com.rubecula.darwin.domain.helper
Class PhenotypeCache

java.lang.Object
  extended by com.rubecula.darwin.domain.helper.Cache_<PhenotypeCacheKey,Phenotype>
      extended by com.rubecula.darwin.domain.helper.PhenotypeCache
All Implemented Interfaces:
Cache, Cache_MBean, net.sf.tostring0.Identifiable

public class PhenotypeCache
extends Cache_<PhenotypeCacheKey,Phenotype>

This cache maintains a set of Phenotypes indexed by Basic/Identifiable pair. Normally, the identifiable object is a population, or at any rate, a Colony. The purpose is to save time regenerating the phenotype when it is unnecessary. TODO must ensure that this cache is flushed when variables change.

Author:
Robin Hillyard

Field Summary
 
Fields inherited from class com.rubecula.darwin.domain.helper.Cache_
LOG
 
Constructor Summary
PhenotypeCache()
           
 
Method Summary
 void addPhenotype(Basic genes, net.sf.tostring0.Identifiable identifiable, Phenotype phenotype)
           
 void flush(Basic genes, net.sf.tostring0.Identifiable identifiable)
           
 java.lang.String getIdentifier()
           
 Phenotype getPhenotype(Basic genes, net.sf.tostring0.Identifiable identifiable)
           
 
Methods inherited from class com.rubecula.darwin.domain.helper.Cache_
add, cached, count, flush, flush, get, isActive, setActive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhenotypeCache

public PhenotypeCache()
Method Detail

addPhenotype

public void addPhenotype(Basic genes,
                         net.sf.tostring0.Identifiable identifiable,
                         Phenotype phenotype)
Parameters:
genes - the genes being expressed
identifiable - the identifiable object, typically a population.
phenotype -

flush

public void flush(Basic genes,
                  net.sf.tostring0.Identifiable identifiable)
Parameters:
genes -
identifiable -

getIdentifier

public java.lang.String getIdentifier()
Returns:
"phenotype cache"
See Also:
Identifiable.getIdentifier()

getPhenotype

public Phenotype getPhenotype(Basic genes,
                              net.sf.tostring0.Identifiable identifiable)
Parameters:
genes - the genes from which we derive the phenotype
identifiable - the identifiable object (and its environment).
Returns:
the cached phenotype (or null if none) - unless it is not active in which case always null.


Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.