Class Fragments


  • public final class Fragments
    extends Object

    Convenience methods for constructing orphaned and empty fragments.

    Author:
    David B. Bracewell
    • Method Detail

      • emptyHString

        public static HString emptyHString​(Document document)
        Creates an empty HString associated with the given document.
        Parameters:
        document - the document the HString is span on
        Returns:
        the new HString (associated with the given document if it is not null)
      • orphanedAnnotation

        public static Annotation orphanedAnnotation​(AnnotationType annotationType)
        Creates an orphaned empty annotation, i.e. an empty span and no document associated with it.
        Returns:
        the annotation
      • span

        public static HString span​(Document document,
                                   int start,
                                   int end)
        Creates an HString which is a span, i.e. fragment, of text on the given document.
        Parameters:
        document - the document
        start - the start
        end - the end
        Returns:
        the h string
      • stringWrapper

        public static HString stringWrapper​(@NonNull
                                            @NonNull String content)
        Creates a new HString that has content, but no document associated with it
        Parameters:
        content - the content of the string
        Returns:
        the new HString