View Javadoc
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  		return prime * result + (cities == null ? 0 : cities.hashCode());
30  	}
31  
32  	@Override
33  	public boolean equals(Object obj) {
34  		if (this == obj) {
35  			return true;
36  		}
37  		if (obj == null) {
38  			return false;
39  		}
40  		if (getClass() != obj.getClass()) {
41  			return false;
42  		}
43  		TSPLIBProblem other = (TSPLIBProblem) obj;
44  		if (attributes == null) {
45  			if (other.attributes != null) {
46  				return false;
47  			}
48  		} else if (!attributes.equals(other.attributes)) {
49  			return false;
50  		}
51  		if (cities == null) {
52  			if (other.cities != null) {
53  				return false;
54  			}
55  		} else if (!cities.equals(other.cities)) {
56  			return false;
57  		}
58  		return true;
59  	}
60  
61  	@Override
62  	public String toString() {
63  		return "TSPLIBProblem [attributes=" + attributes + "]";
64  	}
65  }