clusteredIndices[currentFunction] = functionIndices.get(0);
functionIndices.remove(0);
while (!functionIndices.isEmpty()) {
// get the last outputted function to match against
String currentCode = getJsForRange(clusteredIndices[currentFunction]);
final GeneralEditDistance editDistance =
GeneralEditDistances.getLevenshteinDistance(currentCode);
int bestIndex = 0;
int bestFunction = functionIndices.getFirst();
int bestDistance = MAX_DISTANCE_LIMIT;
int count = 0;
for (int functionIndex : functionIndices) {
if (count >= SEARCH_LIMIT) {
break;
}
String testCode = getJsForRange(functionIndex);
int dist = editDistance.getDistance(testCode, bestDistance);
if (dist < bestDistance) {
bestDistance = dist;
bestIndex = count;
bestFunction = functionIndex;
}