Package adams.core

Class DiffUtils.SideBySideDiff

    • Field Detail

      • m_Diff

        protected List[] m_Diff
        the diff information.
    • Constructor Detail

      • SideBySideDiff

        public SideBySideDiff()
        Initializes the container with an empty diff.
      • SideBySideDiff

        public SideBySideDiff​(List[] diff)
        Initializes the container.
    • Method Detail

      • getLeft

        public List getLeft()
        Return the diff of the left/first list/file.
        Returns:
        the diff
      • getRight

        public List getRight()
        Return the diff of the right/second list/file.
        Returns:
        the diff
      • getIndicator

        public List getIndicator()
        Returns the indicator list.
        Returns:
        the indicator
      • getStartPos

        public List getStartPos()
        Return the list with starting positions of the deltas.
        Returns:
        the list with start positions
      • hasDifferences

        public boolean hasDifferences()
        Returns whether there are any differences between the two files/lists.
        Returns:
        true if there are differences
      • differences

        public int differences()
        Returns the number of differences.
        Returns:
        the number of differences
      • lineToDelta

        public int lineToDelta​(int line)
        Returns the closest patch delta index for the given line number.
        Parameters:
        line - the 0-based line number
        Returns:
        the index of the delta, -1 if no delta matched
      • deltaToLine

        public int deltaToLine​(int delta,
                               boolean start)
        Returns the line number (start or end) of the given delta.
        Parameters:
        delta - the 0-based delta index
        Returns:
        the line number, -1 if failed to determine
      • hasNextDelta

        public boolean hasNextDelta​(int line)
        Checks whether there is a next delta after the current line.
        Parameters:
        line - the current line number (0-based)
        Returns:
        the next delta index, -1 if none available
      • getNextDelta

        public int getNextDelta​(int line)
        Returns the next delta after the current line.
        Parameters:
        line - the current line number (0-based)
        Returns:
        the next delta index, -1 if none available
      • hasPreviousDelta

        public boolean hasPreviousDelta​(int line)
        Checks whether there is a previous delta after the current line.
        Parameters:
        line - the current line number (0-based)
        Returns:
        the previous delta index, -1 if none available
      • getPreviousDelta

        public int getPreviousDelta​(int line)
        Returns the previous delta after the current line.
        Parameters:
        line - the current line number (0-based)
        Returns:
        the previous delta index, -1 if none available
      • toString

        public String toString​(String separator)
        Generates a string representation of the diff information.
        Parameters:
        separator - the separator between the columns
        Returns:
        the string representation
      • toString

        public String toString()
        Generates a string representation of the diff information.
        Overrides:
        toString in class Object
        Returns:
        the string representation