git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-2808 refactor KeyedMatcher as FeatureMatcher with byLabel, byScore, byAttribute...
[jalview.git]
/
src
/
jalview
/
datamodel
/
features
/
FeatureMatcherSet.java
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
(file)
--- 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.ArrayList;
import java.util.List;
-import java.util.function.Function;
-public class KeyedMatcherSet implements KeyedMatcherSetI
+public class FeatureMatcherSet implements FeatureMatcherSetI
{
{
- List<KeyedMatcherI> matchConditions;
+ List<FeatureMatcherI> matchConditions;
boolean andConditions;
/**
* Constructor
*/
boolean andConditions;
/**
* Constructor
*/
- public KeyedMatcherSet()
+ public FeatureMatcherSet()
{
matchConditions = new ArrayList<>();
}
@Override
{
matchConditions = new ArrayList<>();
}
@Override
- public boolean matches(Function<String[], String> valueProvider)
+ public boolean matches(SequenceFeature feature)
{
/*
* no conditions matches anything
{
/*
* no conditions matches anything
@@
-34,9
+35,9
@@
public class KeyedMatcherSet implements KeyedMatcherSetI
*/
if (andConditions)
{
*/
if (andConditions)
{
- for (KeyedMatcherI m : matchConditions)
+ for (FeatureMatcherI m : matchConditions)
{
{
- if (!m.matches(valueProvider))
+ if (!m.matches(feature))
{
return false;
}
{
return false;
}
@@
-47,9
+48,9
@@
public class KeyedMatcherSet implements KeyedMatcherSetI
/*
* OR until match
*/
/*
* OR until match
*/
- for (KeyedMatcherI m : matchConditions)
+ for (FeatureMatcherI m : matchConditions)
{
{
- if (m.matches(valueProvider))
+ if (m.matches(feature))
{
return true;
}
{
return true;
}
@@
-58,7
+59,7
@@
public class KeyedMatcherSet implements KeyedMatcherSetI
}
@Override
}
@Override
- public KeyedMatcherSetI and(KeyedMatcherI m)
+ public FeatureMatcherSetI and(FeatureMatcherI m)
{
if (!andConditions && matchConditions.size() > 1)
{
{
if (!andConditions && matchConditions.size() > 1)
{
@@
-71,7
+72,7
@@
public class KeyedMatcherSet implements KeyedMatcherSetI
}
@Override
}
@Override
- public KeyedMatcherSetI or(KeyedMatcherI m)
+ public FeatureMatcherSetI or(FeatureMatcherI m)
{
if (andConditions && matchConditions.size() > 1)
{
{
if (andConditions && matchConditions.size() > 1)
{
@@
-90,7
+91,7
@@
public class KeyedMatcherSet implements KeyedMatcherSetI
}
@Override
}
@Override
- public Iterable<KeyedMatcherI> getMatchers()
+ public Iterable<FeatureMatcherI> getMatchers()
{
return matchConditions;
}
{
return matchConditions;
}
@@
-100,7
+101,7
@@
public class KeyedMatcherSet implements KeyedMatcherSetI
{
StringBuilder sb = new StringBuilder();
boolean first = true;
{
StringBuilder sb = new StringBuilder();
boolean first = true;
- for (KeyedMatcherI matcher : matchConditions)
+ for (FeatureMatcherI matcher : matchConditions)
{
if (!first)
{
{
if (!first)
{