-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into gh-194-update-to-java-11
- Loading branch information
Showing
15 changed files
with
252 additions
and
440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
core/src/main/java/uk/gov/gchq/koryphe/impl/function/ToDouble.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2022 Crown Copyright | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package uk.gov.gchq.koryphe.impl.function; | ||
|
||
import uk.gov.gchq.koryphe.Since; | ||
import uk.gov.gchq.koryphe.Summary; | ||
import uk.gov.gchq.koryphe.function.KorypheFunction; | ||
|
||
/** | ||
* A <code>ToDouble</code> is a {@link java.util.function.Function} that takes | ||
* an Object and casts it to a Double. | ||
* <p> | ||
* The resulting object is what is returned from the method. | ||
*/ | ||
@Since("2.0.0") | ||
@Summary("Casts input Object to a Double") | ||
public class ToDouble extends KorypheFunction<Object, Double> { | ||
|
||
@Override | ||
public Double apply(final Object value) { | ||
if (null == value) { | ||
return null; | ||
} | ||
|
||
if (value instanceof Number) { | ||
return ((Number) value).doubleValue(); | ||
} | ||
|
||
if (value instanceof String) { | ||
return Double.valueOf(((String) value)); | ||
} | ||
|
||
throw new IllegalArgumentException("Could not convert value to Double: " + value); | ||
} | ||
} |
35 changes: 0 additions & 35 deletions
35
core/src/main/java/uk/gov/gchq/koryphe/iterable/CloseableIterable.java
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
core/src/main/java/uk/gov/gchq/koryphe/iterable/CloseableIterator.java
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
core/src/main/java/uk/gov/gchq/koryphe/iterable/EmptyCloseableIterator.java
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
core/src/main/java/uk/gov/gchq/koryphe/iterable/StreamIterable.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.