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 TypeInputResult TypeResult
java.lang.Integer2java.lang.Integer5
java.lang.Double2.0java.lang.Integer5
java.lang.Float2.0java.lang.Integer5
java.lang.Long2java.lang.Integer5

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 TypeInputResult TypeResult
java.lang.Integer2java.lang.Double5.0
java.lang.Double2.0java.lang.Double5.0
java.lang.Float2.0java.lang.Double5.0
java.lang.Long2java.lang.Double5.0
java.lang.String33ClassCastException: java.lang.String cannot be cast to java.lang.Number
java.lang.StringthreeClassCastException: java.lang.String cannot be cast to java.lang.Number
nulljava.lang.Double3.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 TypeInputResult TypeResult
java.lang.Integer2java.lang.Float5.0
java.lang.Double2.0java.lang.Float5.0
java.lang.Float2.0java.lang.Float5.0
java.lang.Long2java.lang.Float5.0
java.lang.String33ClassCastException: java.lang.String cannot be cast to java.lang.Number
java.lang.StringthreeClassCastException: java.lang.String cannot be cast to java.lang.Number
nulljava.lang.Float3.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 TypeInputResult TypeResult
java.lang.Integer2java.lang.Long5
java.lang.Double2.0java.lang.Long5
java.lang.Float2.0java.lang.Long5
java.lang.Long2java.lang.Long5
java.lang.String33ClassCastException: java.lang.String cannot be cast to java.lang.Number
java.lang.StringthreeClassCastException: java.lang.String cannot be cast to java.lang.Number
nulljava.lang.Long3

results matching ""

    No results matching ""