mirror of https://github.com/zlatinb/muwire
rename PathTree to StringPathTree
parent
fb60085d93
commit
f045a17bf1
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue