de.tubs.cs.sc.casim
Class BlockLattice2D

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

public class BlockLattice2D
extends BlockLattice

A lattice for two dimensional Block CA's

See Also:
Serialized Form

Field Summary
 
Fields inherited from class de.tubs.cs.sc.casim.BlockLattice
blockDims, blockNo, blocks, blockStates
 
Fields inherited from class de.tubs.cs.sc.casim.Lattice
boundaryHandler, lx, ly, lz
 
Constructor Summary
BlockLattice2D(java.lang.Class state, de.tubs.cs.sc.casim.LatticeDefinition definition)
          Constructor creates a two dimensional array of State, initializes lattice and block sizes
 
Method Summary
 int getDimension()
           
 de.tubs.cs.sc.casim.State getOldState(int x, int y, int z)
          returns the state at the given coordinates using boundary handlers.
 de.tubs.cs.sc.casim.State getState(int x)
          will always throw a RuntimeException if the method will be used.
 de.tubs.cs.sc.casim.State getState(int x, int y)
          returns the current state at the given coordinates.
 de.tubs.cs.sc.casim.State getState(int x, int y, int z)
          returns the current state at the given coordinates.
protected  void reset()
          recreates the whole CA by creating new States initializes the lattice
protected  void reversetransition()
          calculates all block patterns and calls reversetransition with the array of BlockStates
protected  void transition()
          calculates all block patterns and calls transition with the array of BlockStates
 
Methods inherited from class de.tubs.cs.sc.casim.BlockLattice
backup, defineNeighborsArbitrary, initBlock
 
Methods inherited from class de.tubs.cs.sc.casim.Lattice
addBoundaryHandler, beginBlock, callAnalyze, callInitialize, endBlock, finish, getBoundaryHandler, getDefinition, getStateClass, getX, getY, getZ, setNeighborhood, waitForReadyForBackup, waitForReadyForTransition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockLattice2D

public BlockLattice2D(java.lang.Class state,
                      de.tubs.cs.sc.casim.LatticeDefinition definition)
               throws CAException
Constructor creates a two dimensional array of State, initializes lattice and block sizes

Method Detail

reset

protected void reset()
              throws CAException
recreates the whole CA by creating new States initializes the lattice

Overrides:
reset in class BlockLattice
CAException

getDimension

public int getDimension()
Specified by:
getDimension in class Lattice
Returns:
the dimension of the lattice

getState

public de.tubs.cs.sc.casim.State getState(int x)
will always throw a RuntimeException if the method will be used.

Specified by:
getState in class Lattice
Returns:
the current state at position x

getState

public de.tubs.cs.sc.casim.State getState(int x,
                                          int y)
returns the current state at the given coordinates. getState should be used in State's override initialize to init all states of the CA. The returned reference must be casted to a class derived from abstract class State.

Specified by:
getState in class Lattice
Returns:
the current state at position x,y

getState

public de.tubs.cs.sc.casim.State getState(int x,
                                          int y,
                                          int z)
returns the current state at the given coordinates. It will throw a RuntimeException if the method will be used with a z parameter not equal 0. getState should be used in State's override initialize to init all states of the CA. The returned reference must be casted to a class derived from abstract class State.

Specified by:
getState in class Lattice
Returns:
the current state at position x,y,z

getOldState

public de.tubs.cs.sc.casim.State getOldState(int x,
                                             int y,
                                             int z)
returns the state at the given coordinates using boundary handlers. y and z are ignored for one dimensional lattices, z is ignored for two dimensional lattices.

Specified by:
getOldState in class Lattice
Returns:
the old state at position x,y,z
See Also:
BoundaryHandler.getOutsideState(int)

transition

protected final void transition()
calculates all block patterns and calls transition with the array of BlockStates

Overrides:
transition in class BlockLattice
See Also:
BlockState.transition(de.tubs.cs.sc.casim.BlockState[])

reversetransition

protected final void reversetransition()
calculates all block patterns and calls reversetransition with the array of BlockStates

Overrides:
reversetransition in class BlockLattice
See Also:
BlockState.reversetransition(de.tubs.cs.sc.casim.BlockState[])