jess
Class HasLHS

java.lang.Object
  extended by jess.Node
      extended by jess.HasLHS
All Implemented Interfaces:
java.io.Serializable, Modular, Named, Visitable
Direct Known Subclasses:
Defquery, Defrule

public abstract class HasLHS
extends Node
implements java.io.Serializable, Visitable, Modular

Parent class of Defrules and Defqueries.

(C) 2013 Sandia Corporation

See Also:
Serialized Form

Field Summary
 
Fields inherited from class jess.Node
TYPE_ADAPTER, TYPE_NODE1, TYPE_NODE2, TYPE_NODENOT2, TYPE_NONE, TYPE_TERMINAL, TYPE_TEST
 
Method Summary
abstract  java.lang.Object accept(Visitor jv)
          A proper accept() implementation should call one of the visitXXX() methods on the Visitor.
protected  void addCE(jess.ConditionalElementX ce, Rete engine)
          Add a conditional element to this construct
 void addNode(Node n)
          Add a node to this sink.
 java.util.Iterator getBindingNames()
          Return an iterator listing all the variable names used on this rule's left hand side.
 ConditionalElement getConditionalElements()
          Consider this ConditionalElement to be READ ONLY!
 java.lang.String getDisplayName()
          Fetch the display name of this construct
 java.lang.String getDocstring()
          Get the documentation string for this construct.
 int getGroupSize()
          Fetch the number of elenments on the LHS of this construct.
 java.lang.String getModule()
          Returns the name of the module this construct belongs to.
 java.lang.String getName()
          Fetch the name of this construct
 HasLHS getNext()
          Some rules that use the "or" conditional element can be compiled into multiple subrules.
 int getNodeCount()
           
 int getNodeIndexHash()
          Get the node-index-hash setting of this construct.
 java.util.Iterator getNodes()
           
 int getNodeType()
           
 int getPatternCount()
           
 java.lang.String listNodes()
          Return a string (useful for debugging) describing all the Rete network nodes connected to this construct.
 void setLHS(Group ce, Rete engine)
           
 void setNodeIndexHash(int h)
          Set the node-index-hash of this construct.
 
Methods inherited from class jess.Node
addJessListener, decrementUseCount, getSuccessors, getUseCount, incrementUseCount, removeJessListener, successors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jess.Named
getConstructType
 

Method Detail

getGroupSize

public int getGroupSize()
Fetch the number of elenments on the LHS of this construct.

Returns:
The number of CEs

getConditionalElements

public ConditionalElement getConditionalElements()
Consider this ConditionalElement to be READ ONLY!


listNodes

public java.lang.String listNodes()
Return a string (useful for debugging) describing all the Rete network nodes connected to this construct.

Returns:
A textual description of all the nodes used by this construct

getNext

public HasLHS getNext()
Some rules that use the "or" conditional element can be compiled into multiple subrules. In those situations, those subrules are chained together and can be accessed, in order, using this method.

Returns:
the next subrule or subquery in the chain.

getPatternCount

public int getPatternCount()

setLHS

public void setLHS(Group ce,
                   Rete engine)
            throws JessException
Throws:
JessException

addCE

protected void addCE(jess.ConditionalElementX ce,
                     Rete engine)
              throws JessException
Add a conditional element to this construct

Throws:
JessException

getBindingNames

public java.util.Iterator getBindingNames()
Return an iterator listing all the variable names used on this rule's left hand side. Both variables used in defining the rule as well as synthetic variables added by Jess will be included. Note that while compiling a rule, Jess may rename some of the variables that appear. Synthetic variable names always start with an underscore.

Returns:
an Iterator over variable names

getNodes

public java.util.Iterator getNodes()

getNodeCount

public int getNodeCount()

addNode

public void addNode(Node n)
             throws JessException
Add a node to this sink. This addition should be reflected by subsequent calls to "listNodes()".

Parameters:
n - a Rete network node
Throws:
JessException - if n is null

setNodeIndexHash

public void setNodeIndexHash(int h)
Set the node-index-hash of this construct. The node-index-hash value effects the indexing efficiency of the join nodes for this construct. Larger values will make constructs with many partial matches faster (to a point). Must be set before construct is added to engine (so is typically set during parsing via the equivalent Jess command.

Parameters:
h - The node index hash value

getNodeIndexHash

public int getNodeIndexHash()
Get the node-index-hash setting of this construct.

Returns:
The node-index-hash of this construct

getName

public final java.lang.String getName()
Fetch the name of this construct

Specified by:
getName in interface Named
Returns:
The name of this construct

getDisplayName

public java.lang.String getDisplayName()
Fetch the display name of this construct

Returns:
The display name of this construct

getDocstring

public final java.lang.String getDocstring()
Get the documentation string for this construct.

Specified by:
getDocstring in interface Named
Returns:
The docstring for this construct

accept

public abstract java.lang.Object accept(Visitor jv)
Description copied from interface: Visitable
A proper accept() implementation should call one of the visitXXX() methods on the Visitor.

Specified by:
accept in interface Visitable
Parameters:
jv - a visitor to invoke
Returns:
whatever the invoked Visitor method returns.

getModule

public java.lang.String getModule()
Description copied from interface: Modular
Returns the name of the module this construct belongs to.

Specified by:
getModule in interface Modular
Returns:
a module name

getNodeType

public int getNodeType()
Specified by:
getNodeType in class Node

© 2013 Sandia Corporation