// Sort by SIF4
Collections.sort(criteriaSets, Collections.reverseOrder(new Comparator<CriteriaHierarchy>() {
@Override
public int compare(CriteriaHierarchy set1, CriteriaHierarchy set2) {
CriteriaNode treeRoot1 = set1.getCriteriaTreeRoot();
CriteriaNode treeRoot2 = set2.getCriteriaTreeRoot();
Double comp1 = new Double(treeRoot1.getImportanceFactorSIF7());
Double comp2 = new Double(treeRoot2.getImportanceFactorSIF7());
return comp1.compareTo(comp2);
}
}));
// Create data object
PotentialToRangeData data = new PotentialToRangeData();
// Title
data.setTitle("Maximum Impact to Average Impact");
data.setSourcesTitle("Criteria sets");
data.setFormatString("%.3f");
// Label of series
ArrayList<String> seriesLabels = new ArrayList<String>();
seriesLabels.add("Maximum Impact");
seriesLabels.add("Average Impact");
// Data lists for criteria sets
ArrayList<String> sourceLabels = new ArrayList<String>();
ArrayList<Double> potentialSeries = new ArrayList<Double>();
ArrayList<Double> rangeSeries = new ArrayList<Double>();
for (CriteriaHierarchy criteriaSet : criteriaSets) {
log.debug("Adding potential and range of node " + criteriaSet.getName());
// Source label
sourceLabels.add(criteriaSet.getName());
// Get root of tree
CriteriaNode treeRoot = criteriaSet.getCriteriaTreeRoot();
// Add values
potentialSeries.add(treeRoot.getImportanceFactorSIF7());
rangeSeries.add(treeRoot.getImportanceFactorSIF6());
}
// Set data
data.setSeriesLabels(seriesLabels);
data.setSourceLabels(sourceLabels);