diff --git a/build.gradle b/build.gradle index 74bfd6a..49ed64a 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { } group = 'com.nucleodb' -version = '1.13.4' +version = '1.13.5' repositories { mavenCentral() diff --git a/src/main/java/com/nucleodb/library/database/index/IndexWrapper.java b/src/main/java/com/nucleodb/library/database/index/IndexWrapper.java index 66cfb2d..7f00564 100644 --- a/src/main/java/com/nucleodb/library/database/index/IndexWrapper.java +++ b/src/main/java/com/nucleodb/library/database/index/IndexWrapper.java @@ -6,6 +6,7 @@ import com.nucleodb.library.database.index.trie.Entry; import com.nucleodb.library.database.tables.table.DataEntry; import com.nucleodb.library.database.utils.exceptions.InvalidIndexTypeException; +import org.jetbrains.annotations.NotNull; import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; @@ -18,7 +19,7 @@ import java.util.Queue; import java.util.Set; -public abstract class IndexWrapper implements Serializable{ +public abstract class IndexWrapper implements Serializable, Comparable{ private static final long serialVersionUID = 1; String indexedKeyStr; public IndexWrapper(String indexedKey) { @@ -140,4 +141,12 @@ public Set greaterThan(Object searchObj) { public Set greaterThanEqual(Object searchObj) { return (Set) Sets.newTreeSet(); } + + @Override + public int compareTo(@NotNull Object o) { + if(o instanceof IndexWrapper) { + return indexedKeyStr.compareTo(((IndexWrapper) o).getIndexedKey()); + } + return 0; + } } diff --git a/src/main/java/com/nucleodb/library/database/index/TrieIndex.java b/src/main/java/com/nucleodb/library/database/index/TrieIndex.java index 4cf628f..b72f79c 100644 --- a/src/main/java/com/nucleodb/library/database/index/TrieIndex.java +++ b/src/main/java/com/nucleodb/library/database/index/TrieIndex.java @@ -252,4 +252,5 @@ public List startsWithInternal(String findString) { return tmp.getPartialEntries().stream().collect(Collectors.toList()); } + } \ No newline at end of file diff --git a/src/main/java/com/nucleodb/library/database/tables/table/DataTableConfig.java b/src/main/java/com/nucleodb/library/database/tables/table/DataTableConfig.java index 25f05b9..f71576f 100644 --- a/src/main/java/com/nucleodb/library/database/tables/table/DataTableConfig.java +++ b/src/main/java/com/nucleodb/library/database/tables/table/DataTableConfig.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.nucleodb.library.database.index.IndexWrapper; import com.nucleodb.library.database.utils.StartupRun; +import org.jetbrains.annotations.NotNull; import java.io.Serializable; import java.time.Instant; @@ -14,7 +15,7 @@ public class DataTableConfig implements Serializable{ private static final long serialVersionUID = 4416983891804575837L; - public static class IndexConfig { + public static class IndexConfig implements Comparable { String name; Class indexType; @@ -38,6 +39,14 @@ public Class getIndexType() { public void setIndexType(Class indexType) { this.indexType = indexType; } + + @Override + public int compareTo(@NotNull Object o) { + if(o instanceof IndexConfig){ + return this.getName().compareTo(((IndexConfig) o).getName()); + } + return 0; + } } String bootstrap = "127.0.0.1:19092"; String table;