Skip to content

Commit dd3f061

Browse files
committed
Add support for EQUALS number filter in SpecificationUtils
Signed-off-by: achour94 <[email protected]>
1 parent 9cf49b7 commit dd3f061

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/main/java/org/gridsuite/computation/utils/SpecificationUtils.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/**
2-
* Copyright (c) 2025, RTE (http://www.rte-france.com)
3-
* This Source Code Form is subject to the terms of the Mozilla Public
4-
* License, v. 2.0. If a copy of the MPL was not distributed with this
5-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6-
*/
7-
81
/**
92
* Copyright (c) 2025, RTE (http://www.rte-france.com)
103
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -236,6 +229,8 @@ private static <X> Specification<X> appendNumberFilterToSpecification(Specificat
236229
specification.and(lessThanOrEqual(resourceFilter.column(), valueDouble, tolerance));
237230
case GREATER_THAN_OR_EQUAL ->
238231
specification.and(greaterThanOrEqual(resourceFilter.column(), valueDouble, tolerance));
232+
case EQUALS -> specification.and(greaterThanOrEqual(resourceFilter.column(), valueDouble, tolerance))
233+
.and(lessThanOrEqual(resourceFilter.column(), valueDouble, tolerance));
239234
default ->
240235
throw new IllegalArgumentException("The filter type " + resourceFilter.type() + " is not supported with the data type " + resourceFilter.dataType());
241236
};

src/test/java/org/gridsuite/computation/specification/CommonSpecificationBuilderTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ void testBuildSpecification() {
8686
new ResourceFilterDTO(TEXT, CONTAINS, List.of("partialValue1", "partialValue2"), "dummyColumn"),
8787
new ResourceFilterDTO(NUMBER, LESS_THAN_OR_EQUAL, 100.0157, "dummyNumberColumn"),
8888
new ResourceFilterDTO(NUMBER, GREATER_THAN_OR_EQUAL, 10, "dummyNumberColumn", 0.1),
89-
new ResourceFilterDTO(NUMBER, NOT_EQUAL, 10, "parent.dummyNumberColumn")
89+
new ResourceFilterDTO(NUMBER, NOT_EQUAL, 10, "parent.dummyNumberColumn"),
90+
new ResourceFilterDTO(NUMBER, EQUALS, 42.000, "dummyNumberColumn")
9091
);
9192
List<ResourceFilterDTO> resourceFiltersWithChildren = List.of(
9293
new ResourceFilterDTO(NUMBER, NOT_EQUAL, 10, "parent.dummyNumberColumn")

0 commit comments

Comments
 (0)