signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ColorStateDrawable { /** * Given a particular color , adjusts its value by a multiplier . */
private int getPressedColor ( int color ) { } } | float [ ] hsv = new float [ 3 ] ; Color . colorToHSV ( color , hsv ) ; hsv [ 2 ] = hsv [ 2 ] * PRESSED_STATE_MULTIPLIER ; return Color . HSVToColor ( hsv ) ; |
public class LatchedObserver { /** * Create a LatchedObserver with the given callback function ( s ) . */
public static < T > LatchedObserver < T > create ( Action1 < ? super T > onNext , Action1 < ? super Throwable > onError ) { } } | return create ( onNext , onError , new CountDownLatch ( 1 ) ) ; |
public class GlobalTrafficShapingHandler { /** * Create the global TrafficCounter . */
void createGlobalTrafficCounter ( ScheduledExecutorService executor ) { } } | if ( executor == null ) { throw new NullPointerException ( "executor" ) ; } TrafficCounter tc = new TrafficCounter ( this , executor , "GlobalTC" , checkInterval ) ; setTrafficCounter ( tc ) ; tc . start ( ) ; |
public class WebSiteManagementClientImpl { /** * Gets list of available geo regions plus ministamps .
* Gets list of available geo regions plus ministamps .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the DeploymentLocationsInner object */
public Obser... | return getSubscriptionDeploymentLocationsWithServiceResponseAsync ( ) . map ( new Func1 < ServiceResponse < DeploymentLocationsInner > , DeploymentLocationsInner > ( ) { @ Override public DeploymentLocationsInner call ( ServiceResponse < DeploymentLocationsInner > response ) { return response . body ( ) ; } } ) ; |
public class PortTcp { /** * Starts the port listening . */
public void start ( ) throws Exception { } } | if ( _port < 0 && _unixPath == null ) { return ; } if ( ! _lifecycle . toStarting ( ) ) return ; boolean isValid = false ; try { bind ( ) ; postBind ( ) ; enable ( ) ; _acceptTask = new AcceptTcp ( this , _serverSocket ) ; _threadPool . execute ( _acceptTask ) ; // _ connThreadPool . start ( ) ;
_suspendAlarm = new Ala... |
public class MMFF94ParametersCall { /** * Gets the bond parameter set .
* @ param id1 atom1 id
* @ param id2 atom2 id
* @ return The distance value from the force field parameter set
* @ exception Exception Description of the Exception */
public List getBondData ( String code , String id1 , String id2 ) throws ... | String dkey = "" ; if ( pSet . containsKey ( ( "bond" + code + ";" + id1 + ";" + id2 ) ) ) { dkey = "bond" + code + ";" + id1 + ";" + id2 ; } else if ( pSet . containsKey ( ( "bond" + code + ";" + id2 + ";" + id1 ) ) ) { dkey = "bond" + code + ";" + id2 + ";" + id1 ; } /* * else { System . out . println ( " KEYError : ... |
public class Check { /** * Check if < code > a < / code > is superior to < code > b < / code > .
* @ param a The parameter to test .
* @ param b The parameter to compare to .
* @ throws LionEngineException If check failed . */
public static void superiorOrEqual ( double a , double b ) { } } | if ( a < b ) { throw new LionEngineException ( ERROR_ARGUMENT + String . valueOf ( a ) + ERROR_SUPERIOR + String . valueOf ( b ) ) ; } |
public class Flowable { /** * Mirrors the Publisher ( current or provided ) that first either emits an item or sends a termination
* notification .
* < img width = " 640 " height = " 385 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / amb . png " alt = " " >
* < dl... | ObjectHelper . requireNonNull ( other , "other is null" ) ; return ambArray ( this , other ) ; |
public class TinkerpopBackend { /** * Updates the properties of the element , disregarding any changes of the disallowed properties
* < p > The list of the disallowed properties will usually come from
* { @ link Constants . Type # getMappedProperties ( ) } .
* @ param e the element to update properties of
* @ p... | if ( properties == null ) { return ; } Set < String > disallowed = new HashSet < > ( Arrays . asList ( disallowedProperties ) ) ; // remove all non - mapped properties , that are not in the update
Spliterator < Property < ? > > sp = Spliterators . spliteratorUnknownSize ( e . properties ( ) , Spliterator . NONNULL & Sp... |
public class ReflectionUtils { /** * Calls the method with the specified name on the given object . This method assumes the " method " to invoke
* is an instance ( object ) member method .
* @ param obj the Object on which the method to invoke is defined .
* @ param methodName a String indicating the name of the ... | invoke ( obj , methodName , null , null , Void . class ) ; |
public class FindingReplacing { /** * Sets the substring in the beginning and given right index as the search string
* @ see Indexer # before ( int )
* @ param rightIndex
* @ return */
public NegateMultiPos < S , Integer , Integer > before ( int rightIndex ) { } } | return new NegateMultiPos < S , Integer , Integer > ( 0 , rightIndex ) { @ Override protected S result ( ) { return aQueue ( 'J' , left , right , pos , position , null , plusminus , filltgt ) ; } } ; |
public class ReflectUtil { /** * 尝试遍历并调用此类的所有构造方法 , 直到构造成功并返回
* @ param < T > 对象类型
* @ param beanClass 被构造的类
* @ return 构造后的对象 */
public static < T > T newInstanceIfPossible ( Class < T > beanClass ) { } } | Assert . notNull ( beanClass ) ; try { return newInstance ( beanClass ) ; } catch ( Exception e ) { // ignore
// 默认构造不存在的情况下查找其它构造
} final Constructor < T > [ ] constructors = getConstructors ( beanClass ) ; Class < ? > [ ] parameterTypes ; for ( Constructor < T > constructor : constructors ) { parameterTypes = constru... |
public class Main { /** * Entry point for embedded applications . This method attaches
* to the given { @ link ContextFactory } with the given scope . No
* I / O redirection is performed as with { @ link # main ( String [ ] ) } . */
public static Main mainEmbedded ( ContextFactory factory , ScopeProvider scopeProvi... | return mainEmbeddedImpl ( factory , scopeProvider , title ) ; |
public class JDBCResultSet { /** * < ! - - start generic documentation - - >
* Updates the designated column with a < code > java . sql . Timestamp < / code >
* value .
* The updater methods are used to update column values in the
* current row or the insert row . The updater methods do not
* update the under... | startUpdate ( columnIndex ) ; preparedStatement . setParameter ( columnIndex , x ) ; |
public class ClusterSecurityGroup { /** * A list of EC2 security groups that are permitted to access clusters associated with this cluster security group .
* @ return A list of EC2 security groups that are permitted to access clusters associated with this cluster security
* group . */
public java . util . List < EC... | if ( eC2SecurityGroups == null ) { eC2SecurityGroups = new com . amazonaws . internal . SdkInternalList < EC2SecurityGroup > ( ) ; } return eC2SecurityGroups ; |
public class KerasModelImport { /** * Load Keras Sequential model for which the configuration and weights were
* saved separately using calls to model . to _ json ( ) and model . save _ weights ( . . . ) .
* @ param modelJsonFilename path to JSON file storing Keras Sequential model configuration
* @ param weights... | KerasSequentialModel kerasModel = new KerasSequentialModel ( ) . modelBuilder ( ) . modelJsonFilename ( modelJsonFilename ) . weightsHdf5FilenameNoRoot ( weightsHdf5Filename ) . enforceTrainingConfig ( enforceTrainingConfig ) . buildSequential ( ) ; return kerasModel . getMultiLayerNetwork ( ) ; |
public class FileEventStore { /** * Gets an array containing all of the files in the given directory .
* @ param dir A directory .
* @ return An array containing all of the files in the given directory . */
private File [ ] getFilesInDir ( File dir ) { } } | return dir . listFiles ( new FileFilter ( ) { public boolean accept ( File file ) { return file . isFile ( ) && ! file . getName ( ) . equals ( ATTEMPTS_JSON_FILE_NAME ) ; } } ) ; |
public class MessageReader { /** * Extracts the message body and interprets it
* as the given number ( e . g . Integer ) .
* @ param type The number type
* @ return The message body as the specified number */
@ SuppressWarnings ( "unchecked" ) public < T extends Number > T readBodyAsNumber ( Class < T > type ) { ... | String messageContent = readBodyAndValidateForNumber ( ) ; if ( type . equals ( BigDecimal . class ) ) { return ( T ) new BigDecimal ( messageContent ) ; } else if ( type . equals ( BigInteger . class ) ) { return ( T ) new BigInteger ( messageContent ) ; } else if ( type . equals ( Byte . class ) ) { return ( T ) Byte... |
public class StreamExecutionEnvironment { /** * Creates a data stream from the given iterator .
* < p > Because the iterator will remain unmodified until the actual execution happens ,
* the type of data returned by the iterator must be given explicitly in the form of the type
* class ( this is due to the fact th... | return fromCollection ( data , TypeExtractor . getForClass ( type ) ) ; |
public class snmpalarm { /** * Use this API to fetch all the snmpalarm resources that are configured on netscaler . */
public static snmpalarm [ ] get ( nitro_service service ) throws Exception { } } | snmpalarm obj = new snmpalarm ( ) ; snmpalarm [ ] response = ( snmpalarm [ ] ) obj . get_resources ( service ) ; return response ; |
public class SecurityServiceImpl { /** * { @ inheritDoc } */
@ Override public UserRegistryService getUserRegistryService ( ) { } } | UserRegistryService service = userRegistryService . get ( ) ; if ( service == null ) { if ( isConfigurationDefinedInFile ( ) ) { String id = getEffectiveSecurityConfiguration ( ) . getUserRegistryServiceId ( ) ; service = getUserRegistryService ( id ) ; } else { service = autoDetectService ( KEY_USERREGISTRY , userRegi... |
public class FactoryKernelGaussian { /** * Creates a floating point Gaussian kernel with the sigma and radius .
* If normalized is set to true then the elements in the kernel will sum up to one .
* @ param sigma Distributions standard deviation .
* @ param radius Kernel ' s radius .
* @ param odd Does the kerne... | Kernel1D_F32 ret ; if ( odd ) { ret = new Kernel1D_F32 ( radius * 2 + 1 ) ; int index = 0 ; for ( int i = radius ; i >= - radius ; i -- ) { ret . data [ index ++ ] = ( float ) UtilGaussian . computePDF ( 0 , sigma , i ) ; } } else { ret = new Kernel1D_F32 ( radius * 2 ) ; int index = 0 ; for ( int i = radius ; i > - ra... |
public class CmsModelPageHelper { /** * Disables the given model page . < p >
* @ param sitemapConfig the configuration resource
* @ param structureId the model page id
* @ param disabled < code > true < / code > to disabe the entry
* @ throws CmsException if something goes wrong */
public void disableModelPage... | CmsFile sitemapConfigFile = m_cms . readFile ( sitemapConfig ) ; CmsXmlContent content = CmsXmlContentFactory . unmarshal ( m_cms , sitemapConfigFile ) ; CmsConfigurationReader reader = new CmsConfigurationReader ( m_cms ) ; reader . parseConfiguration ( m_adeConfig . getBasePath ( ) , content ) ; List < CmsModelPageCo... |
public class GregorianMath { /** * / * [ deutsch ]
* < p > Ermittelt das modifizierte julianische Datum . < / p >
* @ param year proleptic iso year [ ( - 99999 ) - 99999]
* @ param month gregorian month ( 1-12)
* @ param dayOfMonth day of month in range ( 1-31)
* @ return days since [ 1858-11-17 ] ( modified ... | checkDate ( year , month , dayOfMonth ) ; long y = year ; int m = month ; if ( m < 3 ) { y -- ; m += 12 ; } long days = ( ( y * 365 ) + Math . floorDiv ( y , 4 ) + ( ( ( m + 1 ) * 153 ) / 5 ) - 123 + dayOfMonth ) ; if ( ( year >= 1901 ) && ( year < 2100 ) ) { days -= 15 ; } else { days = days - Math . floorDiv ( y , 10... |
public class ProtoParser { /** * Defaults aren ' t options . This finds an option named " default " , removes , and returns it . Returns
* null if no default option is present . */
private @ Nullable String stripDefault ( List < OptionElement > options ) { } } | String result = null ; for ( Iterator < OptionElement > i = options . iterator ( ) ; i . hasNext ( ) ; ) { OptionElement option = i . next ( ) ; if ( option . getName ( ) . equals ( "default" ) ) { i . remove ( ) ; result = String . valueOf ( option . getValue ( ) ) ; // Defaults aren ' t options !
} } return result ; |
public class RunTime { /** * Add one run time to a specified detail record . < br >
* 给指定的详细记录增加一次RunTime 。
* @ param descDescription of the detail record . < br >
* 详细记录的Description
* @ param milliStartTimeStart time in milliseconds ( usually from System . currentTimeMillis ( ) )
* @ param nanoDurationTimeRu... | this . getDetail ( desc ) . add ( milliStartTime , nanoDurationTime ) ; |
public class CommandLineArgumentParser { /** * helper to deal with the case of special flags that are evaluated before the options are properly set */
private boolean isSpecialFlagSet ( final OptionSet parsedArguments , final String flagName ) { } } | if ( parsedArguments . has ( flagName ) ) { Object value = parsedArguments . valueOf ( flagName ) ; return ( value == null || ! value . equals ( "false" ) ) ; } else { return false ; } |
public class CassQuery { /** * Prepare index clause .
* @ param m
* the m
* @ param isQueryForInvertedIndex
* the is query for inverted index
* @ return the map */
Map < Boolean , List < IndexClause > > prepareIndexClause ( EntityMetadata m , boolean isQueryForInvertedIndex ) { } } | IndexClause indexClause = new IndexClause ( new ArrayList < IndexExpression > ( ) , ByteBufferUtil . EMPTY_BYTE_BUFFER , maxResult ) ; List < IndexClause > clauses = new ArrayList < IndexClause > ( ) ; List < IndexExpression > expr = new ArrayList < IndexExpression > ( ) ; Map < Boolean , List < IndexClause > > idxClau... |
public class EvolutionResult { /** * Return a mapping function , which removes duplicate individuals from the
* population and replaces it with newly created one by the given genotype
* { @ code factory } .
* < pre > { @ code
* final Problem < Double , DoubleGene , Integer > problem = . . . ;
* final Engine <... | return toUniquePopulation ( factory , 100 ) ; |
public class CmsSitemapTreeNode { /** * Shows or hides the opener button . < p >
* @ param visible true if the opener should be shown , else false */
public void setOpenerVisible ( boolean visible ) { } } | if ( visible ) { m_opener . removeStyleName ( OpenCmsTheme . BUTTON_INVISIBLE ) ; } else { m_opener . addStyleName ( OpenCmsTheme . BUTTON_INVISIBLE ) ; } |
public class StandardSocketServer { /** * Starts the service . Instantiates a server socket and starts a thread that
* handles incoming client connections . */
public void start ( ) throws ConfigurationException { } } | if ( connectionFactory == null ) { throw new ConfigurationException ( "can not start without client socket factory" ) ; } try { server = new ServerSocket ( port ) ; } catch ( IOException e ) { System . out . println ( new LogEntry ( e . getMessage ( ) , e ) ) ; throw new ConfigurationException ( "Cannot start server at... |
public class TransactionOutPoint { /** * Returns the RedeemData identified in the connected output , for either P2PKH , P2WPKH , P2PK
* or P2SH scripts .
* If the script forms cannot be understood , throws ScriptException .
* @ return a RedeemData or null if the connected data cannot be found in the wallet . */
@... | TransactionOutput connectedOutput = getConnectedOutput ( ) ; checkNotNull ( connectedOutput , "Input is not connected so cannot retrieve key" ) ; Script connectedScript = connectedOutput . getScriptPubKey ( ) ; if ( ScriptPattern . isP2PKH ( connectedScript ) ) { byte [ ] addressBytes = ScriptPattern . extractHashFromP... |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public FNCXUnitBase createFNCXUnitBaseFromString ( EDataType eDataType , String initialValue ) { } } | FNCXUnitBase result = FNCXUnitBase . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class PrimaveraPMFileReader { /** * Render a zero Double as null .
* @ param value double value
* @ return null if the double value is zero */
private Double zeroIsNull ( Double value ) { } } | if ( value != null && value . doubleValue ( ) == 0 ) { value = null ; } return value ; |
public class NamingUtils { /** * Converts snake case string ( lower or upper ) to camel case ,
* for example ' hello _ world ' or ' HELLO _ WORLD ' - > ' helloWorld ' or ' HelloWorld ' .
* @ param snake Input string .
* @ param upper True if result snake cased string should be upper cased like ' HelloWorld ' . */... | StringBuilder sb = new StringBuilder ( ) ; boolean firstWord = true ; for ( String word : snake . split ( "_" ) ) { if ( ! word . isEmpty ( ) ) { if ( firstWord && ! upper ) { sb . append ( word . toLowerCase ( ) ) ; } else { sb . append ( Character . toUpperCase ( word . charAt ( 0 ) ) ) . append ( word . substring ( ... |
public class TimerNpImpl { /** * Returns the timer reference that was represented by a TimerHandle
* obtained from { @ link # getSerializableObject ( ) } . For non - persistent
* timers , a serialized TimerHandle always represents a Timer ; never
* a TimerHandle . < p >
* This method is intended for use by the ... | // Look first for existing timer ( in all 3 places )
// If not found , THEN new TimerNpImpl , but with new ctor to set
// ivDestroyed = true , since this timer will never run
// F743-22582
// A stateful session bean may have a reference to a non - persistent Timer .
// By definition , a non - persistent Timer only exis... |
public class ResourceBundlesHandlerImpl { /** * ( non - Javadoc )
* @ see
* net . jawr . web . resource . bundle . handler . ResourceBundlesHandler # writeBundleTo
* ( java . lang . String , java . io . Writer ) */
@ Override public void writeBundleTo ( String bundlePath , Writer writer ) throws ResourceNotFoundE... | Reader rd = null ; try { // If debug mode is on , resources are retrieved one by one .
if ( config . isDebugModeOn ( ) ) { rd = resourceHandler . getResource ( null , bundlePath ) ; } else { for ( String prefix : bundlePrefixes ) { if ( bundlePath . startsWith ( prefix ) ) { bundlePath = bundlePath . substring ( prefix... |
public class DeprecationStatus { /** * Returns the timestamp ( in milliseconds since epoch ) on or after which the deprecation state of
* this resource will be changed to { @ link Status # DEPRECATED } . Returns { @ code null } if not set .
* @ throws IllegalStateException if { @ link # getDeprecated ( ) } is not a... | try { return deprecated != null ? TIMESTAMP_FORMATTER . parse ( deprecated , Instant . FROM ) . toEpochMilli ( ) : null ; } catch ( DateTimeParseException ex ) { throw new IllegalStateException ( ex . getMessage ( ) , ex ) ; } |
public class TextAnalyticsImpl { /** * The API returns the detected language and a numeric score between 0 and 1.
* Scores close to 1 indicate 100 % certainty that the identified language is true . A total of 120 languages are supported .
* @ param documents the List & lt ; Input & gt ; value
* @ throws IllegalAr... | if ( this . client . azureRegion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.azureRegion() is required and cannot be null." ) ; } Validator . validate ( documents ) ; BatchInput input = new BatchInput ( ) ; input . withDocuments ( documents ) ; String parameterizedHost = Joiner . on ( ",... |
public class Shortcode { /** * Parse an arbitrary string .
* @ param str The string .
* @ param handler The handler for parse events . */
public static void parse ( final String str , final ShortcodeParser . Handler handler ) { } } | ShortcodeParser . parse ( str , handler ) ; |
public class PropertiesWriter { /** * Appends a property to be written .
* @ param key key of property
* @ param value value of property
* @ return self for a fluent api
* @ throws NullArgumentException if key is null or empty */
public PropertiesWriter append ( final String key , final String value ) { } } | NullArgumentException . validateNotEmpty ( key , "Key" ) ; String valueToAdd = value ; if ( value == null ) { valueToAdd = "" ; } Integer position = m_positions . get ( key ) ; List < String > values = m_values . get ( key ) ; if ( values == null ) { values = new ArrayList < String > ( ) ; m_values . put ( key , values... |
public class MessageProcessor { /** * This lifecycle phase is implemented by invoking the { @ link Mp # shouldBeEvicted ( ) } method on the instance
* @ see MessageProcessorLifecycle # invokeEvictable ( Object ) */
@ Override public boolean invokeEvictable ( final Mp instance ) throws DempsyException { } } | try { return instance . shouldBeEvicted ( ) ; } catch ( final RuntimeException rte ) { throw new DempsyException ( rte , true ) ; } |
public class FodselsnummerCalculator { /** * Returns a List with valid Fodselsnummer instances for a given Date and gender . */
public static List < Fodselsnummer > getFodselsnummerForDateAndGender ( Date date , KJONN kjonn ) { } } | List < Fodselsnummer > result = getManyFodselsnummerForDate ( date ) ; splitByGender ( kjonn , result ) ; return result ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link TimeTopologyComplexType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link TimeTopologyComplexType ... | return new JAXBElement < TimeTopologyComplexType > ( _TimeTopologyComplex_QNAME , TimeTopologyComplexType . class , null , value ) ; |
public class References { /** * Gets all component references that match specified locator and matching to
* the specified type .
* @ param type the Class type that defined the type of the result .
* @ param locator the locator to find references by .
* @ return a list with matching component references or empt... | try { return find ( type , locator , false ) ; } catch ( Exception ex ) { return new ArrayList < T > ( ) ; } |
public class AbstractEviction { /** * Exceptions have the minimum weight . */
private long calculateWeight ( final Entry e , final Object v ) { } } | long _weight ; if ( v instanceof ExceptionWrapper ) { _weight = 1 ; } else { _weight = weigher . weigh ( e . getKey ( ) , v ) ; } if ( _weight < 0 ) { throw new IllegalArgumentException ( "weight must be positive." ) ; } return _weight ; |
public class PersistentExecutorImpl { /** * { @ inheritDoc } */
@ Override public boolean setProperty ( String name , String value ) { } } | if ( value == null || value . length ( ) == 0 ) throw new IllegalArgumentException ( "value: " + value ) ; boolean exists = false ; if ( name != null && name . length ( ) > 0 ) { TransactionController tranController = new TransactionController ( ) ; try { tranController . preInvoke ( ) ; exists = taskStore . setPropert... |
public class BaseTransport { /** * Convert this encoded string back to a Java Object .
* @ param string The string to convert .
* @ return The java object . */
public Object stringToObject ( String string ) { } } | Object obj = BaseTransport . convertStringToObject ( string ) ; return obj ; |
public class Tuple5 { /** * Creates a new tuple and assigns the given values to the tuple ' s fields .
* This is more convenient than using the constructor , because the compiler can
* infer the generic type arguments implicitly . For example :
* { @ code Tuple3 . of ( n , x , s ) }
* instead of
* { @ code ne... | return new Tuple5 < > ( value0 , value1 , value2 , value3 , value4 ) ; |
public class MetricsUtil { /** * Escapes a user - supplied string value that is to be used as metrics key
* tag or value .
* Prefixes comma ( { @ code " , " } ) , equals sign ( { @ code " = " } ) and backslash
* ( { @ code " \ " } ) with another backslash . */
@ Nonnull public static String escapeMetricNamePart (... | int i = 0 ; int l = namePart . length ( ) ; while ( i < l ) { char ch = namePart . charAt ( i ) ; if ( ch == ',' || ch == '=' || ch == '\\' ) { break ; } i ++ ; } if ( i == l ) { return namePart ; } StringBuilder sb = new StringBuilder ( namePart . length ( ) + 3 ) ; sb . append ( namePart , 0 , i ) ; while ( i < l ) {... |
public class GosuStringUtil { /** * < p > Find the first index of any of a set of potential substrings . < / p >
* < p > A < code > null < / code > String will return < code > - 1 < / code > .
* A < code > null < / code > or zero length search array will return < code > - 1 < / code > .
* A < code > null < / code... | if ( ( str == null ) || ( searchStrs == null ) ) { return - 1 ; } int sz = searchStrs . length ; // String ' s can ' t have a MAX _ VALUEth index .
int ret = Integer . MAX_VALUE ; int tmp = 0 ; for ( int i = 0 ; i < sz ; i ++ ) { String search = searchStrs [ i ] ; if ( search == null ) { continue ; } tmp = str . indexO... |
public class StatusReference { /** * Start constructing a new { @ link StatusReference } .
* @ param statusUrl the status url for the job
* @ return partially constructed { @ link StatusReference } which
* must be completed with a status query token using
* { @ link StatusUrlContruction # withStatusQueryToken (... | return new StatusUrlContruction ( ) { @ Override public StatusReference withStatusQueryToken ( String token ) { return new StatusReference ( statusUrl , token ) ; } } ; |
public class Fat { /** * Allocate a cluster for a new file
* @ return long the number of the newly allocated cluster
* @ throws IOException if there are no free clusters */
public long allocNew ( ) throws IOException { } } | int i ; int entryIndex = - 1 ; for ( i = lastAllocatedCluster ; i < lastClusterIndex ; i ++ ) { if ( isFreeCluster ( i ) ) { entryIndex = i ; break ; } } if ( entryIndex < 0 ) { for ( i = FIRST_CLUSTER ; i < lastAllocatedCluster ; i ++ ) { if ( isFreeCluster ( i ) ) { entryIndex = i ; break ; } } } if ( entryIndex < 0 ... |
public class SignatureUtil { /** * Scans the given string for a type argument signature starting at the given
* index and returns the index of the last character .
* < pre >
* TypeArgumentSignature :
* < b > & # 42 ; < / b >
* | < b > + < / b > TypeSignature
* | < b > - < / b > TypeSignature
* | TypeSigna... | // need a minimum 1 char
if ( start >= string . length ( ) ) { throw new IllegalArgumentException ( ) ; } char c = string . charAt ( start ) ; switch ( c ) { case C_STAR : return start ; case C_EXTENDS : case C_SUPER : return scanTypeBoundSignature ( string , start ) ; default : return scanTypeSignature ( string , star... |
public class EventTimeTrigger { /** * If a watermark arrives , we need to check all pending windows .
* If any of the pending window suffices , we should fire immediately by registering a timer without delay .
* Otherwise we register a timer whose time is the window end plus max lag time */
@ Override public Trigge... | ctx . registerEventTimeTimer ( window . getEnd ( ) + ctx . getMaxLagMs ( ) , window ) ; return TriggerResult . CONTINUE ; |
public class MultiMEProxyHandler { /** * Adds a message back into the Pool of available messages .
* @ param messageHandler The message handler to add back to the pool */
void addMessageHandler ( SubscriptionMessageHandler messageHandler ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addMessageHandler" , messageHandler ) ; final boolean inserted = _subscriptionMessagePool . add ( messageHandler ) ; // If the message wasn ' t inserted , then the pool was exceeded
if ( ! inserted ) if ( TraceComponent . i... |
public class WSEJBWrapper { /** * Performs all EJB Container processing required prior to invoking
* the specified EJB method . < p >
* This method will establish the proper EJB contexts for the method
* call ; including the Security context , Transaction context ,
* and Naming context ( java : comp / env ) , a... | // Validate the state , and input parameters
if ( ivMethod != null ) { throw new IllegalStateException ( "WSEJBEndpointManager.ejbPreInvoke called previously : " + ivMethod . getName ( ) ) ; } if ( method == null ) { throw new IllegalArgumentException ( "WSEJBEndpointManager.ejbPreInvoke requires a method" ) ; } if ( T... |
public class Replacer { /** * Takes all instances in text of the Pattern this was constructed with , and replaces them with substitution .
* @ param text a String , StringBuilder , or other CharSequence that may contain the text to replace
* @ return the post - replacement text */
public String replace ( CharSequen... | TextBuffer tb = wrap ( new StringBuilder ( text . length ( ) ) ) ; replace ( pattern . matcher ( text ) , substitution , tb ) ; return tb . toString ( ) ; |
public class LinearControl { /** * Generates a FieldCase [ min , min + 1 , . . . , max - 1 , max ] for every value within the allowed
* range .
* @ return a list that contains a FieldCase for every allowed value */
@ Override protected List < FieldCase > createCases ( ) { } } | List < FieldCase > list = Lists . newArrayListWithExpectedSize ( range . getRange ( ) * 2 + 2 ) ; for ( int i = range . getMin ( ) ; i <= range . getMax ( ) ; i ++ ) { list . add ( new FieldCase ( i ) ) ; } return list ; |
public class DatabaseManagerSwing { /** * This stuff is all quick , except for the refreshTree ( ) .
* This unit can be kicked off in main Gui thread . The refreshTree
* will be backgrounded and this method will return . */
public void connect ( Connection c ) { } } | schemaFilter = null ; if ( c == null ) { return ; } if ( cConn != null ) { try { cConn . close ( ) ; } catch ( SQLException e ) { // Added : ( weconsultants @ users )
CommonSwing . errorMessage ( e ) ; } } cConn = c ; // Added : ( weconsultants @ users ) Need to barrow to get the table rowcounts
rowConn = c ; try { dMe... |
public class FileExtractor { /** * Installs MicrosoftWebDriver . msi file as administrator in SELION _ HOME _ DIR and also deletes unwanted file and
* directory created by Msiexec .
* @ param msiFile
* the . msi file to extract
* @ return The path of installed MicrosoftWebDriver */
static String extractMsi ( St... | LOGGER . entering ( msiFile ) ; Process process = null ; String exeFilePath = null ; boolean isMsiExtracted = true ; try { process = Runtime . getRuntime ( ) . exec ( new String [ ] { "msiexec" , "/a" , msiFile , "/qn" , "TARGETDIR=" + SeLionConstants . SELION_HOME_DIR } ) ; process . waitFor ( ) ; } catch ( IOExceptio... |
public class CreateDeploymentJobRequest { /** * A map that contains tag keys and tag values that are attached to the deployment job .
* @ param tags
* A map that contains tag keys and tag values that are attached to the deployment job .
* @ return Returns a reference to this object so that method calls can be cha... | setTags ( tags ) ; return this ; |
public class NoCompTreeMap { /** * right ( son = = 1 ) link . Returns the old value attached to node . */
private final V remove_node ( BinTreeNode < K , V > node , BinTreeNode < K , V > prev , int son ) { } } | if ( node . left == null ) return remove_semi_leaf ( node , prev , son , node . right ) ; if ( node . right == null ) return remove_semi_leaf ( node , prev , son , node . left ) ; // The BinTreeNode to replace node in the tree . This is either the
// next or the precedent node ( in the order of the hashCode ' s .
// We... |
public class LocalTransactionCurrentService { /** * { @ inheritDoc } */
@ Override public void beginShareable ( boolean arg0 , boolean arg1 , boolean arg2 ) throws IllegalStateException { } } | if ( ltc != null ) { ltc . beginShareable ( arg0 , arg1 , arg2 ) ; } |
public class BufferedRandomAccessFile { /** * Reads the next BUF _ SIZE bytes into the internal buffer . */
private int fillBuffer ( ) throws IOException { } } | int n = super . read ( buffer , 0 , BUF_SIZE ) ; if ( n >= 0 ) { real_pos += n ; buf_end = n ; buf_pos = 0 ; } return n ; |
public class BloomFilterTermsSet { /** * Serialize the list of terms to the { @ link StreamOutput } .
* < br >
* Given the low performance of { @ link org . elasticsearch . common . io . stream . BytesStreamOutput } when writing a large number
* of longs ( 5 to 10 times slower than writing directly to a byte [ ] ... | // Encode flag
out . writeBoolean ( this . isPruned ( ) ) ; // Encode bloom filter
out . writeVInt ( set . numHashFunctions ) ; out . writeVInt ( set . hashing . type ( ) ) ; // hashType
out . writeVInt ( set . bits . data . length ) ; BytesRef buffer = new BytesRef ( new byte [ 1024 * 8 ] ) ; for ( long l : set . bits... |
public class ApacheHTTPClient { /** * This function creates the full URL from the provided values .
* @ param httpRequest
* The HTTP request to send
* @ param configuration
* HTTP client configuration
* @ return The full URL */
protected String createURL ( HTTPRequest httpRequest , HTTPClientConfiguration con... | // init buffer
StringBuilder buffer = new StringBuilder ( 100 ) ; // create URL
String resource = httpRequest . getResource ( ) ; this . appendBaseURL ( buffer , resource , configuration ) ; String parameters = httpRequest . getParametersText ( ) ; this . appendParameters ( buffer , parameters ) ; String url = buffer .... |
public class SubscriberInspector { /** * Report the subscription methods declared on the subscriber . */
public Set < Method > subscriptionsOn ( Object subscriber ) { } } | SubscriptionMethodFilter filter = new SubscriptionMethodFilter ( ) ; Class < ? > subscriberClass = subscriber . getClass ( ) ; List < Method > methods = Arrays . asList ( subscriberClass . getMethods ( ) ) ; Set < Method > subscriptions = new HashSet < Method > ( ) ; for ( Method method : methods ) { if ( filter . acce... |
public class IconDao { /** * Query for the icon row from a style mapping row
* @ param styleMappingRow
* style mapping row
* @ return icon row */
public IconRow queryForRow ( StyleMappingRow styleMappingRow ) { } } | IconRow iconRow = null ; UserCustomRow userCustomRow = queryForIdRow ( styleMappingRow . getRelatedId ( ) ) ; if ( userCustomRow != null ) { iconRow = getRow ( userCustomRow ) ; } return iconRow ; |
public class ContentSpecParser { /** * Parse a Content Specification to put the string into usable objects that can then be validate .
* @ param contentSpec A string representation of the Content Specification .
* @ param mode The mode in which the Content Specification should be parsed .
* @ return True if every... | return parse ( contentSpec , mode , false ) ; |
public class SubscriptionDefinitionImpl { /** * Returns the destination .
* @ return String */
public String getDestination ( ) { } } | if ( tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getDestination" ) ; SibTr . exit ( tc , "getDestination" , destination ) ; } return destination ; |
public class MetadataContext { /** * Invokes { @ link DatabaseMetaData # getProcedures ( java . lang . String , java . lang . String , java . lang . String ) } with given
* arguments and returns bound information .
* @ param catalog the value for { @ code catalog } parameter
* @ param schemaPattern the value for ... | final List < Procedure > list = new ArrayList < > ( ) ; try ( ResultSet results = databaseMetadata . getProcedures ( catalog , schemaPattern , procedureNamePattern ) ) { if ( results != null ) { bind ( results , Procedure . class , list ) ; } } return list ; |
public class BatchUtils { /** * 批量处理切分的时候 , 返回第index个List */
private static < E > List < E > getBatchList ( Integer index , int batchSize , Collection < E > collection ) { } } | List < E > list = null ; if ( collection instanceof List ) { list = ( List < E > ) collection ; } else { list = new ArrayList < E > ( collection ) ; } if ( index == list . size ( ) / batchSize ) { return list . subList ( index * batchSize , list . size ( ) ) ; } else { return list . subList ( index * batchSize , ( inde... |
public class FtpClient { /** * Perform list files operation and provide file information as response .
* @ param list
* @ param context
* @ return */
protected FtpMessage listFiles ( ListCommand list , TestContext context ) { } } | String remoteFilePath = Optional . ofNullable ( list . getTarget ( ) ) . map ( ListCommand . Target :: getPath ) . map ( context :: replaceDynamicContentInString ) . orElse ( "" ) ; try { List < String > fileNames = new ArrayList < > ( ) ; FTPFile [ ] ftpFiles ; if ( StringUtils . hasText ( remoteFilePath ) ) { ftpFile... |
public class QueryByCriteria { /** * Adds a groupby fieldName for ReportQueries .
* @ param fieldName The groupby to set */
public void addGroupBy ( String fieldName ) { } } | if ( fieldName != null ) { m_groupby . add ( new FieldHelper ( fieldName , false ) ) ; } |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public IfcAddressTypeEnum createIfcAddressTypeEnumFromString ( EDataType eDataType , String initialValue ) { } } | IfcAddressTypeEnum result = IfcAddressTypeEnum . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class Quicksort { /** * Routine that arranges the elements in ascending order around a pivot . This routine
* runs in O ( n ) time .
* @ param floatArray array that we want to sort
* @ param start index of the starting point to sort
* @ param end index of the end point to sort
* @ return an integer tha... | float pivot = floatArray [ end ] ; int index = start - 1 ; for ( int j = start ; j < end ; j ++ ) { if ( floatArray [ j ] <= pivot ) { index ++ ; TrivialSwap . swap ( floatArray , index , j ) ; } } TrivialSwap . swap ( floatArray , index + 1 , end ) ; return index + 1 ; |
public class DomainsInner { /** * Lists domain ownership identifiers .
* Lists domain ownership identifiers .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the Pa... | return listOwnershipIdentifiersNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < DomainOwnershipIdentifierInner > > , Observable < ServiceResponse < Page < DomainOwnershipIdentifierInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < DomainOwnershipIdentifier... |
public class FirstNonNullHelper { /** * Gets first result of function which is not null .
* @ param < T > type of values .
* @ param < R > element to return .
* @ param function function to apply to each value .
* @ param values all possible values to apply function to .
* @ return first result which was not ... | return values == null ? null : firstNonNull ( function , Stream . of ( values ) ) ; |
public class DroolsActivity { /** * Get knowledge base with no modifiers . */
protected KieBase getKnowledgeBase ( String name , String version ) throws ActivityException { } } | return getKnowledgeBase ( name , version , null ) ; |
public class DataUtil { /** * Method similar to { @ link # growArrayBy50Pct } , but it also ensures that
* the new size is at least as big as the specified minimum size . */
public static Object growArrayToAtLeast ( Object arr , int minLen ) { } } | if ( arr == null ) { throw new IllegalArgumentException ( NO_TYPE ) ; } Object old = arr ; int oldLen = Array . getLength ( arr ) ; int newLen = oldLen + ( ( oldLen + 1 ) >> 1 ) ; if ( newLen < minLen ) { newLen = minLen ; } arr = Array . newInstance ( arr . getClass ( ) . getComponentType ( ) , newLen ) ; System . arr... |
public class BaseActivity { /** * Set up a date time interpreter which will show short date values when in week view and long
* date values otherwise .
* @ param shortDate True if the date values should be short . */
private void setupDateTimeInterpreter ( final boolean shortDate ) { } } | mWeekView . setDateTimeInterpreter ( new DateTimeInterpreter ( ) { @ Override public String interpretDate ( Calendar date ) { SimpleDateFormat weekdayNameFormat = new SimpleDateFormat ( "EEE" , Locale . getDefault ( ) ) ; String weekday = weekdayNameFormat . format ( date . getTime ( ) ) ; SimpleDateFormat format = new... |
public class SensitiveUtil { /** * 初始化敏感词树
* @ param sensitiveWords 敏感词列表组成的字符串
* @ param isAsync 是否异步初始化
* @ param separator 分隔符 */
public static void init ( String sensitiveWords , char separator , boolean isAsync ) { } } | if ( StrUtil . isNotBlank ( sensitiveWords ) ) { init ( StrUtil . split ( sensitiveWords , separator ) , isAsync ) ; } |
public class BaseMessage { /** * Convert this external data format to the raw object and put it in the map .
* Typically overidden to return correctly converted data . */
public void put ( String strKey , Object strValue ) { } } | if ( this . getMessageFieldDesc ( strKey ) != null ) this . getMessageFieldDesc ( strKey ) . put ( strValue ) ; else this . putNative ( strKey , strValue ) ; |
public class AbstractCassandraStorage { /** * Deconstructs a composite type to a Tuple . */
protected Tuple composeComposite ( AbstractCompositeType comparator , ByteBuffer name ) throws IOException { } } | List < CompositeComponent > result = comparator . deconstruct ( name ) ; Tuple t = TupleFactory . getInstance ( ) . newTuple ( result . size ( ) ) ; for ( int i = 0 ; i < result . size ( ) ; i ++ ) setTupleValue ( t , i , cassandraToObj ( result . get ( i ) . comparator , result . get ( i ) . value ) ) ; return t ; |
public class DescribeScalingPlansRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeScalingPlansRequest describeScalingPlansRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeScalingPlansRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeScalingPlansRequest . getScalingPlanNames ( ) , SCALINGPLANNAMES_BINDING ) ; protocolMarshaller . marshall ( describeScalingPlansRequest . getScaling... |
public class CommerceCountryPersistenceImpl { /** * Returns the commerce country where groupId = & # 63 ; and numericISOCode = & # 63 ; or returns < code > null < / code > if it could not be found , optionally using the finder cache .
* @ param groupId the group ID
* @ param numericISOCode the numeric iso code
* ... | Object [ ] finderArgs = new Object [ ] { groupId , numericISOCode } ; Object result = null ; if ( retrieveFromCache ) { result = finderCache . getResult ( FINDER_PATH_FETCH_BY_G_N , finderArgs , this ) ; } if ( result instanceof CommerceCountry ) { CommerceCountry commerceCountry = ( CommerceCountry ) result ; if ( ( g... |
public class vpnglobal_intranetip_binding { /** * Use this API to fetch filtered set of vpnglobal _ intranetip _ binding resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static vpnglobal_intranetip_binding [ ] get_filtered ( nitro_service service , String filt... | vpnglobal_intranetip_binding obj = new vpnglobal_intranetip_binding ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; vpnglobal_intranetip_binding [ ] response = ( vpnglobal_intranetip_binding [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class SwingGroovyMethods { /** * Allow MutableComboBoxModel to work with subscript operators . < p >
* < b > WARNING : < / b > this operation does not replace the item at the
* specified index , rather it inserts the item at that index , thus
* increasing the size of the model by 1.
* @ param self a Muta... | self . insertElementAt ( i , index ) ; |
public class ConnectionFactory { /** * Uses the provided connection to check the specified schema version within
* the database .
* @ param conn the database connection object
* @ throws DatabaseException thrown if the schema version is not compatible
* with this version of dependency - check */
private void en... | ResultSet rs = null ; PreparedStatement ps = null ; try { // TODO convert this to use DatabaseProperties
ps = conn . prepareStatement ( "SELECT value FROM properties WHERE id = 'version'" ) ; rs = ps . executeQuery ( ) ; if ( rs . next ( ) ) { final String dbSchemaVersion = settings . getString ( Settings . KEYS . DB_V... |
public class UtcInstant { /** * Obtains an instance of { @ code UtcInstant } from a Modified Julian Day with
* a nanosecond fraction of day .
* Modified Julian Day is a simple incrementing count of days where day 0 is 1858-11-17.
* Nanosecond - of - day is a simple count of nanoseconds from the start of the day
... | UtcRules . system ( ) . validateModifiedJulianDay ( mjDay , nanoOfDay ) ; return new UtcInstant ( mjDay , nanoOfDay ) ; |
public class Enhancer { /** * Creates a new object that is enhanced .
* @ return new object */
public T newInstance ( ) { } } | try { return getEnhancedClass ( ) . newInstance ( ) ; } catch ( Exception e ) { logger . error ( "Could not instantiate enhanced object." , e ) ; throw ExceptionUtil . propagate ( e ) ; } |
public class TangramEngine { /** * { @ inheritDoc } */
@ Override public void replaceCard ( Card oldCard , Card newCard ) { } } | List < Card > groups = this . mGroupBasicAdapter . getGroups ( ) ; int index = groups . indexOf ( oldCard ) ; if ( index >= 0 ) { replaceData ( index , Collections . singletonList ( newCard ) ) ; } |
public class RequestPropertiesBuilder { /** * This method is used to validate and build the accept JSON version .
* @ param version
* { @ code String } version
* @ return { @ code String } the mounted header value */
private String acceptBuilder ( String version ) { } } | String acceptValue = "application/json" ; if ( version == "2.1" ) acceptValue += ";version=" + version ; return acceptValue ; |
public class NutchResourceIndex { /** * do an HTTP request , plus parse the result into an XML DOM */
protected synchronized Document getHttpDocument ( String url ) throws IOException , SAXException { } } | Document d = null ; d = this . builder . parse ( url ) ; return d ; |
public class HttpChannelConfig { /** * Check the input configuration for a maximum limit on the number of
* headers allowed per message .
* @ param props */
private void parseLimitNumberHeaders ( Map < Object , Object > props ) { } } | Object value = props . get ( HttpConfigConstants . PROPNAME_LIMIT_NUMHEADERS ) ; if ( null != value ) { try { this . limitNumHeaders = rangeLimit ( convertInteger ( value ) , HttpConfigConstants . MIN_LIMIT_NUMHEADERS , HttpConfigConstants . MAX_LIMIT_NUMHEADERS ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc .... |
public class ManagementHttpRequestProcessor { /** * Notify all shutdown listeners that the shutdown completed . */
protected synchronized void handleCompleted ( ) { } } | latch . countDown ( ) ; for ( final ShutdownListener listener : listeners ) { listener . handleCompleted ( ) ; } listeners . clear ( ) ; |
public class StreamingJsonSerializer { /** * / * ( non - Javadoc )
* @ see org . ektorp . impl . JsonSerializer # asInputStream ( java . util . Collection , boolean ) */
public BulkOperation createBulkOperation ( final Collection < ? > objects , final boolean allOrNothing ) { } } | try { final PipedOutputStream out = new PipedOutputStream ( ) ; PipedInputStream in = new PipedInputStream ( out ) ; Future < ? > writeTask = executorService . submit ( new Runnable ( ) { public void run ( ) { try { bulkDocWriter . write ( objects , allOrNothing , out ) ; } catch ( Exception e ) { LOG . error ( "Caught... |
public class CommonOps_DDF2 { /** * Returns the value of the element in the vector that has the minimum value . < br >
* < br >
* Min { a < sub > i < / sub > } for all < br >
* @ param a A matrix . Not modified .
* @ return The value of element in the vector with the minimum value . */
public static double elem... | double min = a . a1 ; if ( a . a2 < min ) min = a . a2 ; return min ; |
public class Association { /** * Return the list of actions on the tuple . Operations are inherently deduplicated , i . e . there will be at most one
* operation for a specific row key .
* Note that the global CLEAR operation is put at the top of the list .
* @ return the operations to execute on the association ... | List < AssociationOperation > result = new ArrayList < AssociationOperation > ( currentState . size ( ) + 1 ) ; if ( cleared ) { result . add ( new AssociationOperation ( null , null , AssociationOperationType . CLEAR ) ) ; } result . addAll ( currentState . values ( ) ) ; return result ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.