Package psidev.psi.mi.jami.utils
Class AnnotationUtils
- java.lang.Object
-
- psidev.psi.mi.jami.utils.AnnotationUtils
-
public class AnnotationUtils extends Object
Utility class for Annotation- Since:
05/02/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description AnnotationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Collection<Annotation>collectAllAnnotationsHavingTopic(Collection<? extends Annotation> annots, String topicId, String topicName)Collect all annotations having a specific topicstatic Collection<Annotation>collectAllAnnotationsHavingTopic(Collection<? extends Annotation> annots, String topicId, String topicName, String value)Collect all annotations having a specific topic and valuestatic AnnotationcollectFirstAnnotationWithTopic(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/namestatic AnnotationcollectFirstAnnotationWithTopicAndValue(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/namestatic AnnotationcreateAnnotation(String topicName, String name)createAnnotationstatic AnnotationcreateAnnotation(String topicName, String topicMi, String name)createAnnotationstatic AnnotationcreateCaution(String caution)createCautionstatic AnnotationcreateComment(String comment)createCommentstatic booleandoesAnnotationHaveTopic(Annotation annotation, String topicId, String topicName)To know if the annotation does have a specific topicstatic booleandoesAnnotationHaveTopicAndValue(Annotation annotation, String topicId, String topicName, String value)To know if the annotation does have a specific topicstatic booleandoesAnnotationHaveTopicAndValueLike(Annotation annotation, String topicId, String topicName, String value)To know if the annotation does have a specific topic and like valuestatic voidremoveAllAnnotationsWithTopic(Collection<? extends Annotation> annotations, String topicId, String topicName)Remove all annotations having this topic name/database id from the collection of annotationsstatic voidremoveAllAnnotationsWithTopicAndValue(Collection<? extends Annotation> annotations, String topicId, String topicName, String value)Remove all annotations having this topic name/database id from the collection of annotationsstatic voidremoveAllAnnotationsWithTopicAndValueLike(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
-
-
-
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 annotationtopicId- : the topic MI identifiertopicName- : 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 annotationstopicId- : the topic MI identifiertopicName- : 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 AnnotationtopicId- : the topic id to look fortopicName- : 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 annotationstopicId- : the topic id to look fortopicName- : 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 annotationtopicId- : the topic MI identifiertopicName- : the topic namevalue- : 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 annotationtopicId- : the topic MI identifiertopicName- : the topic namevalue- : 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 annotationstopicId- : the topic MI identifiertopicName- : the topic namevalue- : 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 AnnotationtopicId- : the topic id to look fortopicName- : the topic name to look forvalue- aStringobject.- 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 annotationstopicId- : the topic id to look fortopicName- : the topic name to look forvalue- aStringobject.
-
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 annotationstopicId- : the topic id to look fortopicName- : the topic name to look forvalue- aStringobject.
-
createAnnotation
public static Annotation createAnnotation(String topicName, String topicMi, String name)
createAnnotation
- Parameters:
topicName- aStringobject.topicMi- aStringobject.name- aStringobject.- Returns:
- a
Annotationobject.
-
createAnnotation
public static Annotation createAnnotation(String topicName, String name)
createAnnotation
- Parameters:
topicName- aStringobject.name- aStringobject.- Returns:
- a
Annotationobject.
-
createComment
public static Annotation createComment(String comment)
createComment
- Parameters:
comment- aStringobject.- Returns:
- a
Annotationobject.
-
createCaution
public static Annotation createCaution(String caution)
createCaution
- Parameters:
caution- aStringobject.- Returns:
- a
Annotationobject.
-
-