source: josm/trunk/src/org/openstreetmap/josm/data/osm/DefaultChangesetCacheEvent.java@ 7599

Last change on this file since 7599 was 7005, checked in by Don-vip, 10 years ago

see #8465 - use diamond operator where applicable

  • Property svn:eol-style set to native
File size: 1.6 KB
RevLine 
[2711]1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm;
3
4import java.util.Collection;
5import java.util.Collections;
6import java.util.HashSet;
7import java.util.Set;
8
9public class DefaultChangesetCacheEvent implements ChangesetCacheEvent{
10
11 private final Set<Changeset> added;
12 private final Set<Changeset> modified;
13 private final Set<Changeset> removed;
14 private final ChangesetCache source;
15
16 public DefaultChangesetCacheEvent(ChangesetCache source) {
17 this.source = source;
[7005]18 added = new HashSet<>();
19 modified = new HashSet<>();
20 removed = new HashSet<>();
[2711]21 }
22
[6084]23 @Override
[2711]24 public Collection<Changeset> getAddedChangesets() {
25 return Collections.unmodifiableCollection(added);
26 }
[6084]27 @Override
[2711]28 public Collection<Changeset> getRemovedChangesets() {
29 return Collections.unmodifiableCollection(removed);
30 }
[6084]31 @Override
[2711]32 public ChangesetCache getSource() {
33 return source;
34 }
[6084]35 @Override
[2711]36 public Collection<Changeset> getUpdatedChangesets() {
37 return Collections.unmodifiableCollection(modified);
38 }
39
40 public void rememberAddedChangeset(Changeset cs) {
41 if (cs == null) return;
42 added.add(cs);
43 }
44
45 public void rememberUpdatedChangeset(Changeset cs) {
46 if (cs == null) return;
47 modified.add(cs);
48 }
49
50 public void rememberRemovedChangeset(Changeset cs) {
51 if (cs == null) return;
52 removed.add(cs);
53 }
54
55 public boolean isEmpty() {
56 return added.isEmpty() && modified.isEmpty() && removed.isEmpty();
57 }
58}
Note: See TracBrowser for help on using the repository browser.