instead of a static array.
Because of the upcoming AbstractTimeGraphEntry and its subclasses,
we will now need to specify the exact class in each view's
.getChildren(). This is not possible to do with an array if we use
a generic type (e.g. E[]), we have to use a Collection like List<E>.
Change-Id: Icf858b471a95ea7d68e6b6b2169afdc35922545a
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/7747
Tested-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
IP-Clean: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
}
@Override
- public ControlFlowEntry[] getChildren() {
- return fChildren.toArray(new ControlFlowEntry[0]);
+ public List<ControlFlowEntry> getChildren() {
+ return fChildren;
}
@Override
@Override
public Object[] getChildren(Object parentElement) {
ITimeGraphEntry entry = (ITimeGraphEntry) parentElement;
- return entry.getChildren();
+ List<? extends ITimeGraphEntry> children = entry.getChildren();
+ return children.toArray(new ITimeGraphEntry[children.size()]);
}
@Override
private final int fQuark;
private final CtfKernelTrace fTrace;
private ITimeGraphEntry fParent = null;
- private final ITimeGraphEntry[] children = null;
+ private final List<ITimeGraphEntry> children = null;
private final String fName;
private final Type fType;
private final int fId;
@Override
public boolean hasChildren() {
- return children != null && children.length > 0;
+ return children != null && children.size() > 0;
}
@Override
- public ITimeGraphEntry[] getChildren() {
+ public List<ITimeGraphEntry> getChildren() {
return children;
}
}
@Override
- public ResourcesEntry[] getChildren() {
- return fChildren.toArray(new ResourcesEntry[0]);
+ public List<ResourcesEntry> getChildren() {
+ return fChildren;
}
@Override
package org.eclipse.linuxtools.tmf.ui.widgets.timegraph.test.stub.model;
import java.util.Iterator;
+import java.util.List;
import java.util.Vector;
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
}
@Override
- public ITimeGraphEntry[] getChildren() {
+ public List<ITimeGraphEntry> getChildren() {
return null;
}
package org.eclipse.linuxtools.tmf.ui.views.timechart;
import java.util.Iterator;
+import java.util.List;
import java.util.NoSuchElementException;
import java.util.Vector;
fTraceEvents = new Vector<TimeChartEvent>(modelSize);
}
+ /**
+ * @since 2.0
+ */
@Override
- public ITimeGraphEntry[] getChildren() {
+ public List<ITimeGraphEntry> getChildren() {
return null;
}
package org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model;
import java.util.Iterator;
+import java.util.List;
/**
* Interface for an entry (row) in the time graph view
* Returns the child elements of this entry.
*
* @return an array of child elements
+ * @since 2.0
*/
- public ITimeGraphEntry[] getChildren();
+ public List<? extends ITimeGraphEntry> getChildren();
/**
* Returns the name of this entry.