jess
Class BindingValue

java.lang.Object
  |
  +--jess.Value
        |
        +--jess.BindingValue
All Implemented Interfaces:
java.io.Serializable

public class BindingValue
extends Value
implements java.io.Serializable

A class to represent a location within a rule LHS, used internally. It is 'self-resolving' using Context

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

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

Method Summary
 java.lang.String atomValue(Context c)
          Returns the contents of this value, as an atom
 boolean equals(Value o)
          Compare this value to another value.
 java.lang.Object externalAddressValue(Context c)
          Returns the contents of this value, as an external adress object
 Fact factValue(Context c)
          Returns the contents of this value, as a fact
 double floatValue(Context c)
          Returns the contents of this value, as a number
 int getFactNumber()
           
 java.lang.String getName()
           
 int getSlotIndex()
           
 int getSubIndex()
           
 int getType()
           
 int hashCode()
          Return a hashcode for the object
 int intValue(Context c)
          Returns the contents of this value, as an int
 ValueVector listValue(Context c)
          Returns the contents of this value, as a list
 double numericValue(Context c)
          Returns the contents of this value, as a number
 void resetFactNumber()
           
 Value resolveValue(Context c)
          Given an evaluation context, return the "true value" of this Value.
 java.lang.String stringValue(Context c)
          Returns the contents of this value, as a String
 java.lang.String toString()
          Pretty-print this value, without adding parens to any lists
 java.lang.String variableValue(Context c)
          Returns the contents of this value, as a String (a variable name)
 
Methods inherited from class jess.Value
equals, equalsStar, funcallValue, longValue, toStringWithParens, type
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

resetFactNumber

public void resetFactNumber()

getName

public java.lang.String getName()

getFactNumber

public int getFactNumber()

getSlotIndex

public int getSlotIndex()

getSubIndex

public int getSubIndex()

getType

public int getType()

resolveValue

public Value resolveValue(Context c)
                   throws JessException
Description copied from class: Value
Given an evaluation context, return the "true value" of this Value. For this class, the true value is always "this". For subclasses, the Context may be used to compute a new Value.
Overrides:
resolveValue in class Value
Following copied from class: jess.Value
Parameters:
c - An execution context. You can pass null if you are sure that you're not calling this method on a subclass that uses the argument.
Returns:
This object
See Also:
Variable, Funcall

externalAddressValue

public final java.lang.Object externalAddressValue(Context c)
                                            throws JessException
Description copied from class: Value
Returns the contents of this value, as an external adress object
Overrides:
externalAddressValue in class Value
Following copied from class: jess.Value
Returns:
The external address object
Throws:
JessException - If this value does not contain an object

factValue

public final 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
Following copied from class: jess.Value
Returns:
The fact
Throws:
JessException - If this value does not contain a fact

listValue

public final ValueVector listValue(Context c)
                            throws JessException
Description copied from class: Value
Returns the contents of this value, as a list
Overrides:
listValue in class Value
Following copied from class: jess.Value
Returns:
The list
Throws:
JessException - If this value does not contain a list

intValue

public final int intValue(Context c)
                   throws JessException
Description copied from class: Value
Returns the contents of this value, as an int
Overrides:
intValue in class Value
Following copied from class: jess.Value
Returns:
The number as an int
Throws:
JessException - If this value does not contain any kind of number

floatValue

public final double floatValue(Context c)
                        throws JessException
Description copied from class: Value
Returns the contents of this value, as a number
Overrides:
floatValue in class Value
Following copied from class: jess.Value
Returns:
The number as a double
Throws:
JessException - If this value does not contain any kind of number

numericValue

public final double numericValue(Context c)
                          throws JessException
Description copied from class: Value
Returns the contents of this value, as a number
Overrides:
numericValue in class Value
Following copied from class: jess.Value
Returns:
The number as a double
Throws:
JessException - If this value does not contain any kind of number

atomValue

public final java.lang.String atomValue(Context c)
                                 throws JessException
Description copied from class: Value
Returns the contents of this value, as an atom
Overrides:
atomValue in class Value
Following copied from class: jess.Value
Returns:
The atom
Throws:
JessException - If this value does not contain any kind of String

variableValue

public final java.lang.String variableValue(Context c)
                                     throws JessException
Description copied from class: Value
Returns the contents of this value, as a String (a variable name)
Overrides:
variableValue in class Value
Following copied from class: jess.Value
Returns:
The name of the variable
Throws:
JessException - If this value does not contain a variable

stringValue

public final java.lang.String stringValue(Context c)
                                   throws JessException
Description copied from class: Value
Returns the contents of this value, as a String
Overrides:
stringValue in class Value
Following copied from class: jess.Value
Returns:
The string
Throws:
JessException - If this value does not contain any kind of String

toString

public java.lang.String toString()
Description copied from class: Value
Pretty-print this value, without adding parens to any lists
Overrides:
toString in class Value
Following copied from class: jess.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
Following copied from class: jess.Value
Returns:
The hashcode

equals

public boolean equals(Value o)
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
Following copied from class: jess.Value
Parameters:
v - The Value to compare to.
Returns:
True if the Values are equivalent.

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