public class OffsetTree extends Object
I.e. if you have 0 1 2 3 6 7 8 , it will return 3.
Why is that useful ? to quickly return the largest offset terminating a continuously increasing sequence.
Constructor and Description |
---|
OffsetTree() |
Modifier and Type | Method and Description |
---|---|
long |
add(long l)
Add an offset to the tree.
|
void |
clearUpTo(long l)
Clear all items up to the given value
|
boolean |
contains(long offset)
Return true if this offset is currently in the set
|
long |
getLargestOffsetFromFirstSequence()
getLargestOffsetFromFirstSequence(1 2 6 7) returns 2.
|
protected boolean |
isEmpty() |
protected void |
removeStartingFrom(long l) |
int |
size() |
String |
toString() |
public long getLargestOffsetFromFirstSequence()
getLargestOffsetFromFirstSequence(1 2 3 4) returns 4.
public long add(long l)
l
- the new offsetpublic boolean contains(long offset)
offset
- public int size()
protected boolean isEmpty()
public void clearUpTo(long l)
l
- a valueprotected void removeStartingFrom(long l)
Copyright © 2014–2023. All rights reserved.