// Path: core/src/main/java/edu/ucdavis/fiehnlab/spectra/hash/core/types/Ion.java
// public class Ion implements Comparable<Ion> {
//     private static String SEPERATOR = ":";
//     private static int PRECESSION = 6;
// 
//     private Double mass;
//     private Double intensity;
// 
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (!(o instanceof Ion)) return false;
// 
//         Ion ion = (Ion) o;
// 
//         if (!getMass().equals(ion.getMass())) return false;
//         return getIntensity().equals(ion.getIntensity());
// 
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = getMass().hashCode();
//         result = 31 * result + getIntensity().hashCode();
//         return result;
//     }
// 
//     public Ion() {}
// 
//     public Ion(double mass, double intensity) {
//         this.mass = mass;
//         this.intensity = intensity;
//     }
// 
//     public Double getIntensity() {
//         return intensity;
//     }
// 
//     public void setIntensity(Double intensity) {
//         this.intensity = intensity;
//     }
// 
//     public Double getMass() {
//         return mass;
//     }
// 
//     public void setMass(Double mass) {
//         this.mass = mass;
//     }
// 
//     public String toString() {
//         return String.format("%."+PRECESSION+"f",this.getMass()) + SEPERATOR + String.format("%." + PRECESSION + "f", this.getIntensity());
//     }
// 
//     public int compareTo(Ion o) {
//         return getMass().compareTo(o.getMass());
//     }
// }
// 
// Path: core/src/main/java/edu/ucdavis/fiehnlab/spectra/hash/core/Splash.java
// public interface Splash {
// 
//     /**
//      * generates a new spectra hash based on the given spectrum
//      * @return
//      */
//     String splashIt(Spectrum spectrum);
// 
//     /**
//      * adds an optional listener to the
//      * @param listener
//      */
//     void addListener(SplashListener listener);
// }
// 
// Path: core/src/main/java/edu/ucdavis/fiehnlab/spectra/hash/core/SplashFactory.java
// public class SplashFactory {
// 
//     public static Splash create() {
//         return createVersion1Splash();
//     }
// 
//     /**
//      * the first official splash release
//      *
//      * @return
//      */
//     public static Splash createVersion1Splash() {
//         return new SplashVersion1();
//     }
// 
// }
// 
// Path: core/src/main/java/edu/ucdavis/fiehnlab/spectra/hash/core/types/SpectraType.java
// public enum SpectraType {
//     MS('1'),
//     NMR('2'),
//     UV('3'),
//     IR('4'),
//     RAMAN('5');
// 
//     /**
//      * identifier has to be a single character
//      */
//     private final char identifier;
// 
//     /**
//      * creates a new spectra type with the assoicated reference number
//      *
//      * @param referenceNumber
//      */
//     SpectraType(char referenceNumber) {
//         this.identifier = referenceNumber;
//     }
// 
//     /**
//      * access to it's identifier
//      *
//      * @return
//      */
//     public char getIdentifier() {
//         return this.identifier;
//     }
// }
// 
// Path: web/src/main/java/edu/ucdavis/fiehnlab/spectra/hash/rest/dao/ValidationResponse.java
// public class ValidationResponse {
//     String referenceSplash;
// 
//     boolean validationSuccessful;
// 
//     public boolean isValidationSuccessful() {
//         return validationSuccessful;
//     }
// 
//     public void setValidationSuccessful(boolean validationSuccessful) {
//         this.validationSuccessful = validationSuccessful;
//     }
// 
//     public ValidationRequest getRequest() {
//         return request;
//     }
// 
//     public void setRequest(ValidationRequest request) {
//         this.request = request;
//     }
// 
//     public String getReferenceSplash() {
//         return referenceSplash;
//     }
// 
//     public void setReferenceSplash(String refrenceSplash) {
//         this.referenceSplash = refrenceSplash;
//     }
// 
//     ValidationRequest request;
// }


