tmf: Rename the UI TmfStatistics class to TmfStatisticsValues
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / viewers / statistics / model / TmfStatisticsValues.java
1 /*******************************************************************************
2 * Copyright (c) 2011, 2012 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Mathieu Denis <mathieu.denis@polymtl.ca> - Intial API and Implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
14
15 /**
16 * Primitive container for Statistics values.
17 *
18 * Contains information about statistics that can be retrieved with any type of
19 * traces.
20 *
21 * There are two counters : one for the total number of events in the trace, and
22 * another for the number of events in the selected time range.
23 *
24 * @author Mathieu Denis
25 * @version 2.0
26 * @since 2.0
27 */
28 public class TmfStatisticsValues {
29
30 /**
31 * Total number of events.
32 */
33 protected long fNbEvents = 0;
34
35 /**
36 * Number of events within a time range (Partial event count).
37 */
38 protected long fNbEventsInTimeRange = 0;
39
40 /**
41 * @return the total events count
42 */
43 public long getTotal() {
44 return fNbEvents;
45 }
46
47 /**
48 * @return the partial events count within a time range
49 */
50 public long getPartial() {
51 return fNbEventsInTimeRange;
52 }
53
54 /**
55 * Increments by one the total number of events.
56 */
57 public void incrementTotal() {
58 ++fNbEvents;
59 }
60
61 /**
62 * Increments <b>nb</b> times the total number of events.
63 *
64 * @param nb
65 * Amount that will be added to the total events count. Ignored
66 * if negative.
67 */
68 public void incrementTotal(int nb) {
69 if (nb > 0) {
70 fNbEvents += nb;
71 }
72 }
73
74 /**
75 * Increments by one the number of events within a time range (partial events
76 * count).
77 */
78 public void incrementPartial() {
79 ++fNbEventsInTimeRange;
80 }
81
82 /**
83 * Increments <b>nb</b> times the number of events within a time range
84 * (partial events count).
85 *
86 * @param nb
87 * Amount that will be added to the partial events count. Ignored
88 * if negative.
89 */
90 public void incrementPartial(int nb) {
91 if (nb > 0) {
92 fNbEventsInTimeRange += nb;
93 }
94 }
95
96 /**
97 * Resets the total number of events.
98 */
99 public void resetTotalCount() {
100 fNbEvents = 0;
101 }
102
103 /**
104 * Resets the number of events within a time range (partial events count).
105 */
106 public void resetPartialCount() {
107 fNbEventsInTimeRange = 0;
108 }
109 }
This page took 0.032878 seconds and 6 git commands to generate.