use of suite.primitive.DblPrimitives.DblSource in project suite by stupidsing.
the class DblFunUtil method suck.
/**
* Sucks data from a sink and produce into a source.
*/
public static DblSource suck(Sink<DblSink> fun) {
NullableSyncQueue<Double> queue = new NullableSyncQueue<>();
DblSink 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.DblPrimitives.DblSource in project suite by stupidsing.
the class DblSet method forEach.
public void forEach(DblSink sink) {
DblSource source = source_();
double c;
while ((c = source.source()) != DblFunUtil.EMPTYVALUE) sink.sink(c);
}
use of suite.primitive.DblPrimitives.DblSource in project suite by stupidsing.
the class DblOutlet method equals.
@Override
public boolean equals(Object object) {
if (Object_.clazz(object) == DblOutlet.class) {
DblSource source1 = ((DblOutlet) object).source;
double o0, o1;
while (Objects.equals(o0 = source.source(), o1 = source1.source())) if (o0 == DblFunUtil.EMPTYVALUE && o1 == DblFunUtil.EMPTYVALUE)
return true;
return false;
} else
return false;
}
Aggregations