Class FunctionTagMerger

  • All Implemented Interfaces:
    ListingMergeConstants, MergeResolver

    public class FunctionTagMerger
    extends java.lang.Object
    implements MergeResolver, ListingMergeConstants
    Class for merging function tag changes. Most tag differences can be easily auto-merged, which is to say the result will be the set of all of tags from both program 1 and program 2. Conflicts arise when both parties have edited/deleted the same tag. The specific cases handled by the class are described below, where: - X and Y are tags - X(A) means to take A's version of tag X - ** indicates a conflict - NP means the situation is not possible User A | Add X Add Y Delete X Delete Y Edit X Edit Y | User B | --------------------------------------------------------------------------- Add X | X X,Y NP X NP X,Y(A) | Add Y | X,Y Y Y NP X(A),Y NP | Delete X | NP Y - - ** Y(A) | Delete Y | X NP - - X(A) ** | Edit X | NP X(B),Y ** X(B) ** X(B),Y(A) | Edit Y | X,Y(B) NP Y(B) ** X(A),Y(B) **
    • Constructor Detail

      • FunctionTagMerger

        public FunctionTagMerger​(ProgramMultiUserMergeManager mergeManager,
                                 Program resultPgm,
                                 Program originalPgm,
                                 Program latestPgm,
                                 Program myPgm,
                                 ProgramChangeSet latestChanges,
                                 ProgramChangeSet myChanges)
        Constructor.
        Parameters:
        mergeManager - the merge manager
        resultPgm - the program storing the result of the merge
        originalPgm - the state of the program before any changes
        latestPgm - the checked in program version
        myPgm - the checked out program version
        latestChanges - tag changes in Latest
        myChanges - tag changes in My
    • Method Detail

      • getName

        public java.lang.String getName()
        PUBLIC METHODS
        Specified by:
        getName in interface MergeResolver
      • getDescription

        public java.lang.String getDescription()
        Description copied from interface: MergeResolver
        Get the description of what this MergeResolver does.
        Specified by:
        getDescription in interface MergeResolver
      • apply

        public void apply()
        Description copied from interface: MergeResolver
        Notification that the apply button was hit.
        Specified by:
        apply in interface MergeResolver
      • cancel

        public void cancel()
        Description copied from interface: MergeResolver
        Notification that the merge process was canceled.
        Specified by:
        cancel in interface MergeResolver
      • merge

        public void merge​(TaskMonitor monitor)
                   throws java.lang.Exception
        Description copied from interface: MergeResolver
        Perform the merge process.
        Specified by:
        merge in interface MergeResolver
        Parameters:
        monitor - monitor that allows the user to cancel the merge operation
        Throws:
        java.lang.Exception - if the merge encounters an error and the merge process should not continue.
      • getPhases

        public java.lang.String[][] getPhases()
        Description copied from interface: MergeResolver
        Gets identifiers for the merge phases handled by this MergeResolver. If the merge has no sub-phases then return an array with a single string array. Each inner String array indicates a path for a single merge phase. Each outer array element represents a phase whose progress we wish to indicate.
        Examples:
        So for a simple phase which has no sub-phases return new String[][] {new String[] {"Phase A"}}
        So for a phase with 2 sub-phases return new String[][] { new String[] {"Phase A"}, new String[] {"Phase A", "Sub-Phase 1}, new String[] {"Phase A", "Sub-Phase 2} } .
        Specified by:
        getPhases in interface MergeResolver
        Returns:
        an array of phases.
      • setConflictResolution

        public void setConflictResolution​(int option)
        For JUnit testing only, set the option for resolving a conflict.
        Parameters:
        option -