signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class DeleteFileExtensions { /** * Tries to delete a file and if its a directory than its deletes all the sub - directories .
* @ param file
* The File to delete .
* @ throws IOException
* Signals that an I / O exception has occurred . */
public static void delete ( final @ NonNull File file ) throws IOE... | if ( file . isDirectory ( ) ) { DeleteFileExtensions . deleteAllFiles ( file ) ; } else { String error = null ; // If the file is not deleted
if ( ! file . delete ( ) ) { error = "Cannot delete the File " + file . getAbsolutePath ( ) + "." ; throw new IOException ( error ) ; } } |
public class CommerceDiscountUtil { /** * Returns all the commerce discounts that the user has permission to view where groupId = & # 63 ; and couponCode = & # 63 ; .
* @ param groupId the group ID
* @ param couponCode the coupon code
* @ return the matching commerce discounts that the user has permission to view... | return getPersistence ( ) . filterFindByG_C ( groupId , couponCode ) ; |
public class BoxFactory { /** * Creates the box subtrees for all the child nodes of the DOM node corresponding to the box creatin status . Recursively creates the child boxes
* from the child nodes .
* @ param stat current tree creation status used for determining the parents */
public void createBoxTree ( BoxTreeC... | boolean generated = false ; do { if ( stat . parent . isDisplayed ( ) ) { // add previously created boxes ( the rest from the last twin )
if ( stat . parent . preadd != null ) { addToTree ( stat . parent . preadd , stat ) ; stat . parent . preadd = null ; // don ' t need to keep this anymore
} // create : before elemen... |
public class OSGiServiceRegistryProxyTargetLocator { /** * < p > locateProxyTarget . < / p >
* @ return a { @ link org . ops4j . pax . wicket . spi . ReleasableProxyTarget } object . */
public ReleasableProxyTarget locateProxyTarget ( ) { } } | ServiceReference < ? > [ ] references = fetchReferences ( ) ; if ( references != null ) { // Sort the references . . .
Arrays . sort ( references ) ; // Fetch the first ( if any ) . . .
for ( final ServiceReference < ? > reference : references ) { final Object service = bundleContext . getService ( reference ) ; if ( s... |
public class XPathParser { /** * Checks if a given token represents a ForwardAxis .
* @ return true if the token is a ForwardAxis */
private boolean isForwardAxis ( ) { } } | final String content = mToken . getContent ( ) ; return ( mToken . getType ( ) == TokenType . TEXT && ( "child" . equals ( content ) || ( "descendant" . equals ( content ) || "descendant-or-self" . equals ( content ) || "attribute" . equals ( content ) || "self" . equals ( content ) || "following" . equals ( content ) ... |
public class SSLConnectionContextImpl { /** * @ see com . ibm . wsspi . tcpchannel . SSLConnectionContext # getSession ( ) */
public SSLSession getSession ( ) { } } | if ( this . sslConnLink != null && this . sslConnLink . getSSLEngine ( ) != null ) { return this . sslConnLink . getSSLEngine ( ) . getSession ( ) ; } return null ; |
public class StanzaCollector { /** * Returns the next available stanza . The method call will block ( not return ) until a stanza is available or the
* < tt > timeout < / tt > has elapsed or if the connection was terminated because of an error . If the timeout elapses without a
* result or if there was an connectio... | throwIfCancelled ( ) ; P res = null ; long remainingWait = timeout ; waitStart = System . currentTimeMillis ( ) ; while ( remainingWait > 0 && connectionException == null && ! cancelled ) { synchronized ( this ) { res = ( P ) resultQueue . poll ( ) ; if ( res != null ) { return res ; } wait ( remainingWait ) ; } remain... |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getPGPConstant ( ) { } } | if ( pgpConstantEEnum == null ) { pgpConstantEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 62 ) ; } return pgpConstantEEnum ; |
public class Record { /** * Gets the field at the given position . If the field at that position is null , then this method leaves
* the target field unchanged and returns false .
* @ param fieldNum The position of the field .
* @ param target The value to deserialize the field into .
* @ return True , if the f... | // range check
if ( fieldNum < 0 || fieldNum >= this . numFields ) { throw new IndexOutOfBoundsException ( ) ; } // get offset and check for null
int offset = this . offsets [ fieldNum ] ; if ( offset == NULL_INDICATOR_OFFSET ) { return false ; } else if ( offset == MODIFIED_INDICATOR_OFFSET ) { // value that has been ... |
public class BiIterator { /** * It ' s preferred to call < code > forEachRemaining ( Try . BiConsumer ) < / code > to avoid the create the unnecessary < code > Pair < / code > Objects .
* @ deprecated */
@ Override @ Deprecated public void forEachRemaining ( java . util . function . Consumer < ? super Pair < A , B > ... | super . forEachRemaining ( action ) ; |
public class ArrayUtils { /** * Removes an item from the array .
* If the item has been found , a new array is returned where this item is removed . Otherwise the original array is returned .
* @ param src the src array
* @ param object the object to remove
* @ param < T > the type of the array
* @ return the... | int index = indexOf ( src , object ) ; if ( index == - 1 ) { return src ; } T [ ] dst = ( T [ ] ) Array . newInstance ( src . getClass ( ) . getComponentType ( ) , src . length - 1 ) ; System . arraycopy ( src , 0 , dst , 0 , index ) ; if ( index < src . length - 1 ) { System . arraycopy ( src , index + 1 , dst , index... |
public class ExpandableGridView { /** * Notifies the listener , which has been registered to be notified , when a child has been
* clicked , about a child being clicked .
* @ param view
* The view within the expandable grid view , which has been clicked , as an instance of
* the class { @ link View } . The view... | return childClickListener != null && childClickListener . onChildClick ( this , view , groupIndex , childIndex , id ) ; |
public class DiscoveryClientResolverFactory { /** * Triggers a refresh of the registered name resolvers .
* @ param event The event that triggered the update . */
@ EventListener ( HeartbeatEvent . class ) public void heartbeat ( final HeartbeatEvent event ) { } } | if ( this . monitor . update ( event . getValue ( ) ) ) { for ( final DiscoveryClientNameResolver discoveryClientNameResolver : this . discoveryClientNameResolvers ) { discoveryClientNameResolver . refresh ( ) ; } } |
public class MigrationRepository { /** * Ensures that every path starts and ends with a slash character .
* @ param scriptPath the scriptPath that needs to be normalized
* @ return a path with leading and trailing slash */
private String normalizePath ( String scriptPath ) { } } | StringBuilder builder = new StringBuilder ( scriptPath . length ( ) + 1 ) ; if ( scriptPath . startsWith ( "/" ) ) { builder . append ( scriptPath . substring ( 1 ) ) ; } else { builder . append ( scriptPath ) ; } if ( ! scriptPath . endsWith ( "/" ) ) { builder . append ( "/" ) ; } return builder . toString ( ) ; |
public class SocialNetworkStructureBuilder { /** * Build all combinations of graph structures for generic event stubs of a maximum length
* @ param length Maximum number of nodes in each to generate
* @ return All graph combinations of specified length or less */
public Vector < Graph < UserStub > > generateAllNode... | Vector < Graph < UserStub > > graphs = super . generateAllNodeDataTypeGraphCombinationsOfMaxLength ( length ) ; if ( WRITE_STRUCTURES_IN_PARALLEL ) { // Left as an exercise to the student .
throw new NotImplementedError ( ) ; } else { int i = 0 ; for ( Iterator < Graph < UserStub > > iter = graphs . toIterator ( ) ; it... |
public class ListShardsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListShardsRequest listShardsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listShardsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listShardsRequest . getStreamName ( ) , STREAMNAME_BINDING ) ; protocolMarshaller . marshall ( listShardsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMar... |
public class ReviewsImpl { /** * The reviews created would show up for Reviewers on your team . As Reviewers complete reviewing , results of the Review would be POSTED ( i . e . HTTP POST ) on the specified CallBackEndpoint .
* & lt ; h3 & gt ; CallBack Schemas & lt ; / h3 & gt ;
* & lt ; h4 & gt ; Review Completio... | if ( this . client . baseUrl ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.baseUrl() is required and cannot be null." ) ; } if ( teamName == null ) { throw new IllegalArgumentException ( "Parameter teamName is required and cannot be null." ) ; } if ( urlContentType == null ) { throw new Il... |
public class SimpleXmlWriter { /** * Writes ' < elementName ' . */
public void beginElement ( String elementName ) throws IOException { } } | addElementName ( elementName ) ; indent ( ) ; writer . write ( "<" ) ; writer . write ( elementName ) ; |
public class VirtualMachineImagesInner { /** * Gets a list of all virtual machine image versions for the specified location , publisher , offer , and SKU .
* @ param location The name of a supported Azure region .
* @ param publisherName A valid image publisher .
* @ param offer A valid image publisher offer .
... | if ( location == null ) { throw new IllegalArgumentException ( "Parameter location is required and cannot be null." ) ; } if ( publisherName == null ) { throw new IllegalArgumentException ( "Parameter publisherName is required and cannot be null." ) ; } if ( offer == null ) { throw new IllegalArgumentException ( "Param... |
public class Util { /** * Quote the given string if needed
* @ param value The value to quote ( e . g . bob )
* @ return The quoted string ( e . g . " bob " ) */
public static String quote ( final String value ) { } } | if ( value == null ) { return null ; } String result = value ; if ( ! result . startsWith ( "\"" ) ) { result = "\"" + result ; } if ( ! result . endsWith ( "\"" ) ) { result = result + "\"" ; } return result ; |
public class CPDefinitionLocalizationPersistenceImpl { /** * Returns the last cp definition localization in the ordered set where CPDefinitionId = & # 63 ; .
* @ param CPDefinitionId the cp definition ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ ret... | int count = countByCPDefinitionId ( CPDefinitionId ) ; if ( count == 0 ) { return null ; } List < CPDefinitionLocalization > list = findByCPDefinitionId ( CPDefinitionId , count - 1 , count , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; |
public class ContextStore { /** * - - - Function Properties - - - */
public void storeFunctionPropertyResult ( final String uuid , final String propertyName , final Object value ) { } } | this . functionPropertyCache . put ( contextCacheKey ( uuid , propertyName ) , value ) ; |
public class RestAssuredConfigurator { /** * required for rest assured base URI configuration . */
public void configure ( @ Observes ( precedence = - 200 ) ArquillianDescriptor arquillianDescriptor ) { } } | restAssuredConfigurationInstanceProducer . set ( RestAssuredConfiguration . fromMap ( arquillianDescriptor . extension ( "restassured" ) . getExtensionProperties ( ) ) ) ; |
public class CartesianScaleLabel { /** * Write the options of scale label
* @ return options as JSON object
* @ throws java . io . IOException If an I / O error occurs */
public String encode ( ) throws IOException { } } | FastStringWriter fsw = new FastStringWriter ( ) ; try { fsw . write ( "{" ) ; ChartUtils . writeDataValue ( fsw , "display" , this . display , false ) ; ChartUtils . writeDataValue ( fsw , "labelString" , this . labelString , true ) ; ChartUtils . writeDataValue ( fsw , "lineHeight" , this . lineHeight , true ) ; Chart... |
public class CircuitBreakerHttpClient { /** * Creates a new decorator that binds one { @ link CircuitBreaker } per { @ link HttpMethod } with the specified
* { @ link CircuitBreakerStrategy } .
* < p > Since { @ link CircuitBreaker } is a unit of failure detection , don ' t reuse the same instance for
* unrelated... | return newDecorator ( CircuitBreakerMapping . perMethod ( factory ) , strategy ) ; |
public class LabelingJobInputConfigMarshaller { /** * Marshall the given parameter object . */
public void marshall ( LabelingJobInputConfig labelingJobInputConfig , ProtocolMarshaller protocolMarshaller ) { } } | if ( labelingJobInputConfig == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( labelingJobInputConfig . getDataSource ( ) , DATASOURCE_BINDING ) ; protocolMarshaller . marshall ( labelingJobInputConfig . getDataAttributes ( ) , DATAATTRIBUTE... |
public class WSConnectionRequestInfoImpl { /** * determines if two typeMaps match . Note that this method takes under account
* an Oracle 11g change with TypeMap
* @ param m1
* @ param m2
* @ return */
public static final boolean matchTypeMap ( Map < String , Class < ? > > m1 , Map < String , Class < ? > > m2 )... | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "matchTypeMap" , new Object [ ] { m1 , m2 } ) ; boolean match = false ; if ( m1 == m2 ) match = true ; else if ( m1 != null && m1 . equals ( m2 ) ) match = true ; if ( isTraceOn && tc . isE... |
public class OracleNoSQLClient { /** * Iterate and store attributes .
* @ param entity
* JPA entity .
* @ param metamodel
* JPA meta model .
* @ param row
* kv row .
* @ param attributes
* JPA attributes .
* @ param schemaTable
* the schema table
* @ param metadata
* the metadata */
private void... | for ( Attribute attribute : attributes ) { // by pass association .
if ( ! attribute . isAssociation ( ) ) { // in case of embeddable id .
if ( attribute . equals ( metadata . getIdAttribute ( ) ) && metamodel . isEmbeddable ( ( ( AbstractAttribute ) attribute ) . getBindableJavaType ( ) ) ) { processEmbeddableAttribut... |
public class AtomicInteger { /** * Atomically updates the current value with the results of
* applying the given function to the current and given values ,
* returning the updated value . The function should be
* side - effect - free , since it may be re - applied when attempted
* updates fail due to contention... | int prev , next ; do { prev = get ( ) ; next = accumulatorFunction . applyAsInt ( prev , x ) ; } while ( ! compareAndSet ( prev , next ) ) ; return next ; |
public class BifurcatedConsumerSessionProxy { /** * This method is used to read a set of locked messages held by the message processor .
* This call will simply be passed onto the server who will call the method on the real
* bifurcated consumer session residing on the server .
* @ param msgHandles An array of me... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "readSet" , new Object [ ] { msgHandles . length + " msg ids" } ) ; SIBusMessage [ ] messages = null ; try { closeLock . readLock ( ) . lockInterruptibly ( ) ; try { checkAlreadyClosed ( ) ; CommsByteBuffer request = ... |
public class RSAUtils { /** * 使用模和指数生成RSA私钥
* 注意 : 【 此代码用了默认补位方式 , 为RSA / None / PKCS1Padding , 不同JDK默认的补位方式可能不同 , 如Android默认是RSA
* / None / NoPadding 】
* @ param modulus
* @ param exponent
* 指数
* @ return */
public static RSAPrivateKey getPrivateKey ( String modulus , String exponent ) { } } | try { BigInteger b1 = new BigInteger ( modulus ) ; BigInteger b2 = new BigInteger ( exponent ) ; KeyFactory keyFactory = KeyFactory . getInstance ( KEY_ALGORITHM ) ; RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec ( b1 , b2 ) ; return ( RSAPrivateKey ) keyFactory . generatePrivate ( keySpec ) ; } catch ( Exception e ... |
public class CPFriendlyURLEntryPersistenceImpl { /** * Removes all the cp friendly url entries where classNameId = & # 63 ; and classPK = & # 63 ; from the database .
* @ param classNameId the class name ID
* @ param classPK the class pk */
@ Override public void removeByC_C ( long classNameId , long classPK ) { } ... | for ( CPFriendlyURLEntry cpFriendlyURLEntry : findByC_C ( classNameId , classPK , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( cpFriendlyURLEntry ) ; } |
public class CommercePriceListUtil { /** * Returns the first commerce price list in the ordered set where uuid = & # 63 ; and companyId = & # 63 ; .
* @ param uuid the uuid
* @ param companyId the company ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
*... | return getPersistence ( ) . fetchByUuid_C_First ( uuid , companyId , orderByComparator ) ; |
public class ObjFileLoader { /** * Loads a . obj file , storing the data in the provided lists . After loading , the input stream will be closed . The number of components for each attribute is returned in a Vector3 , x being the
* number of position components , y the number of normal components and z the number of ... | int positionSize = - 1 ; final TFloatList rawTextureCoords = new TFloatArrayList ( ) ; int textureCoordSize = - 1 ; final TFloatList rawNormalComponents = new TFloatArrayList ( ) ; int normalSize = - 1 ; final TIntList textureCoordIndices = new TIntArrayList ( ) ; final TIntList normalIndices = new TIntArrayList ( ) ; ... |
public class HeaderCell { /** * Render the header cell ' s contents . This method sets the style information on the HTML
* th tag and then calls the
* { @ link # renderHeaderCellContents ( org . apache . beehive . netui . tags . rendering . AbstractRenderAppender , String ) }
* method to render the contents of th... | DataGridTagModel dataGridModel = DataGridUtil . getDataGridTagModel ( getJspContext ( ) ) ; assert dataGridModel != null ; TableRenderer tableRenderer = dataGridModel . getTableRenderer ( ) ; assert tableRenderer != null ; ArrayList /* < String > */
styleClasses = new ArrayList /* < String > */
( ) ; /* todo : refactor... |
public class SimplePurview { /** * Returns < code > true < / code > if the given purview in the delegate purview
* @ param values
* @ return */
public boolean has ( int ... values ) { } } | long p = pur ( values [ 0 ] ) ; for ( int i = 1 , l = values . length ; i < l ; i ++ ) { p += pur ( values [ i ] ) ; } return p == ( this . delegate & p ) ; |
public class ObjectEditorTable { /** * Insert the specified element at the specified row . */
public void insertDatum ( Object element , int row ) { } } | _data . add ( row , element ) ; _model . fireTableRowsInserted ( row , row ) ; |
public class UserProfileHandlerImpl { /** * { @ inheritDoc } */
public UserProfile findUserProfileByName ( String userName ) throws Exception { } } | UserProfile profile = getFromCache ( userName ) ; if ( profile != null ) { return profile ; } Session session = service . getStorageSession ( ) ; try { profile = readProfile ( session , userName ) ; if ( profile != null ) { putInCache ( profile ) ; } } finally { session . logout ( ) ; } return profile ; |
public class MemoryManager { /** * Allocates a set of memory segments from this memory manager . If the memory manager pre - allocated the
* segments , they will be taken from the pool of memory segments . Otherwise , they will be allocated
* as part of this call .
* @ param owner The owner to associate with the ... | // sanity check
if ( owner == null ) { throw new IllegalArgumentException ( "The memory owner must not be null." ) ; } // reserve array space , if applicable
if ( target instanceof ArrayList ) { ( ( ArrayList < MemorySegment > ) target ) . ensureCapacity ( numPages ) ; } // - - - - - BEGIN CRITICAL SECTION - - - - -
sy... |
public class ConcurrentDateFormatAccess { /** * Convert date to string .
* @ param date the date
* @ return the string */
public String convertDateToString ( final Date date ) { } } | if ( date == null ) { return null ; } return dateFormat . get ( ) . format ( date ) ; |
public class AmazonRedshiftClient { /** * Modifies the maintenance settings of a cluster . For example , you can defer a maintenance window . You can also
* update or cancel a deferment .
* @ param modifyClusterMaintenanceRequest
* @ return Result of the ModifyClusterMaintenance operation returned by the service ... | request = beforeClientExecution ( request ) ; return executeModifyClusterMaintenance ( request ) ; |
public class PrimitiveTransformation { /** * < code > . google . privacy . dlp . v2 . CharacterMaskConfig character _ mask _ config = 3 ; < / code > */
public com . google . privacy . dlp . v2 . CharacterMaskConfig getCharacterMaskConfig ( ) { } } | if ( transformationCase_ == 3 ) { return ( com . google . privacy . dlp . v2 . CharacterMaskConfig ) transformation_ ; } return com . google . privacy . dlp . v2 . CharacterMaskConfig . getDefaultInstance ( ) ; |
public class DataLabelingServiceClient { /** * Formats a string containing the fully - qualified path to represent a data _ item resource .
* @ deprecated Use the { @ link DataItemName } class instead . */
@ Deprecated public static final String formatDataItemName ( String project , String dataset , String dataItem )... | return DATA_ITEM_PATH_TEMPLATE . instantiate ( "project" , project , "dataset" , dataset , "data_item" , dataItem ) ; |
public class StatementExecutor { /** * Delete an object from the database by id . */
public int deleteById ( DatabaseConnection databaseConnection , ID id , ObjectCache objectCache ) throws SQLException { } } | if ( mappedDelete == null ) { mappedDelete = MappedDelete . build ( dao , tableInfo ) ; } int result = mappedDelete . deleteById ( databaseConnection , id , objectCache ) ; if ( dao != null && ! localIsInBatchMode . get ( ) ) { dao . notifyChanges ( ) ; } return result ; |
public class HttpContext { /** * Execute a PUT call against the partial URL .
* @ param < T > The type parameter used for the return object
* @ param partialUrl The partial URL to build
* @ param payload The object to use for the PUT
* @ param headers A set of headers to add to the request
* @ param queryPara... | URI uri = buildUri ( partialUrl ) ; return executePutRequest ( uri , payload , headers , queryParams , returnType ) ; |
public class ConfigManager { /** * Reload config file if it hasn ' t been loaded in a while
* Returns true if the file was reloaded . */
public synchronized boolean reloadConfigsIfNecessary ( ) { } } | long time = RaidNode . now ( ) ; if ( time > lastReloadAttempt + reloadInterval ) { lastReloadAttempt = time ; try { File file = new File ( configFileName ) ; long lastModified = file . lastModified ( ) ; if ( lastModified > lastSuccessfulReload && time > lastModified + RELOAD_WAIT ) { reloadConfigs ( ) ; lastSuccessfu... |
public class MemcachedSessionService { /** * Check if the valid session associated with the provided
* requested session Id will be relocated with the next { @ link # backupSession ( Session , boolean ) }
* and change the session id to the new one ( containing the new memcached node ) . The
* new session id must ... | if ( ! _memcachedNodesManager . isEncodeNodeIdInSessionId ( ) ) { return null ; } try { if ( _sticky ) { /* We can just lookup the session in the local session map , as we wouldn ' t get
* the session from memcached if the node was not available - or , the other way round ,
* if we would get the session from memcac... |
public class TileSetRuleSet { /** * Adds the necessary rules to the digester to parse our tilesets .
* Derived classes should override this method , being sure to call the
* superclass method and then adding their own rule instances ( which
* should register themselves relative to the < code > _ prefix < / code >... | // this creates the appropriate instance when we encounter a
// < tileset > tag
digester . addObjectCreate ( _path , getTileSetClass ( ) . getName ( ) ) ; // grab the name attribute from the < tileset > tag
digester . addSetProperties ( _path ) ; // grab the image path from an element
digester . addCallMethod ( _path +... |
public class CommercePriceListAccountRelPersistenceImpl { /** * Creates a new commerce price list account rel with the primary key . Does not add the commerce price list account rel to the database .
* @ param commercePriceListAccountRelId the primary key for the new commerce price list account rel
* @ return the n... | CommercePriceListAccountRel commercePriceListAccountRel = new CommercePriceListAccountRelImpl ( ) ; commercePriceListAccountRel . setNew ( true ) ; commercePriceListAccountRel . setPrimaryKey ( commercePriceListAccountRelId ) ; String uuid = PortalUUIDUtil . generate ( ) ; commercePriceListAccountRel . setUuid ( uuid )... |
public class Conference { /** * Gets list all members from a conference . If a member had already hung up or removed from conference it will be displayed as completed .
* @ return list of members
* @ throws IOException unexpected error . */
public List < ConferenceMember > getMembers ( ) throws Exception { } } | final String membersPath = StringUtils . join ( new String [ ] { getUri ( ) , "members" } , '/' ) ; final JSONArray array = toJSONArray ( client . get ( membersPath , null ) ) ; final List < ConferenceMember > members = new ArrayList < ConferenceMember > ( ) ; for ( final Object obj : array ) { members . add ( new Conf... |
public class DeploymentsInner { /** * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager . .
* @ param resourceGroupName The name of the resource group the template will be deployed to . The name is case insensitive .
* @ param deploymentName The name of... | return ServiceFuture . fromResponse ( validateWithServiceResponseAsync ( resourceGroupName , deploymentName , properties ) , serviceCallback ) ; |
public class GoogleConnector { /** * Requests the user info for the given account . This requires previous
* authorization from the user , so this might start the process .
* @ param accountId
* The id of the account to get the user info .
* @ return The user info bean .
* @ throws IOException If the account ... | Credential credential = impl_getStoredCredential ( accountId ) ; if ( credential == null ) { throw new UnsupportedOperationException ( "The account has not been authorized yet!" ) ; } Userinfoplus info = impl_requestUserInfo ( credential ) ; GoogleAccount account = new GoogleAccount ( ) ; account . setId ( accountId ) ... |
public class JDBCInputFormat { /** * Closes all resources used .
* @ throws IOException Indicates that a resource could not be closed . */
@ Override public void close ( ) throws IOException { } } | if ( resultSet == null ) { return ; } try { resultSet . close ( ) ; } catch ( SQLException se ) { LOG . info ( "Inputformat ResultSet couldn't be closed - " + se . getMessage ( ) ) ; } |
public class CommsServerByteBuffer { /** * Reads the data for a transaction .
* @ param connectionObjectId
* @ param linkState
* @ param txOptimized
* @ return Returns the identifier for the transaction in the link level state transaction table
* ( or the value CommsUtils . NO _ TRANSACTION if there was no tr... | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getSITransactionId" , new Object [ ] { "" + connectionObjectId , linkState , "" + txOptimized } ) ; final int transactionId ; int transactionFlags = - 1 ; if ( txOptimized ) { // Read the flags BIT32 from the data .
transactionFlags = getInt ( ) ; // Check transacted... |
public class SchemaUsageAnalyzer { /** * Extracts a numeric id from a string , which can be either a Wikidata
* entity URI or a short entity or property id .
* @ param idString
* @ param isUri
* @ return numeric id , or 0 if there was an error */
private Integer getNumId ( String idString , boolean isUri ) { } ... | String numString ; if ( isUri ) { if ( ! idString . startsWith ( "http://www.wikidata.org/entity/" ) ) { return 0 ; } numString = idString . substring ( "http://www.wikidata.org/entity/Q" . length ( ) ) ; } else { numString = idString . substring ( 1 ) ; } return Integer . parseInt ( numString ) ; |
public class FlowMeter { /** * Takes a sample of the request rates . Calculations are based on
* differences in request counts since the last call to
* < code > sample ( ) < / code > .
* @ return an array of three < code > doubles < / code > : total requests per
* second , successful requests per second , faile... | long [ ] currCounts = counter . sample ( ) ; long now = System . currentTimeMillis ( ) ; if ( lastSampleMillis != 0 ) { long deltaTime = now - lastSampleMillis ; if ( deltaTime == 0 ) return lastKnownRates ; lastKnownRates [ 0 ] = rate ( currCounts [ 0 ] - lastTotal , deltaTime ) ; lastKnownRates [ 1 ] = rate ( currCou... |
public class DescribeDBInstancesResult { /** * Detailed information about one or more DB instances .
* @ param dBInstances
* Detailed information about one or more DB instances . */
public void setDBInstances ( java . util . Collection < DBInstance > dBInstances ) { } } | if ( dBInstances == null ) { this . dBInstances = null ; return ; } this . dBInstances = new java . util . ArrayList < DBInstance > ( dBInstances ) ; |
public class DbPro { /** * Batch save records using the " insert into . . . " sql generated by the first record in recordList .
* Ensure all the record can use the same sql as the first record .
* @ param tableName the table name */
public int [ ] batchSave ( String tableName , List < Record > recordList , int batc... | if ( recordList == null || recordList . size ( ) == 0 ) return new int [ 0 ] ; Record record = recordList . get ( 0 ) ; Map < String , Object > cols = record . getColumns ( ) ; int index = 0 ; StringBuilder columns = new StringBuilder ( ) ; // the same as the iterator in Dialect . forDbSave ( ) to ensure the order of t... |
public class Util { /** * Utility method to format algorithms name in Java like way
* @ param mode
* @ param padding
* @ return string name with the formatted algorithm */
public static String formatter ( Mode mode , Padding padding ) { } } | return String . format ( "%s/%s" , mode , padding ) ; |
public class LdapConsentRepository { /** * Modifies the consent decisions attribute on the entry .
* @ param newConsent new set of consent decisions
* @ param entry entry of consent decisions
* @ return true / false */
private boolean executeModifyOperation ( final Set < String > newConsent , final LdapEntry entr... | val attrMap = new HashMap < String , Set < String > > ( ) ; attrMap . put ( this . ldap . getConsentAttributeName ( ) , newConsent ) ; LOGGER . debug ( "Storing consent decisions [{}] at LDAP attribute [{}] for [{}]" , newConsent , attrMap . keySet ( ) , entry . getDn ( ) ) ; return LdapUtils . executeModifyOperation (... |
public class Vectors { /** * Creates a sum vector accumulator that calculates the sum of all elements in the vector .
* @ param neutral the neutral value
* @ return a sum accumulator */
public static VectorAccumulator asSumAccumulator ( final double neutral ) { } } | return new VectorAccumulator ( ) { private BigDecimal result = BigDecimal . valueOf ( neutral ) ; @ Override public void update ( int i , double value ) { result = result . add ( BigDecimal . valueOf ( value ) ) ; } @ Override public double accumulate ( ) { double value = result . setScale ( Vectors . ROUND_FACTOR , Ro... |
public class QueryBuilder { /** * Creates a new { @ code TRUNCATE } query .
* < p > This is a shortcut for { @ link # truncate ( CqlIdentifier , CqlIdentifier )
* truncate ( CqlIdentifier . fromCql ( keyspace ) , CqlIdentifier . fromCql ( table ) ) } .
* @ param keyspace the name of the keyspace to use .
* @ pa... | return truncate ( keyspace == null ? null : CqlIdentifier . fromCql ( keyspace ) , CqlIdentifier . fromCql ( table ) ) ; |
public class JsfFaceletScannerPlugin { /** * Try to find an existing { @ link JsfFaceletDescriptor } with the given
* parameters .
* @ param templateFqn
* full qualified name of the including file
* @ param path
* the found path to the included file
* @ param context
* The scanner context
* @ return an ... | String includedFile = absolutifyFilePath ( path , templateFqn ) ; return getJsfTemplateDescriptor ( includedFile , context ) ; |
public class Util { /** * delegate to your to an ExceptionAction and wraps checked exceptions in RuntimExceptions , leaving unchecked exceptions alone .
* @ return A
* @ throws Either Error or RuntimeException . Error on Errors in doAction and RuntimeException if doError throws a RuntimeException or an Exception . ... | try { return action . doAction ( ) ; } catch ( RuntimeException e ) { throw e ; } catch ( Error e ) { throw e ; } catch ( Throwable e ) { throw new RuntimeException ( e ) ; } |
public class SRTUpgradeOutputStream31 { /** * @ see javax . servlet . ServletOutputStream # println ( boolean ) */
public void println ( boolean b ) throws IOException { } } | if ( this . _listener != null && ! checkIfCalledFromWLonError ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "non blocking println boolean , WriteListener enabled: " + this . _listener ) ; _outHelper . println_NonBlocking ( Boolean . toString ( b ) ) ; } else { if (... |
public class CallbackThread { @ Override public void run ( ) { } } | // System . out . println ( " I am in thread ! " ) ;
// All info are in AsyncCallObjec . It does everything itself
try { aco . manage_reply ( 0 ) ; } catch ( final Exception e ) { System . err . println ( e ) ; } |
public class SamlIdPObjectEncrypter { /** * Encode encrypted id .
* @ param samlObject the saml object
* @ param service the service
* @ param adaptor the adaptor
* @ return the encrypted id */
@ SneakyThrows public EncryptedID encode ( final NameID samlObject , final SamlRegisteredService service , final SamlR... | val encrypter = buildEncrypterForSamlObject ( samlObject , service , adaptor ) ; return encrypter . encrypt ( samlObject ) ; |
public class TrackerClient { /** * Fire the new peer discovery event to all listeners .
* @ param peers The list of peers discovered . */
protected void fireDiscoveredPeersEvent ( List < Peer > peers , String hexInfoHash ) { } } | for ( AnnounceResponseListener listener : this . listeners ) { listener . handleDiscoveredPeers ( peers , hexInfoHash ) ; } |
public class Quaterniond { /** * Set this quaternion to be a representation of the supplied axis and
* angle ( in radians ) .
* @ param axis
* the rotation axis
* @ param angle
* the angle in radians
* @ return this */
public Quaterniond fromAxisAngleRad ( Vector3dc axis , double angle ) { } } | return fromAxisAngleRad ( axis . x ( ) , axis . y ( ) , axis . z ( ) , angle ) ; |
public class Monitoring { /** * < pre >
* Monitoring configurations for sending metrics to the producer project .
* There can be multiple producer destinations . A monitored resouce type may
* appear in multiple monitoring destinations if different aggregations are
* needed for different sets of metrics associa... | return producerDestinations_ . get ( index ) ; |
public class ArrayTrie { @ Override public V get ( String s , int offset , int len ) { } } | int t = 0 ; for ( int i = 0 ; i < len ; i ++ ) { char c = s . charAt ( offset + i ) ; int index = __lookup [ c & 0x7f ] ; if ( index >= 0 ) { int idx = t * ROW_SIZE + index ; t = _rowIndex [ idx ] ; if ( t == 0 ) return null ; } else { char [ ] big = _bigIndex == null ? null : _bigIndex [ t ] ; if ( big == null ) retur... |
public class Messages { /** * Create constant name .
* @ param state STATE _ UNCHANGED , STATE _ CHANGED , STATE _ NEW or STATE _ DELETED .
* @ return cconstanname as String */
public static String getStateKey ( CmsResourceState state ) { } } | StringBuffer sb = new StringBuffer ( STATE_PREFIX ) ; sb . append ( state ) ; sb . append ( STATE_POSTFIX ) ; return sb . toString ( ) ; |
public class ListTagsForStreamRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListTagsForStreamRequest listTagsForStreamRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listTagsForStreamRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listTagsForStreamRequest . getStreamName ( ) , STREAMNAME_BINDING ) ; protocolMarshaller . marshall ( listTagsForStreamRequest . getExclusiveStartTagKey ( ) , E... |
public class HourRanges { /** * Adds some hour ranges to this instance and returns a new one . < br >
* < br >
* It is only allowed to call this method if the hour ranges represents only one day . This means a value like ' 18:00-03:00 ' will lead to
* an error . To avoid this , call the { @ link # normalize ( ) }... | Contract . requireArgNotNull ( "other" , other ) ; ensureSingleDayOnly ( "this" , this ) ; ensureSingleDayOnly ( "other" , other ) ; final BitSet thisMinutes = this . toMinutes ( ) ; final BitSet otherMinutes = other . toMinutes ( ) ; thisMinutes . or ( otherMinutes ) ; return HourRanges . valueOf ( thisMinutes ) ; |
public class MapBuilder { /** * Returns a new MapBuilder with the given entry . */
public static < K , V > MapBuilder < K , V > of ( K key , V value ) { } } | return new MapBuilder < K , V > ( ) . put ( key , value ) ; |
public class ScanIterator { /** * Sequentially iterate over keys in the keyspace . This method uses { @ code SCAN } to perform an iterative scan .
* @ param commands the commands interface , must not be { @ literal null } .
* @ param scanArgs the scan arguments , must not be { @ literal null } .
* @ param < K > K... | LettuceAssert . notNull ( scanArgs , "ScanArgs must not be null" ) ; return scan ( commands , Optional . of ( scanArgs ) ) ; |
public class XMLDocumentCache { /** * Retrieve the currently cached value for the given document . */
public static Result get ( XmlFileModel key ) { } } | String cacheKey = getKey ( key ) ; Result result = null ; CacheDocument reference = map . get ( cacheKey ) ; if ( reference == null ) return new Result ( false , null ) ; if ( reference . parseFailure ) return new Result ( true , null ) ; Document document = reference . getDocument ( ) ; if ( document == null ) LOG . i... |
public class SwaggerBuilder { /** * Register an Operation ' s parameters .
* @ param swagger
* @ param operation
* @ param route
* @ param method
* @ return the registered Swagger URI for the operation */
protected String registerParameters ( Swagger swagger , Operation operation , Route route , Method method... | Map < String , Object > pathParameterPlaceholders = new HashMap < > ( ) ; for ( String uriParameterName : getUriParameterNames ( route . getUriPattern ( ) ) ) { // path parameters are required
PathParameter pathParameter = new PathParameter ( ) ; pathParameter . setName ( uriParameterName ) ; setPropertyType ( swagger ... |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getCFC ( ) { } } | if ( cfcEClass == null ) { cfcEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 226 ) ; } return cfcEClass ; |
public class AbstractColumnFamilyOutputFormat { /** * Fills the deprecated OutputFormat interface for streaming . */
@ Deprecated public void checkOutputSpecs ( org . apache . hadoop . fs . FileSystem filesystem , org . apache . hadoop . mapred . JobConf job ) throws IOException { } } | checkOutputSpecs ( job ) ; |
public class ModuleMetadataDatabaseImpl { /** * { @ inheritDoc } */
public List < MetadataDatabase > getMetadadaDatabasesSharedFolders ( ResponseListNetworkSharedFolder responseNetworkSharedFolders ) { } } | // Init the list
List < MetadataDatabase > databases = new ArrayList < MetadataDatabase > ( ) ; if ( null != responseNetworkSharedFolders ) { for ( ObjectNetworkShare networkShare : responseNetworkSharedFolders . getNetworkShares ( ) ) { try { MetadataDatabase database = getDatabase ( networkShare . getUrl ( ) ) ; data... |
public class PathUtils { /** * Copies a directory .
* NOTE : This method is not thread - safe .
* Most of the implementation is thanks to
* http : / / stackoverflow . com / questions / 17641706 / how - to - copy - a - directory - with - its - attributes - permissions - from - one
* - location - to - ano / 18691... | copyDirectory ( sourceDirectory , targetDirectory , emptySet ( ) ) ; |
public class Log4JULogger { /** * { @ inheritDoc } */
public void debug ( final Object parameterizedMsg , final Object param1 ) { } } | if ( logger . isDebugEnabled ( ) ) { logger . debug ( MessageFormatter . format ( parameterizedMsg . toString ( ) , param1 ) ) ; } |
public class BundleAdjustmentMetricResidualFunction { /** * projection from 3D coordinates */
private void project3 ( double [ ] output ) { } } | int observationIndex = 0 ; for ( int viewIndex = 0 ; viewIndex < structure . views . length ; viewIndex ++ ) { SceneStructureMetric . View view = structure . views [ viewIndex ] ; SceneStructureMetric . Camera camera = structure . cameras [ view . camera ] ; // = = = = = Project General Points in this View
{ SceneObser... |
public class Primitive { /** * Unwrap Primitive wrappers to their java . lang wrapper values .
* e . g . Primitive ( 42 ) becomes Integer ( 42)
* @ see # unwrap ( Object ) */
public static Object [ ] unwrap ( Object [ ] args ) { } } | if ( args == null ) return null ; Object [ ] oa = new Object [ args . length ] ; for ( int i = 0 ; i < args . length ; i ++ ) oa [ i ] = unwrap ( args [ i ] ) ; return oa ; |
public class SQLiteConnection { /** * Collects statistics about database connection memory usage .
* @ param dbStatsList The list to populate . */
void collectDbStats ( ArrayList < com . couchbase . lite . internal . database . sqlite . SQLiteDebug . DbStats > dbStatsList ) { } } | // Get information about the main database .
int lookaside = nativeGetDbLookaside ( mConnectionPtr ) ; long pageCount = 0 ; long pageSize = 0 ; try { pageCount = executeForLong ( "PRAGMA page_count;" , null , null ) ; pageSize = executeForLong ( "PRAGMA page_size;" , null , null ) ; } catch ( com . couchbase . lite . i... |
public class HelpCommand { /** * { @ inheritDoc } */
@ Override int execute ( OptionsAndArgs pOpts , Object pVm , VirtualMachineHandler pHandler ) throws InvocationTargetException , NoSuchMethodException , IllegalAccessException { } } | printUsage ( ) ; return 0 ; |
public class JavaSoundPlayer { /** * Use the gain control to implement volume . */
protected static void adjustVolume ( Line line , float vol ) { } } | FloatControl control = ( FloatControl ) line . getControl ( FloatControl . Type . MASTER_GAIN ) ; // the only problem is that gain is specified in decibals , which is a logarithmic scale .
// Since we want max volume to leave the sample unchanged , our
// maximum volume translates into a 0db gain .
float gain ; if ( vo... |
public class FileHelper { /** * Returns < code > true < / code > if the first file is newer than the second file .
* Returns < code > true < / code > if the first file exists and the second file does
* not exist . Returns < code > false < / code > if the first file is older than the
* second file . Returns < code... | ValueEnforcer . notNull ( aFile1 , "File1" ) ; ValueEnforcer . notNull ( aFile2 , "aFile2" ) ; // Compare with the same file ?
if ( aFile1 . equals ( aFile2 ) ) return false ; // if the first file does not exists , always false
if ( ! aFile1 . exists ( ) ) return false ; // first file exists , but second file does not
... |
public class AbstractMonteCarloProduct { /** * This method returns the value under shifted market data ( or model parameters ) .
* In its default implementation it does bump ( creating a new model ) and revalue .
* Override the way the new model is created , to implemented improved techniques ( proxy scheme , re - ... | return getValuesForModifiedData ( 0.0 , model , dataModified ) ; |
public class StorableIndex { /** * Returns a new array with all the properties in it , with directions
* folded in . */
@ SuppressWarnings ( "unchecked" ) public OrderedProperty < S > [ ] getOrderedProperties ( ) { } } | OrderedProperty < S > [ ] ordered = new OrderedProperty [ mProperties . length ] ; for ( int i = mProperties . length ; -- i >= 0 ; ) { ordered [ i ] = OrderedProperty . get ( mProperties [ i ] , mDirections [ i ] ) ; } return ordered ; |
public class MapTileApproximater { /** * Approximate a tile from a lower zoom level
* @ since 6.0.0
* @ param pProvider Source tile provider
* @ param pMapTileIndex Destination tile , for the same place on the planet as the source , but on a higher zoom
* @ param pZoomDiff Zoom level difference between the dest... | if ( pZoomDiff <= 0 ) { return null ; } final int srcZoomLevel = MapTileIndex . getZoom ( pMapTileIndex ) - pZoomDiff ; if ( srcZoomLevel < pProvider . getMinimumZoomLevel ( ) ) { return null ; } if ( srcZoomLevel > pProvider . getMaximumZoomLevel ( ) ) { return null ; } final long srcTile = MapTileIndex . getTileIndex... |
public class CommerceRegionLocalServiceWrapper { /** * Returns a range of all the commerce regions .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thu... | return _commerceRegionLocalService . getCommerceRegions ( start , end ) ; |
public class DateUtils { /** * Converts an RFC3339 formatted Date String to a Java Date RFC3339 format : yyyy - MM - dd HH : mm : ss
* @ param rfc3339FormattedDate RFC3339 formatted Date
* @ return an { @ link Date } object
* @ throws InvalidFormatException the RFC3339 formatted Date is invalid or cannot be parse... | SimpleDateFormat rfc3339DateFormat = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) ; try { return rfc3339DateFormat . parse ( rfc3339FormattedDate ) ; } catch ( ParseException e ) { throw new InvalidFormatException ( "Error parsing as date" , rfc3339FormattedDate , Date . class ) ; } |
public class FileUtils { /** * Guava predicates and functions */
public static Predicate < File > isDirectoryPredicate ( ) { } } | return new Predicate < File > ( ) { @ Override public boolean apply ( final File input ) { return input . isDirectory ( ) ; } } ; |
public class RotationAxisAligner { /** * Returns a vector perpendicular to the principal rotation vector
* for the alignment of structures in the xy - plane
* @ return reference vector */
private void calcReferenceVector ( ) { } } | referenceVector = null ; if ( rotationGroup . getPointGroup ( ) . startsWith ( "C" ) ) { referenceVector = getReferenceAxisCylic ( ) ; } else if ( rotationGroup . getPointGroup ( ) . startsWith ( "D" ) ) { referenceVector = getReferenceAxisDihedral ( ) ; } else if ( rotationGroup . getPointGroup ( ) . equals ( "T" ) ) ... |
public class PublicCardUrl { /** * Get Resource Url for Update
* @ param cardId Unique identifier of the card associated with the customer account billing contact .
* @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This param... | UrlFormatter formatter = new UrlFormatter ( "/payments/commerce/payments/cards/{cardId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "cardId" , cardId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . PCI_POD )... |
public class StreamingConnectionFactory { /** * Sets the connect timeout in the specified time unit .
* @ param connectTimeout the connectWait to set
* @ param unit the time unit to set */
public void setConnectTimeout ( long connectTimeout , TimeUnit unit ) { } } | this . connectTimeout = Duration . ofMillis ( unit . toMillis ( connectTimeout ) ) ; |
public class MOEADD { /** * Calculate the norm of the vector */
public double norm_vector ( double [ ] z ) { } } | double sum = 0 ; for ( int i = 0 ; i < problem . getNumberOfObjectives ( ) ; i ++ ) { sum += z [ i ] * z [ i ] ; } return Math . sqrt ( sum ) ; |
public class WebAppConfiguratorHelper { /** * To configure JMS Destinations
* @ param jmsDestinations */
private void configureJMSDestinations ( List < JMSDestination > jmsDestinations ) { } } | Map < String , ConfigItem < JMSDestination > > jmsDestinationConfigItemMap = configurator . getConfigItemMap ( JNDIEnvironmentRefType . JMSConnectionFactory . getXMLElementName ( ) ) ; for ( JMSDestination jmsDestination : jmsDestinations ) { String name = jmsDestination . getName ( ) ; if ( name == null ) { continue ;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.