Jelajahi Sumber

Move event, graphics, observer into own modules to avoid compilation issues.

Sam Jaffe 8 tahun lalu
induk
melakukan
1fb5d634ee

+ 9 - 0
.gitmodules

@@ -0,0 +1,9 @@
+[submodule "include/event"]
+	path = include/event
+	url = http://209.6.89.209:3000/samjaffe/java-util-event.git
+[submodule "include/graphics"]
+	path = include/graphics
+	url = http://209.6.89.209:3000/samjaffe/java-util-graphics.git
+[submodule "include/observer"]
+	path = include/observer
+	url = http://209.6.89.209:3000/samjaffe/java-util-observer.git

+ 1 - 1
README.md

@@ -17,7 +17,7 @@ This guide assumes the following:
 #### Build
 1. Clone/Download this repository
 2. Open a command prompt in d20-charsheet
-3. Enter the command `mvn clean package`
+3. Enter the command `mvn -f include/pom.xml clean package`
 
 #### Run  
 * From the d20-charsheet directory, run the below command for your OS.  

+ 1 - 0
include/event

@@ -0,0 +1 @@
+Subproject commit 12f2d8b40fd3696f5bcae1b69666a05d5bc697ae

+ 1 - 0
include/graphics

@@ -0,0 +1 @@
+Subproject commit 52e1bc2a6cae15d37641354661ed6cb4a8b16d79

+ 1 - 0
include/observer

@@ -0,0 +1 @@
+Subproject commit 69bd32cc5566eaed85883d800b814a48c94cf07e

+ 23 - 0
include/pom.xml

@@ -0,0 +1,23 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.leumasjaffe</groupId>
+  <artifactId>d20-charsheet-aggregator</artifactId>
+  <version>0.1</version>
+  <packaging>pom</packaging>
+
+  <!-- FIXME change it to the project's website -->
+  <url>http://maven.apache.org</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <modules>
+    <module>event</module>
+    <module>graphics</module>
+    <module>observer</module>
+    <module>..</module>
+  </modules>
+</project>

+ 181 - 149
pom.xml

