Skip to content

Commit 2e988b6

Browse files
author
Jegors Cemisovs
committed
Fixed gradle files
1 parent cd64289 commit 2e988b6

File tree

9 files changed

+31
-61
lines changed

9 files changed

+31
-61
lines changed

.idea/gradle.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

algorithm/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ plugins {
33
id 'java-library'
44
id 'maven-publish'
55
}
6-
sourceCompatibility = JavaVersion.VERSION_17
76

87
group 'lv.id.jc'
98
version '1.1'
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/**
2-
* The module contains an interface for a graph and an interface for a graph search algorithm.
3-
* There is an implementation of two search algorithms:
4-
* Dijkstra's algorithm and Breadth First Search algorithm.
5-
*/
61
module lv.id.jc.algorithm.graph {
72
exports lv.id.jc.algorithm.graph;
83
}

application/build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
plugins {
2+
id 'application'
3+
}
4+
5+
dependencies {
6+
implementation project(':algorithm')
7+
}
8+
9+
application {
10+
mainModule = 'lv.id.jc.application'
11+
mainClass = 'lv.id.jc.application.GraphApp'
12+
applicationDefaultJvmArgs = ['-Dgreeting.language=en']
13+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package lv.id.jc.sample;
1+
package lv.id.jc.application;
22

33
import lv.id.jc.algorithm.graph.BreadthFirstSearch;
44
import lv.id.jc.algorithm.graph.DijkstrasAlgorithm;
@@ -7,10 +7,8 @@
77

88
import java.util.Map;
99

10-
import static java.lang.System.*;
11-
1210
public class GraphApp {
13-
private static final Graph<Character> COMPLEX_GRAPH = Graph.of(Map.of(
11+
private static final Graph<Character> graph = Graph.of(Map.of(
1412
'A', Map.of('B', 5, 'H', 2),
1513
'B', Map.of('A', 5, 'C', 7),
1614
'C', Map.of('B', 7, 'D', 3, 'G', 4),
@@ -24,19 +22,16 @@ public class GraphApp {
2422
private static final SearchAlgorithm<Character> shortest = new BreadthFirstSearch<>();
2523

2624
public static void main(String[] args) {
27-
out.println(COMPLEX_GRAPH);
28-
29-
printRoute(COMPLEX_GRAPH, 'D', 'C');
30-
printRoute(COMPLEX_GRAPH, 'A', 'G');
31-
printRoute(COMPLEX_GRAPH, 'D', 'H');
25+
printRoute('D', 'C');
26+
printRoute('A', 'G');
27+
printRoute('D', 'H');
3228
}
3329

34-
private static void printRoute(final Graph<Character> graph,
35-
final Character source,
36-
final Character target) {
37-
final var routeOne = shortest.findPath(graph, source, target);
38-
final var routeTwo = fastest.findPath(graph, source, target);
39-
final var message = """
30+
@SuppressWarnings("squid:S106")
31+
private static void printRoute(Character source, Character target) {
32+
var routeOne = shortest.findPath(graph, source, target);
33+
var routeTwo = fastest.findPath(graph, source, target);
34+
var message = """
4035
4136
Find the path from %s to %s
4237
- the shortest take %.0f min and the path is %s
@@ -46,6 +41,6 @@ private static void printRoute(final Graph<Character> graph,
4641
graph.getDistance(routeOne), routeOne,
4742
graph.getDistance(routeTwo), routeTwo);
4843

49-
out.println(message);
44+
System.out.println(message);
5045
}
5146
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module lv.id.jc.application {
2+
requires lv.id.jc.algorithm.graph;
3+
exports lv.id.jc.application;
4+
}

build.gradle

Lines changed: 0 additions & 3 deletions
This file was deleted.

sample/build.gradle

Lines changed: 0 additions & 31 deletions
This file was deleted.

settings.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
rootProject.name = 'algorithms'
2-
include 'algorithm'
3-
include 'sample'
4-
1+
rootProject.name = 'graphs-algorithms'
2+
include 'algorithm', 'application'

0 commit comments

Comments
 (0)