org.deri.iris.evaluation.topdown.oldt
Class MemoTable
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<IAtom,IRelation>
org.deri.iris.evaluation.topdown.oldt.MemoTable
- All Implemented Interfaces:
- Serializable, Cloneable, Map<IAtom,IRelation>
public class MemoTable
- extends HashMap<IAtom,IRelation>
- implements Map<IAtom,IRelation>
- Author:
- gigi
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
| Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
| Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
MemoTable
public MemoTable()
- Constructor
add
public IRelation add(IAtom atom,
ITuple tuple)
- Add a answer (which is an
ITuple) to an atom.
If the relation was not initialized before (there was no answer
related to the atom), the empty relation will be returned. Since
the OLDT table does not allow null values, null
is returned if the atom is null. If the tuple is null, the
relation will be initialized with the empty relation or remain unchanged.
- Parameters:
atom - the unique, ungrounded atomtuple - a answer tuple. The arity of the tuple
must be equal to the number of distinct variables in the atom.
- Returns:
- previous answer relation associated with specified atom.
get
public IRelation get(IAtom atom,
Map<IVariable,ITerm> variableMap)
get
public ITuple get(IAtom atom,
int i)
- Get the
ith answer tuple
- Parameters:
atom - memo atomi - index position
- Returns:
- answer tuple from answer relation, at the given index position
or
null if there was no answer found
containsKey
public boolean containsKey(IAtom atom)
addAll
public void addAll(IAtom atom,
IRelation relationFromSubtree)