Class CycleGenerator
java.lang.Object
wbs.utils.util.providers.generator.num.DoubleGenerator
wbs.utils.util.providers.generator.num.CycleGenerator
- All Implemented Interfaces:
Provider,Refreshable
A generator that moves between two NumProviders in one direction
over a given period, where it takes period calls to
DoubleGenerator.refresh() to
go form start to end-
Constructor Summary
ConstructorsConstructorDescriptionCycleGenerator(double start, double end, double period, double initialProgress) CycleGenerator(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory) Create this generator from a ConfigurationSection, logging errors in the given settingsCycleGenerator(CycleGenerator clone) Clone constructor.CycleGenerator(NumProvider start, NumProvider end, 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
-
CycleGenerator
Clone constructor.- Parameters:
clone- The object to clone from.
-
CycleGenerator
public CycleGenerator(double start, double end, double period, double initialProgress) - Parameters:
start- The starting value of the cycleend- The end value of the cycleperiod- The amount of steps needed to go from start to endinitialProgress- The initial progress from 0 to 1, where 0 is start, and 1 is end.
-
CycleGenerator
public CycleGenerator(NumProvider start, NumProvider end, NumProvider period, double initialProgress) - Parameters:
start- The starting value of the cycleend- The end value of the cycleperiod- The amount of steps needed to go from start to endinitialProgress- The initial progress from 0 to 1, where 0 is start, and 1 is end.
-
CycleGenerator
public CycleGenerator(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
-