Package org.globus.rsl
Class AbstractRslNode
- java.lang.Object
-
- org.globus.rsl.AbstractRslNode
-
- Direct Known Subclasses:
ListRslNode,RslNode
public abstract class AbstractRslNode extends Object
This class represents an abstract RSL parse tree. It is composed of variable definitions (bindings), relations, and sub-specifications (sub nodes).
-
-
Constructor Summary
Constructors Constructor Description AbstractRslNode()AbstractRslNode(int operator)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanadd(AbstractRslNode node)Adds a rsl parse tree to this node.abstract booleanadd(Bindings bindings)abstract booleanadd(NameOpValue relations)static Stringcanonicalize(String str)Canonicalizes a string by removing any underscores and moving all characters to lowercase.AbstractRslNodeevaluate()Evalutes the rsl tree.abstract AbstractRslNodeevaluate(Map symbolTable)Evalutes the rsl tree against the specified symbol table.abstract BindingsgetBindings(String attribute)Returns the variable definitions associated wit the given attribute.intgetOperator()Returns the node operator.StringgetOperatorAsString()Returns the operator as a string.static StringgetOperatorAsString(int op)Returns a string represention of a given operator.abstract NameOpValuegetParam(String attribute)Returns the relation associated with the given attribute.ListgetSpecifications()Returns the list of sub-specifications.voidmerge(AbstractRslNode inNode)Merges the specified node with the current node.voidmergeTo(AbstractRslNode dstNode)abstract BindingsremoveBindings(String attribute)Removes a bindings list for the specified attribute.abstract NameOpValueremoveParam(String attribute)Removes a relation for the specified attribute.booleanremoveSpecification(AbstractRslNode node)Removes a specific sub-specification tree from the sub-specification list.voidsetOperator(int oper)Sets the operator.StringtoRSL(boolean explicitConcat)Returns a RSL representation of this relation.abstract voidtoRSL(StringBuffer buf, boolean explicitConcat)Produces a RSL representation of node.StringtoString()
-
-
-
Field Detail
-
AND
public static final int AND
- See Also:
- Constant Field Values
-
OR
public static final int OR
- See Also:
- Constant Field Values
-
MULTI
public static final int MULTI
- See Also:
- Constant Field Values
-
_operator
protected int _operator
-
_specifications
protected List _specifications
-
-
Method Detail
-
add
public abstract boolean add(Bindings bindings)
-
add
public abstract boolean add(NameOpValue relations)
-
add
public boolean add(AbstractRslNode node)
Adds a rsl parse tree to this node.- Parameters:
node- the rsl parse tree to add.
-
getParam
public abstract NameOpValue getParam(String attribute)
Returns the relation associated with the given attribute.- Parameters:
attribute- the attribute of the relation.- Returns:
- the relation for the attribute. Null, if not found.
-
getBindings
public abstract Bindings getBindings(String attribute)
Returns the variable definitions associated wit the given attribute.- Parameters:
attribute- the attribute of the variable deinitions.- Returns:
- the variable deinitions for the attribute. Null, if not found.
-
removeSpecification
public boolean removeSpecification(AbstractRslNode node)
Removes a specific sub-specification tree from the sub-specification list.- Parameters:
node- node to remove.- Returns:
- true if the tree was removed successfuly. False, otherwise.
-
removeBindings
public abstract Bindings removeBindings(String attribute)
Removes a bindings list for the specified attribute.- Parameters:
attribute- the attribute name for the bindings.- Returns:
- the bindings that were removed.
-
removeParam
public abstract NameOpValue removeParam(String attribute)
Removes a relation for the specified attribute.- Parameters:
attribute- the attribute name for the relation to remove.- Returns:
- the relation that was removed.
-
merge
public void merge(AbstractRslNode inNode)
Merges the specified node with the current node. All sub-specifications from the given node will be copied to the current node. All relations and variable definitions will be added together in the current node.- Parameters:
inNode- the source parse tree.
-
mergeTo
public void mergeTo(AbstractRslNode dstNode)
-
getSpecifications
public List getSpecifications()
Returns the list of sub-specifications.- Returns:
- the list of other sub-specifications.
-
getOperator
public int getOperator()
Returns the node operator.- Returns:
- the operator.
-
setOperator
public void setOperator(int oper)
Sets the operator.- Parameters:
oper- the operator.
-
getOperatorAsString
public String getOperatorAsString()
Returns the operator as a string.- Returns:
- operator in a string representation.
-
getOperatorAsString
public static String getOperatorAsString(int op)
Returns a string represention of a given operator.- Parameters:
op- the operator.- Returns:
- the string representation of the operator.
-
evaluate
public AbstractRslNode evaluate() throws RslEvaluationException
Evalutes the rsl tree. All the variable definitions are first evaluated because they might update the symbol table. Then all the relations followed by the sub-specifications are evaluated.- Returns:
- the evaluated rsl tree.
- Throws:
RslEvaluationException- If an error occured during rsl evaluation.
-
evaluate
public abstract AbstractRslNode evaluate(Map symbolTable) throws RslEvaluationException
Evalutes the rsl tree against the specified symbol table. All the variable definitions are first evaluated because they might update the symbol table. Then all the relations followed by the sub-specifications are evaluated.- Parameters:
symbolTable- the symbol table to evalute variables against.- Returns:
- the evaluated rsl tree.
- Throws:
RslEvaluationException- If an error occured during rsl evaluation.
-
toRSL
public String toRSL(boolean explicitConcat)
Returns a RSL representation of this relation.
Note: Enable explicitConcat to generate more 'valid' RSL- Parameters:
explicitConcat- if true explicit concatination will be used in RSL strings.- Returns:
- RSL representation of this relation.
-
toRSL
public abstract void toRSL(StringBuffer buf, boolean explicitConcat)
Produces a RSL representation of node.- Parameters:
buf- buffer to add the RSL representation to.explicitConcat- if true explicit concatination will be used in RSL strings.
-
-