IRISLIB database
AbstractArray Class Reference

An array collection represents an array of data type elements, each of which is associated with a unique key value. More...

Inheritance diagram for AbstractArray:
Collaboration diagram for AbstractArray:

Public Member Functions

_.Library.Status Clear ()
 Clears the contents of the array. More...
 
_.Library.Integer Count ()
 Returns the number of elements contained in the array.
 
_.Library.Boolean Define (_.Library.String key)
 This method is deprecated. More...
 
_.Library.String Find (_.Library.RawString element, _.Library.String key)
 Starting from, but not including, location key,. More...
 
_.Library.RawString GetPrevious (_.Library.String key)
 Finds and returns the value of the element at the location before key More...
 
_.Library.Boolean IsDefined (_.Library.String key)
 Returns true (1) if a value is defined at location key,. More...
 
_.Library.String Previous (_.Library.String key)
 Finds and returns the key value of the element at the location preceding key in the array. More...
 
_.Library.RawString RemoveAt (_.Library.String key)
 Removes the element associated with key in the array. More...
 
_.Library.Status SetAt (_.Library.RawString element, _.Library.String key)
 Sets the value of the element associated with key to element. More...
 
- Public Member Functions inherited from AbstractIterator
_.Library.RawString GetAt (_.Library.RawString key)
 Definition of iterator methods that all our collections classes use to ensure consistency. More...
 
_.Library.RawString GetNext (_.Library.RawString key)
 Finds and returns the value of the element at the location after key More...
 
_.Library.RawString Next (_.Library.RawString key)
 Finds and returns the key value of the element at the location following key in the iteration. More...
 

Static Public Member Functions

_.Library.Status BuildValueArray (_.Library.Binary serialized, _.Library.Binary array)
 Constructs array(key)=value for each element in the serialval value. More...
 
_.Library.String LogicalToOdbc (_.Library.String val, _.Library.String delim, _.Library.String class, _.Library.String method)
 Converts the serial state of this array object to a delimited string. More...
 
_.Library.String OdbcToLogical (_.Library.String val, _.Library.String delim, _.Library.String class, _.Library.String method)
 Converts the value of an incoming delimited string to a serialized state. More...
 

Static Public Attributes

 ELEMENTTYPE = None
 The type (class name) of the elements stored in the collection.
 

Private Member Functions

_.Library.Boolean IsNull ()
 A collection is null if it does not contain any elements.
 

Detailed Description

An array collection represents an array of data type elements, each of which is associated with a unique key value.

Keys can have any value, string or numeric.

The <CLASS>Collection.AbstractArray</CLASS> class provides the basic functionality of the
various array collection classes.

The non-abstract array classes derived from <CLASS>AbstractArray</CLASS> include <CLASS>ArrayOfDataTypes</CLASS>, <CLASS>ArrayOfObjects</CLASS>, <CLASS>Collection.ArrayOfObj</CLASS> and <CLASS>Collection.ArrayOfDT</CLASS>.

You can use an array object as follows:

Set arr=##class(ArrayOfDataTypes).New()

; place items into the array Do arr.SetAt("red","color") Do arr.SetAt("large","size") Do arr.SetAt("expensive","price")

; iterate over contents of array Set key="" For Set value=arr.GetNext(.key) Quit:key="" Write key,":",value,!

Member Function Documentation

◆ BuildValueArray()

_.Library.Status BuildValueArray ( _.Library.Binary  serialized,
_.Library.Binary  array 
)
static

Constructs array(key)=value for each element in the serialval value.

Returns a <CLASS>Status</CLASS> value indicating success or failure.

◆ Clear()

_.Library.Status Clear ( )

Clears the contents of the array.

Returns a <CLASS>Status</CLASS> value indicating success or failure.

Reimplemented in ArrayOfObjects, and ArrayOfDataTypes.

◆ Define()

This method is deprecated.

Please use <METHOD>IsDefined</METHOD> instead.

Reimplemented in ArrayOfObj, and ArrayOfDT.

◆ Find()

Starting from, but not including, location key,.

finds the next element in the array with value equal to element.

If key is a null string (""), the search starts at the beginning of the array.

Find returns the key associated with the found element or null string ("") if no element is found.

◆ GetPrevious()

_.Library.RawString GetPrevious ( _.Library.String  key)

Finds and returns the value of the element at the location before key

in the array. If key is a null string (""), it returns the value of the last element in the array.

The value of key, which is passed by reference, is updated to the key value of the returned element or null string ("") if key is at the beginning of the array.

Reimplemented in ArrayOfObj, ArrayOfDT, AbstractArrayOfObj, and AbstractArrayOfDT.

◆ IsDefined()

_.Library.Boolean IsDefined ( _.Library.String  key)

Returns true (1) if a value is defined at location key,.

otherwise false (0).

Reimplemented in ArrayOfObj, and ArrayOfDT.

◆ LogicalToOdbc()

_.Library.String LogicalToOdbc ( _.Library.String  val,
_.Library.String  delim,
_.Library.String  class,
_.Library.String  method 
)
static

Converts the serial state of this array object to a delimited string.

using delim as a delimiter.

◆ OdbcToLogical()

_.Library.String OdbcToLogical ( _.Library.String  val,
_.Library.String  delim,
_.Library.String  class,
_.Library.String  method 
)
static

Converts the value of an incoming delimited string to a serialized state.

using delim as a delimiter.

◆ Previous()

Finds and returns the key value of the element at the location preceding key in the array.

If key is a null string (""), then <METHOD>Previous</METHOD> returns the key value for the last element in the array.

Reimplemented in ArrayOfObj, and ArrayOfDT.

◆ RemoveAt()

Removes the element associated with key in the array.

RemoveAt returns the value of the removed element or null string ("") if no element was removed.

Reimplemented in ArrayOfDT, and AbstractArrayOfDT.

◆ SetAt()

Sets the value of the element associated with key to element.

Returns a <CLASS>Status</CLASS> value indicating success or failure.