|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opt4j.core.genotype.CompositeGenotype<K,V>
K - the type of key for the mappingV - the type of Genotypepublic class CompositeGenotype<K,V extends Genotype>
The CompositeGenotype is a base class for Genotype classes
that consist of multiple Genotypes. The method
size() returns the sum of the sizes of the
contained Genotypes.
CompositeGenotype has to add each contained
Genotype by calling the method put(Object, Genotype) where
Object is an arbitrary identifier.
Example:
SpecificGenotype extends CompositeGenotype<Integer, Genotype> {
public void setDoubleVector(DoubleGenotype genotype){
put(0, genotype);
}
public DoubleGenotype getDoubleVector(){
return get(0);
}
public void setBinaryVector(BooleanGenotype genotype){
put(1, genotype);
}
public BooleanGenotype getDoubleVector(){
return get(1);
}
}
| Field Summary | |
|---|---|
protected java.util.Map<K,V> |
map
|
| Constructor Summary | |
|---|---|
CompositeGenotype()
Constructs a CompositeGenotype. |
|
CompositeGenotype(java.util.Map<K,V> map)
Constructs a CompositeGenotype with values from a given map. |
|
| Method Summary | ||
|---|---|---|
void |
clear()
Removes all key, value pairs. |
|
|
get(java.lang.Object key)
Returns the Genotype for the given key with an implicit cast to
the specific Genotype type. |
|
java.util.Iterator<java.util.Map.Entry<K,V>> |
iterator()
Returns the Iterator over the Map.Entry pairs. |
|
java.util.Set<K> |
keySet()
Returns all keys. |
|
|
newInstance()
Constructs a new (empty) instance of this Genotype. |
|
void |
put(K key,
V value)
Adds a key, value pair. |
|
int |
size()
The number of atomic elements of the Genotype. |
|
java.lang.String |
toString()
|
|
java.util.Collection<V> |
values()
Returns all values which are the contained Genotype
objects. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final java.util.Map<K,V extends Genotype> map
| Constructor Detail |
|---|
public CompositeGenotype()
CompositeGenotype.
public CompositeGenotype(java.util.Map<K,V> map)
CompositeGenotype with values from a given map.
map - initial values| Method Detail |
|---|
public int size()
GenotypeGenotype.
size in interface Genotypepublic <G> G get(java.lang.Object key)
Genotype for the given key with an implicit cast to
the specific Genotype type.
G - the type of genotypekey - the key
public void put(K key,
V value)
key, value pair.
key - the keyvalue - the value (Genotype)public void clear()
key, value pairs.
public java.util.Set<K> keySet()
keys.
keyspublic java.util.Collection<V> values()
values which are the contained Genotype
objects.
valuespublic java.util.Iterator<java.util.Map.Entry<K,V>> iterator()
Iterator over the Map.Entry pairs.
iterator in interface java.lang.Iterable<java.util.Map.Entry<K,V extends Genotype>>public <G extends Genotype> G newInstance()
GenotypeGenotype.
newInstance in interface GenotypeG - the type of genotype for an implicit cast
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||