tmf: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.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 * Set either the "global" or the "time range" value.
56 *
57 * @param global
58 * True to set the global value, false for the timerange one.
59 * @param nb
60 * The new value to set
61 */
62 public void setValue(boolean global, long nb) {
63 if (nb > 0) {
64 if (global) {
65 fNbEvents = nb;
66 } else {
67 fNbEventsInTimeRange = nb;
68 }
69 }
70 }
71
72 /**
73 * Resets the total number of events.
74 */
75 public void resetTotalCount() {
76 fNbEvents = 0;
77 }
78
79 /**
80 * Resets the number of events within a time range (partial events count).
81 */
82 public void resetPartialCount() {
83 fNbEventsInTimeRange = 0;
84 }
85
86 @Override
87 public String toString() {
88 return fNbEvents + ", " + fNbEventsInTimeRange; //$NON-NLS-1$
89 }
90 }
This page took 0.054498 seconds and 5 git commands to generate.