signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class MariaDbConnection { /** * Retrieves this < code > Connection < / code > object ' s current transaction isolation level .
* @ return the current transaction isolation level , which will be one of the following constants :
* < code > Connection . TRANSACTION _ READ _ UNCOMMITTED < / code > ,
* < code > Connection . TRANSACTION _ READ _ COMMITTED < / code > , < code > Connection . TRANSACTION _ REPEATABLE _ READ < / code > ,
* < code > Connection . TRANSACTION _ SERIALIZABLE < / code > , or < code > Connection . TRANSACTION _ NONE < / code > .
* @ throws SQLException if a database access error occurs or this method is called on a closed
* connection
* @ see # setTransactionIsolation */
public int getTransactionIsolation ( ) throws SQLException { } } | Statement stmt = createStatement ( ) ; String sql = "SELECT @@tx_isolation" ; if ( ! protocol . isServerMariaDb ( ) ) { if ( ( protocol . getMajorServerVersion ( ) >= 8 && protocol . versionGreaterOrEqual ( 8 , 0 , 3 ) ) || ( protocol . getMajorServerVersion ( ) < 8 && protocol . versionGreaterOrEqual ( 5 , 7 , 20 ) ) ) { sql = "SELECT @@transaction_isolation" ; } } ResultSet rs = stmt . executeQuery ( sql ) ; if ( rs . next ( ) ) { final String response = rs . getString ( 1 ) ; switch ( response ) { case "REPEATABLE-READ" : return Connection . TRANSACTION_REPEATABLE_READ ; case "READ-UNCOMMITTED" : return Connection . TRANSACTION_READ_UNCOMMITTED ; case "READ-COMMITTED" : return Connection . TRANSACTION_READ_COMMITTED ; case "SERIALIZABLE" : return Connection . TRANSACTION_SERIALIZABLE ; default : throw ExceptionMapper . getSqlException ( "Could not get transaction isolation level: " + "Invalid value \"" + response + "\"" ) ; } } throw ExceptionMapper . getSqlException ( "Could not get transaction isolation level" ) ; |
public class DateTimeFormatter { /** * Parses and resolves the specified text .
* This parses to a { @ code TemporalAccessor } ensuring that the text is fully parsed .
* @ param text the text to parse , not null
* @ param position the position to parse from , updated with length parsed
* and the index of any error , null if parsing whole string
* @ return the resolved result of the parse , not null
* @ throws DateTimeParseException if the parse fails
* @ throws DateTimeException if an error occurs while resolving the date or time
* @ throws IndexOutOfBoundsException if the position is invalid */
private TemporalAccessor parseResolved0 ( final CharSequence text , final ParsePosition position ) { } } | ParsePosition pos = ( position != null ? position : new ParsePosition ( 0 ) ) ; DateTimeParseContext context = parseUnresolved0 ( text , pos ) ; if ( context == null || pos . getErrorIndex ( ) >= 0 || ( position == null && pos . getIndex ( ) < text . length ( ) ) ) { String abbr ; if ( text . length ( ) > 64 ) { abbr = text . subSequence ( 0 , 64 ) . toString ( ) + "..." ; } else { abbr = text . toString ( ) ; } if ( pos . getErrorIndex ( ) >= 0 ) { throw new DateTimeParseException ( "Text '" + abbr + "' could not be parsed at index " + pos . getErrorIndex ( ) , text , pos . getErrorIndex ( ) ) ; } else { throw new DateTimeParseException ( "Text '" + abbr + "' could not be parsed, unparsed text found at index " + pos . getIndex ( ) , text , pos . getIndex ( ) ) ; } } return context . toResolved ( resolverStyle , resolverFields ) ; |
public class SubtitleChatOverlay { /** * Update the history scrollbar with the specified value . */
protected void updateHistBar ( int val ) { } } | // we may need to figure out the new history offset amount . .
if ( ! _histOffsetFinal && _history . size ( ) > _histOffset ) { Graphics2D gfx = getTargetGraphics ( ) ; if ( gfx != null ) { figureHistoryOffset ( gfx ) ; gfx . dispose ( ) ; } } // then figure out the new value and range
int oldval = Math . max ( _histOffset , val ) ; int newmaxval = Math . max ( 0 , _history . size ( ) - 1 ) ; int newval = ( oldval >= newmaxval - 1 ) ? newmaxval : oldval ; // and set it , which MAY generate a change event , but we want to ignore it so we use the
// _ settingBar flag
_settingBar = true ; _historyModel . setRangeProperties ( newval , _historyExtent , _histOffset , newmaxval + _historyExtent , _historyModel . getValueIsAdjusting ( ) ) ; _settingBar = false ; |
public class DaisyFilter { /** * changes the color of the image - more red and less blue
* @ return new pixel array */
private int [ ] changeColor ( ) { } } | int [ ] changedPixels = new int [ pixels . length ] ; double frequenz = 2 * Math . PI / 1020 ; for ( int i = 0 ; i < pixels . length ; i ++ ) { int argb = pixels [ i ] ; int a = ( argb >> 24 ) & 0xff ; int r = ( argb >> 16 ) & 0xff ; int g = ( argb >> 8 ) & 0xff ; int b = argb & 0xff ; r = ( int ) ( 255 * Math . sin ( frequenz * r ) ) ; b = ( int ) ( - 255 * Math . cos ( frequenz * b ) + 255 ) ; changedPixels [ i ] = ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | b ; } return changedPixels ; |
public class StreamMetadataResourceImpl { /** * Implementation of createStream REST API .
* @ param scopeName The scope name of stream .
* @ param createStreamRequest The object conforming to createStream request json .
* @ param securityContext The security for API access .
* @ param asyncResponse AsyncResponse provides means for asynchronous server side response processing . */
@ Override public void createStream ( final String scopeName , final CreateStreamRequest createStreamRequest , final SecurityContext securityContext , final AsyncResponse asyncResponse ) { } } | long traceId = LoggerHelpers . traceEnter ( log , "createStream" ) ; String streamName = createStreamRequest . getStreamName ( ) ; try { NameUtils . validateUserStreamName ( streamName ) ; } catch ( IllegalArgumentException | NullPointerException e ) { log . warn ( "Create stream failed due to invalid stream name {}" , streamName ) ; asyncResponse . resume ( Response . status ( Status . BAD_REQUEST ) . build ( ) ) ; LoggerHelpers . traceLeave ( log , "createStream" , traceId ) ; return ; } try { restAuthHelper . authenticateAuthorize ( getAuthorizationHeader ( ) , AuthResourceRepresentation . ofStreamsInScope ( scopeName ) , READ_UPDATE ) ; } catch ( AuthException e ) { log . warn ( "Create stream for {} failed due to authentication failure." , streamName ) ; asyncResponse . resume ( Response . status ( Status . fromStatusCode ( e . getResponseCode ( ) ) ) . build ( ) ) ; LoggerHelpers . traceLeave ( log , "createStream" , traceId ) ; return ; } StreamConfiguration streamConfiguration = ModelHelper . getCreateStreamConfig ( createStreamRequest ) ; controllerService . createStream ( scopeName , streamName , streamConfiguration , System . currentTimeMillis ( ) ) . thenApply ( streamStatus -> { Response resp = null ; if ( streamStatus . getStatus ( ) == CreateStreamStatus . Status . SUCCESS ) { log . info ( "Successfully created stream: {}/{}" , scopeName , streamName ) ; resp = Response . status ( Status . CREATED ) . entity ( ModelHelper . encodeStreamResponse ( scopeName , streamName , streamConfiguration ) ) . build ( ) ; } else if ( streamStatus . getStatus ( ) == CreateStreamStatus . Status . STREAM_EXISTS ) { log . warn ( "Stream already exists: {}/{}" , scopeName , streamName ) ; resp = Response . status ( Status . CONFLICT ) . build ( ) ; } else if ( streamStatus . getStatus ( ) == CreateStreamStatus . Status . SCOPE_NOT_FOUND ) { log . warn ( "Scope not found: {}" , scopeName ) ; resp = Response . status ( Status . NOT_FOUND ) . build ( ) ; } else if ( streamStatus . getStatus ( ) == CreateStreamStatus . Status . INVALID_STREAM_NAME ) { log . warn ( "Invalid stream name: {}" , streamName ) ; resp = Response . status ( Status . BAD_REQUEST ) . build ( ) ; } else { log . warn ( "createStream failed for : {}/{}" , scopeName , streamName ) ; resp = Response . status ( Status . INTERNAL_SERVER_ERROR ) . build ( ) ; } return resp ; } ) . exceptionally ( exception -> { log . warn ( "createStream for {}/{} failed: " , scopeName , streamName , exception ) ; return Response . status ( Status . INTERNAL_SERVER_ERROR ) . build ( ) ; } ) . thenApply ( asyncResponse :: resume ) . thenAccept ( x -> LoggerHelpers . traceLeave ( log , "createStream" , traceId ) ) ; |
public class FieldList { /** * init . */
public void init ( Object recordOwner ) { } } | m_recordOwner = recordOwner ; if ( m_dbOpenMode == Constants . OPEN_NORMAL ) // In case it was changed in contructor ( ) and init was called after
m_dbOpenMode = Constants . OPEN_NORMAL ; if ( this . getTask ( ) != null ) m_dbOpenMode = m_dbOpenMode | this . getTask ( ) . getDefaultLockType ( this . getDatabaseType ( ) ) ; m_vFieldInfo = new Vector < Field > ( ) ; m_vKeyAreaList = new Vector < Key > ( ) ; this . setupFields ( ) ; // Add this FieldList ' s fields
this . setupKeys ( ) ; // Set up the key areas
m_dbEditMode = Constants . EDIT_NONE ; m_bIsAutoSequence = true ; |
public class MemcachedClient { /** * Get the values for multiple keys from the cache .
* @ param keys the keys
* @ return a map of the values ( for each value that exists )
* @ throws OperationTimeoutException if the global operation timeout is
* exceeded
* @ throws IllegalStateException in the rare circumstance where queue is too
* full to accept any more requests */
@ Override public Map < String , Object > getBulk ( String ... keys ) { } } | return getBulk ( Arrays . asList ( keys ) , transcoder ) ; |
public class ConversationHelperImpl { /** * Deletes a set of messages based on their IDs in the scope
* of a specific transaction .
* @ param msgIDs
* @ param tran
* @ param priority */
public void deleteMessages ( SIMessageHandle [ ] msgHandles , SITransaction tran , int priority ) throws SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException , SIResourceException , SIConnectionLostException , SILimitExceededException , SIIncorrectCallException , SIMessageNotLockedException , SIErrorException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "deleteMessages" , new Object [ ] { msgHandles , tran , priority } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) ) { CommsLightTrace . traceMessageIds ( tc , "DeleteMsgTrace" , msgHandles ) ; } if ( sessionId == 0 ) { // If the session Id = 0 , then no one called setSessionId ( ) . As such we are unable to flow
// to the server as we do not know which session to instruct the server to use .
SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "SESSION_ID_HAS_NOT_BEEN_SET_SICO1043" , null , null ) ) ; FFDCFilter . processException ( e , CLASS_NAME + ".deleteMessages" , CommsConstants . CONVERSATIONHELPERIMPL_08 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , e . getMessage ( ) , e ) ; throw e ; } if ( msgHandles == null ) { // Some null message id ' s are no good to us
SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "NULL_MESSAGE_IDS_PASSED_IN_SICO1044" , null , null ) ) ; FFDCFilter . processException ( e , CLASS_NAME + ".deleteMessages" , CommsConstants . CONVERSATIONHELPERIMPL_09 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , e . getMessage ( ) , e ) ; throw e ; } CommsByteBuffer request = getCommsByteBuffer ( ) ; // Connection object id
request . putShort ( connectionObjectId ) ; // Consumer session id
request . putShort ( sessionId ) ; // Transaction id
request . putSITransaction ( tran ) ; // Number of msgIds sent
request . putSIMessageHandles ( msgHandles ) ; // Pass on call to server - note that if we are transacted we only fire and forget .
// If not , we exchange .
if ( tran == null ) { final CommsByteBuffer reply = jfapExchange ( request , JFapChannelConstants . SEG_DELETE_SET , priority , true ) ; // Confirm appropriate data returned
try { short err = reply . getCommandCompletionCode ( JFapChannelConstants . SEG_DELETE_SET_R ) ; if ( err != CommsConstants . SI_NO_EXCEPTION ) { checkFor_SISessionUnavailableException ( reply , err ) ; checkFor_SISessionDroppedException ( reply , err ) ; checkFor_SIConnectionUnavailableException ( reply , err ) ; checkFor_SIConnectionDroppedException ( reply , err ) ; checkFor_SIConnectionLostException ( reply , err ) ; checkFor_SIResourceException ( reply , err ) ; checkFor_SILimitExceededException ( reply , err ) ; checkFor_SIIncorrectCallException ( reply , err ) ; checkFor_SIMessageNotLockedException ( reply , err ) ; checkFor_SIErrorException ( reply , err ) ; defaultChecker ( reply , err ) ; } } finally { if ( reply != null ) reply . release ( ) ; } } else { jfapSend ( request , JFapChannelConstants . SEG_DELETE_SET_NOREPLY , priority , true , ThrottlingPolicy . BLOCK_THREAD ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "deleteMessages" ) ; |
public class Field { /** * Creates a Field if it the Java Field has valid modifiers .
* @ param cl Class containing the Java field
* @ param name of the field
* @ return Field or null */
public static Field forName ( Class cl , String name ) { } } | java . lang . reflect . Field result ; try { result = cl . getDeclaredField ( name ) ; } catch ( NoSuchFieldException e ) { return null ; } return create ( result ) ; |
public class InternalContext { /** * Get a bean ' s property .
* @ param < T > bean type
* @ param bean bean
* @ param property property
* @ return value */
public < T > Object getBeanProperty ( final T bean , final Object property ) { } } | if ( bean != null ) { @ SuppressWarnings ( "unchecked" ) GetResolver < T > resolver = this . getters . unsafeGet ( bean . getClass ( ) ) ; if ( resolver != null ) { return resolver . get ( bean , property ) ; } } return this . resolverManager . get ( bean , property ) ; |
public class TextToSpeech { /** * Add custom words .
* Adds one or more words and their translations to the specified custom voice model . Adding a new translation for a
* word that already exists in a custom model overwrites the word ' s existing translation . A custom model can contain
* no more than 20,000 entries . You must use credentials for the instance of the service that owns a model to add
* words to it .
* You can define sounds - like or phonetic translations for words . A sounds - like translation consists of one or more
* words that , when combined , sound like the word . Phonetic translations are based on the SSML phoneme format for
* representing a word . You can specify them in standard International Phonetic Alphabet ( IPA ) representation
* < code > & lt ; phoneme alphabet = \ " ipa \ " ph = \ " t & # 601 ; m & # 712 ; & # 593 ; to \ " & gt ; & lt ; / phoneme & gt ; < / code >
* or in the proprietary IBM Symbolic Phonetic Representation ( SPR )
* < code > & lt ; phoneme alphabet = \ " ibm \ " ph = \ " 1gAstroEntxrYFXs \ " & gt ; & lt ; / phoneme & gt ; < / code >
* * * Note : * * This method is currently a beta release .
* * * See also : * *
* * [ Adding multiple words to a custom
* model ] ( https : / / cloud . ibm . com / docs / services / text - to - speech / custom - entries . html # cuWordsAdd )
* * [ Adding words to a Japanese custom
* model ] ( https : / / cloud . ibm . com / docs / services / text - to - speech / custom - entries . html # cuJapaneseAdd )
* * [ Understanding customization ] ( https : / / cloud . ibm . com / docs / services / text - to - speech / custom - intro . html ) .
* @ param addWordsOptions the { @ link AddWordsOptions } containing the options for the call
* @ return a { @ link ServiceCall } with a response type of Void */
public ServiceCall < Void > addWords ( AddWordsOptions addWordsOptions ) { } } | Validator . notNull ( addWordsOptions , "addWordsOptions cannot be null" ) ; String [ ] pathSegments = { "v1/customizations" , "words" } ; String [ ] pathParameters = { addWordsOptions . customizationId ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "text_to_speech" , "v1" , "addWords" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; contentJson . add ( "words" , GsonSingleton . getGson ( ) . toJsonTree ( addWordsOptions . words ( ) ) ) ; builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getVoid ( ) ) ; |
public class AbstractMessageProducer { /** * / * ( non - Javadoc )
* @ see javax . jms . MessageProducer # close ( ) */
@ Override public final void close ( ) throws JMSException { } } | externalAccessLock . readLock ( ) . lock ( ) ; try { if ( closed ) return ; closed = true ; onProducerClose ( ) ; } finally { externalAccessLock . readLock ( ) . unlock ( ) ; } |
public class TimeConverter { /** * Converts the string to a time , using the given format for parsing .
* @ param pString the string to convert .
* @ param pType the type to convert to . PropertyConverter
* implementations may choose to ignore this parameter .
* @ param pFormat the format used for parsing . PropertyConverter
* implementations may choose to ignore this parameter . Also ,
* implementations that require a parser format , should provide a default
* format , and allow { @ code null } as the format argument .
* @ return the object created from the given string . May safely be typecast
* to { @ code com . twelvemonkeys . util . Time }
* @ see com . twelvemonkeys . util . Time
* @ see com . twelvemonkeys . util . TimeFormat
* @ throws ConversionException */
public Object toObject ( String pString , Class pType , String pFormat ) throws ConversionException { } } | if ( StringUtil . isEmpty ( pString ) ) return null ; TimeFormat format ; try { if ( pFormat == null ) { // Use system default format
format = TimeFormat . getInstance ( ) ; } else { // Get format from cache
format = getTimeFormat ( pFormat ) ; } return format . parse ( pString ) ; } catch ( RuntimeException rte ) { throw new ConversionException ( rte ) ; } |
public class CmsContainerpageController { /** * Checks if the page editing features should be disabled . < p >
* @ return true if the page editing features should be disabled */
public boolean isEditingDisabled ( ) { } } | return ( m_data == null ) || CmsStringUtil . isNotEmptyOrWhitespaceOnly ( m_data . getNoEditReason ( ) ) || ( m_lockStatus == LockStatus . failed ) ; |
public class Rules { /** * Create a rule : predicate ( conditions ) = > new state ( results )
* @ param conditions conditions
* @ param key key
* @ param value value
* @ return rule */
public static Rule conditionsRule ( final Set < Condition > conditions , String key , String value ) { } } | HashMap < String , String > results = new HashMap < > ( ) ; results . put ( key , value ) ; return conditionsRule ( conditions , results ) ; |
public class ReflectUtil { /** * Get the actual type arguments a child class has used to extend a generic
* base class .
* @ param baseClass
* the base class
* @ param childClass
* the child class
* @ return a list of the raw classes for the actual type arguments . */
public static < T > List < Class < ? > > getTypeArguments ( Class < T > baseClass , Class < ? extends T > childClass ) { } } | Map < Type , Type > resolvedTypes = new HashMap < Type , Type > ( ) ; Type type = getNecessaryResolvedTypes ( baseClass , childClass , resolvedTypes ) ; // finally , for each actual type argument provided to baseClass ,
// determine ( if possible )
// the raw class for that type argument .
Type [ ] actualTypeArguments ; if ( type instanceof Class ) { actualTypeArguments = ( ( Class < ? > ) type ) . getTypeParameters ( ) ; } else { actualTypeArguments = ( ( ParameterizedType ) type ) . getActualTypeArguments ( ) ; } List < Class < ? > > typeArgumentsAsClasses = new ArrayList < Class < ? > > ( ) ; // resolve types by chasing down type variables .
for ( Type baseType : actualTypeArguments ) { while ( resolvedTypes . containsKey ( baseType ) ) { baseType = resolvedTypes . get ( baseType ) ; } typeArgumentsAsClasses . add ( getClass ( baseType ) ) ; } return typeArgumentsAsClasses ; |
public class NativeFunction { /** * Resume execution of a suspended generator .
* @ param cx The current context
* @ param scope Scope for the parent generator function
* @ param operation The resumption operation ( next , send , etc . . )
* @ param state The generator state ( has locals , stack , etc . )
* @ param value The return value of yield ( if required ) .
* @ return The next yielded value ( if any ) */
public Object resumeGenerator ( Context cx , Scriptable scope , int operation , Object state , Object value ) { } } | throw new EvaluatorException ( "resumeGenerator() not implemented" ) ; |
public class Query { /** * < pre >
* { field : < field > , regex : < pattern > , . . . }
* < / pre > */
public static Query regex ( String field , String pattern , boolean caseInsensitive , boolean extended , boolean multiline , boolean dotall ) { } } | Query q = new Query ( false ) ; q . add ( "field" , field ) . add ( "regex" , pattern ) . add ( "caseInsensitive" , caseInsensitive ) . add ( "extended" , extended ) . add ( "multiline" , multiline ) . add ( "dotall" , dotall ) ; return q ; |
public class ASTHelpers { /** * Implementation of unary numeric promotion rules .
* < p > < a href = " https : / / docs . oracle . com / javase / specs / jls / se9 / html / jls - 5 . html # jls - 5.6.1 " > JLS
* § 5.6.1 < / a > */
@ Nullable private static Type unaryNumericPromotion ( Type type , VisitorState state ) { } } | Type unboxed = unboxAndEnsureNumeric ( type , state ) ; switch ( unboxed . getTag ( ) ) { case BYTE : case SHORT : case CHAR : return state . getSymtab ( ) . intType ; case INT : case LONG : case FLOAT : case DOUBLE : return unboxed ; default : throw new AssertionError ( "Should not reach here: " + type ) ; } |
public class Menus { /** * Set up the screen input fields . */
public void setupFields ( ) { } } | FieldInfo field = null ; field = new FieldInfo ( this , ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field . setDataClass ( Integer . class ) ; field . setHidden ( true ) ; field = new FieldInfo ( this , LAST_CHANGED , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field . setDataClass ( Date . class ) ; field . setHidden ( true ) ; field = new FieldInfo ( this , DELETED , 10 , null , new Boolean ( false ) ) ; field . setDataClass ( Boolean . class ) ; field . setHidden ( true ) ; field = new FieldInfo ( this , NAME , 50 , null , null ) ; field = new FieldInfo ( this , PARENT_FOLDER_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field . setDataClass ( Integer . class ) ; field = new FieldInfo ( this , SEQUENCE , 5 , null , new Short ( ( short ) 0 ) ) ; field . setDataClass ( Short . class ) ; field = new FieldInfo ( this , COMMENT , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field = new FieldInfo ( this , CODE , 30 , null , null ) ; field = new FieldInfo ( this , TYPE , 10 , null , null ) ; field = new FieldInfo ( this , AUTO_DESC , 10 , null , new Boolean ( true ) ) ; field . setDataClass ( Boolean . class ) ; field = new FieldInfo ( this , PROGRAM , 255 , null , null ) ; field = new FieldInfo ( this , PARAMS , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field = new FieldInfo ( this , ICON_RESOURCE , 255 , null , null ) ; field = new FieldInfo ( this , KEYWORDS , 50 , null , null ) ; field = new FieldInfo ( this , XML_DATA , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field = new FieldInfo ( this , MENUS_HELP , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; |
public class WebServiceTemplateBuilder { /** * Set { @ link WebServiceTemplateCustomizer WebServiceTemplateCustomizers } that should
* be applied to the { @ link WebServiceTemplate } . Customizers are applied in the order
* that they were added after builder configuration has been applied . Setting this
* value will replace any previously configured customizers .
* @ param customizers the customizers to set
* @ return a new builder instance
* @ see # additionalCustomizers ( WebServiceTemplateCustomizer . . . ) */
public WebServiceTemplateBuilder customizers ( WebServiceTemplateCustomizer ... customizers ) { } } | Assert . notNull ( customizers , "Customizers must not be null" ) ; return customizers ( Arrays . asList ( customizers ) ) ; |
public class AWSXRayClient { /** * Updates the encryption configuration for X - Ray data .
* @ param putEncryptionConfigRequest
* @ return Result of the PutEncryptionConfig operation returned by the service .
* @ throws InvalidRequestException
* The request is missing required parameters or has invalid parameters .
* @ throws ThrottledException
* The request exceeds the maximum number of requests per second .
* @ sample AWSXRay . PutEncryptionConfig
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / xray - 2016-04-12 / PutEncryptionConfig " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public PutEncryptionConfigResult putEncryptionConfig ( PutEncryptionConfigRequest request ) { } } | request = beforeClientExecution ( request ) ; return executePutEncryptionConfig ( request ) ; |
public class SharedObjectService { /** * { @ inheritDoc } */
public boolean createSharedObject ( IScope scope , String name , boolean persistent ) { } } | boolean added = hasSharedObject ( scope , name ) ; if ( ! added ) { log . debug ( "Attempting to add shared object: {} to {}" , name , scope . getName ( ) ) ; added = scope . addChildScope ( new SharedObjectScope ( scope , name , persistent , getStore ( scope , persistent ) ) ) ; if ( ! added ) { added = hasSharedObject ( scope , name ) ; log . debug ( "Add failed on create, shared object already exists: {}" , added ) ; } } else { // the shared object already exists
log . trace ( "Shared object ({}) already exists. Persistent: {}" , name , persistent ) ; } // added or already existing will be true
return added ; |
public class V1ListenersModel { /** * { @ inheritDoc } */
@ Override public ListenersModel addListener ( ListenerModel listener ) { } } | addChildModel ( listener ) ; _listeners . add ( listener ) ; return this ; |
public class VLLcpMonotoneMinimalPerfectHashFunction { /** * Returns the number of bits used by this structure .
* @ return the number of bits used by this structure . */
public long numBits ( ) { } } | if ( n == 0 ) return 0 ; return offsets . size64 ( ) * log2BucketSize + lcpLengths . numBits ( ) + lcp2Bucket . numBits ( ) + mph . numBits ( ) + transform . numBits ( ) ; |
public class ServiceResolver { /** * This method identifies a service implementation that implements
* the supplied interface , and returns it as a singleton , so that subsequent
* calls for the same service will get the same instance .
* @ param intf The interface
* @ return The service , or null if not found
* @ param < T > The service interface */
@ SuppressWarnings ( "unchecked" ) public static < T > T getSingletonService ( Class < T > intf ) { } } | T ret = null ; synchronized ( singletons ) { if ( singletons . containsKey ( intf ) ) { ret = ( T ) singletons . get ( intf ) ; } else { List < T > services = getServices ( intf ) ; if ( ! services . isEmpty ( ) ) { ret = services . get ( 0 ) ; } singletons . put ( intf , ret ) ; } } return ret ; |
public class SystemJarFinder { /** * Add and search a JRE path .
* @ param dir
* the JRE directory
* @ return true if the directory was readable . */
private static boolean addJREPath ( final File dir ) { } } | if ( dir != null && ! dir . getPath ( ) . isEmpty ( ) && FileUtils . canRead ( dir ) && dir . isDirectory ( ) ) { final File [ ] dirFiles = dir . listFiles ( ) ; if ( dirFiles != null ) { for ( final File file : dirFiles ) { final String filePath = file . getPath ( ) ; if ( filePath . endsWith ( ".jar" ) ) { final String jarPathResolved = FastPathResolver . resolve ( FileUtils . CURR_DIR_PATH , filePath ) ; if ( jarPathResolved . endsWith ( "/rt.jar" ) ) { RT_JARS . add ( jarPathResolved ) ; } else { JRE_LIB_OR_EXT_JARS . add ( jarPathResolved ) ; } try { final File canonicalFile = file . getCanonicalFile ( ) ; final String canonicalFilePath = canonicalFile . getPath ( ) ; if ( ! canonicalFilePath . equals ( filePath ) ) { final String canonicalJarPathResolved = FastPathResolver . resolve ( FileUtils . CURR_DIR_PATH , filePath ) ; JRE_LIB_OR_EXT_JARS . add ( canonicalJarPathResolved ) ; } } catch ( IOException | SecurityException e ) { // Ignored
} } } return true ; } } return false ; |
public class RedBlackTreeLong { /** * Remove the node containing the given key and element . The node MUST exists , else the tree won ' t be valid anymore . */
@ Override public void removeInstance ( long key , T instance ) { } } | if ( first . value == key && instance == first . element ) { removeMin ( ) ; return ; } if ( last . value == key && instance == last . element ) { removeMax ( ) ; return ; } // if both children of root are black , set root to red
if ( ( root . left == null || ! root . left . red ) && ( root . right == null || ! root . right . red ) ) root . red = true ; root = removeInstance ( root , key , instance ) ; if ( root != null ) root . red = false ; |
public class JobInfoPrintUtils { /** * Print properties of a specific job
* @ param jobExecutionInfoOptional */
public static void printJobProperties ( Optional < JobExecutionInfo > jobExecutionInfoOptional ) { } } | if ( ! jobExecutionInfoOptional . isPresent ( ) ) { System . err . println ( "Job not found." ) ; return ; } List < List < String > > data = new ArrayList < > ( ) ; List < String > flags = Arrays . asList ( "" , "-" ) ; List < String > labels = Arrays . asList ( "Property Key" , "Property Value" ) ; for ( Map . Entry < String , String > entry : jobExecutionInfoOptional . get ( ) . getJobProperties ( ) . entrySet ( ) ) { data . add ( Arrays . asList ( entry . getKey ( ) , entry . getValue ( ) ) ) ; } new CliTablePrinter . Builder ( ) . labels ( labels ) . data ( data ) . flags ( flags ) . delimiterWidth ( 2 ) . build ( ) . printTable ( ) ; |
public class LinearModel { /** * 加载模型
* @ param modelFile
* @ throws IOException */
public void load ( String modelFile ) throws IOException { } } | if ( HanLP . Config . DEBUG ) logger . start ( "加载 %s ... " , modelFile ) ; ByteArrayStream byteArray = ByteArrayStream . createByteArrayStream ( modelFile ) ; if ( ! load ( byteArray ) ) { throw new IOException ( String . format ( "%s 加载失败" , modelFile ) ) ; } if ( HanLP . Config . DEBUG ) logger . finish ( " 加载完毕\n" ) ; |
public class ServerView { /** * Creates the columns for the view */
@ Override public void createPartControl ( Composite parent ) { } } | Tree main = new Tree ( parent , SWT . SINGLE | SWT . FULL_SELECTION | SWT . H_SCROLL | SWT . V_SCROLL ) ; main . setHeaderVisible ( true ) ; main . setLinesVisible ( false ) ; main . setLayoutData ( new GridData ( GridData . FILL_BOTH ) ) ; TreeColumn serverCol = new TreeColumn ( main , SWT . SINGLE ) ; serverCol . setText ( "Location" ) ; serverCol . setWidth ( 300 ) ; serverCol . setResizable ( true ) ; TreeColumn locationCol = new TreeColumn ( main , SWT . SINGLE ) ; locationCol . setText ( "Master node" ) ; locationCol . setWidth ( 185 ) ; locationCol . setResizable ( true ) ; TreeColumn stateCol = new TreeColumn ( main , SWT . SINGLE ) ; stateCol . setText ( "State" ) ; stateCol . setWidth ( 95 ) ; stateCol . setResizable ( true ) ; TreeColumn statusCol = new TreeColumn ( main , SWT . SINGLE ) ; statusCol . setText ( "Status" ) ; statusCol . setWidth ( 300 ) ; statusCol . setResizable ( true ) ; viewer = new TreeViewer ( main ) ; viewer . setContentProvider ( this ) ; viewer . setLabelProvider ( this ) ; viewer . setInput ( CONTENT_ROOT ) ; // don ' t care
getViewSite ( ) . setSelectionProvider ( viewer ) ; getViewSite ( ) . getActionBars ( ) . setGlobalActionHandler ( ActionFactory . DELETE . getId ( ) , deleteAction ) ; getViewSite ( ) . getActionBars ( ) . getToolBarManager ( ) . add ( editServerAction ) ; getViewSite ( ) . getActionBars ( ) . getToolBarManager ( ) . add ( newLocationAction ) ; createActions ( ) ; createContextMenu ( ) ; |
public class BoxAPIResponse { /** * Gets the value of the given header field .
* @ param fieldName name of the header field .
* @ return value of the header . */
public String getHeaderField ( String fieldName ) { } } | // headers map is null for all regular response calls except when made as a batch request
if ( this . headers == null ) { if ( this . connection != null ) { return this . connection . getHeaderField ( fieldName ) ; } else { return null ; } } else { return this . headers . get ( fieldName ) ; } |
public class InnerRankUpdate_DDRB { /** * Rank N update function for a symmetric inner submatrix and only operates on the upper
* triangular portion of the submatrix . < br >
* < br >
* A = A - B < sup > T < / sup > B */
public static void symmRankNMinus_U ( int blockLength , DSubmatrixD1 A , DSubmatrixD1 B ) { } } | int heightB = B . row1 - B . row0 ; if ( heightB > blockLength ) throw new IllegalArgumentException ( "Height of B cannot be greater than the block length" ) ; int N = B . col1 - B . col0 ; if ( A . col1 - A . col0 != N ) throw new IllegalArgumentException ( "A does not have the expected number of columns based on B's width" ) ; if ( A . row1 - A . row0 != N ) throw new IllegalArgumentException ( "A does not have the expected number of rows based on B's width" ) ; for ( int i = B . col0 ; i < B . col1 ; i += blockLength ) { int indexB_i = B . row0 * B . original . numCols + i * heightB ; int widthB_i = Math . min ( blockLength , B . col1 - i ) ; int rowA = i - B . col0 + A . row0 ; int heightA = Math . min ( blockLength , A . row1 - rowA ) ; for ( int j = i ; j < B . col1 ; j += blockLength ) { int widthB_j = Math . min ( blockLength , B . col1 - j ) ; int indexA = rowA * A . original . numCols + ( j - B . col0 + A . col0 ) * heightA ; int indexB_j = B . row0 * B . original . numCols + j * heightB ; if ( i == j ) { // only the upper portion of this block needs to be modified since it is along a diagonal
multTransABlockMinus_U ( B . original . data , A . original . data , indexB_i , indexB_j , indexA , heightB , widthB_i , widthB_j ) ; } else { multTransABlockMinus ( B . original . data , A . original . data , indexB_i , indexB_j , indexA , heightB , widthB_i , widthB_j ) ; } } } |
public class XtraBox { /** * Removes and recreates tag using specified Date value
* @ param name Tag name to replace
* @ param date New Date value */
public void setTagValue ( String name , Date date ) { } } | removeTag ( name ) ; XtraTag tag = new XtraTag ( name ) ; tag . values . addElement ( new XtraValue ( date ) ) ; tags . addElement ( tag ) ; |
public class GpsMyLocationProvider { /** * Enable location updates and show your current location on the map . By default this will
* request location updates as frequently as possible , but you can change the frequency and / or
* distance by calling { @ link # setLocationUpdateMinTime } and / or { @ link
* # setLocationUpdateMinDistance } before calling this method . */
@ SuppressLint ( "MissingPermission" ) @ Override public boolean startLocationProvider ( IMyLocationConsumer myLocationConsumer ) { } } | mMyLocationConsumer = myLocationConsumer ; boolean result = false ; for ( final String provider : mLocationManager . getProviders ( true ) ) { if ( locationSources . contains ( provider ) ) { try { mLocationManager . requestLocationUpdates ( provider , mLocationUpdateMinTime , mLocationUpdateMinDistance , this ) ; result = true ; } catch ( Throwable ex ) { Log . e ( IMapView . LOGTAG , "Unable to attach listener for location provider " + provider + " check permissions?" , ex ) ; } } } return result ; |
public class CombineFileRecordReader { /** * return progress based on the amount of data processed so far . */
public float getProgress ( ) throws IOException { } } | long subprogress = 0 ; // bytes processed in current split
if ( null != curReader ) { // idx is always one past the current subsplit ' s true index .
subprogress = ( long ) ( curReader . getProgress ( ) * split . getLength ( idx - 1 ) ) ; } return Math . min ( 1.0f , ( progress + subprogress ) / ( float ) ( split . getLength ( ) ) ) ; |
public class BaseLevel { /** * This function checks the levels nodes and child nodes to see if it can match a spec topic for a topic database id .
* @ param targetId The topic database id
* @ param callerNode The node that called this function so that it isn ' t rechecked
* @ param checkParentNode If the function should check the levels parents as well
* @ return The closest available SpecTopic that matches the DBId otherwise null . */
public SpecNode getClosestSpecNodeByTargetId ( final String targetId , final SpecNode callerNode , final boolean checkParentNode ) { } } | final SpecNode retValue = super . getClosestSpecNodeByTargetId ( targetId , callerNode , checkParentNode ) ; if ( retValue != null ) { return retValue ; } else { // Look up the metadata topics
final ContentSpec contentSpec = getContentSpec ( ) ; for ( final Node contentSpecNode : contentSpec . getNodes ( ) ) { if ( contentSpecNode instanceof KeyValueNode && ( ( KeyValueNode ) contentSpecNode ) . getValue ( ) instanceof SpecTopic ) { final SpecTopic childTopic = ( SpecTopic ) ( ( KeyValueNode ) contentSpecNode ) . getValue ( ) ; if ( childTopic . getTargetId ( ) != null && childTopic . getTargetId ( ) . equals ( targetId ) ) { return childTopic ; } } } return null ; } |
public class BasePanel { /** * Push this command onto the history stack .
* @ param strHistory The history command to push onto the stack . */
public void pushHistory ( String strHistory , boolean bPushToBrowser ) { } } | if ( m_vHistory == null ) m_vHistory = new Vector < String > ( ) ; m_vHistory . addElement ( strHistory ) ; String strHelp = Utility . fixDisplayURL ( strHistory , true , true , true , this ) ; if ( this . getAppletScreen ( ) != null ) if ( this . getAppletScreen ( ) . getScreenFieldView ( ) != null ) this . getAppletScreen ( ) . getScreenFieldView ( ) . showDocument ( strHelp , MenuConstants . HELP_WINDOW_CHANGE ) ; if ( bPushToBrowser ) if ( this . getAppletScreen ( ) != null ) if ( this . getAppletScreen ( ) . getTask ( ) instanceof BaseAppletReference ) ( ( BaseAppletReference ) this . getAppletScreen ( ) . getTask ( ) ) . pushBrowserHistory ( strHistory , this . getTitle ( ) , bPushToBrowser ) ; // Let browser know about the new screen |
public class HandlablesImpl { /** * Add object parent super type .
* @ param object The current object to check .
* @ param type The current class level to check . */
private void addSuperClass ( Object object , Class < ? > type ) { } } | for ( final Class < ? > types : type . getInterfaces ( ) ) { addType ( types , object ) ; } final Class < ? > parent = type . getSuperclass ( ) ; if ( parent != null ) { addSuperClass ( object , parent ) ; } |
public class AWSCognitoIdentityProviderClient { /** * Lists the user pools associated with an AWS account .
* @ param listUserPoolsRequest
* Represents the request to list user pools .
* @ return Result of the ListUserPools operation returned by the service .
* @ throws InvalidParameterException
* This exception is thrown when the Amazon Cognito service encounters an invalid parameter .
* @ throws TooManyRequestsException
* This exception is thrown when the user has made too many requests for a given operation .
* @ throws NotAuthorizedException
* This exception is thrown when a user is not authorized .
* @ throws InternalErrorException
* This exception is thrown when Amazon Cognito encounters an internal error .
* @ sample AWSCognitoIdentityProvider . ListUserPools
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cognito - idp - 2016-04-18 / ListUserPools " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ListUserPoolsResult listUserPools ( ListUserPoolsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListUserPools ( request ) ; |
public class ModeOfInheritance { /** * Get all the de novo variants identified for the proband .
* @ param member Child proband .
* @ param variantIterator Variant iterator .
* @ return A list of variants . */
public static List < Variant > deNovoVariants ( Member member , Iterator < Variant > variantIterator ) { } } | List < Variant > variantList = new ArrayList < > ( ) ; while ( variantIterator . hasNext ( ) ) { Variant variant = variantIterator . next ( ) ; if ( isDeNovoVariant ( member , variant ) ) { variantList . add ( variant ) ; } } return variantList ; |
public class XBELValidator { /** * { @ inheritDoc } */
@ Override public void validate ( final File f ) throws SAXException , IOException { } } | validate ( utf8SourceForFile ( f ) , null ) ; |
public class Geoshape { /** * Returns the point at the given position . The position must be smaller than { @ link # size ( ) } .
* @ param position
* @ return */
public Point getPoint ( int position ) { } } | if ( position < 0 || position >= size ( ) ) throw new ArrayIndexOutOfBoundsException ( "Invalid position: " + position ) ; return new Point ( coordinates [ 0 ] [ position ] , coordinates [ 1 ] [ position ] ) ; |
public class JvmTypesBuilder { /** * / * @ Nullable */
@ Deprecated public JvmAnnotationReference toAnnotation ( /* @ Nullable */
EObject sourceElement , /* @ Nullable */
String annotationTypeName ) { } } | return toAnnotation ( sourceElement , annotationTypeName , null ) ; |
public class JimfsFileStore { /** * Returns an attribute view of the given type for the given file lookup callback , or { @ code null }
* if the view type is not supported . */
@ Nullable < V extends FileAttributeView > V getFileAttributeView ( FileLookup lookup , Class < V > type ) { } } | state . checkOpen ( ) ; return attributes . getFileAttributeView ( lookup , type ) ; |
public class Network { /** * Create connections between a single switch and multiple physical elements
* @ param bandwidth the maximal bandwidth for the connection
* @ param sw the switch to connect
* @ param pelts a list of physical elements to connect
* @ return a list of links */
public List < Link > connect ( int bandwidth , Switch sw , PhysicalElement ... pelts ) { } } | List < Link > l = new ArrayList < > ( ) ; for ( PhysicalElement pe : pelts ) { l . add ( connect ( bandwidth , sw , pe ) ) ; } return l ; |
public class PostConditionException { /** * Validates that the value is greater than a limit .
* This method ensures that < code > value > limit < / code > .
* @ param identifier The name of the object .
* @ param limit The limit that the value must exceed .
* @ param value The value to be tested .
* @ throws PostConditionException if the condition is not met . */
public static void validateGreaterThan ( long value , long limit , String identifier ) throws PostConditionException { } } | if ( value > limit ) { return ; } throw new PostConditionException ( identifier + " was not greater than " + limit + ". Was: " + value ) ; |
public class CodeGenerator { /** * Generates the main class used for creating the extractor objects and later generating the insert statements .
* For each passed table a appropriate creation method will be generated that will return the new object and internally add it to the list of objects that
* will be used to generate the insert strings
* @ param tables All tables that should get a creation method in the main class
* @ param enableVisualizationSupport If { @ code true } , the RedG visualization features will be enabled for the generated code . This will result in a small
* performance hit and slightly more memory usage if activated .
* @ return The generated source code */
public String generateMainClass ( final Collection < TableModel > tables , final boolean enableVisualizationSupport ) { } } | Objects . requireNonNull ( tables ) ; // get package from the table models
final String targetPackage = ( ( TableModel ) tables . toArray ( ) [ 0 ] ) . getPackageName ( ) ; final ST template = this . stGroup . getInstanceOf ( "mainClass" ) ; LOG . debug ( "Filling main class template containing helpers for {} classes..." , tables . size ( ) ) ; template . add ( "package" , targetPackage ) ; // TODO : make prefix usable
template . add ( "prefix" , "" ) ; template . add ( "enableVisualizationSupport" , enableVisualizationSupport ) ; LOG . debug ( "Package is {} | Prefix is {}" , targetPackage , "" ) ; template . add ( "tables" , tables ) ; return template . render ( ) ; |
public class TargetTrackingConfigurationMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TargetTrackingConfiguration targetTrackingConfiguration , ProtocolMarshaller protocolMarshaller ) { } } | if ( targetTrackingConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( targetTrackingConfiguration . getPredefinedScalingMetricSpecification ( ) , PREDEFINEDSCALINGMETRICSPECIFICATION_BINDING ) ; protocolMarshaller . marshall ( targetTrackingConfiguration . getCustomizedScalingMetricSpecification ( ) , CUSTOMIZEDSCALINGMETRICSPECIFICATION_BINDING ) ; protocolMarshaller . marshall ( targetTrackingConfiguration . getTargetValue ( ) , TARGETVALUE_BINDING ) ; protocolMarshaller . marshall ( targetTrackingConfiguration . getDisableScaleIn ( ) , DISABLESCALEIN_BINDING ) ; protocolMarshaller . marshall ( targetTrackingConfiguration . getScaleOutCooldown ( ) , SCALEOUTCOOLDOWN_BINDING ) ; protocolMarshaller . marshall ( targetTrackingConfiguration . getScaleInCooldown ( ) , SCALEINCOOLDOWN_BINDING ) ; protocolMarshaller . marshall ( targetTrackingConfiguration . getEstimatedInstanceWarmup ( ) , ESTIMATEDINSTANCEWARMUP_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class RuleBasedCollator { /** * Sets the orders of lower cased characters to sort before upper cased characters , in strength TERTIARY . The
* default mode is false . If true is set , the RuleBasedCollator will sort lower cased characters before the upper
* cased ones . Otherwise , if false is set , the RuleBasedCollator will ignore case preferences .
* @ param lowerfirst
* true for sorting lower cased characters before upper cased characters , false to ignore case
* preferences .
* @ see # isLowerCaseFirst
* @ see # isUpperCaseFirst
* @ see # setUpperCaseFirst
* @ see # setCaseFirstDefault */
public void setLowerCaseFirst ( boolean lowerfirst ) { } } | checkNotFrozen ( ) ; if ( lowerfirst == isLowerCaseFirst ( ) ) { return ; } CollationSettings ownedSettings = getOwnedSettings ( ) ; ownedSettings . setCaseFirst ( lowerfirst ? CollationSettings . CASE_FIRST : 0 ) ; setFastLatinOptions ( ownedSettings ) ; |
public class FilterTargetData { /** * Create a string containing all the tags from method and class annotations
* @ param mAnnotation Method annotation
* @ param cAnnotation Class annotation
* @ return The string of tags */
private static String mergeTags ( ProbeTest mAnnotation , ProbeTestClass cAnnotation ) { } } | List < String > tags = new ArrayList < > ( ) ; if ( mAnnotation != null ) { tags . addAll ( Arrays . asList ( mAnnotation . tags ( ) ) ) ; } if ( cAnnotation != null ) { tags . addAll ( Arrays . asList ( cAnnotation . tags ( ) ) ) ; } return Arrays . toString ( tags . toArray ( new String [ tags . size ( ) ] ) ) ; |
public class JPAAuditLogService { /** * / * ( non - Javadoc )
* @ see org . jbpm . process . audit . AuditLogService # findNodeInstances ( long , java . lang . String ) */
@ Override public List < NodeInstanceLog > findNodeInstances ( long processInstanceId , String nodeId ) { } } | EntityManager em = getEntityManager ( ) ; Query query = em . createQuery ( "FROM NodeInstanceLog n WHERE n.processInstanceId = :processInstanceId AND n.nodeId = :nodeId ORDER BY date,id" ) . setParameter ( "processInstanceId" , processInstanceId ) . setParameter ( "nodeId" , nodeId ) ; return executeQuery ( query , em , NodeInstanceLog . class ) ; |
public class SimpleDistanceConstraint { /** * Remove an [ lb , ub ] interval between the two { @ link TimePoint } s of this constraint .
* @ param i The interval to remove .
* @ return { @ code true } if the interval was removed , { @ code false } if this was
* an attempt to remove the active constraint . */
public boolean removeInterval ( Bounds i ) { } } | if ( bs . remove ( i ) ) { Bounds intersection = new Bounds ( 0 , APSPSolver . INF ) ; for ( Bounds toIntersect : bs ) { // intersection = intervalIntersect ( intersection , toIntersect ) ; / / intervalIntersect ( intersection , inter ) ;
intersection = intersection . intersect ( toIntersect ) ; } minimum = intersection . min ; maximum = intersection . max ; return true ; } return false ; |
public class DataStoreScanStatusDAO { /** * For grandfathered in ScanStatuses that did not include a startTime attribute extrapolate it as the earliest
* time a scan range was queued . */
private Date extrapolateStartTimeFromScanRanges ( List < ScanRangeStatus > pendingScanRanges , List < ScanRangeStatus > activeScanRanges , List < ScanRangeStatus > completeScanRanges ) { } } | Date startTime = null ; for ( ScanRangeStatus status : Iterables . concat ( pendingScanRanges , activeScanRanges , completeScanRanges ) ) { Date queuedTime = status . getScanQueuedTime ( ) ; if ( queuedTime != null && ( startTime == null || queuedTime . before ( startTime ) ) ) { startTime = queuedTime ; } } if ( startTime == null ) { // Either the scan contained no scan ranges or no scans were ever queued , neither of which is likely to
// ever happen . But , so we don ' t return null choose a reasonably old date .
startTime = new Date ( 0 ) ; } return startTime ; |
public class SQLExpressions { /** * Create a new detached SQLQuery instance with the given projection
* @ param exprs distinct projection
* @ return select ( distinct exprs ) */
public static SQLQuery < Tuple > selectDistinct ( Expression < ? > ... exprs ) { } } | return new SQLQuery < Void > ( ) . select ( exprs ) . distinct ( ) ; |
public class LabelProcessor { /** * Get the first label found in the label type . This is independent of the language of the label .
* @ param label the label type which is searched for the first label
* @ return the first label found
* @ throws NotAvailableException if now label is contained in the label type . */
public static String getFirstLabel ( final LabelOrBuilder label ) throws NotAvailableException { } } | for ( Label . MapFieldEntry entry : label . getEntryList ( ) ) { for ( String value : entry . getValueList ( ) ) { return value ; } } throw new NotAvailableException ( "Label" ) ; |
public class GeneratorsNameUtil { /** * Return the name of the HTML property to use for a given java { @ link Prop } field .
* @ param propName The name of the Java { @ link Prop }
* @ return The name of the HTML attribute to use for that prop */
public static String propNameToAttributeName ( String propName ) { } } | return CaseFormat . UPPER_CAMEL . to ( CaseFormat . LOWER_HYPHEN , propName ) . toLowerCase ( ) ; |
public class ReplicationInternal { /** * Set Extra HTTP headers to be sent in all requests to the remote server . */
@ InterfaceAudience . Public public void setHeaders ( Map < String , Object > requestHeadersParam ) { } } | if ( requestHeadersParam != null && ! requestHeaders . equals ( requestHeadersParam ) ) { requestHeaders = requestHeadersParam ; } |
public class MemcachedSessionService { /** * Check if the given session id does not belong to this tomcat ( according to the
* local jvmRoute and the jvmRoute in the session id ) . If the session contains a
* different jvmRoute load if from memcached . If the session was found in memcached and
* if it ' s valid it must be associated with this tomcat and therefore the session id has to
* be changed . The new session id must be returned if it was changed .
* This is only useful for sticky sessions , in non - sticky operation mode < code > null < / code > should
* always be returned .
* @ param requestedSessionId
* the sessionId that was requested .
* @ return the new session id if the session is taken over and the id was changed .
* Otherwise < code > null < / code > .
* @ see Request # getRequestedSessionId ( ) */
public String changeSessionIdOnTomcatFailover ( final String requestedSessionId ) { } } | if ( ! _sticky ) { return null ; } final String localJvmRoute = _manager . getJvmRoute ( ) ; if ( localJvmRoute != null && ! localJvmRoute . equals ( getSessionIdFormat ( ) . extractJvmRoute ( requestedSessionId ) ) ) { // the session might already be relocated , e . g . if some ajax calls are running concurrently .
// if we ' d run session takeover again , a new empty session would be created .
// see https : / / github . com / magro / memcached - session - manager / issues / 282
final String newSessionId = _memcachedNodesManager . changeSessionIdForTomcatFailover ( requestedSessionId , _manager . getJvmRoute ( ) ) ; if ( _manager . getSessionInternal ( newSessionId ) != null ) { return newSessionId ; } // the session might have been loaded already ( by some valve ) , so let ' s check our session map
MemcachedBackupSession session = _manager . getSessionInternal ( requestedSessionId ) ; if ( session == null ) { session = loadFromMemcachedWithCheck ( requestedSessionId ) ; } // checking valid ( ) can expire ( ) the session !
if ( session != null && session . isValid ( ) ) { return handleSessionTakeOver ( session ) ; } else if ( _manager . getSessionInternal ( newSessionId ) != null ) { return newSessionId ; } } return null ; |
public class PdfCell { /** * Gets the lines of a cell that can be drawn between certain limits .
* Remark : all the lines that can be drawn are removed from the object !
* @ paramtopthe top of the part of the table that can be drawn
* @ parambottomthe bottom of the part of the table that can be drawn
* @ returnan < CODE > ArrayList < / CODE > of < CODE > PdfLine < / CODE > s */
public ArrayList getLines ( float top , float bottom ) { } } | float lineHeight ; float currentPosition = Math . min ( getTop ( ) , top ) ; setTop ( currentPosition + cellspacing ) ; ArrayList result = new ArrayList ( ) ; // if the bottom of the page is higher than the top of the cell : do nothing
if ( getTop ( ) < bottom ) { return result ; } // we loop over the lines
int size = lines . size ( ) ; boolean aboveBottom = true ; for ( int i = 0 ; i < size && aboveBottom ; i ++ ) { line = ( PdfLine ) lines . get ( i ) ; lineHeight = line . height ( ) ; currentPosition -= lineHeight ; // if the currentPosition is higher than the bottom , we add the line to the result
if ( currentPosition > ( bottom + cellpadding + getBorderWidthInside ( BOTTOM ) ) ) { result . add ( line ) ; } else { aboveBottom = false ; } } // if the bottom of the cell is higher than the bottom of the page , the cell is written , so we can remove all lines
float difference = 0f ; if ( ! header ) { if ( aboveBottom ) { lines = new ArrayList ( ) ; contentHeight = 0f ; } else { size = result . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { line = removeLine ( 0 ) ; difference += line . height ( ) ; } } } if ( difference > 0 ) { Image image ; for ( Iterator i = images . iterator ( ) ; i . hasNext ( ) ; ) { image = ( Image ) i . next ( ) ; image . setAbsolutePosition ( image . getAbsoluteX ( ) , image . getAbsoluteY ( ) - difference - leading ) ; } } return result ; |
public class CategoryMap { /** * Add a category to the config map . */
final void put ( final String name , final LoggerConfig value ) { } } | LoggerConfig config = categories . get ( name ) ; if ( config != null ) { config . merge ( value ) ; } else { categories . put ( name , value ) ; } |
public class WebContainer { /** * Servlet 4.0 */
@ Reference ( cardinality = ReferenceCardinality . MANDATORY , policy = ReferencePolicy . DYNAMIC , policyOption = ReferencePolicyOption . GREEDY ) protected void setURIMatcherFactory ( URIMatcherFactory factory ) { } } | uriMatcherFactory = factory ; |
public class OidcLoginConfigImpl { /** * { @ inheritDoc } */
@ Override public ConsumerUtils getConsumerUtils ( ) { } } | if ( consumerUtils == null ) { // lazy init
SocialLoginService socialLoginService = socialLoginServiceRef . getService ( ) ; if ( socialLoginService != null ) { consumerUtils = new ConsumerUtils ( socialLoginService . getKeyStoreServiceRef ( ) ) ; } else { Tr . warning ( tc , "SERVICE_NOT_FOUND_JWT_CONSUMER_NOT_AVAILABLE" , new Object [ ] { uniqueId } ) ; } } return consumerUtils ; |
public class V8ScriptRunner { /** * Convert a Java object to a V8 object . Register all methods of the
* Java object as functions in the created V8 object .
* @ param o the Java object
* @ return the V8 object */
private V8Object convertJavaObject ( Object o ) { } } | V8Object v8o = new V8Object ( runtime ) ; Method [ ] methods = o . getClass ( ) . getMethods ( ) ; for ( Method m : methods ) { v8o . registerJavaMethod ( o , m . getName ( ) , m . getName ( ) , m . getParameterTypes ( ) ) ; } return v8o ; |
public class NaaccrXmlDictionaryUtils { /** * Extracts the NAACCR version from an internal dictionary URI .
* @ param uri internal dictionary URI
* @ return the corresponding NAACCR version , null if it can ' t be extracted */
public static String extractVersionFromUri ( String uri ) { } } | if ( uri == null ) return null ; Matcher matcher = BASE_DICTIONARY_URI_PATTERN . matcher ( uri ) ; if ( matcher . matches ( ) ) return matcher . group ( 1 ) ; else { matcher = DEFAULT_USER_DICTIONARY_URI_PATTERN . matcher ( uri ) ; if ( matcher . matches ( ) ) return matcher . group ( 1 ) ; } return null ; |
public class HTMLReport { /** * Write string
* @ param fw The file writer
* @ param s The string
* @ exception Exception If an error occurs */
static void writeString ( FileWriter fw , String s ) throws Exception { } } | for ( int i = 0 ; i < s . length ( ) ; i ++ ) { fw . write ( ( int ) s . charAt ( i ) ) ; } |
public class LinkedBlockingQueue { /** * Returns an array containing all of the elements in this queue , in
* proper sequence ; the runtime type of the returned array is that of
* the specified array . If the queue fits in the specified array , it
* is returned therein . Otherwise , a new array is allocated with the
* runtime type of the specified array and the size of this queue .
* < p > If this queue fits in the specified array with room to spare
* ( i . e . , the array has more elements than this queue ) , the element in
* the array immediately following the end of the queue is set to
* { @ code null } .
* < p > Like the { @ link # toArray ( ) } method , this method acts as bridge between
* array - based and collection - based APIs . Further , this method allows
* precise control over the runtime type of the output array , and may ,
* under certain circumstances , be used to save allocation costs .
* < p > Suppose { @ code x } is a queue known to contain only strings .
* The following code can be used to dump the queue into a newly
* allocated array of { @ code String } :
* < pre > { @ code String [ ] y = x . toArray ( new String [ 0 ] ) ; } < / pre >
* Note that { @ code toArray ( new Object [ 0 ] ) } is identical in function to
* { @ code toArray ( ) } .
* @ param a the array into which the elements of the queue are to
* be stored , if it is big enough ; otherwise , a new array of the
* same runtime type is allocated for this purpose
* @ return an array containing all of the elements in this queue
* @ throws ArrayStoreException if the runtime type of the specified array
* is not a supertype of the runtime type of every element in
* this queue
* @ throws NullPointerException if the specified array is null */
@ SuppressWarnings ( "unchecked" ) public < T > T [ ] toArray ( T [ ] a ) { } } | fullyLock ( ) ; try { int size = count . get ( ) ; if ( a . length < size ) a = ( T [ ] ) java . lang . reflect . Array . newInstance ( a . getClass ( ) . getComponentType ( ) , size ) ; int k = 0 ; for ( Node < E > p = head . next ; p != null ; p = p . next ) a [ k ++ ] = ( T ) p . item ; if ( a . length > k ) a [ k ] = null ; return a ; } finally { fullyUnlock ( ) ; } |
public class MessageWriter { /** * Writes the body by serializing the given object to XML .
* @ param bodyAsObject The body as object
* @ param < T > The object type */
public < T > void writeBodyFromObject ( T bodyAsObject , Charset charset ) { } } | @ SuppressWarnings ( "unchecked" ) Class < T > clazz = ( Class < T > ) bodyAsObject . getClass ( ) ; ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; Writer outputWriter = new OutputStreamWriter ( outputStream , charset ) ; try { Marshaller marshaller = JAXBContext . newInstance ( clazz ) . createMarshaller ( ) ; if ( clazz . isAnnotationPresent ( XmlRootElement . class ) ) { marshaller . marshal ( bodyAsObject , outputWriter ) ; } else { String tagName = unCapitalizedClassName ( clazz ) ; JAXBElement < T > element = new JAXBElement < T > ( new QName ( "" , tagName ) , clazz , bodyAsObject ) ; marshaller . marshal ( element , outputWriter ) ; } } catch ( JAXBException e ) { throw new RuntimeException ( e ) ; } byte [ ] bodyContent = outputStream . toByteArray ( ) ; message . contentType ( Message . APPLICATION_XML ) . contentEncoding ( charset . name ( ) ) ; message . body ( bodyContent ) ; |
public class IotHubResourcesInner { /** * Get the quota metrics for an IoT hub .
* Get the quota metrics for an IoT hub .
* @ param resourceGroupName The name of the resource group that contains the IoT hub .
* @ param resourceName The name of the IoT hub .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; IotHubQuotaMetricInfoInner & gt ; object */
public Observable < ServiceResponse < Page < IotHubQuotaMetricInfoInner > > > getQuotaMetricsWithServiceResponseAsync ( final String resourceGroupName , final String resourceName ) { } } | return getQuotaMetricsSinglePageAsync ( resourceGroupName , resourceName ) . concatMap ( new Func1 < ServiceResponse < Page < IotHubQuotaMetricInfoInner > > , Observable < ServiceResponse < Page < IotHubQuotaMetricInfoInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < IotHubQuotaMetricInfoInner > > > call ( ServiceResponse < Page < IotHubQuotaMetricInfoInner > > page ) { String nextPageLink = page . body ( ) . nextPageLink ( ) ; if ( nextPageLink == null ) { return Observable . just ( page ) ; } return Observable . just ( page ) . concatWith ( getQuotaMetricsNextWithServiceResponseAsync ( nextPageLink ) ) ; } } ) ; |
public class Cursor { /** * Gets token .
* @ return the token */
public char getToken ( ) { } } | int index = getPosition ( ) ; String document = getDocument ( ) ; return index >= document . length ( ) ? NodewalkerCodec . END_OF_STRING : document . charAt ( index ) ; |
public class MavenJDOMWriter { /** * Method updateActivation .
* @ param value
* @ param element
* @ param counter
* @ param xmlTag */
protected void updateActivation ( Activation value , String xmlTag , Counter counter , Element element ) { } } | boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "activeByDefault" , ( value . isActiveByDefault ( ) == false ) ? null : String . valueOf ( value . isActiveByDefault ( ) ) , "false" ) ; findAndReplaceSimpleElement ( innerCount , root , "jdk" , value . getJdk ( ) , null ) ; updateActivationOS ( value . getOs ( ) , "os" , innerCount , root ) ; updateActivationProperty ( value . getProperty ( ) , "property" , innerCount , root ) ; updateActivationFile ( value . getFile ( ) , "file" , innerCount , root ) ; } |
public class ApplicationGatewaysInner { /** * Deletes the specified application gateway .
* @ param resourceGroupName The name of the resource group .
* @ param applicationGatewayName The name of the application gateway .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */
public void beginDelete ( String resourceGroupName , String applicationGatewayName ) { } } | beginDeleteWithServiceResponseAsync ( resourceGroupName , applicationGatewayName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class FormLogoutExtensionProcessor { /** * Display the default logout message .
* @ param res */
private void useDefaultLogoutMsg ( HttpServletResponse res ) { } } | try { PrintWriter pw = res . getWriter ( ) ; pw . println ( DEFAULT_LOGOUT_MSG ) ; } catch ( IOException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , e . getMessage ( ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "No logoutExitPage specified" ) ; |
public class Cpe { /** * Validates the CPE attributes .
* @ param vendor1 the vendor
* @ param product1 the product
* @ param version1 the version
* @ param update1 the update version
* @ param edition1 the edition
* @ param language1 the language
* @ param swEdition1 the software edition
* @ param targetSw1 the target software
* @ param targetHw1 the target hardware
* @ param other1 the other attribute
* @ throws CpeValidationException thrown if one or more of the attributes
* are invalid */
private void validate ( String vendor1 , String product1 , String version1 , String update1 , String edition1 , String language1 , String swEdition1 , String targetSw1 , String targetHw1 , String other1 ) throws CpeValidationException { } } | Status status = Validate . component ( vendor1 ) ; if ( ! status . isValid ( ) ) { throw new CpeValidationException ( "Invalid vendor component: " + status . getMessage ( ) ) ; } status = Validate . component ( product1 ) ; if ( ! status . isValid ( ) ) { throw new CpeValidationException ( "Invalid product component: " + status . getMessage ( ) ) ; } status = Validate . component ( version1 ) ; if ( ! status . isValid ( ) ) { throw new CpeValidationException ( "Invalid version component: " + status . getMessage ( ) ) ; } status = Validate . component ( update1 ) ; if ( ! status . isValid ( ) ) { throw new CpeValidationException ( "Invalid update component: " + status . getMessage ( ) ) ; } status = Validate . component ( edition1 ) ; if ( ! status . isValid ( ) ) { throw new CpeValidationException ( "Invalid edition component: " + status . getMessage ( ) ) ; } status = Validate . component ( language1 ) ; if ( ! status . isValid ( ) ) { throw new CpeValidationException ( "Invalid language component: " + status . getMessage ( ) ) ; } status = Validate . component ( swEdition1 ) ; if ( ! status . isValid ( ) ) { throw new CpeValidationException ( "Invalid swEdition component: " + status . getMessage ( ) ) ; } status = Validate . component ( targetSw1 ) ; if ( ! status . isValid ( ) ) { throw new CpeValidationException ( "Invalid targetSw component: " + status . getMessage ( ) ) ; } status = Validate . component ( targetHw1 ) ; if ( ! status . isValid ( ) ) { throw new CpeValidationException ( "Invalid targetHw component: " + status . getMessage ( ) ) ; } status = Validate . component ( other1 ) ; if ( ! status . isValid ( ) ) { throw new CpeValidationException ( "Invalid other component: " + status . getMessage ( ) ) ; } |
public class Task { /** * Terminates this task and all its running children . This method MUST be called only if this task is running . */
public final void cancel ( ) { } } | cancelRunningChildren ( 0 ) ; Status previousStatus = status ; status = Status . CANCELLED ; if ( tree . listeners != null && tree . listeners . size > 0 ) tree . notifyStatusUpdated ( this , previousStatus ) ; end ( ) ; |
public class UTF8String { /** * Parses this UTF8String to long .
* Note that , in this method we accumulate the result in negative format , and convert it to
* positive format at the end , if this string is not started with ' - ' . This is because min value
* is bigger than max value in digits , e . g . Long . MAX _ VALUE is ' 9223372036854775807 ' and
* Long . MIN _ VALUE is ' - 9223372036854775808 ' .
* This code is mostly copied from LazyLong . parseLong in Hive .
* @ param toLongResult If a valid ` long ` was parsed from this UTF8String , then its value would
* be set in ` toLongResult `
* @ return true if the parsing was successful else false */
public boolean toLong ( LongWrapper toLongResult ) { } } | if ( numBytes == 0 ) { return false ; } byte b = getByte ( 0 ) ; final boolean negative = b == '-' ; int offset = 0 ; if ( negative || b == '+' ) { offset ++ ; if ( numBytes == 1 ) { return false ; } } final byte separator = '.' ; final int radix = 10 ; final long stopValue = Long . MIN_VALUE / radix ; long result = 0 ; while ( offset < numBytes ) { b = getByte ( offset ) ; offset ++ ; if ( b == separator ) { // We allow decimals and will return a truncated integral in that case .
// Therefore we won ' t throw an exception here ( checking the fractional
// part happens below . )
break ; } int digit ; if ( b >= '0' && b <= '9' ) { digit = b - '0' ; } else { return false ; } // We are going to process the new digit and accumulate the result . However , before doing
// this , if the result is already smaller than the stopValue ( Long . MIN _ VALUE / radix ) , then
// result * 10 will definitely be smaller than minValue , and we can stop .
if ( result < stopValue ) { return false ; } result = result * radix - digit ; // Since the previous result is less than or equal to stopValue ( Long . MIN _ VALUE / radix ) , we
// can just use ` result > 0 ` to check overflow . If result overflows , we should stop .
if ( result > 0 ) { return false ; } } // This is the case when we ' ve encountered a decimal separator . The fractional
// part will not change the number , but we will verify that the fractional part
// is well formed .
while ( offset < numBytes ) { byte currentByte = getByte ( offset ) ; if ( currentByte < '0' || currentByte > '9' ) { return false ; } offset ++ ; } if ( ! negative ) { result = - result ; if ( result < 0 ) { return false ; } } toLongResult . value = result ; return true ; |
public class DefaultGroovyMethods { /** * Sums the result of apply a closure to each item returned from an iterator .
* < code > iter . sum ( closure ) < / code > is equivalent to :
* < code > iter . collect ( closure ) . sum ( ) < / code > . The iterator will become
* exhausted of elements after determining the sum value .
* @ param self An Iterator
* @ param closure a single parameter closure that returns a numeric value .
* @ return The sum of the values returned by applying the closure to each
* item from the Iterator .
* @ since 1.7.1 */
public static Object sum ( Iterator < Object > self , Closure closure ) { } } | return sum ( toList ( self ) , null , closure , true ) ; |
public class ValueEnforcer { /** * Check that the passed map is neither < code > null < / code > nor empty and that
* no < code > null < / code > key or value is contained .
* @ param < T >
* Type to be checked and returned
* @ param aValue
* The map to check . May be < code > null < / code > .
* @ param aName
* The name of the value ( e . g . the parameter name )
* @ return The passed value . Maybe < code > null < / code > .
* @ throws IllegalArgumentException
* if the passed value is not empty and a < code > null < / code > key or
* < code > null < / code > value is contained */
@ Nullable @ CodingStyleguideUnaware public static < T extends Map < ? , ? > > T noNullValue ( final T aValue , @ Nonnull final Supplier < ? extends String > aName ) { } } | if ( isEnabled ( ) ) if ( aValue != null ) { for ( final Map . Entry < ? , ? > aEntry : aValue . entrySet ( ) ) { if ( aEntry . getKey ( ) == null ) throw new IllegalArgumentException ( "A key of map '" + aName . get ( ) + "' may not be null!" ) ; if ( aEntry . getValue ( ) == null ) throw new IllegalArgumentException ( "A value of map '" + aName . get ( ) + "' may not be null!" ) ; } } return aValue ; |
public class ComponentCollision { /** * Check others element .
* @ param objectA The collidable reference .
* @ param current The current group to check .
* @ param acceptedGroup The accepted group . */
private void checkOthers ( Collidable objectA , Entry < Point , Set < Collidable > > current , Integer acceptedGroup ) { } } | final Map < Point , Set < Collidable > > acceptedElements = collidables . get ( acceptedGroup ) ; final Point point = current . getKey ( ) ; if ( acceptedElements . containsKey ( point ) ) { checkPoint ( objectA , acceptedElements , point ) ; } |
public class StatsCollector { /** * Adds a { @ code host = hostname } or { @ code fqdn = full . host . name } tag .
* This uses { @ link InetAddress # getLocalHost } to find the hostname of the
* current host . If the hostname cannot be looked up , { @ code ( unknown ) }
* is used instead .
* @ param canonical Whether or not we should try to get the FQDN of the host .
* If set to true , the tag changes to " fqdn " instead of " host " */
public final void addHostTag ( final boolean canonical ) { } } | try { if ( canonical ) { addExtraTag ( "fqdn" , InetAddress . getLocalHost ( ) . getCanonicalHostName ( ) ) ; } else { addExtraTag ( "host" , InetAddress . getLocalHost ( ) . getHostName ( ) ) ; } } catch ( UnknownHostException x ) { LOG . error ( "WTF? Can't find hostname for localhost!" , x ) ; addExtraTag ( "host" , "(unknown)" ) ; } |
public class PatternRuleMatcher { /** * Creates a Cartesian product of the arrays stored in the input array .
* @ param input Array of string arrays to combine .
* @ param output Work array of strings .
* @ param r Starting parameter ( use 0 to get all combinations ) .
* @ param lang Text language for adding spaces in some languages .
* @ return Combined array of String . */
private static String [ ] combineLists ( String [ ] [ ] input , String [ ] output , int r , Language lang ) { } } | List < String > outputList = new ArrayList < > ( ) ; if ( r == input . length ) { StringBuilder sb = new StringBuilder ( ) ; for ( int k = 0 ; k < output . length ; k ++ ) { sb . append ( output [ k ] ) ; if ( k < output . length - 1 ) { sb . append ( StringTools . addSpace ( output [ k + 1 ] , lang ) ) ; } } outputList . add ( sb . toString ( ) ) ; } else { for ( int c = 0 ; c < input [ r ] . length ; c ++ ) { output [ r ] = input [ r ] [ c ] ; String [ ] sList = combineLists ( input , output , r + 1 , lang ) ; outputList . addAll ( Arrays . asList ( sList ) ) ; } } return outputList . toArray ( new String [ 0 ] ) ; |
public class ILFBuilder { /** * Passes the layout root of each of these documents to mergeChildren causing all children of
* newLayout to be merged into compositeLayout following merging protocal for distributed layout
* management .
* @ throws AuthorizationException */
public static void mergeFragment ( Document fragment , Document composite , IAuthorizationPrincipal ap ) throws AuthorizationException { } } | Element fragmentLayout = fragment . getDocumentElement ( ) ; Element fragmentRoot = ( Element ) fragmentLayout . getFirstChild ( ) ; Element compositeLayout = composite . getDocumentElement ( ) ; Element compositeRoot = ( Element ) compositeLayout . getFirstChild ( ) ; mergeChildren ( fragmentRoot , compositeRoot , ap , new HashSet ( ) ) ; |
public class HystrixPlugins { /** * Retrieve instance of { @ link HystrixMetricsPublisher } to use based on order of precedence as defined in { @ link HystrixPlugins } class header .
* Override default by using { @ link # registerMetricsPublisher ( HystrixMetricsPublisher ) } or setting property ( via Archaius ) : < code > hystrix . plugin . HystrixMetricsPublisher . implementation < / code > with the full
* classname to load .
* @ return { @ link HystrixMetricsPublisher } implementation to use */
public HystrixMetricsPublisher getMetricsPublisher ( ) { } } | if ( metricsPublisher . get ( ) == null ) { // check for an implementation from Archaius first
Object impl = getPluginImplementation ( HystrixMetricsPublisher . class ) ; if ( impl == null ) { // nothing set via Archaius so initialize with default
metricsPublisher . compareAndSet ( null , HystrixMetricsPublisherDefault . getInstance ( ) ) ; // we don ' t return from here but call get ( ) again in case of thread - race so the winner will always get returned
} else { // we received an implementation from Archaius so use it
metricsPublisher . compareAndSet ( null , ( HystrixMetricsPublisher ) impl ) ; } } return metricsPublisher . get ( ) ; |
public class InstanceClient { /** * Sets deletion protection on the instance .
* < p > Sample code :
* < pre > < code >
* try ( InstanceClient instanceClient = InstanceClient . create ( ) ) {
* ProjectZoneInstanceResourceName resource = ProjectZoneInstanceResourceName . of ( " [ PROJECT ] " , " [ ZONE ] " , " [ RESOURCE ] " ) ;
* Boolean deletionProtection = false ;
* Operation response = instanceClient . setDeletionProtectionInstance ( resource . toString ( ) , deletionProtection ) ;
* < / code > < / pre >
* @ param resource Name or id of the resource for this request .
* @ param deletionProtection Whether the resource should be protected against deletion .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation setDeletionProtectionInstance ( String resource , Boolean deletionProtection ) { } } | SetDeletionProtectionInstanceHttpRequest request = SetDeletionProtectionInstanceHttpRequest . newBuilder ( ) . setResource ( resource ) . setDeletionProtection ( deletionProtection ) . build ( ) ; return setDeletionProtectionInstance ( request ) ; |
public class SimpleExpressionsSwitch { /** * Calls < code > caseXXX < / code > for each class of the model until one returns a non null result ; it yields that result .
* < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ return the first non - null result returned by a < code > caseXXX < / code > call .
* @ generated */
@ Override protected T doSwitch ( int classifierID , EObject theEObject ) { } } | switch ( classifierID ) { case SimpleExpressionsPackage . IF_CONDITION : { IfCondition ifCondition = ( IfCondition ) theEObject ; T result = caseIfCondition ( ifCondition ) ; if ( result == null ) result = defaultCase ( theEObject ) ; return result ; } case SimpleExpressionsPackage . EXPRESSION : { Expression expression = ( Expression ) theEObject ; T result = caseExpression ( expression ) ; if ( result == null ) result = defaultCase ( theEObject ) ; return result ; } case SimpleExpressionsPackage . NUMBER_LITERAL : { NumberLiteral numberLiteral = ( NumberLiteral ) theEObject ; T result = caseNumberLiteral ( numberLiteral ) ; if ( result == null ) result = caseExpression ( numberLiteral ) ; if ( result == null ) result = defaultCase ( theEObject ) ; return result ; } case SimpleExpressionsPackage . BOOLEAN_LITERAL : { BooleanLiteral booleanLiteral = ( BooleanLiteral ) theEObject ; T result = caseBooleanLiteral ( booleanLiteral ) ; if ( result == null ) result = caseExpression ( booleanLiteral ) ; if ( result == null ) result = defaultCase ( theEObject ) ; return result ; } case SimpleExpressionsPackage . METHOD_CALL : { MethodCall methodCall = ( MethodCall ) theEObject ; T result = caseMethodCall ( methodCall ) ; if ( result == null ) result = caseExpression ( methodCall ) ; if ( result == null ) result = defaultCase ( theEObject ) ; return result ; } case SimpleExpressionsPackage . OR_EXPRESSION : { OrExpression orExpression = ( OrExpression ) theEObject ; T result = caseOrExpression ( orExpression ) ; if ( result == null ) result = caseExpression ( orExpression ) ; if ( result == null ) result = defaultCase ( theEObject ) ; return result ; } case SimpleExpressionsPackage . AND_EXPRESSION : { AndExpression andExpression = ( AndExpression ) theEObject ; T result = caseAndExpression ( andExpression ) ; if ( result == null ) result = caseExpression ( andExpression ) ; if ( result == null ) result = defaultCase ( theEObject ) ; return result ; } case SimpleExpressionsPackage . COMPARISON : { Comparison comparison = ( Comparison ) theEObject ; T result = caseComparison ( comparison ) ; if ( result == null ) result = caseExpression ( comparison ) ; if ( result == null ) result = defaultCase ( theEObject ) ; return result ; } case SimpleExpressionsPackage . NOT_EXPRESSION : { NotExpression notExpression = ( NotExpression ) theEObject ; T result = caseNotExpression ( notExpression ) ; if ( result == null ) result = caseExpression ( notExpression ) ; if ( result == null ) result = defaultCase ( theEObject ) ; return result ; } default : return defaultCase ( theEObject ) ; } |
public class KunderaCriteriaBuilder { /** * ( non - Javadoc )
* @ see
* javax . persistence . criteria . CriteriaBuilder # le ( javax . persistence . criteria
* . Expression , javax . persistence . criteria . Expression ) */
@ Override public Predicate le ( Expression < ? extends Number > arg0 , Expression < ? extends Number > arg1 ) { } } | // TODO Auto - generated method stub
return null ; |
public class CpcCompression { /** * visible for test */
static void lowLevelUncompressBytes ( final byte [ ] byteArray , // output
final int numBytesToDecode , // input ( but refers to the output )
final short [ ] decodingTable , // input
final int [ ] compressedWords , // input
final long numCompressedWords ) { } } | // input
int byteIndex = 0 ; int nextWordIndex = 0 ; long bitBuf = 0 ; int bufBits = 0 ; assert ( byteArray != null ) ; assert ( decodingTable != null ) ; assert ( compressedWords != null ) ; for ( byteIndex = 0 ; byteIndex < numBytesToDecode ; byteIndex ++ ) { // MAYBE _ FILL _ BITBUF ( compressedWords , wordIndex , 12 ) ; / / ensure 12 bits in bit buffer
if ( bufBits < 12 ) { // Prepare for a 12 - bit peek into the bitstream .
bitBuf |= ( ( compressedWords [ nextWordIndex ++ ] & 0XFFFF_FFFFL ) << bufBits ) ; bufBits += 32 ; } // These 12 bits will include an entire Huffman codeword .
final int peek12 = ( int ) ( bitBuf & 0XFFFL ) ; final int lookup = decodingTable [ peek12 ] & 0XFFFF ; final int codeWordLength = lookup >>> 8 ; final byte decodedByte = ( byte ) ( lookup & 0XFF ) ; byteArray [ byteIndex ] = decodedByte ; bitBuf >>>= codeWordLength ; bufBits -= codeWordLength ; } // Buffer over - run should be impossible unless there is a bug .
// However , we might as well check here .
assert ( nextWordIndex <= numCompressedWords ) ; |
public class HDFSUtils { /** * Convenient method to check if the given URI string is a WebHDFS URL .
* See { @ link # isHdfsUri ( java . net . URI ) } for more . */
public static boolean isHdfsUri ( String uriStr ) { } } | return isHdfsUri ( URI . create ( PERCENT . matcher ( uriStr ) . replaceAll ( "" ) ) ) ; |
public class BubbleAnimationLayout { /** * Show base view */
@ SuppressWarnings ( "unused" ) public void showBaseView ( ) { } } | if ( ( mForwardAnimatorSet != null && mForwardAnimatorSet . isRunning ( ) ) || ( mAnimationView != null && mAnimationView . isPlaying ( ) ) || ( mReverseAnimatorSet != null && mReverseAnimatorSet . isRunning ( ) ) ) { return ; } if ( mBaseContainer != null ) { mBaseContainer . setVisibility ( VISIBLE ) ; } if ( mAnimationView != null ) { mAnimationView . setAnimated ( false ) ; } if ( mContextView != null ) { mContextView . setVisibility ( GONE ) ; } |
public class KafkaTransporter { /** * - - - SUBSCRIBE - - - */
@ Override public Promise subscribe ( String channel ) { } } | poller . subscribe ( channel ) ; return Promise . resolve ( ) ; |
public class CancelableDiagnostician { /** * Use { @ link # checkCanceled } instead to throw a platform specific cancellation exception . */
@ Deprecated protected boolean isCanceled ( Map < Object , Object > context ) { } } | CancelIndicator indicator = getCancelIndicator ( context ) ; return indicator != null && indicator . isCanceled ( ) ; |
public class LocaleMatcher { /** * Get the best match for an individual language code .
* @ param languageCode
* @ return best matching language code and weight ( as per
* { @ link # match ( ULocale , ULocale ) } ) */
private ULocale getBestMatchInternal ( ULocale languageCode , OutputDouble outputWeight ) { } } | languageCode = canonicalize ( languageCode ) ; final ULocale maximized = addLikelySubtags ( languageCode ) ; if ( DEBUG ) { System . out . println ( "\ngetBestMatchInternal: " + languageCode + ";\t" + maximized ) ; } double bestWeight = 0 ; ULocale bestTableMatch = null ; String baseLanguage = maximized . getLanguage ( ) ; Set < R3 < ULocale , ULocale , Double > > searchTable = desiredLanguageToPossibleLocalesToMaxLocaleToData . get ( baseLanguage ) ; if ( searchTable != null ) { // we preprocessed the table so as to filter by lanugage
if ( DEBUG ) System . out . println ( "\tSearching: " + searchTable ) ; for ( final R3 < ULocale , ULocale , Double > tableKeyValue : searchTable ) { ULocale tableKey = tableKeyValue . get0 ( ) ; ULocale maxLocale = tableKeyValue . get1 ( ) ; Double matchedWeight = tableKeyValue . get2 ( ) ; final double match = match ( languageCode , maximized , tableKey , maxLocale ) ; if ( DEBUG ) { System . out . println ( "\t" + tableKeyValue + ";\t" + match + "\n" ) ; } final double weight = match * matchedWeight ; if ( weight > bestWeight ) { bestWeight = weight ; bestTableMatch = tableKey ; if ( weight > 0.999d ) { // bail on good enough match .
break ; } } } } if ( bestWeight < threshold ) { bestTableMatch = defaultLanguage ; } if ( outputWeight != null ) { outputWeight . value = bestWeight ; // only return the weight when needed
} return bestTableMatch ; |
public class MoneyAmountStyle { /** * Gets the prototype localized style for the given locale .
* This uses { @ link DecimalFormatSymbols } and { @ link NumberFormat } .
* The method { @ code DecimalFormatSymbols . getInstance ( locale ) } will be used
* in order to allow the use of locales defined as extensions .
* @ param locale the { @ link Locale } used to get the correct { @ link DecimalFormatSymbols }
* @ return the symbols , never null */
private static MoneyAmountStyle getLocalizedStyle ( Locale locale ) { } } | MoneyAmountStyle protoStyle = LOCALIZED_CACHE . get ( locale ) ; if ( protoStyle == null ) { DecimalFormatSymbols symbols = DecimalFormatSymbols . getInstance ( locale ) ; NumberFormat format = NumberFormat . getCurrencyInstance ( locale ) ; int size = ( format instanceof DecimalFormat ? ( ( DecimalFormat ) format ) . getGroupingSize ( ) : 3 ) ; size = size <= 0 ? 3 : size ; protoStyle = new MoneyAmountStyle ( symbols . getZeroDigit ( ) , '+' , symbols . getMinusSign ( ) , symbols . getMonetaryDecimalSeparator ( ) , GroupingStyle . FULL , symbols . getGroupingSeparator ( ) , size , 0 , false , false ) ; LOCALIZED_CACHE . putIfAbsent ( locale , protoStyle ) ; } return protoStyle ; |
public class ConditionalFunctions { /** * Returned expression results in first non - MISSING , non - NaN number .
* Returns MISSING or NULL if a non - number input is encountered first */
public static Expression ifNaN ( Expression expression1 , Expression expression2 , Expression ... others ) { } } | return build ( "IFNAN" , expression1 , expression2 , others ) ; |
public class PlaidClient { /** * A helper to assist with decoding unsuccessful responses .
* This is not done automatically , because an unsuccessful result may have many causes
* such as network issues , intervening HTTP proxies , load balancers , partial responses , etc ,
* which means that a response can easily be incomplete , or not even the expected well - formed
* JSON error .
* Therefore , even when using this helper , be prepared for it to throw an exception instead of
* successfully decoding every error response !
* @ param response the unsuccessful response object to deserialize .
* @ return the resulting { @ link ErrorResponse } , assuming deserialization succeeded .
* @ throws RuntimeException if the response cannot be deserialized */
public ErrorResponse parseError ( Response response ) { } } | if ( response . isSuccessful ( ) ) { throw new IllegalArgumentException ( "Response must be unsuccessful." ) ; } Converter < ResponseBody , ErrorResponse > responseBodyObjectConverter = retrofit . responseBodyConverter ( ErrorResponse . class , new Annotation [ 0 ] ) ; try { return responseBodyObjectConverter . convert ( response . errorBody ( ) ) ; } catch ( IOException ex ) { throw new RuntimeException ( "Could not parse error response" , ex ) ; } |
public class Classfile { /** * Read the class ' methods .
* @ throws IOException
* if an I / O exception occurs .
* @ throws ClassfileFormatException
* if the classfile is incorrectly formatted . */
private void readMethods ( ) throws IOException , ClassfileFormatException { } } | // Methods
final int methodCount = inputStreamOrByteBuffer . readUnsignedShort ( ) ; for ( int i = 0 ; i < methodCount ; i ++ ) { // Info on modifier flags : http : / / docs . oracle . com / javase / specs / jvms / se7 / html / jvms - 4 . html # jvms - 4.6
final int methodModifierFlags = inputStreamOrByteBuffer . readUnsignedShort ( ) ; final boolean isPublicMethod = ( ( methodModifierFlags & 0x0001 ) == 0x0001 ) ; final boolean methodIsVisible = isPublicMethod || scanSpec . ignoreMethodVisibility ; String methodName = null ; String methodTypeDescriptor = null ; String methodTypeSignature = null ; // Always enable MethodInfo for annotations ( this is how annotation constants are defined )
final boolean enableMethodInfo = scanSpec . enableMethodInfo || isAnnotation ; if ( enableMethodInfo || isAnnotation ) { // Annotations store defaults in method _ info
final int methodNameCpIdx = inputStreamOrByteBuffer . readUnsignedShort ( ) ; methodName = getConstantPoolString ( methodNameCpIdx ) ; final int methodTypeDescriptorCpIdx = inputStreamOrByteBuffer . readUnsignedShort ( ) ; methodTypeDescriptor = getConstantPoolString ( methodTypeDescriptorCpIdx ) ; } else { inputStreamOrByteBuffer . skip ( 4 ) ; // name _ index , descriptor _ index
} final int attributesCount = inputStreamOrByteBuffer . readUnsignedShort ( ) ; String [ ] methodParameterNames = null ; int [ ] methodParameterModifiers = null ; AnnotationInfo [ ] [ ] methodParameterAnnotations = null ; AnnotationInfoList methodAnnotationInfo = null ; boolean methodHasBody = false ; if ( ! methodIsVisible || ( ! enableMethodInfo && ! isAnnotation ) ) { // Skip method attributes
for ( int j = 0 ; j < attributesCount ; j ++ ) { inputStreamOrByteBuffer . skip ( 2 ) ; // attribute _ name _ index
final int attributeLength = inputStreamOrByteBuffer . readInt ( ) ; inputStreamOrByteBuffer . skip ( attributeLength ) ; } } else { // Look for method annotations
for ( int j = 0 ; j < attributesCount ; j ++ ) { final int attributeNameCpIdx = inputStreamOrByteBuffer . readUnsignedShort ( ) ; final int attributeLength = inputStreamOrByteBuffer . readInt ( ) ; if ( scanSpec . enableAnnotationInfo && ( constantPoolStringEquals ( attributeNameCpIdx , "RuntimeVisibleAnnotations" ) || ( ! scanSpec . disableRuntimeInvisibleAnnotations && constantPoolStringEquals ( attributeNameCpIdx , "RuntimeInvisibleAnnotations" ) ) ) ) { final int methodAnnotationCount = inputStreamOrByteBuffer . readUnsignedShort ( ) ; if ( methodAnnotationCount > 0 ) { if ( methodAnnotationInfo == null ) { methodAnnotationInfo = new AnnotationInfoList ( 1 ) ; } for ( int k = 0 ; k < methodAnnotationCount ; k ++ ) { final AnnotationInfo annotationInfo = readAnnotation ( ) ; methodAnnotationInfo . add ( annotationInfo ) ; } } } else if ( scanSpec . enableAnnotationInfo && ( constantPoolStringEquals ( attributeNameCpIdx , "RuntimeVisibleParameterAnnotations" ) || ( ! scanSpec . disableRuntimeInvisibleAnnotations && constantPoolStringEquals ( attributeNameCpIdx , "RuntimeInvisibleParameterAnnotations" ) ) ) ) { // Merge together runtime visible and runtime invisible annotations into a single array
// of annotations for each method parameter ( runtime visible and runtime invisible
// annotations are given in separate attributes , so if both attributes are present ,
// have to make the parameter annotation arrays larger when the second attribute is
// encountered ) .
final int numParams = inputStreamOrByteBuffer . readUnsignedByte ( ) ; if ( methodParameterAnnotations == null ) { methodParameterAnnotations = new AnnotationInfo [ numParams ] [ ] ; } else if ( methodParameterAnnotations . length != numParams ) { throw new ClassfileFormatException ( "Mismatch in number of parameters between RuntimeVisibleParameterAnnotations " + "and RuntimeInvisibleParameterAnnotations" ) ; } for ( int paramIdx = 0 ; paramIdx < numParams ; paramIdx ++ ) { final int numAnnotations = inputStreamOrByteBuffer . readUnsignedShort ( ) ; if ( numAnnotations > 0 ) { int annStartIdx = 0 ; if ( methodParameterAnnotations [ paramIdx ] != null ) { annStartIdx = methodParameterAnnotations [ paramIdx ] . length ; methodParameterAnnotations [ paramIdx ] = Arrays . copyOf ( methodParameterAnnotations [ paramIdx ] , annStartIdx + numAnnotations ) ; } else { methodParameterAnnotations [ paramIdx ] = new AnnotationInfo [ numAnnotations ] ; } for ( int annIdx = 0 ; annIdx < numAnnotations ; annIdx ++ ) { methodParameterAnnotations [ paramIdx ] [ annStartIdx + annIdx ] = readAnnotation ( ) ; } } else if ( methodParameterAnnotations [ paramIdx ] == null ) { methodParameterAnnotations [ paramIdx ] = NO_ANNOTATIONS ; } } } else if ( constantPoolStringEquals ( attributeNameCpIdx , "MethodParameters" ) ) { // Read method parameters . For Java , these are only produced in JDK8 + , and only if the
// commandline switch ` - parameters ` is provided at compiletime .
final int paramCount = inputStreamOrByteBuffer . readUnsignedByte ( ) ; methodParameterNames = new String [ paramCount ] ; methodParameterModifiers = new int [ paramCount ] ; for ( int k = 0 ; k < paramCount ; k ++ ) { final int cpIdx = inputStreamOrByteBuffer . readUnsignedShort ( ) ; // If the constant pool index is zero , then the parameter is unnamed = > use null
methodParameterNames [ k ] = cpIdx == 0 ? null : getConstantPoolString ( cpIdx ) ; methodParameterModifiers [ k ] = inputStreamOrByteBuffer . readUnsignedShort ( ) ; } } else if ( constantPoolStringEquals ( attributeNameCpIdx , "Signature" ) ) { // Add type params to method type signature
methodTypeSignature = getConstantPoolString ( inputStreamOrByteBuffer . readUnsignedShort ( ) ) ; } else if ( constantPoolStringEquals ( attributeNameCpIdx , "AnnotationDefault" ) ) { if ( annotationParamDefaultValues == null ) { annotationParamDefaultValues = new AnnotationParameterValueList ( ) ; } this . annotationParamDefaultValues . add ( new AnnotationParameterValue ( methodName , // Get annotation parameter default value
readAnnotationElementValue ( ) ) ) ; } else if ( constantPoolStringEquals ( attributeNameCpIdx , "Code" ) ) { methodHasBody = true ; inputStreamOrByteBuffer . skip ( attributeLength ) ; } else { inputStreamOrByteBuffer . skip ( attributeLength ) ; } } // Create MethodInfo
if ( enableMethodInfo ) { if ( methodInfoList == null ) { methodInfoList = new MethodInfoList ( ) ; } methodInfoList . add ( new MethodInfo ( className , methodName , methodAnnotationInfo , methodModifierFlags , methodTypeDescriptor , methodTypeSignature , methodParameterNames , methodParameterModifiers , methodParameterAnnotations , methodHasBody ) ) ; } } } |
public class LastaToActionFilter { protected void viaEmbeddedFilter ( HttpServletRequest request , HttpServletResponse response , FilterChain chain ) throws IOException , ServletException { } } | routingFilter . doFilter ( request , response , prepareFinalChain ( chain ) ) ; // # to _ action |
public class DisqueClient { /** * Open a new connection to a Disque server with the supplied { @ link DisqueURI } that treats keys and values as UTF - 8
* strings . Command timeouts are applied from the given { @ link DisqueURI # getTimeout ( ) } settings .
* @ param disqueURI the disque server to connect to , must not be { @ literal null }
* @ return A new connection . */
public DisqueConnection < String , String > connect ( DisqueURI disqueURI ) { } } | return connect ( new Utf8StringCodec ( ) , disqueURI , SocketAddressSupplierFactory . Factories . ROUND_ROBIN ) ; |
public class TemplateEngine { /** * Internal method that initializes the Template Engine instance . This method
* is called before the first execution of { @ link TemplateEngine # process ( String , IContext ) }
* or { @ link TemplateEngine # processThrottled ( String , IContext ) }
* in order to create all the structures required for a quick execution of
* templates .
* THIS METHOD IS INTERNAL AND SHOULD < b > NEVER < / b > BE CALLED DIRECTLY .
* If a subclass of { @ code TemplateEngine } needs additional steps for
* initialization , the { @ link # initializeSpecific ( ) } method should
* be overridden . */
final void initialize ( ) { } } | if ( ! this . initialized ) { synchronized ( this ) { if ( ! this . initialized ) { logger . debug ( "[THYMELEAF] INITIALIZING TEMPLATE ENGINE" ) ; // First of all , give subclasses the opportunity to modify the base configuration
initializeSpecific ( ) ; // We need at least one template resolver at this point - we set the StringTemplateResolver as default
if ( this . templateResolvers . isEmpty ( ) ) { this . templateResolvers . add ( new StringTemplateResolver ( ) ) ; } // Build the EngineConfiguration object
this . configuration = new EngineConfiguration ( this . templateResolvers , this . messageResolvers , this . linkBuilders , this . dialectConfigurations , this . cacheManager , this . engineContextFactory , this . decoupledTemplateLogicResolver ) ; ( ( EngineConfiguration ) this . configuration ) . initialize ( ) ; this . initialized = true ; // Log configuration details
ConfigurationPrinterHelper . printConfiguration ( this . configuration ) ; logger . debug ( "[THYMELEAF] TEMPLATE ENGINE INITIALIZED" ) ; } } } |
public class SourceMapGeneratorV3 { /** * Source map field helpers . */
private static void appendFirstField ( Appendable out , String name , CharSequence value ) throws IOException { } } | appendFieldStart ( out , name , true ) ; out . append ( value ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.