org.objectweb.medor.filter.lib
Class MemberOf

java.lang.Object
  extended byBasicOperator
      extended byorg.objectweb.medor.filter.lib.MemberOf

public class MemberOf
extends BasicOperator

The MemberOf class is an operator testing whether the value of a list of Fields (the first n operands, which are supposed to be FieldOperands or ParameterOperands) are equal to one of the values of another list of Fields (the second n operands, which are supposed to be FieldOperands).

As an example, consider the left list (fopA, fopB) and the right list (fopC, fopD). Consider that fopA and fopB are FieldOperands for fields A and B of QueryTree qt1 and that fopC and fopD are FieldOperands for fields C and D of QueryTree qt2.

Consider the following data:

qt1qt2
abcd
a1b1a1b1
a2b2a3b3
a3b3a3b3
a4b4

(a1,b1) and (a3,b3), values of (a,b), are members of the list of values for (c,d), and appear in the result only once. Even (a3,b3) which appears twice in (c,d) is only once in the result. This would not have been the case with a join.

Note that, in the case of PNames, we only allow comparison of two PNames, that is, the number of operands is supposed to be two and not more.

See Also:
Serialized Form

Constructor Summary
MemberOf(java.util.List left, java.util.List right)
          Constructor for the operator.
 
Method Summary
 Operand compileExpression()
           
 Operand evaluate(ParameterOperand[] pos, java.lang.Object o)
           
 java.lang.String getOperatorString()
           
 Operand getResult()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemberOf

public MemberOf(java.util.List left,
                java.util.List right)
         throws MalformedExpressionException
Constructor for the operator. The operand array of this operators are the union both list parameter ( left + right)

Parameters:
left - a list of FieldOperands to test.
right - the list of FieldOperands of which the left ones should be members.
Throws:
org.objectweb.medor.expression.api.MalformedExpressionException
MalformedExpressionException
Method Detail

evaluate

public Operand evaluate(ParameterOperand[] pos,
                        java.lang.Object o)
                 throws ExpressionException
Throws:
ExpressionException

compileExpression

public Operand compileExpression()
                          throws TypingException,
                                 MalformedExpressionException
Throws:
TypingException
MalformedExpressionException

getResult

public Operand getResult()
                  throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

getOperatorString

public java.lang.String getOperatorString()