Browse Source

Adds PortNumber to export String Representation

Andreas T. Meyer-Berg 5 năm trước cách đây
mục cha
commit
702f5204f2

+ 1 - 1
examples/classifier/KMeansClustering.java

@@ -22,7 +22,7 @@ public class KMeansClustering extends BasicPacketClassifier {
 	 * Number of Clusters
 	 */ 
 	//17 works fine
-	//22 found value anomalies
+	//34 found value anomalies
 	protected int NUMBER_OF_CLUSTERS = 34;
 	protected double[] stdv = new double[NUMBER_OF_CLUSTERS];
 	/**

+ 1 - 1
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/core/protocols/packets/MQTT_packet.java

@@ -195,7 +195,7 @@ public class MQTT_packet extends Packet {
 			packetType="RESERVED";
 			break;
 		}
-		return "[MQTT: "+packetType+"; time:"+timestamp+"; source:"+source.getOwner().getName()+"; destination:"+destination.getOwner().getName()+(message==""?"":"; "+message)+"]";
+		return "[MQTT: "+packetType+"; time:"+timestamp+"; source:"+source.getOwner().getName()+":"+source.getPortNumber()+"; destination:"+destination.getOwner().getName()+":"+destination.getPortNumber()+(message==""?"":"; "+message)+"]";
 	}
 
 	@Override

+ 1 - 1
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/core/protocols/packets/Ping_packet.java

@@ -138,7 +138,7 @@ public class Ping_packet extends Packet {
 
 	@Override
 	public String getTextualRepresentation() {
-		return "[Ping: "+getType()+"; time:"+timestamp+"; source:"+source.getOwner().getName()+"; destination:"+destination.getOwner().getName()+"; Payload: "+getPayload()+"]";
+		return "[Ping: "+getType()+"; time:"+timestamp+"; source:"+source.getOwner().getName()+":"+source.getPortNumber()+"; destination:"+destination.getOwner().getName()+":"+destination.getPortNumber()+"; Payload: "+getPayload()+"]";
 	}
 
 	@Override

+ 3 - 3
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/core/simpleImplementation/SimplePacket.java

@@ -86,9 +86,9 @@ public class SimplePacket extends Packet {
 	
 	@Override
 	public String toString() {
-		String destName = destination == null ? "null" : destination.getOwner().getName();
-		String srcName = source == null ? "null" : source.getOwner().getName();
-			
+		String destName = destination == null ? "null" : (destination.getOwner().getName()+":"+destination.getPortNumber());
+		String srcName = source == null ? "null" : (source.getOwner().getName()+":"+source.getPortNumber());
+
 		return "[SimplePacket:" + payload + " time:" + timestamp + ";source:" + srcName + ";dest:"
 				+ destName + "]";
 	}