1
|
1 package cl.maps.utils;
|
|
2
|
|
3 import java.util.Comparator;
|
|
4
|
|
5 import org.mpi.openmind.repository.bo.Entity;
|
|
6 import org.mpi.openmind.repository.bo.utils.EntitySortByNormalizedOwnValue;
|
|
7
|
|
8 import cl.maps.duplex.DuplexKey;
|
|
9 import cl.maps.duplex.DuplexMap;
|
|
10
|
|
11 public class DuplexMapKeepSortByNormalizedOV<V, A, B> implements Comparator<DuplexKey<A, B>>{
|
|
12
|
|
13 private DuplexMap<V, A, B> dupleMap;
|
|
14 private Entity entB;
|
|
15
|
|
16 public DuplexMapKeepSortByNormalizedOV(DuplexMap<V, A, B> map,
|
|
17 Object ent) {
|
|
18 this.dupleMap = map;
|
|
19 this.entB = (Entity) ent;
|
|
20 }
|
|
21
|
|
22 public DuplexMapKeepSortByNormalizedOV(DuplexMap<V, A, B> map) {
|
|
23 this.dupleMap = map;
|
|
24 }
|
|
25
|
|
26 public void setEntB(Object ent) {
|
|
27 this.entB = (Entity) ent;
|
|
28 }
|
|
29
|
|
30 public int compare(DuplexKey<A, B> a, DuplexKey<A, B> b) {
|
|
31 Entity entA = (Entity) dupleMap.get(a);
|
|
32 return EntitySortByNormalizedOwnValue.compare0(entA, entB);
|
|
33 }
|
|
34 }
|