[100] | 1 | from typing import List
|
---|
| 2 |
|
---|
| 3 | from tudelft_utilities_logging.Reporter import Reporter
|
---|
| 4 |
|
---|
| 5 | from geniusweb.protocol.NegoSettings import NegoSettings
|
---|
| 6 | from geniusweb.protocol.session.SessionProtocol import SessionProtocol
|
---|
| 7 | from geniusweb.protocol.session.TeamInfo import TeamInfo
|
---|
| 8 | from geniusweb.references.PartyWithProfile import PartyWithProfile
|
---|
| 9 |
|
---|
| 10 |
|
---|
| 11 | class SessionSettings(NegoSettings):
|
---|
| 12 | '''
|
---|
| 13 | interface for settings for session protocols. Immutable.
|
---|
| 14 | '''
|
---|
| 15 | def getTeams(self)->List[TeamInfo] :
|
---|
| 16 | '''
|
---|
| 17 | Get the {@link TeamInfo}s.
|
---|
| 18 |
|
---|
| 19 | @return list of {@link PartyWithProfile} items.
|
---|
| 20 | '''
|
---|
| 21 |
|
---|
| 22 | def getTeamSize(self) -> int:
|
---|
| 23 | '''
|
---|
| 24 | @return the size of each {@link TeamInfo}. Usually 1 (SAOP etc) or
|
---|
| 25 | sometimes 2 (SHAOP). Used eg by tournament runner to determine
|
---|
| 26 | proper team construction.
|
---|
| 27 | '''
|
---|
| 28 |
|
---|
| 29 | def With(self, partyprofteam:TeamInfo ) -> "SessionSettings" :
|
---|
| 30 | '''
|
---|
| 31 | Allows modification of SessionSettings to include a party. This is needed
|
---|
| 32 | for tournament auto-configuration of sessions.
|
---|
| 33 |
|
---|
| 34 | @param partyprofteam the {@link TeamInfo} to be added
|
---|
| 35 | @return new modified SessionSettings object
|
---|
| 36 | '''
|
---|
| 37 |
|
---|
| 38 | def getAllParties(self) -> List[PartyWithProfile]:
|
---|
| 39 | '''
|
---|
| 40 | @return all parties from all teams, as a flattened ordered list. The
|
---|
| 41 | order : start with all parties from team 1, then all from team 2,
|
---|
| 42 | etc. The specific order of the parties from a team depends on the
|
---|
| 43 | protocol.
|
---|
| 44 | '''
|
---|
| 45 |
|
---|
| 46 | def getProtocol(self, logger:Reporter)->SessionProtocol :
|
---|
| 47 | '''
|
---|
| 48 | @param logger the logger where the protocol can log events to.
|
---|
| 49 | @return the an initialized and ready to use {@link SessionProtocol} that
|
---|
| 50 | can handle this Negotiation.
|
---|
| 51 | '''
|
---|