View Javadoc

1   package net.obsearch.index.perm.impl;
2   
3   public class PerLong implements Comparable<PerLong>{
4   		private long distance;
5   		private short id;
6   		public PerLong(long distance, short id) {
7   			super();
8   			this.distance = distance;
9   			this.id = id;
10  		}
11  		@Override
12  		public int compareTo(PerLong o) {
13  			if(distance < o.distance){
14  				return -1;
15  			}else if(distance > o.distance){
16  				return 1;
17  			}else{
18  				if(id < o.id){
19  					return -1;
20  				}else if(id > o.id){
21  					return 1;
22  				}else{
23  					return 0;
24  				}
25  			}
26  		}
27  
28  		public boolean equals(Object o){
29  				PerLong ot = (PerLong)o;
30  				return  id == ot.id;
31  		}
32  		
33  		
34  		public int hashCode(){
35  				return id;
36  		}
37  		
38  		public long getDistance() {
39  			return distance;
40  		}
41  		public void setDistance(long distance) {
42  			this.distance = distance;
43  		}
44  		public short getId() {
45  			return id;
46  		}
47  		public void setId(short id) {
48  			this.id = id;
49  		}
50  		
51  		
52  		
53  	}
54  
55  
56