Sequence Interface Reference
[Sequence Support]

<<interface>> <<generic>> A type-safe, ordered collection of elements. The type of these elements is referred to in this documentation as Foo. More...

Inheritance diagram for Sequence:

DynamicDataSeq SampleInfoSeq FooSeq BytesSeq KeyedBytesSeq KeyedStringSeq AbstractPrimitiveSequence AbstractSequence FooSeq

List of all members.

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 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 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.dds.topic.example.FooDataWriter, com.rti.dds.topic.example.FooDataReader, com.rti.dds.topic.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 Sequence.setMaximum.

Returns:
the current maximum of the sequence.
See also:
Sequence.size()

Implemented in BooleanSeq, ByteSeq, CharSeq, ConditionSeq, DoubleSeq, FloatSeq, IntSeq, LongSeq, ShortSeq, PublisherSeq, DataReaderSeq, SubscriberSeq, and LoanableSequence.

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_max Must be >= 0.
Returns:
true on success, false if the preconditions are not met. In that case the sequence is not modified.

Implemented in AbstractSequence, and LoanableSequence.

Class getElementType (  ) 

Returns:
a common supertype for all elements in this sequence.

Implemented in AbstractPrimitiveSequence, and AbstractSequence.


RTI Connext Java API Version 4.5f Copyright © 17 Mar 2012 Real-Time Innovations, Inc