org.eclipse.ocl.examples.pivot
Interface LoopExp

All Superinterfaces:
CallExp, DomainCallExp, DomainElement, DomainExpression, DomainNamedElement, DomainTypedElement, Element, org.eclipse.emf.ecore.EObject, Nameable, NamedElement, org.eclipse.emf.common.notify.Notifier, OCLExpression, PivotObject, TypedElement, Visitable
All Known Subinterfaces:
IterateExp, IteratorExp
All Known Implementing Classes:
IterateExpImpl, IteratorExpImpl, LoopExpImpl

public interface LoopExp
extends CallExp

A representation of the model object 'Loop Exp'.

The following features are supported:

See Also:
PivotPackage.getLoopExp()
Generated
Model
abstract="true"

Method Summary
 OCLExpression createBody(org.eclipse.emf.ecore.EClass eClass)
          Creates a new OCLExpression and sets the 'Body' containment reference.
 Variable createIterator()
          Creates a new Variable and appends it to the 'Iterator' containment reference list.
 OCLExpression getBody()
          Returns the value of the 'Body' containment reference.
 org.eclipse.emf.common.util.EList<Variable> getIterator()
          Returns the value of the 'Iterator' containment reference list.
 Iteration getReferredIteration()
          Returns the value of the 'Referred Iteration' reference.
 void setBody(OCLExpression value)
          Sets the value of the 'Body' containment reference.
 void setReferredIteration(Iteration value)
          Sets the value of the 'Referred Iteration' reference.
 boolean validateNoInitializers(org.eclipse.emf.common.util.DiagnosticChain diagnostics, java.util.Map<java.lang.Object,java.lang.Object> context)
          The loop variable of an iterator expression has no init expression.
 boolean validateSourceIsCollection(org.eclipse.emf.common.util.DiagnosticChain diagnostics, java.util.Map<java.lang.Object,java.lang.Object> context)
          The type of the source expression must be a collection.
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.CallExp
createSource, getSource, isImplicit, setImplicit, setSource
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.TypedElement
getType, setType
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.NamedElement
createOwnedAnnotation, createOwnedRule, getName, getOwnedAnnotation, getOwnedRule, isStatic, setIsStatic, setName
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.Element
allOwnedElements, createOwnedComment, getETarget, getOwnedComment, validateNotOwnSelf
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.util.Visitable
accept, eClass
 
Methods inherited from interface org.eclipse.emf.ecore.EObject
eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eInvoke, eIsProxy, eIsSet, eResource, eSet, eUnset
 
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eAdapters, eDeliver, eNotify, eSetDeliver
 
Methods inherited from interface org.eclipse.ocl.examples.domain.elements.DomainNamedElement
getName
 
Methods inherited from interface org.eclipse.ocl.examples.domain.elements.DomainExpression
getType
 

Method Detail

getBody

OCLExpression getBody()
Returns the value of the 'Body' containment reference.

If the meaning of the 'Body' containment reference isn't clear, there really should be more of a description here...

Returns:
the value of the 'Body' containment reference.
See Also:
setBody(OCLExpression), PivotPackage.getLoopExp_Body()
Generated
Model
containment="true" required="true" ordered="false" annotation="http://www.eclipse.org/emf/2002/GenModel get='throw new UnsupportedOperationException(); // FIXME Unimplemented http://www.eclipse.org/ocl/3.1.0/Pivot!LoopExp!body'"

setBody

void setBody(OCLExpression value)
Sets the value of the 'Body' containment reference.

Parameters:
value - the new value of the 'Body' containment reference.
See Also:
getBody()
Generated

createBody

OCLExpression createBody(org.eclipse.emf.ecore.EClass eClass)
Creates a new OCLExpression and sets the 'Body' containment reference.

Parameters:
eClass - The Ecore class of the OCLExpression to create.
Returns:
The new OCLExpression.
See Also:
getBody()
Generated

getIterator

org.eclipse.emf.common.util.EList<Variable> getIterator()
Returns the value of the 'Iterator' containment reference list. The list contents are of type Variable.

If the meaning of the 'Iterator' containment reference list isn't clear, there really should be more of a description here...

