public PopulateVirtualWorld(String prefix) {
    distribution = Configuration.getInt(prefix + "." + PAR_DISTRIB);
    applicativeLayerId = Configuration.getPid(prefix + "." + APPLICATIVE_LAYER);
    Globals.mapSize = Configuration.getLong(prefix + "." + MAP_SIZE);
    Globals.zoneSize = Configuration.getLong(prefix + "." + ZONE_SIZE);
    Globals.zoneNb = Configuration.getInt(prefix + "." + ZONE_NB);
    Globals.outOfZoneNb = Configuration.getInt(prefix + "." + OUT_OF_ZONE_NB);
    Globals.wSpeed = Configuration.getInt(prefix + "." + WSPEED);
    Globals.tSpeed = Configuration.getInt(prefix + "." + TSPEED);
    Globals.smallZoneSize = Configuration.getInt(prefix + "." + SMALL_ZONE_SIZE);
    Globals.smallZoneNb = Configuration.getInt(prefix + "." + SMALL_ZONE_NB);

    Globals.haltedToHalted = Configuration.getInt(prefix + "." + HTH);
    Globals.haltedToTravelling = Configuration.getInt(prefix + "." + HTT);
    Globals.haltedToWandering = Configuration.getInt(prefix + "." + HTW);

    Globals.travellingToTravelling = Configuration.getInt(prefix + "." + TTT);
    Globals.travellingToHalted = Configuration.getInt(prefix + "." + TTH);
    Globals.travellingToWandering = Configuration.getInt(prefix + "." + TTW);

    Globals.wanderingToWandering = Configuration.getInt(prefix + "." + WTW);
    Globals.wanderingToTravelling = Configuration.getInt(prefix + "." + WTT);
    Globals.wanderingToHalted = Configuration.getInt(prefix + "." + WTH);
    Globals.changeWanderingDirection = Configuration.getInt(prefix + "." + CWD);

    Globals.quiet = Configuration.getBoolean(prefix + "." + QUIET);
  }
Example #2
0
 public TrafficGene(String prefix) {
   pid = Configuration.getPid(prefix + "." + PAR_PROT);
   numReqPerClient = Configuration.getInt(prefix + "." + PAR_NUMREQPERCLIENT);
   startupFilePath = Configuration.getString(prefix + "." + PAR_STARTUPFILEPATH);
   reqArrivalInterval = Configuration.getLong(prefix + "." + PAR_REQARRIVALINTERVAL);
   localTransTime = Configuration.getLong(prefix + "." + PAR_LOCALTRANSTIME);
   Library.policy = Configuration.getString(prefix + "." + PAR_POLICY);
 }
Example #3
0
 public HelloWorld(String prefix) {
   this.prefix = prefix;
   // initialisation des identifiants a partir du fichier de configuration
   this.transportPid = Configuration.getPid(prefix + ".transport");
   this.mypid = Configuration.getPid(prefix + ".myself");
   this.ping_timeout = Configuration.getLong(prefix + ".ping_timeout");
   this.ping_frequency = Configuration.getLong(prefix + ".ping_frequency");
   this.transport = null;
   this.state = 0;
   this.last_pong = new long[Network.size()];
   this.nodes_alive = new boolean[Network.size()];
   for (int i = 0; i < Network.size(); i++) {
     nodes_alive[i] = true;
   }
 }
Example #4
0
  /**
   * Loads configuration. It verifies the constraints defined in {@link WireByMethod}.
   *
   * @param prefix the configuration prefix for this class
   */
  public WireByMethod(String prefix) {
    super(prefix);

    // get the method
    try {
      final Class wire =
          Configuration.getClass(
              prefix + "." + PAR_CLASS, Class.forName("peersim.graph.GraphFactory"));
      method =
          WireByMethod.getMethod(wire, Configuration.getString(prefix + "." + PAR_METHOD, "wire"));
    } catch (Exception e) {
      throw new RuntimeException(e);
    }

    // set the constant args (those other than 0th)
    Class[] argt = method.getParameterTypes();
    args = new Object[argt.length];
    for (int i = 1; i < args.length; ++i) {

      if (argt[i] == int.class) args[i] = Configuration.getInt(prefix + "." + PAR_ARG + i);
      else if (argt[i] == long.class) args[i] = Configuration.getLong(prefix + "." + PAR_ARG + i);
      else if (argt[i] == double.class)
        args[i] = Configuration.getDouble(prefix + "." + PAR_ARG + i);
      else if (i == args.length - 1 && argt[i].isInstance(CommonState.r)) args[i] = CommonState.r;
      else {
        // we should neve get here
        throw new RuntimeException(
            "Unexpected error, please " + "report this problem to the peersim team");
      }
    }
  }