|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elib.tables.Column | +--org.erights.e.elib.tables.KeyColumn
Based on the GenericHashtable in the vat by Dan Bornstein
Field Summary | |
(package private) static int |
KEY_DELETED
A value in myPos2Rank indicating that this position used to be occupied since the last rehash, but no longer is. |
(package private) static int |
KEY_UNUSED
A value in myPos2Rank indicating that this position has never been occupied since the last rehash. |
(package private) Object[] |
myKeys
The sparse array of keys by position. |
(package private) int |
myNumDeleted
The number of keys currently marked deleted in the column. |
(package private) int |
myNumTaken
The number of key currently in the column. |
(package private) int[] |
myPos2Rank
A sparse array parallel to myKeys. |
(package private) int[] |
myRank2Pos
A dense array, listing positions in their enumeration order. |
static int |
POSITIVE_MASK
Used to ensure ints are positive |
private static int[] |
possibleSizes
Little sorted array of primes for use to size key columns. |
Constructor Summary | |
(package private) |
KeyColumn(Class memberType,
int capacity)
Construct a new, empty KeyColumn, with the specified parameters. |
(package private) |
KeyColumn(Object[] keys,
int[] pos2Rank,
int[] rank2Pos,
int numTaken,
int numDeleted)
|
Method Summary | |
(package private) int |
capacity()
|
protected Object |
clone()
Argument defaults to memberType() |
protected abstract Column |
diverge(Class membType)
A shallow copy of the column. |
(package private) abstract int |
findPosOf(Object key)
Returns the pos at which key resides, or -1 if the key is absent from the map. |
private static int |
firstSize(int candidate)
Returns the first good size for a key column that's no less than candidate. |
(package private) Object |
get(int pos)
|
(package private) boolean |
isPosTaken(int pos)
Given a pos, say whether this pos contains a valid key. |
(package private) static KeyColumn |
make(Class memberType,
int capacity)
Makes a key column that's equivalent to a SamenessKeyColumn(memberType, capacity), but may select a more efficient implementation based on how instances of memberType compare for sameness. |
(package private) Class |
memberType()
All the members of the column must conform to this type |
(package private) abstract Column |
newVacant(int capacity)
Makes a new column just like this one, except of the specified size and without any members. |
(package private) int |
numTaken()
Get the number of keys in the column |
(package private) int |
occupy(int pos,
Object key)
|
(package private) void |
put(int pos,
Object value)
|
(package private) int[] |
rank2Pos()
Caller should only read, and only between 0..!numTaken() |
(package private) static int |
skip(int hash,
int len)
|
(package private) abstract int |
store(Object key)
Put the given key into the map, and return its pos. |
(package private) void |
vacate(int pos)
cause pos not to contain a valid key |
static Column |
values(Class memberType,
int capacity)
Make a value-column that can only hold values that conform to 'memberType' and has 'capacity' positions. |
static Column |
values(int capacity)
memberType defaults to Object |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int POSITIVE_MASK
final Object[] myKeys
final int[] myPos2Rank
static final int KEY_UNUSED
static final int KEY_DELETED
final int[] myRank2Pos
int myNumTaken
int myNumDeleted
private static final int[] possibleSizes
Constructor Detail |
KeyColumn(Object[] keys, int[] pos2Rank, int[] rank2Pos, int numTaken, int numDeleted)
KeyColumn(Class memberType, int capacity)
memberType
- All keys will be (implicitly) checked for
conformance to this type.capacity
- The column will hold at least this number of
positions. To find out the actual number, call capacity() on the
constructed column.Method Detail |
static KeyColumn make(Class memberType, int capacity)
abstract int findPosOf(Object key)
private static int firstSize(int candidate)
Object get(int pos)
get
in class Column
boolean isPosTaken(int pos)
Class memberType()
Column
memberType
in class Column
int capacity()
capacity
in class Column
int numTaken()
int[] rank2Pos()
void put(int pos, Object value)
put
in class Column
static int skip(int hash, int len)
abstract int store(Object key)
If the key already exists, no ordering information is affected. If a novel key is inserted, it's position gets the next rank.
key
- the key to place in the map
int occupy(int pos, Object key)
void vacate(int pos)
vacate
in class Column
protected abstract Column diverge(Class membType)
protected Object clone()
clone
in class Object
java.lang.Cloneable
abstract Column newVacant(int capacity)
public static Column values(int capacity)
public static Column values(Class memberType, int capacity)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |