/** * @return {@code true} if this version is equal to {@link Version#UNKNOWN} */ public boolean isUnknown() { return pack() == UNKNOWN_VERSION; }
/** * @return a {@link Version} initialized with this {@code MemberVersion}'s major.minor version. */ public Version asVersion() { return Version.of(major, minor); } }
@Override public int compare(MemberVersion o1, MemberVersion o2) { int thisVersion = (o1.getMajor() << 8 & 0xff00) | (o1.getMinor() & 0xff); int thatVersion = (o2.getMajor() << 8 & 0xff00) | (o2.getMinor() & 0xff); if (thisVersion > thatVersion) { return 1; } else { return thisVersion == thatVersion ? 0 : -1; } } }
/** * @return the {@code ClusterVersion} with the given major and minor */ public static Version of(int major, int minor) { if (major == UNKNOWN_VERSION && minor == UNKNOWN_VERSION) { return UNKNOWN; } else { return new Version(major, minor); } }
public static MemberVersion of(int major, int minor, int patch) { if (major == 0 && minor == 0 && patch == 0) { return MemberVersion.UNKNOWN; } else { return new MemberVersion(major, minor, patch); } }
@Override public int compare(MemberVersion o1, MemberVersion o2) { int thisVersion = (o1.getMajor() << 8 & 0xff00) | (o1.getMinor() & 0xff); int thatVersion = (o2.getMajor() << 8 & 0xff00) | (o2.getMinor() & 0xff); if (thisVersion > thatVersion) { return 1; } else { return thisVersion == thatVersion ? 0 : -1; } } }
/** * @return a {@link Version} initialized with this {@code MemberVersion}'s major.minor version. */ public Version asVersion() { return Version.of(major, minor); } }
/** * @return {@code true} if this version is equal to {@link Version#UNKNOWN} */ public boolean isUnknown() { return pack() == UNKNOWN_VERSION; }