algoanim.primitives
Class ArrayPrimitive

java.lang.Object
  extended by algoanim.primitives.Primitive
      extended by algoanim.primitives.ArrayPrimitive
Direct Known Subclasses:
DoubleArray, IntArray, StringArray

public abstract class ArrayPrimitive
extends Primitive

Base class for all concrete arrays.

Author:
Jens Pfau, Stephan Mehlhase

Field Summary
protected  int length
           
 
Fields inherited from class algoanim.primitives.Primitive
gen
 
Constructor Summary
ArrayPrimitive(GeneratorInterface g, DisplayOptions display)
           
 
Method Summary
 int getLength()
          Returns the length of the internal array.
abstract  void swap(int what, int with, Timing t, Timing d)
          Swaps the elements at index what and with.
 
Methods inherited from class algoanim.primitives.Primitive
changeColor, exchange, getDisplayOptions, getName, hide, hide, moveBy, moveTo, moveVia, rotate, rotate, setName, show, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

length

protected int length
Constructor Detail

ArrayPrimitive

public ArrayPrimitive(GeneratorInterface g,
                      DisplayOptions display)
Parameters:
g - the appropriate code Generator.
display - [optional] the DisplayOptions of this ArrayPrimitive.
Method Detail

getLength

public int getLength()
Returns the length of the internal array.

Returns:
the length of the internal array.

swap

public abstract void swap(int what,
                          int with,
                          Timing t,
                          Timing d)
                   throws java.lang.IndexOutOfBoundsException
Swaps the elements at index what and with. This is the delayed version. The duration of this operation may also be specified.

Parameters:
what - first element to swap.
with - second element to swap.
t - [optional] the delay which shall be applied to the operation.
d - [optional] the duration this action needs.
Throws:
java.lang.IndexOutOfBoundsException