2121from copy import copy
2222
2323
24- class Value (object ):
25- """The actual point value for a Point.
26- Currently there are four types of Value:
27- <ul>
28- <li>double
29- <li>long
30- <li>Summary
31- <li>Distribution (TODO(mayurkale): add Distribution class)
32- </ul>
33- Each Point contains exactly one of the four Value types.
34- """
35-
36- def __init__ (self , value ):
37- self ._value = value
38-
39- @staticmethod
40- def double_value (value ):
41- """Returns a double Value
42-
43- :type value: float
44- :param value: value in double
45- """
46- return ValueDouble (value )
47-
48- @staticmethod
49- def long_value (value ):
50- """Returns a long Value
51-
52- :type value: long
53- :param value: value in long
54- """
55- return ValueLong (value )
56-
57- @staticmethod
58- def summary_value (value ):
59- """Returns a summary Value
60-
61- :type value: Summary
62- :param value: value in Summary
63- """
64- return ValueSummary (value )
65-
66- @property
67- def value (self ):
68- """Returns the value."""
69- return self ._value
70-
71-
72- class ValueDouble (Value ):
24+ class ValueDouble (object ):
7325 """A 64-bit double-precision floating-point number.
7426
7527 :type value: float
7628 :param value: the value in float.
7729 """
7830
7931 def __init__ (self , value ):
80- super ( ValueDouble , self ). __init__ ( value )
32+ self . _value = value
8133
8234 def __repr__ (self ):
8335 return ("{}({})"
@@ -86,16 +38,20 @@ def __repr__(self):
8638 self .value ,
8739 ))
8840
41+ @property
42+ def value (self ):
43+ return self ._value
44+
8945
90- class ValueLong (Value ):
46+ class ValueLong (object ):
9147 """A 64-bit integer.
9248
9349 :type value: long
9450 :param value: the value in long.
9551 """
9652
9753 def __init__ (self , value ):
98- super ( ValueLong , self ). __init__ ( value )
54+ self . _value = value
9955
10056 def __repr__ (self ):
10157 return ("{}({})"
@@ -104,16 +60,20 @@ def __repr__(self):
10460 self .value ,
10561 ))
10662
63+ @property
64+ def value (self ):
65+ return self ._value
66+
10767
108- class ValueSummary (Value ):
68+ class ValueSummary (object ):
10969 """Represents a snapshot values calculated over an arbitrary time window.
11070
11171 :type value: summary
11272 :param value: the value in summary.
11373 """
11474
11575 def __init__ (self , value ):
116- super ( ValueSummary , self ). __init__ ( value )
76+ self . _value = value
11777
11878 def __repr__ (self ):
11979 return ("{}({})"
@@ -122,6 +82,10 @@ def __repr__(self):
12282 self .value ,
12383 ))
12484
85+ @property
86+ def value (self ):
87+ return self ._value
88+
12589
12690class Exemplar (object ):
12791 """An example point to annotate a given value in a bucket.
@@ -227,7 +191,7 @@ def type_(self):
227191 return self ._type
228192
229193
230- class ValueDistribution (Value ):
194+ class ValueDistribution (object ):
231195 """Summary statistics for a population of values.
232196
233197 Distribution contains summary statistics for a population of values. It
0 commit comments