de.tubs.macs.control.floor
Class Floor

java.lang.Object
  |
  +--de.tubs.macs.control.floor.Floor

public class Floor
extends java.lang.Object

MacsApplications perform Floor-actions through objects of this class. An object of this class is instantiated for every resource that an application wishes to apply floor control upon.

Author:
Martin Willers

Field Summary
static int CATEGORY_ALL
           
static int CATEGORY_EXPLICIT
           
static int CATEGORY_FREE
           
static int CATEGORY_IMPLICIT
           
 
Constructor Summary
Floor(Session session, MacsApplication app, java.lang.String res_name)
          Construct a new Floor-object for the specified Session, MacsApplication and resource, allowing all policies.
Floor(Session session, MacsApplication app, java.lang.String res_name, boolean isAudio)
          Construct a new Floor-object for the specified Session, MacsApplication and resource, specifying it as an audio-resource.
Floor(Session session, MacsApplication app, java.lang.String res_name, int policyFilter)
          Construct a new Floor-object for the specified Session, MacsApplication and resource, filtering out certain policies.
Floor(Session session, MacsApplication app, java.lang.String res_name, int policyFilter, boolean isAudio)
          Construct a new Floor-object for the specified Session, MacsApplication and resource, specifying it as an audio-resource and filtering out certain policies.
 
Method Summary
 void exit()
          Deregister the resource this Floor-object has been created for.
 java.util.Vector getCurrentHolder()
          Returns the Users who are the current Floor-holders for the resource this Floor-object has been created for.
 long getId()
          Returns the numerical id of this Floor-object.
 long getRemainingTime()
          Returns the remaining time for the current Floor Holder to keep the floor for this resource.
 void release()
          Release the floor for the resource this Floor-object has been created for.
 void request()
          Request the floor for the resource this Floor-object has been created for.
 void resetTimeout()
          Reset the timeout for this resource to indicate that it's still being used.
 void setActive()
          Declare that this application is able to write to this resource.
 void setInactive()
          Declare that this application is not (any longer?) able to write to this resource.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATEGORY_FREE

public static final int CATEGORY_FREE

CATEGORY_EXPLICIT

public static final int CATEGORY_EXPLICIT

CATEGORY_IMPLICIT

public static final int CATEGORY_IMPLICIT

CATEGORY_ALL

public static final int CATEGORY_ALL
Constructor Detail

Floor

public Floor(Session session,
             MacsApplication app,
             java.lang.String res_name)
Construct a new Floor-object for the specified Session, MacsApplication and resource, allowing all policies.

Floor

public Floor(Session session,
             MacsApplication app,
             java.lang.String res_name,
             int policyFilter)
Construct a new Floor-object for the specified Session, MacsApplication and resource, filtering out certain policies.

Floor

public Floor(Session session,
             MacsApplication app,
             java.lang.String res_name,
             boolean isAudio)
Construct a new Floor-object for the specified Session, MacsApplication and resource, specifying it as an audio-resource.

Floor

public Floor(Session session,
             MacsApplication app,
             java.lang.String res_name,
             int policyFilter,
             boolean isAudio)
Construct a new Floor-object for the specified Session, MacsApplication and resource, specifying it as an audio-resource and filtering out certain policies.
Method Detail

setActive

public void setActive()
Declare that this application is able to write to this resource.

setInactive

public void setInactive()
Declare that this application is not (any longer?) able to write to this resource.

exit

public void exit()
Deregister the resource this Floor-object has been created for.

resetTimeout

public void resetTimeout()
Reset the timeout for this resource to indicate that it's still being used. Should be called whenever a user's action is sent via network.

getId

public long getId()
Returns the numerical id of this Floor-object.
Returns:
a long-value, specifying the floor for this resource.

getCurrentHolder

public java.util.Vector getCurrentHolder()
Returns the Users who are the current Floor-holders for the resource this Floor-object has been created for.
Returns:
a Vector containing ObjectIDs.

getRemainingTime

public long getRemainingTime()
Returns the remaining time for the current Floor Holder to keep the floor for this resource. Returns -1 if the current Floor Control Policy doesn't allow for such insight, or infinite time.
Returns:
a long-value, specifying the remaining time in milliseconds.

request

public void request()
Request the floor for the resource this Floor-object has been created for.

release

public void release()
Release the floor for the resource this Floor-object has been created for.