1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are made
5 * 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
10 * Francois Chouinard - Initial API and implementation
11 * Alexandre Montplaisir - Made immutable
12 *******************************************************************************/
14 package org
.eclipse
.tracecompass
.tmf
.core
.event
;
16 import static org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.equalsNullable
;
18 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.ITmfTimestamp
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.TmfTimeRange
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
23 * A basic implementation of ITmfLostEvent.
25 * @author Francois Chouinard
27 public class TmfLostEvent
extends TmfEvent
implements ITmfLostEvent
{
29 // ------------------------------------------------------------------------
31 // ------------------------------------------------------------------------
33 private final TmfTimeRange fTimeRange
;
34 private final long fNbLostEvents
;
36 // ------------------------------------------------------------------------
38 // ------------------------------------------------------------------------
46 * the event rank (in the trace)
52 * the 'problematic' time range
54 * the number of lost events in the time range
56 public TmfLostEvent(final ITmfTrace trace
,
58 final ITmfTimestamp timestamp
,
59 final ITmfEventType type
,
60 final TmfTimeRange timeRange
,
61 final long nbLostEvents
) {
62 super(trace
, rank
, timestamp
, type
, null);
63 fTimeRange
= timeRange
;
64 fNbLostEvents
= nbLostEvents
;
67 // ------------------------------------------------------------------------
69 // ------------------------------------------------------------------------
72 public TmfTimeRange
getTimeRange() {
77 public long getNbLostEvents() {
81 // ------------------------------------------------------------------------
83 // ------------------------------------------------------------------------
86 public int hashCode() {
88 int result
= super.hashCode();
89 result
= prime
* result
+ (int) (fNbLostEvents ^
(fNbLostEvents
>>> 32));
90 result
= prime
* result
+ ((fTimeRange
== null) ?
0 : fTimeRange
.hashCode());
95 public boolean equals(Object obj
) {
99 if (!super.equals(obj
)) {
102 if (!(obj
instanceof TmfLostEvent
)) {
105 TmfLostEvent other
= (TmfLostEvent
) obj
;
106 if (fNbLostEvents
!= other
.fNbLostEvents
) {
109 if (!equalsNullable(fTimeRange
, other
.fTimeRange
)) {
116 @SuppressWarnings("nls")
117 public String
toString() {
118 return getClass().getSimpleName() + " [Event=" + super.toString() +
119 ", fTimeRange=" + fTimeRange
+ ", fNbLostEvents=" + fNbLostEvents
+ "]";
This page took 0.033066 seconds and 5 git commands to generate.