|
JanosVM v1.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.utah.janosvm.kit.util.SparseArray
A simple class for generating/looking up unique identifiers.
Field Summary | |
static int |
DEFAULT_ID_BITS
The number of bits that make up a unique identifier. |
static int |
DEFAULT_X_SIZE
The default X size of the array. |
static int |
DEFAULT_Y_SIZE
The default Y size of the array. |
private java.lang.Class |
elementClass
The class of elements that should be used in the array. |
static int |
INVALID_ID
A guaranteed invalid ID number. |
private int |
timeBitCount
The number of bits in the delay mask. |
private long |
timeMask
The bitmask that makes up the delay. |
private int |
xBitCount
The number of bits used to index the X dimension. |
private SparseArrayDimension[] |
xDimension
The X dimension. |
private int |
xSize
The size of the X dimension. |
private int |
xUsed
The number of slots actually used in the X dimension. |
private int |
yBitCount
The number of bits used to index the Y dimension. |
private int |
ySize
The size of the Y dimension. |
Constructor Summary | |
SparseArray()
Construct an array with the default values. |
|
SparseArray(java.lang.Class cl)
Construct an array with the given values and the default sizes. |
|
SparseArray(java.lang.Class elementClass,
int xSize,
int ySize,
int timeBitCount)
Construct an array with the given values. |
|
SparseArray(int xSize,
int ySize)
Construct an array with the given values and the default element class. |
Method Summary | |
private static int |
bitCount(int bits)
Count the number of bits set in the given integer. |
void |
dropElement(SparseArrayElement sae)
|
java.util.Enumeration |
elements()
|
SparseArrayElement |
findElement(long id)
|
SparseArrayElement |
getElement()
|
java.lang.Class |
getElementClass()
|
int |
getTimeCount()
|
long |
getTimeMask()
|
int |
getTimeOffset()
|
int |
getXSize()
|
int |
getYSize()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait, wait0 |
Field Detail |
public static final int DEFAULT_X_SIZE
public static final int DEFAULT_Y_SIZE
public static final int DEFAULT_ID_BITS
public static final int INVALID_ID
private java.lang.Class elementClass
private int xSize
private int xBitCount
private int xUsed
private int ySize
private int yBitCount
private int timeBitCount
private long timeMask
private final SparseArrayDimension[] xDimension
Constructor Detail |
public SparseArray(java.lang.Class elementClass, int xSize, int ySize, int timeBitCount)
elementClass
- The class of objects to use as elements.xSize
- The size of the X dimension.ySize
- The size of the Y dimension.public SparseArray(int xSize, int ySize)
xSize
- The size of the X dimension.ySize
- The size of the Y dimension.public SparseArray(java.lang.Class cl)
elementClass
- The class of objects to use as elements.public SparseArray()
Method Detail |
private static int bitCount(int bits)
bits
- A value with a few bits set.public java.lang.Class getElementClass()
public int getXSize()
public int getYSize()
public int getTimeCount()
public int getTimeOffset()
public long getTimeMask()
public SparseArrayElement getElement()
public void dropElement(SparseArrayElement sae)
sae
- A SparseArrayElement to free.public SparseArrayElement findElement(long id)
id
- The element to find.public java.util.Enumeration elements()
public java.lang.String toString()
toString
in class java.lang.Object
|
JanosVM v1.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |