當前位置: 首頁>>代碼示例>>Java>>正文


Java EStructuralFeature.isChangeable方法代碼示例

本文整理匯總了Java中org.eclipse.emf.ecore.EStructuralFeature.isChangeable方法的典型用法代碼示例。如果您正苦於以下問題:Java EStructuralFeature.isChangeable方法的具體用法?Java EStructuralFeature.isChangeable怎麽用?Java EStructuralFeature.isChangeable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.emf.ecore.EStructuralFeature的用法示例。


在下文中一共展示了EStructuralFeature.isChangeable方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getInitialObjectNames

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames ()
{
    if ( initialObjectNames == null )
    {
        initialObjectNames = new ArrayList<String> ();
        for ( EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements ( ExtendedMetaData.INSTANCE.getDocumentRoot ( configurationPackage ) ) )
        {
            if ( eStructuralFeature.isChangeable () )
            {
                EClassifier eClassifier = eStructuralFeature.getEType ();
                if ( eClassifier instanceof EClass )
                {
                    EClass eClass = (EClass)eClassifier;
                    if ( !eClass.isAbstract () )
                    {
                        initialObjectNames.add ( eStructuralFeature.getName () );
                    }
                }
            }
        }
        Collections.sort ( initialObjectNames, CommonPlugin.INSTANCE.getComparator () );
    }
    return initialObjectNames;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:31,代碼來源:ConfigurationModelWizard.java

示例2: merge

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
private EObject merge(final EObject from, final EObject to, final Collection<Object> visitedObjects) {

		if (null == from || null == to) {
			return null;
		}

		// This is against cycles through EReferences.
		if (visitedObjects.contains(from) || visitedObjects.contains(to)) {
			return to;
		}

		visitedObjects.add(to);
		visitedObjects.add(from);

		final Collection<EStructuralFeature> fromFeatures = from.eClass().getEAllStructuralFeatures();

		for (final EStructuralFeature feature : fromFeatures) {
			if (-1 != to.eClass().getFeatureID(feature) && feature.isChangeable()) {
				if (from.eIsSet(feature)) {
					final Object fromValue = from.eGet(feature, true);
					final Object toValue = to.eGet(feature, true);
					if (null == toValue) {
						to.eSet(feature, fromValue);
					} else {
						if (feature.isMany()) {
							@SuppressWarnings("unchecked")
							final Collection<Object> toManyValue = (Collection<Object>) toValue;
							@SuppressWarnings("unchecked")
							final Collection<Object> fromManyValue = (Collection<Object>) fromValue;
							for (final Iterator<Object> itr = fromManyValue.iterator(); itr.hasNext(); /**/) {
								final Object fromElement = itr.next();
								if (!contains(toManyValue, fromElement)) {
									itr.remove();
									toManyValue.add(fromElement);
								}
							}
						} else {
							if (feature instanceof EAttribute) {
								to.eSet(feature, fromValue);
							} else if (feature instanceof EReference) {
								to.eSet(feature, merge((EObject) fromValue, (EObject) toValue, visitedObjects));
							}
						}
					}
				}
			}
		}
		return to;
	}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:50,代碼來源:EObjectFeatureMerger.java


注:本文中的org.eclipse.emf.ecore.EStructuralFeature.isChangeable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。