All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.dongliu.commons.ref.DoubleBox Maven / Gradle / Ivy

There is a newer version: 12.0.2
Show newest version
package net.dongliu.commons.ref;

/**
 * @author Liu Dong
 */
public class DoubleBox {
    private double value;

    private DoubleBox() {
    }

    public static DoubleBox of(double value) {
        DoubleBox box = new DoubleBox();
        box.value = value;
        return box;
    }

    public double value() {
        return value;
    }

    public void value(double value) {
        this.value = value;
    }

    public void plus(double delta) {
        this.value += delta;
    }

    public void minus(double delta) {
        this.value -= delta;
    }

    public void multiply(double num) {
        this.value *= num;
    }

    public void divide(double num) {
        this.value /= num;
    }

    @Override
    public String toString() {
        return String.valueOf(value);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy