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 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/namestatic 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/namestatic Annotation
createAnnotation(String topicName, String name)
createAnnotationstatic Annotation
createAnnotation(String topicName, String topicMi, String name)
createAnnotationstatic Annotation
createCaution(String caution)
createCautionstatic Annotation
createComment(String comment)
createCommentstatic boolean
doesAnnotationHaveTopic(Annotation annotation, String topicId, String topicName)
To know if the annotation does have a specific topicstatic boolean
doesAnnotationHaveTopicAndValue(Annotation annotation, String topicId, String topicName, String value)
To know if the annotation does have a specific topicstatic boolean
doesAnnotationHaveTopicAndValueLike(Annotation annotation, String topicId, String topicName, String value)
To know if the annotation does have a specific topic and like valuestatic void
removeAllAnnotationsWithTopic(Collection<? extends Annotation> annotations, String topicId, String topicName)
Remove all annotations having this topic name/database id from the collection of annotationsstatic 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 annotationsstatic 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
-
-
-
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
- aString
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 annotationstopicId
- : the topic id to look fortopicName
- : the topic name to look forvalue
- aString
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 annotationstopicId
- : the topic id to look fortopicName
- : the topic name to look forvalue
- aString
object.
-
createAnnotation
public static Annotation createAnnotation(String topicName, String topicMi, String name)
createAnnotation
- Parameters:
topicName
- aString
object.topicMi
- aString
object.name
- aString
object.- Returns:
- a
Annotation
object.
-
createAnnotation
public static Annotation createAnnotation(String topicName, String name)
createAnnotation
- Parameters:
topicName
- aString
object.name
- aString
object.- Returns:
- a
Annotation
object.
-
createComment
public static Annotation createComment(String comment)
createComment
- Parameters:
comment
- aString
object.- Returns:
- a
Annotation
object.
-
createCaution
public static Annotation createCaution(String caution)
createCaution
- Parameters:
caution
- aString
object.- Returns:
- a
Annotation
object.
-
-