idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
34,400 | public ConstructorDoc wrap ( ConstructorDoc source ) { if ( source == null || source instanceof Proxy < ? > || ! ( source instanceof ConstructorDocImpl ) ) { return source ; } return new ConstructorDocWrapper ( ( ConstructorDocImpl ) source ) ; } | Wrap a constructor doc . |
34,401 | public MethodDoc wrap ( MethodDoc source ) { if ( source == null || source instanceof Proxy < ? > || ! ( source instanceof MethodDocImpl ) ) { return source ; } return new MethodDocWrapper ( ( MethodDocImpl ) source ) ; } | Wrap a method doc . |
34,402 | public AnnotationTypeElementDoc wrap ( AnnotationTypeElementDoc source ) { if ( source == null || source instanceof Proxy < ? > || ! ( source instanceof AnnotationTypeElementDocImpl ) ) { return source ; } return new AnnotationTypeElementDocWrapper ( ( AnnotationTypeElementDocImpl ) source ) ; } | Wrap a annotation type element doc . |
34,403 | @ Inline ( value = "(long) (($1).doubleValue() * $2.MILLIS_IN_SECOND)" , imported = { TimeExtensions . class } ) public static long seconds ( Number secs ) { return ( long ) ( secs . doubleValue ( ) * MILLIS_IN_SECOND ) ; } | Convert seconds to milliseconds . |
34,404 | @ Inline ( value = "(long) (($1).doubleValue() * $2.MILLIS_IN_MINUTE)" , imported = { TimeExtensions . class } ) public static long minutes ( Number mins ) { return ( long ) ( mins . doubleValue ( ) * MILLIS_IN_MINUTE ) ; } | Convert minutes to milliseconds . |
34,405 | @ Inline ( value = "(long) (($1).doubleValue() * $2.MILLIS_IN_HOUR)" , imported = { TimeExtensions . class } ) public static long hours ( Number hours ) { return ( long ) ( hours . doubleValue ( ) * MILLIS_IN_HOUR ) ; } | Convert hours to milliseconds . |
34,406 | @ Inline ( value = "(long) (($1).doubleValue() * $2.MILLIS_IN_DAY)" , imported = { TimeExtensions . class } ) public static long days ( Number days ) { return ( long ) ( days . doubleValue ( ) * MILLIS_IN_DAY ) ; } | Convert days to milliseconds . |
34,407 | @ Inline ( value = "(long) (($1).doubleValue() * $2.MILLIS_IN_WEEK)" , imported = { TimeExtensions . class } ) public static long weeks ( Number weeks ) { return ( long ) ( weeks . doubleValue ( ) * MILLIS_IN_WEEK ) ; } | Convert weeks to milliseconds . |
34,408 | public Injector createInjectorAndDoEMFRegistration ( Module ... modules ) { doPreSetup ( ) ; final Injector injector = createInjector ( modules ) ; register ( injector ) ; return injector ; } | Create the injector based on the given set of modules and prepare the EMF infrastructure . |
34,409 | @ SuppressWarnings ( "static-method" ) public Injector createInjector ( Module ... modules ) { return Guice . createInjector ( Modules . override ( new SARLRuntimeModule ( ) ) . with ( modules ) ) ; } | Create the injectors based on the given set of modules . |
34,410 | protected static int installationOrder ( Skill skill ) { final int len = StandardBuiltinCapacitiesProvider . SKILL_INSTALLATION_ORDER . length ; if ( skill instanceof BuiltinSkill ) { for ( int i = 0 ; i < len ; ++ i ) { final Class < ? extends Skill > type = StandardBuiltinCapacitiesProvider . SKILL_INSTALLATION_ORDER [ i ] ; if ( type . isInstance ( skill ) ) { return i ; } } } return len ; } | Replies the installation order of the given skill . |
34,411 | public AbstractSREInstallPage getPage ( ISREInstall sre ) { final IExtensionPoint extensionPoint = Platform . getExtensionRegistry ( ) . getExtensionPoint ( SARLEclipsePlugin . PLUGIN_ID , SARLEclipseConfig . EXTENSION_POINT_SRE_INSTALL_PAGES ) ; if ( sre != null && extensionPoint != null ) { IConfigurationElement firstTypeMatching = null ; for ( final IConfigurationElement info : extensionPoint . getConfigurationElements ( ) ) { final String id = info . getAttribute ( "sreInstallId" ) ; if ( sre . getId ( ) . equals ( Strings . nullToEmpty ( id ) ) ) { try { final AbstractSREInstallPage page = ( AbstractSREInstallPage ) info . createExecutableExtension ( "class" ) ; page . setExistingNames ( this . names ) ; return page ; } catch ( CoreException e ) { SARLEclipsePlugin . getDefault ( ) . log ( e ) ; } } else if ( firstTypeMatching == null && isInstance ( info . getAttribute ( "sreInstallType" ) , sre ) ) { firstTypeMatching = info ; } } if ( firstTypeMatching != null ) { try { final AbstractSREInstallPage page = ( AbstractSREInstallPage ) firstTypeMatching . createExecutableExtension ( "class" ) ; page . setExistingNames ( this . names ) ; return page ; } catch ( CoreException e ) { SARLEclipsePlugin . getDefault ( ) . log ( e ) ; } } } if ( sre == null || sre instanceof StandardSREInstall ) { final StandardSREPage standardVMPage = new StandardSREPage ( ) ; standardVMPage . setExistingNames ( this . names ) ; return standardVMPage ; } throw new SREException ( MessageFormat . format ( Messages . SREInstallWizard_5 , sre . getName ( ) ) ) ; } | Returns a page to use for editing a SRE install type . |
34,412 | protected Resource getXtextResource ( ) { final XtextEditor editor = getEditor ( ) ; if ( editor != null ) { final IResource resource = editor . getResource ( ) ; if ( resource instanceof IStorage ) { final IProject project = resource . getProject ( ) ; if ( project != null ) { final ResourceSet resourceSet = this . resourceSetProvider . get ( project ) ; assert resourceSet != null ; final URI uri = this . uriMapper . getUri ( ( IStorage ) resource ) ; return resourceSet . getResource ( uri , true ) ; } } } return null ; } | Replies the current Xtext document that is supported by the linked editor . |
34,413 | protected void generateExpressionAppender ( ) { final TypeReference builderInterface = getExpressionBuilderInterface ( ) ; final TypeReference appender = getCodeElementExtractor ( ) . getElementAppenderImpl ( "Expression" ) ; final StringConcatenationClient content = new StringConcatenationClient ( ) { protected void appendTo ( TargetStringConcatenation it ) { it . append ( "/** Builder of a " + getLanguageName ( ) + " XExpression." ) ; it . newLine ( ) ; it . append ( " */" ) ; it . newLine ( ) ; it . append ( "@SuppressWarnings(\"all\")" ) ; it . newLine ( ) ; it . append ( "public class " ) ; it . append ( appender . getSimpleName ( ) ) ; it . append ( " extends " ) ; it . append ( getCodeElementExtractor ( ) . getAbstractAppenderImpl ( ) ) ; it . append ( " implements " ) ; it . append ( builderInterface ) ; it . append ( " {" ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( generateAppenderMembers ( appender . getSimpleName ( ) , builderInterface , "getXExpression()" ) ) ; it . append ( generateMembers ( false , true ) ) ; it . append ( "}" ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; } } ; final JavaFileAccess javaFile = getFileAccessFactory ( ) . createJavaFile ( appender , content ) ; javaFile . writeTo ( getSrcGen ( ) ) ; } | Generate the expression appender . |
34,414 | protected String ensureContainerKeyword ( EObject grammarContainer ) { final Iterator < Keyword > iterator = Iterators . filter ( grammarContainer . eContents ( ) . iterator ( ) , Keyword . class ) ; if ( iterator . hasNext ( ) ) { return iterator . next ( ) . getValue ( ) ; } return getExpressionConfig ( ) . getFieldContainerDeclarationKeyword ( ) ; } | Replies a keyword for declaring a container . |
34,415 | protected String ensureFieldDeclarationKeyword ( CodeElementExtractor . ElementDescription memberDescription ) { final List < String > modifiers = getCodeBuilderConfig ( ) . getModifiers ( ) . get ( memberDescription . getName ( ) ) ; if ( modifiers != null && ! modifiers . isEmpty ( ) ) { return modifiers . get ( 0 ) ; } return getExpressionConfig ( ) . getFieldDeclarationKeyword ( ) ; } | Replies a keyword for declaring a field . |
34,416 | protected ExpressionContextDescription getExpressionContextDescription ( ) { for ( final CodeElementExtractor . ElementDescription containerDescription : getCodeElementExtractor ( ) . getTopElements ( getGrammar ( ) , getCodeBuilderConfig ( ) ) ) { final AbstractRule rule = getMemberRule ( containerDescription ) ; if ( rule != null ) { final Pattern fieldTypePattern = Pattern . compile ( getExpressionConfig ( ) . getExpressionFieldTypenamePattern ( ) ) ; final ExpressionContextDescription description = getCodeElementExtractor ( ) . visitMemberElements ( containerDescription , rule , null , ( it , grammarContainer , memberContainer , classifier ) -> { if ( fieldTypePattern . matcher ( classifier . getName ( ) ) . find ( ) ) { final Assignment expressionAssignment = findAssignmentFromTerminalPattern ( memberContainer , getExpressionConfig ( ) . getExpressionGrammarPattern ( ) ) ; final CodeElementExtractor . ElementDescription memberDescription = it . newElementDescription ( classifier . getName ( ) , memberContainer , classifier , XExpression . class ) ; return new ExpressionContextDescription ( containerDescription , memberDescription , ensureContainerKeyword ( containerDescription . getGrammarComponent ( ) ) , ensureFieldDeclarationKeyword ( memberDescription ) , expressionAssignment ) ; } return null ; } , null ) ; if ( description != null ) { return description ; } } } return null ; } | Replies the description of the expression context . |
34,417 | public EventSpace postConstruction ( ) { this . spaceRepository . postConstruction ( ) ; this . defaultSpace = createSpace ( OpenEventSpaceSpecification . class , this . defaultSpaceID ) ; if ( this . defaultSpace == null ) { this . defaultSpace = ( OpenEventSpace ) this . spaceRepository . getSpace ( new SpaceID ( this . id , this . defaultSpaceID , OpenEventSpaceSpecification . class ) ) ; } return this . defaultSpace ; } | Create the default space in this context . |
34,418 | @ SuppressWarnings ( "checkstyle:magicnumber" ) public TextStyle capacityMethodInvocation ( ) { final TextStyle textStyle = extensionMethodInvocation ( ) . copy ( ) ; textStyle . setStyle ( SWT . ITALIC ) ; return textStyle ; } | Style for the capacity method extension . |
34,419 | public void validate ( StateAccess validationState , ValidationMessageAcceptor messageAcceptor ) { if ( isResponsible ( validationState . getState ( ) . context , validationState . getState ( ) . currentObject ) ) { try { for ( final MethodWrapper method : getMethods ( validationState . getState ( ) . currentObject ) ) { final Context ctx = new Context ( validationState , this , method , messageAcceptor ) ; this . currentContext . set ( ctx ) ; initializeContext ( ctx ) ; method . invoke ( ctx ) ; } } finally { this . currentContext . set ( null ) ; } } } | Validate the given resource . |
34,420 | protected void collectMethods ( Class < ? extends AbstractExtraLanguageValidator > clazz , Collection < Class < ? > > visitedClasses , Collection < MethodWrapper > result ) { if ( ! visitedClasses . add ( clazz ) ) { return ; } for ( final Method method : clazz . getDeclaredMethods ( ) ) { if ( method . getAnnotation ( Check . class ) != null && method . getParameterTypes ( ) . length == 1 ) { result . add ( createMethodWrapper ( method ) ) ; } } final Class < ? extends AbstractExtraLanguageValidator > superClass = getSuperClass ( clazz ) ; if ( superClass != null ) { collectMethods ( superClass , visitedClasses , result ) ; } } | Collect the check methods . |
34,421 | @ SuppressWarnings ( "static-method" ) protected boolean isResponsible ( Map < Object , Object > context , EObject eObject ) { if ( eObject instanceof XMemberFeatureCall || eObject instanceof XFeatureCall ) { final XAbstractFeatureCall rootFeatureCall = Utils . getRootFeatureCall ( ( XAbstractFeatureCall ) eObject ) ; return ! isCheckedFeatureCall ( context , rootFeatureCall ) ; } return true ; } | Replies if the validator is responsible to validate the given object . |
34,422 | protected void error ( String message , EObject source , EStructuralFeature feature ) { getContext ( ) . getMessageAcceptor ( ) . acceptError ( MessageFormat . format ( getErrorMessageFormat ( ) , message ) , source , feature , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , IssueCodes . INVALID_EXTRA_LANGUAGE_GENERATION ) ; } | Generate an error for the extra - language . |
34,423 | protected void warning ( String message , EObject source , EStructuralFeature feature ) { getContext ( ) . getMessageAcceptor ( ) . acceptWarning ( MessageFormat . format ( getErrorMessageFormat ( ) , message ) , source , feature , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , IssueCodes . INVALID_EXTRA_LANGUAGE_GENERATION ) ; } | Generate a warning for the extra - language . |
34,424 | protected void info ( String message , EObject source , EStructuralFeature feature ) { getContext ( ) . getMessageAcceptor ( ) . acceptInfo ( MessageFormat . format ( getErrorMessageFormat ( ) , message ) , source , feature , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , IssueCodes . INVALID_EXTRA_LANGUAGE_GENERATION ) ; } | Generate an information message for the extra - language . |
34,425 | public ExtraLanguageTypeConverter getTypeConverter ( ) { ExtraLanguageTypeConverter converter = this . typeConverter ; if ( converter == null ) { converter = createTypeConverterInstance ( getTypeConverterInitializer ( ) , null ) ; this . injector . injectMembers ( converter ) ; this . typeConverter = converter ; } return converter ; } | Replies the type converter . |
34,426 | @ SuppressWarnings ( "static-method" ) protected ExtraLanguageTypeConverter createTypeConverterInstance ( IExtraLanguageConversionInitializer initializer , IExtraLanguageGeneratorContext context ) { return new ExtraLanguageTypeConverter ( initializer , context ) ; } | Create the instance of the type converter . |
34,427 | public ExtraLanguageFeatureNameConverter getFeatureNameConverter ( ) { ExtraLanguageFeatureNameConverter converter = this . featureConverter ; if ( converter == null ) { converter = createFeatureNameConverterInstance ( getFeatureConverterInitializer ( ) , null ) ; this . injector . injectMembers ( converter ) ; this . featureConverter = converter ; } return converter ; } | Replies the feature name converter . |
34,428 | protected ExtraLanguageFeatureNameConverter createFeatureNameConverterInstance ( IExtraLanguageConversionInitializer initializer , IExtraLanguageGeneratorContext context ) { return new ExtraLanguageFeatureNameConverter ( initializer , context , getExtraLanguageKeywordProvider ( ) ) ; } | Create the instance of the feature name converter . |
34,429 | protected boolean doTypeMappingCheck ( EObject source , JvmType type , Procedure3 < ? super EObject , ? super JvmType , ? super String > errorHandler ) { if ( source != null && type != null ) { final ExtraLanguageTypeConverter converter = getTypeConverter ( ) ; final String qn = type . getQualifiedName ( ) ; if ( converter != null && ! converter . hasConversion ( qn ) ) { if ( errorHandler != null ) { errorHandler . apply ( source , type , qn ) ; } return false ; } } return true ; } | Do a type mapping check . |
34,430 | protected void doCheckMemberFeatureCallMapping ( XAbstractFeatureCall featureCall , Procedure3 < ? super EObject , ? super JvmType , ? super String > typeErrorHandler , Function2 < ? super EObject , ? super JvmIdentifiableElement , ? extends Boolean > featureErrorHandler ) { final XAbstractFeatureCall rootFeatureCall = Utils . getRootFeatureCall ( featureCall ) ; final Map < Object , Object > context = getContext ( ) . getContext ( ) ; if ( isCheckedFeatureCall ( context , rootFeatureCall ) ) { return ; } setCheckedFeatureCall ( context , rootFeatureCall ) ; internalCheckMemberFeaturCallMapping ( rootFeatureCall , typeErrorHandler , featureErrorHandler ) ; } | Check if the feature call could be translated to the extra - language . |
34,431 | @ SuppressWarnings ( "static-method" ) protected void handleInvocationTargetException ( Throwable targetException , Context context ) { if ( ! ( targetException instanceof NullPointerException ) ) { Exceptions . throwUncheckedException ( targetException ) ; } } | Handle an exception . |
34,432 | protected ITreeAppendable generateStaticConstructor ( JvmOperation it , ITreeAppendable appendable , GeneratorConfig config ) { appendable . newLine ( ) ; appendable . openScope ( ) ; generateJavaDoc ( it , appendable , config ) ; final ITreeAppendable tracedAppendable = appendable . trace ( it ) ; tracedAppendable . append ( "static " ) ; generateExecutableBody ( it , tracedAppendable , config ) ; return appendable ; } | Generate a static constructor from the given Jvm constructor . |
34,433 | public static int open ( Shell parentShell ) { final SubmitEclipseLogWizard wizard = new SubmitEclipseLogWizard ( ) ; final WizardDialog dialog = new WizardDialog ( parentShell , wizard ) ; wizard . setWizardDialog ( dialog ) ; return dialog . open ( ) ; } | Open the wizard . |
34,434 | WizardDialog getWizardDialog ( ) { final WeakReference < WizardDialog > ref = this . wizardDialog ; return ( ref == null ) ? null : ref . get ( ) ; } | Replies the associated wieard dialog . |
34,435 | @ SuppressWarnings ( "static-method" ) protected String buildContent ( String description , Charset charset ) throws IOException { final StringBuilder fullContent = new StringBuilder ( ) ; if ( ! Strings . isEmpty ( description ) ) { fullContent . append ( description ) ; fullContent . append ( Messages . SubmitEclipseLogWizard_8 ) ; } final SARLEclipsePlugin plugin = SARLEclipsePlugin . getDefault ( ) ; plugin . getLog ( ) . log ( plugin . createStatus ( IStatus . INFO , Messages . SubmitEclipseLogWizard_12 ) ) ; fullContent . append ( Messages . SubmitEclipseLogWizard_9 ) ; final String filename = Platform . getLogFileLocation ( ) . toOSString ( ) ; final File log = new File ( filename ) ; if ( ! log . exists ( ) ) { throw new IOException ( "Unable to find the log file" ) ; } final List < String > logLines = Files . readLines ( log , charset ) ; int logStartIndex = - 1 ; for ( int i = logLines . size ( ) - 1 ; logStartIndex == - 1 && i >= 0 ; -- i ) { final String line = logLines . get ( i ) ; if ( line . startsWith ( "!SESSION" ) ) { logStartIndex = i ; } } for ( int i = logStartIndex ; i < logLines . size ( ) ; ++ i ) { fullContent . append ( logLines . get ( i ) ) ; fullContent . append ( Messages . SubmitEclipseLogWizard_8 ) ; } fullContent . append ( Messages . SubmitEclipseLogWizard_10 ) ; for ( final Entry < Object , Object > entry : System . getProperties ( ) . entrySet ( ) ) { fullContent . append ( Objects . toString ( entry . getKey ( ) ) ) ; fullContent . append ( Messages . SubmitEclipseLogWizard_11 ) ; fullContent . append ( Objects . toString ( entry . getValue ( ) ) ) ; fullContent . append ( Messages . SubmitEclipseLogWizard_8 ) ; } fullContent . append ( Messages . SubmitEclipseLogWizard_13 ) ; return fullContent . toString ( ) ; } | Build the issue content . |
34,436 | public void setSpaceService ( ContextSpaceService service ) { if ( this . spaceService != null ) { this . spaceService . removeSpaceRepositoryListener ( this . serviceListener ) ; } this . spaceService = service ; if ( this . spaceService != null ) { this . spaceService . addSpaceRepositoryListener ( this . serviceListener ) ; } } | Set the reference to the space service . |
34,437 | protected void firePeerConnected ( URI peerURI , SpaceID space ) { final NetworkServiceListener [ ] ilisteners ; synchronized ( this . listeners ) { ilisteners = new NetworkServiceListener [ this . listeners . size ( ) ] ; this . listeners . toArray ( ilisteners ) ; } for ( final NetworkServiceListener listener : ilisteners ) { listener . peerConnected ( peerURI , space ) ; } } | Notifies that a peer space was connected . |
34,438 | protected void firePeerDisconnected ( URI peerURI , SpaceID space ) { final NetworkServiceListener [ ] ilisteners ; synchronized ( this . listeners ) { ilisteners = new NetworkServiceListener [ this . listeners . size ( ) ] ; this . listeners . toArray ( ilisteners ) ; } for ( final NetworkServiceListener listener : ilisteners ) { listener . peerDisconnected ( peerURI , space ) ; } } | Notifies that a peer space was disconnected . |
34,439 | protected void firePeerDiscovered ( URI peerURI ) { final NetworkServiceListener [ ] ilisteners ; synchronized ( this . listeners ) { ilisteners = new NetworkServiceListener [ this . listeners . size ( ) ] ; this . listeners . toArray ( ilisteners ) ; } for ( final NetworkServiceListener listener : ilisteners ) { listener . peerDiscovered ( peerURI ) ; } } | Notifies that a peer was discovered . |
34,440 | private static EventEnvelope extractEnvelope ( Socket socket ) throws IOException { byte [ ] data = socket . recv ( ZMQ . DONTWAIT ) ; byte [ ] cdata ; int oldSize = 0 ; while ( socket . hasReceiveMore ( ) ) { cdata = socket . recv ( ZMQ . DONTWAIT ) ; oldSize = data . length ; data = Arrays . copyOf ( data , data . length + cdata . length ) ; System . arraycopy ( cdata , 0 , data , oldSize , cdata . length ) ; } final ByteBuffer buffer = ByteBuffer . wrap ( data ) ; final byte [ ] contextId = readBlock ( buffer ) ; assert contextId != null && contextId . length > 0 ; final byte [ ] spaceId = readBlock ( buffer ) ; assert spaceId != null && spaceId . length > 0 ; final byte [ ] scope = readBlock ( buffer ) ; assert scope != null && scope . length > 0 ; final byte [ ] headers = readBlock ( buffer ) ; assert headers != null && headers . length > 0 ; final byte [ ] body = readBlock ( buffer ) ; assert body != null && body . length > 0 ; return new EventEnvelope ( contextId , spaceId , scope , headers , body ) ; } | Receive data from the network . |
34,441 | protected synchronized void receive ( EventEnvelope env ) throws Exception { this . logger . getKernelLogger ( ) . fine ( MessageFormat . format ( Messages . ZeroMQNetworkService_8 , this . validatedURI , env ) ) ; final EventDispatch dispatch = this . serializer . deserialize ( env ) ; this . logger . getKernelLogger ( ) . fine ( MessageFormat . format ( Messages . ZeroMQNetworkService_9 , dispatch ) ) ; final SpaceID spaceID = dispatch . getSpaceID ( ) ; final NetworkEventReceivingListener space = this . messageRecvListeners . get ( spaceID ) ; if ( space != null ) { this . executorService . submit ( new AsyncRunner ( space , spaceID , dispatch . getScope ( ) , dispatch . getEvent ( ) ) ) ; } else { this . logger . getKernelLogger ( ) . fine ( MessageFormat . format ( Messages . ZeroMQNetworkService_10 , spaceID , dispatch . getEvent ( ) ) ) ; } } | Extract data from a received envelope and forwad it to the rest of the platform . |
34,442 | public GeneratorConfig getGeneratorConfig ( ) { if ( this . generatorConfig == null ) { this . generatorConfig = this . generatorConfigProvider . get ( EcoreUtil . getRootContainer ( this . contextObject ) ) ; } return this . generatorConfig ; } | Replies the generator configuration . |
34,443 | public GeneratorConfig2 getGeneratorConfig2 ( ) { if ( this . generatorConfig2 == null ) { this . generatorConfig2 = this . generatorConfigProvider2 . get ( EcoreUtil . getRootContainer ( this . contextObject ) ) ; } return this . generatorConfig2 ; } | Replies the generator configuration v2 . |
34,444 | public Collection < Procedure1 < ? super ITreeAppendable > > getGuardEvalationCodeFor ( SarlBehaviorUnit source ) { assert source != null ; final String id = source . getName ( ) . getIdentifier ( ) ; final Collection < Procedure1 < ? super ITreeAppendable > > evaluators ; final Pair < SarlBehaviorUnit , Collection < Procedure1 < ? super ITreeAppendable > > > pair = this . guardEvaluators . get ( id ) ; if ( pair == null ) { evaluators = new ArrayList < > ( ) ; this . guardEvaluators . put ( id , new Pair < > ( source , evaluators ) ) ; } else { evaluators = pair . getValue ( ) ; assert evaluators != null ; } return evaluators ; } | Replies the guard evaluation code for the given event . |
34,445 | public List < Runnable > getPostFinalizationElements ( ) { final GenerationContext prt = getParentContext ( ) ; if ( prt != null ) { return prt . getPostFinalizationElements ( ) ; } return this . postFinalization ; } | Replies the collection of the elements that must be generated after the generation process of the current SARL element . |
34,446 | public GeneratorConfig2 install ( final ResourceSet resourceSet , GeneratorConfig2 config ) { GeneratorConfigAdapter adapter = GeneratorConfigAdapter . findInEmfObject ( resourceSet ) ; if ( adapter == null ) { adapter = new GeneratorConfigAdapter ( ) ; } adapter . attachToEmfObject ( resourceSet ) ; return adapter . getLanguage2GeneratorConfig ( ) . put ( this . languageId , config ) ; } | Install the given configuration in the resource set . |
34,447 | protected String getOperatorSymbol ( XAbstractFeatureCall call ) { if ( call != null ) { final Resource res = call . eResource ( ) ; if ( res instanceof StorageAwareResource ) { final boolean isLoadedFromStorage = ( ( StorageAwareResource ) res ) . isLoadedFromStorage ( ) ; if ( isLoadedFromStorage ) { final QualifiedName operator = getOperatorMapping ( ) . getOperator ( QualifiedName . create ( call . getFeature ( ) . getSimpleName ( ) ) ) ; return Objects . toString ( operator ) ; } } return call . getConcreteSyntaxFeatureName ( ) ; } return null ; } | Get the string representation of an operator . |
34,448 | public static String getCallSimpleName ( XAbstractFeatureCall featureCall , ILogicalContainerProvider logicalContainerProvider , IdentifiableSimpleNameProvider featureNameProvider , Function0 < ? extends String > nullKeyword , Function0 < ? extends String > thisKeyword , Function0 < ? extends String > superKeyword , Function1 < ? super JvmIdentifiableElement , ? extends String > referenceNameLambda ) { String name = null ; final JvmIdentifiableElement calledFeature = featureCall . getFeature ( ) ; if ( calledFeature instanceof JvmConstructor ) { final JvmDeclaredType constructorContainer = ( ( JvmConstructor ) calledFeature ) . getDeclaringType ( ) ; final JvmIdentifiableElement logicalContainer = logicalContainerProvider . getNearestLogicalContainer ( featureCall ) ; final JvmDeclaredType contextType = ( ( JvmMember ) logicalContainer ) . getDeclaringType ( ) ; if ( contextType == constructorContainer ) { name = thisKeyword . apply ( ) ; } else { name = superKeyword . apply ( ) ; } } else if ( calledFeature != null ) { final String referenceName = referenceNameLambda . apply ( calledFeature ) ; if ( referenceName != null ) { name = referenceName ; } else if ( calledFeature instanceof JvmOperation ) { name = featureNameProvider . getSimpleName ( calledFeature ) ; } else { name = featureCall . getConcreteSyntaxFeatureName ( ) ; } } if ( name == null ) { return nullKeyword . apply ( ) ; } return name ; } | Compute the simple name for the called feature . |
34,449 | public static boolean buildCallReceiver ( XAbstractFeatureCall call , Function0 < ? extends String > thisKeyword , Function1 < ? super XExpression , ? extends String > referenceNameDefinition , List < Object > output ) { if ( call . isStatic ( ) ) { if ( call instanceof XMemberFeatureCall ) { final XMemberFeatureCall memberFeatureCall = ( XMemberFeatureCall ) call ; if ( memberFeatureCall . isStaticWithDeclaringType ( ) ) { final XAbstractFeatureCall target = ( XAbstractFeatureCall ) memberFeatureCall . getMemberCallTarget ( ) ; final JvmType declaringType = ( JvmType ) target . getFeature ( ) ; output . add ( declaringType ) ; return true ; } } output . add ( ( ( JvmFeature ) call . getFeature ( ) ) . getDeclaringType ( ) ) ; return true ; } final XExpression receiver = call . getActualReceiver ( ) ; if ( receiver == null ) { return false ; } final XExpression implicit = call . getImplicitReceiver ( ) ; if ( receiver == implicit ) { output . add ( thisKeyword . apply ( ) ) ; } else { output . add ( receiver ) ; if ( receiver instanceof XAbstractFeatureCall ) { if ( ( ( XAbstractFeatureCall ) receiver ) . getFeature ( ) instanceof JvmType ) { final String referenceName = referenceNameDefinition . apply ( receiver ) ; if ( referenceName != null && referenceName . length ( ) == 0 ) { return false ; } } } } return true ; } | Compute the list of object that serve as the receiver for the given call . |
34,450 | @ Named ( JanusConfig . DEFAULT_CONTEXT_ID_NAME ) public static UUID getContextID ( ) { String str = JanusConfig . getSystemProperty ( JanusConfig . DEFAULT_CONTEXT_ID_NAME ) ; if ( Strings . isNullOrEmpty ( str ) ) { Boolean v ; str = JanusConfig . getSystemProperty ( JanusConfig . BOOT_DEFAULT_CONTEXT_ID_NAME ) ; if ( Strings . isNullOrEmpty ( str ) ) { v = JanusConfig . BOOT_DEFAULT_CONTEXT_ID_VALUE ; } else { v = Boolean . valueOf ( Boolean . parseBoolean ( str ) ) ; } if ( v . booleanValue ( ) ) { final String bootClassname = JanusConfig . getSystemProperty ( JanusConfig . BOOT_AGENT ) ; str = UUID . nameUUIDFromBytes ( bootClassname . getBytes ( ) ) . toString ( ) ; } else { str = JanusConfig . getSystemProperty ( JanusConfig . RANDOM_DEFAULT_CONTEXT_ID_NAME ) ; if ( Strings . isNullOrEmpty ( str ) ) { v = JanusConfig . RANDOM_DEFAULT_CONTEXT_ID_VALUE ; } else { v = Boolean . valueOf ( Boolean . parseBoolean ( str ) ) ; } if ( v . booleanValue ( ) ) { str = UUID . randomUUID ( ) . toString ( ) ; } else { str = JanusConfig . DEFAULT_CONTEXT_ID_VALUE ; } } System . setProperty ( JanusConfig . DEFAULT_CONTEXT_ID_NAME , str ) ; } assert ! Strings . isNullOrEmpty ( str ) ; return UUID . fromString ( str ) ; } | Create a context identifier . |
34,451 | @ Named ( JanusConfig . DEFAULT_SPACE_ID_NAME ) public static UUID getSpaceID ( ) { final String v = JanusConfig . getSystemProperty ( JanusConfig . DEFAULT_SPACE_ID_NAME , JanusConfig . DEFAULT_SPACE_ID_VALUE ) ; return UUID . fromString ( v ) ; } | Construct a space identifier . |
34,452 | private static String getPUBURIAsString ( ) { String pubUri = JanusConfig . getSystemProperty ( JanusConfig . PUB_URI ) ; if ( pubUri == null || pubUri . isEmpty ( ) ) { InetAddress a = NetworkUtil . getPrimaryAddress ( ) ; if ( a == null ) { a = NetworkUtil . getLoopbackAddress ( ) ; } if ( a != null ) { pubUri = NetworkUtil . toURI ( a , - 1 ) . toString ( ) ; System . setProperty ( JanusConfig . PUB_URI , pubUri ) ; } } return pubUri ; } | Extract the current value of the PUB_URI from the system s property or form the platform default value . |
34,453 | public static void populateInterfaceElements ( JvmDeclaredType jvmElement , Map < ActionPrototype , JvmOperation > operations , Map < String , JvmField > fields , IActionPrototypeProvider sarlSignatureProvider ) { for ( final JvmFeature feature : jvmElement . getAllFeatures ( ) ) { if ( ! "java.lang.Object" . equals ( feature . getDeclaringType ( ) . getQualifiedName ( ) ) ) { if ( operations != null && feature instanceof JvmOperation ) { final JvmOperation operation = ( JvmOperation ) feature ; final ActionParameterTypes sig = sarlSignatureProvider . createParameterTypesFromJvmModel ( operation . isVarArgs ( ) , operation . getParameters ( ) ) ; final ActionPrototype actionKey = sarlSignatureProvider . createActionPrototype ( operation . getSimpleName ( ) , sig ) ; operations . put ( actionKey , operation ) ; } else if ( fields != null && feature instanceof JvmField ) { fields . put ( feature . getSimpleName ( ) , ( JvmField ) feature ) ; } } } } | Analyzing the type hierarchy of the given interface and extract hierarchy information . |
34,454 | public static boolean isVarArg ( List < ? extends XtendParameter > params ) { assert params != null ; if ( params . size ( ) > 0 ) { final XtendParameter param = params . get ( params . size ( ) - 1 ) ; assert param != null ; return param . isVarArg ( ) ; } return false ; } | Replies if the last parameter is a variadic parameter . |
34,455 | public static String createNameForHiddenCapacityImplementationAttribute ( String id ) { return PREFIX_CAPACITY_IMPLEMENTATION + fixHiddenMember ( id . toUpperCase ( ) ) . replace ( "." , HIDDEN_MEMBER_REPLACEMENT_CHARACTER ) ; } | Create the name of the hidden field that is containing a capacity implementation . |
34,456 | public static boolean isNameForHiddenCapacityImplementationCallingMethod ( String simpleName ) { return simpleName != null && simpleName . startsWith ( PREFIX_CAPACITY_IMPLEMENTATION ) && simpleName . endsWith ( POSTFIX_CAPACITY_IMPLEMENTATION_CALLER ) ; } | Replies if the given simple name is the name of the hidden method that is calling a capacity implementation . |
34,457 | public static String createNameForHiddenGuardEvaluatorMethod ( String eventId , int handlerIndex ) { return PREFIX_GUARD + fixHiddenMember ( eventId ) + HIDDEN_MEMBER_CHARACTER + handlerIndex ; } | Create the name of the hidden method that is containing the event guard evaluation . |
34,458 | public static String createNameForHiddenEventHandlerMethod ( String eventId , int handlerIndex ) { return PREFIX_EVENT_HANDLER + fixHiddenMember ( eventId ) + HIDDEN_MEMBER_CHARACTER + handlerIndex ; } | Create the name of the hidden method that is containing the event handler code . |
34,459 | public static boolean isClass ( LightweightTypeReference typeRef ) { final JvmType t = typeRef . getType ( ) ; if ( t instanceof JvmGenericType ) { return ! ( ( JvmGenericType ) t ) . isInterface ( ) ; } return false ; } | Replies if the given reference is pointing to a class type . |
34,460 | public static boolean isFinal ( LightweightTypeReference expressionTypeRef ) { if ( expressionTypeRef . isArray ( ) ) { return isFinal ( expressionTypeRef . getComponentType ( ) ) ; } if ( expressionTypeRef . isPrimitive ( ) ) { return true ; } return expressionTypeRef . getType ( ) instanceof JvmDeclaredType && ( ( JvmDeclaredType ) expressionTypeRef . getType ( ) ) . isFinal ( ) ; } | Replies if the given reference is referencing a final type . |
34,461 | public static boolean isFinal ( Class < ? > expressionType ) { if ( expressionType . isArray ( ) ) { return isFinal ( expressionType . getComponentType ( ) ) ; } if ( expressionType . isPrimitive ( ) ) { return true ; } return expressionType . isEnum ( ) || Modifier . isFinal ( expressionType . getModifiers ( ) ) ; } | Replies if the given type is a final type . |
34,462 | public static boolean isInterface ( LightweightTypeReference type ) { return type . getType ( ) instanceof JvmGenericType && ( ( JvmGenericType ) type . getType ( ) ) . isInterface ( ) ; } | Replies if the given type is an interface . |
34,463 | @ SuppressWarnings ( { "checkstyle:cyclomaticcomplexity" , "checkstyle:booleanexpressioncomplexity" } ) public static boolean canCast ( LightweightTypeReference fromType , LightweightTypeReference toType , boolean enablePrimitiveWidening , boolean enableVoidMatchingNull , boolean allowSynonyms ) { if ( enableVoidMatchingNull ) { final boolean fromVoid = fromType == null || fromType . isPrimitiveVoid ( ) ; final boolean toVoid = toType == null || toType . isPrimitiveVoid ( ) ; if ( fromVoid ) { return toVoid ; } if ( toVoid ) { return fromVoid ; } assert fromType != null ; assert toType != null ; } else if ( ( fromType == null || toType == null ) || ( fromType . isPrimitiveVoid ( ) != toType . isPrimitiveVoid ( ) ) ) { return false ; } final TypeConformanceComputationArgument conform = new TypeConformanceComputationArgument ( false , false , true , enablePrimitiveWidening , false , allowSynonyms ) ; if ( ( ( fromType . getType ( ) instanceof JvmDeclaredType || fromType . isPrimitive ( ) ) && ( ! isInterface ( fromType ) || isFinal ( toType ) ) && ( ! isInterface ( toType ) || isFinal ( fromType ) ) && ( ! toType . isAssignableFrom ( fromType , conform ) ) && ( isFinal ( fromType ) || isFinal ( toType ) || isClass ( fromType ) && isClass ( toType ) ) && ( ! fromType . isAssignableFrom ( toType , conform ) ) ) || ( toType . isPrimitive ( ) && ! ( fromType . isPrimitive ( ) || fromType . isWrapper ( ) ) ) ) { return false ; } return true ; } | Replies if it is allowed to cast between the given types . |
34,464 | public static LightweightTypeReference toLightweightTypeReference ( JvmType type , CommonTypeComputationServices services , boolean keepUnboundWildcardInformation ) { if ( type == null ) { return null ; } final StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner ( services , type ) ; final LightweightTypeReferenceFactory factory = new LightweightTypeReferenceFactory ( owner , keepUnboundWildcardInformation ) ; final LightweightTypeReference reference = factory . toLightweightReference ( type ) ; return reference ; } | Convert a type to a lightweight type reference . |
34,465 | public static int compareVersions ( String v1 , String v2 ) { final Version vobject1 = Version . parseVersion ( v1 ) ; final Version vobject2 = Version . parseVersion ( v2 ) ; return vobject1 . compareTo ( vobject2 ) ; } | Compare the two strings as they are version numbers . |
34,466 | public static String getSarlCodeFor ( EObject object ) { final ICompositeNode node = NodeModelUtils . getNode ( object ) ; if ( node != null ) { String text = node . getText ( ) ; if ( text != null ) { text = text . trim ( ) ; text = text . replaceAll ( "[\n\r\f]+" , " " ) ; } return Strings . emptyToNull ( text ) ; } return null ; } | Replies the original code for the given Ecore object . |
34,467 | public static boolean hasAbstractMember ( XtendTypeDeclaration declaration ) { if ( declaration != null ) { for ( final XtendMember member : declaration . getMembers ( ) ) { if ( member instanceof XtendFunction ) { if ( ( ( XtendFunction ) member ) . isAbstract ( ) ) { return true ; } } } } return false ; } | Replies if the given declaration has an abstract member . |
34,468 | public static boolean isCompatibleSARLLibraryOnClasspath ( TypeReferences typeReferences , Notifier context ) { final OutParameter < String > version = new OutParameter < > ( ) ; final SarlLibraryErrorCode code = getSARLLibraryVersionOnClasspath ( typeReferences , context , version ) ; if ( code == SarlLibraryErrorCode . SARL_FOUND ) { return isCompatibleSARLLibraryVersion ( version . get ( ) ) ; } return false ; } | Check if a compatible SARL library is available on the classpath . |
34,469 | public static boolean isCompatibleSARLLibraryVersion ( String version ) { if ( version != null ) { final Version currentVersion = Version . parseVersion ( SARLVersion . SPECIFICATION_RELEASE_VERSION_STRING ) ; final Version paramVersion = Version . parseVersion ( version ) ; return currentVersion . getMajor ( ) == paramVersion . getMajor ( ) && currentVersion . getMinor ( ) == paramVersion . getMinor ( ) ; } return false ; } | Check if a version is compatible with the expected SARL library . |
34,470 | public static boolean isCompatibleJREVersion ( String version ) { if ( version != null && ! version . isEmpty ( ) ) { final Version current = Version . parseVersion ( version ) ; if ( current != null ) { final Version minJdk = Version . parseVersion ( SARLVersion . MINIMAL_JDK_VERSION ) ; assert minJdk != null ; if ( current . compareTo ( minJdk ) >= 0 ) { final Version maxJdk = Version . parseVersion ( SARLVersion . MAXIMAL_JDK_VERSION ) ; assert maxJdk != null ; return current . compareTo ( maxJdk ) <= 0 ; } } } return false ; } | Check if a version of the JRE is compatible with the SARL library . |
34,471 | public static boolean isCompatibleXtextVersion ( String version ) { return version != null && ! version . isEmpty ( ) && compareVersions ( version , SARLVersion . MINIMAL_XTEXT_VERSION ) >= 0 ; } | Check if a version of Xtext is compatible with the SARL library . |
34,472 | public static boolean isCompatibleXtextVersion ( ) { final XtextVersion xtextVersion = XtextVersion . getCurrent ( ) ; if ( xtextVersion != null && ! Strings . isNullOrEmpty ( xtextVersion . getVersion ( ) ) ) { return isCompatibleXtextVersion ( xtextVersion . getVersion ( ) ) ; } return false ; } | Check if a version of the current Xtext is compatible with the SARL library . |
34,473 | public static boolean isSARLAnnotation ( Class < ? > type ) { return ( type != null && Annotation . class . isAssignableFrom ( type ) ) && isSARLAnnotation ( type . getPackage ( ) . getName ( ) ) ; } | Replies if the given annotation is an annotation from the SARL core library . |
34,474 | public static boolean isFunctionalInterface ( JvmGenericType type , IActionPrototypeProvider sarlSignatureProvider ) { if ( type != null && type . isInterface ( ) ) { final Map < ActionPrototype , JvmOperation > operations = new HashMap < > ( ) ; populateInterfaceElements ( type , operations , null , sarlSignatureProvider ) ; if ( operations . size ( ) == 1 ) { final JvmOperation op = operations . values ( ) . iterator ( ) . next ( ) ; return ! op . isStatic ( ) && ! op . isDefault ( ) ; } } return false ; } | Replies if the given type is a functional interface . |
34,475 | @ SuppressWarnings ( "checkstyle:npathcomplexity" ) public static String dump ( Object object , boolean includeStaticField ) { if ( object == null ) { return new String ( ) ; } final StringBuilder buffer = new StringBuilder ( ) ; final LinkedList < Class < ? > > types = new LinkedList < > ( ) ; types . add ( object . getClass ( ) ) ; while ( ! types . isEmpty ( ) ) { final Class < ? > type = types . removeFirst ( ) ; final Class < ? > supertype = type . getSuperclass ( ) ; if ( supertype != null && ! supertype . equals ( Object . class ) ) { types . add ( supertype ) ; } if ( buffer . length ( ) > 0 ) { buffer . append ( "\n" ) ; } final Field [ ] fields = type . getDeclaredFields ( ) ; buffer . append ( type . getSimpleName ( ) ) . append ( " {\n" ) ; boolean firstRound = true ; for ( final Field field : fields ) { if ( ! includeStaticField && Flags . isStatic ( field . getModifiers ( ) ) ) { continue ; } if ( ! firstRound ) { buffer . append ( ",\n" ) ; } firstRound = false ; field . setAccessible ( true ) ; try { final Object fieldObj = field . get ( object ) ; final String value ; if ( null == fieldObj ) { value = "null" ; } else { value = fieldObj . toString ( ) ; } buffer . append ( '\t' ) . append ( field . getName ( ) ) . append ( '=' ) . append ( '"' ) ; buffer . append ( org . eclipse . xtext . util . Strings . convertToJavaString ( value ) ) ; buffer . append ( "\"\n" ) ; } catch ( IllegalAccessException ignore ) { } } buffer . append ( '}' ) ; } return buffer . toString ( ) ; } | Dump the object . |
34,476 | public static JvmTypeReference cloneWithTypeParametersAndProxies ( JvmTypeReference type , Iterable < JvmTypeParameter > executableTypeParameters , Map < String , JvmTypeReference > superTypeParameterMapping , JvmTypeReferenceBuilder typeParameterBuilder , JvmTypesBuilder typeBuilder , TypeReferences typeReferences , TypesFactory jvmTypesFactory ) { if ( type == null ) { return typeParameterBuilder . typeRef ( Object . class ) ; } boolean cloneType = true ; JvmTypeReference typeCandidate = type ; if ( ( executableTypeParameters . iterator ( ) . hasNext ( ) || ! superTypeParameterMapping . isEmpty ( ) ) && cloneType ) { final Map < String , JvmTypeParameter > typeParameterIdentifiers = new TreeMap < > ( ) ; for ( final JvmTypeParameter typeParameter : executableTypeParameters ) { typeParameterIdentifiers . put ( typeParameter . getIdentifier ( ) , typeParameter ) ; } if ( type instanceof JvmParameterizedTypeReference ) { cloneType = false ; typeCandidate = cloneAndAssociate ( type , typeParameterIdentifiers , superTypeParameterMapping , typeParameterBuilder , typeReferences , jvmTypesFactory ) ; } else if ( type instanceof XFunctionTypeRef ) { final XFunctionTypeRef functionRef = ( XFunctionTypeRef ) type ; cloneType = false ; final XFunctionTypeRef cloneReference = XtypeFactory . eINSTANCE . createXFunctionTypeRef ( ) ; for ( final JvmTypeReference paramType : functionRef . getParamTypes ( ) ) { cloneReference . getParamTypes ( ) . add ( cloneAndAssociate ( paramType , typeParameterIdentifiers , superTypeParameterMapping , typeParameterBuilder , typeReferences , jvmTypesFactory ) ) ; } cloneReference . setReturnType ( cloneAndAssociate ( functionRef . getReturnType ( ) , typeParameterIdentifiers , superTypeParameterMapping , typeParameterBuilder , typeReferences , jvmTypesFactory ) ) ; cloneReference . setInstanceContext ( functionRef . isInstanceContext ( ) ) ; typeCandidate = cloneReference ; } } assert typeCandidate != null ; final JvmTypeReference returnType ; if ( ! cloneType ) { returnType = typeCandidate ; } else { returnType = typeBuilder . cloneWithProxies ( typeCandidate ) ; } return returnType ; } | Clone the given type reference that for being link to the given operation . |
34,477 | public static void getSuperTypeParameterMap ( JvmDeclaredType type , Map < String , JvmTypeReference > mapping ) { for ( final JvmTypeReference superTypeReference : type . getSuperTypes ( ) ) { if ( superTypeReference instanceof JvmParameterizedTypeReference ) { final JvmParameterizedTypeReference parameterizedTypeReference = ( JvmParameterizedTypeReference ) superTypeReference ; final JvmType st = superTypeReference . getType ( ) ; if ( st instanceof JvmTypeParameterDeclarator ) { final JvmTypeParameterDeclarator superType = ( JvmTypeParameterDeclarator ) st ; int i = 0 ; for ( final JvmTypeParameter typeParameter : superType . getTypeParameters ( ) ) { mapping . put ( typeParameter . getIdentifier ( ) , parameterizedTypeReference . getArguments ( ) . get ( i ) ) ; ++ i ; } } } } } | Extract the mapping between the type parameters declared within the super types and the type parameters arguments that are declared within the given type . |
34,478 | public static void setStructuralFeature ( EObject object , EStructuralFeature property , Object value ) { assert object != null ; assert property != null ; if ( value == null ) { object . eUnset ( property ) ; } else { object . eSet ( property , value ) ; } } | Set the given structure feature with the given value . |
34,479 | public static XAbstractFeatureCall getRootFeatureCall ( XAbstractFeatureCall featureCall ) { final EObject container = featureCall . eContainer ( ) ; final XAbstractFeatureCall rootFeatureCall ; if ( container instanceof XMemberFeatureCall || container instanceof XFeatureCall ) { rootFeatureCall = ( XAbstractFeatureCall ) getFirstContainerForPredicate ( featureCall , it -> it . eContainer ( ) != null && ! ( it . eContainer ( ) instanceof XMemberFeatureCall || it . eContainer ( ) instanceof XFeatureCall ) ) ; } else { rootFeatureCall = featureCall ; } return rootFeatureCall ; } | Replies the root feature call into a sequence of feature calls . |
34,480 | public static XAbstractFeatureCall getRootFeatureCall ( XAbstractFeatureCall featureCall , XExpression container , List < JvmFormalParameter > containerParameters ) { if ( hasLocalParameters ( featureCall , container , containerParameters ) || ! ( featureCall instanceof XMemberFeatureCall || featureCall instanceof XFeatureCall ) ) { return null ; } XAbstractFeatureCall current = featureCall ; EObject currentContainer = current . eContainer ( ) ; while ( currentContainer != null ) { if ( currentContainer instanceof XMemberFeatureCall || currentContainer instanceof XFeatureCall ) { final XAbstractFeatureCall c = ( XAbstractFeatureCall ) currentContainer ; if ( hasLocalParameters ( c , container , containerParameters ) ) { return current ; } current = c ; currentContainer = current . eContainer ( ) ; } else { return current ; } } return current ; } | Replies the root feature call into a sequence of feature calls that has not reference to elements declared within the container and that are not one of the container s parameters . |
34,481 | public final boolean isFieldNameSet ( ) { if ( _field_name_type != null ) { switch ( _field_name_type ) { case STRING : return _field_name != null ; case INT : return _field_name_sid >= 0 ; default : break ; } } return false ; } | not supported . |
34,482 | int putSymbol ( String symbolName ) { if ( isReadOnly ) { throw new ReadOnlyValueException ( SymbolTable . class ) ; } if ( mySymbolsCount == mySymbolNames . length ) { int newlen = mySymbolsCount * 2 ; if ( newlen < DEFAULT_CAPACITY ) { newlen = DEFAULT_CAPACITY ; } String [ ] temp = new String [ newlen ] ; System . arraycopy ( mySymbolNames , 0 , temp , 0 , mySymbolsCount ) ; mySymbolNames = temp ; } int sid = - 1 ; if ( symbolName != null ) { sid = mySymbolsCount + myFirstLocalSid ; assert sid == getMaxId ( ) + 1 ; putToMapIfNotThere ( mySymbolsMap , symbolName , sid ) ; } mySymbolNames [ mySymbolsCount ] = symbolName ; mySymbolsCount ++ ; return sid ; } | NOT SYNCHRONIZED! Call within constructor or from synch d method . |
34,483 | boolean symtabExtends ( SymbolTable other ) { LocalSymbolTable subset = ( LocalSymbolTable ) other ; if ( getMaxId ( ) < subset . getMaxId ( ) ) return false ; if ( ! myImportsList . equalImports ( subset . myImportsList ) ) return false ; int subLocalSymbolCount = subset . mySymbolsCount ; if ( subLocalSymbolCount == 0 ) return true ; if ( mySymbolsCount < subLocalSymbolCount ) return false ; String [ ] subsetSymbols = subset . mySymbolNames ; if ( ! safeEquals ( mySymbolNames [ subLocalSymbolCount - 1 ] , subsetSymbols [ subLocalSymbolCount - 1 ] ) ) { return false ; } for ( int i = 0 ; i < subLocalSymbolCount - 1 ; i ++ ) { if ( ! safeEquals ( mySymbolNames [ i ] , subsetSymbols [ i ] ) ) return false ; } return true ; } | This method and the context from which it is called assumes that the symtabs are not being mutated by another thread . Therefore it doesn t use synchronization . |
34,484 | public static SymbolToken newSymbolToken ( SymbolTable symtab , String text ) { text . getClass ( ) ; SymbolToken tok = ( symtab == null ? null : symtab . find ( text ) ) ; if ( tok == null ) { tok = new SymbolTokenImpl ( text , UNKNOWN_SYMBOL_ID ) ; } return tok ; } | Checks symbol content . |
34,485 | public static SymbolToken [ ] newSymbolTokens ( SymbolTable symtab , String ... text ) { if ( text != null ) { int count = text . length ; if ( count != 0 ) { SymbolToken [ ] result = new SymbolToken [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { String s = text [ i ] ; result [ i ] = newSymbolToken ( symtab , s ) ; } return result ; } } return SymbolToken . EMPTY_ARRAY ; } | Validates each text element . |
34,486 | public static String [ ] toStrings ( SymbolToken [ ] symbols , int count ) { if ( count == 0 ) return _Private_Utils . EMPTY_STRING_ARRAY ; String [ ] annotations = new String [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { SymbolToken tok = symbols [ i ] ; String text = tok . getText ( ) ; if ( text == null ) { throw new UnknownSymbolException ( tok . getSid ( ) ) ; } annotations [ i ] = text ; } return annotations ; } | Extracts the non - null text from a list of symbol tokens . |
34,487 | public static Iterator < IonValue > iterate ( ValueFactory valueFactory , IonReader input ) { return new IonIteratorImpl ( valueFactory , input ) ; } | Create a value iterator from a reader . Primarily a trampoline for access permission . |
34,488 | public static boolean isTrivialTable ( SymbolTable table ) { if ( table == null ) return true ; if ( table . isSystemTable ( ) ) return true ; if ( table . isLocalTable ( ) ) { if ( table . getMaxId ( ) == table . getSystemSymbolTable ( ) . getMaxId ( ) ) { return true ; } } return false ; } | Is the table null system or local without imported symbols? |
34,489 | public static SymbolTable copyLocalSymbolTable ( SymbolTable symtab ) throws SubstituteSymbolTableException { if ( ! symtab . isLocalTable ( ) ) { String message = "symtab should be a local symtab" ; throw new IllegalArgumentException ( message ) ; } SymbolTable [ ] imports = ( ( LocalSymbolTable ) symtab ) . getImportedTablesNoCopy ( ) ; for ( int i = 0 ; i < imports . length ; i ++ ) { if ( imports [ i ] . isSubstitute ( ) ) { String message = "local symtabs with substituted symtabs for imports " + "(indicating no exact match within the catalog) cannot " + "be copied" ; throw new SubstituteSymbolTableException ( message ) ; } } return ( ( LocalSymbolTable ) symtab ) . makeCopy ( ) ; } | local symtab has substituted symtabs for imports . |
34,490 | public static SymbolTable initialSymtab ( _Private_LocalSymbolTableFactory lstFactory , SymbolTable defaultSystemSymtab , SymbolTable ... imports ) { if ( imports == null || imports . length == 0 ) { return defaultSystemSymtab ; } if ( imports . length == 1 && imports [ 0 ] . isSystemTable ( ) ) { return imports [ 0 ] ; } return lstFactory . newLocalSymtab ( defaultSystemSymtab , imports ) ; } | Returns a minimal symtab that either system or local depending on the given values that supports representation as an IonStruct . If the imports are empty the default system symtab is returned . |
34,491 | public static boolean isNonSymbolScalar ( IonType type ) { return ! IonType . isContainer ( type ) && ! type . equals ( IonType . SYMBOL ) ; } | Determines whether the passed - in data type is a scalar and not a symbol . |
34,492 | public static final int getSidForSymbolTableField ( String text ) { final int shortestFieldNameLength = 4 ; if ( text != null && text . length ( ) >= shortestFieldNameLength ) { int c = text . charAt ( 0 ) ; switch ( c ) { case 'v' : if ( VERSION . equals ( text ) ) { return VERSION_SID ; } break ; case 'n' : if ( NAME . equals ( text ) ) { return NAME_SID ; } break ; case 's' : if ( SYMBOLS . equals ( text ) ) { return SYMBOLS_SID ; } break ; case 'i' : if ( IMPORTS . equals ( text ) ) { return IMPORTS_SID ; } break ; case 'm' : if ( MAX_ID . equals ( text ) ) { return MAX_ID_SID ; } break ; default : break ; } } return UNKNOWN_SYMBOL_ID ; } | Returns the symbol ID matching a system symbol text of a local or shared symtab field . |
34,493 | private Timestamp make_localtime ( ) { int offset = _offset != null ? _offset . intValue ( ) : 0 ; Timestamp localtime = new Timestamp ( _precision , _year , _month , _day , _hour , _minute , _second , _fraction , _offset , APPLY_OFFSET_NO ) ; localtime . apply_offset ( - offset ) ; assert localtime . _offset == _offset ; return localtime ; } | Applies the local offset from UTC to each of the applicable time field values and returns the new Timestamp . In short this makes the Timestamp represent local time . |
34,494 | public int getYear ( ) { Timestamp adjusted = this ; if ( this . _offset != null ) { if ( this . _offset . intValue ( ) != 0 ) { adjusted = make_localtime ( ) ; } } return adjusted . _year ; } | Returns the year of this Timestamp in its local time . |
34,495 | public int getMonth ( ) { Timestamp adjusted = this ; if ( this . _offset != null ) { if ( this . _offset . intValue ( ) != 0 ) { adjusted = make_localtime ( ) ; } } return adjusted . _month ; } | Returns the month of this Timestamp in its local time . |
34,496 | public int getHour ( ) { Timestamp adjusted = this ; if ( this . _offset != null ) { if ( this . _offset . intValue ( ) != 0 ) { adjusted = make_localtime ( ) ; } } return adjusted . _hour ; } | Returns the hour of this Timestamp in its local time . |
34,497 | public int getMinute ( ) { Timestamp adjusted = this ; if ( this . _offset != null ) { if ( this . _offset . intValue ( ) != 0 ) { adjusted = make_localtime ( ) ; } } return adjusted . _minute ; } | Returns the minute of this Timestamp in its local time . |
34,498 | public Timestamp withLocalOffset ( Integer offset ) { Precision precision = getPrecision ( ) ; if ( precision . alwaysUnknownOffset ( ) || safeEquals ( offset , getLocalOffset ( ) ) ) { return this ; } Timestamp ts = createFromUtcFields ( precision , getZYear ( ) , getZMonth ( ) , getZDay ( ) , getZHour ( ) , getZMinute ( ) , getZSecond ( ) , getZFractionalSecond ( ) , offset ) ; return ts ; } | Returns a timestamp at the same point in time but with the given local offset . If this timestamp has precision coarser than minutes then it is returned unchanged since such timestamps always have an unknown offset . |
34,499 | private void clearUnusedPrecision ( ) { switch ( _precision ) { case YEAR : _month = 1 ; case MONTH : _day = 1 ; case DAY : _hour = 0 ; _minute = 0 ; case MINUTE : _second = 0 ; _fraction = null ; case SECOND : } } | Clears any fields more precise than this Timestamp s precision supports . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.