1 package test.crispy.example.model; 2 3 public class NodeHashCode2 { 4 5 private String name = null; 6 private int id = 0; 7 8 public NodeHashCode2() { 9 } 10 public NodeHashCode2(String pvName) { 11 setName(pvName); 12 } 13 public NodeHashCode2(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 NodeHashCode2 n = (NodeHashCode2) pvObj; 33 return (id == n.id); 34 } 35 return false; 36 } 37 38 public String toString() { 39 return "_2_" + getName() + "(" + id + ")"; 40 } 41 42 43 }