-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCharactersDistance.java
More file actions
32 lines (24 loc) · 847 Bytes
/
CharactersDistance.java
File metadata and controls
32 lines (24 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
abstract class CharactersDistance {
protected int counter;
protected String implementation;
abstract double calculate(String c1, String c2);
public void calculateVerbose(String c1, String c2) {
long start = System.currentTimeMillis();
double distance = this.calculate(c1, c2);
long end = System.currentTimeMillis();
System.out.println("Méthode " + this.implementation);
System.out.println("------------------------------------");
System.out.println("Words: {\"" + c1 + "\", \"" + c2 + "\"}");
System.out.println("Distance: " + distance);
System.out.println("Complexity: " + this.counter);
System.out.println("Time: " + (end - start) + "ms");
System.out.println("");
}
protected double min(double... values) {
double min = values[0];
for (double v : values) {
min = Math.min(min, v);
}
return min;
}
}