Enum MergeMode

    • Enum Constant Detail

      • LEFT_TO_RIGHT

        public static final MergeMode LEFT_TO_RIGHT
        Merge from left to right.
      • RIGHT_TO_LEFT

        public static final MergeMode RIGHT_TO_LEFT
        Merge form right to left.
      • ACCEPT

        public static final MergeMode ACCEPT
        Accept the diff to merge.
      • REJECT

        public static final MergeMode REJECT
        Reject the diff to merge.
    • Method Detail

      • values

        public static MergeMode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (MergeMode c : MergeMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static MergeMode valueOf​(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:
        IllegalArgumentException - if this enum type has no constant with the specified name
        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)