Beispiel #1
0
  /**
   * Add a new ply with it's notation.
   *
   * @param plyNotation The notation of the new ply.
   */
  public void addPly(PlyNotation plyNotation) {
    _plies.add(plyNotation);

    int nPlies = _plies.size(); // Get the number of plies.
    if ((nPlies & 1) != 0) {
      if (nPlies > 1) { // Start a new line
        _notation.append("\n");
      }
      _notation.append("" + ((nPlies >> 1) + 1) + ". ");
    } else {
      _notation.append(" ");
    }
    _notation.append(plyNotation.toString());

    // If there's a panel, display the current notation.
    if (null != getNotationPanel()) {
      getNotationPanel().setText(toString());
    }
  }
Beispiel #2
0
 /**
  * Get the entire game as a string.
  *
  * @return The entire game as a string.
  */
 public final String toString() {
   return _notation.toString();
 }