Skip to content

Commit

Permalink
Merge pull request #79 from cicirello/refactor-first
Browse files Browse the repository at this point in the history
Configured refactor first
  • Loading branch information
cicirello authored Dec 1, 2022
2 parents bf84fff + f0f88cd commit 74aa646
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 35 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

### CI/CD
* Configured [Spotify's fmt-maven-plugin](https://github.com/spotify/fmt-maven-plugin) to format to Google Java Style during builds.
* Configured [Spotify's fmt-maven-plugin](https://github.com/spotify/fmt-maven-plugin) to format to Google Java Style during builds.
* Configured the [refactor-first-maven-plugin](https://github.com/jimbethancourt/RefactorFirst) within a profile in the pom.xml.

### Other
* Adopted [Google Java Style](https://google.github.io/styleguide/javaguide.html).
Expand Down
24 changes: 24 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,30 @@
</plugins>
</build>
</profile>
<profile>
<id>refactor</id>
<build>
<plugins>
<plugin>
<groupId>org.hjug.refactorfirst.plugin</groupId>
<artifactId>refactor-first-maven-plugin</artifactId>
<version>0.3.0</version>
<configuration>
<showDetails>true</showDetails>
</configuration>
<executions>
<execution>
<id>refactor-first</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<issueManagement>
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/org/cicirello/math/rand/ZigguratGaussian.java
Original file line number Diff line number Diff line change
Expand Up @@ -527,16 +527,16 @@ public static double nextGaussian(SplittableRandom r) {
}

/* NOTICE: The original C language version (which is Copyright (C) 2005 Jochen Voss)
* can be found below. All code and comments below are directly from
* the C language version from the GNU Scientific Library. I have simply
* placed comment markers around the C language code below.
*
* I have chosen to keep a copy of the original C code intact below as a
* reference point for the origin of my Java implementation, and so that the
* interested programmer can compare my Java version with the original C version.
*
* ORIGINAL C VERSION BEGINS BELOW THIS LINE.
*/
* can be found below. All code and comments below are directly from
* the C language version from the GNU Scientific Library. I have simply
* placed comment markers around the C language code below.
*
* I have chosen to keep a copy of the original C code intact below as a
* reference point for the origin of my Java implementation, and so that the
* interested programmer can compare my Java version with the original C version.
*
* ORIGINAL C VERSION BEGINS BELOW THIS LINE.
*/

/*
* This routine is based on the following article, with a couple of
Expand Down
20 changes: 8 additions & 12 deletions src/test/java/org/cicirello/math/rand/PolarGaussianTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ public void testRandom1() {
System.out.printf("Random, sigma=1, chi=%5.4f\n", chi);
}
assertTrue(
chi
<= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
chi <= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
}

@Test
Expand All @@ -73,9 +72,8 @@ public void testRandom10() {
System.out.printf("Random, sigma=10, chi=%5.4f\n", chi);
}
assertTrue(
chi
<= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
chi <= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
}

@Test
Expand All @@ -92,9 +90,8 @@ public void testSplittableRandom1() {
System.out.printf("SplittableRandom, sigma=1, chi=%5.4f\n", chi);
}
assertTrue(
chi
<= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
chi <= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
}

@Test
Expand All @@ -111,9 +108,8 @@ public void testSplittableRandom10() {
System.out.printf("SplittableRandom, sigma=10, chi=%5.4f\n", chi);
}
assertTrue(
chi
<= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
chi <= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
}

@Test
Expand Down
20 changes: 8 additions & 12 deletions src/test/java/org/cicirello/math/rand/ZigguratGaussianTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ public void testRandom1() {
}
double chi = chiSquare(buckets);
assertTrue(
chi
<= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
chi <= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
if (VERBOSE_OUTPUT) {
System.out.printf("Random, sigma=1, chi=%5.4f\n", chi);
}
Expand All @@ -70,9 +69,8 @@ public void testRandom10() {
}
double chi = chiSquare(buckets);
assertTrue(
chi
<= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
chi <= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
if (VERBOSE_OUTPUT) {
System.out.printf("Random, sigma=10, chi=%5.4f\n", chi);
}
Expand All @@ -89,9 +87,8 @@ public void testSplittableRandom1() {
}
double chi = chiSquare(buckets);
assertTrue(
chi
<= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
chi <= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
if (VERBOSE_OUTPUT) {
System.out.printf("SplittableRandom, sigma=1, chi=%5.4f\n", chi);
}
Expand All @@ -108,9 +105,8 @@ public void testSplittableRandom10() {
}
double chi = chiSquare(buckets);
assertTrue(
chi
<= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
chi <= 30.144); // 19 degrees of freedom, 95% percentage point of chi square distribution:
// 30.144
if (VERBOSE_OUTPUT) {
System.out.printf("SplittableRandom, sigma=10, chi=%5.4f\n", chi);
}
Expand Down

0 comments on commit 74aa646

Please sign in to comment.