|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.tubs.cs.sc.casim.CALocal
The class CALocal represents and capsulates a Cellular Automaton. It has a lattice, the state class and a generation counter as it's members.
A Cellular Automaton is characterized by it's lattice construction and the transition function The lattice contains the collection of cells of the automaton. It's structure depends on the construction parameters of the automaton. The CALocal holds only a reference to the base class Lattice of all lattices. The behaviour of the lattice is implemented in derived classes. You define a new lattice using setLatticeDefinition. You can create the lattice using initialize.
The transition function is defined by State class. You can define the state class of the automaton using setState or setStateSetDefinition. Using setState you must provide a class derived from State, which overrides at least the transition method of State to define your own transition function. Using setStateSetDefinition you can use StateSetDefinition for your automaton. The automat uses TableState as the from State derived class. StateSetDefinition provides two tables. One table provides a function from the integer state of the cell to a Color in which the cell will be painted. The other table contains transition rules for the transition of the cellular automaton.
Steps to create and execute an CA
Lattice
,
State
,
LatticeDefinition
,
StateSetDefinition
,
Serialized FormField Summary |
Fields inherited from interface de.tubs.cs.sc.casim.CellularAutomaton |
HEXAGONAL, SQUARE, TRIANGLE |
Constructor Summary | |
CALocal()
Constructor I Creates an empty CA. |
|
CALocal(de.tubs.cs.sc.casim.CADescription desc)
|
|
CALocal(de.tubs.cs.sc.casim.LatticeDefinition ldef,
java.lang.Class cls)
Constructor II Creates a CA with the given parameters. |
|
CALocal(de.tubs.cs.sc.casim.LatticeDefinition ldef,
de.tubs.cs.sc.casim.StateSetDefinition ssd)
Constructor III Creates a CA with the given parameters. |
Method Summary | |
void |
backup()
after waiting for all boundary handlers readyForBackup. |
void |
doBackStep()
executes one generation step back of the Block CA. |
void |
doNSteps(int n)
Steps the CA n generations forward. |
void |
doStep()
executes one generation step of the CA. |
de.tubs.cs.sc.casim.BoundaryHandler |
getBoundaryHandler(int dim,
boolean dir)
|
int |
getDimension()
|
int |
getGeneration()
|
int |
getGeometry()
|
de.tubs.cs.sc.casim.Lattice |
getLattice()
|
de.tubs.cs.sc.casim.LatticeDefinition |
getLatticeDefinition()
|
de.tubs.cs.sc.casim.State |
getOldState(int x)
|
de.tubs.cs.sc.casim.State |
getOldState(int x,
int y)
|
de.tubs.cs.sc.casim.State |
getOldState(int x,
int y,
int z)
|
java.lang.String |
getSizeString()
|
de.tubs.cs.sc.casim.State |
getState(int x)
|
de.tubs.cs.sc.casim.State |
getState(int x,
int y)
|
de.tubs.cs.sc.casim.State |
getState(int x,
int y,
int z)
|
java.lang.Class |
getStateClass()
|
de.tubs.cs.sc.casim.StateSetDefinition |
getStateSetDefinition()
|
int |
getX()
|
int |
getY()
|
int |
getZ()
|
void |
initialize()
initializes the CA. |
boolean |
isBlockCA()
checks wether the state class implements the BlockState interface or not. |
boolean |
isInitialized()
|
void |
out(java.io.PrintWriter p)
prints out the whole lattice in {} format |
void |
reset()
Resets the CA into start condition by resetting the lattice and generation counter. |
void |
setDescription(de.tubs.cs.sc.casim.CADescription desc)
Every class that implements this interface can inherit his own CADescription, use this method to configure the respective class with his configuration. |
void |
setLatticeDefinition(de.tubs.cs.sc.casim.LatticeDefinition ldef)
setLatticeDefinition is used to define a new lattice. |
void |
setStateClass(java.lang.Class cls)
Sets the state class for the CA. |
void |
setStateSetDefinition(de.tubs.cs.sc.casim.StateSetDefinition ssd)
setStateSetDefinition is used to create a table driven CA. |
void |
transition()
after waiting for all boundary handlers readyForTransition. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CALocal()
setLatticeDefinition(de.tubs.cs.sc.casim.LatticeDefinition)
,
setStateClass(java.lang.Class)
,
setStateSetDefinition(de.tubs.cs.sc.casim.StateSetDefinition)
,
initialize()
public CALocal(de.tubs.cs.sc.casim.CADescription desc)
public CALocal(de.tubs.cs.sc.casim.LatticeDefinition ldef, java.lang.Class cls)
ldef
- the Lattice definition parameterscls
- the state classLatticeDefinition
,
State
,
initialize()
public CALocal(de.tubs.cs.sc.casim.LatticeDefinition ldef, de.tubs.cs.sc.casim.StateSetDefinition ssd)
ldef
- the Lattice definition parametersssd
- the State set definitionStateSetDefinition
,
LatticeDefinition
,
State
Method Detail |
public de.tubs.cs.sc.casim.LatticeDefinition getLatticeDefinition()
getLatticeDefinition
in interface CellularAutomaton
LatticeDefinition
public void setStateClass(java.lang.Class cls)
setStateClass
in interface CellularAutomaton
CellularAutomaton.setStateClass(java.lang.Class)
,
setLatticeDefinition(de.tubs.cs.sc.casim.LatticeDefinition)
,
setStateSetDefinition(de.tubs.cs.sc.casim.StateSetDefinition)
,
State
,
BlockState
public void setDescription(de.tubs.cs.sc.casim.CADescription desc)
CellularAutomaton
setDescription
in interface CellularAutomaton
CADescription
public void setStateSetDefinition(de.tubs.cs.sc.casim.StateSetDefinition ssd)
setStateSetDefinition
in interface CellularAutomaton
initialize()
,
setLatticeDefinition(de.tubs.cs.sc.casim.LatticeDefinition)
,
setStateClass(java.lang.Class)
,
StateSetDefinition
public de.tubs.cs.sc.casim.StateSetDefinition getStateSetDefinition()
getStateSetDefinition
in interface CellularAutomaton
StateSetDefinition
public void setLatticeDefinition(de.tubs.cs.sc.casim.LatticeDefinition ldef)
setLatticeDefinition
in interface CellularAutomaton
initialize()
,
LatticeDefinition
,
Lattice
,
doStep()
public de.tubs.cs.sc.casim.Lattice getLattice()
Lattice
public java.lang.Class getStateClass()
getStateClass
in interface CellularAutomaton
State
,
BlockState
public de.tubs.cs.sc.casim.State getState(int x)
getState
in interface CellularAutomaton
State
public de.tubs.cs.sc.casim.State getState(int x, int y)
getState
in interface CellularAutomaton
State
public de.tubs.cs.sc.casim.State getState(int x, int y, int z)
getState
in interface CellularAutomaton
State
public de.tubs.cs.sc.casim.State getOldState(int x)
getOldState
in interface CellularAutomaton
State
public de.tubs.cs.sc.casim.State getOldState(int x, int y)
getOldState
in interface CellularAutomaton
State
public de.tubs.cs.sc.casim.State getOldState(int x, int y, int z)
getOldState
in interface CellularAutomaton
State
public void backup()
backup
in interface CellularAutomaton
Lattice.backup()
,
Cell.backup()
,
State.copy(de.tubs.cs.sc.casim.State)
,
BoundaryHandler.readyForBackup(int)
public void transition() throws java.lang.IllegalStateException
transition
in interface CellularAutomaton
java.lang.IllegalStateException
backup()
,
doStep()
,
Lattice.transition()
,
Cell.transition()
,
State.transition(de.tubs.cs.sc.casim.Cell)
,
BlockState.transition(de.tubs.cs.sc.casim.BlockState[])
,
BoundaryHandler.readyForTransition(int)
public void doStep()
doStep
in interface CellularAutomaton
Lattice.backup()
,
Lattice.transition()
,
BoundaryHandler.readyForBackup(int)
,
BoundaryHandler.readyForTransition(int)
public void doBackStep()
doBackStep
in interface CellularAutomaton
isBlockCA()
,
BlockState.reversetransition(de.tubs.cs.sc.casim.BlockState[])
public void doNSteps(int n)
doNSteps
in interface CellularAutomaton
CellularAutomaton.initialize()
public void reset() throws CAException
reset
in interface CellularAutomaton
CAException
CellularAutomaton.initialize()
public void initialize() throws CAException
initialize
in interface CellularAutomaton
CAException
setLatticeDefinition(de.tubs.cs.sc.casim.LatticeDefinition)
,
setStateClass(java.lang.Class)
,
setStateSetDefinition(de.tubs.cs.sc.casim.StateSetDefinition)
public boolean isInitialized()
isInitialized
in interface CellularAutomaton
initialize()
public int getDimension()
getDimension
in interface CellularAutomaton
public java.lang.String getSizeString()
getSizeString
in interface CellularAutomaton
public int getX()
getX
in interface CellularAutomaton
public int getY()
getY
in interface CellularAutomaton
public int getZ()
getZ
in interface CellularAutomaton
public int getGeometry()
getGeometry
in interface CellularAutomaton
public de.tubs.cs.sc.casim.BoundaryHandler getBoundaryHandler(int dim, boolean dir)
getBoundaryHandler
in interface CellularAutomaton
BoundaryHandler
public int getGeneration()
getGeneration
in interface CellularAutomaton
CellularAutomaton.doStep()
public boolean isBlockCA()
isBlockCA
in interface CellularAutomaton
public void out(java.io.PrintWriter p)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |