public class RowCollection extends java.lang.Object implements Sortable<Row.Entry>, java.lang.Iterable<Row.Entry>, java.lang.Cloneable, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
private class |
RowCollection.keyIterator
Iterator for kelondroRowCollection.
|
static class |
RowCollection.partitionthread |
private class |
RowCollection.rowIterator
Iterator for kelondroRowCollection.
|
Modifier and Type | Field and Description |
---|---|
protected byte[] |
chunkcache |
protected int |
chunkcount |
private static Column |
collectionColumnProducer |
private static long |
day |
private static byte[] |
EMPTY_CACHE |
private static int |
exp_chunkcount |
private static int |
exp_collection |
private static int |
exp_last_read |
private static int |
exp_last_wrote |
private static int |
exp_order_bound |
private static int |
exp_order_type |
private static Column |
exportColumn0 |
private static Column |
exportColumn1 |
private static Column |
exportColumn2 |
private static Column |
exportColumn3 |
private static Column |
exportColumn4 |
private static Row |
exportMeasureRow |
protected static long |
exportOverheadSize |
static long |
growfactorLarge100 |
static long |
growfactorSmall100 |
private static int |
isortlimit |
protected long |
lastTimeWrote |
private static java.util.Random |
random |
protected Row |
rowdef |
private static long |
serialVersionUID |
protected int |
sortBound |
Modifier | Constructor and Description |
---|---|
protected |
RowCollection(Row rowdef) |
protected |
RowCollection(Row rowdef,
byte[] chunkcache,
int chunkcount,
int sortBound,
long lastTimeWrote) |
protected |
RowCollection(RowCollection rc) |
|
RowCollection(Row rowdef,
int objectCount) |
protected |
RowCollection(Row rowdef,
int objectCount,
byte[] cache,
int sortBound) |
protected |
RowCollection(Row rowdef,
Row.Entry exportedCollectionRowEnvironment) |
Modifier and Type | Method and Description |
---|---|
void |
add(byte[] a) |
void |
addAllUnique(RowCollection c) |
protected void |
addSorted(byte[] a,
int astart,
int alength) |
private void |
addUnique(byte[] a,
int astart,
int alength) |
void |
addUnique(java.util.List<Row.Entry> rows) |
void |
addUnique(Row.Entry row) |
private static boolean |
allZero(byte[] a,
int astart,
int alength) |
Row.Entry |
buffer() |
private void |
checkShrink() |
void |
clear() |
RowCollection |
clone() |
void |
close() |
protected int |
compare(byte[] a,
int astart,
int chunknumber) |
private int |
compare(int i,
int j) |
int |
compare(Row.Entry o1,
Row.Entry o2) |
private static long |
d(long a,
long b) |
private static int |
daysSince2000(long time) |
void |
delete(int p) |
private void |
ensureSize(int elements) |
byte[] |
exportCollection() |
private static Row |
exportRow(int chunkcachelength) |
Row.Entry |
get(int index,
boolean clone) |
protected byte[] |
getKey(int index) |
void |
insertUnique(int index,
Row.Entry a) |
boolean |
isEmpty() |
boolean |
isSorted() |
java.util.Iterator<Row.Entry> |
iterator()
return an iterator for the row entries in this object
|
java.util.Iterator<byte[]> |
keys(boolean keepOrderWhenRemoving) |
byte[] |
largestKey() |
long |
lastWrote() |
static void |
main(java.lang.String[] args) |
protected boolean |
match(byte[] a,
int astart,
int chunknumber) |
protected boolean |
match(int i,
int j) |
long |
mem()
calculate the memory that the structure occupies in ram
|
protected long |
memoryNeededForGrow()
compute the needed memory in case of a cache extension.
|
private long |
neededSpaceForEnsuredSize(int elements) |
void |
optimize() |
(package private) int |
partition(int L,
int R,
int S,
byte[] swapspace) |
private int |
picMiddle(int a,
int b,
int c) |
private int |
picMiddle(int a,
int b,
int c,
int d,
int e) |
private int |
pivot(int L,
int R,
int S) |
java.util.List<Row.Entry> |
random(int count) |
private static java.lang.String |
randomHash() |
java.util.ArrayList<RowCollection> |
removeDoubles() |
Row.Entry |
removeOne()
removes the last entry from the collection
|
void |
removeRow(int p,
boolean keepOrder)
This method removes the entry at position p ensuring the order of the remaining
entries if specified by keepOrder.
|
void |
reset() |
Row |
row() |
void |
saveCollection(java.io.File file) |
void |
set(int index,
Row.Entry a) |
int |
size() |
static int |
sizeOfExportedCollectionRows(Row.Entry exportedCollectionRowEnvironment,
int columnInEnvironment) |
byte[] |
smallestKey() |
void |
sort() |
int |
sorted() |
private int |
swap(int i,
int j,
int p,
byte[] swapspace) |
void |
swap(int i,
int j,
Row.Entry buffer) |
static void |
test(int testsize) |
java.util.List<Row.Entry> |
top(int count) |
java.lang.String |
toString() |
protected void |
trim() |
protected void |
uniq() |
private static final long serialVersionUID
private static final byte[] EMPTY_CACHE
public static final long growfactorLarge100
public static final long growfactorSmall100
private static final int isortlimit
private static final int exp_chunkcount
private static final int exp_last_read
private static final int exp_last_wrote
private static final int exp_order_type
private static final int exp_order_bound
private static final int exp_collection
protected final Row rowdef
protected byte[] chunkcache
protected int chunkcount
protected int sortBound
protected long lastTimeWrote
private static final Row exportMeasureRow
private static final long day
private static Column exportColumn0
private static Column exportColumn1
private static Column exportColumn2
private static Column exportColumn3
private static Column exportColumn4
private static Column collectionColumnProducer
protected static final long exportOverheadSize
private static java.util.Random random
protected RowCollection(RowCollection rc)
protected RowCollection(Row rowdef)
public RowCollection(Row rowdef, int objectCount) throws SpaceExceededException
SpaceExceededException
protected RowCollection(Row rowdef, int objectCount, byte[] cache, int sortBound)
protected RowCollection(Row rowdef, byte[] chunkcache, int chunkcount, int sortBound, long lastTimeWrote)
public RowCollection clone()
clone
in class java.lang.Object
public void reset()
public long mem()
public static final int sizeOfExportedCollectionRows(Row.Entry exportedCollectionRowEnvironment, int columnInEnvironment)
private static int daysSince2000(long time)
private static Row exportRow(int chunkcachelength)
public byte[] exportCollection()
public void saveCollection(java.io.File file) throws java.io.IOException
java.io.IOException
public Row row()
private final long neededSpaceForEnsuredSize(int elements)
private final void ensureSize(int elements) throws SpaceExceededException
SpaceExceededException
protected final long memoryNeededForGrow()
public int compare(Row.Entry o1, Row.Entry o2)
compare
in interface java.util.Comparator<Row.Entry>
public void swap(int i, int j, Row.Entry buffer)
private final void checkShrink()
protected void trim()
public final long lastWrote()
protected final byte[] getKey(int index)
public final Row.Entry get(int index, boolean clone)
public final void set(int index, Row.Entry a) throws SpaceExceededException
SpaceExceededException
public final void insertUnique(int index, Row.Entry a) throws SpaceExceededException
SpaceExceededException
public void addUnique(Row.Entry row) throws SpaceExceededException
SpaceExceededException
public void addUnique(java.util.List<Row.Entry> rows) throws SpaceExceededException
SpaceExceededException
public void add(byte[] a) throws SpaceExceededException
SpaceExceededException
private final void addUnique(byte[] a, int astart, int alength) throws SpaceExceededException
SpaceExceededException
protected final void addSorted(byte[] a, int astart, int alength) throws SpaceExceededException
SpaceExceededException
private static final boolean allZero(byte[] a, int astart, int alength)
public final void addAllUnique(RowCollection c) throws SpaceExceededException
SpaceExceededException
public final void removeRow(int p, boolean keepOrder)
p
- element at this position will be removedkeepOrder
- keep the order of remaining entriespublic Row.Entry removeOne()
public java.util.List<Row.Entry> top(int count)
public java.util.List<Row.Entry> random(int count)
public byte[] smallestKey()
public byte[] largestKey()
public void clear()
public boolean isEmpty()
public int sorted()
public java.util.Iterator<byte[]> keys(boolean keepOrderWhenRemoving)
public java.util.Iterator<Row.Entry> iterator()
iterator
in interface java.lang.Iterable<Row.Entry>
public void optimize()
public final void sort()
final int partition(int L, int R, int S, byte[] swapspace)
L
- is the first element in the sequenceR
- is the right bound of the sequence, and outside of the sequenceS
- is the bound of the sorted elements in the sequenceswapspace
- private final int pivot(int L, int R, int S)
private final int picMiddle(int a, int b, int c, int d, int e)
private final int picMiddle(int a, int b, int c)
private final int swap(int i, int j, int p, byte[] swapspace)
protected void uniq()
public java.util.ArrayList<RowCollection> removeDoubles() throws SpaceExceededException
SpaceExceededException
public boolean isSorted()
public java.lang.String toString()
toString
in class java.lang.Object
private final int compare(int i, int j)
protected int compare(byte[] a, int astart, int chunknumber)
protected final boolean match(int i, int j)
protected boolean match(byte[] a, int astart, int chunknumber)
public void close()
private static long d(long a, long b)
private static java.lang.String randomHash()
public static void test(int testsize) throws SpaceExceededException
SpaceExceededException
public static void main(java.lang.String[] args)