Class BuildContext
- java.lang.Object
-
- jadex.rules.rulesystem.rete.builder.BuildContext
-
public class BuildContext extends java.lang.ObjectThe build context contains all relevant data about the current net building process.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanalphaFlag indicating if the builder is currently creating alpha nodes.protected INodelastanodeThe last alpha node.protected INodelastbnodeThe last beta node.protected booleanrightunavailableFlag indicating that no right input is available (for collect nodes).protected ReteNoderootThe root node.protected IRuleruleThe currently built rule.protected inttuplecntThe tuple cnt.protected java.util.MapvarinfosThe first variable occurrence.
-
Constructor Summary
Constructors Constructor Description BuildContext(ReteNode root, IRule rule)Create a new build context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddVarInfo(VarInfo vi)Add a new var info.INodegetLastAlphaNode()Get the lastnode.INodegetLastBetaNode()Get the lastnode.ReteNodegetRootNode()Get the root.IRulegetRule()Get the rule.intgetTupleCount()Get the tuple count.VarInfogetVarInfo(Variable var)Get the variable info.java.util.MapgetVarInfos()Get the variable infos.booleanisAlpha()For each object condition, the builder first creates alpha nodes for all constraints that only apply to the object itself.booleanisConstrainable(Variable var)Test if a variable is constrainable (alpha node), i.e. was formerly used in this condition.booleanisJoinable(Variable var)Test if a found variable is joinable (beta node), i.e. if it was formerly used in another condition.booleanisLeftAvailable(Variable var)Test if a variable is left available.booleanisRightUnavailable()Get the rightunavailable.voidsetAlpha(boolean alpha)Set the alpha flag.voidsetLastAlphaNode(INode lastanode)Set the lastnode.voidsetLastBetaNode(INode lastbnode)Set the lastnode.voidsetRightUnavailable(boolean rightunavailable)Set the rightunavailable.voidsetRootNode(ReteNode root)Set the root.voidsetRule(IRule rule)Set the rule.voidsetTupleCount(int tuplecnt)Set the tuple count.
-
-
-
Field Detail
-
root
protected ReteNode root
The root node.
-
rule
protected IRule rule
The currently built rule.
-
lastanode
protected INode lastanode
The last alpha node.
-
lastbnode
protected INode lastbnode
The last beta node.
-
tuplecnt
protected int tuplecnt
The tuple cnt.
-
varinfos
protected java.util.Map varinfos
The first variable occurrence.
-
rightunavailable
protected boolean rightunavailable
Flag indicating that no right input is available (for collect nodes).
-
alpha
protected boolean alpha
Flag indicating if the builder is currently creating alpha nodes.
-
-
Method Detail
-
getRootNode
public ReteNode getRootNode()
Get the root.- Returns:
- The root.
-
setRootNode
public void setRootNode(ReteNode root)
Set the root.- Parameters:
root- The root to set.
-
getRule
public IRule getRule()
Get the rule.- Returns:
- The rule.
-
setRule
public void setRule(IRule rule)
Set the rule.- Parameters:
rule- The rule to set.
-
getLastAlphaNode
public INode getLastAlphaNode()
Get the lastnode.- Returns:
- The lastnode.
-
setLastAlphaNode
public void setLastAlphaNode(INode lastanode)
Set the lastnode.- Parameters:
lastnode- The lastnode to set.
-
getLastBetaNode
public INode getLastBetaNode()
Get the lastnode.- Returns:
- The lastnode.
-
setLastBetaNode
public void setLastBetaNode(INode lastbnode)
Set the lastnode.- Parameters:
lastnode- The lastnode to set.
-
getTupleCount
public int getTupleCount()
Get the tuple count.- Returns:
- The tuplecnt.
-
setTupleCount
public void setTupleCount(int tuplecnt)
Set the tuple count.- Parameters:
tuplecnt- The tuplecnt to set.
-
addVarInfo
public void addVarInfo(VarInfo vi)
Add a new var info.
-
getVarInfo
public VarInfo getVarInfo(Variable var)
Get the variable info.- Parameters:
var- The variable.- Returns:
- The variable info.
-
getVarInfos
public java.util.Map getVarInfos()
Get the variable infos.- Returns:
- The variable infos.
-
isJoinable
public boolean isJoinable(Variable var)
Test if a found variable is joinable (beta node), i.e. if it was formerly used in another condition.- Parameters:
var- The variable.- Returns:
- True, if joinable.
-
isConstrainable
public boolean isConstrainable(Variable var)
Test if a variable is constrainable (alpha node), i.e. was formerly used in this condition.- Parameters:
var- The variable.- Returns:
- True, if constrainable.
-
isLeftAvailable
public boolean isLeftAvailable(Variable var)
Test if a variable is left available.- Parameters:
var- The variable.- Returns:
- True, if left available.
-
isRightUnavailable
public boolean isRightUnavailable()
Get the rightunavailable.- Returns:
- The rightunavailable.
-
setRightUnavailable
public void setRightUnavailable(boolean rightunavailable)
Set the rightunavailable.- Parameters:
rightunavailable- The rightunavailable to set.
-
isAlpha
public boolean isAlpha()
For each object condition, the builder first creates alpha nodes for all constraints that only apply to the object itself. Afterwards, a beta node is created, containing the additional (join) constraints.- Returns:
- The alpha flag.
-
setAlpha
public void setAlpha(boolean alpha)
Set the alpha flag.- See Also:
isAlpha()
-
-