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