FloatNamedArraylist class: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 3: Line 3:
The significant difference is that instead of subscript names for items as in
The significant difference is that instead of subscript names for items as in
the <var>NamedArraylist</var> class, the item subscripts in a <var>FloatNamedArraylist</var> object are
the <var>NamedArraylist</var> class, the item subscripts in a <var>FloatNamedArraylist</var> object are
numeric values. These numeric subscripts are basically like the <var clas="product">Model 204</var> <var>Float</var> datatype, and <var>FloatNamedArraylist</var> items are stored in numeric order by subscript, whereas <var>NamedArraylist</var> items are stored by item name in EBCDIC order.
numeric values. These numeric subscripts are basically like the <var class="product">Model 204</var> <var>Float</var> datatype, and <var>FloatNamedArraylist</var> items are stored in numeric order by subscript, whereas <var>NamedArraylist</var> items are stored by item name in EBCDIC order.


==About the GenericNamedArraylist class==
==About the GenericNamedArraylist class==
Line 9: Line 9:


<div id="FloatNamedArraylist example"><!--in case links to old section name--></div>
<div id="FloatNamedArraylist example"><!--in case links to old section name--></div>
==Example==
==Examples==
The following request demonstrates the numerically ordered
The following request demonstrates the numerically ordered
result produced by a <var>FloatNamedArraylist</var> but not
result produced by a <var>[[NameByNumber (FloatNamedArraylist function)|NameByNumber]]</var> loop over a <var>FloatNamedArraylist</var> versus the alphabetically ordered result using a <var>NamedArraylist</var>:
by a <var>NamedArraylist</var>:
<p class="code">b
<pre style="xmp">
    b
   
   
    %x  is collection namedArraylist of string len 32
%x  is collection namedArraylist of string len 32
    %y  is collection floatNamedArraylist of string len 32
%y  is collection floatNamedArraylist of string len 32
    %i  is float
%i  is float
   
   
    %x = new
%x = new
    %x(7) = 'seven'
%x(7) = 'seven'
    %x(38) = 'thirty-eight'
%x(38) = 'thirty-eight'
    %x(110) = 'one-hundred-ten'
%x(110) = 'one-hundred-ten'
   
   
    %y = new
%y = new
    %y(7) = 'seven'
%y(7) = 'seven'
    %y(38) = 'thirty-eight'
%y(38) = 'thirty-eight'
    %y(110) = 'one-hundred-ten'
%y(110) = 'one-hundred-ten'
   
   
    for %i from 1 to %x:count
for %i from 1 to %x:count
      print %x:nameByNumber(%i) and %x:itemByNumber(%i)
  print %x:nameByNumber(%i) and %x:itemByNumber(%i)
    end for
end for
   
   
    for %i from 1 to %y:count
for %i from 1 to %y:count
      print %y:nameByNumber(%i) and %y:itemByNumber(%i)
  print %y:nameByNumber(%i) and %y:itemByNumber(%i)
    end for
end for
   
   
    end
end
</pre>
</p>
   
   
The request prints:
The request prints:
<pre style="xmp">
<p class="output">
    110 one-hundred-ten
110 one-hundred-ten
    38 thirty-eight
38 thirty-eight
    7 seven
7 seven
    -----
&#45;----
    7 seven
7 seven
    38 thirty-eight
38 thirty-eight
    110 one-hundred-ten
110 one-hundred-ten
</pre>
</p>
For background information about collections and about
declaring collection object variables,
see [[Collections|"Collections"]].
See also [[Collections#Coding considerations for collections|"Coding considerations
for collections"]].
The individual <var>FloatNamedArraylist</var> methods are described in the following subsections.
In the method templates, <tt>%fnamrayl</tt> is used to represent the object
to which the method is being applied, sometimes called the &ldquo;method object&rdquo;
or the &ldquo;method <var>FloatNamedArraylist</var>.&rdquo;
Additional conventions are described in [[Notation conventions for methods|"Notation conventions for methods"]].


==List of FloatNamedArraylist methods==
==List of FloatNamedArraylist methods==
Line 68: Line 54:


==See also==
==See also==
<table>
<table class="thJustBold">
<tr><th>[[List of NamedArraylist methods]]</th>
<tr><th>[[List of NamedArraylist methods]]</th>
<td>For a list of all methods in the <var>NamedArraylist</var> class, with a brief description of each.</td></tr>
<td>For a list of all methods in the <var>NamedArraylist</var> class, with a brief description of each.</td></tr>
<tr><th>[[List of UnicodeNamedArraylist methods]]</th>
<tr><th nowrap>[[List of UnicodeNamedArraylist methods]]</th>
<td>For a list of all methods in the <var>UnicodeNamedArraylist</var> class, with a brief description of each.</td></tr>
<td>For a list of all methods in the <var>UnicodeNamedArraylist</var> class, with a brief description of each.</td></tr>
<tr><th>[[Collections]]</th>
<tr><th>[[Collections]]</th>
Line 80: Line 66:
<td>For tips on using collections.</td></tr>
<td>For tips on using collections.</td></tr>
</table>
</table>
[[Category:System classes]]
[[Category:System classes]]

Latest revision as of 18:35, 26 August 2014

The FloatNamedArraylist class is nearly identical to the NamedArraylist class. The significant difference is that instead of subscript names for items as in the NamedArraylist class, the item subscripts in a FloatNamedArraylist object are numeric values. These numeric subscripts are basically like the Model 204 Float datatype, and FloatNamedArraylist items are stored in numeric order by subscript, whereas NamedArraylist items are stored by item name in EBCDIC order.

About the GenericNamedArraylist class

The FloatNamedArraylist class extends the system GenericNamedArraylist class, so many of the methods available in the FloatNamedArraylist class are documented as belonging to the GenericNamedArraylist class. Any method available in the GenericNamedArraylist class is also available in the FloatNamedArraylist class. The other classes that extend the GenericNamedArraylist class are the NamedArraylist class and the UnicodeNamedArraylist class.

Examples

The following request demonstrates the numerically ordered result produced by a NameByNumber loop over a FloatNamedArraylist versus the alphabetically ordered result using a NamedArraylist:

b %x is collection namedArraylist of string len 32 %y is collection floatNamedArraylist of string len 32 %i is float %x = new %x(7) = 'seven' %x(38) = 'thirty-eight' %x(110) = 'one-hundred-ten' %y = new %y(7) = 'seven' %y(38) = 'thirty-eight' %y(110) = 'one-hundred-ten' for %i from 1 to %x:count print %x:nameByNumber(%i) and %x:itemByNumber(%i) end for for %i from 1 to %y:count print %y:nameByNumber(%i) and %y:itemByNumber(%i) end for end

The request prints:

110 one-hundred-ten 38 thirty-eight 7 seven ----- 7 seven 38 thirty-eight 110 one-hundred-ten

List of FloatNamedArraylist methods

The "List of FloatNamedArraylist methods" shows all the class methods, with a brief description of each.

See also

List of NamedArraylist methods For a list of all methods in the NamedArraylist class, with a brief description of each.
List of UnicodeNamedArraylist methods For a list of all methods in the UnicodeNamedArraylist class, with a brief description of each.
Collections For background information about collections and Arraylists and about declaring Arraylist object variables.
Coding considerations for collections For tips on using collections.