⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 packet.java

📁 使用Java语言编写模拟路由器程序
💻 JAVA
字号:
/* File: Packet.java * * This file contains the code for the class Packet, * which represents a Distance Vector packet exchanged * between the routers. It is just and abstraction over * the Distance Vector to include the ID of the router * that is sending the Distance Vector */import java.util.*;import java.io.*;class Packet implements Serializable {	// The ID of the router sending the Distance Vector	int routerId;	// The Distance Vector	HashMap dv;	/*	 * Constructor	 * 	 * @id: The id of the router @dv: The Distance Vector	 * 	 * Use: To initialize the Packet	 */	public Packet(int id, HashMap d) {		routerId = id;		dv = d;	}	/*	 * Method Name: getRouterId	 * 	 * Use: To get the ID of the router that sent the packet	 */	int getRouterId() {		return routerId;	}	/*	 * Method Name: getDV	 * 	 * Use: To get the Distance Vector contained in the packet	 */	HashMap getDV() {		return dv;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -