From 09667aa4321f2b0ae651e542d3898486739d9708 Mon Sep 17 00:00:00 2001 From: Mathieu Denis Date: Thu, 26 Jul 2012 15:48:21 -0400 Subject: [PATCH] tmf: formatting of tmf.ui.statistics - Remove trailing whitespaces; - Replace tabs for spaces; - Remove html tags; - Format blocks; - Correct warnings. Change-Id: I560b7d9c66e2ed23c3850ecf9e74ccc4ffaf8779 Signed-off-by: Mathieu Denis Reviewed-on: https://git.eclipse.org/r/7005 Reviewed-by: Alexandre Montplaisir IP-Clean: Alexandre Montplaisir Tested-by: Alexandre Montplaisir --- .../core/tests/util/TmfFixedArrayTest.java | 20 +- .../tmf/core/util/TmfFixedArray.java | 164 ++++++++----- .../tmf/ui/tests/AllTmfUITests.java | 18 +- .../tmf/ui/tests/statistics/AllTests.java | 28 +-- .../TmfBaseColumnDataProviderTest.java | 6 +- .../statistics/TmfBaseColumnDataTest.java | 2 +- .../statistics/TmfBaseStatisticsDataTest.java | 21 +- .../statistics/TmfStatisticsTreeNodeTest.java | 56 ++--- .../TmfStatisticsTreeRootFactoryTest.java | 2 +- .../TmfTreeContentProviderTest.java | 2 +- .../views/statistics/ITmfExtraEventInfo.java | 3 +- .../tmf/ui/views/statistics/Messages.java | 2 +- .../views/statistics/TmfStatisticsView.java | 163 ++++++++----- .../model/AbsTmfStatisticsTree.java | 74 +++--- .../model/ITmfColumnDataProvider.java | 16 +- .../model/ITmfStatisticsColumnData.java | 44 ++-- .../ui/views/statistics/model/Messages.java | 5 +- .../statistics/model/TmfBaseColumnData.java | 11 +- .../model/TmfBaseColumnDataProvider.java | 12 +- .../model/TmfBaseStatisticsTree.java | 26 ++- .../views/statistics/model/TmfStatistics.java | 14 +- .../model/TmfStatisticsTreeNode.java | 215 ++++++++++-------- .../model/TmfStatisticsTreeRootFactory.java | 13 +- .../model/TmfTreeContentProvider.java | 20 +- 24 files changed, 552 insertions(+), 385 deletions(-) diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/util/TmfFixedArrayTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/util/TmfFixedArrayTest.java index cf58a89452..5a6961d3a3 100755 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/util/TmfFixedArrayTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/util/TmfFixedArrayTest.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation + * Mathieu Denis - Initial design and implementation *******************************************************************************/ package org.eclipse.linuxtools.tmf.core.tests.util; @@ -20,11 +20,10 @@ import org.eclipse.linuxtools.tmf.core.util.TmfFixedArray; /** * TmfFixedArrayTest - *

+ * * Implement me. Please. - *

