Les calculs peuvent maintenant prendre en compte les valeurs de l'historique 'resX' avec X de 1 à 5
This commit is contained in:
parent
fc64edebe6
commit
51db9fba84
@ -55,12 +55,17 @@ public class CalculatorManager implements Listener {
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
message = message.substring(1);
|
message = message.substring(1);
|
||||||
|
|
||||||
// TODO prendre en compte les variables "resX"
|
int i = history.size();
|
||||||
|
for(HistoryElement el : history)
|
||||||
|
{
|
||||||
|
message = message.replace("res"+i, el.value);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
StringBuffer expression = new StringBuffer();
|
StringBuffer expression = new StringBuffer(); // permet de stocker la version reformaté de l'expression mathématique
|
||||||
|
|
||||||
HistoryElement calcul = new HistoryElement();
|
HistoryElement calcul = new HistoryElement();
|
||||||
calcul.value = StringUtil.formatDouble(JArithmeticInterpreter.getResultFromExpression(message, expression));
|
calcul.value = StringUtil.formatDouble(JArithmeticInterpreter.getResultFromExpression(message, expression));
|
||||||
|
Loading…
Reference in New Issue
Block a user