@Override public boolean includes(Version version) { for (VersionRange range : ranges) { if (range.includes(version)) { return true; } } return false; }
@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(); }
@Override public boolean isMinInclusive() { VersionRange min = null; for (VersionRange range : ranges) { if (min == null || range.getMin().compareTo(min.getMin()) < 0) { min = range; } } return min == null ? false : min.isMinInclusive(); }
public static boolean isSkipped(Coordinate coordinate) { for (Entry<Coordinate, VersionRange> entry : map.entrySet()) { Coordinate pattern = entry.getKey(); VersionRange range = entry.getValue(); if (isPatternMatch(pattern.getGroupId(), coordinate.getGroupId()) && isPatternMatch(pattern.getArtifactId(), coordinate.getArtifactId()) && isPatternMatch(pattern.getClassifier(), coordinate.getClassifier())) { if (range.isEmpty() || range.includes(new SingleVersion(coordinate.getVersion()))) return true; } } return false; }
/** * 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); }
return intersection != null && !intersection.isEmpty(); } catch (Throwable t)
public static boolean isSkipped(Coordinate coordinate) { for (Entry<Coordinate, VersionRange> entry : map.entrySet()) { Coordinate pattern = entry.getKey(); VersionRange range = entry.getValue(); if (isPatternMatch(pattern.getGroupId(), coordinate.getGroupId()) && isPatternMatch(pattern.getArtifactId(), coordinate.getArtifactId()) && isPatternMatch(pattern.getClassifier(), coordinate.getClassifier())) { if (range.isEmpty() || range.includes(new SingleVersion(coordinate.getVersion()))) return true; } } return false; }
if (res1.getMin() == null || res2.getMax() == null || res1.getMin().compareTo(res2.getMax()) <= 0) if (res1.getMax() == null || res2.getMin() == null || res1.getMax().compareTo(res2.getMin()) >= 0) if (res1.getMin() == null) min = res2.getMin(); minInclusive = res2.isMinInclusive(); else if (res2.getMin() == null) min = res1.getMin(); minInclusive = res1.isMinInclusive(); int comparison = res1.getMin().compareTo(res2.getMin()); if (comparison < 0) min = res2.getMin(); minInclusive = res2.isMinInclusive(); min = res1.getMin(); minInclusive = res1.isMinInclusive() && res2.isMinInclusive(); min = res1.getMin(); minInclusive = res1.isMinInclusive(); if (res1.getMax() == null)
return intersection != null && !intersection.isEmpty(); } catch (Throwable t)
public static boolean isSkipped(Coordinate coordinate) { for (Entry<Coordinate, VersionRange> entry : map.entrySet()) { Coordinate pattern = entry.getKey(); VersionRange range = entry.getValue(); if (isPatternMatch(pattern.getGroupId(), coordinate.getGroupId()) && isPatternMatch(pattern.getArtifactId(), coordinate.getArtifactId()) && isPatternMatch(pattern.getClassifier(), coordinate.getClassifier())) { if (range.isEmpty() || range.includes(new SingleVersion(coordinate.getVersion()))) return true; } } return false; }
if (getMin() != null) if (!getMin().equals(restriction.getMin())) else if (restriction.getMin() != null) if (isMinInclusive() != restriction.isMinInclusive()) if (!getMax().equals(restriction.getMax())) else if (restriction.getMax() != null) if (isMaxInclusive() != restriction.isMaxInclusive())
@Override public VersionRange getIntersection(VersionRange... ranges) { for (VersionRange range : ranges) { if (range.includes(version)) return this; } return new EmptyVersionRange(); }