small reformat

master
Jozef Jankaj 2021-05-29 20:49:47 +02:00
parent 33b9f913dd
commit 5e3301bbfb
5 changed files with 17 additions and 18 deletions

View File

@ -1,12 +1,12 @@
package graph; package abstractions;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public abstract class Node<T extends Comparable<T>> { public abstract class Node<T extends Comparable<T>> {
protected final List<Node<T>> children;
protected T value; protected T value;
protected Node<T> parent; protected Node<T> parent;
protected final List<Node<T>> children;
public Node(Node<T> parent, T value) { public Node(Node<T> parent, T value) {
this.value = value; this.value = value;

View File

@ -1,4 +1,4 @@
package graph; package abstractions;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
@ -28,8 +28,12 @@ public abstract class Tree<T extends Comparable<T>> {
} }
public abstract Node<T> addNode(T value); public abstract Node<T> addNode(T value);
public abstract boolean removeNode(T value); public abstract boolean removeNode(T value);
public abstract boolean removeNode(Node<T> n); public abstract boolean removeNode(Node<T> n);
public abstract Node<T> findNode(T value); public abstract Node<T> findNode(T value);
public abstract String toString(); public abstract String toString();
} }

View File

@ -1,7 +1,7 @@
package binarytree; package binarytree;
import graph.Node; import abstractions.Node;
import graph.Tree; import abstractions.Tree;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -1,6 +1,6 @@
package binarytree; package binarytree;
import graph.Node; import abstractions.Node;
import java.util.Random; import java.util.Random;

View File

@ -1,6 +1,6 @@
import binarytree.BinaryTree; import binarytree.BinaryTree;
import binarytree.BinaryTreeNode; import binarytree.BinaryTreeNode;
import graph.Node; import abstractions.Node;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -36,11 +36,6 @@ public class BinaryTreeTests {
Assert.assertEquals(4, tree.getSize()); Assert.assertEquals(4, tree.getSize());
} }
@Test
public void testAddition3() {
Node<Integer> n1 = new BinaryTreeNode<>(null, 1);
}
@Test @Test
public void testRemoval() { public void testRemoval() {
tree.addNode(1); tree.addNode(1);