Class Genome<T extends Genome>

  • All Implemented Interfaces:
    java.lang.Iterable<T>

    public class Genome<T extends Genome>
    extends java.lang.Object
    implements java.lang.Iterable<T>
    the genome class is useful for keeping track of shared genetic information and phylogenies. extend this class to add any genetic/inherited information that needs to be tracked. an instance of the Genome class should be created once for every new mutation, and all agents with the same genome should share the same class instance as a member variable
    • Constructor Summary

      Constructors 
      Constructor Description
      Genome​(T parent)  
      Genome​(T parent, boolean removeLeaves)
      ´╗┐call this with the parent set to null to create a new phylogeny.
    • Method Summary

      Modifier and Type Method Description
      void DecPop()
      removes an individual from the genome population, should be called as part of the disposal of all agents that share this genome.
      void GetChildren​(java.util.ArrayList<T> childrenStorage)
      adds all direct descendants of the genome to the arraylist
      int GetId()
      gets the ID of the genome, which indicates the order in which it arose
      void GetLineage​(java.util.ArrayList<T> lineageStorage)
      adds all ancestors of the genome ot the arraylist
      int GetNumGenomes()
      returns the total number of genomes that have ever existed in the phylogeny
      int GetNumLivingGenomes()
      returns the number of currently active unique genomes
      int GetNumTreeGenomes()
      returns the number of genomes that exist in the phylogeny (not counting removed leaves)
      T GetParent()
      returns the parent genome that was mutated to give rise to this genome
      long GetPop()
      returns the current active population that shares this genome
      T GetRoot()
      gets the first genome that started the phylogeny
      void IncPop()
      adds an individual to the genome population, should be called as part of the initialization of all agents that share this genome.
      java.util.Iterator<T> iterator()  
      void OutputClonesToCSV​(java.lang.String path, java.lang.String[] AttrHeaders, GetGenomeAttrs<T> GetAttrs, int excludePopCutoff)  
      long PhylogenyPop()
      returns the total population of all living members of the phylogeny
      long Pop()
      returns the current population size that shares this genome
      void RecordClones​(double timepoint)  
      void RecordClones​(java.lang.String timepointLabel)  
      void ResetCloneRecord()  
      void SetPop​(long pop)
      sets the active population size for this genome to a specific value.
      void Traverse​(GenomeFn GenomeFunction)
      runs the GenomeFunction argument on every descendant of this genome
      void TraverseWithLineage​(java.util.ArrayList<T> lineageStorage, GenomeLineageFn GenomeFunction)
      runs the GenomeFunction argument on every descendant of this genome, will pass as argument the lineage from this genome to the descendant
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • Genome

        public Genome​(T parent,
                      boolean removeLeaves)
        ´╗┐call this with the parent set to null to create a new phylogeny. the removeLeaves option specifies whether the phylogeny should continue to store dead leaves (lineages with no active individuals). should also be called whenever a new clone is created, along with IncPop to add one individual to the new clone.
      • Genome

        public Genome​(T parent)
    • Method Detail

      • GetId

        public int GetId()
        gets the ID of the genome, which indicates the order in which it arose
      • GetPop

        public long GetPop()
        returns the current active population that shares this genome
      • GetParent

        public T GetParent()
        returns the parent genome that was mutated to give rise to this genome
      • SetPop

        public void SetPop​(long pop)
        sets the active population size for this genome to a specific value.
      • IncPop

        public void IncPop()
        adds an individual to the genome population, should be called as part of the initialization of all agents that share this genome.
      • DecPop

        public void DecPop()
        removes an individual from the genome population, should be called as part of the disposal of all agents that share this genome.
      • Traverse

        public void Traverse​(GenomeFn GenomeFunction)
        runs the GenomeFunction argument on every descendant of this genome
      • TraverseWithLineage

        public void TraverseWithLineage​(java.util.ArrayList<T> lineageStorage,
                                        GenomeLineageFn GenomeFunction)
        runs the GenomeFunction argument on every descendant of this genome, will pass as argument the lineage from this genome to the descendant
      • GetChildren

        public void GetChildren​(java.util.ArrayList<T> childrenStorage)
        adds all direct descendants of the genome to the arraylist
      • GetLineage

        public void GetLineage​(java.util.ArrayList<T> lineageStorage)
        adds all ancestors of the genome ot the arraylist
      • GetNumGenomes

        public int GetNumGenomes()
        returns the total number of genomes that have ever existed in the phylogeny
      • GetNumLivingGenomes

        public int GetNumLivingGenomes()
        returns the number of currently active unique genomes
      • GetNumTreeGenomes

        public int GetNumTreeGenomes()
        returns the number of genomes that exist in the phylogeny (not counting removed leaves)
      • Pop

        public long Pop()
        returns the current population size that shares this genome
      • PhylogenyPop

        public long PhylogenyPop()
        returns the total population of all living members of the phylogeny
      • GetRoot

        public T GetRoot()
        gets the first genome that started the phylogeny
      • ResetCloneRecord

        public void ResetCloneRecord()
      • RecordClones

        public void RecordClones​(double timepoint)
      • RecordClones

        public void RecordClones​(java.lang.String timepointLabel)
      • OutputClonesToCSV

        public void OutputClonesToCSV​(java.lang.String path,
                                      java.lang.String[] AttrHeaders,
                                      GetGenomeAttrs<T> GetAttrs,
                                      int excludePopCutoff)
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T extends Genome>