示例#1
0
  /**
   * Invoked when a message to a specific receiver is encountered in the log file. Example of this
   * is the offers sent by the manufacturers to the customers.
   *
   * @param sender the sender of the message
   * @param receiver the receiver of the message
   * @param content the message content
   */
  @Override
  protected void message(int sender, int receiver, Transportable content) {
    if (content instanceof BankStatus
        && participants[receiver].getRole() == TACAdxConstants.AD_NETOWRK_ROLE_ID) {

      BankStatus status = (BankStatus) content;

      System.out.println(
          StringUtils.rightPad(participantNames[receiver], 20)
              + "\t"
              + day
              + "\t"
              + (int) status.getAccountBalance());

    } else if (content instanceof SimulationStatus) {
      SimulationStatus ss = (SimulationStatus) content;
      day = ss.getCurrentDate();
    }
  }
 private void handleBankStatus(BankStatus content) {
   System.out.println("Day " + w.day + " :" + content.toString());
 }