f064770d3ee1350053d5041433e9731252b00d56
[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    * Answers a new object that matches the logical AND of this and m
24    * 
25    * @param m
26    * @return
27    * @throws IllegalStateException
28    *           if an attempt is made to AND to existing OR-ed conditions
29    */
30   FeatureMatcherSetI and(FeatureMatcherI m);
31
32   /**
33    * Answers true if any second condition is AND-ed with this one, false if it
34    * is OR-ed
35    * 
36    * @return
37    */
38   boolean isAnded();
39
40   /**
41    * Answers a new object that matches the logical OR of this and m
42    * 
43    * @param m
44    * @return
45    * @throws IllegalStateException
46    *           if an attempt is made to OR to existing AND-ed conditions
47    */
48   FeatureMatcherSetI or(FeatureMatcherI m);
49
50   /**
51    * Answers an iterator over the combined match conditions
52    * 
53    * @return
54    */
55   Iterable<FeatureMatcherI> getMatchers();
56
57   /**
58    * Answers true if this object contains no conditions
59    * 
60    * @return
61    */
62   boolean isEmpty();
63 }