view src/main/java/cl/maps/utils/DuplexMapKeepSortByNormalizedOV.java @ 1:615d27dce9b3

(none)
author jurzua
date Wed, 29 Oct 2014 13:28:45 +0000
parents
children
line wrap: on
line source

package cl.maps.utils;

import java.util.Comparator;

import org.mpi.openmind.repository.bo.Entity;
import org.mpi.openmind.repository.bo.utils.EntitySortByNormalizedOwnValue;

import cl.maps.duplex.DuplexKey;
import cl.maps.duplex.DuplexMap;

public class DuplexMapKeepSortByNormalizedOV<V, A, B> implements Comparator<DuplexKey<A, B>>{
	
	private DuplexMap<V, A, B> dupleMap;
	private Entity entB;
	
	public DuplexMapKeepSortByNormalizedOV(DuplexMap<V, A, B> map,
			Object ent) {
		this.dupleMap = map;
		this.entB = (Entity) ent;
	}

	public DuplexMapKeepSortByNormalizedOV(DuplexMap<V, A, B> map) {
		this.dupleMap = map;
	}

	public void setEntB(Object ent) {
		this.entB = (Entity) ent;
	}

	public int compare(DuplexKey<A, B> a, DuplexKey<A, B> b) {
		Entity entA = (Entity) dupleMap.get(a);
		return EntitySortByNormalizedOwnValue.compare0(entA, entB);
	}
}