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
-
nCurrentPlayers
-
-
nCurrentTurn
-
-
TurnTakerArbitrator()
-
This method is used to marshall the arbitrator
-
TurnTakerArbitrator(Arbitrator)
-
-
arbitrate(ActionRequest)
- The arbitrate routine simply passes the problem of arbitrating the
event on to the limit arbitrator.
-
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.
-
getPlayers()
-
-
getTurn()
-
Allows a subclass of this arbitrator to make it someone's turn
-
setTurn(int)
-
Allows a subclass of this arbitrator to make it someone's turn
nCurrentTurn
protected int nCurrentTurn
nCurrentPlayers
protected int nCurrentPlayers
TurnTakerArbitrator
public TurnTakerArbitrator(Arbitrator parent) throws IOException
- Parameters:
- parent - the parent arbitrator
- r - the router
- Returns:
- a new arbitrator
TurnTakerArbitrator
public TurnTakerArbitrator()
- This method is used to marshall the arbitrator
- Returns:
- a new arbitrator
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
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
getPlayers
public int getPlayers()
- Returns:
- the number of active participants in the session
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?
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