Skip to content

Commit b6d2ec1

Browse files
committed
Reformat code
1 parent 7683581 commit b6d2ec1

File tree

240 files changed

+3182
-3087
lines changed

Some content is hidden

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

240 files changed

+3182
-3087
lines changed

README.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# adventOfCode(Language.JAVA)
22

33
## 2022
4+
45
### Days
6+
57
- [Day 1](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year22/days/Day1.java)
68
- [Day 2](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year22/days/Day2.java)
79
- [Day 3](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year22/days/Day3.java)
@@ -29,6 +31,7 @@
2931
- [Day 25](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year22/days/Day25.java)
3032

3133
### Console output
34+
3235
```
3336
Day 1:
3437
Part 1: 67633
@@ -138,7 +141,9 @@ Part 2: The More The Merrier
138141
```
139142

140143
## 2021
144+
141145
### Days
146+
142147
- [Day 1](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year21/days/Day1.java)
143148
- [Day 2](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year21/days/Day2.java)
144149
- [Day 3](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year21/days/Day3.java)
@@ -166,6 +171,7 @@ Part 2: The More The Merrier
166171
- [Day 25](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year21/days/Day25.java)
167172

168173
### Console output
174+
169175
```
170176
Day 1:
171177
Part 1: 1184
@@ -276,7 +282,9 @@ Part 2: Merry Christmas
276282
```
277283

278284
## 2020
285+
279286
### Days
287+
280288
- [Day 1](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year20/days/Day1.java)
281289
- [Day 2](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year20/days/Day2.java)
282290
- [Day 3](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year20/days/Day3.java)
@@ -304,6 +312,7 @@ Part 2: Merry Christmas
304312
- [Day 25](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year20/days/Day25.java)
305313

306314
### Console output
315+
307316
```
308317
Day 1:
309318
Part 1: 270144
@@ -407,7 +416,9 @@ Part 2: That's all folks
407416
```
408417

409418
## 2019
419+
410420
### Days
421+
411422
- [Day 1](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year19/days/Day1.java)
412423
- [Day 2](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year19/days/Day2.java)
413424
- [Day 3](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year19/days/Day3.java)
@@ -435,7 +446,10 @@ Part 2: That's all folks
435446
- [Day 25](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year19/days/Day25.java)
436447

437448
### Console output
438-
Output of running [Main.java](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode2019/Main.java):
449+
450+
Output of
451+
running [Main.java](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode2019/Main.java):
452+
439453
```
440454
Day 1:
441455
Part 1: 3514064
@@ -551,9 +565,11 @@ Part 2: MERRY CHRISTMAS!!
551565
```
552566

553567
## 2018
568+
554569
I never did the 2018 advent of code puzzles when the event was ongoing. I'm just doing them whenever I feel like it :)
555570

556571
### Days
572+
557573
- [Day 1](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year18/days/Day1.java)
558574
- [Day 2](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year18/days/Day2.java)
559575
- [Day 3](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year18/days/Day3.java)
@@ -581,6 +597,7 @@ I never did the 2018 advent of code puzzles when the event was ongoing. I'm just
581597
- [Day 25](https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year18/days/Day25.java)
582598

