1 | package geniusweb.profile.utilityspace;
|
---|
2 |
|
---|
3 | import java.math.BigDecimal;
|
---|
4 |
|
---|
5 | import org.eclipse.jdt.annotation.NonNull;
|
---|
6 |
|
---|
7 | import com.fasterxml.jackson.annotation.JsonSubTypes;
|
---|
8 | import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
---|
9 | import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
---|
10 |
|
---|
11 | import geniusweb.issuevalue.Value;
|
---|
12 | import geniusweb.issuevalue.ValueSet;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Provides a mechanism to map {@link Value}s into a utility (value in range
|
---|
16 | * [0,1]).
|
---|
17 | */
|
---|
18 | @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
|
---|
19 | @JsonSubTypes({ @Type(value = DiscreteValueSetUtilities.class),
|
---|
20 | @Type(value = NumberValueSetUtilities.class) })
|
---|
21 | public interface ValueSetUtilities {
|
---|
22 | /**
|
---|
23 | *
|
---|
24 | * @param value the {@link Value} to get the utility for
|
---|
25 | * @return the utility of the given value. MUST be in [0,1]. Should return 0
|
---|
26 | * if the value is unknown.
|
---|
27 | */
|
---|
28 | @NonNull
|
---|
29 | BigDecimal getUtility(@NonNull Value value);
|
---|
30 |
|
---|
31 | /**
|
---|
32 | *
|
---|
33 | * @param valueset the valueset that is supposed match with this
|
---|
34 | * @return null if the ValueSetUtilities fits the given set of values , that
|
---|
35 | * means it can give utilities for all possible values in valueset.
|
---|
36 | * Or a string containing an explanation why not.
|
---|
37 | */
|
---|
38 | String isFitting(@NonNull ValueSet valueset);
|
---|
39 |
|
---|
40 | }
|
---|