Class AnnotationSet

    • Constructor Detail

      • AnnotationSet

        public AnnotationSet()
    • Method Detail

      • add

        public boolean add​(Annotation annotation)
        Adds an annotation to the set
        Parameters:
        annotation - The annotation to attach
      • contains

        public boolean contains​(Annotation annotation)
        Checks if an annotation is in the set or not
        Parameters:
        annotation - The annotation to check
        Returns:
        True if the annotation is in the set, False if not
      • get

        public Annotation get​(long id)
        Gets the annotation for the given id
        Parameters:
        id - The id of the annotation
        Returns:
        The annotation associated with that id or null if one does not exist
      • getAnnotationProvider

        public String getAnnotationProvider​(AnnotatableType type)
        Gets information on what annotator provided the annotation of the given type
        Parameters:
        type - The annotation type
        Returns:
        String representing the annotation provider or null
      • getCompleted

        public Set<AnnotatableType> getCompleted()
        Gets the set of completed annotation types.
        Returns:
        Set of classes for completed annotations
      • isCompleted

        public boolean isCompleted​(AnnotatableType type)
        Gets if the given annotation type is completed or not
        Parameters:
        type - the annotation type
        Returns:
        True if the annotation is completed, False if not.
      • next

        public Annotation next​(Annotation annotation,
                               AnnotationType type)
        Gets the first annotation after a given one of the given type
        Parameters:
        annotation - The annotation we want the next for
        type - the type of the next annotation wanted
        Returns:
        The next annotation of the same type or null
      • previous

        public Annotation previous​(Annotation annotation,
                                   AnnotationType type)
        Gets the first annotation before a given one of the given type
        Parameters:
        annotation - The annotation we want the previous for
        type - the type of the previous annotation wanted
        Returns:
        The previous annotation of the same type or null
      • remove

        public boolean remove​(Annotation annotation)
        Removes an annotation from the document
        Parameters:
        annotation - The annotation to detach
        Returns:
        the boolean
      • removeAll

        public List<Annotation> removeAll​(AnnotationType type)
        Removes all annotations of a given type and marks that type as not completed.
        Parameters:
        type - the type
        Returns:
        The list of annotations that were removed
      • select

        public List<Annotation> select​(Span span,
                                       Predicate<? super Annotation> criteria)

        Selects all annotations of a given annotation type within a given range and matching a given criteria.

        Parameters:
        span - the range in which to search form annotations
        criteria - the criteria that an annotation must match
        Returns:
        A list of annotations that are an instance of the given class within the given range and matching the given criteria
      • select

        public List<Annotation> select​(Predicate<? super Annotation> criteria)

        Selects all annotations of a given annotation type and matching a given criteria.

        Parameters:
        criteria - the criteria that an annotation must match
        Returns:
        A list of annotations that are an instance of the given class and matching the given criteria
      • setIsCompleted

        public void setIsCompleted​(AnnotatableType type,
                                   boolean isCompleted,
                                   String annotatorInformation)
        Sets the given annotation type as being completed or not
        Parameters:
        type - the annotation type
        isCompleted - True if the annotation is completed, False if not.
        annotatorInformation - the annotator information
      • size

        public int size()
        The number of annotations in the set
        Returns:
        Number of annotations in the set
      • stream

        public Stream<Annotation> stream()
        Returns:
        a stream over the annotations in the set