/** * <p>Tests whether the specified <code>Number</code> occurs within * this range using <code>int</code> comparison..</p> * * <p><code>null</code> is handled and returns <code>false</code>.</p> * * <p>This implementation forwards to the {@link #containsInteger(int)} method.</p> * * @param value the integer to test, may be <code>null</code> * @return <code>true</code> if the specified number occurs within this * range by <code>int</code> comparison */ public boolean containsInteger(Number value) { if (value == null) { return false; } return containsInteger(value.intValue()); }
/** * <p>Tests whether the specified range overlaps with this range * using <code>int</code> comparison.</p> * * <p><code>null</code> is handled and returns <code>false</code>.</p> * * @param range the range to test, may be <code>null</code> * @return <code>true</code> if the specified range overlaps with this range */ public boolean overlapsRange(Range range) { if (range == null) { return false; } return range.containsInteger(min) || range.containsInteger(max) || containsInteger(range.getMinimumInteger()); }
/** * <p>Tests whether the specified <code>Number</code> occurs within * this range using <code>int</code> comparison..</p> * * <p><code>null</code> is handled and returns <code>false</code>.</p> * * <p>This implementation forwards to the {@link #containsInteger(int)} method.</p> * * @param value the integer to test, may be <code>null</code> * @return <code>true</code> if the specified number occurs within this * range by <code>int</code> comparison */ public boolean containsInteger(Number value) { if (value == null) { return false; } return containsInteger(value.intValue()); }
/** * <p>Tests whether the specified <code>Number</code> occurs within * this range using <code>int</code> comparison..</p> * * <p><code>null</code> is handled and returns <code>false</code>.</p> * * <p>This implementation forwards to the {@link #containsInteger(int)} method.</p> * * @param value the integer to test, may be <code>null</code> * @return <code>true</code> if the specified number occurs within this * range by <code>int</code> comparison */ public boolean containsInteger(Number value) { if (value == null) { return false; } return containsInteger(value.intValue()); }
/** * <p>Tests whether the specified <code>Number</code> occurs within * this range using <code>int</code> comparison..</p> * * <p><code>null</code> is handled and returns <code>false</code>.</p> * * <p>This implementation forwards to the {@link #containsInteger(int)} method.</p> * * @param value the integer to test, may be <code>null</code> * @return <code>true</code> if the specified number occurs within this * range by <code>int</code> comparison */ public boolean containsInteger(Number value) { if (value == null) { return false; } return containsInteger(value.intValue()); }
/** * <p>Tests whether the specified <code>Number</code> occurs within * this range using <code>int</code> comparison..</p> * * <p><code>null</code> is handled and returns <code>false</code>.</p> * * <p>This implementation forwards to the {@link #containsInteger(int)} method.</p> * * @param value the integer to test, may be <code>null</code> * @return <code>true</code> if the specified number occurs within this * range by <code>int</code> comparison */ public boolean containsInteger(Number value) { if (value == null) { return false; } return containsInteger(value.intValue()); }
/** * <p>Tests whether the specified <code>Number</code> occurs within * this range using <code>int</code> comparison..</p> * * <p><code>null</code> is handled and returns <code>false</code>.</p> * * <p>This implementation forwards to the {@link #containsInteger(int)} method.</p> * * @param value the integer to test, may be <code>null</code> * @return <code>true</code> if the specified number occurs within this * range by <code>int</code> comparison */ public boolean containsInteger(Number value) { if (value == null) { return false; } return containsInteger(value.intValue()); }
/** * {@inheritDoc} */ @Override public boolean isValid(List<PollItem> pollItems, ConstraintValidatorContext context) { if (!CollectionUtils.isEmpty(pollItems)) { Range range = new IntRange(minSize, maxSize); return range.containsInteger(pollItems.size()); } return true; } }
Range range = new IntRange(4,6) if (range.containsInteger(5)) {..}
/** * <p>Tests whether the specified range overlaps with this range * using <code>int</code> comparison.</p> * * <p><code>null</code> is handled and returns <code>false</code>.</p> * * @param range the range to test, may be <code>null</code> * @return <code>true</code> if the specified range overlaps with this range */ public boolean overlapsRange(Range range) { if (range == null) { return false; } return range.containsInteger(min) || range.containsInteger(max) || containsInteger(range.getMinimumInteger()); }
/** * <p>Tests whether the specified range overlaps with this range * using <code>int</code> comparison.</p> * * <p><code>null</code> is handled and returns <code>false</code>.</p> * * @param range the range to test, may be <code>null</code> * @return <code>true</code> if the specified range overlaps with this range */ public boolean overlapsRange(Range range) { if (range == null) { return false; } return range.containsInteger(min) || range.containsInteger(max) || containsInteger(range.getMinimumInteger()); }
/** * <p>Tests whether the specified range overlaps with this range * using <code>int</code> comparison.</p> * * <p><code>null</code> is handled and returns <code>false</code>.</p> * * @param range the range to test, may be <code>null</code> * @return <code>true</code> if the specified range overlaps with this range */ public boolean overlapsRange(Range range) { if (range == null) { return false; } return range.containsInteger(min) || range.containsInteger(max) || containsInteger(range.getMinimumInteger()); }
/** * <p>Tests whether the specified range overlaps with this range * using <code>int</code> comparison.</p> * * <p><code>null</code> is handled and returns <code>false</code>.</p> * * @param range the range to test, may be <code>null</code> * @return <code>true</code> if the specified range overlaps with this range */ public boolean overlapsRange(Range range) { if (range == null) { return false; } return range.containsInteger(min) || range.containsInteger(max) || containsInteger(range.getMinimumInteger()); }
/** * <p>Tests whether the specified range overlaps with this range * using <code>int</code> comparison.</p> * * <p><code>null</code> is handled and returns <code>false</code>.</p> * * @param range the range to test, may be <code>null</code> * @return <code>true</code> if the specified range overlaps with this range */ public boolean overlapsRange(Range range) { if (range == null) { return false; } return range.containsInteger(min) || range.containsInteger(max) || containsInteger(range.getMinimumInteger()); }
/** * Validates the name of poll title. * * @param pollItem validated poll item * @return {@code true} if poll item name has correct length, * otherwise {@code false} */ private boolean isPollItemValid(PollItem pollItem) { String pollItemName = pollItem.getName(); Range range = new IntRange(minLength, maxLenght); int pollItemLength = pollItemName.length(); return range.containsInteger(pollItemLength); } }