prolog.implementation
Class AndStatement
java.lang.Object
|
+--prolog.implementation.Fact
|
+--prolog.implementation.AbstractStatement
|
+--prolog.implementation.NodeStatement
|
+--prolog.implementation.AndStatement
- All Implemented Interfaces:
- IFact, IStatement
- Direct Known Subclasses:
- DemoAndStatement
- public class AndStatement
- extends NodeStatement
The AndStatement represents the and operation over two tables.
|
Inner Class Summary |
protected class |
AndStatement.CacheMap
this class is the implementation of a cache map |
|
Method Summary |
protected boolean |
addMatching(AndStatement.CacheMap m,
java.lang.Object key,
java.lang.Object mapping)
checks wether the key is allready stored in the cachmap. if not,
the value is stored and true is returned. if yes, it was stored,
the stored value is compared with the given mapping. then the
result of the comparation is returned |
protected void |
findMatching(IFact f,
java.util.List all,
int index,
IFactList finalResults,
AndStatement.CacheMap cachMap)
finds all matchings in the list with results collected by query and
puts it in targetformat into the finalresult factlist |
IFactList |
query(IFact f,
IFactDb l,
IStatementMap constraints)
queries the child nodes and calls the recursive
findMatching method to merge all results. |
java.lang.String |
toString()
|
java.lang.String |
toString(ISymbolTable table)
returns a string representation of this class with decoded symbols |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
AndStatement
public AndStatement(int name)
- constructor 1
AndStatement
public AndStatement(IFact f)
- constructor 2
query
public IFactList query(IFact f,
IFactDb l,
IStatementMap constraints)
throws ParameterMatchingError
- queries the child nodes and calls the recursive
findMatching method to merge all results.
- Parameters:
f - - the target formatl - - the fact databaseconstraints - - the statements to resolve when not found in fdb- Returns:
- a result factlist with all matching results in the format
described in the f parameter fact
- Throws:
ParameterMatchingError -
findMatching
protected void findMatching(IFact f,
java.util.List all,
int index,
IFactList finalResults,
AndStatement.CacheMap cachMap)
throws java.lang.Exception
- finds all matchings in the list with results collected by query and
puts it in targetformat into the finalresult factlist
- Parameters:
f - - the target formatall - - the list with matchings returned by the childsindex - - the index of the current factlist, begins with 0finalResults - - the collector for really matching final resultscachMap - - the cachemap used to find matching values- Returns:
-
- Throws:
java.lang.Exception -
addMatching
protected boolean addMatching(AndStatement.CacheMap m,
java.lang.Object key,
java.lang.Object mapping)
- checks wether the key is allready stored in the cachmap. if not,
the value is stored and true is returned. if yes, it was stored,
the stored value is compared with the given mapping. then the
result of the comparation is returned
- Parameters:
m - - the cachemap where to add the matchingkey - - the key under which the value should be storedmapping - - the value to be stored- Returns:
- true if the given key and mapping does not produce any conflicts,
else false
toString
public java.lang.String toString()
- Overrides:
toString in class Fact
- Returns:
- a string representation of this class
toString
public java.lang.String toString(ISymbolTable table)
- returns a string representation of this class with decoded symbols
- Overrides:
toString in class Fact
- Parameters:
table - - the symboltable to decode the symbols- Returns:
- a string representation of this class