diff --git a/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/AreIn.java b/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/AreIn.java index 2e4f1578a..50cddb5cb 100644 --- a/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/AreIn.java +++ b/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/AreIn.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2022 Crown Copyright + * Copyright 2017-2025 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,9 +37,9 @@ * An AreIn is a {@link java.util.function.BiPredicate} * that checks if a provided {@link java.util.Collection} contains all the provided input values. * - * There is also a nullOrEmptyAllowedValuesAccepted flag which defaults to true. - * If the provided allowedValues collection is null or empty, the flag's value - * will be used as the result for any input test. + * An optional nullOrEmptyAllowedValuesAccepted flag (defaults to true) can determine + * whether the provided allowedValues collection can be null or empty. The return value + * for any null or empty input will be equal to the value of the nullOrEmptyAllowedValuesAccepted flag. */ @Since("1.0.0") @Summary("Checks if a provided collection contains all the provided input values") diff --git a/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/CollectionContains.java b/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/CollectionContains.java index 77ee10de5..bcd62a80c 100644 --- a/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/CollectionContains.java +++ b/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/CollectionContains.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2022 Crown Copyright + * Copyright 2017-2025 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,9 @@ /** * An CollectionContains is a {@link java.util.function.Predicate} * that checks if a {@link java.util.Collection} contains a provided value. + * + * If the collection contains null values or is empty, then false will be returned. + * */ @Since("1.0.0") @Summary("Checks if a collection contains a provided value") diff --git a/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/IsIn.java b/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/IsIn.java index e5300b63e..b6dfc910d 100644 --- a/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/IsIn.java +++ b/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/IsIn.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Crown Copyright + * Copyright 2017-2025 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ import java.util.Set; /** - * An IsIn is a {@link java.util.function.Predicate} that checks that the input is + * IsIn is a {@link java.util.function.Predicate} that checks that the input is * in a set of allowed values. */ @Since("1.0.0") diff --git a/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/range/InDateRangeDual.java b/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/range/InDateRangeDual.java index 109982241..dbbe0bd95 100644 --- a/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/range/InDateRangeDual.java +++ b/core/src/main/java/uk/gov/gchq/koryphe/impl/predicate/range/InDateRangeDual.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Crown Copyright + * Copyright 2017-2025 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,23 +29,27 @@ /** *

* An InDateRangeDual is a {@link java.util.function.Predicate} - * that tests if a start {@link Comparable} and end {@link Comparable} is - * within a provided range [start, end]. Specifically the start {@link Comparable} - * has to be greater than the start bound and the end {@link Comparable} has to - * be less than the end bound. - * By default the range is inclusive, you can toggle this using the startInclusive - * and endInclusive booleans. + * that tests if there is an overlap between a start {@link Comparable} and + * end {@link Comparable} within a provided range [start, end]. + * + * The provided start and end dates do not need to be within the range configured, + * they only need to overlap. To ensure the provided start and/or end are within the + * configured range the booleans startFullyContained and/or + * endFullyContained> should be set to true (false by default). + * + * By default the start and end date comparison is inclusive, + * you can toggle this using the startInclusive and endInclusive + * booleans. *

*

- * If the start is not set then this will be treated as unbounded. - * Similarly with the end. + * If the start or end are not set then they will be treated as unbounded. *

*

* If the test value is null then the predicate will return false. *

*

* This range predicate takes 2 values to test, if you want to test - * a single value lies within a range then you can use the + * whether a single value lies within a range then you should use the * {@link InDateRange} predicate. *

*

@@ -55,8 +59,8 @@ * By default the offset is measured in Days, this can be changed to * DAY, HOUR, MINUTE, SECOND and MILLISECOND using the offsetUnit field. *

- * At the point when test is called on the class the - * current system time is used to calculate the start and end values based on: + * When the test is called on the class the current system time is used + * to calculate the start and end values based on: * System.currentTimeMillis() + offset. *

*

