Exemplo n.º 1
0
 @Override
 public Buildable create(Object name, Object value) {
   if (name.equals("parameter")) {
     return params;
   } else if (name.equals("objfunc")) {
     ObjFunc of = new ObjFunc();
     ofs.add(of);
     return of;
   } else if (name.equals("samples")) {
     samples = (Integer) value;
     //            if (samples<2000) {
     //                throw new IllegalArgumentException("samples<2000");
     //            }
   } else if (name.equals("terms")) {
     terms = (Integer) value;
     if (terms != 4 && terms != 6) {
       throw new IllegalArgumentException("terms 4 or 6 !");
     }
   } else if (name.equals("sens_start")) {
     sens_start = Conversions.convert(value, Date.class);
   } else if (name.equals("sens_end")) {
     sens_end = Conversions.convert(value, Date.class);
   } else if (name.equals("StartMonthOfYear")) {
     startMonthOfYear = (Integer) value - 1;
     if ((startMonthOfYear < 0) || (startMonthOfYear > 11))
       throw new IllegalArgumentException("StartMonthOfYear must be between 1-12 for Jan-Dec.");
   } else {
     return super.create(name, value);
   }
   return LEAF;
 }
Exemplo n.º 2
0
 private Object toValue(String name, double[] vals, Map<String, Object> parameter) {
   Object orig = parameter.get(name);
   if (orig.toString().indexOf('{') > -1) {
     // this is an array (hopefully 1dim)
     return Conversions.convert(vals, String.class);
   } else {
     return Double.toString(vals[0]);
   }
 }