from abc import ABC from pyson.JsonSubTypes import JsonSubTypes from pyson.JsonTypeInfo import Id, As from pyson.JsonTypeInfo import JsonTypeInfo from geniusweb.protocol.NegoSettings import NegoSettings @JsonSubTypes([ "geniusweb.protocol.session.saop.SAOPState.SAOPState"]) @JsonTypeInfo(use=Id.NAME, include=As.WRAPPER_OBJECT) class NegoState (ABC): ''' The current state of the session/tournament. Must be (de)serializabl;e so that it can be restarted if a crash occurs. Notice that this restart functionality is not yet available.

In general the state contains all the information to control the flow of the negotiation: who did what, are we finished, etc. This object may be stored to record the final result as well ''' def getSettings(self) -> NegoSettings: ''' @return the settings that were used to create this Nego ''' def isFinal(self, currentTimeMsLint)-> bool : ''' @param currentTimeMs the current time in ms since 1970, see {@link System#currentTimeMillis()} @return true iff this is the final state. A state can be final because the protocol decided so, eg a deal was achieved, the deadline was reached or someone made a protocol error. If true, no more state changes can occur, including no more protocol errors. '''