@Test public void timestampDelta() { long ts[] = new long[]{100, 200, 350}; timestamp_delta td = ToXdr.timestamp_delta(ts); assertEquals(100l, td.first); assertArrayEquals(new int[]{100, 150}, td.delta); }
public static timestamp_delta timestamp_delta(long[] timestamps) { timestamps = Arrays.copyOf(timestamps, timestamps.length); Arrays.sort(timestamps); long begin = timestamps[0]; int[] result = new int[timestamps.length - 1]; for (int i = 1; i < timestamps.length; ++i) { final long delta = timestamps[i] - begin; if (delta > Integer.MAX_VALUE) throw new RuntimeException("encoding error: time delta too large"); result[i - 1] = (int) delta; begin = timestamps[i]; } timestamp_delta ts = new timestamp_delta(); ts.first = timestamps[0]; ts.delta = result; return ts; }
ToXdr { public static timestamp_delta timestamp_delta(long[] timestamps) { timestamps = Arrays.copyOf(timestamps, timestamps.length); Arrays.sort(timestamps); long begin = timestamps[0]; int[] result = new int[timestamps.length - 1]; for (int i = 1; i < timestamps.length; ++i) { final long delta = timestamps[i] - begin; if (delta > Integer.MAX_VALUE) throw new RuntimeException("encoding error: time delta too large"); result[i - 1] = (int) delta; begin = timestamps[i]; } timestamp_delta ts = new timestamp_delta(); ts.first = timestamps[0]; ts.delta = result; return ts; } }
ToXdr { public static timestamp_delta timestamp_delta(long[] timestamps) { timestamps = Arrays.copyOf(timestamps, timestamps.length); Arrays.sort(timestamps); long begin = timestamps[0]; int[] result = new int[timestamps.length - 1]; for (int i = 1; i < timestamps.length; ++i) { final long delta = timestamps[i] - begin; if (delta > Integer.MAX_VALUE) throw new RuntimeException("encoding error: time delta too large"); result[i - 1] = (int) delta; begin = timestamps[i]; } timestamp_delta ts = new timestamp_delta(); ts.first = timestamps[0]; ts.delta = result; return ts; }  }
ToXdr { public static timestamp_delta timestamp_delta(long[] timestamps) { timestamps = Arrays.copyOf(timestamps, timestamps.length); Arrays.sort(timestamps); long begin = timestamps[0]; int[] result = new int[timestamps.length - 1]; for (int i = 1; i < timestamps.length; ++i) { final long delta = timestamps[i] - begin; if (delta > Integer.MAX_VALUE) throw new RuntimeException("encoding error: time delta too large"); result[i - 1] = (int) delta; begin = timestamps[i]; } timestamp_delta ts = new timestamp_delta(); ts.first = timestamps[0]; ts.delta = result; return ts; }  static timestamp_msec timestamp(DateTime ts); static timestamp_msec timestamp(long ts); static file_segment filePos(FilePos pos); static metric_value metricValue(MetricValue mv, Function<String, Integer> strAlloc); static histogram histogram(Histogram h); static timestamp_delta timestamp_delta(long[] timestamps); static bitset bitset(boolean bits[]); static bitset createPresenceBitset(TIntSet have, int timestampsSize); }
ToXdr { public static timestamp_delta timestamp_delta(long[] timestamps) { timestamps = Arrays.copyOf(timestamps, timestamps.length); Arrays.sort(timestamps); long begin = timestamps[0]; int[] result = new int[timestamps.length - 1]; for (int i = 1; i < timestamps.length; ++i) { final long delta = timestamps[i] - begin; if (delta > Integer.MAX_VALUE) throw new RuntimeException("encoding error: time delta too large"); result[i - 1] = (int) delta; begin = timestamps[i]; } timestamp_delta ts = new timestamp_delta(); ts.first = timestamps[0]; ts.delta = result; return ts; }  static timestamp_msec timestamp(DateTime ts); static timestamp_msec timestamp(long ts); static file_segment filePos(FilePos pos); static metric_value metricValue(MetricValue mv, Function<String, Integer> strAlloc); static histogram histogram(Histogram h); static timestamp_delta timestamp_delta(long[] timestamps); static bitset bitset(boolean bits[]); static bitset createPresenceBitset(TIntSet have, int timestampsSize);  }