From fbbbc1cb404839049f5925f456830e537000c588 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 19 Mar 2025 11:58:04 +0100 Subject: [PATCH] cleanup --- .../common/ObservableMapDecorator.java | 101 ------------------ .../org/cryptomator/event/VaultEventsMap.java | 10 ++ 2 files changed, 10 insertions(+), 101 deletions(-) delete mode 100644 src/main/java/org/cryptomator/common/ObservableMapDecorator.java diff --git a/src/main/java/org/cryptomator/common/ObservableMapDecorator.java b/src/main/java/org/cryptomator/common/ObservableMapDecorator.java deleted file mode 100644 index 5330c189b..000000000 --- a/src/main/java/org/cryptomator/common/ObservableMapDecorator.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.cryptomator.common; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import javafx.beans.InvalidationListener; -import javafx.collections.MapChangeListener; -import javafx.collections.ObservableMap; -import java.util.Collection; -import java.util.Map; -import java.util.Set; - -public abstract class ObservableMapDecorator implements ObservableMap { - - protected final ObservableMap delegate; - - protected ObservableMapDecorator(ObservableMap delegate) { - this.delegate = delegate; - } - - @Override - public void addListener(MapChangeListener mapChangeListener) { - delegate.addListener(mapChangeListener); - } - - @Override - public void removeListener(MapChangeListener mapChangeListener) { - delegate.removeListener(mapChangeListener); - } - - @Override - public int size() { - return delegate.size(); - } - - @Override - public boolean isEmpty() { - return delegate.isEmpty(); - } - - @Override - public boolean containsKey(Object key) { - return delegate.containsKey(key); - } - - @Override - public boolean containsValue(Object value) { - return delegate.containsValue(value); - } - - @Override - public V get(Object key) { - return delegate.get(key); - } - - @Override - public @Nullable V put(K key, V value) { - return delegate.put(key, value); - } - - @Override - public V remove(Object key) { - return delegate.remove(key); - } - - @Override - public void putAll(@NotNull Map m) { - delegate.putAll(m); - } - - @Override - public void clear() { - delegate.clear(); - } - - @Override - public @NotNull Set keySet() { - return delegate.keySet(); - } - - @Override - public @NotNull Collection values() { - return delegate.values(); - } - - @Override - public @NotNull Set> entrySet() { - return delegate.entrySet(); - } - - @Override - public void addListener(InvalidationListener invalidationListener) { - delegate.addListener(invalidationListener); - } - - @Override - public void removeListener(InvalidationListener invalidationListener) { - delegate.removeListener(invalidationListener); - } - -} diff --git a/src/main/java/org/cryptomator/event/VaultEventsMap.java b/src/main/java/org/cryptomator/event/VaultEventsMap.java index da46f3c86..26290ff44 100644 --- a/src/main/java/org/cryptomator/event/VaultEventsMap.java +++ b/src/main/java/org/cryptomator/event/VaultEventsMap.java @@ -89,6 +89,7 @@ public class VaultEventsMap { * Must be executed on the JavaFX application thread * * @return a list of vault events, mainly sorted ascending by the event timestamp + * @implNote Method is not synchronized, because it is only executed if executed by JavaFX application thread */ public List listAll() { if (!Platform.isFxApplicationThread()) { @@ -109,6 +110,7 @@ public class VaultEventsMap { * @param v Vault where the event occurred * @param similar A similar {@link FilesystemEvent} (same class, same idPath) * @return the removed {@link Value} + * @implNote Method is not synchronized, because it is only executed if executed by JavaFX application thread */ public Value remove(Vault v, FilesystemEvent similar) { if (!Platform.isFxApplicationThread()) { @@ -119,6 +121,13 @@ public class VaultEventsMap { return map.remove(key); } + /** + * Clears the event map. + *

+ * Must be executed on the JavaFX application thread + * + * @implNote Method is not synchronized, because it is only executed if executed by JavaFX application thread + */ public void clear() { if (!Platform.isFxApplicationThread()) { throw new IllegalStateException("Map removal must be performed on JavaFX application thread"); @@ -151,6 +160,7 @@ public class VaultEventsMap { * * @param k Key of the entry to update * @param v Value of the entry to update + * @implNote Method is not synchronized, because it is only called on the (one-and-only) JavaFX application thread */ private void updateMap(Key k, Value v) { var entry = map.get(k);