issrg.pba.rbac.xmlpolicy.ifstatement
Class TermNode
java.lang.Object
issrg.pba.rbac.xmlpolicy.PolicyXMLNode
issrg.pba.rbac.xmlpolicy.ifstatement.TermNode
- All Implemented Interfaces:
- Term
- Direct Known Subclasses:
- ConstantNode, NamedTermNode, OperationNode
public abstract class TermNode
- extends PolicyXMLNode
- implements Term
This abstract class represents XML elements that are Terms of IF-expressions.
It maintains a registry of Interpreters for each type of operation, which is
used indirectly by OperationNode and other subclasses.
- Author:
- A.Otenko
Constructor Summary |
protected |
TermNode()
|
|
TermNode(java.lang.String name,
org.xml.sax.Attributes attr,
int maxOperandCount,
int minOperandCount)
This constructor builds a TermNode object that will check that the child
nodes are
Terms and that there are not more than maxOperandCount of them and not
less than minOperandCount. |
Method Summary |
void |
construct()
This method ensures the children are Terms and that there are not more
than maxOperandCount
and not less than minOperandCount of them, as specified in the
constructor. |
protected static Interpreter[] |
getInterpretersForNode(java.lang.String nodeName)
This method retrieves an array of interpreters for a particular kind of
operation. |
protected static void |
registerInterpreterForNode(java.lang.String nodeName,
Interpreter i)
This method registers an interpreter for a given type of operation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
maxOperand
protected int maxOperand
minOperand
protected int minOperand
terms
protected Term[] terms
TermNode
protected TermNode()
TermNode
public TermNode(java.lang.String name,
org.xml.sax.Attributes attr,
int maxOperandCount,
int minOperandCount)
- This constructor builds a TermNode object that will check that the child
nodes are
Terms and that there are not more than maxOperandCount of them and not
less than minOperandCount.
The negative values of these two parameters mean no restriction on the
amount of children.
- Parameters:
name
- is the name of the XML element for this operatorattr
- is the set of attributes it has gotmaxOperandCount
- is the maximum amount of children allowed; -1 means
"don't care"minOperandCouns
- is the minimum amount of children allowed; -1 means
"don't care"
registerInterpreterForNode
protected static void registerInterpreterForNode(java.lang.String nodeName,
Interpreter i)
- This method registers an interpreter for a given type of operation.
- Parameters:
nodeName
- - the name of the XML element that represents the
operationi
- - the Interpreter for that operation
getInterpretersForNode
protected static Interpreter[] getInterpretersForNode(java.lang.String nodeName)
- This method retrieves an array of interpreters for a particular kind of
operation.
- Parameters:
nodeName
- - the name of the XML element that represents the
operation
- Returns:
- an array of Interpreters for this kind of operation; can be null
or empty if no Interpreters were registered for that kind of operation
construct
public void construct()
throws PolicyParsingException
- This method ensures the children are Terms and that there are not more
than maxOperandCount
and not less than minOperandCount of them, as specified in the
constructor. It also creates
an array of Terms that can be used by the sub-classes in their
evaluations.
- Overrides:
construct
in class PolicyXMLNode
- Throws:
PolicyParsingException
- if one of the above-stated conditions is
violated