algoanim.primitives
Class IntMatrix

java.lang.Object
  extended by algoanim.primitives.Primitive
      extended by algoanim.primitives.MatrixPrimitive
          extended by algoanim.primitives.IntMatrix

public class IntMatrix
extends MatrixPrimitive

IntMatrix manages an internal matrix. Operations on objects of IntMatrix are almost performed like on a simple matrix.

Author:
jens

Field Summary
protected  IntMatrixGenerator generator
          The related IntMatrixGenerator, which is responsible for generating the appropriate scriptcode for operations performed on this object.
 
Fields inherited from class algoanim.primitives.MatrixPrimitive
nrCols, nrRows
 
Fields inherited from class algoanim.primitives.Primitive
gen
 
Constructor Summary
IntMatrix(IntMatrixGenerator iag, Node upperLeftCorner, int[][] matrixData, java.lang.String name, DisplayOptions display, MatrixProperties iap)
          Instantiates the IntMatrix and calls the create() method of the associated IntMatrixGenerator.
 
Method Summary
 int[][] getData()
          Returns the internal int matrix.
 int getElement(int row, int col)
           
 MatrixProperties getProperties()
          Returns the properties of this matrix.
 int[] getRow(int row)
          Returns the data at the given position of the internal matrix.
 Node getUpperLeft()
          Returns the upper left corner of this matrix.
 void highlightCell(int row, int col, Timing offset, Timing duration)
          Highlights the matrix cell at a given position after a distinct offset.
 void highlightCellColumnRange(int row, int startCol, int endCol, Timing offset, Timing duration)
          Highlights a range of array cells of an IntMatrix.
 void highlightCellRowRange(int startRow, int endRow, int col, Timing offset, Timing duration)
          Highlights a range of array cells of an IntMatrix.
 void highlightElem(int row, int col, Timing offset, Timing duration)
          Highlights the matrix element at a given position after a distinct offset.
 void highlightElemColumnRange(int row, int startCol, int endCol, Timing offset, Timing duration)
          Highlights a range of matrix elements.
 void highlightElemRowRange(int startRow, int endRow, int col, Timing offset, Timing duration)
          Highlights a range of array elements of an IntMatrix.
 void put(int row, int col, int what, Timing t, Timing d)
          Puts the value what at position [row][col].
 void setName(java.lang.String newName)
          Sets the name of this Primitive.
 void swap(int sourceRow, int sourceCol, int targetRow, int targetCol, Timing t, Timing d)
          Swaps the elements at index [sourceRow][sourceCol] and [targetRow][targetCol].
 void unhighlightCell(int row, int col, Timing offset, Timing duration)
          Unhighlights the array cell of an IntMatrix at a given position after a distinct offset.
 void unhighlightCellColumnRange(int row, int startCol, int endCol, Timing offset, Timing duration)
          Unhighlights a range of array cells of an IntMatrix.
 void unhighlightCellRowRange(int startRow, int endRow, int col, Timing offset, Timing duration)
          Unhighlights a range of array cells of an IntMatrix.
 void unhighlightElem(int row, int col, Timing offset, Timing duration)
          Unhighlights the matrix element at a given position after a distinct offset.
 void unhighlightElemColumnRange(int row, int startCol, int endCol, Timing offset, Timing duration)
          Unhighlights a range of array elements of an IntMatrix.
 void unhighlightElemRowRange(int startRow, int endRow, int col, Timing offset, Timing duration)
          Unhighlights a range of array elements of an IntMatrix.
 
Methods inherited from class algoanim.primitives.MatrixPrimitive
getNrCols, getNrRows
 
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 IntMatrixGenerator generator
The related IntMatrixGenerator, which is responsible for generating the appropriate scriptcode for operations performed on this object.

Constructor Detail

IntMatrix

public IntMatrix(IntMatrixGenerator iag,
                 Node upperLeftCorner,
                 int[][] matrixData,
                 java.lang.String name,
                 DisplayOptions display,
                 MatrixProperties iap)
Instantiates the IntMatrix and calls the create() method of the associated IntMatrixGenerator.

Parameters:
iag - the appropriate code Generator.
upperLeftCorner - the upper left corner of this IntMatrix.
matrixData - the data of this IntMatrix.
name - the name of this IntMatrix.
display - [optional] the DisplayOptions of this IntMatrix.
iap - [optional] the properties of this IntMatrix.
Method Detail

