changes
This commit is contained in:
parent
a3c985acd4
commit
63359cc0a9
@ -25,6 +25,8 @@ import org.solovyev.android.calculator.math.MathType;
|
|||||||
import org.solovyev.android.calculator.model.AndroidVarsRegistry;
|
import org.solovyev.android.calculator.model.AndroidVarsRegistry;
|
||||||
import org.solovyev.android.calculator.model.CalculatorEngine;
|
import org.solovyev.android.calculator.model.CalculatorEngine;
|
||||||
import org.solovyev.android.calculator.model.Var;
|
import org.solovyev.android.calculator.model.Var;
|
||||||
|
import org.solovyev.common.utils.CollectionsUtils;
|
||||||
|
import org.solovyev.common.utils.Finder;
|
||||||
import org.solovyev.common.utils.StringUtils;
|
import org.solovyev.common.utils.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -52,7 +54,14 @@ public class CalculatorVarsActivity extends ListActivity {
|
|||||||
|
|
||||||
setContentView(R.layout.vars);
|
setContentView(R.layout.vars);
|
||||||
|
|
||||||
adapter = new VarsArrayAdapter(this, R.layout.var, R.id.var_text, new ArrayList<Var>(CalculatorEngine.instance.getVarsRegister().getEntities()));
|
final List<Var> vars = new ArrayList<Var>(CalculatorEngine.instance.getVarsRegister().getEntities());
|
||||||
|
CollectionsUtils.removeAll(vars, new Finder<Var>() {
|
||||||
|
@Override
|
||||||
|
public boolean isFound(@Nullable Var var) {
|
||||||
|
return var != null && CollectionsUtils.contains(var.getName(), MathType.INFINITY_JSCL, MathType.NAN);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
adapter = new VarsArrayAdapter(this, R.layout.var, R.id.var_text, vars);
|
||||||
setListAdapter(adapter);
|
setListAdapter(adapter);
|
||||||
|
|
||||||
final ListView lv = getListView();
|
final ListView lv = getListView();
|
||||||
@ -261,9 +270,9 @@ public class CalculatorVarsActivity extends ListActivity {
|
|||||||
createEditVariableDialog(editedInstance, name, value, description);
|
createEditVariableDialog(editedInstance, name, value, description);
|
||||||
} else {
|
} else {
|
||||||
if ( editedInstance == null ) {
|
if ( editedInstance == null ) {
|
||||||
CalculatorVarsActivity.this.adapter.add(varsRegistry.add(null, varBuilder));
|
CalculatorVarsActivity.this.adapter.add(varsRegistry.add(varBuilder));
|
||||||
} else {
|
} else {
|
||||||
final Var newInstance = varsRegistry.add(editedInstance.getName(), varBuilder);
|
final Var newInstance = varsRegistry.add(varBuilder);
|
||||||
CalculatorVarsActivity.this.adapter.remove(editedInstance);
|
CalculatorVarsActivity.this.adapter.remove(editedInstance);
|
||||||
CalculatorVarsActivity.this.adapter.add(newInstance);
|
CalculatorVarsActivity.this.adapter.add(newInstance);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.solovyev.android.calculator.math;
|
package org.solovyev.android.calculator.math;
|
||||||
|
|
||||||
|
import jscl.math.function.Constant;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.StartsWithFinder;
|
import org.solovyev.android.calculator.StartsWithFinder;
|
||||||
@ -107,6 +108,11 @@ public enum MathType {
|
|||||||
public List<String> getTokens() {
|
public List<String> getTokens() {
|
||||||
return CalculatorEngine.instance.getVarsRegister().getNames();
|
return CalculatorEngine.instance.getVarsRegister().getNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getSubstituteFromJscl(@NotNull String match) {
|
||||||
|
return Constant.INF_CONST2.getName().equals(match) ? MathType.INFINITY : super.getSubstituteFromJscl(match);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
text(1200, false, false) {
|
text(1200, false, false) {
|
||||||
|
@ -71,8 +71,8 @@ public class AndroidFunctionsRegistryImpl implements AndroidFunctionsRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Function add(@Nullable String name, @NotNull IBuilder<? extends Function> IBuilder) {
|
public Function add(@NotNull IBuilder<? extends Function> IBuilder) {
|
||||||
return functionsRegistry.add(name, IBuilder);
|
return functionsRegistry.add(IBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,12 +37,8 @@ class AndroidVarsRegistryImpl implements AndroidVarsRegistry {
|
|||||||
this.mathRegistry = mathRegistry;
|
this.mathRegistry = mathRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean initialized = false;
|
|
||||||
|
|
||||||
public synchronized void init(@Nullable Context context, @Nullable SharedPreferences preferences) {
|
public synchronized void init(@Nullable Context context, @Nullable SharedPreferences preferences) {
|
||||||
|
|
||||||
if (!initialized) {
|
|
||||||
|
|
||||||
if (context != null && preferences != null) {
|
if (context != null && preferences != null) {
|
||||||
final String value = preferences.getString(context.getString(R.string.p_calc_vars), null);
|
final String value = preferences.getString(context.getString(R.string.p_calc_vars), null);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
@ -51,7 +47,7 @@ class AndroidVarsRegistryImpl implements AndroidVarsRegistry {
|
|||||||
final Vars vars = serializer.read(Vars.class, value);
|
final Vars vars = serializer.read(Vars.class, value);
|
||||||
for (Var var : vars.getVars()) {
|
for (Var var : vars.getVars()) {
|
||||||
if (!contains(var.getName())) {
|
if (!contains(var.getName())) {
|
||||||
add(null, new Var.Builder(var));
|
add(new Var.Builder(var));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -67,31 +63,31 @@ class AndroidVarsRegistryImpl implements AndroidVarsRegistry {
|
|||||||
final Integer varDescription;
|
final Integer varDescription;
|
||||||
|
|
||||||
if (systemVarName.equals(MathType.E)) {
|
if (systemVarName.equals(MathType.E)) {
|
||||||
builder = new Var.Builder(systemVarName, Math.E);
|
builder = createBuilder(systemVarName, String.valueOf(Math.E));
|
||||||
varDescription = R.string.c_e_description;
|
varDescription = R.string.c_e_description;
|
||||||
} else if (systemVarName.equals(MathType.PI)) {
|
} else if (systemVarName.equals(MathType.PI)) {
|
||||||
builder = new Var.Builder(systemVarName, Math.PI);
|
builder = createBuilder(systemVarName, String.valueOf(Math.PI));
|
||||||
varDescription = R.string.c_pi_description;
|
varDescription = R.string.c_pi_description;
|
||||||
} else if (systemVarName.equals(MathType.C)) {
|
} else if (systemVarName.equals(MathType.C)) {
|
||||||
builder = new Var.Builder(systemVarName, MathType.C_VALUE);
|
builder = createBuilder(systemVarName, String.valueOf(MathType.C_VALUE));
|
||||||
varDescription = R.string.c_c_description;
|
varDescription = R.string.c_c_description;
|
||||||
} else if (systemVarName.equals(MathType.G)) {
|
} else if (systemVarName.equals(MathType.G)) {
|
||||||
builder = new Var.Builder(systemVarName, MathType.G_VALUE);
|
builder = createBuilder(systemVarName, String.valueOf(MathType.G_VALUE));
|
||||||
varDescription = R.string.c_g_description;
|
varDescription = R.string.c_g_description;
|
||||||
/* } else if (systemVarName.equals(MathType.H)) {
|
/* } else if (systemVarName.equals(MathType.H)) {
|
||||||
builder = new Var.Builder(systemVarName, MathType.H_VALUE);
|
builder = new Var.Builder(systemVarName, MathType.H_VALUE);
|
||||||
varDescription = R.string.c_h_description;*/
|
varDescription = R.string.c_h_description;*/
|
||||||
} else if (systemVarName.equals(MathType.H_REDUCED)) {
|
} else if (systemVarName.equals(MathType.H_REDUCED)) {
|
||||||
builder = new Var.Builder(systemVarName, MathType.H_REDUCED_VALUE);
|
builder = createBuilder(systemVarName, String.valueOf(MathType.H_REDUCED_VALUE));
|
||||||
varDescription = R.string.c_h_reduced_description;
|
varDescription = R.string.c_h_reduced_description;
|
||||||
} else if (systemVarName.equals(MathType.IMAGINARY_NUMBER)) {
|
} else if (systemVarName.equals(MathType.IMAGINARY_NUMBER)) {
|
||||||
builder = new Var.Builder(systemVarName, MathType.IMAGINARY_NUMBER_JSCL);
|
builder = createBuilder(systemVarName, MathType.IMAGINARY_NUMBER_JSCL);
|
||||||
varDescription = R.string.c_i_description;
|
varDescription = R.string.c_i_description;
|
||||||
} else if (systemVarName.equals(MathType.NAN)) {
|
} else if (systemVarName.equals(MathType.NAN)) {
|
||||||
builder = new Var.Builder(systemVarName, MathType.NAN);
|
builder = createBuilder(systemVarName, MathType.NAN);
|
||||||
varDescription = R.string.c_nan_description;
|
varDescription = R.string.c_nan_description;
|
||||||
} else if (systemVarName.equals(MathType.INFINITY)) {
|
} else if (systemVarName.equals(MathType.INFINITY)) {
|
||||||
builder = new Var.Builder(systemVarName, MathType.INFINITY_JSCL);
|
builder = createBuilder(systemVarName, MathType.INFINITY_JSCL);
|
||||||
varDescription = R.string.c_infinity_description;
|
varDescription = R.string.c_infinity_description;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException(systemVarName + " is not supported yet!");
|
throw new IllegalArgumentException(systemVarName + " is not supported yet!");
|
||||||
@ -103,13 +99,9 @@ class AndroidVarsRegistryImpl implements AndroidVarsRegistry {
|
|||||||
builder.setDescription(context.getString(varDescription));
|
builder.setDescription(context.getString(varDescription));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!contains(systemVarName)) {
|
add(builder);
|
||||||
add(null, builder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
initialized = true;
|
|
||||||
|
|
||||||
/*Log.d(AndroidVarsRegistry.class.getName(), vars.size() + " variables registered!");
|
/*Log.d(AndroidVarsRegistry.class.getName(), vars.size() + " variables registered!");
|
||||||
for (Var var : vars) {
|
for (Var var : vars) {
|
||||||
@ -117,6 +109,19 @@ class AndroidVarsRegistryImpl implements AndroidVarsRegistry {
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Var.Builder createBuilder(@NotNull String varName, @NotNull String varValue) {
|
||||||
|
final Var.Builder result;
|
||||||
|
|
||||||
|
final IConstant varFromRegistry = mathRegistry.get(varName);
|
||||||
|
if (varFromRegistry == null) {
|
||||||
|
result = new Var.Builder(varName, varValue);
|
||||||
|
} else {
|
||||||
|
result = new Var.Builder(varFromRegistry);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void save(@NotNull Context context) {
|
public synchronized void save(@NotNull Context context) {
|
||||||
final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
@ -163,8 +168,8 @@ class AndroidVarsRegistryImpl implements AndroidVarsRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Var add(@Nullable String name, @NotNull IBuilder<? extends Var> IBuilder) {
|
public Var add(@NotNull IBuilder<? extends Var> IBuilder) {
|
||||||
IConstant result = mathRegistry.add(name, IBuilder);
|
IConstant result = mathRegistry.add(IBuilder);
|
||||||
if (result instanceof Var) {
|
if (result instanceof Var) {
|
||||||
return (Var) result;
|
return (Var) result;
|
||||||
} else if (result != null) {
|
} else if (result != null) {
|
||||||
|
@ -26,7 +26,6 @@ import org.solovyev.common.utils.StringUtils;
|
|||||||
@Root
|
@Root
|
||||||
public class Var implements IConstant {
|
public class Var implements IConstant {
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Transient
|
@Transient
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@ -82,8 +81,10 @@ public class Var implements IConstant {
|
|||||||
|
|
||||||
this.system = iConstant.isSystem();
|
this.system = iConstant.isSystem();
|
||||||
this.description = iConstant.getDescription();
|
this.description = iConstant.getDescription();
|
||||||
|
if (iConstant.isIdDefined()) {
|
||||||
this.id = iConstant.getId();
|
this.id = iConstant.getId();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Builder(@NotNull String name, @NotNull Double value) {
|
public Builder(@NotNull String name, @NotNull Double value) {
|
||||||
this(name, String.valueOf(value));
|
this(name, String.valueOf(value));
|
||||||
@ -145,6 +146,9 @@ public class Var implements IConstant {
|
|||||||
this.value = that.getValue();
|
this.value = that.getValue();
|
||||||
this.description = that.getDescription();
|
this.description = that.getDescription();
|
||||||
this.system = that.isSystem();
|
this.system = that.isSystem();
|
||||||
|
if (that.isIdDefined()) {
|
||||||
|
this.id = that.getId();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Trying to make a copy of unsupported type: " + o.getClass());
|
throw new IllegalArgumentException("Trying to make a copy of unsupported type: " + o.getClass());
|
||||||
}
|
}
|
||||||
@ -184,6 +188,11 @@ public class Var implements IConstant {
|
|||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isIdDefined() {
|
||||||
|
return this.id != null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setId(@NotNull Integer id) {
|
public void setId(@NotNull Integer id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -130,7 +130,7 @@ public class CalculatorEngineTest {
|
|||||||
}
|
}
|
||||||
junit.framework.Assert.assertEquals("24i", cm.evaluate(JsclOperation.numeric, "4!i").getResult());
|
junit.framework.Assert.assertEquals("24i", cm.evaluate(JsclOperation.numeric, "4!i").getResult());
|
||||||
|
|
||||||
CalculatorEngine.instance.getVarsRegister().add(null, new Var.Builder("si", 5d));
|
CalculatorEngine.instance.getVarsRegister().add(new Var.Builder("si", 5d));
|
||||||
|
|
||||||
Assert.assertEquals("-0.959", cm.evaluate(JsclOperation.numeric, "sin(5)").getResult());
|
Assert.assertEquals("-0.959", cm.evaluate(JsclOperation.numeric, "sin(5)").getResult());
|
||||||
Assert.assertEquals("-4.795", cm.evaluate(JsclOperation.numeric, "sin(5)si").getResult());
|
Assert.assertEquals("-4.795", cm.evaluate(JsclOperation.numeric, "sin(5)si").getResult());
|
||||||
@ -138,18 +138,19 @@ public class CalculatorEngineTest {
|
|||||||
Assert.assertEquals("-23.973", cm.evaluate(JsclOperation.numeric, "si*sin(5)si").getResult());
|
Assert.assertEquals("-23.973", cm.evaluate(JsclOperation.numeric, "si*sin(5)si").getResult());
|
||||||
Assert.assertEquals("-3.309", cm.evaluate(JsclOperation.numeric, "sisin(5si)si").getResult());
|
Assert.assertEquals("-3.309", cm.evaluate(JsclOperation.numeric, "sisin(5si)si").getResult());
|
||||||
|
|
||||||
CalculatorEngine.instance.getVarsRegister().add(null, new Var.Builder("s", 1d));
|
CalculatorEngine.instance.getVarsRegister().add(new Var.Builder("s", 1d));
|
||||||
Assert.assertEquals("5", cm.evaluate(JsclOperation.numeric, "si").getResult());
|
Assert.assertEquals("5", cm.evaluate(JsclOperation.numeric, "si").getResult());
|
||||||
|
|
||||||
CalculatorEngine.instance.getVarsRegister().add(null, new Var.Builder("k", 3.5d));
|
CalculatorEngine.instance.getVarsRegister().add(new Var.Builder("k", 3.5d));
|
||||||
CalculatorEngine.instance.getVarsRegister().add(null, new Var.Builder("k1", 4d));
|
CalculatorEngine.instance.getVarsRegister().add(new Var.Builder("k1", 4d));
|
||||||
Assert.assertEquals("4", cm.evaluate(JsclOperation.numeric, "k11").getResult());
|
Assert.assertEquals("4", cm.evaluate(JsclOperation.numeric, "k11").getResult());
|
||||||
|
|
||||||
CalculatorEngine.instance.getVarsRegister().add(null, new Var.Builder("t", (String) null));
|
CalculatorEngine.instance.getVarsRegister().add(new Var.Builder("t", (String) null));
|
||||||
Assert.assertEquals("11t", cm.evaluate(JsclOperation.numeric, "t11").getResult());
|
Assert.assertEquals("11t", cm.evaluate(JsclOperation.numeric, "t11").getResult());
|
||||||
Assert.assertEquals("11et", cm.evaluate(JsclOperation.numeric, "t11e").getResult());
|
Assert.assertEquals("11et", cm.evaluate(JsclOperation.numeric, "t11e").getResult());
|
||||||
Assert.assertEquals("∞", cm.evaluate(JsclOperation.numeric, "∞").getResult());
|
Assert.assertEquals("∞", cm.evaluate(JsclOperation.numeric, "∞").getResult());
|
||||||
Assert.assertEquals("11t∞", cm.evaluate(JsclOperation.numeric, "t11∞").getResult());
|
Assert.assertEquals("∞", cm.evaluate(JsclOperation.numeric, "Infinity").getResult());
|
||||||
|
Assert.assertEquals("11∞t", cm.evaluate(JsclOperation.numeric, "t11∞").getResult());
|
||||||
Assert.assertEquals("-t+t^3", cm.evaluate(JsclOperation.numeric, "t(t-1)(t+1)").getResult());
|
Assert.assertEquals("-t+t^3", cm.evaluate(JsclOperation.numeric, "t(t-1)(t+1)").getResult());
|
||||||
|
|
||||||
Assert.assertEquals("3.957", cm.evaluate(JsclOperation.numeric, "ln(8)lg(8)+ln(8)").getResult());
|
Assert.assertEquals("3.957", cm.evaluate(JsclOperation.numeric, "ln(8)lg(8)+ln(8)").getResult());
|
||||||
@ -192,7 +193,7 @@ public class CalculatorEngineTest {
|
|||||||
}
|
}
|
||||||
Assert.assertEquals("0.739", cm.evaluate(JsclOperation.numeric, "cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(1))))))))))))))))))))))))))))))))))))").getResult());
|
Assert.assertEquals("0.739", cm.evaluate(JsclOperation.numeric, "cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(1))))))))))))))))))))))))))))))))))))").getResult());
|
||||||
|
|
||||||
CalculatorEngine.instance.getVarsRegister().add(null, new Var.Builder("si", 5d));
|
CalculatorEngine.instance.getVarsRegister().add(new Var.Builder("si", 5d));
|
||||||
Assert.assertEquals("5", cm.evaluate(JsclOperation.numeric, "si").getResult());
|
Assert.assertEquals("5", cm.evaluate(JsclOperation.numeric, "si").getResult());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -33,14 +33,15 @@ public class FromJsclSimplifyTextProcessorTest {
|
|||||||
Assert.assertEquals("e", tp.process("2.718281828459045"));
|
Assert.assertEquals("e", tp.process("2.718281828459045"));
|
||||||
Assert.assertEquals("tee", tp.process("t2.718281828459045*2.718281828459045"));
|
Assert.assertEquals("tee", tp.process("t2.718281828459045*2.718281828459045"));
|
||||||
|
|
||||||
CalculatorEngine.instance.getVarsRegister().add(null, new Var.Builder("t2.718281828459045", "2"));
|
CalculatorEngine.instance.getVarsRegister().add(new Var.Builder("t2.718281828459045", "2"));
|
||||||
|
CalculatorEngine.instance.getVarsRegister().add(new Var.Builder("t", (String)null));
|
||||||
Assert.assertEquals("t2.718281828459045e", tp.process("t2.718281828459045*2.718281828459045"));
|
Assert.assertEquals("t2.718281828459045e", tp.process("t2.718281828459045*2.718281828459045"));
|
||||||
Assert.assertEquals("ee", tp.process("2.718281828459045*2.718281828459045"));
|
Assert.assertEquals("ee", tp.process("2.718281828459045*2.718281828459045"));
|
||||||
Assert.assertEquals("t×", tp.process("t*"));
|
Assert.assertEquals("t×", tp.process("t*"));
|
||||||
Assert.assertEquals("×t", tp.process("*t"));
|
Assert.assertEquals("×t", tp.process("*t"));
|
||||||
Assert.assertEquals("t2", tp.process("t*2"));
|
Assert.assertEquals("t2", tp.process("t*2"));
|
||||||
Assert.assertEquals("2t", tp.process("2*t"));
|
Assert.assertEquals("2t", tp.process("2*t"));
|
||||||
CalculatorEngine.instance.getVarsRegister().add(null, new Var.Builder("t", (String) null));
|
CalculatorEngine.instance.getVarsRegister().add(new Var.Builder("t", (String) null));
|
||||||
Assert.assertEquals("t×", tp.process("t*"));
|
Assert.assertEquals("t×", tp.process("t*"));
|
||||||
Assert.assertEquals("×t", tp.process("*t"));
|
Assert.assertEquals("×t", tp.process("*t"));
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ public class FromJsclSimplifyTextProcessorTest {
|
|||||||
Assert.assertEquals("t^[2×2t]", tp.process("t^[2*2*t]"));
|
Assert.assertEquals("t^[2×2t]", tp.process("t^[2*2*t]"));
|
||||||
Assert.assertEquals("2t^2[2t]", tp.process("2*t^2[2*t]"));
|
Assert.assertEquals("2t^2[2t]", tp.process("2*t^2[2*t]"));
|
||||||
|
|
||||||
CalculatorEngine.instance.getVarsRegister().add(null, new Var.Builder("k", (String) null));
|
CalculatorEngine.instance.getVarsRegister().add(new Var.Builder("k", (String) null));
|
||||||
Assert.assertEquals("(t+2k)[k+2t]", tp.process("(t+2*k)*[k+2*t]"));
|
Assert.assertEquals("(t+2k)[k+2t]", tp.process("(t+2*k)*[k+2*t]"));
|
||||||
Assert.assertEquals("(te+2k)e[k+2te]", tp.process("(t*e+2*k)*e*[k+2*t*e]"));
|
Assert.assertEquals("(te+2k)e[k+2te]", tp.process("(t*e+2*k)*e*[k+2*t*e]"));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user