Class NumberValueSource<K,N extends Number>
java.lang.Object
io.github.projectunified.valuevenue.number.DynamicNumberValueSource<K,N>
io.github.projectunified.valuevenue.number.NumberValueSource<K,N>
- Type Parameters:
K- type of the keyN- type of the number
- All Implemented Interfaces:
ValueSource<K,,N> Function<K,List<N>>
A
ValueSource whose values are a fixed range of numbers, stepped
from the start to the end.
The variable is DynamicNumberValueSource.DEFAULT_KEY unless another key is given to the constructor, and resolves to the plain text
of the number.
-
Field Summary
Fields inherited from class io.github.projectunified.valuevenue.number.DynamicNumberValueSource
DEFAULT_KEY -
Constructor Summary
ConstructorsConstructorDescriptionNumberValueSource(NumberType<N> type, Number start, Number end, Number step) Creates the source withDynamicNumberValueSource.DEFAULT_KEY, including the end.NumberValueSource(NumberType<N> type, Number start, Number end, Number step, boolean maxInclusive) Creates the source withDynamicNumberValueSource.DEFAULT_KEY.NumberValueSource(NumberType<N> type, Number start, Number end, Number step, boolean maxInclusive, Direction direction) Creates the source withDynamicNumberValueSource.DEFAULT_KEY.NumberValueSource(NumberType<N> type, String key, Number start, Number end, Number step, boolean maxInclusive, Direction direction) Creates the source. -
Method Summary
Modifier and TypeMethodDescriptionprotected NumberThe last value of the range of the key, or its bound when the end is not included.All source values that do not depend on a key.protected NumberThe first value of the range of the key.protected NumberThe distance between two values of the range of the key, positive.Methods inherited from class io.github.projectunified.valuevenue.number.DynamicNumberValueSource
getSourceValueStream, replaceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.projectunified.valuevenue.core.ValueSource
apply, isSourceValueActivated
-
Constructor Details
-
NumberValueSource
Creates the source withDynamicNumberValueSource.DEFAULT_KEY, including the end.- Parameters:
type- the number type of the valuesstart- the first valueend- the last value, or the bound when it is not includedstep- the distance between two values, positive
-
NumberValueSource
public NumberValueSource(NumberType<N> type, Number start, Number end, Number step, boolean maxInclusive) Creates the source withDynamicNumberValueSource.DEFAULT_KEY.- Parameters:
type- the number type of the valuesstart- the first valueend- the last value, or the bound when it is not includedstep- the distance between two values, positivemaxInclusive- whether the end is a value of the range
-
NumberValueSource
public NumberValueSource(NumberType<N> type, Number start, Number end, Number step, boolean maxInclusive, Direction direction) Creates the source withDynamicNumberValueSource.DEFAULT_KEY.- Parameters:
type- the number type of the valuesstart- the first valueend- the last value, or the 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
-
NumberValueSource
public NumberValueSource(NumberType<N> type, String key, Number start, Number end, Number step, boolean maxInclusive, Direction direction) Creates the source.- Parameters:
type- the number type of the valueskey- name of the variable holding the number itselfstart- the first valueend- the last value, or the 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
-
-
Method Details
-
getSourceValueStream
Description copied from interface:ValueSourceAll source values that do not depend on a key.Empty by default: a source that only knows its values through
ValueSource.getSourceValueStream(Object)needs no override.- Returns:
- stream of every key-independent source value
-
getStart
Description copied from class:DynamicNumberValueSourceThe first value of the range of the key.- Specified by:
getStartin classDynamicNumberValueSource<K,N extends Number> - Parameters:
key- the key- Returns:
- the first value
-
getEnd
Description copied from class:DynamicNumberValueSourceThe last value of the range of the key, or its bound when the end is not included.- Specified by:
getEndin classDynamicNumberValueSource<K,N extends Number> - Parameters:
key- the key- Returns:
- the last value
-
getStep
Description copied from class:DynamicNumberValueSourceThe distance between two values of the range of the key, positive.- Specified by:
getStepin classDynamicNumberValueSource<K,N extends Number> - Parameters:
key- the key- Returns:
- the step
-