本文整理了Java中org.apache.sis.util.Version.compareTo()
方法的一些代码示例,展示了Version.compareTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.compareTo()
方法的具体详情如下:
包路径:org.apache.sis.util.Version
类名称:Version
方法名:compareTo
[英]Compares this version with an other version object. This method performs the same comparison than #compareTo(Version,int) with no limit.
[中]将此版本与其他版本对象进行比较。此方法执行与#compareTo(Version,int)相同的比较,没有限制。
代码示例来源:origin: org.apache.sis.core/sis-utility
/**
* Compares this version with an other version object. This method performs the same
* comparison than {@link #compareTo(Version, int)} with no limit.
*
* @param other the other version object to compare with.
* @return a negative value if this version is lower than the supplied version,
* a positive value if it is higher, or 0 if they are equal.
*/
@Override
public int compareTo(final Version other) {
return compareTo(other, Integer.MAX_VALUE);
}
代码示例来源:origin: apache/sis
/**
* Compares this version with an other version object. This method performs the same
* comparison than {@link #compareTo(Version, int)} with no limit.
*
* @param other the other version object to compare with.
* @return a negative value if this version is lower than the supplied version,
* a positive value if it is higher, or 0 if they are equal.
*/
@Override
public int compareTo(final Version other) {
return compareTo(other, Integer.MAX_VALUE);
}
代码示例来源:origin: apache/sis
/**
* Creates a new GPX writer for the given data store.
*
* @param owner the data store for which this writer is created.
* @param metadata the metadata to write, or {@code null} if none.
* @throws DataStoreException if the output type is not recognized or the data store is closed.
* @throws XMLStreamException if an error occurred while opening the XML file.
* @throws IOException if an error occurred while preparing the output stream.
*/
public Writer(final Store owner, final Metadata metadata)
throws DataStoreException, XMLStreamException, IOException
{
super(owner);
this.metadata = metadata;
final Version ver = owner.version;
if (ver != null && ver.compareTo(StoreProvider.V1_0, 2) <= 0) {
version = 0;
} else {
version = 1;
}
}
代码示例来源:origin: apache/sis
/**
* Returns {@code true} if the GML version is equals or newer than the specified version.
* If no GML version was specified, then this method returns {@code true}, i.e. newest
* version is assumed.
*
* <div class="note"><b>API note:</b>
* This method is static for the convenience of performing the check for null context.</div>
*
* @param context the current context, or {@code null} if none.
* @param version the version to compare to.
* @return {@code true} if the GML version is equals or newer than the specified version.
*
* @see #getVersion(String)
*/
public static boolean isGMLVersion(final Context context, final Version version) {
if (context != null) {
final Version versionGML = context.versionGML;
if (versionGML != null) {
return versionGML.compareTo(version) >= 0;
}
}
return true;
}
代码示例来源:origin: org.apache.sis.core/sis-utility
/**
* Returns {@code true} if the GML version is equals or newer than the specified version.
* If no GML version were specified, then this method returns {@code true}, i.e. newest
* version is assumed.
*
* <div class="note"><b>API note:</b>
* This method is static for the convenience of performing the check for null context.</div>
*
* @param context the current context, or {@code null} if none.
* @param version the version to compare to.
* @return {@code true} if the GML version is equals or newer than the specified version.
*
* @see #getVersion(String)
*/
public static boolean isGMLVersion(final Context context, final Version version) {
if (context != null) {
final Version versionGML = context.versionGML;
if (versionGML != null) {
return versionGML.compareTo(version) >= 0;
}
}
return true;
}
代码示例来源:origin: org.apache.sis.core/sis-utility
if (versionGML.compareTo(LegacyNamespaces.VERSION_3_2_1) < 0) {
return FilterVersion.GML31;
代码示例来源:origin: org.apache.sis.core/sis-utility
/**
* Compare this version string with the specified object for equality. Two version are
* considered equal if <code>{@linkplain #compareTo(Object) compareTo}(other) == 0</code>.
*
* @param other the object to compare with this version for equality.
*/
@Override
public boolean equals(final Object other) {
if (other != null && getClass() == other.getClass()) {
return compareTo((Version) other) == 0;
}
return false;
}
代码示例来源:origin: apache/sis
/**
* Compare this version string with the specified object for equality. Two version are
* considered equal if <code>{@linkplain #compareTo(Object) compareTo}(other) == 0</code>.
*
* @param other the object to compare with this version for equality.
*/
@Override
public boolean equals(final Object other) {
if (other != null && getClass() == other.getClass()) {
return compareTo((Version) other) == 0;
}
return false;
}
代码示例来源:origin: apache/sis
if (versionGML == null ? byDefault : versionGML .compareTo(LegacyNamespaces.VERSION_3_2_1) < 0) combine = 1;
if (versionMetadata == null ? byDefault : versionMetadata.compareTo(LegacyNamespaces.VERSION_2014) < 0) combine |= 2;
switch (combine) {
case 0: return null;
代码示例来源:origin: Geomatys/geotoolkit
if (max == null || max.compareTo(candidate) <= 0) {
max = candidate;
selected = version;
代码示例来源:origin: apache/sis
final WarningListener<?> warningListener)
if (versionMetadata != null && versionMetadata.compareTo(LegacyNamespaces.VERSION_2014) < 0) {
bitMasks |= LEGACY_METADATA;
代码示例来源:origin: apache/sis
/**
* Tests {@link Version#compareTo(Version, int)} with version numbers needed by our GML support.
*/
@Test
public void testGML() {
final Version V3_0 = new Version("3.0"),
V3_2 = new Version("3.2"),
V3_2_1 = new Version("3.2.1");
assertTrue(V3_2.compareTo(V3_2_1, 2) == 0);
assertTrue(V3_2.compareTo(V3_2_1 ) < 0);
assertTrue(V3_0.compareTo(V3_2_1 ) < 0);
assertTrue(V3_0.compareTo(V3_2_1, 2) < 0);
assertTrue(V3_0.compareTo(V3_2_1, 1) == 0);
assertTrue(V3_0.compareTo(V3_2 ) < 0);
assertTrue(V3_0.compareTo(V3_2, 2) < 0);
assertTrue(V3_0.compareTo(V3_2, 1) == 0);
}
代码示例来源:origin: apache/sis
/**
* Tests a numeric-only version.
*/
@Test
public void testNumeric() {
final Version version = new Version("6.11.2");
assertEquals("6.11.2", version.toString());
assertEquals( 6, version.getMajor());
assertEquals(11, version.getMinor());
assertEquals( 2, version.getRevision());
assertSame(version.getRevision(), version.getComponent(2));
assertNull(version.getComponent(3));
assertTrue(version.compareTo(new Version("6.11.2")) == 0);
assertTrue(version.compareTo(new Version("6.8" )) > 0);
assertTrue(version.compareTo(new Version("6.12.0")) < 0);
assertTrue(version.compareTo(new Version("6.11" )) > 0);
}
代码示例来源:origin: apache/sis
if (ver != null) {
version = new Version(ver);
if (version.compareTo(StoreProvider.V1_0, 2) < 0 ||
version.compareTo(StoreProvider.V1_1, 2) > 0)
代码示例来源:origin: apache/sis
/**
* Tests a alpha-numeric version.
*/
@Test
@DependsOnMethod("testNumeric")
public void testAlphaNumeric() {
final Version version = new Version("1.6.b2");
assertEquals("1.6.b2", version.toString());
assertEquals( 1, version.getMajor());
assertEquals( 6, version.getMinor());
assertEquals("b2", version.getRevision());
assertSame(version.getRevision(), version.getComponent(2));
assertNull(version.getComponent(3));
assertTrue(version.compareTo(new Version("1.6.b2")) == 0);
assertTrue(version.compareTo(new Version("1.6.b1")) > 0);
assertTrue(version.compareTo(new Version("1.07.b1")) < 0);
}
内容来源于网络,如有侵权,请联系作者删除!