tmf/lttng: Remove unneeded (non-Javadoc) comments
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / trace / Stream.java
index 473eeaa044fbb35ab69d99c4fb9e6c9f30680bed..5fb6de2f22081739c637d94a46dbfa98e2b020e4 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
+ * Copyright (c) 2011-2013 Ericsson, Ecole Polytechnique de Montreal and others
  *
  * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which
@@ -16,14 +16,15 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Set;
 
-import org.eclipse.linuxtools.ctf.core.event.EventDeclaration;
-import org.eclipse.linuxtools.ctf.core.event.metadata.exceptions.ParseException;
+import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
+import org.eclipse.linuxtools.internal.ctf.core.event.metadata.exceptions.ParseException;
 
 /**
  * <b><u>Stream</u></b>
  * <p>
  * Represents a stream in a trace.
+ * @since 2.0
  */
 public class Stream {
 
@@ -52,7 +53,7 @@ public class Stream {
     /**
      * Maps event ids to events
      */
-    private final HashMap<Long, EventDeclaration> events = new HashMap<Long, EventDeclaration>();
+    private HashMap<Long, IEventDeclaration> events = new HashMap<Long, IEventDeclaration>();
 
     /**
      * The inputs associated to this stream
@@ -77,63 +78,125 @@ public class Stream {
     // Getters/Setters/Predicates
     // ------------------------------------------------------------------------
 
+    /**
+     * Sets the id of a stream
+     * @param id the id of a stream
+     */
     public void setId(long id) {
         this.id = id;
+        this.events = trace.createEvents(this.id);
     }
 
+    /**
+     * Gets the id of a stream
+     * @return id the id of a stream
+     */
     public Long getId() {
         return id;
     }
 
-    public boolean idIsSet() {
+    /**
+     * Is the id of a stream set
+     *
+     * @return If the ID is set or not
+     */
+    public boolean isIdSet() {
         return id != null;
     }
 
-    public boolean eventHeaderIsSet() {
+    /**
+     *
+     * @return is the event header set (timestamp and stuff) (see Ctf Spec)
+     */
+    public boolean isEventHeaderSet() {
         return eventHeaderDecl != null;
     }
 
-    public boolean eventContextIsSet() {
+    /**
+    *
+    * @return is the event context set (pid and stuff) (see Ctf Spec)
+    */
+    public boolean isEventContextSet() {
         return eventContextDecl != null;
     }
 
-    public boolean packetContextIsSet() {
+    /**
+     *
+     * @return Is the packet context set (see Ctf Spec)
+     */
+    public boolean isPacketContextSet() {
         return packetContextDecl != null;
     }
 
+    /**
+     *
+     * @param eventHeader the current event header for all events in this stream
+     */
     public void setEventHeader(StructDeclaration eventHeader) {
         this.eventHeaderDecl = eventHeader;
     }
 
+    /**
+     *
+     * @param eventContext the context for all events in this stream
+     */
     public void setEventContext(StructDeclaration eventContext) {
         this.eventContextDecl = eventContext;
     }
 
+    /**
+     *
+     * @param packetContext the packet context for all packets in this stream
+     */
     public void setPacketContext(StructDeclaration packetContext) {
         this.packetContextDecl = packetContext;
     }
 
+    /**
+     *
+     * @return the event header declaration in structdeclaration form
+     */
     public StructDeclaration getEventHeaderDecl() {
         return eventHeaderDecl;
     }
 
+    /**
+     *
+     * @return the event context declaration in structdeclaration form
+     */
     public StructDeclaration getEventContextDecl() {
         return eventContextDecl;
     }
 
+    /**
+     *
+     * @return the packet context declaration in structdeclaration form
+     */
     public StructDeclaration getPacketContextDecl() {
         return packetContextDecl;
     }
 
+    /**
+     *
+     * @return the set of all stream inputs for this stream
+     */
     public Set<StreamInput> getStreamInputs() {
         return inputs;
     }
 
+    /**
+     *
+     * @return the parent trace
+     */
     public CTFTrace getTrace() {
         return trace;
     }
 
-    public HashMap<Long, EventDeclaration> getEvents() {
+    /**
+     *
+     * @return all the event declarations for this stream, using the id as a key for the hashmap.
+     */
+    public HashMap<Long, IEventDeclaration> getEvents() {
         return events;
     }
 
@@ -151,10 +214,12 @@ public class Stream {
      * is present in the map.
      *
      * @param event
-     *            The event to add.
+     *            The event to add
      * @throws ParseException
+     *             If there was a problem reading the event or adding it to the
+     *             stream
      */
-    public void addEvent(EventDeclaration event) throws ParseException {
+    public void addEvent(IEventDeclaration event) throws ParseException {
         /*
          * If there is an event without id (the null key), it must be the only
          * one
@@ -192,10 +257,6 @@ public class Stream {
         inputs.add(input);
     }
 
-
-    /* (non-Javadoc)
-     * @see java.lang.Object#toString()
-     */
     @Override
     public String toString() {
         return "Stream [id=" + id + ", packetContextDecl=" + packetContextDecl //$NON-NLS-1$ //$NON-NLS-2$
This page took 0.025268 seconds and 5 git commands to generate.