Adjust checkstyle rules. Make checkstyle fail the build when violations are found. Correct all current checkstyle violations.
This commit is contained in:
@ -18,15 +18,13 @@ public class App {
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
scenario(jenkins, 1);
|
||||
scenario(travis, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Can add a List with enum Actions for variable scenarios
|
||||
*/
|
||||
public static void scenario(Servant servant, int compliment) {
|
||||
@ -44,16 +42,18 @@ public class App {
|
||||
servant.giveWine(k);
|
||||
servant.giveWine(q);
|
||||
// compliment
|
||||
servant.GiveCompliments(guests.get(compliment));
|
||||
servant.giveCompliments(guests.get(compliment));
|
||||
|
||||
// outcome of the night
|
||||
for (Royalty r : guests)
|
||||
for (Royalty r : guests) {
|
||||
r.changeMood();
|
||||
}
|
||||
|
||||
// check your luck
|
||||
if (servant.checkIfYouWillBeHanged(guests))
|
||||
if (servant.checkIfYouWillBeHanged(guests)) {
|
||||
System.out.println(servant.name + " will live another day");
|
||||
else
|
||||
} else {
|
||||
System.out.println("Poor " + servant.name + ". His days are numbered");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,10 +28,12 @@ public class King implements Royalty {
|
||||
|
||||
@Override
|
||||
public void changeMood() {
|
||||
if (!isHungry && isDrunk)
|
||||
if (!isHungry && isDrunk) {
|
||||
isHappy = true;
|
||||
if (complimentReceived)
|
||||
}
|
||||
if (complimentReceived) {
|
||||
isHappy = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,8 +29,9 @@ public class Queen implements Royalty {
|
||||
|
||||
@Override
|
||||
public void changeMood() {
|
||||
if (complimentReceived && isFlirty && isDrunk)
|
||||
if (complimentReceived && isFlirty && isDrunk) {
|
||||
isHappy = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,6 +11,9 @@ public class Servant {
|
||||
|
||||
public String name;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Servant(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
@ -23,15 +26,20 @@ public class Servant {
|
||||
r.getDrink();
|
||||
}
|
||||
|
||||
public void GiveCompliments(Royalty r) {
|
||||
public void giveCompliments(Royalty r) {
|
||||
r.receiveCompliments();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we will be hanged
|
||||
*/
|
||||
public boolean checkIfYouWillBeHanged(ArrayList<Royalty> tableGuests) {
|
||||
boolean anotherDay = true;
|
||||
for (Royalty r : tableGuests)
|
||||
if (!r.getMood())
|
||||
for (Royalty r : tableGuests) {
|
||||
if (!r.getMood()) {
|
||||
anotherDay = false;
|
||||
}
|
||||
}
|
||||
|
||||
return anotherDay;
|
||||
}
|
||||
|
Reference in New Issue
Block a user