Returns:
the value of the 'Iterator' containment reference list.
See Also:
PivotPackage.getLoopExp_Iterator()
Generated
Model
containment="true" annotation="http://www.eclipse.org/emf/2002/GenModel get='throw new UnsupportedOperationException(); // FIXME Unimplemented http://www.eclipse.org/ocl/3.1.0/Pivot!LoopExp!iterator'"

createIterator

Variable createIterator()
Creates a new Variable and appends it to the 'Iterator' containment reference list.

Returns:
The new Variable.
See Also:
getIterator()
Generated

getReferredIteration

Iteration getReferredIteration()
Returns the value of the 'Referred Iteration' reference.

If the meaning of the 'Referred Iteration' reference isn't clear, there really should be more of a description here...

Returns:
the value of the 'Referred Iteration' reference.
See Also:
setReferredIteration(Iteration), PivotPackage.getLoopExp_ReferredIteration()
Generated
Model
ordered="false" annotation="http://www.eclipse.org/emf/2002/GenModel get='throw new UnsupportedOperationException(); // FIXME Unimplemented http://www.eclipse.org/ocl/3.1.0/Pivot!LoopExp!referredIteration'"

setReferredIteration

void setReferredIteration(Iteration value)
Sets the value of the 'Referred Iteration' reference.

Parameters:
value - the new value of the 'Referred Iteration' reference.
See Also:
getReferredIteration()
Generated

validateNoInitializers

boolean validateNoInitializers(org.eclipse.emf.common.util.DiagnosticChain diagnostics,
                               java.util.Map<java.lang.Object,java.lang.Object> context)
The loop variable of an iterator expression has no init expression.

Generated
Model
annotation="http://www.eclipse.org/emf/2002/GenModel body='/*\nself.iterator->forAll(initExpression->isEmpty())\n\052/\ntry {\n\tfinal <%org.eclipse.ocl.examples.domain.evaluation.DomainEvaluator%> evaluator = new <%org.eclipse.ocl.examples.library.ecore.EcoreExecutorManager%>(this, null, <%org.eclipse.ocl.examples.pivot.PivotTables%>.LIBRARY);\n\tfinal <%org.eclipse.ocl.examples.domain.values.ValueFactory%> valueFactory = evaluator.getValueFactory();\n\tfinal <%org.eclipse.ocl.examples.domain.values.Value%> self = valueFactory.valueOf(this);\n\tfinal <%org.eclipse.ocl.examples.library.executor.ExecutorType%> T_Boolean = <%org.eclipse.ocl.examples.library.oclstdlib.OCLstdlibTables%>.Types._Boolean;\n\t\n\tfinal <%org.eclipse.ocl.examples.domain.elements.DomainType%> returnType = T_Boolean;\n\tfinal <%org.eclipse.ocl.examples.domain.values.Value%> result = <%org.eclipse.ocl.examples.pivot.bodies.LoopExpBodies%>._invariant_NoInitializers.INSTANCE.evaluate(evaluator, returnType, self);\n\tfinal boolean resultIsNull = result.isNull();\n\tif (!resultIsNull && result.asBoolean()) {\t// true => true, false/null => dropthrough, invalid => exception\n\t\treturn true;\n\t}\n\tif (diagnostics != null) {\n\t\tint severity = resultIsNull ? <%org.eclipse.emf.common.util.Diagnostic%>.ERROR : <%org.eclipse.emf.common.util.Diagnostic%>.WARNING;\n\t\tString message = <%org.eclipse.osgi.util.NLS%>.bind(<%org.eclipse.ocl.examples.domain.messages.EvaluatorMessages%>.ValidationConstraintIsNotSatisfied_ERROR_, new Object[]{\"LoopExp\", \"NoInitializers\", <%org.eclipse.emf.ecore.util.EObjectValidator%>.getObjectLabel(this, context)});\n\t diagnostics.add(new <%org.eclipse.emf.common.util.BasicDiagnostic%>(severity, <%org.eclipse.ocl.examples.pivot.util.PivotValidator%>.DIAGNOSTIC_SOURCE, <%org.eclipse.ocl.examples.pivot.util.PivotValidator%>.LOOP_EXP__NO_INITIALIZERS, message, new Object [] { this }));\n\t}\n\treturn false;\n} catch (<%org.eclipse.ocl.examples.domain.evaluation.InvalidValueException%> e) {\n\tString message = <%org.eclipse.osgi.util.NLS%>.bind(<%org.eclipse.ocl.examples.domain.messages.EvaluatorMessages%>.ValidationEvaluationFailed_ERROR_, new Object[]{\"LoopExp\", \"NoInitializers\", <%org.eclipse.emf.ecore.util.EObjectValidator%>.getObjectLabel(this, context)});\n\tthrow new <%org.eclipse.emf.common.util.WrappedException%>(message, e);\n}\n'"

