當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。