de.tubs.macs.control.floor
Class FloorPolicy

java.lang.Object
  |
  +--de.tubs.macs.control.floor.FloorPolicy
Direct Known Subclasses:
FPAgenda, FPChair, FPFree, FPHolder, FPLecturer, FPQueue, FPRandom, FPRobin

abstract class FloorPolicy
extends java.lang.Object

This is the (abstract) superclass to hold a floor control policy. Its descendants handle the actual policies.

Author:
Martin Willers

Constructor Summary
protected FloorPolicy()
          Since FloorPolicy is an abstract class, it doesn't need a public constructor.
 
Method Summary
(package private) abstract  void exit()
          Shutdown the policy.
(package private) abstract  int getCapabilities()
          Returns the capabilities of the policy.
(package private) abstract  int getCategory()
          Returns the category of the policy.
(package private) abstract  Group getCurrentHolder()
          Return current floor-holder.
(package private) abstract  java.lang.String getDescription()
          Return description of current floor passing policy.
(package private) abstract  java.lang.String getName()
          Return name of current floor passing policy.
(package private) abstract  Group getNextHolder()
          Return probable next floor-holder.
(package private) abstract  java.util.Vector getUserRequests()
          Returns a list of users that have requested the floor for this resource.
(package private) abstract  void init(Session session, FloorResource res, Group users, long res_id)
          Initialise the policy with the specified information.
(package private) abstract  boolean isCurrentHolder(ObjectID user)
          Returns whether the specified user holds the floor.
(package private) abstract  boolean maySetHolder(ObjectID user)
          Returns whether the specified user may set a new floor holder.
(package private) abstract  void passOn()
          Perform action to pass on floor, according to policy.
(package private) abstract  void release(ObjectID userid)
          The specified user has released the floor.
(package private) abstract  int request(ObjectID userid)
          The specified user has requested the floor.
(package private) abstract  boolean requestHolder(ObjectID user)
          Request a new floor holder.
(package private) abstract  boolean setHolder(ObjectID user)
          Set user to be the new floor holder.
(package private) abstract  boolean setUserlist(java.util.Vector ulist)
          Set floor-queue for this policy.
(package private) abstract  void userAdded()
          Notify policy that a user has been added to end of users-group.
(package private) abstract  void userRemoved(int index)
          Notify policy that the user with the specified index will be removed from users-Vector immediately.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FloorPolicy

protected FloorPolicy()
Since FloorPolicy is an abstract class, it doesn't need a public constructor.
Method Detail

init

abstract void init(Session session,
                   FloorResource res,
                   Group users,
                   long res_id)
Initialise the policy with the specified information. Policies must not modify 'users'-argument (may only read).

exit

abstract void exit()
Shutdown the policy.

getCapabilities

abstract int getCapabilities()
Returns the capabilities of the policy.

getCategory

abstract int getCategory()
Returns the category of the policy.

maySetHolder

abstract boolean maySetHolder(ObjectID user)
Returns whether the specified user may set a new floor holder.

isCurrentHolder

abstract boolean isCurrentHolder(ObjectID user)
Returns whether the specified user holds the floor.

getCurrentHolder

abstract Group getCurrentHolder()
Return current floor-holder.

getNextHolder

abstract Group getNextHolder()
Return probable next floor-holder.

getName

abstract java.lang.String getName()
Return name of current floor passing policy.

getDescription

abstract java.lang.String getDescription()
Return description of current floor passing policy.

setUserlist

abstract boolean setUserlist(java.util.Vector ulist)
Set floor-queue for this policy.

requestHolder

abstract boolean requestHolder(ObjectID user)
Request a new floor holder.

setHolder

abstract boolean setHolder(ObjectID user)
Set user to be the new floor holder.

passOn

abstract void passOn()
Perform action to pass on floor, according to policy.

userAdded

abstract void userAdded()
Notify policy that a user has been added to end of users-group.

userRemoved

abstract void userRemoved(int index)
Notify policy that the user with the specified index will be removed from users-Vector immediately.

getUserRequests

abstract java.util.Vector getUserRequests()
Returns a list of users that have requested the floor for this resource.

request

abstract int request(ObjectID userid)
The specified user has requested the floor.
Returns:
0 if floor for this resource is already owned by caller, -1 if the request is not acklowledged, >0 else. (FIXME: >0 position in the request-queue, if applicable).

release

abstract void release(ObjectID userid)
The specified user has released the floor.