// Path: app/src/main/java/com/carver/paul/truesight/Models/HeroAndSimilarity.java
// public class HeroAndSimilarity implements Comparable<HeroAndSimilarity> {
//     public Double similarity;
//     public LoadedHeroImage hero;
// 
//     public HeroAndSimilarity(LoadedHeroImage hero, double similarity) {
//         this.hero = hero;
//         this.similarity = similarity;
//     }
// 
//     @Override
//     public int compareTo(HeroAndSimilarity other) {
//         return this.similarity.compareTo(other.similarity);
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (o == this)
//             return true;
//         if (o instanceof String) {
//             String string = (String) o;
//             return string.equals(this.hero.name);
//         }
//         if (!(o instanceof HeroAndSimilarity))
//             return false;
//         HeroAndSimilarity hhs = (HeroAndSimilarity) o;
//         return this.hero.name.equals(hhs.hero.name);
//     }
// 
//     @Override
//     public int hashCode() {
//         return hero.name.hashCode();
//     }
// }


import org.opencv.imgproc.Imgproc;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import android.content.Context;
import android.util.Log;
import android.util.Pair;
import com.carver.paul.truesight.BuildConfig;
import com.carver.paul.truesight.Models.HeroAndSimilarity;
import com.carver.paul.truesight.R;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Size;
                //new Pair<>(R.drawable.blank_hero, "blank_hero"));
    }

    public int NumberOfHeroesLoaded() {
        return mHeroes.size();
    }

    /**
     * This constructor sets loading all the heroes needed for the comparison work
     * @param context
     */
    public SimilarityTest(Context context) {
        if (BuildConfig.DEBUG) Log.d(TAG, "Loading comparison images.");

        for (Pair<Integer, String> drawableIdAndName : mHeroIconDrawables) {
            LoadedHeroImage hero = new LoadedHeroImage(context, drawableIdAndName.first, drawableIdAndName.second);
            mHeroes.add(hero);
        }

        if (BuildConfig.DEBUG) {
            Log.d(TAG, "Loaded " + NumberOfHeroesLoaded() + " hero images.");
        }
    }

    /**
     * Return a list of heroes with the similarity to the photo, ordered with the most similar
     * first.
     * @param photo
     * @return
     */
// Path: app/src/main/java/com/carver/paul/truesight/Models/HeroAndSimilarity.java
// public class HeroAndSimilarity implements Comparable<HeroAndSimilarity> {
//     public Double similarity;
//     public LoadedHeroImage hero;
// 
//     public HeroAndSimilarity(LoadedHeroImage hero, double similarity) {
//         this.hero = hero;
//         this.similarity = similarity;
//     }
// 
//     @Override
//     public int compareTo(HeroAndSimilarity other) {
//         return this.similarity.compareTo(other.similarity);
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (o == this)
//             return true;
//         if (o instanceof String) {
//             String string = (String) o;
//             return string.equals(this.hero.name);
//         }
//         if (!(o instanceof HeroAndSimilarity))
//             return false;
//         HeroAndSimilarity hhs = (HeroAndSimilarity) o;
//         return this.hero.name.equals(hhs.hero.name);
//     }
// 
//     @Override
//     public int hashCode() {
//         return hero.name.hashCode();
//     }
// }


// Path: app/src/main/java/com/carver/paul/truesight/ImageRecognition/SimilarityTest.java
import org.opencv.imgproc.Imgproc;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import android.content.Context;
import android.util.Log;
import android.util.Pair;
import com.carver.paul.truesight.BuildConfig;
import com.carver.paul.truesight.Models.HeroAndSimilarity;
import com.carver.paul.truesight.R;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Size;

                //new Pair<>(R.drawable.blank_hero, "blank_hero"));
    }

    public int NumberOfHeroesLoaded() {
        return mHeroes.size();
    }

    /**
     * This constructor sets loading all the heroes needed for the comparison work
     * @param context
     */
    public SimilarityTest(Context context) {
        if (BuildConfig.DEBUG) Log.d(TAG, "Loading comparison images.");

        for (Pair<Integer, String> drawableIdAndName : mHeroIconDrawables) {
            LoadedHeroImage hero = new LoadedHeroImage(context, drawableIdAndName.first, drawableIdAndName.second);
            mHeroes.add(hero);
        }

        if (BuildConfig.DEBUG) {
            Log.d(TAG, "Loaded " + NumberOfHeroesLoaded() + " hero images.");
        }
    }

    /**
     * Return a list of heroes with the similarity to the photo, ordered with the most similar
     * first.
     * @param photo
     * @return
     */
    public List<HeroAndSimilarity> OrderedListOfTemplateSimilarHeroes(Mat photo) {