@@ -1,151 +1,183 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<groupId>samjaffe</groupId>
-	<artifactId>d20-charsheet</artifactId>
-	<version>0.0.1-SNAPSHOT</version>
-	<properties>
-		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-	</properties>
-	<build>
-		<pluginManagement>
-			<plugins>
-				<plugin>
-					<groupId>org.eclipse.m2e</groupId>
-					<artifactId>lifecycle-mapping</artifactId>
-					<version>1.0.0</version>
-					<configuration>
-						<lifecycleMappingMetadata>
-							<pluginExecutions>
-								<pluginExecution>
-									<pluginExecutionFilter>
-										<groupId>org.projectlombok</groupId>
-										<artifactId>lombok-maven-plugin</artifactId>
-										<versionRange>[1,)</versionRange>
-										<goals>
-											<goal>delombok</goal>
-										</goals>
-									</pluginExecutionFilter>
-									<action>
-										<ignore />
-									</action>
-								</pluginExecution>
-							</pluginExecutions>
-						</lifecycleMappingMetadata>
-					</configuration>
-				</plugin>
-			</plugins>
-		</pluginManagement>
-		<sourceDirectory>target/generated-sources/delombok</sourceDirectory>
-		<plugins>
-			<plugin>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>3.5.1</version>
-				<configuration>
-					<compilerVersion>1.8</compilerVersion>
-					<source>1.8</source>
-					<target>1.8</target>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.projectlombok</groupId>
-				<artifactId>lombok-maven-plugin</artifactId>
-				<version>1.16.18.0</version>
-				<executions>
-					<execution>
-						<id>delombok</id>
-						<phase>generate-sources</phase>
-						<goals>
-							<goal>delombok</goal>
-						</goals>
-					</execution>
-				</executions>
-				<configuration>
-					<addOutputDirectory>false</addOutputDirectory>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-jar-plugin</artifactId>
-				<version>2.4</version>
-				<configuration>
-					<archive>
-						<manifest>
-							<addClasspath>true</addClasspath>
-							<mainClass>org.leumasjaffe.charsheet.Test</mainClass>
-							<classpathPrefix>dependency-jars/</classpathPrefix>
-						</manifest>
-					</archive>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-dependency-plugin</artifactId>
-				<version>2.5.1</version>
-				<executions>
-					<execution>
-						<id>copy-dependencies</id>
-						<phase>package</phase>
-						<goals>
-							<goal>copy-dependencies</goal>
-						</goals>
-						<configuration>
-							<outputDirectory>
-								${project.build.directory}/dependency-jars/
-							</outputDirectory>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
-		</plugins>
-	</build>
-	<dependencies>
-		<dependency>
-			<groupId>org.projectlombok</groupId>
-			<artifactId>lombok</artifactId>
-			<version>1.16.8</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>com.fasterxml.jackson.core</groupId>
-			<artifactId>jackson-annotations</artifactId>
-			<version>2.7.3</version>
-		</dependency>
-		<dependency>
-			<groupId>com.fasterxml.jackson.core</groupId>
-			<artifactId>jackson-databind</artifactId>
-			<version>2.7.3</version>
-		</dependency>
-		<dependency>
-			<groupId>com.google.guava</groupId>
-			<artifactId>guava</artifactId>
-			<version>19.0</version>
-		</dependency>
-		<dependency>
-			<groupId>com.fasterxml.jackson.datatype</groupId>
-			<artifactId>jackson-datatype-jdk8</artifactId>
-			<version>2.7.3</version>
-		</dependency>
-		<dependency>
-			<groupId>org.swinglabs</groupId>
-			<artifactId>swingx</artifactId>
-			<version>1.6.1</version>
-		</dependency>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<version>4.12</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.logging.log4j</groupId>
-			<artifactId>log4j-api</artifactId>
-			<version>2.8.2</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.logging.log4j</groupId>
-			<artifactId>log4j-core</artifactId>
-			<version>2.8.2</version>
-		</dependency>
-	</dependencies>
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>d20-charsheet</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.eclipse.m2e</groupId>
+          <artifactId>lifecycle-mapping</artifactId>
+          <version>1.0.0</version>
+          <configuration>
+            <lifecycleMappingMetadata>
+              <pluginExecutions>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.projectlombok</groupId>
+                    <artifactId>lombok-maven-plugin</artifactId>
+                    <versionRange>[1,)</versionRange>
+                    <goals>
+                      <goal>delombok</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore />
+                  </action>
+                </pluginExecution>
+              </pluginExecutions>
+            </lifecycleMappingMetadata>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <sourceDirectory>target/generated-sources/delombok</sourceDirectory>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.5.1</version>
+        <configuration>
+          <compilerVersion>1.8</compilerVersion>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.projectlombok</groupId>
+        <artifactId>lombok-maven-plugin</artifactId>
+        <version>1.16.18.0</version>
+        <executions>
+          <execution>
+            <id>delombok</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>delombok</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <addOutputDirectory>false</addOutputDirectory>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.4</version>
+        <configuration>
+          <archive>
+            <manifest>
+              <addClasspath>true</addClasspath>
+              <mainClass>org.leumasjaffe.charsheet.Test</mainClass>
+              <classpathPrefix>dependency-jars/</classpathPrefix>
+            </manifest>
+          </archive>
+          <descriptorRefs>
+            <descriptorRef>jar-with-dependencies</descriptorRef>
+          </descriptorRefs>
+        </configuration>
+        <executions>
+          <execution>
+            <id>make-assembly</id> <!-- this is used for inheritance merges -->
+            <phase>package</phase> <!-- bind to the packaging phase -->
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>2.5.1</version>
+        <executions>
+          <execution>
+            <id>copy-dependencies</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy-dependencies</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>
+                ${project.build.directory}/dependency-jars/
+              </outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.projectlombok</groupId>
+      <artifactId>lombok</artifactId>
+      <version>1.16.8</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+      <version>2.7.3</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>2.7.3</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <version>19.0</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.datatype</groupId>
+      <artifactId>jackson-datatype-jdk8</artifactId>
+      <version>2.7.3</version>
+    </dependency>
+    <dependency>
+      <groupId>org.swinglabs</groupId>
+      <artifactId>swingx</artifactId>
+      <version>1.6.1</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <version>2.8.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <version>2.8.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.leumasjaffe</groupId>
+      <artifactId>event</artifactId>
+      <version>0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.leumasjaffe</groupId>
+      <artifactId>graphics</artifactId>
+      <version>0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.leumasjaffe</groupId>
+      <artifactId>observer</artifactId>
+      <version>0.1</version>
+    </dependency>
+  </dependencies>
+  <parent>
+    <groupId>org.leumasjaffe</groupId>
+    <artifactId>d20-charsheet-aggregator</artifactId>
+    <version>0.1</version>
+    <relativePath>include/pom.xml</relativePath>
+  </parent>
 </project>

