prolog.model
Interface IFactDb

All Known Implementing Classes:
FactDb

public interface IFactDb

This class represent the complete fact database. in this class, facts are stored as relations in factlists. this factlists are ordered by the fact's name. A fact database can be used to prove facts a unsafe fact.


Method Summary
 void add(IFact f)
          adds the given fact to the fact database. first the database is queries for a factlist with the name of the given fact. if one was found, the relation of the given fact is stored. if no one was found, a new factlist is created in which the relation is stored.
 void add(IRelation relation, int name)
          adds a new relation to the fact database under the given name. first the database is queries for a factlist matching name. if one was found, the relation is stored in.
 void clear()
          clears the fact database
 void genXml(java.io.Writer out, ISymbolTable table)
          generates a xml representation of this fact database
 IFactList getFactList(int key)
          returns the factlist for the given name
 java.util.Iterator getFactLists()
           
 boolean isFact(IFact f)
          queries the database for a fact. it returns true, if a fact in database is found matching the given one. first, the database is queried for a factlist with the given name. if on was found, this list is iterated finding a fact matching the given facts.
 java.lang.String toString(ISymbolTable table)
          returns a string representation with decoded symbols
 

Method Detail

clear

public void clear()
clears the fact database

getFactList

public IFactList getFactList(int key)
returns the factlist for the given name
Parameters:
key - the name of the fact to search for
Returns:
the factlist matching the given key

add

public void add(IFact f)
adds the given fact to the fact database. first the database is queries for a factlist with the name of the given fact. if one was found, the relation of the given fact is stored. if no one was found, a new factlist is created in which the relation is stored.
Parameters:
f - is the fact to be added

add

public void add(IRelation relation,
                int name)
adds a new relation to the fact database under the given name. first the database is queries for a factlist matching name. if one was found, the relation is stored in. If no one was found, a new factlist is created in which the relation is stored.
Parameters:
relation - is the relation to be added
name - is the name of the relation

isFact

public boolean isFact(IFact f)
               throws ParameterMatchingError
queries the database for a fact. it returns true, if a fact in database is found matching the given one. first, the database is queried for a factlist with the given name. if on was found, this list is iterated finding a fact matching the given facts. If one was found, this method returns true, in all other cases false. If it returns true, the given fact is proven.
Parameters:
f - is the fact to test
Returns:
true if the given fact is true

genXml

public void genXml(java.io.Writer out,
                   ISymbolTable table)
            throws java.io.IOException
generates a xml representation of this fact database
Parameters:
out - is the writer where to append the xml
table -  
Throws:
java.io.IOException -  

toString

public java.lang.String toString(ISymbolTable table)
returns a string representation with decoded symbols
Parameters:
table - is the symboltable to decode
Returns:
a string representation ;-)

getFactLists

public java.util.Iterator getFactLists()
Returns:
a iterator over all stored factlists