X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fdatamodel%2FAnnotatedCollectionI.java;h=755333ce509c033d72b6e28c0486187de041f649;hb=cfbb94908f5b2d247b763e2663f180058efda7aa;hp=74568e45fd4a4ce2f3e1ee4a88e63142e488b3dc;hpb=37de9310bec3501cbc6381e0c3dcb282fcaad812;p=jalview.git diff --git a/src/jalview/datamodel/AnnotatedCollectionI.java b/src/jalview/datamodel/AnnotatedCollectionI.java index 74568e4..755333c 100644 --- a/src/jalview/datamodel/AnnotatedCollectionI.java +++ b/src/jalview/datamodel/AnnotatedCollectionI.java @@ -31,8 +31,26 @@ public interface AnnotatedCollectionI extends SequenceCollectionI */ AlignmentAnnotation[] getAlignmentAnnotation(); + /** + * Returns a list of annotations matching the given calc id, or an empty list + * if calcId is null + * + * @param calcId + * @return + */ Iterable findAnnotation(String calcId); + /** + * Returns an iterable collection of any annotations that match on given + * sequence ref, calcId and label (ignoring null values). + * + * @param seq + * null or reference sequence to select annotation for + * @param calcId + * null or the calcId to select annotation for + * @param label + * null or the label to select annotation for + */ Iterable findAnnotations(SequenceI seq, String calcId, String label); @@ -43,4 +61,22 @@ public interface AnnotatedCollectionI extends SequenceCollectionI * alignment, parent group). */ AnnotatedCollectionI getContext(); + + /** + * Returns the number of the highest annotation graph group attached to this + * alignment. + */ + default int getLastGraphGroup() + { + var annots = getAlignmentAnnotation(); + if (annots == null) + return 1; + int graphGroup = 1; + for (AlignmentAnnotation ala : annots) + { + graphGroup = Math.max(graphGroup, ala.graphGroup); + } + return graphGroup; + } + }