use of org.diirt.util.TimeInterval in project yamcs-studio by yamcs.
the class Replay method createValues.
@Override
List<VDouble> createValues(TimeInterval interval) {
offset = Duration.between(interval.getStart(), ((VDouble) values.getValues().get(0)).getTimestamp()).abs();
TimeInterval originalInterval = interval.minus(offset);
List<VDouble> newValues = new ArrayList<VDouble>();
for (ReplayValue value : values.getValues()) {
if (originalInterval.contains(value.getTimestamp())) {
ReplayValue copy = value.copy();
if (values.isAdjustTime()) {
copy.adjustTime(offset);
}
newValues.add((VDouble) copy);
}
}
return newValues;
}
use of org.diirt.util.TimeInterval in project yamcs-studio by yamcs.
the class SynchronizedVDoubleAggregator method readValue.
@Override
public VMultiDouble readValue() {
Instant reference = electReferenceTimeStamp(collectors);
if (reference == null)
return null;
TimeInterval allowedInterval = TimeInterval.around(tolerance, reference);
List<VDouble> values = new ArrayList<VDouble>(collectors.size());
StringBuilder buffer = new StringBuilder();
for (ReadFunction<List<VDouble>> collector : collectors) {
List<VDouble> data = collector.readValue();
if (log.isLoggable(Level.FINE)) {
buffer.append(data.size()).append(", ");
}
VDouble value = closestElement(data, allowedInterval, reference);
values.add(value);
}
if (log.isLoggable(Level.FINE)) {
log.fine(buffer.toString());
}
return ValueFactory.newVMultiDouble(values, ValueFactory.alarmNone(), ValueFactory.newTime(reference), ValueFactory.displayNone());
}
Aggregations