jess
Class Fact

java.lang.Object
  |
  +--jess.ValueVector
        |
        +--jess.Fact

public class Fact
extends ValueVector
implements java.io.Serializable

A Fact is a ValueVector where the entries are the slot data in declaration order. The "head" of the fact, id, etc., are -not- stored in the vector.

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

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

Constructor Summary
Fact(Fact f)
          Starts from another Fact.
Fact(java.lang.String name, Rete engine)
          Basic constructor.
 
Method Summary
 java.lang.Object clone()
          Make a copy of this fact
 boolean equals(java.lang.Object o)
          The version in ValueVector isn't good enough, since it doesn't compare heads!
 Deftemplate getDeftemplate()
          Return the deftemplate for this fact.
 int getFactId()
          Returns this Fact's fact-id.
 java.lang.String getName()
           
 Value getSlotValue(java.lang.String slotname)
          Return the value from the named slot.
 boolean isShadow()
          Indicates whether this Fact is a shadow fact for a matched Bean.
 void setSlotValue(java.lang.String slotname, Value value)
          Set the value in the named slot.
 java.lang.String toString()
          Pretty-print this fact into a String.
 java.lang.String toStringWithParens()
          Return a String version of this ValueVector, with parentheses around all ValueVectors.
 
Methods inherited from class jess.ValueVector
add, cloneInto, get, set, setLength, size
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Fact

public Fact(java.lang.String name,
            Rete engine)
     throws JessException
Basic constructor. If name is not a known deftemplate, an implied ordered deftemplate is created. If it is a known unordered deftemplate, default values are copied from the deftemplate.
Parameters:
name - The head or name of the fact
engine - The engine in which to find the deftemplate
Throws:
JessException - If anything goes wrong

Fact

public Fact(Fact f)
     throws JessException
Starts from another Fact. No default values are filled in; the ValueVector is assumed to already be complete.
Parameters:
f - The ValueVector form of a fact
engine - The engine in which to find the deftemplate
Throws:
JessException - If anything goes wrong.
Method Detail

getName

public java.lang.String getName()

getFactId

public int getFactId()
Returns this Fact's fact-id.
Returns:
The fact-id

isShadow

public boolean isShadow()
Indicates whether this Fact is a shadow fact for a matched Bean.
Returns:
True is this is a shadow fact

getDeftemplate

public final Deftemplate getDeftemplate()
Return the deftemplate for this fact.
Returns:
The deftemplate for this fact

clone

public java.lang.Object clone()
Make a copy of this fact
Overrides:
clone in class ValueVector
Returns:
The copy

getSlotValue

public final Value getSlotValue(java.lang.String slotname)
                         throws JessException
Return the value from the named slot.
Parameters:
slotname - The name of a slot in this fact
Returns:
The value
Throws:
JessException - If anything goes wrong

setSlotValue

public final void setSlotValue(java.lang.String slotname,
                               Value value)
                        throws JessException
Set the value in the named slot.
Parameters:
slotname - The name of the slot
value - The new value for the slot
Throws:
JessException - If anything goes wrong

toString

public java.lang.String toString()
Pretty-print this fact into a String. Should always be a parseable fact, except when a slot holds an external-address value.
Overrides:
toString in class ValueVector
Returns:
The pretty-printed String.

toStringWithParens

public java.lang.String toStringWithParens()
Description copied from class: ValueVector
Return a String version of this ValueVector, with parentheses around all ValueVectors.
Overrides:
toStringWithParens in class ValueVector
Tags copied from class: ValueVector
Returns:
The String

equals

public boolean equals(java.lang.Object o)
The version in ValueVector isn't good enough, since it doesn't compare heads!
Overrides:
equals in class ValueVector
Tags copied from class: ValueVector
Parameters:
o - Another object
Returns:
True if the object is a valueVector of the same size containing Values that compare equal to the ones in this Vector.

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