亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? scfqscheduler.java

?? 中間件開發詳細說明:清華大學J2EE教程講義(ppt)-Tsinghua University J2EE tutorial lectures (ppt) [上載源碼成為會員下載此源碼] [成為VIP會
?? JAVA
字號:
/* * ** Network and Service Differentiation Extensions to GridSim 3.0 ** * * Gokul Poduval & Chen-Khong Tham * Computer Communication Networks (CCN) Lab * Dept of Electrical & Computer Engineering * National University of Singapore * August 2004 * * Licence: GPL - http://www.gnu.org/copyleft/gpl.html * * SCFQ.java - Implements a Self Clocked Fair Queuing scheduler * */package gridsim.net;import eduni.simjava.*;import gridsim.*;import java.util.*;/** * SCFQScheduler implements a Self Clocked Fair Queueing Scheduler. A SCFQ is a * variation of Weighted Fair Queueing (WFQ), which is easier to implement than * WFQ because it does not need to compute round numbers at every iteration. * For more details refer to <b>S. R. Golestani's</b> INFOCOM '94 paper * <i>A self-clocked fair queueing scheme for broadband applications</i>. * <p> * A SCFQ scheduler can provide differentiated service to traffic by changing * the weights associated with a certain class of traffic. The higher the weight * of a class of traffic, the better treatment it receives. In this class, you * can set the weights by calling setWeights() with a linear array of weights. * Traffic that is class <tt>0 (default)</tt>, are assigned the first element * of the array as its weight. * <p> * For example: <br> * String userName = { "User_0", "User_1", User_2" };  // list of user names<br> * int[] trafficClass = { 0, 1, 2 };  // a list of class for each user<br> * int[] weights = { 1, 2, 3 };       // a list of weights for each class<br> * <br> * From the above example, <i>User_0</i> has a traffic class of 0 (low * priority), whereas <i>User_2</i> has a traffic class of 2 (high priority) * judging from their respective weights. * * @invariant $none * @since GridSim Toolkit 3.1 * @author Gokul Poduval & Chen-Khong Tham, National University of Singapore */public class SCFQScheduler implements PacketScheduler{    private String name_;       // this scheduler name	private double baudRate_;   // baud rate of this scheduler    private Vector pktList;     // Sorted List of all Packets    private Vector timeList;    // Sorted list of finish times    private double[] weights;   // weights for different ToS packets    private double CF ;         // current finish number    private Hashtable flowTable;    /**     * Creates a new SCFQ packet scheduler with the specified name and baud rate     * (in bits/s). The name can be useful for debugging purposes, but serves     * no functional purposes.     *     * @param name       Name of this scheduler     * @param baudRate   baud rate in bits/s of the port that is using     *                   this scheduler.     * @throws ParameterException This happens when the name is null or     *                   the baud rate <= 0     * @pre name != null     * @pre baudRate > 0     * @post $none     */    public SCFQScheduler(String name, double baudRate)                         throws ParameterException    {        if (name == null) {            throw new ParameterException("SCFQScheduler(): Name is null.");        }        if (baudRate <= 0) {		    throw new ParameterException("SCFQScheduler(): Baudrate <= 0.");        }        name_ = name;        baudRate_ = baudRate;        init();    }    /**     * Creates a new SCFQ packet scheduler with the specified baud rate     * (bits/s). The name is set to a generic name: <b>"SCFQScheduler"</b>.     *     * @param baudRate   baud rate in bits/s of the port that is using     *                   this scheduler.     * @throws ParameterException This happens when the baud rate <= 0     * @pre baudRate > 0     * @post $none     */    public SCFQScheduler(double baudRate) throws ParameterException    {        if (baudRate <= 0) {		    throw new ParameterException("SCFQScheduler(): Baudrate <= 0.");        }        name_ = "SCFQScheduler";        baudRate_ = baudRate;        init();    }    /**     * Creates a new SCFQ packet scheduler with the specified name.     * The baud rate is left at 0, and should be set with     * {@link gridsim.net.PacketScheduler#setBaudRate(double)}     * before the simulation starts.     *     * @param name Name of this scheduler     * @throws ParameterException This happens when the name is null     * @see gridsim.net.PacketScheduler#setBaudRate(double)     * @pre name != null     * @post $none     */    public SCFQScheduler(String name) throws ParameterException    {        if (name == null) {            throw new ParameterException("SCFQScheduler(): Name is null.");        }        name_ = name;        baudRate_ = 0;        init();    }    /**     * Creates a new packet scheduler with the name <b>"SCFQScheduler"</b>.     * The baud rate is left at 0, and should be set with     * {@link gridsim.net.PacketScheduler#setBaudRate(double)}     * before the simulation starts.     * @throws ParameterException This happens when the name is null     * @see gridsim.net.PacketScheduler#setBaudRate(double)     * @pre $none     * @post $none     */    public SCFQScheduler() throws ParameterException    {        name_ = "SCFQScheduler";        baudRate_ = 0;        init();    }    /**     * Initialises all the attributes     * @pre $none     * @post $none     */    private void init()    {        flowTable = new Hashtable();        pktList = new Vector();        timeList = new Vector();        weights = null;        CF = 0;    }    /**     * This method allows you to set different weights for different types of     * traffic. Traffic of class <tt>n</tt> are assigned a weight of     * <tt>weights[n]</tt>. The higher the weight of a class, the better the     * service it receives. <br>     * <b>NOTE</b>: Do not set a weight to be <tt>0</tt> or a negative number.     *     * @param weights a linear array of the weights to be assigned to different     *                classes of traffic.     * @return <tt>true</tt> if it is successful, <tt>false</tt>otherwise     * @pre weights != null     * @post $none     */    public boolean setWeights(double[] weights)    {        if (weights == null) {            return false;        }        // check whether the value of weights are correct        for (int i = 0; i < weights.length; i++)        {            if (weights[i] <= 0)            {                System.out.println(name_ +                    ".setWeights(): Error - weight must be a positive number.");                return false;            }        }        this.weights = weights;        return true;    }    /**     * Puts a packet into the queue     *     * @param pnp    A Packet to be enqued by this scheduler.     * @return <tt>true</tt> if enqued, <tt>false</tt> otherwise     * @pre pnp != null     * @post $none     */    public synchronized boolean enque(Packet pnp)    {        int srcID = pnp.getSrcID();     // source entity id        int destID = pnp.getDestID();   // destination entity id        int type = pnp.getNetServiceType();     // packet service type        Double nextTime = (Double) flowTable.get("" + srcID + destID + type);        if (nextTime == null)        {            nextTime = new Double(CF);            flowTable.put("" + srcID + destID + type, nextTime);        }        double pktTime = calculateFinishTime( pnp, nextTime.doubleValue() );        flowTable.put("" + srcID + destID + type, new Double(pktTime) );        insert(pnp, pktTime);   // Sort the queue list        return true;    }    /**     * Calculates the finish time of a particular packet     * @param np  a network packet     * @param nextTime  the next available time     * @pre np != null     * @pre nextTime >= 0     * @post $none     */    private double calculateFinishTime(Packet np, double nextTime)    {        double time = 0;        double ratio = 0;        try        {            int type = np.getNetServiceType();            if (type >= weights.length)   // out of bound array error checking            {                System.out.println(name_ +".calculateFinishTime(): Warning - " +                    " packet class = " + type + ", weight.length = " +                    weights.length);                type = 0;            }            ratio = np.getSize() / weights[type];        }        catch(Exception e) {            ratio = 1;  // default ratio if an error occurs        }        if (nextTime > CF) {                time = nextTime + ratio;        }        else {            time = CF + ratio;        }        return time;    }    /**     * This function inserts a WFQClass into the sorted     * queue list (using binary search)     *     * @param np    a network packet     * @param time  simulation time     * @pre np != null     * @pre time >= 0     * @post $none     */    private synchronized void insert(Packet np, double time)    {        if ( timeList.isEmpty() )        {            timeList.add( new Double(time) );            pktList.add(np);            return;        }        for (int i = 0; i < timeList.size(); i++)        {            double next = ( (Double) timeList.get(i) ).doubleValue();            if (next > time)            {                timeList.add(i, new Double(time));                pktList.add(i, np);                return;            }        }        // add to end        timeList.add( new Double(time) );        pktList.add(np);        return;    }    /**     * The method deque() has to decide which queue is to be     * served next. In the original WFQ algorithm, this is always the     * packet with lowest finish time. We also need to update the CF     * (current finish no.) to that of the packet being served.     *     * @return the packet to be sent out     * @pre $none     * @post $none     */    public synchronized Packet deque()    {        Packet p = null;        if (pktList.size() > 0 && timeList.size() > 0)        {            p = (Packet) pktList.remove(0);            CF = ( (Double) timeList.remove(0) ).doubleValue();        }        return p;    }    /**     * Determines whether the scheduler is currently keeping any packets in     * its queue(s).     *     * @return <tt>true</tt> if no packets are enqueued, <tt>false</tt>     *         otherwise     * @pre $none     * @post $none     */    public synchronized boolean isEmpty() {        return pktList.isEmpty();    }    /**     * Determines the number of packets that are currently enqueued in this     * scheduler.     *     * @return the number of packets enqueud by this scheduler.     * @pre $none     * @post $none     */    public synchronized int size() {        return pktList.size();    }    /**     * Gets the ID of this scheduler.     * @return the ID of this scheduler or <tt>-1</tt> if no ID is found     * @pre $none     * @post $none     */    public int getSchedID()    {        System.out.println(name_ + ".getID(): No ID is set for this object.");        return -1;    }    /**     * Gets the name of this scheduler.     * @return the name of this scheduler     * @pre $none     * @post $none     */    public String getSchedName() {        return name_;    }    /**     * Sets the baud rate that this scheduler will be sending packets at.     * @param rate the baud rate of this scheduler (in bits/s)     * @pre rate > 0     * @post $none     */    public boolean setBaudRate(double rate)    {        if (rate <= 0.0) {            return false;        }        baudRate_ = rate;        return true;    }    /**     * Returns the baud rate of the egress port that is using this scheduler.     * If the baud rate is zero, it means you haven't set it up.     * @return the baud rate in bits/s     * @see gridsim.net.PacketScheduler#setBaudRate(double)     * @pre $none     * @post $result >= 0     */    public double getBaudRate() {        return baudRate_;    }    /**     * Sets the router ID that hosts this scheduler.     * @param routerID  the router ID that hosts this scheduler     * @return <tt>true</tt> if successful or <tt>false</tt> otherwise     * @pre $none     * @post $none     */    public boolean setRouterID(int routerID)    {        System.out.println(name_ + ".setRouterID(): Router ID is not required");        return false;    }    /**     * Gets the router ID that hosts this scheduler.     * @return the router ID or <tt>-1</tt> if no ID is found     * @pre $none     * @post $none     */    public int getRouterID() {        return -1;    }} // end class

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品一区二区三区视频| 欧美亚洲综合久久| 国产欧美日韩精品一区| 国产精品一区在线| 欧美经典一区二区| 色88888久久久久久影院野外| 欧美日韩国产大片| 国产精一品亚洲二区在线视频| 欧美mv和日韩mv国产网站| 在线亚洲高清视频| a4yy欧美一区二区三区| 成人福利视频网站| 成人免费视频一区| 亚洲另类在线一区| 97se亚洲国产综合在线| 亚洲欧美日韩系列| 久久影院视频免费| 亚洲蜜臀av乱码久久精品蜜桃| 成人性生交大片免费看在线播放| 亚洲色图欧洲色图| 男男成人高潮片免费网站| 国内成人免费视频| 日韩午夜精品视频| 国产风韵犹存在线视精品| 国产精品素人视频| 欧美二区三区91| 国产乱人伦偷精品视频免下载| 亚洲欧美一区二区久久| 久久久久久久网| 成人久久18免费网站麻豆| 亚洲精品第一国产综合野| 欧美一级日韩不卡播放免费| 国产高清在线精品| 亚洲午夜成aⅴ人片| 欧美精品一区二区三区视频| 99久久99久久免费精品蜜臀| 亚洲一二三区在线观看| 精品伦理精品一区| 欧美午夜免费电影| 成人精品电影在线观看| 亚洲高清三级视频| 国产精品美女久久久久久久久久久 | 久久综合九色综合欧美98| 99久久国产综合精品女不卡| 日韩精品亚洲专区| 国产精品污www在线观看| 8x8x8国产精品| 99久久精品免费看国产免费软件| 免费高清视频精品| 一区二区三区四区高清精品免费观看 | 日韩欧美不卡一区| 日本久久一区二区| 成人涩涩免费视频| 极品销魂美女一区二区三区| 亚洲国产成人av好男人在线观看| 久久久久久久久久久黄色| 欧美高清精品3d| 色综合久久88色综合天天 | 成人a级免费电影| 狠狠色狠狠色综合| 天天影视涩香欲综合网| 一区二区三区蜜桃| 亚洲欧洲日韩av| 国产三级精品视频| 精品国产三级a在线观看| 欧美区一区二区三区| 色美美综合视频| 国产91精品在线观看| 国产自产2019最新不卡| 午夜伦欧美伦电影理论片| 一区二区三区久久| 一区二区三区在线视频免费观看| 国产亚洲综合在线| 久久综合给合久久狠狠狠97色69| 日韩女同互慰一区二区| 国产精品888| 国产69精品久久久久毛片 | 国产精品嫩草影院av蜜臀| 久久久久99精品一区| 欧美成人r级一区二区三区| 6080yy午夜一二三区久久| 欧美无砖砖区免费| 欧美综合亚洲图片综合区| 成人激情午夜影院| 成人精品国产免费网站| 不卡大黄网站免费看| 成人爱爱电影网址| 91猫先生在线| 欧美三级午夜理伦三级中视频| 欧洲在线/亚洲| 欧美久久一区二区| 国产日韩亚洲欧美综合| 久久久欧美精品sm网站| 国产精品久久久久一区 | 欧洲亚洲精品在线| 日本韩国精品在线| 在线播放欧美女士性生活| 日韩免费高清av| 国产欧美日韩综合精品一区二区| 中文字幕一区在线| 午夜精品免费在线| 国精产品一区一区三区mba视频| 成人久久18免费网站麻豆| 色999日韩国产欧美一区二区| 欧美日本在线看| 久久这里只精品最新地址| 国产精品国产自产拍高清av | 欧美精选一区二区| 精品精品国产高清一毛片一天堂| 国产亚洲精品aa午夜观看| 日韩毛片一二三区| 婷婷久久综合九色国产成人| 国产精品影音先锋| 在线亚洲免费视频| 久久香蕉国产线看观看99| 亚洲桃色在线一区| 精品一区二区三区在线播放| 91小视频免费观看| 日韩免费视频线观看| 中文字幕亚洲不卡| 日本vs亚洲vs韩国一区三区| 粉嫩av亚洲一区二区图片| 欧美视频一区在线观看| 久久久久久久久一| 亚洲成av人影院在线观看网| 韩国av一区二区| 色老头久久综合| 成人av动漫网站| 欧美日韩国产三级| 国产精品久久久久影院亚瑟| 欧美aaaaaa午夜精品| jizz一区二区| www激情久久| 亚洲女女做受ⅹxx高潮| 国产综合久久久久影院| 91最新地址在线播放| 精品国产亚洲在线| 精品国产一区二区三区四区四| 一区二区三区中文在线观看| 国产福利一区在线观看| 精品1区2区3区| 国产精品久久久久久户外露出 | 亚洲午夜久久久| 成人av中文字幕| 日韩欧美久久久| 亚洲18色成人| 成人一区二区三区视频在线观看| 午夜亚洲福利老司机| 成人av中文字幕| 久久久久久久综合狠狠综合| 亚洲视频在线一区二区| 国产91丝袜在线18| 久久亚洲精品小早川怜子| 香蕉影视欧美成人| 在线视频观看一区| 国产精品欧美一区二区三区| 国产一区二区三区免费播放| 6080国产精品一区二区| 天天av天天翘天天综合网色鬼国产| 成人免费观看视频| 国产精品美女久久久久久久 | 成年人国产精品| 国产精品拍天天在线| 国产精品自在欧美一区| 日韩欧美精品三级| 免费成人性网站| 欧美精品第1页| 麻豆精品在线观看| 欧美日韩一区二区三区高清 | 91精品国产一区二区三区香蕉| 亚洲一区二区三区四区五区中文| 丁香六月久久综合狠狠色| 久久久亚洲综合| 久久99精品国产.久久久久久| 日韩一级黄色大片| 一级女性全黄久久生活片免费| 狠狠v欧美v日韩v亚洲ⅴ| 欧美一区二区在线观看| 日韩电影在线免费看| 欧美色视频在线观看| 亚洲欧美偷拍另类a∨色屁股| 成人在线综合网站| 中文字幕免费不卡| 懂色av一区二区三区免费看| 国产精品看片你懂得| 大尺度一区二区| 亚洲免费观看高清在线观看| 欧美亚洲综合一区| 婷婷六月综合网| 久久久精品综合| 成人性生交大片免费看中文 | 日本aⅴ亚洲精品中文乱码| 8v天堂国产在线一区二区| 激情综合色丁香一区二区| 欧美亚日韩国产aⅴ精品中极品| 日韩精品国产欧美| 久久综合色之久久综合| 国产激情视频一区二区三区欧美| 亚洲少妇最新在线视频| 欧美性做爰猛烈叫床潮|