📄 paresultsmodel.java
字号:
}
/**
* 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
*/
public int[] getSystemResponseTimeMeasures() {
int[] tmp = new int[systemResponseTime.size()];
for (int i=0; i<tmp.length; i++)
tmp[i] = ((Integer)systemResponseTime.get(i)).intValue();
return tmp;
}
/**
* Returns an array with the measureIndex of every system throughput measure
*
* @return an array with measures' index
*/
public int[] getSystemThroughputMeasures() {
int[] tmp = new int[systemThroughput.size()];
for (int i=0; i<tmp.length; i++)
tmp[i] = ((Integer)systemThroughput.get(i)).intValue();
return tmp;
}
/**
* Returns an array with the measureIndex of every customer number measure
*
* @return an array with measures' index
*/
public int[] getCustomerNumberMeasures() {
int[] tmp = new int[customerNumber.size()];
for (int i=0; i<tmp.length; i++)
tmp[i] = ((Integer)customerNumber.get(i)).intValue();
return tmp;
}
// ------------------------- USELESS METHODS --------------------------------
/**
* Not implemented
*
* @param measureIndex index of the measure that this listener should listen
* @param listener listener to add or null to remove old one.
*/
public void addMeasureListener(int measureIndex, MeasureListener listener) {
//not implemented
}
/**
* Not implemented
*
* @param listener listener to be set or null to unset previous one
*/
public void setProgressTimeListener(ProgressTimeListener listener) {
//Not implemented
}
/**
* Not implemented
*
* @return true
*/
public boolean isSimulationFinished() {
return true;
}
/**
* Not implemented, return always 0
*
* @return 0
*/
public double getPollingInterval() {
return 0;
}
/**
* Not implemented
*
* @return 0
*/
public double getProgressTime() {
return 0;
}
/**
* 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 0; //To change body of implemented methods use File | Settings | File Templates.
}
// ------------------------- end USELESS METHODS --------------------------------
/**
* Inner class to store parameters of each measure
*/
protected class Measure {
public String name,
stationName,
className;
public Vector values;
public double alpha,
precision;
public int samples,
state,
type;
/**
* Construct a new Neasure object
* @param name measure name
* @param stationName reference station name
* @param className reference class name
* @param alpha measure alpha
* @param precision measure precision
* @param type type of the measure
*/
public Measure(String name, String stationName, String className,
double alpha, double precision, int type) {
this.name = name;
this.stationName = stationName;
this.className = className;
this.alpha = alpha;
this.precision = precision;
//this.state = state;
this.type = type;
values = new Vector();
}
/**
* Adds a new sample to current measure
* @param meanValue mean value of the sample
* @param upperBound upper bound of the sample
* @param lowerBound lower bound of the sample
*/
public void addSample(double meanValue, double upperBound, double lowerBound, boolean validity) {
MeasureValue val = new MeasureValue(meanValue, upperBound, lowerBound,validity);
values.add(val);
samples++;
}
/**
* Gets the number of sampples for this measure
* @return the number of samples
*/
public int getNumberOfSamples() {
return samples;
}
/**
* Gets the Vector containing measure values. Each element is an instance of
* <code>MeasureValue</code>
* @return the Vector containing the values of this Measure
*/
public Vector getValues() {
return values;
}
/**
* Gets the Vector containing measure values. Each element is an instance of
* <code>MeasureValue</code>
* @return the Vector containing the values of this Measure
*/
public int getType() {
return type;
}
}
/**
* Inner class that implements Value interface
*/
public class MeasureValue implements Value {
private double mean, upper, lower;
boolean valid;
/**
* Creates a new MeasureValue object
* @param meanValue mean value of the sample
* @param upperBound sample upper bound
* @param lowerBound sample lower bound
* @param isValid true if the measure could be computed with the requested precision
*/
public MeasureValue(double meanValue, double upperBound, double lowerBound, boolean isValid) {
mean = meanValue;
upper = upperBound;
lower = lowerBound;
valid = isValid;
}
public double getUpperBound() {
return upper;
}
public double getLowerBound() {
return lower;
}
public double getMeanValue() {
return mean;
}
public boolean isValid() {
return valid;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -