Exemplo n.º 1
0
  @Override
  public String toString() {
    StringBuilder result = new StringBuilder();
    result.append("Fireable transitions: ");

    lock.readLock().lock();
    try {
      for (Transition transition : this.getAllEnabledTransitions()) {
        result.append(transition.getFullLabel() + " ");
      }
      if (this.getAllEnabledTransitions().isEmpty()) {
        result.append("-NONE-");
      }
      result.append("\nPlaces: ");
      for (Place place : petriNet.getRootSubnet().getPlacesRecursively()) {
        result.append(place.getLabel() + ":" + getTokens(place) + " ");
      }
      if (petriNet.getRootSubnet().getPlacesRecursively().isEmpty()) {
        result.append("-NONE-");
      }
    } finally {
      lock.readLock().unlock();
    }

    return result.toString();
  }
Exemplo n.º 2
0
 private Set<Transition> getTransitions() {
   return petriNet.getRootSubnet().getTransitionsRecursively();
 }