org.eclipse.jgit.lib.ObjectId .
Sometimes Git produces abbreviated SHA-1 strings, using sufficient leading digits from the ObjectId name to still be unique within the repository the string was generated from. These ids are likely to be unique for a useful period of time, especially if they contain at least 6-10 hex digits.
This class converts the hex string into a binary form, to make it more efficient for matching against an object.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final int | nibbles
Number of half-bytes used by this id. |
| private static final long | |
| pack-priv final int | |
| pack-priv final int | |
| pack-priv final int | |
| pack-priv final int | |
| pack-priv final int |
| Access | Constructor and Description |
|---|---|
| pack-priv | AbbreviatedObjectId(final int n, final int new_1, final int new_2, final int new_3, final int new_4, final int new_5)
|
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. Indicates whether some other object is "equal to" this one. |
| private static final AbbreviatedObjectId | |
| public static final AbbreviatedObjectId | Returns: the converted object id.the id)org. to convert from.Convert an AbbreviatedObjectId from an
|
| public static final AbbreviatedObjectId | Returns: the converted object id.the US-ASCII buffer to read from. buf, final int position to read the first character from. offset, final int one past the last position to read ( end)end-offset is
the length of the string).Convert an AbbreviatedObjectId from hex characters (US-ASCII). |
| public static final AbbreviatedObjectId | Returns: the converted object id.the string to read from. Must be <= 40 characters. str)Convert an AbbreviatedObjectId from hex characters. |
| public final int | Returns: value for a fan-out style map, only valid of length >= 2.Get value for a fan-out style map, only valid of length >= 2. |
| public int | |
| private static final int | |
| public boolean | Returns: true if this ObjectId is actually a complete id.Whether this ObjectId is actually a complete id. |
| public static final boolean | |
| public int | Returns: number of hex digits appearing in this id.Get number of hex digits appearing in this id. |
| pack-priv static int | |
| private int | |
| public final String | Returns: string form of the abbreviation, in lower case hexadecimal.Get string form of the abbreviation, in lower case hexadecimal. |
| public final int | Returns: <0 if this abbreviation names an object that is less thanother; 0 if this abbreviation exactly matches the
first length() digits of other.name();
>0 if this abbreviation names an object that is after
other.the other object id. other)Compares this abbreviation to a full object id. |
| public final int | Returns: <0 if this abbreviation names an object that is less thanother; 0 if this abbreviation exactly matches the
first length() digits of other.name();
>0 if this abbreviation names an object that is after
other.array containing the other ObjectId in network byte order. bs, int position within p)bs to start the compare at. At least
20 bytes, starting at this position are required.Compare this abbreviation to a network-byte-order ObjectId. |
| public final int | Returns: <0 if this abbreviation names an object that is less thanother; 0 if this abbreviation exactly matches the
first length() digits of other.name();
>0 if this abbreviation names an object that is after
other.array containing the other ObjectId in network byte order. bs, int position within p)bs to start the compare at. At least 5
ints, starting at this position are required.Compare this abbreviation to a network-byte-order ObjectId. |
| public ObjectId | Returns: a complete ObjectId; null ifisComplete() is falseA complete ObjectId; null if |
| public String |
| nibbles | back to summary |
|---|---|
| pack-priv final int nibbles Number of half-bytes used by this id. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| w1 | back to summary |
|---|---|
| pack-priv final int w1 | |
| w2 | back to summary |
|---|---|
| pack-priv final int w2 | |
| w3 | back to summary |
|---|---|
| pack-priv final int w3 | |
| w4 | back to summary |
|---|---|
| pack-priv final int w4 | |
| w5 | back to summary |
|---|---|
| pack-priv final int w5 | |
| AbbreviatedObjectId | back to summary |
|---|---|
| pack-priv AbbreviatedObjectId(final int n, final int new_1, final int new_2, final int new_3, final int new_4, final int new_5) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| fromHexString | back to summary |
|---|---|
| private static final AbbreviatedObjectId fromHexString(final byte[] bs, int ptr, final int end) | |
| fromObjectId | back to summary |
|---|---|
| public static final AbbreviatedObjectId fromObjectId(AnyObjectId id) Convert an AbbreviatedObjectId from an
This method copies over all bits of the Id, and is therefore complete
(see
| |
| fromString | back to summary |
|---|---|
| public static final AbbreviatedObjectId fromString(final byte[] buf, final int offset, final int end) Convert an AbbreviatedObjectId from hex characters (US-ASCII).
| |
| fromString | back to summary |
|---|---|
| public static final AbbreviatedObjectId fromString(String str) Convert an AbbreviatedObjectId from hex characters.
| |
| getFirstByte | back to summary |
|---|---|
| public final int getFirstByte() Get value for a fan-out style map, only valid of length >= 2.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| hexUInt32 | back to summary |
|---|---|
| private static final int hexUInt32(final byte[] bs, int p, final int end) | |
| isComplete | back to summary |
|---|---|
| public boolean isComplete() Whether this ObjectId is actually a complete id.
| |
| isId | back to summary |
|---|---|
| public static final boolean isId(String id) Test a string of characters to verify it is a hex format.
If true the string can be parsed with
| |
| length | back to summary |
|---|---|
| public int length() Get number of hex digits appearing in this id.
| |
| mask | back to summary |
|---|---|
| pack-priv static int mask(int nibbles, int word, int v) | |
| mask | back to summary |
|---|---|
| private int mask(int word, int v) | |
| name | back to summary |
|---|---|
| public final String name() Get string form of the abbreviation, in lower case hexadecimal.
| |
| prefixCompare | back to summary |
|---|---|
| public final int prefixCompare(AnyObjectId other) Compares this abbreviation to a full object id.
| |
| prefixCompare | back to summary |
|---|---|
| public final int prefixCompare(byte[] bs, int p) Compare this abbreviation to a network-byte-order ObjectId.
| |
| prefixCompare | back to summary |
|---|---|
| public final int prefixCompare(int[] bs, int p) Compare this abbreviation to a network-byte-order ObjectId.
| |
| toObjectId | back to summary |
|---|---|
| public ObjectId toObjectId() A complete ObjectId; null if
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |