signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Mockito { /** * Use < code > doThrow ( ) < / code > when you want to stub the void method with an exception .
* A new exception instance will be created for each method invocation .
* Stubbing voids requires different approach from { @ link Mockito # when ( Object ) } because the compiler
* does not like void methods inside brackets . . .
* Example :
* < pre class = " code " > < code class = " java " >
* doThrow ( RuntimeException . class ) . when ( mock ) . someVoidMethod ( ) ;
* < / code > < / pre >
* @ param toBeThrown to be thrown when the stubbed method is called
* @ return stubber - to select a method for stubbing
* @ since 2.1.0 */
@ CheckReturnValue public static Stubber doThrow ( Class < ? extends Throwable > toBeThrown ) { } } | return MOCKITO_CORE . stubber ( ) . doThrow ( toBeThrown ) ; |
public class DefaultKnowledgeHelper { /** * / * Trait helper methods */
public < T , K > T don ( Thing < K > core , Class < T > trait , boolean logical , Mode ... modes ) { } } | return don ( core . getCore ( ) , trait , logical , modes ) ; |
public class ImageLoader { /** * Handler for when an image was successfully loaded .
* @ param cacheKey The cache key that is associated with the image request .
* @ param response The bitmap that was returned from the network . */
protected void onGetImageSuccess ( String cacheKey , Bitmap response ) { } } | // cache the image that was fetched .
imageCache . putBitmap ( cacheKey , response ) ; // remove the request from the list of in - flight requests .
BatchedImageRequest request = inFlightRequests . remove ( cacheKey ) ; if ( request != null ) { // Update the response bitmap .
request . mResponseBitmap = response ; // Send the batched response
batchResponse ( cacheKey , request ) ; } |
public class TimePickerDialog { /** * Get the currently - entered time , as integer values of the hours , minutes and seconds typed .
* @ param enteredZeros A size - 2 boolean array , which the caller should initialize , and which
* may then be used for the caller to know whether zeros had been explicitly entered as either
* hours of minutes . This is helpful for deciding whether to show the dashes , or actual 0 ' s .
* @ return A size - 3 int array . The first value will be the hours , the second value will be the
* minutes , and the third will be either TimePickerDialog . AM or TimePickerDialog . PM . */
@ NonNull private int [ ] getEnteredTime ( @ NonNull Boolean [ ] enteredZeros ) { } } | int amOrPm = - 1 ; int startIndex = 1 ; if ( ! mIs24HourMode && isTypedTimeFullyLegal ( ) ) { int keyCode = mTypedTimes . get ( mTypedTimes . size ( ) - 1 ) ; if ( keyCode == getAmOrPmKeyCode ( AM ) ) { amOrPm = AM ; } else if ( keyCode == getAmOrPmKeyCode ( PM ) ) { amOrPm = PM ; } startIndex = 2 ; } int minute = - 1 ; int hour = - 1 ; int second = 0 ; int shift = mEnableSeconds ? 2 : 0 ; for ( int i = startIndex ; i <= mTypedTimes . size ( ) ; i ++ ) { int val = getValFromKeyCode ( mTypedTimes . get ( mTypedTimes . size ( ) - i ) ) ; if ( mEnableSeconds ) { if ( i == startIndex ) { second = val ; } else if ( i == startIndex + 1 ) { second += 10 * val ; if ( enteredZeros != null && val == 0 ) { enteredZeros [ 2 ] = true ; } } } if ( mEnableMinutes ) { if ( i == startIndex + shift ) { minute = val ; } else if ( i == startIndex + shift + 1 ) { minute += 10 * val ; if ( enteredZeros != null && val == 0 ) { enteredZeros [ 1 ] = true ; } } else if ( i == startIndex + shift + 2 ) { hour = val ; } else if ( i == startIndex + shift + 3 ) { hour += 10 * val ; if ( enteredZeros != null && val == 0 ) { enteredZeros [ 0 ] = true ; } } } else { if ( i == startIndex + shift ) { hour = val ; } else if ( i == startIndex + shift + 1 ) { hour += 10 * val ; if ( enteredZeros != null && val == 0 ) { enteredZeros [ 0 ] = true ; } } } } return new int [ ] { hour , minute , second , amOrPm } ; |
public class MultipartHttpMessageConverter { /** * Add a message body converter . Such a converter is used to convert objects
* to MIME parts . */
public void addPartConverter ( HttpMessageConverter partConverter ) { } } | checkNotNull ( partConverters , "'partConverters' must not be null" ) ; checkArgument ( ! partConverters . isEmpty ( ) , "'partConverters' must not be empty" ) ; this . partConverters . add ( partConverter ) ; |
public class ObjectArrayList { /** * Returns a new list of the part of the receiver between < code > from < / code > , inclusive , and < code > to < / code > , inclusive .
* @ param from the index of the first element ( inclusive ) .
* @ param to the index of the last element ( inclusive ) .
* @ return a new list
* @ exception IndexOutOfBoundsException index is out of range ( < tt > size ( ) & gt ; 0 & & ( from & lt ; 0 | | from & gt ; to | | to & gt ; = size ( ) ) < / tt > ) . */
public ObjectArrayList partFromTo ( int from , int to ) { } } | if ( size == 0 ) return new ObjectArrayList ( 0 ) ; checkRangeFromTo ( from , to , size ) ; Object [ ] part = new Object [ to - from + 1 ] ; System . arraycopy ( elements , from , part , 0 , to - from + 1 ) ; return new ObjectArrayList ( part ) ; |
public class JvmOptionsElement { /** * Adds an option to the Jvm options
* @ param value the option to add */
void addOption ( final String value ) { } } | Assert . checkNotNullParam ( "value" , value ) ; synchronized ( options ) { options . add ( value ) ; } |
public class PCMUtil { /** * A helper method to get a PCMContainer from a CSV file ( limited in a sense we only retrieve the 1st element of containers )
* @ param file
* @ return
* @ throws IOException */
public static List < PCMContainer > loadCSV ( File file ) throws IOException { } } | return loadCSV ( file , PCMDirection . PRODUCTS_AS_LINES ) ; |
public class rewritepolicy_stats { /** * Use this API to fetch the statistics of all rewritepolicy _ stats resources that are configured on netscaler . */
public static rewritepolicy_stats [ ] get ( nitro_service service , options option ) throws Exception { } } | rewritepolicy_stats obj = new rewritepolicy_stats ( ) ; rewritepolicy_stats [ ] response = ( rewritepolicy_stats [ ] ) obj . stat_resources ( service , option ) ; return response ; |
public class WDropdownOptionsExample { /** * Apply the settings from the control table to the drop down . */
private void applySettings ( ) { } } | container . reset ( ) ; infoPanel . reset ( ) ; // create the list of options .
List < String > options = new ArrayList < > ( Arrays . asList ( OPTIONS_ARRAY ) ) ; if ( cbNullOption . isSelected ( ) ) { options . add ( 0 , "" ) ; } // create the dropdown .
final WDropdown dropdown = new WDropdown ( options ) ; // set the dropdown type .
dropdown . setType ( ( DropdownType ) rbsDDType . getSelected ( ) ) ; // set the selected option if applicable .
String selected = ( String ) rgDefaultOption . getSelected ( ) ; if ( selected != null && ! NONE . equals ( selected ) ) { dropdown . setSelected ( selected ) ; } // set the width .
if ( nfWidth . getValue ( ) != null ) { dropdown . setOptionWidth ( nfWidth . getValue ( ) . intValue ( ) ) ; } // set the tool tip .
if ( tfToolTip . getText ( ) != null && tfToolTip . getText ( ) . length ( ) > 0 ) { dropdown . setToolTip ( tfToolTip . getText ( ) ) ; } // set misc options .
dropdown . setVisible ( cbVisible . isSelected ( ) ) ; dropdown . setDisabled ( cbDisabled . isSelected ( ) ) ; // add the action for action on change , ajax and subordinate .
if ( cbActionOnChange . isSelected ( ) || cbAjax . isSelected ( ) || cbSubmitOnChange . isSelected ( ) ) { final WStyledText info = new WStyledText ( ) ; info . setWhitespaceMode ( WhitespaceMode . PRESERVE ) ; infoPanel . add ( info ) ; dropdown . setActionOnChange ( new Action ( ) { @ Override public void execute ( final ActionEvent event ) { String selectedOption = ( String ) dropdown . getSelected ( ) ; info . setText ( selectedOption ) ; } } ) ; } // this has to be below the set action on change so it is
// not over written .
dropdown . setSubmitOnChange ( cbSubmitOnChange . isSelected ( ) ) ; // add the ajax target .
if ( cbAjax . isSelected ( ) ) { WAjaxControl update = new WAjaxControl ( dropdown ) ; update . addTarget ( infoPanel ) ; container . add ( update ) ; } // add the subordinate stuff .
if ( rbsDDType . getValue ( ) == WDropdown . DropdownType . COMBO ) { // This is to work around a WComponent Subordinate logic flaw .
cbSubordinate . setSelected ( false ) ; } if ( cbSubordinate . isSelected ( ) ) { WComponentGroup < SubordinateTarget > group = new WComponentGroup < > ( ) ; container . add ( group ) ; WSubordinateControl control = new WSubordinateControl ( ) ; container . add ( control ) ; for ( String option : OPTIONS_ARRAY ) { buildSubordinatePanel ( dropdown , option , group , control ) ; } // add a rule for none selected .
Rule rule = new Rule ( ) ; control . addRule ( rule ) ; rule . setCondition ( new Equal ( dropdown , "" ) ) ; rule . addActionOnTrue ( new Hide ( group ) ) ; } WFieldLayout flay = new WFieldLayout ( ) ; flay . setLabelWidth ( 25 ) ; container . add ( flay ) ; flay . addField ( "Configured dropdown" , dropdown ) ; flay . addField ( ( WLabel ) null , new WButton ( "Submit" ) ) ; |
public class DatabaseUtils { /** * Partition by 1000 elements a list of input and execute a function on each part .
* The goal is to prevent issue with ORACLE when there ' s more than 1000 elements in a ' in ( ' X ' , ' Y ' , . . . ) '
* and with MsSQL when there ' s more than 2000 parameters in a query */
public static < OUTPUT , INPUT extends Comparable < INPUT > > List < OUTPUT > executeLargeInputs ( Collection < INPUT > input , Function < List < INPUT > , List < OUTPUT > > function ) { } } | return executeLargeInputs ( input , function , i -> i ) ; |
public class MCMPHandler { /** * Process the ping request .
* @ param exchange the http server exchange
* @ param requestData the request data
* @ throws IOException */
void processPing ( final HttpServerExchange exchange , final RequestData requestData ) throws IOException { } } | final String jvmRoute = requestData . getFirst ( JVMROUTE ) ; final String scheme = requestData . getFirst ( SCHEME ) ; final String host = requestData . getFirst ( HOST ) ; final String port = requestData . getFirst ( PORT ) ; final String OK = "Type=PING-RSP&State=OK&id=" + creationTime ; final String NOTOK = "Type=PING-RSP&State=NOTOK&id=" + creationTime ; if ( jvmRoute != null ) { // ping the corresponding node .
final Node nodeConfig = container . getNode ( jvmRoute ) ; if ( nodeConfig == null ) { sendResponse ( exchange , NOTOK ) ; return ; } final NodePingUtil . PingCallback callback = new NodePingUtil . PingCallback ( ) { @ Override public void completed ( ) { try { sendResponse ( exchange , OK ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } @ Override public void failed ( ) { try { nodeConfig . markInError ( ) ; sendResponse ( exchange , NOTOK ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } ; nodeConfig . ping ( exchange , callback ) ; } else { if ( scheme == null && host == null && port == null ) { sendResponse ( exchange , OK ) ; return ; } else { if ( host == null || port == null ) { processError ( TYPESYNTAX , SMISFLD , exchange ) ; return ; } // Check whether we can reach the host
checkHostUp ( scheme , host , Integer . parseInt ( port ) , exchange , new NodePingUtil . PingCallback ( ) { @ Override public void completed ( ) { sendResponse ( exchange , OK ) ; } @ Override public void failed ( ) { sendResponse ( exchange , NOTOK ) ; } } ) ; return ; } } |
public class TreeNode { /** * Recursively sorts all children using the given comparator of their content . */
public void sortChildrenByContent ( Comparator < ? super T > comparator ) { } } | Comparator < TreeNode < T > > byContent = Comparator . comparing ( TreeNode :: getContent , comparator ) ; sortChildrenByNode ( byContent ) ; |
public class ListDataValueImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < DataValue > getValues ( ) { } } | return ( EList < DataValue > ) eGet ( StorePackage . Literals . LIST_DATA_VALUE__VALUES , true ) ; |
public class HTODInvalidationBuffer { /** * Call this method to check the state of " Loop Once " .
* @ return boolean - the state . */
protected synchronized boolean isLoopOnce ( ) { } } | final String methodName = "isLoopOnce()" ; if ( loopOnce ) { traceDebug ( methodName , "cacheName=" + this . cod . cacheName + " isLoopOnce=" + loopOnce + " explicitBuffer=" + explicitBuffer . size ( ) + " scanBuffer=" + this . scanBuffer . size ( ) ) ; } return this . loopOnce ; |
public class JaxbUtils { /** * Xml - > Java Object , 支持大小写敏感或不敏感 . */
@ SuppressWarnings ( "unchecked" ) public < T > T fromXml ( String xml , boolean caseSensitive ) { } } | try { String fromXml = xml ; if ( ! caseSensitive ) fromXml = xml . toLowerCase ( ) ; StringReader reader = new StringReader ( fromXml ) ; return ( T ) createUnmarshaller ( ) . unmarshal ( reader ) ; } catch ( JAXBException e ) { throw new RuntimeException ( e ) ; } |
public class FairSchedulerServlet { /** * Obtained all initialized jobs */
private Collection < JobInProgress > getInitedJobs ( ) { } } | Collection < JobInProgress > runningJobs = jobTracker . getRunningJobs ( ) ; for ( Iterator < JobInProgress > it = runningJobs . iterator ( ) ; it . hasNext ( ) ; ) { JobInProgress job = it . next ( ) ; if ( ! job . inited ( ) ) { it . remove ( ) ; } } return runningJobs ; |
public class QueryParser { /** * src / riemann / Query . g : 61:1 : greater _ equal : field ( WS ) * GREATER _ EQUAL ( WS ) * value ; */
public final QueryParser . greater_equal_return greater_equal ( ) throws RecognitionException { } } | QueryParser . greater_equal_return retval = new QueryParser . greater_equal_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; Token WS61 = null ; Token GREATER_EQUAL62 = null ; Token WS63 = null ; QueryParser . field_return field60 = null ; QueryParser . value_return value64 = null ; CommonTree WS61_tree = null ; CommonTree GREATER_EQUAL62_tree = null ; CommonTree WS63_tree = null ; try { // src / riemann / Query . g : 62:2 : ( field ( WS ) * GREATER _ EQUAL ( WS ) * value )
// src / riemann / Query . g : 62:4 : field ( WS ) * GREATER _ EQUAL ( WS ) * value
{ root_0 = ( CommonTree ) adaptor . nil ( ) ; pushFollow ( FOLLOW_field_in_greater_equal450 ) ; field60 = field ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , field60 . getTree ( ) ) ; // src / riemann / Query . g : 62:10 : ( WS ) *
loop23 : do { int alt23 = 2 ; int LA23_0 = input . LA ( 1 ) ; if ( ( LA23_0 == WS ) ) { alt23 = 1 ; } switch ( alt23 ) { case 1 : // src / riemann / Query . g : 62:10 : WS
{ WS61 = ( Token ) match ( input , WS , FOLLOW_WS_in_greater_equal452 ) ; WS61_tree = ( CommonTree ) adaptor . create ( WS61 ) ; adaptor . addChild ( root_0 , WS61_tree ) ; } break ; default : break loop23 ; } } while ( true ) ; GREATER_EQUAL62 = ( Token ) match ( input , GREATER_EQUAL , FOLLOW_GREATER_EQUAL_in_greater_equal455 ) ; GREATER_EQUAL62_tree = ( CommonTree ) adaptor . create ( GREATER_EQUAL62 ) ; root_0 = ( CommonTree ) adaptor . becomeRoot ( GREATER_EQUAL62_tree , root_0 ) ; // src / riemann / Query . g : 62:29 : ( WS ) *
loop24 : do { int alt24 = 2 ; int LA24_0 = input . LA ( 1 ) ; if ( ( LA24_0 == WS ) ) { alt24 = 1 ; } switch ( alt24 ) { case 1 : // src / riemann / Query . g : 62:29 : WS
{ WS63 = ( Token ) match ( input , WS , FOLLOW_WS_in_greater_equal458 ) ; WS63_tree = ( CommonTree ) adaptor . create ( WS63 ) ; adaptor . addChild ( root_0 , WS63_tree ) ; } break ; default : break loop24 ; } } while ( true ) ; pushFollow ( FOLLOW_value_in_greater_equal461 ) ; value64 = value ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , value64 . getTree ( ) ) ; } retval . stop = input . LT ( - 1 ) ; retval . tree = ( CommonTree ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( CommonTree ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { } return retval ; |
public class HtmlDocletWriter { /** * Return the link for the given member .
* @ param context the id of the context where the link will be printed .
* @ param typeElement the typeElement that we should link to . This is not
* necessarily equal to element . containingClass ( ) . We may be
* inheriting comments .
* @ param element the member being linked to .
* @ param label the label for the link .
* @ param strong true if the link should be strong .
* @ return the link for the given member . */
public Content getDocLink ( LinkInfoImpl . Kind context , TypeElement typeElement , Element element , CharSequence label , boolean strong ) { } } | return getDocLink ( context , typeElement , element , label , strong , false ) ; |
public class JobsImpl { /** * Terminates the specified job , marking it as completed .
* When a Terminate Job request is received , the Batch service sets the job to the terminating state . The Batch service then terminates any running tasks associated with the job and runs any required job release tasks . Then the job moves into the completed state . If there are any tasks in the job in the active state , they will remain in the active state . Once a job is terminated , new tasks cannot be added and any remaining active tasks will not be scheduled .
* @ param jobId The ID of the job to terminate .
* @ param terminateReason The text you want to appear as the job ' s TerminateReason . The default is ' UserTerminate ' .
* @ param jobTerminateOptions Additional parameters for the operation
* @ 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 < Void > terminateAsync ( String jobId , String terminateReason , JobTerminateOptions jobTerminateOptions , final ServiceCallback < Void > serviceCallback ) { } } | return ServiceFuture . fromHeaderResponse ( terminateWithServiceResponseAsync ( jobId , terminateReason , jobTerminateOptions ) , serviceCallback ) ; |
public class BatchEnableStandardsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BatchEnableStandardsRequest batchEnableStandardsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( batchEnableStandardsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( batchEnableStandardsRequest . getStandardsSubscriptionRequests ( ) , STANDARDSSUBSCRIPTIONREQUESTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AmazonSimpleEmailServiceClient { /** * Creates a new custom verification email template .
* For more information about custom verification email templates , see < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / custom - verification - emails . html " > Using Custom
* Verification Email Templates < / a > in the < i > Amazon SES Developer Guide < / i > .
* You can execute this operation no more than once per second .
* @ param createCustomVerificationEmailTemplateRequest
* Represents a request to create a custom verification email template .
* @ return Result of the CreateCustomVerificationEmailTemplate operation returned by the service .
* @ throws CustomVerificationEmailTemplateAlreadyExistsException
* Indicates that a custom verification email template with the name you specified already exists .
* @ throws FromEmailAddressNotVerifiedException
* Indicates that the sender address specified for a custom verification email is not verified , and is
* therefore not eligible to send the custom verification email .
* @ throws CustomVerificationEmailInvalidContentException
* Indicates that custom verification email template provided content is invalid .
* @ throws LimitExceededException
* Indicates that a resource could not be created because of service limits . For a list of Amazon SES
* limits , see the < a href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / limits . html " > Amazon SES
* Developer Guide < / a > .
* @ sample AmazonSimpleEmailService . CreateCustomVerificationEmailTemplate
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / email - 2010-12-01 / CreateCustomVerificationEmailTemplate "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public CreateCustomVerificationEmailTemplateResult createCustomVerificationEmailTemplate ( CreateCustomVerificationEmailTemplateRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeCreateCustomVerificationEmailTemplate ( request ) ; |
public class CreateAssociationRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateAssociationRequest createAssociationRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createAssociationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createAssociationRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createAssociationRequest . getDocumentVersion ( ) , DOCUMENTVERSION_BINDING ) ; protocolMarshaller . marshall ( createAssociationRequest . getInstanceId ( ) , INSTANCEID_BINDING ) ; protocolMarshaller . marshall ( createAssociationRequest . getParameters ( ) , PARAMETERS_BINDING ) ; protocolMarshaller . marshall ( createAssociationRequest . getTargets ( ) , TARGETS_BINDING ) ; protocolMarshaller . marshall ( createAssociationRequest . getScheduleExpression ( ) , SCHEDULEEXPRESSION_BINDING ) ; protocolMarshaller . marshall ( createAssociationRequest . getOutputLocation ( ) , OUTPUTLOCATION_BINDING ) ; protocolMarshaller . marshall ( createAssociationRequest . getAssociationName ( ) , ASSOCIATIONNAME_BINDING ) ; protocolMarshaller . marshall ( createAssociationRequest . getAutomationTargetParameterName ( ) , AUTOMATIONTARGETPARAMETERNAME_BINDING ) ; protocolMarshaller . marshall ( createAssociationRequest . getMaxErrors ( ) , MAXERRORS_BINDING ) ; protocolMarshaller . marshall ( createAssociationRequest . getMaxConcurrency ( ) , MAXCONCURRENCY_BINDING ) ; protocolMarshaller . marshall ( createAssociationRequest . getComplianceSeverity ( ) , COMPLIANCESEVERITY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Equ { /** * showRPN .
* @ param sb a { @ link java . lang . StringBuilder } object .
* @ throws java . lang . Exception if any . */
public void showRPN ( final StringBuilder sb ) throws Exception { } } | for ( final EquPart part : rpn ) { sb . append ( part . toString ( ) ) ; sb . append ( "\n" ) ; } |
public class XElement { /** * Save this XML into the given file .
* @ param file the file
* @ throws IOException on error */
public void save ( File file ) throws IOException { } } | try ( FileOutputStream out = new FileOutputStream ( file ) ) { save ( out ) ; } |
public class CommandLine { /** * Add an option requiring an argument .
* @ param option
* the option , must start with " - "
* @ param argumentDesc
* brief ( one or two word ) description of the argument
* @ param description
* single line description of the option */
public void addOption ( String option , String argumentDesc , String description ) { } } | optionList . add ( option ) ; optionDescriptionMap . put ( option , description ) ; requiresArgumentSet . add ( option ) ; argumentDescriptionMap . put ( option , argumentDesc ) ; int width = option . length ( ) + 3 + argumentDesc . length ( ) ; if ( width > maxWidth ) { maxWidth = width ; } |
public class Distributer { /** * Set up partitions .
* @ param topologyUpdate if true , it is called from topology update
* @ throws ProcCallException on any VoltDB specific failure .
* @ throws NoConnectionsException if this { @ link Client } instance is not connected to any servers .
* @ throws IOException if there is a Java network or connection problem . */
private void refreshPartitionKeys ( boolean topologyUpdate ) { } } | long interval = System . currentTimeMillis ( ) - m_lastPartitionKeyFetched . get ( ) ; if ( ! m_useClientAffinity && interval < PARTITION_KEYS_INFO_REFRESH_FREQUENCY ) { return ; } try { ProcedureInvocation invocation = new ProcedureInvocation ( m_sysHandle . getAndDecrement ( ) , "@GetPartitionKeys" , "INTEGER" ) ; CountDownLatch latch = null ; if ( ! topologyUpdate ) { latch = new CountDownLatch ( 1 ) ; } PartitionUpdateCallback cb = new PartitionUpdateCallback ( latch ) ; if ( ! queue ( invocation , cb , true , System . nanoTime ( ) , USE_DEFAULT_CLIENT_TIMEOUT ) ) { m_partitionUpdateStatus . set ( new ClientResponseImpl ( ClientResponseImpl . SERVER_UNAVAILABLE , new VoltTable [ 0 ] , "Fails to queue the partition update query, please try later." ) ) ; } if ( ! topologyUpdate ) { latch . await ( ) ; } m_lastPartitionKeyFetched . set ( System . currentTimeMillis ( ) ) ; } catch ( InterruptedException | IOException e ) { m_partitionUpdateStatus . set ( new ClientResponseImpl ( ClientResponseImpl . SERVER_UNAVAILABLE , new VoltTable [ 0 ] , "Fails to fetch partition keys from server:" + e . getMessage ( ) ) ) ; } |
public class Indexer { /** * Returns a new string that is a substring of delegate string
* @ param leftIndex
* @ param rightIndex
* @ return */
public String between ( int leftIndex , int rightIndex ) { } } | String result = this . target4Sub . substring ( reviseL ( leftIndex ) , reviseR ( rightIndex ) ) ; return isResetMode ? result : ( this . target4Sub = result ) ; |
public class HashedArray { /** * Get an element from the array */
synchronized public Element get ( long index ) { } } | int bind = ( ( int ) index & Integer . MAX_VALUE ) % buckets . length ; Element [ ] bucket = buckets [ bind ] ; if ( bucket == null ) return null ; for ( int i = 0 ; i < counts [ bind ] ; i ++ ) if ( bucket [ i ] . getIndex ( ) == index ) return bucket [ i ] ; return null ; |
public class ShapeFittingOps { /** * Convenience function . Same as { @ link # fitEllipse _ F64 ( java . util . List , int , boolean , FitData ) } , but converts the set of integer points
* into floating point points .
* @ param points ( Input ) Set of unordered points . Not modified .
* @ param iterations Number of iterations used to refine the fit . If set to zero then an algebraic solution
* is returned .
* @ param computeError If true it will compute the average Euclidean distance error
* @ param outputStorage ( Output / Optional ) Storage for the ellipse . Can be null
* @ return Found ellipse . */
public static FitData < EllipseRotated_F64 > fitEllipse_I32 ( List < Point2D_I32 > points , int iterations , boolean computeError , FitData < EllipseRotated_F64 > outputStorage ) { } } | List < Point2D_F64 > pointsF = convert_I32_F64 ( points ) ; return fitEllipse_F64 ( pointsF , iterations , computeError , outputStorage ) ; |
public class WTab { /** * Set the mode of operation for this tab . See
* < a href = " https : / / github . com / BorderTech / wcomponents / issues / 692 " > # 692 < / a > .
* @ param mode the tab mode . */
public void setMode ( final TabMode mode ) { } } | getOrCreateComponentModel ( ) . mode = TabMode . SERVER . equals ( mode ) ? TabMode . DYNAMIC : mode ; |
public class QRExampleEquation { /** * Returns the Q matrix . */
public DMatrixRMaj getQ ( ) { } } | Equation eq = new Equation ( ) ; DMatrixRMaj Q = CommonOps_DDRM . identity ( QR . numRows ) ; DMatrixRMaj u = new DMatrixRMaj ( QR . numRows , 1 ) ; int N = Math . min ( QR . numCols , QR . numRows ) ; eq . alias ( u , "u" , Q , "Q" , QR , "QR" , QR . numRows , "r" ) ; // compute Q by first extracting the householder vectors from the columns of QR and then applying it to Q
for ( int j = N - 1 ; j >= 0 ; j -- ) { eq . alias ( j , "j" , gammas [ j ] , "gamma" ) ; eq . process ( "u(j:,0) = [1 ; QR((j+1):,j)]" ) ; eq . process ( "Q=(eye(r)-gamma*u*u')*Q" ) ; } return Q ; |
public class DualPivotQuicksort { /** * Sorts the specified range of the array using the given
* workspace array slice if possible for merging
* @ param a the array to be sorted
* @ param left the index of the first element , inclusive , to be sorted
* @ param right the index of the last element , inclusive , to be sorted
* @ param work a workspace array ( slice )
* @ param workBase origin of usable space in work array
* @ param workLen usable size of work array */
static void sort ( float [ ] a , int left , int right , float [ ] work , int workBase , int workLen ) { } } | /* * Phase 1 : Move NaNs to the end of the array . */
while ( left <= right && Float . isNaN ( a [ right ] ) ) { -- right ; } for ( int k = right ; -- k >= left ; ) { float ak = a [ k ] ; if ( ak != ak ) { // a [ k ] is NaN
a [ k ] = a [ right ] ; a [ right ] = ak ; -- right ; } } /* * Phase 2 : Sort everything except NaNs ( which are already in place ) . */
doSort ( a , left , right , work , workBase , workLen ) ; /* * Phase 3 : Place negative zeros before positive zeros . */
int hi = right ; /* * Find the first zero , or first positive , or last negative element . */
while ( left < hi ) { int middle = ( left + hi ) >>> 1 ; float middleValue = a [ middle ] ; if ( middleValue < 0.0f ) { left = middle + 1 ; } else { hi = middle ; } } /* * Skip the last negative value ( if any ) or all leading negative zeros . */
while ( left <= right && Float . floatToRawIntBits ( a [ left ] ) < 0 ) { ++ left ; } /* * Move negative zeros to the beginning of the sub - range .
* Partitioning :
* | < 0.0 | - 0.0 | 0.0 | ? ( > = 0.0 ) |
* left p k
* Invariants :
* all in ( * , left ) < 0.0
* all in [ left , p ) = = - 0.0
* all in [ p , k ) = = 0.0
* all in [ k , right ] > = 0.0
* Pointer k is the first index of ? - part . */
for ( int k = left , p = left - 1 ; ++ k <= right ; ) { float ak = a [ k ] ; if ( ak != 0.0f ) { break ; } if ( Float . floatToRawIntBits ( ak ) < 0 ) { // ak is - 0.0f
a [ k ] = 0.0f ; a [ ++ p ] = - 0.0f ; } } |
public class UpgradeObjectDatanode { /** * Specifies what to do before the upgrade is started .
* The default implementation checks whether the data - node missed the upgrade
* and throws an exception if it did . This leads to the data - node shutdown .
* Data - nodes usually start distributed upgrade when the name - node replies
* to its heartbeat with a start upgrade command .
* Sometimes though , e . g . when a data - node missed the upgrade and wants to
* catchup with the rest of the cluster , it is necessary to initiate the
* upgrade directly on the data - node , since the name - node might not ever
* start it . An override of this method should then return true .
* And the upgrade will start after data - ndoe registration but before sending
* its first heartbeat .
* @ param nsInfo name - node versions , verify that the upgrade
* object can talk to this name - node version if necessary .
* @ throws IOException
* @ return true if data - node itself should start the upgrade or
* false if it should wait until the name - node starts the upgrade . */
boolean preUpgradeAction ( NamespaceInfo nsInfo ) throws IOException { } } | int nsUpgradeVersion = nsInfo . getDistributedUpgradeVersion ( ) ; if ( nsUpgradeVersion >= getVersion ( ) ) return false ; // name - node will perform the upgrade
// Missed the upgrade . Report problem to the name - node and throw exception
String errorMsg = "\n Data-node missed a distributed upgrade and will shutdown." + "\n " + getDescription ( ) + "." + " Name-node version = " + nsInfo . getLayoutVersion ( ) + "." ; DataNode . LOG . fatal ( errorMsg ) ; try { dataNode . getNSNamenode ( nsInfo . getNamespaceID ( ) ) . errorReport ( dataNode . getDNRegistrationForNS ( nsInfo . getNamespaceID ( ) ) , DatanodeProtocol . NOTIFY , errorMsg ) ; } catch ( SocketTimeoutException e ) { // namenode is busy
DataNode . LOG . info ( "Problem connecting to server: " + dataNode . getNSNamenode ( nsInfo . getNamespaceID ( ) ) . toString ( ) ) ; } throw new IOException ( errorMsg ) ; |
public class FlowConfigResourceLocalHandler { /** * Delete flowConfig locally and trigger all listeners */
public UpdateResponse deleteFlowConfig ( FlowId flowId , Properties header ) throws FlowConfigLoggedException { } } | return deleteFlowConfig ( flowId , header , true ) ; |
public class BuyerRfp { /** * Sets the adExchangeEnvironment value for this BuyerRfp .
* @ param adExchangeEnvironment * Identifies the format of the inventory or " channel " through
* which the ad serves . Environments
* currently supported include { @ link AdExchangeEnvironment # DISPLAY } ,
* { @ link AdExchangeEnvironment # VIDEO } , and { @ link AdExchangeEnvironment # MOBILE } .
* < span class = " constraint ReadOnly " > This attribute is read - only when : < ul > < li > using
* programmatic guaranteed , not using sales management . < / li > < li > using
* preferred deals , not using sales management . < / li > < / ul > < / span > */
public void setAdExchangeEnvironment ( com . google . api . ads . admanager . axis . v201902 . AdExchangeEnvironment adExchangeEnvironment ) { } } | this . adExchangeEnvironment = adExchangeEnvironment ; |
public class Authentication { /** * Logs the user out .
* @ param callback
* A possible callback to be executed when the logout has been done ( successfully or not ) . Can be null . */
public void logout ( final BooleanCallback callback ) { } } | GwtCommand command = new GwtCommand ( logoutCommandName ) ; GwtCommandDispatcher . getInstance ( ) . execute ( command , new AbstractCommandCallback < SuccessCommandResponse > ( ) { public void execute ( SuccessCommandResponse response ) { if ( response . isSuccess ( ) ) { userToken = null ; Authentication . this . userId = null ; if ( callback != null ) { callback . execute ( true ) ; } GwtCommandDispatcher . getInstance ( ) . logout ( ) ; manager . fireEvent ( new LogoutSuccessEvent ( ) ) ; } else { if ( callback != null ) { callback . execute ( false ) ; } manager . fireEvent ( new LogoutFailureEvent ( ) ) ; } } } ) ; |
public class MessageFormat { /** * Returns the part index of the next ARG _ START after partIndex , or - 1 if there is none more .
* @ param partIndex Part index of the previous ARG _ START ( initially 0 ) . */
private int nextTopLevelArgStart ( int partIndex ) { } } | if ( partIndex != 0 ) { partIndex = msgPattern . getLimitPartIndex ( partIndex ) ; } for ( ; ; ) { MessagePattern . Part . Type type = msgPattern . getPartType ( ++ partIndex ) ; if ( type == MessagePattern . Part . Type . ARG_START ) { return partIndex ; } if ( type == MessagePattern . Part . Type . MSG_LIMIT ) { return - 1 ; } } |
public class WidgetsUtils { /** * Test if the tag name of the element is one of tag names given in parameter .
* @ param tagNames
* @ return */
public static boolean matchesTags ( Element e , String ... tagNames ) { } } | assert e != null : "Element cannot be null" ; StringBuilder regExp = new StringBuilder ( "^(" ) ; int tagNameLenght = tagNames != null ? tagNames . length : 0 ; for ( int i = 0 ; i < tagNameLenght ; i ++ ) { regExp . append ( tagNames [ i ] . toUpperCase ( ) ) ; if ( i < tagNameLenght - 1 ) { regExp . append ( "|" ) ; } } regExp . append ( ")$" ) ; return e . getTagName ( ) . toUpperCase ( ) . matches ( regExp . toString ( ) ) ; |
public class Preconditions { /** * A { @ code long } specialized version of { @ link # checkPreconditions ( Object ,
* ContractConditionType [ ] ) }
* @ param value The value
* @ param conditions The conditions the value must obey
* @ return value
* @ throws PreconditionViolationException If any of the conditions are false */
public static long checkPreconditionsL ( final long value , final ContractLongConditionType ... conditions ) throws PreconditionViolationException { } } | final Violations violations = innerCheckAllLong ( value , conditions ) ; if ( violations != null ) { throw new PreconditionViolationException ( failedMessage ( Long . valueOf ( value ) , violations ) , null , violations . count ( ) ) ; } return value ; |
public class Channel { /** * query for chain information
* @ param peer The peer to send the request to
* @ param userContext the user context to use .
* @ return a { @ link BlockchainInfo } object containing the chain info requested
* @ throws InvalidArgumentException
* @ throws ProposalException */
public BlockchainInfo queryBlockchainInfo ( Peer peer , User userContext ) throws ProposalException , InvalidArgumentException { } } | return queryBlockchainInfo ( Collections . singleton ( peer ) , userContext ) ; |
public class SeekBarPreference { /** * Sets the step size , the value should be increased or decreased by , when moving the seek bar .
* @ param stepSize
* The step size , which should be set , as an { @ link Integer } value . The value must be at
* least 1 and at maximum the value of the method < code > getRange ( ) : int < / code > or - 1 , if
* the preference should allow to select a value from a continuous range */
public final void setStepSize ( final int stepSize ) { } } | if ( stepSize != - 1 ) { Condition . INSTANCE . ensureAtLeast ( stepSize , 1 , "The step size must be at least 1" ) ; Condition . INSTANCE . ensureAtMaximum ( stepSize , getRange ( ) , "The step size must be at maximum the range" ) ; } this . stepSize = stepSize ; setValue ( adaptToStepSize ( getValue ( ) ) ) ; |
public class TLSEnabledSocketHandler { /** * / * ( non - Javadoc )
* @ see org . openhealthtools . ihe . atna . nodeauth . handlers . AbstractSecureSocketHandler # createSecureSocket ( java . lang . String , int , org . openhealthtools . ihe . atna . nodeauth . SecurityDomain ) */
protected SSLSocket createSecureSocket ( String host , int port , SecurityDomain securityDomain , Socket nestedSocket ) throws NoSecurityDomainException , NoSuchAlgorithmException , KeyManagementException , UnknownHostException , IOException { } } | if ( ! CONTEXT . isTLSEnabled ( ) ) throw new NoSuchAlgorithmException ( "TLS has been disabled for ATNA connections via " + SecurityDomainManager . class . getName ( ) + ".setSetTLSEnabled(false)" ) ; SSLContext ctx = null ; // Attempt to get an instance of the first support TLS protocol
try { ctx = SSLContext . getInstance ( securityDomain . getJdkTlsClientProtocols ( ) [ 0 ] ) ; } catch ( NoSuchAlgorithmException e ) { securityDomain . restoreSystemEnvironment ( ) ; throw e ; } // Initialize the instance for the key and trust stores
try { KeyManager [ ] keyMgrs = securityDomain . getKeyManagers ( ) ; TrustManager [ ] trustMgrs = securityDomain . getTrustManagers ( ) ; ctx . init ( keyMgrs , trustMgrs , null ) ; } catch ( KeyManagementException e ) { throw e ; } SSLSocketFactory factory = ctx . getSocketFactory ( ) ; SSLSocket socket = null ; if ( logger . isDebugEnabled ( ) ) { String [ ] supportedSuites = factory . getSupportedCipherSuites ( ) ; logger . debug ( "\n\nSupported cipher suites are:" ) ; for ( int i = 0 ; i < supportedSuites . length ; i ++ ) { logger . debug ( "\t" + supportedSuites [ i ] ) ; } } int retries = 0 ; Throwable cause = null ; // Loop to get a connection or until we ' ve exhausted number of retries
while ( retries < CONTEXT . getConfig ( ) . getSocketRetries ( ) ) { try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Connecting to " + host + " on port " + port + " (timeout: " + CONTEXT . getConfig ( ) . getConnectTimeout ( ) + " ms) using factory " + factory . getClass ( ) . getName ( ) ) ; } // SocketAddress address = new InetSocketAddress ( host , port ) ;
if ( nestedSocket instanceof Socket ) { socket = ( SSLSocket ) ( factory . createSocket ( nestedSocket , host , port , true ) ) ; } else { socket = ( SSLSocket ) ( factory . createSocket ( host , port ) ) ; } // socket . connect ( address , CONTEXT . getConfig ( ) . getConnectTimeout ( ) ) ;
// Set amount of time to wait on socket read before timing out
socket . setSoTimeout ( CONTEXT . getConfig ( ) . getSocketTimeout ( ) ) ; socket . setKeepAlive ( true ) ; socket . setEnabledProtocols ( securityDomain . getJdkTlsClientProtocols ( ) ) ; socket . setEnabledCipherSuites ( securityDomain . getCipherSuites ( ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "\n\nEnabled Cipher suites for connection are: " ) ; String [ ] suites = socket . getEnabledCipherSuites ( ) ; for ( int i = 0 ; i < suites . length ; i ++ ) { logger . debug ( "\t" + suites [ i ] ) ; } } // Force the TLS handshake at this point so we can catch any authentication errors
socket . startHandshake ( ) ; break ; } catch ( SSLHandshakeException e ) { logger . error ( "Handshake failed with server " + host + " on port " + port + " reason " + e . getLocalizedMessage ( ) , e ) ; try { socket . close ( ) ; } catch ( IOException e1 ) { logger . error ( "Error trying to close socket for " + host + " on port " + port + " reason " + e1 . getLocalizedMessage ( ) , e1 ) ; } // securityDomain . restoreSystemEnvironment ( ) ;
throw e ; } catch ( UnknownHostException e ) { logger . error ( "Unable to establish connection to " + host + " on port " + port + " reason " + e . getLocalizedMessage ( ) , e ) ; // securityDomain . restoreSystemEnvironment ( ) ;
throw e ; } catch ( SocketException e ) { logger . error ( "Error connecting to " + host + " on port " + port + ". Will retry in " + CONTEXT . getConfig ( ) . getSocketRetryWait ( ) / 1000 + " seconds." , e ) ; retries ++ ; cause = e ; try { Thread . sleep ( CONTEXT . getConfig ( ) . getSocketRetryWait ( ) ) ; continue ; } catch ( InterruptedException ie ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Sleep awoken early" ) ; } continue ; } } catch ( IOException e ) { logger . error ( "Error connecting to " + host + " on port " + port + ". Will retry in " + CONTEXT . getConfig ( ) . getSocketRetryWait ( ) / 1000 + " seconds." + " reason " + e . getLocalizedMessage ( ) , e ) ; retries ++ ; cause = e ; try { Thread . sleep ( CONTEXT . getConfig ( ) . getSocketRetryWait ( ) ) ; continue ; } catch ( InterruptedException ie ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Sleep awoken early" ) ; } continue ; } } } // If socket retries exceed maximum allowed , throw an exception
if ( retries >= CONTEXT . getConfig ( ) . getSocketRetries ( ) ) { // securityDomain . restoreSystemEnvironment ( ) ;
logger . error ( "Secure Socket Connect Retries Exhausted." , cause ) ; throw new ConnectException ( "Secure socket retries exhausted" ) ; } // securityDomain . restoreSystemEnvironment ( ) ;
return socket ; |
public class IssueManager { /** * DEPRECATED . use relation . delete ( ) */
@ Deprecated public void deleteRelation ( Integer id ) throws RedmineException { } } | new IssueRelation ( transport ) . setId ( id ) . delete ( ) ; |
public class DescribeImagesFilterMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeImagesFilter describeImagesFilter , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeImagesFilter == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeImagesFilter . getTagStatus ( ) , TAGSTATUS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AsyncCompletionHandlerBase { /** * { @ inheritDoc } */
public STATE onHeadersReceived ( final HttpResponseHeaders headers ) throws Exception { } } | builder . accumulate ( headers ) ; return STATE . CONTINUE ; |
public class RulesPlugin { /** * Find an empty field , ie one that is unknown and not ' not known '
* If we don ' t find one then return null .
* @ param fieldMetadata
* @ return qualifying field */
public FieldMetadata getEmptyField ( FieldMetadata fieldMetadata ) { } } | ValidationSession session = fieldMetadata . getValidationSession ( ) ; RuleSessionImpl ruleSession = getRuleSession ( session ) ; ProxyField proxyField = session . getProxyField ( fieldMetadata ) ; RuleProxyField ruleProxyField = ruleSession . getRuleProxyField ( proxyField ) ; while ( true ) { RuleProxyField rpf = ruleProxyField . backChain ( ) ; if ( rpf == null ) { // there are no unfilled fields
return null ; } else { // We got an unfilled field return it
return rpf . getProxyField ( ) . getFieldMetadata ( ) ; } } |
public class CmsErrorDialog { /** * Checks the available space and sets max - height to the details field - set . */
private void onShow ( ) { } } | if ( m_detailsFieldset != null ) { m_detailsFieldset . getContentPanel ( ) . getElement ( ) . getStyle ( ) . setPropertyPx ( "maxHeight" , getAvailableHeight ( m_messageWidget . getOffsetHeight ( ) ) ) ; } |
public class MtasSolrCQLQParserPlugin { /** * ( non - Javadoc )
* @ see org . apache . solr . search . QParserPlugin # createParser ( java . lang . String ,
* org . apache . solr . common . params . SolrParams ,
* org . apache . solr . common . params . SolrParams ,
* org . apache . solr . request . SolrQueryRequest ) */
@ Override public QParser createParser ( String qstr , SolrParams localParams , SolrParams params , SolrQueryRequest req ) { } } | return new MtasCQLQParser ( qstr , localParams , params , req ) ; |
public class JobSchedulesImpl { /** * Lists all of the job schedules in the specified account .
* @ param jobScheduleListOptions Additional parameters for the operation
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws BatchErrorException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the PagedList & lt ; CloudJobSchedule & gt ; object if successful . */
public PagedList < CloudJobSchedule > list ( final JobScheduleListOptions jobScheduleListOptions ) { } } | ServiceResponseWithHeaders < Page < CloudJobSchedule > , JobScheduleListHeaders > response = listSinglePageAsync ( jobScheduleListOptions ) . toBlocking ( ) . single ( ) ; return new PagedList < CloudJobSchedule > ( response . body ( ) ) { @ Override public Page < CloudJobSchedule > nextPage ( String nextPageLink ) { JobScheduleListNextOptions jobScheduleListNextOptions = null ; if ( jobScheduleListOptions != null ) { jobScheduleListNextOptions = new JobScheduleListNextOptions ( ) ; jobScheduleListNextOptions . withClientRequestId ( jobScheduleListOptions . clientRequestId ( ) ) ; jobScheduleListNextOptions . withReturnClientRequestId ( jobScheduleListOptions . returnClientRequestId ( ) ) ; jobScheduleListNextOptions . withOcpDate ( jobScheduleListOptions . ocpDate ( ) ) ; } return listNextSinglePageAsync ( nextPageLink , jobScheduleListNextOptions ) . toBlocking ( ) . single ( ) . body ( ) ; } } ; |
public class SuggestedFixes { /** * Create a fix to add a suppression annotation on the surrounding class .
* < p > No suggested fix is produced if the suppression annotation cannot be used on classes , i . e .
* the annotation has a { @ code @ Target } but does not include { @ code @ Target ( TYPE ) } .
* < p > If the suggested annotation is { @ code DontSuggestFixes } , return empty . */
public static Optional < SuggestedFix > suggestWhitelistAnnotation ( String whitelistAnnotation , TreePath where , VisitorState state ) { } } | // TODO ( bangert ) : Support annotations that do not have @ Target ( CLASS ) .
if ( whitelistAnnotation . equals ( "com.google.errorprone.annotations.DontSuggestFixes" ) ) { return Optional . empty ( ) ; } SuggestedFix . Builder builder = SuggestedFix . builder ( ) ; Type whitelistAnnotationType = state . getTypeFromString ( whitelistAnnotation ) ; ImmutableSet < Tree . Kind > supportedWhitelistLocationKinds ; String annotationName ; if ( whitelistAnnotationType != null ) { supportedWhitelistLocationKinds = supportedTreeTypes ( whitelistAnnotationType . asElement ( ) ) ; annotationName = qualifyType ( state , builder , whitelistAnnotationType ) ; } else { // If we can ' t resolve the type , fall back to an approximation .
int idx = whitelistAnnotation . lastIndexOf ( '.' ) ; Verify . verify ( idx > 0 && idx + 1 < whitelistAnnotation . length ( ) ) ; supportedWhitelistLocationKinds = TREE_TYPE_UNKNOWN_ANNOTATION ; annotationName = whitelistAnnotation . substring ( idx + 1 ) ; builder . addImport ( whitelistAnnotation ) ; } Optional < Tree > whitelistLocation = StreamSupport . stream ( where . spliterator ( ) , false ) . filter ( tree -> supportedWhitelistLocationKinds . contains ( tree . getKind ( ) ) ) . filter ( Predicates . not ( SuggestedFixes :: isAnonymousClassTree ) ) . findFirst ( ) ; return whitelistLocation . map ( location -> builder . prefixWith ( location , "@" + annotationName + " " ) . build ( ) ) ; |
public class CollectionBindings { /** * Returns an object binding whose value is the reduction of all elements in the list .
* @ param items the observable list of elements .
* @ param defaultValue the value to be returned if there is no value present , may be null .
* @ param reducer an associative , non - interfering , stateless function for combining two values .
* @ return an object binding */
public static < T > ObjectBinding < T > reducing ( final ObservableList < T > items , final T defaultValue , final ObservableValue < BinaryOperator < T > > reducer ) { } } | return Bindings . createObjectBinding ( ( ) -> items . stream ( ) . reduce ( reducer . getValue ( ) ) . orElse ( defaultValue ) , items , reducer ) ; |
public class CmsChangePasswordDialog { /** * Validates the passwords , checking if they match and fulfill the requirements of the password handler . < p >
* Will show the appropriate errors if necessary . < p >
* @ param password1 password 1
* @ param password2 password 2
* @ return < code > true < / code > if valid */
boolean validatePasswords ( String password1 , String password2 ) { } } | if ( ! password1 . equals ( password2 ) ) { showPasswordMatchError ( true ) ; return false ; } showPasswordMatchError ( false ) ; try { OpenCms . getPasswordHandler ( ) . validatePassword ( password1 ) ; m_form . getPassword1Field ( ) . setComponentError ( null ) ; return true ; } catch ( CmsException e ) { m_form . setErrorPassword1 ( new UserError ( e . getLocalizedMessage ( m_locale ) ) , OpenCmsTheme . SECURITY_INVALID ) ; return false ; } |
public class LineBasedFrameDecoder { /** * Create a frame out of the { @ link ByteBuf } and return it .
* @ param ctx the { @ link ChannelHandlerContext } which this { @ link ByteToMessageDecoder } belongs to
* @ param buffer the { @ link ByteBuf } from which to read data
* @ return frame the { @ link ByteBuf } which represent the frame or { @ code null } if no frame could
* be created . */
protected Object decode ( ChannelHandlerContext ctx , ByteBuf buffer ) throws Exception { } } | final int eol = findEndOfLine ( buffer ) ; if ( ! discarding ) { if ( eol >= 0 ) { final ByteBuf frame ; final int length = eol - buffer . readerIndex ( ) ; final int delimLength = buffer . getByte ( eol ) == '\r' ? 2 : 1 ; if ( length > maxLength ) { buffer . readerIndex ( eol + delimLength ) ; fail ( ctx , length ) ; return null ; } if ( stripDelimiter ) { frame = buffer . readRetainedSlice ( length ) ; buffer . skipBytes ( delimLength ) ; } else { frame = buffer . readRetainedSlice ( length + delimLength ) ; } return frame ; } else { final int length = buffer . readableBytes ( ) ; if ( length > maxLength ) { discardedBytes = length ; buffer . readerIndex ( buffer . writerIndex ( ) ) ; discarding = true ; offset = 0 ; if ( failFast ) { fail ( ctx , "over " + discardedBytes ) ; } } return null ; } } else { if ( eol >= 0 ) { final int length = discardedBytes + eol - buffer . readerIndex ( ) ; final int delimLength = buffer . getByte ( eol ) == '\r' ? 2 : 1 ; buffer . readerIndex ( eol + delimLength ) ; discardedBytes = 0 ; discarding = false ; if ( ! failFast ) { fail ( ctx , length ) ; } } else { discardedBytes += buffer . readableBytes ( ) ; buffer . readerIndex ( buffer . writerIndex ( ) ) ; // We skip everything in the buffer , we need to set the offset to 0 again .
offset = 0 ; } return null ; } |
public class TemplateFilter { /** * { @ inheritDoc } */
@ Override public TemplateFilter and ( TemplateFilter otherFilter ) { } } | checkNotNull ( otherFilter , "Other filter must be not a null" ) ; if ( evaluation instanceof SingleFilterEvaluation && otherFilter . evaluation instanceof SingleFilterEvaluation ) { return new TemplateFilter ( getDataCenter ( ) . and ( otherFilter . getDataCenter ( ) ) , getPredicate ( ) . and ( otherFilter . getPredicate ( ) ) ) ; } else { evaluation = new AndEvaluation < > ( evaluation , otherFilter , TemplateMetadata :: getName ) ; return this ; } |
public class ZoneRulesProvider { /** * Gets the history of rules for the zone ID .
* Time - zones are defined by governments and change frequently .
* This method allows applications to find the history of changes to the
* rules for a single zone ID . The map is keyed by a string , which is the
* version string associated with the rules .
* The exact meaning and format of the version is provider specific .
* The version must follow lexicographical order , thus the returned map will
* be order from the oldest known rules to the newest available rules .
* The default ' TZDB ' group uses version numbering consisting of the year
* followed by a letter , such as ' 2009e ' or ' 2012f ' .
* Implementations must provide a result for each valid zone ID , however
* they do not have to provide a history of rules .
* Thus the map will always contain one element , and will only contain more
* than one element if historical rule information is available .
* @ param zoneId the zone region ID as used by { @ code ZoneId } , not null
* @ return a modifiable copy of the history of the rules for the ID , sorted
* from oldest to newest , not null
* @ throws ZoneRulesException if history cannot be obtained for the zone ID */
public static NavigableMap < String , ZoneRules > getVersions ( String zoneId ) { } } | Jdk8Methods . requireNonNull ( zoneId , "zoneId" ) ; return getProvider ( zoneId ) . provideVersions ( zoneId ) ; |
public class druidGParser { /** * druidG . g : 299:1 : whereClause [ QueryMeta qMeta ] : intls = intervalClause ( WS AND WS f = grandFilter ) ? ; */
public final void whereClause ( QueryMeta qMeta ) throws RecognitionException { } } | List < Interval > intls = null ; Filter f = null ; try { // druidG . g : 300:2 : ( intls = intervalClause ( WS AND WS f = grandFilter ) ? )
// druidG . g : 300:3 : intls = intervalClause ( WS AND WS f = grandFilter ) ?
{ pushFollow ( FOLLOW_intervalClause_in_whereClause2008 ) ; intls = intervalClause ( ) ; state . _fsp -- ; qMeta . intervals . addAll ( intls ) ; // druidG . g : 300:57 : ( WS AND WS f = grandFilter ) ?
int alt131 = 2 ; int LA131_0 = input . LA ( 1 ) ; if ( ( LA131_0 == WS ) ) { int LA131_1 = input . LA ( 2 ) ; if ( ( LA131_1 == AND ) ) { alt131 = 1 ; } } switch ( alt131 ) { case 1 : // druidG . g : 300:58 : WS AND WS f = grandFilter
{ match ( input , WS , FOLLOW_WS_in_whereClause2013 ) ; match ( input , AND , FOLLOW_AND_in_whereClause2015 ) ; match ( input , WS , FOLLOW_WS_in_whereClause2017 ) ; pushFollow ( FOLLOW_grandFilter_in_whereClause2021 ) ; f = grandFilter ( ) ; state . _fsp -- ; qMeta . filter = f ; } break ; } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving
} |
public class SplitMergeLineFit { /** * Approximates the input list with a set of line segments
* @ param list ( Input ) Ordered list of connected points .
* @ param vertexes ( Output ) Indexes in the input list which are corners in the polyline
* @ return true if it could fit a polygon to the points or false if not */
public boolean process ( List < Point2D_I32 > list , GrowQueue_I32 vertexes ) { } } | this . contour = list ; this . minimumSideLengthPixel = minimumSideLength . computeI ( contour . size ( ) ) ; splits . reset ( ) ; boolean result = _process ( list ) ; // remove reference so that it can be freed
this . contour = null ; vertexes . setTo ( splits ) ; return result ; |
public class AttachmentInformationMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AttachmentInformation attachmentInformation , ProtocolMarshaller protocolMarshaller ) { } } | if ( attachmentInformation == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( attachmentInformation . getName ( ) , NAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SURT { /** * Given a plain URI or hostname / hostname + path , give its SURT form .
* Results may be unpredictable on strings that cannot
* be interpreted as URIs .
* UURI ' fixup ' is applied to the URI before conversion to SURT
* form .
* @ param u URI or almost - URI to consider
* @ return implied SURT prefix form */
public static String fromPlain ( String u ) { } } | u = ArchiveUtils . addImpliedHttpIfNecessary ( u ) ; boolean trailingSlash = u . endsWith ( "/" ) ; // ensure all typical UURI cleanup ( incl . IDN - punycoding ) is done
try { u = UsableURIFactory . getInstance ( u ) . toString ( ) ; } catch ( URIException e ) { e . printStackTrace ( ) ; // allow to continue with original string uri
} // except : don ' t let UURI - fixup add a trailing slash
// if it wasn ' t already there ( presence or absence of
// such slash has special meaning specifying implied
// SURT prefixes )
if ( ! trailingSlash && u . endsWith ( "/" ) ) { u = u . substring ( 0 , u . length ( ) - 1 ) ; } // convert to full SURT
u = SURT . fromURI ( u ) ; return u ; |
public class Expression { /** * Return results that match both < code > Dimension < / code > objects .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAnd ( java . util . Collection ) } or { @ link # withAnd ( java . util . Collection ) } if you want to override the
* existing values .
* @ param and
* Return results that match both < code > Dimension < / code > objects .
* @ return Returns a reference to this object so that method calls can be chained together . */
public Expression withAnd ( Expression ... and ) { } } | if ( this . and == null ) { setAnd ( new java . util . ArrayList < Expression > ( and . length ) ) ; } for ( Expression ele : and ) { this . and . add ( ele ) ; } return this ; |
public class CmsContainerpageUtil { /** * Creates a list item . < p >
* @ param containerElement the element data
* @ return the list item widget */
public CmsMenuListItem createListItem ( final CmsContainerElementData containerElement ) { } } | CmsMenuListItem listItem = new CmsMenuListItem ( containerElement ) ; if ( ! containerElement . isGroupContainer ( ) && ! containerElement . isInheritContainer ( ) && CmsStringUtil . isEmptyOrWhitespaceOnly ( containerElement . getNoEditReason ( ) ) ) { listItem . enableEdit ( new ClickHandler ( ) { public void onClick ( ClickEvent event ) { CmsEditableData editableData = new CmsEditableData ( ) ; editableData . setElementLanguage ( CmsCoreProvider . get ( ) . getLocale ( ) ) ; editableData . setStructureId ( new CmsUUID ( CmsContainerpageController . getServerId ( containerElement . getClientId ( ) ) ) ) ; editableData . setSitePath ( containerElement . getSitePath ( ) ) ; getController ( ) . getContentEditorHandler ( ) . openDialog ( editableData , false , null , null , null ) ; ( ( CmsPushButton ) event . getSource ( ) ) . clearHoverState ( ) ; } } ) ; } else { if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( containerElement . getNoEditReason ( ) ) ) { listItem . disableEdit ( containerElement . getNoEditReason ( ) , true ) ; } else { listItem . disableEdit ( Messages . get ( ) . key ( Messages . GUI_CLIPBOARD_ITEM_CAN_NOT_BE_EDITED_0 ) , false ) ; } } String clientId = containerElement . getClientId ( ) ; String serverId = CmsContainerpageController . getServerId ( clientId ) ; if ( CmsUUID . isValidUUID ( serverId ) ) { CmsContextMenuButton button = new CmsContextMenuButton ( new CmsUUID ( serverId ) , new CmsContextMenuHandler ( ) { @ Override public void refreshResource ( CmsUUID structureId ) { Window . Location . reload ( ) ; } } , AdeContext . gallery ) ; listItem . getListItemWidget ( ) . addButtonToFront ( button ) ; } listItem . initMoveHandle ( m_controller . getDndHandler ( ) , true ) ; return listItem ; |
public class InitialCycles { /** * Compute the initial cycles . The code corresponds to algorithm 1 from
* { @ cdk . cite Vismara97 } , where possible the variable names have been kept
* the same . */
private void compute ( ) { } } | int n = graph . length ; // the set ' S ' contains the pairs of vertices adjacent to ' y '
int [ ] s = new int [ n ] ; int sizeOfS ; // order the vertices by degree
int [ ] vertices = new int [ n ] ; for ( int v = 0 ; v < n ; v ++ ) { vertices [ ordering [ v ] ] = v ; } // if the graph is known to be a biconnected component ( prepossessing )
// and there is at least one vertex with a degree > 2 we can skip all
// vertices of degree 2.
// otherwise the smallest possible cycle is { 0,1,2 } ( no parallel edges
// or loops ) we can therefore don ' t need to do the first two shortest
// paths calculations
int first = biconnected && nDeg2Vertices < n ? nDeg2Vertices : 2 ; for ( int i = first ; i < n ; i ++ ) { final int r = vertices [ i ] ; ShortestPaths pathsFromR = new ShortestPaths ( graph , null , r , limit / 2 , ordering ) ; // we only check the vertices which belong to the set Vr . this
// set is vertices reachable from ' r ' by only travelling though
// vertices smaller then r . In the ShortestPaths API this is
// name ' isPrecedingPathTo ' .
// using Vr allows us to prune the number of vertices to check and
// discover each cycle exactly once . This is possible as for each
// simple cycle there is only one vertex with a maximum ordering .
for ( int j = 0 ; j < i ; j ++ ) { final int y = vertices [ j ] ; if ( ! pathsFromR . isPrecedingPathTo ( y ) ) continue ; // start refilling set ' s ' by resetting it ' s size
sizeOfS = 0 ; // z is adjacent to y and belong to Vr
for ( final int z : graph [ y ] ) { if ( ! pathsFromR . isPrecedingPathTo ( z ) ) continue ; final int distToZ = pathsFromR . distanceTo ( z ) ; final int distToY = pathsFromR . distanceTo ( y ) ; // the distance of the path to z is one less then the
// path to y . the vertices are adjacent , therefore z must
// also belong to the shortest path from r to y .
// we queue up ( in ' s ' ) all the vertices adjacent to y for
// which this holds and then check these once we ' ve processed
// all adjacent vertices
// / ̄ ̄ z1 \ z1 and z2 are added to ' s ' and
// r y - z3 checked later as p and q ( see below )
// \ _ _ z2 /
if ( distToZ + 1 == distToY ) { s [ sizeOfS ++ ] = z ; } // if the distances are equal we could have an odd cycle
// but we need to check the paths only intersect at ' r ' .
// we check the intersect for cases like this , shortest
// cycle here is { p . . y , z . . p } not { r . . y , z . . r }
// / ̄ ̄ y / ̄ ̄ \ / ̄ ̄ y
// r - - - p | or r p |
// \ _ _ z \ _ _ / \ _ _ z
// if it ' s the shortest cycle then the intersect is just { r }
// \ _ _ z
else if ( distToZ == distToY && ordering [ z ] < ordering [ y ] ) { final int [ ] pathToY = pathsFromR . pathTo ( y ) ; final int [ ] pathToZ = pathsFromR . pathTo ( z ) ; if ( singletonIntersect ( pathToZ , pathToY ) ) { Cycle cycle = new OddCycle ( pathsFromR , pathToY , pathToZ ) ; add ( cycle ) ; } } } // check each pair vertices adjacent to ' y ' for an
// even cycle , as with the odd cycle we ensure the intersect
// of the paths { r . . p } and { r . . q } is { r } .
// r y
// \ _ _ q /
for ( int k = 0 ; k < sizeOfS ; k ++ ) { for ( int l = k + 1 ; l < sizeOfS ; l ++ ) { int [ ] pathToP = pathsFromR . pathTo ( s [ k ] ) ; int [ ] pathToQ = pathsFromR . pathTo ( s [ l ] ) ; if ( singletonIntersect ( pathToP , pathToQ ) ) { Cycle cycle = new EvenCycle ( pathsFromR , pathToP , y , pathToQ ) ; add ( cycle ) ; } } } } } |
public class FleetsApi { /** * Create fleet invitation Invite a character into the fleet . If a character
* has a CSPA charge set it is not possible to invite them to the fleet
* using ESI - - - SSO Scope : esi - fleets . write _ fleet . v1
* @ param fleetId
* ID for a fleet ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param token
* Access token to use if unable to set a header ( optional )
* @ param fleetInvitation
* ( optional )
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public void postFleetsFleetIdMembers ( Long fleetId , String datasource , String token , FleetInvitation fleetInvitation ) throws ApiException { } } | postFleetsFleetIdMembersWithHttpInfo ( fleetId , datasource , token , fleetInvitation ) ; |
public class CmsUserEditDialog { /** * Sets the password fields . < p > */
private void setPasswordFields ( ) { } } | m_dummyPasswordLabel . setContentMode ( com . vaadin . v7 . shared . ui . label . ContentMode . HTML ) ; // ugly hack to prevent Firefox from asking user to save password on every click which causes the history token to change after editing a user
String pwd = "<input type=\"password\" value=\"password\">" ; m_dummyPasswordLabel . setValue ( "<div style=\"display: none;\">" + pwd + pwd + "</div>" ) ; m_pw . hideOldPassword ( ) ; m_pw . setHeaderVisible ( false ) ; if ( OpenCms . getPasswordHandler ( ) instanceof I_CmsPasswordSecurityEvaluator ) { m_pw . setSecurityHint ( ( ( I_CmsPasswordSecurityEvaluator ) OpenCms . getPasswordHandler ( ) ) . getPasswordSecurityHint ( A_CmsUI . get ( ) . getLocale ( ) ) ) ; } m_pw . getOldPasswordField ( ) . setImmediate ( true ) ; m_pw . getPassword1Field ( ) . setImmediate ( true ) ; m_pw . getPassword2Field ( ) . setImmediate ( true ) ; m_pw . getPassword1Field ( ) . addTextChangeListener ( new TextChangeListener ( ) { private static final long serialVersionUID = 1L ; public void textChange ( TextChangeEvent event ) { checkSecurity ( event . getText ( ) ) ; setEmailBox ( ) ; } } ) ; m_pw . getPassword2Field ( ) . addTextChangeListener ( new TextChangeListener ( ) { private static final long serialVersionUID = 1L ; public void textChange ( TextChangeEvent event ) { checkSecurity ( m_pw . getPassword1 ( ) ) ; checkPasswordMatch ( event . getText ( ) ) ; setEmailBox ( ) ; } } ) ; |
public class ExpressionSpecBuilder { /** * Returns an < code > IfNotExists < / code > object which represents an < a href =
* " http : / / docs . aws . amazon . com / amazondynamodb / latest / developerguide / Expressions . Modifying . html "
* > if _ not _ exists ( path , operand ) < / a > function call ; used for building
* expression .
* < pre >
* " if _ not _ exists ( path , operand ) – If the item does not contain an attribute
* at the specified path , then if _ not _ exists evaluates to operand ; otherwise ,
* it evaluates to path . You can use this function to avoid overwriting an
* attribute already present in the item . "
* < / pre >
* @ param path
* document path to an attribute
* @ param defaultValue
* default value if the attribute doesn ' t exist
* @ return an < code > IfNotExists < / code > object for boolean ( BOOL ) attribute . */
public static IfNotExistsFunction < BOOL > if_not_exists ( String path , boolean defaultValue ) { } } | return if_not_exists ( new PathOperand ( path ) , new LiteralOperand ( defaultValue ) ) ; |
public class RetireJSDataSource { /** * Determines if the we should update the RetireJS database .
* @ param repo the retire JS repository .
* @ return < code > true < / code > if an updated to the RetireJS database should
* be performed ; otherwise < code > false < / code >
* @ throws NumberFormatException thrown if an invalid value is contained in
* the database properties */
protected boolean shouldUpdagte ( File repo ) throws NumberFormatException { } } | boolean proceed = true ; if ( repo != null && repo . isFile ( ) ) { final int validForHours = settings . getInt ( Settings . KEYS . ANALYZER_RETIREJS_REPO_VALID_FOR_HOURS , 0 ) ; final long lastUpdatedOn = repo . lastModified ( ) ; final long now = System . currentTimeMillis ( ) ; LOGGER . debug ( "Last updated: {}" , lastUpdatedOn ) ; LOGGER . debug ( "Now: {}" , now ) ; final long msValid = validForHours * 60L * 60L * 1000L ; proceed = ( now - lastUpdatedOn ) > msValid ; if ( ! proceed ) { LOGGER . info ( "Skipping RetireJS update since last update was within {} hours." , validForHours ) ; } } return proceed ; |
public class ValueTaglet { /** * Given the name of the field , return the corresponding FieldDoc . Return null
* due to invalid use of value tag if the name is null or empty string and if
* the value tag is not used on a field .
* @ param config the current configuration of the doclet .
* @ param tag the value tag .
* @ param name the name of the field to search for . The name should be in
* { @ code < qualified class name > # < field name > } format . If the class name is omitted ,
* it is assumed that the field is in the current class .
* @ return the corresponding FieldDoc . If the name is null or empty string ,
* return field that the value tag was used in . Return null if the name is null
* or empty string and if the value tag is not used on a field . */
private FieldDoc getFieldDoc ( Configuration config , Tag tag , String name ) { } } | if ( name == null || name . length ( ) == 0 ) { // Base case : no label .
if ( tag . holder ( ) instanceof FieldDoc ) { return ( FieldDoc ) tag . holder ( ) ; } else { // If the value tag does not specify a parameter which is a valid field and
// it is not used within the comments of a valid field , return null .
return null ; } } StringTokenizer st = new StringTokenizer ( name , "#" ) ; String memberName = null ; ClassDoc cd = null ; if ( st . countTokens ( ) == 1 ) { // Case 2 : @ value in same class .
Doc holder = tag . holder ( ) ; if ( holder instanceof MemberDoc ) { cd = ( ( MemberDoc ) holder ) . containingClass ( ) ; } else if ( holder instanceof ClassDoc ) { cd = ( ClassDoc ) holder ; } memberName = st . nextToken ( ) ; } else { // Case 3 : @ value in different class .
cd = config . root . classNamed ( st . nextToken ( ) ) ; memberName = st . nextToken ( ) ; } if ( cd == null ) { return null ; } FieldDoc [ ] fields = cd . fields ( ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { if ( fields [ i ] . name ( ) . equals ( memberName ) ) { return fields [ i ] ; } } return null ; |
public class SetAclPRequest { /** * < pre >
* * the path of the file or directory
* < / pre >
* < code > optional string path = 1 ; < / code > */
public java . lang . String getPath ( ) { } } | java . lang . Object ref = path_ ; if ( ref instanceof java . lang . String ) { return ( java . lang . String ) ref ; } else { com . google . protobuf . ByteString bs = ( com . google . protobuf . ByteString ) ref ; java . lang . String s = bs . toStringUtf8 ( ) ; if ( bs . isValidUtf8 ( ) ) { path_ = s ; } return s ; } |
public class SQLDroidPreparedStatement { /** * This is a pass through to the integer version of the same method . That is , the long is downcast to an
* integer . If the length is greater than Integer . MAX _ VALUE this method will throw a SQLException .
* @ see # setBinaryStream ( int , InputStream , int )
* @ exception SQLException thrown if length is greater than Integer . MAX _ VALUE or if there is a database error . */
@ Override public void setBinaryStream ( int parameterIndex , InputStream inputStream , long length ) throws SQLException { } } | if ( length > Integer . MAX_VALUE ) { throw new SQLException ( "SQLDroid does not allow input stream data greater than " + Integer . MAX_VALUE ) ; } setBinaryStream ( parameterIndex , inputStream , ( int ) length ) ; |
public class WhileContextDef { /** * < pre >
* Name of the pivot _ for _ body tensor .
* < / pre >
* < code > optional string pivot _ for _ body _ name = 7 ; < / code > */
public com . google . protobuf . ByteString getPivotForBodyNameBytes ( ) { } } | java . lang . Object ref = pivotForBodyName_ ; if ( ref instanceof java . lang . String ) { com . google . protobuf . ByteString b = com . google . protobuf . ByteString . copyFromUtf8 ( ( java . lang . String ) ref ) ; pivotForBodyName_ = b ; return b ; } else { return ( com . google . protobuf . ByteString ) ref ; } |
public class CircularProgressTileSkin { /** * * * * * * Initialization * * * * * */
@ Override protected void initGraphics ( ) { } } | super . initGraphics ( ) ; if ( tile . isAutoScale ( ) ) tile . calcAutoScale ( ) ; minValue = tile . getMinValue ( ) ; range = tile . getRange ( ) ; angleStep = ANGLE_RANGE / range ; sectionsVisible = tile . getSectionsVisible ( ) ; sections = tile . getSections ( ) ; formatString = new StringBuilder ( "%." ) . append ( Integer . toString ( tile . getDecimals ( ) ) ) . append ( "f" ) . toString ( ) ; locale = tile . getLocale ( ) ; currentValueListener = o -> setBar ( tile . getCurrentValue ( ) ) ; graphicListener = ( o , ov , nv ) -> { if ( nv != null ) { graphicContainer . getChildren ( ) . setAll ( tile . getGraphic ( ) ) ; } } ; titleText = new Text ( ) ; titleText . setFill ( tile . getTitleColor ( ) ) ; enableNode ( titleText , ! tile . getTitle ( ) . isEmpty ( ) ) ; text = new Text ( tile . getText ( ) ) ; text . setFill ( tile . getTextColor ( ) ) ; enableNode ( text , tile . isTextVisible ( ) ) ; barBackground = new Arc ( PREFERRED_WIDTH * 0.5 , PREFERRED_HEIGHT * 0.5 , PREFERRED_WIDTH * 0.468 , PREFERRED_HEIGHT * 0.468 , 90 , 360 ) ; barBackground . setType ( ArcType . OPEN ) ; barBackground . setStroke ( tile . getBarBackgroundColor ( ) ) ; barBackground . setStrokeWidth ( PREFERRED_WIDTH * 0.1 ) ; barBackground . setStrokeLineCap ( StrokeLineCap . BUTT ) ; barBackground . setFill ( null ) ; bar = new Arc ( PREFERRED_WIDTH * 0.5 , PREFERRED_HEIGHT * 0.5 , PREFERRED_WIDTH * 0.468 , PREFERRED_HEIGHT * 0.468 , 90 , 0 ) ; bar . setType ( ArcType . OPEN ) ; bar . setStroke ( tile . getBarColor ( ) ) ; bar . setStrokeWidth ( PREFERRED_WIDTH * 0.1 ) ; bar . setStrokeLineCap ( StrokeLineCap . BUTT ) ; bar . setFill ( null ) ; separator = new Line ( PREFERRED_WIDTH * 0.5 , 1 , PREFERRED_WIDTH * 0.5 , 0.16667 * PREFERRED_HEIGHT ) ; separator . setStroke ( tile . getBackgroundColor ( ) ) ; separator . setFill ( Color . TRANSPARENT ) ; percentageValueText = new Text ( String . format ( locale , formatString , tile . getCurrentValue ( ) ) ) ; percentageValueText . setFont ( Fonts . latoRegular ( PREFERRED_WIDTH * 0.27333 ) ) ; percentageValueText . setFill ( tile . getValueColor ( ) ) ; percentageValueText . setTextOrigin ( VPos . CENTER ) ; percentageUnitText = new Text ( tile . getUnit ( ) ) ; percentageUnitText = new Text ( "\u0025" ) ; percentageUnitText . setFont ( Fonts . latoLight ( PREFERRED_WIDTH * 0.08 ) ) ; percentageUnitText . setFill ( tile . getUnitColor ( ) ) ; percentageFlow = new TextFlow ( percentageValueText , percentageUnitText ) ; percentageFlow . setTextAlignment ( TextAlignment . CENTER ) ; valueText = new Text ( String . format ( locale , formatString , tile . getCurrentValue ( ) ) ) ; valueText . setFont ( Fonts . latoRegular ( PREFERRED_WIDTH * 0.27333 ) ) ; valueText . setFill ( tile . getValueColor ( ) ) ; valueText . setTextOrigin ( VPos . CENTER ) ; enableNode ( valueText , tile . isValueVisible ( ) ) ; unitText = new Text ( tile . getUnit ( ) ) ; unitText = new Text ( "\u0025" ) ; unitText . setFont ( Fonts . latoLight ( PREFERRED_WIDTH * 0.08 ) ) ; unitText . setFill ( tile . getUnitColor ( ) ) ; enableNode ( unitText , ! tile . getUnit ( ) . isEmpty ( ) ) ; valueUnitFlow = new TextFlow ( valueText , unitText ) ; valueUnitFlow . setTextAlignment ( TextAlignment . CENTER ) ; graphicContainer = new StackPane ( ) ; graphicContainer . setMinSize ( size * 0.9 , tile . isTextVisible ( ) ? size * 0.72 : size * 0.795 ) ; graphicContainer . setMaxSize ( size * 0.9 , tile . isTextVisible ( ) ? size * 0.72 : size * 0.795 ) ; graphicContainer . setPrefSize ( size * 0.9 , tile . isTextVisible ( ) ? size * 0.72 : size * 0.795 ) ; if ( null == tile . getGraphic ( ) ) { enableNode ( graphicContainer , false ) ; } else { graphicContainer . getChildren ( ) . setAll ( tile . getGraphic ( ) ) ; } getPane ( ) . getChildren ( ) . addAll ( barBackground , bar , separator , titleText , text , graphicContainer , percentageFlow , valueUnitFlow ) ; |
public class TautomerizationMechanism { /** * Initiates the process for the given mechanism . The atoms and bonds to apply are mapped between
* reactants and products .
* @ param atomContainerSet
* @ param atomList The list of atoms taking part in the mechanism . Only allowed fourth atoms .
* @ param bondList The list of bonds taking part in the mechanism . Only allowed two bond .
* The first bond is the bond to decrease the order and the second is the bond
* to increase the order
* It is the bond which is moved
* @ return The Reaction mechanism */
@ Override public IReaction initiate ( IAtomContainerSet atomContainerSet , ArrayList < IAtom > atomList , ArrayList < IBond > bondList ) throws CDKException { } } | CDKAtomTypeMatcher atMatcher = CDKAtomTypeMatcher . getInstance ( atomContainerSet . getBuilder ( ) ) ; if ( atomContainerSet . getAtomContainerCount ( ) != 1 ) { throw new CDKException ( "TautomerizationMechanism only expects one IAtomContainer" ) ; } if ( atomList . size ( ) != 4 ) { throw new CDKException ( "TautomerizationMechanism expects four atoms in the ArrayList" ) ; } if ( bondList . size ( ) != 3 ) { throw new CDKException ( "TautomerizationMechanism expects three bonds in the ArrayList" ) ; } IAtomContainer molecule = atomContainerSet . getAtomContainer ( 0 ) ; IAtomContainer reactantCloned ; try { reactantCloned = ( IAtomContainer ) molecule . clone ( ) ; } catch ( CloneNotSupportedException e ) { throw new CDKException ( "Could not clone IAtomContainer!" , e ) ; } IAtom atom1 = atomList . get ( 0 ) ; // Atom to be added the hydrogen
IAtom atom1C = reactantCloned . getAtom ( molecule . indexOf ( atom1 ) ) ; IAtom atom2 = atomList . get ( 1 ) ; // Atom 2
IAtom atom2C = reactantCloned . getAtom ( molecule . indexOf ( atom2 ) ) ; IAtom atom3 = atomList . get ( 2 ) ; // Atom 3
IAtom atom3C = reactantCloned . getAtom ( molecule . indexOf ( atom3 ) ) ; IAtom atom4 = atomList . get ( 3 ) ; // hydrogen Atom
IAtom atom4C = reactantCloned . getAtom ( molecule . indexOf ( atom4 ) ) ; IBond bond1 = bondList . get ( 0 ) ; // Bond with double bond
int posBond1 = molecule . indexOf ( bond1 ) ; IBond bond2 = bondList . get ( 1 ) ; // Bond with single bond
int posBond2 = molecule . indexOf ( bond2 ) ; IBond bond3 = bondList . get ( 2 ) ; // Bond to be removed
int posBond3 = molecule . indexOf ( bond3 ) ; BondManipulator . decreaseBondOrder ( reactantCloned . getBond ( posBond1 ) ) ; BondManipulator . increaseBondOrder ( reactantCloned . getBond ( posBond2 ) ) ; reactantCloned . removeBond ( reactantCloned . getBond ( posBond3 ) ) ; IBond newBond = molecule . getBuilder ( ) . newInstance ( IBond . class , atom1C , atom4C , IBond . Order . SINGLE ) ; reactantCloned . addBond ( newBond ) ; atom1C . setHybridization ( null ) ; AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( reactantCloned ) ; IAtomType type = atMatcher . findMatchingAtomType ( reactantCloned , atom1C ) ; if ( type == null || type . getAtomTypeName ( ) . equals ( "X" ) ) return null ; atom3C . setHybridization ( null ) ; AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( reactantCloned ) ; type = atMatcher . findMatchingAtomType ( reactantCloned , atom3C ) ; if ( type == null || type . getAtomTypeName ( ) . equals ( "X" ) ) return null ; IReaction reaction = atom2C . getBuilder ( ) . newInstance ( IReaction . class ) ; reaction . addReactant ( molecule ) ; /* mapping */
for ( IAtom atom : molecule . atoms ( ) ) { IMapping mapping = atom2C . getBuilder ( ) . newInstance ( IMapping . class , atom , reactantCloned . getAtom ( molecule . indexOf ( atom ) ) ) ; reaction . addMapping ( mapping ) ; } reaction . addProduct ( reactantCloned ) ; return reaction ; |
public class LightWeightBitSet { /** * Gets the bit for the given position .
* @ param bits
* - bitset
* @ param pos
* - position to retrieve . */
public static boolean get ( long [ ] bits , int pos ) { } } | int offset = pos >> LONG_SHIFT ; if ( offset >= bits . length ) return false ; return ( bits [ offset ] & ( 1L << pos ) ) != 0 ; |
public class ValidationDataRepository { /** * Save all list .
* @ param pDatas the p datas
* @ return the list */
public List < ValidationData > saveAll ( List < ValidationData > pDatas ) { } } | pDatas . forEach ( this :: save ) ; return pDatas ; |
public class StateMachine { /** * Set current state of the state machine . This method is multi - thread safe .
* @ param state the current state to be , must have already been defined . */
public void setState ( S state ) { } } | Integer id = definition . getStateId ( state ) ; currentStateId . set ( id ) ; |
public class ConnectionHandle { /** * Returns unique connection information as a byte array .
* @ param writeBuffer
* ByteBuffer to write ConnectionHandle bytes into . */
public void putBytes ( ByteBuffer writeBuffer ) { } } | if ( writeBuffer . remaining ( ) < CONNECTION_ID_LENGTH ) { throw new IllegalArgumentException ( "Could not add ConnectionHandle to byte buffer: not enough space." ) ; } writeBuffer . putLong ( this . connID ) ; writeBuffer . putInt ( this . seqNum ) ; writeBuffer . put ( this . connHandleCreatorId ) ; writeBuffer . put ( this . myFlags ) ; writeBuffer . put ( this . myType ) ; writeBuffer . put ( ( byte ) 0xFF ) ; // place holder - empty flag |
public class Equation { /** * Adds a new operation to the list from the operation and two variables . The inputs are removed
* from the token list and replaced by their output . */
protected TokenList . Token insertTranspose ( TokenList . Token variable , TokenList tokens , Sequence sequence ) { } } | Operation . Info info = functions . create ( '\'' , variable . getVariable ( ) ) ; sequence . addOperation ( info . op ) ; // replace the symbols with their output
TokenList . Token t = new TokenList . Token ( info . output ) ; // remove the transpose symbol
tokens . remove ( variable . next ) ; // replace the variable with its transposed version
tokens . replace ( variable , t ) ; return t ; |
public class TransposeAlgs_DDRM { /** * A straight forward transpose . Good for small non - square matrices .
* @ param A Original matrix . Not modified .
* @ param A _ tran Transposed matrix . Modified . */
public static void standard ( DMatrix1Row A , DMatrix1Row A_tran ) { } } | int index = 0 ; for ( int i = 0 ; i < A_tran . numRows ; i ++ ) { int index2 = i ; int end = index + A_tran . numCols ; while ( index < end ) { A_tran . data [ index ++ ] = A . data [ index2 ] ; index2 += A . numCols ; } } |
public class UTF16 { /** * Removes the codepoint at the specified position in this target ( shortening target by 1
* character if the codepoint is a non - supplementary , 2 otherwise ) .
* @ param target String buffer to remove codepoint from
* @ param limit End index of the char array , limit & lt ; = target . length
* @ param offset16 Offset which the codepoint will be removed
* @ return a new limit size
* @ exception IndexOutOfBoundsException Thrown if offset16 is invalid . */
public static int delete ( char target [ ] , int limit , int offset16 ) { } } | int count = 1 ; switch ( bounds ( target , 0 , limit , offset16 ) ) { case LEAD_SURROGATE_BOUNDARY : count ++ ; break ; case TRAIL_SURROGATE_BOUNDARY : count ++ ; offset16 -- ; break ; } System . arraycopy ( target , offset16 + count , target , offset16 , limit - ( offset16 + count ) ) ; target [ limit - count ] = 0 ; return limit - count ; |
public class AbstractVdmBuilder { /** * public abstract String getNatureId ( ) ; */
protected void addWarningMarker ( File file , String message , ILexLocation location , String sourceId ) { } } | FileUtility . addMarker ( project . findIFile ( file ) , message , location , IMarker . SEVERITY_WARNING , sourceId , - 1 ) ; |
public class Visualizer { /** * Draws the PE Header to the structure image */
private void drawPEHeaders ( ) { } } | long msdosOffset = 0 ; long msdosSize = withMinLength ( data . getMSDOSHeader ( ) . getHeaderSize ( ) ) ; drawPixels ( colorMap . get ( MSDOS_HEADER ) , msdosOffset , msdosSize ) ; long optOffset = data . getOptionalHeader ( ) . getOffset ( ) ; long optSize = withMinLength ( data . getOptionalHeader ( ) . getSize ( ) ) ; drawPixels ( colorMap . get ( OPTIONAL_HEADER ) , optOffset , optSize ) ; long coffOffset = data . getCOFFFileHeader ( ) . getOffset ( ) ; long coffSize = withMinLength ( COFFFileHeader . HEADER_SIZE ) ; drawPixels ( colorMap . get ( COFF_FILE_HEADER ) , coffOffset , coffSize ) ; long tableOffset = data . getSectionTable ( ) . getOffset ( ) ; long tableSize = data . getSectionTable ( ) . getSize ( ) ; if ( tableSize != 0 ) { tableSize = withMinLength ( tableSize ) ; drawPixels ( colorMap . get ( SECTION_TABLE ) , tableOffset , tableSize ) ; } |
public class LBoolToSrtFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static LBoolToSrtFunction boolToSrtFunctionFrom ( Consumer < LBoolToSrtFunctionBuilder > buildingFunction ) { } } | LBoolToSrtFunctionBuilder builder = new LBoolToSrtFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class FieldIterator { /** * Go through the fields in this class and add them to the field list .
* @ param strClassName The record class to read through . */
protected void scanRecordFields ( String [ ] strClassNames , int iClassIndex , boolean bMarkUnused ) { } } | ClassInfo recClassInfo = new ClassInfo ( Record . findRecordOwner ( m_recClassInfo ) ) ; FieldData recFieldData = new FieldData ( Record . findRecordOwner ( m_recFieldData ) ) ; String strClassName = strClassNames [ iClassIndex ] ; try { // First , re - read the original class .
recClassInfo . getField ( ClassInfo . CLASS_NAME ) . setString ( strClassName ) ; recClassInfo . setKeyArea ( ClassInfo . CLASS_NAME_KEY ) ; if ( ! recClassInfo . seek ( null ) ) return ; // Never
recFieldData . setKeyArea ( FieldData . FIELD_FILE_NAME_KEY ) ; recFieldData . addListener ( new SubFileFilter ( recClassInfo . getField ( ClassInfo . CLASS_NAME ) , FieldData . FIELD_FILE_NAME , null , null , null , null ) ) ; strClassName = recClassInfo . getField ( ClassInfo . CLASS_NAME ) . toString ( ) ; recFieldData . close ( ) ; while ( recFieldData . hasNext ( ) ) { recFieldData . next ( ) ; int iIndex = this . findField ( recFieldData , true ) ; // Find the base field in my list
FieldSummary fieldSummary = new FieldSummary ( recFieldData , FieldSummary . RECORD_FIELD ) ; if ( iIndex == - 1 ) { m_vFieldList . add ( fieldSummary ) ; // Add this
} else { // If there is a base , replace it with this
FieldSummary fieldSummaryBase = ( FieldSummary ) m_vFieldList . get ( iIndex ) ; m_vFieldList . set ( iIndex , fieldSummaryBase . mergeNewSummary ( fieldSummary , ( iClassIndex >= strClassNames . length - 1 ) , strClassName ) ) ; // Replace this
} } if ( bMarkUnused ) { for ( int i = 0 ; i < m_vFieldList . size ( ) ; i ++ ) { FieldSummary fieldSummary = ( FieldSummary ) m_vFieldList . elementAt ( i ) ; if ( ! this . isInRecord ( strClassNames , iClassIndex , fieldSummary . m_strFieldFileName ) ) { fieldSummary . m_strNewFieldClass = UNUSED ; fieldSummary . m_strNewBaseField = fieldSummary . m_strFieldName ; } } } } catch ( DBException ex ) { ex . printStackTrace ( ) ; } finally { recClassInfo . free ( ) ; recFieldData . free ( ) ; } |
public class GenericBeanFactoryAccessor { /** * Find a { @ link Annotation } of < code > annotationType < / code > on the specified
* bean , traversing its interfaces and super classes if no annotation can be
* found on the given class itself , as well as checking its raw bean class
* if not found on the exposed bean reference ( e . g . in case of a proxy ) .
* @ param beanName the name of the bean to look for annotations on
* @ param annotationType the annotation class to look for
* @ return the annotation of the given type found , or < code > null < / code >
* @ see org . springframework . core . annotation . AnnotationUtils # findAnnotation ( Class , Class ) */
public < A extends Annotation > A findAnnotationOnBean ( String beanName , Class < A > annotationType ) { } } | Class < ? > handlerType = beanFactory . getType ( beanName ) ; A ann = AnnotationUtils . findAnnotation ( handlerType , annotationType ) ; if ( ann == null && beanFactory instanceof ConfigurableBeanFactory && beanFactory . containsBeanDefinition ( beanName ) ) { ConfigurableBeanFactory cbf = ( ConfigurableBeanFactory ) beanFactory ; BeanDefinition bd = cbf . getMergedBeanDefinition ( beanName ) ; if ( bd instanceof AbstractBeanDefinition ) { AbstractBeanDefinition abd = ( AbstractBeanDefinition ) bd ; if ( abd . hasBeanClass ( ) ) { Class < ? > beanClass = abd . getBeanClass ( ) ; ann = AnnotationUtils . findAnnotation ( beanClass , annotationType ) ; } } } return ann ; |
public class Quaternion { /** * Sets this quaternion to one that first rotates about x by the specified number of radians ,
* then rotates about y , then about z . */
public Quaternion fromAngles ( float x , float y , float z ) { } } | // TODO : it may be more convenient to define the angles in the opposite order ( first z ,
// then y , then x )
float hx = x * 0.5f , hy = y * 0.5f , hz = z * 0.5f ; float sz = FloatMath . sin ( hz ) , cz = FloatMath . cos ( hz ) ; float sy = FloatMath . sin ( hy ) , cy = FloatMath . cos ( hy ) ; float sx = FloatMath . sin ( hx ) , cx = FloatMath . cos ( hx ) ; float szsy = sz * sy , czsy = cz * sy , szcy = sz * cy , czcy = cz * cy ; return set ( czcy * sx - szsy * cx , czsy * cx + szcy * sx , szcy * cx - czsy * sx , czcy * cx + szsy * sx ) ; |
public class MapCacheProvider { /** * / * ( non - Javadoc )
* @ see java . util . Map # put ( java . lang . Object , java . lang . Object ) */
@ Override public V put ( K key , V value ) { } } | final V old = this . get ( key ) ; this . cache . put ( new Element ( key , value ) ) ; return old ; |
public class HttpHeaderMap { /** * Add more than one value associated with the given key . */
public void add ( Object key , Object value ) { } } | Object existing = mMap . get ( key ) ; if ( existing instanceof List ) { if ( value instanceof List ) { ( ( List ) existing ) . addAll ( ( List ) value ) ; } else { ( ( List ) existing ) . add ( value ) ; } } else if ( existing == null && ! mMap . containsKey ( key ) ) { if ( value instanceof List ) { mMap . put ( key , new ArrayList ( ( List ) value ) ) ; } else { mMap . put ( key , value ) ; } } else { List list = new ArrayList ( ) ; list . add ( existing ) ; if ( value instanceof List ) { list . addAll ( ( List ) value ) ; } else { list . add ( value ) ; } mMap . put ( key , list ) ; } |
public class BlobStoreUtils { /** * Normalize state */
public static BlobKeySequenceInfo normalizeNimbusHostPortSequenceNumberInfo ( String nimbusSeqNumberInfo ) { } } | BlobKeySequenceInfo keySequenceInfo = new BlobKeySequenceInfo ( ) ; int lastIndex = nimbusSeqNumberInfo . lastIndexOf ( "-" ) ; keySequenceInfo . setNimbusHostPort ( nimbusSeqNumberInfo . substring ( 0 , lastIndex ) ) ; keySequenceInfo . setSequenceNumber ( nimbusSeqNumberInfo . substring ( lastIndex + 1 ) ) ; return keySequenceInfo ; |
public class LayerDrawable { /** * Sets the gravity used to position or stretch the specified layer within its container .
* Gravity is applied after any layer insets ( see { @ link # setLayerInset ( int , int , int , int ,
* int ) } ) or padding ( see { @ link # setPaddingMode ( int ) } ) .
* If gravity is specified as { @ link Gravity # NO _ GRAVITY } , the default behavior depends on
* whether an explicit width or height has been set ( see { @ link # setLayerSize ( int , int , int ) } ) ,
* If a dimension is not set , gravity in that direction defaults to { @ link
* Gravity # FILL _ HORIZONTAL } or { @ link Gravity # FILL _ VERTICAL } ; otherwise , gravity in that
* direction defaults to { @ link Gravity # LEFT } or { @ link Gravity # TOP } .
* @ param index the index of the drawable to adjust
* @ param gravity the gravity to set for the layer
* @ attr ref android . R . styleable # LayerDrawableItem _ gravity
* @ see # getLayerGravity ( int ) */
public void setLayerGravity ( int index , int gravity ) { } } | final ChildDrawable childDrawable = mLayerState . mChildren [ index ] ; childDrawable . mGravity = gravity ; |
public class OracleDdlParser { /** * Utility method to additionally check if MODIFY definition without datatype
* @ param tokens a { @ link DdlTokenStream } instance ; may not be null
* @ param columnMixinType a { @ link String } ; may not be null
* @ return { @ code true } if the given stream si at the start of the column defintion , { @ code false } otherwise .
* @ throws ParsingException */
protected boolean isColumnDefinitionStart ( DdlTokenStream tokens , String columnMixinType ) throws ParsingException { } } | boolean result = isColumnDefinitionStart ( tokens ) ; if ( ! result && TYPE_ALTER_COLUMN_DEFINITION . equals ( columnMixinType ) ) { for ( String start : INLINE_COLUMN_PROPERTY_START ) { if ( tokens . matches ( TokenStream . ANY_VALUE , start ) ) return true ; } } return result ; |
public class PreprocessorContext { /** * Get a local variable value
* @ param name the name for the variable , it can be null . The name will be normalized to allowed one .
* @ return null either if the name is null or the variable is not found , otherwise its value */
@ Nullable public Value getLocalVariable ( @ Nullable final String name ) { } } | if ( name == null ) { return null ; } final String normalized = assertNotNull ( PreprocessorUtils . normalizeVariableName ( name ) ) ; if ( normalized . isEmpty ( ) ) { return null ; } return localVarTable . get ( normalized ) ; |
public class AbstractHtmlTableCell { /** * Sets the onKeyPress javascript event for the HTML table cell .
* @ param onKeyPress the onKeyPress event .
* @ jsptagref . attributedescription The onKeyPress JavaScript event for the HTML table cell .
* @ jsptagref . attributesyntaxvalue < i > string _ cellOnKeyPress < / i >
* @ netui : attribute required = " false " rtexprvalue = " true " description = " The onKeyPress JavaScript event . " */
public void setCellOnKeyPress ( String onKeyPress ) { } } | _cellState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONKEYPRESS , onKeyPress ) ; |
public class IPv6AddressPool { /** * Allocate the first available subnet from the pool .
* @ return resulting pool */
public IPv6AddressPool allocate ( ) { } } | if ( ! isExhausted ( ) ) { // get the first range of free subnets , and take the first subnet of that range
final IPv6AddressRange firstFreeRange = freeRanges . first ( ) ; final IPv6Network allocated = IPv6Network . fromAddressAndMask ( firstFreeRange . getFirst ( ) , allocationSubnetSize ) ; return doAllocate ( allocated , firstFreeRange ) ; } else { // exhausted
return null ; } |
public class SecurityContext { /** * Executes the given task with root - permissions . Use with care .
* @ throws ExecutionException if an exception occurs during the execution of the task */
public static < ReturnType > ReturnType executeWithSystemPermissions ( Callable < ReturnType > task ) throws ExecutionException { } } | ContextAwareCallable < ReturnType > contextAwareCallable = new ContextAwareCallable < ReturnType > ( task ) ; Subject newsubject = new Subject . Builder ( ) . buildSubject ( ) ; newsubject . login ( new RootAuthenticationToken ( ) ) ; try { return newsubject . execute ( contextAwareCallable ) ; } finally { newsubject . logout ( ) ; } |
public class YarnJobSubmissionClient { /** * Log all the tokens in the container for thr user .
* @ param logLevel - the log level .
* @ param msgPrefix - msg prefix for log .
* @ param user - the UserGroupInformation object . */
private static void logToken ( final Level logLevel , final String msgPrefix , final UserGroupInformation user ) { } } | if ( LOG . isLoggable ( logLevel ) ) { LOG . log ( logLevel , "{0} number of tokens: [{1}]." , new Object [ ] { msgPrefix , user . getCredentials ( ) . numberOfTokens ( ) } ) ; for ( final org . apache . hadoop . security . token . Token t : user . getCredentials ( ) . getAllTokens ( ) ) { LOG . log ( logLevel , "Token service: {0}, token kind: {1}." , new Object [ ] { t . getService ( ) , t . getKind ( ) } ) ; } } |
public class CertificateOperations { /** * Adds a certificate to the Batch account .
* @ param certificate The certificate to be added .
* @ param additionalBehaviors A collection of { @ link BatchClientBehavior } instances that are applied to the Batch service request .
* @ throws BatchErrorException Exception thrown when an error response is received from the Batch service .
* @ throws IOException Exception thrown when there is an error in serialization / deserialization of data sent to / received from the Batch service . */
public void createCertificate ( CertificateAddParameter certificate , Iterable < BatchClientBehavior > additionalBehaviors ) throws BatchErrorException , IOException { } } | CertificateAddOptions options = new CertificateAddOptions ( ) ; BehaviorManager bhMgr = new BehaviorManager ( this . customBehaviors ( ) , additionalBehaviors ) ; bhMgr . applyRequestBehaviors ( options ) ; this . parentBatchClient . protocolLayer ( ) . certificates ( ) . add ( certificate , options ) ; |
public class SipUserHostInfo { /** * Frames a SIP URI user / host info portion , specified in RFC 3261 as :
* < pre >
* SIP - URI = " sip : " [ userinfo ] hostport
* uri - parameters [ headers ]
* SIPS - URI = " sips : " [ userinfo ] hostport
* uri - parameters [ headers ]
* userinfo = ( user / telephone - subscriber ) [ " : " password ] " @ "
* user = 1 * ( unreserved / escaped / user - unreserved )
* user - unreserved = " & " / " = " / " + " / " $ " / " , " / " ; " / " ? " / " / "
* password = * ( unreserved / escaped / " & " / " = " / " + " / " $ " / " , " )
* hostport = host [ " : " port ]
* < / pre >
* The URI is consumed up to the start uri - parameters or headers section , whichever
* is encountered first .
* @ param buffer a buffer , which should begin at the start of the user / host info section
* @ return a SipUserHostInfo object , encoding the parsed information
* @ throws SipParseException
* @ throws IOException */
public static SipUserHostInfo frame ( final Buffer buffer ) throws SipParseException , IOException { } } | final Parser parser = new Parser ( buffer ) ; return parser . parse ( ) ; |
public class BridgeActivity { /** * Request for write system setting . */
static void requestWriteSetting ( Source source ) { } } | Intent intent = new Intent ( source . getContext ( ) , BridgeActivity . class ) ; intent . putExtra ( KEY_TYPE , BridgeRequest . TYPE_WRITE_SETTING ) ; source . startActivity ( intent ) ; |
public class MPP8Reader { /** * This method extracts view data from the MPP file .
* @ throws IOException */
private void processViewData ( ) throws IOException { } } | DirectoryEntry dir = ( DirectoryEntry ) m_viewDir . getEntry ( "CV_iew" ) ; FixFix ff = new FixFix ( 138 , new DocumentInputStream ( ( ( DocumentEntry ) dir . getEntry ( "FixFix 0" ) ) ) ) ; int items = ff . getItemCount ( ) ; byte [ ] data ; View view ; for ( int loop = 0 ; loop < items ; loop ++ ) { data = ff . getByteArrayValue ( loop ) ; view = new View8 ( m_file , data ) ; m_file . getViews ( ) . add ( view ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.