📄 link.java
字号:
/** * @(#)Link.java ver 1.2 6/20/2005 * * Modified by Weishuai Yang (wyang@cs.binghamton.edu). * * this file is based on KOM / LetsQoS Topology Conversion Tools */package gps.network.graph;import gps.network.BandwidthManager;/** * Represents a link between to nodes. * Can be directed (= unidirectional) or undirected (bidirectional, standard). * The link has some properties that can be read with link.getProperties(). * @author Oliver Heckmann */public class Link { /** * source node id */ int fromNode = -1; /** * destination id */ int toNode = -1; /** * bandwidth manager for this link */ protected BandwidthManager mBM = null; /** * link properties */ protected LinkProperties preProperties = new LinkProperties(); /** Creates new Link, standard constructor * @param directed directed or undirected * @param fromNode source node * @param toNode destination node * */ public Link(boolean directed, int fromNode, int toNode) { this.fromNode = fromNode; this.toNode = toNode; preProperties.unidirectional = directed; mBM=new BandwidthManager(this); } /** * reset values * */ public void reset(){ mBM.reset(); } /** * gets string description * @return string description */ public String toString() { String ret = "link from " + fromNode + " to " + toNode; /* LinkProperties p = getProperties(); if (p != null) { ret += ": bw=" + p.getBandwidth(); } */ return ret; } /** * gets source node * @return source node */ public int fromNode() { return fromNode; } /** * gets destination node * @return destination node */ public int toNode() { return toNode; } /** * exchange source node and destination node * */ public void turnaround() { int tmp; tmp = toNode; toNode = fromNode; fromNode = tmp; } /** * gets link properties * @return link properties */ public LinkProperties getProperties() { return preProperties; } /** * check directed information * @return true if directed, otherwise false */ public boolean isDirected() { return preProperties.unidirectional; } /** * sets bandwidth for this link * @param b new bandwidth */ public void setBandwidth(double b){ mBM.setBandwidth(b); preProperties.setBandwidth(b); } /** * sets delay for this link * @param d new delay */ public void setDelay(double d){ preProperties.setDelay(d); } /** * set bandwidth manager for this link * @param bm new bandwidth manager */ public void setBandwidthManager(BandwidthManager bm){ mBM=bm; } /** * gets BandwidthManager * * @return bandwidth manager */ public BandwidthManager getBandwidthManager(){ return mBM; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -