tmf: Add proper API to statesystem.backends.historytree
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / statesystem / backends / historytree / HTInterval.java
index 9b4bdb36f0db9517e2e9e373190fe9da113d334c..c9d38ce0ab66f494d0361e36a108ed554b13b2a1 100644 (file)
@@ -25,10 +25,9 @@ import org.eclipse.linuxtools.tmf.core.statevalue.TmfStateValue;
  * The interval component, which will be contained in a node of the History
  * Tree.
  *
- * @author alexmont
- *
+ * @author Alexandre Montplaisir
  */
-final class HTInterval implements ITmfStateInterval, Comparable<HTInterval> {
+public final class HTInterval implements ITmfStateInterval, Comparable<HTInterval> {
 
     private static final String errMsg = "Invalid interval data. Maybe your file is corrupt?"; //$NON-NLS-1$
 
@@ -59,12 +58,18 @@ final class HTInterval implements ITmfStateInterval, Comparable<HTInterval> {
      * Standard constructor
      *
      * @param intervalStart
+     *            Start time of the interval
      * @param intervalEnd
+     *            End time of the interval
      * @param attribute
+     *            Attribute (quark) to which the state represented by this
+     *            interval belongs
      * @param value
+     *            State value represented by this interval
      * @throws TimeRangeException
+     *             If the start time or end time are invalid
      */
-    HTInterval(long intervalStart, long intervalEnd, int attribute,
+    public HTInterval(long intervalStart, long intervalEnd, int attribute,
             TmfStateValue value) throws TimeRangeException {
         if (intervalStart > intervalEnd) {
             throw new TimeRangeException();
@@ -82,13 +87,6 @@ final class HTInterval implements ITmfStateInterval, Comparable<HTInterval> {
      * reading it from disk (with {@link #readFrom}), we already know the size
      * of the strings entry, so there is no need to call
      * {@link #computeStringsEntrySize()} and do an extra copy.
-     *
-     * @param intervalStart
-     * @param intervalEnd
-     * @param attribute
-     * @param value
-     * @param size
-     * @throws TimeRangeException
      */
     private HTInterval(long intervalStart, long intervalEnd, int attribute,
             TmfStateValue value, int size) throws TimeRangeException {
@@ -104,14 +102,16 @@ final class HTInterval implements ITmfStateInterval, Comparable<HTInterval> {
     }
 
     /**
-     * Reader constructor. Builds the interval using an already-allocated
+     * Reader factory method. Builds the interval using an already-allocated
      * ByteBuffer, which normally comes from a NIO FileChannel.
      *
      * @param buffer
      *            The ByteBuffer from which to read the information
+     * @return The interval object
      * @throws IOException
+     *             If there was an error reading from the buffer
      */
-    final static HTInterval readFrom(ByteBuffer buffer) throws IOException {
+    public static final HTInterval readFrom(ByteBuffer buffer) throws IOException {
         HTInterval interval;
         long intervalStart, intervalEnd;
         int attribute;
@@ -227,7 +227,7 @@ final class HTInterval implements ITmfStateInterval, Comparable<HTInterval> {
      *            StateValues.
      * @return The size of the Strings Entry that was written, if any.
      */
-    int writeInterval(ByteBuffer buffer, int endPosOfStringEntry) {
+    public int writeInterval(ByteBuffer buffer, int endPosOfStringEntry) {
         buffer.putLong(start);
         buffer.putLong(end);
         buffer.putInt(attribute);
@@ -365,9 +365,9 @@ final class HTInterval implements ITmfStateInterval, Comparable<HTInterval> {
     /**
      * Total serialized size of this interval
      *
-     * @return
+     * @return The interval size
      */
-    int getIntervalSize() {
+    public int getIntervalSize() {
         return stringsEntrySize + HTNode.DATA_ENTRY_SIZE;
     }
 
This page took 0.039548 seconds and 5 git commands to generate.