T
- the type of the items stored in the queuepublic interface OffsetQueue<T>
T
items indexed by offsets.
The items are ordered in the queue according to their offset.
The item with the smallest offset is the head of the queue.
The item with the largest offset is the tail of the queue.Modifier and Type | Method and Description |
---|---|
T |
getHeadItem()
Return the item with the smallest offset in the queue.
|
Iterable<T> |
getHeadItems(int skip,
int limit)
Return #limit items after skipping #skip items from the queue.
|
long |
getHeadOffset() |
T |
getItem(long offset)
Return the item at the given #offset.
|
OffsetQueue<T> |
getMinOffsetQueue(long minOffset)
Return an
OffsetQueue offset queue which
contains all the items from the current queue at
an offset greater or equal to #minOffset. |
int |
getSize() |
long |
getTailOffset() |
boolean |
isEmpty() |
void |
putItem(long offset,
T item)
Put an item in the queue at the given offset.
|
void |
putItems(OffsetQueue<T> offsetQueue)
Put all the items from the #offsetQueue in this queue.
|
void putItem(long offset, T item)
offset
- the offset associated to the itemitem
- the item to be stored at the given offsetvoid putItems(OffsetQueue<T> offsetQueue)
offsetQueue
- the queue to be merged into this queue@CheckForNull T getItem(long offset)
offset
- the offset of the item to be returnednull
if no item could be found
at the given offset@CheckForNull T getHeadItem()
null
if the queue is empty@Nonnull Iterable<T> getHeadItems(int skip, int limit)
skip
- the number of items to skiplimit
- the maximum number of items to return. -1 will return all items.long getHeadOffset()
-1
if the queue is empty.long getTailOffset()
-1
if the queue is empty.boolean isEmpty()
true
if the queue is empty ;
false
otherwiseint getSize()
@Nonnull OffsetQueue<T> getMinOffsetQueue(long minOffset)
OffsetQueue
offset queue which
contains all the items from the current queue at
an offset greater or equal to #minOffset.minOffset
- the minimal offset of the items
in the returned offset queueCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.