signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class MemcachedClient { /** * Get the values for multiple keys from the cache .
* @ param < T >
* @ param keys the keys
* @ param tc the transcoder to serialize and unserialize value
* @ return a map of the values ( for each value that exists )
* @ throws OperationTimeoutException if the global operation timeout is
* exceeded
* @ throws IllegalStateException in the rare circumstance where queue is too
* full to accept any more requests */
@ Override public < T > Map < String , T > getBulk ( Collection < String > keys , Transcoder < T > tc ) { } } | return getBulk ( keys . iterator ( ) , tc ) ; |
public class StaticFileServerHandler { /** * Sets the content type header for the HTTP Response .
* @ param response HTTP response
* @ param file file to extract content type */
public static void setContentTypeHeader ( HttpResponse response , File file ) { } } | String mimeType = MimeTypes . getMimeTypeForFileName ( file . getName ( ) ) ; String mimeFinal = mimeType != null ? mimeType : MimeTypes . getDefaultMimeType ( ) ; response . headers ( ) . set ( CONTENT_TYPE , mimeFinal ) ; |
public class SynchroReader { /** * Recursively update parent task dates .
* @ param parentTask parent task */
private void updateDates ( Task parentTask ) { } } | if ( parentTask . hasChildTasks ( ) ) { Date plannedStartDate = null ; Date plannedFinishDate = null ; for ( Task task : parentTask . getChildTasks ( ) ) { updateDates ( task ) ; plannedStartDate = DateHelper . min ( plannedStartDate , task . getStart ( ) ) ; plannedFinishDate = DateHelper . max ( plannedFinishDate , task . getFinish ( ) ) ; } parentTask . setStart ( plannedStartDate ) ; parentTask . setFinish ( plannedFinishDate ) ; } |
public class Subtypes2 { /** * Add a ClassVertex representing a missing class .
* @ param missingClassDescriptor
* ClassDescriptor naming a missing class
* @ param isInterfaceEdge
* @ return the ClassVertex representing the missing class */
private ClassVertex addClassVertexForMissingClass ( ClassDescriptor missingClassDescriptor , boolean isInterfaceEdge ) { } } | ClassVertex missingClassVertex = ClassVertex . createMissingClassVertex ( missingClassDescriptor , isInterfaceEdge ) ; missingClassVertex . setFinished ( true ) ; addVertexToGraph ( missingClassDescriptor , missingClassVertex ) ; AnalysisContext . currentAnalysisContext ( ) ; AnalysisContext . reportMissingClass ( missingClassDescriptor ) ; return missingClassVertex ; |
public class ValidationSessionComponent { /** * Session check .
* @ param req the req */
public void sessionCheck ( HttpServletRequest req ) { } } | String authHeader = req . getHeader ( "Authorization" ) ; if ( authHeader != null && this . validationSessionCheck ( authHeader ) ) { return ; } if ( req . getCookies ( ) != null ) { Cookie cookie = Arrays . stream ( req . getCookies ( ) ) . filter ( ck -> ck . getName ( ) . equals ( "AuthToken" ) ) . findFirst ( ) . orElse ( null ) ; if ( cookie != null && this . validationSessionCheck ( cookie . getValue ( ) ) ) { return ; } } if ( req . getParameter ( "token" ) != null ) { String token = req . getParameter ( "token" ) ; if ( this . validationSessionCheck ( token ) ) { return ; } } throw new ValidationLibException ( "UnAuthorization" , HttpStatus . UNAUTHORIZED ) ; |
public class ListRootsResult { /** * A list of roots that are defined in an organization .
* @ param roots
* A list of roots that are defined in an organization . */
public void setRoots ( java . util . Collection < Root > roots ) { } } | if ( roots == null ) { this . roots = null ; return ; } this . roots = new java . util . ArrayList < Root > ( roots ) ; |
public class AmazonAthenaClient { /** * Deletes the named query if you have access to the workgroup in which the query was saved .
* For code samples using the AWS SDK for Java , see < a
* href = " http : / / docs . aws . amazon . com / athena / latest / ug / code - samples . html " > Examples and Code Samples < / a > in the
* < i > Amazon Athena User Guide < / i > .
* @ param deleteNamedQueryRequest
* @ return Result of the DeleteNamedQuery operation returned by the service .
* @ throws InternalServerException
* Indicates a platform issue , which may be due to a transient condition or outage .
* @ throws InvalidRequestException
* Indicates that something is wrong with the input to the request . For example , a required parameter may be
* missing or out of range .
* @ sample AmazonAthena . DeleteNamedQuery
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / athena - 2017-05-18 / DeleteNamedQuery " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DeleteNamedQueryResult deleteNamedQuery ( DeleteNamedQueryRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeleteNamedQuery ( request ) ; |
public class CommerceOrderPaymentPersistenceImpl { /** * Returns all the commerce order payments where commerceOrderId = & # 63 ; .
* @ param commerceOrderId the commerce order ID
* @ return the matching commerce order payments */
@ Override public List < CommerceOrderPayment > findByCommerceOrderId ( long commerceOrderId ) { } } | return findByCommerceOrderId ( commerceOrderId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; |
public class JarWriter { /** * Writes an entry . The { @ code inputStream } is closed once the entry has been written
* @ param entryName The name of the entry
* @ param inputStream The stream from which the entry ' s data can be read
* @ throws IOException if the write fails */
public void writeEntry ( String entryName , InputStream inputStream ) throws IOException { } } | JarEntry entry = new JarEntry ( entryName ) ; writeEntry ( entry , new InputStreamEntryWriter ( inputStream , true ) ) ; |
public class SignatureFieldExtension { /** * Sets the { @ link MimeType } of generated images
* @ param mimeType The { @ link MimeType } of generated images */
public void setMimeType ( MimeType mimeType ) { } } | if ( mimeType != null ) { getState ( ) . mimeType = mimeType . getMimeType ( ) ; } else { getState ( ) . mimeType = null ; } |
public class EJBUtils { /** * Returns true for two methods that have the same name and parameters . < p >
* Similar to Method . equals ( ) , except declaring class and return type are
* NOT considered . < p >
* Useful for determining when multiple component or business interfaces
* implement the same method . . . as they will both be mapped to the same
* methodId . < p >
* @ param m1 first of two methods to compare
* @ param m2 second of two methods to compare
* @ return true if both methods have the same name and parameters ;
* otherwise false . */
static boolean methodsMatch ( Method m1 , Method m2 ) { } } | if ( m1 == m2 ) { return true ; } else if ( m1 . getName ( ) . equals ( m2 . getName ( ) ) ) { Class < ? > [ ] parms1 = m1 . getParameterTypes ( ) ; Class < ? > [ ] parms2 = m2 . getParameterTypes ( ) ; if ( parms1 . length == parms2 . length ) { int length = parms1 . length ; for ( int i = 0 ; i < length ; i ++ ) { if ( parms1 [ i ] != parms2 [ i ] ) return false ; } return true ; } } return false ; |
public class AsciidoctorRenderer { /** * Renders a generic document ( class , field , method , etc )
* @ param doc input */
@ Override public void renderDoc ( Doc doc ) { } } | // hide text that looks like tags ( such as annotations in source code ) from Javadoc
doc . setRawCommentText ( doc . getRawCommentText ( ) . replaceAll ( "@([A-Z])" , "{@literal @}$1" ) ) ; StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( render ( doc . commentText ( ) , false ) ) ; buffer . append ( '\n' ) ; for ( Tag tag : doc . tags ( ) ) { renderTag ( tag , buffer ) ; buffer . append ( '\n' ) ; } doc . setRawCommentText ( buffer . toString ( ) ) ; |
public class EdmondsMaximumMatching { /** * Access the next ancestor in a tree of the forest . Note we go back two
* places at once as we only need check ' even ' vertices .
* @ param ancestors temporary set which fills up the path we traversed
* @ param curr the current even vertex in the tree
* @ return the next ' even ' vertex */
private int parent ( BitSet ancestors , int curr ) { } } | curr = dsf . getRoot ( curr ) ; ancestors . set ( curr ) ; int parent = dsf . getRoot ( even [ curr ] ) ; if ( parent == curr ) return curr ; // root of tree
ancestors . set ( parent ) ; return dsf . getRoot ( odd [ parent ] ) ; |
public class JsonWriter { /** * Converts an object to a JSON formatted string .
* If pretty - printing is enabled , includes spaces , tabs and new - lines to make the format more readable .
* @ param object an object to convert to a JSON formatted string
* @ param indentString the string that should be used for indentation when pretty - printing is enabled
* @ return the JSON formatted string
* @ throws IOException if an I / O error has occurred */
public static String stringify ( Object object , String indentString ) throws IOException { } } | if ( object == null ) { return null ; } Writer out = new StringWriter ( ) ; JsonWriter jsonWriter = new JsonWriter ( out , indentString ) ; jsonWriter . write ( object ) ; jsonWriter . close ( ) ; return out . toString ( ) ; |
public class DurableTracker { /** * VoltDB . It will be recorded in committedOffsets and calculate the offset - safeOffset , which is safe to commit to Kafka */
@ Override public synchronized long commit ( long offset ) { } } | if ( offset <= submittedOffset && offset > safeOffset ) { int ggap = ( int ) Math . min ( committedOffsets . length , offset - safeOffset ) ; if ( ggap == committedOffsets . length ) { LOGGER . rateLimitedLog ( LOG_SUPPRESSION_INTERVAL_SECONDS , Level . WARN , null , "CommitTracker moving topic commit point from %d to %d for topic " + topic + " partition " + partition + " group:" + consumerGroup , safeOffset , ( offset - committedOffsets . length + 1 ) ) ; safeOffset = offset - committedOffsets . length + 1 ; committedOffsets [ idx ( safeOffset ) ] = safeOffset ; } committedOffsets [ idx ( offset ) ] = offset ; while ( ggap > 0 && committedOffsets [ idx ( safeOffset ) ] + 1 == committedOffsets [ idx ( safeOffset + 1 ) ] ) { ++ safeOffset ; } if ( offerOffset >= 0 && ( offerOffset - safeOffset ) < committedOffsets . length ) { offerOffset = - 1L ; notify ( ) ; } } if ( offset == firstOffset ) { firstOffsetCommitted = true ; } return safeOffset ; |
public class DailyCalendar { /** * Sets the time range for the < CODE > DailyCalendar < / CODE > to the times
* represented in the specified < CODE > Calendar < / CODE > s .
* @ param rangeStartingCalendar
* a Calendar containing the start time for the
* < CODE > DailyCalendar < / CODE >
* @ param rangeEndingCalendar
* a Calendar containing the end time for the
* < CODE > DailyCalendar < / CODE > */
public final void setTimeRange ( final Calendar rangeStartingCalendar , final Calendar rangeEndingCalendar ) { } } | setTimeRange ( rangeStartingCalendar . get ( Calendar . HOUR_OF_DAY ) , rangeStartingCalendar . get ( Calendar . MINUTE ) , rangeStartingCalendar . get ( Calendar . SECOND ) , rangeStartingCalendar . get ( Calendar . MILLISECOND ) , rangeEndingCalendar . get ( Calendar . HOUR_OF_DAY ) , rangeEndingCalendar . get ( Calendar . MINUTE ) , rangeEndingCalendar . get ( Calendar . SECOND ) , rangeEndingCalendar . get ( Calendar . MILLISECOND ) ) ; |
public class BaseApplet { /** * Display this status message in the status box or at the bottom of the browser .
* @ param strStatus The message to display in the status box .
* @ param iWarningLevel The warning level to display ( see JOptionPane ) .
* INFORMATION _ MESSAGE / WARNING _ MESSAGE . */
public void setStatusText ( String strStatus , int iWarningLevel ) { } } | if ( strStatus == null ) strStatus = Constants . BLANK ; m_strCurrentStatus = strStatus ; m_iCurrentWarningLevel = iWarningLevel ; // xif ( this . getApplet ( ) ! = null )
// x ( ( BaseApplet ) this . getApplet ( ) ) . showStatus ( strStatus ) ;
// xelse
if ( iWarningLevel != Constants . ERROR ) { // Warning or information
ImageIcon icon = null ; if ( iWarningLevel == Constants . INFORMATION ) icon = this . loadImageIcon ( ThinMenuConstants . INFORMATION ) ; else if ( iWarningLevel == Constants . WARNING ) icon = this . loadImageIcon ( ThinMenuConstants . WARNING ) ; else if ( iWarningLevel == Constants . WAIT ) icon = this . loadImageIcon ( ThinMenuConstants . WAIT ) ; else if ( iWarningLevel == Constants . ERROR ) icon = this . loadImageIcon ( ThinMenuConstants . ERROR ) ; if ( this . getStatusbar ( ) != null ) this . getStatusbar ( ) . showStatus ( strStatus , icon , iWarningLevel ) ; } else { // Full blown error message ( show dialog )
Container frame = BaseApplet . getSharedInstance ( ) ; while ( ( frame = frame . getParent ( ) ) != null ) { if ( frame instanceof JFrame ) { JOptionPane . showMessageDialog ( ( JFrame ) frame , strStatus , "Error: " , JOptionPane . WARNING_MESSAGE ) ; break ; } } } |
public class SepaVersion { /** * Liefert den enum - Type fuer den angegebenen Wert .
* @ param type der Type . " pain " , " camt " .
* @ param value der Wert . 001 , 002 , 008 , . . . .
* @ return der zugehoerige Enum - Wert .
* @ throws IllegalArgumentException wenn der Typ unbekannt ist . */
private static Type findType ( String type , String value ) throws IllegalArgumentException { } } | if ( type == null || type . length ( ) == 0 ) throw new IllegalArgumentException ( "no SEPA type type given" ) ; if ( value == null || value . length ( ) == 0 ) throw new IllegalArgumentException ( "no SEPA version value given" ) ; for ( Type t : Type . values ( ) ) { if ( t . getType ( ) . equalsIgnoreCase ( type ) && t . getValue ( ) . equals ( value ) ) return t ; } throw new IllegalArgumentException ( "unknown SEPA version type: " + type + "." + value ) ; |
public class EntriesCredentialConfiguration { /** * Load configuration values from the provided configuration source . For any key that does not
* have a corresponding value in the configuration , no changes will be made to the state of this
* object . */
public void setConfiguration ( Entries entries ) { } } | for ( String prefix : prefixes ) { Optional < Boolean > enableServiceAccounts = maybeGetBoolean ( entries , prefix + ENABLE_SERVICE_ACCOUNTS_SUFFIX ) ; if ( enableServiceAccounts . isPresent ( ) ) { setEnableServiceAccounts ( enableServiceAccounts . get ( ) ) ; } String serviceEmailAccount = entries . getPassword ( prefix + SERVICE_ACCOUNT_EMAIL_SUFFIX ) ; if ( serviceEmailAccount != null ) { setServiceAccountEmail ( serviceEmailAccount ) ; } // Parameters for ServiceAccount directly in Configuration
String serviceAccountPrivateKeyId = entries . getPassword ( prefix + SERVICE_ACCOUNT_PRIVATE_KEY_ID_SUFFIX ) ; if ( serviceAccountPrivateKeyId != null ) { setServiceAccountPrivateKeyId ( serviceAccountPrivateKeyId ) ; } String serviceAccountPrivateKey = entries . getPassword ( prefix + SERVICE_ACCOUNT_PRIVATE_KEY_SUFFIX ) ; if ( serviceAccountPrivateKey != null ) { setServiceAccountPrivateKey ( serviceAccountPrivateKey ) ; } // Parameters for file based credentials
String serviceAccountKeyFile = entries . get ( prefix + SERVICE_ACCOUNT_KEYFILE_SUFFIX ) ; if ( serviceAccountKeyFile != null ) { setServiceAccountKeyFile ( serviceAccountKeyFile ) ; } String serviceAccountJsonKeyFile = entries . get ( prefix + JSON_KEYFILE_SUFFIX ) ; if ( serviceAccountJsonKeyFile != null ) { setServiceAccountJsonKeyFile ( serviceAccountJsonKeyFile ) ; } String clientId = entries . get ( prefix + CLIENT_ID_SUFFIX ) ; if ( clientId != null ) { setClientId ( clientId ) ; } String clientSecret = entries . get ( prefix + CLIENT_SECRET_SUFFIX ) ; if ( clientSecret != null ) { setClientSecret ( clientSecret ) ; } String oAuthCredentialPath = entries . get ( prefix + OAUTH_CLIENT_FILE_SUFFIX ) ; if ( oAuthCredentialPath != null ) { setOAuthCredentialFile ( oAuthCredentialPath ) ; } Optional < Boolean > enableNullCredential = maybeGetBoolean ( entries , prefix + ENABLE_NULL_CREDENTIAL_SUFFIX ) ; if ( enableNullCredential . isPresent ( ) ) { setNullCredentialEnabled ( enableNullCredential . get ( ) ) ; } } // Transport configuration does not use prefixes
String proxyAddress = entries . get ( PROXY_ADDRESS_KEY ) ; if ( proxyAddress != null ) { setProxyAddress ( proxyAddress ) ; } String proxyUsername = entries . getPassword ( PROXY_USERNAME_KEY ) ; if ( proxyUsername != null ) { setProxyUsername ( proxyUsername ) ; } String proxyPassword = entries . getPassword ( PROXY_PASSWORD_KEY ) ; if ( proxyPassword != null ) { setProxyPassword ( proxyPassword ) ; } String transportType = entries . get ( HTTP_TRANSPORT_KEY ) ; if ( transportType != null ) { setTransportType ( HttpTransportType . valueOf ( transportType ) ) ; } |
public class Trie { /** * 只保留最长词
* @ param collectedEmits */
private static void remainLongest ( Collection < Emit > collectedEmits ) { } } | if ( collectedEmits . size ( ) < 2 ) return ; Map < Integer , Emit > emitMapStart = new TreeMap < Integer , Emit > ( ) ; for ( Emit emit : collectedEmits ) { Emit pre = emitMapStart . get ( emit . getStart ( ) ) ; if ( pre == null || pre . size ( ) < emit . size ( ) ) { emitMapStart . put ( emit . getStart ( ) , emit ) ; } } if ( emitMapStart . size ( ) < 2 ) { collectedEmits . clear ( ) ; collectedEmits . addAll ( emitMapStart . values ( ) ) ; return ; } Map < Integer , Emit > emitMapEnd = new TreeMap < Integer , Emit > ( ) ; for ( Emit emit : emitMapStart . values ( ) ) { Emit pre = emitMapEnd . get ( emit . getEnd ( ) ) ; if ( pre == null || pre . size ( ) < emit . size ( ) ) { emitMapEnd . put ( emit . getEnd ( ) , emit ) ; } } collectedEmits . clear ( ) ; collectedEmits . addAll ( emitMapEnd . values ( ) ) ; |
public class StackUtils { /** * スタックの最後の要素 ( 一番下の要素 ) が引数で指定した文字列と等しいかどうか比較する 。
* @ param stack
* @ param str 比較対象の文字列
* @ return */
public static boolean equalsBottomElement ( final LinkedList < String > stack , final String str ) { } } | if ( stack . isEmpty ( ) ) { return false ; } return stack . peekLast ( ) . equals ( str ) ; |
public class IoUtil { /** * Write the entire contents of the supplied string to the given writer . This method always flushes and closes the writer when
* finished .
* @ param input the content to write to the writer ; may be null
* @ param writer the writer to which the content is to be written
* @ throws IOException
* @ throws IllegalArgumentException if the writer is null */
public static void write ( Reader input , Writer writer ) throws IOException { } } | CheckArg . isNotNull ( writer , "destination writer" ) ; boolean error = false ; try { if ( input != null ) { char [ ] buffer = new char [ 1024 ] ; try { int numRead = 0 ; while ( ( numRead = input . read ( buffer ) ) > - 1 ) { writer . write ( buffer , 0 , numRead ) ; } } finally { input . close ( ) ; } } } catch ( IOException e ) { error = true ; // this error should be thrown , even if there is an error flushing / closing writer
throw e ; } catch ( RuntimeException e ) { error = true ; // this error should be thrown , even if there is an error flushing / closing writer
throw e ; } finally { try { writer . flush ( ) ; } catch ( IOException e ) { if ( ! error ) throw e ; } finally { try { writer . close ( ) ; } catch ( IOException e ) { if ( ! error ) throw e ; } } } |
public class DescribeVpcClassicLinkRequest { /** * One or more VPCs for which you want to describe the ClassicLink status .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setVpcIds ( java . util . Collection ) } or { @ link # withVpcIds ( java . util . Collection ) } if you want to override the
* existing values .
* @ param vpcIds
* One or more VPCs for which you want to describe the ClassicLink status .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeVpcClassicLinkRequest withVpcIds ( String ... vpcIds ) { } } | if ( this . vpcIds == null ) { setVpcIds ( new com . amazonaws . internal . SdkInternalList < String > ( vpcIds . length ) ) ; } for ( String ele : vpcIds ) { this . vpcIds . add ( ele ) ; } return this ; |
public class MailApi { /** * Get mail labels and unread counts Return a list of the users mail labels ,
* unread counts for each label and a total unread count . - - - This route is
* cached for up to 30 seconds SSO Scope : esi - mail . read _ mail . v1
* @ param characterId
* An EVE character ID ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ param token
* Access token to use if unable to set a header ( optional )
* @ return MailLabelsResponse
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public MailLabelsResponse getCharactersCharacterIdMailLabels ( Integer characterId , String datasource , String ifNoneMatch , String token ) throws ApiException { } } | ApiResponse < MailLabelsResponse > resp = getCharactersCharacterIdMailLabelsWithHttpInfo ( characterId , datasource , ifNoneMatch , token ) ; return resp . getData ( ) ; |
public class DefaultGroovyMethods { /** * internal helper method */
protected static < T , K , V > T callClosureForMapEntry ( @ ClosureParams ( value = FromString . class , options = { } } | "K,V" , "Map.Entry<K,V>" } ) Closure < T > closure , Map . Entry < K , V > entry ) { if ( closure . getMaximumNumberOfParameters ( ) == 2 ) { return closure . call ( entry . getKey ( ) , entry . getValue ( ) ) ; } return closure . call ( entry ) ; |
public class NodeUtil { /** * Whether a simple name is referenced within the node tree . */
static boolean isNameReferenced ( Node node , String name ) { } } | return isNameReferenced ( node , name , Predicates . alwaysTrue ( ) ) ; |
public class EditableTreeNodeWithProperties { /** * Set an attribute of this node as Object . This method is backed by
* a HashMap , so all rules of HashMap apply to this method .
* Fires a PropertyChangeEvent . */
public void setAttribute ( String strKey , Object value ) { } } | this . propertyChangeDelegate . firePropertyChange ( strKey , hmAttributes . put ( strKey , value ) , value ) ; |
public class AggregationAwareFilterBean { /** * / * ( non - Javadoc )
* @ see javax . servlet . Filter # doFilter ( javax . servlet . ServletRequest , javax . servlet . ServletResponse , javax . servlet . FilterChain ) */
@ Override public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain ) throws IOException , ServletException { } } | if ( this . elementsProvider . getIncludedType ( ( HttpServletRequest ) request ) == Included . AGGREGATED ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Aggregation enabled, delegating to filter: " + this . filter ) ; } this . filter . doFilter ( request , response , chain ) ; } else { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Aggregation disabled, skipping filter: " + this . filter ) ; } chain . doFilter ( request , response ) ; } |
public class BinaryHashTable { /** * Put a build side row to hash table . */
public void putBuildRow ( BaseRow row ) throws IOException { } } | final int hashCode = hash ( this . buildSideProjection . apply ( row ) . hashCode ( ) , 0 ) ; // TODO : combine key projection and build side conversion to code gen .
insertIntoTable ( originBuildSideSerializer . baseRowToBinary ( row ) , hashCode ) ; |
public class DummyInternalTransaction { /** * ( non - Javadoc )
* @ see com . ibm . ws . objectManager . InternalTransaction # preBackout ( com . ibm . ws . objectManager . Transaction ) */
void preBackout ( Transaction transaction ) throws ObjectManagerException { } } | throw new InvalidStateException ( this , InternalTransaction . stateTerminated , InternalTransaction . stateNames [ InternalTransaction . stateTerminated ] ) ; |
public class MediathekReader { /** * Es werden die gefundenen Filme in die Liste einsortiert .
* @ param film der einzufügende Film */
protected void addFilm ( DatenFilm film ) { } } | film . setFileSize ( ) ; upgradeUrl ( film ) ; film . setUrlHistory ( ) ; setGeo ( film ) ; if ( mlibFilmeSuchen . listeFilmeNeu . addFilmVomSender ( film ) ) { // dann ist er neu
FilmeSuchen . listeSenderLaufen . inc ( film . arr [ DatenFilm . FILM_SENDER ] , RunSender . Count . FILME ) ; } |
public class WebSocketNodeService { /** * 当用户连接到节点 , 需要更新到CacheSource
* @ param userid Serializable
* @ param sncpAddr InetSocketAddress
* @ return 无返回值 */
@ Override public CompletableFuture < Void > connect ( Serializable userid , InetSocketAddress sncpAddr ) { } } | tryAcquireSemaphore ( ) ; CompletableFuture < Void > future = sncpNodeAddresses . appendSetItemAsync ( SOURCE_SNCP_USERID_PREFIX + userid , InetSocketAddress . class , sncpAddr ) ; future = future . thenAccept ( ( a ) -> sncpNodeAddresses . appendSetItemAsync ( SOURCE_SNCP_ADDRS_KEY , InetSocketAddress . class , sncpAddr ) ) ; if ( semaphore != null ) future . whenComplete ( ( r , e ) -> releaseSemaphore ( ) ) ; if ( logger . isLoggable ( Level . FINEST ) ) logger . finest ( WebSocketNodeService . class . getSimpleName ( ) + ".event: " + userid + " connect from " + sncpAddr ) ; return future ; |
public class UllmannState { /** * Verify that for every vertex adjacent to n , there should be at least one
* feasible candidate adjacent which can be mapped . If no such candidate
* exists the mapping of n - > m is not longer valid .
* @ param n query vertex
* @ param m target vertex
* @ return mapping is still valid */
private boolean verify ( int n , int m ) { } } | for ( int n_prime : g1 [ n ] ) { boolean found = false ; for ( int m_prime : g2 [ m ] ) { if ( matrix . get ( n_prime , m_prime ) && bondMatcher . matches ( bond1 . get ( n , n_prime ) , bonds2 . get ( m , m_prime ) ) ) { found = true ; break ; } } if ( ! found ) return false ; } return true ; |
public class AbstractWSelectList { /** * Override preparePaintComponent to register an AJAX operation if this list is AJAX enabled .
* @ param request the request being responded to . */
@ Override protected void preparePaintComponent ( final Request request ) { } } | super . preparePaintComponent ( request ) ; if ( isAjax ( ) && UIContextHolder . getCurrent ( ) . getUI ( ) != null ) { AjaxTarget target = getAjaxTarget ( ) ; AjaxHelper . registerComponent ( target . getId ( ) , getId ( ) ) ; } String cacheKey = getListCacheKey ( ) ; if ( cacheKey != null ) { LookupTableHelper . registerList ( cacheKey , request ) ; } |
public class WebDriverTool { /** * Execute JavaScript in the context of the currently selected frame or window .
* @ see JavascriptExecutor # executeScript ( String , Object . . . )
* @ param script
* The JavaScript to execute
* @ param args
* The arguments to the script . May be empty
* @ return One of Boolean , Long , String , List or WebElement . Or null . */
public Object executeScript ( final String script , final Object ... args ) { } } | LOGGER . info ( "executeScript: {}" , new ToStringBuilder ( this , LoggingToStringStyle . INSTANCE ) . append ( "script" , script ) . append ( "args" , args ) ) ; return ( ( JavascriptExecutor ) webDriver ) . executeScript ( script , args ) ; |
public class Activator { /** * { @ inheritDoc } */
@ Override public void start ( BundleContext context ) throws Exception { } } | hpelConfigService = new AbstractHPELConfigService [ ] { new AbstractHPELConfigService ( context , "com.ibm.ws.logging.binaryLog" ) { @ Override void forwardUpdated ( Map < String , Object > map ) { HpelConfigurator . updateLog ( map ) ; } } , new AbstractHPELConfigService ( context , "com.ibm.ws.logging.binaryTrace" ) { @ Override void forwardUpdated ( Map < String , Object > map ) { HpelConfigurator . updateTrace ( map ) ; } } // new AbstractHPELConfigService ( context , " com . ibm . ws . logging . textLog " ) {
// @ Override
// void forwardUpdated ( Map < String , Object > map ) {
// HpelConfigurator . updateText ( map ) ;
} ; |
public class PearsonCorrelation { /** * Computes the correlation between two datasets .
* @ param list1 The first dataset as a list .
* @ param list2 The second dataset as a list .
* @ return The correlation between the two datasets . */
public static double computeCorrelation ( final List < Double > list1 , final List < Double > list2 ) { } } | final double [ ] doubleArray1 = new double [ list1 . size ( ) ] ; final double [ ] doubleArray2 = new double [ list2 . size ( ) ] ; int off1 = 0 ; for ( final double item : list1 ) { doubleArray1 [ off1 ] = item ; off1 ++ ; } int off2 = 0 ; for ( final double item : list2 ) { doubleArray2 [ off2 ] = item ; off2 ++ ; } final double correlation = computeCorrelation ( doubleArray1 , doubleArray2 ) ; return correlation ; |
public class Call { /** * Dials a call , from a phone number to a phone number .
* @ param params the call params
* @ return the call
* @ throws IOException unexpected error . */
public static Call create ( final Map < String , Object > params ) throws Exception { } } | assert ( params != null ) ; return create ( BandwidthClient . getInstance ( ) , params ) ; |
public class Bytes { /** * Concatenate < i > n < / i > byte arrays */
public static byte [ ] add ( byte [ ] ... b ) { } } | int nLen = 0 ; for ( int i = 0 ; i < b . length ; i ++ ) { nLen += b [ i ] . length ; } byte [ ] lp = new byte [ nLen ] ; nLen = 0 ; for ( int i = 0 ; i < b . length ; i ++ ) { byte [ ] lpi = b [ i ] ; System . arraycopy ( lpi , 0 , lp , nLen , lpi . length ) ; nLen += lpi . length ; } return lp ; |
public class NodeReportsInner { /** * Retrieve the Dsc node report list by node id .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ param serviceFuture the ServiceFuture object tracking the Retrofit calls
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < List < DscNodeReportInner > > listByNodeNextAsync ( final String nextPageLink , final ServiceFuture < List < DscNodeReportInner > > serviceFuture , final ListOperationCallback < DscNodeReportInner > serviceCallback ) { } } | return AzureServiceFuture . fromPageResponse ( listByNodeNextSinglePageAsync ( nextPageLink ) , new Func1 < String , Observable < ServiceResponse < Page < DscNodeReportInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < DscNodeReportInner > > > call ( String nextPageLink ) { return listByNodeNextSinglePageAsync ( nextPageLink ) ; } } , serviceCallback ) ; |
public class ClientSocket { /** * Receive messages data from the client .
* @ return The messages data . */
public byte [ ] receiveMessages ( ) { } } | try { final byte [ ] data ; final int size = in . available ( ) ; if ( size <= 0 ) { data = null ; } else { data = new byte [ size ] ; in . readFully ( data ) ; } return data ; } catch ( final IOException exception ) { Verbose . exception ( exception ) ; return new byte [ 0 ] ; } |
public class XsdAsmUtils { /** * Obtains a { @ link Set } of ambiguous names from a given interface hierarchy .
* @ param interfaceInfoList A { @ link List } of { @ link InterfaceInfo } containing interface information .
* @ return A { @ link Set } of ambiguous method names . */
static Set < String > getAmbiguousMethods ( List < InterfaceInfo > interfaceInfoList ) { } } | Set < String > ambiguousNames = new HashSet < > ( ) ; Set < String > dummy = new HashSet < > ( ) ; List < String > interfaceMethods = getAllInterfaceMethodInfo ( interfaceInfoList ) ; interfaceMethods . forEach ( interfaceMethod -> { boolean methodNameAlreadyPresent = dummy . add ( interfaceMethod ) ; if ( ! methodNameAlreadyPresent ) { ambiguousNames . add ( interfaceMethod ) ; } } ) ; return ambiguousNames ; |
public class Utils { /** * Generate the name for the executor class . Must use ' $ ' so that it is considered by some code ( eclipse debugger
* for example ) to be an inner type of the original class ( thus able to consider itself as being from the same
* source file ) .
* @ param name the name prefix for the executor class
* @ param versionstamp the suffix string for the executor class name
* @ return an executor class name */
public static String getExecutorName ( String name , String versionstamp ) { } } | StringBuilder s = new StringBuilder ( name ) ; s . append ( "$$E" ) ; s . append ( versionstamp ) ; return s . toString ( ) ; |
public class NoiseReduction { /** * Function : diff _ y - To compute differntiation along y axis . */
public double [ ] [ ] diff_y ( double maty [ ] [ ] ) { } } | mat3 = new double [ width ] [ height ] ; double mat1 , mat2 ; for ( int i = 0 ; i < width ; i ++ ) { for ( int j = 0 ; j < height ; j ++ ) { if ( i == 0 ) { mat1 = maty [ i ] [ j ] ; mat2 = maty [ i + 1 ] [ j ] ; } else if ( i == width - 1 ) { mat1 = maty [ i - 1 ] [ j ] ; mat2 = maty [ i ] [ j ] ; } else { mat1 = maty [ i - 1 ] [ j ] ; mat2 = maty [ i + 1 ] [ j ] ; } mat3 [ i ] [ j ] = ( mat2 - mat1 ) / 2 ; } } // maty = subMatrix ( mat2 , mat1 , width , height ) ;
return mat3 ; |
public class InMemoryRateLimiterRegistry { /** * { @ inheritDoc } */
@ Override public RateLimiter rateLimiter ( final String name , final Supplier < RateLimiterConfig > rateLimiterConfigSupplier ) { } } | return computeIfAbsent ( name , ( ) -> new AtomicRateLimiter ( name , Objects . requireNonNull ( Objects . requireNonNull ( rateLimiterConfigSupplier , SUPPLIER_MUST_NOT_BE_NULL ) . get ( ) , CONFIG_MUST_NOT_BE_NULL ) ) ) ; |
public class Classfile { /** * Get a string from the constant pool , optionally replacing ' / ' with ' . ' .
* @ param cpIdx
* the constant pool index
* @ param replaceSlashWithDot
* if true , replace slash with dot in the result .
* @ param stripLSemicolon
* if true , strip ' L ' from the beginning and ' ; ' from the end before returning ( for class reference
* constants )
* @ return the constant pool string
* @ throws ClassfileFormatException
* If a problem occurs .
* @ throws IOException
* If an IO exception occurs . */
private String getConstantPoolString ( final int cpIdx , final boolean replaceSlashWithDot , final boolean stripLSemicolon ) throws ClassfileFormatException , IOException { } } | final int constantPoolStringOffset = getConstantPoolStringOffset ( cpIdx , /* subFieldIdx = */
0 ) ; return constantPoolStringOffset == 0 ? null : intern ( inputStreamOrByteBuffer . readString ( constantPoolStringOffset , replaceSlashWithDot , stripLSemicolon ) ) ; |
public class Sysprop { /** * Checks for the existence of a property .
* @ param name the key
* @ return true if a property with this key exists */
public boolean hasProperty ( String name ) { } } | if ( StringUtils . isBlank ( name ) ) { return false ; } return getProperties ( ) . containsKey ( name ) ; |
public class EntityType { /** * Add a sequence number to the attribute . If the sequence number exists add it ot the attribute .
* If the sequence number does not exists then find the highest sequence number . If Entity has not
* attributes with sequence numbers put 0.
* @ param attr the attribute to add
* @ param attrs existing attributes */
static void addSequenceNumber ( Attribute attr , Iterable < Attribute > attrs ) { } } | Integer sequenceNumber = attr . getSequenceNumber ( ) ; if ( null == sequenceNumber ) { int i = stream ( attrs ) . filter ( a -> null != a . getSequenceNumber ( ) ) . mapToInt ( Attribute :: getSequenceNumber ) . max ( ) . orElse ( - 1 ) ; if ( i == - 1 ) attr . setSequenceNumber ( 0 ) ; else attr . setSequenceNumber ( ++ i ) ; } |
public class JFinalConfigExt { /** * Config interceptor applied to all actions . */
public void configInterceptor ( Interceptors me ) { } } | // add excetion interceptor
me . add ( new ExceptionInterceptor ( ) ) ; if ( this . getHttpPostMethod ( ) ) { me . add ( new POST ( ) ) ; } // config others
configMoreInterceptors ( me ) ; |
public class ResourcesInner { /** * Deletes a resource by ID .
* @ param resourceId The fully qualified ID of the resource , including the resource name and resource type . Use the format , / subscriptions / { guid } / resourceGroups / { resource - group - name } / { resource - provider - namespace } / { resource - type } / { resource - name }
* @ param apiVersion The API version to use for the operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < Void > deleteByIdAsync ( String resourceId , String apiVersion ) { } } | return deleteByIdWithServiceResponseAsync ( resourceId , apiVersion ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class QueryBuilder { /** * Execute a series of commands
* @ return
* @ throws Exception */
public JSONArray execute ( ) throws Exception { } } | try { JSONArray retVal = Client . getInstance ( port ) . map ( toString ( ) ) ; return retVal ; } catch ( Exception e ) { throw new Exception ( queryStringRepresentation + ": " + e . getMessage ( ) ) ; } |
public class WeakFastHashMap { /** * Return the value to which this map maps the specified key . Returns
* < code > null < / code > if the map contains no mapping for this key , or if
* there is a mapping with a value of < code > null < / code > . Use the
* < code > containsKey ( ) < / code > method to disambiguate these cases .
* @ param key the key whose value is to be returned
* @ return the value mapped to that key , or null */
@ Override public V get ( Object key ) { } } | if ( fast ) { return ( map . get ( key ) ) ; } else { synchronized ( map ) { return ( map . get ( key ) ) ; } } |
public class StringsExample { /** * Converts an arguments array into a single String of words
* separated by spaces .
* @ param args The command - line arguments .
* @ return A single String made from the command line data . */
private static String convertArgs ( String [ ] args ) { } } | StringBuilder result = new StringBuilder ( ) ; for ( int i = 0 ; i < args . length ; i ++ ) { result . append ( args [ i ] ) ; if ( i < args . length - 1 ) { result . append ( ' ' ) ; } } return result . toString ( ) . toUpperCase ( ) ; |
public class MapAttachmentResourceHandler { /** * Register a new attachment resource handler .
* @ param clazz
* the class of the attachment resource
* @ param handler
* the attachment resource handler */
public void addResourceHandler ( Class < ? extends NamedResource > clazz , JavaMailAttachmentResourceHandler handler ) { } } | map . put ( clazz , handler ) ; |
public class SessionManager { /** * Create and return new ExtWebDriver instance with default options . If
* setAsCurrent is true , set the new session as the current session for this
* SessionManager .
* @ param setAsCurrent
* set to true if the new session should become the current
* session for this SessionManager
* @ return A new ExtWebDriver session
* @ throws Exception */
public ExtWebDriver getNewSession ( boolean setAsCurrent ) throws Exception { } } | Map < String , String > options = sessionFactory . get ( ) . createDefaultOptions ( ) ; return getNewSessionDo ( options , setAsCurrent ) ; |
public class ClusteringKeyMapper { /** * Returns the specified list of clustering keys sorted according to the table cell name comparator .
* @ param clusteringKeys The list of clustering keys to be sorted .
* @ return The specified list of clustering keys sorted according to the table cell name comparator . */
public final List < CellName > sort ( List < CellName > clusteringKeys ) { } } | List < CellName > result = new ArrayList < > ( clusteringKeys ) ; Collections . sort ( result , new Comparator < CellName > ( ) { @ Override public int compare ( CellName o1 , CellName o2 ) { return cellNameType . compare ( o1 , o2 ) ; } } ) ; return result ; |
public class SpringBeanProxyTargetLocator { /** * { @ inheritDoc } */
@ Override protected String getApplicationContextFilter ( String symbolicBundleName ) { } } | return String . format ( "(&(%s=%s)(%s=%s))" , Constants . BUNDLE_SYMBOLICNAME , symbolicBundleName , Constants . OBJECTCLASS , ApplicationContext . class . getName ( ) ) ; |
public class CalibrationIO { /** * Loads intrinsic parameters from disk
* @ param reader Reader
* @ return Camera model */
public static < T > T load ( Reader reader ) { } } | Yaml yaml = createYmlObject ( ) ; Map < String , Object > data = ( Map < String , Object > ) yaml . load ( reader ) ; try { reader . close ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return load ( data ) ; |
public class EDXImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . EDX__DMX_NAME : setDMXName ( DMX_NAME_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class Rollbar { /** * Get the level of the error or message . The Config passed in contains the defaults
* to use for the cases of an Error , Throwable , or a Message . The default in the Config
* if otherwise left unspecified is : CRITICAL for { @ link Error } , ERROR for other
* { @ link Throwable } , WARNING for messages . Use the methods on ConfigBuilder to
* change these defaults
* @ param config the current Config .
* @ param error the error .
* @ return the level . */
public Level level ( Config config , Throwable error ) { } } | if ( error == null ) { return config . defaultMessageLevel ( ) ; } if ( error instanceof Error ) { return config . defaultErrorLevel ( ) ; } return config . defaultThrowableLevel ( ) ; |
public class DOMDifferenceEngine { /** * Compares properties of the doctype declaration . */
private ComparisonState compareDocTypes ( DocumentType control , XPathContext controlContext , DocumentType test , XPathContext testContext ) { } } | return compare ( new Comparison ( ComparisonType . DOCTYPE_NAME , control , getXPath ( controlContext ) , control . getName ( ) , getParentXPath ( controlContext ) , test , getXPath ( testContext ) , test . getName ( ) , getParentXPath ( testContext ) ) ) . andThen ( new Comparison ( ComparisonType . DOCTYPE_PUBLIC_ID , control , getXPath ( controlContext ) , control . getPublicId ( ) , getParentXPath ( controlContext ) , test , getXPath ( testContext ) , test . getPublicId ( ) , getParentXPath ( testContext ) ) ) . andThen ( new Comparison ( ComparisonType . DOCTYPE_SYSTEM_ID , control , null , control . getSystemId ( ) , null , test , null , test . getSystemId ( ) , null ) ) ; |
public class OpenAPIModelFilterAdapter { /** * { @ inheritDoc } */
@ Override public Encoding visitEncoding ( Context context , String key , Encoding encoding ) { } } | visitor . visitEncoding ( context , key , encoding ) ; return encoding ; |
public class JSDocInfo { /** * Returns whether there is a declaration present on this { @ link JSDocInfo } .
* < p > Does not consider ` @ const ` ( without a following type ) to indicate a declaration . Whether you
* want this method , or the ` containsDeclaration ` that includes const , depends on whether you want
* to consider { @ code / * * @ const * / a . b . c = 0 } a declaration or not . */
public boolean containsDeclarationExcludingTypelessConst ( ) { } } | return ( hasType ( ) || hasReturnType ( ) || hasEnumParameterType ( ) || hasTypedefType ( ) || hasThisType ( ) || getParameterCount ( ) > 0 || getImplementedInterfaceCount ( ) > 0 || hasBaseType ( ) || visibility != Visibility . INHERITED || getFlag ( MASK_CONSTRUCTOR | MASK_DEFINE | MASK_OVERRIDE | MASK_EXPORT | MASK_EXPOSE | MASK_DEPRECATED | MASK_INTERFACE | MASK_IMPLICITCAST | MASK_NOSIDEEFFECTS | MASK_RECORD ) ) ; |
public class FirewallRulesInner { /** * Returns a list of firewall rules .
* @ 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 .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the List & lt ; FirewallRuleInner & gt ; object if successful . */
public List < FirewallRuleInner > listByServer ( String resourceGroupName , String serverName ) { } } | return listByServerWithServiceResponseAsync ( resourceGroupName , serverName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class FractionSimplify { /** * This function checks if the multiplication of two fractions given as strings
* simplifies to a whole number or not . Both numerator and denominator of the
* fractions are positive whole numbers .
* @ param fraction _ 1 : String representation of a fraction .
* @ param fraction _ 2 : String representation of a fraction .
* @ return True if the multiplication simplifies to a whole number .
* False otherwise .
* Examples :
* fractionSimplify ( " 1/5 " , " 5/1 " ) / / returns True
* fractionSimplify ( " 1/6 " , " 2/1 " ) / / returns False
* fractionSimplify ( " 7/10 " , " 10/2 " ) / / returns False */
public static boolean fractionSimplify ( String fraction_1 , String fraction_2 ) { } } | String [ ] fraction1Parts = fraction_1 . split ( "/" ) ; String [ ] fraction2Parts = fraction_2 . split ( "/" ) ; int num_1 = Integer . parseInt ( fraction1Parts [ 0 ] ) ; int den_1 = Integer . parseInt ( fraction1Parts [ 1 ] ) ; int num_2 = Integer . parseInt ( fraction2Parts [ 0 ] ) ; int den_2 = Integer . parseInt ( fraction2Parts [ 1 ] ) ; double result = ( num_1 * num_2 ) / ( double ) ( den_1 * den_2 ) ; return result == ( int ) result ; |
public class Session { /** * Request a list of resources
* @ param requestList List of resource requests */
public void requestResource ( List < ResourceRequestInfo > requestList ) { } } | if ( deleted ) { throw new RuntimeException ( "Session: " + sessionId + " has been deleted" ) ; } for ( ResourceRequestInfo req : requestList ) { boolean newRequest = idToRequest . put ( req . getId ( ) , req ) == null ; if ( ! newRequest ) { LOG . warn ( "Duplicate request from Session: " + sessionId + "" + " request: " + req . getId ( ) ) ; continue ; } incrementRequestCount ( req . getType ( ) , 1 ) ; addPendingRequest ( req ) ; setTypeRequested ( req . getType ( ) ) ; } |
public class StatsSource { /** * Called from the constructor to generate the column schema at run time .
* Derived classes need to override this method in order to specify the
* columns they will be adding . The first line must always be a call the
* superclasses version of populateColumnSchema
* in order to ensure the columns are add to the list in the right order .
* @ param columns Output list for the column schema . */
protected void populateColumnSchema ( ArrayList < ColumnInfo > columns ) { } } | columns . add ( new ColumnInfo ( "TIMESTAMP" , VoltType . BIGINT ) ) ; columns . add ( new ColumnInfo ( VoltSystemProcedure . CNAME_HOST_ID , VoltSystemProcedure . CTYPE_ID ) ) ; columns . add ( new ColumnInfo ( "HOSTNAME" , VoltType . STRING ) ) ; |
public class PoolStatisticsImpl { /** * Add delta to total pool time
* @ param delta The value */
public void deltaTotalPoolTime ( long delta ) { } } | if ( enabled . get ( ) && delta > 0 ) { totalPoolTime . addAndGet ( delta ) ; totalPoolTimeInvocations . incrementAndGet ( ) ; if ( delta > maxPoolTime . get ( ) ) maxPoolTime . set ( delta ) ; } |
public class Stream { /** * If specified element is null , returns an empty { @ code Stream } ,
* otherwise returns a { @ code Stream } containing a single element .
* @ param < T > the type of the stream element
* @ param element the element to be passed to stream if it is non - null
* @ return the new stream
* @ since 1.1.5 */
@ NotNull @ SuppressWarnings ( "unchecked" ) public static < T > Stream < T > ofNullable ( @ Nullable T element ) { } } | return ( element == null ) ? Stream . < T > empty ( ) : Stream . of ( element ) ; |
public class l4param { /** * Use this API to update l4param . */
public static base_response update ( nitro_service client , l4param resource ) throws Exception { } } | l4param updateresource = new l4param ( ) ; updateresource . l2connmethod = resource . l2connmethod ; updateresource . l4switch = resource . l4switch ; return updateresource . update_resource ( client ) ; |
public class StreamMessageImpl { /** * ( non - Javadoc )
* @ see javax . jms . StreamMessage # readChar ( ) */
@ Override public char readChar ( ) throws JMSException { } } | backupState ( ) ; try { return MessageConvertTools . asChar ( internalReadObject ( ) ) ; } catch ( JMSException e ) { restoreState ( ) ; throw e ; } catch ( RuntimeException e ) { restoreState ( ) ; throw e ; } |
public class SpringBootUtilTask { /** * Process the command .
* @ param command
* A String list containing the command to be executed . */
private void processCommand ( List < String > command ) throws Exception { } } | processBuilder . command ( command ) ; Process p = processBuilder . start ( ) ; checkReturnCode ( p , processBuilder . command ( ) . toString ( ) , 0 ) ; |
public class AbstractAmazonSQSAsync { /** * Simplified method form for invoking the ChangeMessageVisibility operation with an AsyncHandler .
* @ see # changeMessageVisibilityAsync ( ChangeMessageVisibilityRequest , com . amazonaws . handlers . AsyncHandler ) */
@ Override public java . util . concurrent . Future < ChangeMessageVisibilityResult > changeMessageVisibilityAsync ( String queueUrl , String receiptHandle , Integer visibilityTimeout , com . amazonaws . handlers . AsyncHandler < ChangeMessageVisibilityRequest , ChangeMessageVisibilityResult > asyncHandler ) { } } | return changeMessageVisibilityAsync ( new ChangeMessageVisibilityRequest ( ) . withQueueUrl ( queueUrl ) . withReceiptHandle ( receiptHandle ) . withVisibilityTimeout ( visibilityTimeout ) , asyncHandler ) ; |
public class StringGroovyMethods { /** * Get a replacement corresponding to the matched pattern for { @ link org . codehaus . groovy . runtime . StringGroovyMethods # replaceAll ( String , java . util . regex . Pattern , groovy . lang . Closure ) } .
* The closure take parameter :
* < ul >
* < li > Whole of match if the pattern include no capturing group < / li >
* < li > Object [ ] of capturing groups if the closure takes Object [ ] as parameter < / li >
* < li > List of capturing groups < / li >
* < / ul >
* @ param matcher the matcher object used for matching
* @ param closure specified with replaceAll ( ) to get replacement
* @ return replacement correspond replacement for a match */
private static String getReplacement ( Matcher matcher , Closure closure ) { } } | if ( ! hasGroup ( matcher ) ) { return InvokerHelper . toString ( closure . call ( matcher . group ( ) ) ) ; } int count = matcher . groupCount ( ) ; List < String > groups = new ArrayList < String > ( ) ; for ( int i = 0 ; i <= count ; i ++ ) { groups . add ( matcher . group ( i ) ) ; } if ( closure . getParameterTypes ( ) . length == 1 && closure . getParameterTypes ( ) [ 0 ] == Object [ ] . class ) { return InvokerHelper . toString ( closure . call ( groups . toArray ( ) ) ) ; } return InvokerHelper . toString ( closure . call ( groups ) ) ; |
public class ICalendar { /** * Marshals this iCalendar object to its traditional , plain - text
* representation .
* If this iCalendar object contains user - defined property or component
* objects , you must use the { @ link Biweekly } or { @ link ICalWriter } classes
* instead in order to register the scribe classes .
* @ return the plain text representation
* @ throws IllegalArgumentException if this iCalendar object contains
* user - defined property or component objects */
public String write ( ) { } } | ICalVersion version = ( this . version == null ) ? ICalVersion . V2_0 : this . version ; return Biweekly . write ( this ) . version ( version ) . go ( ) ; |
public class LostExceptionStackTrace { /** * implements the visitor to make sure the jdk is 1.4 or better
* @ param classContext
* the context object of the currently parsed class */
@ Override public void visitClassContext ( ClassContext classContext ) { } } | try { if ( ( throwableClass != null ) && ! isPre14Class ( classContext . getJavaClass ( ) ) ) { stack = new OpcodeStack ( ) ; catchInfos = new HashSet < > ( ) ; exReg = new HashMap < > ( ) ; super . visitClassContext ( classContext ) ; } } finally { stack = null ; catchInfos = null ; exceptions = null ; exReg = null ; } |
public class SelectBase { /** * Returns the item list .
* @ return the item list */
public List < Option > getItems ( ) { } } | List < Option > selectedItems = new ArrayList < > ( 0 ) ; NodeList < OptionElement > items = selectElement . getOptions ( ) ; for ( int i = 0 ; i < items . getLength ( ) ; i ++ ) { OptionElement item = items . getItem ( i ) ; Option option = itemMap . get ( item ) ; if ( option != null ) selectedItems . add ( option ) ; } return selectedItems ; |
public class PsFacebook { /** * Retrieve Facebook access token .
* @ param home Home of this page
* @ param code Facebook " authorization code "
* @ return The token
* @ throws IOException If failed */
private String token ( final String home , final String code ) throws IOException { } } | final String response = this . request . uri ( ) . set ( URI . create ( new Href ( PsFacebook . ACCESS_TOKEN_URL ) . with ( PsFacebook . CLIENT_ID , this . app ) . with ( "redirect_uri" , home ) . with ( PsFacebook . CLIENT_SECRET , this . key ) . with ( PsFacebook . CODE , code ) . toString ( ) ) ) . back ( ) . fetch ( ) . as ( RestResponse . class ) . assertStatus ( HttpURLConnection . HTTP_OK ) . body ( ) ; final String [ ] sectors = response . split ( "&" ) ; for ( final String sector : sectors ) { final String [ ] pair = sector . split ( "=" ) ; if ( pair . length != 2 ) { throw new IllegalArgumentException ( String . format ( "Invalid response: '%s'" , response ) ) ; } if ( "access_token" . equals ( pair [ 0 ] ) ) { return pair [ 1 ] ; } } throw new IllegalArgumentException ( String . format ( "Access token not found in response: '%s'" , response ) ) ; |
public class PooledBufferedOutputStream { /** * Writes the specified byte to this byte array output stream .
* @ param b the byte to be written . */
@ Override public synchronized void write ( final int b ) { } } | BufferPool . Buffer buff = getBuffer ( count , false ) ; if ( buff == null ) { buff = newBuffer ( ) ; } if ( ! buff . putByte ( b ) ) { buff = newBuffer ( ) ; if ( ! buff . putByte ( b ) ) { throw new RuntimeException ( "Logic error in write(b)" ) ; } } count ++ ; |
public class Serializer { /** * Write one object serilized to a output stream .
* @ param obj The Object to serilize .
* @ param out The output stream to write it to . This will be closed ! */
public static < T extends Serializable > void serializeToStream ( T obj , OutputStream out ) throws IOException { } } | ObjectOutputStream objOut ; if ( out instanceof ObjectOutputStream ) objOut = ( ObjectOutputStream ) out ; else objOut = new ObjectOutputStream ( out ) ; objOut . writeObject ( obj ) ; objOut . close ( ) ; |
public class AmqpClient { /** * Disconnects from Amqp Server . */
public void disconnect ( ) { } } | if ( readyState == ReadyState . OPEN ) { // readyState should be set to ReadyState . CLOSED ONLY AFTER the
// the WebSocket has been successfully closed in
// socketClosedHandler ( ) .
this . closeConnection ( 0 , "" , 0 , 0 , null , null ) ; } else if ( readyState == ReadyState . CONNECTING ) { socketClosedHandler ( ) ; } |
public class MeetingController { /** * Method used to stream all meetings at work that are
* snoozers and are really hard to stay awake but , you still have
* to pay attention because someone is going to call on you and ask
* you a dumb question .
* @ return A list of really boring meetings */
@ SuppressWarnings ( { } } | "unchecked" , "SpellCheckingInspection" } ) List < Meeting > findBoringMeetings ( ) { Query query = new Query ( Meeting . class , new QueryCriteria ( "notes" , QueryCriteriaOperator . CONTAINS , "Boring" ) ) ; List < Meeting > boringMeetings = null ; try { boringMeetings = persistenceManager . executeQuery ( query ) ; } catch ( OnyxException e ) { // Log an error
} return boringMeetings ; |
public class SibRaSynchronizedDispatcher { /** * Invoked before delivery of a message . Calls < code > beforeDelivery < / code >
* on the endpoint and then deletes the message under that transaction .
* @ param message
* the message that is about to be delivered
* @ param endpoint
* the message endpoint we are using
* @ throws ResourceAdapterInternalException
* if the endpoint method does not exist or the
* < code > XAResource < / code > is not enlisted
* @ throws ResourceException
* if before delivery failed */
protected void beforeDelivery ( final SIBusMessage message , final MessageEndpoint endpoint ) throws ResourceException { } } | final String methodName = "beforeDelivery" ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { message , endpoint } ) ; } // This will call before delivery on the endpoint
beforeDelivery ( endpoint ) ; /* * Delete the message under the transaction */
deleteMessage ( message , getTransactionForDelete ( ) ) ; |
public class BeangleObjectWrapper { /** * 特殊包装set和map */
public TemplateModel wrap ( Object obj ) throws TemplateModelException { } } | if ( obj == null ) { return super . wrap ( null ) ; } if ( obj instanceof List < ? > ) { return new CollectionModel ( ( Collection < ? > ) obj , this ) ; } // 使得set等集合可以排序
if ( obj instanceof Collection < ? > ) { return new SimpleSequence ( ( Collection < ? > ) obj , this ) ; } if ( obj instanceof Map < ? , ? > ) { if ( altMapWrapper ) { return new FriendlyMapModel ( ( Map < ? , ? > ) obj , this ) ; } else { return new MapModel ( ( Map < ? , ? > ) obj , this ) ; } } return super . wrap ( obj ) ; |
public class ApiError { /** * Gets the fieldPathElements value for this ApiError .
* @ return fieldPathElements * A parsed copy of the field path . For example , the field path
* " operations [ 1 ] . operand "
* corresponds to this list : { FieldPathElement ( field
* = " operations " , index = 1 ) ,
* FieldPathElement ( field = " operand " , index = null ) } . */
public com . google . api . ads . adwords . axis . v201809 . cm . FieldPathElement [ ] getFieldPathElements ( ) { } } | return fieldPathElements ; |
public class BaseScreen { /** * Process the command .
* Step 1 - Process the command if possible and return true if processed .
* Step 2 - If I can ' t process , pass to all children ( with me as the source ) .
* Step 3 - If children didn ' t process , pass to parent ( with me as the source ) .
* Note : Never pass to a parent or child that matches the source ( to avoid an endless loop ) .
* @ param strCommand The command to process .
* @ param sourceSField The source screen field ( to avoid echos ) .
* @ param iCommandOptions If this command creates a new screen , create in a new window ?
* @ return true if success . */
public boolean doCommand ( String strCommand , ScreenField sourceSField , int iCommandOptions ) { } } | if ( strCommand . indexOf ( '=' ) == - 1 ) if ( this . getMainRecord ( ) != null ) { int iDocType = this . getMainRecord ( ) . commandToDocType ( strCommand ) ; if ( iDocType > ScreenConstants . LAST_MODE ) { // Display the user defined screen .
boolean bSuccess = ( this . onForm ( null , iDocType , true , iCommandOptions , null ) != null ) ; if ( bSuccess ) return bSuccess ; // Return if successful .
} } return super . doCommand ( strCommand , sourceSField , iCommandOptions ) ; // This will send the command to my view |
public class BluetoothService { /** * Stop all threads */
public synchronized void stop ( ) { } } | if ( mConnectThread != null ) { mConnectThread . cancel ( ) ; mConnectThread = null ; } if ( mConnectedThread != null ) { mConnectedThread . cancel ( ) ; mConnectedThread = null ; } if ( mSecureAcceptThread != null ) { mSecureAcceptThread . cancel ( ) ; mSecureAcceptThread . kill ( ) ; mSecureAcceptThread = null ; } setState ( BluetoothService . STATE_NONE ) ; |
public class JSONUtils { /** * Returns the params of a function literal . */
public static String getFunctionParams ( String function ) { } } | return RegexpUtils . getMatcher ( FUNCTION_PARAMS_PATTERN , true ) . getGroupIfMatches ( function , 1 ) ; |
public class FXMLShowCaseModel { /** * { @ inheritDoc } */
@ Override protected void initModel ( ) { } } | super . initModel ( ) ; final InnerComponent < StackModel > stack = CBuilder . innerComponent ( StackModel . class , FXMLPage . class ) ; this . stackModel = findInnerComponent ( stack ) ; // stackModel = getModel ( StackModel . class , FXMLPage . class ) ; |
public class LinkedConverter { /** * Convert the display ' s index to the field value and move to field .
* @ param index The index to convert an set this field to .
* @ param bDisplayOption If true , display the change in the converters .
* @ param iMoveMove The type of move . */
public int convertIndexToField ( int index , boolean bDisplayOption , int iMoveMode ) { } } | // Must be overidden
if ( this . getNextConverter ( ) != null ) return this . getNextConverter ( ) . convertIndexToField ( index , bDisplayOption , iMoveMode ) ; else return super . convertIndexToField ( index , bDisplayOption , iMoveMode ) ; |
public class FactoryDescriptor { /** * Returns true if the given { @ link FactoryMethodDescriptor } and
* { @ link ImplementationMethodDescriptor } are duplicates .
* < p > Descriptors are duplicates if they have the same name and if they have the same passed types
* in the same order . */
private static boolean areDuplicateMethodDescriptors ( FactoryMethodDescriptor factory , ImplementationMethodDescriptor implementation ) { } } | if ( ! factory . name ( ) . equals ( implementation . name ( ) ) ) { return false ; } // Descriptors are identical if they have the same passed types in the same order .
return MoreTypes . equivalence ( ) . pairwise ( ) . equivalent ( Iterables . transform ( factory . passedParameters ( ) , Parameter . TYPE ) , Iterables . transform ( implementation . passedParameters ( ) , Parameter . TYPE ) ) ; |
public class Session { /** * Remove a granted request for a resource type .
* @ param req Resource request to remove
* @ param isRevoked Was this request revoked from the cluster manager ? */
protected void removeGrantedRequest ( ResourceRequestInfo req , boolean isRevoked ) { } } | Context c = getContext ( req . getType ( ) ) ; Utilities . removeReference ( c . grantedRequests , req ) ; // if revoked - we didn ' t fulfill this request
if ( isRevoked ) { c . fulfilledRequestCount -- ; c . revokedRequestCount ++ ; } |
public class AuditContextListener { /** * ( non - Javadoc )
* @ see
* javax . servlet . ServletContextListener # contextInitialized ( javax . servlet
* . ServletContextEvent ) */
@ Override public void contextInitialized ( ServletContextEvent contextEvent ) { } } | configSupport = new ServletContexConfigSupport ( ) ; if ( configSupport . hasHandlers ( contextEvent . getServletContext ( ) ) ) { AuditManager . startWithConfiguration ( configSupport . loadConfig ( contextEvent . getServletContext ( ) ) ) ; } else { AuditManager . getInstance ( ) ; } |
public class RewriteGenderMsgsPass { /** * Helper to split a msg for gender , by adding a ' select ' node and cloning the msg ' s contents into
* all 3 cases of the ' select ' node ( ' female ' / ' male ' / default ) .
* @ param msg The message to split .
* @ param genderExpr The expression for the gender value .
* @ param baseSelectVarName The base select var name to use , or null if it should be generated
* from the gender expression .
* @ param nodeIdGen The id generator for the current tree */
private static void splitMsgForGender ( MsgNode msg , ExprRootNode genderExpr , @ Nullable String baseSelectVarName , IdGenerator nodeIdGen ) { } } | List < StandaloneNode > origChildren = ImmutableList . copyOf ( msg . getChildren ( ) ) ; msg . clearChildren ( ) ; MsgSelectCaseNode femaleCase = new MsgSelectCaseNode ( nodeIdGen . genId ( ) , msg . getSourceLocation ( ) , "female" ) ; femaleCase . addChildren ( SoyTreeUtils . cloneListWithNewIds ( origChildren , nodeIdGen ) ) ; MsgSelectCaseNode maleCase = new MsgSelectCaseNode ( nodeIdGen . genId ( ) , msg . getSourceLocation ( ) , "male" ) ; maleCase . addChildren ( SoyTreeUtils . cloneListWithNewIds ( origChildren , nodeIdGen ) ) ; MsgSelectDefaultNode defaultCase = new MsgSelectDefaultNode ( nodeIdGen . genId ( ) , msg . getSourceLocation ( ) ) ; defaultCase . addChildren ( SoyTreeUtils . cloneListWithNewIds ( origChildren , nodeIdGen ) ) ; MsgSelectNode selectNode = new MsgSelectNode ( nodeIdGen . genId ( ) , msg . getSourceLocation ( ) , genderExpr , baseSelectVarName ) ; selectNode . addChild ( femaleCase ) ; selectNode . addChild ( maleCase ) ; selectNode . addChild ( defaultCase ) ; msg . addChild ( selectNode ) ; |
public class BeanValidator { /** * { @ inheritDoc } */
@ Override public Object saveState ( final FacesContext context ) { } } | if ( context == null ) { throw new NullPointerException ( "context" ) ; } if ( ! initialStateMarked ( ) ) { // Full state saving .
return this . validationGroups ; } else if ( DEFAULT_VALIDATION_GROUP_NAME . equals ( this . validationGroups ) ) { // default validation groups can be saved as null .
return null ; } else { // Save it fully . Remember that by MYFACES - 2528
// validationGroups needs to be stored into the state
// because this value is often susceptible to use in " combo "
return this . validationGroups ; } |
public class ScreenshotUtils { /** * Creates a new { @ link Bitmap } object with a rectangular region of pixels
* from the source bitmap .
* The source bitmap is unaffected by this operation .
* @ param sourceBitmap The source bitmap to crop .
* @ param bounds The rectangular bounds to keep when cropping .
* @ return A new bitmap of the cropped area , or { @ code null } if the source
* was { @ code null } or the crop parameters were out of bounds . */
public static Bitmap cropBitmap ( Bitmap sourceBitmap , Rect bounds ) { } } | if ( ( bounds == null ) || bounds . isEmpty ( ) ) { return null ; } return cropBitmap ( sourceBitmap , bounds . left , bounds . top , bounds . width ( ) , bounds . height ( ) ) ; |
public class EventRef { /** * Helper method that appends a type descriptor to a StringBuilder . Used
* while accumulating an event descriptor string . */
private void appendTypeDescriptor ( StringBuilder sb , Class clazz ) { } } | if ( clazz . isPrimitive ( ) ) sb . append ( _primToType . get ( clazz ) ) ; else if ( clazz . isArray ( ) ) sb . append ( clazz . getName ( ) . replace ( '.' , '/' ) ) ; else { sb . append ( "L" ) ; sb . append ( clazz . getName ( ) . replace ( '.' , '/' ) ) ; sb . append ( ";" ) ; } |
public class RmpAppirater { /** * Modify internal value .
* If you use this method , you might need to have a good understanding of this class code .
* @ param context Context
* @ param rateClickDate Date of " Rate " button clicked . */
public static void setRateClickDate ( Context context , Date rateClickDate ) { } } | final long rateClickDateMills = ( ( rateClickDate != null ) ? rateClickDate . getTime ( ) : 0 ) ; SharedPreferences prefs = getSharedPreferences ( context ) ; SharedPreferences . Editor prefsEditor = prefs . edit ( ) ; prefsEditor . putLong ( PREF_KEY_RATE_CLICK_DATE , rateClickDateMills ) ; prefsEditor . commit ( ) ; |
public class ContentValues { /** * Gets a value and converts it to a Double .
* @ param key the value to get
* @ return the Double value , or null if the value is missing or cannot be converted */
public Double getAsDouble ( String key ) { } } | Object value = mValues . get ( key ) ; try { return value != null ? ( ( Number ) value ) . doubleValue ( ) : null ; } catch ( ClassCastException e ) { if ( value instanceof CharSequence ) { try { return Double . valueOf ( value . toString ( ) ) ; } catch ( NumberFormatException e2 ) { DLog . e ( TAG , "Cannot parse Double value for " + value + " at key " + key ) ; return null ; } } else { DLog . e ( TAG , "Cannot cast value for " + key + " to a Double: " + value , e ) ; return null ; } } |
public class MetaMediaManager { /** * If our host supports scrolling around in a virtual view , it should call this method when the
* view origin changes . */
public void viewLocationDidChange ( int dx , int dy ) { } } | if ( _perfRect != null ) { Rectangle sdirty = new Rectangle ( _perfRect ) ; sdirty . translate ( - dx , - dy ) ; _remgr . addDirtyRegion ( sdirty ) ; } // let our sprites and animations know what ' s up
_animmgr . viewLocationDidChange ( dx , dy ) ; _spritemgr . viewLocationDidChange ( dx , dy ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.