Skip to content

Commit ab17e93

Browse files
committed
small refinements
1 parent c465cf1 commit ab17e93

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111

1212
# Eclipse
1313
.project
14-
.classpath
14+
.classpath
15+
/.settings/

jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/Skills.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public String toString() {
109109
* @return true if skill is included, false otherwise
110110
*/
111111
public boolean containsSkill(String skill) {
112-
return skills.contains(skill.toLowerCase());
112+
return skills.contains(skill.trim().toLowerCase());// trim to be consistent with addSkill()
113113
}
114114

115115
@Override

jsprit-core/src/main/java/com/graphhopper/jsprit/core/util/Coordinate.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public static Coordinate newInstance(double x, double y) {
2323
return new Coordinate(x, y);
2424
}
2525

26-
private double x;
26+
private final double x;
2727

28-
private double y;
28+
private final double y;
2929

3030
public Coordinate(double x, double y) {
3131
super();

jsprit-core/src/main/java/com/graphhopper/jsprit/core/util/EuclideanCosts.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,8 @@ public double getTransportCost(Location from, Location to, double time, Driver d
6060
private double calculateDistance(Location fromLocation, Location toLocation) {
6161
Coordinate from = null;
6262
Coordinate to = null;
63-
if (fromLocation.getCoordinate() != null & toLocation.getCoordinate() != null) {
64-
from = fromLocation.getCoordinate();
65-
to = toLocation.getCoordinate();
66-
}
67-
if (from == null || to == null) throw new NullPointerException();
63+
from = fromLocation.getCoordinate();
64+
to = toLocation.getCoordinate();
6865
return calculateDistance(from, to);
6966
}
7067

jsprit-examples/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
.project
1414
.classpath
1515
.settings
16+
/.factorypath

0 commit comments

Comments
 (0)