@SuppressWarnings({"unchecked", "rawtypes"}) private void truncate(Trace<?> dest, Trace<?> orig) throws IOException { long min_time = minTime * orig.ticsPerSecond(); long max_time = maxTime * orig.ticsPerSecond(); Converter truncater; if (orig.isStateful()) { truncater = new StatefulSubtraceConverter( (StatefulTrace<?, ?>) dest, (StatefulTrace<?, ?>) orig, min_time, max_time); } else { truncater = new SubtraceConverter(dest, orig, min_time, max_time); } truncater.convert(); }
@Override protected void run() throws IOException, NoSuchTraceException, AlreadyExistsException, LoadTraceException { if (orig_trace_name != null) { Trace<?> orig_trace = orig_store.getTrace(orig_trace_name); Trace<?> dest_trace = dest_store.newTrace(dest_trace_name, orig_trace.type(), force); truncate(dest_trace, orig_trace); } else { for (Trace<?> orig_trace : orig_store.listTraces()) { Trace<?> dest_trace = dest_store.newTrace(orig_trace.name(), orig_trace.type(), force); truncate(dest_trace, orig_trace); } } }