issrg.pba.rbac.xmlpolicy.ifstatement
Class TermNode

java.lang.Object
  extended by issrg.pba.rbac.xmlpolicy.PolicyXMLNode
      extended by 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

Field Summary
protected  int maxOperand
           
protected  int minOperand
           
protected  Term[] terms
           
 
Fields inherited from class issrg.pba.rbac.xmlpolicy.PolicyXMLNode
attributes, children, name, nodeStr
 
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 issrg.pba.rbac.xmlpolicy.PolicyXMLNode
addChild, addString, getAttributes, getChildren, getName, getString, toString, toXML, toXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface issrg.pba.rbac.xmlpolicy.ifstatement.Term
evaluate, getType
 

Field Detail

maxOperand

protected int maxOperand

minOperand

protected int minOperand

terms

protected Term[] terms
Constructor Detail

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 operator
attr - is the set of attributes it has got
maxOperandCount - 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"
Method Detail

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 operation
i - - 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