@Override public String getMaximumVersion() { return fRange.getMaximum().toString(); }
static StringBuffer addFilterAttribute(StringBuffer filter, String attr, Object value, boolean escapeWildCard) { if (value instanceof VersionRange) { VersionRange range = (VersionRange) value; if (range.getIncludeMinimum()) { filter.append('(').append(attr).append(">=").append(escapeValue(range.getMinimum(), escapeWildCard)).append(')'); //$NON-NLS-1$ } else { filter.append("(!(").append(attr).append("<=").append(escapeValue(range.getMinimum(), escapeWildCard)).append("))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } // only include the maximum check if this is not an open range // this check is a bit hacky because we have no method on VersionRange to check if the range really is open if (!(MAX_VERSION.equals(range.getMaximum()) && range.getIncludeMaximum())) { if (range.getIncludeMaximum()) { filter.append('(').append(attr).append("<=").append(escapeValue(range.getMaximum(), escapeWildCard)).append(')'); //$NON-NLS-1$ } else { filter.append("(!(").append(attr).append(">=").append(escapeValue(range.getMaximum(), escapeWildCard)).append("))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } } else { filter.append('(').append(attr).append('=').append(escapeValue(value, escapeWildCard)).append(')'); } return filter; }
public void setVersion(String version) { try { if (version != null && !version.equals("")) { //$NON-NLS-1$ fVersionRange = new VersionRange(version); Version max = fVersionRange.getMaximum(); if (max.getMajor() != Integer.MAX_VALUE && fVersionRange.getMinimum().compareTo(fVersionRange.getMaximum()) < 0) fIsRanged = true; } } catch (IllegalArgumentException e) { // illegal version string passed fVersionRange = new VersionRange("[1.0.0,1.0.0]"); //$NON-NLS-1$ } }
private void writeVersionRange(VersionRange versionRange, DataOutputStream out) throws IOException { if (versionRange == null || versionRange.equals(VersionRange.emptyRange)) { out.writeByte(StateReader.NULL); return; } out.writeByte(StateReader.OBJECT); writeVersion(versionRange.getMinimum(), out); out.writeBoolean(versionRange.getIncludeMinimum()); writeVersion(versionRange.getMaximum(), out); out.writeBoolean(versionRange.getIncludeMaximum()); }
private void writeVersionRange(VersionRange versionRange, DataOutputStream out) throws IOException { if (versionRange == null || versionRange.equals(VersionRange.emptyRange)) { out.writeByte(StateReader.NULL); return; } out.writeByte(StateReader.OBJECT); writeVersion(versionRange.getMinimum(), out); out.writeBoolean(versionRange.getIncludeMinimum()); writeVersion(versionRange.getMaximum(), out); out.writeBoolean(versionRange.getIncludeMaximum()); }
private void writeVersionRange(VersionRange versionRange, DataOutputStream out) throws IOException { if (versionRange == null || versionRange.equals(VersionRange.emptyRange)) { out.writeByte(StateReader.NULL); return; } out.writeByte(StateReader.OBJECT); writeVersion(versionRange.getMinimum(), out); out.writeBoolean(versionRange.getIncludeMinimum()); writeVersion(versionRange.getMaximum(), out); out.writeBoolean(versionRange.getIncludeMaximum()); }
private void writeVersionRange(VersionRange versionRange, DataOutputStream out) throws IOException { if (versionRange == null || versionRange.equals(VersionRange.emptyRange)) { out.writeByte(StateReader.NULL); return; } out.writeByte(StateReader.OBJECT); writeVersion(versionRange.getMinimum(), out); out.writeBoolean(versionRange.getIncludeMinimum()); writeVersion(versionRange.getMaximum(), out); out.writeBoolean(versionRange.getIncludeMaximum()); }
public void preloadFields() { if (fRangeAllowed) { fMinVersionText.setText((fVersionRange != null) ? fVersionRange.getMinimum().toString() : ""); //$NON-NLS-1$ fMaxVersionText.setText((fVersionRange != null && fVersionRange.getMaximum().getMajor() != Integer.MAX_VALUE) ? fVersionRange.getMaximum().toString() : ""); //$NON-NLS-1$ if (fVersionRange != null) fMinVersionBound.select((fVersionRange.getIncludeMinimum()) ? 0 : 1); else fMinVersionBound.select(0); if (fVersionRange != null && getMaxVersion().length() > 0) fMaxVersionBound.select((fVersionRange.getIncludeMaximum()) ? 0 : 1); else fMaxVersionBound.select(1); } fMinVersionText.setText((fVersionRange != null) ? fVersionRange.getMinimum().toString() : ""); //$NON-NLS-1$ }
public boolean equals(Object object) { if (!(object instanceof VersionRange)) return false; VersionRange vr = (VersionRange) object; if (minVersion.equals(vr.getMinimum()) && includeMin == vr.includeMin) if (maxVersion.equals(vr.getMaximum()) && includeMax == vr.includeMax) return true; return false; }
public static VersionRange fromOSGiVersionRange(org.eclipse.osgi.service.resolver.VersionRange range) { if (range.equals(org.eclipse.osgi.service.resolver.VersionRange.emptyRange)) return VersionRange.emptyRange; return new VersionRange(fromOSGiVersion(range.getMinimum()), range.getIncludeMinimum(), fromOSGiVersion(range.getMaximum()), range.getIncludeMaximum()); } }
public static VersionRange fromOSGiVersionRange(org.eclipse.osgi.service.resolver.VersionRange range) { if (range.equals(org.eclipse.osgi.service.resolver.VersionRange.emptyRange)) return VersionRange.emptyRange; return new VersionRange(fromOSGiVersion(range.getMinimum()), range.getIncludeMinimum(), fromOSGiVersion(range.getMaximum()), range.getIncludeMaximum()); } }
public static VersionRange fromOSGiVersionRange(org.eclipse.osgi.service.resolver.VersionRange range) { if (range.equals(org.eclipse.osgi.service.resolver.VersionRange.emptyRange)) return VersionRange.emptyRange; return new VersionRange(fromOSGiVersion(range.getMinimum()), range.getIncludeMinimum(), fromOSGiVersion(range.getMaximum()), range.getIncludeMaximum()); } }
public static int getMatchRule(VersionRange versionRange) { if (versionRange == null || versionRange.getMinimum() == null) return IMatchRules.NONE; Version minimum = versionRange.getMinimum(); Version maximum = versionRange.getMaximum() == null ? maxVersion : versionRange.getMaximum(); if (maximum.compareTo(maxVersion) >= 0) return IMatchRules.GREATER_OR_EQUAL; else if (minimum.equals(maximum)) return IMatchRules.PERFECT; else if (!versionRange.isIncluded(minimum) || versionRange.isIncluded(maximum)) return IMatchRules.NONE; // no real match rule for this else if (minimum.getMajor() == maximum.getMajor() - 1) return IMatchRules.COMPATIBLE; else if (minimum.getMajor() != maximum.getMajor()) return IMatchRules.NONE; // no real match rule for this else if (minimum.getMinor() == maximum.getMinor() - 1) return IMatchRules.EQUIVALENT; else if (minimum.getMinor() != maximum.getMinor()) return IMatchRules.NONE; // no real match rule for this else if (minimum.getMicro() == maximum.getMicro() - 1) return IMatchRules.PERFECT; // this is as close as we got return IMatchRules.NONE; // no real match rule for this }