org.objectweb.medor.filter.lib
Class MemberOf
java.lang.Object
org.objectweb.medor.filter.lib.MemberOf
- public class MemberOf
- extends java.lang.Object
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:
qt1 | qt2 |
a | b | c | d |
a1 | b1 | a1 | b1 |
a2 | b2 | a3 | b3 |
a3 | b3 | a3 | b3 |
| | a4 | b4 |
(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.
Field Summary |
protected java.util.List |
left
|
protected VariableOperand |
result
|
protected java.util.List |
right
|
protected int |
size
|
protected PType |
type
|
protected boolean |
verified
|
Constructor Summary |
MemberOf(java.util.List left,
java.util.List right)
Constructor for the operator. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
type
protected PType type
result
protected VariableOperand result
verified
protected boolean verified
left
protected java.util.List left
right
protected java.util.List right
size
protected int size
MemberOf
public MemberOf(java.util.List left,
java.util.List right)
throws MalformedExpressionException
- Constructor for the operator.
- 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
evaluate
public org.objectweb.medor.expression.api.Operand evaluate(ParameterOperand[] pos,
java.lang.Object o)
throws ExpressionException
- Throws:
ExpressionException
getType
public PType getType()
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()
getOperandNumber
public int getOperandNumber()
getExpression
public Expression getExpression(int idx)
throws java.lang.ArrayIndexOutOfBoundsException
- Throws:
java.lang.ArrayIndexOutOfBoundsException
setExpression
public void setExpression(int idx,
Expression exp)
throws java.lang.ArrayIndexOutOfBoundsException
- Throws:
java.lang.ArrayIndexOutOfBoundsException
clone
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
- Throws:
java.lang.CloneNotSupportedException