Examples of ROUND


Examples of cero.games.Round

  public void validateGame(Game game) throws ValidationException {
  }

  public void initializeRule(Game game) throws InitializationException {
    Round round = game.getRounds().get(0);
    if (round != null)
      round.addRoundListener(this);
    else
      throw new InitializationException("Can't find the expected Round");
  }
View Full Code Here

Examples of cero.games.Round

  public void roundEnd(RoundEvent e) {
   
  }

  public void initializeRule(Game game) throws InitializationException {
    Round subround = game.getRounds().get(0);
    if (subround != null)
      subround = subround.getSubRounds().getSortedList().get(0);
    if (subround != null) {
      subround.addRoundStopCondition(this);
      subround.addRoundListener(this);
    }
    else
      throw new InitializationException("Can't find the expected subRound");
  }
View Full Code Here

Examples of cero.games.Round

    }

  }

  public void initializeRule (Game game) throws InitializationException {
    Round subround = game.getRounds().get(0);
    if (subround != null)
      subround = subround.getSubRounds().getSortedList().get(0);
    if (subround != null) {
      subround.addRoundListener(this);
    } else
      throw new InitializationException(
          "Can't find the expected subRound");

  }
View Full Code Here

Examples of cero.games.Round

        return false;
    return true;
  }

  public void initializeRule(Game game) throws InitializationException {
    Round subround = game.getRounds().get(0);
    if (subround != null)
      subround = subround.getSubRounds().getSortedList().get(0);
    if (subround != null) {
      subround.addRoundStopCondition(this);
    }
    else
      throw new InitializationException("Can't find the expected subRound");
  }
View Full Code Here

Examples of cero.games.Round

  public void validateGame(Game game) throws ValidationException {
  }

  public void initializeRule(Game game) throws InitializationException {
    Round round = game.getRounds().get(0);
    if (round != null)
      round.addRoundListener(this);
    else
      throw new InitializationException("Can't find the expected Round");
  }
View Full Code Here

Examples of com.svanloon.game.wizard.stats.Round

    for (int roundId = startRound; roundId < endRound + 1; roundId = roundId + inc) {
      dealer = (dealer + 1)% _playerCollection.size();
      lead = (dealer + 1)% _playerCollection.size();
      gameEventNotifier.notify(new NewRoundEvent(roundId));
      _game.newRound(roundId);
      Round round = _game.getCurrentRound();
      Card trump = dealCards(roundId, dealer, lead);
      gameEventNotifier.notify(new NewTrumpEvent(trump));
      round.setTrump(trump);

      if(trump != null && trump.getValue().equals(Value.WIZARD)) {
        Player trumpPicker = _playerCollection.get(dealer);
        //_logger.info(trumpPicker.getName() + " gets to pick trump.");
        trump = new Card(null, trumpPicker.pickTrump(), -1);
        gameEventNotifier.notify(new NewTrumpEvent(trump));
        round.setTrump(trump);
      }
      int cardsDealt = roundId;
      Bid bid = bid(trump, lead, cardsDealt, round);
      if(go.getBidType().equals(BidType.HIDDEN)) {
        for(IndividualBid individualBid :bid.getBids()) {
          gameEventNotifier.notify(new PlayerBidEvent(individualBid.getPlayer().getId(), individualBid.getBid()));
          round.setBid(individualBid.getPlayer().getId(), individualBid.getBid());
        }
      }
      RoundSummary roundSummary = new RoundSummary();
      for (int i = 0; i < roundId; i++) {
        TrickTracker trickTracker = playTrick(trump, lead, round);
        roundSummary.addTrickTracker(trickTracker);
        int playerIdWhoWon = trickTracker.winningPlay().getPlayerId();
        lead = findPlayerIndex(playerIdWhoWon);
      }
      if(go.getBidType().equals(BidType.SECRET)) {
        for(IndividualBid individualBid :bid.getBids()) {
          gameEventNotifier.notify(new PlayerBidEvent(individualBid.getPlayer().getId(), individualBid.getBid()));
          round.setBid(individualBid.getPlayer().getId(), individualBid.getBid());
        }
      }
      scoreRound(roundSummary, bid, _game);
      this.overallScores.displayScore();
    }
View Full Code Here

