Class TrcPresets

java.lang.Object
trclib.robotcore.TrcPresets

public class TrcPresets extends Object
This class implements a generic preset table for looking up preset values.
  • Field Details

    • tracer

      public final TrcDbgTrace tracer
    • instanceName

      private final String instanceName
    • presetTolerance

      private final double presetTolerance
    • presets

      private final double[] presets
  • Constructor Details

    • TrcPresets

      public TrcPresets(String instanceName, double presetTolerance, double... presets)
      Constructor: Create an instance of the object.
      Parameters:
      instanceName - specifies the task name.
      presetTolerance - specifies the preset tolerance.
      presets - specifies the preset value array.
  • Method Details

    • toString

      public String toString()
      This method returns the instance name.
      Overrides:
      toString in class Object
      Returns:
      instance name.
    • validatePresetIndex

      public boolean validatePresetIndex(int index)
      This method checks if the preset index is within the preset table.
      Parameters:
      index - specifies the preset table index to check.
      Returns:
      true if the index is within the table.
    • getPresetValue

      public double getPresetValue(int index)
      This method returns the preset value at the specified index.
      Parameters:
      index - specifies the index into the preset table.
      Returns:
      preset value.
    • nextPresetIndexUp

      public int nextPresetIndexUp(double currValue)
      This method determines the next preset index up from the specified current value.
      Parameters:
      currValue - specifies the current value to check against.
      Returns:
      next preset index up.
    • nextPresetIndexDown

      public int nextPresetIndexDown(double currValue)
      This method determines the next preset index down from the specified current value.
      Parameters:
      currValue - specifies the current value to check against.
      Returns:
      next preset index down.