Ejemplo n.º 1
0
  public Params(Params other) {

    // copy values from other
    debug = other.debug;
    verbose = other.verbose;
    ignoreVParams = other.ignoreVParams;
    stopLevel = other.stopLevel;
    Species = other.Species;
    WoodType = other.WoodType;
    Seed = other.Seed;
    Smooth = other.Smooth;

    // create paramDB
    paramDB = new Hashtable();
    levelParams = new LevelParams[4];
    for (int l = 0; l < 4; l++) {
      levelParams[l] = new LevelParams(l, paramDB);
    }
    registerParams();

    // copy param values
    for (Enumeration e = paramDB.elements(); e.hasMoreElements(); ) {
      AbstractParam p = ((AbstractParam) e.nextElement());
      try {
        AbstractParam otherParam = other.getParam(p.name);
        if (!otherParam.empty()) {
          p.setValue(otherParam.getValue());
        } // else use default value
      } catch (ParamError err) {
        System.err.println("Error copying params: " + err.getMessage());
      }
    }
  }
Ejemplo n.º 2
0
 public TreeMap getParamGroup(int level, String group) {
   TreeMap result = new TreeMap();
   for (Enumeration e = paramDB.elements(); e.hasMoreElements(); ) {
     AbstractParam p = (AbstractParam) e.nextElement();
     if (p.getLevel() == level && p.getGroup().equals(group)) {
       result.put(new Integer(p.getOrder()), p);
     }
   }
   return result;
 }
Ejemplo n.º 3
0
  public void setParam(String name, String value) throws ParamError {
    AbstractParam p = (AbstractParam) paramDB.get(name);
    if (p != null) {
      p.setValue(value);
      if (debug) {
        System.err.println("Params.setParam(): set " + name + " to " + value);
      }

    } else {
      throw new ParamError("Unknown parameter " + name + "!");
    }
  }