Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 18:40:05 +01:00
Moved megabuf to the Functions class
Dieser Commit ist enthalten in:
Ursprung
aef3b0024a
Commit
4fa5daf974
@ -29,6 +29,7 @@ import com.sk89q.worldedit.expression.lexer.tokens.Token;
|
|||||||
import com.sk89q.worldedit.expression.parser.Parser;
|
import com.sk89q.worldedit.expression.parser.Parser;
|
||||||
import com.sk89q.worldedit.expression.runtime.Constant;
|
import com.sk89q.worldedit.expression.runtime.Constant;
|
||||||
import com.sk89q.worldedit.expression.runtime.EvaluationException;
|
import com.sk89q.worldedit.expression.runtime.EvaluationException;
|
||||||
|
import com.sk89q.worldedit.expression.runtime.Functions;
|
||||||
import com.sk89q.worldedit.expression.runtime.RValue;
|
import com.sk89q.worldedit.expression.runtime.RValue;
|
||||||
import com.sk89q.worldedit.expression.runtime.ReturnException;
|
import com.sk89q.worldedit.expression.runtime.ReturnException;
|
||||||
import com.sk89q.worldedit.expression.runtime.Variable;
|
import com.sk89q.worldedit.expression.runtime.Variable;
|
||||||
@ -63,7 +64,7 @@ public class Expression {
|
|||||||
private final Map<String, RValue> variables = new HashMap<String, RValue>();
|
private final Map<String, RValue> variables = new HashMap<String, RValue>();
|
||||||
private final String[] variableNames;
|
private final String[] variableNames;
|
||||||
private RValue root;
|
private RValue root;
|
||||||
private final Map<Integer, double[]> megabuf = new HashMap<Integer, double[]>();
|
private final Functions functions = new Functions();
|
||||||
|
|
||||||
public static Expression compile(String expression, String... variableNames) throws ExpressionException {
|
public static Expression compile(String expression, String... variableNames) throws ExpressionException {
|
||||||
return new Expression(expression, variableNames);
|
return new Expression(expression, variableNames);
|
||||||
@ -153,7 +154,7 @@ public class Expression {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, double[]> getMegabuf() {
|
public Functions getFunctions() {
|
||||||
return megabuf;
|
return functions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,6 +277,7 @@ public final class Functions {
|
|||||||
|
|
||||||
|
|
||||||
private static final Map<Integer, double[]> gmegabuf = new HashMap<Integer, double[]>();
|
private static final Map<Integer, double[]> gmegabuf = new HashMap<Integer, double[]>();
|
||||||
|
private final Map<Integer, double[]> megabuf = new HashMap<Integer, double[]>();
|
||||||
|
|
||||||
private static double[] getSubBuffer(Map<Integer, double[]> megabuf, Integer key) {
|
private static double[] getSubBuffer(Map<Integer, double[]> megabuf, Integer key) {
|
||||||
double[] ret = megabuf.get(key);
|
double[] ret = megabuf.get(key);
|
||||||
@ -306,18 +307,18 @@ public final class Functions {
|
|||||||
|
|
||||||
@Dynamic
|
@Dynamic
|
||||||
public static double megabuf(RValue index) throws EvaluationException {
|
public static double megabuf(RValue index) throws EvaluationException {
|
||||||
return getBufferItem(Expression.getInstance().getMegabuf(), (int) index.getValue());
|
return getBufferItem(Expression.getInstance().getFunctions().megabuf, (int) index.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Dynamic
|
@Dynamic
|
||||||
public static double megabuf(RValue index, double value) throws EvaluationException {
|
public static double megabuf(RValue index, double value) throws EvaluationException {
|
||||||
return setBufferItem(Expression.getInstance().getMegabuf(), (int) index.getValue(), value);
|
return setBufferItem(Expression.getInstance().getFunctions().megabuf, (int) index.getValue(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Dynamic
|
@Dynamic
|
||||||
public static double closest(RValue x, RValue y, RValue z, RValue index, RValue count, RValue stride) throws EvaluationException {
|
public static double closest(RValue x, RValue y, RValue z, RValue index, RValue count, RValue stride) throws EvaluationException {
|
||||||
return findClosest(
|
return findClosest(
|
||||||
Expression.getInstance().getMegabuf(),
|
Expression.getInstance().getFunctions().megabuf,
|
||||||
x.getValue(),
|
x.getValue(),
|
||||||
y.getValue(),
|
y.getValue(),
|
||||||
z.getValue(),
|
z.getValue(),
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren