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