signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class TreeSHAP { /** * undo a previous extension of the decision path */
private void unwindPath ( PathPointer unique_path , int unique_depth , int path_index ) { } } | final float one_fraction = unique_path . get ( path_index ) . one_fraction ; final float zero_fraction = unique_path . get ( path_index ) . zero_fraction ; float next_one_portion = unique_path . get ( unique_depth ) . pweight ; for ( int i = unique_depth - 1 ; i >= 0 ; -- i ) { if ( one_fraction != 0 ) { final float tmp = unique_path . get ( i ) . pweight ; unique_path . get ( i ) . pweight = next_one_portion * ( unique_depth + 1 ) / ( ( i + 1 ) * one_fraction ) ; next_one_portion = tmp - unique_path . get ( i ) . pweight * zero_fraction * ( unique_depth - i ) / ( float ) ( unique_depth + 1 ) ; } else { unique_path . get ( i ) . pweight = ( unique_path . get ( i ) . pweight * ( unique_depth + 1 ) ) / ( zero_fraction * ( unique_depth - i ) ) ; } } for ( int i = path_index ; i < unique_depth ; ++ i ) { unique_path . get ( i ) . feature_index = unique_path . get ( i + 1 ) . feature_index ; unique_path . get ( i ) . zero_fraction = unique_path . get ( i + 1 ) . zero_fraction ; unique_path . get ( i ) . one_fraction = unique_path . get ( i + 1 ) . one_fraction ; } |
public class GeneratedDContactDaoImpl { /** * query - by method for field webPage
* @ param webPage the specified attribute
* @ return an Iterable of DContacts for the specified webPage */
public Iterable < DContact > queryByWebPage ( Object parent , java . lang . String webPage ) { } } | return queryByField ( parent , DContactMapper . Field . WEBPAGE . getFieldName ( ) , webPage ) ; |
public class HttpDateFormatImpl { /** * Parse the input value against the formatter but do not throw an exception
* if it fails to match , instead just return null .
* < br >
* @ param format
* @ param input
* @ return Date */
private Date attemptParse ( SimpleDateFormat format , String input ) { } } | ParsePosition pos = new ParsePosition ( 0 ) ; Date d = format . parse ( input , pos ) ; if ( 0 == pos . getIndex ( ) || pos . getIndex ( ) != input . length ( ) ) { // invalid format matching
return null ; } return d ; |
public class AbstractParamDialog { /** * Adds the given panel , with its { @ link Component # getName ( ) own name } , positioned under the given parents ( or root
* node if none given ) .
* If not sorted the panel is appended to existing panels .
* @ param parentParams the name of the parent nodes of the panel , might be { @ code null } .
* @ param panel the panel , must not be { @ code null } .
* @ param sort { @ code true } if the panel should be added in alphabetic order , { @ code false } otherwise */
public void addParamPanel ( String [ ] parentParams , AbstractParamPanel panel , boolean sort ) { } } | addParamPanel ( parentParams , panel . getName ( ) , panel , sort ) ; |
public class AbstractSlideModel { /** * { @ inheritDoc } */
@ Override public Animation getShowAnimation ( ) { } } | if ( this . showAnimation == null ) { this . showAnimation = buildAnimation ( getSlide ( ) . getShowAnimation ( ) ) ; } return this . showAnimation ; |
public class StoredPaymentChannelClientStates { /** * Finds an inactive channel with the given id and returns it , or returns null . */
@ Nullable StoredClientChannel getUsableChannelForServerID ( Sha256Hash id ) { } } | lock . lock ( ) ; try { Set < StoredClientChannel > setChannels = mapChannels . get ( id ) ; for ( StoredClientChannel channel : setChannels ) { synchronized ( channel ) { // Check if the channel is usable ( has money , inactive ) and if so , activate it .
log . info ( "Considering channel {} contract {}" , channel . hashCode ( ) , channel . contract . getTxId ( ) ) ; if ( channel . close != null || channel . valueToMe . equals ( Coin . ZERO ) ) { log . info ( " ... but is closed or empty" ) ; continue ; } if ( ! channel . active ) { log . info ( " ... activating" ) ; channel . active = true ; return channel ; } log . info ( " ... but is already active" ) ; } } } finally { lock . unlock ( ) ; } return null ; |
public class Value { /** * Set persistence to HDFS from ICE */
public void setHdfs ( ) { } } | assert onICE ( ) ; byte [ ] mem = memOrLoad ( ) ; // Get into stable memory
_persist = Value . HDFS | Value . NOTdsk ; Persist . I [ Value . HDFS ] . store ( this ) ; removeIce ( ) ; // Remove from ICE disk
assert onHDFS ( ) ; // Flip to HDFS
_mem = mem ; // Close a race with the H2O cleaner zapping _ mem while removing from ice |
public class AppsInner { /** * Get the metadata of an IoT Central application .
* @ param resourceGroupName The name of the resource group that contains the IoT Central application .
* @ param resourceName The ARM resource name of the IoT Central application .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the AppInner object */
public Observable < AppInner > getByResourceGroupAsync ( String resourceGroupName , String resourceName ) { } } | return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , resourceName ) . map ( new Func1 < ServiceResponse < AppInner > , AppInner > ( ) { @ Override public AppInner call ( ServiceResponse < AppInner > response ) { return response . body ( ) ; } } ) ; |
public class TerminZooKeeperArbitrateEvent { /** * < pre >
* 算法 :
* 1 . 客户端处理完成对应的termin事件后 , 反馈给仲裁器处理完成 。 仲裁器根据对应S . E . T . L的反馈情况 , 判断是否删除对应的termin信号
* < / pre > */
public void ack ( TerminEventData data ) { } } | Assert . notNull ( data ) ; // 目前只有select模块需要发送ack信号 , 这里一旦收到一个信号后就删除对应的termin节点 , 后续可扩展
// 删除termin节点
String path = StagePathUtils . getTermin ( data . getPipelineId ( ) , data . getProcessId ( ) ) ; try { zookeeper . delete ( path ) ; } catch ( ZkNoNodeException e ) { // ignore , 说明节点已经被删除
} catch ( ZkException e ) { throw new ArbitrateException ( "Termin_ack" , e ) ; } TerminMonitor terminMonitor = ArbitrateFactory . getInstance ( data . getPipelineId ( ) , TerminMonitor . class ) ; terminMonitor . ack ( data . getProcessId ( ) ) ; |
public class Dim { /** * Returns an array of all functions in the given script . */
private static DebuggableScript [ ] getAllFunctions ( DebuggableScript function ) { } } | ObjArray functions = new ObjArray ( ) ; collectFunctions_r ( function , functions ) ; DebuggableScript [ ] result = new DebuggableScript [ functions . size ( ) ] ; functions . toArray ( result ) ; return result ; |
public class JClassWrapper { /** * Returns the public methods . */
public JMethod [ ] getMethods ( ) { } } | Method [ ] methods = _class . getMethods ( ) ; JMethod [ ] jMethods = new JMethod [ methods . length ] ; for ( int i = 0 ; i < methods . length ; i ++ ) { jMethods [ i ] = new JMethodWrapper ( methods [ i ] , getClassLoader ( ) ) ; } return jMethods ; |
public class ModelBuilder { /** * Convert a string like " abcs " to " abc " . */
private static String depluralize ( String s ) { } } | if ( s . endsWith ( "ies" ) ) { return s . substring ( 0 , s . length ( ) - 3 ) + 'y' ; } if ( s . endsWith ( "s" ) ) { return s . substring ( 0 , s . length ( ) - 1 ) ; } return s ; |
public class CsvItemReader { /** * readTitle .
* @ return an array of { @ link java . lang . String } objects . */
public String [ ] readTitle ( ) { } } | try { reader . readLine ( ) ; return Strings . split ( reader . readLine ( ) , "," ) ; } catch ( Exception e ) { throw new RuntimeException ( e . getMessage ( ) ) ; } |
public class WebAppHttpContext { /** * Searches for the resource in the bundle that published the service .
* @ see org . osgi . service . http . HttpContext # getResource ( String ) */
public URL getResource ( final String name ) { } } | final String normalizedName = Path . normalizeResourcePath ( rootPath + ( name . startsWith ( "/" ) ? "" : "/" ) + name ) . trim ( ) ; log . debug ( "Searching bundle " + bundle + " for resource [{}], normalized to [{}]" , name , normalizedName ) ; URL url = resourceCache . get ( normalizedName ) ; if ( url == null && ! normalizedName . isEmpty ( ) ) { url = bundle . getEntry ( normalizedName ) ; if ( url == null ) { log . debug ( "getEntry failed, trying with /META-INF/resources/ in bundle class space" ) ; // Search attached bundles for web - fragments
Set < Bundle > bundlesInClassSpace = ClassPathUtil . getBundlesInClassSpace ( bundle , new HashSet < > ( ) ) ; for ( Bundle bundleInClassSpace : bundlesInClassSpace ) { url = bundleInClassSpace . getEntry ( "/META-INF/resources/" + normalizedName ) ; if ( url != null ) { break ; } } } // obviously still not found might be available from a attached bundle resource
if ( url == null ) { log . debug ( "getEntry failed, fallback to getResource" ) ; url = bundle . getResource ( normalizedName ) ; } if ( url == null ) { url = NO_URL ; } resourceCache . putIfAbsent ( normalizedName , url ) ; } if ( url != null && url != NO_URL ) { log . debug ( "Resource found as url [{}]" , url ) ; } else { log . debug ( "Resource not found" ) ; url = null ; } return url ; |
public class Parser { /** * Pattern : : = . . . | " [ " Element ? ( " , " Element ? ) * " ] " */
private ParseTree parseArrayPattern ( PatternKind kind ) { } } | SourcePosition start = getTreeStartLocation ( ) ; ImmutableList . Builder < ParseTree > elements = ImmutableList . builder ( ) ; eat ( TokenType . OPEN_SQUARE ) ; while ( peek ( TokenType . COMMA ) || peekArrayPatternElement ( ) ) { if ( peek ( TokenType . COMMA ) ) { SourcePosition nullStart = getTreeStartLocation ( ) ; eat ( TokenType . COMMA ) ; elements . add ( new NullTree ( getTreeLocation ( nullStart ) ) ) ; } else { elements . add ( parsePatternAssignmentTarget ( kind ) ) ; if ( peek ( TokenType . COMMA ) ) { // Consume the comma separator
eat ( TokenType . COMMA ) ; } else { // Otherwise we must be done
break ; } } } if ( peek ( TokenType . SPREAD ) ) { recordFeatureUsed ( Feature . ARRAY_PATTERN_REST ) ; elements . add ( parsePatternRest ( kind ) ) ; } if ( eat ( TokenType . CLOSE_SQUARE ) == null ) { // If we get no closing bracket then return invalid tree to avoid compiler tripping
// downstream . It ' s needed only for IDE mode where compiler continues processing even if
// source has syntactic errors .
return new MissingPrimaryExpressionTree ( getTreeLocation ( getTreeStartLocation ( ) ) ) ; } return new ArrayPatternTree ( getTreeLocation ( start ) , elements . build ( ) ) ; |
public class ElementFactory { /** * Used by RelationEdge when it needs to reify a relation .
* Used by this factory when need to build an explicit relation
* @ return ReifiedRelation */
RelationReified buildRelationReified ( VertexElement vertex , RelationType type ) { } } | return RelationReified . create ( vertex , type ) ; |
public class CanalServiceImpl { /** * 添加 */
public void create ( final Canal canal ) { } } | Assert . assertNotNull ( canal ) ; transactionTemplate . execute ( new TransactionCallbackWithoutResult ( ) { protected void doInTransactionWithoutResult ( TransactionStatus status ) { try { CanalDO canalDO = modelToDo ( canal ) ; canalDO . setId ( 0L ) ; if ( ! canalDao . checkUnique ( canalDO ) ) { String exceptionCause = "exist the same repeat canal in the database." ; logger . warn ( "WARN ## " + exceptionCause ) ; throw new RepeatConfigureException ( exceptionCause ) ; } canalDao . insert ( canalDO ) ; canal . setId ( canalDO . getId ( ) ) ; } catch ( RepeatConfigureException rce ) { throw rce ; } catch ( Exception e ) { logger . error ( "ERROR ## create canal has an exception!" ) ; throw new ManagerException ( e ) ; } } } ) ; |
public class ApiOvhTelephony { /** * Alter this object properties
* REST : PUT / telephony / { billingAccount } / line / { serviceName } / options
* @ param body [ required ] New object properties
* @ param billingAccount [ required ] The name of your billingAccount
* @ param serviceName [ required ] */
public void billingAccount_line_serviceName_options_PUT ( String billingAccount , String serviceName , OvhLineOptions body ) throws IOException { } } | String qPath = "/telephony/{billingAccount}/line/{serviceName}/options" ; StringBuilder sb = path ( qPath , billingAccount , serviceName ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ; |
public class OctTreeNode { /** * Replies the zone of the specified child .
* @ param child the child .
* @ return the zone or < code > null < / code > . */
@ Pure public final OctTreeZone zoneOf ( N child ) { } } | final int idx = indexOf ( child ) ; final OctTreeZone [ ] zones = OctTreeZone . values ( ) ; if ( idx < 0 || idx >= zones . length ) { return zones [ idx ] ; } return null ; |
public class GroupBy { /** * Create a new aggregating sum expression
* @ param expression expression a for which the accumulated sum will be used in the group by projection
* @ return wrapper expression */
public static < E extends Number > AbstractGroupExpression < E , E > sum ( Expression < E > expression ) { } } | return new GSum < E > ( expression ) ; |
public class GetCompatibleElasticsearchVersionsResult { /** * A map of compatible Elasticsearch versions returned as part of the
* < code > < a > GetCompatibleElasticsearchVersions < / a > < / code > operation .
* @ param compatibleElasticsearchVersions
* A map of compatible Elasticsearch versions returned as part of the
* < code > < a > GetCompatibleElasticsearchVersions < / a > < / code > operation . */
public void setCompatibleElasticsearchVersions ( java . util . Collection < CompatibleVersionsMap > compatibleElasticsearchVersions ) { } } | if ( compatibleElasticsearchVersions == null ) { this . compatibleElasticsearchVersions = null ; return ; } this . compatibleElasticsearchVersions = new java . util . ArrayList < CompatibleVersionsMap > ( compatibleElasticsearchVersions ) ; |
public class GenericGenerators { /** * Generates instruction to push a null on to the stack .
* @ return instructions to push a null */
public static InsnList loadNull ( ) { } } | InsnList ret = new InsnList ( ) ; ret . add ( new InsnNode ( Opcodes . ACONST_NULL ) ) ; return ret ; |
public class scpolicy { /** * Use this API to update scpolicy . */
public static base_response update ( nitro_service client , scpolicy resource ) throws Exception { } } | scpolicy updateresource = new scpolicy ( ) ; updateresource . name = resource . name ; updateresource . url = resource . url ; updateresource . rule = resource . rule ; updateresource . delay = resource . delay ; updateresource . maxconn = resource . maxconn ; updateresource . action = resource . action ; updateresource . altcontentsvcname = resource . altcontentsvcname ; updateresource . altcontentpath = resource . altcontentpath ; return updateresource . update_resource ( client ) ; |
public class MMDCfgPanel { /** * GEN - LAST : event _ colorChooser1stTextActionPerformed */
private void colorChooser2ndBackgroundActionPerformed ( java . awt . event . ActionEvent evt ) { } } | // GEN - FIRST : event _ colorChooser2ndBackgroundActionPerformed
if ( this . colorChooser2ndBackground . isLastOkPressed ( ) && changeNotificationAllowed ) { this . controller . changed ( ) ; } |
public class PkEnumeration { /** * Returns the next element of this enumeration if this enumeration
* object has at least one more element to provide .
* @ return the next element of this enumeration .
* @ exception NoSuchElementException if no more elements exist . */
public Object nextElement ( ) { } } | try { if ( ! hasCalledCheck ) { hasMoreElements ( ) ; } hasCalledCheck = false ; if ( hasNext ) { Identity oid = getIdentityFromResultSet ( ) ; Identity [ ] args = { oid } ; return this . constructor . newInstance ( args ) ; } else throw new NoSuchElementException ( ) ; } catch ( Exception ex ) { LoggerFactory . getDefaultLogger ( ) . error ( ex ) ; throw new NoSuchElementException ( ) ; } |
public class FastPair { /** * Remove a point and update neighbors of points for which it had been nearest */
public void remove ( int p ) { } } | npoints -- ; int q = index [ p ] ; index [ points [ q ] = points [ npoints ] ] = q ; for ( int i = 0 ; i < npoints ; i ++ ) { if ( neighbor [ points [ i ] ] == p ) { findNeighbor ( points [ i ] ) ; } } |
public class VectorPackingPropagator { /** * recompute the sum of the min / max loads only if at least one variable bound has been updated outside of the constraint */
private void recomputeLoadSums ( ) { } } | loadsHaveChanged . set ( false ) ; for ( int d = 0 ; d < nbDims ; d ++ ) { int sli = 0 ; int sls = 0 ; for ( int b = 0 ; b < nbBins ; b ++ ) { sli += loads [ d ] [ b ] . getLB ( ) ; sls += loads [ d ] [ b ] . getUB ( ) ; } this . sumLoadInf [ d ] . set ( sli ) ; this . sumLoadSup [ d ] . set ( sls ) ; } |
public class FsJobArchivist { /** * Writes the given { @ link AccessExecutionGraph } to the { @ link FileSystem } pointed to by
* { @ link JobManagerOptions # ARCHIVE _ DIR } .
* @ param rootPath directory to which the archive should be written to
* @ param jobId job id
* @ param jsonToArchive collection of json - path pairs to that should be archived
* @ return path to where the archive was written , or null if no archive was created
* @ throws IOException */
public static Path archiveJob ( Path rootPath , JobID jobId , Collection < ArchivedJson > jsonToArchive ) throws IOException { } } | try { FileSystem fs = rootPath . getFileSystem ( ) ; Path path = new Path ( rootPath , jobId . toString ( ) ) ; OutputStream out = fs . create ( path , FileSystem . WriteMode . NO_OVERWRITE ) ; try ( JsonGenerator gen = jacksonFactory . createGenerator ( out , JsonEncoding . UTF8 ) ) { gen . writeStartObject ( ) ; gen . writeArrayFieldStart ( ARCHIVE ) ; for ( ArchivedJson archive : jsonToArchive ) { gen . writeStartObject ( ) ; gen . writeStringField ( PATH , archive . getPath ( ) ) ; gen . writeStringField ( JSON , archive . getJson ( ) ) ; gen . writeEndObject ( ) ; } gen . writeEndArray ( ) ; gen . writeEndObject ( ) ; } catch ( Exception e ) { fs . delete ( path , false ) ; throw e ; } LOG . info ( "Job {} has been archived at {}." , jobId , path ) ; return path ; } catch ( IOException e ) { LOG . error ( "Failed to archive job." , e ) ; throw e ; } |
public class Webcam { /** * Will discover and return first webcam available in the system .
* @ return Default webcam ( first from the list )
* @ throws WebcamException if something is really wrong
* @ see Webcam # getWebcams ( ) */
public static Webcam getDefault ( ) throws WebcamException { } } | try { return getDefault ( Long . MAX_VALUE ) ; } catch ( TimeoutException e ) { // this should never happen since user would have to wait 300000
// years for it to occur
throw new RuntimeException ( e ) ; } |
public class CmsVfsDriver { /** * Appends the appropriate selection criteria related with the resource type . < p >
* @ param projectId the id of the project of the resources
* @ param type the resource type
* @ param mode the selection mode
* @ param conditions buffer to append the selection criteria
* @ param params list to append the selection parameters */
protected void prepareTypeCondition ( CmsUUID projectId , int type , int mode , StringBuffer conditions , List < Object > params ) { } } | if ( type != CmsDriverManager . READ_IGNORE_TYPE ) { if ( ( mode & CmsDriverManager . READMODE_EXCLUDE_TYPE ) > 0 ) { // C _ READ _ FILE _ TYPES : add condition to match against any type , but not given type
conditions . append ( BEGIN_EXCLUDE_CONDITION ) ; conditions . append ( m_sqlManager . readQuery ( projectId , "C_RESOURCES_SELECT_BY_RESOURCE_TYPE" ) ) ; conditions . append ( END_CONDITION ) ; params . add ( new Integer ( type ) ) ; } else { // otherwise add condition to match against given type if necessary
conditions . append ( BEGIN_INCLUDE_CONDITION ) ; conditions . append ( m_sqlManager . readQuery ( projectId , "C_RESOURCES_SELECT_BY_RESOURCE_TYPE" ) ) ; conditions . append ( END_CONDITION ) ; params . add ( new Integer ( type ) ) ; } } |
public class Elements { /** * Registers a callback when an element is removed from the document body . Note that the callback will be called
* only once , if the element is removed and re - appended a new callback should be registered .
* @ param element the HTML element which is going to be removed from the body
* @ param callback { @ link ObserverCallback } */
public static void onDetach ( HTMLElement element , ObserverCallback callback ) { } } | if ( element != null ) { BodyObserver . addDetachObserver ( element , callback ) ; } |
public class AsyncPeriodicWork { /** * Schedules this periodic work now in a new thread , if one isn ' t already running . */
@ SuppressWarnings ( "deprecation" ) // in this case we really want to use PeriodicWork . logger since it reports the impl class
public final void doRun ( ) { } } | try { if ( thread != null && thread . isAlive ( ) ) { logger . log ( this . getSlowLoggingLevel ( ) , "{0} thread is still running. Execution aborted." , name ) ; return ; } thread = new Thread ( new Runnable ( ) { public void run ( ) { logger . log ( getNormalLoggingLevel ( ) , "Started {0}" , name ) ; long startTime = System . currentTimeMillis ( ) ; long stopTime ; StreamTaskListener l = createListener ( ) ; try { l . getLogger ( ) . printf ( "Started at %tc%n" , new Date ( startTime ) ) ; ACL . impersonate ( ACL . SYSTEM ) ; execute ( l ) ; } catch ( IOException e ) { Functions . printStackTrace ( e , l . fatalError ( e . getMessage ( ) ) ) ; } catch ( InterruptedException e ) { Functions . printStackTrace ( e , l . fatalError ( "aborted" ) ) ; } finally { stopTime = System . currentTimeMillis ( ) ; try { l . getLogger ( ) . printf ( "Finished at %tc. %dms%n" , new Date ( stopTime ) , stopTime - startTime ) ; } finally { l . closeQuietly ( ) ; } } logger . log ( getNormalLoggingLevel ( ) , "Finished {0}. {1,number} ms" , new Object [ ] { name , stopTime - startTime } ) ; } } , name + " thread" ) ; thread . start ( ) ; } catch ( Throwable t ) { LogRecord lr = new LogRecord ( this . getErrorLoggingLevel ( ) , "{0} thread failed with error" ) ; lr . setThrown ( t ) ; lr . setParameters ( new Object [ ] { name } ) ; logger . log ( lr ) ; } |
public class DynamoDBTableMapper { /** * Creates the table with the specified throughput ; also populates the same
* throughput for all global secondary indexes .
* @ param throughput The provisioned throughput .
* @ return The table decription .
* @ see com . amazonaws . services . dynamodbv2 . AmazonDynamoDB # createTable
* @ see com . amazonaws . services . dynamodbv2 . model . CreateTableRequest */
public TableDescription createTable ( ProvisionedThroughput throughput ) { } } | final CreateTableRequest request = mapper . generateCreateTableRequest ( model . targetType ( ) ) ; request . setProvisionedThroughput ( throughput ) ; if ( request . getGlobalSecondaryIndexes ( ) != null ) { for ( final GlobalSecondaryIndex gsi : request . getGlobalSecondaryIndexes ( ) ) { gsi . setProvisionedThroughput ( throughput ) ; } } return db . createTable ( request ) . getTableDescription ( ) ; |
public class TriggerDto { /** * Converts trigger entity to triggerDto object .
* @ param trigger trigger entity . Cannot be null .
* @ return triggerDto . */
public static TriggerDto transformToDto ( Trigger trigger ) { } } | TriggerDto result = createDtoObject ( TriggerDto . class , trigger ) ; // Now copy ID fields
result . setAlertId ( trigger . getAlert ( ) . getId ( ) ) ; for ( Notification notification : trigger . getNotifications ( ) ) { result . addNotificationIds ( notification ) ; } return result ; |
public class Company { /** * Returns for given parameter < i > _ uuid < / i > the instance of class
* { @ link Company } .
* @ param _ uuid UUI to search for
* @ return instance of class { @ link Company }
* @ throws CacheReloadException on error */
public static Company get ( final UUID _uuid ) throws CacheReloadException { } } | final Cache < UUID , Company > cache = InfinispanCache . get ( ) . < UUID , Company > getCache ( Company . UUIDCACHE ) ; if ( ! cache . containsKey ( _uuid ) ) { Company . getCompanyFromDB ( Company . SQL_UUID , String . valueOf ( _uuid ) ) ; } return cache . get ( _uuid ) ; |
public class GuiceInjectorBootstrap { /** * Creates an Injector by taking a preloaded service . properties and a pre - constructed GuiceSetup
* @ param properties
* @ param setup
* @ return */
public static Injector createInjector ( final PropertyFile configuration , final GuiceSetup setup ) { } } | return new GuiceBuilder ( ) . withConfig ( configuration ) . withSetup ( setup ) . build ( ) ; |
public class Conformance { /** * syntactic sugar */
public ConformanceRestComponent addRest ( ) { } } | ConformanceRestComponent t = new ConformanceRestComponent ( ) ; if ( this . rest == null ) this . rest = new ArrayList < ConformanceRestComponent > ( ) ; this . rest . add ( t ) ; return t ; |
public class StringUtils { /** * Test whether the given string matches the given substring at the given index .
* @ param str the original string ( or StringBuilder )
* @ param index the index in the original string to start matching against
* @ param substring the substring to match at the given index */
public static boolean substringMatch ( final CharSequence str , final int index , final CharSequence substring ) { } } | if ( index + substring . length ( ) > str . length ( ) ) { return false ; } for ( int i = 0 ; i < substring . length ( ) ; i ++ ) { if ( str . charAt ( index + i ) != substring . charAt ( i ) ) { return false ; } } return true ; |
public class JournalNodeHttpServer { /** * Get journal stats for webui . */
public static Map < String , Map < String , String > > getJournalStats ( Collection < Journal > journals ) { } } | Map < String , Map < String , String > > stats = new HashMap < String , Map < String , String > > ( ) ; for ( Journal j : journals ) { try { Map < String , String > stat = new HashMap < String , String > ( ) ; stats . put ( j . getJournalId ( ) , stat ) ; stat . put ( "Txid committed" , Long . toString ( j . getCommittedTxnId ( ) ) ) ; stat . put ( "Txid segment" , Long . toString ( j . getCurrentSegmentTxId ( ) ) ) ; stat . put ( "Txid written" , Long . toString ( j . getHighestWrittenTxId ( ) ) ) ; stat . put ( "Current lag" , Long . toString ( j . getCurrentLagTxns ( ) ) ) ; stat . put ( "Writer epoch" , Long . toString ( j . getLastWriterEpoch ( ) ) ) ; } catch ( IOException e ) { LOG . error ( "Error when collectng stats" , e ) ; } } return stats ; |
public class DefaultRewriteContentHandler { /** * Builds image element for given media metadata .
* @ param media Media metadata
* @ param element Original element
* @ return Image element or null if media reference is invalid */
private Element buildImageElement ( Media media , Element element ) { } } | if ( media . isValid ( ) ) { element . setAttribute ( "src" , media . getUrl ( ) ) ; } return element ; |
public class ConnectSupport { /** * internal helpers */
private String buildOAuth1Url ( OAuth1ConnectionFactory < ? > connectionFactory , NativeWebRequest request , MultiValueMap < String , String > additionalParameters ) { } } | OAuth1Operations oauthOperations = connectionFactory . getOAuthOperations ( ) ; MultiValueMap < String , String > requestParameters = getRequestParameters ( request ) ; OAuth1Parameters parameters = getOAuth1Parameters ( request , additionalParameters ) ; parameters . putAll ( requestParameters ) ; if ( oauthOperations . getVersion ( ) == OAuth1Version . CORE_10 ) { parameters . setCallbackUrl ( callbackUrl ( request ) ) ; } OAuthToken requestToken = fetchRequestToken ( request , requestParameters , oauthOperations ) ; sessionStrategy . setAttribute ( request , OAUTH_TOKEN_ATTRIBUTE , requestToken ) ; return buildOAuth1Url ( oauthOperations , requestToken . getValue ( ) , parameters ) ; |
public class DefaultGroovyMethods { /** * A convenience method for creating an immutable sorted set .
* @ param self a SortedSet
* @ return an immutable SortedSet
* @ see java . util . Collections # unmodifiableSortedSet ( java . util . SortedSet )
* @ since 1.0 */
public static < T > SortedSet < T > asImmutable ( SortedSet < T > self ) { } } | return Collections . unmodifiableSortedSet ( self ) ; |
public class DelegatingPersistenceBroker { /** * If my underlying { @ link org . apache . ojb . broker . PersistenceBroker }
* is not a { @ link DelegatingPersistenceBroker } , returns it ,
* otherwise recursively invokes this method on my delegate .
* Hence this method will return the first
* delegate that is not a { @ link DelegatingPersistenceBroker } ,
* or < tt > null < / tt > when no non - { @ link DelegatingPersistenceBroker }
* delegate can be found by transversing this chain .
* This method is useful when you may have nested
* { @ link DelegatingPersistenceBroker } s , and you want to make
* sure to obtain a " genuine " { @ link org . apache . ojb . broker . PersistenceBroker }
* implementaion instance . */
public PersistenceBroker getInnermostDelegate ( ) { } } | PersistenceBroker broker = this . m_broker ; while ( broker != null && broker instanceof DelegatingPersistenceBroker ) { broker = ( ( DelegatingPersistenceBroker ) broker ) . getDelegate ( ) ; if ( this == broker ) { return null ; } } return broker ; |
public class Query { /** * @ see org . eclipse . datatools . connectivity . oda . IQuery # executeQuery ( ) */
public IResultSet executeQuery ( ) throws OdaException { } } | String currentQueryText = queryText ; if ( getMaxRows ( ) != 0 ) { currentQueryText = currentQueryText + " LIMIT " + getMaxRows ( ) ; } try { OSQLSynchQuery < ODocument > query = new OSQLSynchQuery < ODocument > ( currentQueryText ) ; List < ODocument > dbResult = getOrMakeDBResult ( db . command ( query ) . execute ( parameters ) ) ; /* ArrayList < ODocument > unCachedResult = new ArrayList < ODocument > ( dbResult . size ( ) ) ;
for ( ODocument oDocument : dbResult ) {
ODocument newDoc = new ODocument ( ) ;
for ( Entry < String , Object > entry : oDocument ) {
newDoc . field ( entry . getKey ( ) , entry . getValue ( ) ) ;
unCachedResult . add ( newDoc ) ; */
return new ResultSet ( dbResult , curMetaData ) ; } catch ( OCommandSQLParsingException e ) { throw new OdaException ( e ) ; } |
public class DocumentSubscriptions { /** * Delete a subscription .
* @ param name Subscription name
* @ param database Database to use */
public void delete ( String name , String database ) { } } | RequestExecutor requestExecutor = _store . getRequestExecutor ( ObjectUtils . firstNonNull ( database , _store . getDatabase ( ) ) ) ; DeleteSubscriptionCommand command = new DeleteSubscriptionCommand ( name ) ; requestExecutor . execute ( command ) ; |
public class NetworkInterfacesInner { /** * Gets all route tables applied to a network interface .
* @ param resourceGroupName The name of the resource group .
* @ param networkInterfaceName The name of the network interface .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the EffectiveRouteListResultInner object */
public Observable < ServiceResponse < EffectiveRouteListResultInner > > beginGetEffectiveRouteTableWithServiceResponseAsync ( String resourceGroupName , String networkInterfaceName ) { } } | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( networkInterfaceName == null ) { throw new IllegalArgumentException ( "Parameter networkInterfaceName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } final String apiVersion = "2018-04-01" ; return service . beginGetEffectiveRouteTable ( resourceGroupName , networkInterfaceName , this . client . subscriptionId ( ) , apiVersion , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < EffectiveRouteListResultInner > > > ( ) { @ Override public Observable < ServiceResponse < EffectiveRouteListResultInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < EffectiveRouteListResultInner > clientResponse = beginGetEffectiveRouteTableDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class CipherOutputStream { /** * Writes the specified byte to this output stream .
* @ param b the < code > byte < / code > .
* @ exception IOException if an I / O error occurs .
* @ since JCE1.2 */
public void write ( int b ) throws IOException { } } | ibuffer [ 0 ] = ( byte ) b ; obuffer = cipher . update ( ibuffer , 0 , 1 ) ; if ( obuffer != null ) { output . write ( obuffer ) ; obuffer = null ; } |
public class FileUploadHelper { /** * Checks , whether the given file name is valid in the sense , that it doesn ' t
* contain any NUL characters . If the file name is valid , it will be returned
* without any modifications . Otherwise , an { @ link InvalidFileNameException }
* is raised .
* @ param sFilename
* The file name to check
* @ return Unmodified file name , if valid .
* @ throws InvalidFileNameException
* The file name was found to be invalid . */
@ Nullable public static String checkFileName ( @ Nullable final String sFilename ) { } } | if ( sFilename != null && sFilename . indexOf ( '\u0000' ) != - 1 ) { throw new InvalidFileNameException ( sFilename , "Invalid filename: " + StringHelper . replaceAll ( sFilename , "\u0000" , "\\0" ) ) ; } return sFilename ; |
public class SimpleFormatter { /** * 每行为特征 预测值 真实值
* @ param inst
* @ param labels
* @ param gold
* @ return */
public static String format ( Instance inst , String [ ] labels , String [ ] gold ) { } } | StringBuilder sb = new StringBuilder ( ) ; String [ ] [ ] data = ( String [ ] [ ] ) inst . getSource ( ) ; int feaNum = data . length ; int seqNum = data [ 0 ] . length ; for ( int i = 0 ; i < seqNum ; i ++ ) { for ( int j = 0 ; j < feaNum ; j ++ ) { sb . append ( data [ j ] [ i ] ) ; sb . append ( "\t" ) ; } sb . append ( labels [ i ] ) ; sb . append ( "\t" ) ; sb . append ( gold [ i ] ) ; sb . append ( "\n" ) ; } return sb . toString ( ) ; |
public class ChatLinearLayoutManager { /** * < p > Scroll the RecyclerView to make the position visible . < / p >
* < p > RecyclerView will scroll the minimum amount that is necessary to make the
* target position visible . If you are looking for a similar behavior to
* { @ link android . widget . ListView # setSelection ( int ) } or
* { @ link android . widget . ListView # setSelectionFromTop ( int , int ) } , use
* { @ link # scrollToPositionWithOffset ( int , int ) } . < / p >
* < p > Note that scroll position change will not be reflected until the next layout call . < / p >
* @ param position Scroll to this adapter position
* @ see # scrollToPositionWithOffset ( int , int ) */
@ Override public void scrollToPosition ( int position ) { } } | mPendingScrollPosition = position ; mPendingScrollPositionOffset = INVALID_OFFSET ; if ( mPendingSavedState != null ) { mPendingSavedState . invalidateAnchor ( ) ; } requestLayout ( ) ; |
public class EUI48XmlAdapter { /** * Converts the EUI - 48 string representation in { @ code str } to an { @ link EUI48 } . Returns
* { @ code null } if { @ code str } is { @ code null } .
* @ param str The EUI - 48 string representation .
* @ return The { @ link EUI48 } represented by { @ code str } .
* @ throws IllegalArgumentException if { @ code str } is not a valid EUI - 48 string representation .
* @ see EUI48 # fromString ( String ) */
@ Override public EUI48 unmarshal ( String str ) throws Exception { } } | return str == null ? null : EUI48 . fromString ( str ) ; |
public class FileUtil { /** * 创建File对象 < br >
* 此方法会检查slip漏洞 , 漏洞说明见http : / / blog . nsfocus . net / zip - slip - 2/
* @ param parent 父目录
* @ param path 文件路径
* @ return File */
public static File file ( String parent , String path ) { } } | return file ( new File ( parent ) , path ) ; |
public class SplitIndexWriter { /** * Get link to the previous unicode character .
* @ return a content tree for the link */
public Content getNavLinkPrevious ( ) { } } | Content prevletterLabel = getResource ( "doclet.Prev_Letter" ) ; if ( prev == - 1 ) { return HtmlTree . LI ( prevletterLabel ) ; } else { Content prevLink = getHyperLink ( DocPaths . indexN ( prev ) , prevletterLabel ) ; return HtmlTree . LI ( prevLink ) ; } |
public class Cargo { /** * � � � ٻ � � � λ � � */
public Location lastKnownLocation ( ) { } } | final HandlingEvent lastEvent = this . lnkDeliveryHistory . lastEvent ( ) ; if ( lastEvent != null ) { return lastEvent . getLocation ( ) ; } else { return null ; } |
public class QueryRunner { /** * Runs a query on a chunk of a single partition . The chunk is defined by the offset { @ code tableIndex }
* and the soft limit { @ code fetchSize } .
* @ param query the query
* @ param partitionId the partition which is queried
* @ param tableIndex the index at which to start querying
* @ param fetchSize the soft limit for the number of items to be queried
* @ return the queried entries along with the next { @ code tableIndex } to resume querying */
public ResultSegment runPartitionScanQueryOnPartitionChunk ( Query query , int partitionId , int tableIndex , int fetchSize ) { } } | MapContainer mapContainer = mapServiceContext . getMapContainer ( query . getMapName ( ) ) ; Predicate predicate = queryOptimizer . optimize ( query . getPredicate ( ) , mapContainer . getIndexes ( partitionId ) ) ; QueryableEntriesSegment entries = partitionScanExecutor . execute ( query . getMapName ( ) , predicate , partitionId , tableIndex , fetchSize ) ; ResultProcessor processor = resultProcessorRegistry . get ( query . getResultType ( ) ) ; Result result = processor . populateResult ( query , Long . MAX_VALUE , entries . getEntries ( ) , singletonPartitionIdSet ( partitionCount , partitionId ) ) ; return new ResultSegment ( result , entries . getNextTableIndexToReadFrom ( ) ) ; |
public class BaseJpaDao { /** * Factory method for creating a { @ link CriteriaQuery } employing standards and best practices in
* general use within the portal . Query objects returned from this method should normally be
* passed to { @ link createCachedQuery } ; this step is important for the sake of scalability . */
protected final < T > CriteriaQuery < T > createCriteriaQuery ( Function < CriteriaBuilder , CriteriaQuery < T > > builder ) { } } | final EntityManager entityManager = this . getEntityManager ( ) ; final EntityManagerFactory entityManagerFactory = entityManager . getEntityManagerFactory ( ) ; final CriteriaBuilder criteriaBuilder = entityManagerFactory . getCriteriaBuilder ( ) ; final CriteriaQuery < T > criteriaQuery = builder . apply ( criteriaBuilder ) ; // Do in TX so the EM gets closed correctly
final TransactionOperations transactionOperations = this . getTransactionOperations ( ) ; transactionOperations . execute ( new TransactionCallbackWithoutResult ( ) { @ Override protected void doInTransactionWithoutResult ( TransactionStatus status ) { entityManager . createQuery ( criteriaQuery ) ; // pre - compile critera query to avoid race
// conditions when setting aliases
} } ) ; return criteriaQuery ; |
public class Late { /** * Sets / initializes the object .
* @ param object the object to set .
* @ return the set object . */
public synchronized @ NonNull T set ( T object ) { } } | if ( this . object != null ) { throw new IllegalStateException ( "Already initialized" ) ; } this . object = object ; return object ; |
public class DateConverter { /** * Initialize this converter .
* @ param converter The next converter in the converter chain .
* @ param dateFormat The date format . */
public void init ( Converter converter , int dateFormat ) { } } | Converter . initGlobals ( ) ; super . init ( converter ) ; m_sDateFormat = dateFormat ; |
public class ParametricStatement { /** * Executes an INSERT statement .
* @ return an array whose length indicates the number of rows inserted . If generatedKeys is true , the array
* contains the keys ; otherwise the content of the array is not defined . */
public long [ ] executeInsert ( Connection conn , DataObject object , boolean generatedKeys ) throws SQLException { } } | PreparedStatement statement = conn . prepareStatement ( _sql , generatedKeys ? Statement . RETURN_GENERATED_KEYS : Statement . NO_GENERATED_KEYS ) ; try { load ( statement , object ) ; long [ ] keys = new long [ statement . executeUpdate ( ) ] ; if ( generatedKeys ) { ResultSet rs = statement . getGeneratedKeys ( ) ; for ( int i = 0 ; rs . next ( ) ; ++ i ) { keys [ i ] = rs . getLong ( 1 ) ; } rs . close ( ) ; } return keys ; } finally { statement . close ( ) ; } |
public class AbstractTrafficShapingHandler { /** * Calculate the size of the given { @ link Object } .
* This implementation supports { @ link ByteBuf } and { @ link ByteBufHolder } . Sub - classes may override this .
* @ param msg the msg for which the size should be calculated .
* @ return size the size of the msg or { @ code - 1 } if unknown . */
protected long calculateSize ( Object msg ) { } } | if ( msg instanceof ByteBuf ) { return ( ( ByteBuf ) msg ) . readableBytes ( ) ; } if ( msg instanceof ByteBufHolder ) { return ( ( ByteBufHolder ) msg ) . content ( ) . readableBytes ( ) ; } return - 1 ; |
public class PPVItemsType { /** * Gets the value of the ppvItem property .
* This accessor method returns a reference to the live list ,
* not a snapshot . Therefore any modification you make to the
* returned list will be present inside the JAXB object .
* This is why there is not a < CODE > set < / CODE > method for the ppvItem property .
* For example , to add a new item , do as follows :
* < pre >
* getPPVItem ( ) . add ( newItem ) ;
* < / pre >
* Objects of the following type ( s ) are allowed in the list
* { @ link PPVItemsType . PPVItem } */
public List < PPVItemsType . PPVItem > getPPVItem ( ) { } } | if ( ppvItem == null ) { ppvItem = new ArrayList < PPVItemsType . PPVItem > ( ) ; } return this . ppvItem ; |
public class EfficientViewHolder { /** * Equivalent to calling View . setTag
* @ param viewId The id of the view whose tag should change
* @ param key The key identifying the tag
* @ param tag An Object to tag the view with */
public void setTag ( int viewId , int key , Object tag ) { } } | ViewHelper . setTag ( mCacheView , viewId , key , tag ) ; |
public class LogisticsCenter { /** * register by class name
* Sacrificing a bit of efficiency to solve
* the problem that the main dex file size is too large
* @ author billy . qi < a href = " mailto : qiyilike @ 163 . com " > Contact me . < / a >
* @ param className class name */
private static void register ( String className ) { } } | if ( ! TextUtils . isEmpty ( className ) ) { try { Class < ? > clazz = Class . forName ( className ) ; Object obj = clazz . getConstructor ( ) . newInstance ( ) ; if ( obj instanceof IRouteRoot ) { registerRouteRoot ( ( IRouteRoot ) obj ) ; } else if ( obj instanceof IProviderGroup ) { registerProvider ( ( IProviderGroup ) obj ) ; } else if ( obj instanceof IInterceptorGroup ) { registerInterceptor ( ( IInterceptorGroup ) obj ) ; } else { logger . info ( TAG , "register failed, class name: " + className + " should implements one of IRouteRoot/IProviderGroup/IInterceptorGroup." ) ; } } catch ( Exception e ) { logger . error ( TAG , "register class error:" + className ) ; } } |
public class ChunkMapReader { /** * Create new map and refer to it with navref . */
private void processNavitation ( final Element topicref ) { } } | // create new map ' s root element
final Element root = ( Element ) topicref . getOwnerDocument ( ) . getDocumentElement ( ) . cloneNode ( false ) ; // create navref element
final Element navref = topicref . getOwnerDocument ( ) . createElement ( MAP_NAVREF . localName ) ; final String newMapFile = chunkFilenameGenerator . generateFilename ( "MAPCHUNK" , FILE_EXTENSION_DITAMAP ) ; navref . setAttribute ( ATTRIBUTE_NAME_MAPREF , newMapFile ) ; navref . setAttribute ( ATTRIBUTE_NAME_CLASS , MAP_NAVREF . toString ( ) ) ; // replace topicref with navref
topicref . getParentNode ( ) . replaceChild ( navref , topicref ) ; root . appendChild ( topicref ) ; // generate new file
final URI navmap = currentFile . resolve ( newMapFile ) ; changeTable . put ( stripFragment ( navmap ) , stripFragment ( navmap ) ) ; outputMapFile ( navmap , buildOutputDocument ( root ) ) ; |
public class DatabasesInner { /** * Pauses a database .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param databaseName The name of the database to be paused .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < DatabaseInner > pauseAsync ( String resourceGroupName , String serverName , String databaseName ) { } } | return pauseWithServiceResponseAsync ( resourceGroupName , serverName , databaseName ) . map ( new Func1 < ServiceResponse < DatabaseInner > , DatabaseInner > ( ) { @ Override public DatabaseInner call ( ServiceResponse < DatabaseInner > response ) { return response . body ( ) ; } } ) ; |
public class DCacheBase { /** * This is a helper method to remove pre - invalidation listener for all entries . */
public synchronized boolean removePreInvalidationListener ( PreInvalidationListener listener ) { } } | if ( bEnableListener && listener != null ) { eventSource . removeListener ( listener ) ; return true ; } return false ; |
public class Perfidix { /** * Main method for invoking benchs with classes as strings .
* @ param args the classes
* @ throws ClassNotFoundException if class cannot be found
* @ throws IllegalAccessException if conf cannot be instantiated
* @ throws InstantiationException if conf cannot be instantiated */
public static void main ( final String [ ] args ) throws ClassNotFoundException , InstantiationException , IllegalAccessException { } } | final BenchmarkResult res = runBenchs ( args ) ; new TabularSummaryOutput ( ) . visitBenchmark ( res ) ; |
public class GDLHandler { /** * Returns a cache that contains a mapping from variables to graph instances .
* @ param includeUserDefined true , iff user - defined variables shall be included in the cache
* @ param includeAutoGenerated true , iff auto - generated variables shall be included in the cache
* @ return immutable graph cache */
public Map < String , Graph > getGraphCache ( boolean includeUserDefined , boolean includeAutoGenerated ) { } } | return loader . getGraphCache ( includeUserDefined , includeAutoGenerated ) ; |
public class SourceParams { /** * Set custom metadata on the parameters .
* @ param metaData
* @ return { @ code this } , for chaining purposes */
@ NonNull public SourceParams setMetaData ( @ NonNull Map < String , String > metaData ) { } } | mMetaData = metaData ; return this ; |
public class ReUtil { /** * 取得内容中匹配的所有结果 , 获得匹配的所有结果中正则对应分组0的内容
* @ param pattern 编译后的正则模式
* @ param content 被查找的内容
* @ return 结果列表
* @ since 3.1.2 */
public static List < String > findAllGroup0 ( Pattern pattern , CharSequence content ) { } } | return findAll ( pattern , content , 0 ) ; |
public class DocCommentParser { /** * Read an HTML entity .
* { @ literal & identifier ; } or { @ literal & # digits ; } or { @ literal & # xhex - digits ; } */
protected DCTree entity ( ) { } } | int p = bp ; nextChar ( ) ; Name name = null ; boolean checkSemi = false ; if ( ch == '#' ) { int namep = bp ; nextChar ( ) ; if ( isDecimalDigit ( ch ) ) { nextChar ( ) ; while ( isDecimalDigit ( ch ) ) nextChar ( ) ; name = names . fromChars ( buf , namep , bp - namep ) ; } else if ( ch == 'x' || ch == 'X' ) { nextChar ( ) ; if ( isHexDigit ( ch ) ) { nextChar ( ) ; while ( isHexDigit ( ch ) ) nextChar ( ) ; name = names . fromChars ( buf , namep , bp - namep ) ; } } } else if ( isIdentifierStart ( ch ) ) { name = readIdentifier ( ) ; } if ( name == null ) return erroneous ( "dc.bad.entity" , p ) ; else { if ( ch != ';' ) return erroneous ( "dc.missing.semicolon" , p ) ; nextChar ( ) ; return m . at ( p ) . Entity ( name ) ; } |
public class CassandraDataHandlerBase { /** * On counter column .
* @ param column
* the column
* @ param m
* the m
* @ param entity
* the entity
* @ param entityType
* the entity type
* @ param relationNames
* the relation names
* @ param isWrapReq
* the is wrap req
* @ param relations
* the relations
* @ param isCql3Enabled
* the is cql3 enabled
* @ throws InstantiationException
* the instantiation exception
* @ throws IllegalAccessException
* the illegal access exception */
private void onCounterColumn ( CounterColumn column , EntityMetadata m , Object entity , EntityType entityType , List < String > relationNames , boolean isWrapReq , Map < String , Object > relations , boolean isCql3Enabled ) throws InstantiationException , IllegalAccessException { } } | String thriftColumnName = PropertyAccessorFactory . STRING . fromBytes ( String . class , column . getName ( ) ) ; String thriftColumnValue = new Long ( column . getValue ( ) ) . toString ( ) ; populateViaThrift ( m , entity , entityType , relationNames , relations , thriftColumnName , thriftColumnValue , isCql3Enabled ) ; |
public class StdScheduler { /** * Calls the equivalent method on the ' proxied ' < code > QuartzScheduler < / code > . */
public void addCalendar ( final String calName , final ICalendar calendar , final boolean replace , final boolean updateTriggers ) throws SchedulerException { } } | m_aSched . addCalendar ( calName , calendar , replace , updateTriggers ) ; |
public class XMLEditorSupport { /** * Returns the property as a String . */
@ Override public String getAsText ( ) { } } | if ( getValue ( ) == null ) { return null ; } return DOMWriter . printNode ( ( Node ) getValue ( ) , false ) ; |
public class QuartzScheduler { /** * Resume a job .
* @ param jobName
* @ param groupName
* @ return true the job has been resumed , no if the job doesn ' t exist .
* @ throws SchedulerException */
public synchronized boolean resumeJobIfPresent ( final String jobName , final String groupName ) throws SchedulerException { } } | if ( ifJobExist ( jobName , groupName ) ) { this . scheduler . resumeJob ( new JobKey ( jobName , groupName ) ) ; return true ; } else { return false ; } |
public class VdmContentOutlinePage { /** * @ see org . eclipse . jface . text . IPostSelectionProvider # removePostSelectionChangedListener
* ( org . eclipse . jface . viewers . ISelectionChangedListener ) */
public void removePostSelectionChangedListener ( ISelectionChangedListener listener ) { } } | if ( fOutlineViewer != null ) { fOutlineViewer . removePostSelectionChangedListener ( listener ) ; } else { fPostSelectionChangedListeners . remove ( listener ) ; } |
public class SortV1 { /** * Returns a new { @ link SortV1 } consisting of the { @ link OrderV1 } s of the current { @ link SortV1}
* combined with the given ones .
* @ param sort can be { @ literal null } . */
public SortV1 and ( SortV1 sort ) { } } | if ( sort == null ) { return this ; } ArrayList < OrderV1 > these = new ArrayList < > ( this . orders ) ; for ( OrderV1 order : sort ) { these . add ( order ) ; } return new SortV1 ( these ) ; |
public class ProvFactory { /** * ( non - Javadoc )
* @ see org . openprovenance . prov . model . LiteralConstructor # newGYear ( int ) */
public XMLGregorianCalendar newGYear ( int year ) { } } | XMLGregorianCalendar cal = dataFactory . newXMLGregorianCalendar ( ) ; cal . setYear ( year ) ; return cal ; |
public class CPTaxCategoryServiceBaseImpl { /** * Sets the cp instance local service .
* @ param cpInstanceLocalService the cp instance local service */
public void setCPInstanceLocalService ( com . liferay . commerce . product . service . CPInstanceLocalService cpInstanceLocalService ) { } } | this . cpInstanceLocalService = cpInstanceLocalService ; |
public class TokenBucketImpl { /** * Attempt to consume a specified number of tokens from the bucket . If the tokens were consumed then { @ code true }
* is returned , otherwise { @ code false } is returned .
* @ param numTokens The number of tokens to consume from the bucket , must be a positive number .
* @ return { @ code true } if the tokens were consumed , { @ code false } otherwise . */
public synchronized boolean tryConsume ( long numTokens ) { } } | checkArgument ( numTokens > 0 , "Number of tokens to consume must be positive" ) ; checkArgument ( numTokens <= capacity , "Number of tokens to consume must be less than the capacity of the bucket." ) ; refill ( refillStrategy . refill ( ) ) ; // Now try to consume some tokens
if ( numTokens <= size ) { size -= numTokens ; return true ; } return false ; |
public class CglibLazyInitializer { /** * Gets the proxy .
* @ param entityName
* the entity name
* @ param persistentClass
* the persistent class
* @ param interfaces
* the interfaces
* @ param getIdentifierMethod
* the get identifier method
* @ param setIdentifierMethod
* the set identifier method
* @ param id
* the id
* @ param persistenceDelegator
* the persistence delegator
* @ return the proxy
* @ throws PersistenceException
* the persistence exception */
public static KunderaProxy getProxy ( final String entityName , final Class < ? > persistentClass , final Class < ? > [ ] interfaces , final Method getIdentifierMethod , final Method setIdentifierMethod , final Object id , final PersistenceDelegator pd ) throws PersistenceException { } } | final CglibLazyInitializer instance = new CglibLazyInitializer ( entityName , persistentClass , interfaces , id , getIdentifierMethod , setIdentifierMethod , pd ) ; final KunderaProxy proxy ; Class factory = getProxyFactory ( persistentClass , interfaces ) ; proxy = getProxyInstance ( factory , instance ) ; instance . constructed = true ; return proxy ; |
public class WebUtils { /** * 执行HTTP POST请求 。
* @ param url 请求地址
* @ param params 请求参数
* @ return 响应字符串 */
public static String doPost ( String url , Map < String , String > params , int connectTimeout , int readTimeout ) throws IOException { } } | return doPost ( url , params , DEFAULT_CHARSET , connectTimeout , readTimeout ) ; |
public class PHPDriver { /** * < p > execGet . < / p >
* @ param command a { @ link java . lang . String } object .
* @ return a { @ link java . lang . String } object .
* @ throws java . io . IOException if any .
* @ throws com . greenpepper . phpsud . exceptions . PHPException if any . */
public String execGet ( String command ) throws IOException , PHPException { } } | writeCommand ( "G" + command ) ; phpConsoleLogger . write ( command ) ; String res = readLine ( ) ; phpConsoleLogger . read ( res ) ; return res ; |
public class RolesEntity { /** * Delete an existing Role .
* A token with scope delete : roles is needed .
* See https : / / auth0 . com / docs / api / management / v2 # ! / Roles / delete _ roles _ by _ id
* @ param roleId The id of the role to delete .
* @ return a Request to execute . */
public Request delete ( String roleId ) { } } | Asserts . assertNotNull ( roleId , "role id" ) ; final String url = baseUrl . newBuilder ( ) . addEncodedPathSegments ( "api/v2/roles" ) . addEncodedPathSegments ( roleId ) . build ( ) . toString ( ) ; VoidRequest request = new VoidRequest ( this . client , url , "DELETE" ) ; request . addHeader ( "Authorization" , "Bearer " + apiToken ) ; return request ; |
public class Scanners { /** * Matches the input against the specified string .
* @ param str the string to match
* @ return the scanner . */
public static Parser < Void > string ( String str ) { } } | return Patterns . string ( str ) . toScanner ( str ) ; |
public class GlobusGSSManagerImpl { /** * Imports a credential .
* @ param lifetime Only lifetime set to
* { @ link GSSCredential # DEFAULT _ LIFETIME
* GSSCredential . DEFAULT _ LIFETIME } is allowed . */
public GSSCredential createCredential ( byte [ ] buff , int option , int lifetime , Oid mech , int usage ) throws GSSException { } } | checkMechanism ( mech ) ; if ( buff == null || buff . length < 1 ) { throw new GlobusGSSException ( GSSException . FAILURE , GlobusGSSException . BAD_ARGUMENT , "invalidBuf" ) ; } if ( lifetime == GSSCredential . INDEFINITE_LIFETIME || lifetime > 0 ) { // lifetime not supported
throw new GlobusGSSException ( GSSException . FAILURE , GlobusGSSException . BAD_ARGUMENT , "badLifetime01" ) ; } InputStream input = null ; switch ( option ) { case ExtendedGSSCredential . IMPEXP_OPAQUE : input = new ByteArrayInputStream ( buff ) ; break ; case ExtendedGSSCredential . IMPEXP_MECH_SPECIFIC : String s = new String ( buff ) ; int pos = s . indexOf ( '=' ) ; if ( pos == - 1 ) { throw new GSSException ( GSSException . FAILURE ) ; } String filename = s . substring ( pos + 1 ) . trim ( ) ; try { input = new FileInputStream ( filename ) ; } catch ( IOException e ) { throw new GlobusGSSException ( GSSException . FAILURE , e ) ; } break ; default : throw new GlobusGSSException ( GSSException . FAILURE , GlobusGSSException . BAD_ARGUMENT , "unknownOption" , new Object [ ] { new Integer ( option ) } ) ; } X509Credential cred = null ; try { cred = new X509Credential ( input ) ; } catch ( CredentialException e ) { throw new GlobusGSSException ( GSSException . DEFECTIVE_CREDENTIAL , e ) ; } catch ( Exception e ) { throw new GlobusGSSException ( GSSException . DEFECTIVE_CREDENTIAL , e ) ; } return new GlobusGSSCredentialImpl ( cred , usage ) ; |
public class Utils { /** * Split the given string using the given separate , returning the components as a
* set . This method does the opposite as { @ link # concatenate ( Collection , String ) } .
* If a null or empty string is passed , an empty set is returned .
* @ param str String to be split .
* @ param sepStr Separator string that lies between values .
* @ return Set of separated substrings . The set may be empty but it will
* not be null . */
public static Set < String > split ( String str , String sepStr ) { } } | // Split but watch out for empty substrings .
Set < String > result = new HashSet < String > ( ) ; if ( str != null ) { for ( String value : str . split ( sepStr ) ) { if ( value . length ( ) > 0 ) { result . add ( value ) ; } } } return result ; |
public class StringUtils { /** * Method to validate whether the given string is null / empty or has value
* @ param text
* @ return boolean */
public static boolean hasText ( final String text ) { } } | if ( text != null && ! "" . equals ( text . trim ( ) ) ) { return true ; } return false ; |
public class SignedMutableBigInteger { /** * Signed addition built upon unsigned add and subtract . */
void signedAdd ( SignedMutableBigInteger addend ) { } } | if ( sign == addend . sign ) add ( addend ) ; else sign = sign * subtract ( addend ) ; |
public class Configuration { /** * Get the comma delimited values of the < code > name < / code > property as
* an array of < code > String < / code > s .
* If no such property is specified then < code > null < / code > is returned .
* @ param name property name .
* @ return property value as an array of < code > String < / code > s ,
* or < code > null < / code > . */
public String [ ] getStrings ( String name ) { } } | String valueString = get ( name ) ; return StringUtils . split ( valueString , "," ) ; |
public class JBossConnectorDiscover { /** * A list of connectors . Not bound connectors will be discarded .
* @ return
* @ throws MalformedObjectNameException
* @ throws NullPointerException
* @ throws UnknownHostException
* @ throws AttributeNotFoundException
* @ throws InstanceNotFoundException
* @ throws MBeanException
* @ throws ReflectionException */
@ Override public HttpConnectorList findConnectors ( ) throws MalformedObjectNameException , NullPointerException , UnknownHostException , AttributeNotFoundException , InstanceNotFoundException , MBeanException , ReflectionException { } } | LOG . info ( "Searching JBoss HTTP connectors." ) ; HttpConnectorList httpConnectorList = null ; MBeanServer mbs = ManagementFactory . getPlatformMBeanServer ( ) ; Set < ObjectName > jbossObjs = mbs . queryNames ( new ObjectName ( "jboss.as:socket-binding-group=standard-sockets,socket-binding=http*" ) , null ) ; LOG . info ( "JBoss Mbean found." ) ; ArrayList < HttpConnector > endPoints = new ArrayList < HttpConnector > ( ) ; if ( jbossObjs != null && jbossObjs . size ( ) > 0 ) { LOG . info ( "JBoss Connectors found:" + jbossObjs . size ( ) ) ; for ( ObjectName obj : jbossObjs ) { Boolean bound = ( Boolean ) mbs . getAttribute ( obj , "bound" ) ; if ( bound ) { String scheme = mbs . getAttribute ( obj , "name" ) . toString ( ) . replaceAll ( "\"" , "" ) ; Integer port = ( Integer ) mbs . getAttribute ( obj , "boundPort" ) ; String address = ( ( String ) mbs . getAttribute ( obj , "boundAddress" ) ) . replaceAll ( "\"" , "" ) ; if ( LOG . isInfoEnabled ( ) ) { LOG . info ( "Jboss Http Connector: " + scheme + "://" + address + ":" + port ) ; } HttpConnector httpConnector = new HttpConnector ( scheme , address , port , scheme . equalsIgnoreCase ( "https" ) ) ; endPoints . add ( httpConnector ) ; } else { LOG . info ( "JBoss Connector not bound,discarding." ) ; } } } if ( endPoints . isEmpty ( ) ) { LOG . warn ( "Coundn't discover any Http Interfaces." ) ; } httpConnectorList = new HttpConnectorList ( endPoints ) ; return httpConnectorList ; |
public class Widgets { /** * Creates an image that responds to clicking . */
public static Image newActionImage ( String path , String tip , ClickHandler onClick ) { } } | return makeActionImage ( new Image ( path ) , tip , onClick ) ; |
public class CmsGalleryControllerHandler { /** * Updates the gallery tree . < p >
* @ param galleryTreeEntries the gallery tree entries
* @ param selectedGalleries the selected galleries */
public void onUpdateGalleryTree ( List < CmsGalleryTreeEntry > galleryTreeEntries , List < String > selectedGalleries ) { } } | m_galleryDialog . getGalleriesTab ( ) . updateTreeContent ( galleryTreeEntries , selectedGalleries ) ; |
public class Duration { /** * Subtract the supplied duration from this duration , and return the result .
* @ param duration the duration to subtract from this object
* @ param unit the unit of the duration being subtracted ; may not be null
* @ return the total duration */
public Duration subtract ( long duration , TimeUnit unit ) { } } | long durationInNanos = TimeUnit . NANOSECONDS . convert ( duration , unit ) ; return new Duration ( this . durationInNanos - durationInNanos ) ; |
public class AbstractGeneratedSQLTransform { /** * / * ( non - Javadoc )
* @ see com . abubusoft . kripton . processor . sqlite . transform . SQLTransform # generateReadPropertyFromCursor ( com . squareup . javapoet . MethodSpec . Builder , com . squareup . javapoet . TypeName , java . lang . String , com . abubusoft . kripton . processor . core . ModelProperty , java . lang . String , java . lang . String ) */
@ Override public void generateReadPropertyFromCursor ( Builder methodBuilder , TypeName beanClass , String beanName , ModelProperty property , String cursorName , String indexName ) { } } | methodBuilder . addCode ( setter ( beanClass , beanName , property , "$T.parse$L($L.getBlob($L))" ) , TypeUtility . mergeTypeNameWithSuffix ( beanClass , "Table" ) , formatter . convert ( property . getName ( ) ) , cursorName , indexName ) ; |
public class StringArrayJsonDeserializer { /** * { @ inheritDoc } */
@ Override public String [ ] doDeserializeArray ( JsonReader reader , JsonDeserializationContext ctx , JsonDeserializerParameters params ) { } } | FastArrayString jsArray = new FastArrayString ( ) ; reader . beginArray ( ) ; while ( JsonToken . END_ARRAY != reader . peek ( ) ) { if ( JsonToken . NULL == reader . peek ( ) ) { reader . skipValue ( ) ; jsArray . push ( null ) ; } else { jsArray . push ( reader . nextString ( ) ) ; } } reader . endArray ( ) ; return jsArray . reinterpretCast ( ) ; |
public class WebApp40 { /** * Throw NPE if name is null
* @ see com . ibm . ws . webcontainer . webapp . WebApp # setInitParameter ( java . lang . String , java . lang . String ) */
@ Override public boolean setInitParameter ( String name , String value ) throws IllegalStateException , IllegalArgumentException { } } | if ( name == null ) { logger . logp ( Level . SEVERE , CLASS_NAME , "setInitParameter" , servlet40NLS . getString ( "name.is.null" ) ) ; throw new java . lang . NullPointerException ( servlet40NLS . getString ( "name.is.null" ) ) ; } return super . setInitParameter ( name , value ) ; |
public class Roster { /** * Returns the presence info for a particular user ' s resource , or unavailable presence
* if the user is offline or if no presence information is available , such as
* when you are not subscribed to the user ' s presence updates .
* @ param userWithResource a fully qualified XMPP ID including a resource ( user @ domain / resource ) .
* @ return the user ' s current presence , or unavailable presence if the user is offline
* or if no presence information is available . */
public Presence getPresenceResource ( FullJid userWithResource ) { } } | BareJid key = userWithResource . asBareJid ( ) ; Resourcepart resource = userWithResource . getResourcepart ( ) ; Map < Resourcepart , Presence > userPresences = getPresencesInternal ( key ) ; if ( userPresences == null ) { Presence presence = new Presence ( Presence . Type . unavailable ) ; presence . setFrom ( userWithResource ) ; return presence ; } else { Presence presence = userPresences . get ( resource ) ; if ( presence == null ) { presence = new Presence ( Presence . Type . unavailable ) ; presence . setFrom ( userWithResource ) ; return presence ; } else { return presence . clone ( ) ; } } |
public class AbstractJSPExtensionProcessor { /** * PM07560 - Start */
public List getPatternList ( ) { } } | List mappings = jspConfigurationManager . getJspExtensionList ( ) ; if ( mappings . isEmpty ( ) ) return mappings ; if ( WCCustomProperties . ENABLE_JSP_MAPPING_OVERRIDE ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINER ) ) { logger . logp ( Level . FINER , CLASS_NAME , "getPatternList" , " enters enableJSPMappingOverride is TRUE" ) ; } // WebAppConfiguration config = ( ( com . ibm . ws . webcontainer . webapp . WebAppConfigurationImpl ) extensionContext . getWebAppConfig ( ) ) ;
WebAppConfig config = this . webapp . getWebAppConfig ( ) ; Map < String , List < String > > srvMappings = config . getServletMappings ( ) ; if ( srvMappings . isEmpty ( ) ) { return mappings ; } Iterator iSrvNames = config . getServletNames ( ) ; List < String > newMappings = new ArrayList < String > ( ) ; String path = null , servletName ; HashSet < String > urlPatternSet = new HashSet < String > ( ) ; // for every servlet name in the mapping . . .
while ( iSrvNames . hasNext ( ) ) { servletName = ( String ) iSrvNames . next ( ) ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINER ) ) { logger . logp ( Level . FINER , CLASS_NAME , "getPatternList" , " servletName [" + servletName + "]" ) ; } List < String > mapList = srvMappings . get ( servletName ) ; if ( mapList != null ) { // . . . get all its UrlPattern and put them into a set . . .
Iterator < String > m = mapList . iterator ( ) ; while ( m . hasNext ( ) ) { path = m . next ( ) ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINER ) ) { logger . logp ( Level . FINER , CLASS_NAME , "getPatternList" , " urlPattern [" + path + "]" ) ; } urlPatternSet . add ( path ) ; } } } // . . . find an extension in the original list that matches the UrlPattern set
for ( Iterator it = mappings . iterator ( ) ; it . hasNext ( ) ; ) { String mapping = ( String ) it . next ( ) ; int dot = - 1 ; dot = mapping . lastIndexOf ( "." ) ; if ( dot != - 1 ) { String extension = "*" + mapping . substring ( dot ) ; if ( ! urlPatternSet . contains ( extension ) ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINER ) ) { logger . logp ( Level . FINER , CLASS_NAME , "getPatternList" , " no match for extension [" + extension + "], add [" + mapping + "]" ) ; } newMappings . add ( mapping ) ; } else { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINER ) ) { logger . logp ( Level . FINER , CLASS_NAME , "getPatternList" , " found a match for extension [" + extension + "], ignore [" + mapping + "]" ) ; } } } else { // no extension . . . just add to the mapping
if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINER ) ) { logger . logp ( Level . FINER , CLASS_NAME , "getPatternList" , " no extension, add [" + mapping + "]" ) ; } newMappings . add ( mapping ) ; } } mappings = newMappings ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINER ) ) { logger . logp ( Level . FINER , CLASS_NAME , "getPatternList" , " exits enableJSPMappingOverride" ) ; } } return mappings ; |
public class MultimapWithProtoValuesSubject { private MultimapSubject . UsingCorrespondence < M , M > usingCorrespondence ( Iterable < ? extends M > expectedValues ) { } } | return comparingValuesUsing ( config . withExpectedMessages ( expectedValues ) . < M > toCorrespondence ( FieldScopeUtil . getSingleDescriptor ( actual ( ) . values ( ) ) ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.