1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 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
.linuxtools
.tmf
.core
.event
;
16 import org
.eclipse
.linuxtools
.tmf
.core
.timestamp
.ITmfTimestamp
;
17 import org
.eclipse
.linuxtools
.tmf
.core
.timestamp
.TmfTimeRange
;
18 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfTrace
;
21 * A basic implementation of ITmfLostEvent.
23 * @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)
56 * the 'problematic' time range
58 * the number of lost events in the time range
61 public TmfLostEvent(final ITmfTrace trace
,
63 final ITmfTimestamp timestamp
,
65 final ITmfEventType type
,
66 final String reference
,
67 final TmfTimeRange timeRange
,
68 final long nbLostEvents
) {
69 super(trace
, rank
, timestamp
, source
, type
, null, reference
);
70 fTimeRange
= timeRange
;
71 fNbLostEvents
= nbLostEvents
;
74 // ------------------------------------------------------------------------
76 // ------------------------------------------------------------------------
82 public TmfTimeRange
getTimeRange() {
87 public long getNbLostEvents() {
91 // ------------------------------------------------------------------------
93 // ------------------------------------------------------------------------
96 public int hashCode() {
98 int result
= super.hashCode();
99 result
= prime
* result
+ (int) (fNbLostEvents ^
(fNbLostEvents
>>> 32));
100 result
= prime
* result
+ ((fTimeRange
== null) ?
0 : fTimeRange
.hashCode());
105 public boolean equals(Object obj
) {
109 if (!super.equals(obj
)) {
112 if (!(obj
instanceof TmfLostEvent
)) {
115 TmfLostEvent other
= (TmfLostEvent
) obj
;
116 if (fNbLostEvents
!= other
.fNbLostEvents
) {
119 if (fTimeRange
== null) {
120 if (other
.fTimeRange
!= null) {
123 } else if (!fTimeRange
.equals(other
.fTimeRange
)) {
130 @SuppressWarnings("nls")
131 public String
toString() {
132 return getClass().getSimpleName() + " [Event=" + super.toString() +
133 ", fTimeRange=" + fTimeRange
+ ", fNbLostEvents=" + fNbLostEvents
+ "]";
This page took 0.035502 seconds and 6 git commands to generate.