Merge branch 'documentation/JAL-3407_2.11.1_release' into releases/Release_2_11_1_Branch
[jalview.git] / src / jalview / datamodel / features / FeatureMatcherSetI.java
1 package jalview.datamodel.features;
2
3 import jalview.datamodel.SequenceFeature;
4
5 /**
6  * An interface to describe a set of one or more feature matchers, where all
7  * matchers are combined with either AND or OR
8  * 
9  * @author gmcarstairs
10  *
11  */
12 public interface FeatureMatcherSetI
13 {
14   /**
15    * Answers true if the feature provided passes this matcher's match condition
16    * 
17    * @param feature
18    * @return
19    */
20   boolean matches(SequenceFeature feature);
21
22   /**
23    * Adds (ANDs) match condition m to this object's matcher set
24    * 
25    * @param m
26    * @throws IllegalStateException
27    *           if an attempt is made to AND to existing OR-ed conditions
28    */
29   void and(FeatureMatcherI m);
30
31   /**
32    * Answers true if any second condition is AND-ed with this one, false if it
33    * is OR-ed
34    * 
35    * @return
36    */
37   boolean isAnded();
38
39   /**
40    * Adds (ORs) the given condition to this object's match conditions
41    * 
42    * @param m
43    * @throws IllegalStateException
44    *           if an attempt is made to OR to existing AND-ed conditions
45    */
46   void or(FeatureMatcherI m);
47
48   /**
49    * Answers an iterator over the combined match conditions
50    * 
51    * @return
52    */
53   Iterable<FeatureMatcherI> getMatchers();
54
55   /**
56    * Answers true if this object contains no conditions
57    * 
58    * @return
59    */
60   boolean isEmpty();
61
62   /**
63    * Answers a string representation of this object suitable for use when
64    * persisting data, in a format that can be reliably read back. Any changes to
65    * the format should be backwards compatible.
66    */
67   String toStableString();
68 }