Package com.illumon.iris.db.v2.ssms
Class LongSegmentedSortedMultiset
java.lang.Object
com.illumon.iris.db.v2.ssms.LongSegmentedSortedMultiset
- All Implemented Interfaces:
DbArrayBase
,DbLongArray
,LongSizedDataStructure
,SegmentedSortedMultiSet<Long>
,ToStringWithElements
,Serializable
public final class LongSegmentedSortedMultiset extends Object implements SegmentedSortedMultiSet<Long>, DbLongArray
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.db.tables.dbarrays.DbLongArray
DbLongArray.Indirect
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.ssms.SegmentedSortedMultiSet
SegmentedSortedMultiSet.RemoveContext
-
Field Summary
Fields inherited from interface com.illumon.iris.db.v2.ssms.SegmentedSortedMultiSet
SEGMENTED_SORTED_MULTISET_VALIDATION
Fields inherited from interface com.illumon.iris.gui.table.format.ToStringWithElements
ARRAY_SIZE_WARNING, DEFAULT_ARRAY_SIZE_COPY, MAX_ARRAY_SIZE_COPY
-
Constructor Summary
Constructors Constructor Description LongSegmentedSortedMultiset(int leafSize)
Create a LongSegmentedSortedArray with the given leafSize. -
Method Summary
Modifier and Type Method Description void
clearDeltas()
LongChunk<?>
countChunk()
boolean
equals(Object o)
void
fillAddedChunk(WritableLongChunk<? extends Attributes.Values> chunk, int position)
void
fillDateChunk(WritableChunk destChunk)
void
fillKeyChunk(WritableChunk<?> keyChunk, int offset)
void
fillRemovedChunk(WritableLongChunk<? extends Attributes.Values> chunk, int position)
long
get(long i)
int
getAddedSize()
DBDateTime
getAsDate(long i)
DbLongArray
getDirect()
Return a version of this DbArrayBase that is flattened out to only reference memory.DbArray<DBDateTime>
getDirectAsDate()
Long
getMax()
long
getMaxCount()
long
getMaxLong()
Long
getMin()
long
getMinCount()
long
getMinLong()
int
getNodeSize()
long
getPrev(long i)
DBDateTime
getPrevAsDate(long offset)
DbLongArray
getPrevValues()
int
getRemovedSize()
int
hashCode()
boolean
insert(WritableChunk<? extends Attributes.Values> valuesToInsert, WritableIntChunk<Attributes.ChunkLengths> counts)
Insert new valuesToInsert into this SSMS.LongChunk<?>
keyChunk()
void
moveBackToFront(SegmentedSortedMultiSet untypedDestination, long count)
Remove count elements from the back of this SSM and add them to the front of the destination SSM.void
moveFrontToBack(SegmentedSortedMultiSet untypedDestination, long count)
Remove count elements from the front of this SSM and add them to the back of the destination SSM.boolean
remove(SegmentedSortedMultiSet.RemoveContext removeContext, WritableChunk<? extends Attributes.Values> valuesToRemove, WritableIntChunk<Attributes.ChunkLengths> counts)
Remove valuesToRemove from this SSA.void
setTrackDeltas(boolean shouldTrackDeltas)
long
size()
The size of this data structure.DbLongArray
subArray(long fromIndex, long toIndex)
DbArray<DBDateTime>
subArrayAsDate(long fromIndexInclusive, long toIndexExclusive)
DbLongArray
subArrayByPositions(long[] positions)
DbArray<DBDateTime>
subArrayByPositionsAsDates(long[] positions)
long[]
toArray()
DBDateTime[]
toDateArray()
Chunk<Attributes.Values>
toDateChunk()
String
toDateString()
DbArray<Long>
toDbArray()
String
toString()
long
totalSize()
void
validate()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.illumon.iris.db.tables.dbarrays.DbLongArray
fillChunk, getComponentType, toChunk
-
Constructor Details
-
LongSegmentedSortedMultiset
public LongSegmentedSortedMultiset(int leafSize)Create a LongSegmentedSortedArray with the given leafSize.- Parameters:
leafSize
- the maximumSize for any leaf
-
-
Method Details
-
insert
public boolean insert(WritableChunk<? extends Attributes.Values> valuesToInsert, WritableIntChunk<Attributes.ChunkLengths> counts)Description copied from interface:SegmentedSortedMultiSet
Insert new valuesToInsert into this SSMS. The valuesToInsert to insert must be sorted, without duplicates. The valuesToInsert and counts chunks will be modified during this call, and the resulting chunks are undefined.- Specified by:
insert
in interfaceSegmentedSortedMultiSet<Long>
- Parameters:
valuesToInsert
- the valuesToInsert to insertcounts
- the number of times each value occurs- Returns:
- true if any new values were inserted
-
remove
public boolean remove(SegmentedSortedMultiSet.RemoveContext removeContext, WritableChunk<? extends Attributes.Values> valuesToRemove, WritableIntChunk<Attributes.ChunkLengths> counts)Remove valuesToRemove from this SSA. The valuesToRemove to remove must be sorted.- Specified by:
remove
in interfaceSegmentedSortedMultiSet<Long>
- Parameters:
valuesToRemove
- the valuesToRemove to removeremoveContext
- removalContext- Returns:
- true if any values were removed.
-
validate
-
totalSize
public long totalSize()- Specified by:
totalSize
in interfaceSegmentedSortedMultiSet<Long>
- Returns:
- the total size of the set in elements (i.e. if A exists twice, 2 is returned not one)
-
getNodeSize
public int getNodeSize()- Specified by:
getNodeSize
in interfaceSegmentedSortedMultiSet<Long>
-
getMin
- Specified by:
getMin
in interfaceSegmentedSortedMultiSet<Long>
-
getMax
- Specified by:
getMax
in interfaceSegmentedSortedMultiSet<Long>
-
getMinLong
public long getMinLong() -
getMinCount
public long getMinCount()- Specified by:
getMinCount
in interfaceSegmentedSortedMultiSet<Long>
- Returns:
- the number of times the minimum value exists in this SSM.
-
getMaxLong
public long getMaxLong() -
getMaxCount
public long getMaxCount()- Specified by:
getMaxCount
in interfaceSegmentedSortedMultiSet<Long>
- Returns:
- the number of times the maximum value exists in this SSM.
-
moveFrontToBack
Description copied from interface:SegmentedSortedMultiSet
Remove count elements from the front of this SSM and add them to the back of the destination SSM.The minimum element of this SSM must be greater than or equal to the maximum of destination.
- Specified by:
moveFrontToBack
in interfaceSegmentedSortedMultiSet<Long>
- Parameters:
untypedDestination
- the SegmentedSortedMultiSet to append count elements tocount
- how many elements to move to the destination
-
moveBackToFront
Description copied from interface:SegmentedSortedMultiSet
Remove count elements from the back of this SSM and add them to the front of the destination SSM.The minimum element of this SSM must be less than or equal to the maximum of destination.
- Specified by:
moveBackToFront
in interfaceSegmentedSortedMultiSet<Long>
- Parameters:
untypedDestination
- the SegmentedSortedMultiSet to prepend count elements tocount
- how many elements to move to the destination
-
keyChunk
- Specified by:
keyChunk
in interfaceSegmentedSortedMultiSet<Long>
-
fillKeyChunk
- Specified by:
fillKeyChunk
in interfaceSegmentedSortedMultiSet<Long>
-
countChunk
- Specified by:
countChunk
in interfaceSegmentedSortedMultiSet<Long>
-
setTrackDeltas
public void setTrackDeltas(boolean shouldTrackDeltas)- Specified by:
setTrackDeltas
in interfaceSegmentedSortedMultiSet<Long>
-
clearDeltas
public void clearDeltas()- Specified by:
clearDeltas
in interfaceSegmentedSortedMultiSet<Long>
-
getAddedSize
public int getAddedSize()- Specified by:
getAddedSize
in interfaceSegmentedSortedMultiSet<Long>
-
getRemovedSize
public int getRemovedSize()- Specified by:
getRemovedSize
in interfaceSegmentedSortedMultiSet<Long>
-
fillRemovedChunk
-
fillAddedChunk
-
getPrevValues
-
get
public long get(long i)- Specified by:
get
in interfaceDbLongArray
-
subArray
- Specified by:
subArray
in interfaceDbArrayBase
- Specified by:
subArray
in interfaceDbLongArray
-
subArrayByPositions
- Specified by:
subArrayByPositions
in interfaceDbArrayBase
- Specified by:
subArrayByPositions
in interfaceDbLongArray
-
toArray
public long[] toArray()- Specified by:
toArray
in interfaceDbArrayBase
- Specified by:
toArray
in interfaceDbLongArray
-
size
public long size()Description copied from interface:LongSizedDataStructure
The size of this data structure.- Specified by:
size
in interfaceDbLongArray
- Specified by:
size
in interfaceLongSizedDataStructure
- Specified by:
size
in interfaceSegmentedSortedMultiSet<Long>
- Returns:
- the size of the set (i.e. the number of unique elements).
-
toDbArray
- Specified by:
toDbArray
in interfaceDbArrayBase
- Specified by:
toDbArray
in interfaceDbLongArray
-
getPrev
public long getPrev(long i)- Specified by:
getPrev
in interfaceDbLongArray
-
getDirect
Description copied from interface:DbLongArray
Return a version of this DbArrayBase that is flattened out to only reference memory.- Specified by:
getDirect
in interfaceDbArrayBase
- Specified by:
getDirect
in interfaceDbLongArray
-
equals
-
hashCode
public int hashCode() -
toString
-
getAsDate
-
subArrayAsDate
-
subArrayByPositionsAsDates
-
toDateArray
-
getPrevAsDate
-
toDateChunk
-
fillDateChunk
-
getDirectAsDate
-
toDateString
-