topologyfileentry.java

来自「使用Java语言编写模拟路由器程序」· Java 代码 · 共 65 行

JAVA
65
字号
/* TopologyFileEntry.java * * This file contains the code for the class TopologyFileEntry * that represents an entry in the Topology Configuration File */class TopologyFileEntry {	// the origin node of the edge	int router1;	// the destination node of the edge	int router2;	// the weight of the edge	int weight;	/*	 * Constructor	 * 	 * @r1 the origin node @r2 the destination node @w the weight of the edge	 */	public TopologyFileEntry(int r1, int r2, int w) {		router1 = r1;		router2 = r2;		weight = w;	}	/*	 * Method Name: getRouter1	 * 	 * Use: to get the origin node of the edge	 */	int getRouter1() {		return router1;	}	/*	 * Method Name: getRouter2	 * 	 * Use: to get the destination node of the edge	 */	int getRouter2() {		return router2;	}	/*	 * Method Name: getWeight	 * 	 * Use: to get the weight of the edge	 */	int getWeight() {		return weight;	}	/*	 * Method Name: toString	 * 	 * Use: to return a textual representation of this entry	 */	public String toString() {		return ("(" + router1 + "," + router2 + "," + weight + ")");	}}

⌨️ 快捷键说明

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