|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jenes.chromosome.GenericAlleleSet<T>
T
- public class GenericAlleleSet<T>
A GenericAlleleSet represents a concrete allele set implementation.
It is usefull to instantiate a new AlleleSet when the allele values are contained by a list,
by an array or by a Set
.
At creation time, the aplhabet objects are not cloned so:
Note that this implementation is not synchronized. If multiple
threads access a GenericAlleleSet concurrently, and at least one of the threads modifies
the set, it must be synchronized externally or wrapped using the Collections.synchronizedSet(Set)
method.
Note that if values are modified externally, the allele set object also change according at that modification.
Some examples of code are provided below.
to build a generic allele set with the object value accesses synchronized.Set s = Collections.synchronizedSet(new HashSet(...)); GenericAlleleSet geneticAlleleSet = new GenericAlleleSet(s);
to build a generic allele set with the boolean values as allele object values.GenericAlleleSet generic alleleSet = new GenericAlleleSet(true, false),
to build a generic allele set with the enum values.GenericAlleleSet generic alleleSet = new GenericAlleleSet(AnyJavaEnum.values()) );
ObjectChromosome
Constructor Summary | |
---|---|
GenericAlleleSet(java.util.List<T> list)
Creates a new AlleleSet instance with the alphabet values contained by the specified list |
|
GenericAlleleSet(java.util.Set<T> set)
Creates a new AlleleSet instance with the alphabet values contained by the specified set |
|
GenericAlleleSet(T... values)
Creates a new AlleleSet instance with the alphabet values contained by the specified array |
Method Summary | |
---|---|
T |
getElementAt(int pos)
Returns the allele at a given positition. |
T |
getRandomValue()
Returns an allele randomly chosen. |
int |
size()
Returns the number of alleles held by the allele set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericAlleleSet(java.util.Set<T> set)
set
- the set with the alphabet allele valuespublic GenericAlleleSet(T... values)
values
- the alphabet values arraypublic GenericAlleleSet(java.util.List<T> list)
list
- the alphabet values listMethod Detail |
---|
public final T getElementAt(int pos)
getElementAt
in interface AlleleSet<T>
pos
-
public final T getRandomValue()
getRandomValue
in interface AlleleSet<T>
public final int size()
size
in interface AlleleSet<T>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |