Double dblValue = null;
try {
dblValue = Double.parseDouble (dataValue);
}
catch (NumberFormatException e) {}
Rational ratValue = null;
if (intValue != null) {
ratValue = new Rational (intValue, 1);
}
else if (dblValue != null) {
ratValue = new Rational ((int) (dblValue * 100 + 0.5), 100);
}
else if(dataValue.contains("/")) {
try {
int num = Integer.parseInt(dataValue.substring(0,dataValue.indexOf("/")));
int den = Integer.parseInt(dataValue.substring(dataValue.indexOf("/")+1));
ratValue = new Rational(num,den);
}
catch (NumberFormatException e) {}
}
// This is a very long switch, but I don't think much would be gained