// Namespace is not yet used.
// final String formulaNamespace;
final String formulaExpression;
if (formula == null)
{
throw new ParseException("Formula is invalid");
}
if (formula.length() > 0 && formula.charAt(0) == '=')
{
// formulaNamespace = "report";
formulaExpression = formula.substring(1);
}
else
{
final int separator = formula.indexOf(':');
if (separator <= 0 || ((separator + 1) == formula.length()))
{
// error: invalid formula.
// formulaNamespace = null;
formulaExpression = null;
}
else
{
// formulaNamespace = formula.substring(0, separator);
formulaExpression = formula.substring(separator + 1);
}
}
if (formulaExpression == null)
{
throw new ParseException("Formula is invalid");
}
return new Formula(formulaExpression);
}