validateSourceIsCollection

boolean validateSourceIsCollection(org.eclipse.emf.common.util.DiagnosticChain diagnostics,
                                   java.util.Map<java.lang.Object,java.lang.Object> context)
The type of the source expression must be a collection.

Generated
Model
annotation="http://www.eclipse.org/emf/2002/GenModel body='/*\nsource.type.oclIsKindOf(CollectionType)\n\052/\ntry {\n\tfinal <%org.eclipse.ocl.examples.domain.evaluation.DomainEvaluator%> evaluator = new <%org.eclipse.ocl.examples.library.ecore.EcoreExecutorManager%>(this, null, <%org.eclipse.ocl.examples.pivot.PivotTables%>.LIBRARY);\n\tfinal <%org.eclipse.ocl.examples.domain.values.ValueFactory%> valueFactory = evaluator.getValueFactory();\n\tfinal <%org.eclipse.ocl.examples.domain.values.Value%> self = valueFactory.valueOf(this);\n\tfinal <%org.eclipse.ocl.examples.library.executor.ExecutorType%> T_Boolean = <%org.eclipse.ocl.examples.library.oclstdlib.OCLstdlibTables%>.Types._Boolean;\n\t\n\tfinal <%org.eclipse.ocl.examples.domain.elements.DomainType%> returnType = T_Boolean;\n\tfinal <%org.eclipse.ocl.examples.domain.values.Value%> result = <%org.eclipse.ocl.examples.pivot.bodies.LoopExpBodies%>._invariant_SourceIsCollection.INSTANCE.evaluate(evaluator, returnType, self);\n\tfinal boolean resultIsNull = result.isNull();\n\tif (!resultIsNull && result.asBoolean()) {\t// true => true, false/null => dropthrough, invalid => exception\n\t\treturn true;\n\t}\n\tif (diagnostics != null) {\n\t\tint severity = resultIsNull ? <%org.eclipse.emf.common.util.Diagnostic%>.ERROR : <%org.eclipse.emf.common.util.Diagnostic%>.WARNING;\n\t\tString message = <%org.eclipse.osgi.util.NLS%>.bind(<%org.eclipse.ocl.examples.domain.messages.EvaluatorMessages%>.ValidationConstraintIsNotSatisfied_ERROR_, new Object[]{\"LoopExp\", \"SourceIsCollection\", <%org.eclipse.emf.ecore.util.EObjectValidator%>.getObjectLabel(this, context)});\n\t diagnostics.add(new <%org.eclipse.emf.common.util.BasicDiagnostic%>(severity, <%org.eclipse.ocl.examples.pivot.util.PivotValidator%>.DIAGNOSTIC_SOURCE, <%org.eclipse.ocl.examples.pivot.util.PivotValidator%>.LOOP_EXP__SOURCE_IS_COLLECTION, message, new Object [] { this }));\n\t}\n\treturn false;\n} catch (<%org.eclipse.ocl.examples.domain.evaluation.InvalidValueException%> e) {\n\tString message = <%org.eclipse.osgi.util.NLS%>.bind(<%org.eclipse.ocl.examples.domain.messages.EvaluatorMessages%>.ValidationEvaluationFailed_ERROR_, new Object[]{\"LoopExp\", \"SourceIsCollection\", <%org.eclipse.emf.ecore.util.EObjectValidator%>.getObjectLabel(this, context)});\n\tthrow new <%org.eclipse.emf.common.util.WrappedException%>(message, e);\n}\n'"