org.objectweb.medor.filter.lib

Class MemberOf

Implemented Interfaces:
Operator

public class MemberOf
extends BasicOperator
implements Operator

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.

Constructor Summary

MemberOf(List left, List right)
Constructor for the operator.

Method Summary

Operand
compileExpression()
Operand
evaluate(ParameterOperand[] pos, Object o)
String
getOperatorString()
Operand
getResult()

Constructor Details

MemberOf

public MemberOf(List left,
                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.

Method Details

compileExpression

public Operand compileExpression()
            throws TypingException,
                   MalformedExpressionException


evaluate

public Operand evaluate(ParameterOperand[] pos,
                        Object o)
            throws ExpressionException


getOperatorString

public String getOperatorString()


getResult

public Operand getResult()
            throws IllegalStateException