From 4c52d3d9180324df4d331fa8ccdfe49761f37ecb Mon Sep 17 00:00:00 2001 From: SebastianEbert <sebastian.ebert@tu-dresden.de> Date: Fri, 7 Jul 2023 14:17:48 +0200 Subject: [PATCH] removed communicator specification (not needed anymore) --- .../st/pnml/base/constants/PnmlConstants.java | 6 - .../base/distribution/DistributedPN.jadd | 24 --- .../base/parsing/ToolSpecificsParser.jadd | 44 ----- src/main/resources/nets/SortingNet.pnml | 158 ++++++++++++++++++ 4 files changed, 158 insertions(+), 74 deletions(-) create mode 100644 src/main/resources/nets/SortingNet.pnml diff --git a/src/data/java/de/tudresden/inf/st/pnml/base/constants/PnmlConstants.java b/src/data/java/de/tudresden/inf/st/pnml/base/constants/PnmlConstants.java index f5efc3f..16b20ac 100644 --- a/src/data/java/de/tudresden/inf/st/pnml/base/constants/PnmlConstants.java +++ b/src/data/java/de/tudresden/inf/st/pnml/base/constants/PnmlConstants.java @@ -51,12 +51,6 @@ public final class PnmlConstants { public static final String INPUT_SIGNAL_INIT_VALUE_DEF = "initialvalue"; public static final String SIGNAL_VALUE_PAGE_ID = "signalValuePage"; - // structural keys - public static final String COMMUNICATORS = "communicators"; - public static final String COMMUNICATOR = "communicator"; - public static final String COMMUNICATOR_TYPE = "cType"; - public static final String COMMUNICATOR_SUBNET = "cSubnet"; - public static final String TOPIC_PUBLISHER = "topicPub"; public static final String TOPIC_SUBSCRIBER = "topicSub"; public static final String SERVICE_CLIENT = "serviceClient"; diff --git a/src/main/jastadd/base/distribution/DistributedPN.jadd b/src/main/jastadd/base/distribution/DistributedPN.jadd index 584b195..24fc3c1 100644 --- a/src/main/jastadd/base/distribution/DistributedPN.jadd +++ b/src/main/jastadd/base/distribution/DistributedPN.jadd @@ -47,10 +47,6 @@ aspect PnDistribution { return ToolSpecificsParser.getSubnetFromToolSpecifics(this.getToolspecificList()); } - syn lazy CommunicatorInformation PetriNet.getCommunicatorInformation(){ - return ToolSpecificsParser.getCommunicatorInformationFromToolSpecifics(this.getToolspecificList()); - } - syn lazy Map<String, String> PetriNet.getInputSignalDefinition(){ return ToolSpecificsParser.getInputSignalDefinitionsFromToolSpecifics(this.getToolspecificList()); } @@ -71,26 +67,6 @@ aspect PnDistribution { return ToolSpecificsParser.getServiceClientResponsePlaceId(this.getToolspecificList(), placeId); } - syn lazy CommunicatorInformation PetriNet.getCommunicatorInformation(Set<String> ignoredParts){ - - CommunicatorInformation cInfo = ToolSpecificsParser.getCommunicatorInformationFromToolSpecifics(this.getToolspecificList()); - - if(ignoredParts.size() > 0){ - CommunicatorInformation filteredInfo=new CommunicatorInformation(); - - for(Map.Entry<String, String> entry:cInfo.getCommunicatorMapping().entries()){ - for(String part:ignoredParts){ - if(!(entry.getValue().equals("serviceServer") && entry.getKey().equals(part))){ - // cInfo.getCommunicatorMapping().removeMapping(part, entry.getKey()); - filteredInfo.addMapping(entry.getKey(),entry.getValue()); - } - } - } - return filteredInfo; - } - return cInfo; - } - syn lazy String Arc.getType() { return ToolSpecificsParser.getArcTypeFromToolSpecifics(this.getToolspecificList()); } diff --git a/src/main/jastadd/base/parsing/ToolSpecificsParser.jadd b/src/main/jastadd/base/parsing/ToolSpecificsParser.jadd index 92f05aa..1a05ee5 100644 --- a/src/main/jastadd/base/parsing/ToolSpecificsParser.jadd +++ b/src/main/jastadd/base/parsing/ToolSpecificsParser.jadd @@ -186,49 +186,6 @@ aspect ToolSpecificsParser{ return inputSignalDefs; } - public static CommunicatorInformation getCommunicatorInformationFromToolSpecifics(JastAddList<ToolInfo> toolInfos) { - - CommunicatorInformation ci = new CommunicatorInformation(); - - if (toolInfos.getNumChild() > 0) { - try { - Document doc = parseToolSpecifics(toolInfos); - org.w3c.dom.NodeList communicatorList = doc.getElementsByTagName(PnmlConstants.COMMUNICATOR); - - for (int i = 0; i < communicatorList.getLength(); i++) { - - String ct = null; - String cs = null; - - for (int j = 0; j < communicatorList.item(i).getChildNodes().getLength(); j++) { - org.w3c.dom.Node n = communicatorList.item(i).getChildNodes().item(j); - - String newline = System.getProperty("line.separator"); - if (n.getTextContent().length() > 1 && !n.getTextContent().contains(newline)) { - - if (n.getNodeName().equals(PnmlConstants.COMMUNICATOR_TYPE)) { - ct = n.getTextContent(); - } - - if (n.getNodeName().equals(PnmlConstants.COMMUNICATOR_SUBNET)) { - cs = n.getTextContent(); - } - - if (ct != null && cs != null) { - ci.addMapping(cs, ct); - ct = null; - cs = null; - } - } - } - } - } catch (ParserConfigurationException | SAXException | IOException e) { - logger.error(e.getMessage()); - } - } - return ci; - } - private static String getElementByKeyFromToolSpecifics(JastAddList<ToolInfo> toolInfos, String key) { if (toolInfos.getNumChild() > 0) { @@ -543,7 +500,6 @@ aspect ToolSpecificsParser{ for (ToolInfo toolInfo : toolInfos) { if (toolInfo.getFormattedXMLBuffer().indexOf(PnmlConstants.SUBNET_KEY) > 0 || - toolInfo.getFormattedXMLBuffer().indexOf(PnmlConstants.COMMUNICATOR) > 0 || toolInfo.getFormattedXMLBuffer().indexOf(PnmlConstants.TYPE_KEY) > 0 || toolInfo.getFormattedXMLBuffer().indexOf(PnmlConstants.INPUT_SIGNALS_DEF) > 0 || toolInfo.getFormattedXMLBuffer().indexOf(PnmlConstants.ARC_TYPE_KEY) > 0) { diff --git a/src/main/resources/nets/SortingNet.pnml b/src/main/resources/nets/SortingNet.pnml new file mode 100644 index 0000000..e668fa7 --- /dev/null +++ b/src/main/resources/nets/SortingNet.pnml @@ -0,0 +1,158 @@ +<?xml version="1.0" encoding="UTF-8"?> +<pnml xmlns="http://www.pnml.org/version-2009/grammar/pnml"> + <net id="SortingNet" type="http://www.pnml.org/version-2009/grammar/ptnet"> + <name> + <text>SortingNet</text> + </name> + <page id="top"> + <page id="SelectorNodePage"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <type>nodePage</type> + </toolspecific> + <place id="RedObjectPool"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>SelectorNode</node> + <subnet>SelectorNodeRed</subnet> + </toolspecific> + <name> + <text>RedObjectPool</text> + </name> + </place> + <place id="BlueObjectPool"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>SelectorNode</node> + <subnet>SelectorNodeBlue</subnet> + </toolspecific> + <name> + <text>BlueObjectPool</text> + </name> + </place> + <place id="GreenObjectPool"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>SelectorNode</node> + <subnet>SelectorNodeGreen</subnet> + </toolspecific> + <name> + <text>GreenObjectPool</text> + </name> + </place> + <place id="RedPublisher"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>SelectorNode</node> + <subnet>SelectorNodeRed</subnet> + </toolspecific> + <name> + <text>RedPublisher</text> + </name> + </place> + <place id="BluePublisher"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>SelectorNode</node> + <subnet>SelectorNodeBlue</subnet> + </toolspecific> + <name> + <text>BluePublisher</text> + </name> + </place> + <place id="GreenPublisher"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>SelectorNode</node> + <subnet>SelectorNodeGreen</subnet> + </toolspecific> + <name> + <text>GreenPublisher</text> + </name> + </place> + + <transition id="SortRed"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>SelectorNode</node> + <subnet>SelectorNodeRed</subnet> + <type>discreteTransitionType</type> + <inputsignalclause>(SignalRed)</inputsignalclause> + </toolspecific> + <name> + <text>SortRed</text> + </name> + </transition> + <transition id="SortGreen"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>SelectorNode</node> + <subnet>SelectorNodeGreen</subnet> + <type>discreteTransitionType</type> + <inputsignalclause>(SignalGreen)</inputsignalclause> + </toolspecific> + <name> + <text>SortGreen</text> + </name> + </transition> + <transition id="SortBlue"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>SelectorNode</node> + <subnet>SelectorNodeBlue</subnet> + <type>discreteTransitionType</type> + <inputsignalclause>(SignalBlue)</inputsignalclause> + </toolspecific> + <name> + <text>SortBlue</text> + </name> + </transition> + + <arc id="sn1" source="RedObjectPool" target="SortRed"> + </arc> + <arc id="sn2" source="GreenObjectPool" target="SortGreen"> + </arc> + <arc id="sn3" source="BlueObjectPool" target="SortBlue"> + </arc> + <arc id="sn4" source="SortRed" target="RedPublisher"> + </arc> + <arc id="sn5" source="SortGreen" target="GreenPublisher"> + </arc> + <arc id="sn6" source="SortBlue" target="BluePublisher"> + </arc> + </page> + + <page id="ControllerLeftNodePage"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <type>nodePage</type> + </toolspecific> + + </page> + + <page id="ControllerRightNodePage"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <type>nodePage</type> + </toolspecific> + + </page> + + <page id="SynchronizerNodePage"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <type>nodePage</type> + </toolspecific> + + </page> + + <page id="ExecutorNodePage"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <type>nodePage</type> + </toolspecific> + + </page> + + <page id="SensorNodePage"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <type>nodePage</type> + </toolspecific> + + </page> + + <page id="FeedbackNodePage"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <type>nodePage</type> + </toolspecific> + + </page> + </page> + </net> +</pnml> -- GitLab