Hash
, java.io.Serializable
public class VisitStateSet extends java.lang.Object implements java.io.Serializable, Hash
Hash.Strategy<K extends java.lang.Object>
Modifier and Type | Field | Description |
---|---|---|
protected int |
mask |
The mask for wrapping a position counter.
|
protected int |
maxFill |
The maximum number of entries that can be filled before rehashing.
|
protected int |
n |
The current table size.
|
protected int |
size |
Number of entries in the set.
|
protected VisitState[] |
visitState |
The array of keys.
|
DEFAULT_GROWTH_FACTOR, DEFAULT_INITIAL_SIZE, DEFAULT_LOAD_FACTOR, FAST_LOAD_FACTOR, FREE, OCCUPIED, PRIMES, REMOVED, VERY_FAST_LOAD_FACTOR
Constructor | Description |
---|---|
VisitStateSet() |
Creates an empty visit state set.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
add(VisitState v) |
Adds a visit state to the set, if necessary.
|
void |
clear() |
Removes all elements from this set.
|
void |
ensureCapacity(int capacity) |
Ensures that the set has a given capacity.
|
VisitState |
get(byte[] array) |
Returns the visit state associated to a given scheme+authority, or
null . |
VisitState |
get(byte[] array,
int offset,
int length) |
Returns the visit state associated to a given scheme+authority specified as a byte-array fragment, or
null . |
boolean |
isEmpty() |
Returns whether the set is empty.
|
protected void |
rehash(int newN) |
Rehashes the state set to a new size.
|
boolean |
remove(VisitState k) |
Removes a given visit state.
|
protected int |
shiftKeys(int pos) |
Shifts left entries with the specified hash code, starting at the specified position, and
empties the resulting free entry.
|
int |
size() |
The number of visit states.
|
VisitState[] |
visitStates() |
Returns the array of visit states; the order is arbitrary.
|
protected transient VisitState[] visitState
protected transient int n
protected transient int mask
protected int size
protected int maxFill
public VisitState[] visitStates()
null
elements.null
entries.public void ensureCapacity(int capacity)
capacity
- the desired capacity.public boolean add(VisitState v)
v
- the state to be added.protected final int shiftKeys(int pos)
pos
- a starting position.public boolean remove(VisitState k)
k
- the visit state to be removed.public VisitState get(byte[] array)
null
.array
- a byte array.null
.public VisitState get(byte[] array, int offset, int length)
null
.array
- a byte array.offset
- the first valid byte in array
.length
- the number of valid elements in array
.null
.public void clear()
To increase object reuse, this method does not change the table size.
public int size()
public boolean isEmpty()
protected void rehash(int newN)
newN
- the new size.