com.antelmann.math
Class NumberStringFilter<T extends Number & Comparable<? super T>>
java.lang.Object
com.antelmann.math.NumberStringFilter<T>
- All Implemented Interfaces:
- Filter<T>
- Direct Known Subclasses:
- NumberStringFilter.DecimalFilter, NumberStringFilter.DoubleFilter, NumberStringFilter.IntFilter, NumberStringFilter.LongFilter
@Todo(value={"support localized number formats","also support expressions with BooleanOperator"})
public abstract class NumberStringFilter<T extends Number & Comparable<? super T>>- extends Object
- implements Filter<T>
compiles a filter from an input string that supports numbers and ranges in the form:
'<1, 3, 5, 7-9, 11, 20-30, >=50'.
- Since:
- 10.12.2010, 12:54:14
- Author:
- Holger Antelmann
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NumberStringFilter
public NumberStringFilter(String filterString)
throws NumberFormatException
- Throws:
NumberFormatException
getCompiledNumbers
public Set<Map.Entry<T,RelationalOperator>> getCompiledNumbers()
getCompiledRanges
public List<Range<T>> getCompiledRanges()
accept
public boolean accept(T number)
- Description copied from interface:
Filter
- returns true only if the given entry is accepted by this filter
- Specified by:
accept in interface Filter<T extends Number & Comparable<? super T>>
getFilterString
public String getFilterString()
parseNumber
public abstract T parseNumber(String str)
throws NumberFormatException
- Throws:
NumberFormatException
setFilterString
public void setFilterString(String filterString)
throws NumberFormatException
- Throws:
NumberFormatException
(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads