Skip to content

Commit 02d2f54

Browse files
committed
Update EditDistance.java
1 parent 74407e7 commit 02d2f54

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/cicirello/permutations/distance/EditDistance.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* JavaPermutationTools - A Java library for computation on permutations.
3-
* Copyright 2005-2022 Vincent A. Cicirello, <https://www.cicirello.org/>.
3+
* Copyright 2005-2023 Vincent A. Cicirello, <https://www.cicirello.org/>.
44
*
55
* JavaPermutationTools is free software: you can
66
* redistribute it and/or modify it under the terms of the GNU
@@ -131,7 +131,7 @@ public double distancef(Permutation p1, Permutation p2) {
131131
if (combined <= changeCost) {
132132
return (length-1)*combined;
133133
}
134-
if (length % 2 == 0) {
134+
if ((length & 1) == 0) {
135135
double m1 = (length-1)*combined;
136136
double m2 = length*changeCost;
137137
double m3 = combined + (length-2)*changeCost;

0 commit comments

Comments
 (0)