From 0dc0e081796856373a370adf238732e19bb6bbfb Mon Sep 17 00:00:00 2001 From: Eike Stepper Date: Thu, 10 Aug 2006 04:03:21 +0000 Subject: *** empty log message *** --- .../src/testmodel1/TestModel1Factory.java | 49 ++ .../src/testmodel1/TestModel1Package.java | 300 ++++++++++++ .../src/testmodel1/TreeNode.java | 180 ++++++++ .../src/testmodel1/impl/TestModel1FactoryImpl.java | 113 +++++ .../src/testmodel1/impl/TestModel1PackageImpl.java | 281 +++++++++++ .../src/testmodel1/impl/TreeNodeImpl.java | 511 +++++++++++++++++++++ .../testmodel1/util/TestModel1AdapterFactory.java | 176 +++++++ .../src/testmodel1/util/TestModel1Switch.java | 180 ++++++++ 8 files changed, 1790 insertions(+) create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Factory.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Package.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TreeNode.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1FactoryImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1PackageImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TreeNodeImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1AdapterFactory.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1Switch.java (limited to 'plugins/org.eclipse.emf.cdo.tests/src/testmodel1') diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Factory.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Factory.java new file mode 100644 index 0000000000..a2254ecfcc --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Factory.java @@ -0,0 +1,49 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1; + + +import org.eclipse.emf.ecore.EFactory; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see testmodel1.TestModel1Package + * @generated + */ +public interface TestModel1Factory extends EFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + TestModel1Factory eINSTANCE = testmodel1.impl.TestModel1FactoryImpl.init(); + + /** + * Returns a new object of class 'Tree Node'. + * + * + * @return a new object of class 'Tree Node'. + * @generated + */ + TreeNode createTreeNode(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + TestModel1Package getTestModel1Package(); + +} //TestModel1Factory diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Package.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Package.java new file mode 100644 index 0000000000..35c5fee80a --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Package.java @@ -0,0 +1,300 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1; + + +import org.eclipse.emf.cdo.client.CDOPackage; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + * + * + * @see testmodel1.TestModel1Factory + * @model kind="package" + * @generated + */ +public interface TestModel1Package extends EPackage +{ + /** + * The package name. + * + * + * @generated + */ + String eNAME = "testmodel1"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/cdo/2006/TestModel1"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "testmodel1"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + TestModel1Package eINSTANCE = testmodel1.impl.TestModel1PackageImpl.init(); + + /** + * The meta object id for the '{@link testmodel1.impl.TreeNodeImpl Tree Node}' class. + * + * + * @see testmodel1.impl.TreeNodeImpl + * @see testmodel1.impl.TestModel1PackageImpl#getTreeNode() + * @generated + */ + int TREE_NODE = 0; + + /** + * The feature id for the 'Parent' container reference. + * + * + * @generated + * @ordered + */ + int TREE_NODE__PARENT = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Children' containment reference list. + * + * + * @generated + * @ordered + */ + int TREE_NODE__CHILDREN = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 1; + + /** + * The feature id for the 'References' reference list. + * + * + * @generated + * @ordered + */ + int TREE_NODE__REFERENCES = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 2; + + /** + * The feature id for the 'Boolean Feature' attribute. + * + * + * @generated + * @ordered + */ + int TREE_NODE__BOOLEAN_FEATURE = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 3; + + /** + * The feature id for the 'Int Feature' attribute. + * + * + * @generated + * @ordered + */ + int TREE_NODE__INT_FEATURE = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 4; + + /** + * The feature id for the 'String Feature' attribute. + * + * + * @generated + * @ordered + */ + int TREE_NODE__STRING_FEATURE = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 5; + + /** + * The number of structural features of the 'Tree Node' class. + * + * + * @generated + * @ordered + */ + int TREE_NODE_FEATURE_COUNT = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 6; + + /** + * Returns the meta object for class '{@link testmodel1.TreeNode Tree Node}'. + * + * + * @return the meta object for class 'Tree Node'. + * @see testmodel1.TreeNode + * @generated + */ + EClass getTreeNode(); + + /** + * Returns the meta object for the container reference '{@link testmodel1.TreeNode#getParent Parent}'. + * + * + * @return the meta object for the container reference 'Parent'. + * @see testmodel1.TreeNode#getParent() + * @see #getTreeNode() + * @generated + */ + EReference getTreeNode_Parent(); + + /** + * Returns the meta object for the containment reference list '{@link testmodel1.TreeNode#getChildren Children}'. + * + * + * @return the meta object for the containment reference list 'Children'. + * @see testmodel1.TreeNode#getChildren() + * @see #getTreeNode() + * @generated + */ + EReference getTreeNode_Children(); + + /** + * Returns the meta object for the reference list '{@link testmodel1.TreeNode#getReferences References}'. + * + * + * @return the meta object for the reference list 'References'. + * @see testmodel1.TreeNode#getReferences() + * @see #getTreeNode() + * @generated + */ + EReference getTreeNode_References(); + + /** + * Returns the meta object for the attribute '{@link testmodel1.TreeNode#isBooleanFeature Boolean Feature}'. + * + * + * @return the meta object for the attribute 'Boolean Feature'. + * @see testmodel1.TreeNode#isBooleanFeature() + * @see #getTreeNode() + * @generated + */ + EAttribute getTreeNode_BooleanFeature(); + + /** + * Returns the meta object for the attribute '{@link testmodel1.TreeNode#getIntFeature Int Feature}'. + * + * + * @return the meta object for the attribute 'Int Feature'. + * @see testmodel1.TreeNode#getIntFeature() + * @see #getTreeNode() + * @generated + */ + EAttribute getTreeNode_IntFeature(); + + /** + * Returns the meta object for the attribute '{@link testmodel1.TreeNode#getStringFeature String Feature}'. + * + * + * @return the meta object for the attribute 'String Feature'. + * @see testmodel1.TreeNode#getStringFeature() + * @see #getTreeNode() + * @generated + */ + EAttribute getTreeNode_StringFeature(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + TestModel1Factory getTestModel1Factory(); + + + /** + * + * Defines literals for the meta objects that represent + * + * + * @generated + */ + interface Literals + { + /** + * The meta object literal for the '{@link testmodel1.impl.TreeNodeImpl Tree Node}' class. + * + * + * @see testmodel1.impl.TreeNodeImpl + * @see testmodel1.impl.TestModel1PackageImpl#getTreeNode() + * @generated + */ + EClass TREE_NODE = eINSTANCE.getTreeNode(); + + /** + * The meta object literal for the 'Parent' container reference feature. + * + * + * @generated + */ + EReference TREE_NODE__PARENT = eINSTANCE.getTreeNode_Parent(); + + /** + * The meta object literal for the 'Children' containment reference list feature. + * + * + * @generated + */ + EReference TREE_NODE__CHILDREN = eINSTANCE.getTreeNode_Children(); + + /** + * The meta object literal for the 'References' reference list feature. + * + * + * @generated + */ + EReference TREE_NODE__REFERENCES = eINSTANCE.getTreeNode_References(); + + /** + * The meta object literal for the 'Boolean Feature' attribute feature. + * + * + * @generated + */ + EAttribute TREE_NODE__BOOLEAN_FEATURE = eINSTANCE.getTreeNode_BooleanFeature(); + + /** + * The meta object literal for the 'Int Feature' attribute feature. + * + * + * @generated + */ + EAttribute TREE_NODE__INT_FEATURE = eINSTANCE.getTreeNode_IntFeature(); + + /** + * The meta object literal for the 'String Feature' attribute feature. + * + * + * @generated + */ + EAttribute TREE_NODE__STRING_FEATURE = eINSTANCE.getTreeNode_StringFeature(); + + } + +} //TestModel1Package diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TreeNode.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TreeNode.java new file mode 100644 index 0000000000..95e0fb5eeb --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TreeNode.java @@ -0,0 +1,180 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1; + + +import org.eclipse.emf.cdo.client.CDOPersistent; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + + +/** + * + * A representation of the model object 'Tree Node'. + * + * + *

