View Javadoc

1   /*
2    * @(#)$Id: JdomClassStatistic.java 689 2009-07-22 00:10:27Z bsigner $
3    *
4    * Author       :   Ueli Kurmann, igesture@uelikurmann.ch
5    *
6    * Purpose      : 	XML support for the ClassStatistic class.
7    *
8    * -----------------------------------------------------------------------
9    *
10   * Revision Information:
11   *
12   * Date             Who         Reason
13   *
14   * Dec 26, 2006     ukurmann    Initial Release
15   * Mar 22, 2007     bsigner     Cleanup
16   *
17   * -----------------------------------------------------------------------
18   *
19   * Copyright 1999-2009 ETH Zurich. All Rights Reserved.
20   *
21   * This software is the proprietary information of ETH Zurich.
22   * Use is subject to license terms.
23   * 
24   */
25  
26  
27  package org.ximtec.igesture.batch.jdom;
28  
29  import org.jdom.Element;
30  import org.sigtec.jdom.element.JdomIntegerElement;
31  import org.ximtec.igesture.batch.Statistic;
32  
33  
34  /**
35   * XML support for the ClassStatistic class.
36   * 
37   * @version 1.0 Dec 2006
38   * @author Ueli Kurmann, igesture@uelikurmann.ch
39   * @author Beat Signer, signer@inf.ethz.ch
40   */
41  public class JdomClassStatistic extends Element {
42  
43     public static final String ROOT_TAG = "classStatistic";
44  
45     public static final String NAME_ATTRIBUTE = "name";
46  
47     public static final String NUMBER_OF_REJECT_CORRECT = "numberOfRejectCorrect";
48  
49     public static final String NUMBER_OF_REJECT_ERROR = "numberOfRejectError";
50  
51     public static final String NUMBER_OF_ERRORS = "numberOfErrors";
52  
53     public static final String NUMBER_OF_CORRECTS = "numberOfCorrects";
54  
55  
56     public JdomClassStatistic(Statistic statistic) {
57        super(ROOT_TAG);
58        this.setAttribute(NAME_ATTRIBUTE, statistic.getClassName());
59        this.addContent(new JdomIntegerElement(NUMBER_OF_CORRECTS, statistic
60              .getCorrect()));
61        this.addContent(new JdomIntegerElement(NUMBER_OF_ERRORS, statistic
62              .getError()));
63        this.addContent(new JdomIntegerElement(NUMBER_OF_REJECT_ERROR, statistic
64              .getRejectError()));
65        this.addContent(new JdomIntegerElement(NUMBER_OF_REJECT_CORRECT, statistic
66              .getRejectCorrect()));
67     }
68  
69  }