jess
Class FactIDValue

java.lang.Object
  extended by jess.Value
      extended by jess.FactIDValue
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class FactIDValue
extends Value
implements java.io.Serializable, java.lang.Comparable

Use this subclass of Value when you want to create a Value that represents a Fact.

In previous versions of Jess, fact-id's were more like integers; now they are really references to facts. As such, a fact-id must represent a valid Fact object. Call Value.javaObjectValue(jess.Context) to get the Fact object, and call Fact.getFactId() to get the fact-id as an integer. This latter manipulation will now rarely, if ever, be necessary.

(C) 2013 Sandia Corporation

See Also:
Serialized Form

Constructor Summary
FactIDValue(Fact f)
          Create a FactIDValue
 
Method Summary
 int compareTo(java.lang.Object c)
           
 boolean equals(Value v)
          Compare this value to another value.
 Fact factValue(Context c)
          Returns the contents of this value, as a fact.
 int getFactId()
           
 int hashCode()
          Return a hashcode for the object.
 int intValue(Context c)
          Returns the contents of this value, as an int.
 double numericValue(Context c)
          Returns the contents of this value, as a number.
 java.lang.String toString()
          Return a pretty-print version of this value, without adding parens to any lists.
 
Methods inherited from class jess.Value
atomValue, equals, equalsStar, externalAddressValue, floatValue, funcallValue, functionValue, isLexeme, isLiteral, isNumeric, isVariable, javaObjectValue, listValue, longValue, resolveValue, stringValue, symbolValue, toStringWithParens, type, variableValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FactIDValue

public FactIDValue(Fact f)
            throws JessException
Create a FactIDValue

Parameters:
f - The fact
Throws:
JessException - If the type is invalid
Method Detail

intValue

public int intValue(Context c)
Description copied from class: Value
Returns the contents of this value, as an int.

Overrides:
intValue in class Value
Parameters:
c - the execution context used to resolve the value
Returns:
the number as an int

numericValue

public double numericValue(Context c)
Description copied from class: Value
Returns the contents of this value, as a number.

Overrides:
numericValue in class Value
Parameters:
c - the execution context used to resolve the value
Returns:
the number as a double

factValue

public Fact factValue(Context c)
               throws JessException
Description copied from class: Value
Returns the contents of this value, as a fact.

Overrides:
factValue in class Value
Parameters:
c - the execution context used to resolve the value
Returns:
the fact
Throws:
JessException - if this value does not contain a fact

toString

public java.lang.String toString()
Description copied from class: Value
Return a pretty-print version of this value, without adding parens to any lists.

Overrides:
toString in class Value
Returns:
the formatted string

hashCode

public int hashCode()
Description copied from class: Value
Return a hashcode for the object.

Overrides:
hashCode in class Value
Returns:
the hashcode

getFactId

public int getFactId()

equals

public boolean equals(Value v)
Description copied from class: Value
Compare this value to another value. Believe it or not, using this separate overloaded routine has a measurable impact on performance - since so much time is spent comparing Values.

Overrides:
equals in class Value
Parameters:
v - the Value to compare to.
Returns:
true if the Values are equivalent.

compareTo

public int compareTo(java.lang.Object c)
Specified by:
compareTo in interface java.lang.Comparable

2013 Sandia Corporation