signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Log4jAppender { /** * Activate the options set using < tt > setPort ( ) < / tt > * and < tt > setHostname ( ) < / tt > * @ throws FlumeException if the < tt > hostname < / tt > and * < tt > port < / tt > combination is invalid . */ @ Override public void activateOptions ( ) throws FlumeException { } }
Properties props = new Properties ( ) ; props . setProperty ( RpcClientConfigurationConstants . CONFIG_HOSTS , "h1" ) ; props . setProperty ( RpcClientConfigurationConstants . CONFIG_HOSTS_PREFIX + "h1" , hostname + ":" + port ) ; props . setProperty ( RpcClientConfigurationConstants . CONFIG_CONNECT_TIMEOUT , String . valueOf ( timeout ) ) ; props . setProperty ( RpcClientConfigurationConstants . CONFIG_REQUEST_TIMEOUT , String . valueOf ( timeout ) ) ; try { rpcClient = RpcClientFactory . getInstance ( props ) ; if ( layout != null ) { layout . activateOptions ( ) ; } } catch ( FlumeException e ) { String errormsg = "RPC client creation failed! " + e . getMessage ( ) ; LogLog . error ( errormsg ) ; throw e ; }
public class RemoteSLF4j { /** * Logs a Log Record which has been serialized using GWT RPC on the server . * @ return either an error message , or null if logging is successful . */ public final String logOnServer ( LogRecord lr ) { } }
String strongName = getPermutationStrongName ( ) ; /* RemoteLoggingServiceUtil . logOnServer ( lr , strongName , deobfuscator , loggerNameOverride ) ; */ logger . error ( lr . getMessage ( ) ) ; return null ;
public class CmsSearchResultsList { /** * Generates the dialog starting html code . < p > * @ return html code */ @ Override protected String defaultActionHtmlStart ( ) { } }
StringBuffer result = new StringBuffer ( 2048 ) ; result . append ( htmlStart ( null ) ) ; result . append ( getList ( ) . listJs ( ) ) ; result . append ( CmsListExplorerColumn . getExplorerStyleDef ( ) ) ; result . append ( "<script language='JavaScript'>\n" ) ; result . append ( new CmsExplorer ( getJsp ( ) ) . getInitializationHeader ( ) ) ; result . append ( "\ntop.updateWindowStore();\n" ) ; result . append ( "top.displayHead(top.win.head, 0, 1);\n}\n" ) ; result . append ( "</script>" ) ; result . append ( bodyStart ( "dialog" , "onload='initialize();'" ) ) ; result . append ( dialogStart ( ) ) ; result . append ( dialogContentStart ( getParamTitle ( ) ) ) ; return result . toString ( ) ;
public class GeneralValidator { /** * Processes the output of all data providers , all at once , with each rule . */ @ SuppressWarnings ( "unchecked" ) // NOSONAR ( Avoid Duplicate Literals ) private void processAllDataProvidersWithEachRule ( ) { } }
// For each data provider List < Object > transformedDataProvidersOutput = new ArrayList < Object > ( dataProviders . size ( ) ) ; for ( DataProvider < DPO > dataProvider : dataProviders ) { // Get the data provider output Object transformedOutput = dataProvider . getData ( ) ; // Transform the data provider output if ( dataProviderOutputTransformers != null ) { for ( Transformer transformer : dataProviderOutputTransformers ) { transformedOutput = transformer . transform ( transformedOutput ) ; } } // Put the transformed data provider output in a list transformedDataProvidersOutput . add ( transformedOutput ) ; } // Transform the list of transformed data provider output to rule input Object transformedRulesInput = transformedDataProvidersOutput ; if ( ruleInputTransformers != null ) { for ( Transformer transformer : ruleInputTransformers ) { transformedRulesInput = transformer . transform ( transformedRulesInput ) ; } } RI ruleInput = ( RI ) transformedRulesInput ; // Process the rule input with the rules processRules ( ruleInput ) ;
public class MPXJFormats { /** * Called to update the cached formats when something changes . */ public void update ( ) { } }
ProjectProperties properties = m_projectFile . getProjectProperties ( ) ; char decimalSeparator = properties . getDecimalSeparator ( ) ; char thousandsSeparator = properties . getThousandsSeparator ( ) ; m_unitsDecimalFormat . applyPattern ( "#.##" , null , decimalSeparator , thousandsSeparator ) ; m_decimalFormat . applyPattern ( "0.00#" , null , decimalSeparator , thousandsSeparator ) ; m_durationDecimalFormat . applyPattern ( "#.##" , null , decimalSeparator , thousandsSeparator ) ; m_percentageDecimalFormat . applyPattern ( "##0.##" , null , decimalSeparator , thousandsSeparator ) ; updateCurrencyFormats ( properties , decimalSeparator , thousandsSeparator ) ; updateDateTimeFormats ( properties ) ;
public class KeyStoreSpi { /** * Gets a { @ code KeyStore . Entry } for the specified alias * with the specified protection parameter . * @ param alias get the { @ code KeyStore . Entry } for this alias * @ param protParam the { @ code ProtectionParameter } * used to protect the { @ code Entry } , * which may be { @ code null } * @ return the { @ code KeyStore . Entry } for the specified alias , * or { @ code null } if there is no such entry * @ exception KeyStoreException if the operation failed * @ exception NoSuchAlgorithmException if the algorithm for recovering the * entry cannot be found * @ exception UnrecoverableEntryException if the specified * { @ code protParam } were insufficient or invalid * @ exception UnrecoverableKeyException if the entry is a * { @ code PrivateKeyEntry } or { @ code SecretKeyEntry } * and the specified { @ code protParam } does not contain * the information needed to recover the key ( e . g . wrong password ) * @ since 1.5 */ public KeyStore . Entry engineGetEntry ( String alias , KeyStore . ProtectionParameter protParam ) throws KeyStoreException , NoSuchAlgorithmException , UnrecoverableEntryException { } }
if ( ! engineContainsAlias ( alias ) ) { return null ; } if ( protParam != null && ! ( protParam instanceof KeyStore . PasswordProtection ) ) { throw new UnsupportedOperationException ( ) ; } if ( engineIsCertificateEntry ( alias ) ) { if ( protParam == null ) { return new KeyStore . TrustedCertificateEntry ( engineGetCertificate ( alias ) ) ; } else { throw new UnsupportedOperationException ( "trusted certificate entries are not password-protected" ) ; } } else if ( engineIsKeyEntry ( alias ) ) { char [ ] password = null ; if ( protParam != null ) { KeyStore . PasswordProtection pp = ( KeyStore . PasswordProtection ) protParam ; password = pp . getPassword ( ) ; } Key key = engineGetKey ( alias , password ) ; if ( key instanceof PrivateKey ) { Certificate [ ] chain = engineGetCertificateChain ( alias ) ; return new KeyStore . PrivateKeyEntry ( ( PrivateKey ) key , chain ) ; } else if ( key instanceof SecretKey ) { return new KeyStore . SecretKeyEntry ( ( SecretKey ) key ) ; } } throw new UnsupportedOperationException ( ) ;
public class MetadataBuilder { /** * Add to the { @ link Set } of tags by which this { @ link RulesetMetadata } is classified . * Inherits from { @ link RulesetMetadata # getTags ( ) } if available . */ public MetadataBuilder addTags ( String tag , String ... tags ) { } }
if ( ! StringUtils . isBlank ( tag ) ) this . tags . add ( tag . trim ( ) ) ; if ( tags != null ) { for ( String t : tags ) { if ( ! StringUtils . isBlank ( t ) ) this . tags . add ( t . trim ( ) ) ; } } return this ;
public class SonarHLAFactory { /** * Create an instance of an { @ link ISonarExtractor } type . * @ param hostURL The host URL pointing to SonarQube . * @ param userName The user name . * @ param password The password for the given user . Beware that it will not be handled in a safe way . So better use a kind of * technical user or , if possible , use { @ link # getExtractor ( String ) } which does not require any credentials . * @ return A < b > new < / b > instance of { @ link ISonarExtractor } . */ public static ISonarExtractor getExtractor ( String hostURL , String userName , String password ) { } }
return new DefaultSonarExtractor ( hostURL , userName , password ) ;
public class NewWordDiscover { /** * 提取词语 * @ param reader 大文本 * @ param size 需要提取词语的数量 * @ return 一个词语列表 */ public List < WordInfo > discover ( BufferedReader reader , int size ) throws IOException { } }
String doc ; Map < String , WordInfo > word_cands = new TreeMap < String , WordInfo > ( ) ; int totalLength = 0 ; Pattern delimiter = Pattern . compile ( "[\\s\\d,.<>/?:;'\"\\[\\]{}()\\|~!@#$%^&*\\-_=+,。《》、?:;“”‘’{}【】()…¥!—┄-]+" ) ; while ( ( doc = reader . readLine ( ) ) != null ) { doc = delimiter . matcher ( doc ) . replaceAll ( "\0" ) ; int docLength = doc . length ( ) ; for ( int i = 0 ; i < docLength ; ++ i ) { int end = Math . min ( i + 1 + max_word_len , docLength + 1 ) ; for ( int j = i + 1 ; j < end ; ++ j ) { String word = doc . substring ( i , j ) ; if ( word . indexOf ( '\0' ) >= 0 ) continue ; // 含有分隔符的不认为是词语 WordInfo info = word_cands . get ( word ) ; if ( info == null ) { info = new WordInfo ( word ) ; word_cands . put ( word , info ) ; } info . update ( i == 0 ? '\0' : doc . charAt ( i - 1 ) , j < docLength ? doc . charAt ( j ) : '\0' ) ; } } totalLength += docLength ; } for ( WordInfo info : word_cands . values ( ) ) { info . computeProbabilityEntropy ( totalLength ) ; } for ( WordInfo info : word_cands . values ( ) ) { info . computeAggregation ( word_cands ) ; } // 过滤 List < WordInfo > wordInfoList = new LinkedList < WordInfo > ( word_cands . values ( ) ) ; ListIterator < WordInfo > listIterator = wordInfoList . listIterator ( ) ; while ( listIterator . hasNext ( ) ) { WordInfo info = listIterator . next ( ) ; if ( info . text . trim ( ) . length ( ) < 2 || info . p < min_freq || info . entropy < min_entropy || info . aggregation < min_aggregation || ( filter && LexiconUtility . getFrequency ( info . text ) > 0 ) ) { listIterator . remove ( ) ; } } // 按照频率排序 MaxHeap < WordInfo > topN = new MaxHeap < WordInfo > ( size , new Comparator < WordInfo > ( ) { public int compare ( WordInfo o1 , WordInfo o2 ) { return Float . compare ( o1 . p , o2 . p ) ; } } ) ; topN . addAll ( wordInfoList ) ; return topN . toList ( ) ;
public class SubscriptionsApi { /** * Validate Subscription * Validate Subscription * @ param subId Subscription ID . ( required ) * @ param validationCallbackRequest Subscription validation callback request ( required ) * @ return ApiResponse & lt ; SubscriptionEnvelope & gt ; * @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */ public ApiResponse < SubscriptionEnvelope > validateSubscriptionWithHttpInfo ( String subId , ValidationCallbackInfo validationCallbackRequest ) throws ApiException { } }
com . squareup . okhttp . Call call = validateSubscriptionValidateBeforeCall ( subId , validationCallbackRequest , null , null ) ; Type localVarReturnType = new TypeToken < SubscriptionEnvelope > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ;
public class NetworkMonitor { /** * Returns WiFi State Requires ACCESS _ NETWORK _ SATE , READ _ PHONE _ STATE * permissions < br > * @ return State */ public State getWifiState ( ) { } }
if ( connMan == null ) { connMan = ( ConnectivityManager ) context . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; } NetworkInfo wifiNetworkInfo = connMan . getNetworkInfo ( TYPE_WIFI ) ; if ( wifiNetworkInfo == null ) { return State . UNKNOWN ; } return wifiNetworkInfo . getState ( ) ;
public class RowData { /** * 正規表現に一致する列に該当するセルの値を返します 。 * @ param regex * 正規表現 * @ return 正規表現に一致する列に該当するセルの値 */ public List < String > getCellValues ( String regex , List < ReplacePattern > replaces , boolean excludeEmptyValue ) { } }
List < String > valueList = new ArrayList < String > ( ) ; if ( StringUtils . isEmpty ( regex ) ) { LOG . warn ( "列名が空であるセル値は格納できません。" ) ; return valueList ; } Pattern pattern = Pattern . compile ( regex ) ; for ( Entry < String , String > entry : getData ( ) . entrySet ( ) ) { if ( pattern . matcher ( entry . getKey ( ) ) . matches ( ) ) { if ( excludeEmptyValue && StringUtils . isEmpty ( entry . getValue ( ) ) ) { continue ; } String value = value ( entry . getValue ( ) , replaces ) ; LOG . trace ( "key:{}, value:{}" , entry . getKey ( ) , value ) ; valueList . add ( value ) ; } } return valueList ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcBuildingElementPartType ( ) { } }
if ( ifcBuildingElementPartTypeEClass == null ) { ifcBuildingElementPartTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 60 ) ; } return ifcBuildingElementPartTypeEClass ;
public class RiakIndex { /** * Add a asSet of values to this secondary index . * @ param values a collection of values to add * @ return a reference to this object */ public final RiakIndex < T > add ( Collection < T > values ) { } }
for ( T value : values ) { add ( value ) ; } return this ;
public class SchemaBuilder { /** * Shortcut for { @ link # alterType ( CqlIdentifier ) alterType ( CqlIdentifier . fromCql ( typeName ) } */ @ NonNull public static AlterTypeStart alterType ( @ NonNull String typeName ) { } }
return alterType ( CqlIdentifier . fromCql ( typeName ) ) ;
public class Ci_HelpStg { /** * Processes general help with no specific command requested . * @ param info the info object to add help to */ protected void generalHelp ( IsInfoSetFT info ) { } }
// collect all commands belonging to a particular category String defKey = "__standard" ; Map < String , TreeMap < String , SkbShellCommand > > cat2Cmd = new TreeMap < > ( ) ; for ( CommandInterpreter ci : this . skbShell . getCommandMap ( ) . values ( ) ) { for ( SkbShellCommand ssc : ci . getCommands ( ) . values ( ) ) { String cat = defKey ; if ( ssc . getCategory ( ) != null ) { cat = ssc . getCategory ( ) . getCategory ( ) ; } if ( ! cat2Cmd . containsKey ( cat ) ) { cat2Cmd . put ( cat , new TreeMap < > ( ) ) ; } cat2Cmd . get ( cat ) . put ( ssc . getCommand ( ) , ssc ) ; } } // no argument , means general help info . addInfo ( "" ) ; info . addInfo ( "{} {}" , this . skbShell . getDisplayName ( ) , this . skbShell . getDescription ( ) ) ; info . addInfo ( "" ) ; // do the commands per category , starting with " _ _ standard " for ( String cat : cat2Cmd . keySet ( ) ) { String catDescr = cat ; if ( defKey . equals ( cat ) ) { catDescr = "standard commands" ; } info . addInfo ( "- {}: {}" , new Object [ ] { catDescr , cat2Cmd . get ( cat ) . keySet ( ) } ) ; } info . addInfo ( " try: 'help <command>' for more details" ) ;
public class TimeOfDay { /** * Returns a copy of this time with the second of minute field updated . * TimeOfDay is immutable , so there are no set methods . * Instead , this method returns a new instance with the value of * second of minute changed . * @ param second the second of minute to set * @ return a copy of this object with the field set * @ throws IllegalArgumentException if the value is invalid * @ since 1.3 */ public TimeOfDay withSecondOfMinute ( int second ) { } }
int [ ] newValues = getValues ( ) ; newValues = getChronology ( ) . secondOfMinute ( ) . set ( this , SECOND_OF_MINUTE , newValues , second ) ; return new TimeOfDay ( this , newValues ) ;
public class WisdomExecutor { /** * Waits for a file to be created . * @ param file the file * @ return { @ literal true } if the file was created , { @ literal false } otherwise */ public static boolean waitForFile ( File file ) { } }
if ( file . isFile ( ) ) { return true ; } else { // Start waiting 10 seconds maximum long timeout = System . currentTimeMillis ( ) + FILE_WAIT_TIMEOUT ; while ( System . currentTimeMillis ( ) <= timeout ) { sleepQuietly ( 10 ) ; if ( file . isFile ( ) ) { return true ; } } } // Timeout reached return false ;
public class XIfExpressionImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public NotificationChain basicSetIf ( XExpression newIf , NotificationChain msgs ) { } }
XExpression oldIf = if_ ; if_ = newIf ; if ( eNotificationRequired ( ) ) { ENotificationImpl notification = new ENotificationImpl ( this , Notification . SET , XbasePackage . XIF_EXPRESSION__IF , oldIf , newIf ) ; if ( msgs == null ) msgs = notification ; else msgs . add ( notification ) ; } return msgs ;
public class BoxFile { /** * Adds a new task to this file . The task can have an optional message to include , and a due date . * @ param action the action the task assignee will be prompted to do . * @ param message an optional message to include with the task . * @ param dueAt the day at which this task is due . * @ return information about the newly added task . */ public BoxTask . Info addTask ( BoxTask . Action action , String message , Date dueAt ) { } }
JsonObject itemJSON = new JsonObject ( ) ; itemJSON . add ( "type" , "file" ) ; itemJSON . add ( "id" , this . getID ( ) ) ; JsonObject requestJSON = new JsonObject ( ) ; requestJSON . add ( "item" , itemJSON ) ; requestJSON . add ( "action" , action . toJSONString ( ) ) ; if ( message != null && ! message . isEmpty ( ) ) { requestJSON . add ( "message" , message ) ; } if ( dueAt != null ) { requestJSON . add ( "due_at" , BoxDateFormat . format ( dueAt ) ) ; } URL url = ADD_TASK_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( this . getAPI ( ) , url , "POST" ) ; request . setBody ( requestJSON . toString ( ) ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject responseJSON = JsonObject . readFrom ( response . getJSON ( ) ) ; BoxTask addedTask = new BoxTask ( this . getAPI ( ) , responseJSON . get ( "id" ) . asString ( ) ) ; return addedTask . new Info ( responseJSON ) ;
public class PredicateOptimisations { /** * Checks if two predicates are identical or opposite . * @ param isFirstNegated is first predicate negated ? * @ param first the first predicate expression * @ param isSecondNegated is second predicate negated ? * @ param second the second predicate expression * @ return - 1 if unrelated predicates , 0 if identical predicates , 1 if opposite predicates */ public static int comparePrimaryPredicates ( boolean isFirstNegated , PrimaryPredicateExpr first , boolean isSecondNegated , PrimaryPredicateExpr second ) { } }
if ( first . getClass ( ) == second . getClass ( ) ) { if ( first instanceof ComparisonExpr ) { ComparisonExpr comparison1 = ( ComparisonExpr ) first ; ComparisonExpr comparison2 = ( ComparisonExpr ) second ; assert comparison1 . getLeftChild ( ) instanceof PropertyValueExpr ; assert comparison1 . getRightChild ( ) instanceof ConstantValueExpr ; assert comparison2 . getLeftChild ( ) instanceof PropertyValueExpr ; assert comparison2 . getRightChild ( ) instanceof ConstantValueExpr ; if ( comparison1 . getLeftChild ( ) . equals ( comparison2 . getLeftChild ( ) ) && comparison1 . getRightChild ( ) . equals ( comparison2 . getRightChild ( ) ) ) { ComparisonExpr . Type cmpType1 = comparison1 . getComparisonType ( ) ; if ( isFirstNegated ) { cmpType1 = cmpType1 . negate ( ) ; } ComparisonExpr . Type cmpType2 = comparison2 . getComparisonType ( ) ; if ( isSecondNegated ) { cmpType2 = cmpType2 . negate ( ) ; } return cmpType1 == cmpType2 ? 0 : ( cmpType1 == cmpType2 . negate ( ) ? 1 : - 1 ) ; } } else if ( first . equals ( second ) ) { return isFirstNegated == isSecondNegated ? 0 : 1 ; } } return - 1 ;
public class LegacySpy { /** * Alias for { @ link # expectBetween ( int , int , Threads , Query ) } with arguments 0 , { @ code allowedStatements } , { @ link Threads # CURRENT } , { @ code queryType } * @ since 2.2 */ @ Deprecated public C expectAtMost ( int allowedStatements , Query query ) { } }
return expect ( SqlQueries . maxQueries ( allowedStatements ) . type ( adapter ( query ) ) ) ;
public class TraceNLS { /** * Return the Base ( English ) resource bundle since we do not explicitly ship the _ en bundle . * @ param aClass * the class utilizing the resource bundle * @ param aBundleName * the name of the resource bundle * @ return ResourceBundle * the base resource bundle */ public static ResourceBundle getBaseResourceBundle ( Class < ? > aClass , String aBundleName ) { } }
ResourceBundle bundle = null ; final Class < ? > clazz = aClass ; final String bundleName = aBundleName ; // Need a special classloader trick to load the ENGLISH messages ( from the base bundle ) . // See BaseResourceBundleClassLoader for more info . ClassLoader cl = AccessController . doPrivileged ( new PrivilegedAction < ClassLoader > ( ) { public ClassLoader run ( ) { return new TraceNLSBundleClassLoader ( clazz . getClassLoader ( ) , bundleName ) ; } } ) ; bundle = ResourceBundle . getBundle ( bundleName , Locale . ENGLISH , cl ) ; return bundle ;
public class AmazonEC2Client { /** * Creates a new version for a launch template . You can specify an existing version of launch template from which to * base the new version . * Launch template versions are numbered in the order in which they are created . You cannot specify , change , or * replace the numbering of launch template versions . * @ param createLaunchTemplateVersionRequest * @ return Result of the CreateLaunchTemplateVersion operation returned by the service . * @ sample AmazonEC2 . CreateLaunchTemplateVersion * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / CreateLaunchTemplateVersion " * target = " _ top " > AWS API Documentation < / a > */ @ Override public CreateLaunchTemplateVersionResult createLaunchTemplateVersion ( CreateLaunchTemplateVersionRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeCreateLaunchTemplateVersion ( request ) ;
public class ResponseHelperSettings { /** * Set the default expiration settings to be used for objects that should use * HTTP caching * @ param nExpirationSeconds * The number of seconds for which the response should be cached * @ return { @ link EChange } */ @ Nonnull public static EChange setExpirationSeconds ( final int nExpirationSeconds ) { } }
return s_aRWLock . writeLocked ( ( ) -> { if ( s_nExpirationSeconds == nExpirationSeconds ) return EChange . UNCHANGED ; s_nExpirationSeconds = nExpirationSeconds ; LOGGER . info ( "ResponseHelper expirationSeconds=" + nExpirationSeconds ) ; return EChange . CHANGED ; } ) ;
public class BinomialBoundsN { /** * a Frequentist confidence interval based on the tails of the Binomial distribution . */ private static double computeApproxBinoUB ( final long numSamplesI , final double theta , final int numSDev ) { } }
if ( theta == 1.0 ) { return ( numSamplesI ) ; } else if ( numSamplesI == 0 ) { final double delta = deltaOfNumSDev [ numSDev ] ; final double rawUB = ( Math . log ( delta ) ) / ( Math . log ( 1.0 - theta ) ) ; return ( Math . ceil ( rawUB ) ) ; // round up } else if ( numSamplesI > 120 ) { // plenty of samples , so gaussian approximation to binomial distribution isn ' t too bad final double rawUB = contClassicUB ( numSamplesI , theta , numSDev ) ; return ( rawUB + 0.5 ) ; // fake round up } // at this point we know 1 < = numSamplesI < = 120 else if ( theta > ( 1.0 - 1e-5 ) ) { // empirically - determined threshold return ( numSamplesI + 1 ) ; } else if ( theta < ( ( numSamplesI ) / 360.0 ) ) { // empirically - determined threshold // here we use the gaussian approximation , but with a modified " numSDev " final int index ; final double rawUB ; index = ( 3 * ( ( int ) numSamplesI ) ) + ( numSDev - 1 ) ; rawUB = contClassicUB ( numSamplesI , theta , EquivTables . getUB ( index ) ) ; return ( rawUB + 0.5 ) ; // fake round up } else { // This is the most difficult range to approximate ; we will compute an " exact " UB . // We know that est < = 360 , so specialNPrimeF ( ) shouldn ' t be ridiculously slow . final double delta = deltaOfNumSDev [ numSDev ] ; final long nprimef = specialNPrimeF ( numSamplesI , theta , delta ) ; return ( nprimef ) ; // don ' t need to round }
public class GridScreen { /** * Read the current file in the header record given the current detail record . */ public void syncHeaderToMain ( ) { } }
super . syncHeaderToMain ( ) ; // NOTE ! This logic is VERY similar to the logic in getScreenURL , so change both . FileListener listener = this . getMainRecord ( ) . getListener ( ) ; while ( listener != null ) { if ( listener instanceof FileFilter ) { for ( int iIndex = 0 ; iIndex < 4 ; iIndex ++ ) { BaseField field = ( ( FileFilter ) listener ) . getReferencedField ( iIndex ) ; if ( field == null ) break ; if ( field . getRecord ( ) == this . getScreenRecord ( ) ) { // Okay here is one that needs to be added Utility . restoreFieldParam ( this , field ) ; } } } listener = ( FileListener ) listener . getNextListener ( ) ; }
public class DynamicPropertiesRule { /** * This rule adds dynamic getter , setter and builder methods based on the properties and additional properties * defined in a schema . * If accessors are being generated , then methods for getting and setting properties by name will be added . These * methods first attempt to call the appropriate getter or setter for the property . If the named property is not defined , * then the additional properties map is used . * If builders are being generated , then a method for building properties by name will be added . This method first * attempts to call the builder for the property . If no property with the supplied name is defined , then the additional * properties map is used . * The methods generated by this class throw an IllegalArgumentException , if the name specified for the property is unknown and * additional properties are not enabled . A ClassCastException will be thrown , when the value being set is incompatible with the * type of the named property . * @ param nodeName * the name of the node for which dynamic getters , setters , and builders are being added . * @ param node * the properties node , containing property names and their * definition * @ param parent * the parent node * @ param jclass * the Java type which will have the given properties added * @ param currentSchema * the schema being implemented * @ return the given jclass */ @ Override public JDefinedClass apply ( String nodeName , JsonNode node , JsonNode parent , JDefinedClass jclass , Schema currentSchema ) { } }
if ( ! ruleFactory . getGenerationConfig ( ) . isIncludeDynamicAccessors ( ) || ( ! ruleFactory . getGenerationConfig ( ) . isIncludeDynamicSetters ( ) && ! ruleFactory . getGenerationConfig ( ) . isIncludeDynamicGetters ( ) && ! ruleFactory . getGenerationConfig ( ) . isIncludeDynamicBuilders ( ) ) ) { return jclass ; } boolean isIncludeGetters = ruleFactory . getGenerationConfig ( ) . isIncludeGetters ( ) ; boolean isIncludeSetters = ruleFactory . getGenerationConfig ( ) . isIncludeSetters ( ) ; boolean isGenerateBuilders = ruleFactory . getGenerationConfig ( ) . isGenerateBuilders ( ) ; if ( isIncludeGetters || isIncludeSetters || isGenerateBuilders ) { if ( LanguageFeatures . canUseJava7 ( ruleFactory . getGenerationConfig ( ) ) ) { if ( isIncludeSetters ) { addInternalSetMethodJava7 ( jclass , node ) ; } if ( isIncludeGetters ) { addInternalGetMethodJava7 ( jclass , node ) ; } } else { if ( isIncludeSetters ) { addInternalSetMethodJava6 ( jclass , node ) ; } if ( isIncludeGetters ) { addInternalGetMethodJava6 ( jclass , node ) ; } } } if ( isIncludeGetters ) { addGetMethods ( jclass ) ; } if ( isIncludeSetters ) { addSetMethods ( jclass ) ; } if ( isGenerateBuilders ) { addWithMethods ( jclass ) ; } return jclass ;
public class RethinkDBClient { /** * ( non - Javadoc ) * @ see com . impetus . kundera . client . ClientBase # onPersist ( com . impetus . kundera . * metadata . model . EntityMetadata , java . lang . Object , java . lang . Object , * java . util . List ) */ @ Override protected void onPersist ( EntityMetadata entityMetadata , Object entity , Object id , List < RelationHolder > rlHolders ) { } }
if ( ! isUpdate ) { r . db ( entityMetadata . getSchema ( ) ) . table ( entityMetadata . getTableName ( ) ) . insert ( populateRmap ( entityMetadata , entity ) ) . run ( connection ) ; } else { r . db ( entityMetadata . getSchema ( ) ) . table ( entityMetadata . getTableName ( ) ) . update ( populateRmap ( entityMetadata , entity ) ) . run ( connection ) ; }
public class MandatoryWarningHandler { /** * Reports a mandatory warning to the log . If mandatory warnings * are not being enforced , treat this as an ordinary warning . */ private void logMandatoryWarning ( DiagnosticPosition pos , String msg , Object ... args ) { } }
// Note : the following log methods are safe if lintCategory is null . if ( enforceMandatory ) log . mandatoryWarning ( lintCategory , pos , msg , args ) ; else log . warning ( lintCategory , pos , msg , args ) ;
public class FrutillaRule { /** * Starts writing sentences . This is the entry point of the use case . < br / > * To add more sentences to the entry point use < br / > * { @ link org . frutilla . FrutillaParser . Given # and ( String ) } < br / > * { @ link org . frutilla . FrutillaParser . Given # but ( String ) } * @ param text the sentence . * @ return a { @ link org . frutilla . FrutillaParser . Given } to continue writing sentences . */ public FrutillaParser . Given given ( String text ) { } }
mRoot = FrutillaParser . given ( text ) ; return ( FrutillaParser . Given ) mRoot ;
public class MedicationDispense { /** * syntactic sugar */ public MedicationDispenseDosageInstructionComponent addDosageInstruction ( ) { } }
MedicationDispenseDosageInstructionComponent t = new MedicationDispenseDosageInstructionComponent ( ) ; if ( this . dosageInstruction == null ) this . dosageInstruction = new ArrayList < MedicationDispenseDosageInstructionComponent > ( ) ; this . dosageInstruction . add ( t ) ; return t ;
public class SyntheticStorableReferenceAccess { /** * Sets all the primary key properties of the given master , using the * applicable properties of the given reference . * @ param reference source of property values * @ param master master whose primary key properties will be set */ public void copyToMasterPrimaryKey ( Storable reference , S master ) throws FetchException { } }
try { mCopyToMasterPkMethod . invoke ( reference , master ) ; } catch ( Exception e ) { ThrowUnchecked . fireFirstDeclaredCause ( e , FetchException . class ) ; }
public class ApplicationDescriptorImpl { /** * If not already created , a new < code > message - destination < / code > element will be created and returned . * Otherwise , the first existing < code > message - destination < / code > element will be returned . * @ return the instance defined for the element < code > message - destination < / code > */ public MessageDestinationType < ApplicationDescriptor > getOrCreateMessageDestination ( ) { } }
List < Node > nodeList = model . get ( "message-destination" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new MessageDestinationTypeImpl < ApplicationDescriptor > ( this , "message-destination" , model , nodeList . get ( 0 ) ) ; } return createMessageDestination ( ) ;
public class ThreadUtils { /** * Determines whether the specified Thread is in a blocked state . A Thread may be currently blocked waiting on a lock * or performing some IO operation . * @ param thread the Thread to evaluate . * @ return a boolean valued indicating whether he specified Thread is blocked . * @ see java . lang . Thread # getState ( ) * @ see java . lang . Thread . State # BLOCKED */ @ NullSafe public static boolean isBlocked ( Thread thread ) { } }
return ( thread != null && Thread . State . BLOCKED . equals ( thread . getState ( ) ) ) ;
public class NodeWriteTrx { /** * Adapting the structure with a rolling hash for all ancestors only with * insert . * @ throws TTIOException * if anything weird happened */ private void rollingAdd ( ) throws TTException { } }
// start with hash to add final ITreeData startNode = mDelegate . getCurrentNode ( ) ; long hashToAdd = startNode . hashCode ( ) ; long newHash = 0 ; long possibleOldHash = 0 ; // go the path to the root do { synchronized ( mDelegate . getCurrentNode ( ) ) { getPtx ( ) . getData ( mDelegate . getCurrentNode ( ) . getDataKey ( ) ) ; if ( mDelegate . getCurrentNode ( ) . getDataKey ( ) == startNode . getDataKey ( ) ) { // at the beginning , take the hashcode of the node only newHash = hashToAdd ; } else if ( mDelegate . getCurrentNode ( ) . getDataKey ( ) == startNode . getParentKey ( ) ) { // at the parent level , just add the node possibleOldHash = mDelegate . getCurrentNode ( ) . getHash ( ) ; newHash = possibleOldHash + hashToAdd * PRIME ; hashToAdd = newHash ; } else { // at the rest , remove the existing old key for this element // and add the new one newHash = mDelegate . getCurrentNode ( ) . getHash ( ) - ( possibleOldHash * PRIME ) ; newHash = newHash + hashToAdd * PRIME ; hashToAdd = newHash ; possibleOldHash = mDelegate . getCurrentNode ( ) . getHash ( ) ; } mDelegate . getCurrentNode ( ) . setHash ( newHash ) ; getPtx ( ) . setData ( mDelegate . getCurrentNode ( ) ) ; } } while ( moveTo ( mDelegate . getCurrentNode ( ) . getParentKey ( ) ) ) ; mDelegate . setCurrentNode ( startNode ) ;
public class UserDetailsCache { /** * Gets the cached UserDetails for the given username . * Similar to { @ link # loadUserByUsername ( String ) } except it doesn ' t perform the actual lookup if there is a cache miss . * @ param idOrFullName the username * @ return { @ code null } if the cache doesn ' t contain any data for the key or the user details cached for the key . * @ throws UsernameNotFoundException if a previous lookup resulted in the same */ @ CheckForNull public UserDetails getCached ( String idOrFullName ) throws UsernameNotFoundException { } }
Boolean exists = existenceCache . getIfPresent ( idOrFullName ) ; if ( exists != null && ! exists ) { throw new UserMayOrMayNotExistException ( String . format ( "\"%s\" does not exist" , idOrFullName ) ) ; } else { return detailsCache . getIfPresent ( idOrFullName ) ; }
public class PresentationSpaceResetMixingImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setBgMxFlag ( Integer newBgMxFlag ) { } }
Integer oldBgMxFlag = bgMxFlag ; bgMxFlag = newBgMxFlag ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . PRESENTATION_SPACE_RESET_MIXING__BG_MX_FLAG , oldBgMxFlag , bgMxFlag ) ) ;
public class DataStoreAdapterException { /** * Utility method that preserves existing behavior of appending SQL State / error code to a translated message . */ private static final String formatMessage ( String resourceKey , Throwable exception , Object ... formatArguments ) { } }
String message = Tr . formatMessage ( tc , resourceKey , formatArguments ) ; if ( exception instanceof SQLException ) { SQLException sqlX = ( SQLException ) exception ; StringBuilder st = new StringBuilder ( message . length ( ) + 40 ) ; st . append ( message ) . append ( " with SQL State : " ) . append ( sqlX . getSQLState ( ) ) . append ( " SQL Code : " ) . append ( sqlX . getErrorCode ( ) ) ; message = st . toString ( ) ; } return message ;
public class RequestUtil { /** * 判断IP是否合法 . * @ param ip * @ return */ public static boolean isValidIp ( final String ip ) { } }
if ( ip == null || ip . length ( ) == 0 ) { return false ; } Matcher m = IS_VALID_IP_PATTERN . matcher ( ip ) ; return m . find ( ) ; // return false ; // return true ;
public class SiteParameters { /** * Tells whether or not this site has any parameters ( cookies , query , form * parameters , or response header fields ) . * @ return { @ code true } if this site has parameters , { @ code false } * otherwise . * @ since 2.5.0 */ public boolean hasParams ( ) { } }
return ! cookieParams . isEmpty ( ) || ! urlParams . isEmpty ( ) || ! formParams . isEmpty ( ) || ! headerParams . isEmpty ( ) || ! multipartParams . isEmpty ( ) ;
public class AbstractXmlReader { /** * Test an event to see whether it is an end tag with the expected name . */ protected boolean isEndTagEvent ( XMLEvent event , QName tagName ) { } }
return event . isEndElement ( ) && event . asEndElement ( ) . getName ( ) . equals ( tagName ) ;
public class SubsystemFeatureDefinitionImpl { /** * ( non - Javadoc ) * @ see com . ibm . wsspi . kernel . feature . LibertyFeature # getBundles ( ) */ @ Override public Collection < Bundle > getBundles ( ) { } }
if ( mfDetails == null ) throw new IllegalStateException ( "Method called outside of provisioining operation or without a registered service" ) ; Collection < Bundle > bundles = featureBundles . get ( ) ; if ( bundles == null ) { bundles = new ArrayList < Bundle > ( ) ; Collection < FeatureResource > bundlesInFeature = mfDetails . getConstituents ( SubsystemContentType . BUNDLE_TYPE ) ; BundleContext ctx = FrameworkUtil . getBundle ( FrameworkUtil . class ) . getBundleContext ( ) ; // symbolic name to bundle map . for ( FeatureResource bundle : bundlesInFeature ) { String location = bundle . getLocation ( ) ; Bundle b = ctx . getBundle ( location ) ; if ( b != null ) { bundles . add ( b ) ; } } // make an unmodifiable version . bundles = Collections . unmodifiableCollection ( bundles ) ; // store it away if it hasn ' t already been read . If this is read by another // thread at once then this thread will get this collection , and others will // the winner ' s . featureBundles . compareAndSet ( null , bundles ) ; } return bundles ;
public class EdgeInfo { /** * fast access method to avoid creating a new instance of an EdgeInfo */ public static String getVertexId ( Value value ) { } }
byte [ ] buffer = value . get ( ) ; int offset = 0 ; // skip label int strLen = readInt ( buffer , offset ) ; offset += 4 ; if ( strLen > 0 ) { offset += strLen ; } strLen = readInt ( buffer , offset ) ; return readString ( buffer , offset , strLen ) ;
public class Preferences { /** * load properties file */ public static void loadResourcesDefaults ( Properties defaultProperties , String propertiesFileName ) throws IOException { } }
final String resource = Setup . TEMPLATE_RESOURCES_PATH + "/" + propertiesFileName ; InputStream is = Preferences . class . getClassLoader ( ) . getResourceAsStream ( resource ) ; if ( null == is ) { throw new IOException ( "Unable to load resource: " + resource ) ; } try { defaultProperties . load ( is ) ; } finally { if ( null != is ) { is . close ( ) ; } }
public class Matrix4f { /** * Set the value of the matrix element at column 0 and row 0. * @ param m00 * the new value * @ return this */ public Matrix4f m00 ( float m00 ) { } }
this . m00 = m00 ; properties &= ~ PROPERTY_ORTHONORMAL ; if ( m00 != 1.0f ) properties &= ~ ( PROPERTY_IDENTITY | PROPERTY_TRANSLATION ) ; return this ;
public class SugarDataSource { /** * Method that list all elements . It run a SugarRecord . listAll but it ' s code is performed asynchronously * with the usage of Futures and callbacks . * @ param orderBy the way you want to order the objects you get * @ param successCallback the callback that is performed if the operation is successful * @ param errorCallback the callback that is performed if your code has an error */ public void listAll ( final String orderBy , final SuccessCallback < List < T > > successCallback , final ErrorCallback errorCallback ) { } }
checkNotNull ( successCallback ) ; checkNotNull ( errorCallback ) ; final Callable < List < T > > call = new Callable < List < T > > ( ) { @ Override public List < T > call ( ) throws Exception { return SugarRecord . listAll ( getSugarClass ( ) , orderBy ) ; } } ; final Future < List < T > > future = doInBackground ( call ) ; List < T > objects ; try { objects = future . get ( ) ; if ( null == objects || objects . isEmpty ( ) ) { errorCallback . onError ( new Exception ( "There are no objects in the database" ) ) ; } else { successCallback . onSuccess ( objects ) ; } } catch ( Exception e ) { errorCallback . onError ( e ) ; }
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public SIADIRCTION createSIADIRCTIONFromString ( EDataType eDataType , String initialValue ) { } }
SIADIRCTION result = SIADIRCTION . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link LogicType } { @ code > } } */ @ XmlElementDecl ( namespace = "http://www.w3.org/1998/Math/MathML" , name = "or" ) public JAXBElement < LogicType > createOr ( LogicType value ) { } }
return new JAXBElement < LogicType > ( _Or_QNAME , LogicType . class , null , value ) ;
public class AbstractIntIntMap { /** * Fills all keys contained in the receiver into the specified list . * Fills the list , starting at index 0. * After this call returns the specified list has a new size that equals < tt > this . size ( ) < / tt > . * Iteration order is guaranteed to be < i > identical < / i > to the order used by method { @ link # forEachKey ( IntProcedure ) } . * This method can be used to iterate over the keys of the receiver . * @ param list the list to be filled , can have any size . */ public void keys ( final IntArrayList list ) { } }
list . clear ( ) ; forEachKey ( new IntProcedure ( ) { public boolean apply ( int key ) { list . add ( key ) ; return true ; } } ) ;
public class LREnvelope { /** * Builds and returns a map of the envelope data including any signing data , suitable for sending to a Learning Registry node * @ return map of the envelope data , including signing data */ protected Map < String , Object > getSendableData ( ) { } }
Map < String , Object > doc = new LinkedHashMap < String , Object > ( ) ; MapUtil . put ( doc , docTypeField , docType ) ; MapUtil . put ( doc , docVersionField , docVersion ) ; MapUtil . put ( doc , activeField , true ) ; MapUtil . put ( doc , resourceDataTypeField , resourceDataType ) ; Map < String , Object > docId = new HashMap < String , Object > ( ) ; MapUtil . put ( docId , submitterTypeField , submitterType ) ; MapUtil . put ( docId , submitterField , submitter ) ; MapUtil . put ( docId , curatorField , curator ) ; MapUtil . put ( docId , ownerField , owner ) ; MapUtil . put ( docId , signerField , signer ) ; MapUtil . put ( doc , identityField , docId ) ; MapUtil . put ( doc , submitterTTLField , submitterTTL ) ; Map < String , Object > docTOS = new HashMap < String , Object > ( ) ; MapUtil . put ( docTOS , submissionTOSField , submissionTOS ) ; MapUtil . put ( docTOS , submissionAttributionField , submissionAttribution ) ; MapUtil . put ( doc , TOSField , docTOS ) ; MapUtil . put ( doc , resourceLocatorField , resourceLocator ) ; MapUtil . put ( doc , payloadPlacementField , payloadPlacement ) ; MapUtil . put ( doc , payloadSchemaField , payloadSchema ) ; MapUtil . put ( doc , payloadSchemaLocatorField , payloadSchemaLocator ) ; MapUtil . put ( doc , keysField , tags ) ; MapUtil . put ( doc , resourceDataField , getEncodedResourceData ( ) ) ; MapUtil . put ( doc , replacesField , replaces ) ; if ( signed ) { Map < String , Object > sig = new HashMap < String , Object > ( ) ; String [ ] keys = { publicKeyLocation } ; MapUtil . put ( sig , keyLocationField , keys ) ; MapUtil . put ( sig , signingMethodField , signingMethod ) ; MapUtil . put ( sig , signatureField , clearSignedMessage ) ; MapUtil . put ( doc , digitalSignatureField , sig ) ; } return doc ;
public class UpdateSpecifier { /** * Returns the actions required during a document update to modify * a target document so that it become equal to a source document . * @ param sourceDoc Source document * @ param documentDigest Digest computed for source document * @ param targetDoc Document currently on the target location * @ param schedule Specifies the type of update required * @ return Specifier that explains what needs to happen during an update * @ throws Exception */ static public UpdateSpecifier computeUpdateSpecifier ( Document sourceDoc , DocumentDigest documentDigest , JSONObject targetDoc , DocumentUpdateProcess . Schedule schedule , Comparator < JSONObject > objectComparator ) throws Exception { } }
UpdateSpecifier result = new UpdateSpecifier ( ) ; // Verify main document if ( schedule == DocumentUpdateProcess . Schedule . UPDATE_FORCED ) { logger . debug ( "Update forced by schedule. Mark document modified" ) ; result . setDocumentModified ( true ) ; } else if ( null == targetDoc ) { // Document creation logger . debug ( "Target document does not exist. Mark document modified" ) ; result . setDocumentModified ( true ) ; } else { if ( 0 != objectComparator . compare ( sourceDoc . getJSONObject ( ) , targetDoc ) ) { logger . debug ( "Documents do not compare as equal. Mark document modified" ) ; result . setDocumentModified ( true ) ; } } // Attachments . . . // Get attachments from source document Map < String , Attachment > attachmentsByName = new HashMap < String , Attachment > ( ) ; { Collection < Attachment > attachments = sourceDoc . getAttachments ( ) ; if ( null != attachments ) { for ( Attachment attachment : attachments ) { attachmentsByName . put ( attachment . getName ( ) , attachment ) ; } } } // Figure out which attachments should be deleted if ( null != targetDoc ) { JSONObject targetAttachments = targetDoc . optJSONObject ( "_attachments" ) ; if ( null != targetAttachments ) { Iterator < ? > it = targetAttachments . keys ( ) ; while ( it . hasNext ( ) ) { Object keyObj = it . next ( ) ; if ( keyObj instanceof String ) { String attachmentName = ( String ) keyObj ; if ( false == attachmentsByName . containsKey ( attachmentName ) ) { // Target document has an attachment not available in the // source one . Delete . logger . debug ( "Documents do not compare as equal. Mark document modified" ) ; result . addAttachmentToDelete ( attachmentName ) ; } } } } } // Figure out which attachments should be uploaded for ( Attachment attachment : attachmentsByName . values ( ) ) { String attachmentName = attachment . getName ( ) ; boolean shouldUpload = false ; if ( null == targetDoc ) { // On creation , upload all attachments shouldUpload = true ; } else if ( schedule == DocumentUpdateProcess . Schedule . UPDATE_FORCED ) { // On forced update , shouldUpload = true ; } else { String attachmentContentType = attachment . getContentType ( ) ; shouldUpload = shouldAttachmentBeUploaded ( targetDoc , attachmentName , documentDigest . getAttachmentDigest ( attachmentName ) , attachmentContentType ) ; } if ( shouldUpload ) { result . addAttachmentToUpload ( attachmentName ) ; } else { result . addAttachmentNotModified ( attachmentName ) ; } } return result ;
public class InferJSDocInfo { /** * Nullsafe wrapper for { @ code JSType # dereference ( ) } . */ private static ObjectType dereferenced ( @ Nullable JSType type ) { } }
return type == null ? null : type . dereference ( ) ;
public class LocalGridManager { /** * This method is responsible for spawning a local hub for supporting local executions * @ param testSession * - A { @ link AbstractTestSession } that represents the type of test session to start ( mobile or web ) . */ public static synchronized void spawnLocalHub ( AbstractTestSession testSession ) { } }
LOGGER . entering ( testSession . getPlatform ( ) ) ; if ( ! isRunLocally ( ) ) { LOGGER . exiting ( ) ; return ; } setupToBootList ( ) ; for ( LocalServerComponent eachItem : toBoot ) { try { eachItem . boot ( testSession ) ; } catch ( Exception e ) { // NOSONAR // If either the Grid or the Node failed to start at the first attempt then there is NO point in trying // to keep restarting it for every iteration . So lets log a severe message and exit the JVM . LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; System . exit ( 1 ) ; } } LOGGER . exiting ( ) ;
public class Require { /** * Throws an { @ link IndexOutOfBoundsException } if { @ code sliceFrom } or * { @ code sliceLength } is negative or the sum of both is greater than * { @ code arrayLength } . Note that this means that a slice of length zero * starting at array length is a valid slice . * @ param sliceFrom the start index of the slice to be checked * @ param sliceLength the length of the slice to be checked * @ param arrayLength the upper bound against which the slice is checked * @ param message exception message */ public static void validArraySlice ( final int sliceFrom , final int sliceLength , final int arrayLength , final String message ) { } }
if ( sliceFrom < 0 || sliceLength < 0 ) { throw new IndexOutOfBoundsException ( message ) ; } if ( sliceFrom + sliceLength > arrayLength ) { throw new IndexOutOfBoundsException ( message ) ; }
public class GetDomainSuggestionsResult { /** * A list of possible domain names . If you specified < code > true < / code > for < code > OnlyAvailable < / code > in the * request , the list contains only domains that are available for registration . * @ param suggestionsList * A list of possible domain names . If you specified < code > true < / code > for < code > OnlyAvailable < / code > in the * request , the list contains only domains that are available for registration . */ public void setSuggestionsList ( java . util . Collection < DomainSuggestion > suggestionsList ) { } }
if ( suggestionsList == null ) { this . suggestionsList = null ; return ; } this . suggestionsList = new com . amazonaws . internal . SdkInternalList < DomainSuggestion > ( suggestionsList ) ;
public class ZipFileContainer { /** * TODO : Move this to utilities . */ @ Trivial @ FFDCIgnore ( PrivilegedActionException . class ) private static String getCanonicalPath ( final File file ) throws IOException { } }
if ( System . getSecurityManager ( ) == null ) { return file . getCanonicalPath ( ) ; // throws IOException } else { try { return AccessController . doPrivileged ( new PrivilegedExceptionAction < String > ( ) { @ Override public String run ( ) throws IOException { return file . getCanonicalPath ( ) ; // throws IOException } } ) ; } catch ( PrivilegedActionException e ) { throw ( IOException ) e . getException ( ) ; } }
public class BoxApiUser { /** * Gets a request that gets information about the current user * @ return request to get information about the current user */ public BoxRequestsUser . GetUserInfo getCurrentUserInfoRequest ( ) { } }
BoxRequestsUser . GetUserInfo request = new BoxRequestsUser . GetUserInfo ( getUserInformationUrl ( "me" ) , mSession ) ; return request ;
public class DOTranslatorModule { /** * { @ inheritDoc } */ public void deserialize ( InputStream in , DigitalObject out , String format , String encoding , int transContext ) throws ObjectIntegrityException , StreamIOException , UnsupportedTranslationException , ServerException { } }
m_wrappedTranslator . deserialize ( in , out , format , encoding , transContext ) ;
public class FullTextSearchParser { /** * Parse the full - text search criteria from the supplied token stream . This method is useful when the full - text search * expression is included in other content . * @ param tokens the token stream containing the full - text search starting on the next token * @ return the term representation of the full - text search , or null if there are no terms * @ throws ParsingException if there is an error parsing the supplied string * @ throws IllegalArgumentException if the token stream is null */ public Term parse ( TokenStream tokens ) { } }
CheckArg . isNotNull ( tokens , "tokens" ) ; List < Term > terms = new ArrayList < Term > ( ) ; do { Term term = parseDisjunctedTerms ( tokens ) ; if ( term == null ) break ; terms . add ( term ) ; } while ( tokens . canConsume ( "OR" ) ) ; if ( terms . isEmpty ( ) ) return null ; return terms . size ( ) > 1 ? new Disjunction ( terms ) : terms . iterator ( ) . next ( ) ;
public class ManagedServerBootCmdFactory { /** * Resolve expressions in the given model ( if there are any ) * @ param unresolved node with possibly unresolved expressions . Cannot be { @ code null } * @ param expressionResolver resolver to use . Cannot be { @ code null } * @ param excludePostBootSystemProps { @ code true } if child system - property nodes should be checked * for the ' boot - time ' attribute , with resolution being * skipped if that is set to ' false ' . WFCORE - 450 * @ return a clone of { @ code unresolved } with all expression resolved */ static ModelNode resolveExpressions ( final ModelNode unresolved , final ExpressionResolver expressionResolver , boolean excludePostBootSystemProps ) { } }
ModelNode toResolve = unresolved . clone ( ) ; ModelNode sysProps = null ; if ( excludePostBootSystemProps && toResolve . hasDefined ( SYSTEM_PROPERTY ) ) { sysProps = toResolve . remove ( SYSTEM_PROPERTY ) ; } try { ModelNode result = expressionResolver . resolveExpressions ( toResolve ) ; if ( sysProps != null ) { ModelNode resolvedSysProps = new ModelNode ( ) . setEmptyObject ( ) ; for ( Property property : sysProps . asPropertyList ( ) ) { ModelNode val = property . getValue ( ) ; boolean bootTime = SystemPropertyResourceDefinition . BOOT_TIME . resolveModelAttribute ( expressionResolver , val ) . asBoolean ( ) ; if ( bootTime ) { val . get ( VALUE ) . set ( SystemPropertyResourceDefinition . VALUE . resolveModelAttribute ( expressionResolver , val ) ) ; } // store the resolved boot - time to save re - resolving later val . get ( BOOT_TIME ) . set ( bootTime ) ; resolvedSysProps . get ( property . getName ( ) ) . set ( val ) ; } result . get ( SYSTEM_PROPERTY ) . set ( resolvedSysProps ) ; } return result ; } catch ( OperationFailedException e ) { // Fail throw new IllegalStateException ( e . getMessage ( ) , e ) ; }
public class ExampleDetectDescribe { /** * For some features , there are pre - made implementations of DetectDescribePoint . This has only been done * in situations where there was a performance advantage or that it was a very common combination . */ public static < T extends ImageGray < T > , TD extends TupleDesc > DetectDescribePoint < T , TD > createFromPremade ( Class < T > imageType ) { } }
return ( DetectDescribePoint ) FactoryDetectDescribe . surfStable ( new ConfigFastHessian ( 1 , 2 , 200 , 1 , 9 , 4 , 4 ) , null , null , imageType ) ; // return ( DetectDescribePoint ) FactoryDetectDescribe . sift ( new ConfigCompleteSift ( - 1,5,300 ) ) ;
public class HtmlAdaptorServlet { /** * Invoke an operation on a MBean * @ param name The name of the bean * @ param index The operation index * @ param args The operation arguments * @ return The operation result * @ exception PrivilegedExceptionAction Thrown if the operation cannot be performed */ private OpResultInfo invokeOp ( final String name , final int index , final String [ ] args ) throws PrivilegedActionException { } }
return AccessController . doPrivileged ( new PrivilegedExceptionAction < OpResultInfo > ( ) { public OpResultInfo run ( ) throws Exception { return Server . invokeOp ( name , index , args ) ; } } ) ;
public class IOUtil { /** * Copies all available bytes from a { @ linkplain ByteBuffer } to a { @ linkplain OutputStream } . * @ param dst the { @ linkplain OutputStream } to copy to . * @ param buffer the { @ linkplain ByteBuffer } to copy from . * @ return the number of copied bytes . * @ throws IOException if an I / O error occurs . */ public static int copyBuffer ( OutputStream dst , ByteBuffer buffer ) throws IOException { } }
int remaining = buffer . remaining ( ) ; int copied = 0 ; if ( remaining > 0 ) { if ( buffer . hasArray ( ) ) { byte [ ] bufferArray = buffer . array ( ) ; int bufferArrayOffset = buffer . arrayOffset ( ) ; int bufferPosition = buffer . position ( ) ; dst . write ( bufferArray , bufferArrayOffset + bufferPosition , remaining ) ; buffer . position ( bufferPosition + remaining ) ; } else { byte [ ] bufferBytes = new byte [ remaining ] ; buffer . get ( bufferBytes ) ; dst . write ( bufferBytes ) ; } copied = remaining ; } return copied ;
public class InstrumentStreamableTask { /** * Instruments the supplied { @ link Streamable } implementing class . */ protected void processStreamable ( File source , CtClass clazz ) throws NotFoundException { } }
ArrayList < CtField > fields = Lists . newArrayList ( ) ; for ( CtField field : clazz . getDeclaredFields ( ) ) { int modifiers = field . getModifiers ( ) ; if ( Modifier . isStatic ( modifiers ) || Modifier . isTransient ( modifiers ) || ! ( Modifier . isProtected ( modifiers ) || Modifier . isPrivate ( modifiers ) ) ) { continue ; } fields . add ( field ) ; } HashSet < String > methods = Sets . newHashSet ( ) ; for ( CtMethod method : clazz . getMethods ( ) ) { methods . add ( method . getName ( ) ) ; } int added = 0 ; for ( CtField field : fields ) { String rname = FieldMarshaller . getReaderMethodName ( field . getName ( ) ) ; if ( ! methods . contains ( rname ) ) { String reader = "public void " + rname + " (com.threerings.io.ObjectInputStream ins) {\n" + // " throws java . io . IOException , java . lang . ClassNotFoundException \ n " + " " + getFieldReader ( field ) + "\n" + "}" ; // System . out . println ( " Adding reader " + clazz . getName ( ) + " : \ n " + reader ) ; try { clazz . addMethod ( CtNewMethod . make ( reader , clazz ) ) ; added ++ ; } catch ( CannotCompileException cce ) { System . err . println ( "Unable to compile reader [class=" + clazz . getName ( ) + ", error=" + cce + "]:" ) ; System . err . println ( reader ) ; } } String wname = FieldMarshaller . getWriterMethodName ( field . getName ( ) ) ; if ( ! methods . contains ( wname ) ) { String writer = "public void " + wname + " (com.threerings.io.ObjectOutputStream out) {\n" + // " throws java . io . IOException \ n " + " " + getFieldWriter ( field ) + "\n" + "}" ; // System . out . println ( " Adding writer " + clazz . getName ( ) + " : \ n " + writer ) ; try { clazz . addMethod ( CtNewMethod . make ( writer , clazz ) ) ; added ++ ; } catch ( CannotCompileException cce ) { System . err . println ( "Unable to compile writer [class=" + clazz . getName ( ) + ", error=" + cce + "]:" ) ; System . err . println ( writer ) ; } } } if ( added > 0 ) { try { System . out . println ( "Instrumented '" + clazz . getName ( ) + "'." ) ; clazz . writeFile ( _outdir . getPath ( ) ) ; } catch ( Exception e ) { System . err . println ( "Failed to write instrumented class [class=" + clazz + ", outdir=" + _outdir + "]: " + e ) ; } }
public class Utils { /** * @ param cronExpression : A cron expression is a string separated by white space , to provide a * parser and evaluator for Quartz cron expressions . * @ return : org . quartz . CronExpression object . * TODO : Currently , we have to transform Joda Timezone to Java Timezone due to CronExpression . * Since Java8 enhanced Time functionalities , We consider transform all Jodatime to Java Time in * future . */ public static CronExpression parseCronExpression ( final String cronExpression , final DateTimeZone timezone ) { } }
if ( cronExpression != null ) { try { final CronExpression ce = new CronExpression ( cronExpression ) ; ce . setTimeZone ( TimeZone . getTimeZone ( timezone . getID ( ) ) ) ; return ce ; } catch ( final ParseException pe ) { logger . error ( "this cron expression {" + cronExpression + "} can not be parsed. " + "Please Check Quartz Cron Syntax." ) ; } return null ; } else { return null ; }
public class AbstractTokenizingFilter { /** * Adds a term , if one exists , from the tokens collection . * @ return whether or not a new term was added */ protected boolean addTerm ( ) { } }
final boolean termAdded = ! tokens . isEmpty ( ) ; if ( termAdded ) { final String term = tokens . pop ( ) ; clearAttributes ( ) ; termAtt . append ( term ) ; } return termAdded ;
public class StatementMetaData { /** * 设置挂在DAO方法上的属性 * @ param name * @ param value */ public void setAttribute ( String name , Object value ) { } }
if ( attributes == null ) { synchronized ( this ) { if ( attributes == null ) { attributes = new ConcurrentHashMap < String , Object > ( 4 ) ; } } } this . attributes . put ( name , value ) ;
public class OperationImpl { /** * Set some arguments for an operation into the given byte buffer . */ protected final void setArguments ( ByteBuffer bb , Object ... args ) { } }
boolean wasFirst = true ; for ( Object o : args ) { if ( wasFirst ) { wasFirst = false ; } else { bb . put ( ( byte ) ' ' ) ; } bb . put ( KeyUtil . getKeyBytes ( String . valueOf ( o ) ) ) ; } bb . put ( CRLF ) ;
public class ResourceIndexImpl { /** * { @ inheritDoc } */ public int countTriples ( String queryLang , String tripleQuery , int limit , boolean distinct ) throws TrippiException { } }
return _writer . countTriples ( queryLang , tripleQuery , limit , distinct ) ;
public class ProjectService { /** * get project from a resource * @ param resource * @ return */ public static Project getProject ( Resource resource ) { } }
Project retval = new Project ( ) ; retval . setUri ( resource . getUri ( ) ) ; retval . setUsername ( resource . getUsername ( ) ) ; retval . setPassword ( resource . getPassword ( ) ) ; retval . setBranchTagName ( resource . getBranchTagName ( ) ) ; return retval ;
public class Collections { /** * Get an Iterator that returns the same elements returned by the supplied Iterator , but in a * completely random order . */ public static < T > Iterator < T > getRandomIterator ( Iterator < T > itr ) { } }
ArrayList < T > list = new ArrayList < T > ( ) ; CollectionUtil . addAll ( list , itr ) ; java . util . Collections . shuffle ( list ) ; return getUnmodifiableIterator ( list ) ;
public class AsyncMethodWrapper { /** * F743-761 */ private boolean isApplicationException ( Throwable ex , EJBMethodInfoImpl methodInfo ) { } }
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "isApplicationException : " + ex . getClass ( ) . getName ( ) + ", " + methodInfo ) ; // d660332 if ( ex instanceof Exception && ( ! ContainerProperties . DeclaredUncheckedAreSystemExceptions || ! ( ex instanceof RuntimeException ) ) ) { Class < ? > [ ] declaredExceptions = null ; // Checks if the method interface is business or component . // If it ' s a component interface , there is only one interface to worry about / / d734957 if ( ivInterface == WrapperInterface . LOCAL || ivInterface == WrapperInterface . REMOTE ) { declaredExceptions = methodInfo . ivDeclaredExceptionsComp ; } else { // Determine if there were any declared exceptions for the method // interface being used . However , if the wrapper is an aggregate // wrapper ( all interfaces ) , then just find the first set of // non - null declared exceptions . It is possible ( thought not likely ) // this could result in odd behavior , but a warning was logged // when the wrapper class was created . F743-34304 if ( ivBusinessInterfaceIndex == AGGREGATE_LOCAL_INDEX ) { for ( Class < ? > [ ] declaredEx : methodInfo . ivDeclaredExceptions ) { if ( declaredEx != null ) { declaredExceptions = declaredEx ; break ; } } } else { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "ivBusinessInterfaceIndex=" + ivBusinessInterfaceIndex ) ; declaredExceptions = methodInfo . ivDeclaredExceptions [ ivBusinessInterfaceIndex ] ; // F743-24429 } } if ( declaredExceptions != null ) { for ( Class < ? > declaredException : declaredExceptions ) { if ( declaredException . isAssignableFrom ( ex . getClass ( ) ) ) { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "isApplicationException : true" ) ; return true ; } } } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "isApplicationException : false" ) ; return false ;
public class SqlQueryStatement { /** * Appends the ORDER BY clause for the Query . * < br > * If the orderByField is found in the list of selected fields it ' s index is added . * Otherwise it ' s name is added . * @ param orderByFields * @ param selectedFields the names of the fields in the SELECT clause * @ param buf */ protected void appendOrderByClause ( List orderByFields , List selectedFields , StringBuffer buf ) { } }
if ( orderByFields == null || orderByFields . size ( ) == 0 ) { return ; } buf . append ( " ORDER BY " ) ; for ( int i = 0 ; i < orderByFields . size ( ) ; i ++ ) { FieldHelper cf = ( FieldHelper ) orderByFields . get ( i ) ; int colNumber = selectedFields . indexOf ( cf . name ) ; if ( i > 0 ) { buf . append ( "," ) ; } if ( colNumber >= 0 ) { buf . append ( colNumber + 1 ) ; } else { appendColName ( cf . name , false , null , buf ) ; } if ( ! cf . isAscending ) { buf . append ( " DESC" ) ; } }
public class UIComponent { /** * < p class = " changed _ added _ 2_0 " > Push the current * < code > UIComponent < / code > < code > this < / code > to the { @ link FacesContext } * attribute map using the key { @ link # CURRENT _ COMPONENT } saving the previous * < code > UIComponent < / code > associated with { @ link # CURRENT _ COMPONENT } for a * subsequent call to { @ link # popComponentFromEL } . < / p > * < pclass = " changed _ added _ 2_0 " > This method and < code > popComponentFromEL ( ) < / code > form the basis for * the contract that enables the EL Expression " < code > # { component } < / code > " to * resolve to the " current " component that is being processed in the * lifecycle . The requirements for when < code > pushComponentToEL ( ) < / code > and * < code > popComponentFromEL ( ) < / code > must be called are specified as * needed in the javadoc for this class . < / p > * < p class = " changed _ added _ 2_0 " > After * < code > pushComponentToEL ( ) < / code > returns , a call to { @ link * # getCurrentComponent } must return < code > this < / code > * < code > UIComponent < / code > instance until * < code > popComponentFromEL ( ) < / code > is called , after which point * the previous < code > UIComponent < / code > instance will be returned * from < code > getCurrentComponent ( ) < / code > < / p > * @ param context the { @ link FacesContext } for the current request * @ param component the < code > component < / code > to push to the EL . If * < code > component < / code > is < code > null < / code > the < code > UIComponent < / code > * instance that this call was invoked upon will be pushed to the EL . * @ throws NullPointerException if < code > context < / code > is < code > null < / code > * @ see javax . faces . context . FacesContext # getAttributes ( ) * @ since 2.0 */ public final void pushComponentToEL ( FacesContext context , UIComponent component ) { } }
if ( context == null ) { throw new NullPointerException ( ) ; } if ( null == component ) { component = this ; } Map < Object , Object > contextAttributes = context . getAttributes ( ) ; ArrayDeque < UIComponent > componentELStack = _getComponentELStack ( _CURRENT_COMPONENT_STACK_KEY , contextAttributes ) ; componentELStack . push ( component ) ; component . _isPushedAsCurrentRefCount ++ ; // we only do this because of the spec boolean setCurrentComponent = isSetCurrentComponent ( context ) ; if ( setCurrentComponent ) { contextAttributes . put ( UIComponent . CURRENT_COMPONENT , component ) ; } // if the pushed component is a composite component , we need to update that // stack as well if ( UIComponent . isCompositeComponent ( component ) ) { _getComponentELStack ( _CURRENT_COMPOSITE_COMPONENT_STACK_KEY , contextAttributes ) . push ( component ) ; // we only do this because of the spec if ( setCurrentComponent ) { contextAttributes . put ( UIComponent . CURRENT_COMPOSITE_COMPONENT , component ) ; } }
public class NameUtil { /** * Generates a readable name for this type . */ public static String getName ( TypeMirror type ) { } }
StringBuilder sb = new StringBuilder ( ) ; buildTypeName ( type , sb ) ; return sb . toString ( ) ;
public class Indexer { /** * Gets the column family of the index table based on the given column family and qualifier . * @ param columnFamily Presto column family * @ param columnQualifier Presto column qualifier * @ return ByteBuffer of the given index column family */ public static ByteBuffer getIndexColumnFamily ( byte [ ] columnFamily , byte [ ] columnQualifier ) { } }
return wrap ( ArrayUtils . addAll ( ArrayUtils . add ( columnFamily , UNDERSCORE ) , columnQualifier ) ) ;
public class PubSubMessageItemStream { /** * Gives signal to deleteMsgsWithNoReferences ( ) to gracefully exit . This happens in two cases * ( i ) When ME is stopped and ( ii ) When the destination is deleted * @ param hasToStop */ public void stopDeletingMsgsWihoutReferencesTask ( boolean hasToStop ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "stopDeletingMsgsWihoutReferencesTask" , hasToStop ) ; this . HasToStop = hasToStop ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "stopDeletingMsgsWihoutReferencesTask" , hasToStop ) ;
public class SasFileParser { /** * The function to convert the array of bytes that stores the data of a row into an array of objects . * Each object corresponds to a table cell . * @ param rowOffset - the offset of the row in cachedPage . * @ param rowLength - the length of the row . * @ param columnNames - list of column names which should be processed . * @ return the array of objects storing the data of the row . */ private Object [ ] processByteArrayWithData ( long rowOffset , long rowLength , List < String > columnNames ) { } }
Object [ ] rowElements ; if ( columnNames != null ) { rowElements = new Object [ columnNames . size ( ) ] ; } else { rowElements = new Object [ ( int ) sasFileProperties . getColumnsCount ( ) ] ; } byte [ ] source ; int offset ; if ( sasFileProperties . isCompressed ( ) && rowLength < sasFileProperties . getRowLength ( ) ) { Decompressor decompressor = LITERALS_TO_DECOMPRESSOR . get ( sasFileProperties . getCompressionMethod ( ) ) ; source = decompressor . decompressRow ( ( int ) rowOffset , ( int ) rowLength , ( int ) sasFileProperties . getRowLength ( ) , cachedPage ) ; offset = 0 ; } else { source = cachedPage ; offset = ( int ) rowOffset ; } for ( int currentColumnIndex = 0 ; currentColumnIndex < sasFileProperties . getColumnsCount ( ) && columnsDataLength . get ( currentColumnIndex ) != 0 ; currentColumnIndex ++ ) { if ( columnNames == null ) { rowElements [ currentColumnIndex ] = processElement ( source , offset , currentColumnIndex ) ; } else { String name = columns . get ( currentColumnIndex ) . getName ( ) ; if ( columnNames . contains ( name ) ) { rowElements [ columnNames . indexOf ( name ) ] = processElement ( source , offset , currentColumnIndex ) ; } } } return rowElements ;
public class CheckArg { /** * Check that the argument is not less than the supplied value * @ param argument The argument * @ param notLessThanValue the value that is to be used to check the value * @ param name The name of the argument * @ throws IllegalArgumentException If argument greater than or equal to the supplied vlaue */ public static void isNotLessThan ( int argument , int notLessThanValue , String name ) { } }
if ( argument < notLessThanValue ) { throw new IllegalArgumentException ( CommonI18n . argumentMayNotBeLessThan . text ( name , argument , notLessThanValue ) ) ; }
public class AlertService { /** * Creates a new alert . * @ param alert The alert to create with an un - populated ID field . * @ return The new alert having the ID field populated . * @ throws IOException If the server cannot be reached . * @ throws TokenExpiredException If the token sent along with the request has expired */ public Alert createAlert ( Alert alert ) throws IOException , TokenExpiredException { } }
String requestUrl = RESOURCE ; ArgusResponse response = getClient ( ) . executeHttpRequest ( ArgusHttpClient . RequestType . POST , requestUrl , alert ) ; assertValidResponse ( response , requestUrl ) ; return fromJson ( response . getResult ( ) , Alert . class ) ;
public class GLUtil { /** * Returns the next largest power of two , or zero if x is already a power of two . * TODO ( jgw ) : Is there no better way to do this than all this bit twiddling ? */ public static int nextPowerOfTwo ( int x ) { } }
assert x < 0x10000 ; int bit = 0x8000 , highest = - 1 , count = 0 ; for ( int i = 15 ; i >= 0 ; -- i , bit >>= 1 ) { if ( ( x & bit ) != 0 ) { ++ count ; if ( highest == - 1 ) { highest = i ; } } } if ( count <= 1 ) { return 0 ; } return 1 << ( highest + 1 ) ;
public class NetUtil { /** * 获取本机所有网卡 * @ return 所有网卡 , 异常返回 < code > null < / code > * @ since 3.0.1 */ public static Collection < NetworkInterface > getNetworkInterfaces ( ) { } }
Enumeration < NetworkInterface > networkInterfaces = null ; try { networkInterfaces = NetworkInterface . getNetworkInterfaces ( ) ; } catch ( SocketException e ) { return null ; } return CollectionUtil . addAll ( new ArrayList < NetworkInterface > ( ) , networkInterfaces ) ;
public class InternalGosuInit { /** * single module ( i . e . runtime ) */ public void initializeRuntime ( IExecutionEnvironment execEnv , List < ? extends GosuPathEntry > pathEntries , String ... discretePackages ) { } }
( ( ExecutionEnvironment ) execEnv ) . initializeDefaultSingleModule ( pathEntries , Collections . emptyList ( ) , discretePackages ) ;
public class OpenPgpManager { /** * Create a { @ link PubkeyElement } which contains the given { @ code data } base64 encoded . * @ param bytes byte representation of an OpenPGP public key * @ param date date of creation of the element * @ return { @ link PubkeyElement } containing the key */ private static PubkeyElement createPubkeyElement ( byte [ ] bytes , Date date ) { } }
return new PubkeyElement ( new PubkeyElement . PubkeyDataElement ( Base64 . encode ( bytes ) ) , date ) ;
public class GCMRKImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . GCMRK__RG : getRg ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ;
public class FileUtils { /** * Sorts file list , using this rules : directories first , sorted using provided comparator , then files sorted using provided comparator . * @ param files list to sort * @ param comparator comparator used to sort files and directories list * @ return sorted file list */ public static Array < FileHandle > sortFiles ( FileHandle [ ] files , Comparator < FileHandle > comparator ) { } }
return sortFiles ( files , comparator , false ) ;
public class HttpUpload { public static void upload ( HttpURLConnection conn , List < Entry < String , String > > fileList , List < Param > paramList ) throws IOException { } }
long time = System . currentTimeMillis ( ) ; String boundary = "Droid4jFormBoundary" + time ; boundary = "WebKitFormBoundary7Ihe6KrrkF27C7DX" ; // conn . setRequestProperty ( " Charset " , " UTF - 8 " ) ; conn . setRequestProperty ( "Content-Type" , "multipart/form-data; boundary=" + boundary ) ; OutputStream output = conn . getOutputStream ( ) ; DataOutputStream ds = new DataOutputStream ( output ) ; ds . writeBytes ( BR ) ; for ( Param param : paramList ) { if ( param . getValue ( ) != null ) { uploadParam ( ds , boundary , param ) ; } } for ( Entry < String , String > file : fileList ) { uploadFile ( ds , boundary , file ) ; } ds . writeBytes ( BR + "--" + boundary + "--" + BR ) ; ds . flush ( ) ; ds . close ( ) ;
public class Hierarchy { /** * Only looks in current processes ( not archived ) . */ public List < Process > findCalledProcesses ( Process mainproc , ProgressMonitor ... monitors ) throws IOException { } }
List < Process > processes = new ArrayList < > ( ) ; for ( String pkg : getPackageProcesses ( ) . keySet ( ) ) { for ( File procFile : getPackageProcesses ( ) . get ( pkg ) ) { processes . add ( loadProcess ( pkg , procFile , true ) ) ; } } return ProcessHierarchy . findInvoked ( mainproc , processes ) ;
public class ConvertUtil { /** * Converts any value to < code > Double < / code > . * @ param value value to convert . * @ return converted double . * @ throws ConversionException if the conversion failed */ public static Double toDouble ( Object value ) throws ConversionException { } }
if ( value == null ) { return null ; } else if ( value instanceof Number ) { return ( ( Number ) value ) . doubleValue ( ) ; } else { NumberFormat nf = new DecimalFormat ( ) ; try { return nf . parse ( value . toString ( ) ) . doubleValue ( ) ; } catch ( ParseException e ) { throw new ConversionException ( "failed to convert: '" + value + "' to Double" , e ) ; } }
public class ShippingStatesUrl { /** * Get Resource Url for GetStates * @ param profileCode The unique , user - defined code of the profile with which the shipping state is associated . * @ return String Resource Url */ public static MozuUrl getStatesUrl ( String profileCode ) { } }
UrlFormatter formatter = new UrlFormatter ( "/api/commerce/shipping/admin/profiles/{profilecode}/shippingstates" ) ; formatter . formatUrl ( "profileCode" , profileCode ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ;
public class VisibleBufferedInputStream { /** * Ensures that the buffer contains at least n bytes . This method invalidates the buffer and index * fields . * @ param n The amount of bytes to ensure exists in buffer * @ return true if required bytes are available and false if EOF * @ throws IOException If reading of the wrapped stream failed . */ public boolean ensureBytes ( int n ) throws IOException { } }
int required = n - endIndex + index ; while ( required > 0 ) { if ( ! readMore ( required ) ) { return false ; } required = n - endIndex + index ; } return true ;
public class AbstractClient { /** * { @ inheritDoc } */ @ Override public Client accept ( MediaType ... types ) { } }
for ( MediaType mt : types ) { possiblyAddHeader ( HttpHeaders . ACCEPT , JAXRSUtils . mediaTypeToString ( mt ) ) ; } return this ;
public class IdentificationMsg { /** * Maps ADS - B encoded to readable characters * @ param digits array of encoded digits * @ return array of decoded characters */ private static char [ ] mapChar ( byte [ ] digits ) { } }
char [ ] result = new char [ digits . length ] ; for ( int i = 0 ; i < digits . length ; i ++ ) result [ i ] = mapChar ( digits [ i ] ) ; return result ;
public class RepositoryDownloadUtil { /** * Gets the version of the resource using the getAppliesToVersions function . * @ param installResource - resource in a repository * @ return - the version of installResource */ public static String getProductVersion ( RepositoryResource installResource ) { } }
String resourceVersion = null ; try { Collection < ProductDefinition > pdList = new ArrayList < ProductDefinition > ( ) ; for ( ProductInfo pi : ProductInfo . getAllProductInfo ( ) . values ( ) ) { pdList . add ( new ProductInfoProductDefinition ( pi ) ) ; } resourceVersion = installResource . getAppliesToVersions ( pdList ) ; } catch ( Exception e ) { logger . log ( Level . FINEST , e . getMessage ( ) , e ) ; } if ( resourceVersion == null ) resourceVersion = InstallConstants . NOVERSION ; return resourceVersion ;
public class ClassGenericsUtil { /** * Returns a new instance of the given type for the specified className . * If the class for className is not found , the instantiation is tried using * the package of the given type as package of the given className . * This is a weaker type checked version of " { @ link # instantiate } " for use * with generics . * @ param < T > Class type for compile time type checking * @ param type desired Class type of the Object to retrieve * @ param className name of the class to instantiate * @ return a new instance of the given type for the specified className * @ throws ClassInstantiationException When a class cannot be instantiated . */ @ SuppressWarnings ( "unchecked" ) public static < T > T instantiateGenerics ( Class < ? > type , String className ) throws ClassInstantiationException { } }
// TODO : can we do a verification that type conforms to T somehow ? // ( probably not because generics are implemented via erasure . try { try { return ( ( Class < T > ) type ) . cast ( CLASSLOADER . loadClass ( className ) . newInstance ( ) ) ; } catch ( ClassNotFoundException e ) { // try package of type return ( ( Class < T > ) type ) . cast ( CLASSLOADER . loadClass ( type . getPackage ( ) . getName ( ) + "." + className ) . newInstance ( ) ) ; } } catch ( InstantiationException | IllegalAccessException | ClassNotFoundException | ClassCastException e ) { throw new ClassInstantiationException ( e ) ; }
public class WebXmlTemplate { /** * Public */ public void populateFromObj ( ProjectObj obj ) { } }
// FIXME : this needs something . . . List < ServletDesc > servlets = new ArrayList < ServletDesc > ( ) ; for ( PackageObj pkg : obj . getPackages ( ) ) { for ( InterfaceObj iface : pkg . getInterfaces ( ) ) { // servlets . add ( new ServletDesc ( iface . getCycName ( ) , iface . getFullPackageName ( ) ) ) ; servlets . add ( new ServletDesc ( "ws" , iface . getPackageName ( ) + ".ws" ) ) ; } } Collections . sort ( servlets ) ; setProperty ( SERVLETS_PROP , servlets ) ;
public class HTMLReport { /** * Write top - level index . html * @ param poolNames The pool names * @ param statuses The overall status of each pool * @ param ccmStatus The status of the CCM * @ param ccmPoolStatuses The CCM status of the pools * @ param version The version information * @ param fw The file writer * @ exception Exception If an error occurs */ private static void generateTopLevelIndexHTML ( Set < String > poolNames , Map < String , TraceEventStatus > statuses , TraceEventStatus ccmStatus , Map < String , TraceEventStatus > ccmPoolStatuses , TraceEvent version , FileWriter fw ) throws Exception { } }
writeString ( fw , "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"" ) ; writeEOL ( fw ) ; writeString ( fw , " \"http://www.w3.org/TR/html4/loose.dtd\">" ) ; writeEOL ( fw ) ; writeString ( fw , "<html>" ) ; writeEOL ( fw ) ; writeString ( fw , "<head>" ) ; writeEOL ( fw ) ; writeString ( fw , "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">" ) ; writeEOL ( fw ) ; writeString ( fw , "<title>IronJacamar tracer report</title>" ) ; writeEOL ( fw ) ; writeString ( fw , "</head>" ) ; writeEOL ( fw ) ; writeString ( fw , "<body style=\"background: #D7D7D7;\">" ) ; writeEOL ( fw ) ; writeString ( fw , "<h1>IronJacamar tracer report</h1>" ) ; writeEOL ( fw ) ; writeString ( fw , "<table>" ) ; writeEOL ( fw ) ; writeString ( fw , "<tr>" ) ; writeEOL ( fw ) ; writeString ( fw , "<td><b>Generated:</b></td>" ) ; writeEOL ( fw ) ; writeString ( fw , "<td>" + new Date ( ) + "</td>" ) ; writeEOL ( fw ) ; writeString ( fw , "</tr>" ) ; writeEOL ( fw ) ; writeString ( fw , "<tr>" ) ; writeEOL ( fw ) ; writeString ( fw , "<td><b>Data:</b></td>" ) ; writeEOL ( fw ) ; writeString ( fw , "<td>" + Version . PROJECT + " " + ( version != null ? version . getPool ( ) : "Unknown" ) + "</td>" ) ; writeEOL ( fw ) ; writeString ( fw , "</tr>" ) ; writeEOL ( fw ) ; writeString ( fw , "<tr>" ) ; writeEOL ( fw ) ; writeString ( fw , "<td><b>By:</b></td>" ) ; writeEOL ( fw ) ; writeString ( fw , "<td>" + Version . FULL_VERSION + "</td>" ) ; writeEOL ( fw ) ; writeString ( fw , "</tr>" ) ; writeEOL ( fw ) ; writeString ( fw , "</table>" ) ; writeEOL ( fw ) ; writeString ( fw , "<h2>Pool</h2>" ) ; writeEOL ( fw ) ; writeString ( fw , "<ul>" ) ; writeEOL ( fw ) ; for ( String name : poolNames ) { TraceEventStatus status = statuses . get ( name ) ; writeString ( fw , "<li>" ) ; writeString ( fw , "<a href=\"" + name + "/index.html\"><div style=\"color: " ) ; if ( status != null ) { writeString ( fw , status . getColor ( ) ) ; } else { writeString ( fw , TraceEventStatus . GREEN . getColor ( ) ) ; } writeString ( fw , ";\">" ) ; writeString ( fw , name ) ; writeString ( fw , "</div></a>" ) ; writeEOL ( fw ) ; writeString ( fw , "</li>" ) ; writeEOL ( fw ) ; } writeString ( fw , "</ul>" ) ; writeEOL ( fw ) ; writeString ( fw , "<h2>Lifecycle</h2>" ) ; writeEOL ( fw ) ; writeString ( fw , "<ul>" ) ; writeEOL ( fw ) ; for ( String name : poolNames ) { writeString ( fw , "<li>" ) ; writeString ( fw , "<a href=\"" + name + "/lifecycle.html\">" ) ; writeString ( fw , name ) ; writeString ( fw , "</a>" ) ; writeEOL ( fw ) ; writeString ( fw , "</li>" ) ; writeEOL ( fw ) ; } writeString ( fw , "</ul>" ) ; writeEOL ( fw ) ; writeString ( fw , "<h2>CachedConnectionManager</h2>" ) ; writeEOL ( fw ) ; writeString ( fw , "<ul>" ) ; writeEOL ( fw ) ; writeString ( fw , "<li><a href=\"CachedConnectionManager/ccm.html\"><div style=\"color: " ) ; writeString ( fw , ccmStatus . getColor ( ) ) ; writeString ( fw , ";\">Main report</div></a></li>" ) ; writeEOL ( fw ) ; writeString ( fw , "</ul>" ) ; writeEOL ( fw ) ; writeString ( fw , "<p>" ) ; writeEOL ( fw ) ; writeString ( fw , "<ul>" ) ; writeEOL ( fw ) ; for ( String name : poolNames ) { writeString ( fw , "<li>" ) ; writeString ( fw , "<a href=\"" + name + "/ccm.html\"><div style=\"color: " ) ; TraceEventStatus ps = ccmPoolStatuses . get ( name ) ; if ( ps != null ) { writeString ( fw , ps . getColor ( ) ) ; } else { writeString ( fw , TraceEventStatus . GREEN . getColor ( ) ) ; } writeString ( fw , ";\">" ) ; writeString ( fw , name ) ; writeString ( fw , "</div></a>" ) ; writeEOL ( fw ) ; writeString ( fw , "</li>" ) ; writeEOL ( fw ) ; } writeString ( fw , "</ul>" ) ; writeEOL ( fw ) ; writeString ( fw , "<h2>Reference</h2>" ) ; writeEOL ( fw ) ; writeString ( fw , "<ul>" ) ; writeEOL ( fw ) ; writeString ( fw , "<li><a href=\"toc-c.html\">Connection</a></li>" ) ; writeEOL ( fw ) ; writeString ( fw , "<li><a href=\"toc-mc.html\">ManagedConnection</a></li>" ) ; writeEOL ( fw ) ; writeString ( fw , "<li><a href=\"toc-cl.html\">ConnectionListener</a></li>" ) ; writeEOL ( fw ) ; writeString ( fw , "<li><a href=\"toc-mcp.html\">ManagedConnectionPool</a></li>" ) ; writeEOL ( fw ) ; writeString ( fw , "</ul>" ) ; writeEOL ( fw ) ; writeString ( fw , "<h2>Other</h2>" ) ; writeEOL ( fw ) ; writeString ( fw , "<ul>" ) ; writeEOL ( fw ) ; writeString ( fw , "<li><a href=\"transaction.html\">Transaction</a></li>" ) ; writeEOL ( fw ) ; writeString ( fw , "</ul>" ) ; writeEOL ( fw ) ; writeString ( fw , "</body>" ) ; writeEOL ( fw ) ; writeString ( fw , "</html>" ) ; writeEOL ( fw ) ;
public class Descriptor { /** * Partially matches this descriptor to another descriptor . Fields that contain * " * " or null are excluded from the match . * @ param descriptor the descriptor to match this one against . * @ return true if descriptors match and false otherwise * @ see # exactMatch ( Descriptor ) */ public boolean match ( Descriptor descriptor ) { } }
return matchField ( _group , descriptor . getGroup ( ) ) && matchField ( _type , descriptor . getType ( ) ) && matchField ( _kind , descriptor . getKind ( ) ) && matchField ( _name , descriptor . getName ( ) ) && matchField ( _version , descriptor . getVersion ( ) ) ;
public class DynamoDBReflector { /** * Returns the attribute name corresponding to the given getter method . */ String getAttributeName ( Method getter ) { } }
String attributeName ; readLockAttrName . lock ( ) ; try { attributeName = attributeNameCache . get ( getter ) ; } finally { readLockAttrName . unlock ( ) ; } if ( attributeName != null ) return attributeName ; DynamoDBHashKey hashKeyAnnotation = ReflectionUtils . getAnnotationFromGetterOrField ( getter , DynamoDBHashKey . class ) ; if ( hashKeyAnnotation != null ) { attributeName = hashKeyAnnotation . attributeName ( ) ; if ( attributeName != null && attributeName . length ( ) > 0 ) return cacheAttributeName ( getter , attributeName ) ; } DynamoDBIndexHashKey indexHashKey = ReflectionUtils . getAnnotationFromGetterOrField ( getter , DynamoDBIndexHashKey . class ) ; if ( indexHashKey != null ) { attributeName = indexHashKey . attributeName ( ) ; if ( attributeName != null && attributeName . length ( ) > 0 ) return cacheAttributeName ( getter , attributeName ) ; } DynamoDBRangeKey rangeKey = ReflectionUtils . getAnnotationFromGetterOrField ( getter , DynamoDBRangeKey . class ) ; if ( rangeKey != null ) { attributeName = rangeKey . attributeName ( ) ; if ( attributeName != null && attributeName . length ( ) > 0 ) return cacheAttributeName ( getter , attributeName ) ; } DynamoDBIndexRangeKey indexRangeKey = ReflectionUtils . getAnnotationFromGetterOrField ( getter , DynamoDBIndexRangeKey . class ) ; if ( indexRangeKey != null ) { attributeName = indexRangeKey . attributeName ( ) ; if ( attributeName != null && attributeName . length ( ) > 0 ) return cacheAttributeName ( getter , attributeName ) ; } DynamoDBAttribute attribute = ReflectionUtils . getAnnotationFromGetterOrField ( getter , DynamoDBAttribute . class ) ; if ( attribute != null ) { attributeName = attribute . attributeName ( ) ; if ( attributeName != null && attributeName . length ( ) > 0 ) return cacheAttributeName ( getter , attributeName ) ; } DynamoDBVersionAttribute version = ReflectionUtils . getAnnotationFromGetterOrField ( getter , DynamoDBVersionAttribute . class ) ; if ( version != null ) { attributeName = version . attributeName ( ) ; if ( attributeName != null && attributeName . length ( ) > 0 ) return cacheAttributeName ( getter , attributeName ) ; } // Default to the camel - cased field name of the getter method , inferred // according to the Java naming convention . attributeName = ReflectionUtils . getFieldNameByGetter ( getter , true ) ; return cacheAttributeName ( getter , attributeName ) ;