1 package org.molwind.graph;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 import org.molwind.model.Relationship;
21 import edu.uci.ics.jung.graph.util.Pair;
22
23
24
25
26
27
28
29
30
31 public class DefaultEntityEdge implements EntityEdge {
32
33 private Relationship relationship;
34 private EntityVertex v1;
35 private EntityVertex v2;
36
37 private int edgeWeight;
38
39
40
41
42
43 public int getEdgeWeight() {
44
45 return edgeWeight;
46
47 }
48
49
50
51
52
53
54
55 public EntityVertex getV1() {
56 return v1;
57 }
58
59
60
61
62
63
64 public EntityVertex getV2() {
65 return v2;
66 }
67
68
69
70
71
72
73
74
75 public void setEdgeWeight(int newEdgeWeight) {
76
77 this.edgeWeight = newEdgeWeight;
78 }
79
80
81
82
83
84
85
86 public Pair<EntityVertex> getVerticePair(){
87
88 return new Pair<EntityVertex>(v1,v2);
89
90 }
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106 public DefaultEntityEdge(final EntityVertex vertex1,
107 final EntityVertex vertex2,int edgeWeight) {
108
109 this.edgeWeight=edgeWeight;
110 this.v1=vertex1;
111 this.v2=vertex2;
112 }
113
114
115
116
117
118
119
120
121
122
123
124
125 public DefaultEntityEdge(final DefaultEntityVertex vertex1,
126 final DefaultEntityVertex vertex2) {
127
128 this.v1=vertex1;
129 this.v2=vertex2;
130 }
131
132
133
134
135
136
137
138
139
140 public boolean isVertexIncluded(EntityVertex v){
141
142 if((this.v1.getId().equals(v.getId()))
143 ||((this.v2.getId().equals(v.getId()))))
144 return true;
145 else
146 return false;
147 }
148
149
150
151
152
153
154
155
156 public Relationship getRelationship() {
157 return relationship;
158 }
159
160
161
162
163
164
165
166 public void setRelationship(final Relationship newRelation) {
167 this.relationship = newRelation;
168 }
169
170 }