/** * {@inheritDoc} * <p> * Compare this ObjectId to another and obtain a sort ordering. */ @Override public final int compareTo(AnyObjectId other) { if (this == other) return 0; int cmp; cmp = NB.compareUInt32(w1, other.w1); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, other.w2); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, other.w3); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, other.w4); if (cmp != 0) return cmp; return NB.compareUInt32(w5, other.w5); }
/** * Compare this ObjectId to a network-byte-order ObjectId. * * @param bs * array containing the other ObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least 5 * integers, starting at this position are required. * @return a negative integer, zero, or a positive integer as this object is * less than, equal to, or greater than the specified object. */ public final int compareTo(int[] bs, int p) { int cmp; cmp = NB.compareUInt32(w1, bs[p]); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, bs[p + 1]); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, bs[p + 2]); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, bs[p + 3]); if (cmp != 0) return cmp; return NB.compareUInt32(w5, bs[p + 4]); }
/** * Compares this abbreviation to a full object id. * * @param other * the other object id. * @return <0 if this abbreviation names an object that is less than * <code>other</code>; 0 if this abbreviation exactly matches the * first {@link #length()} digits of <code>other.name()</code>; * >0 if this abbreviation names an object that is after * <code>other</code>. */ public final int prefixCompare(AnyObjectId other) { int cmp; cmp = NB.compareUInt32(w1, mask(1, other.w1)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, mask(2, other.w2)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, mask(3, other.w3)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, mask(4, other.w4)); if (cmp != 0) return cmp; return NB.compareUInt32(w5, mask(5, other.w5)); }
/** * Compare this ObjectId to a network-byte-order ObjectId. * * @param bs * array containing the other ObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least * 20 bytes, starting at this position are required. * @return a negative integer, zero, or a positive integer as this object is * less than, equal to, or greater than the specified object. */ public final int compareTo(byte[] bs, int p) { int cmp; cmp = NB.compareUInt32(w1, NB.decodeInt32(bs, p)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, NB.decodeInt32(bs, p + 4)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, NB.decodeInt32(bs, p + 8)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, NB.decodeInt32(bs, p + 12)); if (cmp != 0) return cmp; return NB.compareUInt32(w5, NB.decodeInt32(bs, p + 16)); }
/** * Compare this abbreviation to a network-byte-order ObjectId. * * @param bs * array containing the other ObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least 5 * ints, starting at this position are required. * @return <0 if this abbreviation names an object that is less than * <code>other</code>; 0 if this abbreviation exactly matches the * first {@link #length()} digits of <code>other.name()</code>; * >0 if this abbreviation names an object that is after * <code>other</code>. */ public final int prefixCompare(int[] bs, int p) { int cmp; cmp = NB.compareUInt32(w1, mask(1, bs[p])); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, mask(2, bs[p + 1])); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, mask(3, bs[p + 2])); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, mask(4, bs[p + 3])); if (cmp != 0) return cmp; return NB.compareUInt32(w5, mask(5, bs[p + 4])); }
/** * Compare this abbreviation to a network-byte-order ObjectId. * * @param bs * array containing the other ObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least * 20 bytes, starting at this position are required. * @return <0 if this abbreviation names an object that is less than * <code>other</code>; 0 if this abbreviation exactly matches the * first {@link #length()} digits of <code>other.name()</code>; * >0 if this abbreviation names an object that is after * <code>other</code>. */ public final int prefixCompare(byte[] bs, int p) { int cmp; cmp = NB.compareUInt32(w1, mask(1, NB.decodeInt32(bs, p))); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, mask(2, NB.decodeInt32(bs, p + 4))); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, mask(3, NB.decodeInt32(bs, p + 8))); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, mask(4, NB.decodeInt32(bs, p + 12))); if (cmp != 0) return cmp; return NB.compareUInt32(w5, mask(5, NB.decodeInt32(bs, p + 16))); }
/** * {@inheritDoc} * <p> * Compare this ObjectId to another and obtain a sort ordering. */ @Override public final int compareTo(AnyObjectId other) { if (this == other) return 0; int cmp; cmp = NB.compareUInt32(w1, other.w1); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, other.w2); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, other.w3); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, other.w4); if (cmp != 0) return cmp; return NB.compareUInt32(w5, other.w5); }
/** * Compare this ObjectId to a network-byte-order ObjectId. * * @param bs * array containing the other ObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least 5 * integers, starting at this position are required. * @return a negative integer, zero, or a positive integer as this object is * less than, equal to, or greater than the specified object. */ public final int compareTo(final int[] bs, final int p) { int cmp; cmp = NB.compareUInt32(w1, bs[p]); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, bs[p + 1]); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, bs[p + 2]); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, bs[p + 3]); if (cmp != 0) return cmp; return NB.compareUInt32(w5, bs[p + 4]); }
/** * Compare this ObjectId to another and obtain a sort ordering. * * @param other * the other id to compare to. Must not be null. * @return < 0 if this id comes before other; 0 if this id is equal to * other; > 0 if this id comes after other. */ public final int compareTo(final AnyObjectId other) { if (this == other) return 0; int cmp; cmp = NB.compareUInt32(w1, other.w1); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, other.w2); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, other.w3); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, other.w4); if (cmp != 0) return cmp; return NB.compareUInt32(w5, other.w5); }
/** * Compare this ObjectId to a network-byte-order ObjectId. * * @param bs * array containing the other ObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least 5 * integers, starting at this position are required. * @return a negative integer, zero, or a positive integer as this object is * less than, equal to, or greater than the specified object. */ public final int compareTo(int[] bs, int p) { int cmp; cmp = NB.compareUInt32(w1, bs[p]); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, bs[p + 1]); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, bs[p + 2]); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, bs[p + 3]); if (cmp != 0) return cmp; return NB.compareUInt32(w5, bs[p + 4]); }
/** * Compare this ObjectId to a network-byte-order ObjectId. * * @param bs * array containing the other ObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least * 20 bytes, starting at this position are required. * @return a negative integer, zero, or a positive integer as this object is * less than, equal to, or greater than the specified object. */ public final int compareTo(final byte[] bs, final int p) { int cmp; cmp = NB.compareUInt32(w1, NB.decodeInt32(bs, p)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, NB.decodeInt32(bs, p + 4)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, NB.decodeInt32(bs, p + 8)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, NB.decodeInt32(bs, p + 12)); if (cmp != 0) return cmp; return NB.compareUInt32(w5, NB.decodeInt32(bs, p + 16)); }
/** * Compares this abbreviation to a full object id. * * @param other * the other object id. * @return <0 if this abbreviation names an object that is less than * <code>other</code>; 0 if this abbreviation exactly matches the * first {@link #length()} digits of <code>other.name()</code>; * >0 if this abbreviation names an object that is after * <code>other</code>. */ public final int prefixCompare(final AnyObjectId other) { int cmp; cmp = NB.compareUInt32(w1, mask(1, other.w1)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, mask(2, other.w2)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, mask(3, other.w3)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, mask(4, other.w4)); if (cmp != 0) return cmp; return NB.compareUInt32(w5, mask(5, other.w5)); }
/** * Compare this ObjectId to a network-byte-order ObjectId. * * @param bs * array containing the other ObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least * 20 bytes, starting at this position are required. * @return a negative integer, zero, or a positive integer as this object is * less than, equal to, or greater than the specified object. */ public final int compareTo(byte[] bs, int p) { int cmp; cmp = NB.compareUInt32(w1, NB.decodeInt32(bs, p)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, NB.decodeInt32(bs, p + 4)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, NB.decodeInt32(bs, p + 8)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, NB.decodeInt32(bs, p + 12)); if (cmp != 0) return cmp; return NB.compareUInt32(w5, NB.decodeInt32(bs, p + 16)); }
/** * Compares this abbreviation to a full object id. * * @param other * the other object id. * @return <0 if this abbreviation names an object that is less than * <code>other</code>; 0 if this abbreviation exactly matches the * first {@link #length()} digits of <code>other.name()</code>; * >0 if this abbreviation names an object that is after * <code>other</code>. */ public final int prefixCompare(AnyObjectId other) { int cmp; cmp = NB.compareUInt32(w1, mask(1, other.w1)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, mask(2, other.w2)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, mask(3, other.w3)); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, mask(4, other.w4)); if (cmp != 0) return cmp; return NB.compareUInt32(w5, mask(5, other.w5)); }
/** * Compare this abbreviation to a network-byte-order ObjectId. * * @param bs * array containing the other ObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least 5 * ints, starting at this position are required. * @return <0 if this abbreviation names an object that is less than * <code>other</code>; 0 if this abbreviation exactly matches the * first {@link #length()} digits of <code>other.name()</code>; * >0 if this abbreviation names an object that is after * <code>other</code>. */ public final int prefixCompare(final int[] bs, final int p) { int cmp; cmp = NB.compareUInt32(w1, mask(1, bs[p])); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, mask(2, bs[p + 1])); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, mask(3, bs[p + 2])); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, mask(4, bs[p + 3])); if (cmp != 0) return cmp; return NB.compareUInt32(w5, mask(5, bs[p + 4])); }
/** * Compare this abbreviation to a network-byte-order ObjectId. * * @param bs * array containing the other ObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least 5 * ints, starting at this position are required. * @return <0 if this abbreviation names an object that is less than * <code>other</code>; 0 if this abbreviation exactly matches the * first {@link #length()} digits of <code>other.name()</code>; * >0 if this abbreviation names an object that is after * <code>other</code>. */ public final int prefixCompare(int[] bs, int p) { int cmp; cmp = NB.compareUInt32(w1, mask(1, bs[p])); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, mask(2, bs[p + 1])); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, mask(3, bs[p + 2])); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, mask(4, bs[p + 3])); if (cmp != 0) return cmp; return NB.compareUInt32(w5, mask(5, bs[p + 4])); }
private int compare(final CommitImpact o1, final CommitImpact o2, final int offset) { return NB.compareUInt32(NB.decodeInt32(o1.commit, offset), NB.decodeInt32(o2.commit, offset)); }
/** * Compare this abbreviation to a network-byte-order ObjectId. * * @param bs * array containing the other ObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least * 20 bytes, starting at this position are required. * @return <0 if this abbreviation names an object that is less than * <code>other</code>; 0 if this abbreviation exactly matches the * first {@link #length()} digits of <code>other.name()</code>; * >0 if this abbreviation names an object that is after * <code>other</code>. */ public final int prefixCompare(final byte[] bs, final int p) { int cmp; cmp = NB.compareUInt32(w1, mask(1, NB.decodeInt32(bs, p))); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, mask(2, NB.decodeInt32(bs, p + 4))); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, mask(3, NB.decodeInt32(bs, p + 8))); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, mask(4, NB.decodeInt32(bs, p + 12))); if (cmp != 0) return cmp; return NB.compareUInt32(w5, mask(5, NB.decodeInt32(bs, p + 16))); }
/** * Compare this abbreviation to a network-byte-order ObjectId. * * @param bs * array containing the other ObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least * 20 bytes, starting at this position are required. * @return <0 if this abbreviation names an object that is less than * <code>other</code>; 0 if this abbreviation exactly matches the * first {@link #length()} digits of <code>other.name()</code>; * >0 if this abbreviation names an object that is after * <code>other</code>. */ public final int prefixCompare(byte[] bs, int p) { int cmp; cmp = NB.compareUInt32(w1, mask(1, NB.decodeInt32(bs, p))); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w2, mask(2, NB.decodeInt32(bs, p + 4))); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w3, mask(3, NB.decodeInt32(bs, p + 8))); if (cmp != 0) return cmp; cmp = NB.compareUInt32(w4, mask(4, NB.decodeInt32(bs, p + 12))); if (cmp != 0) return cmp; return NB.compareUInt32(w5, mask(5, NB.decodeInt32(bs, p + 16))); }