# Path: fuzzy/set/Set.py
# class Set(object):
#     """Base class for all types of fuzzy sets."""
# 
#     def __call__(self,x):
#         """Return membership of x in this fuzzy set.
#            This method makes the set work like a function.
#            
#            @param x: value x
#            @type x: float
#            @return: membership for value x
#            @rtype: float
#            """
#         return 0.
# 
#     class IntervalGenerator(object):
#         def nextInterval(self,prev,next):
#             """For conversion of any set to a polygon representation.
#                Return which end value should have the interval started
#                by prev. (next is the current proposal.)
#                The membership function has to be monotonic in this interval.
#                (eg. no minima or maxima)
#                To find left start point prev is None.
#                If no further splitting at right necessary return None."""
#             return next
# 
#     def getIntervalGenerator(self):
#         """Internal helper function to help convert arbitrary fuzzy sets in 
#         fuzzy sets represented by a polygon."""
#         return self.IntervalGenerator()
# 
#     def getCOG(self):
#         """Returns center of gravity.
#            
#            @return: x-value of center of gravity
#            @rtype: float
#            """
#         #raise Exception("abtract class %s has no center of gravity." % self.__class__.__name__)
#         return 0. # XXX
# 
# Path: fuzzy/utils.py
# def prop(func):
#     """Function decorator for defining property attributes
#   
#     The decorated function is expected to return a dictionary
#     containing one or more of the following pairs:
#       - fget - function for getting attribute value
#       - fset - function for setting attribute value
#       - fdel - function for deleting attribute
#     This can be conveniently constructed by the locals() builtin
#     function; see:
#     U{http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/205183}
#     """
#     return property(doc=func.__doc__, **func())


from fuzzy.set.Set import Set
from fuzzy.utils import prop
        import copy
            import copy
               |               \             \
               |                \             \
               *--*              *             *--*
        """
        # quick and dirty implementation
        range_p = range(len(self.__points))
        if where == self.END:
            range_p.reverse()
        for i in range_p:
            if self.__points[i][Polygon.X] == x:
                self.__points.remove(i)
                return
        #raise Exception("Not in points list")

    def clear(self):
        """Reset polygon to zero."""
        del self.__points[:]

    @prop
    def points():
        """points of the polygon.
        @type: list of 2-tuple (x,y)"""
        def fget(self):
            return copy.deepcopy(self.__points)
        return locals()


    def getIntervalGenerator(self):
        return self.__IntervalGenerator(self.__points)


# Path: fuzzy/set/Set.py
# class Set(object):
#     """Base class for all types of fuzzy sets."""
# 
#     def __call__(self,x):
#         """Return membership of x in this fuzzy set.
#            This method makes the set work like a function.
#            
#            @param x: value x
#            @type x: float
#            @return: membership for value x
#            @rtype: float
#            """
#         return 0.
# 
#     class IntervalGenerator(object):
#         def nextInterval(self,prev,next):
#             """For conversion of any set to a polygon representation.
#                Return which end value should have the interval started
#                by prev. (next is the current proposal.)
#                The membership function has to be monotonic in this interval.
#                (eg. no minima or maxima)
#                To find left start point prev is None.
#                If no further splitting at right necessary return None."""
#             return next
# 
#     def getIntervalGenerator(self):
#         """Internal helper function to help convert arbitrary fuzzy sets in 
#         fuzzy sets represented by a polygon."""
#         return self.IntervalGenerator()
# 
#     def getCOG(self):
#         """Returns center of gravity.
#            
#            @return: x-value of center of gravity
#            @rtype: float
#            """
#         #raise Exception("abtract class %s has no center of gravity." % self.__class__.__name__)
#         return 0. # XXX
# 
# Path: fuzzy/utils.py
# def prop(func):
#     """Function decorator for defining property attributes
#   
#     The decorated function is expected to return a dictionary
#     containing one or more of the following pairs:
#       - fget - function for getting attribute value
#       - fset - function for setting attribute value
#       - fdel - function for deleting attribute
#     This can be conveniently constructed by the locals() builtin
#     function; see:
#     U{http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/205183}
#     """
#     return property(doc=func.__doc__, **func())


# Path: fuzzy/set/Polygon.py
from fuzzy.set.Set import Set
from fuzzy.utils import prop
        import copy
            import copy

               |               \             \
               |                \             \
               *--*              *             *--*
        """
        # quick and dirty implementation
        range_p = range(len(self.__points))
        if where == self.END:
            range_p.reverse()
        for i in range_p:
            if self.__points[i][Polygon.X] == x:
                self.__points.remove(i)
                return
        #raise Exception("Not in points list")

    def clear(self):
        """Reset polygon to zero."""
        del self.__points[:]

    @prop
    def points():
        """points of the polygon.
        @type: list of 2-tuple (x,y)"""
        def fget(self):
            return copy.deepcopy(self.__points)
        return locals()


    def getIntervalGenerator(self):
        return self.__IntervalGenerator(self.__points)


    class __IntervalGenerator(Set.IntervalGenerator):