From 979d3269fa8e0ba4fc71fcf8727b3b4388db4bab Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Thu, 4 Oct 2018 18:46:51 +0200 Subject: [PATCH] remove obsolete classes and methods --- .../pdb/datastore/internal/CreateNewKey.java | 20 ----- .../org/lucares/performance/db/ByteType.java | 90 ------------------- .../performance/db/PdbWriterByTimeAsc.java | 18 ---- .../org/lucares/performance/db/DateUtils.java | 5 -- 4 files changed, 133 deletions(-) delete mode 100644 data-store/src/main/java/org/lucares/pdb/datastore/internal/CreateNewKey.java delete mode 100644 performanceDb/src/main/java/org/lucares/performance/db/ByteType.java delete mode 100644 performanceDb/src/main/java/org/lucares/performance/db/PdbWriterByTimeAsc.java diff --git a/data-store/src/main/java/org/lucares/pdb/datastore/internal/CreateNewKey.java b/data-store/src/main/java/org/lucares/pdb/datastore/internal/CreateNewKey.java deleted file mode 100644 index 3abfffe..0000000 --- a/data-store/src/main/java/org/lucares/pdb/datastore/internal/CreateNewKey.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.lucares.pdb.datastore.internal; - -import java.util.function.Function; - -public class CreateNewKey implements Function { - - private final int index; - - public CreateNewKey(final int index) { - this.index = index; - } - - @Override - public String apply(final String key) { - - final String result = String.valueOf(index); - - return result; - } -} diff --git a/performanceDb/src/main/java/org/lucares/performance/db/ByteType.java b/performanceDb/src/main/java/org/lucares/performance/db/ByteType.java deleted file mode 100644 index e995a99..0000000 --- a/performanceDb/src/main/java/org/lucares/performance/db/ByteType.java +++ /dev/null @@ -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(); - } -} diff --git a/performanceDb/src/main/java/org/lucares/performance/db/PdbWriterByTimeAsc.java b/performanceDb/src/main/java/org/lucares/performance/db/PdbWriterByTimeAsc.java deleted file mode 100644 index e5153a5..0000000 --- a/performanceDb/src/main/java/org/lucares/performance/db/PdbWriterByTimeAsc.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.lucares.performance.db; - -import java.util.Comparator; - -public class PdbWriterByTimeAsc implements Comparator { - - public static final PdbWriterByTimeAsc INSTANCE = new PdbWriterByTimeAsc(); - public static final Comparator 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); - } - -} diff --git a/performanceDb/src/test/java/org/lucares/performance/db/DateUtils.java b/performanceDb/src/test/java/org/lucares/performance/db/DateUtils.java index 168e6dc..6d34148 100644 --- a/performanceDb/src/test/java/org/lucares/performance/db/DateUtils.java +++ b/performanceDb/src/test/java/org/lucares/performance/db/DateUtils.java @@ -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); - } }