001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 * Created on June 7, 2010
021 * Author: Mark Chapman
022 */
023
024package org.biojava.nbio.alignment.template;
025
026/**
027 * Defines an algorithm which computes a score.
028 *
029 * @author Mark Chapman
030 */
031public interface Scorer {
032
033        /**
034         * Returns score as a distance between 0.0 and 1.0.  This equals ({@link #getMaxScore()} - {@link #getScore()}) /
035         * ({@link #getMaxScore()} - {@link #getMinScore()}).
036         *
037         * @return score as a distance between 0.0 and 1.0
038         */
039        double getDistance();
040
041        /**
042         * Returns score as a distance between 0.0 and scale.  This equals scale * ({@link #getMaxScore()} -
043         * {@link #getScore()}) / ({@link #getMaxScore()} - {@link #getMinScore()}).
044         *
045         * @param scale maximum distance
046         * @return score as a distance between 0.0 and scale
047         */
048        double getDistance(double scale);
049
050        /**
051         * Returns maximum possible score.
052         *
053         * @return maximum possible score
054         */
055        double getMaxScore();
056
057        /**
058         * Returns minimum possible score.
059         *
060         * @return minimum possible score
061         */
062        double getMinScore();
063
064        /**
065         * Returns score resulting from algorithm.  This should normalize between 0 and 1 by calculating
066         * ({@link #getScore()} - {@link #getMinScore()}) / ({@link #getMaxScore()} - {@link #getMinScore()}).
067         *
068         * @return score resulting from algorithm
069         */
070        double getScore();
071
072        /**
073         * Returns score as a similarity between 0.0 and 1.0.  This equals ({@link #getScore()} - {@link #getMinScore()}) /
074         * ({@link #getMaxScore()} - {@link #getMinScore()}).
075         *
076         * @return score as a similarity between 0.0 and 1.0
077         */
078        double getSimilarity();
079
080        /**
081         * Returns score as a similarity between 0.0 and scale.  This equals scale * ({@link #getScore()} -
082         * {@link #getMinScore()}) / ({@link #getMaxScore()} - {@link #getMinScore()}).
083         *
084         * @param scale maximum similarity
085         * @return score as a similarity between 0.0 and scale
086         */
087        double getSimilarity(double scale);
088
089}