source: java2python/geniuswebtranslator/geniuswebsrc/geniusweb/profile/utilityspace/UtilitySpace.java@ 854

Last change on this file since 854 was 825, checked in by wouter, 5 months ago

#291 move annotation to above the javadoc

File size: 947 bytes
Line 
1package geniusweb.profile.utilityspace;
2
3import java.math.BigDecimal;
4
5import org.eclipse.jdt.annotation.NonNull;
6
7import geniusweb.issuevalue.Bid;
8import geniusweb.profile.FullOrdering;
9
10/**
11 * A utilityspace defines a profile in terms of a utility of a bid. Bids with
12 * higher utility are preferred over bids with less utility.
13 */
14public interface UtilitySpace extends FullOrdering {
15 @NonNull
16 /**
17 * @param bid the {@link Bid} to be evaluated
18 * @return the utility value of this bid. This MUST return a number in the
19 * range [0,1]. 0 means preferred the least and 1 means preferred
20 * the most.
21 */
22 BigDecimal getUtility(final @NonNull Bid bid);
23
24 @Override
25 default boolean isPreferredOrEqual(final @NonNull Bid bid1,
26 final @NonNull Bid bid2) {
27 if (bid1 == null || bid2 == null)
28 throw new NullPointerException("bid1, bid2 must be not null");
29 return getUtility(bid1).compareTo(getUtility(bid2)) >= 0;
30 }
31
32}
Note: See TracBrowser for help on using the repository browser.