Package org.apache.commons.numbers.core
Interface Addition<T>
-
- Type Parameters:
T- Type of elements.
- All Known Subinterfaces:
NativeOperators<T>
- All Known Implementing Classes:
DD
public interface Addition<T>
Addition.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Tadd(T a)Binary addition.default booleanisZero()Check if this is a neutral element of addition, i.e.Tnegate()Additive inverse.Tzero()Identity element.
-
-
-
Method Detail
-
zero
T zero()
Identity element.- Returns:
- the field element such that for all
a,zero().add(a).equals(a)istrue.
-
isZero
default boolean isZero()
Check if this is a neutral element of addition, i.e.this.add(a)returnsaor an element representing the same value asa.The default implementation calls
equals(zero()). Implementations may want to employ more a efficient method. This may even be required if an implementation has multiple representations ofzeroand itsequalsmethod differentiates between them.- Returns:
trueifthisis a neutral element of addition.- Since:
- 1.2
- See Also:
zero()
-
-