All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.habanero.TurnTakerArbitrator

java.lang.Object
   |
   +----ncsa.habanero.ModelObject
           |
           +----ncsa.habanero.granted.Arbitrator
                   |
                   +----ncsa.habanero.CentralArbitrator
                           |
                           +----ncsa.habanero.LimitArbitrator
                                   |
                                   +----ncsa.habanero.TurnTakerArbitrator

public class TurnTakerArbitrator
extends LimitArbitrator
The TurnTakerArbitrator is when only one person may move at a time and each person must take turns


Variable Index

 o nCurrentPlayers
 o nCurrentTurn

Constructor Index

 o TurnTakerArbitrator()
This method is used to marshall the arbitrator
 o TurnTakerArbitrator(Arbitrator)

Method Index

 o arbitrate(ActionRequest)
The arbitrate routine simply passes the problem of arbitrating the event on to the limit arbitrator.
 o getLock(Lock, Key)
returns a lock if it is OK to do so, it limits each participants to requesting keys allowing actions during their turn.
 o getPlayers()
 o getTurn()
Allows a subclass of this arbitrator to make it someone's turn
 o setTurn(int)
Allows a subclass of this arbitrator to make it someone's turn

Variables

 o nCurrentTurn
 protected int nCurrentTurn
 o nCurrentPlayers
 protected int nCurrentPlayers

Constructors

 o TurnTakerArbitrator
 public TurnTakerArbitrator(Arbitrator parent) throws IOException
Parameters:
parent - the parent arbitrator
r - the router
Returns:
a new arbitrator
 o TurnTakerArbitrator
 public TurnTakerArbitrator()
This method is used to marshall the arbitrator

Returns:
a new arbitrator

Methods

 o arbitrate
 public synchronized boolean arbitrate(ActionRequest request)
The arbitrate routine simply passes the problem of arbitrating the event on to the limit arbitrator.

Parameters:
request - the ActionRequest we want to grant
Returns:
true if the action was granted and false if not
Overrides:
arbitrate in class LimitArbitrator
 o getLock
 public synchronized Key getLock(Lock ldRequest,
                                 Key oldKey)
returns a lock if it is OK to do so, it limits each participants to requesting keys allowing actions during their turn.

Parameters:
lpdRequest - what you would like to do
oldKey - the key that permits us to get the lock
Returns:
checks to see if you are allowed to do that, and returns a key if you can, and Key.NoKey if you can't
Overrides:
getLock in class LimitArbitrator
 o getPlayers
 public int getPlayers()
Returns:
the number of active participants in the session
 o setTurn
 protected void setTurn(int nTurn)
Allows a subclass of this arbitrator to make it someone's turn

Parameters:
nTurn - whose turn should it be?
 o getTurn
 protected int getTurn()
Allows a subclass of this arbitrator to make it someone's turn

Returns:
returns the integer whose turn it is

All Packages  Class Hierarchy  This Package  Previous  Next  Index