Added model interface.
This commit is contained in:
@@ -9,18 +9,18 @@ import java.util.Queue;
|
||||
import connect.src.ClientThread;
|
||||
import gui.src.View;
|
||||
import logger.src.MessageLogger;
|
||||
import model.src.Model;
|
||||
import model.src.ModelRepresentation;
|
||||
|
||||
public class ControllerThread extends Thread implements Controller {
|
||||
private static final String className = "ControllerThread";
|
||||
|
||||
private View view;
|
||||
private Model model;
|
||||
private ModelRepresentation model;
|
||||
|
||||
private Queue<ControllerToViewData> controllerToViewQueue;
|
||||
private Queue<ViewToControllerData> viewToControllerQueue;
|
||||
|
||||
public ControllerThread(View view, Model model) {
|
||||
public ControllerThread(View view, ModelRepresentation model) {
|
||||
this.view = view;
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import controller.src.ViewToControllerData;
|
||||
import gui.src.View;
|
||||
import gui.src.ViewThread;
|
||||
import logger.src.MessageLogger;
|
||||
import model.src.Model;
|
||||
import model.src.ModelRepresentation;
|
||||
|
||||
public final class Main {
|
||||
private static final String className = "Main";
|
||||
@@ -32,7 +32,7 @@ public final class Main {
|
||||
view.start();
|
||||
MessageLogger.printMessage(className, "View was started.");
|
||||
|
||||
Model model = new Model();
|
||||
ModelRepresentation model = new ModelRepresentation();
|
||||
MessageLogger.printMessage(className, "Model was created.");
|
||||
|
||||
Controller controller = new ControllerThread(view, model);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
*/
|
||||
package model.src;
|
||||
|
||||
public class Model {
|
||||
private NetworkModel networkModel;
|
||||
private NFTablesModel nfTablesModel;
|
||||
|
||||
public Model() {
|
||||
networkModel = new NetworkModel();
|
||||
nfTablesModel = new NFTablesModel();
|
||||
}
|
||||
public interface Model {
|
||||
public void addNetworkConnection(String networkConnection);
|
||||
}
|
||||
|
||||
19
src/main/java/model/src/ModelRepresentation.java
Normal file
19
src/main/java/model/src/ModelRepresentation.java
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 01.12.2023
|
||||
*/
|
||||
package model.src;
|
||||
|
||||
public class ModelRepresentation implements Model {
|
||||
private NetworkModel networkModel;
|
||||
private NFTablesModel nfTablesModel;
|
||||
|
||||
public ModelRepresentation() {
|
||||
networkModel = new NetworkModel();
|
||||
nfTablesModel = new NFTablesModel();
|
||||
}
|
||||
|
||||
public void addNetworkConnection(String networkConnection) {
|
||||
networkModel.addNetworkConnection(networkConnection);
|
||||
}
|
||||
}
|
||||
@@ -31,43 +31,47 @@ public class NetworkModel {
|
||||
unixNetworkConnections = new LinkedList<String>();
|
||||
}
|
||||
|
||||
public void addIPv4NetworkConnection(String networkConnection) {
|
||||
public void addNetworkConnection(String networkConnection) {
|
||||
|
||||
}
|
||||
|
||||
private void addIPv4NetworkConnection(String networkConnection) {
|
||||
if (null != networkConnection && null != ipv4NetworkConnections) {
|
||||
ipv4NetworkConnections.add(networkConnection);
|
||||
}
|
||||
}
|
||||
|
||||
public void addIPv6NetworkConnection(String networkConnection) {
|
||||
private void addIPv6NetworkConnection(String networkConnection) {
|
||||
if (null != networkConnection && null != ipv6NetworkConnections) {
|
||||
ipv6NetworkConnections.add(networkConnection);
|
||||
}
|
||||
}
|
||||
|
||||
public void addTCPOverIPv4NetworkConnection(String networkConnection) {
|
||||
private void addTCPOverIPv4NetworkConnection(String networkConnection) {
|
||||
if (null != networkConnection && null != tcpOverIPv4NetworkConnections) {
|
||||
tcpOverIPv4NetworkConnections.add(networkConnection);
|
||||
}
|
||||
}
|
||||
|
||||
public void addTCPOverIPv6NetworkConnection(String networkConnection) {
|
||||
private void addTCPOverIPv6NetworkConnection(String networkConnection) {
|
||||
if (null != networkConnection && null != tcpOverIPv6NetworkConnections) {
|
||||
tcpOverIPv6NetworkConnections.add(networkConnection);
|
||||
}
|
||||
}
|
||||
|
||||
public void addUDPOverIPv4NetworkConnection(String networkConnection) {
|
||||
private void addUDPOverIPv4NetworkConnection(String networkConnection) {
|
||||
if (null != networkConnection && null != udpOverIPv4NetworkConnections) {
|
||||
udpOverIPv4NetworkConnections.add(networkConnection);
|
||||
}
|
||||
}
|
||||
|
||||
public void addUDPOverIPv6NetworkConnection(String networkConnection) {
|
||||
private void addUDPOverIPv6NetworkConnection(String networkConnection) {
|
||||
if (null != networkConnection && null != udpOverIPv6NetworkConnections) {
|
||||
udpOverIPv6NetworkConnections.add(networkConnection);
|
||||
}
|
||||
}
|
||||
|
||||
public void addUnixNetworkConnection(String networkConnection) {
|
||||
private void addUnixNetworkConnection(String networkConnection) {
|
||||
if (null != networkConnection && null != unixNetworkConnections) {
|
||||
unixNetworkConnections.add(networkConnection);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user