SubsetPermChromosome (JEvolution)
Date: 2013-03-21

evSOLve.JEvolution.chromosomes

## Class SubsetPermChromosome

- java.lang.Object
- - evSOLve.JEvolution.chromosomes.Chromosome
  - - evSOLve.JEvolution.chromosomes.IntChromosome
    - - evSOLve.JEvolution.chromosomes.PermChromosome
      - - evSOLve.JEvolution.chromosomes.SubsetPermChromosome

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

      public class SubsetPermChromosome
      extends PermChromosome

  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class evSOLve.JEvolution.chromosomes.IntChromosome

      `bases, high, low`

    - ### Fields inherited from class evSOLve.JEvolution.chromosomes.Chromosome

      `BIASED, crossoverPoints, crossoverRate, LAPLACE, length, mutationRate, soupType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SubsetPermChromosome()` The standard constructor.
    `SubsetPermChromosome(Element c)` Creates a SubsetPermChromosome via XML.
    `SubsetPermChromosome(int length)` Constructs a chromosome of given length.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object o)` An efficient check for equality.
    `int` | `getSubSetSize()` Return subset size.
    `int` | `hashCode()` An efficient hash code.
    `void` | `setSubSetSize(int subSetSize)` Change subset size.
    `Element` | `toXml(Element parent)` Saves the current state to XML.

    - ### Methods inherited from class evSOLve.JEvolution.chromosomes.PermChromosome

      `doCrossover, doMutation, mixSoup`

    - ### Methods inherited from class evSOLve.JEvolution.chromosomes.IntChromosome

      `clone, fromString, getBases, getHigh, getLow, setHigh, setLow, toString`

    - ### Methods inherited from class evSOLve.JEvolution.chromosomes.Chromosome

      `create, getCrossoverPoints, getCrossoverRate, getLength, getMutationRate, getSoupType, setCrossoverPoints, setCrossoverRate, setLength, setMutationRate, setSoupType`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SubsetPermChromosome

          public SubsetPermChromosome()

      The standard constructor.

    - #### SubsetPermChromosome

          public SubsetPermChromosome(int length)

      Constructs a chromosome of given length.
      Parameters:
        `length` - the number of bases

    - #### SubsetPermChromosome

          public SubsetPermChromosome(Element c)

      Creates a SubsetPermChromosome via XML.
      Parameters:
        `c` - an XML Chromosome element

  - ### Method Detail

    - #### equals

          public boolean equals(java.lang.Object o)

      An efficient check for equality. It only checks the bases, first, if the number of bases is equal, and then if the smaller subset of base values are the same.
      Overrides:
        `equals` in class `IntChromosome`
      Returns:
        equal The equality of the passed object with this object.

    - #### hashCode

          public int hashCode()

      An efficient hash code. Uses List.hashCode(), but it first creates a List where only the bases of the smaller subset are copied in order to keep the number of different keys as small as possible.
      Overrides:
        `hashCode` in class `IntChromosome`
      Returns:
        hashCode A correct hash code.

    - #### getSubSetSize

          public int getSubSetSize()

      Return subset size.
      Returns:
        subSetSize The number of elements in the subset.

    - #### setSubSetSize

          public void setSubSetSize(int subSetSize)
                             throws JEvolutionException

      Change subset size.
      Parameters:
        `subSetSize` - The number of elements in the subset.
      Throws:
        `JEvolutionException` - Invalid size.

    - #### toXml

          public Element toXml(Element parent)

      Saves the current state to XML.
      Overrides:
        `toXml` in class `IntChromosome`
      Parameters:
        `parent` - the JDOM parent element
      Returns:
        the Chromosome element