jess
Class Pattern

java.lang.Object
  |
  +--jess.Pattern
All Implemented Interfaces:
java.lang.Cloneable, jess.Groupable, java.io.Serializable, Visitable

public class Pattern
extends java.lang.Object
implements jess.Groupable, java.io.Serializable, Visitable, java.lang.Cloneable

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.

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

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

Constructor Summary
Pattern(java.lang.String name, Deftemplate deft)
           
Pattern(java.lang.String name, Rete engine)
           
 
Method Summary
 java.lang.Object accept(Visitor jv)
           
 void addDirectlyMatchedVariables(java.util.Map map)
           
 void addTest(java.lang.String slotname, Test1 aTest)
          Add a test to this pattern
 void addToLHS(HasLHS l, Rete engine)
           
 java.lang.Object clone()
           
 boolean equals(java.lang.Object o)
           
 void flattenToGroup(jess.Group g, int negcnt)
          If this is a duplicate or trivial modification of a pattern already in the group, special action will be taken -- for example, a prexisting (exists) is removed and replaced with an identical plain pattern.
 java.lang.String getBackchainingTemplateName()
           
 boolean getBackwardChaining()
           
 java.lang.String getBoundName()
           
 Deftemplate getDeftemplate()
           
 boolean getExplicit()
           
 jess.Groupable getGroupable(int i)
           
 int getGroupSize()
           
 boolean getLogical()
           
 java.lang.String getName()
           
 java.lang.String getNameWithoutBackchainingPrefix()
           
 int getNegated()
          Is this pattern a (not()) CE pattern, possibly nested?
 int getNMultifieldsInSlot(int slot)
           
 int getNSlots()
           
 int getNTests(int slot)
           
 int getSlotLength(int slot)
           
 Test1 getTest(int slot, int test)
           
 boolean getUnique()
           
 boolean isBackwardChainingTrigger()
           
 boolean isMultifieldSubslot(int slot, int subslot)
           
 void renameUnmentionedVariables(java.util.Map map, java.util.Map substitutes, int size)
           
 void setBoundName(java.lang.String s)
           
 void setExplicit()
           
 void setLogical()
           
 void setNegated(int negcnt)
           
 void setSlotLength(java.lang.String slotname, int length)
          Set the length of a multislot within a pattern
 void setUnique()
           
 jess.Groupable simplify()
           
 int size()
           
 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(java.lang.String name,
               Deftemplate deft)
Method Detail

size

public int size()
Returns:
The number of slots in this pattern's Deftemplate

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

addTest

public void addTest(java.lang.String slotname,
                    Test1 aTest)
             throws JessException
Add a test to this pattern

addDirectlyMatchedVariables

public void addDirectlyMatchedVariables(java.util.Map map)
                                 throws JessException
Specified by:
addDirectlyMatchedVariables in interface jess.Groupable

renameUnmentionedVariables

public void renameUnmentionedVariables(java.util.Map map,
                                       java.util.Map substitutes,
                                       int size)
                                throws JessException
Specified by:
renameUnmentionedVariables in interface jess.Groupable

getNegated

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

setNegated

public void setNegated(int negcnt)

setLogical

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

getLogical

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

setUnique

public void setUnique()
Specified by:
setUnique in interface jess.Groupable

getUnique

public boolean getUnique()

setExplicit

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

getExplicit

public boolean getExplicit()

getBackwardChaining

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

getName

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

setBoundName

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

getBoundName

public java.lang.String getBoundName()

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()

flattenToGroup

public void flattenToGroup(jess.Group g,
                           int negcnt)
                    throws JessException
If this is a duplicate or trivial modification of a pattern already in the group, special action will be taken -- for example, a prexisting (exists) is removed and replaced with an identical plain pattern.
Specified by:
flattenToGroup in interface jess.Groupable

addToLHS

public void addToLHS(HasLHS l,
                     Rete engine)
              throws JessException
Specified by:
addToLHS in interface jess.Groupable

simplify

public jess.Groupable simplify()
Specified by:
simplify in interface jess.Groupable

accept

public java.lang.Object accept(Visitor jv)
Specified by:
accept in interface Visitable

getGroupSize

public int getGroupSize()
Specified by:
getGroupSize in interface jess.Groupable

getGroupable

public jess.Groupable getGroupable(int i)
Specified by:
getGroupable in interface jess.Groupable

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

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