diff --git a/core/src/main/java/uk/gov/gchq/koryphe/util/RangeUtil.java b/core/src/main/java/uk/gov/gchq/koryphe/util/RangeUtil.java index fff1834f8..09290bfa8 100644 --- a/core/src/main/java/uk/gov/gchq/koryphe/util/RangeUtil.java +++ b/core/src/main/java/uk/gov/gchq/koryphe/util/RangeUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Crown Copyright + * Copyright 2017-2025 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ private RangeUtil() { * @param startValue the start value to test * @param endValue the end value to test * @param rangeStart the start of the defined allowed range - * @param rangeEnd the start of the defined allowed range + * @param rangeEnd the end of the defined allowed range * @param startInclusive true if the start of the range is inclusive * @param endInclusive true if the end of the range is inclusive * @param the type of the range diff --git a/core/src/test/java/uk/gov/gchq/koryphe/impl/predicate/CollectionContainsTest.java b/core/src/test/java/uk/gov/gchq/koryphe/impl/predicate/CollectionContainsTest.java index 5e8e96d44..90466cb31 100644 --- a/core/src/test/java/uk/gov/gchq/koryphe/impl/predicate/CollectionContainsTest.java +++ b/core/src/test/java/uk/gov/gchq/koryphe/impl/predicate/CollectionContainsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2022 Crown Copyright + * Copyright 2017-2025 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; -public class CollectionContainsTest extends PredicateTest { +class CollectionContainsTest extends PredicateTest { private static final CustomObj VALUE1 = new CustomObj(); private static final String VALUE2 = "value2"; @@ -47,7 +47,7 @@ public void setup() { } @Test - public void shouldAcceptWhenValueInList() { + void shouldAcceptWhenValueInList() { // Given final CollectionContains filter = new CollectionContains(VALUE1); @@ -56,7 +56,7 @@ public void shouldAcceptWhenValueInList() { } @Test - public void shouldAcceptWhenValueInSet() { + void shouldAcceptWhenValueInSet() { // Given final CollectionContains filter = new CollectionContains(VALUE1); @@ -65,7 +65,7 @@ public void shouldAcceptWhenValueInSet() { } @Test - public void shouldRejectWhenValueNotPresentInList() { + void shouldRejectWhenValueNotPresentInList() { // Given final CollectionContains filter = new CollectionContains(VALUE2); @@ -74,7 +74,7 @@ public void shouldRejectWhenValueNotPresentInList() { } @Test - public void shouldRejectWhenValueNotPresentInSet() { + void shouldRejectWhenValueNotPresentInSet() { // Given final CollectionContains filter = new CollectionContains(VALUE2); @@ -83,7 +83,7 @@ public void shouldRejectWhenValueNotPresentInSet() { } @Test - public void shouldRejectEmptyLists() { + void shouldRejectEmptyLists() { // Given final CollectionContains filter = new CollectionContains(VALUE1); @@ -92,7 +92,7 @@ public void shouldRejectEmptyLists() { } @Test - public void shouldRejectEmptySets() { + void shouldRejectEmptySets() { // Given final CollectionContains filter = new CollectionContains(VALUE1); @@ -101,7 +101,7 @@ public void shouldRejectEmptySets() { } @Test - public void shouldRejectNullLists() { + void shouldRejectNullLists() { // Given final CollectionContains filter = new CollectionContains(VALUE1); @@ -110,7 +110,7 @@ public void shouldRejectNullLists() { } @Test - public void shouldRejectNullSets() { + void shouldRejectNullSets() { // Given final CollectionContains filter = new CollectionContains(VALUE1); diff --git a/core/src/test/java/uk/gov/gchq/koryphe/impl/predicate/IsInTest.java b/core/src/test/java/uk/gov/gchq/koryphe/impl/predicate/IsInTest.java index dce0da847..da8eef66e 100644 --- a/core/src/test/java/uk/gov/gchq/koryphe/impl/predicate/IsInTest.java +++ b/core/src/test/java/uk/gov/gchq/koryphe/impl/predicate/IsInTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Crown Copyright + * Copyright 2017-2025 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,10 +29,10 @@ import static org.assertj.core.api.Assertions.assertThat; -public class IsInTest extends PredicateTest { +class IsInTest extends PredicateTest { @Test - public void shouldAcceptWhenValueInList() { + void shouldAcceptWhenValueInList() { // Given final IsIn filter = new IsIn(Arrays.asList("A", "B", "C")); @@ -41,7 +41,7 @@ public void shouldAcceptWhenValueInList() { } @Test - public void shouldRejectWhenValueNotInList() { + void shouldRejectWhenValueNotInList() { // Given final IsIn filter = new IsIn(Arrays.asList("A", "B", "C"));