// If this is a new item and there is more than one bid, then
// we'll choose the bidder's UserId at random.
// If there is only one bid, then it will have to be the last bidder
bidderId = (itemInfo.numBids == 1 ? itemInfo.lastBidderId :
profile.getRandomBuyerId(itemInfo.sellerId));
TimestampType endDate;
if (itemInfo.status == ItemStatus.OPEN) {
endDate = profile.getBenchmarkStartTime();
} else {
endDate = itemInfo.endDate;
}
this.currentCreateDateAdvanceStep = (endDate.getTime() - itemInfo.startDate.getTime()) / (remaining + 1);
this.currentBidPriceAdvanceStep = itemInfo.initialPrice * AuctionMarkConstants.ITEM_BID_PERCENT_STEP;
}
// The last bid must always be the item's lastBidderId
else if (remaining == 0) {
bidderId = itemInfo.lastBidderId;
}
// The first bid for a two-bid item must always be different than the lastBidderId
else if (itemInfo.numBids == 2) {
assert(remaining == 1);
bidderId = profile.getRandomBuyerId(itemInfo.lastBidderId, itemInfo.sellerId);
}
// Since there are multiple bids, we want randomly select one based on the previous bidders
// We will get the histogram of bidders so that we are more likely to select
// an existing bidder rather than a completely random one
else {
assert(this.bid != null);
ObjectHistogram<UserId> bidderHistogram = itemInfo.getBidderHistogram();
bidderId = profile.getRandomBuyerId(bidderHistogram, this.bid.bidderId, itemInfo.sellerId);
}
assert(bidderId != null);
float last_bid = (this.new_item ? itemInfo.initialPrice : this.bid.maxBid);
this.bid = itemInfo.getNextBid(this.count, bidderId);
this.bid.createDate = new TimestampType(itemInfo.startDate.getTime() + this.currentCreateDateAdvanceStep);
this.bid.updateDate = this.bid.createDate;
if (remaining == 0) {
this.bid.maxBid = itemInfo.currentPrice;
if (itemInfo.purchaseDate != null) {