AbstractNumericGene.java
01 /*
02  * Java Genetic Algorithm Library (jenetics-3.5.0).
03  * Copyright (c) 2007-2016 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 /**
25  * Abstract base class for implementing concrete NumericGenes.
26  *
27  * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
28  * @version 1.6
29  * @since 1.6
30  */
31 abstract class AbstractNumericGene<
32     N extends Number & Comparable<? super N>,
33     G extends AbstractNumericGene<N, G>
34 >
35     extends AbstractBoundedGene<N, G>
36     implements NumericGene<N, G>, Serializable
37 {
38     private static final long serialVersionUID = 1L;
39 
40     /**
41      * Create new {@code NumericGene}.
42      *
43      * @param value The value of the gene.
44      * @param min The allowed min value of the gene.
45      * @param max The allows max value of the gene.
46      * @throws NullPointerException if one of the given arguments is
47      *         {@code null}.
48      */
49     protected AbstractNumericGene(final N value, final N min, final N max) {
50         super(value, min, max);
51     }
52 
53     @Override
54     public abstract G newInstance(final Number number);
55 
56 }