org.objectweb.medor.filter.jorm.lib
Class CompositePName

java.lang.Object
  |
  +--org.objectweb.medor.filter.jorm.lib.CompositePName
All Implemented Interfaces:
java.lang.Cloneable, Cloneable, Expression, Operator

public class CompositePName
extends java.lang.Object
implements Operator

A CompositePName is an Operator representing the construction of a PName from a NamingContext and several Fields.

The NamingContext is provided as a ParameterOperand. The name of the ParameterOperand is defined to be:

  1. The fully qualified class name for the PName of the class itself
  2. The fully qualified class name, to which the attribute name is concatenated for a reference PName
The Fields are provided as an array of FieldOperand. It relies on a TuplePNameGetter (@see org.objectweb.medor.query.jorm.lib.TuplePNameGetter) to construct the PName.

Author:
Alexandre Lefebvre

Field Summary
protected  java.lang.String[] cofns
           
protected  FieldOperand[] fields
           
protected  TuplePNameGetter myGetter
           
protected  Operand nc
           
protected  VariableOperand result
           
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
CompositePName(FieldOperand[] fs, java.lang.String[] compositefieldnames, Operand po, PType t)
          Constructs a SinglePName from a ParameterOperand representing the naming context, and an array of FieldOperand.
 
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.
 java.lang.String[] getCompositeFieldName()
          It retrieves an array of the composite field name.
 Expression getExpression(int idx)
           
 FieldOperand[] getFields()
           
 int getOperandNumber()
           
 java.lang.String getOperatorString()
          There is no Java operator associated to a PName
 ParameterOperand getPNameManagerParameter()
           
 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()
          CHecks 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

type

protected PType type

fields

protected FieldOperand[] fields

cofns

protected java.lang.String[] cofns

nc

protected Operand nc

result

protected VariableOperand result

verified

protected boolean verified

myGetter

protected TuplePNameGetter myGetter
Constructor Detail

CompositePName

public CompositePName(FieldOperand[] fs,
                      java.lang.String[] compositefieldnames,
                      Operand po,
                      PType t)
               throws MedorException
Constructs a SinglePName from a ParameterOperand representing the naming context, and an array of FieldOperand. The FieldOperands should be built on JormFields.

Parameters:
fs - is the array of FieldOperands from which the value is taken.
po - is the ParameterOperand representing the naming context.
t - is the PType of the PName created by this operator.
compositefieldnames - is the compositename fields. This array is linked to parameter fs (FieldOperand[]).
Throws:
MedorException - when the number of FieldOperand is not equal to the size of the proj parameter.
Method Detail

getCompositeFieldName

public java.lang.String[] getCompositeFieldName()
It retrieves an array of the composite field name. The order of this array matches to the order of the FieldOperand array returned by the method getField()


getPNameManagerParameter

public ParameterOperand getPNameManagerParameter()

getOperandNumber

public int getOperandNumber()
Specified by:
getOperandNumber in interface Operator

getExpression

public Expression getExpression(int idx)
                         throws java.lang.ArrayIndexOutOfBoundsException
Specified by:
getExpression in interface Operator
java.lang.ArrayIndexOutOfBoundsException

setExpression

public void setExpression(int idx,
                          Expression exp)
                   throws java.lang.ArrayIndexOutOfBoundsException
Specified by:
setExpression in interface Operator
java.lang.ArrayIndexOutOfBoundsException

getType

public PType getType()
Description copied from interface: Expression
It gets the result type of this expression

Specified by:
getType in interface Expression
Returns:
a PType object

isCompiled

public boolean isCompiled()
CHecks wether this expression is compiled or not

Specified by:
isCompiled in interface Expression
Returns:
true if the expression is compiled and false if it is not

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Cloneable
Overrides:
clone in class java.lang.Object
java.lang.CloneNotSupportedException

getResult

public Operand getResult()
                  throws java.lang.IllegalStateException
Gets the operand in wich the result will be put in

Specified by:
getResult in interface Expression
Returns:
an Operand Object
Throws:
java.lang.IllegalStateException - if this expression is not compiled.

evaluate

public void evaluate(ParameterOperand[] pos,
                     Tuple t)
              throws MedorException
Description copied from interface: Expression
It evaluates the expression tree and puts the result into the operand result.

Specified by:
evaluate in interface Expression
Parameters:
pos - a list of ParameterOperand
t - Tuple
Throws:
MedorException - if evaluation error

compileExpression

public void compileExpression()
                       throws TypingException,
                              MalformedExpressionException
Checks the semantic integrity of an expression. It checks that all types are compatible and prepare the expression to be evaluable. It also creates buffers where stores the result. Notes that when evaluating there is no creation of new objects. This method changes the state of this expression object, it will be evaluable and not modifiable.

Specified by:
compileExpression in interface Expression
Throws:
TypingException - when incompatible types error occurs.
MalformedExpressionException - if syntax error

getFields

public FieldOperand[] getFields()

getOperatorString

public java.lang.String getOperatorString()
There is no Java operator associated to a PName

Specified by:
getOperatorString in interface Operator
Returns:
the String representing the operator in Java