jess
Class Pattern

java.lang.Object
  extended by jess.Pattern
All Implemented Interfaces:
java.io.Serializable, ConditionalElement, Visitable

public class Pattern
extends java.lang.Object
implements ConditionalElement, java.io.Serializable, Visitable

A Pattern represents a single conditional element on a rule LHS. A Pattern consists mainly of a two-dimensional array of Test1 structures. Each Test1 contains information about a specific characteristic of a slot.

Most users will not use this class directly, but you could use it to build rules directly in the Java language.

(C) 2013 Sandia Corporation

See Also:
Serialized Form

Constructor Summary
Pattern(Deftemplate deft)
           
Pattern(java.lang.String name, Rete engine)
           
 
Method Summary
 java.lang.Object accept(Visitor jv)
          A proper accept() implementation should call one of the visitXXX() methods on the Visitor.
 void addDirectlyMatchedVariables(java.util.Set set)
           
 void addTest(Test1 aTest)
          Add a test to this pattern
 void addToGroup(Group g)
           
 jess.ConditionalElementX canonicalize()
           
 java.lang.Object clone()
           
 boolean equals(java.lang.Object o)
           
 void findVariableDefinitions(int startIndex, java.util.Map bindingsSoFar, java.util.Map newBindings)
           
 java.lang.String getBackchainingTemplateName()
           
 boolean getBackwardChaining()
           
 java.lang.String getBoundName()
           
 ConditionalElement getConditionalElement(int i)
           
 jess.ConditionalElementX getConditionalElementX(int i)
           
 Deftemplate getDeftemplate()
           
 boolean getExplicit()
           
 int getGroupSize()
           
 boolean getLogical()
           
 java.lang.String getName()
           
 java.lang.String getNameWithoutBackchainingPrefix()
           
 boolean getNegated()
          Is this pattern a (not()) CE pattern, possibly nested?
 int getNMultifieldsInSlot(int slot)
           
 int getNSlots()
           
 int getNTests()
           
 int getNTests(int slot)
           
 int getPatternCount()
           
 int getSlotLength(int slot)
           
 java.util.Iterator getTests()
           
 java.util.Iterator getTests(int slot)
           
 java.util.Iterator getTests(java.lang.String slotName)
           
 boolean isBackwardChainingTrigger()
           
 boolean isGroup()
           
 boolean isMultifieldSubslot(int slot, int subslot)
           
 void recordTestedSlots(java.util.Set testedSlots)
           
 int renameUnmentionedVariables(java.util.Set set, java.util.Map substitutes, int seqNum, java.lang.String groupPrefix)
           
 void setBoundName(java.lang.String s)
           
 void setExplicit()
           
 void setLogical()
           
 void setNegated()
           
 void setSlotLength(java.lang.String slotname, int length)
          Set the length of a multislot within a pattern
 java.lang.String toString()
           
 void transformOrConjunctionsIntoOrFuncalls(int startIndex, java.util.Map bindings, Rete engine)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pattern

public Pattern(java.lang.String name,
               Rete engine)
        throws JessException
Throws:
JessException

Pattern

public Pattern(Deftemplate deft)
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

setSlotLength

public void setSlotLength(java.lang.String slotname,
                          int length)
                   throws JessException
Set the length of a multislot within a pattern

Throws:
JessException

addTest

public void addTest(Test1 aTest)
             throws JessException
Add a test to this pattern

Throws:
JessException

addDirectlyMatchedVariables

public void addDirectlyMatchedVariables(java.util.Set set)
                                 throws JessException
Throws:
JessException

renameUnmentionedVariables

public int renameUnmentionedVariables(java.util.Set set,
                                      java.util.Map substitutes,
                                      int seqNum,
                                      java.lang.String groupPrefix)
                               throws JessException
Throws:
JessException

recordTestedSlots

public void recordTestedSlots(java.util.Set testedSlots)
                       throws JessException
Throws:
JessException

findVariableDefinitions

public void findVariableDefinitions(int startIndex,
                                    java.util.Map bindingsSoFar,
                                    java.util.Map newBindings)
                             throws JessException
Throws:
JessException

getNegated

public boolean getNegated()
Is this pattern a (not()) CE pattern, possibly nested?


setNegated

public void setNegated()

setLogical

public void setLogical()

getLogical

public boolean getLogical()

setExplicit

public void setExplicit()

getExplicit

public boolean getExplicit()

getBackwardChaining

public boolean getBackwardChaining()

getName

public java.lang.String getName()
Specified by:
getName in interface ConditionalElement

setBoundName

public void setBoundName(java.lang.String s)
                  throws JessException
Throws:
JessException

getBoundName

public java.lang.String getBoundName()
Specified by:
getBoundName in interface ConditionalElement

getNSlots

public int getNSlots()

getNTests

public int getNTests(int slot)
              throws JessException
Throws:
JessException

getNTests

public int getNTests()

getSlotLength

public int getSlotLength(int slot)

getNMultifieldsInSlot

public int getNMultifieldsInSlot(int slot)
                          throws JessException
Throws:
JessException

isMultifieldSubslot

public boolean isMultifieldSubslot(int slot,
                                   int subslot)
                            throws JessException
Throws:
JessException

getTests

public java.util.Iterator getTests()

getTests

public java.util.Iterator getTests(int slot)
                            throws JessException
Throws:
JessException

getTests

public java.util.Iterator getTests(java.lang.String slotName)
                            throws JessException
Throws:
JessException

getDeftemplate

public Deftemplate getDeftemplate()

addToGroup

public void addToGroup(Group g)
                throws JessException
Throws:
JessException

canonicalize

public jess.ConditionalElementX canonicalize()

accept

public 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.

getGroupSize

public int getGroupSize()
Specified by:
getGroupSize in interface ConditionalElement

isGroup

public boolean isGroup()
Specified by:
isGroup in interface ConditionalElement

getConditionalElement

public ConditionalElement getConditionalElement(int i)
Specified by:
getConditionalElement in interface ConditionalElement

getPatternCount

public int getPatternCount()

getConditionalElementX

public jess.ConditionalElementX getConditionalElementX(int i)

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

isBackwardChainingTrigger

public boolean isBackwardChainingTrigger()

getBackchainingTemplateName

public java.lang.String getBackchainingTemplateName()

getNameWithoutBackchainingPrefix

public java.lang.String getNameWithoutBackchainingPrefix()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

transformOrConjunctionsIntoOrFuncalls

public void transformOrConjunctionsIntoOrFuncalls(int startIndex,
                                                  java.util.Map bindings,
                                                  Rete engine)
                                           throws JessException
Throws:
JessException

© 2013 Sandia Corporation