RTI Connext Java API  Version 6.1.1

<<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 FooSeq:
LoanableSequence Sequence Copyable AbstractSequence Sequence

Public Member Functions

Object copy_from (Object src)
 
- Public Member Functions inherited from LoanableSequence
 LoanableSequence (Class elementType)
 Construct a new sequence for elements of the given type. More...
 
 LoanableSequence (Class elementType, int maximum)
 Construct a new sequence for elements of the given type. More...
 
 LoanableSequence (Class elementType, Collection elements)
 Construct a new sequence for elements of the given type. More...
 
final boolean hasOwnership ()
 Return the value of the owned flag. More...
 
int getMaximum ()
 Get the current maximum number of elements that can be stored in this sequence. More...
 
void setMaximum (int new_max)
 Resize this sequence to a new desired maximum. More...
 
Object set (int index, Object element)
 Replaces the element at the specified position in this sequence with the specified element. More...
 
Object get (int index)
 Returns the element at the specified position in this sequence. More...
 
int size ()
 Returns the length of the sequence. More...
 
- Public Member Functions inherited from AbstractSequence
void setMaximum (int new_max)
 Resize this sequence to a new desired maximum. More...
 
Class getElementType ()
 
void add (int index, Object element)
 Inserts the specified element at the specified position in this sequence. More...
 
boolean add (Object element)
 Appends the specified element to the end of this sequence. More...
 
final Object remove (int index)
 Remove the element at the given index by shifting all subsequent elements "left" by one. More...
 

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

◆ copy_from()

Object copy_from ( Object  src)

Copy data into this object from another. The result of this method is that both this and src will be the same size and contain the same data.

Parameters
srcThe Object which contains the data to be copied
Returns
this
Exceptions
NullPointerExceptionIf src is null.
ClassCastExceptionIf src is not a Sequence OR if one of the objects contained in the Sequence is not of the expected type.
See also
com.rti.dds.infrastructure.Copyable::copy_from(java.lang.Object)

Implements Copyable.

References AbstractSequence.add(), LoanableSequence.getMaximum(), LoanableSequence.setMaximum(), and LoanableSequence.size().