source: geniuswebcore/geniusweb/events/SessionStarted.py@ 73

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

Fix for IssueValue hashcode.

File size: 885 bytes
Line 
1from typing import List
2from geniusweb.actions.PartyId import PartyId
3from geniusweb.events.ProtocolEvent import ProtocolEvent
4class SessionStarted (ProtocolEvent):
5
6 def __init__(self, sessionNumber:int, parties: List[PartyId], time:int):
7 super().__init__(time)
8 self._sessionNumber = sessionNumber
9 self._parties = parties
10
11 def getParties(self) -> List[PartyId]:
12 return self._parties
13
14 def getSessionNumber(self)->int:
15 return self._sessionNumber
16
17 def __eq__(self, other):
18 return isinstance(other, self.__class__) and \
19 super().__eq__(other) and self._parties==other._parties \
20 and self._sessionNumber==other._sessionNumber
21
22 def __hash__(self):
23 return hash((self._time, self._sessionNumber, tuple(self._parties)))
24
25 def __repr__(self)->str:
26 return "SessionStarted[" + str(self._sessionNumber) + "," +\
27 str(self._parties) + "," + str(self.getTime())+ "]"
28
Note: See TracBrowser for help on using the repository browser.