signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ConcurrentReloadableManaged { /** * Construct a new managed reference .
* @ return a new concurrent managed */
private ConcurrentManaged < T > newManaged ( ) { } } | return ConcurrentManaged . newManaged ( async , caller , managedOptions , setup , teardown ) ; |
public class VJournal { /** * Sets either ( a ) the creation date of the iCalendar object ( if the
* { @ link Method } property is defined ) or ( b ) the date that the journal
* entry was last modified ( the { @ link LastModified } property also holds
* this information ) . This journal entry object comes populated with a
* { @ link DateTimeStamp } property that is set to the current time . This is a
* < b > required < / b > property .
* @ param dateTimeStamp the date time stamp or null to remove
* @ return the property that was created
* @ see < a href = " http : / / tools . ietf . org / html / rfc5545 # page - 137 " > RFC 5545
* p . 137-8 < / a >
* @ see < a href = " http : / / tools . ietf . org / html / rfc2445 # page - 130 " > RFC 2445
* p . 130-1 < / a > */
public DateTimeStamp setDateTimeStamp ( Date dateTimeStamp ) { } } | DateTimeStamp prop = ( dateTimeStamp == null ) ? null : new DateTimeStamp ( dateTimeStamp ) ; setDateTimeStamp ( prop ) ; return prop ; |
public class RandomVariableAAD { /** * / * ( non - Javadoc )
* @ see net . finmath . stochastic . RandomVariable # accrue ( net . finmath . stochastic . RandomVariable , double ) */
@ Override public RandomVariable accrue ( RandomVariable rate , double periodLength ) { } } | return apply ( OperatorType . ACCRUE , new RandomVariable [ ] { this , rate , constructNewAADRandomVariable ( periodLength ) } ) ; |
public class HlsManifestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( HlsManifest hlsManifest , ProtocolMarshaller protocolMarshaller ) { } } | if ( hlsManifest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( hlsManifest . getAdMarkers ( ) , ADMARKERS_BINDING ) ; protocolMarshaller . marshall ( hlsManifest . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( hlsManifest . getIncludeIframeOnlyStream ( ) , INCLUDEIFRAMEONLYSTREAM_BINDING ) ; protocolMarshaller . marshall ( hlsManifest . getManifestName ( ) , MANIFESTNAME_BINDING ) ; protocolMarshaller . marshall ( hlsManifest . getPlaylistType ( ) , PLAYLISTTYPE_BINDING ) ; protocolMarshaller . marshall ( hlsManifest . getPlaylistWindowSeconds ( ) , PLAYLISTWINDOWSECONDS_BINDING ) ; protocolMarshaller . marshall ( hlsManifest . getProgramDateTimeIntervalSeconds ( ) , PROGRAMDATETIMEINTERVALSECONDS_BINDING ) ; protocolMarshaller . marshall ( hlsManifest . getUrl ( ) , URL_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AbstrCFMLScriptTransformer { /** * Liest ein for Statement ein . < br / >
* EBNF : < br / >
* < code > expression spaces " ; " spaces condition spaces " ; " spaces expression spaces " ) " spaces block ; < / code >
* @ return for Statement
* @ throws TemplateException */
private final Statement forStatement ( Data data ) throws TemplateException { } } | int pos = data . srcCode . getPos ( ) ; // id
String id = variableDec ( data , false ) ; if ( id == null ) { data . srcCode . setPos ( pos ) ; return null ; } if ( id . equalsIgnoreCase ( "for" ) ) { id = null ; data . srcCode . removeSpace ( ) ; if ( ! data . srcCode . forwardIfCurrent ( '(' ) ) { data . srcCode . setPos ( pos ) ; return null ; } } else { data . srcCode . removeSpace ( ) ; if ( ! data . srcCode . forwardIfCurrent ( ':' ) ) { data . srcCode . setPos ( pos ) ; return null ; } data . srcCode . removeSpace ( ) ; if ( ! data . srcCode . forwardIfCurrent ( "for" , '(' ) ) { data . srcCode . setPos ( pos ) ; return null ; } } Expression left = null ; Body body = new BodyBase ( data . factory ) ; Position line = data . srcCode . getPosition ( ) ; comments ( data ) ; if ( ! data . srcCode . isCurrent ( ';' ) ) { // left
left = expression ( data ) ; comments ( data ) ; } // middle for
if ( data . srcCode . forwardIfCurrent ( ';' ) ) { Expression cont = null ; Expression update = null ; // condition
comments ( data ) ; if ( ! data . srcCode . isCurrent ( ';' ) ) { cont = condition ( data ) ; comments ( data ) ; } // middle
if ( ! data . srcCode . forwardIfCurrent ( ';' ) ) throw new TemplateException ( data . srcCode , "invalid syntax in for statement" ) ; // update
comments ( data ) ; if ( ! data . srcCode . isCurrent ( ')' ) ) { update = expression ( data ) ; comments ( data ) ; } // start )
if ( ! data . srcCode . forwardIfCurrent ( ')' ) ) throw new TemplateException ( data . srcCode , "invalid syntax in for statement, for statement must end with a [)]" ) ; // ex block
Body prior = data . setParent ( body ) ; statement ( data , body , CTX_FOR ) ; // performance improvment in special constellation
// TagLoop loop = asLoop ( data . factory , left , cont , update , body , line , data . srcCode . getPosition ( ) , id ) ;
// if ( loop ! = null ) return loop ;
data . setParent ( prior ) ; return new For ( data . factory , left , cont , update , body , line , data . srcCode . getPosition ( ) , id ) ; } // middle foreach
else if ( data . srcCode . forwardIfCurrent ( "in" ) ) { // condition
comments ( data ) ; Expression value = expression ( data ) ; comments ( data ) ; if ( ! data . srcCode . forwardIfCurrent ( ')' ) ) throw new TemplateException ( data . srcCode , "invalid syntax in for statement, for statement must end with a [)]" ) ; // ex block
Body prior = data . setParent ( body ) ; statement ( data , body , CTX_FOR ) ; data . setParent ( prior ) ; if ( ! ( left instanceof Variable ) ) throw new TemplateException ( data . srcCode , "invalid syntax in for statement, left value is invalid" ) ; // if ( ! ( value instanceof Variable ) )
// throw new TemplateException ( data . srcCode , " invalid syntax in for statement , right value is
// invalid " ) ;
return new ForEach ( ( Variable ) left , value , body , line , data . srcCode . getPosition ( ) , id ) ; } else throw new TemplateException ( data . srcCode , "invalid syntax in for statement" ) ; |
public class ServletRequestWrapper { /** * The default behavior of this method is to invoke
* { @ link ServletRequest # startAsync ( ServletRequest , ServletResponse ) }
* on the wrapped request object .
* @ param servletRequest the ServletRequest used to initialize the
* AsyncContext
* @ param servletResponse the ServletResponse used to initialize the
* AsyncContext
* @ return the ( re ) initialized AsyncContext
* @ throws IllegalStateException if the request is within the scope of
* a filter or servlet that does not support asynchronous operations
* ( that is , { @ link # isAsyncSupported } returns false ) ,
* or if this method is called again without any asynchronous dispatch
* ( resulting from one of the { @ link AsyncContext # dispatch } methods ) ,
* is called outside the scope of any such dispatch , or is called again
* within the scope of the same dispatch , or if the response has
* already been closed
* @ see ServletRequest # startAsync ( ServletRequest , ServletResponse )
* @ since Servlet 3.0 */
public AsyncContext startAsync ( ServletRequest servletRequest , ServletResponse servletResponse ) throws IllegalStateException { } } | return request . startAsync ( servletRequest , servletResponse ) ; |
public class JobInProgress { /** * Adds the failed TIP in the front of the list for non - running maps
* @ param tip the tip that needs to be failed */
private synchronized void failMap ( TaskInProgress tip ) { } } | if ( nonRunningMapCache == null ) { LOG . warn ( "Non-running cache for maps missing!! " + "Job details are missing." ) ; return ; } // 1 . Its added everywhere since other nodes ( having this split local )
// might have removed this tip from their local cache
// 2 . Give high priority to failed tip - fail early
String [ ] splitLocations = tip . getSplitLocations ( ) ; // Add the TIP in the front of the list for non - local non - running maps
if ( splitLocations . length == 0 ) { nonLocalMaps . add ( 0 , tip ) ; return ; } for ( String host : splitLocations ) { Node node = jobtracker . getNode ( host ) ; for ( int j = 0 ; j < maxLevel ; ++ j ) { List < TaskInProgress > hostMaps = nonRunningMapCache . get ( node ) ; if ( hostMaps == null ) { hostMaps = new LinkedList < TaskInProgress > ( ) ; nonRunningMapCache . put ( node , hostMaps ) ; } hostMaps . add ( 0 , tip ) ; node = node . getParent ( ) ; } } |
public class AutomationAccountsInner { /** * Lists the Automation Accounts within an Azure subscription .
* Retrieve a list of accounts within a given subscription .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; AutomationAccountInner & gt ; object */
public Observable < Page < AutomationAccountInner > > listAsync ( ) { } } | return listWithServiceResponseAsync ( ) . map ( new Func1 < ServiceResponse < Page < AutomationAccountInner > > , Page < AutomationAccountInner > > ( ) { @ Override public Page < AutomationAccountInner > call ( ServiceResponse < Page < AutomationAccountInner > > response ) { return response . body ( ) ; } } ) ; |
public class ResourceLookup { /** * Returns the stream of a resource at a given path , using the CL of a class .
* @ param path the path to search
* @ param clazz a { @ link java . lang . Class } instance which class loader should be used when doing the lookup .
* @ param useTLCL { @ code true } if the thread local class loader should be used as well , in addition to { @ code classLoader }
* @ return a { @ link java . io . InputStream } if the resource was found , or { @ code null } otherwise
* @ see org . modeshape . common . util . ResourceLookup # read ( String , ClassLoader , boolean ) */
public static InputStream read ( String path , Class < ? > clazz , boolean useTLCL ) { } } | return read ( path , clazz . getClassLoader ( ) , useTLCL ) ; |
public class LoadPermissionModifications { /** * The load permissions to remove .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setRemove ( java . util . Collection ) } or { @ link # withRemove ( java . util . Collection ) } if you want to override the
* existing values .
* @ param remove
* The load permissions to remove .
* @ return Returns a reference to this object so that method calls can be chained together . */
public LoadPermissionModifications withRemove ( LoadPermissionRequest ... remove ) { } } | if ( this . remove == null ) { setRemove ( new com . amazonaws . internal . SdkInternalList < LoadPermissionRequest > ( remove . length ) ) ; } for ( LoadPermissionRequest ele : remove ) { this . remove . add ( ele ) ; } return this ; |
public class SymbolOptions { /** * Creates SymbolOptions out of a Feature .
* @ param feature feature to be converted */
@ Nullable static SymbolOptions fromFeature ( @ NonNull Feature feature ) { } } | if ( feature . geometry ( ) == null ) { throw new RuntimeException ( "geometry field is required" ) ; } if ( ! ( feature . geometry ( ) instanceof Point ) ) { return null ; } SymbolOptions options = new SymbolOptions ( ) ; options . geometry = ( Point ) feature . geometry ( ) ; if ( feature . hasProperty ( PROPERTY_ICON_SIZE ) ) { options . iconSize = feature . getProperty ( PROPERTY_ICON_SIZE ) . getAsFloat ( ) ; } if ( feature . hasProperty ( PROPERTY_ICON_IMAGE ) ) { options . iconImage = feature . getProperty ( PROPERTY_ICON_IMAGE ) . getAsString ( ) ; } if ( feature . hasProperty ( PROPERTY_ICON_ROTATE ) ) { options . iconRotate = feature . getProperty ( PROPERTY_ICON_ROTATE ) . getAsFloat ( ) ; } if ( feature . hasProperty ( PROPERTY_ICON_OFFSET ) ) { options . iconOffset = toFloatArray ( feature . getProperty ( PROPERTY_ICON_OFFSET ) . getAsJsonArray ( ) ) ; } if ( feature . hasProperty ( PROPERTY_ICON_ANCHOR ) ) { options . iconAnchor = feature . getProperty ( PROPERTY_ICON_ANCHOR ) . getAsString ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_FIELD ) ) { options . textField = feature . getProperty ( PROPERTY_TEXT_FIELD ) . getAsString ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_FONT ) ) { options . textFont = toStringArray ( feature . getProperty ( PROPERTY_TEXT_FONT ) . getAsJsonArray ( ) ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_SIZE ) ) { options . textSize = feature . getProperty ( PROPERTY_TEXT_SIZE ) . getAsFloat ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_MAX_WIDTH ) ) { options . textMaxWidth = feature . getProperty ( PROPERTY_TEXT_MAX_WIDTH ) . getAsFloat ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_LETTER_SPACING ) ) { options . textLetterSpacing = feature . getProperty ( PROPERTY_TEXT_LETTER_SPACING ) . getAsFloat ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_JUSTIFY ) ) { options . textJustify = feature . getProperty ( PROPERTY_TEXT_JUSTIFY ) . getAsString ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_ANCHOR ) ) { options . textAnchor = feature . getProperty ( PROPERTY_TEXT_ANCHOR ) . getAsString ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_ROTATE ) ) { options . textRotate = feature . getProperty ( PROPERTY_TEXT_ROTATE ) . getAsFloat ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_TRANSFORM ) ) { options . textTransform = feature . getProperty ( PROPERTY_TEXT_TRANSFORM ) . getAsString ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_OFFSET ) ) { options . textOffset = toFloatArray ( feature . getProperty ( PROPERTY_TEXT_OFFSET ) . getAsJsonArray ( ) ) ; } if ( feature . hasProperty ( PROPERTY_ICON_OPACITY ) ) { options . iconOpacity = feature . getProperty ( PROPERTY_ICON_OPACITY ) . getAsFloat ( ) ; } if ( feature . hasProperty ( PROPERTY_ICON_COLOR ) ) { options . iconColor = feature . getProperty ( PROPERTY_ICON_COLOR ) . getAsString ( ) ; } if ( feature . hasProperty ( PROPERTY_ICON_HALO_COLOR ) ) { options . iconHaloColor = feature . getProperty ( PROPERTY_ICON_HALO_COLOR ) . getAsString ( ) ; } if ( feature . hasProperty ( PROPERTY_ICON_HALO_WIDTH ) ) { options . iconHaloWidth = feature . getProperty ( PROPERTY_ICON_HALO_WIDTH ) . getAsFloat ( ) ; } if ( feature . hasProperty ( PROPERTY_ICON_HALO_BLUR ) ) { options . iconHaloBlur = feature . getProperty ( PROPERTY_ICON_HALO_BLUR ) . getAsFloat ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_OPACITY ) ) { options . textOpacity = feature . getProperty ( PROPERTY_TEXT_OPACITY ) . getAsFloat ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_COLOR ) ) { options . textColor = feature . getProperty ( PROPERTY_TEXT_COLOR ) . getAsString ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_HALO_COLOR ) ) { options . textHaloColor = feature . getProperty ( PROPERTY_TEXT_HALO_COLOR ) . getAsString ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_HALO_WIDTH ) ) { options . textHaloWidth = feature . getProperty ( PROPERTY_TEXT_HALO_WIDTH ) . getAsFloat ( ) ; } if ( feature . hasProperty ( PROPERTY_TEXT_HALO_BLUR ) ) { options . textHaloBlur = feature . getProperty ( PROPERTY_TEXT_HALO_BLUR ) . getAsFloat ( ) ; } if ( feature . hasProperty ( PROPERTY_Z_INDEX ) ) { options . zIndex = feature . getProperty ( PROPERTY_Z_INDEX ) . getAsInt ( ) ; } if ( feature . hasProperty ( PROPERTY_IS_DRAGGABLE ) ) { options . isDraggable = feature . getProperty ( PROPERTY_IS_DRAGGABLE ) . getAsBoolean ( ) ; } return options ; |
public class AuthUtils { /** * Returns OAuth previously stored access token from HTTP session
* Null is returned if token is present but does not have requested scopes or
* the token has been expired
* @ param requestContext request context
* @ param provider token provider
* @ param scopes required scopes
* @ return OAuth previously stored access token from HTTP session */
public static OAuthAccessToken getOAuthAccessToken ( RequestContext requestContext , String provider , String ... scopes ) { } } | HttpSession session = requestContext . getRequest ( ) . getSession ( ) ; OAuthAccessToken [ ] accessTokens = ( OAuthAccessToken [ ] ) session . getAttribute ( String . format ( PROVIDER_ACCESS_TOKENS , provider ) ) ; if ( accessTokens != null ) { for ( OAuthAccessToken accessToken : accessTokens ) { List < String > accessTokenScopes = accessToken . getScopes ( ) != null ? Arrays . asList ( accessToken . getScopes ( ) ) : Collections . emptyList ( ) ; if ( scopes == null || accessTokenScopes . containsAll ( Arrays . asList ( scopes ) ) ) { if ( isOAuthTokenExpired ( accessToken ) ) { if ( "Keycloak" . equals ( provider ) ) { return getKeycloakStrategy ( ) . refreshToken ( requestContext , accessToken ) ; } } else { return accessToken ; } } } } return null ; |
public class HCHelper { /** * Find the first HTML child element within a start element . This check
* considers both lower - and upper - case element names . Mixed case is not
* supported !
* @ param aElement
* The element to search in
* @ param eHTMLElement
* The HTML element to search .
* @ return < code > null < / code > if no such child element is present . */
@ Nullable public static IMicroElement getFirstChildElement ( @ Nonnull final IMicroElement aElement , @ Nonnull final EHTMLElement eHTMLElement ) { } } | ValueEnforcer . notNull ( aElement , "element" ) ; ValueEnforcer . notNull ( eHTMLElement , "HTMLElement" ) ; // First try with lower case name
IMicroElement aChild = aElement . getFirstChildElement ( eHTMLElement . getElementName ( ) ) ; if ( aChild == null ) { // Fallback : try with upper case name
aChild = aElement . getFirstChildElement ( eHTMLElement . getElementNameUpperCase ( ) ) ; } return aChild ; |
public class FixedWidthTextSequencer { /** * Set the column start positions . The column start positions are 0 - based . Everything before the first start position is
* treated as the first column .
* As an example , if the column start positions were { 3 , 6 , 15 } and the incoming stream was :
* < pre >
* 1 2
* 012345678901234567890
* supercallifragilistic
* expialidocious
* < / pre >
* This sequencer would return the following rows :
* < pre >
* row 1 : " sup " , " erc " , " allifragi " , " listic "
* row 2 : " exp : , " ial " , " idocious "
* < / pre >
* Note that there are only three columns returned in the second row , as there were not enough characters to reach the third
* start position .
* @ param columnStartPositions the column startPositions ; may not be null */
public void setColumnStartPositions ( int [ ] columnStartPositions ) { } } | CheckArg . isNotNull ( columnStartPositions , "columnStartPositions" ) ; this . columnStartPositions = columnStartPositions ; Arrays . sort ( columnStartPositions ) ; |
public class ValueFilterAdapter { /** * { @ inheritDoc } */
@ Override public Filter adapt ( FilterAdapterContext context , ValueFilter filter ) throws IOException { } } | return toFilter ( context , filter ) ; |
public class Service { /** * < pre >
* Experimental configuration .
* < / pre >
* < code > . google . api . Experimental experimental = 101 ; < / code > */
public com . google . api . Experimental getExperimental ( ) { } } | return experimental_ == null ? com . google . api . Experimental . getDefaultInstance ( ) : experimental_ ; |
public class MathUtils { /** * This returns the sum of products for the given
* numbers .
* @ param nums the sum of products for the give numbers
* @ return the sum of products for the given numbers */
public static double sumOfProducts ( double [ ] ... nums ) { } } | if ( nums == null || nums . length < 1 ) return 0 ; double sum = 0 ; for ( int i = 0 ; i < nums . length ; i ++ ) { /* The ith column for all of the rows */
double [ ] column = column ( i , nums ) ; sum += times ( column ) ; } return sum ; |
public class Jsr353JsonFunction { /** * using fromJson ( ) function */
private static void insertFromJson ( CqlSession session ) { } } | JsonObject alice = Json . createObjectBuilder ( ) . add ( "name" , "alice" ) . add ( "age" , 30 ) . build ( ) ; JsonObject bob = Json . createObjectBuilder ( ) . add ( "name" , "bob" ) . add ( "age" , 35 ) . build ( ) ; JsonObject aliceScores = Json . createObjectBuilder ( ) . add ( "call_of_duty" , 4.8 ) . add ( "pokemon_go" , 9.7 ) . build ( ) ; JsonObject bobScores = Json . createObjectBuilder ( ) . add ( "zelda" , 8.3 ) . add ( "pokemon_go" , 12.4 ) . build ( ) ; // Build and execute a simple statement
Statement stmt = insertInto ( "examples" , "json_jsr353_function" ) . value ( "id" , literal ( 1 ) ) // client - side , the JsonObject will be converted into a JSON String ;
// then , server - side , the fromJson ( ) function will convert that JSON string
// into an instance of the json _ jsr353 _ function _ user user - defined type ( UDT ) ,
// which will be persisted into the column " user "
. value ( "user" , function ( "fromJson" , literal ( alice , session . getContext ( ) . getCodecRegistry ( ) ) ) ) // same thing , but this time converting from
// a JsonObject to a JSON string , then from this string to a map < varchar , float >
. value ( "scores" , function ( "fromJson" , literal ( aliceScores , session . getContext ( ) . getCodecRegistry ( ) ) ) ) . build ( ) ; session . execute ( stmt ) ; // The JSON object can be a bound value if the statement is prepared
// ( subsequent calls to the prepare ( ) method will return cached statement )
PreparedStatement pst = session . prepare ( insertInto ( "examples" , "json_jsr353_function" ) . value ( "id" , bindMarker ( "id" ) ) . value ( "user" , function ( "fromJson" , bindMarker ( "user" ) ) ) . value ( "scores" , function ( "fromJson" , bindMarker ( "scores" ) ) ) . build ( ) ) ; session . execute ( pst . bind ( ) . setInt ( "id" , 2 ) // note that the codec requires that the type passed to the set ( ) method
// be always JsonStructure , and not a subclass of it , such as JsonObject
. set ( "user" , bob , JsonStructure . class ) . set ( "scores" , bobScores , JsonStructure . class ) ) ; |
public class CalendarFormatterBase { /** * Format the seconds , optionally zero - padded . */
void formatSeconds ( StringBuilder b , ZonedDateTime d , int width ) { } } | zeroPad2 ( b , d . getSecond ( ) , width ) ; |
public class ElementAttributesFactory { /** * Parse the tag and return the ElementAttributes
* @ param tag
* the tag to parse
* @ return ElementAttributes */
static ElementAttributes createElementAttributes ( String tag ) { } } | // Parsing strings
// < ! - - $ includetemplate $ aggregated2 $ templatewithparams . jsp $ - - >
// or
// < ! - - $ includeblock $ aggregated2 $ $ ( block ) $ myblock $ - - >
// in order to retrieve driver , page and name attributes
Pattern pattern = Pattern . compile ( "(?<=\\$)(?:[^\\$]|\\$\\()*(?=\\$)" ) ; Matcher matcher = pattern . matcher ( tag ) ; List < String > listparameters = new ArrayList < > ( ) ; while ( matcher . find ( ) ) { listparameters . add ( matcher . group ( ) ) ; } String [ ] parameters = listparameters . toArray ( new String [ listparameters . size ( ) ] ) ; Driver driver ; String page = "" ; String name = null ; if ( parameters . length > 1 ) { driver = DriverFactory . getInstance ( parameters [ 1 ] ) ; } else { driver = DriverFactory . getInstance ( ) ; } if ( parameters . length > 2 ) { page = parameters [ 2 ] ; } if ( parameters . length > 3 ) { name = parameters [ 3 ] ; } return new ElementAttributes ( driver , page , name ) ; |
public class InodeTree { /** * Marks an inode directory as having its direct children loaded .
* @ param context journal context supplier
* @ param dir the inode directory */
public void setDirectChildrenLoaded ( Supplier < JournalContext > context , InodeDirectory dir ) { } } | mState . applyAndJournal ( context , UpdateInodeDirectoryEntry . newBuilder ( ) . setId ( dir . getId ( ) ) . setDirectChildrenLoaded ( true ) . build ( ) ) ; |
public class ConfigOption { /** * Gets the fallback keys , in the order to be checked .
* @ return The option ' s fallback keys . */
public Iterable < FallbackKey > fallbackKeys ( ) { } } | return ( fallbackKeys == EMPTY ) ? Collections . emptyList ( ) : Arrays . asList ( fallbackKeys ) ; |
public class NonBlockingCharArrayWriter { /** * Returns a copy of the input data as bytes in the correct charset .
* @ param aCharset
* The charset to be used . May not be < code > null < / code > .
* @ return an array of bytes . Never < code > null < / code > . */
@ Nonnull @ ReturnsMutableCopy public byte [ ] toByteArray ( @ Nonnull final Charset aCharset ) { } } | return StringHelper . encodeCharToBytes ( m_aBuf , 0 , m_nCount , aCharset ) ; |
public class ResourcePool { /** * With .
* @ param f the f
* @ param filter */
public void with ( @ javax . annotation . Nonnull final java . util . function . Consumer < T > f , final Predicate < T > filter ) { } } | final T prior = currentValue . get ( ) ; if ( null != prior ) { f . accept ( prior ) ; } else { final T poll = get ( filter ) ; try { currentValue . set ( poll ) ; f . accept ( poll ) ; } finally { this . pool . add ( poll ) ; currentValue . remove ( ) ; } } |
public class PaymentSettingsUrl { /** * Get Resource Url for GetThirdPartyPaymentWorkflowWithValues
* @ param fullyQualifiedName Fully qualified name of the attribute for the third - party payment workflow .
* @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter should only be used to retrieve data . Attempting to update data using this parameter may cause data loss .
* @ return String Resource Url */
public static MozuUrl getThirdPartyPaymentWorkflowWithValuesUrl ( String fullyQualifiedName , String responseFields ) { } } | UrlFormatter formatter = new UrlFormatter ( "/api/commerce/settings/checkout/paymentsettings/thirdpartyworkflow/{fullyQualifiedName}?responseFields={responseFields}" ) ; formatter . formatUrl ( "fullyQualifiedName" , fullyQualifiedName ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; |
public class AmazonDynamoDBAsyncClient { /** * Gets the values of one or more items and its attributes by primary key
* ( composite primary key , only ) .
* Narrow the scope of the query using comparison operators on the
* < code > RangeKeyValue < / code > of the composite key . Use the
* < code > ScanIndexForward < / code > parameter to get results in forward or
* reverse order by range key .
* @ param queryRequest Container for the necessary parameters to execute
* the Query operation on AmazonDynamoDB .
* @ param asyncHandler Asynchronous callback handler for events in the
* life - cycle of the request . Users could provide the implementation of
* the four callback methods in this interface to process the operation
* result or handle the exception .
* @ return A Java Future object containing the response from the Query
* service method , as returned by AmazonDynamoDB .
* @ throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response . For example
* if a network connection is not available .
* @ throws AmazonServiceException
* If an error response is returned by AmazonDynamoDB indicating
* either a problem with the data in the request , or a server side issue . */
public Future < QueryResult > queryAsync ( final QueryRequest queryRequest , final AsyncHandler < QueryRequest , QueryResult > asyncHandler ) throws AmazonServiceException , AmazonClientException { } } | return executorService . submit ( new Callable < QueryResult > ( ) { public QueryResult call ( ) throws Exception { QueryResult result ; try { result = query ( queryRequest ) ; } catch ( Exception ex ) { asyncHandler . onError ( ex ) ; throw ex ; } asyncHandler . onSuccess ( queryRequest , result ) ; return result ; } } ) ; |
public class BufferedWriter { /** * Closes the servlet output stream . */
public void close ( ) throws IOException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { // 306998.15
Tr . debug ( tc , "close" ) ; } // Were we requested to close the underlying stream ?
finish ( ) ; try { // 104771 - alert the observer that the underlying stream is being closed
obs . alertClose ( ) ; // don ' t close the underlying stream . . . we want to reuse it
// out . close ( ) ;
} catch ( Exception ex ) { com . ibm . wsspi . webcontainer . util . FFDCWrapper . processException ( ex , "com.ibm.ws.webcontainer.srt.BufferedWriter.close" , "397" , this ) ; } |
public class NativeArray { /** * Implements the methods " reduce " and " reduceRight " . */
private static Object reduceMethod ( Context cx , int id , Scriptable scope , Scriptable thisObj , Object [ ] args ) { } } | Scriptable o = ScriptRuntime . toObject ( cx , scope , thisObj ) ; long length = getLengthProperty ( cx , o , false ) ; Object callbackArg = args . length > 0 ? args [ 0 ] : Undefined . instance ; if ( callbackArg == null || ! ( callbackArg instanceof Function ) ) { throw ScriptRuntime . notFunctionError ( callbackArg ) ; } Function f = ( Function ) callbackArg ; Scriptable parent = ScriptableObject . getTopLevelScope ( f ) ; // hack to serve both reduce and reduceRight with the same loop
boolean movingLeft = id == Id_reduce ; Object value = args . length > 1 ? args [ 1 ] : Scriptable . NOT_FOUND ; for ( long i = 0 ; i < length ; i ++ ) { long index = movingLeft ? i : ( length - 1 - i ) ; Object elem = getRawElem ( o , index ) ; if ( elem == Scriptable . NOT_FOUND ) { continue ; } if ( value == Scriptable . NOT_FOUND ) { // no initial value passed , use first element found as inital value
value = elem ; } else { Object [ ] innerArgs = { value , elem , index , o } ; value = f . call ( cx , parent , parent , innerArgs ) ; } } if ( value == Scriptable . NOT_FOUND ) { // reproduce spidermonkey error message
throw ScriptRuntime . typeError0 ( "msg.empty.array.reduce" ) ; } return value ; |
public class AWSStepFunctionsClient { /** * Used by workers to retrieve a task ( with the specified activity ARN ) which has been scheduled for execution by a
* running state machine . This initiates a long poll , where the service holds the HTTP connection open and responds
* as soon as a task becomes available ( i . e . an execution of a task of this type is needed . ) The maximum time the
* service holds on to the request before responding is 60 seconds . If no task is available within 60 seconds , the
* poll returns a < code > taskToken < / code > with a null string .
* < important >
* Workers should set their client side socket timeout to at least 65 seconds ( 5 seconds higher than the maximum
* time the service may hold the poll request ) .
* Polling with < code > GetActivityTask < / code > can cause latency in some implementations . See < a
* href = " https : / / docs . aws . amazon . com / step - functions / latest / dg / bp - activity - pollers . html " > Avoid Latency When Polling
* for Activity Tasks < / a > in the Step Functions Developer Guide .
* < / important >
* @ param getActivityTaskRequest
* @ return Result of the GetActivityTask operation returned by the service .
* @ throws ActivityDoesNotExistException
* The specified activity does not exist .
* @ throws ActivityWorkerLimitExceededException
* The maximum number of workers concurrently polling for activity tasks has been reached .
* @ throws InvalidArnException
* The provided Amazon Resource Name ( ARN ) is invalid .
* @ sample AWSStepFunctions . GetActivityTask
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / states - 2016-11-23 / GetActivityTask " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public GetActivityTaskResult getActivityTask ( GetActivityTaskRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetActivityTask ( request ) ; |
public class CollectionFactory { /** * Create the most approximate map for the given map .
* < p > Creates a TreeMap or linked Map for a SortedMap or Map , respectively .
* @ param map the original Map object
* @ param initialCapacity the initial capacity
* @ return the new Map instance
* @ see java . util . TreeMap
* @ see java . util . LinkedHashMap */
@ SuppressWarnings ( "unchecked" ) public static Map createApproximateMap ( Object map , int initialCapacity ) { } } | if ( map instanceof SortedMap ) { return new TreeMap ( ( ( SortedMap ) map ) . comparator ( ) ) ; } else { return new LinkedHashMap ( initialCapacity ) ; } |
public class ImmutableConciseSet { /** * Based on the ConciseSet implementation by Alessandro Colantonio */
public IntSet . IntIterator iterator ( ) { } } | if ( isEmpty ( ) ) { return new IntSet . IntIterator ( ) { @ Override public void skipAllBefore ( int element ) { /* empty */
} @ Override public boolean hasNext ( ) { return false ; } @ Override public int next ( ) { throw new NoSuchElementException ( ) ; } @ Override public void remove ( ) { throw new UnsupportedOperationException ( ) ; } @ Override public IntSet . IntIterator clone ( ) { throw new UnsupportedOperationException ( ) ; } } ; } return new BitIterator ( ) ; |
public class RouteBuilder { /** * Extracts user segment name from route config . Returns null if no pattern match : { xxx } .
* @ param segment user segment , such as " { user _ id } " , " { fav _ color } " , etc .
* @ return the name inside the braces , " user _ id " , " fav _ color " , etc .
* Returns null if no pattern match : { xxx } . */
protected String getUserSegmentName ( String segment ) { } } | Matcher m = USER_SEGMENT_PATTERN . matcher ( segment ) ; if ( m . find ( ) ) { String value = m . group ( 0 ) ; return value . substring ( 1 , value . length ( ) - 1 ) ; // I wish I knew regexp better !
} return null ; |
public class ListStacksRequest { /** * Stack status to use as a filter . Specify one or more stack status codes to list only stacks with the specified
* status codes . For a complete list of stack status codes , see the < code > StackStatus < / code > parameter of the
* < a > Stack < / a > data type .
* @ return Stack status to use as a filter . Specify one or more stack status codes to list only stacks with the
* specified status codes . For a complete list of stack status codes , see the < code > StackStatus < / code >
* parameter of the < a > Stack < / a > data type .
* @ see StackStatus */
public java . util . List < String > getStackStatusFilters ( ) { } } | if ( stackStatusFilters == null ) { stackStatusFilters = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return stackStatusFilters ; |
public class ConjunctionContextGenerator { /** * / * ( non - Javadoc )
* @ see jvntextpro . data . ContextGenerator # getContext ( jvntextpro . data . Sentence , int ) */
@ Override public String [ ] getContext ( Sentence sent , int pos ) { } } | List < String > cps = new ArrayList < String > ( ) ; for ( int it = 0 ; it < cpnames . size ( ) ; ++ it ) { String cp = cpnames . get ( it ) ; Vector < Integer > paras = this . paras . get ( it ) ; String cpvalue = "" ; if ( cp . equals ( "syll_conj_gen" ) ) { String prefix = "s:" ; String suffix = "" ; for ( int i = 0 ; i < paras . size ( ) ; ++ i ) { if ( pos + paras . get ( i ) < 0 || pos + paras . get ( i ) >= sent . size ( ) ) { cpvalue = "" ; continue ; } prefix += paras . get ( i ) + ":" ; suffix += sent . getWordAt ( pos + paras . get ( i ) ) + ":" ; } if ( suffix . endsWith ( ":" ) ) cpvalue = prefix + suffix . substring ( 0 , suffix . length ( ) - 1 ) ; } if ( ! cpvalue . equals ( "" ) ) cps . add ( cpvalue ) ; } String [ ] ret = new String [ cps . size ( ) ] ; return cps . toArray ( ret ) ; |
public class IOUtils { /** * Reads len bytes in a loop using the channel of the stream */
public static int readFileChannelFully ( FileChannel fileChannel , byte buf [ ] , int off , int len , long offset , boolean throwOnEof ) throws IOException { } } | ByteBuffer byteBuffer = ByteBuffer . wrap ( buf , off , len ) ; int toRead = len ; int dataRead = 0 ; while ( toRead > 0 ) { int ret = fileChannel . read ( byteBuffer , offset ) ; if ( ret < 0 ) { if ( throwOnEof ) { throw new IOException ( "Premeture EOF from inputStream" ) ; } else { return dataRead ; } } toRead -= ret ; offset += ret ; dataRead += ret ; } return dataRead ; |
public class Log { /** * Generates a string with { @ code length } spaces .
* @ param length length of the string
* @ return the string */
public static String getSpaces ( int length ) { } } | char [ ] charArray = new char [ length ] ; Arrays . fill ( charArray , ' ' ) ; String str = new String ( charArray ) ; return str ; |
public class SubnetworkClient { /** * Creates a subnetwork in the specified project using the data included in the request .
* < p > Sample code :
* < pre > < code >
* try ( SubnetworkClient subnetworkClient = SubnetworkClient . create ( ) ) {
* ProjectRegionName region = ProjectRegionName . of ( " [ PROJECT ] " , " [ REGION ] " ) ;
* Subnetwork subnetworkResource = Subnetwork . newBuilder ( ) . build ( ) ;
* Operation response = subnetworkClient . insertSubnetwork ( region , subnetworkResource ) ;
* < / code > < / pre >
* @ param region Name of the region scoping this request .
* @ param subnetworkResource A Subnetwork resource . ( = = resource _ for beta . subnetworks = = ) ( = =
* resource _ for v1 . subnetworks = = )
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation insertSubnetwork ( ProjectRegionName region , Subnetwork subnetworkResource ) { } } | InsertSubnetworkHttpRequest request = InsertSubnetworkHttpRequest . newBuilder ( ) . setRegion ( region == null ? null : region . toString ( ) ) . setSubnetworkResource ( subnetworkResource ) . build ( ) ; return insertSubnetwork ( request ) ; |
public class DefaultAndroidDeferredManager { /** * If a non - Android friendly promise is passed in , wrap it with { @ link AndroidDeferredObject }
* so that callbacks can be executed in the corresponding execution scope .
* @ param scope Whether to execute in UI thread or Background thread
* @ param promise A promise
* @ return A promise wrapped in @ { link AndroidDeferredObject } */
public < D , F , P > Promise < D , F , P > when ( Promise < D , F , P > promise , AndroidExecutionScope scope ) { } } | if ( promise instanceof AndroidDeferredObject ) { return promise ; } return new AndroidDeferredObject < D , F , P > ( promise , scope ) . promise ( ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link String } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.ibm.com/websphere/wim" , name = "stateOrProvinceName" ) public JAXBElement < String > createStateOrProvinceName ( String value ) { } } | return new JAXBElement < String > ( _StateOrProvinceName_QNAME , String . class , null , value ) ; |
public class UserPreferences { /** * Additional plugins which could be used by { @ link IFindBugsEngine } ( if
* enabled ) , or which shouldn ' t be used ( if disabled ) . If a plugin is not
* included in the set , it ' s enablement depends on it ' s default settings .
* @ param customPlugins
* map with additional third party plugin locations ( as absolute
* paths ) , never null , but might be empty
* @ see Plugin # isCorePlugin ( )
* @ see Plugin # isGloballyEnabled ( ) */
public void setCustomPlugins ( Map < String , Boolean > customPlugins ) { } } | if ( customPlugins == null ) { throw new IllegalArgumentException ( "customPlugins may not be null." ) ; } this . customPlugins = customPlugins ; |
public class ModelRegistry { /** * Finds the most specific models for the given { @ link Resource } . The model ' s model
* name must match the provided model name .
* @ param resource must not be < code > null < / code > .
* @ param modelName must not be < code > null < / code > .
* @ return the resolved models , or < code > null < / code > if no such models exist . */
Collection < LookupResult > lookupMostSpecificModels ( Resource resource , String modelName ) { } } | if ( resource == null ) { throw new IllegalArgumentException ( "Method argument resource must not be null." ) ; } if ( modelName == null ) { throw new IllegalArgumentException ( "Method argument modelName must not be null." ) ; } Key key = key ( resource , modelName ) ; if ( isUnmapped ( key ) ) { return null ; } Collection < LookupResult > matchingModels = lookupFromCache ( key ) ; if ( matchingModels == null ) { final int currentStateId = this . state . get ( ) ; matchingModels = resolveMostSpecificModelSources ( resource , modelName ) ; if ( matchingModels . isEmpty ( ) ) { markAsUnmapped ( key , currentStateId ) ; } else { cache ( key , matchingModels , currentStateId ) ; } } return nullIfEmpty ( matchingModels ) ; |
public class AWSStorageGatewayClient { /** * Updates a Network File System ( NFS ) file share . This operation is only supported in the file gateway type .
* < note >
* To leave a file share field unchanged , set the corresponding input field to null .
* < / note >
* Updates the following file share setting :
* < ul >
* < li >
* Default storage class for your S3 bucket
* < / li >
* < li >
* Metadata defaults for your S3 bucket
* < / li >
* < li >
* Allowed NFS clients for your file share
* < / li >
* < li >
* Squash settings
* < / li >
* < li >
* Write status of your file share
* < / li >
* < / ul >
* < note >
* To leave a file share field unchanged , set the corresponding input field to null . This operation is only
* supported in file gateways .
* < / note >
* @ param updateNFSFileShareRequest
* UpdateNFSFileShareInput
* @ return Result of the UpdateNFSFileShare operation returned by the service .
* @ throws InvalidGatewayRequestException
* An exception occurred because an invalid gateway request was issued to the service . For more information ,
* see the error and message fields .
* @ throws InternalServerErrorException
* An internal server error has occurred during the request . For more information , see the error and message
* fields .
* @ sample AWSStorageGateway . UpdateNFSFileShare
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / storagegateway - 2013-06-30 / UpdateNFSFileShare "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateNFSFileShareResult updateNFSFileShare ( UpdateNFSFileShareRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateNFSFileShare ( request ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcVibrationIsolatorType ( ) { } } | if ( ifcVibrationIsolatorTypeEClass == null ) { ifcVibrationIsolatorTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 637 ) ; } return ifcVibrationIsolatorTypeEClass ; |
public class ExternalChildResourceImpl { /** * Add a dependency task item for this model .
* @ param dependency the dependency task item .
* @ return key to be used as parameter to taskResult ( string ) method to retrieve result the task item */
protected String addDependency ( FunctionalTaskItem dependency ) { } } | Objects . requireNonNull ( dependency ) ; return this . taskGroup ( ) . addDependency ( dependency ) ; |
public class CFMLExpressionInterpreter { /** * Transfomiert einen lierale Zeichenkette . < br / >
* EBNF : < br / >
* < code > ( " ' " { " # # " | " ' ' " | " # " impOp " # " | ? - " # " - " ' " } " ' " ) |
* ( " " " { " # # " | " " " " | " # " impOp " # " | ? - " # " - " " " } " " " ) ; < / code >
* @ return CFXD Element
* @ throws PageException */
protected Ref string ( ) throws PageException { } } | // Init Parameter
char quoter = cfml . getCurrentLower ( ) ; LStringBuffer str = new LStringBuffer ( ) ; Ref value = null ; while ( cfml . hasNext ( ) ) { cfml . next ( ) ; // check sharp
if ( ! limited && cfml . isCurrent ( '#' ) ) { if ( cfml . isNext ( '#' ) ) { cfml . next ( ) ; str . append ( '#' ) ; } else { cfml . next ( ) ; cfml . removeSpace ( ) ; if ( ! str . isEmpty ( ) || value != null ) str . append ( assignOp ( ) ) ; else value = assignOp ( ) ; cfml . removeSpace ( ) ; if ( ! cfml . isCurrent ( '#' ) ) throw new InterpreterException ( "Invalid Syntax Closing [#] not found" ) ; } } else if ( cfml . isCurrent ( quoter ) ) { if ( cfml . isNext ( quoter ) ) { cfml . next ( ) ; str . append ( quoter ) ; } else { break ; } } // all other character
else { str . append ( cfml . getCurrent ( ) ) ; } } if ( ! cfml . forwardIfCurrent ( quoter ) ) throw new InterpreterException ( "Invalid String Literal Syntax Closing [" + quoter + "] not found" ) ; cfml . removeSpace ( ) ; mode = STATIC ; if ( value != null ) { if ( str . isEmpty ( ) ) return value ; return new Concat ( value , str , limited ) ; } return str ; |
public class WdrVideoUrlParser { /** * Ermittelt die Video - URLs für einen WDR - Film
* @ param jsUrl URL für Javascript - Dateien , die Video - URLs beinhaltet
* @ return Map mit den verfügbaren Video - Qualitäten */
public WdrVideoDto parse ( String jsUrl ) { } } | WdrVideoDto dto = new WdrVideoDto ( ) ; String javascript = urlLoader . executeRequest ( jsUrl ) ; if ( javascript . isEmpty ( ) ) { return dto ; } // URL suchen
String url = getSubstring ( javascript , JS_SEARCH_ALT , "\"" ) ; String f4m = getSubstring ( javascript , JS_SEARCH_DFLT , "\"" ) ; // Fehlendes Protokoll ergänzen , wenn es fehlt . kommt teilweise vor .
String protocol = jsUrl . substring ( 0 , jsUrl . indexOf ( ':' ) ) ; url = addProtocolIfMissing ( url , protocol ) ; f4m = addProtocolIfMissing ( f4m , protocol ) ; if ( url . endsWith ( ".m3u8" ) ) { fillUrlsFromM3u8 ( dto , url ) ; } if ( ! f4m . isEmpty ( ) && url . contains ( "_" ) && url . endsWith ( ".mp4" ) ) { fillUrlsFromf4m ( dto , f4m , url ) ; } dto . setSubtitleUrl ( addProtocolIfMissing ( getSubstring ( javascript , "\"captionURL\":\"" , "\"" ) , protocol ) ) ; return dto ; |
public class NettyClient { /** * Avoid channel double close */
void closeChannel ( final Channel channel ) { } } | synchronized ( channelClosing ) { if ( closingChannel . contains ( channel ) ) { LOG . info ( channel . toString ( ) + " has already been closed" ) ; return ; } closingChannel . add ( channel ) ; } LOG . debug ( channel . toString ( ) + " begin to close" ) ; ChannelFuture closeFuture = channel . close ( ) ; closeFuture . addListener ( new ChannelFutureListener ( ) { public void operationComplete ( ChannelFuture future ) throws Exception { synchronized ( channelClosing ) { closingChannel . remove ( channel ) ; } LOG . debug ( channel . toString ( ) + " closed." ) ; } } ) ; |
public class TextMateGenerator2 { /** * Generate the rules for the annotations .
* @ return the rules . */
protected List < Map < String , ? > > generateAnnotations ( ) { } } | final List < Map < String , ? > > list = new ArrayList < > ( ) ; list . add ( pattern ( it -> { it . matches ( "\\@[_a-zA-Z$][_0-9a-zA-Z$]*" ) ; // $ NON - NLS - 1 $
it . style ( ANNOTATION_STYLE ) ; it . comment ( "Annotations" ) ; // $ NON - NLS - 1 $
} ) ) ; return list ; |
public class LevenbergMarquardt { /** * Performs sanity checks on the input data and reshapes internal matrices . By reshaping
* a matrix it will only declare new memory when needed . */
protected void configure ( ResidualFunction function , int numParam ) { } } | this . function = function ; int numFunctions = function . numFunctions ( ) ; // reshaping a matrix means that new memory is only declared when needed
candidateParameters . reshape ( numParam , 1 ) ; g . reshape ( numParam , 1 ) ; H . reshape ( numParam , numParam ) ; negativeStep . reshape ( numParam , 1 ) ; // Normally these variables are thought of as row vectors , but it works out easier if they are column
temp0 . reshape ( numFunctions , 1 ) ; temp1 . reshape ( numFunctions , 1 ) ; residuals . reshape ( numFunctions , 1 ) ; jacobian . reshape ( numFunctions , numParam ) ; |
public class CsvOpenCSV { /** * - - - OBJECT TO COLLECTION CONVERTER - - - */
protected static final Collection < ? > objectToCollection ( Object object ) { } } | Collection < ? > collection = null ; if ( object != null ) { if ( object instanceof Collection ) { collection = ( Collection < ? > ) object ; } else if ( object instanceof Map ) { collection = ( ( Map < ? , ? > ) object ) . values ( ) ; } else if ( object . getClass ( ) . isArray ( ) ) { LinkedList < Object > list = new LinkedList < Object > ( ) ; int len = Array . getLength ( object ) ; for ( int i = 0 ; i < len ; i ++ ) { list . addLast ( Array . get ( object , i ) ) ; } collection = list ; } else { collection = Collections . singleton ( object ) ; } } return collection ; |
public class WFG { /** * Gets the x vector */
public float [ ] calculateX ( float [ ] t ) { } } | float [ ] x = new float [ m ] ; for ( int i = 0 ; i < m - 1 ; i ++ ) { x [ i ] = Math . max ( t [ m - 1 ] , a [ i ] ) * ( t [ i ] - ( float ) 0.5 ) + ( float ) 0.5 ; } x [ m - 1 ] = t [ m - 1 ] ; return x ; |
public class KryoTranscoderFactory { /** * Gets / creates a single instance of { @ link KryoTranscoder } .
* @ param classLoader the class loader of the web app container / context .
* @ return for all invocations the same instance of { @ link KryoTranscoder } . */
private KryoTranscoder getTranscoder ( final ClassLoader classLoader ) { } } | if ( _transcoder == null ) { final int initialBufferSize = getSysPropValue ( PROP_INIT_BUFFER_SIZE , KryoTranscoder . DEFAULT_INITIAL_BUFFER_SIZE ) ; final int maxBufferSize = getSysPropValue ( PROP_ENV_MAX_BUFFER_SIZE , KryoTranscoder . DEFAULT_MAX_BUFFER_SIZE ) ; final String defaultSerializerFactory = getSysPropValue ( PROP_ENV_DEFAULT_FACTORY , KryoTranscoder . DEFAULT_SERIALIZER_FACTORY_CLASS ) ; _transcoder = new KryoTranscoder ( classLoader , _customConverterClassNames , _copyCollectionsForSerialization , initialBufferSize , maxBufferSize , defaultSerializerFactory ) ; } return _transcoder ; |
public class Proxy { /** * Specify which proxy to use for FTP connections .
* @ param ftpProxy the proxy host , expected format is < code > hostname . com : 1234 < / code >
* @ return reference to self */
public Proxy setFtpProxy ( String ftpProxy ) { } } | verifyProxyTypeCompatibility ( ProxyType . MANUAL ) ; this . proxyType = ProxyType . MANUAL ; this . ftpProxy = ftpProxy ; return this ; |
public class PatternFileFilter { /** * Creates a new List containing an include - mode PatternFileFilter using the supplied patternStrings which
* are interpreted as file suffixes . ( I . e . prepended with { @ code PATTERN _ LETTER _ DIGIT _ PUNCT } and compiled to
* Patterns ) . The { @ code FILE _ PATH _ CONVERTER } is used to convert Files to strings .
* @ param patterns A List of suffix patterns to be used in creating a new ExclusionRegularExpressionFileFilter .
* @ param log The active Maven Log .
* @ return A List containing a PatternFileFilter using the supplied suffix patterns to match Files .
* @ see PatternFileFilter */
public static List < Filter < File > > createIncludeFilterList ( final Log log , final String ... patterns ) { } } | return createFilterList ( log , true , patterns ) ; |
public class CmsDetailOnlyContainerUtil { /** * Checks whether the given resource path is of a detail containers page . < p >
* @ param cms the cms context
* @ param detailContainersPage the resource site path
* @ return < code > true < / code > if the given resource path is of a detail containers page */
public static boolean isDetailContainersPage ( CmsObject cms , String detailContainersPage ) { } } | boolean result = false ; try { String detailName = CmsResource . getName ( detailContainersPage ) ; String parentFolder = CmsResource . getParentFolder ( detailContainersPage ) ; if ( ! parentFolder . endsWith ( "/" + DETAIL_CONTAINERS_FOLDER_NAME + "/" ) ) { // this will be the case for locale dependent detail only pages , move one level up
parentFolder = CmsResource . getParentFolder ( parentFolder ) ; } detailName = CmsStringUtil . joinPaths ( CmsResource . getParentFolder ( parentFolder ) , detailName ) ; result = parentFolder . endsWith ( "/" + DETAIL_CONTAINERS_FOLDER_NAME + "/" ) && cms . existsResource ( detailName , CmsResourceFilter . IGNORE_EXPIRATION ) ; } catch ( Throwable t ) { // may happen in case string operations fail
LOG . debug ( t . getLocalizedMessage ( ) , t ) ; } return result ; |
public class TcpServerTransport { /** * Creates a new instance
* @ param address the address to bind to
* @ return a new instance
* @ throws NullPointerException if { @ code address } is { @ code null } */
public static TcpServerTransport create ( InetSocketAddress address ) { } } | Objects . requireNonNull ( address , "address must not be null" ) ; return create ( address . getHostName ( ) , address . getPort ( ) ) ; |
public class MouseHeadless { /** * Update coordinate from event .
* @ param event event consumed . */
private void updateCoord ( MouseEvent event ) { } } | oldX = x ; oldY = y ; x = event . getX ( ) ; y = event . getY ( ) ; mx = x - oldX ; my = y - oldY ; |
public class ApplicationLauncher { /** * Returns an { @ code ApplicationContext } , loaded from the bean definition
* files at the classpath - relative locations specified by
* { @ code configLocations } .
* If a splash screen has been created , the application context will be
* loaded with a bean post processor that will notify the splash screen ' s
* progress monitor as each bean is initialized .
* @ param configLocations The classpath - relative locations of the files from
* which the application context will be loaded .
* @ return The main application context , never null . */
private ApplicationContext loadRootApplicationContext ( String [ ] configLocations , MessageSource messageSource ) { } } | final ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext ( configLocations , false ) ; if ( splashScreen instanceof MonitoringSplashScreen ) { final ProgressMonitor tracker = ( ( MonitoringSplashScreen ) splashScreen ) . getProgressMonitor ( ) ; applicationContext . addBeanFactoryPostProcessor ( new ProgressMonitoringBeanFactoryPostProcessor ( tracker ) ) ; } applicationContext . refresh ( ) ; return applicationContext ; |
public class ListFunctionsResult { /** * A list of Lambda functions .
* @ return A list of Lambda functions . */
public java . util . List < FunctionConfiguration > getFunctions ( ) { } } | if ( functions == null ) { functions = new com . amazonaws . internal . SdkInternalList < FunctionConfiguration > ( ) ; } return functions ; |
public class AdminSchedulerAction { @ Execute public HtmlResponse createnewjob ( final String type , final String id , final String name ) { } } | saveToken ( ) ; return asHtml ( path_AdminScheduler_AdminSchedulerEditJsp ) . useForm ( CreateForm . class , op -> { op . setup ( scheduledJobForm -> { scheduledJobForm . initialize ( ) ; scheduledJobForm . crudMode = CrudMode . CREATE ; scheduledJobForm . jobLogging = Constants . ON ; scheduledJobForm . crawler = Constants . ON ; scheduledJobForm . available = Constants . ON ; scheduledJobForm . cronExpression = null ; final String decodedName = new String ( Base64 . getUrlDecoder ( ) . decode ( name ) , Constants . CHARSET_UTF_8 ) ; scheduledJobForm . name = MessageFormat . format ( fessConfig . getJobTemplateTitle ( type ) , decodedName ) ; final String [ ] ids = new String [ ] { "" , "" , "" } ; if ( Constants . WEB_CRAWLER_TYPE . equals ( type ) ) { ids [ 0 ] = "\"" + id + "\"" ; } else if ( Constants . FILE_CRAWLER_TYPE . equals ( type ) ) { ids [ 1 ] = "\"" + id + "\"" ; } else if ( Constants . DATA_CRAWLER_TYPE . equals ( type ) ) { ids [ 2 ] = "\"" + id + "\"" ; } scheduledJobForm . scriptData = MessageFormat . format ( fessConfig . getJobTemplateScript ( ) , ids [ 0 ] , ids [ 1 ] , ids [ 2 ] , id ) ; } ) ; } ) ; |
public class Colors { /** * < p > toRGB . < / p >
* @ param color a { @ link java . awt . Color } object .
* @ return a { @ link java . lang . String } object . */
public static String toRGB ( Color color ) { } } | String rgb = "#" ; rgb += formatAsHex ( color . getRed ( ) ) ; rgb += formatAsHex ( color . getGreen ( ) ) ; rgb += formatAsHex ( color . getBlue ( ) ) ; return rgb ; |
public class CollectionDiff { /** * Compare and find out the difference between two collections .
* The comparison depends on hashCode ( . . . ) and equals ( . . . ) methods of the elements .
* @ param lhsleft hand side
* @ param rhsright hand side
* @ returnthe result with information about elements only in lhs , only in rhs , and in both . */
public static < T > Result < T > compare ( Collection < T > lhs , Collection < T > rhs ) { } } | Set < T > onlyInLhs = new HashSet < T > ( lhs ) ; onlyInLhs . removeAll ( rhs ) ; Set < T > inBoth = new HashSet < T > ( lhs ) ; inBoth . removeAll ( onlyInLhs ) ; Set < T > onlyInRhs = new HashSet < T > ( rhs ) ; onlyInRhs . removeAll ( inBoth ) ; return new Result < T > ( onlyInLhs , onlyInRhs , inBoth ) ; |
public class FluxUtil { /** * Gets the content of the provided ByteBuf as a byte array .
* This method will create a new byte array even if the ByteBuf can
* have optionally backing array .
* @ param byteBuf the byte buffer
* @ return the byte array */
public static byte [ ] byteBufToArray ( ByteBuf byteBuf ) { } } | int length = byteBuf . readableBytes ( ) ; byte [ ] byteArray = new byte [ length ] ; byteBuf . getBytes ( byteBuf . readerIndex ( ) , byteArray ) ; return byteArray ; |
public class AdminCommand { /** * Parses command - line and directs to command groups or non - grouped
* sub - commands .
* @ param args Command - line input
* @ throws Exception */
public static void executeCommand ( String [ ] args ) throws Exception { } } | String subCmd = ( args . length > 0 ) ? args [ 0 ] : "" ; args = AdminToolUtils . copyArrayCutFirst ( args ) ; if ( subCmd . equals ( "async-job" ) ) { AdminCommandAsyncJob . executeCommand ( args ) ; } else if ( subCmd . equals ( "scheduled" ) ) { AdminCommandScheduled . executeCommand ( args ) ; } else if ( subCmd . equals ( "cleanup" ) ) { AdminCommandCleanup . executeCommand ( args ) ; } else if ( subCmd . equals ( "debug" ) ) { AdminCommandDebug . executeCommand ( args ) ; } else if ( subCmd . equals ( "meta" ) ) { AdminCommandMeta . executeCommand ( args ) ; } else if ( subCmd . equals ( "quota" ) ) { AdminCommandQuota . executeCommand ( args ) ; } else if ( subCmd . equals ( "store" ) ) { AdminCommandStore . executeCommand ( args ) ; } else if ( subCmd . equals ( "stream" ) ) { AdminCommandStream . executeCommand ( args ) ; } else if ( subCmd . equals ( "help" ) || subCmd . equals ( "--help" ) || subCmd . equals ( "-h" ) ) { executeHelp ( args , System . out ) ; } else { args = AdminToolUtils . copyArrayAddFirst ( args , subCmd ) ; AdminCommandOther . executeCommand ( args ) ; } |
public class AxisAngle4f { /** * Transform the given vector by the rotation transformation described by this { @ link AxisAngle4f }
* and store the result in < code > dest < / code > .
* @ param v
* the vector to transform
* @ param dest
* will hold the result
* @ return dest */
public Vector4f transform ( Vector4fc v , Vector4f dest ) { } } | double sin = Math . sin ( angle ) ; double cos = Math . cosFromSin ( sin , angle ) ; float dot = x * v . x ( ) + y * v . y ( ) + z * v . z ( ) ; dest . set ( ( float ) ( v . x ( ) * cos + sin * ( y * v . z ( ) - z * v . y ( ) ) + ( 1.0 - cos ) * dot * x ) , ( float ) ( v . y ( ) * cos + sin * ( z * v . x ( ) - x * v . z ( ) ) + ( 1.0 - cos ) * dot * y ) , ( float ) ( v . z ( ) * cos + sin * ( x * v . y ( ) - y * v . x ( ) ) + ( 1.0 - cos ) * dot * z ) , dest . w ) ; return dest ; |
public class JvmTypesBuilder { /** * Adds or removes the annotation { @ link Extension @ Extension } from the given field . If the annotation is
* already present , nothing is done if { @ code value } is { @ code true } . If it is not present and { @ code value }
* is { @ code false } , this is a no - op , too .
* @ param field the field that will be processed
* @ param sourceElement the context that shall be used to lookup the { @ link Extension annotation type } .
* @ param value < code > true < / code > if the parameter shall be marked as extension , < code > false < / code > if it should be unmarked . */
public void setExtension ( /* @ Nullable */
JvmField field , EObject sourceElement , boolean value ) { } } | if ( field == null ) return ; internalSetExtension ( field , sourceElement , value ) ; |
public class PropertyLoader { /** * Get collection element type for given type . Given type type should
* be assignable from { @ link Collection } . For collections without
* generic returns { @ link String } . */
protected Class < ? > getCollectionElementType ( Type genericType ) throws ConversionException { } } | if ( genericType instanceof ParameterizedType ) { ParameterizedType parameterizedType = ( ParameterizedType ) genericType ; Type [ ] typeArguments = parameterizedType . getActualTypeArguments ( ) ; if ( typeArguments . length != 1 ) { throw new ConversionException ( "Types with more then one generic are not supported" ) ; } Type type = typeArguments [ 0 ] ; if ( type instanceof Class ) { return ( Class < ? > ) type ; } throw new ConversionException ( String . format ( "Could not resolve generic type <%s>" , type ) ) ; } return String . class ; |
public class AbstractExcelWriter { /** * 获取属性名到标题单元格样式的映射
* @ return 返回属性名到标题单元格样式的映射 */
public Map < String , CellStyle > getTitleCellStyleMapping ( ) { } } | if ( null == this . titleCellStyleMapping ) { this . titleCellStyleMapping = new HashMap < String , CellStyle > ( 16 ) ; } return titleCellStyleMapping ; |
public class JainMgcpStackImpl { /** * Closes the stack and it ' s underlying resources . */
public void close ( ) { } } | stopped = true ; try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Closing socket" ) ; } // selector . close ( ) ;
socket . close ( ) ; if ( this . channel != null ) { this . channel . close ( ) ; } for ( int i = 0 ; i < decodingThreads . length ; i ++ ) { decodingThreads [ i ] . shutdown ( ) ; } } catch ( Exception e ) { if ( logger . isErrorEnabled ( ) ) { logger . error ( "Could not gracefully close socket" , e ) ; } } |
public class DataRow { /** * Returns this row in { @ link ObjectNode } representation .
* @ return this row in { @ link ObjectNode } representation */
public JsonNode toJsonObject ( ) { } } | ObjectNode node = new ObjectMapper ( ) . createObjectNode ( ) ; if ( id != null ) { node . put ( "id" , id ) ; } for ( DataColumn column : columns ) { String value = content . get ( column ) ; if ( value != null ) { node . put ( column . getCode ( ) , value ) ; } else { node . put ( column . getCode ( ) , "" ) ; } } return node ; |
public class Layout { /** * Do post exam of child inside the layout after it has been positioned in parent
* @ param dataIndex data index */
protected void postLayoutChild ( final int dataIndex ) { } } | if ( ! mContainer . isDynamic ( ) ) { boolean visibleInLayout = ! mViewPort . isClippingEnabled ( ) || inViewPort ( dataIndex ) ; ViewPortVisibility visibility = visibleInLayout ? ViewPortVisibility . FULLY_VISIBLE : ViewPortVisibility . INVISIBLE ; Log . d ( Log . SUBSYSTEM . LAYOUT , TAG , "onLayout: child with dataId [%d] viewportVisibility = %s" , dataIndex , visibility ) ; Widget childWidget = mContainer . get ( dataIndex ) ; if ( childWidget != null ) { childWidget . setViewPortVisibility ( visibility ) ; } } |
public class ISOBlueDemo { /** * Sends a message .
* @ param message
* A string of text to send . */
private void sendMessage ( org . isoblue . isobus . Message message ) { } } | // Check that we ' re actually connected before trying anything
if ( mChatService . getState ( ) != BluetoothService . STATE_CONNECTED ) { Toast . makeText ( this , R . string . not_connected , Toast . LENGTH_SHORT ) . show ( ) ; return ; } // Get the message bytes and tell the BluetoothChatService to write
mChatService . write ( message ) ; // Reset out string buffer to zero and clear the edit text field
mOutStringBuffer . setLength ( 0 ) ; |
public class IntermediateResult { /** * Returns the partition with the given ID .
* @ param resultPartitionId ID of the partition to look up
* @ throws NullPointerException If partition ID < code > null < / code >
* @ throws IllegalArgumentException Thrown if unknown partition ID
* @ return Intermediate result partition with the given ID */
public IntermediateResultPartition getPartitionById ( IntermediateResultPartitionID resultPartitionId ) { } } | // Looks ups the partition number via the helper map and returns the
// partition . Currently , this happens infrequently enough that we could
// consider removing the map and scanning the partitions on every lookup .
// The lookup ( currently ) only happen when the producer of an intermediate
// result cannot be found via its registered execution .
Integer partitionNumber = partitionLookupHelper . get ( checkNotNull ( resultPartitionId , "IntermediateResultPartitionID" ) ) ; if ( partitionNumber != null ) { return partitions [ partitionNumber ] ; } else { throw new IllegalArgumentException ( "Unknown intermediate result partition ID " + resultPartitionId ) ; } |
public class CmsPrincipalSelection { /** * Opens the popup of this widget . < p > */
protected void open ( ) { } } | m_oldValue = m_selectionInput . m_textbox . getValue ( ) ; CmsEmbeddedDialogHandler handler = new CmsEmbeddedDialogHandler ( ) ; handler . setPrincipleSelectHandler ( new I_CmsPrincipalSelectHandler ( ) { public void selectPrincipal ( String principal ) { if ( ! getFormValue ( ) . equals ( principal ) ) { setFormValueAsString ( principal ) ; fireValueChange ( principal ) ; } } } ) ; handler . openDialog ( DIALOG_ID , null , null , m_configuration ) ; |
public class AsyncResponse { /** * 已字符串信息获取返回数据
* @ return */
public String getDataString ( ) { } } | if ( exception == null ) { try { if ( ! setDataString ) { dataString = EntityUtils . toString ( httpEntity , charset . charset ) ; setDataString = true ; } } catch ( IOException e ) { e . printStackTrace ( ) ; return null ; } } return dataString ; |
public class Benchmark { /** * main program
* creates a 1 - tps database :
* i . e . 1 branch , 10 tellers , . . .
* runs one TPC BM B transaction */
public void run ( String [ ] args ) { } } | String DriverName = "" ; String DBUrl = "" ; String DBUser = "" ; String DBPassword = "" ; boolean initialize_dataset = false ; for ( int i = 0 ; i < args . length ; i ++ ) { if ( args [ i ] . equals ( "-clients" ) ) { if ( i + 1 < args . length ) { i ++ ; n_clients = Integer . parseInt ( args [ i ] ) ; } } else if ( args [ i ] . equals ( "-driver" ) ) { if ( i + 1 < args . length ) { i ++ ; DriverName = args [ i ] ; } } else if ( args [ i ] . equals ( "-url" ) ) { if ( i + 1 < args . length ) { i ++ ; DBUrl = args [ i ] ; } } else if ( args [ i ] . equals ( "-user" ) ) { if ( i + 1 < args . length ) { i ++ ; DBUser = args [ i ] ; } } else if ( args [ i ] . equals ( "-password" ) ) { if ( i + 1 < args . length ) { i ++ ; DBPassword = args [ i ] ; } } else if ( args [ i ] . equals ( "-tpc" ) ) { if ( i + 1 < args . length ) { i ++ ; n_txn_per_client = Integer . parseInt ( args [ i ] ) ; } } else if ( args [ i ] . equals ( "-init" ) ) { initialize_dataset = true ; } else if ( args [ i ] . equals ( "-tps" ) ) { if ( i + 1 < args . length ) { i ++ ; tps = Integer . parseInt ( args [ i ] ) ; } } else if ( args [ i ] . equals ( "-v" ) ) { verbose = true ; } } if ( DriverName . length ( ) == 0 || DBUrl . length ( ) == 0 ) { System . out . println ( "JDBC based benchmark program\n\n" + "JRE usage:\n\njava jsqlite.BenchmarkDriver " + "-url [url_to_db] \\\n " + "[-user [username]] " + "[-password [password]] " + "[-driver [driver_class_name]] \\\n " + "[-v] [-init] [-tpc N] [-tps N] " + "[-clients N]\n" ) ; System . out . println ( "OJEC usage:\n\ncvm jsqlite.BenchmarkDataSource " + "[-user [username]] " + "[-password [password]] " + "[-driver [driver_class_name]] \\\n " + "[-v] [-init] [-tpc N] [-tps N] " + "[-clients N]\n" ) ; System . out . println ( ) ; System . out . println ( "-v verbose mode" ) ; System . out . println ( "-init initialize the tables" ) ; System . out . println ( "-tpc N transactions per client" ) ; System . out . println ( "-tps N scale factor" ) ; System . out . println ( "-clients N number of simultaneous clients/threads" ) ; System . out . println ( ) ; System . out . println ( "Default driver class is jsqlite.JDBCDriver" ) ; System . out . println ( "in this case use an -url parameter of the form" ) ; System . out . println ( " jdbc:sqlite:/[path]" ) ; System . exit ( 1 ) ; } System . out . println ( "Driver: " + DriverName ) ; System . out . println ( "URL:" + DBUrl ) ; System . out . println ( ) ; System . out . println ( "Scale factor value: " + tps ) ; System . out . println ( "Number of clients: " + n_clients ) ; System . out . println ( "Number of transactions per client: " + n_txn_per_client ) ; System . out . println ( ) ; try { benchmark ( DBUrl , DBUser , DBPassword , initialize_dataset ) ; } catch ( java . lang . Exception e ) { System . out . println ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; } |
public class ConciseSet { /** * { @ inheritDoc } */
public boolean contains ( int o ) { } } | if ( isEmpty ( ) || o > last || o < 0 ) { return false ; } // check if the element is within a literal word
int block = maxLiteralLengthDivision ( o ) ; int bit = maxLiteralLengthModulus ( o ) ; for ( int i = 0 ; i <= lastWordIndex ; i ++ ) { final int w = words [ i ] ; final int t = w & 0xC0000000 ; // the first two bits . . .
switch ( t ) { case 0x80000000 : // LITERAL
case 0xC0000000 : // LITERAL
// check if the current literal word is the " right " one
if ( block == 0 ) { return ( w & ( 1 << bit ) ) != 0 ; } block -- ; break ; case 0x00000000 : // ZERO SEQUENCE
if ( ! simulateWAH ) { if ( block == 0 && ( ( w >> 25 ) - 1 ) == bit ) { return true ; } } block -= getSequenceCount ( w ) + 1 ; if ( block < 0 ) { return false ; } break ; case 0x40000000 : // ONE SEQUENCE
if ( ! simulateWAH ) { if ( block == 0 && ( 0x0000001F & ( w >> 25 ) - 1 ) == bit ) { return false ; } } block -= getSequenceCount ( w ) + 1 ; if ( block < 0 ) { return true ; } break ; } } // no more words
return false ; |
public class TilesOverlay { /** * Get the area we are drawing to
* @ since 6.0.0
* @ return true if the tiles are to be drawn */
protected boolean setViewPort ( final Canvas pCanvas , final Projection pProjection ) { } } | setProjection ( pProjection ) ; getProjection ( ) . getMercatorViewPort ( mViewPort ) ; return true ; |
public class ColtUtils { /** * Returns v = v1 + c * v2.
* Useful in avoiding the need of the copy ( ) in the colt api . */
public static final DoubleMatrix1D add ( DoubleMatrix1D v1 , DoubleMatrix1D v2 , double c ) { } } | if ( v1 . size ( ) != v2 . size ( ) ) { throw new IllegalArgumentException ( "wrong vectors dimensions" ) ; } DoubleMatrix1D ret = DoubleFactory1D . dense . make ( v1 . size ( ) ) ; for ( int i = 0 ; i < ret . size ( ) ; i ++ ) { ret . setQuick ( i , v1 . getQuick ( i ) + c * v2 . getQuick ( i ) ) ; } return ret ; |
public class KamSummarizer { /** * Summarize nodes and edges
* @ param edges
* @ param annotationStatements
* @ return */
public static KamSummary summarizeKamNetwork ( Collection < KamEdge > edges , int statementCount ) { } } | KamSummary summary = new KamSummary ( ) ; Set < KamNode > nodes = new HashSet < KamNode > ( ) ; // unique set of nodes
for ( KamEdge edge : edges ) { nodes . add ( edge . getSourceNode ( ) ) ; nodes . add ( edge . getTargetNode ( ) ) ; } summary . setNumOfBELStatements ( statementCount ) ; summary . setNumOfNodes ( nodes . size ( ) ) ; summary . setNumOfEdges ( edges . size ( ) ) ; return summary ; |
public class SVGParser { /** * Parse stroke - linecap */
private static Style . LineCap parseStrokeLineCap ( String val ) { } } | if ( "butt" . equals ( val ) ) return Style . LineCap . Butt ; if ( "round" . equals ( val ) ) return Style . LineCap . Round ; if ( "square" . equals ( val ) ) return Style . LineCap . Square ; return null ; |
public class DecoupledInjectedAttribute { /** * We use a factory method here because we will not be using the same buffer specified for this method , so we
* require a bit of processing before actually calling a constructor ( not that this could not be done at the
* constructor , but it gives us higher flexibility this way . Maybe in the future we reuse instances or something . . . */
public static DecoupledInjectedAttribute createAttribute ( final char [ ] buffer , final int nameOffset , final int nameLen , final int operatorOffset , final int operatorLen , final int valueContentOffset , final int valueContentLen , final int valueOuterOffset , final int valueOuterLen ) { } } | final char [ ] newBuffer = new char [ nameLen + operatorLen + valueOuterLen ] ; System . arraycopy ( buffer , nameOffset , newBuffer , 0 , nameLen ) ; System . arraycopy ( buffer , operatorOffset , newBuffer , nameLen , operatorLen ) ; System . arraycopy ( buffer , valueOuterOffset , newBuffer , ( nameLen + operatorLen ) , valueOuterLen ) ; return new DecoupledInjectedAttribute ( newBuffer , 0 , nameLen , ( operatorOffset - nameOffset ) , operatorLen , ( valueContentOffset - nameOffset ) , valueContentLen , ( valueOuterOffset - nameOffset ) , valueOuterLen ) ; |
public class PDTWebDateHelper { /** * create a W3C Date Time representation of a date .
* @ param aDateTime
* Date to print . May not be < code > null < / code > .
* @ return the W3C Date Time represented by the given Date . */
@ Nullable public static String getAsStringW3C ( @ Nullable final LocalDateTime aDateTime ) { } } | if ( aDateTime == null ) return null ; return getAsStringW3C ( aDateTime . atOffset ( ZoneOffset . UTC ) ) ; |
public class SwaggerBuilder { /** * Determines if this controller handler can be registered in the Swagger specification .
* @ param route
* @ param handler
* @ return true if the controller handler can be registered in the Swagger specification */
protected boolean canRegister ( Route route , ControllerHandler handler ) { } } | if ( ! METHODS . contains ( route . getRequestMethod ( ) . toUpperCase ( ) ) ) { log . debug ( "Skip {} {}, {} Swagger does not support specified HTTP method" , route . getRequestMethod ( ) , route . getUriPattern ( ) , Util . toString ( handler . getControllerMethod ( ) ) ) ; return false ; } List < String > produces = handler . getDeclaredProduces ( ) ; if ( produces . isEmpty ( ) ) { log . debug ( "Skip {} {}, {} does not declare @Produces" , route . getRequestMethod ( ) , route . getUriPattern ( ) , Util . toString ( handler . getControllerMethod ( ) ) ) ; return false ; } if ( handler . getDeclaredReturns ( ) . isEmpty ( ) ) { log . debug ( "Skip {} {}, {} does not declare expected @Returns" , route . getRequestMethod ( ) , route . getUriPattern ( ) , Util . toString ( handler . getControllerMethod ( ) ) ) ; return false ; } if ( handler . getControllerMethod ( ) . isAnnotationPresent ( Undocumented . class ) || handler . getControllerMethod ( ) . getDeclaringClass ( ) . isAnnotationPresent ( Undocumented . class ) ) { log . debug ( "Skip {} {}, {} is annotated as @Undocumented" , route . getRequestMethod ( ) , route . getUriPattern ( ) , Util . toString ( handler . getControllerMethod ( ) ) ) ; return false ; } if ( ! route . getUriPattern ( ) . startsWith ( relativeSwaggerBasePath ) ) { log . debug ( "Skip {} {}, {} route is not within Swagger basePath '{}'" , route . getRequestMethod ( ) , route . getUriPattern ( ) , Util . toString ( handler . getControllerMethod ( ) ) , relativeSwaggerBasePath ) ; return false ; } return true ; |
public class AlpineParser { /** * / * - - - Private methods - - - */
private DependencyInfo createDependencyInfo ( Package packageInfo ) { } } | DependencyInfo dependencyInfo = null ; if ( StringUtils . isNotBlank ( packageInfo . getPackageName ( ) ) && StringUtils . isNotBlank ( packageInfo . getVersion ( ) ) && StringUtils . isNotBlank ( packageInfo . getArchitecture ( ) ) ) { dependencyInfo = new DependencyInfo ( null , MessageFormat . format ( ALPINE_PACKAGE_PATTERN , packageInfo . getPackageName ( ) + Constants . DASH + packageInfo . getVersion ( ) ) , packageInfo . getVersion ( ) + Constants . DASH + packageInfo . getArchitecture ( ) ) ; } if ( dependencyInfo != null ) { return dependencyInfo ; } else { return null ; } |
public class KafkaClient { /** * Sends a message asynchronously , specifying { @ link ProducerType } .
* This methods returns the underlying Kafka producer ' s output directly to
* caller , not converting { @ link RecordMetadata } to { @ link KafkaMessage } .
* @ param type
* @ param message
* @ param callback
* @ return
* @ since 1.3.1 */
public Future < RecordMetadata > sendMessageRaw ( ProducerType type , KafkaMessage message , Callback callback ) { } } | String key = message . key ( ) ; ProducerRecord < String , byte [ ] > record = StringUtils . isEmpty ( key ) ? new ProducerRecord < > ( message . topic ( ) , message . content ( ) ) : new ProducerRecord < > ( message . topic ( ) , key , message . content ( ) ) ; KafkaProducer < String , byte [ ] > producer = getJavaProducer ( type ) ; return producer . send ( record , callback ) ; |
public class CmsSecurityManager { /** * Undos all changes in the resource by restoring the version from the
* online project to the current offline project . < p >
* @ param context the current request context
* @ param resource the name of the resource to apply this operation to
* @ param mode the undo mode , one of the < code > { @ link CmsResource } # UNDO _ XXX < / code > constants
* @ throws CmsException if something goes wrong
* @ throws CmsSecurityException if the user has insufficient permission for the given resource ( write access permission is required )
* @ see CmsObject # undoChanges ( String , CmsResource . CmsResourceUndoMode )
* @ see org . opencms . file . types . I _ CmsResourceType # undoChanges ( CmsObject , CmsSecurityManager , CmsResource , CmsResource . CmsResourceUndoMode ) */
public void undoChanges ( CmsRequestContext context , CmsResource resource , CmsResource . CmsResourceUndoMode mode ) throws CmsException , CmsSecurityException { } } | CmsDbContext dbc = m_dbContextFactory . getDbContext ( context ) ; try { checkOfflineProject ( dbc ) ; checkPermissions ( dbc , resource , CmsPermissionSet . ACCESS_WRITE , true , CmsResourceFilter . ALL ) ; checkSystemLocks ( dbc , resource ) ; m_driverManager . undoChanges ( dbc , resource , mode ) ; } catch ( Exception e ) { dbc . report ( null , Messages . get ( ) . container ( Messages . ERR_UNDO_CHANGES_FOR_RESOURCE_1 , context . getSitePath ( resource ) ) , e ) ; } finally { dbc . clear ( ) ; } |
public class Type { /** * Returns the descriptor corresponding to the given class .
* @ param clazz an object class , a primitive class or an array class .
* @ return the descriptor corresponding to the given class . */
public static String getDescriptor ( final Class < ? > clazz ) { } } | StringBuilder stringBuilder = new StringBuilder ( ) ; appendDescriptor ( stringBuilder , clazz ) ; return stringBuilder . toString ( ) ; |
public class MonitorEndpointHelper { /** * Verify access to a JMS backout queue by browsing the backout queue and ensure that no messages exists .
* @ param queueName
* @ return */
public static String pingJmsBackoutQueue ( MuleContext muleContext , String queueName ) { } } | return pingJmsBackoutQueue ( muleContext , DEFAULT_MULE_JMS_CONNECTOR , queueName ) ; |
public class Config { /** * Sets the map of AtomicReference configurations , mapped by config name .
* The config name may be a pattern with which the configuration will be obtained in the future .
* @ param atomicReferenceConfigs the AtomicReference configuration map to set
* @ return this config instance */
public Config setAtomicReferenceConfigs ( Map < String , AtomicReferenceConfig > atomicReferenceConfigs ) { } } | this . atomicReferenceConfigs . clear ( ) ; this . atomicReferenceConfigs . putAll ( atomicReferenceConfigs ) ; for ( Entry < String , AtomicReferenceConfig > entry : atomicReferenceConfigs . entrySet ( ) ) { entry . getValue ( ) . setName ( entry . getKey ( ) ) ; } return this ; |
public class OWLLiteralImplString_CustomFieldSerializer { /** * Deserializes the content of the object from the
* { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } .
* @ param streamReader the { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } to read the
* object ' s content from
* @ param instance the object instance to deserialize
* @ throws com . google . gwt . user . client . rpc . SerializationException
* if the deserialization operation is not
* successful */
@ Override public void deserializeInstance ( SerializationStreamReader streamReader , OWLLiteralImplString instance ) throws SerializationException { } } | deserialize ( streamReader , instance ) ; |
public class RootAction { @ Execute public HtmlResponse index ( ) { } } | if ( isLoginRequired ( ) ) { return redirectToLogin ( ) ; } return asHtml ( virtualHost ( path_IndexJsp ) ) . useForm ( SearchForm . class , op -> { op . setup ( form -> { buildFormParams ( form ) ; } ) ; } ) . renderWith ( data -> { buildInitParams ( ) ; RenderDataUtil . register ( data , "notification" , fessConfig . getNotificationSearchTop ( ) ) ; } ) ; |
public class JSONConverter { /** * Encode an ObjectInstanceWrapper instance as JSON :
* " objectName " : ObjectName ,
* " className " : String ,
* " URL " : URL ,
* @ param out The stream to write JSON to
* @ param value The ObjectInstanceWrapper instance to encode .
* The value and value . objectInstance can ' t be null .
* @ throws IOException If an I / O error occurs
* @ see # readObjectInstance ( InputStream ) */
public void writeObjectInstance ( OutputStream out , ObjectInstanceWrapper value ) throws IOException { } } | // ObjectInstance has no known sub - class .
writeStartObject ( out ) ; writeObjectNameField ( out , OM_OBJECTNAME , value . objectInstance . getObjectName ( ) ) ; writeStringField ( out , OM_CLASSNAME , value . objectInstance . getClassName ( ) ) ; writeStringField ( out , OM_URL , value . mbeanInfoURL ) ; writeEndObject ( out ) ; |
public class DescribeHyperParameterTuningJobRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeHyperParameterTuningJobRequest describeHyperParameterTuningJobRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeHyperParameterTuningJobRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeHyperParameterTuningJobRequest . getHyperParameterTuningJobName ( ) , HYPERPARAMETERTUNINGJOBNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class PublicIPPrefixesInner { /** * Deletes the specified public IP prefix .
* @ param resourceGroupName The name of the resource group .
* @ param publicIpPrefixName The name of the PublicIpPrefix .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */
public void beginDelete ( String resourceGroupName , String publicIpPrefixName ) { } } | beginDeleteWithServiceResponseAsync ( resourceGroupName , publicIpPrefixName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ResponseStore { /** * Automatically inject any { @ link ResponseStoreListener } s , which are implementations of
* { @ link ResponseListener } so they can be notified of changes .
* @ param collection of { @ link ResponseListener } s that are injected to be
* listeners on the { @ link ResponseStore } */
@ Inject @ ResponseStoreListener public void setListeners ( Collection < ResponseListener > listeners ) { } } | for ( ResponseListener listener : listeners ) { registerListener ( listener ) ; } |
public class ClassIndex { /** * Retrieves a list of subclasses of the given class .
* The class must be annotated with { @ link IndexSubclasses } for it ' s subclasses to be indexed
* at compile - time by { @ link ClassIndexProcessor } .
* @ param superClass class to find subclasses for
* @ return list of subclasses */
public static < T > Iterable < Class < ? extends T > > getSubclasses ( Class < T > superClass ) { } } | return getSubclasses ( superClass , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; |
public class DateTimeExtensions { /** * Returns a { @ link java . time . Period } between the first day of this year ( inclusive ) and the first day of the
* provided { @ link java . time . Year } ( exclusive ) .
* @ param self a Year
* @ param year another Year
* @ return a Period between the Years
* @ since 2.5.0 */
public static Period rightShift ( final Year self , Year year ) { } } | return Period . between ( self . atDay ( 1 ) , year . atDay ( 1 ) ) ; |
public class Automounter { /** * Cleanup all references from the { @ link MountOwner } . Cleanup any mounted entries that become un - referenced in the process .
* @ param owner { @ link MountOwner } to cleanup references for */
public static void cleanup ( MountOwner owner ) { } } | final Set < RegistryEntry > references = ownerReferences . remove ( owner ) ; if ( references != null ) { for ( RegistryEntry entry : references ) { entry . removeInboundReference ( owner ) ; } } owner . onCleanup ( ) ; |
public class BugResolution { /** * Runs the < CODE > BugResolution < / CODE > on the given < CODE > IMarker < / CODE > .
* The < CODE > IMarker < / CODE > has to be a FindBugs marker . The
* < CODE > BugInstance < / CODE > associated to the < CODE > IMarker < / CODE > will be
* repaired . All exceptions are reported to the ErrorLog .
* @ param marker
* non null The < CODE > IMarker < / CODE > that specifies the bug . */
@ Override public void run ( IMarker marker ) { } } | requireNonNull ( marker , "marker" ) ; try { // do NOT inline this method invocation
runInternal ( marker ) ; } catch ( CoreException e ) { reportException ( e ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.