@Test public void testRemoveChildNode(){ LabelNode node = new LabelNodeImpl(LEVEL_1_NODE_1); labelNode.addChildNode(node); Assert.assertTrue(labelNode.hasChildren()); Assert.assertTrue(labelNode.removeChildNode(node)); Assert.assertFalse(labelNode.hasChildren()); Assert.assertFalse(labelNode.removeChildNode(node)); }
public boolean removeChildNode(LabelNode node) { if (node == null) { throw new ArgumentNullException("node"); } if (childrenNodes.contains(node)) { for (LabelNode item : childrenNodes) { if (item.equals(node)) { ((LabelNodeImpl) item).setParent(null); break; } } } return childrenNodes.remove(node); }
LabelNodeImpl implements LabelNode, Serializable { public boolean removeChildNode(LabelNode node) { if (node == null) { throw new ArgumentNullException("node"); } if (childrenNodes.contains(node)) { for (LabelNode item : childrenNodes) { if (item.equals(node)) { ((LabelNodeImpl) item).setParent(null); break; } } } return childrenNodes.remove(node); } }
LabelNodeImpl implements LabelNode, Serializable { public boolean removeChildNode(LabelNode node) { if (node == null) { throw new ArgumentNullException("node"); } if (childrenNodes.contains(node)) { for (LabelNode item : childrenNodes) { if (item.equals(node)) { ((LabelNodeImpl) item).setParent(null); break; } } } return childrenNodes.remove(node); } LabelNodeImpl(String name); @SuppressWarnings("unused") private  LabelNodeImpl(); }
LabelNodeImpl implements LabelNode, Serializable { public boolean removeChildNode(LabelNode node) { if (node == null) { throw new ArgumentNullException("node"); } if (childrenNodes.contains(node)) { for (LabelNode item : childrenNodes) { if (item.equals(node)) { ((LabelNodeImpl) item).setParent(null); break; } } } return childrenNodes.remove(node); } LabelNodeImpl(String name); @SuppressWarnings("unused") private  LabelNodeImpl(); boolean addChildNode(LabelNode node); boolean removeChildNode(LabelNode node); Set<String> getChildrenLabels(); Set<String> getDescendantLabels(); Set<LabelNode> getChildren(); String getName(); LabelNode getParent(); boolean hasChildren(); boolean hasParent(); @Override int hashCode(); @Override boolean equals(Object obj); }
LabelNodeImpl implements LabelNode, Serializable { public boolean removeChildNode(LabelNode node) { if (node == null) { throw new ArgumentNullException("node"); } if (childrenNodes.contains(node)) { for (LabelNode item : childrenNodes) { if (item.equals(node)) { ((LabelNodeImpl) item).setParent(null); break; } } } return childrenNodes.remove(node); } LabelNodeImpl(String name); @SuppressWarnings("unused") private  LabelNodeImpl(); boolean addChildNode(LabelNode node); boolean removeChildNode(LabelNode node); Set<String> getChildrenLabels(); Set<String> getDescendantLabels(); Set<LabelNode> getChildren(); String getName(); LabelNode getParent(); boolean hasChildren(); boolean hasParent(); @Override int hashCode(); @Override boolean equals(Object obj);  }