Package forestry.core.genetics

Examples of forestry.core.genetics.Chromosome


  public static Chromosome[] templateAsChromosomes(IAllele[] template) {
    Chromosome[] chromosomes = new Chromosome[template.length];
    for (int i = 0; i < template.length; i++)
      if (template[i] != null)
        chromosomes[i] = new Chromosome(template[i]);

    return chromosomes;
  }
View Full Code Here


  public static Chromosome[] templateAsChromosomes(IAllele[] templateActive, IAllele[] templateInactive) {
    Chromosome[] chromosomes = new Chromosome[templateActive.length];
    for (int i = 0; i < templateActive.length; i++)
      if (templateActive[i] != null)
        chromosomes[i] = new Chromosome(templateActive[i], templateInactive[i]);

    return chromosomes;
  }
View Full Code Here

  @Override
  public float getSappiness() {
    // FIXME: Legacy handling.
    if (getChromosomes()[EnumTreeChromosome.SAPPINESS.ordinal()] == null)
      getChromosomes()[EnumTreeChromosome.SAPPINESS.ordinal()] = new Chromosome(Allele.sappinessLowest);

    IAllele allele = getActiveAllele(EnumTreeChromosome.SAPPINESS.ordinal());
    // FIXME: More legacy handling
    if (allele instanceof IAlleleFloat)
      return ((IAlleleFloat) allele).getValue();
    else {
      getChromosomes()[EnumTreeChromosome.SAPPINESS.ordinal()] = new Chromosome(Allele.sappinessLowest);
      return 0.1f;
    }
  }
View Full Code Here

  @Override
  public EnumSet<EnumPlantType> getPlantTypes() {
    // / FIXME: Needs some legacy handling.
    if (!(getActiveAllele(EnumTreeChromosome.PLANT.ordinal()) instanceof AllelePlantType))
      getChromosomes()[EnumTreeChromosome.PLANT.ordinal()] = new Chromosome(Allele.plantTypeNone);

    return ((AllelePlantType) getActiveAllele(EnumTreeChromosome.PLANT.ordinal())).getPlantTypes();
  }
View Full Code Here

  }

  @Override
  public int getMaturationTime() {
    if (getChromosomes()[EnumTreeChromosome.MATURATION.ordinal()] == null)
      getChromosomes()[EnumTreeChromosome.MATURATION.ordinal()] = new Chromosome(Allele.maturationSlowest);

    return ((IAlleleInteger) getActiveAllele(EnumTreeChromosome.MATURATION.ordinal())).getValue();
  }
View Full Code Here

TOP

Related Classes of forestry.core.genetics.Chromosome

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.