jess
Class JessEvent

java.lang.Object
  extended byjava.util.EventObject
      extended byjess.JessEvent
All Implemented Interfaces:
java.io.Serializable

public class JessEvent
extends java.util.EventObject

JessEvents are used by JessEvent sources (like the Rete class) to convey information about interesting things that happen to registered event listeners.

(C) 2005 Sandia National Laboratories

See Also:
JessListener, Rete.addJessListener(jess.JessListener), Rete.removeJessListener(jess.JessListener), Serialized Form

Field Summary
static int ACTIVATION
          A defrule has been activated or deactivated
static int CLEAR
          A (clear) has been executed
static int DEFCLASS
          A defclass has been added or removed
static int DEFFACTS
          A deffacts has been added or removqed
static int DEFGLOBAL
          A defglobal has been added or removed
static int DEFINSTANCE
          A definstance has been added or removed
static int DEFRULE
          A defrule has been added or removed
static int DEFRULE_FIRED
          A defrule has been fired
static int DEFTEMPLATE
          A deftemplate has been added or removed
static int FACT
          A fact has been asserted or retracted
static int FOCUS
          The module focus has changed
static int HALT
          A (run) has been executed
static int MODIFIED
          Added to other event-related flags to indicate modified fact
static int REMOVED
          Added to other event-related flags to indicate removal of construct
static int RESET
          A (reset) has been executed
static int RETE_TOKEN
          A Rete node has been reached by a token.
static int RETE_TOKEN_LEFT
          A Rete node has been reached by a token, calltype left
static int RETE_TOKEN_RIGHT
          A Rete node has been reached by a token, calltype right
static int RUN
          A (run) has been executed
static int USERFUNCTION
          A userfunction has been added or removed
static int USERFUNCTION_CALLED
          A userfunction has been called
static int USERFUNCTION_RETURNED
          A userfunction has returned from a call
static int USERPACKAGE
          A userpackage has been added or removed
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
JessEvent(java.lang.Object theSource, int type, java.lang.Object obj)
          Construct a JessEvent containing the given information.
JessEvent(java.lang.Object theSource, int type, java.lang.Object obj, Context context)
          Construct a JessEvent containing the given information.
 
Method Summary
 Context getContext()
          Gets the execution context associated with the event.
static java.lang.String getEventName(int type)
          Displays a name for the numeric type of a JessEvent
 java.lang.Object getObject()
          Gets any optional data associated with this event.
 int getType()
          Gets the type of this event.
 java.lang.String toString()
          Return a string suitable for debugging.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFRULE

public static final int DEFRULE
A defrule has been added or removed

See Also:
Constant Field Values

DEFRULE_FIRED

public static final int DEFRULE_FIRED
A defrule has been fired

See Also:
Constant Field Values

ACTIVATION

public static final int ACTIVATION
A defrule has been activated or deactivated

See Also:
Constant Field Values

DEFFACTS

public static final int DEFFACTS
A deffacts has been added or removqed

See Also:
Constant Field Values

FACT

public static final int FACT
A fact has been asserted or retracted

See Also:
Constant Field Values

DEFINSTANCE

public static final int DEFINSTANCE
A definstance has been added or removed

See Also:
Constant Field Values

DEFTEMPLATE

public static final int DEFTEMPLATE
A deftemplate has been added or removed

See Also:
Constant Field Values

DEFCLASS

public static final int DEFCLASS
A defclass has been added or removed

See Also:
Constant Field Values

DEFGLOBAL

public static final int DEFGLOBAL
A defglobal has been added or removed

See Also:
Constant Field Values

USERFUNCTION

public static final int USERFUNCTION
A userfunction has been added or removed

See Also:
Constant Field Values

USERPACKAGE

public static final int USERPACKAGE
A userpackage has been added or removed

See Also:
Constant Field Values

CLEAR

public static final int CLEAR
A (clear) has been executed

See Also:
Constant Field Values

RESET

public static final int RESET
A (reset) has been executed

See Also:
Constant Field Values

RUN

public static final int RUN
A (run) has been executed

See Also:
Constant Field Values

HALT

public static final int HALT
A (run) has been executed

See Also:
Constant Field Values

RETE_TOKEN

public static final int RETE_TOKEN
A Rete node has been reached by a token. Deliberately equal to RETE_TOKEN_LEFT

See Also:
Constant Field Values

RETE_TOKEN_LEFT

public static final int RETE_TOKEN_LEFT
A Rete node has been reached by a token, calltype left

See Also:
Constant Field Values

RETE_TOKEN_RIGHT

public static final int RETE_TOKEN_RIGHT
A Rete node has been reached by a token, calltype right

See Also:
Constant Field Values

USERFUNCTION_CALLED

public static final int USERFUNCTION_CALLED
A userfunction has been called

See Also:
Constant Field Values

FOCUS

public static final int FOCUS
The module focus has changed

See Also:
Constant Field Values

USERFUNCTION_RETURNED

public static final int USERFUNCTION_RETURNED
A userfunction has returned from a call

See Also:
Constant Field Values

MODIFIED

public static final int MODIFIED
Added to other event-related flags to indicate modified fact

See Also:
Constant Field Values

REMOVED

public static final int REMOVED
Added to other event-related flags to indicate removal of construct

See Also:
Constant Field Values
Constructor Detail

JessEvent

public JessEvent(java.lang.Object theSource,
                 int type,
                 java.lang.Object obj)
Construct a JessEvent containing the given information.

Parameters:
theSource - the object (usually an instance of Rete) generating the event.
type - one of the manifest constants in this class.
obj - data relevant to the specific type of this event.

JessEvent

public JessEvent(java.lang.Object theSource,
                 int type,
                 java.lang.Object obj,
                 Context context)
Construct a JessEvent containing the given information.

Parameters:
theSource - the object (usually an instance of Rete) generating the event.
type - one of the manifest constants in this class.
obj - data relevant to the specific type of this event.
context - current execution context of event
Method Detail

getType

public int getType()
Gets the type of this event. The type should be one of the manifest constants in this class.

Returns:
the event's type.

getObject

public java.lang.Object getObject()
Gets any optional data associated with this event. The type of this data depends on the type of the event object. In general, it is an instance of the type of object the event refers to; for example, for DEFRULE_FIRED events it is a Defrule.

Returns:
the optional data.
See Also:
getType()

getContext

public Context getContext()
Gets the execution context associated with the event. May be null if not known. Should never be null for debug events.

Returns:
the execution context when the event occurred
See Also:
getType()

toString

public java.lang.String toString()
Return a string suitable for debugging.

Returns:
Something like [JessEvent: a fact was asserted].

getEventName

public static java.lang.String getEventName(int type)
Displays a name for the numeric type of a JessEvent


© 2006 Sandia Corporation