Esempio n. 1
0
 /**
  * Returns info about the game consisting of white player, black player, event, site, date,
  * result, and ECO.
  *
  * @return the info string
  */
 public String getLongInfoString() {
   StringBuffer sb = new StringBuffer();
   sb.append(getWhite()).append(" - ").append(getBlack()).append(", ").append(getEvent());
   if (getRound() != null) {
     sb.append(" (").append(getRound()).append(") ");
   }
   sb.append(", ").append(getSite()).append("  ").append(getResult());
   if (getECO() != null) {
     sb.append("  [").append(getECO()).append("]");
   }
   return sb.toString();
 }
Esempio n. 2
0
 /**
  * Returns information to display at the header of a game. The information is split in three
  * parts: (1) white and black player plus their elos, (2) event, site, date, rounf, and (3) the
  * ECO.
  *
  * @param line which line to return (0..2)
  * @return the info string
  */
 public String getHeaderString(int line) {
   if (line == 0) {
     StringBuffer sb = new StringBuffer();
     sb.append(getWhite());
     if (getWhiteElo() != 0) sb.append(" [").append(getWhiteElo()).append("]");
     sb.append(" - ").append(getBlack());
     if (getBlackElo() != 0) sb.append(" [").append(getBlackElo()).append("]");
     sb.append("  ").append(getResultStr()).append("  (").append(getNumOfMoves()).append(")");
     return sb.toString();
   } else if (line == 1) {
     StringBuffer sb = new StringBuffer();
     sb.append(getEvent()).append(", ").append(getSite()).append(", ").append(getDate());
     sb.append("  [").append(getRound()).append("]");
     return sb.toString();
   } else if (line == 2) {
     return getECO();
   } else {
     throw new RuntimeException("Only 3 header lines supported");
   }
 }