Package org.zkoss.zss.engine.xel

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


   * @param ys y-coordinates
   * @return a commons math Regression class
   */
  public static SimpleRegression getRegre(double[] xs, double[] ys){
    if(xs.length != ys.length){
      throw new SSErrorXelException(SSError.NA);
    }else{
      SimpleRegression sr = new SimpleRegression();
      for(int i =0; i < xs.length; i++){
        sr.addData(xs[i], ys[i]);
      }
View Full Code Here


  public static double[] toDoubleArray(Object[] objs){
    double[] da = new double[objs.length];
    //System.out.println(a.length);
    for(int i =0; i < objs.length; i++){
      if (objs[i] instanceof SSError) {
        throw new SSErrorXelException((SSError) objs[i]);
      }else{
        da[i] = ((Number)Classes.coerce(double.class, objs[i])).doubleValue();
      }
    }
    return da;
View Full Code Here

   */
  public static int[] toIntArray(Object[] objs){
    int[] in = new int[objs.length];
    for(int i =0; i < objs.length; i++){
      if (objs[i] instanceof SSError) {
        throw new SSErrorXelException((SSError) objs[i]);
      }else{
        in[i] = ((Number)Classes.coerce(int.class, objs[i])).intValue();
      }
    }
    return in;
View Full Code Here

          endj = j;
          break;
        }
      }
      if (startj < 0 || endj < 0) { //reach sheetTo first, reverse sequence.
        throw new SSErrorXelException(SSError.REF);
      }
      final int sheetsz = endj - startj + 1;
      cella = new Cell[sheetsz][][];
     
    } else { //2d range
View Full Code Here

   */
  public static Complex[] toComplexArray(Object[] objs) {
    Complex[] complex = new Complex[objs.length];
    for(int i = 0; i < objs.length; i++) {
      if (objs[i] instanceof SSError) {
        throw new SSErrorXelException((SSError) objs[i]);
      }else{
        complex[i] = UtilFns.validateComplex(objs[i].toString());
        if(!complex[i].getSuffix().equals("k")) {
          for(int j = 0; j < i; j++) {
            if(!complex[j].getSuffix().equals("k") && !complex[i].getSuffix().equals(complex[j].getSuffix())) {
              throw new SSErrorXelException(SSError.NUM);
            }                     
          }
        }
      }
    }
View Full Code Here

   */
  public static Date[] toDateArray(Object[] objs) {
    Date[] dates = new Date[objs.length];
    for(int i = 0; i< objs.length; i++) {
      if (objs[i] instanceof SSError) {
        throw new SSErrorXelException((SSError) objs[i]);
      }else{
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
        try {
          dates[i] = sdf.parse(objs[i].toString());
        } catch (ParseException e) {
          throw new SSErrorXelException(SSError.VALUE);
        }
      }
    }
    return dates;
  }
View Full Code Here

   * @param arg recursive range
   * @return List
   */
  public static List toListHelper(List result, Object arg, boolean skipBoolean, boolean skipText, XelContext ctx){
    if (arg instanceof SSError) {
      throw new SSErrorXelException((SSError) arg);
    } else if (arg instanceof Range) { // a range, iterator thru available cells
      final Range rng = (Range) arg;
      final Book book = rng.getSheet().getBook();
      final Collection cells = rng.getCells();
      for(final Iterator it = cells.iterator(); it.hasNext();) {
View Full Code Here

      return new Double(Double.parseDouble(str));
    } catch (NumberFormatException ex) {
      if (nullable) {
        return null;
      } else {
        throw new SSErrorXelException(SSError.VALUE);
      }
    }
  }
View Full Code Here

    SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd");
    Date result = null;
    try {
      result = df.parse(date);
    } catch (ParseException e) {
      throw new SSErrorXelException(SSError.VALUE);
    }
    return result;
  }
View Full Code Here

   * @param v double value to be validated.
   * @return Double object that wrap the given v double value; or SSError.NUM is v is NaN.
   */
  public static Object validateNumber(double v) {
    if (Double.isInfinite(v) || Double.isNaN(v)) {
      throw new SSErrorXelException(SSError.NUM);
    } else {
      return new Double(v);
    }
  }
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.