[416470] Delete conflicting overridden static methods
diff --git a/examples/org.eclipse.ocl.examples.interpreter/src/org/eclipse/ocl/examples/interpreter/console/OCLConsolePage.java b/examples/org.eclipse.ocl.examples.interpreter/src/org/eclipse/ocl/examples/interpreter/console/OCLConsolePage.java
index 63856cf..7afd3b4 100644
--- a/examples/org.eclipse.ocl.examples.interpreter/src/org/eclipse/ocl/examples/interpreter/console/OCLConsolePage.java
+++ b/examples/org.eclipse.ocl.examples.interpreter/src/org/eclipse/ocl/examples/interpreter/console/OCLConsolePage.java
@@ -143,10 +143,12 @@
public IItemLabelProvider tupleTypeLabelProvider = new IItemLabelProvider() {
+ @Override
public Object getImage(Object object) {
return null;
}
+ @Override
public String getText(Object object) {
@SuppressWarnings("unchecked")
Tuple<?, Object> tuple = (Tuple<?, Object>) object;
@@ -203,6 +205,7 @@
input.getTextWidget().addKeyListener(new InputKeyListener());
selectionListener = new ISelectionListener() {
+ @Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
OCLConsolePage.this.selectionChanged(selection);
}};
@@ -632,6 +635,7 @@
private List<String> history = new ArrayList<String>();
private int currentHistoryPointer = 0;
+ @Override
public void keyPressed(KeyEvent e) {
switch (e.keyCode) {
case SWT.CR :
@@ -671,6 +675,7 @@
}
}
+ @Override
public void keyReleased(KeyEvent e) {
switch (e.keyCode) {
case SWT.CR :
@@ -871,6 +876,7 @@
}
private class EcoreOCLFactory implements IOCLFactory<Object> {
+ @Override
public TargetMetamodel getTargetMetamodel() {
return TargetMetamodel.Ecore;
}
@@ -884,23 +890,27 @@
return new EcoreEnvironmentFactory(compositeRegistry);
}
+ @Override
@SuppressWarnings("unchecked")
public OCL<?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> createOCL(ModelingLevel level) {
EcoreEnvironmentFactory envFactory = createEnvironmentFactory();
- return OCL.newInstance(envFactory);
+ return OCL.newInstanceAbstract(envFactory);
}
+ @Override
@SuppressWarnings("unchecked")
public OCL<?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> createOCL(ModelingLevel level,
Resource res) {
EcoreEnvironmentFactory envFactory = createEnvironmentFactory();
- return OCL.newInstance(envFactory, res);
+ return OCL.newInstanceAbstract(envFactory, res);
}
+ @Override
public Object getContextClassifier(EObject object) {
return context.eClass();
}
+ @Override
public String getName(Object modelElement) {
return ((ENamedElement) modelElement).getName();
}
@@ -936,10 +946,12 @@
}
private class UMLOCLFactory implements IOCLFactory<Object> {
+ @Override
public TargetMetamodel getTargetMetamodel() {
return TargetMetamodel.UML;
}
+ @Override
@SuppressWarnings("unchecked")
public OCL<?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> createOCL(ModelingLevel level) {
UMLEnvironmentFactory factory = new UMLEnvironmentFactory(
@@ -949,7 +961,7 @@
context.eResource().getResourceSet());
- OCL<?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> result = OCL.newInstance(factory);
+ OCL<?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> result = OCL.newInstanceAbstract(factory);
switch (level) {
case M2:
@@ -967,6 +979,7 @@
return result;
}
+ @Override
@SuppressWarnings("unchecked")
public OCL<?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> createOCL(ModelingLevel level,
Resource res) {
@@ -977,7 +990,7 @@
EPackage.Registry.INSTANCE),
context.eResource().getResourceSet());
- OCL<?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> result = OCL.newInstance(factory, res);
+ OCL<?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> result = OCL.newInstanceAbstract(factory, res);
switch (level) {
case M2:
@@ -995,11 +1008,13 @@
return result;
}
+ @Override
public Object getContextClassifier(EObject object) {
return OCLUMLUtil.getClassifier(context.eClass(),
context.eResource().getResourceSet());
}
+ @Override
public String getName(Object modelElement) {
return ((NamedElement) modelElement).getName();
}
@@ -1034,6 +1049,7 @@
private List<IAction> actions = new java.util.ArrayList<IAction>();
private IPropertyChangeListener listener = new IPropertyChangeListener() {
+ @Override
public void propertyChange(PropertyChangeEvent event) {
if (IAction.CHECKED.equals(event.getProperty())) {
if (Boolean.TRUE.equals(event.getNewValue())) {
@@ -1062,6 +1078,7 @@
setText(action.getText());
}
+ @Override
public Menu getMenu(Control parent) {
if (menu == null) {
menu = new Menu(parent);
@@ -1079,12 +1096,14 @@
contrib.fill(m, -1);
}
+ @Override
public void dispose() {
if (menu != null) {
menu.dispose();
}
}
+ @Override
public Menu getMenu(Menu parent) {
return null;
}
diff --git a/examples/org.eclipse.ocl.examples.interpreter/src/org/eclipse/ocl/examples/interpreter/console/OCLResource.java b/examples/org.eclipse.ocl.examples.interpreter/src/org/eclipse/ocl/examples/interpreter/console/OCLResource.java
index f401aab..9539ff4 100644
--- a/examples/org.eclipse.ocl.examples.interpreter/src/org/eclipse/ocl/examples/interpreter/console/OCLResource.java
+++ b/examples/org.eclipse.ocl.examples.interpreter/src/org/eclipse/ocl/examples/interpreter/console/OCLResource.java
@@ -36,65 +36,65 @@
extends XMIResourceImpl {
private static Map<String, Object> saveOptions = new java.util.HashMap<String, Object>();
-
+
static {
saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true);
}
-
+
/**
* Initializes me with my URI.
- *
+ *
* @param uri my URI
*/
public OCLResource(URI uri) {
super(uri);
}
-
+
@Override
protected boolean useIDs() {
return true;
}
-
+
@Override
protected boolean useUUIDs() {
return true;
}
-
+
/**
* Loads an OCL expression from the specified <code>path</code>. The
* OCL expression is converted to a string using a custom AST visitor that
* renders the string representation.
- *
+ *
* @param path the absolute path of the XMI file to load
* @return the string representation of the OCL expression, if found
* @throws IOException if anything goes wrong in loading the XMI file
*/
public static String load(String path) throws IOException {
String result = null;
-
+
ResourceSet rset = new ResourceSetImpl();
-
+
// create and load the resource
OCLResource res = new OCLResource(URI.createFileURI(path));
rset.getResources().add(res);
-
+
res.load(Collections.EMPTY_MAP);
-
+
OCLExpression<Object> expr = res.getOCLExpression();
if (expr != null) {
- result = expr.accept(ToStringVisitor.getInstance(expr));
+ result = expr.accept(ToStringVisitor.getInstanceAbstract(expr));
}
-
+
return result;
}
-
+
/**
* Saves the specified OCL expression to an XMI file.
- *
+ *
* @param path the fully-qualified path of the XMI file to save
* @param document the current OCL document
* @param expression the expression to save
- *
+ *
* @throws RuntimeException if anything goes wrong in parsing
* @throws IOException if anything goes wrong in saving
* @throws ParserException if anything goes wrong in parsing
@@ -102,18 +102,18 @@
public static void save(String path, OCLDocument document, String expression)
throws IOException, ParserException {
final OCLResource res = new OCLResource(URI.createFileURI(path));
-
+
// create an OCL helper to do our parsing
OCL<?, Object, ?, ?, ?, ?, ?, ?, ?, Object, ?, ?> ocl =
document.getOCLFactory().createOCL(document.getModelingLevel(), res);
OCLHelper<Object, ?, ?, Object> helper = ocl.createOCLHelper();
-
+
// set our helper's context classifier to parse against it
ConstraintKind kind = document.getModelingLevel().setContext(
helper, document.getOCLContext(), document.getOCLFactory());
-
+
OCLExpression<Object> parsed = null;
-
+
switch (document.getModelingLevel()) {
case M2:
parsed = helper.createQuery(expression);
@@ -124,16 +124,16 @@
constraint).getBodyExpression();
break;
}
-
+
// add the AST to the resource and save it
res.setOCLExpression(parsed);
-
+
res.save(saveOptions);
}
-
+
/**
* Sets my contents to the specified OCL expression.
- *
+ *
* @param expr an OCL expression
*/
public void setOCLExpression(OCLExpression<Object> expr) {
@@ -141,20 +141,20 @@
// variables and EPackages defining dynamically-generated types
getContents().add(0, expr);
}
-
+
/**
* Obtains the OCL expression that I store.
- *
+ *
* @return my OCL expression
*/
@SuppressWarnings("unchecked")
public OCLExpression<Object> getOCLExpression() {
OCLExpression<Object> result = null;
-
+
if (!getContents().isEmpty()) {
result = (OCLExpression<Object>) getContents().get(0);
}
-
+
return result;
}
}
diff --git a/examples/org.eclipse.ocl.examples.interpreter/src/org/eclipse/ocl/examples/interpreter/delegate/OCLQueryDelegateTextViewer.java b/examples/org.eclipse.ocl.examples.interpreter/src/org/eclipse/ocl/examples/interpreter/delegate/OCLQueryDelegateTextViewer.java
index 3e52b89..2f05b79 100644
--- a/examples/org.eclipse.ocl.examples.interpreter/src/org/eclipse/ocl/examples/interpreter/delegate/OCLQueryDelegateTextViewer.java
+++ b/examples/org.eclipse.ocl.examples.interpreter/src/org/eclipse/ocl/examples/interpreter/delegate/OCLQueryDelegateTextViewer.java
@@ -4,8 +4,8 @@
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Kenn Hussey - Initial API and implementation
*******************************************************************************/
package org.eclipse.ocl.examples.interpreter.delegate;
@@ -43,29 +43,34 @@
private class EcoreOCLFactory
implements IOCLFactory<Object> {
+ @Override
public TargetMetamodel getTargetMetamodel() {
return TargetMetamodel.Ecore;
}
+ @Override
@SuppressWarnings("unchecked")
public OCL<?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> createOCL(
ModelingLevel level) {
- return OCL.newInstance(new EcoreEnvironmentFactory(
+ return OCL.newInstanceAbstract(new EcoreEnvironmentFactory(
EPackage.Registry.INSTANCE));
}
+ @Override
@SuppressWarnings("unchecked")
public OCL<?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> createOCL(
ModelingLevel level, Resource res) {
- return OCL.newInstance(new EcoreEnvironmentFactory(
+ return OCL.newInstanceAbstract(new EcoreEnvironmentFactory(
EPackage.Registry.INSTANCE), res);
}
+ @Override
public Object getContextClassifier(EObject object) {
return context.eClass();
}
+ @Override
public String getName(Object modelElement) {
return ((ENamedElement) modelElement).getName();
}
@@ -75,15 +80,18 @@
super(parent, new ColorManager(), styles);
}
+ @Override
public void setContext(EClassifier context) {
((OCLDocument) getDocument()).setOCLContext(this.context = context);
}
+ @Override
public void setParameters(Map<String, EClassifier> parameters) {
((OCLDocument) getDocument())
.setOCLParameters(this.parameters = parameters);
}
+ @Override
public void setDocument(IDocument document) {
if (document != null) {
diff --git a/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/CallExpImpl.java b/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/CallExpImpl.java
index d4e520a..9ce5dd3 100644
--- a/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/CallExpImpl.java
+++ b/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/CallExpImpl.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
- *
+ *
* Contributors:
* IBM - Initial API and implementation
* Zeligsoft - Bug 207365, 207365
@@ -379,7 +379,7 @@
}
return this.<String, Visitor<String, ?, ?, ?, ?, ?, ?, ?, ?, ?>> accept(
- ToStringVisitor.getInstance(this));
+ ToStringVisitor.getInstanceAbstract(this));
}
} //CallExpImpl
diff --git a/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/FeatureCallExpImpl.java b/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/FeatureCallExpImpl.java
index 2acd718..062353e 100644
--- a/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/FeatureCallExpImpl.java
+++ b/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/FeatureCallExpImpl.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
- *
+ *
* Contributors:
* IBM - Initial API and implementation
* Zeligsoft - Bug 207365
@@ -212,7 +212,7 @@
}
return this.<String, Visitor<String, ?, ?, ?, ?, ?, ?, ?, ?, ?>> accept(
- ToStringVisitor.getInstance(this));
+ ToStringVisitor.getInstanceAbstract(this));
}
} //FeatureCallExpImpl
diff --git a/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/OCLExpressionImpl.java b/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/OCLExpressionImpl.java
index a8df411..a9edd57 100644
--- a/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/OCLExpressionImpl.java
+++ b/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/OCLExpressionImpl.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
- *
+ *
* Contributors:
* IBM - Initial API and implementation
* Zeligsoft - Bug 207365
@@ -12,6 +12,7 @@
package org.eclipse.ocl.uml.impl;
import java.util.Map;
+
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.ecore.EClass;
@@ -311,7 +312,7 @@
}
return this.<String, Visitor<String, ?, ?, ?, ?, ?, ?, ?, ?, ?>> accept(
- ToStringVisitor.getInstance(this));
+ ToStringVisitor.getInstanceAbstract(this));
}
/**
diff --git a/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/TupleLiteralPartImpl.java b/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/TupleLiteralPartImpl.java
index 9606d62..0ad9727 100644
--- a/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/TupleLiteralPartImpl.java
+++ b/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/TupleLiteralPartImpl.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
- *
+ *
* Contributors:
* IBM - Initial API and implementation
* Zeligsoft - Bug 207365
@@ -634,7 +634,7 @@
return super.toString();
}
- return accept(ToStringVisitor.getInstance(this));
+ return accept(ToStringVisitor.getInstanceAbstract(this));
}
/**
diff --git a/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/VariableImpl.java b/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/VariableImpl.java
index 0172e31..56937dc 100644
--- a/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/VariableImpl.java
+++ b/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/VariableImpl.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
- *
+ *
* Contributors:
* IBM - Initial API and implementation
* Zeligsoft - Bug 207365
@@ -638,7 +638,7 @@
return super.toString();
}
- return accept(ToStringVisitor.getInstance(this));
+ return accept(ToStringVisitor.getInstanceAbstract(this));
}
/**
diff --git a/plugins/org.eclipse.ocl/.settings/.api_filters b/plugins/org.eclipse.ocl/.settings/.api_filters
index 4446d3f..5cae8e3 100644
--- a/plugins/org.eclipse.ocl/.settings/.api_filters
+++ b/plugins/org.eclipse.ocl/.settings/.api_filters
@@ -8,6 +8,26 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/ocl/OCL.java" type="org.eclipse.ocl.OCL">
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.ocl.OCL"/>
+ <message_argument value="newInstance(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.ocl.OCL"/>
+ <message_argument value="newInstance(EnvironmentFactory<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.ocl.OCL"/>
+ <message_argument value="newInstance(EnvironmentFactory<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>, Resource)"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/ocl/parser/OCLKWLexerprs.java" type="org.eclipse.ocl.parser.OCLKWLexerprs">
<filter comment="Bug 512402 workaround" id="576725006">
<message_arguments>
@@ -56,4 +76,12 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/ocl/util/ToStringVisitor.java" type="org.eclipse.ocl.util.ToStringVisitor">
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.ocl.util.ToStringVisitor"/>
+ <message_argument value="getInstance(TypedElement<C>)"/>
+ </message_arguments>
+ </filter>
+ </resource>
</component>
diff --git a/plugins/org.eclipse.ocl/src/org/eclipse/ocl/OCL.java b/plugins/org.eclipse.ocl/src/org/eclipse/ocl/OCL.java
index 2695e23..bb61432 100644
--- a/plugins/org.eclipse.ocl/src/org/eclipse/ocl/OCL.java
+++ b/plugins/org.eclipse.ocl/src/org/eclipse/ocl/OCL.java
@@ -7,7 +7,7 @@
*
* Contributors:
* IBM - Initial API and implementation
- * E.D.Willink - Refactoring to support extensibility and flexible error handling
+ * E.D.Willink - Refactoring to support extensibility and flexible error handling
* Zeligsoft - Bug 251349
* E.D.Willink - Bug 259818
* Radek Dvorak - Bug 261128
@@ -58,7 +58,7 @@
* Providers of OCL bindings for metamodels may extend this class for the
* convenience of their clients, to specify the type parameter substitutions.
* </p>
- *
+ *
* @author Christian W. Damus (cdamus)
*/
public class OCL<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> {
@@ -74,7 +74,7 @@
private List<CT> constraints = new java.util.ArrayList<CT>();
private Diagnostic problems;
- private Diagnostic evaluationProblems;
+ private Diagnostic evaluationProblems;
private int parserRepairCount = 0;
@@ -87,7 +87,7 @@
/**
* Initializes me with an environment factory, which I will use to create a
* root environment.
- *
+ *
* @param envFactory
* my environment factory
*/
@@ -98,7 +98,7 @@
/**
* Initializes me with a root environment.
- *
+ *
* @param env
* my root environment
*/
@@ -110,7 +110,7 @@
* Initializes me with an environment factory and a resource in which my
* environment is to be persisted, or from which it may be loaded if the
* resource already has content.
- *
+ *
* @param envFactory
* an environment factory
* @param resource
@@ -124,7 +124,7 @@
/**
* Initializes me with my environment factory and root environment.
- *
+ *
* @param envFactory
* my environment factory
* @param rootEnv
@@ -146,12 +146,13 @@
/**
* Creates a new <code>OCL</code> with an environment factory, which it will
* use to create a root environment.
- *
+ *
* @param envFactory
* an environment factory
* @return the OCL façade
+ * @since 6.22
*/
- public static <PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> OCL<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> newInstance(
+ public static <PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> OCL<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> newInstanceAbstract(
EnvironmentFactory<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> envFactory) {
return new OCL<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E>(envFactory);
@@ -159,12 +160,13 @@
/**
* Creates a new <code>OCL</code> on the specified root environment.
- *
+ *
* @param env
* the root environment
* @return the OCL façade
+ * @since 6.22
*/
- public static <PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> OCL<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> newInstance(
+ public static <PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> OCL<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> newInstanceAbstract(
Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> env) {
return new OCL<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E>(env);
@@ -174,14 +176,15 @@
* Creates a new <code>OCL</code> with an environment factory and a resource
* in which its environment is to be persisted, or from which it may be
* loaded if the resource already has content.
- *
+ *
* @param envFactory
* an environment factory
* @param resource
* a resource in which the root environment is persisted
* @return the OCL façade
+ * @since 6.22
*/
- public static <PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> OCL<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> newInstance(
+ public static <PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> OCL<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> newInstanceAbstract(
EnvironmentFactory<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> envFactory,
Resource resource) {
@@ -195,9 +198,9 @@
* it to define "global" values. For any variables that are added, bindings
* will have to provided, as well, in the
* {@linkplain #getEvaluationEnvironment() evaluation environment}.
- *
+ *
* @return the parsing environment
- *
+ *
* @see #getEvaluationEnvironment()
*/
public Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> getEnvironment() {
@@ -208,9 +211,9 @@
* Obtains the OCL evaluation environment. Clients may manipulate this
* environment to support custom requirements, such as binding the values of
* "global" variables.
- *
+ *
* @return the evaluation environment
- *
+ *
* @see #getEnvironment()
*/
public EvaluationEnvironment<C, O, P, CLS, E> getEvaluationEnvironment() {
@@ -224,7 +227,7 @@
/**
* Obtains the extent map, if any, provided by the client to customize the
* evaluation of constraints.
- *
+ *
* @return the client-provided custom extent map, or <code>null</code> if
* thie OCL is using the default dynamic extent map implementation
*/
@@ -236,7 +239,7 @@
* Assigns a custom extent map to define the extents of classes in
* evaluation of OCL constraints. This is only needed if the default dynamic
* extent-map implementation is not suitable.
- *
+ *
* @param extentMap
* a custom extent map, or <code>null</code> to use the default
* dynamic extent map implementation
@@ -247,7 +250,7 @@
/**
* Return an analyzer configured ready to parse an input string.
- *
+ *
* @param input the input to parse
* @return an analyzer
* @since 3.0
@@ -271,15 +274,15 @@
* Parses an OCL document, returning the constraints parsed from it. This
* <code>OCL</code> instance remembers these constraints; they can be
* retrieved later via the {@link #getConstraints()} method.
- *
+ *
* @param input
* an OCL document as either a string or a stream
* @return the constraints parsed from the document
- *
+ *
* @throws ParserException
* on failure to parse, either because of a syntactic or
* semantic problem or because of an I/O failure
- *
+ *
* @see #getConstraints()
*/
public List<CT> parse(OCLInput input)
@@ -327,9 +330,9 @@
/**
* Obtains all of the constraints parsed hitherto by this OCL instance.
* These accumulate with every document that is parsed.
- *
+ *
* @return the constraints that I have parsed
- *
+ *
* @see #parse(OCLInput)
*/
public List<CT> getConstraints() {
@@ -340,13 +343,13 @@
* Validates an OCL expression, which may have been loaded from some
* resource or constructed via the API (perhaps by translation from some
* other language).
- *
+ *
* @param expression
* an expression to validate
- *
+ *
* @throws SemanticException
* on detection of any well-formedness problem in the expression
- *
+ *
* @see #validate(Object)
*/
public void validate(OCLExpression<C> expression)
@@ -376,10 +379,10 @@
* Validates an OCL constraint, which may have been loaded from some
* resource or constructed via the API (perhaps by translation from some
* other language).
- *
+ *
* @param constraint
* a constraint to validate
- *
+ *
* @throws SemanticException
* on detection of any well-formedness problem in the constraint
*/
@@ -412,21 +415,21 @@
* <tt>self</tt> variable). Clients should use the
* {@link #isInvalid(Object)} method to check whether the evaluation result
* is <tt>OclInvalid</tt>.
- *
+ *
* @param context
* the context (self) object
* @param expression
* the OCL expression to evaluate
- *
+ *
* @return the value of the expression, or <tt>OclInvalid</tt> if the
* evaluation fails for reasons other than a run-time exception
- *
+ *
* @see #isInvalid(Object)
* @see #check(Object, Object)
*/
public Object evaluate(Object context, OCLExpression<C> expression) {
evaluationProblems = null;
-
+
// can determine a more appropriate context from the context
// variable of the expression, to account for stereotype constraints
context = HelperUtil.getConstraintContext(rootEnvironment, context,
@@ -462,12 +465,12 @@
* Queries whether a value is the special <tt>invalid</tt> token. This is
* useful for determining whether the result of an expression evaluation is
* valid.
- *
+ *
* @param value
* some OCL value
* @return <code>true</code> if it is the <tt>invalid</tt>;
* <code>false</code>, otherwise
- *
+ *
* @see #evaluate(Object, OCLExpression)
*/
public boolean isInvalid(Object value) {
@@ -480,14 +483,14 @@
* required. If it is an operation precondition or postcondition, however,
* then the appropriate parameter variables and (in the postcondition case)
* result variable should be bound in the evaluation environment.
- *
+ *
* @param context
* the <tt>self</tt> object of the constraint
* @param constraint
* the constraint to check
- *
+ *
* @return whether the context object satisfies the constraint
- *
+ *
* @see #check(Object, OCLExpression)
* @see #evaluate(Object, OCLExpression)
*/
@@ -505,18 +508,18 @@
* precondition or postcondition, however, then the appropriate parameter
* variables and (in the postcondition case) result variable should be bound
* in the evaluation environment.
- *
+ *
* @param context
* the <tt>self</tt> object of the constraint
* @param constraint
* the constraint to check, which must be a boolean-valued
* expression
- *
+ *
* @return whether the context object satisfies the constraint
- *
+ *
* @see #check(Object, Object)
* @see #evaluate(Object, OCLExpression)
- *
+ *
* @throws IllegalArgumentException
* if the constraint expression is not boolean-valued
*/
@@ -537,7 +540,7 @@
* helper is particulary useful for parsing constraints embedded in the
* model, in which case the context of a constraint is determined by its
* placement and the textual context declarations are unnecessary.
- *
+ *
* @return a new helper object
*/
public OCLHelper<C, O, P, CT> createOCLHelper() {
@@ -554,13 +557,13 @@
* concurrent evaluation (where this may be safe in an EMF-based model) and
* different bindings for client-supplied "global" variables.
* </p>
- *
+ *
* @param query
* the OCL query expression, which may be interpreted as a
* constraint if it is boolean-valued
- *
+ *
* @return the new query object
- *
+ *
* @see #createQuery(Object)
*/
public Query<C, CLS, E> createQuery(OCLExpression<C> query) {
@@ -577,12 +580,12 @@
* concurrent evaluation (where this may be safe in an EMF-based model) and
* different bindings for client-supplied "global" variables.
* </p>
- *
+ *
* @param constraint
* the OCL constraint
- *
+ *
* @return the new query object
- *
+ *
* @see #createQuery(OCLExpression)
*/
public Query<C, CLS, E> createQuery(CT constraint) {
@@ -598,9 +601,9 @@
* In an Eclipse environment, tracing is also enabled by turning on the
* <tt>org.eclipse.ocl/debug/parsing</tt> debug option.
* </p>
- *
+ *
* @return whether parse tracing is enabled
- *
+ *
* @see #setParseTracingEnabled(boolean)
*/
public boolean isParseTracingEnabled() {
@@ -614,9 +617,9 @@
* In an Eclipse environment, tracing is also enabled by turning on the
* <tt>org.eclipse.ocl/debug/parsing</tt> debug option.
* </p>
- *
+ *
* param b whether parsing tracing is enabled
- *
+ *
* @see #isParseTracingEnabled()
*/
public void setParseTracingEnabled(boolean b) {
@@ -635,9 +638,9 @@
* A non-zero value selects the backtracking parser. The backtracking parser
* may be about three times slower.
* </p>
- *
+ *
* @return the number of repairs to be attempted
- *
+ *
* @see #setParserRepairCount(int)
* @since 1.3
*/
@@ -657,13 +660,13 @@
* A non-zero value selects the backtracking parser. The backtracking parser
* may be about three times slower.
* </p>
- *
+ *
* @param parserRepairCount
* whether evaluation tracing is enabled
- *
+ *
* @throws IllegalArgumentException
* if the <tt>parserRepairCount</tt> is negative
- *
+ *
* @see #getParserRepairCount()
* @since 1.3
*/
@@ -683,9 +686,9 @@
* In an Eclipse environment, tracing is also enabled by turning on the
* <tt>org.eclipse.ocl/debug/evaluation</tt> debug option.
* </p>
- *
+ *
* @return whether evaluation tracing is enabled
- *
+ *
* @see #setEvaluationTracingEnabled(boolean)
*/
public boolean isEvaluationTracingEnabled() {
@@ -699,10 +702,10 @@
* In an Eclipse environment, tracing is also enabled by turning on the
* <tt>org.eclipse.ocl/debug/evaluation</tt> debug option.
* </p>
- *
+ *
* @param b
* whether evaluation tracing is enabled
- *
+ *
* @see #isEvaluationTracingEnabled()
*/
public void setEvaluationTracingEnabled(boolean b) {
@@ -718,9 +721,9 @@
/**
* Obtains problems, if any, found in parsing the last OCL constraint or
* query expression.
- *
+ *
* @return parsing problems or <code>null</code> if all was OK
- *
+ *
* @since 1.2
*/
public Diagnostic getProblems() {
@@ -730,9 +733,9 @@
/**
* Obtains problems, if any, occurred during evaluation of the last OCL
* constraint or query expression.
- *
+ *
* @return evaluation problems or <code>null</code> if all was OK
- *
+ *
* @since 1.3
*/
public Diagnostic getEvaluationProblems() {
@@ -744,7 +747,7 @@
* includes disposing of any {@link #getConstraints() constraints} that I
* have parsed and {@linkplain Environment.Internal#dispose() disposing} of
* my environment.
- *
+ *
* @since 1.2
*/
public void dispose() {
diff --git a/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/OCLExpressionImpl.java b/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/OCLExpressionImpl.java
index 196ed21..af21c36 100644
--- a/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/OCLExpressionImpl.java
+++ b/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/OCLExpressionImpl.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
- *
+ *
* Contributors:
* IBM - Initial API and implementation
* Zeligsoft - Bug 207365, 207365
@@ -17,7 +17,6 @@
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.ocl.expressions.ExpressionsPackage;
import org.eclipse.ocl.expressions.OCLExpression;
-
//import org.eclipse.ocl.expressions.operations.OCLExpressionOperations;
import org.eclipse.ocl.util.ToStringVisitor;
import org.eclipse.ocl.utilities.ASTNode;
@@ -331,7 +330,7 @@
}
return this.<String, Visitor<String, ?, ?, ?, ?, ?, ?, ?, ?, ?>> accept(
- ToStringVisitor.getInstance(this));
+ ToStringVisitor.getInstanceAbstract(this));
}
} //OCLExpressionImpl
diff --git a/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/TupleLiteralPartImpl.java b/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/TupleLiteralPartImpl.java
index 0c398c7..5bde6ed 100644
--- a/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/TupleLiteralPartImpl.java
+++ b/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/TupleLiteralPartImpl.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
- *
+ *
* Contributors:
* IBM - Initial API and implementation
* Zeligsoft - Bug 207365
@@ -12,6 +12,7 @@
package org.eclipse.ocl.expressions.impl;
import java.util.Map;
+
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.DiagnosticChain;
@@ -636,7 +637,7 @@
if (eIsProxy()) {
return super.toString();
}
- return accept(ToStringVisitor.getInstance(this));
+ return accept(ToStringVisitor.getInstanceAbstract(this));
}
} //TupleLiteralPartImpl
diff --git a/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/VariableImpl.java b/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/VariableImpl.java
index 9a27fb0..ac7d74b 100644
--- a/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/VariableImpl.java
+++ b/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/VariableImpl.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
- *
+ *
* Contributors:
* IBM - Initial API and implementation
* Zeligsoft - Bug 207365
@@ -12,6 +12,7 @@
package org.eclipse.ocl.expressions.impl;
import java.util.Map;
+
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.DiagnosticChain;
@@ -636,7 +637,7 @@
return super.toString();
}
- return accept(ToStringVisitor.getInstance(this));
+ return accept(ToStringVisitor.getInstanceAbstract(this));
}
} //VariableImpl
diff --git a/plugins/org.eclipse.ocl/src/org/eclipse/ocl/util/ToStringVisitor.java b/plugins/org.eclipse.ocl/src/org/eclipse/ocl/util/ToStringVisitor.java
index 04333f5..6b6ab1a 100644
--- a/plugins/org.eclipse.ocl/src/org/eclipse/ocl/util/ToStringVisitor.java
+++ b/plugins/org.eclipse.ocl/src/org/eclipse/ocl/util/ToStringVisitor.java
@@ -58,7 +58,7 @@
/**
* Converts an OCL expression to a string for debugging. This is not intended
* to be used by client applications as an AST-to-text transformation.
- *
+ *
* @author Edith Schonberg (edith)
* @author Christian W. Damus (cdamus)
* @author Edward Willink (ewillink)
@@ -69,7 +69,7 @@
private final Environment<?, C, O, P, EL, PM, S, COA, SSA, CT, ?, ?> env;
private final UMLReflection<?, C, O, P, EL, PM, S, COA, SSA, CT> uml;
-
+
/**
* Indicates where a required element in the AST was <code>null</code>, so
* that it is evident in the debugger that something was missing. We don't
@@ -80,50 +80,51 @@
/**
* Initializes me with my environment.
- *
+ *
* @param env my environment
*/
protected ToStringVisitor(Environment<?, C, O, P, EL, PM, S, COA, SSA, CT, ?, ?> env) {
this.env = env;
this.uml = (env == null)? null : env.getUMLReflection();
}
-
+
/**
* Obtains an instance of the <tt>toString()</tt> visitor for the specified
* environment.
- *
+ *
* @param env an OCL environment
- *
+ *
* @return the corresponding instance
*/
public static <C, O, P, EL, PM, S, COA, SSA, CT>
ToStringVisitor<C, O, P, EL, PM, S, COA, SSA, CT> getInstance(
Environment<?, C, O, P, EL, PM, S, COA, SSA, CT, ?, ?> env) {
-
+
return new ToStringVisitor<C, O, P, EL, PM, S, COA, SSA, CT>(env);
}
-
+
/**
* Obtains an instance of the <tt>toString()</tt> visitor for the specified
* expression or other typed element.
- *
+ *
* @param element an OCL expression or other typed element such as a variable
- *
+ *
* @return the corresponding instance
+ * @since 6.22
*/
@SuppressWarnings("unchecked")
public static <C, O, P, EL, PM, S, COA, SSA, CT>
- ToStringVisitor<C, O, P, EL, PM, S, COA, SSA, CT> getInstance(
+ ToStringVisitor<C, O, P, EL, PM, S, COA, SSA, CT> getInstanceAbstract(
TypedElement<C> element) {
-
+
return new ToStringVisitor<C, O, P, EL, PM, S, COA, SSA, CT>(
(Environment<?, C, O, P, EL, PM, S, COA, SSA, CT, ?, ?>)
Environment.Registry.INSTANCE.getEnvironmentFor(element));
}
-
+
/**
* Null-safe access to the name of a named element.
- *
+ *
* @param named a named element or <code>null</code>
* @return a name, or the null placeholder if the named element or its name
* be <code>null</code>. i.e., <code>null</code> is never returned
@@ -131,10 +132,10 @@
protected String getName(Object named) {
return (uml == null)? NULL_PLACEHOLDER : uml.getName(named);
}
-
+
/**
* Null-safe access to the qualified name of a named element.
- *
+ *
* @param named a named element or <code>null</code>
* @return a qualified name, or the null placeholder if the named element
* or its name be <code>null</code>. i.e., <code>null</code> is never
@@ -146,7 +147,7 @@
/**
* Callback for an OperationCallExp visit.
- *
+ *
* Look at the source to determine operator ( -> or . )
* @param oc the operation call expression
* @return string
@@ -154,16 +155,16 @@
@Override
protected String handleOperationCallExp(OperationCallExp<C,O> oc,
String sourceResult, List<String> argumentResults) {
-
+
OCLExpression<C> source = oc.getSource();
C sourceType = source != null ? source.getType() : null;
O oper = oc.getReferredOperation();
-
+
StringBuilder result = new StringBuilder();
result.append(sourceResult);
result.append(sourceType instanceof CollectionType<?, ?> ? "->" : "."); //$NON-NLS-1$ //$NON-NLS-2$
result.append(getName(oper));
-
+
result.append('(');
for (Iterator<String> iter = argumentResults.iterator(); iter.hasNext();) {
result.append(iter.next());
@@ -172,12 +173,12 @@
}
}
result.append(')');
-
+
return maybeAtPre(oc, result.toString());
}
/**
- * Callback for an EnumLiteralExp visit.
+ * Callback for an EnumLiteralExp visit.
* @param el the enumeration literal expresion
* @return the enumeration literal toString()
*/
@@ -196,16 +197,16 @@
public String visitVariableExp(VariableExp<C, PM> v) {
Variable<C, PM> vd = v.getReferredVariable();
String result = (vd == null) ? null : vd.getName();
-
+
if (result == null) {
result = NULL_PLACEHOLDER;
}
-
+
return result;
}
/**
- * Callback for an AssociationEndCallExp visit.
+ * Callback for an AssociationEndCallExp visit.
* @param pc the property call expression
* @return string source.ref
*/
@@ -219,29 +220,29 @@
// we just return our name, because our source is null (implied)
return getName(property);
}
-
+
StringBuilder result = new StringBuilder(
maybeAtPre(pc, sourceResult + "." + getName(property)));//$NON-NLS-1$
-
+
if (!qualifierResults.isEmpty()) {
result.append('[');
-
+
for (Iterator<String> iter = qualifierResults.iterator(); iter.hasNext();) {
result.append(iter.next());
-
+
if (iter.hasNext()) {
result.append(", "); //$NON-NLS-1$
}
}
-
+
result.append(']');
}
-
+
return result.toString();
}
/**
- * Callback for an AssociationClassCallExp visit.
+ * Callback for an AssociationClassCallExp visit.
* @param ac the association class expression
* @return string source.ref
*/
@@ -252,22 +253,22 @@
C ref = ac.getReferredAssociationClass();
String name = initialLower(getName(ref));
-
+
StringBuilder result = new StringBuilder(
maybeAtPre(ac, sourceResult + "." + name));//$NON-NLS-1$
-
+
if (!qualifierResults.isEmpty()) {
result.append('[').append(qualifierResults.get(0)).append(']');
}
-
+
return result.toString();
}
-
+
protected String initialLower(String name) {
if (name == null || name.length() == 0) {
return name;
}
-
+
StringBuilder result = new StringBuilder(name);
result.setCharAt(0, Character.toLowerCase(result.charAt(0)));
return result.toString();
@@ -281,22 +282,22 @@
@Override
protected String handleVariable(Variable<C,PM> vd, String initResult) {
String varName = vd.getName();
-
+
if (varName == null) {
varName = NULL_PLACEHOLDER;
}
-
+
C type = vd.getType();
String result = varName;
if (type != null) {
result += " : " + getName(type);//$NON-NLS-1$
}
-
+
if (initResult != null) {
result += " = " + initResult;//$NON-NLS-1$
}
-
+
return result;
}
@@ -308,12 +309,12 @@
@Override
protected String handleIfExp(IfExp<C> ifExp, String conditionResult, String thenResult, String elseResult) {
StringBuilder result = new StringBuilder();
-
+
result.append("if ").append(conditionResult); //$NON-NLS-1$
result.append(" then ").append(thenResult); //$NON-NLS-1$
result.append(" else ").append(elseResult); //$NON-NLS-1$
result.append(" endif"); //$NON-NLS-1$
-
+
return result.toString();
}
@@ -321,7 +322,7 @@
public String visitTypeExp(TypeExp<C> t) {
return getQualifiedName(t.getReferredType());
}
-
+
@Override
public String visitStateExp(StateExp<C, S> s) {
return getName(s);
@@ -345,8 +346,8 @@
}
/**
- * Callback for an IntegerLiteralExp visit.
- * @param il -- integer literal expression
+ * Callback for an IntegerLiteralExp visit.
+ * @param il -- integer literal expression
* @return String
*/
@Override
@@ -354,10 +355,10 @@
return (il.getLongSymbol() == null)? NULL_PLACEHOLDER
: il.getLongSymbol().toString();
}
-
+
/**
- * Callback for an UnlimitedNaturalLiteralExp visit.
- * @param unl -- unlimited natural literal expression
+ * Callback for an UnlimitedNaturalLiteralExp visit.
+ * @param unl -- unlimited natural literal expression
* @return String
*/
@Override
@@ -365,11 +366,11 @@
if (unl.isUnlimited()) {
return "*"; //$NON-NLS-1$
}
-
+
return (unl.getIntegerSymbol() == null)? NULL_PLACEHOLDER
: unl.getIntegerSymbol().toString();
}
-
+
/**
* Callback for a RealLiteralExp visit.
@@ -412,11 +413,11 @@
@Override
protected String handleLetExp(LetExp<C,PM> letExp, String variableResult,
String inResult) {
-
+
StringBuilder result = new StringBuilder();
result.append("let ").append(variableResult); //$NON-NLS-1$
result.append(" in ").append(inResult); //$NON-NLS-1$
-
+
return result.toString();
}
@@ -430,18 +431,18 @@
protected String handleIterateExp(IterateExp<C,PM> callExp,
String sourceResult, List<String> variableResults,
String resultResult, String bodyResult) {
-
+
StringBuilder result = new StringBuilder();
-
+
result.append(sourceResult).append("->iterate("); //$NON-NLS-1$
-
+
for (Iterator<String> iter = variableResults.iterator(); iter.hasNext();) {
result.append(iter.next());
if (iter.hasNext()) {
result.append(", ");//$NON-NLS-1$
}
}
-
+
result.append("; ").append(resultResult).append(" | ");//$NON-NLS-2$//$NON-NLS-1$
result.append(bodyResult).append(')');
@@ -457,19 +458,19 @@
@Override
protected String handleIteratorExp(IteratorExp<C,PM> callExp,
String sourceResult, List<String> variableResults, String bodyResult) {
-
+
StringBuilder result = new StringBuilder();
String name = callExp.getName();
result.append(sourceResult).append("->").append(name).append('('); //$NON-NLS-1$
-
+
for (Iterator<String> iter = variableResults.iterator(); iter.hasNext();) {
result.append(iter.next());
if (iter.hasNext()) {
result.append(", ");//$NON-NLS-1$
}
}
-
+
result.append(" | ").append(bodyResult).append(')');//$NON-NLS-1$
return result.toString();
@@ -483,9 +484,9 @@
@Override
protected String handleCollectionLiteralExp(CollectionLiteralExp<C> cl,
List<String> partResults) {
-
+
StringBuilder result = new StringBuilder();
-
+
// construct the appropriate collection from the parts
// based on the collection kind.
CollectionKind kind = cl.getKind();
@@ -514,18 +515,18 @@
result.append(", "); //$NON-NLS-1$
}
}
-
+
result.append('}');
-
+
return result.toString();
}
-
+
@Override
protected String handleCollectionItem(CollectionItem<C> item,
String itemResult) {
return itemResult;
}
-
+
@Override
protected String handleCollectionRange(CollectionRange<C> range,
String firstResult, String lastResult) {
@@ -540,82 +541,82 @@
@Override
protected String handleTupleLiteralExp(TupleLiteralExp<C,P> literalExp,
List<String> partResults) {
-
+
// construct the appropriate collection from the parts
// based on the collection kind.
StringBuilder result = new StringBuilder();
result.append("Tuple{");//$NON-NLS-1$
-
+
for (Iterator<String> iter = partResults.iterator(); iter.hasNext();) {
result.append(iter.next());
-
+
if (iter.hasNext()) {
result.append(", ");//$NON-NLS-1$
}
}
-
+
result.append('}');
-
+
return result.toString();
}
-
+
@Override
protected String handleTupleLiteralPart(TupleLiteralPart<C, P> part,
String valueResult) {
-
+
String varName = part.getName();
C type = part.getType();
-
+
StringBuilder result = new StringBuilder();
-
+
result.append(varName);
if (type != null) {
result.append(" : ").append(getName(type));//$NON-NLS-1$
}
-
+
if (valueResult != null) {
result.append(" = ").append(valueResult);//$NON-NLS-1$
}
-
+
return result.toString();
}
-
+
@Override
protected String handleMessageExp(MessageExp<C, COA, SSA> messageExp,
String targetResult, List<String> argumentResults) {
StringBuilder result = new StringBuilder();
-
+
result.append(targetResult);
-
+
result.append((messageExp.getType() instanceof CollectionType<?, ?>)?
"^^" : "^"); //$NON-NLS-1$//$NON-NLS-2$
-
+
if (messageExp.getCalledOperation() != null) {
result.append(getName(getOperation(messageExp.getCalledOperation())));
} else if (messageExp.getSentSignal() != null) {
result.append(getName(getSignal(messageExp.getSentSignal())));
}
-
+
result.append('(');
-
+
for (Iterator<String> iter = argumentResults.iterator(); iter.hasNext();) {
result.append(iter.next());
-
+
if (iter.hasNext()) {
result.append(", "); //$NON-NLS-1$
}
}
-
+
result.append(')');
-
+
return result.toString();
}
-
+
protected O getOperation(COA callOperationAction) {
return (uml == null)? null : uml.getOperation(callOperationAction);
}
-
+
protected C getSignal(SSA sendSignalAction) {
return (uml == null)? null : uml.getSignal(sendSignalAction);
}
@@ -634,12 +635,12 @@
@Override
public String visitConstraint(CT constraint) {
StringBuilder result = new StringBuilder();
-
+
List<? extends EObject> constrained = getConstrainedElements(constraint);
-
+
if (!constrained.isEmpty()) {
EObject elem = constrained.get(0);
-
+
result.append("context "); //$NON-NLS-1$
if (isClassifier(elem)) {
result.append(getName(elem));
@@ -652,10 +653,10 @@
P prop = (P) elem;
appendPropertySignature(result, prop);
}
-
+
result.append(' ');
}
-
+
String stereo = getStereotype(constraint);
if (UMLReflection.PRECONDITION.equals(stereo)) {
result.append("pre: "); //$NON-NLS-1$
@@ -669,9 +670,9 @@
result.append("derive: "); //$NON-NLS-1$
} else if (UMLReflection.POSTCONDITION.equals(stereo)) {
result.append("def: "); //$NON-NLS-1$
-
+
EObject elem = constrained.get(1);
-
+
if (isOperation(elem)) {
@SuppressWarnings("unchecked")
O oper = (O) elem;
@@ -681,76 +682,76 @@
P prop = (P) elem;
appendPropertySignature(result, prop);
}
-
+
result.append(" = "); //$NON-NLS-1$
} else {
result.append("inv "); //$NON-NLS-1$
result.append(getName(constraint));
result.append(": "); //$NON-NLS-1$
}
-
+
result.append(visit(getSpecification(constraint)));
-
+
return result.toString();
}
-
+
protected boolean isClassifier(Object element) {
return (uml != null) && uml.isClassifier(element);
}
-
+
protected boolean isOperation(Object element) {
return (uml != null) && uml.isOperation(element);
}
-
+
protected boolean isProperty(Object element) {
return (uml != null) && uml.isProperty(element);
}
-
+
protected List<? extends EObject> getConstrainedElements(CT constraint) {
return (uml == null)? null : uml.getConstrainedElements(constraint);
}
-
+
protected String getStereotype(CT constraint) {
return (uml == null)? null : uml.getStereotype(constraint);
}
-
+
@Override
protected ExpressionInOCL<C, PM> getSpecification(CT constraint) {
return (uml == null)? null : uml.getSpecification(constraint);
}
-
+
private void appendOperationSignature(StringBuilder buf, O operation) {
buf.append(getName(operation)).append('(');
-
+
boolean comma = false;
for (Iterator<PM> iter = getParameters(operation).iterator(); iter.hasNext();) {
PM parm = iter.next();
-
+
if (comma) {
buf.append(", "); //$NON-NLS-1$
} else {
comma = true;
}
-
+
buf.append(getName(parm)).append(" : "); //$NON-NLS-1$
-
+
if (getType(parm) != null) {
buf.append(getName(getType(parm)));
} else {
buf.append("OclVoid"); //$NON-NLS-1$
}
}
-
+
buf.append(") :"); //$NON-NLS-1$
if (getType(operation) != null) {
buf.append(' ').append(getName(getType(operation)));
}
}
-
+
protected C getType(Object typedElement) {
return (uml == null)? null : TypeUtil.resolveType(env, uml.getOCLType(typedElement));
}
-
+
protected List<PM> getParameters(O operation) {
return (uml == null)? null : uml.getParameters(operation);
}
@@ -778,7 +779,7 @@
public String visitNullLiteralExp(NullLiteralExp<C> il) {
return "null"; //$NON-NLS-1$
}
-
+
private String visit(Visitable visitable) {
return (visitable == null)? NULL_PLACEHOLDER : (String) visitable.accept(this);
}
diff --git a/tests/org.eclipse.ocl.tests/src/org/eclipse/ocl/tests/GenericTestSuite.java b/tests/org.eclipse.ocl.tests/src/org/eclipse/ocl/tests/GenericTestSuite.java
index 3cbca18..63e9b2a 100644
--- a/tests/org.eclipse.ocl.tests/src/org/eclipse/ocl/tests/GenericTestSuite.java
+++ b/tests/org.eclipse.ocl.tests/src/org/eclipse/ocl/tests/GenericTestSuite.java
@@ -684,7 +684,7 @@
EnvironmentFactory<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> envFactory,
C context, String text) {
- OCL<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> localOcl = OCL.newInstance(envFactory);
+ OCL<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> localOcl = OCL.newInstanceAbstract(envFactory);
OCLHelper<C, O, P, CT> helper = localOcl.createOCLHelper();
helper.setContext(context);