Package com.martiansoftware.jsap

Examples of com.martiansoftware.jsap.JSAPException


                                paramID,
                                properties.getProperty(thisName));
                        } else {
                            exceptionMap.addException(
                                null,
                                new JSAPException(
                                    "Unknown parameter: " + thisName));
                        }
                    } else {
                        exceptionMap.addException(
                            null,
                            new JSAPException(
                                "Unknown parameter: " + thisName));
                    }
                }
            }
        } catch (IOException ioe) {
            exceptionMap.addException(
                null,
                new JSAPException("Unable to load properties.", ioe));
        }
        return (defaults);
    }
View Full Code Here


 
  private static BigDecimal[] parseRange(String rangeString, int bigDecimalScale, MathContext mc) throws JSAPException {
    if (rangeString.startsWith("[")) {
      // expect a real range
      if (!rangeString.endsWith("]")) { throw new JSAPException ("Range for selection has to be in format [start:step:stop]"); }
     
      // parse the range
      String[] fields = rangeString.substring(1, rangeString.length()-1).split(":");

      // get the array
      if (fields.length != 3) { throw new JSAPException ("Range for selection has to be in format [start:step:stop]"); }
      BigDecimal[] tmp = new BigDecimal[] { (new BigDecimal(fields[0])).setScale(bigDecimalScale), (new BigDecimal(fields[1])).setScale(bigDecimalScale), (new BigDecimal(fields[2])).setScale(bigDecimalScale) };
     
      // now check for the right stepping direction
      if (tmp[2].subtract(tmp[0], mc).multiply(tmp[1], mc).compareTo(BigDecimal.ZERO) < 0) { throw new JSAPException ("Range for selection has to be in format [start:step:stop]"); }
      // and change the order if necessary
      if (tmp[0].compareTo(tmp[2]) > 0) {
        BigDecimal swap = tmp[0];
        tmp[0] = tmp[2];
        tmp[1] = tmp[1].multiply(new BigDecimal("-1"), mc);
View Full Code Here

TOP

Related Classes of com.martiansoftware.jsap.JSAPException

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.