Class Calc

java.lang.Object
rife.bld.extension.propertyfile.Calc

public final class Calc extends Object
Implements the calculation functions for integer properties.

ADD and SUB match Apache Ant <propertyfile> behavior. Additional functions are extensions.

Since:
1.0
Author:
Geert Bevin, Erik C. Thauvin
  • Field Details

  • Method Details

    • add

      public static Integer add(int v)
      Adds 1 to the value.
    • dbl

      public static Integer dbl(int v)
      Doubles the value.
    • half

      public static Integer half(int v)
      Halves the value, truncating toward zero.
    • negate

      public static Integer negate(int v)
      Negates the value.
    • plus

      public static IntFunction<Integer> plus(int n)
      Returns a function that adds a constant.
      Parameters:
      n - the constant to add
      Returns:
      a function adding n
    • sub

      public static Integer sub(int v)
      Subtracts 1 from the value.
    • times

      public static IntFunction<Integer> times(int n)
      Returns a function that multiplies by a constant.
      Parameters:
      n - the constant to multiply by
      Returns:
      a function multiplying by n