Skip to content

Commit

Permalink
#909: Rename 'ArrayConversions' to 'Conversions'.
Browse files Browse the repository at this point in the history
Signed-off-by: Franz Wilhelmstötter <franz.wilhelmstoetter@gmail.com>
  • Loading branch information
jenetics committed Sep 12, 2024
1 parent 7597d52 commit 4a96c25
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@
* This class contains methods for converting from and to the primitive arrays
* {@code int[]}, {@code long[]} and {@code double[]}. Its main usage is to
* unify numerical gene codecs, e.g.:
* {@snippet lang=java:
* {@snippet lang = java:
* final Codec<int[], DoubleGene> codec = Codecs
* .ofVector(DoubleRange.of(0, 100), 100)
* .map(ArrayConversions::doubleToIntArray);
* }
* .map(Conversions::doubleToIntArray);
*}
*
* @author <a href="mailto:franz.wilhelmstoetter@gmail.com">Franz Wilhelmstötter</a>
* @version !__version__!
* @since !__version__!
*/
public class ArrayConversions {
public class Conversions {

private ArrayConversions() {
private Conversions() {
}

/**
Expand Down Expand Up @@ -250,11 +250,11 @@ public static int[] doubleToIntArray(
/**
* Return an array mapper function which applies the given {@code mapper} to
* every array element.
* {@snippet lang=java:
* {@snippet lang = java:
* final Codec<int[], DoubleGene> codec = Codecs
* .ofVector(DoubleRange.of(0, 100), 100)
* .map(ArrayConversions.doubleToIntArray(v -> (int)Math.round(v)));
* }
* .map(Conversions.doubleToIntArray(v -> (int)Math.round(v)));
*}
*
* @param mapper the array element mapper
* @return an array mapper function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
*
* @author <a href="mailto:franz.wilhelmstoetter@gmail.com">Franz Wilhelmstötter</a>
*/
public class ArrayConversionsTest {
public class ConversionsTest {

@Test
public void intToLongArray() {
final var source = new int[100];
Arrays.fill(source, 50);

final var target = ArrayConversions.intToLongArray(source);
final var target = Conversions.intToLongArray(source);
for (int i = 0; i < source.length; ++i) {
assertThat(target[i]).isEqualTo(source[i]);
}
Expand All @@ -47,7 +47,7 @@ public void intToDoubleArray() {
final var source = new int[100];
Arrays.fill(source, 50);

final var target = ArrayConversions.intToDoubleArray(source);
final var target = Conversions.intToDoubleArray(source);
for (int i = 0; i < source.length; ++i) {
assertThat(target[i]).isEqualTo(source[i]);
}
Expand All @@ -58,7 +58,7 @@ public void longToIntArray() {
final var source = new long[100];
Arrays.fill(source, 50);

final var target = ArrayConversions.longToIntArray(source);
final var target = Conversions.longToIntArray(source);
for (int i = 0; i < source.length; ++i) {
assertThat(target[i]).isEqualTo(source[i]);
}
Expand All @@ -69,7 +69,7 @@ public void longToDoubleArray() {
final var source = new long[100];
Arrays.fill(source, 50);

final var target = ArrayConversions.longToDoubleArray(source);
final var target = Conversions.longToDoubleArray(source);
for (int i = 0; i < source.length; ++i) {
assertThat(target[i]).isEqualTo(source[i]);
}
Expand All @@ -80,7 +80,7 @@ public void doubleToIntArray() {
final var source = new double[100];
Arrays.fill(source, 50);

final var target = ArrayConversions.doubleToIntArray(source);
final var target = Conversions.doubleToIntArray(source);
for (int i = 0; i < source.length; ++i) {
assertThat(target[i]).isEqualTo((int)source[i]);
}
Expand All @@ -91,7 +91,7 @@ public void doubleToLongArray() {
final var source = new double[100];
Arrays.fill(source, 50);

final var target = ArrayConversions.doubleToLongArray(source);
final var target = Conversions.doubleToLongArray(source);
for (int i = 0; i < source.length; ++i) {
assertThat(target[i]).isEqualTo((long)source[i]);
}
Expand Down

0 comments on commit 4a96c25

Please sign in to comment.