本文整理汇总了Java中org.eclipse.xtext.xbase.lib.IterableExtensions.forEach方法的典型用法代码示例。如果您正苦于以下问题:Java IterableExtensions.forEach方法的具体用法?Java IterableExtensions.forEach怎么用?Java IterableExtensions.forEach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.xbase.lib.IterableExtensions
的用法示例。
在下文中一共展示了IterableExtensions.forEach方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolvesIdentifiablesTo
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public void resolvesIdentifiablesTo(final String expression, final String... types) {
try {
final String expressionWithQualifiedNames = expression.replace("$$", "org::eclipse::xtext::xbase::lib::");
final XExpression xExpression = this.expression(expressionWithQualifiedNames, false);
final IResolvedTypes resolvedTypes = this.getTypeResolver().resolveTypes(xExpression);
final List<JvmIdentifiableElement> identifiables = this.findIdentifiables(xExpression);
Assert.assertFalse(identifiables.isEmpty());
Assert.assertEquals(((List<String>)Conversions.doWrapArray(types)).size(), identifiables.size());
final Procedure2<JvmIdentifiableElement, Integer> _function = (JvmIdentifiableElement identifiable, Integer index) -> {
final LightweightTypeReference type = resolvedTypes.getActualType(identifiable);
Assert.assertNotNull(type);
StringConcatenation _builder = new StringConcatenation();
_builder.append("failed for identifiable at ");
_builder.append(index);
Assert.assertEquals(_builder.toString(), types[(index).intValue()], type.getSimpleName());
};
IterableExtensions.<JvmIdentifiableElement>forEach(identifiables, _function);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例2: resolvesConstructorCallsTo
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public void resolvesConstructorCallsTo(final String expression, final String... types) {
final String expressionWithQualifiedNames = expression.replace("$$", "org::eclipse::xtext::xbase::lib::");
final List<XConstructorCall> featureCalls = this.findConstructorCalls(expressionWithQualifiedNames);
Assert.assertFalse(featureCalls.isEmpty());
Assert.assertEquals(((List<String>)Conversions.doWrapArray(types)).size(), featureCalls.size());
final IResolvedTypes resolvedTypes = this.getTypeResolver().resolveTypes(IterableExtensions.<XConstructorCall>head(featureCalls));
final Procedure2<XConstructorCall, Integer> _function = (XConstructorCall featureCall, Integer index) -> {
final LightweightTypeReference type = resolvedTypes.getActualType(featureCall);
StringConcatenation _builder = new StringConcatenation();
_builder.append("failed for constructor call at ");
_builder.append(index);
Assert.assertEquals(_builder.toString(), types[(index).intValue()], type.getSimpleName());
};
IterableExtensions.<XConstructorCall>forEach(featureCalls, _function);
}
示例3: resolvesFeatureCallsTo
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public void resolvesFeatureCallsTo(final String expression, final String... types) {
final String expressionWithQualifiedNames = expression.replace("$$", "org::eclipse::xtext::xbase::lib::");
final List<XAbstractFeatureCall> featureCalls = this.findFeatureCalls(expressionWithQualifiedNames);
final IResolvedTypes resolvedTypes = this.getTypeResolver().resolveTypes(IterableExtensions.<XAbstractFeatureCall>head(featureCalls));
final Iterable<XAbstractFeatureCall> actualFeatureCalls = this.filterTypeLiteralsAndPackageFragments(featureCalls);
Assert.assertFalse(IterableExtensions.isEmpty(actualFeatureCalls));
Assert.assertEquals(("" + actualFeatureCalls), ((List<String>)Conversions.doWrapArray(types)).size(), IterableExtensions.size(actualFeatureCalls));
final Procedure2<XAbstractFeatureCall, Integer> _function = (XAbstractFeatureCall featureCall, Integer index) -> {
final LightweightTypeReference type = resolvedTypes.getActualType(featureCall);
StringConcatenation _builder = new StringConcatenation();
_builder.append("failed for feature call at ");
_builder.append(index);
Assert.assertEquals(_builder.toString(), types[(index).intValue()], type.getSimpleName());
};
IterableExtensions.<XAbstractFeatureCall>forEach(actualFeatureCalls, _function);
}
示例4: withEquivalents
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public void withEquivalents(final List<Object> references, final String... types) {
final Procedure2<Object, Integer> _function = (Object reference, Integer index) -> {
final Callable<Object> _function_1 = () -> {
Assert.assertTrue((reference instanceof FunctionTypeReference));
return null;
};
this.collector.<Object>checkSucceeds(_function_1);
final Callable<Object> _function_2 = () -> {
Assert.assertEquals(types[(index).intValue()], this.getEquivalent(((FunctionTypeReference) reference)));
return null;
};
this.collector.<Object>checkSucceeds(_function_2);
};
IterableExtensions.<Object>forEach(references, _function);
}
示例5: hasTypeArguments
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
protected void hasTypeArguments(final XExpression expression, final String... typeArguments) {
final List<LightweightTypeReference> actualTypeArguments = this.resolvedTypes.getActualTypeArguments(expression);
Assert.assertEquals(((List<String>)Conversions.doWrapArray(typeArguments)).size(), actualTypeArguments.size());
final Procedure2<String, Integer> _function = (String typeArgument, Integer i) -> {
StringConcatenation _builder = new StringConcatenation();
String _join = IterableExtensions.join(((Iterable<?>)Conversions.doWrapArray(typeArguments)), ", ");
_builder.append(_join);
_builder.append(" vs ");
final Function1<LightweightTypeReference, String> _function_1 = (LightweightTypeReference it) -> {
return it.getSimpleName();
};
String _join_1 = IterableExtensions.join(ListExtensions.<LightweightTypeReference, String>map(actualTypeArguments, _function_1), ", ");
_builder.append(_join_1);
Assert.assertEquals(_builder.toString(), typeArgument, actualTypeArguments.get((i).intValue()).getSimpleName());
};
IterableExtensions.<String>forEach(((Iterable<String>)Conversions.doWrapArray(typeArguments)), _function);
}
示例6: _assertEqualLinkingData
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
protected void _assertEqualLinkingData(final IClosureCandidate left, final IClosureCandidate right) {
Assert.assertEquals("type", left.getParameters().size(), right.getParameters().size());
final Procedure2<JvmFormalParameter, Integer> _function = (JvmFormalParameter leftParam, Integer idx) -> {
final JvmFormalParameter rightParam = right.getParameters().get((idx).intValue());
Assert.assertEquals(leftParam.getName(), rightParam.getName());
EStructuralFeature _eContainingFeature = leftParam.eContainingFeature();
boolean _notEquals = (!Objects.equal(_eContainingFeature, XbasePackage.Literals.XCLOSURE__DECLARED_FORMAL_PARAMETERS));
if (_notEquals) {
Assert.assertEquals(leftParam.getParameterType().getIdentifier(), rightParam.getParameterType().getIdentifier());
}
};
IterableExtensions.<JvmFormalParameter>forEach(left.getParameters(), _function);
}
示例7: withEquivalents
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public void withEquivalents(final List<Object> references, final String... types) {
final Procedure2<Object, Integer> _function = (Object reference, Integer index) -> {
final Callable<Object> _function_1 = () -> {
Assert.assertTrue((reference instanceof FunctionTypeReference));
return null;
};
this.collector.<Object>checkSucceeds(_function_1);
final Callable<Object> _function_2 = () -> {
Assert.assertEquals(types[(index).intValue()], this.getEquivalent(((FunctionTypeReference) reference)));
return null;
};
this.collector.<Object>checkSucceeds(_function_2);
};
IterableExtensions.<Object>forEach(references, _function);
}
示例8: resolvesStringLiteralsTo
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public void resolvesStringLiteralsTo(final String expression, final String... types) {
final String expressionWithQualifiedNames = expression.replace("$$", "org::eclipse::xtext::xbase::lib::");
final List<XStringLiteral> featureCalls = this.findLiterals(expressionWithQualifiedNames);
Assert.assertFalse(featureCalls.isEmpty());
Assert.assertEquals(((List<String>)Conversions.doWrapArray(types)).size(), featureCalls.size());
final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(IterableExtensions.<XStringLiteral>head(featureCalls));
final Procedure2<XStringLiteral, Integer> _function = (XStringLiteral featureCall, Integer index) -> {
final LightweightTypeReference type = resolvedTypes.getActualType(featureCall);
StringConcatenation _builder = new StringConcatenation();
_builder.append("failed for literal at ");
_builder.append(index);
Assert.assertEquals(_builder.toString(), types[(index).intValue()], type.getSimpleName());
};
IterableExtensions.<XStringLiteral>forEach(featureCalls, _function);
}
示例9: addDeclaredFields
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
* Adds all fields declared directly in the object's class to the output
* @return this
*/
@GwtIncompatible("Class.getDeclaredFields")
public ToStringBuilder addDeclaredFields() {
final Procedure1<Field> _function = new Procedure1<Field>() {
@Override
public void apply(final Field it) {
ToStringBuilder.this.addField(it);
}
};
IterableExtensions.<Field>forEach(((Iterable<Field>)Conversions.doWrapArray(this.instance.getClass().getDeclaredFields())), _function);
return this;
}
示例10: addAllFields
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
* Adds all fields declared in the object's class and its superclasses to the output.
* @return this
*/
@GwtIncompatible("Class.getDeclaredFields")
public ToStringBuilder addAllFields() {
final Procedure1<Field> _function = new Procedure1<Field>() {
@Override
public void apply(final Field it) {
ToStringBuilder.this.addField(it);
}
};
IterableExtensions.<Field>forEach(this.getAllDeclaredFields(this.instance.getClass()), _function);
return this;
}
示例11: doTransform
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public void doTransform(final List<? extends MutableTypeParameterDeclarator> elements, @Extension final TransformationContext context) {
final Procedure1<MutableTypeParameterDeclarator> _function = new Procedure1<MutableTypeParameterDeclarator>() {
@Override
public void apply(final MutableTypeParameterDeclarator it) {
FinalFieldsConstructorProcessor.this.transform(it, context);
}
};
IterableExtensions.forEach(elements, _function);
}
示例12: doTransform
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public void doTransform(final List<? extends MutableMemberDeclaration> elements, @Extension final TransformationContext context) {
final Procedure1<MutableMemberDeclaration> _function = new Procedure1<MutableMemberDeclaration>() {
@Override
public void apply(final MutableMemberDeclaration it) {
AccessorsProcessor.this.transform(it, context);
}
};
IterableExtensions.forEach(elements, _function);
}
示例13: createCompletionList
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public CompletionList createCompletionList(final Document document, final XtextResource resource, final TextDocumentPositionParams params, final CancelIndicator cancelIndicator) {
try {
final CompletionList result = new CompletionList();
result.setIsIncomplete(true);
final IdeContentProposalAcceptor acceptor = this.proposalAcceptorProvider.get();
final int caretOffset = document.getOffSet(params.getPosition());
final Position caretPosition = params.getPosition();
final TextRegion position = new TextRegion(caretOffset, 0);
try {
this.createProposals(document.getContents(), position, caretOffset, resource, acceptor);
} catch (final Throwable _t) {
if (_t instanceof Throwable) {
final Throwable t = (Throwable)_t;
boolean _isOperationCanceledException = this.operationCanceledManager.isOperationCanceledException(t);
boolean _not = (!_isOperationCanceledException);
if (_not) {
throw t;
}
} else {
throw Exceptions.sneakyThrow(_t);
}
}
final Procedure2<ContentAssistEntry, Integer> _function = (ContentAssistEntry it, Integer idx) -> {
final CompletionItem item = this.toCompletionItem(it, caretOffset, caretPosition, document);
item.setSortText(Strings.padStart(Integer.toString((idx).intValue()), 5, '0'));
List<CompletionItem> _items = result.getItems();
_items.add(item);
};
IterableExtensions.<ContentAssistEntry>forEach(acceptor.getEntries(), _function);
return result;
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例14: forEach
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
protected void forEach(Iterable<Integer> input, Procedure2<Integer, Integer> proc) {
IterableExtensions.forEach(input, proc);
}