signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CnvBnRsToString { /** * < p > Convert parameter with using name . < / p >
* @ param pAddParam additional params , e . g . entity class UserRoleTomcat
* to reveal derived columns for its composite ID , or field Enum class
* to reveal Enum value by index .
* @ param pFrom from a bean
* @ param pName by a name
* @ return pTo to a bean
* @ throws Exception - an exception */
@ Override public final String convert ( final Map < String , Object > pAddParam , final IRecordSet < RS > pFrom , final String pName ) throws Exception { } } | return pFrom . getString ( pName ) ; |
public class AccountsInner { /** * Gets the specified Data Lake Store firewall rule .
* @ param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account .
* @ param accountName The name of the Data Lake Store account from which to get the firewall rule .
* @ param firewallRuleName The name of the firewall rule to retrieve .
* @ 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
* @ return the FirewallRuleInner object if successful . */
public FirewallRuleInner getFirewallRule ( String resourceGroupName , String accountName , String firewallRuleName ) { } } | return getFirewallRuleWithServiceResponseAsync ( resourceGroupName , accountName , firewallRuleName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ImplicitObjectUtil { /** * Load the global app into the request
* @ param request the request
* @ param globalApp the global app */
public static void loadGlobalApp ( ServletRequest request , GlobalApp globalApp ) { } } | if ( globalApp != null ) request . setAttribute ( GLOBAL_APP_IMPLICIT_OBJECT_KEY , globalApp ) ; |
public class SelectBase { /** * When set to < code > true < / code > , adds a search box to the
* top of the select picker drop - down . < br >
* < br >
* Defaults to < code > false < / code > .
* @ param liveSearch */
public void setLiveSearch ( final boolean liveSearch ) { } } | if ( liveSearch ) attrMixin . setAttribute ( LIVE_SEARCH , Boolean . toString ( true ) ) ; else attrMixin . removeAttribute ( LIVE_SEARCH ) ; |
public class JobControllerClient { /** * Starts a job cancellation request . To access the job resource after cancellation , call
* [ regions / { region } / jobs . list ] ( / dataproc / docs / reference / rest / v1 / projects . regions . jobs / list ) or
* [ regions / { region } / jobs . get ] ( / dataproc / docs / reference / rest / v1 / projects . regions . jobs / get ) .
* < p > Sample code :
* < pre > < code >
* try ( JobControllerClient jobControllerClient = JobControllerClient . create ( ) ) {
* String projectId = " " ;
* String region = " " ;
* String jobId = " " ;
* Job response = jobControllerClient . cancelJob ( projectId , region , jobId ) ;
* < / code > < / pre >
* @ param projectId Required . The ID of the Google Cloud Platform project that the job belongs to .
* @ param region Required . The Cloud Dataproc region in which to handle the request .
* @ param jobId Required . The job ID .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final Job cancelJob ( String projectId , String region , String jobId ) { } } | CancelJobRequest request = CancelJobRequest . newBuilder ( ) . setProjectId ( projectId ) . setRegion ( region ) . setJobId ( jobId ) . build ( ) ; return cancelJob ( request ) ; |
public class GeoLocation { /** * Converts DMS ( degrees - minutes - seconds ) rational values , as given in { @ link com . drew . metadata . exif . GpsDirectory } ,
* into a single value in degrees , as a double . */
@ Nullable public static Double degreesMinutesSecondsToDecimal ( @ NotNull final Rational degs , @ NotNull final Rational mins , @ NotNull final Rational secs , final boolean isNegative ) { } } | double decimal = Math . abs ( degs . doubleValue ( ) ) + mins . doubleValue ( ) / 60.0d + secs . doubleValue ( ) / 3600.0d ; if ( Double . isNaN ( decimal ) ) return null ; if ( isNegative ) decimal *= - 1 ; return decimal ; |
public class LinkedList { /** * Retrieves , but does not remove , the first element of this list ,
* or returns { @ code null } if this list is empty .
* @ return the first element of this list , or { @ code null }
* if this list is empty
* @ since 1.6 */
public E peekFirst ( ) { } } | final Node < E > f = first ; return ( f == null ) ? null : f . item ; |
public class Disruptor { /** * < p > Specify an exception handler to be used for event handlers and worker pools created by this Disruptor . < / p >
* < p > The exception handler will be used by existing and future event handlers and worker pools created by this Disruptor instance . < / p >
* @ param exceptionHandler the exception handler to use . */
@ SuppressWarnings ( "unchecked" ) public void setDefaultExceptionHandler ( final ExceptionHandler < ? super T > exceptionHandler ) { } } | checkNotStarted ( ) ; if ( ! ( this . exceptionHandler instanceof ExceptionHandlerWrapper ) ) { throw new IllegalStateException ( "setDefaultExceptionHandler can not be used after handleExceptionsWith" ) ; } ( ( ExceptionHandlerWrapper < T > ) this . exceptionHandler ) . switchTo ( exceptionHandler ) ; |
public class NeedlessMemberCollectionSynchronization { /** * removes collection fields that are passed to other methods as arguments */
private void removeCollectionParameters ( ) { } } | int parmCount = SignatureUtils . getNumParameters ( getSigConstantOperand ( ) ) ; if ( stack . getStackDepth ( ) >= parmCount ) { for ( int i = 0 ; i < parmCount ; i ++ ) { OpcodeStack . Item item = stack . getStackItem ( i ) ; XField field = item . getXField ( ) ; if ( field != null ) { collectionFields . remove ( field . getName ( ) ) ; } } } |
public class EncryptionConfigurationMarshaller { /** * Marshall the given parameter object . */
public void marshall ( EncryptionConfiguration encryptionConfiguration , ProtocolMarshaller protocolMarshaller ) { } } | if ( encryptionConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( encryptionConfiguration . getNoEncryptionConfig ( ) , NOENCRYPTIONCONFIG_BINDING ) ; protocolMarshaller . marshall ( encryptionConfiguration . getKMSEncryptionConfig ( ) , KMSENCRYPTIONCONFIG_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CollectorManagerPipelineConfigurator { /** * Search for and add any LogHandler ServiceReferences that were already started
* by the time we registered our ServiceListener . */
@ SuppressWarnings ( "unchecked" ) protected void processInitialCollectorManagerServices ( ) throws InvalidSyntaxException { } } | ServiceReference < CollectorManager > [ ] servRefs = ( ServiceReference < CollectorManager > [ ] ) bundleContext . getServiceReferences ( CollectorManager . class . getName ( ) , null ) ; if ( servRefs != null ) { for ( ServiceReference < CollectorManager > servRef : servRefs ) { setCollectorManagerPipeline ( servRef ) ; } } |
public class WampSession { /** * Register a callback to execute on destruction of the specified attribute . The
* callback is executed when the session is closed .
* @ param name the name of the attribute to register the callback for
* @ param callback the destruction callback to be executed */
public void registerDestructionCallback ( String name , Runnable callback ) { } } | synchronized ( getSessionMutex ( ) ) { if ( isSessionCompleted ( ) ) { throw new IllegalStateException ( "Session id=" + getWebSocketSessionId ( ) + " already completed" ) ; } setAttribute ( DESTRUCTION_CALLBACK_NAME_PREFIX + name , callback ) ; } |
public class CliUtils { /** * Prints information of the test result .
* @ param pass the test result */
public static void printPassInfo ( boolean pass ) { } } | if ( pass ) { System . out . println ( Constants . ANSI_GREEN + "Passed the test!" + Constants . ANSI_RESET ) ; } else { System . out . println ( Constants . ANSI_RED + "Failed the test!" + Constants . ANSI_RESET ) ; } |
public class FilePublisher { /** * Notifies all default file subscribers , that is those that will all be notified no matter what . */
public synchronized void notifyDefaultFileSubscribers ( ) { } } | for ( FileSubscriber sub : defaultFileSubscribers ) { CompletableFuture . runAsync ( sub :: update , main . getThreadPoolManager ( ) . getAddOnsThreadPool ( ) ) ; } |
public class ListBackupPlansRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListBackupPlansRequest listBackupPlansRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listBackupPlansRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listBackupPlansRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listBackupPlansRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( listBackupPlansRequest . getIncludeDeleted ( ) , INCLUDEDELETED_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AbstractManagedType { /** * Gets the singular attribute .
* @ param paramString
* the param string
* @ param checkValidity
* the check validity
* @ return the singular attribute */
private SingularAttribute < ? super X , ? > getSingularAttribute ( String paramString , boolean checkValidity ) { } } | SingularAttribute < ? super X , ? > attribute = getDeclaredSingularAttribute ( paramString , false ) ; try { if ( attribute == null && superClazzType != null ) { attribute = superClazzType . getSingularAttribute ( paramString ) ; } } catch ( IllegalArgumentException iaex ) { attribute = null ; onValidity ( paramString , checkValidity , attribute ) ; } onValidity ( paramString , checkValidity , attribute ) ; return attribute ; |
public class DiagnosticsInner { /** * List Site Detector Responses .
* List Site Detector Responses .
* @ 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 ; DetectorResponseInner & gt ; object */
public Observable < Page < DetectorResponseInner > > listSiteDetectorResponsesNextAsync ( final String nextPageLink ) { } } | return listSiteDetectorResponsesNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < DetectorResponseInner > > , Page < DetectorResponseInner > > ( ) { @ Override public Page < DetectorResponseInner > call ( ServiceResponse < Page < DetectorResponseInner > > response ) { return response . body ( ) ; } } ) ; |
public class GuiceDailyDaemon { /** * Overrides the default time set in the constructor with the value from the application config ( if set )
* @ param config
* @ throws java . time . format . DateTimeParseException
* if the LocalTime stored in config is invalid */
@ Inject public void setTimeFromConfigIfSet ( GuiceConfig config ) { } } | final String str = config . get ( "daemon." + getName ( ) + ".time" , null ) ; if ( StringUtils . isNotEmpty ( str ) ) { this . _time = LocalTime . parse ( str ) ; } |
public class AmazonInspectorClient { /** * Describes the findings that are specified by the ARNs of the findings .
* @ param describeFindingsRequest
* @ return Result of the DescribeFindings operation returned by the service .
* @ throws InternalException
* Internal server error .
* @ throws InvalidInputException
* The request was rejected because an invalid or out - of - range value was supplied for an input parameter .
* @ sample AmazonInspector . DescribeFindings
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / inspector - 2016-02-16 / DescribeFindings " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DescribeFindingsResult describeFindings ( DescribeFindingsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeFindings ( request ) ; |
public class CmsImageCacheHelper { /** * Reads all cached images . < p >
* @ param cms the cms context
* @ param withVariations if also variations should be read
* @ param showSize if it is needed to compute the image size
* @ param statsOnly if only statistical information should be retrieved */
private void init ( CmsObject cms , boolean withVariations , boolean showSize , boolean statsOnly ) { } } | File basedir = new File ( CmsImageLoader . getImageRepositoryPath ( ) ) ; try { CmsObject clonedCms = getClonedCmsObject ( cms ) ; visitImages ( clonedCms , basedir , withVariations , showSize , statsOnly ) ; } catch ( CmsException e ) { // should never happen
} m_variations = Collections . unmodifiableMap ( m_variations ) ; m_sizes = Collections . unmodifiableMap ( m_sizes ) ; m_lengths = Collections . unmodifiableMap ( m_lengths ) ; |
public class AmazonSimpleEmailServiceClient { /** * Updates an existing custom verification email template .
* For more information about custom verification email templates , see < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / custom - verification - emails . html " > Using Custom
* Verification Email Templates < / a > in the < i > Amazon SES Developer Guide < / i > .
* You can execute this operation no more than once per second .
* @ param updateCustomVerificationEmailTemplateRequest
* Represents a request to update an existing custom verification email template .
* @ return Result of the UpdateCustomVerificationEmailTemplate operation returned by the service .
* @ throws CustomVerificationEmailTemplateDoesNotExistException
* Indicates that a custom verification email template with the name you specified does not exist .
* @ throws FromEmailAddressNotVerifiedException
* Indicates that the sender address specified for a custom verification email is not verified , and is
* therefore not eligible to send the custom verification email .
* @ throws CustomVerificationEmailInvalidContentException
* Indicates that custom verification email template provided content is invalid .
* @ sample AmazonSimpleEmailService . UpdateCustomVerificationEmailTemplate
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / email - 2010-12-01 / UpdateCustomVerificationEmailTemplate "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateCustomVerificationEmailTemplateResult updateCustomVerificationEmailTemplate ( UpdateCustomVerificationEmailTemplateRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateCustomVerificationEmailTemplate ( request ) ; |
public class NFBuildGraph { /** * Returns the { @ link NFPropertySpec } associated with the supplied node type and property name . */
public NFPropertySpec getPropertySpec ( String nodeType , String propertyName ) { } } | NFNodeSpec nodeSpec = graphSpec . getNodeSpec ( nodeType ) ; NFPropertySpec propertySpec = nodeSpec . getPropertySpec ( propertyName ) ; return propertySpec ; |
public class JSLocalConsumerPoint { /** * Run the asynch consumer once only when the session is stopped .
* registered or if the session is not stopped
* @ throws SIResourceException thrown if there is a problem in the message store */
@ Override public void runIsolatedAsynch ( boolean deliverImmediately ) throws SIIncorrectCallException , SISessionUnavailableException , SIResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "runIsolatedAsynch" , new Object [ ] { this , Boolean . valueOf ( deliverImmediately ) } ) ; synchronized ( _asynchConsumerBusyLock ) { // Lock the consumer session while we check that it is in a valid
// state
this . lock ( ) ; try { // Only valid if the consumer session is still open
checkNotClosed ( ) ; // if there is no callback registered , throw an exception
if ( ! _asynchConsumerRegistered ) { SIIncorrectCallException e = new SIIncorrectCallException ( nls . getFormattedMessage ( "ASYNCH_CONSUMER_ERROR_CWSIP0175" , new Object [ ] { _consumerDispatcher . getDestination ( ) . getName ( ) , _messageProcessor . getMessagingEngineName ( ) } , null ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "runIsolatedAsynch" , e ) ; throw e ; } // we can ' t do an isolated run if the LCP is not in a stopped state
// so throw an exception
if ( ! _stopped ) { SIIncorrectCallException e = new SIIncorrectCallException ( nls . getFormattedMessage ( "ASYNCH_CONSUMER_RUN_ERROR_CWSIP0176" , new Object [ ] { _consumerDispatcher . getDestination ( ) . getName ( ) , _consumerDispatcher . getMessageProcessor ( ) . getMessagingEngineName ( ) } , null ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "runIsolatedAsynch" , e ) ; throw e ; } // If the consumer has been stopped because the destination is not
// allowing consumers to get messages then we simply return .
if ( _stoppedForReceiveAllowed ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "runIsolatedAsynch" , "Receive not allowed" ) ; return ; } } // synchronized ( this )
finally { this . unlock ( ) ; } } // synchronized ( asynchConsumer )
// if we get this far then if deliverImmediately is set then this
// implies that the callback should be inline
if ( deliverImmediately ) { // run the asynch inline
try { runAsynchConsumer ( true ) ; } catch ( Throwable e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.runIsolatedAsynch" , "1:3182:1.22.5.1" , this ) ; SibTr . exception ( tc , e ) ; try { // Since the asynchConsumer has experienced an error of some kind , the best form
// of cleanup is to close down the session . This ensures any listeners get notified
// and can retry at some point later .
_consumerSession . close ( ) ; // don ' t notify asynchconsumer as we are been called inline
} catch ( Exception ee ) { // No FFDC code needed
SibTr . exception ( tc , ee ) ; } if ( e instanceof ThreadDeath ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "runIsolatedAsynch" , e ) ; throw ( ThreadDeath ) e ; } SISessionDroppedException sessionDroppedException = new SISessionDroppedException ( nls . getFormattedMessage ( "CONSUMER_CLOSED_ERROR_CWSIP0177" , new Object [ ] { _consumerDispatcher . getDestination ( ) . getName ( ) , _messageProcessor . getMessagingEngineName ( ) } , null ) , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "runIsolatedAsynch" , sessionDroppedException ) ; // inline call so throwing exception rather than notifying
throw sessionDroppedException ; } } else { // start up a new thread ( from the MP ' s thread pool )
// to deliver the message asynchronously
try { _messageProcessor . startNewThread ( new AsynchThread ( this , true ) ) ; } catch ( InterruptedException e ) { // No FFDC code needed
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "runIsolatedAsynch" , e ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "runIsolatedAsynch" ) ; |
public class SessionManager { /** * Creates a session id and adds the corresponding cookie to the
* response .
* @ param response the response
* @ return the session id */
protected String createSessionId ( HttpResponse response ) { } } | StringBuilder sessionIdBuilder = new StringBuilder ( ) ; byte [ ] bytes = new byte [ 16 ] ; secureRandom . nextBytes ( bytes ) ; for ( byte b : bytes ) { sessionIdBuilder . append ( Integer . toHexString ( b & 0xff ) ) ; } String sessionId = sessionIdBuilder . toString ( ) ; HttpCookie sessionCookie = new HttpCookie ( idName ( ) , sessionId ) ; sessionCookie . setPath ( path ) ; sessionCookie . setHttpOnly ( true ) ; response . computeIfAbsent ( HttpField . SET_COOKIE , CookieList :: new ) . value ( ) . add ( sessionCookie ) ; response . computeIfAbsent ( HttpField . CACHE_CONTROL , CacheControlDirectives :: new ) . value ( ) . add ( new Directive ( "no-cache" , "SetCookie, Set-Cookie2" ) ) ; return sessionId ; |
public class MapUtils { /** * Returns an immutable copy of the given map whose iteration order has keys sorted by the key
* type ' s natural ordering . No map keys or values may be { @ code null } .
* @ deprecated Prefer { @ link com . google . common . collect . ImmutableSortedMap # copyOf ( Map ) } . */
@ Deprecated public static < K extends Comparable < K > , V > ImmutableMap < K , V > copyWithSortedKeys ( final Map < K , V > map ) { } } | return ImmutableSortedMap . copyOf ( map ) ; |
public class GoogleCloudStorageImpl { /** * See { @ link GoogleCloudStorage # deleteBuckets ( List ) } for details about expected behavior . */
@ Override public void deleteBuckets ( List < String > bucketNames ) throws IOException { } } | logger . atFine ( ) . log ( "deleteBuckets(%s)" , bucketNames ) ; // Validate all the inputs first .
for ( String bucketName : bucketNames ) { Preconditions . checkArgument ( ! Strings . isNullOrEmpty ( bucketName ) , "bucketName must not be null or empty" ) ; } // Gather exceptions to wrap in a composite exception at the end .
final List < IOException > innerExceptions = new ArrayList < > ( ) ; for ( final String bucketName : bucketNames ) { final Storage . Buckets . Delete deleteBucket = configureRequest ( gcs . buckets ( ) . delete ( bucketName ) , bucketName ) ; try { ResilientOperation . retry ( ResilientOperation . getGoogleRequestCallable ( deleteBucket ) , backOffFactory . newBackOff ( ) , rateLimitedRetryDeterminer , IOException . class , sleeper ) ; } catch ( IOException e ) { if ( errorExtractor . itemNotFound ( e ) ) { FileNotFoundException fnfe = GoogleCloudStorageExceptions . getFileNotFoundException ( bucketName , null ) ; innerExceptions . add ( ( FileNotFoundException ) fnfe . initCause ( e ) ) ; } else { innerExceptions . add ( new IOException ( "Error deleting " + bucketName , e ) ) ; } } catch ( InterruptedException e ) { throw new IOException ( e ) ; // From sleep
} } if ( innerExceptions . size ( ) > 0 ) { throw GoogleCloudStorageExceptions . createCompositeException ( innerExceptions ) ; } |
public class JNRPEClient { /** * Configures the command line parser .
* @ return The command line parser configuration */
private static Group configureCommandLine ( ) { } } | DefaultOptionBuilder oBuilder = new DefaultOptionBuilder ( ) ; ArgumentBuilder aBuilder = new ArgumentBuilder ( ) ; GroupBuilder gBuilder = new GroupBuilder ( ) ; DefaultOption nosslOption = oBuilder . withLongName ( "nossl" ) . withShortName ( "n" ) . withDescription ( "Do no use SSL" ) . create ( ) ; DefaultOption weakSslOption = oBuilder . withLongName ( "weakCiherSuites" ) . withShortName ( "w" ) . withDescription ( "Enable weak cipher suites" ) . create ( ) ; DefaultOption unknownOption = oBuilder . withLongName ( "unknown" ) . withShortName ( "u" ) . withDescription ( "Make socket timeouts return an UNKNOWN state instead of CRITICAL" ) . create ( ) ; DefaultOption hostOption = oBuilder . withLongName ( "host" ) . withShortName ( "H" ) . withDescription ( "The address of the host running the JNRPE/NRPE daemon" ) . withArgument ( aBuilder . withName ( "host" ) . withMinimum ( 1 ) . withMaximum ( 1 ) . create ( ) ) . create ( ) ; NumberValidator positiveInt = NumberValidator . getIntegerInstance ( ) ; positiveInt . setMinimum ( 0 ) ; DefaultOption portOption = oBuilder . withLongName ( "port" ) . withShortName ( "p" ) . withDescription ( "The port on which the daemon is running (default=5666)" ) . withArgument ( aBuilder . withName ( "port" ) . withMinimum ( 1 ) . withMaximum ( 1 ) . withDefault ( Long . valueOf ( DEFAULT_PORT ) ) . withValidator ( positiveInt ) . create ( ) ) . create ( ) ; DefaultOption timeoutOption = oBuilder . withLongName ( "timeout" ) . withShortName ( "t" ) . withDescription ( "Number of seconds before connection times out (default=10)" ) . withArgument ( aBuilder . withName ( "timeout" ) . withMinimum ( 1 ) . withMaximum ( 1 ) . withDefault ( Long . valueOf ( DEFAULT_TIMEOUT ) ) . withValidator ( positiveInt ) . create ( ) ) . create ( ) ; DefaultOption commandOption = oBuilder . withLongName ( "command" ) . withShortName ( "c" ) . withDescription ( "The name of the command that the remote daemon should run" ) . withArgument ( aBuilder . withName ( "command" ) . withMinimum ( 1 ) . withMaximum ( 1 ) . create ( ) ) . create ( ) ; DefaultOption argsOption = oBuilder . withLongName ( "arglist" ) . withShortName ( "a" ) . withDescription ( "Optional arguments that should be passed to the command. Multiple arguments should be separated by " + "a space (' '). If provided, this must be the last option supplied on the command line." ) . withArgument ( aBuilder . withName ( "arglist" ) . withMinimum ( 1 ) . create ( ) ) . create ( ) ; DefaultOption helpOption = oBuilder . withLongName ( "help" ) . withShortName ( "h" ) . withDescription ( "Shows this help" ) . create ( ) ; Group executionOption = gBuilder . withOption ( nosslOption ) . withOption ( weakSslOption ) . withOption ( unknownOption ) . withOption ( hostOption ) . withOption ( portOption ) . withOption ( timeoutOption ) . withOption ( commandOption ) . withOption ( argsOption ) . create ( ) ; return gBuilder . withOption ( executionOption ) . withOption ( helpOption ) . withMinimum ( 1 ) . withMaximum ( 1 ) . create ( ) ; |
public class BaseHlsTaskRunner { /** * Determines if a streaming distribution already exists for a given bucket */
protected List < DistributionSummary > getAllExistingWebDistributions ( String bucketName ) { } } | List < DistributionSummary > distListForBucket = new ArrayList < > ( ) ; DistributionList distList = cfClient . listDistributions ( new ListDistributionsRequest ( ) ) . getDistributionList ( ) ; List < DistributionSummary > webDistList = distList . getItems ( ) ; while ( distList . isTruncated ( ) ) { distList = cfClient . listDistributions ( new ListDistributionsRequest ( ) . withMarker ( distList . getNextMarker ( ) ) ) . getDistributionList ( ) ; webDistList . addAll ( distList . getItems ( ) ) ; } for ( DistributionSummary distSummary : webDistList ) { if ( isDistFromBucket ( bucketName , distSummary ) ) { distListForBucket . add ( distSummary ) ; } } return distListForBucket ; |
public class InternalService { /** * Query user profiles on the services .
* @ param queryString Query string . See https : / / www . npmjs . com / package / mongo - querystring for query syntax . You can use { @ link QueryBuilder } helper class to construct valid query string .
* @ return Profiles detail from the service . */
public Observable < ComapiResult < List < Map < String , Object > > > > queryProfiles ( @ NonNull final String queryString ) { } } | final String token = getToken ( ) ; if ( sessionController . isCreatingSession ( ) ) { return getTaskQueue ( ) . queueQueryProfiles ( queryString ) ; } else if ( TextUtils . isEmpty ( token ) ) { return Observable . error ( getSessionStateErrorDescription ( ) ) ; } else { return doQueryProfiles ( token , queryString ) ; } |
public class CommerceTierPriceEntryLocalServiceWrapper { /** * Returns the commerce tier price entry matching the UUID and group .
* @ param uuid the commerce tier price entry ' s UUID
* @ param groupId the primary key of the group
* @ return the matching commerce tier price entry
* @ throws PortalException if a matching commerce tier price entry could not be found */
@ Override public com . liferay . commerce . price . list . model . CommerceTierPriceEntry getCommerceTierPriceEntryByUuidAndGroupId ( String uuid , long groupId ) throws com . liferay . portal . kernel . exception . PortalException { } } | return _commerceTierPriceEntryLocalService . getCommerceTierPriceEntryByUuidAndGroupId ( uuid , groupId ) ; |
public class Utils { /** * Formats the date for today , in a specific format .
* @ param format the date format
* @ param loc the locale instance
* @ return today ' s date formatted */
public static String formatDate ( String format , Locale loc ) { } } | return formatDate ( timestamp ( ) , format , loc ) ; |
public class ListLicenseConfigurationsRequest { /** * An array of ARNs for the calling account ’ s license configurations .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setLicenseConfigurationArns ( java . util . Collection ) } or
* { @ link # withLicenseConfigurationArns ( java . util . Collection ) } if you want to override the existing values .
* @ param licenseConfigurationArns
* An array of ARNs for the calling account ’ s license configurations .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListLicenseConfigurationsRequest withLicenseConfigurationArns ( String ... licenseConfigurationArns ) { } } | if ( this . licenseConfigurationArns == null ) { setLicenseConfigurationArns ( new java . util . ArrayList < String > ( licenseConfigurationArns . length ) ) ; } for ( String ele : licenseConfigurationArns ) { this . licenseConfigurationArns . add ( ele ) ; } return this ; |
public class Generics { /** * Returns the erasure of the given type . */
public static Class < ? > erase ( Type type ) { } } | if ( type instanceof Class < ? > ) { return ( Class < ? > ) type ; } else if ( type instanceof ParameterizedType ) { return ( Class < ? > ) ( ( ParameterizedType ) type ) . getRawType ( ) ; } else if ( type instanceof TypeVariable < ? > ) { TypeVariable < ? > tv = ( TypeVariable < ? > ) type ; if ( tv . getBounds ( ) . length == 0 ) return Object . class ; else return erase ( tv . getBounds ( ) [ 0 ] ) ; } else if ( type instanceof GenericArrayType ) { GenericArrayType aType = ( GenericArrayType ) type ; return GenericArrayTypeImpl . createArrayType ( erase ( aType . getGenericComponentType ( ) ) ) ; } else { // TODO at least support CaptureType here
throw new RuntimeException ( "not supported: " + type . getClass ( ) ) ; } |
public class ServiceLocator { /** * Locates a service given its JNDI name and automatically casts its reference
* to the appropriate class , as specified by the caller .
* @ param name
* the JNDI name of the resource to lookup .
* @ param clazz
* the type to be used for casting the reference .
* @ return
* the type - cast resource reference , or null if no resource found .
* @ throws NamingException
* if there was a problem with the JNDI lookup . */
public static < T > T getService ( String name , Class < T > clazz ) throws NamingException { } } | Object object = SingletonHolder . locator . context . lookup ( name ) ; if ( object != null ) { return clazz . cast ( object ) ; } return null ; |
public class QuadrigaCxUtils { /** * Format a date String for QuadrigaCx
* @ param dateString
* @ return */
public static Date parseDate ( String dateString ) { } } | try { return DATE_FORMAT . parse ( dateString ) ; } catch ( ParseException e ) { throw new ExchangeException ( "Illegal date/time format" , e ) ; } |
public class EnvironmentsInner { /** * Starts an environment by starting all resources inside the environment . This operation can take a while to complete .
* @ param resourceGroupName The name of the resource group .
* @ param labAccountName The name of the lab Account .
* @ param labName The name of the lab .
* @ param environmentSettingName The name of the environment Setting .
* @ param environmentName The name of the environment .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < Void > beginStartAsync ( String resourceGroupName , String labAccountName , String labName , String environmentSettingName , String environmentName ) { } } | return beginStartWithServiceResponseAsync ( resourceGroupName , labAccountName , labName , environmentSettingName , environmentName ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class ScenarioPortrayal { /** * Add a ScatterPlot to the simulation
* @ param scatterID - An ID for the ScatterPlot
* @ param xAxisLabel - The name of the x axis
* @ param yAxisLabel - The name of the y axis
* @ throws ShanksException */
public void addScatterPlot ( String scatterID , String xAxisLabel , String yAxisLabel ) throws ShanksException { } } | if ( ! this . timeCharts . containsKey ( scatterID ) ) { ScatterPlotGenerator scatter = new ScatterPlotGenerator ( ) ; scatter . setTitle ( scatterID ) ; scatter . setXAxisLabel ( xAxisLabel ) ; scatter . setYAxisLabel ( yAxisLabel ) ; this . scatterPlots . put ( scatterID , scatter ) ; } else { throw new DuplicatedChartIDException ( scatterID ) ; } |
public class RuleCharacterIterator { /** * Returns the next character using the given options , or DONE if there
* are no more characters , and advance the position to the next
* character .
* @ param options one or more of the following options , bitwise - OR - ed
* together : PARSE _ VARIABLES , PARSE _ ESCAPES , SKIP _ WHITESPACE .
* @ return the current 32 - bit code point , or DONE */
public int next ( int options ) { } } | int c = DONE ; isEscaped = false ; for ( ; ; ) { c = _current ( ) ; _advance ( UTF16 . getCharCount ( c ) ) ; if ( c == SymbolTable . SYMBOL_REF && buf == null && ( options & PARSE_VARIABLES ) != 0 && sym != null ) { String name = sym . parseReference ( text , pos , text . length ( ) ) ; // If name = = null there was an isolated SYMBOL _ REF ;
// return it . Caller must be prepared for this .
if ( name == null ) { break ; } bufPos = 0 ; buf = sym . lookup ( name ) ; if ( buf == null ) { throw new IllegalArgumentException ( "Undefined variable: " + name ) ; } // Handle empty variable value
if ( buf . length == 0 ) { buf = null ; } continue ; } if ( ( options & SKIP_WHITESPACE ) != 0 && PatternProps . isWhiteSpace ( c ) ) { continue ; } if ( c == '\\' && ( options & PARSE_ESCAPES ) != 0 ) { int offset [ ] = new int [ ] { 0 } ; c = Utility . unescapeAt ( lookahead ( ) , offset ) ; jumpahead ( offset [ 0 ] ) ; isEscaped = true ; if ( c < 0 ) { throw new IllegalArgumentException ( "Invalid escape" ) ; } } break ; } return c ; |
public class DecimalUtils { /** * Extracts the seconds and nanoseconds component of { @ code seconds } as { @ code long } and { @ code int }
* values , passing them to the given converter . The implementation avoids latency issues present
* on some JRE releases .
* @ since 2.9.8 */
public static < T > T extractSecondsAndNanos ( BigDecimal seconds , BiFunction < Long , Integer , T > convert ) { } } | // Complexity is here to workaround unbounded latency in some BigDecimal operations .
// https : / / github . com / FasterXML / jackson - databind / issues / 2141
long secondsOnly ; int nanosOnly ; BigDecimal nanoseconds = seconds . scaleByPowerOfTen ( 9 ) ; if ( nanoseconds . precision ( ) - nanoseconds . scale ( ) <= 0 ) { // There are no non - zero digits to the left of the decimal point .
// This protects against very negative exponents .
secondsOnly = nanosOnly = 0 ; } else if ( seconds . scale ( ) < - 63 ) { // There would be no low - order bits once we chop to a long .
// This protects against very positive exponents .
secondsOnly = nanosOnly = 0 ; } else { // Now we know that seconds has reasonable scale , we can safely chop it apart .
secondsOnly = seconds . longValue ( ) ; nanosOnly = nanoseconds . subtract ( new BigDecimal ( secondsOnly ) . scaleByPowerOfTen ( 9 ) ) . intValue ( ) ; } return convert . apply ( secondsOnly , nanosOnly ) ; |
public class UtilFile { /** * Normalize the file extension by ensuring it has the required one .
* @ param file The original file name ( must not be < code > null < / code > ) .
* @ param extension The desired extension , will replace the other one if has ( must not be < code > null < / code > ) .
* @ return The normalized file with its extension .
* @ throws LionEngineException If invalid arguments . */
public static String normalizeExtension ( String file , String extension ) { } } | Check . notNull ( file ) ; Check . notNull ( extension ) ; final int length = file . length ( ) + Constant . DOT . length ( ) + extension . length ( ) ; final StringBuilder builder = new StringBuilder ( length ) . append ( removeExtension ( file ) ) . append ( Constant . DOT ) ; if ( extension . startsWith ( Constant . DOT ) ) { builder . append ( getExtension ( extension ) ) ; } else { builder . append ( extension ) ; } return builder . toString ( ) ; |
public class AbstractThriftBase { /** * 读取操作 */
@ Override public void read ( TProtocol iprot ) throws TException { } } | if ( ! "org.apache.thrift.scheme.StandardScheme" . equals ( iprot . getScheme ( ) . getName ( ) ) ) throw new TApplicationException ( "Service scheme must be 'org.apache.thrift.scheme.StandardScheme' !" ) ; TField schemeField ; iprot . readStructBegin ( ) ; while ( Boolean . TRUE ) { schemeField = iprot . readFieldBegin ( ) ; if ( schemeField . type == TType . STOP ) break ; if ( schemeField . type == TType . STRING ) str = iprot . readString ( ) ; else throw new TApplicationException ( "field type must be 'String' !" ) ; iprot . readFieldEnd ( ) ; } iprot . readStructEnd ( ) ; |
public class DescribeClassicLinkInstancesRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < DescribeClassicLinkInstancesRequest > getDryRunRequest ( ) { } } | Request < DescribeClassicLinkInstancesRequest > request = new DescribeClassicLinkInstancesRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class StructureTools { /** * Returns the set of inter - chain contacts between the two given chains for
* the given atom names . Uses a geometric hashing algorithm that speeds up
* the calculation without need of full distance matrix . The parsing mode
* { @ link FileParsingParameters # setAlignSeqRes ( boolean ) } needs to be set to
* true for this to work .
* @ param chain1
* @ param chain2
* @ param atomNames
* the array with atom names to be used . For Calphas use { " CA " } ,
* if null all non - H atoms will be used . Note HET atoms are
* ignored unless this parameter is null .
* @ param cutoff
* @ param hetAtoms
* if true HET atoms are included , if false they are not
* @ return */
public static AtomContactSet getAtomsInContact ( Chain chain1 , Chain chain2 , String [ ] atomNames , double cutoff , boolean hetAtoms ) { } } | Grid grid = new Grid ( cutoff ) ; Atom [ ] atoms1 = null ; Atom [ ] atoms2 = null ; if ( atomNames == null ) { atoms1 = getAllNonHAtomArray ( chain1 , hetAtoms ) ; atoms2 = getAllNonHAtomArray ( chain2 , hetAtoms ) ; } else { atoms1 = getAtomArray ( chain1 , atomNames ) ; atoms2 = getAtomArray ( chain2 , atomNames ) ; } grid . addAtoms ( atoms1 , atoms2 ) ; return grid . getAtomContacts ( ) ; |
public class Symbol { /** * A Java source description of the location of this symbol ; used for
* error reporting .
* @ return null if the symbol is a package or a toplevel class defined in
* the default package ; otherwise , the owner symbol is returned */
public Symbol location ( ) { } } | if ( owner . name == null || ( owner . name . isEmpty ( ) && ( owner . flags ( ) & BLOCK ) == 0 && owner . kind != PCK && owner . kind != TYP ) ) { return null ; } return owner ; |
public class AppEventsLogger { /** * Build an AppEventsLogger instance to log events through .
* @ param context Used to access the attributionId for non - authenticated users .
* @ param applicationId Explicitly specified Facebook applicationId to log events against . If null , the default
* app ID specified in the package metadata will be used .
* @ param session Explicitly specified Session to log events against . If null , the activeSession
* will be used if it ' s open , otherwise the logging will happen against the specified
* app ID .
* @ return AppEventsLogger instance to invoke log * methods on . */
public static AppEventsLogger newLogger ( Context context , String applicationId , Session session ) { } } | return new AppEventsLogger ( context , applicationId , session ) ; |
public class ParseUtils { /** * read encoding len .
* see Stringpool . cpp ENCODE _ LENGTH */
private static int readLen16 ( ByteBuffer buffer ) { } } | int len = 0 ; int i = Buffers . readUShort ( buffer ) ; if ( ( i & 0x8000 ) != 0 ) { len |= ( i & 0x7fff ) << 16 ; len += Buffers . readUShort ( buffer ) ; } else { len = i ; } return len ; |
public class OfflinePlugin { /** * Cancel an ongoing download .
* @ param offlineDownload the offline download
* @ since 0.1.0 */
public void cancelDownload ( OfflineDownloadOptions offlineDownload ) { } } | Intent intent = new Intent ( context , OfflineDownloadService . class ) ; intent . setAction ( OfflineConstants . ACTION_CANCEL_DOWNLOAD ) ; intent . putExtra ( KEY_BUNDLE , offlineDownload ) ; context . startService ( intent ) ; |
public class BasicHttpClient { /** * Once the client executes the http call , then it receives the http response . This method takes care of handling
* that . In case you need to handle it differently you can override this method .
* @ param httpResponse : Received Apache http response from the server
* @ return : Effective response with handled http session .
* @ throws IOException */
public Response handleResponse ( CloseableHttpResponse httpResponse ) throws IOException { } } | Response serverResponse = createCharsetResponse ( httpResponse ) ; Header [ ] allHeaders = httpResponse . getAllHeaders ( ) ; Response . ResponseBuilder responseBuilder = Response . fromResponse ( serverResponse ) ; for ( Header thisHeader : allHeaders ) { String headerKey = thisHeader . getName ( ) ; responseBuilder = responseBuilder . header ( headerKey , thisHeader . getValue ( ) ) ; handleHttpSession ( serverResponse , headerKey ) ; } return responseBuilder . build ( ) ; |
public class SimpleAttachable { /** * { @ inheritDoc } */
public synchronized < T > T removeAttachment ( final AttachmentKey < T > key ) { } } | if ( key == null ) { return null ; } return key . cast ( attachments . remove ( key ) ) ; |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcDistributionChamberElementTypeEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class MBTilesHelper { /** * Get a Tile image from the database .
* @ param x
* @ param y
* @ param z
* @ return
* @ throws Exception */
public BufferedImage getTile ( int x , int y , int z ) throws Exception { } } | try ( PreparedStatement statement = connection . prepareStatement ( SELECTQUERY ) ) { statement . setInt ( 1 , z ) ; statement . setInt ( 2 , x ) ; statement . setInt ( 3 , y ) ; ResultSet resultSet = statement . executeQuery ( ) ; if ( resultSet . next ( ) ) { byte [ ] imageBytes = resultSet . getBytes ( 1 ) ; boolean orig = ImageIO . getUseCache ( ) ; ImageIO . setUseCache ( false ) ; InputStream in = new ByteArrayInputStream ( imageBytes ) ; BufferedImage bufferedImage = ImageIO . read ( in ) ; ImageIO . setUseCache ( orig ) ; return bufferedImage ; } } return null ; |
public class ApplicationTypeImpl { /** * If not already created , a new < code > module < / code > element will be created and returned .
* Otherwise , the first existing < code > module < / code > element will be returned .
* @ return the instance defined for the element < code > module < / code > */
public ModuleType < ApplicationType < T > > getOrCreateModule ( ) { } } | List < Node > nodeList = childNode . get ( "module" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new ModuleTypeImpl < ApplicationType < T > > ( this , "module" , childNode , nodeList . get ( 0 ) ) ; } return createModule ( ) ; |
public class MetricsProtoUtils { /** * MetricDescriptors . */
static Metric toMetricProto ( io . opencensus . metrics . export . Metric metric , @ Nullable io . opencensus . resource . Resource resource ) { } } | Metric . Builder builder = Metric . newBuilder ( ) ; builder . setMetricDescriptor ( toMetricDescriptorProto ( metric . getMetricDescriptor ( ) ) ) ; for ( io . opencensus . metrics . export . TimeSeries timeSeries : metric . getTimeSeriesList ( ) ) { builder . addTimeseries ( toTimeSeriesProto ( timeSeries ) ) ; } if ( resource != null ) { builder . setResource ( toResourceProto ( resource ) ) ; } return builder . build ( ) ; |
public class ImageHandlerBuilder { /** * Crop the image to the given width and height , using ( x , y ) as coordinates for upper left corner
* @ param x
* @ param y
* @ param width
* @ param height
* @ return */
public ImageHandlerBuilder crop ( int x , int y , int width , int height ) { } } | height = Math . min ( height , image . getHeight ( ) - y ) ; width = Math . min ( width , image . getWidth ( ) - x ) ; BufferedImage crop = Scalr . crop ( image , x , y , width , height ) ; image . flush ( ) ; // cannot throw
image = crop ; return this ; |
public class IfcObjectImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcRelDefinesByProperties > getIsDefinedBy ( ) { } } | return ( EList < IfcRelDefinesByProperties > ) eGet ( Ifc4Package . Literals . IFC_OBJECT__IS_DEFINED_BY , true ) ; |
public class Buffers { /** * Wrap an observable and free a reference counted item if unsubscribed in the meantime .
* This can and should be used if a hot observable is used as the source but it is not guaranteed that
* there will always be a subscriber that consumes the reference counted item . If an item is emitted
* by the source observable and no subscriber is attached ( because it unsubscribed ) the item will
* be freed .
* Note that also non reference counted items can be passed in , but there is no impact other than
* making it cold ( in which case defer could be used ) .
* It is very important that if subscribed , the caller needs to release the reference counted item .
* It wil only be released on behalf of the caller when unsubscribed .
* @ param source the source observable to wrap .
* @ return the wrapped cold observable with refcnt release logic . */
public static < T > Observable < T > wrapColdWithAutoRelease ( final Observable < T > source ) { } } | return Observable . create ( new Observable . OnSubscribe < T > ( ) { @ Override public void call ( final Subscriber < ? super T > subscriber ) { source . subscribe ( new Subscriber < T > ( ) { @ Override public void onCompleted ( ) { if ( ! subscriber . isUnsubscribed ( ) ) { subscriber . onCompleted ( ) ; } } @ Override public void onError ( Throwable e ) { if ( ! subscriber . isUnsubscribed ( ) ) { subscriber . onError ( e ) ; } } @ Override public void onNext ( T t ) { if ( ! subscriber . isUnsubscribed ( ) ) { subscriber . onNext ( t ) ; } else { ReferenceCountUtil . release ( t ) ; } } } ) ; } } ) ; |
public class JKConfig { /** * Gets the string .
* @ param name the name
* @ param defaultValue the default value
* @ return the string */
public String getString ( String name , String defaultValue ) { } } | return config . getString ( name , defaultValue ) ; |
public class JMSManager { /** * Stops producers and consumers on a given destination .
* This has no effect on durable subscriptions .
* @ param destName
* @ throws MessagingException */
public void stop ( String destName ) throws MessagingException { } } | try { // Look for an existing destination for the given destination
JMSDestination jmsDest = jmsDestinations . get ( destName ) ; if ( jmsDest != null ) { // Close out all JMS related state
if ( jmsDest . producer != null ) { jmsDest . producer . close ( ) ; logger . debug ( "Closed producer for " + destName ) ; } if ( jmsDest . consumer != null ) { jmsDest . consumer . close ( ) ; logger . debug ( "Closed consumer for " + destName ) ; } if ( jmsDest . session != null ) { jmsDest . session . close ( ) ; logger . debug ( "Closed session for " + destName ) ; } jmsDest . destination = null ; jmsDest . session = null ; jmsDest . producer = null ; jmsDest . consumer = null ; // Remove the JMS client entry
jmsDestinations . remove ( destName ) ; jmsDest = null ; } } catch ( JMSException e ) { throw new MessagingException ( e . getMessage ( ) , e ) ; } |
public class Vpc { /** * Information about the IPv6 CIDR blocks associated with the VPC .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setIpv6CidrBlockAssociationSet ( java . util . Collection ) } or
* { @ link # withIpv6CidrBlockAssociationSet ( java . util . Collection ) } if you want to override the existing values .
* @ param ipv6CidrBlockAssociationSet
* Information about the IPv6 CIDR blocks associated with the VPC .
* @ return Returns a reference to this object so that method calls can be chained together . */
public Vpc withIpv6CidrBlockAssociationSet ( VpcIpv6CidrBlockAssociation ... ipv6CidrBlockAssociationSet ) { } } | if ( this . ipv6CidrBlockAssociationSet == null ) { setIpv6CidrBlockAssociationSet ( new com . amazonaws . internal . SdkInternalList < VpcIpv6CidrBlockAssociation > ( ipv6CidrBlockAssociationSet . length ) ) ; } for ( VpcIpv6CidrBlockAssociation ele : ipv6CidrBlockAssociationSet ) { this . ipv6CidrBlockAssociationSet . add ( ele ) ; } return this ; |
public class NonSnarlIdpMetadataManager { /** * { @ inheritDoc } */
public List < RoleDescriptor > getRole ( String entityID , QName roleName ) throws MetadataProviderException { } } | List < RoleDescriptor > roleDescriptors = null ; for ( MetadataProvider provider : getProviders ( ) ) { log . debug ( "Checking child metadata provider for entity descriptor with entity ID: {}" , entityID ) ; try { roleDescriptors = provider . getRole ( entityID , roleName ) ; if ( roleDescriptors != null && ! roleDescriptors . isEmpty ( ) ) { break ; } } catch ( MetadataProviderException e ) { log . warn ( "Error retrieving metadata from provider of type {}, proceeding to next provider" , provider . getClass ( ) . getName ( ) , e ) ; continue ; } } return roleDescriptors ; |
public class CmsDefaultXmlContentHandler { /** * Returns the validation message to be displayed if a certain rule was violated . < p >
* @ param cms the current users OpenCms context
* @ param value the value to validate
* @ param regex the rule that was violated
* @ param valueStr the string value of the given value
* @ param matchResult if false , the rule was negated
* @ param isWarning if true , this validation indicate a warning , otherwise an error
* @ return the validation message to be displayed */
protected String getValidationMessage ( CmsObject cms , I_CmsXmlContentValue value , String regex , String valueStr , boolean matchResult , boolean isWarning ) { } } | String message = null ; if ( isWarning ) { message = m_validationWarningMessages . get ( value . getName ( ) ) ; } else { message = m_validationErrorMessages . get ( value . getName ( ) ) ; } if ( message == null ) { if ( isWarning ) { message = MESSAGE_VALIDATION_DEFAULT_WARNING ; } else { message = MESSAGE_VALIDATION_DEFAULT_ERROR ; } } // create additional macro values
Map < String , String > additionalValues = new HashMap < String , String > ( ) ; additionalValues . put ( CmsMacroResolver . KEY_VALIDATION_VALUE , valueStr ) ; additionalValues . put ( CmsMacroResolver . KEY_VALIDATION_REGEX , ( ( ! matchResult ) ? "!" : "" ) + regex ) ; additionalValues . put ( CmsMacroResolver . KEY_VALIDATION_PATH , value . getPath ( ) ) ; CmsMacroResolver resolver = CmsMacroResolver . newInstance ( ) . setCmsObject ( cms ) . setMessages ( getMessages ( OpenCms . getWorkplaceManager ( ) . getWorkplaceLocale ( cms ) ) ) . setAdditionalMacros ( additionalValues ) ; return resolver . resolveMacros ( message ) ; |
public class SlideOut { /** * { @ inheritDoc } */
@ Override public void queueEvent ( final FacesEvent event ) { } } | final FacesContext fc = FacesContext . getCurrentInstance ( ) ; if ( isSelfRequest ( fc ) && event instanceof AjaxBehaviorEvent ) { final Map < String , String > params = fc . getExternalContext ( ) . getRequestParameterMap ( ) ; final String eventName = params . get ( Constants . RequestParams . PARTIAL_BEHAVIOR_EVENT_PARAM ) ; final AjaxBehaviorEvent behaviorEvent = ( AjaxBehaviorEvent ) event ; if ( OpenEvent . NAME . equals ( eventName ) ) { final OpenEvent openEvent = new OpenEvent ( this , behaviorEvent . getBehavior ( ) ) ; openEvent . setPhaseId ( event . getPhaseId ( ) ) ; super . queueEvent ( openEvent ) ; return ; } else if ( CloseEvent . NAME . equals ( eventName ) ) { final CloseEvent closeEvent = new CloseEvent ( this , behaviorEvent . getBehavior ( ) ) ; closeEvent . setPhaseId ( event . getPhaseId ( ) ) ; super . queueEvent ( closeEvent ) ; return ; } } super . queueEvent ( event ) ; |
public class StringUtils { /** * Merges all occurrences of multiple slashes into a single slash ( e . g . " a / / / b / / c / d " becomes " a / b / c / d " )
* @ param url The string to process
* @ return The resulting string with merged slashes . */
public static String mergeSlashesInUrl ( String url ) { } } | StringBuilder builder = new StringBuilder ( ) ; boolean prevIsColon = false ; boolean inMerge = false ; for ( int i = 0 ; i < url . length ( ) ; i ++ ) { char c = url . charAt ( i ) ; if ( c == ':' ) { prevIsColon = true ; builder . append ( c ) ; } else { if ( c == '/' ) { if ( prevIsColon ) { builder . append ( c ) ; inMerge = false ; } else { if ( ! inMerge ) { builder . append ( c ) ; } inMerge = true ; } } else { inMerge = false ; builder . append ( c ) ; } prevIsColon = false ; } } return builder . toString ( ) ; |
public class LogManager { /** * Sets the formatter to use for all handlers .
* @ param formatter the formatter to use */
public synchronized static void setFormatter ( Formatter formatter ) { } } | java . util . logging . Logger root = java . util . logging . LogManager . getLogManager ( ) . getLogger ( StringUtils . EMPTY ) ; for ( Handler h : root . getHandlers ( ) ) { h . setFormatter ( formatter ) ; } |
public class HttpHealthCheckClient { /** * Retrieves the list of HttpHealthCheck resources available to the specified project .
* < p > Sample code :
* < pre > < code >
* try ( HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient . create ( ) ) {
* ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ;
* for ( HttpHealthCheck2 element : httpHealthCheckClient . listHttpHealthChecks ( project ) . iterateAll ( ) ) {
* / / doThingsWith ( element ) ;
* < / code > < / pre >
* @ param project Project ID for this request .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final ListHttpHealthChecksPagedResponse listHttpHealthChecks ( ProjectName project ) { } } | ListHttpHealthChecksHttpRequest request = ListHttpHealthChecksHttpRequest . newBuilder ( ) . setProject ( project == null ? null : project . toString ( ) ) . build ( ) ; return listHttpHealthChecks ( request ) ; |
public class JettyHttpServer { /** * this should only be used as an estimate */
public int getMaxQueuedConnections ( ) { } } | return getThreadPool ( ) == null ? - 1 : ( ( getThreadPool ( ) . getQueue ( ) instanceof ArrayBlockingQueue ) ? ( ( ArrayBlockingQueue ) getThreadPool ( ) . getQueue ( ) ) . size ( ) + ( ( ArrayBlockingQueue ) getThreadPool ( ) . getQueue ( ) ) . remainingCapacity ( ) : - 1 ) ; |
public class xen_health_ftw { /** * < pre >
* Use this operation to get FTW Status .
* < / pre > */
public static xen_health_ftw [ ] get ( nitro_service client ) throws Exception { } } | xen_health_ftw resource = new xen_health_ftw ( ) ; resource . validate ( "get" ) ; return ( xen_health_ftw [ ] ) resource . get_resources ( client ) ; |
public class SetValueRecord { /** * Replaces the specified data value with the value saved in the log record .
* The method pins a buffer to the specified block , calls setInt to restore
* the saved value ( using a dummy LSN ) , and unpins the buffer .
* @ see LogRecord # undo ( Transaction ) */
@ Override public void undo ( Transaction tx ) { } } | Buffer buff = tx . bufferMgr ( ) . pin ( blk ) ; LogSeqNum lsn = tx . recoveryMgr ( ) . logSetValClr ( this . txNum , buff , offset , val , this . lsn ) ; VanillaDb . logMgr ( ) . flush ( lsn ) ; buff . setVal ( offset , val , tx . getTransactionNumber ( ) , null ) ; tx . bufferMgr ( ) . unpin ( buff ) ; // Note that UndoNextLSN should be set to this log record ' s lsn in order
// to let RecoveryMgr to skip this log record . Since this record should
// be undo by the Clr append there .
// Since Clr is Undo ' s redo log , here we should log
// old val setVal log to make this undo procedure be redo during
// repeat history |
public class RegistriesInner { /** * Creates a container registry with the specified parameters .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param registryCreateParameters The parameters for creating a container registry .
* @ 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 < RegistryInner > beginCreateAsync ( String resourceGroupName , String registryName , RegistryCreateParameters registryCreateParameters , final ServiceCallback < RegistryInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( beginCreateWithServiceResponseAsync ( resourceGroupName , registryName , registryCreateParameters ) , serviceCallback ) ; |
public class ColorPixel { /** * Sets this RGB vector to the result of the cross product of this RGB vector with
* the specified vector . Alpha is preserved .
* See { @ link # cross _ ( double , double , double ) } for cross product with swapped arguments . < br >
* Pseudo code :
* < pre >
* a = this
* b = specified
* this = cross ( a , b )
* cross ( a , b ) : =
* c0 = a1 * b2 - a2 * b1
* c1 = a2 * b0 - a0 * b2
* c2 = a0 * b1 - a1 * b0
* return c
* < / pre >
* @ param r of the specified vector
* @ param g of the specified vector
* @ param b of the specified vector
* @ return this pixel for chaining */
public ColorPixel cross ( double r , double g , double b ) { } } | return setRGB_fromDouble_preserveAlpha ( ( g_asDouble ( ) * b ) - ( g * b_asDouble ( ) ) , ( b_asDouble ( ) * r ) - ( b * r_asDouble ( ) ) , ( r_asDouble ( ) * g ) - ( r * g_asDouble ( ) ) ) ; |
public class SQLLexer { /** * / * to match tokens like ' CASE ' , ' BEGIN ' , ' END '
* the tokens should not be embedded in identifiers , like column names or table names
* the tokens can be followed by operators with / without whitespaces
* eg : emptycase , caseofbeer , suitcaseofbeer ,
* ( id + 0 ) end + 100 , suit2case3ofbeer , 100 + case */
public static boolean matchToken ( String buffer , int position , String token ) { } } | final int tokLength = token . length ( ) ; final int bufLength = buffer . length ( ) ; final char firstLo = Character . toLowerCase ( token . charAt ( 0 ) ) ; final char firstUp = Character . toUpperCase ( token . charAt ( 0 ) ) ; if ( // character before token is non alphanumeric i . e . , token is not embedded in an identifier
( position == 0 || ! isIdentifierPartFast ( buffer . charAt ( position - 1 ) ) ) // perform a region match only if the first character matches
&& ( buffer . charAt ( position ) == firstLo || buffer . charAt ( position ) == firstUp ) // match only if the length of the remaining string is the atleast the length of the token
&& ( position <= bufLength - tokLength ) // search for token
&& buffer . regionMatches ( true , position , token , 0 , tokLength ) // character after token is non alphanumeric i . e . , token is not embedded in an identifier
&& ( position + tokLength == bufLength || ! isIdentifierPartFast ( buffer . charAt ( position + tokLength ) ) ) ) return true ; else return false ; |
public class AssetsSingleton { /** * Serves the asset list page , or a JSON form depending on the { @ literal ACCEPT } header .
* @ return the page , the json form or a bad request . Bad request are returned in " PROD " mode . */
@ Route ( method = HttpMethod . GET , uri = "/assets" ) public Result index ( ) { } } | if ( configuration . isProd ( ) ) { // Dumping assets is not enabled in PROD mode ,
// returning a bad request result
return badRequest ( "Sorry, no asset dump in PROD mode." ) ; } if ( cache . isEmpty ( ) || NOCACHE_VALUE . equalsIgnoreCase ( context ( ) . header ( CACHE_CONTROL ) ) ) { // Refresh the cache .
all ( ) ; } return Negotiation . accept ( ImmutableMap . of ( MimeTypes . HTML , ok ( render ( template , "assets" , cache ) ) , MimeTypes . JSON , ok ( cache ) . json ( ) ) ) ; |
public class SeaGlassStyle { /** * < p > Gets the RuntimeState that most closely matches the state in the given
* context , but is less specific than the given " lastState " . Essentially ,
* this allows you to search for the next best state . < / p >
* < p > For example , if you had the following three states : < / p >
* < pre >
* Enabled
* Enabled + Pressed
* Disabled
* < / pre >
* < p > And you wanted to find the state that best represented
* ENABLED + PRESSED + FOCUSED and < code > lastState < / code > was null ( or an empty
* array , or an array with a single int with index = = - 1 ) , then
* Enabled + Pressed would be returned . If you then call this method again but
* pass the index of Enabled + Pressed as the " lastState " , then Enabled would
* be returned . If you call this method a third time and pass the index of
* Enabled in as the < code > lastState < / code > , then null would be returned .
* < p > The actual code path for determining the proper state is the same as
* in Synth . < / p >
* @ param states
* @ param lastState a 1 element array , allowing me to do pass - by - reference .
* @ param xstate
* @ return */
private RuntimeState getNextState ( RuntimeState [ ] states , int [ ] lastState , int xstate ) { } } | // Use the StateInfo with the most bits that matches that of state .
// If there are none , then fallback to
// the StateInfo with a state of 0 , indicating it ' ll match anything .
// Consider if we have 3 StateInfos a , b and c with states :
// SELECTED , SELECTED | ENABLED , 0
// Input Return Value
// SELECTED a
// SELECTED | ENABLED b
// MOUSE _ OVER c
// SELECTED | ENABLED | FOCUSED b
// ENABLED c
if ( states != null && states . length > 0 ) { int bestCount = 0 ; int bestIndex = - 1 ; int wildIndex = - 1 ; // if xstate is 0 , then search for the runtime state with component
// state of 0 . That is , find the exact match and return it .
if ( xstate == 0 ) { for ( int counter = states . length - 1 ; counter >= 0 ; counter -- ) { if ( states [ counter ] . state == 0 ) { lastState [ 0 ] = counter ; return states [ counter ] ; } } // an exact match couldn ' t be found , so there was no match .
lastState [ 0 ] = - 1 ; return null ; } // xstate is some value ! = 0
// determine from which index to start looking . If lastState [ 0 ] is
// then we know to start from the end of the state array . Otherwise ,
// we start at the lastIndex - 1.
int lastStateIndex = lastState == null || lastState [ 0 ] == - 1 ? states . length : lastState [ 0 ] ; for ( int counter = lastStateIndex - 1 ; counter >= 0 ; counter -- ) { int oState = states [ counter ] . state ; if ( oState == 0 ) { if ( wildIndex == - 1 ) { wildIndex = counter ; } } else if ( ( xstate & oState ) == oState ) { // This is key , we need to make sure all bits of the
// StateInfo match , otherwise a StateInfo with
// SELECTED | ENABLED would match ENABLED , which we
// don ' t want .
// This comes from BigInteger . bitCnt
int bitCount = oState ; bitCount -= ( 0xaaaaaaaa & bitCount ) >>> 1 ; bitCount = ( bitCount & 0x33333333 ) + ( ( bitCount >>> 2 ) & 0x33333333 ) ; bitCount = bitCount + ( bitCount >>> 4 ) & 0x0f0f0f0f ; bitCount += bitCount >>> 8 ; bitCount += bitCount >>> 16 ; bitCount = bitCount & 0xff ; if ( bitCount > bestCount ) { bestIndex = counter ; bestCount = bitCount ; } } } if ( bestIndex != - 1 ) { lastState [ 0 ] = bestIndex ; return states [ bestIndex ] ; } if ( wildIndex != - 1 ) { lastState [ 0 ] = wildIndex ; return states [ wildIndex ] ; } } lastState [ 0 ] = - 1 ; return null ; |
public class DenseMatrix { /** * Creates a random { @ link DenseMatrix } of the given shape :
* { @ code rows } x { @ code columns } . */
public static DenseMatrix random ( int rows , int columns , Random random ) { } } | return Basic2DMatrix . random ( rows , columns , random ) ; |
public class HttpURLConnection { /** * Returns an input stream that reads from this open connection .
* @ return an input stream that reads from this open connection .
* @ throws IOException if an I / O error occurs while
* creating the input stream . */
public synchronized InputStream getInputStream ( ) throws IOException { } } | if ( ! connected ) { connect ( ) ; } // Nothing to return
if ( responseCode == HTTP_NOT_FOUND ) { throw new FileNotFoundException ( url . toString ( ) ) ; } int length ; if ( inputStream == null ) { return null ; } // " De - chunk " the output stream
else if ( "chunked" . equalsIgnoreCase ( getHeaderField ( "Transfer-Encoding" ) ) ) { if ( ! ( inputStream instanceof ChunkedInputStream ) ) { inputStream = new ChunkedInputStream ( inputStream ) ; } } // Make sure we don ' t wait forever , if the content - length is known
else if ( ( length = getHeaderFieldInt ( "Content-Length" , - 1 ) ) >= 0 ) { if ( ! ( inputStream instanceof FixedLengthInputStream ) ) { inputStream = new FixedLengthInputStream ( inputStream , length ) ; } } return inputStream ; |
public class HomographyDirectLinearTransform { /** * < p > Adds the 9x9 matrix constraint for each pair of conics . To avoid O ( N ^ 2 ) growth the default option only
* adds O ( N ) pairs . if only conics are used then a minimum of 3 is required . See [ 2 ] . < / p >
* inv ( C [ 1 ] ' ) * ( C [ 2 ] ' ) * H - H * invC [ 1 ] * C [ 2 ] = = 0
* Note : x ' = H * x . C ' is conic from the same view as x ' and C from x . It can be shown that C = H ^ T * C ' * H */
protected int addConics ( List < AssociatedPairConic > points , DMatrixRMaj A , int rows ) { } } | if ( exhaustiveConics ) { // adds an exhaustive set of linear conics
for ( int i = 0 ; i < points . size ( ) ; i ++ ) { for ( int j = i + 1 ; j < points . size ( ) ; j ++ ) { rows = addConicPairConstraints ( points . get ( i ) , points . get ( j ) , A , rows ) ; } } } else { // adds pairs and has linear time complexity
for ( int i = 1 ; i < points . size ( ) ; i ++ ) { rows = addConicPairConstraints ( points . get ( i - 1 ) , points . get ( i ) , A , rows ) ; } int N = points . size ( ) ; rows = addConicPairConstraints ( points . get ( 0 ) , points . get ( N - 1 ) , A , rows ) ; } return rows ; |
public class vrid { /** * Use this API to add vrid resources . */
public static base_responses add ( nitro_service client , vrid resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { vrid addresources [ ] = new vrid [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { addresources [ i ] = new vrid ( ) ; addresources [ i ] . id = resources [ i ] . id ; addresources [ i ] . priority = resources [ i ] . priority ; addresources [ i ] . preemption = resources [ i ] . preemption ; addresources [ i ] . sharing = resources [ i ] . sharing ; addresources [ i ] . tracking = resources [ i ] . tracking ; } result = add_bulk_request ( client , addresources ) ; } return result ; |
public class ProxyGeneratorAdapter { /** * Ensures that the provided object is wrapped into a closure if it ' s not
* a closure .
* Do not trust IDEs , this method is used in bytecode . */
@ SuppressWarnings ( "unchecked" ) public static Closure ensureClosure ( Object o ) { } } | if ( o == null ) throw new UnsupportedOperationException ( ) ; if ( o instanceof Closure ) return ( Closure ) o ; return new ReturnValueWrappingClosure ( o ) ; |
public class XmlInputFactory { /** * Creates a { @ link XmlReader } to read the XML resource located by the specified identifier .
* On closing the created XML reader , the { @ link Reader } set as input for the XML reader will
* get closed as well .
* @ param baseUri location identifier of the XML resource
* @ return XML reader
* @ throws KNXMLException if creation of the reader failed or XML resource can ' t be resolved */
public XmlReader createXMLReader ( final String baseUri ) throws KNXMLException { } } | final XmlResolver res = new XmlResolver ( ) ; final InputStream is = ( InputStream ) res . resolveEntity ( null , null , baseUri , null ) ; return create ( res , is ) ; |
public class AbstractKubernetesCommand { /** * Adds command parameter to current command .
* @ param name
* @ param value
* @ return */
public T withParam ( String name , String value ) { } } | parameters . put ( name , value ) ; return self ; |
public class LoopExtensions { /** * Iterates elements and execute the procedure .
* A prefix , a separator and a suffix can be initialized with the loopInitializer lambda . */
public < T extends Object > void forEach ( final ITreeAppendable appendable , final Iterable < T > elements , final Procedure1 < ? super LoopParams > loopInitializer , final Procedure1 < ? super T > procedure ) { } } | boolean _isEmpty = IterableExtensions . isEmpty ( elements ) ; if ( _isEmpty ) { return ; } LoopParams _loopParams = new LoopParams ( ) ; final LoopParams params = ObjectExtensions . < LoopParams > operator_doubleArrow ( _loopParams , loopInitializer ) ; params . appendPrefix ( appendable ) ; T _head = IterableExtensions . < T > head ( elements ) ; ObjectExtensions . < T > operator_doubleArrow ( _head , procedure ) ; final Consumer < T > _function = ( T it ) -> { params . appendSeparator ( appendable ) ; ObjectExtensions . < T > operator_doubleArrow ( it , procedure ) ; } ; IterableExtensions . < T > tail ( elements ) . forEach ( _function ) ; params . appendSuffix ( appendable ) ; |
public class SQLService { /** * Converts the given string to a clob object
* @ param stringName string name to clob
* @ param sqlConnection Connection object
* @ return Clob object or NULL */
public Clob toClob ( String stringName , Connection sqlConnection ) { } } | Clob clobName = null ; try { clobName = sqlConnection . createClob ( ) ; clobName . setString ( 1 , stringName ) ; } catch ( SQLException e ) { // TODO Auto - generated catch block
logger . info ( "Unable to create clob object" ) ; e . printStackTrace ( ) ; } return clobName ; |
public class ProcessAssert { /** * Asserts the process instance with the provided id is active and in ( at lease ) an activity with the provided id .
* @ param processInstanceId
* the process instance ' s id to check for . May not be < code > null < / code >
* @ param activityId
* the activity ' s id to check for . May not be < code > null < / code > */
public static final void assertProcessInActivity ( final String processInstanceId , final String activityId ) { } } | Validate . notNull ( processInstanceId ) ; Validate . notNull ( activityId ) ; apiCallback . debug ( LogMessage . PROCESS_15 , processInstanceId , activityId ) ; try { getProcessInstanceAssertable ( ) . processIsInActivity ( processInstanceId , activityId ) ; } catch ( final AssertionError ae ) { apiCallback . fail ( ae , LogMessage . ERROR_PROCESS_6 , processInstanceId , activityId ) ; } |
public class Vectors { /** * Returns a subview for the given { @ code Vector } with a specified offset
* and length . { @ code Vector } instances that are not instances of either
* { @ link DoubleVector } or { @ link IntegerVector } will be returned as
* instances of { @ link DoubleVector } .
* @ param vector the { @ code Vector } whose values will be shown in the view
* @ param offset the index of { @ code v } at which the first index of this
* view starts
* @ param length the length of this view .
* @ throws IllegalArgumentException if < ul > < li > { @ code offset } is
* negative < li > { @ code length } is less than zero < li > the sum of { @ code
* offset } plus { @ code length } is greater than the length of { @ code
* vector } < / ul > */
public static Vector subview ( Vector vector , int offset , int length ) { } } | if ( vector instanceof IntegerVector ) return subview ( ( IntegerVector ) vector , offset , length ) ; else return subview ( asDouble ( vector ) , offset , length ) ; |
public class JCGLBufferUpdates { /** * Construct an update that will replace all of the data in { @ code buffer } .
* @ param buffer The buffer
* @ param < T > The precise type of buffer
* @ return An update */
public static < T extends JCGLBufferWritableType > JCGLBufferUpdateType < T > newUpdateReplacingAll ( final T buffer ) { } } | NullCheck . notNull ( buffer , "Buffer" ) ; return newUpdateReplacingRange ( buffer , buffer . byteRange ( ) ) ; |
public class FileUtils { /** * Copy file metadata into the supplied file element .
* @ param aFile A file to extract metadata from
* @ param aElement A destination element for the file metadata */
private static void copyMetadata ( final File aFile , final Element aElement ) { } } | final SimpleDateFormat formatter = new SimpleDateFormat ( DATE_FORMAT , Locale . US ) ; final StringBuilder permissions = new StringBuilder ( ) ; final Date date = new Date ( aFile . lastModified ( ) ) ; aElement . setAttribute ( FILE_PATH , aFile . getAbsolutePath ( ) ) ; aElement . setAttribute ( MODIFIED , formatter . format ( date ) ) ; if ( aFile . canRead ( ) ) { permissions . append ( 'r' ) ; } if ( aFile . canWrite ( ) ) { permissions . append ( 'w' ) ; } aElement . setAttribute ( "permissions" , permissions . toString ( ) ) ; |
public class ModelsImpl { /** * Create an entity role for an entity in the application .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param entityId The entity model ID .
* @ param createEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the UUID object */
public Observable < UUID > createEntityRoleAsync ( UUID appId , String versionId , UUID entityId , CreateEntityRoleOptionalParameter createEntityRoleOptionalParameter ) { } } | return createEntityRoleWithServiceResponseAsync ( appId , versionId , entityId , createEntityRoleOptionalParameter ) . map ( new Func1 < ServiceResponse < UUID > , UUID > ( ) { @ Override public UUID call ( ServiceResponse < UUID > response ) { return response . body ( ) ; } } ) ; |
public class Resource { /** * Set a date value .
* @ param index date index ( 1-10)
* @ param value date value */
public void setDate ( int index , Date value ) { } } | set ( selectField ( ResourceFieldLists . CUSTOM_DATE , index ) , value ) ; |
public class PairtreeUtils { /** * Removes the supplied Pairtree prefix from the supplied ID .
* @ param aPrefix A Pairtree prefix
* @ param aID An ID
* @ return The ID without the Pairtree prefix prepended to it
* @ throws PairtreeRuntimeException If the supplied prefix or ID is null */
public static String removePrefix ( final String aPrefix , final String aID ) { } } | Objects . requireNonNull ( aPrefix , LOGGER . getMessage ( MessageCodes . PT_006 ) ) ; Objects . requireNonNull ( aID , LOGGER . getMessage ( MessageCodes . PT_004 ) ) ; final String id ; if ( aID . indexOf ( aPrefix ) == 0 ) { id = aID . substring ( aPrefix . length ( ) ) ; } else { id = aID ; } return id ; |
public class ADrawItemEntry { /** * < p > Setter for itsDate . < / p >
* @ param pItsDate reference */
public final void setItsDate ( final Date pItsDate ) { } } | if ( pItsDate == null ) { this . itsDate = null ; } else { this . itsDate = new Date ( pItsDate . getTime ( ) ) ; } |
public class AbstractGenericMojo { /** * Utility method to use the clean plugin in the cleanup methods
* @ param elements Elements to configure the clean plugin
* @ throws MojoExecutionException Throws when error occurred in the clean plugin */
protected void useCleanPlugin ( Element ... elements ) throws MojoExecutionException { } } | List < Element > tempElems = new ArrayList < > ( Arrays . asList ( elements ) ) ; tempElems . add ( new Element ( "excludeDefaultDirectories" , "true" ) ) ; // Configure the Maven Clean Plugin to clean working files
executeMojo ( plugin ( groupId ( "org.apache.maven.plugins" ) , artifactId ( "maven-clean-plugin" ) , version ( "2.5" ) ) , goal ( "clean" ) , configuration ( tempElems . toArray ( new Element [ tempElems . size ( ) ] ) ) , executionEnvironment ( project , session , pluginManager ) ) ; |
public class DerInputBuffer { /** * Returns the Generalized Time value that takes up the specified
* number of bytes in this buffer .
* @ param len the number of bytes to use */
public Date getGeneralizedTime ( int len ) throws IOException { } } | if ( len > available ( ) ) throw new IOException ( "short read of DER Generalized Time" ) ; if ( len < 13 || len > 23 ) throw new IOException ( "DER Generalized Time length error" ) ; return getTime ( len , true ) ; |
public class Repository { /** * < p > removeRequirement . < / p >
* @ param requirement a { @ link com . greenpepper . server . domain . Requirement } object .
* @ throws com . greenpepper . server . GreenPepperServerException if any . */
public void removeRequirement ( Requirement requirement ) throws GreenPepperServerException { } } | if ( ! requirements . contains ( requirement ) ) throw new GreenPepperServerException ( GreenPepperServerErrorKey . REQUIREMENT_NOT_FOUND , "Requirement not found" ) ; requirements . remove ( requirement ) ; requirement . setRepository ( null ) ; |
public class ApplicationManifestUtils { /** * Write { @ link ApplicationManifest } s to an { @ link OutputStream }
* @ param out the { @ link OutputStream } to write to
* @ param applicationManifests the manifests to write */
public static void write ( OutputStream out , List < ApplicationManifest > applicationManifests ) { } } | try ( Writer writer = new OutputStreamWriter ( out ) ) { YAML . dump ( Collections . singletonMap ( "applications" , applicationManifests . stream ( ) . map ( ApplicationManifestUtils :: toYaml ) . collect ( Collectors . toList ( ) ) ) , writer ) ; } catch ( IOException e ) { throw Exceptions . propagate ( e ) ; } |
public class StringHelper { /** * Replaces all the from tokens in the given input string .
* This implementation is not recursive , not does it check for tokens in the replacement string .
* @ param input the input string
* @ param from the from string , must < b > not < / b > be < tt > null < / tt > or empty
* @ param to the replacement string , must < b > not < / b > be empty
* @ return the replaced string , or the input string if no replacement was needed
* @ throws IllegalArgumentException if the input arguments is invalid */
public static String replaceAll ( String input , String from , String to ) { } } | if ( input == null || input . isEmpty ( ) ) { return input ; } if ( from == null ) { throw new IllegalArgumentException ( "from cannot be null" ) ; } if ( to == null ) { // to can be empty , so only check for null
throw new IllegalArgumentException ( "to cannot be null" ) ; } // fast check if there is any from at all
if ( ! input . contains ( from ) ) { return input ; } final int len = from . length ( ) ; final int max = input . length ( ) ; StringBuilder sb = new StringBuilder ( max ) ; for ( int i = 0 ; i < max ; ) { if ( i + len <= max ) { String token = input . substring ( i , i + len ) ; if ( from . equals ( token ) ) { sb . append ( to ) ; // fast forward
i = i + len ; continue ; } } // append single char
sb . append ( input . charAt ( i ) ) ; // forward to next
i ++ ; } return sb . toString ( ) ; |
public class PageSourceImpl { /** * return file object , based on physical path and realpath
* @ return file Object */
@ Override public Resource getPhyscalFile ( ) { } } | if ( physcalSource == null ) { if ( ! mapping . hasPhysical ( ) ) { return null ; } Resource tmp = mapping . getPhysical ( ) . getRealResource ( relPath ) ; physcalSource = ResourceUtil . toExactResource ( tmp ) ; // fix if the case not match
if ( ! tmp . getAbsolutePath ( ) . equals ( physcalSource . getAbsolutePath ( ) ) ) { String relpath = extractRealpath ( relPath , physcalSource . getAbsolutePath ( ) ) ; // just a security !
if ( relPath . equalsIgnoreCase ( relpath ) ) { this . relPath = relpath ; createClassAndPackage ( ) ; } } } return physcalSource ; |
public class AbstractTTTLearner { /** * Chooses a block root , and finalizes the corresponding discriminator .
* @ return { @ code true } if a splittable block root was found , { @ code false } otherwise . */
protected boolean finalizeAny ( ) { } } | GlobalSplitter < I , D > splitter = findSplitterGlobal ( ) ; if ( splitter != null ) { finalizeDiscriminator ( splitter . blockRoot , splitter . localSplitter ) ; return true ; } return false ; |
public class Stapler { /** * Try to dispatch the request against the given node , and if it fails , report an error to the client . */
void invoke ( RequestImpl req , ResponseImpl rsp , Object node ) throws IOException , ServletException { } } | if ( node == null ) { // node is null
if ( ! Dispatcher . isTraceEnabled ( req ) ) { rsp . sendError ( SC_NOT_FOUND ) ; } else { // show error page
rsp . setStatus ( SC_NOT_FOUND ) ; rsp . setContentType ( "text/html;charset=UTF-8" ) ; PrintWriter w = rsp . getWriter ( ) ; w . println ( "<html><body>" ) ; w . println ( "<h1>404 Not Found</h1>" ) ; w . println ( "<p>Stapler processed this HTTP request as follows, but couldn't find the resource to consume the request" ) ; w . println ( "<pre>" ) ; EvaluationTrace . get ( req ) . printHtml ( w ) ; w . println ( "<font color=red>-> unexpected null!</font>" ) ; w . println ( "</pre>" ) ; w . println ( "<p>If this 404 is unexpected, double check the last part of the trace to see if it should have evaluated to null." ) ; w . println ( "</body></html>" ) ; } return ; } if ( tryInvoke ( req , rsp , node ) ) return ; // done
// we really run out of options .
if ( ! Dispatcher . isTraceEnabled ( req ) ) { rsp . sendError ( SC_NOT_FOUND ) ; } else { // show error page
rsp . setStatus ( SC_NOT_FOUND ) ; rsp . setContentType ( "text/html;charset=UTF-8" ) ; PrintWriter w = rsp . getWriter ( ) ; w . println ( "<html><body>" ) ; w . println ( "<h1>404 Not Found</h1>" ) ; w . println ( "<p>Stapler processed this HTTP request as follows, but couldn't find the resource to consume the request" ) ; w . println ( "<pre>" ) ; EvaluationTrace . get ( req ) . printHtml ( w ) ; w . printf ( "<font color=red>-> No matching rule was found on <%s> for \"%s\"</font>\n" , escape ( node . toString ( ) ) , req . tokens . assembleOriginalRestOfPath ( ) ) ; w . println ( "</pre>" ) ; w . printf ( "<p><%s> has the following URL mappings, in the order of preference:" , escape ( node . toString ( ) ) ) ; w . println ( "<ol>" ) ; MetaClass metaClass = webApp . getMetaClass ( node ) ; for ( Dispatcher d : metaClass . dispatchers ) { w . println ( "<li>" ) ; w . println ( d . toString ( ) ) ; } w . println ( "</ol>" ) ; w . println ( "</body></html>" ) ; } |
public class RecordReaderDataSetIterator { /** * Load a multiple examples to a DataSet , using the provided RecordMetaData instances .
* @ param list List of RecordMetaData instances to load from . Should have been produced by the record reader provided
* to the RecordReaderDataSetIterator constructor
* @ return DataSet with the specified examples
* @ throws IOException If an error occurs during loading of the data */
public DataSet loadFromMetaData ( List < RecordMetaData > list ) throws IOException { } } | if ( underlying == null ) { Record r = recordReader . loadFromMetaData ( list . get ( 0 ) ) ; initializeUnderlying ( r ) ; } // Convert back to composable :
List < RecordMetaData > l = new ArrayList < > ( list . size ( ) ) ; for ( RecordMetaData m : list ) { l . add ( new RecordMetaDataComposableMap ( Collections . singletonMap ( READER_KEY , m ) ) ) ; } MultiDataSet m = underlying . loadFromMetaData ( l ) ; return mdsToDataSet ( m ) ; |
public class ListVolumeRecoveryPointsResult { /** * An array of < a > VolumeRecoveryPointInfo < / a > objects .
* @ return An array of < a > VolumeRecoveryPointInfo < / a > objects . */
public java . util . List < VolumeRecoveryPointInfo > getVolumeRecoveryPointInfos ( ) { } } | if ( volumeRecoveryPointInfos == null ) { volumeRecoveryPointInfos = new com . amazonaws . internal . SdkInternalList < VolumeRecoveryPointInfo > ( ) ; } return volumeRecoveryPointInfos ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.