Class BuildContext
- java.lang.Object
-
- jadex.rules.rulesystem.rete.builder.BuildContext
-
public class BuildContext extends java.lang.Object
The build context contains all relevant data about the current net building process.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
alpha
Flag indicating if the builder is currently creating alpha nodes.protected INode
lastanode
The last alpha node.protected INode
lastbnode
The last beta node.protected boolean
rightunavailable
Flag indicating that no right input is available (for collect nodes).protected ReteNode
root
The root node.protected IRule
rule
The currently built rule.protected int
tuplecnt
The tuple cnt.protected java.util.Map
varinfos
The 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 void
addVarInfo(VarInfo vi)
Add a new var info.INode
getLastAlphaNode()
Get the lastnode.INode
getLastBetaNode()
Get the lastnode.ReteNode
getRootNode()
Get the root.IRule
getRule()
Get the rule.int
getTupleCount()
Get the tuple count.VarInfo
getVarInfo(Variable var)
Get the variable info.java.util.Map
getVarInfos()
Get the variable infos.boolean
isAlpha()
For each object condition, the builder first creates alpha nodes for all constraints that only apply to the object itself.boolean
isConstrainable(Variable var)
Test if a variable is constrainable (alpha node), i.e.boolean
isJoinable(Variable var)
Test if a found variable is joinable (beta node), i.e.boolean
isLeftAvailable(Variable var)
Test if a variable is left available.boolean
isRightUnavailable()
Get the rightunavailable.void
setAlpha(boolean alpha)
Set the alpha flag.void
setLastAlphaNode(INode lastanode)
Set the lastnode.void
setLastBetaNode(INode lastbnode)
Set the lastnode.void
setRightUnavailable(boolean rightunavailable)
Set the rightunavailable.void
setRootNode(ReteNode root)
Set the root.void
setRule(IRule rule)
Set the rule.void
setTupleCount(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()
-
-