signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class FTPClient { /** * Actual transfer management .
* Transfer is controlled by two new threads listening
* to the two servers . */
protected void transferRun ( BasicClientControlChannel other , MarkerListener mListener ) throws IOException , ServerException , ClientException { } } | TransferState transferState = transferBegin ( other , mListener ) ; transferWait ( transferState ) ; |
public class ConstraintMessage { /** * Gets the human friendly location of where the violation was raised . */
public static String getMessage ( ConstraintViolation < ? > v , Invocable invocable ) { } } | final Pair < Path , ? extends ConstraintDescriptor < ? > > of = Pair . of ( v . getPropertyPath ( ) , v . getConstraintDescriptor ( ) ) ; final String cachePrefix = PREFIX_CACHE . getIfPresent ( of ) ; if ( cachePrefix == null ) { final String prefix = calculatePrefix ( v , invocable ) ; PREFIX_CACHE . put ( of , prefix ) ; return prefix + v . getMessage ( ) ; } return cachePrefix + v . getMessage ( ) ; |
public class HBaseReader { /** * Reset . */
public void reset ( ) { } } | scanner = null ; fetchSize = null ; resultsIter = null ; tableName = null ; counter = 0 ; |
public class ZonedDateTime { /** * Returns a copy of this date - time with a different time - zone ,
* retaining the instant .
* This method changes the time - zone and retains the instant .
* This normally results in a change to the local date - time .
* This method is based on retaining the same instant , thus gaps and overlaps
* in the local time - line have no effect on the result .
* To change the offset while keeping the local time ,
* use { @ link # withZoneSameLocal ( ZoneId ) } .
* @ param zone the time - zone to change to , not null
* @ return a { @ code ZonedDateTime } based on this date - time with the requested zone , not null
* @ throws DateTimeException if the result exceeds the supported date range */
@ Override public ZonedDateTime withZoneSameInstant ( ZoneId zone ) { } } | Jdk8Methods . requireNonNull ( zone , "zone" ) ; return this . zone . equals ( zone ) ? this : create ( dateTime . toEpochSecond ( offset ) , dateTime . getNano ( ) , zone ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link IdReferenceType } { @ code > } } */
@ XmlElementDecl ( namespace = "urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" , name = "PolicySetIdReference" ) public JAXBElement < IdReferenceType > createPolicySetIdReference ( IdReferenceType value ) { } } | return new JAXBElement < IdReferenceType > ( _PolicySetIdReference_QNAME , IdReferenceType . class , null , value ) ; |
public class PrattParser { /** * Parse upcoming tokens from the stream into an expression , and keep going
* until token binding powers drop down to or below the supplied right binding power . If this
* feels backwards , remember that weak operands end up higher in the parse tree , consider for instance
* < code > 1*2 + 3 < / code > which becomes
* < pre >
* 1*2 3
* < / pre > .
* To parse this expression , we start by swallowing " 1*2 " , stopping by " + " . This is achieved by calling
* this method with the lower binding power of " + " as an argument . */
@ NotNull public N expr ( @ Nullable N left , final int rightBindingPower ) { } } | // An expression always starts with a symbol which can qualify as a nud value
// i . e
// " + " as in " positive " , used in for instance " + 3 + 5 " , parses to + ( rest of expression )
// " - " as in " negative " , used in for instance " - 3 + 5 " , parses to - ( rest of expression )
// " ( " as in " start sub - expression " , used in for instance " ( 3 ) " , parses rest of expression with 0 strength ,
// which keeps going until next 0 - valued token is encountered ( " ) " or end )
// any digit , used in for instance " 3 " , parses to 3.
Lexeme < N > firstLexeme = pop ( ) ; final N first = nud ( firstLexeme , left ) ; // When we have the nud parsing settled , we cannot be sure that the parsing is done . Digit parsing
// returns almost immediately for instance . If the nud parse swallowed all the expression , only the end
// token will remain . But since the end token has 0 binding power , we will never continue in this case .
// If there is more to parse , however , we should keep parsing as long as we encounter stronger tokens
// than the caller is currently parsing . When a weaker token is encountered , the tokens so far should namely
// be wrapped up into a part - expression . This part - expression will then usually form the LHS or RHS of
// the weaker operand . Remember that weak operands end up higher in the tree , consider for instance
// 1*2 + 3 which becomes
// 1*2 3
// The multiplication token will here call parse on the rest of the expression ( " 2 + 3 " ) . This parse
// should abort as soon as the weaker addition token is encountered , so that it returns " 2 " as the RHS
// of the multiplication .
// The addition operators led - parser is then called by the top - level expression parser ,
// passing ( 1*2 ) into it as the expression parsed so far . It will then proceed to swallow the 3,
// completing the expression .
return recursiveParseLoop ( first , rightBindingPower ) ; |
public class HttpBuilder { /** * Executes a POST request on the configured URI , with additional configuration provided by the configuration function . The result will be cast to
* the specified ` type ` .
* This method is generally used for Java - specific configuration .
* [ source , groovy ]
* HttpBuilder http = HttpBuilder . configure ( config - > {
* config . getRequest ( ) . setUri ( " http : / / localhost : 10101 " ) ;
* String result = http . post ( String . class , config - > {
* config . getRequest ( ) . getUri ( ) . setPath ( " / foo " ) ;
* The ` configuration ` { @ link Consumer } allows additional configuration for this request based on the { @ link HttpConfig } interface .
* @ param type the type of the response content
* @ param configuration the additional configuration function ( delegated to { @ link HttpConfig } )
* @ return the resulting content cast to the specified type */
public < T > T post ( final Class < T > type , final Consumer < HttpConfig > configuration ) { } } | return type . cast ( interceptors . get ( HttpVerb . POST ) . apply ( configureRequest ( type , HttpVerb . POST , configuration ) , this :: doPost ) ) ; |
public class IslandEvolution { /** * Helper method used by the constructor to create the individual islands if they haven ' t
* been provided already ( via the other constructor ) . */
private static < T > List < EvolutionEngine < T > > createIslands ( int islandCount , CandidateFactory < T > candidateFactory , EvolutionaryOperator < T > evolutionScheme , FitnessEvaluator < ? super T > fitnessEvaluator , SelectionStrategy < ? super T > selectionStrategy , Random rng ) { } } | List < EvolutionEngine < T > > islands = new ArrayList < EvolutionEngine < T > > ( islandCount ) ; for ( int i = 0 ; i < islandCount ; i ++ ) { GenerationalEvolutionEngine < T > island = new GenerationalEvolutionEngine < T > ( candidateFactory , evolutionScheme , fitnessEvaluator , selectionStrategy , rng ) ; island . setSingleThreaded ( true ) ; // Don ' t need fine - grained concurrency when each island is on a separate thread .
islands . add ( island ) ; } return islands ; |
public class FSDirectory { /** * Add a node child to the inodes at index pos .
* Its ancestors are stored at [ startPos , endPos - 1 ] .
* QuotaExceededException is thrown if it violates quota limit */
private < T extends INode > T addChild ( INode [ ] pathComponents , int startPos , int endPos , T child , long childDiskspace , boolean inheritPermission , boolean checkQuota ) throws QuotaExceededException { } } | INode . DirCounts counts = new INode . DirCounts ( ) ; child . spaceConsumedInTree ( counts ) ; if ( childDiskspace < 0 ) { childDiskspace = counts . getDsCount ( ) ; } updateCount ( pathComponents , startPos , endPos , counts . getNsCount ( ) , childDiskspace , checkQuota ) ; T addedNode = null ; try { addedNode = ( ( INodeDirectory ) pathComponents [ endPos - 1 ] ) . addChild ( child , inheritPermission ) ; } finally { if ( addedNode == null ) { updateCount ( pathComponents , startPos , endPos , - counts . getNsCount ( ) , - childDiskspace , true ) ; } else { inodeMap . put ( addedNode ) ; } } return addedNode ; |
public class OpenAPIConnection { /** * Sets value for specific header
* @ param headerName - header to be set
* @ param headerValue - value of the header
* @ return */
public OpenAPIConnection header ( String headerName , String headerValue ) { } } | this . headers . put ( headerName , headerValue ) ; return this ; |
public class AbstractCommandLineRunner { /** * Outputs the variable and property name maps for the specified compiler if the proper FLAGS are
* set . */
@ GwtIncompatible ( "Unnecessary" ) private void outputNameMaps ( ) throws IOException { } } | String propertyMapOutputPath = null ; String variableMapOutputPath = null ; // Check the create _ name _ map _ files FLAG .
if ( config . createNameMapFiles ) { String basePath = getMapPath ( config . jsOutputFile ) ; propertyMapOutputPath = basePath + "_props_map.out" ; variableMapOutputPath = basePath + "_vars_map.out" ; } // Check the individual FLAGS .
if ( ! config . variableMapOutputFile . isEmpty ( ) ) { if ( variableMapOutputPath != null ) { throw new FlagUsageException ( "The flags variable_map_output_file and " + "create_name_map_files cannot both be used simultaneously." ) ; } variableMapOutputPath = config . variableMapOutputFile ; } if ( ! config . propertyMapOutputFile . isEmpty ( ) ) { if ( propertyMapOutputPath != null ) { throw new FlagUsageException ( "The flags property_map_output_file and " + "create_name_map_files cannot both be used simultaneously." ) ; } propertyMapOutputPath = config . propertyMapOutputFile ; } // Output the maps .
if ( variableMapOutputPath != null && compiler . getVariableMap ( ) != null ) { compiler . getVariableMap ( ) . save ( variableMapOutputPath ) ; } if ( propertyMapOutputPath != null && compiler . getPropertyMap ( ) != null ) { compiler . getPropertyMap ( ) . save ( propertyMapOutputPath ) ; } |
public class ListCoreDefinitionsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListCoreDefinitionsRequest listCoreDefinitionsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listCoreDefinitionsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listCoreDefinitionsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( listCoreDefinitionsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SccpFlowControl { /** * if true then message can be accepted */
public boolean checkInputMessageNumbering ( SccpConnectionImpl conn , SequenceNumber sendSequenceNumber , SequenceNumber receiveSequenceNumber ) throws Exception { } } | if ( sendSequenceNumber != null ) { if ( expectingFirstMessageInputAfterInit && ! sendSequenceNumber . equals ( new SequenceNumberImpl ( 0 ) ) ) { // local procedure error
conn . reset ( new ResetCauseImpl ( ResetCauseValue . MESSAGE_OUT_OF_ORDER_INCORRECT_PS ) ) ; return false ; } else if ( sendSequenceNumber . equals ( sendSequenceNumberExpectedAtInput ) && inputWindow . contains ( sendSequenceNumber ) ) { sendSequenceNumberExpectedAtInput = sendSequenceNumberExpectedAtInput . nextNumber ( ) ; } else { if ( ! inputWindow . contains ( sendSequenceNumber ) ) { conn . reset ( new ResetCauseImpl ( ResetCauseValue . REMOTE_PROCEDURE_ERROR_MESSAGE_OUT_OF_WINDOW ) ) ; } else if ( ! sendSequenceNumber . equals ( sendSequenceNumberExpectedAtInput ) ) { // local procedure error
conn . resetSection ( new ResetCauseImpl ( ResetCauseValue . MESSAGE_OUT_OF_ORDER_INCORRECT_PS ) ) ; } return false ; } } if ( rangeContains ( lastReceiveSequenceNumberReceived , this . sendSequenceNumber . nextNumber ( ) , receiveSequenceNumber ) ) { outputWindow . setLowerEdge ( receiveSequenceNumber ) ; } else { conn . resetSection ( new ResetCauseImpl ( ResetCauseValue . MESSAGE_OUT_OF_ORDER_INCORRECT_PS ) ) ; return false ; } lastReceiveSequenceNumberReceived = receiveSequenceNumber ; expectingFirstMessageInputAfterInit = false ; return true ; |
public class ListResolversResult { /** * The < code > Resolver < / code > objects .
* @ param resolvers
* The < code > Resolver < / code > objects . */
public void setResolvers ( java . util . Collection < Resolver > resolvers ) { } } | if ( resolvers == null ) { this . resolvers = null ; return ; } this . resolvers = new java . util . ArrayList < Resolver > ( resolvers ) ; |
public class UpdatePlacementRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdatePlacementRequest updatePlacementRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updatePlacementRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updatePlacementRequest . getPlacementName ( ) , PLACEMENTNAME_BINDING ) ; protocolMarshaller . marshall ( updatePlacementRequest . getProjectName ( ) , PROJECTNAME_BINDING ) ; protocolMarshaller . marshall ( updatePlacementRequest . getAttributes ( ) , ATTRIBUTES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class IndustrialClockSkin { /** * * * * * * Initialization * * * * * */
@ Override protected void initGraphics ( ) { } } | // Set initial size
if ( Double . compare ( clock . getPrefWidth ( ) , 0.0 ) <= 0 || Double . compare ( clock . getPrefHeight ( ) , 0.0 ) <= 0 || Double . compare ( clock . getWidth ( ) , 0.0 ) <= 0 || Double . compare ( clock . getHeight ( ) , 0.0 ) <= 0 ) { if ( clock . getPrefWidth ( ) > 0 && clock . getPrefHeight ( ) > 0 ) { clock . setPrefSize ( clock . getPrefWidth ( ) , clock . getPrefHeight ( ) ) ; } else { clock . setPrefSize ( PREFERRED_WIDTH , PREFERRED_HEIGHT ) ; } } sectionsAndAreasCanvas = new Canvas ( PREFERRED_WIDTH , PREFERRED_HEIGHT ) ; sectionsAndAreasCtx = sectionsAndAreasCanvas . getGraphicsContext2D ( ) ; tickCanvas = new Canvas ( PREFERRED_WIDTH , PREFERRED_HEIGHT ) ; tickCtx = tickCanvas . getGraphicsContext2D ( ) ; alarmPane = new Pane ( ) ; hour = new Path ( ) ; hour . setFillRule ( FillRule . EVEN_ODD ) ; hour . setStroke ( null ) ; hour . getTransforms ( ) . setAll ( hourRotate ) ; minute = new Path ( ) ; minute . setFillRule ( FillRule . EVEN_ODD ) ; minute . setStroke ( null ) ; minute . getTransforms ( ) . setAll ( minuteRotate ) ; second = new Path ( ) ; second . setFillRule ( FillRule . EVEN_ODD ) ; second . setStroke ( null ) ; second . getTransforms ( ) . setAll ( secondRotate ) ; second . setVisible ( clock . isSecondsVisible ( ) ) ; second . setManaged ( clock . isSecondsVisible ( ) ) ; centerDot = new Circle ( ) ; centerDot . setFill ( Color . WHITE ) ; dropShadow = new DropShadow ( ) ; dropShadow . setColor ( Color . rgb ( 0 , 0 , 0 , 0.25 ) ) ; dropShadow . setBlurType ( BlurType . TWO_PASS_BOX ) ; dropShadow . setRadius ( 0.015 * PREFERRED_WIDTH ) ; dropShadow . setOffsetY ( 0.015 * PREFERRED_WIDTH ) ; shadowGroupHour = new Group ( hour ) ; shadowGroupMinute = new Group ( minute ) ; shadowGroupSecond = new Group ( second ) ; shadowGroupHour . setEffect ( clock . getShadowsEnabled ( ) ? dropShadow : null ) ; shadowGroupMinute . setEffect ( clock . getShadowsEnabled ( ) ? dropShadow : null ) ; shadowGroupSecond . setEffect ( clock . getShadowsEnabled ( ) ? dropShadow : null ) ; title = new Text ( "" ) ; title . setVisible ( clock . isTitleVisible ( ) ) ; title . setManaged ( clock . isTitleVisible ( ) ) ; dateText = new Text ( "" ) ; dateText . setVisible ( clock . isDateVisible ( ) ) ; dateText . setManaged ( clock . isDateVisible ( ) ) ; dateNumber = new Text ( "" ) ; dateNumber . setVisible ( clock . isDateVisible ( ) ) ; dateNumber . setManaged ( clock . isDateVisible ( ) ) ; text = new Text ( "" ) ; text . setVisible ( clock . isTextVisible ( ) ) ; text . setManaged ( clock . isTextVisible ( ) ) ; pane = new Pane ( sectionsAndAreasCanvas , tickCanvas , alarmPane , title , dateText , dateNumber , text , shadowGroupMinute , shadowGroupHour , shadowGroupSecond , centerDot ) ; pane . setBorder ( new Border ( new BorderStroke ( clock . getBorderPaint ( ) , BorderStrokeStyle . SOLID , new CornerRadii ( 1024 ) , new BorderWidths ( clock . getBorderWidth ( ) ) ) ) ) ; pane . setBackground ( new Background ( new BackgroundFill ( clock . getBackgroundPaint ( ) , new CornerRadii ( 1024 ) , Insets . EMPTY ) ) ) ; getChildren ( ) . setAll ( pane ) ; |
public class ServiceInvoker { /** * { @ inheritDoc } */
public boolean invoke ( IServiceCall call , IScope scope ) { } } | String serviceName = call . getServiceName ( ) ; log . trace ( "Service name {}" , serviceName ) ; Object service = getServiceHandler ( scope , serviceName ) ; if ( service == null ) { // Exception must be thrown if service was not found
call . setException ( new ServiceNotFoundException ( serviceName ) ) ; // Set call status
call . setStatus ( Call . STATUS_SERVICE_NOT_FOUND ) ; log . warn ( "Service not found: {}" , serviceName ) ; return false ; } else { log . trace ( "Service found: {}" , serviceName ) ; } // Invoke if everything is ok
return invoke ( call , service ) ; |
public class PlaceholderUnificationVisitor { /** * Returns all the ways this placeholder invocation might unify with the specified list of trees . */
public Choice < State < List < JCExpression > > > unifyExpressions ( @ Nullable Iterable < ? extends ExpressionTree > nodes , State < ? > state ) { } } | return unify ( nodes , state ) . transform ( s -> s . withResult ( List . convert ( JCExpression . class , s . result ( ) ) ) ) ; |
public class LasSourcesTable { /** * Checks if the db is a las database readable by HortonMachine .
* @ param db the database to check .
* @ return < code > true < / code > if the db can be read .
* @ throws Exception */
public static boolean isLasDatabase ( ASpatialDb db ) throws Exception { } } | if ( ! db . hasTable ( TABLENAME ) || ! db . hasTable ( LasCellsTable . TABLENAME ) ) { return false ; } return true ; |
public class HtmlTool { /** * Sets attribute to the given value on elements in HTML .
* @ param content
* HTML content to set attributes on
* @ param selector
* CSS selector for elements to modify
* @ param attributeKey
* Attribute name
* @ param value
* Attribute value
* @ return HTML content with modified elements . If no elements are found , the original content
* is returned .
* @ since 1.0 */
public String setAttr ( String content , String selector , String attributeKey , String value ) { } } | Element body = parseContent ( content ) ; List < Element > elements = body . select ( selector ) ; if ( elements . size ( ) > 0 ) { for ( Element element : elements ) { element . attr ( attributeKey , value ) ; } return body . html ( ) ; } else { // nothing to update
return content ; } |
public class GlstringBuilder { /** * Build and return a new GL String configured from the properties of this GL String builder .
* @ return a new GL String configured from the properties of this GL String builder
* @ throws IllegalStateException if { @ link # locus ( String ) } or { @ link # allele ( String ) } has not been called at least once
* @ throws IllegalStateException if the last call was an operator ( { @ link # allelicAmbiguity ( ) } , { @ link # inPhase ( ) } ,
* { @ link # plus ( ) } , { @ link # genotypicAmbiguity ( ) } , and { @ link # locus ( String ) } ) */
public String build ( ) { } } | if ( locus == null && tree . isEmpty ( ) ) { throw new IllegalStateException ( "must call locus(String) or allele(String) at least once" ) ; } if ( tree . isEmpty ( ) ) { return locus ; } String glstring = tree . toString ( ) ; char last = glstring . charAt ( glstring . length ( ) - 1 ) ; if ( operators . matches ( last ) ) { throw new IllegalStateException ( "last element of a glstring must not be an operator, was " + last ) ; } return glstring ; |
public class CMRFidelityImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . CMR_FIDELITY__STP_CMR_EX : setStpCMREx ( ( Integer ) newValue ) ; return ; case AfplibPackage . CMR_FIDELITY__REP_CMR_EX : setRepCMREx ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class CommerceOrderPaymentLocalServiceUtil { /** * Deletes the commerce order payment from the database . Also notifies the appropriate model listeners .
* @ param commerceOrderPayment the commerce order payment
* @ return the commerce order payment that was removed */
public static com . liferay . commerce . model . CommerceOrderPayment deleteCommerceOrderPayment ( com . liferay . commerce . model . CommerceOrderPayment commerceOrderPayment ) { } } | return getService ( ) . deleteCommerceOrderPayment ( commerceOrderPayment ) ; |
public class CRC32 { /** * Calculates a CRC value for a byte to be used by CRC calculation
* functions . */
private static void initialize ( ) { } } | for ( int i = 0 ; i < 256 ; ++ i ) { long crc = i ; for ( int j = 8 ; j > 0 ; j -- ) { if ( ( crc & 1 ) == 1 ) crc = ( crc >>> 1 ) ^ polynomial ; else crc >>>= 1 ; } values [ i ] = crc ; } init_done = true ; |
public class AbstractCommand { /** * Execute < code > getFallback ( ) < / code > within protection of a semaphore that limits number of concurrent executions .
* Fallback implementations shouldn ' t perform anything that can be blocking , but we protect against it anyways in case someone doesn ' t abide by the contract .
* If something in the < code > getFallback ( ) < / code > implementation is latent ( such as a network call ) then the semaphore will cause us to start rejecting requests rather than allowing potentially
* all threads to pile up and block .
* @ return K
* @ throws UnsupportedOperationException
* if getFallback ( ) not implemented
* @ throws HystrixRuntimeException
* if getFallback ( ) fails ( throws an Exception ) or is rejected by the semaphore */
private Observable < R > getFallbackOrThrowException ( final AbstractCommand < R > _cmd , final HystrixEventType eventType , final FailureType failureType , final String message , final Exception originalException ) { } } | final HystrixRequestContext requestContext = HystrixRequestContext . getContextForCurrentThread ( ) ; long latency = System . currentTimeMillis ( ) - executionResult . getStartTimestamp ( ) ; // record the executionResult
// do this before executing fallback so it can be queried from within getFallback ( see See https : / / github . com / Netflix / Hystrix / pull / 144)
executionResult = executionResult . addEvent ( ( int ) latency , eventType ) ; if ( isUnrecoverable ( originalException ) ) { logger . error ( "Unrecoverable Error for HystrixCommand so will throw HystrixRuntimeException and not apply fallback. " , originalException ) ; /* executionHook for all errors */
Exception e = wrapWithOnErrorHook ( failureType , originalException ) ; return Observable . error ( new HystrixRuntimeException ( failureType , this . getClass ( ) , getLogMessagePrefix ( ) + " " + message + " and encountered unrecoverable error." , e , null ) ) ; } else { if ( isRecoverableError ( originalException ) ) { logger . warn ( "Recovered from java.lang.Error by serving Hystrix fallback" , originalException ) ; } if ( properties . fallbackEnabled ( ) . get ( ) ) { /* fallback behavior is permitted so attempt */
final Action1 < Notification < ? super R > > setRequestContext = new Action1 < Notification < ? super R > > ( ) { @ Override public void call ( Notification < ? super R > rNotification ) { setRequestContextIfNeeded ( requestContext ) ; } } ; final Action1 < R > markFallbackEmit = new Action1 < R > ( ) { @ Override public void call ( R r ) { if ( shouldOutputOnNextEvents ( ) ) { executionResult = executionResult . addEvent ( HystrixEventType . FALLBACK_EMIT ) ; eventNotifier . markEvent ( HystrixEventType . FALLBACK_EMIT , commandKey ) ; } } } ; final Action0 markFallbackCompleted = new Action0 ( ) { @ Override public void call ( ) { long latency = System . currentTimeMillis ( ) - executionResult . getStartTimestamp ( ) ; eventNotifier . markEvent ( HystrixEventType . FALLBACK_SUCCESS , commandKey ) ; executionResult = executionResult . addEvent ( ( int ) latency , HystrixEventType . FALLBACK_SUCCESS ) ; } } ; final Func1 < Throwable , Observable < R > > handleFallbackError = new Func1 < Throwable , Observable < R > > ( ) { @ Override public Observable < R > call ( Throwable t ) { /* executionHook for all errors */
Exception e = wrapWithOnErrorHook ( failureType , originalException ) ; Exception fe = getExceptionFromThrowable ( t ) ; long latency = System . currentTimeMillis ( ) - executionResult . getStartTimestamp ( ) ; Exception toEmit ; if ( fe instanceof UnsupportedOperationException ) { logger . debug ( "No fallback for HystrixCommand. " , fe ) ; // debug only since we ' re throwing the exception and someone higher will do something with it
eventNotifier . markEvent ( HystrixEventType . FALLBACK_MISSING , commandKey ) ; executionResult = executionResult . addEvent ( ( int ) latency , HystrixEventType . FALLBACK_MISSING ) ; toEmit = new HystrixRuntimeException ( failureType , _cmd . getClass ( ) , getLogMessagePrefix ( ) + " " + message + " and no fallback available." , e , fe ) ; } else { logger . debug ( "HystrixCommand execution " + failureType . name ( ) + " and fallback failed." , fe ) ; eventNotifier . markEvent ( HystrixEventType . FALLBACK_FAILURE , commandKey ) ; executionResult = executionResult . addEvent ( ( int ) latency , HystrixEventType . FALLBACK_FAILURE ) ; toEmit = new HystrixRuntimeException ( failureType , _cmd . getClass ( ) , getLogMessagePrefix ( ) + " " + message + " and fallback failed." , e , fe ) ; } // NOTE : we ' re suppressing fallback exception here
if ( shouldNotBeWrapped ( originalException ) ) { return Observable . error ( e ) ; } return Observable . error ( toEmit ) ; } } ; final TryableSemaphore fallbackSemaphore = getFallbackSemaphore ( ) ; final AtomicBoolean semaphoreHasBeenReleased = new AtomicBoolean ( false ) ; final Action0 singleSemaphoreRelease = new Action0 ( ) { @ Override public void call ( ) { if ( semaphoreHasBeenReleased . compareAndSet ( false , true ) ) { fallbackSemaphore . release ( ) ; } } } ; Observable < R > fallbackExecutionChain ; // acquire a permit
if ( fallbackSemaphore . tryAcquire ( ) ) { try { if ( isFallbackUserDefined ( ) ) { executionHook . onFallbackStart ( this ) ; fallbackExecutionChain = getFallbackObservable ( ) ; } else { // same logic as above without the hook invocation
fallbackExecutionChain = getFallbackObservable ( ) ; } } catch ( Throwable ex ) { // If hook or user - fallback throws , then use that as the result of the fallback lookup
fallbackExecutionChain = Observable . error ( ex ) ; } return fallbackExecutionChain . doOnEach ( setRequestContext ) . lift ( new FallbackHookApplication ( _cmd ) ) . lift ( new DeprecatedOnFallbackHookApplication ( _cmd ) ) . doOnNext ( markFallbackEmit ) . doOnCompleted ( markFallbackCompleted ) . onErrorResumeNext ( handleFallbackError ) . doOnTerminate ( singleSemaphoreRelease ) . doOnUnsubscribe ( singleSemaphoreRelease ) ; } else { return handleFallbackRejectionByEmittingError ( ) ; } } else { return handleFallbackDisabledByEmittingError ( originalException , failureType , message ) ; } } |
public class KeyVaultClientBaseImpl { /** * Updates the attributes associated with a specified secret in a given key vault .
* The UPDATE operation changes specified attributes of an existing stored secret . Attributes that are not specified in the request are left unchanged . The value of a secret itself cannot be changed . This operation requires the secrets / set permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param secretName The name of the secret .
* @ param secretVersion The version of the secret .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws KeyVaultErrorException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the SecretBundle object if successful . */
public SecretBundle updateSecret ( String vaultBaseUrl , String secretName , String secretVersion ) { } } | return updateSecretWithServiceResponseAsync ( vaultBaseUrl , secretName , secretVersion ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class RemoteConsumerReceiver { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . runtime . SIMPRemoteConsumerReceiverControllable # getNumberOfActiveMessages ( ) */
public int getNumberOfActiveRequests ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getNumberOfActiveRequests" ) ; // This will return every request in a state other than COMPLETE
List all = aiStream . getTicksOnStream ( ) ; Iterator it = all . iterator ( ) ; // Filter out rejected ticks
int activeCount = 0 ; while ( it . hasNext ( ) ) { TickRange tr = aiStream . getTickRange ( ( ( Long ) it . next ( ) ) . longValue ( ) ) ; if ( ! ( tr . type == TickRange . Rejected ) ) activeCount ++ ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getNumberOfActiveRequests" , Integer . valueOf ( activeCount ) ) ; return activeCount ; |
public class TableScan { /** * Sets the value of the specified field , as a Constant .
* @ param val
* the constant to be set . Will be casted to the correct type
* specified in the schema of the table .
* @ see UpdateScan # setVal ( java . lang . String , Constant ) */
@ Override public void setVal ( String fldName , Constant val ) { } } | rf . setVal ( fldName , val ) ; |
public class DirectoryScanner { /** * < p > Return the names of the directories which were selected out and
* therefore not ultimately included . < / p >
* < p > The names are relative to the base directory . This involves
* performing a slow scan if one has not already been completed . < / p >
* @ return the names of the directories which were deselected .
* @ see # slowScan */
public synchronized String [ ] getDeselectedDirectories ( ) { } } | slowScan ( ) ; String [ ] directories = new String [ dirsDeselected . size ( ) ] ; dirsDeselected . copyInto ( directories ) ; return directories ; |
public class ServerParams { /** * Get the value of the given parameter name belonging to the given module as integer .
* If no such module / parameter exists , defaultValue is returned .
* If the given value is not an integer , a RuntimeException is thrown .
* @ param moduleName Name of module to get parameter for .
* @ param paramName Name of parameter to get value of .
* @ return Parameter value as a integer or defaultValue if tha parameter does not exis . */
public int getModuleParamInt ( String moduleName , String paramName , int defaultValue ) { } } | Map < String , Object > moduleParams = getModuleParams ( moduleName ) ; if ( moduleParams == null || ! moduleParams . containsValue ( paramName ) ) { return defaultValue ; } Object value = moduleParams . get ( paramName ) ; try { return Integer . parseInt ( value . toString ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( "Configuration parameter '" + moduleName + "." + paramName + "' must be a number: " + value ) ; } |
public class FormatterFileLog { /** * Format log data into a log entry String .
* @ param msgLogLevel Log level of an entry .
* @ param tag Tag with SDK and version details .
* @ param msg Log message .
* @ param exception Exception with a stach
* @ return Formatted log entry . */
String formatMessage ( int msgLogLevel , String tag , String msg , Throwable exception ) { } } | if ( exception != null ) { return DateHelper . getUTC ( System . currentTimeMillis ( ) ) + "/" + getLevelTag ( msgLogLevel ) + tag + ": " + msg + "\n" + getStackTrace ( exception ) + "\n" ; } else { return DateHelper . getUTC ( System . currentTimeMillis ( ) ) + "/" + getLevelTag ( msgLogLevel ) + tag + ": " + msg + "\n" ; } |
public class Tag { /** * Converts a wildcard { @ link Tag } to a { @ link String } { @ link Tag } . This method uses the { @ link Object # toString ( ) }
* method to convert the wildcard type to a { @ link String } .
* @ param tag a { @ link Tag } that should be converted to a { @ link Tag } with value of type { @ link String }
* @ return a { @ link Tag } with a { @ link String } value */
public static Tag < String > tagValueToString ( Tag < ? > tag ) { } } | return new Tag < > ( tag . getKey ( ) , tag . getValue ( ) . toString ( ) ) ; |
public class WikisApi { /** * Get a list of pages in project wiki for the specified page .
* < pre > < code > GitLab Endpoint : GET / projects / : id / wikis < / code > < / pre >
* @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance
* @ param page the page to get
* @ param perPage the number of wiki - pages per page
* @ return a list of pages in project ' s wiki for the specified range
* @ throws GitLabApiException if any exception occurs */
public List < WikiPage > getPages ( Object projectIdOrPath , int page , int perPage ) throws GitLabApiException { } } | Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "wikis" ) ; return response . readEntity ( new GenericType < List < WikiPage > > ( ) { } ) ; |
public class XCatchClauseImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public NotificationChain eInverseRemove ( InternalEObject otherEnd , int featureID , NotificationChain msgs ) { } } | switch ( featureID ) { case XbasePackage . XCATCH_CLAUSE__EXPRESSION : return basicSetExpression ( null , msgs ) ; case XbasePackage . XCATCH_CLAUSE__DECLARED_PARAM : return basicSetDeclaredParam ( null , msgs ) ; } return super . eInverseRemove ( otherEnd , featureID , msgs ) ; |
public class JKDefaultListableBeanFactory { /** * ( non - Javadoc )
* @ see org . springframework . beans . factory . support . DefaultListableBeanFactory #
* registerBeanDefinition ( java . lang . String ,
* org . springframework . beans . factory . config . BeanDefinition ) */
@ Override public void registerBeanDefinition ( String beanName , BeanDefinition beanDefinition ) throws BeanDefinitionStoreException { } } | // accepts the beans in the order of classpath , which allow me to override beans
// easily
if ( containsBean ( beanName ) ) { return ; } // just continue normally
super . registerBeanDefinition ( beanName , beanDefinition ) ; |
public class CmsFlexController { /** * Removes the topmost request / response pair from the stack . < p > */
public void pop ( ) { } } | if ( ( m_flexRequestList != null ) && ! m_flexRequestList . isEmpty ( ) ) { m_flexRequestList . remove ( m_flexRequestList . size ( ) - 1 ) ; } if ( ( m_flexResponseList != null ) && ! m_flexRequestList . isEmpty ( ) ) { m_flexResponseList . remove ( m_flexResponseList . size ( ) - 1 ) ; } if ( ( m_flexContextInfoList != null ) && ! m_flexContextInfoList . isEmpty ( ) ) { CmsFlexRequestContextInfo info = m_flexContextInfoList . remove ( m_flexContextInfoList . size ( ) - 1 ) ; if ( m_flexContextInfoList . size ( ) > 0 ) { ( m_flexContextInfoList . get ( 0 ) ) . merge ( info ) ; updateRequestContextInfo ( ) ; } } |
public class MapContentHandler { /** * Registers a handler for a given content type .
* @ param clazz
* the content type
* @ param handler
* the handler
* @ return the handler formerly associated with the content type , if there
* was one */
public SendGridContentHandler register ( final Class < ? extends Content > clazz , final SendGridContentHandler handler ) { } } | if ( handler == null ) { throw new IllegalArgumentException ( "[handler] cannot be null" ) ; } if ( clazz == null ) { throw new IllegalArgumentException ( "[clazz] cannot be null" ) ; } LOG . debug ( "Registering content handler {} for content type {}" , handler , clazz ) ; return handlers . put ( clazz , handler ) ; |
public class BinaryProtoNetworkExternalizer { /** * Reads a proto network from a descriptor representing a binary file .
* @ param protoNetworkDescriptor { @ link ProtoNetworkDescriptor } , the proto
* network descriptor
* @ return { @ link ProtoNetwork } , the read proto network , which cannot be
* null
* @ throws InvalidArgument Thrown if the { @ code protoNetworkDescriptor } was
* not of type { @ link BinaryProtoNetworkDescriptor }
* @ throws ProtoNetworkError , if there was an error reading from the
* { @ link ProtoNetworkDescriptor } */
@ Override public ProtoNetwork readProtoNetwork ( ProtoNetworkDescriptor protoNetworkDescriptor ) throws ProtoNetworkError { } } | if ( ! BinaryProtoNetworkDescriptor . class . isAssignableFrom ( protoNetworkDescriptor . getClass ( ) ) ) { String err = "protoNetworkDescriptor cannot be of type " ; err = err . concat ( protoNetworkDescriptor . getClass ( ) . getName ( ) ) ; err = err . concat ( ", need type " ) ; err = err . concat ( BinaryProtoNetworkDescriptor . class . getName ( ) ) ; throw new InvalidArgument ( err ) ; } BinaryProtoNetworkDescriptor binaryProtoNetworkDescriptor = ( BinaryProtoNetworkDescriptor ) protoNetworkDescriptor ; File pn = binaryProtoNetworkDescriptor . getProtoNetwork ( ) ; ObjectInputStream ois = null ; try { ois = new ObjectInputStream ( new FileInputStream ( pn ) ) ; ProtoNetwork network = new ProtoNetwork ( ) ; network . readExternal ( ois ) ; return network ; } catch ( FileNotFoundException e ) { final String msg = "Cannot find binary proto-network for path" ; throw new ProtoNetworkError ( pn . getAbsolutePath ( ) , msg , e ) ; } catch ( IOException e ) { final String msg = "Cannot read binary proto-network for path" ; throw new ProtoNetworkError ( pn . getAbsolutePath ( ) , msg , e ) ; } catch ( ClassNotFoundException e ) { final String msg = "Cannot read proto-network for path" ; throw new ProtoNetworkError ( pn . getAbsolutePath ( ) , msg , e ) ; } finally { // clean up IO resources
IOUtils . closeQuietly ( ois ) ; } |
public class ListJobsResult { /** * A list of job objects . Each job object contains metadata describing the job .
* @ param jobList
* A list of job objects . Each job object contains metadata describing the job . */
public void setJobList ( java . util . Collection < GlacierJobDescription > jobList ) { } } | if ( jobList == null ) { this . jobList = null ; return ; } this . jobList = new java . util . ArrayList < GlacierJobDescription > ( jobList ) ; |
public class DSUtil { /** * Returns an immutable < code > Iterable < / code > that is the union
* of several < code > Iterable < / code > s ( in the order thet are given
* in < code > its < / code > ) . */
public static < E > Iterable < E > unionIterable ( Iterable < Iterable < E > > its ) { } } | return new ImmutableCompoundIterable < Iterable < E > , E > ( its , new IdFunction < Iterable < E > > ( ) ) ; |
public class AutowiredLoggerPostProcessor { /** * { @ inheritDoc } */
public Object postProcessBeforeInitialization ( final Object bean , String beanName ) throws BeansException { } } | ReflectionUtils . doWithFields ( bean . getClass ( ) , new FieldCallback ( ) { @ SuppressWarnings ( "unchecked" ) public void doWith ( Field field ) throws IllegalArgumentException , IllegalAccessException { ReflectionUtils . makeAccessible ( field ) ; if ( field . getAnnotation ( AutowiredLogger . class ) != null ) { Logger logger = LoggerFactory . getLogger ( bean . getClass ( ) ) ; field . set ( bean , logger ) ; } } } ) ; return bean ; |
public class JsMainImpl { /** * Create a single Message Engine admin object using suppled config object . */
private MessagingEngine createMessageEngine ( JsMEConfig me ) throws Exception { } } | String thisMethodName = CLASS_NAME + ".createMessageEngine(JsMEConfig)" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , "replace ME name here" ) ; } JsMessagingEngine engineImpl = null ; bus = new JsBusImpl ( me , this , ( me . getSIBus ( ) . getName ( ) ) ) ; // getBusProxy ( me ) ;
engineImpl = new JsMessagingEngineImpl ( this , bus , me ) ; MessagingEngine engine = new MessagingEngine ( me , engineImpl ) ; _messagingEngines . put ( defaultMEUUID , engine ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName , engine . toString ( ) ) ; } return engine ; |
public class FaxClientSpiProxyImpl { /** * This function invokes the interceptor for the given event .
* @ param eventType
* The event type
* @ param method
* The method invoked
* @ param arguments
* The method arguments
* @ param output
* The method output
* @ param throwable
* The throwable while invoking the method */
protected void invokeInterceptorsImpl ( FaxClientSpiProxyEventType eventType , Method method , Object [ ] arguments , Object output , Throwable throwable ) { } } | // get interceptors
FaxClientSpiInterceptor [ ] interceptors = this . getFaxClientSpiInterceptors ( ) ; // get interceptors amount
int amount = interceptors . length ; FaxClientSpiInterceptor interceptor = null ; for ( int index = 0 ; index < amount ; index ++ ) { // get next interceptor
interceptor = interceptors [ index ] ; // invoke interceptor
if ( eventType == FaxClientSpiProxyEventType . PRE_EVENT_TYPE ) { interceptor . preMethodInvocation ( method , arguments ) ; } else if ( eventType == FaxClientSpiProxyEventType . POST_EVENT_TYPE ) { interceptor . postMethodInvocation ( method , arguments , output ) ; } else { interceptor . onMethodInvocationError ( method , arguments , throwable ) ; } } |
public class EJBSerializerImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . ejbcontainer . util . EJBSerializer # getObjectType ( java . lang . Object ) */
@ Override public ObjectType getObjectType ( Object theObject ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "getObjectType: " + theObject . getClass ( ) ) ; } ObjectType objectType = ObjectType . NOT_AN_EJB ; if ( theObject instanceof javax . rmi . CORBA . Stub ) { if ( theObject instanceof EJBObject ) { objectType = ObjectType . EJB_OBJECT ; } else if ( theObject instanceof EJBHome ) { objectType = ObjectType . EJB_HOME ; } else { objectType = ObjectType . CORBA_STUB ; } } else if ( theObject instanceof WrapperProxy ) // F58064
{ if ( theObject instanceof LocalBeanWrapperProxy ) { // There is no sense in using heavyweight reflection to dig out the
// WrapperProxyState since we can cheaply detect local bean .
objectType = ObjectType . EJB_LOCAL_BEAN ; } else { objectType = WrapperProxyState . getWrapperProxyState ( theObject ) . getSerializerObjectType ( ) ; } } else if ( theObject instanceof EJSWrapperBase ) { EJSWrapperBase wrapper = ( EJSWrapperBase ) theObject ; WrapperInterface wInterface = wrapper . ivInterface ; if ( wInterface == WrapperInterface . BUSINESS_LOCAL ) { objectType = ObjectType . EJB_BUSINESS_LOCAL ; } else if ( wInterface == WrapperInterface . LOCAL ) { objectType = ObjectType . EJB_LOCAL_OBJECT ; } else if ( wInterface == WrapperInterface . LOCAL_HOME ) { objectType = ObjectType . EJB_LOCAL_HOME ; } else if ( wInterface == WrapperInterface . BUSINESS_REMOTE ) { objectType = ObjectType . EJB3_BUSINESS_REMOTE ; } else if ( wInterface == WrapperInterface . BUSINESS_RMI_REMOTE ) { objectType = ObjectType . EJB3_BUSINESS_REMOTE ; } } else if ( theObject instanceof LocalBeanWrapper ) // d609263
{ objectType = ObjectType . EJB_LOCAL_BEAN ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "ObjectType = " + objectType ) ; } return objectType ; |
public class DataSiftAccount { /** * List limits for the given service
* @ param service which service you want to list the limits of
* @ param page page number ( can be 0)
* @ param perPage items per page ( can be 0)
* @ return List of identities */
public FutureData < LimitList > listLimits ( String service , int page , int perPage ) { } } | if ( service == null || service . isEmpty ( ) ) { throw new IllegalArgumentException ( "A service is required" ) ; } FutureData < LimitList > future = new FutureData < > ( ) ; ParamBuilder b = newParams ( ) ; if ( page > 0 ) { b . put ( "page" , page ) ; } if ( perPage > 0 ) { b . put ( "per_page" , perPage ) ; } URI uri = b . forURL ( config . newAPIEndpointURI ( IDENTITY + "/limit/" + service ) ) ; Request request = config . http ( ) . GET ( uri , new PageReader ( newRequestCallback ( future , new LimitList ( ) , config ) ) ) ; performRequest ( future , request ) ; return future ; |
public class Matrix4d { /** * Set this matrix to a rotation transformation about the Z axis .
* When used with a right - handed coordinate system , the produced rotation will rotate a vector
* counter - clockwise around the rotation axis , when viewing along the negative axis direction towards the origin .
* When used with a left - handed coordinate system , the rotation is clockwise .
* Reference : < a href = " http : / / en . wikipedia . org / wiki / Rotation _ matrix # Basic _ rotations " > http : / / en . wikipedia . org < / a >
* @ param ang
* the angle in radians
* @ return this */
public Matrix4d rotationZ ( double ang ) { } } | double sin , cos ; sin = Math . sin ( ang ) ; cos = Math . cosFromSin ( sin , ang ) ; if ( ( properties & PROPERTY_IDENTITY ) == 0 ) this . _identity ( ) ; m00 = cos ; m01 = sin ; m10 = - sin ; m11 = cos ; properties = PROPERTY_AFFINE | PROPERTY_ORTHONORMAL ; return this ; |
public class MapComposedElement { /** * Set the specified point at the given index .
* < p > If the < var > index < / var > is negative , it will corresponds
* to an index starting from the end of the list .
* @ param index is the index of the desired point
* @ param x is the new value of the point
* @ param y is the new value of the point
* @ param canonize indicates if the function { @ link # canonize ( int ) } must be called .
* @ return < code > true < / code > if the point was set , < code > false < / code > if
* the specified coordinates correspond to the already existing point .
* @ throws IndexOutOfBoundsException in case of error . */
public boolean setPointAt ( int index , double x , double y , boolean canonize ) { } } | final int count = getPointCount ( ) ; int idx = index ; if ( idx < 0 ) { idx = count + idx ; } if ( idx < 0 ) { throw new IndexOutOfBoundsException ( idx + "<0" ) ; // $ NON - NLS - 1 $
} if ( idx >= count ) { throw new IndexOutOfBoundsException ( idx + ">=" + count ) ; // $ NON - NLS - 1 $
} final PointFusionValidator validator = getPointFusionValidator ( ) ; final int idx1 = idx * 2 ; final int idx2 = idx1 + 1 ; if ( ! validator . isSame ( x , y , this . pointCoordinates [ idx1 ] , this . pointCoordinates [ idx2 ] ) ) { this . pointCoordinates [ idx1 ] = x ; this . pointCoordinates [ idx2 ] = y ; if ( canonize ) { canonize ( idx ) ; } fireShapeChanged ( ) ; fireElementChanged ( ) ; return true ; } return false ; |
public class AwsUtils { /** * - - - - - Private Methods - - - - - */
private static String createSignature ( String stringToSign , String awsSecretKey , String algorithm ) throws SignatureException { } } | assert stringToSign != null ; assert awsSecretKey != null ; assert algorithm != null ; String signature ; try { byte [ ] secretyKeyBytes = awsSecretKey . getBytes ( UTF8_CHARSET ) ; SecretKeySpec secretKeySpec = new SecretKeySpec ( secretyKeyBytes , algorithm ) ; Mac mac = Mac . getInstance ( algorithm ) ; mac . init ( secretKeySpec ) ; byte [ ] data = stringToSign . getBytes ( UTF8_CHARSET ) ; byte [ ] rawHmac = mac . doFinal ( data ) ; signature = rfc3986Conformance ( new String ( Codec . base64Encode ( rawHmac ) ) ) ; } catch ( Exception e ) { throw new SignatureException ( "Failed to generate HMAC : " + e . getMessage ( ) ) ; } return signature ; |
public class AutoScaling { /** * Returns filtered list of auto scaling groups .
* @ param options the filter parameters
* @ return filtered list of scaling groups */
@ Override public Collection < ScalingGroup > listScalingGroups ( AutoScalingGroupFilterOptions options ) throws CloudException , InternalException { } } | APITrace . begin ( getProvider ( ) , "AutoScaling.listScalingGroups" ) ; try { ProviderContext ctx = getProvider ( ) . getContext ( ) ; if ( ctx == null ) { throw new CloudException ( "No context has been set for this request" ) ; } ArrayList < ScalingGroup > list = new ArrayList < ScalingGroup > ( ) ; Map < String , String > parameters = getAutoScalingParameters ( getProvider ( ) . getContext ( ) , EC2Method . DESCRIBE_AUTO_SCALING_GROUPS ) ; EC2Method method ; NodeList blocks ; Document doc ; method = new EC2Method ( SERVICE_ID , getProvider ( ) , parameters ) ; try { doc = method . invoke ( ) ; } catch ( EC2Exception e ) { logger . error ( e . getSummary ( ) ) ; throw new CloudException ( e ) ; } blocks = doc . getElementsByTagName ( "AutoScalingGroups" ) ; for ( int i = 0 ; i < blocks . getLength ( ) ; i ++ ) { NodeList items = blocks . item ( i ) . getChildNodes ( ) ; for ( int j = 0 ; j < items . getLength ( ) ; j ++ ) { Node item = items . item ( j ) ; if ( item . getNodeName ( ) . equals ( "member" ) ) { ScalingGroup group = toScalingGroup ( ctx , item ) ; if ( ( group != null && ( options != null && ! options . hasCriteria ( ) ) ) || ( group != null && ( options != null && options . hasCriteria ( ) && options . matches ( group ) ) ) ) { list . add ( group ) ; } } } } return list ; } finally { APITrace . end ( ) ; } |
public class CmsSendEmailGroupsDialog { /** * Returns a warning if users have been excluded . < p >
* @ return a warning */
public String getExcludedUsers ( ) { } } | if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( m_excludedUsers ) ) { getToNames ( ) ; } if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( m_excludedUsers ) ) { return "" ; } return m_excludedUsers ; |
public class ResourceChangeDetectingEventNotifier { /** * Compare the SHA1 digests ( since last check and the latest ) of the configured resource , and if change is detected ,
* publish the < code > ResourceChangeEvent < / code > to ApplicationContext . */
public void notifyOfTheResourceChangeEventIfNecessary ( ) { } } | final String currentResourceSha1 = this . resourceSha1Hex ; String newResourceSha1 = null ; try { newResourceSha1 = new Sha1Hash ( this . watchedResource . getFile ( ) ) . toHex ( ) ; if ( ! newResourceSha1 . equals ( currentResourceSha1 ) ) { logger . debug ( "Resource: [{}] | Old Hash: [{}] | New Hash: [{}]" , new Object [ ] { this . watchedResource . getURI ( ) , currentResourceSha1 , newResourceSha1 } ) ; synchronized ( this . resourceSha1Hex ) { this . resourceSha1Hex = newResourceSha1 ; this . applicationEventPublisher . publishEvent ( new ResourceChangedEvent ( this , this . watchedResource . getURI ( ) ) ) ; } } } catch ( final Throwable e ) { // TODO : Possibly introduce an exception handling strategy ?
logger . error ( "An exception is caught during 'watchedResource' access" , e ) ; return ; } |
public class ReservationUtilizationGroupMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ReservationUtilizationGroup reservationUtilizationGroup , ProtocolMarshaller protocolMarshaller ) { } } | if ( reservationUtilizationGroup == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( reservationUtilizationGroup . getKey ( ) , KEY_BINDING ) ; protocolMarshaller . marshall ( reservationUtilizationGroup . getValue ( ) , VALUE_BINDING ) ; protocolMarshaller . marshall ( reservationUtilizationGroup . getAttributes ( ) , ATTRIBUTES_BINDING ) ; protocolMarshaller . marshall ( reservationUtilizationGroup . getUtilization ( ) , UTILIZATION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CollectionExtensions { /** * Returns an immutable copy of the specified { @ code list } .
* @ param list
* the list for which an immutable copy should be created . May not be < code > null < / code > .
* @ return an immutable copy of the specified list . */
@ Inline ( value = "$2.$3copyOf($1)" , imported = ImmutableList . class ) public static < T > List < T > immutableCopy ( List < ? extends T > list ) { } } | return ImmutableList . copyOf ( list ) ; |
public class Condition { /** * Returns the Lucene { @ link Query } representation of this condition .
* @ param schema the schema to be used
* @ return the Lucene query */
public final Query query ( Schema schema ) { } } | Query query = doQuery ( schema ) ; return boost == null ? query : new BoostQuery ( query , boost ) ; |
public class XmlRpcRemoteRunner { /** * < p > getSpecificationHierarchy . < / p >
* @ param repository a { @ link com . greenpepper . server . domain . Repository } object .
* @ param systemUnderTest a { @ link com . greenpepper . server . domain . SystemUnderTest } object .
* @ return a { @ link DocumentNode } object .
* @ throws com . greenpepper . server . GreenPepperServerException if any . */
public DocumentNode getSpecificationHierarchy ( Repository repository , SystemUnderTest systemUnderTest ) throws GreenPepperServerException { } } | return xmlRpc . getSpecificationHierarchy ( repository , systemUnderTest , getIdentifier ( ) ) ; |
public class SolverWorldModelInterface { /** * Sends a multiple Attribute update messages to the world model .
* @ param attrToSend
* the Attribute values to update
* @ return { @ code true } if the messages were written , or { @ code false } if
* one or more messages failed to send . */
public boolean updateAttributes ( final Collection < Attribute > attrToSend ) { } } | if ( ! this . sentAttrSpecifications ) { log . error ( "Haven't sent type specifications yet, can't send solutions." ) ; return false ; } for ( Iterator < Attribute > iter = attrToSend . iterator ( ) ; iter . hasNext ( ) ; ) { Attribute soln = iter . next ( ) ; Integer solutionTypeAlias = this . attributeAliases . get ( soln . getAttributeName ( ) ) ; if ( solutionTypeAlias == null ) { log . error ( "Cannot send solution: Unregistered attribute type: {}" , soln . getAttributeName ( ) ) ; iter . remove ( ) ; continue ; } soln . setAttributeNameAlias ( solutionTypeAlias . intValue ( ) ) ; } AttributeUpdateMessage message = new AttributeUpdateMessage ( ) ; message . setCreateId ( this . createIds ) ; message . setAttributes ( attrToSend . toArray ( new Attribute [ ] { } ) ) ; this . session . write ( message ) ; log . debug ( "Sent {} to {}" , message , this ) ; return true ; |
public class ElementMatchers { /** * Matches a method in its defined shape .
* @ param matcher The matcher to apply to the matched method ' s defined shape .
* @ param < T > The matched object ' s type .
* @ return A matcher that matches a matched method ' s defined shape . */
public static < T extends MethodDescription > ElementMatcher . Junction < T > definedMethod ( ElementMatcher < ? super MethodDescription . InDefinedShape > matcher ) { } } | return new DefinedShapeMatcher < T , MethodDescription . InDefinedShape > ( matcher ) ; |
public class JDBCStorableIntrospector { /** * Generates aliases for the given name , converting camel case form into
* various underscore forms . */
static String [ ] generateAliases ( String base ) { } } | int length = base . length ( ) ; if ( length <= 1 ) { return new String [ ] { base . toUpperCase ( ) , base . toLowerCase ( ) } ; } ArrayList < String > aliases = new ArrayList < String > ( 4 ) ; StringBuilder buf = new StringBuilder ( ) ; int i ; for ( i = 0 ; i < length ; ) { char c = base . charAt ( i ++ ) ; if ( c == '_' || ! Character . isJavaIdentifierPart ( c ) ) { // Keep scanning for first letter .
buf . append ( c ) ; } else { buf . append ( Character . toUpperCase ( c ) ) ; break ; } } boolean canSeparate = false ; boolean appendedIdentifierPart = false ; for ( ; i < length ; i ++ ) { char c = base . charAt ( i ) ; if ( c == '_' || ! Character . isJavaIdentifierPart ( c ) ) { canSeparate = false ; appendedIdentifierPart = false ; } else if ( Character . isLowerCase ( c ) ) { canSeparate = true ; appendedIdentifierPart = true ; } else { if ( appendedIdentifierPart && i + 1 < length && Character . isLowerCase ( base . charAt ( i + 1 ) ) ) { canSeparate = true ; } if ( canSeparate ) { buf . append ( '_' ) ; } canSeparate = false ; appendedIdentifierPart = true ; } buf . append ( c ) ; } String derived = buf . toString ( ) ; addToSet ( aliases , derived . toUpperCase ( ) ) ; addToSet ( aliases , derived . toLowerCase ( ) ) ; addToSet ( aliases , derived ) ; addToSet ( aliases , base . toUpperCase ( ) ) ; addToSet ( aliases , base . toLowerCase ( ) ) ; addToSet ( aliases , base ) ; return aliases . toArray ( new String [ aliases . size ( ) ] ) ; |
public class AbstractRecordReader { /** * Subscribes the listener object to receive events of the given type .
* @ param eventListener
* the listener object to register
* @ param eventType
* the type of event to register the listener for */
@ Override public void subscribeToEvent ( EventListener eventListener , Class < ? extends AbstractTaskEvent > eventType ) { } } | this . eventHandler . subscribeToEvent ( eventListener , eventType ) ; |
public class CloudFile { /** * 分N线程并行上传云文件 , 线程数默认值是经过本地验证取最优的
* @ param pathDataMap 批量数据 , key为path , value为文件内容
* @ return completable */
@ SuppressWarnings ( "all" ) public static Completable save ( Map pathDataMap ) { } } | return SingleRxXian . call ( "cosService" , "batchCosWrite" , new JSONObject ( ) { { put ( "files" , pathDataMap ) ; } } ) . toCompletable ( ) ; |
public class CheckSkuAvailabilitysInner { /** * Check available SKUs .
* @ param location Resource location .
* @ param skus The SKU of the resource .
* @ param kind The Kind of the resource . Possible values include : ' Bing . Autosuggest . v7 ' , ' Bing . CustomSearch ' , ' Bing . Search . v7 ' , ' Bing . Speech ' , ' Bing . SpellCheck . v7 ' , ' ComputerVision ' , ' ContentModerator ' , ' CustomSpeech ' , ' CustomVision . Prediction ' , ' CustomVision . Training ' , ' Emotion ' , ' Face ' , ' LUIS ' , ' QnAMaker ' , ' SpeakerRecognition ' , ' SpeechTranslation ' , ' TextAnalytics ' , ' TextTranslation ' , ' WebLM '
* @ param type The Type of the resource .
* @ 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 < CheckSkuAvailabilityResultListInner > listAsync ( String location , List < SkuName > skus , Kind kind , String type , final ServiceCallback < CheckSkuAvailabilityResultListInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( listWithServiceResponseAsync ( location , skus , kind , type ) , serviceCallback ) ; |
public class WorkflowTriggersInner { /** * Sets the state of a workflow trigger .
* @ param resourceGroupName The resource group name .
* @ param workflowName The workflow name .
* @ param triggerName The workflow trigger name .
* @ param source the WorkflowTriggerInner value
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < Void > setStateAsync ( String resourceGroupName , String workflowName , String triggerName , WorkflowTriggerInner source ) { } } | return setStateWithServiceResponseAsync ( resourceGroupName , workflowName , triggerName , source ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class StringUtilities { /** * Checks if the list of strings supplied contains the supplied string .
* < p > If the string is contained it changes the name by adding a number .
* < p > The spaces are trimmed away before performing name equality .
* @ param strings the list of existing strings .
* @ param string the proposed new string , to be changed if colliding .
* @ return the new non - colliding name for the string . */
public static String checkSameName ( List < String > strings , String string ) { } } | int index = 1 ; for ( int i = 0 ; i < strings . size ( ) ; i ++ ) { if ( index == 10000 ) { // something odd is going on
throw new RuntimeException ( ) ; } String existingString = strings . get ( i ) ; existingString = existingString . trim ( ) ; if ( existingString . trim ( ) . equals ( string . trim ( ) ) ) { // name exists , change the name of the entering
if ( string . endsWith ( ")" ) ) { string = string . trim ( ) . replaceFirst ( "\\([0-9]+\\)$" , "(" + ( index ++ ) + ")" ) ; } else { string = string + " (" + ( index ++ ) + ")" ; } // start again
i = 0 ; } } return string ; |
public class Service { /** * Removes a dependency . This method < i > must < / i > be called in the { @ link # init ( ) init ( ) } method .
* @ param service */
protected void removeDependency ( Service service ) { } } | assertDuringInitialization ( ) ; LOG . info ( "Service {} is not dependent on {}" , this , service ) ; if ( ! dependsOn . remove ( service ) ) LOG . warn ( "Service {} asked to remove dependency on {}, but wasn't dependendent on it" , getName ( ) , service . getName ( ) ) ; |
public class ArgP { /** * Returns the value of the given option , or a default value .
* @ param name The name of the option to recognize ( e . g . { @ code - - foo } ) .
* @ param defaultv The default value to return if the option wasn ' t given .
* @ throws IllegalArgumentException if this option wasn ' t registered with
* { @ link # addOption } .
* @ throws IllegalStateException if { @ link # parse } wasn ' t called . */
public String get ( final String name , final String defaultv ) { } } | final String value = get ( name ) ; return value == null ? defaultv : value ; |
public class JmxAction { /** * Gets the effects of this action .
* @ return the effects . Will not be { @ code null } */
public Set < Action . ActionEffect > getActionEffects ( ) { } } | switch ( getImpact ( ) ) { case CLASSLOADING : case WRITE : return WRITES ; case READ_ONLY : return READS ; default : throw new IllegalStateException ( ) ; } |
public class AbstractEXIBodyEncoder { /** * returns null if no CH datatype is available or schema - less */
private WhiteSpace getDatatypeWhiteSpace ( ) { } } | Grammar currGr = this . getCurrentGrammar ( ) ; if ( currGr . isSchemaInformed ( ) && currGr . getNumberOfEvents ( ) > 0 ) { Production prod = currGr . getProduction ( 0 ) ; if ( prod . getEvent ( ) . getEventType ( ) == EventType . CHARACTERS ) { Characters ch = ( Characters ) prod . getEvent ( ) ; return ch . getDatatype ( ) . getWhiteSpace ( ) ; } } return null ; |
public class Resolver { /** * Implementation of { @ link LSResourceResolver # resolveResource ( String , String , String , String , String ) } . */
public LSInput resolveResource ( String pType , String pNamespaceURI , String pPublicId , String pSystemId , String pBaseURI ) { } } | if ( pPublicId != null ) { final InputSource isource = resolver . resolveEntity ( pPublicId , pSystemId ) ; if ( isource != null ) { return newLSInput ( isource ) ; } } InputSource isource = resolver . resolveEntity ( pNamespaceURI , pSystemId ) ; if ( isource != null ) { return newLSInput ( isource ) ; } URI baseURI = null ; if ( pBaseURI != null ) { try { baseURI = new URI ( pBaseURI ) ; } catch ( URISyntaxException ex ) { baseURI = null ; // or perhaps this should be an UndeclaredThrowableException
} } URL url = resolve ( pSystemId , baseURI ) ; if ( url != null ) { try { isource = asInputSource ( url ) ; } catch ( IOException e ) { throw new UndeclaredThrowableException ( e ) ; } } return isource == null ? null : newLSInput ( isource ) ; |
public class XmlElementWrapperPlugin { /** * For the given annotatable check that all annotations ( and all annotations within annotations recursively ) do not
* refer any candidate for removal . */
private void checkAnnotationReference ( Map < String , Candidate > candidatesMap , JAnnotatable annotatable ) { } } | for ( JAnnotationUse annotation : annotatable . annotations ( ) ) { JAnnotationValue annotationMember = getAnnotationMember ( annotation , "value" ) ; if ( annotationMember instanceof JAnnotationArrayMember ) { checkAnnotationReference ( candidatesMap , ( JAnnotationArrayMember ) annotationMember ) ; continue ; } JExpression type = getAnnotationMemberExpression ( annotation , "type" ) ; if ( type == null ) { // Can be the case for @ XmlElement ( name = " publication - reference " , namespace = " http : / / mycompany . org / exchange " )
// or any other annotation without " type "
continue ; } Candidate candidate = candidatesMap . get ( generableToString ( type ) . replace ( ".class" , "" ) ) ; if ( candidate != null ) { logger . debug ( "Candidate " + candidate . getClassName ( ) + " is used in XmlElements/XmlElementRef and hence won't be removed." ) ; candidate . unmarkForRemoval ( ) ; } } |
public class PipelineServiceImpl { /** * finds any stages for a dashboard that aren ' t mapped .
* @ param dashboard
* @ return a list of deploy PipelineStages that are not mapped */
private List < PipelineStage > findUnmappedStages ( Dashboard dashboard , List < PipelineStage > pipelineStageList ) { } } | List < PipelineStage > unmappedStages = new ArrayList < > ( ) ; Map < PipelineStage , String > stageToEnvironmentNameMap = PipelineUtils . getStageToEnvironmentNameMap ( dashboard ) ; for ( PipelineStage systemStage : pipelineStageList ) { if ( PipelineStageType . DEPLOY . equals ( systemStage . getType ( ) ) ) { String mappedName = stageToEnvironmentNameMap . get ( systemStage ) ; if ( mappedName == null || mappedName . isEmpty ( ) ) { unmappedStages . add ( systemStage ) ; } } } return unmappedStages ; |
public class ServiceHandler { /** * create local topology files in blobstore and sync metadata to zk */
private void setupStormCode ( String topologyId , String tmpJarLocation , Map < Object , Object > stormConf , StormTopology topology , boolean update ) throws Exception { } } | String codeKey = StormConfig . master_stormcode_key ( topologyId ) ; String confKey = StormConfig . master_stormconf_key ( topologyId ) ; String codeKeyBak = StormConfig . master_stormcode_bak_key ( topologyId ) ; // in local mode there is no jar
if ( tmpJarLocation != null ) { setupJar ( tmpJarLocation , topologyId , update ) ; } if ( update ) { backupBlob ( codeKey , codeKeyBak , topologyId ) ; } createOrUpdateBlob ( confKey , Utils . serialize ( stormConf ) , update , topologyId ) ; createOrUpdateBlob ( codeKey , Utils . serialize ( topology ) , update , topologyId ) ; |
public class RequestTemplate { /** * Specify a Query String parameter , with the specified values . Values can be literals or template
* expressions .
* @ param name of the parameter .
* @ param values for this parameter .
* @ return a RequestTemplate for chaining . */
public RequestTemplate query ( String name , Iterable < String > values ) { } } | return appendQuery ( name , values , this . collectionFormat ) ; |
public class DrpcFetchHelper { /** * 処理が成功した場合の応答を返す 。
* @ param requestId リクエストID
* @ param resultMessage 応答メッセージ
* @ throws TException 応答を返す際に失敗した場合 */
public void ack ( String requestId , String resultMessage ) throws TException { } } | int index = this . requestedMap . remove ( requestId ) ; DRPCInvocationsClient client = this . clients . get ( index ) ; client . result ( requestId , resultMessage ) ; |
public class AmazonAutoScalingClient { /** * Suspends the specified automatic scaling processes , or all processes , for the specified Auto Scaling group .
* If you suspend either the < code > Launch < / code > or < code > Terminate < / code > process types , it can prevent other
* process types from functioning properly .
* To resume processes that have been suspended , use < a > ResumeProcesses < / a > .
* For more information , see < a
* href = " https : / / docs . aws . amazon . com / autoscaling / ec2 / userguide / as - suspend - resume - processes . html " > Suspending and
* Resuming Scaling Processes < / a > in the < i > Amazon EC2 Auto Scaling User Guide < / i > .
* @ param suspendProcessesRequest
* @ return Result of the SuspendProcesses operation returned by the service .
* @ throws ResourceInUseException
* The operation can ' t be performed because the resource is in use .
* @ throws ResourceContentionException
* You already have a pending update to an Amazon EC2 Auto Scaling resource ( for example , an Auto Scaling
* group , instance , or load balancer ) .
* @ sample AmazonAutoScaling . SuspendProcesses
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / autoscaling - 2011-01-01 / SuspendProcesses " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public SuspendProcessesResult suspendProcesses ( SuspendProcessesRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeSuspendProcesses ( request ) ; |
public class LogRepositoryManagerImpl { /** * Deletes the specified directory
* @ param the name of the directory to be deleted */
protected void deleteDirectory ( File directoryName ) { } } | if ( debugLogger . isLoggable ( Level . FINE ) && isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "deleteDirectory" , "empty directory " + ( ( directoryName == null ) ? "None" : directoryName . getPath ( ) ) ) ; } if ( AccessHelper . deleteFile ( directoryName ) ) { // If directory is empty , delete
if ( debugLogger . isLoggable ( Level . FINE ) && isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "deleteDirectory" , "delete " + directoryName . getName ( ) ) ; } } else { // Else the directory is not empty , and deletion fails
if ( isDebugEnabled ( ) ) { debugLogger . logp ( Level . WARNING , thisClass , "deleteDirectory" , "Failed to delete directory " + directoryName . getPath ( ) ) ; } } |
public class Person { /** * Add this field in the Record ' s field sequence . */
public BaseField setupField ( int iFieldSeq ) { } } | BaseField field = null ; if ( iFieldSeq == 0 ) { field = new CounterField ( this , ID , 8 , null , null ) ; field . setHidden ( true ) ; } // if ( iFieldSeq = = 1)
// field = new RecordChangedField ( this , LAST _ CHANGED , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ;
// field . setHidden ( true ) ;
// if ( iFieldSeq = = 2)
// field = new BooleanField ( this , DELETED , Constants . DEFAULT _ FIELD _ LENGTH , null , new Boolean ( false ) ) ;
// field . setHidden ( true ) ;
if ( iFieldSeq == 3 ) field = new StringField ( this , CODE , 16 , null , null ) ; if ( iFieldSeq == 4 ) field = new StringField ( this , NAME , 30 , null , null ) ; if ( iFieldSeq == 5 ) field = new StringField ( this , ADDRESS_LINE_1 , 40 , null , null ) ; if ( iFieldSeq == 6 ) field = new StringField ( this , ADDRESS_LINE_2 , 40 , null , null ) ; if ( iFieldSeq == 7 ) field = new StringField ( this , CITY_OR_TOWN , 15 , null , null ) ; if ( iFieldSeq == 8 ) field = new StringField ( this , STATE_OR_REGION , 15 , null , null ) ; if ( iFieldSeq == 9 ) field = new StringField ( this , POSTAL_CODE , 10 , null , null ) ; if ( iFieldSeq == 10 ) field = new StringField ( this , COUNTRY , 15 , null , null ) ; if ( iFieldSeq == 11 ) field = new PhoneField ( this , TEL , 24 , null , null ) ; if ( iFieldSeq == 12 ) field = new FaxField ( this , FAX , 24 , null , null ) ; if ( iFieldSeq == 13 ) field = new EMailField ( this , EMAIL , 40 , null , null ) ; if ( iFieldSeq == 14 ) field = new URLField ( this , WEB , 60 , null , null ) ; if ( iFieldSeq == 15 ) field = new Person_DateEntered ( this , DATE_ENTERED , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 16 ) field = new DateField ( this , DATE_CHANGED , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 17 ) field = new ReferenceField ( this , CHANGED_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 18 ) field = new MemoField ( this , COMMENTS , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 19 ) field = new UserField ( this , USER_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 20 ) field = new StringField ( this , PASSWORD , 16 , null , null ) ; if ( iFieldSeq == 21 ) field = new StringField ( this , NAME_SORT , 6 , null , null ) ; if ( iFieldSeq == 22 ) field = new StringField ( this , POSTAL_CODE_SORT , 5 , null , null ) ; if ( field == null ) field = super . setupField ( iFieldSeq ) ; return field ; |
public class AmazonAppStreamClient { /** * Creates an image builder . An image builder is a virtual machine that is used to create an image .
* The initial state of the builder is < code > PENDING < / code > . When it is ready , the state is < code > RUNNING < / code > .
* @ param createImageBuilderRequest
* @ return Result of the CreateImageBuilder operation returned by the service .
* @ throws LimitExceededException
* The requested limit exceeds the permitted limit for an account .
* @ throws InvalidAccountStatusException
* The resource cannot be created because your AWS account is suspended . For assistance , contact AWS
* Support .
* @ throws ResourceAlreadyExistsException
* The specified resource already exists .
* @ throws ResourceNotAvailableException
* The specified resource exists and is not in use , but isn ' t available .
* @ throws ResourceNotFoundException
* The specified resource was not found .
* @ throws InvalidRoleException
* The specified role is invalid .
* @ throws ConcurrentModificationException
* An API error occurred . Wait a few minutes and try again .
* @ throws InvalidParameterCombinationException
* Indicates an incorrect combination of parameters , or a missing parameter .
* @ throws IncompatibleImageException
* The image does not support storage connectors .
* @ throws OperationNotPermittedException
* The attempted operation is not permitted .
* @ sample AmazonAppStream . CreateImageBuilder
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / appstream - 2016-12-01 / CreateImageBuilder " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public CreateImageBuilderResult createImageBuilder ( CreateImageBuilderRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeCreateImageBuilder ( request ) ; |
public class Ginv { /** * Add a factor times one column to another column
* @ param matrix
* the matrix to modify
* @ param diag
* coordinate on the diagonal
* @ param fromRow
* first row to process
* @ param col
* column to process
* @ param factor
* factor to multiply */
public static void addColTimes ( DenseDoubleMatrix2D matrix , long diag , long fromRow , long col , double factor ) { } } | long rows = matrix . getRowCount ( ) ; for ( long row = fromRow ; row < rows ; row ++ ) { matrix . setDouble ( matrix . getDouble ( row , col ) - factor * matrix . getDouble ( row , diag ) , row , col ) ; } |
public class ContactDetail { /** * A list of name - value pairs for parameters required by certain top - level domains .
* @ return A list of name - value pairs for parameters required by certain top - level domains . */
public java . util . List < ExtraParam > getExtraParams ( ) { } } | if ( extraParams == null ) { extraParams = new com . amazonaws . internal . SdkInternalList < ExtraParam > ( ) ; } return extraParams ; |
public class JingleContentDescriptionProvider { /** * Parse a iq / jingle / description / payload - type element .
* @ param parser the input to parse
* @ return a payload type element */
protected JinglePayloadType parsePayload ( final XmlPullParser parser ) { } } | int ptId = 0 ; String ptName ; int ptChannels = 0 ; try { ptId = Integer . parseInt ( parser . getAttributeValue ( "" , "id" ) ) ; } catch ( Exception e ) { } ptName = parser . getAttributeValue ( "" , "name" ) ; try { ptChannels = Integer . parseInt ( parser . getAttributeValue ( "" , "channels" ) ) ; } catch ( Exception e ) { } return new JinglePayloadType ( new PayloadType ( ptId , ptName , ptChannels ) ) ; |
public class ServletConfig { /** * Sets the startUpWeight . A null value is translated to the default weight .
* @ param weight */
public void setStartUpWeight ( Integer weight ) { } } | // save previous weight to see if we need to try to remove and add it again to the list
this . previousWeight = this . startUpWeight ; if ( weight != null ) { if ( weight . intValue ( ) >= 0 ) this . startUpWeight = weight ; else this . startUpWeight = DEFAULT_STARTUP ; } else { this . startUpWeight = DEFAULT_STARTUP ; } if ( this . context != null ) this . context . addToStartWeightList ( this ) ; |
public class AnySAMInputFormat { /** * Returns a { @ link BAMRecordReader } or { @ link SAMRecordReader } as
* appropriate , initialized with the given parameters .
* < p > Throws { @ link IllegalArgumentException } if the given input split is
* not a { @ link FileVirtualSplit } ( used by { @ link BAMInputFormat } ) or a
* { @ link FileSplit } ( used by { @ link SAMInputFormat } ) , or if the path
* referred to is not recognized as a SAM , BAM , or CRAM file ( see { @ link
* # getFormat } ) . < / p > */
@ Override public RecordReader < LongWritable , SAMRecordWritable > createRecordReader ( InputSplit split , TaskAttemptContext ctx ) throws InterruptedException , IOException { } } | final Path path ; if ( split instanceof FileSplit ) path = ( ( FileSplit ) split ) . getPath ( ) ; else if ( split instanceof FileVirtualSplit ) path = ( ( FileVirtualSplit ) split ) . getPath ( ) ; else throw new IllegalArgumentException ( "split '" + split + "' has unknown type: cannot extract path" ) ; if ( this . conf == null ) this . conf = ctx . getConfiguration ( ) ; final SAMFormat fmt = getFormat ( path ) ; if ( fmt == null ) throw new IllegalArgumentException ( "unknown SAM format, cannot create RecordReader: " + path ) ; switch ( fmt ) { case SAM : return samIF . createRecordReader ( split , ctx ) ; case BAM : return bamIF . createRecordReader ( split , ctx ) ; case CRAM : return cramIF . createRecordReader ( split , ctx ) ; default : assert false ; return null ; } |
public class AuditSigningImpl { /** * The < code > retrieveSignerCertificate < / code > method retrieves the Administrator ' s certificate used
* to sign the audit records .
* @ return an X509Certificate */
public X509Certificate retrieveSignerCertificate ( ) throws Exception { } } | // TO - DO : The real way is we get the keyStore value from
// the audit Policy , get the audit truststore , retrieve
// the public certificate and extract the public key from
// the public certificate . But since we don ' t have the WCCM
// model change , we ' ll have to hardcode where the truststore is
PublicKey publicKey = null ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "signerAlias: " + signerAlias + " signerType: " + signerType + " signerProvider: " + signerProvider + " signerKeyFileLocation: " + signerKeyFileLocation ) ; } KeyStore ks = null ; try { ks = KeyStore . getInstance ( "JKS" ) ; InputStream is = openKeyStore ( signerKeyFileLocation ) ; X509Certificate cert = ( X509Certificate ) ks . getCertificate ( signerAlias ) ; return cert ; } catch ( java . net . MalformedURLException me ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Exception opening keystore: malformed URL" , me . getMessage ( ) ) ; throw new Exception ( me . getMessage ( ) ) ; } catch ( java . security . KeyStoreException ke ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Exception opening keystore." , ke . getMessage ( ) ) ; throw new Exception ( ke . getMessage ( ) ) ; } catch ( java . io . IOException ioe ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Exception opening keystore." , ioe . getMessage ( ) ) ; throw new Exception ( ioe . getMessage ( ) ) ; } |
public class CmsDbRemovePubLocksApp { /** * Component for remove publish lock surface . < p >
* @ return HorizontalSplitPanel */
private HorizontalSplitPanel getRemovePublishLocksView ( ) { } } | HorizontalSplitPanel sp = new HorizontalSplitPanel ( ) ; sp . setData ( Collections . singletonMap ( A_CmsAttributeAwareApp . ATTR_MAIN_HEIGHT_FULL , Boolean . TRUE ) ) ; sp . setSizeFull ( ) ; CmsDbRemovePublishLocks publishLocksView = new CmsDbRemovePublishLocks ( ) ; sp . setFirstComponent ( new CmsInternalResources ( publishLocksView ) ) ; sp . setSecondComponent ( publishLocksView ) ; sp . addStyleName ( "v-align-center" ) ; sp . setSplitPosition ( CmsFileExplorer . LAYOUT_SPLIT_POSITION , Unit . PIXELS ) ; return sp ; |
public class StringUtils { /** * < p > Compares two CharSequences , and returns the index at which the
* CharSequences begin to differ . < / p >
* < p > For example ,
* { @ code indexOfDifference ( " i am a machine " , " i am a robot " ) - > 7 } < / p >
* < pre >
* StringUtils . indexOfDifference ( null , null ) = - 1
* StringUtils . indexOfDifference ( " " , " " ) = - 1
* StringUtils . indexOfDifference ( " " , " abc " ) = 0
* StringUtils . indexOfDifference ( " abc " , " " ) = 0
* StringUtils . indexOfDifference ( " abc " , " abc " ) = - 1
* StringUtils . indexOfDifference ( " ab " , " abxyz " ) = 2
* StringUtils . indexOfDifference ( " abcde " , " abxyz " ) = 2
* StringUtils . indexOfDifference ( " abcde " , " xyz " ) = 0
* < / pre >
* @ param cs1 the first CharSequence , may be null
* @ param cs2 the second CharSequence , may be null
* @ return the index where cs1 and cs2 begin to differ ; - 1 if they are equal
* @ since 2.0
* @ since 3.0 Changed signature from indexOfDifference ( String , String ) to
* indexOfDifference ( CharSequence , CharSequence ) */
public static int indexOfDifference ( final CharSequence cs1 , final CharSequence cs2 ) { } } | if ( cs1 == cs2 ) { return INDEX_NOT_FOUND ; } if ( cs1 == null || cs2 == null ) { return 0 ; } int i ; for ( i = 0 ; i < cs1 . length ( ) && i < cs2 . length ( ) ; ++ i ) { if ( cs1 . charAt ( i ) != cs2 . charAt ( i ) ) { break ; } } if ( i < cs2 . length ( ) || i < cs1 . length ( ) ) { return i ; } return INDEX_NOT_FOUND ; |
public class StreamUtils { /** * Create a { @ link java . util . stream . Stream } over the elements of the iterables , in order . A list of iterators
* is first created from the iterables , and passed to { @ link # stream ( Iterator [ ] ) } . The iterable elements are not
* loaded into memory first . */
@ SafeVarargs @ SuppressWarnings ( "unchecked" ) public static < T > Stream < T > stream ( Iterable < T > ... iterables ) { } } | List < Iterator < T > > iterators = Arrays . stream ( iterables ) . map ( Iterable :: iterator ) . collect ( Collectors . toList ( ) ) ; return stream ( iterators . toArray ( new Iterator [ iterables . length ] ) ) ; |
public class ComponentCollision { /** * Remove point and adjacent points depending of the collidable max collision size .
* @ param x The horizontal location .
* @ param y The vertical location .
* @ param collidable The collidable reference . */
private void removePoints ( double x , double y , Collidable collidable ) { } } | final int minX = ( int ) Math . floor ( x / REDUCE_FACTOR ) ; final int minY = ( int ) Math . floor ( y / REDUCE_FACTOR ) ; final int maxX = ( int ) Math . floor ( ( x + collidable . getMaxWidth ( ) ) / REDUCE_FACTOR ) ; final int maxY = ( int ) Math . floor ( ( y + collidable . getMaxHeight ( ) ) / REDUCE_FACTOR ) ; removePoints ( minX , minY , maxX , maxY , collidable ) ; |
public class Token { /** * This method is deprecated . Please use { @ link # parseToken ( byte [ ] , String ) } instead
* Parse a token string into token object
* @ param token the token string
* @ param secret the secret to decrypt the token string
* @ return a token instance parsed from the string */
@ Deprecated public static Token parseToken ( String secret , String token ) { } } | return parseToken ( secret . getBytes ( Charsets . UTF_8 ) , token ) ; |
public class PossibleMemoryBloat { /** * implements the visitor to reset the opcode stack
* @ param obj
* the context object of the currently parsed code block */
@ Override public void visitCode ( Code obj ) { } } | stack . resetForMethodEntry ( this ) ; userValues . clear ( ) ; jaxbContextRegs . clear ( ) ; if ( Values . STATIC_INITIALIZER . equals ( methodName ) || Values . CONSTRUCTOR . equals ( methodName ) ) { return ; } super . visitCode ( obj ) ; for ( Integer pc : jaxbContextRegs . values ( ) ) { bugReporter . reportBug ( new BugInstance ( this , BugType . PMB_LOCAL_BASED_JAXB_CONTEXT . name ( ) , "<clinit>" . equals ( getMethodName ( ) ) ? LOW_PRIORITY : NORMAL_PRIORITY ) . addClass ( this ) . addMethod ( this ) . addSourceLine ( this , pc . intValue ( ) ) ) ; } |
public class ListTranscriptionJobsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListTranscriptionJobsRequest listTranscriptionJobsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listTranscriptionJobsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listTranscriptionJobsRequest . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( listTranscriptionJobsRequest . getJobNameContains ( ) , JOBNAMECONTAINS_BINDING ) ; protocolMarshaller . marshall ( listTranscriptionJobsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listTranscriptionJobsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ExpressionEvaluator { /** * Expression evaluator for lang ( ) function */
private Term evalLang ( Function term ) { } } | Term innerTerm = term . getTerm ( 0 ) ; // Create a default return constant : blank language with literal type .
// TODO : avoid this constant wrapping thing
Function emptyString = termFactory . getTypedTerm ( termFactory . getConstantLiteral ( "" , XSD . STRING ) , XSD . STRING ) ; if ( innerTerm instanceof Variable ) { return term ; } /* * TODO : consider the case of constants */
if ( ! ( innerTerm instanceof Function ) ) { return emptyString ; } Function function = ( Function ) innerTerm ; if ( ! function . isDataTypeFunction ( ) ) { return null ; } Predicate predicate = function . getFunctionSymbol ( ) ; if ( predicate instanceof DatatypePredicate ) { RDFDatatype datatype = ( ( DatatypePredicate ) predicate ) . getReturnedType ( ) ; return datatype . getLanguageTag ( ) // TODO : avoid this constant wrapping thing
. map ( tag -> termFactory . getTypedTerm ( termFactory . getConstantLiteral ( tag . getFullString ( ) , XSD . STRING ) , XSD . STRING ) ) . orElse ( emptyString ) ; } return term ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Agent } { @ code > } } */
@ XmlElementDecl ( namespace = PROV_NS , name = "agent" ) public JAXBElement < Agent > createAgent ( Agent value ) { } } | return new JAXBElement < Agent > ( _Agent_QNAME , Agent . class , null , value ) ; |
public class LoadBalancerProbesInner { /** * Gets load balancer probe .
* @ param resourceGroupName The name of the resource group .
* @ param loadBalancerName The name of the load balancer .
* @ param probeName The name of the probe .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ProbeInner object */
public Observable < ProbeInner > getAsync ( String resourceGroupName , String loadBalancerName , String probeName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , loadBalancerName , probeName ) . map ( new Func1 < ServiceResponse < ProbeInner > , ProbeInner > ( ) { @ Override public ProbeInner call ( ServiceResponse < ProbeInner > response ) { return response . body ( ) ; } } ) ; |
public class InfluxDBResultMapper { /** * Process a { @ link QueryResult } object returned by the InfluxDB client inspecting the internal
* data structure and creating the respective object instances based on the Class passed as
* parameter .
* @ param queryResult the InfluxDB result object
* @ param clazz the Class that will be used to hold your measurement data
* @ param < T > the target type
* @ return a { @ link List } of objects from the same Class passed as parameter and sorted on the
* same order as received from InfluxDB .
* @ throws InfluxDBMapperException If { @ link QueryResult } parameter contain errors ,
* < code > clazz < / code > parameter is not annotated with & # 64 ; Measurement or it was not
* possible to define the values of your POJO ( e . g . due to an unsupported field type ) . */
public < T > List < T > toPOJO ( final QueryResult queryResult , final Class < T > clazz ) throws InfluxDBMapperException { } } | return toPOJO ( queryResult , clazz , TimeUnit . MILLISECONDS ) ; |
public class CropDimension { /** * Get crop dimension from crop string .
* Please note : Crop string contains not width / height as 3rd / 4th parameter but right , bottom .
* @ param cropString Cropping string from CQ5 smartimage widget
* @ return Crop dimension instance
* @ throws IllegalArgumentException if crop string syntax is invalid */
public static @ NotNull CropDimension fromCropString ( @ NotNull String cropString ) { } } | if ( StringUtils . isEmpty ( cropString ) ) { throw new IllegalArgumentException ( "Invalid crop string: '" + cropString + "'." ) ; } // strip off optional size parameter after " / "
String crop = cropString ; if ( StringUtils . contains ( crop , "/" ) ) { crop = StringUtils . substringBefore ( crop , "/" ) ; } String [ ] parts = StringUtils . split ( crop , "," ) ; if ( parts . length != 4 ) { throw new IllegalArgumentException ( "Invalid crop string: '" + cropString + "'." ) ; } long x1 = NumberUtils . toLong ( parts [ 0 ] ) ; long y1 = NumberUtils . toLong ( parts [ 1 ] ) ; long x2 = NumberUtils . toLong ( parts [ 2 ] ) ; long y2 = NumberUtils . toLong ( parts [ 3 ] ) ; long width = x2 - x1 ; long height = y2 - y1 ; if ( x1 < 0 || y1 < 0 || width <= 0 || height <= 0 ) { throw new IllegalArgumentException ( "Invalid crop string: '" + cropString + "'." ) ; } return new CropDimension ( x1 , y1 , width , height ) ; |
public class ComputationGraph { /** * Return the input size ( number of inputs ) for the specified layer . < br >
* Note that the meaning of the " input size " can depend on the type of layer . For example : < br >
* - DenseLayer , OutputLayer , etc : the feature vector size ( nIn configuration option ) < br >
* - Recurrent layers : the feature vector size < i > per time step < / i > ( nIn configuration option ) < br >
* - ConvolutionLayer : the channels ( number of channels ) < br >
* - Subsampling layers , global pooling layers , etc : size of 0 is always returned < br >
* @ param layerName Name of the layer to get the size of
* @ return Size of the layer */
public int layerInputSize ( String layerName ) { } } | Layer l = getLayer ( layerName ) ; if ( l == null ) { throw new IllegalArgumentException ( "No layer with name \"" + layerName + "\" exists" ) ; } org . deeplearning4j . nn . conf . layers . Layer conf = l . conf ( ) . getLayer ( ) ; if ( conf == null || ! ( conf instanceof FeedForwardLayer ) ) { return 0 ; } FeedForwardLayer ffl = ( FeedForwardLayer ) conf ; // FIXME : int cast
return ( int ) ffl . getNIn ( ) ; |
public class JKIOUtil { /** * Write data to temp file .
* @ param data String
* @ param ext the ext
* @ return File */
public static File writeDataToTempFile ( final String data , final String ext ) { } } | try { final File file = createTempFile ( ext ) ; final PrintWriter out = new PrintWriter ( new FileOutputStream ( file ) ) ; out . print ( data ) ; // out . flush ( ) ;
out . close ( ) ; // file . deleteOnExit ( ) ;
return file ; } catch ( IOException e ) { JKExceptionUtil . handle ( e ) ; return null ; } |
public class ReceiveMessageActionParser { /** * Adds information about the validation of the message against a certain schema to the context
* @ param messageElement The message element to get the configuration from
* @ param context The context to set the schema validation configuration to */
private void addSchemaInformationToValidationContext ( Element messageElement , SchemaValidationContext context ) { } } | String schemaValidation = messageElement . getAttribute ( "schema-validation" ) ; if ( StringUtils . hasText ( schemaValidation ) ) { context . setSchemaValidation ( Boolean . valueOf ( schemaValidation ) ) ; } String schema = messageElement . getAttribute ( "schema" ) ; if ( StringUtils . hasText ( schema ) ) { context . setSchema ( schema ) ; } String schemaRepository = messageElement . getAttribute ( "schema-repository" ) ; if ( StringUtils . hasText ( schemaRepository ) ) { context . setSchemaRepository ( schemaRepository ) ; } |
public class CXFEndpointProvider { /** * Maps a transportId to its corresponding TransportType .
* @ param transportId
* @ return */
private static TransportType map2TransportType ( String transportId ) { } } | TransportType type ; if ( CXF_HTTP_TRANSPORT_ID . equals ( transportId ) || SOAP_HTTP_TRANSPORT_ID . equals ( transportId ) ) { type = TransportType . HTTP ; } else { type = TransportType . OTHER ; } return type ; |
public class UserPoolDescriptionTypeMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UserPoolDescriptionType userPoolDescriptionType , ProtocolMarshaller protocolMarshaller ) { } } | if ( userPoolDescriptionType == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( userPoolDescriptionType . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( userPoolDescriptionType . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( userPoolDescriptionType . getLambdaConfig ( ) , LAMBDACONFIG_BINDING ) ; protocolMarshaller . marshall ( userPoolDescriptionType . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( userPoolDescriptionType . getLastModifiedDate ( ) , LASTMODIFIEDDATE_BINDING ) ; protocolMarshaller . marshall ( userPoolDescriptionType . getCreationDate ( ) , CREATIONDATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.