Class DiffGroup

java.lang.Object
com.inet.pdfc.generator.model.DiffGroup
All Implemented Interfaces:
Serializable

@JsonData public abstract class DiffGroup extends Object implements Serializable
A DiffGroup describes a set of subsequent Modifications in a document. It is characterized by the fact the the elements in front of and after the DiffGroup are equal. Furthermore there are no equal elements inside the range of a DiffGroup.
Any group has a type which indicates the severity of the Modifications in this group. For a detailed description refer to the DiffGroup.GroupType enumeration.
NOTE: Some DiffGroup have no modifications at all. These groups always have the type DiffGroup.GroupType.Sync and are a hint to faster sync back to equal elements after a modification.
Since:
3.0
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Defines the type of a DiffGroup and thus how to interpret the content of the affected elements lists.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract List<com.inet.pdfc.model.PagedElement>
    Returns a list of elements which are added or have a new value in the SECOND document.
    abstract com.inet.pdfc.generator.model.IDiffGroupBounds
    Returns the elements which define the bounds of the group in the element flow of the first and second document.
    abstract Rectangle
    getBounds(boolean first)
    Returns the overall outline of all affected elements of this group in one of the documents.
    getDifferencePages(boolean first)
    Return the difference pageNumbers or null if no elements exist for this document
    abstract int
    Returns the number modifications in this group.
    abstract List<Modification>
    Returns the list of modifications contained in this group.
    abstract List<com.inet.pdfc.model.PagedElement>
    Returns a list of elements which are removed or have a modified value in the FIRST document.
    Returns the type of differences in this group.
    abstract boolean
    Returns whether this differences group contains at least one visible Modification

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DiffGroup

      public DiffGroup()
  • Method Details

    • getRemovedElements

      public abstract List<com.inet.pdfc.model.PagedElement> getRemovedElements()
      Returns a list of elements which are removed or have a modified value in the FIRST document.
      NOTE: The bounds of these element are relative to their page. This is different to the total outline of the difference group, which is relative to the document.
      Returns:
      the list of removed or modified elements, not null
      Since:
      3.0
    • getAddedElements

      public abstract List<com.inet.pdfc.model.PagedElement> getAddedElements()
      Returns a list of elements which are added or have a new value in the SECOND document.
      NOTE: The bounds of these element are relative to their page. This is different to the total outline of the difference group, which is relative to the document.
      Returns:
      the list of added or modified elements, not null
      Since:
      3.0
    • getBounds

      public abstract Rectangle getBounds(boolean first)
      Returns the overall outline of all affected elements of this group in one of the documents.
      Parameters:
      first - true for the first document, false
      Returns:
      the outline rectangle
      Since:
      3.0
    • getDifferencesCount

      public abstract int getDifferencesCount()
      Returns the number modifications in this group. May return zero if there is no visible modification.
      Returns:
      the number modifications in this group
      Since:
      3.0
    • getBoundingElements

      public abstract com.inet.pdfc.generator.model.IDiffGroupBounds getBoundingElements()
      Returns the elements which define the bounds of the group in the element flow of the first and second document. This information is useful to determine whether the difference is in-line with the matched content and to place markers at locations where there is some content missing.
      Returns:
      the group bounds, never null although the elements in the bounds instance may all be null
      Since:
      3.0
    • getType

      public abstract DiffGroup.GroupType getType()
      Returns the type of differences in this group. This type as well defines the severity of the Modifications in this group.
      Returns:
      the type of differences in this group, never null
      Since:
      3.0
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getModifications

      public abstract List<Modification> getModifications()
      Returns the list of modifications contained in this group. The is the primary entry point to list the differences in a group. Each of these modifications describe one singular modification including the affected elements and the option to get a localized difference description.
      Returns:
      the list of modifications, may be null for sync groups
      Since:
      3.0
    • getDifferencePages

      public DifferencePages getDifferencePages(boolean first)
      Return the difference pageNumbers or null if no elements exist for this document
      Parameters:
      first - true for the first document, false
      Returns:
      the difference pageNumbers
      Since:
      4.0
    • isVisible

      public abstract boolean isVisible()
      Returns whether this differences group contains at least one visible Modification
      Returns:
      true if there is at least one visible Modification, hence false
      Since:
      20.04