Example usage for org.apache.commons.lang.time StopWatch StopWatch

List of usage examples for org.apache.commons.lang.time StopWatch StopWatch

Introduction

In this page you can find the example usage for org.apache.commons.lang.time StopWatch StopWatch.

Prototype

public StopWatch() 

Source Link

Document

Constructor.

Usage

From source file:nu.mine.kino.projects.ACCreatorTest.java

@Test
public void test() throws FileNotFoundException, ProjectException {

    File input = new File("project_management_tools.xls");
    File input_base = new File("base_project_management_tools.xls");
    System.out.println(input.getAbsolutePath());

    StopWatch watch = new StopWatch();
    watch.start();//from   w w w .j  a  va2 s.c  o  m

    List<ACBean> createACList = ACCreator.createACList(input, input_base);
    watch.stop();
    for (ACBean acBean : createACList) {
        System.out.println(acBean);
    }
    System.out.println(watch.getTime() + " ms.");
    watch.reset();

}

From source file:nu.mine.kino.projects.ACCreatorTest.java

@Test
public void test2() throws FileNotFoundException, ProjectException {

    File input = new File("project_management_tools.xls");
    File input_base = new File("base_project_management_tools.xls");
    System.out.println(input.getAbsolutePath());

    StopWatch watch = new StopWatch();
    watch.start();//from  www .  j a v a 2  s  . c o m

    List<ACBean> createACList = ACCreator.createACList(input, input_base);
    List<ACBean> filterAC = ProjectUtils.filterList(createACList);
    watch.stop();

    printList(createACList);
    printList(filterAC);
    System.out.println(watch.getTime() + " ms.");
    watch.reset();

}

From source file:nu.mine.kino.projects.ACCreatorTest.java

@Test
public void test3() throws FileNotFoundException, ProjectException {
    ProjectWriter.write(new File("project_management_tools.xls"));
    ProjectWriter.write(new File("base_project_management_tools.xls"));

    File input = new File("project_management_tools.xls.json");
    File input_base = new File("base_project_management_tools.xls.json");
    System.out.println(input.getAbsolutePath());

    StopWatch watch = new StopWatch();
    watch.start();//from  ww w.  j  ava 2 s.co  m

    List<ACBean> createACList = ACCreator.createACListFromJSON(input, input_base);
    List<ACBean> filterAC = ProjectUtils.filterList(createACList);
    watch.stop();

    printList(createACList);
    printList(filterAC);
    System.out.println(watch.getTime() + " ms.");
    watch.reset();

}

From source file:nu.mine.kino.projects.ExcelProjectCreatorTest.java

@Test
public void test() throws ProjectException {
    String fileName = "testdata";

    File baseDir = new File("./");
    String input = fileName + "." + "xls";
    File file = new File(baseDir, input);

    StopWatch watch = new StopWatch();
    watch.start();//ww w.  j ava  2  s  .  co  m
    Project project = new ExcelProjectCreator(file).createProject();
    watch.stop();
    System.out.println(watch.getTime() + " ms.");

    TaskInformation[] infos = project.getTaskInformations();
    System.out.println(infos.length);
    checkPV(infos);
    checkAC(infos);
    checkEV(infos);
    checkNumberOfDays(infos);

    checkProjectInfo(project);

}

From source file:nu.mine.kino.projects.PVCreatorTest.java

@Test
public void test() throws FileNotFoundException, ProjectException {

    File input = new File("project_management_tools.xls");
    System.out.println(input.getAbsolutePath());

    // File create = PVCreator.create(input);
    // System.out.println(create.getAbsolutePath());

    Project project = new ExcelProjectCreator(input).createProject();
    StopWatch watch = new StopWatch();
    watch.start();/*from w w w.j  a  va2s. com*/
    WriteUtils.writePVForPivot(project, new File(input.getParent(), "hogehoge.tsv"));
    watch.stop();
    System.out.println(watch.getTime() + " ms.");
    watch.reset();

}

From source file:nu.mine.kino.projects.utils.ProjectUtilsTest.java

