-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new type of NodeCalc to compute Min/Max between timeseries #2820
Conversation
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
assertEquals(Sets.newHashSet(1), tsCalc.getVersions()); | ||
|
||
List<DoubleTimeSeries> tsLs = Arrays.asList(ts, tsCalc); | ||
List<DoubleTimeSeries> tsLs = Arrays.asList(ts, tsCalc, tsCalcMin, tsCalcMax); | ||
String json = TimeSeries.toJson(tsLs); | ||
String jsonRef = String.join(System.lineSeparator(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we have text blocks in Java 17, we can do it much simpler and cleaner.
Maybe should be done in another PR.
@@ -52,4 +48,8 @@ public interface NodeCalcVisitor<R, A> { | |||
R visit(TimeSeriesNameNodeCalc nodeCalc, A arg); | |||
|
|||
R visit(TimeSeriesNumNodeCalc nodeCalc, A arg); | |||
|
|||
R visit(AbstractBinaryNodeCal nodeCalc, A arg, R left, R right); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should continue with same design that previous by having in the visitor only child node and not abstracts. As you can see, as doing that you need to lot of instanceof check in all implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -8,6 +8,7 @@ package com.powsybl.timeseries.dsl | |||
|
|||
import com.powsybl.commons.PowsyblException | |||
import com.powsybl.timeseries.ast.BigDecimalNodeCalc | |||
import com.powsybl.timeseries.ast.BinaryMinCalc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused import?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Quality Gate failedFailed conditions 5.1% Duplication on New Code (required ≤ 3%) |
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
No
What kind of change does this PR introduce?
Feature
What is the current behavior?
Using NodeCalc, it is only possible to get
timeseries["foo"].min(comparedValue)
the minimum betweencomparedValue
and the values of the timeseries.What is the new behavior (if this is a feature change)?
It is now possible to get the minimal value(s) between two timeseries using
min(timeseries["foo"], timeseries["bar"])
in a groovy scriptDoes this PR introduce a breaking change or deprecate an API?
If yes, please check if the following requirements are fulfilled
What changes might users need to make in their application due to this PR? (migration steps)
Other information: