signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Vectors { /** * Returns a subview for the given { @ code IntegerVector } with a specified
* offset and length .
* @ param vector the { @ code Vector } whose values will be shown in the view
* @ param offset the index of { @ code v } at which the first index of this
* view starts
* @ param length ... | if ( vector == null ) throw new NullPointerException ( "Cannot create view of a " + "null vector" ) ; return new SparseIntegerVectorView ( vector , offset , length ) ; |
public class TranslationServiceClient { /** * Creates a glossary and returns the long - running operation . Returns NOT _ FOUND , if the project
* doesn ' t exist .
* < p > Sample code :
* < pre > < code >
* try ( TranslationServiceClient translationServiceClient = TranslationServiceClient . create ( ) ) {
* ... | return createGlossaryOperationCallable ( ) . futureCall ( request ) ; |
public class ChromeDriverFactory { /** * Converts String to Boolean \ Integer or returns original String .
* @ param value string to convert
* @ return string ' s object representation */
private Object convertStringToNearestObjectType ( String value ) { } } | switch ( value ) { case "true" : return true ; case "false" : return false ; default : { if ( NumberUtils . isParsable ( value ) ) { return Integer . parseInt ( value ) ; } return value ; } } |
public class JournalSegmentDescriptor { /** * Copies the segment to a new buffer . */
JournalSegmentDescriptor copyTo ( ByteBuffer buffer ) { } } | buffer . putInt ( version ) ; buffer . putLong ( id ) ; buffer . putLong ( index ) ; buffer . putInt ( maxSegmentSize ) ; buffer . putInt ( maxEntries ) ; buffer . putLong ( updated ) ; buffer . put ( locked ? ( byte ) 1 : ( byte ) 0 ) ; return this ; |
public class DirectQuickSelectSketch { /** * Wrap a sketch around the given source Memory containing sketch data that originated from
* this sketch .
* @ param srcMem < a href = " { @ docRoot } / resources / dictionary . html # mem " > See Memory < / a >
* The given Memory object must be in hash table form and no... | final int preambleLongs = extractPreLongs ( srcMem ) ; // byte 0
final int lgNomLongs = extractLgNomLongs ( srcMem ) ; // byte 3
final int lgArrLongs = extractLgArrLongs ( srcMem ) ; // byte 4
UpdateSketch . checkUnionQuickSelectFamily ( srcMem , preambleLongs , lgNomLongs ) ; checkMemIntegrity ( srcMem , seed , preamb... |
public class DRL6Expressions { /** * $ ANTLR start synpred11 _ DRL6Expressions */
public final void synpred11_DRL6Expressions_fragment ( ) throws RecognitionException { } } | // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 421:5 : ( DOUBLE _ AMPER ( fullAnnotation [ null ] ) ? operator )
// src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 421:6 : DOUBLE _ AMPER ( fullAnnotation [ null ] ) ? operator
{ match ( input , DOUBLE_A... |
public class Option { /** * If { @ code x = = null } , return { @ link None } , else return { @ link Some }
* containing { @ code x } .
* @ param < T > The type of values
* @ param x The value
* @ return An optional value */
public static < T > OptionType < T > of ( final @ Nullable T x ) { } } | if ( x == null ) { return None . none ( ) ; } return Some . some ( x ) ; |
public class TargetsApi { /** * Delete a target
* Delete the target from the agent & # 39 ; s personal favorites .
* @ param id The ID of the target . ( required )
* @ param type The type of target . ( required )
* @ return ApiSuccessResponse
* @ throws ApiException If fail to call the API , e . g . server er... | ApiResponse < ApiSuccessResponse > resp = deletePersonalFavoriteWithHttpInfo ( id , type ) ; return resp . getData ( ) ; |
public class IndexFacesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( IndexFacesRequest indexFacesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( indexFacesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( indexFacesRequest . getCollectionId ( ) , COLLECTIONID_BINDING ) ; protocolMarshaller . marshall ( indexFacesRequest . getImage ( ) , IMAGE_BINDING ) ; protocolMarshal... |
public class ExposureEstimator { /** * This method returns the value random variable of the product within the specified model , evaluated at a given evalutationTime .
* Note : For a lattice this is often the value conditional to evalutationTime , for a Monte - Carlo simulation this is the ( sum of ) value discounted... | final RandomVariable one = model . getRandomVariableForConstant ( 1.0 ) ; final RandomVariable zero = model . getRandomVariableForConstant ( 0.0 ) ; RandomVariable values = underlying . getValue ( evaluationTime , model ) ; if ( values . getFiltrationTime ( ) > evaluationTime ) { RandomVariable filterNaN = values . isN... |
public class AWSMigrationHubClient { /** * Sets the migration state of an application . For a given application identified by the value passed to
* < code > ApplicationId < / code > , its status is set or updated by passing one of three values to < code > Status < / code > :
* < code > NOT _ STARTED | IN _ PROGRESS... | request = beforeClientExecution ( request ) ; return executeNotifyApplicationState ( request ) ; |
public class RubyDependencyResolver { /** * Get gems file name { gems . locked / Gemfile . lock } that will be created in bundle install command .
* Bundler version < 2 will create ' Gemfile . lock ' if ' Gemfile ' exist , If ' Gemfile ' doesn ' t exist and ' gems . rb ' exist it will create ' gems . locked '
* Bun... | File gemsRb = new File ( rootDirectory + fileSeparator + GEMS_RB ) ; File gemFile = new File ( rootDirectory + fileSeparator + GEM_FILE ) ; if ( ! gemsRb . isFile ( ) && ! gemFile . isFile ( ) ) { return null ; } List < String > bundleVersionResult = cli . runCmd ( rootDirectory , cli . getCommandParams ( BUNDLE , Cons... |
public class PluginMessageDescription { /** * Create a description for a RateCondition object .
* @ param condition the condition
* @ return a description to be used on email templates */
public String rate ( RateCondition condition ) { } } | String description ; if ( condition . getContext ( ) != null && condition . getContext ( ) . get ( CONTEXT_PROPERTY_DESCRIPTION ) != null ) { description = condition . getContext ( ) . get ( CONTEXT_PROPERTY_DESCRIPTION ) ; } else { description = condition . getDataId ( ) ; } switch ( condition . getDirection ( ) ) { c... |
public class RtmpGroupSettingsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( RtmpGroupSettings rtmpGroupSettings , ProtocolMarshaller protocolMarshaller ) { } } | if ( rtmpGroupSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( rtmpGroupSettings . getAuthenticationScheme ( ) , AUTHENTICATIONSCHEME_BINDING ) ; protocolMarshaller . marshall ( rtmpGroupSettings . getCacheFullBehavior ( ) , CACHE... |
public class Base64Encoder { /** * 编码为Base64 < br >
* 如果isMultiLine为 < code > true < / code > , 则每76个字符一个换行符 , 否则在一行显示
* @ param arr 被编码的数组
* @ param isMultiLine 在76个char之后是CRLF还是EOF
* @ param isUrlSafe 是否使用URL安全字符 , 一般为 < code > false < / code >
* @ return 编码后的bytes */
public static byte [ ] encode ( byte [ ... | if ( null == arr ) { return null ; } int len = arr . length ; if ( len == 0 ) { return new byte [ 0 ] ; } int evenlen = ( len / 3 ) * 3 ; int cnt = ( ( len - 1 ) / 3 + 1 ) << 2 ; int destlen = cnt + ( isMultiLine ? ( cnt - 1 ) / 76 << 1 : 0 ) ; byte [ ] dest = new byte [ destlen ] ; byte [ ] encodeTable = isUrlSafe ? U... |
public class LongTupleStreams { /** * Returns a stream that returns { @ link MutableLongTuple } s up to the given
* maximum , in lexicographical iteration order . < br >
* < br >
* A copy of the given tuple will be stored internally . < br >
* < br >
* Also see < a href = " . . / . . / package - summary . htm... | return stream ( Order . LEXICOGRAPHICAL , LongTuples . zero ( max . getSize ( ) ) , max ) ; |
public class SuggestedFixes { /** * Returns a human - friendly name of the given type for use in fixes . */
public static String qualifyType ( VisitorState state , SuggestedFix . Builder fix , TypeMirror type ) { } } | return type . accept ( new SimpleTypeVisitor8 < String , SuggestedFix . Builder > ( ) { @ Override protected String defaultAction ( TypeMirror e , Builder builder ) { return e . toString ( ) ; } @ Override public String visitArray ( ArrayType t , Builder builder ) { return t . getComponentType ( ) . accept ( this , bui... |
public class BigtableTableAdminClientWrapper { /** * { @ inheritDoc } */
@ Override public ApiFuture < Table > createTableAsync ( CreateTableRequest request ) { } } | com . google . bigtable . admin . v2 . CreateTableRequest requestProto = request . toProto ( instanceName . getProjectId ( ) , instanceName . getInstanceId ( ) ) ; return ApiFutureUtil . transformAndAdapt ( delegate . createTableAsync ( requestProto ) , new Function < com . google . bigtable . admin . v2 . Table , Tabl... |
public class CPAttachmentFileEntryPersistenceImpl { /** * Returns an ordered range of all the cp attachment file entries where classNameId = & # 63 ; and classPK = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end ... | boolean pagination = true ; FinderPath finderPath = null ; Object [ ] finderArgs = null ; if ( ( start == QueryUtil . ALL_POS ) && ( end == QueryUtil . ALL_POS ) && ( orderByComparator == null ) ) { pagination = false ; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C ; finderArgs = new Object [ ] { classNameId ... |
public class WriteRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( WriteRequest writeRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( writeRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( writeRequest . getPutRequest ( ) , PUTREQUEST_BINDING ) ; protocolMarshaller . marshall ( writeRequest . getDeleteRequest ( ) , DELETEREQUEST_BINDING ) ; } catch ( Exceptio... |
public class GenericEncodingStrategy { /** * Generates code that stores a one or four byte generation value into a
* byte array referenced by the local variable .
* @ param encodedVar references a byte array
* @ param offset offset into byte array
* @ param generation if less than zero , no code is generated */... | if ( offset < 0 ) { throw new IllegalArgumentException ( ) ; } if ( generation < 0 ) { return ; } if ( generation < 128 ) { a . loadLocal ( encodedVar ) ; a . loadConstant ( offset ) ; a . loadConstant ( ( byte ) generation ) ; a . storeToArray ( TypeDesc . BYTE ) ; } else { generation |= 0x80000000 ; for ( int i = 0 ;... |
public class SuperActivityToast { /** * Saves the state of all SuperToasts that are showing and / or pending .
* This should be called in the { @ link android . app . Activity # onSaveInstanceState ( android . os . Bundle ) }
* method of your Activity .
* @ param bundle The Bundle provided in onSaveInstanceState ... | final ArrayList < Style > styleList = new ArrayList ( ) ; // Create a list of every Style used by a SuperToast in the queue
for ( SuperToast superToast : Toaster . getInstance ( ) . getQueue ( ) ) { if ( superToast instanceof SuperActivityToast ) { superToast . getStyle ( ) . isSuperActivityToast = true ; } styleList .... |
public class AbstractHealthIndicator { /** * Builds the whole health result .
* @ return The health result to provide to the indicator . */
protected HealthResult getHealthResult ( ) { } } | HealthResult . Builder builder = HealthResult . builder ( getName ( ) ) ; try { builder . details ( getHealthInformation ( ) ) ; builder . status ( this . healthStatus ) ; } catch ( Exception e ) { builder . status ( HealthStatus . DOWN ) ; builder . exception ( e ) ; } return builder . build ( ) ; |
public class SelfCalls { /** * Get an Iterator over all self call sites . */
public Iterator < CallSite > callSiteIterator ( ) { } } | return new Iterator < CallSite > ( ) { private final Iterator < CallGraphEdge > iter = callGraph . edgeIterator ( ) ; @ Override public boolean hasNext ( ) { return iter . hasNext ( ) ; } @ Override public CallSite next ( ) { return iter . next ( ) . getCallSite ( ) ; } @ Override public void remove ( ) { iter . remove... |
public class BuildCache { /** * This method creates a string describing a cycle which has been detected .
* It should only be called if a cycle with the specified dependency has
* actually been detected .
* @ param objectName
* name of the object which has the dependency
* @ param dependencyName
* name of t... | // Determine if adding this dependency will create a cycle .
StringBuilder sb = new StringBuilder ( ) ; sb . append ( objectName ) ; sb . append ( " -> " ) ; sb . append ( dependencyName ) ; String nextObjectName = dependencies . get ( dependencyName ) ; while ( nextObjectName != null && ! objectName . equals ( nextObj... |
public class DirectoryHelper { /** * Returns the size of directory including all subfolders . */
public static long getSize ( File dir ) { } } | long size = 0 ; for ( File file : dir . listFiles ( ) ) { if ( file . isFile ( ) ) { size += file . length ( ) ; } else { size += getSize ( file ) ; } } return size ; |
public class TCPConnectRequestContextFactory { /** * Create a new connection request context based upon the input needed to
* fully define
* the context . The local address is assumed to be null , and the local port
* will be an ephemeral port
* @ param _ remoteHostName
* host name of the remote side of the c... | return new TCPConnectRequestContextImpl ( _remoteHostName , _remotePort , _timeout ) ; |
public class Filters { /** * The collectionRejectFilter rejects a certain collection . */
public static < E > Filter < E > collectionRejectFilter ( Collection < E > objs ) { } } | return new CollectionAcceptFilter < E > ( objs , false ) ; |
public class EventSubscriptionsInner { /** * List all global event subscriptions for a topic type .
* List all global event subscriptions under an Azure subscription for a topic type .
* @ param topicTypeName Name of the topic type
* @ param serviceCallback the async ServiceCallback to handle successful and faile... | return ServiceFuture . fromResponse ( listGlobalBySubscriptionForTopicTypeWithServiceResponseAsync ( topicTypeName ) , serviceCallback ) ; |
public class QueueFactories { /** * Creates an async . Queue backed by an Agrona ManyToOneConcurrentArrayQueue bounded by specified queueSize
* Wait strategy used is NoWaitRetry by default for both Consumers and Producers
* ( both Consumers and Producers will repeatedly retry until successful ) . Use
* withConsum... | return ( ) -> new Queue < T > ( new ManyToOneConcurrentArrayQueue < > ( queueSize ) , new NoWaitRetry < > ( ) , new NoWaitRetry < > ( ) ) ; |
public class ScalarFieldUpdater { /** * Add new SV scalar field . */
private void addSVScalar ( ) { } } | String fieldValue = m_dbObj . getFieldValue ( m_fieldName ) ; m_dbTran . addScalarValueColumn ( m_tableDef , m_dbObj . getObjectID ( ) , m_fieldName , fieldValue ) ; addTermColumns ( fieldValue ) ; |
public class A_CmsJSPAction { /** * Creates string for get — request with given list of resources . < p >
* @ param resources to be transmitted
* @ return valid string for get - request */
protected String getRequestString ( List < CmsResource > resources ) { } } | String res = "?" ; for ( CmsResource resource : resources ) { res += "resources=" + resource . getStructureId ( ) . getStringValue ( ) + "&" ; } return res . substring ( 0 , res . length ( ) - 1 ) ; // Remove last " & " |
public class Async { /** * Runs an array of functions in series , working on a shared context .
* However , if any of the functions pass an error to the callback ,
* the next function is not executed and the outcome is immediately called with the error . */
@ SafeVarargs public final void waterfall ( final C contex... | _series ( context , outcome , functions ) ; |
public class DocumentTypeUrl { /** * Get Resource Url for GetDocumentType
* @ param documentTypeName The name of the document type to retrieve .
* @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter should only be ... | UrlFormatter formatter = new UrlFormatter ( "/api/content/documenttypes/{documentTypeName}?responseFields={responseFields}" ) ; formatter . formatUrl ( "documentTypeName" , documentTypeName ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . ... |
public class WebhookAction { /** * Sets the < b > Name < / b > for the custom Webhook User
* @ param name
* A not - null String name for the new Webhook user .
* @ throws IllegalArgumentException
* If the specified name is not in the range of 2-100.
* @ return The current WebhookAction for chaining convenienc... | Checks . notNull ( name , "Webhook name" ) ; Checks . check ( name . length ( ) >= 2 && name . length ( ) <= 100 , "The webhook name must be in the range of 2-100!" ) ; this . name = name ; return this ; |
public class HashtableOnDisk { /** * getInstance . Initializes a HashtableOnDisk instance over the specified
* FileManager , from the specified instanceid . The instanceid was
* used to originally create the instance in the createInstance method .
* @ param filemgr The FileManager for the HTOD .
* @ param auto ... | if ( instanceid == 0 ) { instanceid = filemgr . start ( ) ; } HashtableOnDisk answer = null ; try { answer = new HashtableOnDisk ( filemgr , auto_rehash , instanceid , initfn , hasCacheValue , htoddc ) ; } catch ( EOFException e ) { // eof means the file is empty and there is no such instance
} return answer ; |
public class TwitterImpl { /** * / path / to / video . mp4 - - file - field " media " */
private void uploadMediaChunkedAppend ( String fileName , InputStream media , int segmentIndex , long mediaId ) throws TwitterException { } } | post ( conf . getUploadBaseURL ( ) + "media/upload.json" , new HttpParameter [ ] { new HttpParameter ( "command" , CHUNKED_APPEND ) , new HttpParameter ( "media_id" , mediaId ) , new HttpParameter ( "segment_index" , segmentIndex ) , new HttpParameter ( "media" , fileName , media ) } ) ; |
public class RayHandler { /** * Sets combined camera matrix .
* < p > Matrix must be set to work in box2d coordinates , it will be copied
* and used for culling and rendering . Remember to update it if camera
* changes . This will work with rotated cameras .
* < p > NOTE : Matrix4 is assumed to be orthogonal fo... | System . arraycopy ( combined . val , 0 , this . combined . val , 0 , 16 ) ; // updateCameraCorners
float invWidth = combined . val [ Matrix4 . M00 ] ; final float halfViewPortWidth = 1f / invWidth ; final float x = - halfViewPortWidth * combined . val [ Matrix4 . M03 ] ; x1 = x - halfViewPortWidth ; x2 = x + halfViewP... |
public class AbsSetting { /** * 获得数组型
* @ param key 属性名
* @ param defaultValue 默认的值
* @ return 属性值 */
public String [ ] getStringsWithDefault ( String key , String [ ] defaultValue ) { } } | String [ ] value = getStrings ( key , null ) ; if ( null == value ) { value = defaultValue ; } return value ; |
public class GroupBuilder { /** * Registers a variable for later reference inside custom expressions .
* The new variable will perform the calculation using the field information passed in the ColumnProperty
* parameter . Such ColumnProperty will be properly registered in the report design as a field ( $ F { . . . ... | group . getVariables ( ) . add ( new DJGroupVariableDef ( name , new ColumnProperty ( property , className ) , operation ) ) ; return this ; |
public class PrefixedProperties { /** * Gets the prefixed key and parse it to an boolean [ ] < br >
* Each comma - separated list can be used .
* @ param key
* the key
* @ return boolean [ ] or null if the key couldn ' t get found . */
public boolean [ ] getBooleanArray ( final String key ) { } } | final String [ ] value = getArray ( key ) ; if ( value != null ) { final boolean [ ] result = new boolean [ value . length ] ; for ( int i = 0 ; i < value . length ; i ++ ) { result [ i ] = Boolean . valueOf ( value [ i ] ) . booleanValue ( ) ; } return result ; } return null ; |
public class LoggingInfoMarshaller { /** * Marshall the given parameter object . */
public void marshall ( LoggingInfo loggingInfo , ProtocolMarshaller protocolMarshaller ) { } } | if ( loggingInfo == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( loggingInfo . getS3BucketName ( ) , S3BUCKETNAME_BINDING ) ; protocolMarshaller . marshall ( loggingInfo . getS3KeyPrefix ( ) , S3KEYPREFIX_BINDING ) ; protocolMarshaller . ... |
public class DescribeSMBFileSharesRequest { /** * An array containing the Amazon Resource Name ( ARN ) of each file share to be described .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setFileShareARNList ( java . util . Collection ) } or { @ link # withFi... | if ( this . fileShareARNList == null ) { setFileShareARNList ( new com . amazonaws . internal . SdkInternalList < String > ( fileShareARNList . length ) ) ; } for ( String ele : fileShareARNList ) { this . fileShareARNList . add ( ele ) ; } return this ; |
public class EqualsCheckerCollection { /** * This method is called from { @ link # isEqualNotNull ( Object , Object ) } to check if the { @ link Object # getClass ( ) type }
* of two given { @ link Collection } s should be considered as equal .
* @ param collection1 is the first { @ link Collection } .
* @ param ... | return collection1 . getClass ( ) . equals ( collection2 . getClass ( ) ) ; |
public class IDCreator { /** * Reset the counters so that we keep generating simple IDs within
* single chem object or a set of them */
private static void resetCounters ( ) { } } | atomCount = 0 ; bondCount = 0 ; atomContainerCount = 0 ; atomContainerSetCount = 0 ; reactionCount = 0 ; reactionSetCount = 0 ; chemModelCount = 0 ; chemSequenceCount = 0 ; chemFileCount = 0 ; |
public class AppenderFile { /** * Keep the maximum size of log files close to maximum value .
* Logs are cached if the size of the currently used log file exceeds max value . */
private void rollOverFiles ( ) { } } | Context context = appContextRef . get ( ) ; if ( context != null ) { File dir = context . getFilesDir ( ) ; File mainFile = new File ( dir , name ( 1 ) ) ; if ( mainFile . exists ( ) ) { float fileSize = mainFile . length ( ) ; fileSize = fileSize / 1024.0f ; // In kilobytes
if ( fileSize > fileSizeLimitKb ) { File fil... |
public class ValidationDataRepository { /** * Find by param type and method and url list .
* @ param paramType the param type
* @ param method the method
* @ param url the url
* @ return the list */
public List < ValidationData > findByParamTypeAndMethodAndUrl ( ParamType paramType , String method , String url ... | return this . findByMethodAndUrl ( method , url ) . stream ( ) . filter ( d -> d . getParamType ( ) . equals ( paramType ) ) . collect ( Collectors . toList ( ) ) ; |
public class TileWriter { private boolean createFolderAndCheckIfExists ( final File pFile ) { } } | if ( pFile . mkdirs ( ) ) { return true ; } if ( Configuration . getInstance ( ) . isDebugMode ( ) ) { Log . d ( IMapView . LOGTAG , "Failed to create " + pFile + " - wait and check again" ) ; } // if create failed , wait a bit in case another thread created it
try { Thread . sleep ( 500 ) ; } catch ( final Interrupted... |
public class CodecUtil { /** * Term value .
* @ param term
* the term
* @ return the string */
public static String termValue ( String term ) { } } | int i = term . indexOf ( MtasToken . DELIMITER ) ; String value = null ; if ( i >= 0 ) { value = term . substring ( ( i + MtasToken . DELIMITER . length ( ) ) ) ; value = ( value . length ( ) > 0 ) ? value : null ; } return ( value == null ) ? null : value . replace ( "\u0000" , "" ) ; |
public class FixedWidthReader { /** * Estimates and returns the type for each column in the delimited text file { @ code file }
* The type is determined by checking a sample of the data in the file . Because only a sample of the data is
* checked ,
* the types may be incorrect . If that is the case a Parse Except... | boolean header = options . header ( ) ; int linesToSkip = header ? 1 : 0 ; AbstractParser < ? > parser = fixedWidthParser ( options ) ; try { return getTypes ( reader , options , linesToSkip , parser ) ; } finally { parser . stopParsing ( ) ; // we don ' t close the reader since we didn ' t create it
} |
public class QueryOptionsListHandle { /** * Returns a HashMap of the named query options from the server .
* The keys are the names of the query options , the values are the corresponding URIs on the server .
* @ return The map of names to URIs . */
@ Override public HashMap < String , String > getValuesMap ( ) { }... | if ( optionsHolder == null ) return null ; else return optionsHolder . getOptionsMap ( ) ; |
public class AbstractJobLauncher { /** * Start the scheduled executor for executing job cancellation .
* The executor , upon started , waits on the condition variable indicating a cancellation is requested ,
* i . e . , it waits for a cancellation request to arrive . If a cancellation is requested , the executor
... | this . cancellationExecutor . execute ( new Runnable ( ) { @ Override public void run ( ) { synchronized ( AbstractJobLauncher . this . cancellationRequest ) { try { while ( ! AbstractJobLauncher . this . cancellationRequested ) { // Wait for a cancellation request to arrive
AbstractJobLauncher . this . cancellationReq... |
public class DecimalFormat { /** * < strong > [ icu ] < / strong > Sets the minimum number of significant digits that will be displayed . If
* < code > min < / code > is less than one then it is set to one . If the maximum significant
* digits count is less than < code > min < / code > , then it is set to < code > ... | if ( min < 1 ) { min = 1 ; } // pin max sig dig to > = min
int max = Math . max ( maxSignificantDigits , min ) ; minSignificantDigits = min ; maxSignificantDigits = max ; setSignificantDigitsUsed ( true ) ; |
public class BatchSuspendUserRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BatchSuspendUserRequest batchSuspendUserRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( batchSuspendUserRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( batchSuspendUserRequest . getAccountId ( ) , ACCOUNTID_BINDING ) ; protocolMarshaller . marshall ( batchSuspendUserRequest . getUserIdList ( ) , USERIDLIST_BINDI... |
public class Validation { /** * Bootstrap performance estimation of a regression model .
* @ param < T > the data type of input objects .
* @ param k k - fold bootstrap estimation .
* @ param trainer a regression model trainer that is properly parameterized .
* @ param x the test data set .
* @ param y the te... | if ( k < 2 ) { throw new IllegalArgumentException ( "Invalid k for k-fold bootstrap: " + k ) ; } int n = x . length ; double [ ] results = new double [ k ] ; Bootstrap bootstrap = new Bootstrap ( n , k ) ; for ( int i = 0 ; i < k ; i ++ ) { T [ ] trainx = Math . slice ( x , bootstrap . train [ i ] ) ; double [ ] trainy... |
public class EitherT { /** * { @ inheritDoc } */
@ Override public < R2 > EitherT < M , L , R2 > fmap ( Function < ? super R , ? extends R2 > fn ) { } } | return MonadT . super . < R2 > fmap ( fn ) . coerce ( ) ; |
public class UberData { /** * Use a { @ link Boolean } to support returning { @ literal null } , and if it is { @ literal null } , don ' t render . */
@ Nullable public Boolean isTemplated ( ) { } } | return Optional . ofNullable ( this . url ) . map ( s -> s . contains ( "{?" ) ? true : null ) . orElse ( null ) ; |
public class TarBuffer { /** * Read a record from the input stream and return the data .
* @ return The record data . */
public byte [ ] readRecord ( ) throws IOException { } } | if ( this . debug ) { System . err . println ( "ReadRecord: recIdx = " + this . currRecIdx + " blkIdx = " + this . currBlkIdx ) ; } if ( this . inStream == null ) { throw new IOException ( "reading from an output buffer" ) ; } if ( this . currRecIdx >= this . recsPerBlock ) { if ( ! this . readBlock ( ) ) { return null... |
public class RepositoryXmlHandler { /** * endElement callback . most elements are build up from here . */
public void endElement ( String uri , String name , String qName ) { } } | boolean isDebug = logger . isDebugEnabled ( ) ; try { switch ( getLiteralId ( qName ) ) { case MAPPING_REPOSITORY : { if ( isDebug ) logger . debug ( " < " + tags . getTagById ( MAPPING_REPOSITORY ) ) ; this . m_CurrentAttrContainer = null ; m_CurrentCLD = null ; break ; } case CLASS_DESCRIPTOR : { if ( isDebug ) logge... |
public class View { /** * Instantiate View subtype from XML stream .
* @ param name Alternative name to use or { @ code null } to keep the one in xml . */
public static View createViewFromXML ( String name , InputStream xml ) throws IOException { } } | try ( InputStream in = new BufferedInputStream ( xml ) ) { View v = ( View ) Jenkins . XSTREAM . fromXML ( in ) ; if ( name != null ) v . name = name ; Jenkins . checkGoodName ( v . name ) ; return v ; } catch ( StreamException | ConversionException | Error e ) { // mostly reflection errors
throw new IOException ( "Una... |
public class DataContainer { /** * Adds properties to the data .
* @ param toAdd the properties to add
* @ return a new copy of the template . */
@ SuppressWarnings ( "unchecked" ) public A addAll ( Iterable < Property > toAdd ) { } } | Data data = getData ( ) ; Data modified = data . addAll ( toAdd ) ; if ( data == modified ) { return ( A ) this ; } return copy ( delegate . put ( "data" , Property . toArrayNode ( data ) ) ) ; |
public class JavaInlineExpressionCompiler { /** * Append the inline code for the given XTypeLiteral .
* @ param expression the expression of the operation .
* @ param parentExpression is the expression that contains this one , or { @ code null } if the current expression is
* the root expression .
* @ param fea... | output . appendTypeConstant ( expression . getType ( ) ) ; return Boolean . TRUE ; |
public class ConnecClient { /** * Return all the entities matching the parameters and using the provided client
* @ param entity
* name
* @ param groupId
* customer group id
* @ param params
* criteria
* @ param httpClient
* MnoHttpClient to use
* @ return list of entities
* @ throws AuthenticationE... | String jsonBody = httpClient . get ( getCollectionUrl ( entityName , groupId ) , MnoMapHelper . toUnderscoreHash ( params ) ) ; return GSON . fromJson ( jsonBody , clazz ) ; |
public class PubSubEventHandler { /** * Subscribes an event handler for an event class type .
* @ param clazz an event class
* @ param handler an event handler */
public void subscribe ( final Class < ? extends T > clazz , final EventHandler < ? extends T > handler ) { } } | lock . writeLock ( ) . lock ( ) ; try { List < EventHandler < ? extends T > > list = clazzToListOfHandlersMap . get ( clazz ) ; if ( list == null ) { list = new LinkedList < EventHandler < ? extends T > > ( ) ; clazzToListOfHandlersMap . put ( clazz , list ) ; } list . add ( handler ) ; } finally { lock . writeLock ( )... |
public class CommerceWarehouseLocalServiceUtil { /** * Updates the commerce warehouse in the database or adds it if it does not yet exist . Also notifies the appropriate model listeners .
* @ param commerceWarehouse the commerce warehouse
* @ return the commerce warehouse that was updated */
public static com . lif... | return getService ( ) . updateCommerceWarehouse ( commerceWarehouse ) ; |
public class Routes { private void add ( HttpMethod method , String url , String acceptedType , Object target ) { } } | RouteEntry entry = new RouteEntry ( ) ; entry . httpMethod = method ; entry . path = url ; entry . target = target ; entry . acceptedType = acceptedType ; LOG . debug ( "Adds route: " + entry ) ; // Adds to end of list
routes . add ( entry ) ; |
public class ZipUtils { /** * Zips arrays into single array of tuples
* @ return */
@ SuppressWarnings ( "unchecked" ) public static < T1 , T2 , T3 > Tuple3 < T1 , T2 , T3 > [ ] zip ( T1 [ ] arr1 , T2 [ ] arr2 , T3 [ ] arr3 ) { } } | int resultSize = _max ( arr1 . length , arr2 . length , arr3 . length ) ; Tuple3 [ ] result = new Tuple3 [ resultSize ] ; for ( int i = 0 ; i < resultSize ; i ++ ) result [ i ] = tuple ( next ( arr1 , i ) , next ( arr2 , i ) , next ( arr3 , i ) ) ; return result ; |
public class NotificationBoard { /** * Set the dim - behind layer a specific opacity .
* @ param alpha */
public void dimAt ( float alpha ) { } } | if ( ! mDimEnabled ) { return ; } if ( mDimView == null ) { mDimView = makeDimView ( ) ; } if ( ! mDimView . isShown ( ) ) { mDimView . setVisibility ( VISIBLE ) ; mDimView . setBackgroundColor ( mDimColor ) ; } mDimView . setAlpha ( alpha ) ; |
public class DeviceManagerClient { /** * Lists the last few versions of the device state in descending order ( i . e . : newest first ) .
* < p > Sample code :
* < pre > < code >
* try ( DeviceManagerClient deviceManagerClient = DeviceManagerClient . create ( ) ) {
* DeviceName name = DeviceName . of ( " [ PROJ... | ListDeviceStatesRequest request = ListDeviceStatesRequest . newBuilder ( ) . setName ( name ) . build ( ) ; return listDeviceStates ( request ) ; |
public class ClassDiscoverer { /** * Finds all external class references
* @ param outline root of the generated code
* @ param classes set of generated classes
* @ return set of external classes
* @ throws IllegalAccessException throw if there ' s an error introspecting the annotations */
static Set < JClass >... | Set < String > directClassNames = new LinkedHashSet < > ( ) ; for ( ClassOutline classOutline : classes ) { // for each field , if it ' s a bean , then visit it
List < FieldOutline > fields = findAllDeclaredAndInheritedFields ( classOutline ) ; for ( FieldOutline fieldOutline : fields ) { JType rawType = fieldOutline .... |
public class HttpRequest { /** * 获取请求URL分段中含prefix段的float值 < br >
* 例如请求URL / pipes / record / query / point : 40.0 < br >
* 获取time参数 : float point = request . getRequstURIPath ( " point : " , 0.0f ) ;
* @ param prefix prefix段前缀
* @ param defvalue 默认float值
* @ return float值 */
public float getRequstURIPath ( ... | String val = getRequstURIPath ( prefix , null ) ; try { return val == null ? defvalue : Float . parseFloat ( val ) ; } catch ( NumberFormatException e ) { return defvalue ; } |
public class SceneStructureMetric { /** * Specifies the camera model being used .
* @ param which Which camera is being specified
* @ param fixed If these parameters are constant or not
* @ param model The camera model */
public void setCamera ( int which , boolean fixed , BundleAdjustmentCamera model ) { } } | cameras [ which ] . known = fixed ; cameras [ which ] . model = model ; |
public class ProtoTruth { /** * Assert on a { @ link ListMultimap } with { @ link Message } values .
* < p > This allows for the equality configurations on { @ link ProtoSubject } to be applied to all
* comparison tests available on { @ link MultimapSubject . UsingCorrespondence } . */
public static < K , M extends... | return assertAbout ( protos ( ) ) . that ( listMultimap ) ; |
public class BuildService { /** * Build an image
* @ param imageConfig the image configuration
* @ param params mojo params for the project
* @ param noCache if not null , dictate the caching behaviour . Otherwise its taken from the build configuration
* @ param buildArgs
* @ throws DockerAccessException
* ... | String imageName = imageConfig . getName ( ) ; ImageName . validate ( imageName ) ; BuildImageConfiguration buildConfig = imageConfig . getBuildConfiguration ( ) ; String oldImageId = null ; CleanupMode cleanupMode = buildConfig . cleanupMode ( ) ; if ( cleanupMode . isRemove ( ) ) { oldImageId = queryService . getImag... |
public class Zips { /** * Creates an iterator yielding values from the source iterator and its
* index .
* < code > E . g :
* counted ( [ " a " , " b " , " c " ] , [ 0 . . inf ] ) - > [ ( 0 , " a " ) , ( 1 , " b " ) , ( 2 , " c " ) ]
* < / code >
* @ param < CT > the counter type
* @ param < ET > the elemen... | dbc . precondition ( iterable != null , "cannot call counted with a null iterable" ) ; return new ZipShortestIterator < CT , ET > ( range . iterator ( ) , iterable . iterator ( ) ) ; |
public class TrainingSpecification { /** * A list of < code > MetricDefinition < / code > objects , which are used for parsing metrics generated by the algorithm .
* @ param metricDefinitions
* A list of < code > MetricDefinition < / code > objects , which are used for parsing metrics generated by the
* algorithm... | if ( metricDefinitions == null ) { this . metricDefinitions = null ; return ; } this . metricDefinitions = new java . util . ArrayList < MetricDefinition > ( metricDefinitions ) ; |
public class RenameFileExtensions { /** * Changes the suffix from the Filename . Example : test . dat to test . xxx
* @ param file
* The file to change .
* @ param newSuffix
* The new suffix . You must start with a dot . For instance : . xxx
* @ return true if the file was renamed .
* @ throws FileNotRename... | return changeFilenameSuffix ( file , newSuffix , false ) ; |
public class SqlExecutor { /** * 执行存储过程
* @ param sql 需要执行的存储过程
* @ return 存储过程执行结果
* @ throws SQLException SQL执行异常 */
public Object [ ] call ( Sql sql ) throws SQLException { } } | long start = System . currentTimeMillis ( ) ; if ( sql . validate ( ) == false ) { return null ; } List < Object > result = new ArrayList < Object > ( ) ; Statement stmt = null ; try { stmt = this . createStatment ( conn , sql ) ; if ( stmt instanceof CallableStatement ) { CallableStatement callStmt = ( CallableStateme... |
public class SolverAggregatorInterface { /** * Called when a sample is received from the aggregator .
* @ param session
* the session the sample was received on .
* @ param sampleMessage
* the received sample . */
protected void solverSampleReceived ( IoSession session , SampleMessage sampleMessage ) { } } | for ( SampleListener listener : this . sampleListeners ) { listener . sampleReceived ( this , sampleMessage ) ; } |
public class CmsDisplayWidget { /** * Represents a value change event . < p > */
public void fireChangeEvent ( ) { } } | String result = "" ; if ( m_textbox . getText ( ) != null ) { if ( ! m_textbox . getText ( ) . equals ( m_default ) ) { result = m_textbox . getText ( ) ; } } ValueChangeEvent . fire ( this , result ) ; |
public class MethodBuilder { /** * Add proxy method to check for exception */
private void addProxyCheckException ( TypeSpec . Builder classBuilder ) { } } | MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "checkException" ) . addModifiers ( Modifier . PRIVATE ) . returns ( Throwable . class ) . addParameter ( ClassName . get ( "android.os" , "Parcel" ) , "reply" ) . addStatement ( "int code = reply.readInt()" ) . addStatement ( "Throwable exception = null... |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Class } { @ code > } } */
@ XmlElementDecl ( namespace = "http://schema.intuit.com/finance/v3" , name = "Class" , substitutionHeadNamespace = "http://schema.intuit.com/finance/v3" , substitutionHeadName = "IntuitObject... | return new JAXBElement < Class > ( _Class_QNAME , Class . class , null , value ) ; |
public class StaticLog { /** * Info等级日志 , 小于Warn < br >
* 由于动态获取Log , 效率较低 , 建议在非频繁调用的情况下使用 ! !
* @ param format 格式文本 , { } 代表变量
* @ param arguments 变量对应的参数 */
public static void info ( String format , Object ... arguments ) { } } | info ( LogFactory . indirectGet ( ) , format , arguments ) ; |
public class AbstractXsdGeneratorMojo { /** * { @ inheritDoc } */
@ Override protected boolean isReGenerationRequired ( ) { } } | // Use the stale flag method to identify if we should re - generate the XSDs from the sources .
// Basically , we should re - generate the XSDs if :
// a ) The staleFile does not exist
// b ) The staleFile exists and is older than one of the sources ( Java or XJB files ) .
// " Older " is determined by comparing the mo... |
public class ProvFactory { /** * ( non - Javadoc )
* @ see org . openprovenance . prov . model . LiteralConstructor # newDuration ( java . lang . String ) */
public Duration newDuration ( String lexicalRepresentation ) { } } | Duration dur = dataFactory . newDuration ( lexicalRepresentation ) ; return dur ; |
public class UsersApi { /** * Gets the user information for a specified user .
* Retrieves the user information for the specified user . To return additional user information that details the last login date , login status , and the user & # 39 ; s password expiration date , set the optional & # x60 ; additional _ in... | return getInformation ( accountId , userId , null ) ; |
public class IoUtil { /** * Transforms a { @ link DomDocument } to XML output .
* @ param document the DOM document to transform
* @ param result the { @ link StreamResult } to write to */
public static void transformDocumentToXml ( DomDocument document , StreamResult result ) { } } | TransformerFactory transformerFactory = TransformerFactory . newInstance ( ) ; try { Transformer transformer = transformerFactory . newTransformer ( ) ; transformer . setOutputProperty ( OutputKeys . ENCODING , "UTF-8" ) ; transformer . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; transformer . setOutputProperty... |
public class MMFF94PartialCharges { /** * Main method which assigns MMFF94 partial charges
* @ param ac AtomContainer
* @ return AtomContainer with MMFF94 partial charges as atom properties */
public IAtomContainer assignMMFF94PartialCharges ( IAtomContainer ac ) throws CDKException { } } | if ( ! mmff . assignAtomTypes ( ac ) ) throw new CDKException ( "Molecule had an atom of unknown MMFF type" ) ; mmff . partialCharges ( ac ) ; mmff . clearProps ( ac ) ; for ( IAtom atom : ac . atoms ( ) ) atom . setProperty ( MMFF_94_CHARGE , atom . getCharge ( ) ) ; return ac ; |
public class OffsetDateTime { /** * Returns a copy of this { @ code OffsetDateTime } with the specified number of months subtracted .
* This method subtracts the specified amount from the months field in three steps :
* < ol >
* < li > Subtract the input months from the month - of - year field < / li >
* < li >... | return ( months == Long . MIN_VALUE ? plusMonths ( Long . MAX_VALUE ) . plusMonths ( 1 ) : plusMonths ( - months ) ) ; |
public class BasicRook { /** * { @ code clear } closes all resources still present in this { @ code Rook } and
* removes them from this { @ code Rook } .
* @ throws IllegalStateException
* When this { @ code BasicRook } is closed .
* @ throws RuntimeException
* When one or more invocations of
* { @ link jav... | checkNotClosed ( ) ; if ( objects_to_close == null ) { return ; } RuntimeException re = null ; for ( AutoCloseable ac : objects_to_close ) { try { ac . close ( ) ; } catch ( Exception e ) { if ( re == null ) { re = new RuntimeException ( e ) ; } else { re . addSuppressed ( e ) ; } } } objects_to_close . clear ( ) ; if ... |
public class JSONObject { /** * 一次性Put 键值对 , 如果key已经存在抛出异常 , 如果键值中有null值 , 忽略
* @ param key 键
* @ param value 值对象 , 可以是以下类型 : Boolean , Double , Integer , JSONArray , JSONObject , Long , String , or the JSONNull . NULL .
* @ return this .
* @ throws JSONException 值是无穷数字 、 键重复抛出异常 */
public JSONObject putOnce ( ... | if ( key != null && value != null ) { if ( rawHashMap . containsKey ( key ) ) { throw new JSONException ( "Duplicate key \"{}\"" , key ) ; } this . put ( key , value ) ; } return this ; |
public class TimePickerSettings { /** * setFormatForMenuTimes , This sets the format that is used to display or parse menu times in
* the time picker , using a pattern string . The default format is generated using the locale of
* the settings instance .
* Available pattern strings can be found in the Javadocs fo... | DateTimeFormatter formatter = PickerUtilities . createFormatterFromPatternString ( patternString , locale ) ; setFormatForMenuTimes ( formatter ) ; |
public class FileUtils { /** * Parse a string into a stream of Quads .
* @ param line the line of text
* @ return the Quad */
public static Stream < Quad > parseQuad ( final String line ) { } } | final List < Token > tokens = new ArrayList < > ( ) ; makeTokenizerString ( line ) . forEachRemaining ( tokens :: add ) ; final List < Node > nodes = tokens . stream ( ) . filter ( Token :: isNode ) . map ( Token :: asNode ) . filter ( Objects :: nonNull ) . collect ( toList ( ) ) ; if ( nodes . size ( ) == 3 ) { retur... |
public class KeyStore { /** * Stores this keystore to the given output stream , and protects its
* integrity with the given password .
* @ param stream the output stream to which this keystore is written .
* @ param password the password to generate the keystore integrity check
* @ exception KeyStoreException i... | if ( ! initialized ) { throw new KeyStoreException ( "Uninitialized keystore" ) ; } keyStoreSpi . engineStore ( stream , password ) ; |
public class VFSUtils { /** * Decode the path .
* @ param path the path to decode
* @ param encoding the encoding
* @ return decoded path */
public static String decode ( String path , String encoding ) { } } | try { return URLDecoder . decode ( path , encoding ) ; } catch ( UnsupportedEncodingException e ) { throw MESSAGES . cannotDecode ( path , encoding , e ) ; } |
public class StringUtils { /** * Properly splits a delimited separated string .
* @ param input The input
* @ param separator The separator
* @ return A list of all the cells in the input */
@ SneakyThrows public static List < String > split ( CharSequence input , char separator ) { } } | if ( input == null ) { return new ArrayList < > ( ) ; } Preconditions . checkArgument ( separator != '"' , "Separator cannot be a quote" ) ; try ( CSVReader reader = CSV . builder ( ) . delimiter ( separator ) . reader ( new StringReader ( input . toString ( ) ) ) ) { List < String > all = new ArrayList < > ( ) ; List ... |
public class MatchResultPredicates { /** * Generates a Predicate that only accepts the Match Results that have a Match Type lower or equal to matchType
* @ param matchType the matchType that defines the boundary
* @ param < T > a subclass of MatchResult
* @ param < S > a subclass of MatchType
* @ return the Pre... | return Predicates . or ( lowerThan ( matchType ) , equalTo ( matchType ) ) ; |
public class AmazonWorkLinkClient { /** * Describes the networking configuration to access the internal websites associated with the specified fleet .
* @ param describeCompanyNetworkConfigurationRequest
* @ return Result of the DescribeCompanyNetworkConfiguration operation returned by the service .
* @ throws Un... | request = beforeClientExecution ( request ) ; return executeDescribeCompanyNetworkConfiguration ( request ) ; |
public class ConsumerContainer { /** * Checks if all preconditions are fulfilled on the broker to
* successfully register a consumer there . One important precondition
* is the existence of the queue the consumer shall consume from .
* @ param consumerHolders The consumer holders
* @ throws IOException if the p... | Channel channel = createChannel ( ) ; for ( ConsumerHolder consumerHolder : consumerHolders ) { String queue = consumerHolder . getConfiguration ( ) . getQueueName ( ) ; try { channel . queueDeclarePassive ( queue ) ; LOGGER . debug ( "Queue {} found on broker" , queue ) ; } catch ( IOException e ) { LOGGER . error ( "... |
public class Program { /** * Add a rule to this program .
* @ param name is the rule name
* @ param condition is the rule condition
* @ return the rule */
public Rule addRule ( String name , Node condition ) { } } | Rule rule = new Rule ( name , condition ) ; rules . put ( name , rule ) ; return rule ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.