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

📄 storedresultsmodel.java

📁 一个用于排队系统仿真的开源软件,有非常形象的图象仿真过程!
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/**    
  * Copyright (C) 2006, Laboratorio di Valutazione delle Prestazioni - Politecnico di Milano

  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.

  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.

  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
  
package jmt.gui.common.definitions;

import jmt.engine.QueueNet.SimConstants;

import java.util.HashMap;
import java.util.Vector;

/**
 * <p>Title: Result's Model data structure</p>
 * <p>Description: This class will store all values of measured loaded from a file.
 * It's used by <code>XMLResultsReader</code>.</p>
 * 
 * @author Bertoli Marco
 *         Date: 3-ott-2005
 *         Time: 14.10.50
 */
public class StoredResultsModel implements MeasureDefinition {
    protected Vector measures = new Vector();
    protected HashMap names = new HashMap();
    protected double pollingInterval = 1;
    private Vector queueLength = new Vector(),
        queueTime = new Vector(),
        residenceTime = new Vector(),
        responseTime = new Vector(),
        utilization = new Vector(),
        throughput = new Vector(),
        systemResponseTime = new Vector(),
        systemThroughput = new Vector(),
        customerNumber = new Vector();


    public Vector getMeasures() {
        return measures;
    }

    /**
     * Returns total number of measures
     * 
     * @return number of measures
     */
    public int getMeasureNumber() {
        return measures.size();
    }

    /**
     * Returns the station name of a given measure
     * 
     * @param measureIndex index of the measure
     * @return station name
     */
    public String getStationName(int measureIndex) {
        return ((Measure)measures.get(measureIndex)).stationName;
    }

    /**
     * Returns the class name of a given measure
     * 
     * @param measureIndex index of the measure
     * @return class name
     */
    public String getClassName(int measureIndex) {
        return ((Measure)measures.get(measureIndex)).className;
    }

    /**
     * Returns the alpha of a given measure
     * 
     * @param measureIndex index of the measure
     * @return alpha
     */
    public double getAlpha(int measureIndex) {
        return ((Measure)measures.get(measureIndex)).alpha;
    }

    /**
     * Returns the precision of a given measure
     * 
     * @param measureIndex index of the measure
     * @return precision
     */
    public double getPrecision(int measureIndex) {
        return ((Measure)measures.get(measureIndex)).precision;
    }

    /**
     * Returns number of analized samples for a given measure
     * 
     * @param measureIndex index of the measure
     * @return number of analized samples
     */
    public int getAnalizedSamples(int measureIndex) {
        return ((Measure)measures.get(measureIndex)).analyzedSamples;
    }

    /**
     * Returns the name of a given measure
     * 
     * @param measureIndex index of the measure
     * @return name of the measure
     */
    public String getName(int measureIndex) {
        return ((Measure)measures.get(measureIndex)).name;
    }

    /**
     * Returns the vector of Temporary values of a given measure. Each element of the vector
     * is an instance of <code>Value</code> interface.
     * 
     * @param measureIndex index of the measure
     * @return vector of termporary values until now
     */
    public Vector getValues(int measureIndex) {
        return ((Measure)measures.get(measureIndex)).values;
    }

    /**
     * Returns the state of a measure, that can be MEASURE_IN_PROGRESS, MEASURE_NO_SAMPLES,
     * MEASURE_FAILED, MEASURE_SUCCESS
     * 
     * @param measureIndex index of the measure
     * @return measure state
     */
    public int getMeasureState(int measureIndex) {
        return ((Measure)measures.get(measureIndex)).state;
    }

    /**
     * Returns the type of a measure
     * 
     * @param measureIndex index of the measure
     * @return measure type
     */
    public int getMeasureType(int measureIndex) {
        return ((Measure)measures.get(measureIndex)).type;
    }

    /**
     * Returns an array with the measureIndex of every queue length measure
     * @return an array with measures' index
     */
    public int[] getQueueLengthMeasures() {
        int[] tmp = new int[queueLength.size()];
        for (int i=0; i<tmp.length; i++)
            tmp[i] = ((Integer)queueLength.get(i)).intValue();
        return tmp;
    }

    /**
     * Returns an array with the measureIndex of every throughput measure
     * @return an array with measures' index
     */
    public int[] getThroughputMeasures() {
        int[] tmp = new int[throughput.size()];
        for (int i=0; i<tmp.length; i++)
            tmp[i] = ((Integer)throughput.get(i)).intValue();
        return tmp;
    }

    /**
     * Returns an array with the measureIndex of every queue time measure
     * @return an array with measures' index
     */
    public int[] getQueueTimeMeasures() {
        int[] tmp = new int[queueTime.size()];
        for (int i=0; i<tmp.length; i++)
            tmp[i] = ((Integer)queueTime.get(i)).intValue();
        return tmp;
    }

    /**
     * Returns an array with the measureIndex of every residence time measure
     * @return an array with measures' index
     */
    public int[] getResidenceTimeMeasures() {
        int[] tmp = new int[residenceTime.size()];
        for (int i=0; i<tmp.length; i++)
            tmp[i] = ((Integer)residenceTime.get(i)).intValue();
        return tmp;
    }

    /**
     * Returns an array with the measureIndex of every response time measure
     * @return an array with measures' index
     */
    public int[] getResponseTimeMeasures() {
        int[] tmp = new int[responseTime.size()];
        for (int i=0; i<tmp.length; i++)
            tmp[i] = ((Integer)responseTime.get(i)).intValue();
        return tmp;
    }

    /**
     * Returns an array with the measureIndex of every utilization measure
     * @return an array with measures' index
     */
    public int[] getUtilizationMeasures() {
        int[] tmp = new int[utilization.size()];
        for (int i=0; i<tmp.length; i++)
            tmp[i] = ((Integer)utilization.get(i)).intValue();
        return tmp;
    }

    /**
     * Returns an array with the measureIndex of every system response time measure
     *
     * @return an array with measures' index
     */

⌨️ 快捷键说明

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