Class AbstractSimilarityCache<T extends AbstractSimilarityCacheMatrix>
java.lang.Object
de.uni_trier.wi2.procake.adaptation.cache.AbstractSimilarityCache<T>
- Type Parameters:
T
- the similarity cache matrix to use
- Direct Known Subclasses:
SimilarityCache
,SimpleSimilarityCache
public abstract class AbstractSimilarityCache<T extends AbstractSimilarityCacheMatrix>
extends Object
Abstract class of the similarity cache which can be used to create a cache of similarities for a
case base.
- Author:
- Maximilian Hoffmann
-
Field Summary
Modifier and TypeFieldDescriptionprotected T
protected WriteableObjectPool
protected final org.slf4j.Logger
protected WriteableObjectPool
static final int
ConstantTIMER_INITIAL_DELAY_MS=60 * 1000
static final int
ConstantTIMER_PERIOD_MS=10 * 60 * 1000
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractSimilarityCache
(WriteableObjectPool queryPool, WriteableObjectPool casePool, T similarityMatrix, String pathCache, SimCalculatorStrategy strategy, boolean complete) Creates an abstract similarity cache.protected
AbstractSimilarityCache
(WriteableObjectPool pool, T similarityMatrix, String pathCache, SimCalculatorStrategy strategy, boolean complete) Creates an abstract similarity cache. -
Method Summary
Modifier and TypeMethodDescriptionGetter for the fieldcacheMatrix
.getCases()
getCases.double
getRoundedSimilarity
(String graphId, String compGraphId, SimilarityTreatment simTreatment) getRoundedSimilarity.double
getSimilarity
(String queryId, String caseId, SimilarityTreatment treatment) getSimilarity.void
updateAllSimilarities
(WriteableObjectPool poolObj) updateAllSimilarities.void
updateAllSimilarities
(WriteableObjectPool queryPoolObj, WriteableObjectPool casePoolObj) updateAllSimilarities.
-
Field Details
-
TIMER_INITIAL_DELAY_MS
public static final int TIMER_INITIAL_DELAY_MSConstantTIMER_INITIAL_DELAY_MS=60 * 1000
- See Also:
-
TIMER_PERIOD_MS
public static final int TIMER_PERIOD_MSConstantTIMER_PERIOD_MS=10 * 60 * 1000
- See Also:
-
logger
protected final org.slf4j.Logger logger -
cacheMatrix
-
queryPool
-
casePool
-
-
Constructor Details
-
AbstractSimilarityCache
protected AbstractSimilarityCache(WriteableObjectPool pool, T similarityMatrix, String pathCache, SimCalculatorStrategy strategy, boolean complete) Creates an abstract similarity cache. It computes similarities between all cases of the pool according to the given strategy and stores them in the similarity matrix. The given path is checked if it contains some or all of the similarities to compute (depending on the value of the parameter complete).- Parameters:
pool
- the pool to take the queries and cases fromsimilarityMatrix
- the similarity matrix to store the similarities inpathCache
- the path to store the cache and load it from, respectivelystrategy
- the strategy to compute the similarities withcomplete
- whether to complete the computations in the loaded file or start from scratch
-
AbstractSimilarityCache
protected AbstractSimilarityCache(WriteableObjectPool queryPool, WriteableObjectPool casePool, T similarityMatrix, String pathCache, SimCalculatorStrategy strategy, boolean complete) Creates an abstract similarity cache. It computes similarities between all cases of the pool according to the given strategy and stores them in the similarity matrix. The given path is checked if it contains some or all of the similarities to compute (depending on the value of the parameter complete).- Parameters:
queryPool
- the pool to take the queries fromcasePool
- the pool to take the cases fromsimilarityMatrix
- the similarity matrix to store the similarities inpathCache
- the path to store the cache and load it from, respectivelystrategy
- the strategy to compute the similarities withcomplete
- whether to complete the computations in the loaded file or start from scratch
-
-
Method Details
-
getCases
getCases.
- Returns:
- a
List
object
-
getSimilarity
getSimilarity.
- Parameters:
queryId
- aString
objectcaseId
- aString
objecttreatment
- aSimilarityTreatment
object- Returns:
- a double
-
getRoundedSimilarity
public double getRoundedSimilarity(String graphId, String compGraphId, SimilarityTreatment simTreatment) getRoundedSimilarity.
- Parameters:
graphId
- aString
objectcompGraphId
- aString
objectsimTreatment
- aSimilarityTreatment
object- Returns:
- a double
-
updateAllSimilarities
updateAllSimilarities.
- Parameters:
poolObj
- aWriteableObjectPool
object
-
updateAllSimilarities
public void updateAllSimilarities(WriteableObjectPool queryPoolObj, WriteableObjectPool casePoolObj) updateAllSimilarities.
- Parameters:
queryPoolObj
- aWriteableObjectPool
objectcasePoolObj
- aWriteableObjectPool
object
-
getCacheMatrix
Getter for the field
cacheMatrix
.- Returns:
- a T object
-