Skip to content

Commit 6c40cbb

Browse files
committed
Merge branch 'master' of https://github.com/eugenp/tutorials into task/BAEL-8899
# Conflicts: # testing-modules/gatling/pom.xml
2 parents 9d70db5 + 3d7a417 commit 6c40cbb

159 files changed

Lines changed: 2754 additions & 1002 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.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.baeldung.algorithms.rectanglesoverlap;
2+
3+
public class Point {
4+
5+
private int x;
6+
private int y;
7+
8+
public Point(int x, int y) {
9+
this.x = x;
10+
this.y = y;
11+
}
12+
13+
public int getX() {
14+
return x;
15+
}
16+
17+
public void setX(int x) {
18+
this.x = x;
19+
}
20+
21+
public int getY() {
22+
return y;
23+
}
24+
25+
public void setY(int y) {
26+
this.y = y;
27+
}
28+
29+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.baeldung.algorithms.rectanglesoverlap;
2+
3+
public class Rectangle {
4+
5+
private Point bottomLeft;
6+
private Point topRight;
7+
8+
public Rectangle(Point bottomLeft, Point topRight) {
9+
this.bottomLeft = bottomLeft;
10+
this.topRight = topRight;
11+
}
12+
13+
public Point getBottomLeft() {
14+
return bottomLeft;
15+
}
16+
17+
public void setBottomLeft(Point bottomLeft) {
18+
this.bottomLeft = bottomLeft;
19+
}
20+
21+
public Point getTopRight() {
22+
return topRight;
23+
}
24+
25+
public void setTopRight(Point topRight) {
26+
this.topRight = topRight;
27+
}
28+
29+
public boolean isOverlapping(Rectangle other) {
30+
// one rectangle is to the top of the other
31+
if (this.topRight.getY() < other.bottomLeft.getY() || this.bottomLeft.getY() > other.topRight.getY()) {
32+
return false;
33+
}
34+
// one rectangle is to the left of the other
35+
if (this.topRight.getX() < other.bottomLeft.getX() || this.bottomLeft.getX() > other.topRight.getX()) {
36+
return false;
37+
}
38+
return true;
39+
}
40+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.baeldung.algorithms.rectanglesoverlap;
2+
3+
import static org.junit.Assert.assertTrue;
4+
import static org.junit.Assert.assertFalse;
5+
import org.junit.Test;
6+
7+
import com.baeldung.algorithms.rectanglesoverlap.Point;
8+
import com.baeldung.algorithms.rectanglesoverlap.Rectangle;
9+
10+
public class RectangleUnitTest {
11+
12+
@Test
13+
public void givenTwoOverlappingRectangles_whenisOverlappingCalled_shouldReturnTrue() {
14+
Rectangle rectangle1 = new Rectangle(new Point(2, 1), new Point(4, 3));
15+
Rectangle rectangle2 = new Rectangle(new Point(1, 1), new Point(6, 4));
16+
assertTrue(rectangle1.isOverlapping(rectangle2));
17+
18+
rectangle1 = new Rectangle(new Point(-5, -2), new Point(2, 3));
19+
rectangle2 = new Rectangle(new Point(-2, -1), new Point(5, 2));
20+
assertTrue(rectangle1.isOverlapping(rectangle2));
21+
22+
rectangle1 = new Rectangle(new Point(-5, 1), new Point(2, 4));
23+
rectangle2 = new Rectangle(new Point(-2, -2), new Point(5, 5));
24+
assertTrue(rectangle1.isOverlapping(rectangle2));
25+
}
26+
27+
@Test
28+
public void givenTwoNonOverlappingRectangles_whenisOverlappingCalled_shouldReturnFalse() {
29+
Rectangle rectangle1 = new Rectangle(new Point(-5, 1), new Point(-3, 4));
30+
Rectangle rectangle2 = new Rectangle(new Point(-2, -2), new Point(5, 5));
31+
assertFalse(rectangle1.isOverlapping(rectangle2));
32+
33+
rectangle1 = new Rectangle(new Point(-5, 1), new Point(3, 4));
34+
rectangle2 = new Rectangle(new Point(-2, -2), new Point(5, -1));
35+
assertFalse(rectangle1.isOverlapping(rectangle2));
36+
37+
rectangle1 = new Rectangle(new Point(-2, 1), new Point(0, 3));
38+
rectangle2 = new Rectangle(new Point(3, 1), new Point(5, 4));
39+
assertFalse(rectangle1.isOverlapping(rectangle2));
40+
}
41+
42+
}

‎aws-lambda/pom.xml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
<gson.version>2.8.2</gson.version>
9696
<aws-java-sdk.version>1.11.241</aws-java-sdk.version>
9797
<maven-shade-plugin.version>3.0.0</maven-shade-plugin.version>
98-
<maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
9998
</properties>
10099

101100
</project>

‎aws/pom.xml‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,26 +100,6 @@
100100
</execution>
101101
</executions>
102102
</plugin>
103-
104-
<plugin>
105-
<groupId>org.apache.maven.plugins</groupId>
106-
<artifactId>maven-dependency-plugin</artifactId>
107-
<version>${maven-dependency-plugin.version}</version>
108-
<executions>
109-
<execution>
110-
<id>copy-dependencies</id>
111-
<phase>test-compile</phase>
112-
<goals>
113-
<goal>copy-dependencies</goal>
114-
</goals>
115-
<configuration>
116-
<includeScope>test</includeScope>
117-
<includeTypes>so,dll,dylib</includeTypes>
118-
<outputDirectory>${project.basedir}/native-libs</outputDirectory>
119-
</configuration>
120-
</execution>
121-
</executions>
122-
</plugin>
123103
</plugins>
124104
</build>
125105

@@ -144,7 +124,6 @@
144124
<commons-codec-version>1.10.L001</commons-codec-version>
145125
<jets3t-version>0.9.4.0006L</jets3t-version>
146126
<maven-shade-plugin.version>3.0.0</maven-shade-plugin.version>
147-
<maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
148127
</properties>
149128

150129
</project>

‎checker-plugin/pom.xml‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,6 @@
4141

4242
<build>
4343
<plugins>
44-
<plugin>
45-
<!-- This plugin will set properties values using dependency information -->
46-
<groupId>org.apache.maven.plugins</groupId>
47-
<artifactId>maven-dependency-plugin</artifactId>
48-
<executions>
49-
<execution>
50-
<goals>
51-
<!--
52-
Goal that sets a property pointing to the artifact file for each project dependency.
53-
For each dependency (direct and transitive) a project property will be set which
54-
follows the:
55-
56-
groupId:artifactId:type:[classifier]
57-
58-
form and contains the path to the resolved artifact. -->
59-
<goal>properties</goal>
60-
</goals>
61-
</execution>
62-
</executions>
63-
</plugin>
64-
6544
<plugin>
6645
<artifactId>maven-compiler-plugin</artifactId>
6746
<version>${maven-compiler-plugin.version}</version>

‎core-java-8/pom.xml‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,6 @@
116116
</resources>
117117

118118
<plugins>
119-
<plugin>
120-
<groupId>org.apache.maven.plugins</groupId>
121-
<artifactId>maven-dependency-plugin</artifactId>
122-
<executions>
123-
<execution>
124-
<id>copy-dependencies</id>
125-
<phase>prepare-package</phase>
126-
<goals>
127-
<goal>copy-dependencies</goal>
128-
</goals>
129-
<configuration>
130-
<outputDirectory>${project.build.directory}/libs</outputDirectory>
131-
</configuration>
132-
</execution>
133-
</executions>
134-
</plugin>
135-
136119
<plugin>
137120
<groupId>org.apache.maven.plugins</groupId>
138121
<artifactId>maven-compiler-plugin</artifactId>

‎core-java-concurrency-collections/pom.xml‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,6 @@
5757
<filtering>true</filtering>
5858
</resource>
5959
</resources>
60-
61-
<plugins>
62-
<plugin>
63-
<groupId>org.apache.maven.plugins</groupId>
64-
<artifactId>maven-dependency-plugin</artifactId>
65-
<executions>
66-
<execution>
67-
<id>copy-dependencies</id>
68-
<phase>prepare-package</phase>
69-
<goals>
70-
<goal>copy-dependencies</goal>
71-
</goals>
72-
<configuration>
73-
<outputDirectory>${project.build.directory}/libs</outputDirectory>
74-
</configuration>
75-
</execution>
76-
</executions>
77-
</plugin>
78-
79-
</plugins>
8060
</build>
8161

8262
<properties>

‎core-java-concurrency/pom.xml‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,6 @@
5757
<filtering>true</filtering>
5858
</resource>
5959
</resources>
60-
61-
<plugins>
62-
<plugin>
63-
<groupId>org.apache.maven.plugins</groupId>
64-
<artifactId>maven-dependency-plugin</artifactId>
65-
<executions>
66-
<execution>
67-
<id>copy-dependencies</id>
68-
<phase>prepare-package</phase>
69-
<goals>
70-
<goal>copy-dependencies</goal>
71-
</goals>
72-
<configuration>
73-
<outputDirectory>${project.build.directory}/libs</outputDirectory>
74-
</configuration>
75-
</execution>
76-
</executions>
77-
</plugin>
78-
79-
</plugins>
8060
</build>
8161

8262
<properties>

‎core-java-sun/pom.xml‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -166,22 +166,6 @@
166166
</resource>
167167
</resources>
168168
<plugins>
169-
<plugin>
170-
<groupId>org.apache.maven.plugins</groupId>
171-
<artifactId>maven-dependency-plugin</artifactId>
172-
<executions>
173-
<execution>
174-
<id>copy-dependencies</id>
175-
<phase>prepare-package</phase>
176-
<goals>
177-
<goal>copy-dependencies</goal>
178-
</goals>
179-
<configuration>
180-
<outputDirectory>${project.build.directory}/libs</outputDirectory>
181-
</configuration>
182-
</execution>
183-
</executions>
184-
</plugin>
185169
<plugin>
186170
<groupId>org.apache.maven.plugins</groupId>
187171
<artifactId>maven-jar-plugin</artifactId>

0 commit comments

Comments
 (0)