report代码分析3--Report

A bstract superclass for all reports所有报告的抽象父类

outline

public abstract class Report{}

public Report(){}   //构造方法,若未设置className.output,则 使用scenarioname_classname.txt作为文件名,并从相关setting中读取设置

private void checkDirExistence(String outFileName)  
private boolean createDirs(File directory) //查看是否存在文件目录,若无,则新建


protected void init() //初始化报告输出。在每个报告文件开始都需要调用
{
this.lastReportTime = getSimTime();
if (outputInterval > 0) {
createSuffixedOutput(outFileName);
}
else {
createOutput(outFileName);
}
}

private void createOutput(String outFileName) //创建新的输出文件
private void createSuffixedOutput(String outFileName) //创建新的数字后缀(逐渐增加)的输出


protected void newEvent()   //每一个新的报告事件生成前调用
{
if (this.outputInterval <= 0) {
return;
}
if (getSimTime() > this.lastReportTime + this.outputInterval) {
done(); // finalize the old file
init(); // init the new file
}
}

protected void write(String txt) //使用固定的格式输出
 {
if (out == null) {
init();
}
out.println(prefix + txt);   //protected PrintWriter out;
}

protected String format(double value) //格式化
 {
return String.format("%." + precision + "f", value);
}

protected void setPrefix(String txt) //设置后缀
protected String getScenarioName() //返回场景名称

protected double getSimTime()  //返回当前模拟时间
{
return SimClock.getTime();
}















  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值