Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
  @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;
  }
Ejemplo n.º 3
0
  /**
   * 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;
  }