Package fr.ifremer.isisfish.datastore
Class ResultStorageAbstract
java.lang.Object
fr.ifremer.isisfish.datastore.ResultStorageAbstract
- All Implemented Interfaces:
ResultStorage,SimulationListener,SimulationResultGetter,SimulationResultListener
- Direct Known Subclasses:
ResultMappedStorage,ResultStorageCSV,ResultStorageInMemory
public abstract class ResultStorageAbstract
extends Object
implements SimulationResultListener, SimulationResultGetter, ResultStorage
Classe abstraite servant a factoriser tous les traitements commun au differente
implantation. Lorsqu'on herite de cette classe il reste a definir la lecture
et l'ecriture reel des resultats (en memoire, en base, binary file, ...)
Created: 24 juin 2014
- Version:
- $Revision$ Mise a jour: $Date$ par : $Author$
- Author:
- Benjamin Poussin : poussin@codelutin.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected EntitySemanticsDecoratorresult enabledprotected SimulationStorage -
Constructor Summary
ConstructorsConstructorDescriptionResultStorageAbstract(SimulationStorage simulation) Les ResultStorage ne doivent pas etre instancier directement, mais recuperer a partir d'unSimulationStorage.getResultStorage() -
Method Summary
Modifier and TypeMethodDescriptionvoidaddActiveRule(TimeStep step, Rule rule) voidaddResult(boolean force, TimeStep step, Population pop, org.nuiton.math.matrix.MatrixND mat) voidaddResult(boolean force, TimeStep step, String name, Population pop, org.nuiton.math.matrix.MatrixND mat) voidvoidvoidaddResult(SimulationContext context, TimeStep step, String name, org.nuiton.math.matrix.MatrixND mat) voidaddResult(TimeStep step, Population pop, org.nuiton.math.matrix.MatrixND mat) voidaddResult(TimeStep step, String name, Population pop, org.nuiton.math.matrix.MatrixND mat) voidvoidvoidafterSimulation(SimulationContext context) called after simulationvoidbeforeSimulation(SimulationContext context) called before simulationvoidclose()Close result storage.protected org.nuiton.math.matrix.MatrixNDdecorate(org.nuiton.math.matrix.MatrixND mat, org.nuiton.topia.TopiaContext tx) voiddelete()Delete all result for this result storage.protected voiddoAddResult(TimeStep step, String name, org.nuiton.math.matrix.MatrixND mat) getInfo()Return some information on result storage.Get last simulation date.org.nuiton.math.matrix.MatrixNDgetMatrix(Population pop, String name) Retourne une matrice contenant tous les pas de temps.org.nuiton.math.matrix.MatrixNDgetMatrix(Population pop, String name, org.nuiton.topia.TopiaContext tx) Retourne une matrice contenant tous les pas de temps.org.nuiton.math.matrix.MatrixNDgetMatrix(SimulationContext context, TimeStep step, String name) Retourne la matrice stocke pour un pas de temps.org.nuiton.math.matrix.MatrixNDgetMatrix(SimulationContext context, String name) Retourne une matrice contenant tous les pas de temps.org.nuiton.math.matrix.MatrixNDgetMatrix(SimulationContext context, List<TimeStep> steps, String name) Retourne la matrice stocke pour un ensemble de pas de temps.org.nuiton.math.matrix.MatrixNDgetMatrix(TimeStep step, Population pop, String name) Retourne la matrice stocke pour un pas de tempsorg.nuiton.math.matrix.MatrixNDgetMatrix(TimeStep step, Population pop, String name, org.nuiton.topia.TopiaContext tx) Retourne la matrice stocke pour un pas de tempsorg.nuiton.math.matrix.MatrixNDorg.nuiton.math.matrix.MatrixNDRetourne une matrice contenant tous les pas de temps.org.nuiton.math.matrix.MatrixNDRetourne une matrice contenant tous les pas de temps.org.nuiton.math.matrix.MatrixNDRetourne une matrice contenant tous les pas de temps.org.nuiton.math.matrix.MatrixNDgetMatrix(List<TimeStep> steps, Population pop, String name) Retourne la matrice stocke pour des pas de tempsorg.nuiton.math.matrix.MatrixNDgetMatrix(List<TimeStep> steps, Population pop, String name, org.nuiton.topia.TopiaContext tx) org.nuiton.math.matrix.MatrixNDorg.nuiton.math.matrix.MatrixNDRetourne la matrice stocke pour des pas de temps.protected org.nuiton.math.matrix.MatrixFactorysub class can overwrite this method to return specifique factoryprotected EntitySemanticsDecorator.EntityProvidergetProvider(org.nuiton.topia.TopiaContext tx) Try to find better tx.return list of all result name availablebooleanDeprecated.since 4.4.0.0 : this method is duplicated with ResultManager#isEnabled(String)protected abstract org.nuiton.math.matrix.MatrixNDreadResult(TimeStep step, String name) Return one result for step and name.voidstepChange(SimulationContext context, TimeStep step) Receive event when simulation change stepprotected Stringundecorate(Object o) undecorate(List l) return new list with undecorate itemprotected org.nuiton.math.matrix.MatrixNDundecorate(org.nuiton.math.matrix.MatrixND mat) Return undecorated version of matrix in argumentprotected abstract voidwriteActiveRule(TimeStep step, String name, String params) Write active ruleprotected abstract voidwriteResult(TimeStep step, String name, org.nuiton.math.matrix.MatrixND mat) write result
-
Field Details
-
simulation
-
decorator
-
enabledResult
result enabled
-
-
Constructor Details
-
ResultStorageAbstract
Les ResultStorage ne doivent pas etre instancier directement, mais recuperer a partir d'unSimulationStorage.getResultStorage()- Parameters:
simulation- storage to get result
-
-
Method Details
-
readResult
Return one result for step and name. Matrix returned must be undecorated (semantics must be string representation of object)- Parameters:
step-name-- Returns:
-
writeResult
protected abstract void writeResult(TimeStep step, String name, org.nuiton.math.matrix.MatrixND mat) write result- Parameters:
step-name-mat-
-
writeActiveRule
Write active rule- Parameters:
step-name-params-
-
getResultName
return list of all result name available- Specified by:
getResultNamein interfaceResultStorage- Returns:
-
getMatrixFactory
protected org.nuiton.math.matrix.MatrixFactory getMatrixFactory()sub class can overwrite this method to return specifique factory- Returns:
-
getInfo
Return some information on result storage. Information depend on result storage type- Specified by:
getInfoin interfaceResultStorage- Returns:
-
decorate
protected org.nuiton.math.matrix.MatrixND decorate(org.nuiton.math.matrix.MatrixND mat, org.nuiton.topia.TopiaContext tx) -
undecorate
protected org.nuiton.math.matrix.MatrixND undecorate(org.nuiton.math.matrix.MatrixND mat) Return undecorated version of matrix in argument- Parameters:
mat-- Returns:
- new matrix undecorated
-
undecorate
return new list with undecorate item- Parameters:
l-- Returns:
- new list
-
undecorate
-
delete
public void delete()Description copied from interface:ResultStorageDelete all result for this result storage. In case of sensitivity analysis, after export, result are no longer needed and can be deleted to save disk space.- Specified by:
deletein interfaceResultStorage
-
close
public void close()Description copied from interface:ResultStorageClose result storage.- Specified by:
closein interfaceResultStorage
-
addResult
- Specified by:
addResultin interfaceResultStorage- Throws:
IsisFishException
-
addResult
public void addResult(TimeStep step, Population pop, org.nuiton.math.matrix.MatrixND mat) throws IsisFishException - Specified by:
addResultin interfaceResultStorage- Throws:
IsisFishException
-
addResult
public void addResult(boolean force, TimeStep step, org.nuiton.math.matrix.MatrixND mat) throws IsisFishException - Specified by:
addResultin interfaceResultStorage- Throws:
IsisFishException
-
addResult
public void addResult(boolean force, TimeStep step, Population pop, org.nuiton.math.matrix.MatrixND mat) throws IsisFishException - Specified by:
addResultin interfaceResultStorage- Throws:
IsisFishException
-
addResult
public void addResult(TimeStep step, String name, Population pop, org.nuiton.math.matrix.MatrixND mat) throws IsisFishException - Specified by:
addResultin interfaceResultStorage- Throws:
IsisFishException
-
addResult
public void addResult(TimeStep step, String name, org.nuiton.math.matrix.MatrixND mat) throws IsisFishException - Specified by:
addResultin interfaceResultStorage- Throws:
IsisFishException
-
addResult
public void addResult(boolean force, TimeStep step, String name, Population pop, org.nuiton.math.matrix.MatrixND mat) throws IsisFishException - Specified by:
addResultin interfaceResultStorage- Throws:
IsisFishException
-
addResult
public void addResult(boolean force, TimeStep step, String name, org.nuiton.math.matrix.MatrixND mat) throws IsisFishException - Specified by:
addResultin interfaceResultStorage- Throws:
IsisFishException
-
doAddResult
protected void doAddResult(TimeStep step, String name, org.nuiton.math.matrix.MatrixND mat) throws IsisFishException - Throws:
IsisFishException
-
isEnabled
Deprecated.since 4.4.0.0 : this method is duplicated with ResultManager#isEnabled(String)Permet de savoir si lorsque l'on ajoutera ce resultat, il sera sauvé ou non. Check for result name returned by :- Specified by:
isEnabledin interfaceResultStorage- Parameters:
name- result name- Returns:
trueif result is enabled
-
addActiveRule
- Specified by:
addActiveRulein interfaceResultStorage- Throws:
IsisFishException
-
getMatrix
Retourne la matrice stocke pour un pas de temps- Specified by:
getMatrixin interfaceResultStorage- Parameters:
step- le pas de temps que l'on souhaitepop- la population pour lequelle on souhaite le resultatname- le nom des resultats dont on veut la matrice- Returns:
- La matrice demandée ou null si aucune matrice ne correspond a la demande.
-
getMatrix
public org.nuiton.math.matrix.MatrixND getMatrix(TimeStep step, Population pop, String name, org.nuiton.topia.TopiaContext tx) Retourne la matrice stocke pour un pas de temps- Specified by:
getMatrixin interfaceResultStorage- Parameters:
step- le pas de temps que l'on souhaitepop- la population pour lequelle on souhaite le resultatname- le nom des resultats dont on veut la matrice- Returns:
- La matrice demandée ou null si aucune matrice ne correspond a la demande.
-
getMatrix
- Specified by:
getMatrixin interfaceResultStorage
-
getMatrix
public org.nuiton.math.matrix.MatrixND getMatrix(TimeStep step, String name, org.nuiton.topia.TopiaContext tx) Retourne une matrice contenant tous les pas de temps.- Specified by:
getMatrixin interfaceResultStorage- Parameters:
name- le nom des resultats dont on veut une matrice globale.step- le pas de temps que l'on souhaitetx- TopiaContext a utiliser pour recuperer les resultats et donc les semantiques- Returns:
- copy of result matrix
-
getMatrix
Retourne une matrice contenant tous les pas de temps.- Specified by:
getMatrixin interfaceResultStorage- Parameters:
pop- la population pour lequel on souhaite la matricename- le nom des resultats dont on veut une matrice globale.
-
getMatrix
public org.nuiton.math.matrix.MatrixND getMatrix(Population pop, String name, org.nuiton.topia.TopiaContext tx) Description copied from interface:ResultStorageRetourne une matrice contenant tous les pas de temps.- Specified by:
getMatrixin interfaceResultStorage- Parameters:
pop- la population pour lequel on souhaite la matricename- le nom des resultats dont on veut une matrice globale.tx- la transaction a utiliser
-
getMatrix
Retourne une matrice contenant tous les pas de temps.- Specified by:
getMatrixin interfaceResultStorage- Parameters:
name- le nom des resultats dont on veut une matrice globale.
-
getMatrix
Retourne une matrice contenant tous les pas de temps.- Specified by:
getMatrixin interfaceResultStorage- Parameters:
name- le nom des resultats dont on veut une matrice globale.tx- TopiaContext a utiliser pour recuperer les resultats et donc les semantiques- Returns:
- new Matrix
-
getMatrix
Description copied from interface:ResultStorageRetourne la matrice stocke pour des pas de temps- Specified by:
getMatrixin interfaceResultStorage- Parameters:
steps- les pas de temps que l'on souhaitepop- la population pour lequelle on souhaite le resultatname- le nom des resultats dont on veut la matrice- Returns:
- La matrice demandée ou null si aucune matrice ne correspond a la demande.
-
getMatrix
public org.nuiton.math.matrix.MatrixND getMatrix(List<TimeStep> steps, Population pop, String name, org.nuiton.topia.TopiaContext tx) - Specified by:
getMatrixin interfaceResultStorage
-
getMatrix
- Specified by:
getMatrixin interfaceResultStorage
-
getMatrix
public org.nuiton.math.matrix.MatrixND getMatrix(List<TimeStep> steps, String name, org.nuiton.topia.TopiaContext tx) Description copied from interface:ResultStorageRetourne la matrice stocke pour des pas de temps.- Specified by:
getMatrixin interfaceResultStorage- Parameters:
steps- les pas de temps que l'on souhaitename- le nom des resultats dont on veut la matricetx- TopiaContext a utiliser pour recuperer les resultats et donc les semantiques- Returns:
- La matrice demandée ou
nullsi aucune matrice ne correspond a la demande.
-
getLastStep
Get last simulation date.- Specified by:
getLastStepin interfaceResultStorage- Returns:
- last simulation date
-
addResult
public void addResult(SimulationContext context, TimeStep step, String name, org.nuiton.math.matrix.MatrixND mat) throws IsisFishException - Specified by:
addResultin interfaceSimulationResultListener- Throws:
IsisFishException
-
getMatrix
public org.nuiton.math.matrix.MatrixND getMatrix(SimulationContext context, TimeStep step, String name) Description copied from interface:SimulationResultGetterRetourne la matrice stocke pour un pas de temps.- Specified by:
getMatrixin interfaceSimulationResultGetterstep- le pas de temps que l'on souhaitename- le nom des resultats dont on veut la matrice- Returns:
- La matrice demandée ou null si aucune matrice ne correspond a la demande.
-
getMatrix
public org.nuiton.math.matrix.MatrixND getMatrix(SimulationContext context, List<TimeStep> steps, String name) Description copied from interface:SimulationResultGetterRetourne la matrice stocke pour un ensemble de pas de temps.- Specified by:
getMatrixin interfaceSimulationResultGettersteps- les pas de temps que l'on souhaitename- le nom des resultats dont on veut la matrice- Returns:
- La matrice demandée ou null si aucune matrice ne correspond a la demande.
-
getMatrix
Description copied from interface:SimulationResultGetterRetourne une matrice contenant tous les pas de temps.- Specified by:
getMatrixin interfaceSimulationResultGettername- le nom des resultats dont on veut une matrice globale.
-
getProvider
Try to find better tx. If argument is not null, return it. otherwize try to get tx in SimulationContext.- Parameters:
tx-- Returns:
-
afterSimulation
Description copied from interface:SimulationListenercalled after simulation- Specified by:
afterSimulationin interfaceSimulationListener
-
beforeSimulation
Description copied from interface:SimulationListenercalled before simulation- Specified by:
beforeSimulationin interfaceSimulationListener
-
stepChange
Description copied from interface:SimulationListenerReceive event when simulation change step- Specified by:
stepChangein interfaceSimulationListenerstep- new Step
-