本文整理匯總了Java中org.eclipse.emf.ecore.EClass.getEPackage方法的典型用法代碼示例。如果您正苦於以下問題:Java EClass.getEPackage方法的具體用法?Java EClass.getEPackage怎麽用?Java EClass.getEPackage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.emf.ecore.EClass
的用法示例。
在下文中一共展示了EClass.getEPackage方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: compareEClasses
import org.eclipse.emf.ecore.EClass; //導入方法依賴的package包/類
private static int compareEClasses(EClass ec1, EClass ec2) {
if (ec1 == ec2) {
return 0;
}
if (ec1 == null) {
return -1;
}
if (ec2 == null) {
return 1;
}
if (ec1.getEPackage() == ec2.getEPackage()) {
return ec1.getClassifierID() - ec2.getClassifierID();
} else {
// NsURIs are to be different!
return ec1.getEPackage().getNsURI().compareTo(ec2.getEPackage().getNsURI());
}
}
示例2: create
import org.eclipse.emf.ecore.EClass; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public <T extends IdEObject> T create(EClass eClass) {
if (eClass.getEPackage() == ePackage) {
return (T) ePackage.getEFactoryInstance().create(eClass);
} else {
for (PackageMetaData dep : dependencies) {
if (dep.has(eClass)) {
return dep.create(eClass);
}
}
}
throw new RuntimeException("Mismatch");
}
示例3: isSubtypeOfType
import org.eclipse.emf.ecore.EClass; //導入方法依賴的package包/類
/**
* Returns <code>true</code> if the given {@code type} is a subtype of {@link Type}.
*/
protected boolean isSubtypeOfType(EClass type) {
return type == TypesPackage.Literals.TYPE || type.getEPackage() == TypesPackage.eINSTANCE
&& TypesPackage.Literals.TYPE.isSuperTypeOf(type);
}
示例4: isSubtypeOfIdentifiable
import org.eclipse.emf.ecore.EClass; //導入方法依賴的package包/類
/**
* Returns <code>true</code> if the given {@code type} is a subtype of {@link IdentifiableElement}.
*/
protected boolean isSubtypeOfIdentifiable(EClass type) {
return type == TypesPackage.Literals.IDENTIFIABLE_ELEMENT || type.getEPackage() == TypesPackage.eINSTANCE
&& TypesPackage.Literals.IDENTIFIABLE_ELEMENT.isSuperTypeOf(type);
}
示例5: has
import org.eclipse.emf.ecore.EClass; //導入方法依賴的package包/類
private boolean has(EClass eClass) {
return eClass.getEPackage() == ePackage;
}
示例6: visit
import org.eclipse.emf.ecore.EClass; //導入方法依賴的package包/類
@Override
public void visit(Container container, String param) {
if (hasElement(container)) {
return;
}
// Create class for container
EClass eContainerClass = g_EcoreFactory.createEClass();
setElement(container, eContainerClass);
this.nrContainer++;
eContainerClass.setName("ContainerClass_" + this.nrContainer);
// Find matching field and package
EPackage containerPackage = null;
Container topContainer = container;
while (topContainer.getParent() != null) {
topContainer = topContainer.getParent();
}
if (topContainer.getField() != null) {
Field f = topContainer.getField();
Class c = f.getDefiningClass();
EClass eClass = (EClass) getElement(c);
containerPackage = eClass.getEPackage();
} else {
containerPackage = packageFromId(Id.ROOT);
}
containerPackage.getEClassifiers()
.add(eContainerClass);
// Create value reference
EStructuralFeature eContainerFeature = null;
if (container.getType() instanceof Class || container.getType() instanceof Tuple
|| container.getType() instanceof Container) {
// Create EReference
eContainerFeature = g_EcoreFactory.createEReference();
} else {
// Create EAttribute
eContainerFeature = g_EcoreFactory.createEAttribute();
}
eContainerFeature.setName("value");
if (container.getType() instanceof Container) {
Container subType = (Container) container.getType();
eContainerFeature.setOrdered(
subType.getContainerType() == Kind.ORD || subType.getContainerType() == Kind.SEQ);
eContainerFeature.setUnique(
subType.getContainerType() == Kind.SET || subType.getContainerType() == Kind.ORD);
} else {
eContainerFeature.setOrdered(false);
eContainerFeature.setUnique(true);
}
EObject eType = getElement(container.getType());
eContainerFeature.setEType((EClassifier) eType);
eContainerFeature.setUpperBound(ETypedElement.UNBOUNDED_MULTIPLICITY);
eContainerFeature.setLowerBound(0);
eContainerClass.getEStructuralFeatures()
.add(eContainerFeature);
}