<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.yasc.example</groupId>
<artifactId>petrinet</artifactId>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.6.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>de.yasc.example.petrinet.Main</mainClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
if (enabledTransitions.isEmpty()) {
return false;
} else {
- transitions.get(prng.nextInt(enabledTransitions.size())).fire();
+ enabledTransitions.get(prng.nextInt(enabledTransitions.size())).fire();
return true;
}
}
public Integer[] getMarking() {
final var marking = new ArrayList<Integer>();
for (int p = 0 ; p < places.length ; p++) {
- Collections.nCopies(places[p].tokens, p).forEach(marking::add);
+ marking.addAll(Collections.nCopies(places[p].tokens, p));
}
return marking.toArray(new Integer[0]);
}