org.eclipse.jgit.lib.ObjectId subclasses in
only one map.
To use this map type, applications must have their entry value type extend
from org., which itself
extends from ObjectId.
Object instances may only be stored in ONE ObjectIdOwnerMap. This restriction exists because the map stores internal map state within each object instance. If an instance is be placed in another ObjectIdOwnerMap it could corrupt one or both map's internal state.
If an object instance must be in more than one map, applications may use
ObjectIdOwnerMap for one of the maps, and
org. for the other map(s). It is
encouraged to use ObjectIdOwnerMap for the map that is accessed most often,
as this implementation runs faster than the more general ObjectIdSubclassMap
implementation.
| Modifier and Type | Class and Description |
|---|---|
| public abstract static class | ObjectIdOwnerMap.
Type of entry stored in the |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv int | |
| pack-priv V[][] | directory
Top level directory of the segments. |
| private int | |
| private static final int | INITIAL_DIRECTORY
Size of the initial directory, will grow as necessary. |
| private int | |
| private static final int | SEGMENT_BITS
Number of bits in a segment's index. |
| private static final int | |
| pack-priv int | size
Total number of objects in this map. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public < type of values Q extends V> void | |
| public < type of values Q extends V> V | Returns: newValue if stored, or the prior value already stored and
that would have been returned had the caller used
get(newValue) first.the object to store. newValue)Store an object for future lookup. |
| public void | |
| private static final int | |
| public boolean | contains(AnyObjectId
the objectId to find toFind)Implements org. Returns true if the objectId is contained within the collection. |
| private static final boolean | |
| public V | Returns: the instance mapped to toFind, or null if no mapping exists.the object identifier to find. toFind)Lookup an existing mapping. |
| private void | |
| public boolean | |
| public Iterator | |
| private final V[] | |
| public int |
| bits | back to summary |
|---|---|
| pack-priv int bits Number of low bits used to form the index into | |
| directory | back to summary |
|---|---|
| pack-priv V[][] directory Top level directory of the segments.
The low | |
| grow | back to summary |
|---|---|
| private int grow The map doubles in capacity when | |
| INITIAL_DIRECTORY | back to summary |
|---|---|
| private static final int INITIAL_DIRECTORY Size of the initial directory, will grow as necessary. | |
| mask | back to summary |
|---|---|
| private int mask Low bit mask to index into | |
| SEGMENT_BITS | back to summary |
|---|---|
| private static final int SEGMENT_BITS Number of bits in a segment's index. Segments are 2^11 in size. | |
| SEGMENT_SHIFT | back to summary |
|---|---|
| private static final int SEGMENT_SHIFT | |
| size | back to summary |
|---|---|
| pack-priv int size Total number of objects in this map. | |
| ObjectIdOwnerMap | back to summary |
|---|---|
| public ObjectIdOwnerMap() Create an empty map.
| |
| add | back to summary |
|---|---|
| public <Q extends V> void add(Q newValue) Store an object for future lookup.
An existing mapping for must not be in this map. Callers must
first call
| |
| addIfAbsent | back to summary |
|---|---|
| public <Q extends V> V addIfAbsent(Q newValue) Store an object for future lookup.
Stores V obj = ...; boolean wasNew = map.addIfAbsent(obj) == obj;
| |
| clear | back to summary |
|---|---|
| public void clear() Remove all entries from this map. | |
| computeGrowAt | back to summary |
|---|---|
| private static final int computeGrowAt(int bits) | |
| contains | back to summary |
|---|---|
| public boolean contains(AnyObjectId toFind) Implements org. Doc from org. Returns true if the objectId is contained within the collection. Returns true if this map contains the specified object.
| |
| equals | back to summary |
|---|---|
| private static final boolean equals(AnyObjectId firstObjectId, AnyObjectId secondObjectId) | |
| get | back to summary |
|---|---|
| public V get(AnyObjectId toFind) Lookup an existing mapping.
| |
| grow | back to summary |
|---|---|
private void grow()
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Whether this map is empty
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. Doc from java. Returns an iterator over elements of type | |
| newSegment | back to summary |
|---|---|
private final V[] newSegment()
| |
| size | back to summary |
|---|---|
| public int size() Get number of objects in this map.
| |
ObjectIdOwnerMap.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv transient ObjectIdOwnerMap. |
| Access | Constructor and Description |
|---|---|
| public |
| next | back to summary |
|---|---|
| pack-priv transient ObjectIdOwnerMap. | |
| Entry | back to summary |
|---|---|
| public Entry(AnyObjectId id) Initialize this entry with a specific ObjectId.
| |