20 package net.sf.gridarta.gui.mapfiles;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.Collections;
26 import java.util.Iterator;
27 import java.util.List;
28 import java.util.concurrent.CopyOnWriteArrayList;
29 import java.util.regex.Pattern;
37 import org.jetbrains.annotations.NotNull;
38 import org.jetbrains.annotations.Nullable;
58 private final Collection<MapFolderListener<G, A, R>>
listeners =
new CopyOnWriteArrayList<>();
70 private final Object
sync =
new Object();
93 private final List<PickmapState<G, A, R>>
pickmapStates =
new ArrayList<>();
157 synchronized (
sync) {
162 listenerMap.pickmapAdded(pickmapState);
173 synchronized (
sync) {
176 throw new IllegalArgumentException(
"pickmap is not part of this folder: " + pickmapState.getFile());
179 final File file = pickmapState.getFile();
185 listenerMap.pickmapRemoved(pickmapState);
187 pickmapState.freePickmap();
197 synchronized (
sync) {
213 public Iterator<PickmapState<G, A, R>>
iterator() {
214 return Collections.unmodifiableList(
pickmapStates).iterator();
247 pickmapState.getUnsavedPickmaps(unsavedPickmaps);
258 listenerMap.pickmapReverted(pickmapState, oldPickmap);