Class DoubleGenerator
java.lang.Object
wbs.utils.util.providers.generator.num.DoubleGenerator
- All Implemented Interfaces:
Provider,Refreshable
- Direct Known Subclasses:
AbsGenerator,BinaryFunctionalGenerator,ClampGenerator,CycleGenerator,FunctionalGenerator,PingPongGenerator,PulseGenerator,RandomGenerator
A generator that returns a single double until
refresh() is called,
at which point it calculates a new value.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract DoubleGeneratorclone()protected abstract doubleGenerate a new value to override the current onedoublegetValue()final voidrefresh()Generate a new value.protected voidAn internal method called beforegetNewValue(), to allow implementing classes to refresh the provider in a controlled way.abstract voidwriteToConfig(org.bukkit.configuration.ConfigurationSection section, String path) Save this provider in a config (that can often by read by its constructor)
-
Constructor Details
-
DoubleGenerator
protected DoubleGenerator()
-
-
Method Details
-
getNewValue
protected abstract double getNewValue()Generate a new value to override the current one- Returns:
- The new value
-
writeToConfig
public abstract void writeToConfig(org.bukkit.configuration.ConfigurationSection section, String path) Description copied from interface:ProviderSave this provider in a config (that can often by read by its constructor)- Specified by:
writeToConfigin interfaceProvider- Parameters:
section- The section to write topath- The field/path inside the given section
-
refresh
public final void refresh()Generate a new value.- Specified by:
refreshin interfaceRefreshable
-
refreshInternal
protected void refreshInternal()An internal method called beforegetNewValue(), to allow implementing classes to refresh the provider in a controlled way. -
getValue
public double getValue()- Returns:
- The most recently generated value
-
clone
-