Package net.alteiar.beans.dice.visitor

Examples of net.alteiar.beans.dice.visitor.DiceCountVisitor


    CampaignClient.getInstance().getDiceRoller()
        .addPropertyChangeListener(new DiceListener() {
          @Override
          public void diceRolled(Dice dices) {
            DiceCountVisitor visitor = new DiceCountVisitor();
            dices.visit(visitor);

            for (Integer dice : visitor.getDices()) {
              List<Integer> results = visitor.getResults(dice);
              Integer total = 0;
              for (Integer res : results) {
                total += res;
              }
              Integer mod = visitor.getModifier();
              total += mod;

              allMessage.add(new PanelDice(maxWidth, total, dice,
                  mod, results));
            }
View Full Code Here


      return callCount;
    }

    @Override
    public void diceRolled(Dice dice) {
      DiceCountVisitor visitor = new DiceCountVisitor();
      dice.visit(visitor);

      for (Entry<Integer, Integer> entry : diceCount.entrySet()) {
        assertEquals("it should contain " + entry.getValue() + "d"
            + entry.getKey(), entry.getValue(),
            visitor.getDiceCount(entry.getKey()));
      }

      callCount++;
    }
View Full Code Here

TOP

Related Classes of net.alteiar.beans.dice.visitor.DiceCountVisitor

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.