/** * @return the end of the time series */ public long getEnd() { setStartAndEnd(); return end; }
/** * Copies a given metric time series. * * @param ts the time series * @return builder preconfigured with values from the given time series */ public MetricTimeSeries.Builder copy(MetricTimeSeries ts) { MetricTimeSeries.Builder result = new MetricTimeSeries.Builder(ts.getName(), ts.getType()); result.start(ts.getStart()); result.end(ts.getEnd()); result.points(ts.getTimestamps(), ts.getValues()); result.attributes(ts.attributes()); return result; } }
/** * @param t an iterator of non-descending timestamps * @return a timeSeries identical to this but relocated to t */ public TimeSeries<T, V> relocate(Iterator<T> t) { return new TimeSeries<>(t, this); }
/** * @param ts a time series * @param <T> the time type * @param <V> the value type * @return a new time series unioning all time stamps given, * the value being the list of all values valid at that time */ public static <T extends Comparable<T>, V> TimeSeries<T, List<V>> merge(Iterable<TimeSeries<T, V>> ts) { Iterator<Pair<T, List<V>>> aux = new TimeSeriesMerge<>(map(asIterator(ts), Iterable::iterator)); return new TimeSeries<>(aux); }
/** * @param ts a time series * @param <T> the time type * @param <V> the value type * @return a new time series unioning all time stamps given, * the value being the list of all values valid at that time */ public static <T extends Comparable<T>, V> TimeSeries<T, List<V>> merge(Iterable<TimeSeries<T, V>> ts) { Iterator<Pair<T, List<V>>> aux = new TimeSeriesMerge<>(map(asIterator(ts), Iterable::iterator)); return new TimeSeries<>(aux); }
@Override public long getEnd() { return timeSeries.getEnd(); }
@Override public long getStart() { return timeSeries.getStart(); }
@Override public String getName() { return timeSeries.getName(); }
@Override public Map<String, Object> getAttributes() { return timeSeries.getAttributesReference(); }
/** * Constructs a new Builder * * @param metric the metric name */ public Builder(String metric) { metricTimeSeries = new MetricTimeSeries(); metricTimeSeries.metric = metric; }
/** * This method merges n time series into one according to the following strategy: * The timestamps are merged; the resulting sequence is the union of the given ones. * The value is the list of all input values at that timestamp * * @param input an iterable of time series to be merged * @param <T> the time type * @param <V> type of input values * @return iterator of merged pairs of (time, list of values)) */ public static <T extends Comparable<T>, V> Iterator<Pair<T, List<V>>> merge(Iterable<Iterator<Pair<T, V>>> input) { return new TimeSeriesMerge<>(input); }
@Override public void sort() { timeSeries.sort(); }
@Override public String getType() { return timeSeries.getType(); }
/** * Constructs a new Builder * * @param metric the metric name */ public Builder(String metric) { straceTimeSeries = new StraceTimeSeries(); straceTimeSeries.metric = metric; }
/** * @param t an iterator of non-descending timestamps * @return a timeSeries identical to this but relocated to t */ public TimeSeries<T, V> relocate(Iterator<T> t) { return new TimeSeries<>(t, this); }
/** * @return the start of the time series */ public long getStart() { setStartAndEnd(); return start; }
/** * Constructs a new Builder * * @param metric the metric name */ public Builder(String metric) { metricTimeSeries = new MetricTimeSeries(); metricTimeSeries.metric = metric; }
/** * This method merges n time series into one according to the following strategy: * The timestamps are merged; the resulting sequence is the union of the given ones. * The value is the list of all input values at that timestamp * * @param input an iterable of time series to be merged * @param <T> the time type * @param <V> type of input values * @return iterator of merged pairs of (time, list of values)) */ public static <T extends Comparable<T>, V> Iterator<Pair<T, List<V>>> merge(Iterable<Iterator<Pair<T, V>>> input) { return new TimeSeriesMerge<>(input); }
/** * @return the end of the time series */ public long getEnd() { setStartAndEnd(); return end; }
/** * @return the start of the time series */ public long getStart() { setStartAndEnd(); return start; }