Record Class DigoutSlot.PrevSlotTrueFor
java.lang.Object
java.lang.Record
com.reduxrobotics.sensors.canandcolor.digout.DigoutSlot.PrevSlotTrueFor
- All Implemented Interfaces:
DigoutSlot
- Enclosing interface:
- DigoutSlot
public static record DigoutSlot.PrevSlotTrueFor(double timeSec, ClauseAction clauseAction, boolean invert)
extends Record
implements DigoutSlot
A
DigoutSlot
that is true if the previous lower-indexed slot has been true for at least a certain period of time.
// Configure digout1 to output true if the proximity value is greater than 0.5 for at least 1.5 seconds Canandcolor canandcolor = new Canandcolor(0); // ... canandcolor.clearAllDigoutSlots(Canandcolor.Digout.kDigout1); canandcolor.setSettings(new Canandcolor.Settings().setDigoutOutputMode(Canandcolor.Digout.kDigout1, new DigoutMode.DigoutSlot())); canandcolor.setDigoutSlot(Canandcolor.Digout.kDigout1, 0, new DigoutSlot.CompareImmidiate(Canandcolor.DataSource.kProximity, SlotComparison.kGreaterThan, 0.5, ClauseAction.kAndWithNextSlot, false)); canandcolor.setDigoutSlot(Canandcolor.Digout.kDigout1, 1, new DigoutSlot.PrevSlotTrueFor(1.5, ClauseAction.kTerminate, false));
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.reduxrobotics.sensors.canandcolor.digout.DigoutSlot
DigoutSlot.CompareAffine, DigoutSlot.CompareImmidiate, DigoutSlot.Disabled, DigoutSlot.PrevClauseTrueFor, DigoutSlot.PrevSlotTrueFor
-
Constructor Summary
ConstructorDescriptionPrevSlotTrueFor
(double timeSec, ClauseAction clauseAction, boolean invert) Primary constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theclauseAction
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
invert()
Returns the value of theinvert
record component.double
timeSec()
Returns the value of thetimeSec
record component.long
Serializes the digout slot into a value writeable to device settings.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
PrevSlotTrueFor
Primary constructor.- Parameters:
timeSec
- time the previous slot must be true (in seconds, ranging from [0 inclusive..65.536 exclusive))clauseAction
- if and how the digout slot should join with the next indexed slot.invert
- whether to invert the value of the result (that is, the previous slot has been true at most timeSec seconds, rather than at least)
-
-
Method Details
-
toSettingData
public long toSettingData()Description copied from interface:DigoutSlot
Serializes the digout slot into a value writeable to device settings.- Specified by:
toSettingData
in interfaceDigoutSlot
- Returns:
- 48-bit long
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
timeSec
public double timeSec()Returns the value of thetimeSec
record component.- Returns:
- the value of the
timeSec
record component
-
clauseAction
Returns the value of theclauseAction
record component.- Returns:
- the value of the
clauseAction
record component
-
invert
public boolean invert()Returns the value of theinvert
record component.- Returns:
- the value of the
invert
record component
-