use of suite.primitive.FltPrimitives.FltSource in project suite by stupidsing.
the class FltFunUtil method suck.
/**
* Sucks data from a sink and produce into a source.
*/
public static FltSource suck(Sink<FltSink> fun) {
NullableSyncQueue<Float> queue = new NullableSyncQueue<>();
FltSink enqueue = c -> enqueue(queue, c);
Thread thread = Thread_.startThread(() -> {
try {
fun.sink(enqueue);
} finally {
enqueue(queue, EMPTYVALUE);
}
});
return () -> {
try {
return queue.take();
} catch (InterruptedException ex) {
thread.interrupt();
return Fail.t(ex);
}
};
}
use of suite.primitive.FltPrimitives.FltSource in project suite by stupidsing.
the class FltOutlet method equals.
@Override
public boolean equals(Object object) {
if (Object_.clazz(object) == FltOutlet.class) {
FltSource source1 = ((FltOutlet) object).source;
float o0, o1;
while (Objects.equals(o0 = source.source(), o1 = source1.source())) if (o0 == FltFunUtil.EMPTYVALUE && o1 == FltFunUtil.EMPTYVALUE)
return true;
return false;
} else
return false;
}
use of suite.primitive.FltPrimitives.FltSource in project suite by stupidsing.
the class FltSet method forEach.
public void forEach(FltSink sink) {
FltSource source = source_();
float c;
while ((c = source.source()) != FltFunUtil.EMPTYVALUE) sink.sink(c);
}
Aggregations