Package rife.bld.extension.propertyfile
Class Calc
java.lang.Object
rife.bld.extension.propertyfile.Calc
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final IntFunction<Integer>Adds1.static final IntFunction<Integer>Multiplies by2.static final IntFunction<Integer>Divides by2.static final IntFunction<Integer>Negates the value.static final IntFunction<Integer>Subtracts1. -
Method Summary
Modifier and TypeMethodDescriptionstatic Integeradd(int v) Adds1to the value.static Integerdbl(int v) Doubles the value.static Integerhalf(int v) Halves the value, truncating toward zero.static Integernegate(int v) Negates the value.static IntFunction<Integer>plus(int n) Returns a function that adds a constant.static Integersub(int v) Subtracts1from the value.static IntFunction<Integer>times(int n) Returns a function that multiplies by a constant.
-
Field Details
-
ADD
Adds1. Ant-compatible. -
DOUBLE
Multiplies by2. Extension. -
HALF
Divides by2. Extension. -
NEGATE
Negates the value. Extension. -
SUB
Subtracts1. Ant-compatible.
-
-
Method Details
-
add
Adds1to the value. -
dbl
Doubles the value. -
half
Halves the value, truncating toward zero. -
negate
Negates the value. -
plus
Returns a function that adds a constant.- Parameters:
n- the constant to add- Returns:
- a function adding
n
-
sub
Subtracts1from the value. -
times
Returns a function that multiplies by a constant.- Parameters:
n- the constant to multiply by- Returns:
- a function multiplying by
n
-