source: voting/src/main/java/geniusweb/voting/VotingEvaluator.java@ 52

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

Fixed small issues in domaineditor.

File size: 2.2 KB
Line 
1package geniusweb.voting;
2
3import com.fasterxml.jackson.annotation.JsonAutoDetect;
4import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
5import com.fasterxml.jackson.annotation.JsonSubTypes;
6import com.fasterxml.jackson.annotation.JsonTypeInfo;
7import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
8
9import geniusweb.inform.Agreements;
10import geniusweb.voting.votingevaluators.LargestAgreement;
11import geniusweb.voting.votingevaluators.LargestAgreementsLoop;
12
13/**
14 * Evaluates the {@link CollectedVotes}, determining the agreements and if the
15 * negotiation should continue.
16 *
17 * Implementations should be immutable and not serialize internal variables (eg
18 * @JsonIgnore them).
19 */
20@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE)
21@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = As.WRAPPER_OBJECT)
22@JsonSubTypes({ @JsonSubTypes.Type(value = LargestAgreementsLoop.class),
23 @JsonSubTypes.Type(value = LargestAgreement.class) })
24public interface VotingEvaluator {
25 /**
26 * This function is the effective constructor. This mechanism serves several
27 * purposes:
28 * <ul>
29 * <li>It defines the constructor at interface level, so that we can ensure
30 * it's available and can call it given an instance,
31 * <li>We can use a (typically blank) instance of this to make more
32 * instances
33 * <li>You can cache intermediate results in the object for caching
34 * </ul>
35 *
36 * @param votes the Votes made by parties in the round to be evaluated.. All
37 * active parties in the negotiation must be available, even if
38 * they did not vote, to ensure that {@link #isFinished()} can
39 * work properly.
40 *
41 * @return new VotingEvaluation object containing the given votes.
42 */
43 VotingEvaluator create(CollectedVotes votes);
44
45 /**
46 *
47 * @return the agreements that is contained in the current available votes.
48 * The exact procedure varies with the implementation.
49 */
50 Agreements getAgreements();
51
52 /**
53 *
54 * @return true iff the negotiation is finished after taking the agreement
55 * returned by {@link #getAgreements()}
56 */
57 boolean isFinished();
58}
Note: See TracBrowser for help on using the repository browser.