Skip to content
Snippets Groups Projects
Commit d28ecede authored by Sebastian Ebert's avatar Sebastian Ebert
Browse files

initial project setup for pnml-splitter

parent da23ed50
No related branches found
No related tags found
No related merge requests found
Showing
with 826 additions and 0 deletions
.gradle/
src/gen
.idea/
build/
out/
logs/
// General configuration (plugins, settings, dependencies)
group 'de.tudresden.inf.st'
version '0.1'
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'jastadd'
apply plugin: 'application'
apply plugin: "idea"
apply plugin: 'java-library'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories.mavenCentral()
buildscript {
repositories.mavenCentral()
dependencies {
classpath group: 'org.jastadd', name: 'jastaddgradle', version: '1.13.3'
}
}
idea.module.generatedSourceDirs += file('src/gen/java')
sourceSets.main.java.srcDir "src/gen/java"
jar.manifest.attributes('Main-Class': 'de.tudresden.inf.st.pnml.Main')
dependencies {
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "${jackson_version}"
implementation group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
implementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.13.2'
implementation group: 'org.fusesource.mqtt-client', name: 'mqtt-client', version: '1.15'
// pnml lib
implementation group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore', version: '2.12.0'
implementation group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore.xmi', version: '2.12.0'
implementation group: 'org.eclipse.emf', name: 'org.eclipse.emf.common', version: '2.12.0'
implementation group: 'org.eclipse.emf', name: 'org.eclipse.emf.mwe.core', version: '1.3.13'
api group: 'fr.lip6.pnml', name: 'fr.lip6.pnml.framework.ptnet', version: '2.2.12'
api group: 'fr.lip6.pnml', name: 'fr.lip6.pnml.framework.utils', version: '2.2.12'
implementation group: 'org.apache.ws.commons.axiom', name: 'axiom-api', version: '1.2.22'
implementation group: 'org.apache.ws.commons.axiom', name: 'axiom-impl', version: '1.2.22'
implementation group: 'com.thaiopensource', name: 'jing', version: '20091111'
implementation 'org.jetbrains:annotations:19.0.0'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
jastadd2 "org.jastadd:jastadd:2.3.4"
}
// Default run configuration
run {
mainClassName = 'de.tudresden.inf.st.pnml.Main'
standardInput = System.in
}
// Generated files
def ecoreFile = "./src/main/resources/placeTransition.ecore"
def relastAspect = "./src/gen/jastadd/pnml/placeTransition.ecore.jadd"
def relastFile = "./src/gen/jastadd/pnml/placeTransition.relast"
// First phase: Ecore -> RelAst
task ecoreToRelast(type: JavaExec) {
group = 'Build'
main = "-jar"
doFirst {
delete "src/gen/jastadd"
mkdir "src/gen/jastadd/pnml"
}
args "libs/ecore2relast-0.1.jar", ecoreFile, relastFile
inputs.files file(ecoreFile)
outputs.files file(relastFile), file(relastAspect)
}
// Second phase: RelAst -> JastAdd
task relastToJastAdd(type: JavaExec) {
group = 'Build'
main = "-jar"
args "libs/relast.jar",
"--grammarName=./src/gen/jastadd/placeTransition",
"--useJastAddNames",
"--listClass=ArrayList",
"--jastAddList=JastAddList",
"--resolverHelper",
"--file",
relastFile,
"./src/main/jastadd/marking/Marking.relast",
"./src/main/jastadd/io/IoPN.relast"
}
// Third phase: JastAdd -> Java (using JastAdd Gradle plugin)
jastadd {
configureModuleBuild()
modules {
module("pnml") {
java {
basedir "src/"
include "main/**/*.java"
include "gen/**/*.java"
}
jastadd {
basedir "src/"
include "main/jastadd/**/*.ast"
include "main/jastadd/**/*.jadd"
include "main/jastadd/**/*.jrag"
include "gen/jastadd/**/*.ast"
include "gen/jastadd/**/*.jadd"
include "gen/jastadd/**/*.jrag"
}
scanner {
include "src/main/jastadd/PnmlScanner.flex"
}
parser {
include "src/main/jastadd/PnmlParser.parser"
}
}
}
cleanGen.doFirst {
delete "src/gen/java/de"
delete "src/gen-res/BuildInfo.properties"
}
module = "pnml"
astPackage = 'de.tudresden.inf.st.pnml.jastadd.model'
genDir = 'src/gen/java'
buildInfoDir = 'src/gen-res'
scanner.genDir = "src/gen/java/de/tudresden/inf/st/pnml/jastadd/scanner"
parser.genDir = "src/gen/java/de/tudresden/inf/st/pnml/jastadd/parser"
// default options are: '--rewrite=cnta', '--safeLazy', '--visitCheck=false', '--cacheCycle=false'
extraJastAddOptions = ['--List=JastAddList'] // '--incremental=param'
}
// Workflow configuration for phases
relastToJastAdd.dependsOn ecoreToRelast
generateAst.dependsOn relastToJastAdd
//// always run jastadd
//jastadd.outputs.upToDateWhen {false}
jackson_version = 2.9.8
apache_httpcomponents_version = 4.5.8
File added
#Fri Mar 27 11:59:50 CET 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
gradlew 0 → 100755
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
File added
File added
File added
File added
rootProject.name = 'pnml-splitter'
#Mon, 22 Mar 2021 15:24:06 +0100
moduleId=pnml
moduleName=null
moduleVariant=null
timestamp=2021-03-22T15\:24Z
build.date=2021-03-22
aspect Constraints {
coll Set<ConstraintViolation> PetriNet.constraintViolations() [new java.util.HashSet()] root PetriNet;
}
aspect ConstraintViolations {
abstract class ConstraintViolation {
public String toString() {
return "Constraint " + getTitle() + " violated in object " + id() + ": " + getMessage();
}
protected ASTNode location;
public String id() {
if (location instanceof PnObject) return ((PnObject) location).getId();
if (location instanceof PetriNet) return ((PetriNet) location).getId();
return location.toString();
}
protected String title;
protected String description;
protected String message;
public String getTitle() { return title; }
public String getDescription() { return description; }
public String getMessage() { return message; }
}
class CheckIdsConstraint extends ConstraintViolation {
public CheckIdsConstraint(ASTNode location) {
this.location = location;
this.title = "CheckIds";
this.description = "Checks id attribute existence";
this.message = "A node of type '" + location.getClass().getSimpleName() + "' must have an id attribute.";
}
}
class CheckIdUniquenessConstraint extends ConstraintViolation {
public CheckIdUniquenessConstraint(ASTNode location) {
this.location = location;
this.title = "CheckIdUniquess";
this.description = "Checks id attribute uniqueness";
this.message = "The id attribute value " + id() + " of the node of type '" + location.getClass().getSimpleName() + "' is not unique.";
}
}
PetriNet contributes new CheckIdsConstraint(this)
when checkIdsConstraintViolated()
to PetriNet.constraintViolations();
PnObject contributes new CheckIdsConstraint(this)
when checkIdsConstraintViolated()
to PetriNet.constraintViolations();
}
aspect CoreModelConstraints {
syn boolean PetriNet.checkIdsConstraintViolated() = getId() == null || getId().equals("");
syn boolean PnObject.checkIdsConstraintViolated() = getId() == null || getId().equals("");
coll List<String> PetriNet.ids() [new ArrayList()] root PetriNet;
PnObject contributes getId() to PetriNet.ids();
syn Map<String, Long> PetriNet.idCount() =
ids().stream().collect(Collectors.groupingBy(java.util.function.Function.identity(), Collectors.counting()));
syn boolean PetriNet.uniqueId(String id) = idCount().get(id) <= 1;
syn boolean PnObject.uniqueId(String id) = petriNet().idCount().get(id) <= 1;
syn Optional<CheckIdUniquenessConstraint> PetriNet.checkIdUniqueness() {
if(uniqueId(getId())) return Optional.empty();
else return Optional.of(new CheckIdUniquenessConstraint(this));
}
syn Optional<CheckIdUniquenessConstraint> PnObject.checkIdUniqueness() {
if(petriNet().uniqueId(getId())) return Optional.empty();
else return Optional.of(new CheckIdUniquenessConstraint(this));
}
PetriNet contributes checkIdUniqueness().get()
when checkIdUniqueness().isPresent()
to PetriNet.constraintViolations();
PnObject contributes checkIdUniqueness().get()
when checkIdUniqueness().isPresent()
to PetriNet.constraintViolations();
}
aspect Graphviz {
syn String PetriNet.toDot() {
StringBuffer b = new StringBuffer();
b.append("digraph \"").append(name()).append("\" {\n")
.append(" rankdir=LR;\n")
.append(" center=true; margin=1;\n")
.append("\n")
.append(" subgraph places {\n")
.append(" node [shape=circle,fixedsize=true,label=\"\", height=.3,width=.3];\n");
for (Place place : allPlaces()) {
b.append(" ").append(place.dotId()).append(" [");
if (place.hasName()) b.append("xlabel=\"").append(place.name()).append("\", ");
b.append("label=\"").append("0").append("\"];\n");
}
b.append(" }\n\n");
b.append(" subgraph transitions {\n")
.append(" node [shape=rect,height=0.4,width=.4];\n");
for (Transition transition : allTransitions()) {
b.append(" ").append(transition.dotId()).append(" [");
if (transition.hasName()) b.append("label=\"").append(transition.name()).append("\"");
b.append("]\n");
}
b.append(" }\n\n");
for (Arc arc : allArcs()) {
b.append(" ").append(arc.getSource().dotId()).append("->").append(arc.getTarget().dotId()).append(";\n");
}
b.append("}\n");
return b.toString();
}
syn String PetriNet.dotId() = "\"" + getId().replaceAll("\"", "\\\"") + "\"";
syn String PnObject.dotId() = "\"" + getId().replaceAll("\"", "\\\"") + "\"";
}
aspect Navigation {
inh PetriNet PnObject.petriNet();
eq PetriNet.getChild().petriNet() = this;
java.util.Collection<Place> Transition.incomingPlaces() {
java.util.Set<Place> incomingPlaces = new java.util.HashSet<>();
for (Arc incomingArc : getInArcList()) {
incomingPlaces.add(incomingArc.getSource().asPlaceNode().place());
}
return incomingPlaces;
}
java.util.Collection<Place> Transition.outgoingPlaces() {
java.util.Set<Place> outgoingPlaces = new java.util.HashSet<>();
for (Arc outgoingArc : getOutArcList()) {
outgoingPlaces.add(outgoingArc.getTarget().asPlaceNode().place());
}
return outgoingPlaces;
}
syn boolean Node.isPlaceNode() = false;
eq PlaceNode.isPlaceNode() = true;
syn PlaceNode Node.asPlaceNode() = null;
eq PlaceNode.asPlaceNode() = this;
syn boolean Node.isTransitionNode() = false;
eq TransitionNode.isTransitionNode() = true;
syn TransitionNode Node.asTransitionNode() = null;
eq TransitionNode.asTransitionNode() = this;
syn InputSignalTransition Transition.asInputSignalTransition() = null;
eq InputSignalTransition.asInputSignalTransition() = this;
syn OutputSignalPlace Place.asOutputSignalPlace() = null;
eq OutputSignalPlace.asOutputSignalPlace() = this;
syn Place PlaceNode.place();
eq Place.place() = this;
eq RefPlace.place() = getRef().place();
syn Transition TransitionNode.transition();
eq Transition.transition() = this;
eq RefTransition.transition() = getRef().transition();
coll java.util.Set<PnObject> PetriNet.allObjects() [new java.util.HashSet()] root PetriNet;
PnObject contributes this
to PetriNet.allObjects()
for petriNet();
coll java.util.Set<Place> PetriNet.allPlaces() [new java.util.HashSet()] root PetriNet;
Place contributes this
to PetriNet.allPlaces()
for petriNet();
coll java.util.Set<Transition> PetriNet.allTransitions() [new java.util.HashSet()] root PetriNet;
Transition contributes this
to PetriNet.allTransitions()
for petriNet();
coll java.util.Set<Arc> PetriNet.allArcs() [new java.util.HashSet()] root PetriNet;
Arc contributes this
to PetriNet.allArcs()
for petriNet();
}
aspect References {
syn PnObject PetriNet.resolve(String id) {
for (PnObject object : allObjects()) {
if (object.getId().equals(id)) {
return object;
}
}
throw new RuntimeException(new de.tudresden.inf.st.pnml.PnmlParseException("Unable to resolve id " + id));
}
eq PnObject.globallyResolveArcByToken(String id) = (Arc) petriNet().resolve(id);
eq PnObject.globallyResolveNodeByToken(String id) = (Node) petriNet().resolve(id);
eq PnObject.globallyResolvePlaceNodeByToken(String id) = (PlaceNode) petriNet().resolve(id);
eq PnObject.globallyResolveTransitionNodeByToken(String id) = (TransitionNode) petriNet().resolve(id);
eq PnObject.globallyResolveRefPlaceByToken(String id) = (RefPlace) petriNet().resolve(id);
eq PnObject.globallyResolveRefTransitionByToken(String id) = (RefTransition) petriNet().resolve(id);
}
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.*;
import java.util.stream.Collectors;
aspect Logging {
static Logger ASTNode.logger = LogManager.getLogger(ASTNode.class);
}
aspect JastAddAPIExtension {
/**
* removes the object from the AST, i.e. removes the reference from its parent to the object
*
* Please note that any intrinsic non-containment relations to the object are not removed.
* @return true, if the object had a parent.
*/
public boolean ASTNode.removeSelf() {
if (getParent() == null) {
return false;
} else {
for (int childIndex = 0; childIndex < getParent().numChildren(); childIndex++) {
if (getParent().getChild(childIndex) == this) {
getParent().removeChild(childIndex);
return true;
}
}
}
throw new RuntimeException("unable to remove child, because it was not contained in its parent!");
}
}
aspect PnDistribution {
syn lazy String Transition.location() {
return de.tudresden.inf.st.pnml.ToolSpecificsParser.getLocationFromToolSpecifics(this.getToolspecificList());
}
syn lazy String Transition.type() {
return de.tudresden.inf.st.pnml.ToolSpecificsParser.getTransitionTypeFromToolSpecifics(this.getToolspecificList());
}
syn lazy String Place.location() {
return de.tudresden.inf.st.pnml.ToolSpecificsParser.getLocationFromToolSpecifics(this.getToolspecificList());
}
syn lazy String Place.type() {
return de.tudresden.inf.st.pnml.ToolSpecificsParser.getPlaceTypeFromToolSpecifics(this.getToolspecificList());
}
syn lazy Boolean Transition.isLimitedChannelTransition() {
return de.tudresden.inf.st.pnml.ToolSpecificsParser.isLimitedChannelTransitionType(this.getToolspecificList());
}
syn lazy int Transition.channelLimit() {
return de.tudresden.inf.st.pnml.ToolSpecificsParser.getLimitedChannelTransitionValue(this.getToolspecificList());
}
syn lazy String Transition.getTopic(){
return de.tudresden.inf.st.pnml.ToolSpecificsParser.getTopic(this.getToolspecificList());
}
}
\ No newline at end of file
aspect IoPnExtension{
inh Marking OutputSignalPlace.marking();
eq PetriNetDoc.getChild().marking() = null;
eq Marking.getPetriNet().marking() = this;
inh Place OutputSignalBinding.containingPlace();
eq OutputSignalPlace.getOutputSignalBinding().containingPlace() = this;
eq Page.getObject().containingPlace() = null;
syn lazy JastAddList<InputSignalBinding> InputSignalTransition.getInputSignalBindingList() {
JastAddList<InputSignalBinding> isBindings = de.tudresden.inf.st.postprocessing.IoPetriNetPostProcessor.parseInputSignalBindingDefinitions(this.getToolspecificList());
return isBindings;
}
syn lazy JastAddList<OutputSignalBinding> OutputSignalPlace.getOutputSignalBindingList() {
JastAddList<OutputSignalBinding> osBindings = de.tudresden.inf.st.postprocessing.IoPetriNetPostProcessor.parseOutputSignalBindingDefinitions(this.getToolspecificList());
return osBindings;
}
// updates automatically based on dependencies to the corresponding place
syn String OutputSignalBinding.getOutputSignalValue(){
OutputSignalPlace osp = this.containingPlace().asOutputSignalPlace();
Marking marking = osp.marking();
MarkedPlace markedPlace = marking.resolvePlaceById(this.getPlaceID());
JastAddList<EqualityOutputMapping> eomList = this.getEqualityOMListNoTransform();
JastAddList<ThresholdOutputMapping> tomList = this.getThresholdOMListNoTransform();
JastAddList<RangeOutputMapping> romList = this.getRangeOMListNoTransform();
// eom
int result = -1;
for(EqualityOutputMapping eom : eomList){
if((eom.getValue() == markedPlace.getMarking()) && result == -1){
result = eom.getResult();
break;
}
}
// tom
if(result > -1){
for(ThresholdOutputMapping tom : tomList){
if(tom.getValue() <= markedPlace.getMarking()){
result = tom.getResult();
break;
}
}
}
// rom
if(result > -1){
for(RangeOutputMapping rom: romList){
if((rom.getLowerBound() <= markedPlace.getMarking()) && (rom.getUpperBound() >= markedPlace.getMarking())){
result = rom.getResult();
break;
}
}
}
// 0 (disabled Signal) is default
if(result == -1){
result = 0;
}
String output = String.valueOf(result) + "-" + this.getOutputSignalID();
return output;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment