eaLib API Docs
Last Modified : January 7 2002

mss.ea.chr
Class ChromosomeSet

java.lang.Object
  |
  +--mss.ea.chr.ChromosomeSet
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class ChromosomeSet
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Base class for a chromosome set. A chromosome set contains all chromosomes of an individual and therefor represents the whole genetic information.

Since:
0.1
Version:
$Revision: 1.6 $ $Date: 2001/11/22 12:49:13 $
Author:
Andreas Rummler
See Also:
Serialized Form

Field Summary
protected  java.util.ArrayList set
          Vector containing all chromosomes.
 
Constructor Summary
ChromosomeSet()
          Constructor.
ChromosomeSet(Chromosome[] ca)
          Constructor with array of chromosomes.
ChromosomeSet(int setLength)
          Constructor with specified length of chromosome vector.
 
Method Summary
 void add(Chromosome c)
          Adds a chromosome to the end of the chromosome vector.
 void add(Chromosome[] ca)
          Adds an array of chromosome to the chromosome set.
 void add(Chromosome[] ca, int i)
          Adds a chromosome from an array with chromosomes to the end of the chromosome vector.
 void clear()
          Clears all chromosomes.
 void clear(int index)
          Clears a single chromosome.
 java.lang.Object clone()
          Clones the chromosome set.
 boolean equals(java.lang.Object o)
           
 Chromosome get(int i)
          Gets a chromosome.
 void remove(int index)
          Removes a single chromosome from the chromosome set, decreasing it's length by 1.
 void replace(Chromosome c, int i)
          Replaces a chromosome.
 int size()
          Gets the number of chromosomes .
 java.lang.String toString()
          Returns the representation of this chromosome set as a string.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

set

protected java.util.ArrayList set
Vector containing all chromosomes.
Constructor Detail

ChromosomeSet

public ChromosomeSet()
Constructor. This initializes the internal vector.

ChromosomeSet

public ChromosomeSet(int setLength)
Constructor with specified length of chromosome vector. This initializes the internal vector with the specified number of null chromosomes.
Parameters:
setLength - initial length of internal chromosome vector

ChromosomeSet

public ChromosomeSet(Chromosome[] ca)
Constructor with array of chromosomes. This creates a new chromosome set with the given chromsomes from the array.
Parameters:
ca - array containing chromosomes
Method Detail

add

public void add(Chromosome c)
Adds a chromosome to the end of the chromosome vector.
Parameters:
c - chromosome to be added

add

public void add(Chromosome[] ca,
                int i)
Adds a chromosome from an array with chromosomes to the end of the chromosome vector.
Parameters:
ca - array with chromosomes
i - index of chromosome in array

add

public void add(Chromosome[] ca)
Adds an array of chromosome to the chromosome set.
Parameters:
ca - array with chromosomes

get

public Chromosome get(int i)
Gets a chromosome.
Parameters:
i - index of the chromosome
Returns:
chromosome at index

replace

public void replace(Chromosome c,
                    int i)
Replaces a chromosome.
Parameters:
c - new chromosome
i - index of the chromosome to be replaced

clear

public void clear()
Clears all chromosomes. Aall chromosomes are set to null. This does not mean that the size of the chromosome set decreases.

clear

public void clear(int index)
Clears a single chromosome. This chromosome is set to null.
Parameters:
index - index of chromosome

remove

public void remove(int index)
Removes a single chromosome from the chromosome set, decreasing it's length by 1.
Parameters:
index - index of chromosome to be removed

size

public int size()
Gets the number of chromosomes .
Returns:
number of chromosomes

clone

public java.lang.Object clone()
Clones the chromosome set. This method will not clone the internal vector, instead it will create a new vector and copy all of the contents, so a real copy is returned.
Overrides:
clone in class java.lang.Object
Returns:
cloned chromosome set

toString

public java.lang.String toString()
Returns the representation of this chromosome set as a string.
Overrides:
toString in class java.lang.Object
Returns:
string representation

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

eaLib API Docs
Last Modified : January 7 2002

Copyright © 2000-2001 Technical University of Ilmenau, Department ESS