📍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:
va1m
2021-03-13 13:19:21 +01:00
committed by GitHub
parent 0e26a6adb5
commit 5cf2fe009b
681 changed files with 2472 additions and 4966 deletions

View File

@ -24,8 +24,7 @@
package com.iluwatar.data.locality;
import com.iluwatar.data.locality.game.GameEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* Use the Data Locality pattern is when you have a performance problem. Take advantage of that to
@ -35,10 +34,9 @@ import org.slf4j.LoggerFactory;
* <p>Example: Game loop that processes a bunch of game entities. Those entities are decomposed
* into different domainsAI, physics, and renderingusing the Component pattern.
*/
@Slf4j
public class Application {
private static final Logger LOGGER = LoggerFactory.getLogger(Application.class);
private static final int NUM_ENTITIES = 5;
/**

View File

@ -26,8 +26,7 @@ package com.iluwatar.data.locality.game;
import com.iluwatar.data.locality.game.component.manager.AiComponentManager;
import com.iluwatar.data.locality.game.component.manager.PhysicsComponentManager;
import com.iluwatar.data.locality.game.component.manager.RenderComponentManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* The game Entity maintains a big array of pointers . Each spin of the game loop, we need to run
@ -39,8 +38,8 @@ import org.slf4j.LoggerFactory;
*
* <p>Render them using their render components.
*/
@Slf4j
public class GameEntity {
private static final Logger LOGGER = LoggerFactory.getLogger(GameEntity.class);
private final AiComponentManager aiComponentManager;
private final PhysicsComponentManager physicsComponentManager;

View File

@ -23,16 +23,14 @@
package com.iluwatar.data.locality.game.component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* Implementation of AI component for Game.
*/
@Slf4j
public class AiComponent implements Component {
private static final Logger LOGGER = LoggerFactory.getLogger(AiComponent.class);
/**
* Update ai component.
*/

View File

@ -23,16 +23,14 @@
package com.iluwatar.data.locality.game.component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* Implementation of Physics Component of Game.
*/
@Slf4j
public class PhysicsComponent implements Component {
private static final Logger LOGGER = LoggerFactory.getLogger(PhysicsComponent.class);
/**
* update physics component of game.
*/

View File

@ -23,16 +23,14 @@
package com.iluwatar.data.locality.game.component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* Implementation of Render Component of Game.
*/
@Slf4j
public class RenderComponent implements Component {
private static final Logger LOGGER = LoggerFactory.getLogger(RenderComponent.class);
@Override
public void update() {
// do nothing

View File

@ -26,16 +26,14 @@ package com.iluwatar.data.locality.game.component.manager;
import com.iluwatar.data.locality.game.component.AiComponent;
import com.iluwatar.data.locality.game.component.Component;
import java.util.stream.IntStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* AI component manager for Game.
*/
@Slf4j
public class AiComponentManager {
private static final Logger LOGGER = LoggerFactory.getLogger(AiComponentManager.class);
private static final int MAX_ENTITIES = 10000;
private final int numEntities;

View File

@ -26,16 +26,14 @@ package com.iluwatar.data.locality.game.component.manager;
import com.iluwatar.data.locality.game.component.Component;
import com.iluwatar.data.locality.game.component.PhysicsComponent;
import java.util.stream.IntStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* Physics component Manager for Game.
*/
@Slf4j
public class PhysicsComponentManager {
private static final Logger LOGGER = LoggerFactory.getLogger(PhysicsComponentManager.class);
private static final int MAX_ENTITIES = 10000;
private final int numEntities;

View File

@ -26,16 +26,14 @@ package com.iluwatar.data.locality.game.component.manager;
import com.iluwatar.data.locality.game.component.Component;
import com.iluwatar.data.locality.game.component.RenderComponent;
import java.util.stream.IntStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* Render component manager for Game.
*/
@Slf4j
public class RenderComponentManager {
private static final Logger LOGGER = LoggerFactory.getLogger(RenderComponentManager.class);
private static final int MAX_ENTITIES = 10000;
private final int numEntities;

View File

@ -42,6 +42,6 @@ class ApplicationTest {
@Test
void shouldExecuteGameApplicationWithoutException() {
assertDoesNotThrow(() -> Application.main(new String[] {}));
assertDoesNotThrow(() -> Application.main(new String[]{}));
}
}