signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class Util { /** * Build the URL from the data obtained from the user .
* @ param url
* The URL to be transformed .
* @ param user
* The user name .
* @ param password
* The password .
* @ return The URL with userInfo .
* @ exception MalformedURLException
* Exception thrown if the URL is malformed . */
private static URL attachUserInfo ( URL url , String user , char [ ] password ) throws MalformedURLException { } }
|
if ( url == null ) { return null ; } if ( ( url . getAuthority ( ) == null || "" . equals ( url . getAuthority ( ) ) ) && ! "jar" . equals ( url . getProtocol ( ) ) ) { return url ; } StringBuilder buf = new StringBuilder ( ) ; String protocol = url . getProtocol ( ) ; if ( protocol . equals ( "jar" ) ) { URL newURL = new URL ( url . getPath ( ) ) ; newURL = attachUserInfo ( newURL , user , password ) ; buf . append ( "jar:" ) ; buf . append ( newURL . toString ( ) ) ; } else { password = correctPassword ( password ) ; user = correctUser ( user ) ; buf . append ( protocol ) ; buf . append ( "://" ) ; if ( ! "file" . equals ( protocol ) && user != null && user . trim ( ) . length ( ) > 0 ) { buf . append ( user ) ; if ( password != null && password . length > 0 ) { buf . append ( ":" ) ; buf . append ( password ) ; } buf . append ( "@" ) ; } buf . append ( url . getHost ( ) ) ; if ( url . getPort ( ) > 0 ) { buf . append ( ":" ) ; buf . append ( url . getPort ( ) ) ; } buf . append ( url . getPath ( ) ) ; String query = url . getQuery ( ) ; if ( query != null && query . trim ( ) . length ( ) > 0 ) { buf . append ( "?" ) . append ( query ) ; } String ref = url . getRef ( ) ; if ( ref != null && ref . trim ( ) . length ( ) > 0 ) { buf . append ( "#" ) . append ( ref ) ; } } return new URL ( buf . toString ( ) ) ;
|
public class FeedbackController { /** * Creates a MimeMessage based on a FeedbackForm . */
@ SuppressWarnings ( "squid:S3457" ) // do not use platform specific line ending
private SimpleMailMessage createFeedbackMessage ( FeedbackForm form ) { } }
|
SimpleMailMessage message = new SimpleMailMessage ( ) ; message . setTo ( userService . getSuEmailAddresses ( ) . toArray ( new String [ ] { } ) ) ; if ( form . hasEmail ( ) ) { message . setCc ( form . getEmail ( ) ) ; message . setReplyTo ( form . getEmail ( ) ) ; } else { message . setReplyTo ( "no-reply@molgenis.org" ) ; } String appName = appSettings . getTitle ( ) ; message . setSubject ( String . format ( "[feedback-%s] %s" , appName , form . getSubject ( ) ) ) ; message . setText ( String . format ( "Feedback from %s:\n\n%s" , form . getFrom ( ) , form . getFeedback ( ) ) ) ; return message ;
|
public class Context { /** * Get the connections for a connection listener
* @ param cl The connection listener
* @ return The value */
List < Object > getConnections ( ConnectionListener cl ) { } }
|
List < Object > l = null ; if ( clToC != null ) l = clToC . get ( cl ) ; if ( l == null ) l = Collections . emptyList ( ) ; return Collections . unmodifiableList ( l ) ;
|
public class ApplicationElement { /** * - - - - - state update */
void update ( ) { } }
|
Application . update ( filter , list , main , footer , toggleAll , count , clearCompleted ) ;
|
public class CareMessages { /** * 客服发送文本消息
* @ param openId
* @ param text
* @ param from 客服账号 */
public void text ( String openId , String text , String from ) { } }
|
Map < String , Object > request = initMessage ( openId , "text" , from ) ; request . put ( "text" , new Text ( text ) ) ; String url = WxEndpoint . get ( "url.care.message.send" ) ; wxClient . post ( url , JsonMapper . defaultMapper ( ) . toJson ( request ) ) ;
|
public class DocumentRevisionBuilder { /** * < p > Builds and returns the { @ link InternalDocumentRevision } for this builder . < / p >
* @ return the { @ link InternalDocumentRevision } for this builder */
public InternalDocumentRevision build ( ) { } }
|
DocumentRevisionOptions options = new DocumentRevisionOptions ( ) ; options . sequence = sequence ; options . docInternalId = docInternalId ; options . deleted = deleted ; options . current = current ; options . parent = parent ; options . attachments = attachments ; return new InternalDocumentRevision ( docId , revId , body , options ) ;
|
public class DeleteEnvironmentMembershipRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteEnvironmentMembershipRequest deleteEnvironmentMembershipRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( deleteEnvironmentMembershipRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteEnvironmentMembershipRequest . getEnvironmentId ( ) , ENVIRONMENTID_BINDING ) ; protocolMarshaller . marshall ( deleteEnvironmentMembershipRequest . getUserArn ( ) , USERARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class OrmBase { /** * Case insensitive comparison . */
protected static boolean isIgnoredColumn ( final Set < String > ignoredColumns , final String columnName ) { } }
|
return ignoredColumns . stream ( ) . anyMatch ( s -> s . equalsIgnoreCase ( columnName ) ) ;
|
public class OpenVidu { /** * Starts the recording of a { @ link io . openvidu . java . client . Session }
* @ param sessionId The sessionId of the session you want to start recording
* @ param name The name you want to give to the video file . You can access
* this same value in your clients on recording events
* ( recordingStarted , recordingStopped ) . < strong > WARNING : this
* parameter follows an overwriting policy . < / strong > If you
* name two recordings the same , the newest MP4 file will
* overwrite the oldest one
* @ return The started recording . If this method successfully returns the
* Recording object it means that the recording can be stopped with
* guarantees
* @ throws OpenViduJavaClientException
* @ throws OpenViduHttpException Value returned from
* { @ link io . openvidu . java . client . OpenViduHttpException # getStatus ( ) }
* < ul >
* < li > < code > 404 < / code > : no session exists
* for the passed < i > sessionId < / i > < / li >
* < li > < code > 406 < / code > : the session has no
* connected participants < / li >
* < li > < code > 422 < / code > : " resolution "
* parameter exceeds acceptable values ( for
* both width and height , min 100px and max
* 1999px ) or trying to start a recording
* with both " hasAudio " and " hasVideo " to
* false < / li >
* < li > < code > 409 < / code > : the session is not
* configured for using
* { @ link io . openvidu . java . client . MediaMode # ROUTED }
* or it is already being recorded < / li >
* < li > < code > 501 < / code > : OpenVidu Server
* recording module is disabled
* ( < i > openvidu . recording < / i > property set
* to < i > false < / i > ) < / li >
* < / ul > */
public Recording startRecording ( String sessionId , String name ) throws OpenViduJavaClientException , OpenViduHttpException { } }
|
if ( name == null ) { name = "" ; } return this . startRecording ( sessionId , new RecordingProperties . Builder ( ) . name ( name ) . build ( ) ) ;
|
public class WVideoRenderer { /** * Converts a Track kind to the client track kind identifier .
* @ param kind the Track Kind to convert .
* @ return a client track kind identifier , or null if it could not be converted . */
private String trackKindToString ( final Track . Kind kind ) { } }
|
if ( kind == null ) { return null ; } switch ( kind ) { case SUBTITLES : return "subtitles" ; case CAPTIONS : return "captions" ; case DESCRIPTIONS : return "descriptions" ; case CHAPTERS : return "chapters" ; case METADATA : return "metadata" ; default : LOG . error ( "Unknown track kind " + kind ) ; return null ; }
|
public class MediaExceptionProcessor { /** * ( non - Javadoc )
* @ see
* com . microsoft . windowsazure . services . media . entityoperations . EntityContract
* # create ( com . microsoft . windowsazure . services . media . entityoperations .
* EntityCreateOperation ) */
@ Override public < T > T create ( EntityCreateOperation < T > creator ) throws ServiceException { } }
|
try { return service . create ( creator ) ; } catch ( UniformInterfaceException e ) { throw processCatch ( new ServiceException ( e ) ) ; } catch ( ClientHandlerException e ) { throw processCatch ( new ServiceException ( e ) ) ; }
|
public class CPDefinitionLinkLocalServiceBaseImpl { /** * Deletes the cp definition link from the database . Also notifies the appropriate model listeners .
* @ param cpDefinitionLink the cp definition link
* @ return the cp definition link that was removed */
@ Indexable ( type = IndexableType . DELETE ) @ Override public CPDefinitionLink deleteCPDefinitionLink ( CPDefinitionLink cpDefinitionLink ) { } }
|
return cpDefinitionLinkPersistence . remove ( cpDefinitionLink ) ;
|
public class DescribeEcsClustersResult { /** * A list of < code > EcsCluster < / code > objects containing the cluster descriptions .
* @ param ecsClusters
* A list of < code > EcsCluster < / code > objects containing the cluster descriptions . */
public void setEcsClusters ( java . util . Collection < EcsCluster > ecsClusters ) { } }
|
if ( ecsClusters == null ) { this . ecsClusters = null ; return ; } this . ecsClusters = new com . amazonaws . internal . SdkInternalList < EcsCluster > ( ecsClusters ) ;
|
public class BitSetOrdinalIterator { /** * { @ inheritDoc } */
@ Override public int nextOrdinal ( ) { } }
|
if ( offset >>> 3 == reader . length ( ) ) return NO_MORE_ORDINALS ; skipToNextPopulatedByte ( ) ; while ( moreBytesToRead ( ) ) { if ( testCurrentBit ( ) ) { return offset ++ ; } offset ++ ; } return NO_MORE_ORDINALS ;
|
public class JpaDistributionSetManagement { /** * Method to get the latest distribution set based on DS ID after the
* metadata changes for that distribution set .
* @ param distId
* of the DS to touch */
private JpaDistributionSet touch ( final Long distId ) { } }
|
return touch ( get ( distId ) . orElseThrow ( ( ) -> new EntityNotFoundException ( DistributionSet . class , distId ) ) ) ;
|
public class BingSpellCheckOperationsImpl { /** * The Bing Spell Check API lets you perform contextual grammar and spell checking . Bing has developed a web - based spell - checker that leverages machine learning and statistical machine translation to dynamically train a constantly evolving and highly contextual algorithm . The spell - checker is based on a massive corpus of web searches and documents .
* @ param text The text string to check for spelling and grammar errors . The combined length of the text string , preContextText string , and postContextText string may not exceed 10,000 characters . You may specify this parameter in the query string of a GET request or in the body of a POST request . Because of the query string length limit , you ' ll typically use a POST request unless you ' re checking only short strings .
* @ param acceptLanguage A comma - delimited list of one or more languages to use for user interface strings . The list is in decreasing order of preference . For additional information , including expected format , see [ RFC2616 ] ( http : / / www . w3 . org / Protocols / rfc2616 / rfc2616 - sec14 . html ) . This header and the setLang query parameter are mutually exclusive ; do not specify both . If you set this header , you must also specify the cc query parameter . Bing will use the first supported language it finds from the list , and combine that language with the cc parameter value to determine the market to return results for . If the list does not include a supported language , Bing will find the closest language and market that supports the request , and may use an aggregated or default market for the results instead of a specified one . You should use this header and the cc query parameter only if you specify multiple languages ; otherwise , you should use the mkt and setLang query parameters . A user interface string is a string that ' s used as a label in a user interface . There are very few user interface strings in the JSON response objects . Any links in the response objects to Bing . com properties will apply the specified language .
* @ param pragma By default , Bing returns cached content , if available . To prevent Bing from returning cached content , set the Pragma header to no - cache ( for example , Pragma : no - cache ) .
* @ param userAgent The user agent originating the request . Bing uses the user agent to provide mobile users with an optimized experience . Although optional , you are strongly encouraged to always specify this header . The user - agent should be the same string that any commonly used browser would send . For information about user agents , see [ RFC 2616 ] ( http : / / www . w3 . org / Protocols / rfc2616 / rfc2616 - sec14 . html ) .
* @ param clientId Bing uses this header to provide users with consistent behavior across Bing API calls . Bing often flights new features and improvements , and it uses the client ID as a key for assigning traffic on different flights . If you do not use the same client ID for a user across multiple requests , then Bing may assign the user to multiple conflicting flights . Being assigned to multiple conflicting flights can lead to an inconsistent user experience . For example , if the second request has a different flight assignment than the first , the experience may be unexpected . Also , Bing can use the client ID to tailor web results to that client ID ’ s search history , providing a richer experience for the user . Bing also uses this header to help improve result rankings by analyzing the activity generated by a client ID . The relevance improvements help with better quality of results delivered by Bing APIs and in turn enables higher click - through rates for the API consumer . IMPORTANT : Although optional , you should consider this header required . Persisting the client ID across multiple requests for the same end user and device combination enables 1 ) the API consumer to receive a consistent user experience , and 2 ) higher click - through rates via better quality of results from the Bing APIs . Each user that uses your application on the device must have a unique , Bing generated client ID . If you do not include this header in the request , Bing generates an ID and returns it in the X - MSEdge - ClientID response header . The only time that you should NOT include this header in a request is the first time the user uses your app on that device . Use the client ID for each Bing API request that your app makes for this user on the device . Persist the client ID . To persist the ID in a browser app , use a persistent HTTP cookie to ensure the ID is used across all sessions . Do not use a session cookie . For other apps such as mobile apps , use the device ' s persistent storage to persist the ID . The next time the user uses your app on that device , get the client ID that you persisted . Bing responses may or may not include this header . If the response includes this header , capture the client ID and use it for all subsequent Bing requests for the user on that device . If you include the X - MSEdge - ClientID , you must not include cookies in the request .
* @ param clientIp The IPv4 or IPv6 address of the client device . The IP address is used to discover the user ' s location . Bing uses the location information to determine safe search behavior . Although optional , you are encouraged to always specify this header and the X - Search - Location header . Do not obfuscate the address ( for example , by changing the last octet to 0 ) . Obfuscating the address results in the location not being anywhere near the device ' s actual location , which may result in Bing serving erroneous results .
* @ param location A semicolon - delimited list of key / value pairs that describe the client ' s geographical location . Bing uses the location information to determine safe search behavior and to return relevant local content . Specify the key / value pair as & lt ; key & gt ; : & lt ; value & gt ; . The following are the keys that you use to specify the user ' s location . lat ( required ) : The latitude of the client ' s location , in degrees . The latitude must be greater than or equal to - 90.0 and less than or equal to + 90.0 . Negative values indicate southern latitudes and positive values indicate northern latitudes . long ( required ) : The longitude of the client ' s location , in degrees . The longitude must be greater than or equal to - 180.0 and less than or equal to + 180.0 . Negative values indicate western longitudes and positive values indicate eastern longitudes . re ( required ) : The radius , in meters , which specifies the horizontal accuracy of the coordinates . Pass the value returned by the device ' s location service . Typical values might be 22m for GPS / Wi - Fi , 380m for cell tower triangulation , and 18,000m for reverse IP lookup . ts ( optional ) : The UTC UNIX timestamp of when the client was at the location . ( The UNIX timestamp is the number of seconds since January 1 , 1970 . ) head ( optional ) : The client ' s relative heading or direction of travel . Specify the direction of travel as degrees from 0 through 360 , counting clockwise relative to true north . Specify this key only if the sp key is nonzero . sp ( optional ) : The horizontal velocity ( speed ) , in meters per second , that the client device is traveling . alt ( optional ) : The altitude of the client device , in meters . are ( optional ) : The radius , in meters , that specifies the vertical accuracy of the coordinates . Specify this key only if you specify the alt key . Although many of the keys are optional , the more information that you provide , the more accurate the location results are . Although optional , you are encouraged to always specify the user ' s geographical location . Providing the location is especially important if the client ' s IP address does not accurately reflect the user ' s physical location ( for example , if the client uses VPN ) . For optimal results , you should include this header and the X - Search - ClientIP header , but at a minimum , you should include this header .
* @ param actionType A string that ' s used by logging to determine whether the request is coming from an interactive session or a page load . The following are the possible values . 1 ) Edit — The request is from an interactive session 2 ) Load — The request is from a page load . Possible values include : ' Edit ' , ' Load '
* @ param appName The unique name of your app . The name must be known by Bing . Do not include this parameter unless you have previously contacted Bing to get a unique app name . To get a unique name , contact your Bing Business Development manager .
* @ param countryCode A 2 - character country code of the country where the results come from . This API supports only the United States market . If you specify this query parameter , it must be set to us . If you set this parameter , you must also specify the Accept - Language header . Bing uses the first supported language it finds from the languages list , and combine that language with the country code that you specify to determine the market to return results for . If the languages list does not include a supported language , Bing finds the closest language and market that supports the request , or it may use an aggregated or default market for the results instead of a specified one . You should use this query parameter and the Accept - Language query parameter only if you specify multiple languages ; otherwise , you should use the mkt and setLang query parameters . This parameter and the mkt query parameter are mutually exclusive — do not specify both .
* @ param clientMachineName A unique name of the device that the request is being made from . Generate a unique value for each device ( the value is unimportant ) . The service uses the ID to help debug issues and improve the quality of corrections .
* @ param docId A unique ID that identifies the document that the text belongs to . Generate a unique value for each document ( the value is unimportant ) . The service uses the ID to help debug issues and improve the quality of corrections .
* @ param market The market where the results come from . You are strongly encouraged to always specify the market , if known . Specifying the market helps Bing route the request and return an appropriate and optimal response . This parameter and the cc query parameter are mutually exclusive — do not specify both .
* @ param sessionId A unique ID that identifies this user session . Generate a unique value for each user session ( the value is unimportant ) . The service uses the ID to help debug issues and improve the quality of corrections
* @ param setLang The language to use for user interface strings . Specify the language using the ISO 639-1 2 - letter language code . For example , the language code for English is EN . The default is EN ( English ) . Although optional , you should always specify the language . Typically , you set setLang to the same language specified by mkt unless the user wants the user interface strings displayed in a different language . This parameter and the Accept - Language header are mutually exclusive — do not specify both . A user interface string is a string that ' s used as a label in a user interface . There are few user interface strings in the JSON response objects . Also , any links to Bing . com properties in the response objects apply the specified language .
* @ param userId A unique ID that identifies the user . Generate a unique value for each user ( the value is unimportant ) . The service uses the ID to help debug issues and improve the quality of corrections .
* @ param mode The type of spelling and grammar checks to perform . The following are the possible values ( the values are case insensitive ) . The default is Proof . 1 ) Proof — Finds most spelling and grammar mistakes . 2 ) Spell — Finds most spelling mistakes but does not find some of the grammar errors that Proof catches ( for example , capitalization and repeated words ) . Possible values include : ' proof ' , ' spell '
* @ param preContextText A string that gives context to the text string . For example , the text string petal is valid . However , if you set preContextText to bike , the context changes and the text string becomes not valid . In this case , the API suggests that you change petal to pedal ( as in bike pedal ) . This text is not checked for grammar or spelling errors . The combined length of the text string , preContextText string , and postContextText string may not exceed 10,000 characters . You may specify this parameter in the query string of a GET request or in the body of a POST request .
* @ param postContextText A string that gives context to the text string . For example , the text string read is valid . However , if you set postContextText to carpet , the context changes and the text string becomes not valid . In this case , the API suggests that you change read to red ( as in red carpet ) . This text is not checked for grammar or spelling errors . The combined length of the text string , preContextText string , and postContextText string may not exceed 10,000 characters . You may specify this parameter in the query string of a GET request or in the body of a POST request .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the SpellCheck object */
public Observable < ServiceResponse < SpellCheck > > spellCheckerWithServiceResponseAsync ( String text , String acceptLanguage , String pragma , String userAgent , String clientId , String clientIp , String location , ActionType actionType , String appName , String countryCode , String clientMachineName , String docId , String market , String sessionId , String setLang , String userId , String mode , String preContextText , String postContextText ) { } }
|
if ( text == null ) { throw new IllegalArgumentException ( "Parameter text is required and cannot be null." ) ; } final String xBingApisSDK = "true" ; return service . spellChecker ( xBingApisSDK , acceptLanguage , pragma , userAgent , clientId , clientIp , location , actionType , appName , countryCode , clientMachineName , docId , market , sessionId , setLang , userId , mode , preContextText , postContextText , text ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < SpellCheck > > > ( ) { @ Override public Observable < ServiceResponse < SpellCheck > > call ( Response < ResponseBody > response ) { try { ServiceResponse < SpellCheck > clientResponse = spellCheckerDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
|
public class AOValue { /** * Returns the source meUuid this message is being requested from . ( Usually the local ME unless
* gathering is taking place )
* Returns null if pre - WAS70 data
* @ return */
public SIBUuid8 getSourceMEUuid ( ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getSourceMEUuid" ) ; SibTr . exit ( tc , "getSourceMEUuid" , sourceMEUuid ) ; } return sourceMEUuid ;
|
public class DefaultGrailsApplication { /** * Retrieves a class from the GrailsApplication for the given name .
* @ param className The class name
* @ return Either the Class instance or null if it doesn ' t exist */
public Class < ? > getClassForName ( String className ) { } }
|
if ( ! StringUtils . hasText ( className ) ) { return null ; } for ( Class < ? > c : allClasses ) { if ( c . getName ( ) . equals ( className ) ) { return c ; } } return null ;
|
public class AWSDirectoryServiceClient { /** * Removes the specified directory as a publisher to the specified SNS topic .
* @ param deregisterEventTopicRequest
* Removes the specified directory as a publisher to the specified SNS topic .
* @ return Result of the DeregisterEventTopic operation returned by the service .
* @ throws EntityDoesNotExistException
* The specified entity could not be found .
* @ throws InvalidParameterException
* One or more parameters are not valid .
* @ throws ClientException
* A client exception has occurred .
* @ throws ServiceException
* An exception has occurred in AWS Directory Service .
* @ sample AWSDirectoryService . DeregisterEventTopic
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ds - 2015-04-16 / DeregisterEventTopic " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DeregisterEventTopicResult deregisterEventTopic ( DeregisterEventTopicRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeDeregisterEventTopic ( request ) ;
|
public class Provisioner { /** * InstallStatus object and used in FFDC at a more appropriate time . */
public void installBundles ( final BundleContext bContext , final BundleList bundleList , final BundleInstallStatus installStatus , final int minStartLevel , final int defaultStartLevel , final int defaultInitialStartLevel , final WsLocationAdmin locSvc ) { } }
|
if ( bundleList == null || bundleList . isEmpty ( ) ) return ; final FrameworkWiring fwkWiring = featureManager . bundleContext . getBundle ( Constants . SYSTEM_BUNDLE_LOCATION ) . adapt ( FrameworkWiring . class ) ; final File bootFile = getBootJar ( ) ; bundleList . foreach ( new BundleList . FeatureResourceHandler ( ) { @ Override @ FFDCIgnore ( { IllegalStateException . class , Exception . class } ) public boolean handle ( FeatureResource fr ) { Bundle bundle = null ; WsResource resource = null ; String urlString = fr . getLocation ( ) ; try { String bundleRepositoryType = fr . getBundleRepositoryType ( ) ; BundleRepositoryHolder bundleRepositoryHolder = featureManager . getBundleRepositoryHolder ( bundleRepositoryType ) ; if ( bundleRepositoryHolder == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Bundle repository not found for type=" + bundleRepositoryType ) ; } Tr . error ( tc , "UPDATE_MISSING_BUNDLE_ERROR" , fr . getMatchString ( ) ) ; installStatus . addMissingBundle ( fr ) ; return true ; } // Get the product name for which the bundles are being installed .
String productName = bundleRepositoryHolder . getFeatureType ( ) ; if ( libertyBoot ) { bundle = installLibertyBootBundle ( productName , fr , fwkWiring ) ; } else { bundle = installFeatureBundle ( urlString , productName , bundleRepositoryHolder , fr ) ; } if ( bundle == null ) { return true ; } BundleStartLevel bsl = bundle . adapt ( BundleStartLevel . class ) ; BundleRevision bRev = bundle . adapt ( BundleRevision . class ) ; int level = 0 ; // For non - fragment bundles set the bundle startLevel then
// add to the list of bundles to be started .
// The order is important because the bundles are sorted by
// start level to preserve the start level ordering during
// dynamic feature additions .
if ( ( bRev . getTypes ( ) & BundleRevision . TYPE_FRAGMENT ) != BundleRevision . TYPE_FRAGMENT ) { level = bsl . getStartLevel ( ) ; // Set the start level on the bundle to the selected value
// if it hasn ' t been set before
if ( level == defaultInitialStartLevel ) { int sl = fr . getStartLevel ( ) ; int newLevel = ( sl == 0 ) ? defaultStartLevel : ( sl < minStartLevel ) ? minStartLevel : sl ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Changing the start level of bundle {0} from {1} to the current level of {2}" , bundle , level , newLevel ) ; } level = newLevel ; bsl . setStartLevel ( level ) ; } installStatus . addBundleToStart ( bundle ) ; } // need to get a resource for the bundle list createAssociation
// call , if we end up with a null resource then bad things
// happen , like we fail to uninstall bundles when we should
File bundleFile = getBundleFile ( bundle ) ; resource = locSvc . asResource ( bundleFile , bundleFile . isFile ( ) ) ; // Update bundle list with resolved information
bundleList . createAssociation ( fr , bundle , resource , level ) ; } catch ( IllegalStateException e ) { // The framework is stopping : this is an expected but not ideal occurrence .
installStatus . markContextInvalid ( e ) ; return false ; } catch ( Exception e ) { // We encountered an error installing a bundle , add it to
// the status , and continue . The caller will handle as appropriate
installStatus . addInstallException ( "INSTALL " + urlString + " (resolved from: " + fr + ")" , e ) ; } return true ; } private File getBundleFile ( Bundle bundle ) { if ( libertyBoot ) { return bootFile ; } // make sure we have a File for the bundle that is already
// installed . Get this by processing the location . We
// need to get past the reference : file : part of the URL .
String location = bundle . getLocation ( ) ; int index = location . indexOf ( BUNDLE_LOC_REFERENCE_TAG ) ; location = location . substring ( index + BUNDLE_LOC_REFERENCE_TAG . length ( ) ) ; // This file path is URL form , convert it back to a valid system File path
return new File ( URI . create ( location ) ) ; } private Bundle installLibertyBootBundle ( String productName , FeatureResource fr , FrameworkWiring fwkWiring ) throws BundleException , IOException { // getting the LibertyBootRuntime instance and installing the boot bundle
LibertyBootRuntime libertyBoot = featureManager . getLibertyBoot ( ) ; if ( libertyBoot == null ) { throw new IllegalStateException ( "No LibertBootRuntime service available!" ) ; } Bundle bundle = libertyBoot . installBootBundle ( fr . getSymbolicName ( ) , fr . getVersionRange ( ) , BUNDLE_LOC_FEATURE_TAG ) ; if ( bundle == null ) { installStatus . addMissingBundle ( fr ) ; return null ; } Region productRegion = getProductRegion ( productName ) ; Region current = featureManager . getDigraph ( ) . getRegion ( bundle ) ; if ( ! productRegion . equals ( current ) ) { current . removeBundle ( bundle ) ; productRegion . addBundle ( bundle ) ; } return bundle ; } private Bundle installFeatureBundle ( String urlString , String productName , BundleRepositoryHolder bundleRepositoryHolder , FeatureResource fr ) throws BundleException , IOException { Bundle bundle = fetchInstalledBundle ( urlString , productName ) ; if ( bundle == null ) { ContentBasedLocalBundleRepository lbr = bundleRepositoryHolder . getBundleRepository ( ) ; // Try to find the file , hopefully using the cached path
File bundleFile = lbr . selectBundle ( urlString , fr . getSymbolicName ( ) , fr . getVersionRange ( ) ) ; if ( bundleFile == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Bundle not matched" , lbr , fr ) ; } Tr . error ( tc , "UPDATE_MISSING_BUNDLE_ERROR" , fr . getMatchString ( ) ) ; installStatus . addMissingBundle ( fr ) ; return null ; } // Get URL from filename
URI uri = bundleFile . toURI ( ) ; urlString = uri . toURL ( ) . toString ( ) ; urlString = PathUtils . normalize ( urlString ) ; // Install this bundle as a " reference " - - this means that the
// framework will not copy this bundle into it ' s private cache ,
// it will run from the actual jar ( wherever it is ) .
urlString = BUNDLE_LOC_REFERENCE_TAG + urlString ; // Get the bundle location .
// The location format being returned must match the format in SchemaBundle and BundleList .
String location = getBundleLocation ( urlString , productName ) ; Region productRegion = getProductRegion ( productName ) ; // Bundle will just be returned if something from this location exists already .
bundle = productRegion . installBundleAtLocation ( location , new URL ( urlString ) . openStream ( ) ) ; } return bundle ; } private Bundle fetchInstalledBundle ( String urlString , String productName ) { // We install bundles as references so we need to ensure that we add reference : to the file url .
String location = getBundleLocation ( BUNDLE_LOC_REFERENCE_TAG + urlString , productName ) ; Bundle b = featureManager . bundleContext . getBundle ( location ) ; if ( b != null && b . getState ( ) == Bundle . UNINSTALLED ) { b = null ; } return b ; } } ) ;
|
public class MapEventPublisherImpl { /** * Return { @ code true } if the { @ code filter } requires the entry
* values ( old , new , merging ) to be included in the event .
* @ throws IllegalArgumentException if the filter type is not known */
static boolean isIncludeValue ( EventFilter filter ) { } }
|
// the order of the following ifs is important !
// QueryEventFilter is instance of EntryEventFilter
if ( filter instanceof EventListenerFilter ) { filter = ( ( EventListenerFilter ) filter ) . getEventFilter ( ) ; } if ( filter instanceof TrueEventFilter ) { return true ; } if ( filter instanceof QueryEventFilter ) { return ( ( QueryEventFilter ) filter ) . isIncludeValue ( ) ; } if ( filter instanceof EntryEventFilter ) { return ( ( EntryEventFilter ) filter ) . isIncludeValue ( ) ; } throw new IllegalArgumentException ( "Unknown EventFilter type = [" + filter . getClass ( ) . getCanonicalName ( ) + "]" ) ;
|
public class ChunkTopicParser { /** * Append XML content into root element
* @ param hrefValue href of the topicref
* @ param parentResult XML content to insert into
* @ param tmpContent XML content to insert */
private void insertAfter ( final URI hrefValue , final StringBuffer parentResult , final CharSequence tmpContent ) { } }
|
int insertpoint = parentResult . lastIndexOf ( "</" ) ; final int end = parentResult . indexOf ( ">" , insertpoint ) ; if ( insertpoint == - 1 || end == - 1 ) { logger . error ( MessageUtils . getMessage ( "DOTJ033E" , hrefValue . toString ( ) ) . toString ( ) ) ; } else { if ( ELEMENT_NAME_DITA . equals ( parentResult . substring ( insertpoint , end ) . trim ( ) ) ) { insertpoint = parentResult . lastIndexOf ( "</" , insertpoint - 1 ) ; } parentResult . insert ( insertpoint , tmpContent ) ; }
|
public class DefaultBrokerCache { /** * Get an object for the specified factory , key , scope , and broker . { @ link DefaultBrokerCache }
* guarantees that calling this method for the same factory , key , and scope will return the same object . */
@ SuppressWarnings ( value = "unchecked" ) < T , K extends SharedResourceKey > T getScoped ( final SharedResourceFactory < T , K , S > factory , @ Nonnull final K key , @ Nonnull final ScopeWrapper < S > scope , final SharedResourcesBrokerImpl < S > broker ) throws ExecutionException { } }
|
SharedResourceFactory < T , K , S > currentFactory = factory ; K currentKey = key ; ScopeWrapper < S > currentScope = scope ; Object obj = getScopedFromCache ( currentFactory , currentKey , currentScope , broker ) ; // this loop is to continue looking up objects through redirection or reloading until a valid resource is found
while ( true ) { if ( obj instanceof ResourceCoordinate ) { ResourceCoordinate < T , K , S > resourceCoordinate = ( ResourceCoordinate < T , K , S > ) obj ; if ( ! SharedResourcesBrokerUtils . isScopeTypeAncestor ( ( ScopeType ) currentScope . getType ( ) , ( ( ResourceCoordinate ) obj ) . getScope ( ) ) ) { throw new RuntimeException ( String . format ( "%s returned an invalid coordinate: scope %s is not an ancestor of %s." , currentFactory . getName ( ) , ( ( ResourceCoordinate ) obj ) . getScope ( ) , currentScope . getType ( ) ) ) ; } try { obj = getScopedFromCache ( resourceCoordinate . getFactory ( ) , resourceCoordinate . getKey ( ) , broker . getWrappedScope ( resourceCoordinate . getScope ( ) ) , broker ) ; } catch ( NoSuchScopeException nsse ) { throw new RuntimeException ( String . format ( "%s returned an invalid coordinate: scope %s is not available." , factory . getName ( ) , resourceCoordinate . getScope ( ) . name ( ) ) , nsse ) ; } } else if ( obj instanceof ResourceEntry ) { T resource = ( ( ResourceEntry < T > ) obj ) . getResourceIfValid ( ) ; // valid resource found
if ( resource != null ) { return resource ; } // resource is invalid . The lock in this block is to reduce the chance of starvation where a thread keeps
// getting objects that are invalidated by another thread .
Lock lock = this . invalidationLock . get ( key ) ; try { lock . lock ( ) ; RawJobBrokerKey fullKey = new RawJobBrokerKey ( currentScope , currentFactory . getName ( ) , currentKey ) ; safeInvalidate ( fullKey ) ; obj = getScopedFromCache ( currentFactory , currentKey , currentScope , broker ) ; } finally { lock . unlock ( ) ; } } else { throw new RuntimeException ( String . format ( "Invalid response from %s: %s." , factory . getName ( ) , obj . getClass ( ) ) ) ; } }
|
public class MongodbQueue { /** * Insert / Update the message to collection .
* @ param msg
* @ return */
protected boolean upsertToCollection ( IQueueMessage < ID , DATA > msg ) { } }
|
getCollection ( ) . replaceOne ( Filters . eq ( COLLECTION_FIELD_ID , msg . getId ( ) ) , toDocument ( msg ) , REPLACE_OPTIONS ) ; return true ;
|
public class MemcachedHandler { /** * On receive message from memcached server */
@ Override public final void onMessageReceived ( final Session session , final Object msg ) { } }
|
Command command = ( Command ) msg ; if ( this . statisticsHandler . isStatistics ( ) ) { if ( command . getCopiedMergeCount ( ) > 0 && command instanceof MapReturnValueAware ) { Map < String , CachedData > returnValues = ( ( MapReturnValueAware ) command ) . getReturnValues ( ) ; int size = returnValues . size ( ) ; this . statisticsHandler . statistics ( CommandType . GET_HIT , size ) ; this . statisticsHandler . statistics ( CommandType . GET_MISS , command . getCopiedMergeCount ( ) - size ) ; } else if ( command instanceof TextGetOneCommand || command instanceof BinaryGetCommand ) { if ( command . getResult ( ) != null ) { this . statisticsHandler . statistics ( CommandType . GET_HIT ) ; } else { this . statisticsHandler . statistics ( CommandType . GET_MISS ) ; } } else { if ( command . getCopiedMergeCount ( ) > 0 ) { this . statisticsHandler . statistics ( command . getCommandType ( ) , command . getCopiedMergeCount ( ) ) ; } else this . statisticsHandler . statistics ( command . getCommandType ( ) ) ; } }
|
public class CommercePriceListPersistenceImpl { /** * Returns the last commerce price list in the ordered set where groupId = & # 63 ; and status = & # 63 ; .
* @ param groupId the group ID
* @ param status the status
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce price list , or < code > null < / code > if a matching commerce price list could not be found */
@ Override public CommercePriceList fetchByG_S_Last ( long groupId , int status , OrderByComparator < CommercePriceList > orderByComparator ) { } }
|
int count = countByG_S ( groupId , status ) ; if ( count == 0 ) { return null ; } List < CommercePriceList > list = findByG_S ( groupId , status , count - 1 , count , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ;
|
public class NatsConnectionReader { /** * Gather the op , either up to the first space or the first carraige return . */
void gatherOp ( int maxPos ) throws IOException { } }
|
try { while ( this . bufferPosition < maxPos ) { byte b = this . buffer [ this . bufferPosition ] ; this . bufferPosition ++ ; if ( gotCR ) { if ( b == NatsConnection . LF ) { // Got CRLF , jump to parsing
this . op = opFor ( opArray , opPos ) ; this . gotCR = false ; this . opPos = 0 ; this . mode = Mode . PARSE_PROTO ; break ; } else { throw new IllegalStateException ( "Bad socket data, no LF after CR" ) ; } } else if ( b == SPACE || b == TAB ) { // Got a space , get the rest of the protocol line
this . op = opFor ( opArray , opPos ) ; this . opPos = 0 ; if ( this . op == NatsConnection . OP_MSG ) { this . msgLinePosition = 0 ; this . mode = Mode . GATHER_MSG_PROTO ; } else { this . mode = Mode . GATHER_PROTO ; } break ; } else if ( b == NatsConnection . CR ) { this . gotCR = true ; } else { this . opArray [ opPos ] = ( char ) b ; this . opPos ++ ; } } } catch ( ArrayIndexOutOfBoundsException | IllegalStateException | NumberFormatException | NullPointerException ex ) { this . encounteredProtocolError ( ex ) ; }
|
public class PlannerReader { /** * This method extracts task data from a Planner file .
* @ param plannerProject Root node of the Planner file */
private void readTasks ( Project plannerProject ) throws MPXJException { } }
|
Tasks tasks = plannerProject . getTasks ( ) ; if ( tasks != null ) { for ( net . sf . mpxj . planner . schema . Task task : tasks . getTask ( ) ) { readTask ( null , task ) ; } for ( net . sf . mpxj . planner . schema . Task task : tasks . getTask ( ) ) { readPredecessors ( task ) ; } } m_projectFile . updateStructure ( ) ;
|
public class QDate { /** * Calculates the month based on the day of the year . */
private void calculateMonth ( ) { } }
|
_dayOfMonth = _dayOfYear ; for ( _month = 0 ; _month < 12 ; _month ++ ) { if ( _month == 1 && _isLeapYear ) { if ( _dayOfMonth < 29 ) return ; else _dayOfMonth -= 29 ; } else if ( _dayOfMonth < DAYS_IN_MONTH [ ( int ) _month ] ) return ; else _dayOfMonth -= DAYS_IN_MONTH [ ( int ) _month ] ; }
|
public class TupleComparatorBase { /** * ScalaTupleComparator */
protected void privateDuplicate ( TupleComparatorBase < T > toClone ) { } }
|
// copy fields and serializer factories
this . keyPositions = toClone . keyPositions ; this . serializers = new TypeSerializer [ toClone . serializers . length ] ; for ( int i = 0 ; i < toClone . serializers . length ; i ++ ) { this . serializers [ i ] = toClone . serializers [ i ] . duplicate ( ) ; } this . comparators = new TypeComparator [ toClone . comparators . length ] ; for ( int i = 0 ; i < toClone . comparators . length ; i ++ ) { this . comparators [ i ] = toClone . comparators [ i ] . duplicate ( ) ; } this . normalizedKeyLengths = toClone . normalizedKeyLengths ; this . numLeadingNormalizableKeys = toClone . numLeadingNormalizableKeys ; this . normalizableKeyPrefixLen = toClone . normalizableKeyPrefixLen ; this . invertNormKey = toClone . invertNormKey ;
|
public class DefaultFileIO { /** * Set whether file should be created if it does not exist . When this method is not invoked , *
* bind operations will fail if the file does not exist .
* @ return this to provide a fluent API . */
@ Override public FileIO failIfNotExists ( final boolean ... failOnFNF ) { } }
|
this . failIfNotExists = ( failOnFNF != null ) && ( ( failOnFNF . length == 0 ) || ( ( failOnFNF . length > 0 ) && failOnFNF [ 0 ] ) ) ; return this ;
|
public class CreateDocumentRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateDocumentRequest createDocumentRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( createDocumentRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createDocumentRequest . getContent ( ) , CONTENT_BINDING ) ; protocolMarshaller . marshall ( createDocumentRequest . getAttachments ( ) , ATTACHMENTS_BINDING ) ; protocolMarshaller . marshall ( createDocumentRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createDocumentRequest . getVersionName ( ) , VERSIONNAME_BINDING ) ; protocolMarshaller . marshall ( createDocumentRequest . getDocumentType ( ) , DOCUMENTTYPE_BINDING ) ; protocolMarshaller . marshall ( createDocumentRequest . getDocumentFormat ( ) , DOCUMENTFORMAT_BINDING ) ; protocolMarshaller . marshall ( createDocumentRequest . getTargetType ( ) , TARGETTYPE_BINDING ) ; protocolMarshaller . marshall ( createDocumentRequest . getTags ( ) , TAGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class SubtitleLineContentToHtmlBase { /** * TODO : write furigana separately on each kanji section */
private void appendRubyElements ( RendersnakeHtmlCanvas html , List < SubtitleItem . Inner > elements ) throws IOException { } }
|
for ( SubtitleItem . Inner element : elements ) { String kanji = element . getKanji ( ) ; if ( kanji != null ) { html . ruby ( ) ; html . spanKanji ( kanji ) ; html . rt ( element . getText ( ) ) ; html . _ruby ( ) ; } else { html . write ( element . getText ( ) ) ; } }
|
public class PartialResponseWriter { /** * < p class = " changed _ added _ 2_0 " > Write the end of an update operation . < / p >
* @ throws IOException if an input / output error occurs
* @ since 2.0 */
public void endUpdate ( ) throws IOException { } }
|
ResponseWriter writer = getWrapped ( ) ; writer . endCDATA ( ) ; writer . endElement ( "update" ) ; inUpdate = false ;
|
public class ZkConnection { /** * 仅供内部测试使用 */
public static void start ( String connectionStr ) { } }
|
synchronized ( zkConnectionStartStopLock ) { if ( connected . get ( ) ) { LOG . info ( "zkConnection已经启动,不再重复启动" ) ; return ; } try { RetryPolicy retryPolicy = new ExponentialBackoffRetry ( 1000 , 3 ) ; client = CuratorFrameworkFactory . newClient ( connectionStr , retryPolicy ) ; client . start ( ) ; LOG . info ( "阻塞直到与zookeeper连接建立完毕!" ) ; client . blockUntilConnected ( ) ; } catch ( Throwable e ) { LOG . error ( e ) ; } finally { connected . set ( true ) ; } }
|
public class XMLUtils { /** * Returns Apache Solr add command .
* @ param values
* values to include
* @ return XML as String */
public static String getSolrAddDocument ( Map < String , String > values ) { } }
|
StringBuilder builder = new StringBuilder ( ) ; builder . append ( "<add><doc>" ) ; for ( Map . Entry < String , String > pair : values . entrySet ( ) ) { XMLUtils . addSolrField ( builder , pair ) ; } builder . append ( "</doc></add>" ) ; return builder . toString ( ) ;
|
public class FileListener { /** * Decode and read this field from the stream .
* Will create a new field , init it and set the data if the field is not passed in .
* @ param daIn The input stream to unmarshal the data from .
* @ param fldCurrent The field to unmarshall the data into ( optional ) . */
public BaseField readField ( ObjectInputStream daIn , BaseField fldCurrent ) throws IOException , ClassNotFoundException { } }
|
String strFieldName = daIn . readUTF ( ) ; Object objData = daIn . readObject ( ) ; if ( fldCurrent == null ) if ( strFieldName . length ( ) > 0 ) { fldCurrent = ( BaseField ) ClassServiceUtility . getClassService ( ) . makeObjectFromClassName ( strFieldName ) ; if ( fldCurrent != null ) { fldCurrent . init ( null , null , DBConstants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( this . getOwner ( ) != null ) // Make sure it is cleaned up
this . getOwner ( ) . addListener ( new RemoveConverterOnCloseHandler ( fldCurrent ) ) ; } } if ( fldCurrent != null ) fldCurrent . setData ( objData ) ; return fldCurrent ;
|
public class BridgeManager { /** * Events */
@ Override public void onReceive ( Object message ) throws Exception { } }
|
final Class < ? > klass = message . getClass ( ) ; final ActorRef self = self ( ) ; final ActorRef sender = sender ( ) ; if ( CreateBridge . class . equals ( klass ) ) { onCreateBridge ( ( CreateBridge ) message , self , sender ) ; } else if ( BridgeStateChanged . class . equals ( klass ) ) { onBridgeStateChanged ( ( BridgeStateChanged ) message , self , sender ) ; }
|
public class MaintenanceWindowLayout { /** * Text field to specify the schedule . */
private void createMaintenanceScheduleControl ( ) { } }
|
schedule = new TextFieldBuilder ( Action . MAINTENANCE_WINDOW_SCHEDULE_LENGTH ) . id ( UIComponentIdProvider . MAINTENANCE_WINDOW_SCHEDULE_ID ) . caption ( i18n . getMessage ( "caption.maintenancewindow.schedule" ) ) . validator ( new CronValidator ( ) ) . prompt ( "0 0 3 ? * 6" ) . required ( true , i18n ) . buildTextComponent ( ) ; schedule . addTextChangeListener ( new CronTranslationListener ( ) ) ;
|
public class TreeIterable { /** * Creates an { @ code Iterable } that starts at { @ code node } and iterates deeper into the tree in a depth - first order . */
public static < T > Iterable < T > depthFirst ( TreeDef < T > treeDef , T node ) { } }
|
return ( ) -> new Iterator < T > ( ) { Deque < T > queue = new ArrayDeque < > ( Arrays . asList ( node ) ) ; @ Override public boolean hasNext ( ) { return ! queue . isEmpty ( ) ; } @ Override public T next ( ) { if ( queue . isEmpty ( ) ) { throw new NoSuchElementException ( ) ; } T next = queue . removeLast ( ) ; List < T > children = treeDef . childrenOf ( next ) ; ListIterator < T > iterator = children . listIterator ( children . size ( ) ) ; while ( iterator . hasPrevious ( ) ) { queue . addLast ( iterator . previous ( ) ) ; } return next ; } } ;
|
public class UpdateUtils { /** * Update a destination file with an updater implementation , while maintaining appropriate
* locks around the action and file
* @ param updater updater
* @ param destFile destination
* @ throws UpdateException on error */
public static void update ( final FileUpdater updater , final File destFile ) throws UpdateException { } }
|
final File lockFile = new File ( destFile . getAbsolutePath ( ) + ".lock" ) ; final File newDestFile = new File ( destFile . getAbsolutePath ( ) + ".new" ) ; try { // synchronize writing to file within this jvm
synchronized ( UpdateUtils . class ) { final FileChannel channel = new RandomAccessFile ( lockFile , "rw" ) . getChannel ( ) ; // acquire file lock to block external jvm ( commandline ) from writing to file
final FileLock lock = channel . lock ( ) ; try { FileUtils . copyFileStreams ( destFile , newDestFile ) ; updater . updateFile ( newDestFile ) ; if ( newDestFile . isFile ( ) && newDestFile . length ( ) > 0 ) { moveFile ( newDestFile , destFile ) ; } else { throw new UpdateException ( "Result file was empty or not present: " + newDestFile ) ; } } catch ( FileUpdaterException e ) { throw new UpdateException ( e ) ; } finally { lock . release ( ) ; channel . close ( ) ; } } } catch ( IOException e ) { throw new UpdateException ( "Unable to get and write file: " + e . toString ( ) , e ) ; }
|
public class AbstractResultSetWrapper { /** * { @ inheritDoc }
* @ see java . sql . ResultSet # updateString ( java . lang . String , java . lang . String ) */
@ Override public void updateString ( final String columnLabel , final String x ) throws SQLException { } }
|
wrapped . updateString ( columnLabel , x ) ;
|
public class CmsPreferences { /** * Returns the values of all parameter methods of this workplace class instance . < p >
* This overwrites the super method because of the possible dynamic editor selection entries . < p >
* @ return the values of all parameter methods of this workplace class instance
* @ see org . opencms . workplace . CmsWorkplace # paramValues ( ) */
@ Override protected Map < String , Object > paramValues ( ) { } }
|
Map < String , Object > map = super . paramValues ( ) ; HttpServletRequest request = getJsp ( ) . getRequest ( ) ; Enumeration < ? > en = request . getParameterNames ( ) ; while ( en . hasMoreElements ( ) ) { String paramName = ( String ) en . nextElement ( ) ; if ( paramName . startsWith ( PARAM_PREFERREDEDITOR_PREFIX ) || paramName . startsWith ( PARAM_STARTGALLERY_PREFIX ) ) { String paramValue = request . getParameter ( paramName ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( paramValue ) ) { map . put ( paramName , CmsEncoder . decode ( paramValue ) ) ; } } } return map ;
|
public class ProxyDataSourceBuilder { /** * Register { @ link SystemOutSlowQueryListener } .
* @ return builder
* @ since 1.4.1 */
public ProxyDataSourceBuilder logSlowQueryToSysOut ( long thresholdTime , TimeUnit timeUnit ) { } }
|
this . createSysOutSlowQueryListener = true ; this . slowQueryThreshold = thresholdTime ; this . slowQueryTimeUnit = timeUnit ; return this ;
|
public class AreaConversions { /** * Convert an area .
* @ param a The area
* @ param < S > A phantom type parameter indicating the coordinate space of the
* area
* @ return An area */
public static < S > PAreaL < S > toPAreaL ( final AreaL a ) { } }
|
Objects . requireNonNull ( a , "area" ) ; return PAreaL . of ( a . minimumX ( ) , a . maximumX ( ) , a . minimumY ( ) , a . maximumY ( ) ) ;
|
public class ImageTransformationPanel { /** * This method is called from within the constructor to
* initialize the form .
* WARNING : Do NOT modify this code . The content of this method is
* always regenerated by the Form Editor . */
@ SuppressWarnings ( "unchecked" ) // < editor - fold defaultstate = " collapsed " desc = " Generated Code " > / / GEN - BEGIN : initComponents
private void initComponents ( ) { } }
|
setDoubleBuffered ( false ) ; setOpaque ( false ) ; addComponentListener ( new java . awt . event . ComponentAdapter ( ) { public void componentResized ( java . awt . event . ComponentEvent evt ) { formComponentResized ( evt ) ; } } ) ; javax . swing . GroupLayout layout = new javax . swing . GroupLayout ( this ) ; this . setLayout ( layout ) ; layout . setHorizontalGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGap ( 0 , 247 , Short . MAX_VALUE ) ) ; layout . setVerticalGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGap ( 0 , 145 , Short . MAX_VALUE ) ) ;
|
public class PlaybackService { /** * Pause the playback . */
private void pause ( ) { } }
|
if ( mHasAlreadyPlayed && ! mIsPaused ) { mIsPaused = true ; if ( ! mIsPreparing ) { mMediaPlayer . pause ( ) ; } // broadcast event
Intent intent = new Intent ( PlaybackListener . ACTION_ON_PLAYER_PAUSED ) ; mLocalBroadcastManager . sendBroadcast ( intent ) ; updateNotification ( ) ; mMediaSession . setPlaybackState ( MediaSessionWrapper . PLAYBACK_STATE_PAUSED ) ; pauseTimer ( ) ; }
|
public class AudioNormalizationSettingsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AudioNormalizationSettings audioNormalizationSettings , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( audioNormalizationSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( audioNormalizationSettings . getAlgorithm ( ) , ALGORITHM_BINDING ) ; protocolMarshaller . marshall ( audioNormalizationSettings . getAlgorithmControl ( ) , ALGORITHMCONTROL_BINDING ) ; protocolMarshaller . marshall ( audioNormalizationSettings . getTargetLkfs ( ) , TARGETLKFS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class AbstractWComponent { /** * { @ inheritDoc } */
@ Override public void setAccessibleText ( final String text , final Serializable ... args ) { } }
|
ComponentModel model = getOrCreateComponentModel ( ) ; model . setAccessibleText ( text , args ) ;
|
public class JacksonJsonFunction { /** * using toJson ( ) function */
private static void selectToJson ( CqlSession session ) { } }
|
Statement stmt = selectFrom ( "examples" , "json_jackson_function" ) . column ( "id" ) . function ( "toJson" , Selector . column ( "user" ) ) . as ( "user" ) . function ( "toJson" , Selector . column ( "scores" ) ) . as ( "scores" ) . whereColumn ( "id" ) . in ( literal ( 1 ) , literal ( 2 ) ) . build ( ) ; System . out . println ( ( ( SimpleStatement ) stmt ) . getQuery ( ) ) ; ResultSet rows = session . execute ( stmt ) ; for ( Row row : rows ) { int id = row . getInt ( "id" ) ; // retrieve the JSON payload and convert it to a User instance
User user = row . get ( "user" , User . class ) ; // it is also possible to retrieve the raw JSON payload
String userJson = row . getString ( "user" ) ; // retrieve the JSON payload and convert it to a JsonNode instance
// note that the codec requires that the type passed to the get ( ) method
// be always JsonNode , and not a subclass of it , such as ObjectNode
JsonNode scores = row . get ( "scores" , JsonNode . class ) ; // it is also possible to retrieve the raw JSON payload
String scoresJson = row . getString ( "scores" ) ; System . out . printf ( "Retrieved row:%n" + "id %d%n" + "user %s%n" + "user (raw) %s%n" + "scores %s%n" + "scores (raw) %s%n%n" , id , user , userJson , scores , scoresJson ) ; }
|
public class Analysis { /** * while 循环调用 . 直到返回为null则分词结束
* @ return
* @ throws IOException */
public Term next ( ) throws IOException { } }
|
Term term = null ; if ( ! terms . isEmpty ( ) ) { term = terms . poll ( ) ; term . updateOffe ( offe ) ; return term ; } String temp = br . readLine ( ) ; while ( StringUtil . isBlank ( temp ) ) { if ( temp == null ) { offe = br . getStart ( ) ; return null ; } else { temp = br . readLine ( ) ; } } offe = br . getStart ( ) ; // 歧异处理字符串
fullTerms ( temp ) ; if ( ! terms . isEmpty ( ) ) { term = terms . poll ( ) ; term . updateOffe ( offe ) ; return term ; } return null ;
|
public class forwardingsession { /** * Use this API to update forwardingsession resources . */
public static base_responses update ( nitro_service client , forwardingsession resources [ ] ) throws Exception { } }
|
base_responses result = null ; if ( resources != null && resources . length > 0 ) { forwardingsession updateresources [ ] = new forwardingsession [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { updateresources [ i ] = new forwardingsession ( ) ; updateresources [ i ] . name = resources [ i ] . name ; updateresources [ i ] . connfailover = resources [ i ] . connfailover ; } result = update_bulk_request ( client , updateresources ) ; } return result ;
|
public class Node { /** * Merges the line number and character number in one integer . The Character
* number takes the first 12 bits and the line number takes the rest . If
* the character number is greater than < code > 2 < sup > 12 < / sup > - 1 < / code > it is
* adjusted to < code > 2 < sup > 12 < / sup > - 1 < / code > . */
protected static int mergeLineCharNo ( int lineno , int charno ) { } }
|
if ( lineno < 0 || charno < 0 ) { return - 1 ; } else if ( ( charno & ~ COLUMN_MASK ) != 0 ) { return lineno << COLUMN_BITS | COLUMN_MASK ; } else { return lineno << COLUMN_BITS | ( charno & COLUMN_MASK ) ; }
|
public class StreamletUtils { /** * Verifies not blank text as the utility function .
* @ param text The text to verify
* @ param errorMessage The error message
* @ throws IllegalArgumentException if the requirement fails */
public static String checkNotBlank ( String text , String errorMessage ) { } }
|
if ( StringUtils . isBlank ( text ) ) { throw new IllegalArgumentException ( errorMessage ) ; } else { return text ; }
|
public class DeAromatizationTool { /** * Methods that takes a ring of which all bonds are aromatic , and assigns single
* and double bonds . It does this in a non - general way by looking at the ring
* size and take everything as a special case .
* @ param ring Ring to dearomatize
* @ return False if it could not convert the aromatic ring bond into single and double bonds */
public static boolean deAromatize ( IRing ring ) { } }
|
boolean allaromatic = true ; for ( int i = 0 ; i < ring . getBondCount ( ) ; i ++ ) { if ( ! ring . getBond ( i ) . getFlag ( CDKConstants . ISAROMATIC ) ) allaromatic = false ; } if ( ! allaromatic ) return false ; for ( int i = 0 ; i < ring . getBondCount ( ) ; i ++ ) { if ( ring . getBond ( i ) . getFlag ( CDKConstants . ISAROMATIC ) ) ring . getBond ( i ) . setOrder ( IBond . Order . SINGLE ) ; } boolean result = false ; IMolecularFormula formula = MolecularFormulaManipulator . getMolecularFormula ( ring ) ; // Map elementCounts = new MFAnalyser ( ring ) . getFormulaHashtable ( ) ;
if ( ring . getRingSize ( ) == 6 ) { if ( MolecularFormulaManipulator . getElementCount ( formula , new Element ( "C" ) ) == 6 ) { result = DeAromatizationTool . deAromatizeBenzene ( ring ) ; } else if ( MolecularFormulaManipulator . getElementCount ( formula , new Element ( "C" ) ) == 5 && MolecularFormulaManipulator . getElementCount ( formula , new Element ( "N" ) ) == 1 ) { result = DeAromatizationTool . deAromatizePyridine ( ring ) ; } } if ( ring . getRingSize ( ) == 5 ) { if ( MolecularFormulaManipulator . getElementCount ( formula , new Element ( "C" ) ) == 4 && MolecularFormulaManipulator . getElementCount ( formula , new Element ( "N" ) ) == 1 ) { result = deAromatizePyrolle ( ring ) ; } } return result ;
|
public class MnistManager { /** * Writes the given image in the given file using the PPM data format .
* @ param image
* @ param ppmFileName
* @ throws java . io . IOException */
public static void writeImageToPpm ( int [ ] [ ] image , String ppmFileName ) throws IOException { } }
|
try ( BufferedWriter ppmOut = new BufferedWriter ( new FileWriter ( ppmFileName ) ) ) { int rows = image . length ; int cols = image [ 0 ] . length ; ppmOut . write ( "P3\n" ) ; ppmOut . write ( "" + rows + " " + cols + " 255\n" ) ; for ( int [ ] anImage : image ) { StringBuilder s = new StringBuilder ( ) ; for ( int j = 0 ; j < cols ; j ++ ) { s . append ( anImage [ j ] + " " + anImage [ j ] + " " + anImage [ j ] + " " ) ; } ppmOut . write ( s . toString ( ) ) ; } }
|
public class Region { /** * 华南机房相关域名 */
public static Region region2 ( ) { } }
|
return new Builder ( ) . region ( "z2" ) . srcUpHost ( "up-z2.qiniup.com" , "up-dg.qiniup.com" , "up-fs.qiniup.com" ) . accUpHost ( "upload-z2.qiniup.com" , "upload-dg.qiniup.com" , "upload-fs.qiniup.com" ) . iovipHost ( "iovip-z2.qbox.me" ) . rsHost ( "rs-z2.qbox.me" ) . rsfHost ( "rsf-z2.qbox.me" ) . apiHost ( "api-z2.qiniu.com" ) . build ( ) ;
|
public class SolutionUtils { /** * Return the best solution between those passed as arguments . If they are equal or incomparable
* one of them is chosen randomly .
* @ param randomGenerator { @ link RandomGenerator } for the equality case
* @ return The best solution */
public static < S extends Solution < ? > > S getBestSolution ( S solution1 , S solution2 , Comparator < S > comparator , RandomGenerator < Double > randomGenerator ) { } }
|
return getBestSolution ( solution1 , solution2 , comparator , ( a , b ) -> randomGenerator . getRandomValue ( ) < 0.5 ? a : b ) ;
|
public class Observation { /** * Determines moments ( probabilistic measure ) of all degrees specified by { @ link # momentDegrees } .
* Moments are characteristics of random variables ( in this case relating to the inserted values )
* < ul >
* < li > 2nd moment : variance < / li >
* < li > 3rd moment : skewness ( Schiefe ) < / li >
* < li > 4th moment : kurtosis ( Woelbung ) < / li >
* < li > . . . < / li >
* < / ul > */
protected void setMoments ( ) { } }
|
moments . clear ( ) ; for ( Integer i : momentDegrees ) moments . put ( i , 0.0 ) ; for ( Double d : insertStat . keySet ( ) ) { for ( int j : momentDegrees ) moments . put ( j , moments . get ( j ) + Math . pow ( d - expectation , j ) * ( insertStat . get ( d ) / observationCount ) ) ; }
|
public class XmlUtil { /** * object - > xml
* @ param object
* @ param childClass */
public static String marshal ( Object object ) { } }
|
if ( object == null ) { return null ; } try { JAXBContext jaxbCtx = JAXBContext . newInstance ( object . getClass ( ) ) ; Marshaller marshaller = jaxbCtx . createMarshaller ( ) ; marshaller . setProperty ( Marshaller . JAXB_FRAGMENT , Boolean . TRUE ) ; StringWriter sw = new StringWriter ( ) ; marshaller . marshal ( object , sw ) ; return sw . toString ( ) ; } catch ( Exception e ) { } return null ;
|
public class MapPolygon { /** * Replies the distance between this figure and the specified point .
* @ param point is the x - coordinate of the point .
* @ param width is the width of the polygon .
* @ return the computed distance */
@ Pure public double distance ( Point2D < ? , ? > point , double width ) { } }
|
double mind = Double . MAX_VALUE ; double dist ; final Point2d pts1 = new Point2d ( ) ; final Point2d pts2 = new Point2d ( ) ; double w = width ; w = Math . abs ( w ) / 2. ; for ( final PointGroup grp : groups ( ) ) { for ( int idx = 0 ; idx < grp . size ( ) ; idx += 2 ) { if ( grp . getMany ( idx , pts1 , pts2 ) > 1 ) { dist = Segment2afp . calculatesDistanceSegmentPoint ( pts1 . getX ( ) , pts1 . getY ( ) , pts2 . getX ( ) , pts2 . getY ( ) , point . getX ( ) , point . getY ( ) ) - w ; if ( dist < mind ) { mind = dist ; } } else { dist = pts1 . getDistance ( point ) ; if ( dist < mind ) { mind = dist ; } } } } return mind ;
|
public class RtfDocumentSettings { /** * Converts protection level from internal bitmap value to protlevel output value .
* Author : Howard Shank ( hgshank @ yahoo . com )
* @ return < pre >
* 0 = Revision protection
* 1 = Annotation / Comment protection
* 2 = Form protection
* 3 = Read only protection
* < / pre >
* @ since 2.1.1 */
private int convertProtectionLevel ( ) { } }
|
int level = 0 ; switch ( this . protectionLevel ) { case RtfProtection . LEVEL_NONE : break ; case RtfProtection . LEVEL_REVPROT : level = 0 ; break ; case RtfProtection . LEVEL_ANNOTPROT : level = 1 ; break ; case RtfProtection . LEVEL_FORMPROT : level = 2 ; break ; case RtfProtection . LEVEL_READPROT : level = 3 ; break ; } return level ;
|
public class Crypto { /** * Encrypt data with TLS certificate and convert cipher to base64
* @ param data
* byte array to encrypt
* @ return cipher in base64
* @ throws NoSuchAlgorithmException
* NoSuchAlgorithmException
* @ throws NoSuchProviderException
* NoSuchProviderException
* @ throws NoSuchPaddingException
* NoSuchPaddingException
* @ throws InvalidKeyException
* InvalidKeyException
* @ throws IllegalBlockSizeException
* IllegalBlockSizeException
* @ throws BadPaddingException
* BadPaddingException
* @ throws InvalidAlgorithmParameterException
* InvalidAlgorithmParameterException
* @ throws IOException
* IOException
* @ throws InvalidCipherTextException
* InvalidCipherTextException */
public String encryptWithBase64 ( byte [ ] data ) throws NoSuchAlgorithmException , NoSuchProviderException , NoSuchPaddingException , InvalidKeyException , IllegalBlockSizeException , BadPaddingException , InvalidAlgorithmParameterException , InvalidCipherTextException , IOException { } }
|
byte [ ] cipher = encryptBytes ( data ) ; return Base64 . toBase64String ( cipher ) ;
|
public class DefaultComponentFactory { /** * ( non - Javadoc )
* @ see org . springframework . richclient . factory . ComponentFactory # createRadioButton ( java . lang . String ) */
public JRadioButton createRadioButton ( String labelKey ) { } }
|
return ( JRadioButton ) getButtonLabelInfo ( getRequiredMessage ( labelKey ) ) . configure ( createNewRadioButton ( ) ) ;
|
public class AbstractJpaEventStore { /** * Tries to find a serializer for the given type of object and converts it
* into a storable data block .
* @ param type
* Type of event .
* @ param data
* Event of the given type .
* @ return Event ready to persist . */
protected final SerializedData serialize ( final SerializedDataType type , final Object data ) { } }
|
return EscSpiUtils . serialize ( serRegistry , type , data ) ;
|
public class SystemConfig { /** * Inicializa la configuracion . */
private void init ( ) throws ConfigFileIOException { } }
|
this . props = new Properties ( ) ; log . info ( "Reading config file: {}" , this . configFile ) ; boolean ok = true ; try { // El fichero esta en el CLASSPATH
this . props . load ( SystemConfig . class . getResourceAsStream ( this . configFile ) ) ; } catch ( Exception e ) { log . warn ( "File not found in the Classpath" ) ; try { this . props . load ( new FileInputStream ( this . configFile ) ) ; } catch ( IOException ioe ) { log . error ( "Can't open file: {}" , ioe . getLocalizedMessage ( ) ) ; ok = false ; ioe . printStackTrace ( ) ; throw new ConfigFileIOException ( ioe . getLocalizedMessage ( ) ) ; } } if ( ok ) { log . info ( "Configuration loaded successfully" ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( this . toString ( ) ) ; } }
|
public class GetResourcesResult { /** * The folders in the specified folder .
* @ param folders
* The folders in the specified folder . */
public void setFolders ( java . util . Collection < FolderMetadata > folders ) { } }
|
if ( folders == null ) { this . folders = null ; return ; } this . folders = new java . util . ArrayList < FolderMetadata > ( folders ) ;
|
public class Base64Coder { /** * Converts a String to a byte array by using UTF - 8 character sets .
* This code is needed even converting US - ASCII characters since there are some character sets which are not compatible with US - ASCII code area .
* For example , CP - 1399 , which is z / OS Japanese EBCDIC character sets , is one .
* @ param input String , may be { @ code null } .
* @ return byte array representing the String or { @ code null } if the String was null or contained non ASCII character . */
public static final byte [ ] getBytes ( String input ) { } }
|
byte output [ ] = null ; try { if ( input != null ) { output = input . getBytes ( "UTF-8" ) ; } } catch ( UnsupportedEncodingException e ) { // This should not happen .
// If it happens , it would be some runtime or operating system issue , so just give up and return null .
// ffdc data will be logged automatically .
} return output ;
|
public class NumberFormatContext { /** * Convert the given value to a { @ link Float } . If the value is not in a
* valid numeric format , then a default value is returned .
* @ param value The value to convert
* @ return The converted numeric value
* @ see # isFloat ( String )
* @ see Float # valueOf ( String ) */
public Float convertStringToFloat ( String value ) { } }
|
Float result ; try { result = Float . valueOf ( value ) ; } catch ( NumberFormatException e ) { result = DEFAULT_FLOAT_VALUE ; } return result ;
|
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcExternallyDefinedSymbol ( ) { } }
|
if ( ifcExternallyDefinedSymbolEClass == null ) { ifcExternallyDefinedSymbolEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 217 ) ; } return ifcExternallyDefinedSymbolEClass ;
|
public class Webcam { /** * Reset webcam driver . < br >
* < br >
* < b > This method is not thread - safe ! < / b > */
public static void resetDriver ( ) { } }
|
synchronized ( DRIVERS_LIST ) { DRIVERS_LIST . clear ( ) ; } if ( discovery != null ) { discovery . shutdown ( ) ; discovery = null ; } driver = null ;
|
public class ExtractFunctionExecutor { /** * 删除指定的文本 使用方法 : removeText ( 作者 : ) 括号内的参数为文本字符 , 从CSS路径匹配的文本中删除参数文本
* @ param text CSS路径抽取出来的文本
* @ param parseExpression 抽取函数
* @ return 抽取函数处理之后的文本 */
public static String executeRemoveText ( String text , String parseExpression ) { } }
|
LOGGER . debug ( "removeText抽取函数之前:" + text ) ; String parameter = parseExpression . replace ( "removeText(" , "" ) ; parameter = parameter . substring ( 0 , parameter . length ( ) - 1 ) ; text = text . replace ( parameter , "" ) ; LOGGER . debug ( "removeText抽取函数之后:" + text ) ; return text ;
|
public class HttpFields { /** * Adds the value of a date field .
* @ param name the field name
* @ param date the field date value */
public void addDateField ( String name , long date ) { } }
|
if ( _dateBuffer == null ) { _dateBuffer = new StringBuffer ( 32 ) ; _calendar = new HttpCal ( ) ; } _dateBuffer . setLength ( 0 ) ; _calendar . setTimeInMillis ( date ) ; formatDate ( _dateBuffer , _calendar , false ) ; add ( name , _dateBuffer . toString ( ) ) ;
|
public class TECore { /** * Submits a request to some HTTP endpoint using the given request details .
* @ param xml
* An ctl : request element .
* @ return A URLConnection object representing an open communications link .
* @ throws Exception
* If any error occurs while submitting the request or
* establishing a conection . */
public URLConnection build_request ( Node xml ) throws Exception { } }
|
Node body = null ; ArrayList < String [ ] > headers = new ArrayList < String [ ] > ( ) ; ArrayList < Node > parts = new ArrayList < Node > ( ) ; String sUrl = null ; String sParams = "" ; String method = "GET" ; String charset = "UTF-8" ; boolean multipart = false ; // Read in the test information ( from CTL )
NodeList nl = xml . getChildNodes ( ) ; for ( int i = 0 ; i < nl . getLength ( ) ; i ++ ) { Node n = nl . item ( i ) ; if ( n . getNodeType ( ) == Node . ELEMENT_NODE ) { if ( n . getLocalName ( ) . equals ( "url" ) ) { sUrl = n . getTextContent ( ) ; } else if ( n . getLocalName ( ) . equals ( "method" ) ) { method = n . getTextContent ( ) . toUpperCase ( ) ; } else if ( n . getLocalName ( ) . equals ( "header" ) ) { headers . add ( new String [ ] { ( ( Element ) n ) . getAttribute ( "name" ) , n . getTextContent ( ) } ) ; } else if ( n . getLocalName ( ) . equals ( "param" ) ) { if ( sParams . length ( ) > 0 ) { sParams += "&" ; } sParams += ( ( Element ) n ) . getAttribute ( "name" ) + "=" + n . getTextContent ( ) ; // WARNING ! May break some existing test suites
// + URLEncoder . encode ( n . getTextContent ( ) , " UTF - 8 " ) ;
} else if ( n . getLocalName ( ) . equals ( "dynamicParam" ) ) { String name = null ; String val = null ; NodeList dpnl = n . getChildNodes ( ) ; for ( int j = 0 ; j < dpnl . getLength ( ) ; j ++ ) { Node dpn = dpnl . item ( j ) ; if ( dpn . getNodeType ( ) == Node . ELEMENT_NODE ) { if ( dpn . getLocalName ( ) . equals ( "name" ) ) { name = dpn . getTextContent ( ) ; } else if ( dpn . getLocalName ( ) . equals ( "value" ) ) { val = dpn . getTextContent ( ) ; // val =
// URLEncoder . encode ( dpn . getTextContent ( ) , " UTF - 8 " ) ;
} } } if ( name != null && val != null ) { if ( sParams . length ( ) > 0 ) sParams += "&" ; sParams += name + "=" + val ; } } else if ( n . getLocalName ( ) . equals ( "body" ) ) { body = n ; } else if ( n . getLocalName ( ) . equals ( "part" ) ) { parts . add ( n ) ; } } } // Complete GET KVP syntax
// Fortify Mod : Added check for null sUrl . Shouldn ' t happen but - - - -
// if ( method . equals ( " GET " ) & & sParams . length ( ) > 0 ) {
if ( method . equals ( "GET" ) && sParams . length ( ) > 0 && sUrl != null ) { if ( sUrl . indexOf ( "?" ) == - 1 ) { sUrl += "?" ; } else if ( ! sUrl . endsWith ( "?" ) && ! sUrl . endsWith ( "&" ) ) { sUrl += "&" ; } sUrl += sParams ; } // System . out . println ( sUrl ) ;
TransformerFactory tf = TransformerFactory . newInstance ( ) ; // Fortify Mod : prevent external entity injection
tf . setFeature ( XMLConstants . FEATURE_SECURE_PROCESSING , true ) ; Transformer t = tf . newTransformer ( ) ; // Open the URLConnection
URLConnection uc = new URL ( sUrl ) . openConnection ( ) ; if ( uc instanceof HttpURLConnection ) { ( ( HttpURLConnection ) uc ) . setRequestMethod ( method ) ; } // POST setup ( XML payload and header information )
if ( method . equals ( "POST" ) || method . equals ( "PUT" ) ) { uc . setDoOutput ( true ) ; byte [ ] bytes = null ; String mime = null ; // KVP over POST
if ( body == null ) { bytes = sParams . getBytes ( ) ; mime = "application/x-www-form-urlencoded" ; } // XML POST
else { String bodyContent = "" ; NodeList children = body . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { if ( children . item ( i ) . getNodeType ( ) == Node . ELEMENT_NODE ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; t . transform ( new DOMSource ( children . item ( i ) ) , new StreamResult ( baos ) ) ; bodyContent = baos . toString ( ) ; bytes = baos . toByteArray ( ) ; if ( mime == null ) { mime = "application/xml; charset=" + charset ; } break ; } } if ( bytes == null ) { bytes = body . getTextContent ( ) . getBytes ( ) ; mime = "text/plain" ; } // Add parts if present
if ( parts . size ( ) > 0 ) { String prefix = "--" ; String boundary = "7bdc3bba-e2c9-11db-8314-0800200c9a66" ; String newline = "\r\n" ; multipart = true ; // Set main body and related headers
ByteArrayOutputStream contentBytes = new ByteArrayOutputStream ( ) ; String bodyPart = prefix + boundary + newline ; bodyPart += "Content-Type: " + mime + newline + newline ; bodyPart += bodyContent ; writeBytes ( contentBytes , bodyPart . getBytes ( charset ) ) ; // Append all parts to the original body , seperated by the
// boundary sequence
for ( int i = 0 ; i < parts . size ( ) ; i ++ ) { Element currentPart = ( Element ) parts . get ( i ) ; String cid = currentPart . getAttribute ( "cid" ) ; if ( cid . indexOf ( "cid:" ) != - 1 ) { cid = cid . substring ( cid . indexOf ( "cid:" ) + "cid:" . length ( ) ) ; } String contentType = currentPart . getAttribute ( "content-type" ) ; // Default encodings and content - type
if ( contentType . equals ( "application/xml" ) ) { contentType = "application/xml; charset=" + charset ; } if ( contentType == null || contentType . equals ( "" ) ) { contentType = "application/octet-stream" ; } // Set headers for each part
String partHeaders = newline + prefix + boundary + newline ; partHeaders += "Content-Type: " + contentType + newline ; partHeaders += "Content-ID: <" + cid + ">" + newline + newline ; writeBytes ( contentBytes , partHeaders . getBytes ( charset ) ) ; // Get the fileName , if it exists
NodeList files = currentPart . getElementsByTagNameNS ( CTL_NS , "file" ) ; // Get part for a specified file
if ( files . getLength ( ) > 0 ) { File contentFile = getFile ( files ) ; InputStream is = new FileInputStream ( contentFile ) ; long length = contentFile . length ( ) ; byte [ ] fileBytes = new byte [ ( int ) length ] ; int offset = 0 ; int numRead = 0 ; while ( offset < fileBytes . length && ( numRead = is . read ( fileBytes , offset , fileBytes . length - offset ) ) >= 0 ) { offset += numRead ; } is . close ( ) ; writeBytes ( contentBytes , fileBytes ) ; } // Get part from inline data ( or xi : include )
else { // Text
if ( currentPart . getFirstChild ( ) instanceof Text ) { writeBytes ( contentBytes , currentPart . getTextContent ( ) . getBytes ( charset ) ) ; } // XML
else { writeBytes ( contentBytes , DomUtils . serializeNode ( currentPart . getFirstChild ( ) ) . getBytes ( charset ) ) ; } } } String endingBoundary = newline + prefix + boundary + prefix + newline ; writeBytes ( contentBytes , endingBoundary . getBytes ( charset ) ) ; bytes = contentBytes . toByteArray ( ) ; // Global Content - Type and Length to be added after the
// parts have been parsed
mime = "multipart/related; type=\"" + mime + "\"; boundary=\"" + boundary + "\"" ; // String contentsString = new String ( bytes , charset ) ;
// System . out . println ( " Content - Type : " + mime + " \ n " + contentsString ) ;
} } // Set headers
if ( body != null ) { String mid = ( ( Element ) body ) . getAttribute ( "mid" ) ; if ( mid != null && ! mid . equals ( "" ) ) { if ( mid . indexOf ( "mid:" ) != - 1 ) { mid = mid . substring ( mid . indexOf ( "mid:" ) + "mid:" . length ( ) ) ; } uc . setRequestProperty ( "Message-ID" , "<" + mid + ">" ) ; } } uc . setRequestProperty ( "Content-Type" , mime ) ; uc . setRequestProperty ( "Content-Length" , Integer . toString ( bytes . length ) ) ; // Enter the custom headers ( overwrites the defaults if present )
for ( int i = 0 ; i < headers . size ( ) ; i ++ ) { String [ ] header = headers . get ( i ) ; if ( multipart && header [ 0 ] . toLowerCase ( ) . equals ( "content-type" ) ) { } else { uc . setRequestProperty ( header [ 0 ] , header [ 1 ] ) ; } } OutputStream os = uc . getOutputStream ( ) ; os . write ( bytes ) ; } return uc ;
|
public class PersonDirectoryPrincipalResolver { /** * Retrieve person attributes map .
* @ param principalId the principal id
* @ param credential the credential whose id we have extracted . This is passed so that implementations
* can extract useful bits of authN info such as attributes into the principal .
* @ return the map */
@ Synchronized protected Map < String , List < Object > > retrievePersonAttributes ( final String principalId , final Credential credential ) { } }
|
return CoreAuthenticationUtils . retrieveAttributesFromAttributeRepository ( this . attributeRepository , principalId , activeAttributeRepositoryIdentifiers ) ;
|
public class Collectors { /** * Use occurrences to save the count of largest objects if { @ code areAllSmallestSame = true } ( e . g . { @ code Number / String / . . . } ) and return a list by repeat the smallest object { @ code n } times .
* @ param areAllSmallestSame
* @ return
* @ see Collectors # maxAll ( Comparator , int , boolean ) */
@ SuppressWarnings ( "rawtypes" ) public static < T extends Comparable > Collector < T , ? , List < T > > minAll ( final boolean areAllSmallestSame ) { } }
|
return minAll ( Integer . MAX_VALUE , areAllSmallestSame ) ;
|
public class BPSImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } }
|
switch ( featureID ) { case AfplibPackage . BPS__PSEG_NAME : setPsegName ( PSEG_NAME_EDEFAULT ) ; return ; case AfplibPackage . BPS__TRIPLETS : getTriplets ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ;
|
public class LogsSummaryMarshaller { /** * Marshall the given parameter object . */
public void marshall ( LogsSummary logsSummary , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( logsSummary == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( logsSummary . getAudit ( ) , AUDIT_BINDING ) ; protocolMarshaller . marshall ( logsSummary . getAuditLogGroup ( ) , AUDITLOGGROUP_BINDING ) ; protocolMarshaller . marshall ( logsSummary . getGeneral ( ) , GENERAL_BINDING ) ; protocolMarshaller . marshall ( logsSummary . getGeneralLogGroup ( ) , GENERALLOGGROUP_BINDING ) ; protocolMarshaller . marshall ( logsSummary . getPending ( ) , PENDING_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class KeyPairFactory { /** * Factory method for creating a new { @ link KeyPairGenerator } from the given parameters .
* @ param algorithm
* the algorithm
* @ param keySize
* the key size
* @ return the new { @ link KeyPairGenerator } from the given parameters
* @ throws NoSuchAlgorithmException
* is thrown if no Provider supports a KeyPairGeneratorSpi implementation for the
* specified algorithm
* @ throws NoSuchProviderException
* is thrown if the specified provider is not registered in the security provider
* list */
public static KeyPairGenerator newKeyPairGenerator ( final String algorithm , final int keySize ) throws NoSuchAlgorithmException , NoSuchProviderException { } }
|
KeyPairGenerator generator ; if ( "EC" . equals ( algorithm ) ) { generator = KeyPairGenerator . getInstance ( algorithm , "BC" ) ; } else { generator = KeyPairGenerator . getInstance ( algorithm ) ; generator . initialize ( keySize ) ; } return generator ;
|
public class ChronoEntity { /** * < p > Liefert den Selbstbezug . < / p >
* @ return time context ( usually this instance ) */
protected T getContext ( ) { } }
|
Chronology < T > c = this . getChronology ( ) ; Class < T > type = c . getChronoType ( ) ; if ( type . isInstance ( this ) ) { return type . cast ( this ) ; } else { for ( ChronoElement < ? > element : c . getRegisteredElements ( ) ) { if ( type == element . getType ( ) ) { return type . cast ( this . get ( element ) ) ; } } } throw new IllegalStateException ( "Implementation error: Cannot find entity context." ) ;
|
public class PublicIpv4Pool { /** * The address ranges .
* @ return The address ranges . */
public java . util . List < PublicIpv4PoolRange > getPoolAddressRanges ( ) { } }
|
if ( poolAddressRanges == null ) { poolAddressRanges = new com . amazonaws . internal . SdkInternalList < PublicIpv4PoolRange > ( ) ; } return poolAddressRanges ;
|
public class SimpleHadoopFilesystemConfigStore { /** * Retrieves the dataset dir on HDFS associated with the given { @ link ConfigKeyPath } and the given version . This
* directory contains the { @ link # MAIN _ CONF _ FILE _ NAME } and { @ link # INCLUDES _ CONF _ FILE _ NAME } file , as well as any child
* datasets . */
private Path getDatasetDirForKey ( ConfigKeyPath configKey , String version ) throws VersionDoesNotExistException { } }
|
String datasetFromConfigKey = getDatasetFromConfigKey ( configKey ) ; if ( StringUtils . isBlank ( datasetFromConfigKey ) ) { return getVersionRoot ( version ) ; } return new Path ( getVersionRoot ( version ) , datasetFromConfigKey ) ;
|
public class SequenceConverter { /** * method to read a rna / dna sequence and generate a HELM2Notation object of
* it
* @ param notation rna / dna sequence
* @ return HELM2Notation object
* @ throws FastaFormatException
* if the rna / dna sequence is not in the right format
* @ throws NotationException
* if the notation object can not be built
* @ throws ChemistryException if chemistry engine can not be initialized
* @ throws NucleotideLoadingException if nucleotides can not be loaded */
public static HELM2Notation readRNA ( String notation ) throws FastaFormatException , NotationException , ChemistryException , NucleotideLoadingException { } }
|
HELM2Notation helm2notation = new HELM2Notation ( ) ; PolymerNotation polymer = new PolymerNotation ( "RNA1" ) ; if ( ! ( FastaFormat . isNormalDirection ( notation ) ) ) { String annotation = "3'-5'" ; helm2notation . addPolymer ( new PolymerNotation ( polymer . getPolymerID ( ) , FastaFormat . generateElementsforRNA ( notation , polymer . getPolymerID ( ) ) , annotation ) ) ; } else { helm2notation . addPolymer ( new PolymerNotation ( polymer . getPolymerID ( ) , FastaFormat . generateElementsforRNA ( notation , polymer . getPolymerID ( ) ) ) ) ; } return helm2notation ;
|
public class KTypeArrayDeque { /** * Ensures the internal buffer has enough free slots to store
* < code > expectedAdditions < / code > . Increases internal buffer size if needed . */
protected void ensureBufferSpace ( int expectedAdditions ) { } }
|
final int bufferLen = buffer . length ; final int elementsCount = size ( ) ; if ( elementsCount + expectedAdditions >= bufferLen ) { final int emptySlot = 1 ; // deque invariant : always an empty slot .
final int newSize = resizer . grow ( bufferLen , elementsCount + emptySlot , expectedAdditions ) ; assert newSize >= ( elementsCount + expectedAdditions + emptySlot ) : "Resizer failed to" + " return sensible new size: " + newSize + " <= " + ( elementsCount + expectedAdditions ) ; try { final KType [ ] newBuffer = Intrinsics . < KType > newArray ( newSize ) ; if ( bufferLen > 0 ) { toArray ( newBuffer ) ; tail = elementsCount ; head = 0 ; } this . buffer = newBuffer ; } catch ( OutOfMemoryError e ) { throw new BufferAllocationException ( "Not enough memory to allocate new buffers: %,d -> %,d" , e , bufferLen , newSize ) ; } }
|
public class CLI { /** * Create a simulation object .
* @ param script the script
* @ param groovy
* @ param ll
* @ return the simulation object . */
public static Object createSim ( String script , boolean groovy , String ll ) throws Exception { } }
|
setOMSProperties ( ) ; Level . parse ( ll ) ; // may throw IAE
String prefix = groovy ? "" : "import static oms3.SimConst.*\n" + "def __sb__ = new oms3.SimBuilder(logging:'" + ll + "')\n" + "__sb__." ; ClassLoader parent = Thread . currentThread ( ) . getContextClassLoader ( ) ; Binding b = new Binding ( ) ; b . setVariable ( "oms_version" , System . getProperty ( "oms.version" ) ) ; b . setVariable ( "oms_home" , System . getProperty ( "oms.home" ) ) ; b . setVariable ( "oms_prj" , System . getProperty ( "oms.prj" ) ) ; GroovyShell shell = new GroovyShell ( new GroovyClassLoader ( parent ) , b ) ; return shell . evaluate ( prefix + script ) ;
|
public class JDBCDatabaseMetaData { /** * # ifdef JAVA4 */
public ResultSet getSuperTypes ( String catalog , String schemaPattern , String typeNamePattern ) throws SQLException { } }
|
if ( wantsIsNull ( typeNamePattern ) ) { return executeSelect ( "SYSTEM_SUPERTYPES" , "0=1" ) ; } schemaPattern = translateSchema ( schemaPattern ) ; StringBuffer select = toQueryPrefixNoSelect ( "SELECT * FROM (SELECT USER_DEFINED_TYPE_CATALOG, USER_DEFINED_TYPE_SCHEMA, USER_DEFINED_TYPE_NAME," + "CAST (NULL AS INFORMATION_SCHEMA.SQL_IDENTIFIER), CAST (NULL AS INFORMATION_SCHEMA.SQL_IDENTIFIER), DATA_TYPE " + "FROM INFORMATION_SCHEMA.USER_DEFINED_TYPES " + "UNION SELECT DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME,NULL,NULL, DATA_TYPE " + "FROM INFORMATION_SCHEMA.DOMAINS) " + "AS SUPERTYPES(TYPE_CAT, TYPE_SCHEM, TYPE_NAME, SUPERTYPE_CAT, SUPERTYPE_SCHEM, SUPERTYPE_NAME) " ) . append ( and ( "TYPE_CAT" , "=" , catalog ) ) . append ( and ( "TYPE_SCHEM" , "LIKE" , schemaPattern ) ) . append ( and ( "TYPE_NAME" , "LIKE" , typeNamePattern ) ) ; return execute ( select . toString ( ) ) ;
|
public class LogbackAdapter { /** * { @ inheritDoc } */
@ Override public void error ( final MessageItem messageItem ) { } }
|
getLogger ( ) . log ( messageItem . getMarker ( ) , FQCN , LocationAwareLogger . ERROR_INT , messageItem . getText ( ) , null , null ) ; throwError ( messageItem , null ) ;
|
public class JSON { /** * parse json
* @ param reader json source .
* @ param type target type .
* @ return result .
* @ throws IOException
* @ throws ParseException */
@ SuppressWarnings ( "unchecked" ) public static < T > T parse ( Reader reader , Class < T > type , Converter < Object , Map < String , Object > > mc ) throws IOException , ParseException { } }
|
return ( T ) parse ( reader , new JSONVisitor ( type , new JSONValue ( mc ) , mc ) , JSONToken . ANY ) ;
|
public class ObjectsApi { /** * Get Skills .
* Get Skills from Configuration Server with the specified filters .
* @ param searchParams object containing remaining search parameters ( limit , offset , searchTerm , searchKey , matchMethod , sortKey , sortAscending , sortMethod ) .
* @ param inUse Specifies whether to return only skills actually assigned to agents . ( optional , default to false )
* @ return Results object which includes list of Skills and total count .
* @ throws ProvisioningApiException if the call is unsuccessful . */
public Results < Skill > searchSkills ( SearchParams searchParams , Boolean inUse ) throws ProvisioningApiException { } }
|
return searchSkills ( searchParams . getLimit ( ) , searchParams . getOffset ( ) , searchParams . getSearchTerm ( ) , searchParams . getSearchKey ( ) , searchParams . getMatchMethod ( ) , searchParams . getSortKey ( ) , searchParams . getSortAscending ( ) , searchParams . getSortMethod ( ) , inUse ) ;
|
public class AccountsInner { /** * Creates the specified Data Lake Store account .
* @ param resourceGroupName The name of the Azure resource group .
* @ param accountName The name of the Data Lake Store account .
* @ param parameters Parameters supplied to create the Data Lake Store account .
* @ 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 DataLakeStoreAccountInner object if successful . */
public DataLakeStoreAccountInner create ( String resourceGroupName , String accountName , CreateDataLakeStoreAccountParameters parameters ) { } }
|
return createWithServiceResponseAsync ( resourceGroupName , accountName , parameters ) . toBlocking ( ) . last ( ) . body ( ) ;
|
public class DataLabelingServiceClient { /** * Lists annotation spec sets for a project . Pagination is supported .
* < p > Sample code :
* < pre > < code >
* try ( DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient . create ( ) ) {
* String formattedParent = DataLabelingServiceClient . formatProjectName ( " [ PROJECT ] " ) ;
* String filter = " " ;
* for ( AnnotationSpecSet element : dataLabelingServiceClient . listAnnotationSpecSets ( formattedParent , filter ) . iterateAll ( ) ) {
* / / doThingsWith ( element ) ;
* < / code > < / pre >
* @ param parent Required . Parent of AnnotationSpecSet resource , format : projects / { project _ id }
* @ param filter Optional . Filter is not supported at this moment .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final ListAnnotationSpecSetsPagedResponse listAnnotationSpecSets ( String parent , String filter ) { } }
|
PROJECT_PATH_TEMPLATE . validate ( parent , "listAnnotationSpecSets" ) ; ListAnnotationSpecSetsRequest request = ListAnnotationSpecSetsRequest . newBuilder ( ) . setParent ( parent ) . setFilter ( filter ) . build ( ) ; return listAnnotationSpecSets ( request ) ;
|
public class LZ4Factory { /** * Returns a { @ link LZ4Compressor } which requires more memory than
* { @ link # fastCompressor ( ) } and is slower but compresses more efficiently .
* The compression level can be customized .
* < p > For current implementations , the following is true about compression level : < ol >
* < li > It should be in range [ 1 , 17 ] < / li >
* < li > A compression level higher than 17 would be treated as 17 . < / li >
* < li > A compression level lower than 1 would be treated as 9 . < / li >
* < / ol >
* @ param compressionLevel the compression level between [ 1 , 17 ] ; the higher the level , the higher the compression ratio
* @ return a { @ link LZ4Compressor } which requires more memory than
* { @ link # fastCompressor ( ) } and is slower but compresses more efficiently . */
public LZ4Compressor highCompressor ( int compressionLevel ) { } }
|
if ( compressionLevel > MAX_COMPRESSION_LEVEL ) { compressionLevel = MAX_COMPRESSION_LEVEL ; } else if ( compressionLevel < 1 ) { compressionLevel = DEFAULT_COMPRESSION_LEVEL ; } return highCompressors [ compressionLevel ] ;
|
public class Memoize { /** * Creates a new closure delegating to the supplied one and memoizing all return values by the arguments .
* The memoizing closure will use SoftReferences to remember the return values allowing the garbage collector
* to reclaim the memory , if needed .
* The supplied cache is used to store the memoized values and it is the cache ' s responsibility to put limits
* on the cache size or implement cache eviction strategy .
* The LRUCache , for example , allows to set the maximum cache size constraint and implements
* the LRU ( Last Recently Used ) eviction strategy .
* If the protectedCacheSize argument is greater than 0 an optional LRU ( Last Recently Used ) cache of hard references
* is maintained to protect recently touched memoized values against eviction by the garbage collector .
* @ param protectedCacheSize The number of hard references to keep in order to prevent some ( LRU ) memoized return values from eviction
* @ param cache A map to hold memoized return values
* @ param closure The closure to memoize
* @ param < V > The closure ' s return type
* @ return A new memoized closure */
public static < V > Closure < V > buildSoftReferenceMemoizeFunction ( final int protectedCacheSize , final MemoizeCache < Object , SoftReference < Object > > cache , final Closure < V > closure ) { } }
|
final ProtectionStorage lruProtectionStorage = protectedCacheSize > 0 ? new LRUProtectionStorage ( protectedCacheSize ) : new NullProtectionStorage ( ) ; // Nothing should be done when no elements need protection against eviction
final ReferenceQueue queue = new ReferenceQueue ( ) ; return new SoftReferenceMemoizeFunction < V > ( cache , closure , lruProtectionStorage , queue ) ;
|
public class ResendContactReachabilityEmailRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ResendContactReachabilityEmailRequest resendContactReachabilityEmailRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( resendContactReachabilityEmailRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( resendContactReachabilityEmailRequest . getDomainName ( ) , DOMAINNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class Hyperalgo { /** * Runs the inside algorithm on a hypergraph .
* @ param graph The hypergraph .
* @ return The beta value for each Hypernode . Where beta [ i ] is the inside
* score for the i ' th node in the Hypergraph , graph . getNodes ( ) . get ( i ) . */
public static double [ ] insideAlgorithm ( final Hypergraph graph , final Hyperpotential w , final Semiring s ) { } }
|
final int n = graph . getNodes ( ) . size ( ) ; final double [ ] beta = new double [ n ] ; // \ beta _ i = 0 \ forall i
Arrays . fill ( beta , s . zero ( ) ) ; graph . applyTopoSort ( new HyperedgeFn ( ) { @ Override public void apply ( Hyperedge e ) { // \ beta _ { H ( e ) } + = w _ e \ prod _ { j \ in T ( e ) } \ beta _ j
double prod = s . one ( ) ; for ( Hypernode jNode : e . getTailNodes ( ) ) { prod = s . times ( prod , beta [ jNode . getId ( ) ] ) ; } int i = e . getHeadNode ( ) . getId ( ) ; prod = s . times ( w . getScore ( e , s ) , prod ) ; beta [ i ] = s . plus ( beta [ i ] , prod ) ; // if ( log . isTraceEnabled ( ) ) { log . trace ( String . format ( " inside : % s w _ e = % f prod = % f beta [ % d ] = % f " , e . getLabel ( ) , ( ( Algebra ) s ) . toReal ( w . getScore ( e , s ) ) , prod , i , ( ( Algebra ) s ) . toReal ( beta [ i ] ) ) ) ; }
} } ) ; return beta ;
|
public class NumberingSystem { /** * Factory method for creating a numbering system .
* @ param name _ in The string representing the name of the numbering system .
* @ param radix _ in The radix for this numbering system . ICU currently
* supports only numbering systems whose radix is 10.
* @ param isAlgorithmic _ in Specifies whether the numbering system is algorithmic
* ( true ) or numeric ( false ) .
* @ param desc _ in String used to describe the characteristics of the numbering
* system . For numeric systems , this string contains the digits used by the
* numbering system , in order , starting from zero . For algorithmic numbering
* systems , the string contains the name of the RBNF ruleset in the locale ' s
* NumberingSystemRules section that will be used to format numbers using
* this numbering system . */
private static NumberingSystem getInstance ( String name_in , int radix_in , boolean isAlgorithmic_in , String desc_in ) { } }
|
if ( radix_in < 2 ) { throw new IllegalArgumentException ( "Invalid radix for numbering system" ) ; } if ( ! isAlgorithmic_in ) { if ( desc_in . length ( ) != radix_in || ! isValidDigitString ( desc_in ) ) { throw new IllegalArgumentException ( "Invalid digit string for numbering system" ) ; } } NumberingSystem ns = new NumberingSystem ( ) ; ns . radix = radix_in ; ns . algorithmic = isAlgorithmic_in ; ns . desc = desc_in ; ns . name = name_in ; return ns ;
|
public class DefaultPolicyGenerator { /** * Connects to a DuraCloud instance as root */
private ContentStoreManager connectToDuraCloud ( String account , String rootPass ) throws ContentStoreException { } }
|
String host = account + DURACLOUD_URL_SUFFIX ; ContentStoreManager storeManager = new ContentStoreManagerImpl ( host , DURACLOUD_PORT ) ; Credential credential = new Credential ( DURACLOUD_ROOT_USER , rootPass ) ; storeManager . login ( credential ) ; return storeManager ;
|
public class EventCMLHandler { /** * Procedure required by the CDOInterface . This function is only
* supposed to be called by the JCFL library */
public void setObjectProperty ( String objectType , String propertyType , String propertyValue ) { } }
|
logger . debug ( "objectType: " + objectType ) ; logger . debug ( "propType: " + propertyType ) ; logger . debug ( "property: " + propertyValue ) ; if ( objectType == null ) { logger . error ( "Cannot add property for null object" ) ; return ; } if ( propertyType == null ) { logger . error ( "Cannot add property for null property type" ) ; return ; } if ( propertyValue == null ) { logger . warn ( "Will not add null property" ) ; return ; } if ( objectType . equals ( "Molecule" ) ) { if ( propertyType . equals ( "id" ) ) { currentMolecule . setID ( propertyValue ) ; } else if ( propertyType . equals ( "inchi" ) ) { currentMolecule . setProperty ( "iupac.nist.chemical.identifier" , propertyValue ) ; } } else if ( objectType . equals ( "PseudoAtom" ) ) { if ( propertyType . equals ( "label" ) ) { if ( ! ( currentAtom instanceof IPseudoAtom ) ) { currentAtom = builder . newInstance ( IPseudoAtom . class , currentAtom ) ; } ( ( IPseudoAtom ) currentAtom ) . setLabel ( propertyValue ) ; } } else if ( objectType . equals ( "Atom" ) ) { if ( propertyType . equals ( "type" ) ) { if ( propertyValue . equals ( "R" ) && ! ( currentAtom instanceof IPseudoAtom ) ) { currentAtom = builder . newInstance ( IPseudoAtom . class , currentAtom ) ; } currentAtom . setSymbol ( propertyValue ) ; } else if ( propertyType . equals ( "x2" ) ) { Point2d coord = currentAtom . getPoint2d ( ) ; if ( coord == null ) coord = new Point2d ( ) ; coord . x = Double . parseDouble ( propertyValue ) ; currentAtom . setPoint2d ( coord ) ; } else if ( propertyType . equals ( "y2" ) ) { Point2d coord = currentAtom . getPoint2d ( ) ; if ( coord == null ) coord = new Point2d ( ) ; coord . y = Double . parseDouble ( propertyValue ) ; currentAtom . setPoint2d ( coord ) ; } else if ( propertyType . equals ( "x3" ) ) { Point3d coord = currentAtom . getPoint3d ( ) ; if ( coord == null ) coord = new Point3d ( ) ; coord . x = Double . parseDouble ( propertyValue ) ; currentAtom . setPoint3d ( coord ) ; } else if ( propertyType . equals ( "y3" ) ) { Point3d coord = currentAtom . getPoint3d ( ) ; if ( coord == null ) coord = new Point3d ( ) ; coord . y = Double . parseDouble ( propertyValue ) ; currentAtom . setPoint3d ( coord ) ; } else if ( propertyType . equals ( "z3" ) ) { Point3d coord = currentAtom . getPoint3d ( ) ; if ( coord == null ) coord = new Point3d ( ) ; coord . z = Double . parseDouble ( propertyValue ) ; currentAtom . setPoint3d ( coord ) ; } else if ( propertyType . equals ( "xFract" ) ) { Point3d coord = currentAtom . getFractionalPoint3d ( ) ; if ( coord == null ) coord = new Point3d ( ) ; coord . x = Double . parseDouble ( propertyValue ) ; currentAtom . setFractionalPoint3d ( coord ) ; } else if ( propertyType . equals ( "yFract" ) ) { Point3d coord = currentAtom . getFractionalPoint3d ( ) ; if ( coord == null ) coord = new Point3d ( ) ; coord . y = Double . parseDouble ( propertyValue ) ; currentAtom . setFractionalPoint3d ( coord ) ; } else if ( propertyType . equals ( "zFract" ) ) { Point3d coord = currentAtom . getFractionalPoint3d ( ) ; if ( coord == null ) coord = new Point3d ( ) ; coord . z = Double . parseDouble ( propertyValue ) ; currentAtom . setFractionalPoint3d ( coord ) ; } else if ( propertyType . equals ( "formalCharge" ) ) { currentAtom . setFormalCharge ( Integer . parseInt ( propertyValue ) ) ; } else if ( propertyType . equals ( "charge" ) || propertyType . equals ( "partialCharge" ) ) { currentAtom . setCharge ( Double . parseDouble ( propertyValue ) ) ; } else if ( propertyType . equals ( "hydrogenCount" ) ) { currentAtom . setImplicitHydrogenCount ( Integer . parseInt ( propertyValue ) ) ; } else if ( propertyType . equals ( "dictRef" ) ) { currentAtom . setProperty ( "org.openscience.cdk.dict" , propertyValue ) ; } else if ( propertyType . equals ( "atomicNumber" ) ) { currentAtom . setAtomicNumber ( Integer . parseInt ( propertyValue ) ) ; } else if ( propertyType . equals ( "massNumber" ) ) { currentAtom . setMassNumber ( ( int ) Double . parseDouble ( propertyValue ) ) ; } else if ( propertyType . equals ( "id" ) ) { logger . debug ( "id: " , propertyValue ) ; currentAtom . setID ( propertyValue ) ; atomEnumeration . put ( propertyValue , numberOfAtoms ) ; } } else if ( objectType . equals ( "Bond" ) ) { if ( propertyType . equals ( "atom1" ) ) { bond_a1 = Integer . parseInt ( propertyValue ) ; } else if ( propertyType . equals ( "atom2" ) ) { bond_a2 = Integer . parseInt ( propertyValue ) ; } else if ( propertyType . equals ( "id" ) ) { logger . debug ( "id: " + propertyValue ) ; bond_id = propertyValue ; } else if ( propertyType . equals ( "order" ) ) { try { Double order = Double . parseDouble ( propertyValue ) ; if ( order == 1.0 ) { bond_order = IBond . Order . SINGLE ; } else if ( order == 2.0 ) { bond_order = IBond . Order . DOUBLE ; } else if ( order == 3.0 ) { bond_order = IBond . Order . TRIPLE ; } else if ( order == 4.0 ) { bond_order = IBond . Order . QUADRUPLE ; } else { bond_order = IBond . Order . SINGLE ; } } catch ( Exception e ) { logger . error ( "Cannot convert to double: " + propertyValue ) ; bond_order = IBond . Order . SINGLE ; } } else if ( propertyType . equals ( "stereo" ) ) { if ( propertyValue . equals ( "H" ) ) { bond_stereo = IBond . Stereo . DOWN ; } else if ( propertyValue . equals ( "W" ) ) { bond_stereo = IBond . Stereo . UP ; } } } logger . debug ( "Object property set..." ) ;
|
public class Patterns { /** * Adapts a regular expression pattern to a { @ link Pattern } .
* < p > < em > WARNING < / em > : in addition to regular expression cost , the returned { @ code Pattern } object needs
* to make a substring copy every time it ' s evaluated . This can incur excessive copying and memory overhead
* when parsing large strings . Consider implementing { @ code Pattern } manually for large input . */
public static Pattern regex ( final java . util . regex . Pattern p ) { } }
|
return new Pattern ( ) { @ Override public int match ( CharSequence src , int begin , int end ) { if ( begin > end ) return MISMATCH ; Matcher matcher = p . matcher ( src . subSequence ( begin , end ) ) ; if ( matcher . lookingAt ( ) ) return matcher . end ( ) ; return MISMATCH ; } } ;
|
public class SolrResultPage { /** * ( non - Javadoc )
* @ see org . springframework . data . solr . core . query . result . SpellcheckQueryResult # getAlternatives ( ) */
@ Override public Collection < Alternative > getAlternatives ( ) { } }
|
List < Alternative > allSuggestions = new ArrayList < > ( ) ; for ( List < Alternative > suggestions : this . suggestions . values ( ) ) { allSuggestions . addAll ( suggestions ) ; } return allSuggestions ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.