001 /*
002 * Java Genetic Algorithm Library (jenetics-1.6.0).
003 * Copyright (c) 2007-2014 Franz Wilhelmstötter
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 *
017 * Author:
018 * Franz Wilhelmstötter (franz.wilhelmstoetter@gmx.at)
019 */
020 package org.jenetics;
021
022 /**
023 * Numeric chromosome interface.
024 *
025 * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
026 * @version 1.6 — <em>$Date: 2014-03-05 $</em>
027 * @since 1.6
028 */
029 public interface NumericChromosome<
030 N extends Number & Comparable<? super N>,
031 G extends NumericGene<N, G>
032 >
033 extends Chromosome<G>
034 {
035
036 /**
037 * Return the byte value of this {@code NumericChromosome} at the given
038 * {@code index}.
039 *
040 * @param index the index of the {@link NumericGene}.
041 * @return the byte value of the {@link Gene} with the given {@code index}.
042 * @throws IndexOutOfBoundsException if the index is out of range
043 * (index < 0 || index >= length()).
044 */
045 public byte byteValue(int index);
046
047 /**
048 * Return the byte value of this {@code NumericChromosome} at the
049 * {@code index} 0.
050 *
051 * @return the byte value of the {@link Gene} with {@code index} 0.
052 */
053 public byte byteValue();
054
055 /**
056 * Return the short value of this {@code NumericChromosome} at the given
057 * {@code index}.
058 *
059 * @param index the index of the {@link NumericGene}.
060 * @return the short value of the {@link Gene} with the given {@code index}.
061 * @throws IndexOutOfBoundsException if the index is out of range
062 * (index < 0 || index >= length()).
063 */
064 public short shortValue(int index);
065
066 /**
067 * Return the short value of this {@code NumericChromosome} at the
068 * {@code index} 0.
069 *
070 * @return the short value of the {@link Gene} with {@code index} 0.
071 */
072 public short shortValue();
073
074 /**
075 * Return the int value of this {@code NumericChromosome} at the given
076 * {@code index}.
077 *
078 * @param index the index of the {@link NumericGene}.
079 * @return the int value of the {@link Gene} with the given {@code index}.
080 * @throws IndexOutOfBoundsException if the index is out of range
081 * (index < 0 || index >= length()).
082 */
083 public int intValue(int index);
084
085 /**
086 * Return the int value of this {@code NumericChromosome} at the
087 * {@code index} 0.
088 *
089 * @return the int value of the {@link Gene} with {@code index} 0.
090 */
091 public int intValue();
092
093 /**
094 * Return the long value of this {@code NumericChromosome} at the given
095 * {@code index}.
096 *
097 * @param index the index of the {@link NumericGene}.
098 * @return the long value of the {@link Gene} with the given {@code index}.
099 * @throws IndexOutOfBoundsException if the index is out of range
100 * (index < 0 || index >= length()).
101 */
102 public long longValue(int index);
103
104 /**
105 * Return the long value of this {@code NumericChromosome} at the
106 * {@code index} 0.
107 *
108 * @return the long value of the {@link Gene} with {@code index} 0.
109 */
110 public long longValue();
111
112 /**
113 * Return the float value of this {@code NumericChromosome} at the given
114 * {@code index}.
115 *
116 * @param index the index of the {@link NumericGene}.
117 * @return the float value of the {@link Gene} with the given {@code index}.
118 * @throws IndexOutOfBoundsException if the index is out of range
119 * (index < 0 || index >= length()).
120 */
121 public float floatValue(int index);
122
123 /**
124 * Return the float value of this {@code NumericChromosome} at the
125 * {@code index} 0.
126 *
127 * @return the float value of the {@link Gene} with {@code index} 0.
128 */
129 public float floatValue();
130
131 /**
132 * Return the double value of this {@code NumericChromosome} at the given
133 * {@code index}.
134 *
135 * @param index the index of the {@link NumericGene}.
136 * @return the double value of the {@link Gene} with the given {@code index}.
137 * @throws IndexOutOfBoundsException if the index is out of range
138 * (index < 0 || index >= length()).
139 */
140 public double doubleValue(int index);
141
142 /**
143 * Return the double value of this {@code NumericChromosome} at the
144 * {@code index} 0.
145 *
146 * @return the double value of the {@link Gene} with {@code index} 0.
147 */
148 public double doubleValue();
149
150 }
|