コード例 #1
0
  private HNSubSet getAllOutputElementsOfDuplicates(HNSubSet duplicates) {
    // Returns the union set of the output tasks of the tasks in
    // "duplicates".
    // The returned union set has already the codes mapped to the ATEs in
    // the log!
    HNSubSet union = new HNSubSet();
    HNSubSet allElements;

    for (int i = 0; i < duplicates.size(); i++) {
      allElements = hNet.getAllElementsOutputSet(duplicates.get(i));
      for (int j = 0; j < allElements.size(); j++) {
        union.add(hNet.getDuplicatesMapping()[allElements.get(j)]);
      }
    }

    return union;
  }
コード例 #2
0
  private int identifyDuplicateToFire(HNSubSet duplicates, int elementInATE) {

    HNSubSet candidateDuplicates = new HNSubSet();
    HNSubSet allElements;

    for (int i = 0; i < duplicates.size(); i++) {
      allElements = hNet.getAllElementsOutputSet(duplicates.get(i));
      for (int j = 0; j < allElements.size(); j++) {
        if (elementInATE == hNet.getDuplicatesMapping()[allElements.get(j)]) {
          candidateDuplicates.add(duplicates.get(i));
          break;
        }
      }
    }

    if (candidateDuplicates.size() <= 0) {
      candidateDuplicates = duplicates; // we can choose any of the tasks
      // because none has
      // followers in the process instance...
    }

    return candidateDuplicates.get(generator.nextInt(candidateDuplicates.size()));
  }