org.eclipse.emf.compare.match.eobject

## Class DefaultWeightProvider

- java.lang.Object
- - org.eclipse.emf.compare.match.eobject.AbstractWeightProvider
  - - org.eclipse.emf.compare.match.eobject.DefaultWeightProvider

All Implemented Interfaces:
  WeightProvider

Direct Known Subclasses:
  EcoreWeightProvider

    public class DefaultWeightProvider
    extends AbstractWeightProvider

The default implementation of `WeightProvider` applicable to all objects.

Since:
  3.1.0

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.eclipse.emf.compare.match.eobject.WeightProvider

`WeightProvider.Descriptor`

### Field Summary

Fields
`protected int` `attributeChangeCoef` Weight coefficient of a change on an attribute.
`protected int` `referenceChangeCoef` Weight coefficient of a change on a reference.
`protected Map<EStructuralFeature,Integer>` `weights` The list of specific weight to apply on specific Features.

### Fields inherited from class org.eclipse.emf.compare.match.eobject.AbstractWeightProvider

`MAJOR, MASSIVE, NORMAL, SIGNIFICANT, SMALL, UNLIKELY_TO_MATCH`

### Constructor Summary

Constructors
Constructor and Description
`DefaultWeightProvider()` Create the weight provider.

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `getContainingFeatureWeight(EObject a)` Return the weight associated with the fact some Object has changed it's containing reference.
`int` `getParentWeight(EObject a)` Return the weight associated with the fact some Object has changed it's container.
`int` `getWeight(EStructuralFeature feature)` Return the weight for the given feature.
`protected boolean` `irrelevant(EStructuralFeature feat)` return true i the feature is irrelevant for the comparison.

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

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

### Field Detail

#### weights

    protected Map<EStructuralFeature,Integer> weights

The list of specific weight to apply on specific Features.

#### referenceChangeCoef

    protected int referenceChangeCoef

Weight coefficient of a change on a reference.

#### attributeChangeCoef

    protected int attributeChangeCoef

Weight coefficient of a change on an attribute.

### Constructor Detail

#### DefaultWeightProvider

    public DefaultWeightProvider()

Create the weight provider.

### Method Detail

#### getWeight

    public int getWeight(EStructuralFeature feature)

Return the weight for the given feature.

Parameters:
  `feature` - any `EStructuralFeature`.
Returns:
  the weight for the given feature. 0 meaning no effects.

#### getParentWeight

    public int getParentWeight(EObject a)

Return the weight associated with the fact some Object has changed it's container.

Parameters:
  `a` - any instance.
Returns:
  a weight representing the importance of the change of container to compute matches.

#### getContainingFeatureWeight

    public int getContainingFeatureWeight(EObject a)

Return the weight associated with the fact some Object has changed it's containing reference.

Parameters:
  `a` - any instance.
Returns:
  a weight representing the importance of the change of containing reference to compute matches.

#### irrelevant

    protected boolean irrelevant(EStructuralFeature feat)

return true i the feature is irrelevant for the comparison.

Parameters:
  `feat` - any feature.
Returns:
  true i the feature is irrelevant for the comparison.