idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
34,000
protected void generateJvmElements ( ResourceSet resourceSet , IProgressMonitor progress ) { assert progress != null ; progress . subTask ( Messages . SarlBatchCompiler_21 ) ; getLogger ( ) . info ( Messages . SarlBatchCompiler_21 ) ; final List < Resource > originalResources = resourceSet . getResources ( ) ; final Li...
Generate the JVM model elements .
34,001
@ SuppressWarnings ( { "checkstyle:cyclomaticcomplexity" , "checkstyle:npathcomplexity" , "checkstyle:nestedifdepth" } ) protected List < Issue > validate ( ResourceSet resourceSet , Collection < Resource > validResources , IProgressMonitor progress ) { assert progress != null ; progress . subTask ( Messages . SarlBatc...
Generate the JVM model elements and validate generated elements .
34,002
@ SuppressWarnings ( "static-method" ) protected boolean isSourceFile ( Resource resource ) { if ( resource instanceof BatchLinkableResource ) { return ! ( ( BatchLinkableResource ) resource ) . isLoadedFromStorage ( ) ; } return false ; }
Replies if the given resource is a script .
34,003
protected boolean preCompileStubs ( File sourceDirectory , File classDirectory , IProgressMonitor progress ) { assert progress != null ; progress . subTask ( Messages . SarlBatchCompiler_50 ) ; return runJavaCompiler ( classDirectory , Collections . singletonList ( sourceDirectory ) , getClassPath ( ) , false , false ,...
Compile the stub files before the compilation of the project s files .
34,004
protected boolean preCompileJava ( File sourceDirectory , File classDirectory , IProgressMonitor progress ) { assert progress != null ; progress . subTask ( Messages . SarlBatchCompiler_51 ) ; return runJavaCompiler ( classDirectory , getSourcePaths ( ) , Iterables . concat ( Collections . singleton ( sourceDirectory )...
Compile the java files before the compilation of the project s files .
34,005
protected boolean postCompileJava ( IProgressMonitor progress ) { assert progress != null ; progress . subTask ( Messages . SarlBatchCompiler_52 ) ; final File classOutputPath = getClassOutputPath ( ) ; if ( classOutputPath == null ) { getLogger ( ) . info ( Messages . SarlBatchCompiler_24 ) ; return true ; } getLogger...
Compile the java files after the compilation of the project s files .
34,006
@ SuppressWarnings ( { "resource" } ) protected boolean runJavaCompiler ( File classDirectory , Iterable < File > sourcePathDirectories , Iterable < File > classPathEntries , boolean enableCompilerOutput , boolean enableOptimization , IProgressMonitor progress ) { String encoding = this . encodingProvider . getDefaultE...
Run the Java compiler .
34,007
protected File createStubs ( ResourceSet resourceSet , IProgressMonitor progress ) { assert progress != null ; progress . subTask ( Messages . SarlBatchCompiler_53 ) ; final File outputDirectory = createTempDir ( STUB_FOLDER_PREFIX ) ; if ( progress . isCanceled ( ) ) { return null ; } if ( getLogger ( ) . isDebugEnabl...
Create the stubs .
34,008
protected void loadSARLFiles ( ResourceSet resourceSet , IProgressMonitor progress ) { assert progress != null ; progress . subTask ( Messages . SarlBatchCompiler_54 ) ; this . encodingProvider . setDefaultEncoding ( getFileEncoding ( ) ) ; final NameBasedFilter nameBasedFilter = new NameBasedFilter ( ) ; nameBasedFilt...
Load the SARL files in the given resource set .
34,009
protected File createTempDir ( String namePrefix ) { final File tempDir = new File ( getTempDirectory ( ) , namePrefix ) ; cleanFolder ( tempDir , ACCEPT_ALL_FILTER , true , true ) ; if ( ! tempDir . mkdirs ( ) ) { throw new RuntimeException ( MessageFormat . format ( Messages . SarlBatchCompiler_8 , tempDir . getAbsol...
Create a temporary subdirectory inside the root temp directory .
34,010
protected boolean cleanFolder ( File parentFolder , FileFilter filter , boolean continueOnError , boolean deleteParentFolder ) { try { if ( getLogger ( ) . isDebugEnabled ( ) ) { getLogger ( ) . debug ( Messages . SarlBatchCompiler_9 , parentFolder . toString ( ) ) ; } return Files . cleanFolder ( parentFolder , null ,...
Clean the folders .
34,011
protected boolean checkConfiguration ( IProgressMonitor progress ) { assert progress != null ; progress . subTask ( Messages . SarlBatchCompiler_55 ) ; final File output = getOutputPath ( ) ; if ( getLogger ( ) . isDebugEnabled ( ) ) { getLogger ( ) . debug ( Messages . SarlBatchCompiler_35 , output ) ; } if ( output =...
Check the compiler configuration ; and logs errors .
34,012
@ SuppressWarnings ( "static-method" ) protected ClassLoader createClassLoader ( Iterable < File > jarsAndFolders , ClassLoader parentClassLoader ) { return new URLClassLoader ( Iterables . toArray ( Iterables . transform ( jarsAndFolders , from -> { try { final URL url = from . toURI ( ) . toURL ( ) ; assert url != nu...
Create the project class loader .
34,013
protected void destroyClassLoader ( ClassLoader classLoader ) { if ( classLoader instanceof Closeable ) { try { ( ( Closeable ) classLoader ) . close ( ) ; } catch ( Exception e ) { reportInternalWarning ( Messages . SarlBatchCompiler_18 , e ) ; } } }
Null - safe destruction of the given class loaders .
34,014
public void setWarningSeverity ( String warningId , Severity severity ) { if ( ! Strings . isEmpty ( warningId ) && severity != null ) { this . issueSeverityProvider . setSeverity ( warningId , severity ) ; } }
Change the severity level of a warning .
34,015
protected EventListener addListener ( ADDRESST key , EventListener value ) { synchronized ( mutex ( ) ) { return this . listeners . put ( key , value ) ; } }
Add a participant with the given address in this repository .
34,016
protected SynchronizedSet < ADDRESST > getAdresses ( ) { final Object mutex = mutex ( ) ; synchronized ( mutex ) { return Collections3 . synchronizedSet ( this . listeners . keySet ( ) , mutex ) ; } }
Replies all the addresses from the inside of this repository .
34,017
public SynchronizedCollection < EventListener > getListeners ( ) { final Object mutex = mutex ( ) ; synchronized ( mutex ) { return Collections3 . synchronizedCollection ( this . listeners . values ( ) , mutex ) ; } }
Replies all the participants from the inside of this repository .
34,018
protected Set < Entry < ADDRESST , EventListener > > listenersEntrySet ( ) { final Object mutex = mutex ( ) ; synchronized ( mutex ) { return Collections3 . synchronizedSet ( this . listeners . entrySet ( ) , mutex ) ; } }
Replies the pairs of addresses and participants in this repository .
34,019
private void searchAndLaunch ( String mode , Object ... scope ) { final ElementDescription element = searchAndSelect ( true , scope ) ; if ( element != null ) { try { launch ( element . projectName , element . elementName , mode ) ; } catch ( CoreException e ) { SARLEclipsePlugin . getDefault ( ) . openError ( getShell...
Resolves an element type that can be launched from the given scope and launches in the specified mode .
34,020
protected void launch ( String projectName , String fullyQualifiedName , String mode ) throws CoreException { final List < ILaunchConfiguration > configs = getCandidates ( projectName , fullyQualifiedName ) ; ILaunchConfiguration config = null ; final int count = configs . size ( ) ; if ( count == 1 ) { config = config...
Launches the given element type in the specified mode .
34,021
protected URI computeUnusedUri ( ResourceSet resourceSet ) { String name = "__synthetic" ; for ( int i = 0 ; i < Integer . MAX_VALUE ; ++ i ) { URI syntheticUri = URI . createURI ( name + i + "." + getScriptFileExtension ( ) ) ; if ( resourceSet . getResource ( syntheticUri , false ) == null ) { return syntheticUri ; }...
Compute a unused URI for a synthetic resource .
34,022
protected Resource createResource ( ResourceSet resourceSet ) { URI uri = computeUnusedUri ( resourceSet ) ; Resource resource = getResourceFactory ( ) . createResource ( uri ) ; resourceSet . getResources ( ) . add ( resource ) ; return resource ; }
Create a synthetic resource .
34,023
protected Injector getInjector ( ) { if ( this . builderInjector == null ) { ImportManager importManager = this . importManagerProvider . get ( ) ; this . builderInjector = createOverridingInjector ( this . originalInjector , new CodeBuilderModule ( importManager ) ) ; } return builderInjector ; }
Replies the injector .
34,024
public IExpressionBuilder getGuard ( ) { IExpressionBuilder exprBuilder = this . expressionProvider . get ( ) ; exprBuilder . eInit ( getSarlBehaviorUnit ( ) , new Procedures . Procedure1 < XExpression > ( ) { public void apply ( XExpression expr ) { getSarlBehaviorUnit ( ) . setGuard ( expr ) ; } } , getTypeResolution...
Change the guard .
34,025
public IBlockExpressionBuilder getExpression ( ) { IBlockExpressionBuilder block = this . blockExpressionProvider . get ( ) ; block . eInit ( getTypeResolutionContext ( ) ) ; XBlockExpression expr = block . getXBlockExpression ( ) ; this . sarlBehaviorUnit . setExpression ( expr ) ; return block ; }
Create the block of code .
34,026
protected IStatus validateNameAgainstOtherSREs ( String name ) { IStatus nameStatus = SARLEclipsePlugin . getDefault ( ) . createOkStatus ( ) ; if ( isDuplicateName ( name ) ) { nameStatus = SARLEclipsePlugin . getDefault ( ) . createStatus ( IStatus . ERROR , ISREInstall . CODE_NAME , Messages . SREInstallWizard_1 ) ;...
Replies if the name of the SRE is valid against the names of the other SRE .
34,027
protected void setPageStatus ( IStatus status ) { this . status = status == null ? SARLEclipsePlugin . getDefault ( ) . createOkStatus ( ) : status ; }
Change the status associated to this page . Any previous status is overrided by the given value .
34,028
private boolean isDuplicateName ( String name ) { if ( this . existingNames != null ) { final String newName = Strings . nullToEmpty ( name ) ; for ( final String existingName : this . existingNames ) { if ( newName . equals ( existingName ) ) { return true ; } } } return false ; }
Returns whether the name is already in use by an existing SRE .
34,029
void setExistingNames ( String ... names ) { this . existingNames = names ; for ( int i = 0 ; i < this . existingNames . length ; ++ i ) { this . existingNames [ i ] = Strings . nullToEmpty ( this . existingNames [ i ] ) ; } }
Sets the names of existing SREs not including the SRE being edited . This method is called by the wizard and clients should not call this method .
34,030
protected void updatePageStatus ( ) { if ( this . status . isOK ( ) ) { setMessage ( null , IMessageProvider . NONE ) ; } else { switch ( this . status . getSeverity ( ) ) { case IStatus . ERROR : setMessage ( this . status . getMessage ( ) , IMessageProvider . ERROR ) ; break ; case IStatus . INFO : setMessage ( this ...
Updates the status message on the page based on the status of the SRE and other status provided by the page .
34,031
public String toActionId ( ) { final StringBuilder b = new StringBuilder ( ) ; b . append ( getActionName ( ) ) ; for ( final String type : this . signature ) { b . append ( "_" ) ; for ( final char c : type . replaceAll ( "(\\[\\])|\\*" , "Array" ) . toCharArray ( ) ) { if ( Character . isJavaIdentifierPart ( c ) ) { ...
Replies the string that permits to identify the action prototype according to the Java variable name .
34,032
public final void emit ( UUID eventSource , Event event , Scope < Address > scope ) { assert event != null ; ensureEventSource ( eventSource , event ) ; assert getSpaceID ( ) . equals ( event . getSource ( ) . getSpaceID ( ) ) : "The source address must belong to this space" ; try { final Scope < Address > scopeInstanc...
Emit the given event in the given scope .
34,033
protected void ensureEventSource ( UUID eventSource , Event event ) { if ( event . getSource ( ) == null ) { if ( eventSource != null ) { event . setSource ( new Address ( getSpaceID ( ) , eventSource ) ) ; } else { throw new AssertionError ( "Every event must have a source" ) ; } } }
Ensure that the given event has a source .
34,034
protected void doEmit ( Event event , Scope < ? super Address > scope ) { assert scope != null ; assert event != null ; final UniqueAddressParticipantRepository < Address > particips = getParticipantInternalDataStructure ( ) ; final SynchronizedCollection < EventListener > listeners = particips . getListeners ( ) ; syn...
Do the emission of the event .
34,035
public static Object undelegate ( Object object ) { Object obj = object ; while ( obj instanceof Delegator ) { obj = ( ( Delegator < ? > ) obj ) . getDelegatedObject ( ) ; } return obj ; }
Find the delegated object .
34,036
protected void formatRegion ( IXtextDocument document , int offset , int length ) { try { final int startLineIndex = document . getLineOfOffset ( previousSiblingChar ( document , offset ) ) ; final int endLineIndex = document . getLineOfOffset ( offset + length ) ; int regionLength = 0 ; for ( int i = startLineIndex ; ...
Called for formatting a region .
34,037
public static ServiceLoader < SREBootstrap > getServiceLoader ( boolean onlyInstalledInJRE ) { synchronized ( SRE . class ) { ServiceLoader < SREBootstrap > sl = loader == null ? null : loader . get ( ) ; if ( sl == null ) { if ( onlyInstalledInJRE ) { sl = ServiceLoader . loadInstalled ( SREBootstrap . class ) ; } els...
Replies all the installed SRE into the class path .
34,038
public static Set < URL > getBootstrappedLibraries ( ) { final String name = PREFIX + SREBootstrap . class . getName ( ) ; final Set < URL > result = new TreeSet < > ( ) ; try { final Enumeration < URL > enumr = ClassLoader . getSystemResources ( name ) ; while ( enumr . hasMoreElements ( ) ) { final URL url = enumr . ...
Replies all the libraries that contains a SRE bootstrap .
34,039
public static SREBootstrap getBootstrap ( ) { synchronized ( SRE . class ) { if ( currentSRE == null ) { final Iterator < SREBootstrap > iterator = getServiceLoader ( ) . iterator ( ) ; if ( iterator . hasNext ( ) ) { currentSRE = iterator . next ( ) ; } else { currentSRE = new VoidSREBootstrap ( ) ; } } return current...
Find and reply the current SRE .
34,040
protected String _signature ( XCastedExpression castExpression , boolean typeAtEnd ) { if ( castExpression instanceof SarlCastedExpression ) { final JvmOperation delegate = ( ( SarlCastedExpression ) castExpression ) . getFeature ( ) ; if ( delegate != null ) { return _signature ( delegate , typeAtEnd ) ; } } return Me...
Replies the hover for a SARL casted expression .
34,041
protected String getTypeName ( JvmType type ) { if ( type != null ) { if ( type instanceof JvmDeclaredType ) { final ITypeReferenceOwner owner = new StandardTypeReferenceOwner ( this . services , type ) ; return owner . toLightweightTypeReference ( type ) . getHumanReadableName ( ) ; } return type . getSimpleName ( ) ;...
Replies the type name for the given type .
34,042
protected static ISREInstall getSREInstallFor ( ILaunchConfiguration configuration , ILaunchConfigurationAccessor configAccessor , IJavaProjectAccessor projectAccessor ) throws CoreException { assert configAccessor != null ; assert projectAccessor != null ; final ISREInstall sre ; if ( configAccessor . getUseProjectSRE...
Replies the SRE installation to be used for the given configuration .
34,043
private static ISREInstall getProjectSpecificSRE ( ILaunchConfiguration configuration , boolean verify , IJavaProjectAccessor projectAccessor ) throws CoreException { assert projectAccessor != null ; final IJavaProject jprj = projectAccessor . get ( configuration ) ; if ( jprj != null ) { final IProject prj = jprj . ge...
Replies the project SRE from the given configuration .
34,044
protected static String join ( String ... values ) { final StringBuilder buffer = new StringBuilder ( ) ; for ( final String value : values ) { if ( ! Strings . isNullOrEmpty ( value ) ) { if ( buffer . length ( ) > 0 ) { buffer . append ( " " ) ; } buffer . append ( value ) ; } } return buffer . toString ( ) ; }
Replies a string that is the concatenation of the given values .
34,045
private IRuntimeClasspathEntry [ ] getOrComputeUnresolvedSARLRuntimeClasspath ( ILaunchConfiguration configuration ) throws CoreException { IRuntimeClasspathEntry [ ] entries = null ; synchronized ( this ) { if ( this . unresolvedClasspathEntries != null ) { entries = this . unresolvedClasspathEntries . get ( ) ; } } i...
Replies the class path for the SARL application .
34,046
public static IRuntimeClasspathEntry [ ] computeUnresolvedSARLRuntimeClasspath ( ILaunchConfiguration configuration , ILaunchConfigurationAccessor configAccessor , IJavaProjectAccessor projectAccessor ) throws CoreException { final IRuntimeClasspathEntry [ ] entries = JavaRuntime . computeUnresolvedRuntimeClasspath ( c...
Compute the class path for the given launch configuration .
34,047
private static List < IRuntimeClasspathEntry > getSREClasspathEntries ( ILaunchConfiguration configuration , ILaunchConfigurationAccessor configAccessor , IJavaProjectAccessor projectAccessor ) throws CoreException { final ISREInstall sre = getSREInstallFor ( configuration , configAccessor , projectAccessor ) ; return ...
Replies the classpath entries associated to the SRE of the given configuration .
34,048
private static boolean isNotSREEntry ( IRuntimeClasspathEntry entry ) { try { final File file = new File ( entry . getLocation ( ) ) ; if ( file . isDirectory ( ) ) { return ! SARLRuntime . isUnpackedSRE ( file ) ; } else if ( file . canRead ( ) ) { return ! SARLRuntime . isPackedSRE ( file ) ; } } catch ( Throwable e ...
Replies if the given classpath entry is a SRE .
34,049
@ SuppressWarnings ( "static-method" ) protected Runnable createTask ( Runnable runnable ) { if ( runnable instanceof JanusRunnable ) { return runnable ; } return new JanusRunnable ( runnable ) ; }
Create a task with the given runnable .
34,050
@ SuppressWarnings ( "static-method" ) protected < T > Callable < T > createTask ( Callable < T > callable ) { if ( callable instanceof JanusCallable < ? > ) { return callable ; } return new JanusCallable < > ( callable ) ; }
Create a task with the given callable .
34,051
protected void verifyAgentName ( ILaunchConfiguration configuration ) throws CoreException { final String name = getAgentName ( configuration ) ; if ( name == null ) { abort ( io . sarl . eclipse . launching . dialog . Messages . MainLaunchConfigurationTab_2 , null , SARLEclipseConfig . ERR_UNSPECIFIED_AGENT_NAME ) ; }...
Verifies a main type name is specified by the given launch configuration and returns the main type name .
34,052
public ISarlInterfaceBuilder addSarlInterface ( String name ) { ISarlInterfaceBuilder builder = this . iSarlInterfaceBuilderProvider . get ( ) ; builder . eInit ( getSarlAgent ( ) , name , getTypeResolutionContext ( ) ) ; return builder ; }
Create a SarlInterface .
34,053
public ISarlEnumerationBuilder addSarlEnumeration ( String name ) { ISarlEnumerationBuilder builder = this . iSarlEnumerationBuilderProvider . get ( ) ; builder . eInit ( getSarlAgent ( ) , name , getTypeResolutionContext ( ) ) ; return builder ; }
Create a SarlEnumeration .
34,054
public ISarlAnnotationTypeBuilder addSarlAnnotationType ( String name ) { ISarlAnnotationTypeBuilder builder = this . iSarlAnnotationTypeBuilderProvider . get ( ) ; builder . eInit ( getSarlAgent ( ) , name , getTypeResolutionContext ( ) ) ; return builder ; }
Create a SarlAnnotationType .
34,055
public void removeTask ( AgentTask task ) { final Iterator < WeakReference < AgentTask > > iterator = this . tasks . iterator ( ) ; while ( iterator . hasNext ( ) ) { final WeakReference < AgentTask > reference = iterator . next ( ) ; final AgentTask knownTask = reference . get ( ) ; if ( knownTask == null ) { iterator...
Remove task .
34,056
public void bind ( Class < ? > type , Class < ? extends SARLSemanticModification > modification ) { this . modificationTypes . put ( type , modification ) ; }
Add a semantic modification related to the given element type .
34,057
@ SuppressWarnings ( "static-method" ) protected Boolean _generate ( CharSequence expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { output . appendStringConstant ( expression . toString ( ) ) ; return Boolean . TRUE ; }
Append the inline code for the given character sequence .
34,058
@ SuppressWarnings ( "static-method" ) protected Boolean _generate ( Number expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { final Class < ? > type = ReflectionUtil . getRawType ( expression . getClass ( ) ) ; if ( Byte . class . equals ( type ) || byte . c...
Append the inline code for the given number value .
34,059
@ SuppressWarnings ( "static-method" ) protected Boolean _generate ( XBooleanLiteral expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { output . appendConstant ( Boolean . toString ( expression . isIsTrue ( ) ) ) ; return Boolean . TRUE ; }
Append the inline code for the given XBooleanLiteral .
34,060
protected Boolean _generate ( XNullLiteral expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { if ( parentExpression == null && feature instanceof XtendFunction ) { final XtendFunction function = ( XtendFunction ) feature ; output . append ( "(" ) ; final JvmT...
Append the inline code for the given XNullLiteral .
34,061
@ SuppressWarnings ( "static-method" ) protected Boolean _generate ( XNumberLiteral expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { output . appendConstant ( expression . getValue ( ) ) ; return Boolean . TRUE ; }
Append the inline code for the given XNumberLiteral .
34,062
@ SuppressWarnings ( "static-method" ) protected Boolean _generate ( XStringLiteral expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { output . appendStringConstant ( expression . getValue ( ) ) ; return Boolean . TRUE ; }
Append the inline code for the given XStringLiteral .
34,063
@ SuppressWarnings ( "static-method" ) protected Boolean _generate ( XTypeLiteral expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { output . appendTypeConstant ( expression . getType ( ) ) ; return Boolean . TRUE ; }
Append the inline code for the given XTypeLiteral .
34,064
protected Boolean _generate ( XCastedExpression expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { final InlineAnnotationTreeAppendable child = newAppendable ( output . getImportManager ( ) ) ; boolean bool = generate ( expression . getTarget ( ) , expression...
Append the inline code for the given XCastedExpression .
34,065
protected Boolean _generate ( XReturnExpression expression , XExpression parentExpression , XtendExecutable feature , InlineAnnotationTreeAppendable output ) { return generate ( expression . getExpression ( ) , parentExpression , feature , output ) ; }
Append the inline code for the given XReturnLiteral .
34,066
public void getExportedPackages ( Set < String > exportedPackages ) { if ( exportedPackages != null ) { exportedPackages . add ( getCodeElementExtractor ( ) . getBasePackage ( ) ) ; exportedPackages . add ( getCodeElementExtractor ( ) . getBuilderPackage ( ) ) ; if ( getCodeBuilderConfig ( ) . isISourceAppendableEnable...
Fill the given set with the exported packages for this fragment .
34,067
protected String getLanguageScriptMemberGetter ( ) { final Grammar grammar = getGrammar ( ) ; final AbstractRule scriptRule = GrammarUtil . findRuleForName ( grammar , getCodeBuilderConfig ( ) . getScriptRuleName ( ) ) ; for ( final Assignment assignment : GrammarUtil . containedAssignments ( scriptRule ) ) { if ( ( as...
Replies the getter function for accessing to the top element collection of the script .
34,068
protected TypeReference getXFactoryFor ( TypeReference type ) { final String packageName = type . getPackageName ( ) ; final Grammar grammar = getGrammar ( ) ; TypeReference reference = getXFactoryFor ( packageName , grammar ) ; if ( reference != null ) { return reference ; } for ( final Grammar usedGrammar : GrammarUt...
Replies the type for the factory for the given type .
34,069
@ SuppressWarnings ( "static-method" ) protected StringConcatenationClient generateAppenderMembers ( String appenderSimpleName , TypeReference builderInterface , String elementAccessor ) { return new StringConcatenationClient ( ) { protected void appendTo ( TargetStringConcatenation it ) { it . append ( "\tprivate fina...
Generate the members related to appenders .
34,070
protected static String getAorAnArticle ( String word ) { if ( Arrays . asList ( 'a' , 'e' , 'i' , 'o' , 'u' , 'y' ) . contains ( Character . toLowerCase ( word . charAt ( 0 ) ) ) ) { return "an" ; } return "a" ; }
Replies the an or a article according to the given word .
34,071
protected static String toSingular ( String word ) { if ( word . endsWith ( "ies" ) ) { return word . substring ( 0 , word . length ( ) - 3 ) + "y" ; } if ( word . endsWith ( "s" ) ) { return word . substring ( 0 , word . length ( ) - 1 ) ; } return word ; }
Replies the singular version of the word .
34,072
protected static boolean nameMatches ( EObject element , String pattern ) { if ( element instanceof RuleCall ) { return nameMatches ( ( ( RuleCall ) element ) . getRule ( ) , pattern ) ; } if ( element instanceof AbstractRule ) { final String name = ( ( AbstractRule ) element ) . getName ( ) ; final Pattern compilerPat...
Replies if the name of the given element is matching the pattern .
34,073
protected void bindElementDescription ( BindingFactory factory , CodeElementExtractor . ElementDescription ... descriptions ) { for ( final CodeElementExtractor . ElementDescription description : descriptions ) { bindTypeReferences ( factory , description . getBuilderInterfaceType ( ) , description . getBuilderImplemen...
Binds the given descriptions according to the standard policy .
34,074
protected void bindTypeReferences ( BindingFactory factory , TypeReference interfaceType , TypeReference implementationType , TypeReference customImplementationType ) { final IFileSystemAccess2 fileSystem = getSrc ( ) ; final TypeReference type ; if ( ( fileSystem . isFile ( implementationType . getJavaPath ( ) ) ) || ...
Binds the given references according to the standard policy .
34,075
protected AbstractRule getMemberRule ( CodeElementExtractor . ElementDescription description ) { for ( final Assignment assignment : GrammarUtil . containedAssignments ( description . getGrammarComponent ( ) ) ) { if ( Objects . equals ( getCodeBuilderConfig ( ) . getMemberCollectionExtensionGrammarName ( ) , assignmen...
Replies the rule used for defining the members of the given element .
34,076
public String getConfig ( String key ) throws MojoExecutionException { ResourceBundle resource = null ; try { resource = ResourceBundle . getBundle ( "io/sarl/maven/compiler/config" , java . util . Locale . getDefault ( ) , MavenHelper . class . getClassLoader ( ) ) ; } catch ( MissingResourceException e ) { throw new ...
Extract the value from the hard - coded configuration .
34,077
public PluginDescriptor loadPlugin ( Plugin plugin ) throws MojoExecutionException { try { final Object repositorySessionObject = this . getRepositorySessionMethod . invoke ( this . session ) ; return ( PluginDescriptor ) this . loadPluginMethod . invoke ( this . buildPluginManager , plugin , getSession ( ) . getCurren...
Load the given plugin .
34,078
public void executeMojo ( MojoExecution mojo ) throws MojoExecutionException , MojoFailureException { try { this . buildPluginManager . executeMojo ( this . session , mojo ) ; } catch ( PluginConfigurationException | PluginManagerException e ) { throw new MojoFailureException ( e . getLocalizedMessage ( ) , e ) ; } }
Execute the given mojo .
34,079
@ SuppressWarnings ( "static-method" ) public Dependency toDependency ( Artifact artifact ) { final Dependency result = new Dependency ( ) ; result . setArtifactId ( artifact . getArtifactId ( ) ) ; result . setClassifier ( artifact . getClassifier ( ) ) ; result . setGroupId ( artifact . getGroupId ( ) ) ; result . se...
Convert an artifact to a dependency .
34,080
public synchronized Map < String , Dependency > getPluginDependencies ( ) throws MojoExecutionException { if ( this . pluginDependencies == null ) { final String groupId = getConfig ( "plugin.groupId" ) ; final String artifactId = getConfig ( "plugin.artifactId" ) ; final String pluginArtifactKey = ArtifactUtils . vers...
Build the map of dependencies for the current plugin .
34,081
public Set < Artifact > resolve ( String groupId , String artifactId ) throws MojoExecutionException { final ArtifactResolutionRequest request = new ArtifactResolutionRequest ( ) ; request . setResolveRoot ( true ) ; request . setResolveTransitively ( true ) ; request . setLocalRepository ( getSession ( ) . getLocalRep...
Resolve the artifacts with the given key .
34,082
public Artifact createArtifact ( String groupId , String artifactId ) { return this . repositorySystem . createArtifact ( groupId , artifactId , "RELEASE" , "jar" ) ; }
Create an instance of artifact with a version range that corresponds to all versions .
34,083
public Set < Artifact > resolveDependencies ( String artifactId , boolean plugins ) throws MojoExecutionException { final Artifact pluginArtifact ; if ( plugins ) { pluginArtifact = getSession ( ) . getCurrentProject ( ) . getPluginArtifactMap ( ) . get ( artifactId ) ; } else { pluginArtifact = getSession ( ) . getCur...
Replies the dependencies for the given artifact .
34,084
public String getPluginDependencyVersion ( String groupId , String artifactId ) throws MojoExecutionException { final Map < String , Dependency > deps = getPluginDependencies ( ) ; final String key = ArtifactUtils . versionlessKey ( groupId , artifactId ) ; this . log . debug ( "COMPONENT DEPENDENCIES(getPluginVersionF...
Replies the version of the given plugin that is specified in the POM of the plugin in which this mojo is located .
34,085
@ SuppressWarnings ( "static-method" ) public Xpp3Dom toXpp3Dom ( String content , Log logger ) { if ( content != null && ! content . isEmpty ( ) ) { try ( StringReader sr = new StringReader ( content ) ) { return Xpp3DomBuilder . build ( sr ) ; } catch ( Exception exception ) { if ( logger != null ) { logger . debug (...
Parse the given string for extracting an XML tree .
34,086
@ SuppressWarnings ( "static-method" ) public IJavaBatchCompiler providesJavaBatchCompiler ( Injector injector , Provider < SarlConfig > config ) { final SarlConfig cfg = config . get ( ) ; final IJavaBatchCompiler compiler = cfg . getCompiler ( ) . getJavaCompiler ( ) . newCompilerInstance ( ) ; injector . injectMembe...
Provide a Java batch compiler based on the Bootique configuration .
34,087
private static void uninstallSkillsPreStage ( Iterable < ? extends Skill > skills ) { try { for ( final Skill s : skills ) { SREutils . doSkillUninstallation ( s , UninstallationStage . PRE_DESTROY_EVENT ) ; } } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Run the uninstallation functions of the skills for the pre stage of the uninstallation process .
34,088
private static void uninstallSkillsFinalStage ( Iterable < ? extends Skill > skills ) { try { for ( final Skill s : skills ) { SREutils . doSkillUninstallation ( s , UninstallationStage . POST_DESTROY_EVENT ) ; } } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Run the uninstallation functions of the skills for the final stage of the uninstallation process .
34,089
protected void fireKernelDiscovered ( URI uri ) { this . logger . getKernelLogger ( ) . info ( MessageFormat . format ( Messages . HazelcastKernelDiscoveryService_0 , uri , getCurrentKernel ( ) ) ) ; for ( final KernelDiscoveryServiceListener listener : this . listeners . getListeners ( KernelDiscoveryServiceListener ....
Notifies the listeners about the discovering of a kernel .
34,090
protected void fireKernelDisconnected ( URI uri ) { this . logger . getKernelLogger ( ) . info ( MessageFormat . format ( Messages . HazelcastKernelDiscoveryService_1 , uri , getCurrentKernel ( ) ) ) ; for ( final KernelDiscoveryServiceListener listener : this . listeners . getListeners ( KernelDiscoveryServiceListener...
Notifies the listeners about the killing of a kernel .
34,091
public static SarlConfig getConfiguration ( ConfigurationFactory configFactory ) { assert configFactory != null ; return configFactory . config ( SarlConfig . class , PREFIX ) ; }
Replies the configuration for SARLC .
34,092
protected static File unix2os ( String filename ) { File file = null ; for ( final String base : filename . split ( Pattern . quote ( "/" ) ) ) { if ( file == null ) { file = new File ( base ) ; } else { file = new File ( file , base ) ; } } return file ; }
Create a file from a unix - like representation of the filename .
34,093
protected File makeAbsolute ( File file ) { if ( ! file . isAbsolute ( ) ) { final File basedir = this . mavenHelper . getSession ( ) . getCurrentProject ( ) . getBasedir ( ) ; return new File ( basedir , file . getPath ( ) ) . getAbsoluteFile ( ) ; } return file ; }
Make absolute the given filename relatively to the project s folder .
34,094
protected void executeMojo ( String groupId , String artifactId , String version , String goal , String configuration , Dependency ... dependencies ) throws MojoExecutionException , MojoFailureException { final Plugin plugin = new Plugin ( ) ; plugin . setArtifactId ( artifactId ) ; plugin . setGroupId ( groupId ) ; pl...
Execute another MOJO .
34,095
protected String internalExecute ( ) { getLog ( ) . info ( Messages . AbstractDocumentationMojo_1 ) ; final Map < File , File > files = getFiles ( ) ; getLog ( ) . info ( MessageFormat . format ( Messages . AbstractDocumentationMojo_2 , files . size ( ) ) ) ; return internalExecute ( files ) ; }
Internal run .
34,096
protected String formatErrorMessage ( File inputFile , Throwable exception ) { File filename ; int lineno = 0 ; final boolean addExceptionName ; if ( exception instanceof ParsingException ) { addExceptionName = false ; final ParsingException pexception = ( ParsingException ) exception ; final File file = pexception . g...
Format the error message .
34,097
@ SuppressWarnings ( "checkstyle:npathcomplexity" ) protected AbstractMarkerLanguageParser createLanguageParser ( File inputFile ) throws MojoExecutionException , IOException { final AbstractMarkerLanguageParser parser ; if ( isFileExtension ( inputFile , MarkdownParser . MARKDOWN_FILE_EXTENSIONS ) ) { parser = this . ...
Create a parser for the given file .
34,098
protected Map < File , File > getFiles ( ) { final Map < File , File > files = new TreeMap < > ( ) ; for ( final String rootName : this . inferredSourceDirectories ) { File root = FileSystem . convertStringToFile ( rootName ) ; if ( ! root . isAbsolute ( ) ) { root = FileSystem . makeAbsolute ( root , this . baseDirect...
Replies the source files .
34,099
protected static String toPackageName ( String rootPackage , File packageName ) { final StringBuilder name = new StringBuilder ( ) ; File tmp = packageName ; while ( tmp != null ) { final String elementName = tmp . getName ( ) ; if ( ! Strings . equal ( FileSystem . CURRENT_DIRECTORY , elementName ) && ! Strings . equa...
Convert a file to a package name .