java.lang.Object
com.iqser.red.service.redaction.v1.server.model.document.nodes.SectionIdentifier

public class SectionIdentifier extends Object
Represents the textual identifier sometimes present in a Headline. For example, given the headline 3.1 Results, the section identifier is 3.1. Keep in mind, this identifier must not be unique in a single document, as there might be multiple headlines starting with the same textual identifier.
  • Field Details

    • numericalIdentifierPattern

      public static Pattern numericalIdentifierPattern
    • alphanumericIdentifierPattern

      public static Pattern alphanumericIdentifierPattern
  • Constructor Details

    • SectionIdentifier

      public SectionIdentifier(com.iqser.red.service.redaction.v1.server.model.document.nodes.SectionIdentifier.Format format, String identifierString, List<Integer> identifiers, boolean asChild)
  • Method Details

    • fromSearchText

      public static SectionIdentifier fromSearchText(String headline)
      Generates a SectionIdentifier from the headline text of a section, determining its format and structure.
      Parameters:
      headline - The headline text from which to generate the section identifier.
      Returns:
      A SectionIdentifier instance corresponding to the headline text.
    • asChildOf

      public static SectionIdentifier asChildOf(SectionIdentifier sectionIdentifier)
      Marks the current section identifier as a child of another section.
      Parameters:
      sectionIdentifier - The parent section identifier.
      Returns:
      A new SectionIdentifier instance marked as a child.
    • document

      public static SectionIdentifier document()
      Generates a SectionIdentifier that represents the entire document.
      Returns:
      A SectionIdentifier with a document-wide scope.
    • empty

      public static SectionIdentifier empty()
      Generates an empty SectionIdentifier.
      Returns:
      An empty SectionIdentifier instance.
    • isParentOf

      public boolean isParentOf(SectionIdentifier sectionIdentifier)
      Determines if the current SectionIdentifier is the parent of the given SectionIdentifier.
      Parameters:
      sectionIdentifier - The section identifier to compare against.
      Returns:
      true if the current section is the parent of the given section, false otherwise.
    • isChildOf

      public boolean isChildOf(SectionIdentifier sectionIdentifier)
      Determines if the current section is a child of the given section, based on their identifiers.
      Parameters:
      sectionIdentifier - The section identifier to compare against.
      Returns:
      True if the current section is a child of the given section, false otherwise.
    • toString

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

      public boolean isEmpty()
      Returns:
      true, when no identifier could be found
    • level

      public int level()
      The level of a SectionIdentifier corresponds with the count of identifiers. E.g. 1.1 is level 2, and 1. is level 1
      Returns:
      the level of the Headline
    • getFormat

      public com.iqser.red.service.redaction.v1.server.model.document.nodes.SectionIdentifier.Format getFormat()
    • getIdentifierString

      public String getIdentifierString()