@Override public boolean isMaxInclusive() { VersionRange max = null; for (VersionRange range : ranges) { if (max == null || range.getMax().compareTo(max.getMax()) > 0) { max = range; } } return max == null ? false : max.isMaxInclusive(); }
maxInclusive = res2.isMaxInclusive(); maxInclusive = res1.isMaxInclusive(); maxInclusive = res1.isMaxInclusive(); maxInclusive = res1.isMaxInclusive() && res2.isMaxInclusive(); maxInclusive = res2.isMaxInclusive();
/** * Calculate the intersection of one or more {@link VersionRange} instances, returning a single {@link VersionRange} * as the result. */ public static VersionRange intersection(Collection<VersionRange> ranges) { Assert.notNull(ranges, "Version ranges must not be null."); Assert.isTrue(ranges.size() >= 1, "Version ranges must not be empty."); Version min = null; Version max = null; boolean minInclusive = false; boolean maxInclusive = false; for (VersionRange range : ranges) { if (min == null || range.getMin().compareTo(min) > 0) { min = range.getMin(); minInclusive = range.isMinInclusive(); } if (max == null || range.getMax().compareTo(max) < 0) { max = range.getMax(); maxInclusive = range.isMaxInclusive(); } } return new DefaultVersionRange(min, minInclusive, max, maxInclusive); }
if (isMaxInclusive() != restriction.isMaxInclusive())