gecco.game.dke
Class AutomatonImpl

java.lang.Object
  |
  +--gecco.server.automaton.Automaton
        |
        +--gecco.game.dke.AutomatonImpl
All Implemented Interfaces:
ReplayReady
Direct Known Subclasses:
AutomatonImplDKE3

public class AutomatonImpl
extends Automaton
implements ReplayReady


Field Summary
 
Fields inherited from class gecco.server.automaton.Automaton
currentColor, x, y
 
Fields inherited from interface gecco.server.replaymanager.ReplayReady
AUTOMATON, MOVING_ACTION, UNIT
 
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 isBlueZC()
          Gets the value of blueZC
 boolean isRedZC()
          Gets the value of redZC
 boolean isRoute()
           
 boolean isVisited()
           
 void playReplayData(int function, Object[] parameters)
           
 void saveReplayData(int automatonPosX, int automatonPosY, int function, Object[] parameters)
           
 void saveReplayData(int function, Object[] parameters)
           
protected  void setColor(int terrainType)
           
 void setLastVisitor(int argLastVisitor)
          Sets the value of lastVisitor
 void setLastVisitor(int argLastVisitor, int argX, int argY)
           
 void setVisited(boolean b)
           
 void setZC(boolean b, int force, int unitHandle)
           
 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

setColor

protected void setColor(int terrainType)

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

isBlueZC

public boolean isBlueZC()
Gets the value of blueZC

Returns:
the value of blueZC

isRedZC

public boolean isRedZC()
Gets the value of redZC

Returns:
the value of redZC

setZC

public void setZC(boolean b,
                  int force,
                  int unitHandle)

saveReplayData

public void saveReplayData(int function,
                           Object[] parameters)
Specified by:
saveReplayData in interface ReplayReady

saveReplayData

public void saveReplayData(int automatonPosX,
                           int automatonPosY,
                           int function,
                           Object[] parameters)

playReplayData

public void playReplayData(int function,
                           Object[] parameters)
Specified by:
playReplayData in interface ReplayReady