getElement

public int getElement(int row,
                      int col)

put

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

Parameters:
row - the row position of the element to write.
col - the column position of the element to write.
what - the new value.
t - [optional] the delay which shall be applied to the operation.
d - [optional] the duration this action needs.
Throws:
java.lang.IndexOutOfBoundsException

swap

public void swap(int sourceRow,
                 int sourceCol,
                 int targetRow,
                 int targetCol,
                 Timing t,
                 Timing d)
          throws java.lang.IndexOutOfBoundsException
Swaps the elements at index [sourceRow][sourceCol] and [targetRow][targetCol]. This is the delayed version. The duration of this operation may also be specified.

Parameters:
sourceRow - the row position of the first element to swap.
sourceCol - the column position of the first element to swap.
targetRow - the row position of the second element to swap.
targetCol - the column position of the 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

getData

public int[][] getData()
Returns the internal int matrix.

Returns:
the internal int matrix.

getRow

public int[] getRow(int row)
             throws java.lang.IndexOutOfBoundsException
Returns the data at the given position of the internal matrix.

Parameters:
row - the position where to look for the data.
Returns:
the data at position i in the internal int matrix.
Throws:
java.lang.IndexOutOfBoundsException

getUpperLeft

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

Returns:
the upper left corner of this matrix.

getProperties

public MatrixProperties getProperties()
Returns the properties of this matrix.

Returns:
the properties of this matrix.

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 row,
                          int col,
                          Timing offset,
                          Timing duration)
Highlights the matrix cell at a given position after a distinct offset.

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

highlightCellColumnRange

public void highlightCellColumnRange(int row,
                                     int startCol,
                                     int endCol,
                                     Timing offset,
                                     Timing duration)
Highlights a range of array cells of an IntMatrix.

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

highlightCellRowRange

public void highlightCellRowRange(int startRow,
                                  int endRow,
                                  int col,
                                  Timing offset,
                                  Timing duration)
Highlights a range of array cells of an IntMatrix.

Parameters:
startRow - the start row of the interval to highlight.
endRow - the end row of the interval to highlight.
col - the column 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 row,
                            int col,
                            Timing offset,
                            Timing duration)
Unhighlights the array cell of an IntMatrix at a given position after a distinct offset.

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

unhighlightCellColumnRange

public void unhighlightCellColumnRange(int row,
                                       int startCol,
                                       int endCol,
                                       Timing offset,
                                       Timing duration)
Unhighlights a range of array cells of an IntMatrix.

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

unhighlightCellRowRange

public void unhighlightCellRowRange(int startRow,
                                    int endRow,
                                    int col,
                                    Timing offset,
                                    Timing duration)
Unhighlights a range of array cells of an IntMatrix.

Parameters:
startRow - the start row of the interval to highlight.
endRow - the end row of the interval to highlight.
col - the column of the interval 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 row,
                          int col,
                          Timing offset,
                          Timing duration)
Highlights the matrix element at a given position after a distinct offset.

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

highlightElemColumnRange

public void highlightElemColumnRange(int row,
                                     int startCol,
                                     int endCol,
                                     Timing offset,
                                     Timing duration)
Highlights a range of matrix elements.

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

highlightElemRowRange

public void highlightElemRowRange(int startRow,
                                  int endRow,
                                  int col,
                                  Timing offset,
                                  Timing duration)
Highlights a range of array elements of an IntMatrix.

Parameters:
startRow - the start of the row interval to highlight.
endRow - the end of the row interval to highlight.
col - the column 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 row,
                            int col,
                            Timing offset,
                            Timing duration)
Unhighlights the matrix element at a given position after a distinct offset.

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

unhighlightElemColumnRange

public void unhighlightElemColumnRange(int row,
                                       int startCol,
                                       int endCol,
                                       Timing offset,
                                       Timing duration)
Unhighlights a range of array elements of an IntMatrix.

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

unhighlightElemRowRange

public void unhighlightElemRowRange(int startRow,
                                    int endRow,
                                    int col,
                                    Timing offset,
                                    Timing duration)
Unhighlights a range of array elements of an IntMatrix.

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