예제 #1
0
  // override to renderScore() when judging
  public String showEarningsSummary(final String userName) {
    final StringBuffer buff = new StringBuffer();
    JudgingStatusAdaptor ad =
        new NoActionJudgingStatusAdaptor() {
          public void judging() {
            renderScore(userName, buff);
          }

          public void trading() {
            renderScore(userName, buff);
          }

          public void showingScores() {
            renderScoreAndExplanation(userName, buff);
          }
        };
    try {
      ifJudging(ad);
    } catch (ScoreException e) {
      Logger logger = sessionLogger();
      logger.error(e);
      appendToErrorMessage("unable to compute scores.");
    }
    ifScoring(ad);
    ifTrading(ad);
    return buff.toString();
  }
예제 #2
0
  private void logScoringParameters(Logger log) {
    String rewards = (String) props.get(JUDGE_REWARDS);
    if (null == rewards || rewards.length() == 0) {
      String[] scoreInputs =
          new String[] {SCORING_FACTOR_PROPERTY_WORD, SCORING_CONSTANT_PROPERTY_WORD};
      String[] scoreRoles = new String[] {JUDGE_PROPERTY_WORD};
      logParameterCombinations(scoreInputs, scoreRoles, log, false);
    } else {
      StringBuffer buff = new StringBuffer();
      buff.append("Judge scoring based on table: ");
      String[] rewardArray = rewards.split(COMMA_SPLIT_RE);
      for (int i = 0; i < rewardArray.length; i++) {
        String reward = rewardArray[i];
        buff.append(reward);
        if (i + 1 < rewardArray.length) {
          buff.append(", ");
        }
      }
      log.info(buff.toString());
    }
    String manipRewards = props.getProperty(Manipulator.MANIPULATOR_REWARDS_TOKEN);

    if (null == manipRewards || manipRewards.length() == 0) {
      String[] scoreInputs =
          new String[] {SCORING_FACTOR_PROPERTY_WORD, SCORING_CONSTANT_PROPERTY_WORD};
      String[] scoreRoles = new String[] {MANIPULATOR_PROPERTY_WORD};
      logParameterCombinations(scoreInputs, scoreRoles, log, false);
    } else {
      log.info("Manipulator scoring based on " + manipRewards);
    }
  }
예제 #3
0
 public String getEstimatesHtml() {
   Session session = SessionSingleton.getSession();
   if (session == null) {
     return "";
   }
   Iterator iterator = session.playerNameSortedIterator();
   StringBuffer buff = new StringBuffer();
   printEstimatesTableHeader(session, buff);
   while (iterator.hasNext()) {
     String playerName = (String) iterator.next();
     Judge judge = getJudgeOrNull(playerName);
     if (null == judge) {
       continue;
     }
     HtmlRow.startTag(buff);
     buff.append(HtmlSimpleElement.printTableCell(playerName));
     judge.getGuessesRow(buff, session);
     HtmlRow.endTag(buff);
   }
   HtmlTable.endTagWithP(buff);
   return buff.toString();
 }