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

Last change on this file since 810 was 804, checked in by wouter, 7 months ago

#278 added NonNull annotation in many places in the geniusweb code

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 /**
16 * @param bid the {@link Bid} to be evaluated
17 * @return the utility value of this bid. This MUST return a number in the
18 * range [0,1]. 0 means preferred the least and 1 means preferred
19 * the most.
20 */
21 @NonNull
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.