Exemplo n.º 1
0
 public void remove(@NotNull Change change) {
   if (change.getType().isApplied()) {
     LOG.assertTrue(myAppliedChanges.remove(change), change);
   } else {
     LOG.assertTrue(myChanges.remove(change), change);
   }
   change.onRemovedFromList();
   fireOnChangeRemoved();
 }
Exemplo n.º 2
0
 public void setChanges(@NotNull ArrayList<Change> changes) {
   if (myChanges != null) {
     HashSet<Change> newChanges = new HashSet<>(changes);
     LOG.assertTrue(newChanges.size() == changes.size());
     for (Iterator<Change> iterator = myChanges.iterator(); iterator.hasNext(); ) {
       Change oldChange = iterator.next();
       if (!newChanges.contains(oldChange)) {
         iterator.remove();
         oldChange.onRemovedFromList();
       }
     }
   }
   for (Change change : changes) {
     LOG.assertTrue(change.isValid());
   }
   myChanges = new ArrayList<>(changes);
   myAppliedChanges = new ArrayList<>();
 }