jess
Class LongValue

java.lang.Object
  extended by jess.Value
      extended by jess.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) 2013 Sandia Corporation

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.
 boolean isLexeme(Context c)
          Indicate whether this object represents a lexeme.
 boolean isLiteral()
          Indicate whether this value represents a literal.
 boolean isNumeric(Context c)
          Indicate whether this object represents a number.
 java.lang.Object javaObjectValue(Context c)
          Returns the contents of this value, as a Java object.
 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, isVariable, 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

javaObjectValue

public java.lang.Object javaObjectValue(Context c)
                                 throws JessException
Description copied from class: Value
Returns the contents of this value, as a Java object.

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

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

isNumeric

public boolean isNumeric(Context c)
                  throws JessException
Description copied from class: Value
Indicate whether this object represents a number. This includes FLOAT, INTEGER, LONG, and FACT values, as well as Strings and symbols that could be parsed as an INTEGER, LONG, or FLOAT.

Overrides:
isNumeric in class Value
Parameters:
c - the execution context used to resolve the value
Returns:
true if this Value is a number.
Throws:
JessException - if something goes wrong during value resolution

isLexeme

public boolean isLexeme(Context c)
                 throws JessException
Description copied from class: Value
Indicate whether this object represents a lexeme. This includes Strings and symbols.

Overrides:
isLexeme in class Value
Parameters:
c - the execution context used to resolve the value
Returns:
true if this Value is a lexeme
Throws:
JessException - if something goes wrong during value resolution

isLiteral

public boolean isLiteral()
Description copied from class: Value
Indicate whether this value represents a literal. A literal has type STRING, SYMBOL, INTEGER, FLOAT, or LONG, and is not a variable.

Overrides:
isLiteral in class Value
Returns:

2013 Sandia Corporation