Package org.formulacompiler.runtime

Examples of org.formulacompiler.runtime.FormulaException


    final ArrayDescriptor desc = _range.arrayDescriptor();
    final int iRow = valueToIntOrOne( _rowIndex ) - 1;
    final int iCol = valueToIntOrOne( _colIndex ) - 1;
    int iValue;
    if (iRow < 0 || iRow >= desc.numberOfRows())
      throw new FormulaException( "#VALUE/REF! because row out of range in INDEX" );
    if (iCol < 0 || iCol >= desc.numberOfColumns())
      throw new FormulaException( "#VALUE/REF! because column out of range in INDEX" );
    if (null != _rowIndex && null != _colIndex) {
      iValue = iRow * desc.numberOfColumns() + iCol;
    }
    else {
      iValue = iRow + iCol;
View Full Code Here


  @SuppressWarnings( "unchecked" )
  public static int match( Object _lookup, Object _in, int _type )
  {
    if (null == _in) {
      throw new FormulaException( "#VALUE! because range is empty in MATCH" );
    }
    final ExpressionNodeForArrayReference range = (ExpressionNodeForArrayReference) _in;
    if (0 == _type) {
      int iObj = 0;
      for (Object arg : range.arguments()) {
View Full Code Here

  private static final BigDecimal MAX_EXP_VALUE = BigDecimal.valueOf( 1, 4 ); // 1E-4


  public static double checkDouble( final double _value )
  {
    if (Double.isNaN( _value )) throw new FormulaException( "#NUM! (value is NaN)" );
    if (Double.isInfinite( _value )) throw new FormulaException( "#NUM! (value is infinite)" );
    return _value;
  }
View Full Code Here

    final Matcher matcher = pattern.matcher( _within.toLowerCase() );
    if (matcher.find( _startingAt - 1 )) {
      return matcher.start() + 1;
    }
    else {
      throw new FormulaException( "#VALUE! because no result in FIND" );
    }
  }
View Full Code Here

        // return code of "?" symbol
        return 63;
      }
    }
    else {
      throw new FormulaException( "#VALUE! because no data in CODE" );
    }
  }
View Full Code Here

      CharBuffer cb = _environment.charset().decode( bb );
      if (cb.capacity() > 0) {
        return String.valueOf( cb.get() );
      }
      else {
        throw new FormulaException( "#VALUE! because wrong symbol code in CHAR" );
      }
    }
    throw new FormulaException( "#VALUE! because illegal argument (num <= 0 or num >= 256) in CHAR" );
  }
View Full Code Here

  static final long[] FACTORIALS = { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600 };


  public static void fun_ERROR( String _message )
  {
    throw new FormulaException( _message );
  }
View Full Code Here

      case 2:
        return dayOfWeek > 1 ? dayOfWeek - 1 : 7;
      case 3:
        return dayOfWeek > 1 ? dayOfWeek - 2 : 6;
      default:
        throw new FormulaException( "#NUM! because of illegal argument _type in WEEKDAY" );
    }
  }
View Full Code Here

    final double q = 1.0 - _probability;
    double factor = Math.pow( q, _trials );
    if (factor == 0.0) {
      factor = Math.pow( _probability, _trials );
      if (factor == 0.0) {
        throw new FormulaException( "#NUM! because both factors = 0 in binomialDensity" );
      }
      else {
        final int max = _trials - _successes;
        for (int i = 0; i < max && factor > 0.0; i++) {
          factor *= ((double) (_trials - i)) / ((double) (i + 1)) * q / _probability;
View Full Code Here

    double q = 1 - _p;
    double factor = Math.pow( q, n );
    if (factor == 0) {
      factor = Math.pow( _p, n );
      if (factor == 0) {
        throw new FormulaException( "#NUM! because factor = 0 in CRITBINOM" );
      }
      else {
        double sum = 1 - factor;
        int i;
        for (i = 0; i < n && sum >= _alpha; i++) {
View Full Code Here

TOP

Related Classes of org.formulacompiler.runtime.FormulaException

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.