/** * */ public OJOperation findToString() { OJOperation result = null; Iterator it = getOperations().iterator(); while (it.hasNext()) { OJOperation oper = (OJOperation) it.next(); if (oper.getName().equals("toString")) result = oper; } return result; }
public OJOperation findOperation(String name, List<OJPathName> types) { OJOperation result = null; Iterator it = getOperations().iterator(); while (it.hasNext()) { OJOperation elem = (OJOperation) it.next(); if (elem.isEqual(name, types)) return elem; } return result; }
/** * */ public OJOperation findIdentOper() { OJOperation result = null; Iterator it = getOperations().iterator(); while (it.hasNext()) { OJOperation oper = (OJOperation) it.next(); if (oper.getName().equals("getIdentifyingString")) result = oper; } return result; }
/** * @return */ protected StringBuilder operations() { // sort the operations on visibilityKind, then name List<OJOperation> temp = new ArrayList<OJOperation>(this.getOperations()); Collections.sort(temp, new OJOperationComparator()); // StringBuilder result = new StringBuilder(); result.append(JavaUtil.collectionToJavaString(temp, "\n")); // if ( result.length() > 0) result.append("\n"); return result; }
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()); } }
@Override public void renameAll(Set<OJPathName> renamePathNames, String suffix) { if (renamePathNames.contains(getPathName())) { this.suffix = suffix; } Set<OJPathName> newImports = new HashSet<OJPathName>(); Collection<OJPathName> imports = getImports(); for (OJPathName ojPathName : imports) { OJPathName newImport = ojPathName.getDeepCopy(); newImport.renameAll(renamePathNames, suffix); newImports.add(newImport); } setImports(newImports); Collection<OJOperation> operations = getOperations(); for (OJOperation ojOperation : operations) { ojOperation.renameAll(renamePathNames, suffix); } }
public void calcImports() { // operations for (OJOperation oper : getOperations()) { addAll(oper.getParamTypes()); this.addToImports(oper.getReturnType()); addImportsRecursively(oper.getBody()); } }