signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class HString { /** * Trims tokens off the right of this HString that match the given predicate .
* @ param toTrimPredicate the predicate to use to determine if a token should be removed ( evaulate to TRUE ) or kept
* ( evaluate to FALSE ) .
* @ return the trimmed HString */
public HString trimRight ( @ NonNull Predicate < ? super Annotation > toTrimPredicate ) { } } | int end = tokenLength ( ) - 1 ; while ( end >= 0 && toTrimPredicate . test ( tokenAt ( end ) ) ) { end -- ; } if ( end > 0 ) { return tokenAt ( 0 ) . union ( tokenAt ( end ) ) ; } else if ( end == 0 ) { return tokenAt ( 0 ) ; } return Fragments . empty ( document ( ) ) ; |
public class BackupRule { /** * An array of key - value pair strings that are assigned to resources that are associated with this rule when
* restored from backup .
* @ param recoveryPointTags
* An array of key - value pair strings that are assigned to resources that are associated with this rule when
* restored from backup .
* @ return Returns a reference to this object so that method calls can be chained together . */
public BackupRule withRecoveryPointTags ( java . util . Map < String , String > recoveryPointTags ) { } } | setRecoveryPointTags ( recoveryPointTags ) ; return this ; |
public class RtfCtrlWordData { /** * Return the parameter value as a Long object
* @ return
* Returns the parameter value as a Long object . */
public Long toLong ( ) { } } | Long value ; value = Long . valueOf ( this . isNeg ? Long . parseLong ( this . param ) * - 1 : Long . parseLong ( this . param ) ) ; return value ; |
public class CDXServer { /** * TODO : Support idx / summary in json ? */
protected void writeIdxResponse ( CDXWriter responseWriter , CloseableIterator < String > iter ) { } } | responseWriter . begin ( ) ; while ( iter . hasNext ( ) ) { responseWriter . writeMiscLine ( iter . next ( ) ) ; } responseWriter . end ( ) ; |
public class ComponentFactory { /** * Factory method for create a new { @ link MultiLineLabel } .
* @ param < T >
* the generic type of the model
* @ param id
* the id
* @ param model
* the { @ link IModel } of the { @ link MultiLineLabel } .
* @ return the new { @ link MultiLineLabel } . */
public static < T > MultiLineLabel newMultiLineLabel ( final String id , final IModel < T > model ) { } } | final MultiLineLabel multiLineLabel = new MultiLineLabel ( id , model ) ; multiLineLabel . setOutputMarkupId ( true ) ; return multiLineLabel ; |
public class Parameters { /** * Set a boolean value to the query parameter referenced by the given name . A query parameter
* is defined by using the Expression ' s parameter ( String name ) function .
* @ param name The parameter name .
* @ param value The boolean value .
* @ return The self object . */
@ NonNull public Parameters setBoolean ( @ NonNull String name , boolean value ) { } } | return setValue ( name , value ) ; |
public class HttpSessionContextImpl { /** * lock session for serialized session access feature
* overrides empty method in SessionContext . java */
public void lockSession ( HttpServletRequest req , HttpSession sess ) { } } | String isNested = ( String ) req . getAttribute ( "com.ibm.servlet.engine.webapp.dispatch_nested" ) ; if ( isNested == null || ( isNested . equalsIgnoreCase ( "false" ) ) ) { try { long syncSessionTimeOut = ( long ) _smc . getSerializedSessionAccessMaxWaitTime ( ) * 1000L ; // convert to millisecond
long syncSessionTimeOutNanos = syncSessionTimeOut * 1000000L ; // convert to nanosecond
// if session exits , start locking procedures
if ( sess != null ) { Object lock = new Object ( ) ; // create a new lock object for this request ;
LinkedList ll = ( ( SessionData ) sess ) . getLockList ( ) ; // gets the linked lists of lock objects for this session ;
int llsize ; // PK09786 BEGIN - - Always synchronize on linklist before lock to avoid deadlock
synchronized ( ll ) { ( ( SessionData ) sess ) . setSessionLock ( Thread . currentThread ( ) , lock ) ; // adds thread to WsSession locks hashtable so we know who to notify in PostInvoke
ll . addLast ( lock ) ; llsize = ll . size ( ) ; } // PK19389 when another thread is in sessionPostInvoke , trying to lock linkedlist in order to notify the thread in lock . wait ( )
if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_CORE . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_CORE . logp ( Level . FINE , methodClassName , methodNames [ LOCK_SESSION ] , "size = " + llsize + " thread = " + Thread . currentThread ( ) . getId ( ) + " lock = " + lock . hashCode ( ) ) ; } if ( llsize > 1 ) { long before = System . nanoTime ( ) ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_CORE . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_CORE . logp ( Level . FINE , methodClassName , methodNames [ LOCK_SESSION ] , "waiting..." ) ; } synchronized ( lock ) { lock . wait ( syncSessionTimeOut ) ; } if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_CORE . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_CORE . logp ( Level . FINE , methodClassName , methodNames [ LOCK_SESSION ] , "Done waiting." ) ; } long after = System . nanoTime ( ) ; synchronized ( ll ) { // if timed out
if ( ( after - syncSessionTimeOutNanos ) >= before ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_CORE . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_CORE . logp ( Level . FINE , methodClassName , methodNames [ LOCK_SESSION ] , "notified after wait timed out" ) ; } // 118672 - we want to fail if we aren ' t supposed to get the access session
if ( ! _smc . getAccessSessionOnTimeout ( ) ) { ll . remove ( lock ) ; LoggingUtil . SESSION_LOGGER_CORE . logp ( Level . SEVERE , methodClassName , methodNames [ LOCK_SESSION ] , "WsSessionContext.timeOut" ) ; throw new RuntimeException ( "Session Lock time outException" ) ; } } } } // PK09786 END
} if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_CORE . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_CORE . exiting ( methodClassName , methodNames [ LOCK_SESSION ] , sess ) ; } // return sess ;
} catch ( InterruptedException e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ws.webcontainer.session.impl.HttpSessionContextImpl.lockSession" , "133" , this ) ; LoggingUtil . SESSION_LOGGER_CORE . logp ( Level . SEVERE , methodClassName , methodNames [ LOCK_SESSION ] , "CommonMessage.exception" , e ) ; } } // close if ( isNested . . . ) |
public class TimeSensor { /** * setEnabled will set the TimeSensor enable variable .
* if true , then it will started the animation
* if fase , then it changes repeat mode to ONCE so the animation will conclude .
* There is no simple stop ( ) animation
* @ param enable
* @ param gvrContext */
public void setEnabled ( boolean enable , GVRContext gvrContext ) { } } | if ( this . enabled != enabled ) { // a change in the animation stopping / starting
for ( GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations ) { if ( enable ) gvrKeyFrameAnimation . start ( gvrContext . getAnimationEngine ( ) ) ; else { gvrKeyFrameAnimation . setRepeatMode ( GVRRepeatMode . ONCE ) ; } } this . enabled = enable ; } |
public class CommerceUserSegmentEntryPersistenceImpl { /** * Returns a range of all the commerce user segment entries that the user has permission to view where groupId = & # 63 ; and active = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceUserSegmentEntryModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param groupId the group ID
* @ param active the active
* @ param start the lower bound of the range of commerce user segment entries
* @ param end the upper bound of the range of commerce user segment entries ( not inclusive )
* @ return the range of matching commerce user segment entries that the user has permission to view */
@ Override public List < CommerceUserSegmentEntry > filterFindByG_A ( long groupId , boolean active , int start , int end ) { } } | return filterFindByG_A ( groupId , active , start , end , null ) ; |
public class PluginDefinition { /** * Returns the list of plugin resources belonging to the specified resource class . Never null .
* @ param < E > A subclass of PluginResource .
* @ param clazz The resource class being sought .
* @ return List of associated resources . */
@ SuppressWarnings ( "unchecked" ) public < E extends IPluginResource > List < E > getResources ( Class < E > clazz ) { } } | List < E > list = new ArrayList < > ( ) ; for ( IPluginResource resource : resources ) { if ( clazz . isInstance ( resource ) ) { list . add ( ( E ) resource ) ; } } return list ; |
public class ListValue { /** * Creates a { @ code ListValue } object given a number of string values . */
public static ListValue of ( String first , String ... other ) { } } | return newBuilder ( ) . addValue ( first , other ) . build ( ) ; |
public class KMLGeometry { /** * Build a string represention to kml coordinates
* Syntax :
* < coordinates > . . . < / coordinates > < ! - - lon , lat [ , alt ] tuples - - >
* @ param coords */
public static void appendKMLCoordinates ( Coordinate [ ] coords , StringBuilder sb ) { } } | sb . append ( "<coordinates>" ) ; for ( int i = 0 ; i < coords . length ; i ++ ) { Coordinate coord = coords [ i ] ; sb . append ( coord . x ) . append ( "," ) . append ( coord . y ) ; if ( ! Double . isNaN ( coord . z ) ) { sb . append ( "," ) . append ( coord . z ) ; } if ( i < coords . length - 1 ) { sb . append ( " " ) ; } } sb . append ( "</coordinates>" ) ; |
public class AWSServerMigrationClient { /** * Creates a replication job . The replication job schedules periodic replication runs to replicate your server to
* AWS . Each replication run creates an Amazon Machine Image ( AMI ) .
* @ param createReplicationJobRequest
* @ return Result of the CreateReplicationJob operation returned by the service .
* @ throws InvalidParameterException
* A specified parameter is not valid .
* @ throws MissingRequiredParameterException
* A required parameter is missing .
* @ throws UnauthorizedOperationException
* You lack permissions needed to perform this operation . Check your IAM policies , and ensure that you are
* using the correct access keys .
* @ throws OperationNotPermittedException
* This operation is not allowed .
* @ throws ServerCannotBeReplicatedException
* The specified server cannot be replicated .
* @ throws ReplicationJobAlreadyExistsException
* The specified replication job already exists .
* @ throws NoConnectorsAvailableException
* There are no connectors available .
* @ throws InternalErrorException
* An internal error occurred .
* @ throws TemporarilyUnavailableException
* The service is temporarily unavailable .
* @ sample AWSServerMigration . CreateReplicationJob
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / sms - 2016-10-24 / CreateReplicationJob " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public CreateReplicationJobResult createReplicationJob ( CreateReplicationJobRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeCreateReplicationJob ( request ) ; |
public class RecordChangedHandler { /** * Remove the temporary key field . */
public void clearTemporaryKeyField ( ) { } } | Record record = this . getOwner ( ) ; KeyArea keyArea = record . getKeyArea ( 0 ) ; if ( keyArea . getKeyFields ( false , true ) == 2 ) if ( m_fakeKeyField != null ) // Always
keyArea . removeKeyField ( m_fakeKeyField ) ; |
public class Command { /** * Unbind a component from this command .
* @ param component The component to unbind . */
public void unbind ( BaseUIComponent component ) { } } | if ( componentBindings . remove ( component ) ) { keyEventListener . registerComponent ( component , false ) ; CommandUtil . updateShortcuts ( component , shortcutBindings , true ) ; setCommandTarget ( component , null ) ; } |
public class WorkspacesApi { /** * List Workspace Folder Contents
* Retrieves workspace folder contents , which can include sub folders and files .
* @ param accountId The external account number ( int ) or account ID Guid . ( required )
* @ param workspaceId Specifies the workspace ID GUID . ( required )
* @ param folderId The ID of the folder being accessed . ( required )
* @ param options for modifying the method behavior .
* @ return WorkspaceFolderContents
* @ throws ApiException if fails to make API call */
public WorkspaceFolderContents listWorkspaceFolderItems ( String accountId , String workspaceId , String folderId , WorkspacesApi . ListWorkspaceFolderItemsOptions options ) throws ApiException { } } | Object localVarPostBody = "{}" ; // verify the required parameter ' accountId ' is set
if ( accountId == null ) { throw new ApiException ( 400 , "Missing the required parameter 'accountId' when calling listWorkspaceFolderItems" ) ; } // verify the required parameter ' workspaceId ' is set
if ( workspaceId == null ) { throw new ApiException ( 400 , "Missing the required parameter 'workspaceId' when calling listWorkspaceFolderItems" ) ; } // verify the required parameter ' folderId ' is set
if ( folderId == null ) { throw new ApiException ( 400 , "Missing the required parameter 'folderId' when calling listWorkspaceFolderItems" ) ; } // create path and map variables
String localVarPath = "/v2/accounts/{accountId}/workspaces/{workspaceId}/folders/{folderId}" . replaceAll ( "\\{format\\}" , "json" ) . replaceAll ( "\\{" + "accountId" + "\\}" , apiClient . escapeString ( accountId . toString ( ) ) ) . replaceAll ( "\\{" + "workspaceId" + "\\}" , apiClient . escapeString ( workspaceId . toString ( ) ) ) . replaceAll ( "\\{" + "folderId" + "\\}" , apiClient . escapeString ( folderId . toString ( ) ) ) ; // query params
java . util . List < Pair > localVarQueryParams = new java . util . ArrayList < Pair > ( ) ; java . util . Map < String , String > localVarHeaderParams = new java . util . HashMap < String , String > ( ) ; java . util . Map < String , Object > localVarFormParams = new java . util . HashMap < String , Object > ( ) ; if ( options != null ) { localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "count" , options . count ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "include_files" , options . includeFiles ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "include_sub_folders" , options . includeSubFolders ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "include_thumbnails" , options . includeThumbnails ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "include_user_detail" , options . includeUserDetail ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "start_position" , options . startPosition ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "workspace_user_id" , options . workspaceUserId ) ) ; } final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; final String [ ] localVarContentTypes = { } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; String [ ] localVarAuthNames = new String [ ] { "docusignAccessCode" } ; GenericType < WorkspaceFolderContents > localVarReturnType = new GenericType < WorkspaceFolderContents > ( ) { } ; return apiClient . invokeAPI ( localVarPath , "GET" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ; |
public class CmsLinkValidationInternalTable { /** * Creates a root - cms object . < p >
* @ return CmsObject */
private CmsObject getRootCms ( ) { } } | if ( m_cms == null ) { m_cms = A_CmsUI . getCmsObject ( ) ; m_cms . getRequestContext ( ) . setSiteRoot ( "" ) ; } return m_cms ; |
public class YokeRequest { /** * Create a new Session with custom Id and store it with the underlying storage .
* Internally create a entry in the request context under the name " session " and add a end handler to save that
* object once the execution is terminated . Custom session id could be used with external auth provider like mod - auth - mgr .
* @ param sessionId custom session id
* @ return { JsonObject } session */
public JsonObject createSession ( @ NotNull final String sessionId ) { } } | final JsonObject session = new JsonObject ( ) . put ( "id" , sessionId ) ; put ( "session" , session ) ; response ( ) . headersHandler ( new Handler < Void > ( ) { @ Override public void handle ( Void event ) { int responseStatus = response ( ) . getStatusCode ( ) ; // Only save on success and redirect status codes
if ( responseStatus >= 200 && responseStatus < 400 ) { JsonObject session = get ( "session" ) ; if ( session != null ) { store . set ( sessionId , session , new Handler < Object > ( ) { @ Override public void handle ( Object error ) { if ( error != null ) { // TODO : better handling of errors
System . err . println ( error ) ; } } } ) ; } } } } ) ; return session ; |
public class DirectConnectGatewayAssociationProposal { /** * The existing Amazon VPC prefixes advertised to the Direct Connect gateway .
* @ return The existing Amazon VPC prefixes advertised to the Direct Connect gateway . */
public java . util . List < RouteFilterPrefix > getExistingAllowedPrefixesToDirectConnectGateway ( ) { } } | if ( existingAllowedPrefixesToDirectConnectGateway == null ) { existingAllowedPrefixesToDirectConnectGateway = new com . amazonaws . internal . SdkInternalList < RouteFilterPrefix > ( ) ; } return existingAllowedPrefixesToDirectConnectGateway ; |
public class IntuitResponseDeserializer { /** * Method to deserialize the QueryResponse object
* @ param jsonNode
* @ return QueryResponse */
private AttachableResponse getAttachableResponse ( JsonNode jsonNode ) throws IOException { } } | ObjectMapper mapper = new ObjectMapper ( ) ; SimpleModule simpleModule = new SimpleModule ( "AttachableResponseDeserializer" , new Version ( 1 , 0 , 0 , null ) ) ; simpleModule . addDeserializer ( AttachableResponse . class , new AttachableResponseDeserializer ( ) ) ; mapper . registerModule ( simpleModule ) ; mapper . configure ( DeserializationFeature . FAIL_ON_UNKNOWN_PROPERTIES , false ) ; return mapper . treeToValue ( jsonNode , AttachableResponse . class ) ; |
public class CommercePriceListAccountRelServiceBaseImpl { /** * Sets the commerce price list user segment entry rel remote service .
* @ param commercePriceListUserSegmentEntryRelService the commerce price list user segment entry rel remote service */
public void setCommercePriceListUserSegmentEntryRelService ( com . liferay . commerce . price . list . service . CommercePriceListUserSegmentEntryRelService commercePriceListUserSegmentEntryRelService ) { } } | this . commercePriceListUserSegmentEntryRelService = commercePriceListUserSegmentEntryRelService ; |
public class AdminUserUrl { /** * Get Resource Url for GetTenantScopesForUser
* @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter should only be used to retrieve data . Attempting to update data using this parameter may cause data loss .
* @ param userId Unique identifier of the user whose tenant scopes you want to retrieve .
* @ return String Resource Url */
public static MozuUrl getTenantScopesForUserUrl ( String responseFields , String userId ) { } } | UrlFormatter formatter = new UrlFormatter ( "/api/platform/adminuser/accounts/{userId}/tenants?responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "userId" , userId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ; |
public class SmooshedFileMapper { /** * Returns a mapped buffer of the smooshed file with the given name . Buffer ' s contents from 0 to capacity ( ) are the
* whole mapped file contents , limit ( ) is equal to capacity ( ) . */
public ByteBuffer mapFile ( String name ) throws IOException { } } | final Metadata metadata = internalFiles . get ( name ) ; if ( metadata == null ) { return null ; } final int fileNum = metadata . getFileNum ( ) ; while ( buffersList . size ( ) <= fileNum ) { buffersList . add ( null ) ; } MappedByteBuffer mappedBuffer = buffersList . get ( fileNum ) ; if ( mappedBuffer == null ) { mappedBuffer = Files . map ( outFiles . get ( fileNum ) ) ; buffersList . set ( fileNum , mappedBuffer ) ; } ByteBuffer retVal = mappedBuffer . duplicate ( ) ; retVal . position ( metadata . getStartOffset ( ) ) . limit ( metadata . getEndOffset ( ) ) ; return retVal . slice ( ) ; |
public class ChainedTransformationTools { /** * Transform a path address .
* @ param original the path address to be transformed
* @ param target the transformation target
* @ return the transformed path address */
public static PathAddress transformAddress ( final PathAddress original , final TransformationTarget target ) { } } | return TransformersImpl . transformAddress ( original , target ) ; |
public class AbstractBatch { /** * Flushes the pending batches .
* @ implSpec Same as { @ link # flush ( boolean ) } with { @ link false } . */
public void flush ( ) { } } | List < BatchEntry > temp ; bufferLock . lock ( ) ; try { // Reset the last flush timestamp , even if the batch is empty or flush fails
lastFlush = System . currentTimeMillis ( ) ; // No - op if batch is empty
if ( batch == batchSize ) { logger . trace ( "[{}] Batch empty, not flushing" , name ) ; return ; } // Declare the batch empty , regardless of flush success / failure
batch = batchSize ; // If something goes wrong we still have a copy to recover .
temp = buffer ; buffer = new LinkedList < > ( ) ; } finally { bufferLock . unlock ( ) ; } long start = System . currentTimeMillis ( ) ; try { flushTransactionLock . lock ( ) ; start = System . currentTimeMillis ( ) ; processBatch ( temp ) ; logger . trace ( "[{}] Batch flushed. Took {} ms, {} rows." , name , ( System . currentTimeMillis ( ) - start ) , temp . size ( ) ) ; } catch ( final Exception e ) { if ( this . maxFlushRetries > 0 ) { logger . warn ( dev , "[{}] Error occurred while flushing. Retrying." , name , e ) ; } boolean success = false ; int retryCount ; for ( retryCount = 0 ; retryCount < this . maxFlushRetries && ! success ; retryCount ++ ) { try { Thread . sleep ( this . flushRetryDelay ) ; // If the connection was established , we might need a rollback .
if ( de . checkConnection ( ) && de . isTransactionActive ( ) ) { de . rollback ( ) ; } processBatch ( temp ) ; success = true ; } catch ( final InterruptedException ex ) { logger . debug ( "Interrupted while trying to flush batch. Stopping retries." ) ; Thread . currentThread ( ) . interrupt ( ) ; break ; } catch ( final Exception ex ) { logger . warn ( dev , "[{}] Error occurred while flushing (retry attempt {})." , name , retryCount + 1 , ex ) ; } } if ( ! success ) { try { if ( de . isTransactionActive ( ) ) { de . rollback ( ) ; } } catch ( final Exception ee ) { ee . addSuppressed ( e ) ; logger . trace ( "[{}] Batch failed to check the flush transaction state" , name , ee ) ; } onFlushFailure ( temp . toArray ( new BatchEntry [ temp . size ( ) ] ) ) ; logger . error ( dev , "[{}] Error occurred while flushing. Aborting batch flush." , name , e ) ; } else { logger . trace ( "[{}] Batch flushed. Took {} ms, {} retries, {} rows." , name , ( System . currentTimeMillis ( ) - start ) , retryCount , temp . size ( ) ) ; } } finally { try { if ( de . isTransactionActive ( ) ) { de . rollback ( ) ; } } catch ( final Exception e ) { logger . trace ( "[{}] Batch failed to check the flush transaction state" , name , e ) ; } finally { flushTransactionLock . unlock ( ) ; } } |
public class JSchemaInterpreterImpl { /** * Method to retrieve ( and possibly construct ) the MessageMap for a particular
* combination of choices . */
static public MessageMap getMessageMap ( JSchema sfs , int [ ] choices ) throws JMFUninitializedAccessException { } } | BigInteger multiChoice = MessageMap . getMultiChoice ( choices , sfs ) ; return getMessageMap ( sfs , multiChoice ) ; |
public class HttpOutboundLink { /** * @ see
* com . ibm . wsspi . channelfw . base . OutboundProtocolLink # ready ( com . ibm . wsspi . channelfw
* . VirtualConnection ) */
public void ready ( VirtualConnection inVC ) { } } | if ( ! this . reconnecting ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Outbound ready for " + this + " " + inVC ) ; } super . ready ( inVC ) ; } else { this . reconnecting = false ; this . reconnectException = null ; // on the reconnect , inform the outbound SC to re - send the request
// message that failed .
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Outbound reconnect finished for " + this + " " + inVC ) ; } this . myInterface . nowReconnectedAsync ( ) ; } |
public class RegistryUtility { /** * Adds an Netty encoder to Registry . < br >
* 向Registry中增加一个给Netty用的encoder 。
* @ param contextThe CamelContext must be based on CombinedRegistry , otherwise ClassCastException will be thrown . < br >
* 这个context必须是采用CombinedRegistry类型的Registry的 , 否则会抛出格式转换异常 。
* @ param nameName of the encoder in Registry . < br >
* encoder在Registry中的名字 。
* @ param encoderThe encoder that will be used by Netty . < br >
* 将被Netty用到的encoder 。 */
@ SuppressWarnings ( "unchecked" ) static public void addEncoder ( CamelContext context , String name , ChannelDownstreamHandler encoder ) { } } | CombinedRegistry registry = getCombinedRegistry ( context ) ; addCodecOnly ( registry , name , encoder ) ; List < ChannelDownstreamHandler > encoders ; Object o = registry . lookup ( NAME_ENCODERS ) ; if ( o == null ) { encoders = new ArrayList < ChannelDownstreamHandler > ( ) ; registry . getDefaultSimpleRegistry ( ) . put ( NAME_ENCODERS , encoders ) ; } else { try { encoders = ( List < ChannelDownstreamHandler > ) o ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Preserved name '" + NAME_ENCODERS + "' is already being used by others in at least one of the registries." ) ; } } encoders . add ( encoder ) ; |
public class IslandCollection { /** * Return whether a coordinate overlaps with an already committed coordinate */
@ Override public boolean doesCoordinateOverlapWithCommittedCoordinate ( Coordinate coordinate ) { } } | return fixedRows . get ( coordinate . row ) || fixedVertices . contains ( coordinate . match . vertex ) ; |
public class NNLatencyBenchmark { @ Override public int run ( String [ ] args ) throws Exception { } } | parseArgs ( args ) ; // Create results file
FileWriter results = new FileWriter ( resultsFile , true ) ; // Run all benchmarks
int failed = 0 ; for ( Method method : NNLatencyBenchmark . class . getMethods ( ) ) { if ( method . isAnnotationPresent ( Benchmark . class ) ) { results . write ( method . getName ( ) + " : " ) ; try { setUp ( ) ; try { method . invoke ( this , results ) ; } finally { tearDown ( ) ; } } catch ( Throwable e ) { failed ++ ; LOG . error ( method . getName ( ) + " failed with: " , e ) ; } results . write ( "\n" ) ; } } results . close ( ) ; return - failed ; |
public class Role { /** * Returns for given parameter < i > _ uuid < / i > the instance of class
* { @ link Role } .
* @ param _ uuid UUI to search for
* @ return instance of class { @ link Role }
* @ throws CacheReloadException on error
* @ see # CACHE */
public static Role get ( final UUID _uuid ) throws CacheReloadException { } } | final Cache < UUID , Role > cache = InfinispanCache . get ( ) . < UUID , Role > getCache ( Role . UUIDCACHE ) ; if ( ! cache . containsKey ( _uuid ) ) { Role . getRoleFromDB ( Role . SQL_UUID , String . valueOf ( _uuid ) ) ; } return cache . get ( _uuid ) ; |
public class SearchableString { /** * Indicates whether this instance starts with the specified prefix .
* @ param literal The prefix that should be tested
* @ return < code > true < / code > if the argument represents the prefix of this instance , < code > false < / code > otherwise . */
boolean startsWith ( final Literal literal ) { } } | // Check whether the answer is already in the cache
final int index = literal . getIndex ( ) ; final Boolean cached = myPrefixCache . get ( index ) ; if ( cached != null ) { return cached . booleanValue ( ) ; } // Get the answer and cache the result
final boolean result = literal . matches ( myChars , 0 ) ; myPrefixCache . set ( index , result ) ; return result ; |
public class ElevationUtil { /** * Creates and returns a bitmap , which can be used to emulate a shadow of an elevated view on
* pre - Lollipop devices . By default a non - parallel illumination of the view is emulated , which
* causes the shadow at its bottom to appear a bit more intense than the shadows to its left and
* right and a lot more intense than the shadow at its top .
* @ param context
* The context , which should be used , as an instance of the class { @ link Context } . The
* context may not be null
* @ param elevation
* The elevation , which should be emulated , in dp as an { @ link Integer } value . The
* elevation must be at least 0 and at maximum the value of the constant
* < code > MAX _ ELEVATION < / code >
* @ param orientation
* The orientation of the shadow in relation to the elevated view as a value of the enum
* { @ link Orientation } . The orientation may either be < code > LEFT < / code > ,
* < code > RIGHT < / code > , < code > TOP < / code > , < code > BOTTOM < / code > , < code > TOP _ LEFT < / code > ,
* < code > TOP _ RIGHT < / code > , < code > BOTTOM _ LEFT < / code > or < code > BOTTOM _ RIGHT < / code >
* @ return The bitmap , which has been created , as an instance of the class { @ link Bitmap } or
* null , if the given elevation is 0 */
public static Bitmap createElevationShadow ( @ NonNull final Context context , final int elevation , @ NonNull final Orientation orientation ) { } } | return createElevationShadow ( context , elevation , orientation , false ) ; |
public class Subtypes2 { /** * Starting at the class or interface named by the given ClassDescriptor ,
* traverse the inheritance graph depth first , visiting each class only
* once . This is much faster than traversing all paths in certain circumstances .
* @ param start
* ClassDescriptor naming the class where the traversal should
* start
* @ param visitor
* an InheritanceGraphVisitor
* @ throws ClassNotFoundException
* if the start vertex cannot be resolved */
public void traverseSupertypesDepthFirst ( ClassDescriptor start , SupertypeTraversalVisitor visitor ) throws ClassNotFoundException { } } | this . traverseSupertypesDepthFirstHelper ( start , visitor , new HashSet < ClassDescriptor > ( ) ) ; |
public class JDBCXAResource { /** * Per the JDBC 3.0 spec , this rolls back the transaction for the
* specified Xid , not necessarily for the transaction associated
* with this XAResource object . */
public void rollback ( Xid xid ) throws XAException { } } | JDBCXAResource resource = xaDataSource . getResource ( xid ) ; if ( resource == null ) { throw new XAException ( "The XADataSource has no such Xid in prepared state: " + xid ) ; } resource . rollbackThis ( ) ; |
public class ResourcesCompat { /** * Support implementation of { @ code getResources ( ) . getInteger ( ) } that we
* can use to simulate filtering based on width qualifiers on pre - 3.2.
* @ param context Context to load integers from on 3.2 + and to fetch the
* display metrics .
* @ param id Id of integer to load .
* @ return Associated integer value as reflected by the current display
* metrics . */
public static int getResources_getInteger ( Context context , int id ) { } } | if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . HONEYCOMB_MR2 ) { return context . getResources ( ) . getInteger ( id ) ; } DisplayMetrics metrics = context . getResources ( ) . getDisplayMetrics ( ) ; float widthDp = metrics . widthPixels / metrics . density ; if ( id == R . integer . abs__max_action_buttons ) { if ( widthDp >= 600 ) { return 5 ; // values - w600dp
} if ( widthDp >= 500 ) { return 4 ; // values - w500dp
} if ( widthDp >= 360 ) { return 3 ; // values - w360dp
} return 2 ; // values
} throw new IllegalArgumentException ( "Unknown integer resource ID " + id ) ; |
public class CPRuleUserSegmentRelModelImpl { /** * Converts the soap model instances into normal model instances .
* @ param soapModels the soap model instances to convert
* @ return the normal model instances */
public static List < CPRuleUserSegmentRel > toModels ( CPRuleUserSegmentRelSoap [ ] soapModels ) { } } | if ( soapModels == null ) { return null ; } List < CPRuleUserSegmentRel > models = new ArrayList < CPRuleUserSegmentRel > ( soapModels . length ) ; for ( CPRuleUserSegmentRelSoap soapModel : soapModels ) { models . add ( toModel ( soapModel ) ) ; } return models ; |
public class CommonDataAccess { /** * Should only be used with MDW data source */
public TransactionWrapper startTransaction ( ) throws DataAccessException { } } | TransactionWrapper transaction = new TransactionWrapper ( ) ; TransactionUtil transUtil = TransactionUtil . getInstance ( ) ; TransactionManager transManager = transUtil . getTransactionManager ( ) ; try { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "startTransaction - transaction manager=" + transManager . hashCode ( ) + " (status=" + transManager . getStatus ( ) + ")" ) ; } transaction . setDatabaseAccess ( db ) ; if ( transManager . getStatus ( ) == Status . STATUS_NO_TRANSACTION ) { transaction . setTransactionAlreadyStarted ( false ) ; // Get connection BEFORE beginning transaction to avoid transaction timeout ( 10 minutes ) exceptions ( Fail to stop the transaction )
db . openConnection ( ) . setAutoCommit ( false ) ; // Also set autoCommit to false
transManager . begin ( ) ; transUtil . setCurrentConnection ( db . getConnection ( ) ) ; } else { if ( logger . isTraceEnabled ( ) ) logger . trace ( " ... transaction already started, status=" + transManager . getStatus ( ) ) ; transaction . setTransactionAlreadyStarted ( true ) ; if ( db . connectionIsOpen ( ) ) { transaction . setDatabaseConnectionAlreadyOpened ( true ) ; } else { if ( logger . isTraceEnabled ( ) ) logger . trace ( " ... but database is not open" ) ; // not opened through this DatabaseAccess
transaction . setDatabaseConnectionAlreadyOpened ( false ) ; if ( transUtil . getCurrentConnection ( ) == null ) { db . openConnection ( ) . setAutoCommit ( false ) ; // Set autoCommit to false
transUtil . setCurrentConnection ( db . getConnection ( ) ) ; } else { db . setConnection ( transUtil . getCurrentConnection ( ) ) ; } } } transaction . setTransaction ( transManager . getTransaction ( ) ) ; return transaction ; } catch ( Throwable e ) { if ( transaction . getTransaction ( ) != null ) stopTransaction ( transaction ) ; throw new DataAccessException ( 0 , "Fail to start transaction" , e ) ; } |
public class CheckGroupMembershipControl { /** * Returns true if the requested property is set ; false , otherwise .
* @ return
* returned object is { @ link boolean } */
@ Override public boolean isSet ( String propName ) { } } | if ( propName . equals ( "level" ) ) { return isSetLevel ( ) ; } if ( propName . equals ( "inGroup" ) ) { return isSetInGroup ( ) ; } return super . isSet ( propName ) ; |
public class BeanELResolver { /** * If the base object is not < code > null < / code > , returns the current
* value of the given property on this bean .
* < p > If the base is not < code > null < / code > , the
* < code > propertyResolved < / code > property of the < code > ELContext < / code >
* object must be set to < code > true < / code > by this resolver , before
* returning . If this property is not < code > true < / code > after this
* method is called , the caller should ignore the return value . < / p >
* < p > The provided property name will first be coerced to a
* < code > String < / code > . If the property is a readable property of the
* base object , as per the JavaBeans specification , then return the
* result of the getter call . If the getter throws an exception ,
* it is propagated to the caller . If the property is not found or is
* not readable , a < code > PropertyNotFoundException < / code > is thrown . < / p >
* @ param context The context of this evaluation .
* @ param base The bean on which to get the property .
* @ param property The name of the property to get . Will be coerced to
* a < code > String < / code > .
* @ return If the < code > propertyResolved < / code > property of
* < code > ELContext < / code > was set to < code > true < / code > , then
* the value of the given property . Otherwise , undefined .
* @ throws NullPointerException if context is < code > null < / code > .
* @ throws PropertyNotFoundException if < code > base < / code > is not
* < code > null < / code > and the specified property does not exist
* or is not readable .
* @ throws ELException if an exception was thrown while performing
* the property or variable resolution . The thrown exception
* must be included as the cause property of this exception , if
* available . */
public Object getValue ( ELContext context , Object base , Object property ) { } } | if ( context == null ) { throw new NullPointerException ( ) ; } if ( base == null || property == null ) { return null ; } BeanProperty bp = getBeanProperty ( context , base , property ) ; Method method = bp . getReadMethod ( ) ; if ( method == null ) { throw new PropertyNotFoundException ( ELUtil . getExceptionMessageString ( context , "propertyNotReadable" , new Object [ ] { base . getClass ( ) . getName ( ) , property . toString ( ) } ) ) ; } Object value ; try { value = method . invoke ( base , new Object [ 0 ] ) ; context . setPropertyResolved ( base , property ) ; } catch ( ELException ex ) { throw ex ; } catch ( InvocationTargetException ite ) { throw new ELException ( ite . getCause ( ) ) ; } catch ( Exception ex ) { throw new ELException ( ex ) ; } return value ; |
public class NetworkInterfacesInner { /** * Get the specified network interface ip configuration in a virtual machine scale set .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; NetworkInterfaceIPConfigurationInner & gt ; object */
public Observable < ServiceResponse < Page < NetworkInterfaceIPConfigurationInner > > > listVirtualMachineScaleSetIpConfigurationsNextWithServiceResponseAsync ( final String nextPageLink ) { } } | return listVirtualMachineScaleSetIpConfigurationsNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < NetworkInterfaceIPConfigurationInner > > , Observable < ServiceResponse < Page < NetworkInterfaceIPConfigurationInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < NetworkInterfaceIPConfigurationInner > > > call ( ServiceResponse < Page < NetworkInterfaceIPConfigurationInner > > page ) { String nextPageLink = page . body ( ) . nextPageLink ( ) ; if ( nextPageLink == null ) { return Observable . just ( page ) ; } return Observable . just ( page ) . concatWith ( listVirtualMachineScaleSetIpConfigurationsNextWithServiceResponseAsync ( nextPageLink ) ) ; } } ) ; |
public class HttpSessionsPanel { /** * Gets the selected http session .
* @ return the selected session , or null if nothing is selected */
public HttpSession getSelectedSession ( ) { } } | final int selectedRow = this . sessionsTable . getSelectedRow ( ) ; if ( selectedRow == - 1 ) { // No row selected
return null ; } final int rowIndex = sessionsTable . convertRowIndexToModel ( selectedRow ) ; return this . sessionsModel . getHttpSessionAt ( rowIndex ) ; |
public class pqpolicy { /** * Use this API to add pqpolicy . */
public static base_response add ( nitro_service client , pqpolicy resource ) throws Exception { } } | pqpolicy addresource = new pqpolicy ( ) ; addresource . policyname = resource . policyname ; addresource . rule = resource . rule ; addresource . priority = resource . priority ; addresource . weight = resource . weight ; addresource . qdepth = resource . qdepth ; addresource . polqdepth = resource . polqdepth ; return addresource . add_resource ( client ) ; |
public class NTLMResponses { /** * Calculates the LMv2 Response for the given challenge , using the
* specified authentication target , username , password , and client
* challenge .
* @ param target The authentication target ( i . e . , domain ) .
* @ param user The username .
* @ param password The user ' s password .
* @ param challenge The Type 2 challenge from the server .
* @ param clientNonce The random 8 - byte client nonce .
* @ return The LMv2 Response . */
public static byte [ ] getLMv2Response ( String target , String user , String password , byte [ ] challenge , byte [ ] clientNonce ) throws Exception { } } | byte [ ] ntlmv2Hash = ntlmv2Hash ( target , user , password ) ; return lmv2Response ( ntlmv2Hash , clientNonce , challenge ) ; |
public class Container { /** * Deploy an archive .
* @ param deployment The ShrinkWrap archive to deploy .
* @ return The container .
* @ throws DeploymentException if an error occurs . */
public Container deploy ( Archive < ? > deployment ) throws DeploymentException { } } | if ( ! this . running ) { throw new RuntimeException ( "The Container has not been started." ) ; } this . deployer . deploy ( deployment ) ; return this ; |
public class AbstractAttributeDefinitionBuilder { /** * Removes { @ link AttributeDefinition # getAlternatives ( ) names of alternative attributes } from the set of those that should not
* be defined if this attribute is defined .
* @ param alternatives the attribute names
* @ return a builder that can be used to continue building the attribute definition */
@ SuppressWarnings ( "deprecation" ) public final BUILDER removeAlternatives ( String ... alternatives ) { } } | if ( this . alternatives == null ) { return ( BUILDER ) this ; } else { for ( String alternative : alternatives ) { if ( isAlternativePresent ( alternative ) ) { int length = this . alternatives . length ; String [ ] newAlternatives = new String [ length - 1 ] ; int k = 0 ; for ( String alt : this . alternatives ) { if ( ! alt . equals ( alternative ) ) { newAlternatives [ k ] = alt ; k ++ ; } } this . alternatives = newAlternatives ; } } } return ( BUILDER ) this ; |
public class WriterState { /** * Sets the Sequence Number of the last Truncated Operation .
* @ param value The Sequence Number to set . */
void setLastTruncatedSequenceNumber ( long value ) { } } | Preconditions . checkArgument ( value >= this . lastTruncatedSequenceNumber . get ( ) , "New LastTruncatedSequenceNumber cannot be smaller than the previous one." ) ; this . lastTruncatedSequenceNumber . set ( value ) ; |
public class GoodsSpecifics { /** * < p > Setter for specifics . < / p >
* @ param pSpecifics reference */
@ Override public final void setSpecifics ( final SpecificsOfItem pSpecifics ) { } } | this . specifics = pSpecifics ; if ( this . itsId == null ) { this . itsId = new GoodsSpecificsId ( ) ; } this . itsId . setSpecifics ( this . specifics ) ; |
public class URLEncodedUtil { /** * Decode / unescape www - url - form - encoded content .
* @ param content
* the content to decode , will decode ' + ' as space
* @ param charset
* the charset to use
* @ return encoded string */
private static String decodeFormFields ( final String content , final Charset charset ) { } } | if ( content == null ) { return null ; } return urlDecode ( content , ( charset != null ) ? charset : Charsets . UTF_8 , true ) ; |
public class AbstractCubicSpline { /** * Returns class cached DoubleMatrix with decompose already called .
* @ param n
* @ return */
protected DoubleMatrix getMatrix ( int n ) { } } | Map < Integer , DoubleMatrix > degreeMap = matrixCache . get ( this . getClass ( ) ) ; if ( degreeMap == null ) { degreeMap = new HashMap < > ( ) ; matrixCache . put ( this . getClass ( ) , degreeMap ) ; } DoubleMatrix m = degreeMap . get ( n ) ; if ( m == null ) { m = createMatrix ( n ) ; m . decompose ( ) ; degreeMap . put ( n , m ) ; } return m ; |
public class HtmlBaseTag { /** * Sets the onClick javascript event .
* @ param onclick the onClick event .
* @ jsptagref . attributedescription The onClick JavaScript event .
* @ jsptagref . databindable false
* @ jsptagref . attributesyntaxvalue < i > string _ onClick < / i >
* @ netui : attribute required = " false " rtexprvalue = " true "
* description = " The onClick JavaScript event . " */
public void setOnClick ( String onclick ) { } } | AbstractHtmlState tsh = getState ( ) ; tsh . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , ONCLICK , onclick ) ; |
public class HysteresisEdgeTracePoints { /** * Performs hysteresis thresholding using the provided lower and upper thresholds .
* @ param intensity Intensity image after edge non - maximum suppression has been applied . Modified .
* @ param direction 4 - direction image . Not modified .
* @ param lower Lower threshold .
* @ param upper Upper threshold . */
public void process ( GrayF32 intensity , GrayS8 direction , float lower , float upper ) { } } | if ( lower < 0 ) throw new IllegalArgumentException ( "Lower must be >= 0!" ) ; InputSanityCheck . checkSameShape ( intensity , direction ) ; // set up internal data structures
this . intensity = intensity ; this . direction = direction ; this . lower = lower ; queuePoints . reset ( ) ; contours . clear ( ) ; // step through each pixel in the image
for ( int y = 0 ; y < intensity . height ; y ++ ) { int indexInten = intensity . startIndex + y * intensity . stride ; for ( int x = 0 ; x < intensity . width ; x ++ , indexInten ++ ) { // start a search if a pixel is found that ' s above the threshold
if ( intensity . data [ indexInten ] >= upper ) { trace ( x , y , indexInten ) ; } } } |
public class DefaultNodeManager { /** * Handles a file upload . */
private Handler < Message < Buffer > > handleUpload ( final AsyncFile file , final String address ) { } } | final AtomicLong position = new AtomicLong ( ) ; return new Handler < Message < Buffer > > ( ) { @ Override public void handle ( final Message < Buffer > message ) { final Handler < Message < Buffer > > handler = this ; final Buffer buffer = message . body ( ) ; if ( buffer . length ( ) > 0 ) { file . write ( buffer , position . get ( ) , new Handler < AsyncResult < Void > > ( ) { @ Override public void handle ( AsyncResult < Void > result ) { if ( result . failed ( ) ) { file . close ( ) ; message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , result . cause ( ) . getMessage ( ) ) ) ; vertx . eventBus ( ) . unregisterHandler ( address , handler ) ; } else { position . addAndGet ( buffer . length ( ) ) ; message . reply ( new JsonObject ( ) . putString ( "status" , "ok" ) ) ; } } } ) ; } else { file . flush ( new Handler < AsyncResult < Void > > ( ) { @ Override public void handle ( AsyncResult < Void > result ) { if ( result . failed ( ) ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , result . cause ( ) . getMessage ( ) ) ) ; vertx . eventBus ( ) . unregisterHandler ( address , handler ) ; } else { file . close ( new Handler < AsyncResult < Void > > ( ) { @ Override public void handle ( AsyncResult < Void > result ) { if ( result . failed ( ) ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , result . cause ( ) . getMessage ( ) ) ) ; vertx . eventBus ( ) . unregisterHandler ( address , handler ) ; } else { vertx . eventBus ( ) . unregisterHandler ( address , handler , new Handler < AsyncResult < Void > > ( ) { @ Override public void handle ( AsyncResult < Void > result ) { message . reply ( new JsonObject ( ) . putString ( "status" , "ok" ) ) ; } } ) ; } } } ) ; } } } ) ; } } } ; |
public class SimpleFormatConversionProvider { /** * This implementation assumes that the converter can convert from each of
* its source formats to each of its target formats . If this is not the
* case , the converter has to override this method .
* @ param targetEncoding
* @ param sourceFormat
* @ return */
@ Override public AudioFormat [ ] getTargetFormats ( AudioFormat . Encoding targetEncoding , AudioFormat sourceFormat ) { } } | if ( isConversionSupported ( targetEncoding , sourceFormat ) ) { return m_targetFormats . toArray ( EMPTY_FORMAT_ARRAY ) ; } else { return EMPTY_FORMAT_ARRAY ; } |
public class ModelHandlerManagerImp { /** * get the model instance from the cache */
public Object getCache ( ModelKey modelKey ) { } } | String modelClassName = null ; if ( modelKey . getModelClass ( ) == null ) { ModelMapping modelMapping = this . modelFactory . getModelMapping ( modelKey . getFormName ( ) ) ; modelClassName = modelMapping . getClassName ( ) ; } else modelClassName = modelKey . getModelClass ( ) . getName ( ) ; return modelCacheManager . getCache ( modelKey . getDataKey ( ) , modelClassName ) ; |
public class SymbolTable { /** * Removes symbols where the namespace they ' re on has been removed .
* < p > After filling property scopes , we may have two symbols represented in different ways . For
* example , " A . superClass _ . foo " and B . prototype . foo " .
* < p > This resolves that ambiguity by pruning the duplicates . If we have a lexical symbol with a
* constructor in its property chain , then we assume there ' s also a property path to this symbol .
* In other words , we can remove " A . superClass _ . foo " because it ' s rooted at " A " , and we built a
* property scope for " A " above . */
void pruneOrphanedNames ( ) { } } | nextSymbol : for ( Symbol s : getAllSymbols ( ) ) { if ( s . isProperty ( ) ) { continue ; } String currentName = s . getName ( ) ; int dot = - 1 ; while ( - 1 != ( dot = currentName . lastIndexOf ( '.' ) ) ) { currentName = currentName . substring ( 0 , dot ) ; Symbol owner = s . scope . getQualifiedSlot ( currentName ) ; if ( owner != null && getType ( owner ) != null && ( getType ( owner ) . isNominalConstructor ( ) || getType ( owner ) . isFunctionPrototypeType ( ) || getType ( owner ) . isEnumType ( ) ) ) { removeSymbol ( s ) ; continue nextSymbol ; } } } |
public class ApiOvhOrder { /** * Get allowed durations for ' upgrade ' option
* REST : GET / order / license / sqlserver / { serviceName } / upgrade
* @ param version [ required ] This license version
* @ param serviceName [ required ] The name of your SQL Server license */
public ArrayList < String > license_sqlserver_serviceName_upgrade_GET ( String serviceName , OvhSqlServerVersionEnum version ) throws IOException { } } | String qPath = "/order/license/sqlserver/{serviceName}/upgrade" ; StringBuilder sb = path ( qPath , serviceName ) ; query ( sb , "version" , version ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t1 ) ; |
public class XpathUtils { /** * Evaluates the specified XPath expression and returns the result as an
* Integer .
* This method can be expensive as a new xpath is instantiated per
* invocation . Consider passing in the xpath explicitly via {
* { @ link # asDouble ( String , Node , XPath ) } instead . Note { @ link XPath } is
* not thread - safe and not reentrant .
* @ param expression
* The XPath expression to evaluate .
* @ param node
* The node to run the expression on .
* @ return The Integer result .
* @ throws XPathExpressionException
* If there was a problem processing the specified XPath
* expression . */
public static Integer asInteger ( String expression , Node node ) throws XPathExpressionException { } } | return asInteger ( expression , node , xpath ( ) ) ; |
public class ResultBuilder { /** * This method will send the text to a client verbatim . It will not use any layouts . Use it to build app . services
* and to support AJAX .
* @ param text A string containing & quot ; { index } & quot ; , like so : & quot ; Message : { 0 } , error : { 1 } & quot ;
* @ param objects A varargs of objects to be put into the < code > text < / code >
* @ return { @ link HttpSupport . HttpBuilder } , to accept additional information .
* @ see MessageFormat # format */
public Result text ( String text , Object ... objects ) { } } | return text ( MessageFormat . format ( text , objects ) ) ; |
public class AmazonLexModelBuildingClient { /** * Returns information about an Amazon Lex bot alias . For more information about aliases , see
* < a > versioning - aliases < / a > .
* This operation requires permissions for the < code > lex : GetBotAlias < / code > action .
* @ param getBotAliasRequest
* @ return Result of the GetBotAlias operation returned by the service .
* @ throws NotFoundException
* The resource specified in the request was not found . Check the resource and try again .
* @ throws LimitExceededException
* The request exceeded a limit . Try your request again .
* @ throws InternalFailureException
* An internal Amazon Lex error occurred . Try your request again .
* @ throws BadRequestException
* The request is not well formed . For example , a value is invalid or a required field is missing . Check the
* field values , and try again .
* @ sample AmazonLexModelBuilding . GetBotAlias
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / lex - models - 2017-04-19 / GetBotAlias " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public GetBotAliasResult getBotAlias ( GetBotAliasRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetBotAlias ( request ) ; |
public class ChunkAnnotationUtils { /** * Create a new chunk Annotation with basic chunk information
* CharacterOffsetBeginAnnotation - set to CharacterOffsetBeginAnnotation of first token in chunk
* CharacterOffsetEndAnnotation - set to CharacterOffsetEndAnnotation of last token in chunk
* TokensAnnotation - List of tokens in this chunk
* TokenBeginAnnotation - Index of first token in chunk ( index in original list of tokens )
* tokenStartIndex + totalTokenOffset
* TokenEndAnnotation - Index of last token in chunk ( index in original list of tokens )
* tokenEndIndex + totalTokenOffset
* @ param tokens - List of tokens to look for chunks
* @ param tokenStartIndex - Index ( relative to current list of tokens ) at which this chunk starts
* @ param tokenEndIndex - Index ( relative to current list of tokens ) at which this chunk ends ( not inclusive )
* @ param totalTokenOffset - Index of tokens to offset by
* @ return Annotation representing new chunk */
public static Annotation getAnnotatedChunk ( List < CoreLabel > tokens , int tokenStartIndex , int tokenEndIndex , int totalTokenOffset ) { } } | Annotation chunk = new Annotation ( "" ) ; annotateChunk ( chunk , tokens , tokenStartIndex , tokenEndIndex , totalTokenOffset ) ; return chunk ; |
public class VirtualNetworkGatewaysInner { /** * Gets all the connections in a virtual network gateway .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; VirtualNetworkGatewayConnectionListEntityInner & gt ; object */
public Observable < ServiceResponse < Page < VirtualNetworkGatewayConnectionListEntityInner > > > listConnectionsNextWithServiceResponseAsync ( final String nextPageLink ) { } } | return listConnectionsNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < VirtualNetworkGatewayConnectionListEntityInner > > , Observable < ServiceResponse < Page < VirtualNetworkGatewayConnectionListEntityInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < VirtualNetworkGatewayConnectionListEntityInner > > > call ( ServiceResponse < Page < VirtualNetworkGatewayConnectionListEntityInner > > page ) { String nextPageLink = page . body ( ) . nextPageLink ( ) ; if ( nextPageLink == null ) { return Observable . just ( page ) ; } return Observable . just ( page ) . concatWith ( listConnectionsNextWithServiceResponseAsync ( nextPageLink ) ) ; } } ) ; |
public class CodedInputStream { /** * Read a { @ code string } field value from the stream . */
public String readString ( ) throws IOException { } } | final int size = readRawVarint32 ( ) ; if ( size <= ( bufferSize - bufferPos ) && size > 0 ) { // Fast path : We already have the bytes in a contiguous buffer , so
// just copy directly from it .
final String result = new String ( buffer , bufferPos , size , "UTF-8" ) ; bufferPos += size ; return result ; } else { // Slow path : Build a byte array first then copy it .
return new String ( readRawBytes ( size ) , "UTF-8" ) ; } |
public class CustomStorableCodecFactory { /** * Note : This factory method is not abstract for backwards compatibility . */
protected < S extends Storable > CustomStorableCodec < S > createCodec ( Class < S > type , boolean isMaster , Layout layout , RawSupport support ) throws SupportException { } } | return createCodec ( type , isMaster , layout ) ; |
public class AbstractRedisStorage { /** * Attempt to remove lock
* @ return true if lock was successfully removed ; false otherwise */
public boolean unlock ( T jedis ) { } } | final String currentLock = jedis . get ( redisSchema . lockKey ( ) ) ; if ( ! isNullOrEmpty ( currentLock ) && UUID . fromString ( currentLock ) . equals ( lockValue ) ) { // This is our lock . We can remove it .
jedis . del ( redisSchema . lockKey ( ) ) ; return true ; } return false ; |
public class AmazonAutoScalingClient { /** * Describes the available types of lifecycle hooks .
* The following hook types are supported :
* < ul >
* < li >
* autoscaling : EC2 _ INSTANCE _ LAUNCHING
* < / li >
* < li >
* autoscaling : EC2 _ INSTANCE _ TERMINATING
* < / li >
* < / ul >
* @ param describeLifecycleHookTypesRequest
* @ return Result of the DescribeLifecycleHookTypes operation returned by the service .
* @ throws ResourceContentionException
* You already have a pending update to an Amazon EC2 Auto Scaling resource ( for example , an Auto Scaling
* group , instance , or load balancer ) .
* @ sample AmazonAutoScaling . DescribeLifecycleHookTypes
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / autoscaling - 2011-01-01 / DescribeLifecycleHookTypes "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DescribeLifecycleHookTypesResult describeLifecycleHookTypes ( DescribeLifecycleHookTypesRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeLifecycleHookTypes ( request ) ; |
public class FuncBoolean { /** * Execute the function . The function must return
* a valid object .
* @ param xctxt The current execution context .
* @ return A valid XObject .
* @ throws javax . xml . transform . TransformerException */
public XObject execute ( XPathContext xctxt ) throws javax . xml . transform . TransformerException { } } | return m_arg0 . execute ( xctxt ) . bool ( ) ? XBoolean . S_TRUE : XBoolean . S_FALSE ; |
public class ZooKeeperUpdatingListenerBuilder { /** * Sets the session timeout ( in ms ) . ( default : { @ value ZooKeeperDefaults # DEFAULT _ SESSION _ TIMEOUT _ MS } )
* @ param sessionTimeoutMillis the session timeout
* @ throws IllegalStateException if this builder is constructed with
* { @ link # ZooKeeperUpdatingListenerBuilder ( CuratorFramework , String ) } */
public ZooKeeperUpdatingListenerBuilder sessionTimeoutMillis ( long sessionTimeoutMillis ) { } } | ensureInternalClient ( ) ; checkArgument ( sessionTimeoutMillis > 0 , "sessionTimeoutMillis: %s (expected: > 0)" , sessionTimeoutMillis ) ; this . sessionTimeoutMillis = Ints . saturatedCast ( sessionTimeoutMillis ) ; return this ; |
public class XCostExtension { /** * Retrieves a map containing all cost drivers for all descending attributes
* of a trace .
* @ see # extractNestedAmounts ( XTrace )
* @ param trace
* Trace to retrieve all cost drivers for .
* @ return Map from all descending keys to cost drivers . */
public Map < List < String > , String > extractNestedDrivers ( XTrace trace ) { } } | return XCostDriver . instance ( ) . extractNestedValues ( trace ) ; |
public class Navigate { /** * Finishes current activity with provided result code and data . */
public void finish ( int resultCode , Intent data ) { } } | Activity activity = getActivity ( ) ; activity . setResult ( resultCode , data ) ; activity . finish ( ) ; setTransition ( true ) ; |
public class DRL5Lexer { /** * $ ANTLR start " C _ STYLE _ SINGLE _ LINE _ COMMENT " */
public final void mC_STYLE_SINGLE_LINE_COMMENT ( ) throws RecognitionException { } } | try { int _type = C_STYLE_SINGLE_LINE_COMMENT ; int _channel = DEFAULT_TOKEN_CHANNEL ; // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 319:5 : ( ' / / ' ( ~ ( ' \ \ r ' | ' \ \ n ' ) ) * ( EOL | EOF ) )
// src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 319:7 : ' / / ' ( ~ ( ' \ \ r ' | ' \ \ n ' ) ) * ( EOL | EOF )
{ match ( "//" ) ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 319:12 : ( ~ ( ' \ \ r ' | ' \ \ n ' ) ) *
loop57 : while ( true ) { int alt57 = 2 ; int LA57_0 = input . LA ( 1 ) ; if ( ( ( LA57_0 >= '\u0000' && LA57_0 <= '\t' ) || ( LA57_0 >= '\u000B' && LA57_0 <= '\f' ) || ( LA57_0 >= '\u000E' && LA57_0 <= '\uFFFF' ) ) ) { alt57 = 1 ; } switch ( alt57 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g :
{ if ( ( input . LA ( 1 ) >= '\u0000' && input . LA ( 1 ) <= '\t' ) || ( input . LA ( 1 ) >= '\u000B' && input . LA ( 1 ) <= '\f' ) || ( input . LA ( 1 ) >= '\u000E' && input . LA ( 1 ) <= '\uFFFF' ) ) { input . consume ( ) ; state . failed = false ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } } break ; default : break loop57 ; } } // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 319:28 : ( EOL | EOF )
int alt58 = 2 ; int LA58_0 = input . LA ( 1 ) ; if ( ( LA58_0 == '\n' || LA58_0 == '\r' ) ) { alt58 = 1 ; } else { alt58 = 2 ; } switch ( alt58 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 319:29 : EOL
{ mEOL ( ) ; if ( state . failed ) return ; } break ; case 2 : // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 319:33 : EOF
{ match ( EOF ) ; if ( state . failed ) return ; } break ; } if ( state . backtracking == 0 ) { _channel = HIDDEN ; } } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving
} |
public class GSCPImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . GSCP__XPOS : setXPOS ( ( Integer ) newValue ) ; return ; case AfplibPackage . GSCP__YPOS : setYPOS ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class TypeQualifierValue { /** * Get the " complementary " TypeQualifierValues for given exclusive type
* qualifier .
* @ param tqv
* a type qualifier ( which must be exclusive )
* @ return Collection of complementary exclusive type qualifiers */
public static Collection < TypeQualifierValue < ? > > getComplementaryExclusiveTypeQualifierValue ( TypeQualifierValue < ? > tqv ) { } } | assert tqv . isExclusiveQualifier ( ) ; LinkedList < TypeQualifierValue < ? > > result = new LinkedList < > ( ) ; for ( TypeQualifierValue < ? > t : instance . get ( ) . allKnownTypeQualifiers ) { // Any TypeQualifierValue with the same
// annotation class but a different value is a complementary
// type qualifier .
if ( t . typeQualifier . equals ( tqv . typeQualifier ) && ! Objects . equals ( t . value , tqv . value ) ) { result . add ( t ) ; } } return result ; |
public class TagResourceRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TagResourceRequest tagResourceRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( tagResourceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( tagResourceRequest . getResourceArn ( ) , RESOURCEARN_BINDING ) ; protocolMarshaller . marshall ( tagResourceRequest . getTagsModel ( ) , TAGSMODEL_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ClientLockManager { /** * Get the remote lock server .
* @ return The remote lock server . */
public RemoteLockSession getRemoteLockSession ( SessionInfo sessionInfo ) { } } | if ( m_lockServer == null ) { // Haven ' t done any locks yet , hook up with the lock server .
Application app = ( Application ) ( ( Environment ) m_owner ) . getDefaultApplication ( ) ; if ( m_gbRemoteTaskServer ) { String strServer = app . getAppServerName ( ) ; String strRemoteApp = DBParams . DEFAULT_REMOTE_LOCK ; String strUserID = null ; String strPassword = null ; m_lockServer = ( RemoteTask ) app . createRemoteTask ( strServer , strRemoteApp , strUserID , strPassword ) ; } if ( m_lockServer == null ) { m_gbRemoteTaskServer = false ; try { m_lockServer = new org . jbundle . base . remote . db . TaskSession ( app ) ; } catch ( RemoteException ex ) { ex . printStackTrace ( ) ; } } } RemoteLockSession remoteLockSession = ( RemoteLockSession ) sessionInfo . m_remoteLockSession ; if ( remoteLockSession == null ) { // Setup the remote lock server
try { if ( m_gbRemoteTaskServer ) { remoteLockSession = ( RemoteLockSession ) m_lockServer . makeRemoteSession ( LockSession . class . getName ( ) ) ; } else { remoteLockSession = new LockSession ( ( org . jbundle . base . remote . db . TaskSession ) m_lockServer ) ; } sessionInfo . m_remoteLockSession = remoteLockSession ; } catch ( RemoteException ex ) { ex . printStackTrace ( ) ; } } return remoteLockSession ; |
public class CorporationApi { /** * Get alliance history Get a list of all the alliances a corporation has
* been a member of - - - This route is cached for up to 3600 seconds
* @ param corporationId
* An EVE corporation ID ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ return List & lt ; CorporationAlliancesHistoryResponse & gt ;
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public List < CorporationAlliancesHistoryResponse > getCorporationsCorporationIdAlliancehistory ( Integer corporationId , String datasource , String ifNoneMatch ) throws ApiException { } } | ApiResponse < List < CorporationAlliancesHistoryResponse > > resp = getCorporationsCorporationIdAlliancehistoryWithHttpInfo ( corporationId , datasource , ifNoneMatch ) ; return resp . getData ( ) ; |
public class ProvisionedThroughputDescriptionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ProvisionedThroughputDescription provisionedThroughputDescription , ProtocolMarshaller protocolMarshaller ) { } } | if ( provisionedThroughputDescription == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( provisionedThroughputDescription . getLastIncreaseDateTime ( ) , LASTINCREASEDATETIME_BINDING ) ; protocolMarshaller . marshall ( provisionedThroughputDescription . getLastDecreaseDateTime ( ) , LASTDECREASEDATETIME_BINDING ) ; protocolMarshaller . marshall ( provisionedThroughputDescription . getNumberOfDecreasesToday ( ) , NUMBEROFDECREASESTODAY_BINDING ) ; protocolMarshaller . marshall ( provisionedThroughputDescription . getReadCapacityUnits ( ) , READCAPACITYUNITS_BINDING ) ; protocolMarshaller . marshall ( provisionedThroughputDescription . getWriteCapacityUnits ( ) , WRITECAPACITYUNITS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Put { /** * One or more values that can be substituted in an expression .
* @ param expressionAttributeValues
* One or more values that can be substituted in an expression .
* @ return Returns a reference to this object so that method calls can be chained together . */
public Put withExpressionAttributeValues ( java . util . Map < String , AttributeValue > expressionAttributeValues ) { } } | setExpressionAttributeValues ( expressionAttributeValues ) ; return this ; |
public class IPAccessHandler { /** * Set the standard action beeing taken when not registred IPs wants access
* @ param s The standard - string ( either ' allow ' or ' deny ' ) */
public void setStandard ( String s ) { } } | s = s . toLowerCase ( ) ; if ( s . indexOf ( "allow" ) > - 1 ) { standard = true ; } else { standard = false ; } |
public class GeneratorKeys { /** * Does not test for multiple qualifiers . This is tested in { @ code ValidationProcessor } . */
private static AnnotationMirror getQualifier ( List < ? extends AnnotationMirror > annotations ) { } } | AnnotationMirror qualifier = null ; for ( AnnotationMirror annotation : annotations ) { if ( annotation . getAnnotationType ( ) . asElement ( ) . getAnnotation ( Qualifier . class ) == null ) { continue ; } qualifier = annotation ; } return qualifier ; |
public class TransactionException { /** * Thrown when attempting to mutate a property which is immutable */
public static TransactionException immutableProperty ( Object oldValue , Object newValue , Enum vertexProperty ) { } } | return create ( ErrorMessage . IMMUTABLE_VALUE . getMessage ( oldValue , newValue , vertexProperty . name ( ) ) ) ; |
public class LockAdviser { /** * Reads { @ link LockAdviser # lockPath lock path directory } and finds the
* { @ link File read lock files } , if any .
* @ return the { @ link Set set } of { @ link read lock files } , or an empty
* { @ link Set } if no read locks exist */
private Set < File > getReadLocks ( ) { } } | final Set < File > readLocks = new HashSet < File > ( ) ; File [ ] lckFiles = this . lockPath . listFiles ( lockFilter ) ; for ( final File lckFile : lckFiles ) { if ( lockFilter . isReaderLockFile ( lckFile ) ) { readLocks . add ( lckFile ) ; } } return readLocks ; |
public class CmsSitemapData { /** * Gets the new resource info with a given structure id . < p >
* @ param id the structure id
* @ return the new resource info with the given id */
public CmsNewResourceInfo getNewResourceInfoById ( CmsUUID id ) { } } | if ( m_newElementInfos != null ) { for ( CmsNewResourceInfo info : m_newElementInfos ) { if ( info . getCopyResourceId ( ) . equals ( id ) ) { return info ; } } } return null ; |
public class RobotControlProxy { /** * / * ( non - Javadoc )
* @ see com . github . thehilikus . jrobocom . RobotControl # reverseTransfer ( int , int ) */
@ Override public int reverseTransfer ( int remoteBankIndex , int localBankIndex ) { } } | int penalty = Timing . getInstance ( ) . REMOTE_ACCESS_PENALTY + Timing . getInstance ( ) . TRANSFER_BASE ; log . trace ( "[reverseTransfer] Waiting {} cycles to start transfer from {} to {}" , penalty , remoteBankIndex , localBankIndex ) ; turnsControl . waitTurns ( penalty , "Reverse Transfer Wait 1/2" ) ; int bankComplexity = robot . reverseTransfer ( localBankIndex , remoteBankIndex ) ; log . trace ( "[reverseTransfer] Waiting {} cycles to complete transfer" , Timing . getInstance ( ) . TRANSFER_SINGLE * bankComplexity ) ; turnsControl . waitTurns ( Timing . getInstance ( ) . TRANSFER_SINGLE * bankComplexity , "Reverse Transfer Wait 2/2" ) ; return bankComplexity ; |
public class NetUtils { /** * 添加Cookie
* @ param response { @ link HttpServletResponse }
* @ param name Cookie名
* @ param value Cookie值
* @ param expiry 有效期
* @ param uri 路径
* @ return { @ link Boolean }
* @ since 1.0.8 */
public static boolean addCookie ( HttpServletResponse response , String name , String value , int expiry , String uri ) { } } | Cookie cookie = new Cookie ( name , value ) ; if ( expiry > 0 ) { cookie . setMaxAge ( expiry ) ; } if ( Checker . isNotEmpty ( uri ) ) { cookie . setPath ( uri ) ; } return addCookie ( cookie , response ) ; |
public class EditText { /** * Gets the line spacing extra space
* @ return the extra space that is added to the height of each lines of this TextView .
* @ see # setLineSpacing ( float , float )
* @ see # getLineSpacingMultiplier ( )
* @ attr ref android . R . styleable # TextView _ lineSpacingExtra */
@ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) public float getLineSpacingExtra ( ) { } } | if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) return mInputView . getLineSpacingExtra ( ) ; return 0f ; |
public class ModelsImpl { /** * Gets information about the intent models .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param listIntentsOptionalParameter the object representing the optional parameters to be set before calling this API
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < List < IntentClassifier > > listIntentsAsync ( UUID appId , String versionId , ListIntentsOptionalParameter listIntentsOptionalParameter , final ServiceCallback < List < IntentClassifier > > serviceCallback ) { } } | return ServiceFuture . fromResponse ( listIntentsWithServiceResponseAsync ( appId , versionId , listIntentsOptionalParameter ) , serviceCallback ) ; |
public class DocumentSymbolMapper { /** * Converts the { @ code EObject } argument into a { @ link DocumentSymbol document symbol } without
* the { @ link DocumentSymbol # children children } information filled in . */
public DocumentSymbol toDocumentSymbol ( final EObject object ) { } } | DocumentSymbol _documentSymbol = new DocumentSymbol ( ) ; final Procedure1 < DocumentSymbol > _function = ( DocumentSymbol it ) -> { final String objectName = this . nameProvider . getName ( object ) ; if ( ( objectName != null ) ) { it . setName ( objectName ) ; } final SymbolKind objectKind = this . kindProvider . getSymbolKind ( object ) ; if ( ( objectKind != null ) ) { it . setKind ( objectKind ) ; } final Range objectRange = this . rangeProvider . getRange ( object ) ; if ( ( objectRange != null ) ) { it . setRange ( objectRange ) ; } final Range objectSelectionRange = this . rangeProvider . getSelectionRange ( object ) ; if ( ( objectSelectionRange != null ) ) { it . setSelectionRange ( objectSelectionRange ) ; } it . setDetail ( this . detailsProvider . getDetails ( object ) ) ; it . setDeprecated ( Boolean . valueOf ( this . deprecationInfoProvider . isDeprecated ( object ) ) ) ; it . setChildren ( CollectionLiterals . < DocumentSymbol > newArrayList ( ) ) ; } ; return ObjectExtensions . < DocumentSymbol > operator_doubleArrow ( _documentSymbol , _function ) ; |
public class TarOutputStream { /** * Writes a byte to the stream and updates byte counters
* @ see java . io . FilterOutputStream # write ( int ) */
@ Override public void write ( int b ) throws IOException { } } | out . write ( b ) ; bytesWritten += 1 ; if ( currentEntry != null ) { currentFileSize += 1 ; } |
public class TaskQueueImpl { /** * 检查并初始化ExecutorService */
private void checkExecutor ( ) { } } | if ( mExecutor == null || mExecutor . isShutdown ( ) ) { ExecutorService poolExecutor ; final String name = "task-queue-" + mMaxThreads ; switch ( mMaxThreads ) { case 0 : // cached thread pool
poolExecutor = ThreadUtils . newCachedThreadPool ( name ) ; break ; case 1 : // single thread mode
poolExecutor = ThreadUtils . newSingleThreadExecutor ( name ) ; break ; default : // fixed thread pool
poolExecutor = ThreadUtils . newFixedThreadPool ( name , mMaxThreads ) ; break ; } mExecutor = poolExecutor ; } |
public class DatabaseClientSnippets { /** * [ VARIABLE my _ singer _ id ] */
public void readWriteTransaction ( final long singerId ) { } } | // [ START readWriteTransaction ]
TransactionRunner runner = dbClient . readWriteTransaction ( ) ; runner . run ( new TransactionCallable < Void > ( ) { @ Override public Void run ( TransactionContext transaction ) throws Exception { String column = "FirstName" ; Struct row = transaction . readRow ( "Singers" , Key . of ( singerId ) , Collections . singleton ( column ) ) ; String name = row . getString ( column ) ; transaction . buffer ( Mutation . newUpdateBuilder ( "Singers" ) . set ( column ) . to ( name . toUpperCase ( ) ) . build ( ) ) ; return null ; } } ) ; // [ END readWriteTransaction ] |
public class MonetaryFormats { /** * Access the default { @ link MonetaryAmountFormat } given a { @ link Locale } .
* @ param formatQuery the required { @ link AmountFormatQuery } , not { @ code null } . If the query does not define
* any explicit provider chain , the providers as defined by # getDefaultCurrencyProviderChain ( )
* are used .
* @ return the matching { @ link MonetaryAmountFormat }
* @ throws MonetaryException if no registered { @ link MonetaryAmountFormatProviderSpi } can provide a
* corresponding { @ link MonetaryAmountFormat } instance . */
public static MonetaryAmountFormat getAmountFormat ( AmountFormatQuery formatQuery ) { } } | return Optional . ofNullable ( getMonetaryFormatsSpi ( ) ) . orElseThrow ( ( ) -> new MonetaryException ( "No MonetaryFormatsSingletonSpi " + "loaded, query functionality is not available." ) ) . getAmountFormat ( formatQuery ) ; |
public class LzoTextInputFormat { /** * Read the index of the lzo file .
* @ param split
* Read the index of this file .
* @ param fs
* The index file is on this file system .
* @ throws IOException */
private LzoIndex readIndex ( Path file , FileSystem fs ) throws IOException { } } | FSDataInputStream indexIn = null ; try { Path indexFile = new Path ( file . toString ( ) + LZO_INDEX_SUFFIX ) ; if ( ! fs . exists ( indexFile ) ) { // return empty index , fall back to the unsplittable mode
return new LzoIndex ( ) ; } long indexLen = fs . getFileStatus ( indexFile ) . getLen ( ) ; int blocks = ( int ) ( indexLen / 8 ) ; LzoIndex index = new LzoIndex ( blocks ) ; indexIn = fs . open ( indexFile ) ; for ( int i = 0 ; i < blocks ; i ++ ) { index . set ( i , indexIn . readLong ( ) ) ; } return index ; } finally { if ( indexIn != null ) { indexIn . close ( ) ; } } |
public class EventCollector { /** * Applies changes in the state of an execution vertex to the stored management graph .
* @ param jobID
* the ID of the job whose management graph shall be updated
* @ param executionStateChangeEvent
* the event describing the changes in the execution state of the vertex */
private void updateManagementGraph ( final JobID jobID , final ExecutionStateChangeEvent executionStateChangeEvent , String optionalMessage ) { } } | synchronized ( this . recentManagementGraphs ) { final ManagementGraph managementGraph = this . recentManagementGraphs . get ( jobID ) ; if ( managementGraph == null ) { return ; } final ManagementVertex vertex = managementGraph . getVertexByID ( executionStateChangeEvent . getVertexID ( ) ) ; if ( vertex == null ) { return ; } vertex . setExecutionState ( executionStateChangeEvent . getNewExecutionState ( ) ) ; if ( executionStateChangeEvent . getNewExecutionState ( ) == ExecutionState . FAILED ) { vertex . setOptMessage ( optionalMessage ) ; } } |
public class Utils { /** * Copy the given directory contents from the source package directory
* to the generated documentation directory . For example , given a package
* java . lang , this method will copy the entire directory , to the generated
* documentation hierarchy .
* @ param pe the package containing the directory to be copied
* @ param dir the directory to be copied
* @ throws DocFileIOException if there is a problem while copying
* the documentation files */
public void copyDirectory ( PackageElement pe , DocPath dir ) throws DocFileIOException { } } | copyDirectory ( getLocationForPackage ( pe ) , dir ) ; |
public class Driver { /** * Direct connection , with given | handler | and random URL .
* @ param handler the statement handler
* @ return the configured connection
* @ throws IllegalArgumentException if handler is null */
public static acolyte . jdbc . Connection connection ( StatementHandler handler ) { } } | return connection ( handler , ( Properties ) null ) ; |
public class Convolution { /** * The out size for a convolution
* @ param size
* @ param k
* @ param s
* @ param p
* @ param coverAll
* @ return */
@ Deprecated public static int outSize ( int size , int k , int s , int p , int dilation , boolean coverAll ) { } } | k = effectiveKernelSize ( k , dilation ) ; if ( coverAll ) return ( size + p * 2 - k + s - 1 ) / s + 1 ; else return ( size + p * 2 - k ) / s + 1 ; |
public class Messenger { /** * Send Markdown Message
* @ param peer destination peer
* @ param text message text
* @ param markDownText message markdown text */
@ ObjectiveCName ( "sendMessageWithPeer:withText:withMarkdownText:" ) public void sendMessage ( @ NotNull Peer peer , @ NotNull String text , @ Nullable String markDownText ) { } } | sendMessage ( peer , text , markDownText , null , false ) ; |
public class XmlTrxMessageIn { /** * Get the SOAP message body as a DOM node .
* @ param message the SOAP message .
* @ param bReturnCopy Return a copy of the message node , instead of the actual node .
* @ return The DOM node containing the message body . */
public org . w3c . dom . Node getMessageBody ( Object rawData , boolean bReturnCopy ) { } } | if ( this . getRawData ( ) instanceof String ) { // Always
String strXML = this . getXML ( ) ; return Utility . convertXMLToDOM ( strXML ) ; } return super . getMessageBody ( rawData , bReturnCopy ) ; |
public class DatabaseTableConfigUtil { /** * Extract our configuration information from the field by looking for a { @ link DatabaseField } annotation . */
private static DatabaseFieldConfig configFromField ( DatabaseType databaseType , String tableName , Field field ) throws SQLException { } } | if ( configFieldNums == null ) { return DatabaseFieldConfig . fromField ( databaseType , tableName , field ) ; } /* * This , unfortunately , we can ' t get around . This creates a AnnotationFactory , an array of AnnotationMember
* fields , and possibly another array of AnnotationMember values . This creates a lot of GC ' d objects . */
DatabaseField databaseField = field . getAnnotation ( DatabaseField . class ) ; DatabaseFieldConfig config = null ; try { if ( databaseField != null ) { config = buildConfig ( databaseField , tableName , field ) ; } } catch ( Exception e ) { // ignored so we will configure normally below
} if ( config == null ) { /* * We configure this the old way because we might be using javax annotations , have a ForeignCollectionField ,
* or may still be using the deprecated annotations . At this point we know that there isn ' t a @ DatabaseField
* or we can ' t do our reflection hacks for some reason . */
return DatabaseFieldConfig . fromField ( databaseType , tableName , field ) ; } else { workedC ++ ; return config ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.