prolog.implementation
Class AbstractStatement
java.lang.Object
|
+--prolog.implementation.Fact
|
+--prolog.implementation.AbstractStatement
- All Implemented Interfaces:
- IFact, IStatement
- Direct Known Subclasses:
- ConstraintStatement, NodeStatement
- public abstract class AbstractStatement
- extends Fact
- implements IStatement
AbstractStatement has methods for reordering a relation after a
given format
|
Method Summary |
protected Fact |
generateFact(IFact f,
java.util.Map factFormat,
IStatement targetStatement)
generates a new fact matching the format of the given statement |
protected Relation |
generateRelation(IFact f,
java.util.Map factFormat,
IStatement targetStatement)
builds a new relation from the given fact
matching the format of the targetStatement.
create new relation
iterate over atoms of relation of statement2
search for atom value int factmap and get index in fact f
fetch atom from fact f at index and add atom found to new relation |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
AbstractStatement
public AbstractStatement(int name)
- constructor 1
AbstractStatement
public AbstractStatement(int name,
IRelation r)
- constructor 2
generateFact
protected Fact generateFact(IFact f,
java.util.Map factFormat,
IStatement targetStatement)
throws ParameterMatchingError
- generates a new fact matching the format of the given statement
- Parameters:
f - - the fact to be taken the values fromsrcRelationFormat - - the format of the given facttargetStatement - - the statement for which the new fact is created for- Returns:
- a new fact formated for the targetStatement
generateRelation
protected Relation generateRelation(IFact f,
java.util.Map factFormat,
IStatement targetStatement)
throws ParameterMatchingError
builds a new relation from the given fact
matching the format of the targetStatement.
create new relation
iterate over atoms of relation of statement2
search for atom value int factmap and get index in fact f
fetch atom from fact f at index and add atom found to new relation
- Parameters:
f - = ?-statement1(batman,robin).factFormat - = [X]=[0],[Y]=[1]targetStatement - statement1(X,Y):-statement2(Y,X).- Returns:
- (robin,batman)