org.vizzini.ui.game.boardgame
Class MovementMouseAgent

java.lang.Object
  extended by org.vizzini.game.AbstractAgent
      extended by org.vizzini.game.AbstractHumanAgent
          extended by org.vizzini.ui.game.boardgame.MovementMouseAgent
All Implemented Interfaces:
MouseListener, Serializable, EventListener, IAgent, IHumanAgent
Direct Known Subclasses:
MouseAgent

public class MovementMouseAgent
extends AbstractHumanAgent
implements MouseListener

Provides a user interface for a human agent which uses the mouse to move a token.

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

Field Summary
protected  int _desiredPositionCount
          Number of positions to complete a move.
protected  List _positions
          Mouse positions.
protected  StatusManager _statusManager
          Status manager.
 
Fields inherited from interface org.vizzini.game.IAgent
NAME_PROPERTY, TEAM_PROPERTY
 
Constructor Summary
MovementMouseAgent()
           
 
Method Summary
 void addStatusListener(IStatusListener listener)
          Add a status listener.
protected  IAction createAction(IEnvironment environment)
          Create the appropriate action.
 IAction getAction(IEnvironment environment, IAdjudicator adjudicator)
          Return the action determined through consideration of the given environment and the given adjudicator.
protected  StatusManager getStatusManager()
          Return the status manager.
 void mouseClicked(MouseEvent event)
          Implement the mouse listener interface.
 void mouseEntered(MouseEvent event)
          Implement the mouse listener interface.
 void mouseExited(MouseEvent event)
          Implement the mouse listener interface.
 void mousePressed(MouseEvent event)
          Implement the mouse listener interface.
 void mouseReleased(MouseEvent event)
          Implement the mouse listener interface.
 void reset()
          Reset to the initial state.
 void setDesiredPositionCount(int desiredPositionCount)
          Set the desired position count.
 
Methods inherited from class org.vizzini.game.AbstractHumanAgent
beep
 
Methods inherited from class org.vizzini.game.AbstractAgent
addConcedeListener, addPropertyChangeListener, addScoreListener, addToScore, concede, configure, equals, getConcedeManager, getIndex, getName, getProperties, getPropertyChangeManager, getScore, getScoreManager, getTeam, getTokenCollection, getTokenCollectionClass, hashCode, incrementScore, removeConcedeListener, removePropertyChangeListener, removeScoreListener, setName, setScore, setTeam, setTokenCollectionClass, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.vizzini.game.IAgent
addConcedeListener, addPropertyChangeListener, addScoreListener, addToScore, concede, configure, getName, getScore, getTeam, getTokenCollection, incrementScore, removeConcedeListener, removePropertyChangeListener, removeScoreListener, setName, setScore, setTeam
 

Field Detail

_desiredPositionCount

protected int _desiredPositionCount
Number of positions to complete a move.


_positions

protected List _positions
Mouse positions.


_statusManager

protected transient StatusManager _statusManager
Status manager.

Constructor Detail

MovementMouseAgent

public MovementMouseAgent()
Method Detail

addStatusListener

public void addStatusListener(IStatusListener listener)
Add a status listener.

Since:
v0.2

getAction

public IAction getAction(IEnvironment environment,
                         IAdjudicator adjudicator)
Return the action determined through consideration of the given environment and the given adjudicator.

Specified by:
getAction in interface IAgent
Parameters:
environment - The current environment.
adjudicator - The adjudicator.
Since:
v0.2

mouseClicked

public void mouseClicked(MouseEvent event)
Implement the mouse listener interface.

Specified by:
mouseClicked in interface MouseListener
Parameters:
event - A mouse event.
Since:
v0.2

mouseEntered

public void mouseEntered(MouseEvent event)
Implement the mouse listener interface.

Specified by:
mouseEntered in interface MouseListener
Parameters:
event - A mouse event.
Since:
v0.2

mouseExited

public void mouseExited(MouseEvent event)
Implement the mouse listener interface.

Specified by:
mouseExited in interface MouseListener
Parameters:
event - A mouse event.
Since:
v0.2

mousePressed

public void mousePressed(MouseEvent event)
Implement the mouse listener interface.

Specified by:
mousePressed in interface MouseListener
Parameters:
event - A mouse event.
Since:
v0.2

mouseReleased

public void mouseReleased(MouseEvent event)
Implement the mouse listener interface.

Specified by:
mouseReleased in interface MouseListener
Parameters:
event - A mouse event.
Since:
v0.2

reset

public void reset()
Reset to the initial state.

Specified by:
reset in interface IAgent
Overrides:
reset in class AbstractAgent
Since:
v0.2

setDesiredPositionCount

public void setDesiredPositionCount(int desiredPositionCount)
Set the desired position count.

Since:
v0.2

createAction

protected IAction createAction(IEnvironment environment)
Create the appropriate action. This method creates either a MoveAction or a MoveCaptureAction depending on the state of the board.

Since:
v0.2

getStatusManager

protected StatusManager getStatusManager()
Return the status manager.

Since:
v0.2


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02