org.eclipse.jdt.annotation.NonNull Java Examples
The following examples show how to use
org.eclipse.jdt.annotation.NonNull.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XmlDataProviderManagerTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Test getting the XML data provider for one trace, with an analysis that * applies to a trace */ @Test public void testOneTrace() { ITmfTrace trace = null; try { // Initialize the trace and module trace = XmlUtilsTest.initializeTrace(TEST_TRACE); TmfTraceOpenedSignal signal = new TmfTraceOpenedSignal(this, trace, null); ((TmfTrace) trace).traceOpened(signal); // The data provider manager uses opened traces from the manager TmfTraceManager.getInstance().traceOpened(signal); // Get the view element from the file Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.STATE_VALUE_FILE.getPath().toOSString(), TmfXmlStrings.TIME_GRAPH_VIEW, TRACE_VIEW_ID); assertNotNull(viewElement); ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> timeGraphProvider = XmlDataProviderManager.getInstance().getTimeGraphProvider(trace, viewElement); assertNotNull(timeGraphProvider); } finally { if (trace != null) { trace.dispose(); TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, trace)); } } }
Example #2
Source File: ThreadStatusDataProviderTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private static void assertEqualsStates(String string, @NonNull List<@NonNull ITimeGraphState> states, String element) { String[] stringStates = string.split(","); for (int i = 0; i < stringStates.length / 4; i++) { ITimeGraphState state = states.get(i); assertEquals(element + ": start time at position " + i, Long.parseLong(stringStates[i * 4]), state.getStartTime()); assertEquals(element + ": duration at position " + i, Long.parseLong(stringStates[i * 4 + 1]), state.getDuration()); OutputElementStyle style = state.getStyle(); if (style == null) { // Expected a value of Long try { assertEquals(element + ": value at position " + i, Long.parseLong(stringStates[i * 4 + 2]), state.getValue()); } catch (NumberFormatException e) { fail(element + ": value at position " + i + ": did not expect a null style"); } } else { assertEquals(element + ": value at position " + i, stringStates[i * 4 + 2], style.getParentKey()); } assertEquals(element + ": label at position " + i, stringStates[i * 4 + 3], String.valueOf(state.getLabel())); } }
Example #3
Source File: XmlDataProviderManager.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Create (if necessary) and get the {@link ITmfTreeXYDataProvider} for the * specified trace and viewElement. * * @param trace * trace for which we are querying a provider * @param viewElement * the XML XY view element for which we are querying a provider * @return the unique instance of an XY provider for the queried parameters */ public synchronized @Nullable ITmfTreeXYDataProvider<@NonNull ITmfTreeDataModel> getXyProvider(ITmfTrace trace, Element viewElement) { if (!viewElement.hasAttribute(ID_ATTRIBUTE)) { return null; } String viewId = viewElement.getAttribute(ID_ATTRIBUTE); ITmfTreeXYDataProvider<@NonNull ITmfTreeDataModel> provider = fXyProviders.get(trace, viewId); if (provider != null) { return provider; } if (Iterables.any(TmfTraceManager.getInstance().getOpenedTraces(), opened -> TmfTraceManager.getTraceSetWithExperiment(opened).contains(trace))) { DataDrivenXYProviderFactory xyFactory = getXyProviderFactory(viewElement); // Create with the trace or experiment first if (xyFactory != null) { return createXYProvider(trace, viewId, xyFactory); } } return null; }
Example #4
Source File: LTTngControlService.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Basic generation of command for session creation * * @param sessionInfo * the session to create * @return the basic command for command creation */ protected @NonNull ICommandInput prepareSessionCreationCommand(ISessionInfo sessionInfo) { ICommandInput command = createCommand(LTTngControlServiceConstants.COMMAND_CREATE_SESSION); if (!sessionInfo.getName().isEmpty()) { command.add(sessionInfo.getName()); } String newPath = sessionInfo.getSessionPath(); if (newPath != null && !"".equals(newPath)) { //$NON-NLS-1$ command.add(LTTngControlServiceConstants.OPTION_OUTPUT_PATH); command.add(newPath); } if (sessionInfo.isSnapshotSession()) { command.add(LTTngControlServiceConstants.OPTION_SNAPSHOT); } return command; }
Example #5
Source File: CallStackPresentationProvider.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
@Override @NonNullByDefault({}) public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime) { Map<String, String> retMap = super.getEventHoverToolTipInfo(event, hoverTime); if (retMap == null) { retMap = new LinkedHashMap<>(1); } if (!(event instanceof TimeEvent) || !((TimeEvent) event).hasValue() || !(event.getEntry() instanceof TimeGraphEntry)) { return retMap; } TimeGraphEntry entry = (TimeGraphEntry) event.getEntry(); ITimeGraphDataProvider<? extends TimeGraphEntryModel> dataProvider = BaseDataProviderTimeGraphView.getProvider(entry); TmfModelResponse<@NonNull Map<@NonNull String, @NonNull String>> response = dataProvider.fetchTooltip( FetchParametersUtils.selectionTimeQueryToMap(new SelectionTimeQueryFilter(hoverTime, hoverTime, 1, Collections.singletonList(entry.getEntryModel().getId()))), null); Map<@NonNull String, @NonNull String> tooltipModel = response.getModel(); if (tooltipModel != null) { retMap.putAll(tooltipModel); } return retMap; }
Example #6
Source File: ResourceUtilTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private @NonNull IResource createAndVerifyLink(IPath path, String name, boolean isFile, boolean isSymLink, boolean checkSymLink) throws IOException, CoreException { IResource resource; if (isFile) { resource = fTestFolder.getFile(name); } else { resource = fTestFolder.getFolder(name); } assertNotNull(resource); boolean success = ResourceUtil.createSymbolicLink(resource, path, isSymLink, null); assertTrue(success); assertTrue(resource.exists()); assertTrue(isFileSystemSymbolicLink(resource) == (checkSymLink ? isSymLink : false)); assertTrue(resource.isLinked() == ((checkSymLink ? !isSymLink : true))); assertTrue(ResourceUtil.isSymbolicLink(resource)); verifyLocation(path, resource); return resource; }
Example #7
Source File: FlameChartView.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * @return an array of {@link ISymbolProviderPreferencePage} that will configure * the current traces */ private ISymbolProviderPreferencePage[] getProviderPages() { List<ISymbolProviderPreferencePage> pages = new ArrayList<>(); ITmfTrace trace = getTrace(); if (trace != null) { for (ITmfTrace subTrace : getTracesToBuild(trace)) { Collection<@NonNull ISymbolProvider> symbolProviders = SymbolProviderManager.getInstance().getSymbolProviders(subTrace); for (org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProvider provider : Iterables.filter(symbolProviders, org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProvider.class)) { ISymbolProviderPreferencePage page = provider.createPreferencePage(); if (page != null) { pages.add(page); } } } } return pages.toArray(new ISymbolProviderPreferencePage[pages.size()]); }
Example #8
Source File: AbstractStatisticsTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Test a data set with a large number of objects of random values * * NOTE: This test contains negative values */ @Test public void testLargeDatasetNegative() { // Create a fixture of a large number of random values List<@NonNull Long> longFixture = new ArrayList<>(LARGE_AMOUNT_OF_SEGMENTS); Random rng = new Random(10); for (int i = 1; i <= LARGE_AMOUNT_OF_SEGMENTS; i++) { longFixture.add(rng.nextLong()); } // Create the statistics object for the objects that will return those // values Collection<@NonNull E> fixture = createElementsWithValues(longFixture); // Compare with an offline algorithm testOnlineVsOffline(fixture); }
Example #9
Source File: TmfMipmapStateProviderStub.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * @param time * The event type * @param longVal * The event value or null * @return A new TmfEvent */ public @NonNull ITmfEvent createEvent(long time, Long longVal) { ITmfStateValue value; if (longVal == null) { value = TmfStateValue.nullValue(); } else if (type == ITmfStateValue.Type.LONG) { value = TmfStateValue.newValueLong(longVal); } else if (type == ITmfStateValue.Type.INTEGER) { value = TmfStateValue.newValueInt(longVal.intValue()); } else if (type == ITmfStateValue.Type.DOUBLE) { value = TmfStateValue.newValueDouble(longVal.doubleValue()); } else { value = TmfStateValue.nullValue(); } ITmfTimestamp timestamp = TmfTimestamp.fromNanos(time); ITmfEventType eventType = new TmfEventType(MIPMAP_ID, null); ITmfEventField content = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, value, null); ITmfEvent event = new TmfEvent(null, ITmfContext.UNKNOWN_RANK, timestamp, eventType, content); return event; }
Example #10
Source File: SynchronizationManager.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static SynchronizationAlgorithm synchronize(final File syncFile, final Collection<@NonNull ITmfTrace> traces, SynchronizationAlgorithm syncAlgo) { ITmfEventMatching matching = new TmfEventMatching(traces, syncAlgo); matching.matchEvents(); SynchronizationBackend syncBackend; try { syncBackend = new SynchronizationBackend(syncFile, false); syncBackend.saveSync(syncAlgo); } catch (IOException e) { Activator.logError("Error while saving trace synchronization file", e); //$NON-NLS-1$ } return syncAlgo; }
Example #11
Source File: TestDataBigCallStack.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public @NonNull ITmfTrace getTrace() { // A good moment to initialize the expected data by reading the trace ITmfTrace trace = super.getTrace(); if (!fDataInitialized) { setCallStackData(getExpectedData(trace)); fDataInitialized = true; } return trace; }
Example #12
Source File: AbstractSegmentStoreTableViewer.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Compute the predicate for every property regexes * * @return A map of time event filters predicate by property * @since 3.1 * @deprecated Use {@link #generateRegexPredicate()} */ @Deprecated protected Map<Integer, Predicate<@NonNull Map<@NonNull String, @NonNull Object>>> computeRegexPredicate() { Multimap<@NonNull Integer, @NonNull String> regexes = getRegexes(); Map<@NonNull Integer, @NonNull Predicate<@NonNull Map<@NonNull String, @NonNull Object>>> predicates = new HashMap<>(); for (Map.Entry<Integer, Collection<String>> entry : regexes.asMap().entrySet()) { String regex = IFilterStrings.mergeFilters(entry.getValue()); FilterCu cu = FilterCu.compile(regex); Predicate<@NonNull Map<@NonNull String, @NonNull Object>> predicate = cu != null ? multiToMapPredicate(cu.generate()) : null; if (predicate != null) { predicates.put(entry.getKey(), predicate); } } return predicates; }
Example #13
Source File: SwtBarChart.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override protected ISeries createSwtSeries(ChartSeries chartSeries, ISeriesSet swtSeriesSet, @NonNull Color color) { String title = chartSeries.getY().getLabel(); IBarSeries swtSeries = (IBarSeries) swtSeriesSet.createSeries(SeriesType.BAR, title); swtSeries.setBarPadding(BAR_PADDING); swtSeries.setBarColor(color); return swtSeries; }
Example #14
Source File: SegmentTableTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Test table with an on-disk segment store that is lazy loaded in the table * * @throws IOException * when creating the segment store */ @Test public void onDiskSegStoreTest() throws IOException { Path segmentFile = Files.createTempFile("tmpSegStore", ".tmp"); assertNotNull(segmentFile); ISegmentStore<@NonNull BasicSegment> fixture = null; try { final int size = 1000000; fixture = SegmentStoreFactory.createOnDiskSegmentStore(segmentFile, BasicSegment.BASIC_SEGMENT_READ_FACTORY, 1); for (int i = 0; i < size; i++) { fixture.add(new BasicSegment(i, 2 * i)); } fixture.close(false); assertNotNull(getTable()); getTable().updateModel(fixture); SWTBotTable tableBot = new SWTBotTable(getTable().getTableViewer().getTable()); fBot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); tableBot.header("Duration").click(); fBot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); tableBot.header("Duration").click(); fBot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "999,999", 0, 2)); } finally { if (fixture != null) { fixture.close(true); } Files.deleteIfExists(segmentFile); } }
Example #15
Source File: HABotResource.java From org.openhab.ui.habot with Eclipse Public License 1.0 | 5 votes |
@POST @Path("/compat/cards/{cardUID}/unbookmark") @ApiOperation(value = "Removes the bookmark on a card (compatibility endpoint).") @ApiResponses(value = { @ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 404, message = "The card with the provided UID doesn't exist"), @ApiResponse(code = 500, message = "An error occured") }) public Response unsetCardBookmarkCompat( @PathParam("cardUID") @ApiParam(value = "cardUID", required = true) @NonNull String cardUID) { return this.unsetCardBookmark(cardUID); }
Example #16
Source File: SegmentStoreScatterDataProvider.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public @NonNull ISegment next() { /* hasNext implies next != null */ if (hasNext()) { ISegment segment = Objects.requireNonNull(fNext); fLasts.put(getSegmentName(segment), segment); fNext = null; return segment; } throw new NoSuchElementException(); }
Example #17
Source File: XYChartLegendImageProvider.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private void drawStyledDot(GC gc, Color lineColor, int imageWidth, int imageHeight, @NonNull OutputElementStyle appearance) { BaseXYPresentationProvider presProvider = fChartViewer.getPresentationProvider(); String symbolStyle = (String) presProvider.getStyleOrDefault(appearance, StyleProperties.SYMBOL_TYPE, StyleProperties.SymbolType.NONE); int symbolSize = ((Number) presProvider.getFloatStyleOrDefault(appearance, StyleProperties.HEIGHT, 1.0f)).intValue(); int centerX = imageWidth / 2; int centerY = imageHeight / 2; Color prevBg = gc.getBackground(); Color prevFg = gc.getForeground(); switch(symbolStyle) { case StyleProperties.SymbolType.CIRCLE: SymbolHelper.drawCircle(gc, lineColor, symbolSize, centerX, centerY); break; case StyleProperties.SymbolType.DIAMOND: SymbolHelper.drawDiamond(gc, lineColor, symbolSize, centerX, centerY); break; case StyleProperties.SymbolType.SQUARE: SymbolHelper.drawSquare(gc, lineColor, symbolSize, centerX, centerY); break; case StyleProperties.SymbolType.CROSS: SymbolHelper.drawCross(gc, lineColor, symbolSize, centerX, centerY); break; case StyleProperties.SymbolType.PLUS: SymbolHelper.drawPlus(gc, lineColor, symbolSize, centerX, centerY); break; case StyleProperties.SymbolType.INVERTED_TRIANGLE: SymbolHelper.drawInvertedTriangle(gc, lineColor, symbolSize, centerX, centerY); break; case StyleProperties.SymbolType.TRIANGLE: SymbolHelper.drawTriangle(gc, lineColor, symbolSize, centerX, centerY); break; default: // Default is nothing break; } gc.setForeground(prevFg); gc.setBackground(prevBg); }
Example #18
Source File: AbstractSelectTreeViewer.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Get the legend image for a entry's name * * @param name * the entry's name (used in both Tree and Chart viewer * @return the correctly dimensioned image if there is a legend image provider */ protected Image getLegendImage(@NonNull String name) { /* If the image height match the row height, row height will increment */ ILegendImageProvider legendImageProvider = fLegendImageProvider; int legendColumnIndex = fLegendIndex; if (legendImageProvider != null && legendColumnIndex >= 0) { Tree tree = getTreeViewer().getTree(); int imageWidth = tree.getColumn(legendColumnIndex).getWidth(); int imageHeight = tree.getItemHeight() - 1; if (imageHeight > 0 && imageWidth > 0) { return legendImageProvider.getLegendImage(imageHeight, imageWidth, name); } } return null; }
Example #19
Source File: XYChartLegendImageProvider.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private void drawStyleLine(GC gc, Color lineColor, int imageWidth, int imageHeight, @NonNull OutputElementStyle appearance) { Color prev = gc.getForeground(); BaseXYPresentationProvider presProvider = fChartViewer.getPresentationProvider2(); LineStyle lineStyle = LineStyle.valueOf((String) presProvider.getStyleOrDefault(appearance, StyleProperties.SERIES_STYLE, StyleProperties.SeriesStyle.SOLID)); if (lineStyle != LineStyle.NONE) { gc.setForeground(lineColor); gc.setLineWidth(((Number) presProvider.getFloatStyleOrDefault(appearance, StyleProperties.WIDTH, 1.0f)).intValue()); gc.setLineStyle(lineStyle.ordinal()); gc.drawLine(0, imageHeight / 2, imageWidth, imageHeight / 2); gc.setForeground(prev); } }
Example #20
Source File: ExprFilter.java From Skript with GNU General Public License v3.0 | 5 votes |
@NonNull @Override public Iterator<?> iterator(Event e) { try { return Iterators.filter(new ArrayIterator<>(this.objects.getArray(e)), object -> { current = object; return condition.check(e); }); } finally { current = null; } }
Example #21
Source File: ClassicNode.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public void readSpecificHeader(@NonNull ByteBuffer buffer) { super.readSpecificHeader(buffer); int size = getNode().getMaxChildren(); for (int i = 0; i < getNbChildren(); i++) { fChildStart[i] = buffer.getLong(); } for (int i = getNbChildren(); i < size; i++) { buffer.getLong(); } }
Example #22
Source File: TmfTraceUtilsSearchingTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Test the {@link TmfTraceUtils#getPreviousEventMatching} method, where the * event from which we start the search already matches the criterion (it * should be correctly skipped). */ @Test public void testPreviousMatchingEventStartMatches() { ITmfTrace trace = fTrace; assertNotNull(trace); Predicate<@NonNull ITmfEvent> predicate = event -> event.getName().equals("softirq_raise"); ITmfEvent foundEvent = TmfTraceUtils.getPreviousEventMatching(trace, START_RANK, predicate, null); assertNotNull(foundEvent); assertNotEquals(fStartEvent, foundEvent); }
Example #23
Source File: TmfStateStatistics.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public Map<@NonNull String, @NonNull Long> getEventTypesTotal() { int quark = fTypesStats.optQuarkAbsolute(Attributes.EVENT_TYPES); if (quark == ITmfStateSystem.INVALID_ATTRIBUTE) { return Collections.emptyMap(); } /* Get the list of quarks, one for each even type in the database */ List<Integer> quarks = fTypesStats.getSubAttributes(quark, false); long endTime = fTypesStats.getCurrentEndTime(); final Map<@NonNull String, @NonNull Long> map = new HashMap<>(); try { /* Since we want the total we can look only at the end */ List<ITmfStateInterval> endState = fTypesStats.queryFullState(endTime); for (int typeQuark : quarks) { String curEventName = fTypesStats.getAttributeName(typeQuark); long eventCount = extractCount(endState.get(typeQuark).getValue()); map.put(curEventName, eventCount); } return map; } catch (StateSystemDisposedException e) { /* Assume there is no events, nothing will be put in the map. */ return Collections.emptyMap(); } }
Example #24
Source File: BtfEventType.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * The type constructor * @param name the event name * @param description the event description */ public BtfEventType(@NonNull String name, String description) { super(); fName = name; fDescription = description; fCols = ImmutableList.copyOf(FIELDS_WITH_NOTES_COLUMNS); fFields = FIELDS_WITH_NOTES; }
Example #25
Source File: PatternStatisticsView.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override protected @NonNull AbstractTmfTreeViewer createSegmentStoreStatisticsViewer(@NonNull Composite parent) { PatternStatisticsViewer viewer = new PatternStatisticsViewer(parent); fViewer = viewer; loadStatisticView(); return viewer; }
Example #26
Source File: FloatDefinitionTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@NonNull private static BitBuffer create32BitNegativeFloatByteBuffer() { float[] data = new float[2]; data[0] = -2.0f; data[1] = -3.14f; ByteBuffer byb = ByteBuffer.allocate(128); byb.order(ByteOrder.nativeOrder()); byb.mark(); byb.putFloat(data[0]); byb.putFloat(data[1]); byb.reset(); BitBuffer bb = new BitBuffer(byb); return bb; }
Example #27
Source File: LTTngControlService.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * @return the tracing group option if configured in the preferences */ protected @NonNull List<@NonNull String> getTracingGroupOption() { List<@NonNull String> groupOption = new ArrayList<>(); if (!ControlPreferences.getInstance().isDefaultTracingGroup() && !ControlPreferences.getInstance().getTracingGroup().equals("")) { //$NON-NLS-1$ groupOption.add(LTTngControlServiceConstants.OPTION_TRACING_GROUP); groupOption.add(ControlPreferences.getInstance().getTracingGroup()); } return groupOption; }
Example #28
Source File: ArrayDefinition2Test.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Run the ArrayDefinition(ArrayDeclaration,DefinitionScope,String) * constructor test. */ @Test public void testArrayDefinition_baseDeclaration() { CompoundDeclaration declaration = (CompoundDeclaration) charArrayFixture.getDeclaration(); String fieldName = ""; ArrayDefinition result = new ArrayDefinition(declaration, this.trace, fieldName, Arrays.asList(new @NonNull Definition[0])); assertNotNull(result); }
Example #29
Source File: CallStackProviderStub.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override protected @Nullable ITmfStateValue functionExit(@NonNull ITmfEvent event) { String name = event.getName(); if (EXIT.equals(name)) { ITmfEventField field = event.getContent().getField(FIELD_NAME); if (field != null) { return TmfStateValue.newValueString((String) field.getValue()); } // Field is null, but this is an exit, return something return NO_FUNC_EXIT; } return null; }
Example #30
Source File: ThreadStatusDataProvider.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Filter and deduplicate the time stamps for the statesystem * * @param ss * this provider's {@link ITmfStateSystem} * @param filter * the query object * @return a Set of filtered timestamps that intersect the state system's time * range */ private static @NonNull Collection<@NonNull Long> getTimes(ITmfStateSystem ss, TimeQueryFilter filter) { long start = ss.getStartTime(); // use a HashSet to deduplicate time stamps Collection<@NonNull Long> times = new HashSet<>(); for (long t : filter.getTimesRequested()) { if (t >= start) { times.add(t); } } return times; }