blob: 8a9221d47f866a48b9c571252161d3fd5731c871 [file] [log] [blame]
/**
* Copyright (c) 2014 CEA LIST.
*
* 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:
* CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.dd.dc.impl;
import java.awt.Color;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EGenericType;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EValidator;
import org.eclipse.emf.ecore.impl.EPackageImpl;
import org.eclipse.papyrus.dd.dc.Bounds;
import org.eclipse.papyrus.dd.dc.DCFactory;
import org.eclipse.papyrus.dd.dc.DCPackage;
import org.eclipse.papyrus.dd.dc.Dimension;
import org.eclipse.papyrus.dd.dc.KnownColor;
import org.eclipse.papyrus.dd.dc.Point;
import org.eclipse.papyrus.dd.dc.util.DCValidator;
/**
* <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!--
* end-user-doc -->
*
* @generated
*/
public class DCPackageImpl extends EPackageImpl implements DCPackage {
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
private EClass pointEClass = null;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
private EClass dimensionEClass = null;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
private EClass boundsEClass = null;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
private EEnum knownColorEEnum = null;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
private EDataType booleanEDataType = null;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
private EDataType integerEDataType = null;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
private EDataType realEDataType = null;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
private EDataType stringEDataType = null;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
private EDataType colorEDataType = 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 org.eclipse.papyrus.dd.dc.DCPackage#eNS_URI
* @see #init()
* @generated
*/
private DCPackageImpl() {
super(eNS_URI, DCFactory.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 DCPackage#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 DCPackage init() {
if(isInited)
return (DCPackage)EPackage.Registry.INSTANCE.getEPackage(DCPackage.eNS_URI);
// Obtain or create and register package
DCPackageImpl theDCPackage = (DCPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof DCPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new DCPackageImpl());
isInited = true;
// Create package meta-data objects
theDCPackage.createPackageContents();
// Initialize created meta-data
theDCPackage.initializePackageContents();
// Register package validator
EValidator.Registry.INSTANCE.put(theDCPackage, new EValidator.Descriptor() {
public EValidator getEValidator() {
return DCValidator.INSTANCE;
}
});
// Mark meta-data to indicate it can't be changed
theDCPackage.freeze();
// Update the registry and return the package
EPackage.Registry.INSTANCE.put(DCPackage.eNS_URI, theDCPackage);
return theDCPackage;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EClass getPoint() {
return pointEClass;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EAttribute getPoint_X() {
return (EAttribute)pointEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EAttribute getPoint_Y() {
return (EAttribute)pointEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EClass getDimension() {
return dimensionEClass;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EAttribute getDimension_Width() {
return (EAttribute)dimensionEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EAttribute getDimension_Height() {
return (EAttribute)dimensionEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EOperation getDimension__NonNegativeWidth__DiagnosticChain_Map() {
return dimensionEClass.getEOperations().get(0);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EOperation getDimension__NonNegativeHeight__DiagnosticChain_Map() {
return dimensionEClass.getEOperations().get(1);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EClass getBounds() {
return boundsEClass;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EAttribute getBounds_X() {
return (EAttribute)boundsEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EAttribute getBounds_Y() {
return (EAttribute)boundsEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EAttribute getBounds_Width() {
return (EAttribute)boundsEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EAttribute getBounds_Height() {
return (EAttribute)boundsEClass.getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EOperation getBounds__NonNegativeWidth__DiagnosticChain_Map() {
return boundsEClass.getEOperations().get(0);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EOperation getBounds__NonNegativeHeight__DiagnosticChain_Map() {
return boundsEClass.getEOperations().get(1);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EEnum getKnownColor() {
return knownColorEEnum;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EDataType getBoolean() {
return booleanEDataType;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EDataType getInteger() {
return integerEDataType;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EDataType getReal() {
return realEDataType;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EDataType getString() {
return stringEDataType;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EDataType getColor() {
return colorEDataType;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public DCFactory getDCFactory() {
return (DCFactory)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
pointEClass = createEClass(POINT);
createEAttribute(pointEClass, POINT__X);
createEAttribute(pointEClass, POINT__Y);
dimensionEClass = createEClass(DIMENSION);
createEAttribute(dimensionEClass, DIMENSION__WIDTH);
createEAttribute(dimensionEClass, DIMENSION__HEIGHT);
createEOperation(dimensionEClass, DIMENSION___NON_NEGATIVE_WIDTH__DIAGNOSTICCHAIN_MAP);
createEOperation(dimensionEClass, DIMENSION___NON_NEGATIVE_HEIGHT__DIAGNOSTICCHAIN_MAP);
boundsEClass = createEClass(BOUNDS);
createEAttribute(boundsEClass, BOUNDS__X);
createEAttribute(boundsEClass, BOUNDS__Y);
createEAttribute(boundsEClass, BOUNDS__WIDTH);
createEAttribute(boundsEClass, BOUNDS__HEIGHT);
createEOperation(boundsEClass, BOUNDS___NON_NEGATIVE_WIDTH__DIAGNOSTICCHAIN_MAP);
createEOperation(boundsEClass, BOUNDS___NON_NEGATIVE_HEIGHT__DIAGNOSTICCHAIN_MAP);
// Create enums
knownColorEEnum = createEEnum(KNOWN_COLOR);
// Create data types
booleanEDataType = createEDataType(BOOLEAN);
integerEDataType = createEDataType(INTEGER);
realEDataType = createEDataType(REAL);
stringEDataType = createEDataType(STRING);
colorEDataType = createEDataType(COLOR);
}
/**
* <!-- 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
// Initialize classes, features, and operations; add parameters
initEClass(pointEClass, Point.class, "Point", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getPoint_X(), this.getReal(), "x", "0", 0, 1, Point.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(getPoint_Y(), this.getReal(), "y", "0", 0, 1, Point.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(dimensionEClass, Dimension.class, "Dimension", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getDimension_Width(), this.getReal(), "width", "0", 0, 1, Dimension.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(getDimension_Height(), this.getReal(), "height", "0", 0, 1, Dimension.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
EOperation op = initEOperation(getDimension__NonNegativeWidth__DiagnosticChain_Map(), ecorePackage.getEBoolean(), "nonNegativeWidth", 0, 1, IS_UNIQUE, IS_ORDERED);
addEParameter(op, ecorePackage.getEDiagnosticChain(), "diagnostics", 0, 1, IS_UNIQUE, IS_ORDERED);
EGenericType g1 = createEGenericType(ecorePackage.getEMap());
EGenericType g2 = createEGenericType(ecorePackage.getEJavaObject());
g1.getETypeArguments().add(g2);
g2 = createEGenericType(ecorePackage.getEJavaObject());
g1.getETypeArguments().add(g2);
addEParameter(op, g1, "context", 0, 1, IS_UNIQUE, IS_ORDERED);
op = initEOperation(getDimension__NonNegativeHeight__DiagnosticChain_Map(), ecorePackage.getEBoolean(), "nonNegativeHeight", 0, 1, IS_UNIQUE, IS_ORDERED);
addEParameter(op, ecorePackage.getEDiagnosticChain(), "diagnostics", 0, 1, IS_UNIQUE, IS_ORDERED);
g1 = createEGenericType(ecorePackage.getEMap());
g2 = createEGenericType(ecorePackage.getEJavaObject());
g1.getETypeArguments().add(g2);
g2 = createEGenericType(ecorePackage.getEJavaObject());
g1.getETypeArguments().add(g2);
addEParameter(op, g1, "context", 0, 1, IS_UNIQUE, IS_ORDERED);
initEClass(boundsEClass, Bounds.class, "Bounds", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getBounds_X(), this.getReal(), "x", "0", 0, 1, Bounds.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(getBounds_Y(), this.getReal(), "y", "0", 0, 1, Bounds.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(getBounds_Width(), this.getReal(), "width", "0", 0, 1, Bounds.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(getBounds_Height(), this.getReal(), "height", "0", 0, 1, Bounds.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
op = initEOperation(getBounds__NonNegativeWidth__DiagnosticChain_Map(), ecorePackage.getEBoolean(), "nonNegativeWidth", 0, 1, IS_UNIQUE, IS_ORDERED);
addEParameter(op, ecorePackage.getEDiagnosticChain(), "diagnostics", 0, 1, IS_UNIQUE, IS_ORDERED);
g1 = createEGenericType(ecorePackage.getEMap());
g2 = createEGenericType(ecorePackage.getEJavaObject());
g1.getETypeArguments().add(g2);
g2 = createEGenericType(ecorePackage.getEJavaObject());
g1.getETypeArguments().add(g2);
addEParameter(op, g1, "context", 0, 1, IS_UNIQUE, IS_ORDERED);
op = initEOperation(getBounds__NonNegativeHeight__DiagnosticChain_Map(), ecorePackage.getEBoolean(), "nonNegativeHeight", 0, 1, IS_UNIQUE, IS_ORDERED);
addEParameter(op, ecorePackage.getEDiagnosticChain(), "diagnostics", 0, 1, IS_UNIQUE, IS_ORDERED);
g1 = createEGenericType(ecorePackage.getEMap());
g2 = createEGenericType(ecorePackage.getEJavaObject());
g1.getETypeArguments().add(g2);
g2 = createEGenericType(ecorePackage.getEJavaObject());
g1.getETypeArguments().add(g2);
addEParameter(op, g1, "context", 0, 1, IS_UNIQUE, IS_ORDERED);
// Initialize enums and add enum literals
initEEnum(knownColorEEnum, KnownColor.class, "KnownColor");
addEEnumLiteral(knownColorEEnum, KnownColor.MAROON);
addEEnumLiteral(knownColorEEnum, KnownColor.RED);
addEEnumLiteral(knownColorEEnum, KnownColor.ORANGE);
addEEnumLiteral(knownColorEEnum, KnownColor.YELLOW);
addEEnumLiteral(knownColorEEnum, KnownColor.OLIVE);
addEEnumLiteral(knownColorEEnum, KnownColor.PURPLE);
addEEnumLiteral(knownColorEEnum, KnownColor.FUCHSIA);
addEEnumLiteral(knownColorEEnum, KnownColor.WHITE);
addEEnumLiteral(knownColorEEnum, KnownColor.LIME);
addEEnumLiteral(knownColorEEnum, KnownColor.GREEN);
addEEnumLiteral(knownColorEEnum, KnownColor.NAVY);
addEEnumLiteral(knownColorEEnum, KnownColor.BLUE);
addEEnumLiteral(knownColorEEnum, KnownColor.AQUA);
addEEnumLiteral(knownColorEEnum, KnownColor.TEAL);
addEEnumLiteral(knownColorEEnum, KnownColor.BLACK);
addEEnumLiteral(knownColorEEnum, KnownColor.SILVER);
addEEnumLiteral(knownColorEEnum, KnownColor.GRAY);
// Initialize data types
initEDataType(booleanEDataType, boolean.class, "Boolean", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
initEDataType(integerEDataType, int.class, "Integer", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
initEDataType(realEDataType, double.class, "Real", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
initEDataType(stringEDataType, String.class, "String", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
initEDataType(colorEDataType, Color.class, "Color", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
// Create resource
createResource(eNS_URI);
// Create annotations
// http://www.eclipse.org/emf/2002/Ecore
createEcoreAnnotations();
// http://www.eclipse.org/emf/2002/Ecore/OCL
createOCLAnnotations();
}
/**
* Initializes the annotations for <b>http://www.eclipse.org/emf/2002/Ecore</b>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected void createEcoreAnnotations() {
String source = "http://www.eclipse.org/emf/2002/Ecore";
addAnnotation(this, source, new String[]{ "validationDelegates", "http://www.eclipse.org/emf/2002/Ecore/OCL" });
}
/**
* Initializes the annotations for <b>http://www.eclipse.org/emf/2002/Ecore/OCL</b>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected void createOCLAnnotations() {
String source = "http://www.eclipse.org/emf/2002/Ecore/OCL";
addAnnotation(getDimension__NonNegativeWidth__DiagnosticChain_Map(), source, new String[]{ "body", "width >=0" });
addAnnotation(getDimension__NonNegativeHeight__DiagnosticChain_Map(), source, new String[]{ "body", "height >=0" });
addAnnotation(getBounds__NonNegativeWidth__DiagnosticChain_Map(), source, new String[]{ "body", "width >= 0" });
addAnnotation(getBounds__NonNegativeHeight__DiagnosticChain_Map(), source, new String[]{ "body", "height >=0" });
}
} // DCPackageImpl