de.tubs.cs.sc.casim
Class BlockLattice1D

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

public class BlockLattice1D
extends BlockLattice

A lattice for one 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
BlockLattice1D(java.lang.Class state, de.tubs.cs.sc.casim.LatticeDefinition definition)
          Constructor creates a one 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)
          returns the current state at the given coordinates.
 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
 void reversetransition()
          calculates all block patterns and calls reversetransition with the array of BlockStates
 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

BlockLattice1D

public BlockLattice1D(java.lang.Class state,
                      de.tubs.cs.sc.casim.LatticeDefinition definition)
               throws CAException
Constructor creates a one 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)
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

getState

public de.tubs.cs.sc.casim.State getState(int x,
                                          int y)
returns the current state at the given coordinates. It will throw a RuntimeException if the method will be used with a y 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

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 y or 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.

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

transition

public 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

public 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[])