signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Database { public DbDatum [ ] get_device_property ( String name , String [ ] propnames ) throws DevFailed { } } | return databaseDAO . get_device_property ( this , name , propnames ) ; |
public class VariantNormalizer { /** * < p > Compares two CharSequences , and returns the index beginning from the behind ,
* at which the CharSequences begin to differ . < / p >
* Based on { @ link StringUtils # indexOfDifference }
* < p > For example ,
* { @ code reverseIndexOfDifference ( " you are a machine... | if ( cs1 == cs2 ) { return StringUtils . INDEX_NOT_FOUND ; } if ( cs1 == null || cs2 == null ) { return 0 ; } int i ; int cs1Length = cs1 . length ( ) ; int cs2Length = cs2 . length ( ) ; for ( i = 0 ; i < cs1Length && i < cs2Length ; ++ i ) { if ( cs1 . charAt ( cs1Length - i - 1 ) != cs2 . charAt ( cs2Length - i - 1 ... |
public class WatchDir { /** * Register the given directory , and all its sub - directories , with the
* WatchService .
* @ param aStartDir
* The start directory to be iterated . May not be < code > null < / code > . */
private void _registerDirRecursive ( @ Nonnull final Path aStartDir ) throws IOException { } } | // register directory and sub - directories
Files . walkFileTree ( aStartDir , new SimpleFileVisitor < Path > ( ) { @ Override public FileVisitResult preVisitDirectory ( final Path dir , final BasicFileAttributes attrs ) throws IOException { _registerDir ( dir ) ; return FileVisitResult . CONTINUE ; } } ) ; |
public class StringBufferWriter { public void write ( char [ ] ca , int offset , int length ) throws IOException { } } | _buffer . append ( ca , offset , length ) ; |
public class TcpConnection { /** * This method is thread safe . */
public int send ( Connection connection , Object object ) throws IOException { } } | SocketChannel socketChannel = this . socketChannel ; if ( socketChannel == null ) throw new SocketException ( "Connection is closed." ) ; synchronized ( writeLock ) { int start = writeBuffer . position ( ) ; int lengthLength = serialization . getLengthLength ( ) ; try { // Leave room for length .
writeBuffer . position... |
public class Job { /** * Set property value .
* @ param key property key
* @ param value property value
* @ return the previous value of the specified key in this property list , or { @ code null } if it did not have one */
public Object setProperty ( final String key , final String value ) { } } | return prop . put ( key , value ) ; |
public class PrefixedProperties { /** * Gets the property .
* @ param value
* the value
* @ param def
* the def
* @ return the property */
@ Override public String getProperty ( final String value , final String def ) { } } | final String result = getProperty ( value ) ; return result == null ? def : result ; |
public class ClosureBundler { /** * Append the contents of the file to the supplied appendable . */
public void appendTo ( Appendable out , DependencyInfo info , File content , Charset contentCharset ) throws IOException { } } | appendTo ( out , info , Files . asCharSource ( content , contentCharset ) ) ; |
public class SingleThreadBlockingQpsBenchmark { /** * Useful for triggering a subset of the benchmark in a profiler . */
public static void main ( String [ ] argv ) throws Exception { } } | SingleThreadBlockingQpsBenchmark bench = new SingleThreadBlockingQpsBenchmark ( ) ; bench . setup ( ) ; for ( int i = 0 ; i < 10000 ; i ++ ) { bench . blockingUnary ( ) ; } Thread . sleep ( 30000 ) ; bench . teardown ( ) ; System . exit ( 0 ) ; |
public class Waiter { /** * Clears the log . */
public void clearLog ( ) { } } | Process p = null ; try { p = Runtime . getRuntime ( ) . exec ( "logcat -c" ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } |
public class MapAttributeDefinition { /** * Iterates through the items in the { @ code parameter } map , calling { @ link # convertParameterElementExpressions ( ModelNode ) }
* for each value .
* < strong > Note < / strong > that the default implementation of { @ link # convertParameterElementExpressions ( ModelNod... | ModelNode result = parameter ; List < Property > asList ; try { asList = parameter . asPropertyList ( ) ; } catch ( IllegalArgumentException iae ) { // We can ' t convert ; we ' ll just return parameter
asList = null ; } if ( asList != null ) { boolean changeMade = false ; ModelNode newMap = new ModelNode ( ) . setEmpt... |
public class StorageGatewayUtils { /** * Sends a request to the AWS Storage Gateway server running at the
* specified address , and returns the activation key for that server .
* @ param gatewayAddress
* The DNS name or IP address of a running AWS Storage Gateway
* @ param activationRegionName
* The region in... | return getActivationKey ( gatewayAddress , activationRegion == null ? null : activationRegion . getName ( ) ) ; |
public class CmsCommentImages { /** * Returns the HTML for the dialog input form to comment the images . < p >
* @ return the HTML for the dialog input form to comment the images */
public String buildDialogForm ( ) { } } | StringBuffer result = new StringBuffer ( 16384 ) ; Iterator < CmsResource > i = getImages ( ) . iterator ( ) ; result . append ( "<div style=\"height: 450px; padding: 4px; overflow: auto;\">" ) ; while ( i . hasNext ( ) ) { CmsResource res = i . next ( ) ; String imageName = res . getName ( ) ; String propertySuffix = ... |
public class PolicyAssignmentsInner { /** * Gets all the policy assignments for a subscription .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; ... | return listNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < PolicyAssignmentInner > > , Page < PolicyAssignmentInner > > ( ) { @ Override public Page < PolicyAssignmentInner > call ( ServiceResponse < Page < PolicyAssignmentInner > > response ) { return response . body ( ) ; } ... |
public class LastModifiedServlet { /** * Gets a last modified time given a context - relative path starting with a
* slash ( / ) .
* Any file ending in " . css " ( case - insensitive ) will be parsed and will have
* a modified time that is equal to the greatest of itself or any referenced
* URL .
* @ return t... | HeaderAndPath hap = new HeaderAndPath ( request , path ) ; if ( CSS_EXTENSION . equals ( extension ) ) { try { // Parse CSS file , finding all dependencies .
// Don ' t re - parse when CSS file not changed , but still check
// dependencies .
return ParsedCssFile . parseCssFile ( servletContext , hap ) . newestLastModif... |
public class BrowsersDataProvider { /** * Return available grid browsers applying filter defined by Map content .
* Filter - > Regexp as : " filter . key ( ) = filter . value ( key ) [ , | } ] "
* @ param filter browser selected for test execution
* @ return browsers list */
private static List < String > gridBro... | ArrayList < String > response = new ArrayList < String > ( ) ; LOGGER . debug ( "Trying to get a list of Selenium-available browsers" ) ; String grid = System . getProperty ( "SELENIUM_GRID" ) ; if ( grid != null ) { grid = "http://" + grid + "/grid/console" ; Document doc ; try { doc = Jsoup . connect ( grid ) . timeo... |
public class TextPost { /** * Get the details of this post ( and the base details )
* @ return the details */
@ Override protected Map < String , Object > detail ( ) { } } | final Map < String , Object > map = super . detail ( ) ; map . put ( "title" , this . title ) ; map . put ( "body" , this . body ) ; return map ; |
public class AutoEncodingFilteredTag { /** * @ Override
* public boolean isValidatingMediaInputType ( MediaType inputType ) {
* return inputValidator ! = null & & inputValidator . isValidatingMediaInputType ( inputType ) ; */
@ Override public void doTag ( ) throws JspException , IOException { } } | try { final PageContext pageContext = ( PageContext ) getJspContext ( ) ; final ServletRequest request = pageContext . getRequest ( ) ; final HttpServletResponse response = ( HttpServletResponse ) pageContext . getResponse ( ) ; final JspWriter out = pageContext . getOut ( ) ; final ThreadEncodingContext parentEncoding... |
public class AWSTransferClient { /** * Describes the server that you specify by passing the < code > ServerId < / code > parameter .
* The response contains a description of the server ' s properties .
* @ param describeServerRequest
* @ return Result of the DescribeServer operation returned by the service .
* ... | request = beforeClientExecution ( request ) ; return executeDescribeServer ( request ) ; |
public class ChildAxisQuery { /** * { @ inheritDoc } */
public QueryHits execute ( JcrIndexSearcher searcher , SessionImpl session , Sort sort ) throws IOException { } } | if ( sort . getSort ( ) . length == 0 && matchesAnyChildNode ( ) ) { Query context = getContextQuery ( ) ; return new ChildNodesQueryHits ( searcher . evaluate ( context ) , session , indexConfig ) ; } else { return null ; } |
public class DiscoveryNodeListProvider { /** * ( non - Javadoc )
* @ see com . netflix . evcache . pool . EVCacheNodeList # discoverInstances ( ) */
@ Override public Map < ServerGroup , EVCacheServerGroupConfig > discoverInstances ( String appName ) throws IOException { } } | if ( ( applicationInfoManager . getInfo ( ) . getStatus ( ) == InstanceStatus . DOWN ) ) { return Collections . < ServerGroup , EVCacheServerGroupConfig > emptyMap ( ) ; } /* Get a list of EVCACHE instances from the DiscoveryManager */
final Application app = _discoveryClient . getApplication ( _appName ) ; if ( app ==... |
public class ConfigUtil { /** * Parse a complex array structure and return it as a map containing maps as
* values for further internal structures < br >
* Example of configuration we support :
* smartcardAdaptor . cardFeatures . 1 . cardFamily = VGE
* smartcardAdaptor . cardFeatures . 1 . supportSbm = true
*... | Configuration configuration = ConfigurationFactory . getConfiguration ( ) ; Map < String , Map < String , String > > result = new HashMap < String , Map < String , String > > ( ) ; // get a subset of the configuration based on the config prefix .
final Configuration subset = configuration . subset ( configPrefix ) ; @ ... |
public class CollectionUtils { /** * Convert given collection to an array .
* @ param collection
* source collection .
* @ return an array has full given collection element and order by
* collection index . */
public static < T > T [ ] toArray ( final Collection < T > collection ) { } } | T next = getFirstNotNullValue ( collection ) ; if ( next != null ) { Object [ ] objects = collection . toArray ( ) ; @ SuppressWarnings ( "unchecked" ) T [ ] convertedObjects = ( T [ ] ) Array . newInstance ( next . getClass ( ) , objects . length ) ; System . arraycopy ( objects , 0 , convertedObjects , 0 , objects . ... |
public class ServletHolder { public void start ( ) throws Exception { } } | _unavailable = 0 ; super . start ( ) ; if ( ! javax . servlet . Servlet . class . isAssignableFrom ( _class ) ) { Exception ex = new IllegalStateException ( "Servlet " + _class + " is not a javax.servlet.Servlet" ) ; super . stop ( ) ; throw ex ; } _config = new Config ( ) ; if ( _runAs != null ) _realm = _httpHandler ... |
public class KTypeHashSet { /** * Returns the exact value of the existing key . This method makes sense for sets
* of objects which define custom key - equality relationship .
* @ see # indexOf
* @ param index The index of an existing key .
* @ return Returns the equivalent key currently stored in the set .
*... | assert index >= 0 : "The index must point at an existing key." ; assert index <= mask || ( index == mask + 1 && hasEmptyKey ) ; return Intrinsics . < KType > cast ( keys [ index ] ) ; |
import java . lang . Math ; class CanBeSumOfSquares { /** * This function checks if a given integer can be expressed as the sum of squares of two different integers .
* Examples :
* > > > can _ be _ sum _ of _ squares ( 25)
* True
* > > > can _ be _ sum _ of _ squares ( 24)
* False
* > > > can _ be _ sum _ ... | int x = 1 ; while ( ( x * x ) <= num ) { int y = 1 ; while ( ( y * y ) <= num ) { if ( ( ( x * x ) + ( y * y ) ) == num ) { return true ; } y += 1 ; } x += 1 ; } return false ; |
public class AWSElasticBeanstalkClient { /** * Deletes the specified version from the specified application .
* < note >
* You cannot delete an application version that is associated with a running environment .
* < / note >
* @ param deleteApplicationVersionRequest
* Request to delete an application version ... | request = beforeClientExecution ( request ) ; return executeDeleteApplicationVersion ( request ) ; |
public class VirtualNetworkGatewaysInner { /** * Generates VPN client package for P2S client of the virtual network gateway in the specified resource group .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetworkGatewayName The name of the virtual network gateway .
* @ param paramet... | return ServiceFuture . fromResponse ( generatevpnclientpackageWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName , parameters ) , serviceCallback ) ; |
public class StreamHandler { /** * Format and publish a < tt > LogRecord < / tt > .
* The < tt > StreamHandler < / tt > first checks if there is an < tt > OutputStream < / tt >
* and if the given < tt > LogRecord < / tt > has at least the required log level .
* If not it silently returns . If so , it calls any as... | if ( ! isLoggable ( record ) ) { return ; } String msg ; try { msg = getFormatter ( ) . format ( record ) ; } catch ( Exception ex ) { // We don ' t want to throw an exception here , but we
// report the exception to any registered ErrorManager .
reportError ( null , ex , ErrorManager . FORMAT_FAILURE ) ; return ; } tr... |
public class Balanced { /** * Splits a string around the specified character , returning the parts in an array .
* However , any occurrence of the specified character enclosed between balanced parentheses / brackets / braces is ignored .
* @ param symbols an optional functor to provide the complete set of balancing... | List < String > list = new ArrayList < > ( ) ; return split ( list , symbols , text , begin , end , delimiter , extra ) . toArray ( new String [ list . size ( ) ] ) ; |
public class GetIdRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetIdRequest getIdRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getIdRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getIdRequest . getAccountId ( ) , ACCOUNTID_BINDING ) ; protocolMarshaller . marshall ( getIdRequest . getIdentityPoolId ( ) , IDENTITYPOOLID_BINDING ) ; protocolMarshaller... |
public class EventStreamClient { /** * Read asynchronously events from connected event stream . This method start read thread and returns immediately . Given
* callback argument is used to pass events ; when a new event arrives from server { @ link Callback # handle ( Object ) } is
* invoked .
* Please note that ... | if ( inputStream == null ) { throw new BugError ( "Attempt to read from a not connected event stream." ) ; } this . callback = callback ; thread = new Thread ( this , getClass ( ) . getSimpleName ( ) ) ; synchronized ( this ) { thread . start ( ) ; thread . wait ( THREAD_START_TIMEOUT ) ; } |
public class Result { /** * Discards the given cookie . The cookie max - age is set to 0 , so is going to be invalidated .
* @ param name the name of the cookie
* @ return the current result */
public Result discard ( String name ) { } } | Cookie cookie = getCookie ( name ) ; if ( cookie != null ) { cookies . remove ( cookie ) ; cookies . add ( Cookie . builder ( cookie ) . setMaxAge ( 0 ) . build ( ) ) ; } else { cookies . add ( Cookie . builder ( name , "" ) . setMaxAge ( 0 ) . build ( ) ) ; } return this ; |
public class CmsJspContentAccessBean { /** * Returns the map of RDFA maps by locale . < p >
* @ return the map of RDFA maps by locale */
public Map < String , Map < String , String > > getLocaleRdfa ( ) { } } | if ( m_localeRdfa == null ) { m_localeRdfa = CmsCollectionsGenericWrapper . createLazyMap ( new CmsLocaleRdfaTransformer ( ) ) ; } return m_localeRdfa ; |
public class ApiOvhMe { /** * Alter this object properties
* REST : PUT / me / accessRestriction / ipDefaultRule
* @ param body [ required ] New object properties */
public void accessRestriction_ipDefaultRule_PUT ( OvhIpRestrictionDefaultRule body ) throws IOException { } } | String qPath = "/me/accessRestriction/ipDefaultRule" ; StringBuilder sb = path ( qPath ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ; |
public class Calculator { public static int getIndex ( String [ ] arr , String str ) { } } | if ( arr == null || arr . length == 0 || str == null ) { return - 1 ; } int len = arr . length ; for ( int i = 0 ; i < len ; i ++ ) { if ( str . compareToIgnoreCase ( arr [ i ] ) == 0 ) { return i ; } } return - 1 ; |
public class CommercePriceEntryLocalServiceWrapper { /** * Returns all the commerce price entries matching the UUID and company .
* @ param uuid the UUID of the commerce price entries
* @ param companyId the primary key of the company
* @ return the matching commerce price entries , or an empty list if no matches... | return _commercePriceEntryLocalService . getCommercePriceEntriesByUuidAndCompanyId ( uuid , companyId ) ; |
public class route { /** * Use this API to unset the properties of route resource .
* Properties that need to be unset are specified in args array . */
public static base_response unset ( nitro_service client , route resource , String [ ] args ) throws Exception { } } | route unsetresource = new route ( ) ; unsetresource . network = resource . network ; unsetresource . netmask = resource . netmask ; unsetresource . gateway = resource . gateway ; unsetresource . td = resource . td ; return unsetresource . unset_resource ( client , args ) ; |
public class QueryUtil { /** * Get a rKNN query object for the given distance function .
* When possible , this will use an index , but it may default to an expensive
* linear scan .
* Hints include :
* < ul >
* < li > Integer : maximum value for k needed < / li >
* < li > { @ link de . lmu . ifi . dbs . el... | final DistanceQuery < O > distanceQuery = relation . getDistanceQuery ( distanceFunction , hints ) ; return relation . getRKNNQuery ( distanceQuery , hints ) ; |
public class MpJwtPrincipalHandler { /** * If there is a JWTAccount installed in the exchange security context , create
* @ param exchange - the request / response exchange
* @ throws Exception on failure */
@ Override public void handleRequest ( HttpServerExchange exchange ) throws Exception { } } | Account account = exchange . getSecurityContext ( ) . getAuthenticatedAccount ( ) ; if ( account != null && account . getPrincipal ( ) instanceof JsonWebToken ) { JsonWebToken token = ( JsonWebToken ) account . getPrincipal ( ) ; PrincipalProducer myInstance = CDI . current ( ) . select ( PrincipalProducer . class ) . ... |
public class DefaultGroovyMethods { /** * Create a Collection composed of the intersection of both collections . Any
* elements that exist in both collections are added to the resultant collection .
* < pre class = " groovyTestCase " > assert [ 4,5 ] = = [ 1,2,3,4,5 ] . intersect ( [ 4,5,6,7,8 ] ) < / pre >
* @ p... | if ( left . isEmpty ( ) || right . isEmpty ( ) ) return createSimilarCollection ( left , 0 ) ; if ( left . size ( ) < right . size ( ) ) { Collection < T > swaptemp = left ; left = right ; right = swaptemp ; } // TODO optimise if same type ?
// boolean nlgnSort = sameType ( new Collection [ ] { left , right } ) ;
Colle... |
public class Getter { /** * Returns a { @ code View } with a certain index , from the list of current { @ code View } s of the specified type .
* @ param classToFilterBy which { @ code View } s to choose from
* @ param index choose among all instances of this type , e . g . { @ code Button . class } or { @ code Edi... | return waiter . waitForAndGetView ( index , classToFilterBy ) ; |
public class Clipboard { /** * This method places incoming VoidAggregation into clipboard , for further tracking
* @ param aggregation
* @ return TRUE , if given VoidAggregation was the last chunk , FALSE otherwise */
public boolean pin ( @ NonNull VoidAggregation aggregation ) { } } | RequestDescriptor descriptor = RequestDescriptor . createDescriptor ( aggregation . getOriginatorId ( ) , aggregation . getTaskId ( ) ) ; VoidAggregation existing = clipboard . get ( descriptor ) ; if ( existing == null ) { existing = aggregation ; trackingCounter . incrementAndGet ( ) ; clipboard . put ( descriptor , ... |
public class FutureResult { /** * get result of the call .
* @ return result of call
* @ throws IllegalStateException if call isn ' t done . */
public T get ( ) throws IllegalStateException { } } | switch ( this . state ) { case INCOMPLETE : // Do not block browser so just throw ex
throw new IllegalStateException ( "The server response did not yet recieved." ) ; case FAILED : throw new IllegalStateException ( this . error ) ; case SUCCEEDED : return this . value ; default : throw new IllegalStateException ( "Some... |
public class PowerMock { /** * Mock all methods of a class except for a specific one . Use this method
* only if you have several overloaded methods .
* @ param < T > The type of the mock .
* @ param type The type that ' ll be used to create a mock instance .
* @ param methodNameToExclude The name of the method... | /* * The reason why we ' ve split the first and " additional types " is
* because it should not intervene with the mockAllExcept ( type ,
* String . . . methodNames ) method . */
final Class < ? > [ ] argumentTypes = mergeArgumentTypes ( firstArgumentType , moreTypes ) ; return createMock ( type , WhiteboxImpl . ge... |
public class Workteam { /** * The Amazon Marketplace identifier for a vendor ' s work team .
* @ param productListingIds
* The Amazon Marketplace identifier for a vendor ' s work team . */
public void setProductListingIds ( java . util . Collection < String > productListingIds ) { } } | if ( productListingIds == null ) { this . productListingIds = null ; return ; } this . productListingIds = new java . util . ArrayList < String > ( productListingIds ) ; |
public class MediaGroup { /** * Default content index MediaContent .
* @ param defaultContentIndex Default content index MediaContent . */
public void setDefaultContentIndex ( final Integer defaultContentIndex ) { } } | for ( int i = 0 ; i < getContents ( ) . length ; i ++ ) { if ( i == defaultContentIndex . intValue ( ) ) { getContents ( ) [ i ] . setDefaultContent ( true ) ; } else { getContents ( ) [ i ] . setDefaultContent ( false ) ; } } this . defaultContentIndex = defaultContentIndex ; |
public class WnsService { /** * Pushes a toast to channelUri
* @ param channelUri
* @ param toast which should be built with { @ link ar . com . fernandospr . wns . model . builders . WnsToastBuilder }
* @ return WnsNotificationResponse please see response headers from < a href = " http : / / msdn . microsoft . c... | return this . pushToast ( channelUri , null , toast ) ; |
public class SipApplicationDispatcherImpl { /** * ( non - Javadoc )
* @ see javax . sip . SipListener # processIOException ( javax . sip . IOExceptionEvent ) */
public void processIOException ( IOExceptionEvent event ) { } } | if ( event instanceof IOExceptionEventExt && ( ( IOExceptionEventExt ) event ) . getReason ( ) == gov . nist . javax . sip . IOExceptionEventExt . Reason . KeepAliveTimeout ) { IOExceptionEventExt keepAliveTimeout = ( ( IOExceptionEventExt ) event ) ; SipConnector connector = findSipConnector ( keepAliveTimeout . getLo... |
public class Product { /** * Gets the roadblockingType value for this Product .
* @ return roadblockingType * The strategy for serving roadblocked creatives , i . e . instances
* where
* multiple creatives must be served together on a single
* web page .
* < span class = " constraint Applicable " > This attri... | return roadblockingType ; |
public class PdfSmartCopy { /** * Translate a PRIndirectReference to a PdfIndirectReference
* In addition , translates the object numbers , and copies the
* referenced object to the output file if it wasn ' t available
* in the cache yet . If it ' s in the cache , the reference to
* the already used stream is r... | PdfObject srcObj = PdfReader . getPdfObjectRelease ( in ) ; ByteStore streamKey = null ; boolean validStream = false ; if ( srcObj . isStream ( ) ) { streamKey = new ByteStore ( ( PRStream ) srcObj ) ; validStream = true ; PdfIndirectReference streamRef = ( PdfIndirectReference ) streamMap . get ( streamKey ) ; if ( st... |
public class EndpointSendConfigurationMarshaller { /** * Marshall the given parameter object . */
public void marshall ( EndpointSendConfiguration endpointSendConfiguration , ProtocolMarshaller protocolMarshaller ) { } } | if ( endpointSendConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( endpointSendConfiguration . getBodyOverride ( ) , BODYOVERRIDE_BINDING ) ; protocolMarshaller . marshall ( endpointSendConfiguration . getContext ( ) , CONTEXT... |
public class ArrayUtils { /** * < p > Copies the given array and adds the given element at the end of the new array . < / p >
* < p > The new array contains the same elements of the input
* array plus the given element in the last position . The component type of
* the new array is the same as that of the input a... | Class type ; if ( array != null ) { type = array . getClass ( ) ; } else if ( element != null ) { type = element . getClass ( ) ; } else { type = Object . class ; } Object [ ] newArray = ( Object [ ] ) copyArrayGrow1 ( array , type ) ; newArray [ newArray . length - 1 ] = element ; return newArray ; |
public class ModelsImpl { /** * Adds an entity extractor to the application .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param addEntityOptionalParameter the object representing the optional parameters to be set before calling this API
* @ param serviceCallback the async Servi... | return ServiceFuture . fromResponse ( addEntityWithServiceResponseAsync ( appId , versionId , addEntityOptionalParameter ) , serviceCallback ) ; |
public class TagAPI { /** * Update the tags on the objects
* @ param reference
* The object the tags should be updated on
* @ param tags
* The tags that should now be set on the object */
public void updateTags ( Reference reference , String ... tags ) { } } | updateTags ( reference , Arrays . asList ( tags ) ) ; |
public class Gauge { /** * The factor defines the width of the medium tick mark .
* It can be in the range from 0 - 1.
* @ param FACTOR */
public void setMediumTickMarkWidthFactor ( final double FACTOR ) { } } | if ( null == mediumTickMarkWidthFactor ) { _mediumTickMarkWidthFactor = Helper . clamp ( 0.0 , 1.0 , FACTOR ) ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { mediumTickMarkWidthFactor . set ( FACTOR ) ; } |
public class CopyManager { /** * Pass results of a COPY TO STDOUT query from database into a Writer .
* @ param sql COPY TO STDOUT statement
* @ param to the stream to write the results to ( row by row )
* @ return number of rows updated for server 8.2 or newer ; - 1 for older
* @ throws SQLException on databas... | byte [ ] buf ; CopyOut cp = copyOut ( sql ) ; try { while ( ( buf = cp . readFromCopy ( ) ) != null ) { to . write ( encoding . decode ( buf ) ) ; } return cp . getHandledRowCount ( ) ; } catch ( IOException ioEX ) { // if not handled this way the close call will hang , at least in 8.2
if ( cp . isActive ( ) ) { cp . c... |
public class SplitShowAreaHandler { private void cleanup ( ) { } } | for ( Rectangle rectangle : labelBgs ) { mapWidget . render ( rectangle , RenderGroup . SCREEN , RenderStatus . DELETE ) ; } labelBgs . clear ( ) ; for ( Text text : labelTxts ) { mapWidget . render ( text , RenderGroup . SCREEN , RenderStatus . DELETE ) ; } labelTxts . clear ( ) ; centroids . clear ( ) ; |
public class CrudMB { /** * called via preRenderView or viewAction */
public void init ( ) { } } | if ( FacesContext . getCurrentInstance ( ) . getPartialViewContext ( ) . isAjaxRequest ( ) ) { return ; } if ( id != null && ! "" . equals ( id ) ) { entity = crudService . findById ( id ) ; if ( entity == null ) { log . info ( String . format ( "Entity not found with id %s, a new one will be initialized." , id ) ) ; i... |
public class RoleAssignmentsInner { /** * Gets all role assignments for the subscription .
* @ param filter The filter to apply on the operation . Use $ filter = atScope ( ) to return all role assignments at or above the scope . Use $ filter = principalId eq { id } to return all role assignments at , above or below t... | return listWithServiceResponseAsync ( filter ) . map ( new Func1 < ServiceResponse < Page < RoleAssignmentInner > > , Page < RoleAssignmentInner > > ( ) { @ Override public Page < RoleAssignmentInner > call ( ServiceResponse < Page < RoleAssignmentInner > > response ) { return response . body ( ) ; } } ) ; |
public class Tag { /** * - - - - - protected static methods - - - - - */
protected static void beginTag ( final PrintWriter writer , final String tagName , final boolean newline , final List < Attr > attributes , final int level , final String indent ) throws IOException { } } | beginTag ( writer , tagName , newline , false , attributes , level , indent ) ; |
public class CommerceNotificationTemplateUserSegmentRelPersistenceImpl { /** * Returns the commerce notification template user segment rels before and after the current commerce notification template user segment rel in the ordered set where commerceUserSegmentEntryId = & # 63 ; .
* @ param commerceNotificationTempla... | CommerceNotificationTemplateUserSegmentRel commerceNotificationTemplateUserSegmentRel = findByPrimaryKey ( commerceNotificationTemplateUserSegmentRelId ) ; Session session = null ; try { session = openSession ( ) ; CommerceNotificationTemplateUserSegmentRel [ ] array = new CommerceNotificationTemplateUserSegmentRelImpl... |
public class DisasterRecoveryConfigurationsInner { /** * Creates or updates a disaster recovery configuration .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the s... | if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( serverN... |
public class DefaultAsyncJobExecutor { /** * Starts the async executor */
public void start ( ) { } } | if ( isActive ) { return ; } log . info ( "Starting up the default async job executor [{}]." , getClass ( ) . getName ( ) ) ; if ( timerJobRunnable == null ) { timerJobRunnable = new AcquireTimerJobsRunnable ( this , processEngineConfiguration . getJobManager ( ) ) ; } if ( resetExpiredJobsRunnable == null ) { resetExp... |
public class WindowsJNIFaxClientSpi { /** * This function will submit a new fax job . < br >
* The fax job ID will be returned by this method .
* @ param serverName
* The fax server name
* @ param targetAddress
* The fax job target address
* @ param targetName
* The fax job target name
* @ param senderN... | int faxJobID = 0 ; synchronized ( WindowsFaxClientSpiHelper . NATIVE_LOCK ) { // pre native call
this . preNativeCall ( ) ; // invoke native
faxJobID = WindowsJNIFaxClientSpi . submitFaxJobNative ( serverName , targetAddress , targetName , senderName , fileName , documentName ) ; } return faxJobID ; |
public class ZookeeperMgr { /** * @ return List < String >
* @ Description : 写持久化结点 , 没有则新建 , 存在则进行更新
* @ author liaoqiqi
* @ date 2013-6-14 */
public void writePersistentUrl ( String url , String value ) throws Exception { } } | store . write ( url , value ) ; |
public class Searcher { /** * Searches a model for the given pattern , then collects the specified elements of the matches
* and returns .
* @ param < T > BioPAX type
* @ param model model to search in
* @ param pattern pattern to search for
* @ param index index of the element in the match to collect
* @ p... | return searchAndCollect ( model . getObjects ( pattern . getStartingClass ( ) ) , pattern , index , c ) ; |
public class EvolutionResume { /** * Run the evolution . */
private EvolutionResult < BitGene , Double > run ( final EvolutionResult < BitGene , Double > last , final AtomicBoolean proceed ) { } } | System . out . println ( "Starting evolution with existing result." ) ; return ( last != null ? ENGINE . stream ( last ) : ENGINE . stream ( ) ) . limit ( r -> proceed . get ( ) ) . collect ( EvolutionResult . toBestEvolutionResult ( ) ) ; |
public class ExecutionConfig { /** * Returns the registered Kryo types . */
public LinkedHashSet < Class < ? > > getRegisteredKryoTypes ( ) { } } | if ( isForceKryoEnabled ( ) ) { // if we force kryo , we must also return all the types that
// were previously only registered as POJO
LinkedHashSet < Class < ? > > result = new LinkedHashSet < > ( ) ; result . addAll ( registeredKryoTypes ) ; for ( Class < ? > t : registeredPojoTypes ) { if ( ! result . contains ( t ... |
public class PvmExecutionImpl { /** * Delays and stores the given DelayedVariableEvent on the process instance .
* @ param delayedVariableEvent the DelayedVariableEvent which should be store on the process instance */
public void delayEvent ( DelayedVariableEvent delayedVariableEvent ) { } } | // if process definition has no conditional events the variable events does not have to be delayed
Boolean hasConditionalEvents = this . getProcessDefinition ( ) . getProperties ( ) . get ( BpmnProperties . HAS_CONDITIONAL_EVENTS ) ; if ( hasConditionalEvents == null || ! hasConditionalEvents . equals ( Boolean . TRUE ... |
public class HBlinkImageView { /** * display this field in html input format .
* @ param out The html out stream .
* @ param strFieldDesc The field description .
* @ param strFieldName The field name .
* @ param strSize The control size .
* @ param strMaxSize The string max size .
* @ param strValue The def... | String strImage = "" ; out . println ( "<td>" + strImage + "</td>" ) ; |
public class OutgoingTupleCollection { /** * Clean the internal state of OutgoingTupleCollection */
public void clear ( ) { } } | lock . lock ( ) ; try { currentControlTuple = null ; currentDataTuple = null ; outQueue . clear ( ) ; } finally { lock . unlock ( ) ; } |
public class rnat { /** * Use this API to clear rnat . */
public static base_response clear ( nitro_service client , rnat resource ) throws Exception { } } | rnat clearresource = new rnat ( ) ; clearresource . network = resource . network ; clearresource . netmask = resource . netmask ; clearresource . aclname = resource . aclname ; clearresource . redirectport = resource . redirectport ; clearresource . natip = resource . natip ; clearresource . td = resource . td ; return... |
public class MethodInvocationProcessor { /** * - - - - PortableObject implementation - - - - - */
@ Override public void readExternal ( PofReader reader ) throws IOException { } } | name = reader . readString ( 0 ) ; mutator = reader . readBoolean ( 1 ) ; args = reader . readObjectArray ( 2 , new Object [ 0 ] ) ; |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getCPC ( ) { } } | if ( cpcEClass == null ) { cpcEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 228 ) ; } return cpcEClass ; |
public class server_servicegroup_binding { /** * Use this API to fetch server _ servicegroup _ binding resources of given name . */
public static server_servicegroup_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | server_servicegroup_binding obj = new server_servicegroup_binding ( ) ; obj . set_name ( name ) ; server_servicegroup_binding response [ ] = ( server_servicegroup_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class Annotate { /** * Queue processing of an attribute default value . */
public void annotateDefaultValueLater ( JCExpression defaultValue , Env < AttrContext > localEnv , MethodSymbol m , DiagnosticPosition deferPos ) { } } | normal ( ( ) -> { JavaFileObject prev = log . useSource ( localEnv . toplevel . sourcefile ) ; DiagnosticPosition prevLintPos = deferredLintHandler . setPos ( deferPos ) ; try { enterDefaultValue ( defaultValue , localEnv , m ) ; } finally { deferredLintHandler . setPos ( prevLintPos ) ; log . useSource ( prev ) ; } } ... |
public class Tree { /** * Prepare the Tree for rendering .
* @ throws JspException if a JSP exception has occurred */
public void doTag ( ) throws JspException , IOException { } } | if ( hasErrors ( ) ) { reportErrors ( ) ; return ; } // See if there is a TreeRoot already defined .
_expr = new ExpressionHandling ( this ) ; TreeElement root = null ; try { root = getTreeRoot ( _expr ) ; } catch ( IllegalExpressionException iee ) { String s = Bundle . getString ( "TreeRootError" , new Object [ ] { _d... |
public class CoreJBossASClient { /** * Adds a new module extension to the core system .
* @ param name the name of the new module extension
* @ throws Exception any error */
public void addExtension ( String name ) throws Exception { } } | // / extension = < name > / : add ( module = < name > )
final ModelNode request = createRequest ( ADD , Address . root ( ) . add ( EXTENSION , name ) ) ; request . get ( MODULE ) . set ( name ) ; final ModelNode response = execute ( request ) ; if ( ! isSuccess ( response ) ) { throw new FailureException ( response , "... |
public class RangeMassDecomposer { /** * Check if a mass is decomposable . This is done in constant time ( especially : it is very very very fast ! ) .
* But it doesn ' t check if there is a valid decomposition . Therefore , even if the method returns true ,
* all decompositions may be invalid for the given validat... | init ( ) ; final int [ ] [ ] [ ] ERTs = this . ERTs ; final int [ ] minmax = new int [ 2 ] ; // normal version seems to be faster , because it returns after first hit
integerBound ( from , to , minmax ) ; final int a = weights . get ( 0 ) . getIntegerMass ( ) ; for ( int i = minmax [ 0 ] ; i <= minmax [ 1 ] ; ++ i ) { ... |
public class CellRepeater { /** * Get the metadata for the current item . This method is not supported by
* this tag .
* @ throws UnsupportedOperationException this tag does not support this method from the IDataAccessProvider interface
* @ see org . apache . beehive . netui . script . common . IDataAccessProvide... | LocalizedUnsupportedOperationException uoe = new LocalizedUnsupportedOperationException ( "The " + getTagName ( ) + "does not export metadata for its iterated items." ) ; uoe . setLocalizedMessage ( Bundle . getErrorString ( "Tags_DataAccessProvider_metadataUnsupported" , new Object [ ] { getTagName ( ) } ) ) ; throw u... |
public class TemplateMetadata { /** * Builds a Template from a parsed TemplateNode . */
public static TemplateMetadata fromTemplate ( TemplateNode template ) { } } | TemplateMetadata . Builder builder = builder ( ) . setTemplateName ( template . getTemplateName ( ) ) . setSourceLocation ( template . getSourceLocation ( ) ) . setSoyFileKind ( SoyFileKind . SRC ) . setContentKind ( template . getContentKind ( ) ) . setStrictHtml ( template . isStrictHtml ( ) ) . setDelPackageName ( t... |
public class Stream { /** * # # Repartitioning Operation
* @ param partitioner
* @ return */
public Stream partition ( CustomStreamGrouping partitioner ) { } } | return partition ( Grouping . custom_serialized ( Utils . javaSerialize ( partitioner ) ) ) ; |
public class ImageIOGreyScale { /** * Returns an < code > ImageOutputStream < / code > that will send its output to the given < code > Object < / code > .
* The set of < code > ImageOutputStreamSpi < / code > s registered with the < code > IIORegistry < / code > class is
* queried and the first one that is able to ... | if ( output == null ) { throw new IllegalArgumentException ( "output == null!" ) ; } Iterator iter ; // Ensure category is present
try { iter = theRegistry . getServiceProviders ( ImageOutputStreamSpi . class , true ) ; } catch ( IllegalArgumentException e ) { return null ; } boolean usecache = getUseCache ( ) && hasCa... |
public class Lens { /** * Called when a capture is triggered but not yet saved to a { @ link File } , enabling additional
* processing before saving . The default implementation immediately calls the { @ code listener }
* with the original screenshot .
* @ param screenshot A reference to the screenshot that was c... | listener . onBitmapReady ( screenshot ) ; |
public class CommandLineIndicatorRunner { /** * Creates a list with the available indicators ( but setCoverage )
* @ param referenceFront
* @ return
* @ throws FileNotFoundException */
private static List < QualityIndicator < List < PointSolution > , Double > > getAvailableIndicators ( Front referenceFront ) thro... | List < QualityIndicator < List < PointSolution > , Double > > list = new ArrayList < > ( ) ; list . add ( new Epsilon < PointSolution > ( referenceFront ) ) ; list . add ( new PISAHypervolume < PointSolution > ( referenceFront ) ) ; list . add ( new GenerationalDistance < PointSolution > ( referenceFront ) ) ; list . a... |
public class ReflectionUtils { /** * Checks if the class is an integer type , i . e . , is numeric but not a floating point type .
* @ param type the class we want to check
* @ return true if the type is an integral type */
public static boolean isIntegerType ( final Class type ) { } } | return Arrays . < Class > asList ( Integer . class , int . class , Long . class , long . class , Short . class , short . class , Byte . class , byte . class ) . contains ( type ) ; |
public class StackTraceHelper { /** * Get the stack trace of a throwable as string .
* @ param t
* The throwable to be converted . May be < code > null < / code > .
* @ param bOmitCommonStackTraceElements
* If < code > true < / code > the stack trace is cut after certain class
* names occurring . If < code > ... | if ( t == null ) return "" ; // convert call stack to string
final StringBuilder aCallStack = _getRecursiveStackAsStringBuilder ( t , null , null , 1 , bOmitCommonStackTraceElements ) ; // avoid having a separator at the end - > remove the last char
if ( StringHelper . getLastChar ( aCallStack ) == STACKELEMENT_LINESEP... |
public class CmsAlertDialog { /** * Adds a widget to this dialogs bottom content . < p >
* @ param w the widget to add */
public void addBottomWidget ( Widget w ) { } } | m_content . removeStyleName ( I_CmsLayoutBundle . INSTANCE . dialogCss ( ) . alertMainContent ( ) ) ; m_bottomWidgets . getElement ( ) . getStyle ( ) . clearDisplay ( ) ; m_bottomWidgets . add ( w ) ; |
public class JavacParser { /** * If next input token matches given token , skip it , otherwise report
* an error . */
public void accept ( TokenKind tk ) { } } | if ( token . kind == tk ) { nextToken ( ) ; } else { setErrorEndPos ( token . pos ) ; reportSyntaxError ( S . prevToken ( ) . endPos , "expected" , tk ) ; } |
public class BasicRecordStoreLoader { /** * Invokes an operation to put the provided key - value pairs to the partition
* record store .
* @ param keyValueSequence the list of serialised alternating key - value pairs
* @ return the future representing the pending completion of the put operation */
private Future ... | OperationService operationService = mapServiceContext . getNodeEngine ( ) . getOperationService ( ) ; Operation operation = createOperation ( keyValueSequence ) ; return operationService . invokeOnPartition ( MapService . SERVICE_NAME , operation , partitionId ) ; |
public class SnapshotStore { /** * Creates a disk snapshot . */
private Snapshot createDiskSnapshot ( SnapshotDescriptor descriptor ) { } } | SnapshotFile file = new SnapshotFile ( SnapshotFile . createSnapshotFile ( storage . directory ( ) , storage . prefix ( ) , descriptor . index ( ) ) ) ; Snapshot snapshot = new FileSnapshot ( file , descriptor , this ) ; log . debug ( "Created disk snapshot: {}" , snapshot ) ; return snapshot ; |
public class DatastreamResolverServlet { /** * Processes the servlet request and resolves the physical location of the
* specified datastream .
* @ param request
* The servlet request .
* @ param response
* servlet The servlet response .
* @ throws ServletException
* If an error occurs that effects the se... | String id = null ; String dsPhysicalLocation = null ; String dsControlGroupType = null ; MIMETypedStream mimeTypedStream = null ; DisseminationService ds = null ; Timestamp keyTimestamp = null ; Timestamp currentTimestamp = null ; PrintWriter out = null ; ServletOutputStream outStream = null ; id = request . getParamet... |
public class HylaFaxClientSpi { /** * Returns an instance of the hyla fax client .
* @ return The client instance */
protected synchronized HylaFAXClient getHylaFAXClient ( ) { } } | HylaFAXClient client = null ; if ( this . connection == null ) { // create new connection
this . connection = this . connectionFactory . createConnection ( ) ; } // get client
client = this . connection . getResource ( ) ; return client ; |
public class GalleryServiceImpl { /** * A kind of inverse lookup - finding the public path given the actual file .
* < strong > NOTE ! This method does NOT verify that the current user actually
* has the right to access the given publicRoot ! It is the responsibility of
* calling methods to make sure only allowed... | String actualFilePath = file . getCanonicalPath ( ) ; File rootFile = galleryAuthorizationService . getRootPathsForCurrentUser ( ) . get ( publicRoot ) ; String relativePath = actualFilePath . substring ( rootFile . getCanonicalPath ( ) . length ( ) , actualFilePath . length ( ) ) ; StringBuilder builder = new StringBu... |
public class UploadImage { /** * Runs the example .
* @ param adWordsServices the services factory .
* @ param session the session .
* @ throws ApiException if the API request failed with one or more service errors .
* @ throws RemoteException if the API request failed due to other errors .
* @ throws IOExcep... | // Get the MediaService .
MediaServiceInterface mediaService = adWordsServices . get ( session , MediaServiceInterface . class ) ; // Create image .
Image image = new Image ( ) ; image . setData ( com . google . api . ads . common . lib . utils . Media . getMediaDataFromUrl ( "https://goo.gl/3b9Wfh" ) ) ; image . setTy... |
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1203:1 : unaryExpressionNotPlusMinus : ( ' ~ ' unaryExpression | ' ! ' unaryExpression | castExpression | primary ( selector ) * ( ' + + ' | ' - - ' ) ? ) ; */
public final void unaryExpressionNotPl... | int unaryExpressionNotPlusMinus_StartIndex = input . index ( ) ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 125 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1204:5 : ( ' ~ ' unaryExpression | ' ! ' unaryExpression | castExpression ... |
public class HTTPRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( HTTPRequest hTTPRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( hTTPRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( hTTPRequest . getClientIP ( ) , CLIENTIP_BINDING ) ; protocolMarshaller . marshall ( hTTPRequest . getCountry ( ) , COUNTRY_BINDING ) ; protocolMarshaller . marshall ( hTTPR... |
public class SchemaFactoryFinder { /** * < p > Creates an instance of the specified and returns it . < / p >
* @ param className
* fully qualified class name to be instantiated .
* @ return null
* if it fails . Error messages will be printed by this method . */
SchemaFactory createInstance ( String className ) ... | try { if ( debug ) debugPrintln ( "instantiating " + className ) ; Class clazz ; if ( classLoader != null ) clazz = classLoader . loadClass ( className ) ; else clazz = Class . forName ( className ) ; if ( debug ) debugPrintln ( "loaded it from " + which ( clazz ) ) ; Object o = clazz . newInstance ( ) ; if ( o instanc... |
public class AutoFringer { /** * Retrieve or compose an image for the specified fringe . */
protected BufferedImage getTileImage ( BufferedImage img , FringeConfiguration . FringeTileSetRecord tsr , int baseset , int index , int hashValue , Map < Long , BufferedImage > masks ) throws NoSuchTileSetException { } } | int fringeset = tsr . fringe_tsid ; TileSet fset = _tmgr . getTileSet ( fringeset ) ; if ( ! tsr . mask ) { // oh good , this is easy
Tile stamp = fset . getTile ( index ) ; return stampTileImage ( stamp , img , stamp . getWidth ( ) , stamp . getHeight ( ) ) ; } // otherwise , it ' s a mask . .
Long maskkey = Long . va... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.