jess
Class Deffacts

java.lang.Object
  |
  +--jess.Deffacts

public class Deffacts
extends java.lang.Object
implements JessListener, java.io.Serializable

Class used to represent deffacts. Note that you can create Deffacts objects and add them to a Rete engine using Rete.addDeffacts().

(C) 1998 E.J. Friedman-Hill and the Sandia Corporation

Author:
Ernest J. Friedman-Hill
See Also:
Serialized Form

Constructor Summary
Deffacts(java.lang.String name, java.lang.String docstring)
          Create a deffacts
 
Method Summary
 void addFact(Fact fact)
          Add a fact to this deffacts
 void eventHappened(JessEvent je)
          Assert my facts into engine.
 java.lang.String getDocstring()
          Fetch the documentation comment, if any, for this deffacts
 ValueVector getFact(int idx)
          Fetch a single Fact from this deffacts
 java.lang.String getName()
          Fetch the name of thie deffacts
 int getNFacts()
          Fetch the number of facts in this deffacts
 java.lang.String toString()
          Describe myself
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Deffacts

public Deffacts(java.lang.String name,
                java.lang.String docstring)
Create a deffacts
Parameters:
name - The name of the deffacts
docstring - A documentation string
Method Detail

getName

public final java.lang.String getName()
Fetch the name of thie deffacts
Returns:
the name

getDocstring

public final java.lang.String getDocstring()
Fetch the documentation comment, if any, for this deffacts
Returns:
the documentation string

addFact

public void addFact(Fact fact)
Add a fact to this deffacts
Parameters:
fact - The fact to add

getNFacts

public int getNFacts()
Fetch the number of facts in this deffacts
Returns:
the number of facts

getFact

public ValueVector getFact(int idx)
Fetch a single Fact from this deffacts
Parameters:
idx - the o-based index of the desired fact
Returns:
the idx'th fact

eventHappened

public void eventHappened(JessEvent je)
                   throws JessException
Assert my facts into engine. Called in response to an event, not directly by you. A Deffacts will also remove itself from the engine in response to a CLEAR event.
Specified by:
eventHappened in interface JessListener
Parameters:
je - An event in the engine;
Throws:
JessException - If anything goes wrong.

toString

public java.lang.String toString()
Describe myself
Overrides:
toString in class java.lang.Object
Returns:
A string representation of this deffacts

© 1997 E.J. Friedman-Hill and Sandia Corporation