1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 package org.ximtec.igesture.batch.jdom;
28
29 import org.jdom.Element;
30 import org.sigtec.jdom.element.JdomDoubleElement;
31 import org.sigtec.jdom.element.JdomIntegerElement;
32 import org.ximtec.igesture.batch.BatchResult;
33 import org.ximtec.igesture.batch.Statistic;
34 import org.ximtec.igesture.configuration.jdom.JdomConfiguration;
35
36
37
38
39
40
41
42
43
44 public class JdomBatchResult extends Element {
45
46 public static final String RUNNING_TIME = "runningTime";
47
48 private static final String PRECISION = "precision";
49
50 public static final String RECALL = "recall";
51
52 public static final String NUMBER_OF_SAMPLES = "numberOfSamples";
53
54 public static final String NUMBER_OF_NOISE = "numberOfNoise";
55
56 public static final String NUMBER_OF_REJECT_CORRECT = "numberOfRejectCorrect";
57
58 public static final String NUMBER_OF_REJECT_ERROR = "numberOfRejectError";
59
60 public static final String NUMBER_OF_ERRORS = "numberOfErrors";
61
62 public static final String NUMBER_OF_CORRECTS = "numberOfCorrects";
63
64 public static final String ROOT_TAG = "batchResult";
65
66 public static final String NAME_ATTRIBUTE = "name";
67
68 public static final String UUID_ATTRIBUTE = "id";
69
70
71 public JdomBatchResult(BatchResult result) {
72 super(ROOT_TAG);
73 this.addContent(new JdomIntegerElement(NUMBER_OF_CORRECTS, result
74 .getNumberOfCorrects()));
75 this.addContent(new JdomIntegerElement(NUMBER_OF_ERRORS, result
76 .getNumberOfErrors()));
77 this.addContent(new JdomIntegerElement(NUMBER_OF_REJECT_CORRECT, result
78 .getNumberOfRejectCorrect()));
79 this.addContent(new JdomIntegerElement(NUMBER_OF_REJECT_ERROR, result
80 .getNumberOfRejectError()));
81 this.addContent(new JdomIntegerElement(NUMBER_OF_SAMPLES, result
82 .getNumberOfSamples()));
83 this.addContent(new JdomIntegerElement(NUMBER_OF_NOISE, result
84 .getNumberOfNoise()));
85 this.addContent(new JdomDoubleElement(RECALL, result.getRecall()));
86 this.addContent(new JdomDoubleElement(PRECISION, result.getPrecision()));
87 this.addContent(new JdomDoubleElement(RUNNING_TIME, result
88 .getRunningTime()));
89 this.addContent(new JdomConfiguration(result.getConfiguration()));
90
91 for (final Statistic statistic : result.getStatistics()) {
92 this.addContent(new JdomClassStatistic(statistic));
93 }
94
95 }
96
97 }