当前位置: 首页>>代码示例>>Java>>正文


Java EClass.getEPackage方法代码示例

本文整理汇总了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());
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:TypeCompareLogic.java

示例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");
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:15,代码来源:PackageMetaData.java

示例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);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:DefaultN4GlobalScopeProvider.java

示例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);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:N4JSGlobalScopeProvider.java

示例5: has

import org.eclipse.emf.ecore.EClass; //导入方法依赖的package包/类
private boolean has(EClass eClass) {
	return eClass.getEPackage() == ePackage;
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:4,代码来源:PackageMetaData.java

示例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);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:63,代码来源:TypeToEcore.java


注:本文中的org.eclipse.emf.ecore.EClass.getEPackage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。