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 Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TrcPresets(String instanceName, double presetTolerance, double... presets)
    Constructor: Create an instance of the object.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    getPresetValue(int index)
    This method returns the preset value at the specified index.
    int
    nextPresetIndexDown(double currValue)
    This method determines the next preset index down from the specified current value.
    int
    nextPresetIndexUp(double currValue)
    This method determines the next preset index up from the specified current value.
    This method returns the instance name.
    boolean
    This method checks if the preset index is within the preset table.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • 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.