steveohara / j2mod

Enhanced Modbus library implemented in the Java programming language
Apache License 2.0
275 stars 110 forks source link

Added equals & hashcode method to ModbusTCPMaster & TCPMasterConnection #127

Closed aDramaQueen closed 1 year ago

aDramaQueen commented 2 years ago

Hi, I implemented equals & hash code methods for ModbusTCPMaster. The problem here is, that your "facade" has not relly anything that i can work with to identify unique entities. That is why I have now gone the route via the TCPMasterConnection. A master is now identified through his connection. If it is not the same connection, then it cannot be the same master. The connection itself, I identify by the address & the port. A connection is exactly the same, if it targets the same IP address & the with the same port. The problem here now is that you can theoretically create multiple masters with the same address & port. These would then be handled as identical when you call the equals-method on them. Same goes for hashcode-method.

Oh..., and one small typo in your CONTRIBUTING.md