*/ -@SuppressWarnings({"nls","javadoc"}) +@SuppressWarnings({ "nls", "javadoc" }) public class TmfFixedArrayTest extends TestCase { // ------------------------------------------------------------------------ @@ -45,7 +44,8 @@ public class TmfFixedArrayTest extends TestCase { fString4 = "Fourth String"; fString5 = "Fifth String"; fFixedArray1 = new TmfFixedArray(fString1, fString2, fString3); - fFixedArray2 = new TmfFixedArray(); // Empty array at the beginning + // Empty array at the beginning + fFixedArray2 = new TmfFixedArray(); } @Override @@ -70,8 +70,7 @@ public class TmfFixedArrayTest extends TestCase { try { fFixedArray2.get(0); fail(); - } - catch (ArrayIndexOutOfBoundsException e) { + } catch (ArrayIndexOutOfBoundsException e) { // Success } } @@ -140,12 +139,11 @@ public class TmfFixedArrayTest extends TestCase { assertTrue("append", fString4.equals(fixedArray.get(3))); } - @SuppressWarnings("unchecked") public void testAppendFixedArray() { TmfFixedArray fixedArrayToAppend1 = new TmfFixedArray(fString4); TmfFixedArray fixedArrayToAppend2 = new TmfFixedArray(fString5); - TmfFixedArray fixedArray = new TmfFixedArray(); + TmfFixedArray fixedArray = new TmfFixedArray(); fixedArray = fixedArray.append(fFixedArray1, fixedArrayToAppend1); assertEquals("append", 4, fixedArray.size()); @@ -179,7 +177,7 @@ public class TmfFixedArrayTest extends TestCase { // ------------------------------------------------------------------------ public void testToArray() { - String[] expected1 = {fString1, fString2, fString3}; + String[] expected1 = { fString1, fString2, fString3 }; assertTrue("toArray", Arrays.equals(expected1, fFixedArray1.toArray())); String[] expected2 = {}; @@ -197,7 +195,7 @@ public class TmfFixedArrayTest extends TestCase { fFixedArray1.toArray(stringBigArray); assertNull("toArrayArg", stringBigArray[3]); - TmfFixedArray fFixedArrayObject = new TmfFixedArray(fString1); + TmfFixedArray fFixedArrayObject = new TmfFixedArray(fString1); stringArray = fFixedArrayObject.toArray(new String[0]); assertTrue("toArrayArg", stringArray[0].equals(fString1)); } diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/util/TmfFixedArray.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/util/TmfFixedArray.java index f38fd5f0ef..1144ba89cc 100755 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/util/TmfFixedArray.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/util/TmfFixedArray.java @@ -7,8 +7,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Francois Godin (copelnug@gmail.com) - Initial design and implementation - * Mathieu Denis (mathieu.denis@polymtl.ca) - Correction and refactoring + * Francois Godin - Initial design and implementation + * Mathieu Denis - Correction and refactoring *******************************************************************************/ package org.eclipse.linuxtools.tmf.core.util; @@ -20,38 +20,53 @@ import java.util.List; import java.util.RandomAccess; /** - *

Allow to create a List object that contain an already existing array.

- *

Works like {@link java.util.Arrays#asList} but offers more functions : + * Allow to create a List object that contain an already existing array. Works + * like {@link java.util.Arrays#asList} but contains more functions : *

    - *
  • {@link #hashCode()}
  • - *
  • {@link #equals(Object)}
  • - *

- *

Those functions allow to use the FixedArray as the key of a {@link java.util.HashMap}.

+ *
  • {@link #hashCode()}
  • + *
  • {@link #equals(Object)}
  • + * + * Those functions allow to use the FixedArray as the key of a + * {@link java.util.HashMap}. * * @version 1.0 * @author Francois Godin * - * @param Type of the array content. + * @param + * Type of the array content. */ public final class TmfFixedArray extends AbstractList implements RandomAccess, Cloneable { /** - * Replace {@link java.util.Arrays#copyOf(Object[], int)} that do not exist in java 5. - * @param Content of the array. - * @param array Original array to copy from. - * @param newLength Length of the copy to be returned. + * Replace {@link java.util.Arrays#copyOf(Object[], int)} that do not exist + * in java 5. + * + * @param + * Content of the array. + * @param array + * Original array to copy from. + * @param newLength + * Length of the copy to be returned. * @return A new array consisting of the elements specified. */ private static E[] copyOf(final E[] array, int newLength) { - E[] result = (E[])Array.newInstance(array.getClass().getComponentType(), newLength); // Is it useful to use newInstance? + // FIXME Is it useful to use newInstance? + E[] result = (E[]) Array.newInstance(array.getClass().getComponentType(), newLength); System.arraycopy(array, 0, result, 0, Math.min(array.length, newLength)); return result; } + /** - * Replace {@link java.util.Arrays#copyOf(Object[], int, Class)} that do not exist in java 5. - * @param Content of the array. - * @param array Original array to copy from. - * @param newLength Length of the copy to be returned. - * @param newType Type of the array to be returned. + * Replace {@link java.util.Arrays#copyOf(Object[], int, Class)} that do not + * exist in java 5. + * + * @param + * Content of the array. + * @param array + * Original array to copy from. + * @param newLength + * Length of the copy to be returned. + * @param newType + * Type of the array to be returned. * @return A new array consisting of the elements specified. */ private static E[] copyOf(final U[] array, int newLength, Class newType) { @@ -59,33 +74,48 @@ public final class TmfFixedArray extends AbstractList implements RandomAcc System.arraycopy(array, 0, result, 0, Math.min(array.length, newLength)); return result; } + /** - * Replace {@link java.util.Arrays#copyOfRange(Object[], int, int)} that do not exist in java 5. - * @param Content of the array. - * @param array Original array to copy from. - * @param start Starting position of the range, inclusive. - * @param end Ending position of the range, exclusive. - * @return A new array consisting of the elements specified. The length of the new array is equal to end-start + * Replace {@link java.util.Arrays#copyOfRange(Object[], int, int)} that do + * not exist in java 5. + * + * @param + * Content of the array. + * @param array + * Original array to copy from. + * @param start + * Starting position of the range, inclusive. + * @param end + * Ending position of the range, exclusive. + * @return A new array consisting of the elements specified. The length of + * the new array is equal to end-start */ private static E[] copyOfRange(final E[] array, int start, int end) { E[] result = (E[])Array.newInstance(array.getClass().getComponentType(), end - start); System.arraycopy(array, start, result, 0, end - start); return result; } + /** * The array. */ private final T[] fArray; + /** * Constructor. - * @param array Array to use. WILL NOT BE COPIED. + * + * @param array + * Array to use. WILL NOT BE COPIED. */ public TmfFixedArray(final T... array) { fArray = array; } + /** * Append a FixedArray to this FixedArray. - * @param value The FixedArray to append. + * + * @param value + * The FixedArray to append. * @return A new FixedArray with the elements of the two FixedArray. */ public TmfFixedArray append(final TmfFixedArray value) { @@ -93,28 +123,33 @@ public final class TmfFixedArray extends AbstractList implements RandomAcc System.arraycopy(value.fArray, 0, result.fArray, fArray.length, value.fArray.length); return result; } + /** * Append in order many FixedArray to this FixedArray. - * @param values The FixedArrays to append. + * + * @param values + * The FixedArrays to append. * @return A new FixedArray with the element of all the FixedArray. */ public TmfFixedArray append(final TmfFixedArray... values) { int newLength = 0; - for(TmfFixedArray value : values) { + for (TmfFixedArray value : values) { newLength += value.size(); } TmfFixedArray result = new TmfFixedArray(copyOf(fArray, fArray.length + newLength)); newLength = fArray.length; - for(TmfFixedArray value : values) - { + for (TmfFixedArray value : values) { System.arraycopy(value.fArray, 0, result.fArray, newLength, value.fArray.length); newLength += value.fArray.length; } return result; } + /** * Append an element to the array. - * @param value Element to append. + * + * @param value + * Element to append. * @return A new FixedArray with the element appended. */ public TmfFixedArray append(final T value) { @@ -122,72 +157,86 @@ public final class TmfFixedArray extends AbstractList implements RandomAcc result.set(fArray.length, value); return result; } + /** * Append an array of element to the array. - * @param values Elements array to append. + * + * @param values + * Elements array to append. * @return A new FixedArray with the elements appended. */ public TmfFixedArray append(final T... values) { TmfFixedArray result = new TmfFixedArray(copyOf(fArray, fArray.length + values.length)); - for(int i = 0; i < values.length; ++i) { + for (int i = 0; i < values.length; ++i) { result.set(fArray.length + i, values[i]); } return result; } + /* * (non-Javadoc) + * * @see java.lang.Object#clone() */ @Override - public Object clone() - { + public Object clone() { return new TmfFixedArray(copyOf(fArray, fArray.length)); } + /* * (non-Javadoc) + * * @see java.util.AbstractList#equals(java.lang.Object) */ @Override public boolean equals(Object o) { - if(o instanceof TmfFixedArray) { - return Arrays.equals(fArray, ((TmfFixedArray)o).fArray); + if (o instanceof TmfFixedArray) { + return Arrays.equals(fArray, ((TmfFixedArray) o).fArray); } - if(!(o instanceof List)) { + if (!(o instanceof List)) { return false; } - for(int i = 0; i < fArray.length; ++i) { - if(!fArray[i].equals(o)) { + for (int i = 0; i < fArray.length; ++i) { + if (!fArray[i].equals(o)) { return false; } } return true; } + /* * (non-Javadoc) + * * @see java.util.AbstractList#get(int) */ @Override public T get(int index) { return fArray[index]; } + /** * Get the array reference. + * * @return The array reference. * @see #toArray FixedArray.toArray() to get a copy of the array. */ public T[] getArray() { return fArray; } + /* * (non-Javadoc) + * * @see java.util.AbstractList#hashCode() */ @Override public int hashCode() { return Arrays.hashCode(fArray); } + /* * (non-Javadoc) + * * @see java.util.AbstractList#set(int, java.lang.Object) */ @Override @@ -196,58 +245,71 @@ public final class TmfFixedArray extends AbstractList implements RandomAcc fArray[index] = element; return temp; } + /* * (non-Javadoc) + * * @see java.util.AbstractCollection#size() */ @Override public int size() { return fArray.length; } + /** * Get a array covering only a part of the array. - * @param start Starting position of the new array. + * + * @param start + * Starting position of the new array. * @return A new array covering the elements specified. */ public TmfFixedArray subArray(int start) { return new TmfFixedArray(copyOfRange(fArray, start, fArray.length)); } + /** * Get a array covering only a part of the array. - * @param start Starting position of the new array. - * @param length Number of element to include in the new array. + * + * @param start + * Starting position of the new array. + * @param length + * Number of element to include in the new array. * @return A new array covering the elements specified. */ public TmfFixedArray subArray(int start, int length) { return new TmfFixedArray(copyOfRange(fArray, start, length + start)); } + /* * (non-Javadoc) + * * @see java.util.AbstractCollection#toArray() */ @Override - public T[] toArray() - { + public T[] toArray() { return copyOf(fArray, fArray.length); } + /* * (non-Javadoc) + * * @see java.util.AbstractCollection#toArray(T[]) */ @Override - public E[] toArray(E[] array) - { - if(array.length < fArray.length) { - return copyOf(fArray, fArray.length,(Class)array.getClass()); + public E[] toArray(E[] array) { + if (array.length < fArray.length) { + return copyOf(fArray, fArray.length, (Class) array.getClass()); } System.arraycopy(fArray, 0, array, 0, fArray.length); - if(array.length > fArray.length) { + if (array.length > fArray.length) { array[fArray.length] = null; } return array; } + /* * (non-Javadoc) + * * @see java.util.AbstractCollection#toString() */ @Override diff --git a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/AllTmfUITests.java b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/AllTmfUITests.java index 6a590ae458..2759bf61e6 100644 --- a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/AllTmfUITests.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/AllTmfUITests.java @@ -9,7 +9,7 @@ * Contributors: * Bernd Hufmann - Initial API and implementation * Bernd Hufmann - Add UML2SD tests - * Mathieu Denis (mathieu.denis@polymtl.ca) - Add Statistics test + * Mathieu Denis - Add Statistics test *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.tests; @@ -19,7 +19,7 @@ import junit.framework.TestSuite; /** * AllTmfUITests - *

    + * * Master test suite for TMF UI Core. */ public class AllTmfUITests { @@ -27,15 +27,15 @@ public class AllTmfUITests { /** * @return the TMF UI test suite */ - public static Test suite() { - TestSuite suite = new TestSuite(AllTmfUITests.class.getName()); - //$JUnit-BEGIN$ - suite.addTest(org.eclipse.linuxtools.tmf.ui.tests.statistics.AllTests.suite()); + public static Test suite() { + TestSuite suite = new TestSuite(AllTmfUITests.class.getName()); + // $JUnit-BEGIN$ + suite.addTest(org.eclipse.linuxtools.tmf.ui.tests.statistics.AllTests.suite()); suite.addTest(org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.dialogs.AllTests.suite()); suite.addTest(org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.loader.AllTests.suite()); suite.addTest(org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.load.AllTests.suite()); suite.addTest(org.eclipse.linuxtools.tmf.ui.tests.histogram.AllTests.suite()); - //$JUnit-END$ - return suite; - } + // $JUnit-END$ + return suite; + } } diff --git a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/AllTests.java b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/AllTests.java index e9f82de763..8d8ce22159 100644 --- a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/AllTests.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/AllTests.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation + * Mathieu Denis - Initial API and Implementation * Bernd Hufmann - Fixed suite name *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.tests.statistics; @@ -24,16 +24,16 @@ public class AllTests { /** * @return the test suite */ - public static Test suite() { - TestSuite suite = new TestSuite(AllTests.class.getName()); - //$JUnit-BEGIN$ - suite.addTestSuite(TmfBaseColumnDataProviderTest.class); - suite.addTestSuite(TmfBaseColumnDataTest.class); - suite.addTestSuite(TmfBaseStatisticsDataTest.class); - suite.addTestSuite(TmfStatisticsTreeNodeTest.class); - suite.addTestSuite(TmfStatisticsTreeRootFactoryTest.class); - suite.addTestSuite(TmfTreeContentProviderTest.class); - //$JUnit-END$ - return suite; - } -} \ No newline at end of file + public static Test suite() { + TestSuite suite = new TestSuite(AllTests.class.getName()); + // $JUnit-BEGIN$ + suite.addTestSuite(TmfBaseColumnDataProviderTest.class); + suite.addTestSuite(TmfBaseColumnDataTest.class); + suite.addTestSuite(TmfBaseStatisticsDataTest.class); + suite.addTestSuite(TmfStatisticsTreeNodeTest.class); + suite.addTestSuite(TmfStatisticsTreeRootFactoryTest.class); + suite.addTestSuite(TmfTreeContentProviderTest.class); + // $JUnit-END$ + return suite; + } +} diff --git a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java index 8e35d7a372..58aafde9ca 100644 --- a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation + * Mathieu Denis - Initial API and Implementation * Bernd Hufmann - Fixed header and warnings *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.tests.statistics; @@ -62,7 +62,7 @@ public class TmfBaseColumnDataProviderTest extends TestCase { private final TmfTimestamp fTimestamp2 = new TmfTimestamp(12350, (byte) 2, 5); private final TmfTimestamp fTimestamp3 = new TmfTimestamp(12355, (byte) 2, 5); - private final String fSource = "Source"; + private final String fSource = "Source"; private final TmfEventType fType1 = new TmfEventType(fContext, fTypeId1, TmfEventField.makeRoot(fLabels)); private final TmfEventType fType2 = new TmfEventType(fContext, fTypeId1, TmfEventField.makeRoot(fLabels)); @@ -169,4 +169,4 @@ public class TmfBaseColumnDataProviderTest extends TestCase { } } } -} \ No newline at end of file +} diff --git a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java index 3f4f60b267..a123c4118f 100755 --- a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation + * Mathieu Denis - Initial design and implementation *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.tests.statistics; diff --git a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java index d955b9b8b3..7e7ebb28f5 100755 --- a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation + * Mathieu Denis - Initial design and implementation * Bernd Hufmann - Fixed warnings *******************************************************************************/ @@ -40,7 +40,7 @@ public class TmfBaseStatisticsDataTest extends TestCase { // ------------------------------------------------------------------------ // Fields // ------------------------------------------------------------------------ - private String fTestName = null; + private String fTestName = null; private final String fContext = "UnitTest"; private final String fTypeId1 = "Some type1"; @@ -80,7 +80,8 @@ public class TmfBaseStatisticsDataTest extends TestCase { // ------------------------------------------------------------------------ /** - * @param name of the test + * @param name + * Test name */ public TmfBaseStatisticsDataTest(final String name) { super(name); @@ -141,8 +142,7 @@ public class TmfBaseStatisticsDataTest extends TestCase { temp = iterChild.next(); if (keyExpected.contains(temp.getKey())) { keyExpected.removeElement(temp.getKey()); - } - else { + } else { fail(); } } @@ -175,7 +175,10 @@ public class TmfBaseStatisticsDataTest extends TestCase { Vector keyExpected = new Vector(); keyExpected.add(fEvent1.getType().toString()); keyExpected.add(fEvent3.getType().toString()); - // It should return the eventType even though the number of events equals 0 + /* + * It should return the eventType even though the number of events + * equals 0 + */ fStatsData.get(new TmfFixedArray(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString())).reset(); // Getting children of a category childrenTreeNode = fStatsData.get(treeNode.getPath()).getAllChildren(); @@ -187,8 +190,7 @@ public class TmfBaseStatisticsDataTest extends TestCase { temp = iterChild.next(); if (keyExpected.contains(temp.getKey())) { keyExpected.removeElement(temp.getKey()); - } - else { + } else { fail(); } } @@ -213,8 +215,7 @@ public class TmfBaseStatisticsDataTest extends TestCase { for (TmfStatisticsTreeNode child : childrenTreeNode) { if (child.getKey().compareTo(fEvent1.getType().toString()) == 0) { assertEquals("registerEvent", 2, child.getValue().nbEvents); - } - else if (child.getKey().compareTo(fEvent3.getType().toString()) == 0) { + } else if (child.getKey().compareTo(fEvent3.getType().toString()) == 0) { assertEquals("registerEvent", 1, child.getValue().nbEvents); } } diff --git a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java index c0ec628953..c9d3d7143d 100755 --- a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation + * Mathieu Denis - Initial design and implementation * Bernd Hufmann - Fixed warnings *******************************************************************************/ @@ -81,7 +81,8 @@ public class TmfStatisticsTreeNodeTest extends TestCase { // ------------------------------------------------------------------------ /** - * @param name of the test + * @param name + * Test name */ public TmfStatisticsTreeNodeTest(final String name) { super(name); @@ -122,16 +123,16 @@ public class TmfStatisticsTreeNodeTest extends TestCase { // Creates a category from the key already created TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next(); - assertTrue("containsChild", rootNode.containsChild(fTestName)); + assertTrue("containsChild", rootNode.containsChild(fTestName)); assertFalse("containsChild", rootNode.containsChild(catNode.getKey())); assertFalse("containsChild", rootNode.containsChild(null)); - assertTrue("containsChild", traceNode.containsChild(catNode.getKey())); + assertTrue("containsChild", traceNode.containsChild(catNode.getKey())); assertFalse("containsChild", traceNode.containsChild(fEvent1.getType().toString())); assertFalse("containsChild", traceNode.containsChild(null)); - assertTrue("containsChild", catNode.containsChild(fEvent1.getType().toString())); - assertTrue("containsChild", catNode.containsChild(fEvent3.getType().toString())); + assertTrue("containsChild", catNode.containsChild(fEvent1.getType().toString())); + assertTrue("containsChild", catNode.containsChild(fEvent3.getType().toString())); assertFalse("containsChild", catNode.containsChild(null)); } @@ -168,8 +169,7 @@ public class TmfStatisticsTreeNodeTest extends TestCase { temp = iterChild.next(); if (keyExpected.contains(temp.getKey())) { keyExpected.removeElement(temp.getKey()); - } - else { + } else { fail(); } } @@ -202,7 +202,10 @@ public class TmfStatisticsTreeNodeTest extends TestCase { Vector keyExpected = new Vector(); keyExpected.add(fEvent1.getType().toString()); keyExpected.add(fEvent3.getType().toString()); - // It should return the eventType even though the number of events equals 0 + /* + * It should return the eventType even though the number of events + * equals 0 + */ fStatsData.get(new TmfFixedArray(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString())).reset(); // Getting children of a category childrenTreeNode = treeNode.getAllChildren(); @@ -214,8 +217,7 @@ public class TmfStatisticsTreeNodeTest extends TestCase { temp = iterChild.next(); if (keyExpected.contains(temp.getKey())) { keyExpected.removeElement(temp.getKey()); - } - else { + } else { fail(); } } @@ -228,6 +230,7 @@ public class TmfStatisticsTreeNodeTest extends TestCase { // ------------------------------------------------------------------------ // GetNbChildren // ------------------------------------------------------------------------ + /** * Test getting of number of children. */ @@ -237,9 +240,9 @@ public class TmfStatisticsTreeNodeTest extends TestCase { TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next(); TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString())); - assertEquals("getNbChildren", 1, rootNode.getNbChildren()); - assertEquals("getNbChildren", 1, traceNode.getNbChildren()); - assertEquals("getNbChildren", 2, catNode.getNbChildren()); + assertEquals("getNbChildren", 1, rootNode.getNbChildren()); + assertEquals("getNbChildren", 1, traceNode.getNbChildren()); + assertEquals("getNbChildren", 2, catNode.getNbChildren()); assertEquals("getNbChildren", 0, elementNode.getNbChildren()); } @@ -256,9 +259,9 @@ public class TmfStatisticsTreeNodeTest extends TestCase { TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next(); TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString())); - assertTrue ("hasChildren", rootNode.hasChildren()); - assertTrue ("hasChildren", traceNode.hasChildren()); - assertTrue ("hasChildren", catNode.hasChildren()); + assertTrue("hasChildren", rootNode.hasChildren()); + assertTrue("hasChildren", traceNode.hasChildren()); + assertTrue("hasChildren", catNode.hasChildren()); assertFalse("hasChildren", elementNode.hasChildren()); } @@ -305,6 +308,7 @@ public class TmfStatisticsTreeNodeTest extends TestCase { // ------------------------------------------------------------------------ // GetKey // ------------------------------------------------------------------------ + /** * Test getting of key. */ @@ -314,9 +318,9 @@ public class TmfStatisticsTreeNodeTest extends TestCase { TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next(); TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString())); - assertEquals("getKey", 0, rootNode.getKey().compareTo(AbsTmfStatisticsTree.ROOT.get(0))); - assertEquals("getKey", 0, traceNode.getKey().compareTo(fTestName)); - assertEquals("getKey", 0, catNode.getKey().compareTo(Messages.TmfStatisticsData_EventTypes)); + assertEquals("getKey", 0, rootNode.getKey().compareTo(AbsTmfStatisticsTree.ROOT.get(0))); + assertEquals("getKey", 0, traceNode.getKey().compareTo(fTestName)); + assertEquals("getKey", 0, catNode.getKey().compareTo(Messages.TmfStatisticsData_EventTypes)); assertEquals("getKey", 0, elementNode.getKey().compareTo(fEvent1.getType().toString())); } @@ -333,9 +337,9 @@ public class TmfStatisticsTreeNodeTest extends TestCase { TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next(); TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString())); - assertTrue("getPath", rootNode.getPath().equals(AbsTmfStatisticsTree.ROOT)); - assertTrue("getPath", traceNode.getPath().equals(new TmfFixedArray(fTestName))); - assertTrue("getPath", catNode.getPath().equals(new TmfFixedArray(fTestName, Messages.TmfStatisticsData_EventTypes))); + assertTrue("getPath", rootNode.getPath().equals(AbsTmfStatisticsTree.ROOT)); + assertTrue("getPath", traceNode.getPath().equals(new TmfFixedArray(fTestName))); + assertTrue("getPath", catNode.getPath().equals(new TmfFixedArray(fTestName, Messages.TmfStatisticsData_EventTypes))); assertTrue("getPath", elementNode.getPath().equals(new TmfFixedArray(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString()))); } @@ -353,9 +357,9 @@ public class TmfStatisticsTreeNodeTest extends TestCase { TmfStatisticsTreeNode elementNode1 = fStatsData.get(new TmfFixedArray(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString())); TmfStatisticsTreeNode elementNode2 = fStatsData.get(new TmfFixedArray(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent3.getType().toString())); - assertEquals("getValue", 0, rootNode.getValue().nbEvents); - assertEquals("getValue", 3, traceNode.getValue().nbEvents); - assertEquals("getValue", 0, catNode.getValue().nbEvents); + assertEquals("getValue", 0, rootNode.getValue().nbEvents); + assertEquals("getValue", 3, traceNode.getValue().nbEvents); + assertEquals("getValue", 0, catNode.getValue().nbEvents); assertEquals("getValue", 2, elementNode1.getValue().nbEvents); assertEquals("getValue", 1, elementNode2.getValue().nbEvents); } diff --git a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java index ae7b5240e1..ca8512c027 100755 --- a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation + * Mathieu Denis - Initial design and implementation * Bernd Hufmann - Fixed warnings *******************************************************************************/ diff --git a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java index 82ba6ffdee..8f81c9e168 100755 --- a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation + * Mathieu Denis - Initial design and implementation * Bernd Hufmann - Fixed warnings *******************************************************************************/ diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/ITmfExtraEventInfo.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/ITmfExtraEventInfo.java index a8cd5640ae..0ebc8c3783 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/ITmfExtraEventInfo.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/ITmfExtraEventInfo.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation + * Mathieu Denis - Initial design and implementation * Bernd Hufmann - Changed interface and class name *******************************************************************************/ @@ -24,6 +24,7 @@ public interface ITmfExtraEventInfo { /** * Returns the trace name. + * * @return the name of the trace. */ public String getTraceName(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/Messages.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/Messages.java index 62656f827a..2fd8caecde 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/Messages.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/Messages.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation + * Mathieu Denis - Initial API and Implementation *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.statistics; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java index e9f3950452..73d8eb6416 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 20112 Ericsson + * Copyright (c) 2011, 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 @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Generalized version based on LTTng + * Mathieu Denis - Generalized version based on LTTng * Bernd Hufmann - Updated to use trace reference in TmfEvent and streaming * *******************************************************************************/ @@ -56,66 +56,84 @@ import org.eclipse.swt.widgets.Listener; /** * The generic Statistics View displays statistics for any kind of traces. * - * It is implemented according to the MVC pattern. - The model is a TmfStatisticsTreeNode built by the State Manager. - The view is built with a - * TreeViewer. - The controller that keeps model and view synchronized is an observer of the model. - *

    + * It is implemented according to the MVC pattern. - The model is a + * TmfStatisticsTreeNode built by the State Manager. - The view is built with a + * TreeViewer. - The controller that keeps model and view synchronized is an + * observer of the model. * * @version 1.0 - * @author @author Mathieu Denis + * @author Mathieu Denis */ public class TmfStatisticsView extends TmfView { + /** * The ID correspond to the package in which this class is embedded */ public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.statistics"; //$NON-NLS-1$ + /** - * The view name. + * The view name. */ public static final String TMF_STATISTICS_VIEW = "StatisticsView"; //$NON-NLS-1$ + /** - * Refresh frequency + * Refresh frequency */ protected static final Long STATS_INPUT_CHANGED_REFRESH = 5000L; + /** - * Default PAGE_SIZE for background requests + * Default PAGE_SIZE for background requests */ protected static final int PAGE_SIZE = 50000; + /** - * The actual tree viewer to display + * The actual tree viewer to display */ protected TreeViewer fTreeViewer; + /** - * Stores the request to the experiment + * Stores the global request to the experiment */ protected ITmfEventRequest fRequest = null; + /** - * Update synchronization parameter (used for streaming): Update busy indicator + * Update synchronization parameter (used for streaming): Update busy + * indicator */ protected boolean fStatisticsUpdateBusy = false; + /** - * Update synchronization parameter (used for streaming): Update pending indicator + * Update synchronization parameter (used for streaming): Update pending + * indicator */ protected boolean fStatisticsUpdatePending = false; + /** - * Update synchronization parameter (used for streaming): Pending Update time range + * Update synchronization parameter (used for streaming): Pending Update + * time range */ protected TmfTimeRange fStatisticsUpdateRange = null; + /** * Update synchronization object. */ protected final Object fStatisticsUpdateSyncObj = new Object(); + /** - * Flag to force request the data from trace + * Flag to force request the data from trace */ protected boolean fRequestData = false; + /** - * Object to store the cursor while waiting for the experiment to load + * Object to store the cursor while waiting for the experiment to load */ private Cursor fWaitCursor = null; + /** - * View instance counter (for multiple statistic views) + * View instance counter (for multiple statistic views) */ private static int fCountInstance = 0; + /** * Number of this instance. Used as an instance ID. */ @@ -142,7 +160,9 @@ public class TmfStatisticsView extends TmfView { /* * (non-Javadoc) - * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) + * + * @see + * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ @Override public void createPartControl(Composite parent) { @@ -231,11 +251,12 @@ public class TmfStatisticsView extends TmfView { // Insert the statistics data into the tree TmfExperimentSelectedSignal signal = new TmfExperimentSelectedSignal(this, experiment); experimentSelected(signal); - } + } } /* * (non-Javadoc) + * * @see org.eclipse.linuxtools.tmf.ui.views.TmfView#dispose() */ @Override @@ -245,7 +266,10 @@ public class TmfStatisticsView extends TmfView { fWaitCursor.dispose(); } - // Make sure there is no request running before removing the statistics tree + /* + * Make sure there is no request running before removing the statistics + * tree + */ cancelOngoingRequest(); // clean the model TmfStatisticsTreeRootFactory.removeAll(); @@ -253,6 +277,7 @@ public class TmfStatisticsView extends TmfView { /* * (non-Javadoc) + * * @see org.eclipse.ui.part.WorkbenchPart#setFocus() */ @Override @@ -290,13 +315,16 @@ public class TmfStatisticsView extends TmfView { * Called when an experiment request has failed or has been cancelled. * Remove the data retrieved from the experiment from the statistics tree. * - * @param name The experiment name + * @param name + * The experiment name */ public void modelIncomplete(String name) { Object input = fTreeViewer.getInput(); if (input != null && input instanceof TmfStatisticsTreeNode) { - // The data from this experiment is invalid and shall be removed to - // refresh upon next selection + /* + * The data from this experiment is invalid and shall be removed to + * refresh upon next selection + */ TmfStatisticsTreeRootFactory.removeStatTreeRoot(getTreeID(name)); // Reset synchronization information @@ -309,7 +337,8 @@ public class TmfStatisticsView extends TmfView { /** * Handles the signal about disposal of the current experiment. * - * @param signal The disposed signal + * @param signal + * The disposed signal */ @TmfSignalHandler public void experimentDisposed(TmfExperimentDisposedSignal signal) { @@ -320,10 +349,12 @@ public class TmfStatisticsView extends TmfView { } /** - * Handler called when an experiment is selected. Checks if the experiment has changed - * and requests the selected experiment if it has not yet been cached. + * Handler called when an experiment is selected. Checks if the experiment + * has changed and requests the selected experiment if it has not yet been + * cached. * - * @param signal Contains the information about the selection. + * @param signal + * Contains the information about the selection. */ @TmfSignalHandler public void experimentSelected(TmfExperimentSelectedSignal signal) { @@ -343,8 +374,10 @@ public class TmfStatisticsView extends TmfView { if (numTraces == numNodeTraces) { boolean same = true; - // Detect if the experiment contains the same traces as when - // previously selected + /* + * Detect if the experiment contains the same traces as when + * previously selected + */ for (int i = 0; i < numTraces; i++) { String traceName = traces[i].getName(); if (!experimentTreeNode.containsChild(traceName)) { @@ -388,13 +421,15 @@ public class TmfStatisticsView extends TmfView { /** * Handles the signal about new experiment range. - * @param signal The experiment range updated signal + * + * @param signal + * The experiment range updated signal */ @TmfSignalHandler public void experimentRangeUpdated(TmfExperimentRangeUpdatedSignal signal) { TmfExperiment experiment = signal.getExperiment(); // validate - if (! experiment.equals(TmfExperiment.getCurrentExperiment())) { + if (!experiment.equals(TmfExperiment.getCurrentExperiment())) { return; } @@ -402,16 +437,18 @@ public class TmfStatisticsView extends TmfView { } /** - * Handles the experiment updated signal. This will detect new events - * in case the indexing is not coalesced with a statistics request. - * @param signal The experiment updated signal + * Handles the experiment updated signal. This will detect new events in + * case the indexing is not coalesced with a statistics request. + * + * @param signal + * The experiment updated signal * * @since 1.1 */ @TmfSignalHandler public void experimentUpdated(TmfExperimentUpdatedSignal signal) { TmfExperiment experiment = signal.getExperiment(); - if (! experiment.equals(TmfExperiment.getCurrentExperiment())) { + if (!experiment.equals(TmfExperiment.getCurrentExperiment())) { return; } @@ -420,9 +457,11 @@ public class TmfStatisticsView extends TmfView { nbEvents += (int) node.getValue().nbEvents; } - // In the normal case, the statistics request is coalesced with indexing - // and the number of events are the same, there is nothing to do. - // But if its not the case, trigger a new request to count the new events. + /* + * In the normal case, the statistics request is coalesced with indexing + * and the number of events are the same, there is nothing to do. But if + * it's not the case, trigger a new request to count the new events. + */ if (nbEvents < experiment.getNbEvents()) { requestData(experiment, experiment.getTimeRange()); } @@ -438,16 +477,19 @@ public class TmfStatisticsView extends TmfView { } /** - * Returns the quantity of data to retrieve before a refresh of the view is performed + * Returns the quantity of data to retrieve before a refresh of the view is + * performed * - * @return the quantity of data to retrieve before a refresh of the view is performed. + * @return the quantity of data to retrieve before a refresh of the view is + * performed. */ protected long getInputChangedRefresh() { return STATS_INPUT_CHANGED_REFRESH; } /** - * This method can be overridden to implement another way to represent the statistics data and to retrieve the information for display. + * This method can be overridden to implement another way to represent the + * statistics data and to retrieve the information for display. * * @return a TmfStatisticsData object. */ @@ -456,7 +498,8 @@ public class TmfStatisticsView extends TmfView { } /** - * This method can be overridden to change the representation of the data in the columns. + * This method can be overridden to change the representation of the data in + * the columns. * * @return an object implementing ITmfBaseColumnDataProvider. */ @@ -465,9 +508,11 @@ public class TmfStatisticsView extends TmfView { } /** - * Constructs the ID based on the experiment name and fInstanceNb + * Constructs the ID based on the experiment name and + * fInstanceNb * - * @param experimentName the name of the trace name to show in the view + * @param experimentName + * the name of the trace name to show in the view * @return a view ID */ protected String getTreeID(String experimentName) { @@ -475,9 +520,12 @@ public class TmfStatisticsView extends TmfView { } /** - * When the experiment is loading the cursor will be different so the user know the processing is not finished yet. + * When the experiment is loading the cursor will be different so the user + * knows the processing is not finished yet. * - * @param waitInd Indicates if we need to show the waiting cursor, or the default one + * @param waitInd + * Indicates if we need to show the waiting cursor, or the + * default one */ protected void waitCursor(final boolean waitInd) { if ((fTreeViewer == null) || (fTreeViewer.getTree().isDisposed())) { @@ -493,7 +541,8 @@ public class TmfStatisticsView extends TmfView { display.asyncExec(new Runnable() { @Override public void run() { - if ((fTreeViewer != null) && (!fTreeViewer.getTree().isDisposed())) { + if ((fTreeViewer != null) + && (!fTreeViewer.getTree().isDisposed())) { Cursor cursor = null; /* indicates default */ if (waitInd) { cursor = fWaitCursor; @@ -505,15 +554,18 @@ public class TmfStatisticsView extends TmfView { } /** - * Perform the request for an experiment and populates the statistics tree with event. + * Perform the request for an experiment and populates the statistics tree + * with events. * - * @param experiment experiment for which we need the statistics data. - * @param timeRange to request + * @param experiment + * Experiment for which we need the statistics data. + * @param timeRange + * to request */ protected void requestData(final TmfExperiment experiment, TmfTimeRange timeRange) { if (experiment != null) { - // Check if update is already ongoing + // Check if an update is already ongoing if (checkUpdateBusy(timeRange)) { return; } @@ -596,16 +648,19 @@ public class TmfStatisticsView extends TmfView { } /** - * Checks if statistic update is ongoing. If it is ongoing the new time range is stored as pending + * Checks if statistic update is ongoing. If it is ongoing the new time + * range is stored as pending * - * @param timeRange - new time range + * @param timeRange + * - new time range * @return true if statistic update is ongoing else false */ protected boolean checkUpdateBusy(TmfTimeRange timeRange) { synchronized (fStatisticsUpdateSyncObj) { if (fStatisticsUpdateBusy) { fStatisticsUpdatePending = true; - if (fStatisticsUpdateRange == null || timeRange.getEndTime().compareTo(fStatisticsUpdateRange.getEndTime()) > 0) { + if (fStatisticsUpdateRange == null + || timeRange.getEndTime().compareTo(fStatisticsUpdateRange.getEndTime()) > 0) { fStatisticsUpdateRange = timeRange; } return true; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java index 79efa68d18..e268f3c6e0 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java @@ -23,28 +23,27 @@ import org.eclipse.linuxtools.tmf.core.util.TmfFixedArray; import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo; /** - *

    Base class for the statistics storage.

    - *

    - * It allow to implement a tree structure while avoiding the need to run through - * the tree each time you need to add a node at a given place. - *

    + * Base class for the statistics storage. It allow to implement a tree structure + * while avoiding the need to run through the tree each time you need to add a + * node at a given place. * - * @version 1.0 - * @author Mathieu Denis + * @version 1.0 + * @author Mathieu Denis */ public abstract class AbsTmfStatisticsTree { /** - *

    String builder used to merge string with more efficacy.

    + * String builder used to merge string with more efficiency. */ protected static final StringBuilder fBuilder = new StringBuilder(); + /** - *

    Identification of the root.

    + * Identification of the root. */ public static final TmfFixedArray ROOT = new TmfFixedArray("root"); //$NON-NLS-1$ /** - *

    Function to merge many string with more efficacy.

    + * Function to merge many string with more efficiency. * * @param strings * Strings to merge. @@ -55,26 +54,22 @@ public abstract class AbsTmfStatisticsTree { for (String s : strings) { fBuilder.append(s); } - return fBuilder.toString(); + return fBuilder.toString(); } /** - *

    Define what child a node can have.

    - *

    - * The management and usage of this map is done by subclass. - *

    - *

    - * HashSet are always faster than TreeSet. - *

    + * Define what children a node can have. The management and usage of this map + * is done by subclasses. HashSet are always faster than TreeSet for String keys. */ protected Map> fKeys; + /** - *

    The nodes in the tree. + * The nodes in the tree. */ protected HashMap, TmfStatisticsTreeNode> fNodes; /** - *

    Constructor.

    + * Constructor. */ public AbsTmfStatisticsTree() { fNodes = new HashMap, TmfStatisticsTreeNode>(); @@ -82,7 +77,7 @@ public abstract class AbsTmfStatisticsTree { } /** - *

    Get a node.

    + * Get a node. * * @param path * Path to the node. @@ -93,7 +88,7 @@ public abstract class AbsTmfStatisticsTree { } /** - *

    Get the children of a node.

    + * Get the children of a node. * * @param path * Path to the node. @@ -102,7 +97,8 @@ public abstract class AbsTmfStatisticsTree { public abstract Collection getChildren(final TmfFixedArray path); /** - *

    Get every children of a node, even if it doesn't have any registered events, as opposed to getChildren

    + * Get every children of a node, even if it doesn't have any registered + * events, as opposed to getChildren * * @param path * Path to the node. @@ -111,7 +107,7 @@ public abstract class AbsTmfStatisticsTree { public abstract Collection getAllChildren(final TmfFixedArray path); /** - *

    Get the map of existing elements of path classified by parent.

    + * Get the map of existing elements of path classified by parent. * * @return The map. */ @@ -120,7 +116,7 @@ public abstract class AbsTmfStatisticsTree { } /** - *

    Get or create a node.

    + * Get or create a node. * * @param path * Path to the node. @@ -137,7 +133,7 @@ public abstract class AbsTmfStatisticsTree { } /** - *

    Get the parent of a node.

    + * Get the parent of a node. * * @param path * Path to the node. @@ -154,10 +150,10 @@ public abstract class AbsTmfStatisticsTree { } /** - *

    Increase any kind of counter.

    - *

    - * This method must be implemented by subclass. - *

    + * Increase any kind of counter. + * + * This method must be implemented by subclasses. + * * @param event * Current event. * @param extraInfo @@ -168,10 +164,10 @@ public abstract class AbsTmfStatisticsTree { public abstract void increase(ITmfEvent event, ITmfExtraEventInfo extraInfo, int values); /** - *

    Register an event.

    - *

    - * This method must be implemented by subclass. - *

    + * Register an event. + * + * This method must be implemented by subclasses. + * * @param event * Current event. * @param extraInfo @@ -180,11 +176,10 @@ public abstract class AbsTmfStatisticsTree { public abstract void registerEvent(ITmfEvent event, ITmfExtraEventInfo extraInfo); /** - *

    Register that a new node was created.

    - *

    + * Register that a new node was created. + * * Must make sure the {@link #getChildren(TmfFixedArray)} on the parent node * will return the newly created node. - *

    * * @param path * Path of the new node. @@ -192,10 +187,9 @@ public abstract class AbsTmfStatisticsTree { protected abstract void registerName(final TmfFixedArray path); /** - *

    Reset a node.

    - *

    + * Reset a node. + * * Work recursively. - *

    * * @param path * Path to the node. diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfColumnDataProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfColumnDataProvider.java index 6e06be4179..35cd206dfe 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfColumnDataProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfColumnDataProvider.java @@ -1,13 +1,13 @@ /******************************************************************************* * Copyright (c) 2011, 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: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation + * Mathieu Denis - Initial API and Implementation *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.statistics.model; @@ -15,16 +15,18 @@ package org.eclipse.linuxtools.tmf.ui.views.statistics.model; import java.util.List; /** - * Basic methods that must be implemented in a column data provider. - * The TmfStatisticsView uses classes implementing this - * interface to define the columns in the statistics tree viewer. - * + * Basic methods that must be implemented in a column data provider. The + * TmfStatisticsView uses classes implementing this interface to + * define the columns in the statistics tree viewer. + * * @version 1.0 * @author Mathieu Denis */ public interface ITmfColumnDataProvider { + /** * Return a list of the column created for the view + * * @return columns list */ public List getColumnData(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfStatisticsColumnData.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfStatisticsColumnData.java index 59043d8d3d..236423aab0 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfStatisticsColumnData.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/ITmfStatisticsColumnData.java @@ -1,13 +1,13 @@ /******************************************************************************* * Copyright (c) 2011, 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: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation + * Mathieu Denis - Initial API and Implementation *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.statistics.model; @@ -17,53 +17,63 @@ import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider; /** - * Provide the basic interface to create a statistics column for the statistics table tree. - * - * @version 1.0 - * @author Mathieu Denis + * Provide the basic interface to create a statistics column for the statistics + * table tree. + * + * @version 1.0 + * @author Mathieu Denis */ public interface ITmfStatisticsColumnData { /** * Return the column name. + * * @return the name of the column. */ public String getHeader(); - + /** * Return the width of the column at the creation. + * * @return the width of the column. */ public int getWidth(); - + /** * Return the alignment of the column. + * * @see org.eclipse.swt.SWT * @return an integer representing the alignment inside the column. */ public int getAlignment(); - + /** - * Provide the text to show in the tooltip when the cursor comes over the column header. + * Provide the text to show in the tooltip when the cursor comes over the + * column header. + * * @return text to show in the tooltip */ public String getTooltip(); - + /** - * Return the labelProvider which provides the information to put in column cells. + * Return the labelProvider which provides the information to put in column + * cells. + * * @return a ColumnLabelProvider. */ public ColumnLabelProvider getLabelProvider(); - + /** * Return a ViewerComparator used to sort viewer's contents. + * * @return the comparator. */ public ViewerComparator getComparator(); - + /** - * Return the provider of the percentage. - * Used to draw bar charts in columns. + * Return the provider of the percentage. Used to draw bar charts in + * columns. + * * @return the percentageProvider. */ public ITmfColumnPercentageProvider getPercentageProvider(); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/Messages.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/Messages.java index 8811eaae1c..18e9ebed7c 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/Messages.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/Messages.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation + * Mathieu Denis - Initial API and Implementation *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.statistics.model; @@ -21,11 +21,14 @@ import org.eclipse.osgi.util.NLS; * @author Mathieu Denis */ public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ui.views.statistics.model.messages"; //$NON-NLS-1$ + /** * CPU statistic name. */ public static String TmfStatisticsData_CPUs; + /** * Event type statistic name. */ diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnData.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnData.java index 2600102e46..7d9662a513 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnData.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnData.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial Implementation + * Mathieu Denis - Initial Implementation * Bernd Hufmann - Added Annotations *******************************************************************************/ @@ -28,26 +28,33 @@ public class TmfBaseColumnData implements ITmfStatisticsColumnData { * Name of the column. */ protected final String fHeader; + /** * Width of the column. */ protected final int fWidth; + /** * Alignment of the column. */ protected final int fAlignment; + /** * Tooltip of the column. */ protected final String fTooltip; + /** - * Adapts a StatisticsTreeNode into the content of it's corresponding cell for that column. + * Adapts a StatisticsTreeNode into the content of it's corresponding cell + * for that column. */ protected final ColumnLabelProvider fLabelProvider; + /** * Used to sort elements of this column. Can be null. */ protected final ViewerComparator fComparator; + /** * Used to draw bar charts in this column. Can be null. */ diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java index d0dc21e729..7bc3ac3bf9 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2011 Ericsson + * Copyright (c) 2011, 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 @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis - Implementation and Initial API + * Mathieu Denis - Implementation and Initial API *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.statistics.model; @@ -40,31 +40,37 @@ public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider { * Contains the list of the columns */ protected List fColumnData = null; + /** * Level column names */ protected final static String LEVEL_COLUMN = Messages.TmfStatisticsView_LevelColumn; + /** * Number of events column names */ protected final static String EVENTS_COUNT_COLUMN = Messages.TmfStatisticsView_NbEventsColumn; + /** * Level column tooltips */ protected final static String LEVEL_COLUMN_TIP = Messages.TmfStatisticsView_LevelColumnTip; + /** * Number of events column tooltips */ protected final static String EVENTS_COUNT_COLUMN_TIP = Messages.TmfStatisticsView_NbEventsTip; + /** * Level for which statistics should not be displayed. */ protected Set fFolderLevels = new HashSet(Arrays.asList(new String[] { "Event Types" })); //$NON-NLS-1$ + /** * Create basic columns to represent the statistics data */ public TmfBaseColumnDataProvider() { - // List that will be used to create the table. + /* List that will be used to create the table. */ fColumnData = new Vector(); fColumnData.add(new TmfBaseColumnData(LEVEL_COLUMN, 200, SWT.LEFT, LEVEL_COLUMN_TIP, new ColumnLabelProvider() { @Override diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseStatisticsTree.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseStatisticsTree.java index 10803abb08..5e835a49d1 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseStatisticsTree.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseStatisticsTree.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation + * Mathieu Denis - Initial API and Implementation *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.statistics.model; @@ -34,21 +34,19 @@ import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo; public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree { /** - *

    Header for the event types categories.

    + * Header for the event types categories. */ public static final String HEADER_EVENT_TYPES = Messages.TmfStatisticsData_EventTypes; /** - *

    Indicate that it's a value.

    - *

    + * Indicate that it's a value. + * * Used when checking the possible child node for a node. - *

    - * * - *

    + * * It differentiate a category of a value by being appended to a value. - *

    */ protected static final String NODE = "z"; //$NON-NLS-1$ + /** * Root node key. */ @@ -82,6 +80,7 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree { /* * (non-Javadoc) + * * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#getChildren(org.eclipse.linuxtools.tmf.util.TmfFixedArray) */ @Override @@ -119,6 +118,7 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree { /* * (non-Javadoc) + * * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#getAllChildren(org.eclipse.linuxtools.tmf.util.TmfFixedArray) */ @Override @@ -154,7 +154,7 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree { } /** - *

    Get the event types paths.

    + * Get the event types paths. * * @param event * Event to get the path for. @@ -175,7 +175,7 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree { } /** - *

    Get the standard paths for an event.

    + * Get the standard paths for an event. * * @param event * Event to get the path for. @@ -193,6 +193,7 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree { /* * (non-Javadoc) + * * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#increase(org.eclipse.linuxtools.tmf.event.TmfEvent, org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfEventInfo, int) */ @Override @@ -202,6 +203,7 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree { /* * (non-Javadoc) + * * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#registerEvent(org.eclipse.linuxtools.tmf.event.TmfEvent, org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfEventInfo) */ @Override @@ -219,8 +221,8 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree { /* * (non-Javadoc) - * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#registerName - * (org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfFixedArray) + * + * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.AbsTmfStatisticsTree#registerName(org.eclipse.linuxtools.tmf.core.util.TmfFixedArray) */ @Override protected void registerName(TmfFixedArray path) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatistics.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatistics.java index 52aa1a2716..b5d0f284a1 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatistics.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatistics.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Intial API and Implementation + * Mathieu Denis - Intial API and Implementation *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.statistics.model; @@ -15,15 +15,15 @@ package org.eclipse.linuxtools.tmf.ui.views.statistics.model; /** * Primitive container for Statistics data * - * Contains information about statistics that can be retrieved with any type - * of traces + * Contains information about statistics that can be retrieved with any type of + * traces * * @version 1.0 * @author Mathieu Denis */ public class TmfStatistics { - /** - *

    Number of event

    - */ - public long nbEvents = 0; + /** + * Number of events. + */ + public long nbEvents = 0; } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeNode.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeNode.java index f56e6a7d9d..bfc1de29f7 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeNode.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeNode.java @@ -7,9 +7,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Yann N. Dauphin (dhaemon@gmail.com) - Implementation for stats - * Francois Godin (copelnug@gmail.com) - Re-design for new stats structure - * Mathieu Denis (mathieu.denis@polymtl.ca) - Re-design for new stats structure (2) + * Yann N. Dauphin - Implementation for stats + * Francois Godin - Re-design for new stats structure + * Mathieu Denis - Re-design for new stats structure (2) *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.statistics.model; @@ -21,108 +21,137 @@ import org.eclipse.linuxtools.tmf.core.util.TmfFixedArray; /** * A tree where nodes can be accessed efficiently using paths. * - * It works like file systems. Each node is identified by a key. A path is - * an array ({@link TmfFixedArray}) of String. The elements of the array - * represent the path from the root to this node. + * It works like file systems. Each node is identified by a key. A path is an + * array ({@link TmfFixedArray}) of String. The elements of the array represent + * the path from the root to this node. * * @version 1.0 * @author Mathieu Denis */ public class TmfStatisticsTreeNode { - /** - *

    Value of the node.

    - */ + + /** + * Value of the node. + */ protected TmfStatistics fValue; - /** - *

    Path of the node.

    - */ + + /** + * Path of the node. + */ protected TmfFixedArray fPath; - /** - *

    Corresponding StatisticsData.

    - */ + + /** + * Corresponding StatisticsData. + */ protected AbsTmfStatisticsTree fNodes; - /** - *

    Constructor.

    - * @param path Path to the node. - * @param nodes Corresponding StatisticsData. - */ - public TmfStatisticsTreeNode(final TmfFixedArray path, AbsTmfStatisticsTree nodes) { - fPath = path; - fNodes = nodes; - fValue = new TmfStatistics(); - } - /** - *

    Test if a node contain the specified child.

    - * @param key Name of the child. - * @return true: if child with given key is present, false: if no child exists with given key name - */ - public boolean containsChild(String key) { - if(AbsTmfStatisticsTree.ROOT.equals(fPath)) { + + /** + * Constructor. + * + * @param path + * Path to the node. + * @param nodes + * Corresponding StatisticsData. + */ + public TmfStatisticsTreeNode(final TmfFixedArray path, AbsTmfStatisticsTree nodes) { + fPath = path; + fNodes = nodes; + fValue = new TmfStatistics(); + } + + /** + * Test if a node contain the specified child. + * + * @param key + * Name of the child. + * @return true: if child with given key is present, false: if no child + * exists with given key name + */ + public boolean containsChild(String key) { + if (AbsTmfStatisticsTree.ROOT.equals(fPath)) { return fNodes.get(new TmfFixedArray(key)) != null; } - return (fNodes.get(fPath.append(key)) != null); - } - /** - *

    Get the children of this node.

    - * @return Direct children of this node. - */ - public Collection getChildren() { - return fNodes.getChildren(fPath); - } - /** - *

    Get the children of this node.

    + return (fNodes.get(fPath.append(key)) != null); + } + + /** + * Get the children of this node. + * + * @return Direct children of this node. + */ + public Collection getChildren() { + return fNodes.getChildren(fPath); + } + + /** + * Get the children of this node. + * * @return Direct children of this node. */ public Collection getAllChildren() { return fNodes.getAllChildren(fPath); } - /** - *

    Get the key for this node.

    - * @return Key associated with this node. - */ - public String getKey() { - return fPath.get(fPath.size() - 1); - } - /** - *

    Get the number of children this node have.

    - * @return Number of direct children of this node. - */ - public int getNbChildren() { - return fNodes.getChildren(fPath).size(); - } - /** - *

    Return the parent node.

    - * @return Parent node. - */ - public TmfStatisticsTreeNode getParent() { - return fNodes.getParent(fPath); - } - /** - *

    Get the path of the node.

    - * @return The path of the node. - */ - public TmfFixedArray getPath() { - return fPath; - } - /** - *

    Get the value of this node.

    - * @return Value associated with this node. - */ - public TmfStatistics getValue() { - return fValue; - } - /** - *

    Indicate if the node have children.

    - * @return True if the node has children. - */ - public boolean hasChildren() { - return !fNodes.getChildren(fPath).isEmpty(); - } - /** - *

    Start from creation time i.e. keep key and parent but new statistics and no children.

    - */ - public void reset() { - fValue = new TmfStatistics(); - fNodes.reset(fPath); - } -} \ No newline at end of file + + /** + * Get the key for this node. + * + * @return Key associated with this node. + */ + public String getKey() { + return fPath.get(fPath.size() - 1); + } + + /** + * Get the number of children this node have. + * + * @return Number of direct children of this node. + */ + public int getNbChildren() { + return fNodes.getChildren(fPath).size(); + } + + /** + * Return the parent node. + * + * @return Parent node. + */ + public TmfStatisticsTreeNode getParent() { + return fNodes.getParent(fPath); + } + + /** + * Get the path of the node. + * + * @return The path of the node. + */ + public TmfFixedArray getPath() { + return fPath; + } + + /** + * Get the value of this node. + * + * @return Value associated with this node. + */ + public TmfStatistics getValue() { + return fValue; + } + + /** + * Indicate if the node have children. + * + * @return True if the node has children. + */ + public boolean hasChildren() { + return !fNodes.getChildren(fPath).isEmpty(); + } + + /** + * Start from creation time i.e. keep key and parent but new statistics and + * no children. + */ + public void reset() { + fValue = new TmfStatistics(); + fNodes.reset(fPath); + } +} diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeRootFactory.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeRootFactory.java index 1c90f0c5bc..ff8d2f49e1 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeRootFactory.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeRootFactory.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API + * Mathieu Denis - Initial API *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.statistics.model; @@ -18,8 +18,8 @@ import java.util.Map; /** * Factory class to create and store TMF statistic trees. * - * Based on a given tree node ID a TMF statistic tree is stored internally. - * A root node is created for each tree. Using the tree node ID the statistics + * Based on a given tree node ID a TMF statistic tree is stored internally. A + * root node is created for each tree. Using the tree node ID the statistics * tree can be retrieved. * * @version 1.0 @@ -28,18 +28,11 @@ import java.util.Map; */ public class TmfStatisticsTreeRootFactory { - // ----------------------------------------------------------------------- - // Data - // ----------------------------------------------------------------------- /** * Contains the experiment name as the key and the traces data */ private static final Map fTreeInstances = new HashMap(); - // ----------------------------------------------------------------------- - // Methods - // ----------------------------------------------------------------------- - /** * Provide a statisticsTree instance per trace * diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfTreeContentProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfTreeContentProvider.java index 7174b3c914..614be4fcee 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfTreeContentProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfTreeContentProvider.java @@ -1,13 +1,13 @@ /******************************************************************************* * Copyright (c) 2011, 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: - * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API + * Mathieu Denis - Initial API *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.statistics.model; @@ -17,7 +17,7 @@ import org.eclipse.jface.viewers.Viewer; /** * Adapter TreeViewers can use to interact with StatisticsTreeNode objects. - * + * * @version 1.0 * @author Mathieu Denis * @see org.eclipse.jface.viewers.ITreeContentProvider @@ -25,7 +25,7 @@ import org.eclipse.jface.viewers.Viewer; public class TmfTreeContentProvider implements ITreeContentProvider { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) */ @Override @@ -35,7 +35,7 @@ public class TmfTreeContentProvider implements ITreeContentProvider { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) */ @Override @@ -45,7 +45,7 @@ public class TmfTreeContentProvider implements ITreeContentProvider { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) */ @Override @@ -55,7 +55,7 @@ public class TmfTreeContentProvider implements ITreeContentProvider { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) */ @Override @@ -65,7 +65,7 @@ public class TmfTreeContentProvider implements ITreeContentProvider { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.viewers.IContentProvider#dispose() */ @Override @@ -74,7 +74,7 @@ public class TmfTreeContentProvider implements ITreeContentProvider { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ @Override -- 2.34.1