signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AbstractGrailsClass { /** * < p > Looks for a property of the reference instance with a given name and type . < / p >
* < p > If found its value is returned . We follow the Java bean conventions with augmentation for groovy support
* and static fields / properties . We will therefore match , in this or... | return ClassPropertyFetcher . getStaticPropertyValue ( getClazz ( ) , name , type ) ; |
public class ZookeeperRegistry { /** * 订阅
* @ param config */
protected void subscribeConsumerUrls ( ConsumerConfig config ) { } } | // 注册Consumer节点
String url = null ; if ( config . isRegister ( ) ) { try { String consumerPath = buildConsumerPath ( rootPath , config ) ; if ( consumerUrls . containsKey ( config ) ) { url = consumerUrls . get ( config ) ; } else { url = ZookeeperRegistryHelper . convertConsumerToUrl ( config ) ; consumerUrls . put ( ... |
public class WebhooksInner { /** * Gets the configuration of service URI and custom headers for the webhook .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param webhookName The name of the webho... | return getCallbackConfigWithServiceResponseAsync ( resourceGroupName , registryName , webhookName ) . map ( new Func1 < ServiceResponse < CallbackConfigInner > , CallbackConfigInner > ( ) { @ Override public CallbackConfigInner call ( ServiceResponse < CallbackConfigInner > response ) { return response . body ( ) ; } }... |
public class AbstractConnectorServlet { /** * Processing a new request from ElFinder client .
* @ param request
* @ param response */
protected void processRequest ( HttpServletRequest request , HttpServletResponse response ) { } } | parseRequest ( request , response ) ; if ( profile == null ) { profile = _profileService . findProfile ( request , "jbpm" ) ; } Repository repository = profile . getRepository ( ) ; if ( ! initialized ) { try { initializeDefaultRepo ( profile , repository , request ) ; initialized = true ; } catch ( Exception e ) { log... |
public class AnnotationEventHandler { /** * Call the method into the callback object .
* @ param methodName the method name to call
* @ param event the event to trigger */
private void callMethod ( final String methodName , final Event event ) { } } | final Class < ? > ctrlClass = this . callbackObject . getClass ( ) ; try { final Method method = ctrlClass . getDeclaredMethod ( methodName , event . getClass ( ) ) ; ClassUtility . callMethod ( method , this . callbackObject , event ) ; } catch ( NoSuchMethodException | SecurityException | IllegalArgumentException | C... |
public class PhaseFourImpl { /** * { @ inheritDoc } */
@ Override public void stage3CreateKAMstore ( final DBConnection db , String schemaName ) throws CreateKAMFailure { } } | if ( db == null ) { throw new InvalidArgument ( "db" , db ) ; } try { ksss . setupKAMStoreSchema ( db , schemaName ) ; } catch ( IOException e ) { throw new CreateKAMFailure ( db , e . getMessage ( ) ) ; } catch ( SQLException e ) { throw new CreateKAMFailure ( db , e . getMessage ( ) ) ; } |
public class DBFKRelationPropertySheet { /** * GEN - LAST : event _ formComponentShown */
public void setModel ( PropertySheetModel pm ) { } } | if ( pm instanceof org . apache . ojb . tools . mapping . reversedb . DBFKRelation ) { this . aRelation = ( org . apache . ojb . tools . mapping . reversedb . DBFKRelation ) pm ; this . readValuesFromReference ( ) ; } else throw new IllegalArgumentException ( ) ; |
public class SqlExporter { /** * Creates insert query field name */
private < T > String format ( final T t , final IClassContainer container ) { } } | final List < ExportContainer > exportContainers = extractExportContainers ( t , container ) ; final String resultValues = exportContainers . stream ( ) . map ( c -> convertFieldValue ( container . getField ( c . getExportName ( ) ) , c ) ) . collect ( Collectors . joining ( ", " ) ) ; return "(" + resultValues + ")" ; |
public class Constraint { /** * Creates a new map representing a { @ link Pattern } validation constraint .
* @ param regex a regular expression
* @ return a map */
static Map < String , Object > patternPayload ( final Object regex ) { } } | if ( regex == null ) { return null ; } Map < String , Object > payload = new LinkedHashMap < > ( ) ; payload . put ( "value" , regex ) ; payload . put ( "message" , MSG_PREFIX + VALIDATORS . get ( Pattern . class ) ) ; return payload ; |
public class SuppressionHandler { /** * Processes field members that have been collected during the characters
* and startElement method to construct a PropertyType object .
* @ return a PropertyType object */
private PropertyType processPropertyType ( ) { } } | final PropertyType pt = new PropertyType ( ) ; pt . setValue ( currentText . toString ( ) ) ; if ( currentAttributes != null && currentAttributes . getLength ( ) > 0 ) { final String regex = currentAttributes . getValue ( "regex" ) ; if ( regex != null ) { pt . setRegex ( Boolean . parseBoolean ( regex ) ) ; } final St... |
public class DomainsInner { /** * Creates an ownership identifier for a domain or updates identifier details for an existing identifer .
* Creates an ownership identifier for a domain or updates identifier details for an existing identifer .
* @ param resourceGroupName Name of the resource group to which the resour... | return updateOwnershipIdentifierWithServiceResponseAsync ( resourceGroupName , domainName , name , domainOwnershipIdentifier ) . map ( new Func1 < ServiceResponse < DomainOwnershipIdentifierInner > , DomainOwnershipIdentifierInner > ( ) { @ Override public DomainOwnershipIdentifierInner call ( ServiceResponse < DomainO... |
public class ParquetRecordReader { /** * Moves the reading position to the given block and seeks to and reads the given record .
* @ param block The block to seek to .
* @ param recordInBlock The number of the record in the block to return next . */
public void seek ( long block , long recordInBlock ) throws IOExce... | List < BlockMetaData > blockMetaData = reader . getRowGroups ( ) ; if ( block == - 1L && recordInBlock == - 1L ) { // the split was fully consumed
currentBlock = blockMetaData . size ( ) - 1 ; numReadRecords = numTotalRecords ; numRecordsUpToCurrentBlock = numTotalRecords ; return ; } // init all counters for the start... |
public class StringContext { /** * Replace the given regular expression pattern with the given replacement .
* Only the first match will be replaced .
* @ param subject The value to replace
* @ param regex The regular expression pattern to match
* @ param replacement The replacement value
* @ return A new str... | return subject . replaceFirst ( regex , replacement ) ; |
public class ISO639Converter { /** * Converts a two or three digit ISO - 639 language code into a human readable name for the language represented by
* the code .
* @ param aCode A two or three digit ISO - 639 code
* @ return An English name for the language represented by the two or three digit code */
public st... | String langName ; switch ( aCode . length ( ) ) { case 2 : langName = ISO639_1_MAP . get ( aCode . toLowerCase ( ) ) ; break ; case 3 : langName = ISO639_2_MAP . get ( aCode . toLowerCase ( ) ) ; break ; default : langName = aCode ; } return langName == null ? aCode : langName ; |
public class BitmapContainer { /** * Counts how many runs there is in the bitmap , up to a maximum
* @ param mustNotExceed maximum of runs beyond which counting is pointless
* @ return estimated number of courses */
public int numberOfRunsLowerBound ( int mustNotExceed ) { } } | int numRuns = 0 ; for ( int blockOffset = 0 ; blockOffset < bitmap . length ; blockOffset += BLOCKSIZE ) { for ( int i = blockOffset ; i < blockOffset + BLOCKSIZE ; i ++ ) { long word = bitmap [ i ] ; numRuns += Long . bitCount ( ( ~ word ) & ( word << 1 ) ) ; } if ( numRuns > mustNotExceed ) { return numRuns ; } } ret... |
public class SqlParserImpl { /** * Parse an END node . */
protected void parseEnd ( ) { } } | while ( TokenType . EOF != tokenizer . next ( ) ) { if ( tokenizer . getTokenType ( ) == TokenType . COMMENT && isEndComment ( tokenizer . getToken ( ) ) ) { pop ( ) ; return ; } parseToken ( ) ; } throw new TwoWaySQLException ( String . format ( "END comment of %s not found." , tokenizer . getSql ( ) ) ) ; |
public class FailoverGroupsInner { /** * Creates or updates a failover group .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server containing the failover gro... | return ServiceFuture . fromResponse ( createOrUpdateWithServiceResponseAsync ( resourceGroupName , serverName , failoverGroupName , parameters ) , serviceCallback ) ; |
public class Matcher { /** * Replaces the first match this Matcher can find with replacement , as interpreted by PerlSubstitution ( so $ 1 refers
* to the first group and so on ) . Advances the search position for this Matcher , so it can also be used to
* repeatedly replace the next match when called successively ... | TextBuffer tb = wrap ( new StringBuilder ( data . length ) ) ; Replacer . replace ( this , new PerlSubstitution ( replacement ) , tb , 1 ) ; return tb . toString ( ) ; |
public class MathUtils { /** * Rounds the specified floating point value to the nearest integer and adds it to the specified list of integers ,
* provided it is not already in the list .
* @ param result The list of integers to add to .
* @ param value The new candidate to round and add to the list . */
private s... | int roundedValue = ( int ) Math . round ( value ) ; if ( ! result . contains ( roundedValue ) ) { result . add ( roundedValue ) ; } |
public class SubCommandMetaGet { /** * Prints help menu for command .
* @ param stream PrintStream object for output
* @ throws IOException */
public static void printHelp ( PrintStream stream ) throws IOException { } } | stream . println ( ) ; stream . println ( "NAME" ) ; stream . println ( " meta get - Get metadata from nodes" ) ; stream . println ( ) ; stream . println ( "SYNOPSIS" ) ; stream . println ( " meta get (<meta-key-list> | all) -u <url> [-d <output-dir>]" ) ; stream . println ( " [-n <node-id-list> | --all-nod... |
public class VariantToProtoVcfRecord { /** * Encodes the { @ link String } value of the Quality into a float .
* See { @ link VcfRecordProtoToVariantConverter # getQuality ( float ) }
* Increments one to the quality value . 0 means missing or unknown .
* @ param value String quality value
* @ return Quality */
... | final float qual ; if ( StringUtils . isEmpty ( value ) || value . equals ( "." ) ) { qual = MISSING_QUAL_VALUE ; } else { qual = Float . parseFloat ( value ) ; } return qual + 1 ; |
public class Sign { /** * Given an arbitrary piece of text and an Ethereum message signature encoded in bytes ,
* returns the public key that was used to sign it . This can then be compared to the expected
* public key to determine if the signature was correct .
* @ param message RLP encoded message .
* @ param... | return signedMessageHashToKey ( Hash . sha3 ( message ) , signatureData ) ; |
public class CreateConditionalForwarderRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateConditionalForwarderRequest createConditionalForwarderRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createConditionalForwarderRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createConditionalForwarderRequest . getDirectoryId ( ) , DIRECTORYID_BINDING ) ; protocolMarshaller . marshall ( createConditionalForwarderRequest . ge... |
public class UnicodeFilter { /** * Default implementation of UnicodeMatcher : : matches ( ) for Unicode
* filters . Matches a single 16 - bit code unit at offset . */
@ Override public int matches ( Replaceable text , int [ ] offset , int limit , boolean incremental ) { } } | int c ; if ( offset [ 0 ] < limit && contains ( c = text . char32At ( offset [ 0 ] ) ) ) { offset [ 0 ] += UTF16 . getCharCount ( c ) ; return U_MATCH ; } if ( offset [ 0 ] > limit && contains ( text . char32At ( offset [ 0 ] ) ) ) { // Backup offset by 1 , unless the preceding character is a
// surrogate pair - - then... |
public class ServerRequestCreateUrl { /** * Calls the callback with the URL . This should be called on finding an existing url
* up on trying to create a URL asynchronously
* @ param url existing url with for the given data */
public void onUrlAvailable ( String url ) { } } | if ( callback_ != null ) { callback_ . onLinkCreate ( url , null ) ; } updateShareEventToFabric ( url ) ; |
public class CSSModuleBuilder { /** * Initializes Rhino with PostCSS and configured plugins . The minifier plugin is
* always added . Additional plugins are added based on configuration .
* See { @ link CSSModuleBuilder } for a description of the plugin config JavaScript
* @ param config The config object
* @ t... | final String sourceMethod = "initPostcss" ; // $ NON - NLS - 1 $
final boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( sourceClass , sourceMethod , new Object [ ] { config } ) ; } pluginInfoList = new ArrayList < PluginInfo > ( ) ; Context cx = Context . enter ( ) ... |
public class ASTProcessor { /** * Parses the provided file , using the given libraryPaths and sourcePaths as context . The libraries may be either
* jar files or references to directories containing class files .
* The sourcePaths must be a reference to the top level directory for sources ( eg , for a file
* src ... | ASTParser parser = ASTParser . newParser ( AST . JLS11 ) ; parser . setEnvironment ( libraryPaths . toArray ( new String [ libraryPaths . size ( ) ] ) , sourcePaths . toArray ( new String [ sourcePaths . size ( ) ] ) , null , true ) ; parser . setBindingsRecovery ( false ) ; parser . setResolveBindings ( true ) ; Map o... |
public class HystrixCommandExecutionHook { /** * DEPRECATED : Change usages of this to { @ link # onError } .
* Invoked after failed completion of { @ link HystrixCommand } execution .
* @ param commandInstance
* The executing HystrixCommand instance .
* @ param failureType
* { @ link FailureType } representi... | // pass - thru by default
return e ; |
public class EvolutionUtils { /** * Sorts an evaluated population in descending order of fitness
* ( descending order of fitness score for natural scores , ascending
* order of scores for non - natural scores ) .
* @ param evaluatedPopulation The population to be sorted ( in - place ) .
* @ param naturalFitness... | // Sort candidates in descending order according to fitness .
if ( naturalFitness ) // Descending values for natural fitness .
{ Collections . sort ( evaluatedPopulation , Collections . reverseOrder ( ) ) ; } else // Ascending values for non - natural fitness .
{ Collections . sort ( evaluatedPopulation ) ; } |
public class RedisSortSet { /** * 删除有序集合中的一个成员
* @ param member
* @ return */
public boolean remove ( Object mem ) { } } | try { boolean result = false ; if ( isCluster ( groupName ) ) { result = getBinaryJedisClusterCommands ( groupName ) . zrem ( keyBytes , valueSerialize ( mem ) ) >= 1 ; } else { result = getBinaryJedisCommands ( groupName ) . zrem ( keyBytes , valueSerialize ( mem ) ) >= 1 ; } return result ; } finally { getJedisProvid... |
public class JSONObject { /** * A Simple Helper cast an Object to an Number
* @ return a Number or null */
public Number getAsNumber ( String key ) { } } | Object obj = this . get ( key ) ; if ( obj == null ) return null ; if ( obj instanceof Number ) return ( Number ) obj ; return Long . valueOf ( obj . toString ( ) ) ; |
public class Sneaky { /** * Sneaky throws a Predicate lambda .
* @ param predicate Predicate that can throw an exception
* @ param < T > type of first argument
* @ return a Predicate as defined in java . util . function */
public static < T , E extends Exception > Predicate < T > sneaked ( SneakyPredicate < T , E... | return t -> { @ SuppressWarnings ( "unchecked" ) SneakyPredicate < T , RuntimeException > castedSneakyPredicate = ( SneakyPredicate < T , RuntimeException > ) predicate ; return castedSneakyPredicate . test ( t ) ; } ; |
public class Artwork { /** * Serializes this artwork object to a { @ link Bundle } representation .
* @ return a serialized version of the artwork .
* @ see # fromBundle */
@ NonNull public Bundle toBundle ( ) { } } | Bundle bundle = new Bundle ( ) ; bundle . putString ( KEY_COMPONENT_NAME , ( mComponentName != null ) ? mComponentName . flattenToShortString ( ) : null ) ; bundle . putString ( KEY_IMAGE_URI , ( mImageUri != null ) ? mImageUri . toString ( ) : null ) ; bundle . putString ( KEY_TITLE , mTitle ) ; bundle . putString ( K... |
public class SimpleDocTreeVisitor { /** * { @ inheritDoc } This implementation calls { @ code defaultAction } .
* @ param node { @ inheritDoc }
* @ param p { @ inheritDoc }
* @ return the result of { @ code defaultAction } */
@ Override public R visitSerial ( SerialTree node , P p ) { } } | return defaultAction ( node , p ) ; |
public class TypeGraph { /** * Attempts to find the best { @ link com . merakianalytics . datapipelines . ChainTransform } to get from a type to another
* @ param from
* the type to convert from
* @ param to
* the type to convert to
* @ return the best { @ link com . merakianalytics . datapipelines . ChainTra... | if ( from . equals ( to ) ) { return ChainTransform . identity ( to ) ; } final SearchProblem problem = GraphSearchProblem . startingFrom ( from ) . in ( graph ) . extractCostFromEdges ( new Function < DataTransformer , Double > ( ) { @ Override public Double apply ( final DataTransformer transformer ) { return new Dou... |
public class WildcardFilenameFilter { /** * / * ( non - Javadoc )
* @ see java . io . FilenameFilter # accept ( java . io . File , java . lang . String ) */
public boolean accept ( File dir , String name ) { } } | for ( List < String > pattern : _patterns ) { boolean match = match ( pattern , name ) ; if ( match ) return ! _exclude ; } return _exclude ; |
public class BaseScope { /** * Iterates over the entries of the specified map calling potentially registered
* { @ link Disposable } s .
* @ param scopeMap
* the scope map */
protected void performDisposal ( final Map < Key < ? > , Object > scopeMap ) { } } | for ( Entry < Key < ? > , Object > entry : scopeMap . entrySet ( ) ) { Key < ? > key = entry . getKey ( ) ; // warning can be safely suppressed , we always get a Disposable and
// the type parameter < Object > does not hurt here at runtime
@ SuppressWarnings ( "unchecked" ) Disposable < Object > disposable = ( Disposab... |
public class FessMessages { /** * Add the created action message for the key ' success . changed _ password ' with parameters .
* < pre >
* message : Changed your password .
* < / pre >
* @ param property The property name for the message . ( NotNull )
* @ return this . ( NotNull ) */
public FessMessages addS... | assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( SUCCESS_changed_password ) ) ; return this ; |
public class SessionDriver { /** * Stops session acquired by remote JT
* @ param remoteId id of remote JT session */
public void stopRemoteSession ( String remoteId ) { } } | cmNotifier . addCall ( new ClusterManagerService . sessionEnd_args ( remoteId , SessionStatus . TIMED_OUT ) ) ; |
public class Strings { /** * 将1-2,3,4-9之类的序列拆分成数组
* @ param numSeq
* a { @ link java . lang . String } object .
* @ return an array of { @ link java . lang . Integer } objects . */
public static Integer [ ] splitNumSeq ( final String numSeq ) { } } | if ( isEmpty ( numSeq ) ) { return null ; } String [ ] numArray = split ( numSeq , ',' ) ; Set < Integer > numSet = CollectUtils . newHashSet ( ) ; for ( int i = 0 ; i < numArray . length ; i ++ ) { String num = numArray [ i ] ; if ( num . contains ( "-" ) ) { String [ ] termFromTo = split ( num , '-' ) ; int from = Nu... |
public class DefaultGroovyMethods { /** * Finds all values matching the closure condition .
* < pre class = " groovyTestCase " > assert ( [ 2,4 ] as Set ) = = ( [ 1,2,3,4 ] as Set ) . findAll { it % 2 = = 0 } < / pre >
* @ param self a Set
* @ param closure a closure condition
* @ return a Set of matching value... | return ( Set < T > ) findAll ( ( Collection < T > ) self , closure ) ; |
public class AwsSecurityFindingFilters { /** * Specifies the type of the resource for which details are provided .
* @ param resourceType
* Specifies the type of the resource for which details are provided . */
public void setResourceType ( java . util . Collection < StringFilter > resourceType ) { } } | if ( resourceType == null ) { this . resourceType = null ; return ; } this . resourceType = new java . util . ArrayList < StringFilter > ( resourceType ) ; |
public class AmazonRoute53Client { /** * Gets information about all of the versions for a specified traffic policy .
* Traffic policy versions are listed in numerical order by < code > VersionNumber < / code > .
* @ param listTrafficPolicyVersionsRequest
* A complex type that contains the information about the re... | request = beforeClientExecution ( request ) ; return executeListTrafficPolicyVersions ( request ) ; |
public class WapitiCRFModel { /** * 加载特征标签转换
* @ param br
* @ return
* @ throws Exception */
private int [ ] loadTagCoven ( BufferedReader br ) throws Exception { } } | int [ ] conver = new int [ Config . TAG_NUM + Config . TAG_NUM * Config . TAG_NUM ] ; String temp = br . readLine ( ) ; // # qrk # 4
// TODO : 这个是个写死的过程 , 如果标签发生改变需要重新来写这里
for ( int i = 0 ; i < Config . TAG_NUM ; i ++ ) { char c = br . readLine ( ) . split ( ":" ) [ 1 ] . charAt ( 0 ) ; switch ( c ) { case 'S' : conver... |
import java . util . ArrayList ; import java . util . Collections ; public class AlternateExtremeSort { /** * Rearranges the list of integers in alternation of smallest and largest values , starting with the smallest .
* The process begins with the lowest value , followed by the highest of the remaining numbers , and... | ArrayList < Integer > result = new ArrayList < Integer > ( ) ; boolean toggle = true ; while ( ! inputList . isEmpty ( ) ) { if ( toggle ) { result . add ( Collections . min ( inputList ) ) ; } else { result . add ( Collections . max ( inputList ) ) ; } inputList . remove ( result . get ( result . size ( ) - 1 ) ) ; to... |
public class ForecastBreakdown { /** * Gets the startTime value for this ForecastBreakdown .
* @ return startTime * The starting time of the represented breakdown . */
public com . google . api . ads . admanager . axis . v201811 . DateTime getStartTime ( ) { } } | return startTime ; |
public class NtlmSsp { /** * Calls the static { @ link # authenticate ( CIFSContext , HttpServletRequest ,
* HttpServletResponse , byte [ ] ) } method to perform NTLM authentication
* for the specified servlet request .
* @ param tc
* @ param req
* The request being serviced .
* @ param resp
* The respons... | return authenticate ( tc , req , resp , challenge ) ; |
public class RadioConverter { /** * Constructor .
* @ param converter The next converter in the converter chain .
* @ param strTarget If the radio button is set , set this converter to this target string .
* @ param bTrueIfMatch If true , sets value on setState ( true ) , otherwise sets it to blank . */
public vo... | super . init ( converter , null , null ) ; m_objTarget = objTarget ; m_bTrueIfMatch = bTrueIfMatch ; |
public class SSLWriteServiceContext { /** * See method above . Extra parameter tells if the request was from a formerly queued request .
* @ param _ numBytes
* @ param userCallback
* @ param forceQueue
* @ param timeout
* @ param fromQueue
* @ return VirtualConnection */
protected VirtualConnection write ( ... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "writeAsync, numBytes=" + _numBytes + ", timeout=" + timeout + ", fromQueue=" + fromQueue + ", vc=" + getVCHash ( ) ) ; } VirtualConnection vc = null ; try { long numBytes = _numBytes ; // Handle timing out of former read req... |
public class VirtualMachineExtensionsInner { /** * The operation to update the extension .
* @ param resourceGroupName The name of the resource group .
* @ param vmName The name of the virtual machine where the extension should be updated .
* @ param vmExtensionName The name of the virtual machine extension .
*... | return beginUpdateWithServiceResponseAsync ( resourceGroupName , vmName , vmExtensionName , extensionParameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class AWSDeviceFarmClient { /** * Installs an application to the device in a remote access session . For Android applications , the file must be in
* . apk format . For iOS applications , the file must be in . ipa format .
* @ param installToRemoteAccessSessionRequest
* Represents the request to install an... | request = beforeClientExecution ( request ) ; return executeInstallToRemoteAccessSession ( request ) ; |
public class JobChangeLog { public static void setLogLevelDebug ( boolean logLevelDebug ) { } } | assertUnlocked ( ) ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "...Setting job-change logLevelDebug: " + logLevelDebug ) ; } _logLevelDebug = logLevelDebug ; lock ( ) ; // auto - lock here , because of deep world |
public class BackgroundCache { /** * Gets the value if currently in the cache . If not ,
* Runs the refresher immediately to obtain the result , then
* places an entry into the cache .
* @ return The result obtained from either the cache or this refresher
* @ see # get ( java . lang . Object )
* @ see # put (... | Result < V , E > result = get ( key ) ; if ( result == null ) result = put ( key , refresher ) ; return result ; |
public class RequestHelper { /** * Get the full URI ( excl . protocol ) and parameters of the passed request . < br >
* Example :
* < pre >
* / mywebapp / servlet / dir / a / b . xml = 123 ? d = 789
* < / pre >
* @ param aHttpRequest
* The request to use . May not be < code > null < / code > .
* @ return ... | ValueEnforcer . notNull ( aHttpRequest , "HttpRequest" ) ; final String sReqUrl = getRequestURI ( aHttpRequest ) ; final String sQueryString = ServletHelper . getRequestQueryString ( aHttpRequest ) ; // d = 789 & x = y
if ( StringHelper . hasText ( sQueryString ) ) return sReqUrl + URLHelper . QUESTIONMARK + sQueryStri... |
public class CmsSetupBean { /** * Returns html for the given component to fill the selection list . < p >
* @ param component the component to generate the code for
* @ return html code */
protected String htmlComponent ( CmsSetupComponent component ) { } } | StringBuffer html = new StringBuffer ( 256 ) ; html . append ( "\t<tr>\n" ) ; html . append ( "\t\t<td>\n" ) ; html . append ( "\t\t\t<input type='checkbox' name='availableComponents' value='" ) ; html . append ( component . getId ( ) ) ; html . append ( "'" ) ; if ( component . isChecked ( ) ) { html . append ( " chec... |
public class CmsFlexResponse { /** * This method is needed to process pages that can NOT be analyzed
* directly during delivering ( like JSP ) because they write to
* their own buffer . < p >
* In this case , we don ' t actually write output of include calls to the stream .
* Where there are include calls we wr... | byte [ ] result = getWriterBytes ( ) ; if ( ! hasIncludeList ( ) ) { // no include list , so no includes and we just use the bytes as they are in one block
m_cachedEntry . add ( result ) ; } else { // process the include list
int max = result . length ; int pos = 0 ; int last = 0 ; int size = 0 ; int count = 0 ; // wor... |
public class Metrics { /** * Generic method that posts a plugin to the metrics website */
private void postPlugin ( final boolean isPing ) throws IOException { } } | String serverVersion = getFullServerVersion ( ) ; int playersOnline = getPlayersOnline ( ) ; // END server software specific section - - all code below does not use any code outside of this class / Java
// Construct the post data
StringBuilder json = new StringBuilder ( 1024 ) ; json . append ( '{' ) ; // The plugin ' ... |
public class XesXmlSerializer { /** * Helper method , adds the given collection of attributes to the given Tag .
* @ param tag
* Tag to add attributes to .
* @ param attributes
* The attributes to add . */
protected void addAttributes ( SXTag tag , Collection < XAttribute > attributes ) throws IOException { } } | for ( XAttribute attribute : attributes ) { SXTag attributeTag ; if ( attribute instanceof XAttributeList ) { attributeTag = tag . addChildNode ( "list" ) ; attributeTag . addAttribute ( "key" , attribute . getKey ( ) ) ; } else if ( attribute instanceof XAttributeContainer ) { attributeTag = tag . addChildNode ( "cont... |
public class FailureMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Failure failure , ProtocolMarshaller protocolMarshaller ) { } } | if ( failure == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( failure . getArn ( ) , ARN_BINDING ) ; protocolMarshaller . marshall ( failure . getReason ( ) , REASON_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Una... |
public class AbstractJsonReader { /** * Parses the root bean .
* @ param input the JSON input
* @ param declaredType the declared type , not null
* @ return the bean , not null
* @ throws Exception if an error occurs */
< T > T parseRoot ( JsonInput input , Class < T > declaredType ) throws Exception { } } | this . input = input ; Object parsed = parseObject ( input . acceptEvent ( JsonEvent . OBJECT ) , declaredType , null , null , null , true ) ; return declaredType . cast ( parsed ) ; |
public class ConsistentColor { /** * Return the consistent RGB color value for the input .
* This method respects the color vision deficiency mode set by the user .
* @ param input input string ( for example username )
* @ param settings the settings for consistent color creation .
* @ return consistent color o... | double angle = createAngle ( input ) ; double correctedAngle = applyColorDeficiencyCorrection ( angle , settings . getDeficiency ( ) ) ; double [ ] CbCr = angleToCbCr ( correctedAngle ) ; float [ ] rgb = CbCrToRGB ( CbCr , Y ) ; return rgb ; |
public class BaseNDArrayProxy { /** * Custom deserialization for Java serialization */
protected void read ( ObjectInputStream s ) throws IOException , ClassNotFoundException { } } | val header = BaseDataBuffer . readHeader ( s ) ; data = Nd4j . createBuffer ( header . getRight ( ) , length , false ) ; data . read ( s , header . getLeft ( ) , header . getMiddle ( ) , header . getRight ( ) ) ; |
public class PDBFileParser { /** * Handler for CONECT Record Format
* < pre >
* COLUMNS DATA TYPE FIELD DEFINITION
* 1 - 6 Record name " CONECT "
* 7 - 11 Integer serial Atom serial number
* 12 - 16 Integer serial Serial number of bonded atom
* 17 - 21 Integer serial Serial number of bonded atom
* 22 - 26... | if ( atomOverflow ) { return ; } if ( params . isHeaderOnly ( ) ) { return ; } // this try . . catch is e . g . to catch 1gte which has wrongly formatted lines . . .
try { int atomserial = Integer . parseInt ( line . substring ( 6 , 11 ) . trim ( ) ) ; Integer bond1 = conect_helper ( line , 11 , 16 ) ; Integer bond2 = ... |
public class Select { /** * Clear all selected entries . This is only valid when the SELECT supports multiple selections .
* @ throws UnsupportedOperationException If the SELECT does not support multiple selections */
@ Override public void deselectAll ( ) { } } | if ( ! isMultiple ( ) ) { throw new UnsupportedOperationException ( "You may only deselect all options of a multi-select" ) ; } for ( WebElement option : getOptions ( ) ) { setSelected ( option , false ) ; } |
public class ScanlineFiller { /** * Fills area starting at xx , yy . Pixels fullfilling target are replaced with
* replacement color .
* @ param xx
* @ param yy
* @ param target
* @ param replacement */
public void floodFill ( int xx , int yy , IntPredicate target , int replacement ) { } } | floodFill ( xx , yy , 0 , 0 , width , height , target , replacement ) ; |
public class XHTMLText { /** * Appends a tag that indicates the start of a new paragraph . This is usually rendered
* with two carriage returns , producing a single blank line in between the two paragraphs .
* @ param style the style of the paragraph
* @ return this . */
public XHTMLText appendOpenParagraphTag ( ... | text . halfOpenElement ( P ) ; text . optAttribute ( STYLE , style ) ; text . rightAngleBracket ( ) ; return this ; |
public class TransformProcess { /** * Infer the categories for the given record reader for a particular column
* Note that each " column index " is a column in the context of :
* List < Writable > record = . . . ;
* record . get ( columnIndex ) ;
* Note that anything passed in as a column will be automatically ... | Set < String > categories = new HashSet < > ( ) ; while ( recordReader . hasNext ( ) ) { List < Writable > next = recordReader . next ( ) ; categories . add ( next . get ( columnIndex ) . toString ( ) ) ; } // Sort categories alphabetically - HashSet and RecordReader orders are not deterministic in general
List < Strin... |
public class DraggableView { /** * Modify dragged view alpha based on the horizontal position while the view is being
* horizontally dragged . */
void changeDragViewViewAlpha ( ) { } } | if ( enableHorizontalAlphaEffect ) { float alpha = 1 - getHorizontalDragOffset ( ) ; if ( alpha == 0 ) { alpha = 1 ; } ViewHelper . setAlpha ( dragView , alpha ) ; } |
public class TrustedAdvisorCategorySpecificSummaryMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TrustedAdvisorCategorySpecificSummary trustedAdvisorCategorySpecificSummary , ProtocolMarshaller protocolMarshaller ) { } } | if ( trustedAdvisorCategorySpecificSummary == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( trustedAdvisorCategorySpecificSummary . getCostOptimizing ( ) , COSTOPTIMIZING_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException (... |
public class CollapsedRequestSubject { /** * Set an ISE if a response is not yet received otherwise skip it
* @ param e A pre - generated exception . If this is null an ISE will be created and returned
* @ param exceptionMessage The message for the ISE */
public Exception setExceptionIfResponseNotReceived ( Excepti... | Exception exception = e ; if ( ! valueSet . get ( ) && ! isTerminated ( ) ) { if ( e == null ) { exception = new IllegalStateException ( exceptionMessage ) ; } setExceptionIfResponseNotReceived ( exception ) ; } // return any exception that was generated
return exception ; |
public class ConfigRestClientUtil { /** * 根据路径更新文档
* https : / / www . elastic . co / guide / en / elasticsearch / reference / current / docs - update . html
* @ param path test / _ doc / 1
* test / _ doc / 1 / _ update
* @ param templateName
* @ return
* @ throws ElasticSearchException */
public String upd... | try { return this . client . executeHttp ( path , ESTemplateHelper . evalTemplate ( esUtil , templateName , ( Object ) null ) , ClientUtil . HTTP_POST ) ; } catch ( ElasticSearchException e ) { return ResultUtil . hand404HttpRuntimeException ( e , String . class , ResultUtil . OPERTYPE_updateDocument ) ; } |
public class StubAmpBean { /** * @ Override
* public void onSaveEnd ( boolean isComplete )
* SaveResult saveResult = new SaveResult ( result ) ;
* _ stubClass . checkpointStart ( this , saveResult . addBean ( ) ) ;
* onSaveChildren ( saveResult ) ;
* saveResult . completeBean ( ) ; */
@ Override public Object... | StubContainerAmp container = childContainer ( ) ; if ( container == null ) { return null ; } ServiceRef serviceRef = container . getService ( path ) ; if ( serviceRef != null ) { return serviceRef ; } Object value = _stubClass . onLookup ( this , path ) ; if ( value == null ) { return null ; } else if ( value instanceo... |
public class DateTimeRange { /** * Sets the startDateTime value for this DateTimeRange .
* @ param startDateTime * The start date time of this range . This field is optional and
* if it is not set then there is no
* lower bound on the date time range . If this field
* is not set then { @ code endDateTime } must... | this . startDateTime = startDateTime ; |
public class Tuple4 { /** * Split this tuple into two tuples of degree 1 and 3. */
public final Tuple2 < Tuple1 < T1 > , Tuple3 < T2 , T3 , T4 > > split1 ( ) { } } | return new Tuple2 < > ( limit1 ( ) , skip1 ( ) ) ; |
public class CFG { /** * Returns a collection of locations , ordered according to the compareTo
* ordering over locations . If you want to list all the locations in a CFG
* for debugging purposes , this is a good order to do so in .
* @ return collection of locations */
public Collection < Location > orderedLocat... | TreeSet < Location > tree = new TreeSet < > ( ) ; for ( Iterator < Location > locs = locationIterator ( ) ; locs . hasNext ( ) ; ) { Location loc = locs . next ( ) ; tree . add ( loc ) ; } return tree ; |
public class ValueEnforcer { /** * Check that the passed { @ link Collection } is neither < code > null < / code > nor
* empty .
* @ param < T >
* Type to be checked and returned
* @ param aValue
* The String to check .
* @ param aName
* The name of the value ( e . g . the parameter name )
* @ return Th... | notNull ( aValue , aName ) ; if ( isEnabled ( ) ) if ( aValue . isEmpty ( ) ) throw new IllegalArgumentException ( "The value of the collection '" + aName . get ( ) + "' may not be empty!" ) ; return aValue ; |
public class QueryServiceImpl { /** * Throw an exception if the parameter is missing .
* @ param value Value which is checked for null .
* @ param name The short name of parameter .
* @ param description A one line description of the meaing of the parameter . */
private void requiredParameter ( String value , Str... | if ( value == null ) { throw new WebApplicationException ( Response . status ( Response . Status . BAD_REQUEST ) . type ( MediaType . TEXT_PLAIN ) . entity ( "missing required parameter '" + name + "' (" + description + ")" ) . build ( ) ) ; } |
public class FirestoreAdminClient { /** * Creates a composite index . This returns a
* [ google . longrunning . Operation ] [ google . longrunning . Operation ] which may be used to track the
* status of the creation . The metadata for the operation will be the type
* [ IndexOperationMetadata ] [ google . firesto... | CreateIndexRequest request = CreateIndexRequest . newBuilder ( ) . setParent ( parent ) . setIndex ( index ) . build ( ) ; return createIndex ( request ) ; |
public class ParticipantRepository { /** * Replies all the addresses from the inside of this repository .
* @ return the addresses in this repository . */
protected SynchronizedSet < ADDRESST > getAdresses ( ) { } } | final Object mutex = mutex ( ) ; synchronized ( mutex ) { return Collections3 . synchronizedSet ( this . listeners . keySet ( ) , mutex ) ; } |
public class FessMessages { /** * Add the created action message for the key ' errors . design _ file _ is _ unsupported _ type ' with parameters .
* < pre >
* message : The kind of file is unsupported .
* < / pre >
* @ param property The property name for the message . ( NotNull )
* @ return this . ( NotNull... | assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( ERRORS_design_file_is_unsupported_type ) ) ; return this ; |
public class MRCompactor { /** * A { @ link Dataset } should be verified if its not already compacted , and it satisfies the blacklist and whitelist . */
private boolean shouldVerifyCompletenessForDataset ( Dataset dataset , List < Pattern > blacklist , List < Pattern > whitelist ) { } } | boolean renamingRequired = this . state . getPropAsBoolean ( COMPACTION_RENAME_SOURCE_DIR_ENABLED , DEFAULT_COMPACTION_RENAME_SOURCE_DIR_ENABLED ) ; LOG . info ( "Should verify completeness with renaming source dir : " + renamingRequired ) ; return ! datasetAlreadyCompacted ( this . fs , dataset , renamingRequired ) &&... |
public class DataSet { /** * Initiates a Full Outer Join transformation .
* < p > An Outer Join transformation joins two elements of two
* { @ link DataSet DataSets } on key equality and provides multiple ways to combine
* joining elements into one DataSet .
* < p > Elements of < b > both < / b > DataSets that ... | switch ( strategy ) { case OPTIMIZER_CHOOSES : case REPARTITION_SORT_MERGE : case REPARTITION_HASH_FIRST : case REPARTITION_HASH_SECOND : return new JoinOperatorSetsBase < > ( this , other , strategy , JoinType . FULL_OUTER ) ; default : throw new InvalidProgramException ( "Invalid JoinHint for FullOuterJoin: " + strat... |
public class MemoryTracker { /** * This method returns precise amount of free memory on specified device
* @ param deviceId
* @ return */
public long getPreciseFreeMemory ( int deviceId ) { } } | // we refresh free memory on device
val extFree = NativeOpsHolder . getInstance ( ) . getDeviceNativeOps ( ) . getDeviceFreeMemory ( deviceId ) ; // freePerDevice . get ( deviceId ) . set ( extFree ) ;
return extFree ; |
public class RequestProcessorChain { /** * < p > Accepts the { @ link InvocationContext } given to { @ link # run ( Object . . . ) } } the { @ link RequestProcessorChain }
* and translates the request metadata to a concrete instance of { @ link HttpRequestBase } . The
* { @ link HttpRequestBase } , together with th... | InvocationContext context = assertAssignable ( assertNotEmpty ( args ) [ 0 ] , InvocationContext . class ) ; HttpRequestBase request = RequestUtils . translateRequestMethod ( context ) ; return root . getProcessor ( ) . run ( context , request ) ; // allow any exceptions to elevate to a chain - wide failure |
public class DuplicationMonitor { /** * Create the store manager to connect to this DuraCloud account instance */
private ContentStoreManager getStoreManager ( String host ) throws DBNotFoundException { } } | ContentStoreManager storeManager = new ContentStoreManagerImpl ( host , PORT , CONTEXT ) ; Credential credential = getRootCredential ( ) ; storeManager . login ( credential ) ; return storeManager ; |
public class SftpProtocolHandler { /** * { @ inheritDoc } */
@ Override public File downloadResource ( final String url , final String path ) throws ResourceDownloadError { } } | JSch jsch = new JSch ( ) ; String [ ] sftpPath = url . substring ( 7 ) . split ( "\\@" ) ; final String [ ] userCreds = sftpPath [ 0 ] . split ( "\\:" ) ; try { String host ; int port = ProtocolHandlerConstants . DEFAULT_SSH_PORT ; String filePath = sftpPath [ 1 ] . substring ( sftpPath [ 1 ] . indexOf ( '/' ) ) ; Stri... |
public class ClassLoadingMetricSet { /** * Registers all the metrics in this metric pack .
* @ param metricsRegistry the MetricsRegistry upon which the metrics are registered . */
public static void register ( MetricsRegistry metricsRegistry ) { } } | checkNotNull ( metricsRegistry , "metricsRegistry" ) ; ClassLoadingMXBean mxBean = ManagementFactory . getClassLoadingMXBean ( ) ; metricsRegistry . register ( mxBean , "classloading.loadedClassesCount" , MANDATORY , ClassLoadingMXBean :: getLoadedClassCount ) ; metricsRegistry . register ( mxBean , "classloading.total... |
public class TcpClientExample { /** * / * Thread , which sends characters and prints received responses to the console . */
private Thread getScannerThread ( ) { } } | return new Thread ( ( ) -> { Scanner scanIn = new Scanner ( System . in ) ; while ( true ) { String line = scanIn . nextLine ( ) ; if ( line . isEmpty ( ) ) { break ; } ByteBuf buf = ByteBuf . wrapForReading ( encodeAscii ( line + "\r\n" ) ) ; eventloop . execute ( ( ) -> socket . write ( buf ) ) ; } eventloop . execut... |
public class LineItemServiceLocator { /** * For the given interface , get the stub implementation .
* If this service has no port for the given interface ,
* then ServiceException is thrown . */
public java . rmi . Remote getPort ( Class serviceEndpointInterface ) throws javax . xml . rpc . ServiceException { } } | try { if ( com . google . api . ads . admanager . axis . v201902 . LineItemServiceInterface . class . isAssignableFrom ( serviceEndpointInterface ) ) { com . google . api . ads . admanager . axis . v201902 . LineItemServiceSoapBindingStub _stub = new com . google . api . ads . admanager . axis . v201902 . LineItemServi... |
public class AtomContainer { /** * { @ inheritDoc } */
@ Override public IBond removeBond ( int position ) { } } | IBond bond = bonds [ position ] ; for ( int i = position ; i < bondCount - 1 ; i ++ ) { bonds [ i ] = bonds [ i + 1 ] ; } bonds [ bondCount - 1 ] = null ; bondCount -- ; return bond ; |
public class DailyTimeIntervalTrigger { /** * Returns the final time at which the < code > DailyTimeIntervalTrigger < / code >
* will fire , if there is no end time set , null will be returned .
* Note that the return time may be in the past . */
@ Override public Date getFinalFireTime ( ) { } } | if ( m_bComplete || getEndTime ( ) == null ) { return null ; } // We have an endTime , we still need to check to see if there is a
// endTimeOfDay if that ' s applicable .
Date eTime = getEndTime ( ) ; if ( m_aEndTimeOfDay != null ) { final Date endTimeOfDayDate = m_aEndTimeOfDay . getTimeOfDayForDate ( eTime ) ; if ( ... |
public class StoreConfig { /** * Saves configuration to a properties file in a format suitable for using { { @ link # load ( File ) } .
* @ param propertiesFile - a configuration properties file
* @ param comments - a description of the configuration
* @ throws IOException */
public void save ( File propertiesFil... | FileWriter writer = new FileWriter ( propertiesFile ) ; _properties . store ( writer , comments ) ; writer . close ( ) ; |
public class SeqServerGroup { /** * The substring method will create a copy of the substring in JDK 8 and probably newer
* versions . To reduce the number of allocations we use a char buffer to return a view
* with just that subset . */
private static CharSequence substr ( CharSequence str , int s , int e ) { } } | return ( s >= e ) ? null : CharBuffer . wrap ( str , s , e ) ; |
public class CreateClusterRequest { /** * Sets the type of storage used by this cluster to serve its parent instance ' s tables . Defaults
* to { @ code SSD } . */
@ SuppressWarnings ( "WeakerAccess" ) public CreateClusterRequest setStorageType ( @ Nonnull StorageType storageType ) { } } | Preconditions . checkNotNull ( storageType ) ; Preconditions . checkArgument ( storageType != StorageType . UNRECOGNIZED , "StorageType can't be UNRECOGNIZED" ) ; proto . getClusterBuilder ( ) . setDefaultStorageType ( storageType . toProto ( ) ) ; return this ; |
public class Configuration { /** * The matchers used to authorize the incoming requests in function of the referer . For example :
* < pre > < code >
* allowedReferers :
* - ! hostnameMatch
* host : example . com
* allowSubDomains : true
* < / code > < / pre >
* By default , the referer is not checked
*... | this . allowedReferers = matchers != null ? new UriMatchers ( matchers ) : null ; |
public class Packer { /** * Resize input buffer to newsize
* @ param buf
* @ param newsize
* @ return */
static final byte [ ] resizeBuffer ( final byte [ ] buf , final int newsize ) { } } | if ( buf . length == newsize ) return buf ; final byte [ ] newbuf = new byte [ newsize ] ; System . arraycopy ( buf , 0 , newbuf , 0 , Math . min ( buf . length , newbuf . length ) ) ; return newbuf ; |
public class SingleNodeCrossover { /** * The static method makes it easier to test . */
static < A > int swap ( final TreeNode < A > that , final TreeNode < A > other ) { } } | assert that != null ; assert other != null ; final Random random = RandomRegistry . getRandom ( ) ; final ISeq < TreeNode < A > > seq1 = that . breadthFirstStream ( ) . collect ( ISeq . toISeq ( ) ) ; final ISeq < TreeNode < A > > seq2 = other . breadthFirstStream ( ) . collect ( ISeq . toISeq ( ) ) ; final int changed... |
public class HtmlMessages { /** * < p > Return the value of the < code > warnClass < / code > property . < / p >
* < p > Contents : CSS style class to apply to any message
* with a severity class of " WARN " . */
public java . lang . String getWarnClass ( ) { } } | return ( java . lang . String ) getStateHelper ( ) . eval ( PropertyKeys . warnClass ) ; |
public class Logos { /** * { @ inheritDoc } */
@ Override public List < Integer > getIds ( ) { } } | List < Integer > result = new ArrayList < > ( ) ; for ( Logo logo : this ) { result . add ( logo . getNid ( ) ) ; } return result ; |
public class WhileyFileParser { /** * Parse a do - while statement , which has the form :
* < pre >
* DoWhileStmt : : = " do " ' : ' NewLine Block " where " Expr ( " where " Expr ) *
* < / pre >
* @ see wyc . lang . Stmt . DoWhile
* @ param scope
* The enclosing scope for this statement , which determines t... | int start = index ; match ( Do ) ; match ( Colon ) ; int end = index ; matchEndLine ( ) ; // match the block
Stmt . Block blk = parseBlock ( scope , true ) ; // match while and condition
match ( While ) ; Expr condition = parseLogicalExpression ( scope , false ) ; // Parse the loop invariants
Tuple < Expr > invariant =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.