Explorar el Código

Renames Connection to Link

Andreas T. Meyer-Berg hace 5 años
padre
commit
0066aad86c

+ 1 - 1
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/Main.java

@@ -21,7 +21,7 @@ public class Main {
 	static MainFrame v;
 	
 	/**
-	 * Controller of the pogram 
+	 * Controller of the program 
 	 */
 	static Controller c;
 	

+ 5 - 5
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/core/Connection.java → src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/core/Link.java

@@ -4,11 +4,11 @@ import java.util.List;
 import java.util.ArrayList;
 
 /**
- * Connection medium for SmartDevices, which connects two or more devices and allows communication between them
+ * Link medium for SmartDevices, which connects two or more devices and allows communication between them
  *
  * @author Andreas T. Meyer-Berg
  */
-public class Connection {
+public class Link {
 
 	/**
 	 * name of the connection
@@ -16,15 +16,15 @@ public class Connection {
 	private String name;
 	
 	/**
-	 * Devices connected by this Connection
+	 * Devices connected by this Link
 	 */
 	private List<SmartDevice> devices;
 
 	/**
-	 * Initializes a Connection with name and an empty devices list.
+	 * Initializes a Link with name and an empty devices list.
 	 * @param name
 	 */
-	public Connection(String name){
+	public Link(String name){
 		this.name = name;
 		this.devices = new ArrayList<SmartDevice>();
 	}

+ 5 - 5
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/core/Model.java

@@ -4,14 +4,14 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * Model of the smart home, which contains all the important parts of the simulation, like {@link SmartDevice} and their {@link Connection}.
+ * Model of the smart home, which contains all the important parts of the simulation, like {@link SmartDevice} and their {@link Link}.
  *
  * @author Andreas T. Meyer-Berg
  */
 public class Model {
 
 	private List<SmartDevice> devices;
-	private List<Connection> connectionNetworks;
+	private List<Link> connectionNetworks;
 	
 	/**
 	 * Initializes the Model, with 3 default devices for testing purposes
@@ -19,7 +19,7 @@ public class Model {
 	public Model() {
 		
 		devices = new ArrayList<SmartDevice>();
-		connectionNetworks = new ArrayList<Connection>();
+		connectionNetworks = new ArrayList<Link>();
 		
 		SmartDevice A = new SmartDevice("SmartTV");		
 		A.setX(50);
@@ -39,7 +39,7 @@ public class Model {
 	/**
 	 * @return the connectionNetworks
 	 */
-	public List<Connection> getConnectionNetworks() {
+	public List<Link> getConnectionNetworks() {
 		return connectionNetworks;
 	}
 
@@ -47,7 +47,7 @@ public class Model {
 	 * Adds network connection
 	 * @param connectionNetwork the connectionNetwork to add
 	 */
-	public void addConnectionNetwork(Connection connectionNetwork) {
+	public void addConnectionNetwork(Link connectionNetwork) {
 		this.connectionNetworks.add(connectionNetwork);
 	}
 

+ 12 - 11
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/core/SmartDevice.java

@@ -5,7 +5,7 @@ import java.util.List;
 
 /**
  * Model of an SmartDevice, which keeps track of its main attributes, like name
- * and connections
+ * and links
  * 
  * @author Andreas T. Meyer-Berg
  */
@@ -19,17 +19,17 @@ public class SmartDevice {
 	/**
 	 * Connections to other SmartDevices
 	 */
-	private List<Connection> connections;
+	private List<Link> links;
 
 	/**
-	 * Creates a new SmartDevice without connections
+	 * Creates a new SmartDevice without links
 	 * 
 	 * @param name
 	 *            name of the device
 	 */
 	public SmartDevice(String name) {
 		this.name = name;
-		connections = new ArrayList<Connection>();
+		links = new ArrayList<Link>();
 	}
 
 	/**
@@ -63,18 +63,18 @@ public class SmartDevice {
 	}
 
 	/**
-	 * @return the connections of this device
+	 * @return the links of this device
 	 */
-	public List<Connection> getConnections() {
-		return connections;
+	public List<Link> getLinks() {
+		return links;
 	}
 
 	/**
-	 * @param connection
+	 * @param link
 	 *            the connection to add
 	 */
-	public void addConnection(Connection connection) {
-		this.connections.add(connection);
+	public void addLink(Link link) {
+		this.links.add(link);
 	}
 
 	/**
@@ -88,7 +88,8 @@ public class SmartDevice {
 	 * @param x the x to set
 	 */
 	public void setX(int x) {
-		this.x = x;	}
+		this.x = x;	
+	}
 
 	/**
 	 * @return the y

+ 3 - 0
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/MainFrame.java

@@ -40,6 +40,9 @@ public class MainFrame extends JFrame {
 	 * @param c Controller which handles the user interaction
 	 */
 	public MainFrame(Model m, Controller c) {
+		//Set model and control
+		this.model = m;
+		this.control = c;
 		
 		setTitle("Smart Home Network Simulator");