use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiData.DataType in project tracecompass by tracecompass.
the class LamiMixedAspect method resolveString.
@Override
@Nullable
public String resolveString(LamiTableEntry entry) {
LamiData data = entry.getValue(getColIndex());
Class<? extends LamiData> cls = data.getClass();
DataType dataType = DataType.fromClass(cls);
if (dataType == null) {
return data.toString();
}
String str = data.toString();
if (dataType.getUnits() != null) {
// $NON-NLS-1$
str += " " + dataType.getUnits();
}
return str;
}
use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiData.DataType in project tracecompass by tracecompass.
the class LamiAnalysis method getAspectsFromColumnDescriptions.
private static List<LamiTableEntryAspect> getAspectsFromColumnDescriptions(JSONArray columnDescriptions) throws JSONException {
ImmutableList.Builder<LamiTableEntryAspect> aspectsBuilder = new ImmutableList.Builder<>();
for (int j = 0; j < columnDescriptions.length(); j++) {
JSONObject column = columnDescriptions.getJSONObject(j);
DataType columnDataType;
String columnClass = column.optString(LamiStrings.CLASS, null);
if (columnClass == null) {
columnDataType = DataType.MIXED;
} else {
columnDataType = getDataTypeFromString(columnClass);
}
String columnTitle = column.optString(LamiStrings.TITLE, null);
if (columnTitle == null) {
// $NON-NLS-1$
columnTitle = String.format("%s #%d", columnDataType.getTitle(), j + 1);
}
final int colIndex = j;
switch(columnDataType) {
case TIME_RANGE:
/*
* We will add 3 aspects, to represent the start, end and
* duration of this time range.
*/
aspectsBuilder.add(new LamiTimeRangeBeginAspect(columnTitle, colIndex));
aspectsBuilder.add(new LamiTimeRangeEndAspect(columnTitle, colIndex));
aspectsBuilder.add(new LamiTimeRangeDurationAspect(columnTitle, colIndex));
break;
case TIMESTAMP:
aspectsBuilder.add(new LamiTimestampAspect(columnTitle, colIndex));
break;
case PROCESS:
aspectsBuilder.add(new LamiProcessNameAspect(columnTitle, colIndex));
aspectsBuilder.add(new LamiProcessPIDAspect(columnTitle, colIndex));
aspectsBuilder.add(new LamiProcessTIDAspect(columnTitle, colIndex));
break;
case IRQ:
aspectsBuilder.add(new LamiIRQTypeAspect(columnTitle, colIndex));
aspectsBuilder.add(new LamiIRQNameAspect(columnTitle, colIndex));
aspectsBuilder.add(new LamiIRQNumberAspect(columnTitle, colIndex));
break;
case DURATION:
aspectsBuilder.add(new LamiDurationAspect(columnTitle, colIndex));
break;
case MIXED:
aspectsBuilder.add(new LamiMixedAspect(columnTitle, colIndex));
break;
// $CASES-OMITTED$
default:
String units = column.optString(LamiStrings.UNIT, null);
if (units == null) {
units = columnDataType.getUnits();
}
/* We will add only one aspect representing the element */
LamiTableEntryAspect aspect = new LamiGenericAspect(columnTitle, units, colIndex, columnDataType.isContinuous(), false);
aspectsBuilder.add(aspect);
break;
}
}
/*
* SWT quirk : we need an empty column at the end or else the last data
* column will clamp to the right edge of the view if it is
* right-aligned.
*/
aspectsBuilder.add(LamiEmptyAspect.INSTANCE);
return aspectsBuilder.build();
}
Aggregations