public class TabooSet<T> extends Object implements cz.cuni.amis.utils.IFilter<T>
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)
.
Modifier and Type | Class and Description |
---|---|
static interface |
TabooSet.IRelaxedTaboo<T> |
Constructor and Description |
---|
TabooSet(UT2004Bot bot)
Constructor of the TabuSet.
|
Modifier and Type | Method and Description |
---|---|
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.
|
Set<T> |
filter(Collection<T> collection,
TabooSet.IRelaxedTaboo estimator)
Filters collection according to the current state of the tabu set.
|
double |
getTabooTime(T item)
If not tabooized forever, it returns remaining time for the item to remain taboo.
|
double |
getTime()
Returns current UT2004 time that is used by the TabooSet.
|
boolean |
isAccepted(T item)
Method that is used by
DistanceUtils methods to filter items. |
boolean |
isTaboo(T item)
Determines whether an 'item' is inside tabu set or not based on the current
UT2004 time.
|
boolean |
isTaboo(T item,
TabooSet.IRelaxedTaboo estimator)
Determines whether an 'item' is considered to be taboo using relaxed 'estimator'.
|
void |
remove(T item)
Removes a tabu item from the set.
|
int |
size()
Return how many items are inside taboo set.
|
public TabooSet(UT2004Bot bot)
bot
- public int size()
public double getTabooTime(T item)
If tabooized forever, returns Double.POSITIVE_INFINITY
.
If item is not tabooized, returns 0.
item
- public void add(T item)
item
- public void add(T item, double timeout)
item
- timeout
- in secondspublic void remove(T item)
item
- public boolean isTaboo(T item)
item
- public boolean isTaboo(T item, TabooSet.IRelaxedTaboo estimator)
item
- estimator
- public boolean isAccepted(T item)
DistanceUtils
methods to filter items.isAccepted
in interface cz.cuni.amis.utils.IFilter<T>
item
- isTaboo(Object)
public Set<T> filter(Collection<T> collection)
collection
- public Set<T> filter(Collection<T> collection, TabooSet.IRelaxedTaboo estimator)
collection
- public void clear()
public double getTime()
Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.