Class TunableLong

java.lang.Object
org.wpilib.tunable.TunableBase
org.wpilib.tunable.TunableLong
All Implemented Interfaces:
LongConsumer, LongSupplier

public abstract class TunableLong extends TunableBase implements LongSupplier, LongConsumer
A tunable long.
  • Constructor Details

    • TunableLong

      protected TunableLong(TunableConfig config)
      Constructs a tunable long.
      Parameters:
      config - tunable config
    • TunableLong

      protected TunableLong(TunableConfig config, boolean supportsChangeNotification)
      Constructs a tunable long.
      Parameters:
      config - tunable config
      supportsChangeNotification - whether the tunable notifies backends when it changes
  • Method Details

    • create

      public static TunableLong create()
      Creates a tunable long with the initial value of 0.
      Returns:
      a tunable long
    • create

      public static TunableLong create(long initialValue)
      Creates a tunable long with the given initial value.
      Parameters:
      initialValue - initial value
      Returns:
      a tunable long
    • create

      public static TunableLong create(LongSupplier getter, LongConsumer setter)
      Creates a tunable long with the given getter and setter.

      The getter and setter must not throw.

      Parameters:
      getter - getter for the tunable value
      setter - setter for the tunable value
      Returns:
      a tunable long
    • createConfig

      public static TunableLong createConfig(TunableConfig config)
      Creates a tunable long with the given config and an initial value of 0.
      Parameters:
      config - tunable config
      Returns:
      a tunable long
    • createConfig

      public static TunableLong createConfig(long initialValue, TunableConfig config)
      Creates a tunable long with the given initial value and config.
      Parameters:
      initialValue - initial value
      config - tunable config
      Returns:
      a tunable long
    • createConfig

      public static TunableLong createConfig(LongSupplier getter, LongConsumer setter, TunableConfig config)
      Creates a tunable long with the given getter, setter, and config.

      The getter and setter must not throw.

      Parameters:
      getter - getter for the tunable value
      setter - setter for the tunable value
      config - tunable config
      Returns:
      a tunable long
    • set

      public abstract void set(long value)
      Sets the value.

      Implementations must not throw.

      Parameters:
      value - value
    • get

      public abstract long get()
      Gets the value.

      Implementations must not throw.

      Returns:
      value
    • getAsLong

      public long getAsLong()
      Specified by:
      getAsLong in interface LongSupplier
    • accept

      public void accept(long value)
      Specified by:
      accept in interface LongConsumer