Skip to content

Commit 4a4bb88

Browse files
committed
refactor RelbelBySorting
1 parent 4ed9802 commit 4a4bb88

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/org/cicirello/sequences/distance/RelabelBySorting.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @author <a href=https://www.cicirello.org/ target=_top>Vincent A. Cicirello</a>, <a
3232
* href=https://www.cicirello.org/ target=_top>https://www.cicirello.org/</a>
3333
*/
34-
final class RelabelBySorting extends AbstractRelabelBySorting implements KendallTauRelabeler {
34+
final class RelabelBySorting implements KendallTauRelabeler {
3535

3636
@Override
3737
public int relabel(int[] s1, int[] s2, int[][] relabeling) {
@@ -251,4 +251,11 @@ public <T> int relabel(List<T> s1, List<T> s2, int[][] relabeling) {
251251
}
252252
return current + 1;
253253
}
254+
255+
private void validateElementIndex(int index) {
256+
if (index < 0) {
257+
throw new IllegalArgumentException(
258+
"Sequences must contain same elements: s2 contains at least one element not in s1.");
259+
}
260+
}
254261
}

0 commit comments

Comments
 (0)