本文整理汇总了Java中org.eclipse.xtext.xbase.lib.ListExtensions.map方法的典型用法代码示例。如果您正苦于以下问题:Java ListExtensions.map方法的具体用法?Java ListExtensions.map怎么用?Java ListExtensions.map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.xbase.lib.ListExtensions
的用法示例。
在下文中一共展示了ListExtensions.map方法的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: 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;
}
示例3: 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);
}
}
}
示例4: toFileSet
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入方法依赖的package包/类
private TreeSet<CliWizardIntegrationTest.GeneratedFile> toFileSet(final File root) {
TreeSet<CliWizardIntegrationTest.GeneratedFile> _xblockexpression = null;
{
final ArrayList<File> allFiles = CollectionLiterals.<File>newArrayList();
this.collectAllFiles(root, allFiles);
final Function1<File, CliWizardIntegrationTest.GeneratedFile> _function = (File it) -> {
CliWizardIntegrationTest.GeneratedFile _xblockexpression_1 = null;
{
final String relativePath = it.getPath().replace(root.getPath(), "");
_xblockexpression_1 = this.toGeneratedFile(it, relativePath);
}
return _xblockexpression_1;
};
final List<CliWizardIntegrationTest.GeneratedFile> generatedFiles = ListExtensions.<File, CliWizardIntegrationTest.GeneratedFile>map(allFiles, _function);
final Comparator<CliWizardIntegrationTest.GeneratedFile> _function_1 = (CliWizardIntegrationTest.GeneratedFile $0, CliWizardIntegrationTest.GeneratedFile $1) -> {
return ($0.relativePath.compareTo($1.relativePath));
};
final Comparator<CliWizardIntegrationTest.GeneratedFile> sortByPath = _function_1;
_xblockexpression = CollectionLiterals.<CliWizardIntegrationTest.GeneratedFile>newTreeSet(sortByPath, ((CliWizardIntegrationTest.GeneratedFile[])Conversions.unwrapArray(generatedFiles, CliWizardIntegrationTest.GeneratedFile.class)));
}
return _xblockexpression;
}
示例5: pingying
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入方法依赖的package包/类
public static String pingying(final String fullName) {
String _xblockexpression = null;
{
final HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
char[] _charArray = fullName.toCharArray();
final Function1<Character, String> _function = (Character it) -> {
try {
String[] _hanyuPinyinStringArray = PinyinHelper.toHanyuPinyinStringArray((it).charValue(), format);
String _get = null;
if (_hanyuPinyinStringArray!=null) {
_get=_hanyuPinyinStringArray[0];
}
return _get;
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
};
List<String> _map = ListExtensions.<Character, String>map(((List<Character>)Conversions.doWrapArray(_charArray)), _function);
Iterable<String> _filterNull = IterableExtensions.<String>filterNull(_map);
String _join = IterableExtensions.join(_filterNull);
_xblockexpression = _join.replace(":", "");
}
return _xblockexpression;
}
示例6: wordSimilarity
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入方法依赖的package包/类
public static int wordSimilarity(final String first, final String second) {
int _xblockexpression = (int) 0;
{
boolean _equalsIgnoreCase = first.equalsIgnoreCase(second);
if (_equalsIgnoreCase) {
return 1;
}
char[] _charArray = first.toCharArray();
final Function1<Character, Character> _function = (Character it) -> {
return it;
};
final List<Character> firstChars = ListExtensions.<Character, Character>map(((List<Character>)Conversions.doWrapArray(_charArray)), _function);
int orginSize = firstChars.size();
char[] _charArray_1 = second.toCharArray();
firstChars.retainAll(((Collection<?>)Conversions.doWrapArray(_charArray_1)));
int newSize = firstChars.size();
_xblockexpression = (newSize / orginSize);
}
return _xblockexpression;
}
示例7: _foldConstants
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入方法依赖的package包/类
protected static Expression _foldConstants(final ConstantOrFunctionCallExp cofce) {
final ConstantOrFunctionCallExp result = RigidBodiesFactory.eINSTANCE.createConstantOrFunctionCallExp();
String _label = cofce.getLabel();
result.setLabel(_label);
EList<Expression> _param = result.getParam();
EList<Expression> _param_1 = cofce.getParam();
final Function1<Expression, Expression> _function = new Function1<Expression, Expression>() {
@Override
public Expression apply(final Expression p) {
return ExpressionHelper.foldConstants(p);
}
};
List<Expression> _map = ListExtensions.<Expression, Expression>map(_param_1, _function);
_param.addAll(_map);
return result;
}
示例8: byFileTypes
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入方法依赖的package包/类
public static List<ModuleGeneratedDoc> byFileTypes(final String[] fileTypes) {
final Function1<String, ModuleGeneratedDoc> _function = (String it) -> {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("cn.tung.fabricator.back.clazz.");
_builder.append(it, "");
Class<?> _forName = Class.forName(_builder.toString());
Object _newInstance = _forName.newInstance();
return ((ModuleGeneratedDoc) _newInstance);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
};
List<ModuleGeneratedDoc> _map = ListExtensions.<String, ModuleGeneratedDoc>map(((List<String>)Conversions.doWrapArray(fileTypes)), _function);
Iterable<ModuleGeneratedDoc> _filterNull = IterableExtensions.<ModuleGeneratedDoc>filterNull(_map);
return CollectionLiterals.<ModuleGeneratedDoc>newArrayList(((ModuleGeneratedDoc[])Conversions.unwrapArray(_filterNull, ModuleGeneratedDoc.class)));
}
示例9: byOtherFileTypes
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入方法依赖的package包/类
public static List<ModuleGeneratedDoc> byOtherFileTypes(final String[] fileTypes) {
final Function1<String, ModuleGeneratedDoc> _function = (String it) -> {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("cn.tung.fabricator.back.other.");
_builder.append(it, "");
Class<?> _forName = Class.forName(_builder.toString());
Object _newInstance = _forName.newInstance();
return ((ModuleGeneratedDoc) _newInstance);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
};
List<ModuleGeneratedDoc> _map = ListExtensions.<String, ModuleGeneratedDoc>map(((List<String>)Conversions.doWrapArray(fileTypes)), _function);
Iterable<ModuleGeneratedDoc> _filterNull = IterableExtensions.<ModuleGeneratedDoc>filterNull(_map);
return CollectionLiterals.<ModuleGeneratedDoc>newArrayList(((ModuleGeneratedDoc[])Conversions.unwrapArray(_filterNull, ModuleGeneratedDoc.class)));
}
示例10: byPageFileTypes
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入方法依赖的package包/类
public static List<ModuleGeneratedDoc> byPageFileTypes(final String[] fileTypes) {
final Function1<String, ModuleGeneratedDoc> _function = (String it) -> {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("cn.tung.fabricator.back.page.");
_builder.append(it, "");
Class<?> _forName = Class.forName(_builder.toString());
Object _newInstance = _forName.newInstance();
return ((ModuleGeneratedDoc) _newInstance);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
};
List<ModuleGeneratedDoc> _map = ListExtensions.<String, ModuleGeneratedDoc>map(((List<String>)Conversions.doWrapArray(fileTypes)), _function);
Iterable<ModuleGeneratedDoc> _filterNull = IterableExtensions.<ModuleGeneratedDoc>filterNull(_map);
return CollectionLiterals.<ModuleGeneratedDoc>newArrayList(((ModuleGeneratedDoc[])Conversions.unwrapArray(_filterNull, ModuleGeneratedDoc.class)));
}
示例11: klassType
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入方法依赖的package包/类
public static String klassType(final Table table) {
String _xblockexpression = null;
{
String _name = table.getName();
String _substring = _name.substring(2);
String[] _split = _substring.split("_");
final Function1<String, String> _function = (String it) -> {
return StringExtensions.toFirstUpper(it);
};
List<String> _map = ListExtensions.<String, String>map(((List<String>)Conversions.doWrapArray(_split)), _function);
String name = IterableExtensions.join(_map);
boolean _equals = Objects.equal(name, "Enum");
if (_equals) {
name = "EnumCode";
}
_xblockexpression = name;
}
return _xblockexpression;
}
示例12: getPossibleGetterNames
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入方法依赖的package包/类
public List<String> getPossibleGetterNames(final FieldDeclaration it) {
List<String> _xifexpression = null;
final TypeReference _type = it.getType();
final TypeReference _orObject = this.orObject(_type);
final boolean _isBooleanType = this.isBooleanType(_orObject);
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) {
final String _simpleName = it.getSimpleName();
final String _firstUpper = StringExtensions.toFirstUpper(_simpleName);
return (prefix + _firstUpper);
}
};
return ListExtensions.<String, String> map(_xifexpression, _function);
}
示例13: _resolveValueSpecification
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入方法依赖的package包/类
private TValueSpecification _resolveValueSpecification(final Attribute specification, final TAspect to) {
EList<AbstractMessageView> _messageViews = to.getMessageViews();
AbstractMessageView _get = _messageViews.get(0);
final TAbstractMessageView tAbstractMessageView = ((TAbstractMessageView) _get);
EList<TLifeline> _lifelines = tAbstractMessageView.getLifelines();
final Function1<TLifeline,EList<TTemporaryProperty>> _function = new Function1<TLifeline,EList<TTemporaryProperty>>() {
public EList<TTemporaryProperty> apply(final TLifeline it) {
return it.getLocalProperties();
}
};
List<EList<TTemporaryProperty>> _map = ListExtensions.<TLifeline, EList<TTemporaryProperty>>map(_lifelines, _function);
Iterable<TTemporaryProperty> _flatten = Iterables.<TTemporaryProperty>concat(_map);
Iterable<TLocalAttribute> _filter = Iterables.<TLocalAttribute>filter(_flatten, TLocalAttribute.class);
final Function1<TLocalAttribute,Boolean> _function_1 = new Function1<TLocalAttribute,Boolean>() {
public Boolean apply(final TLocalAttribute la) {
String _name = la.getName();
String _name_1 = specification.getName();
return Boolean.valueOf(Objects.equal(_name, _name_1));
}
};
final TLocalAttribute res = IterableExtensions.<TLocalAttribute>findFirst(_filter, _function_1);
return res;
}
示例14: _getAssignToFrom
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入方法依赖的package包/类
private TMessageAssignableFeature _getAssignToFrom(final Attribute feature, final TAspect to, final TClass clazz) {
EList<AbstractMessageView> _messageViews = to.getMessageViews();
AbstractMessageView _get = _messageViews.get(0);
final TAbstractMessageView mv = ((TAbstractMessageView) _get);
EList<TLifeline> _lifelines = mv.getLifelines();
final Function1<TLifeline,EList<TTemporaryProperty>> _function = new Function1<TLifeline,EList<TTemporaryProperty>>() {
public EList<TTemporaryProperty> apply(final TLifeline it) {
return it.getLocalProperties();
}
};
List<EList<TTemporaryProperty>> _map = ListExtensions.<TLifeline, EList<TTemporaryProperty>>map(_lifelines, _function);
Iterable<TTemporaryProperty> _flatten = Iterables.<TTemporaryProperty>concat(_map);
Iterable<TLocalAttribute> _filter = Iterables.<TLocalAttribute>filter(_flatten, TLocalAttribute.class);
final Function1<TLocalAttribute,Boolean> _function_1 = new Function1<TLocalAttribute,Boolean>() {
public Boolean apply(final TLocalAttribute la) {
String _name = la.getName();
String _name_1 = feature.getName();
return Boolean.valueOf(Objects.equal(_name, _name_1));
}
};
final TLocalAttribute res = IterableExtensions.<TLocalAttribute>findFirst(_filter, _function_1);
return res;
}
示例15: getGetTAttributesFromLifelines
import org.eclipse.xtext.xbase.lib.ListExtensions; //导入方法依赖的package包/类
public Iterable<TTemporaryProperty> getGetTAttributesFromLifelines(final Aspect aspect) {
EList<AbstractMessageView> _messageViews = aspect.getMessageViews();
AbstractMessageView _head = IterableExtensions.<AbstractMessageView>head(_messageViews);
final TAbstractMessageView tAbstractMessageView = ((TAbstractMessageView) _head);
boolean _notEquals = (!Objects.equal(tAbstractMessageView, null));
if (_notEquals) {
EList<TLifeline> _lifelines = tAbstractMessageView.getLifelines();
final Function1<TLifeline,EList<TTemporaryProperty>> _function = new Function1<TLifeline,EList<TTemporaryProperty>>() {
public EList<TTemporaryProperty> apply(final TLifeline it) {
return it.getLocalProperties();
}
};
List<EList<TTemporaryProperty>> _map = ListExtensions.<TLifeline, EList<TTemporaryProperty>>map(_lifelines, _function);
return Iterables.<TTemporaryProperty>concat(_map);
}
return null;
}