Examples of TableDataIntf


Examples of edu.villanova.studs.poker.transport.TableDataIntf

        //Holds the results for each individual player if there are no errors
        PlayerResults[] playerResults;
       
        //The table data factory is responsible for deserializing the input
        //array and returning the appropriate concrete Table Data implementation
        TableDataIntf td = tdFactory.createTableData( in, flag );
       
        //The calc engine factory uses the table data instance to determine the
        //appropriate calc engine implementation to use
        calcEngine = calcFactory.createCalcEngine( td );
       
        //Set the calc engine options - do this 1st because the options may
        //affect how game data is set and processed
        calcEngine.setOtherOptions( td.getOptions() );
       
        //Use a try..catch here in case generating the results throws an error
        try {
            //Set the game data - this is the player & cards
            calcEngine.setGameData( td );
View Full Code Here

Examples of edu.villanova.studs.poker.transport.TableDataIntf

    }
   
   
    public static void main(String[] args) {
       
        TableDataIntf td = new TableDataCommunity();
        Hashtable<String, Object> opts = new Hashtable<String, Object>();
        Locale.setDefault( Locale.GERMAN );
        try {
            Player p = new Player();
            p.addCard( new Card(1,1) );
            p.addCard( new Card(1,2) );
            td.addPlayer( p );
            td.addPlayer( new Player() );
        } catch (TransportException e) {
          e.printStackTrace(System.out);
            CalcEngineException ex = new CalcEngineException( "My message" , e);
            System.out.println(ex.getLocalizedMessage( Locale.GERMAN) );
            return;
        }
        opts.put( CalcEngineFactory.ENGINE_PROPH_SIMS, -1 );
        td.setOptions( opts );
       
        CalculateResults results = new CalculateResults();
               
        //Object o = TransportUtils.getDeserializedResult(new CalcHandResults().getResults( td ), res.getClass() );
        results = (CalculateResults)TransportUtils.getDeserializedResult(new CalcHandResults().getResults( TransportUtils.getSerializedResult( td ), 1 ), results.getClass() );
View Full Code Here

Examples of edu.villanova.studs.poker.transport.TableDataIntf

    }

  @Test
  public void calculate() throws Exception {
    CalculatorIntf calculator = new CalculatorLocalImpl();
    TableDataIntf tableData = new TableDataCommunity();
    Player p1 = new Player(), p2 = new Player();
    Card p1c1 = new Card(TransportUtils.ACE, TransportUtils.SPADES),
      p1c2 = new Card(TransportUtils.TWO, TransportUtils.SPADES),
      p2c1 = new Card(TransportUtils.ACE, TransportUtils.HEARTS),
      p2c2 = new Card(TransportUtils.TWO, TransportUtils.HEARTS);
   
    p1.addCard(p1c1);
    p1.addCard(p1c2);
   
    p2.addCard(p2c1);
    p2.addCard(p2c2);
   
    tableData.addPlayer(p1);
    tableData.addPlayer(p2);
   
    Hashtable <String, Object> opts = new Hashtable <String, Object> ();
    opts.put(CalcEngineFactory.ENGINE_PROPH_SIMS, 50);
    tableData.setOptions(opts);
   
    CalculateResults results = calculator.calculate(tableData);
   
    //check that results were actually returned
    assertNotNull(results);
View Full Code Here

Examples of edu.villanova.studs.poker.transport.TableDataIntf

   
    //set the parameters into the request obj
    req.setParameterMap(params);
   
    //create the table data
     TableDataIntf tableData = null;
                try {
                    tableData = TableDataBuilder.buildTableData(req);
                } catch ( TransportException e ) {
                    fail( "Unexpected Error ni TableDataBuilder: " + e.getMessage() );
                }
                   
   
    //test that table data was created
    assertNotNull(tableData);
   
    //test the number of players
    List <Player> players = tableData.getPlayers();
    assertEquals(players.size(), 2);
   
    //test the number of cards for player 1
    Player p = players.get(0);
    List <Card> cards = p.getCards();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.