public class DimensionCache extends Object implements Comparator<Object[]>
Constructor and Description |
---|
DimensionCache(RowMetaInterface rowMeta,
int[] keyIndexes,
int fromDateIndex,
int toDateIndex)
Create a new dimension cache object
|
Modifier and Type | Method and Description |
---|---|
void |
addRow(int index,
Object[] row)
Insert a row into the list on a certain index
|
void |
addRow(Object[] row)
Add a row to the back of the list
|
int |
compare(Object[] o1,
Object[] o2)
Compare 2 rows of data using the natural keys and indexes specified.
|
int |
getFromDateIndex() |
int[] |
getKeyIndexes() |
Object[] |
getRow(int index)
Get a row from the cache on a certain index
|
List<Object[]> |
getRowCache() |
RowMetaInterface |
getRowMeta() |
int |
getToDateIndex() |
int |
lookupRow(Object[] lookupRowData)
Looks up a row in the (sorted) cache.
|
void |
setFromDateIndex(int fromDateIndex) |
void |
setKeyIndexes(int[] keyIndexes) |
void |
setRowCache(List<Object[]> rowCache) |
void |
setRowMeta(RowMetaInterface rowMeta) |
void |
setToDateIndex(int toDateIndex) |
void |
sortRows() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public DimensionCache(RowMetaInterface rowMeta, int[] keyIndexes, int fromDateIndex, int toDateIndex)
rowMeta
- the description of the rows to storekeyIndexes
- the indexes of the natural key (in that order)fromDateIndex
- the field index where the start of the date range can be foundtoDateIndex
- the field index where the end of the date range can be foundpublic void addRow(Object[] row)
row
- the row to addpublic Object[] getRow(int index)
index
- the index to look forpublic void addRow(int index, Object[] row)
index
- the index on which the row should be insertedrow
- the row to addpublic int lookupRow(Object[] lookupRowData) throws KettleException
lookupRowData
- The data of the lookup row. Make sure that on the index of the from date, you put the lookup date.a
- KettleException in case there are conversion errors during the lookup of the rowKettleException
public void sortRows()
public int compare(Object[] o1, Object[] o2)
compare
in interface Comparator<Object[]>
o1
- o2
- public RowMetaInterface getRowMeta()
public void setRowMeta(RowMetaInterface rowMeta)
rowMeta
- the rowMeta to setpublic void setRowCache(List<Object[]> rowCache)
rowCache
- the rowCache to setpublic int[] getKeyIndexes()
public void setKeyIndexes(int[] keyIndexes)
keyIndexes
- the keyIndexes to setpublic int getFromDateIndex()
public void setFromDateIndex(int fromDateIndex)
fromDateIndex
- the fromDateIndex to setpublic int getToDateIndex()
public void setToDateIndex(int toDateIndex)
toDateIndex
- the toDateIndex to setCopyright © 2018 Hitachi Vantara. All rights reserved.