|
Last change
on this file since 8 was
8,
checked in by gnappo, 15 years ago
|
|
Aggiunta la libreria Jung per lavorare con i grafi. Primi esperimenti. A breve riorganizzazione completa del codice per usufruire della libreria.
|
|
File size:
866 bytes
|
| 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; |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.