mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[wpilibj] Watchdog: Implement equals and hashCode (#2743)
This commit is contained in:
@@ -72,6 +72,20 @@ public class Watchdog implements Closeable, Comparable<Watchdog> {
|
||||
return Double.compare(m_expirationTime, rhs.m_expirationTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof Watchdog)) {
|
||||
return false;
|
||||
}
|
||||
Watchdog oth = (Watchdog) obj;
|
||||
return oth.m_expirationTime == m_expirationTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Double.hashCode(m_expirationTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time in seconds since the watchdog was last fed.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user