Resolves checkstyle errors for remaining m (#1090)

* Reduces checkstyle errors in marker

* Reduces checkstyle errors in master-worker-pattern

* Reduces checkstyle errors in mediator

* Reduces checkstyle errors in memento

* Reduces checkstyle errors in model-view-controller

* Reduces checkstyle errors in model-view-presenter

* Reduces checkstyle errors in module

* Reduces checkstyle errors in monad

* Reduces checkstyle errors in monostate

* Reduces checkstyle errors in multiton

* Reduces checkstyle errors in mute-idiom

* Reduces checkstyle errors in mutex
This commit is contained in:
Anurag Agarwal
2019-11-16 18:18:23 +05:30
committed by Ilkka Seppälä
parent 3ccc9baa1a
commit 1fdc650545
66 changed files with 374 additions and 423 deletions

View File

@ -24,31 +24,29 @@
package com.iluwatar.model.view.presenter;
/**
*
* The Model-View-Presenter(MVP) architectural pattern, helps us achieve what is called
* "The separation of concerns" principle. This is accomplished by separating the application's
* logic (Model), GUIs (View), and finally the way that the user's actions update the application's
* logic (Presenter).
* <p>
* In the following example, The {@link FileLoader} class represents the app's logic, the
* {@link FileSelectorJFrame} is the GUI and the {@link FileSelectorPresenter} is responsible to
* respond to users' actions.
* <p>
* Finally, please notice the wiring between the Presenter and the View and between the Presenter
* and the Model.
*
* The Model-View-Presenter(MVP) architectural pattern, helps us achieve what is called "The
* separation of concerns" principle. This is accomplished by separating the application's logic
* (Model), GUIs (View), and finally the way that the user's actions update the application's logic
* (Presenter).
*
* <p>In the following example, The {@link FileLoader} class represents the app's logic, the {@link
* FileSelectorJFrame} is the GUI and the {@link FileSelectorPresenter} is responsible to respond to
* users' actions.
*
* <p>Finally, please notice the wiring between the Presenter and the View and between the
* Presenter and the Model.
*/
public class App {
/**
* Program entry point
*
* Program entry point.
*
* @param args command line args
*/
public static void main(String[] args) {
FileLoader loader = new FileLoader();
FileSelectorJFrame jFrame = new FileSelectorJFrame();
FileSelectorPresenter presenter = new FileSelectorPresenter(jFrame);
FileSelectorJFrame frame = new FileSelectorJFrame();
FileSelectorPresenter presenter = new FileSelectorPresenter(frame);
presenter.setLoader(loader);
presenter.start();
}

View File

@ -27,23 +27,22 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.Serializable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Every instance of this class represents the Model component in the Model-View-Presenter
* architectural pattern.
* <p>
* It is responsible for reading and loading the contents of a given file.
*
* <p>It is responsible for reading and loading the contents of a given file.
*/
public class FileLoader implements Serializable {
/**
* Generated serial version UID
* Generated serial version UID.
*/
private static final long serialVersionUID = -4745803872902019069L;
private static final Logger LOGGER = LoggerFactory.getLogger(FileLoader.class);
/**
@ -81,7 +80,7 @@ public class FileLoader implements Serializable {
/**
* Sets the path of the file to be loaded, to the given value.
*
*
* @param fileName The path of the file to be loaded.
*/
public void setFileName(String fileName) {
@ -89,6 +88,8 @@ public class FileLoader implements Serializable {
}
/**
* Gets the path of the file to be loaded.
*
* @return fileName The path of the file to be loaded.
*/
public String getFileName() {
@ -96,6 +97,8 @@ public class FileLoader implements Serializable {
}
/**
* Returns true if the given file exists.
*
* @return True, if the file given exists, false otherwise.
*/
public boolean fileExists() {
@ -103,6 +106,8 @@ public class FileLoader implements Serializable {
}
/**
* Returns true if the given file is loaded.
*
* @return True, if the file is loaded, false otherwise.
*/
public boolean isLoaded() {

View File

@ -26,7 +26,6 @@ package com.iluwatar.model.view.presenter;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
@ -82,7 +81,7 @@ public class FileSelectorJFrame extends JFrame implements FileSelectorView, Acti
private JPanel panel;
/**
* The Presenter component that the frame will interact with
* The Presenter component that the frame will interact with.
*/
private FileSelectorPresenter presenter;

View File

@ -28,13 +28,13 @@ import java.io.Serializable;
/**
* Every instance of this class represents the Presenter component in the Model-View-Presenter
* architectural pattern.
* <p>
* It is responsible for reacting to the user's actions and update the View component.
*
* <p>It is responsible for reacting to the user's actions and update the View component.
*/
public class FileSelectorPresenter implements Serializable {
/**
* Generated serial version UID
* Generated serial version UID.
*/
private static final long serialVersionUID = 1210314339075855074L;
@ -49,8 +49,8 @@ public class FileSelectorPresenter implements Serializable {
private FileLoader loader;
/**
* Constructor
*
* Constructor.
*
* @param view The view component that the presenter will interact with.
*/
public FileSelectorPresenter(FileSelectorView view) {
@ -59,7 +59,7 @@ public class FileSelectorPresenter implements Serializable {
/**
* Sets the {@link FileLoader} object, to the value given as parameter.
*
*
* @param loader The new {@link FileLoader} object(the Model component).
*/
public void setLoader(FileLoader loader) {
@ -82,7 +82,7 @@ public class FileSelectorPresenter implements Serializable {
}
/**
* Ok button handler
* Ok button handler.
*/
public void confirmed() {
if (loader.getFileName() == null || loader.getFileName().equals("")) {

View File

@ -26,12 +26,12 @@ package com.iluwatar.model.view.presenter;
/**
* Every instance of this class represents the Stub component in the Model-View-Presenter
* architectural pattern.
* <p>
* The stub implements the View interface and it is useful when we want the test the reaction to
*
* <p>The stub implements the View interface and it is useful when we want the test the reaction to
* user events, such as mouse clicks.
* <p>
* Since we can not test the GUI directly, the MVP pattern provides this functionality through the
* View's dummy implementation, the Stub.
*
* <p>Since we can not test the GUI directly, the MVP pattern provides this functionality through
* the View's dummy implementation, the Stub.
*/
public class FileSelectorStub implements FileSelectorView {
@ -61,7 +61,7 @@ public class FileSelectorStub implements FileSelectorView {
private boolean dataDisplayed;
/**
* Constructor
* Constructor.
*/
public FileSelectorStub() {
this.opened = false;
@ -124,6 +124,8 @@ public class FileSelectorStub implements FileSelectorView {
}
/**
* Returns true, if the data were displayed.
*
* @return True if the data where displayed, false otherwise.
*/
public boolean dataDisplayed() {

View File

@ -42,44 +42,50 @@ public interface FileSelectorView extends Serializable {
void close();
/**
* Returns true if view is opened.
*
* @return True, if the view is opened, false otherwise.
*/
boolean isOpened();
/**
* Sets the presenter component, to the one given as parameter.
*
*
* @param presenter The new presenter component.
*/
void setPresenter(FileSelectorPresenter presenter);
/**
* Gets presenter component.
*
* @return The presenter Component.
*/
FileSelectorPresenter getPresenter();
/**
* Sets the file's name, to the value given as parameter.
*
*
* @param name The new name of the file.
*/
void setFileName(String name);
/**
* Gets the name of file.
*
* @return The name of the file.
*/
String getFileName();
/**
* Displays a message to the users.
*
*
* @param message The message to be displayed.
*/
void showMessage(String message);
/**
* Displays the data to the view.
*
*
* @param data The data to be written.
*/
void displayData(String data);