UnicodeNamedArraylist class

From m204wiki
Jump to: navigation, search

The UnicodeNamedArraylist class is nearly identical to the NamedArraylist class. The main difference is that instead of EBCDIC subscript names for items as in the NamedArraylist class, the name subscripts in a UnicodeNamedArraylist object are Unicode values. UnicodeNamedArraylist items are stored by item name in Unicode order, whereas NamedArraylist items are stored by item name in EBCDIC order.

UnicodeNamedArraylists were added in Sirius Mods version 7.6.

Note: The names of UnicodeNamedArraylists are limited to 127 characters (versus 255 bytes for NamedArraylists).

About the GenericNamedArraylist class

The UnicodeNamedArraylist class extends the system GenericNamedArraylist class, so many of the methods available in the UnicodeNamedArraylist class are documented as belonging to the GenericNamedArraylist class. Any method available in the GenericNamedArraylist class is also available in the UnicodeNamedArraylist class.


The following annotated request demonstrates the methods where the distinction between a UnicodeNamedArraylist and a NamedArraylist is significant. The U constant function handily creates Unicode strings in the item name subscripts. Those names also begin with an XHTML entity reference.

b %i is float %k is unicodeNamedArraylist of longstring %m is Arraylist of longstring %k = new * implicit Item method sets list item values: %k('§Jan':u) = 'Orion' %k('§Apr':u) = 'Leo' %k('§Mar':u) = 'Cancer' %k('§Jun':u) = 'Ursa Minor' %k('§Nov':u) = 'Andromeda' %k('§Dec':u) = 'Aries' %k('§Feb':u) = 'Canis Major' * print the value of the item whose name is the Item method argument: print %k:Item('§Jan':u) * print item number of named item: print %k:number('§Nov':u) * print name of each list item, in order of item position from first to last: for %i from 1 to %k:count print %i ': ' %k:nameByNumber(%i) end for * how many items remain after specified item is removed? printText {~} = {%k:removeItem('§Dec':u)} * names and values of list items in order by item position: for %i from 1 to %k:count print %k:nameByNumber(%i) ': ' and %k:itembyNumber(%i) end for * sort list values alphabetically in descending order %m = %k:sortNew(descending(this)) %m:print end

The request prints:

Orion 7 1: §Apr 2: §Dec 3: §Feb 4: §Jan 5: §Jun 6: §Mar 7: §Nov %k:removeItem('§Dec':u) = 6 §Apr: Leo §Feb: Canis Major §Jan: Orion §Jun: Ursa Minor §Mar: Cancer §Nov: Andromeda 1: Ursa Minor 2: Orion 3: Leo 4: Canis Major 5: Cancer 6: Andromeda

List of UnicodeNamedArraylist methods

The "List of UnicodeNamedArraylist 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 FloatNamedArraylist methods For a list of all methods in the FloatNamedArraylist 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.