1 package test.crispy.example.model; 2 3 import java.util.ArrayList; 4 import java.util.List; 5 6 public class NodeHashCode1 { 7 8 private List childs = new ArrayList(); 9 private String name = null; 10 private int id = 0; 11 12 public NodeHashCode1() { 13 } 14 public NodeHashCode1(String pvName) { 15 setName(pvName); 16 } 17 public NodeHashCode1(String pvName, int pvId) { 18 setName(pvName); 19 this.id = pvId; 20 } 21 22 23 public String getName() { 24 return name; 25 } 26 public void setName(String pvName) { 27 name = pvName; 28 } 29 30 public List getChilds() { 31 return childs; 32 } 33 public void setChilds(List pvChilds) { 34 childs = pvChilds; 35 } 36 37 public int hashCode() { 38 return id; 39 } 40 41 public boolean equals(Object pvObj) { 42 if (this.getClass().isAssignableFrom(pvObj.getClass())) { 43 NodeHashCode1 n = (NodeHashCode1) pvObj; 44 return (id == n.id); 45 } 46 return false; 47 } 48 49 public String toString() { 50 return "_1_" + getName() + "(" + id + ")"; 51 } 52 53 }