Package com.portal.pcm
Class SparseArray
java.lang.Object
com.portal.pcm.AssocArray
com.portal.pcm.SparseArray
- All Implemented Interfaces:
Externalizable
,Serializable
The SparseArray class is used to simulate the Portal `Array' in an
FList. It is an array that doesn't require all elements to be filled.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.portal.pcm.AssocArray
AssocArray.Pair, AssocArray.PairEnumeration
-
Field Summary
Fields inherited from class com.portal.pcm.AssocArray
keys, values
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new element to the array.void
Adds a new element to the end of array.void
dump()
Dumps the SparseArray.elementAt
(int index) Returns the element, if any, associated with an index.Returns the element, if any, associated with an index.Returns an element (usually called when it is known that there is only one).Returns an enumeration of the index values in the array.getKeys()
Returns a read-only list of the index values in the sparsearraygetPairs()
Returns an enumeration of pairs.int
getSize()
Returns the number of element pairs in the array.Returns an enumeration of the values in the array.Returns a read-only list of the values in the sparsearrayvoid
void
remove
(int index) Remove an element from the array.void
Methods inherited from class com.portal.pcm.AssocArray
clear, containsKey, elements, get, isEmpty, keys, put, remove, size
-
Constructor Details
-
SparseArray
public SparseArray()Constructs an instance ofSparseArray
. The array is initially empty.
-
-
Method Details
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
getSize
public int getSize()Returns the number of element pairs in the array.- Returns:
- The number of elements in the array.
-
elementAt
Returns the element, if any, associated with an index.- Parameters:
index
- Where to find the element.- Returns:
- An FList instance, if present, NULL if not.
- See Also:
-
elementAt
Returns the element, if any, associated with an index.- Parameters:
index
- Where to find the element.- Returns:
- An FList instance, if present, NULL if not.
- See Also:
-
getAnyElement
Returns an element (usually called when it is known that there is only one).- Returns:
- An FList instance, if present, NULL if not.
-
add
Adds a new element to the array.- Parameters:
index
- Where to add the new element.newElement
- The new element to add.- See Also:
-
add
Adds a new element to the end of array.- Parameters:
newElement
- The new element to add.- See Also:
-
remove
public void remove(int index) Remove an element from the array.- Parameters:
index
- Where to remove the element.
-
getValueEnumerator
Returns an enumeration of the values in the array.- Returns:
- An enumeration of the values in the array.
-
getKeyEnumerator
Returns an enumeration of the index values in the array.- Returns:
- An enumeration of the index values in the array.
-
getValues
Returns a read-only list of the values in the sparsearray- Returns:
- a read-only list of the values in the sparsearray
-
getKeys
Returns a read-only list of the index values in the sparsearray- Returns:
- a read-only list of the index values in the sparsearray
-
getPairs
Description copied from class:AssocArray
Returns an enumeration of pairs.This method provides an enumeration over pairs of keys and values.
- Overrides:
getPairs
in classAssocArray
- Returns:
- An instance of
AssocArray.PairEnumeration
that enumerates the pairs.
-
dump
public void dump()Dumps the SparseArray.
-