public void test0(String fileName) throws FileNotFoundException, ProjectException {
    File baseDir = new File("./");
    // String fileName = "project_management_tools";
    String input = fileName + "." + "xls";

    // java.io.InputStream in = null;
    File target = new File(baseDir, input);
    // in = new java.io.FileInputStream(target);

    StopWatch watch = new StopWatch();
    watch.start();//from  w  w  w .  j  a  v a2 s.  c om
    Project projectOrg = new ExcelProjectCreator(target).createProject();
    watch.stop();
    System.out.println(watch.getTime() + " ms.");
    watch.reset();
    // fail("Not yet implemented");
    File output = ProjectWriter.write(projectOrg, new File(input + ".json"));
    System.out.println(output.getAbsolutePath());

    watch.start();
    // Project projectJ = new JSONProjectCreator(new
    // FileInputStream(output))
    // .createProject();
    // watch.stop();
    // System.out.println(watch.getTime() + " ms.");
    //
    // // projectJ.getProjectStartDate().setTime(new Date().getTime());
    //
    // String expected = JSON.encode(projectOrg);
    // String actual = JSON.encode(projectJ);
    //
    // System.out.println("---------------");
    // System.out.println(expected);
    // System.out.println(actual);
    // System.out.println("---------------");
    // assertEquals(expected, actual);

}

From source file:nu.mine.kino.projects.utils.ProjectUtilsTest.java

public void testDate(String fileName) throws FileNotFoundException, ProjectException {
    File baseDir = new File("./");
    String input = fileName + "." + "xls";
    File target = new File(baseDir, input);

    StopWatch watch = new StopWatch();
    watch.start();//  w ww  .  j ava  2 s .  co  m
    Project projectOrg = new ExcelProjectCreator(target).createProject();
    watch.stop();
    System.out.println(watch.getTime() + " ms.");
    watch.reset();
    System.out.println(projectOrg.getBaseDate());
    System.out.println(ProjectUtils.nextTradingDate(projectOrg));
    System.out.println(ProjectUtils.nextTradingDate(new Date(), projectOrg));

    sevenDaysLater(projectOrg);
}

From source file:nu.mine.kino.projects.utils.ProjectUtilsTest.java

@Test
public void test() throws FileNotFoundException, ProjectException {
    File baseDir = new File("./");
    String fileName = "project_management_tools";
    String input = fileName + "." + "xls";

    // java.io.InputStream in = null;
    File target = new File(baseDir, input);
    // in = new java.io.FileInputStream(target);

    StopWatch watch = new StopWatch();
    watch.start();/* w w  w .  ja  v  a2s.co  m*/
    Project projectOrg = new ExcelProjectCreator(target).createProject();
    watch.stop();
    System.out.println(watch.getTime() + " ms.");
    watch.reset();
    // fail("Not yet implemented");
    File output = ProjectWriter.write(projectOrg, new File(input + ".json"));
    System.out.println(output.getAbsolutePath());

    watch.start();
    Project projectJ = new JSONProjectCreator(new FileInputStream(output)).createProject();
    watch.stop();
    System.out.println(watch.getTime() + " ms.");

    // projectJ.getProjectStartDate().setTime(new Date().getTime());

    String expected = JSON.encode(projectOrg);
    String actual = JSON.encode(projectJ);

    System.out.println("---------------");
    System.out.println(expected);
    System.out.println(actual);
    System.out.println("---------------");
    assertEquals(expected, actual);

}

From source file:nu.mine.kino.projects.utils.ProjectUtilsTest.java

@Test
public void test2() throws FileNotFoundException, ProjectException {
    File baseDir = new File("./");
    String fileName = "project_management_tools";
    String input = fileName + "." + "xls";

    // java.io.InputStream in = null;
    File target = new File(baseDir, input);
    // in = new java.io.FileInputStream(target);

    StopWatch watch = new StopWatch();
    watch.start();//from   ww w.j a  v a  2  s .c  o  m
    Project projectOrg = new ExcelProjectCreator(target).createProject();
    watch.stop();
    System.out.println(watch.getTime() + " ms.");
    watch.reset();

    List<PVBean> list = PVCreator.createCurrentList(projectOrg);
    for (PVBean pvBean : list) {
        System.out.println(pvBean);
    }

    Date startDate = projectOrg.getProjectStartDate();
    Date endDate = projectOrg.getProjectEndDate();
    Date cursor = startDate;
    while (cursor.getTime() <= endDate.getTime()) {
        // System.out.println(cursor);
        System.out.println(ProjectUtils.calculateTotalPVOfProject(projectOrg, cursor));
        cursor = DateUtils.addDays(cursor, 1);

    }
}

From source file:ome.formats.importer.util.ProportionalTimeEstimatorImpl.java

/**
 * Creates a new object of this class with a defined internal buffer size.
 *
 * @param imageContainerSize/*from  w  ww  .  ja v a 2  s .c om*/
 *            The total size in bytes of the data container for which upload
 *            time is being estimated.
 */
public ProportionalTimeEstimatorImpl(long imageContainerSize) {
    sw = new StopWatch();
    this.imageContainerSize = imageContainerSize;
}