idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
34,200
@ SuppressWarnings ( "static-method" ) protected String getGeneratedMemberAccessor ( MemberDescription description ) { return "get" + Strings . toFirstUpper ( description . getElementDescription ( ) . getElementType ( ) . getSimpleName ( ) ) + "()" ; }
Replies the name of the accessor that replies the generated member .
34,201
protected Binding bindAnnotatedWith ( TypeReference bind , TypeReference annotatedWith , TypeReference to , String functionName ) { final StringConcatenationClient client = new StringConcatenationClient ( ) { protected void appendTo ( TargetStringConcatenation builder ) { builder . append ( "binder.bind(" ) ; builder ....
Bind an annotated element .
34,202
protected Binding bindAnnotatedWithNameToInstance ( TypeReference bind , String name , String to , String functionName ) { String tmpName = Strings . emptyIfNull ( name ) ; if ( tmpName . startsWith ( REFERENCE_PREFIX ) ) { tmpName = tmpName . substring ( REFERENCE_PREFIX . length ( ) ) . trim ( ) ; } else { tmpName = ...
Bind a type annotated with a name of the given value .
34,203
protected Binding bindToInstance ( TypeReference bind , String functionName , String instanceExpression , boolean isSingleton , boolean isEager ) { final BindKey type ; final BindValue value ; if ( ! Strings . isEmpty ( functionName ) && functionName . startsWith ( CONFIGURE_PREFIX ) ) { final String fname = functionNa...
Bind a type to an instance expression .
34,204
public void add ( Binding binding , boolean override ) { final Set < Binding > moduleBindings = this . module . get ( ) . getBindings ( ) ; final Binding otherBinding = findBinding ( moduleBindings , binding ) ; if ( ! override ) { if ( otherBinding != null ) { throw new IllegalArgumentException ( MessageFormat . forma...
Add the binding .
34,205
public void contributeToModule ( ) { final GuiceModuleAccess module = this . module . get ( ) ; if ( ! this . removableBindings . isEmpty ( ) ) { try { final Field field = module . getClass ( ) . getDeclaredField ( "bindings" ) ; final boolean accessible = field . isAccessible ( ) ; try { field . setAccessible ( true )...
Put the bindings to the associated module .
34,206
public Binding toBinding ( BindingElement element ) { final TypeReference typeReference = typeRef ( element . getBind ( ) ) ; final String annotatedWith = element . getAnnotatedWith ( ) ; final String annotatedWithName = element . getAnnotatedWithName ( ) ; if ( ! Strings . isEmpty ( annotatedWith ) ) { final TypeRefer...
Convert a binding element to a Guive binding .
34,207
protected void enableNature ( IProject project ) { final IFile pom = project . getFile ( IMavenConstants . POM_FILE_NAME ) ; final Job job ; if ( pom . exists ( ) ) { job = createJobForMavenProject ( project ) ; } else { job = createJobForJavaProject ( project ) ; } if ( job != null ) { job . schedule ( ) ; } }
Enable the SARL Maven nature .
34,208
@ SuppressWarnings ( "static-method" ) protected Job createJobForMavenProject ( IProject project ) { return new Job ( Messages . EnableSarlMavenNatureAction_0 ) { protected IStatus run ( IProgressMonitor monitor ) { final SubMonitor mon = SubMonitor . convert ( monitor , 3 ) ; try { final IPath descriptionFilename = pr...
Create the configuration job for a Maven project .
34,209
@ SuppressWarnings ( "static-method" ) protected Job createJobForJavaProject ( IProject project ) { return new Job ( Messages . EnableSarlMavenNatureAction_0 ) { protected IStatus run ( IProgressMonitor monitor ) { final SubMonitor mon = SubMonitor . convert ( monitor , 3 ) ; SARLProjectConfigurator . configureSARLProj...
Create the configuration job for a Java project .
34,210
protected void fireAgentSpawnedOutsideAgent ( UUID spawningAgent , AgentContext context , Class < ? extends Agent > agentClazz , List < Agent > agents , Object ... initializationParameters ) { for ( final SpawnServiceListener l : this . globalListeners . getListeners ( SpawnServiceListener . class ) ) { l . agentSpawne...
Notify the listeners about the agents spawning .
34,211
protected void fireAgentSpawnedInAgent ( UUID spawningAgent , AgentContext context , Agent agent , Object ... initializationParameters ) { final ListenerCollection < SpawnServiceListener > list ; synchronized ( this . agentLifecycleListeners ) { list = this . agentLifecycleListeners . get ( agent . getID ( ) ) ; } if (...
Notify the agent s listeners about its spawning .
34,212
public SynchronizedSet < UUID > getAgents ( ) { final Object mutex = getAgentRepositoryMutex ( ) ; synchronized ( mutex ) { return Collections3 . synchronizedSet ( this . agents . keySet ( ) , mutex ) ; } }
Replies the registered agents .
34,213
Agent getAgent ( UUID id ) { assert id != null ; synchronized ( getAgentRepositoryMutex ( ) ) { return this . agents . get ( id ) ; } }
Replies the registered agent .
34,214
@ SuppressWarnings ( "static-method" ) public boolean canKillAgent ( Agent agent ) { try { final AgentContext ac = BuiltinCapacityUtil . getContextIn ( agent ) ; if ( ac != null ) { final SynchronizedSet < UUID > participants = ac . getDefaultSpace ( ) . getParticipants ( ) ; if ( participants != null ) { synchronized ...
Replies if the given agent can be killed .
34,215
@ SuppressWarnings ( { "checkstyle:npathcomplexity" } ) protected void fireAgentDestroyed ( Agent agent ) { final ListenerCollection < SpawnServiceListener > list ; synchronized ( getAgentLifecycleListenerMutex ( ) ) { list = this . agentLifecycleListeners . get ( agent . getID ( ) ) ; } final SpawnServiceListener [ ] ...
Notifies the listeners about the agent destruction .
34,216
protected void initFields ( ) { final IEclipsePreferences prefs = SARLEclipsePlugin . getDefault ( ) . getPreferences ( ) ; this . trackerLogin . setText ( prefs . get ( PREFERENCE_LOGIN , "" ) ) ; }
Set the initial values to the fields .
34,217
protected void updatePageStatus ( ) { final boolean ok ; if ( Strings . isEmpty ( this . titleField . getText ( ) ) ) { ok = false ; setMessage ( Messages . IssueInformationPage_5 , IMessageProvider . ERROR ) ; } else if ( Strings . isEmpty ( this . trackerLogin . getText ( ) ) ) { ok = false ; setMessage ( Messages . ...
Update the page status and change the finish state button .
34,218
public boolean performFinish ( ) { final IEclipsePreferences prefs = SARLEclipsePlugin . getDefault ( ) . getPreferences ( ) ; final String login = this . trackerLogin . getText ( ) ; if ( Strings . isEmpty ( login ) ) { prefs . remove ( PREFERENCE_LOGIN ) ; } else { prefs . put ( PREFERENCE_LOGIN , login ) ; } try { p...
Invoked when the wizard is closed with the Finish button .
34,219
public String format ( String sarlCode , ResourceSet resourceSet ) { try { final URI createURI = URI . createURI ( "synthetic://to-be-formatted." + this . fileExtension ) ; final Resource res = this . resourceFactory . createResource ( createURI ) ; if ( res instanceof XtextResource ) { final XtextResource resource = (...
Format the given code .
34,220
@ SuppressWarnings ( "static-method" ) public Boolean toBooleanPrimitiveWrapperConstant ( XExpression expression ) { if ( expression instanceof XBooleanLiteral ) { return ( ( XBooleanLiteral ) expression ) . isIsTrue ( ) ? Boolean . TRUE : Boolean . FALSE ; } if ( expression instanceof XMemberFeatureCall ) { final XMem...
Convert the boolean constant to the object equivalent if possible .
34,221
public boolean isFrom ( UUID entityId ) { final Address iSource = getSource ( ) ; return ( entityId != null ) && ( iSource != null ) && entityId . equals ( iSource . getUUID ( ) ) ; }
Replies if the event was emitted by an entity with the given identifier .
34,222
protected void generateClosureDefinition ( XClosure closure , IAppendable it , IExtraLanguageGeneratorContext context ) { if ( ! it . hasName ( closure ) ) { final LightweightTypeReference closureType0 = getExpectedType ( closure ) ; LightweightTypeReference closureType = closureType0 ; if ( closureType0 . isFunctionTy...
Generate the closure definition .
34,223
protected void generateAnonymousClassDefinition ( AnonymousClass anonClass , IAppendable it , IExtraLanguageGeneratorContext context ) { if ( ! it . hasName ( anonClass ) && it instanceof PyAppendable ) { final LightweightTypeReference jvmAnonType = getExpectedType ( anonClass ) ; final String anonName = it . declareSy...
Generate the anonymous class definition .
34,224
@ SuppressWarnings ( { "checkstyle:cyclomaticcomplexity" , "checkstyle:booleanexpressioncomplexity" , "checkstyle:npathcomplexity" } ) public static String toDefaultValue ( JvmTypeReference type ) { final String id = type . getIdentifier ( ) ; if ( ! "void" . equals ( id ) ) { if ( Strings . equal ( Boolean . class . g...
Replies the Python default value for the given type .
34,225
protected PyFeatureCallGenerator newFeatureCallGenerator ( IExtraLanguageGeneratorContext context , IAppendable it ) { return new PyFeatureCallGenerator ( context , ( ExtraLanguageAppendable ) it ) ; }
Generate a feature call .
34,226
protected String readSarlEclipseSetting ( String sourceDirectory ) { if ( this . propertiesFileLocation != null ) { final File file = new File ( this . propertiesFileLocation ) ; if ( file . canRead ( ) ) { final Properties sarlSettings = new Properties ( ) ; try ( FileInputStream stream = new FileInputStream ( file ) ...
Read the SARL Eclipse settings for the project if existing .
34,227
protected List < File > getClassPath ( ) throws MojoExecutionException { if ( this . bufferedClasspath == null ) { final Set < String > classPath = new LinkedHashSet < > ( ) ; final MavenProject project = getProject ( ) ; classPath . add ( project . getBuild ( ) . getSourceDirectory ( ) ) ; try { classPath . addAll ( p...
Replies the classpath for the standard code .
34,228
protected boolean executeExportOperation ( IJarExportRunnable op , IStatus wizardPageStatus ) { try { getContainer ( ) . run ( true , true , op ) ; } catch ( InterruptedException e ) { return false ; } catch ( InvocationTargetException ex ) { if ( ex . getTargetException ( ) != null ) { ExceptionHandler . handle ( ex ,...
Exports the JAR package .
34,229
public void init ( IWorkbench workbench , JarPackageData jarPackage ) { Assert . isNotNull ( workbench ) ; Assert . isNotNull ( jarPackage ) ; fJarPackage = jarPackage ; setInitializeFromJarPackage ( true ) ; setWindowTitle ( FatJarPackagerMessages . JarPackageWizard_windowTitle ) ; setDefaultPageImageDescriptor ( Java...
Initializes this wizard from the given JAR package description .
34,230
protected Image convertToImage ( Object imageDescription ) { if ( imageDescription instanceof Image ) { return ( Image ) imageDescription ; } else if ( imageDescription instanceof ImageDescriptor ) { return this . imageHelper . getImage ( ( ImageDescriptor ) imageDescription ) ; } else if ( imageDescription instanceof ...
Replies the image that corresponds to the given object .
34,231
@ SuppressWarnings ( "static-method" ) protected int getIssueAdornment ( XtendMember element ) { final ICompositeNode node = NodeModelUtils . getNode ( element ) ; if ( node == null ) { return 0 ; } final Resource resource = element . eResource ( ) ; if ( ! resource . getURI ( ) . isArchive ( ) ) { if ( hasParserIssue ...
Replies the diagnotic adornment for the given element .
34,232
@ SuppressWarnings ( "static-method" ) public IJavaElement getSelectedResource ( IStructuredSelection selection ) { IJavaElement elem = null ; if ( selection != null && ! selection . isEmpty ( ) ) { final Object object = selection . getFirstElement ( ) ; if ( object instanceof IAdaptable ) { final IAdaptable adaptable ...
Replies the Java element that corresponds to the given selection .
34,233
public String getBasePackage ( ) { final Grammar grammar = getGrammar ( ) ; final String basePackage = this . naming . getRuntimeBasePackage ( grammar ) ; return basePackage + ".services" ; }
Replies the base package for the language .
34,234
protected static Iterable < Keyword > getAllKeywords ( Grammar grammar ) { final Map < String , Keyword > keywords = new HashMap < > ( ) ; final List < ParserRule > rules = GrammarUtil . allParserRules ( grammar ) ; for ( final ParserRule parserRule : rules ) { final List < Keyword > list = typeSelect ( eAllContentsAsL...
Replies the keywords in the given grammar .
34,235
protected StringConcatenationClient generateKeyword ( final String keyword , final String comment , Map < String , String > getters ) { final String fieldName = keyword . toUpperCase ( ) . replaceAll ( "[^a-zA-Z0-9_]+" , "_" ) ; final String methodName = Strings . toFirstUpper ( keyword . replaceAll ( "[^a-zA-Z0-9_]+" ...
Generate a basic keyword .
34,236
protected StringConcatenationClient generateKeyword ( final Keyword keyword , final String comment , Map < String , String > getters ) { try { final String methodName = getIdentifier ( keyword ) ; final String accessor = GrammarKeywordAccessFragment2 . this . grammarAccessExtensions . gaAccessor ( keyword ) ; if ( ! St...
Generate a grammar keyword .
34,237
@ SuppressWarnings ( "static-method" ) protected String protectCommentKeyword ( String keyword ) { if ( "*/" . equals ( keyword ) ) { return "* /" ; } if ( "/*" . equals ( keyword ) ) { return "/ *" ; } if ( "//" . equals ( keyword ) ) { return "/ /" ; } return keyword ; }
Protect the keywword for Java comments .
34,238
@ SuppressWarnings ( { "checkstyle:npathcomplexity" , "checkstyle:cyclomaticcomplexity" } ) protected boolean isIgnorableCallToFeature ( ILinkingCandidate candidate ) { final JvmIdentifiableElement feature = candidate . getFeature ( ) ; if ( feature instanceof JvmOperation ) { JvmAnnotationTarget target = ( JvmOperatio...
Replies if ambiguity could be removed for the given feature .
34,239
protected void _computeTypes ( SarlBreakExpression object , ITypeComputationState state ) { final LightweightTypeReference primitiveVoid = getPrimitiveVoid ( state ) ; state . acceptActualType ( primitiveVoid ) ; }
Compute the type of a break expression .
34,240
protected void _computeTypes ( SarlAssertExpression object , ITypeComputationState state ) { state . withExpectation ( getTypeForName ( Boolean . class , state ) ) . computeTypes ( object . getCondition ( ) ) ; }
Compute the type of an assert expression .
34,241
@ SuppressWarnings ( "checkstyle:nestedifdepth" ) protected void _computeTypes ( SarlCastedExpression cast , ITypeComputationState state ) { if ( state instanceof AbstractTypeComputationState ) { final JvmTypeReference type = cast . getType ( ) ; if ( type != null ) { state . withNonVoidExpectation ( ) . computeTypes (...
Compute the type of a casted expression .
34,242
@ SuppressWarnings ( "unchecked" ) protected void fireEntryRemoved ( K key , V value ) { if ( this . listeners != null ) { for ( final DMapListener < ? super K , ? super V > listener : this . listeners . getListeners ( DMapListener . class ) ) { listener . entryRemoved ( key , value ) ; } } }
Fire the removal event .
34,243
@ SuppressWarnings ( "unchecked" ) protected void fireEntryUpdated ( K key , V value ) { for ( final DMapListener < ? super K , ? super V > listener : this . listeners . getListeners ( DMapListener . class ) ) { listener . entryUpdated ( key , value ) ; } }
Fire the update event .
34,244
@ SuppressWarnings ( "unchecked" ) protected void fireCleared ( boolean localClearing ) { for ( final DMapListener < ? super K , ? super V > listener : this . listeners . getListeners ( DMapListener . class ) ) { listener . mapCleared ( localClearing ) ; } }
Fire the clearing event .
34,245
protected Xpp3Dom createSREConfiguration ( ) throws MojoExecutionException , MojoFailureException { final Xpp3Dom xmlConfiguration = new Xpp3Dom ( "configuration" ) ; final Xpp3Dom xmlArchive = new Xpp3Dom ( "archive" ) ; xmlConfiguration . addChild ( xmlArchive ) ; final String mainClass = getMainClass ( ) ; if ( main...
Create the configuration of the SRE with the maven archive format .
34,246
private void runInitializationStage ( Event event ) { try { setOwnerState ( OwnerState . INITIALIZING ) ; try { this . eventDispatcher . immediateDispatch ( event ) ; } finally { setOwnerState ( OwnerState . ALIVE ) ; } this . agentAsEventListener . fireEnqueuedEvents ( this ) ; if ( this . agentAsEventListener . isKil...
This function runs the initialization of the agent .
34,247
private void runDestructionStage ( Event event ) { try { setOwnerState ( OwnerState . DYING ) ; try { this . eventDispatcher . immediateDispatch ( event ) ; } finally { setOwnerState ( OwnerState . DEAD ) ; } } catch ( Exception e ) { final Logging loggingCapacity = getLoggingSkill ( ) ; if ( loggingCapacity != null ) ...
This function runs the destruction of the agent .
34,248
protected boolean isCapacityMethodCall ( JvmOperation feature ) { if ( feature != null ) { final JvmDeclaredType container = feature . getDeclaringType ( ) ; if ( container instanceof JvmGenericType ) { return this . inheritanceHelper . isSarlCapacity ( ( JvmGenericType ) container ) ; } } return false ; }
Replies if the given call is for a capacity function call .
34,249
protected void completeJavaTypes ( ContentAssistContext context , ITypesProposalProvider . Filter filter , ICompletionProposalAcceptor acceptor ) { completeJavaTypes ( context , TypesPackage . Literals . JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE , true , getQualifiedNameValueConverter ( ) , filter , acceptor ) ; }
Complete for Java types .
34,250
protected void completeSarlEvents ( boolean allowEventType , boolean isExtensionFilter , ContentAssistContext context , ICompletionProposalAcceptor acceptor ) { if ( isSarlProposalEnabled ( ) ) { completeSubJavaTypes ( Event . class , allowEventType , context , TypesPackage . Literals . JVM_PARAMETERIZED_TYPE_REFERENCE...
Complete for obtaining SARL events if the proposals are enabled .
34,251
protected void completeSarlCapacities ( boolean allowCapacityType , boolean isExtensionFilter , ContentAssistContext context , ICompletionProposalAcceptor acceptor ) { if ( isSarlProposalEnabled ( ) ) { completeSubJavaTypes ( Capacity . class , allowCapacityType , context , TypesPackage . Literals . JVM_PARAMETERIZED_T...
Complete for obtaining SARL capacities if the proposals are enabled .
34,252
protected void completeSarlAgents ( boolean allowAgentType , boolean isExtensionFilter , ContentAssistContext context , ICompletionProposalAcceptor acceptor ) { if ( isSarlProposalEnabled ( ) ) { completeSubJavaTypes ( Agent . class , allowAgentType , context , TypesPackage . Literals . JVM_PARAMETERIZED_TYPE_REFERENCE...
Complete for obtaining SARL agents if the proposals are enabled .
34,253
protected void completeSarlBehaviors ( boolean allowBehaviorType , boolean isExtensionFilter , ContentAssistContext context , ICompletionProposalAcceptor acceptor ) { if ( isSarlProposalEnabled ( ) ) { completeSubJavaTypes ( Behavior . class , allowBehaviorType , context , TypesPackage . Literals . JVM_PARAMETERIZED_TY...
Complete for obtaining SARL behaviors if the proposals are enabled .
34,254
protected void completeSarlSkills ( boolean allowSkillType , boolean isExtensionFilter , ContentAssistContext context , ICompletionProposalAcceptor acceptor ) { if ( isSarlProposalEnabled ( ) ) { completeSubJavaTypes ( Skill . class , allowSkillType , context , TypesPackage . Literals . JVM_PARAMETERIZED_TYPE_REFERENCE...
Complete for obtaining SARL skills if proposals are enabled .
34,255
protected void completeExceptions ( boolean allowExceptionType , ContentAssistContext context , ICompletionProposalAcceptor acceptor ) { if ( isSarlProposalEnabled ( ) ) { completeSubJavaTypes ( Exception . class , allowExceptionType , context , TypesPackage . Literals . JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE , getQual...
Complete for obtaining exception types if proposals are enabled .
34,256
protected void completeSubJavaTypes ( Class < ? > superType , boolean allowSuperTypeItself , ContentAssistContext context , EReference reference , IValueConverter < String > valueConverter , final ITypesProposalProvider . Filter filter , ICompletionProposalAcceptor acceptor ) { assert superType != null ; final INode la...
Complete for obtaining SARL types that are subtypes of the given type .
34,257
protected String getExpectedPackageName ( EObject model ) { final URI fileURI = model . eResource ( ) . getURI ( ) ; for ( final Pair < IStorage , IProject > storage : this . storage2UriMapper . getStorages ( fileURI ) ) { if ( storage . getFirst ( ) instanceof IFile ) { final IPath fileWorkspacePath = storage . getFir...
Replies the expected package for the given model .
34,258
protected void completeExtends ( EObject model , ContentAssistContext context , ICompletionProposalAcceptor acceptor ) { if ( isSarlProposalEnabled ( ) ) { if ( model instanceof SarlAgent ) { completeSarlAgents ( false , true , context , acceptor ) ; } else if ( model instanceof SarlBehavior ) { completeSarlBehaviors (...
Complete the extends if the proposals are enabled .
34,259
protected void _createChildren ( DocumentRootNode parentNode , SarlScript modelElement ) { if ( ! Strings . isNullOrEmpty ( modelElement . getPackage ( ) ) ) { createEStructuralFeatureNode ( parentNode , modelElement , XtendPackage . Literals . XTEND_FILE__PACKAGE , this . imageDispatcher . invoke ( getClass ( ) . getP...
Create a node for the SARL script .
34,260
@ SuppressWarnings ( "checkstyle:cyclomaticcomplexity" ) protected void _createNode ( DocumentRootNode parentNode , XtendTypeDeclaration modelElement ) { final boolean isFeatureSet = modelElement . eIsSet ( XtendPackage . Literals . XTEND_TYPE_DECLARATION__NAME ) ; final EStructuralFeatureNode elementNode = new EStruct...
Create a node for the given feature container .
34,261
protected Image _image ( XtendMember modelElement ) { final Image img = super . _image ( modelElement ) ; return this . diagnoticDecorator . decorateImage ( img , modelElement ) ; }
Get the image for the Xtend members .
34,262
public IFormalParameterBuilder addParameter ( String name ) { IFormalParameterBuilder builder = this . parameterProvider . get ( ) ; builder . eInit ( this . sarlConstructor , name , getTypeResolutionContext ( ) ) ; return builder ; }
Add a formal parameter .
34,263
@ SuppressWarnings ( "static-method" ) protected boolean isValidResource ( IResource resource ) { return resource . isAccessible ( ) && ! resource . isHidden ( ) && ! resource . isPhantom ( ) && ! resource . isDerived ( ) ; }
Replies if the given resource could be considered for discovering an agent to be launched .
34,264
public ElementDescription searchAndSelect ( boolean showEmptySelectionError , Object ... scope ) { try { final List < ElementDescription > elements = findElements ( scope , PlatformUI . getWorkbench ( ) . getProgressService ( ) ) ; ElementDescription element = null ; if ( elements == null || elements . isEmpty ( ) ) { ...
Search the elements based on the given scope and select one . If more than one element was found the user selects interactively one .
34,265
private ElementDescription chooseElement ( List < ElementDescription > elements ) { final ElementListSelectionDialog dialog = new ElementListSelectionDialog ( getShell ( ) , new LabelProvider ( ) ) ; dialog . setElements ( elements . toArray ( ) ) ; dialog . setTitle ( MessageFormat . format ( Messages . AbstractSarlSc...
Prompts the user to select an element from the given element types .
34,266
public String getValidationDescription ( ) { final JvmOperation feature = getOperation ( ) ; String message = null ; if ( ! getDeclaredTypeParameters ( ) . isEmpty ( ) ) { message = MessageFormat . format ( Messages . CastOperatorLinkingCandidate_0 , getFeatureTypeParametersAsString ( true ) , feature . getSimpleName (...
Replies the string representation of the candidate .
34,267
private JvmAnnotationReference annotationClassRef ( Class < ? extends Annotation > type , List < ? extends JvmTypeReference > values ) { try { final JvmAnnotationReference annot = this . _annotationTypesBuilder . annotationRef ( type ) ; final JvmTypeAnnotationValue annotationValue = this . services . getTypesFactory (...
Create an annotation with classes as values .
34,268
protected void initializeLocalTypes ( GenerationContext context , JvmFeature feature , XExpression expression ) { if ( expression != null ) { int localTypeIndex = context . getLocalTypeIndex ( ) ; final TreeIterator < EObject > iterator = EcoreUtil2 . getAllNonDerivedContents ( expression , true ) ; final String nameSt...
Initialize the local class to the given expression .
34,269
protected void setBody ( JvmExecutable executable , Procedure1 < ITreeAppendable > expression ) { this . typeBuilder . setBody ( executable , expression ) ; }
Set the body of the executable .
34,270
protected final synchronized GenerationContext openContext ( EObject sarlObject , JvmDeclaredType type , final Iterable < Class < ? extends XtendMember > > supportedMemberTypes ) { assert type != null ; assert supportedMemberTypes != null ; this . sarlSignatureProvider . clear ( type ) ; final GenerationContext context...
Open the context for the generation of a SARL - specific element .
34,271
protected final void closeContext ( GenerationContext context ) { boolean runPostElements = false ; GenerationContext selectedContext = null ; synchronized ( this ) { final Iterator < GenerationContext > iterator = this . bufferedContexes . iterator ( ) ; while ( selectedContext == null && iterator . hasNext ( ) ) { fi...
Close a generation context .
34,272
protected final synchronized GenerationContext getContext ( JvmIdentifiableElement type ) { for ( final GenerationContext candidate : this . bufferedContexes ) { if ( Objects . equal ( candidate . getTypeIdentifier ( ) , type . getIdentifier ( ) ) ) { return candidate ; } } throw new GenerationContextNotFoundInternalEr...
Replies the SARL - specific generation context .
34,273
protected void appendDefaultConstructors ( XtendTypeDeclaration source , JvmGenericType target ) { final GenerationContext context = getContext ( target ) ; if ( ! context . hasConstructor ( ) ) { final boolean notInitializedValueField = Iterables . any ( source . getMembers ( ) , it -> { if ( it instanceof XtendField ...
Add the default constructors .
34,274
protected void initialize ( SarlSkill source , JvmGenericType inferredJvmType ) { assert source != null ; assert inferredJvmType != null ; if ( Strings . isNullOrEmpty ( source . getName ( ) ) ) { return ; } final GenerationContext context = openContext ( source , inferredJvmType , Arrays . asList ( SarlField . class ,...
Initialize the SARL skill type .
34,275
protected void initialize ( SarlCapacity source , JvmGenericType inferredJvmType ) { assert source != null ; assert inferredJvmType != null ; if ( Strings . isNullOrEmpty ( source . getName ( ) ) ) { return ; } final GenerationContext context = openContext ( source , inferredJvmType , Collections . singleton ( SarlActi...
Initialize the SARL capacity type .
34,276
@ SuppressWarnings ( "static-method" ) protected void initialize ( SarlSpace source , JvmGenericType inferredJvmType ) { assert source != null ; assert inferredJvmType != null ; if ( Strings . isNullOrEmpty ( source . getName ( ) ) ) { return ; } }
Initialize the SARL space type .
34,277
protected void transform ( XtendField source , JvmGenericType container ) { super . transform ( source , container ) ; final JvmField field = ( JvmField ) this . sarlAssociations . getPrimaryJvmElement ( source ) ; setVisibility ( field , source ) ; final GenerationContext context = getContext ( container ) ; if ( cont...
Transform the field .
34,278
protected void appendAOPMembers ( JvmGenericType featureContainerType , XtendTypeDeclaration container , GenerationContext context ) { Utils . populateInheritanceContext ( featureContainerType , context . getInheritedFinalOperations ( ) , context . getInheritedOverridableOperations ( ) , null , context . getInheritedOp...
Generate the code for the given SARL members in a agent - oriented container .
34,279
private static StringConcatenationClient toStringConcatenation ( final String ... javaCodeLines ) { return new StringConcatenationClient ( ) { protected void appendTo ( StringConcatenationClient . TargetStringConcatenation builder ) { for ( final String line : javaCodeLines ) { builder . append ( line ) ; builder . new...
Create a string concatenation client from a set of Java code lines .
34,280
protected void appendConstrainedImplements ( GenerationContext context , JvmGenericType owner , Class < ? > defaultJvmType , Class < ? extends XtendTypeDeclaration > defaultSarlType , List < ? extends JvmParameterizedTypeReference > implementedtypes ) { boolean explicitType = false ; for ( final JvmParameterizedTypeRef...
Generate the implemented types for the given SARL statement .
34,281
protected void appendEventGuardEvaluators ( JvmGenericType container ) { final GenerationContext context = getContext ( container ) ; if ( context != null ) { final Collection < Pair < SarlBehaviorUnit , Collection < Procedure1 < ? super ITreeAppendable > > > > allEvaluators = context . getGuardEvaluationCodes ( ) ; if...
Append the guard evaluators .
34,282
protected void appendSerialNumber ( GenerationContext context , XtendTypeDeclaration source , JvmGenericType target ) { if ( ! isAppendSerialNumbersEnable ( context ) ) { return ; } for ( final JvmField field : target . getDeclaredFields ( ) ) { if ( SERIAL_FIELD_NAME . equals ( field . getSimpleName ( ) ) ) { return ;...
Append the serial number field .
34,283
protected void appendSerialNumberIfSerializable ( GenerationContext context , XtendTypeDeclaration source , JvmGenericType target ) { if ( ! target . isInterface ( ) && this . inheritanceHelper . isSubTypeOf ( target , Serializable . class , null ) ) { appendSerialNumber ( context , source , target ) ; } }
Append the serial number field if and only if the container type is serializable .
34,284
protected void appendCloneFunction ( GenerationContext context , XtendTypeDeclaration source , JvmGenericType target ) { if ( ! isAppendCloneFunctionsEnable ( context ) ) { return ; } for ( final JvmOperation operation : target . getDeclaredOperations ( ) ) { if ( CLONE_FUNCTION_NAME . equals ( operation . getSimpleNam...
Append the clone function .
34,285
protected void appendSARLSpecificationVersion ( GenerationContext context , XtendTypeDeclaration source , JvmDeclaredType target ) { addAnnotationSafe ( target , SarlSpecification . class , SARLVersion . SPECIFICATION_RELEASE_VERSION_STRING ) ; }
Append the SARL specification version as an annotation to the given container .
34,286
protected void appendSARLElementType ( XtendTypeDeclaration source , JvmDeclaredType target ) { addAnnotationSafe ( target , SarlElementType . class , source . eClass ( ) . getClassifierID ( ) ) ; }
Append the SARL element type as an annotation to the given container .
34,287
protected JvmTypeReference skipTypeParameters ( JvmTypeReference type , Notifier context ) { final LightweightTypeReference ltr = Utils . toLightweightTypeReference ( type , this . services ) ; return ltr . getRawTypeReference ( ) . toJavaCompliantTypeReference ( ) ; }
Remove the type parameters from the given type .
34,288
@ SuppressWarnings ( "static-method" ) protected void translateAnnotationsTo ( List < JvmAnnotationReference > annotations , JvmAnnotationTarget target , Class < ? > ... exceptions ) { final Set < String > excepts = new HashSet < > ( ) ; for ( final Class < ? > type : exceptions ) { excepts . add ( type . getName ( ) )...
Copy the annotations except the ones given as parameters .
34,289
@ SuppressWarnings ( "static-method" ) protected List < JvmTypeParameter > getTypeParametersFor ( XtendTypeDeclaration type ) { if ( type instanceof XtendClass ) { return ( ( XtendClass ) type ) . getTypeParameters ( ) ; } if ( type instanceof XtendInterface ) { return ( ( XtendInterface ) type ) . getTypeParameters ( ...
Replies the type parameters for the given type .
34,290
protected JvmTypeReference cloneWithTypeParametersAndProxies ( JvmTypeReference type , JvmExecutable forExecutable ) { assert forExecutable . getDeclaringType ( ) != null ; final Map < String , JvmTypeReference > superTypeParameterMapping = new HashMap < > ( ) ; Utils . getSuperTypeParameterMap ( forExecutable . getDec...
Clone the given type reference that for being link to the given executable component .
34,291
protected JvmTypeReference cloneWithProxiesFromOtherResource ( JvmTypeReference type , JvmOperation target ) { if ( type == null ) { return this . _typeReferenceBuilder . typeRef ( Void . TYPE ) ; } if ( InferredTypeIndicator . isInferred ( type ) ) { return type ; } final String id = type . getIdentifier ( ) ; if ( Ob...
Clone the given type reference that is associated to another Xtext resource .
34,292
@ SuppressWarnings ( "checkstyle:npathcomplexity" ) protected void copyNonStaticPublicJvmOperations ( JvmGenericType source , JvmGenericType target , Set < ActionPrototype > createdActions , Procedure2 < ? super JvmOperation , ? super ITreeAppendable > bodyBuilder ) { final Iterable < JvmOperation > operations = Iterab...
Copy the JVM operations from the source to the destination .
34,293
protected JvmTypeReference inferFunctionReturnType ( XExpression body ) { XExpression expr = body ; boolean stop = false ; while ( ! stop && expr instanceof XBlockExpression ) { final XBlockExpression block = ( XBlockExpression ) expr ; switch ( block . getExpressions ( ) . size ( ) ) { case 0 : expr = null ; break ; c...
Infer the function s return type .
34,294
protected JvmTypeReference inferFunctionReturnType ( XtendFunction source , JvmOperation target , JvmOperation overriddenOperation ) { if ( source . getReturnType ( ) != null ) { return ensureValidType ( source . eResource ( ) , source . getReturnType ( ) ) ; } if ( overriddenOperation != null ) { final JvmTypeReferenc...
Infer the return type for the given source function .
34,295
@ SuppressWarnings ( "checkstyle:npathcomplexity" ) public void setFrom ( SARLConfiguration config ) { if ( this . input == null ) { this . input = config . getInput ( ) ; } if ( this . output == null ) { this . output = config . getOutput ( ) ; } if ( this . binOutput == null ) { this . binOutput = config . getBinOutp...
Set the uninitialized field with given configuration .
34,296
@ SuppressWarnings ( { "static-method" , "checkstyle:npathcomplexity" } ) public SarlBatchCompiler provideSarlBatchCompiler ( Injector injector , Provider < SarlConfig > config , Provider < SARLBootClasspathProvider > defaultBootClasspath , Provider < IssueMessageFormatter > issueMessageFormater , Provider < IJavaBatch...
Replies the SARL batch compiler .
34,297
@ SuppressWarnings ( "static-method" ) protected Visibility applyMinMaxVisibility ( Visibility visibility , MutableFieldDeclaration it , TransformationContext context ) { if ( context . findTypeGlobally ( Agent . class ) . isAssignableFrom ( it . getDeclaringType ( ) ) ) { if ( visibility . compareTo ( Visibility . PRO...
Apply the minimum and maximum visibilities to the given one .
34,298
public static < RT , T > ReflectMethod < RT , T > of ( Class < RT > receiverType , Class < T > returnType , String methodName ) { return new ReflectMethod < > ( receiverType , returnType , methodName ) ; }
Static constructor .
34,299
public T invoke ( RT receiver , Object ... arguments ) { assert receiver != null ; final Method method ; synchronized ( this ) { if ( this . method == null ) { this . method = getMethod ( receiver , arguments ) ; method = this . method ; } else { method = this . method ; } } try { return this . returnType . cast ( meth...
Invoke the method .