1 | from abc import ABC
|
---|
2 | from typing import List
|
---|
3 |
|
---|
4 | from pyson.JsonSubTypes import JsonSubTypes
|
---|
5 | from pyson.JsonTypeInfo import Id, As
|
---|
6 | from pyson.JsonTypeInfo import JsonTypeInfo
|
---|
7 |
|
---|
8 | from geniusweb.protocol.NegoSettings import NegoSettings
|
---|
9 | from geniusweb.protocol.session.SessionResult import SessionResult
|
---|
10 |
|
---|
11 |
|
---|
12 | @JsonSubTypes([ "geniusweb.protocol.session.saop.SAOPState.SAOPState"])
|
---|
13 | @JsonTypeInfo(use=Id.NAME, include=As.WRAPPER_OBJECT)
|
---|
14 | class NegoState (ABC):
|
---|
15 | '''
|
---|
16 | The current state of the session/tournament. Must be (de)serializabl;e so
|
---|
17 | that it can be restarted if a crash occurs. Notice that this restart
|
---|
18 | functionality is not yet available.
|
---|
19 | <p>
|
---|
20 | In general the state contains all the information to control the flow of the
|
---|
21 | negotiation: who did what, are we finished, etc. This object may be stored to
|
---|
22 | record the final result as well
|
---|
23 | '''
|
---|
24 |
|
---|
25 | def getSettings(self) -> NegoSettings:
|
---|
26 | '''
|
---|
27 | @return the settings that were used to create this Nego
|
---|
28 | '''
|
---|
29 |
|
---|
30 | def isFinal(self, currentTimeMsLint) -> bool:
|
---|
31 | '''
|
---|
32 | @param currentTimeMs the current time in ms since 1970, see
|
---|
33 | {@link System#currentTimeMillis()}
|
---|
34 | @return true iff this is the final state. A state can be final because
|
---|
35 | the protocol decided so, eg a deal was achieved, the deadline was
|
---|
36 | reached or someone made a protocol error. If true, no more state
|
---|
37 | changes can occur, including no more protocol errors.
|
---|
38 | '''
|
---|
39 |
|
---|
40 | def getResults(self) -> List[SessionResult]:
|
---|
41 | '''
|
---|
42 | @return List of the{@link SessionResult}s. Each SessionResult is a short
|
---|
43 | report of the final outcome. Assumes {@link #isFinal(long)}.
|
---|
44 | result may be undefined if not.
|
---|
45 | '''
|
---|
46 |
|
---|