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 /**
23 * Base interface for numeric genes.
24 *
25 * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
26 * @version 1.6 — <em>$Date: 2014-03-05 $</em>
27 * @since 1.6
28 */
29 public interface NumericGene<
30 N extends Number & Comparable<? super N>,
31 G extends NumericGene<N, G>
32 >
33 extends BoundedGene<N, G>
34 {
35
36 /**
37 * Returns the value of the specified gene as an byte. This may involve
38 * rounding or truncation.
39 *
40 * @return the numeric value represented by this object after conversion to
41 * type {@code byte}.
42 */
43 public byte byteValue();
44
45 /**
46 * Returns the value of the specified gene as an short. This may involve
47 * rounding or truncation.
48 *
49 * @return the numeric value represented by this object after conversion to
50 * type {@code short}.
51 */
52 public short shortValue();
53
54 /**
55 * Returns the value of the specified gene as an int. This may involve
56 * rounding or truncation.
57 *
58 * @return the numeric value represented by this object after conversion to
59 * type {@code int}.
60 */
61 public int intValue();
62
63 /**
64 * Returns the value of the specified gene as an long. This may involve
65 * rounding or truncation.
66 *
67 * @return the numeric value represented by this object after conversion to
68 * type {@code long}.
69 */
70 public long longValue();
71
72 /**
73 * Returns the value of the specified gene as an float. This may involve
74 * rounding or truncation.
75 *
76 * @return the numeric value represented by this object after conversion to
77 * type {@code float}.
78 */
79 public float floatValue();
80
81 /**
82 * Returns the value of the specified gene as an double. This may involve
83 * rounding or truncation.
84 *
85 * @return the numeric value represented by this object after conversion to
86 * type {@code double}.
87 */
88 public double doubleValue();
89
90 @Override
91 public G newInstance(final Number number);
92
93 }
|