Class AbstractScoresCache
- java.lang.Object
-
- org.biojava.nbio.structure.align.multiple.AbstractScoresCache
-
- All Implemented Interfaces:
ScoresCache
- Direct Known Subclasses:
BlockImpl
,BlockSetImpl
,MultipleAlignmentEnsembleImpl
,MultipleAlignmentImpl
public abstract class AbstractScoresCache extends Object implements ScoresCache
Abstact implementation of theScoresCache
with the shared code used in all objects with a variables cache.- Since:
- 4.1.0
- Author:
- Spencer Bliven
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractScoresCache()
protected
AbstractScoresCache(AbstractScoresCache cache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear the cached scores.protected Object
clone(Object e)
Subclasses should override clone and use the copy constructor.Double
getScore(String property)
Get the value for a particular score.Set<String>
getScores()
Get a collection of all scores that have been set.void
putScore(String property, Double score)
Add a score to the list of scores.
-
-
-
Constructor Detail
-
AbstractScoresCache
protected AbstractScoresCache()
-
AbstractScoresCache
protected AbstractScoresCache(AbstractScoresCache cache)
-
-
Method Detail
-
putScore
public void putScore(String property, Double score)
Description copied from interface:ScoresCache
Add a score to the list of scores.- Specified by:
putScore
in interfaceScoresCache
- Parameters:
property
- A string identifying the score and suitable for printing in headers. Example names found in:MultipleAlignmentScorer
.score
- Value of the score
-
getScore
public Double getScore(String property)
Description copied from interface:ScoresCache
Get the value for a particular score. Scores which return null should be recalculated and then stored usingScoresCache.putScore(String, Double)
.- Specified by:
getScore
in interfaceScoresCache
- Parameters:
property
- Name of the score to fetch- Returns:
- Value of the score, or null if it is not set.
-
getScores
public Set<String> getScores()
Description copied from interface:ScoresCache
Get a collection of all scores that have been set.- Specified by:
getScores
in interfaceScoresCache
- Returns:
- Set of all score names
-
clone
protected Object clone(Object e) throws CloneNotSupportedException
Subclasses should override clone and use the copy constructor.- Parameters:
e
-- Returns:
- Throws:
CloneNotSupportedException
-
clear
public void clear()
Clear the cached scores. This frees memory after the alignment changed.
-
-