private static VersionRange parseVersionRange(Element restrictElement) { final String version = restrictElement.attributeValue("version"); if (version != null) { return VersionRange.parse(version); } else { final List<Element> versionElements = restrictElement.elements("version"); if (!versionElements.isEmpty()) { VersionRange range = VersionRange.empty(); for (Element versionElement : versionElements) { range = range.or(VersionRange.parse(versionElement.getText())); } return range; } else { return VersionRange.all(); } } }
private static boolean isLowerThan(String version, String rightVersion, boolean rightIncluded) { final int rightCompare = newVersionComparator().compare(rightVersion, version); return rightCompare > 0 || (rightIncluded && rightCompare == 0); }
checkState(rightParenthesis == null); checkState(rightVersion == null); return VersionRange.include(leftVersion).unbounded(); } else if (leftParenthesis.equals("[") && rightParenthesis.equals("]") && rightVersion == null) // single version return VersionRange.single(leftVersion); } else { final ActualVersionRangeBuilder builder; if (leftParenthesis.equals("[")) { checkState(leftVersion != null); builder = VersionRange.include(leftVersion); } else if (leftParenthesis.equals("(")) { if (leftVersion != null) { builder = VersionRange.exclude(leftVersion); } else { builder = VersionRange.unbounded();
ModuleRestrict(String application, InstallationMode mode) { this(application, mode, VersionRange.all()); }
@Override public boolean apply(ModuleRestrict restrict) { return restrict.application.equals(app.getKey()) && isInstallModeValid(restrict.mode) && restrict.version.isInRange(app.getVersion()); }
private static boolean isGreaterThan(boolean leftIncluded, String leftVersion, String version) { final int leftCompare = newVersionComparator().compare(version, leftVersion); return leftCompare > 0 || (leftIncluded && leftCompare == 0); }