eventqueueentry.java

来自「DSr project for the java applications」· Java 代码 · 共 46 行

JAVA
46
字号
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 + =
减小字号Ctrl + -
显示快捷键?