jess
Class Fact

java.lang.Object
  extended byjess.ValueVector
      extended byjess.Fact
All Implemented Interfaces:
java.lang.Cloneable, Modular, java.io.Serializable

public class Fact
extends ValueVector
implements java.io.Serializable, Modular

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

Field Summary
static int DYNAMIC
           
static int NO
           
static int STATIC
           
 
Constructor Summary
Fact(Deftemplate template)
          Basic constructor.
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!
 Value get(int i)
          Fetch the entry at position i in thie ValueVector
 Deftemplate getDeftemplate()
          Return the deftemplate for this fact.
 int getFactId()
          Returns this Fact's fact-id.
 Fact getIcon()
           
 java.lang.String getModule()
           
 java.lang.String getName()
           
 int getShadowMode()
          Indicates whether this fact is a shadow fact, and if so, what type.
 Value getSlotValue(java.lang.String slotname)
          Return the value from the named slot.
 int getTime()
           
 int hashCode()
           
 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, addAll, cloneInto, copy, remove, set, setLength, size
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO

public static final int NO
See Also:
Constant Field Values

DYNAMIC

public static final int DYNAMIC
See Also:
Constant Field Values

STATIC

public static final int STATIC
See Also:
Constant Field Values
Constructor Detail

Fact

public Fact(Deftemplate template)
     throws JessException
Basic constructor. If the deftemplate is an unordered deftemplate, default values are copied from the deftemplate.

Parameters:
template - The deftemplate to use
Throws:
JessException - If anything goes wrong

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
Throws:
JessException - If anything goes wrong.
Method Detail

getIcon

public Fact getIcon()

getName

public java.lang.String getName()
Specified by:
getName in interface Modular

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

getShadowMode

public int getShadowMode()
Indicates whether this fact is a shadow fact, and if so, what type.

Returns:
NO, DYNAMIC, or STATIC from this class

getDeftemplate

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

Returns:
The deftemplate for this fact

getModule

public final java.lang.String getModule()
Specified by:
getModule in interface Modular

getTime

public int getTime()

get

public Value get(int i)
          throws JessException
Description copied from class: ValueVector
Fetch the entry at position i in thie ValueVector

Overrides:
get in class ValueVector
Parameters:
i - The 0-based index of the Value to fetch
Returns:
The Value
Throws:
JessException

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
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
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.

hashCode

public int hashCode()

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