public class BindingStack extends Object implements BindingEnvironment
Constructor and Description |
---|
BindingStack()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
bind(int i,
Node value)
Bind the ith variable in the current envionment to the given value.
|
boolean |
bind(Node var,
Node value)
Bind a variable in the current envionment to the given value.
|
void |
bindNoCheck(Node_RuleVariable var,
Node value)
Bind a variable in the current envionment to the given value.
|
void |
commit()
Forget the previously pushed state but keep the current environment.
|
Node |
getBinding(Node node)
If the node is a variable then return the current binding (null if not bound)
otherwise return the node itself.
|
Node[] |
getEnvironment()
Return the current array of bindings
|
Node |
getGroundVersion(Node node)
Return the most ground version of the node.
|
Triple |
instantiate(TriplePattern pattern)
Instantiate a triple pattern against the current environment.
|
void |
push()
Save the current environment on an internal stack
|
void |
reset(int newSize)
Reset the binding environment to empty.
|
void |
unwind()
Forget the current environment and return the previously
pushed state.
|
public BindingStack()
public void push()
public void unwind() throws IndexOutOfBoundsException
IndexOutOfBoundsException
- if there was not previous pushpublic void commit() throws IndexOutOfBoundsException
IndexOutOfBoundsException
- if there was not previous pushpublic void reset(int newSize)
newSize
- the number of variables needed for processing the new rulepublic Node[] getEnvironment()
public Node getBinding(Node node)
public Node getGroundVersion(Node node)
getGroundVersion
in interface BindingEnvironment
public boolean bind(int i, Node value)
public boolean bind(Node var, Node value)
bind
in interface BindingEnvironment
var
- a Node_RuleVariable defining the variable to bindvalue
- the value to bindpublic void bindNoCheck(Node_RuleVariable var, Node value)
var
- a Node_RuleVariable defining the variable to bindvalue
- the value to bindpublic Triple instantiate(TriplePattern pattern)
instantiate
in interface BindingEnvironment
pattern
- the triple pattern to matchLicenced under the Apache License, Version 2.0