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.ui/src/io/sarl/lang/ui/codemining/SARLCodeMiningProvider.java | SARLCodeMiningProvider.createImplicitActionReturnType | @SuppressWarnings("checkstyle:npathcomplexity")
private void createImplicitActionReturnType(XtextResource resource, IAcceptor<? super ICodeMining> acceptor) {
final List<XtendFunction> actions = EcoreUtil2.eAllOfType(resource.getContents().get(0), XtendFunction.class);
for (final XtendFunction action : actions) {
// inline annotation only for methods with no return type
if (action.getReturnType() != null) {
continue;
}
// get return type name from operation
final JvmOperation inferredOperation = (JvmOperation) this.jvmModelAssocitions.getPrimaryJvmElement(action);
if (inferredOperation == null || inferredOperation.getReturnType() == null) {
continue;
}
// find document offset for inline annotationn
final ICompositeNode node = NodeModelUtils.findActualNodeFor(action);
final Keyword parenthesis = this.grammar.getAOPMemberAccess().getRightParenthesisKeyword_2_5_6_2();
final Assignment fctname = this.grammar.getAOPMemberAccess().getNameAssignment_2_5_5();
int offsetFctname = -1;
int offsetParenthesis = -1;
for (Iterator<INode> it = node.getAsTreeIterable().iterator(); it.hasNext();) {
final INode child = it.next();
if (child != node) {
final EObject grammarElement = child.getGrammarElement();
if (grammarElement instanceof RuleCall) {
if (fctname.equals(grammarElement.eContainer())) {
offsetFctname = child.getTotalEndOffset();
}
} else if (parenthesis.equals(grammarElement)) {
offsetParenthesis = child.getTotalEndOffset();
break;
}
}
}
int offset = -1;
if (offsetParenthesis >= 0) {
offset = offsetParenthesis;
} else if (offsetFctname >= 0) {
offset = offsetFctname;
}
if (offset >= 0) {
final String returnType = inferredOperation.getReturnType().getSimpleName();
final String text = " " + this.keywords.getColonKeyword() + " " + returnType; //$NON-NLS-1$ //$NON-NLS-2$
acceptor.accept(createNewLineContentCodeMining(offset, text));
}
}
} | java | @SuppressWarnings("checkstyle:npathcomplexity")
private void createImplicitActionReturnType(XtextResource resource, IAcceptor<? super ICodeMining> acceptor) {
final List<XtendFunction> actions = EcoreUtil2.eAllOfType(resource.getContents().get(0), XtendFunction.class);
for (final XtendFunction action : actions) {
// inline annotation only for methods with no return type
if (action.getReturnType() != null) {
continue;
}
// get return type name from operation
final JvmOperation inferredOperation = (JvmOperation) this.jvmModelAssocitions.getPrimaryJvmElement(action);
if (inferredOperation == null || inferredOperation.getReturnType() == null) {
continue;
}
// find document offset for inline annotationn
final ICompositeNode node = NodeModelUtils.findActualNodeFor(action);
final Keyword parenthesis = this.grammar.getAOPMemberAccess().getRightParenthesisKeyword_2_5_6_2();
final Assignment fctname = this.grammar.getAOPMemberAccess().getNameAssignment_2_5_5();
int offsetFctname = -1;
int offsetParenthesis = -1;
for (Iterator<INode> it = node.getAsTreeIterable().iterator(); it.hasNext();) {
final INode child = it.next();
if (child != node) {
final EObject grammarElement = child.getGrammarElement();
if (grammarElement instanceof RuleCall) {
if (fctname.equals(grammarElement.eContainer())) {
offsetFctname = child.getTotalEndOffset();
}
} else if (parenthesis.equals(grammarElement)) {
offsetParenthesis = child.getTotalEndOffset();
break;
}
}
}
int offset = -1;
if (offsetParenthesis >= 0) {
offset = offsetParenthesis;
} else if (offsetFctname >= 0) {
offset = offsetFctname;
}
if (offset >= 0) {
final String returnType = inferredOperation.getReturnType().getSimpleName();
final String text = " " + this.keywords.getColonKeyword() + " " + returnType; //$NON-NLS-1$ //$NON-NLS-2$
acceptor.accept(createNewLineContentCodeMining(offset, text));
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:npathcomplexity\"",
")",
"private",
"void",
"createImplicitActionReturnType",
"(",
"XtextResource",
"resource",
",",
"IAcceptor",
"<",
"?",
"super",
"ICodeMining",
">",
"acceptor",
")",
"{",
"final",
"List",
"<",
"XtendFunct... | Add an annotation when the action's return type is implicit and inferred by the SARL compiler.
@param resource the resource to parse.
@param acceptor the code mining acceptor. | [
"Add",
"an",
"annotation",
"when",
"the",
"action",
"s",
"return",
"type",
"is",
"implicit",
"and",
"inferred",
"by",
"the",
"SARL",
"compiler",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/codemining/SARLCodeMiningProvider.java#L252-L298 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/services/SARLGrammarKeywordAccess.java | SARLGrammarKeywordAccess.getPureKeywords | public Set<String> getPureKeywords() {
Set<String> kws = this.pureSarlKeywords == null ? null : this.pureSarlKeywords.get();
if (kws == null) {
kws = new HashSet<>();
kws.add(getAsKeyword());
kws.add(getRequiresKeyword());
kws.add(getWithKeyword());
kws.add(getItKeyword());
kws.add(getArtifactKeyword());
kws.add(getAnnotationKeyword());
kws.add(getSpaceKeyword());
kws.add(getOnKeyword());
kws.add(getCapacityKeyword());
kws.add(getEventKeyword());
kws.add(getVarKeyword());
kws.add(getAgentKeyword());
kws.add(getDispatchKeyword());
kws.add(getUsesKeyword());
kws.add(getSkillKeyword());
kws.add(getDefKeyword());
kws.add(getFiresKeyword());
kws.add(getOverrideKeyword());
kws.add(getIsStaticAssumeKeyword());
kws.add(getBehaviorKeyword());
kws.add(getExtensionExtensionKeyword());
kws.add(getValKeyword());
kws.add(getTypeofKeyword());
kws.add(getOccurrenceKeyword());
this.pureSarlKeywords = new SoftReference<>(kws);
}
return Collections.unmodifiableSet(kws);
} | java | public Set<String> getPureKeywords() {
Set<String> kws = this.pureSarlKeywords == null ? null : this.pureSarlKeywords.get();
if (kws == null) {
kws = new HashSet<>();
kws.add(getAsKeyword());
kws.add(getRequiresKeyword());
kws.add(getWithKeyword());
kws.add(getItKeyword());
kws.add(getArtifactKeyword());
kws.add(getAnnotationKeyword());
kws.add(getSpaceKeyword());
kws.add(getOnKeyword());
kws.add(getCapacityKeyword());
kws.add(getEventKeyword());
kws.add(getVarKeyword());
kws.add(getAgentKeyword());
kws.add(getDispatchKeyword());
kws.add(getUsesKeyword());
kws.add(getSkillKeyword());
kws.add(getDefKeyword());
kws.add(getFiresKeyword());
kws.add(getOverrideKeyword());
kws.add(getIsStaticAssumeKeyword());
kws.add(getBehaviorKeyword());
kws.add(getExtensionExtensionKeyword());
kws.add(getValKeyword());
kws.add(getTypeofKeyword());
kws.add(getOccurrenceKeyword());
this.pureSarlKeywords = new SoftReference<>(kws);
}
return Collections.unmodifiableSet(kws);
} | [
"public",
"Set",
"<",
"String",
">",
"getPureKeywords",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"kws",
"=",
"this",
".",
"pureSarlKeywords",
"==",
"null",
"?",
"null",
":",
"this",
".",
"pureSarlKeywords",
".",
"get",
"(",
")",
";",
"if",
"(",
"kws... | Replies the pure SARL keywords.
Pure SARL keywords are SARL keywords that are not Java keywords.
@return the pure SARL keywords. | [
"Replies",
"the",
"pure",
"SARL",
"keywords",
".",
"Pure",
"SARL",
"keywords",
"are",
"SARL",
"keywords",
"that",
"are",
"not",
"Java",
"keywords",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/services/SARLGrammarKeywordAccess.java#L946-L977 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/services/SARLGrammarKeywordAccess.java | SARLGrammarKeywordAccess.protectKeyword | public String protectKeyword(String text) {
if (!Strings.isEmpty(text) && isKeyword(text)) {
return "^" + text;
}
return text;
} | java | public String protectKeyword(String text) {
if (!Strings.isEmpty(text) && isKeyword(text)) {
return "^" + text;
}
return text;
} | [
"public",
"String",
"protectKeyword",
"(",
"String",
"text",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isEmpty",
"(",
"text",
")",
"&&",
"isKeyword",
"(",
"text",
")",
")",
"{",
"return",
"\"^\"",
"+",
"text",
";",
"}",
"return",
"text",
";",
"}"
] | Protect the given text if it is a keyword.
@param text the text to protect.
@return the protected text. | [
"Protect",
"the",
"given",
"text",
"if",
"it",
"is",
"a",
"keyword",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/services/SARLGrammarKeywordAccess.java#L993-L998 | train |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/validator/PyValidator.java | PyValidator.checkImportsMapping | @Check
public void checkImportsMapping(XImportDeclaration importDeclaration) {
final JvmDeclaredType type = importDeclaration.getImportedType();
doTypeMappingCheck(importDeclaration, type, this.typeErrorHandler1);
} | java | @Check
public void checkImportsMapping(XImportDeclaration importDeclaration) {
final JvmDeclaredType type = importDeclaration.getImportedType();
doTypeMappingCheck(importDeclaration, type, this.typeErrorHandler1);
} | [
"@",
"Check",
"public",
"void",
"checkImportsMapping",
"(",
"XImportDeclaration",
"importDeclaration",
")",
"{",
"final",
"JvmDeclaredType",
"type",
"=",
"importDeclaration",
".",
"getImportedType",
"(",
")",
";",
"doTypeMappingCheck",
"(",
"importDeclaration",
",",
"... | Check that import mapping are known.
@param importDeclaration the declaration. | [
"Check",
"that",
"import",
"mapping",
"are",
"known",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/validator/PyValidator.java#L148-L152 | train |
sarl/sarl | main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/MavenImportUtils.java | MavenImportUtils.importMavenProject | public static void importMavenProject(IWorkspaceRoot workspaceRoot, String projectName,
boolean addSarlSpecificSourceFolders, IProgressMonitor monitor) {
// XXX: The m2e plugin seems to have an issue for creating a fresh project with the SARL plugin as an extension.
// Solution: Create a simple project, and switch to a real SARL project.
final WorkspaceJob bugFixJob = new WorkspaceJob("Creating Simple Maven project") { //$NON-NLS-1$
@SuppressWarnings("synthetic-access")
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
try {
final SubMonitor submon = SubMonitor.convert(monitor, 3);
forceSimplePom(workspaceRoot, projectName, submon.newChild(1));
final AbstractProjectScanner<MavenProjectInfo> scanner = getProjectScanner(workspaceRoot, projectName);
scanner.run(submon.newChild(1));
final ProjectImportConfiguration importConfiguration = new ProjectImportConfiguration();
runFixedImportJob(addSarlSpecificSourceFolders,
scanner.getProjects(), importConfiguration,
null, submon.newChild(1));
} catch (Exception exception) {
return SARLMavenEclipsePlugin.getDefault().createStatus(IStatus.ERROR, exception);
}
return Status.OK_STATUS;
}
};
bugFixJob.setRule(MavenPlugin.getProjectConfigurationManager().getRule());
bugFixJob.schedule();
} | java | public static void importMavenProject(IWorkspaceRoot workspaceRoot, String projectName,
boolean addSarlSpecificSourceFolders, IProgressMonitor monitor) {
// XXX: The m2e plugin seems to have an issue for creating a fresh project with the SARL plugin as an extension.
// Solution: Create a simple project, and switch to a real SARL project.
final WorkspaceJob bugFixJob = new WorkspaceJob("Creating Simple Maven project") { //$NON-NLS-1$
@SuppressWarnings("synthetic-access")
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
try {
final SubMonitor submon = SubMonitor.convert(monitor, 3);
forceSimplePom(workspaceRoot, projectName, submon.newChild(1));
final AbstractProjectScanner<MavenProjectInfo> scanner = getProjectScanner(workspaceRoot, projectName);
scanner.run(submon.newChild(1));
final ProjectImportConfiguration importConfiguration = new ProjectImportConfiguration();
runFixedImportJob(addSarlSpecificSourceFolders,
scanner.getProjects(), importConfiguration,
null, submon.newChild(1));
} catch (Exception exception) {
return SARLMavenEclipsePlugin.getDefault().createStatus(IStatus.ERROR, exception);
}
return Status.OK_STATUS;
}
};
bugFixJob.setRule(MavenPlugin.getProjectConfigurationManager().getRule());
bugFixJob.schedule();
} | [
"public",
"static",
"void",
"importMavenProject",
"(",
"IWorkspaceRoot",
"workspaceRoot",
",",
"String",
"projectName",
",",
"boolean",
"addSarlSpecificSourceFolders",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"// XXX: The m2e plugin seems to have an issue for creating a fres... | Create a fresh Maven project from existing files, assuming a pom file exists.
<p>If the Maven project is associated to an existing {@code IProject}, then the source folders
must be configured before the call to this function.
@param workspaceRoot the workspace root.
@param projectName the name of the project that is also the name of the project's folder.
@param addSarlSpecificSourceFolders indicates if the source folders that are specific to SARL should be added.
@param monitor the progress monitor.
@since 0.8 | [
"Create",
"a",
"fresh",
"Maven",
"project",
"from",
"existing",
"files",
"assuming",
"a",
"pom",
"file",
"exists",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/MavenImportUtils.java#L84-L110 | train |
sarl/sarl | main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/MavenImportUtils.java | MavenImportUtils.runFixedImportJob | static List<IMavenProjectImportResult> runFixedImportJob(boolean addSarlSpecificSourceFolders,
Collection<MavenProjectInfo> projectInfos,
ProjectImportConfiguration importConfiguration, IProjectCreationListener projectCreationListener,
IProgressMonitor monitor) throws CoreException {
final List<IMavenProjectImportResult> importResults = MavenPlugin.getProjectConfigurationManager()
.importProjects(projectInfos, importConfiguration, projectCreationListener, monitor);
if (addSarlSpecificSourceFolders) {
final SubMonitor submon = SubMonitor.convert(monitor, importResults.size());
for (final IMavenProjectImportResult importResult : importResults) {
SARLProjectConfigurator.configureSARLSourceFolders(
// Project to configure
importResult.getProject(),
// Create folders
true,
// Monitor
submon.newChild(1));
final WorkspaceJob job = new WorkspaceJob("Creating Maven project") { //$NON-NLS-1$
@SuppressWarnings("synthetic-access")
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
try {
runBugFix(importResult.getProject(), monitor);
} catch (Exception exception) {
return SARLMavenEclipsePlugin.getDefault().createStatus(IStatus.ERROR, exception);
}
return Status.OK_STATUS;
}
};
job.setRule(MavenPlugin.getProjectConfigurationManager().getRule());
job.schedule();
}
}
return importResults;
} | java | static List<IMavenProjectImportResult> runFixedImportJob(boolean addSarlSpecificSourceFolders,
Collection<MavenProjectInfo> projectInfos,
ProjectImportConfiguration importConfiguration, IProjectCreationListener projectCreationListener,
IProgressMonitor monitor) throws CoreException {
final List<IMavenProjectImportResult> importResults = MavenPlugin.getProjectConfigurationManager()
.importProjects(projectInfos, importConfiguration, projectCreationListener, monitor);
if (addSarlSpecificSourceFolders) {
final SubMonitor submon = SubMonitor.convert(monitor, importResults.size());
for (final IMavenProjectImportResult importResult : importResults) {
SARLProjectConfigurator.configureSARLSourceFolders(
// Project to configure
importResult.getProject(),
// Create folders
true,
// Monitor
submon.newChild(1));
final WorkspaceJob job = new WorkspaceJob("Creating Maven project") { //$NON-NLS-1$
@SuppressWarnings("synthetic-access")
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
try {
runBugFix(importResult.getProject(), monitor);
} catch (Exception exception) {
return SARLMavenEclipsePlugin.getDefault().createStatus(IStatus.ERROR, exception);
}
return Status.OK_STATUS;
}
};
job.setRule(MavenPlugin.getProjectConfigurationManager().getRule());
job.schedule();
}
}
return importResults;
} | [
"static",
"List",
"<",
"IMavenProjectImportResult",
">",
"runFixedImportJob",
"(",
"boolean",
"addSarlSpecificSourceFolders",
",",
"Collection",
"<",
"MavenProjectInfo",
">",
"projectInfos",
",",
"ProjectImportConfiguration",
"importConfiguration",
",",
"IProjectCreationListene... | Run the job that execute a fixed import of a Maven project.
@param addSarlSpecificSourceFolders indicates if the source folders that are specific to SARL should be added.
@param projectInfos the list of descriptions for each project to import.
@param importConfiguration the import configuration.
@param projectCreationListener the listener on the project creation. Could be {@code null}.
@param monitor the progress monitor.
@return the results of the importation tasks.
@throws CoreException if it is impossible to do the import.
@since 0.8 | [
"Run",
"the",
"job",
"that",
"execute",
"a",
"fixed",
"import",
"of",
"a",
"Maven",
"project",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/MavenImportUtils.java#L123-L156 | train |
sarl/sarl | main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/MavenImportUtils.java | MavenImportUtils.forceSimplePom | static void forceSimplePom(File projectDir, IProgressMonitor monitor) throws IOException {
final File pomFile = new File(projectDir, POM_FILE);
if (pomFile.exists()) {
final SubMonitor submon = SubMonitor.convert(monitor, 4);
final File savedPomFile = new File(projectDir, POM_BACKUP_FILE);
if (savedPomFile.exists()) {
savedPomFile.delete();
}
submon.worked(1);
Files.copy(pomFile, savedPomFile);
submon.worked(1);
final StringBuilder content = new StringBuilder();
try (BufferedReader stream = new BufferedReader(new FileReader(pomFile))) {
String line = stream.readLine();
while (line != null) {
line = line.replaceAll("<extensions>\\s*true\\s*</extensions>", ""); //$NON-NLS-1$ //$NON-NLS-2$
content.append(line).append("\n"); //$NON-NLS-1$
line = stream.readLine();
}
}
submon.worked(1);
Files.write(content.toString().getBytes(), pomFile);
submon.worked(1);
}
} | java | static void forceSimplePom(File projectDir, IProgressMonitor monitor) throws IOException {
final File pomFile = new File(projectDir, POM_FILE);
if (pomFile.exists()) {
final SubMonitor submon = SubMonitor.convert(monitor, 4);
final File savedPomFile = new File(projectDir, POM_BACKUP_FILE);
if (savedPomFile.exists()) {
savedPomFile.delete();
}
submon.worked(1);
Files.copy(pomFile, savedPomFile);
submon.worked(1);
final StringBuilder content = new StringBuilder();
try (BufferedReader stream = new BufferedReader(new FileReader(pomFile))) {
String line = stream.readLine();
while (line != null) {
line = line.replaceAll("<extensions>\\s*true\\s*</extensions>", ""); //$NON-NLS-1$ //$NON-NLS-2$
content.append(line).append("\n"); //$NON-NLS-1$
line = stream.readLine();
}
}
submon.worked(1);
Files.write(content.toString().getBytes(), pomFile);
submon.worked(1);
}
} | [
"static",
"void",
"forceSimplePom",
"(",
"File",
"projectDir",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"IOException",
"{",
"final",
"File",
"pomFile",
"=",
"new",
"File",
"(",
"projectDir",
",",
"POM_FILE",
")",
";",
"if",
"(",
"pomFile",
".",
"ex... | Force the pom file of a project to be "simple".
@param projectDir the folder in which the pom file is located.
@param monitor the progress monitor.
@throws IOException if the pom file cannot be changed. | [
"Force",
"the",
"pom",
"file",
"of",
"a",
"project",
"to",
"be",
"simple",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/MavenImportUtils.java#L186-L210 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/buildpath/AbstractSARLBasedClasspathContainer.java | AbstractSARLBasedClasspathContainer.getBundleDependencies | public final Set<String> getBundleDependencies() {
final Set<String> bundles = new TreeSet<>();
updateBundleList(bundles);
return bundles;
} | java | public final Set<String> getBundleDependencies() {
final Set<String> bundles = new TreeSet<>();
updateBundleList(bundles);
return bundles;
} | [
"public",
"final",
"Set",
"<",
"String",
">",
"getBundleDependencies",
"(",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"bundles",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"updateBundleList",
"(",
"bundles",
")",
";",
"return",
"bundles",
";",
"}"
] | Replies the list of the symbolic names of the bundle dependencies.
@return the bundle symbolic names of the dependencies. | [
"Replies",
"the",
"list",
"of",
"the",
"symbolic",
"names",
"of",
"the",
"bundle",
"dependencies",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/buildpath/AbstractSARLBasedClasspathContainer.java#L71-L75 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Skill.java | Skill.getCaller | @SuppressWarnings("static-method")
@Pure
@Inline(value = "$1.getCaller()", imported = Capacities.class, constantExpression = true)
protected AgentTrait getCaller() {
return Capacities.getCaller();
} | java | @SuppressWarnings("static-method")
@Pure
@Inline(value = "$1.getCaller()", imported = Capacities.class, constantExpression = true)
protected AgentTrait getCaller() {
return Capacities.getCaller();
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"$1.getCaller()\"",
",",
"imported",
"=",
"Capacities",
".",
"class",
",",
"constantExpression",
"=",
"true",
")",
"protected",
"AgentTrait",
"getCaller",
"(... | Replies the caller of the capacity functions.
<p>The replied value has a meaning inside the skills' functions that
are implemented the capacities' functions.
@return the caller, or {@code null} if the caller is unknown (assuming that the caller is the agent itself).
@since 0.7 | [
"Replies",
"the",
"caller",
"of",
"the",
"capacity",
"functions",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Skill.java#L75-L80 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Skill.java | Skill.unregisterUse | void unregisterUse() {
final int value = this.uses.decrementAndGet();
if (value == 0) {
uninstall(UninstallationStage.PRE_DESTROY_EVENT);
uninstall(UninstallationStage.POST_DESTROY_EVENT);
}
} | java | void unregisterUse() {
final int value = this.uses.decrementAndGet();
if (value == 0) {
uninstall(UninstallationStage.PRE_DESTROY_EVENT);
uninstall(UninstallationStage.POST_DESTROY_EVENT);
}
} | [
"void",
"unregisterUse",
"(",
")",
"{",
"final",
"int",
"value",
"=",
"this",
".",
"uses",
".",
"decrementAndGet",
"(",
")",
";",
"if",
"(",
"value",
"==",
"0",
")",
"{",
"uninstall",
"(",
"UninstallationStage",
".",
"PRE_DESTROY_EVENT",
")",
";",
"unins... | Mark this skill as release by one user. | [
"Mark",
"this",
"skill",
"as",
"release",
"by",
"one",
"user",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Skill.java#L93-L99 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/FormalParameterBuilderFragment.java | FormalParameterBuilderFragment.generateIFormalParameterBuilder | protected void generateIFormalParameterBuilder() {
final TypeReference builder = getFormalParameterBuilderInterface();
final StringConcatenationClient content = new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation it) {
it.append("/** Builder of a " + getLanguageName() //$NON-NLS-1$
+ " formal parameter."); //$NON-NLS-1$
it.newLine();
it.append(" */"); //$NON-NLS-1$
it.newLine();
it.append("@SuppressWarnings(\"all\")"); //$NON-NLS-1$
it.newLine();
it.append("public interface "); //$NON-NLS-1$
it.append(builder.getSimpleName());
it.append(" {"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
it.append(generateMembers(true, false));
it.append("}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
}
};
final JavaFileAccess javaFile = getFileAccessFactory().createJavaFile(builder, content);
javaFile.writeTo(getSrcGen());
} | java | protected void generateIFormalParameterBuilder() {
final TypeReference builder = getFormalParameterBuilderInterface();
final StringConcatenationClient content = new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation it) {
it.append("/** Builder of a " + getLanguageName() //$NON-NLS-1$
+ " formal parameter."); //$NON-NLS-1$
it.newLine();
it.append(" */"); //$NON-NLS-1$
it.newLine();
it.append("@SuppressWarnings(\"all\")"); //$NON-NLS-1$
it.newLine();
it.append("public interface "); //$NON-NLS-1$
it.append(builder.getSimpleName());
it.append(" {"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
it.append(generateMembers(true, false));
it.append("}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
}
};
final JavaFileAccess javaFile = getFileAccessFactory().createJavaFile(builder, content);
javaFile.writeTo(getSrcGen());
} | [
"protected",
"void",
"generateIFormalParameterBuilder",
"(",
")",
"{",
"final",
"TypeReference",
"builder",
"=",
"getFormalParameterBuilderInterface",
"(",
")",
";",
"final",
"StringConcatenationClient",
"content",
"=",
"new",
"StringConcatenationClient",
"(",
")",
"{",
... | Generate the formal parameter builder interface. | [
"Generate",
"the",
"formal",
"parameter",
"builder",
"interface",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/FormalParameterBuilderFragment.java#L100-L125 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/FormalParameterBuilderFragment.java | FormalParameterBuilderFragment.generateFormalParameterAppender | protected void generateFormalParameterAppender() {
final CodeElementExtractor.ElementDescription parameter = getCodeElementExtractor().getFormalParameter();
final String accessor = "get" //$NON-NLS-1$
+ Strings.toFirstUpper(parameter.getElementType().getSimpleName()) + "()"; //$NON-NLS-1$
final TypeReference builderInterface = getFormalParameterBuilderInterface();
final TypeReference appender = getCodeElementExtractor().getElementAppenderImpl("FormalParameter"); //$NON-NLS-1$
final StringConcatenationClient content = new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation it) {
it.append("/** Appender of a " + getLanguageName() //$NON-NLS-1$
+ " formal parameter."); //$NON-NLS-1$
it.newLine();
it.append(" */"); //$NON-NLS-1$
it.newLine();
it.append("@SuppressWarnings(\"all\")"); //$NON-NLS-1$
it.newLine();
it.append("public class "); //$NON-NLS-1$
it.append(appender.getSimpleName());
it.append(" extends "); //$NON-NLS-1$
it.append(getCodeElementExtractor().getAbstractAppenderImpl());
it.append(" implements "); //$NON-NLS-1$
it.append(builderInterface);
it.append(" {"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
it.append(generateAppenderMembers(appender.getSimpleName(), builderInterface, accessor));
it.append(generateMembers(false, true));
it.append("}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
}
};
final JavaFileAccess javaFile = getFileAccessFactory().createJavaFile(appender, content);
javaFile.writeTo(getSrcGen());
} | java | protected void generateFormalParameterAppender() {
final CodeElementExtractor.ElementDescription parameter = getCodeElementExtractor().getFormalParameter();
final String accessor = "get" //$NON-NLS-1$
+ Strings.toFirstUpper(parameter.getElementType().getSimpleName()) + "()"; //$NON-NLS-1$
final TypeReference builderInterface = getFormalParameterBuilderInterface();
final TypeReference appender = getCodeElementExtractor().getElementAppenderImpl("FormalParameter"); //$NON-NLS-1$
final StringConcatenationClient content = new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation it) {
it.append("/** Appender of a " + getLanguageName() //$NON-NLS-1$
+ " formal parameter."); //$NON-NLS-1$
it.newLine();
it.append(" */"); //$NON-NLS-1$
it.newLine();
it.append("@SuppressWarnings(\"all\")"); //$NON-NLS-1$
it.newLine();
it.append("public class "); //$NON-NLS-1$
it.append(appender.getSimpleName());
it.append(" extends "); //$NON-NLS-1$
it.append(getCodeElementExtractor().getAbstractAppenderImpl());
it.append(" implements "); //$NON-NLS-1$
it.append(builderInterface);
it.append(" {"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
it.append(generateAppenderMembers(appender.getSimpleName(), builderInterface, accessor));
it.append(generateMembers(false, true));
it.append("}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
}
};
final JavaFileAccess javaFile = getFileAccessFactory().createJavaFile(appender, content);
javaFile.writeTo(getSrcGen());
} | [
"protected",
"void",
"generateFormalParameterAppender",
"(",
")",
"{",
"final",
"CodeElementExtractor",
".",
"ElementDescription",
"parameter",
"=",
"getCodeElementExtractor",
"(",
")",
".",
"getFormalParameter",
"(",
")",
";",
"final",
"String",
"accessor",
"=",
"\"g... | Generate the formal parameter appender. | [
"Generate",
"the",
"formal",
"parameter",
"appender",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/FormalParameterBuilderFragment.java#L163-L197 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/StandardContextSpaceService.java | StandardContextSpaceService.fireContextCreated | protected void fireContextCreated(AgentContext context) {
final ContextRepositoryListener[] ilisteners = this.listeners.getListeners(ContextRepositoryListener.class);
this.logger.getKernelLogger().info(MessageFormat.format(Messages.StandardContextSpaceService_0, context.getID()));
for (final ContextRepositoryListener listener : ilisteners) {
listener.contextCreated(context);
}
} | java | protected void fireContextCreated(AgentContext context) {
final ContextRepositoryListener[] ilisteners = this.listeners.getListeners(ContextRepositoryListener.class);
this.logger.getKernelLogger().info(MessageFormat.format(Messages.StandardContextSpaceService_0, context.getID()));
for (final ContextRepositoryListener listener : ilisteners) {
listener.contextCreated(context);
}
} | [
"protected",
"void",
"fireContextCreated",
"(",
"AgentContext",
"context",
")",
"{",
"final",
"ContextRepositoryListener",
"[",
"]",
"ilisteners",
"=",
"this",
".",
"listeners",
".",
"getListeners",
"(",
"ContextRepositoryListener",
".",
"class",
")",
";",
"this",
... | Notifies the listeners about a context creation.
@param context reference to the created context. | [
"Notifies",
"the",
"listeners",
"about",
"a",
"context",
"creation",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/StandardContextSpaceService.java#L309-L315 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/StandardContextSpaceService.java | StandardContextSpaceService.fireContextDestroyed | protected void fireContextDestroyed(AgentContext context) {
final ContextRepositoryListener[] ilisteners = this.listeners.getListeners(ContextRepositoryListener.class);
this.logger.getKernelLogger().info(MessageFormat.format(Messages.StandardContextSpaceService_1, context.getID()));
for (final ContextRepositoryListener listener : ilisteners) {
listener.contextDestroyed(context);
}
} | java | protected void fireContextDestroyed(AgentContext context) {
final ContextRepositoryListener[] ilisteners = this.listeners.getListeners(ContextRepositoryListener.class);
this.logger.getKernelLogger().info(MessageFormat.format(Messages.StandardContextSpaceService_1, context.getID()));
for (final ContextRepositoryListener listener : ilisteners) {
listener.contextDestroyed(context);
}
} | [
"protected",
"void",
"fireContextDestroyed",
"(",
"AgentContext",
"context",
")",
"{",
"final",
"ContextRepositoryListener",
"[",
"]",
"ilisteners",
"=",
"this",
".",
"listeners",
".",
"getListeners",
"(",
"ContextRepositoryListener",
".",
"class",
")",
";",
"this",... | Notifies the listeners about a context destruction.
@param context reference to the destroyed context. | [
"Notifies",
"the",
"listeners",
"about",
"a",
"context",
"destruction",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/StandardContextSpaceService.java#L322-L328 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/StandardContextSpaceService.java | StandardContextSpaceService.removeDefaultSpaceDefinition | protected void removeDefaultSpaceDefinition(SpaceID spaceID) {
AgentContext context = null;
synchronized (mutex()) {
context = this.contexts.remove(spaceID.getContextID());
}
if (context != null) {
fireContextDestroyed(context);
}
} | java | protected void removeDefaultSpaceDefinition(SpaceID spaceID) {
AgentContext context = null;
synchronized (mutex()) {
context = this.contexts.remove(spaceID.getContextID());
}
if (context != null) {
fireContextDestroyed(context);
}
} | [
"protected",
"void",
"removeDefaultSpaceDefinition",
"(",
"SpaceID",
"spaceID",
")",
"{",
"AgentContext",
"context",
"=",
"null",
";",
"synchronized",
"(",
"mutex",
"(",
")",
")",
"{",
"context",
"=",
"this",
".",
"contexts",
".",
"remove",
"(",
"spaceID",
"... | Update the internal data structure when a default space was removed.
@param spaceID identifier of the space to remove. | [
"Update",
"the",
"internal",
"data",
"structure",
"when",
"a",
"default",
"space",
"was",
"removed",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/StandardContextSpaceService.java#L378-L386 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/latex/LaTeXListingsGenerator2.java | LaTeXListingsGenerator2.addRequirement | public void addRequirement(String requirement) {
if (!Strings.isEmpty(requirement)) {
if (this.requirements == null) {
this.requirements = new ArrayList<>();
}
this.requirements.add(requirement);
}
} | java | public void addRequirement(String requirement) {
if (!Strings.isEmpty(requirement)) {
if (this.requirements == null) {
this.requirements = new ArrayList<>();
}
this.requirements.add(requirement);
}
} | [
"public",
"void",
"addRequirement",
"(",
"String",
"requirement",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isEmpty",
"(",
"requirement",
")",
")",
"{",
"if",
"(",
"this",
".",
"requirements",
"==",
"null",
")",
"{",
"this",
".",
"requirements",
"=",
... | Add a TeX requirement.
@param requirement the name of the TeX package. | [
"Add",
"a",
"TeX",
"requirement",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/latex/LaTeXListingsGenerator2.java#L255-L262 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/latex/LaTeXListingsGenerator2.java | LaTeXListingsGenerator2.generateOptions | @SuppressWarnings("static-method")
protected boolean generateOptions(IStyleAppendable it) {
it.appendNl("\\newif\\ifusesarlcolors\\usesarlcolorstrue"); //$NON-NLS-1$
it.appendNl("\\DeclareOption{sarlcolors}{\\global\\usesarlcolorstrue}"); //$NON-NLS-1$
it.appendNl("\\DeclareOption{nosarlcolors}{\\global\\usesarlcolorsfalse}"); //$NON-NLS-1$
return true;
} | java | @SuppressWarnings("static-method")
protected boolean generateOptions(IStyleAppendable it) {
it.appendNl("\\newif\\ifusesarlcolors\\usesarlcolorstrue"); //$NON-NLS-1$
it.appendNl("\\DeclareOption{sarlcolors}{\\global\\usesarlcolorstrue}"); //$NON-NLS-1$
it.appendNl("\\DeclareOption{nosarlcolors}{\\global\\usesarlcolorsfalse}"); //$NON-NLS-1$
return true;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"boolean",
"generateOptions",
"(",
"IStyleAppendable",
"it",
")",
"{",
"it",
".",
"appendNl",
"(",
"\"\\\\newif\\\\ifusesarlcolors\\\\usesarlcolorstrue\"",
")",
";",
"//$NON-NLS-1$",
"it",
".",
"append... | Generate the optional extensions.
@param it the target.
@return {@code true} if options are generated.
@since 0.6 | [
"Generate",
"the",
"optional",
"extensions",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/latex/LaTeXListingsGenerator2.java#L430-L436 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/network/AESEventEncrypter.java | AESEventEncrypter.setKey | @Inject
public void setKey(@Named(NetworkConfig.AES_KEY) String key) throws Exception {
final byte[] raw = key.getBytes(NetworkConfig.getStringEncodingCharset());
final int keySize = raw.length;
if ((keySize % 16) == 0 || (keySize % 24) == 0 || (keySize % 32) == 0) {
this.skeySpec = new SecretKeySpec(raw, "AES"); //$NON-NLS-1$
// this.cipher = Cipher.getInstance(ALGORITHM);
} else {
throw new IllegalArgumentException(Messages.AESEventEncrypter_0);
}
} | java | @Inject
public void setKey(@Named(NetworkConfig.AES_KEY) String key) throws Exception {
final byte[] raw = key.getBytes(NetworkConfig.getStringEncodingCharset());
final int keySize = raw.length;
if ((keySize % 16) == 0 || (keySize % 24) == 0 || (keySize % 32) == 0) {
this.skeySpec = new SecretKeySpec(raw, "AES"); //$NON-NLS-1$
// this.cipher = Cipher.getInstance(ALGORITHM);
} else {
throw new IllegalArgumentException(Messages.AESEventEncrypter_0);
}
} | [
"@",
"Inject",
"public",
"void",
"setKey",
"(",
"@",
"Named",
"(",
"NetworkConfig",
".",
"AES_KEY",
")",
"String",
"key",
")",
"throws",
"Exception",
"{",
"final",
"byte",
"[",
"]",
"raw",
"=",
"key",
".",
"getBytes",
"(",
"NetworkConfig",
".",
"getStrin... | Change the encryption key.
@param key injected encryption key.
@throws Exception - when the given key is invalid. | [
"Change",
"the",
"encryption",
"key",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/network/AESEventEncrypter.java#L62-L73 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java | SarlLinkFactory.getLinkForPrimitive | @SuppressWarnings("static-method")
protected void getLinkForPrimitive(Content link, LinkInfo linkInfo, Type type) {
link.addContent(type.typeName());
} | java | @SuppressWarnings("static-method")
protected void getLinkForPrimitive(Content link, LinkInfo linkInfo, Type type) {
link.addContent(type.typeName());
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"void",
"getLinkForPrimitive",
"(",
"Content",
"link",
",",
"LinkInfo",
"linkInfo",
",",
"Type",
"type",
")",
"{",
"link",
".",
"addContent",
"(",
"type",
".",
"typeName",
"(",
")",
")",
";... | Build the link for the primitive.
@param link the link.
@param linkInfo the information on the link.
@param type the type. | [
"Build",
"the",
"link",
"for",
"the",
"primitive",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L64-L67 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java | SarlLinkFactory.getLinkForAnnotationType | protected void getLinkForAnnotationType(Content link, LinkInfo linkInfo, Type type) {
link.addContent(getTypeAnnotationLinks(linkInfo));
linkInfo.type = type.asAnnotatedType().underlyingType();
link.addContent(getLink(linkInfo));
} | java | protected void getLinkForAnnotationType(Content link, LinkInfo linkInfo, Type type) {
link.addContent(getTypeAnnotationLinks(linkInfo));
linkInfo.type = type.asAnnotatedType().underlyingType();
link.addContent(getLink(linkInfo));
} | [
"protected",
"void",
"getLinkForAnnotationType",
"(",
"Content",
"link",
",",
"LinkInfo",
"linkInfo",
",",
"Type",
"type",
")",
"{",
"link",
".",
"addContent",
"(",
"getTypeAnnotationLinks",
"(",
"linkInfo",
")",
")",
";",
"linkInfo",
".",
"type",
"=",
"type",... | Build the link for the annotation type.
@param link the link.
@param linkInfo the information on the link.
@param type the type. | [
"Build",
"the",
"link",
"for",
"the",
"annotation",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L75-L79 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java | SarlLinkFactory.getLinkForWildcard | protected void getLinkForWildcard(Content link, LinkInfo linkInfo, Type type) {
linkInfo.isTypeBound = true;
link.addContent("?"); //$NON-NLS-1$
final WildcardType wildcardType = type.asWildcardType();
final Type[] extendsBounds = wildcardType.extendsBounds();
final SARLFeatureAccess kw = Utils.getKeywords();
for (int i = 0; i < extendsBounds.length; i++) {
link.addContent(i > 0 ? kw.getCommaKeyword() + " " //$NON-NLS-1$
: " " + kw.getExtendsKeyword() + " "); //$NON-NLS-1$ //$NON-NLS-2$
setBoundsLinkInfo(linkInfo, extendsBounds[i]);
link.addContent(getLink(linkInfo));
}
final Type[] superBounds = wildcardType.superBounds();
for (int i = 0; i < superBounds.length; i++) {
link.addContent(i > 0 ? kw.getCommaKeyword() + " " //$NON-NLS-1$
: " " + kw.getSuperKeyword() + " "); //$NON-NLS-1$ //$NON-NLS-2$
setBoundsLinkInfo(linkInfo, superBounds[i]);
link.addContent(getLink(linkInfo));
}
} | java | protected void getLinkForWildcard(Content link, LinkInfo linkInfo, Type type) {
linkInfo.isTypeBound = true;
link.addContent("?"); //$NON-NLS-1$
final WildcardType wildcardType = type.asWildcardType();
final Type[] extendsBounds = wildcardType.extendsBounds();
final SARLFeatureAccess kw = Utils.getKeywords();
for (int i = 0; i < extendsBounds.length; i++) {
link.addContent(i > 0 ? kw.getCommaKeyword() + " " //$NON-NLS-1$
: " " + kw.getExtendsKeyword() + " "); //$NON-NLS-1$ //$NON-NLS-2$
setBoundsLinkInfo(linkInfo, extendsBounds[i]);
link.addContent(getLink(linkInfo));
}
final Type[] superBounds = wildcardType.superBounds();
for (int i = 0; i < superBounds.length; i++) {
link.addContent(i > 0 ? kw.getCommaKeyword() + " " //$NON-NLS-1$
: " " + kw.getSuperKeyword() + " "); //$NON-NLS-1$ //$NON-NLS-2$
setBoundsLinkInfo(linkInfo, superBounds[i]);
link.addContent(getLink(linkInfo));
}
} | [
"protected",
"void",
"getLinkForWildcard",
"(",
"Content",
"link",
",",
"LinkInfo",
"linkInfo",
",",
"Type",
"type",
")",
"{",
"linkInfo",
".",
"isTypeBound",
"=",
"true",
";",
"link",
".",
"addContent",
"(",
"\"?\"",
")",
";",
"//$NON-NLS-1$",
"final",
"Wil... | Build the link for the wildcard.
@param link the link.
@param linkInfo the information on the link.
@param type the type. | [
"Build",
"the",
"link",
"for",
"the",
"wildcard",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L87-L106 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java | SarlLinkFactory.getLinkForTypeVariable | protected void getLinkForTypeVariable(Content link, LinkInfo linkInfo, Type type) {
link.addContent(getTypeAnnotationLinks(linkInfo));
linkInfo.isTypeBound = true;
final Doc owner = type.asTypeVariable().owner();
if ((!linkInfo.excludeTypeParameterLinks) && owner instanceof ClassDoc) {
linkInfo.classDoc = (ClassDoc) owner;
final Content label = newContent();
label.addContent(type.typeName());
linkInfo.label = label;
link.addContent(getClassLink(linkInfo));
} else {
link.addContent(type.typeName());
}
final Type[] bounds = type.asTypeVariable().bounds();
if (!linkInfo.excludeTypeBounds) {
linkInfo.excludeTypeBounds = true;
final SARLFeatureAccess kw = Utils.getKeywords();
for (int i = 0; i < bounds.length; ++i) {
link.addContent(i > 0 ? " " + kw.getAmpersandKeyword() + " " //$NON-NLS-1$ //$NON-NLS-2$
: " " + kw.getExtendsKeyword() + " "); //$NON-NLS-1$ //$NON-NLS-2$
setBoundsLinkInfo(linkInfo, bounds[i]);
link.addContent(getLink(linkInfo));
}
}
} | java | protected void getLinkForTypeVariable(Content link, LinkInfo linkInfo, Type type) {
link.addContent(getTypeAnnotationLinks(linkInfo));
linkInfo.isTypeBound = true;
final Doc owner = type.asTypeVariable().owner();
if ((!linkInfo.excludeTypeParameterLinks) && owner instanceof ClassDoc) {
linkInfo.classDoc = (ClassDoc) owner;
final Content label = newContent();
label.addContent(type.typeName());
linkInfo.label = label;
link.addContent(getClassLink(linkInfo));
} else {
link.addContent(type.typeName());
}
final Type[] bounds = type.asTypeVariable().bounds();
if (!linkInfo.excludeTypeBounds) {
linkInfo.excludeTypeBounds = true;
final SARLFeatureAccess kw = Utils.getKeywords();
for (int i = 0; i < bounds.length; ++i) {
link.addContent(i > 0 ? " " + kw.getAmpersandKeyword() + " " //$NON-NLS-1$ //$NON-NLS-2$
: " " + kw.getExtendsKeyword() + " "); //$NON-NLS-1$ //$NON-NLS-2$
setBoundsLinkInfo(linkInfo, bounds[i]);
link.addContent(getLink(linkInfo));
}
}
} | [
"protected",
"void",
"getLinkForTypeVariable",
"(",
"Content",
"link",
",",
"LinkInfo",
"linkInfo",
",",
"Type",
"type",
")",
"{",
"link",
".",
"addContent",
"(",
"getTypeAnnotationLinks",
"(",
"linkInfo",
")",
")",
";",
"linkInfo",
".",
"isTypeBound",
"=",
"t... | Build the link for the type variable.
@param link the link.
@param linkInfo the information on the link.
@param type the type. | [
"Build",
"the",
"link",
"for",
"the",
"type",
"variable",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L114-L138 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java | SarlLinkFactory.setBoundsLinkInfo | protected void setBoundsLinkInfo(LinkInfo linkInfo, Type bound) {
Reflect.callProc(this, LinkFactory.class, "setBoundsLinkInfo", //$NON-NLS-1$
new Class<?>[]{LinkInfo.class, Type.class},
linkInfo, bound);
} | java | protected void setBoundsLinkInfo(LinkInfo linkInfo, Type bound) {
Reflect.callProc(this, LinkFactory.class, "setBoundsLinkInfo", //$NON-NLS-1$
new Class<?>[]{LinkInfo.class, Type.class},
linkInfo, bound);
} | [
"protected",
"void",
"setBoundsLinkInfo",
"(",
"LinkInfo",
"linkInfo",
",",
"Type",
"bound",
")",
"{",
"Reflect",
".",
"callProc",
"(",
"this",
",",
"LinkFactory",
".",
"class",
",",
"\"setBoundsLinkInfo\"",
",",
"//$NON-NLS-1$",
"new",
"Class",
"<",
"?",
">",... | Change the bounds into the link info.
@param linkInfo the link info.
@param bound the new bounds. | [
"Change",
"the",
"bounds",
"into",
"the",
"link",
"info",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L145-L149 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java | SarlLinkFactory.getLinkForClass | protected Content getLinkForClass(Content link, LinkInfo linkInfo, Type type) {
if (linkInfo.isTypeBound && linkInfo.excludeTypeBoundsLinks) {
//Since we are excluding type parameter links, we should not
//be linking to the type bound.
link.addContent(type.typeName());
link.addContent(getTypeParameterLinks(linkInfo));
return null;
}
linkInfo.classDoc = type.asClassDoc();
final Content nlink = newContent();
nlink.addContent(getClassLink(linkInfo));
if (linkInfo.includeTypeAsSepLink) {
nlink.addContent(getTypeParameterLinks(linkInfo, false));
}
return nlink;
} | java | protected Content getLinkForClass(Content link, LinkInfo linkInfo, Type type) {
if (linkInfo.isTypeBound && linkInfo.excludeTypeBoundsLinks) {
//Since we are excluding type parameter links, we should not
//be linking to the type bound.
link.addContent(type.typeName());
link.addContent(getTypeParameterLinks(linkInfo));
return null;
}
linkInfo.classDoc = type.asClassDoc();
final Content nlink = newContent();
nlink.addContent(getClassLink(linkInfo));
if (linkInfo.includeTypeAsSepLink) {
nlink.addContent(getTypeParameterLinks(linkInfo, false));
}
return nlink;
} | [
"protected",
"Content",
"getLinkForClass",
"(",
"Content",
"link",
",",
"LinkInfo",
"linkInfo",
",",
"Type",
"type",
")",
"{",
"if",
"(",
"linkInfo",
".",
"isTypeBound",
"&&",
"linkInfo",
".",
"excludeTypeBoundsLinks",
")",
"{",
"//Since we are excluding type parame... | Build the link for the class.
@param link the link.
@param linkInfo the information on the link.
@param type the type.
@return the content. | [
"Build",
"the",
"link",
"for",
"the",
"class",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L158-L173 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java | SarlLinkFactory.updateLinkLabel | protected void updateLinkLabel(LinkInfo linkInfo) {
if (linkInfo.type != null && linkInfo instanceof LinkInfoImpl) {
final LinkInfoImpl impl = (LinkInfoImpl) linkInfo;
final ClassDoc classdoc = linkInfo.type.asClassDoc();
if (classdoc != null) {
final SARLFeatureAccess kw = Utils.getKeywords();
final String name = classdoc.qualifiedName();
if (isPrefix(name, kw.getProceduresName())) {
linkInfo.label = createProcedureLambdaLabel(impl);
} else if (isPrefix(name, kw.getFunctionsName())) {
linkInfo.label = createFunctionLambdaLabel(impl);
}
}
}
} | java | protected void updateLinkLabel(LinkInfo linkInfo) {
if (linkInfo.type != null && linkInfo instanceof LinkInfoImpl) {
final LinkInfoImpl impl = (LinkInfoImpl) linkInfo;
final ClassDoc classdoc = linkInfo.type.asClassDoc();
if (classdoc != null) {
final SARLFeatureAccess kw = Utils.getKeywords();
final String name = classdoc.qualifiedName();
if (isPrefix(name, kw.getProceduresName())) {
linkInfo.label = createProcedureLambdaLabel(impl);
} else if (isPrefix(name, kw.getFunctionsName())) {
linkInfo.label = createFunctionLambdaLabel(impl);
}
}
}
} | [
"protected",
"void",
"updateLinkLabel",
"(",
"LinkInfo",
"linkInfo",
")",
"{",
"if",
"(",
"linkInfo",
".",
"type",
"!=",
"null",
"&&",
"linkInfo",
"instanceof",
"LinkInfoImpl",
")",
"{",
"final",
"LinkInfoImpl",
"impl",
"=",
"(",
"LinkInfoImpl",
")",
"linkInfo... | Update the label of the given link with the SARL notation for lambdas.
@param linkInfo the link information to update. | [
"Update",
"the",
"label",
"of",
"the",
"given",
"link",
"with",
"the",
"SARL",
"notation",
"for",
"lambdas",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L243-L257 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java | SarlLinkFactory.createProcedureLambdaLabel | protected Content createProcedureLambdaLabel(LinkInfoImpl linkInfo) {
final ParameterizedType type = linkInfo.type.asParameterizedType();
if (type != null) {
final Type[] arguments = type.typeArguments();
if (arguments != null && arguments.length > 0) {
return createLambdaLabel(linkInfo, arguments, arguments.length);
}
}
return linkInfo.label;
} | java | protected Content createProcedureLambdaLabel(LinkInfoImpl linkInfo) {
final ParameterizedType type = linkInfo.type.asParameterizedType();
if (type != null) {
final Type[] arguments = type.typeArguments();
if (arguments != null && arguments.length > 0) {
return createLambdaLabel(linkInfo, arguments, arguments.length);
}
}
return linkInfo.label;
} | [
"protected",
"Content",
"createProcedureLambdaLabel",
"(",
"LinkInfoImpl",
"linkInfo",
")",
"{",
"final",
"ParameterizedType",
"type",
"=",
"linkInfo",
".",
"type",
".",
"asParameterizedType",
"(",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"final",
... | Create the label for a procedure lambda.
@param linkInfo the type.
@return the label. | [
"Create",
"the",
"label",
"for",
"a",
"procedure",
"lambda",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L268-L277 | train |
sarl/sarl | products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/commands/CompilerCommandModule.java | CompilerCommandModule.provideSarlcCompilerCommand | @SuppressWarnings("static-method")
@Provides
@Singleton
public CompilerCommand provideSarlcCompilerCommand(Provider<SarlBatchCompiler> compiler,
Provider<SarlConfig> configuration, Provider<PathDetector> pathDetector,
Provider<ProgressBarConfig> commandConfig) {
return new CompilerCommand(compiler, configuration, pathDetector, commandConfig);
} | java | @SuppressWarnings("static-method")
@Provides
@Singleton
public CompilerCommand provideSarlcCompilerCommand(Provider<SarlBatchCompiler> compiler,
Provider<SarlConfig> configuration, Provider<PathDetector> pathDetector,
Provider<ProgressBarConfig> commandConfig) {
return new CompilerCommand(compiler, configuration, pathDetector, commandConfig);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"@",
"Provides",
"@",
"Singleton",
"public",
"CompilerCommand",
"provideSarlcCompilerCommand",
"(",
"Provider",
"<",
"SarlBatchCompiler",
">",
"compiler",
",",
"Provider",
"<",
"SarlConfig",
">",
"configuration",
... | Provide the command for running the compiler.
@param compiler the compiler.
@param configuration the SARLC configuration.
@param pathDetector the detector of paths.
@param commandConfig the configuration of the command.
@return the command. | [
"Provide",
"the",
"command",
"for",
"running",
"the",
"compiler",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/commands/CompilerCommandModule.java#L77-L84 | train |
sarl/sarl | products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/commands/CompilerCommandModule.java | CompilerCommandModule.getProgressBarConfig | @SuppressWarnings("static-method")
@Provides
@Singleton
public ProgressBarConfig getProgressBarConfig(ConfigurationFactory configFactory, Injector injector) {
final ProgressBarConfig config = ProgressBarConfig.getConfiguration(configFactory);
injector.injectMembers(config);
return config;
} | java | @SuppressWarnings("static-method")
@Provides
@Singleton
public ProgressBarConfig getProgressBarConfig(ConfigurationFactory configFactory, Injector injector) {
final ProgressBarConfig config = ProgressBarConfig.getConfiguration(configFactory);
injector.injectMembers(config);
return config;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"@",
"Provides",
"@",
"Singleton",
"public",
"ProgressBarConfig",
"getProgressBarConfig",
"(",
"ConfigurationFactory",
"configFactory",
",",
"Injector",
"injector",
")",
"{",
"final",
"ProgressBarConfig",
"config",
... | Replies the instance of the compiler command configuration.
@param configFactory accessor to the bootique factory.
@param injector the current injector.
@return the compiler command configuration accessor. | [
"Replies",
"the",
"instance",
"of",
"the",
"compiler",
"command",
"configuration",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/commands/CompilerCommandModule.java#L92-L99 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/macro/SarlProcessorInstanceForJvmTypeProvider.java | SarlProcessorInstanceForJvmTypeProvider.filterActiveProcessorType | public static JvmType filterActiveProcessorType(JvmType type, CommonTypeComputationServices services) {
if (AccessorsProcessor.class.getName().equals(type.getQualifiedName())) {
return services.getTypeReferences().findDeclaredType(SarlAccessorsProcessor.class, type);
}
return type;
} | java | public static JvmType filterActiveProcessorType(JvmType type, CommonTypeComputationServices services) {
if (AccessorsProcessor.class.getName().equals(type.getQualifiedName())) {
return services.getTypeReferences().findDeclaredType(SarlAccessorsProcessor.class, type);
}
return type;
} | [
"public",
"static",
"JvmType",
"filterActiveProcessorType",
"(",
"JvmType",
"type",
",",
"CommonTypeComputationServices",
"services",
")",
"{",
"if",
"(",
"AccessorsProcessor",
".",
"class",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"type",
".",
"getQualifiedN... | Filter the type in order to create the correct processor.
@param type the type of the processor specified into the {@code @Active} annotation.
@param services the type services of the framework.
@return the real type of the processor to instance. | [
"Filter",
"the",
"type",
"in",
"order",
"to",
"create",
"the",
"correct",
"processor",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/macro/SarlProcessorInstanceForJvmTypeProvider.java#L59-L64 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java | SARLImages.forAgent | public ImageDescriptor forAgent(JvmVisibility visibility, int flags) {
return getDecorated(getTypeImageDescriptor(
SarlElementType.AGENT, false, false, toFlags(visibility), USE_LIGHT_ICONS), flags);
} | java | public ImageDescriptor forAgent(JvmVisibility visibility, int flags) {
return getDecorated(getTypeImageDescriptor(
SarlElementType.AGENT, false, false, toFlags(visibility), USE_LIGHT_ICONS), flags);
} | [
"public",
"ImageDescriptor",
"forAgent",
"(",
"JvmVisibility",
"visibility",
",",
"int",
"flags",
")",
"{",
"return",
"getDecorated",
"(",
"getTypeImageDescriptor",
"(",
"SarlElementType",
".",
"AGENT",
",",
"false",
",",
"false",
",",
"toFlags",
"(",
"visibility"... | Replies the image descriptor for the "agents".
@param visibility the visibility of the agent.
@param flags the mark flags. See {@link JavaElementImageDescriptor#setAdornments(int)} for
a description of the available flags.
@return the image descriptor for the agents. | [
"Replies",
"the",
"image",
"descriptor",
"for",
"the",
"agents",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java#L127-L130 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java | SARLImages.forBehavior | public ImageDescriptor forBehavior(JvmVisibility visibility, int flags) {
return getDecorated(getTypeImageDescriptor(
SarlElementType.BEHAVIOR, false, false, toFlags(visibility), USE_LIGHT_ICONS), flags);
} | java | public ImageDescriptor forBehavior(JvmVisibility visibility, int flags) {
return getDecorated(getTypeImageDescriptor(
SarlElementType.BEHAVIOR, false, false, toFlags(visibility), USE_LIGHT_ICONS), flags);
} | [
"public",
"ImageDescriptor",
"forBehavior",
"(",
"JvmVisibility",
"visibility",
",",
"int",
"flags",
")",
"{",
"return",
"getDecorated",
"(",
"getTypeImageDescriptor",
"(",
"SarlElementType",
".",
"BEHAVIOR",
",",
"false",
",",
"false",
",",
"toFlags",
"(",
"visib... | Replies the image descriptor for the "behaviors".
@param visibility the visibility of the behavior.
@param flags the mark flags. See {@link JavaElementImageDescriptor#setAdornments(int)} for
a description of the available flags.
@return the image descriptor for the behaviors. | [
"Replies",
"the",
"image",
"descriptor",
"for",
"the",
"behaviors",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java#L139-L142 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java | SARLImages.forCapacity | public ImageDescriptor forCapacity(JvmVisibility visibility, int flags) {
return getDecorated(getTypeImageDescriptor(
SarlElementType.CAPACITY, false, false, toFlags(visibility), USE_LIGHT_ICONS), flags);
} | java | public ImageDescriptor forCapacity(JvmVisibility visibility, int flags) {
return getDecorated(getTypeImageDescriptor(
SarlElementType.CAPACITY, false, false, toFlags(visibility), USE_LIGHT_ICONS), flags);
} | [
"public",
"ImageDescriptor",
"forCapacity",
"(",
"JvmVisibility",
"visibility",
",",
"int",
"flags",
")",
"{",
"return",
"getDecorated",
"(",
"getTypeImageDescriptor",
"(",
"SarlElementType",
".",
"CAPACITY",
",",
"false",
",",
"false",
",",
"toFlags",
"(",
"visib... | Replies the image descriptor for the "capacities".
@param visibility the visibility of the capacity.
@param flags the mark flags. See {@link JavaElementImageDescriptor#setAdornments(int)} for
a description of the available flags.
@return the image descriptor for the capacities. | [
"Replies",
"the",
"image",
"descriptor",
"for",
"the",
"capacities",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java#L151-L154 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java | SARLImages.forSkill | public ImageDescriptor forSkill(JvmVisibility visibility, int flags) {
return getDecorated(getTypeImageDescriptor(
SarlElementType.SKILL, false, false, toFlags(visibility), USE_LIGHT_ICONS), flags);
} | java | public ImageDescriptor forSkill(JvmVisibility visibility, int flags) {
return getDecorated(getTypeImageDescriptor(
SarlElementType.SKILL, false, false, toFlags(visibility), USE_LIGHT_ICONS), flags);
} | [
"public",
"ImageDescriptor",
"forSkill",
"(",
"JvmVisibility",
"visibility",
",",
"int",
"flags",
")",
"{",
"return",
"getDecorated",
"(",
"getTypeImageDescriptor",
"(",
"SarlElementType",
".",
"SKILL",
",",
"false",
",",
"false",
",",
"toFlags",
"(",
"visibility"... | Replies the image descriptor for the "skills".
@param visibility the visibility of the skill.
@param flags the mark flags. See {@link JavaElementImageDescriptor#setAdornments(int)} for
a description of the available flags.
@return the image descriptor for the skills. | [
"Replies",
"the",
"image",
"descriptor",
"for",
"the",
"skills",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java#L163-L166 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java | SARLImages.forEvent | public ImageDescriptor forEvent(JvmVisibility visibility, int flags) {
return getDecorated(getTypeImageDescriptor(
SarlElementType.EVENT, false, false, toFlags(visibility), USE_LIGHT_ICONS), flags);
} | java | public ImageDescriptor forEvent(JvmVisibility visibility, int flags) {
return getDecorated(getTypeImageDescriptor(
SarlElementType.EVENT, false, false, toFlags(visibility), USE_LIGHT_ICONS), flags);
} | [
"public",
"ImageDescriptor",
"forEvent",
"(",
"JvmVisibility",
"visibility",
",",
"int",
"flags",
")",
"{",
"return",
"getDecorated",
"(",
"getTypeImageDescriptor",
"(",
"SarlElementType",
".",
"EVENT",
",",
"false",
",",
"false",
",",
"toFlags",
"(",
"visibility"... | Replies the image descriptor for the "events".
@param visibility the visibility of the event.
@param flags the mark flags. See {@link JavaElementImageDescriptor#setAdornments(int)} for
a description of the available flags.
@return the image descriptor for the events. | [
"Replies",
"the",
"image",
"descriptor",
"for",
"the",
"events",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java#L175-L178 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java | SARLImages.forBehaviorUnit | public ImageDescriptor forBehaviorUnit() {
return getDecorated(getTypeImageDescriptor(
SarlElementType.BEHAVIOR_UNIT, false, false,
toFlags(JvmVisibility.PUBLIC), USE_LIGHT_ICONS), 0);
} | java | public ImageDescriptor forBehaviorUnit() {
return getDecorated(getTypeImageDescriptor(
SarlElementType.BEHAVIOR_UNIT, false, false,
toFlags(JvmVisibility.PUBLIC), USE_LIGHT_ICONS), 0);
} | [
"public",
"ImageDescriptor",
"forBehaviorUnit",
"(",
")",
"{",
"return",
"getDecorated",
"(",
"getTypeImageDescriptor",
"(",
"SarlElementType",
".",
"BEHAVIOR_UNIT",
",",
"false",
",",
"false",
",",
"toFlags",
"(",
"JvmVisibility",
".",
"PUBLIC",
")",
",",
"USE_LI... | Replies the image descriptor for the "behavior units".
@return the image descriptor for the behavior units. | [
"Replies",
"the",
"image",
"descriptor",
"for",
"the",
"behavior",
"units",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java#L184-L188 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java | SARLImages.forStaticConstructor | public ImageDescriptor forStaticConstructor() {
return getDecorated(
getMethodImageDescriptor(false, toFlags(JvmVisibility.PUBLIC)),
JavaElementImageDescriptor.CONSTRUCTOR | JavaElementImageDescriptor.STATIC);
} | java | public ImageDescriptor forStaticConstructor() {
return getDecorated(
getMethodImageDescriptor(false, toFlags(JvmVisibility.PUBLIC)),
JavaElementImageDescriptor.CONSTRUCTOR | JavaElementImageDescriptor.STATIC);
} | [
"public",
"ImageDescriptor",
"forStaticConstructor",
"(",
")",
"{",
"return",
"getDecorated",
"(",
"getMethodImageDescriptor",
"(",
"false",
",",
"toFlags",
"(",
"JvmVisibility",
".",
"PUBLIC",
")",
")",
",",
"JavaElementImageDescriptor",
".",
"CONSTRUCTOR",
"|",
"J... | Replies the image descriptor for the "static constructors".
@return the image descriptor for the agents.
@since 0.6 | [
"Replies",
"the",
"image",
"descriptor",
"for",
"the",
"static",
"constructors",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java#L236-L240 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/NewSarlProjectWizard.java | NewSarlProjectWizard.getPomTemplateLocation | public static URL getPomTemplateLocation() {
final URL url = Resources.getResource(NewSarlProjectWizard.class, POM_TEMPLATE_BASENAME);
assert url != null;
return url;
} | java | public static URL getPomTemplateLocation() {
final URL url = Resources.getResource(NewSarlProjectWizard.class, POM_TEMPLATE_BASENAME);
assert url != null;
return url;
} | [
"public",
"static",
"URL",
"getPomTemplateLocation",
"(",
")",
"{",
"final",
"URL",
"url",
"=",
"Resources",
".",
"getResource",
"(",
"NewSarlProjectWizard",
".",
"class",
",",
"POM_TEMPLATE_BASENAME",
")",
";",
"assert",
"url",
"!=",
"null",
";",
"return",
"u... | Replies the location of a template for the pom files.
@return the location. Should be never {@code null}.
@since 0.8
@see #POM_TEMPLATE_BASENAME | [
"Replies",
"the",
"location",
"of",
"a",
"template",
"for",
"the",
"pom",
"files",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/NewSarlProjectWizard.java#L128-L132 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/NewSarlProjectWizard.java | NewSarlProjectWizard.validateSARLSpecificElements | protected boolean validateSARLSpecificElements(IJavaProject javaProject) {
// Check if the "SARL" generation directory is a source folder.
final IPath outputPath = SARLPreferences.getSARLOutputPathFor(javaProject.getProject());
if (outputPath == null) {
final String message = MessageFormat.format(
Messages.BuildSettingWizardPage_0,
SARLConfig.FOLDER_SOURCE_GENERATED);
final IStatus status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, message);
handleFinishException(getShell(), new InvocationTargetException(new CoreException(status)));
return false;
}
if (!hasSourcePath(javaProject, outputPath)) {
final String message = MessageFormat.format(
Messages.SARLProjectCreationWizard_0,
toOSString(outputPath),
buildInvalidOutputPathMessageFragment(javaProject));
final IStatus status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, message);
handleFinishException(getShell(), new InvocationTargetException(new CoreException(status)));
return false;
}
return true;
} | java | protected boolean validateSARLSpecificElements(IJavaProject javaProject) {
// Check if the "SARL" generation directory is a source folder.
final IPath outputPath = SARLPreferences.getSARLOutputPathFor(javaProject.getProject());
if (outputPath == null) {
final String message = MessageFormat.format(
Messages.BuildSettingWizardPage_0,
SARLConfig.FOLDER_SOURCE_GENERATED);
final IStatus status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, message);
handleFinishException(getShell(), new InvocationTargetException(new CoreException(status)));
return false;
}
if (!hasSourcePath(javaProject, outputPath)) {
final String message = MessageFormat.format(
Messages.SARLProjectCreationWizard_0,
toOSString(outputPath),
buildInvalidOutputPathMessageFragment(javaProject));
final IStatus status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, message);
handleFinishException(getShell(), new InvocationTargetException(new CoreException(status)));
return false;
}
return true;
} | [
"protected",
"boolean",
"validateSARLSpecificElements",
"(",
"IJavaProject",
"javaProject",
")",
"{",
"// Check if the \"SARL\" generation directory is a source folder.",
"final",
"IPath",
"outputPath",
"=",
"SARLPreferences",
".",
"getSARLOutputPathFor",
"(",
"javaProject",
".",... | Validate the SARL properties of the new projects.
@param javaProject the created element
@return validity | [
"Validate",
"the",
"SARL",
"properties",
"of",
"the",
"new",
"projects",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/NewSarlProjectWizard.java#L202-L224 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/NewSarlProjectWizard.java | NewSarlProjectWizard.createDefaultMavenPom | protected void createDefaultMavenPom(IJavaProject project, String compilerCompliance) {
// Get the template resource.
final URL templateUrl = getPomTemplateLocation();
if (templateUrl != null) {
final String compliance = Strings.isNullOrEmpty(compilerCompliance) ? SARLVersion.MINIMAL_JDK_VERSION : compilerCompliance;
final String groupId = getDefaultMavenGroupId();
// Read the template and do string replacement.
final StringBuilder content = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(templateUrl.openStream()))) {
String line = reader.readLine();
while (line != null) {
line = line.replaceAll(Pattern.quote("@GROUP_ID@"), groupId); //$NON-NLS-1$
line = line.replaceAll(Pattern.quote("@PROJECT_NAME@"), project.getElementName()); //$NON-NLS-1$
line = line.replaceAll(Pattern.quote("@PROJECT_VERSION@"), DEFAULT_MAVEN_PROJECT_VERSION); //$NON-NLS-1$
line = line.replaceAll(Pattern.quote("@SARL_VERSION@"), SARLVersion.SARL_RELEASE_VERSION_MAVEN); //$NON-NLS-1$
line = line.replaceAll(Pattern.quote("@JAVA_VERSION@"), compliance); //$NON-NLS-1$
line = line.replaceAll(Pattern.quote("@FILE_ENCODING@"), Charset.defaultCharset().displayName()); //$NON-NLS-1$
content.append(line).append("\n"); //$NON-NLS-1$
line = reader.readLine();
}
} catch (IOException exception) {
throw new RuntimeIOException(exception);
}
// Write the pom
final IFile pomFile = project.getProject().getFile("pom.xml"); //$NON-NLS-1$
try (StringInputStream is = new StringInputStream(content.toString())) {
pomFile.create(is, true, new NullProgressMonitor());
} catch (CoreException exception) {
throw new RuntimeException(exception);
} catch (IOException exception) {
throw new RuntimeIOException(exception);
}
}
} | java | protected void createDefaultMavenPom(IJavaProject project, String compilerCompliance) {
// Get the template resource.
final URL templateUrl = getPomTemplateLocation();
if (templateUrl != null) {
final String compliance = Strings.isNullOrEmpty(compilerCompliance) ? SARLVersion.MINIMAL_JDK_VERSION : compilerCompliance;
final String groupId = getDefaultMavenGroupId();
// Read the template and do string replacement.
final StringBuilder content = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(templateUrl.openStream()))) {
String line = reader.readLine();
while (line != null) {
line = line.replaceAll(Pattern.quote("@GROUP_ID@"), groupId); //$NON-NLS-1$
line = line.replaceAll(Pattern.quote("@PROJECT_NAME@"), project.getElementName()); //$NON-NLS-1$
line = line.replaceAll(Pattern.quote("@PROJECT_VERSION@"), DEFAULT_MAVEN_PROJECT_VERSION); //$NON-NLS-1$
line = line.replaceAll(Pattern.quote("@SARL_VERSION@"), SARLVersion.SARL_RELEASE_VERSION_MAVEN); //$NON-NLS-1$
line = line.replaceAll(Pattern.quote("@JAVA_VERSION@"), compliance); //$NON-NLS-1$
line = line.replaceAll(Pattern.quote("@FILE_ENCODING@"), Charset.defaultCharset().displayName()); //$NON-NLS-1$
content.append(line).append("\n"); //$NON-NLS-1$
line = reader.readLine();
}
} catch (IOException exception) {
throw new RuntimeIOException(exception);
}
// Write the pom
final IFile pomFile = project.getProject().getFile("pom.xml"); //$NON-NLS-1$
try (StringInputStream is = new StringInputStream(content.toString())) {
pomFile.create(is, true, new NullProgressMonitor());
} catch (CoreException exception) {
throw new RuntimeException(exception);
} catch (IOException exception) {
throw new RuntimeIOException(exception);
}
}
} | [
"protected",
"void",
"createDefaultMavenPom",
"(",
"IJavaProject",
"project",
",",
"String",
"compilerCompliance",
")",
"{",
"// Get the template resource.",
"final",
"URL",
"templateUrl",
"=",
"getPomTemplateLocation",
"(",
")",
";",
"if",
"(",
"templateUrl",
"!=",
"... | Create the default Maven pom file for the project.
<p>Even if the project has not the Maven nature when it is created with this wizard,
the pom file is created in order to let the developer to switch to the Maven nature easily.
@param project the new project.
@param compilerCompliance the Java version that is supported by the project. | [
"Create",
"the",
"default",
"Maven",
"pom",
"file",
"for",
"the",
"project",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/NewSarlProjectWizard.java#L292-L325 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/NewSarlProjectWizard.java | NewSarlProjectWizard.getDefaultMavenGroupId | @SuppressWarnings("static-method")
protected String getDefaultMavenGroupId() {
final String userdomain = System.getenv("userdomain"); //$NON-NLS-1$
if (Strings.isNullOrEmpty(userdomain)) {
return "com.foo"; //$NON-NLS-1$
}
final String[] elements = userdomain.split(Pattern.quote(".")); //$NON-NLS-1$
final StringBuilder groupId = new StringBuilder();
for (int i = elements.length - 1; i >= 0; --i) {
if (groupId.length() > 0) {
groupId.append("."); //$NON-NLS-1$
}
groupId.append(elements[i]);
}
return groupId.toString();
} | java | @SuppressWarnings("static-method")
protected String getDefaultMavenGroupId() {
final String userdomain = System.getenv("userdomain"); //$NON-NLS-1$
if (Strings.isNullOrEmpty(userdomain)) {
return "com.foo"; //$NON-NLS-1$
}
final String[] elements = userdomain.split(Pattern.quote(".")); //$NON-NLS-1$
final StringBuilder groupId = new StringBuilder();
for (int i = elements.length - 1; i >= 0; --i) {
if (groupId.length() > 0) {
groupId.append("."); //$NON-NLS-1$
}
groupId.append(elements[i]);
}
return groupId.toString();
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"String",
"getDefaultMavenGroupId",
"(",
")",
"{",
"final",
"String",
"userdomain",
"=",
"System",
".",
"getenv",
"(",
"\"userdomain\"",
")",
";",
"//$NON-NLS-1$",
"if",
"(",
"Strings",
".",
"i... | Replies the default group id for a maven project.
@return the default group id, never {@code null} nor empty string. | [
"Replies",
"the",
"default",
"group",
"id",
"for",
"a",
"maven",
"project",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/NewSarlProjectWizard.java#L331-L346 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/NewSarlProjectWizard.java | NewSarlProjectWizard.getActivePart | IWorkbenchPart getActivePart() {
final IWorkbenchWindow activeWindow = getWorkbench().getActiveWorkbenchWindow();
if (activeWindow != null) {
final IWorkbenchPage activePage = activeWindow.getActivePage();
if (activePage != null) {
return activePage.getActivePart();
}
}
return null;
} | java | IWorkbenchPart getActivePart() {
final IWorkbenchWindow activeWindow = getWorkbench().getActiveWorkbenchWindow();
if (activeWindow != null) {
final IWorkbenchPage activePage = activeWindow.getActivePage();
if (activePage != null) {
return activePage.getActivePart();
}
}
return null;
} | [
"IWorkbenchPart",
"getActivePart",
"(",
")",
"{",
"final",
"IWorkbenchWindow",
"activeWindow",
"=",
"getWorkbench",
"(",
")",
".",
"getActiveWorkbenchWindow",
"(",
")",
";",
"if",
"(",
"activeWindow",
"!=",
"null",
")",
"{",
"final",
"IWorkbenchPage",
"activePage"... | Replies the active part in the workbench.
@return the active part. | [
"Replies",
"the",
"active",
"part",
"in",
"the",
"workbench",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/NewSarlProjectWizard.java#L352-L361 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.getCurrentClasspath | public static String getCurrentClasspath() {
final StringBuilder path = new StringBuilder();
for (final URL url : getCurrentClassLoader().getURLs()) {
if (path.length() > 0) {
path.append(File.pathSeparator);
}
final File file = FileSystem.convertURLToFile(url);
if (file != null) {
path.append(file.getAbsolutePath());
}
}
return path.toString();
} | java | public static String getCurrentClasspath() {
final StringBuilder path = new StringBuilder();
for (final URL url : getCurrentClassLoader().getURLs()) {
if (path.length() > 0) {
path.append(File.pathSeparator);
}
final File file = FileSystem.convertURLToFile(url);
if (file != null) {
path.append(file.getAbsolutePath());
}
}
return path.toString();
} | [
"public",
"static",
"String",
"getCurrentClasspath",
"(",
")",
"{",
"final",
"StringBuilder",
"path",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"final",
"URL",
"url",
":",
"getCurrentClassLoader",
"(",
")",
".",
"getURLs",
"(",
")",
")",
"{",... | Replies the current class path.
@return the current class path.
@since 0.7 | [
"Replies",
"the",
"current",
"class",
"path",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L360-L372 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.getCurrentClassLoader | private static URLClassLoader getCurrentClassLoader() {
synchronized (Boot.class) {
if (dynamicClassLoader == null) {
final ClassLoader cl = ClassLoader.getSystemClassLoader();
if (cl instanceof URLClassLoader) {
dynamicClassLoader = (URLClassLoader) cl;
} else {
dynamicClassLoader = URLClassLoader.newInstance(new URL[0], cl);
}
}
return dynamicClassLoader;
}
} | java | private static URLClassLoader getCurrentClassLoader() {
synchronized (Boot.class) {
if (dynamicClassLoader == null) {
final ClassLoader cl = ClassLoader.getSystemClassLoader();
if (cl instanceof URLClassLoader) {
dynamicClassLoader = (URLClassLoader) cl;
} else {
dynamicClassLoader = URLClassLoader.newInstance(new URL[0], cl);
}
}
return dynamicClassLoader;
}
} | [
"private",
"static",
"URLClassLoader",
"getCurrentClassLoader",
"(",
")",
"{",
"synchronized",
"(",
"Boot",
".",
"class",
")",
"{",
"if",
"(",
"dynamicClassLoader",
"==",
"null",
")",
"{",
"final",
"ClassLoader",
"cl",
"=",
"ClassLoader",
".",
"getSystemClassLoa... | Replies the current class loader.
@return the current class loader.
@since 0.7 | [
"Replies",
"the",
"current",
"class",
"loader",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L380-L392 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.addToSystemClasspath | @SuppressWarnings("checkstyle:nestedifdepth")
public static void addToSystemClasspath(String entries) {
if (!Strings.isNullOrEmpty(entries)) {
final List<URL> cp = new ArrayList<>();
final String[] individualEntries = entries.split(Pattern.quote(File.pathSeparator));
for (final String entry : individualEntries) {
if (!Strings.isNullOrEmpty(entry)) {
URL url = FileSystem.convertStringToURL(entry, false);
if (url != null) {
// Normalize the folder name in order to have a "/" at the end of the name.
// Without this "/" the class loader cannot find the resources.
if (URISchemeType.FILE.isURL(url)) {
final File file = FileSystem.convertURLToFile(url);
if (file != null && file.isDirectory()) {
try {
url = new URL(URISchemeType.FILE.name(), "", file.getAbsolutePath() + "/"); //$NON-NLS-1$//$NON-NLS-2$
} catch (MalformedURLException e) {
//
}
}
}
cp.add(url);
}
}
}
final URL[] newcp = new URL[cp.size()];
cp.toArray(newcp);
synchronized (Boot.class) {
dynamicClassLoader = URLClassLoader.newInstance(newcp, ClassLoader.getSystemClassLoader());
}
}
} | java | @SuppressWarnings("checkstyle:nestedifdepth")
public static void addToSystemClasspath(String entries) {
if (!Strings.isNullOrEmpty(entries)) {
final List<URL> cp = new ArrayList<>();
final String[] individualEntries = entries.split(Pattern.quote(File.pathSeparator));
for (final String entry : individualEntries) {
if (!Strings.isNullOrEmpty(entry)) {
URL url = FileSystem.convertStringToURL(entry, false);
if (url != null) {
// Normalize the folder name in order to have a "/" at the end of the name.
// Without this "/" the class loader cannot find the resources.
if (URISchemeType.FILE.isURL(url)) {
final File file = FileSystem.convertURLToFile(url);
if (file != null && file.isDirectory()) {
try {
url = new URL(URISchemeType.FILE.name(), "", file.getAbsolutePath() + "/"); //$NON-NLS-1$//$NON-NLS-2$
} catch (MalformedURLException e) {
//
}
}
}
cp.add(url);
}
}
}
final URL[] newcp = new URL[cp.size()];
cp.toArray(newcp);
synchronized (Boot.class) {
dynamicClassLoader = URLClassLoader.newInstance(newcp, ClassLoader.getSystemClassLoader());
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:nestedifdepth\"",
")",
"public",
"static",
"void",
"addToSystemClasspath",
"(",
"String",
"entries",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"entries",
")",
")",
"{",
"final",
"List",
"<",
"UR... | Add the given entries to the system classpath.
@param entries the new classpath entries. The format of the value is the same as for the <code>-cp</code>
command-line option of the <code>java</code> tool. | [
"Add",
"the",
"given",
"entries",
"to",
"the",
"system",
"classpath",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L399-L430 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.main | public static void main(String[] args) {
try {
Object[] freeArgs = parseCommandLine(args);
if (JanusConfig.getSystemPropertyAsBoolean(JanusConfig.JANUS_LOGO_SHOW_NAME,
JanusConfig.JANUS_LOGO_SHOW.booleanValue())) {
showJanusLogo();
}
if (freeArgs.length == 0) {
showError(Messages.Boot_3, null);
// Event if showError never returns, add the return statement for
// avoiding compilation error.
return;
}
final String agentToLaunch = freeArgs[0].toString();
freeArgs = Arrays.copyOfRange(freeArgs, 1, freeArgs.length, String[].class);
// Load the agent class
final Class<? extends Agent> agent = loadAgentClass(agentToLaunch);
assert agent != null;
startJanus(agent, freeArgs);
} catch (EarlyExitException exception) {
// Be silent
return;
} catch (Throwable e) {
showError(MessageFormat.format(Messages.Boot_4,
e.getLocalizedMessage()), e);
// Even if showError never returns, add the return statement for
// avoiding compilation error.
return;
}
} | java | public static void main(String[] args) {
try {
Object[] freeArgs = parseCommandLine(args);
if (JanusConfig.getSystemPropertyAsBoolean(JanusConfig.JANUS_LOGO_SHOW_NAME,
JanusConfig.JANUS_LOGO_SHOW.booleanValue())) {
showJanusLogo();
}
if (freeArgs.length == 0) {
showError(Messages.Boot_3, null);
// Event if showError never returns, add the return statement for
// avoiding compilation error.
return;
}
final String agentToLaunch = freeArgs[0].toString();
freeArgs = Arrays.copyOfRange(freeArgs, 1, freeArgs.length, String[].class);
// Load the agent class
final Class<? extends Agent> agent = loadAgentClass(agentToLaunch);
assert agent != null;
startJanus(agent, freeArgs);
} catch (EarlyExitException exception) {
// Be silent
return;
} catch (Throwable e) {
showError(MessageFormat.format(Messages.Boot_4,
e.getLocalizedMessage()), e);
// Even if showError never returns, add the return statement for
// avoiding compilation error.
return;
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"Object",
"[",
"]",
"freeArgs",
"=",
"parseCommandLine",
"(",
"args",
")",
";",
"if",
"(",
"JanusConfig",
".",
"getSystemPropertyAsBoolean",
"(",
"JanusConfig",
".",... | Main function that is parsing the command line and launching the first agent.
@param args command line arguments
@see #startJanus(Class, Object...) | [
"Main",
"function",
"that",
"is",
"parsing",
"the",
"command",
"line",
"and",
"launching",
"the",
"first",
"agent",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L477-L511 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.getOptions | public static Options getOptions() {
final Options options = new Options();
options.addOption(CLI_OPTION_CLASSPATH_SHORT, CLI_OPTION_CLASSPATH_LONG, true,
Messages.Boot_24);
options.addOption(CLI_OPTION_EMBEDDED_SHORT, CLI_OPTION_EMBEDDED_LONG, false,
Messages.Boot_5);
options.addOption(CLI_OPTION_BOOTID_SHORT, CLI_OPTION_BOOTID_LONG, false,
MessageFormat.format(Messages.Boot_6,
JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME));
options.addOption(CLI_OPTION_FILE_SHORT, CLI_OPTION_FILE_LONG, true,
Messages.Boot_7);
options.addOption(CLI_OPTION_HELP_SHORT, CLI_OPTION_HELP_LONG, false,
Messages.Boot_8);
options.addOption(null, CLI_OPTION_NOLOGO_LONG, false,
Messages.Boot_9);
options.addOption(CLI_OPTION_OFFLINE_SHORT, CLI_OPTION_OFFLINE_LONG, false,
MessageFormat.format(Messages.Boot_10, JanusConfig.OFFLINE));
options.addOption(CLI_OPTION_QUIET_SHORT, CLI_OPTION_QUIET_LONG, false,
Messages.Boot_11);
options.addOption(CLI_OPTION_RANDOMID_SHORT, CLI_OPTION_RANDOMID_LONG, false,
MessageFormat.format(Messages.Boot_12,
JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME));
options.addOption(CLI_OPTION_SHOWDEFAULTS_SHORT, CLI_OPTION_SHOWDEFAULTS_LONG, false,
Messages.Boot_13);
options.addOption(CLI_OPTION_SHOWCLASSPATH, false,
Messages.Boot_23);
options.addOption(null, CLI_OPTION_SHOWCLIARGUMENTS_LONG, false,
Messages.Boot_14);
options.addOption(CLI_OPTION_VERBOSE_SHORT, CLI_OPTION_VERBOSE_LONG, false,
Messages.Boot_15);
options.addOption(CLI_OPTION_VERSION, false,
Messages.Boot_25);
options.addOption(CLI_OPTION_WORLDID_SHORT, CLI_OPTION_WORLDID_LONG, false,
MessageFormat.format(Messages.Boot_16,
JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME));
final StringBuilder b = new StringBuilder();
int level = 0;
for (final String logLevel : LoggerCreator.getLevelStrings()) {
if (b.length() > 0) {
b.append(", "); //$NON-NLS-1$
}
b.append(logLevel);
b.append(" ("); //$NON-NLS-1$
b.append(level);
b.append(")"); //$NON-NLS-1$
++level;
}
Option opt = new Option(CLI_OPTION_LOG_SHORT, CLI_OPTION_LOG_LONG, true,
MessageFormat.format(Messages.Boot_17,
JanusConfig.VERBOSE_LEVEL_VALUE, b));
opt.setArgs(1);
options.addOption(opt);
opt = new Option(CLI_OPTION_DEFINE_SHORT, CLI_OPTION_DEFINE_LONG, true,
Messages.Boot_18);
opt.setArgs(2);
opt.setValueSeparator('=');
opt.setArgName(Messages.Boot_19);
options.addOption(opt);
return options;
} | java | public static Options getOptions() {
final Options options = new Options();
options.addOption(CLI_OPTION_CLASSPATH_SHORT, CLI_OPTION_CLASSPATH_LONG, true,
Messages.Boot_24);
options.addOption(CLI_OPTION_EMBEDDED_SHORT, CLI_OPTION_EMBEDDED_LONG, false,
Messages.Boot_5);
options.addOption(CLI_OPTION_BOOTID_SHORT, CLI_OPTION_BOOTID_LONG, false,
MessageFormat.format(Messages.Boot_6,
JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME));
options.addOption(CLI_OPTION_FILE_SHORT, CLI_OPTION_FILE_LONG, true,
Messages.Boot_7);
options.addOption(CLI_OPTION_HELP_SHORT, CLI_OPTION_HELP_LONG, false,
Messages.Boot_8);
options.addOption(null, CLI_OPTION_NOLOGO_LONG, false,
Messages.Boot_9);
options.addOption(CLI_OPTION_OFFLINE_SHORT, CLI_OPTION_OFFLINE_LONG, false,
MessageFormat.format(Messages.Boot_10, JanusConfig.OFFLINE));
options.addOption(CLI_OPTION_QUIET_SHORT, CLI_OPTION_QUIET_LONG, false,
Messages.Boot_11);
options.addOption(CLI_OPTION_RANDOMID_SHORT, CLI_OPTION_RANDOMID_LONG, false,
MessageFormat.format(Messages.Boot_12,
JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME));
options.addOption(CLI_OPTION_SHOWDEFAULTS_SHORT, CLI_OPTION_SHOWDEFAULTS_LONG, false,
Messages.Boot_13);
options.addOption(CLI_OPTION_SHOWCLASSPATH, false,
Messages.Boot_23);
options.addOption(null, CLI_OPTION_SHOWCLIARGUMENTS_LONG, false,
Messages.Boot_14);
options.addOption(CLI_OPTION_VERBOSE_SHORT, CLI_OPTION_VERBOSE_LONG, false,
Messages.Boot_15);
options.addOption(CLI_OPTION_VERSION, false,
Messages.Boot_25);
options.addOption(CLI_OPTION_WORLDID_SHORT, CLI_OPTION_WORLDID_LONG, false,
MessageFormat.format(Messages.Boot_16,
JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME));
final StringBuilder b = new StringBuilder();
int level = 0;
for (final String logLevel : LoggerCreator.getLevelStrings()) {
if (b.length() > 0) {
b.append(", "); //$NON-NLS-1$
}
b.append(logLevel);
b.append(" ("); //$NON-NLS-1$
b.append(level);
b.append(")"); //$NON-NLS-1$
++level;
}
Option opt = new Option(CLI_OPTION_LOG_SHORT, CLI_OPTION_LOG_LONG, true,
MessageFormat.format(Messages.Boot_17,
JanusConfig.VERBOSE_LEVEL_VALUE, b));
opt.setArgs(1);
options.addOption(opt);
opt = new Option(CLI_OPTION_DEFINE_SHORT, CLI_OPTION_DEFINE_LONG, true,
Messages.Boot_18);
opt.setArgs(2);
opt.setValueSeparator('=');
opt.setArgName(Messages.Boot_19);
options.addOption(opt);
return options;
} | [
"public",
"static",
"Options",
"getOptions",
"(",
")",
"{",
"final",
"Options",
"options",
"=",
"new",
"Options",
"(",
")",
";",
"options",
".",
"addOption",
"(",
"CLI_OPTION_CLASSPATH_SHORT",
",",
"CLI_OPTION_CLASSPATH_LONG",
",",
"true",
",",
"Messages",
".",
... | Replies the command line options supported by this boot class.
@return the command line options. | [
"Replies",
"the",
"command",
"line",
"options",
"supported",
"by",
"this",
"boot",
"class",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L542-L616 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.showError | @SuppressWarnings("checkstyle:regexp")
public static void showError(String message, Throwable exception) {
try (PrintWriter logger = new PrintWriter(getConsoleLogger())) {
if (message != null && !message.isEmpty()) {
logger.println(message);
} else if (exception != null) {
exception.printStackTrace(logger);
}
logger.println();
logger.flush();
showHelp(logger, false);
showVersion(true);
}
} | java | @SuppressWarnings("checkstyle:regexp")
public static void showError(String message, Throwable exception) {
try (PrintWriter logger = new PrintWriter(getConsoleLogger())) {
if (message != null && !message.isEmpty()) {
logger.println(message);
} else if (exception != null) {
exception.printStackTrace(logger);
}
logger.println();
logger.flush();
showHelp(logger, false);
showVersion(true);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:regexp\"",
")",
"public",
"static",
"void",
"showError",
"(",
"String",
"message",
",",
"Throwable",
"exception",
")",
"{",
"try",
"(",
"PrintWriter",
"logger",
"=",
"new",
"PrintWriter",
"(",
"getConsoleLogger",
"(",
... | Show an error message, and exit.
<p>This function never returns.
@param message the description of the error.
@param exception the cause of the error. | [
"Show",
"an",
"error",
"message",
"and",
"exit",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L626-L639 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.getProgramName | public static String getProgramName() {
String programName = JanusConfig.getSystemProperty(JanusConfig.JANUS_PROGRAM_NAME, null);
if (Strings.isNullOrEmpty(programName)) {
programName = JanusConfig.JANUS_PROGRAM_NAME_VALUE;
}
return programName;
} | java | public static String getProgramName() {
String programName = JanusConfig.getSystemProperty(JanusConfig.JANUS_PROGRAM_NAME, null);
if (Strings.isNullOrEmpty(programName)) {
programName = JanusConfig.JANUS_PROGRAM_NAME_VALUE;
}
return programName;
} | [
"public",
"static",
"String",
"getProgramName",
"(",
")",
"{",
"String",
"programName",
"=",
"JanusConfig",
".",
"getSystemProperty",
"(",
"JanusConfig",
".",
"JANUS_PROGRAM_NAME",
",",
"null",
")",
";",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"programN... | Replies the name of the program.
@return the name of the program. | [
"Replies",
"the",
"name",
"of",
"the",
"program",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L667-L673 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.showDefaults | @SuppressWarnings("checkstyle:regexp")
public static void showDefaults() {
final Properties defaultValues = new Properties();
JanusConfig.getDefaultValues(defaultValues);
NetworkConfig.getDefaultValues(defaultValues);
try (OutputStream os = getConsoleLogger()) {
defaultValues.storeToXML(os, null);
os.flush();
} catch (Throwable e) {
e.printStackTrace();
}
getExiter().exit();
} | java | @SuppressWarnings("checkstyle:regexp")
public static void showDefaults() {
final Properties defaultValues = new Properties();
JanusConfig.getDefaultValues(defaultValues);
NetworkConfig.getDefaultValues(defaultValues);
try (OutputStream os = getConsoleLogger()) {
defaultValues.storeToXML(os, null);
os.flush();
} catch (Throwable e) {
e.printStackTrace();
}
getExiter().exit();
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:regexp\"",
")",
"public",
"static",
"void",
"showDefaults",
"(",
")",
"{",
"final",
"Properties",
"defaultValues",
"=",
"new",
"Properties",
"(",
")",
";",
"JanusConfig",
".",
"getDefaultValues",
"(",
"defaultValues",
")... | Show the default values of the system properties. This function never returns. | [
"Show",
"the",
"default",
"values",
"of",
"the",
"system",
"properties",
".",
"This",
"function",
"never",
"returns",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L678-L690 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.showClasspath | @SuppressWarnings({ "resource" })
public static void showClasspath() {
final String cp = getCurrentClasspath();
if (!Strings.isNullOrEmpty(cp)) {
final PrintStream ps = getConsoleLogger();
for (final String entry : cp.split(Pattern.quote(File.pathSeparator))) {
ps.println(entry);
}
ps.flush();
}
getExiter().exit();
} | java | @SuppressWarnings({ "resource" })
public static void showClasspath() {
final String cp = getCurrentClasspath();
if (!Strings.isNullOrEmpty(cp)) {
final PrintStream ps = getConsoleLogger();
for (final String entry : cp.split(Pattern.quote(File.pathSeparator))) {
ps.println(entry);
}
ps.flush();
}
getExiter().exit();
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"resource\"",
"}",
")",
"public",
"static",
"void",
"showClasspath",
"(",
")",
"{",
"final",
"String",
"cp",
"=",
"getCurrentClasspath",
"(",
")",
";",
"if",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"cp",
")",
... | Show the classpath of the system properties. This function never returns. | [
"Show",
"the",
"classpath",
"of",
"the",
"system",
"properties",
".",
"This",
"function",
"never",
"returns",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L695-L706 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.showVersion | public static void showVersion(boolean exit) {
try (PrintWriter logger = new PrintWriter(getConsoleLogger())) {
logger.println(MessageFormat.format(Messages.Boot_26, JanusVersion.JANUS_RELEASE_VERSION));
logger.println(MessageFormat.format(Messages.Boot_27, SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING));
logger.flush();
}
if (exit) {
getExiter().exit();
}
} | java | public static void showVersion(boolean exit) {
try (PrintWriter logger = new PrintWriter(getConsoleLogger())) {
logger.println(MessageFormat.format(Messages.Boot_26, JanusVersion.JANUS_RELEASE_VERSION));
logger.println(MessageFormat.format(Messages.Boot_27, SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING));
logger.flush();
}
if (exit) {
getExiter().exit();
}
} | [
"public",
"static",
"void",
"showVersion",
"(",
"boolean",
"exit",
")",
"{",
"try",
"(",
"PrintWriter",
"logger",
"=",
"new",
"PrintWriter",
"(",
"getConsoleLogger",
"(",
")",
")",
")",
"{",
"logger",
".",
"println",
"(",
"MessageFormat",
".",
"format",
"(... | Show the version of Janus.
@param exit if {@code true}, this function never returns. | [
"Show",
"the",
"version",
"of",
"Janus",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L713-L722 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.showCommandLineArguments | @SuppressWarnings("checkstyle:regexp")
public static void showCommandLineArguments(String[] args) {
try (PrintStream os = getConsoleLogger()) {
for (int i = 0; i < args.length; ++i) {
os.println(i + ": " //$NON-NLS-1$
+ args[i]);
}
os.flush();
} catch (Throwable e) {
e.printStackTrace();
}
getExiter().exit();
} | java | @SuppressWarnings("checkstyle:regexp")
public static void showCommandLineArguments(String[] args) {
try (PrintStream os = getConsoleLogger()) {
for (int i = 0; i < args.length; ++i) {
os.println(i + ": " //$NON-NLS-1$
+ args[i]);
}
os.flush();
} catch (Throwable e) {
e.printStackTrace();
}
getExiter().exit();
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:regexp\"",
")",
"public",
"static",
"void",
"showCommandLineArguments",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"try",
"(",
"PrintStream",
"os",
"=",
"getConsoleLogger",
"(",
")",
")",
"{",
"for",
"(",
"int",
"i... | Show the command line arguments. This function never returns.
@param args the command line arguments. | [
"Show",
"the",
"command",
"line",
"arguments",
".",
"This",
"function",
"never",
"returns",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L729-L741 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.setBootAgentTypeContextUUID | public static void setBootAgentTypeContextUUID() {
System.setProperty(JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, Boolean.TRUE.toString());
System.setProperty(JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME, Boolean.FALSE.toString());
} | java | public static void setBootAgentTypeContextUUID() {
System.setProperty(JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, Boolean.TRUE.toString());
System.setProperty(JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME, Boolean.FALSE.toString());
} | [
"public",
"static",
"void",
"setBootAgentTypeContextUUID",
"(",
")",
"{",
"System",
".",
"setProperty",
"(",
"JanusConfig",
".",
"BOOT_DEFAULT_CONTEXT_ID_NAME",
",",
"Boolean",
".",
"TRUE",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"setProperty",
"(",
... | Force the Janus platform to use a default context identifier that tis build upon the classname of the boot agent. It means
that the UUID is always the same for a given classname.
<p>This function is equivalent to the command line option <code>-B</code>.
@since 2.0.2.0
@see JanusConfig#BOOT_DEFAULT_CONTEXT_ID_NAME
@see JanusConfig#RANDOM_DEFAULT_CONTEXT_ID_NAME | [
"Force",
"the",
"Janus",
"platform",
"to",
"use",
"a",
"default",
"context",
"identifier",
"that",
"tis",
"build",
"upon",
"the",
"classname",
"of",
"the",
"boot",
"agent",
".",
"It",
"means",
"that",
"the",
"UUID",
"is",
"always",
"the",
"same",
"for",
... | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L792-L795 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.setDefaultContextUUID | public static void setDefaultContextUUID() {
System.setProperty(JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, Boolean.FALSE.toString());
System.setProperty(JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME, Boolean.FALSE.toString());
} | java | public static void setDefaultContextUUID() {
System.setProperty(JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, Boolean.FALSE.toString());
System.setProperty(JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME, Boolean.FALSE.toString());
} | [
"public",
"static",
"void",
"setDefaultContextUUID",
"(",
")",
"{",
"System",
".",
"setProperty",
"(",
"JanusConfig",
".",
"BOOT_DEFAULT_CONTEXT_ID_NAME",
",",
"Boolean",
".",
"FALSE",
".",
"toString",
"(",
")",
")",
";",
"System",
".",
"setProperty",
"(",
"Ja... | Force the Janus platform to use the identifier hard-coded in the source code for its default context.
<p>This function is equivalent to the command line option <code>-W</code>.
<p>This function must be called before launching the Janus platform.
@since 2.0.2.0
@see JanusConfig#BOOT_DEFAULT_CONTEXT_ID_NAME
@see JanusConfig#RANDOM_DEFAULT_CONTEXT_ID_NAME | [
"Force",
"the",
"Janus",
"platform",
"to",
"use",
"the",
"identifier",
"hard",
"-",
"coded",
"in",
"the",
"source",
"code",
"for",
"its",
"default",
"context",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L808-L811 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java | Utils.getSarlClassification | public static Integer getSarlClassification(ProgramElementDoc type) {
final AnnotationDesc annotation = Utils.findFirst(type.annotations(), it ->
qualifiedNameEquals(it.annotationType().qualifiedTypeName(), getKeywords().getSarlElementTypeAnnotationName()));
if (annotation != null) {
final ElementValuePair[] pairs = annotation.elementValues();
if (pairs != null && pairs.length > 0) {
return ((Number) pairs[0].value().value()).intValue();
}
}
return null;
} | java | public static Integer getSarlClassification(ProgramElementDoc type) {
final AnnotationDesc annotation = Utils.findFirst(type.annotations(), it ->
qualifiedNameEquals(it.annotationType().qualifiedTypeName(), getKeywords().getSarlElementTypeAnnotationName()));
if (annotation != null) {
final ElementValuePair[] pairs = annotation.elementValues();
if (pairs != null && pairs.length > 0) {
return ((Number) pairs[0].value().value()).intValue();
}
}
return null;
} | [
"public",
"static",
"Integer",
"getSarlClassification",
"(",
"ProgramElementDoc",
"type",
")",
"{",
"final",
"AnnotationDesc",
"annotation",
"=",
"Utils",
".",
"findFirst",
"(",
"type",
".",
"annotations",
"(",
")",
",",
"it",
"->",
"qualifiedNameEquals",
"(",
"... | Replies the SARL element type of the given type.
@param type the type.
@return the SARL element type, or {@code null} if unknown. | [
"Replies",
"the",
"SARL",
"element",
"type",
"of",
"the",
"given",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java#L269-L279 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java | Utils.fixHiddenMember | public static String fixHiddenMember(String name) {
return name.replaceAll(Pattern.quote(HIDDEN_MEMBER_CHARACTER),
Matcher.quoteReplacement(HIDDEN_MEMBER_REPLACEMENT_CHARACTER));
} | java | public static String fixHiddenMember(String name) {
return name.replaceAll(Pattern.quote(HIDDEN_MEMBER_CHARACTER),
Matcher.quoteReplacement(HIDDEN_MEMBER_REPLACEMENT_CHARACTER));
} | [
"public",
"static",
"String",
"fixHiddenMember",
"(",
"String",
"name",
")",
"{",
"return",
"name",
".",
"replaceAll",
"(",
"Pattern",
".",
"quote",
"(",
"HIDDEN_MEMBER_CHARACTER",
")",
",",
"Matcher",
".",
"quoteReplacement",
"(",
"HIDDEN_MEMBER_REPLACEMENT_CHARACT... | Replies a fixed version of the given name assuming
that it is an hidden action, and reformating
the reserved text.
<p>An hidden action is an action that is generated by the SARL
compiler, and that cannot be defined by the SARL user.
@param name the name to fix.
@return the fixed name. | [
"Replies",
"a",
"fixed",
"version",
"of",
"the",
"given",
"name",
"assuming",
"that",
"it",
"is",
"an",
"hidden",
"action",
"and",
"reformating",
"the",
"reserved",
"text",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java#L303-L306 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java | Utils.qualifiedNameEquals | public static boolean qualifiedNameEquals(String s1, String s2) {
if (isNullOrEmpty(s1)) {
return isNullOrEmpty(s2);
}
if (!s1.equals(s2)) {
final String simple1 = simpleName(s1);
final String simple2 = simpleName(s2);
return simpleNameEquals(simple1, simple2);
}
return true;
} | java | public static boolean qualifiedNameEquals(String s1, String s2) {
if (isNullOrEmpty(s1)) {
return isNullOrEmpty(s2);
}
if (!s1.equals(s2)) {
final String simple1 = simpleName(s1);
final String simple2 = simpleName(s2);
return simpleNameEquals(simple1, simple2);
}
return true;
} | [
"public",
"static",
"boolean",
"qualifiedNameEquals",
"(",
"String",
"s1",
",",
"String",
"s2",
")",
"{",
"if",
"(",
"isNullOrEmpty",
"(",
"s1",
")",
")",
"{",
"return",
"isNullOrEmpty",
"(",
"s2",
")",
";",
"}",
"if",
"(",
"!",
"s1",
".",
"equals",
... | Replies if the given qualified names are equal.
<p>Because the Javadoc tool cannot create the fully qualified name, this function
also test simple names.
@param s1 the first string.
@param s2 the first string.
@return {@code true} if the strings are equal. | [
"Replies",
"if",
"the",
"given",
"qualified",
"names",
"are",
"equal",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java#L344-L354 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java | Utils.simpleName | public static String simpleName(String name) {
if (name == null) {
return null;
}
final int index = name.lastIndexOf('.');
if (index > 0) {
return name.substring(index + 1);
}
return name;
} | java | public static String simpleName(String name) {
if (name == null) {
return null;
}
final int index = name.lastIndexOf('.');
if (index > 0) {
return name.substring(index + 1);
}
return name;
} | [
"public",
"static",
"String",
"simpleName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"int",
"index",
"=",
"name",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index... | Replies the simple name for the given name.
@param name the name.
@return the simple name. | [
"Replies",
"the",
"simple",
"name",
"for",
"the",
"given",
"name",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java#L374-L383 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java | Utils.getCause | public static Throwable getCause(Throwable thr) {
Throwable cause = thr.getCause();
while (cause != null && cause != thr && cause != cause.getCause() && cause.getCause() != null) {
cause = cause.getCause();
}
return cause == null ? thr : cause;
} | java | public static Throwable getCause(Throwable thr) {
Throwable cause = thr.getCause();
while (cause != null && cause != thr && cause != cause.getCause() && cause.getCause() != null) {
cause = cause.getCause();
}
return cause == null ? thr : cause;
} | [
"public",
"static",
"Throwable",
"getCause",
"(",
"Throwable",
"thr",
")",
"{",
"Throwable",
"cause",
"=",
"thr",
".",
"getCause",
"(",
")",
";",
"while",
"(",
"cause",
"!=",
"null",
"&&",
"cause",
"!=",
"thr",
"&&",
"cause",
"!=",
"cause",
".",
"getCa... | Replies the cause of the given exception.
@param thr the exception.
@return the cause. | [
"Replies",
"the",
"cause",
"of",
"the",
"given",
"exception",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java#L390-L396 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java | Utils.performCopy | public static void performCopy(String filename, SarlConfiguration configuration) {
if (filename.isEmpty()) {
return;
}
try {
final DocFile fromfile = DocFile.createFileForInput(configuration, filename);
final DocPath path = DocPath.create(fromfile.getName());
final DocFile toFile = DocFile.createFileForOutput(configuration, path);
if (toFile.isSameFile(fromfile)) {
return;
}
configuration.message.notice((SourcePosition) null,
"doclet.Copying_File_0_To_File_1", //$NON-NLS-1$
fromfile.toString(), path.getPath());
toFile.copyFile(fromfile);
} catch (IOException exc) {
configuration.message.error((SourcePosition) null,
"doclet.perform_copy_exception_encountered", //$NON-NLS-1$
exc.toString());
throw new DocletAbortException(exc);
}
} | java | public static void performCopy(String filename, SarlConfiguration configuration) {
if (filename.isEmpty()) {
return;
}
try {
final DocFile fromfile = DocFile.createFileForInput(configuration, filename);
final DocPath path = DocPath.create(fromfile.getName());
final DocFile toFile = DocFile.createFileForOutput(configuration, path);
if (toFile.isSameFile(fromfile)) {
return;
}
configuration.message.notice((SourcePosition) null,
"doclet.Copying_File_0_To_File_1", //$NON-NLS-1$
fromfile.toString(), path.getPath());
toFile.copyFile(fromfile);
} catch (IOException exc) {
configuration.message.error((SourcePosition) null,
"doclet.perform_copy_exception_encountered", //$NON-NLS-1$
exc.toString());
throw new DocletAbortException(exc);
}
} | [
"public",
"static",
"void",
"performCopy",
"(",
"String",
"filename",
",",
"SarlConfiguration",
"configuration",
")",
"{",
"if",
"(",
"filename",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"final",
"DocFile",
"fromfile",
"=",
"DocF... | Copy the given file.
@param filename the file to copy.
@param configuration the configuration. | [
"Copy",
"the",
"given",
"file",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java#L403-L425 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java | Utils.emptyList | public static <T> com.sun.tools.javac.util.List<T> emptyList() {
return com.sun.tools.javac.util.List.from(Collections.emptyList());
} | java | public static <T> com.sun.tools.javac.util.List<T> emptyList() {
return com.sun.tools.javac.util.List.from(Collections.emptyList());
} | [
"public",
"static",
"<",
"T",
">",
"com",
".",
"sun",
".",
"tools",
".",
"javac",
".",
"util",
".",
"List",
"<",
"T",
">",
"emptyList",
"(",
")",
"{",
"return",
"com",
".",
"sun",
".",
"tools",
".",
"javac",
".",
"util",
".",
"List",
".",
"from... | Create an empty Java list.
@param <T> the type of the elements into the list.
@return the list. | [
"Create",
"an",
"empty",
"Java",
"list",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java#L432-L434 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java | Utils.toArray | @SuppressWarnings("unchecked")
public static <T> T[] toArray(T[] source, Collection<? extends T> newContent) {
final Object array = Array.newInstance(source.getClass().getComponentType(), newContent.size());
int i = 0;
for (final T element : newContent) {
Array.set(array, i, element);
++i;
}
return (T[]) array;
} | java | @SuppressWarnings("unchecked")
public static <T> T[] toArray(T[] source, Collection<? extends T> newContent) {
final Object array = Array.newInstance(source.getClass().getComponentType(), newContent.size());
int i = 0;
for (final T element : newContent) {
Array.set(array, i, element);
++i;
}
return (T[]) array;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"toArray",
"(",
"T",
"[",
"]",
"source",
",",
"Collection",
"<",
"?",
"extends",
"T",
">",
"newContent",
")",
"{",
"final",
"Object",
"array",
"=",
... | Convert to an array.
@param <T> the type of the elements.
@param source the original array.
@param newContent the new content.
@return the new array. | [
"Convert",
"to",
"an",
"array",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java#L443-L452 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/preferences/AbstractPreferenceAccess.java | AbstractPreferenceAccess.getPreferenceStoreAccess | protected IPreferenceStoreAccess getPreferenceStoreAccess() {
if (this.preferenceStoreAccess == null) {
final Injector injector = LangActivator.getInstance().getInjector(LangActivator.IO_SARL_LANG_SARL);
this.preferenceStoreAccess = injector.getInstance(IPreferenceStoreAccess.class);
}
return this.preferenceStoreAccess;
} | java | protected IPreferenceStoreAccess getPreferenceStoreAccess() {
if (this.preferenceStoreAccess == null) {
final Injector injector = LangActivator.getInstance().getInjector(LangActivator.IO_SARL_LANG_SARL);
this.preferenceStoreAccess = injector.getInstance(IPreferenceStoreAccess.class);
}
return this.preferenceStoreAccess;
} | [
"protected",
"IPreferenceStoreAccess",
"getPreferenceStoreAccess",
"(",
")",
"{",
"if",
"(",
"this",
".",
"preferenceStoreAccess",
"==",
"null",
")",
"{",
"final",
"Injector",
"injector",
"=",
"LangActivator",
".",
"getInstance",
"(",
")",
".",
"getInjector",
"(",... | Replies the preference accessor.
@return the accessor. | [
"Replies",
"the",
"preference",
"accessor",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/preferences/AbstractPreferenceAccess.java#L59-L65 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/preferences/AbstractPreferenceAccess.java | AbstractPreferenceAccess.getWritablePreferenceStore | public IPreferenceStore getWritablePreferenceStore(Object context) {
if (this.preferenceStore == null) {
this.preferenceStore = getPreferenceStoreAccess().getWritablePreferenceStore(context);
}
return this.preferenceStore;
} | java | public IPreferenceStore getWritablePreferenceStore(Object context) {
if (this.preferenceStore == null) {
this.preferenceStore = getPreferenceStoreAccess().getWritablePreferenceStore(context);
}
return this.preferenceStore;
} | [
"public",
"IPreferenceStore",
"getWritablePreferenceStore",
"(",
"Object",
"context",
")",
"{",
"if",
"(",
"this",
".",
"preferenceStore",
"==",
"null",
")",
"{",
"this",
".",
"preferenceStore",
"=",
"getPreferenceStoreAccess",
"(",
")",
".",
"getWritablePreferenceS... | Replies the writable preference store to be used for the SARL editor.
@param context the context (project, etc.) or {@code null} if none (global preferences).
@return the modifiable preference store. | [
"Replies",
"the",
"writable",
"preference",
"store",
"to",
"be",
"used",
"for",
"the",
"SARL",
"editor",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/preferences/AbstractPreferenceAccess.java#L72-L77 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java | JanusConfig.getSystemProperty | public static String getSystemProperty(String name, String defaultValue) {
String value;
value = System.getProperty(name, null);
if (value != null) {
return value;
}
value = System.getenv(name);
if (value != null) {
return value;
}
return defaultValue;
} | java | public static String getSystemProperty(String name, String defaultValue) {
String value;
value = System.getProperty(name, null);
if (value != null) {
return value;
}
value = System.getenv(name);
if (value != null) {
return value;
}
return defaultValue;
} | [
"public",
"static",
"String",
"getSystemProperty",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
";",
"value",
"=",
"System",
".",
"getProperty",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
"... | Replies the value of the system property.
@param name
- name of the property.
@param defaultValue
- value to reply if the these is no property found
@return the value, or defaultValue. | [
"Replies",
"the",
"value",
"of",
"the",
"system",
"property",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java#L320-L331 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java | JanusConfig.getSystemPropertyAsBoolean | public static boolean getSystemPropertyAsBoolean(String name, boolean defaultValue) {
final String value = getSystemProperty(name, null);
if (value != null) {
try {
return Boolean.parseBoolean(value);
} catch (Throwable exception) {
//
}
}
return defaultValue;
} | java | public static boolean getSystemPropertyAsBoolean(String name, boolean defaultValue) {
final String value = getSystemProperty(name, null);
if (value != null) {
try {
return Boolean.parseBoolean(value);
} catch (Throwable exception) {
//
}
}
return defaultValue;
} | [
"public",
"static",
"boolean",
"getSystemPropertyAsBoolean",
"(",
"String",
"name",
",",
"boolean",
"defaultValue",
")",
"{",
"final",
"String",
"value",
"=",
"getSystemProperty",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{"... | Replies the value of the boolean system property.
@param name
- name of the property.
@param defaultValue
- value to reply if the these is no property found
@return the value, or defaultValue. | [
"Replies",
"the",
"value",
"of",
"the",
"boolean",
"system",
"property",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java#L353-L363 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java | JanusConfig.getSystemPropertyAsFloat | public static float getSystemPropertyAsFloat(String name, float defaultValue) {
final String value = getSystemProperty(name, null);
if (value != null) {
try {
return Float.parseFloat(value);
} catch (Throwable exception) {
//
}
}
return defaultValue;
} | java | public static float getSystemPropertyAsFloat(String name, float defaultValue) {
final String value = getSystemProperty(name, null);
if (value != null) {
try {
return Float.parseFloat(value);
} catch (Throwable exception) {
//
}
}
return defaultValue;
} | [
"public",
"static",
"float",
"getSystemPropertyAsFloat",
"(",
"String",
"name",
",",
"float",
"defaultValue",
")",
"{",
"final",
"String",
"value",
"=",
"getSystemProperty",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"t... | Replies the value of the single precision floating point value system property.
@param name
- name of the property.
@param defaultValue
- value to reply if the these is no property found
@return the value, or defaultValue. | [
"Replies",
"the",
"value",
"of",
"the",
"single",
"precision",
"floating",
"point",
"value",
"system",
"property",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java#L417-L427 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java | JanusConfig.getSystemPropertyAsEnum | public static <S extends Enum<S>> S getSystemPropertyAsEnum(Class<S> type, String name) {
return getSystemPropertyAsEnum(type, name, null);
} | java | public static <S extends Enum<S>> S getSystemPropertyAsEnum(Class<S> type, String name) {
return getSystemPropertyAsEnum(type, name, null);
} | [
"public",
"static",
"<",
"S",
"extends",
"Enum",
"<",
"S",
">",
">",
"S",
"getSystemPropertyAsEnum",
"(",
"Class",
"<",
"S",
">",
"type",
",",
"String",
"name",
")",
"{",
"return",
"getSystemPropertyAsEnum",
"(",
"type",
",",
"name",
",",
"null",
")",
... | Replies the value of the enumeration system property.
@param <S>
- type of the enumeration to read.
@param type
- type of the enumeration.
@param name
- name of the property.
@return the value, or <code>null</code> if no property found. | [
"Replies",
"the",
"value",
"of",
"the",
"enumeration",
"system",
"property",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java#L440-L442 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.isSarlFile | protected boolean isSarlFile(IPackageFragment packageFragment, String filename) {
if (isFileExists(packageFragment, filename, this.sarlFileExtension)) {
return true;
}
final IJavaProject project = getPackageFragmentRoot().getJavaProject();
if (project != null) {
try {
final String packageName = packageFragment.getElementName();
for (final IPackageFragmentRoot root : project.getPackageFragmentRoots()) {
final IPackageFragment fragment = root.getPackageFragment(packageName);
if (isFileExists(fragment, filename, JAVA_FILE_EXTENSION)) {
return true;
}
}
} catch (JavaModelException exception) {
// silent error
}
}
return false;
} | java | protected boolean isSarlFile(IPackageFragment packageFragment, String filename) {
if (isFileExists(packageFragment, filename, this.sarlFileExtension)) {
return true;
}
final IJavaProject project = getPackageFragmentRoot().getJavaProject();
if (project != null) {
try {
final String packageName = packageFragment.getElementName();
for (final IPackageFragmentRoot root : project.getPackageFragmentRoots()) {
final IPackageFragment fragment = root.getPackageFragment(packageName);
if (isFileExists(fragment, filename, JAVA_FILE_EXTENSION)) {
return true;
}
}
} catch (JavaModelException exception) {
// silent error
}
}
return false;
} | [
"protected",
"boolean",
"isSarlFile",
"(",
"IPackageFragment",
"packageFragment",
",",
"String",
"filename",
")",
"{",
"if",
"(",
"isFileExists",
"(",
"packageFragment",
",",
"filename",
",",
"this",
".",
"sarlFileExtension",
")",
")",
"{",
"return",
"true",
";"... | Replies if the given filename is a SARL script or a generated Java file.
@param packageFragment the package in which the file should be search for.
@param filename the filename to test.
@return <code>true</code> if a file (SALR or Java) with the given name exists. | [
"Replies",
"if",
"the",
"given",
"filename",
"is",
"a",
"SARL",
"script",
"or",
"a",
"generated",
"Java",
"file",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L347-L366 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.isFileExists | protected static boolean isFileExists(IPackageFragment packageFragment, String filename, String extension) {
if (packageFragment != null) {
final IResource resource = packageFragment.getResource();
if (resource instanceof IFolder) {
final IFolder folder = (IFolder) resource;
if (folder.getFile(filename + "." + extension).exists()) { //$NON-NLS-1$
return true;
}
}
}
return false;
} | java | protected static boolean isFileExists(IPackageFragment packageFragment, String filename, String extension) {
if (packageFragment != null) {
final IResource resource = packageFragment.getResource();
if (resource instanceof IFolder) {
final IFolder folder = (IFolder) resource;
if (folder.getFile(filename + "." + extension).exists()) { //$NON-NLS-1$
return true;
}
}
}
return false;
} | [
"protected",
"static",
"boolean",
"isFileExists",
"(",
"IPackageFragment",
"packageFragment",
",",
"String",
"filename",
",",
"String",
"extension",
")",
"{",
"if",
"(",
"packageFragment",
"!=",
"null",
")",
"{",
"final",
"IResource",
"resource",
"=",
"packageFrag... | Replies if the given filename is a SARL script in the given package.
@param packageFragment the package in which the file should be search for.
@param filename the filename to test.
@param extension the filename extension to search for.
@return <code>true</code> if a file (SARL or Java) with the given name exists. | [
"Replies",
"if",
"the",
"given",
"filename",
"is",
"a",
"SARL",
"script",
"in",
"the",
"given",
"package",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L375-L386 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.init | protected void init(IStructuredSelection selection) {
final IJavaElement elem = this.fieldInitializer.getSelectedResource(selection);
initContainerPage(elem);
initTypePage(elem);
//
try {
getRootSuperType();
reinitSuperClass();
} catch (Throwable exception) {
//
}
//
try {
getRootSuperInterface();
reinitSuperInterfaces();
} catch (Throwable exception) {
//
}
//
doStatusUpdate();
} | java | protected void init(IStructuredSelection selection) {
final IJavaElement elem = this.fieldInitializer.getSelectedResource(selection);
initContainerPage(elem);
initTypePage(elem);
//
try {
getRootSuperType();
reinitSuperClass();
} catch (Throwable exception) {
//
}
//
try {
getRootSuperInterface();
reinitSuperInterfaces();
} catch (Throwable exception) {
//
}
//
doStatusUpdate();
} | [
"protected",
"void",
"init",
"(",
"IStructuredSelection",
"selection",
")",
"{",
"final",
"IJavaElement",
"elem",
"=",
"this",
".",
"fieldInitializer",
".",
"getSelectedResource",
"(",
"selection",
")",
";",
"initContainerPage",
"(",
"elem",
")",
";",
"initTypePag... | Invoked by the wizard for initializing the page with the given selection.
@param selection the current selection. | [
"Invoked",
"by",
"the",
"wizard",
"for",
"initializing",
"the",
"page",
"with",
"the",
"given",
"selection",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L445-L465 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.createCommonControls | protected Composite createCommonControls(Composite parent) {
initializeDialogUnits(parent);
final Composite composite = SWTFactory.createComposite(
parent,
parent.getFont(),
COLUMNS, 1,
GridData.FILL_HORIZONTAL);
createContainerControls(composite, COLUMNS);
createPackageControls(composite, COLUMNS);
createSeparator(composite, COLUMNS);
createTypeNameControls(composite, COLUMNS);
return composite;
} | java | protected Composite createCommonControls(Composite parent) {
initializeDialogUnits(parent);
final Composite composite = SWTFactory.createComposite(
parent,
parent.getFont(),
COLUMNS, 1,
GridData.FILL_HORIZONTAL);
createContainerControls(composite, COLUMNS);
createPackageControls(composite, COLUMNS);
createSeparator(composite, COLUMNS);
createTypeNameControls(composite, COLUMNS);
return composite;
} | [
"protected",
"Composite",
"createCommonControls",
"(",
"Composite",
"parent",
")",
"{",
"initializeDialogUnits",
"(",
"parent",
")",
";",
"final",
"Composite",
"composite",
"=",
"SWTFactory",
".",
"createComposite",
"(",
"parent",
",",
"parent",
".",
"getFont",
"(... | Create the components that are common to the creation of all
the SARL elements.
<p>You should invoke this from the {@link #createControl(Composite)} of
the child class.
@param parent the component in which the common controls are added.
@return the created composite. | [
"Create",
"the",
"components",
"that",
"are",
"common",
"to",
"the",
"creation",
"of",
"all",
"the",
"SARL",
"elements",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L675-L687 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.asyncCreateType | protected final int asyncCreateType() {
final int[] size = {0};
final IRunnableWithProgress op = new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor)
throws CoreException, InvocationTargetException, InterruptedException {
size[0] = createSARLType(monitor);
}
};
try {
getContainer().run(true, false, op);
} catch (InterruptedException e) {
// canceled by user
return 0;
} catch (InvocationTargetException e) {
final Throwable realException = e.getTargetException();
SARLEclipsePlugin.getDefault().openError(getShell(), getTitle(),
realException.getMessage(), realException);
}
return size[0];
} | java | protected final int asyncCreateType() {
final int[] size = {0};
final IRunnableWithProgress op = new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor)
throws CoreException, InvocationTargetException, InterruptedException {
size[0] = createSARLType(monitor);
}
};
try {
getContainer().run(true, false, op);
} catch (InterruptedException e) {
// canceled by user
return 0;
} catch (InvocationTargetException e) {
final Throwable realException = e.getTargetException();
SARLEclipsePlugin.getDefault().openError(getShell(), getTitle(),
realException.getMessage(), realException);
}
return size[0];
} | [
"protected",
"final",
"int",
"asyncCreateType",
"(",
")",
"{",
"final",
"int",
"[",
"]",
"size",
"=",
"{",
"0",
"}",
";",
"final",
"IRunnableWithProgress",
"op",
"=",
"new",
"WorkspaceModifyOperation",
"(",
")",
"{",
"@",
"Override",
"protected",
"void",
"... | Create the type from the data gathered in the wizard.
@return the size of the created file. | [
"Create",
"the",
"type",
"from",
"the",
"data",
"gathered",
"in",
"the",
"wizard",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L708-L728 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.readSettings | protected void readSettings() {
boolean createConstructors = false;
boolean createUnimplemented = true;
boolean createEventHandlers = true;
boolean createLifecycleFunctions = true;
final IDialogSettings dialogSettings = getDialogSettings();
if (dialogSettings != null) {
final IDialogSettings section = dialogSettings.getSection(getName());
if (section != null) {
createConstructors = section.getBoolean(SETTINGS_CREATECONSTR);
createUnimplemented = section.getBoolean(SETTINGS_CREATEUNIMPLEMENTED);
createEventHandlers = section.getBoolean(SETTINGS_GENERATEEVENTHANDLERS);
createLifecycleFunctions = section.getBoolean(SETTINGS_GENERATELIFECYCLEFUNCTIONS);
}
}
setMethodStubSelection(createConstructors, createUnimplemented, createEventHandlers,
createLifecycleFunctions, true);
} | java | protected void readSettings() {
boolean createConstructors = false;
boolean createUnimplemented = true;
boolean createEventHandlers = true;
boolean createLifecycleFunctions = true;
final IDialogSettings dialogSettings = getDialogSettings();
if (dialogSettings != null) {
final IDialogSettings section = dialogSettings.getSection(getName());
if (section != null) {
createConstructors = section.getBoolean(SETTINGS_CREATECONSTR);
createUnimplemented = section.getBoolean(SETTINGS_CREATEUNIMPLEMENTED);
createEventHandlers = section.getBoolean(SETTINGS_GENERATEEVENTHANDLERS);
createLifecycleFunctions = section.getBoolean(SETTINGS_GENERATELIFECYCLEFUNCTIONS);
}
}
setMethodStubSelection(createConstructors, createUnimplemented, createEventHandlers,
createLifecycleFunctions, true);
} | [
"protected",
"void",
"readSettings",
"(",
")",
"{",
"boolean",
"createConstructors",
"=",
"false",
";",
"boolean",
"createUnimplemented",
"=",
"true",
";",
"boolean",
"createEventHandlers",
"=",
"true",
";",
"boolean",
"createLifecycleFunctions",
"=",
"true",
";",
... | Read the settings of the dialog box. | [
"Read",
"the",
"settings",
"of",
"the",
"dialog",
"box",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L939-L956 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.saveSettings | protected void saveSettings() {
final IDialogSettings dialogSettings = getDialogSettings();
if (dialogSettings != null) {
IDialogSettings section = dialogSettings.getSection(getName());
if (section == null) {
section = dialogSettings.addNewSection(getName());
}
section.put(SETTINGS_CREATECONSTR, isCreateConstructors());
section.put(SETTINGS_CREATEUNIMPLEMENTED, isCreateInherited());
section.put(SETTINGS_GENERATEEVENTHANDLERS, isCreateStandardEventHandlers());
section.put(SETTINGS_GENERATELIFECYCLEFUNCTIONS, isCreateStandardLifecycleFunctions());
}
} | java | protected void saveSettings() {
final IDialogSettings dialogSettings = getDialogSettings();
if (dialogSettings != null) {
IDialogSettings section = dialogSettings.getSection(getName());
if (section == null) {
section = dialogSettings.addNewSection(getName());
}
section.put(SETTINGS_CREATECONSTR, isCreateConstructors());
section.put(SETTINGS_CREATEUNIMPLEMENTED, isCreateInherited());
section.put(SETTINGS_GENERATEEVENTHANDLERS, isCreateStandardEventHandlers());
section.put(SETTINGS_GENERATELIFECYCLEFUNCTIONS, isCreateStandardLifecycleFunctions());
}
} | [
"protected",
"void",
"saveSettings",
"(",
")",
"{",
"final",
"IDialogSettings",
"dialogSettings",
"=",
"getDialogSettings",
"(",
")",
";",
"if",
"(",
"dialogSettings",
"!=",
"null",
")",
"{",
"IDialogSettings",
"section",
"=",
"dialogSettings",
".",
"getSection",
... | Save the settings of the dialog box. | [
"Save",
"the",
"settings",
"of",
"the",
"dialog",
"box",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L960-L972 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.createMethodStubControls | protected void createMethodStubControls(Composite composite, int columns,
boolean enableConstructors, boolean enableInherited, boolean defaultEvents,
boolean lifecycleFunctions) {
this.isConstructorCreationEnabled = enableConstructors;
this.isInheritedCreationEnabled = enableInherited;
this.isDefaultEventGenerated = defaultEvents;
this.isDefaultLifecycleFunctionsGenerated = lifecycleFunctions;
final List<String> nameList = new ArrayList<>(4);
if (enableConstructors) {
nameList.add(Messages.AbstractNewSarlElementWizardPage_0);
}
if (enableInherited) {
nameList.add(Messages.AbstractNewSarlElementWizardPage_1);
}
if (defaultEvents) {
nameList.add(Messages.AbstractNewSarlElementWizardPage_17);
}
if (lifecycleFunctions) {
nameList.add(Messages.AbstractNewSarlElementWizardPage_18);
}
if (nameList.isEmpty()) {
return;
}
final String[] buttonNames = new String[nameList.size()];
nameList.toArray(buttonNames);
this.methodStubsButtons = new SelectionButtonDialogFieldGroup(SWT.CHECK, buttonNames, 1);
this.methodStubsButtons.setLabelText(Messages.AbstractNewSarlElementWizardPage_2);
final Control labelControl = this.methodStubsButtons.getLabelControl(composite);
LayoutUtil.setHorizontalSpan(labelControl, columns);
DialogField.createEmptySpace(composite);
final Control buttonGroup = this.methodStubsButtons.getSelectionButtonsGroup(composite);
LayoutUtil.setHorizontalSpan(buttonGroup, columns - 1);
} | java | protected void createMethodStubControls(Composite composite, int columns,
boolean enableConstructors, boolean enableInherited, boolean defaultEvents,
boolean lifecycleFunctions) {
this.isConstructorCreationEnabled = enableConstructors;
this.isInheritedCreationEnabled = enableInherited;
this.isDefaultEventGenerated = defaultEvents;
this.isDefaultLifecycleFunctionsGenerated = lifecycleFunctions;
final List<String> nameList = new ArrayList<>(4);
if (enableConstructors) {
nameList.add(Messages.AbstractNewSarlElementWizardPage_0);
}
if (enableInherited) {
nameList.add(Messages.AbstractNewSarlElementWizardPage_1);
}
if (defaultEvents) {
nameList.add(Messages.AbstractNewSarlElementWizardPage_17);
}
if (lifecycleFunctions) {
nameList.add(Messages.AbstractNewSarlElementWizardPage_18);
}
if (nameList.isEmpty()) {
return;
}
final String[] buttonNames = new String[nameList.size()];
nameList.toArray(buttonNames);
this.methodStubsButtons = new SelectionButtonDialogFieldGroup(SWT.CHECK, buttonNames, 1);
this.methodStubsButtons.setLabelText(Messages.AbstractNewSarlElementWizardPage_2);
final Control labelControl = this.methodStubsButtons.getLabelControl(composite);
LayoutUtil.setHorizontalSpan(labelControl, columns);
DialogField.createEmptySpace(composite);
final Control buttonGroup = this.methodStubsButtons.getSelectionButtonsGroup(composite);
LayoutUtil.setHorizontalSpan(buttonGroup, columns - 1);
} | [
"protected",
"void",
"createMethodStubControls",
"(",
"Composite",
"composite",
",",
"int",
"columns",
",",
"boolean",
"enableConstructors",
",",
"boolean",
"enableInherited",
",",
"boolean",
"defaultEvents",
",",
"boolean",
"lifecycleFunctions",
")",
"{",
"this",
"."... | Create the controls related to the behavior units to generate.
@param composite the container of the controls.
@param columns the number of columns.
@param enableConstructors indicates if the constructor creation is enable.
@param enableInherited indicates if the inherited operation creation is enable.
@param defaultEvents indicates if the default events will be generated.
@param lifecycleFunctions indicates if the default lifecycle functions will be generated. | [
"Create",
"the",
"controls",
"related",
"to",
"the",
"behavior",
"units",
"to",
"generate",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L994-L1030 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.isCreateStandardEventHandlers | protected boolean isCreateStandardEventHandlers() {
int idx = 0;
if (this.isConstructorCreationEnabled) {
++idx;
}
if (this.isInheritedCreationEnabled) {
++idx;
}
return this.isDefaultEventGenerated && this.methodStubsButtons.isSelected(idx);
} | java | protected boolean isCreateStandardEventHandlers() {
int idx = 0;
if (this.isConstructorCreationEnabled) {
++idx;
}
if (this.isInheritedCreationEnabled) {
++idx;
}
return this.isDefaultEventGenerated && this.methodStubsButtons.isSelected(idx);
} | [
"protected",
"boolean",
"isCreateStandardEventHandlers",
"(",
")",
"{",
"int",
"idx",
"=",
"0",
";",
"if",
"(",
"this",
".",
"isConstructorCreationEnabled",
")",
"{",
"++",
"idx",
";",
"}",
"if",
"(",
"this",
".",
"isInheritedCreationEnabled",
")",
"{",
"++"... | Returns the current selection state of the 'Create standard event handlers'
checkbox.
@return the selection state of the 'Create standard event handlers' checkbox | [
"Returns",
"the",
"current",
"selection",
"state",
"of",
"the",
"Create",
"standard",
"event",
"handlers",
"checkbox",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L1061-L1070 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.isCreateStandardLifecycleFunctions | protected boolean isCreateStandardLifecycleFunctions() {
int idx = 0;
if (this.isConstructorCreationEnabled) {
++idx;
}
if (this.isInheritedCreationEnabled) {
++idx;
}
if (this.isDefaultEventGenerated) {
++idx;
}
return this.isDefaultLifecycleFunctionsGenerated && this.methodStubsButtons.isSelected(idx);
} | java | protected boolean isCreateStandardLifecycleFunctions() {
int idx = 0;
if (this.isConstructorCreationEnabled) {
++idx;
}
if (this.isInheritedCreationEnabled) {
++idx;
}
if (this.isDefaultEventGenerated) {
++idx;
}
return this.isDefaultLifecycleFunctionsGenerated && this.methodStubsButtons.isSelected(idx);
} | [
"protected",
"boolean",
"isCreateStandardLifecycleFunctions",
"(",
")",
"{",
"int",
"idx",
"=",
"0",
";",
"if",
"(",
"this",
".",
"isConstructorCreationEnabled",
")",
"{",
"++",
"idx",
";",
"}",
"if",
"(",
"this",
".",
"isInheritedCreationEnabled",
")",
"{",
... | Returns the current selection state of the 'Create standard lifecycle functions'
checkbox.
@return the selection state of the 'Create standard lifecycle functions' checkbox | [
"Returns",
"the",
"current",
"selection",
"state",
"of",
"the",
"Create",
"standard",
"lifecycle",
"functions",
"checkbox",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L1078-L1090 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.setMethodStubSelection | protected void setMethodStubSelection(boolean createConstructors, boolean createInherited,
boolean createEventHandlers, boolean createLifecycleFunctions, boolean canBeModified) {
if (this.methodStubsButtons != null) {
int idx = 0;
if (this.isConstructorCreationEnabled) {
this.methodStubsButtons.setSelection(idx, createConstructors);
++idx;
}
if (this.isInheritedCreationEnabled) {
this.methodStubsButtons.setSelection(idx, createInherited);
++idx;
}
if (this.isDefaultEventGenerated) {
this.methodStubsButtons.setSelection(idx, createEventHandlers);
++idx;
}
if (this.isDefaultLifecycleFunctionsGenerated) {
this.methodStubsButtons.setSelection(idx, createLifecycleFunctions);
++idx;
}
this.methodStubsButtons.setEnabled(canBeModified);
}
} | java | protected void setMethodStubSelection(boolean createConstructors, boolean createInherited,
boolean createEventHandlers, boolean createLifecycleFunctions, boolean canBeModified) {
if (this.methodStubsButtons != null) {
int idx = 0;
if (this.isConstructorCreationEnabled) {
this.methodStubsButtons.setSelection(idx, createConstructors);
++idx;
}
if (this.isInheritedCreationEnabled) {
this.methodStubsButtons.setSelection(idx, createInherited);
++idx;
}
if (this.isDefaultEventGenerated) {
this.methodStubsButtons.setSelection(idx, createEventHandlers);
++idx;
}
if (this.isDefaultLifecycleFunctionsGenerated) {
this.methodStubsButtons.setSelection(idx, createLifecycleFunctions);
++idx;
}
this.methodStubsButtons.setEnabled(canBeModified);
}
} | [
"protected",
"void",
"setMethodStubSelection",
"(",
"boolean",
"createConstructors",
",",
"boolean",
"createInherited",
",",
"boolean",
"createEventHandlers",
",",
"boolean",
"createLifecycleFunctions",
",",
"boolean",
"canBeModified",
")",
"{",
"if",
"(",
"this",
".",
... | Sets the selection state of the method stub checkboxes.
@param createConstructors initial selection state of the 'Create Constructors' checkbox.
@param createInherited initial selection state of the 'Create inherited abstract methods' checkbox.
@param createEventHandlers initial selection state of the 'Create standard event handlers' checkbox.
@param createLifecycleFunctions initial selection state of the 'Create standard lifecycle functions' checkbox.
@param canBeModified if <code>true</code> the method stub checkboxes can be changed by
the user. If <code>false</code> the buttons are "read-only" | [
"Sets",
"the",
"selection",
"state",
"of",
"the",
"method",
"stub",
"checkboxes",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L1102-L1124 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.createSuperClassSelectionDialog | @SuppressWarnings("static-method")
protected AbstractSuperTypeSelectionDialog<?> createSuperClassSelectionDialog(
Shell parent, IRunnableContext context, IJavaProject project, SarlSpecificTypeSelectionExtension extension,
boolean multi) {
return null;
} | java | @SuppressWarnings("static-method")
protected AbstractSuperTypeSelectionDialog<?> createSuperClassSelectionDialog(
Shell parent, IRunnableContext context, IJavaProject project, SarlSpecificTypeSelectionExtension extension,
boolean multi) {
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"AbstractSuperTypeSelectionDialog",
"<",
"?",
">",
"createSuperClassSelectionDialog",
"(",
"Shell",
"parent",
",",
"IRunnableContext",
"context",
",",
"IJavaProject",
"project",
",",
"SarlSpecificTypeSelec... | Create an instanceof the super-class selection dialog.
@param parent the parent.
@param context the execution context.
@param project the Java project.
@param extension the extension to give to the dialog box.
@param multi indicates if the selection could be done on multiple elements.
@return the dialog, or <code>null</code> for using the default dialog box. | [
"Create",
"an",
"instanceof",
"the",
"super",
"-",
"class",
"selection",
"dialog",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L1135-L1140 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.createStandardSARLEventTemplates | protected boolean createStandardSARLEventTemplates(String elementTypeName,
Function1<? super String, ? extends ISarlBehaviorUnitBuilder> behaviorUnitAdder,
Procedure1<? super String> usesAdder) {
if (!isCreateStandardEventHandlers()) {
return false;
}
Object type;
try {
type = getTypeFinder().findType(INITIALIZE_EVENT_NAME);
} catch (JavaModelException e) {
type = null;
}
if (type != null) {
// SARL Libraries are on the classpath
usesAdder.apply(LOGGING_CAPACITY_NAME);
ISarlBehaviorUnitBuilder unit = behaviorUnitAdder.apply(INITIALIZE_EVENT_NAME);
IBlockExpressionBuilder block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_9,
elementTypeName));
IExpressionBuilder expr = block.addExpression();
createInfoCall(expr, "The " + elementTypeName + " was started."); //$NON-NLS-1$ //$NON-NLS-2$
unit = behaviorUnitAdder.apply(DESTROY_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_10,
elementTypeName));
expr = block.addExpression();
createInfoCall(expr, "The " + elementTypeName + " was stopped."); //$NON-NLS-1$ //$NON-NLS-2$
unit = behaviorUnitAdder.apply(AGENTSPAWNED_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_11,
elementTypeName));
unit = behaviorUnitAdder.apply(AGENTKILLED_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_12,
elementTypeName));
unit = behaviorUnitAdder.apply(CONTEXTJOINED_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_13,
elementTypeName));
unit = behaviorUnitAdder.apply(CONTEXTLEFT_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_14,
elementTypeName));
unit = behaviorUnitAdder.apply(MEMBERJOINED_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_15,
elementTypeName));
unit = behaviorUnitAdder.apply(MEMBERLEFT_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_16,
elementTypeName));
return true;
}
return false;
} | java | protected boolean createStandardSARLEventTemplates(String elementTypeName,
Function1<? super String, ? extends ISarlBehaviorUnitBuilder> behaviorUnitAdder,
Procedure1<? super String> usesAdder) {
if (!isCreateStandardEventHandlers()) {
return false;
}
Object type;
try {
type = getTypeFinder().findType(INITIALIZE_EVENT_NAME);
} catch (JavaModelException e) {
type = null;
}
if (type != null) {
// SARL Libraries are on the classpath
usesAdder.apply(LOGGING_CAPACITY_NAME);
ISarlBehaviorUnitBuilder unit = behaviorUnitAdder.apply(INITIALIZE_EVENT_NAME);
IBlockExpressionBuilder block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_9,
elementTypeName));
IExpressionBuilder expr = block.addExpression();
createInfoCall(expr, "The " + elementTypeName + " was started."); //$NON-NLS-1$ //$NON-NLS-2$
unit = behaviorUnitAdder.apply(DESTROY_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_10,
elementTypeName));
expr = block.addExpression();
createInfoCall(expr, "The " + elementTypeName + " was stopped."); //$NON-NLS-1$ //$NON-NLS-2$
unit = behaviorUnitAdder.apply(AGENTSPAWNED_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_11,
elementTypeName));
unit = behaviorUnitAdder.apply(AGENTKILLED_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_12,
elementTypeName));
unit = behaviorUnitAdder.apply(CONTEXTJOINED_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_13,
elementTypeName));
unit = behaviorUnitAdder.apply(CONTEXTLEFT_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_14,
elementTypeName));
unit = behaviorUnitAdder.apply(MEMBERJOINED_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_15,
elementTypeName));
unit = behaviorUnitAdder.apply(MEMBERLEFT_EVENT_NAME);
block = unit.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_16,
elementTypeName));
return true;
}
return false;
} | [
"protected",
"boolean",
"createStandardSARLEventTemplates",
"(",
"String",
"elementTypeName",
",",
"Function1",
"<",
"?",
"super",
"String",
",",
"?",
"extends",
"ISarlBehaviorUnitBuilder",
">",
"behaviorUnitAdder",
",",
"Procedure1",
"<",
"?",
"super",
"String",
">",... | Create the default standard SARL event templates.
@param elementTypeName the name of the element type.
@param behaviorUnitAdder the adder of behavior unit.
@param usesAdder the adder of uses statement.
@return {@code true} if the units are added; {@code false} otherwise.
@since 0.5 | [
"Create",
"the",
"default",
"standard",
"SARL",
"event",
"templates",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L1214-L1286 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.createStandardSARLLifecycleFunctionTemplates | protected boolean createStandardSARLLifecycleFunctionTemplates(String elementTypeName,
Function1<? super String, ? extends ISarlActionBuilder> actionAdder,
Procedure1<? super String> usesAdder) {
if (!isCreateStandardLifecycleFunctions()) {
return false;
}
usesAdder.apply(LOGGING_CAPACITY_NAME);
ISarlActionBuilder action = actionAdder.apply(INSTALL_SKILL_NAME);
IBlockExpressionBuilder block = action.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_19,
elementTypeName));
IExpressionBuilder expr = block.addExpression();
createInfoCall(expr, "Installing the " + elementTypeName); //$NON-NLS-1$
action = actionAdder.apply(UNINSTALL_SKILL_NAME);
block = action.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_20,
elementTypeName));
expr = block.addExpression();
createInfoCall(expr, "Uninstalling the " + elementTypeName); //$NON-NLS-1$
return true;
} | java | protected boolean createStandardSARLLifecycleFunctionTemplates(String elementTypeName,
Function1<? super String, ? extends ISarlActionBuilder> actionAdder,
Procedure1<? super String> usesAdder) {
if (!isCreateStandardLifecycleFunctions()) {
return false;
}
usesAdder.apply(LOGGING_CAPACITY_NAME);
ISarlActionBuilder action = actionAdder.apply(INSTALL_SKILL_NAME);
IBlockExpressionBuilder block = action.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_19,
elementTypeName));
IExpressionBuilder expr = block.addExpression();
createInfoCall(expr, "Installing the " + elementTypeName); //$NON-NLS-1$
action = actionAdder.apply(UNINSTALL_SKILL_NAME);
block = action.getExpression();
block.setInnerDocumentation(MessageFormat.format(
Messages.AbstractNewSarlElementWizardPage_20,
elementTypeName));
expr = block.addExpression();
createInfoCall(expr, "Uninstalling the " + elementTypeName); //$NON-NLS-1$
return true;
} | [
"protected",
"boolean",
"createStandardSARLLifecycleFunctionTemplates",
"(",
"String",
"elementTypeName",
",",
"Function1",
"<",
"?",
"super",
"String",
",",
"?",
"extends",
"ISarlActionBuilder",
">",
"actionAdder",
",",
"Procedure1",
"<",
"?",
"super",
"String",
">",... | Create the default standard lifecycle function templates.
@param elementTypeName the name of the element type.
@param actionAdder the adder of actions.
@param usesAdder the adder of uses statement.
@return {@code true} if the units are added; {@code false} otherwise.
@since 0.5 | [
"Create",
"the",
"default",
"standard",
"lifecycle",
"function",
"templates",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L1296-L1322 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/compiler/ProjectAdapter.java | ProjectAdapter.getProject | public static IProject getProject(Resource resource) {
ProjectAdapter adapter = (ProjectAdapter) EcoreUtil.getAdapter(resource.getResourceSet().eAdapters(), ProjectAdapter.class);
if (adapter == null) {
final String platformString = resource.getURI().toPlatformString(true);
final IProject project = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(platformString)).getProject();
adapter = new ProjectAdapter(project);
resource.getResourceSet().eAdapters().add(adapter);
}
return adapter.getProject();
} | java | public static IProject getProject(Resource resource) {
ProjectAdapter adapter = (ProjectAdapter) EcoreUtil.getAdapter(resource.getResourceSet().eAdapters(), ProjectAdapter.class);
if (adapter == null) {
final String platformString = resource.getURI().toPlatformString(true);
final IProject project = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(platformString)).getProject();
adapter = new ProjectAdapter(project);
resource.getResourceSet().eAdapters().add(adapter);
}
return adapter.getProject();
} | [
"public",
"static",
"IProject",
"getProject",
"(",
"Resource",
"resource",
")",
"{",
"ProjectAdapter",
"adapter",
"=",
"(",
"ProjectAdapter",
")",
"EcoreUtil",
".",
"getAdapter",
"(",
"resource",
".",
"getResourceSet",
"(",
")",
".",
"eAdapters",
"(",
")",
","... | Get the project associated to the resource.
@param resource the resource
@return the project. | [
"Get",
"the",
"project",
"associated",
"to",
"the",
"resource",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/compiler/ProjectAdapter.java#L69-L78 | train |
sarl/sarl | main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/ImportMavenSarlProjectWizard.java | ImportMavenSarlProjectWizard.getMavenImportWizardPage | protected MavenImportWizardPage getMavenImportWizardPage() {
if (this.mainPageBuffer == null) {
try {
final Field field = MavenImportWizard.class.getDeclaredField("page"); //$NON-NLS-1$
field.setAccessible(true);
this.mainPageBuffer = (MavenImportWizardPage) field.get(this);
} catch (Exception exception) {
throw new RuntimeException(exception);
}
}
return this.mainPageBuffer;
} | java | protected MavenImportWizardPage getMavenImportWizardPage() {
if (this.mainPageBuffer == null) {
try {
final Field field = MavenImportWizard.class.getDeclaredField("page"); //$NON-NLS-1$
field.setAccessible(true);
this.mainPageBuffer = (MavenImportWizardPage) field.get(this);
} catch (Exception exception) {
throw new RuntimeException(exception);
}
}
return this.mainPageBuffer;
} | [
"protected",
"MavenImportWizardPage",
"getMavenImportWizardPage",
"(",
")",
"{",
"if",
"(",
"this",
".",
"mainPageBuffer",
"==",
"null",
")",
"{",
"try",
"{",
"final",
"Field",
"field",
"=",
"MavenImportWizard",
".",
"class",
".",
"getDeclaredField",
"(",
"\"pag... | Replies the main configuration page.
@return the main configuration page. | [
"Replies",
"the",
"main",
"configuration",
"page",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/ImportMavenSarlProjectWizard.java#L65-L76 | train |
sarl/sarl | main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/ImportMavenSarlProjectWizard.java | ImportMavenSarlProjectWizard.createImportJob | protected WorkspaceJob createImportJob(Collection<MavenProjectInfo> projects) {
final WorkspaceJob job = new ImportMavenSarlProjectsJob(projects, this.workingSets, this.importConfiguration);
job.setRule(MavenPlugin.getProjectConfigurationManager().getRule());
return job;
} | java | protected WorkspaceJob createImportJob(Collection<MavenProjectInfo> projects) {
final WorkspaceJob job = new ImportMavenSarlProjectsJob(projects, this.workingSets, this.importConfiguration);
job.setRule(MavenPlugin.getProjectConfigurationManager().getRule());
return job;
} | [
"protected",
"WorkspaceJob",
"createImportJob",
"(",
"Collection",
"<",
"MavenProjectInfo",
">",
"projects",
")",
"{",
"final",
"WorkspaceJob",
"job",
"=",
"new",
"ImportMavenSarlProjectsJob",
"(",
"projects",
",",
"this",
".",
"workingSets",
",",
"this",
".",
"im... | Create the import job.
@param projects the projects to import.
@return the import job. | [
"Create",
"the",
"import",
"job",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/ImportMavenSarlProjectWizard.java#L154-L158 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Utilities.java | Utilities.parseVersion | public static Version parseVersion(String version) {
if (!Strings.isNullOrEmpty(version)) {
try {
return Version.parseVersion(version);
} catch (Throwable exception) {
//
}
}
return null;
} | java | public static Version parseVersion(String version) {
if (!Strings.isNullOrEmpty(version)) {
try {
return Version.parseVersion(version);
} catch (Throwable exception) {
//
}
}
return null;
} | [
"public",
"static",
"Version",
"parseVersion",
"(",
"String",
"version",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"version",
")",
")",
"{",
"try",
"{",
"return",
"Version",
".",
"parseVersion",
"(",
"version",
")",
";",
"}",
"catch... | Null-safe version parser.
@param version the version string.
@return the version. | [
"Null",
"-",
"safe",
"version",
"parser",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Utilities.java#L62-L71 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Utilities.java | Utilities.compareVersionToRange | public static int compareVersionToRange(Version version, Version minVersion, Version maxVersion) {
assert minVersion == null || maxVersion == null || minVersion.compareTo(maxVersion) < 0;
if (version == null) {
return Integer.MIN_VALUE;
}
if (minVersion != null && compareVersionsNoQualifier(version, minVersion) < 0) {
return -1;
}
if (maxVersion != null && compareVersionsNoQualifier(version, maxVersion) >= 0) {
return 1;
}
return 0;
} | java | public static int compareVersionToRange(Version version, Version minVersion, Version maxVersion) {
assert minVersion == null || maxVersion == null || minVersion.compareTo(maxVersion) < 0;
if (version == null) {
return Integer.MIN_VALUE;
}
if (minVersion != null && compareVersionsNoQualifier(version, minVersion) < 0) {
return -1;
}
if (maxVersion != null && compareVersionsNoQualifier(version, maxVersion) >= 0) {
return 1;
}
return 0;
} | [
"public",
"static",
"int",
"compareVersionToRange",
"(",
"Version",
"version",
",",
"Version",
"minVersion",
",",
"Version",
"maxVersion",
")",
"{",
"assert",
"minVersion",
"==",
"null",
"||",
"maxVersion",
"==",
"null",
"||",
"minVersion",
".",
"compareTo",
"("... | Null-safe compare a version number to a range of version numbers.
<p>The minVersion must be strictly lower to the maxVersion. Otherwise
the behavior is not predictible.
@param version the version to compare to the range; must not be <code>null</code>.
@param minVersion the minimal version in the range (inclusive); could be <code>null</code>.
@param maxVersion the maximal version in the range (exclusive); could be <code>null</code>.
@return a negative number if the version in lower than the minVersion.
A positive number if the version is greater than or equal to the maxVersion.
<code>0</code> if the version is between minVersion and maxVersion. | [
"Null",
"-",
"safe",
"compare",
"a",
"version",
"number",
"to",
"a",
"range",
"of",
"version",
"numbers",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Utilities.java#L85-L97 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Utilities.java | Utilities.compareTo | public static <T> int compareTo(Comparable<T> object1, T object2) {
if (object1 == object2) {
return 0;
}
if (object1 == null) {
return Integer.MIN_VALUE;
}
if (object2 == null) {
return Integer.MAX_VALUE;
}
assert object1 != null && object2 != null;
return object1.compareTo(object2);
} | java | public static <T> int compareTo(Comparable<T> object1, T object2) {
if (object1 == object2) {
return 0;
}
if (object1 == null) {
return Integer.MIN_VALUE;
}
if (object2 == null) {
return Integer.MAX_VALUE;
}
assert object1 != null && object2 != null;
return object1.compareTo(object2);
} | [
"public",
"static",
"<",
"T",
">",
"int",
"compareTo",
"(",
"Comparable",
"<",
"T",
">",
"object1",
",",
"T",
"object2",
")",
"{",
"if",
"(",
"object1",
"==",
"object2",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"object1",
"==",
"null",
")",
... | Null-safe comparison.
@param <T> - type of the comparable element.
@param object1 the first object.
@param object2 the second object.
@return Negative number if a lower than b.
Positive number if a greater than b.
<code>0</code> if a is equal to b. | [
"Null",
"-",
"safe",
"comparison",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Utilities.java#L126-L138 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Utilities.java | Utilities.getNameWithTypeParameters | public static String getNameWithTypeParameters(IType type) {
assert type != null;
final String superName = type.getFullyQualifiedName('.');
if (!JavaModelUtil.is50OrHigher(type.getJavaProject())) {
return superName;
}
try {
final ITypeParameter[] typeParameters = type.getTypeParameters();
if (typeParameters != null && typeParameters.length > 0) {
final StringBuffer buf = new StringBuffer(superName);
buf.append('<');
for (int k = 0; k < typeParameters.length; ++k) {
if (k != 0) {
buf.append(',').append(' ');
}
buf.append(typeParameters[k].getElementName());
}
buf.append('>');
return buf.toString();
}
} catch (JavaModelException e) {
// ignore
}
return superName;
} | java | public static String getNameWithTypeParameters(IType type) {
assert type != null;
final String superName = type.getFullyQualifiedName('.');
if (!JavaModelUtil.is50OrHigher(type.getJavaProject())) {
return superName;
}
try {
final ITypeParameter[] typeParameters = type.getTypeParameters();
if (typeParameters != null && typeParameters.length > 0) {
final StringBuffer buf = new StringBuffer(superName);
buf.append('<');
for (int k = 0; k < typeParameters.length; ++k) {
if (k != 0) {
buf.append(',').append(' ');
}
buf.append(typeParameters[k].getElementName());
}
buf.append('>');
return buf.toString();
}
} catch (JavaModelException e) {
// ignore
}
return superName;
} | [
"public",
"static",
"String",
"getNameWithTypeParameters",
"(",
"IType",
"type",
")",
"{",
"assert",
"type",
"!=",
"null",
";",
"final",
"String",
"superName",
"=",
"type",
".",
"getFullyQualifiedName",
"(",
"'",
"'",
")",
";",
"if",
"(",
"!",
"JavaModelUtil... | Replies the fully qualified name with generic parameters.
@param type the type. Never <code>null</code>.
@return the qualified name. | [
"Replies",
"the",
"fully",
"qualified",
"name",
"with",
"generic",
"parameters",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Utilities.java#L145-L170 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Utilities.java | Utilities.newLibraryEntry | public static IClasspathEntry newLibraryEntry(Bundle bundle, IPath precomputedBundlePath, BundleURLMappings javadocURLs) {
assert bundle != null;
final IPath bundlePath;
if (precomputedBundlePath == null) {
bundlePath = BundleUtil.getBundlePath(bundle);
} else {
bundlePath = precomputedBundlePath;
}
final IPath sourceBundlePath = BundleUtil.getSourceBundlePath(bundle, bundlePath);
final IPath javadocPath = BundleUtil.getJavadocBundlePath(bundle, bundlePath);
final IClasspathAttribute[] extraAttributes;
if (javadocPath == null) {
if (javadocURLs != null) {
final String url = javadocURLs.getURLForBundle(bundle);
if (!Strings.isNullOrEmpty(url)) {
final IClasspathAttribute attr = JavaCore.newClasspathAttribute(
IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME,
url);
extraAttributes = new IClasspathAttribute[] {attr};
} else {
extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES;
}
} else {
extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES;
}
} else {
final IClasspathAttribute attr = JavaCore.newClasspathAttribute(
IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME,
javadocPath.makeAbsolute().toOSString());
extraAttributes = new IClasspathAttribute[] {attr};
}
return JavaCore.newLibraryEntry(
bundlePath,
sourceBundlePath,
null,
null,
extraAttributes,
false);
} | java | public static IClasspathEntry newLibraryEntry(Bundle bundle, IPath precomputedBundlePath, BundleURLMappings javadocURLs) {
assert bundle != null;
final IPath bundlePath;
if (precomputedBundlePath == null) {
bundlePath = BundleUtil.getBundlePath(bundle);
} else {
bundlePath = precomputedBundlePath;
}
final IPath sourceBundlePath = BundleUtil.getSourceBundlePath(bundle, bundlePath);
final IPath javadocPath = BundleUtil.getJavadocBundlePath(bundle, bundlePath);
final IClasspathAttribute[] extraAttributes;
if (javadocPath == null) {
if (javadocURLs != null) {
final String url = javadocURLs.getURLForBundle(bundle);
if (!Strings.isNullOrEmpty(url)) {
final IClasspathAttribute attr = JavaCore.newClasspathAttribute(
IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME,
url);
extraAttributes = new IClasspathAttribute[] {attr};
} else {
extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES;
}
} else {
extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES;
}
} else {
final IClasspathAttribute attr = JavaCore.newClasspathAttribute(
IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME,
javadocPath.makeAbsolute().toOSString());
extraAttributes = new IClasspathAttribute[] {attr};
}
return JavaCore.newLibraryEntry(
bundlePath,
sourceBundlePath,
null,
null,
extraAttributes,
false);
} | [
"public",
"static",
"IClasspathEntry",
"newLibraryEntry",
"(",
"Bundle",
"bundle",
",",
"IPath",
"precomputedBundlePath",
",",
"BundleURLMappings",
"javadocURLs",
")",
"{",
"assert",
"bundle",
"!=",
"null",
";",
"final",
"IPath",
"bundlePath",
";",
"if",
"(",
"pre... | Create the classpath library linked to the bundle with the given name.
@param bundle the bundle to point to. Never <code>null</code>.
@param precomputedBundlePath the path to the bundle that is already available. If <code>null</code>,
the path is computed from the bundle with {@link BundleUtil}.
@param javadocURLs the mappings from the bundle to the javadoc URL. It is used for linking the javadoc to the bundle if
the bundle platform does not know the Javadoc file. If <code>null</code>, no mapping is defined.
@return the classpath entry. | [
"Create",
"the",
"classpath",
"library",
"linked",
"to",
"the",
"bundle",
"with",
"the",
"given",
"name",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Utilities.java#L181-L221 | train |
sarl/sarl | products/sarlc/src/main/java/io/sarl/lang/sarlc/BootiqueSarlcMain.java | BootiqueSarlcMain.createRuntime | @SuppressWarnings("static-method")
protected BQRuntime createRuntime(String... args) {
SARLStandaloneSetup.doPreSetup();
final BQRuntime runtime = Bootique.app(args).autoLoadModules().createRuntime();
SARLStandaloneSetup.doPostSetup(runtime.getInstance(Injector.class));
return runtime;
} | java | @SuppressWarnings("static-method")
protected BQRuntime createRuntime(String... args) {
SARLStandaloneSetup.doPreSetup();
final BQRuntime runtime = Bootique.app(args).autoLoadModules().createRuntime();
SARLStandaloneSetup.doPostSetup(runtime.getInstance(Injector.class));
return runtime;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"BQRuntime",
"createRuntime",
"(",
"String",
"...",
"args",
")",
"{",
"SARLStandaloneSetup",
".",
"doPreSetup",
"(",
")",
";",
"final",
"BQRuntime",
"runtime",
"=",
"Bootique",
".",
"app",
"(",... | Create the compiler runtime.
@param args the command line arguments.
@return the runtime. | [
"Create",
"the",
"compiler",
"runtime",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/BootiqueSarlcMain.java#L55-L61 | train |
sarl/sarl | products/sarlc/src/main/java/io/sarl/lang/sarlc/BootiqueSarlcMain.java | BootiqueSarlcMain.runCompiler | public int runCompiler(String... args) {
try {
final BQRuntime runtime = createRuntime(args);
final CommandOutcome outcome = runtime.run();
if (!outcome.isSuccess() && outcome.getException() != null) {
Logger.getRootLogger().error(outcome.getMessage(), outcome.getException());
}
return outcome.getExitCode();
} catch (ProvisionException exception) {
final Throwable ex = Throwables.getRootCause(exception);
if (ex != null) {
Logger.getRootLogger().error(ex.getLocalizedMessage());
} else {
Logger.getRootLogger().error(exception.getLocalizedMessage());
}
} catch (Throwable exception) {
Logger.getRootLogger().error(exception.getLocalizedMessage());
}
return Constants.ERROR_CODE;
} | java | public int runCompiler(String... args) {
try {
final BQRuntime runtime = createRuntime(args);
final CommandOutcome outcome = runtime.run();
if (!outcome.isSuccess() && outcome.getException() != null) {
Logger.getRootLogger().error(outcome.getMessage(), outcome.getException());
}
return outcome.getExitCode();
} catch (ProvisionException exception) {
final Throwable ex = Throwables.getRootCause(exception);
if (ex != null) {
Logger.getRootLogger().error(ex.getLocalizedMessage());
} else {
Logger.getRootLogger().error(exception.getLocalizedMessage());
}
} catch (Throwable exception) {
Logger.getRootLogger().error(exception.getLocalizedMessage());
}
return Constants.ERROR_CODE;
} | [
"public",
"int",
"runCompiler",
"(",
"String",
"...",
"args",
")",
"{",
"try",
"{",
"final",
"BQRuntime",
"runtime",
"=",
"createRuntime",
"(",
"args",
")",
";",
"final",
"CommandOutcome",
"outcome",
"=",
"runtime",
".",
"run",
"(",
")",
";",
"if",
"(",
... | Run the batch compiler.
<p>This function runs the compiler and exits with the return code.
@param args the command line arguments.
@return the exit code. | [
"Run",
"the",
"batch",
"compiler",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/BootiqueSarlcMain.java#L70-L89 | train |
sarl/sarl | products/sarlc/src/main/java/io/sarl/lang/sarlc/BootiqueSarlcMain.java | BootiqueSarlcMain.getOptions | public List<HelpOption> getOptions() {
final BQRuntime runtime = createRuntime();
final ApplicationMetadata application = runtime.getInstance(ApplicationMetadata.class);
final HelpOptions helpOptions = new HelpOptions();
application.getCommands().forEach(c -> {
helpOptions.add(c.asOption());
c.getOptions().forEach(o -> helpOptions.add(o));
});
application.getOptions().forEach(o -> helpOptions.add(o));
return helpOptions.getOptions();
} | java | public List<HelpOption> getOptions() {
final BQRuntime runtime = createRuntime();
final ApplicationMetadata application = runtime.getInstance(ApplicationMetadata.class);
final HelpOptions helpOptions = new HelpOptions();
application.getCommands().forEach(c -> {
helpOptions.add(c.asOption());
c.getOptions().forEach(o -> helpOptions.add(o));
});
application.getOptions().forEach(o -> helpOptions.add(o));
return helpOptions.getOptions();
} | [
"public",
"List",
"<",
"HelpOption",
">",
"getOptions",
"(",
")",
"{",
"final",
"BQRuntime",
"runtime",
"=",
"createRuntime",
"(",
")",
";",
"final",
"ApplicationMetadata",
"application",
"=",
"runtime",
".",
"getInstance",
"(",
"ApplicationMetadata",
".",
"clas... | Replies the options of the program.
@return the options of the program. | [
"Replies",
"the",
"options",
"of",
"the",
"program",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/BootiqueSarlcMain.java#L95-L108 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/writers/SarlConstructorWriter.java | SarlConstructorWriter.addAnnotations | protected void addAnnotations(ExecutableMemberDoc member, Content htmlTree) {
WriterUtils.addAnnotations(member, htmlTree, this.configuration, this.writer);
} | java | protected void addAnnotations(ExecutableMemberDoc member, Content htmlTree) {
WriterUtils.addAnnotations(member, htmlTree, this.configuration, this.writer);
} | [
"protected",
"void",
"addAnnotations",
"(",
"ExecutableMemberDoc",
"member",
",",
"Content",
"htmlTree",
")",
"{",
"WriterUtils",
".",
"addAnnotations",
"(",
"member",
",",
"htmlTree",
",",
"this",
".",
"configuration",
",",
"this",
".",
"writer",
")",
";",
"}... | Add annotations, except the reserved annotations.
@param member the members.
@param htmlTree the output. | [
"Add",
"annotations",
"except",
"the",
"reserved",
"annotations",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/writers/SarlConstructorWriter.java#L82-L84 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java | SARLRuntime.setCurrentPreferenceKey | public static void setCurrentPreferenceKey(String key) {
LOCK.lock();
try {
currentPreferenceKey = (Strings.isNullOrEmpty(key)) ? DEFAULT_PREFERENCE_KEY : key;
} finally {
LOCK.unlock();
}
} | java | public static void setCurrentPreferenceKey(String key) {
LOCK.lock();
try {
currentPreferenceKey = (Strings.isNullOrEmpty(key)) ? DEFAULT_PREFERENCE_KEY : key;
} finally {
LOCK.unlock();
}
} | [
"public",
"static",
"void",
"setCurrentPreferenceKey",
"(",
"String",
"key",
")",
"{",
"LOCK",
".",
"lock",
"(",
")",
";",
"try",
"{",
"currentPreferenceKey",
"=",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"key",
")",
")",
"?",
"DEFAULT_PREFERENCE_KEY",
":"... | Change the key used for storing the SARL runtime configuration
into the preferences.
<p>If the given key is <code>null</code> or empty, the preference key
is reset to the {@link #DEFAULT_PREFERENCE_KEY}.
@param key the new key or <code>null</code>. | [
"Change",
"the",
"key",
"used",
"for",
"storing",
"the",
"SARL",
"runtime",
"configuration",
"into",
"the",
"preferences",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L154-L161 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java | SARLRuntime.fireSREChanged | public static void fireSREChanged(PropertyChangeEvent event) {
for (final Object listener : SRE_LISTENERS.getListeners()) {
((ISREInstallChangedListener) listener).sreChanged(event);
}
} | java | public static void fireSREChanged(PropertyChangeEvent event) {
for (final Object listener : SRE_LISTENERS.getListeners()) {
((ISREInstallChangedListener) listener).sreChanged(event);
}
} | [
"public",
"static",
"void",
"fireSREChanged",
"(",
"PropertyChangeEvent",
"event",
")",
"{",
"for",
"(",
"final",
"Object",
"listener",
":",
"SRE_LISTENERS",
".",
"getListeners",
"(",
")",
")",
"{",
"(",
"(",
"ISREInstallChangedListener",
")",
"listener",
")",
... | Notifies all SRE install changed listeners of the given property change.
@param event event describing the change. | [
"Notifies",
"all",
"SRE",
"install",
"changed",
"listeners",
"of",
"the",
"given",
"property",
"change",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L188-L192 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java | SARLRuntime.fireSREAdded | public static void fireSREAdded(ISREInstall installation) {
for (final Object listener : SRE_LISTENERS.getListeners()) {
((ISREInstallChangedListener) listener).sreAdded(installation);
}
} | java | public static void fireSREAdded(ISREInstall installation) {
for (final Object listener : SRE_LISTENERS.getListeners()) {
((ISREInstallChangedListener) listener).sreAdded(installation);
}
} | [
"public",
"static",
"void",
"fireSREAdded",
"(",
"ISREInstall",
"installation",
")",
"{",
"for",
"(",
"final",
"Object",
"listener",
":",
"SRE_LISTENERS",
".",
"getListeners",
"(",
")",
")",
"{",
"(",
"(",
"ISREInstallChangedListener",
")",
"listener",
")",
".... | Notifies all SRE install changed listeners of the addition of a SRE.
@param installation the installed SRE. | [
"Notifies",
"all",
"SRE",
"install",
"changed",
"listeners",
"of",
"the",
"addition",
"of",
"a",
"SRE",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L199-L203 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java | SARLRuntime.fireSRERemoved | public static void fireSRERemoved(ISREInstall installation) {
for (final Object listener : SRE_LISTENERS.getListeners()) {
((ISREInstallChangedListener) listener).sreRemoved(installation);
}
} | java | public static void fireSRERemoved(ISREInstall installation) {
for (final Object listener : SRE_LISTENERS.getListeners()) {
((ISREInstallChangedListener) listener).sreRemoved(installation);
}
} | [
"public",
"static",
"void",
"fireSRERemoved",
"(",
"ISREInstall",
"installation",
")",
"{",
"for",
"(",
"final",
"Object",
"listener",
":",
"SRE_LISTENERS",
".",
"getListeners",
"(",
")",
")",
"{",
"(",
"(",
"ISREInstallChangedListener",
")",
"listener",
")",
... | Notifies all SRE install changed listeners of the removed of a SRE.
@param installation the removed SRE. | [
"Notifies",
"all",
"SRE",
"install",
"changed",
"listeners",
"of",
"the",
"removed",
"of",
"a",
"SRE",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L210-L214 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java | SARLRuntime.getSREFromId | public static ISREInstall getSREFromId(String id) {
if (Strings.isNullOrEmpty(id)) {
return null;
}
initializeSREs();
LOCK.lock();
try {
return ALL_SRE_INSTALLS.get(id);
} finally {
LOCK.unlock();
}
} | java | public static ISREInstall getSREFromId(String id) {
if (Strings.isNullOrEmpty(id)) {
return null;
}
initializeSREs();
LOCK.lock();
try {
return ALL_SRE_INSTALLS.get(id);
} finally {
LOCK.unlock();
}
} | [
"public",
"static",
"ISREInstall",
"getSREFromId",
"(",
"String",
"id",
")",
"{",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"id",
")",
")",
"{",
"return",
"null",
";",
"}",
"initializeSREs",
"(",
")",
";",
"LOCK",
".",
"lock",
"(",
")",
";",
"... | Return the SRE corresponding to the specified Id.
@param id the id that specifies an instance of ISREInstall
@return the SRE corresponding to the specified Id, or <code>null</code>. | [
"Return",
"the",
"SRE",
"corresponding",
"to",
"the",
"specified",
"Id",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L222-L233 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java | SARLRuntime.setSREInstalls | @SuppressWarnings("checkstyle:npathcomplexity")
public static void setSREInstalls(ISREInstall[] sres, IProgressMonitor monitor) throws CoreException {
final SubMonitor mon = SubMonitor.convert(monitor,
io.sarl.eclipse.runtime.Messages.SARLRuntime_0,
sres.length * 2 + ALL_SRE_INSTALLS.size());
initializeSREs();
final String oldDefaultId;
String newDefaultId;
final List<ISREInstall> newElements = new ArrayList<>();
final Map<String, ISREInstall> allKeys;
LOCK.lock();
try {
oldDefaultId = getDefaultSREId();
newDefaultId = oldDefaultId;
allKeys = new TreeMap<>(ALL_SRE_INSTALLS);
for (final ISREInstall sre : sres) {
if (allKeys.remove(sre.getId()) == null) {
newElements.add(sre);
ALL_SRE_INSTALLS.put(sre.getId(), sre);
}
mon.worked(1);
}
for (final ISREInstall sre : allKeys.values()) {
ALL_SRE_INSTALLS.remove(sre.getId());
platformSREInstalls.remove(sre.getId());
mon.worked(1);
}
if (oldDefaultId != null && !ALL_SRE_INSTALLS.containsKey(oldDefaultId)) {
newDefaultId = null;
}
} finally {
LOCK.unlock();
}
boolean changed = false;
mon.subTask(io.sarl.eclipse.runtime.Messages.SARLRuntime_1);
if (oldDefaultId != null && newDefaultId == null) {
changed = true;
setDefaultSREInstall(null, monitor);
}
mon.worked(1);
mon.subTask(io.sarl.eclipse.runtime.Messages.SARLRuntime_2);
for (final ISREInstall sre : allKeys.values()) {
changed = true;
fireSRERemoved(sre);
}
for (final ISREInstall sre : newElements) {
changed = true;
fireSREAdded(sre);
}
mon.worked(1);
if (changed) {
saveSREConfiguration(mon.newChild(sres.length - 2));
}
} | java | @SuppressWarnings("checkstyle:npathcomplexity")
public static void setSREInstalls(ISREInstall[] sres, IProgressMonitor monitor) throws CoreException {
final SubMonitor mon = SubMonitor.convert(monitor,
io.sarl.eclipse.runtime.Messages.SARLRuntime_0,
sres.length * 2 + ALL_SRE_INSTALLS.size());
initializeSREs();
final String oldDefaultId;
String newDefaultId;
final List<ISREInstall> newElements = new ArrayList<>();
final Map<String, ISREInstall> allKeys;
LOCK.lock();
try {
oldDefaultId = getDefaultSREId();
newDefaultId = oldDefaultId;
allKeys = new TreeMap<>(ALL_SRE_INSTALLS);
for (final ISREInstall sre : sres) {
if (allKeys.remove(sre.getId()) == null) {
newElements.add(sre);
ALL_SRE_INSTALLS.put(sre.getId(), sre);
}
mon.worked(1);
}
for (final ISREInstall sre : allKeys.values()) {
ALL_SRE_INSTALLS.remove(sre.getId());
platformSREInstalls.remove(sre.getId());
mon.worked(1);
}
if (oldDefaultId != null && !ALL_SRE_INSTALLS.containsKey(oldDefaultId)) {
newDefaultId = null;
}
} finally {
LOCK.unlock();
}
boolean changed = false;
mon.subTask(io.sarl.eclipse.runtime.Messages.SARLRuntime_1);
if (oldDefaultId != null && newDefaultId == null) {
changed = true;
setDefaultSREInstall(null, monitor);
}
mon.worked(1);
mon.subTask(io.sarl.eclipse.runtime.Messages.SARLRuntime_2);
for (final ISREInstall sre : allKeys.values()) {
changed = true;
fireSRERemoved(sre);
}
for (final ISREInstall sre : newElements) {
changed = true;
fireSREAdded(sre);
}
mon.worked(1);
if (changed) {
saveSREConfiguration(mon.newChild(sres.length - 2));
}
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:npathcomplexity\"",
")",
"public",
"static",
"void",
"setSREInstalls",
"(",
"ISREInstall",
"[",
"]",
"sres",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"final",
"SubMonitor",
"mon",
"=",
"SubM... | Sets the installed SREs.
@param sres The installed SREs.
@param monitor the progress monitor to use for reporting progress to the user. It is the caller's responsibility
to call done() on the given monitor. Accepts <code>null</code>, indicating that no progress should be
reported and that the operation cannot be canceled.
@throws CoreException if trying to set the default SRE install encounters problems | [
"Sets",
"the",
"installed",
"SREs",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L281-L334 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.