|
|||||||||||
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 | +--org.erights.e.elib.tables.SamenessKeyColumn
Compares using Equalizer.same() and Equalizer.samenessHash()
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. |
private int[] |
myHashes
The array of computed hashes for each key in the set. |
(package private) Object[] |
myKeys
The sparse array of keys by position. |
private int |
myMaxProbes
The maximum number of probes made so far. |
(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 |
Constructor Summary | |
|
SamenessKeyColumn()
Reasonable defaults |
|
SamenessKeyColumn(Class memberType)
Reasonable defaults |
|
SamenessKeyColumn(Class memberType,
int capacity)
|
|
SamenessKeyColumn(int capacity)
Reasonable defaults |
private |
SamenessKeyColumn(Object[] keys,
int[] pos2Rank,
int[] rank2Pos,
int numTaken,
int numDeleted,
int maxProbes,
int[] hashes)
|
Method Summary | |
(package private) int |
capacity()
|
protected Object |
clone()
Argument defaults to memberType() |
protected Column |
diverge(Class membType)
A shallow copy of the column. |
(package private) int |
findPosOf(Object key)
Returns the pos at which key resides, or -1 if the key is absent from the map. |
(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) 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)
|
private int |
occupy(int pos,
Object key,
int hash)
|
(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) 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 |
private final int myMaxProbes
private final int[] myHashes
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
Constructor Detail |
public SamenessKeyColumn()
private SamenessKeyColumn(Object[] keys, int[] pos2Rank, int[] rank2Pos, int numTaken, int numDeleted, int maxProbes, int[] hashes)
public SamenessKeyColumn(int capacity)
public SamenessKeyColumn(Class memberType)
public SamenessKeyColumn(Class memberType, int capacity)
memberType
- capacity
- Method Detail |
protected Column diverge(Class membType)
Column
diverge
in class Column
Column newVacant(int capacity)
Column
newVacant
in class Column
int findPosOf(Object key)
KeyColumn
findPosOf
in class KeyColumn
int store(Object key)
KeyColumn
If the key already exists, no ordering information is affected. If a novel key is inserted, it's position gets the next rank.
store
in class KeyColumn
key
- the key to place in the map
private int occupy(int pos, Object key, int hash)
void vacate(int pos)
KeyColumn
vacate
in class KeyColumn
static KeyColumn make(Class memberType, int capacity)
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)
int occupy(int pos, Object key)
protected Object clone()
clone
in class Object
java.lang.Cloneable
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 |