source: geniuswebcore/geniusweb/issuevalue/DiscreteValue.py@ 81

Last change on this file since 81 was 81, checked in by Bart Vastenhouw, 3 years ago

Added python timedependent parties (conceder, hardliner, etc)

File size: 586 bytes
Line 
1from pyson.JsonValue import JsonValue
2
3from geniusweb.issuevalue.Value import Value
4
5
6class DiscreteValue (Value) :
7 '''
8 A value for a discrete issue. Constructor guarantees this is non-null and
9 non-empty. immutable.
10 '''
11
12 def __init__(self, value:str):
13 if value == None or value=="":
14 raise ValueError("value must be non-null and non-empty")
15 super().__init__(value)
16
17 def __hash__(self):
18 return hash(self._value)
19
20 def __repr__(self):
21 return '"'+str(self._value)+'"'
22
23 def __eq__(self, other):
24 return isinstance(other, self.__class__) and self._value == other._value
Note: See TracBrowser for help on using the repository browser.