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.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java
SARLProjectConfigurator.safeRefresh
@SuppressWarnings("static-method") protected void safeRefresh(IProject project, IProgressMonitor monitor) { try { project.refreshLocal(IResource.DEPTH_INFINITE, monitor); } catch (CoreException exception) { SARLEclipsePlugin.getDefault().log(exception); } }
java
@SuppressWarnings("static-method") protected void safeRefresh(IProject project, IProgressMonitor monitor) { try { project.refreshLocal(IResource.DEPTH_INFINITE, monitor); } catch (CoreException exception) { SARLEclipsePlugin.getDefault().log(exception); } }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "protected", "void", "safeRefresh", "(", "IProject", "project", ",", "IProgressMonitor", "monitor", ")", "{", "try", "{", "project", ".", "refreshLocal", "(", "IResource", ".", "DEPTH_INFINITE", ",", "monitor...
Refresh the project file hierarchy. @param project the project. @param monitor the progress monitor.
[ "Refresh", "the", "project", "file", "hierarchy", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java#L197-L204
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java
SARLProjectConfigurator.getSARLProjectSourceFolders
public static String[] getSARLProjectSourceFolders() { return new String[] { SARLConfig.FOLDER_SOURCE_SARL, SARLConfig.FOLDER_SOURCE_JAVA, SARLConfig.FOLDER_RESOURCES, SARLConfig.FOLDER_TEST_SOURCE_SARL, SARLConfig.FOLDER_SOURCE_GENERATED, SARLConfig.FOLDER_TEST_SOURCE_GENERATED, }; }
java
public static String[] getSARLProjectSourceFolders() { return new String[] { SARLConfig.FOLDER_SOURCE_SARL, SARLConfig.FOLDER_SOURCE_JAVA, SARLConfig.FOLDER_RESOURCES, SARLConfig.FOLDER_TEST_SOURCE_SARL, SARLConfig.FOLDER_SOURCE_GENERATED, SARLConfig.FOLDER_TEST_SOURCE_GENERATED, }; }
[ "public", "static", "String", "[", "]", "getSARLProjectSourceFolders", "(", ")", "{", "return", "new", "String", "[", "]", "{", "SARLConfig", ".", "FOLDER_SOURCE_SARL", ",", "SARLConfig", ".", "FOLDER_SOURCE_JAVA", ",", "SARLConfig", ".", "FOLDER_RESOURCES", ",", ...
Replies the list of the standard source folders for a SARL project. @return the list of the standard source folders. @since 0.8
[ "Replies", "the", "list", "of", "the", "standard", "source", "folders", "for", "a", "SARL", "project", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java#L211-L220
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java
SARLProjectConfigurator.configureSARLProject
public static void configureSARLProject(IProject project, boolean addNatures, boolean configureJavaNature, boolean createFolders, IProgressMonitor monitor) { try { final SubMonitor subMonitor = SubMonitor.convert(monitor, 11); // Add Natures final IStatus status = Status.OK_STATUS; if (addNatures) { addSarlNatures(project, subMonitor.newChild(1)); if (status != null && !status.isOK()) { SARLEclipsePlugin.getDefault().getLog().log(status); } } // Ensure SARL specific folders. final OutParameter<IFolder[]> sourceFolders = new OutParameter<>(); final OutParameter<IFolder[]> testSourceFolders = new OutParameter<>(); final OutParameter<IFolder[]> generationFolders = new OutParameter<>(); final OutParameter<IFolder[]> testGenerationFolders = new OutParameter<>(); final OutParameter<IFolder> generationFolder = new OutParameter<>(); final OutParameter<IFolder> outputFolder = new OutParameter<>(); final OutParameter<IFolder> testOutputFolder = new OutParameter<>(); ensureSourceFolders(project, createFolders, subMonitor, sourceFolders, testSourceFolders, generationFolders, testGenerationFolders, generationFolder, outputFolder, testOutputFolder); // SARL specific configuration SARLPreferences.setSpecificSARLConfigurationFor(project, generationFolder.get().getProjectRelativePath()); subMonitor.worked(1); // Create the Java project if (configureJavaNature) { if (!addNatures) { addNatures(project, subMonitor.newChild(1), JavaCore.NATURE_ID); } final IJavaProject javaProject = JavaCore.create(project); subMonitor.worked(1); // Build path BuildPathsBlock.flush( buildClassPathEntries(javaProject, sourceFolders.get(), testSourceFolders.get(), generationFolders.get(), testGenerationFolders.get(), testOutputFolder.get().getFullPath(), false, true), outputFolder.get().getFullPath(), javaProject, null, subMonitor.newChild(1)); } subMonitor.done(); } catch (CoreException exception) { SARLEclipsePlugin.getDefault().log(exception); } }
java
public static void configureSARLProject(IProject project, boolean addNatures, boolean configureJavaNature, boolean createFolders, IProgressMonitor monitor) { try { final SubMonitor subMonitor = SubMonitor.convert(monitor, 11); // Add Natures final IStatus status = Status.OK_STATUS; if (addNatures) { addSarlNatures(project, subMonitor.newChild(1)); if (status != null && !status.isOK()) { SARLEclipsePlugin.getDefault().getLog().log(status); } } // Ensure SARL specific folders. final OutParameter<IFolder[]> sourceFolders = new OutParameter<>(); final OutParameter<IFolder[]> testSourceFolders = new OutParameter<>(); final OutParameter<IFolder[]> generationFolders = new OutParameter<>(); final OutParameter<IFolder[]> testGenerationFolders = new OutParameter<>(); final OutParameter<IFolder> generationFolder = new OutParameter<>(); final OutParameter<IFolder> outputFolder = new OutParameter<>(); final OutParameter<IFolder> testOutputFolder = new OutParameter<>(); ensureSourceFolders(project, createFolders, subMonitor, sourceFolders, testSourceFolders, generationFolders, testGenerationFolders, generationFolder, outputFolder, testOutputFolder); // SARL specific configuration SARLPreferences.setSpecificSARLConfigurationFor(project, generationFolder.get().getProjectRelativePath()); subMonitor.worked(1); // Create the Java project if (configureJavaNature) { if (!addNatures) { addNatures(project, subMonitor.newChild(1), JavaCore.NATURE_ID); } final IJavaProject javaProject = JavaCore.create(project); subMonitor.worked(1); // Build path BuildPathsBlock.flush( buildClassPathEntries(javaProject, sourceFolders.get(), testSourceFolders.get(), generationFolders.get(), testGenerationFolders.get(), testOutputFolder.get().getFullPath(), false, true), outputFolder.get().getFullPath(), javaProject, null, subMonitor.newChild(1)); } subMonitor.done(); } catch (CoreException exception) { SARLEclipsePlugin.getDefault().log(exception); } }
[ "public", "static", "void", "configureSARLProject", "(", "IProject", "project", ",", "boolean", "addNatures", ",", "boolean", "configureJavaNature", ",", "boolean", "createFolders", ",", "IProgressMonitor", "monitor", ")", "{", "try", "{", "final", "SubMonitor", "su...
Configure the SARL project. <p>This function does the following:<ul> <li>Add the SARL nature to the project;</li> <li>Create the standard SARL folders if {@code createFolders} is evaluated to true;</li> <li>Set the output configuration of the project from the {@link SARLPreferences#setSpecificSARLConfigurationFor(IProject, IPath) general SARL configuration};</li> <li>Reset the Java configuration in order to follow the SARL configuration, if {@code configureJabvaNature} is evaluated to true.</li> </ul> @param project the project. @param addNatures indicates if the natures must be added to the project by calling {@link #addSarlNatures(IProject, IProgressMonitor)}. @param configureJavaNature indicates if the Java configuration elements must be configured. @param createFolders indicates if the folders must be created or not. @param monitor the monitor. @see #addSarlNatures(IProject, IProgressMonitor) @see #configureSARLSourceFolders(IProject, boolean, IProgressMonitor)
[ "Configure", "the", "SARL", "project", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java#L253-L309
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java
SARLProjectConfigurator.configureSARLSourceFolders
public static void configureSARLSourceFolders(IProject project, boolean createFolders, IProgressMonitor monitor) { try { final SubMonitor subMonitor = SubMonitor.convert(monitor, 8); final OutParameter<IFolder[]> sourceFolders = new OutParameter<>(); final OutParameter<IFolder[]> testSourceFolders = new OutParameter<>(); final OutParameter<IFolder[]> generationFolders = new OutParameter<>(); final OutParameter<IFolder[]> testGenerationFolders = new OutParameter<>(); final OutParameter<IFolder> testOutputFolder = new OutParameter<>(); ensureSourceFolders(project, createFolders, subMonitor, sourceFolders, testSourceFolders, generationFolders, testGenerationFolders, null, null, testOutputFolder); final IJavaProject javaProject = JavaCore.create(project); subMonitor.worked(1); // Build path BuildPathsBlock.flush( buildClassPathEntries(javaProject, sourceFolders.get(), testSourceFolders.get(), generationFolders.get(), testGenerationFolders.get(), testOutputFolder.get().getFullPath(), true, false), javaProject.getOutputLocation(), javaProject, null, subMonitor.newChild(1)); subMonitor.done(); } catch (CoreException exception) { SARLEclipsePlugin.getDefault().log(exception); } }
java
public static void configureSARLSourceFolders(IProject project, boolean createFolders, IProgressMonitor monitor) { try { final SubMonitor subMonitor = SubMonitor.convert(monitor, 8); final OutParameter<IFolder[]> sourceFolders = new OutParameter<>(); final OutParameter<IFolder[]> testSourceFolders = new OutParameter<>(); final OutParameter<IFolder[]> generationFolders = new OutParameter<>(); final OutParameter<IFolder[]> testGenerationFolders = new OutParameter<>(); final OutParameter<IFolder> testOutputFolder = new OutParameter<>(); ensureSourceFolders(project, createFolders, subMonitor, sourceFolders, testSourceFolders, generationFolders, testGenerationFolders, null, null, testOutputFolder); final IJavaProject javaProject = JavaCore.create(project); subMonitor.worked(1); // Build path BuildPathsBlock.flush( buildClassPathEntries(javaProject, sourceFolders.get(), testSourceFolders.get(), generationFolders.get(), testGenerationFolders.get(), testOutputFolder.get().getFullPath(), true, false), javaProject.getOutputLocation(), javaProject, null, subMonitor.newChild(1)); subMonitor.done(); } catch (CoreException exception) { SARLEclipsePlugin.getDefault().log(exception); } }
[ "public", "static", "void", "configureSARLSourceFolders", "(", "IProject", "project", ",", "boolean", "createFolders", ",", "IProgressMonitor", "monitor", ")", "{", "try", "{", "final", "SubMonitor", "subMonitor", "=", "SubMonitor", ".", "convert", "(", "monitor", ...
Configure the source folders for a SARL project. @param project the project. @param createFolders indicates if the folders must be created or not. @param monitor the monitor. @since 0.8 @see #addSarlNatures(IProject, IProgressMonitor) @see #configureSARLProject(IProject, boolean, boolean, boolean, IProgressMonitor)
[ "Configure", "the", "source", "folders", "for", "a", "SARL", "project", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java#L369-L403
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java
SARLProjectConfigurator.getDefaultSourceClassPathEntries
public static List<IClasspathEntry> getDefaultSourceClassPathEntries(IPath projectFolder) { final IPath srcJava = projectFolder.append( Path.fromPortableString(SARLConfig.FOLDER_SOURCE_JAVA)); final IClasspathEntry srcJavaEntry = JavaCore.newSourceEntry(srcJava.makeAbsolute()); final IPath srcSarl = projectFolder.append( Path.fromPortableString(SARLConfig.FOLDER_SOURCE_SARL)); final IClasspathEntry srcSarlEntry = JavaCore.newSourceEntry(srcSarl.makeAbsolute()); final IPath srcGeneratedSources = projectFolder.append( Path.fromPortableString(SARLConfig.FOLDER_SOURCE_GENERATED)); final IClasspathAttribute attr = JavaCore.newClasspathAttribute( IClasspathAttribute.IGNORE_OPTIONAL_PROBLEMS, Boolean.TRUE.toString()); final IClasspathEntry srcGeneratedSourcesEntry = JavaCore.newSourceEntry( srcGeneratedSources.makeAbsolute(), ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null /*output location*/, new IClasspathAttribute[] {attr}); final IPath srcResources = projectFolder.append( Path.fromPortableString(SARLConfig.FOLDER_RESOURCES)); final IClasspathEntry srcResourcesEntry = JavaCore.newSourceEntry(srcResources.makeAbsolute()); return Arrays.asList( srcSarlEntry, srcJavaEntry, srcResourcesEntry, srcGeneratedSourcesEntry); }
java
public static List<IClasspathEntry> getDefaultSourceClassPathEntries(IPath projectFolder) { final IPath srcJava = projectFolder.append( Path.fromPortableString(SARLConfig.FOLDER_SOURCE_JAVA)); final IClasspathEntry srcJavaEntry = JavaCore.newSourceEntry(srcJava.makeAbsolute()); final IPath srcSarl = projectFolder.append( Path.fromPortableString(SARLConfig.FOLDER_SOURCE_SARL)); final IClasspathEntry srcSarlEntry = JavaCore.newSourceEntry(srcSarl.makeAbsolute()); final IPath srcGeneratedSources = projectFolder.append( Path.fromPortableString(SARLConfig.FOLDER_SOURCE_GENERATED)); final IClasspathAttribute attr = JavaCore.newClasspathAttribute( IClasspathAttribute.IGNORE_OPTIONAL_PROBLEMS, Boolean.TRUE.toString()); final IClasspathEntry srcGeneratedSourcesEntry = JavaCore.newSourceEntry( srcGeneratedSources.makeAbsolute(), ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null /*output location*/, new IClasspathAttribute[] {attr}); final IPath srcResources = projectFolder.append( Path.fromPortableString(SARLConfig.FOLDER_RESOURCES)); final IClasspathEntry srcResourcesEntry = JavaCore.newSourceEntry(srcResources.makeAbsolute()); return Arrays.asList( srcSarlEntry, srcJavaEntry, srcResourcesEntry, srcGeneratedSourcesEntry); }
[ "public", "static", "List", "<", "IClasspathEntry", ">", "getDefaultSourceClassPathEntries", "(", "IPath", "projectFolder", ")", "{", "final", "IPath", "srcJava", "=", "projectFolder", ".", "append", "(", "Path", ".", "fromPortableString", "(", "SARLConfig", ".", ...
Replies the default source entries for a SARL project. @param projectFolder the folder of the project. @return the classpath entries.
[ "Replies", "the", "default", "source", "entries", "for", "a", "SARL", "project", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java#L410-L440
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java
SARLProjectConfigurator.collectProjectFoldersFromDirectory
@SuppressWarnings("checkstyle:npathcomplexity") protected void collectProjectFoldersFromDirectory(Collection<File> folders, File directory, Set<String> directoriesVisited, boolean nestedProjects, IProgressMonitor monitor) { if (monitor.isCanceled()) { return; } monitor.subTask(NLS.bind( Messages.SARLProjectConfigurator_0, directory.getPath())); final File[] contents = directory.listFiles(); if (contents == null) { return; } Set<String> visited = directoriesVisited; if (visited == null) { visited = new HashSet<>(); try { visited.add(directory.getCanonicalPath()); } catch (IOException exception) { StatusManager.getManager().handle( StatusUtil.newStatus(IStatus.ERROR, exception .getLocalizedMessage(), exception)); } } final Set<File> subdirectories = new LinkedHashSet<>(); for (final File file : contents) { if (file.isDirectory()) { subdirectories.add(file); } else if (file.getName().endsWith(this.fileExtension)) { // Found a SARL file. final File rootFile = getProjectFolderForSourceFolder(file.getParentFile()); if (rootFile != null) { folders.add(rootFile); return; } } } for (final File subdir : subdirectories) { try { final String canonicalPath = subdir.getCanonicalPath(); if (!visited.add(canonicalPath)) { // already been here --> do not recurse continue; } } catch (IOException exception) { StatusManager.getManager().handle( StatusUtil.newStatus(IStatus.ERROR, exception .getLocalizedMessage(), exception)); } collectProjectFoldersFromDirectory(folders, subdir, visited, nestedProjects, monitor); } }
java
@SuppressWarnings("checkstyle:npathcomplexity") protected void collectProjectFoldersFromDirectory(Collection<File> folders, File directory, Set<String> directoriesVisited, boolean nestedProjects, IProgressMonitor monitor) { if (monitor.isCanceled()) { return; } monitor.subTask(NLS.bind( Messages.SARLProjectConfigurator_0, directory.getPath())); final File[] contents = directory.listFiles(); if (contents == null) { return; } Set<String> visited = directoriesVisited; if (visited == null) { visited = new HashSet<>(); try { visited.add(directory.getCanonicalPath()); } catch (IOException exception) { StatusManager.getManager().handle( StatusUtil.newStatus(IStatus.ERROR, exception .getLocalizedMessage(), exception)); } } final Set<File> subdirectories = new LinkedHashSet<>(); for (final File file : contents) { if (file.isDirectory()) { subdirectories.add(file); } else if (file.getName().endsWith(this.fileExtension)) { // Found a SARL file. final File rootFile = getProjectFolderForSourceFolder(file.getParentFile()); if (rootFile != null) { folders.add(rootFile); return; } } } for (final File subdir : subdirectories) { try { final String canonicalPath = subdir.getCanonicalPath(); if (!visited.add(canonicalPath)) { // already been here --> do not recurse continue; } } catch (IOException exception) { StatusManager.getManager().handle( StatusUtil.newStatus(IStatus.ERROR, exception .getLocalizedMessage(), exception)); } collectProjectFoldersFromDirectory(folders, subdir, visited, nestedProjects, monitor); } }
[ "@", "SuppressWarnings", "(", "\"checkstyle:npathcomplexity\"", ")", "protected", "void", "collectProjectFoldersFromDirectory", "(", "Collection", "<", "File", ">", "folders", ",", "File", "directory", ",", "Set", "<", "String", ">", "directoriesVisited", ",", "boolea...
Collect the list of SARL project folders that are under directory into files. @param folders the list of folders to fill in. @param directory the directory to explore. @param directoriesVisited Set of canonical paths of directories, used as recursion guard. @param nestedProjects whether to look for nested projects. @param monitor The monitor to report to.
[ "Collect", "the", "list", "of", "SARL", "project", "folders", "that", "are", "under", "directory", "into", "files", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java#L618-L675
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java
SARLProjectConfigurator.addNatures
public static IStatus addNatures(IProject project, IProgressMonitor monitor, String... natureIdentifiers) { if (project != null && natureIdentifiers != null && natureIdentifiers.length > 0) { try { final SubMonitor subMonitor = SubMonitor.convert(monitor, natureIdentifiers.length + 2); final IProjectDescription description = project.getDescription(); final List<String> natures = new LinkedList<>(Arrays.asList(description.getNatureIds())); for (final String natureIdentifier : natureIdentifiers) { if (!Strings.isNullOrEmpty(natureIdentifier) && !natures.contains(natureIdentifier)) { natures.add(0, natureIdentifier); } subMonitor.worked(1); } final String[] newNatures = natures.toArray(new String[natures.size()]); final IStatus status = ResourcesPlugin.getWorkspace().validateNatureSet(newNatures); subMonitor.worked(1); // check the status and decide what to do if (status.getCode() == IStatus.OK) { description.setNatureIds(newNatures); project.setDescription(description, subMonitor.newChild(1)); } subMonitor.done(); return status; } catch (CoreException exception) { return SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, exception); } } return SARLEclipsePlugin.getDefault().createOkStatus(); }
java
public static IStatus addNatures(IProject project, IProgressMonitor monitor, String... natureIdentifiers) { if (project != null && natureIdentifiers != null && natureIdentifiers.length > 0) { try { final SubMonitor subMonitor = SubMonitor.convert(monitor, natureIdentifiers.length + 2); final IProjectDescription description = project.getDescription(); final List<String> natures = new LinkedList<>(Arrays.asList(description.getNatureIds())); for (final String natureIdentifier : natureIdentifiers) { if (!Strings.isNullOrEmpty(natureIdentifier) && !natures.contains(natureIdentifier)) { natures.add(0, natureIdentifier); } subMonitor.worked(1); } final String[] newNatures = natures.toArray(new String[natures.size()]); final IStatus status = ResourcesPlugin.getWorkspace().validateNatureSet(newNatures); subMonitor.worked(1); // check the status and decide what to do if (status.getCode() == IStatus.OK) { description.setNatureIds(newNatures); project.setDescription(description, subMonitor.newChild(1)); } subMonitor.done(); return status; } catch (CoreException exception) { return SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, exception); } } return SARLEclipsePlugin.getDefault().createOkStatus(); }
[ "public", "static", "IStatus", "addNatures", "(", "IProject", "project", ",", "IProgressMonitor", "monitor", ",", "String", "...", "natureIdentifiers", ")", "{", "if", "(", "project", "!=", "null", "&&", "natureIdentifiers", "!=", "null", "&&", "natureIdentifiers"...
Add the natures to the given project. @param project the project. @param monitor the monitor. @param natureIdentifiers the identifiers of the natures to add to the project. @return the status if the operation. @since 0.8
[ "Add", "the", "natures", "to", "the", "given", "project", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java#L714-L744
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java
SARLProjectConfigurator.addSarlNatures
public static IStatus addSarlNatures(IProject project, IProgressMonitor monitor) { return addNatures(project, monitor, getSarlNatures()); }
java
public static IStatus addSarlNatures(IProject project, IProgressMonitor monitor) { return addNatures(project, monitor, getSarlNatures()); }
[ "public", "static", "IStatus", "addSarlNatures", "(", "IProject", "project", ",", "IProgressMonitor", "monitor", ")", "{", "return", "addNatures", "(", "project", ",", "monitor", ",", "getSarlNatures", "(", ")", ")", ";", "}" ]
Add the SARL natures to the given project. @param project the project. @param monitor the monitor. @return the status if the operation.
[ "Add", "the", "SARL", "natures", "to", "the", "given", "project", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java#L760-L762
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java
Jdt2Ecore.getAnnotation
public IAnnotation getAnnotation(IAnnotatable element, String qualifiedName) { if (element != null) { try { final int separator = qualifiedName.lastIndexOf('.'); final String simpleName; if (separator >= 0 && separator < (qualifiedName.length() - 1)) { simpleName = qualifiedName.substring(separator + 1, qualifiedName.length()); } else { simpleName = qualifiedName; } for (final IAnnotation annotation : element.getAnnotations()) { final String name = annotation.getElementName(); if (name.equals(simpleName) || name.equals(qualifiedName)) { return annotation; } } } catch (JavaModelException e) { // } } return null; }
java
public IAnnotation getAnnotation(IAnnotatable element, String qualifiedName) { if (element != null) { try { final int separator = qualifiedName.lastIndexOf('.'); final String simpleName; if (separator >= 0 && separator < (qualifiedName.length() - 1)) { simpleName = qualifiedName.substring(separator + 1, qualifiedName.length()); } else { simpleName = qualifiedName; } for (final IAnnotation annotation : element.getAnnotations()) { final String name = annotation.getElementName(); if (name.equals(simpleName) || name.equals(qualifiedName)) { return annotation; } } } catch (JavaModelException e) { // } } return null; }
[ "public", "IAnnotation", "getAnnotation", "(", "IAnnotatable", "element", ",", "String", "qualifiedName", ")", "{", "if", "(", "element", "!=", "null", ")", "{", "try", "{", "final", "int", "separator", "=", "qualifiedName", ".", "lastIndexOf", "(", "'", "'"...
Replies the annotation with the given qualified name. @param element the annoted element. @param qualifiedName the qualified name of the element. @return the annotation, or <code>null</code> if the element is not annoted.
[ "Replies", "the", "annotation", "with", "the", "given", "qualified", "name", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java#L335-L356
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java
Jdt2Ecore.getJvmConstructor
public JvmConstructor getJvmConstructor(IMethod constructor, XtendTypeDeclaration context) throws JavaModelException { if (constructor.isConstructor()) { final JvmType type = this.typeReferences.findDeclaredType( constructor.getDeclaringType().getFullyQualifiedName(), context); if (type instanceof JvmDeclaredType) { final JvmDeclaredType declaredType = (JvmDeclaredType) type; final ActionParameterTypes jdtSignature = this.actionPrototypeProvider.createParameterTypes( Flags.isVarargs(constructor.getFlags()), getFormalParameterProvider(constructor)); for (final JvmConstructor jvmConstructor : declaredType.getDeclaredConstructors()) { final ActionParameterTypes jvmSignature = this.actionPrototypeProvider.createParameterTypesFromJvmModel( jvmConstructor.isVarArgs(), jvmConstructor.getParameters()); if (jvmSignature.equals(jdtSignature)) { return jvmConstructor; } } } } return null; }
java
public JvmConstructor getJvmConstructor(IMethod constructor, XtendTypeDeclaration context) throws JavaModelException { if (constructor.isConstructor()) { final JvmType type = this.typeReferences.findDeclaredType( constructor.getDeclaringType().getFullyQualifiedName(), context); if (type instanceof JvmDeclaredType) { final JvmDeclaredType declaredType = (JvmDeclaredType) type; final ActionParameterTypes jdtSignature = this.actionPrototypeProvider.createParameterTypes( Flags.isVarargs(constructor.getFlags()), getFormalParameterProvider(constructor)); for (final JvmConstructor jvmConstructor : declaredType.getDeclaredConstructors()) { final ActionParameterTypes jvmSignature = this.actionPrototypeProvider.createParameterTypesFromJvmModel( jvmConstructor.isVarArgs(), jvmConstructor.getParameters()); if (jvmSignature.equals(jdtSignature)) { return jvmConstructor; } } } } return null; }
[ "public", "JvmConstructor", "getJvmConstructor", "(", "IMethod", "constructor", ",", "XtendTypeDeclaration", "context", ")", "throws", "JavaModelException", "{", "if", "(", "constructor", ".", "isConstructor", "(", ")", ")", "{", "final", "JvmType", "type", "=", "...
Create the JvmConstructor for the given JDT constructor. @param constructor the JDT constructor. @param context the context of the constructor. @return the JvmConstructor @throws JavaModelException if the Java model is invalid.
[ "Create", "the", "JvmConstructor", "for", "the", "given", "JDT", "constructor", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java#L365-L387
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java
Jdt2Ecore.createFormalParametersWith
protected IFormalParameterBuilder[] createFormalParametersWith( ParameterBuilder parameterBuilder, IMethod operation) throws JavaModelException, IllegalArgumentException { final boolean isVarargs = Flags.isVarargs(operation.getFlags()); final ILocalVariable[] rawParameters = operation.getParameters(); final FormalParameterProvider parameters = getFormalParameterProvider(operation); final int len = parameters.getFormalParameterCount(); final IFormalParameterBuilder[] paramBuilders = new IFormalParameterBuilder[len]; for (int i = 0; i < len; ++i) { final ILocalVariable rawParameter = rawParameters[i]; final IAnnotation annotation = getAnnotation(rawParameter, DefaultValue.class.getName()); final String defaultValue = (annotation != null) ? extractDefaultValue(operation, annotation) : null; final boolean isV = isVarargs && i == len - 1; String type = parameters.getFormalParameterType(i, isV); if (isV && type.endsWith("[]")) { //$NON-NLS-1$ type = type.substring(0, type.length() - 2); } final IFormalParameterBuilder sarlParameter = parameterBuilder.addParameter(parameters.getFormalParameterName(i)); sarlParameter.setParameterType(type); if (defaultValue != null) { sarlParameter.getDefaultValue().setExpression(defaultValue); } if (isV) { sarlParameter.setVarArg(true); } paramBuilders[i] = sarlParameter; } return paramBuilders; }
java
protected IFormalParameterBuilder[] createFormalParametersWith( ParameterBuilder parameterBuilder, IMethod operation) throws JavaModelException, IllegalArgumentException { final boolean isVarargs = Flags.isVarargs(operation.getFlags()); final ILocalVariable[] rawParameters = operation.getParameters(); final FormalParameterProvider parameters = getFormalParameterProvider(operation); final int len = parameters.getFormalParameterCount(); final IFormalParameterBuilder[] paramBuilders = new IFormalParameterBuilder[len]; for (int i = 0; i < len; ++i) { final ILocalVariable rawParameter = rawParameters[i]; final IAnnotation annotation = getAnnotation(rawParameter, DefaultValue.class.getName()); final String defaultValue = (annotation != null) ? extractDefaultValue(operation, annotation) : null; final boolean isV = isVarargs && i == len - 1; String type = parameters.getFormalParameterType(i, isV); if (isV && type.endsWith("[]")) { //$NON-NLS-1$ type = type.substring(0, type.length() - 2); } final IFormalParameterBuilder sarlParameter = parameterBuilder.addParameter(parameters.getFormalParameterName(i)); sarlParameter.setParameterType(type); if (defaultValue != null) { sarlParameter.getDefaultValue().setExpression(defaultValue); } if (isV) { sarlParameter.setVarArg(true); } paramBuilders[i] = sarlParameter; } return paramBuilders; }
[ "protected", "IFormalParameterBuilder", "[", "]", "createFormalParametersWith", "(", "ParameterBuilder", "parameterBuilder", ",", "IMethod", "operation", ")", "throws", "JavaModelException", ",", "IllegalArgumentException", "{", "final", "boolean", "isVarargs", "=", "Flags"...
Create the formal parameters for the given operation. @param parameterBuilder the code builder. @param operation the operation that describes the formal parameters. @return the parameters. @throws JavaModelException if the Java model is invalid. @throws IllegalArgumentException if the signature is not syntactically correct.
[ "Create", "the", "formal", "parameters", "for", "the", "given", "operation", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java#L459-L487
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java
Jdt2Ecore.createStandardConstructorsWith
public void createStandardConstructorsWith( ConstructorBuilder codeBuilder, Collection<IMethod> superClassConstructors, XtendTypeDeclaration context) throws JavaModelException { if (superClassConstructors != null) { for (final IMethod constructor : superClassConstructors) { if (!isGeneratedOperation(constructor)) { final ISarlConstructorBuilder cons = codeBuilder.addConstructor(); // Create parameters final IFormalParameterBuilder[] sarlParams = createFormalParametersWith( name -> cons.addParameter(name), constructor); // Create the block final IBlockExpressionBuilder block = cons.getExpression(); // Create thre super-call expression final IExpressionBuilder superCall = block.addExpression(); final XFeatureCall call = XbaseFactory.eINSTANCE.createXFeatureCall(); superCall.setXExpression(call); // Set the todo comment. superCall.setDocumentation(block.getAutoGeneratedActionString()); // Create the super-call XExpression call.setFeature(getJvmConstructor(constructor, context)); call.setExplicitOperationCall(true); final List<XExpression> arguments = call.getFeatureCallArguments(); for (final IFormalParameterBuilder currentParam : sarlParams) { final XFeatureCall argumentSource = XbaseFactory.eINSTANCE.createXFeatureCall(); arguments.add(argumentSource); currentParam.setReferenceInto(argumentSource); } } } } }
java
public void createStandardConstructorsWith( ConstructorBuilder codeBuilder, Collection<IMethod> superClassConstructors, XtendTypeDeclaration context) throws JavaModelException { if (superClassConstructors != null) { for (final IMethod constructor : superClassConstructors) { if (!isGeneratedOperation(constructor)) { final ISarlConstructorBuilder cons = codeBuilder.addConstructor(); // Create parameters final IFormalParameterBuilder[] sarlParams = createFormalParametersWith( name -> cons.addParameter(name), constructor); // Create the block final IBlockExpressionBuilder block = cons.getExpression(); // Create thre super-call expression final IExpressionBuilder superCall = block.addExpression(); final XFeatureCall call = XbaseFactory.eINSTANCE.createXFeatureCall(); superCall.setXExpression(call); // Set the todo comment. superCall.setDocumentation(block.getAutoGeneratedActionString()); // Create the super-call XExpression call.setFeature(getJvmConstructor(constructor, context)); call.setExplicitOperationCall(true); final List<XExpression> arguments = call.getFeatureCallArguments(); for (final IFormalParameterBuilder currentParam : sarlParams) { final XFeatureCall argumentSource = XbaseFactory.eINSTANCE.createXFeatureCall(); arguments.add(argumentSource); currentParam.setReferenceInto(argumentSource); } } } } }
[ "public", "void", "createStandardConstructorsWith", "(", "ConstructorBuilder", "codeBuilder", ",", "Collection", "<", "IMethod", ">", "superClassConstructors", ",", "XtendTypeDeclaration", "context", ")", "throws", "JavaModelException", "{", "if", "(", "superClassConstructo...
Add the given constructors to the Ecore container. @param codeBuilder the code builder to use. @param superClassConstructors the constructors defined in the super class. @param context the context of the constructors. @throws JavaModelException if the Java model is invalid.
[ "Add", "the", "given", "constructors", "to", "the", "Ecore", "container", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java#L496-L527
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java
Jdt2Ecore.createActionsWith
public void createActionsWith( ActionBuilder codeBuilder, Collection<IMethod> methods, XtendTypeDeclaration context) throws JavaModelException, IllegalArgumentException { if (methods != null) { for (final IMethod operation : methods) { if (!isGeneratedOperation(operation)) { final ISarlActionBuilder action = codeBuilder.addAction(operation.getElementName()); action.setReturnType(Signature.toString(operation.getReturnType())); final IFormalParameterBuilder[] sarlParams = createFormalParametersWith( name -> action.addParameter(name), operation); if (context != null) { final JvmType type = this.typeReferences.findDeclaredType( operation.getDeclaringType().getFullyQualifiedName(), context); final JvmOperation superOperation = getJvmOperation(operation, type); // Create the block final IBlockExpressionBuilder block = action.getExpression(); if ((type.eClass() != TypesPackage.Literals.JVM_GENERIC_TYPE || !((JvmGenericType) type).isInterface()) && superOperation != null && !superOperation.isAbstract()) { // Create the super-call expression final IExpressionBuilder superCall = block.addExpression(); final XMemberFeatureCall call = XbaseFactory.eINSTANCE.createXMemberFeatureCall(); superCall.setXExpression(call); superCall.setDocumentation(block.getAutoGeneratedActionString()); call.setFeature(superOperation); call.setMemberCallTarget(superCall.createReferenceToSuper()); final List<XExpression> arguments = call.getMemberCallArguments(); for (final IFormalParameterBuilder currentParam : sarlParams) { final XFeatureCall argumentSource = XbaseFactory.eINSTANCE.createXFeatureCall(); arguments.add(argumentSource); currentParam.setReferenceInto(argumentSource); } } else { final JvmTypeReference ret = superOperation != null ? superOperation.getReturnType() : null; block.setDefaultAutoGeneratedContent( ret == null ? null : ret.getIdentifier()); } } } } } }
java
public void createActionsWith( ActionBuilder codeBuilder, Collection<IMethod> methods, XtendTypeDeclaration context) throws JavaModelException, IllegalArgumentException { if (methods != null) { for (final IMethod operation : methods) { if (!isGeneratedOperation(operation)) { final ISarlActionBuilder action = codeBuilder.addAction(operation.getElementName()); action.setReturnType(Signature.toString(operation.getReturnType())); final IFormalParameterBuilder[] sarlParams = createFormalParametersWith( name -> action.addParameter(name), operation); if (context != null) { final JvmType type = this.typeReferences.findDeclaredType( operation.getDeclaringType().getFullyQualifiedName(), context); final JvmOperation superOperation = getJvmOperation(operation, type); // Create the block final IBlockExpressionBuilder block = action.getExpression(); if ((type.eClass() != TypesPackage.Literals.JVM_GENERIC_TYPE || !((JvmGenericType) type).isInterface()) && superOperation != null && !superOperation.isAbstract()) { // Create the super-call expression final IExpressionBuilder superCall = block.addExpression(); final XMemberFeatureCall call = XbaseFactory.eINSTANCE.createXMemberFeatureCall(); superCall.setXExpression(call); superCall.setDocumentation(block.getAutoGeneratedActionString()); call.setFeature(superOperation); call.setMemberCallTarget(superCall.createReferenceToSuper()); final List<XExpression> arguments = call.getMemberCallArguments(); for (final IFormalParameterBuilder currentParam : sarlParams) { final XFeatureCall argumentSource = XbaseFactory.eINSTANCE.createXFeatureCall(); arguments.add(argumentSource); currentParam.setReferenceInto(argumentSource); } } else { final JvmTypeReference ret = superOperation != null ? superOperation.getReturnType() : null; block.setDefaultAutoGeneratedContent( ret == null ? null : ret.getIdentifier()); } } } } } }
[ "public", "void", "createActionsWith", "(", "ActionBuilder", "codeBuilder", ",", "Collection", "<", "IMethod", ">", "methods", ",", "XtendTypeDeclaration", "context", ")", "throws", "JavaModelException", ",", "IllegalArgumentException", "{", "if", "(", "methods", "!="...
Create the operations into the SARL feature container. @param codeBuilder the builder of the script. @param methods the operations to create. @param context the context of the actions. If <code>null</code>, the block of the actions are not generated. @throws JavaModelException if the Java model is invalid. @throws IllegalArgumentException if the signature is not syntactically correct.
[ "Create", "the", "operations", "into", "the", "SARL", "feature", "container", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java#L537-L581
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java
Jdt2Ecore.isSubClassOf
public boolean isSubClassOf(TypeFinder typeFinder, String subClass, String superClass) throws JavaModelException { final SuperTypeIterator typeIterator = new SuperTypeIterator(typeFinder, false, subClass); while (typeIterator.hasNext()) { final IType type = typeIterator.next(); if (Objects.equals(type.getFullyQualifiedName(), superClass)) { return true; } } return false; }
java
public boolean isSubClassOf(TypeFinder typeFinder, String subClass, String superClass) throws JavaModelException { final SuperTypeIterator typeIterator = new SuperTypeIterator(typeFinder, false, subClass); while (typeIterator.hasNext()) { final IType type = typeIterator.next(); if (Objects.equals(type.getFullyQualifiedName(), superClass)) { return true; } } return false; }
[ "public", "boolean", "isSubClassOf", "(", "TypeFinder", "typeFinder", ",", "String", "subClass", ",", "String", "superClass", ")", "throws", "JavaModelException", "{", "final", "SuperTypeIterator", "typeIterator", "=", "new", "SuperTypeIterator", "(", "typeFinder", ",...
Replies if the given type is a subclass of the second type. <p>The type finder could be obtained with {@link #toTypeFinder(IJavaProject)}. @param typeFinder the type finder to be used for finding the type definitions. @param subClass the name of the sub class. @param superClass the name of the expected super class. @return <code>true</code> if it is a subclass. @throws JavaModelException if the Java model is invalid. @see #toTypeFinder(IJavaProject)
[ "Replies", "if", "the", "given", "type", "is", "a", "subclass", "of", "the", "second", "type", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java#L594-L603
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/BehaviorUnitComparator.java
BehaviorUnitComparator.compare
public static int compare(XExpression e1, XExpression e2) { if (e1 == e2) { return 0; } if (e1 == null) { return Integer.MIN_VALUE; } if (e2 == null) { return Integer.MAX_VALUE; } return e1.toString().compareTo(e2.toString()); }
java
public static int compare(XExpression e1, XExpression e2) { if (e1 == e2) { return 0; } if (e1 == null) { return Integer.MIN_VALUE; } if (e2 == null) { return Integer.MAX_VALUE; } return e1.toString().compareTo(e2.toString()); }
[ "public", "static", "int", "compare", "(", "XExpression", "e1", ",", "XExpression", "e2", ")", "{", "if", "(", "e1", "==", "e2", ")", "{", "return", "0", ";", "}", "if", "(", "e1", "==", "null", ")", "{", "return", "Integer", ".", "MIN_VALUE", ";",...
Compare two Xtext expressions. @param e1 the first expression to compare. @param e2 the second expression to compare. @return A negative value if <code>e1</code> is lower than <code>e2</code>, a positive value if <code>e1</code> is greater than <code>e2</code>, otherwise <code>0</code>.
[ "Compare", "two", "Xtext", "expressions", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/BehaviorUnitComparator.java#L69-L80
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/config/LaunchConfigurationConfigurator.java
LaunchConfigurationConfigurator.setMainJavaClass
protected static void setMainJavaClass(ILaunchConfigurationWorkingCopy wc, String name) { wc.setAttribute( IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, name); }
java
protected static void setMainJavaClass(ILaunchConfigurationWorkingCopy wc, String name) { wc.setAttribute( IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, name); }
[ "protected", "static", "void", "setMainJavaClass", "(", "ILaunchConfigurationWorkingCopy", "wc", ",", "String", "name", ")", "{", "wc", ".", "setAttribute", "(", "IJavaLaunchConfigurationConstants", ".", "ATTR_MAIN_TYPE_NAME", ",", "name", ")", ";", "}" ]
Change the main java class within the given configuration. @param wc the configuration to change. @param name the qualified name of the main Java class. @since 0.7
[ "Change", "the", "main", "java", "class", "within", "the", "given", "configuration", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/config/LaunchConfigurationConfigurator.java#L201-L205
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/config/LaunchConfigurationConfigurator.java
LaunchConfigurationConfigurator.initLaunchConfiguration
protected ILaunchConfigurationWorkingCopy initLaunchConfiguration(String configurationType, String projectName, String id, boolean resetJavaMainClass) throws CoreException { final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); final ILaunchConfigurationType configType = launchManager.getLaunchConfigurationType(configurationType); final ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, launchManager.generateLaunchConfigurationName(id)); setProjectName(wc, projectName); setDefaultContextIdentifier(wc, null); setLaunchingFlags(wc, DEFAULT_SHOW_LOGO, DEFAULT_SHOW_LOG_INFO, DEFAULT_OFFLINE); setRuntimeConfiguration(wc, SARLRuntime.getDefaultSREInstall(), DEFAULT_USE_SYSTEM_SRE, DEFAULT_USE_PROJECT_SRE, resetJavaMainClass); JavaMigrationDelegate.updateResourceMapping(wc); return wc; }
java
protected ILaunchConfigurationWorkingCopy initLaunchConfiguration(String configurationType, String projectName, String id, boolean resetJavaMainClass) throws CoreException { final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); final ILaunchConfigurationType configType = launchManager.getLaunchConfigurationType(configurationType); final ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, launchManager.generateLaunchConfigurationName(id)); setProjectName(wc, projectName); setDefaultContextIdentifier(wc, null); setLaunchingFlags(wc, DEFAULT_SHOW_LOGO, DEFAULT_SHOW_LOG_INFO, DEFAULT_OFFLINE); setRuntimeConfiguration(wc, SARLRuntime.getDefaultSREInstall(), DEFAULT_USE_SYSTEM_SRE, DEFAULT_USE_PROJECT_SRE, resetJavaMainClass); JavaMigrationDelegate.updateResourceMapping(wc); return wc; }
[ "protected", "ILaunchConfigurationWorkingCopy", "initLaunchConfiguration", "(", "String", "configurationType", ",", "String", "projectName", ",", "String", "id", ",", "boolean", "resetJavaMainClass", ")", "throws", "CoreException", "{", "final", "ILaunchManager", "launchMan...
initialize the launch configuration. @param configurationType the name of the configuration type to create. @param projectName the name of the project. @param id the identifier of the launch configuration. @param resetJavaMainClass indicates if the JAva main class should be reset from the SRE configuration. @return the created launch configuration. @throws CoreException if the configuration cannot be created. @since 0.7
[ "initialize", "the", "launch", "configuration", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/config/LaunchConfigurationConfigurator.java#L217-L228
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/refactoring/rename/SARLFileRenameParticipant.java
SARLFileRenameParticipant.trimFileExtension
protected static String trimFileExtension(String fileName) { if (fileName.lastIndexOf('.') == -1) { return fileName; } return fileName.substring(0, fileName.lastIndexOf('.')); }
java
protected static String trimFileExtension(String fileName) { if (fileName.lastIndexOf('.') == -1) { return fileName; } return fileName.substring(0, fileName.lastIndexOf('.')); }
[ "protected", "static", "String", "trimFileExtension", "(", "String", "fileName", ")", "{", "if", "(", "fileName", ".", "lastIndexOf", "(", "'", "'", ")", "==", "-", "1", ")", "{", "return", "fileName", ";", "}", "return", "fileName", ".", "substring", "(...
Remove the file extension. @param fileName the file name. @return the file name without the extension.
[ "Remove", "the", "file", "extension", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/refactoring/rename/SARLFileRenameParticipant.java#L118-L123
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/gtk/GtkSourceViewerGenerator2.java
GtkSourceViewerGenerator2.generateMetadata
protected void generateMetadata(IXmlStyleAppendable it) { it.appendTagWithValue("property", //$NON-NLS-1$ Strings.concat(";", getMimeTypes()), //$NON-NLS-1$ "name", "mimetypes"); //$NON-NLS-1$ //$NON-NLS-2$ final StringBuilder buffer = new StringBuilder(); for (final String fileExtension : getLanguage().getFileExtensions()) { if (buffer.length() > 0) { buffer.append(";"); //$NON-NLS-1$ } buffer.append("*.").append(fileExtension); //$NON-NLS-1$ } it.appendTagWithValue("property", //$NON-NLS-1$ buffer.toString(), "name", "globs"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTagWithValue("property", //$NON-NLS-1$ "//", //$NON-NLS-1$ "name", "line-comment-start"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTagWithValue("property", //$NON-NLS-1$ "/*", //$NON-NLS-1$ "name", "block-comment-start"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTagWithValue("property", //$NON-NLS-1$ "*/", //$NON-NLS-1$ "name", "block-comment-end"); //$NON-NLS-1$ //$NON-NLS-2$ }
java
protected void generateMetadata(IXmlStyleAppendable it) { it.appendTagWithValue("property", //$NON-NLS-1$ Strings.concat(";", getMimeTypes()), //$NON-NLS-1$ "name", "mimetypes"); //$NON-NLS-1$ //$NON-NLS-2$ final StringBuilder buffer = new StringBuilder(); for (final String fileExtension : getLanguage().getFileExtensions()) { if (buffer.length() > 0) { buffer.append(";"); //$NON-NLS-1$ } buffer.append("*.").append(fileExtension); //$NON-NLS-1$ } it.appendTagWithValue("property", //$NON-NLS-1$ buffer.toString(), "name", "globs"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTagWithValue("property", //$NON-NLS-1$ "//", //$NON-NLS-1$ "name", "line-comment-start"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTagWithValue("property", //$NON-NLS-1$ "/*", //$NON-NLS-1$ "name", "block-comment-start"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTagWithValue("property", //$NON-NLS-1$ "*/", //$NON-NLS-1$ "name", "block-comment-end"); //$NON-NLS-1$ //$NON-NLS-2$ }
[ "protected", "void", "generateMetadata", "(", "IXmlStyleAppendable", "it", ")", "{", "it", ".", "appendTagWithValue", "(", "\"property\"", ",", "//$NON-NLS-1$", "Strings", ".", "concat", "(", "\";\"", ",", "getMimeTypes", "(", ")", ")", ",", "//$NON-NLS-1$", "\"...
Generate the metadata section. @param it the appendable
[ "Generate", "the", "metadata", "section", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/gtk/GtkSourceViewerGenerator2.java#L100-L127
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/gtk/GtkSourceViewerGenerator2.java
GtkSourceViewerGenerator2.generateStyles
@SuppressWarnings("static-method") protected void generateStyles(IXmlStyleAppendable it) { it.appendTag("style", //$NON-NLS-1$ "id", "comment", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Comment", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:comment"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "error", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Error", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:error"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "escaped-character", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Escaped Character", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:special-char"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "string", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "String", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:string"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "keyword", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Keyword", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:keyword"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "literal", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Literal", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:special-constant"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "number", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Number", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:number"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "operator", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Operator", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:operator"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "identifier", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Identifier", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:text"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "annotation", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Annotation", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:preprocessor"); //$NON-NLS-1$ //$NON-NLS-2$ }
java
@SuppressWarnings("static-method") protected void generateStyles(IXmlStyleAppendable it) { it.appendTag("style", //$NON-NLS-1$ "id", "comment", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Comment", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:comment"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "error", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Error", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:error"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "escaped-character", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Escaped Character", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:special-char"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "string", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "String", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:string"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "keyword", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Keyword", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:keyword"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "literal", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Literal", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:special-constant"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "number", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Number", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:number"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "operator", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Operator", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:operator"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "identifier", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Identifier", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:text"); //$NON-NLS-1$ //$NON-NLS-2$ it.appendTag("style", //$NON-NLS-1$ "id", "annotation", //$NON-NLS-1$ //$NON-NLS-2$ "_name", "Annotation", //$NON-NLS-1$ //$NON-NLS-2$ "map-to", "def:preprocessor"); //$NON-NLS-1$ //$NON-NLS-2$ }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "protected", "void", "generateStyles", "(", "IXmlStyleAppendable", "it", ")", "{", "it", ".", "appendTag", "(", "\"style\"", ",", "//$NON-NLS-1$", "\"id\"", ",", "\"comment\"", ",", "//$NON-NLS-1$ //$NON-NLS-2$",...
Generate the style section. @param it the appendable
[ "Generate", "the", "style", "section", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/gtk/GtkSourceViewerGenerator2.java#L133-L175
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/StandardSREPage.java
StandardSREPage.selectSRE
protected void selectSRE() { final File file; if (StandardSREPage.this.workingCopy.getJarFile() != null) { file = StandardSREPage.this.workingCopy.getJarFile().toFile(); } else { file = null; } final FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); dialog.setText(Messages.StandardSREPage_4); dialog.setFilterExtensions(new String[] {"*.jar"}); //$NON-NLS-1$ if (file != null && file.exists()) { dialog.setFileName(file.getAbsolutePath()); } final String selectedFile = dialog.open(); if (selectedFile != null) { final IPath path = Path.fromOSString(selectedFile); // IWorkspace workspace = ResourcesPlugin.getWorkspace(); // IPath workspaceLocation = workspace.getRoot().getLocation(); // SARLEclipsePlugin.logDebugMessage("Workspace (Path): " + workspaceLocation); //$NON-NLS-1$ // if (workspaceLocation.isPrefixOf(path)) { // SARLEclipsePlugin.logDebugMessage("Make relative path"); //$NON-NLS-1$ // path = workspaceLocation.makeRelativeTo(workspaceLocation); // } // SARLEclipsePlugin.logDebugMessage("Resolved Path (Path): " + path); //$NON-NLS-1$ // createWorkingCopy(); this.workingCopy.setJarFile(path); final IStatus status = validate(); // initializeFields(); setPageStatus(status); updatePageStatus(); } }
java
protected void selectSRE() { final File file; if (StandardSREPage.this.workingCopy.getJarFile() != null) { file = StandardSREPage.this.workingCopy.getJarFile().toFile(); } else { file = null; } final FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); dialog.setText(Messages.StandardSREPage_4); dialog.setFilterExtensions(new String[] {"*.jar"}); //$NON-NLS-1$ if (file != null && file.exists()) { dialog.setFileName(file.getAbsolutePath()); } final String selectedFile = dialog.open(); if (selectedFile != null) { final IPath path = Path.fromOSString(selectedFile); // IWorkspace workspace = ResourcesPlugin.getWorkspace(); // IPath workspaceLocation = workspace.getRoot().getLocation(); // SARLEclipsePlugin.logDebugMessage("Workspace (Path): " + workspaceLocation); //$NON-NLS-1$ // if (workspaceLocation.isPrefixOf(path)) { // SARLEclipsePlugin.logDebugMessage("Make relative path"); //$NON-NLS-1$ // path = workspaceLocation.makeRelativeTo(workspaceLocation); // } // SARLEclipsePlugin.logDebugMessage("Resolved Path (Path): " + path); //$NON-NLS-1$ // createWorkingCopy(); this.workingCopy.setJarFile(path); final IStatus status = validate(); // initializeFields(); setPageStatus(status); updatePageStatus(); } }
[ "protected", "void", "selectSRE", "(", ")", "{", "final", "File", "file", ";", "if", "(", "StandardSREPage", ".", "this", ".", "workingCopy", ".", "getJarFile", "(", ")", "!=", "null", ")", "{", "file", "=", "StandardSREPage", ".", "this", ".", "workingC...
Ask to the user to selected the SRE.
[ "Ask", "to", "the", "user", "to", "selected", "the", "SRE", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/StandardSREPage.java#L153-L187
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/StandardSREPage.java
StandardSREPage.initializeFields
private void initializeFields() { final IPath path = this.workingCopy.getJarFile(); String tooltip = null; String basename = null; if (path != null) { tooltip = path.toOSString(); final IPath tmpPath = path.removeTrailingSeparator(); if (tmpPath != null) { basename = tmpPath.lastSegment(); } } this.sreLibraryTextField.setText(Strings.nullToEmpty(basename)); this.sreLibraryTextField.setToolTipText(Strings.nullToEmpty(tooltip)); // final String name = this.workingCopy.getNameNoDefault(); this.sreNameTextField.setText(Strings.nullToEmpty(name)); // final String mainClass = this.workingCopy.getMainClass(); this.sreMainClassTextField.setText(Strings.nullToEmpty(mainClass)); // this.sreIdTextField.setText(this.workingCopy.getId()); }
java
private void initializeFields() { final IPath path = this.workingCopy.getJarFile(); String tooltip = null; String basename = null; if (path != null) { tooltip = path.toOSString(); final IPath tmpPath = path.removeTrailingSeparator(); if (tmpPath != null) { basename = tmpPath.lastSegment(); } } this.sreLibraryTextField.setText(Strings.nullToEmpty(basename)); this.sreLibraryTextField.setToolTipText(Strings.nullToEmpty(tooltip)); // final String name = this.workingCopy.getNameNoDefault(); this.sreNameTextField.setText(Strings.nullToEmpty(name)); // final String mainClass = this.workingCopy.getMainClass(); this.sreMainClassTextField.setText(Strings.nullToEmpty(mainClass)); // this.sreIdTextField.setText(this.workingCopy.getId()); }
[ "private", "void", "initializeFields", "(", ")", "{", "final", "IPath", "path", "=", "this", ".", "workingCopy", ".", "getJarFile", "(", ")", ";", "String", "tooltip", "=", "null", ";", "String", "basename", "=", "null", ";", "if", "(", "path", "!=", "...
Initialize the dialogs fields.
[ "Initialize", "the", "dialogs", "fields", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sreinstall/StandardSREPage.java#L229-L250
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/BundleUtil.java
BundleUtil.getSourceBundlePath
public static IPath getSourceBundlePath(Bundle bundle, IPath bundleLocation) { IPath sourcesPath = null; // Not an essential functionality, make it robust try { final IPath srcFolderPath = getSourceRootProjectFolderPath(bundle); if (srcFolderPath == null) { //common case, jar file. final IPath bundlesParentFolder = bundleLocation.removeLastSegments(1); final String binaryJarName = bundleLocation.lastSegment(); final String symbolicName = bundle.getSymbolicName(); final String sourceJarName = binaryJarName.replace(symbolicName, symbolicName.concat(SOURCE_SUFIX)); final IPath potentialSourceJar = bundlesParentFolder.append(sourceJarName); if (potentialSourceJar.toFile().exists()) { sourcesPath = potentialSourceJar; } } else { sourcesPath = srcFolderPath; } } catch (Throwable t) { throw new RuntimeException(t); } return sourcesPath; }
java
public static IPath getSourceBundlePath(Bundle bundle, IPath bundleLocation) { IPath sourcesPath = null; // Not an essential functionality, make it robust try { final IPath srcFolderPath = getSourceRootProjectFolderPath(bundle); if (srcFolderPath == null) { //common case, jar file. final IPath bundlesParentFolder = bundleLocation.removeLastSegments(1); final String binaryJarName = bundleLocation.lastSegment(); final String symbolicName = bundle.getSymbolicName(); final String sourceJarName = binaryJarName.replace(symbolicName, symbolicName.concat(SOURCE_SUFIX)); final IPath potentialSourceJar = bundlesParentFolder.append(sourceJarName); if (potentialSourceJar.toFile().exists()) { sourcesPath = potentialSourceJar; } } else { sourcesPath = srcFolderPath; } } catch (Throwable t) { throw new RuntimeException(t); } return sourcesPath; }
[ "public", "static", "IPath", "getSourceBundlePath", "(", "Bundle", "bundle", ",", "IPath", "bundleLocation", ")", "{", "IPath", "sourcesPath", "=", "null", ";", "// Not an essential functionality, make it robust", "try", "{", "final", "IPath", "srcFolderPath", "=", "g...
Replies the source location for the given bundle. <p>The source location is usually the root folder where the source code of the bundle is located. <p>We can't use P2Utils and we can't use SimpleConfiguratorManipulator because of API breakage between 3.5 and 4.2. So we do a bit EDV (Computer data processing) ;-) @param bundle the bundle for which the source location must be computed. @param bundleLocation the location of the bundle, as replied by {@link #getBundlePath(Bundle)}. @return the path to the source folder of the bundle, or {@code null} if undefined. @see #getBundlePath(Bundle)
[ "Replies", "the", "source", "location", "for", "the", "given", "bundle", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/BundleUtil.java#L120-L144
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/BundleUtil.java
BundleUtil.getBundlePath
public static IPath getBundlePath(Bundle bundle) { IPath path = getBinFolderPath(bundle); if (path == null) { // common jar file case, no bin folder try { path = new Path(FileLocator.getBundleFile(bundle).getAbsolutePath()); } catch (IOException e) { throw new RuntimeException(e); } } return path; }
java
public static IPath getBundlePath(Bundle bundle) { IPath path = getBinFolderPath(bundle); if (path == null) { // common jar file case, no bin folder try { path = new Path(FileLocator.getBundleFile(bundle).getAbsolutePath()); } catch (IOException e) { throw new RuntimeException(e); } } return path; }
[ "public", "static", "IPath", "getBundlePath", "(", "Bundle", "bundle", ")", "{", "IPath", "path", "=", "getBinFolderPath", "(", "bundle", ")", ";", "if", "(", "path", "==", "null", ")", "{", "// common jar file case, no bin folder", "try", "{", "path", "=", ...
Replies the path of the binary files of the given bundle. @param bundle the bundle for which the path must be retreived. @return the path to the binaries of the bundle. @see #getSourceBundlePath(Bundle, IPath)
[ "Replies", "the", "path", "of", "the", "binary", "files", "of", "the", "given", "bundle", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/BundleUtil.java#L185-L196
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/FormalParameterBuilderImpl.java
FormalParameterBuilderImpl.setReferenceInto
public void setReferenceInto(XFeatureCall container) { JvmVoid jvmVoid = this.jvmTypesFactory.createJvmVoid(); if (jvmVoid instanceof InternalEObject) { final InternalEObject jvmVoidProxy = (InternalEObject) jvmVoid; final EObject param = getSarlFormalParameter(); final Resource resource = param.eResource(); // Get the derived object final SarlFormalParameter jvmParam = getAssociatedElement(SarlFormalParameter.class, param, resource); // Set the proxy URI final URI uri = EcoreUtil2.getNormalizedURI(jvmParam); jvmVoidProxy.eSetProxyURI(uri); } container.setFeature(jvmVoid); }
java
public void setReferenceInto(XFeatureCall container) { JvmVoid jvmVoid = this.jvmTypesFactory.createJvmVoid(); if (jvmVoid instanceof InternalEObject) { final InternalEObject jvmVoidProxy = (InternalEObject) jvmVoid; final EObject param = getSarlFormalParameter(); final Resource resource = param.eResource(); // Get the derived object final SarlFormalParameter jvmParam = getAssociatedElement(SarlFormalParameter.class, param, resource); // Set the proxy URI final URI uri = EcoreUtil2.getNormalizedURI(jvmParam); jvmVoidProxy.eSetProxyURI(uri); } container.setFeature(jvmVoid); }
[ "public", "void", "setReferenceInto", "(", "XFeatureCall", "container", ")", "{", "JvmVoid", "jvmVoid", "=", "this", ".", "jvmTypesFactory", ".", "createJvmVoid", "(", ")", ";", "if", "(", "jvmVoid", "instanceof", "InternalEObject", ")", "{", "final", "InternalE...
Replies the JvmIdentifiable that corresponds to the formal parameter. @param container the feature call that is supposed to contains the replied identifiable element.
[ "Replies", "the", "JvmIdentifiable", "that", "corresponds", "to", "the", "formal", "parameter", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/FormalParameterBuilderImpl.java#L93-L106
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/FormalParameterBuilderImpl.java
FormalParameterBuilderImpl.setParameterType
public void setParameterType(String type) { String typeName; if (Strings.isEmpty(type)) { typeName = Object.class.getName(); } else { typeName = type; } this.parameter.setParameterType(newTypeRef(this.context, typeName)); }
java
public void setParameterType(String type) { String typeName; if (Strings.isEmpty(type)) { typeName = Object.class.getName(); } else { typeName = type; } this.parameter.setParameterType(newTypeRef(this.context, typeName)); }
[ "public", "void", "setParameterType", "(", "String", "type", ")", "{", "String", "typeName", ";", "if", "(", "Strings", ".", "isEmpty", "(", "type", ")", ")", "{", "typeName", "=", "Object", ".", "class", ".", "getName", "(", ")", ";", "}", "else", "...
Change the type. @param type the formal parameter type.
[ "Change", "the", "type", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/FormalParameterBuilderImpl.java#L119-L127
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/FormalParameterBuilderImpl.java
FormalParameterBuilderImpl.getDefaultValue
@Pure public IExpressionBuilder getDefaultValue() { if (this.defaultValue == null) { this.defaultValue = this.expressionProvider.get(); this.defaultValue.eInit(this.parameter, new Procedures.Procedure1<XExpression>() { public void apply(XExpression it) { getSarlFormalParameter().setDefaultValue(it); } }, getTypeResolutionContext()); } return this.defaultValue; }
java
@Pure public IExpressionBuilder getDefaultValue() { if (this.defaultValue == null) { this.defaultValue = this.expressionProvider.get(); this.defaultValue.eInit(this.parameter, new Procedures.Procedure1<XExpression>() { public void apply(XExpression it) { getSarlFormalParameter().setDefaultValue(it); } }, getTypeResolutionContext()); } return this.defaultValue; }
[ "@", "Pure", "public", "IExpressionBuilder", "getDefaultValue", "(", ")", "{", "if", "(", "this", ".", "defaultValue", "==", "null", ")", "{", "this", ".", "defaultValue", "=", "this", ".", "expressionProvider", ".", "get", "(", ")", ";", "this", ".", "d...
Replies the default value of the parameter. @return the default value builder.
[ "Replies", "the", "default", "value", "of", "the", "parameter", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/FormalParameterBuilderImpl.java#L140-L151
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLAnnotationUtil.java
SARLAnnotationUtil.findAnnotation
@SuppressWarnings("static-method") public JvmAnnotationReference findAnnotation(JvmAnnotationTarget annotationTarget, String lookupType) { // avoid creating an empty list for all given targets but check for #eIsSet first if (annotationTarget.eIsSet(TypesPackage.Literals.JVM_ANNOTATION_TARGET__ANNOTATIONS)) { for (final JvmAnnotationReference annotation: annotationTarget.getAnnotations()) { final JvmAnnotationType annotationType = annotation.getAnnotation(); if (annotationType != null && Objects.equals(lookupType, annotationType.getQualifiedName())) { return annotation; } } } return null; }
java
@SuppressWarnings("static-method") public JvmAnnotationReference findAnnotation(JvmAnnotationTarget annotationTarget, String lookupType) { // avoid creating an empty list for all given targets but check for #eIsSet first if (annotationTarget.eIsSet(TypesPackage.Literals.JVM_ANNOTATION_TARGET__ANNOTATIONS)) { for (final JvmAnnotationReference annotation: annotationTarget.getAnnotations()) { final JvmAnnotationType annotationType = annotation.getAnnotation(); if (annotationType != null && Objects.equals(lookupType, annotationType.getQualifiedName())) { return annotation; } } } return null; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "public", "JvmAnnotationReference", "findAnnotation", "(", "JvmAnnotationTarget", "annotationTarget", ",", "String", "lookupType", ")", "{", "// avoid creating an empty list for all given targets but check for #eIsSet first", ...
Find an annotation. @param annotationTarget the annotation target. @param lookupType the name of the type to look for. @return the annotation or {@code null}. @see AnnotationLookup#findAnnotation(JvmAnnotationTarget, Class)
[ "Find", "an", "annotation", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLAnnotationUtil.java#L251-L263
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/DynamicValidationContext.java
DynamicValidationContext.getTempResourceRoots
public List<String> getTempResourceRoots() { final List<String> tmp = this.tmpResources == null ? Collections.emptyList() : this.tmpResources; this.tmpResources = null; return tmp; }
java
public List<String> getTempResourceRoots() { final List<String> tmp = this.tmpResources == null ? Collections.emptyList() : this.tmpResources; this.tmpResources = null; return tmp; }
[ "public", "List", "<", "String", ">", "getTempResourceRoots", "(", ")", "{", "final", "List", "<", "String", ">", "tmp", "=", "this", ".", "tmpResources", "==", "null", "?", "Collections", ".", "emptyList", "(", ")", ":", "this", ".", "tmpResources", ";"...
Replies the temprary root folders for resources. <p>The temporary resources are forgiven as soon as this function is called. @return the root folders.
[ "Replies", "the", "temprary", "root", "folders", "for", "resources", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/DynamicValidationContext.java#L133-L137
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/ScriptBuilderFragment.java
ScriptBuilderFragment.generateTopElement
@SuppressWarnings("checkstyle:all") protected StringConcatenationClient generateTopElement(CodeElementExtractor.ElementDescription description, boolean forInterface, boolean forAppender) { final String topElementName = Strings.toFirstUpper(description.getName()); final TypeReference builderType = getCodeElementExtractor().getElementBuilderInterface(topElementName); return new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { if (!forInterface && !forAppender) { it.append("\t@"); //$NON-NLS-1$ it.append(Inject.class); it.newLine(); it.append("\tprivate "); //$NON-NLS-1$ it.append(Provider.class); it.append("<"); //$NON-NLS-1$ it.append(builderType); it.append("> "); //$NON-NLS-1$ it.append(Strings.toFirstLower(topElementName)); it.append("Provider;"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); } it.append("\t/** Create " + getAorAnArticle(topElementName) //$NON-NLS-1$ + " "+ topElementName + " builder."); //$NON-NLS-1$//$NON-NLS-2$ it.newLine(); it.append("\t * @param name the name of the " + topElementName + "."); //$NON-NLS-1$ //$NON-NLS-2$ it.newLine(); it.append("\t * @return the builder."); //$NON-NLS-1$ it.newLine(); it.append("\t */"); //$NON-NLS-1$ it.newLine(); it.append("\t"); //$NON-NLS-1$ if (!forInterface) { it.append("public "); //$NON-NLS-1$ } it.append(builderType); it.append(" add"); //$NON-NLS-1$ it.append(topElementName); it.append("(String name)"); //$NON-NLS-1$ if (forInterface) { it.append(";"); //$NON-NLS-1$ it.newLineIfNotEmpty(); } else { it.append(" {"); //$NON-NLS-1$ it.newLine(); if (forAppender) { it.append("\t\t return this.builder.add"); //$NON-NLS-1$ it.append(topElementName); it.append("(name);"); //$NON-NLS-1$ } else { it.append("\t\t"); //$NON-NLS-1$ it.append(builderType); it.append(" builder = this."); //$NON-NLS-1$ it.append(Strings.toFirstLower(topElementName)); it.append("Provider.get();"); //$NON-NLS-1$ it.newLine(); it.append("\t\tbuilder.eInit(getScript(), name, getTypeResolutionContext());"); //$NON-NLS-1$ it.newLine(); it.append("\t\treturn builder;"); //$NON-NLS-1$ } it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); } it.newLine(); } }; }
java
@SuppressWarnings("checkstyle:all") protected StringConcatenationClient generateTopElement(CodeElementExtractor.ElementDescription description, boolean forInterface, boolean forAppender) { final String topElementName = Strings.toFirstUpper(description.getName()); final TypeReference builderType = getCodeElementExtractor().getElementBuilderInterface(topElementName); return new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { if (!forInterface && !forAppender) { it.append("\t@"); //$NON-NLS-1$ it.append(Inject.class); it.newLine(); it.append("\tprivate "); //$NON-NLS-1$ it.append(Provider.class); it.append("<"); //$NON-NLS-1$ it.append(builderType); it.append("> "); //$NON-NLS-1$ it.append(Strings.toFirstLower(topElementName)); it.append("Provider;"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); } it.append("\t/** Create " + getAorAnArticle(topElementName) //$NON-NLS-1$ + " "+ topElementName + " builder."); //$NON-NLS-1$//$NON-NLS-2$ it.newLine(); it.append("\t * @param name the name of the " + topElementName + "."); //$NON-NLS-1$ //$NON-NLS-2$ it.newLine(); it.append("\t * @return the builder."); //$NON-NLS-1$ it.newLine(); it.append("\t */"); //$NON-NLS-1$ it.newLine(); it.append("\t"); //$NON-NLS-1$ if (!forInterface) { it.append("public "); //$NON-NLS-1$ } it.append(builderType); it.append(" add"); //$NON-NLS-1$ it.append(topElementName); it.append("(String name)"); //$NON-NLS-1$ if (forInterface) { it.append(";"); //$NON-NLS-1$ it.newLineIfNotEmpty(); } else { it.append(" {"); //$NON-NLS-1$ it.newLine(); if (forAppender) { it.append("\t\t return this.builder.add"); //$NON-NLS-1$ it.append(topElementName); it.append("(name);"); //$NON-NLS-1$ } else { it.append("\t\t"); //$NON-NLS-1$ it.append(builderType); it.append(" builder = this."); //$NON-NLS-1$ it.append(Strings.toFirstLower(topElementName)); it.append("Provider.get();"); //$NON-NLS-1$ it.newLine(); it.append("\t\tbuilder.eInit(getScript(), name, getTypeResolutionContext());"); //$NON-NLS-1$ it.newLine(); it.append("\t\treturn builder;"); //$NON-NLS-1$ } it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); } it.newLine(); } }; }
[ "@", "SuppressWarnings", "(", "\"checkstyle:all\"", ")", "protected", "StringConcatenationClient", "generateTopElement", "(", "CodeElementExtractor", ".", "ElementDescription", "description", ",", "boolean", "forInterface", ",", "boolean", "forAppender", ")", "{", "final", ...
Extract a top element from the grammar. @param description the description of the top element. @param forInterface indicates if the generated code is for interfaces. @param forAppender indicates if the generated code is for appenders. @return the top element.
[ "Extract", "a", "top", "element", "from", "the", "grammar", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/ScriptBuilderFragment.java#L454-L521
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/ScriptBuilderFragment.java
ScriptBuilderFragment.generateTopElements
protected List<StringConcatenationClient> generateTopElements(boolean forInterface, boolean forAppender) { final List<StringConcatenationClient> topElements = new ArrayList<>(); for (final CodeElementExtractor.ElementDescription description : getCodeElementExtractor().getTopElements( getGrammar(), getCodeBuilderConfig())) { topElements.add(generateTopElement(description, forInterface, forAppender)); } return topElements; }
java
protected List<StringConcatenationClient> generateTopElements(boolean forInterface, boolean forAppender) { final List<StringConcatenationClient> topElements = new ArrayList<>(); for (final CodeElementExtractor.ElementDescription description : getCodeElementExtractor().getTopElements( getGrammar(), getCodeBuilderConfig())) { topElements.add(generateTopElement(description, forInterface, forAppender)); } return topElements; }
[ "protected", "List", "<", "StringConcatenationClient", ">", "generateTopElements", "(", "boolean", "forInterface", ",", "boolean", "forAppender", ")", "{", "final", "List", "<", "StringConcatenationClient", ">", "topElements", "=", "new", "ArrayList", "<>", "(", ")"...
Extract top elements from the grammar. @param forInterface indicates if the generated code is for interfaces. @param forAppender indicates if the generated code is for appender. @return the top elements.
[ "Extract", "top", "elements", "from", "the", "grammar", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/ScriptBuilderFragment.java#L529-L536
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/ScriptBuilderFragment.java
ScriptBuilderFragment.generateIScriptBuilder
protected void generateIScriptBuilder() { final List<StringConcatenationClient> topElements = generateTopElements(true, false); final TypeReference builder = getScriptBuilderInterface(); final StringConcatenationClient content = new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { it.append("/** Builder of " + getLanguageName() + " scripts."); //$NON-NLS-1$ //$NON-NLS-2$ it.newLine(); it.append(" *"); //$NON-NLS-1$ it.newLine(); it.append(" * <p>This builder is provided for helping to create " //$NON-NLS-1$ + getLanguageName() + " Ecore elements."); //$NON-NLS-1$ it.newLine(); it.append(" *"); //$NON-NLS-1$ it.newLine(); it.append(" * <p>Do not forget to invoke {@link #finalizeScript()} for creating imports, etc."); //$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(generateFieldsAndMethods(true, false)); for (final StringConcatenationClient element : topElements) { it.append(element); } it.append("}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); } }; final JavaFileAccess javaFile = getFileAccessFactory().createJavaFile(builder, content); javaFile.writeTo(getSrcGen()); }
java
protected void generateIScriptBuilder() { final List<StringConcatenationClient> topElements = generateTopElements(true, false); final TypeReference builder = getScriptBuilderInterface(); final StringConcatenationClient content = new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { it.append("/** Builder of " + getLanguageName() + " scripts."); //$NON-NLS-1$ //$NON-NLS-2$ it.newLine(); it.append(" *"); //$NON-NLS-1$ it.newLine(); it.append(" * <p>This builder is provided for helping to create " //$NON-NLS-1$ + getLanguageName() + " Ecore elements."); //$NON-NLS-1$ it.newLine(); it.append(" *"); //$NON-NLS-1$ it.newLine(); it.append(" * <p>Do not forget to invoke {@link #finalizeScript()} for creating imports, etc."); //$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(generateFieldsAndMethods(true, false)); for (final StringConcatenationClient element : topElements) { it.append(element); } it.append("}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); } }; final JavaFileAccess javaFile = getFileAccessFactory().createJavaFile(builder, content); javaFile.writeTo(getSrcGen()); }
[ "protected", "void", "generateIScriptBuilder", "(", ")", "{", "final", "List", "<", "StringConcatenationClient", ">", "topElements", "=", "generateTopElements", "(", "true", ",", "false", ")", ";", "final", "TypeReference", "builder", "=", "getScriptBuilderInterface",...
Generate the script builder interface.
[ "Generate", "the", "script", "builder", "interface", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/ScriptBuilderFragment.java#L540-L579
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/ScriptBuilderFragment.java
ScriptBuilderFragment.generateScriptSourceAppender
protected void generateScriptSourceAppender() { final List<StringConcatenationClient> topElements = generateTopElements(false, true); final TypeReference appender = getCodeElementExtractor().getElementAppenderImpl("Script"); //$NON-NLS-1$ final StringConcatenationClient content = new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { it.append("/** Appender of " + getLanguageName() + " scripts."); //$NON-NLS-1$ //$NON-NLS-2$ it.newLine(); it.append(" *"); //$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(getScriptAppender().getSimpleName()); it.append(" extends "); //$NON-NLS-1$ it.append(getCodeElementExtractor().getAbstractAppenderImpl()); it.append(" implements "); //$NON-NLS-1$ it.append(getScriptBuilderInterface()); it.append(" {"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append(generateFieldsAndMethods(false, true)); for (final StringConcatenationClient element : topElements) { it.append(element); } it.append("}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); } }; final JavaFileAccess javaFile = getFileAccessFactory().createJavaFile(appender, content); javaFile.writeTo(getSrcGen()); }
java
protected void generateScriptSourceAppender() { final List<StringConcatenationClient> topElements = generateTopElements(false, true); final TypeReference appender = getCodeElementExtractor().getElementAppenderImpl("Script"); //$NON-NLS-1$ final StringConcatenationClient content = new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { it.append("/** Appender of " + getLanguageName() + " scripts."); //$NON-NLS-1$ //$NON-NLS-2$ it.newLine(); it.append(" *"); //$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(getScriptAppender().getSimpleName()); it.append(" extends "); //$NON-NLS-1$ it.append(getCodeElementExtractor().getAbstractAppenderImpl()); it.append(" implements "); //$NON-NLS-1$ it.append(getScriptBuilderInterface()); it.append(" {"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append(generateFieldsAndMethods(false, true)); for (final StringConcatenationClient element : topElements) { it.append(element); } it.append("}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); } }; final JavaFileAccess javaFile = getFileAccessFactory().createJavaFile(appender, content); javaFile.writeTo(getSrcGen()); }
[ "protected", "void", "generateScriptSourceAppender", "(", ")", "{", "final", "List", "<", "StringConcatenationClient", ">", "topElements", "=", "generateTopElements", "(", "false", ",", "true", ")", ";", "final", "TypeReference", "appender", "=", "getCodeElementExtrac...
Generate the script appender.
[ "Generate", "the", "script", "appender", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/ScriptBuilderFragment.java#L583-L618
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/ScriptBuilderFragment.java
ScriptBuilderFragment.generateScriptBuilderImpl
protected void generateScriptBuilderImpl() { final List<StringConcatenationClient> topElements = generateTopElements(false, false); final TypeReference script = getScriptBuilderImpl(); final TypeReference scriptInterface = getScriptBuilderInterface(); final StringConcatenationClient content = new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { it.append("@SuppressWarnings(\"all\")"); //$NON-NLS-1$ it.newLine(); it.append("public class "); //$NON-NLS-1$ it.append(script.getSimpleName()); it.append(" extends "); //$NON-NLS-1$ it.append(getAbstractBuilderImpl()); it.append(" implements "); //$NON-NLS-1$ it.append(scriptInterface); it.append(" {"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append(generateFieldsAndMethods(false, false)); for (final StringConcatenationClient element : topElements) { it.append(element); } it.append("}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); } }; final JavaFileAccess javaFile = getFileAccessFactory().createJavaFile(script, content); javaFile.writeTo(getSrcGen()); }
java
protected void generateScriptBuilderImpl() { final List<StringConcatenationClient> topElements = generateTopElements(false, false); final TypeReference script = getScriptBuilderImpl(); final TypeReference scriptInterface = getScriptBuilderInterface(); final StringConcatenationClient content = new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { it.append("@SuppressWarnings(\"all\")"); //$NON-NLS-1$ it.newLine(); it.append("public class "); //$NON-NLS-1$ it.append(script.getSimpleName()); it.append(" extends "); //$NON-NLS-1$ it.append(getAbstractBuilderImpl()); it.append(" implements "); //$NON-NLS-1$ it.append(scriptInterface); it.append(" {"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append(generateFieldsAndMethods(false, false)); for (final StringConcatenationClient element : topElements) { it.append(element); } it.append("}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); } }; final JavaFileAccess javaFile = getFileAccessFactory().createJavaFile(script, content); javaFile.writeTo(getSrcGen()); }
[ "protected", "void", "generateScriptBuilderImpl", "(", ")", "{", "final", "List", "<", "StringConcatenationClient", ">", "topElements", "=", "generateTopElements", "(", "false", ",", "false", ")", ";", "final", "TypeReference", "script", "=", "getScriptBuilderImpl", ...
Generate the script builder default implementation.
[ "Generate", "the", "script", "builder", "default", "implementation", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/ScriptBuilderFragment.java#L622-L651
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/ClassFinder.java
ClassFinder.findClass
public static Class<?> findClass(String classname) { Class<?> type = null; final ClassLoader loader = ClassLoaderFinder.findClassLoader(); if (loader != null) { try { type = loader.loadClass(classname); } catch (ClassNotFoundException e) { // } } if (type == null) { try { type = ClassFinder.class.getClassLoader().loadClass(classname); } catch (ClassNotFoundException e) { // } } if (type == null) { try { type = Class.forName(classname); } catch (ClassNotFoundException e) { // } } if (type != null && !LogService.class.isAssignableFrom(type)) { return type; } return null; }
java
public static Class<?> findClass(String classname) { Class<?> type = null; final ClassLoader loader = ClassLoaderFinder.findClassLoader(); if (loader != null) { try { type = loader.loadClass(classname); } catch (ClassNotFoundException e) { // } } if (type == null) { try { type = ClassFinder.class.getClassLoader().loadClass(classname); } catch (ClassNotFoundException e) { // } } if (type == null) { try { type = Class.forName(classname); } catch (ClassNotFoundException e) { // } } if (type != null && !LogService.class.isAssignableFrom(type)) { return type; } return null; }
[ "public", "static", "Class", "<", "?", ">", "findClass", "(", "String", "classname", ")", "{", "Class", "<", "?", ">", "type", "=", "null", ";", "final", "ClassLoader", "loader", "=", "ClassLoaderFinder", ".", "findClassLoader", "(", ")", ";", "if", "(",...
Find the class with a search policy. @param classname the name of the class. @return the class.
[ "Find", "the", "class", "with", "a", "search", "policy", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/ClassFinder.java#L49-L77
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.generatePreamble
protected void generatePreamble(IStyleAppendable it) { clearHilights(); final String nm = getLanguageSimpleName().toLowerCase(); final String cmd = Strings.toFirstUpper(getLanguageSimpleName().toLowerCase()) + "HiLink"; //$NON-NLS-1$ appendComment(it, "Quit when a syntax file was already loaded"); //$NON-NLS-1$ appendCmd(it, false, "if !exists(\"main_syntax\")").increaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, false, "if exists(\"b:current_syntax\")").increaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, false, "finish").decreaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, "endif"); //$NON-NLS-1$ appendComment(it, "we define it here so that included files can test for it"); //$NON-NLS-1$ appendCmd(it, "let main_syntax='" + nm + "'"); //$NON-NLS-1$ //$NON-NLS-2$ appendCmd(it, false, "syn region " + nm + "Fold start=\"{\" end=\"}\" transparent fold"); //$NON-NLS-1$ //$NON-NLS-2$ it.decreaseIndentation().newLine(); appendCmd(it, "endif"); //$NON-NLS-1$ it.newLine(); appendCmd(it, "let s:cpo_save = &cpo"); //$NON-NLS-1$ appendCmd(it, "set cpo&vim"); //$NON-NLS-1$ it.newLine(); appendComment(it, "don't use standard HiLink, it will not work with included syntax files"); //$NON-NLS-1$ appendCmd(it, false, "if version < 508").increaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, false, "command! -nargs=+ " + cmd + " hi link <args>").decreaseIndentation().newLine(); //$NON-NLS-1$ //$NON-NLS-2$ appendCmd(it, false, "else").increaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, false, "command! -nargs=+ " + cmd + " hi def link <args>").decreaseIndentation().newLine(); //$NON-NLS-1$ //$NON-NLS-2$ appendCmd(it, "endif"); //$NON-NLS-1$ it.newLine(); appendComment(it, "some characters that cannot be in a SARL program (outside a string)"); //$NON-NLS-1$ appendMatch(it, nm + "Error", "[\\\\`]"); //$NON-NLS-1$ //$NON-NLS-2$ it.newLine(); }
java
protected void generatePreamble(IStyleAppendable it) { clearHilights(); final String nm = getLanguageSimpleName().toLowerCase(); final String cmd = Strings.toFirstUpper(getLanguageSimpleName().toLowerCase()) + "HiLink"; //$NON-NLS-1$ appendComment(it, "Quit when a syntax file was already loaded"); //$NON-NLS-1$ appendCmd(it, false, "if !exists(\"main_syntax\")").increaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, false, "if exists(\"b:current_syntax\")").increaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, false, "finish").decreaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, "endif"); //$NON-NLS-1$ appendComment(it, "we define it here so that included files can test for it"); //$NON-NLS-1$ appendCmd(it, "let main_syntax='" + nm + "'"); //$NON-NLS-1$ //$NON-NLS-2$ appendCmd(it, false, "syn region " + nm + "Fold start=\"{\" end=\"}\" transparent fold"); //$NON-NLS-1$ //$NON-NLS-2$ it.decreaseIndentation().newLine(); appendCmd(it, "endif"); //$NON-NLS-1$ it.newLine(); appendCmd(it, "let s:cpo_save = &cpo"); //$NON-NLS-1$ appendCmd(it, "set cpo&vim"); //$NON-NLS-1$ it.newLine(); appendComment(it, "don't use standard HiLink, it will not work with included syntax files"); //$NON-NLS-1$ appendCmd(it, false, "if version < 508").increaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, false, "command! -nargs=+ " + cmd + " hi link <args>").decreaseIndentation().newLine(); //$NON-NLS-1$ //$NON-NLS-2$ appendCmd(it, false, "else").increaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, false, "command! -nargs=+ " + cmd + " hi def link <args>").decreaseIndentation().newLine(); //$NON-NLS-1$ //$NON-NLS-2$ appendCmd(it, "endif"); //$NON-NLS-1$ it.newLine(); appendComment(it, "some characters that cannot be in a SARL program (outside a string)"); //$NON-NLS-1$ appendMatch(it, nm + "Error", "[\\\\`]"); //$NON-NLS-1$ //$NON-NLS-2$ it.newLine(); }
[ "protected", "void", "generatePreamble", "(", "IStyleAppendable", "it", ")", "{", "clearHilights", "(", ")", ";", "final", "String", "nm", "=", "getLanguageSimpleName", "(", ")", ".", "toLowerCase", "(", ")", ";", "final", "String", "cmd", "=", "Strings", "....
Generate the preamble of the Vim style. @param it the receiver of the generated elements.
[ "Generate", "the", "preamble", "of", "the", "Vim", "style", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L129-L157
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.generatePostamble
protected void generatePostamble(IStyleAppendable it) { appendComment(it, "catch errors caused by wrong parenthesis"); //$NON-NLS-1$ appendCmd(it, "syn region sarlParenT transparent matchgroup=sarlParen start=\"(\" end=\")\" contains=@sarlTop,sarlParenT1"); //$NON-NLS-1$ appendCmd(it, "syn region sarlParenT1 transparent matchgroup=sarlParen1 start=\"(\" end=\")\"" //$NON-NLS-1$ + " contains=@sarlTop,sarlParenT2 contained"); //$NON-NLS-1$ appendCmd(it, "syn region sarlParenT2 transparent matchgroup=sarlParen2 start=\"(\" end=\")\"" //$NON-NLS-1$ + " contains=@sarlTop,sarlParenT contained"); //$NON-NLS-1$ appendCmd(it, "syn match sarlParenError \")\""); //$NON-NLS-1$ appendComment(it, "catch errors caused by wrong square parenthesis"); //$NON-NLS-1$ appendCmd(it, "syn region sarlParenT transparent matchgroup=sarlParen start=\"\\[\" end=\"\\]\"" //$NON-NLS-1$ + " contains=@sarlTop,sarlParenT1"); //$NON-NLS-1$ appendCmd(it, "syn region sarlParenT1 transparent matchgroup=sarlParen1 start=\"\\[\" end=\"\\]\"" //$NON-NLS-1$ + " contains=@sarlTop,sarlParenT2 contained"); //$NON-NLS-1$ appendCmd(it, "syn region sarlParenT2 transparent matchgroup=sarlParen2 start=\"\\[\" end=\"\\]\"" //$NON-NLS-1$ + " contains=@sarlTop,sarlParenT contained"); //$NON-NLS-1$ appendCmd(it, "syn match sarlParenError \"\\]\""); //$NON-NLS-1$ it.newLine(); appendCmd(it, "SarlHiLink sarlParenError sarlError"); //$NON-NLS-1$ it.newLine(); appendCmd(it, false, "if !exists(\"sarl_minlines\")").increaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, false, "let sarl_minlines = 10").decreaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, "endif"); //$NON-NLS-1$ appendCmd(it, "exec \"syn sync ccomment sarlComment minlines=\" . sarl_minlines"); //$NON-NLS-1$ it.newLine(); appendComment(it, "The default highlighting."); //$NON-NLS-1$ for (final Entry<String, VimSyntaxGroup> hilight : this.hilights.entrySet()) { appendCmd(it, "SarlHiLink " + hilight.getKey() + " " + hilight.getValue().getVimConstant()); //$NON-NLS-1$//$NON-NLS-2$ } clearHilights(); it.newLine(); appendCmd(it, "delcommand SarlHiLink"); //$NON-NLS-1$ it.newLine(); appendCmd(it, "let b:current_syntax = \"" + getLanguageSimpleName().toLowerCase() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ it.newLine(); appendCmd(it, false, "if main_syntax == '" + getLanguageSimpleName().toLowerCase() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ it.increaseIndentation().newLine(); appendCmd(it, false, "unlet main_syntax").decreaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, "endif"); //$NON-NLS-1$ it.newLine(); appendCmd(it, "let b:spell_options=\"contained\""); //$NON-NLS-1$ appendCmd(it, "let &cpo = s:cpo_save"); //$NON-NLS-1$ appendCmd(it, "unlet s:cpo_save"); //$NON-NLS-1$ }
java
protected void generatePostamble(IStyleAppendable it) { appendComment(it, "catch errors caused by wrong parenthesis"); //$NON-NLS-1$ appendCmd(it, "syn region sarlParenT transparent matchgroup=sarlParen start=\"(\" end=\")\" contains=@sarlTop,sarlParenT1"); //$NON-NLS-1$ appendCmd(it, "syn region sarlParenT1 transparent matchgroup=sarlParen1 start=\"(\" end=\")\"" //$NON-NLS-1$ + " contains=@sarlTop,sarlParenT2 contained"); //$NON-NLS-1$ appendCmd(it, "syn region sarlParenT2 transparent matchgroup=sarlParen2 start=\"(\" end=\")\"" //$NON-NLS-1$ + " contains=@sarlTop,sarlParenT contained"); //$NON-NLS-1$ appendCmd(it, "syn match sarlParenError \")\""); //$NON-NLS-1$ appendComment(it, "catch errors caused by wrong square parenthesis"); //$NON-NLS-1$ appendCmd(it, "syn region sarlParenT transparent matchgroup=sarlParen start=\"\\[\" end=\"\\]\"" //$NON-NLS-1$ + " contains=@sarlTop,sarlParenT1"); //$NON-NLS-1$ appendCmd(it, "syn region sarlParenT1 transparent matchgroup=sarlParen1 start=\"\\[\" end=\"\\]\"" //$NON-NLS-1$ + " contains=@sarlTop,sarlParenT2 contained"); //$NON-NLS-1$ appendCmd(it, "syn region sarlParenT2 transparent matchgroup=sarlParen2 start=\"\\[\" end=\"\\]\"" //$NON-NLS-1$ + " contains=@sarlTop,sarlParenT contained"); //$NON-NLS-1$ appendCmd(it, "syn match sarlParenError \"\\]\""); //$NON-NLS-1$ it.newLine(); appendCmd(it, "SarlHiLink sarlParenError sarlError"); //$NON-NLS-1$ it.newLine(); appendCmd(it, false, "if !exists(\"sarl_minlines\")").increaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, false, "let sarl_minlines = 10").decreaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, "endif"); //$NON-NLS-1$ appendCmd(it, "exec \"syn sync ccomment sarlComment minlines=\" . sarl_minlines"); //$NON-NLS-1$ it.newLine(); appendComment(it, "The default highlighting."); //$NON-NLS-1$ for (final Entry<String, VimSyntaxGroup> hilight : this.hilights.entrySet()) { appendCmd(it, "SarlHiLink " + hilight.getKey() + " " + hilight.getValue().getVimConstant()); //$NON-NLS-1$//$NON-NLS-2$ } clearHilights(); it.newLine(); appendCmd(it, "delcommand SarlHiLink"); //$NON-NLS-1$ it.newLine(); appendCmd(it, "let b:current_syntax = \"" + getLanguageSimpleName().toLowerCase() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ it.newLine(); appendCmd(it, false, "if main_syntax == '" + getLanguageSimpleName().toLowerCase() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ it.increaseIndentation().newLine(); appendCmd(it, false, "unlet main_syntax").decreaseIndentation().newLine(); //$NON-NLS-1$ appendCmd(it, "endif"); //$NON-NLS-1$ it.newLine(); appendCmd(it, "let b:spell_options=\"contained\""); //$NON-NLS-1$ appendCmd(it, "let &cpo = s:cpo_save"); //$NON-NLS-1$ appendCmd(it, "unlet s:cpo_save"); //$NON-NLS-1$ }
[ "protected", "void", "generatePostamble", "(", "IStyleAppendable", "it", ")", "{", "appendComment", "(", "it", ",", "\"catch errors caused by wrong parenthesis\"", ")", ";", "//$NON-NLS-1$", "appendCmd", "(", "it", ",", "\"syn region sarlParenT transparent matchgroup=sarlPare...
Generate the postamble of the Vim style. @param it the receiver of the generated elements.
[ "Generate", "the", "postamble", "of", "the", "Vim", "style", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L163-L206
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.generatePrimitiveTypes
protected void generatePrimitiveTypes(IStyleAppendable it, Iterable<String> types) { final Iterator<String> iterator = types.iterator(); if (iterator.hasNext()) { appendComment(it, "primitive types."); //$NON-NLS-1$ appendMatch(it, "sarlArrayDeclaration", "\\(\\s*\\[\\s*\\]\\)*", true); //$NON-NLS-1$//$NON-NLS-2$ it.append("syn keyword sarlPrimitiveType"); //$NON-NLS-1$ do { it.append(" "); //$NON-NLS-1$ it.append(iterator.next()); } while (iterator.hasNext()); it.append(" nextgroup=sarlArrayDeclaration").newLine(); //$NON-NLS-1$ appendCluster(it, "sarlPrimitiveType"); //$NON-NLS-1$ hilight("sarlPrimitiveType", VimSyntaxGroup.SPECIAL); //$NON-NLS-1$ hilight("sarlArrayDeclaration", VimSyntaxGroup.SPECIAL); //$NON-NLS-1$ it.newLine(); } }
java
protected void generatePrimitiveTypes(IStyleAppendable it, Iterable<String> types) { final Iterator<String> iterator = types.iterator(); if (iterator.hasNext()) { appendComment(it, "primitive types."); //$NON-NLS-1$ appendMatch(it, "sarlArrayDeclaration", "\\(\\s*\\[\\s*\\]\\)*", true); //$NON-NLS-1$//$NON-NLS-2$ it.append("syn keyword sarlPrimitiveType"); //$NON-NLS-1$ do { it.append(" "); //$NON-NLS-1$ it.append(iterator.next()); } while (iterator.hasNext()); it.append(" nextgroup=sarlArrayDeclaration").newLine(); //$NON-NLS-1$ appendCluster(it, "sarlPrimitiveType"); //$NON-NLS-1$ hilight("sarlPrimitiveType", VimSyntaxGroup.SPECIAL); //$NON-NLS-1$ hilight("sarlArrayDeclaration", VimSyntaxGroup.SPECIAL); //$NON-NLS-1$ it.newLine(); } }
[ "protected", "void", "generatePrimitiveTypes", "(", "IStyleAppendable", "it", ",", "Iterable", "<", "String", ">", "types", ")", "{", "final", "Iterator", "<", "String", ">", "iterator", "=", "types", ".", "iterator", "(", ")", ";", "if", "(", "iterator", ...
Generate the keywords for the primitive types. @param it the receiver of the generated elements. @param types the primitive types.
[ "Generate", "the", "keywords", "for", "the", "primitive", "types", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L222-L238
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.generateComments
protected void generateComments(IStyleAppendable it) { appendComment(it, "comments"); //$NON-NLS-1$ appendRegion(it, "sarlComment", "/\\*", "\\*/", "@Spell"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ appendCmd(it, "syn match sarlCommentStar contained \"^\\s*\\*[^/]\"me=e-1"); //$NON-NLS-1$ appendMatch(it, "sarlCommentStar", "^\\s*\\*$", true); //$NON-NLS-1$ //$NON-NLS-2$ appendMatch(it, "sarlLineComment", "//.*", "@Spell"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ appendCluster(it, "sarlComment", "sarlLineComment"); //$NON-NLS-1$ //$NON-NLS-2$ hilight("sarlComment", VimSyntaxGroup.COMMENT); //$NON-NLS-1$ hilight("sarlLineComment", VimSyntaxGroup.COMMENT); //$NON-NLS-1$ appendComment(it, "match the special comment /**/"); //$NON-NLS-1$ appendMatch(it, "sarlComment", "/\\*\\*/"); //$NON-NLS-1$ //$NON-NLS-2$ it.newLine(); }
java
protected void generateComments(IStyleAppendable it) { appendComment(it, "comments"); //$NON-NLS-1$ appendRegion(it, "sarlComment", "/\\*", "\\*/", "@Spell"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ appendCmd(it, "syn match sarlCommentStar contained \"^\\s*\\*[^/]\"me=e-1"); //$NON-NLS-1$ appendMatch(it, "sarlCommentStar", "^\\s*\\*$", true); //$NON-NLS-1$ //$NON-NLS-2$ appendMatch(it, "sarlLineComment", "//.*", "@Spell"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ appendCluster(it, "sarlComment", "sarlLineComment"); //$NON-NLS-1$ //$NON-NLS-2$ hilight("sarlComment", VimSyntaxGroup.COMMENT); //$NON-NLS-1$ hilight("sarlLineComment", VimSyntaxGroup.COMMENT); //$NON-NLS-1$ appendComment(it, "match the special comment /**/"); //$NON-NLS-1$ appendMatch(it, "sarlComment", "/\\*\\*/"); //$NON-NLS-1$ //$NON-NLS-2$ it.newLine(); }
[ "protected", "void", "generateComments", "(", "IStyleAppendable", "it", ")", "{", "appendComment", "(", "it", ",", "\"comments\"", ")", ";", "//$NON-NLS-1$", "appendRegion", "(", "it", ",", "\"sarlComment\"", ",", "\"/\\\\*\"", ",", "\"\\\\*/\"", ",", "\"@Spell\""...
Generate the Vim comments. @param it the receiver of the generated elements.
[ "Generate", "the", "Vim", "comments", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L244-L258
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.generateStrings
protected void generateStrings(IStyleAppendable it) { appendComment(it, "Strings constants"); //$NON-NLS-1$ appendMatch(it, "sarlSpecialError", "\\\\.", true); //$NON-NLS-1$ //$NON-NLS-2$ appendMatch(it, "sarlSpecialCharError", "[^']", true); //$NON-NLS-1$ //$NON-NLS-2$ appendMatch(it, "sarlSpecialChar", "\\\\\\([4-9]\\d\\|[0-3]\\d\\d\\|[\"\\\\'ntbrf]\\|u\\x\\{4\\}\\)", true); //$NON-NLS-1$ //$NON-NLS-2$ appendRegion(it, true, "sarlString", "\"", "\"", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ "sarlSpecialChar", "sarlSpecialError", "@Spell"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ appendRegion(it, true, "sarlString", "'", "'", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ "sarlSpecialChar", "sarlSpecialError", "@Spell"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ appendCluster(it, "sarlString"); //$NON-NLS-1$ hilight("sarlString", VimSyntaxGroup.CONSTANT); //$NON-NLS-1$ it.newLine(); }
java
protected void generateStrings(IStyleAppendable it) { appendComment(it, "Strings constants"); //$NON-NLS-1$ appendMatch(it, "sarlSpecialError", "\\\\.", true); //$NON-NLS-1$ //$NON-NLS-2$ appendMatch(it, "sarlSpecialCharError", "[^']", true); //$NON-NLS-1$ //$NON-NLS-2$ appendMatch(it, "sarlSpecialChar", "\\\\\\([4-9]\\d\\|[0-3]\\d\\d\\|[\"\\\\'ntbrf]\\|u\\x\\{4\\}\\)", true); //$NON-NLS-1$ //$NON-NLS-2$ appendRegion(it, true, "sarlString", "\"", "\"", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ "sarlSpecialChar", "sarlSpecialError", "@Spell"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ appendRegion(it, true, "sarlString", "'", "'", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ "sarlSpecialChar", "sarlSpecialError", "@Spell"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ appendCluster(it, "sarlString"); //$NON-NLS-1$ hilight("sarlString", VimSyntaxGroup.CONSTANT); //$NON-NLS-1$ it.newLine(); }
[ "protected", "void", "generateStrings", "(", "IStyleAppendable", "it", ")", "{", "appendComment", "(", "it", ",", "\"Strings constants\"", ")", ";", "//$NON-NLS-1$", "appendMatch", "(", "it", ",", "\"sarlSpecialError\"", ",", "\"\\\\\\\\.\"", ",", "true", ")", ";"...
Generate the Vim strings of characters. @param it the receiver of the generated elements.
[ "Generate", "the", "Vim", "strings", "of", "characters", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L264-L276
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.generateNumericConstants
protected void generateNumericConstants(IStyleAppendable it) { appendComment(it, "numerical constants"); //$NON-NLS-1$ appendMatch(it, "sarlNumber", "[0-9][0-9]*\\.[0-9]\\+([eE][0-9]\\+)\\?[fFdD]\\?"); //$NON-NLS-1$ //$NON-NLS-2$ appendMatch(it, "sarlNumber", "0[xX][0-9a-fA-F]\\+"); //$NON-NLS-1$ //$NON-NLS-2$ appendMatch(it, "sarlNumber", "[0-9]\\+[lL]\\?"); //$NON-NLS-1$ //$NON-NLS-2$ appendCluster(it, "sarlNumber"); //$NON-NLS-1$ hilight("sarlNumber", VimSyntaxGroup.CONSTANT); //$NON-NLS-1$ it.newLine(); }
java
protected void generateNumericConstants(IStyleAppendable it) { appendComment(it, "numerical constants"); //$NON-NLS-1$ appendMatch(it, "sarlNumber", "[0-9][0-9]*\\.[0-9]\\+([eE][0-9]\\+)\\?[fFdD]\\?"); //$NON-NLS-1$ //$NON-NLS-2$ appendMatch(it, "sarlNumber", "0[xX][0-9a-fA-F]\\+"); //$NON-NLS-1$ //$NON-NLS-2$ appendMatch(it, "sarlNumber", "[0-9]\\+[lL]\\?"); //$NON-NLS-1$ //$NON-NLS-2$ appendCluster(it, "sarlNumber"); //$NON-NLS-1$ hilight("sarlNumber", VimSyntaxGroup.CONSTANT); //$NON-NLS-1$ it.newLine(); }
[ "protected", "void", "generateNumericConstants", "(", "IStyleAppendable", "it", ")", "{", "appendComment", "(", "it", ",", "\"numerical constants\"", ")", ";", "//$NON-NLS-1$", "appendMatch", "(", "it", ",", "\"sarlNumber\"", ",", "\"[0-9][0-9]*\\\\.[0-9]\\\\+([eE][0-9]\\...
Generate the Vim numeric constants. @param it the receiver of the generated elements.
[ "Generate", "the", "Vim", "numeric", "constants", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L282-L290
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.generateAnnotations
protected void generateAnnotations(IStyleAppendable it) { appendComment(it, "annnotation"); //$NON-NLS-1$ appendMatch(it, "sarlAnnotation", "@[_a-zA-Z][_0-9a-zA-Z]*\\([.$][_a-zA-Z][_0-9a-zA-Z]*\\)*"); //$NON-NLS-1$ //$NON-NLS-2$ appendCluster(it, "sarlAnnotation"); //$NON-NLS-1$ hilight("sarlAnnotation", VimSyntaxGroup.PRE_PROCESSOR); //$NON-NLS-1$ it.newLine(); }
java
protected void generateAnnotations(IStyleAppendable it) { appendComment(it, "annnotation"); //$NON-NLS-1$ appendMatch(it, "sarlAnnotation", "@[_a-zA-Z][_0-9a-zA-Z]*\\([.$][_a-zA-Z][_0-9a-zA-Z]*\\)*"); //$NON-NLS-1$ //$NON-NLS-2$ appendCluster(it, "sarlAnnotation"); //$NON-NLS-1$ hilight("sarlAnnotation", VimSyntaxGroup.PRE_PROCESSOR); //$NON-NLS-1$ it.newLine(); }
[ "protected", "void", "generateAnnotations", "(", "IStyleAppendable", "it", ")", "{", "appendComment", "(", "it", ",", "\"annnotation\"", ")", ";", "//$NON-NLS-1$", "appendMatch", "(", "it", ",", "\"sarlAnnotation\"", ",", "\"@[_a-zA-Z][_0-9a-zA-Z]*\\\\([.$][_a-zA-Z][_0-9a...
Generate the annotations. @param it the receiver of the generated elements.
[ "Generate", "the", "annotations", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L296-L302
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.generateKeywords
protected void generateKeywords(IStyleAppendable it, String family, VimSyntaxGroup color, Iterable<String> keywords) { appendComment(it, "keywords for the '" + family + "' family."); //$NON-NLS-1$ //$NON-NLS-2$ final Iterator<String> iterator = keywords.iterator(); if (iterator.hasNext()) { it.append("syn keyword "); //$NON-NLS-1$ it.append(family); do { it.append(" "); //$NON-NLS-1$ it.append(iterator.next()); } while (iterator.hasNext()); } it.newLine(); appendCluster(it, family); hilight(family, color); it.newLine(); }
java
protected void generateKeywords(IStyleAppendable it, String family, VimSyntaxGroup color, Iterable<String> keywords) { appendComment(it, "keywords for the '" + family + "' family."); //$NON-NLS-1$ //$NON-NLS-2$ final Iterator<String> iterator = keywords.iterator(); if (iterator.hasNext()) { it.append("syn keyword "); //$NON-NLS-1$ it.append(family); do { it.append(" "); //$NON-NLS-1$ it.append(iterator.next()); } while (iterator.hasNext()); } it.newLine(); appendCluster(it, family); hilight(family, color); it.newLine(); }
[ "protected", "void", "generateKeywords", "(", "IStyleAppendable", "it", ",", "String", "family", ",", "VimSyntaxGroup", "color", ",", "Iterable", "<", "String", ">", "keywords", ")", "{", "appendComment", "(", "it", ",", "\"keywords for the '\"", "+", "family", ...
Generate the Vim keywords. @param it the receiver of the generated elements. @param family the name of the keyword family. @param color the color to be associated to the elements. @param keywords the keywords.
[ "Generate", "the", "Vim", "keywords", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L311-L326
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.appendCmd
protected IStyleAppendable appendCmd(IStyleAppendable it, String text) { return appendCmd(it, true, text); }
java
protected IStyleAppendable appendCmd(IStyleAppendable it, String text) { return appendCmd(it, true, text); }
[ "protected", "IStyleAppendable", "appendCmd", "(", "IStyleAppendable", "it", ",", "String", "text", ")", "{", "return", "appendCmd", "(", "it", ",", "true", ",", "text", ")", ";", "}" ]
Append a Vim command. @param it the receiver of the generated elements. @param text the text of the command. @return {@code it}.
[ "Append", "a", "Vim", "command", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L539-L541
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.generateFileTypeDetectionScript
protected void generateFileTypeDetectionScript(String basename) { final CharSequence scriptContent = getFileTypeDetectionScript(); if (scriptContent != null) { final String textualContent = scriptContent.toString(); if (!Strings.isEmpty(textualContent)) { final byte[] bytes = textualContent.getBytes(); for (final String output : getOutputs()) { final File directory = new File(output, FTDETECT_FOLDER).getAbsoluteFile(); try { final File outputFile = new File(directory, basename); outputFile.getParentFile().mkdirs(); Files.write(Paths.get(outputFile.getAbsolutePath()), bytes); } catch (IOException e) { throw new RuntimeException(e); } } } } }
java
protected void generateFileTypeDetectionScript(String basename) { final CharSequence scriptContent = getFileTypeDetectionScript(); if (scriptContent != null) { final String textualContent = scriptContent.toString(); if (!Strings.isEmpty(textualContent)) { final byte[] bytes = textualContent.getBytes(); for (final String output : getOutputs()) { final File directory = new File(output, FTDETECT_FOLDER).getAbsoluteFile(); try { final File outputFile = new File(directory, basename); outputFile.getParentFile().mkdirs(); Files.write(Paths.get(outputFile.getAbsolutePath()), bytes); } catch (IOException e) { throw new RuntimeException(e); } } } } }
[ "protected", "void", "generateFileTypeDetectionScript", "(", "String", "basename", ")", "{", "final", "CharSequence", "scriptContent", "=", "getFileTypeDetectionScript", "(", ")", ";", "if", "(", "scriptContent", "!=", "null", ")", "{", "final", "String", "textualCo...
Generate the script for detecting the SARL files. @param basename the name of the file to create. @see #getFileTypeDetectionScript()
[ "Generate", "the", "script", "for", "detecting", "the", "SARL", "files", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L583-L601
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.getFileTypeDetectionScript
protected CharSequence getFileTypeDetectionScript() { return concat( "\" Vim filetype-detection file", //$NON-NLS-1$ "\" Language: " + getLanguageSimpleName(), //$NON-NLS-1$ "\" Version: " + getLanguageVersion(), //$NON-NLS-1$ "", //$NON-NLS-1$ "au BufRead,BufNewFile *." + getLanguage().getFileExtensions().get(0) //$NON-NLS-1$ + " set filetype=" + getLanguageSimpleName().toLowerCase()); //$NON-NLS-1$ }
java
protected CharSequence getFileTypeDetectionScript() { return concat( "\" Vim filetype-detection file", //$NON-NLS-1$ "\" Language: " + getLanguageSimpleName(), //$NON-NLS-1$ "\" Version: " + getLanguageVersion(), //$NON-NLS-1$ "", //$NON-NLS-1$ "au BufRead,BufNewFile *." + getLanguage().getFileExtensions().get(0) //$NON-NLS-1$ + " set filetype=" + getLanguageSimpleName().toLowerCase()); //$NON-NLS-1$ }
[ "protected", "CharSequence", "getFileTypeDetectionScript", "(", ")", "{", "return", "concat", "(", "\"\\\" Vim filetype-detection file\"", ",", "//$NON-NLS-1$", "\"\\\" Language: \"", "+", "getLanguageSimpleName", "(", ")", ",", "//$NON-NLS-1$", "\"\\\" Version: \"", "+", "...
Replies the script for detecting the SARL files. @return the content of the "ftdetect" script.
[ "Replies", "the", "script", "for", "detecting", "the", "SARL", "files", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L607-L615
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/preferences/SARLBuilderConfigurationBlock.java
SARLBuilderConfigurationBlock.getOutputConfigurations
@Override protected Set<OutputConfiguration> getOutputConfigurations(IProject project) { final Set<OutputConfiguration> original = this.configurationProvider.getOutputConfigurations(getProject()); return Sets.filter(original, it -> !ExtraLanguageOutputConfigurations.isExtraLanguageOutputConfiguration(it.getName())); }
java
@Override protected Set<OutputConfiguration> getOutputConfigurations(IProject project) { final Set<OutputConfiguration> original = this.configurationProvider.getOutputConfigurations(getProject()); return Sets.filter(original, it -> !ExtraLanguageOutputConfigurations.isExtraLanguageOutputConfiguration(it.getName())); }
[ "@", "Override", "protected", "Set", "<", "OutputConfiguration", ">", "getOutputConfigurations", "(", "IProject", "project", ")", "{", "final", "Set", "<", "OutputConfiguration", ">", "original", "=", "this", ".", "configurationProvider", ".", "getOutputConfigurations...
Replies the output configurations for the given project. <p>This function filters the output configurations in order to never reply one associated to a extra language output. @param project the project. @return the output configurations associated to the given project.
[ "Replies", "the", "output", "configurations", "for", "the", "given", "project", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/preferences/SARLBuilderConfigurationBlock.java#L118-L122
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/AbstractMarkerLanguageParser.java
AbstractMarkerLanguageParser.parseRange
public static IntegerRange parseRange(String stringRange, int minValue) { final String sepPattern = "[,;\\-:]"; //$NON-NLS-1$ try { final Matcher matcher = Pattern.compile("^\\s*" //$NON-NLS-1$ + "(?:(?<left>[0-9]+)\\s*(?:(?<sep1>" + sepPattern + ")\\s*(?<right1>[0-9]+)?)?)" //$NON-NLS-1$ //$NON-NLS-2$ + "|(?:(?<sep2>" + sepPattern + ")\\s*(?<right2>[0-9]+))" //$NON-NLS-1$ //$NON-NLS-2$ + "\\s*$") //$NON-NLS-1$ .matcher(stringRange); if (matcher.matches()) { final String left = matcher.group("left"); //$NON-NLS-1$ final String sep = select(matcher.group("sep1"), matcher.group("sep2")); //$NON-NLS-1$ //$NON-NLS-2$ final String right = select(matcher.group("right1"), matcher.group("right2")); //$NON-NLS-1$ //$NON-NLS-2$ if (Strings.isEmpty(left)) { if (!Strings.isEmpty(sep) && !Strings.isEmpty(right)) { return new IntegerRange(minValue, Math.max(minValue, Integer.valueOf(right))); } } else { final int leftValue = Math.max(minValue, Integer.valueOf(left)); if (Strings.isEmpty(sep)) { return new IntegerRange(leftValue, leftValue); } if (Strings.isEmpty(right)) { return new IntegerRange(leftValue, Integer.MAX_VALUE); } final int rightValue = Math.max(minValue, Integer.valueOf(right)); if (rightValue < leftValue) { return new IntegerRange(rightValue, leftValue); } return new IntegerRange(leftValue, rightValue); } } } catch (Throwable exception) { throw new IllegalArgumentException(MessageFormat.format(Messages.GenerateMojo_4, stringRange), exception); } throw new IllegalArgumentException(MessageFormat.format(Messages.GenerateMojo_4, stringRange)); }
java
public static IntegerRange parseRange(String stringRange, int minValue) { final String sepPattern = "[,;\\-:]"; //$NON-NLS-1$ try { final Matcher matcher = Pattern.compile("^\\s*" //$NON-NLS-1$ + "(?:(?<left>[0-9]+)\\s*(?:(?<sep1>" + sepPattern + ")\\s*(?<right1>[0-9]+)?)?)" //$NON-NLS-1$ //$NON-NLS-2$ + "|(?:(?<sep2>" + sepPattern + ")\\s*(?<right2>[0-9]+))" //$NON-NLS-1$ //$NON-NLS-2$ + "\\s*$") //$NON-NLS-1$ .matcher(stringRange); if (matcher.matches()) { final String left = matcher.group("left"); //$NON-NLS-1$ final String sep = select(matcher.group("sep1"), matcher.group("sep2")); //$NON-NLS-1$ //$NON-NLS-2$ final String right = select(matcher.group("right1"), matcher.group("right2")); //$NON-NLS-1$ //$NON-NLS-2$ if (Strings.isEmpty(left)) { if (!Strings.isEmpty(sep) && !Strings.isEmpty(right)) { return new IntegerRange(minValue, Math.max(minValue, Integer.valueOf(right))); } } else { final int leftValue = Math.max(minValue, Integer.valueOf(left)); if (Strings.isEmpty(sep)) { return new IntegerRange(leftValue, leftValue); } if (Strings.isEmpty(right)) { return new IntegerRange(leftValue, Integer.MAX_VALUE); } final int rightValue = Math.max(minValue, Integer.valueOf(right)); if (rightValue < leftValue) { return new IntegerRange(rightValue, leftValue); } return new IntegerRange(leftValue, rightValue); } } } catch (Throwable exception) { throw new IllegalArgumentException(MessageFormat.format(Messages.GenerateMojo_4, stringRange), exception); } throw new IllegalArgumentException(MessageFormat.format(Messages.GenerateMojo_4, stringRange)); }
[ "public", "static", "IntegerRange", "parseRange", "(", "String", "stringRange", ",", "int", "minValue", ")", "{", "final", "String", "sepPattern", "=", "\"[,;\\\\-:]\"", ";", "//$NON-NLS-1$", "try", "{", "final", "Matcher", "matcher", "=", "Pattern", ".", "compi...
Parse a range of integers. <p>The supported formats are:<ul> <li>{@code n} for exactly {@code n},</li> <li>{@code n-m} for {@code n} to {@code m},</li> <li>{@code n-} for {@code n} to infinity,</li> <li>{@code -m} for 1 to {@code n}.</li> </ul> @param stringRange the string representation to parse. @param minValue the minimal value in the possible values for the range. @return the integer range.
[ "Parse", "a", "range", "of", "integers", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/AbstractMarkerLanguageParser.java#L85-L120
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/AbstractMarkerLanguageParser.java
AbstractMarkerLanguageParser.isHtmlFileExtension
public static boolean isHtmlFileExtension(String extension) { for (final String ext : HTML_FILE_EXTENSIONS) { if (Strings.equal(ext, extension)) { return true; } } return false; }
java
public static boolean isHtmlFileExtension(String extension) { for (final String ext : HTML_FILE_EXTENSIONS) { if (Strings.equal(ext, extension)) { return true; } } return false; }
[ "public", "static", "boolean", "isHtmlFileExtension", "(", "String", "extension", ")", "{", "for", "(", "final", "String", "ext", ":", "HTML_FILE_EXTENSIONS", ")", "{", "if", "(", "Strings", ".", "equal", "(", "ext", ",", "extension", ")", ")", "{", "retur...
Replies if the given extension is for HTML file. @param extension the extension to test. @return {@code true} if the extension is for a HTML file.
[ "Replies", "if", "the", "given", "extension", "is", "for", "HTML", "file", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/AbstractMarkerLanguageParser.java#L143-L150
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/AbstractMarkerLanguageParser.java
AbstractMarkerLanguageParser.setDocumentParser
@Inject public void setDocumentParser(SarlDocumentationParser parser) { assert parser != null; this.parser = parser; this.parser.reset(); }
java
@Inject public void setDocumentParser(SarlDocumentationParser parser) { assert parser != null; this.parser = parser; this.parser.reset(); }
[ "@", "Inject", "public", "void", "setDocumentParser", "(", "SarlDocumentationParser", "parser", ")", "{", "assert", "parser", "!=", "null", ";", "this", ".", "parser", "=", "parser", ";", "this", ".", "parser", ".", "reset", "(", ")", ";", "}" ]
Change the document parser. @param parser the documentation parser.
[ "Change", "the", "document", "parser", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/AbstractMarkerLanguageParser.java#L156-L161
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/AbstractMarkerLanguageParser.java
AbstractMarkerLanguageParser.getStandardValidationComponents
public Iterable<ValidationComponent> getStandardValidationComponents(File inputFile) { final ValidationHandler handler = new ValidationHandler(); getDocumentParser().extractValidationComponents(inputFile, handler); return handler.getComponents(); }
java
public Iterable<ValidationComponent> getStandardValidationComponents(File inputFile) { final ValidationHandler handler = new ValidationHandler(); getDocumentParser().extractValidationComponents(inputFile, handler); return handler.getComponents(); }
[ "public", "Iterable", "<", "ValidationComponent", ">", "getStandardValidationComponents", "(", "File", "inputFile", ")", "{", "final", "ValidationHandler", "handler", "=", "new", "ValidationHandler", "(", ")", ";", "getDocumentParser", "(", ")", ".", "extractValidatio...
Extract the validation components from the given file. @param inputFile the input file. @return the validation components.
[ "Extract", "the", "validation", "components", "from", "the", "given", "file", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/AbstractMarkerLanguageParser.java#L268-L272
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/AbstractMarkerLanguageParser.java
AbstractMarkerLanguageParser.getMarkerSpecificValidationComponents
public final List<DynamicValidationComponent> getMarkerSpecificValidationComponents(File inputFile, File rootFolder, DynamicValidationContext context) { return getSpecificValidationComponents( transform(inputFile, false), inputFile, rootFolder, context); }
java
public final List<DynamicValidationComponent> getMarkerSpecificValidationComponents(File inputFile, File rootFolder, DynamicValidationContext context) { return getSpecificValidationComponents( transform(inputFile, false), inputFile, rootFolder, context); }
[ "public", "final", "List", "<", "DynamicValidationComponent", ">", "getMarkerSpecificValidationComponents", "(", "File", "inputFile", ",", "File", "rootFolder", ",", "DynamicValidationContext", "context", ")", "{", "return", "getSpecificValidationComponents", "(", "transfor...
Extract the validation components that are specific to the marker language. @param inputFile the input file. @param rootFolder the root folder in which the input file is located. @param context the generation context. @return the validation components.
[ "Extract", "the", "validation", "components", "that", "are", "specific", "to", "the", "marker", "language", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/AbstractMarkerLanguageParser.java#L293-L301
train
sarl/sarl
sre/io.janusproject/io.janusproject.eclipse/src/io/janusproject/eclipse/buildpath/JanusClasspathContainer.java
JanusClasspathContainer.getJanusPlatformClasspath
public static IBundleDependencies getJanusPlatformClasspath() { final Bundle bundle = Platform.getBundle(JanusEclipsePlugin.JANUS_KERNEL_PLUGIN_ID); return BundleUtil.resolveBundleDependencies(bundle, new JanusBundleJavadocURLMappings(), JANUS_ROOT_BUNDLE_NAMES); }
java
public static IBundleDependencies getJanusPlatformClasspath() { final Bundle bundle = Platform.getBundle(JanusEclipsePlugin.JANUS_KERNEL_PLUGIN_ID); return BundleUtil.resolveBundleDependencies(bundle, new JanusBundleJavadocURLMappings(), JANUS_ROOT_BUNDLE_NAMES); }
[ "public", "static", "IBundleDependencies", "getJanusPlatformClasspath", "(", ")", "{", "final", "Bundle", "bundle", "=", "Platform", ".", "getBundle", "(", "JanusEclipsePlugin", ".", "JANUS_KERNEL_PLUGIN_ID", ")", ";", "return", "BundleUtil", ".", "resolveBundleDependen...
Replies the standard classpath for running the Janus platform. @return the classpath.
[ "Replies", "the", "standard", "classpath", "for", "running", "the", "Janus", "platform", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.eclipse/src/io/janusproject/eclipse/buildpath/JanusClasspathContainer.java#L93-L98
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/FormalParameterListComparator.java
FormalParameterListComparator.compare
public static int compare(XtendParameter p1, XtendParameter p2) { if (p1 != p2) { if (p1 == null) { return Integer.MIN_VALUE; } if (p2 == null) { return Integer.MAX_VALUE; } final JvmTypeReference t1 = p1.getParameterType(); final JvmTypeReference t2 = p2.getParameterType(); if (t1 != t2) { final int cmp; if (t1 == null) { cmp = Integer.MIN_VALUE; } else if (t2 == null) { cmp = Integer.MAX_VALUE; } else { cmp = t1.getIdentifier().compareTo(t2.getIdentifier()); } if (cmp != 0) { return cmp; } } } return 0; }
java
public static int compare(XtendParameter p1, XtendParameter p2) { if (p1 != p2) { if (p1 == null) { return Integer.MIN_VALUE; } if (p2 == null) { return Integer.MAX_VALUE; } final JvmTypeReference t1 = p1.getParameterType(); final JvmTypeReference t2 = p2.getParameterType(); if (t1 != t2) { final int cmp; if (t1 == null) { cmp = Integer.MIN_VALUE; } else if (t2 == null) { cmp = Integer.MAX_VALUE; } else { cmp = t1.getIdentifier().compareTo(t2.getIdentifier()); } if (cmp != 0) { return cmp; } } } return 0; }
[ "public", "static", "int", "compare", "(", "XtendParameter", "p1", ",", "XtendParameter", "p2", ")", "{", "if", "(", "p1", "!=", "p2", ")", "{", "if", "(", "p1", "==", "null", ")", "{", "return", "Integer", ".", "MIN_VALUE", ";", "}", "if", "(", "p...
Compare the two formal parameters. @param p1 the first parameter to compare. @param p2 the second parameter to compare. @return A negative value if <code>p1</code> is lower than <code>p2</code>, a positive value if <code>p1</code> is greater than <code>p2</code>, otherwise <code>0</code>.
[ "Compare", "the", "two", "formal", "parameters", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/FormalParameterListComparator.java#L74-L99
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorBuilderImpl.java
SarlBehaviorBuilderImpl.addSarlBehaviorUnit
public ISarlBehaviorUnitBuilder addSarlBehaviorUnit(String name) { ISarlBehaviorUnitBuilder builder = this.iSarlBehaviorUnitBuilderProvider.get(); builder.eInit(getSarlBehavior(), name, getTypeResolutionContext()); return builder; }
java
public ISarlBehaviorUnitBuilder addSarlBehaviorUnit(String name) { ISarlBehaviorUnitBuilder builder = this.iSarlBehaviorUnitBuilderProvider.get(); builder.eInit(getSarlBehavior(), name, getTypeResolutionContext()); return builder; }
[ "public", "ISarlBehaviorUnitBuilder", "addSarlBehaviorUnit", "(", "String", "name", ")", "{", "ISarlBehaviorUnitBuilder", "builder", "=", "this", ".", "iSarlBehaviorUnitBuilderProvider", ".", "get", "(", ")", ";", "builder", ".", "eInit", "(", "getSarlBehavior", "(", ...
Create a SarlBehaviorUnit. @param name the type of the SarlBehaviorUnit. @return the builder.
[ "Create", "a", "SarlBehaviorUnit", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorBuilderImpl.java#L158-L162
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorBuilderImpl.java
SarlBehaviorBuilderImpl.addVarSarlField
public ISarlFieldBuilder addVarSarlField(String name) { ISarlFieldBuilder builder = this.iSarlFieldBuilderProvider.get(); builder.eInit(getSarlBehavior(), name, "var", getTypeResolutionContext()); return builder; }
java
public ISarlFieldBuilder addVarSarlField(String name) { ISarlFieldBuilder builder = this.iSarlFieldBuilderProvider.get(); builder.eInit(getSarlBehavior(), name, "var", getTypeResolutionContext()); return builder; }
[ "public", "ISarlFieldBuilder", "addVarSarlField", "(", "String", "name", ")", "{", "ISarlFieldBuilder", "builder", "=", "this", ".", "iSarlFieldBuilderProvider", ".", "get", "(", ")", ";", "builder", ".", "eInit", "(", "getSarlBehavior", "(", ")", ",", "name", ...
Create a SarlField. @param name the name of the SarlField. @return the builder.
[ "Create", "a", "SarlField", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorBuilderImpl.java#L171-L175
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorBuilderImpl.java
SarlBehaviorBuilderImpl.addDefSarlAction
public ISarlActionBuilder addDefSarlAction(String name) { ISarlActionBuilder builder = this.iSarlActionBuilderProvider.get(); builder.eInit(getSarlBehavior(), name, "def", getTypeResolutionContext()); return builder; }
java
public ISarlActionBuilder addDefSarlAction(String name) { ISarlActionBuilder builder = this.iSarlActionBuilderProvider.get(); builder.eInit(getSarlBehavior(), name, "def", getTypeResolutionContext()); return builder; }
[ "public", "ISarlActionBuilder", "addDefSarlAction", "(", "String", "name", ")", "{", "ISarlActionBuilder", "builder", "=", "this", ".", "iSarlActionBuilderProvider", ".", "get", "(", ")", ";", "builder", ".", "eInit", "(", "getSarlBehavior", "(", ")", ",", "name...
Create a SarlAction. @param name the name of the SarlAction. @return the builder.
[ "Create", "a", "SarlAction", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorBuilderImpl.java#L203-L207
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorBuilderImpl.java
SarlBehaviorBuilderImpl.addSarlClass
public ISarlClassBuilder addSarlClass(String name) { ISarlClassBuilder builder = this.iSarlClassBuilderProvider.get(); builder.eInit(getSarlBehavior(), name, getTypeResolutionContext()); return builder; }
java
public ISarlClassBuilder addSarlClass(String name) { ISarlClassBuilder builder = this.iSarlClassBuilderProvider.get(); builder.eInit(getSarlBehavior(), name, getTypeResolutionContext()); return builder; }
[ "public", "ISarlClassBuilder", "addSarlClass", "(", "String", "name", ")", "{", "ISarlClassBuilder", "builder", "=", "this", ".", "iSarlClassBuilderProvider", ".", "get", "(", ")", ";", "builder", ".", "eInit", "(", "getSarlBehavior", "(", ")", ",", "name", ",...
Create a SarlClass. @param name the name of the SarlClass. @return the builder.
[ "Create", "a", "SarlClass", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorBuilderImpl.java#L235-L239
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorBuilderImpl.java
SarlBehaviorBuilderImpl.addSarlCapacityUses
public void addSarlCapacityUses(String... name) { if (name != null && name.length > 0) { SarlCapacityUses member = SarlFactory.eINSTANCE.createSarlCapacityUses(); this.sarlBehavior.getMembers().add(member); member.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember()); Collection<JvmParameterizedTypeReference> thecollection = member.getCapacities(); for (final String aname : name) { if (!Strings.isEmpty(aname)) { thecollection.add(newTypeRef(this.sarlBehavior, aname)); } } } }
java
public void addSarlCapacityUses(String... name) { if (name != null && name.length > 0) { SarlCapacityUses member = SarlFactory.eINSTANCE.createSarlCapacityUses(); this.sarlBehavior.getMembers().add(member); member.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember()); Collection<JvmParameterizedTypeReference> thecollection = member.getCapacities(); for (final String aname : name) { if (!Strings.isEmpty(aname)) { thecollection.add(newTypeRef(this.sarlBehavior, aname)); } } } }
[ "public", "void", "addSarlCapacityUses", "(", "String", "...", "name", ")", "{", "if", "(", "name", "!=", "null", "&&", "name", ".", "length", ">", "0", ")", "{", "SarlCapacityUses", "member", "=", "SarlFactory", ".", "eINSTANCE", ".", "createSarlCapacityUse...
Create a SarlCapacityUses. @param name the types referenced by the SarlCapacityUses.
[ "Create", "a", "SarlCapacityUses", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorBuilderImpl.java#L283-L296
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorBuilderImpl.java
SarlBehaviorBuilderImpl.addSarlRequiredCapacity
public void addSarlRequiredCapacity(String... name) { if (name != null && name.length > 0) { SarlRequiredCapacity member = SarlFactory.eINSTANCE.createSarlRequiredCapacity(); this.sarlBehavior.getMembers().add(member); member.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember()); Collection<JvmParameterizedTypeReference> thecollection = member.getCapacities(); for (final String aname : name) { if (!Strings.isEmpty(aname)) { thecollection.add(newTypeRef(this.sarlBehavior, aname)); } } } }
java
public void addSarlRequiredCapacity(String... name) { if (name != null && name.length > 0) { SarlRequiredCapacity member = SarlFactory.eINSTANCE.createSarlRequiredCapacity(); this.sarlBehavior.getMembers().add(member); member.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember()); Collection<JvmParameterizedTypeReference> thecollection = member.getCapacities(); for (final String aname : name) { if (!Strings.isEmpty(aname)) { thecollection.add(newTypeRef(this.sarlBehavior, aname)); } } } }
[ "public", "void", "addSarlRequiredCapacity", "(", "String", "...", "name", ")", "{", "if", "(", "name", "!=", "null", "&&", "name", ".", "length", ">", "0", ")", "{", "SarlRequiredCapacity", "member", "=", "SarlFactory", ".", "eINSTANCE", ".", "createSarlReq...
Create a SarlRequiredCapacity. @param name the types referenced by the SarlRequiredCapacity.
[ "Create", "a", "SarlRequiredCapacity", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorBuilderImpl.java#L301-L314
train
sarl/sarl
products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/configs/SarlcConfigModule.java
SarlcConfigModule.getSarlcConfig
@SuppressWarnings("static-method") @Provides @Singleton public SarlConfig getSarlcConfig(ConfigurationFactory configFactory, Injector injector) { final SarlConfig config = SarlConfig.getConfiguration(configFactory); injector.injectMembers(config); return config; }
java
@SuppressWarnings("static-method") @Provides @Singleton public SarlConfig getSarlcConfig(ConfigurationFactory configFactory, Injector injector) { final SarlConfig config = SarlConfig.getConfiguration(configFactory); injector.injectMembers(config); return config; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "@", "Provides", "@", "Singleton", "public", "SarlConfig", "getSarlcConfig", "(", "ConfigurationFactory", "configFactory", ",", "Injector", "injector", ")", "{", "final", "SarlConfig", "config", "=", "SarlConfig"...
Replies the instance of the sarl configuration. @param configFactory accessor to the bootique factory. @param injector the current injector. @return the path configuration accessor.
[ "Replies", "the", "instance", "of", "the", "sarl", "configuration", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/configs/SarlcConfigModule.java#L135-L142
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/refactoring/rename/EcorePackageRenameStrategy.java
EcorePackageRenameStrategy.validatePackageName
public static RefactoringStatus validatePackageName(String newName) { if (!PACKAGE_NAME_PATTERN.matcher(newName).find()) { RefactoringStatus.createErrorStatus(MessageFormat.format(Messages.SARLJdtPackageRenameParticipant_0, newName)); } return new RefactoringStatus(); }
java
public static RefactoringStatus validatePackageName(String newName) { if (!PACKAGE_NAME_PATTERN.matcher(newName).find()) { RefactoringStatus.createErrorStatus(MessageFormat.format(Messages.SARLJdtPackageRenameParticipant_0, newName)); } return new RefactoringStatus(); }
[ "public", "static", "RefactoringStatus", "validatePackageName", "(", "String", "newName", ")", "{", "if", "(", "!", "PACKAGE_NAME_PATTERN", ".", "matcher", "(", "newName", ")", ".", "find", "(", ")", ")", "{", "RefactoringStatus", ".", "createErrorStatus", "(", ...
Validate the package name. @param newName the package name to be validated. @return the status of the validation.
[ "Validate", "the", "package", "name", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/refactoring/rename/EcorePackageRenameStrategy.java#L73-L78
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/refactoring/rename/EcorePackageRenameStrategy.java
EcorePackageRenameStrategy.setPackageName
protected void setPackageName(String newName, ResourceSet resourceSet) { final EObject object = resourceSet.getEObject(this.uriProvider.apply(resourceSet), true); if (object instanceof SarlScript) { ((SarlScript) object).setPackage(newName); } else { throw new RefactoringException("SARL script not loaded."); //$NON-NLS-1$ } }
java
protected void setPackageName(String newName, ResourceSet resourceSet) { final EObject object = resourceSet.getEObject(this.uriProvider.apply(resourceSet), true); if (object instanceof SarlScript) { ((SarlScript) object).setPackage(newName); } else { throw new RefactoringException("SARL script not loaded."); //$NON-NLS-1$ } }
[ "protected", "void", "setPackageName", "(", "String", "newName", ",", "ResourceSet", "resourceSet", ")", "{", "final", "EObject", "object", "=", "resourceSet", ".", "getEObject", "(", "this", ".", "uriProvider", ".", "apply", "(", "resourceSet", ")", ",", "tru...
Change the package name. @param newName the new name. @param resourceSet the set of resource to use.
[ "Change", "the", "package", "name", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/refactoring/rename/EcorePackageRenameStrategy.java#L106-L113
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/refactoring/rename/EcorePackageRenameStrategy.java
EcorePackageRenameStrategy.getDeclarationTextEdit
protected TextEdit getDeclarationTextEdit(String newName, ResourceSet resourceSet) { final EObject object = resourceSet.getEObject(this.uriProvider.apply(resourceSet), true); if (object instanceof SarlScript) { final ITextRegion region = getOriginalPackageRegion((SarlScript) object); if (region != null) { return new ReplaceEdit(region.getOffset(), region.getLength(), newName); } } throw new RefactoringException("SARL script not loaded."); //$NON-NLS-1$ }
java
protected TextEdit getDeclarationTextEdit(String newName, ResourceSet resourceSet) { final EObject object = resourceSet.getEObject(this.uriProvider.apply(resourceSet), true); if (object instanceof SarlScript) { final ITextRegion region = getOriginalPackageRegion((SarlScript) object); if (region != null) { return new ReplaceEdit(region.getOffset(), region.getLength(), newName); } } throw new RefactoringException("SARL script not loaded."); //$NON-NLS-1$ }
[ "protected", "TextEdit", "getDeclarationTextEdit", "(", "String", "newName", ",", "ResourceSet", "resourceSet", ")", "{", "final", "EObject", "object", "=", "resourceSet", ".", "getEObject", "(", "this", ".", "uriProvider", ".", "apply", "(", "resourceSet", ")", ...
Replies the text update for the rename. @param newName the new package name. @param resourceSet the set of resources. @return the text update.
[ "Replies", "the", "text", "update", "for", "the", "rename", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/refactoring/rename/EcorePackageRenameStrategy.java#L138-L147
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/refactoring/rename/EcorePackageRenameStrategy.java
EcorePackageRenameStrategy.getOriginalPackageRegion
protected ITextRegion getOriginalPackageRegion(final SarlScript script) { return this.locationInFileProvider.getFullTextRegion(script, XtendPackage.Literals.XTEND_FILE__PACKAGE, 0); }
java
protected ITextRegion getOriginalPackageRegion(final SarlScript script) { return this.locationInFileProvider.getFullTextRegion(script, XtendPackage.Literals.XTEND_FILE__PACKAGE, 0); }
[ "protected", "ITextRegion", "getOriginalPackageRegion", "(", "final", "SarlScript", "script", ")", "{", "return", "this", ".", "locationInFileProvider", ".", "getFullTextRegion", "(", "script", ",", "XtendPackage", ".", "Literals", ".", "XTEND_FILE__PACKAGE", ",", "0"...
Replies the text region that is corresponding to the package name. @param script the script. @return the region.
[ "Replies", "the", "text", "region", "that", "is", "corresponding", "to", "the", "package", "name", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/refactoring/rename/EcorePackageRenameStrategy.java#L154-L157
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java
SarlDocumentationParser.setOutputLanguage
@Inject public void setOutputLanguage(@Named(Constants.LANGUAGE_NAME) String outputLanguage) { if (!Strings.isNullOrEmpty(outputLanguage)) { final String[] parts = outputLanguage.split("\\.+"); //$NON-NLS-1$ if (parts.length > 0) { final String simpleName = parts[parts.length - 1]; if (!Strings.isNullOrEmpty(simpleName)) { this.languageName = simpleName; return; } } } this.languageName = null; }
java
@Inject public void setOutputLanguage(@Named(Constants.LANGUAGE_NAME) String outputLanguage) { if (!Strings.isNullOrEmpty(outputLanguage)) { final String[] parts = outputLanguage.split("\\.+"); //$NON-NLS-1$ if (parts.length > 0) { final String simpleName = parts[parts.length - 1]; if (!Strings.isNullOrEmpty(simpleName)) { this.languageName = simpleName; return; } } } this.languageName = null; }
[ "@", "Inject", "public", "void", "setOutputLanguage", "(", "@", "Named", "(", "Constants", ".", "LANGUAGE_NAME", ")", "String", "outputLanguage", ")", "{", "if", "(", "!", "Strings", ".", "isNullOrEmpty", "(", "outputLanguage", ")", ")", "{", "final", "Strin...
Change the name of the language. @param outputLanguage the language name, or {@code null} for ignoring the language name.
[ "Change", "the", "name", "of", "the", "language", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L136-L149
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java
SarlDocumentationParser.getFencedCodeBlockFormatter
public static Function2<String, String, String> getFencedCodeBlockFormatter() { return (languageName, content) -> { /*final StringBuilder result = new StringBuilder(); result.append("<div class=\\\"highlight"); //$NON-NLS-1$ if (!Strings.isNullOrEmpty(languageName)) { result.append(" highlight-").append(languageName); //$NON-NLS-1$ } result.append("\"><pre>\n").append(content).append("</pre></div>\n"); //$NON-NLS-1$ //$NON-NLS-2$ return result.toString();*/ return "```" + Strings.nullToEmpty(languageName).toLowerCase() + "\n" //$NON-NLS-1$ //$NON-NLS-2$ + content + "```\n"; //$NON-NLS-1$ }; }
java
public static Function2<String, String, String> getFencedCodeBlockFormatter() { return (languageName, content) -> { /*final StringBuilder result = new StringBuilder(); result.append("<div class=\\\"highlight"); //$NON-NLS-1$ if (!Strings.isNullOrEmpty(languageName)) { result.append(" highlight-").append(languageName); //$NON-NLS-1$ } result.append("\"><pre>\n").append(content).append("</pre></div>\n"); //$NON-NLS-1$ //$NON-NLS-2$ return result.toString();*/ return "```" + Strings.nullToEmpty(languageName).toLowerCase() + "\n" //$NON-NLS-1$ //$NON-NLS-2$ + content + "```\n"; //$NON-NLS-1$ }; }
[ "public", "static", "Function2", "<", "String", ",", "String", ",", "String", ">", "getFencedCodeBlockFormatter", "(", ")", "{", "return", "(", "languageName", ",", "content", ")", "->", "{", "/*final StringBuilder result = new StringBuilder();\r\n\t\t\tresult.append(\"<d...
Replies the fenced code block formatter. <p>This code block formatter is usually used by Github. @return the formatter.
[ "Replies", "the", "fenced", "code", "block", "formatter", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L190-L203
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java
SarlDocumentationParser.getBasicCodeBlockFormatter
public static Function2<String, String, String> getBasicCodeBlockFormatter() { return (languageName, content) -> { return Pattern.compile("^", Pattern.MULTILINE).matcher(content).replaceAll("\t"); //$NON-NLS-1$ //$NON-NLS-2$ }; }
java
public static Function2<String, String, String> getBasicCodeBlockFormatter() { return (languageName, content) -> { return Pattern.compile("^", Pattern.MULTILINE).matcher(content).replaceAll("\t"); //$NON-NLS-1$ //$NON-NLS-2$ }; }
[ "public", "static", "Function2", "<", "String", ",", "String", ",", "String", ">", "getBasicCodeBlockFormatter", "(", ")", "{", "return", "(", "languageName", ",", "content", ")", "->", "{", "return", "Pattern", ".", "compile", "(", "\"^\"", ",", "Pattern", ...
Replies the basic code block formatter. @return the formatter.
[ "Replies", "the", "basic", "code", "block", "formatter", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L209-L213
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java
SarlDocumentationParser.reset
public void reset() { this.rawPatterns.clear(); this.compiledPatterns.clear(); this.inlineFormat = DEFAULT_INLINE_FORMAT; this.blockFormat = null; this.outlineOutputTag = DEFAULT_OUTLINE_OUTPUT_TAG; this.dynamicNameExtractionPattern = DEFAULT_TAG_NAME_PATTERN; this.lineContinuation = DEFAULT_LINE_CONTINUATION; }
java
public void reset() { this.rawPatterns.clear(); this.compiledPatterns.clear(); this.inlineFormat = DEFAULT_INLINE_FORMAT; this.blockFormat = null; this.outlineOutputTag = DEFAULT_OUTLINE_OUTPUT_TAG; this.dynamicNameExtractionPattern = DEFAULT_TAG_NAME_PATTERN; this.lineContinuation = DEFAULT_LINE_CONTINUATION; }
[ "public", "void", "reset", "(", ")", "{", "this", ".", "rawPatterns", ".", "clear", "(", ")", ";", "this", ".", "compiledPatterns", ".", "clear", "(", ")", ";", "this", ".", "inlineFormat", "=", "DEFAULT_INLINE_FORMAT", ";", "this", ".", "blockFormat", "...
Reset to the default settings.
[ "Reset", "to", "the", "default", "settings", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L244-L252
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java
SarlDocumentationParser.setPattern
public void setPattern(Tag tag, String regex) { if (Strings.isNullOrEmpty(regex)) { this.rawPatterns.remove(tag); this.compiledPatterns.remove(tag); } else { this.rawPatterns.put(tag, regex); this.compiledPatterns.put(tag, Pattern.compile("^\\s*" + regex, PATTERN_COMPILE_OPTIONS)); //$NON-NLS-1$ } }
java
public void setPattern(Tag tag, String regex) { if (Strings.isNullOrEmpty(regex)) { this.rawPatterns.remove(tag); this.compiledPatterns.remove(tag); } else { this.rawPatterns.put(tag, regex); this.compiledPatterns.put(tag, Pattern.compile("^\\s*" + regex, PATTERN_COMPILE_OPTIONS)); //$NON-NLS-1$ } }
[ "public", "void", "setPattern", "(", "Tag", "tag", ",", "String", "regex", ")", "{", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "regex", ")", ")", "{", "this", ".", "rawPatterns", ".", "remove", "(", "tag", ")", ";", "this", ".", "compiledPattern...
Change the pattern of the tag. @param tag the tag. @param regex the regular expression.
[ "Change", "the", "pattern", "of", "the", "tag", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L289-L297
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java
SarlDocumentationParser.getPattern
public String getPattern(Tag tag) { final String pattern = this.rawPatterns.get(tag); if (pattern == null) { return tag.getDefaultPattern(); } return pattern; }
java
public String getPattern(Tag tag) { final String pattern = this.rawPatterns.get(tag); if (pattern == null) { return tag.getDefaultPattern(); } return pattern; }
[ "public", "String", "getPattern", "(", "Tag", "tag", ")", "{", "final", "String", "pattern", "=", "this", ".", "rawPatterns", ".", "get", "(", "tag", ")", ";", "if", "(", "pattern", "==", "null", ")", "{", "return", "tag", ".", "getDefaultPattern", "("...
Replies the pattern of the tag. @param tag the tag. @return the regular expression pattern.
[ "Replies", "the", "pattern", "of", "the", "tag", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L304-L310
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java
SarlDocumentationParser.getTagForPattern
public Tag getTagForPattern(CharSequence text) { for (final Tag tag : Tag.values()) { Pattern pattern = this.compiledPatterns.get(tag); if (pattern == null) { pattern = Pattern.compile("^\\s*" + getPattern(tag), Pattern.DOTALL); //$NON-NLS-1$ this.compiledPatterns.put(tag, pattern); } final Matcher matcher = pattern.matcher(text); if (matcher.find()) { return tag; } } return null; }
java
public Tag getTagForPattern(CharSequence text) { for (final Tag tag : Tag.values()) { Pattern pattern = this.compiledPatterns.get(tag); if (pattern == null) { pattern = Pattern.compile("^\\s*" + getPattern(tag), Pattern.DOTALL); //$NON-NLS-1$ this.compiledPatterns.put(tag, pattern); } final Matcher matcher = pattern.matcher(text); if (matcher.find()) { return tag; } } return null; }
[ "public", "Tag", "getTagForPattern", "(", "CharSequence", "text", ")", "{", "for", "(", "final", "Tag", "tag", ":", "Tag", ".", "values", "(", ")", ")", "{", "Pattern", "pattern", "=", "this", ".", "compiledPatterns", ".", "get", "(", "tag", ")", ";", ...
Replies the tag that is matching the given text. @param text the text to match. @return the tag or {@code null}.
[ "Replies", "the", "tag", "that", "is", "matching", "the", "given", "text", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L317-L330
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java
SarlDocumentationParser.getLineSeparator
public String getLineSeparator() { if (Strings.isNullOrEmpty(this.lineSeparator)) { final String nl = System.getProperty("line.separator"); //$NON-NLS-1$ if (Strings.isNullOrEmpty(nl)) { return "\n"; //$NON-NLS-1$ } return nl; } return this.lineSeparator; }
java
public String getLineSeparator() { if (Strings.isNullOrEmpty(this.lineSeparator)) { final String nl = System.getProperty("line.separator"); //$NON-NLS-1$ if (Strings.isNullOrEmpty(nl)) { return "\n"; //$NON-NLS-1$ } return nl; } return this.lineSeparator; }
[ "public", "String", "getLineSeparator", "(", ")", "{", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "this", ".", "lineSeparator", ")", ")", "{", "final", "String", "nl", "=", "System", ".", "getProperty", "(", "\"line.separator\"", ")", ";", "//$NON-NLS-...
Replies the OS-dependent line separator. @return the line separator from the {@code "line.separator"} property, or {@code "\n"}.
[ "Replies", "the", "OS", "-", "dependent", "line", "separator", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L560-L569
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java
SarlDocumentationParser.extractDynamicName
protected void extractDynamicName(Tag tag, CharSequence name, OutParameter<String> dynamicName) { if (tag.hasDynamicName()) { final Pattern pattern = Pattern.compile(getDynamicNameExtractionPattern()); final Matcher matcher = pattern.matcher(name); if (matcher.matches()) { dynamicName.set(Strings.nullToEmpty(matcher.group(1))); return; } } dynamicName.set(name.toString()); }
java
protected void extractDynamicName(Tag tag, CharSequence name, OutParameter<String> dynamicName) { if (tag.hasDynamicName()) { final Pattern pattern = Pattern.compile(getDynamicNameExtractionPattern()); final Matcher matcher = pattern.matcher(name); if (matcher.matches()) { dynamicName.set(Strings.nullToEmpty(matcher.group(1))); return; } } dynamicName.set(name.toString()); }
[ "protected", "void", "extractDynamicName", "(", "Tag", "tag", ",", "CharSequence", "name", ",", "OutParameter", "<", "String", ">", "dynamicName", ")", "{", "if", "(", "tag", ".", "hasDynamicName", "(", ")", ")", "{", "final", "Pattern", "pattern", "=", "P...
Extract the dynamic name of that from the raw text. @param tag the tag to extract for. @param name the raw text. @param dynamicName the dynamic name.
[ "Extract", "the", "dynamic", "name", "of", "that", "from", "the", "raw", "text", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L621-L631
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java
SarlDocumentationParser.transform
public String transform(File inputFile) { final String content; try (FileReader reader = new FileReader(inputFile)) { content = read(reader); } catch (IOException exception) { reportError(Messages.SarlDocumentationParser_0, exception); return null; } return transform(content, inputFile); }
java
public String transform(File inputFile) { final String content; try (FileReader reader = new FileReader(inputFile)) { content = read(reader); } catch (IOException exception) { reportError(Messages.SarlDocumentationParser_0, exception); return null; } return transform(content, inputFile); }
[ "public", "String", "transform", "(", "File", "inputFile", ")", "{", "final", "String", "content", ";", "try", "(", "FileReader", "reader", "=", "new", "FileReader", "(", "inputFile", ")", ")", "{", "content", "=", "read", "(", "reader", ")", ";", "}", ...
Read the given file and transform its content in order to have a raw text. @param inputFile the input file. @return the raw file context.
[ "Read", "the", "given", "file", "and", "transform", "its", "content", "in", "order", "to", "have", "a", "raw", "text", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L649-L658
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java
SarlDocumentationParser.postProcessing
protected String postProcessing(CharSequence text) { final String lineContinuation = getLineContinuation(); if (lineContinuation != null) { final Pattern pattern = Pattern.compile( "\\s*\\\\[\\n\\r]+\\s*", //$NON-NLS-1$ Pattern.DOTALL); final Matcher matcher = pattern.matcher(text.toString().trim()); return matcher.replaceAll(lineContinuation); } return text.toString().trim(); }
java
protected String postProcessing(CharSequence text) { final String lineContinuation = getLineContinuation(); if (lineContinuation != null) { final Pattern pattern = Pattern.compile( "\\s*\\\\[\\n\\r]+\\s*", //$NON-NLS-1$ Pattern.DOTALL); final Matcher matcher = pattern.matcher(text.toString().trim()); return matcher.replaceAll(lineContinuation); } return text.toString().trim(); }
[ "protected", "String", "postProcessing", "(", "CharSequence", "text", ")", "{", "final", "String", "lineContinuation", "=", "getLineContinuation", "(", ")", ";", "if", "(", "lineContinuation", "!=", "null", ")", "{", "final", "Pattern", "pattern", "=", "Pattern"...
Do a post processing of the text. @param text the text to post process. @return the post-processed text.
[ "Do", "a", "post", "processing", "of", "the", "text", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L716-L726
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java
SarlDocumentationParser.formatBlockText
protected static String formatBlockText(String content, String languageName, Function2<String, String, String> blockFormat) { String replacement = Strings.nullToEmpty(content); final String[] lines = replacement.trim().split("[\n\r]+"); //$NON-NLS-1$ int minIndent = Integer.MAX_VALUE; final Pattern wpPattern = Pattern.compile("^(\\s*)[^\\s]"); //$NON-NLS-1$ for (int i = lines.length > 1 ? 1 : 0; i < lines.length; ++i) { final String line = lines[i]; final Matcher matcher = wpPattern.matcher(line); if (matcher.find()) { final int n = matcher.group(1).length(); if (n < minIndent) { minIndent = n; if (minIndent <= 0) { break; } } } } final StringBuilder buffer = new StringBuilder(); buffer.append(lines[0]); buffer.append("\n"); //$NON-NLS-1$ for (int i = 1; i < lines.length; ++i) { final String line = lines[i]; buffer.append(line.replaceFirst("^\\s{0," + minIndent + "}", "")); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ buffer.append("\n"); //$NON-NLS-1$ } replacement = buffer.toString().replaceFirst("[\n\r]+$", "\n"); //$NON-NLS-1$ //$NON-NLS-2$ if (!Strings.isNullOrEmpty(replacement) && !"\n".equals(replacement)) { //$NON-NLS-1$ if (blockFormat != null) { return blockFormat.apply(languageName, replacement); } return replacement; } return ""; //$NON-NLS-1$ }
java
protected static String formatBlockText(String content, String languageName, Function2<String, String, String> blockFormat) { String replacement = Strings.nullToEmpty(content); final String[] lines = replacement.trim().split("[\n\r]+"); //$NON-NLS-1$ int minIndent = Integer.MAX_VALUE; final Pattern wpPattern = Pattern.compile("^(\\s*)[^\\s]"); //$NON-NLS-1$ for (int i = lines.length > 1 ? 1 : 0; i < lines.length; ++i) { final String line = lines[i]; final Matcher matcher = wpPattern.matcher(line); if (matcher.find()) { final int n = matcher.group(1).length(); if (n < minIndent) { minIndent = n; if (minIndent <= 0) { break; } } } } final StringBuilder buffer = new StringBuilder(); buffer.append(lines[0]); buffer.append("\n"); //$NON-NLS-1$ for (int i = 1; i < lines.length; ++i) { final String line = lines[i]; buffer.append(line.replaceFirst("^\\s{0," + minIndent + "}", "")); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ buffer.append("\n"); //$NON-NLS-1$ } replacement = buffer.toString().replaceFirst("[\n\r]+$", "\n"); //$NON-NLS-1$ //$NON-NLS-2$ if (!Strings.isNullOrEmpty(replacement) && !"\n".equals(replacement)) { //$NON-NLS-1$ if (blockFormat != null) { return blockFormat.apply(languageName, replacement); } return replacement; } return ""; //$NON-NLS-1$ }
[ "protected", "static", "String", "formatBlockText", "(", "String", "content", ",", "String", "languageName", ",", "Function2", "<", "String", ",", "String", ",", "String", ">", "blockFormat", ")", "{", "String", "replacement", "=", "Strings", ".", "nullToEmpty",...
Format the given text in order to be suitable for being output as a block. @param content the text. @param languageName the name of the output language. @param blockFormat the formatting template. @return the formatted text.
[ "Format", "the", "given", "text", "in", "order", "to", "be", "suitable", "for", "being", "output", "as", "a", "block", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L1055-L1089
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/DocumentationBuilderFragment.java
DocumentationBuilderFragment.generateInnerDocumentationAdapter
protected void generateInnerDocumentationAdapter() { final TypeReference adapter = getCodeElementExtractor().getInnerBlockDocumentationAdapter(); final StringConcatenationClient content = new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { it.append("public class "); //$NON-NLS-1$ it.append(adapter.getSimpleName()); it.append(" extends "); //$NON-NLS-1$ it.append(AdapterImpl.class); it.append(" {"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\tprivate String documentation;"); //$NON-NLS-1$ it.newLine(); it.append("\t@"); //$NON-NLS-1$ it.append(Pure.class); it.newLine(); it.append("\tpublic String getDocumentation() {"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\t\treturn this.documentation;"); //$NON-NLS-1$ it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\tpublic void setDocumentation(String documentation) {"); //$NON-NLS-1$ it.newLine(); it.append("\t\tthis.documentation = documentation;"); //$NON-NLS-1$ it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\t@"); //$NON-NLS-1$ it.append(Pure.class); it.newLine(); it.append("\tpublic boolean isAdapterForType(Object type) {"); //$NON-NLS-1$ it.newLine(); it.append("\t\treturn type == "); //$NON-NLS-1$ it.append(adapter.getSimpleName()); it.append(".class;"); //$NON-NLS-1$ it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); } }; final JavaFileAccess createJavaFile = getFileAccessFactory().createJavaFile(adapter, content); createJavaFile.writeTo(getSrcGen()); }
java
protected void generateInnerDocumentationAdapter() { final TypeReference adapter = getCodeElementExtractor().getInnerBlockDocumentationAdapter(); final StringConcatenationClient content = new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { it.append("public class "); //$NON-NLS-1$ it.append(adapter.getSimpleName()); it.append(" extends "); //$NON-NLS-1$ it.append(AdapterImpl.class); it.append(" {"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\tprivate String documentation;"); //$NON-NLS-1$ it.newLine(); it.append("\t@"); //$NON-NLS-1$ it.append(Pure.class); it.newLine(); it.append("\tpublic String getDocumentation() {"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\t\treturn this.documentation;"); //$NON-NLS-1$ it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\tpublic void setDocumentation(String documentation) {"); //$NON-NLS-1$ it.newLine(); it.append("\t\tthis.documentation = documentation;"); //$NON-NLS-1$ it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("\t@"); //$NON-NLS-1$ it.append(Pure.class); it.newLine(); it.append("\tpublic boolean isAdapterForType(Object type) {"); //$NON-NLS-1$ it.newLine(); it.append("\t\treturn type == "); //$NON-NLS-1$ it.append(adapter.getSimpleName()); it.append(".class;"); //$NON-NLS-1$ it.newLine(); it.append("\t}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); it.newLine(); it.append("}"); //$NON-NLS-1$ it.newLineIfNotEmpty(); } }; final JavaFileAccess createJavaFile = getFileAccessFactory().createJavaFile(adapter, content); createJavaFile.writeTo(getSrcGen()); }
[ "protected", "void", "generateInnerDocumentationAdapter", "(", ")", "{", "final", "TypeReference", "adapter", "=", "getCodeElementExtractor", "(", ")", ".", "getInnerBlockDocumentationAdapter", "(", ")", ";", "final", "StringConcatenationClient", "content", "=", "new", ...
Generate the adapter that supports the inner documentation.
[ "Generate", "the", "adapter", "that", "supports", "the", "inner", "documentation", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/DocumentationBuilderFragment.java#L224-L275
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/editor/SARLSourceViewerPreferenceAccess.java
SARLSourceViewerPreferenceAccess.setAutoFormattingEnabled
public void setAutoFormattingEnabled(Boolean enable) { final IPreferenceStore store = getWritablePreferenceStore(null); if (enable == null) { store.setToDefault(AUTOFORMATTING_PROPERTY); } else { store.setValue(AUTOFORMATTING_PROPERTY, enable.booleanValue()); } }
java
public void setAutoFormattingEnabled(Boolean enable) { final IPreferenceStore store = getWritablePreferenceStore(null); if (enable == null) { store.setToDefault(AUTOFORMATTING_PROPERTY); } else { store.setValue(AUTOFORMATTING_PROPERTY, enable.booleanValue()); } }
[ "public", "void", "setAutoFormattingEnabled", "(", "Boolean", "enable", ")", "{", "final", "IPreferenceStore", "store", "=", "getWritablePreferenceStore", "(", "null", ")", ";", "if", "(", "enable", "==", "null", ")", "{", "store", ".", "setToDefault", "(", "A...
Enable or disable the auto-formatting feature into the SARL editor. @param enable is {@code true} if it is enabled; {@code false} if it is disable; {@code null} to restore the default value. @since 0.8 @see #getWritablePreferenceStore(Object)
[ "Enable", "or", "disable", "the", "auto", "-", "formatting", "feature", "into", "the", "SARL", "editor", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/editor/SARLSourceViewerPreferenceAccess.java#L69-L76
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlActionBuilderImpl.java
SarlActionBuilderImpl.setReturnType
public void setReturnType(String type) { if (!Strings.isEmpty(type) && !Objects.equals("void", type) && !Objects.equals(Void.class.getName(), type)) { this.sarlAction.setReturnType(newTypeRef(container, type)); } else { this.sarlAction.setReturnType(null); } }
java
public void setReturnType(String type) { if (!Strings.isEmpty(type) && !Objects.equals("void", type) && !Objects.equals(Void.class.getName(), type)) { this.sarlAction.setReturnType(newTypeRef(container, type)); } else { this.sarlAction.setReturnType(null); } }
[ "public", "void", "setReturnType", "(", "String", "type", ")", "{", "if", "(", "!", "Strings", ".", "isEmpty", "(", "type", ")", "&&", "!", "Objects", ".", "equals", "(", "\"void\"", ",", "type", ")", "&&", "!", "Objects", ".", "equals", "(", "Void",...
Change the return type. @param type the return type of the member.
[ "Change", "the", "return", "type", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlActionBuilderImpl.java#L147-L155
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlActionBuilderImpl.java
SarlActionBuilderImpl.addAnnotation
public void addAnnotation(String type) { if (!Strings.isEmpty(type)) { XAnnotation annotation = XAnnotationsFactory.eINSTANCE.createXAnnotation(); annotation.setAnnotationType(newTypeRef(getSarlAction(), type).getType()); getSarlAction().getAnnotations().add(annotation); } }
java
public void addAnnotation(String type) { if (!Strings.isEmpty(type)) { XAnnotation annotation = XAnnotationsFactory.eINSTANCE.createXAnnotation(); annotation.setAnnotationType(newTypeRef(getSarlAction(), type).getType()); getSarlAction().getAnnotations().add(annotation); } }
[ "public", "void", "addAnnotation", "(", "String", "type", ")", "{", "if", "(", "!", "Strings", ".", "isEmpty", "(", "type", ")", ")", "{", "XAnnotation", "annotation", "=", "XAnnotationsFactory", ".", "eINSTANCE", ".", "createXAnnotation", "(", ")", ";", "...
Add an annotation. @param type the qualified name of the annotation
[ "Add", "an", "annotation", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlActionBuilderImpl.java#L171-L177
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java
LoggerCreator.useJanusMessageFormat
public static void useJanusMessageFormat() { final String format = System.getProperty(FORMAT_PROPERTY_KEY, null); if (format == null || format.isEmpty()) { System.setProperty(FORMAT_PROPERTY_KEY, JANUS_FORMAT); } }
java
public static void useJanusMessageFormat() { final String format = System.getProperty(FORMAT_PROPERTY_KEY, null); if (format == null || format.isEmpty()) { System.setProperty(FORMAT_PROPERTY_KEY, JANUS_FORMAT); } }
[ "public", "static", "void", "useJanusMessageFormat", "(", ")", "{", "final", "String", "format", "=", "System", ".", "getProperty", "(", "FORMAT_PROPERTY_KEY", ",", "null", ")", ";", "if", "(", "format", "==", "null", "||", "format", ".", "isEmpty", "(", "...
Change the configuration of the root logger for using the Janus format for the messages.
[ "Change", "the", "configuration", "of", "the", "root", "logger", "for", "using", "the", "Janus", "format", "for", "the", "messages", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java#L67-L72
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java
LoggerCreator.createPlatformLogger
public static Logger createPlatformLogger() { final Logger logger = Logger.getAnonymousLogger(); for (final Handler handler : logger.getHandlers()) { logger.removeHandler(handler); } final Handler stderr = new StandardErrorOutputConsoleHandler(); stderr.setLevel(Level.ALL); final Handler stdout = new StandardOutputConsoleHandler(); stdout.setLevel(Level.ALL); logger.addHandler(stderr); logger.addHandler(stdout); logger.setUseParentHandlers(false); logger.setLevel(Level.ALL); return logger; }
java
public static Logger createPlatformLogger() { final Logger logger = Logger.getAnonymousLogger(); for (final Handler handler : logger.getHandlers()) { logger.removeHandler(handler); } final Handler stderr = new StandardErrorOutputConsoleHandler(); stderr.setLevel(Level.ALL); final Handler stdout = new StandardOutputConsoleHandler(); stdout.setLevel(Level.ALL); logger.addHandler(stderr); logger.addHandler(stdout); logger.setUseParentHandlers(false); logger.setLevel(Level.ALL); return logger; }
[ "public", "static", "Logger", "createPlatformLogger", "(", ")", "{", "final", "Logger", "logger", "=", "Logger", ".", "getAnonymousLogger", "(", ")", ";", "for", "(", "final", "Handler", "handler", ":", "logger", ".", "getHandlers", "(", ")", ")", "{", "lo...
Create a logger with the given name for the platform. <p>The platform logger has the level {@link Level#ALL}. It override the output handlers with handlers for the standard output and standard error. The platform logger is a root logger. @return the logger.
[ "Create", "a", "logger", "with", "the", "given", "name", "for", "the", "platform", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java#L83-L97
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java
LoggerCreator.getLoggingLevelFromProperties
public static Level getLoggingLevelFromProperties() { if (levelFromProperties == null) { final String verboseLevel = JanusConfig.getSystemProperty(JanusConfig.VERBOSE_LEVEL_NAME, JanusConfig.VERBOSE_LEVEL_VALUE); levelFromProperties = parseLoggingLevel(verboseLevel); } return levelFromProperties; }
java
public static Level getLoggingLevelFromProperties() { if (levelFromProperties == null) { final String verboseLevel = JanusConfig.getSystemProperty(JanusConfig.VERBOSE_LEVEL_NAME, JanusConfig.VERBOSE_LEVEL_VALUE); levelFromProperties = parseLoggingLevel(verboseLevel); } return levelFromProperties; }
[ "public", "static", "Level", "getLoggingLevelFromProperties", "(", ")", "{", "if", "(", "levelFromProperties", "==", "null", ")", "{", "final", "String", "verboseLevel", "=", "JanusConfig", ".", "getSystemProperty", "(", "JanusConfig", ".", "VERBOSE_LEVEL_NAME", ","...
Extract the logging level from the system properties. @return the logging level.
[ "Extract", "the", "logging", "level", "from", "the", "system", "properties", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java#L126-L132
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java
LoggerCreator.parseLoggingLevel
@SuppressWarnings({ "checkstyle:returncount", "checkstyle:cyclomaticcomplexity" }) public static Level parseLoggingLevel(String level) { if (level == null) { return Level.INFO; } switch (level.toLowerCase()) { case "none": //$NON-NLS-1$ case "false": //$NON-NLS-1$ case "0": //$NON-NLS-1$ return Level.OFF; case "severe": //$NON-NLS-1$ case "error": //$NON-NLS-1$ case "1": //$NON-NLS-1$ return Level.SEVERE; case "warn": //$NON-NLS-1$ case "warning": //$NON-NLS-1$ case "2": //$NON-NLS-1$ return Level.WARNING; case "info": //$NON-NLS-1$ case "true": //$NON-NLS-1$ case "3": //$NON-NLS-1$ return Level.INFO; case "fine": //$NON-NLS-1$ case "config": //$NON-NLS-1$ case "4": //$NON-NLS-1$ return Level.FINE; case "finer": //$NON-NLS-1$ case "5": //$NON-NLS-1$ return Level.FINER; case "finest": //$NON-NLS-1$ case "debug": //$NON-NLS-1$ case "6": //$NON-NLS-1$ return Level.FINEST; case "all": //$NON-NLS-1$ case "7": //$NON-NLS-1$ return Level.ALL; default: try { return fromInt(Integer.parseInt(level)); } catch (Throwable exception) { // } return Level.INFO; } }
java
@SuppressWarnings({ "checkstyle:returncount", "checkstyle:cyclomaticcomplexity" }) public static Level parseLoggingLevel(String level) { if (level == null) { return Level.INFO; } switch (level.toLowerCase()) { case "none": //$NON-NLS-1$ case "false": //$NON-NLS-1$ case "0": //$NON-NLS-1$ return Level.OFF; case "severe": //$NON-NLS-1$ case "error": //$NON-NLS-1$ case "1": //$NON-NLS-1$ return Level.SEVERE; case "warn": //$NON-NLS-1$ case "warning": //$NON-NLS-1$ case "2": //$NON-NLS-1$ return Level.WARNING; case "info": //$NON-NLS-1$ case "true": //$NON-NLS-1$ case "3": //$NON-NLS-1$ return Level.INFO; case "fine": //$NON-NLS-1$ case "config": //$NON-NLS-1$ case "4": //$NON-NLS-1$ return Level.FINE; case "finer": //$NON-NLS-1$ case "5": //$NON-NLS-1$ return Level.FINER; case "finest": //$NON-NLS-1$ case "debug": //$NON-NLS-1$ case "6": //$NON-NLS-1$ return Level.FINEST; case "all": //$NON-NLS-1$ case "7": //$NON-NLS-1$ return Level.ALL; default: try { return fromInt(Integer.parseInt(level)); } catch (Throwable exception) { // } return Level.INFO; } }
[ "@", "SuppressWarnings", "(", "{", "\"checkstyle:returncount\"", ",", "\"checkstyle:cyclomaticcomplexity\"", "}", ")", "public", "static", "Level", "parseLoggingLevel", "(", "String", "level", ")", "{", "if", "(", "level", "==", "null", ")", "{", "return", "Level"...
Extract the logging level from the given string. @param level - the string representation of the logging level. @return the logging level.
[ "Extract", "the", "logging", "level", "from", "the", "given", "string", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java#L141-L185
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java
LoggerCreator.fromInt
@SuppressWarnings({ "checkstyle:magicnumber", "checkstyle:returncount" }) public static Level fromInt(int num) { switch (num) { case 0: return Level.OFF; case 1: return Level.SEVERE; case 2: return Level.WARNING; case 3: return Level.INFO; case 4: return Level.FINE; case 5: return Level.FINER; case 6: return Level.FINEST; case 7: return Level.ALL; default: if (num < 0) { return Level.OFF; } return Level.ALL; } }
java
@SuppressWarnings({ "checkstyle:magicnumber", "checkstyle:returncount" }) public static Level fromInt(int num) { switch (num) { case 0: return Level.OFF; case 1: return Level.SEVERE; case 2: return Level.WARNING; case 3: return Level.INFO; case 4: return Level.FINE; case 5: return Level.FINER; case 6: return Level.FINEST; case 7: return Level.ALL; default: if (num < 0) { return Level.OFF; } return Level.ALL; } }
[ "@", "SuppressWarnings", "(", "{", "\"checkstyle:magicnumber\"", ",", "\"checkstyle:returncount\"", "}", ")", "public", "static", "Level", "fromInt", "(", "int", "num", ")", "{", "switch", "(", "num", ")", "{", "case", "0", ":", "return", "Level", ".", "OFF"...
Convert a numerical representation of logging level to the logging level. @param num - the numerical index that corresponds to the given level. @return the logging level.
[ "Convert", "a", "numerical", "representation", "of", "logging", "level", "to", "the", "logging", "level", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java#L194-L219
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java
LoggerCreator.toInt
@SuppressWarnings({ "checkstyle:magicnumber", "checkstyle:returncount", "checkstyle:npathcomplexity" }) public static int toInt(Level level) { if (level == Level.OFF) { return 0; } if (level == Level.SEVERE) { return 1; } if (level == Level.WARNING) { return 2; } if (level == Level.INFO) { return 3; } if (level == Level.CONFIG) { return 4; } if (level == Level.FINE) { return 4; } if (level == Level.FINER) { return 5; } if (level == Level.FINEST) { return 6; } if (level == Level.ALL) { return 7; } return 3; }
java
@SuppressWarnings({ "checkstyle:magicnumber", "checkstyle:returncount", "checkstyle:npathcomplexity" }) public static int toInt(Level level) { if (level == Level.OFF) { return 0; } if (level == Level.SEVERE) { return 1; } if (level == Level.WARNING) { return 2; } if (level == Level.INFO) { return 3; } if (level == Level.CONFIG) { return 4; } if (level == Level.FINE) { return 4; } if (level == Level.FINER) { return 5; } if (level == Level.FINEST) { return 6; } if (level == Level.ALL) { return 7; } return 3; }
[ "@", "SuppressWarnings", "(", "{", "\"checkstyle:magicnumber\"", ",", "\"checkstyle:returncount\"", ",", "\"checkstyle:npathcomplexity\"", "}", ")", "public", "static", "int", "toInt", "(", "Level", "level", ")", "{", "if", "(", "level", "==", "Level", ".", "OFF",...
Convert a logging level to its numerical equivalent. @param level - the logging level. @return the numerical index that corresponds to the given level.
[ "Convert", "a", "logging", "level", "to", "its", "numerical", "equivalent", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java#L228-L258
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/Services.java
Services.startServices
public static void startServices(IServiceManager manager) { final List<Service> otherServices = new ArrayList<>(); final List<Service> infraServices = new ArrayList<>(); final LinkedList<DependencyNode> serviceQueue = new LinkedList<>(); final Accessors accessors = new StartingPhaseAccessors(); // Build the dependency graph buildDependencyGraph(manager, serviceQueue, infraServices, otherServices, accessors); // Launch the services runDependencyGraph(serviceQueue, infraServices, otherServices, accessors); manager.awaitHealthy(); }
java
public static void startServices(IServiceManager manager) { final List<Service> otherServices = new ArrayList<>(); final List<Service> infraServices = new ArrayList<>(); final LinkedList<DependencyNode> serviceQueue = new LinkedList<>(); final Accessors accessors = new StartingPhaseAccessors(); // Build the dependency graph buildDependencyGraph(manager, serviceQueue, infraServices, otherServices, accessors); // Launch the services runDependencyGraph(serviceQueue, infraServices, otherServices, accessors); manager.awaitHealthy(); }
[ "public", "static", "void", "startServices", "(", "IServiceManager", "manager", ")", "{", "final", "List", "<", "Service", ">", "otherServices", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "List", "<", "Service", ">", "infraServices", "=", "new", ...
Start the services associated to the given service manager. <p>This starting function supports the {@link DependentService prioritized services}. @param manager the manager of the services to start.
[ "Start", "the", "services", "associated", "to", "the", "given", "service", "manager", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/Services.java#L75-L88
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/Services.java
Services.stopServices
public static void stopServices(IServiceManager manager) { final List<Service> otherServices = new ArrayList<>(); final List<Service> infraServices = new ArrayList<>(); final LinkedList<DependencyNode> serviceQueue = new LinkedList<>(); final Accessors accessors = new StoppingPhaseAccessors(); // Build the dependency graph buildInvertedDependencyGraph(manager, serviceQueue, infraServices, otherServices, accessors); // Launch the services runDependencyGraph(serviceQueue, infraServices, otherServices, accessors); manager.awaitStopped(); }
java
public static void stopServices(IServiceManager manager) { final List<Service> otherServices = new ArrayList<>(); final List<Service> infraServices = new ArrayList<>(); final LinkedList<DependencyNode> serviceQueue = new LinkedList<>(); final Accessors accessors = new StoppingPhaseAccessors(); // Build the dependency graph buildInvertedDependencyGraph(manager, serviceQueue, infraServices, otherServices, accessors); // Launch the services runDependencyGraph(serviceQueue, infraServices, otherServices, accessors); manager.awaitStopped(); }
[ "public", "static", "void", "stopServices", "(", "IServiceManager", "manager", ")", "{", "final", "List", "<", "Service", ">", "otherServices", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "List", "<", "Service", ">", "infraServices", "=", "new", ...
Stop the services associated to the given service manager. <p>This stopping function supports the {@link DependentService prioritized services}. @param manager the manager of the services to stop.
[ "Stop", "the", "services", "associated", "to", "the", "given", "service", "manager", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/Services.java#L108-L121
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/Services.java
Services.runDependencyGraph
@SuppressWarnings("checkstyle:npathcomplexity") private static void runDependencyGraph(Queue<DependencyNode> roots, List<Service> infraServices, List<Service> freeServices, Accessors accessors) { final boolean async = accessors.isAsyncStateWaitingEnabled(); final Set<Class<? extends Service>> executed = new TreeSet<>(Comparators.CLASS_COMPARATOR); accessors.runInfrastructureServicesBefore(infraServices); accessors.runFreeServicesBefore(freeServices); while (!roots.isEmpty()) { final DependencyNode node = roots.remove(); assert node != null && node.getType() != null; if (!executed.contains(node.getType())) { executed.add(node.getType()); roots.addAll(node.getNextServices()); roots.addAll(node.getNextWeakServices()); assert node.getService() != null; if (async) { for (final WeakReference<DependencyNode> asyncService : node.getAsyncStateServices()) { final AsyncStateService as = (AsyncStateService) (asyncService.get().getService()); assert as != null; while (!as.isReadyForOtherServices()) { Thread.yield(); } } } accessors.run(node.getService()); } } accessors.runFreeServicesAfter(freeServices); accessors.runInfrastructureServicesAfter(infraServices); }
java
@SuppressWarnings("checkstyle:npathcomplexity") private static void runDependencyGraph(Queue<DependencyNode> roots, List<Service> infraServices, List<Service> freeServices, Accessors accessors) { final boolean async = accessors.isAsyncStateWaitingEnabled(); final Set<Class<? extends Service>> executed = new TreeSet<>(Comparators.CLASS_COMPARATOR); accessors.runInfrastructureServicesBefore(infraServices); accessors.runFreeServicesBefore(freeServices); while (!roots.isEmpty()) { final DependencyNode node = roots.remove(); assert node != null && node.getType() != null; if (!executed.contains(node.getType())) { executed.add(node.getType()); roots.addAll(node.getNextServices()); roots.addAll(node.getNextWeakServices()); assert node.getService() != null; if (async) { for (final WeakReference<DependencyNode> asyncService : node.getAsyncStateServices()) { final AsyncStateService as = (AsyncStateService) (asyncService.get().getService()); assert as != null; while (!as.isReadyForOtherServices()) { Thread.yield(); } } } accessors.run(node.getService()); } } accessors.runFreeServicesAfter(freeServices); accessors.runInfrastructureServicesAfter(infraServices); }
[ "@", "SuppressWarnings", "(", "\"checkstyle:npathcomplexity\"", ")", "private", "static", "void", "runDependencyGraph", "(", "Queue", "<", "DependencyNode", ">", "roots", ",", "List", "<", "Service", ">", "infraServices", ",", "List", "<", "Service", ">", "freeSer...
Run the dependency graph for the services. @param roots filled with the services that have no dependency. @param infraServices filled with the infrastructure services. @param freeServices filled with the services that are executed before/after all the dependent services. @param accessors permits to retreive information on the services.
[ "Run", "the", "dependency", "graph", "for", "the", "services", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/Services.java#L280-L309
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/BuiltinCapacityUtil.java
BuiltinCapacityUtil.getContextsOf
public static SynchronizedIterable<AgentContext> getContextsOf(Agent agent) throws Exception { final ExternalContextAccess skill = SREutils.getInternalSkill(agent, ExternalContextAccess.class); assert skill != null; return skill.getAllContexts(); }
java
public static SynchronizedIterable<AgentContext> getContextsOf(Agent agent) throws Exception { final ExternalContextAccess skill = SREutils.getInternalSkill(agent, ExternalContextAccess.class); assert skill != null; return skill.getAllContexts(); }
[ "public", "static", "SynchronizedIterable", "<", "AgentContext", ">", "getContextsOf", "(", "Agent", "agent", ")", "throws", "Exception", "{", "final", "ExternalContextAccess", "skill", "=", "SREutils", ".", "getInternalSkill", "(", "agent", ",", "ExternalContextAcces...
Replies the contexts in which the agent is located. @param agent the agent for which the contexts must be retrieved. @return the contexts of the agents. @throws Exception - when it is not possible to retrieve the contexts.
[ "Replies", "the", "contexts", "in", "which", "the", "agent", "is", "located", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/BuiltinCapacityUtil.java#L52-L56
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/BuiltinCapacityUtil.java
BuiltinCapacityUtil.getContextIn
public static AgentContext getContextIn(Agent agent) throws Exception { final InnerContextAccess skill = SREutils.getInternalSkill(agent, InnerContextAccess.class); if (skill instanceof InnerContextSkill) { final InnerContextSkill janusSkill = (InnerContextSkill) skill; if (janusSkill.hasInnerContext()) { return janusSkill.getInnerContext(); } return null; } if (skill == null) { return null; } return skill.getInnerContext(); }
java
public static AgentContext getContextIn(Agent agent) throws Exception { final InnerContextAccess skill = SREutils.getInternalSkill(agent, InnerContextAccess.class); if (skill instanceof InnerContextSkill) { final InnerContextSkill janusSkill = (InnerContextSkill) skill; if (janusSkill.hasInnerContext()) { return janusSkill.getInnerContext(); } return null; } if (skill == null) { return null; } return skill.getInnerContext(); }
[ "public", "static", "AgentContext", "getContextIn", "(", "Agent", "agent", ")", "throws", "Exception", "{", "final", "InnerContextAccess", "skill", "=", "SREutils", ".", "getInternalSkill", "(", "agent", ",", "InnerContextAccess", ".", "class", ")", ";", "if", "...
Replies the inner context of the agent, if it was created. @param agent the agent for which the inner context must be retreived. @return the inner context, or <code>null</code>. @throws Exception - when it is not possible to retreive the inner context.
[ "Replies", "the", "inner", "context", "of", "the", "agent", "if", "it", "was", "created", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/BuiltinCapacityUtil.java#L65-L79
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java
SarlCompiler._toJavaStatement
@SuppressWarnings("static-method") protected void _toJavaStatement(SarlBreakExpression breakExpression, ITreeAppendable appendable, boolean isReferenced) { appendable.newLine().append("break;"); //$NON-NLS-1$ }
java
@SuppressWarnings("static-method") protected void _toJavaStatement(SarlBreakExpression breakExpression, ITreeAppendable appendable, boolean isReferenced) { appendable.newLine().append("break;"); //$NON-NLS-1$ }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "protected", "void", "_toJavaStatement", "(", "SarlBreakExpression", "breakExpression", ",", "ITreeAppendable", "appendable", ",", "boolean", "isReferenced", ")", "{", "appendable", ".", "newLine", "(", ")", ".",...
Generate the Java code related to the preparation statements for the break keyword. @param breakExpression the expression. @param appendable the output. @param isReferenced indicates if the expression is referenced.
[ "Generate", "the", "Java", "code", "related", "to", "the", "preparation", "statements", "for", "the", "break", "keyword", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java#L528-L531
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java
SarlCompiler.getReferencedLocalVariable
@SuppressWarnings("static-method") protected Map<XVariableDeclaration, XFeatureCall> getReferencedLocalVariable(XExpression expression, boolean onlyWritable) { final Map<XVariableDeclaration, XFeatureCall> localVariables = new TreeMap<>((k1, k2) -> { return k1.getIdentifier().compareTo(k2.getIdentifier()); }); for (final XFeatureCall featureCall : EcoreUtil2.getAllContentsOfType(expression, XFeatureCall.class)) { if (featureCall.getFeature() instanceof XVariableDeclaration) { final XVariableDeclaration localVariable = (XVariableDeclaration) featureCall.getFeature(); if ((!onlyWritable || localVariable.isWriteable()) && !localVariables.containsKey(localVariable)) { localVariables.put(localVariable, featureCall); } } } return localVariables; }
java
@SuppressWarnings("static-method") protected Map<XVariableDeclaration, XFeatureCall> getReferencedLocalVariable(XExpression expression, boolean onlyWritable) { final Map<XVariableDeclaration, XFeatureCall> localVariables = new TreeMap<>((k1, k2) -> { return k1.getIdentifier().compareTo(k2.getIdentifier()); }); for (final XFeatureCall featureCall : EcoreUtil2.getAllContentsOfType(expression, XFeatureCall.class)) { if (featureCall.getFeature() instanceof XVariableDeclaration) { final XVariableDeclaration localVariable = (XVariableDeclaration) featureCall.getFeature(); if ((!onlyWritable || localVariable.isWriteable()) && !localVariables.containsKey(localVariable)) { localVariables.put(localVariable, featureCall); } } } return localVariables; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "protected", "Map", "<", "XVariableDeclaration", ",", "XFeatureCall", ">", "getReferencedLocalVariable", "(", "XExpression", "expression", ",", "boolean", "onlyWritable", ")", "{", "final", "Map", "<", "XVariable...
Replies all the variables that are referenced into the given expression. @param expression the expression. @param onlyWritable if {@code true} only the writable variables are replied. Otherwise, all variables are replied. @return the referenced variables.
[ "Replies", "all", "the", "variables", "that", "are", "referenced", "into", "the", "given", "expression", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java#L654-L668
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java
SarlCompiler.isAtLeastJava8
protected boolean isAtLeastJava8(EObject context) { return this.generatorConfigProvider.get(EcoreUtil.getRootContainer(context)).getJavaSourceVersion().isAtLeast(JavaVersion.JAVA8); }
java
protected boolean isAtLeastJava8(EObject context) { return this.generatorConfigProvider.get(EcoreUtil.getRootContainer(context)).getJavaSourceVersion().isAtLeast(JavaVersion.JAVA8); }
[ "protected", "boolean", "isAtLeastJava8", "(", "EObject", "context", ")", "{", "return", "this", ".", "generatorConfigProvider", ".", "get", "(", "EcoreUtil", ".", "getRootContainer", "(", "context", ")", ")", ".", "getJavaSourceVersion", "(", ")", ".", "isAtLea...
Replies if the generation is for Java version 8 at least. @param context the context. @return {@code true} if Java 8 or newer.
[ "Replies", "if", "the", "generation", "is", "for", "Java", "version", "8", "at", "least", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java#L675-L677
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java
SarlCompiler._toJavaExpression
protected void _toJavaExpression(SarlAssertExpression assertExpression, ITreeAppendable appendable) { if (!assertExpression.isIsStatic() && isAtLeastJava8(assertExpression)) { appendable.append("/* error - couldn't compile nested assert */"); //$NON-NLS-1$ } }
java
protected void _toJavaExpression(SarlAssertExpression assertExpression, ITreeAppendable appendable) { if (!assertExpression.isIsStatic() && isAtLeastJava8(assertExpression)) { appendable.append("/* error - couldn't compile nested assert */"); //$NON-NLS-1$ } }
[ "protected", "void", "_toJavaExpression", "(", "SarlAssertExpression", "assertExpression", ",", "ITreeAppendable", "appendable", ")", "{", "if", "(", "!", "assertExpression", ".", "isIsStatic", "(", ")", "&&", "isAtLeastJava8", "(", "assertExpression", ")", ")", "{"...
Generate the Java code related to the expression for the assert keyword. @param assertExpression the expression. @param appendable the output.
[ "Generate", "the", "Java", "code", "related", "to", "the", "expression", "for", "the", "assert", "keyword", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java#L705-L709
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java
SarlCompiler.jvmOperationCallToJavaExpression
protected void jvmOperationCallToJavaExpression(final XExpression sourceObject, final JvmOperation operation, XExpression receiver, List<XExpression> arguments, ITreeAppendable appendable) { String name = null; assert operation != null; if (appendable.hasName(operation)) { name = appendable.getName(operation); } else { name = this.featureNameProvider.getSimpleName(operation); } if (name == null) { name = "/* name is null */"; //$NON-NLS-1$ } if (operation.isStatic()) { final JvmDeclaredType operationContainer = operation.getDeclaringType(); final JvmIdentifiableElement container = getLogicalContainerProvider().getNearestLogicalContainer(sourceObject); final JvmType containerType = EcoreUtil2.getContainerOfType(container, JvmType.class); final LightweightTypeReference reference = newTypeReferenceOwner(sourceObject) .toLightweightTypeReference(operationContainer); if (!reference.isAssignableFrom(containerType)) { appendable.append(operationContainer); appendable.append("."); //$NON-NLS-1$ } } else if (receiver != null) { internalToJavaExpression(receiver, appendable); appendable.append("."); //$NON-NLS-1$ } else { appendable.append("this."); //$NON-NLS-1$ } appendable.trace(sourceObject, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, 0).append(name); appendable.append("("); //$NON-NLS-1$ if (arguments != null && !arguments.isEmpty()) { appendArguments(arguments, appendable, true); } appendable.append(")"); //$NON-NLS-1$ }
java
protected void jvmOperationCallToJavaExpression(final XExpression sourceObject, final JvmOperation operation, XExpression receiver, List<XExpression> arguments, ITreeAppendable appendable) { String name = null; assert operation != null; if (appendable.hasName(operation)) { name = appendable.getName(operation); } else { name = this.featureNameProvider.getSimpleName(operation); } if (name == null) { name = "/* name is null */"; //$NON-NLS-1$ } if (operation.isStatic()) { final JvmDeclaredType operationContainer = operation.getDeclaringType(); final JvmIdentifiableElement container = getLogicalContainerProvider().getNearestLogicalContainer(sourceObject); final JvmType containerType = EcoreUtil2.getContainerOfType(container, JvmType.class); final LightweightTypeReference reference = newTypeReferenceOwner(sourceObject) .toLightweightTypeReference(operationContainer); if (!reference.isAssignableFrom(containerType)) { appendable.append(operationContainer); appendable.append("."); //$NON-NLS-1$ } } else if (receiver != null) { internalToJavaExpression(receiver, appendable); appendable.append("."); //$NON-NLS-1$ } else { appendable.append("this."); //$NON-NLS-1$ } appendable.trace(sourceObject, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, 0).append(name); appendable.append("("); //$NON-NLS-1$ if (arguments != null && !arguments.isEmpty()) { appendArguments(arguments, appendable, true); } appendable.append(")"); //$NON-NLS-1$ }
[ "protected", "void", "jvmOperationCallToJavaExpression", "(", "final", "XExpression", "sourceObject", ",", "final", "JvmOperation", "operation", ",", "XExpression", "receiver", ",", "List", "<", "XExpression", ">", "arguments", ",", "ITreeAppendable", "appendable", ")",...
Generate the Java expression for the given JVM operation. @param sourceObject the object into the source tree that is the source for the call. @param operation the JVM operation to call. @param receiver the receiver of the call. @param arguments the arguments to pass to the called operation. @param appendable the receiver of the Java code.
[ "Generate", "the", "Java", "expression", "for", "the", "given", "JVM", "operation", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java#L835-L869
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java
SarlCompiler.canBeNotStaticAnonymousClass
@SuppressWarnings("static-method") protected boolean canBeNotStaticAnonymousClass(XClosure closure, LightweightTypeReference typeRef, JvmOperation operation) { return !typeRef.isSubtypeOf(Serializable.class); }
java
@SuppressWarnings("static-method") protected boolean canBeNotStaticAnonymousClass(XClosure closure, LightweightTypeReference typeRef, JvmOperation operation) { return !typeRef.isSubtypeOf(Serializable.class); }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "protected", "boolean", "canBeNotStaticAnonymousClass", "(", "XClosure", "closure", ",", "LightweightTypeReference", "typeRef", ",", "JvmOperation", "operation", ")", "{", "return", "!", "typeRef", ".", "isSubtypeO...
Replies if the given closure could be represented by an not static anonymous class. @param closure the closure. @param typeRef the type of the closure. @param operation the operation to implement. @return {@code true} if the given closure could be represented by a not-static anonymous class. @since 0.8.6
[ "Replies", "if", "the", "given", "closure", "could", "be", "represented", "by", "an", "not", "static", "anonymous", "class", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlCompiler.java#L1289-L1293
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/AbstractDMultiMapView.java
AbstractDMultiMapView.wrapValues
Collection<V> wrapValues(K key, Collection<V> values) { final Object backEnd = DataViewDelegate.undelegate(values); if (backEnd instanceof List<?>) { return new SingleKeyValueListView(key, (List<V>) values); } if (backEnd instanceof Set<?>) { return new SingleKeyValueSetView(key, (Set<V>) values); } throw new IllegalStateException("Unsupported type of the backend multimap: " + values.getClass()); //$NON-NLS-1$ }
java
Collection<V> wrapValues(K key, Collection<V> values) { final Object backEnd = DataViewDelegate.undelegate(values); if (backEnd instanceof List<?>) { return new SingleKeyValueListView(key, (List<V>) values); } if (backEnd instanceof Set<?>) { return new SingleKeyValueSetView(key, (Set<V>) values); } throw new IllegalStateException("Unsupported type of the backend multimap: " + values.getClass()); //$NON-NLS-1$ }
[ "Collection", "<", "V", ">", "wrapValues", "(", "K", "key", ",", "Collection", "<", "V", ">", "values", ")", "{", "final", "Object", "backEnd", "=", "DataViewDelegate", ".", "undelegate", "(", "values", ")", ";", "if", "(", "backEnd", "instanceof", "List...
Wrap the given values into a dedicated view. <p>The replies view may be a {@link SingleKeyValueListView} or a {@link SingleKeyValueSetView} according to the type of the given values' collection. @param key the key of the values. @param values the values. @return the wrapper.
[ "Wrap", "the", "given", "values", "into", "a", "dedicated", "view", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/AbstractDMultiMapView.java#L90-L99
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/AbstractDMultiMapView.java
AbstractDMultiMapView.copyValues
@SuppressWarnings({ "unchecked", "checkstyle:illegaltype" }) Collection<V> copyValues(Collection<V> values) { final Object backEnd = DataViewDelegate.undelegate(values); if (backEnd instanceof List<?>) { return Lists.newArrayList(values); } if (backEnd instanceof TreeSet<?>) { TreeSet<V> c = (TreeSet<V>) backEnd; c = Sets.newTreeSet(c.comparator()); c.addAll(values); return c; } if (backEnd instanceof LinkedHashSet<?>) { return Sets.newLinkedHashSet(values); } if (backEnd instanceof Set<?>) { return Sets.newHashSet(values); } throw new IllegalStateException("Unsupported type of the backend multimap: " + values.getClass()); //$NON-NLS-1$ }
java
@SuppressWarnings({ "unchecked", "checkstyle:illegaltype" }) Collection<V> copyValues(Collection<V> values) { final Object backEnd = DataViewDelegate.undelegate(values); if (backEnd instanceof List<?>) { return Lists.newArrayList(values); } if (backEnd instanceof TreeSet<?>) { TreeSet<V> c = (TreeSet<V>) backEnd; c = Sets.newTreeSet(c.comparator()); c.addAll(values); return c; } if (backEnd instanceof LinkedHashSet<?>) { return Sets.newLinkedHashSet(values); } if (backEnd instanceof Set<?>) { return Sets.newHashSet(values); } throw new IllegalStateException("Unsupported type of the backend multimap: " + values.getClass()); //$NON-NLS-1$ }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"checkstyle:illegaltype\"", "}", ")", "Collection", "<", "V", ">", "copyValues", "(", "Collection", "<", "V", ">", "values", ")", "{", "final", "Object", "backEnd", "=", "DataViewDelegate", ".", "undel...
Copy the given values. <p>The replies collection may be a {@link List} or a {@link Set} according to the type of the given values' collection. @param values the values. @return the copy.
[ "Copy", "the", "given", "values", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/AbstractDMultiMapView.java#L109-L128
train