Class PulseGenerator
java.lang.Object
wbs.utils.util.providers.generator.num.DoubleGenerator
wbs.utils.util.providers.generator.num.PulseGenerator
- All Implemented Interfaces:
Provider,Refreshable
A generator that moves between two NumProviders using a sine wave,
over a given period.
-
Constructor Summary
ConstructorsConstructorDescriptionPulseGenerator(double min, double max, double period, double initialProgress) PulseGenerator(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory) Create this generator from a ConfigurationSection, logging errors in the given settingsPulseGenerator(PulseGenerator clone) Clone constructor.PulseGenerator(NumProvider min, NumProvider max, NumProvider period, double initialProgress) -
Method Summary
Modifier and TypeMethodDescriptionclone()protected doubleGenerate a new value to override the current oneprotected voidAn internal method called beforeDoubleGenerator.getNewValue(), to allow implementing classes to refresh the provider in a controlled way.voidwriteToConfig(org.bukkit.configuration.ConfigurationSection section, String path) Save this provider in a config (that can often by read by its constructor)Methods inherited from class wbs.utils.util.providers.generator.num.DoubleGenerator
getValue, refresh
-
Constructor Details
-
PulseGenerator
Clone constructor.- Parameters:
clone- The object to clone from.
-
PulseGenerator
public PulseGenerator(double min, double max, double period, double initialProgress) -
PulseGenerator
-
PulseGenerator
public PulseGenerator(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory) Create this generator from a ConfigurationSection, logging errors in the given settings- Parameters:
section- The section where this generator is definedsettings- The settings to log errors againstdirectory- The path taken through the config to get to this point, for logging purposes
-
-
Method Details
-
refreshInternal
protected void refreshInternal()Description copied from class:DoubleGeneratorAn internal method called beforeDoubleGenerator.getNewValue(), to allow implementing classes to refresh the provider in a controlled way.- Overrides:
refreshInternalin classDoubleGenerator
-
getNewValue
protected double getNewValue()Description copied from class:DoubleGeneratorGenerate a new value to override the current one- Specified by:
getNewValuein classDoubleGenerator- Returns:
- The new value
-
writeToConfig
Description copied from interface:ProviderSave this provider in a config (that can often by read by its constructor)- Specified by:
writeToConfigin interfaceProvider- Specified by:
writeToConfigin classDoubleGenerator- Parameters:
section- The section to write topath- The field/path inside the given section
-
clone
- Specified by:
clonein classDoubleGenerator
-