Class AnnotatedSpan


  • public class AnnotatedSpan
    extends Object
    Represents the information about a span of content that is associated with a marker (MTag object or a derived object).

    The span my exist across several parts (segments or ignorables).

    • Constructor Detail

      • AnnotatedSpan

        public AnnotatedSpan​(MTag marker,
                             Part startPart,
                             int start)
        Creates a new AnnotatedSpan object.
        Parameters:
        marker - the marker associated to this span.
        startPart - the Part where this span starts.
        start - the location where the part starts.
    • Method Detail

      • getMarker

        public MTag getMarker()
        Gets the MTag object associated with this span.
        Returns:
        the annotation for this span.
      • getStartPart

        public Part getStartPart()
        Gets the Part object where this span starts.
        Returns:
        the part/segment where this span starts.
      • getEndPart

        public Part getEndPart()
        Gets the Part object where this span ends.
        Returns:
        the part/segment where this span ends.
      • setEndPart

        public void setEndPart​(Part endPart)
        Sets the part/segment where this span ends.
        Parameters:
        endPart - the part/segment where this span ends.
      • getType

        public String getType()
        Gets the type of the marker for this span.
        Returns:
        the marker type for this span.
      • getId

        public String getId()
        Gets the id of the marker for this span.
        Returns:
        the marker id for this span.
      • getStart

        public int getStart()
        Gets the start position in the coded text of the start part of this span.
        Returns:
        the start position of this span.
        See Also:
        getEnd(), getStartPart()
      • append

        protected void append​(String chunk)
        Appends a chunk of coded text to the coded text of this span. (This used during the creation of the span).
        Parameters:
        chunk - the chunk to append.
      • getCodedText

        public String getCodedText()
        Gets the coded text of the content for this span.

        IMPORTANT: This coded text can go across parts (segments or ignorables).

        Returns:
        the coded text of the span (possibly across parts)
      • getPlainText

        public String getPlainText()
        Gets the plain text version of the content for this span.

        IMPORTANT: This text can go across parts (segments or ignorables).

        Returns:
        the plain text version of the content for this span.
      • setEnd

        public void setEnd​(int end)
        Sets the end position in the coded text of the end part of this span.
        Parameters:
        end - the end position of this span.
      • getEnd

        public int getEnd()
        Gets the end position in the coded text of the end part of this span.
        Returns:
        the end position of this span.
        See Also:
        getStart(), getEndPart()
      • setPartCount

        public void setPartCount​(int partCount)
        Sets the number of parts where this span exists.
        Parameters:
        partCount - the new number of parts where this span occurs.
      • getPartCount

        public int getPartCount()
        Gets the number of parts where this span exists.
        Returns:
        the number of parts where this span exists.
      • setFullContent

        public void setFullContent​(boolean fullContent)
        Sets the flag indicating if this span covers the entire content of the part or parts where it exists.
        Parameters:
        fullContent - true if the span content is the full content of the part(s).
      • isFullContent

        public boolean isFullContent()
        Indicates if this span covers the entire content of the part or parts where it exists.

        Note that annotation markers are not counted as part of the "content" in this context.

        Returns:
        true if this span is the full content of the part(s).