import edu.ucdavis.fiehnlab.spectra.hash.core.types.Ion;
import edu.ucdavis.fiehnlab.spectra.hash.core.Splash;
import edu.ucdavis.fiehnlab.spectra.hash.core.SplashFactory;
import edu.ucdavis.fiehnlab.spectra.hash.core.types.SpectraType;
import edu.ucdavis.fiehnlab.spectra.hash.rest.dao.Spectrum;
import edu.ucdavis.fiehnlab.spectra.hash.rest.dao.ValidationRequest;
import edu.ucdavis.fiehnlab.spectra.hash.rest.dao.ValidationResponse;
import org.apache.log4j.Logger;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
    }

    /**
     * converts a spectra to the hash code
     * @param validationRequest
     * @return validation response
     */
    @RequestMapping(value = "/splash/validate", method = RequestMethod.POST)
    public ValidationResponse validate(@RequestBody ValidationRequest validationRequest) {

        try {
            String reference = spectraHash.splashIt(validationRequest.getSpectrum());
            String provided = validationRequest.getSplash();

            ValidationResponse validationResponse = new ValidationResponse();
            validationResponse.setRequest(validationRequest);
            validationResponse.setReferenceSplash(reference);
            validationResponse.setValidationSuccessful(reference.equals(provided));

            return validationResponse;
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            throw new RuntimeException(e);
        }
    }

    @RequestMapping(value = "/splash/validate/example")
    public ValidationRequest splashValidationExample() {
        Spectrum spectrum = new Spectrum();
        spectrum.setIons(Arrays.asList(new Ion(100, 1), new Ion(101, 2), new Ion(102, 3)));
// Path: core/src/main/java/edu/ucdavis/fiehnlab/spectra/hash/core/types/Ion.java
// public class Ion implements Comparable<Ion> {
//     private static String SEPERATOR = ":";
//     private static int PRECESSION = 6;
// 
//     private Double mass;
//     private Double intensity;
// 
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (!(o instanceof Ion)) return false;
// 
//         Ion ion = (Ion) o;
// 
//         if (!getMass().equals(ion.getMass())) return false;
//         return getIntensity().equals(ion.getIntensity());
// 
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = getMass().hashCode();
//         result = 31 * result + getIntensity().hashCode();
//         return result;
//     }
// 
//     public Ion() {}
// 
//     public Ion(double mass, double intensity) {
//         this.mass = mass;
//         this.intensity = intensity;
//     }
// 
//     public Double getIntensity() {
//         return intensity;
//     }
// 
//     public void setIntensity(Double intensity) {
//         this.intensity = intensity;
//     }
// 
//     public Double getMass() {
//         return mass;
//     }
// 
//     public void setMass(Double mass) {
//         this.mass = mass;
//     }
// 
//     public String toString() {
//         return String.format("%."+PRECESSION+"f",this.getMass()) + SEPERATOR + String.format("%." + PRECESSION + "f", this.getIntensity());
//     }
// 
//     public int compareTo(Ion o) {
//         return getMass().compareTo(o.getMass());
//     }
// }
// 
// Path: core/src/main/java/edu/ucdavis/fiehnlab/spectra/hash/core/Splash.java
// public interface Splash {
// 
//     /**
//      * generates a new spectra hash based on the given spectrum
//      * @return
//      */
//     String splashIt(Spectrum spectrum);
// 
//     /**
//      * adds an optional listener to the
//      * @param listener
//      */
//     void addListener(SplashListener listener);
// }
// 
// Path: core/src/main/java/edu/ucdavis/fiehnlab/spectra/hash/core/SplashFactory.java
// public class SplashFactory {
// 
//     public static Splash create() {
//         return createVersion1Splash();
//     }
// 
//     /**
//      * the first official splash release
//      *
//      * @return
//      */
//     public static Splash createVersion1Splash() {
//         return new SplashVersion1();
//     }
// 
// }
// 
// Path: core/src/main/java/edu/ucdavis/fiehnlab/spectra/hash/core/types/SpectraType.java
// public enum SpectraType {
//     MS('1'),
//     NMR('2'),
//     UV('3'),
//     IR('4'),
//     RAMAN('5');
// 
//     /**
//      * identifier has to be a single character
//      */
//     private final char identifier;
// 
//     /**
//      * creates a new spectra type with the assoicated reference number
//      *
//      * @param referenceNumber
//      */
//     SpectraType(char referenceNumber) {
//         this.identifier = referenceNumber;
//     }
// 
//     /**
//      * access to it's identifier
//      *
//      * @return
//      */
//     public char getIdentifier() {
//         return this.identifier;
//     }
// }
// 
// Path: web/src/main/java/edu/ucdavis/fiehnlab/spectra/hash/rest/dao/ValidationResponse.java
// public class ValidationResponse {
//     String referenceSplash;
// 
//     boolean validationSuccessful;
// 
//     public boolean isValidationSuccessful() {
//         return validationSuccessful;
//     }
// 
//     public void setValidationSuccessful(boolean validationSuccessful) {
//         this.validationSuccessful = validationSuccessful;
//     }
// 
//     public ValidationRequest getRequest() {
//         return request;
//     }
// 
//     public void setRequest(ValidationRequest request) {
//         this.request = request;
//     }
// 
//     public String getReferenceSplash() {
//         return referenceSplash;
//     }
// 
//     public void setReferenceSplash(String refrenceSplash) {
//         this.referenceSplash = refrenceSplash;
//     }
// 
//     ValidationRequest request;
// }


// Path: web/src/main/java/edu/ucdavis/fiehnlab/spectra/hash/rest/RestController.java
import edu.ucdavis.fiehnlab.spectra.hash.core.types.Ion;
import edu.ucdavis.fiehnlab.spectra.hash.core.Splash;
import edu.ucdavis.fiehnlab.spectra.hash.core.SplashFactory;
import edu.ucdavis.fiehnlab.spectra.hash.core.types.SpectraType;
import edu.ucdavis.fiehnlab.spectra.hash.rest.dao.Spectrum;
import edu.ucdavis.fiehnlab.spectra.hash.rest.dao.ValidationRequest;
import edu.ucdavis.fiehnlab.spectra.hash.rest.dao.ValidationResponse;
import org.apache.log4j.Logger;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;

    }

    /**
     * converts a spectra to the hash code
     * @param validationRequest
     * @return validation response
     */
    @RequestMapping(value = "/splash/validate", method = RequestMethod.POST)
    public ValidationResponse validate(@RequestBody ValidationRequest validationRequest) {

        try {
            String reference = spectraHash.splashIt(validationRequest.getSpectrum());
            String provided = validationRequest.getSplash();

            ValidationResponse validationResponse = new ValidationResponse();
            validationResponse.setRequest(validationRequest);
            validationResponse.setReferenceSplash(reference);
            validationResponse.setValidationSuccessful(reference.equals(provided));

            return validationResponse;
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            throw new RuntimeException(e);
        }
    }

    @RequestMapping(value = "/splash/validate/example")
    public ValidationRequest splashValidationExample() {
        Spectrum spectrum = new Spectrum();
        spectrum.setIons(Arrays.asList(new Ion(100, 1), new Ion(101, 2), new Ion(102, 3)));
        spectrum.setOrigin("where do I come from or null");