+ 0 - 83
src/main/lombok/org/leumasjaffe/event/AnyActionDocumentListener.java

@@ -1,83 +0,0 @@
-package org.leumasjaffe.event;
-
-import java.beans.PropertyChangeEvent;
-import java.util.Objects;
-import java.util.function.Consumer;
-
-import javax.swing.SwingUtilities;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.text.Document;
-import javax.swing.text.JTextComponent;
-
-@FunctionalInterface
-public interface AnyActionDocumentListener extends DocumentListener {
-
-	public void update(DocumentEvent e);
-	
-	public default void insertUpdate(DocumentEvent e) { this.update(e); }
-    public default void removeUpdate(DocumentEvent e) { this.update(e); }
-    public default void changedUpdate(DocumentEvent e) { this.update(e); }
-    
-    public static void skipEmpty(final JTextComponent text, 
-    		final Consumer<ChangeEvent> in) {
-    	addChangeListener(text, e -> {
-    		if (text.getText().trim().isEmpty()) { return; }
-    		in.accept(e);
-    	});
-    }
-    
-    public static void emptyOrText(final JTextComponent text, 
-    		final Consumer<ChangeEvent> empty,
-    		final Consumer<ChangeEvent> in) {
-    	addChangeListener(text, e -> {
-    		if (text.getText().trim().isEmpty()) { empty.accept(e); }
-    		else { in.accept(e); }
-    	});
-    }
-    
-    /**
-	 * Installs a listener to receive notification when the text of any
-	 * {@code JTextComponent} is changed. Internally, it installs a
-	 * {@link DocumentListener} on the text component's {@link Document},
-	 * and a {@link PropertyChangeListener} on the text component to detect
-	 * if the {@code Document} itself is replaced.
-	 * 
-	 * @param text any text component, such as a {@link JTextField}
-	 *        or {@link JTextArea}
-	 * @param changeListener a listener to receieve {@link ChangeEvent}s
-	 *        when the text is changed; the source object for the events
-	 *        will be the text component
-	 * @throws NullPointerException if either parameter is null
-	 */
-	public static void addChangeListener(final JTextComponent text, 
-			final ChangeListener changeListener) {
-	    Objects.requireNonNull(text);
-	    Objects.requireNonNull(changeListener);
-	    final DocumentListener dl = new AnyActionDocumentListener() {
-	        private int lastChange = 0, lastNotifiedChange = 0;
-
-	        @Override
-	        public void update(DocumentEvent e) {
-	            lastChange++;
-	            SwingUtilities.invokeLater(() -> {
-	                if (lastNotifiedChange != lastChange) {
-	                    lastNotifiedChange = lastChange;
-	                    changeListener.stateChanged(new ChangeEvent(text));
-	                }
-	            });
-	        }
-	    };
-	    text.addPropertyChangeListener("document", (PropertyChangeEvent e) -> {
-	        Document d1 = (Document)e.getOldValue();
-	        Document d2 = (Document)e.getNewValue();
-	        if (d1 != null) d1.removeDocumentListener(dl);
-	        if (d2 != null) d2.addDocumentListener(dl);
-	        dl.changedUpdate(null);
-	    });
-	    Document d = text.getDocument();
-	    if (d != null) d.addDocumentListener(dl);
-	}
-}

+ 0 - 32
src/main/lombok/org/leumasjaffe/event/PopClickListener.java

@@ -1,32 +0,0 @@
-package org.leumasjaffe.event;
-
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
-import javax.swing.JPopupMenu;
-
-import lombok.AccessLevel;
-import lombok.RequiredArgsConstructor;
-import lombok.experimental.FieldDefaults;
-
-@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
-@RequiredArgsConstructor
-public class PopClickListener extends MouseAdapter {
-	JPopupMenu popup;
-	
-	public void mousePressed(MouseEvent e){
-		if (e.isPopupTrigger()) {
-			doPop(e);
-		}
-	}
-
-	public void mouseReleased(MouseEvent e){
-		if (e.isPopupTrigger()) {
-			doPop(e);
-		}
-	}
-
-	private void doPop(MouseEvent e){
-		popup.show(e.getComponent(), e.getX(), e.getY());
-	}
-}

+ 0 - 36
src/main/lombok/org/leumasjaffe/event/SelectTableRowPopupMenuListener.java

