idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
42,400
public static < I , O > MealyCacheOracle < I , O > createTreeCache ( Alphabet < I > alphabet , MembershipOracle < I , Word < O > > mqOracle ) { return MealyCacheOracle . createTreeCacheOracle ( alphabet , mqOracle ) ; }
Creates a cache oracle for a Mealy machine learning setup using a tree for internal cache organization .
60
21
42,401
public static < I , O > MealyCacheOracle < I , OutputAndLocalInputs < I , O > > createStateLocalInputTreeCache ( Collection < I > initialLocalInputs , MembershipOracle < I , Word < OutputAndLocalInputs < I , O > > > mqOracle ) { return MealyCacheOracle . createStateLocalInputTreeCacheOracle ( initialLocalInputs , mqOra...
Creates a cache oracle for a Mealy machine learning setup with observable state local inputs for every state of the system under learning .
90
27
42,402
public DFALearner < I > asDFALearner ( ) { return new DFALearner < I > ( ) { @ Override public String toString ( ) { return NLStarLearner . this . toString ( ) ; } @ Override public void startLearning ( ) { NLStarLearner . this . startLearning ( ) ; } @ Override public boolean refineHypothesis ( DefaultQuery < I , Bool...
Retrieves a view of this learner as a DFA learner . The DFA is obtained by determinizing and minimizing the NFA hypothesis .
154
31
42,403
public void insertBlock ( AbstractBaseDTNode < I , D > blockRoot ) { blockRoot . removeFromBlockList ( ) ; blockRoot . setNextElement ( next ) ; if ( getNextElement ( ) != null ) { next . setPrevElement ( blockRoot ) ; } blockRoot . setPrevElement ( this ) ; next = blockRoot ; }
Inserts a block into the list . Currently the block is inserted at the head of the list . However callers should not rely on this .
76
29
42,404
@ Override @ Autowired ( required = false ) public void setSamlLogger ( SAMLLogger samlLogger ) { Assert . notNull ( samlLogger , "SAMLLogger can't be null" ) ; this . samlLogger = samlLogger ; }
Logger for SAML events cannot be null must be set .
66
13
42,405
@ Override @ Autowired ( required = false ) @ Qualifier ( "webSSOprofileConsumer" ) public void setConsumer ( WebSSOProfileConsumer consumer ) { Assert . notNull ( consumer , "WebSSO Profile Consumer can't be null" ) ; this . consumer = consumer ; }
Profile for consumption of processed messages must be set .
65
10
42,406
@ Override @ Autowired ( required = false ) @ Qualifier ( "hokWebSSOprofileConsumer" ) public void setHokConsumer ( WebSSOProfileConsumer hokConsumer ) { this . hokConsumer = hokConsumer ; }
Profile for consumption of processed messages using the Holder - of - Key profile must be set .
54
18
42,407
@ SneakyThrows public KeyStore loadKeystore ( String certResourceLocation , String privateKeyResourceLocation , String alias , String keyPassword ) { KeyStore keystore = createEmptyKeystore ( ) ; X509Certificate cert = loadCert ( certResourceLocation ) ; RSAPrivateKey privateKey = loadPrivateKey ( privateKeyResourceLoc...
Based on a public certificate private key alias and password this method will load the certificate and private key as an entry into a newly created keystore and it will set the provided alias and password to the keystore entry .
100
43
42,408
@ SneakyThrows public void addKeyToKeystore ( KeyStore keyStore , X509Certificate cert , RSAPrivateKey privateKey , String alias , String password ) { KeyStore . PasswordProtection pass = new KeyStore . PasswordProtection ( password . toCharArray ( ) ) ; Certificate [ ] certificateChain = { cert } ; keyStore . setEntry...
Based on a public certificate private key alias and password this method will load the certificate and private key as an entry into the keystore and it will set the provided alias and password to the keystore entry .
101
41
42,409
@ SneakyThrows public KeyStore createEmptyKeystore ( ) { KeyStore keyStore = KeyStore . getInstance ( "JKS" ) ; keyStore . load ( null , "" . toCharArray ( ) ) ; return keyStore ; }
Returns an empty KeyStore object .
53
7
42,410
@ SneakyThrows public X509Certificate loadCert ( String certLocation ) { CertificateFactory cf = CertificateFactory . getInstance ( "X509" ) ; Resource certRes = resourceLoader . getResource ( certLocation ) ; X509Certificate cert = ( X509Certificate ) cf . generateCertificate ( certRes . getInputStream ( ) ) ; return ...
Given a resource location it loads a PEM X509 certificate .
80
13
42,411
@ SneakyThrows public RSAPrivateKey loadPrivateKey ( String privateKeyLocation ) { Resource keyRes = resourceLoader . getResource ( privateKeyLocation ) ; byte [ ] keyBytes = StreamUtils . copyToByteArray ( keyRes . getInputStream ( ) ) ; PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec ( keyBytes ) ; KeyFa...
Given a resource location it loads a DER RSA private Key .
133
13
42,412
public static Properties initialize ( URI uri , Configuration conf ) throws IOException , ConfigurationParseException { String host = Utils . getHost ( uri ) ; Properties props = new Properties ( ) ; if ( ! Utils . validSchema ( uri ) ) { props . setProperty ( SWIFT_AUTH_METHOD_PROPERTY , PUBLIC_ACCESS ) ; } else { fin...
Parse configuration properties from the core - site . xml and initialize Swift configuration
861
15
42,413
public SwiftCachedObject get ( final String objName ) throws IOException { LOG . trace ( "Get from cache: {}" , objName ) ; SwiftCachedObject res = cache . get ( objName ) ; if ( res == null ) { LOG . trace ( "Cache get: {} is not in the cache. Access Swift to get content length" , objName ) ; StoredObject rawObj = con...
The get function will first search for the object in the cache . If not found will issue a HEAD request for the object metadata and add the object to the cache .
175
33
42,414
public boolean isTemporaryPath ( String path ) { for ( String tempPath : tempIdentifiers ) { String [ ] tempPathComponents = tempPath . split ( "/" ) ; if ( tempPathComponents . length > 0 && path != null && path . contains ( tempPathComponents [ 0 ] . replace ( "ID" , "" ) ) ) { return true ; } } return false ; }
Inspect the path and return true if path contains reserved _temporary or the first entry from fs . stocator . temp . identifier if provided
86
30
42,415
public Path modifyPathToFinalDestination ( Path path ) throws IOException { String res ; if ( tempFileOriginator . equals ( DEFAULT_FOUTPUTCOMMITTER_V1 ) ) { res = parseHadoopOutputCommitter ( path , true , hostNameScheme ) ; } else { res = extractNameFromTempPath ( path , true , hostNameScheme ) ; } return new Path ( ...
Accept temporary path and return a final destination path
99
9
42,416
private String parseHadoopOutputCommitter ( Path fullPath , boolean addTaskIdCompositeName , String hostNameScheme ) throws IOException { String path = fullPath . toString ( ) ; String noPrefix = path ; if ( path . startsWith ( hostNameScheme ) ) { noPrefix = path . substring ( hostNameScheme . length ( ) ) ; } int npI...
Main method to parse Hadoop OutputCommitter V1 or V2 as used by Hadoop M - R or Apache Spark Method transforms object name from the temporary path .
556
36
42,417
private String extractExtension ( String filename ) { int startExtension = filename . indexOf ( ' ' ) ; if ( startExtension > 0 ) { return filename . substring ( startExtension + 1 ) ; } return "" ; }
A filename for example one3 - attempt - 01 . txt . gz will return txt . gz
51
23
42,418
protected ObjectMetadata getObjectMetadata ( String key ) { try { ObjectMetadata meta = mClient . getObjectMetadata ( mBucket , key ) ; return meta ; } catch ( AmazonClientException e ) { LOG . debug ( e . getMessage ( ) ) ; return null ; } }
Request object metadata Used to call _SUCCESS object or identify if objects were generated by Stocator
64
21
42,419
public PutObjectRequest newPutObjectRequest ( String key , ObjectMetadata metadata , File srcfile ) { PutObjectRequest putObjectRequest = new PutObjectRequest ( mBucket , key , srcfile ) ; putObjectRequest . setMetadata ( metadata ) ; return putObjectRequest ; }
Create a putObject request . Adds the ACL and metadata
61
11
42,420
private void initConnectionSettings ( Configuration conf , ClientConfiguration clientConf ) throws IOException { clientConf . setMaxConnections ( Utils . getInt ( conf , FS_COS , FS_ALT_KEYS , MAXIMUM_CONNECTIONS , DEFAULT_MAXIMUM_CONNECTIONS ) ) ; clientConf . setClientExecutionTimeout ( Utils . getInt ( conf , FS_COS...
Initializes connection management
634
4
42,421
private String correctPlusSign ( String origin , String stringToCorrect ) { if ( origin . contains ( "+" ) ) { LOG . debug ( "Adapt plus sign in {} to avoid SDK bug on {}" , origin , stringToCorrect ) ; StringBuilder tmpStringToCorrect = new StringBuilder ( stringToCorrect ) ; boolean hasSign = true ; int fromIndex = 0...
Due to SDK bug list operations may return strings that has spaces instead of + This method will try to fix names for known patterns
235
25
42,422
private void copyFile ( String srcKey , String dstKey , long size ) throws IOException , InterruptedIOException , AmazonClientException { LOG . debug ( "copyFile {} -> {} " , srcKey , dstKey ) ; CopyObjectRequest copyObjectRequest = new CopyObjectRequest ( mBucket , srcKey , mBucket , dstKey ) ; try { ObjectMetadata sr...
Copy a single object in the bucket via a COPY operation .
281
13
42,423
static BlockFactory createFactory ( COSAPIClient owner , String name ) { switch ( name ) { case COSConstants . FAST_UPLOAD_BUFFER_ARRAY : return new ArrayBlockFactory ( owner ) ; case COSConstants . FAST_UPLOAD_BUFFER_DISK : return new DiskBlockFactory ( owner ) ; default : throw new IllegalArgumentException ( "Unsuppo...
Create a factory .
107
4
42,424
private synchronized void reopen ( String msg , long targetPos , long length ) throws IOException { if ( wrappedStream != null ) { closeStream ( "reopen(" + msg + ")" , contentRangeFinish ) ; } contentRangeStart = targetPos ; contentRangeFinish = targetPos + Math . max ( readahead , length ) + threasholdRead ; if ( neg...
Reopen stream if closed
280
5
42,425
private void closeStream ( String msg , long length ) { if ( wrappedStream != null ) { long remaining = remainingInCurrentRequest ( ) ; boolean shouldAbort = remaining > readahead ; if ( ! shouldAbort ) { try { wrappedStream . close ( ) ; } catch ( IOException e ) { LOG . debug ( "When closing {} stream for {}" , uri ,...
close the stream
186
3
42,426
@ InterfaceAudience . Private @ InterfaceStability . Unstable public synchronized long remainingInFile ( ) throws IOException { return objectCache . get ( objName ) . getContentLength ( ) - pos ; }
Bytes left in stream .
44
5
42,427
private synchronized void reopen ( String reason , long targetPos , long length ) throws IOException { if ( wrappedStream != null ) { closeStream ( "reopen(" + reason + ")" , contentRangeFinish , false ) ; } contentRangeFinish = calculateRequestLimit ( inputPolicy , targetPos , length , contentLength , readahead ) ; LO...
Opens up the stream at specified target position and for given length .
254
14
42,428
private void lazySeek ( long targetPos , long len ) throws IOException { //For lazy seek seekInStream ( targetPos , len ) ; //re-open at specific location if needed if ( wrappedStream == null ) { reopen ( "read from new offset" , targetPos , len ) ; } }
Perform lazy seek and adjust stream to correct position for reading .
65
13
42,429
static long calculateRequestLimit ( COSInputPolicy inputPolicy , long targetPos , long length , long contentLength , long readahead ) { long rangeLimit ; switch ( inputPolicy ) { case Random : // positioned. // read either this block, or the here + readahead value. rangeLimit = ( length < 0 ) ? contentLength : targetPo...
Calculate the limit for a get request based on input policy and state of object .
148
18
42,430
public static String getContainerName ( String hostname , boolean serviceRequired ) throws IOException { int i = hostname . lastIndexOf ( "." ) ; if ( i <= 0 ) { if ( serviceRequired ) { throw badHostName ( hostname ) ; } return hostname ; } return hostname . substring ( 0 , i ) ; }
Extracts container name from the container . service or container
74
12
42,431
public static String getServiceName ( String hostname ) throws IOException { int i = hostname . lastIndexOf ( "." ) ; if ( i <= 0 ) { throw badHostName ( hostname ) ; } String service = hostname . substring ( i + 1 ) ; if ( service . isEmpty ( ) || service . contains ( "." ) ) { throw badHostName ( hostname ) ; } retur...
Extracts service name from the container . service
92
10
42,432
public static boolean validSchema ( URI uri ) throws IOException { LOG . trace ( "Checking schema {}" , uri . toString ( ) ) ; String hostName = Utils . getHost ( uri ) ; LOG . trace ( "Got hostname as {}" , hostName ) ; int i = hostName . lastIndexOf ( "." ) ; if ( i < 0 ) { return false ; } String service = hostName ...
Test if hostName of the form container . service
144
10
42,433
public static String getHost ( URI uri ) throws IOException { String host = uri . getHost ( ) ; if ( host != null ) { return host ; } host = uri . toString ( ) ; int sInd = host . indexOf ( "//" ) + 2 ; host = host . substring ( sInd ) ; int eInd = host . indexOf ( "/" ) ; if ( eInd != - 1 ) { host = host . substring (...
Extract host name from the URI
138
7
42,434
public static String getOption ( Properties props , String key ) throws IOException { String val = props . getProperty ( key ) ; if ( val == null ) { throw new IOException ( "Undefined property: " + key ) ; } return val ; }
Get a mandatory configuration option
54
5
42,435
public static void updateProperty ( Configuration conf , String prefix , String [ ] altPrefix , String key , Properties props , String propsKey , boolean required ) throws ConfigurationParseException { String val = conf . get ( prefix + key ) ; String altKey = prefix + key ; if ( val == null ) { // try alternative key ...
Read key from core - site . xml and parse it to connector configuration
172
14
42,436
public static String extractTaskID ( String path , String identifier ) { LOG . debug ( "extract task id for {}" , path ) ; if ( path . contains ( HADOOP_ATTEMPT ) ) { String prf = path . substring ( path . indexOf ( HADOOP_ATTEMPT ) ) ; if ( prf . contains ( "/" ) ) { return TaskAttemptID . forName ( prf . substring ( ...
Extract Hadoop Task ID from path
262
9
42,437
public static long lastModifiedAsLong ( String strTime ) throws IOException { final SimpleDateFormat simpleDateFormat = new SimpleDateFormat ( TIME_PATTERN , Locale . US ) ; try { long lastModified = simpleDateFormat . parse ( strTime ) . getTime ( ) ; if ( lastModified == 0 ) { lastModified = System . currentTimeMilli...
Transforms last modified time stamp from String to the long format
121
12
42,438
public static IOException extractException ( String operation , String path , ExecutionException ee ) { IOException ioe ; Throwable cause = ee . getCause ( ) ; if ( cause instanceof AmazonClientException ) { ioe = translateException ( operation , path , ( AmazonClientException ) cause ) ; } else if ( cause instanceof I...
Extract an exception from a failed future and convert to an IOE .
112
15
42,439
static boolean containsInterruptedException ( Throwable thrown ) { if ( thrown == null ) { return false ; } if ( thrown instanceof InterruptedException || thrown instanceof InterruptedIOException ) { return true ; } // tail recurse return containsInterruptedException ( thrown . getCause ( ) ) ; }
Recurse down the exception loop looking for any inner details about an interrupted exception .
64
16
42,440
public static int ensureOutputParameterInRange ( String name , long size ) { if ( size > Integer . MAX_VALUE ) { LOG . warn ( "cos: {} capped to ~2.14GB" + " (maximum allowed size with current output mechanism)" , name ) ; return Integer . MAX_VALUE ; } else { return ( int ) size ; } }
Ensure that the long value is in the range of an integer .
76
14
42,441
public static COSFileStatus createFileStatus ( Path keyPath , S3ObjectSummary summary , long blockSize ) { long size = summary . getSize ( ) ; return createFileStatus ( keyPath , objectRepresentsDirectory ( summary . getKey ( ) , size ) , size , summary . getLastModified ( ) , blockSize ) ; }
Create a files status instance from a listing .
74
9
42,442
public static IStoreClient getStoreClient ( URI fsuri , Configuration conf ) throws IOException { final String fsSchema = fsuri . toString ( ) . substring ( 0 , fsuri . toString ( ) . indexOf ( "://" ) ) ; final ClassLoader classLoader = ObjectStoreVisitor . class . getClassLoader ( ) ; String [ ] supportedSchemas = co...
fs . stocator . scheme . list contains comma separated list of the provided back - end storage drivers . If none provided or key is not present then swift is the default value .
565
37
42,443
public void createAccount ( ) { mAccount = new AccountFactory ( mAccountConfig ) . setHttpClient ( httpclient ) . createAccount ( ) ; mAccess = mAccount . getAccess ( ) ; if ( mRegion != null ) { mAccess . setPreferredRegion ( mRegion ) ; } }
Creates account model
65
4
42,444
public void createDummyAccount ( ) { mAccount = new DummyAccountFactory ( mAccountConfig ) . setHttpClient ( httpclient ) . createAccount ( ) ; mAccess = mAccount . getAccess ( ) ; }
Creates virtual account . Used for public containers
48
9
42,445
public void authenticate ( ) { if ( mAccount == null ) { // Create account also performs authentication. createAccount ( ) ; } else { mAccess = mAccount . authenticate ( ) ; if ( mRegion != null ) { mAccess . setPreferredRegion ( mRegion ) ; } } }
Authenticates and renew the token
64
6
42,446
public String getAccessURL ( ) { if ( mUsePublicURL ) { LOG . trace ( "Using public URL: " + mAccess . getPublicURL ( ) ) ; return mAccess . getPublicURL ( ) ; } LOG . trace ( "Using internal URL: " + mAccess . getInternalURL ( ) ) ; return mAccess . getInternalURL ( ) ; }
Get authenticated URL
80
3
42,447
private synchronized COSDataBlocks . DataBlock createBlockIfNeeded ( ) throws IOException { if ( activeBlock == null ) { blockCount ++ ; if ( blockCount >= COSConstants . MAX_MULTIPART_COUNT ) { LOG . error ( "Number of partitions in stream exceeds limit for S3: " + COSConstants . MAX_MULTIPART_COUNT + " write may fail...
Demand create a destination block .
117
6
42,448
private synchronized void uploadCurrentBlock ( ) throws IOException { if ( ! hasActiveBlock ( ) ) { throw new IllegalStateException ( "No active block" ) ; } LOG . debug ( "Writing block # {}" , blockCount ) ; if ( multiPartUpload == null ) { LOG . debug ( "Initiating Multipart upload" ) ; multiPartUpload = new MultiPa...
Start an asynchronous upload of the current block .
132
9
42,449
private void putObject ( ) throws IOException { LOG . debug ( "Executing regular upload for {}" , writeOperationHelper ) ; final COSDataBlocks . DataBlock block = getActiveBlock ( ) ; int size = block . dataSize ( ) ; final COSDataBlocks . BlockUploadData uploadData = block . startUpload ( ) ; final PutObjectRequest pu...
Upload the current block as a single PUT request ; if the buffer is empty a 0 - byte PUT will be invoked as it is needed to create an entry at the far end .
387
38
42,450
@ Override public FSDataOutputStream createObject ( String objName , String contentType , Map < String , String > metadata , Statistics statistics ) throws IOException { final URL url = new URL ( mJossAccount . getAccessURL ( ) + "/" + getURLEncodedObjName ( objName ) ) ; LOG . debug ( "PUT {}. Content-Type : {}" , url...
Direct HTTP PUT request without JOSS package
246
9
42,451
private void setCorrectSize ( StoredObject tmp , Container cObj ) { long objectSize = tmp . getContentLength ( ) ; if ( objectSize == 0 ) { // we may hit a well known Swift bug. // container listing reports 0 for large objects. StoredObject soDirect = cObj . getObject ( tmp . getName ( ) ) ; long contentLength = soDire...
Swift has a bug where container listing might wrongly report size 0 for large objects . It s seems to be a well known issue in Swift without solution . We have to provide work around for this . If container listing reports size 0 for some object we send additional HEAD on that object to verify it s size .
109
62
42,452
private FileStatus createFileStatus ( StoredObject tmp , Container cObj , String hostName , Path path ) throws IllegalArgumentException , IOException { String newMergedPath = getMergedPath ( hostName , path , tmp . getName ( ) ) ; return new FileStatus ( tmp . getContentLength ( ) , false , 1 , blockSize , Utils . last...
Maps StoredObject of JOSS into Hadoop FileStatus
114
13
42,453
public static Properties initialize ( URI uri , Configuration conf , String scheme ) throws IOException { LOG . debug ( "COS driver: initialize start for {} " , uri . toString ( ) ) ; String host = Utils . getHost ( uri ) ; LOG . debug ( "extracted host name from {} is {}" , uri . toString ( ) , host ) ; String bucket ...
Parse configuration properties from the core - site . xml and initialize COS configuration
642
16
42,454
private HttpRequestRetryHandler getRetryHandler ( ) { final HttpRequestRetryHandler myRetryHandler = new HttpRequestRetryHandler ( ) { public boolean retryRequest ( IOException exception , int executionCount , HttpContext context ) { if ( executionCount >= connectionConfiguration . getExecutionCount ( ) ) { // Do not r...
Creates custom retry handler to be used if HTTP exception happens
464
13
42,455
public CloseableHttpClient createHttpConnection ( ) { LOG . trace ( "HTTP build new connection based on connection pool" ) ; return HttpClients . custom ( ) . setRetryHandler ( getRetryHandler ( ) ) . setConnectionManager ( connectionPool ) . setDefaultRequestConfig ( rConfig ) . setKeepAliveStrategy ( myStrategy ) . b...
Creates HTTP connection based on the connection pool
84
9
42,456
public void setGraphvizCommand ( String cmd ) { if ( cmd != null && cmd . length ( ) == 0 ) cmd = null ; graphvizCommand = cmd ; }
Set the Graphviz command that is issued to paint a debugging diagram .
38
15
42,457
public String javaName ( final JvmVisibility visibility ) { if ( ( visibility != null ) ) { String _switchResult = null ; if ( visibility != null ) { switch ( visibility ) { case PRIVATE : _switchResult = "private " ; break ; case PUBLIC : _switchResult = "public " ; break ; case PROTECTED : _switchResult = "protected ...
Returns the visibility modifier and a space as suffix if not empty
115
12
42,458
protected String getInvalidWritableVariableAccessMessage ( XVariableDeclaration variable , XAbstractFeatureCall featureCall , IResolvedTypes resolvedTypes ) { // TODO this should be part of a separate validation service XClosure containingClosure = EcoreUtil2 . getContainerOfType ( featureCall , XClosure . class ) ; if...
Provide the error message for mutable variables that may not be captured in lambdas .
144
19
42,459
public void setDocumentation ( /* @Nullable */ JvmIdentifiableElement jvmElement , /* @Nullable */ String documentation ) { if ( jvmElement == null || documentation == null ) return ; DocumentationAdapter documentationAdapter = new DocumentationAdapter ( ) ; documentationAdapter . setDocumentation ( documentation ) ; j...
Attaches the given documentation to the given jvmElement .
81
12
42,460
public void copyDocumentationTo ( /* @Nullable */ final EObject source , /* @Nullable */ JvmIdentifiableElement jvmElement ) { if ( source == null || jvmElement == null ) return ; DocumentationAdapter documentationAdapter = new DocumentationAdapter ( ) { private boolean computed = false ; @ Override public String getDo...
Attaches the given documentation of the source element to the given jvmElement .
163
16
42,461
protected boolean isPrimitiveBoolean ( JvmTypeReference typeRef ) { if ( InferredTypeIndicator . isInferred ( typeRef ) ) { return false ; } return typeRef != null && typeRef . getType ( ) != null && ! typeRef . getType ( ) . eIsProxy ( ) && "boolean" . equals ( typeRef . getType ( ) . getIdentifier ( ) ) ; }
Detects whether the type reference refers to primitive boolean .
91
11
42,462
public void setGeneratorProjectName ( String generatorProjectName ) { if ( generatorProjectName == null || "" . equals ( generatorProjectName . trim ( ) ) ) { return ; } this . generatorProjectName = generatorProjectName . trim ( ) ; }
Sets the name of the generator project .
54
9
42,463
public void setFileExtension ( String modelFileExtension ) { if ( modelFileExtension == null || "" . equals ( modelFileExtension . trim ( ) ) ) { return ; } this . modelFileExtension = modelFileExtension . trim ( ) ; }
Sets the file extension used when creating the initial sample model .
58
13
42,464
public static String getCharacterName ( char character ) { String transliterated = transliterator . transliterate ( String . valueOf ( character ) ) ; // returns strings in the for of SEMICOLON} return transliterated . substring ( "\\N{" . length ( ) , transliterated . length ( ) - "}" . length ( ) ) ; }
Returns the Unicode string name for a character .
78
9
42,465
@ Override protected List < String > getSignificantContent ( ) { final List < String > result = super . getSignificantContent ( ) ; if ( ( ( result . size ( ) >= 1 ) && Objects . equal ( this . getLineDelimiter ( ) , IterableExtensions . < String > last ( result ) ) ) ) { int _size = result . size ( ) ; int _minus = ( ...
A potentially contained trailing line delimiter is ignored .
112
10
42,466
public void selectStrategy ( ) { LightweightTypeReference expectedType = expectation . getExpectedType ( ) ; if ( expectedType == null ) { strategy = getClosureWithoutExpectationHelper ( ) ; } else { JvmOperation operation = functionTypes . findImplementingOperation ( expectedType ) ; JvmType type = expectedType . getT...
This method is only public for testing purpose .
206
9
42,467
protected void validateResourceState ( Resource resource ) { if ( resource instanceof StorageAwareResource && ( ( StorageAwareResource ) resource ) . isLoadedFromStorage ( ) ) { LOG . error ( "Discouraged attempt to compute types for resource that was loaded from storage. Resource was : " + resource . getURI ( ) , new ...
Checks the internal state of the resource and logs if type resolution was triggered unexpectedly .
79
17
42,468
public synchronized String getString ( ) { // check state and initialize buffer if ( outputFileName == null ) throw new IllegalStateException ( ) ; StringBuffer out = new StringBuffer ( ) ; // start the SMAP out . append ( "SMAP\n" ) ; out . append ( outputFileName + ' ' ) ; out . append ( defaultStratum + ' ' ) ; // i...
Methods for serializing the logical SMAP
239
8
42,469
@ Deprecated protected boolean doValidateLambdaContents ( XClosure closure , DiagnosticChain diagnostics , Map < Object , Object > context ) { return true ; }
This was here for EMF 2 . 5 compatibility and was refactored to a no - op .
36
21
42,470
public boolean isJavaSwitchExpression ( final XSwitchExpression it ) { boolean _xblockexpression = false ; { final LightweightTypeReference switchType = this . getSwitchVariableType ( it ) ; if ( ( switchType == null ) ) { return false ; } boolean _isSubtypeOf = switchType . isSubtypeOf ( Integer . TYPE ) ; if ( _isSub...
Determine whether the given switch expression is valid for Java version 6 or lower .
152
17
42,471
public boolean isJava7SwitchExpression ( final XSwitchExpression it ) { boolean _xblockexpression = false ; { final LightweightTypeReference switchType = this . getSwitchVariableType ( it ) ; if ( ( switchType == null ) ) { return false ; } boolean _isSubtypeOf = switchType . isSubtypeOf ( Integer . TYPE ) ; if ( _isSu...
Determine whether the given switch expression is valid for Java version 7 or higher .
190
17
42,472
protected boolean isMultilineLambda ( final XClosure closure ) { final ILeafNode closingBracket = this . _nodeModelAccess . nodeForKeyword ( closure , "]" ) ; HiddenLeafs _hiddenLeafsBefore = null ; if ( closingBracket != null ) { _hiddenLeafsBefore = this . _hiddenLeafAccess . getHiddenLeafsBefore ( closingBracket ) ;...
checks whether the given lambda should be formatted as a block . That includes newlines after and before the brackets and a fresh line for each expression .
296
29
42,473
protected List < ICompositeNode > internalFindValidReplaceRootNodeForChangeRegion ( List < ICompositeNode > nodesEnclosingRegion ) { List < ICompositeNode > result = new ArrayList < ICompositeNode > ( ) ; boolean mustSkipNext = false ; for ( int i = 0 ; i < nodesEnclosingRegion . size ( ) ; i ++ ) { ICompositeNode node...
Investigates the composite nodes containing the changed region and collects a list of nodes which could possibly replaced by a partial parse . Such a node has a parent that consumes all his current lookahead tokens and all of these tokens are located before the changed region .
174
51
42,474
public ResolvedFeatures getResolvedFeatures ( LightweightTypeReference contextType , JavaVersion targetVersion ) { return new ResolvedFeatures ( contextType , overrideTester , targetVersion ) ; }
Returns the resolved features targeting a specific Java version in order to support new language features .
40
17
42,475
public Class < ? extends org . eclipse . xtext . parsetree . reconstr . IParseTreeConstructor > bindIParseTreeConstructor ( ) { return org . eclipse . xtext . generator . parser . antlr . debug . parseTreeConstruction . SimpleAntlrParsetreeConstructor . class ; }
contributed by org . eclipse . xtext . generator . parseTreeConstructor . ParseTreeConstructorFragment
68
24
42,476
@ org . eclipse . xtext . service . SingletonBinding ( eager = true ) public Class < ? extends org . eclipse . xtext . generator . parser . antlr . debug . validation . SimpleAntlrJavaValidator > bindSimpleAntlrJavaValidator ( ) { return org . eclipse . xtext . generator . parser . antlr . debug . validation . SimpleAn...
contributed by org . eclipse . xtext . generator . validation . JavaValidatorFragment
88
19
42,477
public Class < ? extends org . eclipse . xtext . formatting . IFormatter > bindIFormatter ( ) { return org . eclipse . xtext . generator . parser . antlr . debug . formatting . SimpleAntlrFormatter . class ; }
contributed by org . eclipse . xtext . generator . formatting . FormatterFragment
53
18
42,478
protected void addLocalToCurrentScope ( XExpression expression , ITypeComputationState state ) { if ( expression instanceof XVariableDeclaration ) { addLocalToCurrentScope ( ( XVariableDeclaration ) expression , state ) ; } }
If the expression is a variable declaration then add it to the current scope ; DSLs introducing new containers for variable declarations should override this method and explicitly add nested variable declarations .
52
34
42,479
protected void _computeTypes ( XDoWhileExpression object , ITypeComputationState state ) { ITypeComputationResult loopBodyResult = computeWhileLoopBody ( object , state , false ) ; boolean noImplicitReturn = ( loopBodyResult . getConformanceFlags ( ) & ConformanceFlags . NO_IMPLICIT_RETURN ) != 0 ; LightweightTypeRefer...
Since we are sure that the loop body is executed at least once the early exit information of the loop body expression can be used for the outer expression .
150
30
42,480
protected EObject findAccessibleType ( String fragment , ResourceSet resourceSet , Iterator < IEObjectDescription > fromIndex ) throws UnknownNestedTypeException { IEObjectDescription description = fromIndex . next ( ) ; return getAccessibleType ( description , fragment , resourceSet ) ; }
Returns the first type that was found in the index . May be overridden to honor visibility semantics . The given iterator is never empty .
64
27
42,481
protected EObject getAccessibleType ( IEObjectDescription description , String fragment , ResourceSet resourceSet ) throws UnknownNestedTypeException { EObject typeProxy = description . getEObjectOrProxy ( ) ; if ( typeProxy . eIsProxy ( ) ) { typeProxy = EcoreUtil . resolve ( typeProxy , resourceSet ) ; } if ( ! typeP...
Read and resolve the EObject from the given description and navigate to its children according to the given fragment .
143
21
42,482
public EObject resolveJavaObject ( JvmType rootType , String fragment ) throws UnknownNestedTypeException { if ( fragment . endsWith ( "[]" ) ) { return resolveJavaArrayObject ( rootType , fragment ) ; } int slash = fragment . indexOf ( ' ' ) ; if ( slash != - 1 ) { if ( slash == 0 ) return null ; String containerFragm...
Locate a locale type with the given fragment . Does not consider types that are defined in operations or constructors as inner classes .
444
26
42,483
protected void cumulateDistance ( final List < LightweightTypeReference > references , Multimap < JvmType , LightweightTypeReference > all , Multiset < JvmType > cumulatedDistance ) { for ( LightweightTypeReference other : references ) { Multiset < JvmType > otherDistance = LinkedHashMultiset . create ( ) ; initializeD...
Keeps the cumulated distance for all the common raw super types of the given references . Interfaces that are more directly implemented will get a lower total count than more general interfaces .
170
36
42,484
public void configureFormatterPreferences ( Binder binder ) { binder . bind ( IPreferenceValuesProvider . class ) . annotatedWith ( FormatterPreferences . class ) . to ( FormatterPreferenceValuesProvider . class ) ; }
contributed by org . eclipse . xtext . xtext . generator . formatting . Formatter2Fragment2
52
23
42,485
@ Override public void resolveLazyCrossReferences ( CancelIndicator monitor ) { IParseResult parseResult = getParseResult ( ) ; if ( parseResult != null ) { batchLinkingService . resolveBatched ( parseResult . getRootASTElement ( ) , monitor ) ; } operationCanceledManager . checkCanceled ( monitor ) ; super . resolveLa...
Delegates to the BatchLinkingService to resolve all references . The linking service is responsible to lock the resource or resource set .
88
27
42,486
private void markPendingInitialization ( JvmDeclaredTypeImplCustom type ) { type . setPendingInitialization ( true ) ; for ( JvmMember member : type . basicGetMembers ( ) ) { if ( member instanceof JvmDeclaredTypeImplCustom ) { markPendingInitialization ( ( JvmDeclaredTypeImplCustom ) member ) ; } } }
Recursively traverse the types in this resource to mark them as lazy initialized types .
80
17
42,487
protected Map < JvmIdentifiableElement , ResolvedTypes > prepare ( ResolvedTypes resolvedTypes , IFeatureScopeSession featureScopeSession ) { Map < JvmIdentifiableElement , ResolvedTypes > resolvedTypesByContext = Maps . newHashMapWithExpectedSize ( 3 ) ; JvmType root = getRootJvmType ( ) ; rootedInstances . add ( root...
Assign computed type references to the identifiable structural elements in the processed type .
115
15
42,488
protected XExpression getInferredFrom ( JvmTypeReference typeReference ) { if ( InferredTypeIndicator . isInferred ( typeReference ) ) { XComputedTypeReference computed = ( XComputedTypeReference ) typeReference ; if ( computed . getEquivalent ( ) instanceof XComputedTypeReference ) { XComputedTypeReference inferred = ...
Returns the expression that will be used to infer the given type from . If the type is already resolved the result will be null . If no expression can be determined null is also returned .
141
37
42,489
private boolean isRawType ( JvmTypeParameter current , RecursionGuard < JvmTypeParameter > guard ) { if ( guard . tryNext ( current ) ) { List < JvmTypeConstraint > constraints = current . getConstraints ( ) ; for ( int i = 0 , size = constraints . size ( ) ; i < size ; i ++ ) { JvmTypeConstraint constraint = constrain...
Here we already know that we don t have type arguments
359
11
42,490
public ParameterizedTypeReference toInstanceTypeReference ( ) { ParameterizedTypeReference result = getOwner ( ) . newParameterizedTypeReference ( getType ( ) ) ; for ( LightweightTypeReference typeArgument : getTypeArguments ( ) ) { result . addTypeArgument ( typeArgument . getInvariantBoundSubstitute ( ) ) ; } return...
Returns a projection of this type to the instance level . That is type arguments will be replaced by their invariant bounds .
83
24
42,491
@ Override public void visit ( final String name , final Object value ) { JvmAnnotationValue annotationValue = proxies . createAnnotationValue ( value ) ; annotationValue . setOperation ( proxies . createMethodProxy ( annotationType , name ) ) ; values . addUnique ( annotationValue ) ; }
Visits a primitive value of the annotation .
63
9
42,492
@ Override public IResourceDescriptions getResourceDescriptions ( ResourceSet resourceSet ) { IResourceDescriptions result = super . getResourceDescriptions ( resourceSet ) ; if ( compilerPhases . isIndexing ( resourceSet ) ) { // during indexing we don't want to see any local files String projectName = getProjectName ...
And if we are in the indexing phase we don t want to see the local resources .
204
19
42,493
public void clearResourceSet ( final ResourceSet resourceSet ) { final boolean wasDeliver = resourceSet . eDeliver ( ) ; try { resourceSet . eSetDeliver ( false ) ; resourceSet . getResources ( ) . clear ( ) ; } finally { resourceSet . eSetDeliver ( wasDeliver ) ; } }
Clears the content of the resource set without sending notifications . This avoids unnecessary explicit unloads .
71
19
42,494
protected final boolean announceSynonym ( LightweightTypeReference synonym , ConformanceHint hint , Acceptor acceptor ) { if ( synonym . isUnknown ( ) ) { return true ; } return acceptor . accept ( synonym , hint ) ; }
Announce a synonym type with the given conformance hint .
54
13
42,495
protected final boolean announceSynonym ( LightweightTypeReference synonym , EnumSet < ConformanceHint > hints , Acceptor acceptor ) { if ( synonym . isUnknown ( ) ) { return true ; } return acceptor . accept ( synonym , hints ) ; }
Announce a synonym type with the given conformance hints .
59
13
42,496
protected final boolean announceSynonym ( LightweightTypeReference synonym , int flags , Acceptor acceptor ) { if ( synonym . isUnknown ( ) ) { return true ; } return acceptor . accept ( synonym , flags | ConformanceFlags . CHECKED_SUCCESS ) ; }
Announce a synonym type with the given conformance flags .
63
13
42,497
protected File getTmpFolder ( ) { final ArrayList < ? > _cacheKey = CollectionLiterals . newArrayList ( ) ; final File _result ; synchronized ( _createCache_getTmpFolder ) { if ( _createCache_getTmpFolder . containsKey ( _cacheKey ) ) { return _createCache_getTmpFolder . get ( _cacheKey ) ; } File _createTempDir = File...
offers a singleton temporary folder
143
7
42,498
protected static void deleteDir ( final File dir ) { try { boolean _exists = dir . exists ( ) ; boolean _not = ( ! _exists ) ; if ( _not ) { return ; } org . eclipse . xtext . util . Files . sweepFolder ( dir ) ; try { dir . delete ( ) ; } finally { } } catch ( Throwable _e ) { throw Exceptions . sneakyThrow ( _e ) ; }...
little helper for cleaning up the temporary stuff .
95
9
42,499
public static List < AbstractElement > getFirstSet ( AbstractElement element ) { return org . eclipse . xtext . xtext . generator . parser . antlr . AntlrGrammarGenUtil . getFirstSet ( element ) ; }
Returns the first - set of the given abstractElement . That is all keywords with distinct values and all rule calls to distinct terminals .
51
26