signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class CostBalancerStrategy { /** * For assignment , we want to move to the lowest cost server that isn ' t already serving the segment . * @ param proposalSegment A DataSegment that we are proposing to move . * @ param serverHolders An iterable of ServerHolders for a particular tier . * @ return A ServerHolder with the new home for a segment . */ protected Pair < Double , ServerHolder > chooseBestServer ( final DataSegment proposalSegment , final Iterable < ServerHolder > serverHolders , final boolean includeCurrentServer ) { } }
Pair < Double , ServerHolder > bestServer = Pair . of ( Double . POSITIVE_INFINITY , null ) ; List < ListenableFuture < Pair < Double , ServerHolder > > > futures = new ArrayList < > ( ) ; for ( final ServerHolder server : serverHolders ) { futures . add ( exec . submit ( ( ) -> Pair . of ( computeCost ( proposalSegment , server , includeCurrentServer ) , server ) ) ) ; } final ListenableFuture < List < Pair < Double , ServerHolder > > > resultsFuture = Futures . allAsList ( futures ) ; final List < Pair < Double , ServerHolder > > bestServers = new ArrayList < > ( ) ; bestServers . add ( bestServer ) ; try { for ( Pair < Double , ServerHolder > server : resultsFuture . get ( ) ) { if ( server . lhs <= bestServers . get ( 0 ) . lhs ) { if ( server . lhs < bestServers . get ( 0 ) . lhs ) { bestServers . clear ( ) ; } bestServers . add ( server ) ; } } // Randomly choose a server from the best servers bestServer = bestServers . get ( ThreadLocalRandom . current ( ) . nextInt ( bestServers . size ( ) ) ) ; } catch ( Exception e ) { log . makeAlert ( e , "Cost Balancer Multithread strategy wasn't able to complete cost computation." ) . emit ( ) ; } return bestServer ;
public class PeriodicReplicationService { /** * If the stored preferences are in the old format , upgrade them to the new format so that * the app continues to work after upgrade to this version . */ protected void upgradePreferences ( ) { } }
String alarmDueElapsed = "com.cloudant.sync.replication.PeriodicReplicationService.alarmDueElapsed" ; if ( mPrefs . contains ( alarmDueElapsed ) ) { // These are old style preferences . We need to rewrite them in the new form that allows // multiple replication policies . String alarmDueClock = "com.cloudant.sync.replication.PeriodicReplicationService.alarmDueClock" ; String replicationsActive = "com.cloudant.sync.replication.PeriodicReplicationService.periodicReplicationsActive" ; long elapsed = mPrefs . getLong ( alarmDueElapsed , 0 ) ; long clock = mPrefs . getLong ( alarmDueClock , 0 ) ; boolean enabled = mPrefs . getBoolean ( replicationsActive , false ) ; SharedPreferences . Editor editor = mPrefs . edit ( ) ; editor . putLong ( constructKey ( LAST_ALARM_ELAPSED_TIME_SUFFIX ) , elapsed - ( getIntervalInSeconds ( ) * MILLISECONDS_IN_SECOND ) ) ; editor . putLong ( constructKey ( LAST_ALARM_CLOCK_TIME_SUFFIX ) , clock - ( getIntervalInSeconds ( ) * MILLISECONDS_IN_SECOND ) ) ; editor . putBoolean ( constructKey ( PERIODIC_REPLICATION_ENABLED_SUFFIX ) , enabled ) ; editor . remove ( alarmDueElapsed ) ; editor . remove ( alarmDueClock ) ; editor . remove ( replicationsActive ) ; editor . apply ( ) ; }
public class DescribePullRequestEventsResult { /** * Information about the pull request events . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setPullRequestEvents ( java . util . Collection ) } or { @ link # withPullRequestEvents ( java . util . Collection ) } if * you want to override the existing values . * @ param pullRequestEvents * Information about the pull request events . * @ return Returns a reference to this object so that method calls can be chained together . */ public DescribePullRequestEventsResult withPullRequestEvents ( PullRequestEvent ... pullRequestEvents ) { } }
if ( this . pullRequestEvents == null ) { setPullRequestEvents ( new java . util . ArrayList < PullRequestEvent > ( pullRequestEvents . length ) ) ; } for ( PullRequestEvent ele : pullRequestEvents ) { this . pullRequestEvents . add ( ele ) ; } return this ;
public class JsonReader { /** * Read the Json from the passed { @ link IHasInputStream } . * @ param aISP * The input stream provider to use . May not be < code > null < / code > . * @ param aFallbackCharset * The charset to be used if no BOM is present . May not be * < code > null < / code > . * @ return < code > null < / code > if reading failed , the Json declarations * otherwise . */ @ Nullable public static IJson readFromStream ( @ Nonnull final IHasInputStream aISP , @ Nonnull final Charset aFallbackCharset ) { } }
return readFromStream ( aISP , aFallbackCharset , null ) ;
public class Ix { /** * Collects the elements of this sequence into a Map where the key is * determined from each element via the keySelector function ; duplicates are * overwritten . * @ param < K > the key type * @ param keySelector the function that receives the current element and returns * a key for it to be used as the Map key . * @ return the new Map instance * @ throws NullPointerException if keySelector is null * @ since 1.0 */ public final < K > Map < K , T > toMap ( IxFunction < ? super T , ? extends K > keySelector ) { } }
return this . < K > collectToMap ( keySelector ) . first ( ) ;
public class ModifyImageAttributeRequest { /** * The user groups . This parameter can be used only when the < code > Attribute < / code > parameter is * < code > launchPermission < / code > . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setUserGroups ( java . util . Collection ) } or { @ link # withUserGroups ( java . util . Collection ) } if you want to * override the existing values . * @ param userGroups * The user groups . This parameter can be used only when the < code > Attribute < / code > parameter is * < code > launchPermission < / code > . * @ return Returns a reference to this object so that method calls can be chained together . */ public ModifyImageAttributeRequest withUserGroups ( String ... userGroups ) { } }
if ( this . userGroups == null ) { setUserGroups ( new com . amazonaws . internal . SdkInternalList < String > ( userGroups . length ) ) ; } for ( String ele : userGroups ) { this . userGroups . add ( ele ) ; } return this ;
public class AbstractSmartLifecycleService { /** * / * ( non - Javadoc ) * @ see org . springframework . context . SmartLifecycle # stop ( java . lang . Runnable ) */ @ Override public void stop ( final Runnable callback ) { } }
if ( state . stop ( ) ) { serviceThreadPool . execute ( new Runnable ( ) { @ Override public void run ( ) { try { doStop ( ) ; state . finishStopping ( ) ; callback . run ( ) ; } catch ( Exception e ) { state . failStopping ( ) ; logger . warn ( "Failed to stop {}" , this . getClass ( ) . getName ( ) , e ) ; } } } ) ; }
public class CassandraSchemaManager { /** * On composite columns . * @ param translator * the translator * @ param compositeColumns * the composite columns * @ param queryBuilder * the query builder * @ param columns * the columns * @ param isCounterColumnFamily * the is counter column family */ private void onCompositeColumns ( CQLTranslator translator , List < ColumnInfo > compositeColumns , StringBuilder queryBuilder , List < ColumnInfo > columns , boolean isCounterColumnFamily ) { } }
MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( puMetadata . getPersistenceUnitName ( ) ) ; for ( ColumnInfo colInfo : compositeColumns ) { if ( columns == null || ( columns != null && ! columns . contains ( colInfo ) ) ) { String cqlType = null ; if ( isCounterColumnFamily ) { cqlType = "counter" ; translator . appendColumnName ( queryBuilder , colInfo . getColumnName ( ) , cqlType ) ; queryBuilder . append ( Constants . SPACE_COMMA ) ; } // check for composite partition keys # 734 else if ( colInfo . getType ( ) . isAnnotationPresent ( Embeddable . class ) ) { EmbeddableType embeddedObject = ( EmbeddableType ) metaModel . embeddable ( colInfo . getType ( ) ) ; for ( Field embeddedColumn : colInfo . getType ( ) . getDeclaredFields ( ) ) { if ( ! ReflectUtils . isTransientOrStatic ( embeddedColumn ) ) { validateAndAppendColumnName ( translator , queryBuilder , ( ( AbstractAttribute ) embeddedObject . getAttribute ( embeddedColumn . getName ( ) ) ) . getJPAColumnName ( ) , embeddedColumn . getType ( ) ) ; } } } else { validateAndAppendColumnName ( translator , queryBuilder , colInfo . getColumnName ( ) , colInfo . getType ( ) ) ; } } }
public class CallableStatementHandle { /** * # endif JDK > 6 */ public < T > T getObject ( int parameterIndex , Class < T > type ) throws SQLException { } }
return this . internalCallableStatement . getObject ( parameterIndex , type ) ;
public class AccountsApi { /** * Updates an existing account custom field . * @ param accountId The external account number ( int ) or account ID Guid . ( required ) * @ param customFieldId ( required ) * @ param customField ( optional ) * @ return CustomFields */ public CustomFields updateCustomField ( String accountId , String customFieldId , CustomField customField ) throws ApiException { } }
return updateCustomField ( accountId , customFieldId , customField , null ) ;
public class AbstractManagedType { /** * On check set attribute . * @ param < E > * the element type * @ param pluralAttribute * the plural attribute * @ param paramClass * the param class * @ return true , if successful */ private < E > boolean onCheckSetAttribute ( PluralAttribute < ? super X , ? , ? > pluralAttribute , Class < E > paramClass ) { } }
if ( pluralAttribute != null ) { if ( isSetAttribute ( pluralAttribute ) && isBindable ( pluralAttribute , paramClass ) ) { return true ; } } return false ;
public class DSLMapParser { /** * src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 172:1 : value _ sentence : ( variable _ reference | vc = value _ chunk - > VT _ LITERAL [ $ vc . start , text ] ) ; */ public final DSLMapParser . value_sentence_return value_sentence ( ) throws RecognitionException { } }
DSLMapParser . value_sentence_return retval = new DSLMapParser . value_sentence_return ( ) ; retval . start = input . LT ( 1 ) ; Object root_0 = null ; ParserRuleReturnScope vc = null ; ParserRuleReturnScope variable_reference19 = null ; RewriteRuleSubtreeStream stream_value_chunk = new RewriteRuleSubtreeStream ( adaptor , "rule value_chunk" ) ; String text = "" ; try { // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 176:5 : ( variable _ reference | vc = value _ chunk - > VT _ LITERAL [ $ vc . start , text ] ) int alt12 = 2 ; int LA12_0 = input . LA ( 1 ) ; if ( ( LA12_0 == LEFT_CURLY ) ) { alt12 = 1 ; } else if ( ( ( LA12_0 >= COLON && LA12_0 <= DOT ) || LA12_0 == EQUALS || ( LA12_0 >= LEFT_SQUARE && LA12_0 <= LITERAL ) || LA12_0 == RIGHT_SQUARE ) ) { alt12 = 2 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } NoViableAltException nvae = new NoViableAltException ( "" , 12 , 0 , input ) ; throw nvae ; } switch ( alt12 ) { case 1 : // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 176:7 : variable _ reference { root_0 = ( Object ) adaptor . nil ( ) ; pushFollow ( FOLLOW_variable_reference_in_value_sentence703 ) ; variable_reference19 = variable_reference ( ) ; state . _fsp -- ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) adaptor . addChild ( root_0 , variable_reference19 . getTree ( ) ) ; } break ; case 2 : // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 177:7 : vc = value _ chunk { pushFollow ( FOLLOW_value_chunk_in_value_sentence713 ) ; vc = value_chunk ( ) ; state . _fsp -- ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) stream_value_chunk . add ( vc . getTree ( ) ) ; if ( state . backtracking == 0 ) { text = ( vc != null ? input . toString ( vc . start , vc . stop ) : null ) ; } // AST REWRITE // elements : // token labels : // rule labels : retval // token list labels : // rule list labels : // wildcard labels : if ( state . backtracking == 0 ) { retval . tree = root_0 ; RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream ( adaptor , "rule retval" , retval != null ? retval . getTree ( ) : null ) ; root_0 = ( Object ) adaptor . nil ( ) ; // 178:5 : - > VT _ LITERAL [ $ vc . start , text ] { adaptor . addChild ( root_0 , ( Object ) adaptor . create ( VT_LITERAL , ( vc != null ? ( vc . start ) : null ) , text ) ) ; } retval . tree = root_0 ; } } break ; } retval . stop = input . LT ( - 1 ) ; if ( state . backtracking == 0 ) { retval . tree = ( Object ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( Object ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { // do for sure before leaving } return retval ;
public class GenericReflection { /** * This method dynamically invokes the method with the given name on the given * object . * @ param < RETURNTYPE > * The method return type * @ param aSrcObj * The source object on which the method is to be invoked . May not be * < code > null < / code > . * @ param sMethodName * The method to be invoked . * @ param aArgs * The arguments to be passed into the method . May be < code > null < / code > * . If not < code > null < / code > , the members of the array may not be * < code > null < / code > because otherwise the classes of the arguments * cannot be determined and will throw an Exception ! * @ return The return value of the invoked method or < code > null < / code > for * void methods . * @ throws NoSuchMethodException * Thrown by reflection * @ throws IllegalAccessException * Thrown by reflection * @ throws InvocationTargetException * Thrown by reflection */ @ Nullable public static < RETURNTYPE > RETURNTYPE invokeMethod ( @ Nonnull final Object aSrcObj , @ Nonnull final String sMethodName , @ Nullable final Object ... aArgs ) throws NoSuchMethodException , IllegalAccessException , InvocationTargetException { } }
return GenericReflection . < RETURNTYPE > invokeMethod ( aSrcObj , sMethodName , getClassArray ( aArgs ) , aArgs ) ;
public class HttpClientBuilder { /** * Configures an Apache { @ link org . apache . http . impl . client . HttpClientBuilder HttpClientBuilder } . * Intended for use by subclasses to inject HttpClientBuilder * configuration . The default implementation is an identity * function . */ protected org . apache . http . impl . client . HttpClientBuilder customizeBuilder ( org . apache . http . impl . client . HttpClientBuilder builder ) { } }
return builder ;
public class AstaTextFileReader { /** * Process tasks . * @ throws SQLException */ private void processTasks ( ) throws SQLException { } }
List < Row > bars = getTable ( "BAR" ) ; List < Row > expandedTasks = getTable ( "EXPANDED_TASK" ) ; List < Row > tasks = getTable ( "TASK" ) ; List < Row > milestones = getTable ( "MILESTONE" ) ; m_reader . processTasks ( bars , expandedTasks , tasks , milestones ) ;
public class AccountsApi { /** * Gets a list of brand profiles . * Retrieves the list of brand profiles associated with the account and the default brand profiles . The Account Branding feature ( accountSettings properties & # x60 ; canSelfBrandSend & # x60 ; and & # x60 ; canSelfBrandSend & # x60 ; ) must be set to * * true * * for the account to use this call . * @ param accountId The external account number ( int ) or account ID Guid . ( required ) * @ param options for modifying the method behavior . * @ return BrandsResponse * @ throws ApiException if fails to make API call */ public BrandsResponse listBrands ( String accountId , AccountsApi . ListBrandsOptions options ) throws ApiException { } }
Object localVarPostBody = "{}" ; // verify the required parameter ' accountId ' is set if ( accountId == null ) { throw new ApiException ( 400 , "Missing the required parameter 'accountId' when calling listBrands" ) ; } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/brands" . replaceAll ( "\\{format\\}" , "json" ) . replaceAll ( "\\{" + "accountId" + "\\}" , apiClient . escapeString ( accountId . toString ( ) ) ) ; // query params java . util . List < Pair > localVarQueryParams = new java . util . ArrayList < Pair > ( ) ; java . util . Map < String , String > localVarHeaderParams = new java . util . HashMap < String , String > ( ) ; java . util . Map < String , Object > localVarFormParams = new java . util . HashMap < String , Object > ( ) ; if ( options != null ) { localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "exclude_distributor_brand" , options . excludeDistributorBrand ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "include_logos" , options . includeLogos ) ) ; } final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; final String [ ] localVarContentTypes = { } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; String [ ] localVarAuthNames = new String [ ] { "docusignAccessCode" } ; GenericType < BrandsResponse > localVarReturnType = new GenericType < BrandsResponse > ( ) { } ; return apiClient . invokeAPI ( localVarPath , "GET" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ;
public class Command { /** * Create a CORBA Any object and insert a String in it . * @ param data The String 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 < / a > to read * < b > DevFailed < / b > exception specification */ public Any insert ( String data ) throws DevFailed { } }
Any out_any = alloc_any ( ) ; out_any . insert_string ( data ) ; return out_any ;
public class CPFriendlyURLEntryPersistenceImpl { /** * Returns the cp friendly url entry where groupId = & # 63 ; and classNameId = & # 63 ; and languageId = & # 63 ; and urlTitle = & # 63 ; or returns < code > null < / code > if it could not be found . Uses the finder cache . * @ param groupId the group ID * @ param classNameId the class name ID * @ param languageId the language ID * @ param urlTitle the url title * @ return the matching cp friendly url entry , or < code > null < / code > if a matching cp friendly url entry could not be found */ @ Override public CPFriendlyURLEntry fetchByG_C_L_U ( long groupId , long classNameId , String languageId , String urlTitle ) { } }
return fetchByG_C_L_U ( groupId , classNameId , languageId , urlTitle , true ) ;
public class CmsMultiMessages { /** * Adds a list a messages instances to this multi message bundle . < p > * @ param messages the messages instance to add */ public void addMessages ( List < CmsMessages > messages ) { } }
if ( messages == null ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . ERR_MULTIMSG_EMPTY_LIST_0 ) ) ; } Iterator < CmsMessages > i = messages . iterator ( ) ; while ( i . hasNext ( ) ) { addMessages ( i . next ( ) ) ; }
public class HomeActivity { /** * show any error messages posted to the bus . */ @ Subscribe public void onFailure ( Throwable t ) { } }
Toast . makeText ( this , t . getMessage ( ) , LENGTH_LONG ) . show ( ) ;
public class FeatureCoreStyleExtension { /** * Create a style relationship for the feature table * @ param featureTable * feature table */ public void createStyleRelationship ( String featureTable ) { } }
createStyleRelationship ( getMappingTableName ( TABLE_MAPPING_STYLE , featureTable ) , featureTable , featureTable , StyleTable . TABLE_NAME ) ;
public class PaymentChannelClient { /** * < p > Called when the connection terminates . Notifies the { @ link StoredClientChannel } object that we can attempt to * resume this channel in the future and stops generating messages for the server . < / p > * < p > For stateless protocols , this translates to a client not using the channel for the immediate future , but * intending to reopen the channel later . There is likely little reason to use this in a stateless protocol . < / p > * < p > Note that this < b > MUST < / b > still be called even after either * { @ link IPaymentChannelClient . ClientConnection # destroyConnection ( PaymentChannelCloseException . CloseReason ) } or * { @ link PaymentChannelClient # settle ( ) } is called , to actually handle the connection close logic . < / p > */ @ Override public void connectionClosed ( ) { } }
lock . lock ( ) ; try { connectionOpen = false ; if ( state != null ) state . disconnectFromChannel ( ) ; } finally { lock . unlock ( ) ; }
public class WebSiteManagementClientImpl { /** * Updates publishing user . * Updates publishing user . * @ param userDetails Details of publishing user * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the UserInner object */ public Observable < ServiceResponse < UserInner > > updatePublishingUserWithServiceResponseAsync ( UserInner userDetails ) { } }
if ( userDetails == null ) { throw new IllegalArgumentException ( "Parameter userDetails is required and cannot be null." ) ; } if ( this . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.apiVersion() is required and cannot be null." ) ; } Validator . validate ( userDetails ) ; return service . updatePublishingUser ( userDetails , this . apiVersion ( ) , this . acceptLanguage ( ) , this . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < UserInner > > > ( ) { @ Override public Observable < ServiceResponse < UserInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < UserInner > clientResponse = updatePublishingUserDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class InitializationService { /** * Used to create a user . Implements special logic by encoding the password . * @ param user */ public void saveUser ( User user ) { } }
LOG . trace ( "Trying to create a new user" ) ; // encode the raw password using bcrypt final String pwHash = passwordEncoder . encode ( user . getPassword ( ) ) ; user . setPassword ( pwHash ) ; dao . saveOrUpdate ( user ) ; LOG . info ( "Created the user " + user . getAccountName ( ) ) ;
public class IPCLoggerChannel { /** * Separated out for easy overriding in tests . */ @ VisibleForTesting protected ExecutorService createExecutor ( ) { } }
return Executors . newSingleThreadExecutor ( new ThreadFactoryBuilder ( ) . setDaemon ( true ) . setNameFormat ( "Logger channel to " + addr ) . setUncaughtExceptionHandler ( UncaughtExceptionHandlers . systemExit ( ) ) . build ( ) ) ;
public class AbstractSaga { /** * Requests a timeout event with a specific name to this saga . The name can * be used to distinguish the timeout if multiple ones have been requested by the saga . */ protected TimeoutId requestTimeout ( final long delay , final TimeUnit unit , @ Nullable final String name ) { } }
return requestTimeout ( delay , unit , name , null ) ;
public class NotificationBoard { /** * Set the y degree that this board is rotated . * @ param y */ public void setBoardRotationY ( float y ) { } }
if ( mListeners != null ) { for ( StateListener l : mListeners ) { l . onBoardRotationY ( this , y ) ; } } mContentView . setRotationY ( y ) ;
public class Util { /** * Returns the first header with the given name ( case - insensitive ) or null . */ public static Header findHeader ( HttpResponse response , String headerName ) { } }
Header [ ] headers = response . getHeaders ( headerName ) ; return headers . length > 0 ? headers [ 0 ] : null ;
public class ContentType { /** * Extracts < code > Content - Type < / code > value from { @ link HttpEntity } exactly as * specified by the < code > Content - Type < / code > header of the entity . Returns < code > null < / code > * if not specified . * @ param entity HTTP entity * @ return content type * @ throws ParseException if the given text does not represent a valid * < code > Content - Type < / code > value . */ public static ContentType get ( final HttpEntity entity ) throws ParseException , UnsupportedCharsetException { } }
if ( entity == null ) { return null ; } Header header = entity . getContentType ( ) ; if ( header != null ) { HeaderElement [ ] elements = header . getElements ( ) ; if ( elements . length > 0 ) { return create ( elements [ 0 ] ) ; } } return null ;
public class IndexBuilder { /** * Sort the index map . Traverse the index map for all it ' s elements and * sort each element which is a list . */ protected void sortIndexMap ( ) { } }
for ( Iterator < List < Doc > > it = indexmap . values ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Collections . sort ( it . next ( ) , new DocComparator ( ) ) ; }
public class TableBucketReader { /** * Creates a new instance of the { @ link TableBucketReader } class that can read { @ link TableEntry } instances . * @ param segment A { @ link DirectSegmentAccess } that can be used to read from the Segment . * @ param getBackpointer A Function that , when invoked with a { @ link DirectSegmentAccess } and an offset , will return * a Backpointer originating at that offset , or - 1 if no such backpointer exists . * @ param executor An Executor for async operations . * @ return A new instance of the { @ link TableBucketReader } class . */ static TableBucketReader < TableEntry > entry ( @ NonNull DirectSegmentAccess segment , @ NonNull GetBackpointer getBackpointer , @ NonNull Executor executor ) { } }
return new TableBucketReader . Entry ( segment , getBackpointer , executor ) ;
public class Text { /** * deserialize */ public void readFields ( DataInput in ) throws IOException { } }
int newLength = WritableUtils . readVInt ( in ) ; setCapacity ( newLength , false ) ; in . readFully ( bytes , 0 , newLength ) ; length = newLength ;
public class Base64Url { /** * Encode a byte array into Base64Url encoded bytes . * @ param bytes The byte array to encode . * @ return a Base64Url instance */ public static Base64Url encode ( byte [ ] bytes ) { } }
if ( bytes == null ) { return new Base64Url ( null ) ; } else { return new Base64Url ( BaseEncoding . base64Url ( ) . omitPadding ( ) . encode ( bytes ) ) ; }
public class IfBlock { /** * define an ElseIf block . < br > * @ param init lambda expression returns an object or boolean value , * init = = null | | init . equals ( false ) will be considered * < b > false < / b > in traditional if expression . in other * cases , considered true * @ param body return body ' s return value if init is considered true * @ return if body */ public IfBlock < T , INIT > ElseIf ( RFunc0 < INIT > init , def < T > body ) { } }
if ( procceed ) if ( initVal != null && ! initVal . equals ( false ) ) { return new IfBlock < > ( this . body . apply ( initVal ) ) ; } else { return new IfBlock < > ( init , body ) ; } else return new IfBlock < > ( this . val ) ;
public class ContentStoreImpl { /** * { @ inheritDoc } */ @ Override public Content getContent ( final String spaceId , final String contentId ) throws ContentStoreException { } }
return getContent ( spaceId , contentId , 0l , null ) ;
public class Variables { /** * Shortcut for { @ code Variables . createVariables ( ) . putValue ( name , value ) } */ public static VariableMap putValue ( String name , Object value ) { } }
return createVariables ( ) . putValue ( name , value ) ;
public class Exec { /** * Launches the process , returning a handle to it for IO ops , etc . < br / > * The finish condition for the OutputProcess is that all processes outputting to standard out must be complete before * proceeding * @ return * @ throws IOException */ public Execed start ( ) throws IOException { } }
Process p = getProcessBuilder ( ) . start ( ) ; return new Execed ( cmd , p , builder . redirectErrorStream ( ) ) ;
public class FileUtils { /** * Deletes a file , never throwing an exception . If file is a directory , delete it and all sub - directories . * The difference between File . delete ( ) and this method are : * < ul > * < li > A directory to be deleted does not have to be empty . < / li > * < li > No exceptions are thrown when a file or directory cannot be deleted . < / li > * < / ul > * @ param path file or directory to delete , can be { @ code null } * @ return { @ code true } if the file or directory was deleted , otherwise { @ code false } */ public static boolean deleteQuietly ( @ Nullable Path path ) { } }
if ( path == null ) { return false ; } try { if ( path . toFile ( ) . isDirectory ( ) ) { deleteDirectory ( path ) ; } else { Files . delete ( path ) ; } return true ; } catch ( IOException | SecurityException ignored ) { return false ; }
public class RestClientConfiguration { /** * Creates and returns a new { @ link RestClientConfiguration } from the given { @ link Configuration } . * @ param config configuration from which the REST client endpoint configuration should be created from * @ return REST client endpoint configuration * @ throws ConfigurationException if SSL was configured incorrectly */ public static RestClientConfiguration fromConfiguration ( Configuration config ) throws ConfigurationException { } }
Preconditions . checkNotNull ( config ) ; final SSLHandlerFactory sslHandlerFactory ; if ( SSLUtils . isRestSSLEnabled ( config ) ) { try { sslHandlerFactory = SSLUtils . createRestClientSSLEngineFactory ( config ) ; } catch ( Exception e ) { throw new ConfigurationException ( "Failed to initialize SSLContext for the REST client" , e ) ; } } else { sslHandlerFactory = null ; } final long connectionTimeout = config . getLong ( RestOptions . CONNECTION_TIMEOUT ) ; final long idlenessTimeout = config . getLong ( RestOptions . IDLENESS_TIMEOUT ) ; int maxContentLength = config . getInteger ( RestOptions . CLIENT_MAX_CONTENT_LENGTH ) ; return new RestClientConfiguration ( sslHandlerFactory , connectionTimeout , idlenessTimeout , maxContentLength ) ;
public class Writer { /** * 设置specify * @ param value Type */ public void specify ( Type value ) { } }
if ( value instanceof GenericArrayType ) { this . specify = ( ( GenericArrayType ) value ) . getGenericComponentType ( ) ; } else if ( value instanceof Class && ( ( Class ) value ) . isArray ( ) ) { this . specify = ( ( Class ) value ) . getComponentType ( ) ; } else { this . specify = value ; }
public class Http2CodecUtil { /** * Results in a RST _ STREAM being sent for { @ code streamId } due to violating * < a href = " https : / / tools . ietf . org / html / rfc7540 # section - 6.5.2 " > SETTINGS _ MAX _ HEADER _ LIST _ SIZE < / a > . * @ param streamId The stream ID that was being processed when the exceptional condition occurred . * @ param maxHeaderListSize The max allowed size for a list of headers in bytes which was exceeded . * @ param onDecode { @ code true } if the exception was encountered during decoder . { @ code false } for encode . * @ throws Http2Exception a stream error . */ public static void headerListSizeExceeded ( int streamId , long maxHeaderListSize , boolean onDecode ) throws Http2Exception { } }
throw headerListSizeError ( streamId , PROTOCOL_ERROR , onDecode , "Header size exceeded max " + "allowed size (%d)" , maxHeaderListSize ) ;
public class TypeHandlerUtils { /** * Transfers data from InputStream into sql . Blob * @ param blob sql . Blob which would be filled * @ param input InputStream * @ return sql . Blob from InputStream * @ throws SQLException */ public static Object convertBlob ( Object blob , InputStream input ) throws SQLException { } }
return convertBlob ( blob , toByteArray ( input ) ) ;
public class AtlasEntityStoreV1 { /** * Validate if classification is not already associated with the entities * @ param guid unique entity id * @ param classifications list of classifications to be associated */ private void validateEntityAssociations ( String guid , List < AtlasClassification > classifications ) throws AtlasBaseException { } }
List < String > entityClassifications = getClassificationNames ( guid ) ; for ( AtlasClassification classification : classifications ) { String newClassification = classification . getTypeName ( ) ; if ( CollectionUtils . isNotEmpty ( entityClassifications ) && entityClassifications . contains ( newClassification ) ) { throw new AtlasBaseException ( AtlasErrorCode . INVALID_PARAMETERS , "entity: " + guid + ", already associated with classification: " + newClassification ) ; } }
public class DOMJettyWebXmlParser { private Class < ? > nodeClass ( Element node ) throws ClassNotFoundException { } }
String className = getAttribute ( node , "class" ) ; if ( className == null ) { return null ; } return Loader . loadClass ( DOMJettyWebXmlParser . class , className , true ) ;
public class IonizationPotentialTool { /** * Get the prediction result for the Oxygen family given a series of values . * It is based on 368 instances and 9 attributes ( descriptors ) using the Linear Regression Model * with result of Root mean squared error 0.64 with a cross validation of 10 folds . * @ param resultsH Array which contains the results of each descriptor * @ return The result */ private static double getDTOxygenF ( double [ ] resultsH ) { } }
double result = 0.0 ; double SE = resultsH [ 0 ] ; double PE = resultsH [ 1 ] ; double PSC = resultsH [ 2 ] ; double PIC = resultsH [ 3 ] ; double ETP = resultsH [ 4 ] ; double SPC = resultsH [ 5 ] ; double COUNTR = resultsH [ 6 ] ; // System . out . println ( " SE : " + SE + " , PE : " + PE + " , PSC : " + PSC + " , PIC : " + PIC + " , ETP : " + ETP + " , SPC : " + SPC + " , COUNTR : " + COUNTR + " , COUNTAr : " + COUNTAr ) ; result = - 0.0118 * SE - 0.1859 * PE - 0.0752 * PSC - 8.1697 * PIC - 0.2278 * ETP - 0.0041 * SPC + 0.0175 * COUNTR + 11.4835 ; return result ;
public class CommerceDiscountPersistenceImpl { /** * Removes the commerce discount where uuid = & # 63 ; and groupId = & # 63 ; from the database . * @ param uuid the uuid * @ param groupId the group ID * @ return the commerce discount that was removed */ @ Override public CommerceDiscount removeByUUID_G ( String uuid , long groupId ) throws NoSuchDiscountException { } }
CommerceDiscount commerceDiscount = findByUUID_G ( uuid , groupId ) ; return remove ( commerceDiscount ) ;
public class RetryHandlingMetaMasterMasterClient { /** * Sends a heartbeat to the leader master . Standby masters periodically execute this method * so that the leader master knows they are still running . * @ param masterId the master id * @ return whether this master should re - register */ public MetaCommand heartbeat ( final long masterId ) throws IOException { } }
return retryRPC ( ( ) -> mClient . masterHeartbeat ( MasterHeartbeatPRequest . newBuilder ( ) . setMasterId ( masterId ) . build ( ) ) . getCommand ( ) ) ;
public class GeoEquals { /** * Evaluates the given object against this expression . * @ param o The object to evaluate . * @ return True if the given object matches this expression , false otherwise . */ public Boolean evaluate ( Object o ) { } }
return getLeft ( ) . evaluate ( o ) . equals ( getRight ( ) . evaluate ( o ) ) ;
public class EurekaClientFactoryBuilder { /** * Use { @ link # withSSLContext ( SSLContext ) } */ @ Deprecated public B withTrustStoreFile ( String trustStoreFileName , String trustStorePassword ) { } }
this . trustStoreFileName = trustStoreFileName ; this . trustStorePassword = trustStorePassword ; return self ( ) ;
public class EllipseClustersIntoRegularGrid { /** * Combines the inner and outer grid into one grid for output . See { @ link Grid } for a discussion * on how elements are ordered internally . */ static void createRegularGrid ( List < List < NodeInfo > > gridByRows , Grid g ) { } }
g . reset ( ) ; g . columns = gridByRows . get ( 0 ) . size ( ) ; g . rows = gridByRows . size ( ) ; for ( int row = 0 ; row < g . rows ; row ++ ) { List < NodeInfo > list = gridByRows . get ( row ) ; for ( int i = 0 ; i < g . columns ; i ++ ) { g . ellipses . add ( list . get ( i ) . ellipse ) ; } }
public class DefaultCasConfigurationPropertiesSourceLocator { /** * Get all possible configuration files for config directory that actually exist as files . * @ param config Folder in which to look for files * @ param profiles Profiles that are active * @ return List of files to be processed in order where last one processed overrides others */ private List < Resource > scanForConfigurationResources ( final File config , final List < String > profiles ) { } }
val possibleFiles = getAllPossibleExternalConfigDirFilenames ( config , profiles ) ; return possibleFiles . stream ( ) . filter ( File :: exists ) . filter ( File :: isFile ) . map ( FileSystemResource :: new ) . collect ( Collectors . toList ( ) ) ;
public class DelayPath { /** * documentation inherited */ public boolean tick ( Pathable pable , long tickstamp ) { } }
if ( tickstamp >= _startStamp + _duration ) { if ( _source != null ) { pable . setLocation ( _source . x , _source . y ) ; } pable . pathCompleted ( tickstamp ) ; return ( _source != null ) ; } // If necessary , move the sprite to the supplied location if ( _source != null && ( pable . getX ( ) != _source . x || pable . getY ( ) != _source . y ) ) { pable . setLocation ( _source . x , _source . y ) ; return true ; } return false ;
public class PropsVectors { /** * Call compact ( ) , create a IntTrie with indexes into the compacted * vectors array . */ public IntTrie compactToTrieWithRowIndexes ( ) { } }
PVecToTrieCompactHandler compactor = new PVecToTrieCompactHandler ( ) ; compact ( compactor ) ; return compactor . builder . serialize ( new DefaultGetFoldedValue ( compactor . builder ) , new DefaultGetFoldingOffset ( ) ) ;
public class TagAdapter { /** * Returns the parent of this tag , which is always * getAdaptee ( ) . getParent ( ) . * This will either be the enclosing Tag ( if getAdaptee ( ) . getParent ( ) * implements Tag ) , or an adapter to the enclosing Tag ( if * getAdaptee ( ) . getParent ( ) does not implement Tag ) . * @ return The parent of the tag being adapted . */ public Tag getParent ( ) { } }
if ( ! parentDetermined ) { JspTag adapteeParent = simpleTagAdaptee . getParent ( ) ; if ( adapteeParent != null ) { if ( adapteeParent instanceof Tag ) { this . parent = ( Tag ) adapteeParent ; } else { // Must be SimpleTag - no other types defined . this . parent = new TagAdapter ( ( SimpleTag ) adapteeParent ) ; } } parentDetermined = true ; } return this . parent ;
public class ExecutionPath { /** * This will create an execution path from the list of objects * @ param objects the path objects * @ return a new execution path */ public static ExecutionPath fromList ( List < ? > objects ) { } }
assertNotNull ( objects ) ; ExecutionPath path = ExecutionPath . rootPath ( ) ; for ( Object object : objects ) { if ( object instanceof Number ) { path = path . segment ( ( ( Number ) object ) . intValue ( ) ) ; } else { path = path . segment ( String . valueOf ( object ) ) ; } } return path ;
public class ReflectiveInterceptor { /** * Performs access checks and returns a ( potential ) copy of the field with accessibility flag set if this necessary * for the acces operation to succeed . * If any checks fail , an appropriate exception is raised . * Warning this method is sensitive to stack depth ! Should expects to be called DIRECTLY from a jlr redicriction * method only ! */ private static Field asAccessibleField ( Field field , Object target , boolean makeAccessibleCopy ) throws IllegalAccessException { } }
if ( isDeleted ( field ) ) { throw Exceptions . noSuchFieldError ( field ) ; } Class < ? > clazz = field . getDeclaringClass ( ) ; int mods = field . getModifiers ( ) ; if ( field . isAccessible ( ) || Modifier . isPublic ( mods & jlClassGetModifiers ( clazz ) ) ) { // More expensive check not required / copy not required } else { // More expensive check required Class < ? > callerClass = getCallerClass ( ) ; JVM . ensureMemberAccess ( callerClass , clazz , target , mods ) ; if ( makeAccessibleCopy ) { // TODO : This code is not covered by a test . It needs a non - reloadable type with non - public // field , being accessed reflectively from a context that is " priviliged " to access it without setting the access flag . field = JVM . copyField ( field ) ; // copy : we must not change accessible flag on original method ! field . setAccessible ( true ) ; } } return makeAccessibleCopy ? field : null ;
public class PDatabase { /** * Get the physical db type from the record db type . * @ param iDatabaseType * @ return */ public static char getPDBTypeFromDBType ( int iDatabaseType ) { } }
char strPDBType = ThinPhysicalDatabase . MEMORY_TYPE ; if ( ( iDatabaseType & Constants . MAPPED ) != 0 ) ; iDatabaseType = iDatabaseType & Constants . TABLE_TYPE_MASK ; if ( iDatabaseType == Constants . LOCAL ) strPDBType = ThinPhysicalDatabase . NET_TYPE ; // Never asked if ( iDatabaseType == Constants . REMOTE ) strPDBType = ThinPhysicalDatabase . NET_TYPE ; // Never asked if ( iDatabaseType == Constants . TABLE ) strPDBType = ThinPhysicalDatabase . NET_TYPE ; return strPDBType ;
public class SwingGroovyMethods { /** * Overloads the left shift operator to provide an easy way to add * components to a popupMenu . < p > * @ param self a JPopupMenu * @ param action an action to be added to the popupMenu . * @ return same popupMenu , after the value was added to it . * @ since 1.6.4 */ public static JPopupMenu leftShift ( JPopupMenu self , Action action ) { } }
self . add ( action ) ; return self ;
public class CellField { /** * 複数の { @ link FieldValidator } を追加する 。 * @ param validators 複数のvalidatorのインスタンス 。 * @ return 自身のインスタンス 。 * @ throws NullPointerException validator is null . */ public CellField < T > add ( final List < FieldValidator < T > > validators ) { } }
if ( validators . isEmpty ( ) ) { return this ; } for ( FieldValidator < T > validator : validators ) { add ( validator ) ; } return this ;
public class ISUPMessageFactoryImpl { /** * ( non - Javadoc ) * @ see org . restcomm . protocols . ss7 . isup . ISUPMessageFactory # createIRS ( int ) */ @ Override public IdentificationResponseMessage createIRS ( int cic ) { } }
IdentificationResponseMessage msg = createIRS ( ) ; CircuitIdentificationCode code = this . parameterFactory . createCircuitIdentificationCode ( ) ; code . setCIC ( cic ) ; msg . setCircuitIdentificationCode ( code ) ; return msg ;
public class Gmp { /** * Calculate ( base ^ exponent ) % modulus ; faster , VULNERABLE TO TIMING ATTACKS . * @ param base the base , must be positive * @ param exponent the exponent * @ param modulus the modulus * @ return the ( base ^ exponent ) % modulus * @ throws ArithmeticException if modulus is non - positive , or the exponent is negative and the * base cannot be inverted */ public static BigInteger modPowInsecure ( BigInteger base , BigInteger exponent , BigInteger modulus ) { } }
if ( modulus . signum ( ) <= 0 ) { throw new ArithmeticException ( "modulus must be positive" ) ; } return INSTANCE . get ( ) . modPowInsecureImpl ( base , exponent , modulus ) ;
public class AcceptPreference { /** * Constructs an { @ link AcceptPreference } array from an { @ link javax . servlet . http . HttpServletRequest } . * @ param request the request to extract the { @ link AcceptPreference } from . * @ return the { @ link AcceptPreference } s reflecting all Accept - Headers in * the request , in case the request contains no header an * AcceptPreference quivalent to a single " * & # 47 ; * " header value is returned . */ public static AcceptPreference fromRequest ( HttpServletRequest request ) { } }
ArrayList < AcceptPreference > headers = new ArrayList < AcceptPreference > ( ) ; Enumeration < String > strHeaders = request . getHeaders ( RFC7231_HEADER ) ; while ( strHeaders . hasMoreElements ( ) ) { headers . add ( fromString ( strHeaders . nextElement ( ) ) ) ; } if ( headers . isEmpty ( ) ) { return fromString ( "*/*" ) ; } else { return fromHeaders ( headers ) ; }
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcAdvancedFace ( ) { } }
if ( ifcAdvancedFaceEClass == null ) { ifcAdvancedFaceEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 9 ) ; } return ifcAdvancedFaceEClass ;
public class Costs { /** * The order of comparison is : network first , then disk , then CPU . The comparison here happens each time * primarily after the heuristic costs , then after the quantifiable costs . * @ see java . lang . Comparable # compareTo ( java . lang . Object ) */ @ Override public int compareTo ( Costs o ) { } }
// check the network cost . if we have actual costs on both , use them , otherwise use the heuristic costs . if ( this . networkCost != UNKNOWN && o . networkCost != UNKNOWN ) { if ( this . networkCost != o . networkCost ) { return this . networkCost < o . networkCost ? - 1 : 1 ; } } else if ( this . heuristicNetworkCost < o . heuristicNetworkCost ) { return - 1 ; } else if ( this . heuristicNetworkCost > o . heuristicNetworkCost ) { return 1 ; } // next , check the disk cost . again , if we have actual costs on both , use them , otherwise use the heuristic costs . if ( this . diskCost != UNKNOWN && o . diskCost != UNKNOWN ) { if ( this . diskCost != o . diskCost ) { return this . diskCost < o . diskCost ? - 1 : 1 ; } } else if ( this . heuristicDiskCost < o . heuristicDiskCost ) { return - 1 ; } else if ( this . heuristicDiskCost > o . heuristicDiskCost ) { return 1 ; } // next , check the CPU cost . again , if we have actual costs on both , use them , otherwise use the heuristic costs . if ( this . cpuCost != UNKNOWN && o . cpuCost != UNKNOWN ) { return this . cpuCost < o . cpuCost ? - 1 : this . cpuCost > o . cpuCost ? 1 : 0 ; } else if ( this . heuristicCpuCost < o . heuristicCpuCost ) { return - 1 ; } else if ( this . heuristicCpuCost > o . heuristicCpuCost ) { return 1 ; } else { return 0 ; }
public class Validators { /** * The input parameter must contain the string c . if yes , the check passes * @ param c contained strings * @ return Validation */ public static Validation < String > contains ( String c ) { } }
return contains ( c , I18N_MAP . get ( i18nPrefix + "CONTAINS" ) ) ;
public class AbstractBaseLauncher { /** * Get the port for the instance represented by this launcher * @ return the port information . */ int getPort ( ) { } }
LOGGER . entering ( ) ; int val = - 1 ; InstanceType type = getType ( ) ; if ( commands . contains ( PORT_ARG ) ) { val = Integer . parseInt ( commands . get ( commands . indexOf ( PORT_ARG ) + 1 ) ) ; LOGGER . exiting ( val ) ; return val ; } try { if ( type . equals ( InstanceType . SELENIUM_NODE ) || type . equals ( InstanceType . SELENIUM_HUB ) ) { val = getSeleniumConfigAsJsonObject ( ) . get ( "port" ) . getAsInt ( ) ; } } catch ( JsonParseException | NullPointerException e ) { // ignore } // last ditch effort val = ( val != - 1 ) ? val : 4444 ; LOGGER . exiting ( val ) ; return val ;
public class Resolve { /** * Resolve a constructor , throw a fatal error if not found . * @ param pos The position to use for error reporting . * @ param env The environment current at the method invocation . * @ param site The type to be constructed . * @ param argtypes The types of the invocation ' s value arguments . * @ param typeargtypes The types of the invocation ' s type arguments . */ public MethodSymbol resolveInternalConstructor ( DiagnosticPosition pos , Env < AttrContext > env , Type site , List < Type > argtypes , List < Type > typeargtypes ) { } }
MethodResolutionContext resolveContext = new MethodResolutionContext ( ) ; resolveContext . internalResolution = true ; Symbol sym = resolveConstructor ( resolveContext , pos , env , site , argtypes , typeargtypes ) ; if ( sym . kind == MTH ) return ( MethodSymbol ) sym ; else throw new FatalError ( diags . fragment ( "fatal.err.cant.locate.ctor" , site ) ) ;
public class CPMeasurementUnitPersistenceImpl { /** * Returns the cp measurement unit where groupId = & # 63 ; and key = & # 63 ; and type = & # 63 ; or returns < code > null < / code > if it could not be found , optionally using the finder cache . * @ param groupId the group ID * @ param key the key * @ param type the type * @ param retrieveFromCache whether to retrieve from the finder cache * @ return the matching cp measurement unit , or < code > null < / code > if a matching cp measurement unit could not be found */ @ Override public CPMeasurementUnit fetchByG_K_T ( long groupId , String key , int type , boolean retrieveFromCache ) { } }
Object [ ] finderArgs = new Object [ ] { groupId , key , type } ; Object result = null ; if ( retrieveFromCache ) { result = finderCache . getResult ( FINDER_PATH_FETCH_BY_G_K_T , finderArgs , this ) ; } if ( result instanceof CPMeasurementUnit ) { CPMeasurementUnit cpMeasurementUnit = ( CPMeasurementUnit ) result ; if ( ( groupId != cpMeasurementUnit . getGroupId ( ) ) || ! Objects . equals ( key , cpMeasurementUnit . getKey ( ) ) || ( type != cpMeasurementUnit . getType ( ) ) ) { result = null ; } } if ( result == null ) { StringBundler query = new StringBundler ( 5 ) ; query . append ( _SQL_SELECT_CPMEASUREMENTUNIT_WHERE ) ; query . append ( _FINDER_COLUMN_G_K_T_GROUPID_2 ) ; boolean bindKey = false ; if ( key == null ) { query . append ( _FINDER_COLUMN_G_K_T_KEY_1 ) ; } else if ( key . equals ( "" ) ) { query . append ( _FINDER_COLUMN_G_K_T_KEY_3 ) ; } else { bindKey = true ; query . append ( _FINDER_COLUMN_G_K_T_KEY_2 ) ; } query . append ( _FINDER_COLUMN_G_K_T_TYPE_2 ) ; String sql = query . toString ( ) ; Session session = null ; try { session = openSession ( ) ; Query q = session . createQuery ( sql ) ; QueryPos qPos = QueryPos . getInstance ( q ) ; qPos . add ( groupId ) ; if ( bindKey ) { qPos . add ( StringUtil . toLowerCase ( key ) ) ; } qPos . add ( type ) ; List < CPMeasurementUnit > list = q . list ( ) ; if ( list . isEmpty ( ) ) { finderCache . putResult ( FINDER_PATH_FETCH_BY_G_K_T , finderArgs , list ) ; } else { CPMeasurementUnit cpMeasurementUnit = list . get ( 0 ) ; result = cpMeasurementUnit ; cacheResult ( cpMeasurementUnit ) ; } } catch ( Exception e ) { finderCache . removeResult ( FINDER_PATH_FETCH_BY_G_K_T , finderArgs ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } if ( result instanceof List < ? > ) { return null ; } else { return ( CPMeasurementUnit ) result ; }
public class DescribeIpGroupsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DescribeIpGroupsRequest describeIpGroupsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( describeIpGroupsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeIpGroupsRequest . getGroupIds ( ) , GROUPIDS_BINDING ) ; protocolMarshaller . marshall ( describeIpGroupsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( describeIpGroupsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class PushDownBooleanExpressionExecutorImpl { /** * TODO : explain */ @ Override public NodeCentricOptimizationResults < JoinOrFilterNode > apply ( PushDownBooleanExpressionProposal proposal , IntermediateQuery query , QueryTreeComponent treeComponent ) throws InvalidQueryOptimizationProposalException { } }
JoinOrFilterNode focusNode = proposal . getFocusNode ( ) ; for ( Map . Entry < CommutativeJoinOrFilterNode , Collection < ImmutableExpression > > targetEntry : proposal . getNewDirectRecipientNodes ( ) . asMap ( ) . entrySet ( ) ) { updateNewDirectRecipientNode ( treeComponent , targetEntry . getKey ( ) , targetEntry . getValue ( ) ) ; } for ( Map . Entry < QueryNode , Collection < ImmutableExpression > > targetEntry : proposal . getIndirectRecipientNodes ( ) . asMap ( ) . entrySet ( ) ) { updateIndirectRecipientNode ( treeComponent , targetEntry . getKey ( ) , targetEntry . getValue ( ) ) ; } QueryNode firstChild = query . getFirstChild ( focusNode ) . orElseThrow ( ( ) -> new InvalidQueryOptimizationProposalException ( "The focus node has no child" ) ) ; return updateFocusNode ( treeComponent , focusNode , proposal . getExpressionsToKeep ( ) ) . map ( n -> new NodeCentricOptimizationResultsImpl < > ( query , n ) ) . orElseGet ( ( ) -> new NodeCentricOptimizationResultsImpl < > ( query , Optional . of ( firstChild ) ) ) ;
public class AioSession { /** * 关闭输出 * @ return this */ public AioSession closeIn ( ) { } }
if ( null != this . channel ) { try { this . channel . shutdownInput ( ) ; } catch ( IOException e ) { throw new IORuntimeException ( e ) ; } } return this ;
public class JavaUserDefinedUntypedAggregation { /** * $ example off : untyped _ custom _ aggregation $ */ public static void main ( String [ ] args ) { } }
SparkSession spark = SparkSession . builder ( ) . appName ( "Java Spark SQL user-defined DataFrames aggregation example" ) . getOrCreate ( ) ; // $ example on : untyped _ custom _ aggregation $ // Register the function to access it spark . udf ( ) . register ( "myAverage" , new MyAverage ( ) ) ; Dataset < Row > df = spark . read ( ) . json ( "examples/src/main/resources/employees.json" ) ; df . createOrReplaceTempView ( "employees" ) ; df . show ( ) ; // | name | salary | // | Michael | 3000 | // | Andy | 4500 | // | Justin | 3500 | // | Berta | 4000 | Dataset < Row > result = spark . sql ( "SELECT myAverage(salary) as average_salary FROM employees" ) ; result . show ( ) ; // | average _ salary | // | 3750.0 | // $ example off : untyped _ custom _ aggregation $ spark . stop ( ) ;
public class UrlUtils { /** * Gets the singular of a plural . * @ param noun * Name . * @ return if the name was at singular , it does anything . If the name was a * plural , returns its singular . */ public String singularize ( String noun ) { } }
String singular = noun ; if ( singulars . get ( noun ) != null ) { singular = singulars . get ( noun ) ; } else if ( noun . matches ( ".*is$" ) ) { // Singular of * is = > * es singular = noun . substring ( 0 , noun . length ( ) - 2 ) + "es" ; } else if ( noun . matches ( ".*ies$" ) ) { // Singular of * ies = > * y singular = noun . substring ( 0 , noun . length ( ) - 3 ) + "y" ; } else if ( noun . matches ( ".*ves$" ) ) { // Singular of * ves = > * f singular = noun . substring ( 0 , noun . length ( ) - 3 ) + "f" ; } else if ( noun . matches ( ".*es$" ) ) { if ( noun . matches ( ".*les$" ) ) { // Singular of * les = > singular = noun . substring ( 0 , noun . length ( ) - 1 ) ; } else { // Singular of * es = > singular = noun . substring ( 0 , noun . length ( ) - 2 ) ; } } else if ( noun . matches ( ".*s$" ) ) { // Singular of * s = > singular = noun . substring ( 0 , noun . length ( ) - 1 ) ; } return singular ;
public class DefaultDedupEventStore { /** * Returns the mutable persistent sorted queue if managed by this JVM , { @ code null } otherwise . */ @ Nullable private DedupQueue getQueueReadWrite ( String queue , Duration waitDuration ) { } }
return _ownerGroup . startIfOwner ( queue , waitDuration ) ;
public class Lines { /** * Returns the square of the distance between the specified point and the specified line * segment . */ public static float pointSegDistSq ( float px , float py , float x1 , float y1 , float x2 , float y2 ) { } }
// A = ( x2 - x1 , y2 - y1) // P = ( px - x1 , py - y1) x2 -= x1 ; // A = ( x2 , y2) y2 -= y1 ; px -= x1 ; // P = ( px , py ) py -= y1 ; float dist ; if ( px * x2 + py * y2 <= 0.0 ) { // P * A dist = px * px + py * py ; } else { px = x2 - px ; // P = A - P = ( x2 - px , y2 - py ) py = y2 - py ; if ( px * x2 + py * y2 <= 0.0 ) { // P * A dist = px * px + py * py ; } else { dist = px * y2 - py * x2 ; dist = dist * dist / ( x2 * x2 + y2 * y2 ) ; // pxA / | A | } } if ( dist < 0 ) { dist = 0 ; } return dist ;
public class FastaReader { /** * The parsing is done in this method . < br > * This method tries to process all the available fasta records * in the File or InputStream , closes the underlying resource , * and return the results in { @ link LinkedHashMap } . < br > * You don ' t need to call { @ link # close ( ) } after calling this method . * @ see # process ( int ) * @ return { @ link HashMap } containing all the parsed fasta records * present , starting current fileIndex onwards . * @ throws IOException if an error occurs reading the input file */ public LinkedHashMap < String , S > process ( ) throws IOException { } }
LinkedHashMap < String , S > sequences = process ( - 1 ) ; close ( ) ; return sequences ;
public class CertificateVersion { /** * Encode the CertificateVersion period in DER form to the stream . * @ param out the OutputStream to marshal the contents to . * @ exception IOException on errors . */ public void encode ( OutputStream out ) throws IOException { } }
// Nothing for default if ( version == V1 ) { return ; } DerOutputStream tmp = new DerOutputStream ( ) ; tmp . putInteger ( version ) ; DerOutputStream seq = new DerOutputStream ( ) ; seq . write ( DerValue . createTag ( DerValue . TAG_CONTEXT , true , ( byte ) 0 ) , tmp ) ; out . write ( seq . toByteArray ( ) ) ;
public class AntlrGrammarGenUtil { /** * Returns the effective rule name for the generated Antlr grammar . * Inherited rules may be prefixed by { @ code super [ 0 . . 9 ] * } . Otherwise the * prefix { @ code rule or RULE _ } is used . * @ since 2.9 */ public static String getRuleName ( AbstractRule rule ) { } }
RuleWithParameterValues parameterValues = RuleWithParameterValues . findInEmfObject ( rule ) ; if ( parameterValues != null ) { return rule . getName ( ) ; } RuleNames ruleNames = RuleNames . getRuleNames ( rule ) ; return ruleNames . getAntlrRuleName ( rule ) ;
public class BaseMessageReplyInProcessor { /** * Given the converted message for return , do any further processing before returning the message . * @ param internalMessage The internal return message just as it was converted from the source . */ public BaseMessage processMessage ( BaseMessage message ) { } }
if ( message == null ) return null ; this . updateLogFiles ( message , true ) ; // Need to change log status to SENTOK ( also associate return message log trx ID ) ( todo ) String strReturnQueueName = null ; if ( message . getMessageHeader ( ) instanceof TrxMessageHeader ) strReturnQueueName = ( String ) ( ( TrxMessageHeader ) message . getMessageHeader ( ) ) . getMessageHeaderMap ( ) . get ( MessageConstants . RETURN_QUEUE_NAME ) ; if ( strReturnQueueName == null ) strReturnQueueName = MessageConstants . TRX_RETURN_QUEUE ; TrxMessageHeader privateMessageHeader = new TrxMessageHeader ( strReturnQueueName , MessageConstants . INTERNET_QUEUE , null ) ; if ( message . getMessageHeader ( ) . getRegistryIDMatch ( ) == null ) { // The registry is probably in the message header Integer intRegistryID = this . getRegistryID ( message ) ; if ( intRegistryID != null ) message . getMessageHeader ( ) . setRegistryIDMatch ( intRegistryID ) ; } privateMessageHeader . setRegistryIDMatch ( message . getMessageHeader ( ) . getRegistryIDMatch ( ) ) ; message . setMessageHeader ( privateMessageHeader ) ; Environment env = null ; if ( ( this . getTask ( ) != null ) && ( this . getTask ( ) . getApplication ( ) != null ) ) env = ( ( BaseApplication ) this . getTask ( ) . getApplication ( ) ) . getEnvironment ( ) ; if ( env == null ) env = Environment . getEnvironment ( null ) ; App app = null ; if ( this . getTask ( ) != null ) app = this . getTask ( ) . getApplication ( ) ; MessageManager msgManager = env . getMessageManager ( app , true ) ; msgManager . sendMessage ( message ) ; return null ;
public class LocalDateTime { /** * Formats this date - time using the specified formatter . * This date - time will be passed to the formatter to produce a string . * @ param formatter the formatter to use , not null * @ return the formatted date - time string , not null * @ throws DateTimeException if an error occurs during printing */ @ Override // override for Javadoc and performance public String format ( DateTimeFormatter formatter ) { } }
Objects . requireNonNull ( formatter , "formatter" ) ; return formatter . format ( this ) ;
public class MemberModifier { /** * Suppress an array of accessible objects . */ public static void suppress ( AccessibleObject [ ] accessibleObjects ) { } }
if ( accessibleObjects == null ) { throw new IllegalArgumentException ( "accessibleObjects cannot be null" ) ; } for ( AccessibleObject accessibleObject : accessibleObjects ) { if ( accessibleObject instanceof Constructor < ? > ) { SuppressCode . suppressConstructor ( ( Constructor < ? > ) accessibleObject ) ; } else if ( accessibleObject instanceof Field ) { SuppressCode . suppressField ( ( Field ) accessibleObject ) ; } else if ( accessibleObject instanceof Method ) { SuppressCode . suppressMethod ( ( Method ) accessibleObject ) ; } }
public class CommerceWishListUtil { /** * Returns all the commerce wish lists where groupId = & # 63 ; and userId = & # 63 ; and defaultWishList = & # 63 ; . * @ param groupId the group ID * @ param userId the user ID * @ param defaultWishList the default wish list * @ return the matching commerce wish lists */ public static List < CommerceWishList > findByG_U_D ( long groupId , long userId , boolean defaultWishList ) { } }
return getPersistence ( ) . findByG_U_D ( groupId , userId , defaultWishList ) ;
public class Element { /** * Focuses on the element , but only if the element * is present , displayed , enabled , and an input . If those conditions are not * met , the focus action will be logged , but skipped and the test will * continue . */ public void focus ( ) { } }
String cantFocus = "Unable to focus on " ; String action = "Focusing on " + prettyOutput ( ) ; String expected = prettyOutputStart ( ) + " is present, displayed, and enabled to be focused" ; try { if ( isNotPresentDisplayedEnabledInput ( action , expected , cantFocus ) ) { return ; } WebElement webElement = getWebElement ( ) ; new Actions ( driver ) . moveToElement ( webElement ) . perform ( ) ; } catch ( Exception e ) { log . warn ( e ) ; reporter . fail ( action , expected , cantFocus + prettyOutputEnd ( ) + e . getMessage ( ) ) ; return ; } reporter . pass ( action , expected , "Focused on " + prettyOutputEnd ( ) . trim ( ) ) ;
public class TileTOCRGImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setCOMPR ( Integer newCOMPR ) { } }
Integer oldCOMPR = compr ; compr = newCOMPR ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . TILE_TOCRG__COMPR , oldCOMPR , compr ) ) ;
public class ApiOvhEmailpro { /** * Alter this object properties * REST : PUT / email / pro / { service } / domain / { domainName } * @ param body [ required ] New object properties * @ param service [ required ] The internal name of your pro organization * @ param domainName [ required ] Domain name * API beta */ public void service_domain_domainName_PUT ( String service , String domainName , OvhDomain body ) throws IOException { } }
String qPath = "/email/pro/{service}/domain/{domainName}" ; StringBuilder sb = path ( qPath , service , domainName ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ;
public class CommandRunner { /** * Executes < code > command < / code > and returns the result . Use this method * when the command you are executing requires no input , writes only UTF - 8 * compatible text to STDOUT and / or STDERR , and you are comfortable with * buffering up all of that data in memory . Otherwise , use * { @ link # open ( String ) } , which allows you to work with the underlying * streams . * @ param command * The command to execute * @ return The resulting data * @ throws JSchException * If ssh execution fails * @ throws IOException * If unable to read the result data */ public ExecuteResult execute ( String command ) throws JSchException , IOException { } }
logger . debug ( "executing {} on {}" , command , sessionManager ) ; Session session = sessionManager . getSession ( ) ; ByteArrayOutputStream stdErr = new ByteArrayOutputStream ( ) ; ByteArrayOutputStream stdOut = new ByteArrayOutputStream ( ) ; int exitCode ; ChannelExecWrapper channel = null ; try { channel = new ChannelExecWrapper ( session , command , null , stdOut , stdErr ) ; } finally { exitCode = channel . close ( ) ; } return new ExecuteResult ( exitCode , new String ( stdOut . toByteArray ( ) , UTF8 ) , new String ( stdErr . toByteArray ( ) , UTF8 ) ) ;
public class ListSpeechSynthesisTasksResult { /** * List of SynthesisTask objects that provides information from the specified task in the list request , including * output format , creation time , task status , and so on . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setSynthesisTasks ( java . util . Collection ) } or { @ link # withSynthesisTasks ( java . util . Collection ) } if you want * to override the existing values . * @ param synthesisTasks * List of SynthesisTask objects that provides information from the specified task in the list request , * including output format , creation time , task status , and so on . * @ return Returns a reference to this object so that method calls can be chained together . */ public ListSpeechSynthesisTasksResult withSynthesisTasks ( SynthesisTask ... synthesisTasks ) { } }
if ( this . synthesisTasks == null ) { setSynthesisTasks ( new java . util . ArrayList < SynthesisTask > ( synthesisTasks . length ) ) ; } for ( SynthesisTask ele : synthesisTasks ) { this . synthesisTasks . add ( ele ) ; } return this ;
public class CommandExecutor { /** * Combination of everything before . * @ param timeout a * @ param unit a * @ param logLevel a * @ return a */ public NativeResponse exec ( long timeout , TimeUnit unit , Level logLevel ) { } }
return internalexec ( timeout , unit , logLevel ) ;
public class FlakeEncodingProvider { /** * Return a 128 - bit version of the given time and sequence numbers according * to the Flake specification . * @ param time a time value to encode * @ param sequence a sequence value to encode * @ return the Flake id as bytes */ @ Override public byte [ ] encodeAsBytes ( long time , int sequence ) { } }
byte [ ] buffer = new byte [ 16 ] ; buffer [ 0 ] = ( byte ) ( time >>> 56 ) ; buffer [ 1 ] = ( byte ) ( time >>> 48 ) ; buffer [ 2 ] = ( byte ) ( time >>> 40 ) ; buffer [ 3 ] = ( byte ) ( time >>> 32 ) ; buffer [ 4 ] = ( byte ) ( time >>> 24 ) ; buffer [ 5 ] = ( byte ) ( time >>> 16 ) ; buffer [ 6 ] = ( byte ) ( time >>> 8 ) ; buffer [ 7 ] = ( byte ) ( time ) ; long rest = shiftedMachineId | ( 0x0000FFFF & sequence ) ; buffer [ 8 ] = ( byte ) ( rest >>> 56 ) ; buffer [ 9 ] = ( byte ) ( rest >>> 48 ) ; buffer [ 10 ] = ( byte ) ( rest >>> 40 ) ; buffer [ 11 ] = ( byte ) ( rest >>> 32 ) ; buffer [ 12 ] = ( byte ) ( rest >>> 24 ) ; buffer [ 13 ] = ( byte ) ( rest >>> 16 ) ; buffer [ 14 ] = ( byte ) ( rest >>> 8 ) ; buffer [ 15 ] = ( byte ) ( rest ) ; return buffer ;
public class JDBCRepository { /** * Returns the highest supported level for the given desired level . * @ return null if not supported */ IsolationLevel selectIsolationLevel ( Transaction parent , IsolationLevel desiredLevel ) { } }
if ( desiredLevel == null ) { if ( parent == null ) { desiredLevel = mDefaultIsolationLevel ; } else { desiredLevel = parent . getIsolationLevel ( ) ; } } else if ( parent != null ) { IsolationLevel parentLevel = parent . getIsolationLevel ( ) ; // Can promote to higher level , but not lower . if ( parentLevel . compareTo ( desiredLevel ) >= 0 ) { desiredLevel = parentLevel ; } else { return null ; } } switch ( desiredLevel ) { case NONE : return IsolationLevel . NONE ; case READ_UNCOMMITTED : return mReadUncommittedLevel ; case READ_COMMITTED : return mReadCommittedLevel ; case REPEATABLE_READ : return mRepeatableReadLevel ; case SERIALIZABLE : return mSerializableLevel ; } return null ;
public class HdfsBasedUpdateProvider { /** * Get the update time of a { @ link Partition } * @ return the update time if available , 0 otherwise * { @ inheritDoc } * @ see HiveUnitUpdateProvider # getUpdateTime ( org . apache . hadoop . hive . ql . metadata . Partition ) */ @ Override public long getUpdateTime ( Partition partition ) throws UpdateNotFoundException { } }
try { return getUpdateTime ( partition . getDataLocation ( ) ) ; } catch ( IOException e ) { throw new UpdateNotFoundException ( String . format ( "Failed to get update time for %s" , partition . getCompleteName ( ) ) , e ) ; }
public class TaskManager { /** * / * This method is not thread safe , gets called from the thread safe method addNewList ( . . ) */ private boolean appendList ( List < Object > formattedEvents ) { } }
if ( newLists . size ( ) >= clientPoolSize ) return false ; boolean done = false ; while ( ! done ) { try { newLists . putLast ( formattedEvents ) ; done = true ; } catch ( InterruptedException e ) { // Interrupted try again } } return true ;
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public Tristate createTristateFromString ( EDataType eDataType , String initialValue ) { } }
Tristate result = Tristate . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ;
public class LinkFactoryImpl { /** * { @ inheritDoc } */ protected Content getTypeParameterLink ( LinkInfo linkInfo , Type typeParam ) { } }
LinkInfoImpl typeLinkInfo = new LinkInfoImpl ( m_writer . configuration , ( ( LinkInfoImpl ) linkInfo ) . getContext ( ) , typeParam ) ; typeLinkInfo . excludeTypeBounds = linkInfo . excludeTypeBounds ; typeLinkInfo . excludeTypeParameterLinks = linkInfo . excludeTypeParameterLinks ; typeLinkInfo . linkToSelf = linkInfo . linkToSelf ; typeLinkInfo . isJava5DeclarationLocation = false ; return getLink ( typeLinkInfo ) ;
public class DwgFile { /** * Modify the geometry of the objects applying the Extrusion vector where it * is necessary */ public void applyExtrusions ( ) { } }
for ( int i = 0 ; i < dwgObjects . size ( ) ; i ++ ) { DwgObject dwgObject = ( DwgObject ) dwgObjects . get ( i ) ; if ( dwgObject instanceof DwgArc ) { double [ ] arcCenter = ( ( DwgArc ) dwgObject ) . getCenter ( ) ; double [ ] arcExt = ( ( DwgArc ) dwgObject ) . getExtrusion ( ) ; arcCenter = AcadExtrusionCalculator . CalculateAcadExtrusion ( arcCenter , arcExt ) ; ( ( DwgArc ) dwgObject ) . setCenter ( arcCenter ) ; } else if ( dwgObject instanceof DwgAttdef ) { // Extrusion in DwgAttdef is not necessary } else if ( dwgObject instanceof DwgAttrib ) { Point2D attribInsertionPoint = ( ( DwgAttrib ) dwgObject ) . getInsertionPoint ( ) ; double attribElevation = ( ( DwgAttrib ) dwgObject ) . getElevation ( ) ; double [ ] attribInsertionPoint3D = new double [ ] { attribInsertionPoint . getX ( ) , attribInsertionPoint . getY ( ) , attribElevation } ; double [ ] attribExt = ( ( DwgAttrib ) dwgObject ) . getExtrusion ( ) ; attribInsertionPoint3D = AcadExtrusionCalculator . CalculateAcadExtrusion ( attribInsertionPoint3D , attribExt ) ; ( ( DwgAttrib ) dwgObject ) . setInsertionPoint ( new Point2D . Double ( attribInsertionPoint3D [ 0 ] , attribInsertionPoint3D [ 1 ] ) ) ; ( ( DwgAttrib ) dwgObject ) . setElevation ( attribInsertionPoint3D [ 2 ] ) ; } else if ( dwgObject instanceof DwgBlock ) { // DwgBlock hasn ' t Extrusion } else if ( dwgObject instanceof DwgBlockControl ) { // DwgBlockControl hasn ' t Extrusion } else if ( dwgObject instanceof DwgBlockHeader ) { // DwgBlockHeader hasn ' t Extrusion } else if ( dwgObject instanceof DwgCircle ) { double [ ] circleCenter = ( ( DwgCircle ) dwgObject ) . getCenter ( ) ; double [ ] circleExt = ( ( DwgCircle ) dwgObject ) . getExtrusion ( ) ; circleCenter = AcadExtrusionCalculator . CalculateAcadExtrusion ( circleCenter , circleExt ) ; ( ( DwgCircle ) dwgObject ) . setCenter ( circleCenter ) ; // Seems that Autocad don ' t apply the extrusion to Ellipses /* } else if ( dwgObject instanceof DwgEllipse ) { double [ ] ellipseCenter = ( ( DwgEllipse ) dwgObject ) . getCenter ( ) ; double [ ] ellipseExt = ( ( DwgEllipse ) dwgObject ) . getExtrusion ( ) ; ellipseCenter = AcadExtrusionCalculator . CalculateAcadExtrusion ( ellipseCenter , ellipseExt ) ; ( ( DwgEllipse ) dwgObject ) . setCenter ( ellipseCenter ) ; */ } else if ( dwgObject instanceof DwgInsert ) { double [ ] insertPoint = ( ( DwgInsert ) dwgObject ) . getInsertionPoint ( ) ; double [ ] insertExt = ( ( DwgInsert ) dwgObject ) . getExtrusion ( ) ; insertPoint = AcadExtrusionCalculator . CalculateAcadExtrusion ( insertPoint , insertExt ) ; ( ( DwgInsert ) dwgObject ) . setInsertionPoint ( insertPoint ) ; } else if ( dwgObject instanceof DwgLayer ) { // DwgLayer hasn ' t Extrusion } else if ( dwgObject instanceof DwgLayerControl ) { // DwgLayerControl hasn ' t Extrusion } else if ( dwgObject instanceof DwgLine ) { double [ ] lineP1 = ( ( DwgLine ) dwgObject ) . getP1 ( ) ; double [ ] lineP2 = ( ( DwgLine ) dwgObject ) . getP2 ( ) ; boolean zflag = ( ( DwgLine ) dwgObject ) . isZflag ( ) ; if ( zflag ) { // elev = 0.0; lineP1 = new double [ ] { lineP1 [ 0 ] , lineP1 [ 1 ] , 0.0 } ; lineP2 = new double [ ] { lineP2 [ 0 ] , lineP2 [ 1 ] , 0.0 } ; } double [ ] lineExt = ( ( DwgLine ) dwgObject ) . getExtrusion ( ) ; lineP1 = AcadExtrusionCalculator . CalculateAcadExtrusion ( lineP1 , lineExt ) ; lineP2 = AcadExtrusionCalculator . CalculateAcadExtrusion ( lineP2 , lineExt ) ; ( ( DwgLine ) dwgObject ) . setP1 ( lineP1 ) ; ( ( DwgLine ) dwgObject ) . setP2 ( lineP2 ) ; } else if ( dwgObject instanceof DwgLinearDimension ) { // TODO : Extrusions in DwgLinearDimension elements // TODO : Void LwPolylines are a bug } else if ( dwgObject instanceof DwgLwPolyline && ( ( DwgLwPolyline ) dwgObject ) . getVertices ( ) != null ) { Point2D [ ] vertices = ( ( DwgLwPolyline ) dwgObject ) . getVertices ( ) ; double [ ] lwPolylineExt = ( ( DwgLwPolyline ) dwgObject ) . getNormal ( ) ; // Normals and Extrusions aren ` t the same if ( lwPolylineExt [ 0 ] == 0 && lwPolylineExt [ 1 ] == 0 && lwPolylineExt [ 2 ] == 0 ) lwPolylineExt [ 2 ] = 1.0 ; double elev = ( ( DwgLwPolyline ) dwgObject ) . getElevation ( ) ; double [ ] [ ] lwPolylinePoints3D = new double [ vertices . length ] [ 3 ] ; for ( int j = 0 ; j < vertices . length ; j ++ ) { lwPolylinePoints3D [ j ] [ 0 ] = vertices [ j ] . getX ( ) ; lwPolylinePoints3D [ j ] [ 1 ] = vertices [ j ] . getY ( ) ; lwPolylinePoints3D [ j ] [ 2 ] = elev ; lwPolylinePoints3D [ j ] = AcadExtrusionCalculator . CalculateAcadExtrusion ( lwPolylinePoints3D [ j ] , lwPolylineExt ) ; } ( ( DwgLwPolyline ) dwgObject ) . setElevation ( elev ) ; for ( int j = 0 ; j < vertices . length ; j ++ ) { vertices [ j ] = new Point2D . Double ( lwPolylinePoints3D [ j ] [ 0 ] , lwPolylinePoints3D [ j ] [ 1 ] ) ; } ( ( DwgLwPolyline ) dwgObject ) . setVertices ( vertices ) ; } else if ( dwgObject instanceof DwgMText ) { double [ ] mtextPoint = ( ( DwgMText ) dwgObject ) . getInsertionPoint ( ) ; double [ ] mtextExt = ( ( DwgMText ) dwgObject ) . getExtrusion ( ) ; mtextPoint = AcadExtrusionCalculator . CalculateAcadExtrusion ( mtextPoint , mtextExt ) ; ( ( DwgMText ) dwgObject ) . setInsertionPoint ( mtextPoint ) ; } else if ( dwgObject instanceof DwgPoint ) { double [ ] point = ( ( DwgPoint ) dwgObject ) . getPoint ( ) ; double [ ] pointExt = ( ( DwgPoint ) dwgObject ) . getExtrusion ( ) ; point = AcadExtrusionCalculator . CalculateAcadExtrusion ( point , pointExt ) ; ( ( DwgPoint ) dwgObject ) . setPoint ( point ) ; } else if ( dwgObject instanceof DwgSolid ) { double [ ] corner1 = ( ( DwgSolid ) dwgObject ) . getCorner1 ( ) ; double [ ] corner2 = ( ( DwgSolid ) dwgObject ) . getCorner2 ( ) ; double [ ] corner3 = ( ( DwgSolid ) dwgObject ) . getCorner3 ( ) ; double [ ] corner4 = ( ( DwgSolid ) dwgObject ) . getCorner4 ( ) ; double [ ] solidExt = ( ( DwgSolid ) dwgObject ) . getExtrusion ( ) ; corner1 = AcadExtrusionCalculator . CalculateAcadExtrusion ( corner1 , solidExt ) ; ( ( DwgSolid ) dwgObject ) . setCorner1 ( corner1 ) ; ( ( DwgSolid ) dwgObject ) . setCorner2 ( corner2 ) ; ( ( DwgSolid ) dwgObject ) . setCorner3 ( corner3 ) ; ( ( DwgSolid ) dwgObject ) . setCorner4 ( corner4 ) ; } else if ( dwgObject instanceof DwgSpline ) { // DwgSpline hasn ' t Extrusion } else if ( dwgObject instanceof DwgText ) { Point2D tpoint = ( ( DwgText ) dwgObject ) . getInsertionPoint ( ) ; double elev = ( ( DwgText ) dwgObject ) . getElevation ( ) ; double [ ] textPoint = new double [ ] { tpoint . getX ( ) , tpoint . getY ( ) , elev } ; double [ ] textExt = ( ( DwgText ) dwgObject ) . getExtrusion ( ) ; textPoint = AcadExtrusionCalculator . CalculateAcadExtrusion ( textPoint , textExt ) ; ( ( DwgText ) dwgObject ) . setInsertionPoint ( new Point2D . Double ( textPoint [ 0 ] , textPoint [ 1 ] ) ) ; ( ( DwgText ) dwgObject ) . setElevation ( elev ) ; } else if ( dwgObject instanceof DwgPolyline2D && ( ( DwgPolyline2D ) dwgObject ) . getPts ( ) != null ) { Point2D [ ] vertices = ( ( DwgPolyline2D ) dwgObject ) . getPts ( ) ; double [ ] polyline2DExt = ( ( DwgPolyline2D ) dwgObject ) . getExtrusion ( ) ; double elev = ( ( DwgPolyline2D ) dwgObject ) . getElevation ( ) ; double [ ] [ ] polylinePoints3D = new double [ vertices . length ] [ 3 ] ; for ( int j = 0 ; j < vertices . length ; j ++ ) { polylinePoints3D [ j ] [ 0 ] = vertices [ j ] . getX ( ) ; polylinePoints3D [ j ] [ 1 ] = vertices [ j ] . getY ( ) ; polylinePoints3D [ j ] [ 2 ] = elev ; polylinePoints3D [ j ] = AcadExtrusionCalculator . CalculateAcadExtrusion ( polylinePoints3D [ j ] , polyline2DExt ) ; } ( ( DwgPolyline2D ) dwgObject ) . setElevation ( elev ) ; for ( int j = 0 ; j < vertices . length ; j ++ ) { vertices [ j ] = new Point2D . Double ( polylinePoints3D [ j ] [ 0 ] , polylinePoints3D [ j ] [ 1 ] ) ; } ( ( DwgPolyline2D ) dwgObject ) . setPts ( vertices ) ; } else if ( dwgObject instanceof DwgPolyline3D ) { // DwgPolyline3D hasn ' t Extrusion } else if ( dwgObject instanceof DwgVertex2D ) { // DwgVertex2D hasn ' t Extrusion } else if ( dwgObject instanceof DwgVertex3D ) { // DwgVertex3D hasn ' t Extrusion } else { } }
public class DynamicVirtualHost { /** * BEGIN : NEVER INVOKED BY WEBSPHERE APPLICATION SERVER ( Common Component Specific ) */ @ SuppressWarnings ( "unchecked" ) @ Override public void addWebApplication ( DeployedModule deployedModule , List extensionFactories ) throws WebAppNotLoadedException { } }
com . ibm . ws . webcontainer . osgi . container . DeployedModule deployedModuleImpl = ( com . ibm . ws . webcontainer . osgi . container . DeployedModule ) deployedModule ; String ct = deployedModuleImpl . getProperContextRoot ( ) ; String contextRoot = deployedModuleImpl . getMappingContextRoot ( ) ; String displayName = deployedModule . getDisplayName ( ) ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "addWebApplication" , "enter [" + displayName + "]" ) ; } WebGroup webGroup = ( WebGroup ) requestMapper . map ( contextRoot ) ; if ( webGroup != null && ct . equalsIgnoreCase ( webGroup . getConfiguration ( ) . getContextRoot ( ) ) ) { // begin 296368 Nested exceptions lost for problems during // application startup WAS . webcontainer List list = webGroup . getWebApps ( ) ; String originalName = "" ; if ( list != null && ( list . size ( ) > 0 ) ) { WebApp originalWebApp = ( WebApp ) list . get ( 0 ) ; originalName = originalWebApp . getWebAppName ( ) ; } logger . logp ( Level . SEVERE , CLASS_NAME , "addWebApplication" , "context.root.already.in.use" , new Object [ ] { displayName , contextRoot , originalName , displayName } ) ; throw new WebAppNotLoadedException ( "Context root " + contextRoot + " is already bound. Cannot start application " + displayName ) ; // end 296368 Nested exceptions lost for problems during application // startup WAS . webcontainer } // The following is used by / for Liberty : requred to create the webgroup & // webgroup configuration webGroup = new WebGroup ( contextRoot , this ) ; WebGroupConfiguration wgConfig = new WebGroupConfiguration ( deployedModule . getName ( ) ) ; wgConfig . setContextRoot ( deployedModule . getContextRoot ( ) ) ; wgConfig . setVersionID ( deployedModule . getWebAppConfig ( ) . getVersion ( ) ) ; // begin LIDB2356.1 : WebContainer work for incorporating SIP // Liberty : if this is one of the " new " WebAppConfiguration objects , // add this as the virtual host for better delegation ( and less object copying ) com . ibm . ws . webcontainer . webapp . WebAppConfiguration baseAppConfig = deployedModule . getWebAppConfig ( ) ; try { ( ( com . ibm . ws . webcontainer . osgi . webapp . WebAppConfiguration ) baseAppConfig ) . setVirtualHost ( this ) ; } catch ( ClassCastException cce ) { baseAppConfig . setVirtualHostName ( getName ( ) ) ; } wgConfig . setWebAppHost ( this ) ; // end LIDB2356.1 : WebContainer work for incorporating SIP webGroup . initialize ( wgConfig ) ; try { webGroup . addWebApplication ( deployedModule , extensionFactories ) ; Object [ ] args = { displayName , vHostConfig . toString ( ) } ; logger . logp ( Level . INFO , CLASS_NAME , "addWebApplication" , "module.[{0}].successfully.bound.to.virtualhost.[{1}]" , args ) ; } catch ( Throwable t ) { // PI58875 if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "addWebApplication" , "error adding web app [" + displayName + "]" ) ; } webGroup . destroy ( ) ; // preventing the classLoader memory leak webGroup = null ; // PI58875 end // requestMapper . removeMapping ( contextRoot ) ; // Do not need to remove mapping because we wait until we ' re sure we should add it ! // PK67698 removeMapping ( contextRoot ) ; // 296368 added rootCause to newly created exception . throw new WebAppNotLoadedException ( t . getMessage ( ) , t ) ; } // PK67698 Start try { addMapping ( contextRoot , webGroup ) ; webGroup . notifyStart ( ) ; } catch ( Exception exc ) { // begin 296368 Nested exceptions lost for problems during // application startup WAS . webcontainer if ( TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "addWebApplication" , "error adding mapping " , exc ) ; /* @283348.1 */ } webGroup . destroy ( ) ; throw new WebAppNotLoadedException ( "Context root " + contextRoot + " mapping unable to be bound. Application " + displayName + " unavailable." , exc ) ; // end 296368 Nested exceptions lost for problems during application // startup WAS . webcontainer } // PK67698 End
public class CmsTypesTab { /** * Updates the types list . < p > * @ param types the new types list * @ param selectedTypes the list of types to select */ public void updateContent ( List < CmsResourceTypeBean > types , List < String > selectedTypes ) { } }
clearList ( ) ; fillContent ( types , selectedTypes ) ;
public class ByteBufQueue { /** * Returns the first byte from this queue without any recycling . * @ see # getByte ( ) . */ @ Contract ( pure = true ) public byte peekByte ( ) { } }
assert hasRemaining ( ) ; ByteBuf buf = bufs [ first ] ; return buf . peek ( ) ;
public class MethodSignatureKeyServiceLocator { /** * 注入服务 * @ param exporter * 服务的实例或者封装类 * @ return 是否注册成功 * @ see com . baidu . beidou . navi . server . locator . ServiceLocator # regiserService ( java . lang . Object ) */ @ Override public boolean regiserService ( NaviRpcExporter exporter ) { } }
Class < ? > interf = exporter . getServiceInterface ( ) ; Object bean = exporter . getServiceBean ( ) ; List < AppIdToken > appIdTokens = getAuthIfPossible ( bean ) ; String interfSimpleName = interf . getSimpleName ( ) ; try { exporters . put ( exporter . getName ( ) , exporter ) ; if ( interf . isAssignableFrom ( bean . getClass ( ) ) ) { Method [ ] ms = ReflectionUtil . getAllInstanceMethods ( bean . getClass ( ) ) ; for ( Method m : ms ) { if ( methodResolver . isSupport ( m ) ) { MethodWrapper methodWrapper = new MethodWrapper ( interf . getName ( ) , m . getName ( ) , MethodUtil . getArgsTypeName ( m ) ) ; MethodWrapper defaultMethodWrapper = new MethodWrapper ( interf . getName ( ) , m . getName ( ) , StringUtil . EMPTY ) ; String key = methodWrapper . toString ( ) ; MethodDescriptor < String > desc = new MethodDescriptor < String > ( ) ; desc . setServiceId ( key ) . setMethod ( m ) . setTarget ( bean ) . setArgumentClass ( m . getParameterTypes ( ) ) . setReturnClass ( m . getReturnType ( ) ) . setInterfClass ( interf ) . setAppIdTokens ( appIdTokens ) ; serviceRegistry . addServiceDescriptor ( key , desc ) ; serviceRegistry . addServiceDescriptor ( defaultMethodWrapper . toString ( ) , desc ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( String . format ( "Register service key=[%s], %s %s#%s(%s) successfully" , key , m . getReturnType ( ) . getSimpleName ( ) , interf . getName ( ) , m . getName ( ) , StringUtil . toString4Array ( m . getParameterTypes ( ) ) ) ) ; } } } LOG . info ( "Find rpc service configured, interface is " + interfSimpleName + " , implementation is " + AopUtils . getTargetClass ( bean ) . getName ( ) ) ; return true ; } else { LOG . error ( "The interface " + interfSimpleName + " is not compatible with the bean " + bean . getClass ( ) . getName ( ) ) ; } } catch ( Exception e ) { LOG . error ( "The interface " + interfSimpleName + " is configured wrongly." + e . getMessage ( ) , e ) ; } return false ;
public class AbstractReady { /** * { @ inheritDoc } */ @ Override public final < M extends Model > M getModel ( final UniqueKey < M > modelKey ) { } }
localFacade ( ) . globalFacade ( ) . trackEvent ( JRebirthEventType . ACCESS_MODEL , this . getClass ( ) , modelKey . classField ( ) ) ; return localFacade ( ) . globalFacade ( ) . uiFacade ( ) . retrieve ( modelKey ) ;