diff options
author | dwagelaar | 2013-08-01 19:47:40 +0000 |
---|---|---|
committer | dwagelaar | 2013-08-01 19:47:40 +0000 |
commit | 8489908c225e1cf646755ca0ed5fc43a281f6cc4 (patch) | |
tree | df53170ef149e097db9d28dd3af30e583dcfe3ff /plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse | |
parent | 81b677bf2f5928ac2e51d1803096ab0456c9dc66 (diff) | |
download | org.eclipse.atl-8489908c225e1cf646755ca0ed5fc43a281f6cc4.tar.gz org.eclipse.atl-8489908c225e1cf646755ca0ed5fc43a281f6cc4.tar.xz org.eclipse.atl-8489908c225e1cf646755ca0ed5fc43a281f6cc4.zip |
Fix + test + bytecode format change.
413110: Refining mode rules resolves default traces to the second target
element when available
https://bugs.eclipse.org/bugs/show_bug.cgi?id=413110
Diffstat (limited to 'plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse')
20 files changed, 274 insertions, 43 deletions
diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/EmftvmPackage.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/EmftvmPackage.java index b6342a35..09a9b318 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/EmftvmPackage.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/EmftvmPackage.java @@ -1895,13 +1895,22 @@ public interface EmftvmPackage extends EPackage { int INPUT_RULE_ELEMENT__INPUT_FOR = RULE_ELEMENT_FEATURE_COUNT + 1; /** + * The feature id for the '<em><b>Maps To Self</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int INPUT_RULE_ELEMENT__MAPS_TO_SELF = RULE_ELEMENT_FEATURE_COUNT + 2; + + /** * The number of structural features of the '<em>Input Rule Element</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int INPUT_RULE_ELEMENT_FEATURE_COUNT = RULE_ELEMENT_FEATURE_COUNT + 2; + int INPUT_RULE_ELEMENT_FEATURE_COUNT = RULE_ELEMENT_FEATURE_COUNT + 3; /** * The meta object id for the '{@link org.eclipse.m2m.atl.emftvm.impl.OutputRuleElementImpl <em>Output Rule Element</em>}' class. @@ -8917,6 +8926,17 @@ public interface EmftvmPackage extends EPackage { EReference getInputRuleElement_InputFor(); /** + * Returns the meta object for the attribute '{@link org.eclipse.m2m.atl.emftvm.InputRuleElement#isMapsToSelf <em>Maps To Self</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Maps To Self</em>'. + * @see org.eclipse.m2m.atl.emftvm.InputRuleElement#isMapsToSelf() + * @see #getInputRuleElement() + * @generated + */ + EAttribute getInputRuleElement_MapsToSelf(); + + /** * Returns the meta object for class '{@link org.eclipse.m2m.atl.emftvm.OutputRuleElement <em>Output Rule Element</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -10945,6 +10965,14 @@ public interface EmftvmPackage extends EPackage { EReference INPUT_RULE_ELEMENT__INPUT_FOR = eINSTANCE.getInputRuleElement_InputFor(); /** + * The meta object literal for the '<em><b>Maps To Self</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute INPUT_RULE_ELEMENT__MAPS_TO_SELF = eINSTANCE.getInputRuleElement_MapsToSelf(); + + /** * The meta object literal for the '{@link org.eclipse.m2m.atl.emftvm.impl.OutputRuleElementImpl <em>Output Rule Element</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/ExecEnv.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/ExecEnv.java index 568bc8c2..c6e44af2 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/ExecEnv.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/ExecEnv.java @@ -141,7 +141,7 @@ public interface ExecEnv extends EObject { /** * Returns the value of the '<em><b>Current Phase</b></em>' attribute. - * The default value is <code>"null"</code>. + * The default value is <code>"manual"</code>. * The literals are from the enumeration {@link org.eclipse.m2m.atl.emftvm.RuleMode}. * <!-- begin-user-doc --> * <p> @@ -152,7 +152,7 @@ public interface ExecEnv extends EObject { * @return the value of the '<em>Current Phase</em>' attribute. * @see org.eclipse.m2m.atl.emftvm.RuleMode * @see org.eclipse.m2m.atl.emftvm.EmftvmPackage#getExecEnv_CurrentPhase() - * @model default="null" transient="true" changeable="false" + * @model default="manual" transient="true" changeable="false" * @generated */ RuleMode getCurrentPhase(); diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/InputRuleElement.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/InputRuleElement.java index 99126862..1949db59 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/InputRuleElement.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/InputRuleElement.java @@ -25,6 +25,7 @@ import org.eclipse.emf.ecore.EObject; * <ul> * <li>{@link org.eclipse.m2m.atl.emftvm.InputRuleElement#getBinding <em>Binding</em>}</li> * <li>{@link org.eclipse.m2m.atl.emftvm.InputRuleElement#getInputFor <em>Input For</em>}</li> + * <li>{@link org.eclipse.m2m.atl.emftvm.InputRuleElement#isMapsToSelf <em>Maps To Self</em>}</li> * </ul> * </p> * @@ -90,6 +91,32 @@ public interface InputRuleElement extends RuleElement { void setInputFor(Rule value); /** + * Returns the value of the '<em><b>Maps To Self</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Maps To Self</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Maps To Self</em>' attribute. + * @see #setMapsToSelf(boolean) + * @see org.eclipse.m2m.atl.emftvm.EmftvmPackage#getInputRuleElement_MapsToSelf() + * @model required="true" + * @generated + */ + boolean isMapsToSelf(); + + /** + * Sets the value of the '{@link org.eclipse.m2m.atl.emftvm.InputRuleElement#isMapsToSelf <em>Maps To Self</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Maps To Self</em>' attribute. + * @see #isMapsToSelf() + * @generated + */ + void setMapsToSelf(boolean value); + + /** * <!-- begin-user-doc --> * Creates a new {@link Iterable} of possible match values for this rule element. * @param env the execution environment context diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/Instruction.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/Instruction.java index 9e6b4f5a..d1e1d55e 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/Instruction.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/Instruction.java @@ -66,7 +66,7 @@ public interface Instruction extends EObject { /** * Returns the value of the '<em><b>Opcode</b></em>' attribute. - * The default value is <code>""</code>. + * The default value is <code>"PUSH"</code>. * The literals are from the enumeration {@link org.eclipse.m2m.atl.emftvm.Opcode}. * <!-- begin-user-doc --> * <p> @@ -77,7 +77,7 @@ public interface Instruction extends EObject { * @return the value of the '<em>Opcode</em>' attribute. * @see org.eclipse.m2m.atl.emftvm.Opcode * @see org.eclipse.m2m.atl.emftvm.EmftvmPackage#getInstruction_Opcode() - * @model default="" required="true" transient="true" changeable="false" derived="true" + * @model default="PUSH" required="true" transient="true" changeable="false" derived="true" * @generated */ Opcode getOpcode(); diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/Rule.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/Rule.java index b7dea8bf..239d362f 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/Rule.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/Rule.java @@ -706,4 +706,17 @@ public interface Rule extends NamedElement { */ void clearFields(); + /** + * <!-- begin-user-doc --> + * Finds the {@link InputRuleElement} with the given name within the rule inheritance hierarchy depth-first. + * + * @param name + * the input element name + * @return the {@link InputRuleElement} with the given name or <code>null</code> + * <!-- end-user-doc --> + * @model + * @generated + */ + InputRuleElement findInputElement(String name); + } // Rule diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/CodeBlockImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/CodeBlockImpl.java index 6361d08e..f8ee6dd9 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/CodeBlockImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/CodeBlockImpl.java @@ -374,7 +374,7 @@ public class CodeBlockImpl extends EObjectImpl implements CodeBlock { */ public Rule getMatcherFor() { if (eContainerFeatureID() != EmftvmPackage.CODE_BLOCK__MATCHER_FOR) return null; - return (Rule)eContainer(); + return (Rule)eInternalContainer(); } /** @@ -418,7 +418,7 @@ public class CodeBlockImpl extends EObjectImpl implements CodeBlock { */ public Rule getApplierFor() { if (eContainerFeatureID() != EmftvmPackage.CODE_BLOCK__APPLIER_FOR) return null; - return (Rule)eContainer(); + return (Rule)eInternalContainer(); } /** @@ -462,7 +462,7 @@ public class CodeBlockImpl extends EObjectImpl implements CodeBlock { */ public Rule getPostApplyFor() { if (eContainerFeatureID() != EmftvmPackage.CODE_BLOCK__POST_APPLY_FOR) return null; - return (Rule)eContainer(); + return (Rule)eInternalContainer(); } /** @@ -506,7 +506,7 @@ public class CodeBlockImpl extends EObjectImpl implements CodeBlock { */ public Operation getBodyFor() { if (eContainerFeatureID() != EmftvmPackage.CODE_BLOCK__BODY_FOR) return null; - return (Operation)eContainer(); + return (Operation)eInternalContainer(); } /** @@ -550,7 +550,7 @@ public class CodeBlockImpl extends EObjectImpl implements CodeBlock { */ public Field getInitialiserFor() { if (eContainerFeatureID() != EmftvmPackage.CODE_BLOCK__INITIALISER_FOR) return null; - return (Field)eContainer(); + return (Field)eInternalContainer(); } /** @@ -607,7 +607,7 @@ public class CodeBlockImpl extends EObjectImpl implements CodeBlock { */ public CodeBlock getNestedFor() { if (eContainerFeatureID() != EmftvmPackage.CODE_BLOCK__NESTED_FOR) return null; - return (CodeBlock)eContainer(); + return (CodeBlock)eInternalContainer(); } /** @@ -675,7 +675,7 @@ public class CodeBlockImpl extends EObjectImpl implements CodeBlock { */ public InputRuleElement getBindingFor() { if (eContainerFeatureID() != EmftvmPackage.CODE_BLOCK__BINDING_FOR) return null; - return (InputRuleElement)eContainer(); + return (InputRuleElement)eInternalContainer(); } /** diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/EmftvmFactoryImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/EmftvmFactoryImpl.java index b5469bf3..1d4bee6d 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/EmftvmFactoryImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/EmftvmFactoryImpl.java @@ -129,7 +129,7 @@ public class EmftvmFactoryImpl extends EFactoryImpl implements EmftvmFactory { */ public static EmftvmFactory init() { try { - EmftvmFactory theEmftvmFactory = (EmftvmFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/m2m/atl/2011/EMFTVM"); + EmftvmFactory theEmftvmFactory = (EmftvmFactory)EPackage.Registry.INSTANCE.getEFactory(EmftvmPackage.eNS_URI); if (theEmftvmFactory != null) { return theEmftvmFactory; } diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/EmftvmPackageImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/EmftvmPackageImpl.java index a74f3d0d..bcff1330 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/EmftvmPackageImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/EmftvmPackageImpl.java @@ -2685,6 +2685,15 @@ public class EmftvmPackageImpl extends EPackageImpl implements EmftvmPackage { * <!-- end-user-doc --> * @generated */ + public EAttribute getInputRuleElement_MapsToSelf() { + return (EAttribute)inputRuleElementEClass.getEStructuralFeatures().get(2); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public EClass getOutputRuleElement() { return outputRuleElementEClass; } @@ -3030,6 +3039,7 @@ public class EmftvmPackageImpl extends EPackageImpl implements EmftvmPackage { inputRuleElementEClass = createEClass(INPUT_RULE_ELEMENT); createEReference(inputRuleElementEClass, INPUT_RULE_ELEMENT__BINDING); createEReference(inputRuleElementEClass, INPUT_RULE_ELEMENT__INPUT_FOR); + createEAttribute(inputRuleElementEClass, INPUT_RULE_ELEMENT__MAPS_TO_SELF); outputRuleElementEClass = createEClass(OUTPUT_RULE_ELEMENT); createEReference(outputRuleElementEClass, OUTPUT_RULE_ELEMENT__MAPS_TO); @@ -3369,7 +3379,7 @@ public class EmftvmPackageImpl extends EPackageImpl implements EmftvmPackage { g1.getETypeArguments().add(g2); initEAttribute(getExecEnv_UniqueResults(), g1, "uniqueResults", null, 1, 1, ExecEnv.class, IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); initEAttribute(getExecEnv_JitDisabled(), theEcorePackage.getEBoolean(), "jitDisabled", null, 1, 1, ExecEnv.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getExecEnv_CurrentPhase(), this.getRuleMode(), "currentPhase", "null", 0, 1, ExecEnv.class, IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getExecEnv_CurrentPhase(), this.getRuleMode(), "currentPhase", "manual", 0, 1, ExecEnv.class, IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); EOperation op = addEOperation(execEnvEClass, this.getModule(), "loadModule", 0, 1, IS_UNIQUE, IS_ORDERED); addEParameter(op, this.getModuleResolver(), "resolver", 0, 1, IS_UNIQUE, IS_ORDERED); @@ -3656,7 +3666,7 @@ public class EmftvmPackageImpl extends EPackageImpl implements EmftvmPackage { initEClass(instructionEClass, Instruction.class, "Instruction", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getInstruction_OwningBlock(), this.getCodeBlock(), this.getCodeBlock_Code(), "owningBlock", null, 1, 1, Instruction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getInstruction_Opcode(), this.getOpcode(), "opcode", "", 1, 1, Instruction.class, IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + initEAttribute(getInstruction_Opcode(), this.getOpcode(), "opcode", "PUSH", 1, 1, Instruction.class, IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); initEAttribute(getInstruction_StackProduction(), theEcorePackage.getEInt(), "stackProduction", "0", 1, 1, Instruction.class, IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); initEAttribute(getInstruction_StackConsumption(), theEcorePackage.getEInt(), "stackConsumption", "0", 1, 1, Instruction.class, IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); initEAttribute(getInstruction_StackLevel(), theEcorePackage.getEInt(), "stackLevel", "0", 1, 1, Instruction.class, IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); @@ -3778,6 +3788,9 @@ public class EmftvmPackageImpl extends EPackageImpl implements EmftvmPackage { addEOperation(ruleEClass, null, "clearFields", 0, 1, IS_UNIQUE, IS_ORDERED); + op = addEOperation(ruleEClass, this.getInputRuleElement(), "findInputElement", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theEcorePackage.getEString(), "name", 0, 1, IS_UNIQUE, IS_ORDERED); + initEClass(ruleElementEClass, RuleElement.class, "RuleElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getRuleElement_Models(), theEcorePackage.getEString(), "models", null, 0, -1, RuleElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getRuleElement_EModels(), this.getModel(), null, "eModels", null, 0, -1, RuleElement.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); @@ -3785,6 +3798,7 @@ public class EmftvmPackageImpl extends EPackageImpl implements EmftvmPackage { initEClass(inputRuleElementEClass, InputRuleElement.class, "InputRuleElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getInputRuleElement_Binding(), this.getCodeBlock(), this.getCodeBlock_BindingFor(), "binding", null, 0, 1, InputRuleElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getInputRuleElement_InputFor(), this.getRule(), this.getRule_InputElements(), "inputFor", null, 0, 1, InputRuleElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getInputRuleElement_MapsToSelf(), theEcorePackage.getEBoolean(), "mapsToSelf", null, 1, 1, InputRuleElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); op = addEOperation(inputRuleElementEClass, null, "createIterable", 0, 1, IS_UNIQUE, IS_ORDERED); addEParameter(op, this.getExecEnv(), "env", 0, 1, IS_UNIQUE, IS_ORDERED); diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/FeatureImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/FeatureImpl.java index 493661d6..0bff4f18 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/FeatureImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/FeatureImpl.java @@ -397,7 +397,7 @@ public abstract class FeatureImpl extends TypedElementImpl implements Feature { */ public Module getModule() { if (eContainerFeatureID() != EmftvmPackage.FEATURE__MODULE) return null; - return (Module)eContainer(); + return (Module)eInternalContainer(); } /** diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/FieldImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/FieldImpl.java index 01ad4eea..502cf0d9 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/FieldImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/FieldImpl.java @@ -189,7 +189,7 @@ public class FieldImpl extends FeatureImpl implements Field { */ public Rule getRule() { if (eContainerFeatureID() != EmftvmPackage.FIELD__RULE) return null; - return (Rule)eContainer(); + return (Rule)eInternalContainer(); } /** diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/InputRuleElementImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/InputRuleElementImpl.java index 6063c478..b7527090 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/InputRuleElementImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/InputRuleElementImpl.java @@ -38,6 +38,7 @@ import org.eclipse.m2m.atl.emftvm.util.LazyList; * <ul> * <li>{@link org.eclipse.m2m.atl.emftvm.impl.InputRuleElementImpl#getBinding <em>Binding</em>}</li> * <li>{@link org.eclipse.m2m.atl.emftvm.impl.InputRuleElementImpl#getInputFor <em>Input For</em>}</li> + * <li>{@link org.eclipse.m2m.atl.emftvm.impl.InputRuleElementImpl#isMapsToSelf <em>Maps To Self</em>}</li> * </ul> * </p> * @@ -55,6 +56,25 @@ public class InputRuleElementImpl extends RuleElementImpl implements InputRuleEl protected CodeBlock binding; /** + * The default value of the '{@link #isMapsToSelf() <em>Maps To Self</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isMapsToSelf() + * @generated + * @ordered + */ + protected static final boolean MAPS_TO_SELF_EDEFAULT = false; + /** + * The cached value of the '{@link #isMapsToSelf() <em>Maps To Self</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isMapsToSelf() + * @generated + * @ordered + */ + protected boolean mapsToSelf = MAPS_TO_SELF_EDEFAULT; + + /** * <!-- begin-user-doc --> * Creates a new {@link InputRuleElementImpl}. * <!-- end-user-doc --> @@ -130,7 +150,7 @@ public class InputRuleElementImpl extends RuleElementImpl implements InputRuleEl */ public Rule getInputFor() { if (eContainerFeatureID() != EmftvmPackage.INPUT_RULE_ELEMENT__INPUT_FOR) return null; - return (Rule)eContainer(); + return (Rule)eInternalContainer(); } /** @@ -167,6 +187,27 @@ public class InputRuleElementImpl extends RuleElementImpl implements InputRuleEl } /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isMapsToSelf() { + return mapsToSelf; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setMapsToSelf(boolean newMapsToSelf) { + boolean oldMapsToSelf = mapsToSelf; + mapsToSelf = newMapsToSelf; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EmftvmPackage.INPUT_RULE_ELEMENT__MAPS_TO_SELF, oldMapsToSelf, mapsToSelf)); + } + + /** * <!-- begin-user-doc. --> * {@inheritDoc} * <!-- end-user-doc --> @@ -250,6 +291,8 @@ public class InputRuleElementImpl extends RuleElementImpl implements InputRuleEl return getBinding(); case EmftvmPackage.INPUT_RULE_ELEMENT__INPUT_FOR: return getInputFor(); + case EmftvmPackage.INPUT_RULE_ELEMENT__MAPS_TO_SELF: + return isMapsToSelf(); } return super.eGet(featureID, resolve, coreType); } @@ -269,6 +312,9 @@ public class InputRuleElementImpl extends RuleElementImpl implements InputRuleEl case EmftvmPackage.INPUT_RULE_ELEMENT__INPUT_FOR: setInputFor((Rule)newValue); return; + case EmftvmPackage.INPUT_RULE_ELEMENT__MAPS_TO_SELF: + setMapsToSelf((Boolean)newValue); + return; } super.eSet(featureID, newValue); } @@ -288,6 +334,9 @@ public class InputRuleElementImpl extends RuleElementImpl implements InputRuleEl case EmftvmPackage.INPUT_RULE_ELEMENT__INPUT_FOR: setInputFor((Rule)null); return; + case EmftvmPackage.INPUT_RULE_ELEMENT__MAPS_TO_SELF: + setMapsToSelf(MAPS_TO_SELF_EDEFAULT); + return; } super.eUnset(featureID); } @@ -305,8 +354,26 @@ public class InputRuleElementImpl extends RuleElementImpl implements InputRuleEl return binding != null; case EmftvmPackage.INPUT_RULE_ELEMENT__INPUT_FOR: return getInputFor() != null; + case EmftvmPackage.INPUT_RULE_ELEMENT__MAPS_TO_SELF: + return mapsToSelf != MAPS_TO_SELF_EDEFAULT; } return super.eIsSet(featureID); } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (mapsToSelf: "); + result.append(mapsToSelf); + result.append(')'); + return result.toString(); + } + } //InputRuleElementImpl diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/InstructionImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/InstructionImpl.java index 24570fd3..b5ac0bc6 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/InstructionImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/InstructionImpl.java @@ -160,7 +160,7 @@ public abstract class InstructionImpl extends EObjectImpl implements Instruction */ public CodeBlock getOwningBlock() { if (eContainerFeatureID() != EmftvmPackage.INSTRUCTION__OWNING_BLOCK) return null; - return (CodeBlock)eContainer(); + return (CodeBlock)eInternalContainer(); } /** diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/LineNumberImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/LineNumberImpl.java index 1b5732e8..7f21ac75 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/LineNumberImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/LineNumberImpl.java @@ -336,7 +336,7 @@ public class LineNumberImpl extends EObjectImpl implements LineNumber { */ public CodeBlock getOwningBlock() { if (eContainerFeatureID() != EmftvmPackage.LINE_NUMBER__OWNING_BLOCK) return null; - return (CodeBlock)eContainer(); + return (CodeBlock)eInternalContainer(); } /** diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/LocalVariableImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/LocalVariableImpl.java index bf5a58fb..d291d239 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/LocalVariableImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/LocalVariableImpl.java @@ -581,7 +581,7 @@ public class LocalVariableImpl extends TypedElementImpl implements LocalVariable */ public CodeBlock getOwningBlock() { if (eContainerFeatureID() != EmftvmPackage.LOCAL_VARIABLE__OWNING_BLOCK) return null; - return (CodeBlock)eContainer(); + return (CodeBlock)eInternalContainer(); } /** diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/ModelDeclarationImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/ModelDeclarationImpl.java index bbc35248..ff0b80ba 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/ModelDeclarationImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/ModelDeclarationImpl.java @@ -155,7 +155,7 @@ public class ModelDeclarationImpl extends EObjectImpl implements ModelDeclaratio */ public Module getInputModelFor() { if (eContainerFeatureID() != EmftvmPackage.MODEL_DECLARATION__INPUT_MODEL_FOR) return null; - return (Module)eContainer(); + return (Module)eInternalContainer(); } /** @@ -199,7 +199,7 @@ public class ModelDeclarationImpl extends EObjectImpl implements ModelDeclaratio */ public Module getInoutModelFor() { if (eContainerFeatureID() != EmftvmPackage.MODEL_DECLARATION__INOUT_MODEL_FOR) return null; - return (Module)eContainer(); + return (Module)eInternalContainer(); } /** @@ -243,7 +243,7 @@ public class ModelDeclarationImpl extends EObjectImpl implements ModelDeclaratio */ public Module getOutputModelFor() { if (eContainerFeatureID() != EmftvmPackage.MODEL_DECLARATION__OUTPUT_MODEL_FOR) return null; - return (Module)eContainer(); + return (Module)eInternalContainer(); } /** diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/OutputRuleElementImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/OutputRuleElementImpl.java index 5124d6c6..c65db145 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/OutputRuleElementImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/OutputRuleElementImpl.java @@ -96,7 +96,7 @@ public class OutputRuleElementImpl extends RuleElementImpl implements OutputRule */ public Rule getOutputFor() { if (eContainerFeatureID() != EmftvmPackage.OUTPUT_RULE_ELEMENT__OUTPUT_FOR) return null; - return (Rule)eContainer(); + return (Rule)eInternalContainer(); } /** diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/ParameterImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/ParameterImpl.java index 1b0d52c0..930d88bd 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/ParameterImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/ParameterImpl.java @@ -67,7 +67,7 @@ public class ParameterImpl extends TypedElementImpl implements Parameter { */ public Operation getOperation() { if (eContainerFeatureID() != EmftvmPackage.PARAMETER__OPERATION) return null; - return (Operation)eContainer(); + return (Operation)eInternalContainer(); } /** diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/RuleImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/RuleImpl.java index 071296b2..64e23c0a 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/RuleImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/RuleImpl.java @@ -1022,10 +1022,11 @@ public class RuleImpl extends NamedElementImpl implements Rule { final TraceLink match = TraceFactory.eINSTANCE.createTraceLink(); final EList<SourceElement> ses = match.getSourceElements(); int i = 0; - for (RuleElement re : getInputElements()) { + for (InputRuleElement re : getInputElements()) { SourceElement se = TraceFactory.eINSTANCE.createSourceElement(); se.setName(re.getName()); se.setRuntimeObject(values[i++]); + se.setMapsToSelf(re.isMapsToSelf()); ses.add(se); } frame.getEnv().getMatches().getLinksByRule(getName(), true).getLinks().add(match); @@ -1049,6 +1050,8 @@ public class RuleImpl extends NamedElementImpl implements Rule { SourceElement se = TraceFactory.eINSTANCE.createSourceElement(); se.setName(v.getKey()); se.setRuntimeObject(v.getValue()); + InputRuleElement re = findInputElement(v.getKey()); + se.setMapsToSelf(re == null ? false : re.isMapsToSelf()); ses.add(se); } frame.getEnv().getMatches().getLinksByRule(getName(), true).getLinks().add(match); @@ -1596,7 +1599,7 @@ public class RuleImpl extends NamedElementImpl implements Rule { */ public Module getModule() { if (eContainerFeatureID() != EmftvmPackage.RULE__MODULE) return null; - return (Module)eContainer(); + return (Module)eInternalContainer(); } /** @@ -2329,6 +2332,26 @@ public class RuleImpl extends NamedElementImpl implements Rule { * <!-- begin-user-doc. --> * {@inheritDoc} * <!-- end-user-doc --> + * @generated NOT + */ + public InputRuleElement findInputElement(final String name) { + for (InputRuleElement ire : getInputElements()) { + if (name.equals(ire.getName())) { + return ire; + } + } + InputRuleElement ire = null; + final Iterator<Rule> superRules = getESuperRules().iterator(); + while (ire == null && superRules.hasNext()) { + ire = superRules.next().findInputElement(name); + } + return ire; + } + + /** + * <!-- begin-user-doc. --> + * {@inheritDoc} + * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/resource/EMFTVMResourceImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/resource/EMFTVMResourceImpl.java index 020b56cc..071d7696 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/resource/EMFTVMResourceImpl.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/resource/EMFTVMResourceImpl.java @@ -52,10 +52,30 @@ import org.eclipse.m2m.atl.emftvm.TypedElement; public class EMFTVMResourceImpl extends ResourceImpl { /** - * Magic header: "ETVM". - * http://www.asciitable.com/ - */ - public static final int MAGIC = 0x4554564D; + * Legacy magic header: "ETVM". + * + * @see <a href="http://www.asciitable.com/">http://www.asciitable.com/</a> + */ + public static final int MAGIC_LEGACY = 0x4554564D; + + /** + * Magic header part 1: "EMFT". + * + * @see <a href="http://www.asciitable.com/">http://www.asciitable.com/</a> + */ + public static final int MAGIC_00 = 0x454D4654; + + /** + * Magic header part 2: "VM..". + * + * @see <a href="http://www.asciitable.com/">http://www.asciitable.com/</a> + */ + public static final int MAGIC_01 = 0x564D0000; + + /** + * Current - and highest supported - bytecode format version. + */ + public static final int BYTECODE_VERSION = 1; /** Default trace mode value. */ public static final int TRACE_MODE_DEFAULT = 1; @@ -67,6 +87,8 @@ public class EMFTVMResourceImpl extends ResourceImpl { */ protected static final EmftvmFactory FACTORY = EmftvmFactory.eINSTANCE; + private int bytecodeVersion; + /** * Creates a new {@link EMFTVMResourceImpl}. */ @@ -83,15 +105,47 @@ public class EMFTVMResourceImpl extends ResourceImpl { } /** + * Returns the bytecode format version of the loaded file. + * + * @return the bytecodeVersion + */ + public int getBytecodeVersion() { + return bytecodeVersion; + } + + /** + * Sets the bytecode format version of the loaded file. + * + * @param bytecodeVersion + * the bytecodeVersion to set + */ + protected void setBytecodeVersion(int bytecodeVersion) { + this.bytecodeVersion = bytecodeVersion; + } + + /** * {@inheritDoc} */ @Override protected void doLoad(InputStream inputStream, Map<?, ?> options) throws IOException { final DataInputStream in = new DataInputStream(inputStream); - final int magic = in.readInt(); - if (magic != MAGIC) { - throw new IOException("Wrong magic"); + final int magic_00 = in.readInt(); + if (magic_00 == MAGIC_LEGACY) { + setBytecodeVersion(0); + } else { + if (magic_00 != MAGIC_00) { + throw new IOException("Wrong magic"); + } + final int magic_01 = in.readInt(); + if ((magic_01 & 0xFFFF0000) != MAGIC_01) { + throw new IOException("Wrong magic"); + } + final int version = magic_01 & 0x0000FFFF; + if (version > BYTECODE_VERSION) { + throw new IOException("Unsupported bytecode version: " + version); + } + setBytecodeVersion(version); } final ConstantPool constants = new ConstantPool(); constants.read(in); @@ -99,7 +153,7 @@ public class EMFTVMResourceImpl extends ResourceImpl { getContents().add(module); } - private static Module readModule(final DataInputStream in, + private Module readModule(final DataInputStream in, final ConstantPool constants) throws IOException { final Module module = FACTORY.createModule(); module.setName((String)constants.get(in.readInt())); @@ -302,7 +356,7 @@ public class EMFTVMResourceImpl extends ResourceImpl { } } - private static void readRules(final DataInputStream in, + private void readRules(final DataInputStream in, final ConstantPool constants, final EList<Rule> rules) throws IOException { final int rtsize = in.readInt(); for (int i = 0; i < rtsize; i++) { @@ -340,13 +394,16 @@ public class EMFTVMResourceImpl extends ResourceImpl { } } - private static void readInputRuleElements(final DataInputStream in, + private void readInputRuleElements(final DataInputStream in, final ConstantPool constants, final EList<InputRuleElement> elements) throws IOException { final int esize = in.readInt(); for (int i = 0; i < esize; i++) { InputRuleElement ire = FACTORY.createInputRuleElement(); elements.add(ire); readTypedElement(in, constants, ire); + if (getBytecodeVersion() >= 1) { + ire.setMapsToSelf(in.readInt() > 0); + } int iemsize = in.readInt(); final EList<String> models = ire.getModels(); for (int j = 0; j < iemsize; j++) { @@ -404,7 +461,8 @@ public class EMFTVMResourceImpl extends ResourceImpl { protected void doSave(OutputStream outputStream, Map<?, ?> options) throws IOException { final DataOutputStream out = new DataOutputStream(outputStream); - out.writeInt(MAGIC); + out.writeInt(MAGIC_00); + out.writeInt(MAGIC_01 + BYTECODE_VERSION); final Module module = findModule(); final ConstantPool constants = new ConstantPool(); constants.createConstants(module); @@ -643,6 +701,7 @@ public class EMFTVMResourceImpl extends ResourceImpl { out.writeInt(elements.size()); for (InputRuleElement ire : elements) { writeTypedElement(out, constants, ire); + out.writeInt(ire.isMapsToSelf() ? 1 : 0); final EList<String> models = ire.getModels(); out.writeInt(models.size()); for (String model : models) { diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/OCLOperations.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/OCLOperations.java index 91eb129e..2f38f82a 100644 --- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/OCLOperations.java +++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/OCLOperations.java @@ -76,7 +76,7 @@ public final class OCLOperations { public Object next() { Object next = inner.next(); final SourceElement se = tls.getDefaultSourceElement(next); - if (se != null) { + if (se != null && !se.isMapsToSelf()) { final EList<TargetElement> seMapsTo = se.getMapsTo(); if (!seMapsTo.isEmpty()) { assert seMapsTo.get(0).getObject().eResource() != null; @@ -149,7 +149,7 @@ public final class OCLOperations { public Object next() { Object next = inner.next(); final SourceElement se = tr.getUniqueSourceElement(next); - if (se != null) { + if (se != null && !se.isMapsToSelf()) { final EList<TargetElement> seMapsTo = se.getMapsTo(); if (!seMapsTo.isEmpty()) { assert seMapsTo.get(0).getObject().eResource() != null; @@ -537,7 +537,7 @@ public final class OCLOperations { public Object execute(final StackFrame frame) { final Object object = frame.getLocal(0, 0); final SourceElement se = frame.getEnv().getTraces().getDefaultSourceElement(object); - if (se != null) { + if (se != null && !se.isMapsToSelf()) { final EList<TargetElement> seMapsTo = se.getMapsTo(); if (!seMapsTo.isEmpty()) { assert seMapsTo.get(0).getObject().eResource() != null; @@ -563,7 +563,7 @@ public final class OCLOperations { final TracedRule tr = frame.getEnv().getTraces().getLinksByRule(rule, false); if (tr != null) { final SourceElement se = tr.getUniqueSourceElement(object); - if (se != null) { + if (se != null && !se.isMapsToSelf()) { final EList<TargetElement> seMapsTo = se.getMapsTo(); if (!seMapsTo.isEmpty()) { assert seMapsTo.get(0).getObject().eResource() != null; |