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

Last change on this file since 26 was 26, checked in by bart, 4 years ago

Voting requests now contain Offers. Fixed windows whitespace issue. Partiesserver now supports up to 8 parties simultaneously.

File size: 2.1 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. All active parties in the
37 * negotiation must be available, even if they did not vote, to
38 * ensure that {@link #isFinished()} can work properly.
39 *
40 * @return new VotingEvaluation object containing the given votes.
41 */
42 VotingEvaluator create(CollectedVotes votes);
43
44 /**
45 *
46 * @return the agreements that is contained in the current available votes.
47 * The exact procedure varies with the implementation.
48 */
49 Agreements getAgreements();
50
51 /**
52 *
53 * @return true iff the negotiation is finished after taking the agreement
54 * returned by {@link #getAgreements()}
55 */
56 boolean isFinished();
57}
Note: See TracBrowser for help on using the repository browser.