/** * <p>Tests whether the specified <code>long</code> occurs within * this range using <code>long</code> comparison.</p> * * <p>This implementation uses the {@link #getMinimumLong()} and * {@link #getMaximumLong()} methods and should be good for most uses.</p> * * @param value the long to test * @return <code>true</code> if the specified number occurs within this * range by <code>long</code> comparison */ public boolean containsLong(long value) { return value >= getMinimumLong() && value <= getMaximumLong(); }
/** * <p>Tests whether the specified range occurs entirely within this range * using <code>long</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 occurs entirely within this range * @throws IllegalArgumentException if the range is not of this type */ public boolean containsRange(Range range) { if (range == null) { return false; } return containsLong(range.getMinimumLong()) && containsLong(range.getMaximumLong()); }
/** * <p>Tests whether the specified range overlaps with this range * using <code>long</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.containsLong(min) || range.containsLong(max) || containsLong(range.getMinimumLong()); }
/** * <p>Tests whether the specified <code>long</code> occurs within * this range using <code>long</code> comparison.</p> * * <p>This implementation uses the {@link #getMinimumLong()} and * {@link #getMaximumLong()} methods and should be good for most uses.</p> * * @param value the long to test * @return <code>true</code> if the specified number occurs within this * range by <code>long</code> comparison */ public boolean containsLong(long value) { return value >= getMinimumLong() && value <= getMaximumLong(); }
/** * <p>Tests whether the specified <code>long</code> occurs within * this range using <code>long</code> comparison.</p> * * <p>This implementation uses the {@link #getMinimumLong()} and * {@link #getMaximumLong()} methods and should be good for most uses.</p> * * @param value the long to test * @return <code>true</code> if the specified number occurs within this * range by <code>long</code> comparison */ public boolean containsLong(long value) { return value >= getMinimumLong() && value <= getMaximumLong(); }
/** * <p>Tests whether the specified <code>long</code> occurs within * this range using <code>long</code> comparison.</p> * * <p>This implementation uses the {@link #getMinimumLong()} and * {@link #getMaximumLong()} methods and should be good for most uses.</p> * * @param value the long to test * @return <code>true</code> if the specified number occurs within this * range by <code>long</code> comparison */ public boolean containsLong(long value) { return value >= getMinimumLong() && value <= getMaximumLong(); }
/** * <p>Tests whether the specified <code>long</code> occurs within * this range using <code>long</code> comparison.</p> * * <p>This implementation uses the {@link #getMinimumLong()} and * {@link #getMaximumLong()} methods and should be good for most uses.</p> * * @param value the long to test * @return <code>true</code> if the specified number occurs within this * range by <code>long</code> comparison */ public boolean containsLong(long value) { return value >= getMinimumLong() && value <= getMaximumLong(); }
/** * <p>Tests whether the specified <code>long</code> occurs within * this range using <code>long</code> comparison.</p> * * <p>This implementation uses the {@link #getMinimumLong()} and * {@link #getMaximumLong()} methods and should be good for most uses.</p> * * @param value the long to test * @return <code>true</code> if the specified number occurs within this * range by <code>long</code> comparison */ public boolean containsLong(long value) { return value >= getMinimumLong() && value <= getMaximumLong(); }
/** * <p>Tests whether the specified range occurs entirely within this range * using <code>long</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 occurs entirely within this range * @throws IllegalArgumentException if the range is not of this type */ public boolean containsRange(Range range) { if (range == null) { return false; } return containsLong(range.getMinimumLong()) && containsLong(range.getMaximumLong()); }
/** * <p>Tests whether the specified range overlaps with this range * using <code>long</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.containsLong(min) || range.containsLong(max) || containsLong(range.getMinimumLong()); }
public static LongRange clipRange(Range range) { long rangeEnd = range.getMaximumLong(); long rangeStart = range.getMinimumLong(); boolean trimmingOccurred = false; if (MacAddressRangeUtils.macIsMulticast(rangeStart)) { rangeStart = (rangeStart | 0x00FFFFFFFFFFL) + 1; trimmingOccurred = true; } final long trimmedRangeEnd = Math.min(rangeStart + Integer.MAX_VALUE - 1, rangeEnd); if (rangeEnd != trimmedRangeEnd) { rangeEnd = trimmedRangeEnd; trimmingOccurred = true; } if (MacAddressRangeUtils.macIsMulticast(rangeEnd)) { rangeEnd = (rangeEnd & 0xFF0000000000L) - 1; trimmingOccurred = true; } if (rangeStart > rangeEnd) { log.warn( "User supplied range({}) contains only multicast addresses, so this range is not usable.", range); return null; } final LongRange result = new LongRange(rangeStart, rangeEnd); if (trimmingOccurred) { log.warn("User supplied range({}) need to be trimmed to {}.", range, result); } return result; }
/** * <p>Tests whether the specified range overlaps with this range * using <code>long</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.containsLong(min) || range.containsLong(max) || containsLong(range.getMinimumLong()); }
/** * <p>Tests whether the specified range occurs entirely within this range * using <code>long</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 occurs entirely within this range * @throws IllegalArgumentException if the range is not of this type */ public boolean containsRange(Range range) { if (range == null) { return false; } return containsLong(range.getMinimumLong()) && containsLong(range.getMaximumLong()); }
/** * <p>Tests whether the specified range occurs entirely within this range * using <code>long</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 occurs entirely within this range * @throws IllegalArgumentException if the range is not of this type */ public boolean containsRange(Range range) { if (range == null) { return false; } return containsLong(range.getMinimumLong()) && containsLong(range.getMaximumLong()); }
/** * <p>Tests whether the specified range overlaps with this range * using <code>long</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.containsLong(min) || range.containsLong(max) || containsLong(range.getMinimumLong()); }
/** * <p>Tests whether the specified range overlaps with this range * using <code>long</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.containsLong(min) || range.containsLong(max) || containsLong(range.getMinimumLong()); }
/** * <p>Tests whether the specified range occurs entirely within this range * using <code>long</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 occurs entirely within this range * @throws IllegalArgumentException if the range is not of this type */ public boolean containsRange(Range range) { if (range == null) { return false; } return containsLong(range.getMinimumLong()) && containsLong(range.getMaximumLong()); }
/** * <p>Tests whether the specified range occurs entirely within this range * using <code>long</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 occurs entirely within this range * @throws IllegalArgumentException if the range is not of this type */ public boolean containsRange(Range range) { if (range == null) { return false; } return containsLong(range.getMinimumLong()) && containsLong(range.getMaximumLong()); }
/** * <p>Tests whether the specified range overlaps with this range * using <code>long</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.containsLong(min) || range.containsLong(max) || containsLong(range.getMinimumLong()); }