signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Chunk { /** * Gets the width of the Chunk in points .
* @ return a width in points */
public float getWidthPoint ( ) { } } | if ( getImage ( ) != null ) { return getImage ( ) . getScaledWidth ( ) ; } return font . getCalculatedBaseFont ( true ) . getWidthPoint ( getContent ( ) , font . getCalculatedSize ( ) ) * getHorizontalScaling ( ) ; |
public class MelcoePDPImpl { /** * ( non - Javadoc )
* @ see org . fcrepo . server . security . xacml . pdp . MelcoePDP # evaluate ( java . lang . String ) */
@ Override public String evaluate ( String request ) throws EvaluationException { } } | logger . debug ( "evaluating request: {}" , request ) ; RequestCtx req = null ; ByteArrayInputStream is = new ByteArrayInputStream ( request . getBytes ( ) ) ; try { req = BasicRequestCtx . getInstance ( is ) ; } catch ( ParsingException pe ) { logger . error ( "Error parsing request:\n" + request , pe ) ; throw new EvaluationException ( "Error parsing request:\n" + request ) ; } ResponseCtx res = evaluate ( req ) ; ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; res . encode ( os , new Indenter ( ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "response is: {}" , os . toString ( ) ) ; } return os . toString ( ) ; |
public class CommerceWarehouseUtil { /** * Returns the last commerce warehouse in the ordered set where groupId = & # 63 ; .
* @ param groupId the group ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce warehouse , or < code > null < / code > if a matching commerce warehouse could not be found */
public static CommerceWarehouse fetchByGroupId_Last ( long groupId , OrderByComparator < CommerceWarehouse > orderByComparator ) { } } | return getPersistence ( ) . fetchByGroupId_Last ( groupId , orderByComparator ) ; |
public class RegularExpression { /** * Checks whether the < var > target < / var > text < strong > contains < / strong > this
* pattern in specified range or not .
* @ param start
* Start offset of the range .
* @ param end
* End offset + 1 of the range .
* @ return true if the target is matched to this regular expression . */
public boolean matches ( String target , int start , int end ) { } } | return this . matches ( target , start , end , ( Match ) null ) ; |
public class CPFriendlyURLEntryUtil { /** * Removes the cp friendly url entry where uuid = & # 63 ; and groupId = & # 63 ; from the database .
* @ param uuid the uuid
* @ param groupId the group ID
* @ return the cp friendly url entry that was removed */
public static CPFriendlyURLEntry removeByUUID_G ( String uuid , long groupId ) throws com . liferay . commerce . product . exception . NoSuchCPFriendlyURLEntryException { } } | return getPersistence ( ) . removeByUUID_G ( uuid , groupId ) ; |
public class VoiceApi { /** * Transfer a call in a single step
* Perform a single - step transfer to the specified destination .
* @ param id The connection ID of the call to transfer . ( required )
* @ param singleStepTransferData ( required )
* @ return ApiResponse & lt ; ApiSuccessResponse & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < ApiSuccessResponse > singleStepTransferWithHttpInfo ( String id , SingleStepTransferData singleStepTransferData ) throws ApiException { } } | com . squareup . okhttp . Call call = singleStepTransferValidateBeforeCall ( id , singleStepTransferData , null , null ) ; Type localVarReturnType = new TypeToken < ApiSuccessResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class PoolableObjects { /** * Finds an available Poolable Object to borrow
* @ return Poolable Object or null if we couldn ' t allocate */
public PoolableObject < V > getFree ( ) { } } | if ( ! borrowed . isEmpty ( ) ) { for ( PoolableObject < V > bo : borrowed ) { if ( bo . isCurrentOwner ( ) ) return bo ; } } if ( ! available . isEmpty ( ) ) { PoolableObject < V > obj = available . remove ( ) ; borrowed . add ( obj ) ; return obj ; } return null ; |
public class CommandLine { /** * Sets whether the parser should stop interpreting options and positional parameters as soon as it encounters an
* unmatched option . Unmatched options are arguments that look like an option but are not one of the known options , or
* positional arguments for which there is no available slots ( the command has no positional parameters or their size is limited ) .
* The default is { @ code false } .
* < p > Setting this flag to { @ code true } automatically sets the { @ linkplain # setUnmatchedArgumentsAllowed ( boolean ) unmatchedArgumentsAllowed } flag to { @ code true } also . < / p >
* < p > The specified setting will be registered with this { @ code CommandLine } and the full hierarchy of its
* subcommands and nested sub - subcommands < em > at the moment this method is called < / em > . Subcommands added
* later will have the default setting . To ensure a setting is applied to all
* subcommands , call the setter last , after adding subcommands . < / p >
* @ param newValue { @ code true } when an unmatched option should result in the remaining command line arguments to be added to the
* { @ linkplain # getUnmatchedArguments ( ) unmatchedArguments list }
* @ return this { @ code CommandLine } object , to allow method chaining
* @ since 2.3 */
public CommandLine setStopAtUnmatched ( boolean newValue ) { } } | getCommandSpec ( ) . parser ( ) . stopAtUnmatched ( newValue ) ; for ( CommandLine command : getCommandSpec ( ) . subcommands ( ) . values ( ) ) { command . setStopAtUnmatched ( newValue ) ; } if ( newValue ) { setUnmatchedArgumentsAllowed ( true ) ; } return this ; |
public class GetBlacklistReportsResult { /** * An object that contains information about a blacklist that one of your dedicated IP addresses appears on .
* @ return An object that contains information about a blacklist that one of your dedicated IP addresses appears on . */
public java . util . Map < String , java . util . List < BlacklistEntry > > getBlacklistReport ( ) { } } | return blacklistReport ; |
public class CitrusRemoteApplication { /** * Find reports folder based in unit testing framework present on classpath .
* @ return */
private String getJUnitReportsFolder ( ) { } } | if ( ClassUtils . isPresent ( "org.testng.annotations.Test" , getClass ( ) . getClassLoader ( ) ) ) { return "test-output" + File . separator + "junitreports" ; } else if ( ClassUtils . isPresent ( "org.junit.Test" , getClass ( ) . getClassLoader ( ) ) ) { JUnitReporter jUnitReporter = new JUnitReporter ( ) ; return jUnitReporter . getReportDirectory ( ) + File . separator + jUnitReporter . getOutputDirectory ( ) ; } else { return new LoggingReporter ( ) . getReportDirectory ( ) ; } |
public class mps_ssl_certkey { /** * < pre >
* Use this operation to get certificate on Management Service .
* < / pre > */
public static mps_ssl_certkey [ ] get ( nitro_service client ) throws Exception { } } | mps_ssl_certkey resource = new mps_ssl_certkey ( ) ; resource . validate ( "get" ) ; return ( mps_ssl_certkey [ ] ) resource . get_resources ( client ) ; |
public class CookieHelper { /** * Retrieve the value of the first instance of the specified Cookie name
* from the array of Cookies . Note name matching ignores case .
* @ param cookies array of Cookie objects , may be { @ code null } .
* @ param cookieName the name of the cookie
* @ return String value associated with the specified cookieName , { @ code null } if no match could not be found . */
@ Sensitive public static String getCookieValue ( Cookie [ ] cookies , String cookieName ) { } } | if ( cookies == null ) { return null ; } String retVal = null ; for ( int i = 0 ; i < cookies . length ; ++ i ) { if ( cookieName . equalsIgnoreCase ( cookies [ i ] . getName ( ) ) ) { retVal = cookies [ i ] . getValue ( ) ; break ; } } return retVal ; |
public class ElasticsearchClusterRunner { /** * Return a node by the name .
* @ param name A node name
* @ return null if the node is not found by the name */
public Node getNode ( final String name ) { } } | if ( name == null ) { return null ; } for ( final Node node : nodeList ) { if ( name . equals ( node . settings ( ) . get ( NODE_NAME ) ) ) { return node ; } } return null ; |
public class ClassFileImporter { /** * Delegates to { @ link # importClasses ( Collection ) } */
@ PublicAPI ( usage = ACCESS ) public JavaClasses importClasses ( Class < ? > ... classes ) { } } | return importClasses ( Arrays . asList ( classes ) ) ; |
public class TermPrefixCursor { /** * Appends the separator char ( if not the first ) plus the given word to the prefix buffer ,
* then seeks to it . If the seek fails , false is returned and this cursor
* can be re - used as if in a new state . The { @ code word } BytesRef is considered temporary ,
* and is not saved within this class . */
boolean advance ( BytesRef word ) throws IOException { } } | if ( prefixBuf == null ) { // first advance
// set prefixBuf to word temporary . When advance ( ) completes , we either null out or copy .
prefixBuf = word ; prefixBufOnLoan = true ; if ( seekPrefix ( ) ) { // . . . and we have to
ensureBufIsACopy ( ) ; return true ; } else { prefixBuf = null ; // just to be darned sure ' word ' isn ' t referenced here
return false ; } } else { // subsequent advance
// append to existing
assert ! prefixBufOnLoan ; prefixBufBuilder . append ( SEPARATOR_CHAR ) ; prefixBufBuilder . append ( word ) ; prefixBuf = prefixBufBuilder . get ( ) ; if ( seekPrefix ( ) ) { return true ; } else { prefixBuf = null ; return false ; } } |
public class DataInput { /** * { @ inheritDoc } */
@ Override public String readUTFBytes ( int length ) { } } | int limit = buffer . limit ( ) ; final ByteBuffer strBuf = buffer . buf ( ) ; strBuf . limit ( strBuf . position ( ) + length ) ; final String string = AMF . CHARSET . decode ( strBuf ) . toString ( ) ; buffer . limit ( limit ) ; // Reset the limit
return string ; |
public class GeneralNonBlockingStepExecution { /** * If the computation is going synchronously , try to cancel that . */
@ Override public void stop ( Throwable cause ) throws Exception { } } | stopping = true ; if ( task != null ) { task . cancel ( true ) ; } super . stop ( cause ) ; |
public class AbstractIoService { /** * { @ inheritDoc } */
public final void setHandler ( IoHandler handler ) { } } | if ( handler == null ) { throw new NullPointerException ( "handler cannot be null" ) ; } if ( isActive ( ) ) { throw new IllegalStateException ( "handler cannot be set while the service is active." ) ; } this . handler = handler ; |
public class Distribution { /** * Contribution to numerator for initial value computation
* @ param w weight
* @ param o offset
* @ param y response
* @ return weighted contribution to numerator */
public double initFNum ( double w , double o , double y ) { } } | switch ( distribution ) { case AUTO : case gaussian : case bernoulli : case quasibinomial : case multinomial : return w * ( y - o ) ; case poisson : return w * y ; case gamma : return w * y * linkInv ( - o ) ; case tweedie : return w * y * exp ( o * ( 1 - tweediePower ) ) ; case modified_huber : return y == 1 ? w : 0 ; default : throw H2O . unimpl ( ) ; } |
public class MvpQueuingBasePresenter { /** * { @ inheritDoc } */
@ Override public void attachView ( @ NonNull V view ) { } } | presenterDestroyed = false ; viewRef = new WeakReference < V > ( view ) ; runQueuedActions ( ) ; |
public class PusherInternal { /** * - ( void ) maybeCreateRemoteDB in CBL _ Replicator . m */
@ Override @ InterfaceAudience . Private protected void maybeCreateRemoteDB ( ) { } } | if ( ! createTarget ) { return ; } creatingTarget = true ; Log . v ( TAG , "Remote db might not exist; creating it..." ) ; Future future = sendAsyncRequest ( "PUT" , "" , null , new RemoteRequestCompletion ( ) { @ Override public void onCompletion ( RemoteRequest remoteRequest , Response httpResponse , Object result , Throwable e ) { creatingTarget = false ; if ( e != null && e instanceof RemoteRequestResponseException && ( ( RemoteRequestResponseException ) e ) . getCode ( ) != 412 ) { Log . e ( TAG , this + ": Failed to create remote db" , e ) ; setError ( e ) ; triggerStopGraceful ( ) ; // this is fatal : no db to push to !
} else { Log . v ( TAG , "%s: Created remote db" , this ) ; createTarget = false ; beginReplicating ( ) ; } } } ) ; pendingFutures . add ( future ) ; |
public class ShortComparisonExtensions { /** * The number comparison operator . This is equivalent to the Java
* { @ code compareTo } function on numbers . This function is null - safe .
* @ param left a number
* @ param right a number .
* @ return the value { @ code 0 } if { @ code left = = right } ;
* a value less than { @ code 0 } if { @ code left < right } ; and
* a value greater than { @ code 0 } if { @ code left > right } . */
@ Pure @ Inline ( value = "$3.compare($1.shortValue(), $2)" , constantExpression = true , imported = Short . class ) public static int operator_spaceship ( Short left , byte right ) { } } | return Short . compare ( left . shortValue ( ) , right ) ; |
public class SelectionImpl { /** * Actions *
* Actions change the state of this control . They typically cause a *
* change of one or more observables and / or produce an event . * */
@ Override public void selectRange ( int startParagraphIndex , int startColPosition , int endParagraphIndex , int endColPosition ) { } } | selectRange ( textPosition ( startParagraphIndex , startColPosition ) , textPosition ( endParagraphIndex , endColPosition ) ) ; |
public class DocServiceBuilder { /** * Adds the example { @ link HttpHeaders } for the method with the specified service and method name . */
public DocServiceBuilder exampleHttpHeaders ( String serviceName , String methodName , Iterable < ? extends HttpHeaders > exampleHttpHeaders ) { } } | requireNonNull ( serviceName , "serviceName" ) ; checkArgument ( ! serviceName . isEmpty ( ) , "serviceName is empty." ) ; requireNonNull ( methodName , "methodName" ) ; checkArgument ( ! methodName . isEmpty ( ) , "methodName is empty." ) ; requireNonNull ( exampleHttpHeaders , "exampleHttpHeaders" ) ; return exampleHttpHeaders0 ( serviceName , methodName , exampleHttpHeaders ) ; |
public class BeatGridFinder { /** * We have received an update that invalidates the beat grid for a player , so clear it and alert
* any listeners if this represents a change . This does not affect the hot cues ; they will stick around until the
* player loads a new track that overwrites one or more of them .
* @ param update the update which means we have no beat grid for the associated player */
private void clearDeck ( TrackMetadataUpdate update ) { } } | if ( hotCache . remove ( DeckReference . getDeckReference ( update . player , 0 ) ) != null ) { deliverBeatGridUpdate ( update . player , null ) ; } |
public class CommerceDiscountRuleServiceBaseImpl { /** * Sets the commerce discount rel remote service .
* @ param commerceDiscountRelService the commerce discount rel remote service */
public void setCommerceDiscountRelService ( com . liferay . commerce . discount . service . CommerceDiscountRelService commerceDiscountRelService ) { } } | this . commerceDiscountRelService = commerceDiscountRelService ; |
public class ManagedPropertyPersistenceHelper { /** * generates code to manage field serialization .
* @ param context the context
* @ param persistType the persist type
* @ param property the property
* @ param modifiers the modifiers */
public static void generateFieldSerialize ( BindTypeContext context , PersistType persistType , BindProperty property , Modifier ... modifiers ) { } } | Converter < String , String > format = CaseFormat . LOWER_CAMEL . converterTo ( CaseFormat . UPPER_CAMEL ) ; String methodName = "serialize" + format . convert ( property . getName ( ) ) ; MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( methodName ) . addJavadoc ( "for attribute $L serialization\n" , property . getName ( ) ) . addParameter ( ParameterSpec . builder ( typeName ( property . getElement ( ) ) , "value" ) . build ( ) ) . addModifiers ( modifiers ) ; switch ( persistType ) { case STRING : methodBuilder . returns ( className ( String . class ) ) ; break ; case BYTE : methodBuilder . returns ( TypeUtility . arrayTypeName ( Byte . TYPE ) ) ; break ; } // if property type is byte [ ] , return directly the value
if ( ArrayTypeName . of ( Byte . TYPE ) . equals ( property . getPropertyType ( ) . getTypeName ( ) ) && persistType == PersistType . BYTE ) { methodBuilder . addStatement ( "return value" ) ; } else { methodBuilder . beginControlFlow ( "if (value==null)" ) ; methodBuilder . addStatement ( "return null" ) ; methodBuilder . endControlFlow ( ) ; methodBuilder . addStatement ( "$T context=$T.jsonBind()" , KriptonJsonContext . class , KriptonBinder . class ) ; methodBuilder . beginControlFlow ( "try ($T stream=new $T(); $T wrapper=context.createSerializer(stream))" , KriptonByteArrayOutputStream . class , KriptonByteArrayOutputStream . class , JacksonWrapperSerializer . class ) ; methodBuilder . addStatement ( "$T jacksonSerializer=wrapper.jacksonGenerator" , JsonGenerator . class ) ; if ( ! property . isBindedObject ( ) ) { methodBuilder . addStatement ( "jacksonSerializer.writeStartObject()" ) ; } methodBuilder . addStatement ( "int fieldCount=0" ) ; BindTransform bindTransform = BindTransformer . lookup ( property ) ; String serializerName = "jacksonSerializer" ; bindTransform . generateSerializeOnJackson ( context , methodBuilder , serializerName , null , "value" , property ) ; if ( ! property . isBindedObject ( ) ) { methodBuilder . addStatement ( "jacksonSerializer.writeEndObject()" ) ; } methodBuilder . addStatement ( "jacksonSerializer.flush()" ) ; switch ( persistType ) { case STRING : methodBuilder . addStatement ( "return stream.toString()" ) ; break ; case BYTE : methodBuilder . addStatement ( "return stream.toByteArray()" ) ; break ; } methodBuilder . nextControlFlow ( "catch($T e)" , Exception . class ) ; methodBuilder . addStatement ( "throw(new $T(e.getMessage()))" , KriptonRuntimeException . class ) ; methodBuilder . endControlFlow ( ) ; } context . builder . addMethod ( methodBuilder . build ( ) ) ; |
public class H2FileConnector { /** * Compact the database by exporting everything , resetting the DB and
* importing it again . Before compacting process is started , < b > the data
* source is closed < / b > ! ! !
* @ param bDeleteTemporarySQLFile
* if < code > true < / code > the temporary file ( h2temp . sql ) is deleted
* after successful compacting .
* @ return { @ link ESuccess # SUCCESS } if everything went well ,
* < code > false < / code > if an error occurred . In case of an error , see
* the log file . */
@ Nonnull public ESuccess compactDatabase ( final boolean bDeleteTemporarySQLFile ) { } } | return getLock ( ) . locked ( ( ) -> { // Close DB
close ( ) ; // Set temporary file name
final String sScriptFileName = "h2dump$$.sql" ; final File aScriptFileName = new File ( sScriptFileName ) ; try { if ( dumpDatabase ( aScriptFileName ) . isSuccess ( ) ) { // Delete all DB files
DeleteDbFiles . execute ( m_sDirectory , m_sDBName , true ) ; // And re - execute the stuff from the file
RunScript . execute ( getConnectionUrl ( ) , m_sUser , m_sPassword , sScriptFileName , null , false ) ; // And delete temporary file
if ( bDeleteTemporarySQLFile && FileOperations . deleteFile ( aScriptFileName ) . isFailure ( ) ) LOGGER . error ( "Failed to delete temporary export file '" + sScriptFileName + "'" ) ; return ESuccess . SUCCESS ; } } catch ( final SQLException ex ) { // Oops , we lost our data - > save file to avoid overwriting with another
// compact call
String sUniqueFileName = "h2dump-" + Clock . systemUTC ( ) . millis ( ) + ".sql" ; if ( FileOperations . renameFile ( aScriptFileName , new File ( sUniqueFileName ) ) . isFailure ( ) ) sUniqueFileName = sScriptFileName ; LOGGER . error ( "Failed to delete and refill database. Data is contained in file '" + sUniqueFileName + "'!" , ex ) ; } return ESuccess . FAILURE ; } ) ; |
public class Messenger { /** * Edit current user ' s about
* @ param newAbout new user ' s about
* @ return Command for execution */
@ Nullable @ ObjectiveCName ( "editMyAboutCommandWithNick:" ) public Command < Boolean > editMyAbout ( final String newAbout ) { } } | return callback -> modules . getUsersModule ( ) . editAbout ( newAbout ) . then ( v -> callback . onResult ( true ) ) . failure ( e -> callback . onError ( e ) ) ; |
public class Fetcher { /** * Submit a fetch task if remainingBytes is smaller than prefetchTriggerBytes . */
private void fetchIfNeeded ( long remainingBytes ) { } } | if ( ( fetchFutures . isEmpty ( ) || fetchFutures . peekLast ( ) . isDone ( ) ) && remainingBytes <= prefetchConfig . getPrefetchTriggerBytes ( ) ) { Future < Void > fetchFuture = fetchExecutor . submit ( ( ) -> { fetch ( ) ; return null ; } ) ; fetchFutures . add ( fetchFuture ) ; } |
public class Delivery { /** * Show / Create a Support DialogFragment on the provided Support FragmentTransaction with
* the given tag
* @ see android . support . v4 . app . DialogFragment # show ( android . support . v4 . app . FragmentTransaction , String )
* @ param transaction the support fragment transaction to display the dialog with
* @ param tag the tag to identify the dialog fragment in the manager */
public void show ( android . support . v4 . app . FragmentTransaction transaction , String tag ) { } } | mActiveSupportMail = generateSupportDialogFragment ( ) ; mActiveSupportMail . show ( transaction , tag ) ; |
public class PresentsDObjectMgr { /** * Runs the dobjmgr event loop until it is requested to exit . This should be called from the
* main application thread . */
public void run ( ) { } } | log . info ( "DOMGR running." ) ; // make a note of the thread that ' s processing events
synchronized ( this ) { _dobjThread = Thread . currentThread ( ) ; } while ( isRunning ( ) ) { // pop the next unit off the queue and process it
processUnit ( _evqueue . get ( ) ) ; } log . info ( "DOMGR exited." ) ; |
public class CodeGenBase { /** * Notifies the { @ link # irObserver } when the initial version of the IR has been constructed . This method allows the
* { @ link # irObserver } to modify the initial version of the IR .
* @ param ast
* The initial version of the IR .
* @ return A possibly modified version of the initial IR . */
public List < IRStatus < PIR > > initialIrEvent ( List < IRStatus < PIR > > ast ) { } } | if ( irObserver != null ) { return irObserver . initialIRConstructed ( ast , getInfo ( ) ) ; } return ast ; |
public class CPInstanceUtil { /** * Removes the cp instance where companyId = & # 63 ; and externalReferenceCode = & # 63 ; from the database .
* @ param companyId the company ID
* @ param externalReferenceCode the external reference code
* @ return the cp instance that was removed */
public static CPInstance removeByC_ERC ( long companyId , String externalReferenceCode ) throws com . liferay . commerce . product . exception . NoSuchCPInstanceException { } } | return getPersistence ( ) . removeByC_ERC ( companyId , externalReferenceCode ) ; |
public class ByteUtils { /** * This function converts a big integer into its corresponding byte format and inserts
* it into the specified buffer at the specified index .
* @ param integer The big integer to be converted .
* @ param buffer The byte array .
* @ param index The index in the array to begin inserting bytes .
* @ return The number of bytes inserted . */
static public int bigIntegerToBytes ( BigInteger integer , byte [ ] buffer , int index ) { } } | int length = 4 + ( integer . bitLength ( ) + 8 ) / 8 ; System . arraycopy ( intToBytes ( length ) , 0 , buffer , index , 4 ) ; // copy in the length
index += 4 ; System . arraycopy ( integer . toByteArray ( ) , 0 , buffer , index , length - 4 ) ; // copy in the big integer
return length ; |
public class InstanceProfile { /** * The role associated with the instance profile .
* @ return The role associated with the instance profile . */
public java . util . List < Role > getRoles ( ) { } } | if ( roles == null ) { roles = new com . amazonaws . internal . SdkInternalList < Role > ( ) ; } return roles ; |
public class FsPermission { /** * Create an immutable { @ link FsPermission } object . */
public static FsPermission createImmutable ( short permission ) { } } | return new FsPermission ( permission ) { public FsPermission applyUMask ( FsPermission umask ) { throw new UnsupportedOperationException ( ) ; } public void readFields ( DataInput in ) throws IOException { throw new UnsupportedOperationException ( ) ; } } ; |
public class GeopaparazziDatabaseProperties { /** * Update a style definition .
* @ param database the db to use .
* @ param style the { @ link Style } to set .
* @ throws Exception if something goes wrong . */
public static void updateStyle ( ASpatialDb database , Style style ) throws Exception { } } | StringBuilder sbIn = new StringBuilder ( ) ; sbIn . append ( "update " ) . append ( PROPERTIESTABLE ) ; sbIn . append ( " set " ) ; // sbIn . append ( NAME ) . append ( " = ' " ) . append ( style . name ) . append ( " ' , " ) ;
sbIn . append ( SIZE ) . append ( "=?," ) ; sbIn . append ( FILLCOLOR ) . append ( "=?," ) ; sbIn . append ( STROKECOLOR ) . append ( "=?," ) ; sbIn . append ( FILLALPHA ) . append ( "=?," ) ; sbIn . append ( STROKEALPHA ) . append ( "=?," ) ; sbIn . append ( SHAPE ) . append ( "=?," ) ; sbIn . append ( WIDTH ) . append ( "=?," ) ; sbIn . append ( LABELSIZE ) . append ( "=?," ) ; sbIn . append ( LABELFIELD ) . append ( "=?," ) ; sbIn . append ( LABELVISIBLE ) . append ( "=?," ) ; sbIn . append ( ENABLED ) . append ( "=?," ) ; sbIn . append ( ORDER ) . append ( "=?," ) ; sbIn . append ( DASH ) . append ( "=?," ) ; sbIn . append ( MINZOOM ) . append ( "=?," ) ; sbIn . append ( MAXZOOM ) . append ( "=?," ) ; sbIn . append ( DECIMATION ) . append ( "=?," ) ; sbIn . append ( THEME ) . append ( "=?" ) ; sbIn . append ( " where " ) ; sbIn . append ( NAME ) ; sbIn . append ( "='" ) ; sbIn . append ( style . name ) ; sbIn . append ( "';" ) ; Object [ ] objects = { style . size , style . fillcolor , style . strokecolor , style . fillalpha , style . strokealpha , style . shape , style . width , style . labelsize , style . labelfield , style . labelvisible , style . enabled , style . order , style . dashPattern , style . minZoom , style . maxZoom , style . decimationFactor , style . getTheme ( ) } ; String updateQuery = sbIn . toString ( ) ; database . executeInsertUpdateDeletePreparedSql ( updateQuery , objects ) ; |
public class ModifyDocumentPermissionRequest { /** * The AWS user accounts that should have access to the document . The account IDs can either be a group of account
* IDs or < i > All < / i > .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAccountIdsToAdd ( java . util . Collection ) } or { @ link # withAccountIdsToAdd ( java . util . Collection ) } if you
* want to override the existing values .
* @ param accountIdsToAdd
* The AWS user accounts that should have access to the document . The account IDs can either be a group of
* account IDs or < i > All < / i > .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ModifyDocumentPermissionRequest withAccountIdsToAdd ( String ... accountIdsToAdd ) { } } | if ( this . accountIdsToAdd == null ) { setAccountIdsToAdd ( new com . amazonaws . internal . SdkInternalList < String > ( accountIdsToAdd . length ) ) ; } for ( String ele : accountIdsToAdd ) { this . accountIdsToAdd . add ( ele ) ; } return this ; |
public class Sniffer { /** * Execute the { @ link Callable # call ( ) } method , record the SQL queries
* and return the { @ link Spy . SpyWithValue } object with stats
* @ param callable code to test
* @ param < V > type of return value
* @ return statistics on executed queries
* @ throws Exception if underlying code under test throws an Exception
* @ since 2.0 */
@ SuppressWarnings ( "unchecked" ) @ Deprecated public static < V > Spy . SpyWithValue < V > call ( Callable < V > callable ) throws Exception { } } | return Sniffy . call ( callable ) ; |
public class MyCustomRibbonColumn { /** * Can accept " X and " Y " text values to be printed out . */
public void configure ( String key , String value ) { } } | if ( "x" . equalsIgnoreCase ( key ) ) { xText = value ; } else if ( "y" . equalsIgnoreCase ( key ) ) { yText = value ; } |
public class SHE { /** * Initializes the cipher with key , creates a random IV to use with the cipher .
* @ param key A key to encrypt with . Key can be any length but a key longer than the block size will run more slowly .
* @ return An IV that has been created for this cipher to use . IV will be the same length as the key . */
public byte [ ] init ( byte [ ] key ) { } } | keySize = key . length ; byte [ ] iv = new byte [ keySize ] ; new SecureRandom ( ) . nextBytes ( iv ) ; init ( iv , key ) ; return iv ; |
public class TransAssistantIR { /** * FIXME make this method work on generic PMUltipleBinds */
public ABlockStmIR consComplexCompIterationBlock ( List < SMultipleBindIR > multipleSetBinds , ITempVarGen tempGen , IIterationStrategy strategy , IterationVarPrefixes iteVarPrefixes ) throws AnalysisException { } } | ABlockStmIR outerBlock = new ABlockStmIR ( ) ; ABlockStmIR nextMultiBindBlock = outerBlock ; for ( SMultipleBindIR bind : multipleSetBinds ) { if ( hasEmptySet ( bind ) ) { multipleSetBinds . clear ( ) ; return outerBlock ; } } strategy . setFirstBind ( true ) ; for ( int i = 0 ; i < multipleSetBinds . size ( ) ; i ++ ) { strategy . setLastBind ( i == multipleSetBinds . size ( ) - 1 ) ; SMultipleBindIR mb = multipleSetBinds . get ( i ) ; if ( mb instanceof ASetMultipleBindIR ) { nextMultiBindBlock = consIterationBlock ( nextMultiBindBlock , mb . getPatterns ( ) , ( ( ASetMultipleBindIR ) mb ) . getSet ( ) , tempGen , strategy , iteVarPrefixes ) ; } else if ( mb instanceof ASeqMultipleBindIR ) { nextMultiBindBlock = consIterationBlock ( nextMultiBindBlock , mb . getPatterns ( ) , ( ( ASeqMultipleBindIR ) mb ) . getSeq ( ) , tempGen , strategy , iteVarPrefixes ) ; } else { log . error ( "Expected set multiple bind or sequence multiple bind. Got: " + mb ) ; } strategy . setFirstBind ( false ) ; } return outerBlock ; |
public class FieldWriterImpl { /** * { @ inheritDoc } */
@ Override protected void addNavDetailLink ( boolean link , Content liNav ) { } } | if ( link ) { liNav . addContent ( writer . getHyperLink ( SectionName . FIELD_DETAIL , contents . navField ) ) ; } else { liNav . addContent ( contents . navField ) ; } |
public class AbstractWComponent { /** * { @ inheritDoc } */
@ Override public final void serviceRequest ( final Request request ) { } } | ArrayList < WComponent > visibles = new ArrayList < > ( ) ; collateVisible ( this , visibles ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Calling handleRequest for " + visibles . size ( ) + " components" ) ; } for ( int i = 0 ; i < visibles . size ( ) ; i ++ ) { WComponent next = visibles . get ( i ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Calling handleRequest on " + next . getId ( ) + " " + next . getClass ( ) ) ; } next . handleRequest ( request ) ; } invokeLaters ( ) ; |
public class PathTools { /** * Deletes files and folders at the specified path .
* @ param start the path
* @ param deleteStart true if the start path should also be deleted , false if only the contents should be deleted
* @ throws IOException if an I / O error occurs */
public static void deleteRecursive ( Path start , boolean deleteStart ) throws IOException { } } | Files . walkFileTree ( start , new SimpleFileVisitor < Path > ( ) { @ Override public FileVisitResult visitFile ( Path file , BasicFileAttributes attrs ) throws IOException { Files . delete ( file ) ; return FileVisitResult . CONTINUE ; } @ Override public FileVisitResult postVisitDirectory ( Path dir , IOException e ) throws IOException { if ( e == null ) { if ( deleteStart || ! Files . isSameFile ( dir , start ) ) { Files . delete ( dir ) ; } return FileVisitResult . CONTINUE ; } else { // directory iteration failed
throw e ; } } } ) ; |
public class ClassPropertyUsageAnalyzer { /** * Returns record where statistics about a class should be stored .
* @ param entityIdValue
* the class to initialize
* @ return the class record */
private ClassRecord getClassRecord ( EntityIdValue entityIdValue ) { } } | if ( ! this . classRecords . containsKey ( entityIdValue ) ) { ClassRecord classRecord = new ClassRecord ( ) ; this . classRecords . put ( entityIdValue , classRecord ) ; return classRecord ; } else { return this . classRecords . get ( entityIdValue ) ; } |
public class MessageBox { /** * Set width of all buttons in pixels .
* @ param width */
public void setButtonWidth ( int width ) { } } | btnNo . setWidth ( width + "px" ) ; btnYes . setWidth ( width + "px" ) ; btnCancel . setWidth ( width + "px" ) ; |
public class ServerConfig { /** * setParams */
static void setParam ( String name , Object value ) { } } | try { if ( value instanceof List ) { setCollectionParam ( name , ( List < ? > ) value ) ; } else if ( value instanceof String ) { setParamFromString ( name , ( String ) value ) ; } else { setScalarParam ( name , value ) ; } } catch ( ConfigurationException e ) { logger . warn ( e . getMessage ( ) + " -- Ignoring." ) ; } |
public class AbstractPlugin { /** * Check that each given field has unique value in { @ link Plugin . Data } annotation . */
private static boolean shouldHasUniqueValues ( List < Field > dataFields ) { } } | Set < String > dataValues = new HashSet < > ( ) ; for ( Field field : dataFields ) { String value = field . getAnnotation ( Plugin . Data . class ) . value ( ) ; if ( dataValues . contains ( value ) ) { return false ; } dataValues . add ( value ) ; } return true ; |
public class MapMaker { /** * Specifies a listener instance , which all maps built using this { @ code MapMaker } will notify
* each time an entry is removed from the map by any means .
* < p > Each map built by this map maker after this method is called invokes the supplied listener
* after removing an element for any reason ( see removal causes in { @ link RemovalCause } ) . It will
* invoke the listener during invocations of any of that map ' s public methods ( even read - only
* methods ) .
* < p > < b > Important note : < / b > Instead of returning < i > this < / i > as a { @ code MapMaker } instance ,
* this method returns { @ code GenericMapMaker < K , V > } . From this point on , either the original
* reference or the returned reference may be used to complete configuration and build the map ,
* but only the " generic " one is type - safe . That is , it will properly prevent you from building
* maps whose key or value types are incompatible with the types accepted by the listener already
* provided ; the { @ code MapMaker } type cannot do this . For best results , simply use the standard
* method - chaining idiom , as illustrated in the documentation at top , configuring a { @ code
* MapMaker } and building your { @ link Map } all in a single statement .
* < p > < b > Warning : < / b > if you ignore the above advice , and use this { @ code MapMaker } to build a map
* or cache whose key or value type is incompatible with the listener , you will likely experience
* a { @ link ClassCastException } at some < i > undefined < / i > point in the future .
* @ throws IllegalStateException if a removal listener was already set
* @ deprecated Caching functionality in { @ code MapMaker } has been moved to
* { @ link com . google . common . cache . CacheBuilder } , with { @ link # removalListener } being
* replaced by { @ link com . google . common . cache . CacheBuilder # removalListener } . Note that { @ code
* CacheBuilder } is simply an enhanced API for an implementation which was branched from
* { @ code MapMaker } . */
@ Deprecated @ GwtIncompatible ( "To be supported" ) < K , V > GenericMapMaker < K , V > removalListener ( RemovalListener < K , V > listener ) { } } | checkState ( this . removalListener == null ) ; // safely limiting the kinds of maps this can produce
@ SuppressWarnings ( "unchecked" ) GenericMapMaker < K , V > me = ( GenericMapMaker < K , V > ) this ; me . removalListener = checkNotNull ( listener ) ; useCustomMap = true ; return me ; |
public class ResponseParser { /** * The given InputStream must contain the xml response from an xmlrpc server .
* This method extract the content of it as an object .
* @ param response The InputStream of the server response .
* @ return The returned object .
* @ throws XMLRPCException Will be thrown whenever something fails .
* @ throws XMLRPCServerException Will be thrown , if the server returns an error . */
public Object parse ( SerializerHandler serializerHandler , InputStream response , boolean debugMode ) throws XMLRPCException { } } | try { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; Document dom = builder . parse ( response ) ; if ( debugMode ) { printDocument ( dom , System . out ) ; } Element e = dom . getDocumentElement ( ) ; // Check for root tag
if ( ! e . getNodeName ( ) . equals ( XMLRPCClient . METHOD_RESPONSE ) ) { throw new XMLRPCException ( "MethodResponse root tag is missing." ) ; } e = XMLUtil . getOnlyChildElement ( e . getChildNodes ( ) ) ; if ( e . getNodeName ( ) . equals ( XMLRPCClient . PARAMS ) ) { e = XMLUtil . getOnlyChildElement ( e . getChildNodes ( ) ) ; if ( ! e . getNodeName ( ) . equals ( XMLRPCClient . PARAM ) ) { throw new XMLRPCException ( "The params tag must contain a param tag." ) ; } return getReturnValueFromElement ( serializerHandler , e ) ; } else if ( e . getNodeName ( ) . equals ( XMLRPCClient . FAULT ) ) { @ SuppressWarnings ( "unchecked" ) Map < String , Object > o = ( Map < String , Object > ) getReturnValueFromElement ( serializerHandler , e ) ; throw new XMLRPCServerException ( ( String ) o . get ( FAULT_STRING ) , ( Integer ) o . get ( FAULT_CODE ) ) ; } throw new XMLRPCException ( "The methodResponse tag must contain a fault or params tag." ) ; } catch ( XMLRPCServerException e ) { throw e ; } catch ( Exception ex ) { throw new XMLRPCException ( "Error getting result from server." , ex ) ; } |
public class A_CmsFormFieldPanel { /** * Creates a form row . < p >
* @ param labelText the label text
* @ param description the description
* @ param widget the widget to use
* @ return the new form row */
protected CmsFormRow createRow ( String labelText , String description , Widget widget ) { } } | return createRow ( labelText , description , widget , null , false ) ; |
public class DRIDTrackerHelper { /** * Merge trackers in the additional map into the base map .
* @ param base The base map to merge trackers into .
* @ param add The additional trackers to merge . */
public static void mergeTrackers ( Map < Integer , Map < Integer , DRSiteDrIdTracker > > base , Map < Integer , Map < Integer , DRSiteDrIdTracker > > add ) { } } | for ( Map . Entry < Integer , Map < Integer , DRSiteDrIdTracker > > clusterEntry : add . entrySet ( ) ) { final Map < Integer , DRSiteDrIdTracker > baseClusterEntry = base . get ( clusterEntry . getKey ( ) ) ; if ( baseClusterEntry == null ) { base . put ( clusterEntry . getKey ( ) , clusterEntry . getValue ( ) ) ; } else { for ( Map . Entry < Integer , DRSiteDrIdTracker > partitionEntry : clusterEntry . getValue ( ) . entrySet ( ) ) { final DRConsumerDrIdTracker basePartitionTracker = baseClusterEntry . get ( partitionEntry . getKey ( ) ) ; if ( basePartitionTracker == null ) { baseClusterEntry . put ( partitionEntry . getKey ( ) , partitionEntry . getValue ( ) ) ; } else { basePartitionTracker . mergeTracker ( partitionEntry . getValue ( ) ) ; } } } } |
public class JdbcWriter { /** * Generates an insert SQL statement for the configured table and its fields .
* @ param properties
* Properties that contains the configured table and fields
* @ param quote
* Character for quoting identifiers ( can be a space if the database doesn ' t support quote characters )
* @ return SQL statement for { @ link PreparedStatement }
* @ throws SQLException
* Table or field names contain illegal characters */
private static String renderSql ( final Map < String , String > properties , final String quote ) throws SQLException { } } | StringBuilder builder = new StringBuilder ( ) ; builder . append ( "INSERT INTO " ) ; append ( builder , getTable ( properties ) , quote ) ; builder . append ( " (" ) ; int count = 0 ; for ( Entry < String , String > entry : properties . entrySet ( ) ) { String key = entry . getKey ( ) ; if ( key . toLowerCase ( Locale . ROOT ) . startsWith ( FIELD_PREFIX ) ) { String column = key . substring ( FIELD_PREFIX . length ( ) ) ; if ( count ++ != 0 ) { builder . append ( ", " ) ; } append ( builder , column , quote ) ; } } builder . append ( ") VALUES (" ) ; for ( int i = 0 ; i < count ; ++ i ) { if ( i > 0 ) { builder . append ( ", ?" ) ; } else { builder . append ( "?" ) ; } } builder . append ( ")" ) ; return builder . toString ( ) ; |
public class BaseDaoEnabled { /** * A call through to the { @ link Dao # create ( Object ) } . */
public int create ( ) throws SQLException { } } | checkForDao ( ) ; @ SuppressWarnings ( "unchecked" ) T t = ( T ) this ; return dao . create ( t ) ; |
public class DataDownloader { /** * Downloads the file from the provided url and uncompresses it to the given
* folder . */
public void downloadAndUnzip ( ) { } } | URL dataURL = null ; String fileName = folder + "/" + url . substring ( url . lastIndexOf ( "/" ) + 1 ) ; File compressedData = new File ( fileName ) ; if ( ! new File ( fileName ) . exists ( ) ) { try { dataURL = new URL ( url ) ; } catch ( MalformedURLException e ) { e . printStackTrace ( ) ; } try { assert dataURL != null ; FileUtils . copyURLToFile ( dataURL , compressedData ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } try { ZipFile zipFile = new ZipFile ( compressedData ) ; File dataFolder = new File ( folder ) ; zipFile . extractAll ( dataFolder . getCanonicalPath ( ) ) ; } catch ( ZipException | IOException e ) { e . printStackTrace ( ) ; } |
public class ApiOvhOrder { /** * Get allowed durations for ' ip ' option
* REST : GET / order / vps / { serviceName } / ip
* @ param number [ required ] Number of IPs to order
* @ param country [ required ] Choose a geolocation for your IP Address
* @ param serviceName [ required ] The internal name of your VPS offer */
public ArrayList < String > vps_serviceName_ip_GET ( String serviceName , OvhGeolocationEnum country , Long number ) throws IOException { } } | String qPath = "/order/vps/{serviceName}/ip" ; StringBuilder sb = path ( qPath , serviceName ) ; query ( sb , "country" , country ) ; query ( sb , "number" , number ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t1 ) ; |
public class NDArrayIndex { /** * Generates an interval from begin ( inclusive ) to end ( exclusive )
* @ param begin the begin
* @ param stride the stride at which to increment
* @ param end the end index
* @ param max the max length for this domain
* @ return the interval */
public static INDArrayIndex interval ( long begin , long stride , long end , long max ) { } } | if ( begin < 0 ) { begin += max ; } if ( end < 0 ) { end += max ; } if ( Math . abs ( begin - end ) < 1 ) end ++ ; if ( stride > 1 && Math . abs ( begin - end ) == 1 ) { end *= stride ; } return interval ( begin , stride , end , false ) ; |
public class SMPPSession { /** * Open connection and bind immediately .
* @ param host is the SMSC host address .
* @ param port is the SMSC listen port .
* @ param bindParam is the bind parameters .
* @ param timeout is the timeout .
* @ return the SMSC system id .
* @ throws IOException if there is an IO error found . */
public String connectAndBind ( String host , int port , BindParameter bindParam , long timeout ) throws IOException { } } | logger . debug ( "Connect and bind to {} port {}" , host , port ) ; if ( getSessionState ( ) != SessionState . CLOSED ) { throw new IOException ( "Session state is not closed" ) ; } conn = connFactory . createConnection ( host , port ) ; logger . info ( "Connected to {}" , conn . getInetAddress ( ) ) ; conn . setSoTimeout ( getEnquireLinkTimer ( ) ) ; sessionContext . open ( ) ; try { in = new DataInputStream ( conn . getInputStream ( ) ) ; out = conn . getOutputStream ( ) ; pduReaderWorker = new PDUReaderWorker ( ) ; pduReaderWorker . start ( ) ; String smscSystemId = sendBind ( bindParam . getBindType ( ) , bindParam . getSystemId ( ) , bindParam . getPassword ( ) , bindParam . getSystemType ( ) , bindParam . getInterfaceVersion ( ) , bindParam . getAddrTon ( ) , bindParam . getAddrNpi ( ) , bindParam . getAddressRange ( ) , timeout ) ; sessionContext . bound ( bindParam . getBindType ( ) ) ; enquireLinkSender = new EnquireLinkSender ( ) ; enquireLinkSender . start ( ) ; return smscSystemId ; } catch ( PDUException e ) { logger . error ( "Failed sending bind command" , e ) ; throw new IOException ( "Failed sending bind since some string parameter area invalid: " + e . getMessage ( ) , e ) ; } catch ( NegativeResponseException e ) { String message = "Receive negative bind response" ; logger . error ( message , e ) ; close ( ) ; throw new IOException ( message + ": " + e . getMessage ( ) , e ) ; } catch ( InvalidResponseException e ) { String message = "Receive invalid response of bind" ; logger . error ( message , e ) ; close ( ) ; throw new IOException ( message + ": " + e . getMessage ( ) , e ) ; } catch ( ResponseTimeoutException e ) { String message = "Waiting bind response take time too long" ; logger . error ( message , e ) ; close ( ) ; throw new IOException ( message + ": " + e . getMessage ( ) , e ) ; } catch ( IOException e ) { logger . error ( "IO error occurred" , e ) ; close ( ) ; throw e ; } |
public class ChangeRequest { /** * Returns { @ code true } if the change request has been completed . If the status is not { @ link
* ChangeRequestInfo . Status # DONE } already , the method makes an API call to Google Cloud DNS to
* update the change request first .
* @ throws DnsException upon failure of the API call or if the associated zone was not found */
public boolean isDone ( ) { } } | if ( status ( ) == Status . DONE ) { return true ; } ChangeRequest updated = reload ( Dns . ChangeRequestOption . fields ( Dns . ChangeRequestField . STATUS ) ) ; return updated == null || updated . status ( ) == Status . DONE ; |
public class SQLExpressions { /** * Add the given amount of months to the date
* @ param date datetime
* @ param months months to add
* @ return converted datetime */
public static < D extends Comparable > DateTimeExpression < D > addMonths ( DateTimeExpression < D > date , int months ) { } } | return Expressions . dateTimeOperation ( date . getType ( ) , Ops . DateTimeOps . ADD_MONTHS , date , ConstantImpl . create ( months ) ) ; |
public class AdminParserUtils { /** * Adds OPT _ Z | OPT _ ZONE option to OptionParser , with one argument .
* @ param parser OptionParser to be modified
* @ param required Tells if this option is required or optional */
public static void acceptsZone ( OptionParser parser ) { } } | parser . acceptsAll ( Arrays . asList ( OPT_Z , OPT_ZONE ) , "zone id" ) . withRequiredArg ( ) . describedAs ( "zone-id" ) . ofType ( Integer . class ) ; |
public class SDBaseOps { /** * Not equal to operation : elementwise x ! = y < br >
* If x and y arrays have equal shape , the output shape is the same as these inputs . < br >
* Note : supports broadcasting if x and y have different shapes and are broadcastable . < br >
* Returns an array with values 1 where condition is satisfied , or value 0 otherwise .
* @ param x Input 1
* @ param y Input 2
* @ return Output SDVariable with values 0 and 1 based on where the condition is satisfied */
public SDVariable neq ( SDVariable x , SDVariable y ) { } } | return neq ( null , x , y ) ; |
public class Say { /** * - - - - - WARN - - - - - */
public static void warn ( Object message ) { } } | log ( Level . WARN , message , null , ( Object [ ] ) null ) ; |
public class MessageAttributeValue { /** * Not implemented . Reserved for future use .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setBinaryListValues ( java . util . Collection ) } or { @ link # withBinaryListValues ( java . util . Collection ) } if you
* want to override the existing values .
* @ param binaryListValues
* Not implemented . Reserved for future use .
* @ return Returns a reference to this object so that method calls can be chained together . */
public MessageAttributeValue withBinaryListValues ( java . nio . ByteBuffer ... binaryListValues ) { } } | if ( this . binaryListValues == null ) { setBinaryListValues ( new com . amazonaws . internal . SdkInternalList < java . nio . ByteBuffer > ( binaryListValues . length ) ) ; } for ( java . nio . ByteBuffer ele : binaryListValues ) { this . binaryListValues . add ( ele ) ; } return this ; |
public class TcpTransporter { /** * - - - MESSAGE RECEIVED - - - */
public void received ( byte packetID , byte [ ] packet ) { } } | executor . execute ( ( ) -> { // Parse message
Tree data ; try { data = serializer . read ( packet ) ; } catch ( Exception cause ) { logger . warn ( "Unable to parse incoming message!" , cause ) ; return ; } // Send message to proper component
try { switch ( packetID ) { case PACKET_EVENT_ID : // Incoming event
if ( debug ) { logger . info ( "Event message received:\r\n" + data ) ; } eventbus . receiveEvent ( data ) ; return ; case PACKET_REQUEST_ID : // Incoming request
if ( debug ) { logger . info ( "Request message received:\r\n" + data ) ; } registry . receiveRequest ( data ) ; return ; case PACKET_RESPONSE_ID : // Incoming response
if ( debug ) { logger . info ( "Response message received:\r\n" + data ) ; } registry . receiveResponse ( data ) ; return ; case PACKET_PING_ID : // Send pong
if ( debug ) { logger . info ( "Ping message received:\r\n" + data ) ; } String sender = data . get ( "sender" , "" ) ; if ( sender == null || sender . isEmpty ( ) ) { logger . warn ( "Missing \"sender\" property:\r\n" + data ) ; return ; } data . put ( "sender" , this . nodeID ) ; data . put ( "arrived" , System . currentTimeMillis ( ) ) ; writer . send ( sender , serialize ( PACKET_PONG_ID , data ) ) ; return ; case PACKET_PONG_ID : // Pong received
if ( debug ) { logger . info ( "Pong message received:\r\n" + data ) ; } registry . receivePong ( data ) ; return ; case PACKET_GOSSIP_REQ_ID : // Incoming gossip request
processGossipRequest ( data ) ; return ; case PACKET_GOSSIP_RSP_ID : // Incoming gossip request
processGossipResponse ( data ) ; return ; case PACKET_GOSSIP_HELLO_ID : // Incoming " hello " message
processGossipHello ( data ) ; return ; default : logger . warn ( "Unsupported message ID (" + packetID + ")!" ) ; } } catch ( Exception cause ) { logger . warn ( "Unable to process incoming message!" , cause ) ; } } ) ; |
public class AsynchronousRequest { /** * For more info on Material MaterialCategory API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / materials " > here < / a > < br / >
* Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwable ) } methods for custom interactions
* @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) }
* @ throws NullPointerException if given { @ link Callback } is empty
* @ see MaterialCategory material category info */
public void getAllMaterialCategoryID ( Callback < List < Integer > > callback ) throws NullPointerException { } } | gw2API . getAllMaterialBankIDs ( ) . enqueue ( callback ) ; |
public class Person { /** * Create a new { @ code Person } object with the given parameters .
* @ param name name of person or organization
* @ param email the person ' s email address
* @ param link link to Web site or other external information about person
* @ return a new { @ code Person } object with the given parameters */
public static Person of ( final String name , final Email email , final Link link ) { } } | return new Person ( name , email , link ) ; |
public class LinnaeusSpecies { /** * setter for mostProbableSpeciesId - sets This feature contains the value of the most probable NCBI Taxonomy Id for the annotated species occurence .
* @ generated
* @ param v value to set into the feature */
public void setMostProbableSpeciesId ( String v ) { } } | if ( LinnaeusSpecies_Type . featOkTst && ( ( LinnaeusSpecies_Type ) jcasType ) . casFeat_mostProbableSpeciesId == null ) jcasType . jcas . throwFeatMissing ( "mostProbableSpeciesId" , "ch.epfl.bbp.uima.types.LinnaeusSpecies" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( LinnaeusSpecies_Type ) jcasType ) . casFeatCode_mostProbableSpeciesId , v ) ; |
public class TargetStreamControl { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . runtime . ControlAdapter # assertValidControllable ( ) */
public void assertValidControllable ( ) throws SIMPControllableNotFoundException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "assertValidControllable" ) ; if ( _targetStream == null || _streamSetID == null || _targetStreamReliability == null ) { SIMPControllableNotFoundException finalE = new SIMPControllableNotFoundException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "TargetStreamControl.assertValidControllable" , "1:228:1.32" , _streamSetID } , null ) ) ; SibTr . exception ( tc , finalE ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "assertValidControllable" , finalE ) ; throw finalE ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "assertValidControllable" ) ; |
public class AFactoryAppBeans { /** * < p > Get SessionTracker full import in lazy mode . < / p >
* @ return SessionTracker - SessionTracker
* @ throws Exception - an exception */
public final SessionTracker lazyGetSessionTracker ( ) throws Exception { } } | String beanName = getSessionTrackerName ( ) ; SessionTracker sessionTracker = ( SessionTracker ) this . beansMap . get ( beanName ) ; if ( sessionTracker == null ) { sessionTracker = new SessionTracker ( ) ; sessionTracker . setLogger ( lazyGetSecureLogger ( ) ) ; sessionTracker . setSrvI18n ( lazyGetSrvI18n ( ) ) ; lazyGetLogger ( ) . info ( null , AFactoryAppBeans . class , beanName + " has been created." ) ; this . beansMap . put ( beanName , sessionTracker ) ; } return sessionTracker ; |
public class JmxTreeBuilder { /** * Returns the matching child nodes of a ManagedObject .
* @ param nameFilter Name to filter on
* @ param objectNode The object to inspect .
* @ return the matching child nodes of objectNode . */
private Set < JmxTreeNode > getMatchingChildren ( String nameFilter , ObjectNode objectNode ) { } } | AttributesNode attributesNode = null ; OperationsNode operationsNode = null ; NotificationsNode notificationsNode = null ; Set < JmxTreeNode > objectChildren = new TreeSet < JmxTreeNode > ( ) ; for ( JmxTreeNode child : objectNode . getChildren ( ) ) { if ( child instanceof AttributesNode ) { Set < AttributeNode > attributes = getMatchingAttributes ( ( AttributesNode ) child , nameFilter ) ; if ( ! attributes . isEmpty ( ) ) { attributesNode = new AttributesNode ( ObjectNode . LABEL_ATTRIBUTES , attributes ) ; } } else if ( child instanceof OperationsNode ) { Set < OperationNode > operations = getMatchingOperations ( ( OperationsNode ) child , nameFilter ) ; if ( ! operations . isEmpty ( ) ) { operationsNode = new OperationsNode ( ObjectNode . LABEL_OPERATIONS , operations ) ; } } else if ( child instanceof NotificationsNode ) { Set < NotificationNode > notifications = getMatchingNotifications ( ( NotificationsNode ) child , nameFilter ) ; if ( ! notifications . isEmpty ( ) ) { notificationsNode = new NotificationsNode ( ObjectNode . LABEL_NOTIFICATIONS , notifications ) ; } } } if ( attributesNode != null ) { objectChildren . add ( attributesNode ) ; } if ( operationsNode != null ) { objectChildren . add ( operationsNode ) ; } if ( notificationsNode != null ) { objectChildren . add ( notificationsNode ) ; } return objectChildren ; |
public class ApacheHttp31SLRFactory { /** * / * ( non - Javadoc )
* @ see org . archive . util . binsearch . impl . HTTPSeekableLineReaderFactory # setConnectionTimeoutMS ( int ) */
@ Override public void setConnectionTimeoutMS ( int connectionTimeoutMS ) { } } | connectionManager . getParams ( ) . setConnectionTimeout ( connectionTimeoutMS ) ; http . getParams ( ) . setConnectionManagerTimeout ( connectionTimeoutMS ) ; |
public class SpringConfigProcessor { /** * Automate register and wire bean < br / >
* Reconfig beans */
public void postProcessBeanDefinitionRegistry ( BeanDefinitionRegistry definitionRegistry ) throws BeansException { } } | // 自动注册
BindRegistry registry = new SpringBindRegistry ( definitionRegistry ) ; Map < String , BeanDefinition > newDefinitions = registerModules ( registry ) ; // should register after all beans
registerBuildins ( registry ) ; // 再配置
reconfig ( definitionRegistry , registry ) ; lifecycle ( registry , definitionRegistry ) ; autowire ( newDefinitions , registry ) ; |
public class WebsocketSession { /** * Saves ( if not already saved ) by stream id a subscription of service call coming in form of
* { @ link Disposable } reference .
* @ param streamId stream id
* @ param disposable service subscription
* @ return true if disposable subscription was stored */
public boolean register ( Long streamId , Disposable disposable ) { } } | boolean result = false ; if ( ! disposable . isDisposed ( ) ) { result = subscriptions . putIfAbsent ( streamId , disposable ) == null ; } if ( result ) { LOGGER . debug ( "Registered subscription with sid={}, session={}" , streamId , id ) ; } return result ; |
public class Property_Builder { /** * Replaces the value to be returned by { @ link
* org . inferred . freebuilder . processor . property . Property # getCapitalizedName ( ) } by applying { @ code
* mapper } to it and using the result .
* @ return this { @ code Builder } object
* @ throws NullPointerException if { @ code mapper } is null or returns null
* @ throws IllegalStateException if the field has not been set */
public org . inferred . freebuilder . processor . property . Property . Builder mapCapitalizedName ( UnaryOperator < String > mapper ) { } } | Objects . requireNonNull ( mapper ) ; return setCapitalizedName ( mapper . apply ( getCapitalizedName ( ) ) ) ; |
public class JsonConverter { /** * 获取JSON响应加签内容串
* @ param request
* @ param body
* @ return */
private ResponseParseItem getJSONSignSourceData ( AlipayRequest < ? > request , String body ) { } } | String rootNode = request . getApiMethodName ( ) . replace ( '.' , '_' ) + AlipayConstants . RESPONSE_SUFFIX ; String errorRootNode = AlipayConstants . ERROR_RESPONSE ; int indexOfRootNode = body . indexOf ( rootNode ) ; int indexOfErrorRoot = body . indexOf ( errorRootNode ) ; if ( indexOfRootNode > 0 ) { return parseJSONSignSourceData ( body , rootNode , indexOfRootNode ) ; } else if ( indexOfErrorRoot > 0 ) { return parseJSONSignSourceData ( body , errorRootNode , indexOfErrorRoot ) ; } else { return null ; } |
public class BooleanCliParam { /** * Construct an optional CLI boolean parameter with the given default value .
* @ param identifier Parameter identifier .
* @ param defaultValue Default value to be used by the parameter if it isn ' t explicitly bound .
* @ param nullable Whether the parameter is nullable .
* @ return A CLI boolean parameter constructed from the given parameters . */
public static BooleanCliParam optional ( Identifier identifier , boolean defaultValue , boolean nullable ) { } } | return new BooleanCliParam ( identifier , Opt . of ( MoreSuppliers . of ( defaultValue ) ) , nullable ) ; |
public class AbstractPacket { /** * ( non - Javadoc )
* @ see io . pkts . packet . Packet # getPacket ( io . pkts . protocol . Protocol ) */
@ Override public Packet getPacket ( final Protocol p ) throws IOException , PacketParseException { } } | if ( this . protocol == p ) { return this ; } final Packet child = getNextPacket ( ) ; if ( child != null && child . getProtocol ( ) == p ) { return child ; } if ( child == null ) { return checkParent ( p ) ; } return child . getPacket ( p ) ; |
public class AgentSerializer { /** * Call getter method and get value
* @ param method structure of getter method
* @ param value object to call method
* @ return a value */
@ SuppressWarnings ( "rawtypes" ) protected Object getValue ( GetterMethodCover method , Object value ) { } } | if ( method . isByte ( ) ) { value = ( ( Byte ) value ) . intValue ( ) ; } else if ( method . isChar ( ) ) { value = ( int ) ( ( Character ) value ) . charValue ( ) ; } else if ( method . isFloat ( ) ) { value = ( ( Float ) value ) . doubleValue ( ) ; } else if ( method . isLong ( ) ) { value = ( ( Long ) value ) . doubleValue ( ) ; } else if ( method . isShort ( ) ) { value = ( ( Short ) value ) . intValue ( ) ; } else if ( method . isObject ( ) ) { value = parseObject ( method , value ) ; } else if ( method . isObjectArray ( ) ) { value = parseArray ( method , value ) ; } else if ( method . isArrayObjectCollection ( ) ) { return parseArrayObjectCollection ( method , ( Collection ) value ) ; } else if ( method . isObjectCollection ( ) ) { return parseObjectCollection ( method , ( Collection ) value ) ; } else if ( method . isArrayCollection ( ) ) { return parseArrayCollection ( method , ( Collection ) value ) ; } else if ( method . isArray ( ) || method . isColection ( ) ) { return transformSimpleValue ( value ) ; } return value ; |
public class SipPhone { /** * This method is the same as the basic blocking makeCall ( ) method except that it allows the
* caller to specify a message body and / or additional JAIN - SIP API message headers to add to or
* replace in the outbound INVITE message . Use of this method requires knowledge of the JAIN - SIP
* API .
* The extra parameters supported by this method are :
* @ param additionalHeaders ArrayList of javax . sip . header . Header , each element a SIP header to add
* to the outbound message . These headers are added to the message after a correct message
* has been constructed . Note that if you try to add a header that there is only supposed
* to be one of in a message , and it ' s already there and only one single value is allowed
* for that header , then this header addition attempt will be ignored . Use the
* ' replaceHeaders ' parameter instead if you want to replace the existing header with your
* own . Use null for no additional message headers .
* @ param replaceHeaders ArrayList of javax . sip . header . Header , each element a SIP header to add to
* the outbound message , replacing existing header ( s ) of that type if present in the
* message . These headers are applied to the message after a correct message has been
* constructed . Use null for no replacement of message headers .
* @ param body A String to be used as the body of the message . The additionalHeaders parameter
* must contain a ContentTypeHeader for this body to be included in the message . Use null
* for no body bytes . */
public SipCall makeCall ( String to , int response , long timeout , String viaNonProxyRoute , ArrayList < Header > additionalHeaders , ArrayList < Header > replaceHeaders , String body ) { } } | initErrorInfo ( ) ; SipCall call = this . createSipCall ( ) ; if ( call . initiateOutgoingCall ( null , to , viaNonProxyRoute , additionalHeaders , replaceHeaders , body ) == false ) { setReturnCode ( call . getReturnCode ( ) ) ; setErrorMessage ( call . getErrorMessage ( ) ) ; setException ( call . getException ( ) ) ; return null ; } if ( call . waitOutgoingCallResponse ( timeout ) == false ) { setReturnCode ( call . getReturnCode ( ) ) ; setErrorMessage ( call . getErrorMessage ( ) ) ; setException ( call . getException ( ) ) ; return null ; } int status_code = call . getReturnCode ( ) ; while ( status_code != response ) { if ( status_code / 100 == 1 ) { if ( call . waitOutgoingCallResponse ( timeout ) == false ) { setReturnCode ( call . getReturnCode ( ) ) ; setErrorMessage ( call . getErrorMessage ( ) ) ; setException ( call . getException ( ) ) ; return null ; } status_code = call . getReturnCode ( ) ; continue ; } else if ( ( status_code == Response . UNAUTHORIZED ) || ( status_code == Response . PROXY_AUTHENTICATION_REQUIRED ) ) { Request msg = call . getSentRequest ( ) ; // modify the request to include user authorization info
msg = processAuthChallenge ( ( Response ) call . getLastReceivedResponse ( ) . getMessage ( ) , msg ) ; if ( msg == null ) { return null ; } if ( call . reInitiateOutgoingCall ( msg ) == false ) { setReturnCode ( call . getReturnCode ( ) ) ; setErrorMessage ( call . getErrorMessage ( ) ) ; setException ( call . getException ( ) ) ; return null ; } if ( call . waitOutgoingCallResponse ( timeout ) == false ) { setReturnCode ( call . getReturnCode ( ) ) ; setErrorMessage ( call . getErrorMessage ( ) ) ; setException ( call . getException ( ) ) ; return null ; } status_code = call . getReturnCode ( ) ; continue ; } else { setReturnCode ( status_code ) ; setErrorMessage ( "Desired make-call response was not received, got this instead: " + status_code ) ; return null ; } } return call ; |
public class RestRepositoryHandler { /** * Performs a repository backup . */
public Response backupRepository ( ServletContext context , HttpServletRequest request , String repositoryName , BackupOptions options ) throws RepositoryException { } } | final File backupLocation = resolveBackupLocation ( context ) ; Session session = getSession ( request , repositoryName , null ) ; String repositoryVersion = session . getRepository ( ) . getDescriptorValue ( Repository . REP_VERSION_DESC ) . getString ( ) . replaceAll ( "\\." , "" ) ; final String backupName = "modeshape_" + repositoryVersion + "_" + repositoryName + "_backup_" + DATE_FORMAT . format ( new Date ( ) ) ; final File backup = new File ( backupLocation , backupName ) ; if ( ! backup . mkdirs ( ) ) { throw new RuntimeException ( "Cannot create backup folder: " + backup ) ; } logger . debug ( "Backing up repository '{0}' to '{1}', using '{2}'" , repositoryName , backup , options ) ; RepositoryManager repositoryManager = ( ( org . modeshape . jcr . api . Workspace ) session . getWorkspace ( ) ) . getRepositoryManager ( ) ; repositoryManager . backupRepository ( backup , options ) ; final String backupURL ; try { backupURL = backup . toURI ( ) . toURL ( ) . toString ( ) ; } catch ( MalformedURLException e ) { // should never happen
throw new RuntimeException ( e ) ; } JSONAble responseContent = new JSONAble ( ) { @ Override public JSONObject toJSON ( ) throws JSONException { JSONObject object = new JSONObject ( ) ; object . put ( "name" , backupName ) ; object . put ( "url" , backupURL ) ; return object ; } } ; return Response . status ( Response . Status . CREATED ) . entity ( responseContent ) . build ( ) ; |
public class StringTransformerChain { /** * This method extends this chain with { @ code additionalRules } . < br >
* < b > ATTENTION : < / b > < br >
* If you want to be able to marshall the chain with JAXB , you have to use
* { @ link StringTransformerChain # StringTransformerChain ( String , StringTransformerChain , StringTransformerRule . . . ) }
* instead .
* @ param additionalRules are the rules to add .
* @ return the chain that also checks the { @ code additionalRules } if none of this rules match . */
public StringTransformerChain extend ( StringTransformerRule ... additionalRules ) { } } | StringTransformerRule [ ] newRules = new StringTransformerRule [ this . rules . length + additionalRules . length ] ; System . arraycopy ( this . rules , 0 , newRules , 0 , this . rules . length ) ; System . arraycopy ( additionalRules , 0 , newRules , this . rules . length , additionalRules . length ) ; return new StringTransformerChain ( newRules ) ; |
public class XMLCharacterRecognizer { /** * Tell if the string is whitespace .
* @ param ch Character array to check as XML whitespace .
* @ param start Start index of characters in the array
* @ param length Number of characters in the array
* @ return True if the characters in the array are
* XML whitespace ; otherwise , false . */
public static boolean isWhiteSpace ( char ch [ ] , int start , int length ) { } } | int end = start + length ; for ( int s = start ; s < end ; s ++ ) { if ( ! isWhiteSpace ( ch [ s ] ) ) return false ; } return true ; |
public class ExpressionUtils { /** * Create a new Template expression
* @ param template template
* @ param args template parameters
* @ return template expression */
public static PredicateTemplate predicateTemplate ( Template template , Object ... args ) { } } | return predicateTemplate ( template , ImmutableList . copyOf ( args ) ) ; |
public class TemporalProposition { /** * Sets the valid interval .
* @ param interval an < code > Interval < / code > . */
public void setInterval ( Interval interval ) { } } | if ( interval == null ) { interval = INTERVAL_FACTORY . getInstance ( ) ; } this . interval = interval ; |
public class Walk { /** * Traverse the configuration ( sub ) tree in preorder , starting from the given node .
* FIXME : handle loopy graphs correctly !
* @ param nodeVisitor node visitor . Can be null .
* @ param edgeVisitor edge visitor . Can be null .
* @ param node current node of the configuration tree .
* @ return true if all nodes has been walked , false if visitor stopped early . */
public static < T extends Traversable < T > > boolean preorder ( final NodeVisitor < T > nodeVisitor , final EdgeVisitor < T > edgeVisitor , final T node ) { } } | if ( nodeVisitor != null && nodeVisitor . visit ( node ) ) { if ( edgeVisitor != null ) { for ( final T child : node . getChildren ( ) ) { if ( ! ( edgeVisitor . visit ( node , child ) && preorder ( nodeVisitor , edgeVisitor , child ) ) ) { return false ; } } } else { for ( final T child : node . getChildren ( ) ) { if ( ! preorder ( nodeVisitor , null , child ) ) { return false ; } } } } return true ; |
public class PassConfig { /** * Gets a graph of the passes run . For debugging . */
GraphvizGraph getPassGraph ( ) { } } | LinkedDirectedGraph < String , String > graph = LinkedDirectedGraph . createWithoutAnnotations ( ) ; Iterable < PassFactory > allPasses = Iterables . concat ( getChecks ( ) , getOptimizations ( ) ) ; String lastPass = null ; String loopStart = null ; for ( PassFactory pass : allPasses ) { String passName = pass . getName ( ) ; int i = 1 ; while ( graph . hasNode ( passName ) ) { passName = pass . getName ( ) + ( i ++ ) ; } graph . createNode ( passName ) ; if ( loopStart == null && ! pass . isOneTimePass ( ) ) { loopStart = passName ; } else if ( loopStart != null && pass . isOneTimePass ( ) ) { graph . connect ( lastPass , "loop" , loopStart ) ; loopStart = null ; } if ( lastPass != null ) { graph . connect ( lastPass , "" , passName ) ; } lastPass = passName ; } return graph ; |
public class FileChunker { /** * This method pushes the content file to the space destSpaceId with the
* content ID destContentId
* @ param destSpaceId of content destination
* @ param destContentId of content
* @ param fileChecksum MD5 checksum of file or null if not known
* @ param file to add */
public void addContent ( String destSpaceId , String destContentId , String fileChecksum , File file ) { } } | Map < String , String > properties = StorageProviderUtil . createContentProperties ( file . getAbsolutePath ( ) , null ) ; addContent ( destSpaceId , destContentId , fileChecksum , file . length ( ) , getInputStream ( file ) , properties ) ; |
public class ExplicitConfigurationInjector { /** * < p > Configures the { @ link Activity } to use a < i > title < / i >
* specified via { @ link Title } . < / p >
* @ param injectionActivity
* the { @ link Activity } which is the subject of dependency injection
* < br > < br >
* @ since 1.0.0 */
private void configureTitle ( Activity injectionActivity ) { } } | Title title = TypeUtils . getAnnotation ( injectionActivity , Title . class ) ; if ( title != null ) { if ( title . value ( ) != 0 ) injectionActivity . setTitle ( title . value ( ) ) ; else if ( ! title . text ( ) . equals ( "" ) ) injectionActivity . setTitle ( title . text ( ) ) ; } |
public class GetFolderResult { /** * The custom metadata on the folder .
* @ param customMetadata
* The custom metadata on the folder .
* @ return Returns a reference to this object so that method calls can be chained together . */
public GetFolderResult withCustomMetadata ( java . util . Map < String , String > customMetadata ) { } } | setCustomMetadata ( customMetadata ) ; return this ; |
public class GBSIterator { /** * Find the next node in the tree in key order .
* @ param stack The stack being used for traversal .
* @ return the next node in key order . null if we have reached the end . */
private GBSNode nextNode ( DeleteStack stack ) { } } | if ( _eof ) throw new RuntimeException ( "_eof is set on entry to nextNode()" ) ; boolean done = false ; GBSNode q = null ; GBSNode nextp = null ; while ( ! done ) { if ( stack . index ( ) > GBSTree . maxDepth ) throw new OptimisticDepthException ( "maxDepth (" + GBSTree . maxDepth + ") exceeded in GBSIterator.nextNode()." ) ; switch ( _s ) { case NodeStack . VISIT_LEFT : _s = NodeStack . PROCESS_CURRENT ; q = _p . leftChild ( ) ; while ( q != null ) { stack . push ( _s , _p , "GBSIterator.nextNode:VISIT_LEFT" ) ; _p = q ; q = _p . leftChild ( ) ; } break ; case NodeStack . PROCESS_CURRENT : _s = NodeStack . VISIT_RIGHT ; done = true ; nextp = _p ; /* Next node to visit */
break ; case NodeStack . VISIT_RIGHT : _s = NodeStack . DONE_VISITS ; q = _p . rightChild ( ) ; if ( q != null ) { stack . push ( _s , _p , "GBSIterator.nextNode:VISIT_RIGHT" ) ; _s = NodeStack . VISIT_LEFT ; _p = _p . rightChild ( ) ; } break ; case NodeStack . DONE_VISITS : if ( stack . index ( ) <= 0 ) /* Have finally hit end of sub - tree */
done = true ; else { _s = stack . state ( ) ; _p = stack . node ( ) ; stack . pop ( ) ; } break ; default : throw new RuntimeException ( "Help!, _s = " + _s + ", _p = " + _p + "." ) ; } /* switch ( _ s ) */
} /* while ( ! done ) */
return nextp ; |
public class Command { /** * Make RESTful calls to Doradus server
* @ param restClient
* @ param methodName
* @ param uri
* @ param body
* @ return
* @ throws IOException */
private RESTResponse sendRequest ( RESTClient restClient , String methodName , String uri , byte [ ] body ) throws IOException { } } | RESTResponse response = restClient . sendRequest ( HttpMethod . methodFromString ( methodName ) , uri , ContentType . APPLICATION_JSON , body ) ; logger . debug ( "response: {}" , response . toString ( ) ) ; return response ; |
public class BaseField { /** * For binary fields , return the current state .
* @ param True is this field is true . */
public boolean getState ( ) { } } | String tempChar = this . getString ( ) ; if ( tempChar . length ( ) == 0 ) tempChar = " " ; if ( ( tempChar . charAt ( 0 ) == 'Y' ) || ( tempChar . charAt ( 0 ) == 'y' ) ) return true ; else return false ; |
public class EncodedElement_32 { /** * Pack a number of bits from each int of an array ( within given limits ) to
* the end of this list .
* @ param inputA Array containing input values .
* @ param inputBits Array containing number of bits to use for each index
* packed . This array should be equal in size to the inputA array .
* @ param inputOffset Index of first usable index .
* @ param countA Number of indices to pack .
* @ param startPosIn First usable bit - level index in destination array ( byte
* index = startPosIn / 8 , bit within that byte = startPosIn % 8)
* @ param dest Destination array to store input values in . This array * must *
* be large enough to store all values or this method will fail in an
* undefined manner . */
public static void packIntByBits ( int [ ] inputA , int [ ] inputBits , int inputOffset , int countA , int startPosIn , int [ ] dest ) { } } | if ( DEBUG_LEV > 30 ) System . err . println ( "EncodedElement::packIntByBits : Begin" ) ; // int offsetCounter = 0;
int startPos = startPosIn ; // the position to write to in output array
int inputStop = countA + inputOffset ; for ( int valI = inputOffset ; valI < inputStop ; valI ++ ) { // inputIter = valI + inputOffset ;
// inputIter + = valI ;
// int input = inputA [ valI ] ; / / value to encode
int value = inputA [ valI ] ; int count = inputBits [ valI ] ; // bits of value to encode
// EncodedElement _ 32 . addInt ( input , count , startPos , dest ) ;
int currentIndex = startPos / 32 ; int currentOffset = startPos % 32 ; int totalSize = count + currentOffset ; if ( totalSize > 32 ) { // System . err . println ( " totalSize > 32 " ) ;
int secondIndex = currentIndex + 1 ; int secondSize = totalSize - 32 ; int secondValue = value << ( 32 - secondSize ) ; int lowerMask = - 1 >>> secondSize ; int temp = dest [ secondIndex ] & lowerMask ; dest [ secondIndex ] = temp | secondValue ; totalSize = 32 ; value = value >>> secondSize ; } // if ( totalSize < = 32 ) { / / Case 1
int upperMask = - 2 << ( 31 - currentOffset ) ; int lowerMask = 0x7FFFFFFF >>> ( totalSize - 1 ) ; int destMask = upperMask | lowerMask ; int temp = dest [ currentIndex ] & destMask ; destMask = ~ destMask ; value = value << ( 32 - totalSize ) ; value = value & destMask ; dest [ currentIndex ] = temp | value ; startPos += count ; // startPos must not be referenced again below here !
} if ( DEBUG_LEV > 30 ) System . err . println ( "EncodedElement::addInt : End" ) ; |
public class HttpRequester { /** * Request string .
* @ param httpUriRequest the http uri request
* @ param charSet the char set
* @ return the string */
public static String request ( HttpUriRequest httpUriRequest , Charset charSet ) { } } | try ( CloseableHttpResponse response = getHttpClient ( ) . execute ( httpUriRequest ) ) { HttpEntity httpEntity = response . getEntity ( ) ; int statusCode = response . getStatusLine ( ) . getStatusCode ( ) ; if ( statusCode >= 200 && statusCode < 300 ) return EntityUtils . toString ( httpEntity , charSet ) ; throw new IllegalStateException ( response . getStatusLine ( ) . getStatusCode ( ) + JMString . SPACE + response . getStatusLine ( ) . getReasonPhrase ( ) ) ; } catch ( IOException e ) { throw JMExceptionManager . handleExceptionAndReturnRuntimeEx ( log , e , "request" , httpUriRequest ) ; } |
public class PoiWorkSheet { /** * Create cell cell .
* @ param str the str
* @ return the cell */
public Cell createCell ( String str ) { } } | Cell cell = this . getNextCell ( CellType . STRING ) ; cell . setCellValue ( str ) ; cell . setCellStyle ( this . style . getStringCs ( ) ) ; return cell ; |
public class Optionalish { /** * Returns a string representing the method call to obtain the empty version of this Optional .
* This will be something like { @ code " Optional . empty ( ) " } or possibly { @ code
* " java . util . Optional . empty ( ) " } . It does not have a final semicolon .
* < p > This method is public so that it can be referenced as { @ code p . optional . empty } from
* templates . */
public String getEmpty ( ) { } } | String empty = className . startsWith ( "java.util." ) ? ".empty()" : ".absent()" ; return TypeEncoder . encodeRaw ( optionalType ) + empty ; |
public class HullWhiteModelWithShiftExtension { /** * This is the shift alpha of the process , which essentially represents
* the integrated drift of the short rate ( without the interest rate curve related part ) .
* @ param timeIndex Time index associated with the time discretization obtained from < code > getProcess < / code >
* @ return The integrated drift ( integrating from 0 to getTime ( timeIndex ) ) . */
private double getIntegratedDriftAdjustment ( int timeIndex ) { } } | double integratedDriftAdjustment = 0 ; for ( int i = 1 ; i <= timeIndex ; i ++ ) { double t = getProcess ( ) . getTime ( i - 1 ) ; double t2 = getProcess ( ) . getTime ( i ) ; int timeIndexVolatilityModel = volatilityModel . getTimeDiscretization ( ) . getTimeIndex ( t ) ; if ( timeIndexVolatilityModel < 0 ) { timeIndexVolatilityModel = - timeIndexVolatilityModel - 2 ; // Get timeIndex corresponding to previous point
} double meanReversion = volatilityModel . getMeanReversion ( timeIndexVolatilityModel ) . doubleValue ( ) ; integratedDriftAdjustment += getShortRateConditionalVariance ( 0 , t ) * getB ( t , t2 ) / ( t2 - t ) * ( t2 - t ) - integratedDriftAdjustment * meanReversion * ( t2 - t ) * getB ( t , t2 ) / ( t2 - t ) ; } return integratedDriftAdjustment ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.