|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbaobab.util.CompressibleSortedSet<T>
T
- the type of objects that this object may store.
When the type <T> implements the interface
baobab.util.Joinable<T>, if the CompressibleSortedSet already contains
an element that is equal to an added element, they are joined.
In the same way, when an element is removed, it is in fact splitted
from an equivalent object which is already present in the
CompressibleSortedSet, and if the resulting object is empty, then
it is removed.public class CompressibleSortedSet<T>
The CompressibleSortedSet class represents a sorted set of codable objects.
In general, insertions and removals are not processed one by one, but accumulated and then processed in batch mode, from time to time or when the set is resolved.
The intern organization of this set allows automatic partial compression of its data. To be able to use this class it is necessary to have an element comparator (java.util.Comparator<T>) and an element coder (baobab.util.Coder<T>).
Field Summary | |
---|---|
static double |
BLOCK_SPLIT_BALANCE
|
static int |
MAXIMUM_NUMBER_OF_ELEMENTS_BY_COMPRESSIBLE_BLOCK
The default value for the maximum number of elements by compressible block |
static int |
MAXIMUM_NUMBER_OF_UNCOMPRESSED_BLOCKS_FOR_AUTOMATIC_COMPRESSION
The default value for the maximum number uncompressed blocks |
static int |
MAXIMUM_PENDING_INSERTION_DELETION_LIST_FOR_COMPRESSED_BLOCK
The default value for the maximum number of uncompressed elements in the pending (insertion / deletion) lists of each compressed block |
Constructor Summary | |
---|---|
CompressibleSortedSet(Coder<T> coder)
CompressibleSortedSet constructor |
|
CompressibleSortedSet(Coder<T> coder,
int x,
int y,
int z)
CompressibleSortedSet constructor |
|
CompressibleSortedSet(java.util.Comparator<T> comparator,
Coder<T> coder)
CompressibleSortedSet constructor |
|
CompressibleSortedSet(java.util.Comparator<T> comparator,
Coder<T> coder,
int x,
int y,
int z,
double balance)
CompressibleSortedSet constructor |
Method Summary | |
---|---|
int |
addElement(T element)
Add an element to this set (in general, additions are not processed one by one, but accumulated and then processed in batch mode, from time to time or when the set is resolved). |
void |
clear()
Removes all elements in this set |
void |
clear(boolean bk)
Removes all elements in this set |
java.util.Iterator<T> |
descendingIterator()
Gets a descending iterator of this set. |
T |
firstElement()
Gets the first element in this set |
int |
flushLastDecompressionResult()
Gets the number of elements that have been added/removed to this set after the last internal (partial) decompression and batch processing. |
boolean |
isEmpty()
Tests whether this set is empty |
boolean |
isResolved()
Tests whether this set is resolved (does not have pending insertions/removals). |
java.util.Iterator<T> |
iterator()
Gets a ascending iterator of this set. |
T |
lastElement()
Gets the last element in this set |
int |
notResolvedSize()
Gets the not resolved size (number of elements) of this set. |
int |
removeElement(T element)
Remove an element from this set (in general, removals are not processed one by one, but accumulated and then processed in batch mode, from time to time or when the set is resolved). |
int |
resolve()
Resolves all pending insertions/removals of this set (WARNING: this method can cause a high overhead because usually it forces several internal decompressions and recompressions). |
int |
resolvedSize()
Gets the resolved size (number of elements) of this set. |
T |
searchElement(T element)
Search an element in this set (WARNING: frequent use of this method can cause a high overhead because usually it forces an internal partial decompression) |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MAXIMUM_NUMBER_OF_ELEMENTS_BY_COMPRESSIBLE_BLOCK
public static final int MAXIMUM_NUMBER_OF_UNCOMPRESSED_BLOCKS_FOR_AUTOMATIC_COMPRESSION
public static final int MAXIMUM_PENDING_INSERTION_DELETION_LIST_FOR_COMPRESSED_BLOCK
public static final double BLOCK_SPLIT_BALANCE
Constructor Detail |
---|
public CompressibleSortedSet(java.util.Comparator<T> comparator, Coder<T> coder, int x, int y, int z, double balance)
comparator
- a comparator of Elementcoder
- a coder of Elementx
- the maximum number of elements by compressible blocky
- the maximum number of uncompressed blocks to start automatic compressionz
- the maximum number of uncompressed elements in the pending (insertion ou deletion) lists for each compressed blockpublic CompressibleSortedSet(Coder<T> coder, int x, int y, int z)
coder
- a coder of Elementx
- the maximum number of elements by compressible blocky
- the maximum number of uncompressed blocks to start automatic compressionz
- the maximum number of uncompressed elements in the pending (insertion ou deletion) lists for each compressed blockpublic CompressibleSortedSet(java.util.Comparator<T> comparator, Coder<T> coder)
comparator
- a comparator of Elementcoder
- a coder of Elementpublic CompressibleSortedSet(Coder<T> coder)
coder
- a coder of ElementMethod Detail |
---|
public boolean isResolved()
public int flushLastDecompressionResult()
public boolean isEmpty()
public int notResolvedSize()
public int resolvedSize()
public int resolve()
public java.util.Iterator<T> iterator()
public java.util.Iterator<T> descendingIterator()
public int addElement(T element)
When this addition is processed, if element is Joinable, and an object equivalent to element is already present in this set, element is joined to the object.
element
- the element to be added
public int removeElement(T element)
When this removal is processed, if element is Joinable, and an object equivalent to element is present in this set, element is splitted from this object; if the resulting object is empty, it is removed from the set.
element
- the element to be removed
public T firstElement()
public T lastElement()
public T searchElement(T element)
element
- the element to be searched
public void clear()
public void clear(boolean bk)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |