jess
Class LongValue

java.lang.Object
  extended byjess.Value
      extended byjess.LongValue
All Implemented Interfaces:
java.io.Serializable

public class LongValue
extends Value
implements java.io.Serializable

A LongValue represents a Java long in Jess. You can do arithmetic and perform various other operations on LongValues. Use this subclass of Value when you want to create a Value that represents a Java long.

(C) 2006 Sandia National Laboratories

See Also:
Serialized Form

Constructor Summary
LongValue(long l)
          Create a LongValue
 
Method Summary
 boolean equals(java.lang.Object v)
          Compare this value to another object.
 boolean equals(Value v)
          Compare this value to another value.
 boolean equalsStar(Value v)
          Like equals(Value), but returns true for 3 == 3.0
 int hashCode()
          Return a hashcode for the object.
 int intValue(Context c)
          Returns the contents of this value, as an int.
 long longValue(Context c)
          Returns the contents of this value, as a long.
 double numericValue(Context c)
          Returns the contents of this value, as a number.
 java.lang.String stringValue(Context c)
          Returns the contents of this value, as a String.
 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, externalAddressValue, factValue, floatValue, funcallValue, functionValue, isLexeme, isNumeric, javaObjectValue, listValue, resolveValue, symbolValue, toStringWithParens, type, variableValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LongValue

public LongValue(long l)
          throws JessException
Create a LongValue

Parameters:
l - The long value
Throws:
JessException - If the type is invalid
Method Detail

longValue

public final long longValue(Context c)
Description copied from class: Value
Returns the contents of this value, as a long.

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

numericValue

public final 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

intValue

public final 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

stringValue

public final java.lang.String stringValue(Context c)
Description copied from class: Value
Returns the contents of this value, as a String.

Overrides:
stringValue in class Value
Parameters:
c - the execution context used to resolve the value
Returns:
the string

toString

public final 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

equals

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

equals

public final boolean equals(java.lang.Object v)
Description copied from class: Value
Compare this value to another object. As a convenience, if the parameter is not a Value, it will be compared to any contained Object inside this Value (a String or Java object.)

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

equalsStar

public final boolean equalsStar(Value v)
Description copied from class: Value
Like equals(Value), but returns true for 3 == 3.0

Overrides:
equalsStar in class Value
Parameters:
v - Value to compare to
Returns:
true if the values are loosely equivalent

hashCode

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

Overrides:
hashCode in class Value
Returns:
the hashcode

© 2007 Sandia Corporation