equal
deleted
inserted
replaced
|
1 package ru.bosony.graph; |
|
2 |
|
3 import ru.bosony.model.mine.Cell; |
|
4 import ru.bosony.model.mine.Mine; |
|
5 |
|
6 /** |
|
7 * @author indvdum (gotoindvdum[at]gmail[dot]com) <br> |
|
8 * 16.07.2012 11:09:35 |
|
9 * |
|
10 */ |
|
11 public class CellsLink { |
|
12 Mine mine; |
|
13 Cell source; |
|
14 Cell target; |
|
15 double weight = 1d; |
|
16 |
|
17 public CellsLink(Mine mine, Cell source, Cell target) { |
|
18 this.mine = mine; |
|
19 this.source = source; |
|
20 this.target = target; |
|
21 calculateWeight(); |
|
22 } |
|
23 |
|
24 protected void calculateWeight() { |
|
25 |
|
26 } |
|
27 |
|
28 public Mine getMine() { |
|
29 return mine; |
|
30 } |
|
31 |
|
32 public Cell getSource() { |
|
33 return source; |
|
34 } |
|
35 |
|
36 public Cell getTarget() { |
|
37 return target; |
|
38 } |
|
39 |
|
40 public double getWeight() { |
|
41 return weight; |
|
42 } |
|
43 |
|
44 @Override |
|
45 public int hashCode() { |
|
46 // TODO Auto-generated method stub |
|
47 return super.hashCode(); |
|
48 } |
|
49 |
|
50 @Override |
|
51 public boolean equals(Object obj) { |
|
52 if (obj instanceof CellsLink) { |
|
53 CellsLink otherLink = (CellsLink) obj; |
|
54 return source.equals(otherLink.source) && target.equals(otherLink.target); |
|
55 } |
|
56 return super.equals(obj); |
|
57 } |
|
58 |
|
59 } |