iiitAccessServer 1.0

de.iiit.access.server.plugins.parser
Class Parser

java.lang.Object
  |
  +--de.iiit.access.server.plugins.parser.Parser

public class Parser
extends Object

Provides a parser for operations on sets.

Every expression is evaluated from left to right. The operator '&' has a higher priority then '+' and '-'.

Examples:
 A1 = { a1, a2 }
 A2 = { a3, a4 }
 A3 = { a5, a6 }
 A12 = A1 + A2 = { a1, a2, a3, a4 }
 A13 = A1 + A3 = { a1, a2, a5, a6 }
 A23 = A2 + A3 = { a3, a4, a3, a4 }
 A  = A1 + A2 + A3 = { a1, a2, a3, a4, a5, a6 }
 N  = { }

 A1 + A2 = A2 + A1 = { a1, a2, a3, a4 }
 A1 + A1 = A1
 A  + A1 = A + A2 = A + A3 = A
 A1 - A1 = N
 A1 - A2 = A1
 A1 - A  = N
 A - A1 - A2 = A - (A1 + A2) = A3

 A  -  A1       = { a3, a4, a5, a6 }
 A  -  A1 + A2  = (A -  A1) + A2  = { a3, a4, a5, a6 }
 A  -  A2 + A1  = (A -  A2) + A1  = { a1, a2, a5, a6 }
 A  - (A1 + A2) =  A - (A2  + A1) = A3
 A  +  A1 - A2  = (A +  A1) - A2  = { a1, a2, a5, a6 }
 A  +  A2 - A1  = (A +  A2) - A1  = { a3, a4, a5, a6 }
 A  +  A1 - A1  = (A +  A1) - A1  = { a3, a4, a5, a6 }
 A  -  A1 + A1  = (A -  A1) + A1  = { a1, a2, a3, a4, a5, a6 }
 A1 -  A  = N
 A1 -  A2 = A1

  A1 &  A2 = N
  A  &  N  = N
  A  &  A1 & A2  = (A & A1) & A2 = N
  A  & (A1 & A2) =  N
 (A1 + A2) & (A2 + A3) = (A2 +  A1) & (A3  + A2) = A2
  A1 + A2  &  A2 + A3  =  A1 + (A2  &  A2) + A3  = A
  A2 + A1  &  A3 + A2  =  A2 + (A1  &  A3) + A2  = A2

 A  & A2 = A2 & A  = A2
 A1 & A2 = A2 & A1 = N
 

Version:
$Revision: 1.7 $ $Date: 2003/04/13 21:09:56 $

Constructor Summary
Parser()
          Creates a new instance of Parser.
Parser(ResolverPluginIf resolver)
          Creates a new instance of Parser.
 
Method Summary
 Set evaluate(ParserStackIf argStack)
          Evaluates the expression on top of argStack.
 Set evaluate(ParserStackIf argStack, String name)
          Evaluates the expression on top of argStack.
 Set evaluateExpression(String expression)
          Evaluates an expression
 Set evaluateExpression(String expression, String name)
          Evaluates an expression.
 boolean getReturnEmptySets()
          Retrieves whether the parser shall empty sets or null values when nothing was found.
 void setReturnEmptySets(boolean flag)
          Sets whether the parser shall empty sets or null values when nothing was found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser()
Creates a new instance of Parser. The AccessServer is asked for the ResolverPlugin to use for the evaluations.


Parser

public Parser(ResolverPluginIf resolver)
Creates a new instance of Parser.

Parameters:
resolver - The ResolverPlugin to use for the evaluations.
Method Detail

setReturnEmptySets

public void setReturnEmptySets(boolean flag)
Sets whether the parser shall empty sets or null values when nothing was found.

Parameters:
flag - true when empty sets shall be returned or false if null shall be returned

getReturnEmptySets

public boolean getReturnEmptySets()
Retrieves whether the parser shall empty sets or null values when nothing was found.

Returns:
true when empty sets shall be returned or false if null shall be returned

evaluate

public Set evaluate(ParserStackIf argStack,
                    String name)
             throws ParserException
Evaluates the expression on top of argStack. The evaluation is optimized in such way that it only retrieves information regarding the given user name.

Parameters:
argStack - This stack includes all expressions and subexpressions of the current tree inside the orginal expression.
name - The name of the user for whom the expression should be evaluated.
Returns:
An optimized set of users. It is guaranteed that it is correct for the given user but it is not guaranteed that it includes all users described by the expression.
Throws:
ParserException - if there is something wrong with the expression. The most common cases are syntax errors or circular references within the expression.

evaluate

public Set evaluate(ParserStackIf argStack)
             throws ParserException
Evaluates the expression on top of argStack.

Parameters:
argStack - This stack includes all expressions and subexpressions of the current tree inside the orginal expression.
Returns:
The set of users described by the expression.
Throws:
ParserException - if there is something wrong with the expression. The most common cases are syntax errors or circular references within the expression.

evaluateExpression

public Set evaluateExpression(String expression,
                              String name)
                       throws ParserException
Evaluates an expression. The evaluation is optimized in such way that it only retrieves information regarding the given user name.

Parameters:
expression - The expression to evaluate
name - The name of the user for whom the expression should be evaluated.
Returns:
An optimized set of users. It is guaranteed that it is correct for the given user but it is not guaranteed that it includes all users described by the expression.
Throws:
ParserException - if there is something wrong with the expression. The most common cases are syntax errors or circular references within the expression.

evaluateExpression

public Set evaluateExpression(String expression)
                       throws ParserException
Evaluates an expression

Parameters:
expression - The expression to evaluate
Returns:
The set of users described by the expression.
Throws:
ParserException - if there is something wrong with the expression. The most common cases are syntax errors or circular references within the expression.

iiitAccessServer 1.0

Copyright © 2002, 2003 ingeneurbuero fuer innovative informationstechnik, Dipl.-Ing. Joerg Beckmann, Dortmund, Germany. All Rights Reserved.
See Copyright statement