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


Java EObject.eAllContents方法代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.EObject.eAllContents方法的典型用法代码示例。如果您正苦于以下问题:Java EObject.eAllContents方法的具体用法?Java EObject.eAllContents怎么用?Java EObject.eAllContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.ecore.EObject的用法示例。


在下文中一共展示了EObject.eAllContents方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: collectReferencedTypeVars

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
private static Set<TypeVariable> collectReferencedTypeVars(EObject obj, boolean includeChildren,
		Set<TypeVariable> addHere) {
	final Type declType = obj instanceof TypeRef ? ((TypeRef) obj).getDeclaredType() : null;
	if (declType instanceof TypeVariable) {
		addHere.add((TypeVariable) declType);
	}
	if (obj instanceof StructuralTypeRef) {
		for (TStructMember m : ((StructuralTypeRef) obj).getStructuralMembers()) {
			collectReferencedTypeVars(m, true, addHere);
		}
	}
	if (includeChildren) {
		final Iterator<EObject> iter = obj.eAllContents();
		while (iter.hasNext()) {
			collectReferencedTypeVars(iter.next(), false, addHere);
		}
	}
	return addHere;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:TypeUtils.java

示例2: collectNodes

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
/**
 * Search entire containment tree below 'root' for objects of type 'cls'. If last argument is <code>false</code>,
 * then sub trees below a matching node won't be searched.
 */
public static final <T extends EObject> List<T> collectNodes(EObject root, Class<T> cls,
		boolean searchForNestedNodes) {
	final List<T> result = new ArrayList<>();
	final TreeIterator<EObject> iter = root.eAllContents();
	while (iter.hasNext()) {
		final EObject obj = iter.next();
		if (cls.isAssignableFrom(obj.getClass())) {
			@SuppressWarnings("unchecked")
			final T objCasted = (T) obj;
			result.add(objCasted);
			if (!searchForNestedNodes)
				iter.prune();
		}
	}
	return result;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:TranspilerUtils.java

示例3: collectNodesWithinSameThisEnvironment

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
/**
 * root usually a function or other ThisProviding environment.
 *
 * @param root
 *            function or method.
 * @param cls
 *            Type of element to report.
 * @return nodes of (sub-)type cls in the same this-environment
 */
public static final <T extends EObject> List<T> collectNodesWithinSameThisEnvironment(EObject root, Class<T> cls) {
	final List<T> result = new ArrayList<>();
	final TreeIterator<EObject> iter = root.eAllContents();
	while (iter.hasNext()) {
		final EObject obj = iter.next();
		if (cls.isAssignableFrom(obj.getClass())) {
			@SuppressWarnings("unchecked")
			final T objCasted = (T) obj;
			result.add(objCasted);
		}
		// check for same environment
		if (obj instanceof ThisArgProvider) {
			iter.prune();
		}
	}
	return result;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:TranspilerUtils.java

示例4: exposeTypesReferencedBy

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
private static void exposeTypesReferencedBy(EObject root) {
	final TreeIterator<EObject> i = root.eAllContents();
	while (i.hasNext()) {
		final EObject object = i.next();
		for (EReference currRef : object.eClass().getEAllReferences()) {
			if (!currRef.isContainment() && !currRef.isContainer()) {
				final Object currTarget = object.eGet(currRef);
				if (currTarget instanceof Collection<?>) {
					for (Object currObj : (Collection<?>) currTarget) {
						exposeType(currObj);
					}
				} else {
					exposeType(currTarget);
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:N4JSPostProcessor.java

示例5: run

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
public boolean run ( final EObject element, final DiagnosticChain diagnostics, final Map<Object, Object> context )
{
    if ( element == null )
    {
        return true;
    }

    boolean result = runElement ( element, diagnostics, context );

    final TreeIterator<EObject> it = element.eAllContents ();
    while ( it.hasNext () )
    {
        if ( !runElement ( it.next (), diagnostics, context ) )
        {
            result = false;
        }
    }

    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:ValidationRunner.java

示例6: assertNoDanglingReferences

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
/**
 * Asserts that root and the entire object tree below root does not contain any dangling references, i.e.
 * cross-references to target {@link EObject}s that are not contained in a {@link Resource}.
 */
public void assertNoDanglingReferences(EObject root) {
	final List<String> errMsgs = new ArrayList<>();
	final TreeIterator<EObject> iter = root.eAllContents();
	while (iter.hasNext()) {
		final EObject currObj = iter.next();
		if (currObj != null && !currObj.eIsProxy()) {
			for (EReference currRef : currObj.eClass().getEAllReferences()) {
				if (!currRef.isContainment() && !currRef.isContainer() && currRef.getEOpposite() == null) {
					if (currRef.isMany()) {
						@SuppressWarnings("unchecked")
						final EList<? extends EObject> targets = (EList<? extends EObject>) currObj.eGet(currRef,
								false);
						for (EObject currTarget : targets) {
							if (isDangling(currTarget)) {
								errMsgs.add(getErrorInfoForDanglingEObject(currObj, currRef));
								break;
							}
						}
					} else {
						final EObject target = (EObject) currObj.eGet(currRef, false);
						if (isDangling(target))
							errMsgs.add(getErrorInfoForDanglingEObject(currObj, currRef));
					}
				}
			}
		}
	}
	if (!errMsgs.isEmpty())
		fail("Expected no dangling references, but found the following: " + Joiner.on("; ").join(errMsgs) + ".");
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:35,代码来源:N4JSValidationTestHelper.java

示例7: containsDeferredTypeRefs

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
/**
 * Tells if the given object contains a {@link DeferredTypeRef}.
 */
public static boolean containsDeferredTypeRefs(EObject object) {
	final Iterator<EObject> i = object.eAllContents();
	while (i.hasNext()) {
		Object local = i.next();
		if (local instanceof DeferredTypeRef) {
			return true;
		}
	}
	return false;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:TypeUtils.java

示例8: isOrContainsRefToTypeVar

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
private static boolean isOrContainsRefToTypeVar(EObject obj, boolean checkForInfVars, TypeVariable... typeVars) {
	if (obj == null)
		return false;
	if (isRefToTypeVar(obj, checkForInfVars, typeVars))
		return true;
	final Iterator<EObject> iter = obj.eAllContents();
	while (iter.hasNext()) {
		if (isRefToTypeVar(iter.next(), checkForInfVars, typeVars))
			return true;
	}
	return false;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:13,代码来源:TypeUtils.java

示例9: getAllContentsOfTypeStopAt

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static <T> List<T> getAllContentsOfTypeStopAt(boolean findFirst, EObject eobj, final Class<T> filterType,
		final EReference... stopReferences) {

	if (eobj == null) {
		return Collections.EMPTY_LIST;
	}

	List<EReference> stopReferencesL = Arrays.asList(stopReferences);
	List<T> contentList = new LinkedList<>();
	TreeIterator<EObject> tIter = eobj.eAllContents();

	while (tIter.hasNext()) {
		EObject eObj = tIter.next();
		EReference eRef = eObj.eContainmentFeature();
		if (stopReferencesL != null && stopReferencesL.contains(eRef)) {
			tIter.prune();
		} else {
			if (filterType.isInstance(eObj)) {
				contentList.add((T) eObj);
				if (findFirst) {
					return contentList;
				}
			}
		}
	}

	return contentList;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:30,代码来源:EcoreUtilN4.java

示例10: getGeneratedElement

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
private static EObject getGeneratedElement(EObject generatedRoot, EObject existing) {
	if (areEquivalent(generatedRoot, existing)) {
		return generatedRoot;
	}
	for (Iterator<EObject> iterator = generatedRoot.eAllContents(); iterator.hasNext();) {
		EObject generated = iterator.next();
		if (areEquivalent(generated, existing)) {
			return generated;
		}
	}
	return null;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:13,代码来源:ConverterUtils.java


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