signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class IndexPreprocessor { /** * Processes index string and creates nodes with " prefix " in given " namespace _ url " from the parsed index entry text .
* @ param theIndexString index string
* param contents index contents
* @ param theTargetDocument target document to create new nodes
* @ param theIndex... | final IndexEntry [ ] indexEntries = IndexStringProcessor . processIndexString ( theIndexString , contents ) ; for ( final IndexEntry indexEntrie : indexEntries ) { theIndexEntryFoundListener . foundEntry ( indexEntrie ) ; } return transformToNodes ( indexEntries , theTargetDocument , null ) ; |
public class HtmlRewriter { /** * / * Rewrites the file to contain html tags */
public static void rewrite ( SoyFileNode file , IdGenerator nodeIdGen , ErrorReporter errorReporter ) { } } | new Visitor ( nodeIdGen , file . getFilePath ( ) , errorReporter ) . exec ( file ) ; |
public class AbstractAmazonSNSAsync { /** * Simplified method form for invoking the SetTopicAttributes operation .
* @ see # setTopicAttributesAsync ( SetTopicAttributesRequest ) */
@ Override public java . util . concurrent . Future < SetTopicAttributesResult > setTopicAttributesAsync ( String topicArn , String attr... | return setTopicAttributesAsync ( new SetTopicAttributesRequest ( ) . withTopicArn ( topicArn ) . withAttributeName ( attributeName ) . withAttributeValue ( attributeValue ) ) ; |
public class DeviceProxyDAODefaultImpl { public List < PipeInfo > getPipeConfig ( DeviceProxy deviceProxy ) throws DevFailed { } } | build_connection ( deviceProxy ) ; if ( deviceProxy . idl_version < 5 ) Except . throw_exception ( "TangoApi_NOT_SUPPORTED" , "Pipe not supported in IDL " + deviceProxy . idl_version ) ; ArrayList < PipeInfo > infoList = new ArrayList < PipeInfo > ( ) ; boolean done = false ; final int retries = deviceProxy . transpare... |
public class TransactionManagerImpl { /** * { @ inheritDoc } */
public Transaction suspend ( ) throws SystemException { } } | Transaction tx = registry . getTransaction ( ) ; registry . assignTransaction ( null ) ; return tx ; |
public class BackPropagationNet { /** * Creates the weights for the hidden layers and output layer
* @ param rand source of randomness */
private void setUp ( Random rand ) { } } | Ws = new ArrayList < > ( npl . length ) ; bs = new ArrayList < > ( npl . length ) ; // First Hiden layer takes input raw
DenseMatrix W = new DenseMatrix ( npl [ 0 ] , inputSize ) ; Vec b = new DenseVector ( W . rows ( ) ) ; initializeWeights ( W , rand ) ; initializeWeights ( b , W . cols ( ) , rand ) ; Ws . add ( W ) ... |
public class Ginv { /** * This routine performs the matrix multiplication . The final matrix size is
* taken from the rows of the left matrix and the columns of the right
* matrix . The timesInner is the minimum of the left columns and the right
* rows .
* @ param matrix1
* the first matrix
* @ param matrix... | int timesRows = matrix1 . length ; int timesCols = matrix2 [ 0 ] . length ; double [ ] [ ] response = new double [ timesRows ] [ timesCols ] ; for ( int row = 0 ; row < timesRows ; row ++ ) { for ( int col = 0 ; col < timesCols ; col ++ ) { for ( int inner = 0 ; inner < timesInner ; inner ++ ) { response [ row ] [ col ... |
public class AbstractControllerServer { /** * @ param name
* @ return
* @ throws NotAvailableException */
protected final Object getDataField ( String name ) throws NotAvailableException { } } | try { MB dataClone = cloneDataBuilder ( ) ; Descriptors . FieldDescriptor findFieldByName = dataClone . getDescriptorForType ( ) . findFieldByName ( name ) ; if ( findFieldByName == null ) { throw new NotAvailableException ( "Field[" + name + "] does not exist for type " + dataClone . getClass ( ) . getName ( ) ) ; } r... |
public class CmsTagReplaceSettings { /** * Sets the path under which files will be processed recursively .
* @ param workPath the path under which files will be processed recursively .
* @ throws CmsIllegalArgumentException if the argument is not valid . */
public void setWorkPath ( String workPath ) throws CmsIlle... | if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( workPath ) ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_ERR_WIDGETVALUE_EMPTY_0 ) ) ; } // test if it is a valid path :
if ( ! m_cms . existsResource ( workPath ) ) { throw new CmsIllegalArgumentException ( Messages . get ( ) ... |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link BigInteger }
* { @ code > } */
@ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "depth" , scope = GetFolderTree . class ) public JAXBElement < BigInteger > createGetFolde... | return new JAXBElement < BigInteger > ( _GetDescendantsDepth_QNAME , BigInteger . class , GetFolderTree . class , value ) ; |
public class CacheProviderWrapper { /** * This returns the cache entry identified by the specified cache id .
* It returns null if not in the cache .
* @ param id The cache id for the entry . The id cannot be null .
* @ param source The source - local or remote ( No effect on CoreCache )
* @ param ignoreCountin... | final String methodName = "getEntry()" ; com . ibm . websphere . cache . CacheEntry ce = this . coreCache . get ( id ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " cacheName=" + cacheName + " id=" + id + " cacheEntry=" + ce ) ; } return ce ; |
public class AbstractBuffer { /** * Resets the buffer ' s internal offset and capacity . */
protected AbstractBuffer reset ( long offset , long capacity , long maxCapacity ) { } } | this . offset = offset ; this . capacity = 0 ; this . initialCapacity = capacity ; this . maxCapacity = maxCapacity ; capacity ( initialCapacity ) ; references . set ( 0 ) ; rewind ( ) ; return this ; |
public class Unchecked { /** * Wrap a { @ link CheckedLongToIntFunction } in a { @ link LongToIntFunction } with a custom handler for checked exceptions .
* Example :
* < code > < pre >
* LongStream . of ( 1L , 2L , 3L ) . mapToInt ( Unchecked . longToIntFunction (
* if ( l & lt ; 0L )
* throw new Exception (... | return t -> { try { return function . applyAsInt ( t ) ; } catch ( Throwable e ) { handler . accept ( e ) ; throw new IllegalStateException ( "Exception handler must throw a RuntimeException" , e ) ; } } ; |
public class AmazonApiGatewayClient { /** * Gets the usage data of a usage plan in a specified time interval .
* @ param getUsageRequest
* The GET request to get the usage data of a usage plan in a specified time interval .
* @ return Result of the GetUsage operation returned by the service .
* @ throws BadRequ... | request = beforeClientExecution ( request ) ; return executeGetUsage ( request ) ; |
public class WebAppParser { /** * Returns the text content of an element or null if the element is null .
* @ param element the same element form which the context should be retrieved
* @ return text content of element */
private static String getTextContent ( final Element element ) { } } | if ( element != null ) { String content = element . getTextContent ( ) ; if ( content != null ) { content = content . trim ( ) ; } return content ; } return null ; |
public class GobblinHadoopJob { /** * Factory method that provides IPropertiesValidator based on preset in runtime .
* Using factory method pattern as it is expected to grow .
* @ return IPropertiesValidator */
private static IPropertiesValidator getValidator ( GobblinPresets preset ) { } } | Objects . requireNonNull ( preset ) ; switch ( preset ) { case MYSQL_TO_HDFS : return new MySqlToHdfsValidator ( ) ; case HDFS_TO_MYSQL : return new HdfsToMySqlValidator ( ) ; default : throw new UnsupportedOperationException ( "Preset " + preset + " is not supported" ) ; } |
public class ApiOvhEmaildomain { /** * Alter this object properties
* REST : PUT / email / domain / { domain } / mailingList / { name }
* @ param body [ required ] New object properties
* @ param domain [ required ] Name of your domain name
* @ param name [ required ] Name of mailing list */
public void domain_... | String qPath = "/email/domain/{domain}/mailingList/{name}" ; StringBuilder sb = path ( qPath , domain , name ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ; |
public class ArtistView { /** * Set the { @ link SoundCloudUser } used as model .
* @ param artist user used as artist . */
public void setModel ( SoundCloudUser artist ) { } } | mModel = artist ; if ( mModel != null ) { Picasso . with ( getContext ( ) ) . load ( SoundCloudArtworkHelper . getCoverUrl ( mModel , SoundCloudArtworkHelper . XLARGE ) ) . fit ( ) . centerInside ( ) . into ( mAvatar ) ; mArtistName . setText ( mModel . getFullName ( ) ) ; mTracks . setText ( String . format ( getResou... |
public class SShape { /** * Computes the membership function evaluated at ` x `
* @ param x
* @ return ` \ begin { cases } 0h & \ mbox { if $ x \ leq s $ } \ cr h ( 2 \ left ( ( x - s ) /
* ( e - s ) \ right ) ^ 2 ) & \ mbox { if $ x \ leq 0.5 ( s + e ) $ } \ cr h ( 1 - 2 \ left ( ( x - e ) /
* ( e - s ) \ righ... | if ( Double . isNaN ( x ) ) { return Double . NaN ; } if ( Op . isLE ( x , start ) ) { return height * 0.0 ; } else if ( Op . isLE ( x , 0.5 * ( start + end ) ) ) { return height * 2.0 * Math . pow ( ( x - start ) / ( end - start ) , 2 ) ; } else if ( Op . isLt ( x , end ) ) { return height * ( 1.0 - 2.0 * Math . pow (... |
public class Transformation3D { /** * Calculates the Inverse transformation .
* @ param src
* The input transformation .
* @ param result
* The inverse of the input transformation . Throws the
* GeometryException ( " math singularity " ) exception if the Inverse
* can not be calculated . */
public static vo... | double det = src . xx * ( src . yy * src . zz - src . zy * src . yz ) - src . yx * ( src . xy * src . zz - src . zy * src . xz ) + src . zx * ( src . xy * src . yz - src . yy * src . xz ) ; if ( det != 0 ) { double xx , yx , zx ; double xy , yy , zy ; double xz , yz , zz ; double xd , yd , zd ; double det_1 = 1.0 / det... |
public class ResourceIndexModule { /** * Shutdown the RI module by closing the wrapped ResourceIndex .
* @ throws ModuleShutdownException
* if any error occurs while closing . */
@ Override public void shutdownModule ( ) throws ModuleShutdownException { } } | if ( _ri != null ) { try { _ri . close ( ) ; } catch ( TrippiException e ) { throw new ModuleShutdownException ( "Error closing RI" , getRole ( ) , e ) ; } } |
public class Expressions { /** * Create a new Template expression
* @ deprecated Use { @ link # dslTemplate ( Class , Template , List ) } instead .
* @ param cl type of expression
* @ param template template
* @ param args template parameters
* @ return template expression */
@ Deprecated public static < T > ... | return new DslTemplate < T > ( cl , template , args ) ; |
public class AppCacheLinker { /** * Determines whether our not the given should be included in the app cache
* manifest . Subclasses may override this method in order to filter out
* specific file patterns .
* @ param path the path of the resource being considered
* @ return true if the file should be included ... | // GWT Development Mode files
if ( path . equals ( "hosted.html" ) || path . endsWith ( ".devmode.js" ) ) { return false ; } // Default or welcome file
if ( path . equals ( "/" ) ) { return true ; } // Whitelisted file extension
int pos = path . lastIndexOf ( '.' ) ; if ( pos != - 1 ) { String extension = path . substr... |
public class AppServiceEnvironmentsInner { /** * Get metrics for a specific instance of a worker pool of an App Service Environment .
* Get metrics for a specific instance of a worker pool of an App Service Environment .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @... | ServiceResponse < Page < ResourceMetricInner > > response = listWorkerPoolInstanceMetricsNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < ResourceMetricInner > ( response . body ( ) ) { @ Override public Page < ResourceMetricInner > nextPage ( String nextPageLink ) { return li... |
public class ModelsImpl { /** * Updates the closed list model .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param clEntityId The closed list model ID .
* @ param closedListModelUpdateObject The new entity name and words list .
* @ param serviceCallback the async ServiceCallba... | return ServiceFuture . fromResponse ( updateClosedListWithServiceResponseAsync ( appId , versionId , clEntityId , closedListModelUpdateObject ) , serviceCallback ) ; |
public class P2sVpnGatewaysInner { /** * Creates a virtual wan p2s vpn gateway if it doesn ' t exist else updates the existing gateway .
* @ param resourceGroupName The resource group name of the P2SVpnGateway .
* @ param gatewayName The name of the gateway .
* @ param p2SVpnGatewayParameters Parameters supplied ... | return ServiceFuture . fromResponse ( createOrUpdateWithServiceResponseAsync ( resourceGroupName , gatewayName , p2SVpnGatewayParameters ) , serviceCallback ) ; |
public class DSLMapWalker { /** * src / main / resources / org / drools / compiler / lang / dsl / DSLMapWalker . g : 34:1 : entry returns [ DSLMappingEntry mappingEntry ] : ^ ( VT _ ENTRY scope _ section ( meta _ section ) ? key _ section ( value _ section ) ? ) ; */
public final DSLMappingEntry entry ( ) throws Recogn... | entry_stack . push ( new entry_scope ( ) ) ; DSLMappingEntry mappingEntry = null ; entry_stack . peek ( ) . retval = new AntlrDSLMappingEntry ( ) ; entry_stack . peek ( ) . variables = new HashMap < String , Integer > ( ) ; entry_stack . peek ( ) . keybuffer = new StringBuilder ( ) ; entry_stack . peek ( ) . valuebuffe... |
public class Rollbar { /** * Record an error or message with extra data at the level specified . At least ene of ` error ` or
* ` description ` must be non - null . If error is null , ` description ` will be sent as a message . If
* error is non - null , description will be sent as the description of the error . Cu... | RollbarThrowableWrapper rollbarThrowableWrapper = null ; if ( error != null ) { rollbarThrowableWrapper = new RollbarThrowableWrapper ( error ) ; } this . log ( rollbarThrowableWrapper , custom , description , level , isUncaught ) ; |
public class CrcConcat { /** * Helper function to transform a CRC using lookup table . Currently it is used
* for calculating CRC after adding bytes zeros to source byte array . The special
* lookup table needs to be passed in for this specific transformation
* @ param crc
* @ param lookupTable
* the first di... | int cb1 = lookupTable [ 0 ] [ crc & 0xff ] ; int cb2 = lookupTable [ 1 ] [ ( crc >>>= 8 ) & 0xff ] ; int cb3 = lookupTable [ 2 ] [ ( crc >>>= 8 ) & 0xff ] ; int cb4 = lookupTable [ 3 ] [ ( crc >>>= 8 ) & 0xff ] ; return cb1 ^ cb2 ^ cb3 ^ cb4 ; |
public class SerialArrayList { /** * Add all int .
* @ param data the data
* @ return the int */
public synchronized int addAll ( Collection < U > data ) { } } | int startIndex = length ( ) ; putAll ( data , startIndex ) ; return startIndex ; |
public class StandardBullhornData { /** * { @ inheritDoc } */
@ Override public FileWrapper updateFile ( Class < ? extends FileEntity > type , Integer entityId , FileMeta fileMeta ) { } } | Map < String , String > uriVariables = restUriVariablesFactory . getUriVariablesForAddFile ( BullhornEntityInfo . getTypesRestEntityName ( type ) , entityId , fileMeta ) ; String url = restUrlFactory . assembleGetFileUrl ( ) ; CrudResponse response ; try { String jsonString = restJsonConverter . convertEntityToJsonStri... |
public class ParserUtils { /** * reads from the specified point in the line and returns how many chars to
* the specified delimiter
* @ param line
* @ param start
* @ param delimiter
* @ return int */
public static int getDelimiterOffset ( final String line , final int start , final char delimiter ) { } } | int idx = line . indexOf ( delimiter , start ) ; if ( idx >= 0 ) { idx -= start - 1 ; } return idx ; |
public class JMElasticsearchSearchAndCount { /** * Search all search response .
* @ param indices the indices
* @ param types the types
* @ param filterQueryBuilder the filter query builder
* @ param aggregationBuilders the aggregation builders
* @ return the search response */
public SearchResponse searchAll... | return searchAll ( false , indices , types , filterQueryBuilder , aggregationBuilders ) ; |
public class ScalarizationUtils { /** * Scalarization values based on angle utility ( see Angle - based Preference
* Models in Multi - objective Optimization by Braun et al . ) . Extreme points
* are computed from the list of solutions .
* @ param solutionsList A list of solutions . */
public static < S extends S... | angleUtility ( solutionsList , getExtremePoints ( solutionsList ) ) ; |
public class GSFLWImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . GSFLW__MH : setMH ( MH_EDEFAULT ) ; return ; case AfplibPackage . GSFLW__MFR : setMFR ( MFR_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class CenteringTransform { /** * Change the coordinate system of { @ code x } from the
* " centered " graphical coordinate system to the global document coordinate system .
* @ param x the x graphical coordinate to convert .
* @ return the x coordinate in the global document coordinate system . */
@ Pure p... | final double adjustedX = x - this . translationX . get ( ) ; return this . invertX . get ( ) ? - adjustedX : adjustedX ; |
public class Iterators2 { /** * Divides an iterator into unmodifiable sublists of equivalent elements . The iterator groups elements
* in consecutive order , forming a new parition when the value from the provided function changes . For example ,
* grouping the iterator { @ code [ 1 , 3 , 2 , 4 , 5 ] } with a funct... | requireNonNull ( iterator ) ; requireNonNull ( groupingFunction ) ; return new AbstractIterator < List < T > > ( ) { private final PeekingIterator < T > peekingIterator = peekingIterator ( iterator ) ; @ Override protected List < T > computeNext ( ) { if ( ! peekingIterator . hasNext ( ) ) return endOfData ( ) ; Object... |
public class JournalOutputFile { /** * Write the document trailer , clean up everything and rename the file . Set
* the flag saying we are closed . */
public void close ( ) throws JournalException { } } | synchronized ( JournalWriter . SYNCHRONIZER ) { if ( ! open ) { return ; } try { parent . getDocumentTrailer ( xmlWriter ) ; xmlWriter . close ( ) ; fileWriter . close ( ) ; timer . cancel ( ) ; /* * java . io . File . renameTo ( ) has a known bug when working across
* file - systems , see :
* http : / / bugs . sun... |
public class UpdateBaseRates { /** * Runs the example .
* @ param adManagerServices the services factory .
* @ param session the session .
* @ param baseRateId the base rate ID to update .
* @ throws ApiException if the API request failed with one or more service errors .
* @ throws RemoteException if the API... | // Get the BaseRateService .
BaseRateServiceInterface baseRateService = adManagerServices . get ( session , BaseRateServiceInterface . class ) ; // Create a statement to only select a single base rate by ID .
StatementBuilder statementBuilder = new StatementBuilder ( ) . where ( "id = :id" ) . orderBy ( "id ASC" ) . li... |
public class ComponentPropertiesKeysListResolver { /** * Gets the display values with the full properties keys as a List of { @ link ResourceBundleKey } .
* @ return the display values */
public List < ResourceBundleKey > getDisplayValues ( ) { } } | final List < ResourceBundleKey > rbk = new ArrayList < > ( ) ; for ( final ResourceBundleKey key : getValues ( ) ) { final ResourceBundleKey clone = ( ResourceBundleKey ) key . clone ( ) ; clone . setKey ( getPropertiesKey ( key . getKey ( ) ) ) ; rbk . add ( clone ) ; } return rbk ; |
public class CloseableIterables { /** * Returns an iterable that applies { @ code function } to each element of { @ code
* fromIterable } . */
public static < F , T > CloseableIterable < T > transform ( final CloseableIterable < F > iterable , final Function < ? super F , ? extends T > function ) { } } | return wrap ( Iterables . transform ( iterable , function :: apply ) , iterable ) ; |
public class druidGLexer { /** * $ ANTLR start " FROM " */
public final void mFROM ( ) throws RecognitionException { } } | try { int _type = FROM ; int _channel = DEFAULT_TOKEN_CHANNEL ; // druidG . g : 628:7 : ( ( ' FROM ' | ' from ' ) )
// druidG . g : 628:9 : ( ' FROM ' | ' from ' )
{ // druidG . g : 628:9 : ( ' FROM ' | ' from ' )
int alt17 = 2 ; int LA17_0 = input . LA ( 1 ) ; if ( ( LA17_0 == 'F' ) ) { alt17 = 1 ; } else if ( ( LA17_... |
public class VaultsInner { /** * Gets the deleted Azure key vault .
* @ param vaultName The name of the vault .
* @ param location The location of the deleted vault .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by serve... | return getDeletedWithServiceResponseAsync ( vaultName , location ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class DirectoryListing { /** * Writable interface */
@ Override public void readFields ( DataInput in ) throws IOException { } } | int numEntries = in . readInt ( ) ; partialListing = new HdfsFileStatus [ numEntries ] ; for ( int i = 0 ; i < numEntries ; i ++ ) { partialListing [ i ] = new HdfsFileStatus ( ) ; partialListing [ i ] . readFields ( in ) ; } remainingEntries = in . readInt ( ) ; |
public class ConstructorExpression { /** * Create an alias for the expression
* @ return alias expression */
public Expression < T > as ( String alias ) { } } | return as ( ExpressionUtils . path ( getType ( ) , alias ) ) ; |
public class SortedLists { /** * Searches the specified naturally ordered list for the specified object using the binary search
* algorithm .
* < p > Equivalent to { @ link # binarySearch ( List , Function , Object , Comparator , KeyPresentBehavior ,
* KeyAbsentBehavior ) } using { @ link Ordering # natural } . *... | checkNotNull ( e ) ; return binarySearch ( list , e , Ordering . natural ( ) , presentBehavior , absentBehavior ) ; |
public class InteractiveElement { /** * ( non - Javadoc )
* @ see
* qc . automation . framework . widget . IInteractiveElement # dragAndDropByOffset ( IElement element ) */
public void dragAndDropByOffset ( int xOffset , int yOffset ) throws WidgetException { } } | try { Actions builder = new Actions ( getGUIDriver ( ) . getWrappedDriver ( ) ) ; synchronized ( InteractiveElement . class ) { getGUIDriver ( ) . focus ( ) ; builder . dragAndDropBy ( getWebElement ( ) , xOffset , yOffset ) . build ( ) . perform ( ) ; } } catch ( Exception e ) { throw new WidgetException ( "Error whil... |
import java . lang . Math ; public class AreaOfRhombus { /** * This function calculates the area of a rhombus given the lengths of its diagonals .
* Examples :
* > > > area _ of _ rhombus ( 10 , 20)
* 100.0
* > > > area _ of _ rhombus ( 10 , 5)
* 25.0
* > > > area _ of _ rhombus ( 4 , 2)
* 4.0
* Argumen... | double rhombus_area = ( diagonal1 * diagonal2 ) / 2.0 ; return rhombus_area ; |
public class BarcodeInter25 { /** * Creates the bars for the barcode .
* @ param text the text . It can contain non numeric characters
* @ return the barcode */
public static byte [ ] getBarsInter25 ( String text ) { } } | text = keepNumbers ( text ) ; if ( ( text . length ( ) & 1 ) != 0 ) throw new IllegalArgumentException ( "The text length must be even." ) ; byte bars [ ] = new byte [ text . length ( ) * 5 + 7 ] ; int pb = 0 ; bars [ pb ++ ] = 0 ; bars [ pb ++ ] = 0 ; bars [ pb ++ ] = 0 ; bars [ pb ++ ] = 0 ; int len = text . length (... |
public class DriverFactory { /** * Add / replace instance in current instance map . Work on a copy of the current map and replace it atomically .
* @ param instanceName
* The name of the provider
* @ param instance
* The instance */
public static void put ( String instanceName , Driver instance ) { } } | // Copy current instances
Map < String , Driver > newInstances = new HashMap < > ( ) ; synchronized ( instances ) { Set < String > keys = instances . getInstances ( ) . keySet ( ) ; for ( String key : keys ) { newInstances . put ( key , instances . getInstances ( ) . get ( key ) ) ; } } // Add new instance
newInstances... |
public class AnalyticFormulas { /** * This static method calculated the vega of a call option under a Black - Scholes model
* @ param initialStockValue The initial value of the underlying , i . e . , the spot .
* @ param riskFreeRate The risk free rate of the bank account numerarie .
* @ param volatility The Blac... | if ( optionStrike <= 0.0 || optionMaturity <= 0.0 ) { // The Black - Scholes model does not consider it being an option
return 0.0 ; } else { // Calculate theta
double dPlus = ( Math . log ( initialStockValue / optionStrike ) + ( riskFreeRate + 0.5 * volatility * volatility ) * optionMaturity ) / ( volatility * Math . ... |
public class PageTableModel { /** * Moves to specific page and fire a data changed ( all rows ) .
* @ return true if we can move to the page . */
public boolean setPage ( int p ) { } } | if ( p >= 0 && p < getPageCount ( ) ) { page = p ; fireTableDataChanged ( ) ; return true ; } return false ; |
public class CommandFactory { /** * Goalie special command . Tries to catch the ball in a given direction
* relative to its body direction . If the catch is successful the ball will
* be in the goalies hand untill kicked away .
* @ param direction The direction in which to catch , relative to its body . */
public... | StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(catch " ) ; buf . append ( direction ) ; buf . append ( ')' ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; |
public class ImageUtil { /** * Create a reduced image ( thumb ) of an image from the given input stream .
* Possible output formats are " jpg " or " png " ( no " gif " ; it is possible to
* read " gif " files , but not to write ) . The resulting thumb is written to
* the output stream . The both streams will be e... | try { try { ImageInputStream imageInput = ImageIO . createImageInputStream ( input ) ; BufferedImage image = ImageIO . read ( imageInput ) ; BufferedImage thumbImage = createThumb ( image , thumbWidth , thumbHeight ) ; ImageIO . write ( thumbImage , format , output ) ; } finally { output . close ( ) ; } } finally { inp... |
public class AnnotationManager { /** * Update annotations on the map .
* @ param annotationList list of annotation to be updated */
@ UiThread public void update ( List < T > annotationList ) { } } | for ( T annotation : annotationList ) { annotations . put ( annotation . getId ( ) , annotation ) ; } updateSource ( ) ; |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getEIM ( ) { } } | if ( eimEClass == null ) { eimEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 248 ) ; } return eimEClass ; |
public class ReferNotifySender { /** * This method creates a NOTIFY message using the given parameters and sends it to the subscriber .
* Knowledge of JAIN - SIP API headers is required . The request will be resent if challenged . Use
* this method only if you have previously called processRefer ( ) or processSubsc... | return super . sendNotify ( subscriptionState , termReason , body , timeLeft , eventHdr , ssHdr , accHdr , ctHdr , viaProxy ) ; |
public class Viterbi { /** * Compute HMM hidden states
* @ param obs observations
* @ param states hidden states
* @ param startProb start probability of the hidden state
* @ param transProb transition probability of the hidden state
* @ param emitProb emission probability
* @ return The most possible hidde... | double [ ] [ ] v = new double [ obs . length ] [ states . length ] ; int [ ] [ ] path = new int [ states . length ] [ obs . length ] ; for ( int y : states ) { v [ 0 ] [ y ] = startProb [ y ] * emitProb [ y ] [ obs [ 0 ] ] ; path [ y ] [ 0 ] = y ; } for ( int t = 1 ; t < obs . length ; ++ t ) { int [ ] [ ] newPath = ne... |
public class AsyncContextImpl { /** * PI43752 start */
public void setDispatchURI ( String uri ) { } } | if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) logger . logp ( Level . FINEST , CLASS_NAME , "setDispatchURI" , "uri -> " + uri ) ; this . dispatchURI = uri ; |
public class ZipFileEntry { /** * Answer the enclosing container of this entry .
* Obtaining the enclosing container is expensive . The implementation
* works very hard to avoid having to obtain the enclosing container .
* First , the zip entry is created with the enclosing container when
* the container is alr... | // The enclosing container may be set when the entry is
// created , in which case the enclosing container lock is null
// and is never needed .
// The entry can be created in these ways :
// ZipFileContainer . createEntry ( ArtifactContainer , String , String , String , int , ZipEntry )
// - - A caching factory method... |
public class ComponentTag { /** * get the content type class object */
protected Class < ? extends SlingBean > getComponentType ( ) throws ClassNotFoundException { } } | if ( componentType == null ) { String type = getType ( ) ; if ( StringUtils . isNotBlank ( type ) ) { componentType = ( Class < ? extends SlingBean > ) context . getType ( type ) ; } } return componentType ; |
public class Led { /** * Sets the color that will be used to calculate the custom led color
* @ param COLOR */
public void setCustomLedColor ( final Color COLOR ) { } } | if ( customLedColor . COLOR . equals ( COLOR ) ) { return ; } customLedColor = new CustomLedColor ( COLOR ) ; final boolean LED_WAS_ON = currentLedImage . equals ( ledImageOn ) ? true : false ; flushImages ( ) ; ledImageOff = create_LED_Image ( getWidth ( ) , 0 , ledColor , ledType ) ; ledImageOn = create_LED_Image ( g... |
public class ExpectationMaximizationGmm_F64 { /** * Using points responsibility information to recompute the Gaussians and their weights , maximizing
* the likelihood of the mixture . */
protected void maximization ( ) { } } | // discard previous parameters by zeroing
for ( int i = 0 ; i < mixture . size ; i ++ ) { mixture . get ( i ) . zero ( ) ; } // compute the new mean
for ( int i = 0 ; i < info . size ; i ++ ) { PointInfo p = info . get ( i ) ; for ( int j = 0 ; j < mixture . size ; j ++ ) { mixture . get ( j ) . addMean ( p . point , p... |
public class MySQLStorage { /** * Lazy to avoid eager I / O */
Schema schema ( ) { } } | if ( schema == null ) { synchronized ( this ) { if ( schema == null ) { schema = new Schema ( datasource , context , strictTraceId ) ; } } } return schema ; |
public class LocalDocumentStore { /** * Store the supplied document and metadata at the given key .
* @ param key the key or identifier for the document
* @ param document the document that is to be stored
* @ see SchematicDb # put ( String , Document ) */
@ RequiresTransaction public void put ( String key , Docu... | database . put ( key , document ) ; |
public class AstCompatGeneratingVisitor { /** * / / - > ^ ( NAMED _ EXPRESSION namedExprTokens ) */
@ Override public T visitNamedExpr ( NamedExprContext ctx ) { } } | // on ( ctx ) ;
appendAst ( ctx , tok ( NAMED_EXPRESSION ) ) ; return super . visitNamedExpr ( ctx ) ; |
public class Util { /** * Return true if Strings are equal including possible null
* @ param thisStr
* @ param thatStr
* @ return boolean true for equal */
public static boolean equalsString ( final String thisStr , final String thatStr ) { } } | if ( ( thisStr == null ) && ( thatStr == null ) ) { return true ; } if ( thisStr == null ) { return false ; } return thisStr . equals ( thatStr ) ; |
public class AuthorizeSecurityGroupIngressRequest { /** * The sets of IP permissions .
* @ return The sets of IP permissions . */
public java . util . List < IpPermission > getIpPermissions ( ) { } } | if ( ipPermissions == null ) { ipPermissions = new com . amazonaws . internal . SdkInternalList < IpPermission > ( ) ; } return ipPermissions ; |
public class ContentSpec { /** * Sets the list of additional files needed by the book .
* @ param files The list of additional Files . */
public void setFiles ( final List < File > files ) { } } | if ( files == null && this . files == null ) { return ; } else if ( files == null ) { removeChild ( this . files ) ; this . files = null ; } else if ( this . files == null ) { this . files = new FileList ( CommonConstants . CS_FILE_TITLE , files ) ; appendChild ( this . files , false ) ; } else { this . files . setValu... |
public class JobConfigurationUtils { /** * Get a new { @ link Properties } instance by combining a given system configuration { @ link Properties }
* object ( first ) and a job configuration { @ link Properties } object ( second ) .
* @ param sysProps the given system configuration { @ link Properties } object
* ... | Properties combinedJobProps = new Properties ( ) ; combinedJobProps . putAll ( sysProps ) ; combinedJobProps . putAll ( jobProps ) ; return combinedJobProps ; |
public class OSMTablesFactory { /** * Drop the existing OSM tables used to store the imported OSM data
* @ param connection
* @ param isH2
* @ param tablePrefix
* @ throws SQLException */
public static void dropOSMTables ( Connection connection , boolean isH2 , String tablePrefix ) throws SQLException { } } | TableLocation requestedTable = TableLocation . parse ( tablePrefix , isH2 ) ; String osmTableName = requestedTable . getTable ( ) ; String [ ] omsTables = new String [ ] { TAG , NODE , NODE_TAG , WAY , WAY_NODE , WAY_TAG , RELATION , RELATION_TAG , NODE_MEMBER , WAY_MEMBER , RELATION_MEMBER } ; StringBuilder sb = new S... |
public class TimedDiffCalculator { /** * Transmits the DiffTask at the end of the RevisionTask processing .
* @ param task
* Reference to the RevisionTask
* @ param result
* Reference to the DiffTask
* @ throws TimeoutException
* if a timeout occurred */
protected void transmitAtEndOfTask ( final Task < Rev... | this . processingTimeDiff += System . currentTimeMillis ( ) - startTime ; if ( task . getTaskType ( ) == TaskTypes . TASK_FULL || task . getTaskType ( ) == TaskTypes . TASK_PARTIAL_LAST ) { diffedSize += result . byteSize ( ) ; ArticleInformation info = result . getHeader ( ) ; info . setRevisionCounter ( revisionCount... |
public class DefaultTemplateEngineProvider { /** * Configure settings from the struts . xml or struts . properties , using
* sensible defaults if values are not provided . */
public void configure ( ) { } } | ServletContext servletContext = ServletActionContext . getServletContext ( ) ; ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver ( servletContext ) ; templateResolver . setTemplateMode ( templateMode ) ; templateResolver . setCharacterEncoding ( characterEncoding ) ; templateResolver ... |
public class ADT { /** * Splits a leaf node using the local { @ link LeafSplitter } .
* @ param nodeToSplit
* the leaf node to split
* @ param distinguishingSuffix
* the input sequence that splits the hypothesis state of the leaf to split and the new node
* @ param oldOutput
* the hypothesis output of the n... | if ( ! ADTUtil . isLeafNode ( nodeToSplit ) ) { throw new IllegalArgumentException ( "Node to split is not a final node" ) ; } if ( ! ( distinguishingSuffix . length ( ) == oldOutput . length ( ) && oldOutput . length ( ) == newOutput . length ( ) ) ) { throw new IllegalArgumentException ( "Distinguishing suffixes and ... |
public class EnumLiteralDeclarationImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnumLiteral getEnumLiteral ( ) { } } | if ( enumLiteral != null && enumLiteral . eIsProxy ( ) ) { InternalEObject oldEnumLiteral = ( InternalEObject ) enumLiteral ; enumLiteral = ( EEnumLiteral ) eResolveProxy ( oldEnumLiteral ) ; if ( enumLiteral != oldEnumLiteral ) { if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . ... |
public class Concurrency { /** * Return an new Concurrency object from the given executor .
* @ param executor the underlying Executor
* @ return a new Concurrency object */
public static Concurrency with ( final Executor executor ) { } } | if ( executor instanceof ForkJoinPool ) { return new ForkJoinPoolConcurrency ( ( ForkJoinPool ) executor ) ; } else if ( executor instanceof ExecutorService ) { return new ExecutorServiceConcurrency ( ( ExecutorService ) executor ) ; } else if ( executor == SERIAL_EXECUTOR ) { return SERIAL_EXECUTOR ; } else { return n... |
public class HectorObjectMapper { /** * Persists the object collection using a single batch mutate . It is up to the
* client to partition large collections appropriately so not to cause timeout
* or buffer overflow issues . The objects can be heterogenous ( mapping to
* multiple column families , etc . )
* @ p... | Mutator < byte [ ] > m = HFactory . createMutator ( keyspace , BytesArraySerializer . get ( ) ) ; Collection < ? > retColl = saveObjCollection ( keyspace , objColl , m ) ; m . execute ( ) ; return retColl ; |
public class StockIcon { /** * Get a particular stock icon .
* @ param name Icon name
* @ return Icon */
public static Icon getStockIcon ( String name ) { } } | SoftReference < Icon > ref = iconcache . get ( name ) ; if ( ref != null ) { Icon icon = ref . get ( ) ; if ( icon != null ) { return icon ; } } java . net . URL imgURL = StockIcon . class . getResource ( name + ".png" ) ; if ( imgURL != null ) { Icon icon = new ImageIcon ( imgURL ) ; iconcache . put ( name , new SoftR... |
public class JaxWsDDHelper { /** * Get the PortComponent by servlet - link .
* @ param servletLink
* @ param containerToAdapt
* @ return
* @ throws UnableToAdaptException */
static PortComponent getPortComponentByServletLink ( String servletLink , Adaptable containerToAdapt ) throws UnableToAdaptException { } } | return getHighLevelElementByServiceImplBean ( servletLink , containerToAdapt , PortComponent . class , LinkType . SERVLET ) ; |
public class NodeAction { /** * 修改Node */
public void doEdit ( @ FormGroup ( "nodeInfo" ) Group nodeInfo , @ FormGroup ( "nodeParameterInfo" ) Group nodeParameterInfo , @ Param ( "pageIndex" ) int pageIndex , @ Param ( "searchKey" ) String searchKey , @ FormField ( name = "formNodeError" , group = "nodeInfo" ) CustomEr... | Node node = new Node ( ) ; NodeParameter parameter = new NodeParameter ( ) ; nodeInfo . setProperties ( node ) ; nodeParameterInfo . setProperties ( parameter ) ; if ( parameter . getDownloadPort ( ) == null || parameter . getDownloadPort ( ) == 0 ) { parameter . setDownloadPort ( node . getPort ( ) . intValue ( ) + 1 ... |
public class BitmapIterationBenchmark { /** * Benchmark of cumulative cost of bitmap union with subsequent iteration over the result . This is a pattern from
* query processing on historical nodes , when filters like { @ link org . apache . druid . segment . filter . DimensionPredicateFilter } ,
* { @ link org . ap... | ImmutableBitmap intersection = factory . union ( Arrays . asList ( state . bitmaps ) ) ; return iter ( intersection ) ; |
public class Element { /** * This is set when the element is associated with the page .
* @ see Page # addElement ( com . aoindustries . docs . Element ) */
void setPage ( Page page ) { } } | synchronized ( lock ) { checkNotFrozen ( ) ; if ( this . page != null ) throw new IllegalStateException ( "element already has a page: " + this ) ; this . page = page ; } assert checkPageAndParentElement ( ) ; |
public class VertxResourceAdapter { /** * This is called when a message endpoint is deactivated .
* @ param endpointFactory
* A message endpoint factory instance .
* @ param spec
* An activation spec JavaBean instance . */
public void endpointDeactivation ( MessageEndpointFactory endpointFactory , ActivationSpe... | VertxActivation activation = activations . remove ( spec ) ; if ( activation != null ) activation . stop ( ) ; log . finest ( "endpointDeactivation()" ) ; |
public class TCPInputPoller { /** * Pop the oldest command from our list and return it .
* @ return the oldest unhandled command in our list */
public CommandAndIPAddress getCommandAndIPAddress ( ) { } } | CommandAndIPAddress command = null ; synchronized ( this ) { if ( commandQueue . size ( ) > 0 ) { command = commandQueue . remove ( 0 ) ; } } return command ; |
public class ULocale { /** * displayLocaleID is canonical , localeID need not be since parsing will fix this . */
private static String getDisplayCountryInternal ( ULocale locale , ULocale displayLocale ) { } } | return LocaleDisplayNames . getInstance ( displayLocale ) . regionDisplayName ( locale . getCountry ( ) ) ; |
public class StringContext { /** * Finds the indices for each occurrence of the given search string in the
* source string , starting from the given index .
* @ param str the source string
* @ param search the string to search for
* @ param fromIndex index to start the find
* @ return an array of indices , wh... | if ( str == null || search == null ) { return new int [ 0 ] ; } int [ ] indices = new int [ 10 ] ; int size = 0 ; int index = fromIndex ; while ( ( index = str . indexOf ( search , index ) ) >= 0 ) { if ( size >= indices . length ) { // Expand capacity .
int [ ] newArray = new int [ indices . length * 2 ] ; System . ar... |
public class ArbitrarySqlTask { /** * This task will only execute if the following column exists */
public void addExecuteOnlyIfColumnExists ( String theTableName , String theColumnName ) { } } | myConditionalOnExistenceOf . add ( new TableAndColumn ( theTableName , theColumnName ) ) ; |
public class RestTemplateBuilder { /** * Set the { @ code Supplier } of { @ link ClientHttpRequestFactory } that should be called
* each time we { @ link # build ( ) } a new { @ link RestTemplate } instance .
* @ param requestFactorySupplier the supplier for the request factory
* @ return a new builder instance
... | Assert . notNull ( requestFactorySupplier , "RequestFactory Supplier must not be null" ) ; return new RestTemplateBuilder ( this . detectRequestFactory , this . rootUri , this . messageConverters , requestFactorySupplier , this . uriTemplateHandler , this . errorHandler , this . basicAuthentication , this . restTemplat... |
public class BatchingEntityLoaderBuilder { /** * Builds a batch - fetch capable loader based on the given persister , lock - options , etc .
* @ param persister The entity persister
* @ param batchSize The maximum number of ids to batch - fetch at once
* @ param lockOptions The lock options
* @ param factory Th... | if ( batchSize <= 1 ) { // no batching
return buildNonBatchingLoader ( persister , lockOptions , factory , influencers , innerEntityLoaderBuilder ) ; } return buildBatchingLoader ( persister , batchSize , lockOptions , factory , influencers , innerEntityLoaderBuilder ) ; |
public class BlockInlineChecksumReader { /** * Implement Scatter Gather read . Since checksum and data are saved separately ,
* we go over the data file twice , the first time for checksums and the second
* time for data . The speed of it then is not necessarily to be faster than
* normal read ( ) and is likely t... | FileInputStream datain = new FileInputStream ( dataFile ) ; FileChannel dch = datain . getChannel ( ) ; int type = replica . getChecksumType ( ) ; int bytesPerChecksum = replica . getBytesPerChecksum ( ) ; long checksumSize = DataChecksum . getChecksumSizeByType ( type ) ; DataChecksum checksum = DataChecksum . newData... |
public class ManagedServerBootCmdFactory { /** * Adds the absolute path to command .
* @ param command the command to add the arguments to .
* @ param typeName the type of directory .
* @ param propertyName the name of the property .
* @ param properties the properties where the path may already be defined .
... | final String result ; final String value = properties . get ( propertyName ) ; if ( value == null ) { switch ( directoryGrouping ) { case BY_TYPE : result = getAbsolutePath ( typeDir , "servers" , serverName ) ; break ; case BY_SERVER : default : result = getAbsolutePath ( serverDir , typeName ) ; break ; } properties ... |
public class JBaseScreen { /** * Return the FieldList describing the screen ' s fields .
* Note : This is used so you can override this method to use more that one field list .
* @ return The fieldlist for this screen ( null if you are past the end of the list ) . */
public FieldList getFieldList ( String strFileNa... | if ( m_vFieldListList == null ) return null ; for ( int i = 0 ; ; i ++ ) { // Step 1 - Disconnect the controls from the fields
FieldList fieldInList = this . getFieldList ( i ) ; if ( fieldInList == null ) break ; if ( strFileName . equalsIgnoreCase ( fieldInList . getTableNames ( false ) ) ) return fieldInList ; // Fo... |
public class Bytes { /** * Copy a subsequence of Bytes to specific byte array . Uses the specified offset in the dest byte
* array to start the copy .
* @ param start index of subsequence start ( inclusive )
* @ param end index of subsequence end ( exclusive )
* @ param dest destination array
* @ param destPo... | // this . subSequence ( start , end ) . copyTo ( dest , destPos ) would allocate another Bytes object
arraycopy ( start , dest , destPos , end - start ) ; |
public class StringUtils { /** * append values to buf separated with the specified separator */
public static void join ( StringBuilder buf , Iterable < ? > values , String separator ) { } } | for ( Iterator < ? > i = values . iterator ( ) ; i . hasNext ( ) ; ) { buf . append ( i . next ( ) ) ; if ( i . hasNext ( ) ) { buf . append ( separator ) ; } } |
public class VdmDropAdapterAssistent { /** * Adds the given status to the list of problems . Discards OK statuses . If
* the status is a multi - status , only its children are added . */
private void mergeStatus ( MultiStatus status , IStatus toMerge ) { } } | if ( ! toMerge . isOK ( ) ) { status . merge ( toMerge ) ; } |
public class Cipher { /** * Initializes this cipher with a key , a set of algorithm
* parameters , and a source of randomness .
* < p > The cipher is initialized for one of the following four operations :
* encryption , decryption , key wrapping or key unwrapping , depending
* on the value of < code > opmode < ... | initialized = false ; checkOpmode ( opmode ) ; chooseProvider ( InitType . ALGORITHM_PARAM_SPEC , opmode , key , params , null , random ) ; initialized = true ; this . opmode = opmode ; |
public class DebugWsDelegate { /** * Runs a diagnostic for a given instance .
* @ return the instance
* @ throws DebugWsException */
public Diagnostic diagnoseInstance ( String applicationName , String instancePath ) throws DebugWsException { } } | this . logger . finer ( "Diagnosing instance " + instancePath + " in application " + applicationName ) ; WebResource path = this . resource . path ( UrlConstants . DEBUG ) . path ( "diagnose-instance" ) ; path = path . queryParam ( "application-name" , applicationName ) ; path = path . queryParam ( "instance-path" , in... |
public class Solo { /** * Returns a Button matching the specified index .
* @ param index the index of the { @ link Button } . { @ code 0 } if only one is available
* @ return a { @ link Button } matching the specified index */
public Button getButton ( int index ) { } } | if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "getButton(" + index + ")" ) ; } return getter . getView ( Button . class , index ) ; |
public class ArtefactHandlerAdapter { /** * < p > Creates new GrailsClass derived object using the type supplied in constructor . May not perform
* optimally but is a convenience . < / p >
* @ param artefactClass Creates a new artefact for the given class
* @ return An instance of the GrailsClass interface repres... | try { Constructor < ? > c = grailsClassImpl . getDeclaredConstructor ( new Class [ ] { Class . class } ) ; // TODO GRAILS - 720 plugin class instance created here first
return ( GrailsClass ) c . newInstance ( new Object [ ] { artefactClass } ) ; } catch ( NoSuchMethodException e ) { throw new GrailsRuntimeException ( ... |
public class LittleEndianRandomAccessFile { /** * Writes a string to the underlying output stream as a sequence of
* bytes . Each character is written to the data output stream as
* if by the { @ code writeByte ( ) } method .
* @ param pString the { @ code String } value to be written .
* @ throws IOException i... | int length = pString . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { file . write ( ( byte ) pString . charAt ( i ) ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.