report代码分析3--Report
2015-11-13 16:26
295 查看
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();
}
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();
}
相关文章推荐
- java excel表格数据导入
- org.springframework.util.Assert 这个类,叫方法入参检测工具类
- GitHub Masonry 说明文档翻译
- JAVA学习8_@Override标签背后的小秘密
- report代码分析2——ConnectivityDtnsim2Report,ConnectivityONEReport
- Pycharm 新手一进去全是小波浪的非重要报错(PEP8)
- JAVA I/O输入输出流详解
- Java SE__java代码注释规范
- MyEclipse注册
- 从头认识java-8.10 接口里面的类
- rvm实现一个系统同时运行多个ruby版本项目(用于解决一个服务器部署多个ruby版本项目的实现)
- python 函数参数
- report包中的类及代码分析
- C、C++中union用法总结
- C语言:使用冒泡排序,排序多个字符串(优化)。
- C、C++内存对齐
- 从Jni到Java增加一个系统服务SystemServer,并通过getSystemService调用
- Movement models代码分析3--WorkingDayMovement
- Java学习笔记--导航
- Java SE__关于Java的File.separator