DoubleValue ret = new DoubleValue();
ret.setValue(Double.parseDouble(this.value) * ((IntValue) v).getValue());
return ret;
} catch (NumberFormatException e) {
throw new IncompatibleTypesException(getValue() +
" is not a number");
}
} else if (v instanceof LongValue) {
try {
DoubleValue ret = new DoubleValue();
ret.setValue(Double.parseDouble(this.value) * ((LongValue) v).getValue());
return ret;
} catch (NumberFormatException e) {
throw new IncompatibleTypesException(getValue() +
" is not a number");
}
} else if (v instanceof FloatValue) {
try {
DoubleValue ret = new DoubleValue();
ret.setValue(Double.parseDouble(this.value) * ((FloatValue) v).getValue());
return ret;
} catch (NumberFormatException e) {
throw new IncompatibleTypesException(getValue() +
" is not a number");
}
} else if (v instanceof DoubleValue) {
try {
DoubleValue ret = new DoubleValue();
ret.setValue(Double.parseDouble(this.value) * ((DoubleValue) v).getValue());
return ret;
} catch (NumberFormatException e) {
throw new IncompatibleTypesException(getValue() +
" is not a number");
}
} else if (v instanceof StringValue) {
try {
DoubleValue ret = new DoubleValue();
ret.setValue(Double.parseDouble(this.value) * Double.parseDouble(
((StringValue) v).getValue()));
return ret;
} catch (NumberFormatException e) {
throw new IncompatibleTypesException(getValue() +
" is not a number");
}
} else {
throw new IncompatibleTypesException();
}
}