/**
* Copyright (c) 2012-2016 Marsha Chechik, Alessio Di Sandro, Michalis Famelis,
* Rick Salay.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alessio Di Sandro - Implementation.
*/
package edu.toronto.cs.se.modelepedia.relationaldatabase.impl;
import edu.toronto.cs.se.modelepedia.relationaldatabase.Column;
import edu.toronto.cs.se.modelepedia.relationaldatabase.ForeignKey;
import edu.toronto.cs.se.modelepedia.relationaldatabase.NamedElement;
import edu.toronto.cs.se.modelepedia.relationaldatabase.RelationalDatabase;
import edu.toronto.cs.se.modelepedia.relationaldatabase.RelationalDatabaseFactory;
import edu.toronto.cs.se.modelepedia.relationaldatabase.RelationalDatabasePackage;
import edu.toronto.cs.se.modelepedia.relationaldatabase.Table;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Package</b>.
* <!-- end-user-doc -->
* @generated
*/
public class RelationalDatabasePackageImpl extends EPackageImpl implements RelationalDatabasePackage {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass relationalDatabaseEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass namedElementEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass tableEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass columnEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass foreignKeyEClass = null;
/**
* Creates an instance of the model <b>Package</b>, registered with
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
* package URI value.
* <p>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.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.emf.ecore.EPackage.Registry
* @see edu.toronto.cs.se.modelepedia.relationaldatabase.RelationalDatabasePackage#eNS_URI
* @see #init()
* @generated
*/
private RelationalDatabasePackageImpl() {
super(eNS_URI, RelationalDatabaseFactory.eINSTANCE);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static boolean isInited = false;
/**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
*
* <p>This method is used to initialize {@link RelationalDatabasePackage#eINSTANCE} when that field is accessed.
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #eNS_URI
* @see #createPackageContents()
* @see #initializePackageContents()
* @generated
*/
public static RelationalDatabasePackage init() {
if (isInited) return (RelationalDatabasePackage)EPackage.Registry.INSTANCE.getEPackage(RelationalDatabasePackage.eNS_URI);
// Obtain or create and register package
RelationalDatabasePackageImpl theRelationalDatabasePackage = (RelationalDatabasePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof RelationalDatabasePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new RelationalDatabasePackageImpl());
isInited = true;
// Create package meta-data objects
theRelationalDatabasePackage.createPackageContents();
// Initialize created meta-data
theRelationalDatabasePackage.initializePackageContents();
// Mark meta-data to indicate it can't be changed
theRelationalDatabasePackage.freeze();
// Update the registry and return the package
EPackage.Registry.INSTANCE.put(RelationalDatabasePackage.eNS_URI, theRelationalDatabasePackage);
return theRelationalDatabasePackage;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getRelationalDatabase() {
return relationalDatabaseEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getRelationalDatabase_Tables() {
return (EReference)relationalDatabaseEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getNamedElement() {
return namedElementEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getNamedElement_Name() {
return (EAttribute)namedElementEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getTable() {
return tableEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTable_Columns() {
return (EReference)tableEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTable_PrimaryKey() {
return (EReference)tableEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTable_ForeignKeys() {
return (EReference)tableEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getColumn() {
return columnEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getColumn_Table() {
return (EReference)columnEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getColumn_TableAsPrimaryKey() {
return (EReference)columnEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getColumn_ForeignKeysAsColumn() {
return (EReference)columnEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getColumn_ForeignKeysAsForeignColumn() {
return (EReference)columnEClass.getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getForeignKey() {
return foreignKeyEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getForeignKey_TableColumn() {
return (EReference)foreignKeyEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getForeignKey_ForeignColumn() {
return (EReference)foreignKeyEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getForeignKey_Table() {
return (EReference)foreignKeyEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public RelationalDatabaseFactory getRelationalDatabaseFactory() {
return (RelationalDatabaseFactory)getEFactoryInstance();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void createPackageContents() {
if (isCreated) return;
isCreated = true;
// Create classes and their features
relationalDatabaseEClass = createEClass(RELATIONAL_DATABASE);
createEReference(relationalDatabaseEClass, RELATIONAL_DATABASE__TABLES);
namedElementEClass = createEClass(NAMED_ELEMENT);
createEAttribute(namedElementEClass, NAMED_ELEMENT__NAME);
tableEClass = createEClass(TABLE);
createEReference(tableEClass, TABLE__COLUMNS);
createEReference(tableEClass, TABLE__PRIMARY_KEY);
createEReference(tableEClass, TABLE__FOREIGN_KEYS);
columnEClass = createEClass(COLUMN);
createEReference(columnEClass, COLUMN__TABLE);
createEReference(columnEClass, COLUMN__TABLE_AS_PRIMARY_KEY);
createEReference(columnEClass, COLUMN__FOREIGN_KEYS_AS_COLUMN);
createEReference(columnEClass, COLUMN__FOREIGN_KEYS_AS_FOREIGN_COLUMN);
foreignKeyEClass = createEClass(FOREIGN_KEY);
createEReference(foreignKeyEClass, FOREIGN_KEY__TABLE_COLUMN);
createEReference(foreignKeyEClass, FOREIGN_KEY__FOREIGN_COLUMN);
createEReference(foreignKeyEClass, FOREIGN_KEY__TABLE);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void initializePackageContents() {
if (isInitialized) return;
isInitialized = true;
// Initialize package
setName(eNAME);
setNsPrefix(eNS_PREFIX);
setNsURI(eNS_URI);
// Create type parameters
// Set bounds for type parameters
// Add supertypes to classes
tableEClass.getESuperTypes().add(this.getNamedElement());
columnEClass.getESuperTypes().add(this.getNamedElement());
foreignKeyEClass.getESuperTypes().add(this.getNamedElement());
// Initialize classes, features, and operations; add parameters
initEClass(relationalDatabaseEClass, RelationalDatabase.class, "RelationalDatabase", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getRelationalDatabase_Tables(), this.getTable(), null, "tables", null, 0, -1, RelationalDatabase.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(namedElementEClass, NamedElement.class, "NamedElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getNamedElement_Name(), ecorePackage.getEString(), "name", null, 1, 1, NamedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(tableEClass, Table.class, "Table", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getTable_Columns(), this.getColumn(), this.getColumn_Table(), "columns", null, 1, -1, Table.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getTable_PrimaryKey(), this.getColumn(), this.getColumn_TableAsPrimaryKey(), "primaryKey", null, 1, 1, Table.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getTable_ForeignKeys(), this.getForeignKey(), this.getForeignKey_Table(), "foreignKeys", null, 0, -1, Table.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(columnEClass, Column.class, "Column", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getColumn_Table(), this.getTable(), this.getTable_Columns(), "table", null, 1, 1, Column.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getColumn_TableAsPrimaryKey(), this.getTable(), this.getTable_PrimaryKey(), "tableAsPrimaryKey", null, 0, 1, Column.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getColumn_ForeignKeysAsColumn(), this.getForeignKey(), this.getForeignKey_TableColumn(), "foreignKeysAsColumn", null, 0, -1, Column.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getColumn_ForeignKeysAsForeignColumn(), this.getForeignKey(), this.getForeignKey_ForeignColumn(), "foreignKeysAsForeignColumn", null, 0, -1, Column.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(foreignKeyEClass, ForeignKey.class, "ForeignKey", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getForeignKey_TableColumn(), this.getColumn(), this.getColumn_ForeignKeysAsColumn(), "tableColumn", null, 1, 1, ForeignKey.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getForeignKey_ForeignColumn(), this.getColumn(), this.getColumn_ForeignKeysAsForeignColumn(), "foreignColumn", null, 1, 1, ForeignKey.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getForeignKey_Table(), this.getTable(), this.getTable_ForeignKeys(), "table", null, 1, 1, ForeignKey.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Create resource
createResource(eNS_URI);
// Create annotations
// gmf.diagram
createGmfAnnotations();
// gmf.node
createGmf_1Annotations();
// gmf.compartment
createGmf_2Annotations();
// gmf.link
createGmf_3Annotations();
}
/**
* Initializes the annotations for <b>gmf.diagram</b>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void createGmfAnnotations() {
String source = "gmf.diagram";
addAnnotation
(relationalDatabaseEClass,
source,
new String[] {
});
}
/**
* Initializes the annotations for <b>gmf.node</b>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void createGmf_1Annotations() {
String source = "gmf.node";
addAnnotation
(tableEClass,
source,
new String[] {
"label", "name"
});
addAnnotation
(columnEClass,
source,
new String[] {
"label", "name"
});
addAnnotation
(foreignKeyEClass,
source,
new String[] {
"label", "name"
});
}
/**
* Initializes the annotations for <b>gmf.compartment</b>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void createGmf_2Annotations() {
String source = "gmf.compartment";
addAnnotation
(getTable_Columns(),
source,
new String[] {
"layout", "list"
});
addAnnotation
(getTable_ForeignKeys(),
source,
new String[] {
"layout", "list"
});
}
/**
* Initializes the annotations for <b>gmf.link</b>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void createGmf_3Annotations() {
String source = "gmf.link";
addAnnotation
(getForeignKey_TableColumn(),
source,
new String[] {
"target.decoration", "none"
});
addAnnotation
(getForeignKey_ForeignColumn(),
source,
new String[] {
"target.decoration", "none"
});
}
} //RelationalDatabasePackageImpl