9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-29 20:19:06 +00:00

Schema system

This commit is contained in:
Daniel Mills
2020-08-08 18:56:01 -04:00
parent 4132c0552f
commit 185d0d8817
34 changed files with 1325 additions and 147 deletions

View File

@@ -0,0 +1,16 @@
package com.volmit.iris.util;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Retention(RUNTIME)
@Target({PARAMETER, TYPE, FIELD})
public @interface ArrayType
{
Class<?> type();
int min() default 0;
}

View File

@@ -0,0 +1,14 @@
package com.volmit.iris.util;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Retention(RUNTIME)
@Target({FIELD})
public @interface MaxNumber
{
double value();
}

View File

@@ -0,0 +1,14 @@
package com.volmit.iris.util;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Retention(RUNTIME)
@Target({FIELD})
public @interface MinNumber
{
double value();
}

View File

@@ -10,6 +10,7 @@ public class RNG extends Random
private static final long serialVersionUID = 5222938581174415179L;
public static final RNG r = new RNG();
private final long sx;
public RNG()
{
super();
@@ -32,12 +33,12 @@ public class RNG extends Random
{
this(UUID.nameUUIDFromBytes(seed.getBytes(StandardCharsets.UTF_8)).getLeastSignificantBits() + UUID.nameUUIDFromBytes(seed.getBytes(StandardCharsets.UTF_8)).getMostSignificantBits() + (seed.length() * 32564));
}
public RNG nextParallelRNG(int signature)
{
return new RNG(sx + signature);
}
@Deprecated
public RNG nextRNG()
{
@@ -116,7 +117,7 @@ public class RNG extends Random
public double d(double lowerBound, double upperBound)
{
return lowerBound + (nextDouble() * ((upperBound - lowerBound)));
return M.lerp(lowerBound, upperBound, nextDouble());
}
public double d(double upperBound)
@@ -136,7 +137,7 @@ public class RNG extends Random
public int i(int upperBound)
{
return i(0, upperBound);
return i(Math.min(upperBound, 0), Math.max(0, upperBound));
}
public long l(long lowerBound, long upperBound)

View File

@@ -0,0 +1,14 @@
package com.volmit.iris.util;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Retention(RUNTIME)
@Target({PARAMETER, TYPE, FIELD})
public @interface Required
{
}