[DEV] commit all with new insland

This commit is contained in:
Edouard DUPIN 2022-03-20 23:39:36 +01:00
parent d7eec826cf
commit 44b4062903
4 changed files with 38 additions and 24 deletions

View File

@ -27,5 +27,10 @@
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/atriasoft-etk/lib/spotbugs-annotations-4.2.2.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="out/eclipse/classes"/>
</classpath>

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
/__pycache__/
# ---> Java
# Compiled class file
*.class

View File

@ -21,4 +21,15 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
<filteredResources>
<filter>
<id>1646149232191</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>

View File

@ -28,6 +28,26 @@ import edu.umd.cs.findbugs.annotations.CheckReturnValue;
*
*/
public class ISignal<T> extends GenericSignalInstrumented<Consumer<T>, BiConsumer<Object, T>> {
@CheckReturnValue
@SuppressWarnings("unchecked")
public <V> Connection connect(final V object, final BiConsumer<V, T> function) {
return connect(object, (final Object obj, final T value) -> {
function.accept((V) obj, value);
});
}
/**
* Connect to the signal and automatically disconnect when the object is removed
* @param object Object to check if remove to continue keeping the signal active (Keep a WeakReference on it only)
* @param function Function to connect (Keep a WeakReference on it only)
*/
@SuppressWarnings("unchecked")
public <V> void connectAuto(final V object, final BiConsumer<V, T> function) {
connectAuto(object, (final Object obj, final T value) -> {
function.accept((V) obj, value);
});
}
/**
* Emit a signal on all element connect (and clean the list of unlinked elements).
* @param value Value to set in parameter.
@ -58,28 +78,4 @@ public class ISignal<T> extends GenericSignalInstrumented<Consumer<T>, BiConsume
}
}
}
/**
* Connect to the signal and automatically disconnect when the object is removed
* @param object Object to check if remove to continue keeping the signal active (Keep a WeakReference on it only)
* @param function Function to connect (Keep a WeakReference on it only)
*/
@SuppressWarnings("unchecked")
public <V> void connectAuto(final V object, final BiConsumer<V, T> function) {
connectAuto(object,
(final Object obj, final T value) -> {
function.accept((V)obj, value);
});
}
@CheckReturnValue
@SuppressWarnings("unchecked")
public <V> Connection connect(final V object, final BiConsumer<V, T> function) {
return connect(object,
(final Object obj, final T value) -> {
function.accept((V)obj, value);
});
}
}