LoanableSequence Class Reference

A sequence capable of storing its elements directly or taking out a loan on them from an internal middleware store. More...

Inheritance diagram for LoanableSequence:

AbstractSequence Sequence SampleInfoSeq FooSeq BytesSeq KeyedBytesSeq KeyedStringSeq FooSeq

List of all members.

Public Member Functions

 LoanableSequence (Class elementType)
 Construct a new sequence for elements of the given type.
 LoanableSequence (Class elementType, int maximum)
 Construct a new sequence for elements of the given type.
 LoanableSequence (Class elementType, Collection elements)
 Construct a new sequence for elements of the given type.
final boolean hasOwnership ()
 Return the value of the owned flag.
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.
Object set (int index, Object element)
 Replaces the element at the specified position in this sequence with the specified element.
Object get (int index)
 Returns the element at the specified position in this sequence.
int size ()
 Returns the length of the sequence.


Detailed Description

A sequence capable of storing its elements directly or taking out a loan on them from an internal middleware store.

See also:
com.rti.dds.subscription.DataReader.read_untyped(java.util.List, com.rti.dds.subscription.SampleInfoSeq, int, int, int, int)

com.rti.dds.subscription.DataReader.take_untyped(java.util.List, com.rti.dds.subscription.SampleInfoSeq, int, int, int, int)


Constructor & Destructor Documentation

LoanableSequence ( Class  elementType  ) 

Construct a new sequence for elements of the given type.

LoanableSequence ( Class  elementType,
int  maximum 
)

Construct a new sequence for elements of the given type.

LoanableSequence ( Class  elementType,
Collection  elements 
)

Construct a new sequence for elements of the given type.


Member Function Documentation

final boolean hasOwnership (  ) 

Return the value of the owned flag.

Returns:
true if sequence owns the underlying buffer, or false if it has an outstanding loan.

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

Implements Sequence.

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.

Reimplemented from AbstractSequence.

Object set ( int  index,
Object  element 
)

Replaces the element at the specified position in this sequence with the specified element.

See also:
java.util.List.set(int, java.lang.Object)

Object get ( int  index  ) 

Returns the element at the specified position in this sequence.

See also:
java.util.List.get(int)

int size (  ) 

Returns the length of the sequence.

See also:
java.util.List.get(int)


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