@@ -1,36 +0,0 @@
-package org.leumasjaffe.event;
-
-import java.awt.Point;
-
-import javax.swing.JPopupMenu;
-import javax.swing.JTable;
-import javax.swing.SwingUtilities;
-import javax.swing.event.PopupMenuEvent;
-import javax.swing.event.PopupMenuListener;
-
-import lombok.AllArgsConstructor;
-
-@AllArgsConstructor
-public final class SelectTableRowPopupMenuListener implements PopupMenuListener {
-	JPopupMenu popupMenu;
-	JTable table;
-
-	@Override
-	public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
-	    SwingUtilities.invokeLater(new Runnable() {
-	        @Override
-	        public void run() {
-	            int rowAtPoint = table.rowAtPoint(SwingUtilities.convertPoint(popupMenu, new Point(0, 0), table));
-	            if (rowAtPoint > -1) {
-	            	table.setRowSelectionInterval(rowAtPoint, rowAtPoint);
-	            }
-	        }
-	    });
-	}
-
-	@Override
-	public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {}
-
-	@Override
-	public void popupMenuCanceled(PopupMenuEvent e) {}
-}

+ 0 - 46
src/main/lombok/org/leumasjaffe/graphics/NumberTextField.java

@@ -1,46 +0,0 @@
-package org.leumasjaffe.graphics;
-
-import java.awt.event.FocusEvent;
-import java.text.NumberFormat;
-
-import javax.swing.JFormattedTextField;
-import javax.swing.text.NumberFormatter;
-
-public class NumberTextField extends JFormattedTextField {
-	
-	 /**
-	 * 
-	 */
-	private static final long serialVersionUID = 1L;
-
-	private static final NumberFormatter getNumberFormatInstance(int min, int max) {
-		NumberFormat format = NumberFormat.getInstance();
-	    NumberFormatter formatter = new NumberFormatter(format);
-	    formatter.setValueClass(Integer.class);
-	    formatter.setMinimum(min);
-	    formatter.setMaximum(max);
-	    formatter.setAllowsInvalid(true);
-	    return formatter;
-	}
-
-	public NumberTextField() {
-		super(getNumberFormatInstance(0, Integer.MAX_VALUE));
-	}
-	
-	public NumberTextField(int min, int max) {
-		super(getNumberFormatInstance(min, max));
-	}
-	
-	@Override
-	protected void processFocusEvent(FocusEvent e) {
-	    String text = getText();
-
-	    super.processFocusEvent(e);
-
-	    if ((text == null || text.length() == 0) &&
-	        getValue() != null)
-	        setValue(null);
-	}
-
-
-}

+ 0 - 35
src/main/lombok/org/leumasjaffe/observer/IndirectObservableListener.java

@@ -1,35 +0,0 @@
-package org.leumasjaffe.observer;
-
-import java.util.Objects;
-import java.util.function.BiConsumer;
-
-import lombok.experimental.FieldDefaults;
-import lombok.experimental.NonFinal;
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
-@Getter(value=AccessLevel.PACKAGE)
-@RequiredArgsConstructor
-public class IndirectObservableListener<C, T> {
-	C component;
-	BiConsumer<? super C, ? super T> update;
-
-	@NonFinal T model = null;
-	
-	public void setObserved( T obs, Observable... extra ) {
-		Objects.requireNonNull( obs );
-		if ( obs == model ) return;
-		ObserverDispatch.unsubscribeAll( this );
-		model = obs;
-		updateComponent( );
-		for ( int i = 0; i < extra.length; ++i ) {
-			ObserverDispatch.subscribe( extra[i], this, () -> updateComponent( ) );
-		}
-	}
-
-	private void updateComponent() {
-		update.accept(component, model);
-	}
-}

+ 0 - 7
src/main/lombok/org/leumasjaffe/observer/Observable.java

@@ -1,7 +0,0 @@
-package org.leumasjaffe.observer;
-
-import java.util.UUID;
-
-public class Observable {
-	public final transient UUID observableId = UUID.randomUUID();
-}

+ 0 - 45
src/main/lombok/org/leumasjaffe/observer/ObservableController.java

