org.eclipse.xtext.scoping
Class Scopes

java.lang.Object
  extended by org.eclipse.xtext.scoping.Scopes

public class Scopes
extends java.lang.Object

This class contains static utility functions to create and work on IScope and IEObjectDescription

Author:
Sven Efftinge - Initial contribution and API, Jan Koehnlein - introduced QualifiedName

Constructor Summary
Scopes()
           
 
Method Summary
static java.lang.Iterable<IEObjectDescription> filterDuplicates(java.lang.Iterable<IEObjectDescription> filtered)
           
static com.google.common.collect.Multimap<QualifiedName,IEObjectDescription> index(java.lang.Iterable<IEObjectDescription> descriptions)
          indexes the IEObject description using the given
static
<T> com.google.common.collect.Multimap<T,IEObjectDescription>
index(java.lang.Iterable<IEObjectDescription> descriptions, com.google.common.base.Function<IEObjectDescription,T> indexer)
          indexes the IEObject description using the given
static java.lang.Iterable<IEObjectDescription> scopedElementsFor(java.lang.Iterable<? extends org.eclipse.emf.ecore.EObject> elements)
          transforms an Iterable of EObjects into an Iterable of IEObjectDescriptions computing the EAttribute 'name' to compute the IEObjectDescription's name.
static
<T extends org.eclipse.emf.ecore.EObject>
java.lang.Iterable<IEObjectDescription>
scopedElementsFor(java.lang.Iterable<? extends T> elements, com.google.common.base.Function<T,QualifiedName> nameComputation)
          transforms an Iterable of EObjects into an Iterable of IEObjectDescriptions computing the name of the elements using the passed Function If the passed function returns null the object is filtered out.
static IScope scopeFor(java.lang.Iterable<? extends org.eclipse.emf.ecore.EObject> elements)
          creates a scope using SimpleAttributeResolver.NAME_RESOLVER to compute the names and sets IScope.NULLSCOPE as parent scope
static IScope scopeFor(java.lang.Iterable<? extends org.eclipse.emf.ecore.EObject> elements, IScope outer)
          creates a scope using SimpleAttributeResolver.NAME_RESOLVER to compute the names
static
<T extends org.eclipse.emf.ecore.EObject>
IScope
scopeFor(java.lang.Iterable<? extends T> elements, com.google.common.base.Function<T,QualifiedName> nameComputation, IScope outer)
          creates a scope using the passed function to compute the names and sets the passed scope as the parent scope
static java.lang.Iterable<IEObjectDescription> selectCompatible(java.lang.Iterable<IEObjectDescription> exportedObjects, org.eclipse.emf.ecore.EClass clazz)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scopes

public Scopes()
Method Detail

selectCompatible

public static java.lang.Iterable<IEObjectDescription> selectCompatible(java.lang.Iterable<IEObjectDescription> exportedObjects,
                                                                       org.eclipse.emf.ecore.EClass clazz)

scopeFor

public static IScope scopeFor(java.lang.Iterable<? extends org.eclipse.emf.ecore.EObject> elements)
creates a scope using SimpleAttributeResolver.NAME_RESOLVER to compute the names and sets IScope.NULLSCOPE as parent scope


scopeFor

public static IScope scopeFor(java.lang.Iterable<? extends org.eclipse.emf.ecore.EObject> elements,
                              IScope outer)
creates a scope using SimpleAttributeResolver.NAME_RESOLVER to compute the names


scopeFor

public static <T extends org.eclipse.emf.ecore.EObject> IScope scopeFor(java.lang.Iterable<? extends T> elements,
                                                                        com.google.common.base.Function<T,QualifiedName> nameComputation,
                                                                        IScope outer)
creates a scope using the passed function to compute the names and sets the passed scope as the parent scope


scopedElementsFor

public static java.lang.Iterable<IEObjectDescription> scopedElementsFor(java.lang.Iterable<? extends org.eclipse.emf.ecore.EObject> elements)
transforms an Iterable of EObjects into an Iterable of IEObjectDescriptions computing the EAttribute 'name' to compute the IEObjectDescription's name. If not existent the object is filtered out.


scopedElementsFor

public static <T extends org.eclipse.emf.ecore.EObject> java.lang.Iterable<IEObjectDescription> scopedElementsFor(java.lang.Iterable<? extends T> elements,
                                                                                                                  com.google.common.base.Function<T,QualifiedName> nameComputation)
transforms an Iterable of EObjects into an Iterable of IEObjectDescriptions computing the name of the elements using the passed Function If the passed function returns null the object is filtered out.


index

public static <T> com.google.common.collect.Multimap<T,IEObjectDescription> index(java.lang.Iterable<IEObjectDescription> descriptions,
                                                                                  com.google.common.base.Function<IEObjectDescription,T> indexer)
indexes the IEObject description using the given


index

public static com.google.common.collect.Multimap<QualifiedName,IEObjectDescription> index(java.lang.Iterable<IEObjectDescription> descriptions)
indexes the IEObject description using the given


filterDuplicates

public static java.lang.Iterable<IEObjectDescription> filterDuplicates(java.lang.Iterable<IEObjectDescription> filtered)