org.vizzini.game.boardgame.action
Class AbstractGridBoardAction

java.lang.Object
  extended by org.vizzini.game.action.AbstractAction
      extended by org.vizzini.game.boardgame.action.AbstractGridBoardAction
All Implemented Interfaces:
Serializable, Comparable, IAction, IGridBoardAction
Direct Known Subclasses:
AbstractMoveAction, PlaceAction, RemoveAction

public abstract class AbstractGridBoardAction
extends AbstractAction
implements IGridBoardAction

Provides base functionality for grid board actions in the game framework. A grid board action instance encapsulates the information necessary for the environment to process the action. Examples are moving a chess piece, placing a token, or capturing a token.

This class participates in the Command pattern as described in Patterns In Java Volume 1, Mark Grand, 1998.

Since:
v0.2
Version:
v0.3
Author:
Jeffrey M. Thompson
See Also:
Serialized Form

Constructor Summary
AbstractGridBoardAction(IGridBoard gridBoard, IAgent agent)
          Construct this object.
 
Method Summary
 void clear()
          Clear the properties of this object.
 boolean equals(Object object)
          Return true if the given object is equal to this.
 IGridBoard getGridBoard()
          Return the gridBoard.
 IntegerPosition getToPosition()
           
 int hashCode()
          Returns a hash code value for the object.
 String prettyPrint()
          Provide a nicely formatted string representation of this object.
protected  void setGridBoard(IGridBoard gridBoard)
          Set the GridBoard.
protected  void setToPosition(IntegerPosition position)
          Set the to position.
 
Methods inherited from class org.vizzini.game.action.AbstractAction
compareTo, doIt, getAgent, getRating, release, setAgent, setRating, toString, undoIt
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.vizzini.game.action.IAction
doIt, getAgent, getRating, release, setAgent, setRating, undoIt
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

AbstractGridBoardAction

public AbstractGridBoardAction(IGridBoard gridBoard,
                               IAgent agent)
Construct this object.

Since:
v0.2
Method Detail

clear

public void clear()
Clear the properties of this object.

Specified by:
clear in interface IAction
Overrides:
clear in class AbstractAction
Since:
v0.3

equals

public boolean equals(Object object)
Return true if the given object is equal to this. This method overrides the super method so that the rating is not considered.

Specified by:
equals in interface IAction
Overrides:
equals in class AbstractAction
Parameters:
object - The object to compare.
Since:
v0.2

getGridBoard

public IGridBoard getGridBoard()
Description copied from interface: IGridBoardAction
Return the gridBoard.

Specified by:
getGridBoard in interface IGridBoardAction
Returns:
Returns the gridBoard.
Since:
v0.2

getToPosition

public IntegerPosition getToPosition()
Specified by:
getToPosition in interface IGridBoardAction
Returns:
Returns the toPosition.
Since:
v0.3

hashCode

public int hashCode()
Returns a hash code value for the object.

Specified by:
hashCode in interface IAction
Overrides:
hashCode in class AbstractAction
Since:
v0.2

prettyPrint

public String prettyPrint()
Provide a nicely formatted string representation of this object.

Specified by:
prettyPrint in interface IAction
Overrides:
prettyPrint in class AbstractAction
Since:
v0.3

setGridBoard

protected void setGridBoard(IGridBoard gridBoard)
Set the GridBoard.

Since:
v0.2

setToPosition

protected void setToPosition(IntegerPosition position)
Set the to position.

Since:
v0.2


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02