Record Class DigoutSlot.PrevSlotTrueFor

All Implemented Interfaces:
Enclosing interface:

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.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));
  • Constructor Details

    • PrevSlotTrueFor

      public PrevSlotTrueFor(double timeSec, ClauseAction clauseAction, boolean invert)
      Primary constructor.
      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 interface DigoutSlot
      48-bit long
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      o - the object with which to compare
      true if this object is the same as the o argument; false otherwise.
    • timeSec

      public double timeSec()
      Returns the value of the timeSec record component.
      the value of the timeSec record component
    • clauseAction

      public ClauseAction clauseAction()
      Returns the value of the clauseAction record component.
      the value of the clauseAction record component
    • invert

      public boolean invert()
      Returns the value of the invert record component.
      the value of the invert record component