visidia.simulation.process.agent
Class AgentMover

java.lang.Object
  extended by visidia.simulation.process.agent.AgentMover
All Implemented Interfaces:
java.io.Serializable

public abstract class AgentMover
extends java.lang.Object
implements java.io.Serializable

Abstract class providing different moving types for the agents. You should subclass this class to create your own style of move.

See Also:
Serialized Form

Constructor Summary
AgentMover()
          Instantiates a new agent mover.
AgentMover(Agent ag)
          Creates a new agent mover.
 
Method Summary
protected  Agent agent()
          Returns the agent associated to this mover.
abstract  int findNextDoor()
          Returns the door to which the agent will go.
 java.lang.Boolean isOpenDoor(int door, Vertex vertex)
          Tests if the door is open, and if the vertex is accessible.
 void move()
          Moves the agent to the next door.
 void move(int door)
          Moves the agent to a specified door.
 void setAgent(Agent ag)
          Sets the agent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentMover

public AgentMover()
Instantiates a new agent mover.


AgentMover

public AgentMover(Agent ag)
Creates a new agent mover.

Parameters:
ag - agent associated to this mover.
Method Detail

agent

protected final Agent agent()
Returns the agent associated to this mover.

Returns:
the agent

setAgent

public void setAgent(Agent ag)
Sets the agent.

Parameters:
ag - the new agent

move

public void move()
          throws java.lang.InterruptedException,
                 MoveException
Moves the agent to the next door.

Throws:
java.lang.InterruptedException - the interrupted exception
MoveException - the move exception

move

public final void move(int door)
                throws java.lang.InterruptedException
Moves the agent to a specified door.

Parameters:
door - Door to which move.
Throws:
java.lang.InterruptedException - the interrupted exception

findNextDoor

public abstract int findNextDoor()
                          throws MoveException
Returns the door to which the agent will go. This method needs to be specialized in the sub-classes.

Returns:
the door
Throws:
MoveException - the move exception

isOpenDoor

public java.lang.Boolean isOpenDoor(int door,
                                    Vertex vertex)
Tests if the door is open, and if the vertex is accessible.

Parameters:
door - the door
vertex - the vertex
Returns:
true, if checks if is open door