Interface IndexedSortable
- All Known Subinterfaces:
InMemorySorter<T>
- All Known Implementing Classes:
FixedLengthRecordSorter,NormalizedKeySorter
public interface IndexedSortable
-
Method Summary
Modifier and TypeMethodDescriptionintcompare(int i, int j) Compare items at the given addresses consistent with the semantics ofComparator.compare(Object, Object).intcompare(int segmentNumberI, int segmentOffsetI, int segmentNumberJ, int segmentOffsetJ) Compare records at the given addresses consistent with the semantics ofComparator.compare(Object, Object).intGets the size of each record, the number of bytes separating the head of successive records.intGets the number of elements in each memory segment.intsize()Gets the number of elements in the sortable.voidswap(int i, int j) Swap items at the given addresses.voidswap(int segmentNumberI, int segmentOffsetI, int segmentNumberJ, int segmentOffsetJ) Swap records at the given addresses.
-
Method Details
-
compare
int compare(int i, int j) Compare items at the given addresses consistent with the semantics ofComparator.compare(Object, Object). -
compare
int compare(int segmentNumberI, int segmentOffsetI, int segmentNumberJ, int segmentOffsetJ) Compare records at the given addresses consistent with the semantics ofComparator.compare(Object, Object).- Parameters:
segmentNumberI- index of memory segment containing first recordsegmentOffsetI- offset into memory segment containing first recordsegmentNumberJ- index of memory segment containing second recordsegmentOffsetJ- offset into memory segment containing second record- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
-
swap
void swap(int i, int j) Swap items at the given addresses. -
swap
void swap(int segmentNumberI, int segmentOffsetI, int segmentNumberJ, int segmentOffsetJ) Swap records at the given addresses.- Parameters:
segmentNumberI- index of memory segment containing first recordsegmentOffsetI- offset into memory segment containing first recordsegmentNumberJ- index of memory segment containing second recordsegmentOffsetJ- offset into memory segment containing second record
-
size
int size()Gets the number of elements in the sortable.- Returns:
- The number of elements.
-
recordSize
int recordSize()Gets the size of each record, the number of bytes separating the head of successive records.- Returns:
- The record size
-
recordsPerSegment
int recordsPerSegment()Gets the number of elements in each memory segment.- Returns:
- The number of records per segment
-