signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class AsyncStorageInt { /** * Display list */ public void loadForward ( String query , Long afterSortKey , int limit , ListEngineDisplayLoadCallback < T > callback ) { } }
storageActor . send ( new AsyncStorageActor . LoadForward < T > ( query , afterSortKey , limit , callback ) ) ;
public class IntentUtils { /** * Send SMS message using built - in app * @ param context Application context * @ param to Receiver phone number * @ param message Text to send */ public static Intent sendSms ( Context context , String to , String message ) { } }
if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . KITKAT ) { String defaultSmsPackageName = Telephony . Sms . getDefaultSmsPackage ( context ) ; Intent intent = new Intent ( Intent . ACTION_SENDTO , Uri . parse ( "smsto:" + to ) ) ; intent . putExtra ( "sms_body" , message ) ; if ( defaultSmsPackageName != null ) { intent . setPackage ( defaultSmsPackageName ) ; } return intent ; } else { Uri smsUri = Uri . parse ( "tel:" + to ) ; Intent intent = new Intent ( Intent . ACTION_VIEW , smsUri ) ; intent . putExtra ( "address" , to ) ; intent . putExtra ( "sms_body" , message ) ; intent . setType ( "vnd.android-dir/mms-sms" ) ; return intent ; }
public class IncludeRelationshipLoader { /** * Loads all related resources for the given resources and relationship * field . It updates the relationship data of the source resources * accordingly and returns the loaded resources for potential inclusion in * the result resource . */ @ SuppressWarnings ( "unchecked" ) public Result < Set < Resource > > lookupRelatedResource ( IncludeRequest request , Collection < Resource > sourceResources , ResourceField relationshipField ) { } }
if ( sourceResources . isEmpty ( ) ) { return resultFactory . just ( Collections . emptySet ( ) ) ; } // directly load where relationship data is available Collection < Resource > sourceResourcesWithData = new ArrayList < > ( ) ; Collection < Resource > sourceResourcesWithoutData = new ArrayList < > ( ) ; for ( Resource sourceResource : sourceResources ) { boolean present = sourceResource . getRelationships ( ) . get ( relationshipField . getJsonName ( ) ) . getData ( ) . isPresent ( ) ; if ( present ) { sourceResourcesWithData . add ( sourceResource ) ; } else { sourceResourcesWithoutData . add ( sourceResource ) ; } } Set < Resource > relatedResources = new HashSet < > ( ) ; Result < Set < Resource > > result = resultFactory . just ( relatedResources ) ; if ( ! sourceResourcesWithData . isEmpty ( ) ) { Result < Set < Resource > > lookupWithId = lookupRelatedResourcesWithId ( request , sourceResourcesWithData , relationshipField ) ; result = result . zipWith ( lookupWithId , this :: mergeList ) ; } if ( ! sourceResourcesWithoutData . isEmpty ( ) ) { Result < Set < Resource > > lookupWithoutData = lookupRelatedResourceWithRelationship ( request , sourceResourcesWithoutData , relationshipField ) ; result = result . zipWith ( lookupWithoutData , this :: mergeList ) ; } return result ;
public class CountedCompleter { /** * H2O Hack to get distributed FJ behavior closer to the behavior on local node . * It allows us to continue in " completion propagation " interrupted by remote task . * Should * not * be called by anyone outside of RPC mechanism . * In standard FJ , tryComplete is always called by the task itself and the task is thus it ' s own caller . * Afterwards , the FJ framework will start propagating the completion up the task tree , walking up the list of completers ( parents ) * each time calling onCompletion of the parent with the current node ( the child which triggered the completion ) being passed as the " caller " argument . * When there is a distributed task in the chain , the sequence is broken as the task is completed on a remote node . * We want to be able to continue the completion chain , i . e . the remote task should now call onCompletion of its parent with itself passed as the caller argument . * We can not call tryComplete on the task , since it has already been called on the remote . * Instead , we explicitly set the caller argument in this overloaded tryComplete calls * Example : * new RPC ( node , task ) . addCompletor ( f ( x ) { . . . } ) * When we receive the reponse , we want to pass task as x to f . * We call f . _ _ tryComplete ( task ) * @ param caller - The child task completing this */ public final void __tryComplete ( CountedCompleter caller ) { } }
CountedCompleter a = this , s = caller ; for ( int c ; ; ) { if ( ( c = a . pending ) == 0 ) { a . onCompletion ( s ) ; if ( ( a = ( s = a ) . completer ) == null ) { s . quietlyComplete ( ) ; return ; } } else if ( U . compareAndSwapInt ( a , PENDING , c , c - 1 ) ) return ; }
public class TcpListener { /** * Close the listening socket . */ private void close ( ) { } }
assert ( fd != null ) ; try { fd . close ( ) ; socket . eventClosed ( endpoint , fd ) ; } catch ( IOException e ) { socket . eventCloseFailed ( endpoint , ZError . exccode ( e ) ) ; } fd = null ;
public class Partitions { /** * Update the partition cache . Updates are necessary after the partition details have changed . */ public void updateCache ( ) { } }
synchronized ( partitions ) { if ( partitions . isEmpty ( ) ) { this . slotCache = EMPTY ; this . nodeReadView = Collections . emptyList ( ) ; return ; } RedisClusterNode [ ] slotCache = new RedisClusterNode [ SlotHash . SLOT_COUNT ] ; List < RedisClusterNode > readView = new ArrayList < > ( partitions . size ( ) ) ; for ( RedisClusterNode partition : partitions ) { readView . add ( partition ) ; for ( Integer integer : partition . getSlots ( ) ) { slotCache [ integer . intValue ( ) ] = partition ; } } this . slotCache = slotCache ; this . nodeReadView = Collections . unmodifiableCollection ( readView ) ; }
public class TorqueDBHandling { /** * Writes the torque schemata to files in the given directory and returns * a comma - separated list of the filenames . * @ param dir The directory to write the files to * @ return The list of filenames * @ throws IOException If an error occurred */ private String writeSchemata ( File dir ) throws IOException { } }
writeCompressedTexts ( dir , _torqueSchemata ) ; StringBuffer includes = new StringBuffer ( ) ; for ( Iterator it = _torqueSchemata . keySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { includes . append ( ( String ) it . next ( ) ) ; if ( it . hasNext ( ) ) { includes . append ( "," ) ; } } return includes . toString ( ) ;
public class FlattenUnionExecutorImpl { /** * Replace the child subtrees of the focus node */ @ Override public NodeCentricOptimizationResults < UnionNode > apply ( FlattenUnionProposal proposal , IntermediateQuery query , QueryTreeComponent treeComponent ) throws InvalidQueryOptimizationProposalException , EmptyQueryException { } }
UnionNode focusNode = proposal . getFocusNode ( ) ; IntermediateQuery snapShot = query . createSnapshot ( ) ; query . getChildren ( focusNode ) . stream ( ) . forEach ( n -> treeComponent . removeSubTree ( n ) ) ; ImmutableSet < QueryNode > subqueryRoots = proposal . getSubqueryRoots ( ) ; subqueryRoots . forEach ( n -> treeComponent . addChild ( focusNode , n , Optional . empty ( ) , false ) ) ; subqueryRoots . forEach ( n -> treeComponent . addSubTree ( snapShot , n , n ) ) ; return new NodeCentricOptimizationResultsImpl < > ( query , focusNode ) ;
public class RadialPickerLayout { /** * Set either seconds , minutes or hours as showing . * @ param animate True to animate the transition , false to show with no animation . */ public void setCurrentItemShowing ( int index , boolean animate ) { } }
if ( index != HOUR_INDEX && index != MINUTE_INDEX && index != SECOND_INDEX ) { Log . e ( TAG , "TimePicker does not support view at index " + index ) ; return ; } int lastIndex = getCurrentItemShowing ( ) ; mCurrentItemShowing = index ; reselectSelector ( getTime ( ) , true , index ) ; if ( animate && ( index != lastIndex ) ) { ObjectAnimator [ ] anims = new ObjectAnimator [ 4 ] ; if ( index == MINUTE_INDEX && lastIndex == HOUR_INDEX ) { anims [ 0 ] = mHourRadialTextsView . getDisappearAnimator ( ) ; anims [ 1 ] = mHourRadialSelectorView . getDisappearAnimator ( ) ; anims [ 2 ] = mMinuteRadialTextsView . getReappearAnimator ( ) ; anims [ 3 ] = mMinuteRadialSelectorView . getReappearAnimator ( ) ; } else if ( index == HOUR_INDEX && lastIndex == MINUTE_INDEX ) { anims [ 0 ] = mHourRadialTextsView . getReappearAnimator ( ) ; anims [ 1 ] = mHourRadialSelectorView . getReappearAnimator ( ) ; anims [ 2 ] = mMinuteRadialTextsView . getDisappearAnimator ( ) ; anims [ 3 ] = mMinuteRadialSelectorView . getDisappearAnimator ( ) ; } else if ( index == MINUTE_INDEX && lastIndex == SECOND_INDEX ) { anims [ 0 ] = mSecondRadialTextsView . getDisappearAnimator ( ) ; anims [ 1 ] = mSecondRadialSelectorView . getDisappearAnimator ( ) ; anims [ 2 ] = mMinuteRadialTextsView . getReappearAnimator ( ) ; anims [ 3 ] = mMinuteRadialSelectorView . getReappearAnimator ( ) ; } else if ( index == HOUR_INDEX && lastIndex == SECOND_INDEX ) { anims [ 0 ] = mSecondRadialTextsView . getDisappearAnimator ( ) ; anims [ 1 ] = mSecondRadialSelectorView . getDisappearAnimator ( ) ; anims [ 2 ] = mHourRadialTextsView . getReappearAnimator ( ) ; anims [ 3 ] = mHourRadialSelectorView . getReappearAnimator ( ) ; } else if ( index == SECOND_INDEX && lastIndex == MINUTE_INDEX ) { anims [ 0 ] = mSecondRadialTextsView . getReappearAnimator ( ) ; anims [ 1 ] = mSecondRadialSelectorView . getReappearAnimator ( ) ; anims [ 2 ] = mMinuteRadialTextsView . getDisappearAnimator ( ) ; anims [ 3 ] = mMinuteRadialSelectorView . getDisappearAnimator ( ) ; } else if ( index == SECOND_INDEX && lastIndex == HOUR_INDEX ) { anims [ 0 ] = mSecondRadialTextsView . getReappearAnimator ( ) ; anims [ 1 ] = mSecondRadialSelectorView . getReappearAnimator ( ) ; anims [ 2 ] = mHourRadialTextsView . getDisappearAnimator ( ) ; anims [ 3 ] = mHourRadialSelectorView . getDisappearAnimator ( ) ; } if ( anims [ 0 ] != null && anims [ 1 ] != null && anims [ 2 ] != null && anims [ 3 ] != null ) { if ( mTransition != null && mTransition . isRunning ( ) ) { mTransition . end ( ) ; } mTransition = new AnimatorSet ( ) ; mTransition . playTogether ( anims ) ; mTransition . start ( ) ; } else { transitionWithoutAnimation ( index ) ; } } else { transitionWithoutAnimation ( index ) ; }
public class RetryInfo { /** * < pre > * Clients should wait at least this long between retrying the same request . * < / pre > * < code > . google . protobuf . Duration retry _ delay = 1 ; < / code > */ public com . google . protobuf . Duration getRetryDelay ( ) { } }
return retryDelay_ == null ? com . google . protobuf . Duration . getDefaultInstance ( ) : retryDelay_ ;
public class IOUtil { /** * 读取一行数据 , 比如System . in的用户输入 */ public static String readLine ( final InputStream input ) throws IOException { } }
return new BufferedReader ( new InputStreamReader ( input , Charsets . UTF_8 ) ) . readLine ( ) ;
public class Divider { /** * Creates and returns a listener , which allows to observe the progress of an animation , which * is used to show or hide the divider . * @ param show * True , if the divider is shown by the animation , false otherwise * @ return The listener , which has been created , as an instance of the type { @ link * AnimatorListener } . The listener may not be null */ @ NonNull private AnimatorListener createVisibilityAnimationListener ( final boolean show ) { } }
return new AnimatorListenerAdapter ( ) { @ Override public void onAnimationStart ( final Animator animation ) { super . onAnimationStart ( animation ) ; if ( show ) { Divider . super . setVisibility ( View . VISIBLE ) ; } } @ Override public void onAnimationEnd ( final Animator animation ) { super . onAnimationEnd ( animation ) ; if ( ! show ) { Divider . super . setVisibility ( View . INVISIBLE ) ; } } } ;
public class INodeFileUnderConstruction { /** * Remove this INodeFileUnderConstruction from the list of datanodes . */ private void removeINodeFromDatanodeDescriptors ( DatanodeDescriptor [ ] targets ) { } }
if ( targets != null ) { for ( DatanodeDescriptor node : targets ) { node . removeINode ( this ) ; } }
public class ArrayDeque { /** * Inserts the specified element at the end of this deque . * < p > This method is equivalent to { @ link # add } . * @ param e the element to add * @ throws NullPointerException if the specified element is null */ public void addLast ( E e ) { } }
if ( e == null ) throw new NullPointerException ( ) ; elements [ tail ] = e ; if ( ( tail = ( tail + 1 ) & ( elements . length - 1 ) ) == head ) doubleCapacity ( ) ;
public class V1InstanceGetter { /** * Get assets filtered by the criteria specified in the passed in filter . * @ param filter Limit the items returned . If null , then all items returned . * @ return Collection of items as specified in the filter . */ public Collection < BaseAsset > baseAssets ( BaseAssetFilter filter ) { } }
return get ( BaseAsset . class , ( filter != null ) ? filter : new BaseAssetFilter ( ) ) ;
public class CorruptReplicasMap { /** * Remove the block at the given datanode from CorruptBlockMap * @ param blk block to be removed * @ param datanode datanode where the block is located * @ return true if the removal is successful ; * false if the replica is not in the map */ boolean removeFromCorruptReplicasMap ( Block blk , DatanodeDescriptor datanode ) { } }
Collection < DatanodeDescriptor > datanodes = corruptReplicasMap . get ( blk ) ; if ( datanodes == null ) return false ; if ( datanodes . remove ( datanode ) ) { // remove the replicas if ( datanodes . isEmpty ( ) ) { // remove the block if there is no more corrupted replicas corruptReplicasMap . remove ( blk ) ; } return true ; } return false ;
public class PortalApplicationContextLocator { /** * If the ApplicationContext returned by { @ link # getApplicationContext ( ) } is ' portal managed ' * the shutdown hook for the context is called , closing and cleaning up all spring managed * resources . * < p > If the ApplicationContext returned by { @ link # getApplicationContext ( ) } is actually a * WebApplicationContext this method does nothing but log an error message . */ public static void shutdown ( ) { } }
if ( applicationContextCreator . isCreated ( ) ) { final ConfigurableApplicationContext applicationContext = applicationContextCreator . get ( ) ; applicationContext . close ( ) ; } else { final IllegalStateException createException = new IllegalStateException ( "No portal managed ApplicationContext has been created, there is nothing to shutdown." ) ; getLogger ( ) . error ( createException , createException ) ; }
public class XElementBase { /** * Converts all sensitive characters to its HTML entity equivalent . * @ param s the string to convert , can be null * @ return the converted string , or an empty string */ public static String sanitize ( String s ) { } }
if ( s != null ) { StringBuilder b = new StringBuilder ( s . length ( ) ) ; for ( int i = 0 , count = s . length ( ) ; i < count ; i ++ ) { char c = s . charAt ( i ) ; switch ( c ) { case '<' : b . append ( "&lt;" ) ; break ; case '>' : b . append ( "&gt;" ) ; break ; case '\'' : b . append ( "&#39;" ) ; break ; case '"' : b . append ( "&quot;" ) ; break ; case '&' : b . append ( "&amp;" ) ; break ; default : b . append ( c ) ; } } return b . toString ( ) ; } return "" ;
public class FreemarkerCall { /** * Render the template as the entity for a ResponseBuilder , returning the built Response * @ return the result of calling responseBuilder . */ @ Override public Response process ( Response . ResponseBuilder responseBuilder ) { } }
final String entity = process ( ) ; responseBuilder . entity ( entity ) ; return responseBuilder . build ( ) ;
public class Datatype_Builder { /** * Sets the value to be returned by { @ link Datatype # getBuilderFactory ( ) } . * @ return this { @ code Builder } object */ public Datatype . Builder setNullableBuilderFactory ( BuilderFactory builderFactory ) { } }
if ( builderFactory != null ) { return setBuilderFactory ( builderFactory ) ; } else { return clearBuilderFactory ( ) ; }
public class Document { /** * Gets annotations of the given type that overlap with the given span and meet the given filter . * @ param type the type of annotation * @ param span the span to search for overlapping annotations * @ param filter the filter to use on the annotations * @ return All annotations of the given type on the document that overlap with the give span and meet the given * filter . */ public List < Annotation > get ( @ NonNull AnnotationType type , @ NonNull Span span , @ NonNull Predicate < ? super Annotation > filter ) { } }
return annotationSet . select ( span , a -> filter . test ( a ) && a . isInstance ( type ) && a . overlaps ( span ) ) ;
public class ApiApp { /** * Internal method used to retrieve the necessary POST fields to submit the * API app to HelloSign . * @ return Map * @ throws HelloSignException thrown if there is a problem serializing the * POST fields . */ public Map < String , Serializable > getPostFields ( ) throws HelloSignException { } }
Map < String , Serializable > fields = new HashMap < String , Serializable > ( ) ; try { if ( hasName ( ) ) { fields . put ( APIAPP_NAME , getName ( ) ) ; } if ( hasDomain ( ) ) { fields . put ( APIAPP_DOMAIN , getDomain ( ) ) ; } if ( hasCallbackUrl ( ) ) { fields . put ( APIAPP_CALLBACK_URL , getCallbackUrl ( ) ) ; } if ( custom_logo != null && custom_logo . exists ( ) ) { fields . put ( APIAPP_CUSTOM_LOGO , custom_logo ) ; } ApiAppOauth oauth = getOauthInfo ( ) ; if ( oauth != null ) { if ( oauth . hasCallbackUrl ( ) ) { fields . put ( "oauth[callback_url]" , oauth . getCallbackUrl ( ) ) ; } Set < ApiAppOauthScopeType > scopes = oauth . getScopes ( ) ; if ( scopes . size ( ) > 0 ) { String scopeStr = "" ; for ( ApiAppOauthScopeType type : scopes ) { scopeStr += type . toString ( ) + "," ; } scopeStr = scopeStr . substring ( 0 , scopeStr . length ( ) - 1 ) ; fields . put ( "oauth[scopes]" , scopeStr ) ; } } if ( white_labeling_options != null ) { fields . put ( WhiteLabelingOptions . WHITE_LABELING_OPTIONS_KEY , white_labeling_options . toString ( 0 ) ) ; } } catch ( Exception e ) { throw new HelloSignException ( e ) ; } return fields ;
public class InterceptedCommand { /** * Executes the next command in the execution chain using the given Parameters * parameters ( arguments ) . * @ param correlationId unique transaction id to trace calls across components . * @ param args the parameters ( arguments ) to pass to the command for * execution . * @ return execution result . * @ throws ApplicationException when execution fails for whatever reason . * @ see Parameters */ public Object execute ( String correlationId , Parameters args ) throws ApplicationException { } }
return _interceptor . execute ( correlationId , _next , args ) ;
public class L1Regularizer { /** * Updates the weights by applying the L1 regularization . * @ param l1 * @ param learningRate * @ param weights * @ param newWeights * @ param < K > */ public static < K > void updateWeights ( double l1 , double learningRate , Map < K , Double > weights , Map < K , Double > newWeights ) { } }
if ( l1 > 0.0 ) { /* / / SGD - L1 ( Naive ) for ( Map . Entry < K , Double > e : weights . entrySet ( ) ) { K column = e . getKey ( ) ; newWeights . put ( column , newWeights . get ( column ) + l1 * Math . signum ( e . getValue ( ) ) * ( - learningRate ) ) ; */ // SGDL1 ( Clipping ) for ( Map . Entry < K , Double > e : newWeights . entrySet ( ) ) { K column = e . getKey ( ) ; double wi_k_intermediate = e . getValue ( ) ; // the weight wi _ k + 1/2 as seen on the paper if ( wi_k_intermediate > 0.0 ) { newWeights . put ( column , Math . max ( 0.0 , wi_k_intermediate - l1 * wi_k_intermediate ) ) ; } else if ( wi_k_intermediate < 0.0 ) { newWeights . put ( column , Math . min ( 0.0 , wi_k_intermediate + l1 * wi_k_intermediate ) ) ; } } }
public class WebDriverTool { /** * Delegates to { @ link # findElement ( By ) } and then moves the mouse to the returned element * using the { @ link Actions } class . * @ param by * the { @ link By } used to locate the element */ public void hover ( final By by ) { } }
checkTopmostElement ( by ) ; WebElement element = findElement ( by ) ; new Actions ( webDriver ) . moveToElement ( element ) . perform ( ) ;
public class BELScriptParser { /** * BELScript . g : 143:1 : argument : ( param | term ) ; */ public final BELScriptParser . argument_return argument ( ) throws RecognitionException { } }
BELScriptParser . argument_return retval = new BELScriptParser . argument_return ( ) ; retval . start = input . LT ( 1 ) ; Object root_0 = null ; BELScriptParser . param_return param62 = null ; BELScriptParser . term_return term63 = null ; try { // BELScript . g : 143:9 : ( param | term ) int alt13 = 2 ; int LA13_0 = input . LA ( 1 ) ; if ( ( LA13_0 == OBJECT_IDENT || LA13_0 == QUOTED_VALUE || LA13_0 == NS_PREFIX ) ) { alt13 = 1 ; } else if ( ( ( LA13_0 >= 44 && LA13_0 <= 102 ) ) ) { alt13 = 2 ; } else { NoViableAltException nvae = new NoViableAltException ( "" , 13 , 0 , input ) ; throw nvae ; } switch ( alt13 ) { case 1 : // BELScript . g : 144:5 : param { root_0 = ( Object ) adaptor . nil ( ) ; pushFollow ( FOLLOW_param_in_argument755 ) ; param62 = param ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , param62 . getTree ( ) ) ; } break ; case 2 : // BELScript . g : 144:13 : term { root_0 = ( Object ) adaptor . nil ( ) ; pushFollow ( FOLLOW_term_in_argument759 ) ; term63 = term ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , term63 . getTree ( ) ) ; } break ; } retval . stop = input . LT ( - 1 ) ; 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 { } return retval ;
public class EbInterfaceWriter { /** * Create a writer builder for Ebi40InvoiceType . * @ return The builder and never < code > null < / code > */ @ Nonnull public static EbInterfaceWriter < Ebi40InvoiceType > ebInterface40 ( ) { } }
final EbInterfaceWriter < Ebi40InvoiceType > ret = EbInterfaceWriter . create ( Ebi40InvoiceType . class ) ; ret . setNamespaceContext ( EbInterface40NamespaceContext . getInstance ( ) ) ; return ret ;
public class NetworkWatchersInner { /** * Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server . * @ param resourceGroupName The name of the network watcher resource group . * @ param networkWatcherName The name of the network watcher resource . * @ param parameters Parameters that determine how the connectivity check will be performed . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < ConnectivityInformationInner > checkConnectivityAsync ( String resourceGroupName , String networkWatcherName , ConnectivityParameters parameters , final ServiceCallback < ConnectivityInformationInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( checkConnectivityWithServiceResponseAsync ( resourceGroupName , networkWatcherName , parameters ) , serviceCallback ) ;
public class Optimizer { /** * Remove duplicate branches in an OR clause . For example : { @ code " a | b | a " = > " a | b " } . */ static Matcher dedupOr ( Matcher matcher ) { } }
if ( matcher instanceof OrMatcher ) { List < Matcher > ms = new ArrayList < > ( new LinkedHashSet < > ( matcher . < OrMatcher > as ( ) . matchers ( ) ) ) ; return OrMatcher . create ( ms ) ; } return matcher ;
public class DataFrameJoiner { /** * Full outer join the joiner to the table2 , using the given column for the second table and returns the resulting table * @ param table2 The table to join with * @ param col2Name The column to join on . If col2Name refers to a double column , the join is performed after * rounding to integers . * @ return The resulting table */ public Table fullOuter ( Table table2 , String col2Name ) { } }
return fullOuter ( table , table2 , false , col2Name ) ;
public class SingleWordCorrection { /** * alteration ( change one letter to another ) or an insertion ( add a letter ) . */ private Map < String , Double > distance1Generation ( String word ) { } }
if ( word == null || word . length ( ) < 1 ) throw new RuntimeException ( "Input words Error: " + word ) ; Map < String , Double > result = new HashMap < String , Double > ( ) ; String prev ; String last ; for ( int i = 0 ; i < word . length ( ) ; i ++ ) { // Deletion prev = word . substring ( 0 , i ) ; last = word . substring ( i + 1 , word . length ( ) ) ; result . put ( prev + last , 1.0 ) ; // transposition if ( ( i + 1 ) < word . length ( ) ) { prev = word . substring ( 0 , i ) ; last = word . substring ( i + 2 , word . length ( ) ) ; String trans = prev + word . charAt ( i + 1 ) + word . charAt ( i ) + last ; result . put ( trans , 1.0 ) ; } // alter prev = word . substring ( 0 , i ) ; last = word . substring ( i + 1 , word . length ( ) ) ; for ( int j = 0 ; j < 26 ; j ++ ) { result . put ( prev + ( char ) ( j + 97 ) + last , 1.0 ) ; } // insertion prev = word . substring ( 0 , i ) ; last = word . substring ( i + 1 , word . length ( ) ) ; for ( int j = 0 ; j < 26 ; j ++ ) { result . put ( prev + ( char ) ( j + 97 ) + word . charAt ( i ) + last , 1.0 ) ; result . put ( prev + word . charAt ( i ) + ( char ) ( j + 97 ) + last , 1.0 ) ; } } result . remove ( word ) ; return result ;
public class HelpToolbar { /** * Controls for a maint screen . */ public void setupMiddleSFields ( ) { } }
new SCannedBox ( this . getNextLocation ( ScreenConstants . RIGHT_OF_LAST_BUTTON_WITH_GAP , ScreenConstants . SET_ANCHOR ) , this , null , ScreenConstants . DEFAULT_DISPLAY , "Tech" ) ; new SCannedBox ( this . getNextLocation ( ScreenConstants . RIGHT_OF_LAST_BUTTON_WITH_GAP , ScreenConstants . SET_ANCHOR ) , this , null , ScreenConstants . DEFAULT_DISPLAY , "Run" ) ; new SCannedBox ( this . getNextLocation ( ScreenConstants . RIGHT_OF_LAST_BUTTON_WITH_GAP , ScreenConstants . SET_ANCHOR ) , this , null , ScreenConstants . DEFAULT_DISPLAY , "Bugs" ) ;
public class ViewQuery { /** * Specify the group level to be used . * Important : { @ link # group ( ) } and this setter should not be used * together in the same { @ link ViewQuery } . It is sufficient to only use this * setter and use { @ link # group ( ) } in cases where you always want * the highest group level implictly . * @ param grouplevel How deep the grouping level should be . * @ return the { @ link ViewQuery } object for proper chaining . */ public ViewQuery groupLevel ( final int grouplevel ) { } }
params [ PARAM_GROUPLEVEL_OFFSET ] = "group_level" ; params [ PARAM_GROUPLEVEL_OFFSET + 1 ] = Integer . toString ( grouplevel ) ; return this ;
public class LogUtil { /** * public static void log ( Log log , int level , String logName , Throwable t ) { * log ( log , level , logName , " " , t ) ; } * public static void log ( Log log , int level , String logName , String msg , Throwable t ) { if ( log * instanceof LogAdapter ) { log . log ( level , logName , msg , t ) ; } else { String em = * ExceptionUtil . getMessage ( t ) ; String est = ExceptionUtil . getStacktrace ( t , false ) ; * if ( msg . equals ( em ) ) msg = em + " ; " + est ; else msg + = " ; " + em + " ; " + est ; * if ( log ! = null ) { log . log ( level , logName , msg ) ; } else { PrintStream * ps = ( level > = Log . LEVEL _ WARN ) ? System . err : System . out ; ps . println ( logName + " ; " + msg ) ; } * public static void log ( Log log , int level , String logName , String msg , StackTraceElement [ ] * stackTrace ) { Throwable t = new Throwable ( ) ; t . setStackTrace ( stackTrace ) ; * log ( log , level , logName , msg , t ) ; } * public static Log getLog ( PageContext pc , String name ) { return * ( ( PageContextImpl ) pc ) . getLog ( name ) ; } * public static Log getLog ( PageContext pc , String name , boolean createIfNecessary ) { return * ( ( PageContextImpl ) pc ) . getLog ( name , createIfNecessary ) ; } */ public static int toLevel ( String strLevel , int defaultValue ) { } }
if ( strLevel == null ) return defaultValue ; strLevel = strLevel . toLowerCase ( ) . trim ( ) ; if ( strLevel . startsWith ( "info" ) ) return Log . LEVEL_INFO ; if ( strLevel . startsWith ( "debug" ) ) return Log . LEVEL_DEBUG ; if ( strLevel . startsWith ( "warn" ) ) return Log . LEVEL_WARN ; if ( strLevel . startsWith ( "error" ) ) return Log . LEVEL_ERROR ; if ( strLevel . startsWith ( "fatal" ) ) return Log . LEVEL_FATAL ; if ( strLevel . startsWith ( "trace" ) ) return Log . LEVEL_TRACE ; return defaultValue ;
public class IpPermission { /** * [ VPC only ] The prefix list IDs for an AWS service . With outbound rules , this is the AWS service to access through * a VPC endpoint from instances associated with the security group . * @ return [ VPC only ] The prefix list IDs for an AWS service . With outbound rules , this is the AWS service to access * through a VPC endpoint from instances associated with the security group . */ public java . util . List < PrefixListId > getPrefixListIds ( ) { } }
if ( prefixListIds == null ) { prefixListIds = new com . amazonaws . internal . SdkInternalList < PrefixListId > ( ) ; } return prefixListIds ;
public class TextAnalyticsImpl { /** * The API returns a list of recognized entities in a given document . * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names . See the & lt ; a href = " https : / / docs . microsoft . com / en - us / azure / cognitive - services / text - analytics / text - analytics - supported - languages " & gt ; Supported languages in Text Analytics API & lt ; / a & gt ; for the list of enabled languages . * @ param entitiesOptionalParameter the object representing the optional parameters to be set before calling this API * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the EntitiesBatchResult object */ public Observable < ServiceResponse < EntitiesBatchResult > > entitiesWithServiceResponseAsync ( EntitiesOptionalParameter entitiesOptionalParameter ) { } }
if ( this . client . azureRegion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.azureRegion() is required and cannot be null." ) ; } final List < MultiLanguageInput > documents = entitiesOptionalParameter != null ? entitiesOptionalParameter . documents ( ) : null ; return entitiesWithServiceResponseAsync ( documents ) ;
public class JaxRsClientFactory { /** * Register a list of features to all clients marked with the given group . */ public synchronized JaxRsClientFactory addFeatureToGroup ( JaxRsFeatureGroup group , Feature ... features ) { } }
Preconditions . checkState ( ! started , "Already started building clients" ) ; featureMap . putAll ( group , Arrays . asList ( features ) ) ; LOG . trace ( "Group {} registers features {}" , group , features ) ; return this ;
public class FuncStringLength { /** * { @ inheritDoc } */ @ Override public void resolve ( final ValueStack values ) throws Exception { } }
if ( values . size ( ) < getParameterCount ( ) ) throw new Exception ( "missing operands for " + toString ( ) ) ; try { final Object target = values . popStringOrByteArray ( ) ; if ( target instanceof String ) values . push ( new Double ( ( ( String ) target ) . length ( ) ) ) ; else values . push ( new Double ( ( ( byte [ ] ) target ) . length ) ) ; } catch ( final ParseException e ) { e . fillInStackTrace ( ) ; throw new Exception ( toString ( ) + "; " + e . getMessage ( ) , e ) ; }
public class ScriptClassProvider { /** * 查找可实例化的脚本 * @ param scriptClazzs * @ return * @ throws InstantiationException * @ throws IllegalAccessException */ private Map < Integer , Class < ? extends T > > findInstanceAbleScript ( Set < Class < ? extends T > > scriptClazzs ) throws InstantiationException , IllegalAccessException { } }
Map < Integer , Class < ? extends T > > codeMap = new ConcurrentHashMap < Integer , Class < ? extends T > > ( ) ; for ( Class < ? extends T > scriptClazz : scriptClazzs ) { T script = getInstacne ( scriptClazz ) ; if ( script == null ) { continue ; } if ( skipRegistScript ( script ) ) { _log . warn ( "skil regist script,code=" + script . getMessageCode ( ) + ",class=" + script . getClass ( ) ) ; continue ; } int code = script . getMessageCode ( ) ; if ( codeMap . containsKey ( script . getMessageCode ( ) ) ) { // 重复脚本code定义 _log . error ( "find Repeat ScriptClass,code=" + code + ",addingScript:" + script . getClass ( ) + ",existScript:" + codeMap . get ( code ) ) ; } else { codeMap . put ( code , scriptClazz ) ; _log . info ( "regist ScriptClass:code=" + code + ",class=" + scriptClazz ) ; } } return codeMap ;
public class aaaparameter { /** * Use this API to update aaaparameter . */ public static base_response update ( nitro_service client , aaaparameter resource ) throws Exception { } }
aaaparameter updateresource = new aaaparameter ( ) ; updateresource . enablestaticpagecaching = resource . enablestaticpagecaching ; updateresource . enableenhancedauthfeedback = resource . enableenhancedauthfeedback ; updateresource . defaultauthtype = resource . defaultauthtype ; updateresource . maxaaausers = resource . maxaaausers ; updateresource . maxloginattempts = resource . maxloginattempts ; updateresource . failedlogintimeout = resource . failedlogintimeout ; updateresource . aaadnatip = resource . aaadnatip ; return updateresource . update_resource ( client ) ;
public class AbstractChannel { /** * Build the soap : Envelope and soap : Body things and return the { @ link Element } * for the soap : Body . */ private Element addSoapEnvelopeBody ( Document doc ) { } }
Element env = doc . createElementNS ( IfmapStrings . SOAP_ENV_NS_URI , IfmapStrings . SOAP_PREFIXED_ENV_EL_NAME ) ; Element body = doc . createElementNS ( IfmapStrings . SOAP_ENV_NS_URI , IfmapStrings . SOAP_PREFIXED_BODY_EL_NAME ) ; doc . appendChild ( env ) ; env . appendChild ( body ) ; return body ;
public class UIComponentTag { /** * < p > Locate and return the nearest enclosing { @ link UIComponentTag } * if any ; otherwise , return < code > null < / code > . < / p > * @ param context < code > PageContext < / code > for the current page */ public static UIComponentTag getParentUIComponentTag ( PageContext context ) { } }
UIComponentClassicTagBase result = getParentUIComponentClassicTagBase ( context ) ; if ( ! ( result instanceof UIComponentTag ) ) { return new UIComponentTagAdapter ( result ) ; } return ( ( UIComponentTag ) result ) ;
public class CommerceTaxFixedRatePersistenceImpl { /** * Returns the first commerce tax fixed rate in the ordered set where commerceTaxMethodId = & # 63 ; . * @ param commerceTaxMethodId the commerce tax method ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the first matching commerce tax fixed rate * @ throws NoSuchTaxFixedRateException if a matching commerce tax fixed rate could not be found */ @ Override public CommerceTaxFixedRate findByCommerceTaxMethodId_First ( long commerceTaxMethodId , OrderByComparator < CommerceTaxFixedRate > orderByComparator ) throws NoSuchTaxFixedRateException { } }
CommerceTaxFixedRate commerceTaxFixedRate = fetchByCommerceTaxMethodId_First ( commerceTaxMethodId , orderByComparator ) ; if ( commerceTaxFixedRate != null ) { return commerceTaxFixedRate ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "commerceTaxMethodId=" ) ; msg . append ( commerceTaxMethodId ) ; msg . append ( "}" ) ; throw new NoSuchTaxFixedRateException ( msg . toString ( ) ) ;
public class EJSHome { /** * f111627 */ @ Override public EJBObject getBeanWrapper ( Object primaryKey ) throws FinderException , RemoteException { } }
BeanId id = new BeanId ( this , ( Serializable ) primaryKey , false ) ; return getWrapper ( id ) . getRemoteWrapper ( ) ; // f111627
public class SSSRFinder { /** * Finds the " interchangeability " equivalence classes . * The interchangeability relation is described in [ GLS00 ] . * @ return a List of RingSets containing the rings in an equivalence class */ public List findEquivalenceClasses ( ) { } }
if ( atomContainer == null ) { return null ; } List < IRingSet > equivalenceClasses = new ArrayList < IRingSet > ( ) ; for ( Object o : cycleBasis ( ) . equivalenceClasses ( ) ) { equivalenceClasses . add ( toRingSet ( atomContainer , ( Collection ) o ) ) ; } return equivalenceClasses ;
public class DagManager { /** * Method to submit a { @ link Dag } to the { @ link DagManager } . The { @ link DagManager } first persists the * submitted dag to the { @ link DagStateStore } and then adds the dag to a { @ link BlockingQueue } to be picked up * by one of the { @ link DagManagerThread } s . */ synchronized void offer ( Dag < JobExecutionPlan > dag ) throws IOException { } }
// Persist the dag this . dagStateStore . writeCheckpoint ( dag ) ; // Add it to the queue of dags if ( ! this . queue . offer ( dag ) ) { throw new IOException ( "Could not add dag" + DagManagerUtils . generateDagId ( dag ) + "to queue" ) ; }
public class Punctuation { /** * 判断文本中是否包含标点符号 * @ param text * @ return */ public static boolean has ( String text ) { } }
for ( char c : text . toCharArray ( ) ) { if ( is ( c ) ) { return true ; } } return false ;
public class Token { /** * setter for topicIds - sets topic model ids , separated by spaces * @ generated * @ param v value to set into the feature */ public void setTopicIds ( String v ) { } }
if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_topicIds == null ) jcasType . jcas . throwFeatMissing ( "topicIds" , "de.julielab.jules.types.Token" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_topicIds , v ) ;
public class DirectoryScanner { /** * Return the names of the directories which matched at least one of the * include patterns and at least one of the exclude patterns . * The names are relative to the base directory . This involves * performing a slow scan if one has not already been completed . * @ return the names of the directories which matched at least one of the * include patterns and at least one of the exclude patterns . * @ see # slowScan */ public synchronized String [ ] getExcludedDirectories ( ) { } }
slowScan ( ) ; String [ ] directories = new String [ dirsExcluded . size ( ) ] ; dirsExcluded . copyInto ( directories ) ; return directories ;
public class XmlResponsesSaxParser { /** * Disables certain dangerous features that attempt to automatically fetch DTDs * See < a href = " https : / / www . owasp . org / index . php / XML _ External _ Entity _ ( XXE ) _ Prevention _ Cheat _ Sheet # XMLReader " > OWASP XXE Cheat Sheet < / a > * @ param reader the reader to disable the features on * @ throws SAXNotRecognizedException * @ throws SAXNotSupportedException */ private void disableExternalResourceFetching ( XMLReader reader ) throws SAXNotRecognizedException , SAXNotSupportedException { } }
reader . setFeature ( "http://xml.org/sax/features/external-general-entities" , false ) ; reader . setFeature ( "http://xml.org/sax/features/external-parameter-entities" , false ) ; reader . setFeature ( "http://apache.org/xml/features/nonvalidating/load-external-dtd" , false ) ;
public class ChunkInputStream { /** * ( non - Javadoc ) * @ see java . io . InputStream # read ( ) */ public int read ( ) throws IOException { } }
if ( chunk == null || pos + 1 == chunk . length ) { if ( ! fetchChunk ( ) ) { return - 1 ; } } return chunk [ pos ++ ] & 0xff ;
public class ClassUtil { /** * 取得primitive类型的默认值 。 如果不是primitive , 则返回 < code > null < / code > 。 * 如果 < code > clazz < / code > 为 < code > null < / code > , 则返还 < code > null < / code > * 例如 : * < pre > * ClassUtil . getPrimitiveDefaultValue ( int . class ) = 0; * ClassUtil . getPrimitiveDefaultValue ( boolean . class ) = false ; * ClassUtil . getPrimitiveDefaultValue ( char . class ) = ' \ 0 ' ; * < / pre > */ public static < T > T getPrimitiveDefaultValue ( Class < T > type ) { } }
if ( type == null ) { return null ; } @ SuppressWarnings ( "unchecked" ) PrimitiveInfo < T > info = ( PrimitiveInfo < T > ) PRIMITIVES . get ( type . getName ( ) ) ; if ( info != null ) { return info . defaultValue ; } return null ;
public class EPFImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . EPF__PF_NAME : setPFName ( PF_NAME_EDEFAULT ) ; return ; case AfplibPackage . EPF__TRIPLETS : getTriplets ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ;
public class AddParameterEvent { /** * Add parameter to testCase * @ param context which can be changed */ @ Override public void process ( TestCaseResult context ) { } }
context . getParameters ( ) . add ( new Parameter ( ) . withName ( getName ( ) ) . withValue ( getValue ( ) ) . withKind ( ParameterKind . valueOf ( getKind ( ) ) ) ) ;
public class IconDrawerItem { /** * Called to create this view * @ param inflater the layout inflater to inflate a layout from system * @ param container the container the layout is going to be placed in * @ return */ @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , int highlightColor ) { } }
Context ctx = inflater . getContext ( ) ; View view = inflater . inflate ( R . layout . navdrawer_item , container , false ) ; ImageView iconView = ButterKnife . findById ( view , R . id . icon ) ; TextView titleView = ButterKnife . findById ( view , R . id . title ) ; TextView badgeView = ButterKnife . findById ( view , R . id . badge ) ; // Set the textResId FontLoader . apply ( titleView , Face . ROBOTO_MEDIUM ) ; titleView . setText ( textResId ) ; // Set the iconResId , if provided iconView . setVisibility ( iconResId > 0 ? View . VISIBLE : View . GONE ) ; if ( iconResId > 0 ) iconView . setImageResource ( iconResId ) ; // configure its appearance according to whether or not it ' s selected titleView . setTextColor ( selected ? highlightColor : UIUtils . getColorAttr ( ctx , android . R . attr . textColorPrimary ) ) ; iconView . setColorFilter ( selected ? highlightColor : ctx . getResources ( ) . getColor ( R . color . navdrawer_icon_tint ) ) ; // Setup the badge view if ( badge != null ) { Drawable badgeBackground = DrawableCompat . wrap ( ctx . getResources ( ) . getDrawable ( R . drawable . badge ) ) ; DrawableCompat . setTint ( badgeBackground , badge . getColor ( ) ) ; badgeView . setBackground ( badgeBackground ) ; badgeView . setTextColor ( badge . getTextColor ( ) ) ; badgeView . setText ( badge . getText ( ) ) ; badgeView . setVisibility ( View . VISIBLE ) ; } return view ;
public class FacesConfigFlowDefinitionFacesMethodCallTypeImpl { /** * Returns all < code > parameter < / code > elements * @ return list of < code > parameter < / code > */ public List < FacesConfigFlowDefinitionFlowCallParameterType < FacesConfigFlowDefinitionFacesMethodCallType < T > > > getAllParameter ( ) { } }
List < FacesConfigFlowDefinitionFlowCallParameterType < FacesConfigFlowDefinitionFacesMethodCallType < T > > > list = new ArrayList < FacesConfigFlowDefinitionFlowCallParameterType < FacesConfigFlowDefinitionFacesMethodCallType < T > > > ( ) ; List < Node > nodeList = childNode . get ( "parameter" ) ; for ( Node node : nodeList ) { FacesConfigFlowDefinitionFlowCallParameterType < FacesConfigFlowDefinitionFacesMethodCallType < T > > type = new FacesConfigFlowDefinitionFlowCallParameterTypeImpl < FacesConfigFlowDefinitionFacesMethodCallType < T > > ( this , "parameter" , childNode , node ) ; list . add ( type ) ; } return list ;
public class ClusterState { /** * Identifies this server to the leader . */ CompletableFuture < Void > identify ( ) { } }
Member leader = context . getLeader ( ) ; if ( joinFuture != null && leader != null ) { if ( context . getLeader ( ) . equals ( member ( ) ) ) { if ( context . getState ( ) == CopycatServer . State . LEADER && ! ( ( LeaderState ) context . getServerState ( ) ) . configuring ( ) ) { if ( joinFuture != null ) joinFuture . complete ( null ) ; } else { cancelJoinTimer ( ) ; joinTimeout = context . getThreadContext ( ) . schedule ( context . getElectionTimeout ( ) . multipliedBy ( 2 ) , this :: identify ) ; } } else { cancelJoinTimer ( ) ; joinTimeout = context . getThreadContext ( ) . schedule ( context . getElectionTimeout ( ) . multipliedBy ( 2 ) , this :: identify ) ; LOGGER . debug ( "{} - Sending server identification to {}" , member ( ) . address ( ) , leader . address ( ) ) ; context . getConnections ( ) . getConnection ( leader . serverAddress ( ) ) . thenCompose ( connection -> { ReconfigureRequest request = ReconfigureRequest . builder ( ) . withIndex ( configuration . index ( ) ) . withTerm ( configuration . term ( ) ) . withMember ( member ( ) ) . build ( ) ; LOGGER . trace ( "{} - Sending {} to {}" , member . address ( ) , request , leader . address ( ) ) ; return connection . < ConfigurationRequest , ConfigurationResponse > sendAndReceive ( request ) ; } ) . whenComplete ( ( response , error ) -> { cancelJoinTimer ( ) ; if ( error == null ) { LOGGER . trace ( "{} - Received {}" , member . address ( ) , response ) ; if ( response . status ( ) == Response . Status . OK ) { if ( joinFuture != null ) { joinFuture . complete ( null ) ; } } else if ( response . error ( ) == null || response . error ( ) == CopycatError . Type . CONFIGURATION_ERROR ) { LOGGER . debug ( "{} - Failed to update configuration: configuration change already in progress" , member . address ( ) ) ; joinTimeout = context . getThreadContext ( ) . schedule ( context . getElectionTimeout ( ) . multipliedBy ( 2 ) , this :: identify ) ; } } else { LOGGER . warn ( "{} - Failed to update configuration: {}" , member . address ( ) , error . getMessage ( ) ) ; joinTimeout = context . getThreadContext ( ) . schedule ( context . getElectionTimeout ( ) . multipliedBy ( 2 ) , this :: identify ) ; } } ) ; } } return joinFuture ;
public class CNFactory { /** * 读入分词模型 * @ param path 模型所在目录 , 结尾不带 " / " 。 * @ throws LoadModelException */ public static void loadSeg ( String path ) throws LoadModelException { } }
if ( seg == null ) { String file = path + segModel ; seg = new CWSTagger ( file ) ; seg . setEnFilter ( isEnFilter ) ; }
public class LottieValueAnimator { /** * Returns the current value of the animation from 0 to 1 regardless * of the animation speed , direction , or min and max frames . */ @ FloatRange ( from = 0f , to = 1f ) public float getAnimatedValueAbsolute ( ) { } }
if ( composition == null ) { return 0 ; } return ( frame - composition . getStartFrame ( ) ) / ( composition . getEndFrame ( ) - composition . getStartFrame ( ) ) ;
public class AbstractRasMethodAdapter { /** * Visit the method annotations looking at the supported RAS annotations . * The visitors are only used when a { @ code MethodInfo } model object was * not provided during construction . * @ param desc * the annotation descriptor * @ param visible * true if the annotation is a runtime visible annotation */ @ Override public AnnotationVisitor visitAnnotation ( String desc , boolean visible ) { } }
AnnotationVisitor av = super . visitAnnotation ( desc , visible ) ; observedAnnotations . add ( Type . getType ( desc ) ) ; if ( desc . equals ( INJECTED_TRACE_TYPE . getDescriptor ( ) ) ) { injectedTraceAnnotationVisitor = new InjectedTraceAnnotationVisitor ( av , getClass ( ) ) ; av = injectedTraceAnnotationVisitor ; } return av ;
public class TerminologyDataMarshaller { /** * Marshall the given parameter object . */ public void marshall ( TerminologyData terminologyData , ProtocolMarshaller protocolMarshaller ) { } }
if ( terminologyData == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( terminologyData . getFile ( ) , FILE_BINDING ) ; protocolMarshaller . marshall ( terminologyData . getFormat ( ) , FORMAT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class GifDecoder { /** * Reads GIF image from stream . * @ param is containing GIF file . * @ return read status code ( 0 = no errors ) . */ int read ( InputStream is , int contentLength ) { } }
if ( is != null ) { try { int capacity = ( contentLength > 0 ) ? ( contentLength + 4096 ) : 16384 ; ByteArrayOutputStream buffer = new ByteArrayOutputStream ( capacity ) ; int nRead ; byte [ ] data = new byte [ 16384 ] ; while ( ( nRead = is . read ( data , 0 , data . length ) ) != - 1 ) { buffer . write ( data , 0 , nRead ) ; } buffer . flush ( ) ; read ( buffer . toByteArray ( ) ) ; } catch ( IOException e ) { Logger . d ( TAG , "Error reading data from stream" , e ) ; } } else { status = STATUS_OPEN_ERROR ; } try { if ( is != null ) { is . close ( ) ; } } catch ( IOException e ) { Logger . d ( TAG , "Error closing stream" , e ) ; } return status ;
public class HttpHeaders { /** * @ deprecated Use { @ link # getTimeMillis ( CharSequence , long ) } instead . * Returns the date header value with the specified header name . If * there are more than one header value for the specified header name , the * first value is returned . * @ return the header value or the { @ code defaultValue } if there is no such * header or the header value is not a formatted date */ @ Deprecated public static Date getDateHeader ( HttpMessage message , CharSequence name , Date defaultValue ) { } }
final String value = getHeader ( message , name ) ; Date date = DateFormatter . parseHttpDate ( value ) ; return date != null ? date : defaultValue ;
public class ShutdownHandler { /** * / * ( non - Javadoc ) * @ see org . jboss . as . cli . handlers . CommandHandlerWithHelp # doHandle ( org . jboss . as . cli . CommandContext ) */ @ Override protected void doHandle ( CommandContext ctx ) throws CommandLineException { } }
final ModelControllerClient client = ctx . getModelControllerClient ( ) ; if ( client == null ) { throw new CommandLineException ( "Connection is not available." ) ; } if ( embeddedServerRef != null && embeddedServerRef . get ( ) != null ) { embeddedServerRef . get ( ) . stop ( ) ; return ; } if ( ! ( client instanceof AwaiterModelControllerClient ) ) { throw new CommandLineException ( "Unsupported ModelControllerClient implementation " + client . getClass ( ) . getName ( ) ) ; } final AwaiterModelControllerClient cliClient = ( AwaiterModelControllerClient ) client ; final ModelNode op = this . buildRequestWithoutHeaders ( ctx ) ; boolean disconnect = true ; final String restartValue = restart . getValue ( ctx . getParsedCommandLine ( ) ) ; if ( Util . TRUE . equals ( restartValue ) || ctx . isDomainMode ( ) && ! isLocalHost ( ctx . getModelControllerClient ( ) , host . getValue ( ctx . getParsedCommandLine ( ) ) ) ) { disconnect = false ; } try { final ModelNode response = cliClient . execute ( op , true ) ; if ( ! Util . isSuccess ( response ) ) { throw new CommandLineException ( Util . getFailureDescription ( response ) ) ; } } catch ( IOException e ) { // if it ' s not connected , it ' s assumed the connection has already been shutdown if ( cliClient . isConnected ( ) ) { StreamUtils . safeClose ( client ) ; throw new CommandLineException ( "Failed to execute :shutdown" , e ) ; } } if ( disconnect ) { ctx . disconnectController ( ) ; } else { // if I try to reconnect immediately , it ' ll hang for 5 sec // which the default connection timeout for model controller client // waiting half a sec on my machine works perfectly try { Thread . sleep ( 2000 ) ; } catch ( InterruptedException e ) { throw new CommandLineException ( "Interrupted while pausing before reconnecting." , e ) ; } try { cliClient . ensureConnected ( ctx . getConfig ( ) . getConnectionTimeout ( ) + 1000 ) ; } catch ( CommandLineException e ) { ctx . disconnectController ( ) ; throw e ; } catch ( IOException ex ) { if ( ex instanceof RedirectException ) { if ( ! Util . reconnectContext ( ( RedirectException ) ex , ctx ) ) { throw new CommandLineException ( "Can't reconnect context." , ex ) ; } } else { throw new CommandLineException ( ex ) ; } } }
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link BezierType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link BezierType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "Bezier" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "BSpline" ) public JAXBElement < BezierType > createBezier ( BezierType value ) { } }
return new JAXBElement < BezierType > ( _Bezier_QNAME , BezierType . class , null , value ) ;
public class ByteInput { /** * Inserts text at cursor position * @ param text * @ throws java . io . IOException */ @ Override public void insert ( CharSequence text ) throws IOException { } }
int ln = text . length ( ) ; if ( ln == 0 ) { return ; } if ( ln >= size - ( end - cursor ) ) { throw new IOException ( text + " doesn't fit in the buffer" ) ; } if ( cursor != end ) { makeRoom ( ln ) ; } for ( int ii = 0 ; ii < ln ; ii ++ ) { set ( ( cursor + ii ) , text . charAt ( ii ) ) ; } end += ln ;
public class PubSubOutputHandler { /** * @ return flag indicating whether this handler is owned by a Link */ public boolean isLink ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "isLink" ) ; SibTr . exit ( tc , "isLink" , new Boolean ( _isLink ) ) ; } return _isLink ;
public class GenericsUtils { /** * May produce array class instead of generic array type . This is possible due to wildcard or parameterized type * shrinking . * @ param type type to repackage * @ param generics known generics * @ param countPreservedVariables true to replace { @ link ExplicitTypeVariable } too * @ return type without { @ link TypeVariable } ' s */ private static Type resolveGenericArrayTypeVariables ( final GenericArrayType type , final Map < String , Type > generics , final boolean countPreservedVariables ) { } }
final Type componentType = resolveTypeVariables ( type . getGenericComponentType ( ) , generics , countPreservedVariables ) ; return ArrayTypeUtils . toArrayType ( componentType ) ;
public class CopierImplementation { /** * Creates iterations copies of the equivalent java code * < pre > * unsafe . putLong ( dest , destOffset , unsafe . getLong ( src ) ) ; * destOffset + = COPY _ STRIDE ; src + = COPY _ STRIDE * < / pre > * @ param iterations * @ throws NoSuchFieldException * @ throws NoSuchMethodException */ private void buildLongCopyStack ( List < StackManipulation > stack , int iterations ) throws NoSuchFieldException , NoSuchMethodException { } }
final Method getLongMethod = Unsafe . class . getMethod ( "getLong" , long . class ) ; final Method putLongMethod = Unsafe . class . getMethod ( "putLong" , Object . class , long . class , long . class ) ; buildCopyStack ( stack , iterations , getLongMethod , putLongMethod , COPY_STRIDE ) ;
public class TileSheetsConfig { /** * Export the defined sheets . * @ param nodeSheets Sheets node ( must not be < code > null < / code > ) . * @ param sheets Sheets defined ( must not be < code > null < / code > ) . */ private static void exportSheets ( Xml nodeSheets , Collection < String > sheets ) { } }
for ( final String sheet : sheets ) { final Xml nodeSheet = nodeSheets . createChild ( NODE_TILE_SHEET ) ; nodeSheet . setText ( sheet ) ; }
public class SerializedCheckpointData { /** * Converts a list of checkpoints with elements into an array of SerializedCheckpointData . * @ param checkpoints The checkpoints to be converted into IdsCheckpointData . * @ param serializer The serializer to serialize the IDs . * @ param < T > The type of the ID . * @ return An array of serializable SerializedCheckpointData , one per entry in the queue . * @ throws IOException Thrown , if the serialization fails . */ public static < T > SerializedCheckpointData [ ] fromDeque ( ArrayDeque < Tuple2 < Long , Set < T > > > checkpoints , TypeSerializer < T > serializer ) throws IOException { } }
return fromDeque ( checkpoints , serializer , new DataOutputSerializer ( 128 ) ) ;
public class AbstractIterativeSolver { /** * Checks sizes of input data for { @ link # solve ( Matrix , Vector , Vector ) } . * Throws an exception if the sizes does not match . */ protected void checkSizes ( Matrix A , Vector b , Vector x ) { } }
if ( ! A . isSquare ( ) ) throw new IllegalArgumentException ( "!A.isSquare()" ) ; if ( b . size ( ) != A . numRows ( ) ) throw new IllegalArgumentException ( "b.size() != A.numRows()" ) ; if ( b . size ( ) != x . size ( ) ) throw new IllegalArgumentException ( "b.size() != x.size()" ) ;
public class JavaBackend { /** * Convenience method for frameworks that wish to load glue from methods explicitly ( possibly * found with a different mechanism than Cucumber ' s built - in classpath scanning ) . * @ param glue where stepdefs and hooks will be added . * @ param method a candidate method . * @ param glueCodeClass the class implementing the method . Must not be a subclass of the class implementing the method . */ public void loadGlue ( Glue glue , Method method , Class < ? > glueCodeClass ) { } }
this . glue = glue ; methodScanner . scan ( this , method , glueCodeClass ) ;
public class ThreadUtil { /** * 创建新线程 , 非守护线程 , 正常优先级 , 线程组与当前线程的线程组一致 * @ param runnable { @ link Runnable } * @ param name 线程名 * @ return { @ link Thread } * @ since 3.1.2 */ public static Thread newThread ( Runnable runnable , String name ) { } }
final Thread t = newThread ( runnable , name , false ) ; if ( t . getPriority ( ) != Thread . NORM_PRIORITY ) { t . setPriority ( Thread . NORM_PRIORITY ) ; } return t ;
public class AxesRenderer { /** * Draw axes labels and names in the foreground . * @ param canvas */ public void drawInForeground ( Canvas canvas ) { } }
Axis axis = chart . getChartData ( ) . getAxisYLeft ( ) ; if ( null != axis ) { drawAxisLabelsAndName ( canvas , axis , LEFT ) ; } axis = chart . getChartData ( ) . getAxisYRight ( ) ; if ( null != axis ) { drawAxisLabelsAndName ( canvas , axis , RIGHT ) ; } axis = chart . getChartData ( ) . getAxisXBottom ( ) ; if ( null != axis ) { drawAxisLabelsAndName ( canvas , axis , BOTTOM ) ; } axis = chart . getChartData ( ) . getAxisXTop ( ) ; if ( null != axis ) { drawAxisLabelsAndName ( canvas , axis , TOP ) ; }
public class LazySocket { /** * Option 0. */ public void setTcpNoDelay ( boolean on ) throws SocketException { } }
if ( mSocket != null ) { mSocket . setTcpNoDelay ( on ) ; } else { setOption ( 0 , on ? Boolean . TRUE : Boolean . FALSE ) ; }
public class MultiVertexGeometryImpl { /** * \ internal Updates x , y intervals . */ public void _updateXYImpl ( boolean bExact ) { } }
m_envelope . setEmpty ( ) ; AttributeStreamOfDbl stream = ( AttributeStreamOfDbl ) m_vertexAttributes [ 0 ] ; Point2D pt = new Point2D ( ) ; for ( int i = 0 ; i < m_pointCount ; i ++ ) { stream . read ( 2 * i , pt ) ; m_envelope . merge ( pt ) ; }
public class MaterialPathAnimator { /** * Helper method to apply the path animator . * @ param source Source widget to apply the Path Animator * @ param target Target widget to apply the Path Animator */ public static void animate ( Widget source , final Widget target ) { } }
animate ( source . getElement ( ) , target . getElement ( ) ) ;
public class AbstractTracker { /** * Creates a new tracker that tracks services by generic filter * @ param filter generic filter to use for tracker * @ return a configured osgi service tracker */ protected final ServiceTracker < T , W > create ( String filter ) { } }
try { return new ServiceTracker < > ( bundleContext , bundleContext . createFilter ( filter ) , this ) ; } catch ( InvalidSyntaxException e ) { throw new IllegalArgumentException ( "Unexpected InvalidSyntaxException: " + e . getMessage ( ) ) ; }
public class ByteArray { /** * Add data at the current position . * @ param source * Source data . * @ param index * The index in the source data . Data from the index is copied . * @ param length * The length of data to copy . */ public void put ( byte [ ] source , int index , int length ) { } }
// If the buffer is small . if ( mBuffer . capacity ( ) < ( mLength + length ) ) { expandBuffer ( mLength + length + ADDITIONAL_BUFFER_SIZE ) ; } mBuffer . put ( source , index , length ) ; mLength += length ;
public class SARLRuntime { /** * Notifies registered listeners that the default SRE has changed . * @ param previous the previous SRE * @ param current the new current default SRE */ private static void fireDefaultSREChanged ( ISREInstall previous , ISREInstall current ) { } }
for ( final Object listener : SRE_LISTENERS . getListeners ( ) ) { ( ( ISREInstallChangedListener ) listener ) . defaultSREInstallChanged ( previous , current ) ; }
public class LazyIterate { /** * Creates a deferred negative filtering iterable for the specified iterable */ public static < T > LazyIterable < T > reject ( Iterable < T > iterable , Predicate < ? super T > predicate ) { } }
return new RejectIterable < T > ( iterable , predicate ) ;
public class VMCommandLine { /** * Analyse the command line to extract the options . * < p > The options will be recognized thanks to the { @ code optionDefinitions } . * Each entry of { @ code optionDefinitions } describes an option . They must * have one of the following formats : * < ul > * < li > { @ code name } : a simple option without value or flag , < / li > * < li > { @ code name = s } : an option with a mandatory string value , < / li > * < li > { @ code name : s } : an option with an optional string value , < / li > * < li > { @ code name = i } : an option with a mandatory integer value , < / li > * < li > { @ code name : i } : an option with an optional integer value , < / li > * < li > { @ code name = f } : an option with a mandatory floating - point value , < / li > * < li > { @ code name : f } : an option with an optional floating - point value , < / li > * < li > { @ code name = b } : an option with a mandatory boolean value , < / li > * < li > { @ code name : b } : an option with an optional boolean value , < / li > * < li > { @ code name + } : an option with an autoincremented integer value , < / li > * < li > { @ code name ! } : an option which could be flaged or not : { @ code - - name } or { @ code - - noname } . < / li > * < / ul > * @ param optionDefinitions is the list of definitions of the available command line options . */ @ SuppressWarnings ( { } }
"checkstyle:cyclomaticcomplexity" , "npathcomplexity" } ) public static void splitOptionsAndParameters ( String ... optionDefinitions ) { if ( analyzed ) { return ; } final List < String > params = new ArrayList < > ( ) ; final SortedMap < String , List < Object > > options = new TreeMap < > ( ) ; String opt ; // Analyze definitions final Map < String , OptionType > defs = new TreeMap < > ( ) ; for ( final String def : optionDefinitions ) { if ( def . endsWith ( "!" ) ) { // $ NON - NLS - 1 $ opt = def . substring ( 0 , def . length ( ) - 1 ) ; defs . put ( opt , OptionType . FLAG ) ; registerOptionValue ( options , opt , Boolean . FALSE , OptionType . FLAG ) ; } else if ( def . endsWith ( "+" ) ) { // $ NON - NLS - 1 $ opt = def . substring ( 0 , def . length ( ) - 1 ) ; defs . put ( opt , OptionType . AUTO_INCREMENTED ) ; registerOptionValue ( options , opt , Long . valueOf ( 0 ) , OptionType . AUTO_INCREMENTED ) ; } else if ( def . endsWith ( "=b" ) ) { // $ NON - NLS - 1 $ opt = def . substring ( 0 , def . length ( ) - 2 ) ; defs . put ( opt , OptionType . MANDATORY_BOOLEAN ) ; } else if ( def . endsWith ( ":b" ) ) { // $ NON - NLS - 1 $ opt = def . substring ( 0 , def . length ( ) - 2 ) ; defs . put ( opt , OptionType . OPTIONAL_BOOLEAN ) ; } else if ( def . endsWith ( "=f" ) ) { // $ NON - NLS - 1 $ opt = def . substring ( 0 , def . length ( ) - 2 ) ; defs . put ( opt , OptionType . MANDATORY_FLOAT ) ; } else if ( def . endsWith ( ":f" ) ) { // $ NON - NLS - 1 $ opt = def . substring ( 0 , def . length ( ) - 2 ) ; defs . put ( opt , OptionType . OPTIONAL_FLOAT ) ; } else if ( def . endsWith ( "=i" ) ) { // $ NON - NLS - 1 $ opt = def . substring ( 0 , def . length ( ) - 2 ) ; defs . put ( opt , OptionType . MANDATORY_INTEGER ) ; } else if ( def . endsWith ( ":i" ) ) { // $ NON - NLS - 1 $ opt = def . substring ( 0 , def . length ( ) - 2 ) ; defs . put ( opt , OptionType . OPTIONAL_INTEGER ) ; } else if ( def . endsWith ( "=s" ) ) { // $ NON - NLS - 1 $ opt = def . substring ( 0 , def . length ( ) - 2 ) ; defs . put ( opt , OptionType . MANDATORY_STRING ) ; } else if ( def . endsWith ( ":s" ) ) { // $ NON - NLS - 1 $ opt = def . substring ( 0 , def . length ( ) - 2 ) ; defs . put ( opt , OptionType . OPTIONAL_STRING ) ; } else { defs . put ( def , OptionType . SIMPLE ) ; } } int idx ; String base ; String nbase ; String val ; OptionType type ; OptionType waitingValue = null ; String valueOptionName = null ; boolean allParameters = false ; boolean success ; for ( final String param : commandLineParameters ) { if ( allParameters ) { params . add ( param ) ; continue ; } if ( waitingValue != null && waitingValue . isMandatory ( ) ) { // Expect a value as the next parameter success = registerOptionValue ( options , valueOptionName , param , waitingValue ) ; waitingValue = null ; valueOptionName = null ; if ( success ) { continue ; } } if ( "--" . equals ( param ) ) { // $ NON - NLS - 1 $ if ( waitingValue != null ) { registerOptionValue ( options , valueOptionName , null , waitingValue ) ; waitingValue = null ; valueOptionName = null ; } allParameters = true ; continue ; } else if ( ( File . separatorChar != '/' ) && ( param . startsWith ( "/" ) ) ) { // $ NON - NLS - 1 $ opt = param . substring ( 1 ) ; } else if ( param . startsWith ( "--" ) ) { // $ NON - NLS - 1 $ opt = param . substring ( 2 ) ; } else if ( param . startsWith ( "-" ) ) { // $ NON - NLS - 1 $ opt = param . substring ( 1 ) ; } else if ( waitingValue != null ) { success = registerOptionValue ( options , valueOptionName , param , waitingValue ) ; waitingValue = null ; valueOptionName = null ; if ( ! success ) { params . add ( param ) ; } continue ; } else { params . add ( param ) ; continue ; } if ( waitingValue != null ) { success = registerOptionValue ( options , valueOptionName , param , waitingValue ) ; waitingValue = null ; valueOptionName = null ; if ( success ) { continue ; } } idx = opt . indexOf ( '=' ) ; if ( idx > 0 ) { base = opt . substring ( 0 , idx ) ; val = opt . substring ( idx + 1 ) ; } else { base = opt ; val = null ; } nbase = null ; type = defs . get ( base ) ; if ( type == null && base . toLowerCase ( ) . startsWith ( "no" ) ) { // $ NON - NLS - 1 $ nbase = base . substring ( 2 ) ; type = defs . get ( nbase ) ; } if ( type != null ) { switch ( type ) { case FLAG : if ( nbase == null ) { registerOptionValue ( options , base , Boolean . TRUE , type ) ; } else { registerOptionValue ( options , nbase , Boolean . FALSE , type ) ; } break ; case MANDATORY_FLOAT : case MANDATORY_BOOLEAN : case MANDATORY_INTEGER : case MANDATORY_STRING : case OPTIONAL_FLOAT : case OPTIONAL_BOOLEAN : case OPTIONAL_INTEGER : case OPTIONAL_STRING : if ( val != null ) { registerOptionValue ( options , base , val , type ) ; } else { waitingValue = type ; valueOptionName = base ; } break ; // $ CASES - OMITTED $ default : registerOptionValue ( options , base , val , type ) ; } } else { // Not a recognized option , assuming simple registerOptionValue ( options , base , val , OptionType . SIMPLE ) ; } } if ( waitingValue != null && waitingValue . isMandatory ( ) ) { throw new IllegalStateException ( Locale . getString ( "E2" , valueOptionName ) ) ; // $ NON - NLS - 1 $ } commandLineParameters = new String [ params . size ( ) ] ; params . toArray ( commandLineParameters ) ; params . clear ( ) ; commandLineOptions = options ; analyzed = true ;
public class GreedyAllocator { /** * Allocates a block from the given block store location . The location can be a specific location , * or { @ link BlockStoreLocation # anyTier ( ) } or { @ link BlockStoreLocation # anyDirInTier ( String ) } . * @ param sessionId the id of session to apply for the block allocation * @ param blockSize the size of block in bytes * @ param location the location in block store * @ return a { @ link StorageDirView } in which to create the temp block meta if success , null * otherwise * @ throws IllegalArgumentException if block location is invalid */ private StorageDirView allocateBlock ( long sessionId , long blockSize , BlockStoreLocation location ) { } }
Preconditions . checkNotNull ( location , "location" ) ; if ( location . equals ( BlockStoreLocation . anyTier ( ) ) ) { // When any tier is ok , loop over all tier views and dir views , // and return a temp block meta from the first available dirview . for ( StorageTierView tierView : mManagerView . getTierViews ( ) ) { for ( StorageDirView dirView : tierView . getDirViews ( ) ) { if ( dirView . getAvailableBytes ( ) >= blockSize ) { return dirView ; } } } return null ; } String tierAlias = location . tierAlias ( ) ; StorageTierView tierView = mManagerView . getTierView ( tierAlias ) ; if ( location . equals ( BlockStoreLocation . anyDirInTier ( tierAlias ) ) ) { // Loop over all dir views in the given tier for ( StorageDirView dirView : tierView . getDirViews ( ) ) { if ( dirView . getAvailableBytes ( ) >= blockSize ) { return dirView ; } } return null ; } int dirIndex = location . dir ( ) ; StorageDirView dirView = tierView . getDirView ( dirIndex ) ; if ( dirView . getAvailableBytes ( ) >= blockSize ) { return dirView ; } return null ;
public class AuthorizationProcessManager { /** * Generate the params that will be used during the token request phase * @ param grantCode from the authorization phase * @ return Map with all the headers */ private HashMap < String , String > createTokenRequestParams ( String grantCode ) { } }
HashMap < String , String > params = new HashMap < > ( ) ; params . put ( "code" , grantCode ) ; params . put ( "client_id" , preferences . clientId . get ( ) ) ; params . put ( "grant_type" , "authorization_code" ) ; params . put ( "redirect_uri" , HTTP_LOCALHOST ) ; return params ;
public class UpdateIndex { /** * The main ( ) method * @ param argv */ public static void main ( String [ ] argv ) { } }
if ( argv . length == 0 ) { printUsage ( "" ) ; System . exit ( - 1 ) ; } String inputPathsString = null ; Path outputPath = null ; String shardsString = null ; String indexPath = null ; int numShards = - 1 ; int numMapTasks = - 1 ; Configuration conf = new Configuration ( ) ; String confPath = null ; // parse the command line for ( int i = 0 ; i < argv . length ; i ++ ) { // parse command line if ( argv [ i ] . equals ( "-inputPaths" ) ) { inputPathsString = argv [ ++ i ] ; } else if ( argv [ i ] . equals ( "-outputPath" ) ) { outputPath = new Path ( argv [ ++ i ] ) ; } else if ( argv [ i ] . equals ( "-shards" ) ) { shardsString = argv [ ++ i ] ; } else if ( argv [ i ] . equals ( "-indexPath" ) ) { indexPath = argv [ ++ i ] ; } else if ( argv [ i ] . equals ( "-numShards" ) ) { numShards = Integer . parseInt ( argv [ ++ i ] ) ; } else if ( argv [ i ] . equals ( "-numMapTasks" ) ) { numMapTasks = Integer . parseInt ( argv [ ++ i ] ) ; } else if ( argv [ i ] . equals ( "-conf" ) ) { // add as a local FS resource confPath = argv [ ++ i ] ; conf . addResource ( new Path ( confPath ) ) ; } else { System . out . println ( "Unknown option " + argv [ i ] + " w/ value " + argv [ ++ i ] ) ; } } LOG . info ( "inputPaths = " + inputPathsString ) ; LOG . info ( "outputPath = " + outputPath ) ; LOG . info ( "shards = " + shardsString ) ; LOG . info ( "indexPath = " + indexPath ) ; LOG . info ( "numShards = " + numShards ) ; LOG . info ( "numMapTasks= " + numMapTasks ) ; LOG . info ( "confPath = " + confPath ) ; Path [ ] inputPaths = null ; Shard [ ] shards = null ; JobConf jobConf = new JobConf ( conf ) ; IndexUpdateConfiguration iconf = new IndexUpdateConfiguration ( jobConf ) ; if ( inputPathsString != null ) { jobConf . set ( "mapred.input.dir" , inputPathsString ) ; } inputPaths = FileInputFormat . getInputPaths ( jobConf ) ; if ( inputPaths . length == 0 ) { inputPaths = null ; } if ( outputPath == null ) { outputPath = FileOutputFormat . getOutputPath ( jobConf ) ; } if ( inputPaths == null || outputPath == null ) { System . err . println ( "InputPaths and outputPath must be specified." ) ; printUsage ( "" ) ; System . exit ( - 1 ) ; } if ( shardsString != null ) { iconf . setIndexShards ( shardsString ) ; } shards = Shard . getIndexShards ( iconf ) ; if ( shards != null && shards . length == 0 ) { shards = null ; } if ( indexPath == null ) { indexPath = getIndexPath ( conf ) ; } if ( numShards <= 0 ) { numShards = getNumShards ( conf ) ; } if ( shards == null && indexPath == null ) { System . err . println ( "Either shards or indexPath must be specified." ) ; printUsage ( "" ) ; System . exit ( - 1 ) ; } if ( numMapTasks <= 0 ) { numMapTasks = jobConf . getNumMapTasks ( ) ; } try { // create shards and set their directories if necessary if ( shards == null ) { shards = createShards ( indexPath , numShards , conf ) ; } long startTime = now ( ) ; try { IIndexUpdater updater = ( IIndexUpdater ) ReflectionUtils . newInstance ( iconf . getIndexUpdaterClass ( ) , conf ) ; LOG . info ( "sea.index.updater = " + iconf . getIndexUpdaterClass ( ) . getName ( ) ) ; updater . run ( conf , inputPaths , outputPath , numMapTasks , shards ) ; LOG . info ( "Index update job is done" ) ; } finally { long elapsedTime = now ( ) - startTime ; LOG . info ( "Elapsed time is " + ( elapsedTime / 1000 ) + "s" ) ; System . out . println ( "Elapsed time is " + ( elapsedTime / 1000 ) + "s" ) ; } } catch ( Exception e ) { e . printStackTrace ( System . err ) ; }
import java . util . * ; class Main { /** * The function returns the list of strings from the provided list that contain a specific substring * Args : * input _ strings : A list of strings * sub : The target substring * Returns : * A list of strings from the input _ strings that contain the target substring * Example usage : * > > > substring _ filter ( [ ] , ' b ' ) * > > > substring _ filter ( [ ' apple ' , ' banana ' , ' grape ' , ' blueberry ' ] , ' b ' ) * [ ' banana ' , ' blueberry ' ] */ public static List < String > substring_filter ( List < String > input_strings , String sub ) { } }
List < String > result = new ArrayList < > ( ) ; for ( String s : input_strings ) { if ( s . contains ( sub ) ) { result . add ( s ) ; } } return result ;
public class GetUsersSavedTracksRequest { /** * Get the songs from the current users " Your Music " library . * @ return A { @ link SavedTrack } paging . * @ throws IOException In case of networking issues . * @ throws SpotifyWebApiException The Web API returned an error further specified in this exception ' s root cause . */ @ SuppressWarnings ( "unchecked" ) public Paging < SavedTrack > execute ( ) throws IOException , SpotifyWebApiException { } }
return new SavedTrack . JsonUtil ( ) . createModelObjectPaging ( getJson ( ) ) ;
public class CollectionFileWriter { /** * Constructor . * @ param fileName the name of the file to write to * @ param entries the strings to write to the file ( one string per line ) * @ throws IllegalArgumentException if enabled but no file name defined */ public static void write ( String fileName , Collection < ? extends Object > entries ) { } }
if ( fileName == null ) { throw new IllegalArgumentException ( "Must specify a file name to write to" ) ; } PrintWriter writer = null ; File file = new File ( fileName ) ; try { file . mkdirs ( ) ; if ( file . exists ( ) ) { file . delete ( ) ; } writer = new PrintWriter ( new FileWriter ( file ) , true ) ; for ( Object entry : entries ) { writer . println ( String . valueOf ( entry ) ) ; } } catch ( Exception e ) { throw new RuntimeException ( "Problem writing to " + file . getAbsolutePath ( ) , e ) ; } finally { try { if ( writer != null ) { writer . close ( ) ; } } catch ( Exception e ) { } }
public class A_CmsUI { /** * Returns the workplace settings . < p > * @ return the workplace settings */ public CmsWorkplaceSettings getWorkplaceSettings ( ) { } }
CmsWorkplaceSettings settings = ( CmsWorkplaceSettings ) getSession ( ) . getSession ( ) . getAttribute ( CmsWorkplaceManager . SESSION_WORKPLACE_SETTINGS ) ; if ( settings == null ) { settings = CmsLoginHelper . initSiteAndProject ( getCmsObject ( ) ) ; VaadinService . getCurrentRequest ( ) . getWrappedSession ( ) . setAttribute ( CmsWorkplaceManager . SESSION_WORKPLACE_SETTINGS , settings ) ; } return settings ;
public class N1qlQuery { /** * Create a new query with named parameters . Note that the { @ link JsonObject } * should not be mutated until { @ link # n1ql ( ) } is called since it backs the * creation of the query string . * Named parameters have the form of ` $ name ` , where the ` name ` represents the unique name . The * following two examples are equivalent and compare the { @ link # simple ( Statement ) } * vs the named { @ link # parameterized ( Statement , JsonObject ) } approach : * Simple : * N1qlQuery . simple ( " SELECT * FROM ` travel - sample ` WHERE type = ' airline ' and name like ' A % ' " ) * Named Params : * N1qlQuery . parameterized ( * " SELECT * FROM ` travel - sample ` WHERE type = $ type and name like $ name " , * JsonObject . create ( ) * . put ( " type " , " airline " ) * . put ( " name " , " A % " ) * Using parameterized statements combined with non - adhoc queries ( which is configurable through * the { @ link N1qlParams } ) can provide better performance even when the actual arguments change * at execution time . * @ param statement the { @ link Statement } to execute ( containing named placeholders ) * @ param namedParams the values for the named placeholders in statement */ public static ParameterizedN1qlQuery parameterized ( Statement statement , JsonObject namedParams ) { } }
return new ParameterizedN1qlQuery ( statement , namedParams , null ) ;
public class JavacParser { /** * TypeArgumentsOpt = [ TypeArguments ] */ JCExpression typeArgumentsOpt ( JCExpression t ) { } }
if ( token . kind == LT && ( mode & TYPE ) != 0 && ( mode & NOPARAMS ) == 0 ) { mode = TYPE ; checkGenerics ( ) ; return typeArguments ( t , false ) ; } else { return t ; }
public class CommerceTierPriceEntryLocalServiceBaseImpl { /** * Returns all the commerce tier price entries matching the UUID and company . * @ param uuid the UUID of the commerce tier price entries * @ param companyId the primary key of the company * @ return the matching commerce tier price entries , or an empty list if no matches were found */ @ Override public List < CommerceTierPriceEntry > getCommerceTierPriceEntriesByUuidAndCompanyId ( String uuid , long companyId ) { } }
return commerceTierPriceEntryPersistence . findByUuid_C ( uuid , companyId ) ;
public class PhraseCondition { /** * { @ inheritDoc } */ @ Override public Query query ( Schema schema ) { } }
if ( field == null || field . trim ( ) . isEmpty ( ) ) { throw new IllegalArgumentException ( "Field name required" ) ; } if ( values == null ) { throw new IllegalArgumentException ( "Field values required" ) ; } if ( slop == null ) { throw new IllegalArgumentException ( "Slop required" ) ; } if ( slop < 0 ) { throw new IllegalArgumentException ( "Slop must be positive" ) ; } ColumnMapperSingle < ? > columnMapper = getMapper ( schema , field ) ; Class < ? > clazz = columnMapper . baseClass ( ) ; if ( clazz == String . class ) { PhraseQuery query = new PhraseQuery ( ) ; query . setSlop ( slop ) ; query . setBoost ( boost ) ; int count = 0 ; for ( String value : values ) { if ( value != null ) { String analyzedValue = analyze ( field , value , schema ) ; if ( analyzedValue != null ) { Term term = new Term ( field , analyzedValue ) ; query . add ( term , count ) ; } } count ++ ; } return query ; } else { String message = String . format ( "Unsupported query %s for mapper %s" , this , columnMapper ) ; throw new UnsupportedOperationException ( message ) ; }
public class RecordingGroup { /** * A comma - separated list that specifies the types of AWS resources for which AWS Config records configuration * changes ( for example , < code > AWS : : EC2 : : Instance < / code > or < code > AWS : : CloudTrail : : Trail < / code > ) . * Before you can set this option to < code > true < / code > , you must set the < code > allSupported < / code > option to * < code > false < / code > . * If you set this option to < code > true < / code > , when AWS Config adds support for a new type of resource , it will not * record resources of that type unless you manually add that type to your recording group . * For a list of valid < code > resourceTypes < / code > values , see the < b > resourceType Value < / b > column in < a href = * " https : / / docs . aws . amazon . com / config / latest / developerguide / resource - config - reference . html # supported - resources " * > Supported AWS Resource Types < / a > . * @ param resourceTypes * A comma - separated list that specifies the types of AWS resources for which AWS Config records * configuration changes ( for example , < code > AWS : : EC2 : : Instance < / code > or < code > AWS : : CloudTrail : : Trail < / code > * Before you can set this option to < code > true < / code > , you must set the < code > allSupported < / code > option to * < code > false < / code > . * If you set this option to < code > true < / code > , when AWS Config adds support for a new type of resource , it * will not record resources of that type unless you manually add that type to your recording group . * For a list of valid < code > resourceTypes < / code > values , see the < b > resourceType Value < / b > column in < a * href = * " https : / / docs . aws . amazon . com / config / latest / developerguide / resource - config - reference . html # supported - resources " * > Supported AWS Resource Types < / a > . * @ return Returns a reference to this object so that method calls can be chained together . * @ see ResourceType */ public RecordingGroup withResourceTypes ( ResourceType ... resourceTypes ) { } }
com . amazonaws . internal . SdkInternalList < String > resourceTypesCopy = new com . amazonaws . internal . SdkInternalList < String > ( resourceTypes . length ) ; for ( ResourceType value : resourceTypes ) { resourceTypesCopy . add ( value . toString ( ) ) ; } if ( getResourceTypes ( ) == null ) { setResourceTypes ( resourceTypesCopy ) ; } else { getResourceTypes ( ) . addAll ( resourceTypesCopy ) ; } return this ;
public class OsiamConnector { /** * Provides a new and refreshed access token by getting the refresh token from the given access token . * @ param accessToken the access token to be refreshed * @ param scopes an optional parameter if the scope of the token should be changed . Otherwise the scopes of the * old token are used . * @ return the new access token with the refreshed lifetime * @ throws IllegalArgumentException in case the accessToken has an empty refresh token * @ throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized * @ throws UnauthorizedException if the request could not be authorized . * @ throws IllegalStateException if OSIAM ' s endpoint ( s ) are not properly configured */ public AccessToken refreshAccessToken ( AccessToken accessToken , Scope ... scopes ) { } }
return getAuthService ( ) . refreshAccessToken ( accessToken , scopes ) ;
public class AmazonApiGatewayV2Client { /** * Deletes a Deployment . * @ param deleteDeploymentRequest * @ return Result of the DeleteDeployment operation returned by the service . * @ throws NotFoundException * The resource specified in the request was not found . * @ throws TooManyRequestsException * The client is sending more than the allowed number of requests per unit of time . * @ sample AmazonApiGatewayV2 . DeleteDeployment */ @ Override public DeleteDeploymentResult deleteDeployment ( DeleteDeploymentRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDeleteDeployment ( request ) ;
public class ExprParser { /** * and : expr ' & & ' expr */ Expr and ( ) { } }
Expr expr = equalNotEqual ( ) ; for ( Tok tok = peek ( ) ; tok . sym == Sym . AND ; tok = peek ( ) ) { move ( ) ; expr = new Logic ( Sym . AND , expr , equalNotEqual ( ) , location ) ; } return expr ;
public class ConfigurationsInner { /** * The configuration object for the specified cluster . This API is not recommended and might be removed in the future . Please consider using List configurations API instead . * @ param resourceGroupName The name of the resource group . * @ param clusterName The name of the cluster . * @ param configurationName The name of the cluster configuration . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < Map < String , String > > getAsync ( String resourceGroupName , String clusterName , String configurationName , final ServiceCallback < Map < String , String > > serviceCallback ) { } }
return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( resourceGroupName , clusterName , configurationName ) , serviceCallback ) ;
public class JSLocalConsumerPoint { /** * Explicity go and look in the CD ' s itemStream for messages and deliver them via the * asynch callback . The asynch lock MUST be held on entry to this method * Each call to this method will process at most _ maxBatchSize messages , then return * @ param isolatedRun if true then drain the queue even if stopped . Should only * be set to true if this the LCP is in a stopped state , otherwise behaviour is undefined * @ throws SIResourceException Thrown if there is a problem in the msgStore * when the session is not in the stopped state * @ throws SISessionDroppedException */ protected JSLocalConsumerPoint processQueuedMsgs ( boolean isolatedRun ) throws SIResourceException , SISessionDroppedException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "processQueuedMsgs" , new Object [ ] { this , Boolean . valueOf ( isolatedRun ) } ) ; JSLocalConsumerPoint actualConsumer = this ; boolean started = true ; _drainQueue = true ; long timeout = INFINITE_WAIT ; if ( isolatedRun ) { timeout = NO_WAIT ; } // need to count the number of messages we get so that we don ' t exceed the maxBatchSize int numOfMsgs = 0 ; // The following value indicates that we are an isolatedRun and that we need to perform // a wait on a message . boolean isolatedWait = false ; _transferredConsumer = null ; // Java doesn ' t like giving up control of a thread once its got it . We repeatedly // take and release the consumer lock here but there may be others trying to stop // us processing the entire queue before we stop . If they are we can at least try // a yield , that may give the JVM the hint . if ( _lockRequested ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Yield requested" ) ; Thread . yield ( ) ; } ConsumableKey attachedKey = null ; // We don ' t hold the LCP lock here ( just like in put ( ) ) but we do hold the asynch lock // so we ' re protected against the keyGroup being unset underneath us if ( ( _keyGroup != null ) ) _keyGroup . lock ( ) ; try { // We need the consumer lock so that we can set the consumer as // ready or not ( and check the close state ) . this . lock ( ) ; // Short held lock - checking / changing state and locking msgs try { // If the consumer has been closed or is currently suspended ( e . g . has hit the // maxActiveMEssage limit ) then don ' t go round again looking for another message . // If we ' re suspended we ' ll be resumed once the reason for suspension has been // sorted . if ( _closed || isSuspended ( ) || ! _asynchConsumerRegistered ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "processQueuedMsgs" , "Closed:" + _closed + " Suspended:" + _consumerSuspended ) ; started = false ; _drainQueue = false ; } // When we ' re counting active messages there ' s a possibility that a runAsynchConsumer // thread will be dispatched due to a resumeConsumer while a producer thread is just // about to attach a message to us ( there is a legit window where the ConsumerDispatcher // can think we ' re ' ready ' even when we ' re not ) . If the attach gets in between the checkin // processAttachedMsgs ( ) ( called just before this ) and here then we ' ve got to realise it // and process the attached message first else { if ( _keyGroup != null ) { // Look for a message attached to the group , but don ' t process them under this lock attachedKey = _keyGroup . getAttachedMember ( ) ; } // When we ' re counting active messages there ' s a possibility that a runAsynchConsumer // thread will be dispatched due to a resumeConsumer while a producer thread is just // about to attach a message to us ( there is a legit window where the ConsumerDispatcher // can think we ' re ' ready ' even when we ' re not ) . If the attach gets in between the checkin // processAttachedMsgs ( ) ( called just before this ) and here then we ' ve got to realise it // and process the attached message first else if ( _msgAttached ) { // Process the attached message , but not under this lock attachedKey = _consumerKey ; // We ' re not in a group so it must be for us } // If we don ' t have an attached message , check the queue if ( ( attachedKey == null ) && _drainQueue ) { numOfMsgs = lockMessages ( isolatedRun ) ; if ( _transferredConsumer != null ) actualConsumer = _transferredConsumer ; // If we get to this point and we ' re still ready then we are basically // waiting for messages to arrive , when remote from the destination the CD // needs to know when we are doing this by us calling waiting ( ) . // As we are an async consumer we will wait indefinitely for a message // NB . This doesn ' t actually cause this thread to wait ! if ( ( _ready && ( _keyGroup == null ) ) || ( _keyGroup != null ) && ( _keyGroup . isGroupReady ( ) ) ) { timeout = _consumerKey . waiting ( timeout , true ) ; isolatedWait = _isolatedRun ; } else if ( _gatherMessages ) // DID get a msg - but need to consider other partitions . . . // If we are a gatherer then we still want to call waiting to perform refills . // Dont want to set the timeout though as this will cause us to wait . _consumerKey . waiting ( timeout , true ) ; } } } // sync finally { this . unlock ( ) ; } } finally { if ( _keyGroup != null ) _keyGroup . unlock ( ) ; } // Now we ' ve released the lock , process the attached message and exit , forcing // runAsynchConsumer to go round the loop again . if ( attachedKey != null ) { // If we found one , process it ( ( JSLocalConsumerPoint ) attachedKey . getConsumerPoint ( ) ) . processAttachedMsgs ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "processQueuedMsgs" , actualConsumer ) ; return ( JSLocalConsumerPoint ) attachedKey . getConsumerPoint ( ) ; } // If the session has been closed but we managed to lock one // or more messages we must have taken the asynchConsumer lock // before the close ( ) method . Therefore , when we release it here // the close ( ) method will eventually aquire it and unlock all // locked messages so we don ' t need to do anything here . // That ' s the theory anyway . if ( started ) { // if we got at least one message if ( ( numOfMsgs > 0 ) && ( actualConsumer == this ) ) { // initiate the callback _asynchConsumer . processMsgs ( _allLockedMessages , _consumerSession ) ; // Clean up the LME _allLockedMessages . resetCallbackCursor ( ) ; // Go back round in case more came in while we were busy if ( ! isolatedRun ) _drainQueue = true ; else _drainQueue = false ; } } // If a message was found on the queue for a different member of the ordering group // we process that message now on the correct consumer . if ( actualConsumer != this ) { actualConsumer . processTransferredMsg ( ) ; } // If we ' re performing a remote or gathering isolated run but failed to find a message // at this ME we need to wait for the request to return from the DME . We do it // here under the asynch lock so that no - one else can try anything else on // this session till we ' ve finished . if ( isolatedWait ) { this . lock ( ) ; try { // It ' s just possible a message arrived before we took this // lock , if so skip the wait . if ( ! _msgAttached ) { // The RCD will have calculated an appropriate period // for this command to take to complete , use that here to // block the thread for at most that period . If a message // is returned in that time this thread will be notified . try { // wait for the specified time if ( timeout == LocalConsumerPoint . INFINITE_WAIT ) _waiter . await ( ) ; else _waiter . await ( timeout , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException e ) { // No FFDC code needed // No message arrived so return null } } // we ' re not ready for any more messages unsetReady ( ) ; // We ' ve finished this isolated run request if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Finished isolatedrun request set to FALSE" ) ; _isolatedRun = false ; } finally { this . unlock ( ) ; } // If we had a message delivered while we were waiting , process it processAttachedMsgs ( ) ; } // After processing messages for this consumer we better check to see // if someone else is waiting for the lock if ( _externalConsumerLock != null ) { // lockMessages ( ) may already have spotted the yield request if ( ! _interruptConsumer ) _interruptConsumer = _externalConsumerLock . isLockYieldRequested ( ) ; } // If we ' re no longer draining the queue ( maybe we ' ve been stopped or // ran out of messages ) indicate this to the caller by returning null if ( ! _drainQueue ) actualConsumer = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "processQueuedMsgs" , actualConsumer ) ; return actualConsumer ;