Resolves checkstyle errors for delegation dependency-injection dirty-flag double-buffer double-checked-locking double-dispatch (#1068)

* Reduces checkstyle errors in delegation

* Reduces checkstyle errors in dependency-injection

* Reduces checkstyle errors in dirty-flag

* Reduces checkstyle errors in double-buffer

* Reduces checkstyle errors in double-checked-locking

* Reduces checkstyle errors in double-dispatch
This commit is contained in:
Anurag Agarwal
2019-11-10 23:01:20 +05:30
committed by Ilkka Seppälä
parent 01e489c77b
commit f2c91eb836
35 changed files with 154 additions and 215 deletions

View File

@ -23,21 +23,19 @@
package com.iluwatar.doublebuffer;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
/**
* Double buffering is a term used to describe a device that has two buffers.
* The usage of multiple buffers increases the overall throughput of a device
* and helps prevents bottlenecks. This example shows using double buffer pattern
* on graphics. It is used to show one image or frame while a separate frame
* is being buffered to be shown next. This method makes animations and games
* look more realistic than the same done in a single buffer mode.
* Double buffering is a term used to describe a device that has two buffers. The usage of multiple
* buffers increases the overall throughput of a device and helps prevents bottlenecks. This example
* shows using double buffer pattern on graphics. It is used to show one image or frame while a
* separate frame is being buffered to be shown next. This method makes animations and games look
* more realistic than the same done in a single buffer mode.
*/
public class App {
@ -45,10 +43,11 @@ public class App {
/**
* Program main entry point.
*
* @param args runtime arguments
*/
public static void main(String[] args) {
var scene = new Scene();
final var scene = new Scene();
List<Pair<Integer, Integer>> drawPixels = new ArrayList<>();
Pair<Integer, Integer> pixel1 = new MutablePair<>(1, 1);
Pair<Integer, Integer> pixel2 = new MutablePair<>(5, 6);

View File

@ -30,6 +30,7 @@ public interface Buffer {
/**
* Clear the pixel in (x, y).
*
* @param x X coordinate
* @param y Y coordinate
*/
@ -37,6 +38,7 @@ public interface Buffer {
/**
* Draw the pixel in (x, y).
*
* @param x X coordinate
* @param y Y coordinate
*/
@ -49,6 +51,7 @@ public interface Buffer {
/**
* Get all the pixels.
*
* @return pixel list
*/
Pixel[] getPixels();

View File

@ -23,9 +23,6 @@
package com.iluwatar.doublebuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* FrameBuffer implementation class.
*/

View File

@ -23,12 +23,11 @@
package com.iluwatar.doublebuffer;
import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
/**
* Scene class. Render the output frame.
*/
@ -55,6 +54,7 @@ public class Scene {
/**
* Draw the next frame.
*
* @param coordinateList list of pixels of which the color should be black
*/
public void draw(List<Pair<Integer, Integer>> coordinateList) {