1 package test.crispy.example.model; 2 3 import java.io.Serializable; 4 import java.util.Hashtable; 5 import java.util.LinkedList; 6 import java.util.List; 7 import java.util.Map; 8 import java.util.Set; 9 import java.util.TreeSet; 10 11 /** 12 * Test class for recursive tests. 13 * 14 * @author Linke 15 * 16 */ 17 public class Node implements Serializable { 18 19 private static final long serialVersionUID = 828428341312L; 20 21 private String name = null; 22 private List children = new LinkedList(); 23 private Set sets = new TreeSet(); 24 private Map childrenMap = new Hashtable(); 25 private Node node = null; 26 private Long id = null; 27 28 public Node() { } 29 30 public Node(Long pvId) { 31 setId(pvId); 32 } 33 34 public Node(String pvName) { 35 this.name = pvName; 36 } 37 38 public Node(String pvName, List pvChildren) { 39 this.name = pvName; 40 this.children = pvChildren; 41 } 42 43 public Long getId() { 44 return id; 45 } 46 private void setId(Long pvId) { 47 id = pvId; 48 } 49 50 public static Node createExampleTree() { 51 Node lvNode1 = new Node("1", new LinkedList()); 52 Node lvNode2 = new Node("2", new LinkedList()); 53 Node lvNode3 = new Node("3", new LinkedList()); 54 Node lvNodea = new Node("a", new LinkedList()); 55 Node lvNodeb = new Node("b", new LinkedList()); 56 57 lvNode1.getChildren().add(lvNodea); 58 lvNode1.getChildren().add(lvNode2); 59 lvNode1.getChildren().add(lvNode3); 60 61 lvNode2.getChildren().add(lvNodea); 62 lvNode2.getChildren().add(lvNodeb); 63 64 lvNode3.getChildren().add(lvNodea); 65 lvNode3.getChildren().add(lvNodeb); 66 67 68 return lvNode1; 69 } 70 71 public List getChildren() { return this.children; } 72 public void setChildren(List pvChildren) { this.children = pvChildren; } 73 74 public Map getChildrenMap() { return childrenMap; } 75 public void setChildrenMap(Map pvChildrenMap) { childrenMap = pvChildrenMap; } 76 77 public Set getSets() { return sets; } 78 public void setSets(Set pvSets) { sets = pvSets; } 79 80 public String getName() { return this.name; } 81 public void setName(String pvName) { this.name = pvName; } 82 83 public Node getNode() { return node; } 84 public void setNode(Node pvNode) { node = pvNode; } 85 86 public String toString() { return getName() + " " + hashCode() + " " + getId(); } 87 88 }