RefDatabase namespace.
Although not declared as a java., iterators from this
map's projections always return references in
org. ordering. The map's internal
representation is a sorted array of org. objects,
which means lookup and replacement is O(log N), while insertion and removal
can be as expensive as O(N + log N) while the list expands or contracts.
Since this is not a general map implementation, all entries must be keyed by
the reference name.
This class is really intended as a helper for RefDatabase, which
needs to perform a merge-join of three sorted
org.s in order to present the unified
namespace of the packed-refs file, the loose refs/ directory tree, and the
resolved form of any symbolic references.
| Modifier and Type | Class and Description |
|---|---|
| private class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private Set | |
| pack-priv RefList | loose
Immutable collection of the loose references at construction time. |
| pack-priv RefList | packed
Immutable collection of the packed references at construction time. |
| pack-priv final String | prefix
Prefix denoting the reference subspace this map contains. |
| pack-priv RefList | resolved
Immutable collection of resolved symbolic references. |
| pack-priv int | |
| pack-priv boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public | RefMap(String
prefix used to slice the lists down. Only references whose
names start with this prefix will appear to reside in the map.
Must not be null, use prefix, RefList<? extends Ref> "" (the empty string) to select
all list items.items from the packed reference list, this is the last list
searched. packed, RefList<? extends Ref> items from the loose reference list, this list overrides
loose, RefList<? extends Ref> packed if a name appears in both.resolved symbolic references. This list overrides the prior
list resolved)loose, if an item appears in both. Items in this
list must also appear in loose.Construct a map to merge 3 collections together. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | containsKey(Object
key whose presence in this map is to be tested name)Overrides java. Implements java. Returns |
| public Set | entrySet()
Implements abstract java. Implements java. Returns a |
| public Ref | get(Object
the key whose associated value is to be returned key)Overrides java. Implements java. Returns the value to which the specified key is mapped,
or |
| public boolean | isEmpty()
Overrides java. Implements java. Returns |
| public Ref | put(String
key with which the specified value is to be associated keyName, Ref value to be associated with the specified key value)Overrides java. Implements java. Associates the specified value with the specified key in this map (optional operation). |
| public Ref | remove(Object
key whose mapping is to be removed from the map key)Overrides java. Implements java. Removes the mapping for a key from this map if it is present (optional operation). |
| pack-priv String | |
| public static Collector | |
| private String | |
| public String |
| entrySet | back to summary |
|---|---|
| private Set<Map. | |
| loose | back to summary |
|---|---|
| pack-priv RefList<Ref> loose Immutable collection of the loose references at construction time.
If an entry appears here and in | |
| packed | back to summary |
|---|---|
| pack-priv RefList<Ref> packed Immutable collection of the packed references at construction time. | |
| prefix | back to summary |
|---|---|
| pack-priv final String prefix Prefix denoting the reference subspace this map contains. All reference names in this map must start with this prefix. If the prefix is not the empty string, it must end with a '/'. | |
| resolved | back to summary |
|---|---|
| pack-priv RefList<Ref> resolved Immutable collection of resolved symbolic references.
This collection contains only the symbolic references we were able to
resolve at map construction time. Other loose references must be read
from | |
| size | back to summary |
|---|---|
| pack-priv int size | |
| sizeIsValid | back to summary |
|---|---|
| pack-priv boolean sizeIsValid | |
| RefMap | back to summary |
|---|---|
| public RefMap() Construct an empty map with a small initial capacity. | |
| RefMap | back to summary |
|---|---|
| public RefMap(String prefix, RefList<? extends Ref> packed, RefList<? extends Ref> loose, RefList<? extends Ref> resolved) Construct a map to merge 3 collections together.
| |
| containsKey | back to summary |
|---|---|
| public boolean containsKey(Object name) Overrides java. Implements java. Doc from java. Returns
| |
| entrySet | back to summary |
|---|---|
| public Set Implements abstract java. Implements java. Doc from java. Returns a | |
| get | back to summary |
|---|---|
| public Ref get(Object key) Overrides java. Implements java. Doc from java. Returns the value to which the specified key is mapped,
or More formally, if this map contains a mapping from a key
If this map permits null values, then a return value of
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Overrides java. Implements java. Doc from java. Returns
| |
| put | back to summary |
|---|---|
| public Ref put(String keyName, Ref value) Overrides java. Implements java. Doc from java. Associates the specified value with the specified key in this map
(optional operation). If the map previously contained a mapping for
the key, the old value is replaced by the specified value. (A map
| |
| remove | back to summary |
|---|---|
| public Ref remove(Object key) Overrides java. Implements java. Doc from java. Removes the mapping for a key from this map if it is present
(optional operation). More formally, if this map contains a mapping
from key Returns the value to which this map previously associated the key,
or If this map permits null values, then a return value of
The map will not contain a mapping for the specified key once the call returns.
| |
| toMapKey | back to summary |
|---|---|
| pack-priv String toMapKey(Ref ref) | |
| toRefMap | back to summary |
|---|---|
| public static Collector | |
| toRefName | back to summary |
|---|---|
| private String toRefName(String name) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of this map. The string representation
consists of a list of key-value mappings in the order returned by the
map's | |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
object to be compared for equality with this map entry obj)Overrides java. Implements java. Compares the specified object with this entry for equality. |
| public String | |
| public Ref | |
| public int | hashCode()
Overrides java. Implements java. Returns the hash code value for this map entry. |
| public Ref | setValue(Ref
new value to be stored in this entry value)Implements java. Replaces the value corresponding to this entry with the specified value (optional operation). |
| public String |
| ref | back to summary |
|---|---|
| private Ref ref | |
| Ent | back to summary |
|---|---|
| pack-priv Ent(Ref ref) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Implements java. Doc from java. Compares the specified object with this entry for equality.
Returns
(e1.getKey()==null ?
e2.getKey()==null : e1.getKey().equals(e2.getKey())) &&
(e1.getValue()==null ?
e2.getValue()==null : e1.getValue().equals(e2.getValue()))
This ensures that the equals method works properly across
different implementations of the Map.Entry interface.
| |
| getKey | back to summary |
|---|---|
| public String getKey() Implements java. Doc from java. Returns the key corresponding to this entry. | |
| getValue | back to summary |
|---|---|
| public Ref getValue() Implements java. Doc from java. Returns the value corresponding to this entry. If the mapping
has been removed from the backing map (by the iterator's
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implements java. Doc from java. Returns the hash code value for this map entry. The hash code
of a map entry
(e.getKey()==null ? 0 : e.getKey().hashCode()) ^
(e.getValue()==null ? 0 : e.getValue().hashCode())
This ensures that e1.equals(e2) implies that
e1.hashCode()==e2.hashCode() for any two Entries
e1 and e2, as required by the general
contract of Object.hashCode.
| |
| setValue | back to summary |
|---|---|
| public Ref setValue(Ref value) Implements java. Doc from java. Replaces the value corresponding to this entry with the specified
value (optional operation). (Writes through to the map.) The
behavior of this call is undefined if the mapping has already been
removed from the map (by the iterator's | |
| 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- | |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private Map. | |
| private int | |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public Map. | |
| public Map. | |
| public void | remove()
Overrides default java. Removes from the underlying collection the last element returned by this iterator (optional operation). |
| private Ref | |
| private RefMap. |
| looseIdx | back to summary |
|---|---|
| private int looseIdx | |
| next | back to summary |
|---|---|
| private Map. | |
| packedIdx | back to summary |
|---|---|
| private int packedIdx | |
| resolvedIdx | back to summary |
|---|---|
| private int resolvedIdx | |
| SetIterator | back to summary |
|---|---|
| pack-priv SetIterator() | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public Map. Implements java. Doc from java. Returns the next element in the iteration. | |
| peek | back to summary |
|---|---|
| public Map. | |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the
| |
| resolveLoose | back to summary |
|---|---|
| private Ref resolveLoose(Ref l) | |
| toEntry | back to summary |
|---|---|
| private RefMap. | |