Nettoyage de la classe JArithmeticInterpreter

This commit is contained in:
Marc Baloup 2014-12-26 16:56:39 +01:00
parent 9ec2dfb95b
commit 6f05cf681f

View File

@ -449,16 +449,19 @@ public class JArithmeticInterpreter {
//.................................................................................... Write_Tree //.................................................................................... Write_Tree
public String writeTree() {
StringBuffer sb = new StringBuffer();
writeTree(sb);
return sb.toString();
}
private void writeTree(StringBuffer string) { private void writeTree(StringBuffer string) {
boolean parenthese=false; boolean parenthese=false;
switch(mOperator) { switch(mOperator) {
case -2:
string.append('y');
break;
case -1:
string.append('x');
break;
case 0: case 0:
string.append(mValue); string.append(mValue);
break; break;
@ -550,7 +553,7 @@ public class JArithmeticInterpreter {
string.append(')'); string.append(')');
break; break;
case 9: case 9:
string.append("<EFBFBD>("); string.append("sqrt(");
fg.writeTree(string); fg.writeTree(string);
string.append(')'); string.append(')');
break; break;
@ -605,7 +608,7 @@ public class JArithmeticInterpreter {
signe=-1; signe=-1;
i++; i++;
} }
if (chaine.charAt(i)=='<27>') return signe*Math.PI; if (chaine.charAt(i)=='<27>') return signe*Math.PI; // TODO changer le caractère non reconnu
while (i<longueur && chaine.charAt(i)>47 && chaine.charAt(i)<58) { while (i<longueur && chaine.charAt(i)>47 && chaine.charAt(i)<58) {
temp=temp*10+(chaine.charAt(i)-48); temp=temp*10+(chaine.charAt(i)-48);