ss: Move plugins to Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / event / TmfLostEvent.java
index ce9b938b12aabbef9d420f46277ea32075950237..04d13ecea0a0aef5275bd6521d2c8e321fb94c19 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which
@@ -8,11 +8,13 @@
  *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
+ *   Alexandre Montplaisir - Made immutable
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.core.event;
 
-import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 
 /**
@@ -20,7 +22,7 @@ import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
  *
  * @author Francois Chouinard
  * @version 1.0
- * @since 2.0
+ * @since 1.2
 */
 public class TmfLostEvent extends TmfEvent implements ITmfLostEvent {
 
@@ -28,123 +30,68 @@ public class TmfLostEvent extends TmfEvent implements ITmfLostEvent {
     // Attributes
     // ------------------------------------------------------------------------
 
-    private TmfTimeRange fTimeRange;
-    private long fNbLostEvents;
+    private final TmfTimeRange fTimeRange;
+    private final long fNbLostEvents;
 
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
 
-    /**
-     * Default constructor which boils down to the default TmfEvent with no
-     * lost event over the empty time range.
-     */
-    public TmfLostEvent() {
-        this(null, ITmfContext.UNKNOWN_RANK, null, null, null, null, TmfTimeRange.NULL_RANGE, 0);
-    }
-
     /**
      * Full constructor
      *
-     * @param trace the parent trace
-     * @param rank the event rank (in the trace)
-     * @param timestamp the event timestamp
-     * @param source the event source
-     * @param type the event type
-     * @param reference the event reference
-     * @param timeRange the 'problematic' time range
-     * @param nbLostEvents the number of lost events in the time range
+     * @param trace
+     *            the parent trace
+     * @param rank
+     *            the event rank (in the trace)
+     * @param timestamp
+     *            the event timestamp
+     * @param source
+     *            the event source
+     * @param type
+     *            the event type
+     * @param reference
+     *            the event reference
+     * @param timeRange
+     *            the 'problematic' time range
+     * @param nbLostEvents
+     *            the number of lost events in the time range
+     * @since 2.0
      */
-    public TmfLostEvent(final ITmfTrace trace, final long rank, final ITmfTimestamp timestamp,
-            final String source, final ITmfEventType type, final String reference, final TmfTimeRange timeRange, final long nbLostEvents)
-    {
+    public TmfLostEvent(final ITmfTrace trace,
+            final long rank,
+            final ITmfTimestamp timestamp,
+            final String source,
+            final ITmfEventType type,
+            final String reference,
+            final TmfTimeRange timeRange,
+            final long nbLostEvents) {
         super(trace, rank, timestamp, source, type, null, reference);
         fTimeRange = timeRange;
         fNbLostEvents = nbLostEvents;
     }
 
-    /**
-     * Copy constructor
-     *
-     * @param event the original event
-     */
-    public TmfLostEvent(final ITmfLostEvent event) {
-        if (event == null) {
-            throw new IllegalArgumentException();
-        }
-        setTrace(event.getTrace());
-        setRank(event.getRank());
-        setTimestamp(event.getTimestamp());
-        setSource(event.getSource());
-        setType(event.getType());
-        setContent(event.getContent());
-        setReference(event.getReference());
-
-        fTimeRange = event.getTimeRange();
-        fNbLostEvents = event.getNbLostEvents();
-    }
-
     // ------------------------------------------------------------------------
     // ITmfLostEvent
     // ------------------------------------------------------------------------
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.event.ITmfLostEvent#getTimeRange()
+    /**
+     * @since 2.0
      */
     @Override
     public TmfTimeRange getTimeRange() {
         return fTimeRange;
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.event.ITmfLostEvent#getNbLostEvents()
-     */
     @Override
     public long getNbLostEvents() {
         return fNbLostEvents;
     }
 
-    // ------------------------------------------------------------------------
-    // Convenience setters
-    // ------------------------------------------------------------------------
-
-    /**
-     * @param timeRange the 'problematic' time range
-     */
-    protected void setTimeRange(final TmfTimeRange timeRange) {
-        fTimeRange = timeRange;
-    }
-
-    /**
-     * @param nbLostEvents the number of lost events
-     */
-    protected void setNbLostEvents(final long nbLostEvents) {
-        fNbLostEvents = nbLostEvents;
-    }
-
-    // ------------------------------------------------------------------------
-    // Cloneable
-    // ------------------------------------------------------------------------
-
-    /* (non-Javadoc)
-     * @see java.lang.Object#clone()
-     */
-    @Override
-    public TmfLostEvent clone() {
-        TmfLostEvent clone = null;
-        clone = (TmfLostEvent) super.clone();
-        clone.fTimeRange = fTimeRange;
-        clone.fNbLostEvents = fNbLostEvents;
-        return clone;
-    }
-
     // ------------------------------------------------------------------------
     // Object
     // ------------------------------------------------------------------------
 
-    /* (non-Javadoc)
-     * @see java.lang.Object#hashCode()
-     */
     @Override
     public int hashCode() {
         final int prime = 31;
@@ -154,9 +101,6 @@ public class TmfLostEvent extends TmfEvent implements ITmfLostEvent {
         return result;
     }
 
-    /* (non-Javadoc)
-     * @see java.lang.Object#equals(java.lang.Object)
-     */
     @Override
     public boolean equals(Object obj) {
         if (this == obj) {
@@ -182,13 +126,11 @@ public class TmfLostEvent extends TmfEvent implements ITmfLostEvent {
         return true;
     }
 
-    /* (non-Javadoc)
-     * @see java.lang.Object#toString()
-     */
     @Override
     @SuppressWarnings("nls")
     public String toString() {
-        return "TmfLostEvent [Event=" + super.toString() + ", fTimeRange=" + fTimeRange + ", fNbLostEvents=" + fNbLostEvents + "]";
+        return getClass().getSimpleName() + " [Event=" + super.toString() +
+                ", fTimeRange=" + fTimeRange + ", fNbLostEvents=" + fNbLostEvents + "]";
     }
 
 }
This page took 0.026604 seconds and 5 git commands to generate.