org.eclipse.emf.compare.match.eobject.internal

## 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 and Description
`ByTypeIndex(ProximityEObjectMatcher.DistanceFunction meter, ScopeQuery scope)` Create a new instance using the given `ProximityEObjectMatcher.DistanceFunction` to instantiate delegate indexes on demand.

### Method Summary

All Methods Instance Methods Concrete Methods
`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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ByTypeIndex

    public ByTypeIndex(ProximityEObjectMatcher.DistanceFunction meter,
                       ScopeQuery scope)

Create a new instance using the given `ProximityEObjectMatcher.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 interface `EObjectIndex`
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 interface `EObjectIndex`
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 interface `EObjectIndex`
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 interface `EObjectIndex`
Parameters:
  `eObjs` - the `EObject` 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 interface `MatchAheadOfTime`
Parameters:
  `side` - the side to look for.
Returns:
  the EObjects to match ahead of time.