cz.cuni.amis.pogamut.udk.agent.module.utils
Class TabooSet<T>

Package class diagram package TabooSet
java.lang.Object
  extended by cz.cuni.amis.pogamut.udk.agent.module.utils.TabooSet<T>

public class TabooSet<T>
extends Object

This class is a simple implementation of TabooSet (similar to TabooList). It allows you to insert items that are taboo either for infinite time (via add(Object)) or for a specified amount of UT2004 time (via add(Object, double)).

Items inside taboo set are either removed automatically due to a timeout (a specified amount of time has passed) or manually via remove(Object).


Constructor Summary
TabooSet(UDKBot bot)
          Constructor of the TabuSet.
 
Method Summary
 void add(T item)
          Adds a tabu item that is valid for an infinite amount of time.
 void add(T item, double timeout)
          Adds a tabu item that is valid for a period of 'timeout' time (in seconds).
 void clear()
          Clears the taboo set.
 Set<T> filter(Collection<T> collection)
          Filters collection according to the current state of the tabu set.
 double getTime()
          Returns current UT2004 time that is used by the TabuSet.
 boolean isTaboo(T item)
          Determines whether an 'item' is inside tabu set or not based on the current UT2004 time.
 void remove(T item)
          Removes a tabu item from the set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TabooSet

public TabooSet(UDKBot bot)
Constructor of the TabuSet.

Parameters:
bot -
Method Detail

add

public void add(T item)
Adds a tabu item that is valid for an infinite amount of time.

Parameters:
item -

add

public void add(T item,
                double timeout)
Adds a tabu item that is valid for a period of 'timeout' time (in seconds).

Parameters:
item -
timeout - in seconds

remove

public void remove(T item)
Removes a tabu item from the set.

Parameters:
item -

isTaboo

public boolean isTaboo(T item)
Determines whether an 'item' is inside tabu set or not based on the current UT2004 time.

Parameters:
item -
Returns:

filter

public Set<T> filter(Collection<T> collection)
Filters collection according to the current state of the tabu set. It returns a new hash set containing items from 'collection' that are not inside tabu set.

Parameters:
collection -
Returns:

clear

public void clear()
Clears the taboo set.


getTime

public double getTime()
Returns current UT2004 time that is used by the TabuSet.



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