* Create the two groups "ALL_METRICS" and "ALL_CUSTOM".
* Those will always be shown as the two first in the metrics sidebar dropdown box.
*/
private void createManualGroups() {
// Manual "All metrics" algorithm group
AlgorithmGroup manualAlgorithmGroup = AlgorithmGroup.Factory.newInstance();
manualAlgorithmGroup.setID(ALL_METRICS_GROUP_NAME);
manualAlgorithmGroup.setName("Metrics.AlgorthimGroup.Name.AllMetrics");
manualAlgorithmGroup.setDescription("Metrics.AlgorthimGroup.Descr.AllMetrics");
manualAlgorithmGroup.setGroupOrder(-3);
// Add all groups
for(String key : algorithmGroupsMap.keySet())
manualAlgorithmGroup.addNewAlgorithmID().setStringValue(key);
// Create dummy group for all yet ungrouped metrics of a file
List<String> ungroupedMetrics = getUngroupedMetricsFromFile(0);
AlgorithmGroup dummyAlgorithmGroup = AlgorithmGroup.Factory.newInstance();
dummyAlgorithmGroup.setID("UNGROUPED_" + fileMap.get(0));
dummyAlgorithmGroup.setName(new File(fileMap.get(0)).getName() + "_ungrouped");
dummyAlgorithmGroup.setNonTranslatable(true);
dummyAlgorithmGroup.setGroupOrder(currentGroupOrder++);
for(String key : ungroupedMetrics)
dummyAlgorithmGroup.addNewAlgorithmID().setStringValue(key);
manualAlgorithmGroup.addNewAlgorithmID().setStringValue(dummyAlgorithmGroup.getID());
algorithmGroupsMap.put(dummyAlgorithmGroup.getID(), dummyAlgorithmGroup);
algorithmGroupsMap.put(manualAlgorithmGroup.getID(), manualAlgorithmGroup);
algorithmGroupIDOrder.put(dummyAlgorithmGroup.getGroupOrder(), dummyAlgorithmGroup.getID());
algorithmGroupIDOrder.put(manualAlgorithmGroup.getGroupOrder(), manualAlgorithmGroup.getID());
algorithmGroupOrigin.put(dummyAlgorithmGroup.getID(), 0);
// Manual "All custom" algorithm group
manualAlgorithmGroup = AlgorithmGroup.Factory.newInstance();
manualAlgorithmGroup.setID(ALL_CUSTOM_GROUP_NAME);
manualAlgorithmGroup.setName("Metrics.AlgorthimGroup.Name.AllCustom");
manualAlgorithmGroup.setDescription("Metrics.AlgorthimGroup.Descr.AllCustom");
manualAlgorithmGroup.setGroupOrder(-1);
// Add all custom groups
for(String key : algorithmGroupsMap.keySet()){
if(isCustomMetric(key))
manualAlgorithmGroup.addNewAlgorithmID().setStringValue(key);
}
for(int i : fileMap.keySet()){
// FileID = internal metrics -> skip that iteration
if(i == 0)
continue;
// Create dummy group for all yet ungrouped metrics of a file
List<String> ungroupedCustomMetrics = getUngroupedMetricsFromFile(i);
dummyAlgorithmGroup = AlgorithmGroup.Factory.newInstance();
dummyAlgorithmGroup.setID("UNGROUPED_" + fileMap.get(i));
dummyAlgorithmGroup.setName(new File(fileMap.get(i)).getName() + "_ungrouped");
dummyAlgorithmGroup.setNonTranslatable(true);
dummyAlgorithmGroup.setGroupOrder(currentGroupOrder++);
for(String key : ungroupedCustomMetrics){
dummyAlgorithmGroup.addNewAlgorithmID().setStringValue(key);
dummyAlgorithmGroup.getAlgorithmIDArray(dummyAlgorithmGroup.getAlgorithmIDArray().length - 1).setOrder(dummyAlgorithmGroup.getAlgorithmIDArray().length);
}
}
manualAlgorithmGroup.addNewAlgorithmID().setStringValue(dummyAlgorithmGroup.getID());
algorithmGroupsMap.put(dummyAlgorithmGroup.getID(), dummyAlgorithmGroup);
algorithmGroupsMap.put(manualAlgorithmGroup.getID(), manualAlgorithmGroup);
algorithmGroupIDOrder.put(dummyAlgorithmGroup.getGroupOrder(), dummyAlgorithmGroup.getID());
algorithmGroupIDOrder.put(manualAlgorithmGroup.getGroupOrder(), manualAlgorithmGroup.getID());
algorithmGroupOrigin.put(dummyAlgorithmGroup.getID(), -1);
}