当前位置: 首页>>代码示例>>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;未经允许,请勿转载。