jess
Class Pattern

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

public class Pattern
extends java.lang.Object
implements ConditionalElement, jess.ConditionalElementX, 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) 2005 Sandia National Laboratories

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(java.lang.String slotname, 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.Hashtable bindingsSoFar, java.util.Hashtable 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 slot)
           
 int getPatternCount()
           
 int getSlotLength(int slot)
           
 Test1 getTest(int slot, int test)
           
 boolean isBackwardChainingTrigger()
           
 boolean isGroup()
           
 boolean isMultifieldSubslot(int slot, int subslot)
           
 void recordTestedSlots(int factIndex, java.util.Set testedSlots)
           
 void renameUnmentionedVariables(java.util.Set set, java.util.Map substitutes, int size)
           
 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()
           
 
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

Pattern

public Pattern(Deftemplate deft)
Method Detail

clone

public java.lang.Object clone()
Specified by:
clone in interface jess.ConditionalElementX

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(java.lang.String slotname,
                    Test1 aTest)
             throws JessException
Add a test to this pattern

Throws:
JessException

addDirectlyMatchedVariables

public void addDirectlyMatchedVariables(java.util.Set set)
                                 throws JessException
Specified by:
addDirectlyMatchedVariables in interface jess.ConditionalElementX
Throws:
JessException

renameUnmentionedVariables

public void renameUnmentionedVariables(java.util.Set set,
                                       java.util.Map substitutes,
                                       int size)
                                throws JessException
Specified by:
renameUnmentionedVariables in interface jess.ConditionalElementX
Throws:
JessException

recordTestedSlots

public void recordTestedSlots(int factIndex,
                              java.util.Set testedSlots)
Specified by:
recordTestedSlots in interface jess.ConditionalElementX

findVariableDefinitions

public void findVariableDefinitions(int startIndex,
                                    java.util.Hashtable bindingsSoFar,
                                    java.util.Hashtable newBindings)
                             throws JessException
Specified by:
findVariableDefinitions in interface jess.ConditionalElementX
Throws:
JessException

getNegated

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

Specified by:
getNegated in interface jess.ConditionalElementX

setNegated

public void setNegated()
Specified by:
setNegated in interface jess.ConditionalElementX

setLogical

public void setLogical()
Specified by:
setLogical in interface jess.ConditionalElementX

getLogical

public boolean getLogical()
Specified by:
getLogical in interface jess.ConditionalElementX

setExplicit

public void setExplicit()
Specified by:
setExplicit in interface jess.ConditionalElementX

getExplicit

public boolean getExplicit()

getBackwardChaining

public boolean getBackwardChaining()
Specified by:
getBackwardChaining in interface jess.ConditionalElementX

getName

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

setBoundName

public void setBoundName(java.lang.String s)
                  throws JessException
Specified by:
setBoundName in interface jess.ConditionalElementX
Throws:
JessException

getBoundName

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

getNSlots

public int getNSlots()

getNTests

public int getNTests(int slot)

getSlotLength

public int getSlotLength(int slot)

getNMultifieldsInSlot

public int getNMultifieldsInSlot(int slot)

isMultifieldSubslot

public boolean isMultifieldSubslot(int slot,
                                   int subslot)

getTest

public Test1 getTest(int slot,
                     int test)

getDeftemplate

public Deftemplate getDeftemplate()

addToGroup

public void addToGroup(Group g)
                throws JessException
Specified by:
addToGroup in interface jess.ConditionalElementX
Throws:
JessException

canonicalize

public jess.ConditionalElementX canonicalize()
Specified by:
canonicalize in interface jess.ConditionalElementX

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()
Specified by:
getPatternCount in interface jess.ConditionalElementX

getConditionalElementX

public jess.ConditionalElementX getConditionalElementX(int i)
Specified by:
getConditionalElementX in interface jess.ConditionalElementX

equals

public boolean equals(java.lang.Object o)

isBackwardChainingTrigger

public boolean isBackwardChainingTrigger()
Specified by:
isBackwardChainingTrigger in interface jess.ConditionalElementX

getBackchainingTemplateName

public java.lang.String getBackchainingTemplateName()

getNameWithoutBackchainingPrefix

public java.lang.String getNameWithoutBackchainingPrefix()

toString

public java.lang.String toString()

© 2006 Sandia Corporation