@Override public boolean check(ValidationContext ctx, ASTNode node) { // Only allowed on numbers if (node.isSetUnits()) { return node.isNumber(); } if (node.isSetUserObjects() && node.getUserObject(JSBML.UNKNOWN_XML) != null) { String invalidUnits = ValidationTools.checkUnknowndAttribute(ctx, node, "units"); if (invalidUnits != null) { return false; } } if (node.getParentSBMLObject() != null && node.getParentSBMLObject().getUserObject(JSBML.UNKNOWN_XML) != null) { // System.out.println(node.getParentSBMLObject().getUserObject(JSBML.UNKNOWN_XML)); // TODO - put this test on the MathContainer only to avoid getting it several times String invalidUnits = ValidationTools.checkUnknowndAttribute(ctx, (AbstractTreeNode) node.getParentSBMLObject(), "units"); if (invalidUnits != null) { return false; } } return true; } };