Package plan_runner.conversion

Examples of plan_runner.conversion.NumericConversion


      // as the output
      final SumCount sc = (SumCount) _ve.eval(tuple);
      sumDelta = sc.getSum();
      countDelta = sc.getCount();
    } else {
      final NumericConversion nc = (NumericConversion) veType;
      sumDelta = nc.toDouble(_ve.eval(tuple));
      countDelta = 1L;
    }

    final Double sumNew = sumDelta + value.getSum();
    final Long countNew = countDelta + value.getCount();
View Full Code Here


  @Override
  public T eval(List<String> tuple) {
    double result = 0;
    for (final ValueExpression factor : _veList) {
      final Object currentVal = factor.eval(tuple);
      final NumericConversion currentType = (NumericConversion) (factor.getType());
      result += currentType.toDouble(currentVal);
    }
    return _wrapper.fromDouble(result);
  }
View Full Code Here

  @Override
  public T eval(List<String> tuple) {
    final ValueExpression firstVE = _veList.get(0);
    final Object firstObj = firstVE.eval(tuple);
    final NumericConversion firstType = (NumericConversion) firstVE.getType();
    double result = firstType.toDouble(firstObj);

    for (int i = 1; i < _veList.size(); i++) {
      final ValueExpression currentVE = _veList.get(i);
      final Object currentObj = currentVE.eval(tuple);
      final NumericConversion currentType = (NumericConversion) currentVE.getType();
      result -= currentType.toDouble(currentObj);
    }
    return _wrapper.fromDouble(result);

  }
View Full Code Here

  @Override
  public Double eval(List<String> tuple) {
    final ValueExpression firstVE = _veList.get(0);
    final Object firstObj = firstVE.eval(tuple);
    final NumericConversion firstType = (NumericConversion) firstVE.getType();
    double result = firstType.toDouble(firstObj);

    for (int i = 1; i < _veList.size(); i++) {
      final ValueExpression currentVE = _veList.get(i);
      final Object currentObj = currentVE.eval(tuple);
      final NumericConversion currentType = (NumericConversion) currentVE.getType();
      result /= currentType.toDouble(currentObj);
    }
    return _wrapper.fromDouble(result);
  }
View Full Code Here

  }

  @Override
  public void inverseNumber() {
    if (_wrapper instanceof NumericConversion) {
      final NumericConversion makis = (NumericConversion) _wrapper;
      // double temp = makis.toDouble((Number) _constant);
      final double val = ((Number) _constant).doubleValue();
      final double temp = makis.toDouble(new Double(val));
      _constant = (T) makis.fromDouble(1.0 / temp);
    }
  }
View Full Code Here

  }

  @Override
  public boolean isNegative() {
    if (_wrapper instanceof NumericConversion) {
      final NumericConversion makis = (NumericConversion) _wrapper;
      final double temp = makis.toDouble(_constant);
      return (temp < 0);
    }
    return false;
  }
View Full Code Here

  @Override
  public T eval(List<String> tuple) {
    double result = 1;
    for (final ValueExpression factor : _veList) {
      final Object currentVal = factor.eval(tuple);
      final NumericConversion currentType = (NumericConversion) factor.getType();
      result *= currentType.toDouble(currentVal);
    }
    return _wrapper.fromDouble(result);
  }
View Full Code Here

TOP

Related Classes of plan_runner.conversion.NumericConversion

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.