Skip to content

Commit

Permalink
Merge branch 'master' of github.com:openlcb/OpenLCB_Java
Browse files Browse the repository at this point in the history
  • Loading branch information
pabender committed Jul 26, 2020
2 parents e031bf6 + 9ba5b0e commit 33d0786
Show file tree
Hide file tree
Showing 36 changed files with 1,510 additions and 968 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
<version>2.12.0</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
Expand Down
34 changes: 17 additions & 17 deletions src/org/openlcb/AddressedMessage.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.openlcb;

// For annotations
import edu.umd.cs.findbugs.annotations.SuppressWarnings;
import net.jcip.annotations.Immutable;
import net.jcip.annotations.ThreadSafe;

Expand All @@ -14,13 +12,11 @@
* pattern to do message specific-processing in e.g. a node implementation.
*
* @author Bob Jacobsen Copyright 2009, 2010
* @version $Revision$
* @see MessageDecoder
*/
@Immutable
@ThreadSafe
abstract public class AddressedMessage extends Message {

public AddressedMessage(NodeID source, NodeID dest) {
super(source);
destNodeID = dest;
Expand All @@ -29,28 +25,32 @@ public AddressedMessage(NodeID source, NodeID dest) {
// cannot create without sourceID, destID
protected AddressedMessage() {}

@SuppressWarnings("JCIP_FIELD_ISNT_FINAL_IN_IMMUTABLE_CLASS")
NodeID destNodeID;

public NodeID getDestNodeID() { return destNodeID; }

/**
* To be equal, messages have to have the
* same type and content
*/
/**
* To be equal, messages have to have the same type and content
*/
@Override
public boolean equals(Object o) {
if (o == null) return false;
if (! (o instanceof AddressedMessage))
public boolean equals(Object o) {
if (o == null) {
return false;
}
if (! (o instanceof AddressedMessage)) {
return false;
}
AddressedMessage msg = (AddressedMessage) o;
if (!this.getDestNodeID().equals(msg.getDestNodeID()))
if (!this.getDestNodeID().equals(msg.getDestNodeID())) {
return false;
else return super.equals(o);
}
}
return super.equals(o);
}

@Override
public int hashCode() { return super.hashCode()+getDestNodeID().hashCode(); }
@Override
public int hashCode() {
return super.hashCode()+getDestNodeID().hashCode();
}

@Override
public String toString() {
Expand Down
Loading

0 comments on commit 33d0786

Please sign in to comment.