Last change
on this file since 15 was
11,
checked in by gnappo, 14 years ago
|
Un po' di refactoring e implementazione dell'algoritmo di raffinamento.
|
File size:
984 bytes
|
Line | |
---|
1 | package weka.clusterers.forMetisMQI.graph; |
---|
2 | |
---|
3 | |
---|
4 | public class Node { |
---|
5 | |
---|
6 | private String id; |
---|
7 | |
---|
8 | /** The weight of the node */ |
---|
9 | private int vwgt; |
---|
10 | /** The weight of the edges that have been contracted to create the node */ |
---|
11 | private int cewgt; |
---|
12 | public Node(String id) { |
---|
13 | this.id = id; |
---|
14 | this.vwgt = 1; |
---|
15 | this.cewgt = 0; |
---|
16 | } |
---|
17 | |
---|
18 | @Override |
---|
19 | public boolean equals(Object o) { |
---|
20 | return (o instanceof Node) && (((Node) o).getId().equals(id)); |
---|
21 | } |
---|
22 | |
---|
23 | @Override |
---|
24 | public int hashCode() { |
---|
25 | int hash = 1; |
---|
26 | hash = hash * 31 + id.hashCode(); |
---|
27 | return hash; |
---|
28 | } |
---|
29 | |
---|
30 | public String getId() { |
---|
31 | return id; |
---|
32 | } |
---|
33 | |
---|
34 | @Override |
---|
35 | public String toString() { |
---|
36 | return "N" + id; //+ " Cewgt: " + cewgt; |
---|
37 | } |
---|
38 | |
---|
39 | public int getVwgt() { |
---|
40 | return vwgt; |
---|
41 | } |
---|
42 | |
---|
43 | public void setVwgt(int vwgt) { |
---|
44 | this.vwgt = vwgt; |
---|
45 | } |
---|
46 | |
---|
47 | public int getCewgt() { |
---|
48 | return cewgt; |
---|
49 | } |
---|
50 | |
---|
51 | public void setCewgt(int cewgt) { |
---|
52 | this.cewgt = cewgt; |
---|
53 | } |
---|
54 | |
---|
55 | @Override |
---|
56 | public Node clone() { |
---|
57 | Node n = new Node(id); |
---|
58 | n.cewgt = cewgt; |
---|
59 | n.vwgt = vwgt; |
---|
60 | return n; |
---|
61 | } |
---|
62 | |
---|
63 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.