Package org.edu_nation.easy_ftc.sensor
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 Summary
ConstructorsConstructorDescriptionBuilder(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap) Builder constructor -
Method Summary
-
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
Description copied from class:org.edu_nation.easy_ftc.sensor.Sensor.BuilderReverse the sensor's state- Overrides:
reversein classorg.edu_nation.easy_ftc.sensor.Sensor.Builder<Distance.Builder>- Returns:
- builder instance
-
name
Change the name of the hardware device- Specified by:
namein classorg.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
Specify the calibration value- Parameters:
threshold- cutoff threshold for whether an object is detected- Returns:
- builder instance
- Throws:
IllegalArgumentException- if threshold < 0
-
build
Build the sensor- Returns:
- distance instance
-