org.sirix.index.redblacktree.ImmutableRBNodeImpl Maven / Gradle / Ivy
package org.sirix.index.redblacktree;
import org.sirix.index.redblacktree.interfaces.ImmutableRBNode;
import org.sirix.node.AbstractForwardingNode;
import org.sirix.node.NodeKind;
import org.sirix.node.delegates.NodeDelegate;
/**
* Immutable RBNode.
*
* @author Johannes Lichtenberger
*
* @param key which has to be comparable (implement Comparable interface)
* @param value
*/
public final class ImmutableRBNodeImpl, V> extends AbstractForwardingNode
implements ImmutableRBNode {
/** {@link RBNode} to wrap. */
private final RBNode node;
/**
* Constructor.
*
* @param node {@link RBNode} to wrap.
*/
public ImmutableRBNodeImpl(final RBNode node) {
assert node != null;
this.node = node;
}
@Override
public NodeKind getKind() {
return node.getKind();
}
@Override
public K getKey() {
return node.getKey();
}
@Override
public V getValue() {
return node.getValue();
}
@Override
public boolean isChanged() {
return node.isChanged();
}
@Override
public boolean hasLeftChild() {
return node.hasLeftChild();
}
@Override
public boolean hasRightChild() {
return node.hasRightChild();
}
@Override
public long getLeftChildKey() {
return node.getLeftChildKey();
}
@Override
public long getRightChildKey() {
return node.getRightChildKey();
}
@Override
protected NodeDelegate delegate() {
return node.delegate();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy