| FRAMES NO FRAMES | |||||||
| |||||||
| SUMMARY: IMPORT | CONSTANT | MEMBER | ACTION | DETAIL: IMPORT | CONSTANT | MEMBER | ACTION | ||||||
sequence<TYPE> varnameFor example:
// A sequence to hold the names and volume of all my stocks
// (assuming the StockNameAndPrice event type includes a string
// for stock name and float for the volume)
sequence<StockNameAndPrice> MyPortfolio;
// A sequence to hold a list of prices
sequence<float> myPrices; Note that sequences of sequences (and so on) are also supported. For example:
sequence<sequence<float>> seqOfSeq; A global variable of type sequence is initialized by default to an empty instance of the type defined. On the other hand, you must explicitly initialize a local variable using the new operator, as follows: sequence<integer> someNumbers;
someNumbers := new sequence<integer>; It is also possible to both declare and populate a variable of type sequence as a single statement, regardless of the scope in which the variable is declared, as follows: sequence<integer> someNumbers := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];Use [] to delimit the sequence and a comma (,) to delimit individual elements.
sequenceA sequence variable can be a potentially cyclic type — a type that directly or indirectly refers to itself.si := [1, 2, 3, 4];
integer i;
for i in si {
print i.toString();
}
| Action summary | |
|---|---|
void | append(TYPE item)
Append an item to the sequence. |
void | appendSequence(sequence<TYPE> items)
Append all the items from another sequence to this sequence. |
boolean | static canParse(string s)
Check if the string argument can be successfully parsed as a sequence. |
void | clear()
Set the size of the sequence to 0. |
sequence<TYPE> | clone()
Create a deep copy of this sequence. |
integer | hash()
Get an integer hash representation of the underlying object. |
integer | indexOf(TYPE item)
Find an item within the sequence. |
void | insert(TYPE item, integer index)
Insert an item at a specific location in the sequence. |
sequence<TYPE> | static parse(string s)
Parse a string as a sequence. |
void | remove(integer index)
Remove an entry from the sequence by position. |
void | reverse()
Reverse the order of this sequence. |
void | setCapacity(integer size)
Set the amount of memory allocated for the sequence. |
void | setSize(integer size)
Set the size of the sequence to the specified value. |
integer | size()
Get the size of this sequence. |
void | sort()
Sort this sequence in ascending order. |
string | toString()
Return a string form of this sequence. |
| Action detail |
|---|
void append(TYPE item)
Append an item to the sequence.
void appendSequence(sequence<TYPE> items)
Append all the items from another sequence to this sequence.
boolean static canParse(string s)
Check if the string argument can be successfully parsed as a sequence.
void clear()
Set the size of the sequence to 0.
sequence<TYPE> clone()
Create a deep copy of this sequence.
integer hash()
Get an integer hash representation of the underlying object.
integer indexOf(TYPE item)
Find an item within the sequence.
void insert(TYPE item, integer index)
Insert an item at a specific location in the sequence.
seq.insert(item, seq.size());is equivalent to
seq.append(item);
sequence<TYPE> static parse(string s)
Parse a string as a sequence.
void remove(integer index)
Remove an entry from the sequence by position.
void reverse()
Reverse the order of this sequence.
void setCapacity(integer size)
Set the amount of memory allocated for the sequence.
void setSize(integer size)
Set the size of the sequence to the specified value.
integer size()
Get the size of this sequence.
void sort()
Sort this sequence in ascending order.
string toString()
Return a string form of this sequence.
| FRAMES NO FRAMES | |||||||
| |||||||
| SUMMARY: IMPORT | CONSTANT | MEMBER | ACTION | DETAIL: IMPORT | CONSTANT | MEMBER | ACTION | ||||||