/** * Parses the line, removing the package name for each type * (and adding the appropriate import) if the type is * unambiguous. */ private void adjustLine(String line, Map typeNameMap) { StringBuffer lineInProgress = new StringBuffer(line); Set typeNames = parseForTypeNames(lineInProgress.toString()); for (Iterator i = typeNames.iterator(); i.hasNext();) { String typeName = (String)i.next(); String adjustedTypeName = adjustTypeName(typeName, typeNameMap); if (!typeName.equals(adjustedTypeName)) { int typeNameStartIndex = lineInProgress.toString().indexOf(typeName); while (typeNameStartIndex != -1) { lineInProgress.replace(typeNameStartIndex, typeNameStartIndex + typeName.length(), adjustedTypeName); typeNameStartIndex = lineInProgress.toString().indexOf(typeName); } } } replaceLine(line, lineInProgress.toString()); }
/** * Parses the line, removing the package name for each type * (and adding the appropriate import) if the type is * unambiguous. */ private void adjustLine(String line, Map typeNameMap) { StringBuffer lineInProgress = new StringBuffer(line); Set typeNames = parseForTypeNames(lineInProgress.toString()); for (Iterator i = typeNames.iterator(); i.hasNext();) { String typeName = (String)i.next(); String adjustedTypeName = adjustTypeName(typeName, typeNameMap); if (!typeName.equals(adjustedTypeName)) { int typeNameStartIndex = lineInProgress.toString().indexOf(typeName); while (typeNameStartIndex != -1) { lineInProgress.replace(typeNameStartIndex, typeNameStartIndex + typeName.length(), adjustedTypeName); typeNameStartIndex = lineInProgress.toString().indexOf(typeName); } } } replaceLine(line, lineInProgress.toString()); }
/** * Parses the line, removing the package name for each type * (and adding the appropriate import) if the type is * unambiguous. */ private void adjustLine(String line, Map typeNameMap) { StringBuffer lineInProgress = new StringBuffer(line); Set typeNames = parseForTypeNames(lineInProgress.toString()); for (Iterator i = typeNames.iterator(); i.hasNext();) { String typeName = (String)i.next(); String adjustedTypeName = adjustTypeName(typeName, typeNameMap); if (!typeName.equals(adjustedTypeName)) { int typeNameStartIndex = lineInProgress.toString().indexOf(typeName); while (typeNameStartIndex != -1) { lineInProgress.replace(typeNameStartIndex, typeNameStartIndex + typeName.length(), adjustedTypeName); typeNameStartIndex = lineInProgress.toString().indexOf(typeName); } } } replaceLine(line, lineInProgress.toString()); }