/* Copyright (C) 2009  CSE,IIT Bombay  http://www.cse.iitb.ac.in

This file is part of the ConStore open source storage facility for concept-nets.

ConStore is free software and distributed under the 
Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License;
you can copy, distribute and transmit the work
with the work attribution in the manner specified by the author or licensor.
You may not use this work for commercial purposes and may not alter, 
transform, or build upon this work.

Please refer the legal code of the license, available at
http://creativecommons.org/licenses/by-nc-nd/3.0/legalcode

ConStore is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  */

package iitb.con.ds;


/**
 * Node is a key-value pair. It is a generic structure to hold different data type
 * which implements the <tt>Comparable</tt> interface to facilitate the comparison of keys.
 * 
 * @author Prathab K
 */

public class Node<K extends Comparable<K>> implements Comparable<Node<K>>{

    /** Generic key data type */
    public K key;
    
    /** value for the key */
    public int value;
    
    public Node(){}
    
    public Node(K key, int value) {
        this.key = key;
        this.value = value;
    }
    
    public int compareTo(Node<K> node) {
        return this.key.compareTo(node.key);
    }
    
    /*public static Node getNode(byte dataType, Object key, int value) {
        switch(dataType) {
            case DataType.INTEGER:
                Node<Integer> inode = new Node<Integer>((Integer)key,value);
                return inode;
            case DataType.BOOLEAN:
                Node<Boolean> bnode = new Node<Boolean>((Boolean)key,value);
                return bnode;
            case DataType.FLOAT:
                Node<Float> fnode = new Node<Float>((Float)key,value);
                return fnode;
            case DataType.DOUBLE:
                Node<Double> dnode = new Node<Double>((Double)key,value);
                return dnode;
            case DataType.STRING: 
            case DataType.TIME:
                Node<String> snode = new Node<String>((String)key,value);
                return snode;
        }
        return null;
    }*/

}