|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tangosol.util.Base
com.tangosol.util.AbstractLongArray
com.tangosol.util.SparseArray
public class SparseArray
A data structure resembling an array keyed by Java long values.
Tree
Nested Class Summary | |
---|---|
protected class |
SparseArray.Crawler
A red/black tree node iterator. |
protected static class |
SparseArray.Node
A red/black tree node. |
Nested classes/interfaces inherited from interface com.tangosol.util.LongArray |
---|
LongArray.Iterator |
Field Summary | |
---|---|
protected SparseArray.Node |
head
The first node of the tree (or NIL if the tree is empty). |
protected static SparseArray.Node |
NIL
NIL is the sentinal Node that is used instead of null, simplifying the implementation of the red/black tree. |
protected int |
size
The number of nodes in the tree. |
Constructor Summary | |
---|---|
SparseArray()
Default constructor. |
Method Summary | |
---|---|
protected void |
balance(SparseArray.Node child)
Maintain balance on insertion. |
void |
clear()
Remove all nodes from the LongArray. |
Object |
clone()
Make a clone of the LongArray. |
boolean |
exists(long lIndex)
Determine if the specified index is in use. |
protected SparseArray.Node |
find(long lIndex)
Find the specified key and return its node. |
Object |
get(long lIndex)
Return the value stored at the specified index. |
long |
getFirstIndex()
Determine the first index that exists in the LongArray. |
long |
getLastIndex()
Determine the last index that exists in the LongArray. |
int |
getSize()
Determine the size of the LongArray. |
LongArray.Iterator |
iterator()
Obtain a LongArray.Iterator of the contents of the LongArray. |
LongArray.Iterator |
iterator(long lIndex)
Obtain a LongArray.Iterator of the contents of the LongArray, starting at a particular index such that the first call to next will set the location of the iterator at the first existent index that is greater than or equal to the specified index, or will throw a NoSuchElementException if there is no such existent index. |
void |
print()
In-order printing of the contents of the SparseArray. |
Object |
remove(long lIndex)
Remove the specified index from the LongArray, returning its associated value. |
Object |
set(long lIndex,
Object oValue)
Add the passed item to the LongArray at the specified index. |
Methods inherited from class com.tangosol.util.AbstractLongArray |
---|
add, contains, equals, isEmpty, toString |
Methods inherited from interface com.tangosol.util.LongArray |
---|
add, contains, equals, isEmpty, toString |
Field Detail |
---|
protected static final SparseArray.Node NIL
protected SparseArray.Node head
protected int size
Constructor Detail |
---|
public SparseArray()
Method Detail |
---|
public Object get(long lIndex)
get
in interface LongArray
get
in class AbstractLongArray
lIndex
- a long index value
public Object set(long lIndex, Object oValue)
If the index is already used, the passed value will replace the current value stored with the key, and the replaced value will be returned.
It is expected that LongArray implementations will "grow" as necessary to support the specified index.
set
in interface LongArray
lIndex
- a long index valueoValue
- the object to store at the specified index
public boolean exists(long lIndex)
exists
in interface LongArray
exists
in class AbstractLongArray
lIndex
- a long index value
public Object remove(long lIndex)
remove
in interface LongArray
remove
in class AbstractLongArray
lIndex
- the index into the LongArray
public void clear()
clear
in interface LongArray
clear
in class AbstractLongArray
public int getSize()
getSize
in interface LongArray
getSize
in class AbstractLongArray
public LongArray.Iterator iterator()
iterator
in interface LongArray
public LongArray.Iterator iterator(long lIndex)
iterator
in interface LongArray
lIndex
- the LongArray index to iterate from
public long getFirstIndex()
getFirstIndex
in interface LongArray
getFirstIndex
in class AbstractLongArray
public long getLastIndex()
getLastIndex
in interface LongArray
getLastIndex
in class AbstractLongArray
public Object clone()
clone
in interface LongArray
clone
in class AbstractLongArray
public void print()
protected SparseArray.Node find(long lIndex)
lIndex
- the long index to look for in the SparseArray
protected void balance(SparseArray.Node child)
child
- the current node in the traversal of the tree
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |