repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.generateJvmElements | protected void generateJvmElements(ResourceSet resourceSet, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_21);
getLogger().info(Messages.SarlBatchCompiler_21);
final List<Resource> originalResources = resourceSet.getResources();
final List<Resource> toBeResolved = new ArrayList<>(originalResources.size());
for (final Resource resource : originalResources) {
if (progress.isCanceled()) {
return;
}
if (isSourceFile(resource)) {
toBeResolved.add(resource);
}
}
for (final Resource resource : toBeResolved) {
if (progress.isCanceled()) {
return;
}
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_26, resource.getURI().lastSegment());
}
EcoreUtil.resolveAll(resource);
EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
}
} | java | protected void generateJvmElements(ResourceSet resourceSet, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_21);
getLogger().info(Messages.SarlBatchCompiler_21);
final List<Resource> originalResources = resourceSet.getResources();
final List<Resource> toBeResolved = new ArrayList<>(originalResources.size());
for (final Resource resource : originalResources) {
if (progress.isCanceled()) {
return;
}
if (isSourceFile(resource)) {
toBeResolved.add(resource);
}
}
for (final Resource resource : toBeResolved) {
if (progress.isCanceled()) {
return;
}
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_26, resource.getURI().lastSegment());
}
EcoreUtil.resolveAll(resource);
EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
}
} | [
"protected",
"void",
"generateJvmElements",
"(",
"ResourceSet",
"resourceSet",
",",
"IProgressMonitor",
"progress",
")",
"{",
"assert",
"progress",
"!=",
"null",
";",
"progress",
".",
"subTask",
"(",
"Messages",
".",
"SarlBatchCompiler_21",
")",
";",
"getLogger",
... | Generate the JVM model elements.
@param progress monitor of the progress of the compilation.
@param resourceSet the container of the scripts. | [
"Generate",
"the",
"JVM",
"model",
"elements",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1570-L1595 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.validate | @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity", "checkstyle:nestedifdepth"})
protected List<Issue> validate(ResourceSet resourceSet, Collection<Resource> validResources, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_38);
getLogger().info(Messages.SarlBatchCompiler_38);
final List<Resource> resources = new LinkedList<>(resourceSet.getResources());
final List<Issue> issuesToReturn = new ArrayList<>();
for (final Resource resource : resources) {
if (progress.isCanceled()) {
return issuesToReturn;
}
if (isSourceFile(resource)) {
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_22, resource.getURI().lastSegment());
}
final IResourceServiceProvider resourceServiceProvider = IResourceServiceProvider.Registry.INSTANCE
.getResourceServiceProvider(resource.getURI());
if (resourceServiceProvider != null) {
final IResourceValidator resourceValidator = resourceServiceProvider.getResourceValidator();
final List<Issue> result = resourceValidator.validate(resource, CheckMode.ALL, null);
if (progress.isCanceled()) {
return issuesToReturn;
}
final SortedSet<Issue> issues = new TreeSet<>(getIssueComparator());
boolean hasValidationError = false;
for (final Issue issue : result) {
if (progress.isCanceled()) {
return issuesToReturn;
}
if (issue.isSyntaxError() || issue.getSeverity() == Severity.ERROR) {
hasValidationError = true;
}
issues.add(issue);
}
if (!hasValidationError) {
if (!issues.isEmpty()) {
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_39, resource.getURI().lastSegment());
}
issuesToReturn.addAll(issues);
}
validResources.add(resource);
} else {
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_39, resource.getURI().lastSegment());
}
issuesToReturn.addAll(issues);
}
}
}
}
return issuesToReturn;
} | java | @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity", "checkstyle:nestedifdepth"})
protected List<Issue> validate(ResourceSet resourceSet, Collection<Resource> validResources, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_38);
getLogger().info(Messages.SarlBatchCompiler_38);
final List<Resource> resources = new LinkedList<>(resourceSet.getResources());
final List<Issue> issuesToReturn = new ArrayList<>();
for (final Resource resource : resources) {
if (progress.isCanceled()) {
return issuesToReturn;
}
if (isSourceFile(resource)) {
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_22, resource.getURI().lastSegment());
}
final IResourceServiceProvider resourceServiceProvider = IResourceServiceProvider.Registry.INSTANCE
.getResourceServiceProvider(resource.getURI());
if (resourceServiceProvider != null) {
final IResourceValidator resourceValidator = resourceServiceProvider.getResourceValidator();
final List<Issue> result = resourceValidator.validate(resource, CheckMode.ALL, null);
if (progress.isCanceled()) {
return issuesToReturn;
}
final SortedSet<Issue> issues = new TreeSet<>(getIssueComparator());
boolean hasValidationError = false;
for (final Issue issue : result) {
if (progress.isCanceled()) {
return issuesToReturn;
}
if (issue.isSyntaxError() || issue.getSeverity() == Severity.ERROR) {
hasValidationError = true;
}
issues.add(issue);
}
if (!hasValidationError) {
if (!issues.isEmpty()) {
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_39, resource.getURI().lastSegment());
}
issuesToReturn.addAll(issues);
}
validResources.add(resource);
} else {
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_39, resource.getURI().lastSegment());
}
issuesToReturn.addAll(issues);
}
}
}
}
return issuesToReturn;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"checkstyle:cyclomaticcomplexity\"",
",",
"\"checkstyle:npathcomplexity\"",
",",
"\"checkstyle:nestedifdepth\"",
"}",
")",
"protected",
"List",
"<",
"Issue",
">",
"validate",
"(",
"ResourceSet",
"resourceSet",
",",
"Collection",
"<",
... | Generate the JVM model elements, and validate generated elements.
@param resourceSet the container of the scripts.
@param validResources will be filled by this function with the collection of resources that was successfully validated.
@param progress monitor of the progress of the compilation.
@return the list of the issues. | [
"Generate",
"the",
"JVM",
"model",
"elements",
"and",
"validate",
"generated",
"elements",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1604-L1656 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.isSourceFile | @SuppressWarnings("static-method")
protected boolean isSourceFile(Resource resource) {
if (resource instanceof BatchLinkableResource) {
return !((BatchLinkableResource) resource).isLoadedFromStorage();
}
return false;
} | java | @SuppressWarnings("static-method")
protected boolean isSourceFile(Resource resource) {
if (resource instanceof BatchLinkableResource) {
return !((BatchLinkableResource) resource).isLoadedFromStorage();
}
return false;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"boolean",
"isSourceFile",
"(",
"Resource",
"resource",
")",
"{",
"if",
"(",
"resource",
"instanceof",
"BatchLinkableResource",
")",
"{",
"return",
"!",
"(",
"(",
"BatchLinkableResource",
")",
"r... | Replies if the given resource is a script.
@param resource the resource to test.
@return <code>true</code> if the given resource is a script. | [
"Replies",
"if",
"the",
"given",
"resource",
"is",
"a",
"script",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1663-L1669 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.preCompileStubs | protected boolean preCompileStubs(File sourceDirectory, File classDirectory, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_50);
return runJavaCompiler(classDirectory, Collections.singletonList(sourceDirectory), getClassPath(),
false, false, progress);
} | java | protected boolean preCompileStubs(File sourceDirectory, File classDirectory, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_50);
return runJavaCompiler(classDirectory, Collections.singletonList(sourceDirectory), getClassPath(),
false, false, progress);
} | [
"protected",
"boolean",
"preCompileStubs",
"(",
"File",
"sourceDirectory",
",",
"File",
"classDirectory",
",",
"IProgressMonitor",
"progress",
")",
"{",
"assert",
"progress",
"!=",
"null",
";",
"progress",
".",
"subTask",
"(",
"Messages",
".",
"SarlBatchCompiler_50"... | Compile the stub files before the compilation of the project's files.
@param sourceDirectory the source directory where stubs are stored.
@param classDirectory the output directory, where stub binary files should be generated.
@param progress monitor of the progress of the compilation.
@return the success status. Replies <code>false</code> if the activity is canceled. | [
"Compile",
"the",
"stub",
"files",
"before",
"the",
"compilation",
"of",
"the",
"project",
"s",
"files",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1678-L1683 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.preCompileJava | protected boolean preCompileJava(File sourceDirectory, File classDirectory, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_51);
return runJavaCompiler(classDirectory, getSourcePaths(),
Iterables.concat(Collections.singleton(sourceDirectory), getClassPath()),
false, true, progress);
} | java | protected boolean preCompileJava(File sourceDirectory, File classDirectory, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_51);
return runJavaCompiler(classDirectory, getSourcePaths(),
Iterables.concat(Collections.singleton(sourceDirectory), getClassPath()),
false, true, progress);
} | [
"protected",
"boolean",
"preCompileJava",
"(",
"File",
"sourceDirectory",
",",
"File",
"classDirectory",
",",
"IProgressMonitor",
"progress",
")",
"{",
"assert",
"progress",
"!=",
"null",
";",
"progress",
".",
"subTask",
"(",
"Messages",
".",
"SarlBatchCompiler_51",... | Compile the java files before the compilation of the project's files.
@param sourceDirectory the source directory where java files are stored.
@param classDirectory the output directory, where binary files should be generated.
@param progress monitor of the progress of the compilation.
@return the success status. Replies <code>false</code> if the activity is canceled. | [
"Compile",
"the",
"java",
"files",
"before",
"the",
"compilation",
"of",
"the",
"project",
"s",
"files",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1692-L1698 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.postCompileJava | protected boolean postCompileJava(IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_52);
final File classOutputPath = getClassOutputPath();
if (classOutputPath == null) {
getLogger().info(Messages.SarlBatchCompiler_24);
return true;
}
getLogger().info(Messages.SarlBatchCompiler_25);
final Iterable<File> sources = Iterables.concat(getSourcePaths(), Collections.singleton(getOutputPath()));
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_29, toPathString(sources));
}
final List<File> classpath = getClassPath();
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_30, toPathString(classpath));
}
return runJavaCompiler(classOutputPath, sources, classpath, true, true, progress);
} | java | protected boolean postCompileJava(IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_52);
final File classOutputPath = getClassOutputPath();
if (classOutputPath == null) {
getLogger().info(Messages.SarlBatchCompiler_24);
return true;
}
getLogger().info(Messages.SarlBatchCompiler_25);
final Iterable<File> sources = Iterables.concat(getSourcePaths(), Collections.singleton(getOutputPath()));
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_29, toPathString(sources));
}
final List<File> classpath = getClassPath();
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_30, toPathString(classpath));
}
return runJavaCompiler(classOutputPath, sources, classpath, true, true, progress);
} | [
"protected",
"boolean",
"postCompileJava",
"(",
"IProgressMonitor",
"progress",
")",
"{",
"assert",
"progress",
"!=",
"null",
";",
"progress",
".",
"subTask",
"(",
"Messages",
".",
"SarlBatchCompiler_52",
")",
";",
"final",
"File",
"classOutputPath",
"=",
"getClas... | Compile the java files after the compilation of the project's files.
@param progress monitor of the progress of the compilation.
@return the success status. Replies <code>false</code> if the activity is canceled. | [
"Compile",
"the",
"java",
"files",
"after",
"the",
"compilation",
"of",
"the",
"project",
"s",
"files",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1705-L1723 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.runJavaCompiler | @SuppressWarnings({ "resource" })
protected boolean runJavaCompiler(File classDirectory, Iterable<File> sourcePathDirectories,
Iterable<File> classPathEntries, boolean enableCompilerOutput,
boolean enableOptimization, IProgressMonitor progress) {
String encoding = this.encodingProvider.getDefaultEncoding();
if (Strings.isEmpty(encoding)) {
encoding = null;
}
if (progress.isCanceled()) {
return false;
}
final PrintWriter outWriter = getStubCompilerOutputWriter();
final PrintWriter errWriter;
if (enableCompilerOutput) {
errWriter = getErrorCompilerOutputWriter();
} else {
errWriter = getStubCompilerOutputWriter();
}
if (progress.isCanceled()) {
return false;
}
return getJavaCompiler().compile(
classDirectory,
sourcePathDirectories,
classPathEntries,
getBootClassPath(),
getJavaSourceVersion(),
encoding,
isJavaCompilerVerbose(),
enableOptimization ? getOptimizationLevel() : null,
outWriter,
errWriter,
getLogger(),
progress);
} | java | @SuppressWarnings({ "resource" })
protected boolean runJavaCompiler(File classDirectory, Iterable<File> sourcePathDirectories,
Iterable<File> classPathEntries, boolean enableCompilerOutput,
boolean enableOptimization, IProgressMonitor progress) {
String encoding = this.encodingProvider.getDefaultEncoding();
if (Strings.isEmpty(encoding)) {
encoding = null;
}
if (progress.isCanceled()) {
return false;
}
final PrintWriter outWriter = getStubCompilerOutputWriter();
final PrintWriter errWriter;
if (enableCompilerOutput) {
errWriter = getErrorCompilerOutputWriter();
} else {
errWriter = getStubCompilerOutputWriter();
}
if (progress.isCanceled()) {
return false;
}
return getJavaCompiler().compile(
classDirectory,
sourcePathDirectories,
classPathEntries,
getBootClassPath(),
getJavaSourceVersion(),
encoding,
isJavaCompilerVerbose(),
enableOptimization ? getOptimizationLevel() : null,
outWriter,
errWriter,
getLogger(),
progress);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"resource\"",
"}",
")",
"protected",
"boolean",
"runJavaCompiler",
"(",
"File",
"classDirectory",
",",
"Iterable",
"<",
"File",
">",
"sourcePathDirectories",
",",
"Iterable",
"<",
"File",
">",
"classPathEntries",
",",
"boolean"... | Run the Java compiler.
@param classDirectory the output directory.
@param sourcePathDirectories the source directories.
@param classPathEntries classpath entries.
@param enableCompilerOutput indicates if the Java compiler output is displayed.
@param enableOptimization indicates if the Java compiler must applied optimization flags.
@param progress monitor of the progress of the compilation.
@return the success status. Replies <code>false</code> if the activity is canceled.
@see IJavaBatchCompiler | [
"Run",
"the",
"Java",
"compiler",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1747-L1781 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.createStubs | protected File createStubs(ResourceSet resourceSet, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_53);
final File outputDirectory = createTempDir(STUB_FOLDER_PREFIX);
if (progress.isCanceled()) {
return null;
}
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_19, outputDirectory);
}
final JavaIoFileSystemAccess fileSystemAccess = this.javaIoFileSystemAccessProvider.get();
if (progress.isCanceled()) {
return null;
}
fileSystemAccess.setOutputPath(outputDirectory.toString());
final List<Resource> resources = new ArrayList<>(resourceSet.getResources());
for (final Resource resource : resources) {
if (progress.isCanceled()) {
return null;
}
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_20, resource.getURI());
}
final IResourceDescription description = this.resourceDescriptionManager.getResourceDescription(resource);
this.stubGenerator.doGenerateStubs(fileSystemAccess, description);
}
return outputDirectory;
} | java | protected File createStubs(ResourceSet resourceSet, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_53);
final File outputDirectory = createTempDir(STUB_FOLDER_PREFIX);
if (progress.isCanceled()) {
return null;
}
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_19, outputDirectory);
}
final JavaIoFileSystemAccess fileSystemAccess = this.javaIoFileSystemAccessProvider.get();
if (progress.isCanceled()) {
return null;
}
fileSystemAccess.setOutputPath(outputDirectory.toString());
final List<Resource> resources = new ArrayList<>(resourceSet.getResources());
for (final Resource resource : resources) {
if (progress.isCanceled()) {
return null;
}
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_20, resource.getURI());
}
final IResourceDescription description = this.resourceDescriptionManager.getResourceDescription(resource);
this.stubGenerator.doGenerateStubs(fileSystemAccess, description);
}
return outputDirectory;
} | [
"protected",
"File",
"createStubs",
"(",
"ResourceSet",
"resourceSet",
",",
"IProgressMonitor",
"progress",
")",
"{",
"assert",
"progress",
"!=",
"null",
";",
"progress",
".",
"subTask",
"(",
"Messages",
".",
"SarlBatchCompiler_53",
")",
";",
"final",
"File",
"o... | Create the stubs.
@param resourceSet the input resource set.
@param progress monitor of the progress of the compilation.
@return the folder in which the stubs are located. Replies <code>null</code> if the activity is canceled. | [
"Create",
"the",
"stubs",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1833-L1860 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.loadSARLFiles | protected void loadSARLFiles(ResourceSet resourceSet, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_54);
this.encodingProvider.setDefaultEncoding(getFileEncoding());
final NameBasedFilter nameBasedFilter = new NameBasedFilter();
nameBasedFilter.setExtension(this.fileExtensionProvider.getPrimaryFileExtension());
final PathTraverser pathTraverser = new PathTraverser();
final List<String> sourcePathDirectories = getSourcePathStrings();
if (progress.isCanceled()) {
return;
}
final Multimap<String, org.eclipse.emf.common.util.URI> pathes = pathTraverser.resolvePathes(sourcePathDirectories,
input -> nameBasedFilter.matches(input));
if (progress.isCanceled()) {
return;
}
for (final String source : pathes.keySet()) {
for (final org.eclipse.emf.common.util.URI uri : pathes.get(source)) {
if (progress.isCanceled()) {
return;
}
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_7, uri);
}
resourceSet.getResource(uri, true);
}
}
} | java | protected void loadSARLFiles(ResourceSet resourceSet, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_54);
this.encodingProvider.setDefaultEncoding(getFileEncoding());
final NameBasedFilter nameBasedFilter = new NameBasedFilter();
nameBasedFilter.setExtension(this.fileExtensionProvider.getPrimaryFileExtension());
final PathTraverser pathTraverser = new PathTraverser();
final List<String> sourcePathDirectories = getSourcePathStrings();
if (progress.isCanceled()) {
return;
}
final Multimap<String, org.eclipse.emf.common.util.URI> pathes = pathTraverser.resolvePathes(sourcePathDirectories,
input -> nameBasedFilter.matches(input));
if (progress.isCanceled()) {
return;
}
for (final String source : pathes.keySet()) {
for (final org.eclipse.emf.common.util.URI uri : pathes.get(source)) {
if (progress.isCanceled()) {
return;
}
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_7, uri);
}
resourceSet.getResource(uri, true);
}
}
} | [
"protected",
"void",
"loadSARLFiles",
"(",
"ResourceSet",
"resourceSet",
",",
"IProgressMonitor",
"progress",
")",
"{",
"assert",
"progress",
"!=",
"null",
";",
"progress",
".",
"subTask",
"(",
"Messages",
".",
"SarlBatchCompiler_54",
")",
";",
"this",
".",
"enc... | Load the SARL files in the given resource set.
@param progress monitor of the progress of the compilation.
@param resourceSet the resource set to load from. | [
"Load",
"the",
"SARL",
"files",
"in",
"the",
"given",
"resource",
"set",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1867-L1894 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.createTempDir | protected File createTempDir(String namePrefix) {
final File tempDir = new File(getTempDirectory(), namePrefix);
cleanFolder(tempDir, ACCEPT_ALL_FILTER, true, true);
if (!tempDir.mkdirs()) {
throw new RuntimeException(MessageFormat.format(Messages.SarlBatchCompiler_8, tempDir.getAbsolutePath()));
}
this.tempFolders.add(tempDir);
return tempDir;
} | java | protected File createTempDir(String namePrefix) {
final File tempDir = new File(getTempDirectory(), namePrefix);
cleanFolder(tempDir, ACCEPT_ALL_FILTER, true, true);
if (!tempDir.mkdirs()) {
throw new RuntimeException(MessageFormat.format(Messages.SarlBatchCompiler_8, tempDir.getAbsolutePath()));
}
this.tempFolders.add(tempDir);
return tempDir;
} | [
"protected",
"File",
"createTempDir",
"(",
"String",
"namePrefix",
")",
"{",
"final",
"File",
"tempDir",
"=",
"new",
"File",
"(",
"getTempDirectory",
"(",
")",
",",
"namePrefix",
")",
";",
"cleanFolder",
"(",
"tempDir",
",",
"ACCEPT_ALL_FILTER",
",",
"true",
... | Create a temporary subdirectory inside the root temp directory.
@param namePrefix the prefix for the folder name.
@return the temp directory.
@see #getTempDirectory() | [
"Create",
"a",
"temporary",
"subdirectory",
"inside",
"the",
"root",
"temp",
"directory",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1902-L1910 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.cleanFolder | protected boolean cleanFolder(File parentFolder, FileFilter filter, boolean continueOnError,
boolean deleteParentFolder) {
try {
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_9, parentFolder.toString());
}
return Files.cleanFolder(parentFolder, null, continueOnError, deleteParentFolder);
} catch (FileNotFoundException e) {
return true;
}
} | java | protected boolean cleanFolder(File parentFolder, FileFilter filter, boolean continueOnError,
boolean deleteParentFolder) {
try {
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_9, parentFolder.toString());
}
return Files.cleanFolder(parentFolder, null, continueOnError, deleteParentFolder);
} catch (FileNotFoundException e) {
return true;
}
} | [
"protected",
"boolean",
"cleanFolder",
"(",
"File",
"parentFolder",
",",
"FileFilter",
"filter",
",",
"boolean",
"continueOnError",
",",
"boolean",
"deleteParentFolder",
")",
"{",
"try",
"{",
"if",
"(",
"getLogger",
"(",
")",
".",
"isDebugEnabled",
"(",
")",
"... | Clean the folders.
@param parentFolder the parent folder.
@param filter the file filter for the file to remove..
@param continueOnError indicates if the cleaning should continue on error.
@param deleteParentFolder indicates if the parent folder should be removed.
@return the success status. | [
"Clean",
"the",
"folders",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1920-L1930 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.checkConfiguration | protected boolean checkConfiguration(IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_55);
final File output = getOutputPath();
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_35, output);
}
if (output == null) {
reportInternalError(Messages.SarlBatchCompiler_36);
return false;
}
progress.subTask(Messages.SarlBatchCompiler_56);
for (final File sourcePath : getSourcePaths()) {
if (progress.isCanceled()) {
return false;
}
try {
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_37, sourcePath);
}
if (isContainedIn(output.getCanonicalFile(), sourcePath.getCanonicalFile())) {
reportInternalError(Messages.SarlBatchCompiler_10, output, sourcePath);
return false;
}
} catch (IOException e) {
reportInternalError(Messages.SarlBatchCompiler_11, e);
}
}
return true;
} | java | protected boolean checkConfiguration(IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_55);
final File output = getOutputPath();
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_35, output);
}
if (output == null) {
reportInternalError(Messages.SarlBatchCompiler_36);
return false;
}
progress.subTask(Messages.SarlBatchCompiler_56);
for (final File sourcePath : getSourcePaths()) {
if (progress.isCanceled()) {
return false;
}
try {
if (getLogger().isDebugEnabled()) {
getLogger().debug(Messages.SarlBatchCompiler_37, sourcePath);
}
if (isContainedIn(output.getCanonicalFile(), sourcePath.getCanonicalFile())) {
reportInternalError(Messages.SarlBatchCompiler_10, output, sourcePath);
return false;
}
} catch (IOException e) {
reportInternalError(Messages.SarlBatchCompiler_11, e);
}
}
return true;
} | [
"protected",
"boolean",
"checkConfiguration",
"(",
"IProgressMonitor",
"progress",
")",
"{",
"assert",
"progress",
"!=",
"null",
";",
"progress",
".",
"subTask",
"(",
"Messages",
".",
"SarlBatchCompiler_55",
")",
";",
"final",
"File",
"output",
"=",
"getOutputPath... | Check the compiler configuration; and logs errors.
@param progress monitor of the progress of the compilation.
@return success status. Replies <code>false</code> if the operation is canceled. | [
"Check",
"the",
"compiler",
"configuration",
";",
"and",
"logs",
"errors",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1937-L1966 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.createClassLoader | @SuppressWarnings("static-method")
protected ClassLoader createClassLoader(Iterable<File> jarsAndFolders, ClassLoader parentClassLoader) {
return new URLClassLoader(Iterables.toArray(Iterables.transform(jarsAndFolders, from -> {
try {
final URL url = from.toURI().toURL();
assert url != null;
return url;
} catch (Exception e) {
throw new RuntimeException(e);
}
}), URL.class), parentClassLoader);
} | java | @SuppressWarnings("static-method")
protected ClassLoader createClassLoader(Iterable<File> jarsAndFolders, ClassLoader parentClassLoader) {
return new URLClassLoader(Iterables.toArray(Iterables.transform(jarsAndFolders, from -> {
try {
final URL url = from.toURI().toURL();
assert url != null;
return url;
} catch (Exception e) {
throw new RuntimeException(e);
}
}), URL.class), parentClassLoader);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"ClassLoader",
"createClassLoader",
"(",
"Iterable",
"<",
"File",
">",
"jarsAndFolders",
",",
"ClassLoader",
"parentClassLoader",
")",
"{",
"return",
"new",
"URLClassLoader",
"(",
"Iterables",
".",
... | Create the project class loader.
@param jarsAndFolders the project class path.
@param parentClassLoader the parent class loader.
@return the class loader for the project. | [
"Create",
"the",
"project",
"class",
"loader",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L2231-L2242 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.destroyClassLoader | protected void destroyClassLoader(ClassLoader classLoader) {
if (classLoader instanceof Closeable) {
try {
((Closeable) classLoader).close();
} catch (Exception e) {
reportInternalWarning(Messages.SarlBatchCompiler_18, e);
}
}
} | java | protected void destroyClassLoader(ClassLoader classLoader) {
if (classLoader instanceof Closeable) {
try {
((Closeable) classLoader).close();
} catch (Exception e) {
reportInternalWarning(Messages.SarlBatchCompiler_18, e);
}
}
} | [
"protected",
"void",
"destroyClassLoader",
"(",
"ClassLoader",
"classLoader",
")",
"{",
"if",
"(",
"classLoader",
"instanceof",
"Closeable",
")",
"{",
"try",
"{",
"(",
"(",
"Closeable",
")",
"classLoader",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(... | Null-safe destruction of the given class loaders.
@param classLoader the class loader to destroy. | [
"Null",
"-",
"safe",
"destruction",
"of",
"the",
"given",
"class",
"loaders",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L2248-L2256 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.setWarningSeverity | public void setWarningSeverity(String warningId, Severity severity) {
if (!Strings.isEmpty(warningId) && severity != null) {
this.issueSeverityProvider.setSeverity(warningId, severity);
}
} | java | public void setWarningSeverity(String warningId, Severity severity) {
if (!Strings.isEmpty(warningId) && severity != null) {
this.issueSeverityProvider.setSeverity(warningId, severity);
}
} | [
"public",
"void",
"setWarningSeverity",
"(",
"String",
"warningId",
",",
"Severity",
"severity",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isEmpty",
"(",
"warningId",
")",
"&&",
"severity",
"!=",
"null",
")",
"{",
"this",
".",
"issueSeverityProvider",
".",
... | Change the severity level of a warning.
@param warningId the identifier of the warning. If {@code null} or empty, this function does nothing.
@param severity the new severity. If {@code null} this function does nothing.
@since 0.5 | [
"Change",
"the",
"severity",
"level",
"of",
"a",
"warning",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L2264-L2268 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/ParticipantRepository.java | ParticipantRepository.addListener | protected EventListener addListener(ADDRESST key, EventListener value) {
synchronized (mutex()) {
return this.listeners.put(key, value);
}
} | java | protected EventListener addListener(ADDRESST key, EventListener value) {
synchronized (mutex()) {
return this.listeners.put(key, value);
}
} | [
"protected",
"EventListener",
"addListener",
"(",
"ADDRESST",
"key",
",",
"EventListener",
"value",
")",
"{",
"synchronized",
"(",
"mutex",
"(",
")",
")",
"{",
"return",
"this",
".",
"listeners",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"}"
] | Add a participant with the given address in this repository.
@param key address of the participant.
@param value is the participant to map to the address.
@return the participant that was previously associated to the given address. | [
"Add",
"a",
"participant",
"with",
"the",
"given",
"address",
"in",
"this",
"repository",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/ParticipantRepository.java#L126-L130 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/ParticipantRepository.java | ParticipantRepository.getAdresses | protected SynchronizedSet<ADDRESST> getAdresses() {
final Object mutex = mutex();
synchronized (mutex) {
return Collections3.synchronizedSet(this.listeners.keySet(), mutex);
}
} | java | protected SynchronizedSet<ADDRESST> getAdresses() {
final Object mutex = mutex();
synchronized (mutex) {
return Collections3.synchronizedSet(this.listeners.keySet(), mutex);
}
} | [
"protected",
"SynchronizedSet",
"<",
"ADDRESST",
">",
"getAdresses",
"(",
")",
"{",
"final",
"Object",
"mutex",
"=",
"mutex",
"(",
")",
";",
"synchronized",
"(",
"mutex",
")",
"{",
"return",
"Collections3",
".",
"synchronizedSet",
"(",
"this",
".",
"listener... | Replies all the addresses from the inside of this repository.
@return the addresses in this repository. | [
"Replies",
"all",
"the",
"addresses",
"from",
"the",
"inside",
"of",
"this",
"repository",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/ParticipantRepository.java#L158-L163 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/ParticipantRepository.java | ParticipantRepository.getListeners | public SynchronizedCollection<EventListener> getListeners() {
final Object mutex = mutex();
synchronized (mutex) {
return Collections3.synchronizedCollection(this.listeners.values(), mutex);
}
} | java | public SynchronizedCollection<EventListener> getListeners() {
final Object mutex = mutex();
synchronized (mutex) {
return Collections3.synchronizedCollection(this.listeners.values(), mutex);
}
} | [
"public",
"SynchronizedCollection",
"<",
"EventListener",
">",
"getListeners",
"(",
")",
"{",
"final",
"Object",
"mutex",
"=",
"mutex",
"(",
")",
";",
"synchronized",
"(",
"mutex",
")",
"{",
"return",
"Collections3",
".",
"synchronizedCollection",
"(",
"this",
... | Replies all the participants from the inside of this repository.
@return the participants. | [
"Replies",
"all",
"the",
"participants",
"from",
"the",
"inside",
"of",
"this",
"repository",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/ParticipantRepository.java#L170-L175 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/ParticipantRepository.java | ParticipantRepository.listenersEntrySet | protected Set<Entry<ADDRESST, EventListener>> listenersEntrySet() {
final Object mutex = mutex();
synchronized (mutex) {
return Collections3.synchronizedSet(this.listeners.entrySet(), mutex);
}
} | java | protected Set<Entry<ADDRESST, EventListener>> listenersEntrySet() {
final Object mutex = mutex();
synchronized (mutex) {
return Collections3.synchronizedSet(this.listeners.entrySet(), mutex);
}
} | [
"protected",
"Set",
"<",
"Entry",
"<",
"ADDRESST",
",",
"EventListener",
">",
">",
"listenersEntrySet",
"(",
")",
"{",
"final",
"Object",
"mutex",
"=",
"mutex",
"(",
")",
";",
"synchronized",
"(",
"mutex",
")",
"{",
"return",
"Collections3",
".",
"synchron... | Replies the pairs of addresses and participants in this repository.
@return the pairs of addresses and participants | [
"Replies",
"the",
"pairs",
"of",
"addresses",
"and",
"participants",
"in",
"this",
"repository",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/ParticipantRepository.java#L182-L187 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/shortcuts/AbstractSarlLaunchShortcut.java | AbstractSarlLaunchShortcut.searchAndLaunch | private void searchAndLaunch(String mode, Object... scope) {
final ElementDescription element = searchAndSelect(true, scope);
if (element != null) {
try {
launch(element.projectName, element.elementName, mode);
} catch (CoreException e) {
SARLEclipsePlugin.getDefault().openError(getShell(),
io.sarl.eclipse.util.Messages.AbstractSarlScriptInteractiveSelector_1,
e.getStatus().getMessage(), e);
}
}
} | java | private void searchAndLaunch(String mode, Object... scope) {
final ElementDescription element = searchAndSelect(true, scope);
if (element != null) {
try {
launch(element.projectName, element.elementName, mode);
} catch (CoreException e) {
SARLEclipsePlugin.getDefault().openError(getShell(),
io.sarl.eclipse.util.Messages.AbstractSarlScriptInteractiveSelector_1,
e.getStatus().getMessage(), e);
}
}
} | [
"private",
"void",
"searchAndLaunch",
"(",
"String",
"mode",
",",
"Object",
"...",
"scope",
")",
"{",
"final",
"ElementDescription",
"element",
"=",
"searchAndSelect",
"(",
"true",
",",
"scope",
")",
";",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"try"... | Resolves an element type that can be launched from the given scope and launches in the
specified mode.
@param mode launch mode.
@param scope the elements to consider for an element type that can be launched. | [
"Resolves",
"an",
"element",
"type",
"that",
"can",
"be",
"launched",
"from",
"the",
"given",
"scope",
"and",
"launches",
"in",
"the",
"specified",
"mode",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/shortcuts/AbstractSarlLaunchShortcut.java#L219-L230 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/shortcuts/AbstractSarlLaunchShortcut.java | AbstractSarlLaunchShortcut.launch | protected void launch(String projectName, String fullyQualifiedName, String mode)
throws CoreException {
final List<ILaunchConfiguration> configs = getCandidates(projectName, fullyQualifiedName);
ILaunchConfiguration config = null;
final int count = configs.size();
if (count == 1) {
config = configs.get(0);
} else if (count > 1) {
config = chooseConfiguration(configs);
if (config == null) {
return;
}
}
if (config == null) {
config = createConfiguration(projectName, fullyQualifiedName);
}
if (config != null) {
DebugUITools.launch(config, mode);
}
} | java | protected void launch(String projectName, String fullyQualifiedName, String mode)
throws CoreException {
final List<ILaunchConfiguration> configs = getCandidates(projectName, fullyQualifiedName);
ILaunchConfiguration config = null;
final int count = configs.size();
if (count == 1) {
config = configs.get(0);
} else if (count > 1) {
config = chooseConfiguration(configs);
if (config == null) {
return;
}
}
if (config == null) {
config = createConfiguration(projectName, fullyQualifiedName);
}
if (config != null) {
DebugUITools.launch(config, mode);
}
} | [
"protected",
"void",
"launch",
"(",
"String",
"projectName",
",",
"String",
"fullyQualifiedName",
",",
"String",
"mode",
")",
"throws",
"CoreException",
"{",
"final",
"List",
"<",
"ILaunchConfiguration",
">",
"configs",
"=",
"getCandidates",
"(",
"projectName",
",... | Launches the given element type in the specified mode.
@param projectName the name of the project.
@param fullyQualifiedName the element name.
@param mode launch mode
@throws CoreException if something is going wrong. | [
"Launches",
"the",
"given",
"element",
"type",
"in",
"the",
"specified",
"mode",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/shortcuts/AbstractSarlLaunchShortcut.java#L277-L296 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/CodeBuilderFactory.java | CodeBuilderFactory.computeUnusedUri | @Pure
protected URI computeUnusedUri(ResourceSet resourceSet) {
String name = "__synthetic";
for (int i = 0; i < Integer.MAX_VALUE; ++i) {
URI syntheticUri = URI.createURI(name + i + "." + getScriptFileExtension());
if (resourceSet.getResource(syntheticUri, false) == null) {
return syntheticUri;
}
}
throw new IllegalStateException();
} | java | @Pure
protected URI computeUnusedUri(ResourceSet resourceSet) {
String name = "__synthetic";
for (int i = 0; i < Integer.MAX_VALUE; ++i) {
URI syntheticUri = URI.createURI(name + i + "." + getScriptFileExtension());
if (resourceSet.getResource(syntheticUri, false) == null) {
return syntheticUri;
}
}
throw new IllegalStateException();
} | [
"@",
"Pure",
"protected",
"URI",
"computeUnusedUri",
"(",
"ResourceSet",
"resourceSet",
")",
"{",
"String",
"name",
"=",
"\"__synthetic\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"Integer",
".",
"MAX_VALUE",
";",
"++",
"i",
")",
"{",
"UR... | Compute a unused URI for a synthetic resource.
@param resourceSet the resource set in which the resource should be located.
@return the uri. | [
"Compute",
"a",
"unused",
"URI",
"for",
"a",
"synthetic",
"resource",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/CodeBuilderFactory.java#L118-L128 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/CodeBuilderFactory.java | CodeBuilderFactory.createResource | @Pure
protected Resource createResource(ResourceSet resourceSet) {
URI uri = computeUnusedUri(resourceSet);
Resource resource = getResourceFactory().createResource(uri);
resourceSet.getResources().add(resource);
return resource;
} | java | @Pure
protected Resource createResource(ResourceSet resourceSet) {
URI uri = computeUnusedUri(resourceSet);
Resource resource = getResourceFactory().createResource(uri);
resourceSet.getResources().add(resource);
return resource;
} | [
"@",
"Pure",
"protected",
"Resource",
"createResource",
"(",
"ResourceSet",
"resourceSet",
")",
"{",
"URI",
"uri",
"=",
"computeUnusedUri",
"(",
"resourceSet",
")",
";",
"Resource",
"resource",
"=",
"getResourceFactory",
"(",
")",
".",
"createResource",
"(",
"ur... | Create a synthetic resource.
@param resourceSet the resourceSet.
@return the resource. | [
"Create",
"a",
"synthetic",
"resource",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/CodeBuilderFactory.java#L178-L184 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/CodeBuilderFactory.java | CodeBuilderFactory.getInjector | @Pure
protected Injector getInjector() {
if (this.builderInjector == null) {
ImportManager importManager = this.importManagerProvider.get();
this.builderInjector = createOverridingInjector(this.originalInjector, new CodeBuilderModule(importManager));
}
return builderInjector;
} | java | @Pure
protected Injector getInjector() {
if (this.builderInjector == null) {
ImportManager importManager = this.importManagerProvider.get();
this.builderInjector = createOverridingInjector(this.originalInjector, new CodeBuilderModule(importManager));
}
return builderInjector;
} | [
"@",
"Pure",
"protected",
"Injector",
"getInjector",
"(",
")",
"{",
"if",
"(",
"this",
".",
"builderInjector",
"==",
"null",
")",
"{",
"ImportManager",
"importManager",
"=",
"this",
".",
"importManagerProvider",
".",
"get",
"(",
")",
";",
"this",
".",
"bui... | Replies the injector.
@return the injector. | [
"Replies",
"the",
"injector",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/CodeBuilderFactory.java#L189-L196 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorUnitBuilderImpl.java | SarlBehaviorUnitBuilderImpl.getGuard | @Pure
public IExpressionBuilder getGuard() {
IExpressionBuilder exprBuilder = this.expressionProvider.get();
exprBuilder.eInit(getSarlBehaviorUnit(), new Procedures.Procedure1<XExpression>() {
public void apply(XExpression expr) {
getSarlBehaviorUnit().setGuard(expr);
}
}, getTypeResolutionContext());
return exprBuilder;
} | java | @Pure
public IExpressionBuilder getGuard() {
IExpressionBuilder exprBuilder = this.expressionProvider.get();
exprBuilder.eInit(getSarlBehaviorUnit(), new Procedures.Procedure1<XExpression>() {
public void apply(XExpression expr) {
getSarlBehaviorUnit().setGuard(expr);
}
}, getTypeResolutionContext());
return exprBuilder;
} | [
"@",
"Pure",
"public",
"IExpressionBuilder",
"getGuard",
"(",
")",
"{",
"IExpressionBuilder",
"exprBuilder",
"=",
"this",
".",
"expressionProvider",
".",
"get",
"(",
")",
";",
"exprBuilder",
".",
"eInit",
"(",
"getSarlBehaviorUnit",
"(",
")",
",",
"new",
"Proc... | Change the guard.
@param value the value of the guard. It may be <code>null</code>. | [
"Change",
"the",
"guard",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorUnitBuilderImpl.java#L117-L126 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorUnitBuilderImpl.java | SarlBehaviorUnitBuilderImpl.getExpression | public IBlockExpressionBuilder getExpression() {
IBlockExpressionBuilder block = this.blockExpressionProvider.get();
block.eInit(getTypeResolutionContext());
XBlockExpression expr = block.getXBlockExpression();
this.sarlBehaviorUnit.setExpression(expr);
return block;
} | java | public IBlockExpressionBuilder getExpression() {
IBlockExpressionBuilder block = this.blockExpressionProvider.get();
block.eInit(getTypeResolutionContext());
XBlockExpression expr = block.getXBlockExpression();
this.sarlBehaviorUnit.setExpression(expr);
return block;
} | [
"public",
"IBlockExpressionBuilder",
"getExpression",
"(",
")",
"{",
"IBlockExpressionBuilder",
"block",
"=",
"this",
".",
"blockExpressionProvider",
".",
"get",
"(",
")",
";",
"block",
".",
"eInit",
"(",
"getTypeResolutionContext",
"(",
")",
")",
";",
"XBlockExpr... | Create the block of code.
@return the block builder. | [
"Create",
"the",
"block",
"of",
"code",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorUnitBuilderImpl.java#L131-L137 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/AbstractSREInstallPage.java | AbstractSREInstallPage.validateNameAgainstOtherSREs | protected IStatus validateNameAgainstOtherSREs(String name) {
IStatus nameStatus = SARLEclipsePlugin.getDefault().createOkStatus();
if (isDuplicateName(name)) {
nameStatus = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
ISREInstall.CODE_NAME,
Messages.SREInstallWizard_1);
} else {
final IStatus status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
if (!status.isOK()) {
nameStatus = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
ISREInstall.CODE_NAME,
MessageFormat.format(Messages.SREInstallWizard_2, status.getMessage()));
}
}
return nameStatus;
} | java | protected IStatus validateNameAgainstOtherSREs(String name) {
IStatus nameStatus = SARLEclipsePlugin.getDefault().createOkStatus();
if (isDuplicateName(name)) {
nameStatus = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
ISREInstall.CODE_NAME,
Messages.SREInstallWizard_1);
} else {
final IStatus status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
if (!status.isOK()) {
nameStatus = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
ISREInstall.CODE_NAME,
MessageFormat.format(Messages.SREInstallWizard_2, status.getMessage()));
}
}
return nameStatus;
} | [
"protected",
"IStatus",
"validateNameAgainstOtherSREs",
"(",
"String",
"name",
")",
"{",
"IStatus",
"nameStatus",
"=",
"SARLEclipsePlugin",
".",
"getDefault",
"(",
")",
".",
"createOkStatus",
"(",
")",
";",
"if",
"(",
"isDuplicateName",
"(",
"name",
")",
")",
... | Replies if the name of the SRE is valid against the names of
the other SRE.
@param name the name to validate.
@return the validation status. | [
"Replies",
"if",
"the",
"name",
"of",
"the",
"SRE",
"is",
"valid",
"against",
"the",
"names",
"of",
"the",
"other",
"SRE",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/AbstractSREInstallPage.java#L119-L134 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/AbstractSREInstallPage.java | AbstractSREInstallPage.setPageStatus | protected void setPageStatus(IStatus status) {
this.status = status == null ? SARLEclipsePlugin.getDefault().createOkStatus() : status;
} | java | protected void setPageStatus(IStatus status) {
this.status = status == null ? SARLEclipsePlugin.getDefault().createOkStatus() : status;
} | [
"protected",
"void",
"setPageStatus",
"(",
"IStatus",
"status",
")",
"{",
"this",
".",
"status",
"=",
"status",
"==",
"null",
"?",
"SARLEclipsePlugin",
".",
"getDefault",
"(",
")",
".",
"createOkStatus",
"(",
")",
":",
"status",
";",
"}"
] | Change the status associated to this page.
Any previous status is overrided by the given value.
<p>You must call {@link #updatePageStatus()} after
invoking this methid.
@param status the new status. | [
"Change",
"the",
"status",
"associated",
"to",
"this",
"page",
".",
"Any",
"previous",
"status",
"is",
"overrided",
"by",
"the",
"given",
"value",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/AbstractSREInstallPage.java#L144-L146 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/AbstractSREInstallPage.java | AbstractSREInstallPage.isDuplicateName | private boolean isDuplicateName(String name) {
if (this.existingNames != null) {
final String newName = Strings.nullToEmpty(name);
for (final String existingName : this.existingNames) {
if (newName.equals(existingName)) {
return true;
}
}
}
return false;
} | java | private boolean isDuplicateName(String name) {
if (this.existingNames != null) {
final String newName = Strings.nullToEmpty(name);
for (final String existingName : this.existingNames) {
if (newName.equals(existingName)) {
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"isDuplicateName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"this",
".",
"existingNames",
"!=",
"null",
")",
"{",
"final",
"String",
"newName",
"=",
"Strings",
".",
"nullToEmpty",
"(",
"name",
")",
";",
"for",
"(",
"final",
"Stri... | Returns whether the name is already in use by an existing SRE.
@param name new name.
@return whether the name is already in use. | [
"Returns",
"whether",
"the",
"name",
"is",
"already",
"in",
"use",
"by",
"an",
"existing",
"SRE",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/AbstractSREInstallPage.java#L154-L164 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/AbstractSREInstallPage.java | AbstractSREInstallPage.setExistingNames | void setExistingNames(String... names) {
this.existingNames = names;
for (int i = 0; i < this.existingNames.length; ++i) {
this.existingNames[i] = Strings.nullToEmpty(this.existingNames[i]);
}
} | java | void setExistingNames(String... names) {
this.existingNames = names;
for (int i = 0; i < this.existingNames.length; ++i) {
this.existingNames[i] = Strings.nullToEmpty(this.existingNames[i]);
}
} | [
"void",
"setExistingNames",
"(",
"String",
"...",
"names",
")",
"{",
"this",
".",
"existingNames",
"=",
"names",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"existingNames",
".",
"length",
";",
"++",
"i",
")",
"{",
"this",
".... | Sets the names of existing SREs, not including the SRE being edited. This method
is called by the wizard and clients should not call this method.
@param names existing SRE names or an empty array. | [
"Sets",
"the",
"names",
"of",
"existing",
"SREs",
"not",
"including",
"the",
"SRE",
"being",
"edited",
".",
"This",
"method",
"is",
"called",
"by",
"the",
"wizard",
"and",
"clients",
"should",
"not",
"call",
"this",
"method",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/AbstractSREInstallPage.java#L172-L177 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/AbstractSREInstallPage.java | AbstractSREInstallPage.updatePageStatus | protected void updatePageStatus() {
if (this.status.isOK()) {
setMessage(null, IMessageProvider.NONE);
} else {
switch (this.status.getSeverity()) {
case IStatus.ERROR:
setMessage(this.status.getMessage(), IMessageProvider.ERROR);
break;
case IStatus.INFO:
setMessage(this.status.getMessage(), IMessageProvider.INFORMATION);
break;
case IStatus.WARNING:
setMessage(this.status.getMessage(), IMessageProvider.WARNING);
break;
default:
break;
}
}
setPageComplete(this.status.isOK() || this.status.getSeverity() == IStatus.INFO);
} | java | protected void updatePageStatus() {
if (this.status.isOK()) {
setMessage(null, IMessageProvider.NONE);
} else {
switch (this.status.getSeverity()) {
case IStatus.ERROR:
setMessage(this.status.getMessage(), IMessageProvider.ERROR);
break;
case IStatus.INFO:
setMessage(this.status.getMessage(), IMessageProvider.INFORMATION);
break;
case IStatus.WARNING:
setMessage(this.status.getMessage(), IMessageProvider.WARNING);
break;
default:
break;
}
}
setPageComplete(this.status.isOK() || this.status.getSeverity() == IStatus.INFO);
} | [
"protected",
"void",
"updatePageStatus",
"(",
")",
"{",
"if",
"(",
"this",
".",
"status",
".",
"isOK",
"(",
")",
")",
"{",
"setMessage",
"(",
"null",
",",
"IMessageProvider",
".",
"NONE",
")",
";",
"}",
"else",
"{",
"switch",
"(",
"this",
".",
"statu... | Updates the status message on the page, based on the status of the SRE and other
status provided by the page. | [
"Updates",
"the",
"status",
"message",
"on",
"the",
"page",
"based",
"on",
"the",
"status",
"of",
"the",
"SRE",
"and",
"other",
"status",
"provided",
"by",
"the",
"page",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/AbstractSREInstallPage.java#L188-L207 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/sarl/actionprototype/ActionPrototype.java | ActionPrototype.toActionId | public String toActionId() {
final StringBuilder b = new StringBuilder();
b.append(getActionName());
for (final String type : this.signature) {
b.append("_"); //$NON-NLS-1$
for (final char c : type.replaceAll("(\\[\\])|\\*", "Array").toCharArray()) { //$NON-NLS-1$//$NON-NLS-2$
if (Character.isJavaIdentifierPart(c)) {
b.append(c);
}
}
}
return b.toString();
} | java | public String toActionId() {
final StringBuilder b = new StringBuilder();
b.append(getActionName());
for (final String type : this.signature) {
b.append("_"); //$NON-NLS-1$
for (final char c : type.replaceAll("(\\[\\])|\\*", "Array").toCharArray()) { //$NON-NLS-1$//$NON-NLS-2$
if (Character.isJavaIdentifierPart(c)) {
b.append(c);
}
}
}
return b.toString();
} | [
"public",
"String",
"toActionId",
"(",
")",
"{",
"final",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"b",
".",
"append",
"(",
"getActionName",
"(",
")",
")",
";",
"for",
"(",
"final",
"String",
"type",
":",
"this",
".",
"signatur... | Replies the string that permits to identify the action prototype according to the Java variable name.
@return the identifier. | [
"Replies",
"the",
"string",
"that",
"permits",
"to",
"identify",
"the",
"action",
"prototype",
"according",
"to",
"the",
"Java",
"variable",
"name",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/sarl/actionprototype/ActionPrototype.java#L129-L141 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/space/AbstractEventSpace.java | AbstractEventSpace.emit | public final void emit(UUID eventSource, Event event, Scope<Address> scope) {
assert event != null;
ensureEventSource(eventSource, event);
assert getSpaceID().equals(event.getSource().getSpaceID()) : "The source address must belong to this space"; //$NON-NLS-1$
try {
final Scope<Address> scopeInstance = (scope == null) ? Scopes.<Address>allParticipants() : scope;
try {
this.network.publish(scopeInstance, event);
} catch (Throwable e) {
this.logger.getKernelLogger().severe(MessageFormat.format(Messages.AbstractEventSpace_2, event, scope, e));
}
doEmit(event, scopeInstance);
} catch (Throwable e) {
this.logger.getKernelLogger().severe(MessageFormat.format(Messages.AbstractEventSpace_0, event, scope, e));
}
} | java | public final void emit(UUID eventSource, Event event, Scope<Address> scope) {
assert event != null;
ensureEventSource(eventSource, event);
assert getSpaceID().equals(event.getSource().getSpaceID()) : "The source address must belong to this space"; //$NON-NLS-1$
try {
final Scope<Address> scopeInstance = (scope == null) ? Scopes.<Address>allParticipants() : scope;
try {
this.network.publish(scopeInstance, event);
} catch (Throwable e) {
this.logger.getKernelLogger().severe(MessageFormat.format(Messages.AbstractEventSpace_2, event, scope, e));
}
doEmit(event, scopeInstance);
} catch (Throwable e) {
this.logger.getKernelLogger().severe(MessageFormat.format(Messages.AbstractEventSpace_0, event, scope, e));
}
} | [
"public",
"final",
"void",
"emit",
"(",
"UUID",
"eventSource",
",",
"Event",
"event",
",",
"Scope",
"<",
"Address",
">",
"scope",
")",
"{",
"assert",
"event",
"!=",
"null",
";",
"ensureEventSource",
"(",
"eventSource",
",",
"event",
")",
";",
"assert",
"... | Emit the given event in the given scope.
<p>This function emits on the internal event bus of the agent (call to {@link #doEmit(Event, Scope)}), and on the network.
@param eventSource the source of the event.
@param event the event to emit.
@param scope description of the scope of the event, i.e. the receivers of the event.
@since 2.0.6.0 | [
"Emit",
"the",
"given",
"event",
"in",
"the",
"given",
"scope",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/space/AbstractEventSpace.java#L130-L146 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/space/AbstractEventSpace.java | AbstractEventSpace.ensureEventSource | protected void ensureEventSource(UUID eventSource, Event event) {
if (event.getSource() == null) {
if (eventSource != null) {
event.setSource(new Address(getSpaceID(), eventSource));
} else {
throw new AssertionError("Every event must have a source"); //$NON-NLS-1$
}
}
} | java | protected void ensureEventSource(UUID eventSource, Event event) {
if (event.getSource() == null) {
if (eventSource != null) {
event.setSource(new Address(getSpaceID(), eventSource));
} else {
throw new AssertionError("Every event must have a source"); //$NON-NLS-1$
}
}
} | [
"protected",
"void",
"ensureEventSource",
"(",
"UUID",
"eventSource",
",",
"Event",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getSource",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"eventSource",
"!=",
"null",
")",
"{",
"event",
".",
"setSource",
... | Ensure that the given event has a source.
@param eventSource the source of the event.
@param event the event to emit.
@since 2.0.6.0 | [
"Ensure",
"that",
"the",
"given",
"event",
"has",
"a",
"source",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/space/AbstractEventSpace.java#L154-L162 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/space/AbstractEventSpace.java | AbstractEventSpace.doEmit | protected void doEmit(Event event, Scope<? super Address> scope) {
assert scope != null;
assert event != null;
final UniqueAddressParticipantRepository<Address> particips = getParticipantInternalDataStructure();
final SynchronizedCollection<EventListener> listeners = particips.getListeners();
synchronized (listeners.mutex()) {
for (final EventListener listener : listeners) {
final Address adr = getAddress(listener);
if (scope.matches(adr)) {
this.executorService.submit(new AsyncRunner(listener, event));
}
}
}
} | java | protected void doEmit(Event event, Scope<? super Address> scope) {
assert scope != null;
assert event != null;
final UniqueAddressParticipantRepository<Address> particips = getParticipantInternalDataStructure();
final SynchronizedCollection<EventListener> listeners = particips.getListeners();
synchronized (listeners.mutex()) {
for (final EventListener listener : listeners) {
final Address adr = getAddress(listener);
if (scope.matches(adr)) {
this.executorService.submit(new AsyncRunner(listener, event));
}
}
}
} | [
"protected",
"void",
"doEmit",
"(",
"Event",
"event",
",",
"Scope",
"<",
"?",
"super",
"Address",
">",
"scope",
")",
"{",
"assert",
"scope",
"!=",
"null",
";",
"assert",
"event",
"!=",
"null",
";",
"final",
"UniqueAddressParticipantRepository",
"<",
"Address... | Do the emission of the event.
<p>This function emits the event <strong>only on the internal event bus</strong> of the agents.
@param event the event to emit.
@param scope description of the scope of the event, i.e. the receivers of the event. | [
"Do",
"the",
"emission",
"of",
"the",
"event",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/space/AbstractEventSpace.java#L172-L185 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/DataViewDelegate.java | DataViewDelegate.undelegate | public static Object undelegate(Object object) {
Object obj = object;
while (obj instanceof Delegator) {
obj = ((Delegator<?>) obj).getDelegatedObject();
}
return obj;
} | java | public static Object undelegate(Object object) {
Object obj = object;
while (obj instanceof Delegator) {
obj = ((Delegator<?>) obj).getDelegatedObject();
}
return obj;
} | [
"public",
"static",
"Object",
"undelegate",
"(",
"Object",
"object",
")",
"{",
"Object",
"obj",
"=",
"object",
";",
"while",
"(",
"obj",
"instanceof",
"Delegator",
")",
"{",
"obj",
"=",
"(",
"(",
"Delegator",
"<",
"?",
">",
")",
"obj",
")",
".",
"get... | Find the delegated object.
@param object the object.
@return the delegator object. | [
"Find",
"the",
"delegated",
"object",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/DataViewDelegate.java#L44-L50 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/editor/DocumentAutoFormatter.java | DocumentAutoFormatter.formatRegion | protected void formatRegion(IXtextDocument document, int offset, int length) {
try {
final int startLineIndex = document.getLineOfOffset(previousSiblingChar(document, offset));
final int endLineIndex = document.getLineOfOffset(offset + length);
int regionLength = 0;
for (int i = startLineIndex; i <= endLineIndex; ++i) {
regionLength += document.getLineLength(i);
}
if (regionLength > 0) {
final int startOffset = document.getLineOffset(startLineIndex);
for (final IRegion region : document.computePartitioning(startOffset, regionLength)) {
this.contentFormatter.format(document, region);
}
}
} catch (BadLocationException exception) {
Exceptions.sneakyThrow(exception);
}
} | java | protected void formatRegion(IXtextDocument document, int offset, int length) {
try {
final int startLineIndex = document.getLineOfOffset(previousSiblingChar(document, offset));
final int endLineIndex = document.getLineOfOffset(offset + length);
int regionLength = 0;
for (int i = startLineIndex; i <= endLineIndex; ++i) {
regionLength += document.getLineLength(i);
}
if (regionLength > 0) {
final int startOffset = document.getLineOffset(startLineIndex);
for (final IRegion region : document.computePartitioning(startOffset, regionLength)) {
this.contentFormatter.format(document, region);
}
}
} catch (BadLocationException exception) {
Exceptions.sneakyThrow(exception);
}
} | [
"protected",
"void",
"formatRegion",
"(",
"IXtextDocument",
"document",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"try",
"{",
"final",
"int",
"startLineIndex",
"=",
"document",
".",
"getLineOfOffset",
"(",
"previousSiblingChar",
"(",
"document",
",",... | Called for formatting a region.
@param document the document to format.
@param offset the offset of the text to format.
@param length the length of the text. | [
"Called",
"for",
"formatting",
"a",
"region",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/editor/DocumentAutoFormatter.java#L113-L130 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.core/src/io/sarl/bootstrap/SRE.java | SRE.getServiceLoader | @Pure
public static ServiceLoader<SREBootstrap> getServiceLoader(boolean onlyInstalledInJRE) {
synchronized (SRE.class) {
ServiceLoader<SREBootstrap> sl = loader == null ? null : loader.get();
if (sl == null) {
if (onlyInstalledInJRE) {
sl = ServiceLoader.loadInstalled(SREBootstrap.class);
} else {
sl = ServiceLoader.load(SREBootstrap.class);
}
loader = new SoftReference<>(sl);
}
return sl;
}
} | java | @Pure
public static ServiceLoader<SREBootstrap> getServiceLoader(boolean onlyInstalledInJRE) {
synchronized (SRE.class) {
ServiceLoader<SREBootstrap> sl = loader == null ? null : loader.get();
if (sl == null) {
if (onlyInstalledInJRE) {
sl = ServiceLoader.loadInstalled(SREBootstrap.class);
} else {
sl = ServiceLoader.load(SREBootstrap.class);
}
loader = new SoftReference<>(sl);
}
return sl;
}
} | [
"@",
"Pure",
"public",
"static",
"ServiceLoader",
"<",
"SREBootstrap",
">",
"getServiceLoader",
"(",
"boolean",
"onlyInstalledInJRE",
")",
"{",
"synchronized",
"(",
"SRE",
".",
"class",
")",
"{",
"ServiceLoader",
"<",
"SREBootstrap",
">",
"sl",
"=",
"loader",
... | Replies all the installed SRE into the class path.
@param onlyInstalledInJRE indicates if the services will be considered only into the libraries that are
installed into the JRE. If {@code true}, only the libraries into the JRE will be considered and
the application libraries will be ignored. If {@code false}, the application libraries will be
considered as well.
@return the installed SRE. | [
"Replies",
"all",
"the",
"installed",
"SRE",
"into",
"the",
"class",
"path",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/bootstrap/SRE.java#L95-L109 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.core/src/io/sarl/bootstrap/SRE.java | SRE.getBootstrappedLibraries | public static Set<URL> getBootstrappedLibraries() {
final String name = PREFIX + SREBootstrap.class.getName();
final Set<URL> result = new TreeSet<>();
try {
final Enumeration<URL> enumr = ClassLoader.getSystemResources(name);
while (enumr.hasMoreElements()) {
final URL url = enumr.nextElement();
if (url != null) {
result.add(url);
}
}
} catch (Exception exception) {
//
}
return result;
} | java | public static Set<URL> getBootstrappedLibraries() {
final String name = PREFIX + SREBootstrap.class.getName();
final Set<URL> result = new TreeSet<>();
try {
final Enumeration<URL> enumr = ClassLoader.getSystemResources(name);
while (enumr.hasMoreElements()) {
final URL url = enumr.nextElement();
if (url != null) {
result.add(url);
}
}
} catch (Exception exception) {
//
}
return result;
} | [
"public",
"static",
"Set",
"<",
"URL",
">",
"getBootstrappedLibraries",
"(",
")",
"{",
"final",
"String",
"name",
"=",
"PREFIX",
"+",
"SREBootstrap",
".",
"class",
".",
"getName",
"(",
")",
";",
"final",
"Set",
"<",
"URL",
">",
"result",
"=",
"new",
"T... | Replies all the libraries that contains a SRE bootstrap.
@return the set of libraries.
@since 0.7 | [
"Replies",
"all",
"the",
"libraries",
"that",
"contains",
"a",
"SRE",
"bootstrap",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/bootstrap/SRE.java#L116-L131 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.core/src/io/sarl/bootstrap/SRE.java | SRE.getBootstrap | @Pure
public static SREBootstrap getBootstrap() {
synchronized (SRE.class) {
if (currentSRE == null) {
final Iterator<SREBootstrap> iterator = getServiceLoader().iterator();
if (iterator.hasNext()) {
currentSRE = iterator.next();
} else {
currentSRE = new VoidSREBootstrap();
}
}
return currentSRE;
}
} | java | @Pure
public static SREBootstrap getBootstrap() {
synchronized (SRE.class) {
if (currentSRE == null) {
final Iterator<SREBootstrap> iterator = getServiceLoader().iterator();
if (iterator.hasNext()) {
currentSRE = iterator.next();
} else {
currentSRE = new VoidSREBootstrap();
}
}
return currentSRE;
}
} | [
"@",
"Pure",
"public",
"static",
"SREBootstrap",
"getBootstrap",
"(",
")",
"{",
"synchronized",
"(",
"SRE",
".",
"class",
")",
"{",
"if",
"(",
"currentSRE",
"==",
"null",
")",
"{",
"final",
"Iterator",
"<",
"SREBootstrap",
">",
"iterator",
"=",
"getService... | Find and reply the current SRE.
@return the current SRE, never {@code null}.
@throws IllegalStateException if a SRE cannot be found. | [
"Find",
"and",
"reply",
"the",
"current",
"SRE",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/bootstrap/SRE.java#L166-L179 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/hover/SARLHoverSignatureProvider.java | SARLHoverSignatureProvider._signature | protected String _signature(XCastedExpression castExpression, boolean typeAtEnd) {
if (castExpression instanceof SarlCastedExpression) {
final JvmOperation delegate = ((SarlCastedExpression) castExpression).getFeature();
if (delegate != null) {
return _signature(delegate, typeAtEnd);
}
}
return MessageFormat.format(Messages.SARLHoverSignatureProvider_0,
getTypeName(castExpression.getType()));
} | java | protected String _signature(XCastedExpression castExpression, boolean typeAtEnd) {
if (castExpression instanceof SarlCastedExpression) {
final JvmOperation delegate = ((SarlCastedExpression) castExpression).getFeature();
if (delegate != null) {
return _signature(delegate, typeAtEnd);
}
}
return MessageFormat.format(Messages.SARLHoverSignatureProvider_0,
getTypeName(castExpression.getType()));
} | [
"protected",
"String",
"_signature",
"(",
"XCastedExpression",
"castExpression",
",",
"boolean",
"typeAtEnd",
")",
"{",
"if",
"(",
"castExpression",
"instanceof",
"SarlCastedExpression",
")",
"{",
"final",
"JvmOperation",
"delegate",
"=",
"(",
"(",
"SarlCastedExpressi... | Replies the hover for a SARL casted expression.
@param castExpression the casted expression.
@param typeAtEnd indicates if the type should be put at end.
@return the string representation into the hover. | [
"Replies",
"the",
"hover",
"for",
"a",
"SARL",
"casted",
"expression",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/hover/SARLHoverSignatureProvider.java#L245-L254 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/hover/SARLHoverSignatureProvider.java | SARLHoverSignatureProvider.getTypeName | protected String getTypeName(JvmType type) {
if (type != null) {
if (type instanceof JvmDeclaredType) {
final ITypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, type);
return owner.toLightweightTypeReference(type).getHumanReadableName();
}
return type.getSimpleName();
}
return Messages.SARLHoverSignatureProvider_1;
} | java | protected String getTypeName(JvmType type) {
if (type != null) {
if (type instanceof JvmDeclaredType) {
final ITypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, type);
return owner.toLightweightTypeReference(type).getHumanReadableName();
}
return type.getSimpleName();
}
return Messages.SARLHoverSignatureProvider_1;
} | [
"protected",
"String",
"getTypeName",
"(",
"JvmType",
"type",
")",
"{",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"if",
"(",
"type",
"instanceof",
"JvmDeclaredType",
")",
"{",
"final",
"ITypeReferenceOwner",
"owner",
"=",
"new",
"StandardTypeReferenceOwner",
... | Replies the type name for the given type.
@param type the type.
@return the string representation of the given type. | [
"Replies",
"the",
"type",
"name",
"for",
"the",
"given",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/hover/SARLHoverSignatureProvider.java#L273-L282 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java | AbstractSARLLaunchConfigurationDelegate.getSREInstallFor | protected static ISREInstall getSREInstallFor(ILaunchConfiguration configuration,
ILaunchConfigurationAccessor configAccessor,
IJavaProjectAccessor projectAccessor) throws CoreException {
assert configAccessor != null;
assert projectAccessor != null;
final ISREInstall sre;
if (configAccessor.getUseProjectSREFlag(configuration)) {
sre = getProjectSpecificSRE(configuration, true, projectAccessor);
} else if (configAccessor.getUseSystemSREFlag(configuration)) {
sre = SARLRuntime.getDefaultSREInstall();
verifySREValidity(sre, sre.getId());
} else {
final String runtime = configAccessor.getSREId(configuration);
sre = SARLRuntime.getSREFromId(runtime);
verifySREValidity(sre, runtime);
}
if (sre == null) {
throw new CoreException(SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
Messages.SARLLaunchConfigurationDelegate_0));
}
return sre;
} | java | protected static ISREInstall getSREInstallFor(ILaunchConfiguration configuration,
ILaunchConfigurationAccessor configAccessor,
IJavaProjectAccessor projectAccessor) throws CoreException {
assert configAccessor != null;
assert projectAccessor != null;
final ISREInstall sre;
if (configAccessor.getUseProjectSREFlag(configuration)) {
sre = getProjectSpecificSRE(configuration, true, projectAccessor);
} else if (configAccessor.getUseSystemSREFlag(configuration)) {
sre = SARLRuntime.getDefaultSREInstall();
verifySREValidity(sre, sre.getId());
} else {
final String runtime = configAccessor.getSREId(configuration);
sre = SARLRuntime.getSREFromId(runtime);
verifySREValidity(sre, runtime);
}
if (sre == null) {
throw new CoreException(SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
Messages.SARLLaunchConfigurationDelegate_0));
}
return sre;
} | [
"protected",
"static",
"ISREInstall",
"getSREInstallFor",
"(",
"ILaunchConfiguration",
"configuration",
",",
"ILaunchConfigurationAccessor",
"configAccessor",
",",
"IJavaProjectAccessor",
"projectAccessor",
")",
"throws",
"CoreException",
"{",
"assert",
"configAccessor",
"!=",
... | Replies the SRE installation to be used for the given configuration.
@param configuration the configuration to check.
@param configAccessor the accessor to the SRE configuration.
@param projectAccessor the accessor to the Java project.
@return the SRE install.
@throws CoreException if impossible to get the SRE. | [
"Replies",
"the",
"SRE",
"installation",
"to",
"be",
"used",
"for",
"the",
"given",
"configuration",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java#L158-L181 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java | AbstractSARLLaunchConfigurationDelegate.getProjectSpecificSRE | private static ISREInstall getProjectSpecificSRE(ILaunchConfiguration configuration, boolean verify,
IJavaProjectAccessor projectAccessor) throws CoreException {
assert projectAccessor != null;
final IJavaProject jprj = projectAccessor.get(configuration);
if (jprj != null) {
final IProject prj = jprj.getProject();
assert prj != null;
// Get the SRE from the extension point
ISREInstall sre = getSREFromExtension(prj, verify);
if (sre != null) {
return sre;
}
// Get the SRE from the default project configuration
final ProjectSREProvider provider = new EclipseIDEProjectSREProvider(prj);
sre = provider.getProjectSREInstall();
if (sre != null) {
if (verify) {
verifySREValidity(sre, sre.getId());
}
return sre;
}
}
final ISREInstall sre = SARLRuntime.getDefaultSREInstall();
if (verify) {
verifySREValidity(sre, (sre == null) ? Messages.SARLLaunchConfigurationDelegate_8 : sre.getId());
}
return sre;
} | java | private static ISREInstall getProjectSpecificSRE(ILaunchConfiguration configuration, boolean verify,
IJavaProjectAccessor projectAccessor) throws CoreException {
assert projectAccessor != null;
final IJavaProject jprj = projectAccessor.get(configuration);
if (jprj != null) {
final IProject prj = jprj.getProject();
assert prj != null;
// Get the SRE from the extension point
ISREInstall sre = getSREFromExtension(prj, verify);
if (sre != null) {
return sre;
}
// Get the SRE from the default project configuration
final ProjectSREProvider provider = new EclipseIDEProjectSREProvider(prj);
sre = provider.getProjectSREInstall();
if (sre != null) {
if (verify) {
verifySREValidity(sre, sre.getId());
}
return sre;
}
}
final ISREInstall sre = SARLRuntime.getDefaultSREInstall();
if (verify) {
verifySREValidity(sre, (sre == null) ? Messages.SARLLaunchConfigurationDelegate_8 : sre.getId());
}
return sre;
} | [
"private",
"static",
"ISREInstall",
"getProjectSpecificSRE",
"(",
"ILaunchConfiguration",
"configuration",
",",
"boolean",
"verify",
",",
"IJavaProjectAccessor",
"projectAccessor",
")",
"throws",
"CoreException",
"{",
"assert",
"projectAccessor",
"!=",
"null",
";",
"final... | Replies the project SRE from the given configuration.
@param configuration the configuration to read.
@param verify if true verify the SRE validity, do nothing otherwise
@param projectAccessor the accessor to the Java project.
@return the project SRE or <code>null</code>.
@throws CoreException Some error occurs when accessing to the ecore elements. | [
"Replies",
"the",
"project",
"SRE",
"from",
"the",
"given",
"configuration",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java#L191-L220 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java | AbstractSARLLaunchConfigurationDelegate.join | protected static String join(String... values) {
final StringBuilder buffer = new StringBuilder();
for (final String value : values) {
if (!Strings.isNullOrEmpty(value)) {
if (buffer.length() > 0) {
buffer.append(" "); //$NON-NLS-1$
}
buffer.append(value);
}
}
return buffer.toString();
} | java | protected static String join(String... values) {
final StringBuilder buffer = new StringBuilder();
for (final String value : values) {
if (!Strings.isNullOrEmpty(value)) {
if (buffer.length() > 0) {
buffer.append(" "); //$NON-NLS-1$
}
buffer.append(value);
}
}
return buffer.toString();
} | [
"protected",
"static",
"String",
"join",
"(",
"String",
"...",
"values",
")",
"{",
"final",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"final",
"String",
"value",
":",
"values",
")",
"{",
"if",
"(",
"!",
"Strings",... | Replies a string that is the concatenation of the given values.
@param values the values to merge.
@return the concatenation result. | [
"Replies",
"a",
"string",
"that",
"is",
"the",
"concatenation",
"of",
"the",
"given",
"values",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java#L314-L325 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java | AbstractSARLLaunchConfigurationDelegate.getOrComputeUnresolvedSARLRuntimeClasspath | private IRuntimeClasspathEntry[] getOrComputeUnresolvedSARLRuntimeClasspath(ILaunchConfiguration configuration)
throws CoreException {
// Get the buffered entries
IRuntimeClasspathEntry[] entries = null;
synchronized (this) {
if (this.unresolvedClasspathEntries != null) {
entries = this.unresolvedClasspathEntries.get();
}
}
if (entries != null) {
return entries;
}
// Get the classpath from the configuration.
entries = computeUnresolvedSARLRuntimeClasspath(configuration, this.configAccessor, cfg -> getJavaProject(cfg));
//
synchronized (this) {
this.unresolvedClasspathEntries = new SoftReference<>(entries);
}
return entries;
} | java | private IRuntimeClasspathEntry[] getOrComputeUnresolvedSARLRuntimeClasspath(ILaunchConfiguration configuration)
throws CoreException {
// Get the buffered entries
IRuntimeClasspathEntry[] entries = null;
synchronized (this) {
if (this.unresolvedClasspathEntries != null) {
entries = this.unresolvedClasspathEntries.get();
}
}
if (entries != null) {
return entries;
}
// Get the classpath from the configuration.
entries = computeUnresolvedSARLRuntimeClasspath(configuration, this.configAccessor, cfg -> getJavaProject(cfg));
//
synchronized (this) {
this.unresolvedClasspathEntries = new SoftReference<>(entries);
}
return entries;
} | [
"private",
"IRuntimeClasspathEntry",
"[",
"]",
"getOrComputeUnresolvedSARLRuntimeClasspath",
"(",
"ILaunchConfiguration",
"configuration",
")",
"throws",
"CoreException",
"{",
"// Get the buffered entries",
"IRuntimeClasspathEntry",
"[",
"]",
"entries",
"=",
"null",
";",
"syn... | Replies the class path for the SARL application.
@param configuration the configuration that provides the classpath.
@return the filtered entries.
@throws CoreException if impossible to get the classpath. | [
"Replies",
"the",
"class",
"path",
"for",
"the",
"SARL",
"application",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java#L471-L490 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java | AbstractSARLLaunchConfigurationDelegate.computeUnresolvedSARLRuntimeClasspath | public static IRuntimeClasspathEntry[] computeUnresolvedSARLRuntimeClasspath(ILaunchConfiguration configuration,
ILaunchConfigurationAccessor configAccessor,
IJavaProjectAccessor projectAccessor) throws CoreException {
// Get the classpath from the configuration.
final IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedRuntimeClasspath(configuration);
//
final List<IRuntimeClasspathEntry> filteredEntries = new ArrayList<>();
List<IRuntimeClasspathEntry> sreClasspathEntries = null;
// Filtering the entries by replacing the "SARL Libraries" with the SARL runtime environment.
for (final IRuntimeClasspathEntry entry : entries) {
if (entry.getPath().equals(SARLClasspathContainerInitializer.CONTAINER_ID)) {
if (sreClasspathEntries == null) {
sreClasspathEntries = getSREClasspathEntries(configuration, configAccessor, projectAccessor);
}
filteredEntries.addAll(sreClasspathEntries);
} else {
filteredEntries.add(entry);
}
}
return filteredEntries.toArray(new IRuntimeClasspathEntry[filteredEntries.size()]);
} | java | public static IRuntimeClasspathEntry[] computeUnresolvedSARLRuntimeClasspath(ILaunchConfiguration configuration,
ILaunchConfigurationAccessor configAccessor,
IJavaProjectAccessor projectAccessor) throws CoreException {
// Get the classpath from the configuration.
final IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedRuntimeClasspath(configuration);
//
final List<IRuntimeClasspathEntry> filteredEntries = new ArrayList<>();
List<IRuntimeClasspathEntry> sreClasspathEntries = null;
// Filtering the entries by replacing the "SARL Libraries" with the SARL runtime environment.
for (final IRuntimeClasspathEntry entry : entries) {
if (entry.getPath().equals(SARLClasspathContainerInitializer.CONTAINER_ID)) {
if (sreClasspathEntries == null) {
sreClasspathEntries = getSREClasspathEntries(configuration, configAccessor, projectAccessor);
}
filteredEntries.addAll(sreClasspathEntries);
} else {
filteredEntries.add(entry);
}
}
return filteredEntries.toArray(new IRuntimeClasspathEntry[filteredEntries.size()]);
} | [
"public",
"static",
"IRuntimeClasspathEntry",
"[",
"]",
"computeUnresolvedSARLRuntimeClasspath",
"(",
"ILaunchConfiguration",
"configuration",
",",
"ILaunchConfigurationAccessor",
"configAccessor",
",",
"IJavaProjectAccessor",
"projectAccessor",
")",
"throws",
"CoreException",
"{... | Compute the class path for the given launch configuration.
@param configuration the configuration that provides the classpath.
@param configAccessor the accessor to the SRE configuration.
@param projectAccessor the accessor to the Java project.
@return the filtered entries.
@throws CoreException if impossible to get the classpath. | [
"Compute",
"the",
"class",
"path",
"for",
"the",
"given",
"launch",
"configuration",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java#L500-L520 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java | AbstractSARLLaunchConfigurationDelegate.getSREClasspathEntries | private static List<IRuntimeClasspathEntry> getSREClasspathEntries(
ILaunchConfiguration configuration,
ILaunchConfigurationAccessor configAccessor,
IJavaProjectAccessor projectAccessor) throws CoreException {
final ISREInstall sre = getSREInstallFor(configuration, configAccessor, projectAccessor);
return sre.getClassPathEntries();
} | java | private static List<IRuntimeClasspathEntry> getSREClasspathEntries(
ILaunchConfiguration configuration,
ILaunchConfigurationAccessor configAccessor,
IJavaProjectAccessor projectAccessor) throws CoreException {
final ISREInstall sre = getSREInstallFor(configuration, configAccessor, projectAccessor);
return sre.getClassPathEntries();
} | [
"private",
"static",
"List",
"<",
"IRuntimeClasspathEntry",
">",
"getSREClasspathEntries",
"(",
"ILaunchConfiguration",
"configuration",
",",
"ILaunchConfigurationAccessor",
"configAccessor",
",",
"IJavaProjectAccessor",
"projectAccessor",
")",
"throws",
"CoreException",
"{",
... | Replies the classpath entries associated to the SRE of the given configuration.
@param configuration the configuration to read.
@param configAccessor the accessor to the SRE configuration.
@param projectAccessor the accessor to the Java project.
@return the classpath entries for the SRE associated to the configuration.
@throws CoreException if impossible to determine the classpath entries. | [
"Replies",
"the",
"classpath",
"entries",
"associated",
"to",
"the",
"SRE",
"of",
"the",
"given",
"configuration",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java#L530-L536 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java | AbstractSARLLaunchConfigurationDelegate.isNotSREEntry | private static boolean isNotSREEntry(IRuntimeClasspathEntry entry) {
try {
final File file = new File(entry.getLocation());
if (file.isDirectory()) {
return !SARLRuntime.isUnpackedSRE(file);
} else if (file.canRead()) {
return !SARLRuntime.isPackedSRE(file);
}
} catch (Throwable e) {
SARLEclipsePlugin.getDefault().log(e);
}
return true;
} | java | private static boolean isNotSREEntry(IRuntimeClasspathEntry entry) {
try {
final File file = new File(entry.getLocation());
if (file.isDirectory()) {
return !SARLRuntime.isUnpackedSRE(file);
} else if (file.canRead()) {
return !SARLRuntime.isPackedSRE(file);
}
} catch (Throwable e) {
SARLEclipsePlugin.getDefault().log(e);
}
return true;
} | [
"private",
"static",
"boolean",
"isNotSREEntry",
"(",
"IRuntimeClasspathEntry",
"entry",
")",
"{",
"try",
"{",
"final",
"File",
"file",
"=",
"new",
"File",
"(",
"entry",
".",
"getLocation",
"(",
")",
")",
";",
"if",
"(",
"file",
".",
"isDirectory",
"(",
... | Replies if the given classpath entry is a SRE.
@param entry the entry.
@return <code>true</code> if the entry points to a SRE;
<code>false</code> otherwise. | [
"Replies",
"if",
"the",
"given",
"classpath",
"entry",
"is",
"a",
"SRE",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java#L562-L574 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/executors/JdkExecutorService.java | JdkExecutorService.createTask | @SuppressWarnings("static-method")
protected Runnable createTask(Runnable runnable) {
if (runnable instanceof JanusRunnable) {
return runnable;
}
return new JanusRunnable(runnable);
} | java | @SuppressWarnings("static-method")
protected Runnable createTask(Runnable runnable) {
if (runnable instanceof JanusRunnable) {
return runnable;
}
return new JanusRunnable(runnable);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"Runnable",
"createTask",
"(",
"Runnable",
"runnable",
")",
"{",
"if",
"(",
"runnable",
"instanceof",
"JanusRunnable",
")",
"{",
"return",
"runnable",
";",
"}",
"return",
"new",
"JanusRunnable",
... | Create a task with the given runnable.
@param runnable the runnable.
@return the task. | [
"Create",
"a",
"task",
"with",
"the",
"given",
"runnable",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/executors/JdkExecutorService.java#L154-L160 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/executors/JdkExecutorService.java | JdkExecutorService.createTask | @SuppressWarnings("static-method")
protected <T> Callable<T> createTask(Callable<T> callable) {
if (callable instanceof JanusCallable<?>) {
return callable;
}
return new JanusCallable<>(callable);
} | java | @SuppressWarnings("static-method")
protected <T> Callable<T> createTask(Callable<T> callable) {
if (callable instanceof JanusCallable<?>) {
return callable;
}
return new JanusCallable<>(callable);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"<",
"T",
">",
"Callable",
"<",
"T",
">",
"createTask",
"(",
"Callable",
"<",
"T",
">",
"callable",
")",
"{",
"if",
"(",
"callable",
"instanceof",
"JanusCallable",
"<",
"?",
">",
")",
"... | Create a task with the given callable.
@param <T> the type of the returned value.
@param callable the callable.
@return the task. | [
"Create",
"a",
"task",
"with",
"the",
"given",
"callable",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/executors/JdkExecutorService.java#L168-L174 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/SARLAgentLaunchConfigurationDelegate.java | SARLAgentLaunchConfigurationDelegate.verifyAgentName | protected void verifyAgentName(ILaunchConfiguration configuration) throws CoreException {
final String name = getAgentName(configuration);
if (name == null) {
abort(
io.sarl.eclipse.launching.dialog.Messages.MainLaunchConfigurationTab_2,
null,
SARLEclipseConfig.ERR_UNSPECIFIED_AGENT_NAME);
}
} | java | protected void verifyAgentName(ILaunchConfiguration configuration) throws CoreException {
final String name = getAgentName(configuration);
if (name == null) {
abort(
io.sarl.eclipse.launching.dialog.Messages.MainLaunchConfigurationTab_2,
null,
SARLEclipseConfig.ERR_UNSPECIFIED_AGENT_NAME);
}
} | [
"protected",
"void",
"verifyAgentName",
"(",
"ILaunchConfiguration",
"configuration",
")",
"throws",
"CoreException",
"{",
"final",
"String",
"name",
"=",
"getAgentName",
"(",
"configuration",
")",
";",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"abort",
"(",
... | Verifies a main type name is specified by the given launch configuration,
and returns the main type name.
@param configuration launch configuration
@throws CoreException if unable to retrieve the attribute or the attribute is
unspecified | [
"Verifies",
"a",
"main",
"type",
"name",
"is",
"specified",
"by",
"the",
"given",
"launch",
"configuration",
"and",
"returns",
"the",
"main",
"type",
"name",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/SARLAgentLaunchConfigurationDelegate.java#L152-L160 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlAgentBuilderImpl.java | SarlAgentBuilderImpl.addSarlInterface | public ISarlInterfaceBuilder addSarlInterface(String name) {
ISarlInterfaceBuilder builder = this.iSarlInterfaceBuilderProvider.get();
builder.eInit(getSarlAgent(), name, getTypeResolutionContext());
return builder;
} | java | public ISarlInterfaceBuilder addSarlInterface(String name) {
ISarlInterfaceBuilder builder = this.iSarlInterfaceBuilderProvider.get();
builder.eInit(getSarlAgent(), name, getTypeResolutionContext());
return builder;
} | [
"public",
"ISarlInterfaceBuilder",
"addSarlInterface",
"(",
"String",
"name",
")",
"{",
"ISarlInterfaceBuilder",
"builder",
"=",
"this",
".",
"iSarlInterfaceBuilderProvider",
".",
"get",
"(",
")",
";",
"builder",
".",
"eInit",
"(",
"getSarlAgent",
"(",
")",
",",
... | Create a SarlInterface.
@param name the name of the SarlInterface.
@return the builder. | [
"Create",
"a",
"SarlInterface",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlAgentBuilderImpl.java#L248-L252 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlAgentBuilderImpl.java | SarlAgentBuilderImpl.addSarlEnumeration | public ISarlEnumerationBuilder addSarlEnumeration(String name) {
ISarlEnumerationBuilder builder = this.iSarlEnumerationBuilderProvider.get();
builder.eInit(getSarlAgent(), name, getTypeResolutionContext());
return builder;
} | java | public ISarlEnumerationBuilder addSarlEnumeration(String name) {
ISarlEnumerationBuilder builder = this.iSarlEnumerationBuilderProvider.get();
builder.eInit(getSarlAgent(), name, getTypeResolutionContext());
return builder;
} | [
"public",
"ISarlEnumerationBuilder",
"addSarlEnumeration",
"(",
"String",
"name",
")",
"{",
"ISarlEnumerationBuilder",
"builder",
"=",
"this",
".",
"iSarlEnumerationBuilderProvider",
".",
"get",
"(",
")",
";",
"builder",
".",
"eInit",
"(",
"getSarlAgent",
"(",
")",
... | Create a SarlEnumeration.
@param name the name of the SarlEnumeration.
@return the builder. | [
"Create",
"a",
"SarlEnumeration",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlAgentBuilderImpl.java#L261-L265 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlAgentBuilderImpl.java | SarlAgentBuilderImpl.addSarlAnnotationType | public ISarlAnnotationTypeBuilder addSarlAnnotationType(String name) {
ISarlAnnotationTypeBuilder builder = this.iSarlAnnotationTypeBuilderProvider.get();
builder.eInit(getSarlAgent(), name, getTypeResolutionContext());
return builder;
} | java | public ISarlAnnotationTypeBuilder addSarlAnnotationType(String name) {
ISarlAnnotationTypeBuilder builder = this.iSarlAnnotationTypeBuilderProvider.get();
builder.eInit(getSarlAgent(), name, getTypeResolutionContext());
return builder;
} | [
"public",
"ISarlAnnotationTypeBuilder",
"addSarlAnnotationType",
"(",
"String",
"name",
")",
"{",
"ISarlAnnotationTypeBuilder",
"builder",
"=",
"this",
".",
"iSarlAnnotationTypeBuilderProvider",
".",
"get",
"(",
")",
";",
"builder",
".",
"eInit",
"(",
"getSarlAgent",
... | Create a SarlAnnotationType.
@param name the name of the SarlAnnotationType.
@return the builder. | [
"Create",
"a",
"SarlAnnotationType",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlAgentBuilderImpl.java#L274-L278 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/AgentTraitData.java | AgentTraitData.removeTask | public void removeTask(AgentTask task) {
final Iterator<WeakReference<AgentTask>> iterator = this.tasks.iterator();
while (iterator.hasNext()) {
final WeakReference<AgentTask> reference = iterator.next();
final AgentTask knownTask = reference.get();
if (knownTask == null) {
iterator.remove();
} else if (Objects.equals(knownTask.getName(), task.getName())) {
iterator.remove();
return;
}
}
} | java | public void removeTask(AgentTask task) {
final Iterator<WeakReference<AgentTask>> iterator = this.tasks.iterator();
while (iterator.hasNext()) {
final WeakReference<AgentTask> reference = iterator.next();
final AgentTask knownTask = reference.get();
if (knownTask == null) {
iterator.remove();
} else if (Objects.equals(knownTask.getName(), task.getName())) {
iterator.remove();
return;
}
}
} | [
"public",
"void",
"removeTask",
"(",
"AgentTask",
"task",
")",
"{",
"final",
"Iterator",
"<",
"WeakReference",
"<",
"AgentTask",
">",
">",
"iterator",
"=",
"this",
".",
"tasks",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(... | Remove task.
@param task the task. | [
"Remove",
"task",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/AgentTraitData.java#L66-L78 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/acceptors/MultiModification.java | MultiModification.bind | public void bind(Class<?> type, Class<? extends SARLSemanticModification> modification) {
this.modificationTypes.put(type, modification);
} | java | public void bind(Class<?> type, Class<? extends SARLSemanticModification> modification) {
this.modificationTypes.put(type, modification);
} | [
"public",
"void",
"bind",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Class",
"<",
"?",
"extends",
"SARLSemanticModification",
">",
"modification",
")",
"{",
"this",
".",
"modificationTypes",
".",
"put",
"(",
"type",
",",
"modification",
")",
";",
"}"
] | Add a semantic modification related to the given element type.
@param type the type of the element.
@param modification the modification | [
"Add",
"a",
"semantic",
"modification",
"related",
"to",
"the",
"given",
"element",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/acceptors/MultiModification.java#L73-L75 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java | JavaInlineExpressionCompiler._generate | @SuppressWarnings("static-method")
protected Boolean _generate(CharSequence expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
output.appendStringConstant(expression.toString());
return Boolean.TRUE;
} | java | @SuppressWarnings("static-method")
protected Boolean _generate(CharSequence expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
output.appendStringConstant(expression.toString());
return Boolean.TRUE;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"Boolean",
"_generate",
"(",
"CharSequence",
"expression",
",",
"XExpression",
"parentExpression",
",",
"XtendExecutable",
"feature",
",",
"InlineAnnotationTreeAppendable",
"output",
")",
"{",
"output",
... | Append the inline code for the given character sequence.
@param expression the expression of the operation.
@param parentExpression is the expression that contains this one, or {@code null} if the current expression is
the root expression.
@param feature the feature that contains the expression.
@param output the output.
@return {@code true} if a text was appended. | [
"Append",
"the",
"inline",
"code",
"for",
"the",
"given",
"character",
"sequence",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java#L276-L281 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java | JavaInlineExpressionCompiler._generate | @SuppressWarnings("static-method")
protected Boolean _generate(Number expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
final Class<?> type = ReflectionUtil.getRawType(expression.getClass());
if (Byte.class.equals(type) || byte.class.equals(type)) {
output.appendConstant("(byte) (" + expression.toString() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
} else if (Short.class.equals(type) || short.class.equals(type)) {
output.appendConstant("(short) (" + expression.toString() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
} else if (Float.class.equals(type) || float.class.equals(type)) {
output.appendConstant(expression.toString() + "f"); //$NON-NLS-1$
} else {
output.appendConstant(expression.toString());
}
return Boolean.TRUE;
} | java | @SuppressWarnings("static-method")
protected Boolean _generate(Number expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
final Class<?> type = ReflectionUtil.getRawType(expression.getClass());
if (Byte.class.equals(type) || byte.class.equals(type)) {
output.appendConstant("(byte) (" + expression.toString() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
} else if (Short.class.equals(type) || short.class.equals(type)) {
output.appendConstant("(short) (" + expression.toString() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
} else if (Float.class.equals(type) || float.class.equals(type)) {
output.appendConstant(expression.toString() + "f"); //$NON-NLS-1$
} else {
output.appendConstant(expression.toString());
}
return Boolean.TRUE;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"Boolean",
"_generate",
"(",
"Number",
"expression",
",",
"XExpression",
"parentExpression",
",",
"XtendExecutable",
"feature",
",",
"InlineAnnotationTreeAppendable",
"output",
")",
"{",
"final",
"Clas... | Append the inline code for the given number value.
@param expression the expression of the operation.
@param parentExpression is the expression that contains this one, or {@code null} if the current expression is
the root expression.
@param feature the feature that contains the expression.
@param output the output.
@return {@code true} if a text was appended. | [
"Append",
"the",
"inline",
"code",
"for",
"the",
"given",
"number",
"value",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java#L308-L322 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java | JavaInlineExpressionCompiler._generate | @SuppressWarnings("static-method")
protected Boolean _generate(XBooleanLiteral expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
output.appendConstant(Boolean.toString(expression.isIsTrue()));
return Boolean.TRUE;
} | java | @SuppressWarnings("static-method")
protected Boolean _generate(XBooleanLiteral expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
output.appendConstant(Boolean.toString(expression.isIsTrue()));
return Boolean.TRUE;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"Boolean",
"_generate",
"(",
"XBooleanLiteral",
"expression",
",",
"XExpression",
"parentExpression",
",",
"XtendExecutable",
"feature",
",",
"InlineAnnotationTreeAppendable",
"output",
")",
"{",
"output... | Append the inline code for the given XBooleanLiteral.
@param expression the expression of the operation.
@param parentExpression is the expression that contains this one, or {@code null} if the current expression is
the root expression.
@param feature the feature that contains the expression.
@param output the output.
@return {@code true} if a text was appended. | [
"Append",
"the",
"inline",
"code",
"for",
"the",
"given",
"XBooleanLiteral",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java#L333-L338 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java | JavaInlineExpressionCompiler._generate | protected Boolean _generate(XNullLiteral expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
if (parentExpression == null && feature instanceof XtendFunction) {
final XtendFunction function = (XtendFunction) feature;
output.append("("); //$NON-NLS-1$
final JvmTypeReference reference = getFunctionTypeReference(function);
if (reference != null) {
final JvmType type = reference.getType();
if (type != null) {
output.append(type);
} else {
output.append(Object.class);
}
} else {
output.append(Object.class);
}
output.append(")"); //$NON-NLS-1$
output.append(Objects.toString(null));
output.setConstant(true);
} else {
output.appendConstant(Objects.toString(null));
}
return Boolean.TRUE;
} | java | protected Boolean _generate(XNullLiteral expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
if (parentExpression == null && feature instanceof XtendFunction) {
final XtendFunction function = (XtendFunction) feature;
output.append("("); //$NON-NLS-1$
final JvmTypeReference reference = getFunctionTypeReference(function);
if (reference != null) {
final JvmType type = reference.getType();
if (type != null) {
output.append(type);
} else {
output.append(Object.class);
}
} else {
output.append(Object.class);
}
output.append(")"); //$NON-NLS-1$
output.append(Objects.toString(null));
output.setConstant(true);
} else {
output.appendConstant(Objects.toString(null));
}
return Boolean.TRUE;
} | [
"protected",
"Boolean",
"_generate",
"(",
"XNullLiteral",
"expression",
",",
"XExpression",
"parentExpression",
",",
"XtendExecutable",
"feature",
",",
"InlineAnnotationTreeAppendable",
"output",
")",
"{",
"if",
"(",
"parentExpression",
"==",
"null",
"&&",
"feature",
... | Append the inline code for the given XNullLiteral.
@param expression the expression of the operation.
@param parentExpression is the expression that contains this one, or {@code null} if the current expression is
the root expression.
@param feature the feature that contains the expression.
@param output the output.
@return {@code true} if a text was appended. | [
"Append",
"the",
"inline",
"code",
"for",
"the",
"given",
"XNullLiteral",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java#L349-L372 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java | JavaInlineExpressionCompiler._generate | @SuppressWarnings("static-method")
protected Boolean _generate(XNumberLiteral expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
output.appendConstant(expression.getValue());
return Boolean.TRUE;
} | java | @SuppressWarnings("static-method")
protected Boolean _generate(XNumberLiteral expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
output.appendConstant(expression.getValue());
return Boolean.TRUE;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"Boolean",
"_generate",
"(",
"XNumberLiteral",
"expression",
",",
"XExpression",
"parentExpression",
",",
"XtendExecutable",
"feature",
",",
"InlineAnnotationTreeAppendable",
"output",
")",
"{",
"output"... | Append the inline code for the given XNumberLiteral.
@param expression the expression of the operation.
@param parentExpression is the expression that contains this one, or {@code null} if the current expression is
the root expression.
@param feature the feature that contains the expression.
@param output the output.
@return {@code true} if a text was appended. | [
"Append",
"the",
"inline",
"code",
"for",
"the",
"given",
"XNumberLiteral",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java#L383-L388 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java | JavaInlineExpressionCompiler._generate | @SuppressWarnings("static-method")
protected Boolean _generate(XStringLiteral expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
output.appendStringConstant(expression.getValue());
return Boolean.TRUE;
} | java | @SuppressWarnings("static-method")
protected Boolean _generate(XStringLiteral expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
output.appendStringConstant(expression.getValue());
return Boolean.TRUE;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"Boolean",
"_generate",
"(",
"XStringLiteral",
"expression",
",",
"XExpression",
"parentExpression",
",",
"XtendExecutable",
"feature",
",",
"InlineAnnotationTreeAppendable",
"output",
")",
"{",
"output"... | Append the inline code for the given XStringLiteral.
@param expression the expression of the operation.
@param parentExpression is the expression that contains this one, or {@code null} if the current expression is
the root expression.
@param feature the feature that contains the expression.
@param output the output.
@return {@code true} if a text was appended. | [
"Append",
"the",
"inline",
"code",
"for",
"the",
"given",
"XStringLiteral",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java#L399-L404 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java | JavaInlineExpressionCompiler._generate | @SuppressWarnings("static-method")
protected Boolean _generate(XTypeLiteral expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
output.appendTypeConstant(expression.getType());
return Boolean.TRUE;
} | java | @SuppressWarnings("static-method")
protected Boolean _generate(XTypeLiteral expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
output.appendTypeConstant(expression.getType());
return Boolean.TRUE;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"Boolean",
"_generate",
"(",
"XTypeLiteral",
"expression",
",",
"XExpression",
"parentExpression",
",",
"XtendExecutable",
"feature",
",",
"InlineAnnotationTreeAppendable",
"output",
")",
"{",
"output",
... | Append the inline code for the given XTypeLiteral.
@param expression the expression of the operation.
@param parentExpression is the expression that contains this one, or {@code null} if the current expression is
the root expression.
@param feature the feature that contains the expression.
@param output the output.
@return {@code true} if a text was appended. | [
"Append",
"the",
"inline",
"code",
"for",
"the",
"given",
"XTypeLiteral",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java#L415-L420 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java | JavaInlineExpressionCompiler._generate | protected Boolean _generate(XCastedExpression expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
final InlineAnnotationTreeAppendable child = newAppendable(output.getImportManager());
boolean bool = generate(expression.getTarget(), expression, feature, child);
final String childContent = child.getContent();
if (!Strings.isEmpty(childContent)) {
output.append("("); //$NON-NLS-1$
output.append(expression.getType().getType());
output.append(")"); //$NON-NLS-1$
output.append(childContent);
output.setConstant(child.isConstant());
bool = true;
}
return bool;
} | java | protected Boolean _generate(XCastedExpression expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
final InlineAnnotationTreeAppendable child = newAppendable(output.getImportManager());
boolean bool = generate(expression.getTarget(), expression, feature, child);
final String childContent = child.getContent();
if (!Strings.isEmpty(childContent)) {
output.append("("); //$NON-NLS-1$
output.append(expression.getType().getType());
output.append(")"); //$NON-NLS-1$
output.append(childContent);
output.setConstant(child.isConstant());
bool = true;
}
return bool;
} | [
"protected",
"Boolean",
"_generate",
"(",
"XCastedExpression",
"expression",
",",
"XExpression",
"parentExpression",
",",
"XtendExecutable",
"feature",
",",
"InlineAnnotationTreeAppendable",
"output",
")",
"{",
"final",
"InlineAnnotationTreeAppendable",
"child",
"=",
"newAp... | Append the inline code for the given XCastedExpression.
@param expression the expression of the operation.
@param parentExpression is the expression that contains this one, or {@code null} if the current expression is
the root expression.
@param feature the feature that contains the expression.
@param output the output.
@return {@code true} if a text was appended. | [
"Append",
"the",
"inline",
"code",
"for",
"the",
"given",
"XCastedExpression",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java#L431-L445 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java | JavaInlineExpressionCompiler._generate | protected Boolean _generate(XReturnExpression expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
return generate(expression.getExpression(), parentExpression, feature, output);
} | java | protected Boolean _generate(XReturnExpression expression, XExpression parentExpression, XtendExecutable feature,
InlineAnnotationTreeAppendable output) {
return generate(expression.getExpression(), parentExpression, feature, output);
} | [
"protected",
"Boolean",
"_generate",
"(",
"XReturnExpression",
"expression",
",",
"XExpression",
"parentExpression",
",",
"XtendExecutable",
"feature",
",",
"InlineAnnotationTreeAppendable",
"output",
")",
"{",
"return",
"generate",
"(",
"expression",
".",
"getExpression"... | Append the inline code for the given XReturnLiteral.
@param expression the expression of the operation.
@param parentExpression is the expression that contains this one, or {@code null} if the current expression is
the root expression.
@param feature the feature that contains the expression.
@param output the output.
@return {@code true} if a text was appended. | [
"Append",
"the",
"inline",
"code",
"for",
"the",
"given",
"XReturnLiteral",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/JavaInlineExpressionCompiler.java#L481-L484 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java | AbstractSubCodeBuilderFragment.getExportedPackages | public void getExportedPackages(Set<String> exportedPackages) {
if (exportedPackages != null) {
exportedPackages.add(getCodeElementExtractor().getBasePackage());
exportedPackages.add(getCodeElementExtractor().getBuilderPackage());
if (getCodeBuilderConfig().isISourceAppendableEnable()) {
exportedPackages.add(getCodeElementExtractor().getAppenderPackage());
}
}
} | java | public void getExportedPackages(Set<String> exportedPackages) {
if (exportedPackages != null) {
exportedPackages.add(getCodeElementExtractor().getBasePackage());
exportedPackages.add(getCodeElementExtractor().getBuilderPackage());
if (getCodeBuilderConfig().isISourceAppendableEnable()) {
exportedPackages.add(getCodeElementExtractor().getAppenderPackage());
}
}
} | [
"public",
"void",
"getExportedPackages",
"(",
"Set",
"<",
"String",
">",
"exportedPackages",
")",
"{",
"if",
"(",
"exportedPackages",
"!=",
"null",
")",
"{",
"exportedPackages",
".",
"add",
"(",
"getCodeElementExtractor",
"(",
")",
".",
"getBasePackage",
"(",
... | Fill the given set with the exported packages for this fragment.
@param exportedPackages the set to fill in. | [
"Fill",
"the",
"given",
"set",
"with",
"the",
"exported",
"packages",
"for",
"this",
"fragment",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java#L156-L164 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java | AbstractSubCodeBuilderFragment.getLanguageScriptMemberGetter | @Pure
protected String getLanguageScriptMemberGetter() {
final Grammar grammar = getGrammar();
final AbstractRule scriptRule = GrammarUtil.findRuleForName(grammar, getCodeBuilderConfig().getScriptRuleName());
for (final Assignment assignment : GrammarUtil.containedAssignments(scriptRule)) {
if ((assignment.getTerminal() instanceof RuleCall)
&& Objects.equals(((RuleCall) assignment.getTerminal()).getRule().getName(),
getCodeBuilderConfig().getTopElementRuleName())) {
return "get" + Strings.toFirstUpper(assignment.getFeature()); //$NON-NLS-1$
}
}
throw new IllegalStateException("member not found"); //$NON-NLS-1$
} | java | @Pure
protected String getLanguageScriptMemberGetter() {
final Grammar grammar = getGrammar();
final AbstractRule scriptRule = GrammarUtil.findRuleForName(grammar, getCodeBuilderConfig().getScriptRuleName());
for (final Assignment assignment : GrammarUtil.containedAssignments(scriptRule)) {
if ((assignment.getTerminal() instanceof RuleCall)
&& Objects.equals(((RuleCall) assignment.getTerminal()).getRule().getName(),
getCodeBuilderConfig().getTopElementRuleName())) {
return "get" + Strings.toFirstUpper(assignment.getFeature()); //$NON-NLS-1$
}
}
throw new IllegalStateException("member not found"); //$NON-NLS-1$
} | [
"@",
"Pure",
"protected",
"String",
"getLanguageScriptMemberGetter",
"(",
")",
"{",
"final",
"Grammar",
"grammar",
"=",
"getGrammar",
"(",
")",
";",
"final",
"AbstractRule",
"scriptRule",
"=",
"GrammarUtil",
".",
"findRuleForName",
"(",
"grammar",
",",
"getCodeBui... | Replies the getter function for accessing to the top element collection of the script.
@return the name of the getter function. | [
"Replies",
"the",
"getter",
"function",
"for",
"accessing",
"to",
"the",
"top",
"element",
"collection",
"of",
"the",
"script",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java#L369-L381 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java | AbstractSubCodeBuilderFragment.getXFactoryFor | @Pure
protected TypeReference getXFactoryFor(TypeReference type) {
final String packageName = type.getPackageName();
final Grammar grammar = getGrammar();
TypeReference reference = getXFactoryFor(packageName, grammar);
if (reference != null) {
return reference;
}
for (final Grammar usedGrammar : GrammarUtil.allUsedGrammars(grammar)) {
reference = getXFactoryFor(packageName, usedGrammar);
if (reference != null) {
return reference;
}
}
throw new IllegalStateException("Cannot find the XFactory for " + type); //$NON-NLS-1$
} | java | @Pure
protected TypeReference getXFactoryFor(TypeReference type) {
final String packageName = type.getPackageName();
final Grammar grammar = getGrammar();
TypeReference reference = getXFactoryFor(packageName, grammar);
if (reference != null) {
return reference;
}
for (final Grammar usedGrammar : GrammarUtil.allUsedGrammars(grammar)) {
reference = getXFactoryFor(packageName, usedGrammar);
if (reference != null) {
return reference;
}
}
throw new IllegalStateException("Cannot find the XFactory for " + type); //$NON-NLS-1$
} | [
"@",
"Pure",
"protected",
"TypeReference",
"getXFactoryFor",
"(",
"TypeReference",
"type",
")",
"{",
"final",
"String",
"packageName",
"=",
"type",
".",
"getPackageName",
"(",
")",
";",
"final",
"Grammar",
"grammar",
"=",
"getGrammar",
"(",
")",
";",
"TypeRefe... | Replies the type for the factory for the given type.
@param type the type of the object to create.
@return the factory. | [
"Replies",
"the",
"type",
"for",
"the",
"factory",
"for",
"the",
"given",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java#L397-L413 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java | AbstractSubCodeBuilderFragment.generateAppenderMembers | @SuppressWarnings("static-method")
protected StringConcatenationClient generateAppenderMembers(String appenderSimpleName,
TypeReference builderInterface, String elementAccessor) {
return new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation it) {
it.append("\tprivate final "); //$NON-NLS-1$
it.append(builderInterface);
it.append(" builder;"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
it.append("\tpublic "); //$NON-NLS-1$
it.append(appenderSimpleName);
it.append("("); //$NON-NLS-1$
it.append(builderInterface);
it.append(" builder) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\tthis.builder = builder;"); //$NON-NLS-1$
it.newLine();
it.append("\t}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
it.append("\tpublic void build("); //$NON-NLS-1$
it.append(ISourceAppender.class);
it.append(" appender) throws "); //$NON-NLS-1$
it.append(IOException.class);
it.append(" {"); //$NON-NLS-1$
it.newLine();
it.append("\t\tbuild(this.builder."); //$NON-NLS-1$
it.append(elementAccessor);
it.append(", appender);"); //$NON-NLS-1$
it.newLine();
it.append("\t}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
}
};
} | java | @SuppressWarnings("static-method")
protected StringConcatenationClient generateAppenderMembers(String appenderSimpleName,
TypeReference builderInterface, String elementAccessor) {
return new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation it) {
it.append("\tprivate final "); //$NON-NLS-1$
it.append(builderInterface);
it.append(" builder;"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
it.append("\tpublic "); //$NON-NLS-1$
it.append(appenderSimpleName);
it.append("("); //$NON-NLS-1$
it.append(builderInterface);
it.append(" builder) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\tthis.builder = builder;"); //$NON-NLS-1$
it.newLine();
it.append("\t}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
it.append("\tpublic void build("); //$NON-NLS-1$
it.append(ISourceAppender.class);
it.append(" appender) throws "); //$NON-NLS-1$
it.append(IOException.class);
it.append(" {"); //$NON-NLS-1$
it.newLine();
it.append("\t\tbuild(this.builder."); //$NON-NLS-1$
it.append(elementAccessor);
it.append(", appender);"); //$NON-NLS-1$
it.newLine();
it.append("\t}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
}
};
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"StringConcatenationClient",
"generateAppenderMembers",
"(",
"String",
"appenderSimpleName",
",",
"TypeReference",
"builderInterface",
",",
"String",
"elementAccessor",
")",
"{",
"return",
"new",
"StringCo... | Generate the members related to appenders.
@param appenderSimpleName the simple name of the appender.
@param builderInterface the interface of the code builder to wrap.
@param elementAccessor the code for accessing to the generated element.
@return the code. | [
"Generate",
"the",
"members",
"related",
"to",
"appenders",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java#L442-L479 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java | AbstractSubCodeBuilderFragment.getAorAnArticle | protected static String getAorAnArticle(String word) {
if (Arrays.asList('a', 'e', 'i', 'o', 'u', 'y').contains(Character.toLowerCase(word.charAt(0)))) {
return "an"; //$NON-NLS-1$
}
return "a"; //$NON-NLS-1$
} | java | protected static String getAorAnArticle(String word) {
if (Arrays.asList('a', 'e', 'i', 'o', 'u', 'y').contains(Character.toLowerCase(word.charAt(0)))) {
return "an"; //$NON-NLS-1$
}
return "a"; //$NON-NLS-1$
} | [
"protected",
"static",
"String",
"getAorAnArticle",
"(",
"String",
"word",
")",
"{",
"if",
"(",
"Arrays",
".",
"asList",
"(",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
")",
".",
"contains",
"(",
"Chara... | Replies the "an" or "a" article according to the given word.
<p>This function does not follow the real English grammatical rule, but it is
an acceptable approximation.
@param word the word that follows the article.
@return the article. | [
"Replies",
"the",
"an",
"or",
"a",
"article",
"according",
"to",
"the",
"given",
"word",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java#L631-L636 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java | AbstractSubCodeBuilderFragment.toSingular | protected static String toSingular(String word) {
if (word.endsWith("ies")) { //$NON-NLS-1$
return word.substring(0, word.length() - 3) + "y"; //$NON-NLS-1$
}
if (word.endsWith("s")) { //$NON-NLS-1$
return word.substring(0, word.length() - 1);
}
return word;
} | java | protected static String toSingular(String word) {
if (word.endsWith("ies")) { //$NON-NLS-1$
return word.substring(0, word.length() - 3) + "y"; //$NON-NLS-1$
}
if (word.endsWith("s")) { //$NON-NLS-1$
return word.substring(0, word.length() - 1);
}
return word;
} | [
"protected",
"static",
"String",
"toSingular",
"(",
"String",
"word",
")",
"{",
"if",
"(",
"word",
".",
"endsWith",
"(",
"\"ies\"",
")",
")",
"{",
"//$NON-NLS-1$",
"return",
"word",
".",
"substring",
"(",
"0",
",",
"word",
".",
"length",
"(",
")",
"-",... | Replies the singular version of the word.
<p>This function does not follow the real English grammatical rule, but it is
an acceptable approximation.
@param word the word.
@return the singular word. | [
"Replies",
"the",
"singular",
"version",
"of",
"the",
"word",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java#L646-L654 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java | AbstractSubCodeBuilderFragment.nameMatches | protected static boolean nameMatches(EObject element, String pattern) {
if (element instanceof RuleCall) {
return nameMatches(((RuleCall) element).getRule(), pattern);
}
if (element instanceof AbstractRule) {
final String name = ((AbstractRule) element).getName();
final Pattern compilerPattern = Pattern.compile(pattern);
final Matcher matcher = compilerPattern.matcher(name);
if (matcher.find()) {
return true;
}
}
return false;
} | java | protected static boolean nameMatches(EObject element, String pattern) {
if (element instanceof RuleCall) {
return nameMatches(((RuleCall) element).getRule(), pattern);
}
if (element instanceof AbstractRule) {
final String name = ((AbstractRule) element).getName();
final Pattern compilerPattern = Pattern.compile(pattern);
final Matcher matcher = compilerPattern.matcher(name);
if (matcher.find()) {
return true;
}
}
return false;
} | [
"protected",
"static",
"boolean",
"nameMatches",
"(",
"EObject",
"element",
",",
"String",
"pattern",
")",
"{",
"if",
"(",
"element",
"instanceof",
"RuleCall",
")",
"{",
"return",
"nameMatches",
"(",
"(",
"(",
"RuleCall",
")",
"element",
")",
".",
"getRule",... | Replies if the name of the given element is matching the pattern.
@param element the element.
@param pattern the name pattern.
@return <code>true</code> if the element's name is matching. | [
"Replies",
"if",
"the",
"name",
"of",
"the",
"given",
"element",
"is",
"matching",
"the",
"pattern",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java#L662-L675 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java | AbstractSubCodeBuilderFragment.bindElementDescription | protected void bindElementDescription(BindingFactory factory, CodeElementExtractor.ElementDescription... descriptions) {
for (final CodeElementExtractor.ElementDescription description : descriptions) {
bindTypeReferences(factory,
description.getBuilderInterfaceType(),
description.getBuilderImplementationType(),
description.getBuilderCustomImplementationType());
}
} | java | protected void bindElementDescription(BindingFactory factory, CodeElementExtractor.ElementDescription... descriptions) {
for (final CodeElementExtractor.ElementDescription description : descriptions) {
bindTypeReferences(factory,
description.getBuilderInterfaceType(),
description.getBuilderImplementationType(),
description.getBuilderCustomImplementationType());
}
} | [
"protected",
"void",
"bindElementDescription",
"(",
"BindingFactory",
"factory",
",",
"CodeElementExtractor",
".",
"ElementDescription",
"...",
"descriptions",
")",
"{",
"for",
"(",
"final",
"CodeElementExtractor",
".",
"ElementDescription",
"description",
":",
"descripti... | Binds the given descriptions according to the standard policy.
<p>If an custom implementation is defined, it is binded to. Otherwise, the default implementation
is binded.
@param factory the binding factory to use for creating the bindings.
@param descriptions the descriptions to bind to. | [
"Binds",
"the",
"given",
"descriptions",
"according",
"to",
"the",
"standard",
"policy",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java#L707-L714 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java | AbstractSubCodeBuilderFragment.bindTypeReferences | protected void bindTypeReferences(BindingFactory factory, TypeReference interfaceType,
TypeReference implementationType, TypeReference customImplementationType) {
final IFileSystemAccess2 fileSystem = getSrc();
final TypeReference type;
if ((fileSystem.isFile(implementationType.getJavaPath()))
|| (fileSystem.isFile(customImplementationType.getXtendPath()))) {
type = customImplementationType;
} else {
type = implementationType;
}
factory.addfinalTypeToType(interfaceType, type);
} | java | protected void bindTypeReferences(BindingFactory factory, TypeReference interfaceType,
TypeReference implementationType, TypeReference customImplementationType) {
final IFileSystemAccess2 fileSystem = getSrc();
final TypeReference type;
if ((fileSystem.isFile(implementationType.getJavaPath()))
|| (fileSystem.isFile(customImplementationType.getXtendPath()))) {
type = customImplementationType;
} else {
type = implementationType;
}
factory.addfinalTypeToType(interfaceType, type);
} | [
"protected",
"void",
"bindTypeReferences",
"(",
"BindingFactory",
"factory",
",",
"TypeReference",
"interfaceType",
",",
"TypeReference",
"implementationType",
",",
"TypeReference",
"customImplementationType",
")",
"{",
"final",
"IFileSystemAccess2",
"fileSystem",
"=",
"get... | Binds the given references according to the standard policy.
<p>If an custom implementation is defined, it is binded to. Otherwise, the default implementation
is binded.
@param factory the binding factory to use for creating the bindings.
@param interfaceType the type to bind to an implementation type.
@param implementationType the implementation to bind to the interface type.
@param customImplementationType the custom implementation to bind to the interface type. | [
"Binds",
"the",
"given",
"references",
"according",
"to",
"the",
"standard",
"policy",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java#L726-L737 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java | AbstractSubCodeBuilderFragment.getMemberRule | protected AbstractRule getMemberRule(CodeElementExtractor.ElementDescription description) {
for (final Assignment assignment : GrammarUtil.containedAssignments(description.getGrammarComponent())) {
if (Objects.equals(getCodeBuilderConfig().getMemberCollectionExtensionGrammarName(), assignment.getFeature())) {
if (assignment.getTerminal() instanceof RuleCall) {
return ((RuleCall) assignment.getTerminal()).getRule();
}
}
}
return null;
} | java | protected AbstractRule getMemberRule(CodeElementExtractor.ElementDescription description) {
for (final Assignment assignment : GrammarUtil.containedAssignments(description.getGrammarComponent())) {
if (Objects.equals(getCodeBuilderConfig().getMemberCollectionExtensionGrammarName(), assignment.getFeature())) {
if (assignment.getTerminal() instanceof RuleCall) {
return ((RuleCall) assignment.getTerminal()).getRule();
}
}
}
return null;
} | [
"protected",
"AbstractRule",
"getMemberRule",
"(",
"CodeElementExtractor",
".",
"ElementDescription",
"description",
")",
"{",
"for",
"(",
"final",
"Assignment",
"assignment",
":",
"GrammarUtil",
".",
"containedAssignments",
"(",
"description",
".",
"getGrammarComponent",... | Replies the rule used for defining the members of the given element.
@param description description of the container.
@return the rule that is defining the members. | [
"Replies",
"the",
"rule",
"used",
"for",
"defining",
"the",
"members",
"of",
"the",
"given",
"element",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java#L744-L753 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java | MavenHelper.getConfig | public String getConfig(String key) throws MojoExecutionException {
ResourceBundle resource = null;
try {
resource = ResourceBundle.getBundle(
"io/sarl/maven/compiler/config", //$NON-NLS-1$
java.util.Locale.getDefault(),
MavenHelper.class.getClassLoader());
} catch (MissingResourceException e) {
throw new MojoExecutionException(e.getLocalizedMessage(), e);
}
String value = resource.getString(key);
if (value == null || value.isEmpty()) {
value = Strings.nullToEmpty(value);
this.log.warn(MessageFormat.format(Messages.MavenHelper_1, key));
}
return value;
} | java | public String getConfig(String key) throws MojoExecutionException {
ResourceBundle resource = null;
try {
resource = ResourceBundle.getBundle(
"io/sarl/maven/compiler/config", //$NON-NLS-1$
java.util.Locale.getDefault(),
MavenHelper.class.getClassLoader());
} catch (MissingResourceException e) {
throw new MojoExecutionException(e.getLocalizedMessage(), e);
}
String value = resource.getString(key);
if (value == null || value.isEmpty()) {
value = Strings.nullToEmpty(value);
this.log.warn(MessageFormat.format(Messages.MavenHelper_1, key));
}
return value;
} | [
"public",
"String",
"getConfig",
"(",
"String",
"key",
")",
"throws",
"MojoExecutionException",
"{",
"ResourceBundle",
"resource",
"=",
"null",
";",
"try",
"{",
"resource",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"\"io/sarl/maven/compiler/config\"",
",",
"//$N... | Extract the value from the hard-coded configuration.
@param key the key of the configuration entry.
@return the value.
@throws MojoExecutionException on error. | [
"Extract",
"the",
"value",
"from",
"the",
"hard",
"-",
"coded",
"configuration",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java#L152-L168 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java | MavenHelper.loadPlugin | public PluginDescriptor loadPlugin(Plugin plugin)
throws MojoExecutionException {
try {
final Object repositorySessionObject = this.getRepositorySessionMethod.invoke(this.session);
return (PluginDescriptor) this.loadPluginMethod.invoke(
this.buildPluginManager,
plugin,
getSession().getCurrentProject().getRemotePluginRepositories(),
repositorySessionObject);
} catch (IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
throw new MojoExecutionException(e.getLocalizedMessage(), e);
}
} | java | public PluginDescriptor loadPlugin(Plugin plugin)
throws MojoExecutionException {
try {
final Object repositorySessionObject = this.getRepositorySessionMethod.invoke(this.session);
return (PluginDescriptor) this.loadPluginMethod.invoke(
this.buildPluginManager,
plugin,
getSession().getCurrentProject().getRemotePluginRepositories(),
repositorySessionObject);
} catch (IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
throw new MojoExecutionException(e.getLocalizedMessage(), e);
}
} | [
"public",
"PluginDescriptor",
"loadPlugin",
"(",
"Plugin",
"plugin",
")",
"throws",
"MojoExecutionException",
"{",
"try",
"{",
"final",
"Object",
"repositorySessionObject",
"=",
"this",
".",
"getRepositorySessionMethod",
".",
"invoke",
"(",
"this",
".",
"session",
"... | Load the given plugin.
@param plugin the plugin to load.
@return the descriptor of the plugin.
@throws MojoExecutionException if something bad append. | [
"Load",
"the",
"given",
"plugin",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java#L176-L189 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java | MavenHelper.executeMojo | public void executeMojo(MojoExecution mojo) throws MojoExecutionException, MojoFailureException {
try {
this.buildPluginManager.executeMojo(this.session, mojo);
} catch (PluginConfigurationException
| PluginManagerException e) {
throw new MojoFailureException(e.getLocalizedMessage(), e);
}
} | java | public void executeMojo(MojoExecution mojo) throws MojoExecutionException, MojoFailureException {
try {
this.buildPluginManager.executeMojo(this.session, mojo);
} catch (PluginConfigurationException
| PluginManagerException e) {
throw new MojoFailureException(e.getLocalizedMessage(), e);
}
} | [
"public",
"void",
"executeMojo",
"(",
"MojoExecution",
"mojo",
")",
"throws",
"MojoExecutionException",
",",
"MojoFailureException",
"{",
"try",
"{",
"this",
".",
"buildPluginManager",
".",
"executeMojo",
"(",
"this",
".",
"session",
",",
"mojo",
")",
";",
"}",
... | Execute the given mojo.
@param mojo the mojo to execute.
@throws MojoExecutionException if the mojo cannot be run properly.
@throws MojoFailureException if the build failed. | [
"Execute",
"the",
"given",
"mojo",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java#L197-L204 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java | MavenHelper.toDependency | @SuppressWarnings("static-method")
public Dependency toDependency(Artifact artifact) {
final Dependency result = new Dependency();
result.setArtifactId(artifact.getArtifactId());
result.setClassifier(artifact.getClassifier());
result.setGroupId(artifact.getGroupId());
result.setOptional(artifact.isOptional());
result.setScope(artifact.getScope());
result.setType(artifact.getType());
result.setVersion(artifact.getVersion());
return result;
} | java | @SuppressWarnings("static-method")
public Dependency toDependency(Artifact artifact) {
final Dependency result = new Dependency();
result.setArtifactId(artifact.getArtifactId());
result.setClassifier(artifact.getClassifier());
result.setGroupId(artifact.getGroupId());
result.setOptional(artifact.isOptional());
result.setScope(artifact.getScope());
result.setType(artifact.getType());
result.setVersion(artifact.getVersion());
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"public",
"Dependency",
"toDependency",
"(",
"Artifact",
"artifact",
")",
"{",
"final",
"Dependency",
"result",
"=",
"new",
"Dependency",
"(",
")",
";",
"result",
".",
"setArtifactId",
"(",
"artifact",
".",... | Convert an artifact to a dependency.
@param artifact the artifact to convert.
@return the result of the conversion. | [
"Convert",
"an",
"artifact",
"to",
"a",
"dependency",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java#L211-L222 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java | MavenHelper.getPluginDependencies | public synchronized Map<String, Dependency> getPluginDependencies() throws MojoExecutionException {
if (this.pluginDependencies == null) {
final String groupId = getConfig("plugin.groupId"); //$NON-NLS-1$
final String artifactId = getConfig("plugin.artifactId"); //$NON-NLS-1$
final String pluginArtifactKey = ArtifactUtils.versionlessKey(groupId, artifactId);
final Set<Artifact> dependencies = resolveDependencies(pluginArtifactKey, true);
final Map<String, Dependency> deps = new TreeMap<>();
for (final Artifact artifact : dependencies) {
final Dependency dep = toDependency(artifact);
deps.put(ArtifactUtils.versionlessKey(artifact), dep);
}
this.pluginDependencies = deps;
}
return this.pluginDependencies;
} | java | public synchronized Map<String, Dependency> getPluginDependencies() throws MojoExecutionException {
if (this.pluginDependencies == null) {
final String groupId = getConfig("plugin.groupId"); //$NON-NLS-1$
final String artifactId = getConfig("plugin.artifactId"); //$NON-NLS-1$
final String pluginArtifactKey = ArtifactUtils.versionlessKey(groupId, artifactId);
final Set<Artifact> dependencies = resolveDependencies(pluginArtifactKey, true);
final Map<String, Dependency> deps = new TreeMap<>();
for (final Artifact artifact : dependencies) {
final Dependency dep = toDependency(artifact);
deps.put(ArtifactUtils.versionlessKey(artifact), dep);
}
this.pluginDependencies = deps;
}
return this.pluginDependencies;
} | [
"public",
"synchronized",
"Map",
"<",
"String",
",",
"Dependency",
">",
"getPluginDependencies",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"this",
".",
"pluginDependencies",
"==",
"null",
")",
"{",
"final",
"String",
"groupId",
"=",
"getConfi... | Build the map of dependencies for the current plugin.
@return the artifact.
@throws MojoExecutionException if the current plugin cannot be determined. | [
"Build",
"the",
"map",
"of",
"dependencies",
"for",
"the",
"current",
"plugin",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java#L229-L247 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java | MavenHelper.resolve | public Set<Artifact> resolve(String groupId, String artifactId) throws MojoExecutionException {
final ArtifactResolutionRequest request = new ArtifactResolutionRequest();
request.setResolveRoot(true);
request.setResolveTransitively(true);
request.setLocalRepository(getSession().getLocalRepository());
request.setRemoteRepositories(getSession().getCurrentProject().getRemoteArtifactRepositories());
request.setOffline(getSession().isOffline());
request.setForceUpdate(getSession().getRequest().isUpdateSnapshots());
request.setServers(getSession().getRequest().getServers());
request.setMirrors(getSession().getRequest().getMirrors());
request.setProxies(getSession().getRequest().getProxies());
request.setArtifact(createArtifact(groupId, artifactId));
final ArtifactResolutionResult result = resolve(request);
return result.getArtifacts();
} | java | public Set<Artifact> resolve(String groupId, String artifactId) throws MojoExecutionException {
final ArtifactResolutionRequest request = new ArtifactResolutionRequest();
request.setResolveRoot(true);
request.setResolveTransitively(true);
request.setLocalRepository(getSession().getLocalRepository());
request.setRemoteRepositories(getSession().getCurrentProject().getRemoteArtifactRepositories());
request.setOffline(getSession().isOffline());
request.setForceUpdate(getSession().getRequest().isUpdateSnapshots());
request.setServers(getSession().getRequest().getServers());
request.setMirrors(getSession().getRequest().getMirrors());
request.setProxies(getSession().getRequest().getProxies());
request.setArtifact(createArtifact(groupId, artifactId));
final ArtifactResolutionResult result = resolve(request);
return result.getArtifacts();
} | [
"public",
"Set",
"<",
"Artifact",
">",
"resolve",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
")",
"throws",
"MojoExecutionException",
"{",
"final",
"ArtifactResolutionRequest",
"request",
"=",
"new",
"ArtifactResolutionRequest",
"(",
")",
";",
"request",... | Resolve the artifacts with the given key.
@param groupId the group identifier.
@param artifactId the artifact identifier.
@return the discovered artifacts.
@throws MojoExecutionException if resolution cannot be done.
@since 0.8 | [
"Resolve",
"the",
"artifacts",
"with",
"the",
"given",
"key",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java#L268-L284 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java | MavenHelper.createArtifact | public Artifact createArtifact(String groupId, String artifactId) {
return this.repositorySystem.createArtifact(groupId, artifactId, "RELEASE", "jar"); //$NON-NLS-1$ //$NON-NLS-2$
} | java | public Artifact createArtifact(String groupId, String artifactId) {
return this.repositorySystem.createArtifact(groupId, artifactId, "RELEASE", "jar"); //$NON-NLS-1$ //$NON-NLS-2$
} | [
"public",
"Artifact",
"createArtifact",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
")",
"{",
"return",
"this",
".",
"repositorySystem",
".",
"createArtifact",
"(",
"groupId",
",",
"artifactId",
",",
"\"RELEASE\"",
",",
"\"jar\"",
")",
";",
"//$NON-NL... | Create an instance of artifact with a version range that corresponds to all versions.
@param groupId the group identifier.
@param artifactId the artifact identifier.
@return the artifact descriptor.
@since 0.8 | [
"Create",
"an",
"instance",
"of",
"artifact",
"with",
"a",
"version",
"range",
"that",
"corresponds",
"to",
"all",
"versions",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java#L293-L295 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java | MavenHelper.resolveDependencies | public Set<Artifact> resolveDependencies(String artifactId, boolean plugins) throws MojoExecutionException {
final Artifact pluginArtifact;
if (plugins) {
pluginArtifact = getSession().getCurrentProject().getPluginArtifactMap().get(artifactId);
} else {
pluginArtifact = getSession().getCurrentProject().getArtifactMap().get(artifactId);
}
final ArtifactResolutionRequest request = new ArtifactResolutionRequest();
request.setResolveRoot(false);
request.setResolveTransitively(true);
request.setLocalRepository(getSession().getLocalRepository());
request.setRemoteRepositories(getSession().getCurrentProject().getRemoteArtifactRepositories());
request.setOffline(getSession().isOffline());
request.setForceUpdate(getSession().getRequest().isUpdateSnapshots());
request.setServers(getSession().getRequest().getServers());
request.setMirrors(getSession().getRequest().getMirrors());
request.setProxies(getSession().getRequest().getProxies());
request.setArtifact(pluginArtifact);
final ArtifactResolutionResult result = resolve(request);
try {
this.resolutionErrorHandler.throwErrors(request, result);
} catch (MultipleArtifactsNotFoundException e) {
final Collection<Artifact> missing = new HashSet<>(e.getMissingArtifacts());
if (!missing.isEmpty()) {
throw new MojoExecutionException(e.getLocalizedMessage(), e);
}
} catch (ArtifactResolutionException e) {
throw new MojoExecutionException(e.getLocalizedMessage(), e);
}
return result.getArtifacts();
} | java | public Set<Artifact> resolveDependencies(String artifactId, boolean plugins) throws MojoExecutionException {
final Artifact pluginArtifact;
if (plugins) {
pluginArtifact = getSession().getCurrentProject().getPluginArtifactMap().get(artifactId);
} else {
pluginArtifact = getSession().getCurrentProject().getArtifactMap().get(artifactId);
}
final ArtifactResolutionRequest request = new ArtifactResolutionRequest();
request.setResolveRoot(false);
request.setResolveTransitively(true);
request.setLocalRepository(getSession().getLocalRepository());
request.setRemoteRepositories(getSession().getCurrentProject().getRemoteArtifactRepositories());
request.setOffline(getSession().isOffline());
request.setForceUpdate(getSession().getRequest().isUpdateSnapshots());
request.setServers(getSession().getRequest().getServers());
request.setMirrors(getSession().getRequest().getMirrors());
request.setProxies(getSession().getRequest().getProxies());
request.setArtifact(pluginArtifact);
final ArtifactResolutionResult result = resolve(request);
try {
this.resolutionErrorHandler.throwErrors(request, result);
} catch (MultipleArtifactsNotFoundException e) {
final Collection<Artifact> missing = new HashSet<>(e.getMissingArtifacts());
if (!missing.isEmpty()) {
throw new MojoExecutionException(e.getLocalizedMessage(), e);
}
} catch (ArtifactResolutionException e) {
throw new MojoExecutionException(e.getLocalizedMessage(), e);
}
return result.getArtifacts();
} | [
"public",
"Set",
"<",
"Artifact",
">",
"resolveDependencies",
"(",
"String",
"artifactId",
",",
"boolean",
"plugins",
")",
"throws",
"MojoExecutionException",
"{",
"final",
"Artifact",
"pluginArtifact",
";",
"if",
"(",
"plugins",
")",
"{",
"pluginArtifact",
"=",
... | Replies the dependencies for the given artifact.
@param artifactId the artifact identifier.
@param plugins indicates if the map of the plugin artifacts must be explore (if true) or the dependency
artifacts (if false).
@return the dependencies.
@throws MojoExecutionException if the resolution cannot be done. | [
"Replies",
"the",
"dependencies",
"for",
"the",
"given",
"artifact",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java#L305-L339 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java | MavenHelper.getPluginDependencyVersion | public String getPluginDependencyVersion(String groupId, String artifactId) throws MojoExecutionException {
final Map<String, Dependency> deps = getPluginDependencies();
final String key = ArtifactUtils.versionlessKey(groupId, artifactId);
this.log.debug("COMPONENT DEPENDENCIES(getPluginVersionFromDependencies):"); //$NON-NLS-1$
this.log.debug(deps.toString());
final Dependency dep = deps.get(key);
if (dep != null) {
final String version = dep.getVersion();
if (version != null && !version.isEmpty()) {
return version;
}
throw new MojoExecutionException(MessageFormat.format(Messages.MavenHelper_2, key));
}
throw new MojoExecutionException(MessageFormat.format(Messages.MavenHelper_3, key, deps));
} | java | public String getPluginDependencyVersion(String groupId, String artifactId) throws MojoExecutionException {
final Map<String, Dependency> deps = getPluginDependencies();
final String key = ArtifactUtils.versionlessKey(groupId, artifactId);
this.log.debug("COMPONENT DEPENDENCIES(getPluginVersionFromDependencies):"); //$NON-NLS-1$
this.log.debug(deps.toString());
final Dependency dep = deps.get(key);
if (dep != null) {
final String version = dep.getVersion();
if (version != null && !version.isEmpty()) {
return version;
}
throw new MojoExecutionException(MessageFormat.format(Messages.MavenHelper_2, key));
}
throw new MojoExecutionException(MessageFormat.format(Messages.MavenHelper_3, key, deps));
} | [
"public",
"String",
"getPluginDependencyVersion",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
")",
"throws",
"MojoExecutionException",
"{",
"final",
"Map",
"<",
"String",
",",
"Dependency",
">",
"deps",
"=",
"getPluginDependencies",
"(",
")",
";",
"fina... | Replies the version of the given plugin that is specified in the POM of the
plugin in which this mojo is located.
@param groupId the identifier of the group.
@param artifactId thidentifier of the artifact.
@return the version, never <code>null</code>
@throws MojoExecutionException if the plugin was not found. | [
"Replies",
"the",
"version",
"of",
"the",
"given",
"plugin",
"that",
"is",
"specified",
"in",
"the",
"POM",
"of",
"the",
"plugin",
"in",
"which",
"this",
"mojo",
"is",
"located",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java#L349-L363 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java | MavenHelper.toXpp3Dom | @SuppressWarnings("static-method")
public Xpp3Dom toXpp3Dom(String content, Log logger) {
if (content != null && !content.isEmpty()) {
try (StringReader sr = new StringReader(content)) {
return Xpp3DomBuilder.build(sr);
} catch (Exception exception) {
if (logger != null) {
logger.debug(exception);
}
}
}
return null;
} | java | @SuppressWarnings("static-method")
public Xpp3Dom toXpp3Dom(String content, Log logger) {
if (content != null && !content.isEmpty()) {
try (StringReader sr = new StringReader(content)) {
return Xpp3DomBuilder.build(sr);
} catch (Exception exception) {
if (logger != null) {
logger.debug(exception);
}
}
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"public",
"Xpp3Dom",
"toXpp3Dom",
"(",
"String",
"content",
",",
"Log",
"logger",
")",
"{",
"if",
"(",
"content",
"!=",
"null",
"&&",
"!",
"content",
".",
"isEmpty",
"(",
")",
")",
"{",
"try",
"(",
... | Parse the given string for extracting an XML tree.
@param content the text to parse.
@param logger the logger to use for printing out the parsing errors. May be {@code null}.
@return the XML tree, or {@code null} if empty.
@since 0.8 | [
"Parse",
"the",
"given",
"string",
"for",
"extracting",
"an",
"XML",
"tree",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenHelper.java#L391-L403 | train |
sarl/sarl | products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/configs/CompilerConfigModule.java | CompilerConfigModule.providesJavaBatchCompiler | @SuppressWarnings("static-method")
@Provides
@Singleton
public IJavaBatchCompiler providesJavaBatchCompiler(Injector injector, Provider<SarlConfig> config) {
final SarlConfig cfg = config.get();
final IJavaBatchCompiler compiler = cfg.getCompiler().getJavaCompiler().newCompilerInstance();
injector.injectMembers(compiler);
return compiler;
} | java | @SuppressWarnings("static-method")
@Provides
@Singleton
public IJavaBatchCompiler providesJavaBatchCompiler(Injector injector, Provider<SarlConfig> config) {
final SarlConfig cfg = config.get();
final IJavaBatchCompiler compiler = cfg.getCompiler().getJavaCompiler().newCompilerInstance();
injector.injectMembers(compiler);
return compiler;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"@",
"Provides",
"@",
"Singleton",
"public",
"IJavaBatchCompiler",
"providesJavaBatchCompiler",
"(",
"Injector",
"injector",
",",
"Provider",
"<",
"SarlConfig",
">",
"config",
")",
"{",
"final",
"SarlConfig",
"... | Provide a Java batch compiler based on the Bootique configuration.
@param injector the injector.
@param config the bootique configuration.
@return the batch compiler.
@since 0.8 | [
"Provide",
"a",
"Java",
"batch",
"compiler",
"based",
"on",
"the",
"Bootique",
"configuration",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/configs/CompilerConfigModule.java#L190-L198 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/AgentLifeCycleSupport.java | AgentLifeCycleSupport.uninstallSkillsPreStage | private static void uninstallSkillsPreStage(Iterable<? extends Skill> skills) {
try {
// Use reflection to ignore the "private/protected" access right.
for (final Skill s : skills) {
SREutils.doSkillUninstallation(s, UninstallationStage.PRE_DESTROY_EVENT);
}
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | private static void uninstallSkillsPreStage(Iterable<? extends Skill> skills) {
try {
// Use reflection to ignore the "private/protected" access right.
for (final Skill s : skills) {
SREutils.doSkillUninstallation(s, UninstallationStage.PRE_DESTROY_EVENT);
}
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"private",
"static",
"void",
"uninstallSkillsPreStage",
"(",
"Iterable",
"<",
"?",
"extends",
"Skill",
">",
"skills",
")",
"{",
"try",
"{",
"// Use reflection to ignore the \"private/protected\" access right.",
"for",
"(",
"final",
"Skill",
"s",
":",
"skills",
")",
... | Run the uninstallation functions of the skills for the pre stage of the uninstallation process.
<p>This function is run before the handlers for {@link Destroy} are invoked.
@param skills the skills to uninstall.
@see #uninstallSkillsFinalStage(Agent) | [
"Run",
"the",
"uninstallation",
"functions",
"of",
"the",
"skills",
"for",
"the",
"pre",
"stage",
"of",
"the",
"uninstallation",
"process",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/AgentLifeCycleSupport.java#L174-L185 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/AgentLifeCycleSupport.java | AgentLifeCycleSupport.uninstallSkillsFinalStage | private static void uninstallSkillsFinalStage(Iterable<? extends Skill> skills) {
try {
// Use reflection to ignore the "private/protected" access right.
for (final Skill s : skills) {
SREutils.doSkillUninstallation(s, UninstallationStage.POST_DESTROY_EVENT);
}
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | private static void uninstallSkillsFinalStage(Iterable<? extends Skill> skills) {
try {
// Use reflection to ignore the "private/protected" access right.
for (final Skill s : skills) {
SREutils.doSkillUninstallation(s, UninstallationStage.POST_DESTROY_EVENT);
}
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"private",
"static",
"void",
"uninstallSkillsFinalStage",
"(",
"Iterable",
"<",
"?",
"extends",
"Skill",
">",
"skills",
")",
"{",
"try",
"{",
"// Use reflection to ignore the \"private/protected\" access right.",
"for",
"(",
"final",
"Skill",
"s",
":",
"skills",
")",
... | Run the uninstallation functions of the skills for the final stage of the uninstallation process.
<p>This function is run after the handlers for {@link Destroy} are invoked.
@param skills the skills to uninstall.
@see #uninstallSkillsPreStage(Agent) | [
"Run",
"the",
"uninstallation",
"functions",
"of",
"the",
"skills",
"for",
"the",
"final",
"stage",
"of",
"the",
"uninstallation",
"process",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/AgentLifeCycleSupport.java#L194-L205 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/hazelcast/HazelcastKernelDiscoveryService.java | HazelcastKernelDiscoveryService.fireKernelDiscovered | protected void fireKernelDiscovered(URI uri) {
this.logger.getKernelLogger().info(MessageFormat.format(Messages.HazelcastKernelDiscoveryService_0, uri, getCurrentKernel()));
for (final KernelDiscoveryServiceListener listener : this.listeners.getListeners(KernelDiscoveryServiceListener.class)) {
listener.kernelDiscovered(uri);
}
} | java | protected void fireKernelDiscovered(URI uri) {
this.logger.getKernelLogger().info(MessageFormat.format(Messages.HazelcastKernelDiscoveryService_0, uri, getCurrentKernel()));
for (final KernelDiscoveryServiceListener listener : this.listeners.getListeners(KernelDiscoveryServiceListener.class)) {
listener.kernelDiscovered(uri);
}
} | [
"protected",
"void",
"fireKernelDiscovered",
"(",
"URI",
"uri",
")",
"{",
"this",
".",
"logger",
".",
"getKernelLogger",
"(",
")",
".",
"info",
"(",
"MessageFormat",
".",
"format",
"(",
"Messages",
".",
"HazelcastKernelDiscoveryService_0",
",",
"uri",
",",
"ge... | Notifies the listeners about the discovering of a kernel.
@param uri URI of the discovered kernel. | [
"Notifies",
"the",
"listeners",
"about",
"the",
"discovering",
"of",
"a",
"kernel",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/hazelcast/HazelcastKernelDiscoveryService.java#L173-L178 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/hazelcast/HazelcastKernelDiscoveryService.java | HazelcastKernelDiscoveryService.fireKernelDisconnected | protected void fireKernelDisconnected(URI uri) {
this.logger.getKernelLogger().info(MessageFormat.format(Messages.HazelcastKernelDiscoveryService_1, uri, getCurrentKernel()));
for (final KernelDiscoveryServiceListener listener : this.listeners.getListeners(KernelDiscoveryServiceListener.class)) {
listener.kernelDisconnected(uri);
}
} | java | protected void fireKernelDisconnected(URI uri) {
this.logger.getKernelLogger().info(MessageFormat.format(Messages.HazelcastKernelDiscoveryService_1, uri, getCurrentKernel()));
for (final KernelDiscoveryServiceListener listener : this.listeners.getListeners(KernelDiscoveryServiceListener.class)) {
listener.kernelDisconnected(uri);
}
} | [
"protected",
"void",
"fireKernelDisconnected",
"(",
"URI",
"uri",
")",
"{",
"this",
".",
"logger",
".",
"getKernelLogger",
"(",
")",
".",
"info",
"(",
"MessageFormat",
".",
"format",
"(",
"Messages",
".",
"HazelcastKernelDiscoveryService_1",
",",
"uri",
",",
"... | Notifies the listeners about the killing of a kernel.
@param uri URI of the disconnected kernel. | [
"Notifies",
"the",
"listeners",
"about",
"the",
"killing",
"of",
"a",
"kernel",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/hazelcast/HazelcastKernelDiscoveryService.java#L185-L190 | train |
sarl/sarl | products/sarlc/src/main/java/io/sarl/lang/sarlc/configs/SarlConfig.java | SarlConfig.getConfiguration | public static SarlConfig getConfiguration(ConfigurationFactory configFactory) {
assert configFactory != null;
return configFactory.config(SarlConfig.class, PREFIX);
} | java | public static SarlConfig getConfiguration(ConfigurationFactory configFactory) {
assert configFactory != null;
return configFactory.config(SarlConfig.class, PREFIX);
} | [
"public",
"static",
"SarlConfig",
"getConfiguration",
"(",
"ConfigurationFactory",
"configFactory",
")",
"{",
"assert",
"configFactory",
"!=",
"null",
";",
"return",
"configFactory",
".",
"config",
"(",
"SarlConfig",
".",
"class",
",",
"PREFIX",
")",
";",
"}"
] | Replies the configuration for SARLC.
@param configFactory the general configuration factory.
@return the SARLC configuration. | [
"Replies",
"the",
"configuration",
"for",
"SARLC",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/configs/SarlConfig.java#L108-L111 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/AbstractSarlMojo.java | AbstractSarlMojo.unix2os | protected static File unix2os(String filename) {
File file = null;
for (final String base : filename.split(Pattern.quote("/"))) { //$NON-NLS-1$
if (file == null) {
file = new File(base);
} else {
file = new File(file, base);
}
}
return file;
} | java | protected static File unix2os(String filename) {
File file = null;
for (final String base : filename.split(Pattern.quote("/"))) { //$NON-NLS-1$
if (file == null) {
file = new File(base);
} else {
file = new File(file, base);
}
}
return file;
} | [
"protected",
"static",
"File",
"unix2os",
"(",
"String",
"filename",
")",
"{",
"File",
"file",
"=",
"null",
";",
"for",
"(",
"final",
"String",
"base",
":",
"filename",
".",
"split",
"(",
"Pattern",
".",
"quote",
"(",
"\"/\"",
")",
")",
")",
"{",
"//... | Create a file from a unix-like representation of the filename.
@param filename the unix-like filename.
@return the file. | [
"Create",
"a",
"file",
"from",
"a",
"unix",
"-",
"like",
"representation",
"of",
"the",
"filename",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/AbstractSarlMojo.java#L137-L147 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/AbstractSarlMojo.java | AbstractSarlMojo.makeAbsolute | protected File makeAbsolute(File file) {
if (!file.isAbsolute()) {
final File basedir = this.mavenHelper.getSession().getCurrentProject().getBasedir();
return new File(basedir, file.getPath()).getAbsoluteFile();
}
return file;
} | java | protected File makeAbsolute(File file) {
if (!file.isAbsolute()) {
final File basedir = this.mavenHelper.getSession().getCurrentProject().getBasedir();
return new File(basedir, file.getPath()).getAbsoluteFile();
}
return file;
} | [
"protected",
"File",
"makeAbsolute",
"(",
"File",
"file",
")",
"{",
"if",
"(",
"!",
"file",
".",
"isAbsolute",
"(",
")",
")",
"{",
"final",
"File",
"basedir",
"=",
"this",
".",
"mavenHelper",
".",
"getSession",
"(",
")",
".",
"getCurrentProject",
"(",
... | Make absolute the given filename, relatively to the project's folder.
@param file the file to convert.
@return the absolute filename. | [
"Make",
"absolute",
"the",
"given",
"filename",
"relatively",
"to",
"the",
"project",
"s",
"folder",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/AbstractSarlMojo.java#L154-L160 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/AbstractSarlMojo.java | AbstractSarlMojo.executeMojo | protected void executeMojo(
String groupId, String artifactId,
String version, String goal,
String configuration,
Dependency... dependencies) throws MojoExecutionException, MojoFailureException {
final Plugin plugin = new Plugin();
plugin.setArtifactId(artifactId);
plugin.setGroupId(groupId);
plugin.setVersion(version);
plugin.setDependencies(Arrays.asList(dependencies));
getLog().debug(MessageFormat.format(Messages.AbstractSarlMojo_0, plugin.getId()));
final PluginDescriptor pluginDescriptor = this.mavenHelper.loadPlugin(plugin);
if (pluginDescriptor == null) {
throw new MojoExecutionException(MessageFormat.format(Messages.AbstractSarlMojo_1, plugin.getId()));
}
final MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo(goal);
if (mojoDescriptor == null) {
throw new MojoExecutionException(MessageFormat.format(Messages.AbstractSarlMojo_2, goal));
}
final Xpp3Dom mojoXml;
try {
mojoXml = this.mavenHelper.toXpp3Dom(mojoDescriptor.getMojoConfiguration());
} catch (PlexusConfigurationException e1) {
throw new MojoExecutionException(e1.getLocalizedMessage(), e1);
}
Xpp3Dom configurationXml = this.mavenHelper.toXpp3Dom(configuration, getLog());
if (configurationXml != null) {
configurationXml = Xpp3DomUtils.mergeXpp3Dom(
configurationXml,
mojoXml);
} else {
configurationXml = mojoXml;
}
getLog().debug(MessageFormat.format(Messages.AbstractSarlMojo_3, plugin.getId(), configurationXml.toString()));
final MojoExecution execution = new MojoExecution(mojoDescriptor, configurationXml);
this.mavenHelper.executeMojo(execution);
} | java | protected void executeMojo(
String groupId, String artifactId,
String version, String goal,
String configuration,
Dependency... dependencies) throws MojoExecutionException, MojoFailureException {
final Plugin plugin = new Plugin();
plugin.setArtifactId(artifactId);
plugin.setGroupId(groupId);
plugin.setVersion(version);
plugin.setDependencies(Arrays.asList(dependencies));
getLog().debug(MessageFormat.format(Messages.AbstractSarlMojo_0, plugin.getId()));
final PluginDescriptor pluginDescriptor = this.mavenHelper.loadPlugin(plugin);
if (pluginDescriptor == null) {
throw new MojoExecutionException(MessageFormat.format(Messages.AbstractSarlMojo_1, plugin.getId()));
}
final MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo(goal);
if (mojoDescriptor == null) {
throw new MojoExecutionException(MessageFormat.format(Messages.AbstractSarlMojo_2, goal));
}
final Xpp3Dom mojoXml;
try {
mojoXml = this.mavenHelper.toXpp3Dom(mojoDescriptor.getMojoConfiguration());
} catch (PlexusConfigurationException e1) {
throw new MojoExecutionException(e1.getLocalizedMessage(), e1);
}
Xpp3Dom configurationXml = this.mavenHelper.toXpp3Dom(configuration, getLog());
if (configurationXml != null) {
configurationXml = Xpp3DomUtils.mergeXpp3Dom(
configurationXml,
mojoXml);
} else {
configurationXml = mojoXml;
}
getLog().debug(MessageFormat.format(Messages.AbstractSarlMojo_3, plugin.getId(), configurationXml.toString()));
final MojoExecution execution = new MojoExecution(mojoDescriptor, configurationXml);
this.mavenHelper.executeMojo(execution);
} | [
"protected",
"void",
"executeMojo",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
",",
"String",
"version",
",",
"String",
"goal",
",",
"String",
"configuration",
",",
"Dependency",
"...",
"dependencies",
")",
"throws",
"MojoExecutionException",
",",
"Moj... | Execute another MOJO.
@param groupId identifier of the MOJO plugin group.
@param artifactId identifier of the MOJO plugin artifact.
@param version version of the MOJO plugin version.
@param goal the goal to run.
@param configuration the XML code for the configuration.
@param dependencies the dependencies of the plugin.
@throws MojoExecutionException when cannot run the MOJO.
@throws MojoFailureException when the build failed. | [
"Execute",
"another",
"MOJO",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/AbstractSarlMojo.java#L231-L273 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java | AbstractDocumentationMojo.internalExecute | protected String internalExecute() {
getLog().info(Messages.AbstractDocumentationMojo_1);
final Map<File, File> files = getFiles();
getLog().info(MessageFormat.format(Messages.AbstractDocumentationMojo_2, files.size()));
return internalExecute(files);
} | java | protected String internalExecute() {
getLog().info(Messages.AbstractDocumentationMojo_1);
final Map<File, File> files = getFiles();
getLog().info(MessageFormat.format(Messages.AbstractDocumentationMojo_2, files.size()));
return internalExecute(files);
} | [
"protected",
"String",
"internalExecute",
"(",
")",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"Messages",
".",
"AbstractDocumentationMojo_1",
")",
";",
"final",
"Map",
"<",
"File",
",",
"File",
">",
"files",
"=",
"getFiles",
"(",
")",
";",
"getLog",
"("... | Internal run.
@return the error message | [
"Internal",
"run",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java#L242-L247 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java | AbstractDocumentationMojo.formatErrorMessage | protected String formatErrorMessage(File inputFile, Throwable exception) {
File filename;
int lineno = 0;
final boolean addExceptionName;
if (exception instanceof ParsingException) {
addExceptionName = false;
final ParsingException pexception = (ParsingException) exception;
final File file = pexception.getFile();
if (file != null) {
filename = file;
} else {
filename = inputFile;
}
lineno = pexception.getLineno();
} else {
addExceptionName = true;
filename = inputFile;
}
for (final String sourceDir : this.session.getCurrentProject().getCompileSourceRoots()) {
final File root = new File(sourceDir);
if (isParentFile(filename, root)) {
try {
filename = FileSystem.makeRelative(filename, root);
} catch (IOException exception1) {
//
}
break;
}
}
final StringBuilder msg = new StringBuilder();
msg.append(filename.toString());
if (lineno > 0) {
msg.append(":").append(lineno); //$NON-NLS-1$
}
msg.append(": "); //$NON-NLS-1$
final Throwable rootEx = Throwables.getRootCause(exception);
if (addExceptionName) {
msg.append(rootEx.getClass().getName());
msg.append(" - "); //$NON-NLS-1$
}
msg.append(rootEx.getLocalizedMessage());
return msg.toString();
} | java | protected String formatErrorMessage(File inputFile, Throwable exception) {
File filename;
int lineno = 0;
final boolean addExceptionName;
if (exception instanceof ParsingException) {
addExceptionName = false;
final ParsingException pexception = (ParsingException) exception;
final File file = pexception.getFile();
if (file != null) {
filename = file;
} else {
filename = inputFile;
}
lineno = pexception.getLineno();
} else {
addExceptionName = true;
filename = inputFile;
}
for (final String sourceDir : this.session.getCurrentProject().getCompileSourceRoots()) {
final File root = new File(sourceDir);
if (isParentFile(filename, root)) {
try {
filename = FileSystem.makeRelative(filename, root);
} catch (IOException exception1) {
//
}
break;
}
}
final StringBuilder msg = new StringBuilder();
msg.append(filename.toString());
if (lineno > 0) {
msg.append(":").append(lineno); //$NON-NLS-1$
}
msg.append(": "); //$NON-NLS-1$
final Throwable rootEx = Throwables.getRootCause(exception);
if (addExceptionName) {
msg.append(rootEx.getClass().getName());
msg.append(" - "); //$NON-NLS-1$
}
msg.append(rootEx.getLocalizedMessage());
return msg.toString();
} | [
"protected",
"String",
"formatErrorMessage",
"(",
"File",
"inputFile",
",",
"Throwable",
"exception",
")",
"{",
"File",
"filename",
";",
"int",
"lineno",
"=",
"0",
";",
"final",
"boolean",
"addExceptionName",
";",
"if",
"(",
"exception",
"instanceof",
"ParsingEx... | Format the error message.
@param inputFile the input file.
@param exception the error.
@return the error message. | [
"Format",
"the",
"error",
"message",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java#L309-L351 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java | AbstractDocumentationMojo.createLanguageParser | @SuppressWarnings("checkstyle:npathcomplexity")
protected AbstractMarkerLanguageParser createLanguageParser(File inputFile) throws MojoExecutionException, IOException {
final AbstractMarkerLanguageParser parser;
if (isFileExtension(inputFile, MarkdownParser.MARKDOWN_FILE_EXTENSIONS)) {
parser = this.injector.getInstance(MarkdownParser.class);
} else {
throw new MojoExecutionException(MessageFormat.format(Messages.AbstractDocumentationMojo_3, inputFile));
}
parser.setGithubExtensionEnable(this.githubExtension);
final SarlDocumentationParser internalParser = parser.getDocumentParser();
if (this.isLineContinuationEnable) {
internalParser.setLineContinuation(SarlDocumentationParser.DEFAULT_LINE_CONTINUATION);
} else {
internalParser.addLowPropertyProvider(createProjectProperties());
}
final ScriptExecutor scriptExecutor = internalParser.getScriptExecutor();
final StringBuilder cp = new StringBuilder();
for (final File cpElement : getClassPath()) {
if (cp.length() > 0) {
cp.append(":"); //$NON-NLS-1$
}
cp.append(cpElement.getAbsolutePath());
}
scriptExecutor.setClassPath(cp.toString());
final String bootPath = getBootClassPath();
if (!Strings.isEmpty(bootPath)) {
scriptExecutor.setBootClassPath(bootPath);
}
JavaVersion version = null;
if (!Strings.isEmpty(this.source)) {
version = JavaVersion.fromQualifier(this.source);
}
if (version == null) {
version = JavaVersion.JAVA8;
}
scriptExecutor.setJavaSourceVersion(version.getQualifier());
scriptExecutor.setTempFolder(this.tempDirectory.getAbsoluteFile());
internalParser.addLowPropertyProvider(createProjectProperties());
internalParser.addLowPropertyProvider(this.session.getCurrentProject().getProperties());
internalParser.addLowPropertyProvider(this.session.getUserProperties());
internalParser.addLowPropertyProvider(this.session.getSystemProperties());
internalParser.addLowPropertyProvider(createGeneratorProperties());
final Properties defaultValues = createDefaultValueProperties();
if (defaultValues != null) {
internalParser.addLowPropertyProvider(defaultValues);
}
return parser;
} | java | @SuppressWarnings("checkstyle:npathcomplexity")
protected AbstractMarkerLanguageParser createLanguageParser(File inputFile) throws MojoExecutionException, IOException {
final AbstractMarkerLanguageParser parser;
if (isFileExtension(inputFile, MarkdownParser.MARKDOWN_FILE_EXTENSIONS)) {
parser = this.injector.getInstance(MarkdownParser.class);
} else {
throw new MojoExecutionException(MessageFormat.format(Messages.AbstractDocumentationMojo_3, inputFile));
}
parser.setGithubExtensionEnable(this.githubExtension);
final SarlDocumentationParser internalParser = parser.getDocumentParser();
if (this.isLineContinuationEnable) {
internalParser.setLineContinuation(SarlDocumentationParser.DEFAULT_LINE_CONTINUATION);
} else {
internalParser.addLowPropertyProvider(createProjectProperties());
}
final ScriptExecutor scriptExecutor = internalParser.getScriptExecutor();
final StringBuilder cp = new StringBuilder();
for (final File cpElement : getClassPath()) {
if (cp.length() > 0) {
cp.append(":"); //$NON-NLS-1$
}
cp.append(cpElement.getAbsolutePath());
}
scriptExecutor.setClassPath(cp.toString());
final String bootPath = getBootClassPath();
if (!Strings.isEmpty(bootPath)) {
scriptExecutor.setBootClassPath(bootPath);
}
JavaVersion version = null;
if (!Strings.isEmpty(this.source)) {
version = JavaVersion.fromQualifier(this.source);
}
if (version == null) {
version = JavaVersion.JAVA8;
}
scriptExecutor.setJavaSourceVersion(version.getQualifier());
scriptExecutor.setTempFolder(this.tempDirectory.getAbsoluteFile());
internalParser.addLowPropertyProvider(createProjectProperties());
internalParser.addLowPropertyProvider(this.session.getCurrentProject().getProperties());
internalParser.addLowPropertyProvider(this.session.getUserProperties());
internalParser.addLowPropertyProvider(this.session.getSystemProperties());
internalParser.addLowPropertyProvider(createGeneratorProperties());
final Properties defaultValues = createDefaultValueProperties();
if (defaultValues != null) {
internalParser.addLowPropertyProvider(defaultValues);
}
return parser;
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:npathcomplexity\"",
")",
"protected",
"AbstractMarkerLanguageParser",
"createLanguageParser",
"(",
"File",
"inputFile",
")",
"throws",
"MojoExecutionException",
",",
"IOException",
"{",
"final",
"AbstractMarkerLanguageParser",
"parser... | Create a parser for the given file.
@param inputFile the file to be parsed.
@return the parser.
@throws MojoExecutionException if the parser cannot be created.
@throws IOException if a classpath entry cannot be found. | [
"Create",
"a",
"parser",
"for",
"the",
"given",
"file",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java#L378-L429 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java | AbstractDocumentationMojo.getFiles | protected Map<File, File> getFiles() {
final Map<File, File> files = new TreeMap<>();
for (final String rootName : this.inferredSourceDirectories) {
File root = FileSystem.convertStringToFile(rootName);
if (!root.isAbsolute()) {
root = FileSystem.makeAbsolute(root, this.baseDirectory);
}
getLog().debug(MessageFormat.format(Messages.AbstractDocumentationMojo_4, root.getName()));
for (final File file : Files.fileTreeTraverser().breadthFirstTraversal(root)) {
if (file.exists() && file.isFile() && !file.isHidden() && file.canRead() && hasExtension(file)) {
files.put(file, root);
}
}
}
return files;
} | java | protected Map<File, File> getFiles() {
final Map<File, File> files = new TreeMap<>();
for (final String rootName : this.inferredSourceDirectories) {
File root = FileSystem.convertStringToFile(rootName);
if (!root.isAbsolute()) {
root = FileSystem.makeAbsolute(root, this.baseDirectory);
}
getLog().debug(MessageFormat.format(Messages.AbstractDocumentationMojo_4, root.getName()));
for (final File file : Files.fileTreeTraverser().breadthFirstTraversal(root)) {
if (file.exists() && file.isFile() && !file.isHidden() && file.canRead() && hasExtension(file)) {
files.put(file, root);
}
}
}
return files;
} | [
"protected",
"Map",
"<",
"File",
",",
"File",
">",
"getFiles",
"(",
")",
"{",
"final",
"Map",
"<",
"File",
",",
"File",
">",
"files",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"String",
"rootName",
":",
"this",
".",
"inferred... | Replies the source files.
@return the map from the source files to the corresponding source folders. | [
"Replies",
"the",
"source",
"files",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java#L463-L478 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java | AbstractDocumentationMojo.toPackageName | protected static String toPackageName(String rootPackage, File packageName) {
final StringBuilder name = new StringBuilder();
File tmp = packageName;
while (tmp != null) {
final String elementName = tmp.getName();
if (!Strings.equal(FileSystem.CURRENT_DIRECTORY, elementName)
&& !Strings.equal(FileSystem.PARENT_DIRECTORY, elementName)) {
if (name.length() > 0) {
name.insert(0, "."); //$NON-NLS-1$
}
name.insert(0, elementName);
}
tmp = tmp.getParentFile();
}
if (!Strings.isEmpty(rootPackage)) {
if (name.length() > 0) {
name.insert(0, "."); //$NON-NLS-1$
}
name.insert(0, rootPackage);
}
return name.toString();
} | java | protected static String toPackageName(String rootPackage, File packageName) {
final StringBuilder name = new StringBuilder();
File tmp = packageName;
while (tmp != null) {
final String elementName = tmp.getName();
if (!Strings.equal(FileSystem.CURRENT_DIRECTORY, elementName)
&& !Strings.equal(FileSystem.PARENT_DIRECTORY, elementName)) {
if (name.length() > 0) {
name.insert(0, "."); //$NON-NLS-1$
}
name.insert(0, elementName);
}
tmp = tmp.getParentFile();
}
if (!Strings.isEmpty(rootPackage)) {
if (name.length() > 0) {
name.insert(0, "."); //$NON-NLS-1$
}
name.insert(0, rootPackage);
}
return name.toString();
} | [
"protected",
"static",
"String",
"toPackageName",
"(",
"String",
"rootPackage",
",",
"File",
"packageName",
")",
"{",
"final",
"StringBuilder",
"name",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"File",
"tmp",
"=",
"packageName",
";",
"while",
"(",
"tmp",
"... | Convert a file to a package name.
@param rootPackage an additional root package.
@param packageName the file.
@return the package name. | [
"Convert",
"a",
"file",
"to",
"a",
"package",
"name",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java#L491-L512 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.