signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Schema { /** * Converts this descriptor into a set of properties . */
@ Override public Map < String , String > toProperties ( ) { } } | DescriptorProperties properties = new DescriptorProperties ( ) ; List < Map < String , String > > subKeyValues = new ArrayList < > ( ) ; for ( Map . Entry < String , LinkedHashMap < String , String > > entry : tableSchema . entrySet ( ) ) { String name = entry . getKey ( ) ; LinkedHashMap < String , String > props = entry . getValue ( ) ; Map < String , String > map = new HashMap < > ( ) ; map . put ( SCHEMA_NAME , name ) ; map . putAll ( props ) ; subKeyValues . add ( map ) ; } properties . putIndexedVariableProperties ( SCHEMA , subKeyValues ) ; return properties . asMap ( ) ; |
public class DynamicList { /** * regardless of its future position in the list from other modifications */
public Node < E > append ( E value , int maxSize ) { } } | Node < E > newTail = new Node < > ( randomLevel ( ) , value ) ; lock . writeLock ( ) . lock ( ) ; try { if ( size >= maxSize ) return null ; size ++ ; Node < E > tail = head ; for ( int i = maxHeight - 1 ; i >= newTail . height ( ) ; i -- ) { Node < E > next ; while ( ( next = tail . next ( i ) ) != null ) tail = next ; tail . size [ i ] ++ ; } for ( int i = newTail . height ( ) - 1 ; i >= 0 ; i -- ) { Node < E > next ; while ( ( next = tail . next ( i ) ) != null ) tail = next ; tail . setNext ( i , newTail ) ; newTail . setPrev ( i , tail ) ; } return newTail ; } finally { lock . writeLock ( ) . unlock ( ) ; } |
public class MapTilePreCache { /** * Search for a tile bitmap into the list of providers and put it in the memory cache */
private void search ( final long pMapTileIndex ) { } } | for ( final MapTileModuleProviderBase provider : mProviders ) { try { if ( provider instanceof MapTileDownloader ) { final ITileSource tileSource = ( ( MapTileDownloader ) provider ) . getTileSource ( ) ; if ( tileSource instanceof OnlineTileSourceBase ) { if ( ! ( ( OnlineTileSourceBase ) tileSource ) . getTileSourcePolicy ( ) . acceptsPreventive ( ) ) { continue ; } } } final Drawable drawable = provider . getTileLoader ( ) . loadTile ( pMapTileIndex ) ; if ( drawable == null ) { continue ; } mCache . putTile ( pMapTileIndex , drawable ) ; return ; } catch ( CantContinueException exception ) { // just dismiss that lazily : we don ' t need to be severe here
} } |
public class SpringSecurityWebApplicationContextUtils { /** * This method mimics the behaviour in
* org . springframework . security . web . context . support . SecurityWebApplicationContextUtils # findRequiredWebApplicationContext ( sc ) ,
* which provides a default mechanism for looking for the WebApplicationContext as an attribute of the
* ServletContext that might have been declared with a non - standard name ( if it had , it would be
* detected by WebApplicationContextUtils . getWebApplicationContext ( sc ) . This is a behaviour directly
* supported in Spring Framework > = 4.2 thanks to
* org . springframework . web . context . support . WebApplicationContextUtils # findWebApplicationContext ( sc ) .
* Unfortunately , the org . springframework . security . web . context . support . SecurityWebApplicationContextUtils class is
* only available since Spring Security 4.1 , so we cannot simply call it if we want to support Spring Security 4.0.
* That ' s why this method basically mimics its behaviour . */
public static WebApplicationContext findRequiredWebApplicationContext ( final ServletContext servletContext ) { } } | WebApplicationContext wac = WebApplicationContextUtils . getWebApplicationContext ( servletContext ) ; if ( wac == null ) { final Enumeration < String > attrNames = servletContext . getAttributeNames ( ) ; while ( attrNames . hasMoreElements ( ) ) { final String attrName = attrNames . nextElement ( ) ; final Object attrValue = servletContext . getAttribute ( attrName ) ; if ( attrValue instanceof WebApplicationContext ) { if ( wac != null ) { throw new IllegalStateException ( "No unique WebApplicationContext found: more than one " + "DispatcherServlet registered with publishContext=true?" ) ; } wac = ( WebApplicationContext ) attrValue ; } } } if ( wac == null ) { throw new IllegalStateException ( "No WebApplicationContext found: no ContextLoaderListener registered?" ) ; } return wac ; |
public class CmsSeoOptionsDialog { /** * The method which is called when the user clicks the save button of the dialog . < p > */
protected void onClickSave ( ) { } } | Timer timer = new Timer ( ) { @ Override public void run ( ) { m_aliasList . clearValidationErrors ( ) ; m_aliasValidationStatus = VALIDATION_RUNNING ; m_propertyValidationStatus = VALIDATION_RUNNING ; m_aliasList . validate ( new Runnable ( ) { public void run ( ) { m_aliasValidationStatus = ! m_aliasList . hasValidationErrors ( ) ? VALIDATION_OK : VALIDATION_FAILED ; update ( true ) ; } } ) ; m_propertyEditor . getForm ( ) . validateAndSubmit ( ) ; } } ; // slight delay so that the validation doesn ' t interfere with validations triggered by the change event
timer . schedule ( 20 ) ; |
public class LongBestFitAllocator { /** * / * Check all the chunks in a treebin . */
private void checkTreeBin ( int index ) { } } | long tb = treeBins [ index ] ; boolean empty = ( treeMap & ( 1 << index ) ) == 0 ; if ( tb == - 1 && ! empty ) { throw new AssertionError ( "Tree " + index + " is marked as occupied but has an invalid head pointer" ) ; } if ( ! empty ) { checkTree ( tb ) ; } |
public class ByteArrayPersistedValueData { /** * { @ inheritDoc } */
public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { } } | orderNumber = in . readInt ( ) ; value = new byte [ in . readInt ( ) ] ; if ( value . length > 0 ) { in . readFully ( value ) ; } |
public class ModbusTCPMaster { /** * Sets the flag that specifies whether to maintain a
* constant connection or reconnect for every transaction .
* @ param b true if a new connection should be established for each
* transaction , false otherwise . */
public synchronized void setReconnecting ( boolean b ) { } } | reconnecting = b ; if ( transaction != null ) { ( ( ModbusTCPTransaction ) transaction ) . setReconnecting ( b ) ; } |
public class LightCluster { /** * Implement serviceToUrl with client side service discovery .
* @ param protocol String
* @ param serviceId String
* @ param requestKey String
* @ return String */
@ Override public String serviceToUrl ( String protocol , String serviceId , String tag , String requestKey ) { } } | URL url = loadBalance . select ( discovery ( protocol , serviceId , tag ) , requestKey ) ; if ( logger . isDebugEnabled ( ) ) logger . debug ( "final url after load balance = " + url ) ; // construct a url in string
return protocol + "://" + url . getHost ( ) + ":" + url . getPort ( ) ; |
public class ZanataInterface { /** * Run copy trans against a Source Document in zanata and then wait for it to complete
* @ param zanataId The id of the document to run copytrans for .
* @ param waitForFinish Wait for copytrans to finish running .
* @ return True if copytrans was run successfully , otherwise false . */
public boolean runCopyTrans ( final String zanataId , boolean waitForFinish ) { } } | log . debug ( "Running Zanata CopyTrans for " + zanataId ) ; try { final CopyTransResource copyTransResource = proxyFactory . getCopyTransResource ( ) ; copyTransResource . startCopyTrans ( details . getProject ( ) , details . getVersion ( ) , zanataId ) ; performZanataRESTCallWaiting ( ) ; if ( waitForFinish ) { while ( ! isCopyTransCompleteForSourceDocument ( copyTransResource , zanataId ) ) { // Sleep for 3/4 of a second
Thread . sleep ( 750 ) ; } } return true ; } catch ( Exception e ) { log . error ( "Failed to run copyTrans for " + zanataId , e ) ; } finally { performZanataRESTCallWaiting ( ) ; } return false ; |
public class KunderaCriteriaBuilder { /** * ( non - Javadoc )
* @ see
* javax . persistence . criteria . CriteriaBuilder # array ( javax . persistence . criteria
* . Selection < ? > [ ] ) */
@ Override public CompoundSelection < Object [ ] > array ( Selection < ? > ... arg0 ) { } } | return new DefaultCompoundSelection < Object [ ] > ( Arrays . asList ( arg0 ) , Object . class ) ; |
public class AdminRelatedcontentAction { private HtmlResponse asListHtml ( ) { } } | return asHtml ( path_AdminRelatedcontent_AdminRelatedcontentJsp ) . renderWith ( data -> { RenderDataUtil . register ( data , "relatedContentItems" , relatedContentService . getRelatedContentList ( relatedContentPager ) ) ; } ) . useForm ( SearchForm . class , setup -> { setup . setup ( form -> { copyBeanToBean ( relatedContentPager , form , op -> op . include ( "id" ) ) ; } ) ; } ) ; |
public class FunctionToBlockMutator { /** * Create a valid statement Node containing an assignment to name of the
* given expression . */
private static Node createAssignStatementNode ( String name , Node expression ) { } } | // Create ' name = result - expression ; ' statement .
// EXPR ( ASSIGN ( NAME , EXPRESSION ) )
Node nameNode = IR . name ( name ) ; Node assign = IR . assign ( nameNode , expression ) ; return NodeUtil . newExpr ( assign ) ; |
public class OutlineBuildingXMLReaderWrapper { /** * Returns the string excerpt . */
private String excerpt ( String str , int maxLength ) { } } | return str . length ( ) > maxLength ? excerptPattern . matcher ( str . substring ( 0 , maxLength ) ) . replaceFirst ( "…" ) : str ; |
public class AlphabeticIndex { /** * Return a list of the first character in each script . Only exposed for testing .
* @ return list of first characters in each script
* @ deprecated This API is ICU internal , only for testing .
* @ hide original deprecated declaration
* @ hide draft / provisional / internal are hidden on Android */
@ Deprecated public List < String > getFirstCharactersInScripts ( ) { } } | List < String > dest = new ArrayList < String > ( 200 ) ; // Fetch the script - first - primary contractions which are defined in the root collator .
// They all start with U + FDD1.
UnicodeSet set = new UnicodeSet ( ) ; collatorPrimaryOnly . internalAddContractions ( 0xFDD1 , set ) ; if ( set . isEmpty ( ) ) { throw new UnsupportedOperationException ( "AlphabeticIndex requires script-first-primary contractions" ) ; } for ( String boundary : set ) { int gcMask = 1 << UCharacter . getType ( boundary . codePointAt ( 1 ) ) ; if ( ( gcMask & ( GC_L_MASK | GC_CN_MASK ) ) == 0 ) { // Ignore boundaries for the special reordering groups .
// Take only those for " real scripts " ( where the sample character is a Letter ,
// and the one for unassigned implicit weights ( Cn ) .
continue ; } dest . add ( boundary ) ; } return dest ; |
public class ActionUtils { /** * Generates a client - level request by extracting the user parameters ( if */
private static AmazonWebServiceRequest generateRequest ( ActionContext context , Class < ? > type , RequestModel model , AmazonWebServiceRequest request , Object token ) throws InstantiationException , IllegalAccessException { } } | if ( request == null ) { request = ( AmazonWebServiceRequest ) type . newInstance ( ) ; } request . getRequestClientOptions ( ) . appendUserAgent ( USER_AGENT ) ; for ( PathTargetMapping mapping : model . getIdentifierMappings ( ) ) { Object value = context . getIdentifier ( mapping . getSource ( ) ) ; if ( value == null ) { throw new IllegalStateException ( "Action has a mapping for identifier " + mapping . getSource ( ) + ", but the target has no " + "identifier of that name!" ) ; } ReflectionUtils . setByPath ( request , value , mapping . getTarget ( ) ) ; } for ( PathTargetMapping mapping : model . getAttributeMappings ( ) ) { Object value = context . getAttribute ( mapping . getSource ( ) ) ; if ( value == null ) { // TODO : Is this ever valid ?
throw new IllegalStateException ( "Action has a mapping for attribute " + mapping . getSource ( ) + ", but the target has no " + "attribute of that name!" ) ; } ReflectionUtils . setByPath ( request , value , mapping . getTarget ( ) ) ; } for ( PathTargetMapping mapping : model . getConstantMappings ( ) ) { // TODO : This only works for strings ; can we do better ?
ReflectionUtils . setByPath ( request , mapping . getSource ( ) , mapping . getTarget ( ) ) ; } if ( token != null ) { List < String > tokenPath = model . getTokenPath ( ) ; if ( tokenPath == null ) { throw new IllegalArgumentException ( "Cannot pass a token with a null token path" ) ; } ReflectionUtils . setByPath ( request , token , tokenPath ) ; } return request ; |
public class Row { /** * Adds or overrides a column with a default destination
* @ param index the origin index
* @ param name a unique name of the column .
* @ param value
* @ return reference for method chaining */
public Row addColumn ( int index , String name , Object value ) { } } | Objects . requireNonNull ( name , "Name of the column cannot be null" ) ; Objects . requireNonNull ( value , "Value of " + name + " cannot be null" ) ; final Column column = new Column ( index , name , value ) ; return this . addColumn ( column ) ; |
public class ReplicationTrigger { /** * Re - sync the replica to the master . The primary keys of both entries are
* assumed to match .
* @ param listener optional
* @ param replicaEntry current replica entry , or null if none
* @ param masterEntry current master entry , or null if none
* @ param reload true to reload master entry */
void resyncEntries ( ResyncCapability . Listener < ? super S > listener , S replicaEntry , S masterEntry , boolean reload ) throws FetchException , PersistException { } } | if ( replicaEntry == null && masterEntry == null ) { return ; } Log log = LogFactory . getLog ( ReplicatedRepository . class ) ; setReplicationDisabled ( ) ; try { Transaction masterTxn = mRepository . getMasterRepository ( ) . enterTransaction ( ) ; Transaction replicaTxn = mRepository . getReplicaRepository ( ) . enterTransaction ( ) ; try { replicaTxn . setForUpdate ( true ) ; if ( reload ) { if ( masterEntry == null ) { masterEntry = mMasterStorage . prepare ( ) ; replicaEntry . copyAllProperties ( masterEntry ) ; } if ( ! masterEntry . tryLoad ( ) ) { masterEntry = null ; } } final S newReplicaEntry ; if ( replicaEntry == null ) { newReplicaEntry = mReplicaStorage . prepare ( ) ; masterEntry . copyAllProperties ( newReplicaEntry ) ; log . info ( "Inserting missing replica entry: " + newReplicaEntry ) ; } else if ( masterEntry != null ) { if ( replicaEntry . equalProperties ( masterEntry ) ) { return ; } newReplicaEntry = mReplicaStorage . prepare ( ) ; transferToReplicaEntry ( replicaEntry , masterEntry , newReplicaEntry ) ; log . info ( "Updating stale replica entry with: " + newReplicaEntry ) ; } else { newReplicaEntry = null ; log . info ( "Deleting bogus replica entry: " + replicaEntry ) ; } final Object state ; if ( listener == null ) { state = null ; } else { if ( replicaEntry == null ) { state = listener . beforeInsert ( newReplicaEntry ) ; } else if ( masterEntry != null ) { state = listener . beforeUpdate ( replicaEntry , newReplicaEntry ) ; } else { state = listener . beforeDelete ( replicaEntry ) ; } } try { // Delete old entry .
if ( replicaEntry != null ) { try { replicaEntry . tryDelete ( ) ; } catch ( PersistException e ) { log . error ( "Unable to delete replica entry: " + replicaEntry , e ) ; if ( masterEntry != null ) { // Try to update instead .
log . info ( "Updating corrupt replica entry with: " + newReplicaEntry ) ; try { newReplicaEntry . update ( ) ; // This disables the insert step , which is not needed now .
masterEntry = null ; } catch ( PersistException e2 ) { log . error ( "Unable to update replica entry: " + replicaEntry , e2 ) ; resyncFailed ( listener , replicaEntry , masterEntry , newReplicaEntry , state ) ; return ; } } } } // Insert new entry .
if ( masterEntry != null && newReplicaEntry != null ) { if ( ! newReplicaEntry . tryInsert ( ) ) { /* log . warn ( " Unable to insert : " + newReplicaEntry ) ;
Storable copy = newReplicaEntry . copy ( ) ;
if ( copy . tryLoad ( ) ) {
log . warn ( " Blocked by : " + copy ) ;
} else {
log . warn ( " Nothing loaded " ) ;
try {
newReplicaEntry . insert ( ) ;
} catch ( Exception e ) {
log . warn ( " Still cannot insert " , e ) ;
return ; */
// FIXME : can be caused by alt key constraint
// Try to correct bizarre corruption .
newReplicaEntry . tryDelete ( ) ; newReplicaEntry . tryInsert ( ) ; } } if ( listener != null ) { if ( replicaEntry == null ) { listener . afterInsert ( newReplicaEntry , state ) ; } else if ( masterEntry != null ) { listener . afterUpdate ( newReplicaEntry , state ) ; } else { listener . afterDelete ( replicaEntry , state ) ; } } replicaTxn . commit ( ) ; } catch ( Throwable e ) { resyncFailed ( listener , replicaEntry , masterEntry , newReplicaEntry , state ) ; ThrowUnchecked . fire ( e ) ; } } finally { try { masterTxn . exit ( ) ; } finally { // Do second , favoring any exception thrown from it .
replicaTxn . exit ( ) ; } } } finally { setReplicationEnabled ( ) ; } |
public class OrientedBox3f { /** * Set the center .
* @ param cx the center x .
* @ param cy the center y .
* @ param cz the center z . */
@ Override public void setCenter ( double cx , double cy , double cz ) { } } | this . center . set ( cx , cy , cz ) ; |
public class Config { /** * Check that the configuration is valid in terms of the * standard
* configuration * . This method is useful in the
* Pool implementation constructors .
* @ throws IllegalArgumentException If the size is less than one , if the
* { @ link Expiration } is ` null ` , if the { @ link Allocator } is ` null ` , or if
* the ThreadFactory is ` null ` . */
synchronized void validate ( ) throws IllegalArgumentException { } } | if ( size < 1 ) { throw new IllegalArgumentException ( "Size must be at least 1, but was " + size ) ; } if ( allocator == null ) { throw new IllegalArgumentException ( "Allocator cannot be null" ) ; } if ( expiration == null ) { throw new IllegalArgumentException ( "Expiration cannot be null" ) ; } if ( threadFactory == null ) { throw new IllegalArgumentException ( "ThreadFactory cannot be null" ) ; } |
public class HttpResponseParser { /** * Parses a header value . This is called from the generated bytecode .
* @ param buffer The buffer
* @ param state The current state
* @ param builder The exchange builder
* @ return The number of bytes remaining */
@ SuppressWarnings ( "unused" ) final void handleHeaderValue ( ByteBuffer buffer , ResponseParseState state , HttpResponseBuilder builder ) { } } | StringBuilder stringBuilder = state . stringBuilder ; if ( stringBuilder == null ) { stringBuilder = new StringBuilder ( ) ; state . parseState = 0 ; } int parseState = state . parseState ; while ( buffer . hasRemaining ( ) ) { final byte next = buffer . get ( ) ; switch ( parseState ) { case NORMAL : { if ( next == '\r' ) { parseState = BEGIN_LINE_END ; } else if ( next == '\n' ) { parseState = LINE_END ; } else if ( next == ' ' || next == '\t' ) { parseState = WHITESPACE ; } else { stringBuilder . append ( ( char ) next ) ; } break ; } case WHITESPACE : { if ( next == '\r' ) { parseState = BEGIN_LINE_END ; } else if ( next == '\n' ) { parseState = LINE_END ; } else if ( next == ' ' || next == '\t' ) { } else { if ( stringBuilder . length ( ) > 0 ) { stringBuilder . append ( ' ' ) ; } stringBuilder . append ( ( char ) next ) ; parseState = NORMAL ; } break ; } case LINE_END : case BEGIN_LINE_END : { if ( next == '\n' && parseState == BEGIN_LINE_END ) { parseState = LINE_END ; } else if ( next == '\t' || next == ' ' ) { // this is a continuation
parseState = WHITESPACE ; } else { // we have a header
HttpString nextStandardHeader = state . nextHeader ; String headerValue = stringBuilder . toString ( ) ; // TODO : we need to decode this according to RFC - 2047 if we have seen a = ? symbol
builder . getResponseHeaders ( ) . add ( nextStandardHeader , headerValue ) ; state . nextHeader = null ; state . leftOver = next ; state . stringBuilder . setLength ( 0 ) ; if ( next == '\r' ) { parseState = AWAIT_DATA_END ; } else { state . state = ResponseParseState . HEADER ; state . parseState = 0 ; return ; } } break ; } case AWAIT_DATA_END : { state . state = ResponseParseState . PARSE_COMPLETE ; return ; } } } // we only write to the state if we did not finish parsing
state . parseState = parseState ; |
public class VisualStudioNETProjectWriter { /** * Get value of DebugInformationFormat property .
* @ param compilerConfig
* compiler configuration .
* @ return value of DebugInformationFormat property . */
private String getDebugInformationFormat ( final CommandLineCompilerConfiguration compilerConfig ) { } } | String format = "0" ; final String [ ] args = compilerConfig . getPreArguments ( ) ; for ( final String arg : args ) { if ( "/Z7" . equals ( arg ) ) { format = "1" ; } if ( "/Zd" . equals ( arg ) ) { format = "2" ; } if ( "/Zi" . equals ( arg ) ) { format = "3" ; } if ( "/ZI" . equals ( arg ) ) { format = "4" ; } } return format ; |
public class OIDCClientAuthenticatorUtil { /** * Perform OpenID Connect client authenticate for the given web request .
* Return an OidcAuthenticationResult which contains the status and subject
* A routine flow can come through here twice . First there ' s no state and it goes to handleRedirectToServer
* second time , oidcclientimpl . authenticate sends us here after the browser has been to the OP and
* come back with a WAS _ OIDC _ STATE cookie , and an auth code or implicit token . */
public ProviderAuthenticationResult authenticate ( HttpServletRequest req , HttpServletResponse res , ConvergedClientConfig clientConfig ) { } } | ProviderAuthenticationResult oidcResult = null ; if ( ! isEndpointValid ( clientConfig ) ) { return new ProviderAuthenticationResult ( AuthResult . SEND_401 , HttpServletResponse . SC_UNAUTHORIZED ) ; } boolean isImplicit = false ; if ( Constants . IMPLICIT . equals ( clientConfig . getGrantType ( ) ) ) { isImplicit = true ; } String authzCode = null ; String responseState = null ; Hashtable < String , String > reqParameters = new Hashtable < String , String > ( ) ; // the code cookie was set earlier by the code that receives the very first redirect back from the provider .
String encodedReqParams = CookieHelper . getCookieValue ( req . getCookies ( ) , ClientConstants . WAS_OIDC_CODE ) ; OidcClientUtil . invalidateReferrerURLCookie ( req , res , ClientConstants . WAS_OIDC_CODE ) ; if ( encodedReqParams != null && ! encodedReqParams . isEmpty ( ) ) { boolean validCookie = validateReqParameters ( clientConfig , reqParameters , encodedReqParams ) ; if ( validCookie ) { authzCode = reqParameters . get ( ClientConstants . CODE ) ; responseState = reqParameters . get ( ClientConstants . STATE ) ; } else { // error handling
oidcResult = new ProviderAuthenticationResult ( AuthResult . SEND_401 , HttpServletResponse . SC_UNAUTHORIZED ) ; Tr . error ( tc , "OIDC_CLIENT_BAD_PARAM_COOKIE" , new Object [ ] { encodedReqParams , clientConfig . getClientId ( ) } ) ; // CWWKS1745E
return oidcResult ; } } if ( responseState != null ) { // if flow was implicit , we ' d have a grant _ type of implicit and tokens on the params .
String id_token = req . getParameter ( Constants . ID_TOKEN ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "id_token:" + id_token ) ; } if ( id_token != null ) { reqParameters . put ( Constants . ID_TOKEN , id_token ) ; } String access_token = req . getParameter ( Constants . ACCESS_TOKEN ) ; if ( access_token != null ) { reqParameters . put ( Constants . ACCESS_TOKEN , access_token ) ; } if ( req . getMethod ( ) . equals ( "POST" ) && req instanceof IExtendedRequest ) { ( ( IExtendedRequest ) req ) . setMethod ( "GET" ) ; } } if ( responseState == null ) { oidcResult = handleRedirectToServer ( req , res , clientConfig ) ; // first time through , we go here .
} else if ( isImplicit ) { oidcResult = handleImplicitFlowTokens ( req , res , responseState , clientConfig , reqParameters ) ; } else { // confirm the code and go get the tokens if it ' s good .
AuthorizationCodeHandler authzCodeHandler = new AuthorizationCodeHandler ( sslSupport ) ; oidcResult = authzCodeHandler . handleAuthorizationCode ( req , res , authzCode , responseState , clientConfig ) ; } if ( oidcResult . getStatus ( ) != AuthResult . REDIRECT_TO_PROVIDER ) { // restore post param .
// Even the status is bad , it ' s OK to restore , since it will not
// have any impact
WebAppSecurityConfig webAppSecConfig = WebAppSecurityCollaboratorImpl . getGlobalWebAppSecurityConfig ( ) ; PostParameterHelper pph = new PostParameterHelper ( webAppSecConfig ) ; pph . restore ( req , res , true ) ; OidcClientUtil . invalidateReferrerURLCookies ( req , res , OIDC_COOKIES ) ; } return oidcResult ; |
public class AbstractGenericRevisionedDao { /** * This method gets a historic revision of the { @ link net . sf . mmm . util . entity . api . GenericEntity } with the given
* < code > id < / code > .
* @ param id is the { @ link net . sf . mmm . util . entity . api . GenericEntity # getId ( ) ID } of the requested
* { @ link net . sf . mmm . util . entity . api . GenericEntity entity } .
* @ param revision is the { @ link MutablePersistenceEntity # getRevision ( ) revision }
* @ return the requested { @ link net . sf . mmm . util . entity . api . GenericEntity entity } . */
protected ENTITY loadRevision ( Object id , Number revision ) { } } | Class < ? extends ENTITY > entityClassImplementation = getEntityClass ( ) ; ENTITY entity = getAuditReader ( ) . find ( entityClassImplementation , id , revision ) ; if ( entity != null ) { entity . setRevision ( revision ) ; } return entity ; |
public class Exceptions { /** * Prepare an unchecked { @ link RuntimeException } that will bubble upstream if thrown by an operator .
* @ param t the root cause
* @ return an unchecked exception that should choose bubbling up over error callback path . */
public static RuntimeException bubble ( Throwable t ) { } } | if ( t instanceof ExecutionException ) { return bubble ( t . getCause ( ) ) ; } if ( t instanceof TimeoutException ) { return new RedisCommandTimeoutException ( t ) ; } if ( t instanceof InterruptedException ) { Thread . currentThread ( ) . interrupt ( ) ; return new RedisCommandInterruptedException ( t ) ; } if ( t instanceof RedisException ) { return ( RedisException ) t ; } return new RedisException ( t ) ; |
public class druidGParser { /** * druidG . g : 537:1 : hyperUniqueCardinality returns [ PostAggItem postAggItem ] : ( UNIQUE ( WS ) ? LPARAN ( WS ) ? a = ID ( WS ) ? RPARAN ) ; */
public final PostAggItem hyperUniqueCardinality ( ) throws RecognitionException { } } | PostAggItem postAggItem = null ; Token a = null ; postAggItem = new PostAggItem ( "hyperUniqueCardinality" ) ; try { // druidG . g : 539:2 : ( ( UNIQUE ( WS ) ? LPARAN ( WS ) ? a = ID ( WS ) ? RPARAN ) )
// druidG . g : 539:4 : ( UNIQUE ( WS ) ? LPARAN ( WS ) ? a = ID ( WS ) ? RPARAN )
{ // druidG . g : 539:4 : ( UNIQUE ( WS ) ? LPARAN ( WS ) ? a = ID ( WS ) ? RPARAN )
// druidG . g : 539:5 : UNIQUE ( WS ) ? LPARAN ( WS ) ? a = ID ( WS ) ? RPARAN
{ match ( input , UNIQUE , FOLLOW_UNIQUE_in_hyperUniqueCardinality3518 ) ; // druidG . g : 539:12 : ( WS ) ?
int alt217 = 2 ; int LA217_0 = input . LA ( 1 ) ; if ( ( LA217_0 == WS ) ) { alt217 = 1 ; } switch ( alt217 ) { case 1 : // druidG . g : 539:12 : WS
{ match ( input , WS , FOLLOW_WS_in_hyperUniqueCardinality3520 ) ; } break ; } match ( input , LPARAN , FOLLOW_LPARAN_in_hyperUniqueCardinality3523 ) ; // druidG . g : 539:23 : ( WS ) ?
int alt218 = 2 ; int LA218_0 = input . LA ( 1 ) ; if ( ( LA218_0 == WS ) ) { alt218 = 1 ; } switch ( alt218 ) { case 1 : // druidG . g : 539:23 : WS
{ match ( input , WS , FOLLOW_WS_in_hyperUniqueCardinality3525 ) ; } break ; } a = ( Token ) match ( input , ID , FOLLOW_ID_in_hyperUniqueCardinality3530 ) ; // druidG . g : 539:32 : ( WS ) ?
int alt219 = 2 ; int LA219_0 = input . LA ( 1 ) ; if ( ( LA219_0 == WS ) ) { alt219 = 1 ; } switch ( alt219 ) { case 1 : // druidG . g : 539:32 : WS
{ match ( input , WS , FOLLOW_WS_in_hyperUniqueCardinality3532 ) ; } break ; } match ( input , RPARAN , FOLLOW_RPARAN_in_hyperUniqueCardinality3535 ) ; postAggItem . fieldName = ( a != null ? a . getText ( ) : null ) ; } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving
} return postAggItem ; |
public class GetIdentityPoolRolesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetIdentityPoolRolesRequest getIdentityPoolRolesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getIdentityPoolRolesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getIdentityPoolRolesRequest . getIdentityPoolId ( ) , IDENTITYPOOLID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ServletLogContext { /** * Sets the user in the logging context
* @ param user The user */
public static void putUser ( final String user ) { } } | if ( ( user != null ) && ( 0 < user . length ( ) ) ) { MDC . put ( USER , user ) ; } |
public class ApiOvhXdsl { /** * Update and get advanced diagnostic of the line
* REST : POST / xdsl / { serviceName } / lines / { number } / diagnostic / run
* @ param actionsDone [ required ] Customer possible actions
* @ param answers [ required ] Customer answers for line diagnostic
* @ param faultType [ required ] [ default = noSync ] Line diagnostic type . Depends of problem
* @ param serviceName [ required ] The internal name of your XDSL offer
* @ param number [ required ] The number of the line */
public OvhDiagnostic serviceName_lines_number_diagnostic_run_POST ( String serviceName , String number , OvhCustomerActionsEnum [ ] actionsDone , OvhAnswers answers , OvhFaultTypeEnum faultType ) throws IOException { } } | String qPath = "/xdsl/{serviceName}/lines/{number}/diagnostic/run" ; StringBuilder sb = path ( qPath , serviceName , number ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "actionsDone" , actionsDone ) ; addBody ( o , "answers" , answers ) ; addBody ( o , "faultType" , faultType ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhDiagnostic . class ) ; |
public class Base64Slow { /** * Decode Base64 encoded data from the InputStream to the OutputStream . Characters in the Base64
* alphabet , white space and equals sign are expected to be in url encoded data . The presence of
* other characters could be a sign that the data is corrupted .
* @ param in Stream from which to read data that needs to be decoded .
* @ param out Stream to which to write decoded data .
* @ param throwExceptions Whether to throw exceptions when unexpected data is encountered .
* @ throws IOException if an IO error occurs .
* @ throws Base64DecodingException if unexpected data is encountered when throwExceptions is
* specified .
* @ since ostermillerutils 1.00.00 */
public static void decode ( InputStream in , OutputStream out , boolean throwExceptions ) throws IOException { } } | // Base64 decoding converts four bytes of input to three bytes of output
int [ ] inBuffer = new int [ 4 ] ; // read bytes un - mapping them from their ASCII encoding in the process
// we must read at least two bytes to be able to output anything
boolean done = false ; while ( ! done && ( inBuffer [ 0 ] = readBase64 ( in , throwExceptions ) ) != END_OF_INPUT && ( inBuffer [ 1 ] = readBase64 ( in , throwExceptions ) ) != END_OF_INPUT ) { // Fill the buffer
inBuffer [ 2 ] = readBase64 ( in , throwExceptions ) ; inBuffer [ 3 ] = readBase64 ( in , throwExceptions ) ; // Calculate the output
// The first two bytes of our in buffer will always be valid
// but we must check to make sure the other two bytes
// are not END _ OF _ INPUT before using them .
// The basic idea is that the four bytes will get reconstituted
// into three bytes along these lines :
// [ xxAAAAA ] [ xxBBBBB ] [ xxCCCCC ] [ xxDDDDD ]
// [ AAAAABB ] [ BBBBCCCC ] [ CCDDDDD ]
// bytes are considered to be zero when absent .
// six A and two B
out . write ( inBuffer [ 0 ] << 2 | inBuffer [ 1 ] >> 4 ) ; if ( inBuffer [ 2 ] != END_OF_INPUT ) { // four B and four C
out . write ( inBuffer [ 1 ] << 4 | inBuffer [ 2 ] >> 2 ) ; if ( inBuffer [ 3 ] != END_OF_INPUT ) { // two C and six D
out . write ( inBuffer [ 2 ] << 6 | inBuffer [ 3 ] ) ; } else { done = true ; } } else { done = true ; } } out . flush ( ) ; |
public class WebhookManager { /** * Methods for use with sns poller */
public void saveTaskUpdateForRetry ( SingularityTaskHistoryUpdate taskHistoryUpdate ) { } } | String parentPath = ZKPaths . makePath ( SNS_TASK_RETRY_ROOT , taskHistoryUpdate . getTaskId ( ) . getRequestId ( ) ) ; if ( ! isChildNodeCountSafe ( parentPath ) ) { LOG . warn ( "Too many queued webhooks for path {}, dropping" , parentPath ) ; return ; } String updatePath = ZKPaths . makePath ( SNS_TASK_RETRY_ROOT , taskHistoryUpdate . getTaskId ( ) . getRequestId ( ) , getTaskHistoryUpdateId ( taskHistoryUpdate ) ) ; save ( updatePath , taskHistoryUpdate , taskHistoryUpdateTranscoder ) ; |
public class Beta { /** * Incomplete fraction summation used in the method regularizedIncompleteBeta
* using a modified Lentz ' s method . */
private static double incompleteFractionSummation ( double alpha , double beta , double x ) { } } | final int MAXITER = 500 ; final double EPS = 3.0E-7 ; double aplusb = alpha + beta ; double aplus1 = alpha + 1.0 ; double aminus1 = alpha - 1.0 ; double c = 1.0 ; double d = 1.0 - aplusb * x / aplus1 ; if ( Math . abs ( d ) < FPMIN ) { d = FPMIN ; } d = 1.0 / d ; double h = d ; double aa = 0.0 ; double del = 0.0 ; int i = 1 , i2 = 0 ; boolean test = true ; while ( test ) { i2 = 2 * i ; aa = i * ( beta - i ) * x / ( ( aminus1 + i2 ) * ( alpha + i2 ) ) ; d = 1.0 + aa * d ; if ( Math . abs ( d ) < FPMIN ) { d = FPMIN ; } c = 1.0 + aa / c ; if ( Math . abs ( c ) < FPMIN ) { c = FPMIN ; } d = 1.0 / d ; h *= d * c ; aa = - ( alpha + i ) * ( aplusb + i ) * x / ( ( alpha + i2 ) * ( aplus1 + i2 ) ) ; d = 1.0 + aa * d ; if ( Math . abs ( d ) < FPMIN ) { d = FPMIN ; } c = 1.0 + aa / c ; if ( Math . abs ( c ) < FPMIN ) { c = FPMIN ; } d = 1.0 / d ; del = d * c ; h *= del ; i ++ ; if ( Math . abs ( del - 1.0 ) < EPS ) { test = false ; } if ( i > MAXITER ) { test = false ; logger . error ( "Beta.incompleteFractionSummation: Maximum number of iterations wes exceeded" ) ; } } return h ; |
public class WebSocketConnectionManager { /** * Send JSON representation of given data object to all connections tagged with all give tag labels
* @ param data the data object
* @ param labels the tag labels */
public void sendJsonToTagged ( Object data , String ... labels ) { } } | for ( String label : labels ) { sendJsonToTagged ( data , label ) ; } |
public class AmazonEC2Client { /** * Describes your import snapshot tasks .
* @ param describeImportSnapshotTasksRequest
* Contains the parameters for DescribeImportSnapshotTasks .
* @ return Result of the DescribeImportSnapshotTasks operation returned by the service .
* @ sample AmazonEC2 . DescribeImportSnapshotTasks
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DescribeImportSnapshotTasks "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DescribeImportSnapshotTasksResult describeImportSnapshotTasks ( DescribeImportSnapshotTasksRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeImportSnapshotTasks ( request ) ; |
public class DocumentSubscriptions { /** * Creates a data subscription in a database . The subscription will expose all documents that match the specified subscription options for a given type .
* @ param options Subscription options
* @ param clazz Document class
* @ param < T > Document class
* @ param database Target database
* @ return created subscription */
public < T > String create ( Class < T > clazz , SubscriptionCreationOptions options , String database ) { } } | options = ObjectUtils . firstNonNull ( options , new SubscriptionCreationOptions ( ) ) ; return create ( ensureCriteria ( options , clazz , false ) , database ) ; |
public class AWSLogsClient { /** * Deletes the specified destination , and eventually disables all the subscription filters that publish to it . This
* operation does not delete the physical resource encapsulated by the destination .
* @ param deleteDestinationRequest
* @ return Result of the DeleteDestination operation returned by the service .
* @ throws InvalidParameterException
* A parameter is specified incorrectly .
* @ throws ResourceNotFoundException
* The specified resource does not exist .
* @ throws OperationAbortedException
* Multiple requests to update the same resource were in conflict .
* @ throws ServiceUnavailableException
* The service cannot complete the request .
* @ sample AWSLogs . DeleteDestination
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / logs - 2014-03-28 / DeleteDestination " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DeleteDestinationResult deleteDestination ( DeleteDestinationRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeleteDestination ( request ) ; |
public class MutableURI { /** * Set the value of the < code > MutableURI < / code > .
* < p > This method can also be used to clear the < code > MutableURI < / code > . < / p >
* @ param uriString the string to be parsed into a URI
* @ param encoded Flag indicating whether the string is
* already encoded . */
public void setURI ( String uriString , boolean encoded ) throws URISyntaxException { } } | if ( uriString == null ) { setScheme ( null ) ; setUserInfo ( null ) ; setHost ( null ) ; setPort ( UNDEFINED_PORT ) ; setPath ( null ) ; setQuery ( null ) ; setFragment ( null ) ; } else { URI uri = null ; if ( encoded ) { // Get ( parse ) the components using java . net . URI
uri = new URI ( uriString ) ; } else { // Parse , then encode this string into its components using URI
uri = encodeURI ( uriString ) ; } setURI ( uri ) ; } |
public class QuotaRequestAggregator { /** * Clears this instances cache of aggregated operations .
* Is intended to be called by the driver before shutdown . */
public void clear ( ) { } } | if ( cache == null ) { return ; } synchronized ( cache ) { inFlushAll = true ; cache . invalidateAll ( ) ; out . clear ( ) ; inFlushAll = false ; } |
public class BaseDurationField { public int compareTo ( DurationField otherField ) { } } | long otherMillis = otherField . getUnitMillis ( ) ; long thisMillis = getUnitMillis ( ) ; // cannot do ( thisMillis - otherMillis ) as can overflow
if ( thisMillis == otherMillis ) { return 0 ; } if ( thisMillis < otherMillis ) { return - 1 ; } else { return 1 ; } |
public class TephraHBaseUtils { /** * Commits work done . */
@ Override public void commit ( ) throws DataCorruptedException , IOException , IllegalStateException { } } | try { this . txContext . finish ( ) ; } catch ( final TransactionFailureException tfe1 ) { try { this . txContext . abort ( ) ; } catch ( final TransactionFailureException tfe2 ) { } throw new IOException ( "Error trying to commit transaction." , tfe1 ) ; } |
public class RandomVariableAAD { /** * / * ( non - Javadoc )
* @ see net . finmath . stochastic . RandomVariable # pow ( double ) */
@ Override public RandomVariable pow ( double exponent ) { } } | return apply ( OperatorType . POW , new RandomVariable [ ] { this , constructNewAADRandomVariable ( exponent ) } ) ; |
public class DescribeVpnConnectionsResult { /** * Information about one or more VPN connections .
* @ param vpnConnections
* Information about one or more VPN connections . */
public void setVpnConnections ( java . util . Collection < VpnConnection > vpnConnections ) { } } | if ( vpnConnections == null ) { this . vpnConnections = null ; return ; } this . vpnConnections = new com . amazonaws . internal . SdkInternalList < VpnConnection > ( vpnConnections ) ; |
public class IfcPostalAddressImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < String > getAddressLines ( ) { } } | return ( EList < String > ) eGet ( Ifc2x3tc1Package . Literals . IFC_POSTAL_ADDRESS__ADDRESS_LINES , true ) ; |
public class RottenTomatoesApi { /** * Retrieves the current top DVD rentals
* @ param country Provides localized data for the selected country
* @ param limit Limits the number of opening movies returned
* @ return
* @ throws RottenTomatoesException */
public List < RTMovie > getTopRentals ( String country , int limit ) throws RottenTomatoesException { } } | properties . clear ( ) ; properties . put ( ApiBuilder . PROPERTY_URL , URL_TOP_RENTALS ) ; properties . put ( ApiBuilder . PROPERTY_LIMIT , ApiBuilder . validateLimit ( limit ) ) ; properties . put ( ApiBuilder . PROPERTY_COUNTRY , ApiBuilder . validateCountry ( country ) ) ; WrapperLists wrapper = response . getResponse ( WrapperLists . class , properties ) ; if ( wrapper != null && wrapper . getMovies ( ) != null ) { return wrapper . getMovies ( ) ; } else { return Collections . emptyList ( ) ; } |
public class CreateBotVersionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateBotVersionRequest createBotVersionRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createBotVersionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createBotVersionRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createBotVersionRequest . getChecksum ( ) , CHECKSUM_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class OffsetPredicate { /** * Releases an offset from the segment .
* @ param offset The offset to release .
* @ return Indicates whether the offset was newly released . */
public boolean release ( long offset ) { } } | Assert . argNot ( offset < 0 , "offset must be positive" ) ; if ( bits . size ( ) <= offset ) { while ( bits . size ( ) <= offset ) { bits . resize ( bits . size ( ) * 2 ) ; } } return bits . set ( offset ) ; |
public class ContentType { /** * Returns the value of the charset parameter or < code > default < / code > if there is no charset parameter .
* @ return A { @ link String } containing the charset . */
public String getCharset ( String defaultCharset ) { } } | Parameter charsetParam = param ( PARAM_CHARSET ) ; return charsetParam == null || charsetParam . value . length ( ) == 0 ? defaultCharset : charsetParam . value ; |
public class IPAddressDivisionGrouping { /** * Returns the number of consecutive trailing one or zero bits .
* If network is true , returns the number of consecutive trailing zero bits .
* Otherwise , returns the number of consecutive trailing one bits .
* @ param network
* @ return */
public int getTrailingBitCount ( boolean network ) { } } | int count = getDivisionCount ( ) ; if ( count == 0 ) { return 0 ; } long back = network ? 0 : getDivision ( 0 ) . getMaxValue ( ) ; int bitLen = 0 ; for ( int i = count - 1 ; i >= 0 ; i -- ) { IPAddressDivision seg = getDivision ( i ) ; long value = seg . getDivisionValue ( ) ; if ( value != back ) { return bitLen + seg . getTrailingBitCount ( network ) ; } bitLen += seg . getBitCount ( ) ; } return bitLen ; |
public class DefaultCommandRegistry { /** * { @ inheritDoc } */
public void registerCommand ( AbstractCommand command ) { } } | Assert . notNull ( command , "Command cannot be null." ) ; Assert . isTrue ( command . getId ( ) != null , "A command must have an identifier to be placed in a registry." ) ; Object previousCommand = this . commandMap . put ( command . getId ( ) , command ) ; if ( previousCommand != null && logger . isWarnEnabled ( ) ) { logger . info ( "The command [" + previousCommand + "] was overwritten in the registry with the command [" + command + "]" ) ; } if ( command instanceof CommandGroup ) { ( ( CommandGroup ) command ) . setCommandRegistry ( this ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Command registered '" + command . getId ( ) + "'" ) ; } fireCommandRegistered ( command ) ; |
public class SingleItemSubscriberStream { /** * { @ inheritDoc } */
public void receiveAudio ( boolean receive ) { } } | // check if engine currently receives audio , returns previous value
boolean receiveAudio = engine . receiveAudio ( receive ) ; if ( receiveAudio && ! receive ) { // send a blank audio packet to reset the player
engine . sendBlankAudio ( true ) ; } else if ( ! receiveAudio && receive ) { // do a seek
seekToCurrentPlayback ( ) ; } |
public class ConfigImpl { /** * @ Override public String [ ] getCFMLExtensions ( ) { return getAllExtensions ( ) ; }
* @ Override public String getCFCExtension ( ) { return getComponentExtension ( ) ; }
* @ Override public String [ ] getAllExtensions ( ) { return Constants . ALL _ EXTENSION ; }
* @ Override public String getComponentExtension ( ) { return Constants . COMPONENT _ EXTENSION ; }
* @ Override public String [ ] getTemplateExtensions ( ) { return Constants . TEMPLATE _ EXTENSIONS ; } */
protected void setFLDs ( FunctionLib [ ] flds , int dialect ) { } } | if ( dialect == CFMLEngine . DIALECT_CFML ) { cfmlFlds = flds ; combinedCFMLFLDs = null ; // TODO improve check ( hash )
} else { luceeFlds = flds ; combinedLuceeFLDs = null ; // TODO improve check ( hash )
} |
public class IPSImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setYpsOset ( Integer newYpsOset ) { } } | Integer oldYpsOset = ypsOset ; ypsOset = newYpsOset ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . IPS__YPS_OSET , oldYpsOset , ypsOset ) ) ; |
public class HeaderFooterRecyclerAdapter { /** * Notifies that multiple header items are inserted .
* @ param positionStart the position .
* @ param itemCount the item count . */
public final void notifyHeaderItemRangeInserted ( int positionStart , int itemCount ) { } } | int newHeaderItemCount = getHeaderItemCount ( ) ; if ( positionStart < 0 || itemCount < 0 || positionStart + itemCount > newHeaderItemCount ) { throw new IndexOutOfBoundsException ( "The given range [" + positionStart + " - " + ( positionStart + itemCount - 1 ) + "] is not within the position bounds for header items [0 - " + ( newHeaderItemCount - 1 ) + "]." ) ; } notifyItemRangeInserted ( positionStart , itemCount ) ; |
public class OnDiskMatrix { /** * { @ inheritDoc } */
public double get ( int row , int col ) { } } | int region = getMatrixRegion ( row , col ) ; int regionOffset = getRegionOffset ( row , col ) ; return matrixRegions [ region ] . get ( regionOffset ) ; |
public class JMCollections { /** * Gets last .
* @ param < T > the type parameter
* @ param < L > the type parameter
* @ param list the list
* @ return the last */
public static < T , L extends List < T > > T getLast ( List < T > list ) { } } | return isNullOrEmpty ( list ) ? null : list . get ( list . size ( ) - 1 ) ; |
public class ExpressRouteCircuitAuthorizationsInner { /** * Gets all authorizations in an express route circuit .
* @ param resourceGroupName The name of the resource group .
* @ param circuitName The name of the circuit .
* @ 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 < ExpressRouteCircuitAuthorizationInner > > listAsync ( final String resourceGroupName , final String circuitName , final ListOperationCallback < ExpressRouteCircuitAuthorizationInner > serviceCallback ) { } } | return AzureServiceFuture . fromPageResponse ( listSinglePageAsync ( resourceGroupName , circuitName ) , new Func1 < String , Observable < ServiceResponse < Page < ExpressRouteCircuitAuthorizationInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < ExpressRouteCircuitAuthorizationInner > > > call ( String nextPageLink ) { return listNextSinglePageAsync ( nextPageLink ) ; } } , serviceCallback ) ; |
public class BytesImpl { /** * adds bytes from the buffer */
@ Override public BytesImpl write ( byte [ ] buffer , int offset , int length ) { } } | while ( length > 0 ) { int sublen = Math . min ( _data . length - _head , length ) ; System . arraycopy ( buffer , offset , _data , _head , sublen ) ; if ( sublen <= 0 ) { throw new UnsupportedOperationException ( ) ; } length -= sublen ; offset += sublen ; _head += sublen ; } return this ; |
public class ValidatorProcessParameters { /** * Decide which of the command line arguments are keywords and which are
* values , and build a map to hold them . */
private Map < String , String > parseArgsIntoMap ( String [ ] args ) { } } | Map < String , String > parms = new HashMap < String , String > ( ) ; for ( int i = 0 ; i < args . length ; i ++ ) { String key = args [ i ] ; if ( ! isKeyword ( key ) ) { throw new ValidatorProcessUsageException ( "'" + key + "' is not a keyword." ) ; } if ( ! ALL_PARAMETERS . contains ( key ) ) { throw new ValidatorProcessUsageException ( "'" + key + "' is not a recognized keyword." ) ; } if ( i >= args . length - 1 ) { parms . put ( key , null ) ; } else { String value = args [ i + 1 ] ; if ( isKeyword ( value ) ) { parms . put ( key , null ) ; } else { parms . put ( key , value ) ; i ++ ; } } } return parms ; |
public class AbstractSqlBuilder { /** * 设置List类型参数 .
* @ param fieldName 参数名
* @ param value 参数值 */
public void setObject ( String fieldName , Object value ) { } } | if ( value == null ) { // list默认允许传入null
return ; } fieldList . add ( fieldName ) ; statementParameter . setObject ( value ) ; |
public class CreateVpcPeeringConnectionRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < CreateVpcPeeringConnectionRequest > getDryRunRequest ( ) { } } | Request < CreateVpcPeeringConnectionRequest > request = new CreateVpcPeeringConnectionRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class DomainXml_10 { /** * ManagamentXmlDelegate Methods */
@ Override public boolean parseSecurityRealms ( XMLExtendedStreamReader reader , ModelNode address , List < ModelNode > operationsList ) throws XMLStreamException { } } | throw unexpectedElement ( reader ) ; |
public class MSDelegatingXAResource { /** * Ends the association that this resource has with the passed transaction
* branch . Either temporarily via a TMSUSPEND or permanently via TMSUCCESS or
* TMFAIL .
* @ param xid The identifier of the global transaction to dis - associate from . This must
* match a value previously passed on a call to start .
* @ param flags Completion flag
* < BR > TMSUCCESS - Transaction completed successfully .
* < BR > TMFAIL - Transaction completed unsuccessfully .
* < BR > TMSUSPEND - Suspend a previously begun Transaction .
* @ exception XAException
* Thrown if the XID is unknown or if this XAResource is
* nor currently associated with an XID . */
public void end ( Xid xid , int flags ) throws XAException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "end" , new Object [ ] { "XID=" + xid , _manager . xaFlagsToString ( flags ) } ) ; try { _manager . end ( new PersistentTranId ( xid ) , flags ) ; // Reset our instance variables .
_currentTran = null ; _currentPtid = null ; } catch ( XidUnknownException xue ) { com . ibm . ws . ffdc . FFDCFilter . processException ( xue , "com.ibm.ws.sib.msgstore.transactions.MSDelegatingXAResource.end" , "1:375:1.51.1.7" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . event ( this , tc , "Cannot dis-associate from this Xid. It is unknown!" , xue ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "end" ) ; XAException xaException = new XAException ( XAException . XAER_NOTA ) ; xaException . initCause ( xue ) ; throw xaException ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "end" ) ; |
public class CPMeasurementUnitWrapper { /** * Returns the localized name of this cp measurement unit in the language , optionally using the default language if no localization exists for the requested language .
* @ param languageId the ID of the language
* @ param useDefault whether to use the default language if no localization exists for the requested language
* @ return the localized name of this cp measurement unit */
@ Override public String getName ( String languageId , boolean useDefault ) { } } | return _cpMeasurementUnit . getName ( languageId , useDefault ) ; |
public class BaseLevel2 { /** * gbmv computes a matrix - vector product using a general band matrix and performs one of the following matrix - vector operations :
* y : = alpha * a * x + beta * y for trans = ' N ' or ' n ' ;
* y : = alpha * a ' * x + beta * y for trans = ' T ' or ' t ' ;
* y : = alpha * conjg ( a ' ) * x + beta * y for trans = ' C ' or ' c ' .
* Here a is an m - by - n band matrix with ku superdiagonals and kl subdiagonals , x and y are vectors , alpha and beta are scalars .
* @ param order
* @ param TransA
* @ param KL
* @ param KU
* @ param alpha
* @ param A
* @ param X
* @ param beta
* @ param Y */
@ Override public void gbmv ( char order , char TransA , int KL , int KU , double alpha , INDArray A , INDArray X , double beta , INDArray Y ) { } } | if ( Nd4j . getExecutioner ( ) . getProfilingMode ( ) == OpExecutioner . ProfilingMode . ALL ) OpProfiler . getInstance ( ) . processBlasCall ( false , A , X , Y ) ; // FIXME : int cast
if ( A . data ( ) . dataType ( ) == DataType . DOUBLE ) { DefaultOpExecutioner . validateDataType ( DataType . DOUBLE , A , X , Y ) ; dgbmv ( order , TransA , ( int ) A . rows ( ) , ( int ) A . columns ( ) , KL , KU , alpha , A , ( int ) A . size ( 0 ) , X , X . stride ( - 1 ) , beta , Y , Y . stride ( - 1 ) ) ; } else { DefaultOpExecutioner . validateDataType ( DataType . FLOAT , A , X , Y ) ; sgbmv ( order , TransA , ( int ) A . rows ( ) , ( int ) A . columns ( ) , KL , KU , ( float ) alpha , A , ( int ) A . size ( 0 ) , X , X . stride ( - 1 ) , ( float ) beta , Y , Y . stride ( - 1 ) ) ; } OpExecutionerUtil . checkForAny ( Y ) ; |
public class Op { /** * Returns a string representation of the given value
* @ tparam T determines the class type of the value
* @ param x is the value
* @ return a string representation of the given value */
public static < T extends Number > String str ( T x ) { } } | return str ( x , FuzzyLite . getFormatter ( ) ) ; |
public class ObjectInputStream { /** * Registers a callback for post - deserialization validation of objects . It
* allows to perform additional consistency checks before the { @ code
* readObject ( ) } method of this class returns its result to the caller . This
* method can only be called from within the { @ code readObject ( ) } method of
* a class that implements " special " deserialization rules . It can be called
* multiple times . Validation callbacks are then done in order of decreasing
* priority , defined by { @ code priority } .
* @ param object
* an object that can validate itself by receiving a callback .
* @ param priority
* the validator ' s priority .
* @ throws InvalidObjectException
* if { @ code object } is { @ code null } .
* @ throws NotActiveException
* if this stream is currently not reading objects . In that
* case , calling this method is not allowed .
* @ see ObjectInputValidation # validateObject ( ) */
public synchronized void registerValidation ( ObjectInputValidation object , int priority ) throws NotActiveException , InvalidObjectException { } } | // Validation can only be registered when inside readObject calls
Object instanceBeingRead = this . currentObject ; if ( instanceBeingRead == null && nestedLevels == 0 ) { throw new NotActiveException ( ) ; } if ( object == null ) { throw new InvalidObjectException ( "Callback object cannot be null" ) ; } // From now on it is just insertion in a SortedCollection . Since
// the Java class libraries don ' t provide that , we have to
// implement it from scratch here .
InputValidationDesc desc = new InputValidationDesc ( ) ; desc . validator = object ; desc . priority = priority ; // No need for this , validateObject does not take a parameter
// desc . toValidate = instanceBeingRead ;
if ( validations == null ) { validations = new InputValidationDesc [ 1 ] ; validations [ 0 ] = desc ; } else { int i = 0 ; for ( ; i < validations . length ; i ++ ) { InputValidationDesc validation = validations [ i ] ; // Sorted , higher priority first .
if ( priority >= validation . priority ) { break ; // Found the index where to insert
} } InputValidationDesc [ ] oldValidations = validations ; int currentSize = oldValidations . length ; validations = new InputValidationDesc [ currentSize + 1 ] ; System . arraycopy ( oldValidations , 0 , validations , 0 , i ) ; System . arraycopy ( oldValidations , i , validations , i + 1 , currentSize - i ) ; validations [ i ] = desc ; } |
public class Merge { /** * Merge two sorted list into a bigger list in ascending order . This routine runs in O ( n ) time .
* @ param < E > the type of elements in this list .
* @ param list list with two sorted sub arrays that will be merged
* @ param start index of the starting point of the left list
* @ param middle index that splits the array in two sub lists
* @ param end index of the end point of the right list */
private static < E extends Comparable < E > > void merge ( List < E > list , int start , int middle , int end ) { } } | List < E > temp = new LinkedList < > ( ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { temp . add ( list . get ( i ) ) ; } int left = start ; int right = middle + 1 ; int current = start ; while ( left <= middle && right <= end ) { list . remove ( current ) ; if ( temp . get ( left ) . compareTo ( temp . get ( right ) ) <= 0 ) { list . add ( current , temp . get ( left ) ) ; left ++ ; } else { list . add ( current , temp . get ( right ) ) ; right ++ ; } current ++ ; } while ( left <= middle ) { list . remove ( current ) ; list . add ( current , temp . get ( left ) ) ; left ++ ; current ++ ; } |
public class FeatureLinkingCandidate { /** * / * @ Nullable */
protected LightweightTypeReference getReceiverType ( ) { } } | if ( isStatic ( ) ) return null ; LightweightTypeReference result ; if ( getImplicitReceiver ( ) != null ) result = getImplicitReceiverType ( ) ; else result = getSyntacticReceiverType ( ) ; return result ; |
public class InputExcelDataProvider { /** * { @ inheritDoc } */
@ Override public void prepare ( String scenario ) throws TechnicalException { } } | scenarioName = scenario ; try { openInputData ( ) ; initColumns ( ) ; } catch ( EmptyDataFileContentException | WrongDataFileFormatException e ) { logger . error ( Messages . getMessage ( TechnicalException . TECHNICAL_ERROR_MESSAGE_DATA_IOEXCEPTION ) , e ) ; System . exit ( - 1 ) ; } |
public class Cob2Xsd { /** * Remove any non COBOL Structure characters from the source .
* @ param cobolReader reads the raw COBOL source
* @ return a cleaned up source
* @ throws CleanerException if source cannot be read */
public String clean ( final Reader cobolReader ) throws CleanerException { } } | if ( _log . isDebugEnabled ( ) ) { _log . debug ( "1. Cleaning COBOL source code" ) ; } switch ( getConfig ( ) . getCodeFormat ( ) ) { case FIXED_FORMAT : CobolFixedFormatSourceCleaner fixedCleaner = new CobolFixedFormatSourceCleaner ( getErrorHandler ( ) , getConfig ( ) . getStartColumn ( ) , getConfig ( ) . getEndColumn ( ) ) ; return fixedCleaner . clean ( cobolReader ) ; case FREE_FORMAT : CobolFreeFormatSourceCleaner freeCleaner = new CobolFreeFormatSourceCleaner ( getErrorHandler ( ) ) ; return freeCleaner . clean ( cobolReader ) ; default : throw new CleanerException ( "Unkown COBOL source format " + getConfig ( ) . getCodeFormat ( ) ) ; } |
public class SelectionCriteria { /** * Sets the alias . By default the entire attribute path participates in the alias
* @ param alias The name of the alias to set */
public void setAlias ( String alias ) { } } | m_alias = alias ; String attributePath = ( String ) getAttribute ( ) ; boolean allPathsAliased = true ; m_userAlias = new UserAlias ( alias , attributePath , allPathsAliased ) ; |
public class TermsByQueryRequest { /** * The query source to execute . */
public TermsByQueryRequest query ( XContentBuilder builder ) { } } | this . querySource = builder == null ? null : builder . bytes ( ) ; return this ; |
public class Index { /** * Wait the publication of a task on the server .
* All server task are asynchronous and you can check with this method that the task is published .
* @ param taskID the id of the task returned by server
* @ param timeToWait time to sleep seed */
public void waitTask ( String taskID , long timeToWait ) throws AlgoliaException { } } | this . waitTask ( taskID , timeToWait , RequestOptions . empty ) ; |
public class SessionMgrComponentImpl { /** * Derives a unique identifier for the current server .
* The result of this method is used to create a cloneId .
* @ return a unique identifier for the current server ( in lower case ) */
private String getServerId ( ) { } } | UUID fullServerId = null ; WsLocationAdmin locationService = this . wsLocationAdmin ; if ( locationService != null ) { fullServerId = locationService . getServerId ( ) ; } if ( fullServerId == null ) { fullServerId = UUID . randomUUID ( ) ; // shouldn ' t get here , but be careful just in case
} return fullServerId . toString ( ) . toLowerCase ( ) ; // clone IDs need to be in lower case for consistency with tWAS |
public class CleverTapAPI { /** * PN */
private void handlePushNotificationsInResponse ( JSONArray pushNotifications ) { } } | try { for ( int i = 0 ; i < pushNotifications . length ( ) ; i ++ ) { Bundle pushBundle = new Bundle ( ) ; JSONObject pushObject = pushNotifications . getJSONObject ( i ) ; if ( pushObject . has ( "wzrk_acct_id" ) ) pushBundle . putString ( "wzrk_acct_id" , pushObject . getString ( "wzrk_acct_id" ) ) ; if ( pushObject . has ( "wzrk_acts" ) ) pushBundle . putString ( "wzrk_acts" , pushObject . getString ( "wzrk_acts" ) ) ; if ( pushObject . has ( "nm" ) ) pushBundle . putString ( "nm" , pushObject . getString ( "nm" ) ) ; if ( pushObject . has ( "nt" ) ) pushBundle . putString ( "nt" , pushObject . getString ( "nt" ) ) ; if ( pushObject . has ( "wzrk_bp" ) ) pushBundle . putString ( "wzrk_bp" , pushObject . getString ( "wzrk_bp" ) ) ; if ( pushObject . has ( "pr" ) ) pushBundle . putString ( "pr" , pushObject . getString ( "pr" ) ) ; if ( pushObject . has ( "wzrk_pivot" ) ) pushBundle . putString ( "wzrk_pivot" , pushObject . getString ( "wzrk_pivot" ) ) ; if ( pushObject . has ( "wzrk_sound" ) ) pushBundle . putString ( "wzrk_sound" , pushObject . getString ( "wzrk_sound" ) ) ; if ( pushObject . has ( "wzrk_cid" ) ) pushBundle . putString ( "wzrk_cid" , pushObject . getString ( "wzrk_cid" ) ) ; if ( pushObject . has ( "wzrk_bc" ) ) pushBundle . putString ( "wzrk_bc" , pushObject . getString ( "wzrk_bc" ) ) ; if ( pushObject . has ( "wzrk_bi" ) ) pushBundle . putString ( "wzrk_bi" , pushObject . getString ( "wzrk_bi" ) ) ; if ( pushObject . has ( "wzrk_id" ) ) pushBundle . putString ( "wzrk_id" , pushObject . getString ( "wzrk_id" ) ) ; if ( pushObject . has ( "wzrk_pn" ) ) pushBundle . putString ( "wzrk_pn" , pushObject . getString ( "wzrk_pn" ) ) ; if ( pushObject . has ( "ico" ) ) pushBundle . putString ( "ico" , pushObject . getString ( "ico" ) ) ; if ( pushObject . has ( "wzrk_ck" ) ) pushBundle . putString ( "wzrk_ck" , pushObject . getString ( "wzrk_ck" ) ) ; if ( pushObject . has ( "wzrk_dl" ) ) pushBundle . putString ( "wzrk_dl" , pushObject . getString ( "wzrk_dl" ) ) ; if ( pushObject . has ( "wzrk_pid" ) ) pushBundle . putString ( "wzrk_pid" , pushObject . getString ( "wzrk_pid" ) ) ; if ( pushObject . has ( "wzrk_ttl" ) ) pushBundle . putLong ( "wzrk_ttl" , pushObject . getLong ( "wzrk_ttl" ) ) ; Iterator iterator = pushObject . keys ( ) ; while ( iterator . hasNext ( ) ) { String key = iterator . next ( ) . toString ( ) ; pushBundle . putString ( key , pushObject . getString ( key ) ) ; } if ( ! pushBundle . isEmpty ( ) && ! dbAdapter . doesPushNotificationIdExist ( pushObject . getString ( "wzrk_pid" ) ) ) { getConfigLogger ( ) . verbose ( "Creating Push Notification locally" ) ; createNotification ( context , pushBundle ) ; } else { getConfigLogger ( ) . verbose ( getAccountId ( ) , "Push Notification already shown, ignoring local notification :" + pushObject . getString ( "wzrk_pid" ) ) ; } } } catch ( JSONException e ) { getConfigLogger ( ) . verbose ( getAccountId ( ) , "Error parsing push notification JSON" ) ; } |
public class CmsSecurityManager { /** * Copies a resource to the current project of the user . < p >
* @ param context the current request context
* @ param resource the resource to apply this operation to
* @ throws CmsException if something goes wrong
* @ throws CmsRoleViolationException if the current user does not have management access to the project
* @ see org . opencms . file . types . I _ CmsResourceType # copyResourceToProject ( CmsObject , CmsSecurityManager , CmsResource ) */
public void copyResourceToProject ( CmsRequestContext context , CmsResource resource ) throws CmsException , CmsRoleViolationException { } } | CmsDbContext dbc = m_dbContextFactory . getDbContext ( context ) ; try { checkOfflineProject ( dbc ) ; checkManagerOfProjectRole ( dbc , context . getCurrentProject ( ) ) ; m_driverManager . copyResourceToProject ( dbc , resource ) ; } catch ( Exception e ) { dbc . report ( null , Messages . get ( ) . container ( Messages . ERR_COPY_RESOURCE_TO_PROJECT_2 , context . getSitePath ( resource ) , context . getCurrentProject ( ) . getName ( ) ) , e ) ; } finally { dbc . clear ( ) ; } |
public class AbstractNumber { /** * This method is used in constructor that takes byte [ ] or ByteArrayInputStream as parameter . Decodes header part ( its 1 or
* 2 bytes usually . ) Default implemetnation decodes header of one byte - where most significant bit is O / E indicator and
* bits 7-1 are NAI . This method should be over
* @ param bis
* @ return - number of bytes reads
* @ throws IllegalArgumentException - thrown if read error is encountered . */
public int decodeHeader ( ByteArrayInputStream bis ) throws ParameterException { } } | if ( bis . available ( ) == 0 ) { throw new ParameterException ( "No more data to read." ) ; } int b = bis . read ( ) & 0xff ; this . oddFlag = ( b & 0x80 ) >> 7 ; return 1 ; |
public class ConnectionService { /** * Retrieves the connection history records matching the given criteria .
* Retrieves up to < code > limit < / code > connection history records matching
* the given terms and sorted by the given predicates . Only history records
* associated with data that the given user can read are returned .
* @ param user
* The user retrieving the connection history .
* @ param requiredContents
* The search terms that must be contained somewhere within each of the
* returned records .
* @ param sortPredicates
* A list of predicates to sort the returned records by , in order of
* priority .
* @ param limit
* The maximum number of records that should be returned .
* @ return
* The connection history of the given connection , including any
* active connections .
* @ throws GuacamoleException
* If permission to read the connection history is denied . */
public List < ConnectionRecord > retrieveHistory ( ModeledAuthenticatedUser user , Collection < ActivityRecordSearchTerm > requiredContents , List < ActivityRecordSortPredicate > sortPredicates , int limit ) throws GuacamoleException { } } | List < ConnectionRecordModel > searchResults ; // Bypass permission checks if the user is a system admin
if ( user . getUser ( ) . isAdministrator ( ) ) searchResults = connectionRecordMapper . search ( requiredContents , sortPredicates , limit ) ; // Otherwise only return explicitly readable history records
else searchResults = connectionRecordMapper . searchReadable ( user . getUser ( ) . getModel ( ) , requiredContents , sortPredicates , limit , user . getEffectiveUserGroups ( ) ) ; return getObjectInstances ( searchResults ) ; |
public class ReactionSetManipulator { /** * Gets a reaction from a ReactionSet by ID . If several exist ,
* only the first one will be returned .
* @ param reactionSet The reactionSet to search in
* @ param id The id to search for .
* @ return The Reaction or null ; */
public static IReaction getReactionByReactionID ( IReactionSet reactionSet , String id ) { } } | Iterable < IReaction > reactionIter = reactionSet . reactions ( ) ; for ( IReaction reaction : reactionIter ) { if ( reaction . getID ( ) != null && reaction . getID ( ) . equals ( id ) ) { return reaction ; } } return null ; |
public class JdonPicoContainer { /** * Returns the first current monitor found in the ComponentAdapterFactory ,
* the component adapters and the child containers , if these support a
* ComponentMonitorStrategy . { @ inheritDoc }
* @ throws PicoIntrospectionException
* if no component monitor is found in container or its children */
public ComponentMonitor currentMonitor ( ) { } } | if ( componentAdapterFactory instanceof ComponentMonitorStrategy ) { return ( ( ComponentMonitorStrategy ) componentAdapterFactory ) . currentMonitor ( ) ; } for ( Iterator i = compAdapters . iterator ( ) ; i . hasNext ( ) ; ) { Object adapter = i . next ( ) ; if ( adapter instanceof ComponentMonitorStrategy ) { return ( ( ComponentMonitorStrategy ) adapter ) . currentMonitor ( ) ; } } for ( Iterator i = children . iterator ( ) ; i . hasNext ( ) ; ) { Object child = i . next ( ) ; if ( child instanceof ComponentMonitorStrategy ) { return ( ( ComponentMonitorStrategy ) child ) . currentMonitor ( ) ; } } throw new PicoIntrospectionException ( "No component monitor found in container or its children" ) ; |
public class WebSocketContext { /** * Send JSON representation of a data object to all connections connected to
* the same URL of this context with the connection of this context excluded
* @ param data the data to be sent
* @ param excludeSelf whether it should send to the connection of this context
* @ return this context */
public WebSocketContext sendJsonToPeers ( Object data , boolean excludeSelf ) { } } | return sendToPeers ( JSON . toJSONString ( data ) , excludeSelf ) ; |
public class Window { /** * End waiting for a pending offer to be accepted . Decrements pendingOffers by 1.
* If " pendingOffersAborted " is true and pendingOffers reaches 0 then
* pendingOffersAborted will be reset to false .
* @ return True if a pending offer should be aborted . False if a pending
* offer can continue waiting if needed . */
private boolean endPendingOffer ( ) { } } | int newValue = this . pendingOffers . decrementAndGet ( ) ; // if newValue reaches zero , make sure to always reset " offeringAborted "
if ( newValue == 0 ) { // if slotWaitingCanceled was true , then reset it back to false , and
// return true to make sure the caller knows to cancel waiting
return this . pendingOffersAborted . compareAndSet ( true , false ) ; } else { // if slotWaitingCanceled is true , then return true
return this . pendingOffersAborted . get ( ) ; } |
public class SegmentGroupListMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SegmentGroupList segmentGroupList , ProtocolMarshaller protocolMarshaller ) { } } | if ( segmentGroupList == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( segmentGroupList . getGroups ( ) , GROUPS_BINDING ) ; protocolMarshaller . marshall ( segmentGroupList . getInclude ( ) , INCLUDE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class RestUtils { /** * Update response as JSON .
* @ param object object to validate and update
* @ param is entity input stream
* @ param app the app object
* @ return a status code 200 or 400 or 404 */
public static Response getUpdateResponse ( App app , ParaObject object , InputStream is ) { } } | try ( final Metrics . Context context = Metrics . time ( app == null ? null : app . getAppid ( ) , RestUtils . class , "crud" , "update" ) ) { if ( app != null && object != null ) { Map < String , Object > newContent ; Response entityRes = getEntity ( is , Map . class ) ; String [ ] errors = { } ; if ( entityRes . getStatusInfo ( ) == Response . Status . OK ) { newContent = ( Map < String , Object > ) entityRes . getEntity ( ) ; } else { return entityRes ; } object . setAppid ( isNotAnApp ( object . getType ( ) ) ? app . getAppIdentifier ( ) : app . getAppid ( ) ) ; if ( newContent . containsKey ( "_voteup" ) || newContent . containsKey ( "_votedown" ) ) { return getVotingResponse ( object , newContent ) ; } else { ParaObjectUtils . setAnnotatedFields ( object , newContent , Locked . class ) ; // app can ' t modify other apps except itself
if ( checkImplicitAppPermissions ( app , object ) ) { // This is the primary validation pass ( validates not only core POJOS but also user defined objects ) .
errors = validateObject ( app , object ) ; if ( errors . length == 0 && checkIfUserCanModifyObject ( app , object ) ) { // Secondary validation pass : object is validated again before being updated
object . update ( ) ; // check if update failed due to optimistic locking
if ( object . getVersion ( ) == - 1 ) { return getStatusResponse ( Response . Status . PRECONDITION_FAILED , "Update failed due to 'version' mismatch." ) ; } return Response . ok ( object ) . build ( ) ; } } } return getStatusResponse ( Response . Status . BAD_REQUEST , errors ) ; } return getStatusResponse ( Response . Status . NOT_FOUND ) ; } |
public class ObjectMetaData { /** * 获取需要发送的报文长度
* @ param bean
* @ param charset
* @ return
* @ throws NoSuchMethodException
* @ throws InvocationTargetException
* @ throws IllegalAccessException */
public int getFieldsSendTotalByteSize ( Object bean , Charset charset ) { } } | if ( ! hasDynamicField ( ) ) { return fieldsTotalSize ; } else { return getDynamicTotalFieldSize ( bean , charset ) ; } |
public class UnusedPrivateFieldCheck { /** * VJ : copy from MethodsHelper */
public static IdentifierTree methodName ( MethodInvocationTree mit ) { } } | IdentifierTree id ; if ( mit . methodSelect ( ) . is ( Tree . Kind . IDENTIFIER ) ) { id = ( IdentifierTree ) mit . methodSelect ( ) ; } else { id = ( ( MemberSelectExpressionTree ) mit . methodSelect ( ) ) . identifier ( ) ; } return id ; |
public class PoolsImpl { /** * Disables automatic scaling for a pool .
* @ param poolId The ID of the pool on which to disable automatic scaling .
* @ param poolDisableAutoScaleOptions Additional parameters for the operation
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws BatchErrorException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */
public void disableAutoScale ( String poolId , PoolDisableAutoScaleOptions poolDisableAutoScaleOptions ) { } } | disableAutoScaleWithServiceResponseAsync ( poolId , poolDisableAutoScaleOptions ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class PromptX509TrustManager { /** * This method is used to create a " SHA - 1 " or " MD5 " digest on an
* X509Certificate as the " fingerprint " .
* @ param algorithmName
* @ param cert
* @ return String */
private String generateDigest ( String algorithmName , X509Certificate cert ) { } } | try { MessageDigest md = MessageDigest . getInstance ( algorithmName ) ; md . update ( cert . getEncoded ( ) ) ; byte data [ ] = md . digest ( ) ; StringBuilder buffer = new StringBuilder ( 3 * data . length ) ; int i = 0 ; buffer . append ( HEX_CHARS [ ( data [ i ] >> 4 ) & 0xF ] ) ; buffer . append ( HEX_CHARS [ ( data [ i ] % 16 ) & 0xF ] ) ; for ( ++ i ; i < data . length ; i ++ ) { buffer . append ( ':' ) ; buffer . append ( HEX_CHARS [ ( data [ i ] >> 4 ) & 0xF ] ) ; buffer . append ( HEX_CHARS [ ( data [ i ] % 16 ) & 0xF ] ) ; } return buffer . toString ( ) ; } catch ( NoClassDefFoundError e ) { return getMessage ( "sslTrust.genDigestError" , algorithmName , e . getMessage ( ) ) ; } catch ( Exception e ) { return getMessage ( "sslTrust.genDigestError" , algorithmName , e . getMessage ( ) ) ; } |
public class Utils { /** * Returns true if { @ code element } is a { @ link Class } type . */
static boolean isClassType ( Element element , Elements elements , Types types ) { } } | TypeMirror classType = types . getDeclaredType ( elements . getTypeElement ( Class . class . getName ( ) ) , types . getWildcardType ( null , null ) ) ; return types . isAssignable ( element . asType ( ) , classType ) ; |
public class HBCIMsgStatus { /** * Gibt zurück , ob der Fehler " PIN ungültig " zurückgemeldet wurde
* @ return invalid pin code */
public String getInvalidPinCode ( ) { } } | for ( HBCIRetVal hbciRetVal : globStatus . getErrors ( ) ) { if ( invalidPinCodes . contains ( hbciRetVal . code ) ) { return hbciRetVal . code ; } } for ( HBCIRetVal hbciRetVal : segStatus . getErrors ( ) ) { if ( invalidPinCodes . contains ( hbciRetVal . code ) ) { return hbciRetVal . code ; } } return null ; |
public class InterfaceMetricImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < MethodMetric > getMethods ( ) { } } | return ( EList < MethodMetric > ) eGet ( StorePackage . Literals . INTERFACE_METRIC__METHODS , true ) ; |
public class View { /** * Deletes the view , persistently .
* NOTE : It should be - ( void ) deleteView ; */
@ InterfaceAudience . Public public void delete ( ) { } } | if ( viewStore != null ) viewStore . deleteView ( ) ; if ( database != null && name != null ) database . forgetView ( name ) ; close ( ) ; |
public class Latency { /** * Copy the current immutable object by setting a value for the { @ link AbstractLatency # getMin ( ) min } attribute .
* A value equality check is used to prevent copying of the same value by returning { @ code this } .
* @ param value A new value for min
* @ return A modified copy of the { @ code this } object */
public final Latency withMin ( long value ) { } } | if ( this . min == value ) return this ; long newValue = value ; return new Latency ( this . median , this . percentile98th , this . percentile99th , this . percentile999th , this . mean , newValue , this . max ) ; |
public class MessageProcessor { /** * Create this message processor ' s persistent store . */
private void createPersistentStore ( ) throws MessageStoreException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createPersistentStore" ) ; _persistentStore = new MessageProcessorStore ( new SIBUuid8 ( _engine . getUuid ( ) ) , _msgStore , _txManager ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createPersistentStore" ) ; |
public class ServerSentEventConnection { /** * Sets the keep alive time in milliseconds . If this is larger than zero a ' : ' message will be sent this often
* ( assuming there is no activity ) to keep the connection alive .
* The spec recommends a value of 15000 ( 15 seconds ) .
* @ param keepAliveTime The time in milliseconds between keep alive messaged */
public void setKeepAliveTime ( long keepAliveTime ) { } } | this . keepAliveTime = keepAliveTime ; if ( this . timerKey != null ) { this . timerKey . remove ( ) ; } this . timerKey = sink . getIoThread ( ) . executeAtInterval ( new Runnable ( ) { @ Override public void run ( ) { if ( shutdown || open == 0 ) { if ( timerKey != null ) { timerKey . remove ( ) ; } return ; } if ( pooled == null ) { pooled = exchange . getConnection ( ) . getByteBufferPool ( ) . allocate ( ) ; pooled . getBuffer ( ) . put ( ":\n" . getBytes ( StandardCharsets . UTF_8 ) ) ; pooled . getBuffer ( ) . flip ( ) ; writeListener . handleEvent ( sink ) ; } } } , keepAliveTime , TimeUnit . MILLISECONDS ) ; |
public class AbstractLayoutManager { /** * Creates a JasperReport DesignTextField from a DynamicJasper AbstractColumn .
* @ param col
* @ param height
* @ param group
* @ return JRDesignTextField */
protected JRDesignTextField generateTextFieldFromColumn ( AbstractColumn col , int height , DJGroup group ) { } } | JRDesignTextField textField = new JRDesignTextField ( ) ; JRDesignExpression exp = new JRDesignExpression ( ) ; if ( col . getPattern ( ) != null && "" . equals ( col . getPattern ( ) . trim ( ) ) ) { textField . setPattern ( col . getPattern ( ) ) ; } if ( col . getTruncateSuffix ( ) != null ) { textField . getPropertiesMap ( ) . setProperty ( JRTextElement . PROPERTY_TRUNCATE_SUFFIX , col . getTruncateSuffix ( ) ) ; } List < DJGroup > columnsGroups = getReport ( ) . getColumnsGroups ( ) ; if ( col instanceof PercentageColumn ) { PercentageColumn pcol = ( PercentageColumn ) col ; if ( group == null ) { // we are in the detail band
DJGroup innerMostGroup = columnsGroups . get ( columnsGroups . size ( ) - 1 ) ; exp . setText ( pcol . getTextForExpression ( innerMostGroup ) ) ; } else { exp . setText ( pcol . getTextForExpression ( group ) ) ; } textField . setEvaluationTime ( EvaluationTimeEnum . AUTO ) ; } else { exp . setText ( col . getTextForExpression ( ) ) ; } exp . setValueClassName ( col . getValueClassNameForExpression ( ) ) ; textField . setExpression ( exp ) ; textField . setWidth ( col . getWidth ( ) ) ; textField . setX ( col . getPosX ( ) ) ; textField . setY ( col . getPosY ( ) ) ; textField . setHeight ( height ) ; textField . setBlankWhenNull ( col . isBlankWhenNull ( ) ) ; textField . setPattern ( col . getPattern ( ) ) ; if ( col . getMarkup ( ) != null ) textField . setMarkup ( col . getMarkup ( ) . toLowerCase ( ) ) ; textField . setPrintRepeatedValues ( col . isPrintRepeatedValues ( ) ) ; textField . setPrintWhenDetailOverflows ( true ) ; Style columnStyle = col . getStyle ( ) ; if ( columnStyle == null ) columnStyle = report . getOptions ( ) . getDefaultDetailStyle ( ) ; applyStyleToElement ( columnStyle , textField ) ; JRDesignStyle jrstyle = ( JRDesignStyle ) textField . getStyle ( ) ; if ( group != null ) { int index = columnsGroups . indexOf ( group ) ; // JRDesignGroup previousGroup = ( JRDesignGroup ) getDesign ( ) . getGroupsList ( ) . get ( index ) ;
JRDesignGroup previousGroup = getJRGroupFromDJGroup ( group ) ; textField . setPrintWhenGroupChanges ( previousGroup ) ; /* Since a group column can share the style with non group columns , if oddRow coloring is enabled ,
we modified this shared style to have a colored background on odd rows . We don ' t want that for group
columns , that ' s why we create our own style from the existing one , and remove proper odd - row conditional
style if present */
JRDesignStyle groupStyle = Utils . cloneStyle ( jrstyle ) ; groupStyle . setName ( groupStyle . getFontName ( ) + "_for_group_" + index + "_" ) ; textField . setStyle ( groupStyle ) ; try { design . addStyle ( groupStyle ) ; } catch ( JRException e ) { /* e . printStackTrace ( ) ; / / Already there , nothing to do * */
} } else { JRDesignStyle alternateStyle = Utils . cloneStyle ( jrstyle ) ; alternateStyle . setName ( alternateStyle . getFontName ( ) + "_for_column_" + col . getName ( ) + "_" ) ; alternateStyle . getConditionalStyleList ( ) . clear ( ) ; textField . setStyle ( alternateStyle ) ; try { design . addStyle ( alternateStyle ) ; } catch ( JRException e ) { /* e . printStackTrace ( ) ; / / Already there , nothing to do * */
} setUpConditionStyles ( alternateStyle , col ) ; /* if ( getReport ( ) . getOptions ( ) . isPrintBackgroundOnOddRows ( ) & &
( jrstyle . getConditionalStyles ( ) = = null | | jrstyle . getConditionalStyles ( ) . length = = 0 ) ) {
/ / No group column so this is a detail text field
JRDesignExpression expression = new JRDesignExpression ( ) ;
expression . setValueClass ( Boolean . class ) ;
expression . setText ( EXPRESSION _ TRUE _ WHEN _ ODD ) ;
Style oddRowBackgroundStyle = getReport ( ) . getOptions ( ) . getOddRowBackgroundStyle ( ) ;
JRDesignConditionalStyle condStyle = new JRDesignConditionalStyle ( ) ;
condStyle . setBackcolor ( oddRowBackgroundStyle . getBackgroundColor ( ) ) ;
condStyle . setMode ( JRDesignElement . MODE _ OPAQUE ) ;
condStyle . setConditionExpression ( expression ) ;
jrstyle . addConditionalStyle ( condStyle ) ; */
} return textField ; |
public class FlashOverlayCreative { /** * Gets the apiFramework value for this FlashOverlayCreative .
* @ return apiFramework * The API framework of the asset . This attribute is optional . */
public com . google . api . ads . admanager . axis . v201811 . ApiFramework getApiFramework ( ) { } } | return apiFramework ; |
public class Angle { /** * The difference between two angles
* @ param a1
* @ param a2
* @ return New Angle representing the difference */
public static final Angle difference ( Angle a1 , Angle a2 ) { } } | return new Angle ( normalizeToHalfAngle ( angleDiff ( a1 . value , a2 . value ) ) ) ; |
public class CustomField { /** * Sets the dataType value for this CustomField .
* @ param dataType * The type of data this custom field contains . This attribute
* is read - only
* if there exists a { @ link CustomFieldValue } for this
* field . */
public void setDataType ( com . google . api . ads . admanager . axis . v201902 . CustomFieldDataType dataType ) { } } | this . dataType = dataType ; |
public class VTimezone { /** * Sets an ID for this timezone . This is a < b > required < / b > property .
* @ param timezoneId the timezone ID or null to remove
* @ return the property that was created
* @ see < a href = " http : / / tools . ietf . org / html / rfc5545 # page - 102 " > RFC 5545
* p . 102-3 < / a >
* @ see < a href = " http : / / tools . ietf . org / html / rfc2445 # page - 97 " > RFC 2445
* p . 97-8 < / a > */
public TimezoneId setTimezoneId ( String timezoneId ) { } } | TimezoneId prop = ( timezoneId == null ) ? null : new TimezoneId ( timezoneId ) ; setTimezoneId ( prop ) ; return prop ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.