public void applyToCommandLine(List<String> sink) {
sink.add("--author=" + myRegexp);
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Author author = (Author)o;
+
+ if (myRegexp != null ? !myRegexp.equals(author.myRegexp) : author.myRegexp != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return myRegexp != null ? myRegexp.hashCode() : 0;
+ }
}
public static class Committer implements Filter {
public void applyToCommandLine(List<String> sink) {
sink.add("--committer=" + myRegexp);
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Committer committer = (Committer)o;
+
+ if (myRegexp != null ? !myRegexp.equals(committer.myRegexp) : committer.myRegexp != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return myRegexp != null ? myRegexp.hashCode() : 0;
+ }
}
public static class BeforeDate implements Filter {
public void applyToCommandLine(List<String> sink) {
sink.add("--before=" + formatDate(myDate));
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ BeforeDate that = (BeforeDate)o;
+
+ if (myDate != null ? !myDate.equals(that.myDate) : that.myDate != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return myDate != null ? myDate.hashCode() : 0;
+ }
}
public static class AfterDate implements Filter {
public void applyToCommandLine(final List<String> sink) {
sink.add("--after=" + formatDate(myDate));
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ AfterDate afterDate = (AfterDate)o;
+
+ if (myDate != null ? !myDate.equals(afterDate.myDate) : afterDate.myDate != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return myDate != null ? myDate.hashCode() : 0;
+ }
}
private static String formatDate(final Date date) {
public void applyToCommandLine(final List<String> sink) {
sink.add("--grep=" + myRegexp);
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Comment comment = (Comment)o;
+
+ if (myRegexp != null ? !myRegexp.equals(comment.myRegexp) : comment.myRegexp != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return myRegexp != null ? myRegexp.hashCode() : 0;
+ }
}
}
void onDelete(Runnable after) {
myFiltering.removeStartingPoint(getText());
getParent().removeChild(this);
+ after.run();
}
}
void onDelete(Runnable after) {
myFiltering.removeStartingPoint(getText());
getParent().removeChild(this);
+ after.run();
}
}
myFiltering.removeFilter(filter);
}
getParent().removeChild(this);
+ after.run();
}
}
void addChild(final Child child) {
assert myAllowsChildren;
- myChildren.add(child);
+ if (! myChildren.contains(child)) {
+ myChildren.add(child);
+ }
}
public Parent getParent() {
// !!!! after point is included! (should be)
@Nullable
- private Portion loadPortion(final List<String> startingPoints, final Date beforePoint, final Date afterPoint,
+ private Portion loadPortion(final Collection<String> startingPoints, final Date beforePoint, final Date afterPoint,
final Collection<ChangesFilter.Filter> filtersIn, int maxCnt) {
try {
final Collection<ChangesFilter.Filter> filters = new LinkedList<ChangesFilter.Filter>(filtersIn);
requestRefresh();
}
- public List<String> getStartingPoints() {
+ public Collection<String> getStartingPoints() {
return myState.getStartingPoints();
}
private static class MyFiltersStateHolder implements GitTreeFiltering {
private final Object myLock;
- private final List<String> myStartingPoints;
+ private final Set<String> myStartingPoints;
private boolean myDirty;
private final List<Date> myContinuationPoints;
private MyFiltersStateHolder() {
myLock = new Object();
- myStartingPoints = new LinkedList<String>();
- myFilters = new LinkedList<ChangesFilter.Filter>();
+ myStartingPoints = new HashSet<String>();
+ myFilters = new HashSet<ChangesFilter.Filter>();
myContinuationPoints = new LinkedList<Date>();
}
}
@Nullable
- public List<String> getStartingPoints() {
+ public Collection<String> getStartingPoints() {
synchronized (myLock) {
return myStartingPoints;
}
// todo COPIES!
@Nullable
- List<String> getStartingPoints();
+ Collection<String> getStartingPoints();
@Nullable
List<String> getExcludePoints();
Collection<ChangesFilter.Filter> getFilters();
public interface LowLevelAccess {
GitCommit getCommitByHash(final SHAHash hash);
// todo define signature
- void loadCommits(final List<String> startingPoints, final List<String> endPoints, final Collection<ChangesFilter.Filter> filters,
+ void loadCommits(final Collection<String> startingPoints, final Collection<String> endPoints, final Collection<ChangesFilter.Filter> filters,
final Consumer<GitCommit> consumer, final Collection<String> branches, int useMaxCnt) throws VcsException;
Collection<String> getBranchesWithCommit(final SHAHash hash) throws VcsException;
return null; //To change body of implemented methods use File | Settings | File Templates.
}
- public void loadCommits(final @NotNull List<String> startingPoints, @NotNull final List<String> endPoints,
+ public void loadCommits(final @NotNull Collection<String> startingPoints, @NotNull final Collection<String> endPoints,
@NotNull final Collection<ChangesFilter.Filter> filters,
@NotNull final Consumer<GitCommit> consumer, final Collection<String> branches, int useMaxCnt)
throws VcsException {