de.tubs.cs.sc.casim
Class TransitionRule

java.lang.Object
  |
  +--de.tubs.cs.sc.casim.TransitionRule
All Implemented Interfaces:
java.io.Serializable

public class TransitionRule
extends java.lang.Object
implements java.io.Serializable

class TransitionRule describing one transition rule in the table

See Also:
StateSetDefinition, TableState, Serialized Form

Constructor Summary
protected TransitionRule()
          Construction constructs an empty TransistionRule all values must be set using appropriate methods
 
Method Summary
protected  boolean doesNeighborhoodMatch(de.tubs.cs.sc.casim.State[] states)
          for simulation returns true, if all neighbors match to the rule returns false, if one or more neighbors mismatch
 int getNeighbor(int i)
          gets the i's neighbor
 int getNewState()
          returns the new state
 int getNrOfNeighbors()
           
 int getState()
          returns the current state
 void setNeighbor(int i, int iState)
          sets the i's neighbor, if the new neighbor is outside the array of neighbors, the array will be enlarged
 void setNewState(int iNewState)
          sets the new state
 void setState(int iState)
          sets the current state
 java.lang.String toString()
          converts the rule to a human readable string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TransitionRule

protected TransitionRule()
Construction constructs an empty TransistionRule all values must be set using appropriate methods

Method Detail

getState

public int getState()
returns the current state


getNewState

public int getNewState()
returns the new state


setState

public void setState(int iState)
sets the current state


setNewState

public void setNewState(int iNewState)
sets the new state


getNrOfNeighbors

public int getNrOfNeighbors()
Returns:
the number of neighbors

getNeighbor

public int getNeighbor(int i)
gets the i's neighbor


setNeighbor

public void setNeighbor(int i,
                        int iState)
sets the i's neighbor, if the new neighbor is outside the array of neighbors, the array will be enlarged


toString

public java.lang.String toString()
converts the rule to a human readable string

Overrides:
toString in class java.lang.Object

doesNeighborhoodMatch

protected boolean doesNeighborhoodMatch(de.tubs.cs.sc.casim.State[] states)
for simulation returns true, if all neighbors match to the rule returns false, if one or more neighbors mismatch