Skip to content

Commit

Permalink
Final cleanup, removal of all deprecated code.
Browse files Browse the repository at this point in the history
  • Loading branch information
NGSpace committed Aug 17, 2024
1 parent 9c423f9 commit f8cf97c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 128 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static io.github.ngspace.hudder.data_management.BooleanData.getBoolean;
import static io.github.ngspace.hudder.data_management.NumberData.getNumber;
import static io.github.ngspace.hudder.data_management.StringData.getString;
import static io.github.ngspace.hudder.util.MathUtils.eval;

import io.github.ngspace.hudder.compilers.utils.CompileException;
import io.github.ngspace.hudder.config.ConfigManager;
Expand All @@ -26,32 +25,6 @@ public boolean isFirstEqualsCondition(String key) {
return key;
}

/**
* Processes a string (ex. "1+2+fps") and returns a double if it was able to process the equation, or returns the
* variable with that name.
*
* @deprecated Please use V2Runtime and V2Value instead of manually processing Math variables.<br>
* Will be removed by version 4.0.0
* @param variable
* @return the result
* @throws CompileException
*/
@Deprecated(since = "3.5.0", forRemoval = true)
public Object getMathVariable(String variable) throws CompileException {
String advkey = variable.trim().replace(" ", "");
String[] keys = advkey.split("[^\\d\\.A-z ]");
if (keys.length==1) return getVariable(variable);
for (String key : keys) {
if ("".equals(key)) continue;
advkey = advkey.replace(key, getVariable(key).toString());
}
try {
return eval(advkey); //Very Expensive operation so try to avoid it as much as possible.
} catch (Exception e) {
return getVariable(variable);
}
}


//I now realize the name "static variable" might be a little confusing, it means a variable that can't be modified
public boolean isStaticVariable(String key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ public class HudderV2Compiler extends AVarTextCompiler {

int bracketscount = 0;

String[] methodbuilder = {};

String[] condArgs = {};
String[] builder = {};

boolean quotesafe = false;
boolean condSafe = false;
boolean safeappend = false;
Expand All @@ -64,7 +63,7 @@ public class HudderV2Compiler extends AVarTextCompiler {
switch (c) {
case '%':
compileState = CONDITION_STATE;
condArgs = new String[] {};
builder = new String[] {};
runtime.addRuntimeElement(new StringV2RuntimeElement(elemBuilder.toString(), false));
elemBuilder.setLength(0);
break;
Expand All @@ -78,6 +77,7 @@ public class HudderV2Compiler extends AVarTextCompiler {
compileState = META_STATE;
runtime.addRuntimeElement(new StringV2RuntimeElement(elemBuilder.toString(), true));
elemBuilder.setLength(0);
builder = new String[] {};
break;
case '#':
compileState = ADVANCED_CONDITION_STATE;
Expand Down Expand Up @@ -121,16 +121,16 @@ public class HudderV2Compiler extends AVarTextCompiler {
switch (c) {
case '%':
compileState = TEXT_STATE;
condArgs = addToArray(condArgs,elemBuilder.toString().trim());
runtime.addRuntimeElement(new BasicConditionV2RuntimeElement(condArgs, this, info));
builder = addToArray(builder,elemBuilder.toString().trim());
runtime.addRuntimeElement(new BasicConditionV2RuntimeElement(builder, this, info));
elemBuilder.setLength(0);
break;
case '"':
quotesafe = !quotesafe;
elemBuilder.append(c);
break;
case ',':
condArgs = addToArray(condArgs,elemBuilder.toString().trim());
builder = addToArray(builder,elemBuilder.toString().trim());
elemBuilder.setLength(0);
break;
default: elemBuilder.append(c);break;
Expand All @@ -144,16 +144,16 @@ public class HudderV2Compiler extends AVarTextCompiler {
compileState = TEXT_STATE;
break;
case ',':
methodbuilder = addToArray(methodbuilder,elemBuilder.toString().trim());
builder = addToArray(builder,elemBuilder.toString().trim());
elemBuilder.setLength(0);
break;
default: elemBuilder.append(c);break;
}
if (compileState!=META_STATE) {
methodbuilder = addToArray(methodbuilder,elemBuilder.toString().trim());
runtime.addRuntimeElement(new MethodV2RuntimeElement(methodbuilder, this, info, runtime));
builder = addToArray(builder,elemBuilder.toString().trim());
runtime.addRuntimeElement(new MethodV2RuntimeElement(builder, this, info, runtime));
elemBuilder.setLength(0);
methodbuilder = new String[0];
builder = new String[0];
cleanup = true;
cleanup_amount = ConfigManager.getConfig().methodBuffer/2;
}
Expand Down
90 changes: 0 additions & 90 deletions src/main/java/io/github/ngspace/hudder/util/MathUtils.java

This file was deleted.

0 comments on commit f8cf97c

Please sign in to comment.