source: geniuswebcore/geniusweb/references/PartyWithParameters.py@ 78

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

Fix for IssueValue hashcode.

File size: 1.1 KB
Line 
1from __future__ import annotations
2from geniusweb.references.Parameters import Parameters
3from geniusweb.references.PartyRef import PartyRef
4
5class PartyWithParameters:
6 '''
7 Container holding a partyref with parameters
8 '''
9
10 def __init__(self, partyref:PartyRef , parameters:Parameters):
11 self._partyref = partyref
12 self._parameters = parameters
13
14 def getPartyRef(self) -> PartyRef :
15 return self._partyref
16
17 def getParameters(self) ->Parameters :
18 return self._parameters;
19
20
21 def With(self, parameters2:Parameters) ->"PartyWithParameters":
22 '''
23 @param parameters2 the additional parameters
24 @return this party but with the given parameters added to our parameters
25 '''
26 return PartyWithParameters(self._partyref, self._parameters.WithParameters(parameters2));
27
28 def __repr__(self)->str:
29 if self._parameters.isEmpty():
30 return str(self._partyref)
31 return str(self._partyref) + str(self._parameters)
32
33 def __eq__(self, other):
34 return isinstance(other, self.__class__) and \
35 self._partyref==other._partyref and self._parameters==other._parameters
36
37 def __hash__(self):
38 return hash((self._parameters, self._partyref))
Note: See TracBrowser for help on using the repository browser.