コード例 #1
0
 /**
  * Standard constructor that reads the configuration parameters. Invoked by the simulation engine.
  *
  * @param prefix the configuration prefix for this class
  */
 public DynamicNetwork(String prefix) {
   add = Configuration.getDouble(prefix + "." + PAR_ADD);
   substitute = Configuration.contains(prefix + "." + PAR_SUBST);
   Object[] tmp = Configuration.getInstanceArray(prefix + "." + PAR_INIT);
   inits = new NodeInitializer[tmp.length];
   for (int i = 0; i < tmp.length; ++i) {
     // System.out.println("Inits " + tmp[i]);
     inits[i] = (NodeInitializer) tmp[i];
   }
   maxsize = Configuration.getInt(prefix + "." + PAR_MAX, Integer.MAX_VALUE);
   minsize = Configuration.getInt(prefix + "." + PAR_MIN, 0);
 }
コード例 #2
0
  /** Initialization based on configuration parameters. */
  public OrangeSched(String n) {

    String[] prots = Configuration.getString(n + "." + PAR_PROTOCOL).split("\\s");
    pid = new int[prots.length];
    nce = new NextCycleEvent[prots.length];
    for (int i = 0; i < prots.length; ++i) {
      pid[i] = Configuration.lookupPid(prots[i]);
      if (!(Network.prototype.getProtocol(pid[i]) instanceof CDProtocol)) {
        throw new IllegalParameterException(
            n + "." + PAR_PROTOCOL, "Only CDProtocols are accepted here");
      }

      nce[i] =
          (NextCycleEvent) Configuration.getInstance(n + "." + PAR_NEXTC, new NextCycleEvent(null));
    }

    randstart = Configuration.contains(n + "." + PAR_RNDSTART);
  }