package geniusweb.profile.utilityspace; import java.math.BigDecimal; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes.Type; import com.fasterxml.jackson.annotation.JsonTypeInfo; import geniusweb.issuevalue.Value; import geniusweb.issuevalue.ValueSet; /** * Provides a mechanism to map {@link Value}s into a utility (value in range * [0,1]). */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT) @JsonSubTypes({ @Type(value = DiscreteValueSetUtilities.class), @Type(value = NumberValueSetUtilities.class) }) public interface ValueSetUtilities { /** * * @param value the {@link Value} to get the utility for * @return the utility of the given value. MUST be in [0,1]. Should return 0 * if the value is unknown. */ BigDecimal getUtility(Value value); /** * * @param valueset the valueset that is supposed match with this * @return null if the ValueSetUtilities fits the given set of values , that * means it can give utilities for all possible values in valueset. * Or a string containing an explanation why not. */ String isFitting(ValueSet valueset); }