logger.debug("processCharactersOf : !!!!!!!!! context is not an ASTNode ( " +
contextObject.getClass() + " )!!!!!!!!!!");
return;
}
ASTNode astNode = (ASTNode) contextObject;
// System.out.println("MathMLStaxParser : processCharactersOf : context type : " + astNode.getType());
FunctionDefinition functionDef = null;
try {
functionDef = astNode.getParentSBMLObject().getModel().getFunctionDefinition(characters.trim());
} catch(NullPointerException e) {
logger.debug("WARNING : cannot recognize properly functionDefinition in mathML block !!!");
}
if (isFunctionDefinition)
{
logger.debug("MathMLStaxParser : processCharactersOf : function found !!");
logger.debug("Model : " + astNode.getParentSBMLObject().getModel() + ", functionDef = " + functionDef);
if (astNode.getParentSBMLObject().getModel() != null && functionDef == null)
{
logger.warn("Cannot recognize functionDefinition with id '" + characters.trim() + "'");
}
astNode.setType(Type.FUNCTION);
}
if (astNode.isName() || astNode.isFunction()) {
astNode.setName(characters.trim());
} else if (astNode.isInteger()) {
astNode.setValue(StringTools.parseSBMLInt(characters.trim()));
} else if (astNode.isRational()) {
if (elementName == null) {
astNode.setValue(astNode.getNumerator(), StringTools.parseSBMLInt(characters.trim()));
} else {
astNode.setValue(StringTools.parseSBMLInt(characters.trim()), (int) 0);
}
} else if (astNode.getType().equals(Type.REAL_E)) {
if (elementName == null) {
astNode.setValue(astNode.getMantissa(), StringTools.parseSBMLInt(characters.trim()));
} else {
astNode.setValue(StringTools.parseSBMLDouble(characters.trim()), (int) 0);
}
} else if (astNode.isReal()) {
astNode.setValue(Double.valueOf(characters.trim()));
} else if (astNode.getType().equals(Type.FUNCTION_DELAY)) {
astNode.setName(characters.trim());
} else {
logger.warn("processCharactersOf : !!!!!!!!! I don't know what to do with that : " +
elementName + " !!!!!!!!!!");
}
}