Add javadoc and comments
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Thu, 3 May 2012 18:28:32 +0000 (14:28 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Thu, 3 May 2012 22:56:58 +0000 (18:56 -0400)
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfContent.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventType.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java

index 24352443987b711776898c6c9a13fac5ac85cd94..506e506e0a4a04f751e64c1436aab3750be8f319 100644 (file)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
 package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 
 import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
@@ -5,6 +15,11 @@ import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 
+/**
+ * The ctfIterator is the class that will act like a reader for the trace
+ * it does not have a file handle, so many iterators can be used without worries
+ * of io errors.
+ */
 public class CtfIterator extends CTFTraceReader implements ITmfContext,
         Comparable<CtfIterator> {
 
@@ -19,7 +34,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
      * Create a new CTF trace iterator, which initially points at the first
      * event in the trace.
      *
-     * @param trace
+     * @param trace the trace to iterate over
      */
     public CtfIterator(final CtfTmfTrace trace) {
         super(trace.getCTFTrace());
@@ -41,6 +56,12 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
         this.curRank = UNKNOWN_RANK;
     }
 
+    /**
+     * Constructor for CtfIterator.
+     * @param trace CtfTmfTrace the trace
+     * @param timestampValue long the timestamp in ns of the trace for positioning
+     * @param rank long the index of the trace for positioning
+     */
     public CtfIterator(final CtfTmfTrace trace, final long timestampValue,
             final long rank) {
         super(trace.getCTFTrace());
@@ -59,10 +80,18 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
 
     }
 
+    /**
+     * Method getCtfTmfTrace. gets a CtfTmfTrace
+     * @return CtfTmfTrace
+     */
     public CtfTmfTrace getCtfTmfTrace() {
         return ctfTmfTrace;
     }
 
+    /**
+     * Method getCurrentEvent. gets the current event
+     * @return CtfTmfEvent
+     */
     public CtfTmfEvent getCurrentEvent() {
         final StreamInputReader top = super.prio.peek();
         if (top != null) {
@@ -72,6 +101,11 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
         return null;
     }
 
+    /**
+     * Method seek. Seeks to a given timestamp
+     * @param timestamp long the timestamp in ns (utc)
+     * @return boolean
+     */
     @Override
     public boolean seek(final long timestamp) {
         boolean ret = false;
@@ -89,6 +123,11 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
         return ret;
     }
 
+    /**
+     * Method seekRank. seeks to a given rank
+     * @param rank long the rank to seek to
+     * @return boolean
+     */
     public boolean seekRank(final long rank) {
         boolean ret = false;
         ret = super.seekIndex(rank);
@@ -99,11 +138,21 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
         return ret;
     }
 
+    /**
+     * Method getRank.
+     * @return long
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#getRank()
+     */
     @Override
     public long getRank() {
         return super.getIndex();
     }
 
+    /**
+     * Method setRank.
+     * @param rank long
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#setRank(long)
+     */
     @Override
     public void setRank(final long rank) {
         if(!this.curLocation.equals(nullLocation)) {
@@ -124,12 +173,21 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
         return clone;
     }
 
+    /**
+     * Method dispose.
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#dispose()
+     */
     @Override
     public void dispose() {
         // FIXME add dispose() stuff to CTFTrace and call it here...
 
     }
 
+    /**
+     * Method setLocation.
+     * @param location ITmfLocation<?>
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#setLocation(ITmfLocation<?>)
+     */
     @Override
     public void setLocation(final ITmfLocation<?> location) {
         // FIXME alex: isn't there a cleaner way than a cast here?
@@ -137,26 +195,49 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
         seek(((CtfLocation) location).getLocation());
     }
 
+    /**
+     * Method getLocation.
+     * @return CtfLocation
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#getLocation()
+     */
     @Override
     public CtfLocation getLocation() {
         return curLocation;
     }
 
+    /**
+     * Method increaseRank.
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#increaseRank()
+     */
     @Override
     public void increaseRank() {
         curRank++;
     }
 
+    /**
+     * Method hasValidRank, if the iterator is valid
+     * @return boolean
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#hasValidRank()
+     */
     @Override
     public boolean hasValidRank() {
         return (getRank() >= 0);
     }
 
+    /**
+     * Method advance go to the next event
+     * @return boolean successful or not
+     */
     @Override
     public boolean advance() {
         return super.advance();
     }
 
+    /**
+     * Method compareTo.
+     * @param o CtfIterator
+     * @return int -1, 0, 1
+     */
     @Override
     public int compareTo(final CtfIterator o) {
         if (this.getRank() < o.getRank()) {
@@ -166,5 +247,53 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
         }
         return 0;
     }
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = (prime * result)
+                + ((ctfTmfTrace == null) ? 0 : ctfTmfTrace.hashCode());
+        result = (prime * result)
+                + ((curLocation == null) ? 0 : curLocation.hashCode());
+        result = (prime * result) + (int) (curRank ^ (curRank >>> 32));
+        return result;
+    }
 
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (!(obj instanceof CtfIterator)) {
+            return false;
+        }
+        CtfIterator other = (CtfIterator) obj;
+        if (ctfTmfTrace == null) {
+            if (other.ctfTmfTrace != null) {
+                return false;
+            }
+        } else if (!ctfTmfTrace.equals(other.ctfTmfTrace)) {
+            return false;
+        }
+        if (curLocation == null) {
+            if (other.curLocation != null) {
+                return false;
+            }
+        } else if (!curLocation.equals(other.curLocation)) {
+            return false;
+        }
+        if (curRank != other.curRank) {
+            return false;
+        }
+        return true;
+    }
 }
index 4c7ebb1d047b8beea24d0d48f19a23e136c249f5..e0bc5b96308269c4cf2cd48c5c6b0903ac10c7d9 100644 (file)
@@ -1,32 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
 package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 
 import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 
+/**
+ * The ctflocation is the nugget of information that is unique to a location in a trace.
+ * it can be copied and used to restore a position in a given trace.
+ */
 public class CtfLocation implements ITmfLocation<Long> {
 
     public static final Long INVALID_LOCATION = -1L;
 
+    /**
+     * Constructor for CtfLocation.
+     * @param location Long
+     */
     public CtfLocation(Long location) {
         setLocation(location);
     }
 
+    /**
+     * Constructor for CtfLocation.
+     * @param timestamp ITmfTimestamp
+     */
     public CtfLocation(ITmfTimestamp timestamp) {
         setLocation(timestamp.getValue());
     }
 
     private Long fTimestamp;
 
-//    @Override
+    /**
+     * Method setLocation.
+     * @param location Long
+     */
     public void setLocation(Long location) {
         this.fTimestamp = location;
     }
 
+    /**
+     * Method getLocation.
+     * @return Long
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfLocation#getLocation()
+     */
     @Override
     public Long getLocation() {
         return this.fTimestamp;
     }
 
+    /**
+     * Method clone.
+     * @return CtfLocation
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfLocation#clone()
+     */
     @Override
     public CtfLocation clone() {
         return new CtfLocation(getLocation());
index f0afc963e4092562e464ff73618930ca29d2657d..3ca0acfcd7669c9e977f5fc43fa84bae9ac34696 100644 (file)
@@ -1,10 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
 package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
 import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
 
+/**
+ * CtfTmfcontent is a wrapper to allow pretty printing of the fields in a CtfTmfEvent
+ */
 public class CtfTmfContent extends TmfEventField {
 
+    /**
+     * Constructor for CtfTmfContent.
+     * @param name String
+     * @param fields ITmfEventField[]
+     */
     public CtfTmfContent(String name, ITmfEventField[] fields) {
         super(name, fields);
     }
index ea42c0e303be1dd99838a07d29fe5c610c0d6e66..49b150139e867b6c62fed60f7f4c9ca0eed014ca 100644 (file)
@@ -62,7 +62,9 @@ public final class CtfTmfEvent implements ITmfEvent {
      * the StreamInputReader).
      *
      * @param eventDef
-     * @param top
+
+     * @param fileName String
+     * @param originTrace CtfTmfTrace
      */
     public CtfTmfEvent(EventDefinition eventDef, String fileName,
             CtfTmfTrace originTrace) {
@@ -96,7 +98,8 @@ public final class CtfTmfEvent implements ITmfEvent {
      * mess, and put them into something ITmfEventField can cope with.
      *
      * @param eventDef
-     * @return
+
+     * @return CtfTmfEventField[]
      */
     private static CtfTmfEventField[] parseFields(EventDefinition eventDef) {
         List<CtfTmfEventField> fields = new ArrayList<CtfTmfEventField>();
@@ -165,8 +168,7 @@ public final class CtfTmfEvent implements ITmfEvent {
     /**
      * Get a null event
      *
-     * @return an empty event.
-     */
+     * @return an empty event. */
     public static CtfTmfEvent getNullEvent() {
         if (nullEvent == null) {
             nullEvent = new CtfTmfEvent();
@@ -177,8 +179,7 @@ public final class CtfTmfEvent implements ITmfEvent {
     /**
      * Gets the current timestamp of the event
      *
-     * @return the current timestamp (long)
-     */
+     * @return the current timestamp (long) */
     public long getTimestampValue() {
         return this.timestamp;
     }
@@ -186,8 +187,7 @@ public final class CtfTmfEvent implements ITmfEvent {
     /**
      * Gets the cpu core the event was recorded on.
      *
-     * @return the cpu id for a given source. In lttng it's from CPUINFO
-     */
+     * @return the cpu id for a given source. In lttng it's from CPUINFO */
     public int getCPU() {
         return this.sourceCPU;
     }
@@ -197,8 +197,8 @@ public final class CtfTmfEvent implements ITmfEvent {
      * this ID is not constant from one trace to another for the same event
      * types! Use "getEventName()" for a constant reference.
      *
-     * @return the event ID
-     */
+
+     * @return the event ID */
     public long getID() {
         return this.typeId;
     }
@@ -206,8 +206,7 @@ public final class CtfTmfEvent implements ITmfEvent {
     /**
      * Gets the name of a current event.
      *
-     * @return the event name
-     */
+     * @return the event name */
     public String getEventName() {
         return eventName;
     }
@@ -215,17 +214,26 @@ public final class CtfTmfEvent implements ITmfEvent {
     /**
      * Gets the channel name of a field.
      *
-     * @return the channel name.
-     */
+     * @return the channel name. */
     public String getChannelName() {
         return this.fileName;
     }
 
+    /**
+     * Method getTrace.
+     * @return CtfTmfTrace
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getTrace()
+     */
     @Override
     public CtfTmfTrace getTrace() {
         return fTrace;
     }
 
+    /**
+     * Method getRank.
+     * @return long
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getRank()
+     */
     @Override
     public long getRank() {
         // TODO Auto-generated method stub
@@ -236,6 +244,11 @@ public final class CtfTmfEvent implements ITmfEvent {
 
     // TODO Benchmark if the singleton approach is faster than just
     // instantiating a final fTimestramp right away at creation time
+    /**
+     * Method getTimestamp.
+     * @return ITmfTimestamp
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getTimestamp()
+     */
     @Override
     public ITmfTimestamp getTimestamp() {
         if (fTimestamp == null) {
@@ -245,6 +258,11 @@ public final class CtfTmfEvent implements ITmfEvent {
     }
 
     String fSource = null;
+    /**
+     * Method getSource.
+     * @return String
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getSource()
+     */
     @Override
     public String getSource() {
         // TODO Returns CPU for now
@@ -255,6 +273,11 @@ public final class CtfTmfEvent implements ITmfEvent {
     }
 
     private CtfTmfEventType type = null;
+    /**
+     * Method getType.
+     * @return ITmfEventType
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getType()
+     */
     @Override
     public ITmfEventType getType() {
         if(type == null){
@@ -263,12 +286,22 @@ public final class CtfTmfEvent implements ITmfEvent {
         return type;
     }
 
+    /**
+     * Method getContent.
+     * @return ITmfEventField
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getContent()
+     */
     @Override
     public ITmfEventField getContent() {
         return fContent;
     }
 
     String fReference = null;
+    /**
+     * Method getReference.
+     * @return String
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getReference()
+     */
     @Override
     public String getReference() {
         if( fReference == null){
@@ -277,6 +310,11 @@ public final class CtfTmfEvent implements ITmfEvent {
         return fReference;
     }
 
+    /**
+     * Method clone.
+     * @return CtfTmfEvent
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#clone()
+     */
     @Override
     public CtfTmfEvent clone() {
         return new CtfTmfEvent(this);
index dc77c17d2e044428dac39a2b564a097f2cb0bb05..6e5353ccbbc8b873839cad896ac926ac88f1b508 100644 (file)
@@ -38,6 +38,10 @@ public abstract class CtfTmfEventField implements ITmfEventField {
     // Constructors
     // ------------------------------------------------------------------------
 
+    /**
+     * Constructor for CtfTmfEventField.
+     * @param name String
+     */
     protected CtfTmfEventField(String name) {
         /* Strip the damn underscores, screw you CTF */
         if ( name.startsWith("_") ) { //$NON-NLS-1$
@@ -51,6 +55,11 @@ public abstract class CtfTmfEventField implements ITmfEventField {
     // Getters/Setters/Predicates
     // ------------------------------------------------------------------------
 
+    /**
+     * Method getName.
+     * @return String
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getName()
+     */
     @Override
     public String getName() {
         return this.name;
@@ -60,6 +69,12 @@ public abstract class CtfTmfEventField implements ITmfEventField {
     // Operations
     // ------------------------------------------------------------------------
 
+    /**
+     * Method parseField.
+     * @param fieldDef Definition
+     * @param fieldName String
+     * @return CtfTmfEventField
+     */
     public static CtfTmfEventField parseField(Definition fieldDef,
             String fieldName) {
         CtfTmfEventField field = null;
@@ -119,6 +134,11 @@ public abstract class CtfTmfEventField implements ITmfEventField {
         return field;
     }
 
+    /**
+     * Method copyFrom.
+     * @param other CtfTmfEventField
+     * @return CtfTmfEventField
+     */
     public static CtfTmfEventField copyFrom(CtfTmfEventField other) {
         switch (other.getFieldType()) {
         case 0:
@@ -135,6 +155,11 @@ public abstract class CtfTmfEventField implements ITmfEventField {
         }
     }
 
+    /**
+     * Method clone.
+     * @return CtfTmfEventField
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#clone()
+     */
     @Override
     public CtfTmfEventField clone() {
         return CtfTmfEventField.copyFrom(this);
@@ -143,15 +168,16 @@ public abstract class CtfTmfEventField implements ITmfEventField {
     /**
      * Return the int representing this field's value type
      *
-     * @return the field type
-     */
+    
+     * @return the field type */
     public abstract int getFieldType();
 
     /**
      * Return this field's value. You can cast it to the correct type depending
      * on what getFieldType says.
      *
-     * @return the field value
+    
+     * @return the field value * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getValue()
      */
     @Override
     public abstract Object getValue();
@@ -160,30 +186,54 @@ public abstract class CtfTmfEventField implements ITmfEventField {
      * Other methods defined by ITmfEventField, but not used here: the CTF
      *       fields do not have sub-fields (yet!)
      *
-     * @return the field names
+    
+     * @return the field names * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getFieldNames()
      */
     @Override
     public String[] getFieldNames() {
         return null;
     }
 
+    /**
+     * Method getFieldName.
+     * @param index int
+     * @return String
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getFieldName(int)
+     */
     @SuppressWarnings("unused")
     @Override
     public String getFieldName(int index) {
         return null;
     }
 
+    /**
+     * Method getFields.
+     * @return ITmfEventField[]
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getFields()
+     */
     @Override
     public ITmfEventField[] getFields() {
         return null;
     }
 
+    /**
+     * Method getField.
+     * @param fieldName String
+     * @return ITmfEventField
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getField(String)
+     */
     @SuppressWarnings("unused")
     @Override
     public ITmfEventField getField(String fieldName) {
         return null;
     }
 
+    /**
+     * Method getField.
+     * @param index int
+     * @return ITmfEventField
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getField(int)
+     */
     @SuppressWarnings("unused")
     @Override
     public ITmfEventField getField(int index) {
@@ -193,6 +243,8 @@ public abstract class CtfTmfEventField implements ITmfEventField {
 
 /**
  * <b><u>CTFIntegerField</u></b>
+ * @author ematkho
+ * @version $Revision: 1.0 $
  */
 final class CTFIntegerField extends CtfTmfEventField {
 
@@ -201,17 +253,28 @@ final class CTFIntegerField extends CtfTmfEventField {
     /**
      * A CTF "IntegerDefinition" can be an integer of any byte size, so in the
      * Java parser this is interpreted as a long.
+     * @param longValue long
+     * @param name String
      */
     CTFIntegerField(long longValue, String name) {
         super(name);
         this.longValue = longValue;
     }
 
+    /**
+     * Method getFieldType.
+     * @return int
+     */
     @Override
     public int getFieldType() {
         return 0;
     }
 
+    /**
+     * Method getValue.
+     * @return Long
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getValue()
+     */
     @Override
     public Long getValue() {
         return this.longValue;
@@ -230,21 +293,37 @@ final class CTFIntegerField extends CtfTmfEventField {
 
 /**
  * <b><u>CTFStringField</u></b>
+ * @author ematkho
+ * @version $Revision: 1.0 $
  */
 final class CTFStringField extends CtfTmfEventField {
 
     private final String strValue;
 
+    /**
+     * Constructor for CTFStringField.
+     * @param strValue String
+     * @param name String
+     */
     CTFStringField(String strValue, String name) {
         super(name);
         this.strValue = strValue;
     }
 
+    /**
+     * Method getFieldType.
+     * @return int
+     */
     @Override
     public int getFieldType() {
         return 1;
     }
 
+    /**
+     * Method getValue.
+     * @return String
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getValue()
+     */
     @Override
     public String getValue() {
         return this.strValue;
@@ -263,26 +342,46 @@ final class CTFStringField extends CtfTmfEventField {
 
 /**
  * <b><u>CTFIntegerArrayField</u></b>
+ * @author ematkho
+ * @version $Revision: 1.0 $
  */
 final class CTFIntegerArrayField extends CtfTmfEventField {
 
     private final long[] longValues;
 
+    /**
+     * Constructor for CTFIntegerArrayField.
+     * @param longValues long[]
+     * @param name String
+     */
     CTFIntegerArrayField(long[] longValues, String name) {
         super(name);
         this.longValues = longValues;
     }
 
+    /**
+     * Method getFieldType.
+     * @return int
+     */
     @Override
     public int getFieldType() {
         return 2;
     }
 
+    /**
+     * Method getValue.
+     * @return long[]
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getValue()
+     */
     @Override
     public long[] getValue() {
         return this.longValues;
     }
 
+    /**
+     * Method toString.
+     * @return String
+     */
     @Override
     public String toString() {
         StringBuffer buffer = new StringBuffer();
@@ -297,24 +396,44 @@ final class CTFIntegerArrayField extends CtfTmfEventField {
     }
 }
 
+/**
+ */
 final class CTFFloatField extends CtfTmfEventField {
 
     Double value;
+    /**
+     * Constructor for CTFFloatField.
+     * @param value double
+     * @param name String
+     */
     protected CTFFloatField(double value ,String name) {
         super(name);
         this.value = value;
     }
 
+    /**
+     * Method getFieldType.
+     * @return int
+     */
     @Override
     public int getFieldType() {
         return 3;
     }
 
+    /**
+     * Method getValue.
+     * @return Object
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getValue()
+     */
     @Override
     public Object getValue() {
         return this.value;
     }
 
+    /**
+     * Method toString.
+     * @return String
+     */
     @Override
     public String toString(){
         return name + '=' + value;
index 612abc056c3e8f5a5a2bbb09e1135d8ad4c796c8..b841800ff9cce47d57ec1fa48bf14a2b4fcb8208 100644 (file)
@@ -1,15 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
 import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
 
+/**
+ */
 public class CtfTmfEventType extends TmfEventType {
 
+    /**
+     * Constructor for CtfTmfEventType.
+     * @param contextId String
+     * @param eventName String
+     * @param content ITmfEventField
+     */
     public CtfTmfEventType(String contextId, String eventName,
             ITmfEventField content) {
         super(contextId, eventName, content);
     }
 
+    /**
+     * Method toString.
+     * @return String
+     */
     @Override
     public String toString()
     {
index 80b428cd3a51e28cfce846b5cb6cb2f4a428c2b3..c0464fa5466679f6e8cb2189c318ec5755d77862 100644 (file)
@@ -18,23 +18,39 @@ import java.util.Date;
 import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
 
+/**
+ */
 public class CtfTmfTimestamp extends TmfTimestamp {
 
+    /**
+     */
     public enum TimestampType {
         FULL_DATE, DAY, NANOS, SECONDS
     }
 
     private TimestampType type;
 
+    /**
+     * Constructor for CtfTmfTimestamp.
+     * @param timestamp long
+     */
     public CtfTmfTimestamp(long timestamp) {
         setValue(timestamp, -9, 0);
         type = TimestampType.DAY;
     }
 
+    /**
+     * Method setType.
+     * @param value TimestampType
+     */
     public void setType(TimestampType value) {
         type = value;
     }
 
+    /**
+     * Method getType.
+     * @return TimestampType
+     */
     public TimestampType getType() {
         return type;
     }
@@ -46,6 +62,12 @@ public class CtfTmfTimestamp extends TmfTimestamp {
      * org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#getDelta(org.eclipse
      * .linuxtools.tmf.core.event.ITmfTimestamp)
      */
+    /**
+     * Method getDelta.
+     * @param ts ITmfTimestamp
+     * @return ITmfTimestamp
+     * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#getDelta(ITmfTimestamp)
+     */
     @Override
     public ITmfTimestamp getDelta(ITmfTimestamp ts) {
         TmfTimestamp parent = (TmfTimestamp) super.getDelta(ts);
@@ -88,6 +110,10 @@ public class CtfTmfTimestamp extends TmfTimestamp {
         return super.toString();
     }
 
+    /**
+     * Method secondsToString.
+     * @return String
+     */
     private String secondsToString() {
         double timestamp = getValue();
         timestamp /= 1000000000;
@@ -97,6 +123,10 @@ public class CtfTmfTimestamp extends TmfTimestamp {
         return retVal.toString();
     }
 
+    /**
+     * Method nanoToString.
+     * @return String
+     */
     private String nanoToString() {
         final long timestamp = getValue();
         StringBuilder retVal = new StringBuilder();
@@ -105,6 +135,10 @@ public class CtfTmfTimestamp extends TmfTimestamp {
         return retVal.toString();
     }
 
+    /**
+     * Method dateToString.
+     * @return String
+     */
     private String dateToString() {
         final long timestamp = getValue();
         final Date d = new Date(timestamp / 1000000);
@@ -116,6 +150,10 @@ public class CtfTmfTimestamp extends TmfTimestamp {
         return output.toString();
     }
 
+    /**
+     * Method toFullDateString.
+     * @return String
+     */
     private String toFullDateString() {
         final long timestamp = getValue();
         final Date d = new Date(timestamp / 1000000);
@@ -127,4 +165,36 @@ public class CtfTmfTimestamp extends TmfTimestamp {
         return output.toString();
     }
 
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = (prime * result) + ((type == null) ? 0 : type.hashCode());
+        return result;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (!(obj instanceof CtfTmfTimestamp)) {
+            return false;
+        }
+        CtfTmfTimestamp other = (CtfTmfTimestamp) obj;
+        if (type != other.type) {
+            return false;
+        }
+        return true;
+    }
+
 }
index 3ed9a41b10f3015b4a30d5c9a91dda9bc9f21c68..febe5c4ee583674bad17719487ca7897a20b56e2 100644 (file)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 
 import org.eclipse.core.resources.IProject;
@@ -20,6 +31,8 @@ import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 
+/**
+ */
 public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTrace<CtfTmfEvent> {
 
     // ------------------------------------------------------------------------
@@ -61,6 +74,14 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
         super();
     }
 
+    /**
+     * Method initTrace.
+     * @param resource IResource
+     * @param path String
+     * @param eventType Class<CtfTmfEvent>
+     * @throws TmfTraceException
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#initTrace(IResource, String, Class<CtfTmfEvent>)
+     */
     @SuppressWarnings("unused")
     @Override
     public void initTrace(final IResource resource, final String path, final Class<CtfTmfEvent> eventType)
@@ -82,14 +103,7 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
             setStartTime(iterator.getCurrentEvent().getTimestamp());
         }
         TmfSignalManager.register(this);
-        // this.currLocation.setTimestamp(this.fEvent.getTimestamp().getValue());
-        // this.fStartTime = new TmfSimpleTimestamp(this.currLocation
-        // .getLocation().getStartTime());
-        // this.fEndTime = new TmfSimpleTimestamp(this.currLocation
-        // .getLocation().getEndTime());
-        // setTimeRange(new TmfTimeRange(this.fStartTime.clone(),
-        // this.fEndTime.clone()));
-
+        // FIXME this should become a request
         buildStateSystem();
 
         /* Refresh the project, so it can pick up new files that got created. */
@@ -102,16 +116,32 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
         }
     }
 
+    /**
+     * Method dispose.
+     * @see org.eclipse.linuxtools.tmf.core.component.ITmfComponent#dispose()
+     */
     @Override
     public void dispose() {
         TmfSignalManager.deregister(this);
     }
 
+    /**
+     * Method broadcast.
+     * @param signal TmfSignal
+     * @see org.eclipse.linuxtools.tmf.core.component.ITmfComponent#broadcast(TmfSignal)
+     */
     @Override
     public void broadcast(final TmfSignal signal) {
         TmfSignalManager.dispatchSignal(signal);
     }
 
+    /**
+     * Method validate.
+     * @param project IProject
+     * @param path String
+     * @return boolean
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(IProject, String)
+     */
     @SuppressWarnings("unused")
     @Override
     public boolean validate(final IProject project, final String path) {
@@ -124,51 +154,62 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
         }
     }
 
-    @Override
-    public CtfTmfTrace clone() throws CloneNotSupportedException {
-        CtfTmfTrace clone = null;
-        clone = (CtfTmfTrace) super.clone();
-        clone.fStartTime = this.fStartTime.clone();
-        clone.fEndTime = this.fEndTime.clone();
-        clone.fTrace = this.fTrace;
-        return clone;
-    }
-
     // ------------------------------------------------------------------------
     // Accessors
     // ------------------------------------------------------------------------
 
     /**
+     * Method getEventType.
      * @return the trace path
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getEventType()
      */
     @Override
     public Class<CtfTmfEvent> getEventType() {
         return fType;
     }
 
+    /**
+     * Method getNbEnvVars.
+     * @return int
+     */
     public int getNbEnvVars() {
         return this.fTrace.getEnvironment().size();
     }
 
 
+    /**
+     * Method getEnvNames.
+     * @return String[]
+     */
     public String[] getEnvNames() {
         final String[] s = new String[getNbEnvVars()];
         return this.fTrace.getEnvironment().keySet().toArray(s);
     }
 
+    /**
+     * Method getEnvValue.
+     * @param key String
+     * @return String
+     */
     public String getEnvValue(final String key)    {
         return this.fTrace.getEnvironment().get(key);
     }
 
 
     /**
-     * @return the trace path
+
+     * @return the trace path * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getPath()
      */
     @Override
     public String getPath() {
         return this.fTrace.getPath();
     }
 
+    /**
+     * Method getName.
+     * @return String
+     * @see org.eclipse.linuxtools.tmf.core.component.ITmfComponent#getName()
+     */
     @Override
     public String getName() {
         String traceName = (fResource != null) ? fResource.getName() : null;
@@ -181,31 +222,61 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
         return traceName;
     }
 
+    /**
+     * Method getCacheSize.
+     * @return int
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCacheSize()
+     */
     @Override
     public int getCacheSize() {
         return 50000; // not true, but it works
     }
 
+    /**
+     * Method getNbEvents.
+     * @return long
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getNbEvents()
+     */
     @Override
     public long getNbEvents() {
         return this.fNbEvents;
     }
 
+    /**
+     * Method getTimeRange.
+     * @return TmfTimeRange
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getTimeRange()
+     */
     @Override
     public TmfTimeRange getTimeRange() {
         return new TmfTimeRange(this.fStartTime, this.fEndTime);
     }
 
+    /**
+     * Method getStartTime.
+     * @return ITmfTimestamp
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getStartTime()
+     */
     @Override
     public ITmfTimestamp getStartTime() {
         return this.fStartTime;
     }
 
+    /**
+     * Method getEndTime.
+     * @return ITmfTimestamp
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getEndTime()
+     */
     @Override
     public ITmfTimestamp getEndTime() {
         return this.fEndTime;
     }
 
+    /**
+     * Method getCurrentLocation.
+     * @return ITmfLocation<?>
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCurrentLocation()
+     */
     @Override
     public ITmfLocation<?> getCurrentLocation() {
         return iterator.getLocation();
@@ -215,15 +286,27 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
     // Operators
     // ------------------------------------------------------------------------
 
+    /**
+     * Method setTimeRange.
+     * @param range TmfTimeRange
+     */
     protected void setTimeRange(final TmfTimeRange range) {
         this.fStartTime = range.getStartTime();
         this.fEndTime = range.getEndTime();
     }
 
+    /**
+     * Method setStartTime.
+     * @param startTime ITmfTimestamp
+     */
     protected void setStartTime(final ITmfTimestamp startTime) {
         this.fStartTime = startTime;
     }
 
+    /**
+     * Method setEndTime.
+     * @param endTime ITmfTimestamp
+     */
     protected void setEndTime(final ITmfTimestamp endTime) {
         this.fEndTime = endTime;
     }
@@ -232,6 +315,11 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
     // TmfProvider
     // ------------------------------------------------------------------------
 
+    /**
+     * Method armRequest.
+     * @param request ITmfDataRequest<CtfTmfEvent>
+     * @return ITmfContext
+     */
     @Override
     public ITmfContext armRequest(final ITmfDataRequest<CtfTmfEvent> request) {
         if ((request instanceof ITmfEventRequest<?>)
@@ -257,6 +345,8 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
      *
      * FIXME merge with getNextEvent below once they both use the same parameter
      * type.
+     * @param context ITmfContext
+     * @return CtfTmfEvent
      */
     @SuppressWarnings("unused")
     @Override
@@ -269,6 +359,12 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
     // ITmfTrace
     // ------------------------------------------------------------------------
 
+    /**
+     * Method seekEvent.
+     * @param location ITmfLocation<?>
+     * @return ITmfContext
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(ITmfLocation<?>)
+     */
     @Override
     public ITmfContext seekEvent(final ITmfLocation<?> location) {
         CtfLocation currentLocation = (CtfLocation) location;
@@ -281,6 +377,12 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
         return iterator;
     }
 
+    /**
+     * Method getLocationRatio.
+     * @param location ITmfLocation<?>
+     * @return double
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getLocationRatio(ITmfLocation<?>)
+     */
     @Override
     public double getLocationRatio(final ITmfLocation<?> location) {
         final CtfLocation curLocation = (CtfLocation) location;
@@ -290,11 +392,22 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
                 / (iterator.getEndTime() - iterator.getStartTime());
     }
 
+    /**
+     * Method getStreamingInterval.
+     * @return long
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getStreamingInterval()
+     */
     @Override
     public long getStreamingInterval() {
         return 0;
     }
 
+    /**
+     * Method seekEvent.
+     * @param timestamp ITmfTimestamp
+     * @return ITmfContext
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(ITmfTimestamp)
+     */
     @Override
     public ITmfContext seekEvent(final ITmfTimestamp timestamp) {
         iterator.seek(timestamp.getValue());
@@ -303,6 +416,9 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
 
     /**
      * Seek by rank
+     * @param rank long
+     * @return ITmfContext
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(long)
      */
     @Override
     public ITmfContext seekEvent(final long rank) {
@@ -312,6 +428,9 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
 
     /**
      * Seek rank ratio
+     * @param ratio double
+     * @return ITmfContext
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(double)
      */
     @Override
     public ITmfContext seekEvent(final double ratio) {
@@ -319,6 +438,12 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
         return iterator;
     }
 
+    /**
+     * Method readNextEvent.
+     * @param context ITmfContext
+     * @return CtfTmfEvent
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#readNextEvent(ITmfContext)
+     */
     @SuppressWarnings("unused")
     @Override
     public CtfTmfEvent readNextEvent(final ITmfContext context) {
@@ -326,15 +451,28 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
         return iterator.getCurrentEvent();
     }
 
+    /**
+     * Method getResource.
+     * @return IResource
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getResource()
+     */
     @Override
     public IResource getResource() {
         return this.fResource;
     }
 
+    /**
+     * Method getStateSystem.
+     * @return IStateSystemQuerier
+     */
     public IStateSystemQuerier getStateSystem() {
         return this.ss;
     }
 
+    /**
+     * Method getCTFTrace.
+     * @return CTFTrace
+     */
     CTFTrace getCTFTrace() {
         return fTrace;
     }
@@ -343,6 +481,7 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTr
     /**
      * Suppressing the warning, because the 'throws' will usually happen in
      * sub-classes.
+     * @throws TmfTraceException
      */
     @SuppressWarnings({ "unused", "static-method" })
     protected void buildStateSystem() throws TmfTraceException {
This page took 0.046347 seconds and 5 git commands to generate.