01 /*
02 * Java Genetic Algorithm Library (jenetics-1.6.0).
03 * Copyright (c) 2007-2014 Franz Wilhelmstötter
04 *
05 * Licensed under the Apache License, Version 2.0 (the "License");
06 * you may not use this file except in compliance with the License.
07 * You may obtain a copy of the License at
08 *
09 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * Author:
18 * Franz Wilhelmstötter (franz.wilhelmstoetter@gmx.at)
19 */
20 package org.jenetics;
21
22 import java.io.Serializable;
23
24 import javolution.lang.ValueType;
25
26 import org.jenetics.util.Factory;
27 import org.jenetics.util.Verifiable;
28
29 /**
30 * Genes are the atoms of the <em>Jenetics</em> library. They contain the actual
31 * information (alleles) of the encoded solution.
32 *
33 * @param <A> the <a href="http://en.wikipedia.org/wiki/Allele">Allele</a> type
34 * of this gene.
35 *
36 * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
37 * @since 1.0
38 * @version 1.6 — <em>$Date: 2014-02-23 $</em>
39 */
40 public interface Gene<A, G extends Gene<A, G>>
41 extends
42 Factory<G>,
43 Serializable,
44 ValueType,
45 Verifiable
46 {
47
48 /**
49 * Return the allele of this gene.
50 *
51 * @return the allele of this gene.
52 */
53 public A getAllele();
54
55 /**
56 * Return a new, random gene of the same type than this gene. For all genes
57 * returned by this method holds {@code gene.getClass() ==
58 * gene.newInstance().getClass()}.
59 */
60 @Override
61 public G newInstance();
62
63 // /**
64 // * Create a new gene from the given {@code value} and the gene context.
65 // *
66 // * @since 1.6
67 // * @param value the value of the new gene.
68 // * @return a new gene with the given value.
69 // */
70 // public G newInstance(final A value);
71
72 /**
73 * @deprecated This method is introduced by the {@link javolution.lang.ValueType}
74 * of the <i>Javolution</i> library, which will be removed in
75 * the next major version.
76 */
77 @Deprecated
78 @Override
79 public Object copy();
80
81 }
|