All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.asher_stern.crf.utilities.AbsoluteValueComparator Maven / Gradle / Ivy

Go to download

Implementation of linear-chain Conditional Random Fields (CRF) in pure Java

The newest version!
package com.asher_stern.crf.utilities;

import java.util.Comparator;

/**
 * A comparator of Double, which compares the absolute value of the given Doubles.
 * 
 * @author Asher Stern
 * Date: Nov 20, 2014
 *
 */
public class AbsoluteValueComparator implements Comparator
{
	@Override
	public int compare(Double o1, Double o2)
	{
		if (o1==o2) return 0;
		if (o1==null) return -1;
		if (o2==null) return 1;
		return Double.compare(Math.abs(o1), Math.abs(o2));
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy