Google

JanosVM v0.6.0 Java API Documentation: Class SparseArray
JanosVM v0.6.0 Java API

edu.utah.janosvm.kit.util
Class SparseArray

java.lang.Object
  |
  +--edu.utah.janosvm.kit.util.SparseArray

public final class SparseArray
extends java.lang.Object

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.
static int INVALID_ID
          A guaranteed invalid ID number.
 
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
 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
 

Field Detail

DEFAULT_X_SIZE

public static final int DEFAULT_X_SIZE
The default X size of the array.

DEFAULT_Y_SIZE

public static final int DEFAULT_Y_SIZE
The default Y size of the array.

DEFAULT_ID_BITS

public static final int DEFAULT_ID_BITS
The number of bits that make up a unique identifier.

INVALID_ID

public static final int INVALID_ID
A guaranteed invalid ID number.
Constructor Detail

SparseArray

public SparseArray(java.lang.Class elementClass,
                   int xSize,
                   int ySize,
                   int timeBitCount)
Construct an array with the given values.
Parameters:
elementClass - The class of objects to use as elements.
xSize - The size of the X dimension.
ySize - The size of the Y dimension.

SparseArray

public SparseArray(int xSize,
                   int ySize)
Construct an array with the given values and the default element class.
Parameters:
xSize - The size of the X dimension.
ySize - The size of the Y dimension.

SparseArray

public SparseArray(java.lang.Class cl)
Construct an array with the given values and the default sizes.
Parameters:
elementClass - The class of objects to use as elements.

SparseArray

public SparseArray()
Construct an array with the default values.
Method Detail

getElementClass

public java.lang.Class getElementClass()
Returns:
The class of elements in the array.

getXSize

public int getXSize()
Returns:
The size of the X dimension.

getYSize

public int getYSize()
Returns:
The size of the Y dimension.

getTimeCount

public int getTimeCount()
Returns:
The number of bits in the delay mask.

getTimeOffset

public int getTimeOffset()
Returns:
The start of the delay bits.

getTimeMask

public long getTimeMask()
Returns:
The bitmask that makes up the delay.

getElement

public SparseArrayElement getElement()
Returns:
An allocated SparseArrayElement.

dropElement

public void dropElement(SparseArrayElement sae)
Parameters:
sae - A SparseArrayElement to free.

findElement

public SparseArrayElement findElement(long id)
Parameters:
id - The element to find.
Returns:
The element with the given identifier or null if it wasn't found

elements

public java.util.Enumeration elements()
Returns:
An enumeration containing the elements in the array. NOTE: You

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

JanosVM v0.6.0 Java API

This documentation is Copyright (C) 2000-2002 The University of Utah. All Rights Reserved. See the documentation license for distribution terms and restrictions.
Documentation, software, and mailing lists for the JanosVM can be found at the Janos Project web page: http://www.cs.utah.edu/flux/janos/
Generated on Mar 17, 2002