########################################
# The contents of this file are subject to the MLX PUBLIC LICENSE version
# 1.0 (the "License"); you may not use this file except in
# compliance with the License.
# 
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
# the License for the specific language governing rights and limitations
# under the License.
# 
# The Original Source Code is "compClust", released 2003 September 03.
# 
# The Original Source Code was developed by the California Institute of
# Technology (Caltech).  Portions created by Caltech are Copyright (C)
# 2002-2003 California Institute of Technology. All Rights Reserved.
########################################
#
#       Author: Lucas J. Scharenbroich
# 
# Original Implementation:  July 10 by Lucas Scharenbroich
#
##########################################################################

"""
A generic Node class for implementing graphs, trees, etc.

In the case of a SimpleNode, the data is the key, a regular
Node has separate key/data fields.
"""

class SimpleNode:
    def __init__(self, key):
        self.__key = key

    def key(self):
        return self.__key
    
    def value(self):
        return self.__key

class Node:
    def __init__(self, key, data = None):
        self.__data = data
        self.__key  = key

    def key(self):
        return self.__key

    def value(self):
        return self.__data
