gdbtrace: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.control.core / src / org / eclipse / linuxtools / internal / lttng2 / control / core / model / impl / ChannelInfo.java
index f4b770aafc978ac936e9c27b439f819fdb91a6d3..6e2f6269921b8bcd2887787bd3dd6027b196b253 100644 (file)
@@ -10,6 +10,7 @@
  *   Bernd Hufmann - Initial API and implementation
  *   Simon Delisle - Updated for support of LTTng Tools 2.2
  **********************************************************************/
+
 package org.eclipse.linuxtools.internal.lttng2.control.core.model.impl;
 
 import java.util.ArrayList;
@@ -18,13 +19,12 @@ import java.util.List;
 
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.IChannelInfo;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.IEventInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
 
 /**
- * <p>
  * Implementation of the trace channel interface (IChannelInfo) to store channel
  * related data.
- * </p>
  *
  * @author Bernd Hufmann
  */
@@ -56,7 +56,7 @@ public class ChannelInfo extends TraceInfo implements IChannelInfo {
     /**
      * The Output type of the channel.
      */
-    private String fOutputType = ""; //$NON-NLS-1$
+    private TraceChannelOutputType fOutputType = TraceChannelOutputType.UNKNOWN;
     /**
      * The channel enable state.
      */
@@ -78,13 +78,14 @@ public class ChannelInfo extends TraceInfo implements IChannelInfo {
      */
     private BufferType fBufferType = BufferType.BUFFER_TYPE_UNKNOWN;
 
-
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
     /**
      * Constructor
-     * @param name - name channel
+     *
+     * @param name
+     *            - name channel
      */
     public ChannelInfo(String name) {
         super(name);
@@ -92,7 +93,9 @@ public class ChannelInfo extends TraceInfo implements IChannelInfo {
 
     /**
      * Copy constructor
-     * @param other - the instance to copy
+     *
+     * @param other
+     *            - the instance to copy
      */
     public ChannelInfo(ChannelInfo other) {
         super(other);
@@ -104,12 +107,12 @@ public class ChannelInfo extends TraceInfo implements IChannelInfo {
         fMaxSizeTraceFiles = other.fMaxSizeTraceFiles;
         fMaxNumberTraceFiles = other.fMaxNumberTraceFiles;
         fBufferType = other.fBufferType;
-        fOutputType = (other.fOutputType == null ? null : String.valueOf(other.fOutputType));
+        fOutputType = (other.fOutputType == null ? null : other.fOutputType);
         fState = other.fState;
         for (Iterator<IEventInfo> iterator = other.fEvents.iterator(); iterator.hasNext();) {
             IEventInfo event = iterator.next();
             if (event instanceof EventInfo) {
-                fEvents.add(new EventInfo((EventInfo)event));
+                fEvents.add(new EventInfo((EventInfo) event));
             } else {
                 fEvents.add(event);
             }
@@ -171,12 +174,17 @@ public class ChannelInfo extends TraceInfo implements IChannelInfo {
     }
 
     @Override
-    public String getOutputType() {
+    public TraceChannelOutputType getOutputType() {
         return fOutputType;
     }
 
     @Override
     public void setOutputType(String type) {
+        fOutputType = TraceChannelOutputType.valueOfString(type);
+    }
+
+    @Override
+    public void setOutputType(TraceChannelOutputType type) {
         fOutputType = type;
     }
 
@@ -192,12 +200,7 @@ public class ChannelInfo extends TraceInfo implements IChannelInfo {
 
     @Override
     public void setState(String stateName) {
-        fState = TraceEnablement.ENABLED;
-        if (TraceEnablement.DISABLED.getInName().equals(stateName)) {
-            fState = TraceEnablement.DISABLED;
-        } else if (TraceEnablement.ENABLED.getInName().equals(stateName)) {
-            fState = TraceEnablement.ENABLED;
-        }
+        fState = TraceEnablement.valueOfString(stateName);
     }
 
     @Override
@@ -285,37 +288,37 @@ public class ChannelInfo extends TraceInfo implements IChannelInfo {
     @Override
     public String toString() {
         StringBuffer output = new StringBuffer();
-            output.append("[ChannelInfo(");
-            output.append(super.toString());
-            output.append(",State=");
-            output.append(fState);
-            output.append(",OverwriteMode=");
-            output.append(fOverwriteMode);
-            output.append(",SubBuffersSize=");
-            output.append(fSubBufferSize);
-            output.append(",NumberOfSubBuffers=");
-            output.append(fNumberOfSubBuffers);
-            output.append(",SwitchTimer=");
-            output.append(fSwitchTimer);
-            output.append(",ReadTimer=");
-            output.append(fReadTimer);
-            output.append(",output=");
-            output.append(fOutputType);
-            if ((fBufferType != null) && !fBufferType.equals(BufferType.BUFFER_TYPE_UNKNOWN) && !fBufferType.equals(BufferType.BUFFER_SHARED)) {
-                output.append(",BufferType=");
-                output.append(fBufferType);
-            }
-            output.append(",Events=");
-            if (fEvents.isEmpty()) {
-                output.append("None");
-            } else {
-                for (Iterator<IEventInfo> iterator = fEvents.iterator(); iterator.hasNext();) {
-                    IEventInfo event = iterator.next();
-                    output.append(event.toString());
-                }
+        output.append("[ChannelInfo(");
+        output.append(super.toString());
+        output.append(",State=");
+        output.append(fState);
+        output.append(",OverwriteMode=");
+        output.append(fOverwriteMode);
+        output.append(",SubBuffersSize=");
+        output.append(fSubBufferSize);
+        output.append(",NumberOfSubBuffers=");
+        output.append(fNumberOfSubBuffers);
+        output.append(",SwitchTimer=");
+        output.append(fSwitchTimer);
+        output.append(",ReadTimer=");
+        output.append(fReadTimer);
+        output.append(",output=");
+        output.append(fOutputType.getInName());
+        if ((fBufferType != null) && !fBufferType.equals(BufferType.BUFFER_TYPE_UNKNOWN) && !fBufferType.equals(BufferType.BUFFER_SHARED)) {
+            output.append(",BufferType=");
+            output.append(fBufferType);
+        }
+        output.append(",Events=");
+        if (fEvents.isEmpty()) {
+            output.append("None");
+        } else {
+            for (Iterator<IEventInfo> iterator = fEvents.iterator(); iterator.hasNext();) {
+                IEventInfo event = iterator.next();
+                output.append(event.toString());
             }
-            output.append(")]");
-            return output.toString();
+        }
+        output.append(")]");
+        return output.toString();
     }
 
     @Override
This page took 0.027491 seconds and 5 git commands to generate.