From 37eee0849999f14ff9e26f41f8dd43677d7a23dd Mon Sep 17 00:00:00 2001 From: mmogley Date: Tue, 18 May 2021 18:13:02 -0700 Subject: [PATCH] Update CoverTree to allow Jackson serialization --- pom.xml | 114 +----------------- .../zabuzard/closy/internal/CoverTree.java | 21 +++- 2 files changed, 22 insertions(+), 113 deletions(-) diff --git a/pom.xml b/pom.xml index 8ad2e45..ea33d13 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.zabuzard.closy closy - 1.2.1 + 1.2.1_01 jar @@ -18,7 +18,7 @@ Closy Closy is a library that provides fast and generic solutions for nearest neighbor search (NNS) - https://github.com/Zabuzard/Closy + https://github.com/wirefreethought/Closy GNU General Public License v3.0 @@ -34,112 +34,8 @@ - scm:git:git://github.com/Zabuzard/Closy.git - scm:git:ssh://github.com:Zabuzard/Closy.git - http://github.com/Zabuzard/Closy/tree/master + scm:git:git://github.com/wirefreethought/Closy.git + scm:git:ssh://github.com:wirefreethought/Closy.git + http://github.com/wirefreethought/Closy/tree/master - - - - release - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.2.1 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.2.0 - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - ${gpg.keyname} - ${gpg.keyname} - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.8 - true - - ossrh - https://oss.sonatype.org/ - true - - - - - - - local - - - - org.apache.maven.plugins - maven-source-plugin - 3.2.1 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.2.0 - - - attach-javadocs - - jar - - - - - - - - \ No newline at end of file diff --git a/src/main/java/io/github/zabuzard/closy/internal/CoverTree.java b/src/main/java/io/github/zabuzard/closy/internal/CoverTree.java index bd9a5be..5393642 100644 --- a/src/main/java/io/github/zabuzard/closy/internal/CoverTree.java +++ b/src/main/java/io/github/zabuzard/closy/internal/CoverTree.java @@ -39,6 +39,10 @@ public final class CoverTree implements NearestNeighborComputation { */ private static final int DEFAULT_MIN_NUM_LEVELS = -500; + private CoverTree() + { + } + /** * Utility method to create a new list instance. Can be used to exchange the * list type used by the tree. @@ -54,43 +58,52 @@ private static List createList() { /** * Lock used for synchronization. */ - private final Object lock = new Object(); + private transient Object lock = new Object(); + /** * The base of the tree. */ - private final double base; + private double base; + /** * The metric to use for determining distance between elements. */ - private final Metric metric; + private Metric metric; + /** * The current number of levels of the tree. */ - private final int[] numLevels; + private int[] numLevels; + /** * The current maximal level of the tree. */ @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized") private int maxLevel; + /** * The maximal minimum level of the tree. */ @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized") private int maxMinLevel; + /** * The maximal amount of levels of the tree. */ private int maxNumLevels = CoverTree.DEFAULT_MAX_NUM_LEVELS; + /** * The current minimal level of the tree. */ @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized") private int minLevel; + /** * The minimum number of levels of the tree. */ @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized") private int minNumLevels = CoverTree.DEFAULT_MIN_NUM_LEVELS; + /** * The root node. */