public class RowArray extends MetaDataProvider
Title: Structured Data Objects: Row Array
Description: A light-weight object that is a list of rows.
LinkedHashMap
and provides a mechanism for indexing the rows by specifying
either the Row Id
or a column value as a key. Since
it implements the hash set that supports LinkedHashMap.removeEldestEntry(java.util.Map.Entry)
the array can also be used as an MRU cache by enabling the automatic
removal behavior.
Copyright: Copyright (c) 2010
Company: StreamScape Technologies
DEFAULT_SERIAL_VERSION_ID
Constructor and Description |
---|
RowArray() |
RowArray(RowMetaData metaData) |
Modifier and Type | Method and Description |
---|---|
void |
addRow(DataRow row) |
void |
clear()
Clears the row array releasing it's row resources but
not clearing the meta data.
|
RowArray |
clone()
Clones the object.
|
boolean |
containsRow(DataRow row)
Returns
true if the specified row exists in the
collection. |
boolean |
existsKey(java.lang.Object key) |
int |
getCapacity()
Returns the row capacity for this collection.
|
java.lang.String |
getIndexColumnName() |
RowMetaData |
getMeta()
Returns the meta data for this row data collection.
|
RowMetaData |
getMetaData()
Returns the copy meta data for this row data collection.
|
DataRow |
getRowByKey(java.lang.Object key) |
boolean |
hasKeyIndex()
Returns
true if this array has a key index. |
void |
init(ResultSet set)
Initializes a new Row Array based on
ResultSet meta data. |
void |
init(RowMetaData metaData)
Initalizes this collection by using the
RowMetaData object. |
boolean |
isMRUEnabled()
Returns
true if this collection supports MRU caching
capabilities. |
java.util.Iterator |
iteratorByEntry()
Returns an array iterator using the entry sequence of data.
|
java.util.Iterator |
iteratorByKey()
Returns an array iterator sorted by key.
|
DataRow |
newRow() |
void |
removeRow()
Removes the first row in the map.
|
void |
removeRowByKey(java.lang.Object key)
Removes the row specified by key.
|
void |
setMRUEnabled(boolean cache)
Enables or disables the ability of this collection to function as a
Most Recent Used cache.
|
int |
size()
Returns the size of the array of data.
|
getSerialVersionUID
public RowArray()
public RowArray(RowMetaData metaData)
public RowMetaData getMetaData()
public RowMetaData getMeta()
public void init(ResultSet set) throws SQLException, MetaDataException
ResultSet
meta data.
This method only creates the structure, it does not populate the array.set
- ResultSetSQLException
java.lang.ClassNotFoundException
MetaDataException
public void init(RowMetaData metaData) throws RowArrayException
RowMetaData
object.metaData
- RowMetaDataRowArrayException
public int getCapacity() throws RowArrayException
RowArrayException
public void setMRUEnabled(boolean cache)
Capacity
is reached
the array will automatically remove the least-recent row in order to make
room for the new element.cache
- booleanpublic boolean isMRUEnabled()
true
if this collection supports MRU caching
capabilities.public boolean containsRow(DataRow row)
true
if the specified row exists in the
collection.row
- Rowpublic DataRow newRow() throws MetaDataException, RowException
MetaDataException
RowException
public void addRow(DataRow row) throws RowArrayException, RowException
RowArrayException
RowException
public boolean existsKey(java.lang.Object key) throws RowArrayException
RowArrayException
public void removeRowByKey(java.lang.Object key) throws RowArrayException
key
- ObjectRowArrayException
public void removeRow()
public DataRow getRowByKey(java.lang.Object key) throws RowArrayException
RowArrayException
public java.lang.String getIndexColumnName() throws MetaDataException
MetaDataException
public boolean hasKeyIndex() throws RowArrayException
true
if this array has a key index. This holds
true if either the user has set an index, or if Row Id
capability has ben enabled.RowArrayException
public java.util.Iterator iteratorByEntry()
public java.util.Iterator iteratorByKey()
Row Id
has been
set the array is sorted by the row identifier.public int size()
public void clear()
public RowArray clone()
CloneableDataObject
clone
in interface CloneableObject
clone
in class CloneableDataObject
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.