package ch.zhaw.ads;

public class Node<E> {
    public E value;
    public Node<E> previousNode;
    public Node<E> nextNode;

    public Node(E object) {
        this(object, null, null);
    }

    public Node(E object, Node<E> previousNode, Node<E> nextNode) {
        this.value = object;
        this.previousNode = previousNode;
        this.nextNode = nextNode;
    }

    public boolean hasNextNode() {
        return this.nextNode != null;
    }

    public boolean hasPreviousNode() {
        return this.previousNode != null;
    }

    public boolean equals(Node<E> node) {
        if (node == null) {
            return false;
        }

        return value.equals(node.value);
    }

    public Node<E> clone(){
        return new Node<E>(value, previousNode, nextNode);
    }
}
