1 /*******************************************************************************
2 * Copyright (c) 2012 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 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.core
.event
;
15 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfContext
;
16 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfTrace
;
19 * A basic implementation of ITmfLostEvent.
21 * @author Francois Chouinard
25 public class TmfLostEvent
extends TmfEvent
implements ITmfLostEvent
{
27 // ------------------------------------------------------------------------
29 // ------------------------------------------------------------------------
31 private TmfTimeRange fTimeRange
;
32 private long fNbLostEvents
;
34 // ------------------------------------------------------------------------
36 // ------------------------------------------------------------------------
39 * Default constructor which boils down to the default TmfEvent with no
40 * lost event over the empty time range.
42 public TmfLostEvent() {
43 this(null, ITmfContext
.UNKNOWN_RANK
, null, null, null, null, TmfTimeRange
.NULL_RANGE
, 0);
49 * @param trace the parent trace
50 * @param rank the event rank (in the trace)
51 * @param timestamp the event timestamp
52 * @param source the event source
53 * @param type the event type
54 * @param reference the event reference
55 * @param timeRange the 'problematic' time range
56 * @param nbLostEvents the number of lost events in the time range
58 public TmfLostEvent(final ITmfTrace trace
, final long rank
, final ITmfTimestamp timestamp
,
59 final String source
, final ITmfEventType type
, final String reference
, final TmfTimeRange timeRange
, final long nbLostEvents
)
61 super(trace
, rank
, timestamp
, source
, type
, null, reference
);
62 fTimeRange
= timeRange
;
63 fNbLostEvents
= nbLostEvents
;
69 * @param event the original event
71 public TmfLostEvent(final ITmfLostEvent event
) {
72 super( event
.getTrace(),
78 event
.getReference());
79 fTimeRange
= event
.getTimeRange();
80 fNbLostEvents
= event
.getNbLostEvents();
83 // ------------------------------------------------------------------------
85 // ------------------------------------------------------------------------
88 public TmfTimeRange
getTimeRange() {
93 public long getNbLostEvents() {
97 // ------------------------------------------------------------------------
98 // Convenience setters
99 // ------------------------------------------------------------------------
102 * @param timeRange the 'problematic' time range
104 protected void setTimeRange(final TmfTimeRange timeRange
) {
105 fTimeRange
= timeRange
;
109 * @param nbLostEvents the number of lost events
111 protected void setNbLostEvents(final long nbLostEvents
) {
112 fNbLostEvents
= nbLostEvents
;
115 // ------------------------------------------------------------------------
117 // ------------------------------------------------------------------------
120 public int hashCode() {
121 final int prime
= 31;
122 int result
= super.hashCode();
123 result
= prime
* result
+ (int) (fNbLostEvents ^
(fNbLostEvents
>>> 32));
124 result
= prime
* result
+ ((fTimeRange
== null) ?
0 : fTimeRange
.hashCode());
129 public boolean equals(Object obj
) {
133 if (!super.equals(obj
)) {
136 if (!(obj
instanceof TmfLostEvent
)) {
139 TmfLostEvent other
= (TmfLostEvent
) obj
;
140 if (fNbLostEvents
!= other
.fNbLostEvents
) {
143 if (fTimeRange
== null) {
144 if (other
.fTimeRange
!= null) {
147 } else if (!fTimeRange
.equals(other
.fTimeRange
)) {
154 @SuppressWarnings("nls")
155 public String
toString() {
156 return "TmfLostEvent [Event=" + super.toString() + ", fTimeRange=" + fTimeRange
+ ", fNbLostEvents=" + fNbLostEvents
+ "]";
This page took 0.032863 seconds and 5 git commands to generate.