com.davidbracewell.stream.MAccumulator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mango Show documentation
Show all versions of mango Show documentation
A set of utilities and tools to speed up and ease programming in Java.
package com.davidbracewell.stream;
/**
* The interface M accumulator.
*
* @author David B. Bracewell
*/
public interface MAccumulator {
/**
* Increment.
*/
default void increment() {
increment(1d);
}
/**
* Decrement.
*/
default void decrement() {
decrement(1d);
}
default void incrementIf(boolean result) {
if (result) {
increment(1d);
}
}
default void decrementIf(boolean result) {
if (result) {
decrement(1d);
}
}
default void incrementUnless(boolean result) {
if (!result) {
increment(1d);
}
}
default void decrementUnless(boolean result) {
if (!result) {
decrement(1d);
}
}
/**
* Increment.
*
* @param amount the amount
*/
void increment(double amount);
/**
* Decrement.
*
* @param amount the amount
*/
void decrement(double amount);
/**
* Value double.
*
* @return the double
*/
double value();
/**
* Sets value.
*
* @param value the value
*/
void setValue(double value);
String name();
}// END OF MAccumulator
© 2015 - 2025 Weber Informatics LLC | Privacy Policy