Class NumberType<N extends Number>
java.lang.Object
io.github.projectunified.valuevenue.number.NumberType<N>
- Type Parameters:
N- type of the number
The numeric types a number source can produce, with the arithmetic of the type.
The integral types step in long, so they are exact and need no decimal arithmetic. The floating types step
in BigDecimal, because a fractional step would drift in a binary float, and resolve to plain text without
scientific notation.
The class is final and creates its constants itself, so it loads no other class of its own while it is being initialized.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NumberType<Byte> The byte type.static final NumberType<Double> The double type.static final NumberType<Float> The float type.static final NumberType<Integer> The int type.static final NumberType<Long> The long type.static final NumberType<Short> The short type. -
Method Summary
-
Field Details
-
BYTE
The byte type. -
SHORT
The short type. -
INT
The int type. -
LONG
The long type. -
FLOAT
The float type. -
DOUBLE
The double type.
-
-
Method Details
-
values
public Stream<N> values(Number start, Number end, Number step, boolean maxInclusive, Direction direction) The values of a range, from the start to the end.- Parameters:
start- the first valueend- the last value, or its bound when it is not includedstep- the distance between two values, positivemaxInclusive- whether the end is a value of the rangedirection- the direction the values step in- Returns:
- stream of the values, empty when the direction cannot reach the end
-
format
The plain text of a number: no scientific notation, whatever its type.- Parameters:
value- the number- Returns:
- the plain text
-