From 4fa5daf974a7cbadd77aaf69a0912e70c8ed1e97 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Sat, 21 Sep 2013 18:22:18 +0200 Subject: [PATCH] Moved megabuf to the Functions class --- .../java/com/sk89q/worldedit/expression/Expression.java | 7 ++++--- .../com/sk89q/worldedit/expression/runtime/Functions.java | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/expression/Expression.java b/src/main/java/com/sk89q/worldedit/expression/Expression.java index a6b6e23a7..1b34c2032 100644 --- a/src/main/java/com/sk89q/worldedit/expression/Expression.java +++ b/src/main/java/com/sk89q/worldedit/expression/Expression.java @@ -29,6 +29,7 @@ import com.sk89q.worldedit.expression.lexer.tokens.Token; import com.sk89q.worldedit.expression.parser.Parser; import com.sk89q.worldedit.expression.runtime.Constant; 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.ReturnException; import com.sk89q.worldedit.expression.runtime.Variable; @@ -63,7 +64,7 @@ public class Expression { private final Map variables = new HashMap(); private final String[] variableNames; private RValue root; - private final Map megabuf = new HashMap(); + private final Functions functions = new Functions(); public static Expression compile(String expression, String... variableNames) throws ExpressionException { return new Expression(expression, variableNames); @@ -153,7 +154,7 @@ public class Expression { } } - public Map getMegabuf() { - return megabuf; + public Functions getFunctions() { + return functions; } } diff --git a/src/main/java/com/sk89q/worldedit/expression/runtime/Functions.java b/src/main/java/com/sk89q/worldedit/expression/runtime/Functions.java index 3d679baab..2817415dc 100644 --- a/src/main/java/com/sk89q/worldedit/expression/runtime/Functions.java +++ b/src/main/java/com/sk89q/worldedit/expression/runtime/Functions.java @@ -277,6 +277,7 @@ public final class Functions { private static final Map gmegabuf = new HashMap(); + private final Map megabuf = new HashMap(); private static double[] getSubBuffer(Map megabuf, Integer key) { double[] ret = megabuf.get(key); @@ -306,18 +307,18 @@ public final class Functions { @Dynamic 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 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 public static double closest(RValue x, RValue y, RValue z, RValue index, RValue count, RValue stride) throws EvaluationException { return findClosest( - Expression.getInstance().getMegabuf(), + Expression.getInstance().getFunctions().megabuf, x.getValue(), y.getValue(), z.getValue(),