1 package org.apache.ojb.broker; 2 3 4 9 public class GraphEdge implements java.io.Serializable 10 { 11 private int id; 12 private int sourceId; 13 private int sinkId; 14 private GraphNode source; 15 private GraphNode sink; 16 17 public GraphEdge() 18 { 19 } 20 21 public GraphEdge(int id, int sourceId, int sinkId) 22 { 23 this.id = id; 24 this.sourceId = sourceId; 25 this.sinkId = sinkId; 26 } 27 28 public GraphEdge(GraphNode source, GraphNode sink) 29 { 30 source.addOutgoingEdge(this); 31 sink.addIncomingEdge(this); 32 33 this.source = source; 35 this.sourceId = source.getId(); 36 this.sink = sink; 37 this.sinkId = sink.getId(); 38 39 } 40 41 public int getSourceId() 42 { 43 return sourceId; 44 } 45 46 public int getSinkId() 47 { 48 return sinkId; 49 } 50 51 public GraphNode getSource() 52 { 53 return source; 54 } 55 56 public GraphNode getSink() 57 { 58 return sink; 59 } 60 61 public int getId() 62 { 63 return id; 64 } 65 66 public void setSourceId(int sourceId) 67 { 68 this.sourceId = sourceId; 69 } 70 71 public void setSinkId(int sinkId) 72 { 73 this.sinkId = sinkId; 74 } 75 76 public void setSource(GraphNode source) 77 { 78 this.source = source; 79 } 80 81 public void setSink(GraphNode sink) 82 { 83 this.sink = sink; 84 } 85 86 public void setId(int id) 87 { 88 this.id = id; 89 } 90 91 public String toString() 92 { 93 return "(" + (source == null ? "null" : source.getName()) + " -> " 94 + (sink == null ? "null" : (sink == source ? sink.getName() : sink.toString())) + ")"; 95 } 96 } 97 | Popular Tags |