📍Use lombok, reformat, and optimize the code (#1560)
* Use lombok, reformat, and optimize the code * Fix merge conflicts and some sonar issues Co-authored-by: va1m <va1m@email.com>
This commit is contained in:
@ -24,8 +24,7 @@
|
||||
package com.iluwatar.doubledispatch;
|
||||
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* When a message with a parameter is sent to an object, the resultant behaviour is defined by the
|
||||
@ -46,10 +45,9 @@ import org.slf4j.LoggerFactory;
|
||||
* coordinates. If there is an overlap, then the objects collide utilizing the Double Dispatch
|
||||
* pattern.
|
||||
*/
|
||||
@Slf4j
|
||||
public class App {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
||||
|
||||
/**
|
||||
* Program entry point.
|
||||
*
|
||||
|
@ -24,16 +24,14 @@
|
||||
package com.iluwatar.doubledispatch;
|
||||
|
||||
import com.iluwatar.doubledispatch.constants.AppConstants;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Meteoroid game object.
|
||||
*/
|
||||
@Slf4j
|
||||
public class Meteoroid extends GameObject {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Meteoroid.class);
|
||||
|
||||
public Meteoroid(int left, int top, int right, int bottom) {
|
||||
super(left, top, right, bottom);
|
||||
}
|
||||
|
@ -23,9 +23,14 @@
|
||||
|
||||
package com.iluwatar.doubledispatch;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Rectangle has coordinates and can be checked for overlap against other Rectangles.
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public class Rectangle {
|
||||
|
||||
private final int left;
|
||||
@ -33,32 +38,6 @@ public class Rectangle {
|
||||
private final int right;
|
||||
private final int bottom;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public Rectangle(int left, int top, int right, int bottom) {
|
||||
this.left = left;
|
||||
this.top = top;
|
||||
this.right = right;
|
||||
this.bottom = bottom;
|
||||
}
|
||||
|
||||
public int getLeft() {
|
||||
return left;
|
||||
}
|
||||
|
||||
public int getTop() {
|
||||
return top;
|
||||
}
|
||||
|
||||
public int getRight() {
|
||||
return right;
|
||||
}
|
||||
|
||||
public int getBottom() {
|
||||
return bottom;
|
||||
}
|
||||
|
||||
boolean intersectsWith(Rectangle r) {
|
||||
return !(r.getLeft() > getRight() || r.getRight() < getLeft() || r.getTop() > getBottom() || r
|
||||
.getBottom() < getTop());
|
||||
|
@ -24,16 +24,14 @@
|
||||
package com.iluwatar.doubledispatch;
|
||||
|
||||
import com.iluwatar.doubledispatch.constants.AppConstants;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Space station Mir game object.
|
||||
*/
|
||||
@Slf4j
|
||||
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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user