prolog.implementation
Class Fact

java.lang.Object
  |
  +--prolog.implementation.Fact
All Implemented Interfaces:
IFact
Direct Known Subclasses:
AbstractStatement, MatchingStatement, Query

public class Fact
extends java.lang.Object
implements IFact

this is the base implementation for a relation with a name.

prolog: myFact(dan,joe).

in this example, "myFact" is the name and the parameters "dan" and "joe" are the atoms in the relation.


Field Summary
protected  int name
          the name of this fact
protected  Relation relation
          the relation contained in this fact
 
Constructor Summary
Fact(IFact f)
          copy constructor
Fact(int name)
          constructor
Fact(int name, IRelation r)
          constructor
 
Method Summary
 void addAttribute(java.lang.Object value)
          adds a IAtom to this fact's relation
 void genXml(java.io.Writer out, ISymbolTable table)
          generates xml representing this object
 int getName()
          returns the name of this fact
 IRelation getRelation()
          returns the relalation this fact owns
 java.lang.String toString()
           
 java.lang.String toString(ISymbolTable table)
          returns a string representation of this oject, if the parameter ISymbolTable is specified, the symbols are decoded
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

relation

protected Relation relation
the relation contained in this fact

name

protected int name
the name of this fact
Constructor Detail

Fact

public Fact(int name)
constructor
Parameters:
name -  

Fact

public Fact(IFact f)
copy constructor
Parameters:
f -  

Fact

public Fact(int name,
            IRelation r)
constructor
Parameters:
name -  
r -  
Method Detail

addAttribute

public void addAttribute(java.lang.Object value)
adds a IAtom to this fact's relation
Parameters:
value - - a IAtom

getName

public int getName()
Description copied from interface: IFact
returns the name of this fact
Specified by:
getName in interface IFact
Returns:
the name of this fact

getRelation

public IRelation getRelation()
Description copied from interface: IFact
returns the relalation this fact owns
Specified by:
getRelation in interface IFact
Returns:
the values of this fact

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a string representation of this fact

toString

public java.lang.String toString(ISymbolTable table)
Description copied from interface: IFact
returns a string representation of this oject, if the parameter ISymbolTable is specified, the symbols are decoded
Specified by:
toString in interface IFact
Parameters:
table - the symboltable used to decode the symbols
Returns:
a string representation of this fact with decoded symbols

genXml

public void genXml(java.io.Writer out,
                   ISymbolTable table)
            throws java.io.IOException
generates xml representing this object
Specified by:
genXml in interface IFact
Parameters:
out -  
table -  
Throws:
java.io.IOException -