## org.eclipse.emf.compare.diff.engine.check
Class AttributesCheck

    java.lang.Object
      org.eclipse.emf.compare.diff.engine.check.AbstractCheck
          org.eclipse.emf.compare.diff.engine.check.AttributesCheck

    public class AttributesCheck

extends AbstractCheck

This will implement the attribute checks : order of attribute values, changes between two versions, ...

Since:
  1.0

Field Summary

Fields inherited from class org.eclipse.emf.compare.diff.engine.check.AbstractCheck
`ANCESTOR_OBJECT, crossReferencer, LEFT_OBJECT, RIGHT_OBJECT`

Constructor Summary
`AttributesCheck(org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer referencer)` Simply delegates to the super constructor.

Method Summary
`protected boolean` `areDistinctValues(java.lang.Object left, java.lang.Object right)` This will be used internaly to check that an attribute's values have changed from one version to the other.
`protected boolean` `attributeListContains(java.util.List<java.lang.Object> values, java.lang.Object value)` This can be used to check that the given list contains the given value.
`void` `checkAttributesUpdates(DiffGroup root, Match2Elements mapping)` This will iterate through all the attributes of the `mapping`'s two elements to check if any of them has been modified.
`void` `checkAttributesUpdates(DiffGroup root, Match3Elements mapping)` This will iterate through all the attributes of the `mapping`'s three elements to check if any of them has been modified.
`protected void` `checkAttributeUpdates(DiffGroup root, Match2Elements mapping, org.eclipse.emf.ecore.EAttribute attribute)` This will check that the values of the given attribute from the objects contained by mapping has been modified.
`protected void` `checkAttributeUpdates(DiffGroup root, Match3Elements mapping, org.eclipse.emf.ecore.EAttribute attribute)` This will check that the values of the given attribute from the objects contained by mapping has been modified.
`protected boolean` `shouldBeIgnored(org.eclipse.emf.ecore.EAttribute attribute)` Determines if we should ignore an attribute for diff detection.

Methods inherited from class org.eclipse.emf.compare.diff.engine.check.AbstractCheck
`convertFeatureMapList, getMatchedEObject, getMatchedEObject, isUnmatched`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AttributesCheck

    public AttributesCheck(org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer referencer)

  Simply delegates to the super constructor.

  Parameters:
    `referencer` - CrossReferencer instantiated with the match model or match resource set.
  See Also:
    `AbstractCheck#DefaultCheck(org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer)}`

Method Detail

### checkAttributesUpdates

    public void checkAttributesUpdates(DiffGroup root,
                                       Match2Elements mapping)
                                throws FactoryException

  This will iterate through all the attributes of the `mapping`'s two elements to check if any of them has been modified.

  Parameters:
    `root` - `root` of the `DiffElement` to create if one of the attributes has actually been changed.
    `mapping` - This contains the mapping information about the elements we need to check.
  Throws:
    `FactoryException` - Thrown if one of the checks fails.

### checkAttributesUpdates

    public void checkAttributesUpdates(DiffGroup root,
                                       Match3Elements mapping)
                                throws FactoryException

  This will iterate through all the attributes of the `mapping`'s three elements to check if any of them has been modified.

  Parameters:
    `root` - `root` of the `DiffElement` to create if one of the attribute has actually been changed.
    `mapping` - This contains the mapping information about the elements we need to check for a move.
  Throws:
    `FactoryException` - Thrown if one of the checks fails.

### areDistinctValues

    protected boolean areDistinctValues(java.lang.Object left,
                                        java.lang.Object right)

  This will be used internaly to check that an attribute's values have changed from one version to the other.

  Specifically, this will check for :

  - Enumeration literals : if they have the same literal and integer values.
  - Feature Map Entries : if their respective values have been matched.
  - Arrays : compare the content of the two arrays.
  - Other : if the left value is equal to the right value or both are `null`.

  Parameters:
    `left` - The value of the attribute from the left compare resource.
    `right` - The value of the attribute from the right compare resource.
  Returns:
    `true` if the `left` value is distinct from the `right` value.

### attributeListContains

    protected final boolean attributeListContains(java.util.List<java.lang.Object> values,
                                                  java.lang.Object value)

  This can be used to check that the given list contains the given value. This will use the checks described in `areDistinctValues(Object, Object)`.

  Parameters:
    `values` - The list we need to check for a value equivalent to `value`.
    `value` - The value we need to know if it's contained by `values`.
  Returns:
    `true` if `areDistinctValues(Object, Object)` returned true for one of the objects contained by `values` when compared with `value`.

### checkAttributeUpdates

    protected void checkAttributeUpdates(DiffGroup root,
                                         Match2Elements mapping,
                                         org.eclipse.emf.ecore.EAttribute attribute)
                                  throws FactoryException

  This will check that the values of the given attribute from the objects contained by mapping has been modified.

  Parameters:
    `root` - `root` of the `DiffElement` to create if one of the attributes has actually been changed.
    `mapping` - This contains the mapping information about the elements we need to check.
    `attribute` - The attribute we need to check for differences.
  Throws:
    `FactoryException` - Thrown if one of the checks fails.
  Since:
    1.0

### checkAttributeUpdates

    protected void checkAttributeUpdates(DiffGroup root,
                                         Match3Elements mapping,
                                         org.eclipse.emf.ecore.EAttribute attribute)
                                  throws FactoryException

  This will check that the values of the given attribute from the objects contained by mapping has been modified.

  Parameters:
    `root` - `root` of the `DiffElement` to create if one of the attributes has actually been changed.
    `mapping` - This contains the mapping information about the elements we need to check.
    `attribute` - The attribute we need to check for differences.
  Throws:
    `FactoryException` - Thrown if one of the checks fails.
  Since:
    1.0

### shouldBeIgnored

    protected boolean shouldBeIgnored(org.eclipse.emf.ecore.EAttribute attribute)

  Determines if we should ignore an attribute for diff detection.

  Default is to ignore attributes marked either

  - Transient
  - Derived

  Clients should override this if they wish to ignore other attributes.

  Parameters:
    `attribute` - Attribute to determine whether it should be ignored.
  Returns:
    `True` if attribute has to be ignored, `False` otherwise.

Copyright 2006 IBM Corporation and others. All Rights Reserved.