-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDistance.java
More file actions
27 lines (26 loc) · 764 Bytes
/
Distance.java
File metadata and controls
27 lines (26 loc) · 764 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
public class Distance
implements Comparable<Distance>, java.io.Serializable{
private double distance;
private Pyroprint print;
public Distance(double distance, Pyroprint print){
this.distance = distance;
this.print = print;
}
public int compareTo(Distance other){
if(this.distance < other.distance) return 1;
if(this.distance > other.distance) return -1;
return 0;
}
public String getCommonName(){
return this.print.getCommonName();
}
public double getDistance(){
return this.distance;
}
public Pyroprint getPyro(){
return print;
}
public String toString(){
return String.format("%.5f: %s(%s)",this.distance,this.print.getCommonName(),this.print.getPyroId());
}
}