Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-08-21 07:37:18 -0400
committerCamille Letavernier2014-08-21 07:37:18 -0400
commitea48a20561464c3cbb7895d430583669a9f82fcc (patch)
tree0fdf9eebacbbb301b13bafce3ca4a6952ff6e91c /extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common
parentf91b71175fd97557cf378cdcad845a44a6274b16 (diff)
downloadorg.eclipse.papyrus-ea48a20561464c3cbb7895d430583669a9f82fcc.tar.gz
org.eclipse.papyrus-ea48a20561464c3cbb7895d430583669a9f82fcc.tar.xz
org.eclipse.papyrus-ea48a20561464c3cbb7895d430583669a9f82fcc.zip
[Code style] Apply clean-up and formatter on Extra plug-ins
Diffstat (limited to 'extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common')
-rw-r--r--extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/Activator.java10
-rw-r--r--extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/ArchitectureQueries.java289
-rw-r--r--extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/DataTypeQueries.java106
-rw-r--r--extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/DeploymentQueries.java247
-rw-r--r--extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/FSMQueries.java63
-rw-r--r--extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/GeneralQueries.java315
-rw-r--r--extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/MMQueries.java94
7 files changed, 589 insertions, 535 deletions
diff --git a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/Activator.java b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/Activator.java
index 432d9c1c4ea..70c138dd5f3 100644
--- a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/Activator.java
+++ b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/Activator.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
@@ -36,9 +36,10 @@ public class Activator extends Plugin {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
@@ -46,9 +47,10 @@ public class Activator extends Plugin {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
@@ -56,7 +58,7 @@ public class Activator extends Plugin {
/**
* Returns the shared instance.
- *
+ *
* @return the shared instance
*/
public static Activator getDefault() {
diff --git a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/ArchitectureQueries.java b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/ArchitectureQueries.java
index 4d6aac650b5..0e1b3e8ef36 100644
--- a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/ArchitectureQueries.java
+++ b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/ArchitectureQueries.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 PROTEUS Project consortium.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,9 +35,9 @@ import org.eclipse.uml2.uml.util.UMLUtil;
/**
- *
+ *
* @author scdtnsm
- *
+ *
*/
public class ArchitectureQueries {
@@ -65,19 +65,19 @@ public class ArchitectureQueries {
/**
* Retrieves the source port for a given connector
- *
+ *
* @see isDestPort and isSourcePort
*/
static private int getSourcePort(org.eclipse.uml2.uml.Connector conn, Port[] dest_port) {
- if(conn.getEnds().get(0).getRole() instanceof Port) {
- Port test_1 = (Port)conn.getEnds().get(0).getRole();
- if(isSourcePort(conn.getEnds().get(0), test_1)) {
+ if (conn.getEnds().get(0).getRole() instanceof Port) {
+ Port test_1 = (Port) conn.getEnds().get(0).getRole();
+ if (isSourcePort(conn.getEnds().get(0), test_1)) {
dest_port[0] = test_1;
return 0;
}
- Port test_2 = (Port)conn.getEnds().get(1).getRole();
- if(isSourcePort(conn.getEnds().get(1), test_2)) {
+ Port test_2 = (Port) conn.getEnds().get(1).getRole();
+ if (isSourcePort(conn.getEnds().get(1), test_2)) {
dest_port[0] = test_2;
return 1;
}
@@ -88,18 +88,18 @@ public class ArchitectureQueries {
/**
* Retrieves the destination port for a given connector
- *
+ *
* @see isDestPort and isSourcePort
*/
public static int getDestPort(org.eclipse.uml2.uml.Connector conn, Port[] dest_port) {
- if(conn.getEnds().get(0).getRole() instanceof Port) {
- Port test_1 = (Port)conn.getEnds().get(0).getRole();
- if(isDestPort(conn.getEnds().get(0), test_1)) {
+ if (conn.getEnds().get(0).getRole() instanceof Port) {
+ Port test_1 = (Port) conn.getEnds().get(0).getRole();
+ if (isDestPort(conn.getEnds().get(0), test_1)) {
dest_port[0] = test_1;
return 0;
}
- Port test_2 = (Port)conn.getEnds().get(1).getRole();
- if(isDestPort(conn.getEnds().get(1), test_2)) {
+ Port test_2 = (Port) conn.getEnds().get(1).getRole();
+ if (isDestPort(conn.getEnds().get(1), test_2)) {
dest_port[0] = test_2;
return 1;
}
@@ -115,8 +115,9 @@ public class ArchitectureQueries {
String inputName;
Port[] inputPort = new Port[1];
int index = getSourcePort(conn, inputPort);
- if(index < 0)
+ if (index < 0) {
return "Unknown";
+ }
inputName = inputPort[0].getName();
@@ -125,27 +126,29 @@ public class ArchitectureQueries {
/**
* Retrieve the model name of a component at the source of a connector.
- *
+ *
* @param conn
* @return a string or null if no component has been found at the source of a connector.
*/
static public String getSourceComponentTypeNameForConnector(org.eclipse.uml2.uml.Connector conn) {
Property prop = getSourceComponentForConnector(conn);
- if(prop == null)
+ if (prop == null) {
return null;
+ }
return prop.getType().getName();
}
/**
* Retrieve the instance name of a component at the source of a connector.
- *
+ *
* @param conn
* @return a string or null if no component has been found at the source of a connector.
*/
static public String getSourceComponentInstanceNameForConnector(org.eclipse.uml2.uml.Connector conn) {
Property prop = getSourceComponentForConnector(conn);
- if(prop == null)
+ if (prop == null) {
return null;
+ }
return prop.getName();
}
@@ -156,10 +159,11 @@ public class ArchitectureQueries {
Property input;
Port[] inputPort = new Port[1];
int index = getSourcePort(conn, inputPort);
- if((index < 0) || (conn.getEnds().get(index).getPartWithPort() == null))
+ if ((index < 0) || (conn.getEnds().get(index).getPartWithPort() == null)) {
return null;
- else
+ } else {
input = conn.getEnds().get(index).getPartWithPort();
+ }
return input;
}
@@ -170,8 +174,9 @@ public class ArchitectureQueries {
String outputName;
Port[] outputPort = new Port[1];
int index = getDestPort(conn, outputPort);
- if(index < 0)
+ if (index < 0) {
return "Unknown";
+ }
outputName = outputPort[0].getName();
@@ -185,36 +190,39 @@ public class ArchitectureQueries {
Property output;
Port[] outputPort = new Port[1];
int index = getDestPort(conn, outputPort);
- if((index < 0) || (conn.getEnds().get(index).getPartWithPort() == null))
+ if ((index < 0) || (conn.getEnds().get(index).getPartWithPort() == null)) {
return null;
- else
+ } else {
output = conn.getEnds().get(index).getPartWithPort();
+ }
return output;
}
/**
* Retrieve the model name (or type name) of a component at the destination of a connector.
- *
+ *
* @param conn
* @return a string or null if no component has been found at the destination of a connector.
*/
static public String getDestComponentTypeNameForConnector(org.eclipse.uml2.uml.Connector conn) {
Property prop = getDestComponentForConnector(conn);
- if(prop == null)
+ if (prop == null) {
return null;
+ }
return prop.getType().getName();
}
/**
* Retrieve the instance name of a component at the destination of a connector.
- *
+ *
* @param conn
* @return a string or null if no component has been found at the destination of a connector.
*/
static public String getDestComponentInstanceNameForConnector(org.eclipse.uml2.uml.Connector conn) {
Property prop = getDestComponentForConnector(conn);
- if(prop == null)
+ if (prop == null) {
return null;
+ }
return prop.getName();
}
@@ -224,8 +232,8 @@ public class ArchitectureQueries {
*/
static public List<org.eclipse.uml2.uml.Connector> getInternalConnectors(org.eclipse.uml2.uml.Class c) {
LinkedList<org.eclipse.uml2.uml.Connector> connectors = new LinkedList<org.eclipse.uml2.uml.Connector>();
- for(Connector conn : c.getOwnedConnectors()) {
- if(conn.getEnds().size() >= 2 && (conn.getEnds().get(0).getPartWithPort() != null) && (conn.getEnds().get(1).getPartWithPort() != null)) {
+ for (Connector conn : c.getOwnedConnectors()) {
+ if (conn.getEnds().size() >= 2 && (conn.getEnds().get(0).getPartWithPort() != null) && (conn.getEnds().get(1).getPartWithPort() != null)) {
connectors.add(conn);
}
}
@@ -238,12 +246,12 @@ public class ArchitectureQueries {
*/
static public List<org.eclipse.uml2.uml.Connector> getExternalInputConnectors(org.eclipse.uml2.uml.Class c) {
LinkedList<org.eclipse.uml2.uml.Connector> connectors = new LinkedList<org.eclipse.uml2.uml.Connector>();
- for(Connector conn : c.getOwnedConnectors()) {
- if(conn.getEnds().size() >= 2) {// && (conn.getEnds().get(1).getPartWithPort() != null)) {
- if(conn.getEnds().get(0).getRole() instanceof Port && conn.getEnds().get(1).getRole() instanceof Port) {
- Port port_1 = (Port)conn.getEnds().get(0).getRole();
- Port port_2 = (Port)conn.getEnds().get(1).getRole();
- if((isAnInputPort(port_1) && conn.getEnds().get(0).getPartWithPort() == null) || (isAnInputPort(port_2) && conn.getEnds().get(1).getPartWithPort() == null)) {
+ for (Connector conn : c.getOwnedConnectors()) {
+ if (conn.getEnds().size() >= 2) {// && (conn.getEnds().get(1).getPartWithPort() != null)) {
+ if (conn.getEnds().get(0).getRole() instanceof Port && conn.getEnds().get(1).getRole() instanceof Port) {
+ Port port_1 = (Port) conn.getEnds().get(0).getRole();
+ Port port_2 = (Port) conn.getEnds().get(1).getRole();
+ if ((isAnInputPort(port_1) && conn.getEnds().get(0).getPartWithPort() == null) || (isAnInputPort(port_2) && conn.getEnds().get(1).getPartWithPort() == null)) {
connectors.add(conn);
}
}
@@ -258,12 +266,12 @@ public class ArchitectureQueries {
*/
static public List<org.eclipse.uml2.uml.Connector> getExternalOutputConnectors(org.eclipse.uml2.uml.Class c) {
LinkedList<org.eclipse.uml2.uml.Connector> connectors = new LinkedList<org.eclipse.uml2.uml.Connector>();
- for(Connector conn : c.getOwnedConnectors()) {
- if(conn.getEnds().size() >= 2) {// && (conn.getEnds().get(0).getPartWithPort() != null)) {
- if(conn.getEnds().get(0).getRole() instanceof Port && conn.getEnds().get(1).getRole() instanceof Port) {
- Port port_1 = (Port)conn.getEnds().get(0).getRole();
- Port port_2 = (Port)conn.getEnds().get(1).getRole();
- if((isAnOutputPort(port_1) && conn.getEnds().get(0).getPartWithPort() == null) || (isAnOutputPort(port_2) && conn.getEnds().get(1).getPartWithPort() == null)) {
+ for (Connector conn : c.getOwnedConnectors()) {
+ if (conn.getEnds().size() >= 2) {// && (conn.getEnds().get(0).getPartWithPort() != null)) {
+ if (conn.getEnds().get(0).getRole() instanceof Port && conn.getEnds().get(1).getRole() instanceof Port) {
+ Port port_1 = (Port) conn.getEnds().get(0).getRole();
+ Port port_2 = (Port) conn.getEnds().get(1).getRole();
+ if ((isAnOutputPort(port_1) && conn.getEnds().get(0).getPartWithPort() == null) || (isAnOutputPort(port_2) && conn.getEnds().get(1).getPartWithPort() == null)) {
connectors.add(conn);
}
}
@@ -277,11 +285,11 @@ public class ArchitectureQueries {
* (a model can be contained in a model ... which is contained in a class).
*/
static public org.eclipse.uml2.uml.Class getRootClassForModel(org.eclipse.uml2.uml.Model m) {
- for(Element ne : m.getOwnedElements()) {
- if(ne instanceof org.eclipse.uml2.uml.Class) {
- return (org.eclipse.uml2.uml.Class)ne;
- } else if(ne instanceof org.eclipse.uml2.uml.Model) {
- return getRootClassForModel((org.eclipse.uml2.uml.Model)ne);
+ for (Element ne : m.getOwnedElements()) {
+ if (ne instanceof org.eclipse.uml2.uml.Class) {
+ return (org.eclipse.uml2.uml.Class) ne;
+ } else if (ne instanceof org.eclipse.uml2.uml.Model) {
+ return getRootClassForModel((org.eclipse.uml2.uml.Model) ne);
}
}
return null;
@@ -295,8 +303,8 @@ public class ArchitectureQueries {
LinkedList<org.eclipse.uml2.uml.Property> sub_components = new LinkedList<org.eclipse.uml2.uml.Property>();
List<org.eclipse.uml2.uml.Property> level_1 = getLevel1SubComponentsForComponent(c);
sub_components.addAll(level_1);
- for(Property prop : level_1) {
- List<Property> next_levels = getAllSubComponentsInClass((org.eclipse.uml2.uml.Class)prop.getType());
+ for (Property prop : level_1) {
+ List<Property> next_levels = getAllSubComponentsInClass((org.eclipse.uml2.uml.Class) prop.getType());
sub_components.addAll(next_levels);
}
return sub_components;
@@ -308,10 +316,10 @@ public class ArchitectureQueries {
*/
static public List<org.eclipse.uml2.uml.Property> getLevel1SubComponentsForComponent(org.eclipse.uml2.uml.Class c) {
LinkedList<org.eclipse.uml2.uml.Property> sub_components = new LinkedList<org.eclipse.uml2.uml.Property>();
- for(org.eclipse.uml2.uml.Property prop : c.getAllAttributes()) {
+ for (org.eclipse.uml2.uml.Property prop : c.getAllAttributes()) {
Type t = prop.getType();
- if(t instanceof org.eclipse.uml2.uml.Class) {
- if(GeneralQueries.hasStereotype((org.eclipse.uml2.uml.Class)t, org.eclipse.papyrus.RobotML.System.class)) {
+ if (t instanceof org.eclipse.uml2.uml.Class) {
+ if (GeneralQueries.hasStereotype((org.eclipse.uml2.uml.Class) t, org.eclipse.papyrus.RobotML.System.class)) {
sub_components.add(prop);
}
}
@@ -322,17 +330,18 @@ public class ArchitectureQueries {
/**
* On a given class (a RobotML system), retrieve all the contained systems.
* Not recursive. Retrieves only one level deep.
- *
+ *
* @deprecated replaced by getLevel1SubComponentsForComponent(org.eclipse.uml2.uml.Class c) which uses the RobotML API instead of stereotype
* names.
*/
+ @Deprecated
static public List<org.eclipse.uml2.uml.Property> getLevel1SubComponentsForComponentWithStereotype(org.eclipse.uml2.uml.Class c, String stereotype) {
LinkedList<org.eclipse.uml2.uml.Property> sub_components = new LinkedList<org.eclipse.uml2.uml.Property>();
- for(Property prop : c.getAllAttributes()) {
+ for (Property prop : c.getAllAttributes()) {
Type t = prop.getType();
- if(t instanceof org.eclipse.uml2.uml.Class) {
- // if(GeneralQueries.hasStereotype((org.eclipse.uml2.uml.Class) t, stereotype))
- if(GeneralQueries.inheritsFrom((org.eclipse.uml2.uml.Class)t, stereotype)) {
+ if (t instanceof org.eclipse.uml2.uml.Class) {
+ // if(GeneralQueries.hasStereotype((org.eclipse.uml2.uml.Class) t, stereotype))
+ if (GeneralQueries.inheritsFrom((org.eclipse.uml2.uml.Class) t, stereotype)) {
sub_components.add(prop);
}
}
@@ -346,10 +355,10 @@ public class ArchitectureQueries {
*/
static public List<org.eclipse.uml2.uml.Port> getOutputPortsForElement(Element elt) {
LinkedList<org.eclipse.uml2.uml.Port> found_output_ports = new LinkedList<org.eclipse.uml2.uml.Port>();
- for(Element child : elt.getOwnedElements()) {
- if(child instanceof org.eclipse.uml2.uml.Port) {
- if(isAnOutputPort((org.eclipse.uml2.uml.Port)child)) {
- found_output_ports.add((org.eclipse.uml2.uml.Port)child);
+ for (Element child : elt.getOwnedElements()) {
+ if (child instanceof org.eclipse.uml2.uml.Port) {
+ if (isAnOutputPort((org.eclipse.uml2.uml.Port) child)) {
+ found_output_ports.add((org.eclipse.uml2.uml.Port) child);
}
}
}
@@ -361,10 +370,10 @@ public class ArchitectureQueries {
*/
static public List<Port> getInputPortsForElement(Element elt) {
LinkedList<Port> found_input_ports = new LinkedList<org.eclipse.uml2.uml.Port>();
- for(Element child : elt.getOwnedElements()) {
- if(child instanceof NamedElement && child instanceof org.eclipse.uml2.uml.Port) {
- if(isAnInputPort((org.eclipse.uml2.uml.Port)child)) {
- Port found_port = (org.eclipse.uml2.uml.Port)child;
+ for (Element child : elt.getOwnedElements()) {
+ if (child instanceof NamedElement && child instanceof org.eclipse.uml2.uml.Port) {
+ if (isAnInputPort((org.eclipse.uml2.uml.Port) child)) {
+ Port found_port = (org.eclipse.uml2.uml.Port) child;
found_input_ports.add(found_port);
}
}
@@ -374,10 +383,10 @@ public class ArchitectureQueries {
static public List<org.eclipse.uml2.uml.Property> getOnPort(org.eclipse.uml2.uml.Parameter param) {
LinkedList<org.eclipse.uml2.uml.Property> result = new LinkedList<org.eclipse.uml2.uml.Property>();
- for(Stereotype st : param.getAppliedStereotypes()) {
- if(st.getName().contains("OnPort")) {
- for(Property p : st.getAttributes()) {
- result.add((Property)p);
+ for (Stereotype st : param.getAppliedStereotypes()) {
+ if (st.getName().contains("OnPort")) {
+ for (Property p : st.getAttributes()) {
+ result.add(p);
}
}
}
@@ -390,10 +399,10 @@ public class ArchitectureQueries {
*/
static public List<NamedElement> getComponentModels(Model model) {
LinkedList<NamedElement> found_elts = new LinkedList<NamedElement>();
- for(Element elt : model.allOwnedElements()) {
- if(elt instanceof org.eclipse.uml2.uml.Class) {
- if(GeneralQueries.hasStereotype((org.eclipse.uml2.uml.Class)elt, org.eclipse.papyrus.RobotML.System.class) && false == GeneralQueries.hasStereotype((org.eclipse.uml2.uml.Class)elt, org.eclipse.papyrus.RobotML.Platform.class)) {
- found_elts.add((NamedElement)elt);
+ for (Element elt : model.allOwnedElements()) {
+ if (elt instanceof org.eclipse.uml2.uml.Class) {
+ if (GeneralQueries.hasStereotype((org.eclipse.uml2.uml.Class) elt, org.eclipse.papyrus.RobotML.System.class) && false == GeneralQueries.hasStereotype((org.eclipse.uml2.uml.Class) elt, org.eclipse.papyrus.RobotML.Platform.class)) {
+ found_elts.add((NamedElement) elt);
}
}
}
@@ -402,26 +411,27 @@ public class ArchitectureQueries {
/**
* Is the elt at the root of the model hierarchy ?
- *
+ *
* @param elt
* @return
*/
static public Boolean isRootModel(Model elt) {
- if(elt == null)
+ if (elt == null) {
return false;
+ }
return (elt.getOwner() == null);
}
/**
* Does this class contain properties that are classes themselves ?
* (i.e. is this class a container of sub-classes)
- *
+ *
* @param c
* @return
*/
static public Boolean isMacroComponent(org.eclipse.uml2.uml.Class c) {
boolean result = false;
- if(getLevel1SubComponentsForComponent(c).size() > 0) {
+ if (getLevel1SubComponentsForComponent(c).size() > 0) {
result = true;
}
return result;
@@ -429,34 +439,38 @@ public class ArchitectureQueries {
static public Boolean hasNativeImplementation(org.eclipse.uml2.uml.Class c) {
org.eclipse.papyrus.RobotML.System sys = org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication(c, org.eclipse.papyrus.RobotML.System.class);
- if(sys == null)
+ if (sys == null) {
return false;
+ }
return sys.isNative();
}
static public String getNativeLibraryPathForComponent(org.eclipse.uml2.uml.Class c) {
org.eclipse.papyrus.RobotML.System sys = org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication(c, org.eclipse.papyrus.RobotML.System.class);
- if(sys == null)
+ if (sys == null) {
return null;
+ }
return sys.getLibraryPath();
}
static public String getNativeComponentNameForComponent(org.eclipse.uml2.uml.Class c) {
org.eclipse.papyrus.RobotML.System sys = org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication(c, org.eclipse.papyrus.RobotML.System.class);
- if(sys == null)
+ if (sys == null) {
return null;
+ }
return sys.getLibraryComponentName();
}
static public int getOutputPortBufferSize(Port p) {
org.eclipse.papyrus.RobotML.DataFlowPort dfp = org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication(p, org.eclipse.papyrus.RobotML.DataFlowPort.class);
- if(dfp == null)
+ if (dfp == null) {
return 0;
+ }
return dfp.getBufferSize();
}
/**
- *
+ *
*/
static public String getComponentFileName(org.eclipse.uml2.uml.Class c, String end) {
return c.getName() + end;
@@ -466,34 +480,35 @@ public class ArchitectureQueries {
* @TODO: author to add some doc.
*/
static public Boolean isPortConnected(Port p1) {
- if(p1.getEnds().size() > 0) {
- Connector conn = (Connector)p1.getEnds().get(0).getOwner();
+ if (p1.getEnds().size() > 0) {
+ Connector conn = (Connector) p1.getEnds().get(0).getOwner();
return isConnectionValid(conn);
- } else
+ } else {
return false;
+ }
}
/**
* @TODO: author to add some doc. Middleware specific?
*/
static public String getConnectionOtherSide(Port p1) {
- if(p1.getEnds().size() > 0) {
- Connector conn = (Connector)p1.getEnds().get(0).getOwner();
+ if (p1.getEnds().size() > 0) {
+ Connector conn = (Connector) p1.getEnds().get(0).getOwner();
ConnectorEnd e1 = conn.getEnds().get(0);
ConnectorEnd e2 = conn.getEnds().get(1);
Port p2 = null;
java.lang.System.out.println("p1=" + p1.getName());
Property c2 = null;
- if(e1.getRole() == p1) {
- p2 = (Port)e2.getRole();
- c2 = (Property)e2.getPartWithPort();
+ if (e1.getRole() == p1) {
+ p2 = (Port) e2.getRole();
+ c2 = e2.getPartWithPort();
java.lang.System.out.println("1 - p2=" + p2.getName() + ", c2=" + c2.getName());
- } else if(e2.getRole() == p1) {
- p2 = (Port)e1.getRole();
- c2 = (Property)e1.getPartWithPort();
+ } else if (e2.getRole() == p1) {
+ p2 = (Port) e1.getRole();
+ c2 = e1.getPartWithPort();
java.lang.System.out.println("2 - p2=" + p2.getName() + ", c2=" + c2.getName());
}
- if(c2.getName().equals(((NamedElement)conn.getOwner()).getName())) {
+ if (c2.getName().equals(((NamedElement) conn.getOwner()).getName())) {
return "@" + p2.getName();
} else {
return "@" + c2.getName() + "." + p2.getName();
@@ -505,30 +520,33 @@ public class ArchitectureQueries {
/**
* Is this property a DataFlow Port
- *
+ *
* @param port
* @return is this a DataFlow port ?
*/
static public Boolean isDataFlowPort(Port port) {
DataFlowPort dfp = UMLUtil.getStereotypeApplication(port, DataFlowPort.class);
- if(dfp == null)
+ if (dfp == null) {
return false;
+ }
return true;
}
/**
* For DataFlow ports: is it an Input Port ?
- *
+ *
* @param port
* @return false if the port is not a DataFlowPort or not an input port.
*/
static public Boolean isAnInputPort(Port port) {
try {
DataFlowPort dfp = UMLUtil.getStereotypeApplication(port, DataFlowPort.class);
- if(dfp == null)
+ if (dfp == null) {
return false;
- if(dfp.getDirection() == DataFlowDirectionKind.IN)
+ }
+ if (dfp.getDirection() == DataFlowDirectionKind.IN) {
return true;
+ }
return false;
} catch (Exception e) {
java.lang.System.out.println("EXCEPTION caught:" + e.toString());
@@ -538,17 +556,19 @@ public class ArchitectureQueries {
/**
* For DataFlow ports: is it an Output Port ?
- *
+ *
* @param port
* @return false if the port is not a DataFlowPort or not an output port.
*/
static public Boolean isAnOutputPort(Port port) {
try {
DataFlowPort dfp = UMLUtil.getStereotypeApplication(port, DataFlowPort.class);
- if(dfp == null)
+ if (dfp == null) {
return false;
- if(dfp.getDirection() == DataFlowDirectionKind.OUT)
+ }
+ if (dfp.getDirection() == DataFlowDirectionKind.OUT) {
return true;
+ }
return false;
} catch (Exception e) {
java.lang.System.out.println("EXCEPTION caught:" + e.toString());
@@ -558,17 +578,19 @@ public class ArchitectureQueries {
/**
* For RobotML ServicePorts: is the port a "Provided" port?
- *
+ *
* @param port
* @return false if the port is not a ServicePort or not a "Provided" ServicePort.
*/
static public Boolean isAProvidedPort(Port port) {
try {
ServicePort sp = UMLUtil.getStereotypeApplication(port, ServicePort.class);
- if(sp == null)
+ if (sp == null) {
return false;
- if(sp.getKind() == ServiceFlowKind.PROVIDED)
+ }
+ if (sp.getKind() == ServiceFlowKind.PROVIDED) {
return true;
+ }
return false;
} catch (Exception e) {
java.lang.System.out.println("EXCEPTION caught:" + e.toString());
@@ -578,17 +600,19 @@ public class ArchitectureQueries {
/**
* For RobotML ServicePorts: is the port a "Required" port?
- *
+ *
* @param port
* @return false if the port is not a ServicePort or not a "Required" ServicePort.
*/
static public Boolean isARequiredPort(Port port) {
try {
ServicePort sp = UMLUtil.getStereotypeApplication(port, ServicePort.class);
- if(sp == null)
+ if (sp == null) {
return false;
- if(sp.getKind() == ServiceFlowKind.REQUIRED)
+ }
+ if (sp.getKind() == ServiceFlowKind.REQUIRED) {
return true;
+ }
return false;
} catch (Exception e) {
java.lang.System.out.println("EXCEPTION caught:" + e.toString());
@@ -598,7 +622,7 @@ public class ArchitectureQueries {
/**
* Is this property a Service Port
- *
+ *
* @param port
* @return is this a service port ?
*/
@@ -618,11 +642,11 @@ public class ArchitectureQueries {
* @TODO: author to add some doc
*/
static public Boolean isConnectionValid(Connector connector) {
- if(connector.getEnds().size() != 2) {
+ if (connector.getEnds().size() != 2) {
return false;
}
- for(ConnectorEnd cend : connector.getEnds()) {
- if((cend.getRole() == null) || (cend.getPartWithPort() == null)) {
+ for (ConnectorEnd cend : connector.getEnds()) {
+ if ((cend.getRole() == null) || (cend.getPartWithPort() == null)) {
return false;
}
}
@@ -639,28 +663,29 @@ public class ArchitectureQueries {
}
static public Port getConnectedPort(Port port) {
- if(port.getEnds().size() == 0)
+ if (port.getEnds().size() == 0) {
return null;
+ }
- Connector conn = (Connector)port.getEnds().get(0).getOwner();
+ Connector conn = (Connector) port.getEnds().get(0).getOwner();
ConnectorEnd e1 = conn.getEnds().get(0);
ConnectorEnd e2 = conn.getEnds().get(1);
- return (e1.getRole() == port) ? (Port)e2.getRole() : (Port)e1.getRole();
+ return (e1.getRole() == port) ? (Port) e2.getRole() : (Port) e1.getRole();
}
/**
* Get external connectors to a port
- *
+ *
* @param port
* @return a list of connectors which are connected to the port.
*/
static public List<org.eclipse.uml2.uml.Connector> getConnectionsFromPort(Port port) {
LinkedList<org.eclipse.uml2.uml.Connector> connectors = new LinkedList<org.eclipse.uml2.uml.Connector>();
- for(ConnectorEnd connEnd : port.getEnds()) {
- Connector conn = (Connector)connEnd.getOwner();
+ for (ConnectorEnd connEnd : port.getEnds()) {
+ Connector conn = (Connector) connEnd.getOwner();
- if(conn.getEnds().size() >= 2 && conn.getEnds().get(0).getPartWithPort() != null && conn.getEnds().get(1).getPartWithPort() != null) {
+ if (conn.getEnds().size() >= 2 && conn.getEnds().get(0).getPartWithPort() != null && conn.getEnds().get(1).getPartWithPort() != null) {
connectors.add(conn);
}
}
@@ -676,7 +701,7 @@ public class ArchitectureQueries {
Stereotype pst = port.getAppliedStereotypes().get(0);
// Type du port
- if(port.getType() != null) {
+ if (port.getType() != null) {
java.lang.System.out.println("\t\t* type: " + port.getType().getName());
} else {
java.lang.System.err.println("\t\t\t* port " + port.getName() + " has no type ! ");
@@ -688,7 +713,7 @@ public class ArchitectureQueries {
// - la direction (énuméré IN ou OUT)
// - le protocole de synchronization (énuméré SYNCH ou ASYNCH ou UNDEFINED)
//
- for(Property propSt : pst.getAllAttributes()) {
+ for (Property propSt : pst.getAllAttributes()) {
java.lang.System.out.println("\t\t* port stereotype has attribute: " + propSt.getName() + " - " + port.getValue(pst, propSt.getName()));
}
@@ -702,7 +727,7 @@ public class ArchitectureQueries {
Stereotype pst = port.getAppliedStereotypes().get(0);
//
- if(port.getType() != null) {
+ if (port.getType() != null) {
java.lang.System.out.println("\t\t* type: " + port.getType().getName());
} else {
java.lang.System.err.println("\t\t\t* port " + port.getName() + " has no type ! ");
@@ -712,20 +737,20 @@ public class ArchitectureQueries {
// - le protocole de synchronization (énuméré SYNCH ou ASYNCH ou UNDEFINED)
//
- for(Property propSt : pst.getAllAttributes()) {
+ for (Property propSt : pst.getAllAttributes()) {
java.lang.System.out.println("\t\t* port stereotype has attribute: " + propSt.getName() + " - " + port.getValue(pst, propSt.getName()));
}
}
static public Boolean isAnAncestorOf(Class current_elt, Class other_elt) {
Boolean result = false;
- if(current_elt != null && other_elt != null) {
- if(current_elt == other_elt) {
+ if (current_elt != null && other_elt != null) {
+ if (current_elt == other_elt) {
result = true;
} else {
- for(Class parent : current_elt.getSuperClasses()) {
+ for (Class parent : current_elt.getSuperClasses()) {
current_elt = parent;
- if(other_elt == current_elt) {
+ if (other_elt == current_elt) {
result = true;
break;
}
@@ -738,17 +763,19 @@ public class ArchitectureQueries {
/**
* For DataFlow ports: is it an Output Port ?
- *
+ *
* @param port
* @return false if the port is not a DataFlowPort or not an input/output port.
*/
static public Boolean isAnInputOutputPort(Port port) {
try {
DataFlowPort dfp = UMLUtil.getStereotypeApplication(port, DataFlowPort.class);
- if(dfp == null)
+ if (dfp == null) {
return false;
- if(dfp.getDirection() == DataFlowDirectionKind.INOUT)
+ }
+ if (dfp.getDirection() == DataFlowDirectionKind.INOUT) {
return true;
+ }
return false;
} catch (Exception e) {
java.lang.System.out.println("EXCEPTION caught:" + e.toString());
diff --git a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/DataTypeQueries.java b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/DataTypeQueries.java
index 4a3ccebd685..06c1c5a4cc6 100644
--- a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/DataTypeQueries.java
+++ b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/DataTypeQueries.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 PROTEUS Project consortium.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -36,27 +36,27 @@ public class DataTypeQueries {
public List<DataType> getMetamodelComposedDataTypes(Element rootelt) {
LinkedList<DataType> results = new LinkedList<DataType>();
- if(rootelt instanceof Model) {
- EList<Package> packages = ((Model)rootelt).getImportedPackages();
- for(Package p : packages) {
+ if (rootelt instanceof Model) {
+ EList<Package> packages = ((Model) rootelt).getImportedPackages();
+ for (Package p : packages) {
EList<Element> elts = p.getOwnedElements();
- for(Element elt : elts) {
- if(elt instanceof PrimitiveType) {
- } else if(elt instanceof DataType) {
- results.add((DataType)elt);
- } else if(elt instanceof Package) {
+ for (Element elt : elts) {
+ if (elt instanceof PrimitiveType) {
+ } else if (elt instanceof DataType) {
+ results.add((DataType) elt);
+ } else if (elt instanceof Package) {
results.addAll(getMetamodelComposedDataTypes(elt));
}
}
}
- } else if(rootelt instanceof Package) {
- Package p = (Package)rootelt;
+ } else if (rootelt instanceof Package) {
+ Package p = (Package) rootelt;
EList<Element> elts = p.getOwnedElements();
- for(Element elt : elts) {
- if(elt instanceof PrimitiveType) {
- } else if(elt instanceof DataType) {
- results.add((DataType)elt);
- } else if(elt instanceof Package) {
+ for (Element elt : elts) {
+ if (elt instanceof PrimitiveType) {
+ } else if (elt instanceof DataType) {
+ results.add((DataType) elt);
+ } else if (elt instanceof Package) {
results.addAll(getMetamodelComposedDataTypes(elt));
}
}
@@ -66,33 +66,35 @@ public class DataTypeQueries {
/**
* Is the provided DataType one of the RobotML metamodel datatypes ?
- *
+ *
* @param dt
* @return
*/
public static boolean isRobotMLDataType(Element root_model, String datatype_name) {
try {
- if(root_model instanceof Model) {
- EList<Package> packages = ((Model)root_model).getImportedPackages();
- for(Package p : packages) {
+ if (root_model instanceof Model) {
+ EList<Package> packages = ((Model) root_model).getImportedPackages();
+ for (Package p : packages) {
EList<Element> elts = p.getOwnedElements();
- for(Element elt : elts) {
- if(elt instanceof DataType && datatype_name.compareTo(((DataType)elt).getName()) == 0) {
+ for (Element elt : elts) {
+ if (elt instanceof DataType && datatype_name.compareTo(((DataType) elt).getName()) == 0) {
return true;
- } else if(elt instanceof Package) {
- if(isRobotMLDataType(elt, datatype_name))
+ } else if (elt instanceof Package) {
+ if (isRobotMLDataType(elt, datatype_name)) {
return true;
+ }
}
}
}
- } else if(root_model instanceof Package) {
- EList<Element> elts = ((Package)root_model).getOwnedElements();
- for(Element elt : elts) {
- if(elt instanceof DataType && datatype_name.compareTo(((DataType)elt).getName()) == 0) {
+ } else if (root_model instanceof Package) {
+ EList<Element> elts = ((Package) root_model).getOwnedElements();
+ for (Element elt : elts) {
+ if (elt instanceof DataType && datatype_name.compareTo(((DataType) elt).getName()) == 0) {
return true;
- } else if(elt instanceof Package) {
- if(isRobotMLDataType(elt, datatype_name))
+ } else if (elt instanceof Package) {
+ if (isRobotMLDataType(elt, datatype_name)) {
return true;
+ }
}
}
}
@@ -105,29 +107,30 @@ public class DataTypeQueries {
public String getCppClassForDatatType(DataType dt) {
try {
String s = "";
- if(dt instanceof Enumeration) {
- Enumeration en = (Enumeration)dt;
+ if (dt instanceof Enumeration) {
+ Enumeration en = (Enumeration) dt;
s = "enum " + en.getName() + " {" + newline;
EList<EnumerationLiteral> literals = en.getOwnedLiterals();
- for(EnumerationLiteral literal : literals) {
+ for (EnumerationLiteral literal : literals) {
s += "\t" + literal.getName() + "," + newline;
}
- } else if(dt instanceof EnumerationLiteral) {
- //do nothing.
+ } else if (dt instanceof EnumerationLiteral) {
+ // do nothing.
} else {
EList<Property> attributes = dt.getOwnedAttributes();
s = "class " + dt.getName() + " {" + newline + "\tpublic:" + newline;
- for(Property attribute : attributes) {
+ for (Property attribute : attributes) {
String type_name;
- if(attribute.getType() != null)
+ if (attribute.getType() != null) {
type_name = attribute.getType().getName();
- else
+ } else {
type_name = "Unknown_NULL_IN_MODEL";
- if(attribute.getUpper() < 0) {
+ }
+ if (attribute.getUpper() < 0) {
s += "\tstd::vector<" + type_name + "> " + attribute.getName() + ";" + newline;
- } else if(attribute.getUpper() <= 1) {
+ } else if (attribute.getUpper() <= 1) {
s += "\t" + type_name + " " + attribute.getName() + ";" + newline;
- } else if(attribute.getUpper() == attribute.getLower()) {
+ } else if (attribute.getUpper() == attribute.getLower()) {
s += "\t" + type_name + " " + attribute.getName() + "[" + attribute.getUpper() + "];" + newline;
} else {
s += "\tstd::vector<" + type_name + "> " + attribute.getName() + ";" + newline;
@@ -144,14 +147,14 @@ public class DataTypeQueries {
/**
* Get all user-defined datatypes.
- *
+ *
* @return A list of datatypes
*/
public List<NamedElement> getElementsDataType(Model model) {
LinkedList<NamedElement> found_elts = new LinkedList<NamedElement>();
- for(NamedElement ne : model.getOwnedMembers()) {
- if(ne instanceof org.eclipse.uml2.uml.DataType) {
- found_elts.add((NamedElement)ne);
+ for (NamedElement ne : model.getOwnedMembers()) {
+ if (ne instanceof org.eclipse.uml2.uml.DataType) {
+ found_elts.add(ne);
}
getElementsDataType(ne, found_elts);
@@ -163,9 +166,9 @@ public class DataTypeQueries {
* Recursive sub-function to browse model and get all user-defined datatypes.
*/
private void getElementsDataType(Element parent_elt, LinkedList<NamedElement> target_list) {
- for(Element ne : parent_elt.getOwnedElements()) {
- if(ne instanceof org.eclipse.uml2.uml.DataType) {
- target_list.add((NamedElement)ne);
+ for (Element ne : parent_elt.getOwnedElements()) {
+ if (ne instanceof org.eclipse.uml2.uml.DataType) {
+ target_list.add((NamedElement) ne);
}
getElementsDataType(ne, target_list);
}
@@ -174,15 +177,16 @@ public class DataTypeQueries {
public DataType getPortDataType(Port port) {
Type t = port.getType();
- if(t != null && t instanceof DataType) {
- return (DataType)t;
+ if (t != null && t instanceof DataType) {
+ return (DataType) t;
}
return null;
}
public static boolean isPrimitiveType(Element elt) {
- if(elt instanceof PrimitiveType)
+ if (elt instanceof PrimitiveType) {
return true;
+ }
return false;
}
}
diff --git a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/DeploymentQueries.java b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/DeploymentQueries.java
index 35b5c5f3e46..247efdba396 100644
--- a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/DeploymentQueries.java
+++ b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/DeploymentQueries.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 PROTEUS Project Consortium.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,47 +35,47 @@ public class DeploymentQueries {
/**
* Return the list of instance specifications in a model
- *
+ *
* @param model
* @return A list of InstanceSpecification of all instance specifications
*/
static public List<InstanceSpecification> getInstanceSpecificationsInModel(Model model) {
LinkedList<InstanceSpecification> found_elts = new LinkedList<InstanceSpecification>();
- for(Element ne : model.getOwnedElements()) {
- if(ne instanceof NamedElement) {
- if(ne instanceof org.eclipse.uml2.uml.InstanceSpecification) {
- found_elts.add((InstanceSpecification)ne);
- //System.out.println("Instance : "+((NamedElement) ne).getName());
- } else if(ne instanceof org.eclipse.uml2.uml.Package) {
- found_elts.addAll(getInstanceSpecificationsInPackage((org.eclipse.uml2.uml.Package)ne));
+ for (Element ne : model.getOwnedElements()) {
+ if (ne instanceof NamedElement) {
+ if (ne instanceof org.eclipse.uml2.uml.InstanceSpecification) {
+ found_elts.add((InstanceSpecification) ne);
+ // System.out.println("Instance : "+((NamedElement) ne).getName());
+ } else if (ne instanceof org.eclipse.uml2.uml.Package) {
+ found_elts.addAll(getInstanceSpecificationsInPackage((org.eclipse.uml2.uml.Package) ne));
}
- } else if(ne instanceof Model) {
- found_elts.addAll(getInstanceSpecificationsInModel((Model)ne));
+ } else if (ne instanceof Model) {
+ found_elts.addAll(getInstanceSpecificationsInModel((Model) ne));
}
}
- // if(found_elts.isEmpty()){
- // System.out.println("Instances list empty");
- // }
+ // if(found_elts.isEmpty()){
+ // System.out.println("Instances list empty");
+ // }
return found_elts;
}
/**
* Return the list of instance specifications in a package
- *
+ *
* @param pack
* @return A list of InstanceSpecification of all instance specifications
*/
static public List<InstanceSpecification> getInstanceSpecificationsInPackage(org.eclipse.uml2.uml.Package pack) {
LinkedList<InstanceSpecification> found_elts = new LinkedList<InstanceSpecification>();
- for(Element ne : pack.getOwnedElements()) {
- if(ne instanceof NamedElement) {
- if(ne instanceof org.eclipse.uml2.uml.InstanceSpecification) {
- found_elts.add((InstanceSpecification)ne);
- } else if(ne instanceof org.eclipse.uml2.uml.Package) {
- found_elts.addAll(getInstanceSpecificationsInPackage((org.eclipse.uml2.uml.Package)ne));
+ for (Element ne : pack.getOwnedElements()) {
+ if (ne instanceof NamedElement) {
+ if (ne instanceof org.eclipse.uml2.uml.InstanceSpecification) {
+ found_elts.add((InstanceSpecification) ne);
+ } else if (ne instanceof org.eclipse.uml2.uml.Package) {
+ found_elts.addAll(getInstanceSpecificationsInPackage((org.eclipse.uml2.uml.Package) ne));
}
- } else if(ne instanceof Model) {
- found_elts.addAll(getInstanceSpecificationsInModel((Model)ne));
+ } else if (ne instanceof Model) {
+ found_elts.addAll(getInstanceSpecificationsInModel((Model) ne));
}
}
return found_elts;
@@ -83,15 +83,15 @@ public class DeploymentQueries {
/**
* Return the list of instance specifications allocated to given platform
- *
+ *
* @param model
* @param
* @return A list of InstanceSpecification of all instance specifications
*/
static public List<InstanceSpecification> getInstanceSpecificationsForPlatform(org.eclipse.uml2.uml.Model model, java.lang.String pfn) {
List<InstanceSpecification> found_elts = new LinkedList<InstanceSpecification>();
- for(InstanceSpecification instanceSpecification : getInstanceSpecificationsInModel(model)) {
- if(isAllocatedTo(instanceSpecification, pfn)) {
+ for (InstanceSpecification instanceSpecification : getInstanceSpecificationsInModel(model)) {
+ if (isAllocatedTo(instanceSpecification, pfn)) {
found_elts.add(instanceSpecification);
}
}
@@ -101,16 +101,16 @@ public class DeploymentQueries {
/**
* Return the list of instance specifications allocated to given platform. Should be equivalent to getInstanceSpecificationsForPlatform, but
* different implementation.
- *
+ *
* @param model
* @param targetPlatformName
- * Name of the requested target platform type.
+ * Name of the requested target platform type.
* @return A list of InstanceSpecification of all instance specifications.
*/
- static public List<InstanceSpecification> getInstanceSpecificationsForPlatform2(org.eclipse.uml2.uml.Model model, String targetPlatformName) { //org.eclipse.papyrus.RobotML.Platform targetPlatform) {
- //The list to return in the end.
+ static public List<InstanceSpecification> getInstanceSpecificationsForPlatform2(org.eclipse.uml2.uml.Model model, String targetPlatformName) { // org.eclipse.papyrus.RobotML.Platform targetPlatform) {
+ // The list to return in the end.
List<InstanceSpecification> found_elts = new LinkedList<InstanceSpecification>();
- for(org.eclipse.uml2.uml.Package dpPck : getDeploymentPlanPackagesInModel(model)) {
+ for (org.eclipse.uml2.uml.Package dpPck : getDeploymentPlanPackagesInModel(model)) {
found_elts.addAll(getDeploymentPlanInstanceSpecsForPlatform(dpPck, targetPlatformName));
}
return found_elts;
@@ -119,7 +119,7 @@ public class DeploymentQueries {
/**
* Return the parent name of an instance
- *
+ *
* @param inst
* @return Parent name of an instance
*/
@@ -127,7 +127,7 @@ public class DeploymentQueries {
String name = inst.getName();
Integer idx = name.lastIndexOf('.');
- if(idx != -1) {
+ if (idx != -1) {
return name.substring(0, idx);
} else {
return null;
@@ -137,7 +137,7 @@ public class DeploymentQueries {
/**
* Get real instance from InstanceSpecification object
- *
+ *
* @param model
* @param instanceSpecification
* @return the instance if found, or else null
@@ -145,10 +145,10 @@ public class DeploymentQueries {
static public Property getInstance(Model model, InstanceSpecification instanceSpecification) {
List<org.eclipse.uml2.uml.Property> l = ArchitectureQueries.getAllSubComponentsInClass(ArchitectureQueries.getRootClassForModel(model));
- for(Property p : l) {
+ for (Property p : l) {
String[] str = instanceSpecification.getName().split("\\.");
- if(str.length > 0 && p.getName().equals(str[str.length - 1])) {
+ if (str.length > 0 && p.getName().equals(str[str.length - 1])) {
return p;
}
}
@@ -159,20 +159,22 @@ public class DeploymentQueries {
/**
* Function to know if the instance must be generated by the platform or not.
- *
+ *
* @param instanceSpecification
* @param platformName
* @return true if the instance is allocated to the platform which name is given in parameter
*/
static public boolean isAllocatedTo(InstanceSpecification instSpec, String platformName) {
- if(instSpec == null || platformName == null)
+ if (instSpec == null || platformName == null) {
return false;
- for(Dependency dep : instSpec.getClientDependencies()) {
- Allocate alloc = UMLUtil.getStereotypeApplication((Element)dep, Allocate.class);
- if(alloc == null)
+ }
+ for (Dependency dep : instSpec.getClientDependencies()) {
+ Allocate alloc = UMLUtil.getStereotypeApplication(dep, Allocate.class);
+ if (alloc == null) {
continue;
- for(NamedElement nelt : dep.getSuppliers()) {
- if(isPlatformInstanceSpecificationFromPlatform(nelt, platformName)) {
+ }
+ for (NamedElement nelt : dep.getSuppliers()) {
+ if (isPlatformInstanceSpecificationFromPlatform(nelt, platformName)) {
return true;
}
}
@@ -183,19 +185,20 @@ public class DeploymentQueries {
/**
* Retrieves the deployment plans defined in a given model.
- *
+ *
* @param model
* @return A list of DeploymentPlans defined in the model.
*/
static public List<DeploymentPlan> getDeploymentPlansInModel(org.eclipse.uml2.uml.Model model) {
List<DeploymentPlan> dep_plans = new LinkedList<DeploymentPlan>();
- for(Element elt : model.getOwnedElements()) {
- if(elt instanceof org.eclipse.uml2.uml.Package) {
+ for (Element elt : model.getOwnedElements()) {
+ if (elt instanceof org.eclipse.uml2.uml.Package) {
DeploymentPlan dp = UMLUtil.getStereotypeApplication(elt, DeploymentPlan.class);
- if(dp != null)
+ if (dp != null) {
dep_plans.add(dp);
- else
- dep_plans.addAll(getDeploymentPlansInPackage((org.eclipse.uml2.uml.Package)elt));
+ } else {
+ dep_plans.addAll(getDeploymentPlansInPackage((org.eclipse.uml2.uml.Package) elt));
+ }
}
}
return dep_plans;
@@ -203,19 +206,20 @@ public class DeploymentQueries {
/**
* Retrieves the deployment plans defined in a given package.
- *
+ *
* @param pck
* @return
*/
static protected List<DeploymentPlan> getDeploymentPlansInPackage(org.eclipse.uml2.uml.Package pck) {
List<DeploymentPlan> dep_plans = new LinkedList<DeploymentPlan>();
- for(Element elt : pck.getOwnedElements()) {
- if(elt instanceof org.eclipse.uml2.uml.Package) {
+ for (Element elt : pck.getOwnedElements()) {
+ if (elt instanceof org.eclipse.uml2.uml.Package) {
DeploymentPlan dp = UMLUtil.getStereotypeApplication(elt, DeploymentPlan.class);
- if(dp != null)
+ if (dp != null) {
dep_plans.add(dp);
- else
- dep_plans.addAll(getDeploymentPlansInPackage((org.eclipse.uml2.uml.Package)elt));
+ } else {
+ dep_plans.addAll(getDeploymentPlansInPackage((org.eclipse.uml2.uml.Package) elt));
+ }
}
}
return dep_plans;
@@ -223,14 +227,14 @@ public class DeploymentQueries {
/**
* Retrieves the Packages in which Deployment plans are defined in the model.
- *
+ *
* @param model
* @return
*/
static public List<org.eclipse.uml2.uml.Package> getDeploymentPlanPackagesInModel(Model model) {
List<DeploymentPlan> dps = getDeploymentPlansInModel(model);
LinkedList<org.eclipse.uml2.uml.Package> pcks = new LinkedList<org.eclipse.uml2.uml.Package>();
- for(DeploymentPlan dp : dps) {
+ for (DeploymentPlan dp : dps) {
pcks.add(dp.getBase_Package());
}
return pcks;
@@ -238,45 +242,48 @@ public class DeploymentQueries {
/**
* Retrieves the InstanceSpecficiations allocated to a given Platform within a given DeploymentPlan.
- *
+ *
* @param deploymentPlan
* @param targetPlatformName
* @return
*/
static public List<InstanceSpecification> getDeploymentPlanInstanceSpecsForPlatform(org.eclipse.uml2.uml.Package deploymentPlan, String targetPlatformName) {
- //The list to return in the end.
+ // The list to return in the end.
List<InstanceSpecification> found_elts = new LinkedList<InstanceSpecification>();
- //Is the first argument really a Deployment plan ? (a Package with a DeploymentPlan StereoType)
+ // Is the first argument really a Deployment plan ? (a Package with a DeploymentPlan StereoType)
DeploymentPlan dp = org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication(deploymentPlan, org.eclipse.papyrus.RobotML.DeploymentPlan.class);
- if(dp == null)
+ if (dp == null) {
return found_elts;
+ }
- //Let's get all the Allocate elements in the DeploymentPlan, and check if the supplier (the target platform) corresponds to the second argument.
- for(Element elt : deploymentPlan.getOwnedElements()) {
- if(elt instanceof Dependency) {
- //Is it a Dependency with an "Allocate" stereotype ?
- Dependency dep = (Dependency)elt;
+ // Let's get all the Allocate elements in the DeploymentPlan, and check if the supplier (the target platform) corresponds to the second argument.
+ for (Element elt : deploymentPlan.getOwnedElements()) {
+ if (elt instanceof Dependency) {
+ // Is it a Dependency with an "Allocate" stereotype ?
+ Dependency dep = (Dependency) elt;
Allocate alloc = org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication(elt, org.eclipse.papyrus.RobotML.Allocate.class);
- if(alloc == null)
+ if (alloc == null) {
continue;
+ }
- //Let's store the potential client (the component instance) of the Allocate.
- //for future addition to the list to return.
+ // Let's store the potential client (the component instance) of the Allocate.
+ // for future addition to the list to return.
InstanceSpecification client_instance_spec = null;
- for(NamedElement client_elt : dep.getClients()) {
- if(false == (client_elt instanceof InstanceSpecification)) {
+ for (NamedElement client_elt : dep.getClients()) {
+ if (false == (client_elt instanceof InstanceSpecification)) {
continue;
}
- client_instance_spec = (InstanceSpecification)client_elt;
+ client_instance_spec = (InstanceSpecification) client_elt;
break;
}
- if(client_instance_spec == null)
+ if (client_instance_spec == null) {
continue;
+ }
- //Is it allocated to the platform provided as argument ?
- for(NamedElement nelt : dep.getSuppliers()) {
- if(isPlatformInstanceSpecificationFromPlatform(nelt, targetPlatformName)) {
+ // Is it allocated to the platform provided as argument ?
+ for (NamedElement nelt : dep.getSuppliers()) {
+ if (isPlatformInstanceSpecificationFromPlatform(nelt, targetPlatformName)) {
found_elts.add(client_instance_spec);
}
}
@@ -287,15 +294,16 @@ public class DeploymentQueries {
/**
* Function to know the content of allocation string.
- *
+ *
* @param instanceSpecification
* @return the allocation string
*/
static public String getAllocationName(InstanceSpecification instanceSpecification) {
- if(instanceSpecification.getClientDependencies().size() == 0)
+ if (instanceSpecification.getClientDependencies().size() == 0) {
return new String();
+ }
- //il n'y a toujours qu'un element
+ // il n'y a toujours qu'un element
Dependency d = instanceSpecification.getClientDependencies().get(0);
return d.getName();
@@ -303,24 +311,24 @@ public class DeploymentQueries {
/**
* Function to know which class must be generated by the platform or not.
- *
+ *
* @param model
* @param platformName
* @return all classes that are instanciated for the platform "pfn"
*/
static public List<org.eclipse.uml2.uml.Class> getDefinedComponentsForPlatform(Model model, String platformName) {
- //System.out.println("getDefinedComponentsForPlatform");
+ // System.out.println("getDefinedComponentsForPlatform");
LinkedList<org.eclipse.uml2.uml.Class> found_classes = new LinkedList<org.eclipse.uml2.uml.Class>();
List<InstanceSpecification> instances = getInstanceSpecificationsForPlatform(model, platformName);
- for(InstanceSpecification instanceSpecification : instances) {
- //System.out.println("instance : " + instanceSpecification.getName());
+ for (InstanceSpecification instanceSpecification : instances) {
+ // System.out.println("instance : " + instanceSpecification.getName());
- for(org.eclipse.uml2.uml.Classifier classifier : instanceSpecification.getClassifiers()) {
+ for (org.eclipse.uml2.uml.Classifier classifier : instanceSpecification.getClassifiers()) {
found_classes.add(GeneralQueries.findClassInModel(model, classifier.getName()));
- //org.eclipse.uml2.uml.Class theClass = GeneralQueries.findClassInModel(model, classifier.getName());
- //System.out.println("\tclass : " + theClass.getName());
+ // org.eclipse.uml2.uml.Class theClass = GeneralQueries.findClassInModel(model, classifier.getName());
+ // System.out.println("\tclass : " + theClass.getName());
}
}
return found_classes;
@@ -329,22 +337,22 @@ public class DeploymentQueries {
/**
* Function to know which class must be generated by the platform or not. Should be equivalent to getDefinedComponentsForPlatform but with a
* different implementation.
- *
+ *
* @param model
* @param platformName
* @return all classes that are instanciated for the platform "pfn"
*/
- static public List<org.eclipse.uml2.uml.Class> getDefinedComponentsForPlatform2(Model model, String platformName) //Platform platform)
+ static public List<org.eclipse.uml2.uml.Class> getDefinedComponentsForPlatform2(Model model, String platformName) // Platform platform)
{
LinkedList<org.eclipse.uml2.uml.Class> found_classes = new LinkedList<org.eclipse.uml2.uml.Class>();
List<InstanceSpecification> inst_specs = getInstanceSpecificationsForPlatform2(model, platformName);
- for(InstanceSpecification inst_spec : inst_specs) {
- for(org.eclipse.uml2.uml.Classifier classifier : inst_spec.getClassifiers()) {
+ for (InstanceSpecification inst_spec : inst_specs) {
+ for (org.eclipse.uml2.uml.Classifier classifier : inst_spec.getClassifiers()) {
found_classes.add(GeneralQueries.findClassInModel(model, classifier.getName()));
}
}
- //remove duplicates
+ // remove duplicates
Set<org.eclipse.uml2.uml.Class> new_set = new HashSet<org.eclipse.uml2.uml.Class>(found_classes);
List<org.eclipse.uml2.uml.Class> found_classes_2 = new LinkedList<org.eclipse.uml2.uml.Class>(new_set);
@@ -353,40 +361,41 @@ public class DeploymentQueries {
/**
* Checks whether or not a Platform instance specification has a given platform type.
- *
+ *
* @param platformInstanceSpecification
* @param expectedPlatformName
* @return
*/
- protected static boolean isPlatformInstanceSpecificationFromPlatform(NamedElement platformInstanceSpecification, String expectedPlatformName) //Platform expectedPlatform)
+ protected static boolean isPlatformInstanceSpecificationFromPlatform(NamedElement platformInstanceSpecification, String expectedPlatformName) // Platform expectedPlatform)
{
- if(platformInstanceSpecification instanceof InstanceSpecification) {
- InstanceSpecification platformInstance = (InstanceSpecification)platformInstanceSpecification;
- for(Classifier classifier : platformInstance.getClassifiers()) {
- if(classifier.getName().toLowerCase().compareTo(expectedPlatformName) == 0)
+ if (platformInstanceSpecification instanceof InstanceSpecification) {
+ InstanceSpecification platformInstance = (InstanceSpecification) platformInstanceSpecification;
+ for (Classifier classifier : platformInstance.getClassifiers()) {
+ if (classifier.getName().toLowerCase().compareTo(expectedPlatformName) == 0) {
return true;
- /*
- * RoboticMiddleware mdw = UMLUtil.getStereotypeApplication(classifier, org.eclipse.papyrus.RobotML.RoboticMiddleware.class);
- * RoboticSimulator sim = UMLUtil.getStereotypeApplication(classifier, org.eclipse.papyrus.RobotML.RoboticSimulator.class);
- * if (mdw != null) {
- * //The target platform seems to be a middleware.
- * //Middlewares are identified by their "kind".
- * if (expectedPlatform instanceof RoboticMiddleware) {
- * if (mdw.getKind() == ((RoboticMiddleware)expectedPlatform).getKind()) {
- * //YEEEEHAAAA !!!
- * return true;
- * }
- * }
- * }
- * if (sim != null && expectedPlatform instanceof RoboticSimulator) {
- * //The target platform seems to be a simulator.
- * //Simulators are just derived classes.
- * if (sim.getClass().getName().compareTo(((RoboticSimulator)expectedPlatform).getClass().getName()) == 0) {
- * //YEEEEEHAAAAAA !!!
- * return true;
- * }
- * }
- */
+ /*
+ * RoboticMiddleware mdw = UMLUtil.getStereotypeApplication(classifier, org.eclipse.papyrus.RobotML.RoboticMiddleware.class);
+ * RoboticSimulator sim = UMLUtil.getStereotypeApplication(classifier, org.eclipse.papyrus.RobotML.RoboticSimulator.class);
+ * if (mdw != null) {
+ * //The target platform seems to be a middleware.
+ * //Middlewares are identified by their "kind".
+ * if (expectedPlatform instanceof RoboticMiddleware) {
+ * if (mdw.getKind() == ((RoboticMiddleware)expectedPlatform).getKind()) {
+ * //YEEEEHAAAA !!!
+ * return true;
+ * }
+ * }
+ * }
+ * if (sim != null && expectedPlatform instanceof RoboticSimulator) {
+ * //The target platform seems to be a simulator.
+ * //Simulators are just derived classes.
+ * if (sim.getClass().getName().compareTo(((RoboticSimulator)expectedPlatform).getClass().getName()) == 0) {
+ * //YEEEEEHAAAAAA !!!
+ * return true;
+ * }
+ * }
+ */
+ }
}
}
return false;
diff --git a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/FSMQueries.java b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/FSMQueries.java
index f601d7e2ba6..7fd892c142e 100644
--- a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/FSMQueries.java
+++ b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/FSMQueries.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 PROTEUS Project consortium.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,7 +18,6 @@ import java.util.LinkedList;
import java.util.List;
import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.State;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.util.UMLUtil;
@@ -26,35 +25,37 @@ public class FSMQueries {
/**
* Find all states in a state machine.
- *
+ *
* @param sm
- * a state machine
+ * a state machine
* @return a list of states
* @todo a valider par Nicolas
*/
public List<org.eclipse.uml2.uml.Vertex> getStates(StateMachine sm) {
LinkedList<org.eclipse.uml2.uml.Vertex> res = new LinkedList<org.eclipse.uml2.uml.Vertex>();
- for(org.eclipse.uml2.uml.Region region : sm.getRegions())
- for(org.eclipse.uml2.uml.Vertex vertex : region.getSubvertices())
- res.add((org.eclipse.uml2.uml.Vertex)vertex);
+ for (org.eclipse.uml2.uml.Region region : sm.getRegions()) {
+ for (org.eclipse.uml2.uml.Vertex vertex : region.getSubvertices()) {
+ res.add(vertex);
+ }
+ }
return res;
}
/**
* Find all transitions in a state machine.
- *
+ *
* @param sm
- * a state machine
+ * a state machine
* @return a list of transitions
* @todo a valider par Nicolas
*/
public List<org.eclipse.papyrus.RobotML.Transition> getTransitions(StateMachine sm) {
LinkedList<org.eclipse.papyrus.RobotML.Transition> res = new LinkedList<org.eclipse.papyrus.RobotML.Transition>();
- for(org.eclipse.uml2.uml.Region region : sm.getRegions()) {
- for(org.eclipse.uml2.uml.Transition transition : region.getTransitions()) {
+ for (org.eclipse.uml2.uml.Region region : sm.getRegions()) {
+ for (org.eclipse.uml2.uml.Transition transition : region.getTransitions()) {
org.eclipse.papyrus.RobotML.Transition robotml_transition = UMLUtil.getStereotypeApplication(transition, org.eclipse.papyrus.RobotML.Transition.class);
- if(robotml_transition != null) {
+ if (robotml_transition != null) {
res.add(robotml_transition);
}
}
@@ -64,7 +65,7 @@ public class FSMQueries {
/**
* Find all state machines in a component.
- *
+ *
* @param elt
* @return a list of state machines
* @todo a valider par Nicolas
@@ -72,30 +73,32 @@ public class FSMQueries {
public List<StateMachine> getStateMachines(Element elt) {
LinkedList<StateMachine> res = new LinkedList<StateMachine>();
- for(Element child : elt.getOwnedElements())
- if(child instanceof StateMachine)
- res.add((StateMachine)child);
+ for (Element child : elt.getOwnedElements()) {
+ if (child instanceof StateMachine) {
+ res.add((StateMachine) child);
+ }
+ }
return res;
}
/**
* Generate the state operation
- *
+ *
* @param vertex
* @return
*/
- // public String generateOperationStateString(org.eclipse.uml2.uml.Vertex vertex) {
- // String result = "";
- // if(vertex instanceof State) {
- // org.eclipse.papyrus.RobotML.State state = UMLUtil.getStereotypeApplication(vertex, org.eclipse.papyrus.RobotML.State.class);
- // if(state != null) {
- // if(state.getOperation() != null) {
- // String operation = state.getOperation().getBase_Operation().getName();
- // result = operation;
- // }
- // }
- // }
- // return result;
- // }
+ // public String generateOperationStateString(org.eclipse.uml2.uml.Vertex vertex) {
+ // String result = "";
+ // if(vertex instanceof State) {
+ // org.eclipse.papyrus.RobotML.State state = UMLUtil.getStereotypeApplication(vertex, org.eclipse.papyrus.RobotML.State.class);
+ // if(state != null) {
+ // if(state.getOperation() != null) {
+ // String operation = state.getOperation().getBase_Operation().getName();
+ // result = operation;
+ // }
+ // }
+ // }
+ // return result;
+ // }
}
diff --git a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/GeneralQueries.java b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/GeneralQueries.java
index e0f022982cc..bce7e5dbeeb 100644
--- a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/GeneralQueries.java
+++ b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/GeneralQueries.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 PROTEUS Project consortium.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,30 +38,30 @@ public class GeneralQueries {
/**
* Retrieve all sub-elements (of type Class) for a given element that have the provided stereotype.
* Basically, retrieves all the component models inside a RobotML model.
- *
+ *
* @param parent_elt
- * the root element to inspect
+ * the root element to inspect
* @param clazz
- * the stereotype class we are looking for. Usually something like ...RobotML.SensorSystem
+ * the stereotype class we are looking for. Usually something like ...RobotML.SensorSystem
* @param target_list
- * the list in which the found elements will be stored.
+ * the list in which the found elements will be stored.
*/
static protected void getElementsWithStereotype(Element parent_elt, Class clazz, LinkedList<NamedElement> target_list) {
- if(parent_elt instanceof org.eclipse.uml2.uml.Class) {
- for(EObject stereoApplication : parent_elt.getStereotypeApplications()) {
+ if (parent_elt instanceof org.eclipse.uml2.uml.Class) {
+ for (EObject stereoApplication : parent_elt.getStereotypeApplications()) {
// check whether the stereotype is an instance of the passed parameter clazz
- if(clazz.isInstance(stereoApplication)) {
- target_list.add((NamedElement)parent_elt);
+ if (clazz.isInstance(stereoApplication)) {
+ target_list.add((NamedElement) parent_elt);
}
}
}
- for(Element ne : parent_elt.getOwnedElements()) {
- if(ne instanceof NamedElement) {
- if(ne instanceof org.eclipse.uml2.uml.Class) {
- for(EObject stereoApplication : ne.getStereotypeApplications()) {
+ for (Element ne : parent_elt.getOwnedElements()) {
+ if (ne instanceof NamedElement) {
+ if (ne instanceof org.eclipse.uml2.uml.Class) {
+ for (EObject stereoApplication : ne.getStereotypeApplications()) {
// check whether the stereotype is an instance of the passed parameter clazz
- if(clazz.isInstance(stereoApplication)) {
- target_list.add((NamedElement)ne);
+ if (clazz.isInstance(stereoApplication)) {
+ target_list.add((NamedElement) ne);
}
}
getElementsWithStereotype(ne, clazz, target_list);
@@ -73,25 +73,26 @@ public class GeneralQueries {
/**
* Recursive retrieve of all elements with a given stereotype in the model.
- *
+ *
* @param model
- * Model to search in.
+ * Model to search in.
* @param stereotype
- * The stereotype name (e.g. "Sensor", "Actuator", "SubSystem"...)
+ * The stereotype name (e.g. "Sensor", "Actuator", "SubSystem"...)
* @return A list of NamedElements having the specified stereotype.
* @deprecated to be replaced with calls to the RobotML API. Replaced by getElementsWithStereotype (Model model, StereotypeClass sc)
*/
+ @Deprecated
static public List<NamedElement> getElementsWithStereotype(Model model, String stereotype) {
LinkedList<NamedElement> found_elts = new LinkedList<NamedElement>();
- for(Element ne : model.getOwnedElements()) {
- if(ne instanceof NamedElement) {
- if(ne instanceof org.eclipse.uml2.uml.Class) {
- if(hasStereotype((org.eclipse.uml2.uml.Class)ne, stereotype)) {
- found_elts.add((NamedElement)ne);
+ for (Element ne : model.getOwnedElements()) {
+ if (ne instanceof NamedElement) {
+ if (ne instanceof org.eclipse.uml2.uml.Class) {
+ if (hasStereotype((org.eclipse.uml2.uml.Class) ne, stereotype)) {
+ found_elts.add((NamedElement) ne);
}
}
- } else if(ne instanceof Model) {
- found_elts.addAll(getElementsWithStereotype((Model)ne, stereotype));
+ } else if (ne instanceof Model) {
+ found_elts.addAll(getElementsWithStereotype((Model) ne, stereotype));
}
getElementsWithStereotype(ne, stereotype, found_elts);
}
@@ -101,18 +102,19 @@ public class GeneralQueries {
/**
* Same as getElementsWithStereotype(Model model...) searches in an Element members, not in a Model members.
* This function is private and used by getElementsWithStereotype(Model model...)
- *
+ *
* @param parent_elt
* @param stereotype
* @param target_list
* @deprecated to be replaced with calls to the RobotML API.
*/
+ @Deprecated
static private void getElementsWithStereotype(Element parent_elt, String stereotype, LinkedList<NamedElement> target_list) {
- for(Element ne : parent_elt.getOwnedElements()) {
- if(ne instanceof NamedElement) {
- if(ne instanceof org.eclipse.uml2.uml.Class) {
- if(hasStereotype((org.eclipse.uml2.uml.Class)ne, stereotype)) {
- target_list.add((NamedElement)ne);
+ for (Element ne : parent_elt.getOwnedElements()) {
+ if (ne instanceof NamedElement) {
+ if (ne instanceof org.eclipse.uml2.uml.Class) {
+ if (hasStereotype((org.eclipse.uml2.uml.Class) ne, stereotype)) {
+ target_list.add((NamedElement) ne);
}
}
getElementsWithStereotype(ne, stereotype, target_list);
@@ -123,25 +125,26 @@ public class GeneralQueries {
/**
* Recursive retrieve of all element with a given inherited stereotype in the model.
- *
+ *
* @param model
- * Model to search in.
+ * Model to search in.
* @param stereotype
- * The stereotype name (e.g. "Sensor", "Actuator", "SubSystem"...)
+ * The stereotype name (e.g. "Sensor", "Actuator", "SubSystem"...)
* @return A list of NamedElements having the specified stereotype.
* @deprecated to be replaced with calls to the RobotML API. Replaced by getElementsWithStereotype (Model model, StereotypeClass sc)
*/
+ @Deprecated
static public List<NamedElement> getElementsWithInheritedStereotype(Model model, String stereotype) {
LinkedList<NamedElement> found_elts = new LinkedList<NamedElement>();
- for(Element ne : model.getOwnedElements()) {
- if(ne instanceof NamedElement) {
- if(ne instanceof org.eclipse.uml2.uml.Class) {
- if(inheritsFrom((org.eclipse.uml2.uml.Class)ne, stereotype)) {
- found_elts.add((NamedElement)ne);
+ for (Element ne : model.getOwnedElements()) {
+ if (ne instanceof NamedElement) {
+ if (ne instanceof org.eclipse.uml2.uml.Class) {
+ if (inheritsFrom((org.eclipse.uml2.uml.Class) ne, stereotype)) {
+ found_elts.add((NamedElement) ne);
}
}
- } else if(ne instanceof Model) {
- found_elts.addAll(getElementsWithInheritedStereotype((Model)ne, stereotype));
+ } else if (ne instanceof Model) {
+ found_elts.addAll(getElementsWithInheritedStereotype((Model) ne, stereotype));
}
getElementsWithInheritedStereotype(ne, stereotype, found_elts);
}
@@ -151,27 +154,28 @@ public class GeneralQueries {
/**
* Same as getElementsWithInheritedStereotype(Model model...) searches in an Element members, not in a Model members.
* This function is private and used by getElementsWithStereotype(Model model...)
- *
+ *
* @param parent_elt
* @param stereotype
* @param target_list
* @deprecated to be replaced with calls to the RobotML API.
*/
+ @Deprecated
static private void getElementsWithInheritedStereotype(Element parent_elt, String stereotype, LinkedList<NamedElement> target_list) {
- for(Element ne : parent_elt.getOwnedElements()) {
- if(ne instanceof NamedElement) {
- //System.out.println(((NamedElement)ne).getName());
- if(ne instanceof org.eclipse.uml2.uml.Class) {
- if(inheritsFrom((org.eclipse.uml2.uml.Class)ne, stereotype)) {
- target_list.add((NamedElement)ne);
+ for (Element ne : parent_elt.getOwnedElements()) {
+ if (ne instanceof NamedElement) {
+ // System.out.println(((NamedElement)ne).getName());
+ if (ne instanceof org.eclipse.uml2.uml.Class) {
+ if (inheritsFrom((org.eclipse.uml2.uml.Class) ne, stereotype)) {
+ target_list.add((NamedElement) ne);
}
- // String current_stereotype = this.getStereotype((org.eclipse.uml2.uml.Class)ne);
- // //if (stereotype != "--")
- // // System.out.println("STEREOTYPE: " + stereotype);
- // if (current_stereotype.compareTo(stereotype)==0) {
- // //System.out.println("FOUND A SENSOR: " + ((NamedElement)ne).getName());
- // target_list.add((NamedElement)ne);
- // }
+ // String current_stereotype = this.getStereotype((org.eclipse.uml2.uml.Class)ne);
+ // //if (stereotype != "--")
+ // // System.out.println("STEREOTYPE: " + stereotype);
+ // if (current_stereotype.compareTo(stereotype)==0) {
+ // //System.out.println("FOUND A SENSOR: " + ((NamedElement)ne).getName());
+ // target_list.add((NamedElement)ne);
+ // }
}
getElementsWithInheritedStereotype(ne, stereotype, target_list);
}
@@ -182,11 +186,12 @@ public class GeneralQueries {
/**
* Get the first stereotype applied to a given class.
* Warning: other stereotypes are ignored. To use with care.
- *
+ *
* @deprecated superseded by the RobotML API.
*/
+ @Deprecated
static public String getStereotype(org.eclipse.uml2.uml.Class cl) {
- if(cl.getAppliedStereotypes().size() == 1) {
+ if (cl.getAppliedStereotypes().size() == 1) {
return cl.getAppliedStereotypes().get(0).getName();
} else {
return "--";
@@ -194,11 +199,11 @@ public class GeneralQueries {
}
static public Boolean inheritsFrom(org.eclipse.uml2.uml.Class cl, String stname) {
- for(Stereotype st : cl.getAppliedStereotypes()) {
- if(st.getName().equals(stname)) {
+ for (Stereotype st : cl.getAppliedStereotypes()) {
+ if (st.getName().equals(stname)) {
return true;
} else {
- if(inheritsFrom(st, stname)) {
+ if (inheritsFrom(st, stname)) {
return true;
}
}
@@ -207,20 +212,21 @@ public class GeneralQueries {
}
static public Boolean inheritsFrom(org.eclipse.uml2.uml.Stereotype st, String stname) {
- if(st.getName().equals(stname)) {
+ if (st.getName().equals(stname)) {
return true;
} else {
- for(org.eclipse.uml2.uml.Class scl : st.getSuperClasses()) {
- if(inheritsFrom((org.eclipse.uml2.uml.Stereotype)scl, stname))
+ for (org.eclipse.uml2.uml.Class scl : st.getSuperClasses()) {
+ if (inheritsFrom((org.eclipse.uml2.uml.Stereotype) scl, stname)) {
return true;
+ }
}
}
return false;
}
static public String getStereotypeInheritedFrom(org.eclipse.uml2.uml.Class cl, String stname) {
- for(Stereotype st : cl.getAppliedStereotypes()) {
- if(inheritsFrom(st, stname)) {
+ for (Stereotype st : cl.getAppliedStereotypes()) {
+ if (inheritsFrom(st, stname)) {
return st.getName();
}
}
@@ -228,9 +234,9 @@ public class GeneralQueries {
}
static public Boolean hasStereotype(org.eclipse.uml2.uml.Class cl, Class stereotype) {
- for(EObject stereoApplication : cl.getStereotypeApplications()) {
+ for (EObject stereoApplication : cl.getStereotypeApplications()) {
// check whether the stereotype is an instance of the passed parameter clazz
- if(stereotype.isInstance(stereoApplication)) {
+ if (stereotype.isInstance(stereoApplication)) {
return true;
}
}
@@ -241,8 +247,8 @@ public class GeneralQueries {
* Return true if a given class has specified stereotype.
*/
static public Boolean hasStereotype(org.eclipse.uml2.uml.Class cl, String s) {
- for(Stereotype st : cl.getAppliedStereotypes()) {
- if(st.getName().equals(s)) {
+ for (Stereotype st : cl.getAppliedStereotypes()) {
+ if (st.getName().equals(s)) {
return true;
}
}
@@ -251,7 +257,7 @@ public class GeneralQueries {
/**
* Is this element a UML class
- *
+ *
* @param element
* @return is this a UML class ?
*/
@@ -261,31 +267,31 @@ public class GeneralQueries {
/**
* Is this element a UML DataType
- *
+ *
* @param element
* @return is this a UML DataType ?
*/
static public Boolean isDataType(Element elt) {
boolean b = (elt instanceof org.eclipse.uml2.uml.DataType);
- //System.out.println(((NamedElement)elt).getName()+" - isDataType: "+b+" "+elt.getAppliedStereotypes());
+ // System.out.println(((NamedElement)elt).getName()+" - isDataType: "+b+" "+elt.getAppliedStereotypes());
return b;
}
/**
* Is this element a UML interface
- *
+ *
* @param element
* @return is this a UML class ?
*/
static public Boolean isInterface(Element elt) {
boolean b = (elt instanceof org.eclipse.uml2.uml.Interface);
- //System.out.println(((NamedElement)elt).getName()+" - isInterface: "+b+" "+elt.getAppliedStereotypes());
+ // System.out.println(((NamedElement)elt).getName()+" - isInterface: "+b+" "+elt.getAppliedStereotypes());
return b;
}
/**
* Is this element a UML Property
- *
+ *
* @param element
* @return is this a UML Property ?
*/
@@ -295,7 +301,7 @@ public class GeneralQueries {
/**
* Is this property a Port
- *
+ *
* @param property
* @return is this a port ?
*/
@@ -305,7 +311,7 @@ public class GeneralQueries {
/**
* Is this element an instance specification
- *
+ *
* @param element
* @return is this an instance specification ?
*/
@@ -318,12 +324,13 @@ public class GeneralQueries {
*/
static public String getInstanceMultiplicity(Property p) {
try {
- if((p.getLower() == 1) && (p.getUpper() == 1)) {
+ if ((p.getLower() == 1) && (p.getUpper() == 1)) {
return "";
- } else if((p.getLower() == p.getUpper())) {
+ } else if ((p.getLower() == p.getUpper())) {
return "[" + p.getLower() + "]";
- } else
+ } else {
return "[]";
+ }
} catch (Exception e) {
java.lang.System.out.println(e);
e.printStackTrace();
@@ -335,20 +342,20 @@ public class GeneralQueries {
* Return the value of a given attribute using the given stereotype
*/
static public String getAttributeValue(org.eclipse.uml2.uml.Class cl, String attr, String stname) {
- for(Stereotype st : cl.getAppliedStereotypes()) {
- if(st.getName().equals(stname)) {
+ for (Stereotype st : cl.getAppliedStereotypes()) {
+ if (st.getName().equals(stname)) {
Object o = cl.getValue(st, attr);
- if(o != null) {
- if(o instanceof NamedElement) {
- String v = ((NamedElement)o).getName();
+ if (o != null) {
+ if (o instanceof NamedElement) {
+ String v = ((NamedElement) o).getName();
return v;
- } else if(o instanceof String) {
- return (String)o;
- } else if(o instanceof EList) {
- if(((EList<Object>)o).isEmpty()) {
+ } else if (o instanceof String) {
+ return (String) o;
+ } else if (o instanceof EList) {
+ if (((EList<Object>) o).isEmpty()) {
return null;
}
- return ((EList<Object>)o).get(0).toString();
+ return ((EList<Object>) o).get(0).toString();
} else {
return o.toString();
}
@@ -365,9 +372,9 @@ public class GeneralQueries {
static public String getAttributeValue(org.eclipse.uml2.uml.Class cl, String attr, String stname, String defaultValue) {
String result = null;
result = getAttributeValue(cl, attr, stname);
- //System.out.println("value : " + result);
+ // System.out.println("value : " + result);
- if(result == null || result.length() == 0) {
+ if (result == null || result.length() == 0) {
return defaultValue;
}
return result;
@@ -379,19 +386,19 @@ public class GeneralQueries {
*/
static public List<String> getAttributeValues(org.eclipse.uml2.uml.Class cl, String attr, String stname) {
LinkedList<String> result = new LinkedList<String>();
- for(Stereotype st : cl.getAppliedStereotypes()) {
- if(st.getName().equals(stname)) {
+ for (Stereotype st : cl.getAppliedStereotypes()) {
+ if (st.getName().equals(stname)) {
Object o = cl.getValue(st, attr);
- if(o != null) {
- if(o instanceof NamedElement) {
- result.add(((NamedElement)o).getName());
- } else if(o instanceof String) {
- result.add((String)o);
- } else if(o instanceof EList) {
- // System.out.println("Values type: " + o.getClass().getName() );
- for(int i = 0; i < ((EList<Object>)o).size(); i++) {
- result.add(((EList<Object>)o).get(i).toString());
- // System.out.println("element " + i + " : " + ((EList<Object>) o).get(i));
+ if (o != null) {
+ if (o instanceof NamedElement) {
+ result.add(((NamedElement) o).getName());
+ } else if (o instanceof String) {
+ result.add((String) o);
+ } else if (o instanceof EList) {
+ // System.out.println("Values type: " + o.getClass().getName() );
+ for (int i = 0; i < ((EList<Object>) o).size(); i++) {
+ result.add(((EList<Object>) o).get(i).toString());
+ // System.out.println("element " + i + " : " + ((EList<Object>) o).get(i));
}
} else {
result.add(o.toString());
@@ -406,20 +413,23 @@ public class GeneralQueries {
* Find a class with a given name in the model.
*/
static public org.eclipse.uml2.uml.Class findClassInModel(org.eclipse.uml2.uml.Model model, String name) {
- for(Element ne : model.getOwnedElements()) {
- if(ne instanceof NamedElement) {
- if(ne instanceof org.eclipse.uml2.uml.Class) {
- if(((org.eclipse.uml2.uml.Class)ne).getName().equals(name))
- return (org.eclipse.uml2.uml.Class)ne;
- } else if(ne instanceof org.eclipse.uml2.uml.Package) {
- org.eclipse.uml2.uml.Class result = findClassInPackage((org.eclipse.uml2.uml.Package)ne, name);
- if(result != null)
+ for (Element ne : model.getOwnedElements()) {
+ if (ne instanceof NamedElement) {
+ if (ne instanceof org.eclipse.uml2.uml.Class) {
+ if (((org.eclipse.uml2.uml.Class) ne).getName().equals(name)) {
+ return (org.eclipse.uml2.uml.Class) ne;
+ }
+ } else if (ne instanceof org.eclipse.uml2.uml.Package) {
+ org.eclipse.uml2.uml.Class result = findClassInPackage((org.eclipse.uml2.uml.Package) ne, name);
+ if (result != null) {
return result;
+ }
}
- } else if(ne instanceof Model) {
- org.eclipse.uml2.uml.Class result = findClassInModel((Model)ne, name);
- if(result != null)
+ } else if (ne instanceof Model) {
+ org.eclipse.uml2.uml.Class result = findClassInModel((Model) ne, name);
+ if (result != null) {
return result;
+ }
}
}
return null;
@@ -429,21 +439,24 @@ public class GeneralQueries {
* Find a class with a given name in a package.
*/
static public org.eclipse.uml2.uml.Class findClassInPackage(org.eclipse.uml2.uml.Package pack, String name) {
- for(Element ne : pack.getOwnedElements()) {
- if(ne instanceof NamedElement) {
- //System.out.println(((NamedElement) ne).getName());
- if(ne instanceof org.eclipse.uml2.uml.Class) {
- if(((org.eclipse.uml2.uml.Class)ne).getName().equals(name))
- return (org.eclipse.uml2.uml.Class)ne;
- } else if(ne instanceof org.eclipse.uml2.uml.Package) {
- org.eclipse.uml2.uml.Class result = findClassInPackage((org.eclipse.uml2.uml.Package)ne, name);
- if(result != null)
+ for (Element ne : pack.getOwnedElements()) {
+ if (ne instanceof NamedElement) {
+ // System.out.println(((NamedElement) ne).getName());
+ if (ne instanceof org.eclipse.uml2.uml.Class) {
+ if (((org.eclipse.uml2.uml.Class) ne).getName().equals(name)) {
+ return (org.eclipse.uml2.uml.Class) ne;
+ }
+ } else if (ne instanceof org.eclipse.uml2.uml.Package) {
+ org.eclipse.uml2.uml.Class result = findClassInPackage((org.eclipse.uml2.uml.Package) ne, name);
+ if (result != null) {
return result;
+ }
}
- } else if(ne instanceof Model) {
- org.eclipse.uml2.uml.Class result = findClassInModel((Model)ne, name);
- if(result != null)
+ } else if (ne instanceof Model) {
+ org.eclipse.uml2.uml.Class result = findClassInModel((Model) ne, name);
+ if (result != null) {
return result;
+ }
}
}
return null;
@@ -465,33 +478,33 @@ public class GeneralQueries {
java.lang.System.out.println("\t* super classes: " + cl.getSuperClasses());
// stereotypes of this class
- for(Stereotype st : cl.getAppliedStereotypes()) {
+ for (Stereotype st : cl.getAppliedStereotypes()) {
java.lang.System.out.println("\t* applied stereotype: " + st.getName());
}
// properties of this class
- for(Property prop : cl.getAllAttributes()) {
+ for (Property prop : cl.getAllAttributes()) {
java.lang.System.out.println("\t* property: " + prop.getName());
// This is a Port
- if(isPort(prop)) {
- inspectPort((Port)prop);
+ if (isPort(prop)) {
+ inspectPort((Port) prop);
} else {
Type propType = prop.getType();
- if(isDataType(propType)) {
+ if (isDataType(propType)) {
java.lang.System.out.println("\t\t* property read from stereotype: " + prop.getName());
- } else if(isClass(propType)) {
+ } else if (isClass(propType)) {
java.lang.System.out.println("\t\t* class sub instance : " + propType.getName() + " - " + prop.getUpper() + " - " + prop.getLower());
} else {
java.lang.System.err.println("UNKONWN PROPERTY TYPE !");
}
}
}
- for(Connector connector : cl.getOwnedConnectors()) {
+ for (Connector connector : cl.getOwnedConnectors()) {
java.lang.System.out.println("\t* owned connector: " + connector.getName());
- for(ConnectorEnd cend : connector.getEnds()) {
- if((cend.getRole() != null) && (cend.getPartWithPort() != null)) {
+ for (ConnectorEnd cend : connector.getEnds()) {
+ if ((cend.getRole() != null) && (cend.getPartWithPort() != null)) {
java.lang.System.out.println("\t\t* from property: " + cend.getRole().getName() + " in instance " + cend.getPartWithPort().getName());
} else {
java.lang.System.err.println("\t\t* Unconnected Port !");
@@ -499,7 +512,7 @@ public class GeneralQueries {
}
}
}
- for(Operation op : cl.getAllOperations()) {
+ for (Operation op : cl.getAllOperations()) {
java.lang.System.out.println("\t* operation: " + op.getName() + " - datatype: " + op.getDatatype() + " - interface: " + op.getInterface());
}
@@ -510,9 +523,9 @@ public class GeneralQueries {
* Debug function. Prints info about a given port.
*/
static public void inspectPort(Port port) {
- if(ArchitectureQueries.isDataFlowPort(port)) {
+ if (ArchitectureQueries.isDataFlowPort(port)) {
ArchitectureQueries.inspectDataFlowPort(port);
- } else if(ArchitectureQueries.isServicePort(port)) {
+ } else if (ArchitectureQueries.isServicePort(port)) {
ArchitectureQueries.inspectServicePort(port);
} else {
java.lang.System.err.println("UNKONWN PORT !");
@@ -521,7 +534,7 @@ public class GeneralQueries {
/**
* Fonction de test pour inspecter un mod�le UML2
- *
+ *
* @param model
* @return
*/
@@ -533,31 +546,31 @@ public class GeneralQueries {
//
// Bibliothèque de DataTypes sera importée
//
- for(PackageableElement elt : model.getImportedElements()) {
+ for (PackageableElement elt : model.getImportedElements()) {
java.lang.System.out.println("* model imported packageable element: " + elt);
}
//
// Peut-être ?
//
- for(org.eclipse.uml2.uml.Package elt : model.getImportedPackages()) {
+ for (org.eclipse.uml2.uml.Package elt : model.getImportedPackages()) {
java.lang.System.out.println("* model imported package: " + elt);
}
//
- // Récupérer Package par Package si possible (cf méthodologie Outil RobotML)
+ // Récupérer Package par Package si possible (cf méthodologie Outil RobotML)
//
- for(org.eclipse.uml2.uml.Package elt : model.getNestedPackages()) {
+ for (org.eclipse.uml2.uml.Package elt : model.getNestedPackages()) {
java.lang.System.out.println("* model nested package: " + elt);
}
//
// Parcours des éléments contenus dans le modèle
//
- for(NamedElement elt : model.getMembers()) {
+ for (NamedElement elt : model.getMembers()) {
java.lang.System.out.println("* model member: " + elt.getName());
- if(isClass(elt)) {
- inspectClass((org.eclipse.uml2.uml.Class)elt);
- } else if(isDataType(elt)) {
- inspectDataType((DataType)elt);
- } else if(isInterface(elt)) {
+ if (isClass(elt)) {
+ inspectClass((org.eclipse.uml2.uml.Class) elt);
+ } else if (isDataType(elt)) {
+ inspectDataType((DataType) elt);
+ } else if (isInterface(elt)) {
java.lang.System.out.println("\t* interface definition : " + elt.getName());
} else {
@@ -576,7 +589,7 @@ public class GeneralQueries {
/**
* String manipulation function :
* remove brackets from a string
- *
+ *
* @param str
* @return
*/
diff --git a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/MMQueries.java b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/MMQueries.java
index 7b052dad1eb..a43047cfbd7 100644
--- a/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/MMQueries.java
+++ b/extraplugins/robotml/generators/org.eclipse.papyrus.robotml.generators.common/src/org/eclipse/papyrus/robotml/generators/common/mmqueries/MMQueries.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
@@ -26,21 +26,21 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
/**
* Entry point of the 'MMQueries' generation module.
- *
+ *
* @generated
*/
public class MMQueries extends AbstractAcceleoGenerator {
/**
* The name of the module.
- *
+ *
* @generated
*/
public static final String MODULE_FILE_NAME = "MMQueries";
/**
* The name of the templates that are to be generated.
- *
+ *
* @generated
*/
public static final String[] TEMPLATE_NAMES = { "MMQueries", };
@@ -50,10 +50,9 @@ public class MMQueries extends AbstractAcceleoGenerator {
* this way cannot be used to launch generations before one of {@link #initialize(EObject, File, List)} or {@link #initialize(URI, File, List)} is
* called.
* <p>
- * The main reason for this constructor is to allow clients of this generation to call it from another Java file, as it allows for the retrieval
- * of {@link #getProperties()} and {@link #getGenerationListeners()}.
+ * The main reason for this constructor is to allow clients of this generation to call it from another Java file, as it allows for the retrieval of {@link #getProperties()} and {@link #getGenerationListeners()}.
* </p>
- *
+ *
* @generated
*/
public MMQueries() {
@@ -62,18 +61,18 @@ public class MMQueries extends AbstractAcceleoGenerator {
/**
* This allows clients to instantiates a generator with all required information.
- *
+ *
* @param modelURI
- * URI where the model on which this generator will be used is located.
+ * URI where the model on which this generator will be used is located.
* @param targetFolder
- * This will be used as the output folder for this generation : it will be the base path
- * against which all file block URLs will be resolved.
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
* @param arguments
- * If the template which will be called requires more than one argument taken from the model,
- * pass them here.
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
* @throws IOException
- * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
- * the model cannot be loaded.
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
* @generated
*/
public MMQueries(URI modelURI, File targetFolder, List<? extends Object> arguments) throws IOException {
@@ -82,18 +81,18 @@ public class MMQueries extends AbstractAcceleoGenerator {
/**
* This allows clients to instantiates a generator with all required information.
- *
+ *
* @param model
- * We'll iterate over the content of this element to find Objects matching the first parameter
- * of the template we need to call.
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
* @param targetFolder
- * This will be used as the output folder for this generation : it will be the base path
- * against which all file block URLs will be resolved.
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
* @param arguments
- * If the template which will be called requires more than one argument taken from the model,
- * pass them here.
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
* @throws IOException
- * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
* @generated
*/
public MMQueries(EObject model, File targetFolder, List<? extends Object> arguments) throws IOException {
@@ -102,20 +101,20 @@ public class MMQueries extends AbstractAcceleoGenerator {
/**
* This can be used to launch the generation from a standalone application.
- *
+ *
* @param args
- * Arguments of the generation.
+ * Arguments of the generation.
* @generated
*/
public static void main(String[] args) {
try {
- if(args.length < 2) {
+ if (args.length < 2) {
System.out.println("Arguments not valid : {model, folder}.");
} else {
URI modelURI = URI.createFileURI(args[0]);
File folder = new File(args[1]);
List<String> arguments = new ArrayList<String>();
- for(int i = 2; i < args.length; i++) {
+ for (int i = 2; i < args.length; i++) {
arguments.add(args[i]);
}
MMQueries generator = new MMQueries(modelURI, folder, arguments);
@@ -128,11 +127,11 @@ public class MMQueries extends AbstractAcceleoGenerator {
/**
* Launches the generation described by this instance.
- *
+ *
* @param monitor
- * This will be used to display progress information to the user.
+ * This will be used to display progress information to the user.
* @throws IOException
- * This will be thrown if any of the output files cannot be saved to disk.
+ * This will be thrown if any of the output files cannot be saved to disk.
* @generated
*/
@Override
@@ -146,7 +145,7 @@ public class MMQueries extends AbstractAcceleoGenerator {
/**
* If this generator needs to listen to text generation events, listeners can be returned from here.
- *
+ *
* @return List of listeners that are to be notified when text is generated through this launch.
* @generated
*/
@@ -160,23 +159,21 @@ public class MMQueries extends AbstractAcceleoGenerator {
/**
* If you need to change the way files are generated, this is your entry point.
* <p>
- * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates files on the fly. If you only need to
- * preview the results, return a new {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of the
- * running Eclipse and can be used standalone.
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates files on the fly. If you only need to preview the results, return a new {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of
+ * these aren't aware of the running Eclipse and can be used standalone.
* </p>
* <p>
- * If you need the file generation to be aware of the workspace (A typical example is when you wanna override files that are under clear case or
- * any other VCS that could forbid the overriding), then return a new
- * {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}. <b>Note</b>, however, that this <b>cannot</b> be used
- * standalone.
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna override files that are under clear case or any other VCS that could forbid the overriding), then return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}. <b>Note</b>, however, that this <b>cannot</b> be used standalone.
* </p>
* <p>
* All three of these default strategies support merging through JMerge.
* </p>
- *
+ *
* @return The generation strategy that is to be used for generations launched through this launcher.
* @generated
*/
+ @Override
public IAcceleoGenerationStrategy getGenerationStrategy() {
return super.getGenerationStrategy();
}
@@ -184,7 +181,7 @@ public class MMQueries extends AbstractAcceleoGenerator {
/**
* This will be called in order to find and load the module that will be launched through this launcher.
* We expect this name not to contain file extension, and the module to be located beside the launcher.
- *
+ *
* @return The name of the module that is to be launched.
* @generated
*/
@@ -198,11 +195,10 @@ public class MMQueries extends AbstractAcceleoGenerator {
* here.Take note that the first added properties files will take precedence over subsequent ones if they
* contain conflicting keys.
* <p>
- * Properties need to be in source folders, the path that we expect to get as a result of this call are of the form &lt;package>.&lt;properties
- * file name without extension>. For example, if you have a file named "messages.properties" in package "org.eclipse.acceleo.sample", the path
- * that needs be returned by a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of the form &lt;package>.&lt;properties file name without extension>. For example, if you have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be returned by a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
* </p>
- *
+ *
* @return The list of properties file we need to add to the generation context.
* @see java.util.ResourceBundle#getBundle(String)
* @generated
@@ -224,7 +220,7 @@ public class MMQueries extends AbstractAcceleoGenerator {
/**
* This will be used to get the list of templates that are to be launched by this launcher.
- *
+ *
* @return The list of templates to call on the module {@link #getModuleName()}.
* @generated
*/
@@ -235,9 +231,9 @@ public class MMQueries extends AbstractAcceleoGenerator {
/**
* This can be used to update the resource set's package registry with all needed EPackages.
- *
+ *
* @param resourceSet
- * The resource set which registry has to be updated.
+ * The resource set which registry has to be updated.
* @generated
*/
@Override
@@ -250,9 +246,9 @@ public class MMQueries extends AbstractAcceleoGenerator {
/**
* This can be used to update the resource set's resource factory registry with all needed factories.
- *
+ *
* @param resourceSet
- * The resource set which registry has to be updated.
+ * The resource set which registry has to be updated.
* @generated
*/
@Override

Back to the top