1 package org.apache.ojb.broker; 2 3 import java.io.Serializable ; 4 import java.util.Collection ; 5 import java.util.Vector ; 6 7 12 public class GraphNode implements Serializable 13 { 14 private int id; 15 private String name; 16 private Collection outgoingEdges; 17 private Collection incomingEdges; 18 private int locationId; 19 private Point location; 20 21 public GraphNode() 22 { 23 } 24 25 public GraphNode(int id, String name, int locationId) { 26 this.id = id; 27 this.name = name; 28 this.locationId = locationId; 29 } 30 31 public GraphNode(String name) 32 { 33 this.name = name; 34 } 35 36 public void addOutgoingEdge(GraphEdge edge) 37 { 38 if (outgoingEdges == null) 39 { 40 outgoingEdges = new Vector (); 41 } 42 outgoingEdges.add(edge); 43 } 44 45 public void addIncomingEdge(GraphEdge edge) 46 { 47 if (incomingEdges == null) 48 { 49 incomingEdges = new Vector (); 50 } 51 incomingEdges.add(edge); 52 } 53 54 public Collection getOutgoingEdges() 55 { 56 return outgoingEdges; 57 } 58 59 public Collection getIncomingEdges() 60 { 61 return incomingEdges; 62 } 63 64 public String getName() 65 { 66 return name; 67 } 68 69 public int getLocationId() 70 { 71 return locationId; 72 } 73 74 public Point getLocation() 75 { 76 return location; 77 } 78 79 public int getId() 80 { 81 return id; 82 } 83 84 public void setOutgoingEdges(Collection edges) 85 { 86 outgoingEdges = edges; 87 } 88 89 public void setIncomingEdges(Collection edges) 90 { 91 incomingEdges = edges; 92 } 93 94 public void setName(String name) 95 { 96 this.name = name; 97 } 98 99 public void setLocationId(int locationId) 100 { 101 this.locationId = locationId; 102 } 103 104 public void setLocation(Point location) 105 { 106 this.location = location; 107 } 108 109 public void setId(int id) 110 { 111 this.id = id; 112 } 113 114 public String toString() 115 { 116 return name + " " + outgoingEdges; 117 } 118 119 } 120 | Popular Tags |