Package edu.villanova.studs.poker.exceptions

Examples of edu.villanova.studs.poker.exceptions.TransportException


            //Add the Card to the end of the list
            community.add(c);
        }
        else
            //Exceeded maximum # of allowable Cards
            throw new TransportException ( PokerMessages.AFTER_RIVER );
    }
View Full Code Here


            //All checks have passed, add the new Cards to the community
            community.addAll( cards );
        }
        else
            //Exceeded maximum # of allowable Cards
            throw new TransportException ( PokerMessages.COMM_SIZE,
                                           new Object[] { numNewCards +
                                                          community.size(),
                                                          MAX_COMMUNITY} );
    }
View Full Code Here

     */
    public void setStreet( int s ) throws TransportException {
        //Check that the new value is within range
        if ( s < TransportUtils.HOLE_CARDS_DEALT ||
             s > TransportUtils.RIVER_CARD_DEALT )
            throw new TransportException( PokerMessages.INVALID_STREET,
                                          new Object[] {s} );
       
        //No exception thrown, set the new street
        street = s;
    }
View Full Code Here

        switch ( numCardsOnBoard ) {
          case HOLE_SIZE : street = TransportUtils.HOLE_CARDS_DEALT; return;
            case FLOP_SIZE : street = TransportUtils.FLOP_CARDS_DEALT; return;
            case TURN_SIZE : street = TransportUtils.TURN_CARD_DEALT; return;
            case RIVER_SIZE : street = TransportUtils.RIVER_CARD_DEALT; return;
            default : throw new TransportException( PokerMessages.INVALID_BOARD,
                                                    new Object[] {numCardsOnBoard} );
        }
    }
View Full Code Here

        if ( verifyPlayer(p) ) {
            if ( players.size() < MAX_PLAYERS )
                players.add(p);
          else
                //Max exceeded
                throw new TransportException( PokerMessages.PLAYER_SIZE,
                                              new Object[] {MAX_PLAYERS} );
      }
      else
          //Player has invalid number of cards in hand
          throw new TransportException( PokerMessages.PLAYER_CARDS,
                                          new Object[] { players.size(),
                                                         p.numOfCardsInHand(),
                                                         gameType} );
    }
View Full Code Here

     */
    public void setPlayers( ArrayList<Player> plist ) throws TransportException {
     
        if ( ( plist.size() + players.size() ) > MAX_PLAYERS ) {
            //Max exceeded
            throw new TransportException( PokerMessages.PLAYERS_SIZE,
                                          new Object[] { players.size(),
                                                         plist.size(),
                                                         MAX_PLAYERS} );
      }
     
        // Loop through list and make sure each player is valid before adding
      for ( int i=0; i < plist.size(); i++ ) {
            Player p = plist.get(i);
            if ( !verifyPlayer( p ) ) {
                //Player has invalid number of cards in hand
                 throw new TransportException( PokerMessages.PLAYER_CARDS,
                                               new Object[] { i,
                                                              p.numOfCardsInHand(),
                                                              gameType} );  
            }
      }
View Full Code Here

     */
    public void setRank( int r ) throws TransportException {
        if ( validateRank(r) )
            rank = r;
        else
            throw new TransportException ( PokerMessages.INVALID_RANK,
                                           new Object[] {r} );
    }
View Full Code Here

     */
    public void setSuit( int s ) throws TransportException {
        if ( validateSuit(s) )
            suit = s;
  else
            throw new TransportException ( PokerMessages.INVALID_SUIT,
                                           new Object[] {s} );
    }
View Full Code Here

      if (card.getRank() != TransportUtils.UNKNOWN
          && card.getSuit() != TransportUtils.UNKNOWN) {       
        communityCards.add(card);
               
        if (communityCards.size() != i) {
                                    throw new TransportException( PokerMessages.COMM_ORDER );
        }       
      }
    }

    table.setCommunity(communityCards);
View Full Code Here

      }

     
      if (player.getCards().size() == 1) {
          //Player has invalid number of cards in hand
          throw new TransportException( PokerMessages.PLAYER_CARDS,
                                        new Object[] { i, 1, 2} );
      }
     
      playerFold = req.getParameter("p" + i + "fold");
      player.setFolded(REQ_VALUE_FOLD.equals(playerFold));
     
      if(player.isActive() && !player.getFolded()) {
        numActive++;
      }
    }
               
                if ( numActive == 0 )
                    throw new TransportException( PokerMessages.ACTIVE_PLAYERS );
  }
View Full Code Here

TOP

Related Classes of edu.villanova.studs.poker.exceptions.TransportException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.