diff --git a/core/src/main/groovy/com/muwire/core/collections/FileCollection.groovy b/core/src/main/groovy/com/muwire/core/collections/FileCollection.groovy index 0ccb6858..87b8780a 100644 --- a/core/src/main/groovy/com/muwire/core/collections/FileCollection.groovy +++ b/core/src/main/groovy/com/muwire/core/collections/FileCollection.groovy @@ -6,8 +6,6 @@ import com.muwire.core.Constants import com.muwire.core.InfoHash import com.muwire.core.Name import com.muwire.core.Persona -import com.muwire.core.util.DataUtil - import net.i2p.crypto.DSAEngine import net.i2p.data.Signature import net.i2p.data.SigningPrivateKey @@ -26,7 +24,7 @@ class FileCollection { final Set files = new LinkedHashSet<>() - final PathTree tree + final StringPathTree tree final List hits = new ArrayList<>() @@ -38,7 +36,7 @@ class FileCollection { this.files = files name = files.first().pathElements.first() - tree = new PathTree(name) + tree = new StringPathTree(name) for(FileCollectionItem item : files) { tree.add(item.pathElements, item) } @@ -74,7 +72,7 @@ class FileCollection { throw new InvalidCollectionException("invalid signature") name = files.first().pathElements.first() - tree = new PathTree(name) + tree = new StringPathTree(name) for(FileCollectionItem item : files) { tree.add(item.pathElements, item) } diff --git a/core/src/main/groovy/com/muwire/core/collections/PathTree.groovy b/core/src/main/groovy/com/muwire/core/collections/StringPathTree.groovy similarity index 97% rename from core/src/main/groovy/com/muwire/core/collections/PathTree.groovy rename to core/src/main/groovy/com/muwire/core/collections/StringPathTree.groovy index ce37a93d..fc23280d 100644 --- a/core/src/main/groovy/com/muwire/core/collections/PathTree.groovy +++ b/core/src/main/groovy/com/muwire/core/collections/StringPathTree.groovy @@ -1,11 +1,12 @@ package com.muwire.core.collections -class PathTree { +class StringPathTree { private final Map keyToNode = new HashMap<>() final PathNode root - PathTree(String root) { + + StringPathTree(String root) { this.root = new PathNode(root, null) this.root.setUserObject(root) keyToNode.put(this.root.key(), this.root) diff --git a/gui/griffon-app/controllers/com/muwire/gui/CollectionWizardController.groovy b/gui/griffon-app/controllers/com/muwire/gui/CollectionWizardController.groovy index b4391a95..5a8c76aa 100644 --- a/gui/griffon-app/controllers/com/muwire/gui/CollectionWizardController.groovy +++ b/gui/griffon-app/controllers/com/muwire/gui/CollectionWizardController.groovy @@ -10,13 +10,9 @@ import java.awt.Toolkit import java.awt.datatransfer.StringSelection import javax.annotation.Nonnull -import javax.swing.tree.DefaultMutableTreeNode -import javax.swing.tree.MutableTreeNode import com.muwire.core.SharedFile import com.muwire.core.collections.FileCollectionBuilder -import com.muwire.core.collections.PathTree -import com.muwire.core.collections.PathTree.Callback import com.muwire.core.collections.UICollectionCreatedEvent @ArtifactProviderFor(GriffonController) diff --git a/gui/src/main/groovy/com/muwire/gui/TreeUtil.groovy b/gui/src/main/groovy/com/muwire/gui/TreeUtil.groovy index 80a6274a..97b86c70 100644 --- a/gui/src/main/groovy/com/muwire/gui/TreeUtil.groovy +++ b/gui/src/main/groovy/com/muwire/gui/TreeUtil.groovy @@ -6,7 +6,7 @@ import javax.swing.tree.MutableTreeNode import javax.swing.tree.TreeNode import javax.swing.tree.TreePath -import com.muwire.core.collections.PathTree +import com.muwire.core.collections.StringPathTree @@ -15,7 +15,7 @@ class TreeUtil { private TreeUtil() { } - public static void copy(DefaultMutableTreeNode jtreeNode, PathTree.PathNode pathNode) { + public static void copy(DefaultMutableTreeNode jtreeNode, StringPathTree.PathNode pathNode) { jtreeNode.setUserObject(pathNode.getUserObject()) pathNode.children.each { MutableTreeNode newChild = new DefaultMutableTreeNode()