All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Alachisoft.NCache.Common.DataStructures.RedBlackNode Maven / Gradle / Ivy

There is a newer version: 5.3.3
Show newest version
package Alachisoft.NCache.Common.DataStructures;

/**
 * The RedBlackNode class encapsulates a node in the tree
 */
public class RedBlackNode {
    /**
     * Tree node color.
     */
    public static final int RED = 0;
    /**
     * Tree node color.
     */
    public static final int BLACK = 1;

    /**
     * key provided by the calling class.
     */
    private java.lang.Comparable _key;

    /**
     * the data or value associated with the key.
     */
    private java.util.HashMap _value;

    /**
     * color - used to balance the tree.
     */
    private int _color;

    /**
     * Left node.
     */
    private RedBlackNode _leftNode;

    /**
     * Right node.
     */
    private RedBlackNode _rightNode;

    /**
     * Parent node.
     */
    private RedBlackNode _parentNode;
    private RedBlackNodeReference _rbReference;


    /**
     * Default constructor.
     */
    public RedBlackNode() {
        setColor(RED);
        setData(new java.util.HashMap());
        _rbReference = new RedBlackNodeReference(this);
    }

    /**
     * Key
     */
    public final java.lang.Comparable getKey() {
        return _key;
    }

    public final void setKey(java.lang.Comparable value) {
        _key = value;
    }


    /**
     * Data
     */
    public final java.util.HashMap getData() {
        return _value;
    }

    public final void setData(java.util.HashMap value) {
        _value = value;
    }

    /**
     * Color
     */
    public final int getColor() {
        return _color;
    }

    public final void setColor(int value) {
        _color = value;
    }

    /**
     * Left
     */
    public final RedBlackNode getLeft() {
        return _leftNode;
    }

    public final void setLeft(RedBlackNode value) {
        _leftNode = value;
    }

    /**
     * Right
     */
    public final RedBlackNode getRight() {
        return _rightNode;
    }

    public final void setRight(RedBlackNode value) {
        _rightNode = value;
    }

    /**
     * Parent node
     */
    public final RedBlackNode getParent() {
        return _parentNode;
    }

    public final void setParent(RedBlackNode value) {
        _parentNode = value;
    }

    public final RedBlackNodeReference getRBNodeReference() {
        return _rbReference;
    }

    public final void setRBNodeReference(RedBlackNodeReference value) {
        _rbReference = value;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy