source: protocol/src/main/java/geniusweb/protocol/NegoState.java

Last change on this file was 52, checked in by ruud, 13 months ago

Fixed small issues in domaineditor.

File size: 2.0 KB
RevLine 
[52]1package geniusweb.protocol;
2
3import java.util.List;
4
5import com.fasterxml.jackson.annotation.JsonAutoDetect;
6import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
7import com.fasterxml.jackson.annotation.JsonSubTypes;
8import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
9import com.fasterxml.jackson.annotation.JsonTypeInfo;
10
11import geniusweb.protocol.session.SessionResult;
12import geniusweb.protocol.session.SessionState;
13import geniusweb.protocol.tournament.TournamentState;
14
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@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE)
25@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
26@JsonSubTypes({ @Type(value = SessionState.class),
27 @Type(value = TournamentState.class) })
28public interface NegoState {
29
30 /**
31 * @return the settings that were used to create this Nego
32 */
33 NegoSettings getSettings();
34
35 /**
36 * @param currentTimeMs the current time in ms since 1970, see
37 * {@link System#currentTimeMillis()}
38 * @return true iff this is the final state. A state can be final because
39 * the protocol decided so, eg a deal was achieved, the deadline was
40 * reached or someone made a protocol error. If true, no more state
41 * changes can occur, including no more protocol errors.
42 */
43 boolean isFinal(long currentTimeMs);
44
45 /**
46 *
47 * @return List of the{@link SessionResult}s. Each SessionResult is a short
48 * report of the final outcome. Assumes {@link #isFinal(long)}.
49 * result may be undefined if not.
50 */
51 List<SessionResult> getResults();
52}
Note: See TracBrowser for help on using the repository browser.