gecco.game.dke
Class AutomatonImpl

java.lang.Object
  extended bygecco.server.automaton.Automaton
      extended bygecco.game.dke.AutomatonImpl

public class AutomatonImpl
extends Automaton


Field Summary
 
Fields inherited from class gecco.server.automaton.Automaton
currentColor, x, y
 
Constructor Summary
AutomatonImpl()
           
 
Method Summary
 int getInitialState()
           
 int getLastVisitor()
          Gets the value of lastVisitor
 UnitEvent getUnitEventForCurrentState(String unitType)
          Gets the UnitEvent for the current state of the automaton.
 AutomatonReturn handleEvent(AutomatonEvent event)
          Handles incoming event to the automaton.
 void initialize(int initialState)
          Initialises the automaton.
 boolean isRoute()
           
 boolean isVisited()
           
 void setLastVisitor(int argLastVisitor)
          Sets the value of lastVisitor
 void setLastVisitor(int argLastVisitor, int argX, int argY)
           
 void setVisited(boolean b)
           
 AutomatonReturn update(int[][] neighourStates)
          The update method of the automaton.
 
Methods inherited from class gecco.server.automaton.Automaton
getCurrentColor, getState, hasChanged, setCurrentColor, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutomatonImpl

public AutomatonImpl()
Method Detail

initialize

public void initialize(int initialState)
Description copied from class: Automaton
Initialises the automaton. Is only used by the game engine after the automaton has been dynamically loaded and instanciated.

Overrides:
initialize in class Automaton
Parameters:
initialState - Description of Parameter

update

public AutomatonReturn update(int[][] neighourStates)
Description copied from class: Automaton
The update method of the automaton. The states of the surronding automatons is provided in a 3x3 integer grid. The neighbour to the upper left is [0][0], the neighbour to the upper right is in [2][0].

Specified by:
update in class Automaton
Parameters:
neighourStates - The states of the surrounding automatons, given in a 3x3 integer grid.
Returns:
An AutomatonReturn object

handleEvent

public AutomatonReturn handleEvent(AutomatonEvent event)
Description copied from class: Automaton
Handles incoming event to the automaton.

Specified by:
handleEvent in class Automaton
Parameters:
event - The AutomatonEvent
Returns:
An AutomatonReturn object

getUnitEventForCurrentState

public UnitEvent getUnitEventForCurrentState(String unitType)
Description copied from class: Automaton
Gets the UnitEvent for the current state of the automaton. This method is called when a unit moves over the automaton.

Specified by:
getUnitEventForCurrentState in class Automaton
Parameters:
unitType - The name of the UnitType of the unit that has moved over the automaton
Returns:
The UnitEvent for the current state. May be null if there is no event for this state.

isRoute

public boolean isRoute()

isVisited

public boolean isVisited()

setVisited

public void setVisited(boolean b)

getInitialState

public int getInitialState()

getLastVisitor

public int getLastVisitor()
Gets the value of lastVisitor

Returns:
the value of lastVisitor

setLastVisitor

public void setLastVisitor(int argLastVisitor,
                           int argX,
                           int argY)

setLastVisitor

public void setLastVisitor(int argLastVisitor)
Sets the value of lastVisitor

Parameters:
argLastVisitor - Value to assign to this.lastVisitor