Interface DifferencePerformer


  • @API(type=NOT_EXTENDABLE,
         src=PUBLIC)
    public interface DifferencePerformer
    The DifferencePerformer is used to compare two resources of a given content type using a set of options. The result of the diff is a list with the differences between the resources.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.List<Difference> performDiff​(java.io.Reader leftContentReader, java.io.Reader rightContentReader, java.io.Reader baseContentReader, java.lang.String leftSystemId, java.lang.String rightSystemId, java.lang.String baseSystemId, java.lang.String contentType, DiffOptions diffOptions, DiffProgressListener diffProgressListener)
      Performs the diff operation between the resources represented by the three readers.
      java.util.List<Difference> performDiff​(java.io.Reader leftContentReader, java.io.Reader rightContentReader, java.lang.String leftSystemId, java.lang.String rightSystemId, java.lang.String contentType, DiffOptions diffOptions, DiffProgressListener diffProgressListener)
      Performs the diff operation between the resources represented by the two readers.
      void stop()
      Signal to the diff performer that it must stop.
    • Method Detail

      • performDiff

        java.util.List<Difference> performDiff​(java.io.Reader leftContentReader,
                                               java.io.Reader rightContentReader,
                                               java.lang.String leftSystemId,
                                               java.lang.String rightSystemId,
                                               java.lang.String contentType,
                                               DiffOptions diffOptions,
                                               DiffProgressListener diffProgressListener)
                                        throws DiffException
        Performs the diff operation between the resources represented by the two readers. The resources are compared taking into account the content type and the provided options.
        Please note that the content of the readers will be processed before comparison and all end lines will be replaced with \n.
        Parameters:
        leftContentReader - The first resource content reader. It cannot be null.
        rightContentReader - The second resource content reader. It cannot be null.
        leftSystemId - The left resource URL as string. It can be null when a system ID is not relevant.
        rightSystemId - The right resource URL as string. It can be null when a system ID is not relevant.
        contentType - The content type of the two resources, constants from DiffContentTypes. It is used only when the diff algorithm takes into account the tokens of the language associated with the resources. It can be null when the used algorithm is not syntax aware.
        diffOptions - The options used by the diff performer to perform the comparison. It can be null meaning a default set of options wil be used.
        diffProgressListener - The DiffProgressListener notified about the progress of the diff. It can be null when the diff progress doesn't need to be monitored.
        Returns:
        The list with the differences. The differences are represented by Difference objects. If the resources are identical or the diff fails the list will be empty.
        If the hierarchical diff is activated (DiffOptions.isEnableHierarchicalDiff() returns true) then the returned list contains DifferenceParent elements.
        Throws:
        DiffException - If the diff operation fails or it is stopped before it finishes.
      • performDiff

        java.util.List<Difference> performDiff​(java.io.Reader leftContentReader,
                                               java.io.Reader rightContentReader,
                                               java.io.Reader baseContentReader,
                                               java.lang.String leftSystemId,
                                               java.lang.String rightSystemId,
                                               java.lang.String baseSystemId,
                                               java.lang.String contentType,
                                               DiffOptions diffOptions,
                                               DiffProgressListener diffProgressListener)
                                        throws java.io.IOException,
                                               CannotHandleException,
                                               DiffException
        Performs the diff operation between the resources represented by the three readers. The resources are compared taking into account the content type and the provided options.
        Parameters:
        leftContentReader - The first resource content reader. Cannot be null.
        rightContentReader - The second resource content reader.Cannot be null.
        baseContentReader - The content reader of the base resource to which the other 2 resources are compared against. It can be null in which case the diff operation is reduced to the direct comparison between the first and the second resource.
        leftSystemId - The left resource URL as string. Can be null if a system ID is not relevant.
        rightSystemId - The right resource URL as string. Can be null if a system ID is not relevant.
        baseSystemId - The base resource URL as string. Can be null when a system ID is not relevant.
        contentType - The content type of the resources, constants from DiffContentTypes. It is used only when the diff algorithm takes into account the tokens of the language associated with the resources. Can be null when the used algorithm is not syntax aware.
        diffOptions - The options used by the diff performer to perform the comparison. Can be null and that means a default set of options is used.
        diffProgressListener - The DiffProgressListener notified about the progress of the diff. Can be null when the diff progress doesn't need to be monitored.
        Returns:
        The list with the differences. The differences are represented by Difference objects.
        Throws:
        java.io.IOException - If an I/O exception occurs while handling the resource content readers.
        CannotHandleException - When the algorithm cannot handle the documents (most probably issues regarding the parsing of not well formed documents).
        DiffException - If the diff operation fails or it is stopped before it finishes.
      • stop

        void stop()
        Signal to the diff performer that it must stop.