[43] | 1 | package geniusweb.protocol;
|
---|
| 2 |
|
---|
| 3 | import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
---|
| 4 | import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
|
---|
| 5 | import com.fasterxml.jackson.annotation.JsonSubTypes;
|
---|
| 6 | import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
---|
| 7 | import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
---|
| 8 |
|
---|
| 9 | import geniusweb.protocol.session.SessionState;
|
---|
| 10 | import geniusweb.protocol.tournament.TournamentState;
|
---|
| 11 |
|
---|
| 12 | /**
|
---|
| 13 | * The current state of the session/tournament. Must be (de)serializabl;e so
|
---|
| 14 | * that it can be restarted if a crash occurs. Notice that this restart
|
---|
| 15 | * functionality is not yet available.
|
---|
| 16 | * <p>
|
---|
| 17 | * In general the state contains all the information to control the flow of the
|
---|
| 18 | * negotiation: who did what, are we finished, etc. This object may be stored to
|
---|
| 19 | * record the final result as well
|
---|
| 20 | */
|
---|
| 21 | @JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE)
|
---|
| 22 | @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
|
---|
| 23 | @JsonSubTypes({ @Type(value = SessionState.class),
|
---|
| 24 | @Type(value = TournamentState.class) })
|
---|
| 25 | public interface NegoState {
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * @return the settings that were used to create this Nego
|
---|
| 29 | */
|
---|
| 30 | NegoSettings getSettings();
|
---|
| 31 |
|
---|
| 32 | /**
|
---|
| 33 | * @param currentTimeMs the current time in ms since 1970, see
|
---|
| 34 | * {@link System#currentTimeMillis()}
|
---|
| 35 | * @return true iff this is the final state. A state can be final because
|
---|
| 36 | * the protocol decided so, eg a deal was achieved, the deadline was
|
---|
| 37 | * reached or someone made a protocol error. If true, no more state
|
---|
| 38 | * changes can occur, including no more protocol errors.
|
---|
| 39 | */
|
---|
| 40 | boolean isFinal(long currentTimeMs);
|
---|
| 41 |
|
---|
| 42 | }
|
---|