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 */ 021package org.biojava.nbio.structure.align.multiple; 022 023import java.util.Set; 024 025import org.biojava.nbio.structure.align.multiple.util.MultipleAlignmentScorer; 026 027/** 028 * Interface for classes which implement a temporary cache for various numeric 029 * scores, e.g. RMSD, TM-Score, etc. 030 * <p> 031 * Implementations can treat this as a cache, with as much or as little 032 * persistence as required. If getScore() returns null, callers should 033 * recalculate the score and then store it for future calls. Implementations 034 * can therefore reset the cache if things which might impact the scores 035 * change. 036 * <p> 037 * A list of common scores are included to coordinate property names, but 038 * additional scores can be stored as well. As a result, this is a flexible 039 * cache that can store any score as a key-value object. 040 * 041 * @author Spencer Bliven 042 * @since 4.1.0 043 * 044 */ 045public interface ScoresCache { 046 047 /** 048 * Add a score to the list of scores. 049 * 050 * @param property A string identifying the score and suitable for printing 051 * in headers. Example names found in: {@link MultipleAlignmentScorer}. 052 * @param score Value of the score 053 */ 054 public void putScore(String property, Double score); 055 056 /** 057 * Get the value for a particular score. Scores which return null 058 * should be recalculated and then stored using 059 * {@link #putScore(String, Double)}. 060 * 061 * @param property Name of the score to fetch 062 * @return Value of the score, or null if it is not set. 063 */ 064 public Double getScore(String property); 065 066 /** 067 * Get a collection of all scores that have been set. 068 * 069 * @return Set of all score names 070 */ 071 public Set<String> getScores(); 072}