FindNumFilterpublic class FindNumFilter extends Object class to handle a numeric filter for Find, such as:
5, meaning exactly 5
+5, meaning greater than 5
-5, meaning less than 5 |
Fields Summary |
---|
int | numThe value of this filter | final int | LEConstants for the comparison operators. | final int | LT | final int | EQ | final int | GT | final int | GE | int | modeThe current comparison operator |
Constructors Summary |
---|
FindNumFilter(String input)Constructor
switch(input.charAt(0)) {
case '+": mode = GT; break;
case '-": mode = LT; break;
case '=": mode = EQ; break;
// No syntax for LE or GE yet.
}
num = Math.abs(Integer.parseInt(input));
| FindNumFilter(int mode, int value)Construct a NumFilter when you know its mode and value
this.mode = mode;
num = value;
|
Methods Summary |
---|
boolean | accept(int n)
switch(mode) {
case GT: return n > num;
case EQ: return n == num;
case LT: return n < num;
default:
System.err.println("UNEX CASE " + mode );
return false;
}
|
|