Last change
on this file since 10 was
10,
checked in by gnappo, 14 years ago
|
Corretti alcuni bachi inseriti con la migrazione a Jung.
|
File size:
1.1 KB
|
Line | |
---|
1 | package weka.clusterers.forMetisMQI; |
---|
2 | |
---|
3 | public class Edge { |
---|
4 | |
---|
5 | private String id; |
---|
6 | |
---|
7 | private int weight; |
---|
8 | |
---|
9 | private int capacity; |
---|
10 | |
---|
11 | public Edge(String id, int weight, int capacity) { |
---|
12 | this.id = id; |
---|
13 | this.weight = weight; |
---|
14 | this.capacity = capacity; |
---|
15 | } |
---|
16 | |
---|
17 | @Override |
---|
18 | public int hashCode() { |
---|
19 | int hash = 1; |
---|
20 | hash = hash * 31 + id.hashCode(); |
---|
21 | return hash; |
---|
22 | } |
---|
23 | |
---|
24 | @Override |
---|
25 | public boolean equals(Object o) { |
---|
26 | boolean result = (o instanceof Edge); |
---|
27 | if(result) { |
---|
28 | Edge e = (Edge) o; |
---|
29 | result = result && (e.getId().equals(id)); |
---|
30 | result = result && (e.getWeight() == weight); |
---|
31 | result = result && (e.getCapacity() == capacity); |
---|
32 | } |
---|
33 | return result; |
---|
34 | } |
---|
35 | |
---|
36 | public String getId() { |
---|
37 | return id; |
---|
38 | } |
---|
39 | |
---|
40 | public int getWeight() { |
---|
41 | return weight; |
---|
42 | } |
---|
43 | |
---|
44 | public int getCapacity() { |
---|
45 | return capacity; |
---|
46 | } |
---|
47 | |
---|
48 | @Override |
---|
49 | public String toString() { |
---|
50 | return "E" + id + " w:" + weight; |
---|
51 | } |
---|
52 | |
---|
53 | public void setWeight(int weight) { |
---|
54 | this.weight = weight; |
---|
55 | } |
---|
56 | |
---|
57 | public void setCapacity(int capacity) { |
---|
58 | this.capacity = capacity; |
---|
59 | } |
---|
60 | |
---|
61 | @Override |
---|
62 | public Edge clone(){ |
---|
63 | Edge e = new Edge(id, weight, capacity); |
---|
64 | return e; |
---|
65 | } |
---|
66 | |
---|
67 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.