X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2Ffeatures%2FFeatureMatcherSet.java;fp=src%2Fjalview%2Futil%2Fmatcher%2FKeyedMatcherSet.java;h=64ae61bfc47438a06740c7a84b8f2696dcfdff66;hp=a4be48af690fa9224311149690c6dd62124c8209;hb=1aa039ed9dfe0528cb7b40231734cf3004452c39;hpb=a0b04a3977a19395cf95f3535a9fc6b04c754a3a diff --git a/src/jalview/util/matcher/KeyedMatcherSet.java b/src/jalview/datamodel/features/FeatureMatcherSet.java similarity index 72% rename from src/jalview/util/matcher/KeyedMatcherSet.java rename to src/jalview/datamodel/features/FeatureMatcherSet.java index a4be48a..64ae61b 100644 --- a/src/jalview/util/matcher/KeyedMatcherSet.java +++ b/src/jalview/datamodel/features/FeatureMatcherSet.java @@ -1,25 +1,26 @@ -package jalview.util.matcher; +package jalview.datamodel.features; + +import jalview.datamodel.SequenceFeature; import java.util.ArrayList; import java.util.List; -import java.util.function.Function; -public class KeyedMatcherSet implements KeyedMatcherSetI +public class FeatureMatcherSet implements FeatureMatcherSetI { - List matchConditions; + List matchConditions; boolean andConditions; /** * Constructor */ - public KeyedMatcherSet() + public FeatureMatcherSet() { matchConditions = new ArrayList<>(); } @Override - public boolean matches(Function valueProvider) + public boolean matches(SequenceFeature feature) { /* * no conditions matches anything @@ -34,9 +35,9 @@ public class KeyedMatcherSet implements KeyedMatcherSetI */ if (andConditions) { - for (KeyedMatcherI m : matchConditions) + for (FeatureMatcherI m : matchConditions) { - if (!m.matches(valueProvider)) + if (!m.matches(feature)) { return false; } @@ -47,9 +48,9 @@ public class KeyedMatcherSet implements KeyedMatcherSetI /* * OR until match */ - for (KeyedMatcherI m : matchConditions) + for (FeatureMatcherI m : matchConditions) { - if (m.matches(valueProvider)) + if (m.matches(feature)) { return true; } @@ -58,7 +59,7 @@ public class KeyedMatcherSet implements KeyedMatcherSetI } @Override - public KeyedMatcherSetI and(KeyedMatcherI m) + public FeatureMatcherSetI and(FeatureMatcherI m) { if (!andConditions && matchConditions.size() > 1) { @@ -71,7 +72,7 @@ public class KeyedMatcherSet implements KeyedMatcherSetI } @Override - public KeyedMatcherSetI or(KeyedMatcherI m) + public FeatureMatcherSetI or(FeatureMatcherI m) { if (andConditions && matchConditions.size() > 1) { @@ -90,7 +91,7 @@ public class KeyedMatcherSet implements KeyedMatcherSetI } @Override - public Iterable getMatchers() + public Iterable getMatchers() { return matchConditions; } @@ -100,7 +101,7 @@ public class KeyedMatcherSet implements KeyedMatcherSetI { StringBuilder sb = new StringBuilder(); boolean first = true; - for (KeyedMatcherI matcher : matchConditions) + for (FeatureMatcherI matcher : matchConditions) { if (!first) {