T t = getValue(value); if (lowerBound != null) { if (lowerInclusive) { if (less(t, lowerBound)) { return false; if (lessOrEqual(t, lowerBound)) { return false; if (greater(t, upperBound)) { return false; if (greaterOrEqual(t, upperBound)) { return false;
protected NumericConstraint(String definition) { // format: '(<min>, <max>)', '[<min>, <max>]', '(, <max>)' etc. Pattern pattern = Pattern.compile("([\\(\\[])([^,]*),([^\\)\\]]*)([\\)\\]])"); Matcher matcher = pattern.matcher(definition); if (matcher.matches()) { try { // group 1 is lower bound inclusive/exclusive lowerInclusive = "[".equals(matcher.group(1)); // group 2 is lower, group 3 is upper bound lowerBound = getBound(matcher.group(2)); upperBound = getBound(matcher.group(3)); // group 4 is upper bound inclusive/exclusive upperInclusive = "]".equals(matcher.group(4)); } catch (NumberFormatException e) { invalid(definition); } } else { invalid(definition); } }
protected boolean greater(T val, T bound) { return less(bound, val); }
T t = getValue(value); if (lowerBound != null) { if (lowerInclusive) { if (less(t, lowerBound)) { return false; if (lessOrEqual(t, lowerBound)) { return false; if (greater(t, upperBound)) { return false; if (greaterOrEqual(t, upperBound)) { return false;
protected NumericConstraint(String definition) { // format: '(<min>, <max>)', '[<min>, <max>]', '(, <max>)' etc. Pattern pattern = Pattern.compile("([\\(\\[])([^,]*),([^\\)\\]]*)([\\)\\]])"); Matcher matcher = pattern.matcher(definition); if (matcher.matches()) { try { // group 1 is lower bound inclusive/exclusive lowerInclusive = "[".equals(matcher.group(1)); // group 2 is lower, group 3 is upper bound lowerBound = getBound(matcher.group(2)); upperBound = getBound(matcher.group(3)); // group 4 is upper bound inclusive/exclusive upperInclusive = "]".equals(matcher.group(4)); } catch (NumberFormatException e) { invalid(definition); } } else { invalid(definition); } }
protected boolean greater(T val, T bound) { return less(bound, val); }
T t = getValue(value); if (lowerBound != null) { if (lowerInclusive) { if (less(t, lowerBound)) { return false; if (lessOrEqual(t, lowerBound)) { return false; if (greater(t, upperBound)) { return false; if (greaterOrEqual(t, upperBound)) { return false;
protected NumericConstraint(String definition) { // format: '(<min>, <max>)', '[<min>, <max>]', '(, <max>)' etc. Pattern pattern = Pattern.compile("([\\(\\[])([^,]*),([^\\)\\]]*)([\\)\\]])"); Matcher matcher = pattern.matcher(definition); if (matcher.matches()) { try { // group 1 is lower bound inclusive/exclusive lowerInclusive = "[".equals(matcher.group(1)); // group 2 is lower, group 3 is upper bound lowerBound = getBound(matcher.group(2)); upperBound = getBound(matcher.group(3)); // group 4 is upper bound inclusive/exclusive upperInclusive = "]".equals(matcher.group(4)); } catch (NumberFormatException e) { invalid(definition); } } else { invalid(definition); } }
protected boolean greater(T val, T bound) { return less(bound, val); }