remove obsolete classes and methods
This commit is contained in:
@@ -1,90 +0,0 @@
|
||||
package org.lucares.performance.db;
|
||||
|
||||
enum ByteType {
|
||||
|
||||
CONTINUATION(ContinuationByte.CONTINUATION_BYTE_PREFIX), // 10000000
|
||||
|
||||
DATE_INCREMENT(1 << 6), // 01000000
|
||||
|
||||
MEASUREMENT(1 << 5), // 00100000
|
||||
|
||||
DATE_OFFSET(1 << 4), // 00010000
|
||||
|
||||
VERSION(1);// 00000001
|
||||
|
||||
interface ContinuationByte {
|
||||
int NUMBER_OF_VALUES_BITS = 7;
|
||||
|
||||
int CONTINUATION_BYTE_PREFIX = 1 << NUMBER_OF_VALUES_BITS; // 10000000
|
||||
}
|
||||
|
||||
interface VersionByte {
|
||||
/**
|
||||
* The version uses at least two bytes. The first byte is the prefix
|
||||
* which cannot hold any value (unless it is 0). And the second byte is
|
||||
* the actual value.
|
||||
*/
|
||||
int MIN_LENGTH = 2;
|
||||
}
|
||||
|
||||
private final int firstBytePrefix;
|
||||
private final int firstByteMaxValue;
|
||||
|
||||
private ByteType(final int firstBytePrefix) {
|
||||
this.firstBytePrefix = firstBytePrefix;
|
||||
firstByteMaxValue = firstBytePrefix-1;
|
||||
}
|
||||
|
||||
public int getBytePrefix() {
|
||||
return firstBytePrefix;
|
||||
}
|
||||
|
||||
public byte getBytePrefixAsByte() {
|
||||
return (byte) firstBytePrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* the max value for the first byte is the prefix minus 1, because prefixes
|
||||
* start with 0⋯010⋯0, so prefix -1 is 0⋯01⋯1 which is exactly the max value
|
||||
*
|
||||
* @return the maximum value for the first byte of this sequence
|
||||
*/
|
||||
public long getFirstByteMaxValue() {
|
||||
return firstByteMaxValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* the value bits are the prefix minus 1, because prefixes start with
|
||||
* 0⋯010⋯0, so prefix -1 is 0⋯01⋯1 which exactly represents the value bits.
|
||||
*
|
||||
* @return bitmap with the value bits set
|
||||
*/
|
||||
public int getValueBits() {
|
||||
return firstBytePrefix - 1;
|
||||
}
|
||||
|
||||
public boolean isValid(final int theByte) {
|
||||
|
||||
final long prefixBits = getPrefixBits();
|
||||
|
||||
return firstBytePrefix == (theByte & prefixBits);
|
||||
}
|
||||
|
||||
public int getPrefixBits() {
|
||||
return (~getValueBits()) & 0xff;
|
||||
}
|
||||
|
||||
public static ByteType getType(final int aByte) {
|
||||
|
||||
for (final ByteType byteType : values()) {
|
||||
if (byteType.isValid(aByte)) {
|
||||
return byteType;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getValue(final int aByte) {
|
||||
return aByte & getValueBits();
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package org.lucares.performance.db;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
public class PdbWriterByTimeAsc implements Comparator<PdbWriter> {
|
||||
|
||||
public static final PdbWriterByTimeAsc INSTANCE = new PdbWriterByTimeAsc();
|
||||
public static final Comparator<PdbWriter> REVERSED = INSTANCE.reversed();
|
||||
|
||||
@Override
|
||||
public int compare(final PdbWriter o1, final PdbWriter o2) {
|
||||
|
||||
final long o1From = o1.getDateOffsetAsEpochMilli();
|
||||
final long o2From = o2.getDateOffsetAsEpochMilli();
|
||||
return Long.compare(o1From, o2From);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.lucares.performance.db;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
|
||||
@@ -16,8 +15,4 @@ public class DateUtils {
|
||||
public static OffsetDateTime nowInUtc() {
|
||||
return OffsetDateTime.now(ZoneOffset.UTC);
|
||||
}
|
||||
|
||||
public static OffsetDateTime epochMilliInUTC(final long lastEpochMilli) {
|
||||
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(lastEpochMilli), ZoneOffset.UTC);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user