// Path: src/main/java/org/sonar/plugins/stash/StashPlugin.java
// public enum IssueType {
//   CONTEXT,
//   REMOVED,
//   ADDED,
// }


import java.util.Objects;
import java.util.ArrayList;
import java.util.List;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.plugins.stash.StashPlugin.IssueType;


  public void add(StashComment comment) {
    comments.add(comment);
  }

  public void add(StashCommentReport report) {
    for (StashComment comment : report.getComments()) {
      comments.add(comment);
    }
  }

  public boolean contains(String message, String path, long line) {
    boolean result = false;
    for (StashComment comment : comments) {

      if (Objects.equals(comment.getMessage(), message)
       && Objects.equals(comment.getPath(), path)
       && comment.getLine() == line) {

        result = true;
        break;
      }
    }

    return result;
  }

  public StashCommentReport applyDiffReport(StashDiffReport diffReport) {
    for (StashComment comment : comments) {
      StashDiff diff = diffReport.getDiffByComment(comment.getId());

// Path: src/main/java/org/sonar/plugins/stash/StashPlugin.java
// public enum IssueType {
//   CONTEXT,
//   REMOVED,
//   ADDED,
// }


// Path: src/main/java/org/sonar/plugins/stash/issue/StashCommentReport.java
import java.util.Objects;
import java.util.ArrayList;
import java.util.List;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.plugins.stash.StashPlugin.IssueType;


  public void add(StashComment comment) {
    comments.add(comment);
  }

  public void add(StashCommentReport report) {
    for (StashComment comment : report.getComments()) {
      comments.add(comment);
    }
  }

  public boolean contains(String message, String path, long line) {
    boolean result = false;
    for (StashComment comment : comments) {

      if (Objects.equals(comment.getMessage(), message)
       && Objects.equals(comment.getPath(), path)
       && comment.getLine() == line) {

        result = true;
        break;
      }
    }

    return result;
  }

  public StashCommentReport applyDiffReport(StashDiffReport diffReport) {
    for (StashComment comment : comments) {
      StashDiff diff = diffReport.getDiffByComment(comment.getId());

      if ((diff != null) && diff.getType() == IssueType.CONTEXT) {
