# Path: fuzzy/set/Function.py
# class Function(Set):
#     """Base class for any fuzzy set defined by a function (not a polygon)."""
# 
#     # if converted if linear polygon form use
#     # at least x pieces
#     _resolution = 25 #: segments when converting into a polygon


from fuzzy.set.Function import Function
        """
        super(SFunction, self).__init__()
        self.a = a
        self.delta = delta

    def __call__(self,x):
        """Return membership of x in this fuzzy set.
           This method makes the set work like a function.
           
           @param x: value for which the membership is to calculate
           @type x: float
           @return: membership
           @rtype: float
           """
        a = self.a
        d = self.delta
        if x <= a-d:
            return 0.0
        if x <= a:
            t = (x-a+d)/(2.0*d)
            return 2.0*t*t
        if x <= a+d:
            t = (a-x+d)/(2.0*d)
            return 1.0-2.0*t*t
        return 1.0

    def getCOG(self):
        """Return center of gravity."""
        raise Exception("COG of SFunction uncalculable")


# Path: fuzzy/set/Function.py
# class Function(Set):
#     """Base class for any fuzzy set defined by a function (not a polygon)."""
# 
#     # if converted if linear polygon form use
#     # at least x pieces
#     _resolution = 25 #: segments when converting into a polygon


# Path: fuzzy/set/SFunction.py
from fuzzy.set.Function import Function

        """
        super(SFunction, self).__init__()
        self.a = a
        self.delta = delta

    def __call__(self,x):
        """Return membership of x in this fuzzy set.
           This method makes the set work like a function.
           
           @param x: value for which the membership is to calculate
           @type x: float
           @return: membership
           @rtype: float
           """
        a = self.a
        d = self.delta
        if x <= a-d:
            return 0.0
        if x <= a:
            t = (x-a+d)/(2.0*d)
            return 2.0*t*t
        if x <= a+d:
            t = (a-x+d)/(2.0*d)
            return 1.0-2.0*t*t
        return 1.0

    def getCOG(self):
        """Return center of gravity."""
        raise Exception("COG of SFunction uncalculable")


    class __IntervalGenerator(Function.IntervalGenerator):