public void setBid(Bid pBid) { if (pBid.getSuit() == null) { this.DATA[5][1] = "" + (int) pBid.getTricksBid(); this.DATA[5][2] = "No Trump"; } else { this.DATA[5][1] = "" + (int) pBid.getTricksBid(); this.DATA[5][2] = pBid.getSuit().toString(); } this.SCOREBOARD.repaint(); }
@Override public int compareTo(Bid pBid) { int rank1; // Rank for this bid int rank2; // Rank for pBid if (this.isPass()) { rank1 = -1; } else { rank1 = this.toIndex(); } if (pBid.isPass()) { rank2 = -1; } else { rank2 = pBid.toIndex(); } return rank1 - rank2; }
/** * Returns the highest bid in pBids. If they are all passing bids, returns pass. * * @param pBids The bids to compare. * @return the highest bid. */ public static Bid max(Bid[] pBids) { Bid maxBid = null; for (Bid b : pBids) { if (b == null) { continue; } if (b.isPass()) { continue; } else if (maxBid == null || b.toIndex() > maxBid.toIndex()) { maxBid = b; } } // If they are all passing bids, return pass. if (maxBid == null) { return new Bid(); } // Otherwise, return the maximum. return maxBid; }