Пример #1
0
  /**
   * Returns the String Representation of this TimeInstant according to the TimeFormatter,
   * truncating digits after the decimal point if necessary.
   *
   * @param digits Maximum number of digits after decimal point
   * @see java.lang.Object#toString()
   * @see desmoj.core.simulator.TimeFormatter
   */
  public String toString(int digits) {

    String result = TimeOperations.formatTimeInstant(this);

    if (result.lastIndexOf(".") >= 0) {
      result = result.substring(0, Math.max(result.length() - 1, result.lastIndexOf(".") + digits));
    }
    return result;
  }