package abstractions; import java.util.ArrayList; import java.util.List; public abstract class Node> { protected final List> children; protected T value; protected Node parent; public Node(Node parent, T value) { this.value = value; this.parent = parent; this.children = new ArrayList<>(); } public T getValue() { return value; } public void setValue(T value) { this.value = value; } public List> getChildren() { return children; } public Node getParent() { return parent; } public abstract Node addNode(T value); @Override public int hashCode() { return value.hashCode(); } @Override public boolean equals(Object obj) { return super.equals(obj); } public abstract String toString(); }