本文整理汇总了Java中org.eclipse.xtext.xbase.lib.CollectionLiterals.newArrayList方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionLiterals.newArrayList方法的具体用法?Java CollectionLiterals.newArrayList怎么用?Java CollectionLiterals.newArrayList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.xbase.lib.CollectionLiterals
的用法示例。
在下文中一共展示了CollectionLiterals.newArrayList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCodeActions
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
@Override
public List<? extends Command> getCodeActions(final Document document, final XtextResource resource, final CodeActionParams params, final CancelIndicator indicator) {
final ArrayList<Command> commands = CollectionLiterals.<Command>newArrayList();
List<Diagnostic> _diagnostics = params.getContext().getDiagnostics();
for (final Diagnostic d : _diagnostics) {
String _code = d.getCode();
if (_code != null) {
switch (_code) {
case TestLanguageValidator.INVALID_NAME:
Command _fixInvalidName = this.fixInvalidName(d, document, resource, params);
commands.add(_fixInvalidName);
break;
case TestLanguageValidator.UNSORTED_MEMBERS:
Command _fixUnsortedMembers = this.fixUnsortedMembers(d, document, resource, params);
commands.add(_fixUnsortedMembers);
break;
}
}
}
return commands;
}
示例2: getFiles
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
@Override
public Iterable<? extends AbstractFile> getFiles() {
ArrayList<AbstractFile> _xblockexpression = null;
{
final ArrayList<AbstractFile> files = CollectionLiterals.<AbstractFile>newArrayList();
Iterable<? extends AbstractFile> _files = super.getFiles();
Iterables.<AbstractFile>addAll(files, _files);
boolean _isInlined = this.getTestProject().isInlined();
if (_isInlined) {
final Function1<AbstractFile, Boolean> _function = (AbstractFile fileFromTestProject) -> {
final Function1<AbstractFile, Boolean> _function_1 = (AbstractFile it) -> {
String _relativePath = it.getRelativePath();
String _relativePath_1 = fileFromTestProject.getRelativePath();
return Boolean.valueOf(Objects.equal(_relativePath, _relativePath_1));
};
boolean _exists = IterableExtensions.<AbstractFile>exists(files, _function_1);
return Boolean.valueOf((!_exists));
};
Iterable<? extends AbstractFile> _filter = IterableExtensions.filter(this.getTestProject().getFiles(), _function);
Iterables.<AbstractFile>addAll(files, _filter);
}
_xblockexpression = files;
}
return _xblockexpression;
}
示例3: getGrammarConstraints
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public Map<IGrammarConstraintProvider.IConstraint, List<ISerializationContext>> getGrammarConstraints(final Grammar grammar, final EClass clazz) {
final Map<IGrammarConstraintProvider.IConstraint, List<ISerializationContext>> result = CollectionLiterals.<IGrammarConstraintProvider.IConstraint, List<ISerializationContext>>newLinkedHashMap();
final SerializationContextMap<IGrammarConstraintProvider.IConstraint> constraints = this.gcp.getConstraints(grammar);
List<SerializationContextMap.Entry<IGrammarConstraintProvider.IConstraint>> _values = constraints.values();
for (final SerializationContextMap.Entry<IGrammarConstraintProvider.IConstraint> e : _values) {
{
final IGrammarConstraintProvider.IConstraint constraint = e.getValue();
EClass _type = constraint.getType();
boolean _tripleEquals = (_type == clazz);
if (_tripleEquals) {
List<ISerializationContext> contexts = result.get(constraint);
if ((contexts == null)) {
contexts = CollectionLiterals.<ISerializationContext>newArrayList();
result.put(constraint, contexts);
}
contexts.addAll(e.getContexts(clazz));
}
}
}
return result;
}
示例4: subClassAlternatives
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public String subClassAlternatives(final EClass eClazz) {
String _xblockexpression = null;
{
ArrayList<EClass> _newArrayList = CollectionLiterals.<EClass>newArrayList(eClazz);
Iterable<EClass> _subClasses = Ecore2XtextExtensions.subClasses(eClazz);
Iterable<EClass> list = Iterables.<EClass>concat(_newArrayList, _subClasses);
final Function1<EClass, Boolean> _function = (EClass c) -> {
return Boolean.valueOf(Ecore2XtextExtensions.needsConcreteRule(c));
};
list = IterableExtensions.<EClass>filter(list, _function);
final Function1<EClass, String> _function_1 = (EClass it) -> {
return Ecore2XtextExtensions.concreteRuleName(it);
};
_xblockexpression = IterableExtensions.join(IterableExtensions.<EClass, String>map(list, _function_1), " | ");
}
return _xblockexpression;
}
示例5: getFiles
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public Iterable<? extends AbstractFile> getFiles() {
final List<TextFile> files = CollectionLiterals.<TextFile>newArrayList();
boolean _isEclipsePluginProject = this.isEclipsePluginProject();
if (_isEclipsePluginProject) {
PlainTextFile _file = this.file(Outlet.META_INF, "MANIFEST.MF", this.manifest());
files.add(_file);
PlainTextFile _file_1 = this.file(Outlet.ROOT, "build.properties", this.buildProperties());
files.add(_file_1);
}
boolean _isEclipseFeatureProject = this.isEclipseFeatureProject();
if (_isEclipseFeatureProject) {
PlainTextFile _file_2 = this.file(Outlet.ROOT, "build.properties", this.buildProperties());
files.add(_file_2);
}
if ((this.config.needsGradleBuild() && this.isPartOfGradleBuild())) {
GradleBuildFile _buildGradle = this.buildGradle();
files.add(_buildGradle);
}
if ((this.config.needsMavenBuild() && this.isPartOfMavenBuild())) {
PomFile _pom = this.pom();
files.add(_pom);
}
return files;
}
示例6: getSuperClassifiers
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Iterable<? extends TClassifier> getSuperClassifiers() {
final List<TClassifier> result = CollectionLiterals.<TClassifier>newArrayList();
final Object _superClassifierRefs = this.getSuperClassifierRefs();
for (final Object superClassifierRef : ((Iterable<?>) _superClassifierRefs)) {
if ((superClassifierRef != null)) {
final Type declType = ((TypeRef) superClassifierRef).getDeclaredType();
if ((declType instanceof TClassifier)) {
result.add(((TClassifier)declType));
}
}
}
return result;
}
示例7: applyRuleSubstTypeVariablesInComposedTypeRef
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
protected Result<TypeArgument> applyRuleSubstTypeVariablesInComposedTypeRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ComposedTypeRef typeRef) throws RuleFailedException {
ComposedTypeRef result = null; // output parameter
boolean haveReplacement = false;
final ArrayList<TypeRef> substTypeRefs = CollectionLiterals.<TypeRef>newArrayList();
EList<TypeRef> _typeRefs = typeRef.getTypeRefs();
for (final TypeRef currTypeRef : _typeRefs) {
/* G |- currTypeRef ~> var TypeRef substTypeRef */
TypeRef substTypeRef = null;
Result<TypeArgument> result_1 = substTypeVariablesInternal(G, _trace_, currTypeRef);
checkAssignableTo(result_1.getFirst(), TypeRef.class);
substTypeRef = (TypeRef) result_1.getFirst();
boolean _add = substTypeRefs.add(substTypeRef);
/* substTypeRefs.add(substTypeRef) */
if (!_add) {
sneakyThrowRuleFailedException("substTypeRefs.add(substTypeRef)");
}
haveReplacement = (haveReplacement || (substTypeRef != currTypeRef));
}
if (haveReplacement) {
result = TypeUtils.<ComposedTypeRef>copy(typeRef);
result.getTypeRefs().clear();
/* result.typeRefs.addAll(TypeUtils.copyAll(substTypeRefs)) */
if (!result.getTypeRefs().addAll(TypeUtils.<TypeRef>copyAll(substTypeRefs))) {
sneakyThrowRuleFailedException("result.typeRefs.addAll(TypeUtils.copyAll(substTypeRefs))");
}
} else {
result = typeRef;
}
return new Result<TypeArgument>(result);
}
示例8: testResourcesAreClearedWithDeliverFalse_01
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
@Test
public void testResourcesAreClearedWithDeliverFalse_01() {
final XtextResourceSet rs = this.createEmptyResourceSet();
Assert.assertEquals(0, rs.getURIResourceMap().size());
final XtextResource resource = new XtextResource();
resource.setURI(URI.createFileURI(new File("foo").getAbsolutePath()));
EList<Resource> _resources = rs.getResources();
ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
Iterables.<Resource>addAll(_resources, _newArrayList);
Assert.assertEquals(1, rs.getURIResourceMap().size());
rs.eSetDeliver(false);
rs.getResources().clear();
Assert.assertTrue(resource.eAdapters().isEmpty());
Assert.assertEquals(0, rs.getURIResourceMap().size());
}
示例9: doInitialBuild
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public IncrementalBuilder.Result doInitialBuild(final CancelIndicator cancelIndicator) {
final ArrayList<URI> uris = CollectionLiterals.<URI>newArrayList();
final Consumer<ISourceFolder> _function = (ISourceFolder it) -> {
final IAcceptor<URI> _function_1 = (URI it_1) -> {
uris.add(it_1);
};
this.fileSystemScanner.scan(it.getPath(), _function_1);
};
this.projectConfig.getSourceFolders().forEach(_function);
return this.doBuild(uris, CollectionLiterals.<URI>emptyList(), CollectionLiterals.<IResourceDescription.Delta>emptyList(), cancelIndicator);
}
示例10: getEnabledProjects
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
@Override
public List<? extends SubProjectConfig> getEnabledProjects() {
ArrayList<SubProjectConfig> _xblockexpression = null;
{
final ArrayList<SubProjectConfig> enabledProjects = CollectionLiterals.<SubProjectConfig>newArrayList();
final Function1<SubProjectConfig, Boolean> _function = (SubProjectConfig it) -> {
return Boolean.valueOf(it.isEnabled());
};
Iterable<? extends SubProjectConfig> _filter = IterableExtensions.filter(this.getAllProjects(), _function);
Iterables.<SubProjectConfig>addAll(enabledProjects, _filter);
_xblockexpression = enabledProjects;
}
return _xblockexpression;
}
示例11: getFiles
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
@Override
public Iterable<? extends AbstractFile> getFiles() {
final ArrayList<AbstractFile> files = CollectionLiterals.<AbstractFile>newArrayList();
Iterable<? extends AbstractFile> _files = super.getFiles();
Iterables.<AbstractFile>addAll(files, _files);
boolean _needsGradleBuild = this.getConfig().needsGradleBuild();
if (_needsGradleBuild) {
PlainTextFile _file = this.file(Outlet.ROOT, "settings.gradle", this.settingsGradle());
files.add(_file);
PlainTextFile _file_1 = this.file(Outlet.ROOT, "gradle/source-layout.gradle", this.sourceLayoutGradle());
files.add(_file_1);
PlainTextFile _file_2 = this.file(Outlet.ROOT, "gradle/maven-deployment.gradle", this.mavenDeploymentGradle());
files.add(_file_2);
boolean _isNeedsGradleWrapper = this.getConfig().isNeedsGradleWrapper();
if (_isNeedsGradleWrapper) {
PlainTextFile _file_3 = this.file(Outlet.ROOT, "gradlew", this.loadResource("gradlew/gradlew"), true);
files.add(_file_3);
PlainTextFile _file_4 = this.file(Outlet.ROOT, "gradlew.bat", this.loadResource("gradlew/gradlew.bat"));
files.add(_file_4);
PlainTextFile _file_5 = this.file(Outlet.ROOT, "gradle/wrapper/gradle-wrapper.properties", this.loadResource("gradlew/gradle-wrapper.properties"));
files.add(_file_5);
BinaryFile _binaryFile = this.binaryFile(Outlet.ROOT, "gradle/wrapper/gradle-wrapper.jar", this.getClass().getClassLoader().getResource("gradlew/gradle-wrapper.jar"));
files.add(_binaryFile);
}
}
return files;
}
示例12: surround
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> surround(final INode node, final Procedure1<? super FormattingDataInit> before, final Procedure1<? super FormattingDataInit> after) {
final Function1<FormattableDocument, Iterable<FormattingData>> _function = (FormattableDocument doc) -> {
ArrayList<FormattingData> _xblockexpression = null;
{
final ArrayList<FormattingData> result = CollectionLiterals.<FormattingData>newArrayList();
if ((node != null)) {
Iterable<FormattingData> _elvis = null;
Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> _newFormattingData = this.newFormattingData(this._hiddenLeafAccess.getHiddenLeafsBefore(node), before);
Iterable<FormattingData> _apply = null;
if (_newFormattingData!=null) {
_apply=_newFormattingData.apply(doc);
}
if (_apply != null) {
_elvis = _apply;
} else {
List<FormattingData> _emptyList = CollectionLiterals.<FormattingData>emptyList();
_elvis = _emptyList;
}
Iterables.<FormattingData>addAll(result, _elvis);
Iterable<FormattingData> _elvis_1 = null;
Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> _newFormattingData_1 = this.newFormattingData(this._hiddenLeafAccess.getHiddenLeafsAfter(node), after);
Iterable<FormattingData> _apply_1 = null;
if (_newFormattingData_1!=null) {
_apply_1=_newFormattingData_1.apply(doc);
}
if (_apply_1 != null) {
_elvis_1 = _apply_1;
} else {
List<FormattingData> _emptyList_1 = CollectionLiterals.<FormattingData>emptyList();
_elvis_1 = _emptyList_1;
}
Iterables.<FormattingData>addAll(result, _elvis_1);
}
_xblockexpression = result;
}
return _xblockexpression;
};
return _function;
}
示例13: TypeReference
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public TypeReference(final Class<?> clazz, final List<TypeReference> arguments) {
boolean _isPrimitive = clazz.isPrimitive();
if (_isPrimitive) {
String _name = clazz.getName();
String _plus = ("Type is primitive: " + _name);
throw new IllegalArgumentException(_plus);
}
boolean _isAnonymousClass = clazz.isAnonymousClass();
if (_isAnonymousClass) {
String _name_1 = clazz.getName();
String _plus_1 = ("Class is anonymous: " + _name_1);
throw new IllegalArgumentException(_plus_1);
}
boolean _isLocalClass = clazz.isLocalClass();
if (_isLocalClass) {
String _name_2 = clazz.getName();
String _plus_2 = ("Class is local: " + _name_2);
throw new IllegalArgumentException(_plus_2);
}
this.packageName = clazz.getPackage().getName();
this.simpleNames = CollectionLiterals.<String>newArrayList();
List<TypeReference> _elvis = null;
if (arguments != null) {
_elvis = arguments;
} else {
List<TypeReference> _emptyList = Collections.<TypeReference>emptyList();
_elvis = _emptyList;
}
this.typeArguments = _elvis;
Class<?> c = clazz;
do {
{
this.simpleNames.add(0, c.getSimpleName());
c = c.getDeclaringClass();
}
} while((c != null));
}
示例14: getFiles
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
@Override
public Iterable<? extends AbstractFile> getFiles() {
ArrayList<AbstractFile> _xblockexpression = null;
{
final ArrayList<AbstractFile> files = CollectionLiterals.<AbstractFile>newArrayList();
Iterable<? extends AbstractFile> _files = super.getFiles();
Iterables.<AbstractFile>addAll(files, _files);
String _name = this.getName();
String _plus = (_name + ".target");
PlainTextFile _file = this.file(Outlet.ROOT, _plus, this.target());
files.add(_file);
_xblockexpression = files;
}
return _xblockexpression;
}
示例15: doInitialBuild
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public List<IResourceDescription.Delta> doInitialBuild(final List<ProjectDescription> projects, final CancelIndicator indicator) {
final List<ProjectDescription> sortedDescriptions = this.sortByDependencies(projects);
final ArrayList<IResourceDescription.Delta> result = CollectionLiterals.<IResourceDescription.Delta>newArrayList();
for (final ProjectDescription description : sortedDescriptions) {
{
final IncrementalBuilder.Result partialresult = this.workspaceManager.getProjectManager(description.getName()).doInitialBuild(indicator);
result.addAll(partialresult.getAffectedResources());
}
}
return result;
}