Xj3D 2.0 VRML/X3D Code API

org.web3d.vrml.util
Class KeySequence

java.lang.Object
  extended by org.web3d.vrml.util.KeySequence

public class KeySequence
extends java.lang.Object

A sequence, much like the collections List interface, specifically designed for queueing 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
protected  Xj3DKeyEvent[] eventArray
          The array storing key events
protected  int index
          The number of key events currently stored
 
Constructor Summary
KeySequence()
          Construct an instance with the default capacity.
KeySequence(int initialCapacity)
          Construct an instance with the specified initial capacity.
 
Method Summary
 void add(Xj3DKeyEvent evt)
          Add the event to the end of the sequence
 void clear()
          Clear the sequence
 void ensureCapacity(int minCapacity)
          Ensure that the capacity of this sequence is sufficient to contain the specified number of events.
 Xj3DKeyEvent get(int i)
          Return the key event at the specified index.
 int size()
          Return the number of events in the sequence
 void transfer(KeySequence seq)
          Move the current contents of this object into the argument sequence object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

index

protected int index
The number of key events currently stored


eventArray

protected Xj3DKeyEvent[] eventArray
The array storing key events

Constructor Detail

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 Detail

get

public Xj3DKeyEvent get(int i)
Return the key event at the specified index.

Parameters:
i - - The index of the event to return
Returns:
The event
Throws:
java.lang.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

public void add(Xj3DKeyEvent evt)
Add the event to the end of the sequence

Parameters:
evt - - The event

clear

public void clear()
Clear the sequence


transfer

public void transfer(KeySequence seq)
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.

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium