public void addToImports(String pathName) { if (pathName == null) return; OJPathName path = new OJPathName(pathName); addToImports(path); }
private void addAll(List<OJPathName> types) { for (OJPathName type : types) { if (type != null) { this.addToImports(type); if (!type.getElementTypes().isEmpty()) { addAll(type.getElementTypes()); } } } }
public void copyDeepInfoInto(OJClassifier copy) { super.copyDeepInfoInto(copy); copy.setUniqueNumber(getUniqueNumber()); copy.setDerived(isDerived()); copy.setAbstract(isAbstract()); Iterator operationsIt = new ArrayList<OJOperation>(getOperations()).iterator(); while (operationsIt.hasNext()) { OJOperation elem = (OJOperation) operationsIt.next(); copy.addToOperations(elem.getDeepCopy()); } Iterator importsIt = new ArrayList<OJPathName>(getImports()).iterator(); while (importsIt.hasNext()) { OJPathName elem = (OJPathName) importsIt.next(); copy.addToImports(elem.getCopy()); } }
/** * Copies all attributes and associations of this instance into 'copy'. True parts, i.e. associations marked 'aggregate' or 'composite', * and attributes, are copied as well. References to other objects, i.e. associations not marked 'aggregate' or 'composite', will not be * copied. The 'copy' will refer to the same objects as the original (this) instance. * * @param copy */ public void copyInfoInto(OJClassifier copy){ super.copyInfoInto(copy); copy.setUniqueNumber(getUniqueNumber()); copy.setDerived(isDerived()); copy.setAbstract(isAbstract()); Iterator operationsIt = new ArrayList<OJOperation>(getOperations()).iterator(); while(operationsIt.hasNext()){ OJOperation elem = (OJOperation) operationsIt.next(); copy.addToOperations(elem); } Iterator importsIt = new ArrayList<OJPathName>(getImports()).iterator(); while(importsIt.hasNext()){ OJPathName elem = (OJPathName) importsIt.next(); copy.addToImports(elem); } } }
this.addToImports(path2); for (OJPathName generic : path.getGenerics()) { addToImports(generic); OJPathName path2 = path.getCopy().getHead(); path2.addToNames(lastEntry); this.addToImports(path2); } else { addToImports(generic);
public void calcImports() { // operations for (OJOperation oper : getOperations()) { addAll(oper.getParamTypes()); this.addToImports(oper.getReturnType()); addImportsRecursively(oper.getBody()); } }
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()); } } } } }