double deep=1;
int pos=0;
int len=str.length();
if(len==0) throw new CasterException("can't cast empty string to a number value");
char curr=str.charAt(pos);
boolean isMinus=false;
if(curr=='+') {
if(len==++pos) throw new CasterException("can't cast [+] string to a number value");
}
if(curr=='-') {
if(len==++pos) throw new CasterException("can't cast [-] string to a number value");
isMinus=true;
}
boolean hasDot=false;
//boolean hasExp=false;
do {
curr=str.charAt(pos);
if(curr<'0') {
if(curr=='.') {
if(hasDot) {
if(!alsoFromDate) throw new CasterException("cannot cast ["+str+"] string to a number value");
return toDoubleValueViaDate(str);
}
hasDot=true;
}
else {
if(pos==0 && Decision.isBoolean(str)) return toBooleanValue(str,false)?1.0D:0.0D;
if(!alsoFromDate) throw new CasterException("cannot cast ["+str+"] string to a number value");
return toDoubleValueViaDate(str);
//throw new CasterException("can't cast ["+str+"] string to a number value");
}
}
else if(curr>'9') {
if(curr == 'e' || curr == 'E') {
try{
return Double.parseDouble(str);
}
catch( NumberFormatException e){
if(!alsoFromDate) throw new CasterException("cannot cast ["+str+"] string to a number value");
return toDoubleValueViaDate(str);
//throw new CasterException("can't cast ["+str+"] string to a number value");
}
}
//else {
if(pos==0 && Decision.isBoolean(str)) return toBooleanValue(str,false)?1.0D:0.0D;
if(!alsoFromDate) throw new CasterException("cannot cast ["+str+"] string to a number value");
return toDoubleValueViaDate(str);
//throw new CasterException("can't cast ["+str+"] string to a number value");
//}
}
else if(!hasDot) {