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

public abstract class DoubleGenerator extends Object implements Provider
A generator that returns a single double until refresh() is called, at which point it calculates a new value.
  • 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: Provider
      Save this provider in a config (that can often by read by its constructor)
      Specified by:
      writeToConfig in interface Provider
      Parameters:
      section - The section to write to
      path - The field/path inside the given section
    • refresh

      public final void refresh()
      Generate a new value.
      Specified by:
      refresh in interface Refreshable
    • refreshInternal

      protected void refreshInternal()
      An internal method called before getNewValue(), to allow implementing classes to refresh the provider in a controlled way.
    • getValue

      public double getValue()
      Returns:
      The most recently generated value
    • clone

      public abstract DoubleGenerator clone()
      Overrides:
      clone in class Object