2023-03-04 12:19:01 +00:00
|
|
|
package nu.marginalia.array;
|
2023-01-08 10:11:44 +00:00
|
|
|
|
2023-03-04 12:19:01 +00:00
|
|
|
import nu.marginalia.array.algo.LongArrayBase;
|
|
|
|
import nu.marginalia.array.algo.LongArraySearch;
|
|
|
|
import nu.marginalia.array.algo.LongArraySort;
|
|
|
|
import nu.marginalia.array.algo.LongArrayTransformations;
|
|
|
|
import nu.marginalia.array.delegate.ShiftedLongArray;
|
2024-01-22 12:38:42 +00:00
|
|
|
import nu.marginalia.array.page.UnsafeLongArray;
|
2023-01-08 10:11:44 +00:00
|
|
|
|
2023-10-07 08:00:00 +00:00
|
|
|
import java.lang.foreign.Arena;
|
2023-01-08 10:11:44 +00:00
|
|
|
|
|
|
|
|
2023-09-23 10:14:39 +00:00
|
|
|
public interface LongArray extends LongArrayBase, LongArrayTransformations, LongArraySearch, LongArraySort, AutoCloseable {
|
2023-01-08 10:11:44 +00:00
|
|
|
int WORD_SIZE = 8;
|
|
|
|
|
2023-10-07 08:00:00 +00:00
|
|
|
@Deprecated
|
2023-01-08 10:11:44 +00:00
|
|
|
static LongArray allocate(long size) {
|
2024-01-22 12:38:42 +00:00
|
|
|
return UnsafeLongArray.onHeap(Arena.ofShared(), size);
|
2023-01-08 10:11:44 +00:00
|
|
|
}
|
|
|
|
|
2023-09-24 09:31:54 +00:00
|
|
|
default LongArray shifted(long offset) {
|
2023-01-08 10:11:44 +00:00
|
|
|
return new ShiftedLongArray(offset, this);
|
|
|
|
}
|
2023-09-24 09:31:54 +00:00
|
|
|
default LongArray range(long start, long end) {
|
2023-01-08 10:11:44 +00:00
|
|
|
return new ShiftedLongArray(start, end, this);
|
|
|
|
}
|
|
|
|
|
2023-04-20 13:28:09 +00:00
|
|
|
/** Translate the range into the equivalent range in the underlying array if they are in the same page */
|
|
|
|
ArrayRangeReference<LongArray> directRangeIfPossible(long start, long end);
|
|
|
|
|
2023-01-08 10:11:44 +00:00
|
|
|
void force();
|
2023-09-23 10:14:39 +00:00
|
|
|
void close();
|
2023-01-08 10:11:44 +00:00
|
|
|
}
|