RTI Connext Java API  Version 5.2.0
 All Classes Namespaces Functions Variables Groups Pages
Sequence Interface Reference

<<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...

Inheritance diagram for Sequence:
DynamicDataSeq SampleInfoSeq BytesSeq KeyedBytesSeq KeyedStringSeq AbstractPrimitiveSequence AbstractSequence FooSeq

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 ()
 

Detailed Description

<<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> as FooSeq.

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.)

See Also
com.rti.ndds.example.FooDataWriter, com.rti.ndds.example.FooDataReader, com.rti.ndds.example.FooTypeSupport, rtiddsgen

Member Function Documentation

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.

Returns
the current maximum of the sequence.
See Also
com.rti.dds.infrastructure.com.rti.dds.util.Sequence.Sequence.size()
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.

Postcondition
length == MINIMUM(original length, new_max)
Parameters
new_maxMust be >= 0.
Returns
com.rti.dds.infrastructure.true on success, com.rti.dds.infrastructure.false if the preconditions are not met. In that case the sequence is not modified.
Class getElementType ( )
Returns
a common supertype for all elements in this sequence.

RTI Connext Java API Version 5.2.0 Copyright © Sun Jun 21 2015 Real-Time Innovations, Inc