Skip to content

Commit

Permalink
Gh-320: Javadoc fixes (#329)
Browse files Browse the repository at this point in the history
* fix javadocs

* rephrase

* copyright

---------

Co-authored-by: j69772 <[email protected]>
  • Loading branch information
cn337131 and j69772 authored Jan 27, 2025
1 parent 7aafe0f commit 28298c5
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -37,9 +37,9 @@
* An <code>AreIn</code> 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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -30,6 +30,9 @@
/**
* An <code>CollectionContains</code> 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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -34,7 +34,7 @@
import java.util.Set;

/**
* An <code>IsIn</code> is a {@link java.util.function.Predicate} that checks that the input is
* <code>IsIn</code> is a {@link java.util.function.Predicate} that checks that the input is
* in a set of allowed values.
*/
@Since("1.0.0")
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -29,23 +29,27 @@
/**
* <p>
* An <code>InDateRangeDual</code> 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.
* </p>
* <p>
* 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.
* </p>
* <p>
* If the test value is null then the predicate will return false.
* </p>
* <p>
* 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.
* </p>
* <p>
Expand All @@ -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.
* <p>
* 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.
* </p>
* <p>
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/uk/gov/gchq/koryphe/util/RangeUtil.java
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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 <T> the type of the range
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -32,7 +32,7 @@

import static org.assertj.core.api.Assertions.assertThat;

public class CollectionContainsTest extends PredicateTest<CollectionContains> {
class CollectionContainsTest extends PredicateTest<CollectionContains> {

private static final CustomObj VALUE1 = new CustomObj();
private static final String VALUE2 = "value2";
Expand All @@ -47,7 +47,7 @@ public void setup() {
}

@Test
public void shouldAcceptWhenValueInList() {
void shouldAcceptWhenValueInList() {
// Given
final CollectionContains filter = new CollectionContains(VALUE1);

Expand All @@ -56,7 +56,7 @@ public void shouldAcceptWhenValueInList() {
}

@Test
public void shouldAcceptWhenValueInSet() {
void shouldAcceptWhenValueInSet() {
// Given
final CollectionContains filter = new CollectionContains(VALUE1);

Expand All @@ -65,7 +65,7 @@ public void shouldAcceptWhenValueInSet() {
}

@Test
public void shouldRejectWhenValueNotPresentInList() {
void shouldRejectWhenValueNotPresentInList() {
// Given
final CollectionContains filter = new CollectionContains(VALUE2);

Expand All @@ -74,7 +74,7 @@ public void shouldRejectWhenValueNotPresentInList() {
}

@Test
public void shouldRejectWhenValueNotPresentInSet() {
void shouldRejectWhenValueNotPresentInSet() {
// Given
final CollectionContains filter = new CollectionContains(VALUE2);

Expand All @@ -83,7 +83,7 @@ public void shouldRejectWhenValueNotPresentInSet() {
}

@Test
public void shouldRejectEmptyLists() {
void shouldRejectEmptyLists() {
// Given
final CollectionContains filter = new CollectionContains(VALUE1);

Expand All @@ -92,7 +92,7 @@ public void shouldRejectEmptyLists() {
}

@Test
public void shouldRejectEmptySets() {
void shouldRejectEmptySets() {
// Given
final CollectionContains filter = new CollectionContains(VALUE1);

Expand All @@ -101,7 +101,7 @@ public void shouldRejectEmptySets() {
}

@Test
public void shouldRejectNullLists() {
void shouldRejectNullLists() {
// Given
final CollectionContains filter = new CollectionContains(VALUE1);

Expand All @@ -110,7 +110,7 @@ public void shouldRejectNullLists() {
}

@Test
public void shouldRejectNullSets() {
void shouldRejectNullSets() {
// Given
final CollectionContains filter = new CollectionContains(VALUE1);

Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -29,10 +29,10 @@

import static org.assertj.core.api.Assertions.assertThat;

public class IsInTest extends PredicateTest<IsIn> {
class IsInTest extends PredicateTest<IsIn> {

@Test
public void shouldAcceptWhenValueInList() {
void shouldAcceptWhenValueInList() {
// Given
final IsIn filter = new IsIn(Arrays.asList("A", "B", "C"));

Expand All @@ -41,7 +41,7 @@ public void shouldAcceptWhenValueInList() {
}

@Test
public void shouldRejectWhenValueNotInList() {
void shouldRejectWhenValueNotInList() {
// Given
final IsIn filter = new IsIn(Arrays.asList("A", "B", "C"));

Expand Down

0 comments on commit 28298c5

Please sign in to comment.