Package com.sk89q.craftbook.mechanics.ic.gates.variables.NumericModifier

Examples of com.sk89q.craftbook.mechanics.ic.gates.variables.NumericModifier.MathFunction


                String[] mvarParts = RegexUtil.EQUALS_PATTERN.split(newVal,2);
                String mnamespace = VariableManager.instance.getNamespace(mvarParts[0]);
                String mvar = VariableManager.instance.getVariableName(mvarParts[0]);

                String[] mathFunctionParts = RegexUtil.COLON_PATTERN.split(mvarParts[1], 2);
                MathFunction func = MathFunction.parseFunction(mathFunctionParts[0]);

                String cur = VariableManager.instance.getVariable(mvar,mnamespace);
                if(cur == null || cur.isEmpty()) cur = "0";

                double currentValue = Double.parseDouble(cur);
                double amount = Double.parseDouble(mathFunctionParts[1]);

                currentValue = func.parseNumber(currentValue, amount);

                String val = String.valueOf(currentValue);
                if (val.endsWith(".0"))
                    val = StringUtils.replace(val, ".0", "");
View Full Code Here

TOP

Related Classes of com.sk89q.craftbook.mechanics.ic.gates.variables.NumericModifier.MathFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.