algoanim.primitives
Class StringArray

java.lang.Object
  extended by algoanim.primitives.Primitive
      extended by algoanim.primitives.ArrayPrimitive
          extended by algoanim.primitives.StringArray

public class StringArray
extends ArrayPrimitive

Author:
Jens Pfau, Stephan Mehlhase

Field Summary
protected  StringArrayGenerator generator
          The related IntArrayGenerator, which is responsible for generating the appropriate scriptcode for operations performed on this object.
 
Fields inherited from class algoanim.primitives.ArrayPrimitive
length
 
Fields inherited from class algoanim.primitives.Primitive
gen
 
Constructor Summary
StringArray(StringArrayGenerator sag, Node upperLeftCorner, java.lang.String[] arrayData, java.lang.String name, ArrayDisplayOptions display, ArrayProperties iap)
          Instantiates the StringArray and calls the create() method of the associated StringArrayGenerator.
 
Method Summary
 java.lang.String[] getData()
          Returns the internal data of this StringArray.
 java.lang.String getData(int i)
          Returns the data of the internal array at index i.
 ArrayProperties getProperties()
          Returns the properties of this StringArray.
 Node getUpperLeft()
          Returns the upper left corner of this StringArray.
 void highlightCell(int from, int to, Timing offset, Timing duration)
          Highlights a range of array cells.
 void highlightCell(int position, Timing offset, Timing duration)
          Highlights the array cell at a given position after a distinct offset.
 void highlightElem(int from, int to, Timing offset, Timing duration)
          Highlights a range of array elements.
 void highlightElem(int position, Timing offset, Timing duration)
          Highlights the array element at a given position after a distinct offset.
 void put(int where, java.lang.String what, Timing t, Timing d)
          Puts the value what at position where.
 void setName(java.lang.String newName)
          Sets the name of this Primitive.
 void swap(int what, int with, Timing t, Timing d)
          Swaps the elements at index what and with.
 void unhighlightCell(int from, int to, Timing offset, Timing duration)
          Unhighlights a range of array cells.
 void unhighlightCell(int position, Timing offset, Timing duration)
          Unhighlights the array cell at a given position after a distinct offset.
 void unhighlightElem(int from, int to, Timing offset, Timing duration)
          Unhighlights a range of array elements.
 void unhighlightElem(int position, Timing offset, Timing duration)
          Unhighlights the array element at a given position after a distinct offset.
 
Methods inherited from class algoanim.primitives.ArrayPrimitive
getLength
 
Methods inherited from class algoanim.primitives.Primitive
changeColor, exchange, getDisplayOptions, getName, hide, hide, moveBy, moveTo, moveVia, rotate, rotate, show, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

generator

protected StringArrayGenerator generator
The related IntArrayGenerator, which is responsible for generating the appropriate scriptcode for operations performed on this object.

Constructor Detail

StringArray

public StringArray(StringArrayGenerator sag,
                   Node upperLeftCorner,
                   java.lang.String[] arrayData,
                   java.lang.String name,
                   ArrayDisplayOptions display,
                   ArrayProperties iap)
Instantiates the StringArray and calls the create() method of the associated StringArrayGenerator.

Parameters:
sag - the appropriate code Generator.
upperLeftCorner - the upper left corner of this StringArray.
arrayData - the internal data of this StringArray.
name - the name of this StringArray.
display - [optional] the DisplayOptions for this StringArray.
iap - [optional] the properties of this StringArray.
Method Detail

put

public void put(int where,
                java.lang.String what,
                Timing t,
                Timing d)
         throws java.lang.IndexOutOfBoundsException
Puts the value what at position where. This is the delayed version as specified by t. Additionally the duration of this operation may also be specified.

Parameters:
where - the index of the element to write.
what - the new value.
t - [optional] the delay which shall be applied to the operation.
d - [optional] the duration of this operation.
Throws:
java.lang.IndexOutOfBoundsException

swap

public 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 as specified by t. Additionally the duration of this operation may be specified.

Specified by:
swap in class ArrayPrimitive
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 of this operation.
Throws:
java.lang.IndexOutOfBoundsException

getData

public java.lang.String[] getData()
Returns the internal data of this StringArray.

Returns:
the internal data of this StringArray.

getData

public java.lang.String getData(int i)
                         throws java.lang.IndexOutOfBoundsException
Returns the data of the internal array at index i.

Parameters:
i - the index to access.
Returns:
the data at the specified index.
Throws:
java.lang.IndexOutOfBoundsException

getUpperLeft

public Node getUpperLeft()
Returns the upper left corner of this StringArray.

Returns:
the upper left corner of this StringArray.

getProperties

public ArrayProperties getProperties()
Returns the properties of this StringArray.

Returns:
the properties of this StringArray.

setName

public void setName(java.lang.String newName)
Description copied from class: Primitive
Sets the name of this Primitive.

Overrides:
setName in class Primitive
Parameters:
newName - the new name for this Primitive.
See Also:
Primitive.setName(java.lang.String)

highlightCell

public void highlightCell(int position,
                          Timing offset,
                          Timing duration)
Highlights the array cell at a given position after a distinct offset.

Parameters:
position - the position of the cell to highlight.
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

highlightCell

public void highlightCell(int from,
                          int to,
                          Timing offset,
                          Timing duration)
Highlights a range of array cells.

Parameters:
from - the start of the interval to highlight.
to - the end of the interval to highlight.
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

unhighlightCell

public void unhighlightCell(int position,
                            Timing offset,
                            Timing duration)
Unhighlights the array cell at a given position after a distinct offset.

Parameters:
position - the position of the cell to unhighlight.
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

unhighlightCell

public void unhighlightCell(int from,
                            int to,
                            Timing offset,
                            Timing duration)
Unhighlights a range of array cells.

Parameters:
from - the start of the interval to unhighlight.
to - the end of the interval to unhighlight.
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

highlightElem

public void highlightElem(int position,
                          Timing offset,
                          Timing duration)
Highlights the array element at a given position after a distinct offset.

Parameters:
position - the position of the element to highlight.
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

highlightElem

public void highlightElem(int from,
                          int to,
                          Timing offset,
                          Timing duration)
Highlights a range of array elements.

Parameters:
from - the start of the interval to highlight.
to - the end of the interval to highlight.
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

unhighlightElem

public void unhighlightElem(int position,
                            Timing offset,
                            Timing duration)
Unhighlights the array element at a given position after a distinct offset.

Parameters:
position - the position of the element to unhighlight.
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.

unhighlightElem

public void unhighlightElem(int from,
                            int to,
                            Timing offset,
                            Timing duration)
Unhighlights a range of array elements.

Parameters:
from - the start of the interval to unhighlight.
to - the end of the interval to unhighlight.
offset - [optional] the offset after which the operation shall be started.
duration - [optional] the duration this operation lasts.