private static void printNuNetDescription(List<String> command) { String varname = "default"; if (command.size() > 1) varname = command.get(1); NuNet net = nunets.get(varname); if (net == null) { System.out.println("No nu*-net loaded under name '" + varname + "'"); return; } // System.out.println("Nu*-net '"+varname+"':"); System.out.println(net.getPlaces().size() + " places: " + net.getPlaces()); System.out.println(net.getTransitions().size() + " transitions: " + net.getTransitions()); System.out.println(net.getFlowRelationships().size() + " arcs: " + net.getFlowRelationships()); System.out.print(net.getInitialMarking().getNumTokens() + " tokens and "); System.out.println( net.getInitialMarking().getNames().size() + " names in the initial marking: " + net.getInitialMarking().getNames()); System.out.println("Initial marking: " + net.getInitialMarking().toString()); }
private static void doSimulate(NuNet net) { Interpreter interpreter = new Interpreter(); Marking marking = net.getInitialMarking(); while (true) { List<EnabledTransition> modes = interpreter.getEnabledTransitions(net, marking); if (modes.size() == 0) { System.out.println("Simulation done."); return; } printEnabledTransitions(modes, marking); int i = getNextTransition(); if (i == -1) return; if (i >= 0 && i < modes.size()) interpreter.fireTransition(net, marking, modes.get(i)); } }