Changeset 11 for exampleparties/simpleshaop/src
- Timestamp:
- 01/30/20 16:52:38 (5 years ago)
- Location:
- exampleparties/simpleshaop/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
exampleparties/simpleshaop/src/main/java/geniusweb/exampleparties/simpleshaop/ShaopParty.java
r10 r11 15 15 import geniusweb.actions.Offer; 16 16 import geniusweb.actions.PartyId; 17 import geniusweb.bidspace.All PartialBidsList;17 import geniusweb.bidspace.AllBidsList; 18 18 import geniusweb.issuevalue.Bid; 19 19 import geniusweb.party.Capabilities; … … 132 132 133 133 private Offer randomBid() throws IOException { 134 All PartialBidsList bidspace = new AllPartialBidsList(134 AllBidsList bidspace = new AllBidsList( 135 135 profileint.getProfile().getDomain()); 136 136 long i = random.nextInt(bidspace.size().intValue()); -
exampleparties/simpleshaop/src/main/java/geniusweb/exampleparties/simpleshaop/SimpleLinearOrdering.java
r10 r11 94 94 DefaultPartialOrdering prof = (DefaultPartialOrdering) profile; 95 95 List<Bid> bidslist = prof.getBids(); 96 // NOTE sort defaults to ascending order, this is missing in docs. 96 97 Collections.sort(bidslist, new Comparator<Bid>() { 97 98 98 99 @Override 99 100 public int compare(Bid b1, Bid b2) { 100 // notice, -1 if better because WORST bid first 101 return prof.isPreferredOrEqual(b1, b2) ? -1 : 1; 101 return prof.isPreferredOrEqual(b1, b2) ? 1 : -1; 102 102 } 103 103 -
exampleparties/simpleshaop/src/test/java/geniusweb/exampleparties/simpleshaop/SimpleLinearOrderingTest.java
r10 r11 64 64 SimpleLinearOrdering testprofile = new SimpleLinearOrdering( 65 65 realprofile); 66 assertEquals(Arrays.asList(bid 3, bid2, bid1), testprofile.getBids());66 assertEquals(Arrays.asList(bid1, bid2, bid3), testprofile.getBids()); 67 67 } 68 68
Note:
See TracChangeset
for help on using the changeset viewer.