Package org.web3d.vrml.util
Class KeySequence
java.lang.Object
org.web3d.vrml.util.KeySequence
A sequence, much like the collections List interface, specifically
designed for queuing up sequences of Xj3DKeyEvents between
rendering frames.
The methods involved with loading a sequence or manipulating it's underlying array of events are synchronized.
- Version:
- $Revision: 1.1 $
- Author:
- Rex Melton
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Xj3DKeyEvent[]
The array storing key eventsprotected int
The number of key events currently stored -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an instance with the default capacity.KeySequence
(int initialCapacity) Construct an instance with the specified initial capacity. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(Xj3DKeyEvent evt) Add the event to the end of the sequencevoid
clear()
Clear the sequencevoid
ensureCapacity
(int minCapacity) Ensure that the capacity of this sequence is sufficient to contain the specified number of events.get
(int i) Return the key event at the specified index.int
size()
Return the number of events in the sequencevoid
transfer
(KeySequence seq) Move the current contents of this object into the argument sequence object.
-
Field Details
-
index
protected int indexThe number of key events currently stored -
eventArray
The array storing key events
-
-
Constructor Details
-
KeySequence
public KeySequence()Construct an instance with the default capacity. -
KeySequence
public KeySequence(int initialCapacity) Construct an instance with the specified initial capacity.- Parameters:
initialCapacity
- - The initial holding capacity for events.
-
-
Method Details
-
get
Return the key event at the specified index.- Parameters:
i
- - The index of the event to return- Returns:
- The event
- Throws:
IndexOutOfBoundsException
- - if i is out of range ( i < 0 || i >= size( ) ).
-
size
public int size()Return the number of events in the sequence- Returns:
- the number of events in the sequence
-
add
Add the event to the end of the sequence- Parameters:
evt
- - The event
-
clear
public void clear()Clear the sequence -
transfer
Move the current contents of this object into the argument sequence object. Any events currently in the argument sequence will be cleared. The argument sequence's capacity will be increased if it is insufficent to hold the complete set of events. At the end of the transfer, this object will be empty.- Parameters:
seq
- - The KeySequence object to initialize
-
ensureCapacity
public void ensureCapacity(int minCapacity) Ensure that the capacity of this sequence is sufficient to contain the specified number of events.- Parameters:
minCapacity
- the minimum number of events that this sequence must be able to hold.
-