package geniusweb.voting; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import geniusweb.inform.Agreements; import geniusweb.voting.evaluatorwithvalue.LargestAgreementWithValue; /** * Evaluates the {@link CollectedVotes}, determining the agreements and if the * negotiation should continue. * * Implementations should be immutable and not serialize internal variables (eg * @JsonIgnore them). */ @JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = As.WRAPPER_OBJECT) @JsonSubTypes({ @JsonSubTypes.Type(value = LargestAgreementWithValue.class) }) public interface VotingEvaluatorWithValue { /** * This function is the effective constructor. This mechanism serves several * purposes: * * * @param votes the Votes made by parties in the round to be evaluated.. All * active parties in the negotiation must be available, even if * they did not vote, to ensure that {@link #isFinished()} can * work properly. * * @return new VotingEvaluation object containing the given votes. */ VotingEvaluatorWithValue create(CollectedVotesWithValue votes); /** * * @return the agreements that is contained in the current available votes. * The exact procedure varies with the implementation. */ Agreements getAgreements(); /** * * @return true iff the negotiation is finished after taking the agreement * returned by {@link #getAgreements()} */ boolean isFinished(); }