source: geniuswebcore/geniusweb/issuevalue/NumberValueSet.py@ 100

Last change on this file since 100 was 100, checked in by ruud, 20 months ago

python installs also wheel to avoid error messages

File size: 1.0 KB
Line 
1from decimal import Decimal
2
3from tudelft.utilities.immutablelist.Range import Range
4
5from geniusweb.issuevalue.NumberValue import NumberValue
6from geniusweb.issuevalue.ValueSet import ValueSet
7
8
9class NumberValueSet ( ValueSet ):
10 '''
11 number range from low to high with given step size
12 '''
13 def __init__(self, range:Range ):
14 if not isinstance(range, Range):
15 raise ValueError("range must be type Range but got "+repr(range))
16 self._range = range;
17
18 def getRange(self)->Range :
19 '''
20 @return the range defining this NumberValueSet.
21 '''
22 return self._range
23
24 def get(self, index:int) -> NumberValue :
25 return NumberValue(self._range.get(index))
26
27 def size(self) -> int:
28 return self._range.size()
29
30 def __repr__(self) -> str :
31 return "NumberValueSet[" + str(self._range.getLow()) + "," +\
32 str(self._range.getHigh()) + "," + str(self._range.getStep()) + "]"
33
34 def __eq__(self, other):
35 return isinstance(other, self.__class__) and \
36 self._range == other._range
37
38 def __hash__(self):
39 return hash(self._range)
40
Note: See TracBrowser for help on using the repository browser.