583599
### Console output
600+
584601
```
585602
Day 1:
586603
Part 1: 433

pom.xml

+44-44
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5-
<modelVersion>4.0.0</modelVersion>
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>com.sbaars</groupId>
8-
<artifactId>adventofcode</artifactId>
9-
<version>1.0</version>
10-
<build>
11-
<plugins>
12-
<plugin>
13-
<groupId>org.apache.maven.plugins</groupId>
14-
<artifactId>maven-compiler-plugin</artifactId>
15-
<configuration>
16-
<source>17</source>
17-
<target>17</target>
18-
</configuration>
19-
</plugin>
20-
</plugins>
21-
</build>
22-
<packaging>jar</packaging>
7+
<groupId>com.sbaars</groupId>
8+
<artifactId>adventofcode</artifactId>
9+
<version>1.0</version>
10+
<build>
11+
<plugins>
12+
<plugin>
13+
<groupId>org.apache.maven.plugins</groupId>
14+
<artifactId>maven-compiler-plugin</artifactId>
15+
<configuration>
16+
<source>17</source>
17+
<target>17</target>
18+
</configuration>
19+
</plugin>
20+
</plugins>
21+
</build>
22+
<packaging>jar</packaging>
2323

24-
<name>adventofcode</name>
25-
<url>http://maven.apache.org</url>
24+
<name>adventofcode</name>
25+
<url>http://maven.apache.org</url>
2626

27-
<dependencies>
28-
<dependency>
29-
<groupId>org.junit.jupiter</groupId>
30-
<artifactId>junit-jupiter-engine</artifactId>
31-
<version>5.4.0</version>
32-
<scope>test</scope>
33-
</dependency>
34-
<dependency>
35-
<groupId>com.google.mug</groupId>
36-
<artifactId>mug</artifactId>
37-
<version>6.5</version>
38-
</dependency>
39-
<dependency>
40-
<groupId>org.apache.commons</groupId>
41-
<artifactId>commons-lang3</artifactId>
42-
<version>3.12.0</version>
43-
</dependency>
44-
<dependency>
45-
<groupId>net.sourceforge.htmlcleaner</groupId>
46-
<artifactId>htmlcleaner</artifactId>
47-
<version>2.26</version>
48-
</dependency>
49-
</dependencies>
27+
<dependencies>
28+
<dependency>
29+
<groupId>org.junit.jupiter</groupId>
30+
<artifactId>junit-jupiter-engine</artifactId>
31+
<version>5.4.0</version>
32+
<scope>test</scope>
33+
</dependency>
34+
<dependency>
35+
<groupId>com.google.mug</groupId>
36+
<artifactId>mug</artifactId>
37+
<version>6.5</version>
38+
</dependency>
39+
<dependency>
40+
<groupId>org.apache.commons</groupId>
41+
<artifactId>commons-lang3</artifactId>
42+
<version>3.12.0</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>net.sourceforge.htmlcleaner</groupId>
46+
<artifactId>htmlcleaner</artifactId>
47+
<version>2.26</version>
48+
</dependency>
49+
</dependencies>
5050
</project>
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package com.sbaars.adventofcode.common;
22

33
public class AtomicDouble {
4-
double d;
4+
double d;
55

6-
public AtomicDouble(double d) {
7-
this.d = d;
8-
}
6+
public AtomicDouble(double d) {
7+
this.d = d;
8+
}
99

10-
public void set(double d) {
11-
this.d = d;
12-
}
10+
public void set(double d) {
11+
this.d = d;
12+
}
1313

14-
public double get() {
15-
return d;
16-
}
14+
public double get() {
15+
return d;
16+
}
1717
}

src/main/java/com/sbaars/adventofcode/common/Builder.java

+47-47
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,63 @@
44
import java.util.function.Supplier;
55

66
public class Builder<E> {
7-
private E e;
8-
private E newE;
9-
private Class<E> c;
10-
private Supplier<E> s;
7+
private E e;
8+
private E newE;
9+
private Class<E> c;
10+
private Supplier<E> s;
1111

12-
public Builder(E e) {
13-
this.e = e;
14-
}
12+
public Builder(E e) {
13+
this.e = e;
14+
}
1515

16-
public Builder(E e, Supplier<E> s) {
17-
this(s);
18-
this.e = e;
19-
}
16+
public Builder(E e, Supplier<E> s) {
17+
this(s);
18+
this.e = e;
19+
}
2020

21-
public Builder(Class<E> c, Object...o) {
22-
this.c = c;
23-
this.e = getFromClass(o);
24-
this.newE = getFromClass();
25-
}
21+
public Builder(Class<E> c, Object... o) {
22+
this.c = c;
23+
this.e = getFromClass(o);
24+
this.newE = getFromClass();
25+
}
2626

27-
public Builder(Supplier<E> s) {
28-
this.s = s;
29-
this.e = s.get();
30-
this.newE = s.get();
31-
}
27+
public Builder(Supplier<E> s) {
28+
this.s = s;
29+
this.e = s.get();
30+
this.newE = s.get();
31+
}
3232

33-
public E getFromClass(Object...o) {
34-
try {
35-
return (E) Arrays.stream(c.getConstructors()).filter(e -> e.getParameterCount() == o.length).findAny().orElseThrow().newInstance(o);
36-
} catch (Exception ex) {
37-
throw new IllegalStateException(ex);
38-
}
33+
public E getFromClass(Object... o) {
34+
try {
35+
return (E) Arrays.stream(c.getConstructors()).filter(e -> e.getParameterCount() == o.length).findAny().orElseThrow().newInstance(o);
36+
} catch (Exception ex) {
37+
throw new IllegalStateException(ex);
3938
}
39+
}
4040

41-
public void setSupplier(Supplier<E> s) {
42-
this.s = s;
43-
if(newE == null) newE = s.get();
44-
}
41+
public void setSupplier(Supplier<E> s) {
42+
this.s = s;
43+
if (newE == null) newE = s.get();
44+
}
4545

46-
public E get() {
47-
return e;
48-
}
46+
public E get() {
47+
return e;
48+
}
4949

50-
public E getNew() {
51-
return newE;
52-
}
50+
public E getNew() {
51+
return newE;
52+
}
5353

54-
public void refresh(){
55-
e = newE;
56-
if(s != null) {
57-
newE = s.get();
58-
} else if(c != null) {
59-
newE = getFromClass();
60-
}
54+
public void refresh() {
55+
e = newE;
56+
if (s != null) {
57+
newE = s.get();
58+
} else if (c != null) {
59+
newE = getFromClass();
6160
}
61+
}
6262

63-
public void setNew(E e) {
64-
newE = e;
65-
}
63+
public void setNew(E e) {
64+
newE = e;
65+
}
6666
}

src/main/java/com/sbaars/adventofcode/common/CircularLinkedList.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
public class CircularLinkedList {
1010
public final Map<Integer, Node> valueMap = new HashMap<>();
1111
private Node current;
12+
1213
public CircularLinkedList(int[] elements) {
1314
Node prev = null;
1415
Node first = null;
@@ -60,7 +61,7 @@ public void insertAfter(Node s1, Node s2, int dest) {
6061
}
6162

6263
public void insertAfter(Node s1, Node s2) {
63-
if(s1 == s2) return;
64+
if (s1 == s2) return;
6465
s1.prev.next = s1.next;
6566
s1.next.prev = s1.prev;
6667
s2.next.next.prev = s1;
@@ -80,6 +81,7 @@ public int[] toArray() {
8081
public void setCurrent(int value) {
8182
current = valueMap.get(value);
8283
}
84+
8385
public void setCurrent(Node n) {
8486
current = n;
8587
}

0 commit comments

Comments
 (0)