org.drools.rule
Class GroupElement

java.lang.Object
  extended by org.drools.rule.ConditionalElement
      extended by org.drools.rule.GroupElement
All Implemented Interfaces:
Externalizable, Serializable, Cloneable, RuleConditionElement, RuleComponent

public class GroupElement
extends ConditionalElement
implements Externalizable

See Also:
Serialized Form

Nested Class Summary
static class GroupElement.Type
          A public enum for CE types
 
Field Summary
static GroupElement.Type AND
           
static GroupElement.Type EXISTS
           
static GroupElement.Type NOT
           
static GroupElement.Type OR
           
 
Constructor Summary
GroupElement()
           
GroupElement(GroupElement.Type type)
           
 
Method Summary
 void addChild(int index, RuleConditionElement rce)
          Adds the given child as the (index)th child of the this GroupElement
 void addChild(RuleConditionElement child)
          Adds a child to the current GroupElement.
 Object clone()
          Clones all Conditional Elements but references the non ConditionalElement children
 boolean equals(Object object)
          Traverses two trees and checks that they are structurally equal at all levels
 List getChildren()
           
 ObjectType getForallBaseObjectType()
           
 Map getInnerDeclarations()
          Returns a Map of declarations that are visible inside this conditional element
 List getNestedElements()
          Returs a list of RuleConditionElement's that are nested inside the current element
 Map<String,Declaration> getOuterDeclarations()
          Returns a Map of declarations that are visible outside this conditional element.
 GroupElement.Type getType()
           
 int hashCode()
           
 boolean isAnd()
           
 boolean isExists()
           
 boolean isNot()
           
 boolean isOr()
           
 boolean isPatternScopeDelimiter()
          Returns true in case this RuleConditionElement delimits a pattern visibility scope.
 boolean isRoot()
           
 void pack()
          Optimize the group element subtree by removing redundancies like an AND inside another AND, OR inside OR, single branches AND/OR, etc.
 void pack(GroupElement parent)
           
 void readExternal(ObjectInput in)
           
 Declaration resolveDeclaration(String identifier)
          Resolves the given identifier in the current scope and returns the Declaration object for the declaration.
 void setForallBaseObjectType(ObjectType objectType)
           
 void setRoot(boolean root)
           
 void setType(GroupElement.Type type)
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

AND

public static final GroupElement.Type AND

OR

public static final GroupElement.Type OR

NOT

public static final GroupElement.Type NOT

EXISTS

public static final GroupElement.Type EXISTS
Constructor Detail

GroupElement

public GroupElement()

GroupElement

public GroupElement(GroupElement.Type type)
Method Detail

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

addChild

public void addChild(RuleConditionElement child)
Adds a child to the current GroupElement. Restrictions are: NOT/EXISTS: can have only one child, either a single Pattern or another CE

Parameters:
child -

addChild

public void addChild(int index,
                     RuleConditionElement rce)
Adds the given child as the (index)th child of the this GroupElement

Parameters:
index -
rce -

getChildren

public List getChildren()

getInnerDeclarations

public Map getInnerDeclarations()
Description copied from interface: RuleConditionElement
Returns a Map of declarations that are visible inside this conditional element

Specified by:
getInnerDeclarations in interface RuleConditionElement
Returns:

getOuterDeclarations

public Map<String,Declaration> getOuterDeclarations()
Description copied from interface: RuleConditionElement
Returns a Map of declarations that are visible outside this conditional element.

Specified by:
getOuterDeclarations in interface RuleConditionElement
Returns:

resolveDeclaration

public Declaration resolveDeclaration(String identifier)
Description copied from interface: RuleConditionElement
Resolves the given identifier in the current scope and returns the Declaration object for the declaration. Returns null if identifier can not be resolved.

Specified by:
resolveDeclaration in interface RuleConditionElement
Returns:

setForallBaseObjectType

public void setForallBaseObjectType(ObjectType objectType)

getForallBaseObjectType

public ObjectType getForallBaseObjectType()

pack

public void pack()
Optimize the group element subtree by removing redundancies like an AND inside another AND, OR inside OR, single branches AND/OR, etc. LogicTransformer does further, more complicated, transformations


pack

public void pack(GroupElement parent)
Parameters:
parent -

equals

public boolean equals(Object object)
Traverses two trees and checks that they are structurally equal at all levels

Overrides:
equals in class Object
Parameters:
e1 -
e2 -
Returns:

hashCode

public int hashCode()
Overrides:
hashCode in class Object

clone

public Object clone()
Clones all Conditional Elements but references the non ConditionalElement children

Specified by:
clone in interface RuleConditionElement
Specified by:
clone in class ConditionalElement
Parameters:
e1 -
e2 -
Returns:

getType

public GroupElement.Type getType()

setType

public void setType(GroupElement.Type type)

isAnd

public boolean isAnd()

isOr

public boolean isOr()

isNot

public boolean isNot()

isExists

public boolean isExists()

toString

public String toString()
Overrides:
toString in class Object

getNestedElements

public List getNestedElements()
Description copied from interface: RuleConditionElement
Returs a list of RuleConditionElement's that are nested inside the current element

Specified by:
getNestedElements in interface RuleConditionElement
Returns:

isPatternScopeDelimiter

public boolean isPatternScopeDelimiter()
Description copied from interface: RuleConditionElement
Returns true in case this RuleConditionElement delimits a pattern visibility scope. For instance, AND CE is not a scope delimiter, while NOT CE is a scope delimiter

Specified by:
isPatternScopeDelimiter in interface RuleConditionElement
Returns:

isRoot

public boolean isRoot()

setRoot

public void setRoot(boolean root)


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.