Skip to content

Commit

Permalink
Removed inessential equals() (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
climategadgets committed May 18, 2021
1 parent 8861c28 commit 633e9c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Converts voltage in mV to temperature in °C for
* {@link http://www.national.com/ds/LM/LM34.pdf LM34} analog temperature sensor.
*
* @author Copyright &copy; <a href="mailto:vt@freehold.crocodile.org"> Vadim Tkachenko 2010
* @author Copyright &copy; <a href="mailto:vt@homeclimatecontrol.com"> Vadim Tkachenko 2010-2020
*
* @see AnalogConverterTMP36
*/
Expand All @@ -26,30 +26,11 @@ public class AnalogConverterLM34 implements AnalogConverter {
public Double convert(Double signal) {

if (signal == null) {

return null;
}

// 0mV @0°F, 10mV/°F
// convert to Celsius
return (((signal / 10) - 32) * 5) / 9d;
}

/**
* Any two instances of this are stateless, execute the same conversion algorithm and
* therefore are equal.
*
* @param o Object to compare to.
*
* @return {@code true} if the other object is also of the same class.
*/
@Override
public boolean equals(Object o) {

if (o == null) {
return false;
}

return getClass().equals(o.getClass());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* {@link http://www.analog.com/en/temperature-sensing-and-thermal-management/digital-temperature-sensors/tmp36/products/product.html
* TMP36} analog temperature sensor.
*
* @author Copyright &copy; <a href="mailto:vt@freehold.crocodile.org"> Vadim Tkachenko 2010
* @author Copyright &copy; <a href="mailto:vt@homeclimatecontrol.com"> Vadim Tkachenko 2010-2020
*
* @see AnalogConverterLM34
*/
Expand All @@ -27,29 +27,10 @@ public class AnalogConverterTMP36 implements AnalogConverter {
public Double convert(Double signal) {

if (signal == null) {

return null;
}

// 750mV @25°C, 10mV/°C
return 25 - (750 - signal) / 10;
}

/**
* Any two instances of this are stateless, execute the same conversion algorithm and
* therefore are equal.
*
* @param o Object to compare to.
*
* @return {@code true} if the other object is also of the same class.
*/
@Override
public boolean equals(Object o) {

if (o == null) {
return false;
}

return getClass().equals(o.getClass());
}
}

0 comments on commit 633e9c6

Please sign in to comment.