Package org.zkoss.zss.engine.xel

Examples of org.zkoss.zss.engine.xel.SSErrorXelException


   * @param ch char value to be validated.
   * @return Char object that wrap the given ch char value; or SSError.VALUE is ch is not defined in Unicode.
   */
  public static Object validateChar(char ch) {
    if(!Character.isDefined(ch)) {
      throw new SSErrorXelException(SSError.VALUE);
    } else {
      return new Character(ch);
    }
  }
View Full Code Here


    ComplexFormat cf = new ComplexFormat(s);
    complex = replaceiToi1(complex, s);
    try {
      result = cf.parse(complex, s);
    } catch (ParseException e) {
      throw new SSErrorXelException(SSError.NAME);
    }
    return result;
  }
View Full Code Here

  }
 
  public static double[][] doubleToArray(double[] d) {
    int num = (int)Math.sqrt(d.length);
    if(num != Math.sqrt(d.length)) {
      throw new SSErrorXelException(SSError.VALUE);
    } else {
      double[][] array = new double[num][num];
      for(int i = 0; i < num; i++) {
        for(int j = 0; j < num; j++) {
            array[i][j] = d[i*num + j];
View Full Code Here

    }
  }
 
  public static String padZero(String num, int places) {
    if(places <= 0 || places < num.length()) {
      throw new SSErrorXelException(SSError.NUM);
    } else {
      StringBuffer result = new StringBuffer();
      for(int i = 0; i < places - num.length(); i++) {
        result.append("0");
      }
View Full Code Here

    return result;
  }
 
  public static int dsm(Date settle, Date maturi, int basis) {
    if(settle.compareTo(maturi) > 0) {
      throw new SSErrorXelException(SSError.NUM);
    } else {
      int dsm = 0;
      if(basis == 0 || basis == 4) {
        SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd");
        Calendar calendar = df.getCalendar();
View Full Code Here

          final Cell cell = cella[0][rj][cj];
          double num = 0d;
          if (cell != null) {
            final Object val = cell.getResult();
            if (val instanceof SSError) {
              throw new SSErrorXelException((SSError)val);
            } else if (val instanceof Number) {
              num = ((Number)val).doubleValue();
            }
          }
          vala[rj][cj] = num;
        }
      }
      return vala;
    } else if (arg instanceof Object[][]){ //constant array, returned by utilArray
      final Object[][] obja = (Object[][]) arg;
      final int rowsz = obja.length;
      final int colsz = obja[0].length;
      final double[][] vala = new double[rowsz][];
      for (int rj = 0; rj < colsz; ++rj) {
        vala[rj] = new double[colsz];
        for (int cj = 0; cj < colsz; ++cj) {
          final Object val = obja[rj][cj];
          double num = 0d;
          if (val != null) {
            if (val instanceof SSError) {
              throw new SSErrorXelException((SSError)val);
            } else if (val instanceof Number) {
              num = ((Number)val).doubleValue();
            }
          }
          vala[rj][cj] = num;
        }
      }
      return vala;
    }
    throw new SSErrorXelException(SSError.VALUE);
  }
View Full Code Here

      return new int[] {((Range)arg).getRowSize(), ((Range)arg).getColumnSize()}
    } else if (arg instanceof Object[][]){  //constant array, returned by utilArray
      final Object[][] obja = (Object[][]) arg;
      return new int[] {obja.length, obja[0].length};
    }
    throw new SSErrorXelException(SSError.VALUE);
  }
View Full Code Here

    final Object[][] val = new Object[args.length][];
    val[0] = r1;
    for (int j = 1; j < args.length; ++j) {
      final Object[] row = (Object[]) args[j];
      if (rowsz != row.length) { //row size is not consistent (not balance)
        throw new SSErrorXelException(SSError.VALUE);
      }
      val[j] = row;
    }
    return val;
  }
View Full Code Here

        throws XelException {
      // TODO Auto-generated method stub
      if ((prefix == null || prefix.length() == 0) && "ABCD".equals(name))
        return new MyFunc();
      else
        throw new SSErrorXelException(SSError.NAME);
    }
View Full Code Here

   * @return the average of the absolute deviations of data points from thier mean
   */
  public static Object statAvedev(Object[] args, XelContext ctx){
    final List ls = UtilFns.toList(args, ctx);
    if (ls.isEmpty()) {
      throw new SSErrorXelException(SSError.NUM);
    }
    final double[] a = UtilFns.toDoubleArray(ls);
    double m = UtilFns.getStats(a).getMean();
    double total = 0;
    for(int i =0; i < a.length; i++){
View Full Code Here

TOP

Related Classes of org.zkoss.zss.engine.xel.SSErrorXelException

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.