The Sequence class implements a thread-safe increment-only object.
Table 4.962. Sequence Method Overview
Method | Except? | Description |
---|---|---|
N | Creates a new Sequence object. | |
N | Destroys the Sequence object. | |
N | Creates a new Sequence object, not based on the original. | |
N | Atomically increments the counter and returns the last value. | |
N | Returns the current value of the counter. |
Creates a new Sequence object.
new Sequence([start]
)
$seq = new Sequence();
Table 4.963. Arguments for Sequence::constructor()
Argument | Type | Description |
---|---|---|
| Integer | Optional start number for the sequence (default = 0). |
Table 4.964. Return Values for Sequence::constructor()
Return Type | Description |
---|---|
Sequence Object | The new object created. |
Creates a new Sequence object, not based on the original.
Sequence::copy()
$new_seq = $seq.copy();
Table 4.965. Arguments for Sequence::copy()
Argument | Type | Description |
---|---|---|
n/a | n/a | This method takes no arguments. |
Table 4.966. Return Values for Sequence::copy()
Return Type | Description |
---|---|
Sequence Object | A new Sequence object, not based on the original. |
Atomically increments the counter and returns the last value.
Sequence::next()
$seq.next();
Table 4.967. Arguments for Sequence::next()
Argument | Type | Description |
---|---|---|
n/a | n/a | This method takes no arguments. |
Table 4.968. Return Values for Sequence::next()
Return Type | Description |
---|---|
Integer | The last value of the sequence. |
Returns the current value of the counter.
Sequence::getCurrent()
$num = $seq.getCurrent();
Table 4.969. Arguments for Sequence::getCurrent()
Argument | Type | Description |
---|---|---|
n/a | n/a | This method takes no arguments. |
Table 4.970. Return Values for Sequence::getCurrent()
Return Type | Description |
---|---|
Integer | The current value of the counter. |