ss: Move plugins to Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / viewers / statistics / model / TmfStatisticsValues.java
CommitLineData
79e08fd0 1/*******************************************************************************
b544077e 2 * Copyright (c) 2011, 2012 Ericsson
013a5f1c 3 *
79e08fd0
BH
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
013a5f1c 8 *
79e08fd0 9 * Contributors:
09667aa4 10 * Mathieu Denis <mathieu.denis@polymtl.ca> - Intial API and Implementation
79e08fd0
BH
11 *******************************************************************************/
12
cfd22ad0 13package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
79e08fd0
BH
14
15/**
5aaa97db 16 * Primitive container for Statistics values.
013a5f1c 17 *
09667aa4 18 * Contains information about statistics that can be retrieved with any type of
5aaa97db 19 * traces.
013a5f1c 20 *
5aaa97db
AM
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.
25a042b3 23 *
5aaa97db 24 * @author Mathieu Denis
cfd22ad0
MD
25 * @version 2.0
26 * @since 2.0
79e08fd0 27 */
5aaa97db 28public class TmfStatisticsValues {
cfd22ad0 29
09667aa4 30 /**
25a042b3 31 * Total number of events.
25a042b3
MD
32 */
33 protected long fNbEvents = 0;
cfd22ad0 34
25a042b3
MD
35 /**
36 * Number of events within a time range (Partial event count).
25a042b3
MD
37 */
38 protected long fNbEventsInTimeRange = 0;
39
40 /**
41 * @return the total events count
25a042b3
MD
42 */
43 public long getTotal() {
44 return fNbEvents;
45 }
46
47 /**
48 * @return the partial events count within a time range
25a042b3
MD
49 */
50 public long getPartial() {
51 return fNbEventsInTimeRange;
52 }
53
54 /**
89c06060 55 * Set either the "global" or the "time range" value.
25a042b3 56 *
89c06060
AM
57 * @param global
58 * True to set the global value, false for the timerange one.
25a042b3 59 * @param nb
89c06060 60 * The new value to set
25a042b3 61 */
89c06060 62 public void setValue(boolean global, long nb) {
25a042b3 63 if (nb > 0) {
89c06060
AM
64 if (global) {
65 fNbEvents = nb;
66 } else {
67 fNbEventsInTimeRange = nb;
68 }
25a042b3
MD
69 }
70 }
71
72 /**
73 * Resets the total number of events.
25a042b3
MD
74 */
75 public void resetTotalCount() {
76 fNbEvents = 0;
77 }
78
79 /**
80 * Resets the number of events within a time range (partial events count).
09667aa4 81 */
25a042b3
MD
82 public void resetPartialCount() {
83 fNbEventsInTimeRange = 0;
84 }
7588c810
AM
85
86 @Override
87 public String toString() {
88 return fNbEvents + ", " + fNbEventsInTimeRange; //$NON-NLS-1$
89 }
79e08fd0 90}
This page took 0.055741 seconds and 5 git commands to generate.