Adjust checkstyle rules. Make checkstyle fail the build when violations are found. Correct all current checkstyle violations.

This commit is contained in:
Ilkka Seppala
2015-12-25 23:49:28 +02:00
parent 9fbb085985
commit cec9a99410
167 changed files with 1242 additions and 969 deletions

View File

@ -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");
}
}
}

View File

@ -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

View File

@ -29,8 +29,9 @@ public class Queen implements Royalty {
@Override
public void changeMood() {
if (complimentReceived && isFlirty && isDrunk)
if (complimentReceived && isFlirty && isDrunk) {
isHappy = true;
}
}
@Override

View File

@ -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;
}