1 7 package org.jboss.cache.pojo.test; 8 9 import java.util.ArrayList ; 10 import java.util.List ; 11 12 20 @org.jboss.cache.pojo.annotation.Replicable 22 public class NetworkDomain 23 { 24 String name_; 25 List nodes_; 27 List elements_; 29 NetworkAdmin admin_; 31 32 static final int TEMP_SENSOR = 0; 33 static final int VIBRATION_SENSOR = 1; 34 35 public String getName() 36 { 37 return name_; 38 } 39 40 public void setName(String name) 41 { 42 name_ = name; 43 } 44 45 public List getNodes() 46 { 47 return nodes_; 48 } 49 50 protected void setNodes(List nodes) 51 { 52 nodes_ = nodes; 53 } 54 55 public List getElements() 56 { 57 return nodes_; 58 } 59 60 protected void addNode(NetworkNode node) 61 { 62 if (nodes_ == null) 63 nodes_ = new ArrayList (); 64 65 nodes_.add(node); 66 } 67 68 public void addElement(NetworkElement element) 69 { 70 if (elements_ == null) 71 elements_ = new ArrayList (); 72 73 elements_.add(element); 74 75 if (element.getParentNode() == null) 76 throw new RuntimeException ("NetworkDomain.addElement(): parent node of element is null: " + element); 77 78 addNode(element.getParentNode()); 79 } 80 81 public NetworkAdmin getAdmin() 82 { 83 return admin_; 84 } 85 86 public void setAdmin(NetworkAdmin admin) 87 { 88 admin_ = admin; 89 } 90 91 public String toString() 92 { 93 StringBuffer sb = new StringBuffer (); 94 sb.append("* Damain * name= ").append(getName()).append(" + admin +: ").append(getAdmin()); 95 sb.append(" + nodes +: ").append(getNodes()); 96 return sb.toString(); 97 } 98 } 99 | Popular Tags |