@Test public void testIsGreaterThan() { assertTrue(version.isGreaterThan(new Version(0, 0, 0))); assertTrue(version.isGreaterThan(new Version(0, 0, 1))); assertTrue(version.isGreaterThan(new Version(0, 1, 0))); assertTrue(version.isGreaterThan(new Version(1, 0, 0))); assertTrue(version.isGreaterThan(new Version(1, 2, 0))); assertTrue(version.isGreaterThan(new Version(1, 2, 2))); assertFalse(version.isGreaterThan(new Version(1, 2, 3))); assertFalse(version.isGreaterThan(new Version(1, 2, 4))); assertFalse(version.isGreaterThan(new Version(1, 3, 0))); assertFalse(version.isGreaterThan(new Version(2, 0, 0))); assertFalse(version.isGreaterThan(new Version(2, 0, 1))); assertFalse(version.isGreaterThan(new Version(2, 1, 0))); }
public boolean isGreaterThan(Version version) { if (major > version.major) { return true; } if (major < version.major) { return false; } if (minor > version.minor) { return true; } if (minor < version.minor) { return false; } return update > version.update; }
Version implements Serializable, Comparable<Version> { public boolean isGreaterThan(Version version) { if (major > version.major) { return true; } if (major < version.major) { return false; } if (minor > version.minor) { return true; } if (minor < version.minor) { return false; } return update > version.update; } }
Version implements Serializable, Comparable<Version> { public boolean isGreaterThan(Version version) { if (major > version.major) { return true; } if (major < version.major) { return false; } if (minor > version.minor) { return true; } if (minor < version.minor) { return false; } return update > version.update; } Version(int major, int minor, int update); }
Version implements Serializable, Comparable<Version> { public boolean isGreaterThan(Version version) { if (major > version.major) { return true; } if (major < version.major) { return false; } if (minor > version.minor) { return true; } if (minor < version.minor) { return false; } return update > version.update; } Version(int major, int minor, int update); static Version parseString(String version); boolean isGreaterThan(Version version); boolean isGreaterOrEqualThan(Version version); boolean isEqualTo(Version version); int getMinorVersion(); int getMajorVersion(); int getUpdateVersion(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object object); @Override int compareTo(Version v); }
Version implements Serializable, Comparable<Version> { public boolean isGreaterThan(Version version) { if (major > version.major) { return true; } if (major < version.major) { return false; } if (minor > version.minor) { return true; } if (minor < version.minor) { return false; } return update > version.update; } Version(int major, int minor, int update); static Version parseString(String version); boolean isGreaterThan(Version version); boolean isGreaterOrEqualThan(Version version); boolean isEqualTo(Version version); int getMinorVersion(); int getMajorVersion(); int getUpdateVersion(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object object); @Override int compareTo(Version v); static final Version ZERO; static final Version MIN; static final Version MAX; }