private static void runOnImplementedCapacities(Skill skill, Procedure1<? super Class<? extends Capacity>> callback) { TypeToken.of(skill.getClass()).getTypes().interfaces().stream().parallel().forEach(it -> { final Class<?> type = it.getRawType(); if (Capacity.class.isAssignableFrom(type) && !Capacity.class.equals(type)) { callback.apply(type.asSubclass(Capacity.class)); } }); }
private void forEach(final NodeList nodes, final Procedure1<? super Node> procedure) { for (int i = 0; (i < nodes.getLength()); i++) { Node _item = nodes.item(i); procedure.apply(_item); } }
public Element element(final Node parent, final String tag, final Procedure1<? super Element> init) { Element _xblockexpression = null; { final Element element = this.document.createElement(tag); init.apply(element); parent.appendChild(element); _xblockexpression = element; } return _xblockexpression; }
@Override public void run() { try { initializer.getValue().apply(initializer.getKey()); } catch (RuntimeException e) { operationCanceledManager.propagateAsErrorIfCancelException(e); LOG.error("Error calling inferrer", e); } } };
public String lookahead(final int offset, final int length, final Procedure1<? super FormattableDocument> format) { String _xblockexpression = null; { final FormattableDocument lookahead = new FormattableDocument(this); format.apply(lookahead); _xblockexpression = lookahead.renderToString(offset, length); } return _xblockexpression; }
protected Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> newFormattingData(final HiddenLeafs leafs, final Procedure1<? super FormattingDataInit> init) { Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> _xblockexpression = null; { final FormattingDataInit data = new FormattingDataInit(); init.apply(data); _xblockexpression = this.newFormattingData(leafs, data.key, data); } return _xblockexpression; }
public FormatterTestRequest preferences(Procedures.Procedure1<MapBasedPreferenceValues> preferences) { MapBasedPreferenceValues map = getOrCreateMapBasedPreferences(); preferences.apply(map); return this; }
public void assertFormatted(Procedure1<FormatterTestRequest> init) { FormatterTestRequest request = formatterRequestProvider.get(); init.apply(request); assertFormatted(request); }
@Override public void apply(final WithExtendsClause it) { EmfParsleyDslFormatter.this.formatFields(e, document); elementsFormatter.apply(e); } };
protected void withOutputConfig(final BuildRequest it, final Procedure1<? super OutputConfiguration> init) { Set<OutputConfiguration> _outputConfigurations = this.configurationProvider.getOutputConfigurations(); final OutputConfiguration config = IterableExtensions.<OutputConfiguration>head(_outputConfigurations); init.apply(config); Pair<String, Set<OutputConfiguration>> _mappedTo = Pair.<String, Set<OutputConfiguration>>of(this.languageName, Collections.<OutputConfiguration>unmodifiableSet(CollectionLiterals.<OutputConfiguration>newHashSet(config))); final OutputConfigurationAdapter adapter = new OutputConfigurationAdapter(Collections.<String, Set<OutputConfiguration>>unmodifiableMap(CollectionLiterals.<String, Set<OutputConfiguration>>newHashMap(_mappedTo))); XtextResourceSet _resourceSet = it.getResourceSet(); EList<Adapter> _eAdapters = _resourceSet.eAdapters(); _eAdapters.add(adapter); }
@Override public void apply() { procedure.apply(argument); } };
/** * @since 2.3 */ public String useProcedureForCharSequence(Procedures.Procedure1<CharSequence> proc) { proc.apply(null); return "done"; }
private <T extends Object> void nullSafeAccess(final JvmGenericType it, final T parent, final Procedure1<? super JvmGenericType> acceptor) { if ((parent != null)) { acceptor.apply(it); } }
@Override public void apply() { procedure.apply(argument); } };
private <Type extends Object> void each(final ResourceSet resourceSet, final Class<Type> type, final Procedure1<? super Type> strategy) { for (int i = 0; (i < resourceSet.getResources().size()); i++) { { final Resource resource = resourceSet.getResources().get(i); final Consumer<Type> _function = (Type it) -> { strategy.apply(it); }; Iterables.<Type>filter(resource.getContents(), type).forEach(_function); } } }
protected void getSymbolLocation(final IEObjectDescription description, final IReferenceFinder.IResourceAccess resourceAccess, final Procedure1<? super Location> acceptor) { final Procedure1<EObject> _function = (EObject obj) -> { final Location location = this.getSymbolLocation(obj); if ((location != null)) { acceptor.apply(location); } }; this.doRead(resourceAccess, description.getEObjectURI(), _function); }
protected <T extends EObject> T initializeSafely(/* @Nullable */ T targetElement, /* @Nullable */ Procedure1<? super T> initializer) { if(targetElement != null && initializer != null) { try { initializer.apply(targetElement); } catch (Exception e) { LOG.error("Error initializing JvmElement", e); } } return targetElement; }
public static <P extends Object, T extends Builder<P>> P operator_doubleGreaterThan( final T object, final Procedure1<? super T> block) { block.apply(object); return object.build(); }
/** Change the expression in the container. * * @param expression the expression. */ public void setXExpression(XExpression expression) { this.expr = expression; this.setter.apply(this.expr); }
/** Change the expression in the container. * * @param expression the textual representation of the expression. */ public void setExpression(String expression) { this.expr = fromString(expression); this.setter.apply(this.expr); }