[100] | 1 | import json
|
---|
| 2 | import logging
|
---|
| 3 | import sys
|
---|
| 4 | from typing import cast, Optional, List
|
---|
| 5 |
|
---|
| 6 | from tudelft_utilities_logging.Reporter import Reporter
|
---|
| 7 |
|
---|
| 8 | from geniusweb.actions.EndNegotiation import EndNegotiation
|
---|
| 9 | from geniusweb.actions.PartyId import PartyId
|
---|
| 10 | from geniusweb.inform.Inform import Inform
|
---|
| 11 | from geniusweb.issuevalue.Bid import Bid
|
---|
| 12 | from geniusweb.party.Capabilities import Capabilities
|
---|
| 13 | from geniusweb.party.DefaultParty import DefaultParty
|
---|
| 14 |
|
---|
| 15 |
|
---|
| 16 | class EmptyParty (DefaultParty):
|
---|
| 17 | """
|
---|
| 18 | A empty party just for testing PartyStdio.
|
---|
| 19 | """
|
---|
| 20 | def __init__(self, reporter:Reporter):
|
---|
| 21 | super().__init__(reporter)
|
---|
| 22 | self.getReporter().log(logging.INFO,"party is initialized")
|
---|
| 23 | self._lastReceivedBid:Optional[Bid] = None
|
---|
| 24 | self.received:List[Inform]=[]
|
---|
| 25 |
|
---|
| 26 | # Override
|
---|
| 27 | def notifyChange(self, info: Inform):
|
---|
| 28 | self.getReporter().log(logging.INFO,"received info:"+str(info))
|
---|
| 29 | self.received.append(info)
|
---|
| 30 | self.send(EndNegotiation(PartyId('someone')))
|
---|
| 31 |
|
---|
| 32 | # Override
|
---|
| 33 | def getCapabilities(self): # -> Capabilities
|
---|
| 34 | return Capabilities( set([ "SAOP"]), set(['geniusweb.profile.utilityspace.LinearAdditive']))
|
---|
| 35 |
|
---|
| 36 | # Override
|
---|
| 37 | def getDescription(self):
|
---|
| 38 | return "test description"
|
---|
| 39 |
|
---|
| 40 | # Override
|
---|
| 41 | def terminate(self):
|
---|
| 42 | super().terminate()
|
---|
| 43 |
|
---|