Class SectionIdentifier
java.lang.Object
com.iqser.red.service.redaction.v1.server.model.document.nodes.SectionIdentifier
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSectionIdentifier
(com.iqser.red.service.redaction.v1.server.model.document.nodes.SectionIdentifier.Format format, String identifierString, List<Integer> identifiers, boolean asChild) -
Method Summary
Modifier and TypeMethodDescriptionstatic SectionIdentifier
asChildOf
(SectionIdentifier sectionIdentifier) Marks the current section identifier as a child of another section.static SectionIdentifier
document()
Generates a SectionIdentifier that represents the entire document.static SectionIdentifier
empty()
Generates an empty SectionIdentifier.static SectionIdentifier
fromSearchText
(String headline) Generates a SectionIdentifier from the headline text of a section, determining its format and structure.com.iqser.red.service.redaction.v1.server.model.document.nodes.SectionIdentifier.Format
boolean
isChildOf
(SectionIdentifier sectionIdentifier) Determines if the current section is a child of the given section, based on their identifiers.boolean
isEmpty()
boolean
isParentOf
(SectionIdentifier sectionIdentifier) Determines if the current SectionIdentifier is the parent of the given SectionIdentifier.int
level()
The level of a SectionIdentifier corresponds with the count of identifiers.toString()
-
Field Details
-
numericalIdentifierPattern
-
alphanumericIdentifierPattern
-
-
Constructor Details
-
SectionIdentifier
-
-
Method Details
-
fromSearchText
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
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
Generates a SectionIdentifier that represents the entire document.- Returns:
- A
SectionIdentifier
with a document-wide scope.
-
empty
Generates an empty SectionIdentifier.- Returns:
- An empty
SectionIdentifier
instance.
-
isParentOf
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
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
-
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
-