* Constructor
*/
public TmfGraph() {
- fNodeMap = NonNullUtils.checkNotNull(ArrayListMultimap.<IGraphWorker, TmfVertex> create());
+ fNodeMap = NonNullUtils.checkNotNull(ArrayListMultimap.create());
fReverse = new HashMap<>();
}
COLUMN_PROCESS
};
- private final Table<ITmfTrace, Object, List<ILinkEvent>> fLinks = NonNullUtils.checkNotNull(HashBasedTable.<ITmfTrace, Object, List<ILinkEvent>> create());
+ private final Table<ITmfTrace, Object, List<ILinkEvent>> fLinks = NonNullUtils.checkNotNull(HashBasedTable.create());
/** The trace to entry list hash map */
- private final Table<ITmfTrace, Object, TmfGraphStatistics> fObjectStatistics = NonNullUtils.checkNotNull(HashBasedTable.<ITmfTrace, Object, TmfGraphStatistics> create());
+ private final Table<ITmfTrace, Object, TmfGraphStatistics> fObjectStatistics = NonNullUtils.checkNotNull(HashBasedTable.create());
private final CriticalPathContentProvider fContentProvider = new CriticalPathContentProvider();
private @Nullable Object fCurrentObject;
@Override
- public @Nullable ITimeGraphEntry[] getElements(@Nullable Object inputElement) {
+ public ITimeGraphEntry[] getElements(@Nullable Object inputElement) {
ITimeGraphEntry[] ret = new ITimeGraphEntry[0];
if (inputElement instanceof List) {
List<?> list = (List<?>) inputElement;
buildEntryList(worker);
entries = workerEntries.get(worker);
}
+
return (entries == null) ?
new ITimeGraphEntry[0] :
NonNullUtils.checkNotNull(entries.toArray(new ITimeGraphEntry[entries.size()]));
}
private @Nullable TmfGraph getGraph(final ITmfTrace trace) {
- CriticalPathModule module = Iterables.getFirst(TmfTraceUtils.getAnalysisModulesOfClass(trace, CriticalPathModule.class), null);
+ CriticalPathModule module = Iterables.<@Nullable CriticalPathModule> getFirst(
+ TmfTraceUtils.getAnalysisModulesOfClass(trace, CriticalPathModule.class),
+ null);
if (module == null) {
- return null;
+ throw new IllegalStateException();
}
+
module.schedule();
if (!module.waitForCompletion()) {
return null;
if (trace == null) {
return null;
}
- CriticalPathModule module = Iterables.getFirst(TmfTraceUtils.getAnalysisModulesOfClass(trace, CriticalPathModule.class), null);
+ CriticalPathModule module = Iterables.<@Nullable CriticalPathModule> getFirst(
+ TmfTraceUtils.getAnalysisModulesOfClass(trace, CriticalPathModule.class), null);
if (module == null) {
- return null;
+ throw new IllegalStateException();
}
+
final TmfGraph graph = module.getCriticalPath();
if (graph == null) {
return null;
redraw();
for (ITimeGraphEntry child : entry.getChildren()) {
- if (child == null) {
- throw new NullPointerException();
- }
buildStatusEvents(trace, (CriticalPathEntry) child);
}
}
if (thread > 0) {
break;
}
- if (trace == null) {
- continue;
- }
ITmfStateSystem ssq = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysisModule.ID);
if (ssq == null) {
continue;
return list;
}
for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) {
- if (trace == null) {
- continue;
- }
List<Integer> currentThreadQuarks = ss.getQuarks(Attributes.CPUS, "*", Attributes.CURRENT_THREAD); //$NON-NLS-1$
for (int currentThreadQuark : currentThreadQuarks) {
if (currentThreadQuark >= fullStates.get(0).size()) {
package org.eclipse.tracecompass.analysis.os.linux.ui.views.resources;
+import java.util.Iterator;
+
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.resources.SoftIrqLabelProvider;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
return Integer.compare(this.getId(), o.getId());
}
+ @Override
+ public Iterator<@NonNull ITimeEvent> getTimeEventsIterator() {
+ return super.getTimeEventsIterator();
+ }
+
}
Iterator<Entry<String, SegmentStoreStatistics>> stats = perSyscallStats.entrySet().iterator();
while (stats.hasNext()) {
Entry<String, SegmentStoreStatistics> statsEntry = stats.next();
- syscalls.addChild(new SegmentStoreStatisticsEntry(checkNotNull(statsEntry.getKey()), checkNotNull(statsEntry.getValue())));
+ syscalls.addChild(new SegmentStoreStatisticsEntry(statsEntry.getKey(), statsEntry.getValue()));
}
}
return root;
* @since 2.0
*/
public abstract class AbstractSegmentStoreScatterGraphViewer extends TmfCommonXLineChartViewer {
- private static final List<ISegment> EMPTY_LIST = NonNullUtils.checkNotNull(Collections.<ISegment> emptyList());
private final class CompactingSegmentStoreQuery extends Job {
private static final long MAX_POINTS = 1000;
final long endTimeInNanos = getTimeInNanos(fCurrentRange.getEndTime());
if (module == null) {
setWindowRange(startTimeInNanos, endTimeInNanos);
- redraw(statusMonitor, startTimeInNanos, startTimeInNanos, EMPTY_LIST);
+ redraw(statusMonitor, startTimeInNanos, startTimeInNanos, Collections.EMPTY_LIST);
return new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Analysis module not available"); //$NON-NLS-1$
}
final ISegmentStore<ISegment> results = module.getResults();
if (results == null) {
setWindowRange(startTimeInNanos, endTimeInNanos);
- redraw(statusMonitor, startTimeInNanos, startTimeInNanos, EMPTY_LIST);
+ redraw(statusMonitor, startTimeInNanos, startTimeInNanos, Collections.EMPTY_LIST);
return new Status(IStatus.INFO, Activator.PLUGIN_ID, "Analysis module does not have results"); //$NON-NLS-1$
}
continue;
}
if (statusMonitor.isCanceled()) {
- return NonNullUtils.checkNotNull(Collections.<ISegment> emptyList());
+ return Collections.EMPTY_LIST;
}
if (!overlaps(last, next)) {
displayData.add(next);
final List<ISegment> list = new ArrayList<>();
for (ISegment seg : iterable) {
if (statusMonitor.isCanceled()) {
- return NonNullUtils.checkNotNull(Collections.<ISegment> emptyList());
+ return Collections.EMPTY_LIST;
}
list.add(seg);
}
/**
* Data to display
*/
- private Collection<ISegment> fDisplayData = NonNullUtils.checkNotNull(Collections.<ISegment> emptyList());
+ private Collection<ISegment> fDisplayData = Collections.EMPTY_LIST;
/**
* Analysis completion listener
}
});
}
- fDisplayData = NonNullUtils.checkNotNull(Collections.EMPTY_LIST);
+ fDisplayData = Collections.EMPTY_LIST;
} else {
Collection<ISegment> elements = (Collection<ISegment>) dataInput.getIntersectingElements(currentStart, currentEnd);
// getIntersectingElements can return an unsorted iterable, make
/**
* Returns the segment store analysis module
+ *
* @param trace
* The trace to consider
* @return the analysis module
*/
protected @Nullable abstract AbstractSegmentStoreAnalysisModule getSegmentStoreAnalysisModule(ITmfTrace trace);
-
// ------------------------------------------------------------------------
// Signal handlers
// ------------------------------------------------------------------------
package org.eclipse.tracecompass.btf.core.trace;
-import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.btf.core.event.BtfEvent;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
*
* @author Alexandre Montplaisir
*/
+@NonNullByDefault
public final class BtfEventAspects {
private BtfEventAspects() {}
- private static final @NonNull Iterable<ITmfEventAspect> BTF_ASPECTS =
+ private static final Iterable<ITmfEventAspect> BTF_ASPECTS =
NonNullUtils.checkNotNull(ImmutableList.of(
ITmfEventAspect.BaseAspects.TIMESTAMP,
new BtfSourceAspect(),
}
@Override
- public String resolve(ITmfEvent event) {
+ public @Nullable String resolve(ITmfEvent event) {
if (!(event instanceof BtfEvent)) {
return EMPTY_STRING;
}
}
@Override
- public String resolve(ITmfEvent event) {
+ public @Nullable String resolve(ITmfEvent event) {
if (!(event instanceof BtfEvent)) {
return EMPTY_STRING;
}
*
* @return The aspects
*/
- public static @NonNull Iterable<ITmfEventAspect> getAspects() {
+ public static Iterable<ITmfEventAspect> getAspects() {
return BTF_ASPECTS;
}
}
\ No newline at end of file
private ArrayDefinition createLongArray() {
IntegerDeclaration decl = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "none", 8);
- List<Definition> defs = createIntDefs(10, 32);
+ List<@NonNull Definition> defs = createIntDefs(10, 32);
ArrayDefinition temp = setUpDeclaration(decl, defs);
return temp;
}
private ArrayDefinition createCharArray() {
IntegerDeclaration decl = IntegerDeclaration.createDeclaration(8, false, 10, ByteOrder.BIG_ENDIAN, Encoding.UTF8, "none", 8);
- List<Definition> defs = createIntDefs(4, 8);
+ List<@NonNull Definition> defs = createIntDefs(4, 8);
ArrayDefinition temp = setUpDeclaration(decl, defs);
return temp;
}
private ArrayDefinition createStringArray() {
StringDeclaration strDecl = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- List<Definition> defs = createDefs();
+ List<@NonNull Definition> defs = createDefs();
ArrayDefinition temp = setUpDeclaration(strDecl, defs);
return temp;
}
private ArrayDefinition setUpDeclaration(@NonNull IDeclaration decl,
- @NonNull List<Definition> defs) {
+ @NonNull List<@NonNull Definition> defs) {
CompoundDeclaration ad = new ArrayDeclaration(0, decl);
ArrayDefinition temp = new ArrayDefinition(ad, this.trace, "Testx", defs);
return temp;
}
- @NonNull
- private static List<Definition> createIntDefs(int size, int bits) {
- List<Definition> defs = new ArrayList<>(size);
+ private static @NonNull List<@NonNull Definition> createIntDefs(int size, int bits) {
+ List<@NonNull Definition> defs = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
String content = "test" + i;
defs.add(new IntegerDefinition(IntegerDeclaration.createDeclaration(bits, false,
return defs;
}
- @NonNull
- private static List<Definition> createDefs() {
+ private static @NonNull List<@NonNull Definition> createDefs() {
int size = 4;
- List<Definition> defs = new ArrayList<>();
+ List<@NonNull Definition> defs = new ArrayList<>();
for (int i = 0; i < size; i++) {
String content = "test" + i;
defs.add(new StringDefinition(
CompoundDeclaration declaration = (CompoundDeclaration) charArrayFixture.getDeclaration();
String fieldName = "";
- ArrayDefinition result = new ArrayDefinition(declaration, this.trace, fieldName, Arrays.asList(new Definition[0]));
+ ArrayDefinition result = new ArrayDefinition(declaration, this.trace, fieldName, Arrays.asList(new @NonNull Definition[0]));
assertNotNull(result);
}
IDefinitionScope definitionScope = getDefinitionScope();
String fieldName = "";
- ArrayDefinition result = new ArrayDefinition(declaration, definitionScope, fieldName, Arrays.asList(new Definition[0]));
+ ArrayDefinition result = new ArrayDefinition(declaration, definitionScope, fieldName, Arrays.asList(new @NonNull Definition[0]));
assertNotNull(result);
}
*/
@Test
public void testgetElem_withDefs() {
- List<Definition> defs = createDefs();
+ List<@NonNull Definition> defs = createDefs();
IDefinitionScope definitionScope = getDefinitionScope();
ArrayDefinition ad = new ArrayDefinition((CompoundDeclaration) charArrayFixture.getDeclaration(), definitionScope, "test", defs);
int j = 1;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
*
* @return The event declarations for this stream
*/
- public @NonNull Collection<IEventDeclaration> getEventDeclarations() {
- List<IEventDeclaration> retVal = new ArrayList<>(fEvents);
- retVal.removeAll(Collections.<IEventDeclaration> singletonList(null));
+ public @NonNull Collection<@NonNull IEventDeclaration> getEventDeclarations() {
+ List<@NonNull IEventDeclaration> retVal = new ArrayList<>();
+ for (IEventDeclaration eventDeclaration : fEvents) {
+ if (eventDeclaration != null) {
+ retVal.add(eventDeclaration);
+ }
+ }
return retVal;
}
return new ByteArrayDefinition(this, definitionScope, fieldName, data);
}
- @NonNull List<Definition> definitions = read(input, definitionScope, fieldName);
+ @NonNull List<@NonNull Definition> definitions = read(input, definitionScope, fieldName);
return new ArrayDefinition(this, definitionScope, fieldName, definitions);
}
package org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
import org.eclipse.tracecompass.ctf.core.CTFException;
if (top != null) {
if (!fCurLocation.equals(fPreviousLocation)) {
fPreviousLocation = fCurLocation;
- fPreviousEvent = fTrace.getEventFactory().createEvent(fTrace, top.getCurrentEvent(), top.getFilename());
+ fPreviousEvent = fTrace.getEventFactory().createEvent(fTrace, checkNotNull(top.getCurrentEvent()), top.getFilename());
}
return fPreviousEvent;
}
package org.eclipse.tracecompass.tmf.ctf.core.event;
-import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.ctf.core.CTFStrings;
import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
*
* @author Alexandre Montplaisir
*/
+@NonNullByDefault
public class CtfTmfEventFactory {
- private static final @NonNull CtfTmfEventFactory INSTANCE = new CtfTmfEventFactory();
+ private static final CtfTmfEventFactory INSTANCE = new CtfTmfEventFactory();
/**
* The file name to use when none is specified.
*
* @since 2.0
*/
- protected static final @NonNull String NO_STREAM = "No stream"; //$NON-NLS-1$
+ protected static final String NO_STREAM = "No stream"; //$NON-NLS-1$
/**
* Protected constructor, only for use by sub-classes. Users should call
* @return The instance
* @since 2.0
*/
- public static @NonNull CtfTmfEventFactory instance() {
+ public static CtfTmfEventFactory instance() {
return INSTANCE;
}
* @return The newly-built CtfTmfEvent
* @since 2.0
*/
- public CtfTmfEvent createEvent(CtfTmfTrace trace, EventDefinition eventDef, String fileName) {
+ public CtfTmfEvent createEvent(CtfTmfTrace trace, EventDefinition eventDef, @Nullable String fileName) {
/* Prepare what to pass to CtfTmfEvent's constructor */
final IEventDeclaration eventDecl = eventDef.getDeclaration();
int sourceCPU = eventDef.getCPU();
- String reference = fileName == null ? NO_STREAM : fileName;
+ String reference = (fileName == null ? NO_STREAM : fileName);
/* Handle the special case of lost events */
if (eventDecl.getName().equals(CTFStrings.LOST_EVENT_NAME)) {
* Event aspects available for all CTF traces
* @since 1.0
*/
- protected static final @NonNull Collection<ITmfEventAspect> CTF_ASPECTS =
+ protected static final @NonNull Collection<@NonNull ITmfEventAspect> CTF_ASPECTS =
checkNotNull(ImmutableList.of(
ITmfEventAspect.BaseAspects.TIMESTAMP,
new CtfChannelAspect(),
// Fields
// -------------------------------------------
- private final Map<String, CtfTmfEventType> fContainedEventTypes =
- Collections.synchronizedMap(new HashMap<String, CtfTmfEventType>());
+ private final Map<@NonNull String, @NonNull CtfTmfEventType> fContainedEventTypes =
+ Collections.synchronizedMap(new HashMap<>());
- private final CtfIteratorManager fIteratorManager =
- new CtfIteratorManager(this);
+ private final CtfIteratorManager fIteratorManager = new CtfIteratorManager(this);
private final @NonNull CtfTmfEventFactory fEventFactory;
* Gets the list of declared events
*/
@Override
- public Set<CtfTmfEventType> getContainedEventTypes() {
+ public Set<@NonNull CtfTmfEventType> getContainedEventTypes() {
return ImmutableSet.copyOf(fContainedEventTypes.values());
}
*/
public TraceEventHandlerExecutionGraph(LttngKernelExecGraphProvider provider) {
super(provider);
- fKernel = NonNullUtils.checkNotNull(HashBasedTable.<String, Integer, LttngWorker> create());
+ fKernel = NonNullUtils.checkNotNull(HashBasedTable.create());
fTcpNodes = new HashMap<>();
fMatchProcessing = new IMatchProcessingUnit() {
*/
public class LttngSystemModel {
- private final Table<String, Integer, HostThread> fCurrentTids = NonNullUtils.checkNotNull(HashBasedTable.<String, Integer, HostThread> create());
- private final Table<String, Integer, Stack<LttngInterruptContext>> fIntCtxStacks = NonNullUtils.checkNotNull(HashBasedTable.<String, Integer, Stack<LttngInterruptContext>> create());
+ private final Table<String, Integer, HostThread> fCurrentTids = NonNullUtils.checkNotNull(HashBasedTable.create());
+ private final Table<String, Integer, Stack<LttngInterruptContext>> fIntCtxStacks = NonNullUtils.checkNotNull(HashBasedTable.create());
private final Map<HostThread, LttngWorker> fWorkerMap = new HashMap<>();
/**
*/
public class VirtualCPU {
- private static final Table<VirtualMachine, Long, @Nullable VirtualCPU> VIRTUAL_CPU_TABLE = NonNullUtils.checkNotNull(HashBasedTable.<VirtualMachine, Long, VirtualCPU> create());
+ private static final Table<VirtualMachine, Long, @Nullable VirtualCPU> VIRTUAL_CPU_TABLE = NonNullUtils.checkNotNull(HashBasedTable.create());
private final VirtualMachine fVm;
private final Long fCpuId;
public class VirtualMachineCpuAnalysis extends TmfStateSystemAnalysisModule {
// TODO: Update with event layout when requirements are back */
- static final Set<String> REQUIRED_EVENTS = NonNullUtils.checkNotNull(ImmutableSet.<String> of(
+ static final Set<String> REQUIRED_EVENTS = NonNullUtils.checkNotNull(ImmutableSet.of(
// LttngStrings.SCHED_SWITCH
));
super(experiment, "Virtual Machine State Provider"); //$NON-NLS-1$
fModel = new QemuKvmVmModel(experiment);
- Table<ITmfTrace, String, @Nullable Integer> table = NonNullUtils.checkNotNull(HashBasedTable.<ITmfTrace, String, Integer> create());
+ Table<ITmfTrace, String, @Nullable Integer> table = NonNullUtils.checkNotNull(HashBasedTable.create());
fEventNames = table;
fLayouts = new HashMap<>();
}
import java.util.Collection;
import java.util.Map;
+import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventType;
import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTraceValidationStatus;
import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfUtils;
return LTTNG_KERNEL_ASPECTS;
}
+ /*
+ * Needs explicit @NonNull generic type annotation. Can be removed once this
+ * class becomes @NonNullByDefault.
+ */
+ @Override
+ public @NonNull Set<@NonNull CtfTmfEventType> getContainedEventTypes() {
+ return super.getContainedEventTypes();
+ }
+
}
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() {
// TODO specify actual requirements once the requirement-checking is
// implemented. This analysis needs "ip" and "vpid" contexts.
- return checkNotNull(Collections.EMPTY_SET);
+ return Collections.EMPTY_SET;
}
@Override
package org.eclipse.tracecompass.lttng2.ust.core.trace;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.ctf.core.CTFStrings;
import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
}
@Override
- public CtfTmfEvent createEvent(CtfTmfTrace trace, EventDefinition eventDef, String fileName) {
+ public CtfTmfEvent createEvent(CtfTmfTrace trace, EventDefinition eventDef, @Nullable String fileName) {
/* Prepare what to pass to CtfTmfEvent's constructor */
final IEventDeclaration eventDecl = eventDef.getDeclaration();
final long ts = eventDef.getTimestamp();
package org.eclipse.tracecompass.internal.pcap.core.protocol.ipv4;
import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.util.Arrays;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.pcap.core.packet.BadPacketException;
public Map<String, String> getFields() {
Map<String, String> map = fFields;
if (map == null) {
- Builder<String, String> builder = ImmutableMap.<String, String> builder()
+ Builder<@NonNull String, @NonNull String> builder = ImmutableMap.<@NonNull String, @NonNull String> builder()
.put("Version", String.valueOf(fVersion)) //$NON-NLS-1$
.put("Header Length", String.valueOf(getHeaderLength()) + " bytes") //$NON-NLS-1$ //$NON-NLS-2$
.put("Differentiated Services Field", String.format("%s%02x", "0x", fDSCP)) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
.put("Time to live", String.valueOf(fTimeToLive)) //$NON-NLS-1$
.put("Protocol", IPProtocolNumberHelper.toString(fIpDatagramProtocol) + " (" + String.valueOf(fIpDatagramProtocol) + ")") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
.put("Checksum", String.format("%s%04x", "0x", fHeaderChecksum)) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- .put("Source IP Address", fSourceIpAddress.getHostAddress()) //$NON-NLS-1$
- .put("Destination IP Address", fDestinationIpAddress.getHostAddress()); //$NON-NLS-1$
+ .put("Source IP Address", nullToEmptyString(fSourceIpAddress.getHostAddress())) //$NON-NLS-1$
+ .put("Destination IP Address", nullToEmptyString(fDestinationIpAddress.getHostAddress())); //$NON-NLS-1$
byte[] options = fOptions;
if (options == null) {
builder.put("Options", EMPTY_STRING); //$NON-NLS-1$
@Override
public PcapEndpoint getSourceEndpoint() {
- @Nullable PcapEndpoint endpoint = fSourceEndpoint;
+ PcapEndpoint endpoint = fSourceEndpoint;
if (endpoint == null) {
endpoint = new PcapEndpoint(this, true);
}
@Override
public PcapEndpoint getDestinationEndpoint() {
- @Nullable
PcapEndpoint endpoint = fDestinationEndpoint;
if (endpoint == null) {
public Map<String, String> getFields() {
Map<String, String> map = fFields;
if (map == null) {
- ImmutableMap.Builder<String, String> builder = ImmutableMap.<String, String> builder();
+ ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
builder.put("Frame", String.valueOf(fPacketIndex)); //$NON-NLS-1$
builder.put("Frame Length", String.valueOf(fOriginalLength) + " bytes"); //$NON-NLS-1$ //$NON-NLS-2$
builder.put("Capture Length", String.valueOf(fIncludedLength) + " bytes"); //$NON-NLS-1$ //$NON-NLS-2$
package org.eclipse.tracecompass.internal.tmf.pcap.core.trace;
import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
import java.io.IOException;
import java.nio.channels.ClosedChannelException;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.pcap.core.packet.BadPacketException;
import org.eclipse.tracecompass.internal.pcap.core.protocol.pcap.PcapPacket;
import org.eclipse.tracecompass.internal.pcap.core.trace.BadPcapFileException;
/** pcap trace type id as defined in plugin.xml */
public static final String TRACE_TYPE_ID = "org.eclipse.linuxtools.tmf.pcap.core.pcaptrace"; //$NON-NLS-1$
- private @NonNull static final Collection<ITmfEventAspect> PCAP_ASPECTS =
+ private static final Collection<ITmfEventAspect> PCAP_ASPECTS =
checkNotNull(ImmutableList.of(
ITmfEventAspect.BaseAspects.TIMESTAMP,
PcapSourceAspect.INSTANCE,
ITmfEventAspect.BaseAspects.CONTENTS
));
- private @NonNull static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private static final int CONFIDENCE = 50;
private @Nullable PcapFile fPcapFile;
private @Nullable Map<String, String> fTraceProperties = null;
public synchronized Map<String, String> getTraceProperties() {
PcapFile pcap = fPcapFile;
if (pcap == null) {
- return checkNotNull(Collections.<String, String> emptyMap());
+ return Collections.emptyMap();
}
Map<String, String> properties = fTraceProperties;
if (properties == null) {
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
- builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_Version), String.format("%d%c%d", pcap.getMajorVersion(), '.', pcap.getMinorVersion())); //$NON-NLS-1$
- builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_TimeZoneCorrection), pcap.getTimeZoneCorrection() + " s"); //$NON-NLS-1$
- builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_TimestampAccuracy), String.valueOf(pcap.getTimeAccuracy()));
- builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_MaxSnapLength), pcap.getSnapLength() + " bytes"); //$NON-NLS-1$
- builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_LinkLayerHeaderType), LinkTypeHelper.toString((int) pcap.getDataLinkType()) + " (" + pcap.getDataLinkType() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- builder.put(NonNullUtils.nullToEmptyString(Messages.PcapTrace_FileEndianness), pcap.getByteOrder().toString());
+ builder.put(nullToEmptyString(Messages.PcapTrace_Version), String.format("%d%c%d", pcap.getMajorVersion(), '.', pcap.getMinorVersion())); //$NON-NLS-1$
+ builder.put(nullToEmptyString(Messages.PcapTrace_TimeZoneCorrection), pcap.getTimeZoneCorrection() + " s"); //$NON-NLS-1$
+ builder.put(nullToEmptyString(Messages.PcapTrace_TimestampAccuracy), String.valueOf(pcap.getTimeAccuracy()));
+ builder.put(nullToEmptyString(Messages.PcapTrace_MaxSnapLength), pcap.getSnapLength() + " bytes"); //$NON-NLS-1$
+ builder.put(nullToEmptyString(Messages.PcapTrace_LinkLayerHeaderType), LinkTypeHelper.toString((int) pcap.getDataLinkType()) + " (" + pcap.getDataLinkType() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ builder.put(nullToEmptyString(Messages.PcapTrace_FileEndianness), nullToEmptyString(pcap.getByteOrder().toString()));
return checkNotNull(builder.build());
* The same is done for the end times index, but swapping the first two
* comparators instead.
*/
- fStartTimesIndex = checkNotNull(TreeMultimap.<Long, E> create(
+ fStartTimesIndex = checkNotNull(TreeMultimap.create(
SegmentComparators.LONG_COMPARATOR,
Ordering.from(SegmentComparators.INTERVAL_END_COMPARATOR).compound(Ordering.natural())));
- fEndTimesIndex = checkNotNull(TreeMultimap.<Long, E> create(
+ fEndTimesIndex = checkNotNull(TreeMultimap.create(
SegmentComparators.LONG_COMPARATOR,
Ordering.from(SegmentComparators.INTERVAL_START_COMPARATOR).compound(Ordering.natural())));
public Object[] toArray() {
fLock.readLock().lock();
try {
- return checkNotNull(fStartTimesIndex.values().toArray());
+ return fStartTimesIndex.values().toArray();
} finally {
fLock.readLock().unlock();
}
public <T> T[] toArray(T @Nullable[] a) {
fLock.readLock().lock();
try {
- return checkNotNull(fStartTimesIndex.values().toArray(a));
+ return fStartTimesIndex.values().toArray(a);
} finally {
fLock.readLock().unlock();
}
* If 'attributeQuark' is invalid, or if there is no attrbiute
* associated to it.
*/
- public synchronized @NonNull List<Integer> getSubAttributes(int attributeQuark, boolean recursive)
+ public synchronized @NonNull List<@NonNull Integer> getSubAttributes(int attributeQuark, boolean recursive)
throws AttributeNotFoundException {
- List<Integer> listOfChildren = new ArrayList<>();
+ List<@NonNull Integer> listOfChildren = new ArrayList<>();
Attribute startingAttribute;
/* Check if the quark is valid */
import java.util.concurrent.TimeUnit;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
}
@Override
- public List<Integer> getQuarks(String... pattern) {
- List<Integer> quarks = new LinkedList<>();
+ public List<@NonNull Integer> getQuarks(String... pattern) {
+ List<@NonNull Integer> quarks = new LinkedList<>();
List<String> prefix = new LinkedList<>();
List<String> suffix = new LinkedList<>();
boolean split = false;
* @param newStateIntervals
* The new List of state values to use as ongoing state info
*/
- protected void replaceOngoingState(@NonNull List<ITmfStateInterval> newStateIntervals) {
+ protected void replaceOngoingState(@NonNull List<@NonNull ITmfStateInterval> newStateIntervals) {
transState.replaceOngoingState(newStateIntervals);
}
}
final int nbAttr = getNbAttributes();
- List<ITmfStateInterval> stateInfo = new ArrayList<>(nbAttr);
+ List<@Nullable ITmfStateInterval> stateInfo = new ArrayList<>(nbAttr);
/* Bring the size of the array to the current number of attributes */
for (int i = 0; i < nbAttr; i++) {
* @param t
* The requested timestamp
*/
- public void doQuery(List<ITmfStateInterval> stateInfo, long t) {
+ public void doQuery(List<@Nullable ITmfStateInterval> stateInfo, long t) {
fRWLock.readLock().lock();
try {
if (!this.fIsActive) {
* @throws AttributeNotFoundException
* If the quark was not existing or invalid.
*/
- @NonNull List<Integer> getSubAttributes(int quark, boolean recursive)
+ @NonNull List<@NonNull Integer> getSubAttributes(int quark, boolean recursive)
throws AttributeNotFoundException;
/**
* @throws AttributeNotFoundException
* If the 'quark' was not existing or invalid.
*/
- List<Integer> getSubAttributes(int quark, boolean recursive, String pattern)
+ @NonNull List<@NonNull Integer> getSubAttributes(int quark, boolean recursive, String pattern)
throws AttributeNotFoundException;
/**
* the pattern. If no attribute matched, the list will be empty (but
* not null).
*/
- List<Integer> getQuarks(String... pattern);
+ @NonNull List<@NonNull Integer> getQuarks(String... pattern);
/**
* Return the name assigned to this quark. This returns only the "basename",
* @throws StateSystemDisposedException
* If the query is sent after the state system has been disposed
*/
- @NonNull List<ITmfStateInterval> queryFullState(long t)
+ @NonNull List<@NonNull ITmfStateInterval> queryFullState(long t)
throws StateSystemDisposedException;
/**
package org.eclipse.tracecompass.statesystem.core.interval;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
/**
*
* @return the state value represented by this interval
*/
- ITmfStateValue getStateValue();
+ @NonNull ITmfStateValue getStateValue();
/**
* Test if this interval intersects another timestamp, inclusively.
package org.eclipse.tracecompass.tmf.analysis.xml.ui.views.timegraph;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.tmf.analysis.xml.core.module.IXmlStateSystemContainer;
import org.eclipse.tracecompass.tmf.analysis.xml.core.module.XmlUtils;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
import org.w3c.dom.Element;
return Collections.EMPTY_SET;
}
+ @Override
+ public Iterator<@NonNull ITimeEvent> getTimeEventsIterator() {
+ return super.getTimeEventsIterator();
+ }
+
}
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import java.util.Collection;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
// Variables
// ------------------------------------------------------------------------
- private final String fTypeId1 = "Some type";
- private final String fTypeId2 = "Some other type";
+ private final @NonNull String fTypeId1 = "Some type";
+ private final @NonNull String fTypeId2 = "Some other type";
- private final String fLabel0 = "label1";
- private final String fLabel1 = "label2";
- private final String fLabel2 = "label3";
+ private final @NonNull String fLabel0 = "label1";
+ private final @NonNull String fLabel1 = "label2";
+ private final @NonNull String fLabel2 = "label3";
private final String[] fLabels0 = new String[] { };
private final String[] fLabels1 = new String[] { fLabel0, fLabel1 };
private final String[] fLabels2 = new String[] { fLabel1, fLabel0, fLabel2 };
- private final ITmfEventType fType0 = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels0));
- private final ITmfEventType fType1 = new TmfEventType(fTypeId2, TmfEventField.makeRoot(fLabels1));
- private final ITmfEventType fType2 = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels2));
- private final ITmfEventType fType3 = new TmfEventType(fTypeId2, TmfEventField.makeRoot(fLabels1));
+ private final @NonNull ITmfEventType fType0 = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels0));
+ private final @NonNull ITmfEventType fType1 = new TmfEventType(fTypeId2, TmfEventField.makeRoot(fLabels1));
+ private final @NonNull ITmfEventType fType2 = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels2));
+ private final @NonNull ITmfEventType fType3 = new TmfEventType(fTypeId2, TmfEventField.makeRoot(fLabels1));
// ------------------------------------------------------------------------
// Constructors
assertArrayEquals(fLabels2, labels2.toArray(new String[labels2.size()]));
}
- @Test(expected = IllegalArgumentException.class)
- public void testConstructorCornerCases() {
- new TmfEventType(null, null);
- }
-
@Test
public void testCopyConstructor() {
final TmfEventType original = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels1));
assertArrayEquals(fLabels1, labels1.toArray(new String[labels1.size()]));
}
- @Test
- public void testCopyConstructorCornerCases() {
- try {
- new TmfEventType(null);
- fail("TmfEventType: null argument");
- } catch (final IllegalArgumentException e) {
- }
- }
-
// ------------------------------------------------------------------------
// hashCode
// ------------------------------------------------------------------------
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Collection;
+import java.util.Collections;
import java.util.LinkedList;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.internal.tmf.core.synchronization.SyncAlgorithmFullyIncremental;
import org.eclipse.tracecompass.tmf.core.event.matching.TmfEventDependency;
import org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform;
public class SyncTest {
private TmfTraceStub t1, t2;
- private Collection<ITmfTrace> fTraces;
+ private @NonNull Collection<ITmfTrace> fTraces = Collections.EMPTY_LIST;
/**
* Initializing the traces
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.internal.statesystem.core.AttributeTree;
import org.eclipse.tracecompass.internal.statesystem.core.StateSystem;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
// ------------------------------------------------------------------------
@Override
- public void replaceOngoingState(List<ITmfStateInterval> ongoingIntervals) {
+ public void replaceOngoingState(List<@NonNull ITmfStateInterval> ongoingIntervals) {
super.replaceOngoingState(ongoingIntervals);
}
@NonNullByDefault
public class TmfAnalysisManager {
- private static final Multimap<String, IAnalysisModuleHelper> fAnalysisModules = NonNullUtils.checkNotNull(HashMultimap.<String, IAnalysisModuleHelper> create());
+ private static final Multimap<String, IAnalysisModuleHelper> fAnalysisModules = NonNullUtils.checkNotNull(HashMultimap.create());
private static final Map<String, List<Class<? extends IAnalysisParameterProvider>>> fParameterProviders = new HashMap<>();
private static final Map<Class<? extends IAnalysisParameterProvider>, IAnalysisParameterProvider> fParamProviderInstances = new HashMap<>();
private static final List<IAnalysisModuleSource> fSources = new ArrayList<>();
*
* @return The subfield names (empty Collection if none)
*/
- @NonNull Collection<String> getFieldNames();
+ @NonNull Collection<@NonNull String> getFieldNames();
/**
* Return the subfields. The iteration order is the same as
import java.util.Collection;
+import org.eclipse.jdt.annotation.NonNull;
+
/**
* The generic event type in TMF. It contains a reference to the full field structure
* for that event type.
/**
* The default event type name
*/
- String DEFAULT_TYPE_ID = "TmfType"; //$NON-NLS-1$
+ @NonNull String DEFAULT_TYPE_ID = "TmfType"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Getters
/**
* @return the event type ID
*/
- String getName();
+ @NonNull String getName();
/**
* @return the event type root field
import java.util.Collection;
import java.util.Collections;
+import org.eclipse.jdt.annotation.NonNull;
+
/**
* A basic implementation of ITmfEventType.
*
// Attributes
// ------------------------------------------------------------------------
- private final String fTypeId;
+ private final @NonNull String fTypeId;
private final ITmfEventField fRootField;
// ------------------------------------------------------------------------
* @param typeId the type name
* @param root the root field
*/
- public TmfEventType(final String typeId, final ITmfEventField root) {
- if (typeId == null) {
- throw new IllegalArgumentException();
- }
+ public TmfEventType(final @NonNull String typeId, final ITmfEventField root) {
fTypeId = typeId;
fRootField = root;
}
*
* @param type the other type
*/
- public TmfEventType(final ITmfEventType type) {
- if (type == null) {
- throw new IllegalArgumentException();
- }
+ public TmfEventType(@NonNull ITmfEventType type) {
fTypeId = type.getName();
fRootField = type.getRootField();
}
package org.eclipse.tracecompass.tmf.core.event.matching;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
/**
* The array of traces to match
*/
- private final Collection<ITmfTrace> fTraces;
+ private final @NonNull Collection<@NonNull ITmfTrace> fTraces;
/**
* The class to call once a match is found
* The set of traces for which to match events
* @since 1.0
*/
- public TmfEventMatching(Collection<ITmfTrace> traces) {
+ public TmfEventMatching(Collection<@NonNull ITmfTrace> traces) {
this(traces, new TmfEventMatches());
}
* @param tmfEventMatches
* The match processing class
*/
- public TmfEventMatching(Collection<ITmfTrace> traces, IMatchProcessingUnit tmfEventMatches) {
+ public TmfEventMatching(Collection<@NonNull ITmfTrace> traces, IMatchProcessingUnit tmfEventMatches) {
if (tmfEventMatches == null) {
throw new IllegalArgumentException();
}
* lists
*/
if (found) {
- getProcessingUnit().addMatch(dep);
+ getProcessingUnit().addMatch(checkNotNull(dep));
monitor.subTask(NLS.bind(Messages.TmfEventMatching_MatchesFound, getProcessingUnit().countMatches()));
} else {
/*
*
* @return An iterable view of the analysis modules
*/
- @NonNull Iterable<IAnalysisModule> getAnalysisModules();
+ @NonNull Iterable<@NonNull IAnalysisModule> getAnalysisModules();
// ------------------------------------------------------------------------
// Aspect getters
*
* @return The event aspects for this trace
*/
- @NonNull Iterable<ITmfEventAspect> getEventAspects();
+ @NonNull Iterable<@NonNull ITmfEventAspect> getEventAspects();
// ------------------------------------------------------------------------
// Trace characteristics getters
import java.util.Set;
+import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
/**
* @author Geneviève Bastien
* @author Matthew Khouzam
*/
+@NonNullByDefault
public interface ITmfTraceWithPreDefinedEvents {
/**
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
/**
* @return a set of the names of these events, if some names are clashing
* they will only appear once
*/
- public static Set<String> getEventNames(Iterable<? extends ITmfEventType> eventTypes) {
- Set<String> retSet = new HashSet<>();
+ public static Set<@NonNull String> getEventNames(Iterable<@NonNull ? extends ITmfEventType> eventTypes) {
+ Set<@NonNull String> retSet = new HashSet<>();
for (ITmfEventType eventType : eventTypes) {
retSet.add(eventType.getName());
}
/**
* Basic aspects that should be valid for all trace types.
*/
- public static final @NonNull Collection<ITmfEventAspect> BASE_ASPECTS =
+ public static final @NonNull Collection<@NonNull ITmfEventAspect> BASE_ASPECTS =
checkNotNull(ImmutableList.of(
ITmfEventAspect.BaseAspects.TIMESTAMP,
ITmfEventAspect.BaseAspects.EVENT_TYPE,
* The trace or experiment
* @return The corresponding trace set.
*/
- public static @NonNull Collection<ITmfTrace> getTraceSet(ITmfTrace trace) {
+ public static @NonNull Collection<@NonNull ITmfTrace> getTraceSet(ITmfTrace trace) {
if (trace == null) {
- return NonNullUtils.checkNotNull(ImmutableSet.<ITmfTrace> of());
+ return NonNullUtils.checkNotNull(ImmutableSet.of());
}
- List<ITmfTrace> traces = trace.getChildren(ITmfTrace.class);
+ List<@NonNull ITmfTrace> traces = trace.getChildren(ITmfTrace.class);
if (traces.size() > 0) {
return NonNullUtils.checkNotNull(ImmutableSet.copyOf(traces));
}
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
* Returned modules must extend this class
* @return List of modules of class moduleClass
*/
- public static <T> Iterable<T> getAnalysisModulesOfClass(ITmfTrace trace, Class<T> moduleClass) {
+ public static <T> Iterable<@NonNull T> getAnalysisModulesOfClass(ITmfTrace trace, Class<T> moduleClass) {
Iterable<IAnalysisModule> analysisModules = trace.getAnalysisModules();
- Set<T> modules = new HashSet<>();
+ Set<@NonNull T> modules = new HashSet<>();
for (IAnalysisModule module : analysisModules) {
if (moduleClass.isAssignableFrom(module.getClass())) {
modules.add(moduleClass.cast(module));
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.tmf.remote.core.shell.CommandInput;
import org.eclipse.tracecompass.tmf.remote.core.shell.ICommandInput;
import org.junit.Test;
public class CommandInputTest {
private static final @NonNull String COMMAND = "my-command";
- private static final String @NonNull [] CMD_INPUT = { "This", "are", "the", "params" };
+ private static final @NonNull String @NonNull [] CMD_INPUT = { "This", "are", "the", "params" };
/**
* Test suite for the {@link CommandInput#add(String)} and {@link CommandInput#addAll(List)}
public void testConstructorAndAdd() {
ICommandInput iunput = new CommandInput();
iunput.add(COMMAND);
- List<String> params = Arrays.asList(CMD_INPUT);
- iunput.addAll(NonNullUtils.checkNotNull(params));
+ @NonNull List<@NonNull String> params = Arrays.asList(CMD_INPUT);
+ iunput.addAll(params);
List<String> expectedList = new ArrayList<>();
expectedList.add(COMMAND);
import java.util.List;
import java.util.Vector;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
private long startTime = 0;
private long stopTime = 1;
private String className = "defaultClassName";
- private Vector<ITimeEvent> traceEvents = new Vector<>();
+ private Vector<@NonNull ITimeEvent> traceEvents = new Vector<>();
// ========================================================================
// Constructor
}
@Override
- public Iterator<ITimeEvent> getTimeEventsIterator() {
+ public Iterator<@NonNull ITimeEvent> getTimeEventsIterator() {
return traceEvents.iterator();
}
@Override
- public Iterator<ITimeEvent> getTimeEventsIterator(long aStartTime, long aStopTime, long maxDuration) {
+ public Iterator<@NonNull ITimeEvent> getTimeEventsIterator(long aStartTime, long aStopTime, long maxDuration) {
return traceEvents.iterator();
}
- public void addTraceEvent(ITimeEvent event) {
+ public void addTraceEvent(@NonNull ITimeEvent event) {
traceEvents.add(event);
}
@Override
- public List<ITimeGraphEntry> getChildren() {
+ public List<@NonNull ITimeGraphEntry> getChildren() {
return null;
}
*
* @return an array of child elements
*/
- @NonNull
- List<? extends ITmfTreeViewerEntry> getChildren();
+ @NonNull List<@NonNull ? extends ITmfTreeViewerEntry> getChildren();
/**
* Returns the name of this entry.
private ITmfTreeViewerEntry fParent = null;
/** List of child entries */
- @NonNull
- private final List<ITmfTreeViewerEntry> fChildren = new CopyOnWriteArrayList<>();
+ private final @NonNull List<@NonNull ITmfTreeViewerEntry> fChildren = new CopyOnWriteArrayList<>();
/** Name of this entry (default text to show in first column) */
private String fName;
}
@Override
- public List<ITmfTreeViewerEntry> getChildren() {
+ public List<@NonNull ITmfTreeViewerEntry> getChildren() {
return fChildren;
}
package org.eclipse.tracecompass.tmf.ui.views.timechart;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Vector;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
}
@Override
- public List<ITimeGraphEntry> getChildren() {
+ public List<@NonNull ITimeGraphEntry> getChildren() {
return null;
}
}
@Override
- public Iterator<ITimeEvent> getTimeEventsIterator() {
+ public Iterator<@NonNull ITimeEvent> getTimeEventsIterator() {
return new EntryIterator(0, Long.MAX_VALUE, 0);
}
@Override
- public Iterator<ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long maxDuration) {
+ public Iterator<@NonNull ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long maxDuration) {
return new EntryIterator(startTime, stopTime, maxDuration);
}
- private class EntryIterator implements Iterator<ITimeEvent> {
+ private class EntryIterator implements Iterator<@NonNull ITimeEvent> {
private final long fIteratorStartTime;
private final long fIteratorStopTime;
private final long fIteratorMaxDuration;
return event;
}
if (hasNext()) {
- TimeChartEvent event = next;
+ TimeChartEvent event = checkNotNull(next);
next = null;
return event;
}
package org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
+import org.eclipse.jdt.annotation.NonNull;
+
/**
* An iterator for time events. Events from the zoomed event list override any
* iterator [A][D][E][F] [G][B][C]
* </pre>
*/
-public class EventIterator implements Iterator<ITimeEvent> {
+public class EventIterator implements Iterator<@NonNull ITimeEvent> {
private final long fStartTime;
private final long fEndTime;
public ITimeEvent next() {
if (hasNext()) {
if (fZoomedNext != null && (fNext == null || fZoomedNext.getTime() <= fNext.getTime())) {
- ITimeEvent event = fZoomedNext;
+ ITimeEvent event = checkNotNull(fZoomedNext);
fZoomedNext = null;
return event;
}
- ITimeEvent event = fNext;
+ ITimeEvent event = checkNotNull(fNext);
fNext = fSplitNext;
fSplitNext = null;
return event;
import java.util.Iterator;
import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
+
/**
* Interface for an entry (row) in the time graph view
*
*
* @return an array of child elements
*/
- List<? extends ITimeGraphEntry> getChildren();
+ List<@NonNull ? extends ITimeGraphEntry> getChildren();
/**
* Returns the name of this entry.
*
* @return the iterator
*/
- <T extends ITimeEvent> Iterator<T> getTimeEventsIterator();
+ Iterator<@NonNull ? extends ITimeEvent> getTimeEventsIterator();
/**
- * Get an iterator which only returns events that fall within the start time and the stop time.
- * The visible duration is the event duration below which further detail is not discernible.
- * If no such iterator is implemented, provide a basic iterator which returns all events.
+ * Get an iterator which only returns events that fall within the start time
+ * and the stop time. The visible duration is the event duration below which
+ * further detail is not discernible. If no such iterator is implemented,
+ * provide a basic iterator which returns all events.
*
- * @param startTime start time in nanoseconds
- * @param stopTime stop time in nanoseconds
- * @param visibleDuration duration of one pixel in nanoseconds
+ * @param startTime
+ * start time in nanoseconds
+ * @param stopTime
+ * stop time in nanoseconds
+ * @param visibleDuration
+ * duration of one pixel in nanoseconds
*
* @return the iterator
*/
- <T extends ITimeEvent> Iterator<T> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration);
+ <T extends ITimeEvent> Iterator<@NonNull T> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration);
}
private ITimeGraphEntry fParent = null;
/** List of child entries */
- private final List<ITimeGraphEntry> fChildren = new CopyOnWriteArrayList<>();
+ private final List<@NonNull ITimeGraphEntry> fChildren = new CopyOnWriteArrayList<>();
/** Name of this entry (text to show) */
private String fName;
}
@Override
- public synchronized List<? extends ITimeGraphEntry> getChildren() {
+ public synchronized List<@NonNull ? extends ITimeGraphEntry> getChildren() {
return fChildren;
}
}
@Override
- public Iterator<ITimeEvent> getTimeEventsIterator() {
+ public Iterator<@NonNull ITimeEvent> getTimeEventsIterator() {
if (hasTimeEvents()) {
return new EventIterator(fEventList, fZoomedEventList);
}
}
@Override
- public Iterator<ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration) {
+ public Iterator<@NonNull ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration) {
if (!hasTimeEvents()) {
return null;
}
/*
* TODO: This method can be removed in the next major API version.
*/
- public synchronized void addChild(TimeGraphEntry child) {
+ public synchronized void addChild(@NonNull TimeGraphEntry child) {
addChild((ITimeGraphEntry) child);
}
* @param child
* The child entry
*/
- public synchronized void addChild(ITimeGraphEntry child) {
+ public synchronized void addChild(@NonNull ITimeGraphEntry child) {
/*
* TODO: Use setParent() once it is added to the interface.
*/
* @param child
* The child entry
*/
- public synchronized void addChild(int index, ITimeGraphEntry child) {
+ public synchronized void addChild(int index, @NonNull ITimeGraphEntry child) {
/*
* TODO: Use setParent() once it is added to the interface.
*/
if (comparator == null) {
return;
}
- ITimeGraphEntry[] array = fChildren.toArray(new ITimeGraphEntry[0]);
+ @NonNull ITimeGraphEntry[] array = fChildren.toArray(new @NonNull ITimeGraphEntry[0]);
Arrays.sort(array, comparator);
fChildren.clear();
fChildren.addAll(Arrays.asList(array));
if (null == entry || ! entry.hasTimeEvents()) {
return null;
}
- Iterator<ITimeEvent> iterator = entry.getTimeEventsIterator();
+ Iterator<? extends ITimeEvent> iterator = entry.getTimeEventsIterator();
if (iterator != null && iterator.hasNext()) {
return iterator.next();
}
if (null == entry || ! entry.hasTimeEvents()) {
return null;
}
- Iterator<ITimeEvent> iterator = entry.getTimeEventsIterator();
+ Iterator<? extends ITimeEvent> iterator = entry.getTimeEventsIterator();
if (iterator == null) {
return null;
}