More javadoc updates
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / types / SequenceDeclaration.java
index 609ea46bed216733ea393d87c535d826da410b50..082c70488ab85a315124e682c6f7b8e017d7c365 100644 (file)
 
 package org.eclipse.linuxtools.ctf.core.event.types;
 
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
+
 /**
- * <b><u>SequenceDeclaration</u></b>
+ * A CTF sequence declaration.
+ * 
+ * An array where the size is fixed but declared in the trace, unlike array
+ * where it is declared with a literal
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
  */
 public class SequenceDeclaration implements IDeclaration {
 
@@ -28,23 +37,44 @@ public class SequenceDeclaration implements IDeclaration {
     // Constructors
     // ------------------------------------------------------------------------
 
+    /**
+     * Constructor
+     *
+     * @param lengthName
+     *            the name of the field describing the length
+     * @param elemType
+     *            The element type
+     */
     public SequenceDeclaration(String lengthName, IDeclaration elemType) {
         this.elemType = elemType;
         this.lengthName = lengthName;
     }
 
     // ------------------------------------------------------------------------
-    // Gettters/Setters/Predicates
+    // Getters/Setters/Predicates
     // ------------------------------------------------------------------------
 
+    /**
+     * Gets the element type
+     * @return the element type
+     */
     public IDeclaration getElementType() {
         return elemType;
     }
 
+    /**
+     * Gets the name of the length field
+     * @return the name of the length field
+     */
     public String getLengthName() {
         return lengthName;
     }
 
+    @Override
+    public long getAlignment() {
+        return getElementType().getAlignment();
+    }
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
@@ -52,7 +82,15 @@ public class SequenceDeclaration implements IDeclaration {
     @Override
     public SequenceDefinition createDefinition(
             IDefinitionScope definitionScope, String fieldName) {
-        return new SequenceDefinition(this, definitionScope, fieldName);
+        SequenceDefinition ret = null;
+        try {
+            ret = new SequenceDefinition(this, definitionScope, fieldName);
+        } catch (CTFReaderException e) {
+            // Temporarily catch this here, eventually this should be thrown
+            // up the call stack
+            e.printStackTrace();
+        }
+        return ret;
     }
 
     @Override
This page took 0.025063 seconds and 5 git commands to generate.