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

org.molgenis.data.semanticsearch.semantic.Hit Maven / Gradle / Ivy

package org.molgenis.data.semanticsearch.semantic;

import com.google.auto.value.AutoValue;

@AutoValue
public abstract class Hit implements Comparable>
{
	public abstract T getResult();

	public abstract int getScoreInt();

	public float getScore()
	{
		return getScoreInt() / 100000.0f;
	}

	public static  Hit create(T result, float score)
	{
		return new AutoValue_Hit(result, Math.round(score * 100000));
	}

	@Override
	public int compareTo(Hit o)
	{
		return Float.compare(getScore(), o.getScore());
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy