XGTRBAC
Class LogicalExpr

java.lang.Object
  extended by XGTRBAC.LogicalExpr

public class LogicalExpr
extends java.lang.Object

This class contains methods and members for evaluating logical expressions. It is instantiated in [XURAS/XPRAS]_DTDScanner class (setLogicalExpr/addPredicate method).


Nested Class Summary
 class LogicalExpr.Parameter
          An inner "Parameter" class *
 class LogicalExpr.SimplePredicate
          An inner "SimplePredicate" class *
 
Field Summary
private  java.lang.String opcode
           
private  java.util.LinkedList PredicateList
           
 
Constructor Summary
LogicalExpr()
          Creates a new instance of LogicalExpr
 
Method Summary
 java.lang.Object addPredicate(int type)
          Adds a new predicate to the PredicateList
 boolean evaluate(java.lang.Object subject, java.lang.String cred_type)
          Evaluates the logical expression given a credential type
 java.lang.String getOpcode()
          Returns the opcode
 java.lang.Object getPredicate(int index)
          Returns the predicate of the logical expression
 int getPredicateCount()
          Returns the number of predicates for this logical expression
 boolean getResult(boolean[] status)
          Returns the result for a logical expression evaluation
 void setOpcode(java.lang.String op)
          Sets the opcode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

opcode

private java.lang.String opcode

PredicateList

private java.util.LinkedList PredicateList
Constructor Detail

LogicalExpr

public LogicalExpr()
Creates a new instance of LogicalExpr

Method Detail

getOpcode

public java.lang.String getOpcode()
Returns the opcode

Returns:
The opcode as String

setOpcode

public void setOpcode(java.lang.String op)
Sets the opcode

Parameters:
op - The opcode supplied as String

getPredicateCount

public int getPredicateCount()
Returns the number of predicates for this logical expression

Returns:
The predicate count as int

getPredicate

public java.lang.Object getPredicate(int index)
Returns the predicate of the logical expression

Parameters:
index - The integer index of the credential condition in the AssignConditionList
Returns:
The predicate as Object

addPredicate

public java.lang.Object addPredicate(int type)
Adds a new predicate to the PredicateList

Parameters:
type - The type of the predicate (0:simple predicate, 1: logical expression)
Returns:
The reference to the added predicate as Object

evaluate

public boolean evaluate(java.lang.Object subject,
                        java.lang.String cred_type)
                 throws java.lang.Exception
Evaluates the logical expression given a credential type

Parameters:
subject - The subject of evaluation (User or Role) supplied as Object
cred_type - The credential type name supplied as String
Returns:
The evaluation status as boolean
Throws:
java.lang.Exception

getResult

public boolean getResult(boolean[] status)
Returns the result for a logical expression evaluation

Parameters:
status - The status array supplied as boolean[]
Returns:
The result as boolean