From 29a5ceca827430896bab8952961100d1c9dd88d5 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 4 Sep 2016 22:19:22 +0100 Subject: [PATCH] NodeItem: remove support for dynamic names --- src/main/java/net/kemitix/node/NodeItem.java | 26 -------------------- 1 file changed, 26 deletions(-) diff --git a/src/main/java/net/kemitix/node/NodeItem.java b/src/main/java/net/kemitix/node/NodeItem.java index f9ebf47..12a7cef 100644 --- a/src/main/java/net/kemitix/node/NodeItem.java +++ b/src/main/java/net/kemitix/node/NodeItem.java @@ -8,7 +8,6 @@ import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.Set; -import java.util.function.Function; /** * Represents a tree of nodes. @@ -23,8 +22,6 @@ class NodeItem implements Node { private final Set> children = new HashSet<>(); - private Function, String> nameSupplier; - private Node parent; private String name; @@ -47,7 +44,6 @@ class NodeItem implements Node { */ NodeItem(final T data) { this.data = data; - this.nameSupplier = (n) -> null; } /** @@ -74,24 +70,8 @@ class NodeItem implements Node { setParent(parent); } - private String generateName() { - return getNameSupplier().apply(this); - } - - private Function, String> getNameSupplier() { - if (nameSupplier != null) { - return nameSupplier; - } - // no test for parent as root nodes will always have a default name - // supplier - return ((NodeItem) parent).getNameSupplier(); - } - @Override public String getName() { - if (name == null) { - return generateName(); - } return name; } @@ -380,14 +360,8 @@ class NodeItem implements Node { public void removeParent() { if (parent != null) { Node oldParent = parent; - Function, String> supplier = getNameSupplier(); parent = null; oldParent.removeChild(this); - if (this.nameSupplier == null) { - // this is now a root node, so must provide a default name - // supplier - this.nameSupplier = supplier; - } } }