package com.aluxoft.earrecognition.common;

/**
 * Created by josejuliomartinez on 14/10/15.
 */
public class NameDistance implements Comparable<NameDistance> {
    public double distance  = 0;
    public Person person = null;

    public NameDistance() {

    }

    public NameDistance(double distance, Person person) {
        this.set(distance, person);
    }

    public void set(double distance, Person person) {
        this.distance = distance;
        this.person = person;
    }

    @Override
    public int compareTo(NameDistance nameDistance) {
        if (this.distance < nameDistance.distance) {
            return -1;
        } else if (this.distance == nameDistance.distance) {
            return 0;
        } else {
            return 1;
        }
    }

    @Override
    public String toString() {
        return this.person.getName();
    }
}