/** */ package org.eclipse.papyrus.uml.alf.impl; import java.lang.reflect.InvocationTargetException; import java.math.BigInteger; import java.util.Map; import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.DiagnosticChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.WrappedException; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EOperation; import org.eclipse.emf.ecore.plugin.EcorePlugin; import org.eclipse.emf.ecore.util.EObjectValidator; import org.eclipse.papyrus.uml.alf.AlfPackage; import org.eclipse.papyrus.uml.alf.AssignableElement; import org.eclipse.papyrus.uml.alf.AssignedSource; import org.eclipse.papyrus.uml.alf.ElementReference; import org.eclipse.papyrus.uml.alf.Expression; import org.eclipse.papyrus.uml.alf.IncrementOrDecrementExpression; import org.eclipse.papyrus.uml.alf.LeftHandSide; import org.eclipse.papyrus.uml.alf.util.AlfValidator; /** * * An implementation of the model object 'Increment Or Decrement Expression'. * *

*

* The following features are implemented: *

* * * @generated */ public class IncrementOrDecrementExpressionImpl extends ExpressionImpl implements IncrementOrDecrementExpression { /** * * * * @generated */ protected IncrementOrDecrementExpressionImpl() { super(); } /** * * * * @generated */ @Override protected EClass eStaticClass() { return AlfPackage.eINSTANCE.getIncrementOrDecrementExpression(); } /** * * * * @generated */ public AssignedSource getAssignment() { return (AssignedSource) eGet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_Assignment(), true); } /** * * * * @generated */ public void setAssignment(AssignedSource newAssignment) { eSet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_Assignment(), newAssignment); } /** * * * * @generated */ public LeftHandSide getOperand() { return (LeftHandSide) eGet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_Operand(), true); } /** * * * * @generated */ public void setOperand(LeftHandSide newOperand) { eSet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_Operand(), newOperand); } /** * * * * @generated */ public Expression getExpression() { return (Expression) eGet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_Expression(), true); } /** * * * * @generated */ public void setExpression(Expression newExpression) { eSet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_Expression(), newExpression); } /** * * * * @generated */ public ElementReference getFeature() { return (ElementReference) eGet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_Feature(), true); } /** * * * * @generated */ public void setFeature(ElementReference newFeature) { eSet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_Feature(), newFeature); } /** * * * * @generated */ public boolean isIsPrefix() { return (Boolean) eGet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_IsPrefix(), true); } /** * * * * @generated */ public void setIsPrefix(boolean newIsPrefix) { eSet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_IsPrefix(), newIsPrefix); } /** * * * * @generated */ public boolean isIsFeature() { return (Boolean) eGet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_IsFeature(), true); } /** * * * * @generated */ public void setIsFeature(boolean newIsFeature) { eSet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_IsFeature(), newIsFeature); } /** * * * * @generated */ public boolean isIsIndexed() { return (Boolean) eGet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_IsIndexed(), true); } /** * * * * @generated */ public void setIsIndexed(boolean newIsIndexed) { eSet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_IsIndexed(), newIsIndexed); } /** * * * * @generated */ public boolean isIsDataValueUpdate() { return (Boolean) eGet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_IsDataValueUpdate(), true); } /** * * * * @generated */ public void setIsDataValueUpdate(boolean newIsDataValueUpdate) { eSet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_IsDataValueUpdate(), newIsDataValueUpdate); } /** * * * * @generated */ public String getOperator() { return (String) eGet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_Operator(), true); } /** * * * * @generated */ public void setOperator(String newOperator) { eSet(AlfPackage.eINSTANCE.getIncrementOrDecrementExpression_Operator(), newOperator); } /** * The cached invocation delegate for the '{@link #type() Type}' operation. * * * * @see #type() * @generated * @ordered */ protected static final EOperation.Internal.InvocationDelegate TYPE__EINVOCATION_DELEGATE = ((EOperation.Internal) AlfPackage.eINSTANCE.getIncrementOrDecrementExpression__Type()).getInvocationDelegate(); /** * * * * @generated */ public ElementReference type() { try { return (ElementReference) TYPE__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); } } /** * The cached invocation delegate for the '{@link #lower() Lower}' operation. * * * * @see #lower() * @generated * @ordered */ protected static final EOperation.Internal.InvocationDelegate LOWER__EINVOCATION_DELEGATE = ((EOperation.Internal) AlfPackage.eINSTANCE.getIncrementOrDecrementExpression__Lower()).getInvocationDelegate(); /** * * * * @generated */ public BigInteger lower() { try { return (BigInteger) LOWER__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); } } /** * The cached invocation delegate for the '{@link #upper() Upper}' operation. * * * * @see #upper() * @generated * @ordered */ protected static final EOperation.Internal.InvocationDelegate UPPER__EINVOCATION_DELEGATE = ((EOperation.Internal) AlfPackage.eINSTANCE.getIncrementOrDecrementExpression__Upper()).getInvocationDelegate(); /** * * * * @generated */ public BigInteger upper() { try { return (BigInteger) UPPER__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); } } /** * * * * @generated */ public boolean incrementOrDecrementExpressionAssignmentDerivation(DiagnosticChain diagnostics, Map context) { // TODO: implement this method // -> specify the condition that violates the invariant // -> verify the details of the diagnostic, including severity and message // Ensure that you remove @generated or mark it @generated NOT if (false) { if (diagnostics != null) { diagnostics.add (new BasicDiagnostic (Diagnostic.ERROR, AlfValidator.DIAGNOSTIC_SOURCE, AlfValidator.INCREMENT_OR_DECREMENT_EXPRESSION__INCREMENT_OR_DECREMENT_EXPRESSION_ASSIGNMENT_DERIVATION, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "incrementOrDecrementExpressionAssignmentDerivation", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } return true; } /** * * * * @generated */ public boolean incrementOrDecrementExpressionIsFeatureDerivation(DiagnosticChain diagnostics, Map context) { // TODO: implement this method // -> specify the condition that violates the invariant // -> verify the details of the diagnostic, including severity and message // Ensure that you remove @generated or mark it @generated NOT if (false) { if (diagnostics != null) { diagnostics.add (new BasicDiagnostic (Diagnostic.ERROR, AlfValidator.DIAGNOSTIC_SOURCE, AlfValidator.INCREMENT_OR_DECREMENT_EXPRESSION__INCREMENT_OR_DECREMENT_EXPRESSION_IS_FEATURE_DERIVATION, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "incrementOrDecrementExpressionIsFeatureDerivation", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } return true; } /** * * * * @generated */ public boolean incrementOrDecrementExpressionIsIndexedDerivation(DiagnosticChain diagnostics, Map context) { // TODO: implement this method // -> specify the condition that violates the invariant // -> verify the details of the diagnostic, including severity and message // Ensure that you remove @generated or mark it @generated NOT if (false) { if (diagnostics != null) { diagnostics.add (new BasicDiagnostic (Diagnostic.ERROR, AlfValidator.DIAGNOSTIC_SOURCE, AlfValidator.INCREMENT_OR_DECREMENT_EXPRESSION__INCREMENT_OR_DECREMENT_EXPRESSION_IS_INDEXED_DERIVATION, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "incrementOrDecrementExpressionIsIndexedDerivation", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } return true; } /** * * * * @generated */ public boolean incrementOrDecrementExpressionIsDataValueUpdateDerivation(DiagnosticChain diagnostics, Map context) { // TODO: implement this method // -> specify the condition that violates the invariant // -> verify the details of the diagnostic, including severity and message // Ensure that you remove @generated or mark it @generated NOT if (false) { if (diagnostics != null) { diagnostics.add (new BasicDiagnostic (Diagnostic.ERROR, AlfValidator.DIAGNOSTIC_SOURCE, AlfValidator.INCREMENT_OR_DECREMENT_EXPRESSION__INCREMENT_OR_DECREMENT_EXPRESSION_IS_DATA_VALUE_UPDATE_DERIVATION, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "incrementOrDecrementExpressionIsDataValueUpdateDerivation", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } return true; } /** * * * * @generated */ public boolean incrementOrDecrementExpressionFeatureDerivation(DiagnosticChain diagnostics, Map context) { // TODO: implement this method // -> specify the condition that violates the invariant // -> verify the details of the diagnostic, including severity and message // Ensure that you remove @generated or mark it @generated NOT if (false) { if (diagnostics != null) { diagnostics.add (new BasicDiagnostic (Diagnostic.ERROR, AlfValidator.DIAGNOSTIC_SOURCE, AlfValidator.INCREMENT_OR_DECREMENT_EXPRESSION__INCREMENT_OR_DECREMENT_EXPRESSION_FEATURE_DERIVATION, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "incrementOrDecrementExpressionFeatureDerivation", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } return true; } /** * * * * @generated */ public boolean incrementOrDecrementExpressionExpressionDerivation(DiagnosticChain diagnostics, Map context) { // TODO: implement this method // -> specify the condition that violates the invariant // -> verify the details of the diagnostic, including severity and message // Ensure that you remove @generated or mark it @generated NOT if (false) { if (diagnostics != null) { diagnostics.add (new BasicDiagnostic (Diagnostic.ERROR, AlfValidator.DIAGNOSTIC_SOURCE, AlfValidator.INCREMENT_OR_DECREMENT_EXPRESSION__INCREMENT_OR_DECREMENT_EXPRESSION_EXPRESSION_DERIVATION, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "incrementOrDecrementExpressionExpressionDerivation", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } return true; } /** * * * * @generated */ public boolean incrementOrDecrementExpressionTypeDerivation(DiagnosticChain diagnostics, Map context) { // TODO: implement this method // -> specify the condition that violates the invariant // -> verify the details of the diagnostic, including severity and message // Ensure that you remove @generated or mark it @generated NOT if (false) { if (diagnostics != null) { diagnostics.add (new BasicDiagnostic (Diagnostic.ERROR, AlfValidator.DIAGNOSTIC_SOURCE, AlfValidator.INCREMENT_OR_DECREMENT_EXPRESSION__INCREMENT_OR_DECREMENT_EXPRESSION_TYPE_DERIVATION, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "incrementOrDecrementExpressionTypeDerivation", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } return true; } /** * * * * @generated */ public boolean incrementOrDecrementExpressionLowerDerivation(DiagnosticChain diagnostics, Map context) { // TODO: implement this method // -> specify the condition that violates the invariant // -> verify the details of the diagnostic, including severity and message // Ensure that you remove @generated or mark it @generated NOT if (false) { if (diagnostics != null) { diagnostics.add (new BasicDiagnostic (Diagnostic.ERROR, AlfValidator.DIAGNOSTIC_SOURCE, AlfValidator.INCREMENT_OR_DECREMENT_EXPRESSION__INCREMENT_OR_DECREMENT_EXPRESSION_LOWER_DERIVATION, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "incrementOrDecrementExpressionLowerDerivation", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } return true; } /** * * * * @generated */ public boolean incrementOrDecrementExpressionUpperDerivation(DiagnosticChain diagnostics, Map context) { // TODO: implement this method // -> specify the condition that violates the invariant // -> verify the details of the diagnostic, including severity and message // Ensure that you remove @generated or mark it @generated NOT if (false) { if (diagnostics != null) { diagnostics.add (new BasicDiagnostic (Diagnostic.ERROR, AlfValidator.DIAGNOSTIC_SOURCE, AlfValidator.INCREMENT_OR_DECREMENT_EXPRESSION__INCREMENT_OR_DECREMENT_EXPRESSION_UPPER_DERIVATION, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "incrementOrDecrementExpressionUpperDerivation", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } return true; } /** * The cached validation expression for the '{@link #incrementOrDecrementExpressionOperand(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) Increment Or Decrement Expression Operand}' invariant operation. * * * * @see #incrementOrDecrementExpressionOperand(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) * @generated * @ordered */ protected static final String INCREMENT_OR_DECREMENT_EXPRESSION_OPERAND_DIAGNOSTIC_CHAIN_MAP__EEXPRESSION = "self.isIntegerType(self.operand.type) and self.operand.upper = 1"; /** * * * * @generated */ public boolean incrementOrDecrementExpressionOperand(DiagnosticChain diagnostics, Map context) { return AlfValidator.validate (AlfPackage.eINSTANCE.getIncrementOrDecrementExpression(), this, diagnostics, context, "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", AlfPackage.eINSTANCE.getIncrementOrDecrementExpression__IncrementOrDecrementExpressionOperand__DiagnosticChain_Map(), INCREMENT_OR_DECREMENT_EXPRESSION_OPERAND_DIAGNOSTIC_CHAIN_MAP__EEXPRESSION, Diagnostic.ERROR, AlfValidator.DIAGNOSTIC_SOURCE, AlfValidator.INCREMENT_OR_DECREMENT_EXPRESSION__INCREMENT_OR_DECREMENT_EXPRESSION_OPERAND); } /** * * * * @generated */ public boolean incrementOrDecrementExpressionAssignmentsBefore(DiagnosticChain diagnostics, Map context) { // TODO: implement this method // -> specify the condition that violates the invariant // -> verify the details of the diagnostic, including severity and message // Ensure that you remove @generated or mark it @generated NOT if (false) { if (diagnostics != null) { diagnostics.add (new BasicDiagnostic (Diagnostic.ERROR, AlfValidator.DIAGNOSTIC_SOURCE, AlfValidator.INCREMENT_OR_DECREMENT_EXPRESSION__INCREMENT_OR_DECREMENT_EXPRESSION_ASSIGNMENTS_BEFORE, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "incrementOrDecrementExpressionAssignmentsBefore", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } return true; } /** * The cached invocation delegate for the '{@link #updateAssignments() Update Assignments}' operation. * * * * @see #updateAssignments() * @generated * @ordered */ protected static final EOperation.Internal.InvocationDelegate UPDATE_ASSIGNMENTS__EINVOCATION_DELEGATE = ((EOperation.Internal) AlfPackage.eINSTANCE.getIncrementOrDecrementExpression__UpdateAssignments()).getInvocationDelegate(); /** * * * * @generated */ @SuppressWarnings("unchecked") public EList updateAssignments() { try { return (EList) UPDATE_ASSIGNMENTS__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); } } /** * * * * @generated */ @Override public int eDerivedOperationID(int baseOperationID, Class baseClass) { if (baseClass == AssignableElement.class) { switch (baseOperationID) { case AlfPackage.ASSIGNABLE_ELEMENT___TYPE: return AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___TYPE; case AlfPackage.ASSIGNABLE_ELEMENT___LOWER: return AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___LOWER; case AlfPackage.ASSIGNABLE_ELEMENT___UPPER: return AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___UPPER; default: return super.eDerivedOperationID(baseOperationID, baseClass); } } if (baseClass == Expression.class) { switch (baseOperationID) { case AlfPackage.EXPRESSION___UPDATE_ASSIGNMENTS: return AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___UPDATE_ASSIGNMENTS; default: return super.eDerivedOperationID(baseOperationID, baseClass); } } return super.eDerivedOperationID(baseOperationID, baseClass); } /** * * * * @generated */ @Override @SuppressWarnings("unchecked") public Object eInvoke(int operationID, EList arguments) throws InvocationTargetException { switch (operationID) { case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___TYPE: return type(); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___LOWER: return lower(); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___UPPER: return upper(); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___INCREMENT_OR_DECREMENT_EXPRESSION_ASSIGNMENT_DERIVATION__DIAGNOSTICCHAIN_MAP: return incrementOrDecrementExpressionAssignmentDerivation((DiagnosticChain) arguments.get(0), (Map) arguments.get(1)); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___INCREMENT_OR_DECREMENT_EXPRESSION_IS_FEATURE_DERIVATION__DIAGNOSTICCHAIN_MAP: return incrementOrDecrementExpressionIsFeatureDerivation((DiagnosticChain) arguments.get(0), (Map) arguments.get(1)); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___INCREMENT_OR_DECREMENT_EXPRESSION_IS_INDEXED_DERIVATION__DIAGNOSTICCHAIN_MAP: return incrementOrDecrementExpressionIsIndexedDerivation((DiagnosticChain) arguments.get(0), (Map) arguments.get(1)); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___INCREMENT_OR_DECREMENT_EXPRESSION_IS_DATA_VALUE_UPDATE_DERIVATION__DIAGNOSTICCHAIN_MAP: return incrementOrDecrementExpressionIsDataValueUpdateDerivation((DiagnosticChain) arguments.get(0), (Map) arguments.get(1)); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___INCREMENT_OR_DECREMENT_EXPRESSION_FEATURE_DERIVATION__DIAGNOSTICCHAIN_MAP: return incrementOrDecrementExpressionFeatureDerivation((DiagnosticChain) arguments.get(0), (Map) arguments.get(1)); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___INCREMENT_OR_DECREMENT_EXPRESSION_EXPRESSION_DERIVATION__DIAGNOSTICCHAIN_MAP: return incrementOrDecrementExpressionExpressionDerivation((DiagnosticChain) arguments.get(0), (Map) arguments.get(1)); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___INCREMENT_OR_DECREMENT_EXPRESSION_TYPE_DERIVATION__DIAGNOSTICCHAIN_MAP: return incrementOrDecrementExpressionTypeDerivation((DiagnosticChain) arguments.get(0), (Map) arguments.get(1)); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___INCREMENT_OR_DECREMENT_EXPRESSION_LOWER_DERIVATION__DIAGNOSTICCHAIN_MAP: return incrementOrDecrementExpressionLowerDerivation((DiagnosticChain) arguments.get(0), (Map) arguments.get(1)); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___INCREMENT_OR_DECREMENT_EXPRESSION_UPPER_DERIVATION__DIAGNOSTICCHAIN_MAP: return incrementOrDecrementExpressionUpperDerivation((DiagnosticChain) arguments.get(0), (Map) arguments.get(1)); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___INCREMENT_OR_DECREMENT_EXPRESSION_OPERAND__DIAGNOSTICCHAIN_MAP: return incrementOrDecrementExpressionOperand((DiagnosticChain) arguments.get(0), (Map) arguments.get(1)); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___INCREMENT_OR_DECREMENT_EXPRESSION_ASSIGNMENTS_BEFORE__DIAGNOSTICCHAIN_MAP: return incrementOrDecrementExpressionAssignmentsBefore((DiagnosticChain) arguments.get(0), (Map) arguments.get(1)); case AlfPackage.INCREMENT_OR_DECREMENT_EXPRESSION___UPDATE_ASSIGNMENTS: return updateAssignments(); } return super.eInvoke(operationID, arguments); } } // IncrementOrDecrementExpressionImpl