本文整理汇总了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);
}