jess
Class RU

java.lang.Object
  |
  +--jess.RU

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

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

(C) 1997 Ernest J. Friedman-Hill and Sandia National Laboratories

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

Inner Class Summary
static interface RU.Compare
          A helper interface used by RU.bsearchVector.
static interface RU.Fetch
          A helper interface used by RU.bsearchVector.
 
Field Summary
static int ATOM
          Data type of atom
static RU.Compare compareEQ
          Comparison that returns true if the first int is equal to the second.
static RU.Compare compareGT
          Comparison that returns true if the first int is greater than the second.
static RU.Compare compareGTE
          Comparison that returns true if the first int is greater than or equal to the second.
static RU.Compare compareLT
          Comparison that returns true if the first int is less than the second.
static RU.Compare compareLTE
          Comparison that returns true if the first int is less than or equal to the second.
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
          Data type of external address
static int FACT
          Data type of fact stored in a value
static int FACT_ID
          Data type of a fact id
static RU.Fetch fetchActSalience
          A Fetch that retrieves salience values from jess.Activation objects.
static RU.Fetch fetchActTime
          A Fetch that retrieves time stamps from jess.Activation objects.
static int FLOAT
          Data type of float
static int FUNCALL
          Data type of function call stored in a value
static int INTARRAY
          Data type of integer array stored in value (internal use)
static int INTEGER
          Data type of integer
static int LIST
          Data type of a list stored in a value
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 int NONE
          Data type of "no value"
static int SLOT
          Data type of slot name stored in a value
static int STRING
          Data type of string
static int VARIABLE
          Data type of a variable
 
Method Summary
static int bsearchVector(int value, java.util.Vector v, int start, int end, RU.Fetch ff, RU.Compare cc)
          A general-purpose helper routine for use in implementing jess.Strategy classes.
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 java.lang.String getTypeName(int type)
          Given a type constant (ATOM, STRING, INTEGER, etc.) return a String version of the name of that type ("ATOM", "STRING", "INTEGER", etc.)
 
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

DT_DFLT_DATA

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

DT_DATA_TYPE

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

DT_SLOT_SIZE

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

NONE

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

ATOM

public static final int ATOM
Data type of atom

STRING

public static final int STRING
Data type of string

INTEGER

public static final int INTEGER
Data type of integer

VARIABLE

public static final int VARIABLE
Data type of a variable

FACT_ID

public static final int FACT_ID
Data type of a fact id

FLOAT

public static final int FLOAT
Data type of float

FUNCALL

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

FACT

public static final int FACT
Data type of fact stored in a value

LIST

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

EXTERNAL_ADDRESS

public static final int EXTERNAL_ADDRESS
Data type of external address

INTARRAY

public static final int INTARRAY
Data type of integer array stored in value (internal use)

MULTIVARIABLE

public static final int MULTIVARIABLE
Data type of multivariable

SLOT

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

MULTISLOT

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

LONG

public static final int LONG
Data type of Java long

fetchActTime

public static final RU.Fetch fetchActTime
A Fetch that retrieves time stamps from jess.Activation objects.

fetchActSalience

public static final RU.Fetch fetchActSalience
A Fetch that retrieves salience values from jess.Activation objects.

compareLTE

public static final RU.Compare compareLTE
Comparison that returns true if the first int is less than or equal to the second.

compareGTE

public static final RU.Compare compareGTE
Comparison that returns true if the first int is greater than or equal to the second.

compareGT

public static final RU.Compare compareGT
Comparison that returns true if the first int is greater than the second.

compareLT

public static final RU.Compare compareLT
Comparison that returns true if the first int is less than the second.

compareEQ

public static final RU.Compare compareEQ
Comparison that returns true if the first int is equal to the second.
Method Detail

getTypeName

public static java.lang.String getTypeName(int type)
Given a type constant (ATOM, STRING, INTEGER, etc.) return a String version of the name of that type ("ATOM", "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.

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

bsearchVector

public static int bsearchVector(int value,
                                java.util.Vector v,
                                int start,
                                int end,
                                RU.Fetch ff,
                                RU.Compare cc)
A general-purpose helper routine for use in implementing jess.Strategy classes. Find the appropriate Object in a Vector of Objects, between the given indexes, using the given Fetch and Compare objects. For example, if you pass in fetchActTime and compareLTE, this function will find the first Activation in the Vector with timestamp less than or equal to 'value'.
Parameters:
value - The reference value to compare to what fetch returns.
v - The vector to search
start - The index in v of the first element to consider
end - The index in v of the last element to consider, plus one.
ff - An RU.Fetch object, used to compute a value for comparison
ff - An RU.Compare object, used to compare fetch values to 'value'.
See Also:
Strategy

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