@Nullable private List<Node> convertListNode(@Nullable Object o) { if (o == null) { return null; } else { List<Map<String, Object>> in = (List<Map<String, Object>>) o; List<Node> out = new ArrayList<>(); for (Map<String, Object> m : in) { Node n = convert(m); if (n != null) { out.add(n); } } return out; } }
@JsonCreator public RobotMap(@NotNull List<CommandButton> buttons, @Nullable SubsystemSolenoid shooter, @Nullable Pneumatics pneumatics, @Nullable IntakeSingleRollerPneumatic intake, @NotNull @JsonProperty(required = true) Logger logger, @NotNull @JsonProperty(required = true) MappedRunnable updater, @NotNull @JsonProperty(required = true) DriveTalonCluster drive, @NotNull @JsonProperty(required = true) OI oi, @NotNull @JsonProperty(required = true) YamlCommand defaultDriveCommand, @Nullable YamlCommand startupCommand){ this.buttons = buttons; this.intake = intake; this.shooter = shooter; this.pneumatics = pneumatics; this.logger = logger; this.updater = updater; this.drive = drive; this.oi = oi; this.defaultDriveCommand = defaultDriveCommand.getCommand(); this.startupCommand = startupCommand != null ? startupCommand.getCommand() : null; }
@Nullable protected TransformationMenuItem createItem(TransformationMenuContext context) { WorkSpace_TransformationMenu.TMP_SubMenu_tva3ah_c0.TMP_Action_tva3ah_b2a.Item item = new WorkSpace_TransformationMenu.TMP_SubMenu_tva3ah_c0.TMP_Action_tva3ah_b2a.Item(context); String description; try { description = "single item: " + item.getLabelText(""); } catch (Throwable t) { Logger.getLogger(getClass()).error("Exception while executing getText of the item " + item, t); return null; } context.getEditorMenuTrace().pushTraceInfo(); try { context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase(description, new SNodePointer("r:7c1e5bbb-2d18-4cf3-a11d-502be6b13261(jetbrains.mps.samples.VoiceMenu.editor)", "8720745441960174133"))); item.setTraceInfo(context.getEditorMenuTrace().getTraceInfo()); } finally { context.getEditorMenuTrace().popTraceInfo(); } return item; }
@Nullable @Contract("null, _ -> null") public static PsiElement findSiblingByPredicate( @Nullable final PsiElement sibling, @NotNull final Predicate<PsiElement> predicate ) { if (sibling == null) { return null; } else { for (PsiElement child = sibling.getNextSibling(); child != null; child = child.getNextSibling()) { if (predicate.apply(child)) { return child; } } return null; } }
@Nullable @Override public Element getState() { synchronized (lock) { final Element element = new Element("state"); for (Entity entity : queue) { final Element entityElement = new Element(TAG_ENTITY); entityElement.setAttribute(ATTR_ACTION, entity.getAction().name()); entityElement.setAttribute(ATTR_DATE, entity.getDateStr()); final String parameters = entity.getParameters(); if (parameters != null) { entityElement.setAttribute(ATTR_NAME, parameters); } element.addContent(entityElement); } return element; } }
@Nullable protected TransformationMenuItem createItem(TransformationMenuContext context) { Activity_TransformationMenu.TMP_SubMenu_rgk9zw_a2.TMP_Action_rgk9zw_b0c.Item item = new Activity_TransformationMenu.TMP_SubMenu_rgk9zw_a2.TMP_Action_rgk9zw_b0c.Item(context); String description; try { description = "single item: " + item.getLabelText(""); } catch (Throwable t) { Logger.getLogger(getClass()).error("Exception while executing getText of the item " + item, t); return null; } context.getEditorMenuTrace().pushTraceInfo(); try { context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase(description, new SNodePointer("r:7c1e5bbb-2d18-4cf3-a11d-502be6b13261(jetbrains.mps.samples.VoiceMenu.editor)", "8720745441970421370"))); item.setTraceInfo(context.getEditorMenuTrace().getTraceInfo()); } finally { context.getEditorMenuTrace().popTraceInfo(); } return item; }
/** * Set the scene to put a light probe. * * @param scene the scene to put a light probe. */ public void setPbrScene(@Nullable final Node scene) { final Node prevScene = getPbrScene(); if (prevScene != null) { prevScene.removeLight(lightProbe); } this.pbrScene = scene; if (scene != null) { scene.addLight(lightProbe); } this.frame = 0; }
@NotNull @Override public ResultSet select( @NotNull @NonNls String tableName, @Nullable @NonNls String columnName, @Nullable Pair... where) { StringBuilder deepDarkFantasy = new StringBuilder(getQueryString(tableName, columnName)); if (where != null) { deepDarkFantasy .append(" WHERE ") .append(String.join(" AND ", (CharSequence[]) Pair.convert(where))); } return querySQL(deepDarkFantasy.toString()); /* return statement.executeQuery("SELECT " + (columnName != null ? columnName : "*") + " FROM " + tableName + " WHERE " + String.join(" and ", Pair.convert(where)) ); // NOTICE: HERE I IGNORED THE CASE THAT WHERE IS NULL */ }
@Nullable protected TransformationMenuItem createItem(TransformationMenuContext context) { Event_TransformationMenu.TMP_SubMenu_8shh52_a6.TMP_Action_8shh52_a0g.Item item = new Event_TransformationMenu.TMP_SubMenu_8shh52_a6.TMP_Action_8shh52_a0g.Item(context); String description; try { description = "single item: " + item.getLabelText(""); } catch (Throwable t) { Logger.getLogger(getClass()).error("Exception while executing getText of the item " + item, t); return null; } context.getEditorMenuTrace().pushTraceInfo(); try { context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase(description, new SNodePointer("r:7c1e5bbb-2d18-4cf3-a11d-502be6b13261(jetbrains.mps.samples.VoiceMenu.editor)", "6198827212362263672"))); item.setTraceInfo(context.getEditorMenuTrace().getTraceInfo()); } finally { context.getEditorMenuTrace().popTraceInfo(); } return item; }
@Override protected <T> T invokeSpecial0(@NotNull SNode node, @NotNull SMethod<T> method, @Nullable Object[] parameters) { int methodIndex = BH_METHODS.indexOf(method); if (methodIndex < 0) { throw new BHMethodNotFoundException(this, method); } switch (methodIndex) { case 0: return (T) ((Double) GeefWaarde_idXSBwowcV5H(node)); default: throw new BHMethodNotFoundException(this, method); } }
@Override public boolean isAvailable(@NotNull Project project, Editor editor, @Nullable PsiElement element) { if (!super.isAvailable(project, editor, element)) { return false; } element = CsvIntentionHelper.getParentFieldElement(element); return element instanceof CsvField && element.getFirstChild() != null && (CsvIntentionHelper.getElementType(element.getFirstChild()) != CsvTypes.QUOTE || CsvIntentionHelper.getElementType(element.getLastChild()) != CsvTypes.QUOTE); }
@Contract("_, null -> false") public static boolean open(Player player, @Nullable ItemStack bpItem) { if (ItemUtils.isEmpty(bpItem)) { return false; } BackpackType type; String bpId = ItemUtils.getTag(bpItem, ItemUtils.BACKPACK_TAG); if (bpId == null || (type = BackpackManager.getBackpackType(bpId)) == null) { return false; } Backpack backpack; String bpUid = ItemUtils.getTag(bpItem, ItemUtils.BACKPACK_UID_TAG); UUID uuid = bpUid == null ? null : UUID.fromString(bpUid); if (!BACKPACKS.containsKey(uuid)) { if (uuid == null) { backpack = type.createBackpack(); ItemUtils.setTag( bpItem, ItemUtils.BACKPACK_UID_TAG, backpack.getUniqueId().toString()); } else { backpack = type.createBackpack(uuid); } BACKPACKS.put(backpack.getUniqueId(), backpack); } else { backpack = BACKPACKS.get(uuid); } backpack.open(player); return true; }
@Override public @Nullable Number resolveNumber(LamiTableEntry entry) { LamiData data = entry.getValue(fColIndex); if (data instanceof LamiIRQ) { return (((LamiIRQ) data).getNumber()); } return null; }
public FileAction(@Nullable final ResourceElement element, @Nullable final Array<ResourceElement> elements) { this.element = element; this.elements = elements; setText(getName()); setOnAction(this::execute); final Image icon = getIcon(); if (icon != null) setGraphic(new ImageView(icon)); }
@Nullable private static Command findCommand(@NotNull String name) { Command[] commands = Ioc.context().findAll(Command.class); for (Command command : commands) { if (command.alias().contains(name)) { return command; } } return null; }
@Nullable @Override public Navigatable getNavigatable() { PsiElement navigationElement = psiClass.getNavigationElement(); if (navigationElement instanceof Navigatable) { return (Navigatable) navigationElement; } else { return null; } }
static public boolean isProvider(@Nullable PsiFile file) { //noinspection SimplifiableIfStatement - easier to read if (null == file || PhpFileType.INSTANCE != file.getFileType() || file.getName().equals("config.php")) { return false; } return file.getVirtualFile().getPath() .matches(".*/(translations|messages)/([a-zA-z]{2}(-[a-zA-z]{2})?)/[^/]+\\.php$"); }
@Nullable public static PhpClass getPhpClassByCallChain(MethodReference methodRef) { while (methodRef != null) { PhpExpression expr = methodRef.getClassReference(); if (expr instanceof ClassReference) { return (PhpClass) ((ClassReference) expr).resolve(); } else if (expr instanceof MethodReference) { methodRef = (MethodReference) expr; } else if (expr instanceof Variable) { PhpType type = expr.getType(); String strType = type.toString(); int index1 = strType.indexOf('\\'); int index2 = strType.indexOf('.'); if (index2 == -1) index2 = strType.length() - index1; if (index1 >= 0 && index2 >= 0 && index2 > index1) { String className = strType.substring(index1, index2); return ClassUtils.getClass(PhpIndex.getInstance(methodRef.getProject()), className); } else { return null; } // type.toString() } else { return null; } } return null; }
@Override protected <T> T invokeSpecial0(@NotNull SNode node, @NotNull SMethod<T> method, @Nullable Object[] parameters) { int methodIndex = BH_METHODS.indexOf(method); if (methodIndex < 0) { throw new BHMethodNotFoundException(this, method); } switch (methodIndex) { case 0: return (T) ((List<SNode>) GeefLijstMetInvoerKenmerken_id6$f4rrvMdoa(node)); default: throw new BHMethodNotFoundException(this, method); } }
@Nullable @Override public Object getPropertyUnchecked(@NotNull String name) { try { return getProperty(name); } catch (Exception e) { return null; } }
public static VirtualFile chooseFolder(@Nullable Project project, String title, String description, boolean showFileSystemRoots, boolean hideIgnored, @Nullable VirtualFile toSelect){ final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); descriptor.setTitle(title); descriptor.setDescription(description); descriptor.setShowFileSystemRoots(showFileSystemRoots); descriptor.setHideIgnored(hideIgnored); return FileChooser.chooseFile(descriptor, project, toSelect); }
@Nullable public BPMNFileEditor getActiveBPMNFileEditor() { for (FileEditor editor : myFileEditorManager.getSelectedEditors()) { if (editor instanceof BPMNFileEditor) { return (BPMNFileEditor) editor; } } return null; }
@Nullable @Override protected String findItemToAdd() { return showEditDialog( "", "hybris.import.settings.junk.directory.popup.add.title", "hybris.import.settings.junk.directory.popup.add.text" ); }
/** * Create creation menu menu. * * @param nodeTree the node tree * @return the menu */ @FXThread protected @Nullable Menu createCreationMenu(@NotNull final NodeTree<?> nodeTree) { final T element = getElement(); final Menu menu = new Menu(MODEL_NODE_TREE_ACTION_CREATE, new ImageView(Icons.ADD_12)); final Menu createControlsMenu = new Menu(MODEL_NODE_TREE_ACTION_ADD_CONTROL, new ImageView(Icons.ADD_12)); final ObservableList<MenuItem> items = createControlsMenu.getItems(); items.add(new CreateCustomControlAction(nodeTree, this)); if (element.getControl(RigidBodyControl.class) == null) { items.add(new CreateStaticRigidBodyControlAction(nodeTree, this)); items.add(new CreateRigidBodyControlAction(nodeTree, this)); } if (element.getControl(VehicleControl.class) == null) { items.add(new CreateVehicleControlAction(nodeTree, this)); } if (element.getControl(CharacterControl.class) == null) { items.add(new CreateCharacterControlAction(nodeTree, this)); } if (element.getControl(MotionEvent.class) == null) { items.add(new CreateMotionControlAction(nodeTree, this)); } items.add(new CreateLightControlAction(nodeTree, this)); //final SkeletonControl skeletonControl = element.getControl(SkeletonControl.class); //if (skeletonControl != null) { //FIXME items.add(new CreateKinematicRagdollControlAction(nodeTree, this)); //} menu.getItems().add(createControlsMenu); return menu; }
public void addChildren(@Nullable Node... nodes) { if (nodes != null) { for (Node n : nodes) { if (n != null) { n.setParent(this); } } } }
protected TextFieldControl(@Nullable String labelText, ConfigOption<T> option) { fOption = option; Label label = new Label(labelText + ":"); //$NON-NLS-1$ load(); getChildren().addAll(label, fTextField); setAlignment(Pos.CENTER_LEFT); setSpacing(SPACING); }
@Nullable public ParserScope endUntilStartForced() { ParserScope scope = null; if (!scopes.empty()) { scope = scopes.peek(); while (scope != null && scope.scopeType != startExpression) { scopes.pop().end(); scope = getLatestScope(); } } return scope; }
/** * Checks if given {@code AST} element's modifiers contain any of the * {@link TrautePluginSettings#getNotNullAnnotations() NotNull} or * or {@link TrautePluginSettings#getNullableAnnotations() Nullable} annotation. * * @param modifiers {@code AST} element's modifiers to check * @return annotations lookup result */ @NotNull private Annotations findAnnotation(@Nullable ModifiersTree modifiers) { Set<String> annotationsInSource = extractAnnotations(modifiers); if (annotationsInSource.isEmpty()) { return Annotations.EMPTY; } return new Annotations(findMatch(annotationsInSource, context.getPluginSettings().getNotNullAnnotations()), findMatch(annotationsInSource, context.getPluginSettings().getNullableAnnotations())); }
/** returns name identifier, which is valid for reporting */ @Nullable static public PsiElement getNameIdentifier(@Nullable PsiNameIdentifierOwner element) { if (null != element) { PsiElement id = element.getNameIdentifier(); boolean isIdReportable = null != id && id.getTextLength() > 0; return isIdReportable ? id : null; } return null; }
private ExternalProjectRefreshCallback getRefreshDependenciesCbk() { return new ExternalProjectRefreshCallback() { @Override public void onSuccess(@Nullable DataNode<ProjectData> externalProject) { } @Override public void onFailure(@NotNull String errorMessage, @Nullable String errorDetails) { fail(errorMessage + ": " + errorDetails); } }; }
/** * Lazily load the module. */ @Nullable ModuleType getModule() { if (module == null) { createModuleType(); initBindings(); } return module; }
/** * Get an emoji by name. * * @param name The name. * @return An emoji, or null if no name matches. */ @Nullable public static Emoji getByName(String name) { for (Emoji emoji : EMOJIS) { if (emoji.getName().equals(name)) return emoji; } return null; }
@Override protected <T> T invokeSpecial0(@NotNull SAbstractConcept concept, @NotNull SMethod<T> method, @Nullable Object[] parameters) { int methodIndex = BH_METHODS.indexOf(method); if (methodIndex < 0) { throw new BHMethodNotFoundException(this, method); } switch (methodIndex) { default: throw new BHMethodNotFoundException(this, method); } }
/** * Set the selected state rectangle * * @param state * The new selected state. It should ideally be one that's * present in the scenegraph. * @param deselectPrevious * If the previously selected interval should be unmarked as * selected. */ public void setSelectedState(StateRectangle state, boolean deselectPrevious) { @Nullable StateRectangle previousSelectedState = fSelectedState; if (previousSelectedState != null) { previousSelectedState.hideTooltip(); if (deselectPrevious) { previousSelectedState.setSelected(false); } } state.setSelected(true); fSelectedState = state; }
@Override protected <T> T invokeSpecial0(@NotNull SNode node, @NotNull SMethod<T> method, @Nullable Object[] parameters) { int methodIndex = BH_METHODS.indexOf(method); if (methodIndex < 0) { throw new BHMethodNotFoundException(this, method); } switch (methodIndex) { case 0: return (T) ((SNode) GeefOvergang_id2hDGrbWPFpO(node)); default: throw new BHMethodNotFoundException(this, method); } }
private void populateDependenciesTree(ScanTreeNode scanTreeNode, @Nullable JsonNode dependencies) { if (dependencies == null) { return; } dependencies.fields().forEachRemaining(stringJsonNodeEntry -> { String componentId = getComponentId(stringJsonNodeEntry); addSubtree(stringJsonNodeEntry, scanTreeNode, componentId); // Mutual recursive call }); }
@Nullable static Method setMethodAccessible(Method method) { try { if (!method.isAccessible()) method.setAccessible(true); return method; } catch (NullPointerException|SecurityException ignored){} return null; }
@Nullable public static Color findColor(PsiElement element) { Color color = null; //noinspection ConstantConditions if (color == null) color = findInMethodCall(element, ColorARGB); if (color == null) color = findInMethodCall(element, ColorRGB); if (color == null) color = findInMethodCall(element, ColorParseColor); return color; }
@Override @FXThread protected void updateSelection(@Nullable Spatial spatial) { if (spatial instanceof SceneNode || spatial instanceof SceneLayer) { spatial = null; } super.updateSelection(spatial); }
/** * Gets the message link url * @return the message link url or null */ @Nullable public String getMessageLinkUrl() { if (getMessageLink() == null) { return null; } return getMessageLink().getUrl(); }