Package frc.spectrumLib.util
Record Class CanDeviceId
java.lang.Object
java.lang.Record
frc.spectrumLib.util.CanDeviceId
- Record Components:
bus- the bus name, such as"rio"or"canivore", or an empty string for the default bus
Identifies a CAN device by its device number and the bus it lives on. Equality and hashing cover
both, so the same device number on two buses stays two distinct devices.
-
Constructor Summary
ConstructorsConstructorDescriptionCanDeviceId(int deviceNumber) Builds an identifier on the default bus, which is the empty string.CanDeviceId(int deviceNumber, String bus) Creates an instance of aCanDeviceIdrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbus()Returns the value of thebusrecord component.intReturns the value of thedeviceNumberrecord component.final booleanIndicates whether some other object is "equal to" this one.getBus()intfinal inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CanDeviceId
public CanDeviceId(int deviceNumber) Builds an identifier on the default bus, which is the empty string. -
CanDeviceId
Creates an instance of aCanDeviceIdrecord class.- Parameters:
deviceNumber- the value for thedeviceNumberrecord componentbus- the value for thebusrecord component
-
-
Method Details
-
getDeviceNumber
public int getDeviceNumber() -
getBus
-
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 '=='. -
deviceNumber
public int deviceNumber()Returns the value of thedeviceNumberrecord component.- Returns:
- the value of the
deviceNumberrecord component
-
bus
Returns the value of thebusrecord component.- Returns:
- the value of the
busrecord component
-