Example #1
0
  @Override
  protected void beforeRun() {
    super.beforeRun();

    for (WorkStation m : machines) m.init();

    for (JobSource s : sources) s.init();
  }
Example #2
0
  public void addJobSource(JobSource js) {
    ArrayList<JobSource> list = new ArrayList<JobSource>(Arrays.asList(sources));
    list.add(js);

    js.setShop(this);
    js.index = list.size() - 1;

    sources = list.toArray(new JobSource[list.size()]);
  }
Example #3
0
  /**
   * Sets all job sources in this shop.
   *
   * @param sources An array with all job sources.
   */
  public void setSources(JobSource[] sources) {
    this.sources = sources.clone();

    int i = 0;
    for (JobSource js : sources) {
      js.setShop(this);
      js.index = i++;
    }
  }
Example #4
0
 public void removeJobSource(JobSource js) {
   ArrayList<JobSource> list = new ArrayList<JobSource>(Arrays.asList(sources));
   if (list.remove(js)) {
     js.setShop(null);
     js.index = -1;
     int i = 0;
     for (JobSource s : list) {
       s.index = i++;
     }
     sources = list.toArray(new JobSource[list.size()]);
   }
 }