jess
Class RU

java.lang.Object
  extended by jess.RU
All Implemented Interfaces:
java.io.Serializable

public class RU
extends java.lang.Object
implements java.io.Serializable

General utilities and manifest constants for Jess. All fields and methods in this class are static, and there is no constructor.

(C) 2013 Sandia Corporation

See Also:
Serialized Form

Field Summary
static int ACCUM_RESULT
          Variable is an accumulate result
static int AND
          Test is anded with previous
static int ANY
          Any data type
static int ATOM
          Deprecated. use SYMBOL instead
static int BINDING
          Data type of variable binding stored in value (internal use)
static java.lang.String DEFAULT_SLOT_NAME
          Special multislot name used for ordered facts
static int DT_DATA_TYPE
          Relative index of slot data type within a deftemplate's slots
static int DT_DFLT_DATA
          Relative index of slot default value within a deftemplate's slots
static int DT_SLOT_NAME
          Relative index of slot name within a deftemplate's slots
static int DT_SLOT_SIZE
          Size of a slot in a deftemplate
static int EXTERNAL_ADDRESS
          Deprecated. Since Jess 7, use JAVA_OBJECT instead.
static int FACT
          Data type of a fact id
static int FLOAT
          Data type of float
static int FUNCALL
          Data type of function call stored in a value
static int GLOBAL
          Variable is global
static int INTEGER
          Data type of integer
static int JAVA_OBJECT
          Data type of arbitrary Java object
static int LAMBDA
          Data type of a lambda expression
static int LEXEME
          Data type of lexeme (symbol or string)
static int LIST
          Data type of a list stored in a value
static int LOCAL
          Variable is local to a defrule or deffunction
static int LONG
          Data type of Java long
static int MULTISLOT
          Data type of multislot name stored in a value
static int MULTIVARIABLE
          Data type of multivariable
static java.lang.String NO_SLOT
          A slot name for tests not attached to any slot
static int NONE
          Data type of "no value"
static int NUMBER
          Data type of numnber (integer, float, or long)
static int OR
          Test is ored with previous
static int PATTERN
          Variable contains a fact index
static java.lang.String ROOT_DEFTEMPLATE
          The name of the ultimate parent of all deftemplates
static int SLOT
          Data type of slot name stored in a value
static int STRING
          Data type of string
static int SYMBOL
          Data type of symbol
static int VARIABLE
          Data type of a variable
 
Method Summary
static java.lang.String gensym(java.lang.String prefix)
          Generate a pseudo-unique symbol starting with "prefix"
static java.lang.String getProperty(java.lang.String prop)
          Get a property, but return null on SecurityException
static int getTypeCode(java.lang.String typeName)
           
static java.lang.String getTypeName(int type)
          Given a type constant (SYMBOL, STRING, INTEGER, etc.) return a String version of the name of that type ("SYMBOL", "STRING", "INTEGER", etc.)
static Value objectToValue(java.lang.Class clazz, java.lang.Object obj)
          Create a Jess Value object out of a Java Object.
static java.lang.String removePrefix(java.lang.String name)
           
static java.lang.String tagName(int tag)
          Returns a human-readable name for one of the tag values used by the Token class.
static java.lang.Object valueToObject(java.lang.Class clazz, Value value, Context context)
          Return a Java object derived from the Value which matches the Class object as closely as possible.
static java.lang.Object valueToObject(java.lang.Class clazz, Value value, Context context, boolean strict)
          Return a Java object derived from the Value which matches the Class object as closely as possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DT_SLOT_NAME

public static final int DT_SLOT_NAME
Relative index of slot name within a deftemplate's slots

See Also:
Constant Field Values

DT_DFLT_DATA

public static final int DT_DFLT_DATA
Relative index of slot default value within a deftemplate's slots

See Also:
Constant Field Values

DT_DATA_TYPE

public static final int DT_DATA_TYPE
Relative index of slot data type within a deftemplate's slots

See Also:
Constant Field Values

DT_SLOT_SIZE

public static final int DT_SLOT_SIZE
Size of a slot in a deftemplate

See Also:
Constant Field Values

NONE

public static final int NONE
Data type of "no value"

See Also:
Constant Field Values

ATOM

public static final int ATOM
Deprecated. use SYMBOL instead
See Also:
Constant Field Values

SYMBOL

public static final int SYMBOL
Data type of symbol

See Also:
Constant Field Values

STRING

public static final int STRING
Data type of string

See Also:
Constant Field Values

INTEGER

public static final int INTEGER
Data type of integer

See Also:
Constant Field Values

VARIABLE

public static final int VARIABLE
Data type of a variable

See Also:
Constant Field Values

FACT

public static final int FACT
Data type of a fact id

See Also:
Constant Field Values

FLOAT

public static final int FLOAT
Data type of float

See Also:
Constant Field Values

FUNCALL

public static final int FUNCALL
Data type of function call stored in a value

See Also:
Constant Field Values

LIST

public static final int LIST
Data type of a list stored in a value

See Also:
Constant Field Values

JAVA_OBJECT

public static final int JAVA_OBJECT
Data type of arbitrary Java object

See Also:
Constant Field Values

LEXEME

public static final int LEXEME
Data type of lexeme (symbol or string)

See Also:
Constant Field Values

ANY

public static final int ANY
Any data type

See Also:
Constant Field Values

EXTERNAL_ADDRESS

