/** * Convert <code>version</code> into its OSGi equivalent if possible. * * @param version The version to convert. Can be <code>null</code> * @return The converted version or <code>null</code> if the argument was <code>null</code> * @throws UnsupportedOperationException if the version could not be converted into an OSGi version */ public static org.osgi.framework.Version toOSGiVersion(Version version) { if (version == null) return null; if (version == Version.emptyVersion) return org.osgi.framework.Version.emptyVersion; if (version == Version.MAX_VERSION) return new org.osgi.framework.Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); BasicVersion bv = (BasicVersion) version; return new org.osgi.framework.Version(bv.getMajor(), bv.getMinor(), bv.getMicro(), bv.getQualifier()); }
((BasicVersion) minVersion).rawToString(result, true); } else { result.append(includeMin ? '[' : '('); ((BasicVersion) minVersion).rawToString(result, true); result.append(','); ((BasicVersion) maxVersion).rawToString(result, true); result.append(includeMax ? ']' : ')'); result.append(':'); if (gtEqual) { ((BasicVersion) minVersion).originalToString(result, true); } else { if (Version.emptyVersion.equals(minVersion)) ((BasicVersion) minVersion).rawToString(result, true); else ((BasicVersion) minVersion).originalToString(result, true); result.append(','); ((BasicVersion) maxVersion).originalToString(result, true);
/** * Convert <code>version</code> into its OSGi equivalent if possible. * * @param version The version to convert. Can be <code>null</code> * @return The converted version or <code>null</code> if the argument was <code>null</code> * @throws UnsupportedOperationException if the version could not be converted into an OSGi version */ public static org.osgi.framework.Version toOSGiVersion(Version version) { if (version == null) return null; if (version == Version.emptyVersion) return org.osgi.framework.Version.emptyVersion; if (version == Version.MAX_VERSION) return new org.osgi.framework.Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); BasicVersion bv = (BasicVersion) version; return new org.osgi.framework.Version(bv.getMajor(), bv.getMinor(), bv.getMicro(), bv.getQualifier()); }
/** * Convert <code>version</code> into its OSGi equivalent if possible. * * @param version The version to convert. Can be <code>null</code> * @return The converted version or <code>null</code> if the argument was <code>null</code> * @throws UnsupportedOperationException if the version could not be converted into an OSGi version */ public static org.osgi.framework.Version toOSGiVersion(Version version) { if (version == null) return null; if (version == Version.emptyVersion) return org.osgi.framework.Version.emptyVersion; if (version == Version.MAX_VERSION) return new org.osgi.framework.Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); BasicVersion bv = (BasicVersion) version; return new org.osgi.framework.Version(bv.getMajor(), bv.getMinor(), bv.getMicro(), bv.getQualifier()); }
public boolean equals(Object object) { if (object == this) return true; if (!(object instanceof OSGiVersion)) { if (object instanceof BasicVersion) { BasicVersion ov = (BasicVersion) object; return VersionVector.equals(getVector(), null, ov.getVector(), ov.getPad()); } return false; } OSGiVersion other = (OSGiVersion) object; return micro == other.micro && minor == other.minor && major == other.major && qualifier.equals(other.qualifier); }
/** * Convert <code>version</code> into its OSGi equivalent if possible. * * @param version The version to convert. Can be <code>null</code> * @return The converted version or <code>null</code> if the argument was <code>null</code> * @throws UnsupportedOperationException if the version could not be converted into an OSGi version */ public static org.osgi.framework.Version toOSGiVersion(Version version) { if (version == null) return null; if (version == Version.emptyVersion) return org.osgi.framework.Version.emptyVersion; if (version == Version.MAX_VERSION) return new org.osgi.framework.Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); BasicVersion bv = (BasicVersion) version; return new org.osgi.framework.Version(bv.getMajor(), bv.getMinor(), bv.getMicro(), bv.getQualifier()); }
public int compareTo(Version v) { int result; if (!(v instanceof OSGiVersion)) { BasicVersion ov = (BasicVersion) v; result = VersionVector.compare(getVector(), null, ov.getVector(), ov.getPad()); } else { OSGiVersion ov = (OSGiVersion) v; result = major - ov.major; if (result == 0) { result = minor - ov.minor; if (result == 0) { result = micro - ov.micro; if (result == 0) result = VersionVector.compareSegments(qualifier, ov.qualifier); } } } return result; }