Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.emf.refactor.comrel.generator/templates/multifilter.javajet')
-rw-r--r--org.eclipse.emf.refactor.comrel.generator/templates/multifilter.javajet101
1 files changed, 101 insertions, 0 deletions
diff --git a/org.eclipse.emf.refactor.comrel.generator/templates/multifilter.javajet b/org.eclipse.emf.refactor.comrel.generator/templates/multifilter.javajet
new file mode 100644
index 0000000..6b73e71
--- /dev/null
+++ b/org.eclipse.emf.refactor.comrel.generator/templates/multifilter.javajet
@@ -0,0 +1,101 @@
+<%@ jet package="comrel.helper" class="MultiFilter"
+imports="comrel.generator.helper.*"%>
+<%HelperInfo helperInfo = (HelperInfo) argument; %>
+/**
+ * <copyright>
+ * </copyright>
+ */
+package <%=helperInfo.getPackageName()%>;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+
+import comrel.extensions.IMultiFilterHelper;
+import comrel.MultiInputPort;
+import comrel.MultiOutputPort;
+import comrel.ComrelFactory;
+
+/**
+ * Helper class for synchronizing ports in
+ * composite model refactorings specified in CoMReL.
+ * @generated
+ */
+public class <%=helperInfo.getClassName()%> implements IMultiFilterHelper {
+
+ final ComrelFactory factory = ComrelFactory.eINSTANCE;
+ private MultiInputPort <%=helperInfo.getInputTypeVariable() + "in"%>;
+ private MultiOutputPort <%=helperInfo.getOutputTypeVariable() + "out"%>;
+
+ /**
+ * Default constructor.
+ * @generated
+ */
+ public <%=helperInfo.getClassName()%>() {
+ initInputPort();
+ initOutputPort();
+ }
+
+ /**
+ * Method for setting the input port.
+ * @generated
+ */
+ private void initInputPort() {
+ <%=helperInfo.getInputTypeVariable() + "in"%> = factory.createMultiInputPort();
+ <%=helperInfo.getInputTypeVariable() + "in"%>.setName("<%=helperInfo.getInputTypeVariable() + "in"%>");
+ <%=helperInfo.getInputTypeVariable() + "in"%>.setType(<%=helperInfo.getInputType()%>.class);
+ }
+
+ /**
+ * Method for setting the output port.
+ * @generated
+ */
+ private void initOutputPort(){
+ <%=helperInfo.getOutputTypeVariable() + "out"%> = factory.createMultiOutputPort();
+ <%=helperInfo.getOutputTypeVariable() + "out"%>.setName("<%=helperInfo.getOutputTypeVariable() + "out"%>");
+ <%=helperInfo.getOutputTypeVariable() + "out"%>.setType(<%=helperInfo.getOutputType()%>.class);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public MultiInputPort getInputPort() {
+ return <%=helperInfo.getInputTypeVariable() + "in"%>;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public MultiOutputPort getOutputPort() {
+ return <%=helperInfo.getOutputTypeVariable() + "out"%>;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void run() {
+ EList<<%=helperInfo.getInputType()%>> in = setInput();
+ EList<<%=helperInfo.getOutputType()%>> out = new BasicEList<<%=helperInfo.getOutputType()%>>();
+
+ // TODO implement logic (fill 'out')
+
+ <%=helperInfo.getOutputTypeVariable() + "out"%>.getValue().addAll(out);
+ }
+
+ /**
+ * Helper method for extracting input to Java objects.
+ * @generated
+ */
+ private EList<<%=helperInfo.getInputType()%>> setInput() {
+ EList<Object> origin = <%=helperInfo.getInputTypeVariable() + "in"%>.getValue();
+ EList<<%=helperInfo.getInputType()%>> in = new BasicEList<<%=helperInfo.getInputType()%>>();
+ for (Object o : origin) {
+ in.add((<%=helperInfo.getInputType()%>) o);
+ }
+ return in;
+ }
+
+}
+ \ No newline at end of file

Back to the top