1 package net.bmahe.genetics4j.samples;
2
3 import java.util.List;
4 import java.util.Map;
5
6 public class TSPLIBProblem {
7
8 public final Map<String, String> attributes;
9 public final List<Position> cities;
10
11 public TSPLIBProblem(final Map<String, String> _attributes, final List<Position> _cities) {
12 this.attributes = _attributes;
13 this.cities = _cities;
14 }
15
16 public Map<String, String> getAttributes() {
17 return attributes;
18 }
19
20 public List<Position> getCities() {
21 return cities;
22 }
23
24 @Override
25 public int hashCode() {
26 final int prime = 31;
27 int result = 1;
28 result = prime * result + ((attributes == null) ? 0 : attributes.hashCode());
29 result = prime * result + ((cities == null) ? 0 : cities.hashCode());
30 return result;
31 }
32
33 @Override
34 public boolean equals(Object obj) {
35 if (this == obj)
36 return true;
37 if (obj == null)
38 return false;
39 if (getClass() != obj.getClass())
40 return false;
41 TSPLIBProblem other = (TSPLIBProblem) obj;
42 if (attributes == null) {
43 if (other.attributes != null)
44 return false;
45 } else if (!attributes.equals(other.attributes))
46 return false;
47 if (cities == null) {
48 if (other.cities != null)
49 return false;
50 } else if (!cities.equals(other.cities))
51 return false;
52 return true;
53 }
54
55 @Override
56 public String toString() {
57 return "TSPLIBProblem [attributes=" + attributes + "]";
58 }
59 }