signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Ordering { /** * Returns the least of the specified values according to this ordering . If there are multiple
* least values , the first of those is returned .
* < p > < b > Java 8 users : < / b > If { @ code iterable } is a { @ link Collection } , use { @ code
* Collections . min ( collection , this... | return min ( iterable . iterator ( ) ) ; |
public class TableForm { /** * Create a new column in the form . */
public void addColumn ( int spacing ) { } } | table . addCell ( " " , "width=" + spacing ) ; column = new Table ( 0 ) ; table . addCell ( column ) ; table . cell ( ) . top ( ) ; columns ++ ; |
public class DBReceiverJob { /** * Retrieve the event properties from the logging _ event _ property table .
* @ param connection
* @ param id
* @ param event
* @ throws SQLException */
void getProperties ( Connection connection , long id , LoggingEvent event ) throws SQLException { } } | PreparedStatement statement = connection . prepareStatement ( sqlProperties ) ; try { statement . setLong ( 1 , id ) ; ResultSet rs = statement . executeQuery ( ) ; while ( rs . next ( ) ) { String key = rs . getString ( 1 ) ; String value = rs . getString ( 2 ) ; event . setProperty ( key , value ) ; } } finally { sta... |
public class LabelProcessor { /** * Create a new labelBuilder and register label with the default locale .
* @ param label the label to be added
* @ return the updated label builder */
public static Label . Builder generateLabelBuilder ( final String label ) { } } | return addLabel ( Label . newBuilder ( ) , Locale . getDefault ( ) , label ) ; |
public class Cycles { /** * Internal method to wrap cycle computations which < i > should < / i > be
* tractable . That is they currently won ' t throw the exception - if the
* method does throw an exception an internal error is triggered as a sanity
* check .
* @ param finder the cycle finding method
* @ par... | try { return finder . find ( container , length ) ; } catch ( Intractable e ) { throw new RuntimeException ( "Cycle computation should not be intractable: " , e ) ; } |
public class RandomFileInputStream { /** * Skip bytes in the input file .
* @ param bytes The number of bytes to skip
* @ return the number of bytes skiped
* @ throws IOException on IO error
* @ see java . io . InputStream # skip ( long ) */
public long skip ( long bytes ) throws IOException { } } | long pos = randomFile . getFilePointer ( ) ; randomFile . seek ( pos + bytes ) ; return randomFile . getFilePointer ( ) - pos ; |
public class AbstractOAuth1TokenExtractor { /** * { @ inheritDoc } */
@ Override public T extract ( Response response ) throws IOException { } } | final String body = response . getBody ( ) ; Preconditions . checkEmptyString ( body , "Response body is incorrect. Can't extract a token from an empty string" ) ; final String token = extract ( body , OAUTH_TOKEN_REGEXP_PATTERN ) ; final String secret = extract ( body , OAUTH_TOKEN_SECRET_REGEXP_PATTERN ) ; return cre... |
public class AbstractRemoteClient { /** * { @ inheritDoc } */
@ Override public void removeDataObserver ( final Observer < DataProvider < M > , M > observer ) { } } | dataObservable . removeObserver ( observer ) ; |
public class GitlabAPI { /** * Creates a private Project
* @ param name The name of the project
* @ return The GitLab Project
* @ throws IOException on gitlab api call error */
public GitlabProject createProject ( String name ) throws IOException { } } | return createProject ( name , null , null , null , null , null , null , null , null , null , null ) ; |
public class CrowdingDistanceComparator { /** * Compare two solutions .
* @ param solution1 Object representing the first < code > Solution < / code > .
* @ param solution2 Object representing the second < code > Solution < / code > .
* @ return - 1 , or 0 , or 1 if solution1 is has greater , equal , or less dist... | int result ; if ( solution1 == null ) { if ( solution2 == null ) { result = 0 ; } else { result = 1 ; } } else if ( solution2 == null ) { result = - 1 ; } else { double distance1 = Double . MIN_VALUE ; double distance2 = Double . MIN_VALUE ; if ( crowdingDistance . getAttribute ( solution1 ) != null ) { distance1 = ( d... |
public class OracleDatabase { /** * { @ inheritDoc }
* @ throws SQLException */
@ Override public boolean isConnected ( final Connection _connection ) throws SQLException { } } | boolean ret = false ; final Statement stmt = _connection . createStatement ( ) ; try { final ResultSet resultset = stmt . executeQuery ( "select product from product_component_version where product like 'Oracle%'" ) ; ret = resultset . next ( ) ; resultset . close ( ) ; } finally { stmt . close ( ) ; } return ret ; |
public class DateParser { /** * Returns the sort version of the date . Does not have
* estimation rules applied .
* @ return return the sort string for this date */
public Calendar getSortCalendar ( ) { } } | final String dateString = stripApproximationKeywords ( ) ; if ( dateString . isEmpty ( ) ) { return null ; } return parseCalendar ( dateString ) ; |
public class ListJobsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListJobsRequest listJobsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listJobsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listJobsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listJobsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshalle... |
public class XmlEntities { /** * Unescapes the entities in a < code > String < / code > .
* For example , if you have called addEntity ( & quot ; foo & quot ; , 0xA1 ) , unescape ( & quot ; & amp ; foo ; & quot ; ) will return
* & quot ; \ u00A1 & quot ;
* @ param str
* The < code > String < / code > to escape ... | int firstAmp = str . indexOf ( '&' ) ; if ( firstAmp < 0 ) { return str ; } else { StringBuilder sb = createStringBuilder ( str ) ; doUnescape ( sb , str , firstAmp ) ; return sb . toString ( ) ; } |
public class EventService { /** * Dispatch the event to the handler registered for the category . The method
* corresponding to the event type is invoked .
* @ param event The event object
* @ param apiContext The application context
* @ throws ClassNotFoundException
* @ throws SecurityException
* @ throws ... | String topic [ ] = event . getTopic ( ) . split ( "\\." ) ; String eventCategory = topic [ 0 ] . substring ( 0 , 1 ) . toUpperCase ( ) + topic [ 0 ] . substring ( 1 ) ; String eventAction = topic [ 1 ] ; // get list of registered handlers
Object handler = EventManager . getInstance ( ) . getRegisteredClassHandlers ( ev... |
public class EurekaClinicalClient { /** * Gets the resource specified by the path . Sends to the server an Accepts
* header for JSON .
* @ param < T > the type of the resource .
* @ param path the path to the resource . Cannot be < code > null < / code > .
* @ param cls the type of the resource . Cannot be < co... | return doGet ( path , cls , null ) ; |
public class CodedOutputStream { /** * Write a little - endian 64 - bit integer . */
public void writeRawLittleEndian64 ( final long value ) throws IOException { } } | writeRawByte ( ( int ) ( value ) & 0xFF ) ; writeRawByte ( ( int ) ( value >> 8 ) & 0xFF ) ; writeRawByte ( ( int ) ( value >> 16 ) & 0xFF ) ; writeRawByte ( ( int ) ( value >> 24 ) & 0xFF ) ; writeRawByte ( ( int ) ( value >> 32 ) & 0xFF ) ; writeRawByte ( ( int ) ( value >> 40 ) & 0xFF ) ; writeRawByte ( ( int ) ( va... |
public class MyBatis { /** * Create a PreparedStatement for SELECT requests with scrolling of results */
public PreparedStatement newScrollingSelectStatement ( DbSession session , String sql ) { } } | int fetchSize = database . getDialect ( ) . getScrollDefaultFetchSize ( ) ; return newScrollingSelectStatement ( session , sql , fetchSize ) ; |
public class AbstractClassOption { /** * Sets current object .
* @ param obj the object to set as current . */
public void setCurrentObject ( Object obj ) { } } | if ( ( ( obj == null ) && ( this . nullString != null ) ) || this . requiredType . isInstance ( obj ) || ( obj instanceof String ) || ( obj instanceof File ) // | | ( ( obj instanceof Task ) & & this . requiredType . isAssignableFrom ( ( ( Task ) obj ) . getTaskResultType ( ) ) )
) { this . currentValue = obj ; } else ... |
public class GeometryTools { /** * Returns the geometric center of all the rings in this ringset .
* See comment for center ( IAtomContainer atomCon , Dimension areaDim , HashMap renderingCoordinates ) for details on coordinate sets
* @ param ringSet Description of the Parameter
* @ return the geometric center of... | double centerX = 0 ; double centerY = 0 ; for ( int i = 0 ; i < ringSet . getAtomContainerCount ( ) ; i ++ ) { Point2d centerPoint = get2DCenter ( ( IRing ) ringSet . getAtomContainer ( i ) ) ; centerX += centerPoint . x ; centerY += centerPoint . y ; } return new Point2d ( centerX / ( ( double ) ringSet . getAtomConta... |
public class OgmCollectionPersister { /** * Centralize the RowKey column setting logic as the values settings are slightly different between insert / update and delete */
private RowKeyBuilder initializeRowKeyBuilder ( ) { } } | RowKeyBuilder builder = new RowKeyBuilder ( ) ; if ( hasIdentifier ) { builder . addColumns ( getIdentifierColumnName ( ) ) ; } else { builder . addColumns ( getKeyColumnNames ( ) ) ; // ! isOneToMany ( ) present in delete not in update
if ( ! isOneToMany ( ) && hasIndex && ! indexContainsFormula ) { builder . addIndex... |
public class BindMapHelper { /** * Parse a list .
* @ param context the context
* @ param parser the parser
* @ param list the list
* @ param skipRead the skip read
* @ return the list */
static List < Object > parseList ( AbstractContext context , JsonParser parser , List < Object > list , boolean skipRead )... | try { if ( ! skipRead ) { parser . nextToken ( ) ; } if ( parser . currentToken ( ) != JsonToken . START_ARRAY ) { throw ( new KriptonRuntimeException ( "Invalid input format" ) ) ; } skipRead = false ; JsonToken token ; do { if ( skipRead ) { token = parser . getCurrentToken ( ) ; } else { token = parser . nextToken (... |
public class SocketChannelController { /** * Confiure socket channel
* @ param sc
* @ throws IOException */
protected final void configureSocketChannel ( SocketChannel sc ) throws IOException { } } | sc . socket ( ) . setSoTimeout ( this . soTimeout ) ; sc . configureBlocking ( false ) ; if ( this . socketOptions . get ( StandardSocketOption . SO_REUSEADDR ) != null ) { sc . socket ( ) . setReuseAddress ( StandardSocketOption . SO_REUSEADDR . type ( ) . cast ( this . socketOptions . get ( StandardSocketOption . SO_... |
public class CompressionUtils { /** * Get the file name without the . gz extension
* @ param fname The name of the gzip file
* @ return fname without the " . gz " extension
* @ throws IAE if fname is not a valid " * . gz " file name */
public static String getGzBaseName ( String fname ) { } } | final String reducedFname = Files . getNameWithoutExtension ( fname ) ; if ( isGz ( fname ) && ! reducedFname . isEmpty ( ) ) { return reducedFname ; } throw new IAE ( "[%s] is not a valid gz file name" , fname ) ; |
public class UniprotProxySequenceReader { /** * Open a URL connection .
* Follows redirects .
* @ param url
* @ throws IOException */
private static HttpURLConnection openURLConnection ( URL url ) throws IOException { } } | // This method should be moved to a utility class in BioJava 5.0
final int timeout = 5000 ; final String useragent = "BioJava" ; HttpURLConnection conn = ( HttpURLConnection ) url . openConnection ( ) ; conn . setRequestProperty ( "User-Agent" , useragent ) ; conn . setInstanceFollowRedirects ( true ) ; conn . setConne... |
public class HttpClientIntroductionAdvice { /** * Interceptor to apply headers , cookies , parameter and body arguements .
* @ param context The context
* @ return httpClient or future */
@ Override public Object intercept ( MethodInvocationContext < Object , Object > context ) { } } | AnnotationValue < Client > clientAnnotation = context . findAnnotation ( Client . class ) . orElseThrow ( ( ) -> new IllegalStateException ( "Client advice called from type that is not annotated with @Client: " + context ) ) ; HttpClient httpClient = getClient ( context , clientAnnotation ) ; Class < ? > declaringType ... |
public class CalculateDateExtensions { /** * Adds minutes to the given Date object and returns it . Note : you can add negative values too
* for get date in past .
* @ param date
* The Date object to add the minutes .
* @ param addMinutes
* The days to add .
* @ return The resulted Date object . */
public s... | final Calendar dateOnCalendar = Calendar . getInstance ( ) ; dateOnCalendar . setTime ( date ) ; dateOnCalendar . add ( Calendar . MINUTE , addMinutes ) ; return dateOnCalendar . getTime ( ) ; |
public class ResultSetConstraint { /** * Retrieve the { @ link WQUriControlField # EXPAND } parameter as a Set ( or " all " if none is defined )
* @ return */
public Set < String > getExpand ( ) { } } | List < String > values = parameters . get ( WQUriControlField . EXPAND . getName ( ) ) ; if ( values == null || values . isEmpty ( ) ) return Collections . singleton ( "all" ) ; else return new HashSet < > ( values ) ; |
public class sdx_license { /** * Use this operation to get SDX license information . */
public static sdx_license get ( nitro_service client ) throws Exception { } } | sdx_license resource = new sdx_license ( ) ; resource . validate ( "get" ) ; return ( ( sdx_license [ ] ) resource . get_resources ( client ) ) [ 0 ] ; |
public class EclipseHack { /** * Constructs a map from name to method of the no - argument methods in the given type . We need this
* because an ExecutableElement returned by { @ link Elements # getAllMembers } will not compare equal
* to the original ExecutableElement if { @ code getAllMembers } substituted type p... | TypeElement autoValueType = MoreElements . asType ( typeUtils . asElement ( in ) ) ; List < ExecutableElement > allMethods = ElementFilter . methodsIn ( elementUtils . getAllMembers ( autoValueType ) ) ; Map < Name , ExecutableElement > map = new LinkedHashMap < Name , ExecutableElement > ( ) ; for ( ExecutableElement ... |
public class JMPath { /** * Apply sub file paths and get applied list list .
* @ param < R > the type parameter
* @ param startDirectoryPath the start directory path
* @ param maxDepth the max depth
* @ param function the function
* @ return the list */
public static < R > List < R > applySubFilePathsAndGetAp... | return applySubFilePathsAndGetAppliedList ( startDirectoryPath , maxDepth , JMPredicate . getTrue ( ) , function ) ; |
public class ClusterHeartbeatManager { /** * Removes the { @ code member } if it has not sent any heartbeats in { @ link GroupProperty # MAX _ NO _ HEARTBEAT _ SECONDS } .
* If it has not sent any heartbeats in { @ link # HEART _ BEAT _ INTERVAL _ FACTOR } heartbeat intervals , it will log a warning .
* @ param now... | if ( clusterService . getMembershipManager ( ) . isMemberSuspected ( member . getAddress ( ) ) ) { return true ; } long lastHeartbeat = heartbeatFailureDetector . lastHeartbeat ( member ) ; if ( ! heartbeatFailureDetector . isAlive ( member , now ) ) { double suspicionLevel = heartbeatFailureDetector . suspicionLevel (... |
public class SubtypeOperator { /** * Check whether a type is equivalent to < code > void < / code > or not . The
* complexities of Whiley ' s type system mean that this is not always obvious .
* For example , the type < code > int & ( ! int ) < / code > is equivalent to
* < code > void < / code > . Likewise , is ... | return emptinessTest . isVoid ( type , EmptinessTest . PositiveMax , type , EmptinessTest . PositiveMax , lifetimes ) ; |
public class KafkaHelper { /** * Creates a new { @ link KafkaProducer } instance , with custom configuration
* properties .
* Note : custom configuration properties will be populated < i > after < / i > and
* < i > additional / overridden < / i > to the default configuration .
* @ param type
* @ param bootstr... | Properties props = buildKafkaProducerProps ( type , bootstrapServers , customProps ) ; KafkaProducer < String , byte [ ] > producer = new KafkaProducer < > ( props ) ; return producer ; |
public class CacheOnDisk { /** * This method is used to update expiration times in GC and disk emtry header */
public int updateExpirationTime ( Object id , long oldExpirationTime , int size , long newExpirationTime , long newValidatorExpirationTime ) { } } | int returnCode = this . htod . updateExpirationTime ( id , oldExpirationTime , size , newExpirationTime , newValidatorExpirationTime ) ; if ( returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( this . htod . diskCacheException ) ; } return returnCode ; |
public class PhotosLicensesApi { /** * Fetches a list of available photo licenses for Flickr .
* < br >
* This method does not require authentication .
* @ return object containing a list of currently available licenses .
* @ throws JinxException if there are any errors .
* @ see < a href = " https : / / www ... | Map < String , String > params = new TreeMap < > ( ) ; params . put ( "method" , "flickr.photos.licenses.getInfo" ) ; return jinx . flickrGet ( params , Licenses . class , false ) ; |
public class DistributedWorkManagerStatisticsImpl { /** * Send : doWork accepted */
void sendDeltaDoWorkAccepted ( ) { } } | doWorkAccepted . incrementAndGet ( ) ; if ( trace ) log . tracef ( "sendDeltaDoWorkAccepted: %s" , workManagers ) ; if ( own != null && transport != null && transport . isInitialized ( ) ) { for ( Address address : workManagers ) { if ( ! own . equals ( address ) ) transport . deltaDoWorkAccepted ( address ) ; } } |
public class TrackerStats { /** * Increment the number of succeeded tasks on a tracker .
* @ param trackerName The name of the tracker . */
public void recordSucceededTask ( String trackerName ) { } } | synchronized ( this ) { NodeUsageReport usageReport = getReportUnprotected ( trackerName ) ; usageReport . setNumSucceeded ( usageReport . getNumSucceeded ( ) + 1 ) ; } |
public class SQLExpressions { /** * REGR _ AVGX evaluates the average of the independent variable ( arg2 ) of the regression line .
* @ param arg1 first arg
* @ param arg2 second arg
* @ return regr _ avgx ( arg1 , arg2) */
public static WindowOver < Double > regrAvgx ( Expression < ? extends Number > arg1 , Expr... | return new WindowOver < Double > ( Double . class , SQLOps . REGR_AVGX , arg1 , arg2 ) ; |
public class WaveBase { /** * { @ inheritDoc } */
@ Override public Wave waveBeanList ( final List < WaveBean > waveBeanList ) { } } | if ( waveBeanList != null && ! waveBeanList . isEmpty ( ) ) { waveBeanList . forEach ( wb -> getWaveBeanMap ( ) . put ( wb . getClass ( ) , wb ) ) ; } return this ; |
public class PojoDataParser { /** * { @ inheritDoc } */
@ NonNull @ Override public Card parseSingleGroup ( @ Nullable JSONObject data , final ServiceManager serviceManager ) { } } | if ( data == null ) { return Card . NaN ; } final CardResolver cardResolver = serviceManager . getService ( CardResolver . class ) ; Preconditions . checkState ( cardResolver != null , "Must register CardResolver into ServiceManager first" ) ; final MVHelper cellResolver = serviceManager . getService ( MVHelper . class... |
public class ZooClassDef { /** * Only to be used during database startup to load the schema - tree .
* @ param superDef The super class */
public void associateSuperDef ( ZooClassDef superDef ) { } } | if ( this . superDef != null ) { throw new IllegalStateException ( ) ; } if ( superDef == null ) { throw new IllegalArgumentException ( ) ; } // class invariant
if ( superDef . getOid ( ) != oidSuper ) { throw new IllegalStateException ( "s-oid= " + oidSuper + " / " + superDef . getOid ( ) + " class=" + className ) ; ... |
public class AbstractIoSession { /** * TODO Add method documentation */
private String getServiceName ( ) { } } | TransportMetadata tm = getTransportMetadata ( ) ; if ( tm == null ) { return "null" ; } return tm . getProviderName ( ) + ' ' + tm . getName ( ) ; |
public class PendingCloudwatchLogsExports { /** * Log types that are in the process of being enabled . After they are enabled , these log types are exported to
* CloudWatch Logs .
* @ return Log types that are in the process of being enabled . After they are enabled , these log types are exported
* to CloudWatch ... | if ( logTypesToDisable == null ) { logTypesToDisable = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return logTypesToDisable ; |
public class MCDRGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . MCDRG__RG_LENGTH : setRGLength ( RG_LENGTH_EDEFAULT ) ; return ; case AfplibPackage . MCDRG__TRIPLETS : getTriplets ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ; |
public class GenericDataSinkBase { /** * Sets the sink to partition the records into ranges over the given ordering .
* The bucket boundaries are determined using the given data distribution .
* @ param partitionOrdering The record ordering over which to partition in ranges .
* @ param distribution The distributi... | if ( partitionOrdering . getNumberOfFields ( ) != distribution . getNumberOfFields ( ) ) { throw new IllegalArgumentException ( "The number of keys in the distribution must match number of ordered fields." ) ; } // TODO : check compatibility of distribution and ordering ( number and order of keys , key types , etc .
//... |
public class RolloverLogBase { /** * Tries to open the log . Called from inside _ logLock */
private void openLog ( ) { } } | closeLogStream ( ) ; WriteStream os = _os ; _os = null ; IoUtil . close ( os ) ; Path path = getPath ( ) ; if ( path == null ) { path = getPath ( CurrentTime . currentTime ( ) ) ; } Path parent = path . getParent ( ) ; try { if ( ! Files . isDirectory ( parent ) ) { Files . createDirectory ( parent ) ; } } catch ( Exce... |
public class S3Dispatcher { /** * Handles PUT / bucket / id
* @ param ctx the context describing the current request
* @ param bucket the bucket containing the object to upload
* @ param id name of the object to upload */
private void putObject ( WebContext ctx , Bucket bucket , String id , InputStreamHandler inp... | StoredObject object = bucket . getObject ( id ) ; if ( inputStream == null ) { signalObjectError ( ctx , HttpResponseStatus . BAD_REQUEST , "No content posted" ) ; return ; } try ( FileOutputStream out = new FileOutputStream ( object . getFile ( ) ) ) { ByteStreams . copy ( inputStream , out ) ; } Map < String , String... |
public class AutoScalingSettingsDescription { /** * Information about the scaling policies .
* @ param scalingPolicies
* Information about the scaling policies . */
public void setScalingPolicies ( java . util . Collection < AutoScalingPolicyDescription > scalingPolicies ) { } } | if ( scalingPolicies == null ) { this . scalingPolicies = null ; return ; } this . scalingPolicies = new java . util . ArrayList < AutoScalingPolicyDescription > ( scalingPolicies ) ; |
public class HiCO { /** * Computes the correlation distance between the two subspaces defined by the
* specified PCAs .
* @ param pca1 first PCA
* @ param pca2 second PCA
* @ param dimensionality the dimensionality of the data space
* @ return the correlation distance between the two subspaces defined by the ... | // TODO : Can we delay copying the matrixes ?
// pca of rv1
double [ ] [ ] v1t = copy ( pca1 . getEigenvectors ( ) ) ; double [ ] [ ] v1t_strong = pca1 . getStrongEigenvectors ( ) ; int lambda1 = pca1 . getCorrelationDimension ( ) ; // pca of rv2
double [ ] [ ] v2t = copy ( pca2 . getEigenvectors ( ) ) ; double [ ] [ ]... |
public class MgmtSystemManagementResource { /** * Returns a list of all caches .
* @ return a list of caches for all tenants */
@ Override @ PreAuthorize ( SpringEvalExpressions . HAS_AUTH_SYSTEM_ADMIN ) public ResponseEntity < Collection < MgmtSystemCache > > getCaches ( ) { } } | final Collection < String > cacheNames = cacheManager . getCacheNames ( ) ; return ResponseEntity . ok ( cacheNames . stream ( ) . map ( cacheManager :: getCache ) . map ( this :: cacheRest ) . collect ( Collectors . toList ( ) ) ) ; |
public class Gamma { /** * log of the Gamma function . Lanczos approximation ( 6 terms ) */
public static double lgamma ( double x ) { } } | double xcopy = x ; double fg = 0.0 ; double first = x + LANCZOS_SMALL_GAMMA + 0.5 ; double second = LANCZOS_COEFF [ 0 ] ; if ( x >= 0.0 ) { if ( x >= 1.0 && x - ( int ) x == 0.0 ) { fg = Math . logFactorial ( ( int ) x - 1 ) ; } else { first -= ( x + 0.5 ) * Math . log ( first ) ; for ( int i = 1 ; i <= LANCZOS_N ; i +... |
public class StopMojo { /** * Tries to stops the running Wisdom server .
* @ throws MojoExecutionException if the Wisdom server cannot be stopped */
@ Override public void execute ( ) throws MojoExecutionException { } } | new WisdomExecutor ( ) . stop ( this ) ; File pid = new File ( getWisdomRootDirectory ( ) , "RUNNING_PID" ) ; if ( WisdomExecutor . waitForFileDeletion ( pid ) ) { getLog ( ) . info ( "Wisdom server stopped." ) ; } else { throw new MojoExecutionException ( "The " + pid . getName ( ) + " file still exists after having s... |
public class CmsADEConfigCacheState { /** * Gets all the detail pages for a given type . < p >
* @ param type the name of the type
* @ return the detail pages for that type */
protected List < String > getDetailPages ( String type ) { } } | List < String > result = new ArrayList < String > ( ) ; for ( CmsADEConfigDataInternal configData : m_siteConfigurationsByPath . values ( ) ) { for ( CmsDetailPageInfo pageInfo : wrap ( configData ) . getDetailPagesForType ( type ) ) { result . add ( pageInfo . getUri ( ) ) ; } } return result ; |
public class Transporter { /** * - - - SUBSCRIBE - - - */
public Promise subscribe ( String cmd , String nodeID ) { } } | return subscribe ( channel ( cmd , nodeID ) ) ; |
public class LineItemSummary { /** * Sets the creationDateTime value for this LineItemSummary .
* @ param creationDateTime * This attribute may be { @ code null } for line items created before
* this feature was introduced . */
public void setCreationDateTime ( com . google . api . ads . admanager . axis . v201808 ... | this . creationDateTime = creationDateTime ; |
public class ToStream { /** * Receive notification of character data .
* @ param s The string of characters to process .
* @ throws org . xml . sax . SAXException */
public void characters ( String s ) throws org . xml . sax . SAXException { } } | if ( m_inEntityRef && ! m_expandDTDEntities ) return ; final int length = s . length ( ) ; if ( length > m_charsBuff . length ) { m_charsBuff = new char [ length * 2 + 1 ] ; } s . getChars ( 0 , length , m_charsBuff , 0 ) ; characters ( m_charsBuff , 0 , length ) ; |
public class Model { /** * Finder method for DB queries based on table represented by this model . Usually the SQL starts with :
* < code > " select * from table _ name where " + subquery < / code > where table _ name is a table represented by this model .
* Code example :
* < pre >
* List < Person > teenagers ... | return ModelDelegate . where ( Model . < T > modelClass ( ) , subquery , params ) ; |
public class PdfPSXObject { /** * Gets the stream representing this object .
* @ paramcompressionLevelthe compressionLevel
* @ return the stream representing this template
* @ since2.1.3 ( replacing the method without param compressionLevel )
* @ throws IOException */
PdfStream getFormXObject ( int compressionL... | PdfStream s = new PdfStream ( content . toByteArray ( ) ) ; s . put ( PdfName . TYPE , PdfName . XOBJECT ) ; s . put ( PdfName . SUBTYPE , PdfName . PS ) ; s . flateCompress ( compressionLevel ) ; return s ; |
public class ElementPlugin { /** * Unregisters a listener for the IPluginEvent callback event .
* @ param listener Listener to be unregistered . */
public void unregisterListener ( IPluginEventListener listener ) { } } | if ( pluginEventListeners2 != null && pluginEventListeners2 . contains ( listener ) ) { pluginEventListeners2 . remove ( listener ) ; listener . onPluginEvent ( new PluginEvent ( this , PluginAction . UNSUBSCRIBE ) ) ; } |
public class SemiTransactionalHiveMetastore { /** * TODO : Allow updating statistics for 2 tables in the same transaction */
public synchronized void setPartitionStatistics ( Table table , Map < List < String > , PartitionStatistics > partitionStatisticsMap ) { } } | setExclusive ( ( delegate , hdfsEnvironment ) -> partitionStatisticsMap . forEach ( ( partitionValues , newPartitionStats ) -> delegate . updatePartitionStatistics ( table . getDatabaseName ( ) , table . getTableName ( ) , getPartitionName ( table , partitionValues ) , oldPartitionStats -> updatePartitionStatistics ( o... |
public class DatePickerSettings { /** * zApplyAllowKeyboardEditing , This applies the named setting to the parent component . */
void zApplyAllowKeyboardEditing ( ) { } } | if ( parentDatePicker == null ) { return ; } // Set the editability of the date picker text field .
parentDatePicker . getComponentDateTextField ( ) . setEditable ( allowKeyboardEditing ) ; // Set the text field border color based on whether the text field is editable .
Color textFieldBorderColor = ( allowKeyboardEditi... |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getMMCPARAMETER1 ( ) { } } | if ( mmcparameter1EEnum == null ) { mmcparameter1EEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 50 ) ; } return mmcparameter1EEnum ; |
public class BigDecimal { /** * performs divideAndRound for ( dividend0 * dividend1 , divisor )
* returns null if quotient can ' t fit into long value ; */
private static BigDecimal multiplyDivideAndRound ( long dividend0 , long dividend1 , long divisor , int scale , int roundingMode , int preferredScale ) { } } | int qsign = Long . signum ( dividend0 ) * Long . signum ( dividend1 ) * Long . signum ( divisor ) ; dividend0 = Math . abs ( dividend0 ) ; dividend1 = Math . abs ( dividend1 ) ; divisor = Math . abs ( divisor ) ; // multiply dividend0 * dividend1
long d0_hi = dividend0 >>> 32 ; long d0_lo = dividend0 & LONG_MASK ; long... |
public class PropertyResolutionUtil { /** * Resolves a Union of System . env and System . getProperties ( ) and overridingProperties where the KeyValue - Pairs of the later have the highest precedence .
* @ param overridingProperties
* @ return Map or null if there are no entries that match the Persistence Filter {... | if ( overridingProperties == null ) { throw new IllegalArgumentException ( "the property 'overridingProperties' is not allowed to be null." ) ; } Map < String , String > overridingProperttiesCopy = new HashMap < > ( overridingProperties ) ; return mergeFilteredMaps ( getSystemJavaxPersistenceOverrides ( ) , overridingP... |
public class BaseEncoding { /** * Returns a { @ code ByteSink } that writes base - encoded bytes to the specified { @ code CharSink } . */
@ GwtIncompatible ( "ByteSink,CharSink" ) public final ByteSink encodingSink ( final CharSink encodedSink ) { } } | checkNotNull ( encodedSink ) ; return new ByteSink ( ) { @ Override public OutputStream openStream ( ) throws IOException { return encodingStream ( encodedSink . openStream ( ) ) ; } } ; |
public class Base64Encoder { /** * base64编码 , URL安全的
* @ param source 被编码的base64字符串
* @ param charset 字符集
* @ return 被加密后的字符串
* @ since 3.0.6 */
public static String encodeUrlSafe ( byte [ ] source , String charset ) { } } | return StrUtil . str ( encodeUrlSafe ( source , false ) , charset ) ; |
public class Translation { /** * Translates Google App Engine Datastore entities to Acid House
* { @ code AppEngineTransaction } entity with { @ code AppEngineDatastoreService } .
* @ param transactions Google App Engine Datastore entities .
* @ param datastore { @ code AppEngineDatastoreService } .
* @ return ... | AppEngineGlobalTransaction transaction = null ; Map < Long , Entity > logs = new TreeMap < Long , Entity > ( ) ; for ( Entity tx : transactions ) { if ( tx . getKind ( ) . equals ( TRANSACTION_KIND ) ) { transaction = new AppEngineGlobalTransaction ( tx . getKey ( ) . getName ( ) , null , null ) ; } else if ( tx . getK... |
public class DaySchedule { /** * Shuts down the DaySchedule thread . */
public void shutdown ( ) { } } | interrupt ( ) ; try { join ( ) ; } catch ( Exception x ) { _logger . log ( Level . WARNING , "Failed to see DaySchedule thread joining" , x ) ; } |
public class JdbcCpoAdapter { /** * Removes the Object from the datasource . The assumption is that the object exists in the datasource . This method
* stores the object in the datasource
* < pre > Example :
* < code >
* class SomeObject so = new SomeObject ( ) ;
* class CpoAdapter cpo = null ;
* try {
* ... | return processUpdateGroup ( obj , JdbcCpoAdapter . DELETE_GROUP , name , wheres , orderBy , nativeExpressions ) ; |
public class SAXSymbol { /** * Links left and right symbols together , i . e . removes this symbol from the string , also removing
* any old digram from the hash table .
* @ param left the left symbol .
* @ param right the right symbol . */
public static void join ( SAXSymbol left , SAXSymbol right ) { } } | // System . out . println ( " performing the join of " + getPayload ( left ) + " and "
// + getPayload ( right ) ) ;
// check for an OLD digram existence - i . e . left must have a next symbol
// if . n exists then we are joining TERMINAL symbols within the string , and must clean - up the
// old digram
if ( left . n !... |
public class GermanStyleRepeatedWordRule { /** * Is a unknown word ( has only letters and no PosTag ) */
private static boolean isUnknownWord ( AnalyzedTokenReadings token ) { } } | return token . isPosTagUnknown ( ) && token . getToken ( ) . length ( ) > 2 && token . getToken ( ) . matches ( "^[A-Za-zÄÖÜäöüß]+$" ) ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public FNCFNPRGLen createFNCFNPRGLenFromString ( EDataType eDataType , String initialValue ) { } } | FNCFNPRGLen result = FNCFNPRGLen . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class NodeIndexer { /** * Adds the path value to the document as the named field . The path
* value is converted to an indexable string value using the name space
* mappings with which this class has been created .
* @ param doc The document to which to add the field
* @ param fieldName The name of the f... | doc . add ( createFieldWithoutNorms ( fieldName , pathString . toString ( ) , PropertyType . PATH ) ) ; |
public class vpnvserver_sharefileserver_binding { /** * Use this API to fetch vpnvserver _ sharefileserver _ binding resources of given name . */
public static vpnvserver_sharefileserver_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | vpnvserver_sharefileserver_binding obj = new vpnvserver_sharefileserver_binding ( ) ; obj . set_name ( name ) ; vpnvserver_sharefileserver_binding response [ ] = ( vpnvserver_sharefileserver_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class ResourceObjectIncludeImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setObjName ( String newObjName ) { } } | String oldObjName = objName ; objName = newObjName ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . RESOURCE_OBJECT_INCLUDE__OBJ_NAME , oldObjName , objName ) ) ; |
public class ListSimulationApplicationsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListSimulationApplicationsRequest listSimulationApplicationsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listSimulationApplicationsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listSimulationApplicationsRequest . getVersionQualifier ( ) , VERSIONQUALIFIER_BINDING ) ; protocolMarshaller . marshall ( listSimulationApplicationsRe... |
public class PlacesSampleActivity { /** * Return the view to the DraggablePanelState : minimized , maximized , closed to the right or
* closed
* to the left .
* @ param draggableState to apply . */
private void updateDraggablePanelStateDelayed ( DraggableState draggableState ) { } } | Handler handler = new Handler ( ) ; switch ( draggableState ) { case MAXIMIZED : handler . postDelayed ( new Runnable ( ) { @ Override public void run ( ) { draggablePanel . maximize ( ) ; } } , DELAY_MILLIS ) ; break ; case MINIMIZED : handler . postDelayed ( new Runnable ( ) { @ Override public void run ( ) { draggab... |
public class AnnotationReader { /** * Returns a class annotation for the specified type if such an annotation is present , else null .
* @ param < A > the type of the annotation
* @ param clazz the target class
* @ param annClass the Class object corresponding to the annotation type
* @ return the target class ... | if ( xmlInfo != null && xmlInfo . containsClassInfo ( clazz . getName ( ) ) ) { final ClassInfo classInfo = xmlInfo . getClassInfo ( clazz . getName ( ) ) ; if ( classInfo . containsAnnotationInfo ( annClass . getName ( ) ) ) { AnnotationInfo annInfo = classInfo . getAnnotationInfo ( annClass . getName ( ) ) ; try { re... |
public class MainWindowController { /** * When the connectivity changes , we update the fields on the FX thread , we must not update
* any UI fields on the connection thread . */
private void updateConnectionDetails ( ) { } } | Stage stage = ( Stage ) platformLabel . getScene ( ) . getWindow ( ) ; connectedLabel . setText ( connected ? "YES" : "NO" ) ; remoteInfo . ifPresent ( remote -> { remoteNameLabel . setText ( remote . getName ( ) ) ; versionLabel . setText ( remote . getMajorVersion ( ) + "." + remote . getMinorVersion ( ) ) ; platform... |
public class DemonstrationBase { /** * Before invoking this function make sure waitingToOpenImage is false AND that the previous input has been stopped */
protected void openVideo ( boolean reopen , String ... filePaths ) { } } | synchronized ( lockStartingProcess ) { if ( startingProcess ) { System . out . println ( "Ignoring video request. Detected spamming" ) ; return ; } startingProcess = true ; } synchronized ( inputStreams ) { if ( inputStreams . size ( ) != filePaths . length ) throw new IllegalArgumentException ( "Input streams not equ... |
public class EntityManagerFactoryImpl { /** * Return an instance of Metamodel interface for access to the metamodel of
* the persistence unit .
* @ return Metamodel instance
* @ throws IllegalStateException
* if the entity manager factory has been closed
* @ see javax . persistence . EntityManagerFactory # ge... | if ( isOpen ( ) ) { MetamodelImpl metamodel = null ; for ( String pu : persistenceUnits ) { metamodel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( pu ) ; if ( metamodel != null ) { return metamodel ; } } // return
// KunderaMetadataManager . getMetamodel ( getPersistenceUnits ( ) ) ... |
public class Handler { /** * Update the remove list . Remove from main list and notify listeners . Notify featurable destroyed . */
private void updateRemove ( ) { } } | if ( willDelete ) { for ( final Integer id : toDelete ) { final Featurable featurable = featurables . get ( id ) ; for ( final HandlerListener listener : listeners ) { listener . notifyHandlableRemoved ( featurable ) ; } featurable . getFeature ( Identifiable . class ) . notifyDestroyed ( ) ; featurables . remove ( fea... |
public class SetUtil { /** * 如果set为null , 转化为一个安全的空Set .
* 注意返回的Set不可写 , 写入会抛出UnsupportedOperationException .
* @ see java . util . Collections # emptySet ( ) */
public static < T > Set < T > emptySetIfNull ( final Set < T > set ) { } } | return set == null ? ( Set < T > ) Collections . EMPTY_SET : set ; |
public class FreemarkerProfilingTransformer { /** * Makes sure that this transformer is only applied on Freemarker versions { @ code > = 2.3.23 } where the
* { @ link Environment # getCurrentTemplate ( ) } method was made public . This prevents nasty
* { @ link IllegalAccessError } s and { @ link NoSuchMethodError ... | try { return hasMethodThat ( named ( "getCurrentTemplate" ) . and ( ElementMatchers . < MethodDescription . InDefinedShape > isPublic ( ) ) . and ( takesArguments ( 0 ) ) ) . matches ( new TypeDescription . ForLoadedType ( Class . forName ( "freemarker.core.Environment" ) ) ) ; } catch ( ClassNotFoundException e ) { re... |
public class AbstractTraceRegion { /** * Returns the nested trace regions . The list does not necessarily contain all the regions that will be returned by
* the { @ link # leafIterator ( ) } .
* @ return the list of directly nested regions . */
public final List < AbstractTraceRegion > getNestedRegions ( ) { } } | if ( nestedRegions == null ) return Collections . emptyList ( ) ; return Collections . unmodifiableList ( nestedRegions ) ; |
public class V20170607164210_MigrateReopenedIndicesToAliases { /** * Create aliases for legacy reopened indices . */
@ Override public void upgrade ( ) { } } | this . indexSetService . findAll ( ) . stream ( ) . map ( mongoIndexSetFactory :: create ) . flatMap ( indexSet -> getReopenedIndices ( indexSet ) . stream ( ) ) . map ( indexName -> { LOG . debug ( "Marking index {} to be reopened using alias." , indexName ) ; return indexName ; } ) . forEach ( indices :: markIndexReo... |
public class BingVideosImpl { /** * The Video Trending Search API lets you search on Bing and get back a list of videos that are trending based on search requests made by others . The videos are broken out into different categories . For example , Top Music Videos . For a list of markets that support trending videos , ... | final String xBingApisSDK = "true" ; return service . trending ( xBingApisSDK , acceptLanguage , userAgent , clientId , clientIp , location , countryCode , market , safeSearch , setLang , textDecorations , textFormat ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < TrendingVideos > >... |
public class Configuration { /** * Set the default styles . the case of the keys are not important . The retrieval will be case
* insensitive .
* @ param defaultStyle the mapping from geometry type name ( point , polygon , etc . . . ) to the style
* to use for that type . */
public final void setDefaultStyle ( fi... | this . defaultStyle = new HashMap < > ( defaultStyle . size ( ) ) ; for ( Map . Entry < String , Style > entry : defaultStyle . entrySet ( ) ) { String normalizedName = GEOMETRY_NAME_ALIASES . get ( entry . getKey ( ) . toLowerCase ( ) ) ; if ( normalizedName == null ) { normalizedName = entry . getKey ( ) . toLowerCas... |
public class NwwPanel { /** * Set the globe as flat sphere . */
public void setFlatSphereGlobe ( ) { } } | Earth globe = new Earth ( ) ; globe . setElevationModel ( new ZeroElevationModel ( ) ) ; wwd . getModel ( ) . setGlobe ( globe ) ; wwd . getView ( ) . stopMovement ( ) ; wwd . redraw ( ) ; |
public class Caster { /** * converts a object to a QueryColumn , if possible , also variable declarations are allowed . this
* method is used within the generated bytecode
* @ param o
* @ return
* @ throws PageException
* @ info used in bytecode generation */
public static QueryColumn toQueryColumn ( Object o... | if ( o instanceof QueryColumn ) return ( QueryColumn ) o ; if ( o instanceof String ) { o = VariableInterpreter . getVariableAsCollection ( pc , ( String ) o ) ; if ( o instanceof QueryColumn ) return ( QueryColumn ) o ; } throw new CasterException ( o , "querycolumn" ) ; |
public class Request { /** * Asynchronously executes requests that have already been serialized into an HttpURLConnection . No validation is
* done that the contents of the connection actually reflect the serialized requests , so it is the caller ' s
* responsibility to ensure that it will correctly generate the de... | Validate . notNull ( connection , "connection" ) ; RequestAsyncTask asyncTask = new RequestAsyncTask ( connection , requests ) ; requests . setCallbackHandler ( callbackHandler ) ; asyncTask . executeOnSettingsExecutor ( ) ; return asyncTask ; |
public class SibRaSingleProcessListener { /** * Returns the maximum number of active messages that should be associated
* with this listener at any one time .
* @ return int max active messages */
int getMaxActiveMessages ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { final String methodName = "getMaxActiveMessages" ; SibTr . entry ( this , TRACE , methodName ) ; } // The field max active messages is used to represent the default max
// active messages , however , on distributed systems we ignore this
//... |
public class SimpleParserImpl { /** * value = object | array | number | string | " true " | " false " | " null " . */
public Object parseValue ( ) { } } | Object val ; switch ( T . getType ( ) ) { case LCURLY : val = parseObject ( ) ; break ; case LSQUARE : val = parseArray ( ) ; break ; case INTEGER : if ( useBig ) { val = new BigInteger ( T . getString ( ) ) ; } else { try { val = Integer . parseInt ( T . getString ( ) ) ; } catch ( NumberFormatException e0 ) { // we h... |
public class Crossfader { /** * add the values to the bundle for saveInstanceState
* @ param savedInstanceState
* @ return */
public Bundle saveInstanceState ( Bundle savedInstanceState ) { } } | if ( savedInstanceState != null ) { savedInstanceState . putBoolean ( BUNDLE_CROSS_FADED , mCrossFadeSlidingPaneLayout . isOpen ( ) ) ; } return savedInstanceState ; |
public class JDBCResultSet { /** * < ! - - start generic documentation - - >
* Updates the designated column with a < code > float < / code > value .
* The updater methods are used to update column values in the
* current row or the insert row . The updater methods do not
* update the underlying database ; inst... | Double value = new Double ( x ) ; startUpdate ( columnIndex ) ; preparedStatement . setParameter ( columnIndex , value ) ; |
public class Matrix4d { /** * Set < code > this < / code > matrix to < code > T * R * S * M < / code > , where < code > T < / code > is the given < code > translation < / code > ,
* < code > R < / code > is a rotation - and possibly scaling - transformation specified by the given quaternion , < code > S < / code > is... | return translationRotateScaleMulAffine ( translation . x ( ) , translation . y ( ) , translation . z ( ) , quat . x ( ) , quat . y ( ) , quat . z ( ) , quat . w ( ) , scale . x ( ) , scale . y ( ) , scale . z ( ) , m ) ; |
public class EventDataDeserializer { /** * Deserialize JSON into super class { @ code StripeObject } where the underlying concrete class
* corresponds to type specified in root - level { @ code object } field of the JSON input .
* < p > Note that the expected JSON input is data at the { @ code object } value , as a... | String type = eventDataObjectJson . getAsJsonObject ( ) . get ( "object" ) . getAsString ( ) ; Class < ? extends StripeObject > cl = EventDataClassLookup . findClass ( type ) ; return ApiResource . GSON . fromJson ( eventDataObjectJson , cl != null ? cl : StripeRawJsonObject . class ) ; |
public class Script { /** * / * package private */
static BigInteger castToBigInteger ( final byte [ ] chunk , final int maxLength , final boolean requireMinimal ) throws ScriptException { } } | if ( chunk . length > maxLength ) throw new ScriptException ( ScriptError . SCRIPT_ERR_UNKNOWN_ERROR , "Script attempted to use an integer larger than " + maxLength + " bytes" ) ; if ( requireMinimal && chunk . length > 0 ) { // Check that the number is encoded with the minimum possible
// number of bytes .
// If the m... |
public class FiveLetterFirstNameTextProducer { /** * { @ inheritDoc } */
@ Override public String getText ( ) { } } | int car = FIRST_NAMES . length - 1 ; return FIRST_NAMES [ RAND . nextInt ( car ) + 1 ] ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.