public EolElement createDomElement(AST ast, EolElement container, Ast2EvlContext context) { EolElement result = null; for (EolElementCreator dec : domElementCreators) { if (dec.appliesTo(ast)) { result = dec.create(ast, container, context); // System.out.println(dec.getClass()); break; } } if (result == null) { throw new RuntimeException( "Cannot create dom element for " + ast.getText() + "->" + ast.getType() + ": " + ast.getLine() + "-" + ast.getColumn()); } else { context.getTrace().put(result, ast); this.addCreatedDomElements(result); return result; } }
public EolElement createDomElement( AST ast, EolElement container, Ast2EvlContext context, Class<? extends EolElementCreator> ofCreatorClass) { EolElement result = null; for (EolElementCreator dec : domElementCreators) { if (ofCreatorClass == dec.getClass()) { result = dec.create(ast, container, context); break; } } if (result == null) { throw new RuntimeException("Cannot fetch creator for class: " + ofCreatorClass.toString()); } else { this.addCreatedDomElements(result); return result; } }