signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Monetary { /** * The used { @ link javax . money . spi . MonetaryAmountsSingletonSpi } instance . */
private static MonetaryAmountsSingletonQuerySpi monetaryAmountsSingletonQuerySpi ( ) { } } | try { return Bootstrap . getService ( MonetaryAmountsSingletonQuerySpi . class ) ; } catch ( Exception e ) { Logger . getLogger ( Monetary . class . getName ( ) ) . log ( Level . SEVERE , "Failed to load " + "MonetaryAmountsSingletonQuerySpi, " + "query functionality will not be " + "available." , e ) ; return null ; } |
public class TrashPolicy { /** * Get an instance of the configured TrashPolicy based on the value
* of the configuration paramater fs . trash . classname .
* @ param conf the configuration to be used
* @ param fs the file system to be used
* @ param home the home directory
* @ return an instance of TrashPolicy */
public static TrashPolicy getInstance ( Configuration conf , FileSystem fs , Path home ) throws IOException { } } | Class < ? extends TrashPolicy > trashClass = conf . getClass ( "fs.trash.classname" , TrashPolicyDefault . class , TrashPolicy . class ) ; TrashPolicy trash = ( TrashPolicy ) ReflectionUtils . newInstance ( trashClass , conf ) ; trash . initialize ( conf , fs , home ) ; // initialize TrashPolicy
return trash ; |
public class ElementsExceptionsFactory { /** * Constructs and initializes a new { @ link AuthenticationException } with the given { @ link Throwable cause }
* and { @ link String message } formatted with the given { @ link Object [ ] arguments } .
* @ param cause { @ link Throwable } identified as the reason this { @ link AuthenticationException } was thrown .
* @ param message { @ link String } describing the { @ link AuthenticationException exception } .
* @ param args { @ link Object [ ] arguments } used to replace format placeholders in the { @ link String message } .
* @ return a new { @ link AuthenticationException } with the given { @ link Throwable cause } and { @ link String message } .
* @ see org . cp . elements . security . AuthenticationException */
public static AuthenticationException newAuthenticationException ( Throwable cause , String message , Object ... args ) { } } | return new AuthenticationException ( format ( message , args ) , cause ) ; |
public class CmsXmlContentEditor { /** * Performs the save content action . < p >
* This is also used when changing the element language . < p >
* @ param locale the locale to save the content
* @ throws JspException if including the error page fails */
public void actionSave ( Locale locale ) throws JspException { } } | try { setEditorValues ( locale ) ; // check if content has errors
if ( ! hasValidationErrors ( ) ) { // no errors found , write content and copy temp file contents
writeContent ( ) ; commitTempFile ( ) ; // set the modified parameter
setParamModified ( Boolean . TRUE . toString ( ) ) ; // update the offline search indices
OpenCms . getSearchManager ( ) . updateOfflineIndexes ( ) ; } } catch ( CmsException e ) { showErrorPage ( e ) ; } |
public class TextFormat { /** * Generates a human readable form of this message , useful for debugging and
* other purposes , with no newline characters . */
public static String shortDebugString ( final MessageOrBuilder message ) { } } | try { final StringBuilder sb = new StringBuilder ( ) ; SINGLE_LINE_PRINTER . print ( message , new TextGenerator ( sb ) ) ; // Single line mode currently might have an extra space at the end .
return sb . toString ( ) . trim ( ) ; } catch ( IOException e ) { throw new IllegalStateException ( e ) ; } |
public class ServiceRegistryLoader { /** * / * ( non - Javadoc )
* @ see org . jboss . arquillian . core . spi . ServiceLoader # onlyOne ( java . lang . Class ) */
@ Override public < T > T onlyOne ( Class < T > serviceClass ) { } } | Collection < T > all = all ( serviceClass ) ; if ( all . size ( ) == 1 ) { return all . iterator ( ) . next ( ) ; } if ( all . size ( ) > 1 ) { throw new IllegalStateException ( "Multiple service implementations found for " + serviceClass + ": " + toClassString ( all ) ) ; } return null ; |
public class StackManager { /** * Retrieves an Enumeration with all of the currently loaded Diameter stacks
* to which the current caller has access .
* < P > < B > Note : < / B > The classname of a stack can be found using
* < CODE > d . getClass ( ) . getName ( ) < / CODE >
* @ return the list of Diameter stacks loaded by the caller ' s class loader */
public static synchronized Enumeration < Stack > getStacks ( ) { } } | List < Stack > result = new CopyOnWriteArrayList < Stack > ( ) ; if ( ! initialized ) { initialize ( ) ; } // Gets the classloader of the code that called this method , may be null .
ClassLoader callerCL = ClassLoader . getSystemClassLoader ( ) ; // Walk through the loaded stacks .
for ( StackInfo di : stacks ) { // If the caller does not have permission to load the stack then skip it .
if ( getCallerClass ( callerCL , di . stackClassName ) != di . stackClass ) { println ( new StringBuilder ( ) . append ( " skipping: " ) . append ( di ) . toString ( ) ) ; continue ; } result . add ( di . stack ) ; } return Collections . enumeration ( result ) ; |
public class Allure { /** * Process TestSuiteFinishedEvent . Using event . getUid ( ) to access testSuite .
* Then remove this suite from storage and marshal testSuite to xml using
* AllureResultsUtils . writeTestSuiteResult ( )
* @ param event to process */
public void fire ( TestSuiteFinishedEvent event ) { } } | String suiteUid = event . getUid ( ) ; TestSuiteResult testSuite = testSuiteStorage . remove ( suiteUid ) ; if ( testSuite == null ) { return ; } event . process ( testSuite ) ; testSuite . setVersion ( getVersion ( ) ) ; testSuite . getLabels ( ) . add ( AllureModelUtils . createProgrammingLanguageLabel ( ) ) ; writeTestSuiteResult ( testSuite ) ; notifier . fire ( event ) ; |
public class StockTileSkin { /** * * * * * * Methods * * * * * */
@ Override protected void handleEvents ( final String EVENT_TYPE ) { } } | super . handleEvents ( EVENT_TYPE ) ; if ( "VISIBILITY" . equals ( EVENT_TYPE ) ) { Helper . enableNode ( titleText , ! tile . getTitle ( ) . isEmpty ( ) ) ; Helper . enableNode ( valueText , tile . isValueVisible ( ) ) ; Helper . enableNode ( timeSpanText , ! tile . isTextVisible ( ) ) ; redraw ( ) ; } else if ( "VALUE" . equals ( EVENT_TYPE ) ) { if ( tile . isAnimated ( ) ) { tile . setAnimated ( false ) ; } if ( ! tile . isAveragingEnabled ( ) ) { tile . setAveragingEnabled ( true ) ; } double value = clamp ( minValue , maxValue , tile . getValue ( ) ) ; addData ( value ) ; handleCurrentValue ( value ) ; } else if ( "AVERAGING" . equals ( EVENT_TYPE ) ) { noOfDatapoints = tile . getAveragingPeriod ( ) ; // To get smooth lines in the chart we need at least 4 values
if ( noOfDatapoints < 4 ) throw new IllegalArgumentException ( "Please increase the averaging period to a value larger than 3." ) ; for ( int i = 0 ; i < noOfDatapoints ; i ++ ) { dataList . add ( minValue ) ; } pathElements . clear ( ) ; pathElements . add ( 0 , new MoveTo ( ) ) ; for ( int i = 1 ; i < noOfDatapoints ; i ++ ) { pathElements . add ( i , new LineTo ( ) ) ; } sparkLine . getElements ( ) . setAll ( pathElements ) ; redraw ( ) ; } |
public class WithMavenStepExecution2 { /** * Creates the actual wrapper script file and sets the permissions .
* @ param tempBinDir dir to create the script file
* @ param name the script file name
* @ param content contents of the file
* @ return
* @ throws InterruptedException when processing remote calls
* @ throws IOException when reading files */
private FilePath createWrapperScript ( FilePath tempBinDir , String name , String content ) throws IOException , InterruptedException { } } | FilePath scriptFile = tempBinDir . child ( name ) ; envOverride . put ( MVN_CMD , scriptFile . getRemote ( ) ) ; scriptFile . write ( content , getComputer ( ) . getDefaultCharset ( ) . name ( ) ) ; scriptFile . chmod ( 0755 ) ; return scriptFile ; |
public class GraphHopper { /** * Only valid option for in - memory graph and if you e . g . want to disable store on flush for unit
* tests . Specify storeOnFlush to true if you want that existing data will be loaded FROM disc
* and all in - memory data will be flushed TO disc after flush is called e . g . while OSM import .
* @ param storeOnFlush true by default */
public GraphHopper setStoreOnFlush ( boolean storeOnFlush ) { } } | ensureNotLoaded ( ) ; if ( storeOnFlush ) dataAccessType = DAType . RAM_STORE ; else dataAccessType = DAType . RAM ; return this ; |
public class GenJsCodeVisitor { /** * Helper for visitSoyFileNode ( SoyFileNode ) to add code to provide Soy namespaces .
* @ param header
* @ param soyFile The node we ' re visiting . */
private static void addCodeToProvideSoyNamespace ( StringBuilder header , SoyFileNode soyFile ) { } } | header . append ( "goog.provide('" ) . append ( soyFile . getNamespace ( ) ) . append ( "');\n" ) ; |
public class RatelimitManager { /** * Updates the ratelimit information and sets the result if the request was successful .
* @ param request The request .
* @ param result The result of the request .
* @ param bucket The bucket the request belongs to .
* @ param responseTimestamp The timestamp directly after the response finished . */
private void handleResponse ( RestRequest < ? > request , RestRequestResult result , RatelimitBucket bucket , long responseTimestamp ) { } } | if ( result == null || result . getResponse ( ) == null ) { return ; } Response response = result . getResponse ( ) ; boolean global = response . header ( "X-RateLimit-Global" , "false" ) . equalsIgnoreCase ( "true" ) ; int remaining = Integer . valueOf ( response . header ( "X-RateLimit-Remaining" , "1" ) ) ; long reset = request . getEndpoint ( ) . getHardcodedRatelimit ( ) . map ( ratelimit -> responseTimestamp + api . getTimeOffset ( ) + ratelimit ) . orElseGet ( ( ) -> Long . parseLong ( response . header ( "X-RateLimit-Reset" , "0" ) ) * 1000 ) ; // Check if we received a 429 response
if ( result . getResponse ( ) . code ( ) == 429 ) { int retryAfter = result . getJsonBody ( ) . isNull ( ) ? 0 : result . getJsonBody ( ) . get ( "retry_after" ) . asInt ( ) ; if ( global ) { // We hit a global ratelimit . Time to panic !
logger . warn ( "Hit a global ratelimit! This means you were sending a very large " + "amount within a very short time frame." ) ; RatelimitBucket . setGlobalRatelimitResetTimestamp ( api , responseTimestamp + retryAfter ) ; } else { logger . debug ( "Received a 429 response from Discord! Recalculating time offset..." ) ; // Setting the offset to null causes a recalculate for the next request
api . setTimeOffset ( null ) ; // Update the bucket information
bucket . setRatelimitRemaining ( 0 ) ; bucket . setRatelimitResetTimestamp ( responseTimestamp + retryAfter ) ; } } else { // Check if we didn ' t already complete it exceptionally .
CompletableFuture < RestRequestResult > requestResult = request . getResult ( ) ; if ( ! requestResult . isDone ( ) ) { requestResult . complete ( result ) ; } // Update bucket information
bucket . setRatelimitRemaining ( remaining ) ; bucket . setRatelimitResetTimestamp ( reset ) ; } |
public class MessageHeader { /** * Deliver the message
* @ param os the physical output stream
* @ param writerHttp the writer context */
@ Override public void deliver ( WriteStream os , OutHttp2 outHttp ) throws IOException { } } | OutHeader outHeader = outHttp . getOutHeader ( ) ; int streamId = streamId ( outHttp ) ; outHeader . openHeaders ( streamId , getPad ( ) , getPriorityDependency ( ) , getPriorityWeight ( ) , isPriorityExclusive ( ) , getFlagsHttp ( ) ) ; writeHeaders ( outHeader ) ; outHeader . closeHeaders ( ) ; |
public class DevRandomSeedGenerator { /** * { @ inheritDoc }
* @ return The requested number of random bytes , read directly from
* { @ literal / dev / random } .
* @ throws SeedException If { @ literal / dev / random } does not exist or is
* not accessible */
public byte [ ] generateSeed ( int length ) throws SeedException { } } | FileInputStream file = null ; try { file = new FileInputStream ( DEV_RANDOM ) ; byte [ ] randomSeed = new byte [ length ] ; int count = 0 ; while ( count < length ) { int bytesRead = file . read ( randomSeed , count , length - count ) ; if ( bytesRead == - 1 ) { throw new SeedException ( "EOF encountered reading random data." ) ; } count += bytesRead ; } return randomSeed ; } catch ( IOException ex ) { throw new SeedException ( "Failed reading from " + DEV_RANDOM . getName ( ) , ex ) ; } catch ( SecurityException ex ) { // Might be thrown if resource access is restricted ( such as in
// an applet sandbox ) .
throw new SeedException ( "SecurityManager prevented access to " + DEV_RANDOM . getName ( ) , ex ) ; } finally { if ( file != null ) { try { file . close ( ) ; } catch ( IOException ex ) { // Ignore .
} } } |
public class NamedArgumentDefinition { /** * Convert the initial value for this argument to a string representation . */
private String convertDefaultValueToString ( ) { } } | final Object initialValue = getArgumentValue ( ) ; if ( initialValue != null ) { if ( isCollection ( ) && ( ( Collection < ? > ) initialValue ) . isEmpty ( ) ) { // treat empty collections the same as uninitialized non - collection types
return NULL_ARGUMENT_STRING ; } else { // this is an initialized primitive type or a non - empty collection
return initialValue . toString ( ) ; } } else { return NULL_ARGUMENT_STRING ; } |
public class MultipartStream { /** * Skips a < code > boundary < / code > token , and checks whether more
* < code > encapsulations < / code > are contained in the stream .
* @ return < code > true < / code > if there are more encapsulations in this stream ;
* < code > false < / code > otherwise .
* @ throws MultipartMalformedStreamException
* if the stream ends unexpectedly or fails to follow required syntax . */
public boolean readBoundary ( ) throws MultipartMalformedStreamException { } } | final byte [ ] marker = new byte [ 2 ] ; boolean bNextChunk = false ; m_nHead += m_nBoundaryLength ; try { marker [ 0 ] = readByte ( ) ; if ( marker [ 0 ] == LF ) { // Work around IE5 Mac bug with input type = image .
// Because the boundary delimiter , not including the trailing
// CRLF , must not appear within any file ( RFC 2046 , section
// 5.1.1 ) , we know the missing CR is due to a buggy browser
// rather than a file containing something similar to a
// boundary .
return true ; } marker [ 1 ] = readByte ( ) ; if ( ArrayHelper . startsWith ( marker , STREAM_TERMINATOR ) ) bNextChunk = false ; else if ( ArrayHelper . startsWith ( marker , FIELD_SEPARATOR ) ) bNextChunk = true ; else throw new MultipartMalformedStreamException ( "Unexpected characters follow a boundary" ) ; } catch ( final IOException ex ) { throw new MultipartMalformedStreamException ( "Stream ended unexpectedly" , ex ) ; } return bNextChunk ; |
public class TrustedIdProvidersInner { /** * Gets the specified Data Lake Store trusted identity provider .
* @ param resourceGroupName The name of the Azure resource group .
* @ param accountName The name of the Data Lake Store account .
* @ param trustedIdProviderName The name of the trusted identity provider to retrieve .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the TrustedIdProviderInner object */
public Observable < TrustedIdProviderInner > getAsync ( String resourceGroupName , String accountName , String trustedIdProviderName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , accountName , trustedIdProviderName ) . map ( new Func1 < ServiceResponse < TrustedIdProviderInner > , TrustedIdProviderInner > ( ) { @ Override public TrustedIdProviderInner call ( ServiceResponse < TrustedIdProviderInner > response ) { return response . body ( ) ; } } ) ; |
public class MultiNote { /** * Returns the highest note among the notes composing this multi note .
* @ return The highest note among the notes composing this multi note .
* @ see # getLowestNote ( )
* @ see Note # isHigherThan ( Note ) */
public Note getHighestNote ( ) { } } | Note highestNote = ( Note ) m_notes . elementAt ( 0 ) ; // short highestHeight = highestNote . getHeight ( ) ;
// short currentNoteLength = 0;
for ( int i = 1 ; i < m_notes . size ( ) ; i ++ ) if ( ( ( Note ) ( m_notes . elementAt ( i ) ) ) . isHigherThan ( highestNote ) ) highestNote = ( Note ) m_notes . elementAt ( i ) ; return highestNote ; |
public class Marker { /** * Adjacency is defined by two Markers being infinitesimally close to each other .
* This means they must share the same value and have adjacent Bounds . */
public boolean isAdjacent ( Marker other ) { } } | checkTypeCompatibility ( other ) ; if ( isUpperUnbounded ( ) || isLowerUnbounded ( ) || other . isUpperUnbounded ( ) || other . isLowerUnbounded ( ) ) { return false ; } if ( type . compareTo ( valueBlock . get ( ) , 0 , other . valueBlock . get ( ) , 0 ) != 0 ) { return false ; } return ( bound == Bound . EXACTLY && other . bound != Bound . EXACTLY ) || ( bound != Bound . EXACTLY && other . bound == Bound . EXACTLY ) ; |
public class AWSCognitoIdentityProviderClient { /** * Responds to an authentication challenge , as an administrator .
* Requires developer credentials .
* @ param adminRespondToAuthChallengeRequest
* The request to respond to the authentication challenge , as an administrator .
* @ return Result of the AdminRespondToAuthChallenge operation returned by the service .
* @ throws ResourceNotFoundException
* This exception is thrown when the Amazon Cognito service cannot find the requested resource .
* @ throws InvalidParameterException
* This exception is thrown when the Amazon Cognito service encounters an invalid parameter .
* @ throws NotAuthorizedException
* This exception is thrown when a user is not authorized .
* @ throws CodeMismatchException
* This exception is thrown if the provided code does not match what the server was expecting .
* @ throws ExpiredCodeException
* This exception is thrown if a code has expired .
* @ throws UnexpectedLambdaException
* This exception is thrown when the Amazon Cognito service encounters an unexpected exception with the AWS
* Lambda service .
* @ throws InvalidPasswordException
* This exception is thrown when the Amazon Cognito service encounters an invalid password .
* @ throws UserLambdaValidationException
* This exception is thrown when the Amazon Cognito service encounters a user validation exception with the
* AWS Lambda service .
* @ throws InvalidLambdaResponseException
* This exception is thrown when the Amazon Cognito service encounters an invalid AWS Lambda response .
* @ throws TooManyRequestsException
* This exception is thrown when the user has made too many requests for a given operation .
* @ throws InvalidUserPoolConfigurationException
* This exception is thrown when the user pool configuration is invalid .
* @ throws InternalErrorException
* This exception is thrown when Amazon Cognito encounters an internal error .
* @ throws MFAMethodNotFoundException
* This exception is thrown when Amazon Cognito cannot find a multi - factor authentication ( MFA ) method .
* @ throws InvalidSmsRoleAccessPolicyException
* This exception is returned when the role provided for SMS configuration does not have permission to
* publish using Amazon SNS .
* @ throws InvalidSmsRoleTrustRelationshipException
* This exception is thrown when the trust relationship is invalid for the role provided for SMS
* configuration . This can happen if you do not trust < b > cognito - idp . amazonaws . com < / b > or the external ID
* provided in the role does not match what is provided in the SMS configuration for the user pool .
* @ throws AliasExistsException
* This exception is thrown when a user tries to confirm the account with an email or phone number that has
* already been supplied as an alias from a different account . This exception tells user that an account
* with this email or phone already exists .
* @ throws PasswordResetRequiredException
* This exception is thrown when a password reset is required .
* @ throws UserNotFoundException
* This exception is thrown when a user is not found .
* @ throws UserNotConfirmedException
* This exception is thrown when a user is not confirmed successfully .
* @ throws SoftwareTokenMFANotFoundException
* This exception is thrown when the software token TOTP multi - factor authentication ( MFA ) is not enabled
* for the user pool .
* @ sample AWSCognitoIdentityProvider . AdminRespondToAuthChallenge
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cognito - idp - 2016-04-18 / AdminRespondToAuthChallenge "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public AdminRespondToAuthChallengeResult adminRespondToAuthChallenge ( AdminRespondToAuthChallengeRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeAdminRespondToAuthChallenge ( request ) ; |
public class JLineShellAutoConfiguration { /** * Sanitize the buffer input given the customizations applied to the JLine parser ( < em > e . g . < / em > support for
* line continuations , < em > etc . < / em > ) */
static List < String > sanitizeInput ( List < String > words ) { } } | words = words . stream ( ) . map ( s -> s . replaceAll ( "^\\n+|\\n+$" , "" ) ) // CR at beginning / end of line introduced by backslash continuation
. map ( s -> s . replaceAll ( "\\n+" , " " ) ) // CR in middle of word introduced by return inside a quoted string
. collect ( Collectors . toList ( ) ) ; return words ; |
public class OneProperties { /** * Modify one config and write new config into properties file .
* @ param key need update config key
* @ param value new value */
protected void modifyConfig ( IConfigKey key , String value ) throws IOException { } } | if ( propertiesFilePath == null ) { LOGGER . warn ( "Config " + propertiesAbsoluteClassPath + " is not a file, maybe just a resource in library." ) ; } if ( configs == null ) { loadConfigs ( ) ; } configs . setProperty ( key . getKeyString ( ) , value ) ; PropertiesIO . store ( propertiesFilePath , configs ) ; |
public class JBBPBitOutputStream { /** * Write an integer value into the output stream .
* @ param value a value to be written into the output stream .
* @ param byteOrder the byte order of the value bytes to be used for writing .
* @ throws IOException it will be thrown for transport errors
* @ see JBBPByteOrder # BIG _ ENDIAN
* @ see JBBPByteOrder # LITTLE _ ENDIAN */
public void writeInt ( final int value , final JBBPByteOrder byteOrder ) throws IOException { } } | if ( byteOrder == JBBPByteOrder . BIG_ENDIAN ) { this . writeShort ( value >>> 16 , byteOrder ) ; this . writeShort ( value , byteOrder ) ; } else { this . writeShort ( value , byteOrder ) ; this . writeShort ( value >>> 16 , byteOrder ) ; } |
public class KunderaQuery { /** * Adds typed parameter to { @ link TypedParameter } .
* @ param type
* type of parameter ( e . g . NAMED / INDEXED )
* @ param parameter
* parameter name .
* @ param clause
* filter clause . */
private void addTypedParameter ( Type type , String parameter , FilterClause clause ) { } } | if ( typedParameter == null ) { typedParameter = new TypedParameter ( type ) ; } if ( typedParameter . getType ( ) . equals ( type ) ) { typedParameter . addParameters ( parameter , clause ) ; } else { logger . warn ( "Invalid type provided, it can either be name or indexes!" ) ; } |
public class gslbservice { /** * Use this API to update gslbservice resources . */
public static base_responses update ( nitro_service client , gslbservice resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { gslbservice updateresources [ ] = new gslbservice [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { updateresources [ i ] = new gslbservice ( ) ; updateresources [ i ] . servicename = resources [ i ] . servicename ; updateresources [ i ] . ipaddress = resources [ i ] . ipaddress ; updateresources [ i ] . publicip = resources [ i ] . publicip ; updateresources [ i ] . publicport = resources [ i ] . publicport ; updateresources [ i ] . cip = resources [ i ] . cip ; updateresources [ i ] . cipheader = resources [ i ] . cipheader ; updateresources [ i ] . sitepersistence = resources [ i ] . sitepersistence ; updateresources [ i ] . siteprefix = resources [ i ] . siteprefix ; updateresources [ i ] . maxclient = resources [ i ] . maxclient ; updateresources [ i ] . healthmonitor = resources [ i ] . healthmonitor ; updateresources [ i ] . maxbandwidth = resources [ i ] . maxbandwidth ; updateresources [ i ] . downstateflush = resources [ i ] . downstateflush ; updateresources [ i ] . maxaaausers = resources [ i ] . maxaaausers ; updateresources [ i ] . viewname = resources [ i ] . viewname ; updateresources [ i ] . viewip = resources [ i ] . viewip ; updateresources [ i ] . monthreshold = resources [ i ] . monthreshold ; updateresources [ i ] . weight = resources [ i ] . weight ; updateresources [ i ] . monitor_name_svc = resources [ i ] . monitor_name_svc ; updateresources [ i ] . hashid = resources [ i ] . hashid ; updateresources [ i ] . comment = resources [ i ] . comment ; updateresources [ i ] . appflowlog = resources [ i ] . appflowlog ; } result = update_bulk_request ( client , updateresources ) ; } return result ; |
public class ImagePanel { /** * Method for save the images .
* @ throws IOException */
@ Override public void doSaveAs ( ) throws IOException { } } | JFileChooser fileChooser = new JFileChooser ( ) ; ExtensionFileFilter filterPNG = new ExtensionFileFilter ( "PNG Image Files" , ".png" ) ; fileChooser . addChoosableFileFilter ( filterPNG ) ; ExtensionFileFilter filterJPG = new ExtensionFileFilter ( "JPG Image Files" , ".jpg" ) ; fileChooser . addChoosableFileFilter ( filterJPG ) ; ExtensionFileFilter filterEPS = new ExtensionFileFilter ( "EPS Image Files" , ".eps" ) ; fileChooser . addChoosableFileFilter ( filterEPS ) ; ExtensionFileFilter filterSVG = new ExtensionFileFilter ( "SVG Image Files" , ".svg" ) ; fileChooser . addChoosableFileFilter ( filterSVG ) ; fileChooser . setCurrentDirectory ( null ) ; int option = fileChooser . showSaveDialog ( this ) ; if ( option == JFileChooser . APPROVE_OPTION ) { String fileDesc = fileChooser . getFileFilter ( ) . getDescription ( ) ; if ( fileDesc . startsWith ( "PNG" ) ) { if ( ! fileChooser . getSelectedFile ( ) . getName ( ) . toUpperCase ( ) . endsWith ( "PNG" ) ) { ChartUtilities . saveChartAsPNG ( new File ( fileChooser . getSelectedFile ( ) . getAbsolutePath ( ) + ".png" ) , this . chart , this . getWidth ( ) , this . getHeight ( ) ) ; } else { ChartUtilities . saveChartAsPNG ( fileChooser . getSelectedFile ( ) , this . chart , this . getWidth ( ) , this . getHeight ( ) ) ; } } else if ( fileDesc . startsWith ( "JPG" ) ) { if ( ! fileChooser . getSelectedFile ( ) . getName ( ) . toUpperCase ( ) . endsWith ( "JPG" ) ) { ChartUtilities . saveChartAsJPEG ( new File ( fileChooser . getSelectedFile ( ) . getAbsolutePath ( ) + ".jpg" ) , this . chart , this . getWidth ( ) , this . getHeight ( ) ) ; } else { ChartUtilities . saveChartAsJPEG ( fileChooser . getSelectedFile ( ) , this . chart , this . getWidth ( ) , this . getHeight ( ) ) ; } } } // else |
public class FieldRef { /** * Returns an expression that accesses this static field . */
public Expression accessor ( ) { } } | checkState ( isStatic ( ) ) ; Features features = Features . of ( Feature . CHEAP ) ; if ( ! isNullable ( ) ) { features = features . plus ( Feature . NON_NULLABLE ) ; } return new Expression ( type ( ) , features ) { @ Override protected void doGen ( CodeBuilder mv ) { accessStaticUnchecked ( mv ) ; } } ; |
public class CmsSitemapView { /** * Shows or hides the tree for the gallery mode . < p >
* @ param visible true if the tree should be shown */
protected void setGalleriesVisible ( boolean visible ) { } } | if ( visible ) { m_noGalleriesLabel . getElement ( ) . getStyle ( ) . clearDisplay ( ) ; m_galleryTree . getElement ( ) . getStyle ( ) . clearDisplay ( ) ; } else { m_galleryTree . getElement ( ) . getStyle ( ) . setDisplay ( Display . NONE ) ; m_noGalleriesLabel . getElement ( ) . getStyle ( ) . setDisplay ( Display . NONE ) ; } |
public class BatchDisableStandardsRequest { /** * The ARNS of the standards subscriptions that you want to disable .
* @ param standardsSubscriptionArns
* The ARNS of the standards subscriptions that you want to disable . */
public void setStandardsSubscriptionArns ( java . util . Collection < String > standardsSubscriptionArns ) { } } | if ( standardsSubscriptionArns == null ) { this . standardsSubscriptionArns = null ; return ; } this . standardsSubscriptionArns = new java . util . ArrayList < String > ( standardsSubscriptionArns ) ; |
public class LocalSymbolTableImports { /** * Collects the necessary maxId info . from the passed - in { @ code imports }
* and populates the { @ code baseSids } array .
* @ return the sum of all imports ' maxIds
* @ throws IllegalArgumentException
* if any symtab beyond the first is a local or system symtab */
private static int prepBaseSids ( int [ ] baseSids , SymbolTable [ ] imports ) { } } | SymbolTable firstImport = imports [ 0 ] ; assert firstImport . isSystemTable ( ) : "first symtab must be a system symtab" ; baseSids [ 0 ] = 0 ; int total = firstImport . getMaxId ( ) ; for ( int i = 1 ; i < imports . length ; i ++ ) { SymbolTable importedTable = imports [ i ] ; if ( importedTable . isLocalTable ( ) || importedTable . isSystemTable ( ) ) { String message = "only non-system shared tables can be imported" ; throw new IllegalArgumentException ( message ) ; } baseSids [ i ] = total ; total += imports [ i ] . getMaxId ( ) ; } return total ; |
public class ServiceEndpointPolicyDefinitionsInner { /** * Creates or updates a service endpoint policy definition in the specified service endpoint policy .
* @ param resourceGroupName The name of the resource group .
* @ param serviceEndpointPolicyName The name of the service endpoint policy .
* @ param serviceEndpointPolicyDefinitionName The name of the service endpoint policy definition name .
* @ param serviceEndpointPolicyDefinitions Parameters supplied to the create or update service endpoint policy operation .
* @ 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 ServiceEndpointPolicyDefinitionInner object if successful . */
public ServiceEndpointPolicyDefinitionInner createOrUpdate ( String resourceGroupName , String serviceEndpointPolicyName , String serviceEndpointPolicyDefinitionName , ServiceEndpointPolicyDefinitionInner serviceEndpointPolicyDefinitions ) { } } | return createOrUpdateWithServiceResponseAsync ( resourceGroupName , serviceEndpointPolicyName , serviceEndpointPolicyDefinitionName , serviceEndpointPolicyDefinitions ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class QueryStats { /** * Marks a query as completed with the given HTTP code with exception and
* moves it from the running map to the cache , updating the cache if it
* already existed .
* @ param response The HTTP response to log
* @ param exception The exception thrown */
public void markSerialized ( final HttpResponseStatus response , final Throwable exception ) { } } | this . exception = exception ; this . response = response ; query_completed_ts = DateTime . currentTimeMillis ( ) ; overall_stats . put ( QueryStat . PROCESSING_PRE_WRITE_TIME , DateTime . nanoTime ( ) - query_start_ns ) ; synchronized ( running_queries ) { if ( ! running_queries . containsKey ( this . hashCode ( ) ) ) { if ( ! ENABLE_DUPLICATES ) { LOG . warn ( "Query was already marked as complete: " + this ) ; } } running_queries . remove ( hashCode ( ) ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Removed completed query " + remote_address + " with hash " + hashCode ( ) + " on thread " + Thread . currentThread ( ) . getId ( ) ) ; } } aggQueryStats ( ) ; final int cache_hash = this . hashCode ( ) ^ response . toString ( ) . hashCode ( ) ; synchronized ( completed_queries ) { final QueryStats old_query = completed_queries . getIfPresent ( cache_hash ) ; if ( old_query == null ) { completed_queries . put ( cache_hash , this ) ; } else { old_query . executed ++ ; } } |
public class ASTHelper { /** * Adds the given declaration to the specified type . The list of members
* will be initialized if it is < code > null < / code > .
* @ param type
* type declaration
* @ param decl
* member declaration */
public static void addMember ( TypeDeclaration type , BodyDeclaration decl ) { } } | List < BodyDeclaration > members = type . getMembers ( ) ; if ( members == null ) { members = new ArrayList < BodyDeclaration > ( ) ; type . setMembers ( members ) ; } members . add ( decl ) ; |
public class Logger { /** * Log the message at the specified level .
* @ param level the < code > Level < / code > to log at .
* @ param message the message to log .
* @ throws IllegalArgumentException if the < code > level < / code > is < code > null < / code > . */
public void log ( Level level , Object message ) throws IllegalArgumentException { } } | log ( level , message , null ) ; |
public class ArrayHits { /** * { @ inheritDoc } */
public int skipTo ( int target ) { } } | initialize ( ) ; for ( int i = index ; i < hits . length ; i ++ ) { int nextDocValue = hits [ i ] ; if ( nextDocValue >= target ) { index = i ; return next ( ) ; } } return - 1 ; |
public class CopiedOverriddenMethod { /** * overrides the visitor to look for an exact call to the parent class ' s method using this methods parm .
* @ param seen
* the currently parsed instruction */
@ Override public void sawOpcode ( int seen ) { } } | if ( ! sawAload0 ) { if ( seen == Const . ALOAD_0 ) { sawAload0 = true ; } else { throw new StopOpcodeParsingException ( ) ; } } else if ( nextParmIndex < parmTypes . length ) { if ( isExpectedParmInstruction ( seen , nextParmOffset , parmTypes [ nextParmIndex ] ) ) { nextParmOffset += SignatureUtils . getSignatureSize ( parmTypes [ nextParmIndex ] . getSignature ( ) ) ; nextParmIndex ++ ; } else { throw new StopOpcodeParsingException ( ) ; } } else if ( ! sawParentCall ) { if ( ( seen == Const . INVOKESPECIAL ) && getNameConstantOperand ( ) . equals ( getMethod ( ) . getName ( ) ) && getSigConstantOperand ( ) . equals ( getMethod ( ) . getSignature ( ) ) ) { sawParentCall = true ; } else { throw new StopOpcodeParsingException ( ) ; } } else { int expectedInstruction = getExpectedReturnInstruction ( getMethod ( ) . getReturnType ( ) ) ; if ( ( seen == expectedInstruction ) && ( getNextPC ( ) == getCode ( ) . getCode ( ) . length ) ) { bugReporter . reportBug ( new BugInstance ( this , BugType . COM_PARENT_DELEGATED_CALL . name ( ) , NORMAL_PRIORITY ) . addClass ( this ) . addMethod ( this ) . addSourceLine ( this ) ) ; } else { throw new StopOpcodeParsingException ( ) ; } } |
public class SanitizedContent { /** * Converts a Soy { @ link SanitizedContent } of kind CSS into a { @ link SafeStyleSheet } .
* < p > To ensure correct behavior and usage , the SanitizedContent object should fulfill the
* contract of SafeStyleSheet - the CSS content should represent the top - level content of a style
* element within HTML .
* @ throws IllegalStateException if this SanitizedContent ' s content kind is not { @ link
* ContentKind # CSS } . */
public SafeStyleSheet toSafeStyleSheet ( ) { } } | Preconditions . checkState ( getContentKind ( ) == ContentKind . CSS , "toSafeStyleSheet() only valid for SanitizedContent of kind CSS, is: %s" , getContentKind ( ) ) ; // Sanity check : Try to prevent accidental misuse when this is not really a stylesheet but
// instead just a declaration list ( i . e . a SafeStyle ) . This does fail to accept a stylesheet
// that is only a comment or only @ imports ; if you have a legitimate reason for this , it would
// be fine to make this more sophisticated , but in practice it ' s unlikely and keeping this check
// simple helps ensure it is fast . Note that this isn ' t a true security boundary , but a
// best - effort attempt to preserve SafeStyleSheet ' s semantical guarantees .
Preconditions . checkState ( getContent ( ) . isEmpty ( ) || getContent ( ) . indexOf ( '{' ) > 0 , "Calling toSafeStyleSheet() with content that doesn't look like a stylesheet" ) ; return UncheckedConversions . safeStyleSheetFromStringKnownToSatisfyTypeContract ( getContent ( ) ) ; |
public class GVRCameraRig { /** * Attach a { @ link GVRCamera camera } as the left camera of the camera rig .
* @ param camera
* { @ link GVRCamera Camera } to attach . */
public void attachLeftCamera ( GVRCamera camera ) { } } | if ( camera . hasOwnerObject ( ) ) { camera . getOwnerObject ( ) . detachCamera ( ) ; } leftCameraObject . attachCamera ( camera ) ; leftCamera = camera ; NativeCameraRig . attachLeftCamera ( getNative ( ) , camera . getNative ( ) ) ; |
public class MainApplication { /** * Connect to the remote server and get the remote server object .
* @ param strServer The ( rmi ) server .
* @ param The remote application name in jndi index .
* @ return The remote server object . */
public RemoteTask createRemoteTask ( String strServer , String strRemoteApp , String strUserID , String strPassword ) { } } | RemoteTask remoteTask = super . createRemoteTask ( strServer , strRemoteApp , strUserID , strPassword ) ; return remoteTask ; |
public class VnSyllParser { /** * Parses the first consonant . */
private void parseFirstConsonant ( ) { } } | // find first of ( vnfirstconsonant )
// if not found , first consonant = ZERO
// else the found consonant
Iterator iter = alFirstConsonants . iterator ( ) ; while ( iter . hasNext ( ) ) { String strFirstCon = ( String ) iter . next ( ) ; if ( strSyllable . startsWith ( strFirstCon , iCurPos ) ) { strFirstConsonant = strFirstCon ; iCurPos += strFirstCon . length ( ) ; return ; } } strFirstConsonant = ZERO ; |
public class Main { /** * This function computes the sum of the squares of first n natural numbers .
* Args :
* n : A natural number .
* Returns :
* An integer that equals to the sum of squares of the first n numbers .
* Examples :
* > > > calculateSquareSum ( 6)
* 91
* > > > calculateSquareSum ( 7)
* 140
* > > > calculateSquareSum ( 12)
* 650 */
public static int calculateSquareSum ( int n ) { } } | int sumSquares = 0 ; sumSquares = ( int ) ( n * ( n + 1 ) * ( ( 2 * n ) + 1 ) ) / 6 ; return sumSquares ; |
public class Schema { /** * Clear all KS / CF metadata and reset version . */
public synchronized void clear ( ) { } } | for ( String keyspaceName : getNonSystemKeyspaces ( ) ) { KSMetaData ksm = getKSMetaData ( keyspaceName ) ; for ( CFMetaData cfm : ksm . cfMetaData ( ) . values ( ) ) purge ( cfm ) ; clearKeyspaceDefinition ( ksm ) ; } updateVersionAndAnnounce ( ) ; |
public class StructrCMISService { /** * - - - - - interface NaviagationService - - - - - */
@ Override public ObjectInFolderList getChildren ( String repositoryId , String folderId , String filter , String orderBy , Boolean includeAllowableActions , IncludeRelationships includeRelationships , String renditionFilter , Boolean includePathSegment , BigInteger maxItems , BigInteger skipCount , ExtensionsData extension ) { } } | return navigationService . getChildren ( repositoryId , folderId , filter , orderBy , includeAllowableActions , includeRelationships , renditionFilter , includePathSegment , maxItems , skipCount , extension ) ; |
public class Scheduler { /** * Schedule runnable to run a given interval
* @ param runnable the runnable to
* @ param firstTime
* @ param period */
public void scheduleRecurring ( Runnable runnable , Date firstTime , long period ) { } } | timer . scheduleAtFixedRate ( toTimerTask ( runnable ) , firstTime , period ) ; |
public class ActiveRecordPlugin { /** * 分布式场景下指定 IContainerFactory , 并默认使用 MysqlDialect 、 EhCache
* @ see # useAsDataTransfer ( Dialect , IContainerFactory , ICache ) */
public static void useAsDataTransfer ( IContainerFactory containerFactory ) { } } | useAsDataTransfer ( new com . jfinal . plugin . activerecord . dialect . MysqlDialect ( ) , containerFactory , new com . jfinal . plugin . activerecord . cache . EhCache ( ) ) ; |
public class ServiceDiscoveryManager { /** * Find all services under the users service that provide a given feature .
* @ param feature the feature to search for
* @ param stopOnFirst if true , stop searching after the first service was found
* @ param useCache if true , query a cache first to avoid network I / O
* @ return a possible empty list of services providing the given feature
* @ throws NoResponseException
* @ throws XMPPErrorException
* @ throws NotConnectedException
* @ throws InterruptedException */
public List < DiscoverInfo > findServicesDiscoverInfo ( String feature , boolean stopOnFirst , boolean useCache ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } } | return findServicesDiscoverInfo ( feature , stopOnFirst , useCache , null ) ; |
public class ListSecretsResult { /** * A list of the secrets in the account .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setSecretList ( java . util . Collection ) } or { @ link # withSecretList ( java . util . Collection ) } if you want to
* override the existing values .
* @ param secretList
* A list of the secrets in the account .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListSecretsResult withSecretList ( SecretListEntry ... secretList ) { } } | if ( this . secretList == null ) { setSecretList ( new java . util . ArrayList < SecretListEntry > ( secretList . length ) ) ; } for ( SecretListEntry ele : secretList ) { this . secretList . add ( ele ) ; } return this ; |
public class StorageAccountsInner { /** * Gets the first page of Azure Storage accounts , if any , linked to the specified Data Lake Analytics account . The response includes a link to the next page , if any .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; StorageAccountInformationInner & gt ; object */
public Observable < Page < StorageAccountInformationInner > > listByAccountNextAsync ( final String nextPageLink ) { } } | return listByAccountNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < StorageAccountInformationInner > > , Page < StorageAccountInformationInner > > ( ) { @ Override public Page < StorageAccountInformationInner > call ( ServiceResponse < Page < StorageAccountInformationInner > > response ) { return response . body ( ) ; } } ) ; |
public class DebMojo { /** * Decrypts given passphrase if needed using maven security dispatcher .
* See http : / / maven . apache . org / guides / mini / guide - encryption . html for details .
* @ param maybeEncryptedPassphrase possibly encrypted passphrase
* @ return decrypted passphrase */
private String decrypt ( final String maybeEncryptedPassphrase ) { } } | if ( maybeEncryptedPassphrase == null ) { return null ; } try { final String decrypted = secDispatcher . decrypt ( maybeEncryptedPassphrase ) ; if ( maybeEncryptedPassphrase . equals ( decrypted ) ) { console . info ( "Passphrase was not encrypted" ) ; } else { console . info ( "Passphrase was successfully decrypted" ) ; } return decrypted ; } catch ( SecDispatcherException e ) { console . warn ( "Unable to decrypt passphrase: " + e . getMessage ( ) ) ; } return maybeEncryptedPassphrase ; |
public class ExtendedSpringStatusMessageLookupFunction { /** * { @ inheritDoc } */
@ Override public String apply ( final ProfileRequestContext input ) { } } | if ( input != null && messageSource != null ) { final SpringRequestContext springContext = input . getSubcontext ( SpringRequestContext . class ) ; if ( springContext != null ) { final RequestContext springRequestContext = springContext . getRequestContext ( ) ; final Event previousEvent = springRequestContext != null ? springRequestContext . getCurrentEvent ( ) : null ; if ( previousEvent != null ) { try { String msg = messageSource . getMessage ( previousEvent . getId ( ) , null , this . getLocale ( springRequestContext ) ) ; return this . messageSource . getMessage ( msg + ".message" , null , msg , this . getLocale ( springRequestContext ) ) ; } catch ( final NoSuchMessageException e ) { return null ; } } } } return null ; |
public class PutFootnotesMacro { /** * Processes a { { footnote } } macro , by generating a footnote element to insert in the footnote list and a reference
* to it , which is placed instead of the macro call .
* @ param footnoteMacro the { { footnote } } macro element
* @ param counter the current footnote counter
* @ param context the execution context of the macro
* @ return the footnote element which should be inserted in the footnote list
* @ throws MacroExecutionException if the footnote content cannot be further processed */
private ListItemBlock processFootnote ( MacroMarkerBlock footnoteMacro , int counter , MacroTransformationContext context ) throws MacroExecutionException { } } | String content = footnoteMacro . getContent ( ) ; if ( StringUtils . isBlank ( content ) ) { content = " " ; } // Construct the footnote and reference blocks
Block referenceBlock = createFootnoteReferenceBlock ( counter ) ; ListItemBlock footnoteBlock = createFootnoteBlock ( content , counter , context ) ; // Insert the footnote and the reference in the document .
if ( referenceBlock != null && footnoteBlock != null ) { addFootnoteRef ( footnoteMacro , referenceBlock ) ; return footnoteBlock ; } return null ; |
public class FedoraPolicyStore { /** * ( non - Javadoc )
* @ see
* org . fcrepo . server . security . xacml . pdp . data . PolicyDataManager # deletePolicy
* ( java . lang . String ) */
@ Override public boolean deletePolicy ( String name ) throws PolicyStoreException { } } | String pid = this . getPID ( name ) ; if ( ! contains ( name ) ) { throw new PolicyStoreException ( "Delete: object " + pid + " not found." ) ; } try { this . apiMService . modifyObject ( getContext ( ) , pid , "D" , null , null , "Deleting policy " + pid , null ) ; } catch ( ServerException e ) { throw new PolicyStoreException ( "Delete: error deleting policy " + pid + " - " + e . getMessage ( ) , e ) ; } return true ; |
public class NonGeometricData { /** * Get an attribute converted to a float value
* @ param attribute The attribute to retrieve
* @ return The float value derived from the attribute */
public float getAsFloat ( String attribute ) { } } | String value = getAttribute ( attribute ) ; if ( value == null ) { return 0 ; } try { return Float . parseFloat ( value ) ; } catch ( NumberFormatException e ) { throw new RuntimeException ( "Attribute " + attribute + " is not specified as a float:" + getAttribute ( attribute ) ) ; } |
public class VersionedAvroEntityMapper { /** * Initialize the entity mapper we ' ll use to convert the schema version
* metadata in each row to a ManagedSchemaEntityVersion record . */
private void initializeEntityVersionEntityMapper ( ) { } } | AvroEntitySchema avroEntitySchema = schemaParser . parseEntitySchema ( managedSchemaEntityVersionSchema ) ; avroEntitySchema = AvroUtils . mergeSpecificStringTypes ( ManagedSchemaEntityVersion . class , avroEntitySchema ) ; AvroEntityComposer < ManagedSchemaEntityVersion > entityComposer = new AvroEntityComposer < ManagedSchemaEntityVersion > ( avroEntitySchema , true ) ; AvroEntitySerDe < ManagedSchemaEntityVersion > entitySerDe = new AvroEntitySerDe < ManagedSchemaEntityVersion > ( entityComposer , avroEntitySchema , avroEntitySchema , true ) ; this . managedSchemaEntityVersionEntityMapper = new BaseEntityMapper < ManagedSchemaEntityVersion > ( avroEntitySchema , entitySerDe ) ; |
public class AbstractCob2JavaGeneratorMain { /** * Process the command line options selected .
* @ param line the parsed command line
* @ param options available
* @ return false if processing needs to stop , true if its ok to continue
* @ throws Exception if line cannot be processed */
private boolean processLine ( final CommandLine line , final Options options ) { } } | if ( line . hasOption ( OPTION_VERSION ) ) { log . info ( getVersion ( true ) ) ; return false ; } if ( line . hasOption ( OPTION_HELP ) ) { produceHelp ( options ) ; return false ; } if ( line . hasOption ( OPTION_INPUT ) ) { setInput ( line . getOptionValue ( OPTION_INPUT ) . trim ( ) ) ; } if ( line . hasOption ( OPTION_INPUT_ENCODING ) ) { setInputEncoding ( line . getOptionValue ( OPTION_INPUT_ENCODING ) . trim ( ) ) ; } if ( line . hasOption ( OPTION_OUTPUT ) ) { setOutput ( line . getOptionValue ( OPTION_OUTPUT ) . trim ( ) ) ; } if ( line . hasOption ( OPTION_OUTPUT_PACKAGE_PREFIX ) ) { setOutputPackagePrefix ( line . getOptionValue ( OPTION_OUTPUT_PACKAGE_PREFIX ) . trim ( ) ) ; } if ( line . hasOption ( OPTION_CONFIG ) ) { setConfigProps ( line . getOptionValue ( OPTION_CONFIG ) . trim ( ) ) ; } if ( line . hasOption ( OPTION_XSLT_FILE_NAME ) ) { setXsltFileName ( line . getOptionValue ( OPTION_XSLT_FILE_NAME ) . trim ( ) ) ; } return true ; |
public class UCharacter { /** * < strong > [ icu ] < / strong > Return the property value integer for a given value name , as
* specified in the Unicode database file PropertyValueAliases . txt .
* Short , long , and any other variants are recognized .
* Note : Some of the names in PropertyValueAliases . txt will only be
* recognized with UProperty . GENERAL _ CATEGORY _ MASK , not
* UProperty . GENERAL _ CATEGORY . These include : " C " / " Other " , " L " /
* " Letter " , " LC " / " Cased _ Letter " , " M " / " Mark " , " N " / " Number " , " P "
* / " Punctuation " , " S " / " Symbol " , and " Z " / " Separator " .
* @ param property UProperty selector constant .
* UProperty . INT _ START & lt ; = property & lt ; UProperty . INT _ LIMIT or
* UProperty . BINARY _ START & lt ; = property & lt ; UProperty . BINARY _ LIMIT or
* UProperty . MASK _ START & lt ; = property & lt ; UProperty . MASK _ LIMIT .
* Only these properties can be enumerated .
* @ param valueAlias the value name to be matched . The name is
* compared using " loose matching " as described in
* PropertyValueAliases . txt .
* @ return a value integer . Note : UProperty . GENERAL _ CATEGORY
* values are mask values produced by left - shifting 1 by
* UCharacter . getType ( ) . This allows grouped categories such as
* [ : L : ] to be represented .
* @ see UProperty
* @ throws IllegalArgumentException if property is not a valid UProperty
* selector or valueAlias is not a value of this property */
public static int getPropertyValueEnum ( int property , CharSequence valueAlias ) { } } | int propEnum = UPropertyAliases . INSTANCE . getPropertyValueEnum ( property , valueAlias ) ; if ( propEnum == UProperty . UNDEFINED ) { throw new IllegalIcuArgumentException ( "Invalid name: " + valueAlias ) ; } return propEnum ; |
public class TransactionDeleteLogRecord { /** * Called to perform recovery action during a warm start of the ObjectManager .
* @ param objectManagerState of the ObjectManager performing recovery .
* @ throws ObjectManagerException */
public void performRecovery ( ObjectManagerState objectManagerState ) throws ObjectManagerException { } } | if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "performRecovery" , new Object [ ] { objectManagerState , logicalUnitOfWork , new Integer ( transactionState ) , token } ) ; // Delete the ManagedObject again using its original Transaction .
Transaction transactionForRecovery = objectManagerState . getTransaction ( logicalUnitOfWork ) ; ManagedObject existingManagedObject = token . getManagedObject ( ) ; if ( existingManagedObject == null ) { // The object may have already been deleted from the ObjectStore ,
// so create a dummy object to keep the transaction happy .
// The Token will have the ObjecStore and storedObjectIdentifier so the the correct delete in the
// ObjectStore can take place .
DummyManagedObject dummyManagedObject = new DummyManagedObject ( "Created by TransactionDeleteLogRecord.performRecovery()" ) ; existingManagedObject = token . setManagedObject ( dummyManagedObject ) ; existingManagedObject . state = ManagedObject . stateReady ; } // if ( existingManagedObject = = null ) .
// Redo the delete .
transactionForRecovery . delete ( existingManagedObject ) ; // No need to reset the transaction state because Delete can only be executed before
// the transaction is prepared .
// transactionForRecovery . internalTransaction . resetState ( transactionState ) ;
if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "performRecovery" ) ; |
public class SerializingListener { /** * This method is called at each epoch end
* @ param event
* @ param sequenceVectors
* @ param argument */
@ Override public void processEvent ( ListenerEvent event , SequenceVectors < T > sequenceVectors , long argument ) { } } | try { locker . acquire ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss.SSS" ) ; StringBuilder builder = new StringBuilder ( targetFolder . getAbsolutePath ( ) ) ; builder . append ( "/" ) . append ( modelPrefix ) . append ( "_" ) . append ( sdf . format ( new Date ( ) ) ) . append ( ".seqvec" ) ; File targetFile = new File ( builder . toString ( ) ) ; if ( useBinarySerialization ) { SerializationUtils . saveObject ( sequenceVectors , targetFile ) ; } else { throw new UnsupportedOperationException ( "Not implemented yet" ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } finally { locker . release ( ) ; } |
public class BlockingDrainingQueue { /** * Closes the queue and prevents any other access to it . Any blocked call to takeAllItems ( ) will fail with InterruptedException .
* @ return If the queue has any more items in it , these will be returned here in the order in which they were inserted .
* The items are guaranteed not to be returned both here and via take ( ) / poll ( ) . */
public Queue < T > close ( ) { } } | CompletableFuture < Queue < T > > pending = null ; Queue < T > result = null ; synchronized ( this . contents ) { if ( ! this . closed ) { this . closed = true ; pending = this . pendingTake ; this . pendingTake = null ; result = fetch ( this . contents . size ( ) ) ; } } // Cancel any pending poll request .
if ( pending != null ) { pending . cancel ( true ) ; } return result != null ? result : new LinkedList < > ( ) ; |
public class BackgroundOperation { /** * Runs a job in a background thread , using the ExecutorService , and optionally
* sets the cursor to the wait cursor and blocks input . */
public void doBackgroundOp ( final Runnable run , final boolean showWaitCursor ) { } } | final Component [ ] key = new Component [ 1 ] ; ExecutorService jobRunner = getJobRunner ( ) ; if ( jobRunner != null ) { jobRunner . submit ( ( ) -> performBackgroundOp ( run , key , showWaitCursor ) ) ; } else { run . run ( ) ; } |
public class XPointerEngine { /** * Setting the language for the pointer resolution
* The language is used for xml : lang calculation
* @ param language of the parent xml
* @ return the XPointerEngine for fluent api usage */
public XPointerEngine setLanguage ( final String language ) { } } | if ( language == null ) { this . languageValue = XdmEmptySequence . getInstance ( ) ; } else { this . languageValue = new XdmAtomicValue ( language ) ; } return this ; |
public class Versions { /** * Resolves the version .
* @ param minecraftDir the minecraft directory
* @ param version the version name
* @ return the version object , or null if the version does not exist
* @ throws IOException if an I / O error has occurred during resolving version
* @ throws NullPointerException if
* < code > minecraftDir = = null | | version = = null < / code > */
public static Version resolveVersion ( MinecraftDirectory minecraftDir , String version ) throws IOException { } } | Objects . requireNonNull ( minecraftDir ) ; Objects . requireNonNull ( version ) ; if ( doesVersionExist ( minecraftDir , version ) ) { try { return getVersionParser ( ) . parseVersion ( resolveVersionHierarchy ( version , minecraftDir ) , PlatformDescription . current ( ) ) ; } catch ( JSONException e ) { throw new IOException ( "Couldn't parse version json: " + version , e ) ; } } else { return null ; } |
public class IOUtil { /** * Convert from a < code > URL < / code > to a < code > File < / code > .
* From version 1.1 this method will decode the URL .
* Syntax such as < code > file : / / / my % 20docs / file . txt < / code > will be
* correctly decoded to < code > / my docs / file . txt < / code > . Starting with version
* 1.5 , this method uses UTF - 8 to decode percent - encoded octets to characters .
* Additionally , malformed percent - encoded octets are handled leniently by
* passing them through literally .
* @ param url the file URL to convert , { @ code null } returns { @ code null }
* @ return the equivalent < code > File < / code > object if the URL ' s protocol is not < code > file < / code >
* @ throws NullPointerException if the parameter is null */
public static File toFile ( final URL url ) { } } | if ( url . getProtocol ( ) . equals ( "file" ) == false ) { throw new IllegalArgumentException ( "URL could not be converted to a File: " + url ) ; } return new File ( decodeUrl ( url . getFile ( ) . replace ( '/' , File . separatorChar ) ) ) ; |
public class PMML4UnitImpl { /** * Initializes the internal structure that holds data dictionary information .
* This initializer should be called prior to any other initializers , since
* many other structures may have a dependency on the data dictionary . */
private void initDataDictionaryMap ( ) { } } | DataDictionary dd = rawPmml . getDataDictionary ( ) ; if ( dd != null ) { dataDictionaryMap = new HashMap < > ( ) ; for ( DataField dataField : dd . getDataFields ( ) ) { PMMLDataField df = new PMMLDataField ( dataField ) ; dataDictionaryMap . put ( df . getName ( ) , df ) ; } } else { throw new IllegalStateException ( "BRMS-PMML requires a data dictionary section in the definition file" ) ; } |
public class IoUtil { /** * Returns the content of a { @ link File } .
* @ param file the file to load
* @ return Content of the file as { @ link String } */
public static byte [ ] fileAsByteArray ( File file ) { } } | try { return inputStreamAsByteArray ( new FileInputStream ( file ) ) ; } catch ( FileNotFoundException e ) { throw LOG . fileNotFoundException ( file . getAbsolutePath ( ) , e ) ; } |
public class AWSMarketplaceMeteringClient { /** * ResolveCustomer is called by a SaaS application during the registration process . When a buyer visits your website
* during the registration process , the buyer submits a registration token through their browser . The registration
* token is resolved through this API to obtain a CustomerIdentifier and product code .
* @ param resolveCustomerRequest
* Contains input to the ResolveCustomer operation .
* @ return Result of the ResolveCustomer operation returned by the service .
* @ throws InvalidTokenException
* Registration token is invalid .
* @ throws ExpiredTokenException
* The submitted registration token has expired . This can happen if the buyer ' s browser takes too long to
* redirect to your page , the buyer has resubmitted the registration token , or your application has held on
* to the registration token for too long . Your SaaS registration website should redeem this token as soon
* as it is submitted by the buyer ' s browser .
* @ throws ThrottlingException
* The calls to the API are throttled .
* @ throws InternalServiceErrorException
* An internal error has occurred . Retry your request . If the problem persists , post a message with details
* on the AWS forums .
* @ throws DisabledApiException
* The API is disabled in the Region .
* @ sample AWSMarketplaceMetering . ResolveCustomer
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / meteringmarketplace - 2016-01-14 / ResolveCustomer "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public ResolveCustomerResult resolveCustomer ( ResolveCustomerRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeResolveCustomer ( request ) ; |
public class ImageTagUtils { /** * Returns the image URL generated by Jawr from a source image path
* @ param imgSrc
* the source image path
* @ param base64
* the flag indicating if we must encode in base64
* @ param binaryRsHandler
* the binary resource handler
* @ param request
* the request
* @ param response
* the response
* @ return the image URL generated by Jawr from a source image path */
public static String getImageUrl ( String imgSrc , boolean base64 , BinaryResourcesHandler binaryRsHandler , HttpServletRequest request , HttpServletResponse response ) { } } | String imgUrl = null ; boolean isIE6orIE7 = RendererRequestUtils . isIE7orLess ( request ) ; if ( ! isIE6orIE7 && base64 ) { imgUrl = getBase64EncodedImage ( imgSrc , binaryRsHandler , request ) ; } else { imgUrl = getImageUrl ( imgSrc , binaryRsHandler , request , response ) ; } return imgUrl ; |
public class SharedTorrent { /** * Retrieve a piece object by index .
* @ param index The index of the piece in this torrent . */
public Piece getPiece ( int index ) { } } | if ( this . pieces == null ) { throw new IllegalStateException ( "Torrent not initialized yet." ) ; } if ( index >= this . pieces . length ) { throw new IllegalArgumentException ( "Invalid piece index!" ) ; } return this . pieces [ index ] ; |
public class StreamingEndpointsInner { /** * Create StreamingEndpoint .
* Creates a StreamingEndpoint .
* @ param resourceGroupName The name of the resource group within the Azure subscription .
* @ param accountName The Media Services account name .
* @ param streamingEndpointName The name of the StreamingEndpoint .
* @ param parameters StreamingEndpoint properties needed for creation .
* @ param autoStart The flag indicates if the resource should be automatically started on creation .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < StreamingEndpointInner > createAsync ( String resourceGroupName , String accountName , String streamingEndpointName , StreamingEndpointInner parameters , Boolean autoStart , final ServiceCallback < StreamingEndpointInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( createWithServiceResponseAsync ( resourceGroupName , accountName , streamingEndpointName , parameters , autoStart ) , serviceCallback ) ; |
public class SoapUIProExtensionMockServiceRunner { /** * then not used by this method */
@ Override public String getAbsoluteOutputFolder ( ModelItem modelItem ) { } } | // use getter instead of calling the ouputFolder field directly
String folder = PropertyExpander . expandProperties ( modelItem , getOutputFolder ( ) ) ; if ( StringUtils . isNullOrEmpty ( folder ) ) { folder = PathUtils . getExpandedResourceRoot ( modelItem ) ; } else if ( PathUtils . isRelativePath ( folder ) ) { folder = PathUtils . resolveResourcePath ( folder , modelItem ) ; } return folder ; |
public class Transactions { /** * Resumes a transaction that was previously suspended via the { @ link org . modeshape . jcr . txn . Transactions # suspend ( ) } call . If
* there is no such transaction or there is another active transaction , nothing happens .
* @ param transaction a { @ link javax . transaction . Transaction } instance which was suspended previously or { @ code null }
* @ throws javax . transaction . SystemException if the operation fails .
* @ see javax . transaction . TransactionManager # resume ( javax . transaction . Transaction ) */
public void resume ( javax . transaction . Transaction transaction ) throws SystemException { } } | if ( transaction != null && txnMgr . getTransaction ( ) == null ) { try { txnMgr . resume ( transaction ) ; } catch ( InvalidTransactionException e ) { throw new RuntimeException ( e ) ; } } |
public class BatchRequest { /** * Executes all queued HTTP requests in a single call , parses the responses and invokes callbacks .
* Calling { @ link # execute ( ) } executes and clears the queued requests . This means that the
* { @ link BatchRequest } object can be reused to { @ link # queue } and { @ link # execute ( ) } requests
* again . */
public void execute ( ) throws IOException { } } | boolean retryAllowed ; Preconditions . checkState ( ! requestInfos . isEmpty ( ) ) ; HttpRequest batchRequest = requestFactory . buildPostRequest ( this . batchUrl , null ) ; // NOTE : batch does not support gzip encoding
HttpExecuteInterceptor originalInterceptor = batchRequest . getInterceptor ( ) ; batchRequest . setInterceptor ( new BatchInterceptor ( originalInterceptor ) ) ; int retriesRemaining = batchRequest . getNumberOfRetries ( ) ; do { retryAllowed = retriesRemaining > 0 ; MultipartContent batchContent = new MultipartContent ( ) ; batchContent . getMediaType ( ) . setSubType ( "mixed" ) ; int contentId = 1 ; for ( RequestInfo < ? , ? > requestInfo : requestInfos ) { batchContent . addPart ( new MultipartContent . Part ( new HttpHeaders ( ) . setAcceptEncoding ( null ) . set ( "Content-ID" , contentId ++ ) , new HttpRequestContent ( requestInfo . request ) ) ) ; } batchRequest . setContent ( batchContent ) ; HttpResponse response = batchRequest . execute ( ) ; BatchUnparsedResponse batchResponse ; try { // Find the boundary from the Content - Type header .
String boundary = "--" + response . getMediaType ( ) . getParameter ( "boundary" ) ; // Parse the content stream .
InputStream contentStream = response . getContent ( ) ; batchResponse = new BatchUnparsedResponse ( contentStream , boundary , requestInfos , retryAllowed ) ; while ( batchResponse . hasNext ) { batchResponse . parseNextResponse ( ) ; } } finally { response . disconnect ( ) ; } List < RequestInfo < ? , ? > > unsuccessfulRequestInfos = batchResponse . unsuccessfulRequestInfos ; if ( ! unsuccessfulRequestInfos . isEmpty ( ) ) { requestInfos = unsuccessfulRequestInfos ; } else { break ; } retriesRemaining -- ; } while ( retryAllowed ) ; requestInfos . clear ( ) ; |
public class TeaToolsUtils { /** * Introspects a Java bean to learn all about its properties , exposed
* methods , below a given " stop " point .
* @ param beanClass the bean class to be analyzed
* @ param stopClass the base class at which to stop the analysis .
* Any methods / properties / events in the stopClass or in its baseclasses
* will be ignored in the analysis */
public BeanInfo getBeanInfo ( Class < ? > beanClass , Class < ? > stopClass ) throws IntrospectionException { } } | return Introspector . getBeanInfo ( beanClass , stopClass ) ; |
public class FileSystemAvatarBase { /** * 根据名称和类型得到文件绝对路径
* @ param name
* @ param type */
public String getAbsoluteAvatarPath ( String name , String type ) { } } | StringBuilder sb = new StringBuilder ( avatarDir ) ; sb . append ( name ) . append ( '.' ) . append ( type . toLowerCase ( ) ) ; return sb . toString ( ) ; |
public class DMNAssemblerService { /** * Returns a DMNCompilerConfiguration with the specified properties set , and applying the explicited dmnProfiles .
* @ param classLoader
* @ param chainedProperties applies properties - - it does not do any classloading nor profile loading based on these properites , just passes the values .
* @ param dmnProfiles applies these DMNProfile ( s ) to the DMNCompilerConfiguration
* @ param config
* @ return */
public static DMNCompilerConfigurationImpl compilerConfigWithKModulePrefs ( ClassLoader classLoader , ChainedProperties chainedProperties , List < DMNProfile > dmnProfiles , DMNCompilerConfigurationImpl config ) { } } | config . setRootClassLoader ( classLoader ) ; Map < String , String > dmnPrefs = new HashMap < > ( ) ; chainedProperties . mapStartsWith ( dmnPrefs , ORG_KIE_DMN_PREFIX , true ) ; config . setProperties ( dmnPrefs ) ; for ( DMNProfile dmnProfile : dmnProfiles ) { config . addExtensions ( dmnProfile . getExtensionRegisters ( ) ) ; config . addDRGElementCompilers ( dmnProfile . getDRGElementCompilers ( ) ) ; config . addFEELProfile ( dmnProfile ) ; } return config ; |
public class Weeks { /** * Obtains a { @ code Weeks } from a text string such as { @ code PnW } .
* This will parse the string produced by { @ code toString ( ) } which is
* based on the ISO - 8601 period formats { @ code PnW } .
* The string starts with an optional sign , denoted by the ASCII negative
* or positive symbol . If negative , the whole amount is negated .
* The ASCII letter " P " is next in upper or lower case .
* The ASCII integer amount is next , which may be negative .
* The ASCII letter " W " is next in upper or lower case .
* The leading plus / minus sign , and negative values for weeks are
* not part of the ISO - 8601 standard .
* For example , the following are valid inputs :
* < pre >
* " P2W " - - Weeks . of ( 2)
* " P - 2W " - - Weeks . of ( - 2)
* " - P2W " - - Weeks . of ( - 2)
* " - P - 2W " - - Weeks . of ( 2)
* < / pre >
* @ param text the text to parse , not null
* @ return the parsed period , not null
* @ throws DateTimeParseException if the text cannot be parsed to a period */
@ FromString public static Weeks parse ( CharSequence text ) { } } | Objects . requireNonNull ( text , "text" ) ; Matcher matcher = PATTERN . matcher ( text ) ; if ( matcher . matches ( ) ) { int negate = "-" . equals ( matcher . group ( 1 ) ) ? - 1 : 1 ; String str = matcher . group ( 2 ) ; try { int val = Integer . parseInt ( str ) ; return of ( Math . multiplyExact ( val , negate ) ) ; } catch ( NumberFormatException ex ) { throw new DateTimeParseException ( "Text cannot be parsed to a Weeks" , text , 0 , ex ) ; } } throw new DateTimeParseException ( "Text cannot be parsed to a Weeks" , text , 0 ) ; |
public class LToCharBiFunctionBuilder { /** * One of ways of creating builder . This might be the only way ( considering all _ functional _ builders ) that might be utilize to specify generic params only once . */
@ Nonnull public static < T1 , T2 > LToCharBiFunctionBuilder < T1 , T2 > toCharBiFunction ( Consumer < LToCharBiFunction < T1 , T2 > > consumer ) { } } | return new LToCharBiFunctionBuilder ( consumer ) ; |
public class BeadledomClientBuilder { /** * Return a new instance of { @ code { @ link BeadledomWebTarget } } with the given String path by using
* the default builder implementation on the classpath found using SPI . */
public BeadledomWebTarget buildTarget ( String baseUrl ) { } } | BeadledomClient beadledomClient = build ( ) ; return beadledomClient . target ( baseUrl ) ; |
public class BrownianMotion { /** * Lazy initialization of brownianIncrement . Synchronized to ensure thread safety of lazy init . */
private void doGenerateBrownianMotion ( ) { } } | if ( brownianIncrements != null ) { return ; // Nothing to do
} // Create random number sequence generator
MersenneTwister mersenneTwister = new MersenneTwister ( seed ) ; // Allocate memory
double [ ] [ ] [ ] brownianIncrementsArray = new double [ timeDiscretization . getNumberOfTimeSteps ( ) ] [ numberOfFactors ] [ numberOfPaths ] ; // Pre - calculate square roots of deltaT
double [ ] sqrtOfTimeStep = new double [ timeDiscretization . getNumberOfTimeSteps ( ) ] ; for ( int timeIndex = 0 ; timeIndex < sqrtOfTimeStep . length ; timeIndex ++ ) { sqrtOfTimeStep [ timeIndex ] = Math . sqrt ( timeDiscretization . getTimeStep ( timeIndex ) ) ; } /* * Generate normal distributed independent increments .
* The inner loop goes over time and factors .
* MersenneTwister is known to generate " independent " increments in 623 dimensions .
* Since we want to generate independent streams ( paths ) , the loop over path is the outer loop . */
for ( int path = 0 ; path < numberOfPaths ; path ++ ) { for ( int timeIndex = 0 ; timeIndex < timeDiscretization . getNumberOfTimeSteps ( ) ; timeIndex ++ ) { double sqrtDeltaT = sqrtOfTimeStep [ timeIndex ] ; // Generate uncorrelated Brownian increment
for ( int factor = 0 ; factor < numberOfFactors ; factor ++ ) { double uniformIncrement = mersenneTwister . nextDouble ( ) ; brownianIncrementsArray [ timeIndex ] [ factor ] [ path ] = net . finmath . functions . NormalDistribution . inverseCumulativeDistribution ( uniformIncrement ) * sqrtDeltaT ; } } } // Allocate memory for RandomVariable wrapper objects .
brownianIncrements = new RandomVariableInterface [ timeDiscretization . getNumberOfTimeSteps ( ) ] [ numberOfFactors ] ; // Wrap the values in RandomVariable objects
for ( int timeIndex = 0 ; timeIndex < timeDiscretization . getNumberOfTimeSteps ( ) ; timeIndex ++ ) { double time = timeDiscretization . getTime ( timeIndex + 1 ) ; for ( int factor = 0 ; factor < numberOfFactors ; factor ++ ) { brownianIncrements [ timeIndex ] [ factor ] = randomVariableFactory . createRandomVariable ( time , brownianIncrementsArray [ timeIndex ] [ factor ] ) ; } } |
public class JournalConsumer { /** * Tell the thread , the reader and the log to shut down . */
public void shutdown ( ) throws ModuleShutdownException { } } | try { consumerThread . shutdown ( ) ; reader . shutdown ( ) ; recoveryLog . shutdown ( "Server is shutting down." ) ; } catch ( JournalException e ) { throw new ModuleShutdownException ( "Error closing journal reader." , role , e ) ; } |
public class Calendar { /** * Set a field to a value . Subclasses should use this method when
* computing fields . It sets the time stamp in the
* < code > stamp [ ] < / code > array to < code > INTERNALLY _ SET < / code > . If a
* field that may not be set by subclasses is passed in , an
* < code > IllegalArgumentException < / code > is thrown . This prevents
* subclasses from modifying fields that are intended to be
* calendar - system invariant . */
protected final void internalSet ( int field , int value ) { } } | if ( ( ( 1 << field ) & internalSetMask ) == 0 ) { throw new IllegalStateException ( "Subclass cannot set " + fieldName ( field ) ) ; } fields [ field ] = value ; stamp [ field ] = INTERNALLY_SET ; |
public class RandomVariableAAD { /** * / * ( non - Javadoc )
* @ see net . finmath . stochastic . RandomVariable # mult ( net . finmath . stochastic . RandomVariable ) */
@ Override public RandomVariable mult ( RandomVariable randomVariable ) { } } | return apply ( OperatorType . MULT , new RandomVariable [ ] { this , randomVariable } ) ; |
public class CommerceShippingFixedOptionRelServiceBaseImpl { /** * Returns the commerce shipping fixed option remote service .
* @ return the commerce shipping fixed option remote service */
public com . liferay . commerce . shipping . engine . fixed . service . CommerceShippingFixedOptionService getCommerceShippingFixedOptionService ( ) { } } | return commerceShippingFixedOptionService ; |
public class AliasStrings { /** * Creates a var declaration for each aliased string . Var declarations are
* inserted as close to the first use of the string as possible . */
private void addAliasDeclarationNodes ( ) { } } | for ( Entry < String , StringInfo > entry : stringInfoMap . entrySet ( ) ) { StringInfo info = entry . getValue ( ) ; if ( ! info . isAliased ) { continue ; } String alias = info . getVariableName ( entry . getKey ( ) ) ; Node var = IR . var ( IR . name ( alias ) , IR . string ( entry . getKey ( ) ) ) ; var . useSourceInfoFromForTree ( info . parentForNewVarDecl ) ; if ( info . siblingToInsertVarDeclBefore == null ) { info . parentForNewVarDecl . addChildToFront ( var ) ; } else { info . parentForNewVarDecl . addChildBefore ( var , info . siblingToInsertVarDeclBefore ) ; } compiler . reportChangeToEnclosingScope ( var ) ; } |
public class SynthesizeSpeechRequest { /** * The type of speech marks returned for the input text .
* @ param speechMarkTypes
* The type of speech marks returned for the input text .
* @ see SpeechMarkType */
public void setSpeechMarkTypes ( java . util . Collection < String > speechMarkTypes ) { } } | if ( speechMarkTypes == null ) { this . speechMarkTypes = null ; return ; } this . speechMarkTypes = new java . util . ArrayList < String > ( speechMarkTypes ) ; |
public class DeleteThingTypeRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteThingTypeRequest deleteThingTypeRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteThingTypeRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteThingTypeRequest . getThingTypeName ( ) , THINGTYPENAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SSLUtils { /** * Copy all the contents of the source buffer into the destination buffer . The contents
* copied from the source buffer will be from its position . The data will be
* copied into the destination buffer starting at its current position .
* @ param src
* @ param dst
* @ param length */
public static void copyBuffer ( WsByteBuffer src , WsByteBuffer dst , int length ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "copyBuffer: length=" + length + "\r\n\tsrc: " + getBufferTraceInfo ( src ) + "\r\n\tdst: " + getBufferTraceInfo ( dst ) ) ; } // Double check that there is enough space in the dst buffer .
if ( ( dst . remaining ( ) < length ) || ( src . remaining ( ) < length ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "copyBuffer: Not enough space" ) ; } RuntimeException e = new RuntimeException ( "Attempt to copy source buffer to inadequate destination buffer" ) ; FFDCFilter . processException ( e , CLASS_NAME , "762" , src ) ; throw e ; } // If the input buffer has a backing array , a copy will be more efficient .
if ( src . hasArray ( ) ) { int newSrcPosition = src . position ( ) + length ; // This buffer has a backing array . Copy the byte array in bulk .
dst . put ( src . array ( ) , src . arrayOffset ( ) + src . position ( ) , length ) ; // Advance position of src to show data has been read .
src . position ( newSrcPosition ) ; } else { // No backing array . Pull the data into a byte array .
byte srcByteArray [ ] = new byte [ length ] ; src . get ( srcByteArray , 0 , length ) ; // Copy the data into the dst buffer with a single put .
dst . put ( srcByteArray ) ; } |
public class Scheduler { /** * Submit the metrics .
* @ param metricsRecord Where the metrics will be submitted */
public void submitMetrics ( MetricsRecord metricsRecord ) { } } | List < PoolMetadata > poolMetadatas = getPoolMetadataList ( ) ; PoolFairnessCalculator . calculateFairness ( poolMetadatas , metricsRecord ) ; for ( SchedulerForType scheduler : schedulersForTypes . values ( ) ) { scheduler . submitMetrics ( ) ; } |
public class Tools { /** * Decompress ZLIB ( RFC 1950 ) compressed data
* @ param compressedData A byte array containing the ZLIB - compressed data .
* @ param maxBytes The maximum number of uncompressed bytes to read .
* @ return A string containing the decompressed data */
public static String decompressZlib ( byte [ ] compressedData , long maxBytes ) throws IOException { } } | try ( final ByteArrayInputStream dataStream = new ByteArrayInputStream ( compressedData ) ; final InflaterInputStream in = new InflaterInputStream ( dataStream ) ; final InputStream limited = ByteStreams . limit ( in , maxBytes ) ) { return new String ( ByteStreams . toByteArray ( limited ) , StandardCharsets . UTF_8 ) ; } |
public class ServerConfiguration { /** * Gets the value for the given key in the { @ link Properties } ; if this key is not found , a
* RuntimeException is thrown .
* @ param key the key to get the value for
* @ param options options for getting configuration value
* @ return the value for the given key */
public static String get ( PropertyKey key , ConfigurationValueOptions options ) { } } | return sConf . get ( key , options ) ; |
public class JacksonJsonNode { /** * fetch correct array index if index is less than 0
* ArrayNode will convert all negative integers into 0 . . .
* @ param index wanted index
* @ return { @ link Integer } new index */
protected Integer getCorrectIndex ( Integer index ) { } } | Integer size = jsonNode . size ( ) ; Integer newIndex = index ; // reverse walking through the array
if ( index < 0 ) { newIndex = size + index ; } // the negative index would be greater than the size a second time !
if ( newIndex < 0 ) { throw LOG . indexOutOfBounds ( index , size ) ; } // the index is greater as the actual size
if ( index > size ) { throw LOG . indexOutOfBounds ( index , size ) ; } return newIndex ; |
public class TimeRangeMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TimeRange timeRange , ProtocolMarshaller protocolMarshaller ) { } } | if ( timeRange == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( timeRange . getFromInclusive ( ) , FROMINCLUSIVE_BINDING ) ; protocolMarshaller . marshall ( timeRange . getToExclusive ( ) , TOEXCLUSIVE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Client { /** * Closes this { @ link Client } ' s backing { @ link AsynchronousSocketChannel } after flushing any queued packets .
* < br > < br >
* Any registered pre - disconnect listeners are fired before remaining packets are flushed , and registered
* post - disconnect listeners are fired after the backing channel has closed successfully .
* < br > < br >
* Listeners are fired in the same order that they were registered in . */
@ Override public final void close ( ) { } } | preDisconnectListeners . forEach ( Runnable :: run ) ; flush ( ) ; while ( writing . get ( ) ) { Thread . onSpinWait ( ) ; } Channeled . super . close ( ) ; if ( executor != null ) { executor . shutdownNow ( ) ; } while ( channel . isOpen ( ) ) { Thread . onSpinWait ( ) ; } if ( server != null ) { server . connectedClients . remove ( this ) ; } postDisconnectListeners . forEach ( Runnable :: run ) ; |
public class XPathContext { /** * Moves from the current node to the given attribute . */
public void navigateToAttribute ( QName attribute ) { } } | path . addLast ( path . getLast ( ) . attributes . get ( attribute ) ) ; |
public class JFapAddress { /** * Retrieve the address of the local NIC to bind to .
* @ see TCPConnectRequestContext # getLocalAddress ( ) */
public InetSocketAddress getLocalAddress ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getLocalAddress" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getLocalAddress" , "rc=" + null ) ; return null ; |
public class AbstractManagedType { /** * ( non - Javadoc )
* @ see
* javax . persistence . metamodel . ManagedType # getSingularAttribute ( java . lang
* . String ) */
@ Override public SingularAttribute < ? super X , ? > getSingularAttribute ( String paramString ) { } } | SingularAttribute < ? super X , ? > attribute = getSingularAttribute ( paramString , true ) ; return attribute ; |
public class CmsToolbarClipboardMenu { /** * Enables the favorite list editing . < p > */
public void enableFavoritesEdit ( ) { } } | m_isEditingFavorites = true ; getHandler ( ) . enableFavoriteEditing ( true , m_dndController ) ; Iterator < Widget > it = m_favorites . iterator ( ) ; while ( it . hasNext ( ) ) { CmsMenuListItem element = ( CmsMenuListItem ) it . next ( ) ; element . hideEditButton ( ) ; element . showRemoveButton ( ) ; } |
public class InmemQueue { /** * { @ inheritDoc } */
@ Override public void finish ( IQueueMessage < ID , DATA > msg ) { } } | if ( ! isEphemeralDisabled ( ) ) { ephemeralStorage . remove ( msg . getId ( ) ) ; } |
public class SshConnector { /** * Create a new connection to an SSH server over the specified transport .
* This method reads the remote servers identification and determines which
* protocol support is required . An { @ link SshClient } instance is then
* created , initialized and returned . If both protocol versions are
* supported by the remote server the connector will always operate using
* SSH2.
* The { @ link SshTransport } interface is used here to allow different types
* of transport mechanisms . Typically this would be a Socket however since
* this API is targeted at all Java platforms a Socket cannot be used
* directly . See the { @ link SshTransport } documentation for an example
* Socket implementation .
* @ param transport
* the transport for the connection .
* @ param username
* the name of the user connecting
* @ return a connected < a href = " SshClient . html " > SshClient < / a > instance ready
* for authentication .
* @ see com . sshtools . ssh2 . Ssh2Client
* @ throws SshException */
public Ssh2Client connect ( SshTransport transport , String username ) throws SshException { } } | return connect ( transport , username , false , null ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.