org.aksw.commons.rx.op.LocalOrderSpecImpl Maven / Gradle / Ivy
package org.aksw.commons.rx.op;
import java.util.function.BiFunction;
import java.util.function.Function;
public class LocalOrderSpecImpl
extends LocalOrderBase
implements LocalOrderSpec
{
public LocalOrderSpecImpl(
Function super S, ? extends S> incrementSeqId,
BiFunction super S, ? super S, ? extends Number> distanceFn,
Function super T, ? extends S> extractSeqId
) {
super(incrementSeqId, distanceFn, extractSeqId);
}
@Override
public Function super S, ? extends S> getIncrementSeqId() {
return incrementSeqId;
}
@Override
public BiFunction super S, ? super S, ? extends Number> getDistanceFn() {
return distanceFn;
}
@Override
public Function super T, ? extends S> getExtractSeqId() {
return extractSeqId;
}
public static LocalOrderSpecImpl forLong(Function super T, ? extends Long> extractSeqId) {
return new LocalOrderSpecImpl(
id -> Long.valueOf(id.longValue() + 1l),
(a, b) -> a - b,
extractSeqId);
}
public static > LocalOrderSpecImpl wrap(Function super S, ? extends S> incrementSeqId, BiFunction super S, ? super S, ? extends Number> distanceFn, Function super T, ? extends S> extractSeqId) {
return new LocalOrderSpecImpl(incrementSeqId, distanceFn, extractSeqId);
}
public static > LocalOrderSpecImpl create(
S initialExpectedSeqId,
Function super S, ? extends S> incrementSeqId,
BiFunction super S, ? super S, ? extends Number> distanceFn,
Function super T, ? extends S> extractSeqId) {
return new LocalOrderSpecImpl(incrementSeqId, distanceFn, extractSeqId);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy