source: geniuswebcore/geniusweb/events/ActionEvent.py@ 93

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

Refactor to help reusing partiesserver.

File size: 872 bytes
RevLine 
[90]1from geniusweb.actions.Action import Action
2from geniusweb.events.AbstractEvent import AbstractEvent
3class ActionEvent ( AbstractEvent):
4 '''
5 Event where a party did an {@link Action}
6 '''
7
8 def __init__(self, action:Action , time:int) :
9 '''
10 @param action the {@link Action} that was done
11 @param time the current time to use. in millisec since 1970.
12 '''
13 super().__init__(time)
14 if not action:
15 raise ValueError("Action must not be null")
16 self._action = action
17
18 def getAction(self)->Action :
19 '''
20 @return action done by some party in the system.
21 '''
22 return self._action
23
24
25 def __repr__(self):
26 return type(self).__name__ + "[" + str(self.getTime())\
27 + "," + str(self._action) + "]"
28
29 def __hash__(self):
30 return hash((self._action, self._time))
31
32 def __eq__(self, other):
33 return super().__eq__(other) and \
34 self._action==other._action
Note: See TracBrowser for help on using the repository browser.