
net.cassite.style.util.lang.MNumber Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of style Show documentation
Show all versions of style Show documentation
Java 8 functional programming toolbox supporting basic jdk libraries and providing language enhancing.
The newest version!
package net.cassite.style.util.lang;
public abstract class MNumber, N extends Number> extends Number implements Comparable {
/**
*
*/
private static final long serialVersionUID = 7152073371332208165L;
protected N n;
public MNumber(N n) {
this.n = n;
}
@Override
public int intValue() {
return n.intValue();
}
@Override
public long longValue() {
return n.longValue();
}
@Override
public float floatValue() {
return n.floatValue();
}
@Override
public double doubleValue() {
return n.doubleValue();
}
public M inc() {
return inc(1);
}
public abstract M inc(Number inc);
public abstract M mul(Number mul);
@SuppressWarnings("unchecked")
public M assign(N n) {
this.n = n;
return (M) this;
}
public N toNumber() {
return n;
}
@Override
public String toString() {
return n.toString();
}
@Override
public boolean equals(Object o) {
return n.equals(o);
}
@Override
public int hashCode() {
return n.hashCode();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy