jess
Class Defrule

java.lang.Object
  |
  +--jess.Node
        |
        +--jess.HasLHS
              |
              +--jess.Defrule
All Implemented Interfaces:
Modular, java.io.Serializable, Visitable

public class Defrule
extends HasLHS
implements java.io.Serializable

Class used to represent Defrules. These are constructed by the parser.

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

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

Fields inherited from class jess.Node
LEFT, m_usecount, RIGHT
 
Method Summary
 java.lang.Object accept(Visitor jv)
           
 boolean callNodeLeft(Token token)
          All we need to do is create or destroy the appropriate Activation object, which contains enough info to fire a rule.
 int evalSalience(Rete engine)
          Evaluate the salience of this rule.
 Funcall getAction(int idx)
          Fetch the idx-th RHS action of this rule
 boolean getAutoFocus()
           
 int getNActions()
          Fetch the number of actions on this rule's RHS
 int getSalience()
          Fetch the salience setting of this rule
 void setAutoFocus(boolean autoFocus)
           
 
Methods inherited from class jess.HasLHS
getDisplayName, getDocstring, getModule, getName, getNodeIndexHash, getNPatterns, getPattern, listNodes, setNodeIndexHash
 
Methods inherited from class jess.Node
addJessListener, getSuccessors, removeJessListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSalience

public final int getSalience()
Fetch the salience setting of this rule
Returns:
The salience of this defrule

getAutoFocus

public boolean getAutoFocus()

setAutoFocus

public void setAutoFocus(boolean autoFocus)

evalSalience

public int evalSalience(Rete engine)
                 throws JessException
Evaluate the salience of this rule. If the salience was set to a Funcall value during parsing, then this function may return different values over time. If the salience is constant, this is equivalent to getSalience.
Parameters:
engine - The Rete engine the rule belongs to
Returns:
The evaluated salience
Throws:
JessException - If something goes wrong

callNodeLeft

public boolean callNodeLeft(Token token)
                     throws JessException
All we need to do is create or destroy the appropriate Activation object, which contains enough info to fire a rule.
Parameters:
token -  
callType -  
Returns:
 
Throws:
JessException -  

getNActions

public int getNActions()
Fetch the number of actions on this rule's RHS
Returns:
The number of actions

getAction

public Funcall getAction(int idx)
Fetch the idx-th RHS action of this rule
Returns:
The action as a Funcall

accept

public java.lang.Object accept(Visitor jv)
Overrides:
accept in class HasLHS

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