+ * The following features are supported: + *

+ *

+ * + * @see testmodel1.TestModel1Package#getTreeNode() + * @model + * @generated + */ +public interface TreeNode extends CDOPersistent +{ + /** + * Returns the value of the 'Parent' container reference. + * It is bidirectional and its opposite is '{@link testmodel1.TreeNode#getChildren Children}'. + * + *

+ * If the meaning of the 'Parent' container reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Parent' container reference. + * @see #setParent(TreeNode) + * @see testmodel1.TestModel1Package#getTreeNode_Parent() + * @see testmodel1.TreeNode#getChildren + * @model opposite="children" + * @generated + */ + TreeNode getParent(); + + /** + * Sets the value of the '{@link testmodel1.TreeNode#getParent Parent}' container reference. + * + * + * @param value the new value of the 'Parent' container reference. + * @see #getParent() + * @generated + */ + void setParent(TreeNode value); + + /** + * Returns the value of the 'Children' containment reference list. + * The list contents are of type {@link testmodel1.TreeNode}. + * It is bidirectional and its opposite is '{@link testmodel1.TreeNode#getParent Parent}'. + * + *

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

+ * + * @return the value of the 'Children' containment reference list. + * @see testmodel1.TestModel1Package#getTreeNode_Children() + * @see testmodel1.TreeNode#getParent + * @model type="testmodel1.TreeNode" opposite="parent" containment="true" + * @generated + */ + EList getChildren(); + + /** + * Returns the value of the 'References' reference list. + * The list contents are of type {@link testmodel1.TreeNode}. + * + *

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

+ * + * @return the value of the 'References' reference list. + * @see testmodel1.TestModel1Package#getTreeNode_References() + * @model type="testmodel1.TreeNode" + * @generated + */ + EList getReferences(); + + /** + * Returns the value of the 'Boolean Feature' attribute. + * + *

+ * If the meaning of the 'Boolean Feature' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Boolean Feature' attribute. + * @see #setBooleanFeature(boolean) + * @see testmodel1.TestModel1Package#getTreeNode_BooleanFeature() + * @model + * @generated + */ + boolean isBooleanFeature(); + + /** + * Sets the value of the '{@link testmodel1.TreeNode#isBooleanFeature Boolean Feature}' attribute. + * + * + * @param value the new value of the 'Boolean Feature' attribute. + * @see #isBooleanFeature() + * @generated + */ + void setBooleanFeature(boolean value); + + /** + * Returns the value of the 'Int Feature' attribute. + * + *

+ * If the meaning of the 'Int Feature' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Int Feature' attribute. + * @see #setIntFeature(int) + * @see testmodel1.TestModel1Package#getTreeNode_IntFeature() + * @model + * @generated + */ + int getIntFeature(); + + /** + * Sets the value of the '{@link testmodel1.TreeNode#getIntFeature Int Feature}' attribute. + * + * + * @param value the new value of the 'Int Feature' attribute. + * @see #getIntFeature() + * @generated + */ + void setIntFeature(int value); + + /** + * Returns the value of the 'String Feature' attribute. + * + *

+ * If the meaning of the 'String Feature' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'String Feature' attribute. + * @see #setStringFeature(String) + * @see testmodel1.TestModel1Package#getTreeNode_StringFeature() + * @model + * @generated + */ + String getStringFeature(); + + /** + * Sets the value of the '{@link testmodel1.TreeNode#getStringFeature String Feature}' attribute. + * + * + * @param value the new value of the 'String Feature' attribute. + * @see #getStringFeature() + * @generated + */ + void setStringFeature(String value); + +} // TreeNode \ No newline at end of file diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1FactoryImpl.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1FactoryImpl.java new file mode 100644 index 0000000000..d3684d8b95 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1FactoryImpl.java @@ -0,0 +1,113 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1.impl; + + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import testmodel1.*; + + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class TestModel1FactoryImpl extends EFactoryImpl implements TestModel1Factory +{ + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static TestModel1Factory init() + { + try + { + TestModel1Factory theTestModel1Factory = (TestModel1Factory) EPackage.Registry.INSTANCE + .getEFactory("http://www.eclipse.org/emf/cdo/2006/TestModel1"); + if (theTestModel1Factory != null) + { + return theTestModel1Factory; + } + } + catch (Exception exception) + { + EcorePlugin.INSTANCE.log(exception); + } + return new TestModel1FactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public TestModel1FactoryImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public EObject create(EClass eClass) + { + switch (eClass.getClassifierID()) + { + case TestModel1Package.TREE_NODE: + return createTreeNode(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public TreeNode createTreeNode() + { + TreeNodeImpl treeNode = new TreeNodeImpl(); + return treeNode; + } + + /** + * + * + * @generated + */ + public TestModel1Package getTestModel1Package() + { + return (TestModel1Package) getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + public static TestModel1Package getPackage() + { + return TestModel1Package.eINSTANCE; + } + +} //TestModel1FactoryImpl diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1PackageImpl.java new file mode 100644 index 0000000000..d9b692e9eb --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1PackageImpl.java @@ -0,0 +1,281 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1.impl; + + +import org.eclipse.emf.cdo.client.CDOPackage; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import testmodel1.TestModel1Factory; +import testmodel1.TestModel1Package; +import testmodel1.TreeNode; + + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class TestModel1PackageImpl extends EPackageImpl implements TestModel1Package +{ + /** + * + * + * @generated + */ + private EClass treeNodeEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see testmodel1.TestModel1Package#eNS_URI + * @see #init() + * @generated + */ + private TestModel1PackageImpl() + { + super(eNS_URI, TestModel1Factory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this + * model, and for any others upon which it depends. Simple + * dependencies are satisfied by calling this method on all + * dependent packages before doing anything else. This method drives + * initialization for interdependent packages directly, in parallel + * with this package, itself. + *

Of this package and its interdependencies, all packages which + * have not yet been registered by their URI values are first created + * and registered. The packages are then initialized in two steps: + * meta-model objects for all of the packages are created before any + * are initialized, since one package's meta-model objects may refer to + * those of another. + *

Invocation of this method will not affect any packages that have + * already been initialized. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static TestModel1Package init() + { + if (isInited) + return (TestModel1Package) EPackage.Registry.INSTANCE.getEPackage(TestModel1Package.eNS_URI); + + // Obtain or create and register package + TestModel1PackageImpl theTestModel1Package = (TestModel1PackageImpl) (EPackage.Registry.INSTANCE + .getEPackage(eNS_URI) instanceof TestModel1PackageImpl ? EPackage.Registry.INSTANCE + .getEPackage(eNS_URI) : new TestModel1PackageImpl()); + + isInited = true; + + // Initialize simple dependencies + CDOPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theTestModel1Package.createPackageContents(); + + // Initialize created meta-data + theTestModel1Package.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theTestModel1Package.freeze(); + + return theTestModel1Package; + } + + /** + * + * + * @generated + */ + public EClass getTreeNode() + { + return treeNodeEClass; + } + + /** + * + * + * @generated + */ + public EReference getTreeNode_Parent() + { + return (EReference) treeNodeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getTreeNode_Children() + { + return (EReference) treeNodeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getTreeNode_References() + { + return (EReference) treeNodeEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EAttribute getTreeNode_BooleanFeature() + { + return (EAttribute) treeNodeEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EAttribute getTreeNode_IntFeature() + { + return (EAttribute) treeNodeEClass.getEStructuralFeatures().get(4); + } + + /** + * + * + * @generated + */ + public EAttribute getTreeNode_StringFeature() + { + return (EAttribute) treeNodeEClass.getEStructuralFeatures().get(5); + } + + /** + * + * + * @generated + */ + public TestModel1Factory getTestModel1Factory() + { + return (TestModel1Factory) getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() + { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + treeNodeEClass = createEClass(TREE_NODE); + createEReference(treeNodeEClass, TREE_NODE__PARENT); + createEReference(treeNodeEClass, TREE_NODE__CHILDREN); + createEReference(treeNodeEClass, TREE_NODE__REFERENCES); + createEAttribute(treeNodeEClass, TREE_NODE__BOOLEAN_FEATURE); + createEAttribute(treeNodeEClass, TREE_NODE__INT_FEATURE); + createEAttribute(treeNodeEClass, TREE_NODE__STRING_FEATURE); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() + { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + CDOPackage theCDOPackage = (CDOPackage) EPackage.Registry.INSTANCE + .getEPackage(CDOPackage.eNS_URI); + + // Add supertypes to classes + treeNodeEClass.getESuperTypes().add(theCDOPackage.getCDOPersistent()); + + // Initialize classes and features; add operations and parameters + initEClass(treeNodeEClass, TreeNode.class, "TreeNode", !IS_ABSTRACT, !IS_INTERFACE, + IS_GENERATED_INSTANCE_CLASS); + initEReference(getTreeNode_Parent(), this.getTreeNode(), this.getTreeNode_Children(), "parent", + null, 0, 1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, + !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTreeNode_Children(), this.getTreeNode(), this.getTreeNode_Parent(), + "children", null, 0, -1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTreeNode_References(), this.getTreeNode(), null, "references", null, 0, -1, + TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, + IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTreeNode_BooleanFeature(), ecorePackage.getEBoolean(), "booleanFeature", + null, 0, 1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, + !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTreeNode_IntFeature(), ecorePackage.getEInt(), "intFeature", null, 0, 1, + TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, + IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTreeNode_StringFeature(), ecorePackage.getEString(), "stringFeature", null, + 0, 1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, + IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //TestModel1PackageImpl diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TreeNodeImpl.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TreeNodeImpl.java new file mode 100644 index 0000000000..4a084bd976 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TreeNodeImpl.java @@ -0,0 +1,511 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1.impl; + + +import java.util.Collection; + +import org.eclipse.emf.cdo.client.impl.CDOPersistentImpl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.InternalEList; + +import testmodel1.TestModel1Package; +import testmodel1.TreeNode; + + +/** + * + * An implementation of the model object 'Tree Node'. + * + *

+ * The following features are implemented: + *

+ *

+ * + * @generated + */ +public class TreeNodeImpl extends CDOPersistentImpl implements TreeNode +{ + /** + * The cached value of the '{@link #getChildren() Children}' containment reference list. + * + * + * @see #getChildren() + * @generated + * @ordered + */ + protected EList children = null; + + /** + * The cached value of the '{@link #getReferences() References}' reference list. + * + * + * @see #getReferences() + * @generated + * @ordered + */ + protected EList references = null; + + /** + * The default value of the '{@link #isBooleanFeature() Boolean Feature}' attribute. + * + * + * @see #isBooleanFeature() + * @generated + * @ordered + */ + protected static final boolean BOOLEAN_FEATURE_EDEFAULT = false; + + /** + * The cached value of the '{@link #isBooleanFeature() Boolean Feature}' attribute. + * + * + * @see #isBooleanFeature() + * @generated + * @ordered + */ + protected boolean booleanFeature = BOOLEAN_FEATURE_EDEFAULT; + + /** + * The default value of the '{@link #getIntFeature() Int Feature}' attribute. + * + * + * @see #getIntFeature() + * @generated + * @ordered + */ + protected static final int INT_FEATURE_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getIntFeature() Int Feature}' attribute. + * + * + * @see #getIntFeature() + * @generated + * @ordered + */ + protected int intFeature = INT_FEATURE_EDEFAULT; + + /** + * The default value of the '{@link #getStringFeature() String Feature}' attribute. + * + * + * @see #getStringFeature() + * @generated + * @ordered + */ + protected static final String STRING_FEATURE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getStringFeature() String Feature}' attribute. + * + * + * @see #getStringFeature() + * @generated + * @ordered + */ + protected String stringFeature = STRING_FEATURE_EDEFAULT; + + /** + * + * + * @generated + */ + protected TreeNodeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return TestModel1Package.Literals.TREE_NODE; + } + + /** + * + * + * @generated + */ + public TreeNode getParent() + { + + if (eContainerFeatureID != TestModel1Package.TREE_NODE__PARENT) return null; + return (TreeNode) eContainer(); + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetParent(TreeNode newParent, NotificationChain msgs) + { + cdoLoad(); + msgs = eBasicSetContainer((InternalEObject) newParent, TestModel1Package.TREE_NODE__PARENT, + msgs); + return msgs; + } + + /** + * + * + * @generated + */ + public void setParent(TreeNode newParent) + { + + if (newParent != eInternalContainer() + || (eContainerFeatureID != TestModel1Package.TREE_NODE__PARENT && newParent != null)) + { + if (EcoreUtil.isAncestor(this, newParent)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); + if (newParent != null) + msgs = ((InternalEObject) newParent).eInverseAdd(this, + TestModel1Package.TREE_NODE__CHILDREN, TreeNode.class, msgs); + msgs = basicSetParent(newParent, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, TestModel1Package.TREE_NODE__PARENT, + newParent, newParent)); + } + + /** + * + * + * @generated + */ + public EList getChildren() + { + + cdoLoad(); + if (children == null) + { + children = new EObjectContainmentWithInverseEList(TreeNode.class, this, + TestModel1Package.TREE_NODE__CHILDREN, TestModel1Package.TREE_NODE__PARENT); + } + return children; + } + + /** + * + * + * @generated + */ + public EList getReferences() + { + + cdoLoad(); + if (references == null) + { + references = new EObjectResolvingEList(TreeNode.class, this, + TestModel1Package.TREE_NODE__REFERENCES); + } + return references; + } + + /** + * + * + * @generated + */ + public boolean isBooleanFeature() + { + + cdoLoad(); + return booleanFeature; + } + + /** + * + * + * @generated + */ + public void setBooleanFeature(boolean newBooleanFeature) + { + + cdoLoad(); + boolean oldBooleanFeature = booleanFeature; + booleanFeature = newBooleanFeature; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, + TestModel1Package.TREE_NODE__BOOLEAN_FEATURE, oldBooleanFeature, booleanFeature)); + } + + /** + * + * + * @generated + */ + public int getIntFeature() + { + + cdoLoad(); + return intFeature; + } + + /** + * + * + * @generated + */ + public void setIntFeature(int newIntFeature) + { + + cdoLoad(); + int oldIntFeature = intFeature; + intFeature = newIntFeature; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, + TestModel1Package.TREE_NODE__INT_FEATURE, oldIntFeature, intFeature)); + } + + /** + * + * + * @generated + */ + public String getStringFeature() + { + + cdoLoad(); + return stringFeature; + } + + /** + * + * + * @generated + */ + public void setStringFeature(String newStringFeature) + { + + cdoLoad(); + String oldStringFeature = stringFeature; + stringFeature = newStringFeature; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, + TestModel1Package.TREE_NODE__STRING_FEATURE, oldStringFeature, stringFeature)); + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, + NotificationChain msgs) + { + switch (featureID) + { + case TestModel1Package.TREE_NODE__PARENT: + if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); + return basicSetParent((TreeNode) otherEnd, msgs); + case TestModel1Package.TREE_NODE__CHILDREN: + return ((InternalEList) getChildren()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, + NotificationChain msgs) + { + switch (featureID) + { + case TestModel1Package.TREE_NODE__PARENT: + return basicSetParent(null, msgs); + case TestModel1Package.TREE_NODE__CHILDREN: + return ((InternalEList) getChildren()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) + { + switch (eContainerFeatureID) + { + case TestModel1Package.TREE_NODE__PARENT: + return eInternalContainer().eInverseRemove(this, TestModel1Package.TREE_NODE__CHILDREN, + TreeNode.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case TestModel1Package.TREE_NODE__PARENT: + return getParent(); + case TestModel1Package.TREE_NODE__CHILDREN: + return getChildren(); + case TestModel1Package.TREE_NODE__REFERENCES: + return getReferences(); + case TestModel1Package.TREE_NODE__BOOLEAN_FEATURE: + return isBooleanFeature() ? Boolean.TRUE : Boolean.FALSE; + case TestModel1Package.TREE_NODE__INT_FEATURE: + return new Integer(getIntFeature()); + case TestModel1Package.TREE_NODE__STRING_FEATURE: + return getStringFeature(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case TestModel1Package.TREE_NODE__PARENT: + setParent((TreeNode) newValue); + return; + case TestModel1Package.TREE_NODE__CHILDREN: + getChildren().clear(); + getChildren().addAll((Collection) newValue); + return; + case TestModel1Package.TREE_NODE__REFERENCES: + getReferences().clear(); + getReferences().addAll((Collection) newValue); + return; + case TestModel1Package.TREE_NODE__BOOLEAN_FEATURE: + setBooleanFeature(((Boolean) newValue).booleanValue()); + return; + case TestModel1Package.TREE_NODE__INT_FEATURE: + setIntFeature(((Integer) newValue).intValue()); + return; + case TestModel1Package.TREE_NODE__STRING_FEATURE: + setStringFeature((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case TestModel1Package.TREE_NODE__PARENT: + setParent((TreeNode) null); + return; + case TestModel1Package.TREE_NODE__CHILDREN: + getChildren().clear(); + return; + case TestModel1Package.TREE_NODE__REFERENCES: + getReferences().clear(); + return; + case TestModel1Package.TREE_NODE__BOOLEAN_FEATURE: + setBooleanFeature(BOOLEAN_FEATURE_EDEFAULT); + return; + case TestModel1Package.TREE_NODE__INT_FEATURE: + setIntFeature(INT_FEATURE_EDEFAULT); + return; + case TestModel1Package.TREE_NODE__STRING_FEATURE: + setStringFeature(STRING_FEATURE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case TestModel1Package.TREE_NODE__PARENT: + return getParent() != null; + case TestModel1Package.TREE_NODE__CHILDREN: + return children != null && !children.isEmpty(); + case TestModel1Package.TREE_NODE__REFERENCES: + return references != null && !references.isEmpty(); + case TestModel1Package.TREE_NODE__BOOLEAN_FEATURE: + return booleanFeature != BOOLEAN_FEATURE_EDEFAULT; + case TestModel1Package.TREE_NODE__INT_FEATURE: + return intFeature != INT_FEATURE_EDEFAULT; + case TestModel1Package.TREE_NODE__STRING_FEATURE: + return STRING_FEATURE_EDEFAULT == null ? stringFeature != null : !STRING_FEATURE_EDEFAULT + .equals(stringFeature); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (booleanFeature: "); + result.append(booleanFeature); + result.append(", intFeature: "); + result.append(intFeature); + result.append(", stringFeature: "); + result.append(stringFeature); + result.append(')'); + return result.toString(); + } + +} //TreeNodeImpl \ No newline at end of file diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1AdapterFactory.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1AdapterFactory.java new file mode 100644 index 0000000000..dd4732b893 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1AdapterFactory.java @@ -0,0 +1,176 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1.util; + + +import org.eclipse.emf.cdo.client.CDOPersistable; +import org.eclipse.emf.cdo.client.CDOPersistent; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import testmodel1.*; + + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see testmodel1.TestModel1Package + * @generated + */ +public class TestModel1AdapterFactory extends AdapterFactoryImpl +{ + /** + * The cached model package. + * + * + * @generated + */ + protected static TestModel1Package modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public TestModel1AdapterFactory() + { + if (modelPackage == null) + { + modelPackage = TestModel1Package.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + public boolean isFactoryForType(Object object) + { + if (object == modelPackage) + { + return true; + } + if (object instanceof EObject) + { + return ((EObject) object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch the delegates to the createXXX methods. + * + * + * @generated + */ + protected TestModel1Switch modelSwitch = new TestModel1Switch() + { + public Object caseTreeNode(TreeNode object) + { + return createTreeNodeAdapter(); + } + + public Object caseCDOPersistable(CDOPersistable object) + { + return createCDOPersistableAdapter(); + } + + public Object caseCDOPersistent(CDOPersistent object) + { + return createCDOPersistentAdapter(); + } + + public Object defaultCase(EObject object) + { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + public Adapter createAdapter(Notifier target) + { + return (Adapter) modelSwitch.doSwitch((EObject) target); + } + + /** + * Creates a new adapter for an object of class '{@link testmodel1.TreeNode Tree Node}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see testmodel1.TreeNode + * @generated + */ + public Adapter createTreeNodeAdapter() + { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.client.CDOPersistable Persistable}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.emf.cdo.client.CDOPersistable + * @generated + */ + public Adapter createCDOPersistableAdapter() + { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.client.CDOPersistent Persistent}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.emf.cdo.client.CDOPersistent + * @generated + */ + public Adapter createCDOPersistentAdapter() + { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() + { + return null; + } + +} //TestModel1AdapterFactory diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1Switch.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1Switch.java new file mode 100644 index 0000000000..6ed1b9681b --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1Switch.java @@ -0,0 +1,180 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1.util; + + +import java.util.List; + +import org.eclipse.emf.cdo.client.CDOPersistable; +import org.eclipse.emf.cdo.client.CDOPersistent; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; + +import testmodel1.*; + + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see testmodel1.TestModel1Package + * @generated + */ +public class TestModel1Switch +{ + /** + * The cached model package + * + * + * @generated + */ + protected static TestModel1Package modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public TestModel1Switch() + { + if (modelPackage == null) + { + modelPackage = TestModel1Package.eINSTANCE; + } + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + public Object doSwitch(EObject theEObject) + { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + protected Object doSwitch(EClass theEClass, EObject theEObject) + { + if (theEClass.eContainer() == modelPackage) + { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else + { + List eSuperTypes = theEClass.getESuperTypes(); + return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch( + (EClass) eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + protected Object doSwitch(int classifierID, EObject theEObject) + { + switch (classifierID) + { + case TestModel1Package.TREE_NODE: + { + TreeNode treeNode = (TreeNode) theEObject; + Object result = caseTreeNode(treeNode); + if (result == null) result = caseCDOPersistent(treeNode); + if (result == null) result = caseCDOPersistable(treeNode); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: + return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpretting the object as an instance of 'Tree Node'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'Tree Node'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public Object caseTreeNode(TreeNode object) + { + return null; + } + + /** + * Returns the result of interpretting the object as an instance of 'Persistable'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'Persistable'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public Object caseCDOPersistable(CDOPersistable object) + { + return null; + } + + /** + * Returns the result of interpretting the object as an instance of 'Persistent'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'Persistent'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public Object caseCDOPersistent(CDOPersistent object) + { + return null; + } + + /** + * Returns the result of interpretting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public Object defaultCase(EObject object) + { + return null; + } + +} //TestModel1Switch -- cgit v1.2.3