use of org.eclipse.titanium.metrics.Statistics in project titan.EclipsePlug-ins by eclipse.
the class ProjectStatNode method getColumnText.
@Override
public String getColumnText(final MetricData data, final int i) {
if (i == 0) {
return metric.getName();
} else {
StatColumn c = null;
switch(i) {
case 1:
c = StatColumn.TOTAL;
break;
case 2:
c = StatColumn.MAX;
break;
case 3:
c = StatColumn.MEAN;
break;
case 4:
c = StatColumn.DEV;
break;
default:
return null;
}
Statistics s;
if (metric instanceof AltstepMetric) {
s = data.getStatistics((AltstepMetric) metric);
} else if (metric instanceof FunctionMetric) {
s = data.getStatistics((FunctionMetric) metric);
} else if (metric instanceof TestcaseMetric) {
s = data.getStatistics((TestcaseMetric) metric);
} else if (metric instanceof ModuleMetric) {
s = data.getStatistics((ModuleMetric) metric);
} else {
throw new IllegalArgumentException(metric.getName() + " is not a subproject metric");
}
final Number n = s.get(c);
return n == null ? null : n.toString();
}
}
use of org.eclipse.titanium.metrics.Statistics in project titan.EclipsePlug-ins by eclipse.
the class InfoWindow method createContents.
/**
* Fills the table with metrics data, and shows the InfoWindow
*
* @param node
* : The module to show info about.
*/
private void createContents(final NodeDescriptor node) {
if (node.isMissing()) {
errorHandler.reportErrorMessage("The module \"" + node.getDisplayName() + "\" cannot be found on the disk!");
return;
}
final String shownName = node.getDisplayName();
List<String> actRow = null;
addRow(new ArrayList<String>(Arrays.asList("General Information")), Color.lightGray);
addRow(new ArrayList<String>(Arrays.asList("Module name", shownName)), Color.white);
for (final MetricGroup type : new MetricGroup[] { MetricGroup.MODULE }) {
addRow(new ArrayList<String>(Arrays.asList(type.getGroupName() + " metrics")), Color.lightGray);
for (final IMetricEnum metric : type.getMetrics()) {
if (!PreferenceManager.isEnabledOnModuleGraph(metric)) {
continue;
}
actRow = new ArrayList<String>();
actRow.add(metric.getName());
String val = null;
final Number tempVal = metricsProvider.getValue(metric, module.getName());
if (tempVal != null) {
val = tempVal.toString();
}
actRow.add(val);
if (chosenMetric.equals(metric)) {
addRow(actRow, node.getColor());
} else {
addRow(actRow, Color.white);
}
}
}
for (final MetricGroup type : new MetricGroup[] { MetricGroup.ALTSTEP, MetricGroup.FUNCTION, MetricGroup.TESTCASE }) {
addRow(new ArrayList<String>(Arrays.asList(type.getGroupName())), Color.lightGray);
for (final IMetricEnum metric : type.getMetrics()) {
if (!PreferenceManager.isEnabledOnModuleGraph(metric)) {
continue;
}
actRow = new ArrayList<String>();
actRow.add(metric.getName());
final Statistics stat = metricsProvider.getStats(metric, module.getName());
for (final StatColumn actCol : StatColumn.values()) {
final Number val = stat == null ? null : stat.get(actCol);
actRow.add(val == null ? "-" : val.toString());
}
if (chosenMetric.equals(metric)) {
addRow(actRow, node.getColor());
} else {
addRow(actRow, Color.white);
}
}
}
}
use of org.eclipse.titanium.metrics.Statistics in project titan.EclipsePlug-ins by eclipse.
the class ModuleStatNode method getColumnText.
@Override
public String getColumnText(final MetricData data, final int i) {
if (i == 0) {
return module.getName();
} else {
StatColumn c = null;
switch(i) {
case 1:
c = StatColumn.TOTAL;
break;
case 2:
c = StatColumn.MAX;
break;
case 3:
c = StatColumn.MEAN;
break;
case 4:
c = StatColumn.DEV;
break;
default:
return null;
}
Statistics stat;
if (metric instanceof AltstepMetric) {
stat = data.getStatistics((AltstepMetric) metric, module);
} else if (metric instanceof FunctionMetric) {
stat = data.getStatistics((FunctionMetric) metric, module);
} else if (metric instanceof TestcaseMetric) {
stat = data.getStatistics((TestcaseMetric) metric, module);
} else {
throw new AssertionError("ModuleStatNode should have a subModule-metric");
}
final Number n = stat.get(c);
return n == null ? null : n.toString();
}
}
Aggregations