diff --git a/.gitattributes b/.gitattributes index 097f9f9..afd59d8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,4 +6,3 @@ # These are Windows script files and should use crlf *.bat text eol=crlf - diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index cb7db67..4f90742 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -5,7 +5,7 @@ on: - pull_request jobs: - gradle-build-and-test: + build-and-test: runs-on: ubuntu-latest steps: @@ -23,26 +23,3 @@ jobs: - name: Test run: $GITHUB_WORKSPACE/gradlew test - - ant-build-and-test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - - name: Install JUnit5 for ANT - run: $GITHUB_WORKSPACE/ci/install_ant_junit5.sh - - - name: Download Dependencies - run: ant resolve - - - name: Build - run: ant build - - - name: Test - run: ant test diff --git a/gradle.Jenkinsfile b/Jenkinsfile similarity index 98% rename from gradle.Jenkinsfile rename to Jenkinsfile index 3441c09..e5f790c 100644 --- a/gradle.Jenkinsfile +++ b/Jenkinsfile @@ -102,10 +102,6 @@ pipeline { } post { - always { - chuckNorris() - } - cleanup { cleanWs() } diff --git a/ant.Jenkinsfile b/ant.Jenkinsfile deleted file mode 100644 index 919a84f..0000000 --- a/ant.Jenkinsfile +++ /dev/null @@ -1,115 +0,0 @@ -pipeline { - agent { - label "local" - } - - parameters { - booleanParam( - name: "archive", - description: "Should artifacts be archived?", - defaultValue: false - ) - booleanParam( - name: "javadoc", - description: "Should generate Javadoc?", - defaultValue: false - ) - } - - environment { - JDK_NAME = "Open JDK" - ANT_NAME = "Ant" - ANT_OUTPUT_DIR = "antBuild" - } - - options { - skipDefaultCheckout true - timeout(time: 20, unit: "MINUTES") - buildDiscarder logRotator(numToKeepStr: "10", artifactNumToKeepStr: "5") - timestamps() - } - - stages { - stage("Preparation") { - steps { - script { - def scmEnv = checkout scm - currentBuild.displayName = "${env.BUILD_NUMBER} ${scmEnv.GIT_COMMIT.take(8)}" - } - } - } - - stage("Build") { - steps { - echo "#INFO: Building project" - withAnt(installation: "${env.ANT_NAME}", jdk: "${env.JDK_NAME}") { - sh "ant resolve jar" - } - } - } - - stage("Unit tests") { - steps { - echo "#INFO: Running unit tests" - withAnt(installation: "${env.ANT_NAME}", jdk: "${env.JDK_NAME}") { - sh "ant test" - } - } - - post { - always { - junit( - testResults: "${env.ANT_OUTPUT_DIR}/junit/result/TEST-*.xml", - healthScaleFactor: 1.0, - skipPublishingChecks: true - ) - } - } - } - - stage("Archive artifacts") { - when { - beforeAgent true - expression { - params.archive - } - } - - steps { - archiveArtifacts(artifacts: "${env.ANT_OUTPUT_DIR}/dist/*.jar", onlyIfSuccessful: true) - } - } - - stage("Javadoc") { - when { - beforeAgent true - expression { - params.javadoc - } - } - - steps { - echo "#INFO: Publish Javadoc" - withAnt(installation: "${env.ANT_NAME}", jdk: "${env.JDK_NAME}") { - sh "ant docs" - } - } - - post { - always { - javadoc(javadocDir: "${env.ANT_OUTPUT_DIR}/docs", keepAll: false) - } - } - } - } - - post { - always { - chuckNorris() - } - - cleanup { - cleanWs() - } - } -} diff --git a/build.gradle b/build.gradle index d4f8bd0..672c442 100644 --- a/build.gradle +++ b/build.gradle @@ -9,11 +9,10 @@ ext { specVersion = "${majorVersion}.${minorVersion}" jarVersion = "${majorVersion}.${minorVersion}.${dateVersion}" vendor = 'Rafał Kaleta' - mainPackage = 'algolib' + mainPackage = 'com.github.refhumbold.algolib' } version = project.jarVersion -archivesBaseName = project.mainPackage repositories { mavenCentral() diff --git a/build.xml b/build.xml deleted file mode 100644 index b24fab0..0000000 --- a/build.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ci/install_ant_junit5.sh b/ci/install_ant_junit5.sh deleted file mode 100755 index c768be7..0000000 --- a/ci/install_ant_junit5.sh +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/sh - -set -e - -echo ">>> Check ant version" -ANT=$(ant -version | sed -r 's/.*version ([0-9.]+).*/\1/g') - -if [ -f ${HOME}/.ant/lib/ant-junitlauncher-${ANT}.jar ] -then - echo ">>> File ant-junitlauncher.jar found :)" -else - LINK="https://repo1.maven.org/maven2/org/apache/ant/ant-junitlauncher/${ANT}/ant-junitlauncher-${ANT}.jar" - - rm -f ${HOME}/.ant/lib/ant-junitlauncher-*.jar - echo ">>> Download ant-junitlauncher.jar for version ${ANT}" - wget $LINK -P "${HOME}/.ant/lib" -fi diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d64cd49..1b33c55 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a80b22c..d4081da 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4..23d15a9 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -112,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -203,7 +205,7 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. @@ -211,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 25da30d..db3a6ac 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -68,11 +70,11 @@ goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/ivy.xml b/ivy.xml deleted file mode 100644 index 188ca18..0000000 --- a/ivy.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/settings.gradle b/settings.gradle index e9994f2..d3a994b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -rootProject.name = 'AlgoLib_Java' +rootProject.name = 'AlgoLib' diff --git a/src/main/java/algolib/geometry/GeometryObject.java b/src/main/java/com/github/refhumbold/algolib/geometry/GeometryObject.java similarity index 86% rename from src/main/java/algolib/geometry/GeometryObject.java rename to src/main/java/com/github/refhumbold/algolib/geometry/GeometryObject.java index eec97db..244cb5e 100644 --- a/src/main/java/algolib/geometry/GeometryObject.java +++ b/src/main/java/com/github/refhumbold/algolib/geometry/GeometryObject.java @@ -1,4 +1,4 @@ -package algolib.geometry; +package com.github.refhumbold.algolib.geometry; public abstract class GeometryObject { diff --git a/src/main/java/algolib/geometry/dim2/ClosestPoints.java b/src/main/java/com/github/refhumbold/algolib/geometry/dim2/ClosestPoints.java similarity index 82% rename from src/main/java/algolib/geometry/dim2/ClosestPoints.java rename to src/main/java/com/github/refhumbold/algolib/geometry/dim2/ClosestPoints.java index 738638e..d2aed65 100644 --- a/src/main/java/algolib/geometry/dim2/ClosestPoints.java +++ b/src/main/java/com/github/refhumbold/algolib/geometry/dim2/ClosestPoints.java @@ -1,12 +1,11 @@ -package algolib.geometry.dim2; +package com.github.refhumbold.algolib.geometry.dim2; import java.util.ArrayList; import java.util.List; import java.util.NoSuchElementException; import java.util.Objects; import java.util.Optional; - -import algolib.tuples.Pair; +import com.github.refhumbold.algolib.tuples.Pair; /** Algorithm for searching pair of closest points in 2D. */ public final class ClosestPoints @@ -35,8 +34,9 @@ public static Pair findClosestPoints(List points) } // Searches for closest points among three of them. - private static Pair searchThree( - Point2D point1, Point2D point2, Point2D point3) + private static Pair searchThree(Point2D point1, + Point2D point2, + Point2D point3) { double distance12 = Geometry2D.distance(point1, point2); double distance23 = Geometry2D.distance(point2, point3); @@ -53,8 +53,9 @@ private static Pair searchThree( // Searches for closest points inside a belt of given width. // The resulting distance should not be less than belt width. - private static Optional> checkBelt( - List pointsY, double middleX, double beltWidth) + private static Optional> checkBelt(List pointsY, + double middleX, + double beltWidth) { Optional> closestPoints = Optional.empty(); List beltPoints = new ArrayList<>(); @@ -90,15 +91,17 @@ private static Optional> checkBelt( // Searches for closest points in given sublist of points. // Points are given sorted by X coordinate and by Y coordinate. - private static Pair searchClosest( - List pointsX, List pointsY, int indexBegin, int indexEnd) + private static Pair searchClosest(List pointsX, + List pointsY, + int indexBegin, + int indexEnd) { if(indexEnd - indexBegin <= 2) return Pair.of(pointsX.get(indexBegin), pointsX.get(indexEnd - 1)); if(indexEnd - indexBegin == 3) return searchThree(pointsX.get(indexBegin), pointsX.get(indexBegin + 1), - pointsX.get(indexBegin + 2)); + pointsX.get(indexBegin + 2)); int indexMiddle = (indexBegin + indexEnd) / 2; List closetsYL = new ArrayList<>(); @@ -106,7 +109,7 @@ private static Pair searchClosest( for(Point2D pt : pointsY) if(pt.x < pointsX.get(indexMiddle).x - || pt.x == pointsX.get(indexMiddle).x && pt.y < pointsX.get(indexMiddle).y) + || pt.x == pointsX.get(indexMiddle).x && pt.y < pointsX.get(indexMiddle).y) closetsYL.add(pt); else closetsYR.add(pt); @@ -118,9 +121,7 @@ private static Pair searchClosest( Geometry2D.distance(closestL.first, closestL.second) <= Geometry2D.distance( closestR.first, closestR.second) ? closestL : closestR; Optional> beltPoints = checkBelt(pointsY, pointsX.get(indexMiddle).x, - Geometry2D.distance( - closestPoints.first, - closestPoints.second)); + Geometry2D.distance(closestPoints.first, closestPoints.second)); return beltPoints.orElse(closestPoints); } diff --git a/src/main/java/algolib/geometry/dim2/ConvexHull.java b/src/main/java/com/github/refhumbold/algolib/geometry/dim2/ConvexHull.java similarity index 96% rename from src/main/java/algolib/geometry/dim2/ConvexHull.java rename to src/main/java/com/github/refhumbold/algolib/geometry/dim2/ConvexHull.java index 8b44a49..1f10c1e 100644 --- a/src/main/java/algolib/geometry/dim2/ConvexHull.java +++ b/src/main/java/com/github/refhumbold/algolib/geometry/dim2/ConvexHull.java @@ -1,4 +1,4 @@ -package algolib.geometry.dim2; +package com.github.refhumbold.algolib.geometry.dim2; import java.util.ArrayList; import java.util.Comparator; diff --git a/src/main/java/algolib/geometry/dim2/Geometry2D.java b/src/main/java/com/github/refhumbold/algolib/geometry/dim2/Geometry2D.java similarity index 97% rename from src/main/java/algolib/geometry/dim2/Geometry2D.java rename to src/main/java/com/github/refhumbold/algolib/geometry/dim2/Geometry2D.java index 520eeb8..ead515e 100644 --- a/src/main/java/algolib/geometry/dim2/Geometry2D.java +++ b/src/main/java/com/github/refhumbold/algolib/geometry/dim2/Geometry2D.java @@ -1,4 +1,4 @@ -package algolib.geometry.dim2; +package com.github.refhumbold.algolib.geometry.dim2; import java.util.List; diff --git a/src/main/java/algolib/geometry/dim2/Point2D.java b/src/main/java/com/github/refhumbold/algolib/geometry/dim2/Point2D.java similarity index 88% rename from src/main/java/algolib/geometry/dim2/Point2D.java rename to src/main/java/com/github/refhumbold/algolib/geometry/dim2/Point2D.java index 62c53da..7791f89 100644 --- a/src/main/java/algolib/geometry/dim2/Point2D.java +++ b/src/main/java/com/github/refhumbold/algolib/geometry/dim2/Point2D.java @@ -1,8 +1,7 @@ -package algolib.geometry.dim2; +package com.github.refhumbold.algolib.geometry.dim2; import java.util.Objects; - -import algolib.geometry.GeometryObject; +import com.github.refhumbold.algolib.geometry.GeometryObject; /** Structure of point in 2D. */ public final class Point2D @@ -21,7 +20,7 @@ private Point2D(double x, double y) @Override public double[] getCoordinates() { - return new double[]{x, y}; + return new double[]{ x, y }; } public static Point2D of(double x, double y) diff --git a/src/main/java/algolib/geometry/dim2/Vector2D.java b/src/main/java/com/github/refhumbold/algolib/geometry/dim2/Vector2D.java similarity index 92% rename from src/main/java/algolib/geometry/dim2/Vector2D.java rename to src/main/java/com/github/refhumbold/algolib/geometry/dim2/Vector2D.java index 4ebac4d..af4be8d 100644 --- a/src/main/java/algolib/geometry/dim2/Vector2D.java +++ b/src/main/java/com/github/refhumbold/algolib/geometry/dim2/Vector2D.java @@ -1,8 +1,7 @@ -package algolib.geometry.dim2; +package com.github.refhumbold.algolib.geometry.dim2; import java.util.Objects; - -import algolib.geometry.GeometryObject; +import com.github.refhumbold.algolib.geometry.GeometryObject; /** Structure of vector in 2D. */ public final class Vector2D @@ -21,7 +20,7 @@ private Vector2D(double x, double y) @Override public double[] getCoordinates() { - return new double[]{x, y}; + return new double[]{ x, y }; } public static Vector2D of(double x, double y) diff --git a/src/main/java/algolib/geometry/dim3/Geometry3D.java b/src/main/java/com/github/refhumbold/algolib/geometry/dim3/Geometry3D.java similarity index 97% rename from src/main/java/algolib/geometry/dim3/Geometry3D.java rename to src/main/java/com/github/refhumbold/algolib/geometry/dim3/Geometry3D.java index 60bfccf..9992e9a 100644 --- a/src/main/java/algolib/geometry/dim3/Geometry3D.java +++ b/src/main/java/com/github/refhumbold/algolib/geometry/dim3/Geometry3D.java @@ -1,4 +1,4 @@ -package algolib.geometry.dim3; +package com.github.refhumbold.algolib.geometry.dim3; import java.util.List; diff --git a/src/main/java/algolib/geometry/dim3/Point3D.java b/src/main/java/com/github/refhumbold/algolib/geometry/dim3/Point3D.java similarity index 87% rename from src/main/java/algolib/geometry/dim3/Point3D.java rename to src/main/java/com/github/refhumbold/algolib/geometry/dim3/Point3D.java index 93eb981..13f7950 100644 --- a/src/main/java/algolib/geometry/dim3/Point3D.java +++ b/src/main/java/com/github/refhumbold/algolib/geometry/dim3/Point3D.java @@ -1,8 +1,7 @@ -package algolib.geometry.dim3; +package com.github.refhumbold.algolib.geometry.dim3; import java.util.Objects; - -import algolib.geometry.GeometryObject; +import com.github.refhumbold.algolib.geometry.GeometryObject; /** Structure of point in 3D. */ public final class Point3D @@ -23,7 +22,7 @@ private Point3D(double x, double y, double z) @Override public double[] getCoordinates() { - return new double[]{x, y, z}; + return new double[]{ x, y, z }; } public static Point3D of(double x, double y, double z) diff --git a/src/main/java/algolib/geometry/dim3/Vector3D.java b/src/main/java/com/github/refhumbold/algolib/geometry/dim3/Vector3D.java similarity index 92% rename from src/main/java/algolib/geometry/dim3/Vector3D.java rename to src/main/java/com/github/refhumbold/algolib/geometry/dim3/Vector3D.java index 720d69b..c60a69d 100644 --- a/src/main/java/algolib/geometry/dim3/Vector3D.java +++ b/src/main/java/com/github/refhumbold/algolib/geometry/dim3/Vector3D.java @@ -1,8 +1,7 @@ -package algolib.geometry.dim3; +package com.github.refhumbold.algolib.geometry.dim3; import java.util.Objects; - -import algolib.geometry.GeometryObject; +import com.github.refhumbold.algolib.geometry.GeometryObject; /** Structure of vector in 3D. */ public final class Vector3D @@ -23,7 +22,7 @@ private Vector3D(double x, double y, double z) @Override public double[] getCoordinates() { - return new double[]{x, y, z}; + return new double[]{ x, y, z }; } public static Vector3D of(double x, double y, double z) @@ -44,7 +43,7 @@ public static double dot(Vector3D v1, Vector3D v2) public static Vector3D cross(Vector3D v1, Vector3D v2) { return Vector3D.of(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, - v1.x * v2.y - v1.y * v2.x); + v1.x * v2.y - v1.y * v2.x); } public static double area(Vector3D v1, Vector3D v2) diff --git a/src/main/java/algolib/graphs/DirectedGraph.java b/src/main/java/com/github/refhumbold/algolib/graphs/DirectedGraph.java similarity index 90% rename from src/main/java/algolib/graphs/DirectedGraph.java rename to src/main/java/com/github/refhumbold/algolib/graphs/DirectedGraph.java index 337a267..6a98396 100644 --- a/src/main/java/algolib/graphs/DirectedGraph.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/DirectedGraph.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; /** Structure of directed graph. */ public interface DirectedGraph diff --git a/src/main/java/algolib/graphs/DirectedSimpleGraph.java b/src/main/java/com/github/refhumbold/algolib/graphs/DirectedSimpleGraph.java similarity index 98% rename from src/main/java/algolib/graphs/DirectedSimpleGraph.java rename to src/main/java/com/github/refhumbold/algolib/graphs/DirectedSimpleGraph.java index b1ee025..d38fc66 100644 --- a/src/main/java/algolib/graphs/DirectedSimpleGraph.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/DirectedSimpleGraph.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.util.Collection; import java.util.Set; diff --git a/src/main/java/algolib/graphs/Edge.java b/src/main/java/com/github/refhumbold/algolib/graphs/Edge.java similarity index 97% rename from src/main/java/algolib/graphs/Edge.java rename to src/main/java/com/github/refhumbold/algolib/graphs/Edge.java index c4643dc..7e05a5d 100644 --- a/src/main/java/algolib/graphs/Edge.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/Edge.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.util.Objects; diff --git a/src/main/java/algolib/graphs/Graph.java b/src/main/java/com/github/refhumbold/algolib/graphs/Graph.java similarity index 98% rename from src/main/java/algolib/graphs/Graph.java rename to src/main/java/com/github/refhumbold/algolib/graphs/Graph.java index a3a47f2..833d0d1 100644 --- a/src/main/java/algolib/graphs/Graph.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/Graph.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.util.Collection; diff --git a/src/main/java/algolib/graphs/GraphPartitionException.java b/src/main/java/com/github/refhumbold/algolib/graphs/GraphPartitionException.java similarity index 84% rename from src/main/java/algolib/graphs/GraphPartitionException.java rename to src/main/java/com/github/refhumbold/algolib/graphs/GraphPartitionException.java index 39e9dfc..2830889 100644 --- a/src/main/java/algolib/graphs/GraphPartitionException.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/GraphPartitionException.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.io.Serial; diff --git a/src/main/java/algolib/graphs/GraphRepresentation.java b/src/main/java/com/github/refhumbold/algolib/graphs/GraphRepresentation.java similarity index 98% rename from src/main/java/algolib/graphs/GraphRepresentation.java rename to src/main/java/com/github/refhumbold/algolib/graphs/GraphRepresentation.java index 4957a0b..42fda70 100644 --- a/src/main/java/algolib/graphs/GraphRepresentation.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/GraphRepresentation.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.util.Collection; import java.util.HashMap; diff --git a/src/main/java/algolib/graphs/MultipartiteGraph.java b/src/main/java/com/github/refhumbold/algolib/graphs/MultipartiteGraph.java similarity index 99% rename from src/main/java/algolib/graphs/MultipartiteGraph.java rename to src/main/java/com/github/refhumbold/algolib/graphs/MultipartiteGraph.java index 43efd35..efc4281 100644 --- a/src/main/java/algolib/graphs/MultipartiteGraph.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/MultipartiteGraph.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.util.Collection; import java.util.HashMap; diff --git a/src/main/java/algolib/graphs/SimpleGraph.java b/src/main/java/com/github/refhumbold/algolib/graphs/SimpleGraph.java similarity index 99% rename from src/main/java/algolib/graphs/SimpleGraph.java rename to src/main/java/com/github/refhumbold/algolib/graphs/SimpleGraph.java index 0531287..373c366 100644 --- a/src/main/java/algolib/graphs/SimpleGraph.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/SimpleGraph.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.util.Collection; import java.util.stream.Collectors; diff --git a/src/main/java/algolib/graphs/TreeGraph.java b/src/main/java/com/github/refhumbold/algolib/graphs/TreeGraph.java similarity index 98% rename from src/main/java/algolib/graphs/TreeGraph.java rename to src/main/java/com/github/refhumbold/algolib/graphs/TreeGraph.java index af41909..67c7de9 100644 --- a/src/main/java/algolib/graphs/TreeGraph.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/TreeGraph.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.util.Collection; import java.util.Collections; diff --git a/src/main/java/algolib/graphs/UndirectedGraph.java b/src/main/java/com/github/refhumbold/algolib/graphs/UndirectedGraph.java similarity index 89% rename from src/main/java/algolib/graphs/UndirectedGraph.java rename to src/main/java/com/github/refhumbold/algolib/graphs/UndirectedGraph.java index b506e40..3cb9404 100644 --- a/src/main/java/algolib/graphs/UndirectedGraph.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/UndirectedGraph.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; /** Structure of undirected graph. */ public interface UndirectedGraph diff --git a/src/main/java/algolib/graphs/UndirectedSimpleGraph.java b/src/main/java/com/github/refhumbold/algolib/graphs/UndirectedSimpleGraph.java similarity index 98% rename from src/main/java/algolib/graphs/UndirectedSimpleGraph.java rename to src/main/java/com/github/refhumbold/algolib/graphs/UndirectedSimpleGraph.java index fc85e0e..f566397 100644 --- a/src/main/java/algolib/graphs/UndirectedSimpleGraph.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/UndirectedSimpleGraph.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.util.Collection; import java.util.stream.Collectors; diff --git a/src/main/java/algolib/graphs/Vertex.java b/src/main/java/com/github/refhumbold/algolib/graphs/Vertex.java similarity index 92% rename from src/main/java/algolib/graphs/Vertex.java rename to src/main/java/com/github/refhumbold/algolib/graphs/Vertex.java index a791295..5285b13 100644 --- a/src/main/java/algolib/graphs/Vertex.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/Vertex.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.util.Objects; diff --git a/src/main/java/algolib/graphs/algorithms/Cutting.java b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/Cutting.java similarity index 93% rename from src/main/java/algolib/graphs/algorithms/Cutting.java rename to src/main/java/com/github/refhumbold/algolib/graphs/algorithms/Cutting.java index 6ad6c16..8c3f401 100644 --- a/src/main/java/algolib/graphs/algorithms/Cutting.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/Cutting.java @@ -1,4 +1,4 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.ArrayList; import java.util.Collection; @@ -6,11 +6,10 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; - -import algolib.graphs.Edge; -import algolib.graphs.UndirectedGraph; -import algolib.graphs.Vertex; -import algolib.graphs.algorithms.strategy.DfsStrategy; +import com.github.refhumbold.algolib.graphs.Edge; +import com.github.refhumbold.algolib.graphs.UndirectedGraph; +import com.github.refhumbold.algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.algorithms.strategy.DfsStrategy; /** Algorithms for graph cutting (edge cut and vertex cut). */ public final class Cutting diff --git a/src/main/java/algolib/graphs/algorithms/DirectedCyclicGraphException.java b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/DirectedCyclicGraphException.java similarity index 82% rename from src/main/java/algolib/graphs/algorithms/DirectedCyclicGraphException.java rename to src/main/java/com/github/refhumbold/algolib/graphs/algorithms/DirectedCyclicGraphException.java index f567244..7e0e104 100644 --- a/src/main/java/algolib/graphs/algorithms/DirectedCyclicGraphException.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/DirectedCyclicGraphException.java @@ -1,4 +1,4 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.io.Serial; diff --git a/src/main/java/algolib/graphs/algorithms/LowestCommonAncestor.java b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/LowestCommonAncestor.java similarity index 87% rename from src/main/java/algolib/graphs/algorithms/LowestCommonAncestor.java rename to src/main/java/com/github/refhumbold/algolib/graphs/algorithms/LowestCommonAncestor.java index 3aeba94..e8d951b 100644 --- a/src/main/java/algolib/graphs/algorithms/LowestCommonAncestor.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/LowestCommonAncestor.java @@ -1,14 +1,13 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; - -import algolib.graphs.TreeGraph; -import algolib.graphs.Vertex; -import algolib.graphs.algorithms.strategy.DfsStrategy; +import com.github.refhumbold.algolib.graphs.TreeGraph; +import com.github.refhumbold.algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.algorithms.strategy.DfsStrategy; /** Algorithm for lowest common ancestors in a rooted tree. */ public final class LowestCommonAncestor @@ -19,8 +18,8 @@ public final class LowestCommonAncestor private final LcaStrategy strategy = new LcaStrategy<>(); private boolean empty = true; - public LowestCommonAncestor( - TreeGraph graph, Vertex root) + public LowestCommonAncestor(TreeGraph graph, + Vertex root) { this.graph = graph; this.root = root; @@ -54,7 +53,7 @@ private Vertex find(Vertex vertex1, Vertex vertex2 Vertex nextVertex = candidates.stream() .filter(candidate -> !isOffspring(vertex2, - candidate)) + candidate)) .findFirst() .orElse(paths.get(vertex1).get(0)); @@ -78,7 +77,7 @@ private void initialize() private boolean isOffspring(Vertex vertex1, Vertex vertex2) { return strategy.preTimes.get(vertex1) >= strategy.preTimes.get(vertex2) - && strategy.postTimes.get(vertex1) <= strategy.postTimes.get(vertex2); + && strategy.postTimes.get(vertex1) <= strategy.postTimes.get(vertex2); } private static class LcaStrategy diff --git a/src/main/java/algolib/graphs/algorithms/Matching.java b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/Matching.java similarity index 92% rename from src/main/java/algolib/graphs/algorithms/Matching.java rename to src/main/java/com/github/refhumbold/algolib/graphs/algorithms/Matching.java index 86c47b6..e548203 100644 --- a/src/main/java/algolib/graphs/algorithms/Matching.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/Matching.java @@ -1,11 +1,10 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; - -import algolib.graphs.MultipartiteGraph; -import algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.MultipartiteGraph; +import com.github.refhumbold.algolib.graphs.Vertex; /** Hopcroft-Karp algorithm for matching in a bipartite graph. */ public final class Matching @@ -15,8 +14,7 @@ public final class Matching * @param graph the bipartite graph * @return the map of matched vertices */ - public static Map, - Vertex> match( + public static Map, Vertex> match( MultipartiteGraph graph) { MatchAugmenter augmenter = @@ -93,8 +91,7 @@ private void bfs(Map, Double> distances) } } - private boolean dfs( - Vertex vertex, + private boolean dfs(Vertex vertex, Set> visited, Map, Double> distances) { @@ -112,7 +109,7 @@ private boolean dfs( } if(!visited.contains(matched) && distances.get(matched) == distances.get(vertex) + 1 - && dfs(matched, visited, distances)) + && dfs(matched, visited, distances)) { matching.put(vertex, neighbour); matching.put(neighbour, vertex); diff --git a/src/main/java/algolib/graphs/algorithms/MinimalSpanningTree.java b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/MinimalSpanningTree.java similarity index 85% rename from src/main/java/algolib/graphs/algorithms/MinimalSpanningTree.java rename to src/main/java/com/github/refhumbold/algolib/graphs/algorithms/MinimalSpanningTree.java index dc8b27b..4d41e6d 100644 --- a/src/main/java/algolib/graphs/algorithms/MinimalSpanningTree.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/MinimalSpanningTree.java @@ -1,4 +1,4 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.Comparator; import java.util.HashSet; @@ -6,14 +6,13 @@ import java.util.PriorityQueue; import java.util.Set; import java.util.stream.Collectors; - -import algolib.graphs.Edge; -import algolib.graphs.UndirectedGraph; -import algolib.graphs.UndirectedSimpleGraph; -import algolib.graphs.Vertex; -import algolib.graphs.properties.Weighted; -import algolib.structures.DisjointSets; -import algolib.tuples.Pair; +import com.github.refhumbold.algolib.graphs.Edge; +import com.github.refhumbold.algolib.graphs.UndirectedGraph; +import com.github.refhumbold.algolib.graphs.UndirectedSimpleGraph; +import com.github.refhumbold.algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.properties.Weighted; +import com.github.refhumbold.algolib.structures.DisjointSets; +import com.github.refhumbold.algolib.tuples.Pair; /** Algorithms for minimal spanning tree. */ public final class MinimalSpanningTree @@ -56,7 +55,8 @@ public static Undirect * @return the minimal spanning tree */ public static UndirectedGraph prim( - UndirectedGraph graph, Vertex source) + UndirectedGraph graph, + Vertex source) { UndirectedSimpleGraph mst = new UndirectedSimpleGraph<>( @@ -64,9 +64,7 @@ public static Undirect Set> visited = new HashSet<>(); PriorityQueue, Vertex>> queue = new PriorityQueue<>( (pair1, pair2) -> Double.compare(graph.getProperties().get(pair1.first).getWeight(), - graph.getProperties() - .get(pair2.first) - .getWeight())); + graph.getProperties().get(pair2.first).getWeight())); visited.add(source); diff --git a/src/main/java/algolib/graphs/algorithms/Searching.java b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/Searching.java similarity index 92% rename from src/main/java/algolib/graphs/algorithms/Searching.java rename to src/main/java/com/github/refhumbold/algolib/graphs/algorithms/Searching.java index 35203bc..58fee6a 100644 --- a/src/main/java/algolib/graphs/algorithms/Searching.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/Searching.java @@ -1,11 +1,10 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.*; - -import algolib.graphs.Graph; -import algolib.graphs.Vertex; -import algolib.graphs.algorithms.strategy.BfsStrategy; -import algolib.graphs.algorithms.strategy.DfsStrategy; +import com.github.refhumbold.algolib.graphs.Graph; +import com.github.refhumbold.algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.algorithms.strategy.BfsStrategy; +import com.github.refhumbold.algolib.graphs.algorithms.strategy.DfsStrategy; /** Algorithms for graph searching. */ public final class Searching @@ -17,8 +16,7 @@ public final class Searching * @param roots the starting vertices * @return the visited vertices */ - public static Collection> bfs( - Graph graph, + public static Collection> bfs(Graph graph, BfsStrategy strategy, Collection> roots) { @@ -131,8 +129,7 @@ public static Collection void dfsRecursiveStep( - Graph graph, + private static void dfsRecursiveStep(Graph graph, DfsStrategy strategy, DfsRecursiveState state) { diff --git a/src/main/java/algolib/graphs/algorithms/ShortestPaths.java b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/ShortestPaths.java similarity index 78% rename from src/main/java/algolib/graphs/algorithms/ShortestPaths.java rename to src/main/java/com/github/refhumbold/algolib/graphs/algorithms/ShortestPaths.java index 18472e5..eb8a59a 100644 --- a/src/main/java/algolib/graphs/algorithms/ShortestPaths.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/ShortestPaths.java @@ -1,4 +1,4 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.HashMap; import java.util.HashSet; @@ -7,13 +7,12 @@ import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; - -import algolib.graphs.DirectedGraph; -import algolib.graphs.Edge; -import algolib.graphs.Graph; -import algolib.graphs.Vertex; -import algolib.graphs.properties.Weighted; -import algolib.tuples.Pair; +import com.github.refhumbold.algolib.graphs.DirectedGraph; +import com.github.refhumbold.algolib.graphs.Edge; +import com.github.refhumbold.algolib.graphs.Graph; +import com.github.refhumbold.algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.properties.Weighted; +import com.github.refhumbold.algolib.tuples.Pair; /** Algorithms for shortest paths in a weighted graph. */ public final class ShortestPaths @@ -26,16 +25,16 @@ public final class ShortestPaths * @return the map of distances to each vertex * @throws IllegalStateException if the graph contains a negative cycle */ - public static Map, - Double> bellmanFord( - DirectedGraph graph, Vertex source) + public static Map, Double> bellmanFord( + DirectedGraph graph, + Vertex source) throws IllegalStateException { Map, Double> distances = graph.getVertices() .stream() .collect( Collectors.toMap(Function.identity(), - v -> Weighted.INFINITY)); + v -> Weighted.INFINITY)); distances.put(source, 0.0); @@ -43,16 +42,13 @@ Double> bellmanFord( for(Vertex vertex : graph.getVertices()) for(Edge edge : graph.getAdjacentEdges(vertex)) distances.put(edge.destination, Math.min(distances.get(edge.destination), - distances.get(vertex) - + graph.getProperties() - .get(edge) - .getWeight())); + distances.get(vertex) + graph.getProperties().get(edge).getWeight())); for(Vertex vertex : graph.getVertices()) for(Edge edge : graph.getAdjacentEdges(vertex)) if(distances.get(vertex) < Weighted.INFINITY - && distances.get(vertex) + graph.getProperties().get(edge).getWeight() - < distances.get(edge.destination)) + && distances.get(vertex) + graph.getProperties().get(edge).getWeight() + < distances.get(edge.destination)) throw new IllegalStateException("Graph contains a negative cycle."); return distances; @@ -65,9 +61,9 @@ Double> bellmanFord( * @return the map of distances to each vertex. * @throws IllegalStateException if the graph contains an edge with negative weight */ - public static Map, - Double> dijkstra( - Graph graph, Vertex source) + public static Map, Double> dijkstra( + Graph graph, + Vertex source) throws IllegalStateException { for(Edge edge : graph.getEdges()) @@ -78,7 +74,7 @@ Double> dijkstra( .stream() .collect( Collectors.toMap(Function.identity(), - v -> Weighted.INFINITY)); + v -> Weighted.INFINITY)); Set> visited = new HashSet<>(); PriorityQueue>> vertexQueue = new PriorityQueue<>((pair1, pair2) -> Double.compare(pair1.first, pair2.first)); @@ -128,14 +124,13 @@ public static Map e : graph.getEdges()) distances.put(Pair.of(e.source, e.destination), - graph.getProperties().get(e).getWeight()); + graph.getProperties().get(e).getWeight()); for(Vertex w : graph.getVertices()) for(Vertex v : graph.getVertices()) for(Vertex u : graph.getVertices()) distances.put(Pair.of(v, u), Math.min(distances.get(Pair.of(v, u)), - distances.get(Pair.of(v, w)) - + distances.get(Pair.of(w, u)))); + distances.get(Pair.of(v, w)) + distances.get(Pair.of(w, u)))); return distances; } diff --git a/src/main/java/algolib/graphs/algorithms/StronglyConnectedComponents.java b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/StronglyConnectedComponents.java similarity index 93% rename from src/main/java/algolib/graphs/algorithms/StronglyConnectedComponents.java rename to src/main/java/com/github/refhumbold/algolib/graphs/algorithms/StronglyConnectedComponents.java index 72e384a..ad04c61 100644 --- a/src/main/java/algolib/graphs/algorithms/StronglyConnectedComponents.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/StronglyConnectedComponents.java @@ -1,11 +1,10 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.*; import java.util.stream.Collectors; - -import algolib.graphs.DirectedGraph; -import algolib.graphs.Vertex; -import algolib.graphs.algorithms.strategy.DfsStrategy; +import com.github.refhumbold.algolib.graphs.DirectedGraph; +import com.github.refhumbold.algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.algorithms.strategy.DfsStrategy; /** Algorithm for strongly connected components. */ public final class StronglyConnectedComponents diff --git a/src/main/java/algolib/graphs/algorithms/TopologicalSorting.java b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/TopologicalSorting.java similarity index 94% rename from src/main/java/algolib/graphs/algorithms/TopologicalSorting.java rename to src/main/java/com/github/refhumbold/algolib/graphs/algorithms/TopologicalSorting.java index 0de0442..3e96077 100644 --- a/src/main/java/algolib/graphs/algorithms/TopologicalSorting.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/TopologicalSorting.java @@ -1,10 +1,9 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.*; - -import algolib.graphs.DirectedGraph; -import algolib.graphs.Vertex; -import algolib.graphs.algorithms.strategy.DfsStrategy; +import com.github.refhumbold.algolib.graphs.DirectedGraph; +import com.github.refhumbold.algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.algorithms.strategy.DfsStrategy; /** Algorithms for topological sorting of a directed acyclic graph. */ public final class TopologicalSorting diff --git a/src/main/java/algolib/graphs/algorithms/TreeDiameter.java b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/TreeDiameter.java similarity index 84% rename from src/main/java/algolib/graphs/algorithms/TreeDiameter.java rename to src/main/java/com/github/refhumbold/algolib/graphs/algorithms/TreeDiameter.java index 5c9c6b3..ae4161b 100644 --- a/src/main/java/algolib/graphs/algorithms/TreeDiameter.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/TreeDiameter.java @@ -1,10 +1,10 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; -import algolib.graphs.Edge; -import algolib.graphs.TreeGraph; -import algolib.graphs.Vertex; -import algolib.graphs.properties.Weighted; -import algolib.tuples.Pair; +import com.github.refhumbold.algolib.graphs.Edge; +import com.github.refhumbold.algolib.graphs.TreeGraph; +import com.github.refhumbold.algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.properties.Weighted; +import com.github.refhumbold.algolib.tuples.Pair; /** Algorithm for computing diameter of a tree. */ public final class TreeDiameter diff --git a/src/main/java/algolib/graphs/algorithms/strategy/BfsStrategy.java b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/strategy/BfsStrategy.java similarity index 67% rename from src/main/java/algolib/graphs/algorithms/strategy/BfsStrategy.java rename to src/main/java/com/github/refhumbold/algolib/graphs/algorithms/strategy/BfsStrategy.java index 1c3948a..016066a 100644 --- a/src/main/java/algolib/graphs/algorithms/strategy/BfsStrategy.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/strategy/BfsStrategy.java @@ -1,6 +1,6 @@ -package algolib.graphs.algorithms.strategy; +package com.github.refhumbold.algolib.graphs.algorithms.strategy; -import algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.Vertex; public interface BfsStrategy { diff --git a/src/main/java/algolib/graphs/algorithms/strategy/DfsStrategy.java b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/strategy/DfsStrategy.java similarity index 57% rename from src/main/java/algolib/graphs/algorithms/strategy/DfsStrategy.java rename to src/main/java/com/github/refhumbold/algolib/graphs/algorithms/strategy/DfsStrategy.java index 94d31bb..3163da4 100644 --- a/src/main/java/algolib/graphs/algorithms/strategy/DfsStrategy.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/strategy/DfsStrategy.java @@ -1,6 +1,6 @@ -package algolib.graphs.algorithms.strategy; +package com.github.refhumbold.algolib.graphs.algorithms.strategy; -import algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.Vertex; public interface DfsStrategy extends BfsStrategy diff --git a/src/main/java/algolib/graphs/algorithms/strategy/EmptyStrategy.java b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/strategy/EmptyStrategy.java similarity index 81% rename from src/main/java/algolib/graphs/algorithms/strategy/EmptyStrategy.java rename to src/main/java/com/github/refhumbold/algolib/graphs/algorithms/strategy/EmptyStrategy.java index 9243334..f9279cd 100644 --- a/src/main/java/algolib/graphs/algorithms/strategy/EmptyStrategy.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/algorithms/strategy/EmptyStrategy.java @@ -1,6 +1,6 @@ -package algolib.graphs.algorithms.strategy; +package com.github.refhumbold.algolib.graphs.algorithms.strategy; -import algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.Vertex; public class EmptyStrategy implements DfsStrategy diff --git a/src/main/java/algolib/graphs/properties/Weighted.java b/src/main/java/com/github/refhumbold/algolib/graphs/properties/Weighted.java similarity index 64% rename from src/main/java/algolib/graphs/properties/Weighted.java rename to src/main/java/com/github/refhumbold/algolib/graphs/properties/Weighted.java index 448f77a..896e771 100644 --- a/src/main/java/algolib/graphs/properties/Weighted.java +++ b/src/main/java/com/github/refhumbold/algolib/graphs/properties/Weighted.java @@ -1,4 +1,4 @@ -package algolib.graphs.properties; +package com.github.refhumbold.algolib.graphs.properties; public interface Weighted { diff --git a/src/main/java/algolib/maths/Equation.java b/src/main/java/com/github/refhumbold/algolib/maths/Equation.java similarity index 99% rename from src/main/java/algolib/maths/Equation.java rename to src/main/java/com/github/refhumbold/algolib/maths/Equation.java index 119f943..d41d0cf 100644 --- a/src/main/java/algolib/maths/Equation.java +++ b/src/main/java/com/github/refhumbold/algolib/maths/Equation.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; diff --git a/src/main/java/algolib/maths/EquationSystem.java b/src/main/java/com/github/refhumbold/algolib/maths/EquationSystem.java similarity index 99% rename from src/main/java/algolib/maths/EquationSystem.java rename to src/main/java/com/github/refhumbold/algolib/maths/EquationSystem.java index 22e5ef9..e3fb052 100644 --- a/src/main/java/algolib/maths/EquationSystem.java +++ b/src/main/java/com/github/refhumbold/algolib/maths/EquationSystem.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; import java.util.Arrays; import java.util.stream.Collectors; diff --git a/src/main/java/algolib/maths/Fraction.java b/src/main/java/com/github/refhumbold/algolib/maths/Fraction.java similarity index 99% rename from src/main/java/algolib/maths/Fraction.java rename to src/main/java/com/github/refhumbold/algolib/maths/Fraction.java index 111b3c2..6979c6c 100644 --- a/src/main/java/algolib/maths/Fraction.java +++ b/src/main/java/com/github/refhumbold/algolib/maths/Fraction.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; import java.io.Serial; import java.util.Objects; diff --git a/src/main/java/algolib/maths/InfiniteSolutionsException.java b/src/main/java/com/github/refhumbold/algolib/maths/InfiniteSolutionsException.java similarity index 84% rename from src/main/java/algolib/maths/InfiniteSolutionsException.java rename to src/main/java/com/github/refhumbold/algolib/maths/InfiniteSolutionsException.java index 9ea32d7..f578a62 100644 --- a/src/main/java/algolib/maths/InfiniteSolutionsException.java +++ b/src/main/java/com/github/refhumbold/algolib/maths/InfiniteSolutionsException.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; import java.io.Serial; diff --git a/src/main/java/algolib/maths/Integers.java b/src/main/java/com/github/refhumbold/algolib/maths/Integers.java similarity index 99% rename from src/main/java/algolib/maths/Integers.java rename to src/main/java/com/github/refhumbold/algolib/maths/Integers.java index fcd08a9..a68a5d3 100644 --- a/src/main/java/algolib/maths/Integers.java +++ b/src/main/java/com/github/refhumbold/algolib/maths/Integers.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; /** Algorithms for basic computations on integers. */ public final class Integers diff --git a/src/main/java/algolib/maths/NoSolutionException.java b/src/main/java/com/github/refhumbold/algolib/maths/NoSolutionException.java similarity index 83% rename from src/main/java/algolib/maths/NoSolutionException.java rename to src/main/java/com/github/refhumbold/algolib/maths/NoSolutionException.java index 1fb10bc..b1a0daf 100644 --- a/src/main/java/algolib/maths/NoSolutionException.java +++ b/src/main/java/com/github/refhumbold/algolib/maths/NoSolutionException.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; import java.io.Serial; diff --git a/src/main/java/algolib/maths/PrimesSearching.java b/src/main/java/com/github/refhumbold/algolib/maths/PrimesSearching.java similarity index 98% rename from src/main/java/algolib/maths/PrimesSearching.java rename to src/main/java/com/github/refhumbold/algolib/maths/PrimesSearching.java index a32b884..017fd14 100644 --- a/src/main/java/algolib/maths/PrimesSearching.java +++ b/src/main/java/com/github/refhumbold/algolib/maths/PrimesSearching.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/algolib/maths/PrimesTesting.java b/src/main/java/com/github/refhumbold/algolib/maths/PrimesTesting.java similarity index 98% rename from src/main/java/algolib/maths/PrimesTesting.java rename to src/main/java/com/github/refhumbold/algolib/maths/PrimesTesting.java index e14d47f..622de23 100644 --- a/src/main/java/algolib/maths/PrimesTesting.java +++ b/src/main/java/com/github/refhumbold/algolib/maths/PrimesTesting.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; import java.util.Random; import java.util.stream.IntStream; diff --git a/src/main/java/algolib/sequences/LongestCommonSubsequence.java b/src/main/java/com/github/refhumbold/algolib/sequences/LongestCommonSubsequence.java similarity index 97% rename from src/main/java/algolib/sequences/LongestCommonSubsequence.java rename to src/main/java/com/github/refhumbold/algolib/sequences/LongestCommonSubsequence.java index 9837827..b5d2113 100644 --- a/src/main/java/algolib/sequences/LongestCommonSubsequence.java +++ b/src/main/java/com/github/refhumbold/algolib/sequences/LongestCommonSubsequence.java @@ -1,4 +1,4 @@ -package algolib.sequences; +package com.github.refhumbold.algolib.sequences; import java.util.List; import java.util.stream.IntStream; diff --git a/src/main/java/algolib/sequences/LongestIncreasingSubsequence.java b/src/main/java/com/github/refhumbold/algolib/sequences/LongestIncreasingSubsequence.java similarity index 98% rename from src/main/java/algolib/sequences/LongestIncreasingSubsequence.java rename to src/main/java/com/github/refhumbold/algolib/sequences/LongestIncreasingSubsequence.java index 1b3a744..5df5662 100644 --- a/src/main/java/algolib/sequences/LongestIncreasingSubsequence.java +++ b/src/main/java/com/github/refhumbold/algolib/sequences/LongestIncreasingSubsequence.java @@ -1,4 +1,4 @@ -package algolib.sequences; +package com.github.refhumbold.algolib.sequences; import java.util.*; import java.util.stream.Collectors; diff --git a/src/main/java/algolib/sequences/MaximumSubarray.java b/src/main/java/com/github/refhumbold/algolib/sequences/MaximumSubarray.java similarity index 88% rename from src/main/java/algolib/sequences/MaximumSubarray.java rename to src/main/java/com/github/refhumbold/algolib/sequences/MaximumSubarray.java index 93a9157..85e2b08 100644 --- a/src/main/java/algolib/sequences/MaximumSubarray.java +++ b/src/main/java/com/github/refhumbold/algolib/sequences/MaximumSubarray.java @@ -1,11 +1,10 @@ -package algolib.sequences; +package com.github.refhumbold.algolib.sequences; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; - -import algolib.tuples.Pair; +import com.github.refhumbold.algolib.tuples.Pair; /** Algorithms for maximum subarray. */ public final class MaximumSubarray @@ -74,11 +73,9 @@ public static double countMaximalSubsum(Collection sequence) Math.max(intervalSums.get(indexRight), intervalSums.get(indexLeft)), suffixSums.get(indexRight) + prefixSums.get(indexLeft))); prefixSums.set(index, Math.max(prefixSums.get(indexRight), - allSums.get(indexRight) + prefixSums.get( - indexLeft))); + allSums.get(indexRight) + prefixSums.get(indexLeft))); suffixSums.set(index, Math.max(suffixSums.get(indexLeft), - suffixSums.get(indexRight) + allSums.get( - indexLeft))); + suffixSums.get(indexRight) + allSums.get(indexLeft))); allSums.set(index, allSums.get(indexRight) + allSums.get(indexLeft)); index /= 2; } diff --git a/src/main/java/algolib/sequences/Sorting.java b/src/main/java/com/github/refhumbold/algolib/sequences/Sorting.java similarity index 99% rename from src/main/java/algolib/sequences/Sorting.java rename to src/main/java/com/github/refhumbold/algolib/sequences/Sorting.java index 6f1eee7..d1c4cd4 100644 --- a/src/main/java/algolib/sequences/Sorting.java +++ b/src/main/java/com/github/refhumbold/algolib/sequences/Sorting.java @@ -1,4 +1,4 @@ -package algolib.sequences; +package com.github.refhumbold.algolib.sequences; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/algolib/structures/AvlTree.java b/src/main/java/com/github/refhumbold/algolib/structures/AvlTree.java similarity index 99% rename from src/main/java/algolib/structures/AvlTree.java rename to src/main/java/com/github/refhumbold/algolib/structures/AvlTree.java index daf648d..87502a9 100644 --- a/src/main/java/algolib/structures/AvlTree.java +++ b/src/main/java/com/github/refhumbold/algolib/structures/AvlTree.java @@ -1,4 +1,4 @@ -package algolib.structures; +package com.github.refhumbold.algolib.structures; import java.util.*; import java.util.function.BiFunction; diff --git a/src/main/java/algolib/structures/DisjointSets.java b/src/main/java/com/github/refhumbold/algolib/structures/DisjointSets.java similarity index 99% rename from src/main/java/algolib/structures/DisjointSets.java rename to src/main/java/com/github/refhumbold/algolib/structures/DisjointSets.java index 7db47f7..734ccfe 100644 --- a/src/main/java/algolib/structures/DisjointSets.java +++ b/src/main/java/com/github/refhumbold/algolib/structures/DisjointSets.java @@ -1,4 +1,4 @@ -package algolib.structures; +package com.github.refhumbold.algolib.structures; import java.util.*; import java.util.function.Function; diff --git a/src/main/java/algolib/structures/heaps/AbstractHeap.java b/src/main/java/com/github/refhumbold/algolib/structures/heaps/AbstractHeap.java similarity index 97% rename from src/main/java/algolib/structures/heaps/AbstractHeap.java rename to src/main/java/com/github/refhumbold/algolib/structures/heaps/AbstractHeap.java index d7091fe..ef19c03 100644 --- a/src/main/java/algolib/structures/heaps/AbstractHeap.java +++ b/src/main/java/com/github/refhumbold/algolib/structures/heaps/AbstractHeap.java @@ -1,4 +1,4 @@ -package algolib.structures.heaps; +package com.github.refhumbold.algolib.structures.heaps; import java.util.AbstractQueue; import java.util.Comparator; diff --git a/src/main/java/algolib/structures/heaps/DoubleHeap.java b/src/main/java/com/github/refhumbold/algolib/structures/heaps/DoubleHeap.java similarity index 99% rename from src/main/java/algolib/structures/heaps/DoubleHeap.java rename to src/main/java/com/github/refhumbold/algolib/structures/heaps/DoubleHeap.java index 87f54b1..137cb23 100644 --- a/src/main/java/algolib/structures/heaps/DoubleHeap.java +++ b/src/main/java/com/github/refhumbold/algolib/structures/heaps/DoubleHeap.java @@ -1,4 +1,4 @@ -package algolib.structures.heaps; +package com.github.refhumbold.algolib.structures.heaps; import java.util.*; diff --git a/src/main/java/algolib/structures/heaps/LeftistHeap.java b/src/main/java/com/github/refhumbold/algolib/structures/heaps/LeftistHeap.java similarity index 98% rename from src/main/java/algolib/structures/heaps/LeftistHeap.java rename to src/main/java/com/github/refhumbold/algolib/structures/heaps/LeftistHeap.java index a797e27..7cc2075 100644 --- a/src/main/java/algolib/structures/heaps/LeftistHeap.java +++ b/src/main/java/com/github/refhumbold/algolib/structures/heaps/LeftistHeap.java @@ -1,4 +1,4 @@ -package algolib.structures.heaps; +package com.github.refhumbold.algolib.structures.heaps; import java.util.ArrayDeque; import java.util.Collection; diff --git a/src/main/java/algolib/structures/heaps/PairingHeap.java b/src/main/java/com/github/refhumbold/algolib/structures/heaps/PairingHeap.java similarity index 98% rename from src/main/java/algolib/structures/heaps/PairingHeap.java rename to src/main/java/com/github/refhumbold/algolib/structures/heaps/PairingHeap.java index acba0a2..5586fca 100644 --- a/src/main/java/algolib/structures/heaps/PairingHeap.java +++ b/src/main/java/com/github/refhumbold/algolib/structures/heaps/PairingHeap.java @@ -1,4 +1,4 @@ -package algolib.structures.heaps; +package com.github.refhumbold.algolib.structures.heaps; import java.util.*; diff --git a/src/main/java/algolib/text/BaseWordsMap.java b/src/main/java/com/github/refhumbold/algolib/text/BaseWordsMap.java similarity index 85% rename from src/main/java/algolib/text/BaseWordsMap.java rename to src/main/java/com/github/refhumbold/algolib/text/BaseWordsMap.java index c25ce38..68380bb 100644 --- a/src/main/java/algolib/text/BaseWordsMap.java +++ b/src/main/java/com/github/refhumbold/algolib/text/BaseWordsMap.java @@ -1,4 +1,4 @@ -package algolib.text; +package com.github.refhumbold.algolib.text; import java.util.Comparator; import java.util.HashMap; @@ -7,9 +7,8 @@ import java.util.Objects; import java.util.function.BiFunction; import java.util.stream.IntStream; - -import algolib.tuples.ComparablePair; -import algolib.tuples.Pair; +import com.github.refhumbold.algolib.tuples.ComparablePair; +import com.github.refhumbold.algolib.tuples.Pair; /** Structure of base words map using Karp-Miller-Rosenberg algorithm. */ public final class BaseWordsMap @@ -85,21 +84,19 @@ public Pair getCode(int startIndex, int endIndex) int n = getMaxLength(endIndex - startIndex); return Pair.of(factors.get(Pair.of(startIndex, startIndex + n)), - factors.get(Pair.of(endIndex - n, endIndex))); + factors.get(Pair.of(endIndex - n, endIndex))); } // Builds base words map using Karp-Miller-Rosenberg algorithm. private void create() { - int codeValue = extend(1, 0, (i, length) -> new int[]{text.charAt(i), 1 + text.charAt(i), i, - i + length}); + int codeValue = extend(1, 0, + (i, length) -> new int[]{ text.charAt(i), 1 + text.charAt(i), i, i + length }); for(int currentLength = 2; currentLength <= text.length(); currentLength *= 2) codeValue = extend(currentLength, codeValue, - (i, length) -> new int[]{factors.get(Pair.of(i, i + length / 2)), - factors.get(Pair.of(i + length / 2, - i + length)), i, - i + length}); + (i, length) -> new int[]{ factors.get(Pair.of(i, i + length / 2)), + factors.get(Pair.of(i + length / 2, i + length)), i, i + length }); } // Encodes substring of given length using already counted factors. diff --git a/src/main/java/algolib/text/EditDistance.java b/src/main/java/com/github/refhumbold/algolib/text/EditDistance.java similarity index 99% rename from src/main/java/algolib/text/EditDistance.java rename to src/main/java/com/github/refhumbold/algolib/text/EditDistance.java index 5793ed4..2b517d1 100644 --- a/src/main/java/algolib/text/EditDistance.java +++ b/src/main/java/com/github/refhumbold/algolib/text/EditDistance.java @@ -1,4 +1,4 @@ -package algolib.text; +package com.github.refhumbold.algolib.text; import java.util.stream.IntStream; diff --git a/src/main/java/algolib/text/KnuthMorrisPratt.java b/src/main/java/com/github/refhumbold/algolib/text/KnuthMorrisPratt.java similarity index 97% rename from src/main/java/algolib/text/KnuthMorrisPratt.java rename to src/main/java/com/github/refhumbold/algolib/text/KnuthMorrisPratt.java index 4e31d0c..4270c4f 100644 --- a/src/main/java/algolib/text/KnuthMorrisPratt.java +++ b/src/main/java/com/github/refhumbold/algolib/text/KnuthMorrisPratt.java @@ -1,4 +1,4 @@ -package algolib.text; +package com.github.refhumbold.algolib.text; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/algolib/text/SuffixArray.java b/src/main/java/com/github/refhumbold/algolib/text/SuffixArray.java similarity index 99% rename from src/main/java/algolib/text/SuffixArray.java rename to src/main/java/com/github/refhumbold/algolib/text/SuffixArray.java index 546fea9..ecfe48a 100644 --- a/src/main/java/algolib/text/SuffixArray.java +++ b/src/main/java/com/github/refhumbold/algolib/text/SuffixArray.java @@ -1,4 +1,4 @@ -package algolib.text; +package com.github.refhumbold.algolib.text; import java.util.*; import java.util.stream.Collectors; diff --git a/src/main/java/algolib/text/Trie.java b/src/main/java/com/github/refhumbold/algolib/text/Trie.java similarity index 98% rename from src/main/java/algolib/text/Trie.java rename to src/main/java/com/github/refhumbold/algolib/text/Trie.java index fa103a1..b14470d 100644 --- a/src/main/java/algolib/text/Trie.java +++ b/src/main/java/com/github/refhumbold/algolib/text/Trie.java @@ -1,4 +1,4 @@ -package algolib.text; +package com.github.refhumbold.algolib.text; import java.util.Collection; import java.util.HashMap; diff --git a/src/main/java/algolib/tuples/ComparablePair.java b/src/main/java/com/github/refhumbold/algolib/tuples/ComparablePair.java similarity index 96% rename from src/main/java/algolib/tuples/ComparablePair.java rename to src/main/java/com/github/refhumbold/algolib/tuples/ComparablePair.java index 89de9a9..58c25d6 100644 --- a/src/main/java/algolib/tuples/ComparablePair.java +++ b/src/main/java/com/github/refhumbold/algolib/tuples/ComparablePair.java @@ -1,4 +1,4 @@ -package algolib.tuples; +package com.github.refhumbold.algolib.tuples; import java.util.Comparator; import java.util.Objects; diff --git a/src/main/java/algolib/tuples/ComparableTriple.java b/src/main/java/com/github/refhumbold/algolib/tuples/ComparableTriple.java similarity index 97% rename from src/main/java/algolib/tuples/ComparableTriple.java rename to src/main/java/com/github/refhumbold/algolib/tuples/ComparableTriple.java index 9c7aab4..8bcc043 100644 --- a/src/main/java/algolib/tuples/ComparableTriple.java +++ b/src/main/java/com/github/refhumbold/algolib/tuples/ComparableTriple.java @@ -1,4 +1,4 @@ -package algolib.tuples; +package com.github.refhumbold.algolib.tuples; import java.util.Comparator; import java.util.Objects; diff --git a/src/main/java/algolib/tuples/Pair.java b/src/main/java/com/github/refhumbold/algolib/tuples/Pair.java similarity index 95% rename from src/main/java/algolib/tuples/Pair.java rename to src/main/java/com/github/refhumbold/algolib/tuples/Pair.java index 727837b..a64b4c8 100644 --- a/src/main/java/algolib/tuples/Pair.java +++ b/src/main/java/com/github/refhumbold/algolib/tuples/Pair.java @@ -1,4 +1,4 @@ -package algolib.tuples; +package com.github.refhumbold.algolib.tuples; import java.util.Objects; diff --git a/src/main/java/algolib/tuples/Triple.java b/src/main/java/com/github/refhumbold/algolib/tuples/Triple.java similarity index 95% rename from src/main/java/algolib/tuples/Triple.java rename to src/main/java/com/github/refhumbold/algolib/tuples/Triple.java index c2c4433..ee6b4e0 100644 --- a/src/main/java/algolib/tuples/Triple.java +++ b/src/main/java/com/github/refhumbold/algolib/tuples/Triple.java @@ -1,4 +1,4 @@ -package algolib.tuples; +package com.github.refhumbold.algolib.tuples; import java.util.Objects; diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..b58089c --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,15 @@ +module algolib { + exports com.github.refhumbold.algolib.geometry; + exports com.github.refhumbold.algolib.geometry.dim2; + exports com.github.refhumbold.algolib.geometry.dim3; + exports com.github.refhumbold.algolib.graphs; + exports com.github.refhumbold.algolib.graphs.algorithms; + exports com.github.refhumbold.algolib.graphs.algorithms.strategy; + exports com.github.refhumbold.algolib.graphs.properties; + exports com.github.refhumbold.algolib.maths; + exports com.github.refhumbold.algolib.sequences; + exports com.github.refhumbold.algolib.structures; + exports com.github.refhumbold.algolib.structures.heaps; + exports com.github.refhumbold.algolib.text; + exports com.github.refhumbold.algolib.tuples; +} diff --git a/src/test/java/algolib/geometry/dim2/ClosestPointsTest.java b/src/test/java/com/github/refhumbold/algolib/geometry/dim2/ClosestPointsTest.java similarity index 96% rename from src/test/java/algolib/geometry/dim2/ClosestPointsTest.java rename to src/test/java/com/github/refhumbold/algolib/geometry/dim2/ClosestPointsTest.java index 97000a6..523c27a 100644 --- a/src/test/java/algolib/geometry/dim2/ClosestPointsTest.java +++ b/src/test/java/com/github/refhumbold/algolib/geometry/dim2/ClosestPointsTest.java @@ -1,11 +1,10 @@ -package algolib.geometry.dim2; +package com.github.refhumbold.algolib.geometry.dim2; import java.util.List; import java.util.NoSuchElementException; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; - -import algolib.tuples.Pair; +import com.github.refhumbold.algolib.tuples.Pair; // Tests: Algorithm for pair of closest points in 2D. public class ClosestPointsTest diff --git a/src/test/java/algolib/geometry/dim2/ConvexHullTest.java b/src/test/java/com/github/refhumbold/algolib/geometry/dim2/ConvexHullTest.java similarity index 92% rename from src/test/java/algolib/geometry/dim2/ConvexHullTest.java rename to src/test/java/com/github/refhumbold/algolib/geometry/dim2/ConvexHullTest.java index 133d02d..e170d35 100644 --- a/src/test/java/algolib/geometry/dim2/ConvexHullTest.java +++ b/src/test/java/com/github/refhumbold/algolib/geometry/dim2/ConvexHullTest.java @@ -1,4 +1,4 @@ -package algolib.geometry.dim2; +package com.github.refhumbold.algolib.geometry.dim2; import java.util.List; import org.assertj.core.api.Assertions; @@ -56,8 +56,8 @@ public void findConvexHull_ThenPointsInHull() // then Assertions.assertThat(result) .containsExactly(Point2D.of(-1, -8), Point2D.of(3, -6), Point2D.of(6, -4), - Point2D.of(10, 2), Point2D.of(5, 9), Point2D.of(-5, 10), - Point2D.of(-7, 7), Point2D.of(-8, -7)); + Point2D.of(10, 2), Point2D.of(5, 9), Point2D.of(-5, 10), + Point2D.of(-7, 7), Point2D.of(-8, -7)); } @Test diff --git a/src/test/java/algolib/geometry/dim2/Geometry2DTest.java b/src/test/java/com/github/refhumbold/algolib/geometry/dim2/Geometry2DTest.java similarity index 70% rename from src/test/java/algolib/geometry/dim2/Geometry2DTest.java rename to src/test/java/com/github/refhumbold/algolib/geometry/dim2/Geometry2DTest.java index eaac301..e367062 100644 --- a/src/test/java/algolib/geometry/dim2/Geometry2DTest.java +++ b/src/test/java/com/github/refhumbold/algolib/geometry/dim2/Geometry2DTest.java @@ -1,4 +1,4 @@ -package algolib.geometry.dim2; +package com.github.refhumbold.algolib.geometry.dim2; import java.util.Arrays; import java.util.List; @@ -14,8 +14,8 @@ public void sortByX_ThenSortedStablyAscending() // given List sequence = Arrays.asList(Point2D.of(0.0, 0.0), Point2D.of(-2.0, -3.0), Point2D.of(-3.0, 2.0), - Point2D.of(2.0, 3.0), Point2D.of(3.0, -2.0), Point2D.of(-2.0, 3.0), - Point2D.of(3.0, 2.0), Point2D.of(2.0, -3.0), Point2D.of(-3.0, -2.0)); + Point2D.of(2.0, 3.0), Point2D.of(3.0, -2.0), Point2D.of(-2.0, 3.0), + Point2D.of(3.0, 2.0), Point2D.of(2.0, -3.0), Point2D.of(-3.0, -2.0)); // when Geometry2D.sortByX(sequence); @@ -23,10 +23,9 @@ public void sortByX_ThenSortedStablyAscending() // then Assertions.assertThat(sequence) .containsExactly(Point2D.of(-3.0, 2.0), Point2D.of(-3.0, -2.0), - Point2D.of(-2.0, -3.0), Point2D.of(-2.0, 3.0), - Point2D.of(0.0, 0.0), Point2D.of(2.0, 3.0), - Point2D.of(2.0, -3.0), Point2D.of(3.0, -2.0), - Point2D.of(3.0, 2.0)); + Point2D.of(-2.0, -3.0), Point2D.of(-2.0, 3.0), Point2D.of(0.0, 0.0), + Point2D.of(2.0, 3.0), Point2D.of(2.0, -3.0), Point2D.of(3.0, -2.0), + Point2D.of(3.0, 2.0)); } @Test @@ -35,8 +34,8 @@ public void sortByY_ThenSortedStablyAscending() // given List sequence = Arrays.asList(Point2D.of(0.0, 0.0), Point2D.of(-2.0, -3.0), Point2D.of(-3.0, 2.0), - Point2D.of(2.0, 3.0), Point2D.of(3.0, -2.0), Point2D.of(-2.0, 3.0), - Point2D.of(3.0, 2.0), Point2D.of(2.0, -3.0), Point2D.of(-3.0, -2.0)); + Point2D.of(2.0, 3.0), Point2D.of(3.0, -2.0), Point2D.of(-2.0, 3.0), + Point2D.of(3.0, 2.0), Point2D.of(2.0, -3.0), Point2D.of(-3.0, -2.0)); // when Geometry2D.sortByY(sequence); @@ -44,10 +43,9 @@ public void sortByY_ThenSortedStablyAscending() // then Assertions.assertThat(sequence) .containsExactly(Point2D.of(-2.0, -3.0), Point2D.of(2.0, -3.0), - Point2D.of(3.0, -2.0), Point2D.of(-3.0, -2.0), - Point2D.of(0.0, 0.0), Point2D.of(-3.0, 2.0), - Point2D.of(3.0, 2.0), Point2D.of(2.0, 3.0), - Point2D.of(-2.0, 3.0)); + Point2D.of(3.0, -2.0), Point2D.of(-3.0, -2.0), Point2D.of(0.0, 0.0), + Point2D.of(-3.0, 2.0), Point2D.of(3.0, 2.0), Point2D.of(2.0, 3.0), + Point2D.of(-2.0, 3.0)); } @Test @@ -56,8 +54,8 @@ public void sortByAngle_ThenSortedAscending() // given List sequence = Arrays.asList(Point2D.of(0.0, 0.0), Point2D.of(-2.0, -3.0), Point2D.of(-3.0, 2.0), - Point2D.of(2.0, 3.0), Point2D.of(3.0, -2.0), Point2D.of(-2.0, 3.0), - Point2D.of(3.0, 2.0), Point2D.of(2.0, -3.0), Point2D.of(-3.0, -2.0)); + Point2D.of(2.0, 3.0), Point2D.of(3.0, -2.0), Point2D.of(-2.0, 3.0), + Point2D.of(3.0, 2.0), Point2D.of(2.0, -3.0), Point2D.of(-3.0, -2.0)); // when Geometry2D.sortByAngle(sequence); @@ -65,9 +63,8 @@ public void sortByAngle_ThenSortedAscending() // then Assertions.assertThat(sequence) .containsExactly(Point2D.of(0.0, 0.0), Point2D.of(3.0, 2.0), Point2D.of(2.0, 3.0), - Point2D.of(-2.0, 3.0), Point2D.of(-3.0, 2.0), - Point2D.of(-3.0, -2.0), Point2D.of(-2.0, -3.0), - Point2D.of(2.0, -3.0), Point2D.of(3.0, -2.0)); + Point2D.of(-2.0, 3.0), Point2D.of(-3.0, 2.0), Point2D.of(-3.0, -2.0), + Point2D.of(-2.0, -3.0), Point2D.of(2.0, -3.0), Point2D.of(3.0, -2.0)); } @Test @@ -76,7 +73,7 @@ public void sortByAngle_WhenEqualAngles_ThenCompareRadius() // given List sequence = Arrays.asList(Point2D.of(0.0, 0.0), Point2D.of(1.0, 1.0), Point2D.of(-2.0, -2.0), - Point2D.of(-3.0, -3.0), Point2D.of(4.0, 4.0)); + Point2D.of(-3.0, -3.0), Point2D.of(4.0, 4.0)); // when Geometry2D.sortByAngle(sequence); @@ -84,7 +81,7 @@ public void sortByAngle_WhenEqualAngles_ThenCompareRadius() // then Assertions.assertThat(sequence) .containsExactly(Point2D.of(0.0, 0.0), Point2D.of(1.0, 1.0), Point2D.of(4.0, 4.0), - Point2D.of(-2.0, -2.0), Point2D.of(-3.0, -3.0)); + Point2D.of(-2.0, -2.0), Point2D.of(-3.0, -3.0)); } @Test diff --git a/src/test/java/algolib/geometry/dim2/Vector2DTest.java b/src/test/java/com/github/refhumbold/algolib/geometry/dim2/Vector2DTest.java similarity index 96% rename from src/test/java/algolib/geometry/dim2/Vector2DTest.java rename to src/test/java/com/github/refhumbold/algolib/geometry/dim2/Vector2DTest.java index abb2814..e4e194f 100644 --- a/src/test/java/algolib/geometry/dim2/Vector2DTest.java +++ b/src/test/java/com/github/refhumbold/algolib/geometry/dim2/Vector2DTest.java @@ -1,10 +1,9 @@ -package algolib.geometry.dim2; +package com.github.refhumbold.algolib.geometry.dim2; import org.assertj.core.api.Assertions; import org.assertj.core.data.Offset; import org.junit.jupiter.api.Test; - -import algolib.geometry.GeometryObject; +import com.github.refhumbold.algolib.geometry.GeometryObject; // Tests: Structure of vector in 2D. public class Vector2DTest diff --git a/src/test/java/algolib/geometry/dim3/Geometry3DTest.java b/src/test/java/com/github/refhumbold/algolib/geometry/dim3/Geometry3DTest.java similarity index 70% rename from src/test/java/algolib/geometry/dim3/Geometry3DTest.java rename to src/test/java/com/github/refhumbold/algolib/geometry/dim3/Geometry3DTest.java index e696d57..717a9e9 100644 --- a/src/test/java/algolib/geometry/dim3/Geometry3DTest.java +++ b/src/test/java/com/github/refhumbold/algolib/geometry/dim3/Geometry3DTest.java @@ -1,4 +1,4 @@ -package algolib.geometry.dim3; +package com.github.refhumbold.algolib.geometry.dim3; import java.util.Arrays; import java.util.List; @@ -14,17 +14,17 @@ public void sortByX_ThenSortedStablyAscending() // given List sequence = Arrays.asList(Point3D.of(0.0, 0.0, 0.0), Point3D.of(2.0, 3.0, -5.0), - Point3D.of(-2.0, -3.0, 5.0), Point3D.of(2.0, -3.0, -5.0), - Point3D.of(-2.0, -3.0, -5.0), Point3D.of(3.0, 2.0, 5.0), - Point3D.of(-3.0, 2.0, 5.0)); + Point3D.of(-2.0, -3.0, 5.0), Point3D.of(2.0, -3.0, -5.0), + Point3D.of(-2.0, -3.0, -5.0), Point3D.of(3.0, 2.0, 5.0), + Point3D.of(-3.0, 2.0, 5.0)); // when Geometry3D.sortByX(sequence); // then Assertions.assertThat(sequence) .containsExactly(Point3D.of(-3.0, 2.0, 5.0), Point3D.of(-2.0, -3.0, 5.0), - Point3D.of(-2.0, -3.0, -5.0), Point3D.of(0.0, 0.0, 0.0), - Point3D.of(2.0, 3.0, -5.0), Point3D.of(2.0, -3.0, -5.0), - Point3D.of(3.0, 2.0, 5.0)); + Point3D.of(-2.0, -3.0, -5.0), Point3D.of(0.0, 0.0, 0.0), + Point3D.of(2.0, 3.0, -5.0), Point3D.of(2.0, -3.0, -5.0), + Point3D.of(3.0, 2.0, 5.0)); } @Test @@ -33,17 +33,17 @@ public void sortByY_ThenSortedStablyAscending() // given List sequence = Arrays.asList(Point3D.of(0.0, 0.0, 0.0), Point3D.of(2.0, 3.0, -5.0), - Point3D.of(-2.0, -3.0, 5.0), Point3D.of(2.0, -3.0, -5.0), - Point3D.of(-2.0, -3.0, -5.0), Point3D.of(3.0, 2.0, 5.0), - Point3D.of(-3.0, 2.0, 5.0)); + Point3D.of(-2.0, -3.0, 5.0), Point3D.of(2.0, -3.0, -5.0), + Point3D.of(-2.0, -3.0, -5.0), Point3D.of(3.0, 2.0, 5.0), + Point3D.of(-3.0, 2.0, 5.0)); // when Geometry3D.sortByY(sequence); // then Assertions.assertThat(sequence) .containsExactly(Point3D.of(-2.0, -3.0, 5.0), Point3D.of(2.0, -3.0, -5.0), - Point3D.of(-2.0, -3.0, -5.0), Point3D.of(0.0, 0.0, 0.0), - Point3D.of(3.0, 2.0, 5.0), Point3D.of(-3.0, 2.0, 5.0), - Point3D.of(2.0, 3.0, -5.0)); + Point3D.of(-2.0, -3.0, -5.0), Point3D.of(0.0, 0.0, 0.0), + Point3D.of(3.0, 2.0, 5.0), Point3D.of(-3.0, 2.0, 5.0), + Point3D.of(2.0, 3.0, -5.0)); } @Test @@ -52,17 +52,17 @@ public void sortByZ_ThenSortedStablyAscending() // given List sequence = Arrays.asList(Point3D.of(0.0, 0.0, 0.0), Point3D.of(2.0, 3.0, -5.0), - Point3D.of(-2.0, -3.0, 5.0), Point3D.of(2.0, -3.0, -5.0), - Point3D.of(-2.0, -3.0, -5.0), Point3D.of(3.0, 2.0, 5.0), - Point3D.of(-3.0, 2.0, 5.0)); + Point3D.of(-2.0, -3.0, 5.0), Point3D.of(2.0, -3.0, -5.0), + Point3D.of(-2.0, -3.0, -5.0), Point3D.of(3.0, 2.0, 5.0), + Point3D.of(-3.0, 2.0, 5.0)); // when Geometry3D.sortByZ(sequence); // then Assertions.assertThat(sequence) .containsExactly(Point3D.of(2.0, 3.0, -5.0), Point3D.of(2.0, -3.0, -5.0), - Point3D.of(-2.0, -3.0, -5.0), Point3D.of(0.0, 0.0, 0.0), - Point3D.of(-2.0, -3.0, 5.0), Point3D.of(3.0, 2.0, 5.0), - Point3D.of(-3.0, 2.0, 5.0)); + Point3D.of(-2.0, -3.0, -5.0), Point3D.of(0.0, 0.0, 0.0), + Point3D.of(-2.0, -3.0, 5.0), Point3D.of(3.0, 2.0, 5.0), + Point3D.of(-3.0, 2.0, 5.0)); } @Test diff --git a/src/test/java/algolib/geometry/dim3/Vector3DTest.java b/src/test/java/com/github/refhumbold/algolib/geometry/dim3/Vector3DTest.java similarity index 94% rename from src/test/java/algolib/geometry/dim3/Vector3DTest.java rename to src/test/java/com/github/refhumbold/algolib/geometry/dim3/Vector3DTest.java index bfccb99..b883fbc 100644 --- a/src/test/java/algolib/geometry/dim3/Vector3DTest.java +++ b/src/test/java/com/github/refhumbold/algolib/geometry/dim3/Vector3DTest.java @@ -1,10 +1,9 @@ -package algolib.geometry.dim3; +package com.github.refhumbold.algolib.geometry.dim3; import org.assertj.core.api.Assertions; import org.assertj.core.data.Offset; import org.junit.jupiter.api.Test; - -import algolib.geometry.GeometryObject; +import com.github.refhumbold.algolib.geometry.GeometryObject; // Tests: Structure of vector in 3D. public class Vector3DTest @@ -95,7 +94,7 @@ public void volume_ThenScalarTripleProduct() { // when double result = Vector3D.volume(Vector3D.of(1.5, -4.0, -3.5), Vector3D.of(9.0, -2.5, 8.5), - Vector3D.of(1.0, -1.0, 1.0)); + Vector3D.of(1.0, -1.0, 1.0)); // then Assertions.assertThat(result).isCloseTo(33.75, OFFSET); } @@ -105,7 +104,7 @@ public void volume_WhenParallel_ThenZero() { // when double result = Vector3D.volume(Vector3D.of(3.0, 3.0, 3.0), Vector3D.of(-8.0, -8.0, -8.0), - Vector3D.of(2.0, -2.0, 2.0)); + Vector3D.of(2.0, -2.0, 2.0)); // then Assertions.assertThat(result).isCloseTo(0.0, OFFSET); } @@ -115,7 +114,7 @@ public void volume_WhenOrthogonal_ThenZero() { // when double result = Vector3D.volume(Vector3D.of(3.0, 3.0, 3.0), Vector3D.of(1.0, 0.0, 1.0), - Vector3D.of(0.0, -2.0, 0.0)); + Vector3D.of(0.0, -2.0, 0.0)); // then Assertions.assertThat(result).isCloseTo(0.0, OFFSET); } diff --git a/src/test/java/algolib/graphs/DirectedSimpleGraphTest.java b/src/test/java/com/github/refhumbold/algolib/graphs/DirectedSimpleGraphTest.java similarity index 86% rename from src/test/java/algolib/graphs/DirectedSimpleGraphTest.java rename to src/test/java/com/github/refhumbold/algolib/graphs/DirectedSimpleGraphTest.java index e8e0bf0..1a6d707 100644 --- a/src/test/java/algolib/graphs/DirectedSimpleGraphTest.java +++ b/src/test/java/com/github/refhumbold/algolib/graphs/DirectedSimpleGraphTest.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.util.Collection; import java.util.stream.Collectors; @@ -112,8 +112,8 @@ public void getVertices_ThenAllVertices() // then Assertions.assertThat(result) .containsOnly(new Vertex<>(0), new Vertex<>(1), new Vertex<>(2), new Vertex<>(3), - new Vertex<>(4), new Vertex<>(5), new Vertex<>(6), new Vertex<>(7), - new Vertex<>(8), new Vertex<>(9)); + new Vertex<>(4), new Vertex<>(5), new Vertex<>(6), new Vertex<>(7), + new Vertex<>(8), new Vertex<>(9)); } @Test @@ -134,12 +134,12 @@ public void getEdges_ThenAllEdges() // then Assertions.assertThat(result) .containsOnly(new Edge<>(new Vertex<>(1), new Vertex<>(5)), - new Edge<>(new Vertex<>(2), new Vertex<>(4)), - new Edge<>(new Vertex<>(3), new Vertex<>(6)), - new Edge<>(new Vertex<>(6), new Vertex<>(3)), - new Edge<>(new Vertex<>(7), new Vertex<>(7)), - new Edge<>(new Vertex<>(8), new Vertex<>(0)), - new Edge<>(new Vertex<>(9), new Vertex<>(3))); + new Edge<>(new Vertex<>(2), new Vertex<>(4)), + new Edge<>(new Vertex<>(3), new Vertex<>(6)), + new Edge<>(new Vertex<>(6), new Vertex<>(3)), + new Edge<>(new Vertex<>(7), new Vertex<>(7)), + new Edge<>(new Vertex<>(8), new Vertex<>(0)), + new Edge<>(new Vertex<>(9), new Vertex<>(3))); } @Test @@ -227,7 +227,7 @@ public void getNeighbours_ThenDestinationVerticesOfOutgoingEdges() // then Assertions.assertThat(result) .containsExactlyInAnyOrder(new Vertex<>(1), new Vertex<>(3), new Vertex<>(4), - new Vertex<>(7), new Vertex<>(9)); + new Vertex<>(7), new Vertex<>(9)); } @Test @@ -248,10 +248,10 @@ public void getAdjacentEdges_ThenOutgoingEdges() // then Assertions.assertThat(result) .containsExactlyInAnyOrder(new Edge<>(new Vertex<>(1), new Vertex<>(1)), - new Edge<>(new Vertex<>(1), new Vertex<>(3)), - new Edge<>(new Vertex<>(1), new Vertex<>(4)), - new Edge<>(new Vertex<>(1), new Vertex<>(7)), - new Edge<>(new Vertex<>(1), new Vertex<>(9))); + new Edge<>(new Vertex<>(1), new Vertex<>(3)), + new Edge<>(new Vertex<>(1), new Vertex<>(4)), + new Edge<>(new Vertex<>(1), new Vertex<>(7)), + new Edge<>(new Vertex<>(1), new Vertex<>(9))); } @Test @@ -386,15 +386,15 @@ public void reverse_ThenAllEdgesHaveReversedDirection() // then Assertions.assertThat(testObject.getEdges()) .containsOnly(new Edge<>(new Vertex<>(1), new Vertex<>(9)), - new Edge<>(new Vertex<>(2), new Vertex<>(1)), - new Edge<>(new Vertex<>(2), new Vertex<>(6)), - new Edge<>(new Vertex<>(4), new Vertex<>(5)), - new Edge<>(new Vertex<>(5), new Vertex<>(3)), - new Edge<>(new Vertex<>(6), new Vertex<>(6)), - new Edge<>(new Vertex<>(6), new Vertex<>(9)), - new Edge<>(new Vertex<>(7), new Vertex<>(5)), - new Edge<>(new Vertex<>(8), new Vertex<>(7)), - new Edge<>(new Vertex<>(9), new Vertex<>(4))); + new Edge<>(new Vertex<>(2), new Vertex<>(1)), + new Edge<>(new Vertex<>(2), new Vertex<>(6)), + new Edge<>(new Vertex<>(4), new Vertex<>(5)), + new Edge<>(new Vertex<>(5), new Vertex<>(3)), + new Edge<>(new Vertex<>(6), new Vertex<>(6)), + new Edge<>(new Vertex<>(6), new Vertex<>(9)), + new Edge<>(new Vertex<>(7), new Vertex<>(5)), + new Edge<>(new Vertex<>(8), new Vertex<>(7)), + new Edge<>(new Vertex<>(9), new Vertex<>(4))); Assertions.assertThat(testObject.getProperties().get(vertex)).isEqualTo(vertexProperty); Assertions.assertThat(testObject.getProperties().get(new Vertex<>(9))).isNull(); Assertions.assertThat(testObject.getProperties().get(testObject.getEdge(2, 1))) @@ -429,15 +429,15 @@ public void reversedCopy_ThenNewGraphWithReversedEdges() Assertions.assertThat(result.getVertices()).hasSameElementsAs(testObject.getVertices()); Assertions.assertThat(result.getEdges()) .containsOnly(new Edge<>(new Vertex<>(1), new Vertex<>(9)), - new Edge<>(new Vertex<>(2), new Vertex<>(1)), - new Edge<>(new Vertex<>(2), new Vertex<>(6)), - new Edge<>(new Vertex<>(4), new Vertex<>(5)), - new Edge<>(new Vertex<>(5), new Vertex<>(3)), - new Edge<>(new Vertex<>(6), new Vertex<>(6)), - new Edge<>(new Vertex<>(6), new Vertex<>(9)), - new Edge<>(new Vertex<>(7), new Vertex<>(5)), - new Edge<>(new Vertex<>(8), new Vertex<>(7)), - new Edge<>(new Vertex<>(9), new Vertex<>(4))); + new Edge<>(new Vertex<>(2), new Vertex<>(1)), + new Edge<>(new Vertex<>(2), new Vertex<>(6)), + new Edge<>(new Vertex<>(4), new Vertex<>(5)), + new Edge<>(new Vertex<>(5), new Vertex<>(3)), + new Edge<>(new Vertex<>(6), new Vertex<>(6)), + new Edge<>(new Vertex<>(6), new Vertex<>(9)), + new Edge<>(new Vertex<>(7), new Vertex<>(5)), + new Edge<>(new Vertex<>(8), new Vertex<>(7)), + new Edge<>(new Vertex<>(9), new Vertex<>(4))); Assertions.assertThat(result.getProperties().get(vertex)).isEqualTo(vertexProperty); Assertions.assertThat(result.getProperties().get(new Vertex<>(9))).isNull(); Assertions.assertThat(result.getProperties().get(result.getEdge(2, 1))) diff --git a/src/test/java/algolib/graphs/MultipartiteGraphTest.java b/src/test/java/com/github/refhumbold/algolib/graphs/MultipartiteGraphTest.java similarity index 91% rename from src/test/java/algolib/graphs/MultipartiteGraphTest.java rename to src/test/java/com/github/refhumbold/algolib/graphs/MultipartiteGraphTest.java index 4e27706..2ca3098 100644 --- a/src/test/java/algolib/graphs/MultipartiteGraphTest.java +++ b/src/test/java/com/github/refhumbold/algolib/graphs/MultipartiteGraphTest.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.util.Collection; import java.util.List; @@ -14,8 +14,8 @@ public class MultipartiteGraphTest @BeforeEach public void setUp() { - testObject = new MultipartiteGraph<>(5, List.of(List.of(0, 1, 2), List.of(3, 4), - List.of(5, 6, 7, 8), List.of(9))); + testObject = new MultipartiteGraph<>(5, + List.of(List.of(0, 1, 2), List.of(3, 4), List.of(5, 6, 7, 8), List.of(9))); testObject.addEdgeBetween(new Vertex<>(0), new Vertex<>(3)); testObject.addEdgeBetween(new Vertex<>(1), new Vertex<>(5)); testObject.addEdgeBetween(new Vertex<>(2), new Vertex<>(9)); @@ -73,8 +73,8 @@ public void getVertices_ThenAllVertices() // then Assertions.assertThat(result) .containsOnly(new Vertex<>(0), new Vertex<>(1), new Vertex<>(2), new Vertex<>(3), - new Vertex<>(4), new Vertex<>(5), new Vertex<>(6), new Vertex<>(7), - new Vertex<>(8), new Vertex<>(9)); + new Vertex<>(4), new Vertex<>(5), new Vertex<>(6), new Vertex<>(7), + new Vertex<>(8), new Vertex<>(9)); } @Test @@ -86,10 +86,10 @@ public void getEdges_ThenAllEdges() // then Assertions.assertThat(result) .containsOnly(new Edge<>(new Vertex<>(0), new Vertex<>(3)), - new Edge<>(new Vertex<>(1), new Vertex<>(5)), - new Edge<>(new Vertex<>(2), new Vertex<>(9)), - new Edge<>(new Vertex<>(4), new Vertex<>(6)), - new Edge<>(new Vertex<>(7), new Vertex<>(9))); + new Edge<>(new Vertex<>(1), new Vertex<>(5)), + new Edge<>(new Vertex<>(2), new Vertex<>(9)), + new Edge<>(new Vertex<>(4), new Vertex<>(6)), + new Edge<>(new Vertex<>(7), new Vertex<>(9))); } @Test @@ -140,7 +140,7 @@ public void getAdjacentEdges_ThenDestinationVerticesOfOutgoingEdges() // then Assertions.assertThat(result) .containsExactlyInAnyOrder(new Edge<>(new Vertex<>(2), new Vertex<>(9)), - new Edge<>(new Vertex<>(7), new Vertex<>(9))); + new Edge<>(new Vertex<>(7), new Vertex<>(9))); } @Test diff --git a/src/test/java/algolib/graphs/TreeGraphTest.java b/src/test/java/com/github/refhumbold/algolib/graphs/TreeGraphTest.java similarity index 88% rename from src/test/java/algolib/graphs/TreeGraphTest.java rename to src/test/java/com/github/refhumbold/algolib/graphs/TreeGraphTest.java index 270d969..570582b 100644 --- a/src/test/java/algolib/graphs/TreeGraphTest.java +++ b/src/test/java/com/github/refhumbold/algolib/graphs/TreeGraphTest.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.util.Collection; import org.assertj.core.api.Assertions; @@ -73,7 +73,7 @@ public void getVertices_ThenAllVertices() // then Assertions.assertThat(result) .containsOnly(new Vertex<>(0), new Vertex<>(1), new Vertex<>(2), new Vertex<>(3), - new Vertex<>(4), new Vertex<>(5), new Vertex<>(6), new Vertex<>(7)); + new Vertex<>(4), new Vertex<>(5), new Vertex<>(6), new Vertex<>(7)); } @Test @@ -85,12 +85,12 @@ public void getEdges_ThenAllEdges() // then Assertions.assertThat(result) .containsOnly(new Edge<>(new Vertex<>(1), new Vertex<>(0)), - new Edge<>(new Vertex<>(2), new Vertex<>(0)), - new Edge<>(new Vertex<>(3), new Vertex<>(0)), - new Edge<>(new Vertex<>(4), new Vertex<>(1)), - new Edge<>(new Vertex<>(5), new Vertex<>(1)), - new Edge<>(new Vertex<>(6), new Vertex<>(2)), - new Edge<>(new Vertex<>(7), new Vertex<>(2))); + new Edge<>(new Vertex<>(2), new Vertex<>(0)), + new Edge<>(new Vertex<>(3), new Vertex<>(0)), + new Edge<>(new Vertex<>(4), new Vertex<>(1)), + new Edge<>(new Vertex<>(5), new Vertex<>(1)), + new Edge<>(new Vertex<>(6), new Vertex<>(2)), + new Edge<>(new Vertex<>(7), new Vertex<>(2))); } @Test @@ -142,8 +142,8 @@ public void getAdjacentEdges_ThenDestinationVerticesOfOutgoingEdges() // then Assertions.assertThat(result) .containsExactlyInAnyOrder(new Edge<>(new Vertex<>(1), new Vertex<>(0)), - new Edge<>(new Vertex<>(4), new Vertex<>(1)), - new Edge<>(new Vertex<>(5), new Vertex<>(1))); + new Edge<>(new Vertex<>(4), new Vertex<>(1)), + new Edge<>(new Vertex<>(5), new Vertex<>(1))); } @Test diff --git a/src/test/java/algolib/graphs/UndirectedSimpleGraphTest.java b/src/test/java/com/github/refhumbold/algolib/graphs/UndirectedSimpleGraphTest.java similarity index 87% rename from src/test/java/algolib/graphs/UndirectedSimpleGraphTest.java rename to src/test/java/com/github/refhumbold/algolib/graphs/UndirectedSimpleGraphTest.java index 0ea4319..ee317c4 100644 --- a/src/test/java/algolib/graphs/UndirectedSimpleGraphTest.java +++ b/src/test/java/com/github/refhumbold/algolib/graphs/UndirectedSimpleGraphTest.java @@ -1,4 +1,4 @@ -package algolib.graphs; +package com.github.refhumbold.algolib.graphs; import java.util.Collection; import java.util.stream.Collectors; @@ -110,8 +110,8 @@ public void getVertices_ThenAllVertices() // then Assertions.assertThat(result) .containsOnly(new Vertex<>(0), new Vertex<>(1), new Vertex<>(2), new Vertex<>(3), - new Vertex<>(4), new Vertex<>(5), new Vertex<>(6), new Vertex<>(7), - new Vertex<>(8), new Vertex<>(9)); + new Vertex<>(4), new Vertex<>(5), new Vertex<>(6), new Vertex<>(7), + new Vertex<>(8), new Vertex<>(9)); } @Test @@ -131,11 +131,11 @@ public void getEdges_ThenAllEdges() // then Assertions.assertThat(result) .containsOnly(new Edge<>(new Vertex<>(7), new Vertex<>(7)), - new Edge<>(new Vertex<>(1), new Vertex<>(5)), - new Edge<>(new Vertex<>(2), new Vertex<>(4)), - new Edge<>(new Vertex<>(8), new Vertex<>(0)), - new Edge<>(new Vertex<>(6), new Vertex<>(3)), - new Edge<>(new Vertex<>(9), new Vertex<>(3))); + new Edge<>(new Vertex<>(1), new Vertex<>(5)), + new Edge<>(new Vertex<>(2), new Vertex<>(4)), + new Edge<>(new Vertex<>(8), new Vertex<>(0)), + new Edge<>(new Vertex<>(6), new Vertex<>(3)), + new Edge<>(new Vertex<>(9), new Vertex<>(3))); } @Test @@ -224,8 +224,7 @@ public void getNeighbours_ThenDestinationVerticesOfOutgoingEdges() // then Assertions.assertThat(result) .containsExactlyInAnyOrder(new Vertex<>(1), new Vertex<>(2), new Vertex<>(3), - new Vertex<>(4), new Vertex<>(6), new Vertex<>(7), - new Vertex<>(9)); + new Vertex<>(4), new Vertex<>(6), new Vertex<>(7), new Vertex<>(9)); } @Test @@ -246,12 +245,12 @@ public void getAdjacentEdges_ThenOutgoingEdges() // then Assertions.assertThat(result) .containsExactlyInAnyOrder(new Edge<>(new Vertex<>(1), new Vertex<>(1)), - new Edge<>(new Vertex<>(2), new Vertex<>(1)), - new Edge<>(new Vertex<>(1), new Vertex<>(3)), - new Edge<>(new Vertex<>(1), new Vertex<>(4)), - new Edge<>(new Vertex<>(6), new Vertex<>(1)), - new Edge<>(new Vertex<>(1), new Vertex<>(7)), - new Edge<>(new Vertex<>(1), new Vertex<>(9))); + new Edge<>(new Vertex<>(2), new Vertex<>(1)), + new Edge<>(new Vertex<>(1), new Vertex<>(3)), + new Edge<>(new Vertex<>(1), new Vertex<>(4)), + new Edge<>(new Vertex<>(6), new Vertex<>(1)), + new Edge<>(new Vertex<>(1), new Vertex<>(7)), + new Edge<>(new Vertex<>(1), new Vertex<>(9))); } @Test @@ -398,16 +397,16 @@ public void asDirected_ThenDirectedGraph() Assertions.assertThat(result.getVertices()).hasSameSizeAs(testObject.getVertices()); Assertions.assertThat(result.getEdges()) .containsOnly(new Edge<>(new Vertex<>(0), new Vertex<>(8)), - new Edge<>(new Vertex<>(1), new Vertex<>(5)), - new Edge<>(new Vertex<>(2), new Vertex<>(4)), - new Edge<>(new Vertex<>(3), new Vertex<>(6)), - new Edge<>(new Vertex<>(3), new Vertex<>(9)), - new Edge<>(new Vertex<>(4), new Vertex<>(2)), - new Edge<>(new Vertex<>(5), new Vertex<>(1)), - new Edge<>(new Vertex<>(6), new Vertex<>(3)), - new Edge<>(new Vertex<>(7), new Vertex<>(7)), - new Edge<>(new Vertex<>(8), new Vertex<>(0)), - new Edge<>(new Vertex<>(9), new Vertex<>(3))); + new Edge<>(new Vertex<>(1), new Vertex<>(5)), + new Edge<>(new Vertex<>(2), new Vertex<>(4)), + new Edge<>(new Vertex<>(3), new Vertex<>(6)), + new Edge<>(new Vertex<>(3), new Vertex<>(9)), + new Edge<>(new Vertex<>(4), new Vertex<>(2)), + new Edge<>(new Vertex<>(5), new Vertex<>(1)), + new Edge<>(new Vertex<>(6), new Vertex<>(3)), + new Edge<>(new Vertex<>(7), new Vertex<>(7)), + new Edge<>(new Vertex<>(8), new Vertex<>(0)), + new Edge<>(new Vertex<>(9), new Vertex<>(3))); Assertions.assertThat(result.getProperties().get(vertex)).isEqualTo(vertexProperty); Assertions.assertThat(result.getProperties().get(new Vertex<>(9))).isNull(); Assertions.assertThat(result.getProperties().get(result.getEdge(1, 5))) diff --git a/src/test/java/algolib/graphs/algorithms/CuttingTest.java b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/CuttingTest.java similarity index 95% rename from src/test/java/algolib/graphs/algorithms/CuttingTest.java rename to src/test/java/com/github/refhumbold/algolib/graphs/algorithms/CuttingTest.java index 8a6c5f7..3770e3f 100644 --- a/src/test/java/algolib/graphs/algorithms/CuttingTest.java +++ b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/CuttingTest.java @@ -1,14 +1,13 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.Collection; import java.util.stream.Collectors; import java.util.stream.IntStream; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; - -import algolib.graphs.Edge; -import algolib.graphs.UndirectedSimpleGraph; -import algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.Edge; +import com.github.refhumbold.algolib.graphs.UndirectedSimpleGraph; +import com.github.refhumbold.algolib.graphs.Vertex; // Tests: Algorithms for graph cutting (edge cut and vertex cut). public class CuttingTest @@ -93,7 +92,7 @@ public void findVertexCut_WhenPresentSeparators_ThenSeparators() // then Assertions.assertThat(result) .containsOnly(graph.getVertex(0), graph.getVertex(1), graph.getVertex(5), - graph.getVertex(7)); + graph.getVertex(7)); } @Test diff --git a/src/test/java/algolib/graphs/algorithms/LowestCommonAncestorTest.java b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/LowestCommonAncestorTest.java similarity index 95% rename from src/test/java/algolib/graphs/algorithms/LowestCommonAncestorTest.java rename to src/test/java/com/github/refhumbold/algolib/graphs/algorithms/LowestCommonAncestorTest.java index 8d57f11..0bbe774 100644 --- a/src/test/java/algolib/graphs/algorithms/LowestCommonAncestorTest.java +++ b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/LowestCommonAncestorTest.java @@ -1,12 +1,11 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - -import algolib.graphs.TreeGraph; -import algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.TreeGraph; +import com.github.refhumbold.algolib.graphs.Vertex; // Tests: Algorithm for lowest common ancestors in a rooted tree. public class LowestCommonAncestorTest diff --git a/src/test/java/algolib/graphs/algorithms/MatchingTest.java b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/MatchingTest.java similarity index 91% rename from src/test/java/algolib/graphs/algorithms/MatchingTest.java rename to src/test/java/com/github/refhumbold/algolib/graphs/algorithms/MatchingTest.java index 9c42ef1..4b9c021 100644 --- a/src/test/java/algolib/graphs/algorithms/MatchingTest.java +++ b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/MatchingTest.java @@ -1,4 +1,4 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.List; import java.util.Map; @@ -6,9 +6,8 @@ import java.util.stream.IntStream; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; - -import algolib.graphs.MultipartiteGraph; -import algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.MultipartiteGraph; +import com.github.refhumbold.algolib.graphs.Vertex; // Tests: Hopcroft-Karp algorithm for matching in a bipartite graph. public class MatchingTest @@ -26,7 +25,7 @@ public void match_WhenMatchingExists_ThenMaximalMatching() graph.addEdgeBetween(graph.getVertex(3), graph.getVertex(6)); graph.addEdgeBetween(graph.getVertex(6), graph.getVertex(7)); - int[] matches = new int[]{5, 2, 1, 4, 3, 0, 7, 6}; + int[] matches = new int[]{ 5, 2, 1, 4, 3, 0, 7, 6 }; Map, Vertex> expected = IntStream.range(0, matches.length) .boxed() .collect(Collectors.toMap( diff --git a/src/test/java/algolib/graphs/algorithms/MinimalSpanningTreeTest.java b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/MinimalSpanningTreeTest.java similarity index 92% rename from src/test/java/algolib/graphs/algorithms/MinimalSpanningTreeTest.java rename to src/test/java/com/github/refhumbold/algolib/graphs/algorithms/MinimalSpanningTreeTest.java index c1088ee..ca9c378 100644 --- a/src/test/java/algolib/graphs/algorithms/MinimalSpanningTreeTest.java +++ b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/MinimalSpanningTreeTest.java @@ -1,4 +1,4 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -7,10 +7,9 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - -import algolib.graphs.UndirectedGraph; -import algolib.graphs.UndirectedSimpleGraph; -import algolib.graphs.properties.Weighted; +import com.github.refhumbold.algolib.graphs.UndirectedGraph; +import com.github.refhumbold.algolib.graphs.UndirectedSimpleGraph; +import com.github.refhumbold.algolib.graphs.properties.Weighted; // Tests: Algorithms for minimal spanning tree. public class MinimalSpanningTreeTest @@ -56,7 +55,7 @@ public void kruskal_ThenMinimalSpanningTree() Assertions.assertThat(result.getEdgesCount()).isEqualTo(4); Assertions.assertThat(result.getEdges()) .containsOnly(graph.getEdge(0, 1), graph.getEdge(0, 2), graph.getEdge(2, 4), - graph.getEdge(3, 4)); + graph.getEdge(3, 4)); Assertions.assertThat(mstSize).isCloseTo(12.0, OFFSET); } @@ -78,7 +77,7 @@ public void prim_ThenMinimalSpanningTree() Assertions.assertThat(result.getEdgesCount()).isEqualTo(4); Assertions.assertThat(result.getEdges()) .containsOnly(graph.getEdge(0, 1), graph.getEdge(0, 2), graph.getEdge(2, 4), - graph.getEdge(3, 4)); + graph.getEdge(3, 4)); Assertions.assertThat(mstSize).isCloseTo(12.0, Offset.offset(0.000001)); } diff --git a/src/test/java/algolib/graphs/algorithms/SearchingTest.java b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/SearchingTest.java similarity index 80% rename from src/test/java/algolib/graphs/algorithms/SearchingTest.java rename to src/test/java/com/github/refhumbold/algolib/graphs/algorithms/SearchingTest.java index 0083a8d..8f6a43d 100644 --- a/src/test/java/algolib/graphs/algorithms/SearchingTest.java +++ b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/SearchingTest.java @@ -1,4 +1,4 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.Collection; import java.util.HashSet; @@ -9,12 +9,11 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - -import algolib.graphs.DirectedSimpleGraph; -import algolib.graphs.UndirectedSimpleGraph; -import algolib.graphs.Vertex; -import algolib.graphs.algorithms.strategy.DfsStrategy; -import algolib.graphs.algorithms.strategy.EmptyStrategy; +import com.github.refhumbold.algolib.graphs.DirectedSimpleGraph; +import com.github.refhumbold.algolib.graphs.UndirectedSimpleGraph; +import com.github.refhumbold.algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.algorithms.strategy.DfsStrategy; +import com.github.refhumbold.algolib.graphs.algorithms.strategy.EmptyStrategy; // Tests: Algorithms for graph searching. public class SearchingTest @@ -65,13 +64,13 @@ public void bfs_WhenUndirectedGraphAndSingleRoot_ThenVisitedVertices() { // when Collection> result = Searching.bfs(undirectedGraph, new EmptyStrategy<>(), - List.of(undirectedGraph.getVertex(0))); + List.of(undirectedGraph.getVertex(0))); // then Assertions.assertThat(result) .isSubsetOf(undirectedGraph.getVertices()) .doesNotContain(undirectedGraph.getVertex(2), undirectedGraph.getVertex(6), - undirectedGraph.getVertex(9)); + undirectedGraph.getVertex(9)); } @Test @@ -82,8 +81,7 @@ public void bfs_WhenUndirectedGraphAndManyRoots_ThenAllVertices() // when Collection> result = Searching.bfs(undirectedGraph, strategy, - List.of(undirectedGraph.getVertex(0), - undirectedGraph.getVertex(6))); + List.of(undirectedGraph.getVertex(0), undirectedGraph.getVertex(6))); // then Assertions.assertThat(result).hasSameElementsAs(undirectedGraph.getVertices()); @@ -107,13 +105,13 @@ public void bfs_WhenDirectedGraphAndSingleRoot_ThenVisitedVertices() { // when Collection> result = Searching.bfs(directedGraph, new EmptyStrategy<>(), - List.of(directedGraph.getVertex(1))); + List.of(directedGraph.getVertex(1))); // then Assertions.assertThat(result) .containsExactlyInAnyOrder(directedGraph.getVertex(0), directedGraph.getVertex(1), - directedGraph.getVertex(3), directedGraph.getVertex(4), - directedGraph.getVertex(7)); + directedGraph.getVertex(3), directedGraph.getVertex(4), + directedGraph.getVertex(7)); } @Test @@ -124,8 +122,7 @@ public void bfs_WhenDirectedGraphAndMultipleRoots_ThenAllVertices() // when Collection> result = Searching.bfs(directedGraph, strategy, - List.of(directedGraph.getVertex(8), - directedGraph.getVertex(6))); + List.of(directedGraph.getVertex(8), directedGraph.getVertex(6))); // then Assertions.assertThat(result).hasSameElementsAs(directedGraph.getVertices()); @@ -142,13 +139,13 @@ public void dfsIterative_WhenUndirectedGraphAndSingleRoot_ThenVisitedVertices() // when Collection> result = Searching.dfsIterative(undirectedGraph, new EmptyStrategy<>(), - List.of(undirectedGraph.getVertex(0))); + List.of(undirectedGraph.getVertex(0))); // then Assertions.assertThat(result) .isSubsetOf(undirectedGraph.getVertices()) .doesNotContain(undirectedGraph.getVertex(2), undirectedGraph.getVertex(6), - undirectedGraph.getVertex(9)); + undirectedGraph.getVertex(9)); } @Test @@ -159,10 +156,7 @@ public void dfsIterative_WhenUndirectedGraphAndManyRoots_ThenAllVertices() // when Collection> result = Searching.dfsIterative(undirectedGraph, strategy, - List.of(undirectedGraph.getVertex( - 0), - undirectedGraph.getVertex( - 6))); + List.of(undirectedGraph.getVertex(0), undirectedGraph.getVertex(6))); // then Assertions.assertThat(result).hasSameElementsAs(undirectedGraph.getVertices()); @@ -187,13 +181,13 @@ public void dfsIterative_WhenDirectedGraphAndSingleRoot_ThenVisitedVertices() // when Collection> result = Searching.dfsIterative(directedGraph, new EmptyStrategy<>(), - List.of(directedGraph.getVertex(1))); + List.of(directedGraph.getVertex(1))); // then Assertions.assertThat(result) .containsExactlyInAnyOrder(directedGraph.getVertex(0), directedGraph.getVertex(1), - directedGraph.getVertex(3), directedGraph.getVertex(4), - directedGraph.getVertex(7)); + directedGraph.getVertex(3), directedGraph.getVertex(4), + directedGraph.getVertex(7)); } @Test @@ -204,10 +198,7 @@ public void dfsIterative_WhenDirectedGraphAndMultipleRoots_ThenAllVertices() // when Collection> result = Searching.dfsIterative(directedGraph, strategy, - List.of(directedGraph.getVertex( - 8), - directedGraph.getVertex( - 6))); + List.of(directedGraph.getVertex(8), directedGraph.getVertex(6))); // then Assertions.assertThat(result).hasSameElementsAs(directedGraph.getVertices()); @@ -224,13 +215,13 @@ public void dfsRecursive_WhenUndirectedGraphAndSingleRoot_ThenVisitedVertices() // when Collection> result = Searching.dfsRecursive(undirectedGraph, new EmptyStrategy<>(), - List.of(undirectedGraph.getVertex(0))); + List.of(undirectedGraph.getVertex(0))); // then Assertions.assertThat(result) .isSubsetOf(undirectedGraph.getVertices()) .doesNotContain(undirectedGraph.getVertex(2), undirectedGraph.getVertex(6), - undirectedGraph.getVertex(9)); + undirectedGraph.getVertex(9)); } @Test @@ -268,13 +259,13 @@ public void dfsRecursive_WhenDirectedGraphAndSingleRoot_ThenVisitedVertices() // when Collection> result = Searching.dfsRecursive(directedGraph, new EmptyStrategy<>(), - List.of(directedGraph.getVertex(1))); + List.of(directedGraph.getVertex(1))); // then Assertions.assertThat(result) .containsExactlyInAnyOrder(directedGraph.getVertex(0), directedGraph.getVertex(1), - directedGraph.getVertex(3), directedGraph.getVertex(4), - directedGraph.getVertex(7)); + directedGraph.getVertex(3), directedGraph.getVertex(4), + directedGraph.getVertex(7)); } @Test diff --git a/src/test/java/algolib/graphs/algorithms/ShortestPathsTest.java b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/ShortestPathsTest.java similarity index 65% rename from src/test/java/algolib/graphs/algorithms/ShortestPathsTest.java rename to src/test/java/com/github/refhumbold/algolib/graphs/algorithms/ShortestPathsTest.java index e6da875..12006c8 100644 --- a/src/test/java/algolib/graphs/algorithms/ShortestPathsTest.java +++ b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/ShortestPathsTest.java @@ -1,4 +1,4 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.HashMap; import java.util.List; @@ -8,13 +8,12 @@ import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - -import algolib.graphs.DirectedSimpleGraph; -import algolib.graphs.Graph; -import algolib.graphs.UndirectedSimpleGraph; -import algolib.graphs.Vertex; -import algolib.graphs.properties.Weighted; -import algolib.tuples.Pair; +import com.github.refhumbold.algolib.graphs.DirectedSimpleGraph; +import com.github.refhumbold.algolib.graphs.Graph; +import com.github.refhumbold.algolib.graphs.UndirectedSimpleGraph; +import com.github.refhumbold.algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.properties.Weighted; +import com.github.refhumbold.algolib.tuples.Pair; // Tests: Algorithms for shortest paths in a graph. public class ShortestPathsTest @@ -29,64 +28,64 @@ public void setUp() directedGraph = new DirectedSimpleGraph<>( IntStream.range(0, 10).boxed().collect(Collectors.toList())); directedGraph.addEdgeBetween(directedGraph.getVertex(0), directedGraph.getVertex(1), - new Weight(4.0)); + new Weight(4.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(1), directedGraph.getVertex(4), - new Weight(7.0)); + new Weight(7.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(1), directedGraph.getVertex(7), - new Weight(12.0)); + new Weight(12.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(2), directedGraph.getVertex(4), - new Weight(6.0)); + new Weight(6.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(2), directedGraph.getVertex(6), - new Weight(8.0)); + new Weight(8.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(3), directedGraph.getVertex(0), - new Weight(3.0)); + new Weight(3.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(3), directedGraph.getVertex(7), - new Weight(5.0)); + new Weight(5.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(4), directedGraph.getVertex(5), - new Weight(1.0)); + new Weight(1.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(4), directedGraph.getVertex(3), - new Weight(10.0)); + new Weight(10.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(5), directedGraph.getVertex(6), - new Weight(4.0)); + new Weight(4.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(5), directedGraph.getVertex(8), - new Weight(2.0)); + new Weight(2.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(6), directedGraph.getVertex(5), - new Weight(7.0)); + new Weight(7.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(7), directedGraph.getVertex(5), - new Weight(2.0)); + new Weight(2.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(7), directedGraph.getVertex(8), - new Weight(6.0)); + new Weight(6.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(8), directedGraph.getVertex(9), - new Weight(10.0)); + new Weight(10.0)); directedGraph.addEdgeBetween(directedGraph.getVertex(9), directedGraph.getVertex(6), - new Weight(3.0)); + new Weight(3.0)); undirectedGraph = new UndirectedSimpleGraph<>( IntStream.range(0, 10).boxed().collect(Collectors.toList())); undirectedGraph.addEdgeBetween(undirectedGraph.getVertex(0), undirectedGraph.getVertex(1), - new Weight(4.0)); + new Weight(4.0)); undirectedGraph.addEdgeBetween(undirectedGraph.getVertex(1), undirectedGraph.getVertex(4), - new Weight(7.0)); + new Weight(7.0)); undirectedGraph.addEdgeBetween(undirectedGraph.getVertex(1), undirectedGraph.getVertex(7), - new Weight(12.0)); + new Weight(12.0)); undirectedGraph.addEdgeBetween(undirectedGraph.getVertex(2), undirectedGraph.getVertex(6), - new Weight(8.0)); + new Weight(8.0)); undirectedGraph.addEdgeBetween(undirectedGraph.getVertex(3), undirectedGraph.getVertex(0), - new Weight(3.0)); + new Weight(3.0)); undirectedGraph.addEdgeBetween(undirectedGraph.getVertex(3), undirectedGraph.getVertex(7), - new Weight(5.0)); + new Weight(5.0)); undirectedGraph.addEdgeBetween(undirectedGraph.getVertex(4), undirectedGraph.getVertex(5), - new Weight(1.0)); + new Weight(1.0)); undirectedGraph.addEdgeBetween(undirectedGraph.getVertex(4), undirectedGraph.getVertex(3), - new Weight(10.0)); + new Weight(10.0)); undirectedGraph.addEdgeBetween(undirectedGraph.getVertex(5), undirectedGraph.getVertex(8), - new Weight(2.0)); + new Weight(2.0)); undirectedGraph.addEdgeBetween(undirectedGraph.getVertex(7), undirectedGraph.getVertex(5), - new Weight(2.0)); + new Weight(2.0)); undirectedGraph.addEdgeBetween(undirectedGraph.getVertex(7), undirectedGraph.getVertex(8), - new Weight(6.0)); + new Weight(6.0)); undirectedGraph.addEdgeBetween(undirectedGraph.getVertex(9), undirectedGraph.getVertex(6), - new Weight(3.0)); + new Weight(3.0)); } // region bellmanFord @@ -114,7 +113,7 @@ public void bellmanFord_WhenNegativeEdge_ThenEdgeIncluded() Map, Double> expected = fromList(directedGraph, distances); directedGraph.addEdgeBetween(directedGraph.getVertex(8), directedGraph.getVertex(3), - new Weight(-5.0)); + new Weight(-5.0)); // when Map, Double> result = @@ -134,7 +133,7 @@ public void bellmanFord_WhenUndirectedGraph_ThenShortestPathsLengths() // when Map, Double> result = ShortestPaths.bellmanFord(undirectedGraph.asDirected(), - undirectedGraph.getVertex(1)); + undirectedGraph.getVertex(1)); // then Assertions.assertThat(result).isEqualTo(expected); @@ -145,12 +144,11 @@ public void bellmanFord_WhenNegativeCycle_ThenIllegalStateException() { // given directedGraph.addEdgeBetween(directedGraph.getVertex(8), directedGraph.getVertex(3), - new Weight(-20.0)); + new Weight(-20.0)); // then Assertions.assertThatThrownBy( - () -> ShortestPaths.bellmanFord(directedGraph, - directedGraph.getVertex(1))) + () -> ShortestPaths.bellmanFord(directedGraph, directedGraph.getVertex(1))) .isInstanceOf(IllegalStateException.class); } @@ -192,7 +190,7 @@ public void dijkstra_WhenNegativeEdge_ThenIllegalStateException() { // given directedGraph.addEdgeBetween(directedGraph.getVertex(8), directedGraph.getVertex(3), - new Weight(-5.0)); + new Weight(-5.0)); // then Assertions.assertThatThrownBy( @@ -207,16 +205,16 @@ public void dijkstra_WhenNegativeEdge_ThenIllegalStateException() public void floydWarshall_WhenDirectedGraph_ThenAllShortestPathsLengths() { // given - double[][] distances = {{0.0, 4.0, INF, 21.0, 11.0, 12.0, 16.0, 16.0, 14.0, 24.0}, - {20.0, 0.0, INF, 17.0, 7.0, 8.0, 12.0, 12.0, 10.0, 20.0}, - {19.0, 23.0, 0.0, 16.0, 6.0, 7.0, 8.0, 21.0, 9.0, 19.0}, - {3.0, 7.0, INF, 0.0, 14.0, 7.0, 11.0, 5.0, 9.0, 19.0}, - {13.0, 17.0, INF, 10.0, 0.0, 1.0, 5.0, 15.0, 3.0, 13.0}, - {INF, INF, INF, INF, INF, 0.0, 4.0, INF, 2.0, 12.0}, - {INF, INF, INF, INF, INF, 7.0, 0.0, INF, 9.0, 19.0}, - {INF, INF, INF, INF, INF, 2.0, 6.0, 0.0, 4.0, 14.0}, - {INF, INF, INF, INF, INF, 20.0, 13.0, INF, 0.0, 10.0}, - {INF, INF, INF, INF, INF, 10.0, 3.0, INF, 12.0, 0.0}}; + double[][] distances = { { 0.0, 4.0, INF, 21.0, 11.0, 12.0, 16.0, 16.0, 14.0, 24.0 }, + { 20.0, 0.0, INF, 17.0, 7.0, 8.0, 12.0, 12.0, 10.0, 20.0 }, + { 19.0, 23.0, 0.0, 16.0, 6.0, 7.0, 8.0, 21.0, 9.0, 19.0 }, + { 3.0, 7.0, INF, 0.0, 14.0, 7.0, 11.0, 5.0, 9.0, 19.0 }, + { 13.0, 17.0, INF, 10.0, 0.0, 1.0, 5.0, 15.0, 3.0, 13.0 }, + { INF, INF, INF, INF, INF, 0.0, 4.0, INF, 2.0, 12.0 }, + { INF, INF, INF, INF, INF, 7.0, 0.0, INF, 9.0, 19.0 }, + { INF, INF, INF, INF, INF, 2.0, 6.0, 0.0, 4.0, 14.0 }, + { INF, INF, INF, INF, INF, 20.0, 13.0, INF, 0.0, 10.0 }, + { INF, INF, INF, INF, INF, 10.0, 3.0, INF, 12.0, 0.0 } }; Map, Vertex>, Double> expected = fromMatrix(undirectedGraph, distances); @@ -232,21 +230,21 @@ public void floydWarshall_WhenDirectedGraph_ThenAllShortestPathsLengths() public void floydWarshall_WhenNegativeEdge_ThenEdgeIncluded() { // given - double[][] distances = {{0.0, 4.0, INF, 9.0, 11.0, 12.0, 16.0, 14.0, 14.0, 24.0}, - {8.0, 0.0, INF, 5.0, 7.0, 8.0, 12.0, 10.0, 10.0, 20.0}, - {7.0, 11.0, 0.0, 4.0, 6.0, 7.0, 8.0, 9.0, 9.0, 19.0}, - {3.0, 7.0, INF, 0.0, 14.0, 7.0, 11.0, 5.0, 9.0, 19.0}, - {1.0, 5.0, INF, -2.0, 0.0, 1.0, 5.0, 3.0, 3.0, 13.0}, - {0.0, 4.0, INF, -3.0, 11.0, 0.0, 4.0, 2.0, 2.0, 12.0}, - {7.0, 11.0, INF, 4.0, 18.0, 7.0, 0.0, 9.0, 9.0, 19.0}, - {2.0, 6.0, INF, -1.0, 13.0, 2.0, 6.0, 0.0, 4.0, 14.0}, - {-2.0, 2.0, INF, -5.0, 9.0, 2.0, 6.0, 0.0, 0.0, 10.0}, - {10.0, 14.0, INF, 7.0, 21.0, 10.0, 3.0, 12.0, 12.0, 0.0}}; + double[][] distances = { { 0.0, 4.0, INF, 9.0, 11.0, 12.0, 16.0, 14.0, 14.0, 24.0 }, + { 8.0, 0.0, INF, 5.0, 7.0, 8.0, 12.0, 10.0, 10.0, 20.0 }, + { 7.0, 11.0, 0.0, 4.0, 6.0, 7.0, 8.0, 9.0, 9.0, 19.0 }, + { 3.0, 7.0, INF, 0.0, 14.0, 7.0, 11.0, 5.0, 9.0, 19.0 }, + { 1.0, 5.0, INF, -2.0, 0.0, 1.0, 5.0, 3.0, 3.0, 13.0 }, + { 0.0, 4.0, INF, -3.0, 11.0, 0.0, 4.0, 2.0, 2.0, 12.0 }, + { 7.0, 11.0, INF, 4.0, 18.0, 7.0, 0.0, 9.0, 9.0, 19.0 }, + { 2.0, 6.0, INF, -1.0, 13.0, 2.0, 6.0, 0.0, 4.0, 14.0 }, + { -2.0, 2.0, INF, -5.0, 9.0, 2.0, 6.0, 0.0, 0.0, 10.0 }, + { 10.0, 14.0, INF, 7.0, 21.0, 10.0, 3.0, 12.0, 12.0, 0.0 } }; Map, Vertex>, Double> expected = fromMatrix(undirectedGraph, distances); directedGraph.addEdgeBetween(directedGraph.getVertex(8), directedGraph.getVertex(3), - new Weight(-5.0)); + new Weight(-5.0)); // when Map, Vertex>, Double> result = @@ -260,20 +258,19 @@ public void floydWarshall_WhenNegativeEdge_ThenEdgeIncluded() public void floydWarshall_WhenUndirectedGraph_ThenAllShortestPathsLengths() { // given - double[][] distances = {{0.0, 4.0, INF, 3.0, 11.0, 10.0, INF, 8.0, 12.0, INF}, - {4.0, 0.0, INF, 7.0, 7.0, 8.0, INF, 10.0, 10.0, INF}, - {INF, INF, 0.0, INF, INF, INF, 8.0, INF, INF, 11.0}, - {3.0, 7.0, INF, 0.0, 8.0, 7.0, INF, 5.0, 9.0, INF}, - {11.0, 7.0, INF, 8.0, 0.0, 1.0, INF, 3.0, 3.0, INF}, - {10, 8, INF, 7.0, 1.0, 0.0, INF, 2.0, 2.0, INF}, - {INF, INF, 8.0, INF, INF, INF, 0.0, INF, INF, 3.0}, - {8.0, 10.0, INF, 5.0, 3.0, 2.0, INF, 0.0, 4.0, INF}, - {12.0, 10.0, INF, 9.0, 3.0, 2.0, INF, 4.0, 0.0, INF}, - {INF, INF, 11.0, INF, INF, INF, 3.0, INF, INF, 0.0}}; + double[][] distances = { { 0.0, 4.0, INF, 3.0, 11.0, 10.0, INF, 8.0, 12.0, INF }, + { 4.0, 0.0, INF, 7.0, 7.0, 8.0, INF, 10.0, 10.0, INF }, + { INF, INF, 0.0, INF, INF, INF, 8.0, INF, INF, 11.0 }, + { 3.0, 7.0, INF, 0.0, 8.0, 7.0, INF, 5.0, 9.0, INF }, + { 11.0, 7.0, INF, 8.0, 0.0, 1.0, INF, 3.0, 3.0, INF }, + { 10, 8, INF, 7.0, 1.0, 0.0, INF, 2.0, 2.0, INF }, + { INF, INF, 8.0, INF, INF, INF, 0.0, INF, INF, 3.0 }, + { 8.0, 10.0, INF, 5.0, 3.0, 2.0, INF, 0.0, 4.0, INF }, + { 12.0, 10.0, INF, 9.0, 3.0, 2.0, INF, 4.0, 0.0, INF }, + { INF, INF, 11.0, INF, INF, INF, 3.0, INF, INF, 0.0 } }; Map, Vertex>, Double> expected = fromMatrix(undirectedGraph, distances); - // when Map, Vertex>, Double> result = ShortestPaths.floydWarshall(undirectedGraph.asDirected()); @@ -284,8 +281,8 @@ public void floydWarshall_WhenUndirectedGraph_ThenAllShortestPathsLengths() // endregion - private Map, Double> fromList( - Graph graph, List distances) + private Map, Double> fromList(Graph graph, + List distances) { Map, Double> map = new HashMap<>(); @@ -295,8 +292,8 @@ private Map, Double> fromList( return map; } - private Map, Vertex>, Double> fromMatrix( - Graph graph, double[][] distances) + private Map, Vertex>, Double> fromMatrix(Graph graph, + double[][] distances) { Map, Vertex>, Double> expected = new HashMap<>(); diff --git a/src/test/java/algolib/graphs/algorithms/StronglyConnectedComponentsTest.java b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/StronglyConnectedComponentsTest.java similarity index 89% rename from src/test/java/algolib/graphs/algorithms/StronglyConnectedComponentsTest.java rename to src/test/java/com/github/refhumbold/algolib/graphs/algorithms/StronglyConnectedComponentsTest.java index ad3d073..43e1544 100644 --- a/src/test/java/algolib/graphs/algorithms/StronglyConnectedComponentsTest.java +++ b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/StronglyConnectedComponentsTest.java @@ -1,4 +1,4 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.HashSet; import java.util.List; @@ -7,9 +7,8 @@ import java.util.stream.IntStream; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; - -import algolib.graphs.DirectedSimpleGraph; -import algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.DirectedSimpleGraph; +import com.github.refhumbold.algolib.graphs.Vertex; // Tests: Algorithm for strongly connected components. public class StronglyConnectedComponentsTest @@ -43,10 +42,10 @@ public void findScc_WhenManyComponents_ThenAllListed() Assertions.assertThat(result) .containsExactlyInAnyOrder( Set.of(graph.getVertex(0), graph.getVertex(1), graph.getVertex(3), - graph.getVertex(4)), Set.of(graph.getVertex(2)), + graph.getVertex(4)), Set.of(graph.getVertex(2)), Set.of(graph.getVertex(5)), Set.of(graph.getVertex(6), graph.getVertex(7), graph.getVertex(8), - graph.getVertex(9))); + graph.getVertex(9))); } @Test @@ -84,7 +83,6 @@ public void findScc_WhenEmptyGraph_ThenEachVertexIsComponent() // then Assertions.assertThat(result) .containsExactlyInAnyOrder(Set.of(graph.getVertex(0)), Set.of(graph.getVertex(1)), - Set.of(graph.getVertex(2)), - Set.of(graph.getVertex(3))); + Set.of(graph.getVertex(2)), Set.of(graph.getVertex(3))); } } diff --git a/src/test/java/algolib/graphs/algorithms/TopologicalSortingTest.java b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/TopologicalSortingTest.java similarity index 86% rename from src/test/java/algolib/graphs/algorithms/TopologicalSortingTest.java rename to src/test/java/com/github/refhumbold/algolib/graphs/algorithms/TopologicalSortingTest.java index 93ebad4..7b77060 100644 --- a/src/test/java/algolib/graphs/algorithms/TopologicalSortingTest.java +++ b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/TopologicalSortingTest.java @@ -1,14 +1,13 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; - -import algolib.graphs.DirectedGraph; -import algolib.graphs.DirectedSimpleGraph; -import algolib.graphs.Vertex; +import com.github.refhumbold.algolib.graphs.DirectedGraph; +import com.github.refhumbold.algolib.graphs.DirectedSimpleGraph; +import com.github.refhumbold.algolib.graphs.Vertex; // Tests: Algorithms for topological sorting of a graph. public class TopologicalSortingTest @@ -39,7 +38,7 @@ public void inputsTopologicalSort_WhenAcyclicGraph_ThenTopologicalOrder() // then Assertions.assertThat(result) .containsExactly(graph.getVertex(3), graph.getVertex(5), graph.getVertex(1), - graph.getVertex(0), graph.getVertex(2), graph.getVertex(4)); + graph.getVertex(0), graph.getVertex(2), graph.getVertex(4)); } @Test @@ -107,13 +106,13 @@ public void dfsTopologicalSort_WhenAcyclicGraph_ThenTopologicalOrder() // then Assertions.assertThat(result) .isIn(List.of(graph.getVertex(3), graph.getVertex(5), graph.getVertex(1), - graph.getVertex(0), graph.getVertex(2), graph.getVertex(4)), - List.of(graph.getVertex(5), graph.getVertex(3), graph.getVertex(1), - graph.getVertex(0), graph.getVertex(2), graph.getVertex(4)), - List.of(graph.getVertex(3), graph.getVertex(5), graph.getVertex(1), - graph.getVertex(0), graph.getVertex(4), graph.getVertex(2)), - List.of(graph.getVertex(5), graph.getVertex(3), graph.getVertex(1), - graph.getVertex(0), graph.getVertex(4), graph.getVertex(2))); + graph.getVertex(0), graph.getVertex(2), graph.getVertex(4)), + List.of(graph.getVertex(5), graph.getVertex(3), graph.getVertex(1), + graph.getVertex(0), graph.getVertex(2), graph.getVertex(4)), + List.of(graph.getVertex(3), graph.getVertex(5), graph.getVertex(1), + graph.getVertex(0), graph.getVertex(4), graph.getVertex(2)), + List.of(graph.getVertex(5), graph.getVertex(3), graph.getVertex(1), + graph.getVertex(0), graph.getVertex(4), graph.getVertex(2))); } @Test diff --git a/src/test/java/algolib/graphs/algorithms/TreeDiameterTest.java b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/TreeDiameterTest.java similarity index 93% rename from src/test/java/algolib/graphs/algorithms/TreeDiameterTest.java rename to src/test/java/com/github/refhumbold/algolib/graphs/algorithms/TreeDiameterTest.java index 67b6292..a990784 100644 --- a/src/test/java/algolib/graphs/algorithms/TreeDiameterTest.java +++ b/src/test/java/com/github/refhumbold/algolib/graphs/algorithms/TreeDiameterTest.java @@ -1,10 +1,9 @@ -package algolib.graphs.algorithms; +package com.github.refhumbold.algolib.graphs.algorithms; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; - -import algolib.graphs.TreeGraph; -import algolib.graphs.properties.Weighted; +import com.github.refhumbold.algolib.graphs.TreeGraph; +import com.github.refhumbold.algolib.graphs.properties.Weighted; // Tests: Algorithm for computing diameter of a tree. public class TreeDiameterTest diff --git a/src/test/java/algolib/maths/EquationSystemTest.java b/src/test/java/com/github/refhumbold/algolib/maths/EquationSystemTest.java similarity index 65% rename from src/test/java/algolib/maths/EquationSystemTest.java rename to src/test/java/com/github/refhumbold/algolib/maths/EquationSystemTest.java index edc92d3..14996dc 100644 --- a/src/test/java/algolib/maths/EquationSystemTest.java +++ b/src/test/java/com/github/refhumbold/algolib/maths/EquationSystemTest.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; @@ -10,9 +10,9 @@ public class EquationSystemTest public void toString_ThenStringRepresentation() { // given - var testObject = EquationSystem.of(Equation.of(new double[]{2.0, 3.0, -2.0}, 15), - Equation.of(new double[]{7.0, -1.0, 0.0}, 4), - Equation.of(new double[]{-1.0, 6.0, 4.0}, 9)); + var testObject = EquationSystem.of(Equation.of(new double[]{ 2.0, 3.0, -2.0 }, 15), + Equation.of(new double[]{ 7.0, -1.0, 0.0 }, 4), + Equation.of(new double[]{ -1.0, 6.0, 4.0 }, 9)); // when String result = testObject.toString(); @@ -20,7 +20,7 @@ public void toString_ThenStringRepresentation() // then Assertions.assertThat(result) .isEqualTo("{ 2 x_0 + 3 x_1 + -2 x_2 = 15 ; 7 x_0 + -1 x_1 = 4 ; " - + "-1 x_0 + 6 x_1 + 4 x_2 = 9 }"); + + "-1 x_0 + 6 x_1 + 4 x_2 = 9 }"); } @Test @@ -28,9 +28,8 @@ public void solve_WhenSingleSolution_ThenSolution() throws Exception { // given - var testObject = EquationSystem.of(Equation.of(new double[]{2, 3, -2}, 15), - Equation.of(new double[]{7, -1, 0}, 4), - Equation.of(new double[]{-1, 6, 4}, 9)); + var testObject = EquationSystem.of(Equation.of(new double[]{ 2, 3, -2 }, 15), + Equation.of(new double[]{ 7, -1, 0 }, 4), Equation.of(new double[]{ -1, 6, 4 }, 9)); // whens double[] result = testObject.solve(); @@ -38,45 +37,44 @@ public void solve_WhenSingleSolution_ThenSolution() // then Assertions.assertThat(result).containsExactly(1, 3, -2); Assertions.assertThat(testObject.hasSolution(result)).isTrue(); - Assertions.assertThat(testObject.hasSolution(new double[]{-2, -18, -36.5})).isFalse(); + Assertions.assertThat(testObject.hasSolution(new double[]{ -2, -18, -36.5 })).isFalse(); } @Test public void solve_WhenNoSolution_ThenNoSolutionException() { // given - var testObject = EquationSystem.of(Equation.of(new double[]{2, 3, -2}, 15), - Equation.of(new double[]{7, -1, 0}, 4), - Equation.of(new double[]{-1, -1.5, 1}, -1)); + var testObject = EquationSystem.of(Equation.of(new double[]{ 2, 3, -2 }, 15), + Equation.of(new double[]{ 7, -1, 0 }, 4), + Equation.of(new double[]{ -1, -1.5, 1 }, -1)); // then Assertions.assertThatThrownBy(testObject::solve).isInstanceOf(NoSolutionException.class); - Assertions.assertThat(testObject.hasSolution(new double[]{1, 3, -2})).isFalse(); - Assertions.assertThat(testObject.hasSolution(new double[]{-2, -18, -36.5})).isFalse(); + Assertions.assertThat(testObject.hasSolution(new double[]{ 1, 3, -2 })).isFalse(); + Assertions.assertThat(testObject.hasSolution(new double[]{ -2, -18, -36.5 })).isFalse(); } @Test public void solve_WhenInfiniteSolutions_ThenInfiniteSolutionsException() { // given - var testObject = EquationSystem.of(Equation.of(new double[]{2, 3, -2}, 15), - Equation.of(new double[]{7, -1, 0}, 4), - Equation.of(new double[]{4, 6, -4}, 30)); + var testObject = EquationSystem.of(Equation.of(new double[]{ 2, 3, -2 }, 15), + Equation.of(new double[]{ 7, -1, 0 }, 4), + Equation.of(new double[]{ 4, 6, -4 }, 30)); // then Assertions.assertThatThrownBy(testObject::solve) .isInstanceOf(InfiniteSolutionsException.class); - Assertions.assertThat(testObject.hasSolution(new double[]{1, 3, -2})).isTrue(); - Assertions.assertThat(testObject.hasSolution(new double[]{-2, -18, -36.5})).isTrue(); + Assertions.assertThat(testObject.hasSolution(new double[]{ 1, 3, -2 })).isTrue(); + Assertions.assertThat(testObject.hasSolution(new double[]{ -2, -18, -36.5 })).isTrue(); } @Test public void swap_ThenEquationsSwapped() { // given - var testObject = EquationSystem.of(Equation.of(new double[]{2, 3, -2}, 15), - Equation.of(new double[]{7, -1, 0}, 4), - Equation.of(new double[]{-1, 6, 4}, 9)); + var testObject = EquationSystem.of(Equation.of(new double[]{ 2, 3, -2 }, 15), + Equation.of(new double[]{ 7, -1, 0 }, 4), Equation.of(new double[]{ -1, 6, 4 }, 9)); // when testObject.swap(0, 2); diff --git a/src/test/java/algolib/maths/EquationTest.java b/src/test/java/com/github/refhumbold/algolib/maths/EquationTest.java similarity index 91% rename from src/test/java/algolib/maths/EquationTest.java rename to src/test/java/com/github/refhumbold/algolib/maths/EquationTest.java index 54a18b0..7d4b2f5 100644 --- a/src/test/java/algolib/maths/EquationTest.java +++ b/src/test/java/com/github/refhumbold/algolib/maths/EquationTest.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.AfterEach; @@ -13,7 +13,7 @@ public class EquationTest @BeforeEach public void setUp() { - testObject = Equation.of(new double[]{2, 3, 0, -2.5}, 15); + testObject = Equation.of(new double[]{ 2, 3, 0, -2.5 }, 15); } @AfterEach @@ -39,7 +39,7 @@ public void negate_ThenNegated() public void add_ThenAddingEquations() { // when - Equation result = testObject.add(Equation.of(new double[]{1, -1, 4, 10}, 5)); + Equation result = testObject.add(Equation.of(new double[]{ 1, -1, 4, 10 }, 5)); // then Assertions.assertThat(result.getCoefficients()) @@ -52,7 +52,7 @@ public void add_ThenAddingEquations() public void subtract_ThenSubtractingEquations() { // when - Equation result = testObject.subtract(Equation.of(new double[]{1, -1, 4, 10}, 5)); + Equation result = testObject.subtract(Equation.of(new double[]{ 1, -1, 4, 10 }, 5)); // then Assertions.assertThat(result.getCoefficients()) @@ -115,7 +115,7 @@ public void toString_ThenStringRepresentation() public void hasSolution_WhenSolution_ThenTrue() { // when - boolean result = testObject.hasSolution(new double[]{10, 10, -29, 14}); + boolean result = testObject.hasSolution(new double[]{ 10, 10, -29, 14 }); // then Assertions.assertThat(result).isTrue(); @@ -125,7 +125,7 @@ public void hasSolution_WhenSolution_ThenTrue() public void hasSolution_WhenNotSolution_ThenFalse() { // when - boolean result = testObject.hasSolution(new double[]{10, 6, -17, 14}); + boolean result = testObject.hasSolution(new double[]{ 10, 6, -17, 14 }); // then Assertions.assertThat(result).isFalse(); diff --git a/src/test/java/algolib/maths/FractionTest.java b/src/test/java/com/github/refhumbold/algolib/maths/FractionTest.java similarity index 99% rename from src/test/java/algolib/maths/FractionTest.java rename to src/test/java/com/github/refhumbold/algolib/maths/FractionTest.java index 159520c..89b8307 100644 --- a/src/test/java/algolib/maths/FractionTest.java +++ b/src/test/java/com/github/refhumbold/algolib/maths/FractionTest.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/src/test/java/algolib/maths/IntegersTest.java b/src/test/java/com/github/refhumbold/algolib/maths/IntegersTest.java similarity index 99% rename from src/test/java/algolib/maths/IntegersTest.java rename to src/test/java/com/github/refhumbold/algolib/maths/IntegersTest.java index 6413de2..95eefbc 100644 --- a/src/test/java/algolib/maths/IntegersTest.java +++ b/src/test/java/com/github/refhumbold/algolib/maths/IntegersTest.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/src/test/java/algolib/maths/PrimesSearchingTest.java b/src/test/java/com/github/refhumbold/algolib/maths/PrimesSearchingTest.java similarity index 70% rename from src/test/java/algolib/maths/PrimesSearchingTest.java rename to src/test/java/com/github/refhumbold/algolib/maths/PrimesSearchingTest.java index 510fcfa..c72be53 100644 --- a/src/test/java/algolib/maths/PrimesSearchingTest.java +++ b/src/test/java/com/github/refhumbold/algolib/maths/PrimesSearchingTest.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; import java.util.Arrays; import java.util.Collection; @@ -15,15 +15,16 @@ public class PrimesSearchingTest { private static final int[] Primes = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, - 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, - 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, - 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, - 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, - 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, - 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, - 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, - 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, - 941, 947, 953, 967, 971, 977, 983, 991, 997 }; + 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, + 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, + 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, + 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, + 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, + 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, + 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, + 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, + 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, + 991, 997 }; @Test public void findPrimes_WhenSingleArgument_ThenMinIsZero() diff --git a/src/test/java/algolib/maths/PrimesTestingTest.java b/src/test/java/com/github/refhumbold/algolib/maths/PrimesTestingTest.java similarity index 98% rename from src/test/java/algolib/maths/PrimesTestingTest.java rename to src/test/java/com/github/refhumbold/algolib/maths/PrimesTestingTest.java index a1d3467..8906d5a 100644 --- a/src/test/java/algolib/maths/PrimesTestingTest.java +++ b/src/test/java/com/github/refhumbold/algolib/maths/PrimesTestingTest.java @@ -1,4 +1,4 @@ -package algolib.maths; +package com.github.refhumbold.algolib.maths; import org.assertj.core.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; diff --git a/src/test/java/algolib/sequences/LongestCommonSubsequenceTest.java b/src/test/java/com/github/refhumbold/algolib/sequences/LongestCommonSubsequenceTest.java similarity index 91% rename from src/test/java/algolib/sequences/LongestCommonSubsequenceTest.java rename to src/test/java/com/github/refhumbold/algolib/sequences/LongestCommonSubsequenceTest.java index 5a31601..faf5014 100644 --- a/src/test/java/algolib/sequences/LongestCommonSubsequenceTest.java +++ b/src/test/java/com/github/refhumbold/algolib/sequences/LongestCommonSubsequenceTest.java @@ -1,4 +1,4 @@ -package algolib.sequences; +package com.github.refhumbold.algolib.sequences; import java.util.Collections; import java.util.List; @@ -94,9 +94,7 @@ public void countLcsLength_WhenSameElementSequence_ThenShorterLength() // when int result = LongestCommonSubsequence.countLcsLength(sequence, - Stream.concat(sequence.stream(), - sequence.stream()) - .collect(Collectors.toList())); + Stream.concat(sequence.stream(), sequence.stream()).collect(Collectors.toList())); // then Assertions.assertThat(result).isEqualTo(sequence.size()); diff --git a/src/test/java/algolib/sequences/LongestIncreasingSubsequenceTest.java b/src/test/java/com/github/refhumbold/algolib/sequences/LongestIncreasingSubsequenceTest.java similarity index 87% rename from src/test/java/algolib/sequences/LongestIncreasingSubsequenceTest.java rename to src/test/java/com/github/refhumbold/algolib/sequences/LongestIncreasingSubsequenceTest.java index 2713353..b295a8e 100644 --- a/src/test/java/algolib/sequences/LongestIncreasingSubsequenceTest.java +++ b/src/test/java/com/github/refhumbold/algolib/sequences/LongestIncreasingSubsequenceTest.java @@ -1,4 +1,4 @@ -package algolib.sequences; +package com.github.refhumbold.algolib.sequences; import java.util.Collection; import java.util.List; @@ -28,7 +28,7 @@ public void findLis_WhenDecreasing_ThenLastElementOnly() // when Collection result = LongestIncreasingSubsequence.findLis(List.of(12, 10, 8, 6, 4, 2), - Integer::compareTo); + Integer::compareTo); // then Assertions.assertThat(result).containsExactly(2); @@ -40,7 +40,7 @@ public void findLis_WhenMultipleSubsequences_ThenLeastLexicographically() // when Collection result = LongestIncreasingSubsequence.findLis(List.of(2, 1, 4, 3, 6, 5, 8, 7, 10), - Integer::compareTo); + Integer::compareTo); // then Assertions.assertThat(result).containsExactly(1, 3, 5, 7, 10); @@ -52,7 +52,7 @@ public void findLis_WhenSearchInMiddle_ThenLeastLexicographically() // when Collection result = LongestIncreasingSubsequence.findLis(List.of(0, 2, 4, 6, 8, 3, 5, 7, 8), - Integer::compareTo); + Integer::compareTo); // then Assertions.assertThat(result).containsExactly(0, 2, 3, 5, 7, 8); @@ -64,7 +64,7 @@ public void findLis_WhenIncreasingAndReversedComparator_ThenLastElementOnly() // when Collection result = LongestIncreasingSubsequence.findLis(List.of(1, 3, 5, 7, 9, 11, 13, 15), - (i1, i2) -> i2.compareTo(i1)); + (i1, i2) -> i2.compareTo(i1)); // then Assertions.assertThat(result).containsExactly(15); diff --git a/src/test/java/algolib/sequences/MaximumSubarrayTest.java b/src/test/java/com/github/refhumbold/algolib/sequences/MaximumSubarrayTest.java similarity index 98% rename from src/test/java/algolib/sequences/MaximumSubarrayTest.java rename to src/test/java/com/github/refhumbold/algolib/sequences/MaximumSubarrayTest.java index d01d341..f21c2dc 100644 --- a/src/test/java/algolib/sequences/MaximumSubarrayTest.java +++ b/src/test/java/com/github/refhumbold/algolib/sequences/MaximumSubarrayTest.java @@ -1,4 +1,4 @@ -package algolib.sequences; +package com.github.refhumbold.algolib.sequences; import java.util.List; import org.assertj.core.api.Assertions; diff --git a/src/test/java/algolib/sequences/SortingTest.java b/src/test/java/com/github/refhumbold/algolib/sequences/SortingTest.java similarity index 97% rename from src/test/java/algolib/sequences/SortingTest.java rename to src/test/java/com/github/refhumbold/algolib/sequences/SortingTest.java index e2c32b3..4b304e0 100644 --- a/src/test/java/algolib/sequences/SortingTest.java +++ b/src/test/java/com/github/refhumbold/algolib/sequences/SortingTest.java @@ -1,4 +1,4 @@ -package algolib.sequences; +package com.github.refhumbold.algolib.sequences; import java.util.Arrays; import java.util.List; diff --git a/src/test/java/algolib/structures/AvlTreeTest.java b/src/test/java/com/github/refhumbold/algolib/structures/AvlTreeTest.java similarity index 99% rename from src/test/java/algolib/structures/AvlTreeTest.java rename to src/test/java/com/github/refhumbold/algolib/structures/AvlTreeTest.java index 784c5e5..060de47 100644 --- a/src/test/java/algolib/structures/AvlTreeTest.java +++ b/src/test/java/com/github/refhumbold/algolib/structures/AvlTreeTest.java @@ -1,4 +1,4 @@ -package algolib.structures; +package com.github.refhumbold.algolib.structures; import java.util.*; import java.util.stream.Collectors; diff --git a/src/test/java/algolib/structures/DisjointSetsTest.java b/src/test/java/com/github/refhumbold/algolib/structures/DisjointSetsTest.java similarity index 99% rename from src/test/java/algolib/structures/DisjointSetsTest.java rename to src/test/java/com/github/refhumbold/algolib/structures/DisjointSetsTest.java index ff5e877..a9fe800 100644 --- a/src/test/java/algolib/structures/DisjointSetsTest.java +++ b/src/test/java/com/github/refhumbold/algolib/structures/DisjointSetsTest.java @@ -1,4 +1,4 @@ -package algolib.structures; +package com.github.refhumbold.algolib.structures; import java.util.List; import java.util.NoSuchElementException; @@ -384,12 +384,10 @@ public void unionSet_WhenDifferentSetsInChain_ThenSameRepresent() int first = present.get(0); int last = present.get(present.size() - 1); - // when for(int i = 1; i < present.size(); ++i) testObject.unionSet(present.get(i - 1), present.get(i)); - // then Assertions.assertThat(testObject.isSameSet(first, last)).isTrue(); Assertions.assertThat(testObject.findSet(last)).isEqualTo(testObject.findSet(first)); diff --git a/src/test/java/algolib/structures/heaps/DoubleHeapTest.java b/src/test/java/com/github/refhumbold/algolib/structures/heaps/DoubleHeapTest.java similarity index 99% rename from src/test/java/algolib/structures/heaps/DoubleHeapTest.java rename to src/test/java/com/github/refhumbold/algolib/structures/heaps/DoubleHeapTest.java index e05b93a..42f1f09 100644 --- a/src/test/java/algolib/structures/heaps/DoubleHeapTest.java +++ b/src/test/java/com/github/refhumbold/algolib/structures/heaps/DoubleHeapTest.java @@ -1,4 +1,4 @@ -package algolib.structures.heaps; +package com.github.refhumbold.algolib.structures.heaps; import java.util.*; import org.assertj.core.api.Assertions; diff --git a/src/test/java/algolib/structures/heaps/LeftistHeapTest.java b/src/test/java/com/github/refhumbold/algolib/structures/heaps/LeftistHeapTest.java similarity index 99% rename from src/test/java/algolib/structures/heaps/LeftistHeapTest.java rename to src/test/java/com/github/refhumbold/algolib/structures/heaps/LeftistHeapTest.java index 85bd3ad..31ee020 100644 --- a/src/test/java/algolib/structures/heaps/LeftistHeapTest.java +++ b/src/test/java/com/github/refhumbold/algolib/structures/heaps/LeftistHeapTest.java @@ -1,4 +1,4 @@ -package algolib.structures.heaps; +package com.github.refhumbold.algolib.structures.heaps; import java.util.ArrayList; import java.util.Comparator; diff --git a/src/test/java/algolib/structures/heaps/PairingHeapTest.java b/src/test/java/com/github/refhumbold/algolib/structures/heaps/PairingHeapTest.java similarity index 99% rename from src/test/java/algolib/structures/heaps/PairingHeapTest.java rename to src/test/java/com/github/refhumbold/algolib/structures/heaps/PairingHeapTest.java index 12b1714..0947a6b 100644 --- a/src/test/java/algolib/structures/heaps/PairingHeapTest.java +++ b/src/test/java/com/github/refhumbold/algolib/structures/heaps/PairingHeapTest.java @@ -1,4 +1,4 @@ -package algolib.structures.heaps; +package com.github.refhumbold.algolib.structures.heaps; import java.util.ArrayList; import java.util.Comparator; diff --git a/src/test/java/algolib/text/BaseWordsMapTest.java b/src/test/java/com/github/refhumbold/algolib/text/BaseWordsMapTest.java similarity index 97% rename from src/test/java/algolib/text/BaseWordsMapTest.java rename to src/test/java/com/github/refhumbold/algolib/text/BaseWordsMapTest.java index 92be66b..168466a 100644 --- a/src/test/java/algolib/text/BaseWordsMapTest.java +++ b/src/test/java/com/github/refhumbold/algolib/text/BaseWordsMapTest.java @@ -1,10 +1,9 @@ -package algolib.text; +package com.github.refhumbold.algolib.text; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - -import algolib.tuples.Pair; +import com.github.refhumbold.algolib.tuples.Pair; // Tests: Structure of base words map using Karp-Miller-Rosenberg algorithm. public class BaseWordsMapTest diff --git a/src/test/java/algolib/text/EditDistanceTest.java b/src/test/java/com/github/refhumbold/algolib/text/EditDistanceTest.java similarity index 99% rename from src/test/java/algolib/text/EditDistanceTest.java rename to src/test/java/com/github/refhumbold/algolib/text/EditDistanceTest.java index ce7249e..f2e2503 100644 --- a/src/test/java/algolib/text/EditDistanceTest.java +++ b/src/test/java/com/github/refhumbold/algolib/text/EditDistanceTest.java @@ -1,4 +1,4 @@ -package algolib.text; +package com.github.refhumbold.algolib.text; import org.assertj.core.api.Assertions; import org.assertj.core.data.Offset; diff --git a/src/test/java/algolib/text/KnuthMorrisPrattTest.java b/src/test/java/com/github/refhumbold/algolib/text/KnuthMorrisPrattTest.java similarity index 98% rename from src/test/java/algolib/text/KnuthMorrisPrattTest.java rename to src/test/java/com/github/refhumbold/algolib/text/KnuthMorrisPrattTest.java index 41a27d7..eb82884 100644 --- a/src/test/java/algolib/text/KnuthMorrisPrattTest.java +++ b/src/test/java/com/github/refhumbold/algolib/text/KnuthMorrisPrattTest.java @@ -1,4 +1,4 @@ -package algolib.text; +package com.github.refhumbold.algolib.text; import java.util.List; import org.assertj.core.api.Assertions; diff --git a/src/test/java/algolib/text/SuffixArrayTest.java b/src/test/java/com/github/refhumbold/algolib/text/SuffixArrayTest.java similarity index 98% rename from src/test/java/algolib/text/SuffixArrayTest.java rename to src/test/java/com/github/refhumbold/algolib/text/SuffixArrayTest.java index b6583c0..14919bd 100644 --- a/src/test/java/algolib/text/SuffixArrayTest.java +++ b/src/test/java/com/github/refhumbold/algolib/text/SuffixArrayTest.java @@ -1,4 +1,4 @@ -package algolib.text; +package com.github.refhumbold.algolib.text; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.AfterEach; diff --git a/src/test/java/algolib/text/TrieTest.java b/src/test/java/com/github/refhumbold/algolib/text/TrieTest.java similarity index 99% rename from src/test/java/algolib/text/TrieTest.java rename to src/test/java/com/github/refhumbold/algolib/text/TrieTest.java index de163fc..96c2d00 100644 --- a/src/test/java/algolib/text/TrieTest.java +++ b/src/test/java/com/github/refhumbold/algolib/text/TrieTest.java @@ -1,4 +1,4 @@ -package algolib.text; +package com.github.refhumbold.algolib.text; import java.util.List; import java.util.stream.Stream; diff --git a/src/test/java/algolib/tuples/ComparablePairTest.java b/src/test/java/com/github/refhumbold/algolib/tuples/ComparablePairTest.java similarity index 98% rename from src/test/java/algolib/tuples/ComparablePairTest.java rename to src/test/java/com/github/refhumbold/algolib/tuples/ComparablePairTest.java index af05228..5c20615 100644 --- a/src/test/java/algolib/tuples/ComparablePairTest.java +++ b/src/test/java/com/github/refhumbold/algolib/tuples/ComparablePairTest.java @@ -1,4 +1,4 @@ -package algolib.tuples; +package com.github.refhumbold.algolib.tuples; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/src/test/java/algolib/tuples/ComparableTripleTest.java b/src/test/java/com/github/refhumbold/algolib/tuples/ComparableTripleTest.java similarity index 98% rename from src/test/java/algolib/tuples/ComparableTripleTest.java rename to src/test/java/com/github/refhumbold/algolib/tuples/ComparableTripleTest.java index cc2ebcd..fac39e7 100644 --- a/src/test/java/algolib/tuples/ComparableTripleTest.java +++ b/src/test/java/com/github/refhumbold/algolib/tuples/ComparableTripleTest.java @@ -1,4 +1,4 @@ -package algolib.tuples; +package com.github.refhumbold.algolib.tuples; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test;