genegui
Class CellState

java.lang.Object
  extended bygenegui.CellState

public class CellState
extends java.lang.Object

CellState.java A class used in conjuction with ModelState. Represents the state of all the nodes in a cell and its position.


Constructor Summary
CellState()
          Simple constructor does little to be proud of.
CellState(int size)
          Main constructor assigns a 0 value to all nodes.
 
Method Summary
 CellState cloneState()
          Makes a clone of this CellState instance and returns it as a new CellState instance.
 java.awt.geom.Point2D.Float getCellPosition()
          Returns the location of the cell.
 float getNodeValue(int index)
          Returns the value of a single node for this cell.
 float[] getNodeValueArray()
          Returns an array with the values of all the nodes for this cell.
 void reset()
          Resets all node values for this cell to 0.
 void setCellPosition(java.awt.geom.Point2D.Float position)
          Sets the location of the cell.
 void setCellState(CellState state)
          Sets the state of this cell by copying it from the another cell state passed as an argument.
 void setNodeValue(int index, float value)
          Sets the value of a node for this cell.
 void setNodeValueArray(float[] values)
          Sets the values of all the nodes for this cell based upon an array of values passed to it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CellState

public CellState()
Simple constructor does little to be proud of. Used primarily by the cloneState operation.


CellState

public CellState(int size)
Main constructor assigns a 0 value to all nodes. int size - The number od nodes.

Method Detail

cloneState

public CellState cloneState()
Makes a clone of this CellState instance and returns it as a new CellState instance.

Returns:
CellState - A clone of the state.

getCellPosition

public java.awt.geom.Point2D.Float getCellPosition()
Returns the location of the cell. resturn Point2D.Float - Current position of the cell.


getNodeValue

public float getNodeValue(int index)
Returns the value of a single node for this cell.

Returns:
float - The value of the node.

getNodeValueArray

public float[] getNodeValueArray()
Returns an array with the values of all the nodes for this cell.

Returns:
float[] - The values of all the nodes for this cell.

setCellPosition

public void setCellPosition(java.awt.geom.Point2D.Float position)
Sets the location of the cell.


setCellState

public void setCellState(CellState state)
Sets the state of this cell by copying it from the another cell state passed as an argument.


setNodeValue

public void setNodeValue(int index,
                         float value)
Sets the value of a node for this cell.


setNodeValueArray

public void setNodeValueArray(float[] values)
Sets the values of all the nodes for this cell based upon an array of values passed to it.


reset

public void reset()
Resets all node values for this cell to 0.