cz.cuni.amis.pogamut.multi.utils.timekey
Class TimeKeyManager

Package class diagram package TimeKeyManager
java.lang.Object
  extended by cz.cuni.amis.pogamut.multi.utils.timekey.TimeKeyManager
All Implemented Interfaces:
ITimeKeyManager

public class TimeKeyManager
extends Object
implements ITimeKeyManager

Singleton class that manages timekey locks and unlocks,

Author:
srlok

Method Summary
static TimeKeyManager get()
           
 Set<Long> getHeldKeys()
          Returns an immutable collection of currently held timeKeys.
 String getHeldKeysStr()
          Returns an immutable collection of currently held timeKeys as string.
 boolean isLocked(long time)
          True if the provided timeKey is explicitly locked (lock(key) was called).
 boolean isLocked(TimeKey key)
          True if the provided timeKey is explicitly locked (lock(key) was called).
 void lock(long key)
          Locks some "time" (or increment lock number if existing lock exists).
 void unlock(long key)
          Unlocks some "time".
 void unlockAll()
          Unlock all times.
 void unlockAll(long key)
          Completely unlocks one time (regardless number of locks held).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getHeldKeys

public Set<Long> getHeldKeys()
Description copied from interface: ITimeKeyManager
Returns an immutable collection of currently held timeKeys.

Specified by:
getHeldKeys in interface ITimeKeyManager
Returns:

getHeldKeysStr

public String getHeldKeysStr()
Description copied from interface: ITimeKeyManager
Returns an immutable collection of currently held timeKeys as string.

Specified by:
getHeldKeysStr in interface ITimeKeyManager
Returns:

get

public static TimeKeyManager get()

isLocked

public boolean isLocked(TimeKey key)
Description copied from interface: ITimeKeyManager
True if the provided timeKey is explicitly locked (lock(key) was called).

Specified by:
isLocked in interface ITimeKeyManager
Returns:

isLocked

public boolean isLocked(long time)
Description copied from interface: ITimeKeyManager
True if the provided timeKey is explicitly locked (lock(key) was called).

Specified by:
isLocked in interface ITimeKeyManager
Returns:

unlock

public void unlock(long key)
            throws TimeKeyNotLockedException
Description copied from interface: ITimeKeyManager
Unlocks some "time".

Specified by:
unlock in interface ITimeKeyManager
Throws:
TimeKeyNotLockedException

unlockAll

public void unlockAll(long key)
               throws TimeKeyNotLockedException
Description copied from interface: ITimeKeyManager
Completely unlocks one time (regardless number of locks held).

Specified by:
unlockAll in interface ITimeKeyManager
Throws:
TimeKeyNotLockedException

lock

public void lock(long key)
Description copied from interface: ITimeKeyManager
Locks some "time" (or increment lock number if existing lock exists).

Specified by:
lock in interface ITimeKeyManager

unlockAll

public void unlockAll()
Description copied from interface: ITimeKeyManager
Unlock all times.

Specified by:
unlockAll in interface ITimeKeyManager


Copyright © 2015 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.