* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial design and implementation
*******************************************************************************/
package org.eclipse.linuxtools.tmf.core.tests.util;
/**
* <b><u>TmfFixedArrayTest</u></b>
- * <p>
+ *
* Implement me. Please.
- * <p>
*/
-@SuppressWarnings({"nls","javadoc"})
+@SuppressWarnings({ "nls", "javadoc" })
public class TmfFixedArrayTest extends TestCase {
// ------------------------------------------------------------------------
fString4 = "Fourth String";
fString5 = "Fifth String";
fFixedArray1 = new TmfFixedArray<String>(fString1, fString2, fString3);
- fFixedArray2 = new TmfFixedArray<String>(); // Empty array at the beginning
+ // Empty array at the beginning
+ fFixedArray2 = new TmfFixedArray<String>();
}
@Override
try {
fFixedArray2.get(0);
fail();
- }
- catch (ArrayIndexOutOfBoundsException e) {
+ } catch (ArrayIndexOutOfBoundsException e) {
// Success
}
}
assertTrue("append", fString4.equals(fixedArray.get(3)));
}
-
@SuppressWarnings("unchecked")
public void testAppendFixedArray() {
TmfFixedArray<String> fixedArrayToAppend1 = new TmfFixedArray<String>(fString4);
TmfFixedArray<String> fixedArrayToAppend2 = new TmfFixedArray<String>(fString5);
- TmfFixedArray<String> fixedArray = new TmfFixedArray<String>();
+ TmfFixedArray<String> fixedArray = new TmfFixedArray<String>();
fixedArray = fixedArray.append(fFixedArray1, fixedArrayToAppend1);
assertEquals("append", 4, fixedArray.size());
// ------------------------------------------------------------------------
public void testToArray() {
- String[] expected1 = {fString1, fString2, fString3};
+ String[] expected1 = { fString1, fString2, fString3 };
assertTrue("toArray", Arrays.equals(expected1, fFixedArray1.toArray()));
String[] expected2 = {};
fFixedArray1.toArray(stringBigArray);
assertNull("toArrayArg", stringBigArray[3]);
- TmfFixedArray<Object> fFixedArrayObject = new TmfFixedArray<Object>(fString1);
+ TmfFixedArray<Object> fFixedArrayObject = new TmfFixedArray<Object>(fString1);
stringArray = fFixedArrayObject.toArray(new String[0]);
assertTrue("toArrayArg", stringArray[0].equals(fString1));
}
* 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 <copelnug@gmail.com> - Initial design and implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Correction and refactoring
*******************************************************************************/
package org.eclipse.linuxtools.tmf.core.util;
import java.util.RandomAccess;
/**
- * <h4>Allow to create a List object that contain an already existing array.</h4>
- * <p>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 :
* <ul>
- * <li>{@link #hashCode()}</li>
- * <li>{@link #equals(Object)}</li>
- * </ul></p>
- * <p>Those functions allow to use the FixedArray as the key of a {@link java.util.HashMap}.</p>
+ * <li>{@link #hashCode()}</li>
+ * <li>{@link #equals(Object)}</li>
+ * </ul>
+ * Those functions allow to use the FixedArray as the key of a
+ * {@link java.util.HashMap}.
*
* @version 1.0
* @author Francois Godin
*
- * @param <T> Type of the array content.
+ * @param <T>
+ * Type of the array content.
*/
public final class TmfFixedArray<T> extends AbstractList<T> implements RandomAccess, Cloneable {
/**
- * Replace {@link java.util.Arrays#copyOf(Object[], int)} that do not exist in java 5.
- * @param <E> 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 <E>
+ * 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> 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 <E> 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 <E>
+ * 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, U> E[] copyOf(final U[] array, int newLength, Class<? extends E[]> newType) {
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 <E> 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 <E>
+ * 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> 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<T> append(final TmfFixedArray<T> value) {
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<T> append(final TmfFixedArray<T>... values) {
int newLength = 0;
- for(TmfFixedArray<T> value : values) {
+ for (TmfFixedArray<T> value : values) {
newLength += value.size();
}
TmfFixedArray<T> result = new TmfFixedArray<T>(copyOf(fArray, fArray.length + newLength));
newLength = fArray.length;
- for(TmfFixedArray<T> value : values)
- {
+ for (TmfFixedArray<T> 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<T> append(final T value) {
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<T> append(final T... values) {
TmfFixedArray<T> result = new TmfFixedArray<T>(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<T>(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
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<T> subArray(int start) {
return new TmfFixedArray<T>(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<T> subArray(int start, int length) {
return new TmfFixedArray<T>(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> E[] toArray(E[] array)
- {
- if(array.length < fArray.length) {
- return copyOf(fArray, fArray.length,(Class<? extends E[]>)array.getClass());
+ public <E> E[] toArray(E[] array) {
+ if (array.length < fArray.length) {
+ return copyOf(fArray, fArray.length, (Class<? extends E[]>) 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
* Contributors:
* Bernd Hufmann - Initial API and implementation
* Bernd Hufmann - Add UML2SD tests
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Add Statistics test
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Add Statistics test
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.tests;
/**
* <b><u>AllTmfUITests</u></b>
- * <p>
+ *
* Master test suite for TMF UI Core.
*/
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;
+ }
}
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API and Implementation
* Bernd Hufmann - Fixed suite name
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.tests.statistics;
/**
* @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;
+ }
+}
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API and Implementation
* Bernd Hufmann - Fixed header and warnings
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.tests.statistics;
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));
}
}
}
-}
\ No newline at end of file
+}
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial design and implementation
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.tests.statistics;
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial design and implementation
* Bernd Hufmann - Fixed warnings
*******************************************************************************/
// ------------------------------------------------------------------------
// Fields
// ------------------------------------------------------------------------
- private String fTestName = null;
+ private String fTestName = null;
private final String fContext = "UnitTest";
private final String fTypeId1 = "Some type1";
// ------------------------------------------------------------------------
/**
- * @param name of the test
+ * @param name
+ * Test name
*/
public TmfBaseStatisticsDataTest(final String name) {
super(name);
temp = iterChild.next();
if (keyExpected.contains(temp.getKey())) {
keyExpected.removeElement(temp.getKey());
- }
- else {
+ } else {
fail();
}
}
Vector<String> keyExpected = new Vector<String>();
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<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString())).reset();
// Getting children of a category
childrenTreeNode = fStatsData.get(treeNode.getPath()).getAllChildren();
temp = iterChild.next();
if (keyExpected.contains(temp.getKey())) {
keyExpected.removeElement(temp.getKey());
- }
- else {
+ } else {
fail();
}
}
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);
}
}
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial design and implementation
* Bernd Hufmann - Fixed warnings
*******************************************************************************/
// ------------------------------------------------------------------------
/**
- * @param name of the test
+ * @param name
+ * Test name
*/
public TmfStatisticsTreeNodeTest(final String name) {
super(name);
// 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));
}
temp = iterChild.next();
if (keyExpected.contains(temp.getKey())) {
keyExpected.removeElement(temp.getKey());
- }
- else {
+ } else {
fail();
}
}
Vector<String> keyExpected = new Vector<String>();
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<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString())).reset();
// Getting children of a category
childrenTreeNode = treeNode.getAllChildren();
temp = iterChild.next();
if (keyExpected.contains(temp.getKey())) {
keyExpected.removeElement(temp.getKey());
- }
- else {
+ } else {
fail();
}
}
// ------------------------------------------------------------------------
// GetNbChildren
// ------------------------------------------------------------------------
+
/**
* Test getting of number of children.
*/
TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next();
TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray<String>(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());
}
TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next();
TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray<String>(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());
}
// ------------------------------------------------------------------------
// GetKey
// ------------------------------------------------------------------------
+
/**
* Test getting of key.
*/
TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next();
TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray<String>(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()));
}
TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next();
TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString()));
- assertTrue("getPath", rootNode.getPath().equals(AbsTmfStatisticsTree.ROOT));
- assertTrue("getPath", traceNode.getPath().equals(new TmfFixedArray<String>(fTestName)));
- assertTrue("getPath", catNode.getPath().equals(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes)));
+ assertTrue("getPath", rootNode.getPath().equals(AbsTmfStatisticsTree.ROOT));
+ assertTrue("getPath", traceNode.getPath().equals(new TmfFixedArray<String>(fTestName)));
+ assertTrue("getPath", catNode.getPath().equals(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes)));
assertTrue("getPath", elementNode.getPath().equals(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString())));
}
TmfStatisticsTreeNode elementNode1 = fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString()));
TmfStatisticsTreeNode elementNode2 = fStatsData.get(new TmfFixedArray<String>(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);
}
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial design and implementation
* Bernd Hufmann - Fixed warnings
*******************************************************************************/
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial design and implementation
* Bernd Hufmann - Fixed warnings
*******************************************************************************/
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial design and implementation
* Bernd Hufmann - Changed interface and class name
*******************************************************************************/
/**
* Returns the trace name.
+ *
* @return the name of the trace.
*/
public String getTraceName();
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API and Implementation
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics;
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Generalized version based on LTTng
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Generalized version based on LTTng
* Bernd Hufmann - Updated to use trace reference in TmfEvent and streaming
*
*******************************************************************************/
/**
* 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.
- * </p>
+ * 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.
*/
/*
* (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) {
// 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
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();
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.part.WorkbenchPart#setFocus()
*/
@Override
* 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
/**
* 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) {
}
/**
- * 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) {
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)) {
/**
* 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;
}
}
/**
- * 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;
}
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());
}
}
/**
- * 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.
*/
}
/**
- * 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.
*/
}
/**
- * Constructs the ID based on the experiment name and <code>fInstanceNb</code>
+ * Constructs the ID based on the experiment name and
+ * <code>fInstanceNb</code>
*
- * @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) {
}
/**
- * 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())) {
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;
}
/**
- * 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;
}
}
/**
- * 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;
import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo;
/**
- * <h4>Base class for the statistics storage.</h4>
- * <p>
- * 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.
- * </p>
+ * 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 {
/**
- * <h4>String builder used to merge string with more efficacy.</h4>
+ * String builder used to merge string with more efficiency.
*/
protected static final StringBuilder fBuilder = new StringBuilder();
+
/**
- * <h4>Identification of the root.</h4>
+ * Identification of the root.
*/
public static final TmfFixedArray<String> ROOT = new TmfFixedArray<String>("root"); //$NON-NLS-1$
/**
- * <h4>Function to merge many string with more efficacy.</h4>
+ * Function to merge many string with more efficiency.
*
* @param strings
* Strings to merge.
for (String s : strings) {
fBuilder.append(s);
}
- return fBuilder.toString();
+ return fBuilder.toString();
}
/**
- * <h4>Define what child a node can have.</h4>
- * <p>
- * The management and usage of this map is done by subclass.
- * </p>
- * <p>
- * HashSet are always faster than TreeSet.
- * </p>
+ * 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<String, Set<String>> fKeys;
+
/**
- * <h4>The nodes in the tree.</f4>
+ * The nodes in the tree.
*/
protected HashMap<TmfFixedArray<String>, TmfStatisticsTreeNode> fNodes;
/**
- * <h4>Constructor.</h4>
+ * Constructor.
*/
public AbsTmfStatisticsTree() {
fNodes = new HashMap<TmfFixedArray<String>, TmfStatisticsTreeNode>();
}
/**
- * <h4>Get a node.</h4>
+ * Get a node.
*
* @param path
* Path to the node.
}
/**
- * <h4>Get the children of a node.</h4>
+ * Get the children of a node.
*
* @param path
* Path to the node.
public abstract Collection<TmfStatisticsTreeNode> getChildren(final TmfFixedArray<String> path);
/**
- * <h4>Get every children of a node, even if it doesn't have any registered events, as opposed to getChildren</h4>
+ * 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.
public abstract Collection<TmfStatisticsTreeNode> getAllChildren(final TmfFixedArray<String> path);
/**
- * <h4>Get the map of existing elements of path classified by parent.</h4>
+ * Get the map of existing elements of path classified by parent.
*
* @return The map.
*/
}
/**
- * <h4>Get or create a node.</h4>
+ * Get or create a node.
*
* @param path
* Path to the node.
}
/**
- * <h4>Get the parent of a node.</h4>
+ * Get the parent of a node.
*
* @param path
* Path to the node.
}
/**
- * <h4>Increase any kind of counter.</h4>
- * <p>
- * This method must be implemented by subclass.
- * </p>
+ * Increase any kind of counter.
+ *
+ * This method must be implemented by subclasses.
+ *
* @param event
* Current event.
* @param extraInfo
public abstract void increase(ITmfEvent event, ITmfExtraEventInfo extraInfo, int values);
/**
- * <h4>Register an event.</h4>
- * <p>
- * This method must be implemented by subclass.
- * </p>
+ * Register an event.
+ *
+ * This method must be implemented by subclasses.
+ *
* @param event
* Current event.
* @param extraInfo
public abstract void registerEvent(ITmfEvent event, ITmfExtraEventInfo extraInfo);
/**
- * <h4>Register that a new node was created.</h4>
- * <p>
+ * Register that a new node was created.
+ *
* Must make sure the {@link #getChildren(TmfFixedArray)} on the parent node
* will return the newly created node.
- * </p>
*
* @param path
* Path of the new node.
protected abstract void registerName(final TmfFixedArray<String> path);
/**
- * <h4>Reset a node.</h4>
- * <p>
+ * Reset a node.
+ *
* Work recursively.
- * </p>
*
* @param path
* Path to the node.
/*******************************************************************************
* 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 <mathieu.denis@polymtl.ca> - Initial API and Implementation
*******************************************************************************/
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 <code>TmfStatisticsView</code> 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
+ * <code>TmfStatisticsView</code> 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<TmfBaseColumnData> getColumnData();
/*******************************************************************************
* 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 <mathieu.denis@polymtl.ca> - Initial API and Implementation
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
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();
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API and Implementation
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
* @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.
*/
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial Implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial Implementation
* Bernd Hufmann - Added Annotations
*******************************************************************************/
* 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.
*/
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis <mathieu.denis@polymtl.ca> - Implementation and Initial API
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Implementation and Initial API
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
* Contains the list of the columns
*/
protected List<TmfBaseColumnData> 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<String> fFolderLevels = new HashSet<String>(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<TmfBaseColumnData>();
fColumnData.add(new TmfBaseColumnData(LEVEL_COLUMN, 200, SWT.LEFT, LEVEL_COLUMN_TIP, new ColumnLabelProvider() {
@Override
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API and Implementation
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree {
/**
- * <h4>Header for the event types categories.</h4>
+ * Header for the event types categories.
*/
public static final String HEADER_EVENT_TYPES = Messages.TmfStatisticsData_EventTypes;
/**
- * <h4>Indicate that it's a value.</h4>
- * <p>
+ * Indicate that it's a value.
+ *
* Used when checking the possible child node for a node.
- * </p>
- * *
- * <p>
+ *
* It differentiate a category of a value by being appended to a value.
- * </p>
*/
protected static final String NODE = "z"; //$NON-NLS-1$
+
/**
* Root node key.
*/
/*
* (non-Javadoc)
+ *
* @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#getChildren(org.eclipse.linuxtools.tmf.util.TmfFixedArray)
*/
@Override
/*
* (non-Javadoc)
+ *
* @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#getAllChildren(org.eclipse.linuxtools.tmf.util.TmfFixedArray)
*/
@Override
}
/**
- * <h4>Get the event types paths.</h4>
+ * Get the event types paths.
*
* @param event
* Event to get the path for.
}
/**
- * <h4>Get the standard paths for an event.</h4>
+ * Get the standard paths for an event.
*
* @param event
* Event to get the path for.
/*
* (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
/*
* (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
/*
* (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<String> path) {
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Intial API and Implementation
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Intial API and Implementation
*******************************************************************************/
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 {
- /**
- * <h4>Number of event</h4>
- */
- public long nbEvents = 0;
+ /**
+ * Number of events.
+ */
+ public long nbEvents = 0;
}
* 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 <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)
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
/**
* 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 {
- /**
- * <h4>Value of the node.</h4>
- */
+
+ /**
+ * Value of the node.
+ */
protected TmfStatistics fValue;
- /**
- * <h4>Path of the node.</h4>
- */
+
+ /**
+ * Path of the node.
+ */
protected TmfFixedArray<String> fPath;
- /**
- * <h2>Corresponding StatisticsData.</h2>
- */
+
+ /**
+ * Corresponding StatisticsData.
+ */
protected AbsTmfStatisticsTree fNodes;
- /**
- * <h4>Constructor.</h4>
- * @param path Path to the node.
- * @param nodes Corresponding StatisticsData.
- */
- public TmfStatisticsTreeNode(final TmfFixedArray<String> path, AbsTmfStatisticsTree nodes) {
- fPath = path;
- fNodes = nodes;
- fValue = new TmfStatistics();
- }
- /**
- * <h4>Test if a node contain the specified child.</h4>
- * @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<String> 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<String>(key)) != null;
}
- return (fNodes.get(fPath.append(key)) != null);
- }
- /**
- * <h4>Get the children of this node.</h4>
- * @return Direct children of this node.
- */
- public Collection<TmfStatisticsTreeNode> getChildren() {
- return fNodes.getChildren(fPath);
- }
- /**
- * <h4>Get the children of this node.</h4>
+ return (fNodes.get(fPath.append(key)) != null);
+ }
+
+ /**
+ * Get the children of this node.
+ *
+ * @return Direct children of this node.
+ */
+ public Collection<TmfStatisticsTreeNode> getChildren() {
+ return fNodes.getChildren(fPath);
+ }
+
+ /**
+ * Get the children of this node.
+ *
* @return Direct children of this node.
*/
public Collection<TmfStatisticsTreeNode> getAllChildren() {
return fNodes.getAllChildren(fPath);
}
- /**
- * <h4>Get the key for this node.</h4>
- * @return Key associated with this node.
- */
- public String getKey() {
- return fPath.get(fPath.size() - 1);
- }
- /**
- * <h4>Get the number of children this node have.</h4>
- * @return Number of direct children of this node.
- */
- public int getNbChildren() {
- return fNodes.getChildren(fPath).size();
- }
- /**
- * <h4>Return the parent node.</h4>
- * @return Parent node.
- */
- public TmfStatisticsTreeNode getParent() {
- return fNodes.getParent(fPath);
- }
- /**
- * <h4>Get the path of the node.</h4>
- * @return The path of the node.
- */
- public TmfFixedArray<String> getPath() {
- return fPath;
- }
- /**
- * <h4>Get the value of this node.</h4>
- * @return Value associated with this node.
- */
- public TmfStatistics getValue() {
- return fValue;
- }
- /**
- * <h4>Indicate if the node have children.</h4>
- * @return True if the node has children.
- */
- public boolean hasChildren() {
- return !fNodes.getChildren(fPath).isEmpty();
- }
- /**
- * <h4>Start from creation time i.e. keep key and parent but new statistics and no children.</h4>
- */
- 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<String> 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);
+ }
+}
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
/**
* 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
*/
public class TmfStatisticsTreeRootFactory {
- // -----------------------------------------------------------------------
- // Data
- // -----------------------------------------------------------------------
/**
* Contains the experiment name as the key and the traces data
*/
private static final Map<String, AbsTmfStatisticsTree> fTreeInstances = new HashMap<String, AbsTmfStatisticsTree>();
- // -----------------------------------------------------------------------
- // Methods
- // -----------------------------------------------------------------------
-
/**
* Provide a statisticsTree instance per trace
*
/*******************************************************************************
* 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 <mathieu.denis@polymtl.ca> - Initial API
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
/**
* Adapter TreeViewers can use to interact with StatisticsTreeNode objects.
- *
+ *
* @version 1.0
* @author Mathieu Denis
* @see org.eclipse.jface.viewers.ITreeContentProvider
public class TmfTreeContentProvider implements ITreeContentProvider {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
@Override