Skip to content

Commit ea25895

Browse files
committed
Fixed conflicts
2 parents d737e15 + 0f443d3 commit ea25895

310 files changed

Lines changed: 5197 additions & 1333 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

JGit/src/main/java/com/baeldung/jgit/porcelain/Log.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ public static void main(String[] args) throws IOException, GitAPIException {
2828
System.out.println("Had " + count + " commits overall on current branch");
2929

3030
logs = git.log()
31-
.add(repository.resolve("remotes/origin/testbranch"))
31+
.add(repository.resolve(git.getRepository().getFullBranch()))
3232
.call();
3333
count = 0;
3434
for (RevCommit rev : logs) {
3535
System.out.println("Commit: " + rev /* + ", name: " + rev.getName() + ", id: " + rev.getId().getName() */);
3636
count++;
3737
}
38-
System.out.println("Had " + count + " commits overall on test-branch");
38+
System.out.println("Had " + count + " commits overall on "+git.getRepository().getFullBranch());
3939

4040
logs = git.log()
4141
.all()

JGit/src/test/java/com/baeldung/jgit/JGitBugIntegrationTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package com.baeldung.jgit;
2+
13
import com.baeldung.jgit.helper.Helper;
24
import org.eclipse.jgit.lib.ObjectLoader;
35
import org.eclipse.jgit.lib.ObjectReader;

java-strings/src/main/java/com/baeldung/string/SubstringPalindrome.java renamed to algorithms-miscellaneous-1/src/main/java/com/baeldung/algorithms/string/SubstringPalindrome.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.string;
1+
package com.baeldung.algorithms.string;
22

33
import java.util.HashSet;
44
import java.util.Set;

java-strings/src/test/java/com/baeldung/string/SubstringPalindromeUnitTest.java renamed to algorithms-miscellaneous-1/src/test/java/com/baeldung/algorithms/string/SubstringPalindromeUnitTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.string;
1+
package com.baeldung.algorithms.string;
22

33
import static org.junit.Assert.assertEquals;
44
import java.util.HashSet;

algorithms-miscellaneous-2/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
<artifactId>jgrapht-core</artifactId>
3434
<version>${org.jgrapht.core.version}</version>
3535
</dependency>
36+
<dependency>
37+
<groupId>org.jgrapht</groupId>
38+
<artifactId>jgrapht-ext</artifactId>
39+
<version>${org.jgrapht.ext.version}</version>
40+
</dependency>
3641
<dependency>
3742
<groupId>pl.allegro.finance</groupId>
3843
<artifactId>tradukisto</artifactId>
@@ -83,6 +88,7 @@
8388
<commons-math3.version>3.6.1</commons-math3.version>
8489
<tradukisto.version>1.0.1</tradukisto.version>
8590
<org.jgrapht.core.version>1.0.1</org.jgrapht.core.version>
91+
<org.jgrapht.ext.version>1.0.1</org.jgrapht.ext.version>
8692
<org.assertj.core.version>3.9.0</org.assertj.core.version>
8793
<commons-codec.version>1.11</commons-codec.version>
8894
</properties>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package com.baeldung.jgrapht;
2+
3+
import static org.junit.Assert.assertTrue;
4+
import java.awt.Color;
5+
import java.awt.image.BufferedImage;
6+
import java.io.File;
7+
import java.io.IOException;
8+
import javax.imageio.ImageIO;
9+
import org.jgrapht.ext.JGraphXAdapter;
10+
import org.jgrapht.graph.DefaultDirectedGraph;
11+
import org.jgrapht.graph.DefaultEdge;
12+
import org.junit.Before;
13+
import org.junit.Test;
14+
import com.mxgraph.layout.mxCircleLayout;
15+
import com.mxgraph.layout.mxIGraphLayout;
16+
import com.mxgraph.util.mxCellRenderer;
17+
18+
public class GraphImageGenerationUnitTest {
19+
static DefaultDirectedGraph<String, DefaultEdge> g;
20+
21+
@Before
22+
public void createGraph() throws IOException {
23+
File imgFile = new File("src/test/resources/graph.png");
24+
imgFile.createNewFile();
25+
g = new DefaultDirectedGraph<String, DefaultEdge>(DefaultEdge.class);
26+
String x1 = "x1";
27+
String x2 = "x2";
28+
String x3 = "x3";
29+
g.addVertex(x1);
30+
g.addVertex(x2);
31+
g.addVertex(x3);
32+
g.addEdge(x1, x2);
33+
g.addEdge(x2, x3);
34+
g.addEdge(x3, x1);
35+
}
36+
37+
@Test
38+
public void givenAdaptedGraph_whenWriteBufferedImage_ThenFileShouldExist() throws IOException {
39+
JGraphXAdapter<String, DefaultEdge> graphAdapter = new JGraphXAdapter<String, DefaultEdge>(g);
40+
mxIGraphLayout layout = new mxCircleLayout(graphAdapter);
41+
layout.execute(graphAdapter.getDefaultParent());
42+
File imgFile = new File("src/test/resources/graph.png");
43+
BufferedImage image = mxCellRenderer.createBufferedImage(graphAdapter, null, 2, Color.WHITE, true, null);
44+
ImageIO.write(image, "PNG", imgFile);
45+
assertTrue(imgFile.exists());
46+
}
47+
}
9.15 KB
Loading

algorithms-sorting/src/main/java/com/baeldung/algorithms/mergesort/MergeSort.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static void merge(int[] a, int[] l, int[] r, int left, int right) {
3434

3535
while (i < left && j < right) {
3636

37-
if (l[i] < r[j])
37+
if (l[i] <= r[j])
3838
a[k++] = l[i++];
3939
else
4040
a[k++] = r[j++];
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/local/bin/java --source 11
2+
3+
import java.util.Arrays;
4+
5+
public class Addition
6+
{
7+
public static void main(String[] args) {
8+
System.out.println(Arrays.stream(args)
9+
.mapToInt(Integer::parseInt)
10+
.sum());
11+
}
12+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.baeldung.interfaces.multiinheritance;
2+
3+
public abstract interface Fly{
4+
void fly();
5+
}

0 commit comments

Comments
 (0)