MCPcopy Index your code
hub / github.com/ev3dev-lang-java/ev3dev-lang-java / equals

Method equals

src/main/java/ev3dev/sensors/EV3Key.java:262–271  ·  view source on GitHub ↗

@param obj @return true if the obj is an instance of Key and if the button IDs are the same.

(final Object obj)

Source from the content-addressed store, hash-verified

260 * @return true if the {@code obj} is an instance of {@link Key} and if the button IDs are the same.
261 */
262 @Override
263 public boolean equals(final Object obj) {
264 if (obj == null || ! (obj instanceof Key)) {
265 return false;
266 } else if (obj == this) { // pointer comparison
267 return true;
268 } else {
269 return ((int)this.keyType.getId() == ((Key)obj).getId());
270 }
271 }
272
273 /**
274 * @return the button ID based hash code

Callers 15

testEqualsAndHashCodeMethod · 0.95
getMotorMethod · 0.45
mmapMethod · 0.45
EV3DevPropertyLoaderMethod · 0.45
getMotorPortMethod · 0.45
getSensorPortMethod · 0.45
EV3DevSensorDeviceMethod · 0.45
switchModeMethod · 0.45
BatteryMethod · 0.45
getBatteryCurrentMethod · 0.45
isEnabledMethod · 0.45
getInstanceMethod · 0.45

Calls 1

getIdMethod · 0.45

Tested by 1

testEqualsAndHashCodeMethod · 0.76