Package desmoj.extensions.crossbar

Source Code of desmoj.extensions.crossbar.BusZyklus

package desmoj.extensions.crossbar;

import desmoj.core.simulator.SimProcess;
import desmoj.core.simulator.TimeSpan;
import desmoj.extensions.crossbar.CrossbarMessage.DistributionMode;

public class BusZyklus extends SimProcess {

  private final MessageChannel<Student> line;
  private final int initialDelay;
  private final int interval;

  public BusZyklus(MessageCrossbarExample owner, boolean showInTrace, MessageChannel<Student> line, int initialDelay,
      int interval) {
    super(owner, "Producer ", showInTrace);
    this.line = line;
    this.initialDelay = initialDelay;
    this.interval = interval;
  }

  @Override
  public void lifeCycle() {
    hold(new TimeSpan(initialDelay));

    while (true) {
      line.send(new CrossbarMessage(getModel(), "Bus der " + line.getName(),
          DistributionMode.DISTRIBUTE_BY_REFERENCE));

      hold(new TimeSpan(interval));
    }

  }

}
TOP

Related Classes of desmoj.extensions.crossbar.BusZyklus

TOP
Copyright © 2018 www.massapi.com. 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.