1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 """The Compound class takes values of several input operators and
19 processes them through a given norm."""
20 __revision__ = "$Id: Compound.py,v 1.16 2010-10-29 19:24:41 rliebscher Exp $"
21
22 from fuzzy.operator.Operator import Operator
23
25 """Take values of input operators and process them
26 through the given norm.
27
28 @ivar norm: how to combine inputs. (eg. Min,Max,...)
29 @type norm: L{fuzzy.norm.Norm.Norm}
30 @ivar inputs: list of inputs (subclassed from L{fuzzy.operator.Operator.Operator}).
31 """
32
34 """Constructor.
35
36 @param norm: how to combine inputs. (eg. Min,Max,...)
37 @type norm: L{fuzzy.norm.Norm.Norm}
38 @param inputs: list of inputs (subclassed from L{fuzzy.operator.Operator.Operator}).
39 """
40 super(Compound, self).__init__()
41 self.norm = norm
42 self.inputs = inputs
43
45 """Get current value of input and combine them with help of norm."""
46 return self.norm(*[x() for x in self.inputs])
47
49 """Return representation of instance.
50
51 @return: representation of instance
52 @rtype: string
53 """
54 return "%s.%s(norm=%s, inputs=%s)" % (
55 self.__class__.__module__,
56 self.__class__.__name__,
57 repr(self.norm),
58 repr(self.inputs),
59 )
60