Example #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());
    }
  }
Example #2
0
 /**
  * Get the ply with the given index.
  *
  * @param plyIndex The index of the ply.
  * @return The notation for the ply as a string.
  */
 private final String getPly(int plyIndex) {
   return _plies.get(plyIndex).toString();
 }