Enum MergeMode

java.lang.Object
java.lang.Enum<MergeMode>
org.eclipse.emf.compare.internal.merge.MergeMode
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<MergeMode>, java.lang.constant.Constable

public enum MergeMode
extends java.lang.Enum<MergeMode>
Enumeration of all ways of merging differences.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
  • Enum Constant Summary

    Enum Constants 
    Enum Constant Description
    ACCEPT
    Accept the diff to merge.
    LEFT_TO_RIGHT
    Merge from left to right.
    REJECT
    Reject the diff to merge.
    RIGHT_TO_LEFT
    Merge form right to left.
  • Method Summary

    Modifier and Type Method Description
    MergeOperation getMergeAction​(Diff difference, boolean isLeftEditable, boolean isRightEditable)
    Returns the required action to be done to the given difference in this mode.
    static MergeMode getMergeMode​(Diff diff, boolean leftEditable, boolean rightEditable)  
    DifferenceSource getMergeTarget​(boolean isLeftEditable, boolean isRightEditable)
    Returns the target of the merge with the given condition about the left and right sides.
    MergeMode inverse()
    Returns the inverse of this enum.
    boolean isLeftToRight​(boolean isLeftEditable, boolean isRightEditable)
    Returns if this mode will lead to merge to left to right depending whether left and/or right are editable.
    boolean isLeftToRight​(Diff diff, boolean isLeftEditable, boolean isRightEditable)
    To exactly know the way of merge (to compute consequences) we need the source of the diff.
    static MergeMode valueOf​(java.lang.String name)
    Returns the enum constant of this type with the specified name.
    static MergeMode[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Enum

    clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

  • Method Details

    • values

      public static MergeMode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static MergeMode valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
      java.lang.NullPointerException - if the argument is null
    • inverse

      public MergeMode inverse()
      Returns the inverse of this enum.
      Returns:
      the inverse of this enum.
    • getMergeTarget

      public DifferenceSource getMergeTarget​(boolean isLeftEditable, boolean isRightEditable)
      Returns the target of the merge with the given condition about the left and right sides.
      Parameters:
      isLeftEditable - is the left side editable.
      isRightEditable - is the right side editable.
      Returns:
      the target of the merge with the given condition about the left and right sides.
    • isLeftToRight

      public boolean isLeftToRight​(boolean isLeftEditable, boolean isRightEditable)
      Returns if this mode will lead to merge to left to right depending whether left and/or right are editable.
      Parameters:
      isLeftEditable - is left side of the comparison editable.
      isRightEditable - is right side of the comparison editable.
      Returns:
      if this mode will lead to merge to left to right depending whether left and/or right are editable.
    • isLeftToRight

      public boolean isLeftToRight​(Diff diff, boolean isLeftEditable, boolean isRightEditable)
      To exactly know the way of merge (to compute consequences) we need the source of the diff.
      Parameters:
      diff - the diff to merge.
      isLeftEditable - is left side of the comparison editable.
      isRightEditable - is right side of the comparison editable.
      Returns:
      the way of merge.
    • getMergeAction

      public MergeOperation getMergeAction​(Diff difference, boolean isLeftEditable, boolean isRightEditable)
      Returns the required action to be done to the given difference in this mode.
      Parameters:
      difference - the difference to analyze.
      isLeftEditable - is left side of the comparison editable.
      isRightEditable - is right side of the comparison editable.
      Returns:
      the required action to be done to the given difference in this mode.
    • getMergeMode

      public static MergeMode getMergeMode​(Diff diff, boolean leftEditable, boolean rightEditable)