public void renameAll(Set<OJPathName> renamePathNames, String suffix) { if (getElemType() != null) { getElemType().renameAll(renamePathNames, suffix); } setCollection(replaceAll(getCollection(), renamePathNames, suffix)); if (getBody() != null) { getBody().renameAll(renamePathNames, suffix); } } }
public void copyDeepInfoInto(OJForStatement copy) { super.copyDeepInfoInto(copy); copy.setElemName(getElemName()); copy.setCollection(getCollection()); if (getElemType() != null) { copy.setElemType(getElemType().getDeepCopy()); } if (getBody() != null) { copy.setBody(getBody().getDeepCopy()); } }
public String toJavaString() { String result = "for ( " + getElemType().getCollectionTypeName() + " " + getElemName() + " : " + getCollection() + " ) {\n"; result = result + JavaStringHelpers.indent(getBody().toJavaString(), 1) + "\n}"; return result; }
protected void addImportsRecursively(OJBlock body) { if (body != null) { for (OJField ojField : body.getLocals()) { this.addToImports(ojField.getType()); } for (OJStatement s : body.getStatements()) { if (s instanceof OJIfStatement) { addImportsRecursively(((OJIfStatement) s).getThenPart()); addImportsRecursively(((OJIfStatement) s).getElsePart()); } else if (s instanceof OJBlock) { addImportsRecursively(((OJBlock) s)); } else if (s instanceof OJTryStatement) { addImportsRecursively(((OJTryStatement) s).getTryPart()); addImportsRecursively(((OJTryStatement) s).getCatchPart()); } else if (s instanceof OJWhileStatement) { addImportsRecursively(((OJWhileStatement) s).getBody()); } else if (s instanceof OJForStatement) { addImportsRecursively(((OJForStatement) s).getBody()); addToImports(((OJForStatement) s).getElemType()); } else if (s instanceof OJSwitchStatement) { for (OJSwitchCase ojSwitchCase : ((OJSwitchStatement) s).getCases()) { addImportsRecursively(ojSwitchCase.getBody()); } } } } }