Examples of org.apache.imperius.spl.parser.expressions.impl.Round

    //SensorLookup lookup = new SensorLookupImpl(map);

    try {
      Vector v = new Vector();
      v.add(new ShortConstant(sn1));
      Expression e1 = new Round(v,true);

      v.clear();
      v.add(new IntegerConstant(in1));
      Expression e2 = new Round(v,true);

      v.clear();
      v.add(new LongConstant(ln1));
      Expression e3 = new Round(v,true);

      v.clear();
      v.add(new FloatConstant(fn1));
      Expression e4 = new Round(v,true);

      v.clear();
      v.add(new DoubleConstant(dn1));
      Expression e5 = new Round(v,true);

      assertTrue(
        (Math.round(sn1) - ((Number) e1.evaluate()).shortValue())
          == 0);
      assertTrue(
        (Math.round(in1) - ((Number) e2.evaluate()).intValue())
          == 0);
      assertTrue(
          (Math.round(ln1) - ((Number) e3.evaluate()).intValue())
            == 0);
      assertTrue(
        (Math.round(fn1) - ((Number) e4.evaluate()).intValue())
          == 0);
      assertTrue(
        (Math.round(dn1) - ((Number) e5.evaluate()).longValue())
          == 0);
/*
//      assertSame((new Short(sn1)).getClass(), (e1.evaluate()).getClass());
//      assertSame((new Integer(in1)).getClass(), (e2.evaluate()).getClass());
//      assertSame((new Long(ln1)).getClass(), (e3.evaluate()).getClass());
View Full Code Here

Examples of org.apache.pig.builtin.ROUND

    @Test
    public void testROUND() throws Exception {
        Double         dbl     = 0.987654321d;
        Float          flt     = 0.987654321f;
        EvalFunc<Long> rounder = new ROUND();
        Tuple          tup     = TupleFactory.getInstance().newTuple(1);
        long           expected, lng_out;

        tup.set(0, dbl);
        expected = Math.round(dbl);
        lng_out   = rounder.exec(tup);
        assertEquals(expected, lng_out);

        tup.set(0, flt);
        expected = Math.round(flt);
        lng_out   = rounder.exec(tup);
        assertEquals(expected, lng_out);

        tup.set(04.6d); assertEquals( 5l, lng_out = rounder.exec(tup));
        tup.set(02.4d); assertEquals( 2l, lng_out = rounder.exec(tup));
        tup.set(01.0d); assertEquals( 1l, lng_out = rounder.exec(tup));
        tup.set(0, -1.0d); assertEquals(-1l, lng_out = rounder.exec(tup));
        tup.set(0, -2.4d); assertEquals(-2l, lng_out = rounder.exec(tup));
        tup.set(0, -4.6d); assertEquals(-5l, lng_out = rounder.exec(tup));

        // Rounds towards positive infinity: round(x) = floor(x + 0.5)
        tup.set(03.5d); assertEquals( 4l, lng_out = rounder.exec(tup));
        tup.set(0, -3.5d); assertEquals(-3l, lng_out = rounder.exec(tup));
        tup.set(02.5d); assertEquals( 3l, lng_out = rounder.exec(tup));
        tup.set(0, -2.5d); assertEquals(-2l, lng_out = rounder.exec(tup));

        // we don't need to test null input because of SKIP_UDF_CALL_FOR_NULL behavior
    }
View Full Code Here

Examples of org.apache.pig.builtin.ROUND

    @Test
    public void testROUND() throws Exception {
        Double         dbl     = 0.987654321d;
        Float          flt     = 0.987654321f;
        EvalFunc<Long> rounder = new ROUND();
        Tuple          tup     = TupleFactory.getInstance().newTuple(1);
        long           expected, lng_out;

        tup.set(0, dbl);
        expected = Math.round(dbl);
        lng_out   = rounder.exec(tup);
        assertEquals(expected, lng_out);

        tup.set(0, flt);
        expected = Math.round(flt);
        lng_out   = rounder.exec(tup);
        assertEquals(expected, lng_out);

        tup.set(04.6d); assertEquals( 5l, lng_out = rounder.exec(tup));
        tup.set(02.4d); assertEquals( 2l, lng_out = rounder.exec(tup));
        tup.set(01.0d); assertEquals( 1l, lng_out = rounder.exec(tup));
        tup.set(0, -1.0d); assertEquals(-1l, lng_out = rounder.exec(tup));
        tup.set(0, -2.4d); assertEquals(-2l, lng_out = rounder.exec(tup));
        tup.set(0, -4.6d); assertEquals(-5l, lng_out = rounder.exec(tup));

        // Rounds towards positive infinity: round(x) = floor(x + 0.5)
        tup.set(03.5d); assertEquals( 4l, lng_out = rounder.exec(tup));
        tup.set(0, -3.5d); assertEquals(-3l, lng_out = rounder.exec(tup));
        tup.set(02.5d); assertEquals( 3l, lng_out = rounder.exec(tup));
        tup.set(0, -2.5d); assertEquals(-2l, lng_out = rounder.exec(tup));

        // we don't need to test null input because of SKIP_UDF_CALL_FOR_NULL behavior
    }
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.math.ROUND

          double actual = (new Double(output.strval())).doubleValue();
          assertEquals(actual, expected, delta);
   }
  
   public void testROUND() throws Exception{
       EvalFunc<DataAtom> ROUND = new ROUND();
          Tuple tup = new Tuple(1);
          tup.setField(0, 0.5);
          DataAtom output = new DataAtom();
          ROUND.exec(tup, output);
          double expected = Math.round(0.5);
          double actual = (new Double(output.strval())).doubleValue();
          assertEquals(actual, expected, delta);
   }
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.