本文整理汇总了Java中org.eclipse.xtext.xbase.lib.ListExtensions类的典型用法代码示例。如果您正苦于以下问题:Java ListExtensions类的具体用法?Java ListExtensions怎么用?Java ListExtensions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListExtensions类属于org.eclipse.xtext.xbase.lib包,在下文中一共展示了ListExtensions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: map
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
public static List<Ddl2Bean.Klass> map(final Table table) {
Column[] _columns = table.getColumns();
final Function1<Column, Ddl2Bean.Klass> _function = (Column column) -> {
Ddl2Bean.Klass _xblockexpression = null;
{
String _type = column.getType();
String type = Ddl2Bean.fieldType(_type);
String columnName = column.getName();
String _name = column.getName();
String[] _split = _name.split("_");
final Function1<String, String> _function_1 = (String it) -> {
return StringExtensions.toFirstUpper(it);
};
List<String> _map = ListExtensions.<String, String>map(((List<String>)Conversions.doWrapArray(_split)), _function_1);
String _join = IterableExtensions.join(_map);
String name = StringExtensions.toFirstLower(_join);
String comment = column.getDescription();
_xblockexpression = new Ddl2Bean.Klass(type, name, columnName, comment);
}
return _xblockexpression;
};
return ListExtensions.<Column, Ddl2Bean.Klass>map(((List<Column>)Conversions.doWrapArray(_columns)), _function);
}
示例2: applyRuleUpperBoundUnionTypeExpression
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
protected Result<TypeRef> applyRuleUpperBoundUnionTypeExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final UnionTypeExpression U) throws RuleFailedException {
TypeRef T = null; // output parameter
final Function1<TypeRef, TypeRef> _function = (TypeRef it) -> {
TypeRef _xblockexpression = null;
{
TypeRef E = null;
/* G|~ it /\ E */
Result<TypeRef> result = upperBoundInternal(G, _trace_, it);
checkAssignableTo(result.getFirst(), TypeRef.class);
E = (TypeRef) result.getFirst();
_xblockexpression = E;
}
return _xblockexpression;
};
T = TypeUtils.createNonSimplifiedUnionType(
ListExtensions.<TypeRef, TypeRef>map(U.getTypeRefs(), _function));
TypeUtils.copyTypeModifiers(T, U);
return new Result<TypeRef>(T);
}
示例3: applyRuleUpperBoundIntersectionTypeExpression
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
protected Result<TypeRef> applyRuleUpperBoundIntersectionTypeExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final IntersectionTypeExpression I) throws RuleFailedException {
TypeRef T = null; // output parameter
final Function1<TypeRef, TypeRef> _function = (TypeRef it) -> {
TypeRef _xblockexpression = null;
{
TypeRef E = null;
/* G|~ it /\ E */
Result<TypeRef> result = upperBoundInternal(G, _trace_, it);
checkAssignableTo(result.getFirst(), TypeRef.class);
E = (TypeRef) result.getFirst();
_xblockexpression = E;
}
return _xblockexpression;
};
T = TypeUtils.createNonSimplifiedIntersectionType(
ListExtensions.<TypeRef, TypeRef>map(I.getTypeRefs(), _function));
TypeUtils.copyTypeModifiers(T, I);
return new Result<TypeRef>(T);
}
示例4: applyRuleLowerBoundUnionTypeExpression
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
protected Result<TypeRef> applyRuleLowerBoundUnionTypeExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final UnionTypeExpression U) throws RuleFailedException {
TypeRef T = null; // output parameter
final Function1<TypeRef, TypeRef> _function = (TypeRef it) -> {
TypeRef _xblockexpression = null;
{
TypeRef E = null;
/* G|~ it \/ E */
Result<TypeRef> result = lowerBoundInternal(G, _trace_, it);
checkAssignableTo(result.getFirst(), TypeRef.class);
E = (TypeRef) result.getFirst();
_xblockexpression = E;
}
return _xblockexpression;
};
T = TypeUtils.createNonSimplifiedUnionType(
ListExtensions.<TypeRef, TypeRef>map(U.getTypeRefs(), _function));
TypeUtils.copyTypeModifiers(T, U);
return new Result<TypeRef>(T);
}
示例5: applyRuleLowerBoundIntersectionTypeExpression
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
protected Result<TypeRef> applyRuleLowerBoundIntersectionTypeExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final IntersectionTypeExpression I) throws RuleFailedException {
TypeRef T = null; // output parameter
final Function1<TypeRef, TypeRef> _function = (TypeRef it) -> {
TypeRef _xblockexpression = null;
{
TypeRef E = null;
/* G|~ it \/ E */
Result<TypeRef> result = lowerBoundInternal(G, _trace_, it);
checkAssignableTo(result.getFirst(), TypeRef.class);
E = (TypeRef) result.getFirst();
_xblockexpression = E;
}
return _xblockexpression;
};
T = TypeUtils.createNonSimplifiedIntersectionType(
ListExtensions.<TypeRef, TypeRef>map(I.getTypeRefs(), _function));
TypeUtils.copyTypeModifiers(T, I);
return new Result<TypeRef>(T);
}
示例6: findType
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
@Override
public NameEnvironmentAnswer findType(final char[][] compoundTypeName) {
try {
final Function1<char[], String> _function = (char[] it) -> {
return String.valueOf(it);
};
String _join = IterableExtensions.join(ListExtensions.<char[], String>map(((List<char[]>)Conversions.doWrapArray(compoundTypeName)), _function), "/");
final String fileName = (_join + ".class");
boolean _containsKey = this.cache.containsKey(fileName);
if (_containsKey) {
return this.cache.get(fileName);
}
final URL url = this.classLoader.getResource(fileName);
if ((url == null)) {
this.cache.put(fileName, null);
return null;
}
final ClassFileReader reader = ClassFileReader.read(url.openStream(), fileName);
final NameEnvironmentAnswer result = new NameEnvironmentAnswer(reader, null);
this.cache.put(fileName, result);
return result;
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例7: getExtensionClasses
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
protected List<Class<?>> getExtensionClasses() {
return Lists.<Class<?>> newArrayList(
ArrayExtensions.class,
BigDecimalExtensions.class,
BigIntegerExtensions.class,
BooleanExtensions.class,
ByteExtensions.class,
CharacterExtensions.class,
CollectionExtensions.class,
ComparableExtensions.class,
DoubleExtensions.class,
FloatExtensions.class,
FunctionExtensions.class,
IntegerExtensions.class,
IterableExtensions.class,
IteratorExtensions.class,
ListExtensions.class,
LongExtensions.class,
MapExtensions.class,
ObjectExtensions.class,
ProcedureExtensions.class,
ShortExtensions.class,
StringExtensions.class);
}
示例8: hasTypeArguments
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的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);
}
示例9: getURIs
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
public static List<URI> getURIs(final EStructuralFeature.Setting setting) {
List<URI> _switchResult = null;
Object _get = setting.get(false);
final Object it = _get;
boolean _matched = false;
if (it instanceof EObject) {
_matched=true;
_switchResult = CollectionLiterals.<URI>newImmutableList(EcoreUtil.getURI(((EObject)it)));
}
if (!_matched) {
if (it instanceof List) {
_matched=true;
final Function1<EObject, URI> _function = (EObject it_1) -> {
return EcoreUtil.getURI(it_1);
};
_switchResult = ListExtensions.<EObject, URI>map(((List<EObject>)it), _function);
}
}
return _switchResult;
}
示例10: getPossibleGetterNames
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
public List<String> getPossibleGetterNames(final FieldDeclaration it) {
final ArrayList<String> names = CollectionLiterals.<String>newArrayList();
if ((((this.isBooleanType(this.orObject(it.getType())) && it.getSimpleName().startsWith("is")) && (it.getSimpleName().length() > 2)) && Character.isUpperCase(it.getSimpleName().charAt(2)))) {
String _simpleName = it.getSimpleName();
names.add(_simpleName);
}
List<String> _xifexpression = null;
boolean _isBooleanType = this.isBooleanType(this.orObject(it.getType()));
if (_isBooleanType) {
_xifexpression = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("is", "get"));
} else {
_xifexpression = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("get"));
}
final Function1<String, String> _function = new Function1<String, String>() {
@Override
public String apply(final String prefix) {
String _firstUpper = StringExtensions.toFirstUpper(it.getSimpleName());
return (prefix + _firstUpper);
}
};
names.addAll(ListExtensions.<String, String>map(_xifexpression, _function));
return names;
}
示例11: leafsBackwards
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
protected Iterable<IGeneratorNode> leafsBackwards(final IGeneratorNode it) {
Iterable<IGeneratorNode> _switchResult = null;
boolean _matched = false;
if (it instanceof CompositeGeneratorNode) {
_matched=true;
final Function1<IGeneratorNode, Iterable<IGeneratorNode>> _function = (IGeneratorNode it_1) -> {
return this.leafsBackwards(it_1);
};
final Function2<Iterable<IGeneratorNode>, Iterable<IGeneratorNode>, Iterable<IGeneratorNode>> _function_1 = (Iterable<IGeneratorNode> p1, Iterable<IGeneratorNode> p2) -> {
return Iterables.<IGeneratorNode>concat(p1, p2);
};
_switchResult = IterableExtensions.<Iterable<IGeneratorNode>>reduce(ListExtensions.<IGeneratorNode, Iterable<IGeneratorNode>>map(ListExtensions.<IGeneratorNode>reverseView(((CompositeGeneratorNode)it).getChildren()), _function), _function_1);
}
if (!_matched) {
_switchResult = Collections.<IGeneratorNode>unmodifiableList(CollectionLiterals.<IGeneratorNode>newArrayList(it));
}
return _switchResult;
}
示例12: appendImmediate
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
@Override
public void appendImmediate(final Object object, final String indentation) {
final ArrayList<IGeneratorNode> removed = Lists.<IGeneratorNode>newArrayList();
for (int i = (this.currentParent.getChildren().size() - 1); (i >= 0); i--) {
{
final IGeneratorNode node = this.currentParent.getChildren().get(i);
if (((node instanceof TextNode) && (!TemplateNode.hasContent(((TextNode) node).getText())))) {
IGeneratorNode _remove = this.currentParent.getChildren().remove(i);
removed.add(_remove);
} else {
if ((node instanceof NewLineNode)) {
IGeneratorNode _remove_1 = this.currentParent.getChildren().remove(i);
removed.add(_remove_1);
} else {
this.append(object, indentation);
final Consumer<IGeneratorNode> _function = (IGeneratorNode it) -> {
this.append(it, indentation);
};
ListExtensions.<IGeneratorNode>reverse(removed).forEach(_function);
return;
}
}
}
}
this.append(object, indentation);
}
示例13: setHiddenTokens
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
private void setHiddenTokens(final Grammar copy, final Grammar orig, final Map<RuleWithParameterValues, AbstractRule> origToCopy) {
if ((orig == null)) {
copy.setDefinesHiddenTokens(true);
} else {
boolean _isDefinesHiddenTokens = orig.isDefinesHiddenTokens();
boolean _not = (!_isDefinesHiddenTokens);
if (_not) {
this.setHiddenTokens(copy, IterableExtensions.<Grammar>head(orig.getUsedGrammars()), origToCopy);
} else {
copy.setDefinesHiddenTokens(true);
EList<AbstractRule> _hiddenTokens = copy.getHiddenTokens();
final Function1<AbstractRule, AbstractRule> _function = (AbstractRule hidden) -> {
RuleWithParameterValues _ruleWithParameterValues = new RuleWithParameterValues(hidden);
return origToCopy.get(_ruleWithParameterValues);
};
List<AbstractRule> _map = ListExtensions.<AbstractRule, AbstractRule>map(orig.getHiddenTokens(), _function);
Iterables.<AbstractRule>addAll(_hiddenTokens, _map);
}
}
}
示例14: initialHiddenTokens
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
public List<String> initialHiddenTokens(final Grammar it) {
List<String> _xblockexpression = null;
{
boolean _isDefinesHiddenTokens = it.isDefinesHiddenTokens();
if (_isDefinesHiddenTokens) {
final Function1<AbstractRule, String> _function = (AbstractRule it_1) -> {
return this.ruleName(it_1);
};
return IterableExtensions.<String>toList(ListExtensions.<AbstractRule, String>map(it.getHiddenTokens(), _function));
}
int _size = it.getUsedGrammars().size();
boolean _equals = (_size == 1);
if (_equals) {
return this.initialHiddenTokens(IterableExtensions.<Grammar>head(it.getUsedGrammars()));
}
_xblockexpression = CollectionLiterals.<String>emptyList();
}
return _xblockexpression;
}
示例15: getFQFeatureNamesToExclude
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入依赖的package包/类
public Set<String> getFQFeatureNamesToExclude(final Grammar g) {
Set<String> _xifexpression = null;
Grammar _nonTerminalsSuperGrammar = GrammarUtil2.getNonTerminalsSuperGrammar(g);
boolean _tripleNotEquals = (_nonTerminalsSuperGrammar != null);
if (_tripleNotEquals) {
Sets.SetView<String> _xblockexpression = null;
{
final Set<String> thisGrammarFqFeatureNames = IterableExtensions.<String>toSet(this.computeFQFeatureNames(g));
final Function1<Grammar, Iterable<String>> _function = (Grammar it) -> {
return this.computeFQFeatureNames(it);
};
final Set<String> superGrammarsFqFeatureNames = IterableExtensions.<String>toSet(Iterables.<String>concat(ListExtensions.<Grammar, Iterable<String>>map(GrammarUtil.allUsedGrammars(g), _function)));
_xblockexpression = Sets.<String>intersection(thisGrammarFqFeatureNames, superGrammarsFqFeatureNames);
}
_xifexpression = _xblockexpression;
} else {
_xifexpression = CollectionLiterals.<String>emptySet();
}
return _xifexpression;
}