Increment
See javadoc - uk.gov.gchq.koryphe.impl.function.Increment
Available since Koryphe version 1.8.0
Adds a given number to the input
Examples
Add to int
returned value type will match the input type int
Java
JSON
Full JSON
Python
final Increment increment = new Increment(3);
{
"class" : "Increment",
"increment" : 3
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.Increment",
"increment" : 3
}
g.Increment(
increment=3
)
Input type:
java.lang.Number
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.lang.Integer | 2 | java.lang.Integer | 5 |
java.lang.Double | 2.0 | java.lang.Integer | 5 |
java.lang.Float | 2.0 | java.lang.Integer | 5 |
java.lang.Long | 2 | java.lang.Integer | 5 |
Add to double
returned value type will match the input type double
Java
JSON
Full JSON
Python
final Increment increment = new Increment(3.0);
{
"class" : "Increment",
"increment" : 3.0
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.Increment",
"increment" : 3.0
}
g.Increment(
increment=3.0
)
Input type:
java.lang.Number
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.lang.Integer | 2 | java.lang.Double | 5.0 |
java.lang.Double | 2.0 | java.lang.Double | 5.0 |
java.lang.Float | 2.0 | java.lang.Double | 5.0 |
java.lang.Long | 2 | java.lang.Double | 5.0 |
java.lang.String | 33 | ClassCastException: java.lang.String cannot be cast to java.lang.Number | |
java.lang.String | three | ClassCastException: java.lang.String cannot be cast to java.lang.Number | |
null | java.lang.Double | 3.0 |
Add to float
returned value type will match the input type float
Java
JSON
Full JSON
Python
final Increment increment = new Increment(3.0f);
{
"class" : "Increment",
"increment" : {
"Float" : 3.0
}
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.Increment",
"increment" : {
"java.lang.Float" : 3.0
}
}
g.Increment(
increment={'java.lang.Float': 3.0}
)
Input type:
java.lang.Number
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.lang.Integer | 2 | java.lang.Float | 5.0 |
java.lang.Double | 2.0 | java.lang.Float | 5.0 |
java.lang.Float | 2.0 | java.lang.Float | 5.0 |
java.lang.Long | 2 | java.lang.Float | 5.0 |
java.lang.String | 33 | ClassCastException: java.lang.String cannot be cast to java.lang.Number | |
java.lang.String | three | ClassCastException: java.lang.String cannot be cast to java.lang.Number | |
null | java.lang.Float | 3.0 |
Add to long
returned value type will match the input type long
Java
JSON
Full JSON
Python
final Increment increment = new Increment(3L);
{
"class" : "Increment",
"increment" : {
"Long" : 3
}
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.Increment",
"increment" : {
"java.lang.Long" : 3
}
}
g.Increment(
increment={'java.lang.Long': 3}
)
Input type:
java.lang.Number
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.lang.Integer | 2 | java.lang.Long | 5 |
java.lang.Double | 2.0 | java.lang.Long | 5 |
java.lang.Float | 2.0 | java.lang.Long | 5 |
java.lang.Long | 2 | java.lang.Long | 5 |
java.lang.String | 33 | ClassCastException: java.lang.String cannot be cast to java.lang.Number | |
java.lang.String | three | ClassCastException: java.lang.String cannot be cast to java.lang.Number | |
null | java.lang.Long | 3 |