public class SamRecordTrackingBuffer<T extends SamRecordWithOrdinal> extends Object
| Constructor | Description |
|---|---|
SamRecordTrackingBuffer(int maxRecordsInRam,
int blockSize,
List<File> tmpDirs,
SAMFileHeader header,
Class<T> clazz) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
add(SamRecordWithOrdinal samRecordWithOrdinal) |
Add the given SAMRecordIndex to the buffer.
|
boolean |
canEmit() |
Returns true if we can return the next record (it has been examined).
|
void |
close() |
Close IO resources associated with each underlying BufferBlock
|
boolean |
contains(SamRecordWithOrdinal samRecordWithOrdinal) |
Returns true if this buffer contains the record at the given index, false otherwise
|
boolean |
isEmpty() |
Returns true if we are tracking no records, false otherwise
|
SamRecordWithOrdinal |
next() |
Returns the next element in the iteration.
|
void |
remove() |
Removes the next record from this buffer
|
void |
setResultState(SamRecordWithOrdinal samRecordWithOrdinal,
boolean resultState) |
Mark the current samRecordWithOrdinal as having been examined.
|
long |
size() |
Return the total number of elements in the queue, both in memory and on disk
|
public SamRecordTrackingBuffer(int maxRecordsInRam,
int blockSize,
List<File> tmpDirs,
SAMFileHeader header,
Class<T> clazz)
maxRecordsInRam - how many records to buffer before spilling to diskblockSize - the number of records in a given blocktmpDirs - the temporary directories to use when spilling to diskheader - the headerclazz - the class that extends SamRecordWithOrdinalpublic boolean isEmpty()
public boolean canEmit()
public void add(SamRecordWithOrdinal samRecordWithOrdinal)
samRecordWithOrdinal - The samRecordWithOrdinal to be addedpublic SamRecordWithOrdinal next()
NoSuchElementException - if the buffer is empty.SAMException - if the buffer is not competent to emit (canEmit returns false)public void remove()
public long size()
public boolean contains(SamRecordWithOrdinal samRecordWithOrdinal)
public void setResultState(SamRecordWithOrdinal samRecordWithOrdinal, boolean resultState)
samRecordWithOrdinal - The samRecordWithOrdinal to be markedresultState - Boolean flag indicating the result of the examination of this record.SAMException - if the provided recordIndex is not found within the SamRecordTrackingBufferpublic void close()