All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.habanero.LimitPlayerLock

java.lang.Object
   |
   +----ncsa.habanero.Lock
           |
           +----ncsa.habanero.LimitPlayerLock

public class LimitPlayerLock
extends Lock
LimitPlayerLock - a limitation on the number of players to actively participate in a session


Constructor Index

 o LimitPlayerLock()
 o LimitPlayerLock(int)
requests a limit to the active participants

Method Index

 o allows(Action)
This method is used when an action is being attempted.
 o consistent(Lock)
This routine is used to determine if this lock can coexist with this older lock.
 o equals(Object)
Used to compare locks
 o getLimit()
returns the limit
 o keyWorksWith(Lock)
The user has the key to the current lock, is the lock still legal.
 o releaseAfterUsing()
Should this lock be released after it has been used only once

Constructors

 o LimitPlayerLock
 public LimitPlayerLock(int nRequestedLimit)
requests a limit to the active participants

Parameters:
nRequestedLimit - the number of people to be allowed
Returns:
a lock that will request the maximum number of participants
 o LimitPlayerLock
 public LimitPlayerLock()
Returns:
a player lock, one should be used for each participant in a game

Methods

 o getLimit
 public int getLimit()
returns the limit

Returns:
returns the limit
 o allows
 public boolean allows(Action act)
This method is used when an action is being attempted. It checks to see if the action is allowed.

Parameters:
act - the action that is being attempted
Returns:
always returns false since a limit lock keeps additional people from joining
Overrides:
allows in class Lock
 o consistent
 public boolean consistent(Lock lkdRequest)
This routine is used to determine if this lock can coexist with this older lock.

Parameters:
lkdRequest - the other lock that is attempted
Returns:
true if someone else is asking for the same name or the same ID
Overrides:
consistent in class Lock
 o keyWorksWith
 public boolean keyWorksWith(Lock ldRequest)
The user has the key to the current lock, is the lock still legal.

Parameters:
ldRequest - the request that the user is making
Returns:
nothing works with this key
Overrides:
keyWorksWith in class Lock
 o releaseAfterUsing
 public boolean releaseAfterUsing()
Should this lock be released after it has been used only once

Returns:
once a player gets one of these, they have it as long as they want
Overrides:
releaseAfterUsing in class Lock
 o equals
 public boolean equals(Object another)
Used to compare locks

Parameters:
another - the other lock
Returns:
true if they have the same ID, or if one is missing an ID, then the same name
Overrides:
equals in class Lock

All Packages  Class Hierarchy  This Package  Previous  Next  Index