Class Distance.Builder

java.lang.Object
org.edu_nation.easy_ftc.sensor.Sensor.Builder<Distance.Builder>
org.edu_nation.easy_ftc.sensor.Distance.Builder
Enclosing class:
Distance

public static class Distance.Builder extends org.edu_nation.easy_ftc.sensor.Sensor.Builder<Distance.Builder>
Construct a Distance sensor object using the builder design pattern

Basic Usage:


 Distance distance = new Distance.Builder(hardwareMap).build();
 
Defaults:
  • reverse = false
  • name = "distance"
  • threshold = 7.0
  • Constructor Details

    • Builder

      public Builder(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap)
      Builder constructor
      Parameters:
      hardwareMap - instance of the calling opMode's hardwareMap
      Throws:
      NullPointerException - if hardwareMap is null
  • Method Details

    • reverse

      public Distance.Builder reverse()
      Description copied from class: org.edu_nation.easy_ftc.sensor.Sensor.Builder
      Reverse the sensor's state
      Overrides:
      reverse in class org.edu_nation.easy_ftc.sensor.Sensor.Builder<Distance.Builder>
      Returns:
      builder instance
    • name

      public Distance.Builder name(String name)
      Change the name of the hardware device
      Specified by:
      name in class org.edu_nation.easy_ftc.sensor.Sensor.Builder<Distance.Builder>
      Parameters:
      name - name of the hardware devices
      Returns:
      builder instance
      Throws:
      NullPointerException - if name is null
    • threshold

      public Distance.Builder threshold(double threshold)
      Specify the calibration value
      Parameters:
      threshold - cutoff threshold for whether an object is detected
      Returns:
      builder instance
      Throws:
      IllegalArgumentException - if threshold < 0
    • build

      public Distance build()
      Build the sensor
      Returns:
      distance instance