signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class LevenbergMarquardt { /** * / * ( non - Javadoc )
* @ see net . finmath . optimizer . Optimizer # run ( ) */
@ Override public void run ( ) throws SolverException { } } | // Create an executor for concurrent evaluation of derivatives
if ( numberOfThreads > 1 ) { if ( executor == null ) { executor = Executors . newFixedThreadPool ( numberOfThreads ) ; executorShutdownWhenDone = true ; } } try { // Allocate memory
int numberOfParameters = initialParameters . length ; int numberOfValues = targetValues . length ; parameterTest = initialParameters . clone ( ) ; parameterIncrement = new double [ numberOfParameters ] ; parameterCurrent = new double [ numberOfParameters ] ; valueTest = new double [ numberOfValues ] ; valueCurrent = new double [ numberOfValues ] ; derivativeCurrent = new double [ parameterCurrent . length ] [ valueCurrent . length ] ; hessianMatrix = new double [ parameterCurrent . length ] [ parameterCurrent . length ] ; beta = new double [ parameterCurrent . length ] ; iteration = 0 ; while ( true ) { // Count iterations
iteration ++ ; // Calculate values for test parameters
setValues ( parameterTest , valueTest ) ; // Calculate error
double errorMeanSquaredTest = getMeanSquaredError ( valueTest ) ; /* * Note : The following test will be false if errorMeanSquaredTest is NaN .
* That is : NaN is consider as a rejected point . */
if ( errorMeanSquaredTest < errorMeanSquaredCurrent ) { errorRootMeanSquaredChange = Math . sqrt ( errorMeanSquaredCurrent ) - Math . sqrt ( errorMeanSquaredTest ) ; // Accept point
System . arraycopy ( parameterTest , 0 , parameterCurrent , 0 , parameterCurrent . length ) ; System . arraycopy ( valueTest , 0 , valueCurrent , 0 , valueCurrent . length ) ; errorMeanSquaredCurrent = errorMeanSquaredTest ; // Derivative has to be recalculated
isParameterCurrentDerivativeValid = false ; // Decrease lambda ( move faster )
lambda /= lambdaDivisor ; } else { errorRootMeanSquaredChange = Math . sqrt ( errorMeanSquaredTest ) - Math . sqrt ( errorMeanSquaredCurrent ) ; // Reject point , increase lambda ( move slower )
lambda *= lambdaMultiplicator ; } // Update a new parameter trial , if we are not done
if ( ! done ( ) ) { updateParameterTest ( ) ; } else { break ; } // Log iteration
if ( logger . isLoggable ( Level . FINE ) ) { String logString = "Iteration: " + iteration + "\tLambda=" + lambda + "\tError Current:" + errorMeanSquaredCurrent + "\tError Change:" + errorRootMeanSquaredChange + "\t" ; for ( int i = 0 ; i < parameterCurrent . length ; i ++ ) { logString += "[" + i + "] = " + parameterCurrent [ i ] + "\t" ; } logger . fine ( logString ) ; } } } finally { // Shutdown executor if present .
if ( executor != null && executorShutdownWhenDone ) { executor . shutdown ( ) ; executor = null ; } } |
public class AuthenticationApi { /** * Get OpenID user information by access token
* Get information about a user by their OAuth 2 access token .
* @ param authorization The OAuth 2 bearer access token you received from [ / auth / v3 / oauth / token ] ( / reference / authentication / Authentication / index . html # retrieveToken ) . For example : \ & quot ; Authorization : bearer a4b5da75 - a584-4053-9227-0f0ab23ff06e \ & quot ; ( required )
* @ return ApiResponse & lt ; OpenIdUserInfo & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < OpenIdUserInfo > getInfoWithHttpInfo ( String authorization ) throws ApiException { } } | com . squareup . okhttp . Call call = getInfoValidateBeforeCall ( authorization , null , null ) ; Type localVarReturnType = new TypeToken < OpenIdUserInfo > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class Runnables { /** * Returns a wrapped runnable that logs and rethrows uncaught exceptions . */
static Runnable logFailure ( final Runnable runnable , Logger logger ) { } } | return ( ) -> { try { runnable . run ( ) ; } catch ( Throwable t ) { if ( ! ( t instanceof RejectedExecutionException ) ) { logger . error ( "An uncaught exception occurred" , t ) ; } throw t ; } } ; |
public class ValueUtil { /** * Create a string representation repeating a character
* sequence the requested number of times .
* @ param prefix an optional prefix to prepend
* @ param charSequence the character sequence to repeat
* @ param times how many times the character sequence should be repeated
* @ return a string filled with character sequence or empty string */
public static String fill ( final String prefix , final String charSequence , final int times ) { } } | if ( times < 1 ) { return "" ; } StringBuilder sb = new StringBuilder ( ) ; if ( prefix != null ) { sb . append ( prefix ) ; } for ( int i = 0 ; i < times ; i ++ ) { sb . append ( charSequence ) ; } return sb . toString ( ) ; |
public class DERBitString { /** * return a Bit String from the passed in object
* @ exception IllegalArgumentException if the object cannot be converted . */
public static DERBitString getInstance ( Object obj ) { } } | if ( obj == null || obj instanceof DERBitString ) { return ( DERBitString ) obj ; } if ( obj instanceof ASN1OctetString ) { byte [ ] bytes = ( ( ASN1OctetString ) obj ) . getOctets ( ) ; int padBits = bytes [ 0 ] ; byte [ ] data = new byte [ bytes . length - 1 ] ; System . arraycopy ( bytes , 1 , data , 0 , bytes . length - 1 ) ; return new DERBitString ( data , padBits ) ; } if ( obj instanceof ASN1TaggedObject ) { return getInstance ( ( ( ASN1TaggedObject ) obj ) . getObject ( ) ) ; } throw new IllegalArgumentException ( "illegal object in getInstance: " + obj . getClass ( ) . getName ( ) ) ; |
public class TimeBasedRegisteredServiceAccessStrategy { /** * Does starting time allow service access boolean .
* @ return true / false */
protected boolean doesStartingTimeAllowServiceAccess ( ) { } } | if ( this . startingDateTime != null ) { val st = DateTimeUtils . zonedDateTimeOf ( this . startingDateTime ) ; if ( st != null ) { val now = ZonedDateTime . now ( ZoneOffset . UTC ) ; if ( now . isBefore ( st ) ) { LOGGER . warn ( "Service access not allowed because it starts at [{}]. Zoned now is [{}]" , this . startingDateTime , now ) ; return false ; } } else { val stLocal = DateTimeUtils . localDateTimeOf ( this . startingDateTime ) ; if ( stLocal != null ) { val now = LocalDateTime . now ( ZoneOffset . UTC ) ; if ( now . isBefore ( stLocal ) ) { LOGGER . warn ( "Service access not allowed because it starts at [{}]. Local now is [{}]" , this . startingDateTime , now ) ; return false ; } } } } return true ; |
public class Sneaky { /** * Wrap a { @ link CheckedIntFunction } in a { @ link IntFunction } .
* Example :
* < code > < pre >
* IntStream . of ( 1 , 2 , 3 ) . mapToObj ( Unchecked . intFunction ( i - > {
* if ( i & lt ; 0)
* throw new Exception ( " Only positive numbers allowed " ) ;
* return " " + i ;
* < / pre > < / code > */
public static < R > IntFunction < R > intFunction ( CheckedIntFunction < R > function ) { } } | return Unchecked . intFunction ( function , Unchecked . RETHROW_ALL ) ; |
public class OperationProcessor { /** * region Queue Processing */
private CompletableFuture < Void > throttle ( ) { } } | val delay = new AtomicReference < ThrottlerCalculator . DelayResult > ( this . throttlerCalculator . getThrottlingDelay ( ) ) ; if ( ! delay . get ( ) . isMaximum ( ) ) { // We are not delaying the maximum amount . We only need to do this once .
return throttleOnce ( delay . get ( ) . getDurationMillis ( ) , delay . get ( ) . isMaximum ( ) ) ; } else { // The initial delay calculation indicated that we need to throttle to the maximum , which means there ' s
// significant pressure . In order to protect downstream components , we need to run in a loop and delay as much
// as needed until the pressure is relieved .
return Futures . loop ( ( ) -> ! delay . get ( ) . isMaximum ( ) , ( ) -> throttleOnce ( delay . get ( ) . getDurationMillis ( ) , delay . get ( ) . isMaximum ( ) ) . thenRun ( ( ) -> delay . set ( this . throttlerCalculator . getThrottlingDelay ( ) ) ) , this . executor ) ; } |
public class ResourceFinder { /** * Assumes the class specified points to a directory in the classpath that holds files
* containing the name of a class that implements or is a subclass of the specfied class .
* Any class that cannot be loaded or are not assignable to the specified class will be
* skipped and placed in the ' resourcesNotLoaded ' collection .
* Example classpath :
* META - INF / java . net . URLStreamHandler / jar
* META - INF / java . net . URLStreamHandler / file
* META - INF / java . net . URLStreamHandler / http
* ResourceFinder finder = new ResourceFinder ( " META - INF / " ) ;
* Map map = finder . mapAllImplementations ( java . net . URLStreamHandler . class ) ;
* Class jarUrlHandler = map . get ( " jar " ) ;
* Class fileUrlHandler = map . get ( " file " ) ;
* Class httpUrlHandler = map . get ( " http " ) ;
* @ param interfase a superclass or interface
* @ return
* @ throws IOException if classLoader . getResources throws an exception */
public Map < String , Class > mapAvailableImplementations ( Class interfase ) throws IOException { } } | resourcesNotLoaded . clear ( ) ; Map < String , Class > implementations = new HashMap < > ( ) ; Map < String , String > map = mapAvailableStrings ( interfase . getName ( ) ) ; for ( Iterator iterator = map . entrySet ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) iterator . next ( ) ; String string = ( String ) entry . getKey ( ) ; String className = ( String ) entry . getValue ( ) ; try { Class impl = classLoader . loadClass ( className ) ; if ( interfase . isAssignableFrom ( impl ) ) { implementations . put ( string , impl ) ; } else { resourcesNotLoaded . add ( className ) ; } } catch ( Exception notAvailable ) { resourcesNotLoaded . add ( className ) ; } } return implementations ; |
public class RaidNode { /** * Get the job id from the configuration */
public static String getJobID ( Configuration conf ) { } } | String jobId = conf . get ( "mapred.job.id" , null ) ; if ( jobId == null ) { jobId = "localRaid" + df . format ( new Date ( ) ) ; conf . set ( "mapred.job.id" , jobId ) ; } return jobId ; |
public class GraphUtils { /** * Fetch all of the dependents of the given target vertex
* @ return mutable snapshot of the source vertices of all incoming edges */
public static < V > Set < V > getIncomingVertices ( DirectedGraph < V , DefaultEdge > graph , V target ) { } } | Set < DefaultEdge > edges = graph . incomingEdgesOf ( target ) ; Set < V > sources = new LinkedHashSet < V > ( ) ; for ( DefaultEdge edge : edges ) { sources . add ( graph . getEdgeSource ( edge ) ) ; } return sources ; |
public class JdbcRow { /** * Returns the column as a String .
* @ param index 1 - based
* @ return column as a String */
public String getString ( int index ) { } } | Object value = _values [ index - 1 ] ; if ( value != null ) { return value . toString ( ) ; } else { return null ; } |
public class DateUtils { /** * Formats the specified date as an RFC 822 string .
* @ param date
* The date to format .
* @ return The RFC 822 string representing the specified date . */
public static String formatRFC822Date ( Date date ) { } } | try { return rfc822DateFormat . print ( date . getTime ( ) ) ; } catch ( RuntimeException ex ) { throw handleException ( ex ) ; } |
public class Utils { /** * Return the number of invalid characters in sequence .
* @ param sequence
* protein sequence to count for invalid characters .
* @ param cSet
* the set of characters that are deemed valid .
* @ param ignoreCase
* indicates if cases should be ignored
* @ return
* the number of invalid characters in sequence . */
public final static int getNumberOfInvalidChar ( String sequence , Set < Character > cSet , boolean ignoreCase ) { } } | int total = 0 ; char [ ] cArray ; if ( ignoreCase ) cArray = sequence . toUpperCase ( ) . toCharArray ( ) ; else cArray = sequence . toCharArray ( ) ; if ( cSet == null ) cSet = PeptideProperties . standardAASet ; for ( char c : cArray ) { if ( ! cSet . contains ( c ) ) total ++ ; } return total ; |
public class LinkedBlockingQueue { /** * Signals a waiting put . Called only from take / poll . */
private void signalNotFull ( ) { } } | final ReentrantLock putLock = this . putLock ; putLock . lock ( ) ; try { notFull . signal ( ) ; } finally { putLock . unlock ( ) ; } |
public class AWSIotClient { /** * Updates a Device Defender security profile .
* @ param updateSecurityProfileRequest
* @ return Result of the UpdateSecurityProfile operation returned by the service .
* @ throws InvalidRequestException
* The request is not valid .
* @ throws ResourceNotFoundException
* The specified resource does not exist .
* @ throws VersionConflictException
* An exception thrown when the version of an entity specified with the < code > expectedVersion < / code >
* parameter does not match the latest version in the system .
* @ throws ThrottlingException
* The rate exceeds the limit .
* @ throws InternalFailureException
* An unexpected error has occurred .
* @ sample AWSIot . UpdateSecurityProfile */
@ Override public UpdateSecurityProfileResult updateSecurityProfile ( UpdateSecurityProfileRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateSecurityProfile ( request ) ; |
public class Lexer { /** * Throws an exception if the current token is not an identifier . Otherwise ,
* returns the identifier string and moves to the next token .
* @ return the string value of the current token */
public String eatId ( ) { } } | if ( ! matchId ( ) ) throw new BadSyntaxException ( ) ; String s = tok . sval ; nextToken ( ) ; return s ; |
public class AhrefPageURLParser { /** * Get all ahref links within this page response .
* @ param theResponse the response from the request to this page
* @ return the urls . */
public Set < CrawlerURL > get ( HTMLPageResponse theResponse ) { } } | final String url = theResponse . getUrl ( ) ; Set < CrawlerURL > ahrefs = new HashSet < CrawlerURL > ( ) ; // only populate if we have a valid response , else return empty set
if ( theResponse . getResponseCode ( ) == HttpStatus . SC_OK ) { ahrefs = fetch ( AHREF , ABS_HREF , theResponse . getBody ( ) , url ) ; } return ahrefs ; |
public class X509CertImpl { /** * Gets the notBefore date from the validity period of the certificate .
* @ return the start date of the validity period . */
public Date getNotBefore ( ) { } } | if ( info == null ) return null ; try { Date d = ( Date ) info . get ( CertificateValidity . NAME + DOT + CertificateValidity . NOT_BEFORE ) ; return d ; } catch ( Exception e ) { return null ; } |
public class ResourceGroovyMethods { /** * Create a new ObjectInputStream for this file and pass it to the closure .
* This method ensures the stream is closed after the closure returns .
* @ param file a File
* @ param closure a closure
* @ return the value returned by the closure
* @ throws IOException if an IOException occurs .
* @ see IOGroovyMethods # withStream ( java . io . InputStream , groovy . lang . Closure )
* @ since 1.5.2 */
public static < T > T withObjectInputStream ( File file , @ ClosureParams ( value = SimpleType . class , options = "java.io.ObjectInputStream" ) Closure < T > closure ) throws IOException { } } | return IOGroovyMethods . withStream ( newObjectInputStream ( file ) , closure ) ; |
public class LocalWorkspaceDataManagerStub { /** * { @ inheritDoc } */
@ Override public List < NodeData > getChildNodesData ( NodeData nodeData ) throws RepositoryException { } } | return Collections . unmodifiableList ( super . getChildNodesData ( nodeData ) ) ; |
public class SimpleMessageFormatter { /** * Formats a log message which contains placeholders ( i . e . when a template context exists ) . This
* does not format only metadata , only the message and its arguments . */
private static StringBuilder formatMessage ( LogData logData ) { } } | SimpleMessageFormatter formatter = new SimpleMessageFormatter ( logData . getTemplateContext ( ) , logData . getArguments ( ) ) ; StringBuilder out = formatter . build ( ) ; if ( logData . getArguments ( ) . length > formatter . getExpectedArgumentCount ( ) ) { // TODO ( dbeaumont ) : Do better and look at adding formatted values or maybe just a count ?
out . append ( EXTRA_ARGUMENT_MESSAGE ) ; } return out ; |
public class PortletDescriptorImpl { /** * If not already created , a new < code > user - attribute < / code > element will be created and returned .
* Otherwise , the first existing < code > user - attribute < / code > element will be returned .
* @ return the instance defined for the element < code > user - attribute < / code > */
public UserAttributeType < PortletDescriptor > getOrCreateUserAttribute ( ) { } } | List < Node > nodeList = model . get ( "user-attribute" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new UserAttributeTypeImpl < PortletDescriptor > ( this , "user-attribute" , model , nodeList . get ( 0 ) ) ; } return createUserAttribute ( ) ; |
public class MinHash { /** * Create a target data which has analyzer , text and the number of bits .
* @ param analyzer
* @ param text
* @ param numOfBits
* @ return */
public static Data newData ( final Analyzer analyzer , final String text , final int numOfBits ) { } } | return new Data ( analyzer , text , numOfBits ) ; |
public class BaseRichMediaStudioCreative { /** * Sets the creativeFormat value for this BaseRichMediaStudioCreative .
* @ param creativeFormat * The creative format of the Rich Media Studio creative . This
* attribute is readonly . */
public void setCreativeFormat ( com . google . api . ads . admanager . axis . v201902 . RichMediaStudioCreativeFormat creativeFormat ) { } } | this . creativeFormat = creativeFormat ; |
public class RedBlackTree { /** * delete the key - value pair with the maximum key rooted at h */
private RedBlackTreeNode < Key , Value > deleteMax ( RedBlackTreeNode < Key , Value > h ) { } } | if ( isRed ( h . getLeft ( ) ) ) h = rotateRight ( h ) ; if ( h . getRight ( ) == null ) return null ; if ( ! isRed ( h . getRight ( ) ) && ! isRed ( h . getRight ( ) . getLeft ( ) ) ) h = moveRedRight ( h ) ; h . setRight ( deleteMax ( h . getRight ( ) ) ) ; return balance ( h ) ; |
public class VariantAggregatedStatsCalculator { /** * returns in alleles [ ] the genotype specified in index in the sequence :
* 0/0 , 0/1 , 1/1 , 0/2 , 1/2 , 2/2 , 0/3 . . .
* @ param index in this sequence , starting in 0
* @ param alleles returned genotype . */
public static void getGenotype ( int index , Integer alleles [ ] ) { } } | // index + + ;
// double value = ( - 3 + Math . sqrt ( 1 + 8 * index ) ) / 2 ; / / slower than the iterating version , right ?
// alleles [ 1 ] = new Double ( Math . ceil ( value ) ) . intValue ( ) ;
// alleles [ 0 ] = alleles [ 1 ] - ( ( alleles [ 1 ] + 1 ) * ( alleles [ 1 ] + 2 ) / 2 - index ) ;
int cursor = 0 ; final int MAX_ALLOWED_ALLELES = 100 ; // should we allow more than 100 alleles ?
for ( int i = 0 ; i < MAX_ALLOWED_ALLELES ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) { if ( cursor == index ) { alleles [ 0 ] = j ; alleles [ 1 ] = i ; return ; } cursor ++ ; } } |
public class TasksInner { /** * Get the properties of a specified task .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param taskName The name of the container registry task .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the TaskInner object */
public Observable < TaskInner > getAsync ( String resourceGroupName , String registryName , String taskName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , registryName , taskName ) . map ( new Func1 < ServiceResponse < TaskInner > , TaskInner > ( ) { @ Override public TaskInner call ( ServiceResponse < TaskInner > response ) { return response . body ( ) ; } } ) ; |
public class ClassUtils { /** * Returns a list of class fields . Supports inheritance and doesn ' t return synthetic fields .
* @ param beanClass class to be searched for
* @ return a list of found fields */
public static List < Field > getClassFields ( Class < ? > beanClass ) { } } | Map < String , Field > resultMap = new HashMap < > ( ) ; LinkedList < Field > results = new LinkedList < > ( ) ; Class < ? > currentClass = beanClass ; while ( currentClass != null && currentClass != Object . class ) { for ( Field field : currentClass . getDeclaredFields ( ) ) { if ( ! field . isSynthetic ( ) ) { Field v = resultMap . get ( field . getName ( ) ) ; if ( v == null ) { resultMap . put ( field . getName ( ) , field ) ; results . add ( field ) ; } } } currentClass = currentClass . getSuperclass ( ) ; } return results ; |
public class Vector3i { /** * / * ( non - Javadoc )
* @ see org . joml . Vector3ic # mul ( int , org . joml . Vector3i ) */
public Vector3i mul ( int scalar , Vector3i dest ) { } } | dest . x = x * scalar ; dest . y = y * scalar ; dest . z = z * scalar ; return dest ; |
public class Mapper1_0 { /** * / * ( non - Javadoc )
* @ see com . att . authz . certman . mapper . Mapper # toReq ( com . att . authz . env . AuthzTrans , java . lang . Object ) */
@ Override public Result < CertReq > toReq ( AuthzTrans trans , BaseRequest req ) { } } | CertificateRequest in ; try { in = ( CertificateRequest ) req ; } catch ( ClassCastException e ) { return Result . err ( Result . ERR_BadData , "Request is not a CertificateRequest" ) ; } CertReq out = new CertReq ( ) ; Validator v = new Validator ( ) ; if ( v . isNull ( "CertRequest" , req ) . nullOrBlank ( "MechID" , out . mechid = in . getMechid ( ) ) . nullBlankMin ( "FQDNs" , out . fqdns = in . getFqdns ( ) , 1 ) . err ( ) ) { return Result . err ( Result . ERR_BadData , v . errs ( ) ) ; } out . emails = in . getEmail ( ) ; out . sponsor = in . getSponsor ( ) ; out . start = in . getStart ( ) ; out . end = in . getEnd ( ) ; return Result . ok ( out ) ; |
public class RedisClient { /** * Get the object represented by the given serialized bytes . */
protected Object jsonDeserialize ( byte [ ] in , Class < ? > cls ) { } } | if ( in == null || in . length == 0 ) { return null ; } Object res = null ; try { res = JsonUtils . json2Object ( new String ( in , "utf-8" ) , cls ) ; } catch ( UnsupportedEncodingException e ) { logger . error ( "DeSerialize object fail " , e ) ; } return res ; |
public class AbstractRemoteClient { /** * Method reinitialize this remote . If the remote was previously active the activation state will be recovered .
* This method can be used in case of a broken connection or if the participant config has been changed .
* Note : After reinit the data remains the same but a new sync task is created . So to make sure to have new data
* it is necessary to call { @ code requestData . get ( ) } .
* @ param scope the new scope to configure .
* @ throws InterruptedException is thrown if the current thread was externally interrupted .
* @ throws CouldNotPerformException is throws if the reinit has been failed . */
protected void reinit ( final Scope scope ) throws InterruptedException , CouldNotPerformException { } } | // to not reinit if shutdown is in progress !
if ( shutdownInitiated ) { return ; } final StackTraceElement [ ] stackTraceElement = Thread . currentThread ( ) . getStackTrace ( ) ; try { synchronized ( maintainerLock ) { reinitStackTraces . add ( stackTraceElement ) ; try { if ( reinitStackTraces . size ( ) > 1 ) { for ( final StackTraceElement [ ] trace : reinitStackTraces ) { StackTracePrinter . printStackTrace ( "Duplicated reinit call by:" , trace , logger , LogLevel . WARN ) ; } throw new FatalImplementationErrorException ( "Duplicated reinit detected!" , this ) ; } logger . debug ( "Reinit " + this ) ; // temporally unlock this remove but save maintainer
final Object currentMaintainer = maintainer ; try { maintainer = null ; // reinit remote
internalInit ( scope , RSBSharedConnectionConfig . getParticipantConfig ( ) ) ; } catch ( final CouldNotPerformException ex ) { throw new CouldNotPerformException ( "Could not reinit " + this + "!" , ex ) ; } finally { // restore maintainer
maintainer = currentMaintainer ; } } finally { reinitStackTraces . remove ( stackTraceElement ) ; } } } catch ( final CouldNotPerformException ex ) { throw new CouldNotPerformException ( "Could not reinitialize " + this + "!" , ex ) ; } |
public class DoubleValueData { /** * { @ inheritDoc } */
@ Override protected Calendar getDate ( ) { } } | Calendar calendar = Calendar . getInstance ( ) ; calendar . setTimeInMillis ( new Double ( value ) . longValue ( ) ) ; return calendar ; |
public class InternalSimpleAntlrParser { /** * InternalSimpleAntlr . g : 1077:1 : entryRuleNotExpression returns [ EObject current = null ] : iv _ ruleNotExpression = ruleNotExpression EOF ; */
public final EObject entryRuleNotExpression ( ) throws RecognitionException { } } | EObject current = null ; EObject iv_ruleNotExpression = null ; try { // InternalSimpleAntlr . g : 1078:2 : ( iv _ ruleNotExpression = ruleNotExpression EOF )
// InternalSimpleAntlr . g : 1079:2 : iv _ ruleNotExpression = ruleNotExpression EOF
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getNotExpressionRule ( ) ) ; } pushFollow ( FOLLOW_1 ) ; iv_ruleNotExpression = ruleNotExpression ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = iv_ruleNotExpression ; } match ( input , EOF , FOLLOW_2 ) ; if ( state . failed ) return current ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class ChannelDeserializer { /** * endregion */
@ Override protected void produce ( AsyncProduceController async ) { } } | async . begin ( ) ; ByteBuf firstBuf ; while ( isReceiverReady ( ) && ( firstBuf = queue . peekBuf ( ) ) != null ) { int dataSize ; int headerSize ; int size ; int firstBufRemaining = firstBuf . readRemaining ( ) ; if ( firstBufRemaining >= 3 ) { byte [ ] array = firstBuf . array ( ) ; int pos = firstBuf . head ( ) ; byte b = array [ pos ] ; if ( b >= 0 ) { dataSize = b ; headerSize = 1 ; } else { dataSize = b & 0x7f ; b = array [ pos + 1 ] ; if ( b >= 0 ) { dataSize += ( b << 7 ) ; headerSize = 2 ; } else { dataSize += ( ( b & 0x7f ) << 7 ) ; b = array [ pos + 2 ] ; if ( b >= 0 ) { dataSize += ( b << 14 ) ; headerSize = 3 ; } else throw new IllegalArgumentException ( "Invalid header size" ) ; } } size = headerSize + dataSize ; if ( firstBufRemaining >= size ) { T item = valueSerializer . decode ( array , pos + headerSize ) ; send ( item ) ; if ( firstBufRemaining != size ) { firstBuf . moveHead ( size ) ; } else { queue . take ( ) . recycle ( ) ; } continue ; } } else { byte b = queue . peekByte ( ) ; if ( b >= 0 ) { dataSize = b ; headerSize = 1 ; } else if ( queue . hasRemainingBytes ( 2 ) ) { dataSize = b & 0x7f ; b = queue . peekByte ( 1 ) ; if ( b >= 0 ) { dataSize += ( b << 7 ) ; headerSize = 2 ; } else if ( queue . hasRemainingBytes ( 3 ) ) { dataSize += ( ( b & 0x7f ) << 7 ) ; b = queue . peekByte ( 2 ) ; if ( b >= 0 ) { dataSize += ( b << 14 ) ; headerSize = 3 ; } else throw new IllegalArgumentException ( "Invalid header size" ) ; } else { break ; } } else { break ; } size = headerSize + dataSize ; } if ( ! queue . hasRemainingBytes ( size ) ) break ; queue . consume ( size , buf -> { T item = valueSerializer . decode ( buf . array ( ) , buf . head ( ) + headerSize ) ; send ( item ) ; } ) ; } if ( isReceiverReady ( ) ) { input . get ( ) . whenResult ( buf -> { if ( buf != null ) { queue . add ( buf ) ; async . resume ( ) ; } else { if ( queue . isEmpty ( ) ) { sendEndOfStream ( ) ; } else { close ( new TruncatedDataException ( ChannelDeserializer . class , format ( "Truncated serialized data stream, %s : %s" , this , queue ) ) ) ; } } } ) . whenException ( this :: close ) ; } else { async . end ( ) ; } |
public class XWikiSyntaxChainingRenderer { /** * { @ inheritDoc }
* @ since 1.6M2 */
@ Override public void beginDefinitionTerm ( ) { } } | if ( getBlockState ( ) . getDefinitionListItemIndex ( ) > 0 ) { getPrinter ( ) . print ( "\n" ) ; } if ( this . listStyle . length ( ) > 0 ) { print ( this . listStyle . toString ( ) ) ; if ( this . listStyle . charAt ( 0 ) == '1' ) { print ( "." ) ; } } print ( StringUtils . repeat ( ':' , getBlockState ( ) . getDefinitionListDepth ( ) - 1 ) ) ; print ( "; " ) ; |
public class LogRepositoryComponent { /** * Sets memory destination for trace messages .
* @ param location the base directory to use for trace file repository when in - memory records are dumped to the disk . Value ' null ' means
* to keep using current directory .
* @ param maxSize the maximum size of the in - memory buffer in bytes . */
public static synchronized void setTraceMemoryDestination ( String location , long maxSize ) { } } | LogRepositoryWriter old = getBinaryHandler ( ) . getTraceWriter ( ) ; LogRepositoryWriterCBuffImpl writer ; // Check if trace writer need to be changed .
if ( location == null && old instanceof LogRepositoryWriterCBuffImpl ) { writer = ( LogRepositoryWriterCBuffImpl ) old ; } else { // Get the repository manager to use for the dump writer .
LogRepositoryManager manager = null ; if ( location == null && old != null ) { manager = old . getLogRepositoryManager ( ) ; } else if ( location != null ) { if ( svSuperPid != null ) manager = new LogRepositorySubManagerImpl ( new File ( location , LogRepositoryManagerImpl . TRACE_LOCATION ) , svPid , svLabel , svSuperPid ) ; else manager = new LogRepositoryManagerImpl ( new File ( location , LogRepositoryManagerImpl . TRACE_LOCATION ) , svPid , svLabel , true ) ; } if ( manager == null ) { throw new IllegalArgumentException ( "Argument 'location' can't be null if log writer was not setup by this class." ) ; } writer = new LogRepositoryWriterCBuffImpl ( new LogRepositoryWriterImpl ( manager ) ) ; } if ( maxSize > 0 ) { ( ( LogRepositoryWriterCBuffImpl ) writer ) . setMaxSize ( maxSize ) ; } else { // Stop new writer before throwing exception .
if ( old != writer ) { writer . stop ( ) ; } throw new IllegalArgumentException ( "Argument 'maxSize' should be more than zero" ) ; } // Stop old manager only after successful configuration of the new writer .
if ( old != null ) { LogRepositoryManager oldManager = old . getLogRepositoryManager ( ) ; if ( oldManager != null && oldManager != writer . getLogRepositoryManager ( ) ) { // Stop old writer before stopping its manager
if ( old != writer ) { old . stop ( ) ; } oldManager . stop ( ) ; } } // Update writer as a last call after all data verification is done .
getBinaryHandler ( ) . setTraceWriter ( writer ) ; |
public class SparseVector { /** * Add other vector . */
void add_vector ( SparseVector vec ) { } } | for ( Map . Entry < Integer , Double > entry : vec . entrySet ( ) ) { Double v = get ( entry . getKey ( ) ) ; if ( v == null ) v = 0. ; put ( entry . getKey ( ) , v + entry . getValue ( ) ) ; } |
public class ModuleRoles { /** * Create a new role .
* This method will override the configuration specified through
* { @ link CMAClient . Builder # setSpaceId ( String ) } and will ignore
* { @ link CMAClient . Builder # setEnvironmentId ( String ) } .
* @ param spaceId the space id to host the role .
* @ param role the new role to be created .
* @ return the newly created role .
* @ throws IllegalArgumentException if space id is null .
* @ throws IllegalArgumentException if role is null . */
public CMARole create ( String spaceId , CMARole role ) { } } | assertNotNull ( spaceId , "spaceId" ) ; assertNotNull ( role , "role" ) ; final CMASystem sys = role . getSystem ( ) ; role . setSystem ( null ) ; try { return service . create ( spaceId , role ) . blockingFirst ( ) ; } finally { role . setSystem ( sys ) ; } |
public class OgnlFactory { /** * Get an OGNL Evaluator for a particular expression with a given input
* @ param root
* an example instance of the root object that will be passed to this OGNL evaluator
* @ param expression
* the OGNL expression
* @ return
* @ see < a href = " https : / / commons . apache . org / proper / commons - ognl / language - guide . html " > OGNL Language Guide < / a > */
public static OgnlEvaluator getInstance ( final Object root , final String expression ) { } } | final OgnlEvaluatorCollection collection = INSTANCE . getEvaluators ( getRootClass ( root ) ) ; return collection . get ( expression ) ; |
public class NNDescent { /** * Process new neighbors .
* This is a complex join , because we do not need to join old neighbors with
* old neighbors , and we have forward - and reverse neighbors each .
* @ param flag Flags to mark new neighbors .
* @ param newFwd New forward neighbors
* @ param oldFwd Old forward neighbors
* @ param newRev New reverse neighbors
* @ param oldRev Old reverse neighbors
* @ return Number of new neighbors */
private int processNewNeighbors ( WritableDataStore < HashSetModifiableDBIDs > flag , HashSetModifiableDBIDs newFwd , HashSetModifiableDBIDs oldFwd , HashSetModifiableDBIDs newRev , HashSetModifiableDBIDs oldRev ) { } } | int counter = 0 ; // nn _ new
if ( ! newFwd . isEmpty ( ) ) { for ( DBIDIter sniter = newFwd . iter ( ) ; sniter . valid ( ) ; sniter . advance ( ) ) { // nn _ new X nn _ new
for ( DBIDIter niter2 = newFwd . iter ( ) ; niter2 . valid ( ) ; niter2 . advance ( ) ) { if ( DBIDUtil . compare ( sniter , niter2 ) < 0 ) { // Only x < y .
addpair ( flag , sniter , niter2 ) ; counter ++ ; } } // nn _ new X nn _ old
for ( DBIDMIter niter2 = oldFwd . iter ( ) ; niter2 . valid ( ) ; niter2 . advance ( ) ) { if ( DBIDUtil . equal ( sniter , niter2 ) ) { continue ; } addpair ( flag , sniter , niter2 ) ; counter ++ ; } } } // rnn _ new
if ( ! newRev . isEmpty ( ) ) { for ( DBIDIter nriter = newRev . iter ( ) ; nriter . valid ( ) ; nriter . advance ( ) ) { // rnn _ new X rnn _ new
for ( DBIDIter niter2 = newRev . iter ( ) ; niter2 . valid ( ) ; niter2 . advance ( ) ) { if ( DBIDUtil . compare ( nriter , niter2 ) < 0 ) { // Only x < y
addpair ( flag , nriter , niter2 ) ; counter ++ ; } } // rnn _ new X rnn _ old
for ( DBIDIter niter2 = oldRev . iter ( ) ; niter2 . valid ( ) ; niter2 . advance ( ) ) { if ( DBIDUtil . equal ( nriter , niter2 ) ) { continue ; } addpair ( flag , nriter , niter2 ) ; counter ++ ; } } } // nn _ new
if ( ! newFwd . isEmpty ( ) ) { for ( DBIDIter sniter2 = newFwd . iter ( ) ; sniter2 . valid ( ) ; sniter2 . advance ( ) ) { // nn _ new X rnn _ old
for ( DBIDIter niter2 = oldRev . iter ( ) ; niter2 . valid ( ) ; niter2 . advance ( ) ) { if ( ! DBIDUtil . equal ( sniter2 , niter2 ) ) { addpair ( flag , sniter2 , niter2 ) ; counter ++ ; } } // nn _ new X rnn _ new
for ( DBIDIter niter2 = newRev . iter ( ) ; niter2 . valid ( ) ; niter2 . advance ( ) ) { if ( DBIDUtil . compare ( sniter2 , niter2 ) < 0 ) { addpair ( flag , sniter2 , niter2 ) ; counter ++ ; } } } } // nn _ old
if ( ! newRev . isEmpty ( ) && ! oldFwd . isEmpty ( ) ) { for ( DBIDIter niter = oldFwd . iter ( ) ; niter . valid ( ) ; niter . advance ( ) ) { // nn _ old X rnn _ new
for ( DBIDIter niter2 = newRev . iter ( ) ; niter2 . valid ( ) ; niter2 . advance ( ) ) { if ( DBIDUtil . equal ( niter , niter2 ) ) { continue ; } addpair ( flag , niter , niter2 ) ; counter ++ ; } } } return counter ; |
public class AbstractDBOutlier { /** * Runs the algorithm in the timed evaluation part .
* @ param database Database to process
* @ param relation Relation to process
* @ return Outlier result */
public OutlierResult run ( Database database , Relation < O > relation ) { } } | // Run the actual score process
DoubleDataStore dbodscore = computeOutlierScores ( database , relation , d ) ; // Build result representation .
DoubleRelation scoreResult = new MaterializedDoubleRelation ( "Density-Based Outlier Detection" , "db-outlier" , dbodscore , relation . getDBIDs ( ) ) ; OutlierScoreMeta scoreMeta = new ProbabilisticOutlierScore ( ) ; return new OutlierResult ( scoreMeta , scoreResult ) ; |
public class FactoryBuilderSupport { /** * A hook to allow names to be converted into some other object such as a
* QName in XML or ObjectName in JMX .
* @ param methodName the name of the desired method
* @ return the object representing the name */
public Object getName ( String methodName ) { } } | if ( getProxyBuilder ( ) . nameMappingClosure != null ) { return getProxyBuilder ( ) . nameMappingClosure . call ( methodName ) ; } return methodName ; |
public class MapperFactory { /** * Creates a new mapper for the given type .
* @ param type
* the type for which a mapper is to be created
* @ return a mapper that can handle the mapping of given type to / from the Cloud Datastore . */
private Mapper createMapper ( Type type ) { } } | lock . lock ( ) ; try { Mapper mapper = cache . get ( type ) ; if ( mapper != null ) { return mapper ; } if ( type instanceof Class ) { mapper = createMapper ( ( Class < ? > ) type ) ; } else if ( type instanceof ParameterizedType ) { mapper = createMapper ( ( ParameterizedType ) type ) ; } else { throw new IllegalArgumentException ( String . format ( "Type %s is neither a Class nor ParameterizedType" , type ) ) ; } cache . put ( type , mapper ) ; return mapper ; } finally { lock . unlock ( ) ; } |
public class JsMessageImpl { /** * Return a ' safe copy ' of the JsMessage .
* This method must be called by the Message processor during ' receive '
* processing for a pub / sub message . It must be called BEFORE the headers are
* set for the receive . The Message Processor should then return this
* ' copy ' to the receiver , which can then make any changes without affecting
* the message in the bus or the copy given to any other receivers .
* Javadoc description supplied by JsMessage interface . */
public final JsMessage getReceived ( ) throws MessageCopyFailedException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getReceived" ) ; /* Now get the JsMessage to return */
JsMessage newMsg = createNew ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getReceived" , newMsg ) ; return newMsg ; |
public class Blog { /** * Create a new post of a given type for this blog
* @ param klass the class of the post to make
* @ param < T > the class of the post to make
* @ return new post
* @ throws IllegalAccessException if class instantiation fails
* @ throws InstantiationException if class instantiation fails */
public < T extends Post > T newPost ( Class < T > klass ) throws IllegalAccessException , InstantiationException { } } | return client . newPost ( name , klass ) ; |
public class SecurityContextInitializer { /** * Initialize and register the contexts for modules that , by default ,
* are initialized with the security context
* @ param context The Security Context to perform initialzation routines */
private static void initializeDefaultModules ( SecurityContext context ) { } } | if ( context . isInitialized ( ) ) { return ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "SecurityContext default module initializer starting" ) ; } String moduleName ; // Loop through the module names
for ( int i = 0 ; i < DEFAULT_MODULES . length ; i ++ ) { moduleName = DEFAULT_MODULES [ i ] ; try { LOGGER . debug ( moduleName + MODULE_INITIALIZER_CLASS ) ; // Get a class instance for the module initializer
Class < ? > clazz = Class . forName ( moduleName + MODULE_INITIALIZER_CLASS ) ; // Get the method instance for the module initializer ' s initialization method
Method method = clazz . getMethod ( MODULE_INITIALIZER_METHOD , ( Class [ ] ) null ) ; // Invoke the initialization method
Object invokeResult = method . invoke ( clazz . newInstance ( ) , ( Object [ ] ) null ) ; // Validate that the result of the initialization is a valid module context
if ( invokeResult instanceof AbstractModuleContext ) { // Register the module context
context . registerModuleContext ( moduleName , ( AbstractModuleContext ) invokeResult ) ; } else { throw new IllegalArgumentException ( "Initializer method did not return correct type" ) ; } if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "SecurityContext module " + moduleName + " initialized" ) ; } } catch ( ClassNotFoundException cnfe ) { LOGGER . warn ( "SecurityContext module " + moduleName + " not found, skipping." ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Stack trace: " , cnfe ) ; } } catch ( NoSuchMethodException nsme ) { LOGGER . warn ( "SecurityContext module " + moduleName + " does not support default initialization, skipping." , nsme ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Stack trace: " , nsme ) ; } } catch ( Throwable t ) { LOGGER . error ( "Error initializing SecurityContext module " + moduleName , t ) ; } finally { } } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "SecurityContext default module initializer ending" ) ; } |
public class CodecUtils { /** * 将一个长度为8的boolean数组 ( 每bit代表一个boolean值 ) 转换为byte
* @ param array boolean数组
* @ return byte */
public static byte booleansToByte ( boolean [ ] array ) { } } | if ( array != null && array . length > 0 ) { byte b = 0 ; for ( int i = 0 ; i <= 7 ; i ++ ) { if ( array [ i ] ) { int nn = ( 1 << ( 7 - i ) ) ; b += nn ; } } return b ; } return 0 ; |
public class BshClassPath { /** * Search Archive for classes .
* @ param the archive file location
* @ return array of class names found
* @ throws IOException */
static String [ ] searchArchiveForClasses ( URL url ) throws IOException { } } | List < String > list = new ArrayList < > ( ) ; ZipInputStream zip = new ZipInputStream ( url . openStream ( ) ) ; ZipEntry ze ; while ( zip . available ( ) == 1 ) if ( ( ze = zip . getNextEntry ( ) ) != null && isClassFileName ( ze . getName ( ) ) ) list . add ( canonicalizeClassName ( ze . getName ( ) ) ) ; zip . close ( ) ; return list . toArray ( new String [ list . size ( ) ] ) ; |
public class HostParser { /** * Accepts a comma separated list of host / ports .
* For example
* www . example . com , www2 . example . com : 123 , 192.0.2.1 , 192.0.2.2:123 , 2001 : db8 : : ff00:42:8329 , [ 2001 : db8 : : ff00:42:8329 ] : 123 */
public static Hosts parse ( String hostString , Integer explicitGlobalPort , Integer defaultPort ) { } } | List < String > hosts = new ArrayList < > ( ) ; List < Integer > ports = new ArrayList < > ( ) ; if ( hostString == null || hostString . trim ( ) . isEmpty ( ) ) { return Hosts . NO_HOST ; } // for each element between commas
String [ ] splits = hostString . split ( "," ) ; for ( String rawSplit : splits ) { // remove whitespaces
String split = rawSplit . trim ( ) ; Matcher matcher = HOST_AND_PORT_PATTERN . matcher ( split ) ; if ( matcher . matches ( ) ) { setCleanHost ( matcher , hosts ) ; setPort ( ports , matcher , explicitGlobalPort , splits , defaultPort ) ; } else { throw LOG . unableToParseHost ( hostString ) ; } } return new Hosts ( hosts , ports ) ; |
public class BaseMonetaryCurrenciesSingletonSpi { /** * Allows to check if a { @ link javax . money . CurrencyUnit } instance is
* defined , i . e . accessible from { @ link # getCurrency ( String , String . . . ) } .
* @ param locale the target { @ link java . util . Locale } , not { @ code null } .
* @ param providers the ( optional ) specification of providers to consider . If not set ( empty ) the providers
* as defined by # getDefaultRoundingProviderChain ( ) should be used .
* @ return { @ code true } if { @ link # getCurrencies ( java . util . Locale , String . . . ) } would return a
* non empty result for the given code . */
public boolean isCurrencyAvailable ( Locale locale , String ... providers ) { } } | return ! getCurrencies ( CurrencyQueryBuilder . of ( ) . setCountries ( locale ) . setProviderNames ( providers ) . build ( ) ) . isEmpty ( ) ; |
public class RxLifecycle { /** * Binds the given source to a lifecycle .
* When the lifecycle event occurs , the source will cease to emit any notifications .
* @ param lifecycle the lifecycle sequence
* @ param event the event which should conclude notifications from the source
* @ return a reusable { @ link LifecycleTransformer } that unsubscribes the source at the specified event */
@ Nonnull @ CheckReturnValue public static < T , R > LifecycleTransformer < T > bindUntilEvent ( @ Nonnull final Observable < R > lifecycle , @ Nonnull final R event ) { } } | checkNotNull ( lifecycle , "lifecycle == null" ) ; checkNotNull ( event , "event == null" ) ; return bind ( takeUntilEvent ( lifecycle , event ) ) ; |
public class AreaOfInterest { /** * Tests that the area is valid geojson , the style ref is valid or null and the display is non - null . */
public void postConstruct ( ) { } } | parseGeometry ( ) ; Assert . isTrue ( this . polygon != null , "Polygon is null. 'area' string is: '" + this . area + "'" ) ; Assert . isTrue ( this . display != null , "'display' is null" ) ; Assert . isTrue ( this . style == null || this . display == AoiDisplay . RENDER , "'style' does not make sense unless 'display' == RENDER. In this case 'display' == " + this . display ) ; |
public class AttributeSet { /** * Method to get the type from the cache . Searches if not found in the type
* hierarchy .
* @ param _ typeName name of the type
* @ param _ name name of the attribute
* @ return AttributeSet
* @ throws CacheReloadException on error */
public static AttributeSet find ( final String _typeName , final String _name ) throws CacheReloadException { } } | AttributeSet ret = ( AttributeSet ) Type . get ( AttributeSet . evaluateName ( _typeName , _name ) ) ; if ( ret == null ) { if ( Type . get ( _typeName ) . getParentType ( ) != null ) { ret = AttributeSet . find ( Type . get ( _typeName ) . getParentType ( ) . getName ( ) , _name ) ; } } return ret ; |
public class SQLiteConnection { /** * Called by SQLiteConnectionPool only . */
static SQLiteConnection open ( SQLiteConnectionPool pool , SQLiteDatabaseConfiguration configuration , int connectionId , boolean primaryConnection ) { } } | SQLiteConnection connection = new SQLiteConnection ( pool , configuration , connectionId , primaryConnection ) ; try { connection . open ( ) ; return connection ; } catch ( SQLiteException ex ) { connection . dispose ( false ) ; throw ex ; } |
public class SerializationUtil { /** * Writes a nullable { @ link PartitionIdSet } to the given data output .
* @ param partitionIds
* @ param out
* @ throws IOException */
public static void writeNullablePartitionIdSet ( PartitionIdSet partitionIds , ObjectDataOutput out ) throws IOException { } } | if ( partitionIds == null ) { out . writeInt ( - 1 ) ; return ; } out . writeInt ( partitionIds . getPartitionCount ( ) ) ; out . writeInt ( partitionIds . size ( ) ) ; PrimitiveIterator . OfInt intIterator = partitionIds . intIterator ( ) ; while ( intIterator . hasNext ( ) ) { out . writeInt ( intIterator . nextInt ( ) ) ; } |
public class DeleteTapeRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteTapeRequest deleteTapeRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteTapeRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteTapeRequest . getGatewayARN ( ) , GATEWAYARN_BINDING ) ; protocolMarshaller . marshall ( deleteTapeRequest . getTapeARN ( ) , TAPEARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MolecularFormulaManipulator { /** * Get a list of all Elements which are contained
* molecular .
* @ param formula The MolecularFormula to check
* @ return The list with the IElements in this molecular formula */
public static List < IElement > elements ( IMolecularFormula formula ) { } } | List < IElement > elementList = new ArrayList < IElement > ( ) ; List < String > stringList = new ArrayList < String > ( ) ; for ( IIsotope isotope : formula . isotopes ( ) ) { if ( ! stringList . contains ( isotope . getSymbol ( ) ) ) { elementList . add ( isotope ) ; stringList . add ( isotope . getSymbol ( ) ) ; } } return elementList ; |
public class AbstractApitraryClient { /** * doPost .
* @ param request
* a { @ link com . apitrary . api . request . Request } object .
* @ param < T >
* a T object .
* @ return a { @ link com . apitrary . api . response . Response } object . */
protected < T > Response < T > doPost ( Request < T > request ) { } } | String payload = RequestUtil . getRequestPayload ( request ) ; URI uri = buidURI ( request ) ; Timer timer = Timer . tic ( ) ; TransportResult result = getApiClientTransportFactory ( ) . newTransport ( api ) . doPost ( uri , payload ) ; timer . toc ( ) ; log . trace ( result . getStatusCode ( ) + " " + uri . toString ( ) + " took " + timer . getDifference ( ) + "ms" ) ; Response < T > response = toResponse ( timer , result , request ) ; return response ; |
public class ParamTaglet { /** * Convert the individual ParamTag into Content .
* @ param isNonTypeParams true if this is just a regular param tag . False
* if this is a type param tag .
* @ param writer the taglet writer for output writing .
* @ param paramTag the tag whose inline tags will be printed .
* @ param name the name of the parameter . We can ' t rely on
* the name in the param tag because we might be
* inheriting documentation .
* @ param isFirstParam true if this is the first param tag being printed . */
private Content processParamTag ( boolean isNonTypeParams , TagletWriter writer , ParamTag paramTag , String name , boolean isFirstParam ) { } } | Content result = writer . getOutputInstance ( ) ; String header = writer . configuration ( ) . getText ( isNonTypeParams ? "doclet.Parameters" : "doclet.TypeParameters" ) ; if ( isFirstParam ) { result . addContent ( writer . getParamHeader ( header ) ) ; } result . addContent ( writer . paramTagOutput ( paramTag , name ) ) ; return result ; |
public class CorpusUtil { /** * 编译单词
* @ param word
* @ return */
public static IWord compile ( IWord word ) { } } | String label = word . getLabel ( ) ; if ( "nr" . equals ( label ) ) return new Word ( word . getValue ( ) , TAG_PEOPLE ) ; else if ( "m" . equals ( label ) || "mq" . equals ( label ) ) return new Word ( word . getValue ( ) , TAG_NUMBER ) ; else if ( "t" . equals ( label ) ) return new Word ( word . getValue ( ) , TAG_TIME ) ; else if ( "ns" . equals ( label ) ) return new Word ( word . getValue ( ) , TAG_PLACE ) ; // switch ( word . getLabel ( ) )
// case " nr " :
// return new Word ( word . getValue ( ) , TAG _ PEOPLE ) ;
// case " m " :
// case " mq " :
// return new Word ( word . getValue ( ) , TAG _ NUMBER ) ;
// case " t " :
// return new Word ( word . getValue ( ) , TAG _ TIME ) ;
// case " ns " :
// return new Word ( word . getValue ( ) , TAG _ TIME ) ;
return word ; |
public class PipelineServiceImpl { /** * 用于Model对象转化为DO对象
* @ param pipeline
* @ return PipelineDO */
private PipelineDO modelToDo ( Pipeline pipeline ) { } } | PipelineDO pipelineDO = new PipelineDO ( ) ; try { pipelineDO . setId ( pipeline . getId ( ) ) ; pipelineDO . setName ( pipeline . getName ( ) ) ; pipelineDO . setParameters ( pipeline . getParameters ( ) ) ; pipelineDO . setDescription ( pipeline . getDescription ( ) ) ; pipelineDO . setChannelId ( pipeline . getChannelId ( ) ) ; pipelineDO . setGmtCreate ( pipeline . getGmtCreate ( ) ) ; pipelineDO . setGmtModified ( pipeline . getGmtModified ( ) ) ; } catch ( Exception e ) { logger . error ( "ERROR ## change the pipeline Model to Do has an exception" ) ; throw new ManagerException ( e ) ; } return pipelineDO ; |
public class UserApi { /** * Search users by Email or username
* < pre > < code > GitLab Endpoint : GET / users ? search = : email _ or _ username < / code > < / pre >
* @ param emailOrUsername the email or username to search for
* @ return the User List with the email or username like emailOrUsername
* @ throws GitLabApiException if any exception occurs */
public List < User > findUsers ( String emailOrUsername ) throws GitLabApiException { } } | return ( findUsers ( emailOrUsername , getDefaultPerPage ( ) ) . all ( ) ) ; |
public class Database { /** * Saves a document in the database similarly to { @ link Database # save ( Object ) } but using a
* specific write quorum .
* @ param object the object to save
* @ param writeQuorum the write quorum
* @ return { @ link com . cloudant . client . api . model . Response }
* @ throws DocumentConflictException If a conflict is detected during the save .
* @ see Database # save ( Object )
* @ see < a
* href = " https : / / console . bluemix . net / docs / services / Cloudant / api / document . html # quorum - writing - and - reading - data "
* target = " _ blank " > Documents - quorum < / a > */
public com . cloudant . client . api . model . Response save ( Object object , int writeQuorum ) { } } | Response couchDbResponse = client . couchDbClient . put ( getDBUri ( ) , object , true , writeQuorum ) ; com . cloudant . client . api . model . Response response = new com . cloudant . client . api . model . Response ( couchDbResponse ) ; return response ; |
public class CPFriendlyURLEntryPersistenceImpl { /** * Returns the last cp friendly url entry in the ordered set where groupId = & # 63 ; and classNameId = & # 63 ; and classPK = & # 63 ; and main = & # 63 ; .
* @ param groupId the group ID
* @ param classNameId the class name ID
* @ param classPK the class pk
* @ param main the main
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching cp friendly url entry , or < code > null < / code > if a matching cp friendly url entry could not be found */
@ Override public CPFriendlyURLEntry fetchByG_C_C_M_Last ( long groupId , long classNameId , long classPK , boolean main , OrderByComparator < CPFriendlyURLEntry > orderByComparator ) { } } | int count = countByG_C_C_M ( groupId , classNameId , classPK , main ) ; if ( count == 0 ) { return null ; } List < CPFriendlyURLEntry > list = findByG_C_C_M ( groupId , classNameId , classPK , main , count - 1 , count , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; |
public class TextMateGenerator2 { /** * Generate the rules for the type declaration keywords .
* @ param declarators the type declaration keywords .
* @ return the rules . */
protected List < Map < String , ? > > generateTypeDeclarations ( Set < String > declarators ) { } } | final List < Map < String , ? > > list = new ArrayList < > ( ) ; if ( ! declarators . isEmpty ( ) ) { list . add ( pattern ( it -> { it . matches ( keywordRegex ( declarators ) ) ; it . style ( TYPE_DECLARATION_STYLE ) ; it . comment ( "Type Declarations" ) ; // $ NON - NLS - 1 $
} ) ) ; } return list ; |
public class CombinedWriter { /** * { @ inheritDoc } */
@ Override public IBucket read ( final long pKey ) throws TTIOException { } } | Future < IBucket > secondReturn = mService . submit ( new Callable < IBucket > ( ) { @ Override public IBucket call ( ) throws Exception { return mSecondWriter . read ( pKey ) ; } } ) ; IBucket returnVal = mFirstWriter . read ( pKey ) ; try { if ( returnVal == null ) { return secondReturn . get ( ) ; } else { return returnVal ; } } catch ( ExecutionException | InterruptedException exc ) { throw new TTIOException ( exc ) ; } |
public class BaseRTMPTConnection { /** * Real close */
public void realClose ( ) { } } | if ( isClosing ( ) ) { if ( buffer != null ) { buffer . free ( ) ; buffer = null ; } state . setState ( RTMP . STATE_DISCONNECTED ) ; pendingMessages . clear ( ) ; super . close ( ) ; } |
public class DefaultAuthorizationStrategy { /** * Add a new FoxHttpAuthorization to the AuthorizationStrategy
* @ param foxHttpAuthorizationScope scope in which the authorization is used
* @ param foxHttpAuthorization authorization itself */
@ Override public void addAuthorization ( FoxHttpAuthorizationScope foxHttpAuthorizationScope , FoxHttpAuthorization foxHttpAuthorization ) { } } | if ( foxHttpAuthorizations . containsKey ( foxHttpAuthorizationScope . toString ( ) ) ) { foxHttpAuthorizations . get ( foxHttpAuthorizationScope . toString ( ) ) . add ( foxHttpAuthorization ) ; } else { foxHttpAuthorizations . put ( foxHttpAuthorizationScope . toString ( ) , new ArrayList < > ( Collections . singletonList ( foxHttpAuthorization ) ) ) ; } |
public class JpaSource { /** * { @ inheritDoc } */
@ Override public void beginExport ( ) { } } | if ( m_emf == null ) { m_emf = Persistence . createEntityManagerFactory ( m_persistenceUnitName ) ; } m_em = m_emf . createEntityManager ( ) ; |
public class AssetsInner { /** * Get an Asset .
* Get the details of an Asset in the Media Services account .
* @ param resourceGroupName The name of the resource group within the Azure subscription .
* @ param accountName The Media Services account name .
* @ param assetName The Asset name .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ApiErrorException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the AssetInner object if successful . */
public AssetInner get ( String resourceGroupName , String accountName , String assetName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , accountName , assetName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class EstimateSceneCalibrated { /** * Sets the a _ to _ b transform for the motion given . */
void decomposeEssential ( Motion motion ) { } } | List < Se3_F64 > candidates = MultiViewOps . decomposeEssential ( motion . F ) ; int bestScore = 0 ; Se3_F64 best = null ; PositiveDepthConstraintCheck check = new PositiveDepthConstraintCheck ( ) ; for ( int i = 0 ; i < candidates . size ( ) ; i ++ ) { Se3_F64 a_to_b = candidates . get ( i ) ; int count = 0 ; for ( int j = 0 ; j < motion . associated . size ( ) ; j ++ ) { AssociatedIndex a = motion . associated . get ( j ) ; Point2D_F64 p0 = motion . viewSrc . observationNorm . get ( a . src ) ; Point2D_F64 p1 = motion . viewDst . observationNorm . get ( a . dst ) ; if ( check . checkConstraint ( p0 , p1 , a_to_b ) ) { count ++ ; } } if ( count > bestScore ) { bestScore = count ; best = a_to_b ; } } if ( best == null ) throw new RuntimeException ( "Problem!" ) ; motion . a_to_b . set ( best ) ; |
public class ConsumerSessionProxy { /** * This method returns the id for this consumer session that was assigned to it by the
* message processor on the server . This is needed when creating a bifurcated consumer session .
* @ return Returns the id . */
public long getId ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getId" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getId" , "" + messageProcessorId ) ; return messageProcessorId ; |
public class ParsedElement { /** * Just like makeFloat ( ) , but creates a float primitive value instead of a
* Float object . Much more efficient if you don ' t need the object .
* @ param obj Any float convertible object
* @ return The float primitive value . */
public static float makeFloatValue ( Object obj ) { } } | if ( obj == null ) { return Float . NaN ; } return CommonServices . getCoercionManager ( ) . makePrimitiveFloatFrom ( obj ) ; |
public class GetParametersRequest { /** * Names of the parameters for which you want to query information .
* @ return Names of the parameters for which you want to query information . */
public java . util . List < String > getNames ( ) { } } | if ( names == null ) { names = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return names ; |
public class Conversation { /** * region Payloads */
public void addPayload ( Payload payload ) { } } | // TODO : figure out a better way of detecting new events
if ( payload instanceof EventPayload ) { notifyEventGenerated ( ( EventPayload ) payload ) ; } payload . setLocalConversationIdentifier ( notNull ( getLocalIdentifier ( ) ) ) ; payload . setConversationId ( getConversationId ( ) ) ; payload . setToken ( getConversationToken ( ) ) ; payload . setEncryptionKey ( getEncryptionKey ( ) ) ; payload . setAuthenticated ( isAuthenticated ( ) ) ; payload . setSessionId ( getSessionId ( ) ) ; // TODO : don ' t use singleton here
ApptentiveInternal . getInstance ( ) . getApptentiveTaskManager ( ) . addPayload ( payload ) ; |
public class DirectoryClient { /** * { @ inheritDoc }
* @ throws BadVersionException
* @ throws IOException */
@ Override protected Asset readJson ( final String assetId ) throws IOException , BadVersionException { } } | FileInputStream fis = null ; try { fis = DirectoryUtils . createFileInputStream ( createFromRelative ( assetId + ".json" ) ) ; Asset ass = processJSON ( fis ) ; return ass ; } finally { if ( fis != null ) { fis . close ( ) ; } } |
public class DirectoryBrowserApplication { /** * Create the stateful context for the given request / response . */
@ Override public Object createContext ( ApplicationRequest request , ApplicationResponse response ) { } } | mLog . debug ( "Creating DirectoryBrowserContext..." ) ; return new DirectoryBrowserContext ( request , response , this ) ; |
public class Vector3f { /** * / * ( non - Javadoc )
* @ see org . joml . Vector3fc # sub ( org . joml . Vector3fc , org . joml . Vector3f ) */
public Vector3f sub ( Vector3fc v , Vector3f dest ) { } } | dest . x = x - v . x ( ) ; dest . y = y - v . y ( ) ; dest . z = z - v . z ( ) ; return dest ; |
public class BoxCollaborationWhitelistExemptTarget { /** * Creates a collaboration whitelist for a Box User with a given ID .
* @ param api the API connection to be used by the collaboration whitelist .
* @ param userID the ID of the Box User to add to the collaboration whitelist .
* @ return information about the collaboration whitelist created for user . */
public static BoxCollaborationWhitelistExemptTarget . Info create ( final BoxAPIConnection api , String userID ) { } } | URL url = COLLABORATION_WHITELIST_EXEMPT_TARGET_ENTRIES_URL_TEMPLATE . build ( api . getBaseURL ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( api , url , HttpMethod . POST ) ; JsonObject requestJSON = new JsonObject ( ) . add ( "user" , new JsonObject ( ) . add ( "type" , "user" ) . add ( "id" , userID ) ) ; request . setBody ( requestJSON . toString ( ) ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject responseJSON = JsonObject . readFrom ( response . getJSON ( ) ) ; BoxCollaborationWhitelistExemptTarget userWhitelist = new BoxCollaborationWhitelistExemptTarget ( api , responseJSON . get ( "id" ) . asString ( ) ) ; return userWhitelist . new Info ( responseJSON ) ; |
public class ArtifactoryServer { /** * This method might run on slaves , this is why we provide it with a proxy from the master config */
public ArtifactoryDependenciesClient createArtifactoryDependenciesClient ( String userName , String password , ProxyConfiguration proxyConfiguration , TaskListener listener ) { } } | ArtifactoryDependenciesClient client = new ArtifactoryDependenciesClient ( url , userName , password , new JenkinsBuildInfoLog ( listener ) ) ; client . setConnectionTimeout ( timeout ) ; setRetryParams ( client ) ; if ( ! bypassProxy && proxyConfiguration != null ) { client . setProxyConfiguration ( proxyConfiguration . host , proxyConfiguration . port , proxyConfiguration . username , proxyConfiguration . password ) ; } return client ; |
public class Call { /** * Abbreviation for { { @ link # methodForString ( String , Object . . . ) } .
* @ since 1.1
* @ param methodName the name of the method
* @ param optionalParameters the ( optional ) parameters of the method .
* @ return the result of the method execution */
public static Function < Object , String > s ( final String methodName , final Object ... optionalParameters ) { } } | return methodForString ( methodName , optionalParameters ) ; |
public class GitHubHookRegisterProblemMonitor { /** * This web method requires POST , admin rights and nonnull repo .
* Responds with redirect to monitor page
* @ param repo to be disignored . Never null */
@ RequirePOST @ ValidateRepoName @ RequireAdminRights @ RespondWithRedirect public void doDisignore ( @ Nonnull @ GHRepoName GitHubRepositoryName repo ) { } } | ignored . remove ( repo ) ; |
public class ConversionAnalyzer { /** * Analyzes classes given as input and returns the type of conversion that has to be done .
* @ param destination class to analyze
* @ param source class to analyze
* @ return type of Conversion */
public static ConversionType getConversionType ( final Class < ? > destination , final Class < ? > source ) { } } | if ( destination == String . class ) return toStringConversion ( source ) ; if ( destination == Byte . class ) return toByteConversion ( source ) ; if ( destination == byte . class ) return tobyteConversion ( source ) ; if ( destination == Short . class ) return toShortConversion ( source ) ; if ( destination == short . class ) return toshortConversion ( source ) ; if ( destination == Integer . class ) return toIntegerConversion ( source ) ; if ( destination == int . class ) return tointConversion ( source ) ; if ( destination == Long . class ) return toLongConversion ( source ) ; if ( destination == long . class ) return tolongConversion ( source ) ; if ( destination == Float . class ) return toFloatConversion ( source ) ; if ( destination == float . class ) return tofloatConversion ( source ) ; if ( destination == Double . class ) return toDoubleConversion ( source ) ; if ( destination == double . class ) return todoubleConversion ( source ) ; if ( destination == Character . class ) return toCharacterConversion ( source ) ; if ( destination == char . class ) return tocharConversion ( source ) ; if ( destination == Boolean . class ) return toBooleanConversion ( source ) ; if ( destination == boolean . class ) return tobooleanConversion ( source ) ; return UNDEFINED ; |
public class CmsUgcSession { /** * Unmarshal the XML content with auto - correction .
* @ param file the file that contains the XML
* @ return the XML read from the file
* @ throws CmsXmlException thrown if the XML can ' t be read . */
private CmsXmlContent unmarshalXmlContent ( CmsFile file ) throws CmsXmlException { } } | CmsXmlContent content = CmsXmlContentFactory . unmarshal ( m_cms , file ) ; content . setAutoCorrectionEnabled ( true ) ; content . correctXmlStructure ( m_cms ) ; return content ; |
public class GwFacadeImpl { /** * / * ( non - Javadoc )
* @ see com . att . authz . facade . AuthzFacade # error ( com . att . authz . env . AuthzTrans , javax . servlet . http . HttpServletResponse , int )
* Note : Conforms to AT & T TSS RESTful Error Structure */
@ Override public void error ( AuthzTrans trans , HttpServletResponse response , Result < ? > result ) { } } | String msg = result . details == null ? "" : result . details . trim ( ) ; String [ ] detail ; if ( result . variables == null ) { detail = new String [ 1 ] ; } else { int l = result . variables . length ; detail = new String [ l + 1 ] ; System . arraycopy ( result . variables , 0 , detail , 1 , l ) ; } error ( trans , response , result . status , msg , detail ) ; |
public class AmazonElastiCacheClient { /** * Returns information about all provisioned clusters if no cluster identifier is specified , or about a specific
* cache cluster if a cluster identifier is supplied .
* By default , abbreviated information about the clusters is returned . You can use the optional
* < i > ShowCacheNodeInfo < / i > flag to retrieve detailed information about the cache nodes associated with the
* clusters . These details include the DNS address and port for the cache node endpoint .
* If the cluster is in the < i > creating < / i > state , only cluster - level information is displayed until all of the
* nodes are successfully provisioned .
* If the cluster is in the < i > deleting < / i > state , only cluster - level information is displayed .
* If cache nodes are currently being added to the cluster , node endpoint information and creation time for the
* additional nodes are not displayed until they are completely provisioned . When the cluster state is
* < i > available < / i > , the cluster is ready for use .
* If cache nodes are currently being removed from the cluster , no endpoint information for the removed nodes is
* displayed .
* @ param describeCacheClustersRequest
* Represents the input of a < code > DescribeCacheClusters < / code > operation .
* @ return Result of the DescribeCacheClusters operation returned by the service .
* @ throws CacheClusterNotFoundException
* The requested cluster ID does not refer to an existing cluster .
* @ throws InvalidParameterValueException
* The value for a parameter is invalid .
* @ throws InvalidParameterCombinationException
* Two or more incompatible parameters were specified .
* @ sample AmazonElastiCache . DescribeCacheClusters
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / elasticache - 2015-02-02 / DescribeCacheClusters "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DescribeCacheClustersResult describeCacheClusters ( DescribeCacheClustersRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeCacheClusters ( request ) ; |
public class CompletableFuture { /** * Android - changed : hidden */
public CompletableFuture < T > orTimeout ( long timeout , TimeUnit unit ) { } } | if ( unit == null ) throw new NullPointerException ( ) ; if ( result == null ) whenComplete ( new Canceller ( Delayer . delay ( new Timeout ( this ) , timeout , unit ) ) ) ; return this ; |
public class ImageUtil { /** * Obtains the default graphics configuration for this VM . If the JVM is in headless mode ,
* this method will return null . */
protected static GraphicsConfiguration getDefGC ( ) { } } | if ( _gc == null ) { // obtain information on our graphics environment
try { GraphicsEnvironment env = GraphicsEnvironment . getLocalGraphicsEnvironment ( ) ; GraphicsDevice gd = env . getDefaultScreenDevice ( ) ; _gc = gd . getDefaultConfiguration ( ) ; } catch ( HeadlessException e ) { // no problem , just return null
} } return _gc ; |
public class AbstractContextBuilder { /** * Sets an attribute , using { @ code attribute . getClass ( ) } as attribute
* < i > type < / i > .
* @ param value the attribute value , not null .
* @ param key the attribute ' s key , not { @ code null }
* @ return this Builder , for chaining */
public < T > B set ( Class < T > key , T value ) { } } | Object old = set ( key . getName ( ) , Objects . requireNonNull ( value ) ) ; if ( old != null && old . getClass ( ) . isAssignableFrom ( value . getClass ( ) ) ) { return ( B ) old ; } return ( B ) this ; |
public class HttpChannelConfig { /** * Check the input configuration for the maximum allowed requests per socket
* setting .
* @ param props */
private void parseMaxPersist ( Map < Object , Object > props ) { } } | // -1 means unlimited
// 0 . . 1 means 1
// X means X
Object value = props . get ( HttpConfigConstants . PROPNAME_MAX_PERSIST ) ; if ( null != value ) { try { this . maxPersistRequest = minLimit ( convertInteger ( value ) , HttpConfigConstants . MIN_PERSIST_REQ ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Config: Max persistent requests is " + getMaximumPersistentRequests ( ) ) ; } } catch ( NumberFormatException nfe ) { FFDCFilter . processException ( nfe , getClass ( ) . getName ( ) + ".parseMaxPersist" , "1" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Config: Invalid max persistent requests; " + value ) ; } } } |
public class SessionManager { /** * Copyright 2009 NetApp , contribution by Eric Forgette
* Modified by Steve Jin ( sjin @ vmware . com )
* This constructor builds a new ServiceInstance based on a ServiceInstance .
* The new ServiceInstance is effectively a clone of the first . This clone will
* NOT become invalid when the first is logged out .
* @ throws RemoteException
* @ throws RuntimeFault
* @ throws InvalidLogin
* @ throws MalformedURLException
* @ author Eric Forgette ( forgette @ netapp . com ) */
public ServiceInstance cloneSession ( boolean ignoreCert ) throws InvalidLogin , RuntimeFault , RemoteException , MalformedURLException { } } | ServiceInstance oldsi = getServerConnection ( ) . getServiceInstance ( ) ; ServerConnection oldsc = oldsi . getServerConnection ( ) ; String ticket = oldsi . getSessionManager ( ) . acquireCloneTicket ( ) ; VimPortType vimService = new VimPortType ( oldsc . getUrl ( ) . toString ( ) , ignoreCert ) ; vimService . getWsc ( ) . setVimNameSpace ( oldsc . getVimService ( ) . getWsc ( ) . getVimNameSpace ( ) ) ; vimService . getWsc ( ) . setSoapActionOnApiVersion ( oldsi . getAboutInfo ( ) . getApiVersion ( ) ) ; ServerConnection newsc = new ServerConnection ( oldsc . getUrl ( ) , vimService , null ) ; ServiceInstance newsi = new ServiceInstance ( newsc ) ; newsc . setServiceInstance ( newsi ) ; UserSession userSession = newsi . getSessionManager ( ) . cloneSession ( ticket ) ; newsc . setUserSession ( userSession ) ; return newsi ; |
public class SubmitTaskStateChangeRequest { /** * Any attachments associated with the state change request .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAttachments ( java . util . Collection ) } or { @ link # withAttachments ( java . util . Collection ) } if you want to
* override the existing values .
* @ param attachments
* Any attachments associated with the state change request .
* @ return Returns a reference to this object so that method calls can be chained together . */
public SubmitTaskStateChangeRequest withAttachments ( AttachmentStateChange ... attachments ) { } } | if ( this . attachments == null ) { setAttachments ( new com . amazonaws . internal . SdkInternalList < AttachmentStateChange > ( attachments . length ) ) ; } for ( AttachmentStateChange ele : attachments ) { this . attachments . add ( ele ) ; } return this ; |
public class AmazonEC2Waiters { /** * Builds a SubnetAvailable waiter by using custom parameters waiterParameters and other parameters defined in the
* waiters specification , and then polls until it determines whether the resource entered the desired state or not ,
* where polling criteria is bound by either default polling strategy or custom polling strategy . */
public Waiter < DescribeSubnetsRequest > subnetAvailable ( ) { } } | return new WaiterBuilder < DescribeSubnetsRequest , DescribeSubnetsResult > ( ) . withSdkFunction ( new DescribeSubnetsFunction ( client ) ) . withAcceptors ( new SubnetAvailable . IsAvailableMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; |
public class ByteBufUtil { /** * Returns a multi - line hexadecimal dump of the specified { @ link ByteBuf } that is easy to read by humans ,
* starting at the given { @ code offset } using the given { @ code length } . */
public static String prettyHexDump ( ByteBuf buffer , int offset , int length ) { } } | return HexUtil . prettyHexDump ( buffer , offset , length ) ; |
public class DatabaseTaskStore { /** * Returns the persistence service unit , lazily initializing if necessary .
* @ return the persistence service unit .
* @ throws Exceptin if an error occurs .
* @ throws IllegalStateException if this instance has been destroyed . */
public final PersistenceServiceUnit getPersistenceServiceUnit ( ) throws Exception { } } | lock . readLock ( ) . lock ( ) ; try { if ( destroyed ) throw new IllegalStateException ( ) ; if ( persistenceServiceUnit == null ) { // Switch to write lock for lazy initialization
lock . readLock ( ) . unlock ( ) ; lock . writeLock ( ) . lock ( ) ; try { if ( destroyed ) throw new IllegalStateException ( ) ; if ( persistenceServiceUnit == null ) persistenceServiceUnit = dbStore . createPersistenceServiceUnit ( priv . getClassLoader ( Task . class ) , Partition . class . getName ( ) , Property . class . getName ( ) , Task . class . getName ( ) ) ; } finally { // Downgrade to read lock for rest of method
lock . readLock ( ) . lock ( ) ; lock . writeLock ( ) . unlock ( ) ; } } return persistenceServiceUnit ; } finally { lock . readLock ( ) . unlock ( ) ; } |
public class AggregateBinder { /** * Perform binding for the aggregate .
* @ param name the configuration property name to bind
* @ param target the target to bind
* @ param elementBinder an element binder
* @ return the bound aggregate or null */
@ SuppressWarnings ( "unchecked" ) public final Object bind ( ConfigurationPropertyName name , Bindable < ? > target , AggregateElementBinder elementBinder ) { } } | Object result = bindAggregate ( name , target , elementBinder ) ; Supplier < ? > value = target . getValue ( ) ; if ( result == null || value == null ) { return result ; } return merge ( ( Supplier < T > ) value , ( T ) result ) ; |
public class NtlmAuthenticator { /** * Used internally by jCIFS when an < tt > SmbAuthException < / tt > is trapped to retrieve new user credentials .
* @ param url
* @ param sae
* @ return credentials returned by prompt */
public static NtlmPasswordAuthenticator requestNtlmPasswordAuthentication ( String url , SmbAuthException sae ) { } } | return requestNtlmPasswordAuthentication ( auth , url , sae ) ; |
public class ProxyUgiManager { /** * save an ugi to cache , only for junit testing purposes */
static synchronized void saveToCache ( UnixUserGroupInformation ugi ) { } } | ugiCache . put ( ugi . getUserName ( ) , new CachedUgi ( ugi , System . currentTimeMillis ( ) ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.