@@ -1,45 +0,0 @@
-package org.leumasjaffe.observer;
-
-import java.util.Objects;
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
-
-import javax.swing.text.JTextComponent;
-
-import org.leumasjaffe.event.AnyActionDocumentListener;
-import org.leumasjaffe.observer.helper.Helper;
-
-import lombok.experimental.FieldDefaults;
-import lombok.AccessLevel;
-
-@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
-public class ObservableController<S extends JTextComponent, T extends Observable> extends ObservableListener<S, T> {
-	Helper<T> func;
-
-	public ObservableController(final S comp, final Helper<T> func,
-			final BiConsumer<? super S, ? super T> update) {
-		super(comp, update);
-		this.func = func;
-		AnyActionDocumentListener.skipEmpty(comp, evt -> accept( ) );
-	}
-	
-	public ObservableController(final S comp, final Helper<T> func,
-			final BiConsumer<? super S, ? super T> update, final Consumer<T> onEmpty) {
-		super(comp, update);
-		this.func = func;
-		AnyActionDocumentListener.emptyOrText( comp, 
-				e -> onEmpty.accept( impl.getModel() ), 
-				evt -> accept( ) );
-	}
-
-	private boolean update() {
-		return func.apply( impl.getComponent().getText( ), impl.getModel() );
-	}
-
-	private void accept() {
-		Objects.requireNonNull( impl.getModel() );
-		if ( update( ) ) {
-			ObserverDispatch.notifySubscribers( impl.getModel(), this );
-		}
-	}
-}

+ 0 - 19
src/main/lombok/org/leumasjaffe/observer/ObservableListener.java

@@ -1,19 +0,0 @@
-package org.leumasjaffe.observer;
-
-import java.util.function.BiConsumer;
-
-import lombok.AccessLevel;
-import lombok.experimental.FieldDefaults;
-
-@FieldDefaults(level=AccessLevel.PROTECTED, makeFinal=true)
-public class ObservableListener<C, T extends Observable> {
-	IndirectObservableListener<C, T> impl;
-	
-	public ObservableListener(final C comp, final BiConsumer<? super C, ? super T> func) {
-		impl = new IndirectObservableListener<>(comp, func);
-	}
-	
-	public void setObserved( T obs ) {
-		impl.setObserved(obs, obs);
-	}
-}

+ 0 - 39
src/main/lombok/org/leumasjaffe/observer/ObserverDispatch.java

@@ -1,39 +0,0 @@
-package org.leumasjaffe.observer;
-
-import java.lang.ref.WeakReference;
-import java.util.UUID;
-
-import com.google.common.collect.LinkedListMultimap;
-import com.google.common.collect.Multimap;
-
-import lombok.AccessLevel;
-import lombok.AllArgsConstructor;
-import lombok.experimental.FieldDefaults;
-import lombok.experimental.UtilityClass;
-
-@UtilityClass
-@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
-public class ObserverDispatch {
-	@AllArgsConstructor
-	@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
-	private static class Pair {
-		WeakReference<Object> obj;
-		Subscriber sub;
-	}
-	
-	Multimap<UUID, Pair> observers = LinkedListMultimap.create();
-	
-	public void subscribe(Observable target, Object src, Subscriber sub) {
-		observers.put(target.observableId, new Pair(new WeakReference<>(src), sub));
-	}
-	
-	public void unsubscribeAll(Object src) {
-		if (src == null) return;
-		observers.entries().removeIf( e -> e.getValue().obj == src );
-	}
-	
-	public void notifySubscribers(Observable target, Object src) {
-		observers.get(target.observableId).stream().filter( p -> p.obj.get() != src ).forEach( 
-				p -> p.sub.notifyUpdate() );
-	}
-}

+ 0 - 6
src/main/lombok/org/leumasjaffe/observer/Subscriber.java

@@ -1,6 +0,0 @@
-package org.leumasjaffe.observer;
-
-@FunctionalInterface
-public interface Subscriber {
-	public void notifyUpdate();
-}

+ 0 - 10
src/main/lombok/org/leumasjaffe/observer/helper/Helper.java

@@ -1,10 +0,0 @@
-package org.leumasjaffe.observer.helper;
-
-import java.util.function.BiFunction;
-
-import org.leumasjaffe.observer.Observable;
-
-//  @FunctionalInterface
-  public interface Helper<T extends Observable> extends BiFunction<String, T, Boolean> {
-//    public boolean update( final String str, final T ref );
-  }

+ 0 - 9
src/main/lombok/org/leumasjaffe/observer/helper/Stringify.java

@@ -1,9 +0,0 @@
-package org.leumasjaffe.observer.helper;
-
-import java.util.function.Function;
-
-public class Stringify implements Function<Object, String> {
-	public String apply(Object t) {
-		return t.toString();
-	}
-  }