Class TextNodeComparator

    • Constructor Detail

      • TextNodeComparator

        public TextNodeComparator​(DomTree tree,
                                  Locale locale)
    • Method Detail

      • getBodyNode

        public BodyNode getBodyNode()
      • getRangeCount

        public int getRangeCount()
        Description copied from interface: IRangeComparator
        Returns the number of comparable entities.
        Specified by:
        getRangeCount in interface IRangeComparator
        Returns:
        the number of comparable entities
      • getTextNode

        public TextNode getTextNode​(int i)
      • markAsNew

        public void markAsNew​(int start,
                              int end,
                              ModificationType outputFormat)
        Marks the given range as new. In the output, the range will be formatted as specified by the anOutputFormat parameter.
        Parameters:
        start -
        end -
        outputFormat - specifies how this range shall be formatted in the output
      • markAsNew

        public void markAsNew​(int start,
                              int end)
        Marks the given range as new. In the output, the range will be formatted as "added".
        Parameters:
        start -
        end -
      • rangesEqual

        public boolean rangesEqual​(int i1,
                                   IRangeComparator rangeComp,
                                   int i2)
        Description copied from interface: IRangeComparator
        Returns whether the comparable entity given by the first index matches an entity specified by the other IRangeComparator and index.
        Specified by:
        rangesEqual in interface IRangeComparator
        Parameters:
        i1 - the index of the comparable entity within this IRangeComparator
        rangeComp - the IRangeComparator to compare this with
        i2 - the index of the comparable entity within the other IRangeComparator
        Returns:
        true if the comparable entities are equal
      • skipRangeComparison

        public boolean skipRangeComparison​(int arg0,
                                           int arg1,
                                           IRangeComparator arg2)
        Description copied from interface: IRangeComparator
        Returns whether a comparison should be skipped because it would be too costly (or lengthy).
        Specified by:
        skipRangeComparison in interface IRangeComparator
        Parameters:
        arg0 - a number on which to base the decision whether to return true or false
        arg1 - another number on which to base the decision whether to return true or false
        arg2 - the other IRangeComparator to compare with
        Returns:
        true to avoid a too lengthy range comparison
      • handlePossibleChangedPart

        public void handlePossibleChangedPart​(int leftstart,
                                              int leftend,
                                              int rightstart,
                                              int rightend,
                                              TextNodeComparator leftComparator)
      • markAsDeleted

        public void markAsDeleted​(int start,
                                  int end,
                                  TextNodeComparator oldComp,
                                  int before,
                                  int after,
                                  ModificationType outputFormat)
        Marks the given range as deleted. In the output, the range will be formatted as specified by the parameter anOutputFormat.
        Parameters:
        start -
        end -
        oldComp -
        before -
        anOutputFormat - specifies how this range shall be formatted in the output
      • markAsDeleted

        public void markAsDeleted​(int start,
                                  int end,
                                  TextNodeComparator oldComp,
                                  int before,
                                  int after)
        Marks the given range as deleted. In the output, the range will be formatted as "removed".
        Parameters:
        start -
        end -
        oldComp -
        before -
      • expandWhiteSpace

        public void expandWhiteSpace()
      • setStartDeletedID

        public void setStartDeletedID​(long aDeletedID)
        Used for combining multiple comparators in order to create a single output document. The IDs must be successive along the different comparators.
        Parameters:
        aDeletedID -
      • setStartChangedID

        public void setStartChangedID​(long aChangedID)
        Used for combining multiple comparators in order to create a single output document. The IDs must be successive along the different comparators.
        Parameters:
        aDeletedID -
      • setStartNewID

        public void setStartNewID​(long aNewID)
        Used for combining multiple comparators in order to create a single output document. The IDs must be successive along the different comparators.
        Parameters:
        aDeletedID -
      • getChangedID

        public long getChangedID()
      • getDeletedID

        public long getDeletedID()
      • getNewID

        public long getNewID()
      • setLastModified

        public void setLastModified​(List<Modification> aLastModified)