signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class UpdateModelVisitor { /** * { @ inheritDoc } */
@ Override public void component ( final FormComponent < ? > formComponent , final IVisit < Void > visit ) { } } | if ( formComponent instanceof IFormModelUpdateListener ) { final Form < ? > form = Form . findForm ( formComponent ) ; if ( form != null ) { if ( this . form == null || this . form == form ) { if ( form . isEnabledInHierarchy ( ) ) { if ( formComponent . isVisibleInHierarchy ( ) && formComponent . isEnabledInHierarchy ... |
public class A_CmsUI { /** * Tries to open a new browser window , and shows a warning if opening the window fails ( usually because of popup blockers ) . < p >
* @ param link the URL to open in the new window
* @ param target the target window name
* @ param warning the warning to show if opening the window fails... | m_windowExtension . open ( link , target , new Runnable ( ) { public void run ( ) { Notification . show ( warning , Type . ERROR_MESSAGE ) ; } } ) ; |
public class JsonLdUrl { /** * Removes dot segments from a JsonLdUrl path .
* @ param path
* the path to remove dot segments from .
* @ param hasAuthority
* true if the JsonLdUrl has an authority , false if not .
* @ return The URL without the dot segments */
public static String removeDotSegments ( String pa... | String rval = "" ; if ( path . indexOf ( "/" ) == 0 ) { rval = "/" ; } // RFC 3986 5.2.4 ( reworked )
final List < String > input = new ArrayList < String > ( Arrays . asList ( path . split ( "/" ) ) ) ; if ( path . endsWith ( "/" ) ) { // javascript . split includes a blank entry if the string ends with
// the delimit... |
public class FileUtils { /** * Creates a string of XML that describes the supplied file or directory ( and , optionally , all its
* subdirectories ) . Includes absolute path , last modified time , read / write permissions , etc .
* @ param aFilePath The file or directory to be returned as XML
* @ param aDeepConve... | return toXML ( aFilePath , WILDCARD , aDeepConversion ) ; |
public class LayerImpl { /** * De - serialize this object from an ObjectInputStream
* @ param in The ObjectInputStream
* @ throws IOException
* @ throws ClassNotFoundException */
private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { } } | // Call the default implementation to de - serialize our object
in . defaultReadObject ( ) ; // init transients
_validateLastModified = new AtomicBoolean ( true ) ; _cacheKeyGenMutex = new Semaphore ( 1 ) ; _isReportCacheInfo = false ; |
public class JacksonJsonMarshaller { /** * Serialize the given Java object into JSON string . */
@ Override public String serialize ( Object obj ) throws JsonMarshallingException { } } | try { return serializeChecked ( obj ) ; } catch ( Exception e ) { throw new JsonMarshallingException ( e ) ; } |
public class VoltBulkLoader { /** * Waits for all pending inserts to be acknowledged and then closes this instance of the
* VoltBulkLoader . During and after the invocation of close ( ) , calls to insertRow will get
* an Exception . All other instances of VoltBulkLoader will continue to function .
* @ throws java... | // Stop the periodic flush as we will flush laster
if ( m_flush != null ) { m_flush . cancel ( false ) ; } m_ses . shutdown ( ) ; // Remove this VoltBulkLoader from the active set .
synchronized ( m_vblGlobals ) { drain ( ) ; List < VoltBulkLoader > loaderList = m_vblGlobals . m_TableNameToLoader . get ( m_tableName ) ... |
public class ClassNodeResolver { /** * try to find a script using the compilation unit class loader . */
private static LookupResult tryAsScript ( String name , CompilationUnit compilationUnit , ClassNode oldClass ) { } } | LookupResult lr = null ; if ( oldClass != null ) { lr = new LookupResult ( null , oldClass ) ; } if ( name . startsWith ( "java." ) ) return lr ; // TODO : don ' t ignore inner static classes completely
if ( name . indexOf ( '$' ) != - 1 ) return lr ; // try to find a script from classpath * /
GroovyClassLoader gcl = c... |
public class DeleteAgentRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteAgentRequest deleteAgentRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteAgentRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteAgentRequest . getAgentArn ( ) , AGENTARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getM... |
public class Processor { /** * Transforms an input stream into HTML .
* @ param reader
* The Reader to process .
* @ param safeMode
* Set to < code > true < / code > to escape unsafe HTML tags .
* @ return The processed String .
* @ throws IOException
* if an IO error occurs
* @ see Configuration # DEFA... | return process ( reader , Configuration . builder ( ) . setSafeMode ( safeMode ) . build ( ) ) ; |
public class ClassInfo { /** * Get the annotations and meta - annotations on this class . ( Call { @ link # getAnnotationInfo ( ) } instead , if you
* need the parameter values of annotations , rather than just the annotation classes . )
* Also handles the { @ link Inherited } meta - annotation , which causes an an... | if ( ! scanResult . scanSpec . enableAnnotationInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableAnnotationInfo() before #scan()" ) ; } // Get all annotations on this class
final ReachableAndDirectlyRelatedClasses annotationClasses = this . filterClassInfo ( RelType . CLASS_ANNOTATIONS , /* st... |
public class LogSupport { /** * Ignore an exception unless trace is enabled .
* This works around the problem that log4j does not support the trace level . */
public static void ignore ( Log log , Throwable th ) { } } | if ( log . isTraceEnabled ( ) ) log . trace ( IGNORED , th ) ; |
public class ManagedBackupShortTermRetentionPoliciesInner { /** * Updates a managed database ' s short term retention policy .
* @ 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 managedInstan... | return ServiceFuture . fromResponse ( createOrUpdateWithServiceResponseAsync ( resourceGroupName , managedInstanceName , databaseName , retentionDays ) , serviceCallback ) ; |
public class CmsGalleryController { /** * Add type to search object . < p >
* @ param resourceType the id ( name ? ) of the resource type to add */
public void addType ( String resourceType ) { } } | m_searchObject . addType ( resourceType ) ; m_searchObjectChanged = true ; ValueChangeEvent . fire ( this , m_searchObject ) ; |
public class RestApiClient { /** * Close all user sessions .
* @ param username the username
* @ return the response */
public Response deleteSessions ( String username ) { } } | return restClient . delete ( "sessions/" + username , new HashMap < String , String > ( ) ) ; |
public class InlineMenu { /** * Handle an inline query sent .
* Caller dependent , throws exception if called from a class which doesn ' t implement InlineMenuRegistry
* @ param query The callback query
* @ param row The button ' s row
* @ param button The button ' s column
* @ return Whether the menu handled... | if ( ! validateCaller ( InlineMenuRegistry . class ) ) { throw new UnsupportedOperationException ( "Invalid caller! Caller must implement InlineMenuRegistry" ) ; } return ( userPredicate == null || userPredicate . test ( query . getFrom ( ) ) ) && row < rows . size ( ) && rowAt ( row ) . handle ( query , button ) ; |
public class CollectionUtils { /** * Return the items of an Iterable as a sorted list .
* @ param < T >
* The type of items in the Iterable .
* @ param items
* The collection to be sorted .
* @ return A list containing the same items as the Iterable , but sorted . */
public static < T extends Comparable < T >... | List < T > result = toList ( items ) ; Collections . sort ( result ) ; return result ; |
public class UserMarshaller { /** * Marshall the given parameter object . */
public void marshall ( User user , ProtocolMarshaller protocolMarshaller ) { } } | if ( user == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( user . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( user . getArn ( ) , ARN_BINDING ) ; protocolMarshaller . marshall ( user . getUsername ( ) , USERNAME_BINDING ) ; ... |
public class LegacyCookieSupport { /** * Returns true if the byte is a separator as defined by V1 of the cookie
* spec , RFC2109.
* @ throws IllegalArgumentException if a control character was supplied as
* input */
private static boolean isHttpSeparator ( final char c ) { } } | if ( c < 0x20 || c >= 0x7f ) { if ( c != 0x09 ) { throw UndertowMessages . MESSAGES . invalidControlCharacter ( Integer . toString ( c ) ) ; } } return HTTP_SEPARATOR_FLAGS [ c ] ; |
public class DescribePublicIpv4PoolsResult { /** * Information about the address pools .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setPublicIpv4Pools ( java . util . Collection ) } or { @ link # withPublicIpv4Pools ( java . util . Collection ) } if you ... | if ( this . publicIpv4Pools == null ) { setPublicIpv4Pools ( new com . amazonaws . internal . SdkInternalList < PublicIpv4Pool > ( publicIpv4Pools . length ) ) ; } for ( PublicIpv4Pool ele : publicIpv4Pools ) { this . publicIpv4Pools . add ( ele ) ; } return this ; |
public class FileLock { /** * Tells whether or not this lock overlaps the given lock range . < / p >
* @ return < tt > true < / tt > if , and only if , this lock and the given lock
* range overlap by at least one byte */
public final boolean overlaps ( long position , long size ) { } } | if ( position + size <= this . position ) return false ; // That is below this
if ( this . position + this . size <= position ) return false ; // This is below that
return true ; |
public class CommerceAddressRestrictionLocalServiceWrapper { /** * Adds the commerce address restriction to the database . Also notifies the appropriate model listeners .
* @ param commerceAddressRestriction the commerce address restriction
* @ return the commerce address restriction that was added */
@ Override pu... | return _commerceAddressRestrictionLocalService . addCommerceAddressRestriction ( commerceAddressRestriction ) ; |
public class ResourcesInner { /** * Updates a resource by ID .
* @ param resourceId The fully qualified ID of the resource , including the resource name and resource type . Use the format , / subscriptions / { guid } / resourceGroups / { resource - group - name } / { resource - provider - namespace } / { resource - t... | return beginUpdateByIdWithServiceResponseAsync ( resourceId , apiVersion , parameters ) . map ( new Func1 < ServiceResponse < GenericResourceInner > , GenericResourceInner > ( ) { @ Override public GenericResourceInner call ( ServiceResponse < GenericResourceInner > response ) { return response . body ( ) ; } } ) ; |
public class ContentPackage { /** * Adds a binary file .
* @ param path Full content path and file name of file
* @ param inputStream Input stream with binary dta
* @ throws IOException I / O exception */
public void addFile ( String path , InputStream inputStream ) throws IOException { } } | addFile ( path , inputStream , null ) ; |
public class RLSControllerImpl { /** * Suspend i / o to the recovery log files
* @ param timeout value in seconds after which this suspend operation will be cancelled .
* A timeout value of zero indicates no timeout
* @ exception RLSTimeoutRangeException Thrown if timeout is not in the range 0 < timeout < = 1,000... | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "suspend" , new Integer ( timeout ) ) ; if ( Configuration . isZOS ( ) ) { if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "Operation not supported on ZOS - throwing UnsupportedOperationException" ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "resume" , "java.lang... |
public class ReasonFlags { /** * Set the attribute value . */
public void set ( String name , Object obj ) throws IOException { } } | if ( ! ( obj instanceof Boolean ) ) { throw new IOException ( "Attribute must be of type Boolean." ) ; } boolean val = ( ( Boolean ) obj ) . booleanValue ( ) ; set ( name2Index ( name ) , val ) ; |
public class StringUtility { /** * Counts how many times a word appears in a line . Case insensitive matching . */
public static int countOccurrences ( byte [ ] buff , int len , String word ) { } } | int wordlen = word . length ( ) ; int end = len - wordlen ; int count = 0 ; Loop : for ( int c = 0 ; c <= end ; c ++ ) { for ( int d = 0 ; d < wordlen ; d ++ ) { char ch1 = ( char ) buff [ c + d ] ; if ( ch1 <= 'Z' && ch1 >= 'A' ) ch1 += 'a' - 'A' ; char ch2 = word . charAt ( d ) ; if ( ch2 <= 'Z' && ch2 >= 'A' ) ch2 +... |
public class ClasspathUtils { /** * Get the list of classpath components
* @ param ucl url classloader
* @ return List of classpath components */
private static List getUrlClassLoaderClasspathComponents ( URLClassLoader ucl ) { } } | List components = new ArrayList ( ) ; URL [ ] urls = new URL [ 0 ] ; // Workaround for running on JBoss with UnifiedClassLoader3 usage
// We need to invoke getClasspath ( ) method instead of getURLs ( )
if ( ucl . getClass ( ) . getName ( ) . equals ( "org.jboss.mx.loading.UnifiedClassLoader3" ) ) { try { Method classP... |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getFNCXftUnits ( ) { } } | if ( fncXftUnitsEEnum == null ) { fncXftUnitsEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 22 ) ; } return fncXftUnitsEEnum ; |
public class WebUtils { /** * Gets the http servlet request from the current servlet context .
* @ return the http servlet request */
public static HttpServletRequest getHttpServletRequestFromExternalWebflowContext ( ) { } } | val servletExternalContext = ( ServletExternalContext ) ExternalContextHolder . getExternalContext ( ) ; if ( servletExternalContext != null ) { return ( HttpServletRequest ) servletExternalContext . getNativeRequest ( ) ; } return null ; |
public class AWSBackupClient { /** * Sets a resource - based policy that is used to manage access permissions on the target backup vault . Requires a
* backup vault name and an access policy document in JSON format .
* @ param putBackupVaultAccessPolicyRequest
* @ return Result of the PutBackupVaultAccessPolicy o... | request = beforeClientExecution ( request ) ; return executePutBackupVaultAccessPolicy ( request ) ; |
public class SubscriptionRegistrar { /** * Method addNewConsumerForExpression
* Categorises a consumer and adds it to the appropriate hashtable .
* @ param topicExpression
* @ param mc
* @ param selector
* @ param isWildcarded */
public void addNewConsumerForExpression ( String topicExpression , MonitoredCons... | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addNewConsumerForExpression" , new Object [ ] { topicExpression , mc , new Boolean ( selector ) , new Boolean ( isWildcarded ) } ) ; ArrayList consumerList = new ArrayList ( 1 ) ; // Add new consumer into list
consumerList . add ( mc ) ; if ( selector ) { if ( isWild... |
public class UTF8String { /** * Returns the upper case of this string */
public UTF8String toUpperCase ( ) { } } | if ( numBytes == 0 ) { return EMPTY_UTF8 ; } byte [ ] bytes = new byte [ numBytes ] ; bytes [ 0 ] = ( byte ) Character . toTitleCase ( getByte ( 0 ) ) ; for ( int i = 0 ; i < numBytes ; i ++ ) { byte b = getByte ( i ) ; if ( numBytesForFirstByte ( b ) != 1 ) { // fallback
return toUpperCaseSlow ( ) ; } int upper = Char... |
public class DSUtil { /** * Similar to teh other < code > mapColl < / code > method , but the
* function is given as a map . This map is expected to map all
* elements from the entry collection < code > coll < / code > .
* @ see # mapColl ( Iterable , Function , Collection ) */
public static < E1 , E2 > Collectio... | return mapColl ( coll , map2fun ( map ) , newColl ) ; |
public class Command { /** * Create a CORBA Any object and insert a short array in it .
* @ param data The short array to be inserted into the Any object
* @ exception DevFailed If the Any object creation failed .
* Click < a href = " . . / . . / tango _ basic / idl _ html / Tango . html # DevFailed " > here < / ... | Any out_any = alloc_any ( ) ; DevVarShortArrayHelper . insert ( out_any , data ) ; return out_any ; |
public class ServletUtils { /** * Returns the value of the { @ link ServletConstants # DISABLE _ REQUEST _ SIGNATURE _ CHECK _ SYSTEM _ PROPERTY } JVM system property as a { @ link Boolean } .
* @ return value of the { @ link ServletConstants # DISABLE _ REQUEST _ SIGNATURE _ CHECK _ SYSTEM _ PROPERTY } system proper... | String isRequestSignatureCheckDisabled = System . getProperty ( ServletConstants . DISABLE_REQUEST_SIGNATURE_CHECK_SYSTEM_PROPERTY ) ; return Boolean . valueOf ( isRequestSignatureCheckDisabled ) ; |
public class ConfigUtils { /** * Method will create a TrustManagerFactory based on the Algorithm type specified in the config .
* @ param config Config to read from .
* @ param key Key to read from
* @ return TrustManagerFactory based on the type specified in the config . */
public static TrustManagerFactory trus... | final String trustManagerFactoryType = config . getString ( key ) ; try { return TrustManagerFactory . getInstance ( trustManagerFactoryType ) ; } catch ( NoSuchAlgorithmException e ) { ConfigException exception = new ConfigException ( key , trustManagerFactoryType , "Unknown Algorithm." ) ; exception . initCause ( e )... |
public class LazyObject { /** * Returns the integer value stored in this object for the given key .
* Returns 0 if there is no such key .
* @ param key the name of the field on this object
* @ return the requested integer value or 0 if there was no such key */
public int optInt ( String key ) { } } | LazyNode token = getOptionalFieldToken ( key ) ; if ( token == null ) return 0 ; if ( token . type == LazyNode . VALUE_NULL ) return 0 ; return token . getIntValue ( ) ; |
public class CachingGroovyEngine { /** * Initialize the engine . */
public void initialize ( final BSFManager mgr , String lang , Vector declaredBeans ) throws BSFException { } } | super . initialize ( mgr , lang , declaredBeans ) ; ClassLoader parent = mgr . getClassLoader ( ) ; if ( parent == null ) parent = GroovyShell . class . getClassLoader ( ) ; setLoader ( mgr , parent ) ; execScripts = new HashMap < Object , Class > ( ) ; evalScripts = new HashMap < Object , Class > ( ) ; context = shell... |
public class CmsJspContentAccessBean { /** * Gets a lazy map which maps locales to attachment beans for that locale . < p >
* @ return the lazy map */
public Map < ? , ? > getAttachmentsForLocale ( ) { } } | return CmsCollectionsGenericWrapper . createLazyMap ( new Transformer ( ) { @ SuppressWarnings ( "synthetic-access" ) public Object transform ( Object arg0 ) { String localeStr = ( String ) arg0 ; return CmsJspContentAttachmentsBean . getAttachmentsForLocale ( m_cms , m_resource , localeStr ) ; } } ) ; |
public class DescribeTapeRecoveryPointsResult { /** * An array of TapeRecoveryPointInfos that are available for the specified gateway .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setTapeRecoveryPointInfos ( java . util . Collection ) } or
* { @ link # ... | if ( this . tapeRecoveryPointInfos == null ) { setTapeRecoveryPointInfos ( new com . amazonaws . internal . SdkInternalList < TapeRecoveryPointInfo > ( tapeRecoveryPointInfos . length ) ) ; } for ( TapeRecoveryPointInfo ele : tapeRecoveryPointInfos ) { this . tapeRecoveryPointInfos . add ( ele ) ; } return this ; |
public class GenericWindowContainer { /** * - - - - - 以下代码是PortalListener和Invocation的实现代码 - - - - - */
@ Override public void onWindowAdded ( Window window ) { } } | if ( windowListeners != null ) { try { windowListeners . onWindowAdded ( window ) ; } catch ( Exception e ) { logger . error ( "" , e ) ; } } |
public class ClassReplicaCreator { /** * Add a field to the replica class that holds the instance delegator . I . e .
* if we ' re creating a instance replica of { @ code java . lang . Long } this
* methods adds a new field of type { @ code delegator . getClass ( ) } to the
* replica class . */
private < T > void... | CtField f = CtField . make ( String . format ( "private %s %s = null;" , delegator . getClass ( ) . getName ( ) , POWERMOCK_INSTANCE_DELEGATOR_FIELD_NAME ) , replicaClass ) ; replicaClass . addField ( f ) ; |
public class CredentialFactory { /** * Initializes OAuth2 application default credentials based on the environment the code is running
* in . If a service account is to be used with JSON file , set the environment variable with name
* " GOOGLE _ APPLICATION _ CREDENTIALS " to the JSON file path . For more details o... | GoogleCredentials credentials = GoogleCredentials . getApplicationDefault ( getHttpTransportFactory ( ) ) ; if ( credentials instanceof ServiceAccountCredentials ) { return getJwtToken ( ( ServiceAccountCredentials ) credentials ) ; } return credentials . createScoped ( CLOUD_BIGTABLE_ALL_SCOPES ) ; |
public class Member { /** * Create a MemberUpdater to execute update .
* @ param pathServiceSid The SID of the Service to create the resource under
* @ param pathChannelSid The unique ID of the channel the member to update
* belongs to
* @ param pathSid The unique string that identifies the resource
* @ retur... | return new MemberUpdater ( pathServiceSid , pathChannelSid , pathSid ) ; |
public class Utility { /** * MD5加密
* @ param str 待加密数据
* @ return md5值 */
public static byte [ ] md5Bytes ( String str ) { } } | if ( str == null ) return null ; MessageDigest md5 ; try { md5 = MessageDigest . getInstance ( "MD5" ) ; } catch ( NoSuchAlgorithmException ex ) { throw new RuntimeException ( ex ) ; } return md5 . digest ( str . getBytes ( ) ) ; |
public class ZipExporterImpl { /** * { @ inheritDoc }
* @ see org . jboss . shrinkwrap . api . exporter . StreamExporter # exportAsInputStream ( ) */
@ Override public InputStream exportAsInputStream ( ) { } } | // Create export delegate
final AbstractExporterDelegate < InputStream > exportDelegate = new ZipExporterDelegate ( this . getArchive ( ) ) ; // Export and get result
return exportDelegate . export ( ) ; |
public class DescribeInputResult { /** * A list of the sources of the input ( PULL - type ) .
* @ param sources
* A list of the sources of the input ( PULL - type ) . */
public void setSources ( java . util . Collection < InputSource > sources ) { } } | if ( sources == null ) { this . sources = null ; return ; } this . sources = new java . util . ArrayList < InputSource > ( sources ) ; |
public class RedisMemoryImpl { @ Override public Long hset ( String key , long field , String value ) { } } | return this . hset ( key , Long . toString ( field ) , value ) ; |
public class State { /** * Save view hierarchy state so it can be restored later from { @ link # restore ( View ) } . The view
* must have a non - zero id . */
public void save ( @ NonNull View view ) { } } | int viewId = view . getId ( ) ; Preconditions . checkArgument ( viewId != 0 , "Cannot save state for View with no id " + view . getClass ( ) . getSimpleName ( ) ) ; SparseArray < Parcelable > state = new SparseArray < > ( ) ; view . saveHierarchyState ( state ) ; viewStateById . put ( viewId , state ) ; |
public class AbstractImporter { /** * { @ inheritDoc } 进行转换 */
public void transfer ( TransferResult tr ) { } } | this . transferResult = tr ; this . transferResult . setTransfer ( this ) ; long transferStartAt = System . currentTimeMillis ( ) ; try { prepare . prepare ( this ) ; } catch ( Exception e ) { // 预导入发生位置错误 , 错误信息已经记录在tr了
return ; } for ( final TransferListener listener : listeners ) { listener . onStart ( tr ) ; } whil... |
public class ContinuousDistributions { /** * 给定卡方分布的p值和自由度 , 返回卡方值 。 内部采用二分搜索实现 , 移植自JS代码 :
* http : / / www . fourmilab . ch / rpkp / experiments / analysis / chiCalc . js
* @ param p p值 ( 置信度 )
* @ param df
* @ return */
public static double ChisquareInverseCdf ( double p , int df ) { } } | final double CHI_EPSILON = 0.000001 ; /* Accuracy of critchi approximation */
final double CHI_MAX = 99999.0 ; /* Maximum chi - square value */
double minchisq = 0.0 ; double maxchisq = CHI_MAX ; double chisqval = 0.0 ; if ( p <= 0.0 ) { return CHI_MAX ; } else if ( p >= 1.0 ) { return 0.0 ; } chisqval = df / Math . sq... |
public class UserRegistryServiceImpl { /** * When a configuration element is defined , use it to resolve the effective
* UserRegistry configuration .
* @ return
* @ throws RegistryException */
private UserRegistry getUserRegistryFromConfiguration ( ) throws RegistryException { } } | String [ ] refIds = this . refId ; if ( refIds == null || refIds . length == 0 ) { // Can look for config . source = file
// If thats set , and we ' re missing this , we can error .
// If its not set , we don ' t have configuration from the
// file and we should try to resolve if we have one instance defined ?
Tr . err... |
public class WCheckBoxSelectRenderer { /** * Paints the given WCheckBoxSelect .
* @ param component the WCheckBoxSelect to paint .
* @ param renderContext the RenderContext to paint to . */
@ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { } } | WCheckBoxSelect select = ( WCheckBoxSelect ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; int cols = select . getButtonColumns ( ) ; boolean readOnly = select . isReadOnly ( ) ; xml . appendTagOpen ( "ui:checkboxselect" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptio... |
public class GrpcClientBeanPostProcessor { /** * Creates the instance to be injected for the given member .
* @ param name The name that was used to create the channel .
* @ param < T > The type of the instance to be injected .
* @ param injectionTarget The target member for the injection .
* @ param injectionT... | if ( Channel . class . equals ( injectionType ) ) { return injectionType . cast ( channel ) ; } else if ( AbstractStub . class . isAssignableFrom ( injectionType ) ) { try { @ SuppressWarnings ( "unchecked" ) final Class < ? extends AbstractStub < ? > > stubClass = ( Class < ? extends AbstractStub < ? > > ) injectionTy... |
public class Functions { /** * Returns the correctly rounded positive square root of a { @ code double }
* value .
* Any numeric string recognized by { @ code BigDecimal } is supported .
* @ param value A valid number
* @ return the positive square root of { @ code value } . */
public static String sqrt ( Strin... | try { BigDecimal bd = new BigDecimal ( value ) ; return Math . sqrt ( bd . doubleValue ( ) ) + "" ; } catch ( Exception ex ) { return null ; } |
public class ProposalLineItemConstraints { /** * Gets the builtInRoadblockingType value for this ProposalLineItemConstraints .
* @ return builtInRoadblockingType * The built - in roadblocking type for the created { @ link ProposalLineItem } .
* < p > This attribute is read - only . */
public com . google . api . ad... | return builtInRoadblockingType ; |
public class Taint { /** * Checks whether one of the specified taint tag is present for this fact
* @ param tags Tags to test
* @ return true if at least one is present , false otherwise */
public boolean hasOneTag ( Tag ... tags ) { } } | for ( Tag t : tags ) { if ( this . tags . contains ( t ) ) return true ; } return false ; |
public class IgnoreableProcessor { /** * Certain events have no time basis on the person .
* @ param event the event
* @ return true if it is non - time event */
protected final boolean ignoreable ( final Attribute event ) { } } | // Layed out like this because it is easier to understand
// coverage . No performance differences expected compared
// to tighter layout .
if ( "Sex" . equals ( event . getString ( ) ) ) { return true ; } if ( "Changed" . equals ( event . getString ( ) ) ) { return true ; } if ( "Ancestral File Number" . equals ( even... |
public class SherlockAccountAuthenticatorActivity { /** * Retreives the AccountAuthenticatorResponse from either the intent of the icicle , if the
* icicle is non - zero .
* @ param icicle the save instance data of this Activity , may be null */
protected void onCreate ( Bundle icicle ) { } } | super . onCreate ( icicle ) ; mAccountAuthenticatorResponse = getIntent ( ) . getParcelableExtra ( AccountManager . KEY_ACCOUNT_AUTHENTICATOR_RESPONSE ) ; if ( mAccountAuthenticatorResponse != null ) { mAccountAuthenticatorResponse . onRequestContinued ( ) ; } |
public class QueryBuilder { /** * Starts an INSERT query for a qualified table . */
@ NonNull public static InsertInto insertInto ( @ Nullable CqlIdentifier keyspace , @ NonNull CqlIdentifier table ) { } } | return new DefaultInsert ( keyspace , table ) ; |
public class ApiOvhXdsl { /** * Get this object properties
* REST : GET / xdsl / email / pro / { email }
* @ param email [ required ] The email address if the XDSL Email Pro */
public OvhXdslEmailPro email_pro_email_GET ( String email ) throws IOException { } } | String qPath = "/xdsl/email/pro/{email}" ; StringBuilder sb = path ( qPath , email ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhXdslEmailPro . class ) ; |
public class StringUtils { /** * < p > Search a String to find the first index of any
* character in the given set of characters . < / 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 > . ... | if ( isEmpty ( str ) || ArrayUtils . isEmpty ( searchChars ) ) { return INDEX_NOT_FOUND ; } int csLen = str . length ( ) ; int csLast = csLen - 1 ; int searchLen = searchChars . length ; int searchLast = searchLen - 1 ; for ( int i = 0 ; i < csLen ; i ++ ) { char ch = str . charAt ( i ) ; for ( int j = 0 ; j < searchLe... |
public class IterativeStream { /** * Closes the iteration . This method defines the end of the iterative
* program part that will be fed back to the start of the iteration .
* < p > A common usage pattern for streaming iterations is to use output
* splitting to send a part of the closing data stream to the head .... | "unchecked" , "rawtypes" } ) public DataStream < T > closeWith ( DataStream < T > feedbackStream ) { Collection < StreamTransformation < ? > > predecessors = feedbackStream . getTransformation ( ) . getTransitivePredecessors ( ) ; if ( ! predecessors . contains ( this . transformation ) ) { throw new UnsupportedOperati... |
public class AnomalyDetectionTransform { /** * Creates an interval for each data point ( after currentIndex ) in the metric
* and calculates the anomaly score for that data point using only other data
* points in that same interval , i . e . " a moving contextual anomaly score "
* @ param predictionDatapoints dat... | for ( int i = currentIndex ; i < timestamps . length ; i ++ ) { long timestampAtCurrentIndex = timestamps [ i ] ; long projectedIntervalStartTime = timestampAtCurrentIndex - detectionIntervalInSeconds ; Metric intervalMetric = createIntervalMetric ( i , completeDatapoints , timestamps , projectedIntervalStartTime ) ; L... |
public class ByteBufferOutputStream { /** * Prepend a list of ByteBuffers to this stream . */
public void prepend ( List < ByteBuffer > lists ) { } } | for ( ByteBuffer buffer : lists ) { buffer . position ( buffer . limit ( ) ) ; } buffers . addAll ( 0 , lists ) ; |
public class SlidingWindowCounter { /** * Return the current ( total ) counts of all tracked objects , then advance
* the window .
* Whenever this method is called , we consider the counts of the current
* sliding window to be available to and successfully processed " upstream "
* ( i . e . by the caller ) . Kn... | Map < T , Long > counts = objCounter . getCounts ( ) ; objCounter . wipeZeros ( ) ; objCounter . wipeSlot ( tailSlot ) ; advanceHead ( ) ; return counts ; |
public class AuditUtils { /** * Creates an audit entry for the ' plan updated ' event .
* @ param bean the bean
* @ param data the updated data
* @ param securityContext the security context
* @ return the audit entry */
public static AuditEntryBean planUpdated ( PlanBean bean , EntityUpdatedData data , ISecuri... | if ( data . getChanges ( ) . isEmpty ( ) ) { return null ; } AuditEntryBean entry = newEntry ( bean . getOrganization ( ) . getId ( ) , AuditEntityType . Plan , securityContext ) ; entry . setEntityId ( bean . getId ( ) ) ; entry . setEntityVersion ( null ) ; entry . setWhat ( AuditEntryType . Update ) ; entry . setDat... |
public class Block { /** * Removes the given line from this block .
* @ param line
* Line to remove . */
public void removeLine ( final Line line ) { } } | if ( line . previous == null ) { this . lines = line . next ; } else { line . previous . next = line . next ; } if ( line . next == null ) { this . lineTail = line . previous ; } else { line . next . previous = line . previous ; } line . previous = line . next = null ; |
public class DrawerUIUtils { /** * helper method to get a person placeHolder drawable
* @ param ctx
* @ return */
public static Drawable getPlaceHolder ( Context ctx ) { } } | return new IconicsDrawable ( ctx , MaterialDrawerFont . Icon . mdf_person ) . colorRes ( R . color . accent ) . backgroundColorRes ( R . color . primary ) . sizeDp ( 56 ) . paddingDp ( 16 ) ; |
public class JvmLocationInFileProvider { /** * / * @ Nullable */
@ Override public ITextRegion getTextRegion ( EObject object , RegionDescription query ) { } } | return super . getTextRegion ( convertToSource ( object ) , query ) ; |
public class TrainingsImpl { /** * Add the provided images urls to the set of training images .
* This API accepts a batch of urls , and optionally tags , to create images . There is a limit of 64 images and 20 tags .
* @ param projectId The project id
* @ param batch Image urls and tag ids . Limited to 64 images... | return createImagesFromUrlsWithServiceResponseAsync ( projectId , batch ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class CPDefinitionGroupedEntryUtil { /** * Returns the last cp definition grouped entry in the ordered set where uuid = & # 63 ; .
* @ param uuid the uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching cp definition groupe... | return getPersistence ( ) . fetchByUuid_Last ( uuid , orderByComparator ) ; |
public class ClassFile { /** * Add an interface that this class implements .
* @ param interfaceName Full interface name . */
public void addInterface ( String interfaceName ) { } } | if ( ! mInterfaceSet . contains ( interfaceName ) ) { mInterfaces . add ( ConstantClassInfo . make ( mCp , interfaceName ) ) ; mInterfaceSet . add ( interfaceName ) ; } |
public class FieldDefinition { /** * Add the given FieldDefiniton as a child ( nested field ) of this field . */
private void addNestedField ( FieldDefinition nestedFieldDef ) { } } | // Prerequisites
assert nestedFieldDef != null ; assert m_type == FieldType . GROUP ; Utils . require ( ! m_nestedFieldMap . containsKey ( nestedFieldDef . getName ( ) ) , "Duplicate nested field name: %s" , nestedFieldDef . getName ( ) ) ; // Add it to us and point it at us .
m_nestedFieldMap . put ( nestedFieldDef . ... |
public class LinkerDeclarationsManager { /** * Compute and apply all the modifications bring by the modification of the DeclarationFilter .
* Find all the Declaration that are now matching the filter and all that are no more matching the filter .
* < ul >
* < li > Remove all the links of the ones which are no mor... | this . declarationFilter = declarationFilter ; Set < ServiceReference < D > > added = new HashSet < ServiceReference < D > > ( ) ; Set < ServiceReference < D > > removed = new HashSet < ServiceReference < D > > ( ) ; for ( Map . Entry < ServiceReference < D > , Boolean > e : declarations . entrySet ( ) ) { Map < String... |
public class RelationalOperations { /** * Returns true if polyline _ a contains polyline _ b . */
private static boolean polylineContainsPolyline_ ( Polyline polyline_a , Polyline polyline_b , double tolerance , ProgressTracker progress_tracker ) { } } | Envelope2D env_a = new Envelope2D ( ) , env_b = new Envelope2D ( ) ; polyline_a . queryEnvelope2D ( env_a ) ; polyline_b . queryEnvelope2D ( env_b ) ; // Quick envelope rejection test for false equality .
if ( ! envelopeInfContainsEnvelope_ ( env_a , env_b , tolerance ) ) return false ; // Quick rasterize test to see w... |
public class JvmTypeParameterImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public NotificationChain eInverseAdd ( InternalEObject otherEnd , int featureID , NotificationChain msgs ) { } } | switch ( featureID ) { case TypesPackage . JVM_TYPE_PARAMETER__CONSTRAINTS : return ( ( InternalEList < InternalEObject > ) ( InternalEList < ? > ) getConstraints ( ) ) . basicAdd ( otherEnd , msgs ) ; case TypesPackage . JVM_TYPE_PARAMETER__DECLARATOR : if ( eInternalContainer ( ) != null ) msgs = eBasicRemoveFromCont... |
public class CocoaPodsAnalyzer { /** * Extracts evidence from the contents and adds it to the given evidence
* collection .
* @ param contents the text to extract evidence from
* @ param blockVariable the block variable within the content to search for
* @ param fieldPattern the field pattern within the content... | String value = "" ; // capture array value between [ ]
final Matcher arrayMatcher = Pattern . compile ( String . format ( "\\s*?%s\\.%s\\s*?=\\s*?\\{\\s*?(.*?)\\s*?\\}" , blockVariable , fieldPattern ) , Pattern . CASE_INSENSITIVE ) . matcher ( contents ) ; if ( arrayMatcher . find ( ) ) { value = arrayMatcher . group ... |
public class Client { /** * Sends a CSR to the SCEP server for enrolling in a PKI .
* This method enrols the provider < tt > CertificationRequest < / tt > into the
* PKI represented by the SCEP server .
* @ param identity
* the identity of the client .
* @ param key
* the private key to sign the SCEP reques... | return enrol ( identity , key , csr , null ) ; |
public class AnalyticsBot { /** * Use this method to specify a url and receive incoming updates via an outgoing webhook .
* Whenever there is an update for the bot , an HTTPS POST request to the specified url will be sent , containing a JSON - serialized Update .
* In case of an unsuccessful request , it will give ... | AnalyticsData data = new AnalyticsData ( "setWebhook" ) ; IOException ioException = null ; boolean returned = false ; data . setValue ( "url" , url ) ; data . setValue ( "certificate" , certificate ) ; try { returned = bot . setWebhook ( url , certificate ) ; data . setReturned ( returned ) ; } catch ( IOException e ) ... |
public class MathTools { /** * Analog of Math . max that returns the largest double value in an array of doubles .
* @ param values the values to be searched for the largest value among them
* @ return the largest value among a set of given values */
static double max ( double [ ] values ) { } } | double max = values [ 0 ] ; for ( double value : values ) if ( value > max ) max = value ; return max ; |
public class InjectionUtils { /** * Inject JNRPE code inside the passed in plugin .
* The annotation is searched in the whole hierarchy .
* @ param plugin plugin to be injected
* @ param context the jnrpe context */
@ SuppressWarnings ( "rawtypes" ) public static void inject ( final IPluginInterface plugin , fina... | try { Class clazz = plugin . getClass ( ) ; inject ( clazz , plugin , context ) ; while ( IPluginInterface . class . isAssignableFrom ( clazz . getSuperclass ( ) ) ) { clazz = clazz . getSuperclass ( ) ; inject ( clazz , plugin , context ) ; } } catch ( Exception e ) { throw new Error ( e . getMessage ( ) , e ) ; } |
public class Math { /** * Kullback - Leibler divergence . The Kullback - Leibler divergence ( also
* information divergence , information gain , relative entropy , or KLIC )
* is a non - symmetric measure of the difference between two probability
* distributions P and Q . KL measures the expected number of extra ... | if ( x . isEmpty ( ) ) { throw new IllegalArgumentException ( "List x is empty." ) ; } if ( y . isEmpty ( ) ) { throw new IllegalArgumentException ( "List y is empty." ) ; } Iterator < SparseArray . Entry > iterX = x . iterator ( ) ; Iterator < SparseArray . Entry > iterY = y . iterator ( ) ; SparseArray . Entry a = it... |
public class DoubleIntIndex { /** * Adds a pair , ensuring no duplicate key xor value already exists in the
* current search target column .
* @ param key the key
* @ param value the value
* @ return true or false depending on success */
public synchronized boolean addUnique ( int key , int value ) { } } | if ( count == capacity ) { if ( fixedSize ) { return false ; } else { doubleCapacity ( ) ; } } if ( ! sorted ) { fastQuickSort ( ) ; } targetSearchValue = sortOnValues ? value : key ; int i = binaryEmptySlotSearch ( ) ; if ( i == - 1 ) { return false ; } hasChanged = true ; if ( count != i ) { moveRows ( i , i + 1 , co... |
public class RowServiceSkinny { /** * { @ inheritDoc } */
@ Override public void indexInner ( ByteBuffer key , ColumnFamily columnFamily , long timestamp ) { } } | DecoratedKey partitionKey = rowMapper . partitionKey ( key ) ; if ( columnFamily . iterator ( ) . hasNext ( ) ) // Create or update row
{ Row row = row ( partitionKey , timestamp ) ; // Read row
Document document = rowMapper . document ( row ) ; Term term = rowMapper . term ( partitionKey ) ; luceneIndex . upsert ( ter... |
public class VCalAlarmPropertyScribe { /** * Converts an instance of a vCal alarm property into a { @ link VAlarm }
* component .
* @ param property the property to convert
* @ return the component */
protected VAlarm toVAlarm ( T property ) { } } | Trigger trigger = new Trigger ( property . getStart ( ) ) ; VAlarm valarm = new VAlarm ( action ( ) , trigger ) ; valarm . setDuration ( property . getSnooze ( ) ) ; valarm . setRepeat ( property . getRepeat ( ) ) ; toVAlarm ( valarm , property ) ; return valarm ; |
public class JKTableRecord { public double getColumnValueAsDouble ( final int col ) { } } | final Object value = getColumnValue ( col ) ; if ( value == null ) { return 0 ; } return new Double ( value . toString ( ) ) ; |
public class BoxesRunTime { /** * / * UNBOXING . . . UNBOXING . . . UNBOXING . . . UNBOXING . . . UNBOXING . . . UNBOXING . . . UNBOXING */
public static boolean unboxToBoolean ( Object b ) { } } | return b == null ? false : ( ( java . lang . Boolean ) b ) . booleanValue ( ) ; |
public class HOSECodeGenerator { /** * Produces a HOSE code for Atom < code > root < / code > in the { @ link IAtomContainer } < code > ac < / code > . The HOSE
* code is produced for the number of spheres given by < code > noOfSpheres < / code > .
* IMPORTANT : if you want aromaticity to be included in the code , ... | return getHOSECode ( ac , root , noOfSpheres , false ) ; |
public class LIBSVMLoader { /** * Loads a new regression data set from a LIBSVM file , assuming the label is
* a numeric target value to predict
* @ param file the file to load
* @ param sparseRatio the fraction of non zero values to qualify a data
* point as sparse
* @ return a regression data set
* @ thro... | return loadR ( file , sparseRatio , - 1 ) ; |
public class HadoopJobUtils { /** * < pre >
* Uses YarnClient to kill the job on HDFS .
* Using JobClient only works partially :
* If yarn container has started but spark job haven ' t , it will kill
* If spark job has started , the cancel will hang until the spark job is complete
* If the spark job is comple... | YarnConfiguration yarnConf = new YarnConfiguration ( ) ; YarnClient yarnClient = YarnClient . createYarnClient ( ) ; yarnClient . init ( yarnConf ) ; yarnClient . start ( ) ; String [ ] split = applicationId . split ( "_" ) ; ApplicationId aid = ApplicationId . newInstance ( Long . parseLong ( split [ 1 ] ) , Integer .... |
public class LogFactory { /** * Returns a string that uniquely identifies the specified object , including
* its class .
* The returned string is of form " classname @ hashcode " , i . e . is the same as the
* return value of the Object . toString ( ) method , but works even when the
* specified object ' s clas... | if ( o == null ) { return "null" ; } else { return o . getClass ( ) . getName ( ) + "@" + System . identityHashCode ( o ) ; } |
public class ResourcesInner { /** * Updates a resource .
* @ param resourceGroupName The name of the resource group for the resource . The name is case insensitive .
* @ param resourceProviderNamespace The namespace of the resource provider .
* @ param parentResourcePath The parent resource identity .
* @ param... | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( resourceProviderNamespace == null ) { throw new IllegalArgumentException ( "Parameter resourceProviderNamespace is required and cannot be null." ) ; } if ( parentResourcePath ... |
public class DiGraph { /** * Returns the set of all vertices from < code > this < / code >
* digraph : vertices that are ( trasitively and reflexively )
* reachable from the root vertices by following the forward arcs
* provided by the navigator .
* < p > The returned set is unmodifiable and has a deterministic... | if ( CACHING && ( cachedVertices != null ) ) return cachedVertices ; Set < Vertex > vertices = Collections . unmodifiableSet ( transitiveSucc ( getRoots ( ) ) ) ; if ( CACHING ) { cachedVertices = vertices ; } return vertices ; |
public class CLIRegisterer { /** * Finds a resolved method annotated with { @ link CLIResolver } . */
private Method findResolver ( Class type ) throws IOException { } } | List < Method > resolvers = Util . filter ( Index . list ( CLIResolver . class , Jenkins . get ( ) . getPluginManager ( ) . uberClassLoader ) , Method . class ) ; for ( ; type != null ; type = type . getSuperclass ( ) ) for ( Method m : resolvers ) if ( m . getReturnType ( ) == type ) return m ; return null ; |
public class RawRequest { /** * Set a query parameter value for the underlying HTTP request .
* Query parameters set with this method will be merged with query
* parameters found in the configured { @ link SdkRequestConfig } .
* @ param name The name of the header .
* @ param value The value of the header .
*... | queryParameters . computeIfAbsent ( name , k -> new ArrayList < > ( ) ) ; queryParameters . get ( name ) . add ( value ) ; setRequestConfigDirty ( ) ; return this ; |
public class ValueEnforcer { /** * Check if
* < code > nValue & gt ; nLowerBoundInclusive & amp ; & amp ; nValue & lt ; nUpperBoundInclusive < / code >
* @ param nValue
* Value
* @ param aName
* Name
* @ param nLowerBoundExclusive
* Lower bound
* @ param nUpperBoundExclusive
* Upper bound
* @ return... | if ( isEnabled ( ) ) if ( nValue <= nLowerBoundExclusive || nValue >= nUpperBoundExclusive ) throw new IllegalArgumentException ( "The value of '" + aName . get ( ) + "' must be > " + nLowerBoundExclusive + " and < " + nUpperBoundExclusive + "! The current value is: " + nValue ) ; return nValue ; |
public class SecondsBasedEntryTaskScheduler { /** * Removes the entry if it exists from being scheduled to be evicted .
* Cleans up parent container ( second - > entries map ) if it doesn ' t hold anymore items this second .
* Cancels associated scheduler ( second - > scheduler map ) if there are no more items to r... | ScheduledEntry < K , V > entry = entries . get ( key ) ; if ( entry == null || ! entry . equals ( entryToRemove ) ) { return false ; } entries . remove ( key ) ; cleanUpScheduledFuturesIfEmpty ( second , entries ) ; return true ; |
public class SQLiteModelMethod { /** * Builds the prepared statement name .
* @ return the string */
public String buildPreparedStatementName ( ) { } } | if ( ! StringUtils . hasText ( preparedStatementName ) ) { preparedStatementName = getParent ( ) . buildPreparedStatementName ( getName ( ) ) ; } return preparedStatementName ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.