Пример #1
0
  public List<String> getAuthors() {
    List<String> authors = new LinkedList<String>();

    for (LogEntry logEntry : logEntries) {
      if (!authors.contains(logEntry.getAuthor())) {
        authors.add(logEntry.getAuthor());
      }
    }

    Collections.sort(authors);

    return authors;
  }
Пример #2
0
  public void removeEntriesWithPathForAuthor(String path, String author) {
    if (logEntries == null || logEntries.isEmpty()) {
      return;
    }

    int count = logEntries.size();
    int i = 0;

    while (i < count) {
      LogEntry logEntry = logEntries.get(i);
      if (!logEntry.getAuthor().equals(author)) {
        i++;
        continue;
      }

      logEntry.removeEntriesWithPath(path);
      if (logEntry.isEmpty()) {
        logEntries.remove(logEntry);
        count--;
        continue;
      }

      i++;
    }

    isOrdered = false;
  }
Пример #3
0
  private List<LogEntry> getUnorderedAuthorLogEntries(String author) {
    List<LogEntry> entries = new LinkedList<LogEntry>();

    for (LogEntry logEntry : logEntries) {
      if (logEntry.getAuthor().equals(author)) {
        entries.add(logEntry);
      }
    }

    return entries;
  }
Пример #4
0
  public LogReport getLogReportForAuthor(String author) {
    LogReport report = new LogReport();

    for (LogEntry entry : logEntries) {
      if (entry.getAuthor().equals(author)) {
        report.addLogEntry(entry);
      }
    }

    return report.isEmpty() ? null : report;
  }
Пример #5
0
  public boolean hasSamePathEntryWithHigherRevisionForAuthor(PathEntry pathEntry, String author) {
    for (LogEntry logEntry : logEntries) {
      if (!logEntry.getAuthor().equals(author)
          || logEntry.getRevision() < pathEntry.getRevision()) {
        continue;
      }

      List<PathEntry> pathEntries = logEntry.getPathEntries();
      for (PathEntry _pathEntry : pathEntries) {
        if (_pathEntry.getPath().equals(pathEntry.getPath())
            && _pathEntry.getAction().equals(pathEntry.getAction())) {
          return true;
        }
      }
    }

    return false;
  }