use of org.eclipse.tracecompass.tmf.core.event.TmfEvent in project tracecompass by tracecompass.
the class TmfMipmapStateProviderStub method createEvent.
/**
* @param time
* The event type
* @param longVal
* The event value or null
* @return A new TmfEvent
*/
@NonNull
public ITmfEvent createEvent(long time, Long longVal) {
ITmfStateValue value;
if (longVal == null) {
value = TmfStateValue.nullValue();
} else if (type == ITmfStateValue.Type.LONG) {
value = TmfStateValue.newValueLong(longVal);
} else if (type == ITmfStateValue.Type.INTEGER) {
value = TmfStateValue.newValueInt(longVal.intValue());
} else if (type == ITmfStateValue.Type.DOUBLE) {
value = TmfStateValue.newValueDouble(longVal.doubleValue());
} else {
value = TmfStateValue.nullValue();
}
ITmfTimestamp timestamp = TmfTimestamp.fromNanos(time);
ITmfEventType eventType = new TmfEventType(MIPMAP_ID, null);
ITmfEventField content = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, value, null);
ITmfEvent event = new TmfEvent(null, ITmfContext.UNKNOWN_RANK, timestamp, eventType, content);
return event;
}
Aggregations