RTI Connext Java API
Version 5.0.0
|
<<interface>> <<generic>> A type-safe, ordered collection of elements. The type of these elements is referred to in this documentation as com.rti.ndds.example.Foo
.
More...
Public Member Functions | |
int | getMaximum () |
Get the current maximum number of elements that can be stored in this sequence. | |
void | setMaximum (int new_max) |
Resize this sequence to a new desired maximum. | |
Class | getElementType () |
<<interface>> <<generic>> A type-safe, ordered collection of elements. The type of these elements is referred to in this documentation as com.rti.ndds.example.Foo
.
For users who define data types in OMG IDL, this type corresponds to the IDL express sequence
<Foo>
.
For any user-data type Foo
that an application defines for the purpose of data-distribution with RTI Connext, a FooSeq
is generated. We refer to an IDL sequence
<Foo>
asFooSeq
.
A sequence is a type-safe List that makes a distinction between its allocated size and its logical size (much like the ArrayList class). The Collection.size() method returns the logical size.
A new sequence is created for elements of a particular Class, which does not change throughout the lifetime of a sequence instance.
To add an element to a sequence, use the add()
method inherited from the standard interface java.util.List
; this will implicitly increase the sequence's size. Or, to pre-allocate space for several elements at once, use com.rti.dds.infrastructure.com.rti.dds.util.Sequence.Sequence.setMaximum.
An attempt to add an element to a sequence that is not of the correct element type will result in a ClassCastException. (Note that null is considered to belong to any type.)
int getMaximum | ( | ) |
Get the current maximum number of elements that can be stored in this sequence.
The maximum
of the sequence represents the maximum number of elements that the underlying buffer can hold. It does not represent the current number of elements.
The maximum
is a non-negative number. It is initialized when the sequence is first created.
The maximum
can be changed implicitly by adding an element to the sequence with add()
, or explicitly by calling com.rti.dds.infrastructure.com.rti.dds.util.Sequence.Sequence.setMaximum.
void setMaximum | ( | int | new_max | ) |
Resize this sequence to a new desired maximum.
This operation does nothing if the new desired maximum matches the current maximum.
Note: If you add an element with add()
, the sequence's size is increased implicitly.
new_max | Must be >= 0. |
Class getElementType | ( | ) |