|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.objectweb.medor.filter.lib.MemberOf
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
|
Fields inherited from interface org.objectweb.medor.filter.api.Operator |
ABS, AND, AVG, BITWIZE, CONCAT, CONDAND, CONDOR, COUNT, DIV, EQUAL, FIRSTLOCATE, GREATER, GREATEREQUAL, IN, INDEXEDLOCATE, LENGTH, LOWER, LOWEREQUAL, MAX, MEMBEROF, MIN, MINUS, MOD, MULT, NAV, NOT, NOTEQUAL, NOTMEMBEROF, OR, PLUS, SQRT, SUBSTRING, SUM, UMINUS |
Constructor Summary | |
MemberOf(java.util.List left,
java.util.List right)
Constructor for the operator. |
Method Summary | |
java.lang.Object |
clone()
|
void |
compileExpression()
Checks the semantic integrity of an expression. |
void |
evaluate(ParameterOperand[] pos,
Tuple t)
It evaluates the expression tree and puts the result into the operand result. |
Expression |
getExpression(int idx)
|
int |
getOperandNumber()
|
java.lang.String |
getOperatorString()
Returns the String representing the operator in Java |
Operand |
getResult()
Gets the operand in wich the result will be put in |
PType |
getType()
It gets the result type of this expression |
boolean |
isCompiled()
Gets wether this expression is compiled or not |
void |
setExpression(int idx,
Expression exp)
|
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected PType type
protected VariableOperand result
protected boolean verified
protected java.util.List left
protected java.util.List right
protected int size
Constructor Detail |
public MemberOf(java.util.List left, java.util.List right) throws MalformedExpressionException
left
- a list of FieldOperands to test.right
- the list of FieldOperands of which the left ones should be
members.
MalformedExpressionException
Method Detail |
public void evaluate(ParameterOperand[] pos, Tuple t) throws MedorException
Expression
evaluate
in interface Expression
pos
- a list of ParameterOperandt
- Tuple
MedorException
- if evaluation errorpublic PType getType()
Expression
getType
in interface Expression
public boolean isCompiled()
Expression
isCompiled
in interface Expression
public void compileExpression() throws TypingException, MalformedExpressionException
Expression
compileExpression
in interface Expression
MalformedExpressionException
- if syntax error
TypingException
- when incompatible types error
occures.public Operand getResult() throws java.lang.IllegalStateException
Expression
getResult
in interface Expression
java.lang.IllegalStateException
- if this expression is not
compiled.public java.lang.String getOperatorString()
Operator
getOperatorString
in interface Operator
public int getOperandNumber()
getOperandNumber
in interface Operator
public Expression getExpression(int idx) throws java.lang.ArrayIndexOutOfBoundsException
getExpression
in interface Operator
java.lang.ArrayIndexOutOfBoundsException
public void setExpression(int idx, Expression exp) throws java.lang.ArrayIndexOutOfBoundsException
setExpression
in interface Operator
java.lang.ArrayIndexOutOfBoundsException
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface Cloneable
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |