/** * Retrieves Sholl Analysis version * * @return the version or a non-empty place holder string if version could * not be retrieved. * */ public static String version() { final String VERSION = VersionUtils.getVersion(ShollUtils.class); return (VERSION == null) ? "X Dev" : VERSION; }
/** * Compares two version strings. * @param v1 The first version string. * @param v2 The second version string. * @return a negative integer, zero, or a positive integer as the * first argument is less than, equal to, or greater than the * second. */ public static int compare(final String v1, final String v2) { final String[] t1 = splitDots(v1), t2 = splitDots(v2); final int count = Math.min(t1.length, t2.length); for (int t=0; t<count; t++) { final int c = compareToken(t1[t], t2[t]); if (c != 0) return c; } if (t1.length == t2.length) return 0; // NB: Token count differs. More tokens means newer -- e.g. 1.5 < 1.5.1. return t1.length < t2.length ? -1 : 1; }
/** * Looks up the version of the specified class using any means available, * appending the build number to any {@code SNAPSHOT} version. The * {@code groupId} and {@code artifactId} parameters allow specification of * the POM lookup path. * * @param c - Look up this class's version * @param groupId - Maven group ID containing class * @param artifactId - Maven artifact ID containing class * @return Version of specified {@link Class} or null if not found. */ public static String getVersion(final Class<?> c, final String groupId, final String artifactId) { final String version = getVersionFromManifest(c); if (version != null) return version; return getVersionFromPOM(c, groupId, artifactId); }
/** Compares one token of a multi-token version string. */ private static int compareToken(final String t1, final String t2) { final int i1 = digitIndex(t1), i2 = digitIndex(t2); if (i1 > 0 && i2 > 0) { // Versions start with digits; compare them numerically. final long d1 = Long.parseLong(t1.substring(0, i1)); final long d2 = Long.parseLong(t2.substring(0, i2)); if (d1 < d2) return -1; if (d1 > d2) return 1; } // Compare remaining characters lexicographically. return t1.substring(i1).compareTo(t2.substring(i2)); }
assertTrue(VersionUtils.compare("1.5.1", "1.5.2") < 0); assertTrue(VersionUtils.compare("1.5.2", "1.5.1") > 0); assertTrue(VersionUtils.compare("1.5.2", "1.6.2") < 0); assertTrue(VersionUtils.compare("1.6.2", "1.5.2") > 0); assertTrue(VersionUtils.compare("1.7.3", "2.7.3") < 0); assertTrue(VersionUtils.compare("2.7.3", "1.7.3") > 0); assertTrue(VersionUtils.compare("1.5.2", "1.5.2-beta-1") < 0); assertTrue(VersionUtils.compare("1.5", "1.5.1") < 0); assertTrue(VersionUtils.compare("1.5.1", "1.5") > 0); assertEquals(VersionUtils.compare("1.5", "1.5"), 0); assertTrue(VersionUtils.compare("1.50a", "1.50b") < 0); assertTrue(VersionUtils.compare("1.5.1.3", "1.5.1.4") < 0); assertTrue(VersionUtils.compare("1.5.1.6", "1.5.1.5") > 0); assertEquals(VersionUtils.compare("10.4.9.8", "10.4.9.8"), 0); assertTrue(VersionUtils.compare("a.b.c", "a.b.d") < 0); assertTrue(VersionUtils.compare("2.0", "23.0") < 0); assertTrue(VersionUtils.compare("23.0", "2.0") > 0); assertTrue(VersionUtils.compare("3.0", "23.0") < 0); assertTrue(VersionUtils.compare("23.0", "3.0") > 0);
/** Compares one token of a multi-token version string. */ private static int compareToken(final String t1, final String t2) { final int i1 = digitIndex(t1), i2 = digitIndex(t2); if (i1 > 0 && i2 > 0) { // Versions start with digits; compare them numerically. final long d1 = Long.parseLong(t1.substring(0, i1)); final long d2 = Long.parseLong(t2.substring(0, i2)); if (d1 < d2) return -1; if (d1 > d2) return 1; } // Compare remaining characters lexicographically. return t1.substring(i1).compareTo(t2.substring(i2)); }
/** * Looks up the version of the specified class using any means available, * appending the build number to any {@code SNAPSHOT} version. Will only * search POMs in the base directory. * * @param c - Look up this class's version * @return Version of specified {@link Class} or null if not found. */ public static String getVersion(final Class<?> c) { return getVersion(c, null, null); }
/** * Looks up the version of the specified class using any means available, * appending the build number to any {@code SNAPSHOT} version. The * {@code groupId} and {@code artifactId} parameters allow specification of * the POM lookup path. * * @param c - Look up this class's version * @param groupId - Maven group ID containing class * @param artifactId - Maven artifact ID containing class * @return Version of specified {@link Class} or null if not found. */ public static String getVersion(final Class<?> c, final String groupId, final String artifactId) { final String version = getVersionFromManifest(c); if (version != null) return version; return getVersionFromPOM(c, groupId, artifactId); }
/** * Compares two version strings. * @param v1 The first version string. * @param v2 The second version string. * @return a negative integer, zero, or a positive integer as the * first argument is less than, equal to, or greater than the * second. */ public static int compare(final String v1, final String v2) { final String[] t1 = splitDots(v1), t2 = splitDots(v2); final int count = Math.min(t1.length, t2.length); for (int t=0; t<count; t++) { final int c = compareToken(t1[t], t2[t]); if (c != 0) return c; } if (t1.length == t2.length) return 0; // NB: Token count differs. More tokens means newer -- e.g. 1.5 < 1.5.1. return t1.length < t2.length ? -1 : 1; }
/** * Looks up the version of the specified class using any means available, * appending the build number to any {@code SNAPSHOT} version. Will only * search POMs in the base directory. * * @param c - Look up this class's version * @return Version of specified {@link Class} or null if not found. */ public static String getVersion(final Class<?> c) { return getVersion(c, null, null); }
private static String getVersion() { return VersionUtils.getVersion(tracing.SimpleNeuriteTracer.class); }
@Override default String getEngineVersion() { return VersionUtils.getVersion(getClass()); } }
@Override default String getEngineVersion() { return VersionUtils.getVersion(getClass()); } }
/** Gets the version of the object. */ default String getVersion() { return VersionUtils.getVersion(getClass()); }
/** Gets the version of the object. */ default String getVersion() { return VersionUtils.getVersion(getClass()); }
@Override default String getLanguageVersion() { return VersionUtils.getVersion(getClass()); }
@Override default String getLanguageVersion() { return VersionUtils.getVersion(getClass()); }
@Override public String getVersion() { try { return VersionUtils.getVersion(loadClass()); } catch (InstantiableException exc) { return null; } }
public Helper(final Context context) { context.inject(this); VERSION = VersionUtils.getVersion(sholl.gui.Helper.class); }
@Override public String getVersion() { try { return VersionUtils.getVersion(loadClass()); } catch (InstantiableException exc) { return null; } }