Пример #1
0
  /**
   * Method addComment.
   *
   * @param string
   */
  public void addComment(String comment) {
    // Make comment first element if it's already there
    int index = getCommentIndex(comment);
    if (index != -1) {
      makeFirstElement(index);
      return;
    }
    if (containsCommentTemplate(comment)) return;

    // Insert the comment as the first element
    String[] newComments = new String[Math.min(previousComments.length + 1, maxComments)];
    newComments[0] = comment;
    for (int i = 1; i < newComments.length; i++) {
      newComments[i] = previousComments[i - 1];
    }
    previousComments = newComments;
  }