mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 10:59:03 +00:00
#502 Replaced usages of System.out with logger.
This commit is contained in:
@@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.doubledispatch;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* Space station Mir game object
|
||||
@@ -29,6 +32,8 @@ package com.iluwatar.doubledispatch;
|
||||
*/
|
||||
public class SpaceStationMir extends GameObject {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SpaceStationMir.class);
|
||||
|
||||
public SpaceStationMir(int left, int top, int right, int bottom) {
|
||||
super(left, top, right, bottom);
|
||||
}
|
||||
@@ -40,31 +45,30 @@ public class SpaceStationMir extends GameObject {
|
||||
|
||||
@Override
|
||||
public void collisionResolve(FlamingAsteroid asteroid) {
|
||||
System.out.println(String.format("%s hits %s. %s is damaged! %s is set on fire!", asteroid
|
||||
.getClass().getSimpleName(), this.getClass().getSimpleName(), this.getClass()
|
||||
.getSimpleName(), this.getClass().getSimpleName()));
|
||||
LOGGER.info("{} hits {}. {} is damaged! {} is set on fire!", asteroid.getClass().getSimpleName(),
|
||||
this.getClass().getSimpleName(), this.getClass().getSimpleName(), this.getClass().getSimpleName());
|
||||
setDamaged(true);
|
||||
setOnFire(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collisionResolve(Meteoroid meteoroid) {
|
||||
System.out.println(String.format("%s hits %s. %s is damaged!", meteoroid.getClass()
|
||||
.getSimpleName(), this.getClass().getSimpleName(), this.getClass().getSimpleName()));
|
||||
LOGGER.info("{} hits {}. {} is damaged!", meteoroid.getClass().getSimpleName(),
|
||||
this.getClass().getSimpleName(), this.getClass().getSimpleName());
|
||||
setDamaged(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collisionResolve(SpaceStationMir mir) {
|
||||
System.out.println(String.format("%s hits %s. %s is damaged!", mir.getClass().getSimpleName(),
|
||||
this.getClass().getSimpleName(), this.getClass().getSimpleName()));
|
||||
LOGGER.info("{} hits {}. {} is damaged!", mir.getClass().getSimpleName(),
|
||||
this.getClass().getSimpleName(), this.getClass().getSimpleName());
|
||||
setDamaged(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collisionResolve(SpaceStationIss iss) {
|
||||
System.out.println(String.format("%s hits %s. %s is damaged!", iss.getClass().getSimpleName(),
|
||||
this.getClass().getSimpleName(), this.getClass().getSimpleName()));
|
||||
LOGGER.info("{} hits {}. {} is damaged!", iss.getClass().getSimpleName(),
|
||||
this.getClass().getSimpleName(), this.getClass().getSimpleName());
|
||||
setDamaged(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user