Last change
on this file since 22 was
15,
checked in by gnappo, 14 years ago
|
Individuazione del miglioramento del taglio: tentativi.
|
File size:
1019 bytes
|
Line | |
---|
1 | package weka.clusterers.forMetisMQI.graph; |
---|
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 | } |
---|
31 | return result; |
---|
32 | } |
---|
33 | |
---|
34 | public String getId() { |
---|
35 | return id; |
---|
36 | } |
---|
37 | |
---|
38 | public int getWeight() { |
---|
39 | return weight; |
---|
40 | } |
---|
41 | |
---|
42 | public int getCapacity() { |
---|
43 | return capacity; |
---|
44 | } |
---|
45 | |
---|
46 | @Override |
---|
47 | public String toString() { |
---|
48 | return Integer.toString(capacity); |
---|
49 | } |
---|
50 | |
---|
51 | public void setWeight(int weight) { |
---|
52 | this.weight = weight; |
---|
53 | } |
---|
54 | |
---|
55 | public void setCapacity(int capacity) { |
---|
56 | this.capacity = capacity; |
---|
57 | } |
---|
58 | |
---|
59 | @Override |
---|
60 | public Edge clone(){ |
---|
61 | Edge e = new Edge(id, weight, capacity); |
---|
62 | return e; |
---|
63 | } |
---|
64 | |
---|
65 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.