org.opt4j.core.genotype
Class DoubleGenotype

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<java.lang.Double>
              extended by org.opt4j.core.genotype.DoubleGenotype
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.Double>, java.util.Collection<java.lang.Double>, java.util.List<java.lang.Double>, java.util.RandomAccess, Genotype, ListGenotype<java.lang.Double>
Direct Known Subclasses:
DoubleMapGenotype

public class DoubleGenotype
extends java.util.ArrayList<java.lang.Double>
implements ListGenotype<java.lang.Double>

The DoubleGenotype consists of double values that can be used as a Genotype.

See Also:
Serialized Form

Field Summary
protected  Bounds<java.lang.Double> bounds
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
DoubleGenotype()
          Constructs a DoubleGenotype with lower bounds 0.0 and upper bounds 1.0.
DoubleGenotype(Bounds<java.lang.Double> bounds)
          Constructs a DoubleGenotype with the given Bounds.
DoubleGenotype(double lowerBound, double upperBound)
          Constructs a DoubleGenotype with a specified lower and upper bound for all values.
 
Method Summary
 double getLowerBound(int index)
          Returns the lower bound for the i-th element.
 double getUpperBound(int index)
          Returns the upper bound for the i-th element.
 void init(java.util.Random random, int n)
          Initialize this genotype with n random values.
<G extends Genotype>
G
newInstance()
          Constructs a new (empty) instance of this Genotype.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opt4j.core.Genotype
size
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Field Detail

bounds

protected final Bounds<java.lang.Double> bounds
Constructor Detail

DoubleGenotype

public DoubleGenotype()
Constructs a DoubleGenotype with lower bounds 0.0 and upper bounds 1.0.


DoubleGenotype

public DoubleGenotype(double lowerBound,
                      double upperBound)
Constructs a DoubleGenotype with a specified lower and upper bound for all values.

Parameters:
lowerBound - the lower bound
upperBound - the upper bound

DoubleGenotype

public DoubleGenotype(Bounds<java.lang.Double> bounds)
Constructs a DoubleGenotype with the given Bounds.

Parameters:
bounds - the bounds
Method Detail

getLowerBound

public double getLowerBound(int index)
Returns the lower bound for the i-th element.

Parameters:
index - the i-th element
Returns:
the lower bound of the i-th element

getUpperBound

public double getUpperBound(int index)
Returns the upper bound for the i-th element.

Parameters:
index - the i-th element
Returns:
the upper bound of the i-th element

newInstance

public <G extends Genotype> G newInstance()
Description copied from interface: Genotype
Constructs a new (empty) instance of this Genotype.

Specified by:
newInstance in interface Genotype
Type Parameters:
G - the type of genotype for an implicit cast
Returns:
new instance of the genotype

init

public void init(java.util.Random random,
                 int n)
Initialize this genotype with n random values.

Parameters:
random - the random number generator
n - the number of elements in the resulting genotype