Class ByTypeIndex
- java.lang.Object
-
- org.eclipse.emf.compare.match.eobject.internal.ByTypeIndex
-
- All Implemented Interfaces:
EObjectIndex
,MatchAheadOfTime
public class ByTypeIndex extends Object implements EObjectIndex, MatchAheadOfTime
An implementation of EObjectIndex which segregates given EObjects using their type and then delegate to other indexes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.emf.compare.match.eobject.EObjectIndex
EObjectIndex.Side
-
-
Constructor Summary
Constructors Constructor Description ByTypeIndex(ProximityEObjectMatcher.DistanceFunction meter, ScopeQuery scope)
Create a new instance using the givenProximityEObjectMatcher.DistanceFunction
to instantiate delegate indexes on demand.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<EObjectIndex.Side,EObject>
findClosests(Comparison inProgress, EObject obj, EObjectIndex.Side side)
Return the closest EObjects found in other sides than the one given.Iterable<EObject>
getValuesStillThere(EObjectIndex.Side side)
return the list of EObjects of a given side still available in the index.Iterable<EObject>
getValuesToMatchAhead(EObjectIndex.Side side)
Return EObjects to match ahead of time if there are some.void
index(EObject eObjs, EObjectIndex.Side side)
Register an Object in the index with the given side.void
remove(EObject obj, EObjectIndex.Side side)
Remove an object from the index.
-
-
-
Constructor Detail
-
ByTypeIndex
public ByTypeIndex(ProximityEObjectMatcher.DistanceFunction meter, ScopeQuery scope)
Create a new instance using the givenProximityEObjectMatcher.DistanceFunction
to instantiate delegate indexes on demand.- Parameters:
meter
- the function passed when instantiating delegate indexes.scope
- an instance
-
-
Method Detail
-
getValuesStillThere
public Iterable<EObject> getValuesStillThere(EObjectIndex.Side side)
return the list of EObjects of a given side still available in the index.- Specified by:
getValuesStillThere
in interfaceEObjectIndex
- Parameters:
side
- the side we are looking for.- Returns:
- the list of EObjects of a given side still available in the index.
- See Also:
EObjectIndex.getValuesStillThere(org.eclipse.emf.compare.match.eobject.EObjectIndex.Side)
-
findClosests
public Map<EObjectIndex.Side,EObject> findClosests(Comparison inProgress, EObject obj, EObjectIndex.Side side)
Return the closest EObjects found in other sides than the one given.- Specified by:
findClosests
in interfaceEObjectIndex
- Parameters:
inProgress
- the comparison currently being computed. It will not be changed directly but only queried to know if some element has already been matched or not.obj
- the base EObject used to lookup similar ones.side
- the side of the passed EObject.- Returns:
- a map of Side, EObjects, returning all the found objects (and the passed one) which are the closests.
- See Also:
org.eclipse.emf.compare.match.eobject.EObjectIndex#findClosests(org.eclipse.emf.ecore.EObject, org.eclipse.emf.compare.match.eobject.EObjectIndex.Side, int)
-
remove
public void remove(EObject obj, EObjectIndex.Side side)
Remove an object from the index.- Specified by:
remove
in interfaceEObjectIndex
- Parameters:
obj
- object to remove.side
- Side in which this object was.- See Also:
EObjectIndex.remove(org.eclipse.emf.ecore.EObject, org.eclipse.emf.compare.match.eobject.EObjectIndex.Side)
-
index
public void index(EObject eObjs, EObjectIndex.Side side)
Register an Object in the index with the given side.- Specified by:
index
in interfaceEObjectIndex
- Parameters:
eObjs
- theEObject
to register.side
- the side in which it should be registered.- See Also:
EObjectIndex.index(org.eclipse.emf.ecore.EObject, org.eclipse.emf.compare.match.eobject.EObjectIndex.Side)
-
getValuesToMatchAhead
public Iterable<EObject> getValuesToMatchAhead(EObjectIndex.Side side)
Return EObjects to match ahead of time if there are some.- Specified by:
getValuesToMatchAhead
in interfaceMatchAheadOfTime
- Parameters:
side
- the side to look for.- Returns:
- the EObjects to match ahead of time.
-
-