这是我的csv文件。它包含重构操作前后的类和度量值。之后的值像这样metric_value_x和另一个metric_value_y一样写:
public class FindCountOfWordInString {
public static void main(String[] args) {
String str = "yhing ghingu jhhtring inghfg ajklingingd me";
String find = "ing";
int count = findCountOfWordInString(str, find);
System.out.println(count);
}
private static int findCountOfWordInString(String str, String find) {
String[] strArr = str.split(" ");
int count = 0, k = 0;
for (int i = 0; i < strArr.length; i++) {
if (strArr[i].contains(find)) {
String strCheck = strArr[i];
char[] findCharArr = find.toCharArray();
for (int j = 0; j < strCheck.length(); j++) {
if (strCheck.charAt(j) == findCharArr[k]) {
k++;
if (k == 3) {
count++;
k = 0;
}
} else {
k = 0;
}
}
}
}
return count;
}
}
我应该对ecah指标进行减法运算,并在末尾添加一个包含结果的新列 例如第一个指标:
Class cbo_x wmc_x dit_x rfc_x lcom_x totalMethods_x staticMethods_x publicMethods_x privateMethods_x protectedMethods_x defaultMethods_x abstractMethods_x finalMethods_x synchronizedMethods_x totalFields_x staticFields_x publicFields_x privateFields_x protectedFields_x defaultFields_x finalFields_x synchronizedFields_x nosi_x loc_x returnQty_x loopQty_x comparisonsQty_x tryCatchQty_x parenthesizedExpsQty_x stringLiteralsQty_x numbersQty_x assignmentsQty_x mathOperationsQty_x variablesQty_x maxNestedBlocks_x anonymousClassesQty_x subClassesQty_x lambdasQty_x uniqueWordsQty_x Unnamed: 40_x cbo_y wmc_y dit_y rfc_y lcom_y totalMethods_y staticMethods_y publicMethods_y privateMethods_y protectedMethods_y defaultMethods_y abstractMethods_y finalMethods_y synchronizedMethods_y totalFields_y staticFields_y publicFields_y privateFields_y protectedFields_y defaultFields_y finalFields_y synchronizedFields_y nosi_y loc_y returnQty_y loopQty_y comparisonsQty_y tryCatchQty_y parenthesizedExpsQty_y stringLiteralsQty_y numbersQty_y assignmentsQty_y mathOperationsQty_y variablesQty_y maxNestedBlocks_y anonymousClassesQty_y subClassesQty_y lambdasQty_y uniqueWordsQty_y Unnamed: 40_y
com.commonsware.cwac.merge.MergeAdapter 6 24 2 10 0 12 0 12 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 100 12 7 0 0 12 0 7 20 1 1 11 2 0 0 0 114 6 24 2 10 0 12 0 12 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 100 12 7 0 0 12 0 7 20 1 1 11 2 0 0 0 114
com.commonsware.cwac.sacklist.SackOfViewsAdapter 5 13 2 6 35 11 0 10 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 56 8 1 1 0 8 1 1 6 0 0 3 1 0 0 0 139 5 13 2 6 35 11 0 10 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 56 8 1 1 0 8 1 1 6 0 0 3 1 0 0 0 139
com.commonsware.cwac.wakeful.AlarmReceiver 11 13 2 20 1 2 0 1 1 0 0 0 0 0 1 1 0 1 0 0 1 0 3 74 2 1 2 1 2 10 1 9 0 0 9 4 0 0 0 65 11 13 2 20 1 2 0 1 1 0 0 0 0 0 1 1 0 1 0 0 1 0 3 74 2 1 2 1 2 10 1 9 0 0 9 4 0 0 0 65
com.commonsware.cwac.wakeful.WakefulIntentService 12 19 2 21 39 10 6 7 1 2 0 1 1 1 3 3 0 1 0 0 2 0 7 86 2 0 2 1 4 2 8 15 1 1 14 2 0 1 0 60 12 19 2 21 39 10 6 7 1 2 0 1 1 1 3 3 0 1 0 0 2 0 7 86 2 0 2 1 4 2 8 15 1 1 14 2 0 1 0 60
com.sunlightlabs.android.congress.BillPager 22 30 2 63 42 16 0 9 5 2 0 0 0 0 5 0 5 0 0 0 0 0 25 172 3 0 5 0 0 9 7 17 1 1 14 2 2 0 0 70 22 30 2 63 42 16 0 9 5 2 0 0 0 0 5 0 5 0 0 0 0 0 25 172 3 0 5 0 0 9 7 17 1 1 14 2 2 0 0 70
com.sunlightlabs.android.congress.BillSearch 12 6 2 30 8 5 0 5 0 0 0 0 0 0 1 0 0 0 0 0 0 0 15 72 0 0 0 0 0 7 3 10 1 1 10 1 1 0 0 44 12 6 2 30 8 5 0 5 0 0 0 0 0 0 1 0 0 0 0 0 0 0 15 72 0 0 0 0 0 7 3 10 1 1 10 1 1 0 0 44
请帮忙!