mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Update number handlers
This commit is contained in:
parent
ef447e2ba1
commit
353c40cc46
@ -24,6 +24,8 @@ import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class DoubleHandler implements DecreeParameterHandler<Double> {
|
||||
@Override
|
||||
public KList<Double> getPossibilities() {
|
||||
@ -34,7 +36,9 @@ public class DoubleHandler implements DecreeParameterHandler<Double> {
|
||||
public Double parse(String in) throws DecreeParsingException {
|
||||
try
|
||||
{
|
||||
return Double.parseDouble(in);
|
||||
AtomicReference<String> r = new AtomicReference<>(in);
|
||||
double m = getMultiplier(r);
|
||||
return Double.parseDouble(r.get()) * m;
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
|
@ -24,6 +24,8 @@ import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class FloatHandler implements DecreeParameterHandler<Float> {
|
||||
@Override
|
||||
public KList<Float> getPossibilities() {
|
||||
@ -34,7 +36,9 @@ public class FloatHandler implements DecreeParameterHandler<Float> {
|
||||
public Float parse(String in) throws DecreeParsingException {
|
||||
try
|
||||
{
|
||||
return Float.parseFloat(in);
|
||||
AtomicReference<String> r = new AtomicReference<>(in);
|
||||
double m = getMultiplier(r);
|
||||
return (float)(Float.parseFloat(r.get()) * m);
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
|
@ -24,6 +24,9 @@ import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class IntegerHandler implements DecreeParameterHandler<Integer> {
|
||||
@Override
|
||||
public KList<Integer> getPossibilities() {
|
||||
@ -34,7 +37,9 @@ public class IntegerHandler implements DecreeParameterHandler<Integer> {
|
||||
public Integer parse(String in) throws DecreeParsingException {
|
||||
try
|
||||
{
|
||||
return Integer.parseInt(in);
|
||||
AtomicReference<String> r = new AtomicReference<>(in);
|
||||
double m = getMultiplier(r);
|
||||
return (int)(Integer.valueOf(r.get()).doubleValue() * m);
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
|
@ -23,6 +23,8 @@ import com.volmit.iris.util.decree.DecreeParameterHandler;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class LongHandler implements DecreeParameterHandler<Long> {
|
||||
@Override
|
||||
public KList<Long> getPossibilities() {
|
||||
@ -33,7 +35,9 @@ public class LongHandler implements DecreeParameterHandler<Long> {
|
||||
public Long parse(String in) throws DecreeParsingException {
|
||||
try
|
||||
{
|
||||
return Long.parseLong(in);
|
||||
AtomicReference<String> r = new AtomicReference<>(in);
|
||||
double m = getMultiplier(r);
|
||||
return (long)(Long.valueOf(r.get()).doubleValue() * m);
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
|
@ -23,6 +23,8 @@ import com.volmit.iris.util.decree.DecreeParameterHandler;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class ShortHandler implements DecreeParameterHandler<Short> {
|
||||
@Override
|
||||
public KList<Short> getPossibilities() {
|
||||
@ -33,7 +35,9 @@ public class ShortHandler implements DecreeParameterHandler<Short> {
|
||||
public Short parse(String in) throws DecreeParsingException {
|
||||
try
|
||||
{
|
||||
return Short.parseShort(in);
|
||||
AtomicReference<String> r = new AtomicReference<>(in);
|
||||
double m = getMultiplier(r);
|
||||
return (short)(Short.valueOf(r.get()).doubleValue() * m);
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user