Class AnnotationUtils


  • public class AnnotationUtils
    extends Object
    Utility class for Annotation
    Since:
    05/02/13
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • AnnotationUtils

        public AnnotationUtils()
    • Method Detail

      • doesAnnotationHaveTopic

        public static boolean doesAnnotationHaveTopic​(Annotation annotation,
                                                      String topicId,
                                                      String topicName)
        To know if the annotation does have a specific topic
        Parameters:
        annotation - : the annotation
        topicId - : the topic MI identifier
        topicName - : the topic name
        Returns:
        true if the annotation has the topic with given name/identifier
      • collectAllAnnotationsHavingTopic

        public static Collection<Annotation> collectAllAnnotationsHavingTopic​(Collection<? extends Annotation> annots,
                                                                              String topicId,
                                                                              String topicName)
        Collect all annotations having a specific topic
        Parameters:
        annots - : the annotations
        topicId - : the topic MI identifier
        topicName - : the topic name
        Returns:
        the annotations that have this specific topic
      • collectFirstAnnotationWithTopic

        public static Annotation collectFirstAnnotationWithTopic​(Collection<? extends Annotation> annotations,
                                                                 String topicId,
                                                                 String topicName)
        This method will return the first Annotation having this topicId/topic name It will return null if there are no Annotations with this topic id/name
        Parameters:
        annotations - : the collection of Annotation
        topicId - : the topic id to look for
        topicName - : the topic name to look for
        Returns:
        the first annotation having this topic name/id, null if no Annotation with this topic name/id
      • removeAllAnnotationsWithTopic

        public static void removeAllAnnotationsWithTopic​(Collection<? extends Annotation> annotations,
                                                         String topicId,
                                                         String topicName)
        Remove all annotations having this topic name/database id from the collection of annotations
        Parameters:
        annotations - : the collection of annotations
        topicId - : the topic id to look for
        topicName - : the topic name to look for
      • doesAnnotationHaveTopicAndValue

        public static boolean doesAnnotationHaveTopicAndValue​(Annotation annotation,
                                                              String topicId,
                                                              String topicName,
                                                              String value)
        To know if the annotation does have a specific topic
        Parameters:
        annotation - : the annotation
        topicId - : the topic MI identifier
        topicName - : the topic name
        value - : the annotation value
        Returns:
        true if the annotation has the topic with given name/identifier
      • doesAnnotationHaveTopicAndValueLike

        public static boolean doesAnnotationHaveTopicAndValueLike​(Annotation annotation,
                                                                  String topicId,
                                                                  String topicName,
                                                                  String value)
        To know if the annotation does have a specific topic and like value
        Parameters:
        annotation - : the annotation
        topicId - : the topic MI identifier
        topicName - : the topic name
        value - : the annotation value
        Returns:
        true if the annotation has the topic with given name/identifier
      • collectAllAnnotationsHavingTopic

        public static Collection<Annotation> collectAllAnnotationsHavingTopic​(Collection<? extends Annotation> annots,
                                                                              String topicId,
                                                                              String topicName,
                                                                              String value)
        Collect all annotations having a specific topic and value
        Parameters:
        annots - : the annotations
        topicId - : the topic MI identifier
        topicName - : the topic name
        value - : the annotation value
        Returns:
        the annotations having this topic and value
      • collectFirstAnnotationWithTopicAndValue

        public static Annotation collectFirstAnnotationWithTopicAndValue​(Collection<? extends Annotation> annotations,
                                                                         String topicId,
                                                                         String topicName,
                                                                         String value)
        This method will return the first Annotation having this topicId/topic name It will return null if there are no Annotations with this topic id/name
        Parameters:
        annotations - : the collection of Annotation
        topicId - : the topic id to look for
        topicName - : the topic name to look for
        value - a String object.
        Returns:
        the first annotation having this topic name/id, null if no Annotation with this topic name/id
      • removeAllAnnotationsWithTopicAndValue

        public static void removeAllAnnotationsWithTopicAndValue​(Collection<? extends Annotation> annotations,
                                                                 String topicId,
                                                                 String topicName,
                                                                 String value)
        Remove all annotations having this topic name/database id from the collection of annotations
        Parameters:
        annotations - : the collection of annotations
        topicId - : the topic id to look for
        topicName - : the topic name to look for
        value - a String object.
      • removeAllAnnotationsWithTopicAndValueLike

        public static void removeAllAnnotationsWithTopicAndValueLike​(Collection<? extends Annotation> annotations,
                                                                     String topicId,
                                                                     String topicName,
                                                                     String value)
        Remove all annotations having this topic name/database id and like value from the collection of annotations
        Parameters:
        annotations - : the collection of annotations
        topicId - : the topic id to look for
        topicName - : the topic name to look for
        value - a String object.