1 package net.sf.twip.parameterhandler; 2 3 import net.sf.twip.util.Parameter; 4 5 public abstract class AbstractFloatingPointNumberParameterHandler extends 6 AbstractNumberParameterHandler { 7 8 public AbstractFloatingPointNumberParameterHandler(Parameter parameter) { 9 super(parameter); 10 } 11 12 @Override 13 protected Tester getTester(final String expression) { 14 if ("!= NaN".equals(expression)) 15 return new Tester() { 16 public boolean test(Object value) { 17 return !isNaN(value); 18 } 19 }; 20 if ("!= INF".equals(expression)) 21 return new Tester() { 22 public boolean test(Object value) { 23 return !isPositiveInfinity(value); 24 } 25 }; 26 if ("!= -INF".equals(expression)) 27 return new Tester() { 28 public boolean test(Object value) { 29 return !isNegativeInfinity(value); 30 } 31 }; 32 return super.getTester(expression); 33 } 34 35 protected abstract boolean isNaN(Object value); 36 37 protected abstract boolean isNegativeInfinity(Object value); 38 39 protected abstract boolean isPositiveInfinity(Object value); 40 }