📄 eventqueueentry.java
字号:
package dsr;//this class implements the entry in the Event Queueimport java.net.*;class EventQueueEntry { int ID; //ID for that entry, it is unique long time; //time when this entry is added to the Event Queue InetAddress srcIP; //IP address of the source from where this packet was received InetAddress dstIP; //basically this is my IP address DatagramPacket packet; //the actual data packet static int tempID = 0; //a static int to generate the unique ID //default constructor public EventQueueEntry() {}; //constructor public EventQueueEntry(DatagramPacket packet, InetAddress srcIP, InetAddress dstIP){ ID = tempID++; time = System.currentTimeMillis(); this.srcIP = srcIP; this.dstIP = dstIP; this.packet = packet; } //copy cnstructor public EventQueueEntry(EventQueueEntry rhs){ ID = rhs.ID; time = rhs.time; srcIP = rhs.srcIP; dstIP = rhs.dstIP; packet = rhs.packet; } //toString function to print the elements of this class in the string format public String toString() { final String EOLN = java.lang.System.getProperty("line.separator"); String value = "ID: " + ID + EOLN + "Time: " + time + EOLN + "Source IP Address: " + srcIP.toString() + EOLN + "Destination IP Address: " + dstIP.toString() + EOLN; return value; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -