return new Branch(Function.TIMES, new Token(mantissa), power);
default:
Ket.out.println(" !!! Bug: cannot interpret number format: !!! ");
Ket.out.println(doubleString);
return new VariableToken(new Text(doubleString));
}
} else {
String integerString = readNext(INTEGER, equation);
String[] parts = integerString.split("[eE]");
switch (parts.length) {
case 1: // mantissa
int intValue = Integer.parseInt(parts[0]);
return new Token(intValue);
case 2: // mantissa E exponent
int mantissa = Integer.parseInt(parts[0]);
int exponent = Integer.parseInt(parts[1]);
Branch power = new Branch(Function.POWER, new Token(10), new Token(exponent));
return new Branch(Function.TIMES, new Token(mantissa), power);
default:
Ket.out.println(" !!! Bug: cannot interpret number format: !!! ");
Ket.out.println(integerString);
return new VariableToken(new Text(integerString));
}
}
}