public static final int EXTERNAL_ADDRESS
Deprecated. Since Jess 7, use JAVA_OBJECT instead.
Data type of external address

See Also:
Constant Field Values

BINDING

public static final int BINDING
Data type of variable binding stored in value (internal use)

See Also:
Constant Field Values

MULTIVARIABLE

public static final int MULTIVARIABLE
Data type of multivariable

See Also:
Constant Field Values

SLOT

public static final int SLOT
Data type of slot name stored in a value

See Also:
Constant Field Values

MULTISLOT

public static final int MULTISLOT
Data type of multislot name stored in a value

See Also:
Constant Field Values

LONG

public static final int LONG
Data type of Java long

See Also:
Constant Field Values

LAMBDA

public static final int LAMBDA
Data type of a lambda expression

See Also:
Constant Field Values

NUMBER

public static final int NUMBER
Data type of numnber (integer, float, or long)

See Also:
Constant Field Values

LOCAL

public static final int LOCAL
Variable is local to a defrule or deffunction

See Also:
Constant Field Values

GLOBAL

public static final int GLOBAL
Variable is global

See Also:
Constant Field Values

ACCUM_RESULT

public static final int ACCUM_RESULT
Variable is an accumulate result

See Also:
Constant Field Values

PATTERN

public static final int PATTERN
Variable contains a fact index

See Also:
Constant Field Values

AND

public static final int AND
Test is anded with previous

See Also:
Constant Field Values

OR

public static final int OR
Test is ored with previous

See Also:
Constant Field Values

DEFAULT_SLOT_NAME

public static final java.lang.String DEFAULT_SLOT_NAME
Special multislot name used for ordered facts

See Also:
Constant Field Values

ROOT_DEFTEMPLATE

public static final java.lang.String ROOT_DEFTEMPLATE
The name of the ultimate parent of all deftemplates

See Also:
Constant Field Values

NO_SLOT

public static final java.lang.String NO_SLOT
A slot name for tests not attached to any slot

See Also:
Constant Field Values
Method Detail

getTypeName

public static java.lang.String getTypeName(int type)
Given a type constant (SYMBOL, STRING, INTEGER, etc.) return a String version of the name of that type ("SYMBOL", "STRING", "INTEGER", etc.)

Parameters:
type - One of the type constants in this class
Returns:
The String name of this type, or null if the constant is out of range.

getTypeCode

public static int getTypeCode(java.lang.String typeName)
                       throws JessException
Throws:
JessException

gensym

public static java.lang.String gensym(java.lang.String prefix)
Generate a pseudo-unique symbol starting with "prefix"

Parameters:
prefix - The alphabetic part of the symbol
Returns:
The new symbol

getProperty

public static java.lang.String getProperty(java.lang.String prop)
Get a property, but return null on SecurityException

Parameters:
prop - The property name to get
Returns:
The value of the property, or null if none or security problem

tagName

public static java.lang.String tagName(int tag)
Returns a human-readable name for one of the tag values used by the Token class.

Parameters:
tag - a Rete network tag value
Returns:
the name of the tag

removePrefix

public static java.lang.String removePrefix(java.lang.String name)

valueToObject

public static java.lang.Object valueToObject(java.lang.Class clazz,
                                             Value value,
                                             Context context)
                                      throws java.lang.IllegalArgumentException,
                                             JessException
Return a Java object derived from the Value which matches the Class object as closely as possible. If the class is a primitive Class standin like Integer.TYPE, then the returned value will be boxed; i.e., since this routine can't return an int, it will return an Integer. If there's no way to match the Value to the given Class, an IllegalArgumentException will be thrown. Jess uses this method internally to prepare arguments for reflective method calls.

Parameters:
clazz - the desired class of the result
value - the Value to be converted
context - a Context used for resolving the Value, if needed
Returns:
a Java object of the given class
Throws:
java.lang.IllegalArgumentException - if the conversion is impossible
JessException - if anything else goes wrong

valueToObject

public static java.lang.Object valueToObject(java.lang.Class clazz,
                                             Value value,
                                             Context context,
                                             boolean strict)
                                      throws java.lang.IllegalArgumentException,
                                             JessException
Return a Java object derived from the Value which matches the Class object as closely as possible. If the class is a primitive Class standin like Integer.TYPE, then the returned value will be boxed; i.e., since this routine can't return an int, it will return an Integer. Optionally, this method can allow generous conversions like parsing a String into a number. If there's no way to match the Value to the given Class, an IllegalArgumentException will be thrown. Jess uses this method internally to prepare arguments for reflective method calls.

Parameters:
clazz - the desired class of the result
value - the Value to be converted
context - a Context used for resolving the Value, if needed
strict - false to allow Strings to be parsed as numbers
Returns:
a Java object of the given class
Throws:
java.lang.IllegalArgumentException - if the conversion is impossible
JessException - if anything else goes wrong

objectToValue

public static Value objectToValue(java.lang.Class clazz,
                                  java.lang.Object obj)
                           throws JessException
Create a Jess Value object out of a Java Object. The Class object indicates whether the given object is boxed or not; i.e., the object may be an Integer while the Class is Integer.TYPE, indicating that the argument is actually a boxed int. Jess uses this internally to interpret the results of reflective method calls.

Parameters:
clazz - a Class representing the type of the other argument
obj - an object to be converted
Returns:
a Jess Value representing the value of the object
Throws:
JessException - if anything goes wrong

© 2013 Sandia Corporation