package jalview.util.matcher;
+import java.util.Objects;
import java.util.regex.Pattern;
/**
if (cond.isNumeric())
{
value = Float.valueOf(compareTo);
+ pattern = String.valueOf(value);
}
- // pattern matches will be non-case-sensitive
- pattern = compareTo.toUpperCase();
+ else
+ {
+ // pattern matches will be non-case-sensitive
+ pattern = compareTo.toUpperCase();
+ }
+
// if we add regex conditions (e.g. matchesPattern), then
// pattern should hold the raw regex, and
// regexPattern = Pattern.compile(compareTo);
*/
public Matcher(Condition cond, float compareTo)
{
+ Objects.requireNonNull(cond);
condition = cond;
value = compareTo;
- pattern = String.valueOf(compareTo);
+ pattern = String.valueOf(compareTo).toUpperCase();
}
/**
return false;
}
Matcher m = (Matcher) obj;
- return condition != m.condition || value != m.value
- || !pattern.equals(m.pattern);
+ return condition == m.condition && value == m.value
+ && pattern.equals(m.pattern);
}
@Override
{
return value;
}
+
+ @Override
+ public String toString()
+ {
+ return condition.name() + " " + pattern;
+ }
}