1 package test.crispy.example.model; 2 3 public class NodeHashCode3 { 4 5 private String name = null; 6 private int id = 0; 7 8 public NodeHashCode3() { 9 } 10 public NodeHashCode3(String pvName) { 11 setName(pvName); 12 } 13 public NodeHashCode3(String pvName, int pvId) { 14 setName(pvName); 15 this.id = pvId; 16 } 17 18 19 public String getName() { 20 return name; 21 } 22 public void setName(String pvName) { 23 name = pvName; 24 } 25 26 public int hashCode() { 27 return id; 28 } 29 30 public boolean equals(Object pvObj) { 31 if (this.getClass().isAssignableFrom(pvObj.getClass())) { 32 NodeHashCode3 n = (NodeHashCode3) pvObj; 33 if (this.getName() != null && this.getName().equals(n.getName()) && id == n.id) { 34 return true; 35 } 36 return false; 37 } 38 return false; 39 } 40 41 public String toString() { 42 return "_3_" + getName() + "(" + id + ")"; 43 } 44 45 }