org.eclipse.xtext.xbase.linking
Class BestMatchingJvmFeatureScope

java.lang.Object
  extended by org.eclipse.xtext.xbase.linking.BestMatchingJvmFeatureScope
All Implemented Interfaces:
IScope

public class BestMatchingJvmFeatureScope
extends java.lang.Object
implements IScope

A scope which goes through all returned EObjectDescriptions in order to find the best fit, if it is asked for the 'first' element.

Author:
Sven Efftinge - Initial contribution and API

Field Summary
protected  org.eclipse.emf.ecore.EObject context
           
protected  org.eclipse.emf.ecore.EReference reference
           
 
Fields inherited from interface org.eclipse.xtext.scoping.IScope
NULLSCOPE
 
Constructor Summary
BestMatchingJvmFeatureScope(TypeConformanceComputer conformanceComputer, org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference ref, IScope delegate, FeatureCallChecker featureCallChecker, IRawTypeHelper rawTypeHelper)
           
 
Method Summary
 java.lang.Iterable<IEObjectDescription> getAllElements()
          Obtain all elements from the scope.
protected  JvmFeatureDescription getBestConformanceMatch(JvmFeatureDescription featureDescriptionA, JvmFeatureDescription featureDescriptionB)
           
protected  IEObjectDescription getBestMatch(IEObjectDescription a, IEObjectDescription b)
           
protected  IEObjectDescription getBestMatch(java.lang.Iterable<IEObjectDescription> iterable)
           
 java.lang.Iterable<IEObjectDescription> getElements(org.eclipse.emf.ecore.EObject object)
          Find all descriptions that match the given instance.
 java.lang.Iterable<IEObjectDescription> getElements(QualifiedName name)
          Find all descriptions that match the given name.
 IEObjectDescription getSingleElement(org.eclipse.emf.ecore.EObject object)
          Find the first description that matches the given instance.
 IEObjectDescription getSingleElement(QualifiedName name)
          Find the first description that matches the given name.
protected  IValidatedEObjectDescription selectByIssueCode(IValidatedEObjectDescription descA, IValidatedEObjectDescription descB)
           
protected  IEObjectDescription setImplicitReceiverAndIsValid(IEObjectDescription bestMatch)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

context

protected final org.eclipse.emf.ecore.EObject context

reference

protected final org.eclipse.emf.ecore.EReference reference
Constructor Detail

BestMatchingJvmFeatureScope

public BestMatchingJvmFeatureScope(TypeConformanceComputer conformanceComputer,
                                   org.eclipse.emf.ecore.EObject context,
                                   org.eclipse.emf.ecore.EReference ref,
                                   IScope delegate,
                                   FeatureCallChecker featureCallChecker,
                                   IRawTypeHelper rawTypeHelper)
Method Detail

getAllElements

public java.lang.Iterable<IEObjectDescription> getAllElements()
Description copied from interface: IScope
Obtain all elements from the scope. Implementors a free to throw an UnsupportedOperationException if the scope cannot be enumerated.

Specified by:
getAllElements in interface IScope
Returns:
all elements of the scope. Never null.

getElements

public java.lang.Iterable<IEObjectDescription> getElements(org.eclipse.emf.ecore.EObject object)
Description copied from interface: IScope
Find all descriptions that match the given instance.

Specified by:
getElements in interface IScope
Parameters:
object - the instance whose descriptions should be obtained. May not be null.
Returns:
all elements that match the instance. Never null.

getElements

public java.lang.Iterable<IEObjectDescription> getElements(QualifiedName name)
Description copied from interface: IScope
Find all descriptions that match the given name.

Specified by:
getElements in interface IScope
Parameters:
name - the name of the to-be-found elements. May not be null.
Returns:
all elements that match the name. Never null.

getSingleElement

public IEObjectDescription getSingleElement(org.eclipse.emf.ecore.EObject object)
Description copied from interface: IScope
Find the first description that matches the given instance.

Specified by:
getSingleElement in interface IScope
Parameters:
object - the instance whose description should be obtained. May not be null.
Returns:
the first element that matches the instance. May be null.

getSingleElement

public IEObjectDescription getSingleElement(QualifiedName name)
Description copied from interface: IScope
Find the first description that matches the given name.

Specified by:
getSingleElement in interface IScope
Parameters:
name - the name of the to-be-found element. May not be null.
Returns:
the first element that matches the name. May be null.

setImplicitReceiverAndIsValid

protected IEObjectDescription setImplicitReceiverAndIsValid(IEObjectDescription bestMatch)

getBestMatch

protected IEObjectDescription getBestMatch(java.lang.Iterable<IEObjectDescription> iterable)

getBestMatch

protected IEObjectDescription getBestMatch(IEObjectDescription a,
                                           IEObjectDescription b)

selectByIssueCode

protected IValidatedEObjectDescription selectByIssueCode(IValidatedEObjectDescription descA,
                                                         IValidatedEObjectDescription descB)

getBestConformanceMatch

protected JvmFeatureDescription getBestConformanceMatch(JvmFeatureDescription featureDescriptionA,
                                                        JvmFeatureDescription featureDescriptionB)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object