Package org.gdbms.engine.values

Examples of org.gdbms.engine.values.Value


   *
   * @throws SemanticException Si se produce un error sem�ntico
   * @throws DriverException Si se produce un error de I/O
   */
  public Value evaluate(long row) throws EvaluationException {
    Value ret = null;

    Adapter[] expr = (Adapter[]) getChilds();

    if (expr.length > 0) {
      ret = ((Expression) expr[0]).evaluateExpression(row);

      for (int i = 1; i < expr.length; i++) {
        try {
                    ret = ret.or(((Expression) expr[i]).evaluateExpression(row));
                } catch (IncompatibleTypesException e) {
                    throw new EvaluationException(e);
                }
      }
    }
View Full Code Here


          return value;
        } else if (hijosRight[0].getClass() == InClauseAdapter.class) {
            InClauseAdapter inAdapter = (InClauseAdapter) hijosRight[0];
           
            Value test = ((Expression) hijos[0]).evaluateExpression(row);

            boolean is = false;
            for (int i = 0; i < inAdapter.getListLength(); i++) {
                        Value inElement = inAdapter.getLValue(i, row);
                       
                        if (inElement instanceof NullValue){
                            if (test instanceof NullValue){
                                is = true;
                                break;
                            }
                        } else{
                            try {
                                if (((BooleanValue)test.equals(inElement)).getValue()){
                                    is = true;
                                    break;
                                }
                            } catch (IncompatibleTypesException e) {
                                throw new EvaluationException(e);
                            }
                        }
                    }
            if (inAdapter.isNegated()){
                is = !is;
            }
            return ValueFactory.createValue(is);
           
        } else if (hijosRight[0].getClass() == BetweenClauseAdapter.class) {
            BetweenClauseAdapter betweenAdapter = (BetweenClauseAdapter) hijosRight[0];
           
            Value test = ((Expression) hijos[0]).evaluateExpression(row);
                       
                    try {
                        Value ret = test.less(betweenAdapter.getSupValue(row)).and(test.greater(betweenAdapter.getInfValue(row)));
                        if (betweenAdapter.isNegated())
                            return ret.inversa();
                        else
                            return ret;
                       
                    } catch (IncompatibleTypesException e) {
                        throw new EvaluationException(e);
View Full Code Here

    public void filter() throws DriverException, EvaluationException {
        int[] idx = new int[(int) dataSource.getRowCount()];
        TreeSet<Value> h = new TreeSet<Value>(new Comparator<Value>() {
                    public int compare(Value o1, Value o2) {
                        try {
                            Value v1 = (Value) o1;
                            Value v2 = (Value) o2;

                            if (((BooleanValue) v1.equals(v2)).getValue()) {
                                return 0;
                            } else {
                                return 1;
View Full Code Here

     *         representada por el nodo sobre el cual �ste objeto es adaptador
     *
     * @throws EvaluationException Si se produce un error sem�ntico
     */
    public Value evaluate(long row) throws EvaluationException {
        Value ret = null;

        Adapter[] expr = (Adapter[]) getChilds();

        if (expr.length > 0) {
            ret = ((Expression) expr[0]).evaluateExpression(row);

            if (expr.length == 2) {
                try {
                    if (getOperator(this.getEntity()) == SUMA) {
                        ret = ret.suma(((Expression) expr[1]).evaluateExpression(
                                    row));
                    } else if (getOperator(this.getEntity()) == RESTA) {
                        ret = ret.suma(ValueFactory.createValue(-1).producto(((Expression) expr[1]).evaluateExpression(
                                        row)));
                    }
                } catch (IncompatibleTypesException e) {
                    throw new EvaluationException(e);
                }
View Full Code Here

            try {
                int i1 = ((Integer) o1).intValue();
                int i2 = ((Integer) o2).intValue();

                for (int i = 0; i < orders.length; i++) {
                    Value v1 = columnCache[i1][i];
                    Value v2 = columnCache[i2][i];
                    if (v1 instanceof NullValue) return -1 * orders[i];
                    if (v2 instanceof NullValue) return 1 * orders[i];
                    if (((BooleanValue)v1.less(v2)).getValue()){
                        return -1 * orders[i];
                    }else if (((BooleanValue)v2.less(v1)).getValue()){
                        return 1 * orders[i];
                    }
                }
                /*
                 * Because none of the orders criteria defined an order. The first
View Full Code Here

   *
   * @throws SemanticException Si se produce un error sem�ntico
   * @throws DriverException Si se produce un error de I/O
   */
  public Value evaluate(long row) throws EvaluationException {
    Value ret = null;

    Adapter[] terms = (Adapter[]) getChilds();

    if (terms.length > 0) {
      ret = ((Expression) terms[0]).evaluateExpression(row);

      for (int i = 1; i < terms.length; i++) {
        try {
                    ret = ret.suma(((Expression) terms[i]).evaluateExpression(row));
                } catch (IncompatibleTypesException e) {
                    throw new EvaluationException(e);
                }
      }
    }

    if (signChange) {
      Value menosUno = ValueFactory.createValue(-1);
      try {
                ret = ret.producto(menosUno);
            } catch (IncompatibleTypesException e) {
                throw new EvaluationException(e);
            }
View Full Code Here

   *        representada por el nodo sobre el cual �ste objeto es adaptador
   *
   * @throws EvaluationException Si se produce un error
   */
  public Value evaluate(long row) throws EvaluationException {
    Value ret = null;

    Adapter[] expr = (Adapter[]) getChilds();

    if (expr.length > 0) {
      ret = ((Expression) expr[0]).evaluateExpression(row);

      for (int i = 1; i < expr.length; i++) {
        try {
                    ret = ret.and(((Expression) expr[i]).evaluateExpression(row));
                } catch (IncompatibleTypesException e) {
                    throw new EvaluationException(e);
                }
      }
    }
View Full Code Here

        if (campos[fieldId].equals("null")) {
            return null;
        }

        if (fieldId == 0) {
            Value value = ValueFactory.createValue(Integer
                    .parseInt(campos[fieldId]));

            return value;
        } else if (fieldId == 3) {
            return ValueFactory.createValue(Date.valueOf(campos[fieldId]));
        } else if (fieldId == 4) {
            return ValueFactory.createValue(Time.valueOf(campos[fieldId]));
        } else if (fieldId == 5) {
            return ValueFactory.createValue(Timestamp.valueOf(campos[fieldId]));
        }

        Value value = ValueFactory.createValue(campos[fieldId]);

        return value;
    }
View Full Code Here

    /**
     * @see org.gdbms.engine.data.driver.ObjectDriver#getFieldValue(long,
     *      int)
     */
    public Value getFieldValue(long rowIndex, int fieldId) throws DriverException {
        Value ret = null;
        if (ftSupport == null) {
            ret = ds.getOriginalFieldValue(rowIndex, fieldId);
        } else {
            ret = ftSupport.getFieldValue(rowIndex, fieldId);
        }
View Full Code Here

   
    public void testAlphanumericModifyUndoRedo() throws Exception {
        AlphanumericDataSource d = (AlphanumericDataSource)
        ds.getDataSource("persona",
                DataSourceFactory.UNDOABLE);
        Value v2 = ValueFactory.createValue(10);
        Value v1 = ValueFactory.createValue(0);
       
        d.beginTrans();
        d.setFieldValue(0, 0, v2);
        d.undo();
        assertTrue(((BooleanValue) d.getFieldValue(0, 0).equals(v1)).getValue());
View Full Code Here

TOP

Related Classes of org.gdbms.engine.values.Value

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.