Class TypeConformanceComputer.MaxDistanceRawTypeAcceptor
- java.lang.Object
-
- org.eclipse.xtext.xbase.typesystem.conformance.TypeConformanceComputer.MaxDistanceRawTypeAcceptor
-
- All Implemented Interfaces:
SuperTypeAcceptor
- Enclosing class:
- TypeConformanceComputer
protected static class TypeConformanceComputer.MaxDistanceRawTypeAcceptor extends java.lang.Object implements SuperTypeAcceptor
Populates aMultiset
with the maximum number of necessary steps from a given type to its super types. Sorting the set by the steps creates a stable order on from the direct super class, the most specialized implemented interfaces up to object. E.g. althoughStringBuilder
implementsSerializable
andCharSequence
, serializable is treated as more specific by this algorithm since the super class AbstractStringBuilder implementsCharSequence
, too. Thus the number of steps toSerializable
is1
whileCharSequence
requires2
hops.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MaxDistanceRawTypeAcceptor(com.google.common.collect.Multiset<org.eclipse.xtext.common.types.JvmType> result, com.google.common.collect.Multimap<org.eclipse.xtext.common.types.JvmType,LightweightTypeReference> all)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(LightweightTypeReference superType, int distance)
-
-
-
Constructor Detail
-
MaxDistanceRawTypeAcceptor
protected MaxDistanceRawTypeAcceptor(com.google.common.collect.Multiset<org.eclipse.xtext.common.types.JvmType> result, com.google.common.collect.Multimap<org.eclipse.xtext.common.types.JvmType,LightweightTypeReference> all)
-
-
Method Detail
-
accept
public boolean accept(LightweightTypeReference superType, int distance)
- Specified by:
accept
in interfaceSuperTypeAcceptor
- Parameters:
superType
- a visited super typedistance
- the distance to the starting type. StringBuilder has a distance 1 to AbstractStringBuilder, distance 1 and 2 to CharSequence and distance 2 to Appendable.
-
-