FileDocCategorySizeDatePackage
FindNumFilter.javaAPI DocExample986Thu Mar 08 13:20:10 GMT 2001None

FindNumFilter

public 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
    num
    The value of this filter
    final int
    LE
    Constants for the comparison operators.
    final int
    LT
    final int
    EQ
    final int
    GT
    final int
    GE
    int
    mode
    The 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
    booleanaccept(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;
    		}