@Test @Ignore public void past_minor() { hdr.version_number = VERSION - 1; assertEquals(Const.Validation.OLD_MINOR, Const.validateHeader(hdr)); }
public static Validation validateHeader(tsfile_mimeheader hdr) { if (!Arrays.equals(MAGIC, hdr.magic)) return Validation.INVALID_MAGIC; if (hdr.version_number < 0) return Validation.INVALID_NEG_VERSION; int maj_cmp = Short.compare(version_major(hdr.version_number), MAJOR); int min_cmp = Short.compare(version_minor(hdr.version_number), MINOR); if (maj_cmp != 0) return (maj_cmp < 0 ? Validation.OLD_MAJOR : Validation.NEW_MAJOR); if (min_cmp != 0) return (min_cmp < 0 ? Validation.OLD_MINOR : Validation.NEW_MINOR); return Validation.CURRENT; }
Const { public static Validation validateHeader(tsfile_mimeheader hdr) { if (!Arrays.equals(MAGIC, hdr.magic)) return Validation.INVALID_MAGIC; if (hdr.version_number < 0) return Validation.INVALID_NEG_VERSION; int maj_cmp = Short.compare(version_major(hdr.version_number), MAJOR); int min_cmp = Short.compare(version_minor(hdr.version_number), MINOR); if (maj_cmp != 0) return (maj_cmp < 0 ? Validation.OLD_MAJOR : Validation.NEW_MAJOR); if (min_cmp != 0) return (min_cmp < 0 ? Validation.OLD_MINOR : Validation.NEW_MINOR); return Validation.CURRENT; } }
Const { public static Validation validateHeader(tsfile_mimeheader hdr) { if (!Arrays.equals(MAGIC, hdr.magic)) return Validation.INVALID_MAGIC; if (hdr.version_number < 0) return Validation.INVALID_NEG_VERSION; int maj_cmp = Short.compare(version_major(hdr.version_number), MAJOR); int min_cmp = Short.compare(version_minor(hdr.version_number), MINOR); if (maj_cmp != 0) return (maj_cmp < 0 ? Validation.OLD_MAJOR : Validation.NEW_MAJOR); if (min_cmp != 0) return (min_cmp < 0 ? Validation.OLD_MINOR : Validation.NEW_MINOR); return Validation.CURRENT; } private  Const(); }
Const { public static Validation validateHeader(tsfile_mimeheader hdr) { if (!Arrays.equals(MAGIC, hdr.magic)) return Validation.INVALID_MAGIC; if (hdr.version_number < 0) return Validation.INVALID_NEG_VERSION; int maj_cmp = Short.compare(version_major(hdr.version_number), MAJOR); int min_cmp = Short.compare(version_minor(hdr.version_number), MINOR); if (maj_cmp != 0) return (maj_cmp < 0 ? Validation.OLD_MAJOR : Validation.NEW_MAJOR); if (min_cmp != 0) return (min_cmp < 0 ? Validation.OLD_MINOR : Validation.NEW_MINOR); return Validation.CURRENT; } private  Const(); static int version_from_majmin(short maj, short min); static short version_major(int ver); static short version_minor(int ver); static boolean isUpgradable(short maj, short min); static boolean isUpgradable(int version); static boolean needsUpgrade(short maj, short min); static boolean needsUpgrade(int version); static Validation validateHeader(tsfile_mimeheader hdr); static int validateHeaderOrThrow(tsfile_mimeheader hdr); static boolean validateHeaderOrThrowForWrite(tsfile_mimeheader hdr); static int validateHeaderOrThrow(XdrDecodingStream decoder); static boolean validateHeaderOrThrowForWrite(XdrDecodingStream decoder); static void writeMimeHeader(XdrEncodingStream encoder, short major, short minor); static void writeMimeHeader(XdrEncodingStream encoder); }
Const { public static Validation validateHeader(tsfile_mimeheader hdr) { if (!Arrays.equals(MAGIC, hdr.magic)) return Validation.INVALID_MAGIC; if (hdr.version_number < 0) return Validation.INVALID_NEG_VERSION; int maj_cmp = Short.compare(version_major(hdr.version_number), MAJOR); int min_cmp = Short.compare(version_minor(hdr.version_number), MINOR); if (maj_cmp != 0) return (maj_cmp < 0 ? Validation.OLD_MAJOR : Validation.NEW_MAJOR); if (min_cmp != 0) return (min_cmp < 0 ? Validation.OLD_MINOR : Validation.NEW_MINOR); return Validation.CURRENT; } private  Const(); static int version_from_majmin(short maj, short min); static short version_major(int ver); static short version_minor(int ver); static boolean isUpgradable(short maj, short min); static boolean isUpgradable(int version); static boolean needsUpgrade(short maj, short min); static boolean needsUpgrade(int version); static Validation validateHeader(tsfile_mimeheader hdr); static int validateHeaderOrThrow(tsfile_mimeheader hdr); static boolean validateHeaderOrThrowForWrite(tsfile_mimeheader hdr); static int validateHeaderOrThrow(XdrDecodingStream decoder); static boolean validateHeaderOrThrowForWrite(XdrDecodingStream decoder); static void writeMimeHeader(XdrEncodingStream encoder, short major, short minor); static void writeMimeHeader(XdrEncodingStream encoder); static byte[] MAGIC; static final int MIME_HEADER_LEN; static final short MAJOR; static final short MINOR; }