mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-05 23:36:12 +00:00
Cleanup
This commit is contained in:
@@ -28,11 +28,39 @@ import com.volmit.iris.util.function.Function3;
|
||||
import com.volmit.iris.util.function.Function4;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.stream.arithmetic.*;
|
||||
import com.volmit.iris.util.stream.convert.*;
|
||||
import com.volmit.iris.util.stream.arithmetic.AddingStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.ClampedStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.CoordinateBitShiftLeftStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.CoordinateBitShiftRightStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.DividingStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.FittedStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.MaxingStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.MinningStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.ModuloStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.MultiplyingStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.OffsetStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.RadialStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.RoundingDoubleStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.SlopeStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.SubtractingStream;
|
||||
import com.volmit.iris.util.stream.arithmetic.ZoomStream;
|
||||
import com.volmit.iris.util.stream.convert.AwareConversionStream2D;
|
||||
import com.volmit.iris.util.stream.convert.AwareConversionStream3D;
|
||||
import com.volmit.iris.util.stream.convert.CachedConversionStream;
|
||||
import com.volmit.iris.util.stream.convert.ConversionStream;
|
||||
import com.volmit.iris.util.stream.convert.ForceDoubleStream;
|
||||
import com.volmit.iris.util.stream.convert.RoundingStream;
|
||||
import com.volmit.iris.util.stream.convert.SelectionStream;
|
||||
import com.volmit.iris.util.stream.convert.SignificanceStream;
|
||||
import com.volmit.iris.util.stream.convert.To3DStream;
|
||||
import com.volmit.iris.util.stream.interpolation.Interpolated;
|
||||
import com.volmit.iris.util.stream.sources.FunctionStream;
|
||||
import com.volmit.iris.util.stream.utility.*;
|
||||
import com.volmit.iris.util.stream.utility.CachedStream2D;
|
||||
import com.volmit.iris.util.stream.utility.CachedStream3D;
|
||||
import com.volmit.iris.util.stream.utility.NullSafeStream;
|
||||
import com.volmit.iris.util.stream.utility.ProfiledStream;
|
||||
import com.volmit.iris.util.stream.utility.SemaphoreStream;
|
||||
import com.volmit.iris.util.stream.utility.SynchronizedStream;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -38,18 +38,6 @@ public interface Interpolated<T> {
|
||||
Interpolated<Long> LONG = of(Double::valueOf, Double::longValue);
|
||||
Interpolated<UUID> UUID = of((i) -> Double.longBitsToDouble(i.getMostSignificantBits()), (i) -> new UUID(Double.doubleToLongBits(i), i.longValue()));
|
||||
|
||||
double toDouble(T t);
|
||||
|
||||
T fromDouble(double d);
|
||||
|
||||
default InterpolatorFactory<T> interpolate() {
|
||||
if (this instanceof ProceduralStream) {
|
||||
return new InterpolatorFactory<>((ProceduralStream<T>) this);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static <T> Interpolated<T> of(Function<T, Double> a, Function<Double, T> b) {
|
||||
return new Interpolated<>() {
|
||||
@Override
|
||||
@@ -63,4 +51,16 @@ public interface Interpolated<T> {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
double toDouble(T t);
|
||||
|
||||
T fromDouble(double d);
|
||||
|
||||
default InterpolatorFactory<T> interpolate() {
|
||||
if (this instanceof ProceduralStream) {
|
||||
return new InterpolatorFactory<>((ProceduralStream<T>) this);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,50 +41,6 @@ public class ProfiledStream<T> extends BasicStream<T> {
|
||||
this.id = ids.getAndAdd(1);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t) {
|
||||
return getTypedSource().toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d) {
|
||||
return getTypedSource().fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z) {
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
T t = getTypedSource().get(x, z);
|
||||
try {
|
||||
metrics.put(p.getMilliseconds());
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z) {
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
T t = getTypedSource().get(x, y, z);
|
||||
try {
|
||||
metrics.put(p.getMilliseconds());
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
public RollingSequence getMetrics() {
|
||||
return metrics;
|
||||
}
|
||||
|
||||
public static void print(Consumer<String> printer, ProceduralStream<?> stream) {
|
||||
KList<ProfiledTail> tails = getTails(stream);
|
||||
int ind = tails.size();
|
||||
@@ -154,12 +110,56 @@ public class ProfiledStream<T> extends BasicStream<T> {
|
||||
return tailx;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t) {
|
||||
return getTypedSource().toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d) {
|
||||
return getTypedSource().fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z) {
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
T t = getTypedSource().get(x, z);
|
||||
try {
|
||||
metrics.put(p.getMilliseconds());
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z) {
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
T t = getTypedSource().get(x, y, z);
|
||||
try {
|
||||
metrics.put(p.getMilliseconds());
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
public RollingSequence getMetrics() {
|
||||
return metrics;
|
||||
}
|
||||
|
||||
@Data
|
||||
private static class ProfiledTail {
|
||||
private final int id;
|
||||
private final RollingSequence metrics;
|
||||
private ProfiledTail child;
|
||||
private final String name;
|
||||
private ProfiledTail child;
|
||||
|
||||
public ProfiledTail(int id, RollingSequence metrics, String name) {
|
||||
this.id = id;
|
||||
|
||||
Reference in New Issue
Block a user