net.sf.jmatchparser.util
Class NumberExpression

java.lang.Object
  extended by net.sf.jmatchparser.util.NumberExpression

public class NumberExpression
extends Object

An expression that matches nonnegative numbers. This supports cron-like expressions, like 1,3-6,100-200,666,1000-3000/5,400-/7, -100,102- or *. Odd or even numbers can be matched either by cron's step syntax, or by suffixing a simple range (without step values) with e or o.

Author:
Michael Schierl

Constructor Summary
NumberExpression(String pattern)
          Create a new NumberExpression.
 
Method Summary
 int getMaximum()
          Return the maximum number that can be matched.
 int getMinimum()
          Return the minimum number that can be matched.
 boolean matches(int number)
          Check whether this number expression matches the given number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberExpression

public NumberExpression(String pattern)
Create a new NumberExpression.

Parameters:
pattern - the expression pattern.
Throws:
IllegalArgumentException - if the pattern is malformed
Method Detail

matches

public boolean matches(int number)
Check whether this number expression matches the given number.

Parameters:
number - the number to check against
Returns:
whether the expression matches the number

getMinimum

public int getMinimum()
Return the minimum number that can be matched.


getMaximum

public int getMaximum()
Return the maximum number that can be matched.



Copyright © 2011. All Rights Reserved.