rename PathTree to StringPathTree

browse-v2
Zlatin Balevsky 2022-08-27 21:27:12 +01:00
parent fb60085d93
commit f045a17bf1
No known key found for this signature in database
GPG Key ID: A72832072D525E41
4 changed files with 8 additions and 13 deletions

View File

@ -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<FileCollectionItem> files = new LinkedHashSet<>()
final PathTree tree
final StringPathTree tree
final List<SearchHit> hits = new ArrayList<>()
@ -38,7 +36,7 @@ class FileCollection {
this.files = files
name = files.first().pathElements.first()
tree = new PathTree<FileCollectionItem>(name)
tree = new StringPathTree<FileCollectionItem>(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<FileCollectionItem>(name)
tree = new StringPathTree<FileCollectionItem>(name)
for(FileCollectionItem item : files) {
tree.add(item.pathElements, item)
}

View File

@ -1,11 +1,12 @@
package com.muwire.core.collections
class PathTree<T> {
class StringPathTree<T> {
private final Map<PathNode.Key, PathNode> 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)

View File

@ -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)

View File

@ -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()