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
Fields Modifier and Type Field Description protected TcacheMatrixprotected WriteableObjectPoolcasePoolprotected org.slf4j.Loggerloggerprotected WriteableObjectPoolqueryPoolstatic intTIMER_INITIAL_DELAY_MSConstantTIMER_INITIAL_DELAY_MS=60 * 1000static intTIMER_PERIOD_MSConstantTIMER_PERIOD_MS=10 * 60 * 1000
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSimilarityCache(WriteableObjectPool queryPool, WriteableObjectPool casePool, T similarityMatrix, String pathCache, SimCalculatorStrategy strategy, boolean complete)Creates an abstract similarity cache.protectedAbstractSimilarityCache(WriteableObjectPool pool, T similarityMatrix, String pathCache, SimCalculatorStrategy strategy, boolean complete)Creates an abstract similarity cache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TgetCacheMatrix()Getter for the fieldcacheMatrix.List<String>getCases()getCases.doublegetRoundedSimilarity(String graphId, String compGraphId, SimilarityTreatment simTreatment)getRoundedSimilarity.doublegetSimilarity(String queryId, String caseId, SimilarityTreatment treatment)getSimilarity.voidupdateAllSimilarities(WriteableObjectPool poolObj)updateAllSimilarities.voidupdateAllSimilarities(WriteableObjectPool queryPoolObj, WriteableObjectPool casePoolObj)updateAllSimilarities.
-
-
-
Field Detail
-
TIMER_INITIAL_DELAY_MS
public static final int TIMER_INITIAL_DELAY_MS
ConstantTIMER_INITIAL_DELAY_MS=60 * 1000- See Also:
- Constant Field Values
-
TIMER_PERIOD_MS
public static final int TIMER_PERIOD_MS
ConstantTIMER_PERIOD_MS=10 * 60 * 1000- See Also:
- Constant Field Values
-
logger
protected final org.slf4j.Logger logger
-
cacheMatrix
protected T extends AbstractSimilarityCacheMatrix cacheMatrix
-
queryPool
protected WriteableObjectPool queryPool
-
casePool
protected WriteableObjectPool casePool
-
-
Constructor Detail
-
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 Detail
-
getSimilarity
public double getSimilarity(String queryId, String caseId, SimilarityTreatment treatment)
getSimilarity.
- Parameters:
queryId- aStringobjectcaseId- aStringobjecttreatment- aSimilarityTreatmentobject- Returns:
- a double
-
getRoundedSimilarity
public double getRoundedSimilarity(String graphId, String compGraphId, SimilarityTreatment simTreatment)
getRoundedSimilarity.
- Parameters:
graphId- aStringobjectcompGraphId- aStringobjectsimTreatment- aSimilarityTreatmentobject- Returns:
- a double
-
updateAllSimilarities
public void updateAllSimilarities(WriteableObjectPool poolObj)
updateAllSimilarities.
- Parameters:
poolObj- aWriteableObjectPoolobject
-
updateAllSimilarities
public void updateAllSimilarities(WriteableObjectPool queryPoolObj, WriteableObjectPool casePoolObj)
updateAllSimilarities.
- Parameters:
queryPoolObj- aWriteableObjectPoolobjectcasePoolObj- aWriteableObjectPoolobject
-
getCacheMatrix
public T getCacheMatrix()
Getter for the field
cacheMatrix.- Returns:
- a T object
-
-