Skip to content

Commit 5852e49

Browse files
committed
refactor: ./gradle spotlessApply
1 parent 127e210 commit 5852e49

File tree

6 files changed

+120
-88
lines changed

6 files changed

+120
-88
lines changed

lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/evanphilakhong/Formula1Car.java

Lines changed: 63 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -6,69 +6,75 @@
66
@Getter
77
@Setter
88
public class Formula1Car {
9-
private Track track;
10-
private Team team;
11-
private String[] sponsors;
12-
private String driverName;
13-
private int driverNum;
14-
private int position;
15-
private TyreCompound currTyre;
16-
private boolean drs;
9+
private Track track;
10+
private Team team;
11+
private String[] sponsors;
12+
private String driverName;
13+
private int driverNum;
14+
private int position;
15+
private TyreCompound currTyre;
16+
private boolean drs;
1717

18-
// constructors
19-
public Formula1Car() {
20-
this.team = null;
21-
this.sponsors = new String[0];
22-
this.driverName = "";
23-
this.driverNum = 0;
24-
this.currTyre = null;
25-
this.drs = false;
26-
}
18+
// constructors
19+
public Formula1Car() {
20+
this.team = null;
21+
this.sponsors = new String[0];
22+
this.driverName = "";
23+
this.driverNum = 0;
24+
this.currTyre = null;
25+
this.drs = false;
26+
}
2727

28-
public Formula1Car(Team team, String[] sponsors, String driverName, int driverNum, int position, TyreCompound currTyre) {
29-
this.team = team;
30-
this.sponsors = sponsors;
31-
this.driverName = driverName;
32-
this.driverNum = driverNum;
33-
this.position = position;
34-
this.currTyre = currTyre;
35-
this.drs = false;
36-
}
28+
public Formula1Car(
29+
Team team,
30+
String[] sponsors,
31+
String driverName,
32+
int driverNum,
33+
int position,
34+
TyreCompound currTyre) {
35+
this.team = team;
36+
this.sponsors = sponsors;
37+
this.driverName = driverName;
38+
this.driverNum = driverNum;
39+
this.position = position;
40+
this.currTyre = currTyre;
41+
this.drs = false;
42+
}
3743

38-
// methods
39-
public void printSponsors() throws NoSponsorsException {
40-
if (sponsors.length == 0) {
41-
throw new NoSponsorsException(team + " has no Sponsors");
42-
} else {
43-
System.out.println("Here's a list of our Sponsors:");
44-
for (String sponsor : sponsors) {
45-
System.out.println(sponsor);
46-
}
47-
}
44+
// methods
45+
public void printSponsors() throws NoSponsorsException {
46+
if (sponsors.length == 0) {
47+
throw new NoSponsorsException(team + " has no Sponsors");
48+
} else {
49+
System.out.println("Here's a list of our Sponsors:");
50+
for (String sponsor : sponsors) {
51+
System.out.println(sponsor);
52+
}
4853
}
54+
}
4955

50-
public boolean isDrsAvailible() {
51-
if (track.isDrsZone()) {
52-
this.drs = true;
53-
return true;
54-
}
55-
return false;
56+
public boolean isDrsAvailible() {
57+
if (track.isDrsZone()) {
58+
this.drs = true;
59+
return true;
5660
}
61+
return false;
62+
}
5763

58-
public boolean rainStrategy() {
59-
if (track.getWeather() == Weather.LIGHT_RAIN) {
60-
this.currTyre = TyreCompound.INTERMEDIATE;
61-
return true;
62-
} else if (track.getWeather() == Weather.HEAVY_RAIN) {
63-
this.currTyre = TyreCompound.WET;
64-
return true;
65-
}
66-
return false;
64+
public boolean rainStrategy() {
65+
if (track.getWeather() == Weather.LIGHT_RAIN) {
66+
this.currTyre = TyreCompound.INTERMEDIATE;
67+
return true;
68+
} else if (track.getWeather() == Weather.HEAVY_RAIN) {
69+
this.currTyre = TyreCompound.WET;
70+
return true;
6771
}
72+
return false;
73+
}
6874

69-
public static void main(String[] args) {
70-
Formula1Car formula1Car = new Formula1Car();
71-
Team team = Team.MCLAREN;
72-
formula1Car.setTeam(team);
73-
}
74-
}
75+
public static void main(String[] args) {
76+
Formula1Car formula1Car = new Formula1Car();
77+
Team team = Team.MCLAREN;
78+
formula1Car.setTeam(team);
79+
}
80+
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.codedifferently.lesson16.evanphilakhong;
22

33
public class NoSponsorsException extends Exception {
4-
public NoSponsorsException(String message) {
5-
super(message);
6-
}
7-
}
4+
public NoSponsorsException(String message) {
5+
super(message);
6+
}
7+
}
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
package com.codedifferently.lesson16.evanphilakhong;
22

33
public enum Team {
4-
ALPINE, ASTON_MARTIN, FERRARI, HASS,
5-
MCLAREN, MERCEDES, VCARB, RED_BULL,
6-
SAUBER, WILLIAMS
7-
}
4+
ALPINE,
5+
ASTON_MARTIN,
6+
FERRARI,
7+
HASS,
8+
MCLAREN,
9+
MERCEDES,
10+
VCARB,
11+
RED_BULL,
12+
SAUBER,
13+
WILLIAMS
14+
}

lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/evanphilakhong/Track.java

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,37 @@
66
@Getter
77
@Setter
88
public class Track {
9-
private String trackName;
10-
private String trackLocation;
11-
private int numLaps;
12-
private int trackLengthInKm;
13-
private boolean drsZone;
14-
private Weather weather;
9+
private String trackName;
10+
private String trackLocation;
11+
private int numLaps;
12+
private double trackLengthInKm;
13+
private boolean drsZone;
14+
private Weather weather;
1515

16-
// constructors
17-
public Track() {
18-
this.trackName = "";
19-
this.trackLocation = "";
20-
this.numLaps = 0;
21-
this.trackLengthInKm = 0;
22-
this.drsZone = false;
23-
this.weather = null;
24-
}
16+
// constructors
17+
public Track() {
18+
this.trackName = "Suzuka Circuit";
19+
this.trackLocation = "Suzuka, Japan";
20+
this.numLaps = 53;
21+
this.trackLengthInKm = 5.807;
22+
this.drsZone = false;
23+
this.weather = Weather.CLEAR;
24+
}
2525

26-
public static void main(String[] args) {
27-
28-
}
29-
}
26+
public Track(
27+
String trackName,
28+
String trackLocation,
29+
int numLaps,
30+
double trackLengthInKm,
31+
boolean drsZone,
32+
Weather weather) {
33+
this.trackName = trackName;
34+
this.trackLocation = trackLocation;
35+
this.numLaps = numLaps;
36+
this.trackLengthInKm = trackLengthInKm;
37+
this.drsZone = drsZone;
38+
this.weather = weather;
39+
}
40+
41+
public static void main(String[] args) {}
42+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package com.codedifferently.lesson16.evanphilakhong;
22

33
enum TyreCompound {
4-
SOFT, MEDIUM, HARD, INTERMEDIATE, WET
5-
}
4+
SOFT,
5+
MEDIUM,
6+
HARD,
7+
INTERMEDIATE,
8+
WET
9+
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.codedifferently.lesson16.evanphilakhong;
22

33
public enum Weather {
4-
CLEAR, LIGHT_RAIN, HEAVY_RAIN
5-
}
4+
CLEAR,
5+
LIGHT_RAIN,
6+
HEAVY_RAIN
7+
}

0 commit comments

Comments
 (0)