Package org.objectweb.medor.expression.api

Examples of org.objectweb.medor.expression.api.Operator


        || e instanceof Lower
        || e instanceof LowerEqual;
    if (res == false) {
      return false;
    }
    Operator op = (Operator) e;

    if (!(op.getExpression(0) instanceof Operand
        && op.getExpression(1) instanceof Operand)) {
      return false;
    }
    Operand o0 = (Operand) op.getExpression(0);
    Operand o1 = (Operand) op.getExpression(1);
    if (o0.getType().getTypeCode() == PTypeSpace.STRING.getTypeCode()) {
      return true;
    } else if (o1.getType().getTypeCode() == PTypeSpace.STRING.getTypeCode()) {
      //reverse the order: column name at left
      op.setExpression(0, o1);
      op.setExpression(1, o0);
      return true;
    } else {
      return false;
    }
  }
View Full Code Here


            Field f = ((FieldOperand) e).getField();
            if (!result.contains(f)) {
                result.add(f);
            }
        } else if (e instanceof Operator) {
            Operator operator = (Operator) e;
            for (int i = 0; i < operator.getOperandNumber(); i++) {
                getFieldsFromExpression(operator.getExpression(i), result);
            }
        }
    }
View Full Code Here

            Field neo = (Field) old2newElement.get(old);
            if (neo != null && old != neo) {
                ((FieldOperand) e).setField(neo);
            }
        } else if (e instanceof Operator) {
            Operator operator = (Operator) e;
            for (int i = 0; i < operator.getOperandNumber(); i++) {
                replaceFieldsInExpression(operator.getExpression(i),
                        old2newElement);
            }
        }
    }
View Full Code Here

     * @param exprFilter
     */
    private ME replaceNullNode(Expression exprFilterthrows SpeedoException {
        ME me = null;
      if ((exprFilter instanceof Equal) ||  (exprFilter instanceof NotEqual)){
        Operator op = (Operator) exprFilter;
        for (int i = 0; i < op.getOperandNumber(); i++) {
          if (op.getExpression(i) instanceof DummyOperand) {
            //get the other child operand
            int j = (i+1) % 2;
            Expression other = op.getExpression(j);
            PType ptype = other.getType();
            if (ptype.getTypeCode() == PType.TYPECODE_REFERENCE) {
              PName val = null;
              try {
                val = jf.getPClassMapping(ptype.getJormName(), clazz.getClassLoader()).getPBinder().getNull();
              } catch (Exception e) {
                throw new SpeedoException(
                    "Try to replace null node. Impossible to find the null PName for the type " + ptype.getJormName(), e);
              }
              //replace the null node with null PName
              op.setExpression(i, new BasicOperand(val, ptype));
            } else {
                //Transform the null [not]equality into a IsNull operator
                me = new ME(new IsNull(other, exprFilter instanceof NotEqual));
                //recursion is done on the other operand
                exprFilter = me.e;
            }   
          }
        }
      }
      if (exprFilter instanceof Operator) {
        Operator op = (Operator) exprFilter;
        for (int i = 0; i < op.getOperandNumber(); i++) {
          //recursivity
          ME ime = replaceNullNode(op.getExpression(i));
          if (ime != null && ime.modified) {
              //replace the child
              op.setExpression(i, ime.e);
              //mark the result as modified
              if (me == null) {//create if not already done
                  me = new ME(exprFilter);
              }
              me.modified = true;
View Full Code Here

TOP

Related Classes of org.objectweb.medor.expression.api.Operator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.