added endTs and startTs to rolling argument

This commit is contained in:
IrynaMatveieva 2025-02-17 11:51:30 +02:00
parent 9f356e0a80
commit 1e46100cd2
2 changed files with 9 additions and 2 deletions

View File

@ -82,7 +82,8 @@ public class TsRollingArgumentEntry implements ArgumentEntry {
for (var e : tsRecords.entrySet()) { for (var e : tsRecords.entrySet()) {
values.add(new TbelCfTsDoubleVal(e.getKey(), e.getValue())); values.add(new TbelCfTsDoubleVal(e.getKey(), e.getValue()));
} }
return new TbelCfTsRollingArg(values); long ts = System.currentTimeMillis();
return new TbelCfTsRollingArg(ts - timeWindow, ts, values);
} }
@Override @Override

View File

@ -27,10 +27,16 @@ import static org.thingsboard.script.api.tbel.TbelCfTsDoubleVal.OBJ_SIZE;
public class TbelCfTsRollingArg implements TbelCfArg, Iterable<TbelCfTsDoubleVal> { public class TbelCfTsRollingArg implements TbelCfArg, Iterable<TbelCfTsDoubleVal> {
@Getter
private final long startTs;
@Getter
private final long endTs;
@Getter @Getter
private final List<TbelCfTsDoubleVal> values; private final List<TbelCfTsDoubleVal> values;
public TbelCfTsRollingArg(List<TbelCfTsDoubleVal> values) { public TbelCfTsRollingArg(long startTs, long endTs, List<TbelCfTsDoubleVal> values) {
this.startTs = startTs;
this.endTs = endTs;
this.values = Collections.unmodifiableList(values); this.values = Collections.unmodifiableList(values);
} }