signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class MOTDDialog { /** * Hides this { @ code MOTDDialog } and marks its { @ link MOTD } as read using
* { @ link MOTD # markAsRead ( ) } */
private void hide ( ) { } } | try { motd . markAsRead ( ) ; stage . hide ( ) ; } catch ( ClassNotFoundException | IOException e ) { FOKLogger . log ( MOTDDialog . class . getName ( ) , Level . SEVERE , FOKLogger . DEFAULT_ERROR_TEXT , e ) ; } |
public class ArchiveBase { /** * { @ inheritDoc }
* @ see org . jboss . shrinkwrap . api . Archive # move ( java . lang . String , java . lang . String ) */
@ Override public T move ( String source , String target ) throws IllegalArgumentException , IllegalArchivePathException { } } | Validate . notNullOrEmpty ( source , "The source path was not specified" ) ; Validate . notNullOrEmpty ( target , "The target path was not specified" ) ; final ArchivePath sourcePath = new BasicPath ( source ) ; final ArchivePath targetPath = new BasicPath ( target ) ; return move ( sourcePath , targetPath ) ; |
public class InMemoryTokenStore { /** * Convenience method for super admin users to remove all tokens ( useful for testing , not really in production ) */
public void clear ( ) { } } | accessTokenStore . clear ( ) ; authenticationToAccessTokenStore . clear ( ) ; clientIdToAccessTokenStore . clear ( ) ; refreshTokenStore . clear ( ) ; accessTokenToRefreshTokenStore . clear ( ) ; authenticationStore . clear ( ) ; refreshTokenAuthenticationStore . clear ( ) ; refreshTokenToAccessTokenStore . clear ( ) ;... |
public class ImageUrlsFetcher { /** * Reads an InputStream and converts it to a String . */
private static String readAsString ( InputStream stream ) throws IOException { } } | StringWriter writer = new StringWriter ( ) ; Reader reader = new BufferedReader ( new InputStreamReader ( stream , "UTF-8" ) ) ; while ( true ) { int c = reader . read ( ) ; if ( c < 0 ) { break ; } writer . write ( c ) ; } return writer . toString ( ) ; |
public class DiagnosticsInner { /** * Get Diagnostics Categories .
* Get Diagnostics Categories .
* ServiceResponse < PageImpl < DiagnosticCategoryInner > > * @ param resourceGroupName Name of the resource group to which the resource belongs .
* ServiceResponse < PageImpl < DiagnosticCategoryInner > > * @ param s... | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( siteName == null ) { throw new IllegalArgumentException ( "Parameter siteName is required and cannot be null." ) ; } if ( slot == null ) { throw new IllegalArgumentException (... |
public class ManagedServer { /** * Unregister the mgmt channel .
* @ param old the proxy controller to unregister
* @ param shuttingDown whether the server inventory is shutting down
* @ return whether the registration can be removed from the domain - controller */
boolean callbackUnregistered ( final Transaction... | // Disconnect the remote connection .
// WFCORE - 196 Do this out of the sync block to avoid deadlocks where in - flight requests can ' t
// be informed that the channel has closed
protocolClient . disconnected ( old ) ; synchronized ( this ) { // If the connection dropped without us stopping the process ask for reconn... |
public class ReactionRenderer { /** * Set the scale for an IReaction . It calculates the average bond length
* of the model and calculates the multiplication factor to transform this
* to the bond length that is set in the RendererModel .
* @ param reaction */
@ Override public void setScale ( IReaction reaction ... | double bondLength = AverageBondLengthCalculator . calculateAverageBondLength ( reaction ) ; double scale = this . calculateScaleForBondLength ( bondLength ) ; // store the scale so that other components can access it
this . rendererModel . getParameter ( Scale . class ) . setValue ( scale ) ; |
public class MockRepository { /** * Clear all state of the mock repository except for static initializers .
* The reason for not clearing static initializers is that when running in a
* suite with many tests the clear method is invoked after each test . This
* means that before the test that needs to suppress the... | newSubstitutions . clear ( ) ; classMocks . clear ( ) ; instanceMocks . clear ( ) ; objectsToAutomaticallyReplayAndVerify . clear ( ) ; additionalState . clear ( ) ; suppressConstructor . clear ( ) ; suppressMethod . clear ( ) ; substituteReturnValues . clear ( ) ; suppressField . clear ( ) ; suppressFieldTypes . clear... |
public class RedirectRule { /** * Adds a new parameter rule with the specified name and returns it .
* @ param parameterName the parameter name
* @ return the parameter item rule */
public ItemRule newParameterItemRule ( String parameterName ) { } } | ItemRule itemRule = new ItemRule ( ) ; itemRule . setName ( parameterName ) ; addParameterItemRule ( itemRule ) ; return itemRule ; |
public class SimpleLogger { /** * Perform single parameter substitution before logging the message of level
* ERROR according to the format outlined above . */
public void error ( String format , Object arg ) { } } | formatAndLog ( LOG_LEVEL_ERROR , format , arg , null ) ; |
public class AbstractExample { /** * < p > at . < / p >
* @ param i a int .
* @ param indexes a int .
* @ return a { @ link com . greenpepper . Example } object . */
public Example at ( int i , int ... indexes ) { } } | Example at = at ( i ) ; for ( int j : indexes ) { if ( at == null || ! at . hasChild ( ) ) return null ; at = at . firstChild ( ) . at ( j ) ; } return at ; |
public class TypeCheck { /** * Given a constructor or an interface type , find out whether the unknown
* type is a supertype of the current type . */
private static boolean hasUnknownOrEmptySupertype ( FunctionType ctor ) { } } | checkArgument ( ctor . isConstructor ( ) || ctor . isInterface ( ) ) ; checkArgument ( ! ctor . isUnknownType ( ) ) ; // The type system should notice inheritance cycles on its own
// and break the cycle .
while ( true ) { ObjectType maybeSuperInstanceType = ctor . getPrototype ( ) . getImplicitPrototype ( ) ; if ( may... |
public class MorfologikLemmatizer { /** * Generate the dictionary keys ( word , postag ) .
* @ param word
* the surface form
* @ param postag
* the assigned postag
* @ return a list of keys consisting of the word and its postag */
private List < String > getDictKeys ( final String word , final String postag )... | final List < String > keys = new ArrayList < String > ( ) ; keys . addAll ( Arrays . asList ( word . toLowerCase ( ) , postag ) ) ; return keys ; |
public class ToXdr { /** * Lookup the index for the argument , or if it isn ' t present , create one . */
private int simpleGroupPath_index ( dictionary_delta dict_delta , SimpleGroupPath group ) { } } | final BiMap < SimpleGroupPath , Integer > dict = from_ . getGroupDict ( ) . inverse ( ) ; final Integer resolved = dict . get ( group ) ; if ( resolved != null ) return resolved ; final int allocated = allocate_index_ ( dict ) ; dict . put ( group , allocated ) ; // Create new pdd for serialization .
path_dictionary_de... |
public class ModelsImpl { /** * Adds a customizable prebuilt domain along with all of its models to this application .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param addCustomPrebuiltDomainOptionalParameter the object representing the optional parameters to be set before calli... | return ServiceFuture . fromResponse ( addCustomPrebuiltDomainWithServiceResponseAsync ( appId , versionId , addCustomPrebuiltDomainOptionalParameter ) , serviceCallback ) ; |
public class WebDavServer { /** * Creates a new WebDAV servlet ( without starting it yet ) .
* @ param rootPath The path to the directory which should be served as root resource .
* @ param contextPath The servlet context path , i . e . the path of the root resource .
* @ return The controller object for this new... | WebDavServletComponent servletComp = servletFactory . create ( rootPath , contextPath ) ; return servletComp . servlet ( ) ; |
public class CustomPopupWindow { /** * 设置ContentView的出场动画 */
public void setContentViewExitAnimation ( int anim ) { } } | contentExitAnimation = AnimationUtils . loadAnimation ( mTrigger . getContext ( ) , anim ) ; contentExitAnimation . setAnimationListener ( mExitAnimationListener ) ; |
public class TemplateBasedViewBuilder { /** * Need fix width and height to ensure info widget panel is drawn correctly
* @ return */
private VerticalPanel fixedWidthAndHeightPanel ( ) { } } | final VerticalPanel verticalPanel = new VerticalPanel ( ) ; verticalPanel . setHeight ( "300px" ) ; verticalPanel . setWidth ( "500px" ) ; return verticalPanel ; |
public class LBiObjBoolConsumerBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static < T1 , T2 > LBiObjBoolConsumer < T1 , T2 > biObjBoolConsumerFrom ( Consumer < LBiObjBoolConsumerBuilder < T1 ... | LBiObjBoolConsumerBuilder builder = new LBiObjBoolConsumerBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class SwingGroovyMethods { /** * Allow MutableTreeNode to work with subscript operators . < p >
* < b > WARNING : < / b > this operation does not replace the node at the
* specified index , rather it inserts the node at that index , thus
* increasing the size of the treeNode by 1 . < p >
* @ param self a... | self . insert ( node , index ) ; |
public class FilterByteBuffer { /** * Tries to fill dst .
* @ param dst
* @ return
* @ throws IOException
* @ throws EOFException If get request couldn ' t be filled . */
public FilterByteBuffer get ( byte [ ] dst ) throws IOException { } } | checkIn ( ) ; int rc = in . read ( dst ) ; if ( rc != dst . length ) { throw new EOFException ( ) ; } position += dst . length ; return this ; |
public class Parameters { /** * Creates new Parameters from ConfigMap object .
* @ param config a ConfigParams that contain parameters .
* @ return a new Parameters object .
* @ see ConfigParams */
public static Parameters fromConfig ( ConfigParams config ) { } } | Parameters result = new Parameters ( ) ; if ( config == null || config . size ( ) == 0 ) return result ; for ( Map . Entry < String , String > entry : config . entrySet ( ) ) { result . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } return result ; |
public class HmmerDemo { /** * Fetch a protein sequence from the UniProt web site
* @ param uniProtID
* @ return a Protein Sequence
* @ throws Exception */
private static ProteinSequence getUniprot ( String uniProtID ) throws Exception { } } | AminoAcidCompoundSet set = AminoAcidCompoundSet . getAminoAcidCompoundSet ( ) ; UniprotProxySequenceReader < AminoAcidCompound > uniprotSequence = new UniprotProxySequenceReader < AminoAcidCompound > ( uniProtID , set ) ; ProteinSequence seq = new ProteinSequence ( uniprotSequence ) ; return seq ; |
public class AddressHelper { /** * Set the actual port used for mission control - not persisted , could be different each time the Mod is run .
* @ param port the port currently in use for mission control . */
static public void setMissionControlPort ( int port ) { } } | if ( port != AddressHelper . missionControlPort ) { AddressHelper . missionControlPort = port ; // Also update our metadata , for displaying to the user :
ModMetadata md = Loader . instance ( ) . activeModContainer ( ) . getMetadata ( ) ; if ( port != - 1 ) md . description = "Talk to this Mod using port " + TextFormat... |
public class CmsButtonBarHandler { /** * Handles the mouse over event for a choice widget . < p >
* @ param choice the event source */
private void overAttributeChoice ( CmsAttributeChoiceWidget choice ) { } } | cancelChoiceTimer ( ) ; if ( choice . getParent ( ) != m_buttonBar ) { closeAll ( ) ; m_buttonBar = choice . getParent ( ) ; setButtonBarVisibility ( m_buttonBar , true ) ; } if ( m_choice != choice ) { closeAllChoices ( ) ; m_choice = choice ; m_choice . show ( ) ; } |
public class StringUtil { /** * Convert a < code > String < / code > to a < code > BigDecimal < / code > .
* Returns an empty { @ code Optional } if the string is { @ code null } or can ' t be parsed as { @ code BigDecimal } .
* @ param str a < code > String < / code > to convert , may be null
* @ return */
publi... | if ( N . isNullOrEmptyOrBlank ( str ) || str . trim ( ) . startsWith ( "--" ) ) { return Optional . empty ( ) ; } try { return Optional . of ( new BigDecimal ( str ) ) ; } catch ( NumberFormatException e ) { return Optional . empty ( ) ; } |
public class HttpUtil { /** * Forward POST to uri based on given request
* @ param uri uri The URI to forward to .
* @ param request The original { @ link HttpServletRequest }
* @ param forwardHeaders Should headers of request should be forwarded
* @ return
* @ throws URISyntaxException
* @ throws HttpExcep... | Header [ ] headersToForward = null ; if ( request != null && forwardHeaders ) { headersToForward = HttpUtil . getHeadersFromRequest ( request ) ; } String ctString = request . getContentType ( ) ; ContentType ct = ContentType . parse ( ctString ) ; String body = getRequestBody ( request ) ; return HttpUtil . postBody (... |
public class WebhookMessage { /** * forcing first pair as we expect at least one entry ( Effective Java 3rd . Edition - Item 53) */
public static WebhookMessage files ( String name1 , Object data1 , Object ... attachments ) { } } | Checks . notBlank ( name1 , "Name" ) ; Checks . notNull ( data1 , "Data" ) ; Checks . notNull ( attachments , "Attachments" ) ; Checks . check ( attachments . length % 2 == 0 , "Must provide even number of varargs arguments" ) ; int fileAmount = 1 + attachments . length / 2 ; Checks . check ( fileAmount <= WebhookMessa... |
public class OmsHillshade { /** * Re - set the no value to NaN ( I have set it to - 9999.0 in order to use this
* value in the equation ) and set the border to 0. */
private void setNoValueBorder ( WritableRaster pitWR , int width , int height , WritableRaster hillshadeWR ) { } } | for ( int y = 2 ; y < height - 2 ; y ++ ) { for ( int x = 2 ; x < width - 2 ; x ++ ) { if ( pitWR . getSampleDouble ( x , y , 0 ) == - 9999.0 ) { hillshadeWR . setSample ( x , y , 0 , doubleNoValue ) ; } } } // maybe NaN instead of 0
for ( int y = 0 ; y < height ; y ++ ) { hillshadeWR . setSample ( 0 , y , 0 , 0 ) ; hi... |
public class AccountsInner { /** * Gets the specified Azure Storage account linked to the given Data Lake Analytics account .
* @ param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account .
* @ param accountName The name of the Data Lake Analytics account from which ... | return getStorageAccountWithServiceResponseAsync ( resourceGroupName , accountName , storageAccountName ) . map ( new Func1 < ServiceResponse < StorageAccountInfoInner > , StorageAccountInfoInner > ( ) { @ Override public StorageAccountInfoInner call ( ServiceResponse < StorageAccountInfoInner > response ) { return res... |
public class CmsTree { /** * Creates error information output . < p >
* @ param t an error that occurred
* @ return error information output */
private String printError ( Throwable t ) { } } | StringBuffer result = new StringBuffer ( 1024 ) ; result . append ( "/*\n" ) ; result . append ( CmsStringUtil . escapeHtml ( t . getMessage ( ) ) ) ; result . append ( "\n*/\n" ) ; result . append ( "function init() {\n" ) ; result . append ( "}\n" ) ; return result . toString ( ) ; |
public class Neo4JEdge { /** * { @ inheritDoc } */
@ Override @ SuppressWarnings ( "unchecked" ) public < V > Iterator < Property < V > > properties ( String ... propertyKeys ) { } } | Objects . requireNonNull ( propertyKeys , "propertyKeys cannot be null" ) ; // check filter is a single property
if ( propertyKeys . length == 1 ) { // property value
Property < V > propertyValue = properties . get ( propertyKeys [ 0 ] ) ; if ( propertyValue != null ) { // return iterator
return Collections . singleton... |
public class CompositeRecordReader { /** * Pass skip key to child RRs . */
public void skip ( K key ) throws IOException { } } | ArrayList < ComposableRecordReader < K , ? > > tmp = new ArrayList < ComposableRecordReader < K , ? > > ( ) ; while ( ! q . isEmpty ( ) && cmp . compare ( q . peek ( ) . key ( ) , key ) <= 0 ) { tmp . add ( q . poll ( ) ) ; } for ( ComposableRecordReader < K , ? > rr : tmp ) { rr . skip ( key ) ; if ( rr . hasNext ( ) ... |
public class TrainingsImpl { /** * Queues project for training .
* @ param projectId The project id
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture }... | return ServiceFuture . fromResponse ( trainProjectWithServiceResponseAsync ( projectId ) , serviceCallback ) ; |
public class ChunkMapReader { /** * get conflict table .
* @ return conflict table , absolute temporary files */
public Map < URI , URI > getConflicTable ( ) { } } | for ( final Map . Entry < URI , URI > e : conflictTable . entrySet ( ) ) { assert e . getKey ( ) . isAbsolute ( ) ; assert e . getValue ( ) . isAbsolute ( ) ; } return conflictTable ; |
public class SameDiff { /** * Evaluate the performance of a single variable ' s prediction . < br >
* For example , if the variable to evaluatate was called " softmax " you would use :
* < pre >
* { @ code Evaluation e = new Evaluation ( ) ;
* sameDiff . evaluate ( iterator , " softmax " , e ) ; }
* < / pre >... | Preconditions . checkArgument ( evaluations != null && evaluations . length > 0 , "No evaluations were passed to the evaluate method" ) ; evaluate ( new MultiDataSetIteratorAdapter ( iterator ) , Collections . singletonMap ( outputVariable , Arrays . asList ( evaluations ) ) , Collections . singletonMap ( outputVariabl... |
public class RunMojo { /** * Add any relevant project dependencies to the classpath . Indirectly takes
* includePluginDependencies and ExecutableDependency into consideration .
* @ param path classpath of { @ link java . net . URL } objects
* @ throws MojoExecutionException */
private void addRelevantPluginDepend... | if ( hasCommandlineArgs ( ) ) { arguments = parseCommandlineArgs ( ) ; } try { Iterator < Artifact > iter = this . determineRelevantPluginDependencies ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { Artifact classPathElement = iter . next ( ) ; // we must skip org . osgi . core , otherwise we get a
// java . lang .... |
public class Smb2TreeConnectResponse { /** * { @ inheritDoc }
* @ throws Smb2ProtocolDecodingException
* @ see jcifs . internal . smb2 . ServerMessageBlock2 # readBytesWireFormat ( byte [ ] , int ) */
@ Override protected int readBytesWireFormat ( byte [ ] buffer , int bufferIndex ) throws SMBProtocolDecodingExcept... | int start = bufferIndex ; int structureSize = SMBUtil . readInt2 ( buffer , bufferIndex ) ; if ( structureSize != 16 ) { throw new SMBProtocolDecodingException ( "Structure size is not 16" ) ; } this . shareType = buffer [ bufferIndex + 2 ] ; bufferIndex += 4 ; this . shareFlags = SMBUtil . readInt4 ( buffer , bufferIn... |
public class ZKDatabase { /** * the process txn on the data
* @ param hdr the txnheader for the txn
* @ param txn the transaction that needs to be processed
* @ return the result of processing the transaction on this
* datatree / zkdatabase */
public ProcessTxnResult processTxn ( TxnHeader hdr , Record txn ) { ... | return dataTree . processTxn ( hdr , txn ) ; |
public class QueryStringSigner { /** * This signer will add " Signature " parameter to the request . Default
* signature version is " 2 " and default signing algorithm is " HmacSHA256 " .
* AWSAccessKeyId SignatureVersion SignatureMethod Timestamp Signature
* @ param request
* request to be signed .
* @ param... | sign ( request , SignatureVersion . V2 , SigningAlgorithm . HmacSHA256 , credentials ) ; |
public class CmsSiteSelectorOptionBuilder { /** * Adds the shared folder . < p > */
public void addSharedSite ( ) { } } | String shared = OpenCms . getSiteManager ( ) . getSharedFolder ( ) ; if ( shared . endsWith ( "/" ) ) { // IMPORTANT : remove last " / " .
// Otherwise the version without slash will be added as well when you are in the shared folder currently .
shared = shared . substring ( 0 , shared . length ( ) - 1 ) ; } if ( ( sha... |
public class MapViewPosition { /** * The pivot point is the point the map zooms around . If the map zooms around its center null is returned , otherwise
* the zoom - specific x / y pixel coordinates for the MercatorProjection ( note : not the x / y coordinates for the map
* view or the frame buffer , the MapViewPos... | if ( this . pivot != null ) { return MercatorProjection . getPixel ( this . pivot , MercatorProjection . getMapSize ( zoomLevel , displayModel . getTileSize ( ) ) ) ; } return null ; |
public class EquivalenceResourceImpl { /** * { @ inheritDoc } */
@ Override public void openResources ( ) throws IOException { } } | for ( final JDBMEquivalenceLookup lookup : lookupMap . values ( ) ) { lookup . open ( ) ; } opened = true ; |
public class CommonsStreamFactory { /** * Uses the { @ link ArchiveStreamFactory } to create a new { @ link ArchiveInputStream } for the given archive file .
* @ param archive the archive file
* @ return a new { @ link ArchiveInputStream } for the given archive file
* @ throws IOException propagated IOException w... | return createArchiveInputStream ( new BufferedInputStream ( new FileInputStream ( archive ) ) ) ; |
public class SFTPClient { /** * Change file or directory permissions .
* @ param path file or directory path .
* @ param permissions POSIX permissions .
* @ throws IOException in case of error . */
public void chmod ( String path , int permissions ) throws IOException { } } | SFTPv3FileAttributes atts = new SFTPv3FileAttributes ( ) ; atts . permissions = permissions ; setstat ( path , atts ) ; |
public class YahooFinance { /** * Sends a single request to Yahoo Finance to retrieve a quote
* for all the requested FX symbols .
* See < code > getFx ( String ) < / code > for more information on the
* accepted FX symbols .
* @ param symbols an array of FX symbols
* @ return the requested FX symbols mapped ... | List < FxQuote > quotes ; if ( YahooFinance . QUOTES_QUERY1V7_ENABLED . equalsIgnoreCase ( "true" ) ) { FxQuotesQuery1V7Request request = new FxQuotesQuery1V7Request ( Utils . join ( symbols , "," ) ) ; quotes = request . getResult ( ) ; } else { FxQuotesRequest request = new FxQuotesRequest ( Utils . join ( symbols , ... |
public class AnalyzeDataSourceRiskDetails { /** * < code >
* . google . privacy . dlp . v2 . AnalyzeDataSourceRiskDetails . CategoricalStatsResult categorical _ stats _ result = 4;
* < / code > */
public com . google . privacy . dlp . v2 . AnalyzeDataSourceRiskDetails . CategoricalStatsResult getCategoricalStatsRes... | if ( resultCase_ == 4 ) { return ( com . google . privacy . dlp . v2 . AnalyzeDataSourceRiskDetails . CategoricalStatsResult ) result_ ; } return com . google . privacy . dlp . v2 . AnalyzeDataSourceRiskDetails . CategoricalStatsResult . getDefaultInstance ( ) ; |
public class LogarithmicBarrier { /** * Create the barrier function for the Phase I .
* It is a LogarithmicBarrier for the constraints :
* < br > fi ( X ) - s , i = 1 , . . . , n */
@ Override public BarrierFunction createPhase1BarrierFunction ( ) { } } | final int dimPh1 = dim + 1 ; ConvexMultivariateRealFunction [ ] inequalitiesPh1 = new ConvexMultivariateRealFunction [ this . fi . length ] ; for ( int i = 0 ; i < inequalitiesPh1 . length ; i ++ ) { final ConvexMultivariateRealFunction originalFi = this . fi [ i ] ; ConvexMultivariateRealFunction fi = new ConvexMultiv... |
public class ListUtil { /** * casts a list to Array object , remove all empty items at start and end of the list and store count
* to info
* @ param list list to cast
* @ param delimiter delimter of the list
* @ param info
* @ return Array Object */
public static Array listToArrayTrim ( String list , String d... | if ( delimiter . length ( ) == 1 ) return listToArrayTrim ( list , delimiter . charAt ( 0 ) , info ) ; if ( list . length ( ) == 0 ) return new ArrayImpl ( ) ; char [ ] del = delimiter . toCharArray ( ) ; char c ; // remove at start
outer : while ( list . length ( ) > 0 ) { c = list . charAt ( 0 ) ; for ( int i = 0 ; i... |
public class AtomContainer { /** * { @ inheritDoc } */
@ Override public int getConnectedBondsCount ( IAtom atom ) { } } | int count = 0 ; for ( int i = 0 ; i < bondCount ; i ++ ) { if ( bonds [ i ] . contains ( atom ) ) ++ count ; } if ( count == 0 && ! contains ( atom ) ) throw new NoSuchAtomException ( "Atom does not belong to the container!" ) ; return count ; |
public class Smoothing { /** * Simple Explonential Smoothing
* @ param flatDataList
* @ param a
* @ return */
public static double simpleExponentialSmoothing ( FlatDataList flatDataList , double a ) { } } | double EMA = 0 ; int count = 0 ; for ( int i = flatDataList . size ( ) - 1 ; i >= 0 ; -- i ) { double Yti = flatDataList . getDouble ( i ) ; EMA += a * Math . pow ( 1 - a , count ) * Yti ; ++ count ; } return EMA ; |
public class ProtectionContainersInner { /** * Unregisters the given container from your Recovery Services Vault .
* This is an asynchronous operation . To determine whether the backend service has finished processing the request , call Get Container Operation Result API .
* @ param vaultName The name of the recove... | return ServiceFuture . fromResponse ( unregisterWithServiceResponseAsync ( vaultName , resourceGroupName , fabricName , containerName ) , serviceCallback ) ; |
public class DOMJettyWebXmlParser { /** * Reference an id value object .
* @ param obj @ param node @ return @ exception NoSuchMethodException
* @ exception ClassNotFoundException @ exception InvocationTargetException */
private Object refObj ( Object obj , Element node ) throws Exception { } } | String id = getAttribute ( node , "id" ) ; // CHECKSTYLE : OFF
obj = _idMap . get ( id ) ; // CHECKSTYLE : ON
if ( obj == null ) { throw new IllegalStateException ( "No object for id=" + id ) ; } configure ( obj , node , 0 ) ; return obj ; |
public class DeltaFIFO { /** * Update items in the delta FIFO .
* @ param obj the obj */
@ Override public void update ( Object obj ) { } } | lock . writeLock ( ) . lock ( ) ; try { populated = true ; this . queueActionLocked ( DeltaType . Updated , obj ) ; } finally { lock . writeLock ( ) . unlock ( ) ; } |
public class CPOptionCategoryUtil { /** * Returns the last cp option category 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_Last ( uuid , companyId , orderByComparator ) ; |
public class FileResourceProcessor { /** * Generate the output path given the resource and the output dir .
* E . g . : / content / test / test . html - > / output / test / test . html
* @ param resource
* @ return */
public Path normalizeOutputPath ( FileResource resource ) { } } | Path resourcePath = resource . getPath ( ) ; Path rel = Optional . ofNullable ( ( contentDir . relativize ( resourcePath ) ) . getParent ( ) ) . orElseGet ( ( ) -> resourcePath . getFileSystem ( ) . getPath ( "" ) ) ; String finalOutput = rel . resolve ( finalOutputName ( resource ) ) . toString ( ) ; // outputDir and ... |
public class JdbcTemplate { /** * 关闭语句
* @ param stmt */
private void closeStatement ( Statement stmt ) { } } | if ( stmt != null ) { try { stmt . close ( ) ; } catch ( SQLException e ) { logger . error ( "Could not close JDBC Statement" , e ) ; } catch ( Throwable e ) { logger . error ( "Unexpected exception on closing JDBC Statement" , e ) ; } } |
public class WasHttpSessionAdapter { /** * Method adapt
* Creates a WAS http session wrapper , SessionData , around the ISession */
public Object adapt ( ISession isess ) { } } | Object adaptation = isess . getAdaptation ( ) ; if ( null == adaptation ) { adaptation = _sessionCtx . createSessionObject ( isess , _servletCtx ) ; isess . setAdaptation ( adaptation ) ; } return adaptation ; |
public class T38FaxStatusEvent { /** * convenience methods */
public Integer getTotalLagInMilliSeconds ( ) { } } | final String totalLagStripped = stripUnit ( this . totalLag ) ; return totalLagStripped == null ? null : Integer . valueOf ( totalLagStripped ) ; |
public class JenkinsServer { /** * Rename a job
* @ param oldJobName existing job name .
* @ param newJobName The new job name .
* @ throws IOException In case of a failure . */
public JenkinsServer renameJob ( String oldJobName , String newJobName ) throws IOException { } } | return renameJob ( null , oldJobName , newJobName , false ) ; |
public class ChronoPeriodImpl { @ Override public ChronoPeriod plus ( TemporalAmount amountToAdd ) { } } | ChronoPeriodImpl amount = validateAmount ( amountToAdd ) ; return new ChronoPeriodImpl ( chrono , Math . addExact ( years , amount . years ) , Math . addExact ( months , amount . months ) , Math . addExact ( days , amount . days ) ) ; |
public class A_CmsSelectResourceTypeDialog { /** * Notifies the context that the given ids have changed . < p >
* @ param ids the ids */
public void finish ( List < CmsUUID > ids ) { } } | if ( m_selectedRunnable == null ) { m_dialogContext . finish ( ids ) ; if ( ids . size ( ) == 1 ) { m_dialogContext . focus ( ids . get ( 0 ) ) ; } } else { m_selectedRunnable . run ( ) ; } |
public class MessageItemReference { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . impl . interfaces . ControllableResource # dereferenceControlAdapter ( ) */
@ Override public void dereferenceControlAdapter ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "dereferenceControlAdapter" ) ; if ( controlAdapter != null ) { controlAdapter . dereferenceControllable ( ) ; controlAdapter = null ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit... |
public class DescribeScheduledInstanceAvailabilityResult { /** * Information about the available Scheduled Instances .
* @ param scheduledInstanceAvailabilitySet
* Information about the available Scheduled Instances . */
public void setScheduledInstanceAvailabilitySet ( java . util . Collection < ScheduledInstanceA... | if ( scheduledInstanceAvailabilitySet == null ) { this . scheduledInstanceAvailabilitySet = null ; return ; } this . scheduledInstanceAvailabilitySet = new com . amazonaws . internal . SdkInternalList < ScheduledInstanceAvailability > ( scheduledInstanceAvailabilitySet ) ; |
public class DoubleStreamEx { /** * Returns a sequential unordered { @ code DoubleStreamEx } of given length
* which elements are equal to supplied value .
* @ param value the constant value
* @ param length the length of the stream
* @ return a new { @ code DoubleStreamEx }
* @ since 0.1.2 */
public static D... | return of ( new ConstSpliterator . OfDouble ( value , length , false ) ) ; |
public class ContactsApi { /** * Get the contact list for a user .
* < br >
* This method does not require authentication .
* @ param userId Required . The NSID of the user to fetch the contact list for .
* @ param page Optional . The page of results to return . If this argument is & le ; = zero , it defaults t... | JinxUtils . validateParams ( userId ) ; Map < String , String > params = new TreeMap < > ( ) ; params . put ( "method" , "flickr.contacts.getPublicList" ) ; params . put ( "user_id" , userId ) ; if ( page > 0 ) { params . put ( "page" , Integer . toString ( page ) ) ; } if ( perPage > 0 ) { params . put ( "per_page" , ... |
public class HostVsanInternalSystem { /** * Determine if the given objects can be reconfigured with the given policies . The what - if determination only takes
* into account the total number of hosts and total number of disks per host . The API is intended to answer the
* question : is this reconfiguration possibl... | return getVimService ( ) . reconfigurationSatisfiable ( getMOR ( ) , pcbs , ignoreSatisfiability ) ; |
public class AlluxioMasterProcess { /** * Starts serving web ui server , resetting master web port , adding the metrics servlet to the web
* server and starting web ui . */
protected void startServingWebServer ( ) { } } | stopRejectingWebServer ( ) ; mWebServer = new MasterWebServer ( ServiceType . MASTER_WEB . getServiceName ( ) , mWebBindAddress , this ) ; // reset master web port
// Add the metrics servlet to the web server .
mWebServer . addHandler ( mMetricsServlet . getHandler ( ) ) ; // Add the prometheus metrics servlet to the w... |
public class DiscoverInputSchemaResult { /** * Raw stream data that was sampled to infer the schema .
* @ param rawInputRecords
* Raw stream data that was sampled to infer the schema . */
public void setRawInputRecords ( java . util . Collection < String > rawInputRecords ) { } } | if ( rawInputRecords == null ) { this . rawInputRecords = null ; return ; } this . rawInputRecords = new java . util . ArrayList < String > ( rawInputRecords ) ; |
public class RailsLikeNameConverter { /** * { @ inheritDoc } */
@ Override public String entityToTable ( String entityName ) { } } | String pluralized = Inflection . pluralize ( entityName ) ; return super . entityToTable ( pluralized ) ; |
public class ContainerTx { /** * d154342.10 d215317 */
protected void releaseResources ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "releaseResources : State = " + stateStrs [ state ] ) ; // If the state is not complete , then the ContainerTx should not
// be cleared , and should not be returned to the pool . This is common
// for BMT , where a method may b... |
public class AlertAPI { /** * Gets the risk ID from the given { @ code parameters } , using { @ link # PARAM _ RISK } as parameter name .
* @ param parameters the parameters of the API request .
* @ return the ID of the risk , or { @ link # NO _ RISK _ ID } if none provided .
* @ throws ApiException if the provid... | String riskIdParam = getParam ( parameters , PARAM_RISK , "" ) . trim ( ) ; if ( riskIdParam . isEmpty ( ) ) { return NO_RISK_ID ; } int riskId = NO_RISK_ID ; try { riskId = Integer . parseInt ( riskIdParam ) ; } catch ( NumberFormatException e ) { throwInvalidRiskId ( ) ; } if ( riskId < Alert . RISK_INFO || riskId > ... |
public class VerificationConditionGenerator { /** * Construct a conjunction of two expressions
* @ param lhs
* @ param rhs
* @ return */
private WyalFile . Stmt and ( WyalFile . Stmt lhs , WyalFile . Stmt rhs ) { } } | if ( lhs == null ) { return rhs ; } else if ( rhs == null ) { return rhs ; } else { return new WyalFile . Stmt . Block ( lhs , rhs ) ; } |
public class QuantilesHelper { /** * This is written in terms of a plain array to facilitate testing .
* @ param arr the chunk containing the position
* @ param pos the position
* @ return the index of the chunk containing the position */
public static int chunkContainingPos ( final long [ ] arr , final long pos ... | final int nominalLength = arr . length - 1 ; /* remember , arr contains an " extra " position */
assert nominalLength > 0 ; final long n = arr [ nominalLength ] ; assert 0 <= pos ; assert pos < n ; final int l = 0 ; final int r = nominalLength ; // the following three asserts should probably be retained since they ensu... |
public class IntSumFrameworkSerializer { /** * We need to implement serializePrimitive to describe what happens when we encounter one of the following types :
* Integer , Long , Float , Double , Boolean , String . */
@ Override public void serializePrimitive ( IntSumRecord rec , String fieldName , Object value ) { } ... | // / only interested in int values .
if ( value instanceof Integer ) { rec . addValue ( ( ( Integer ) value ) . intValue ( ) ) ; } |
public class CmdLineCLA { /** * { @ inheritDoc } */
@ Override protected void exportNamespaceData ( final String prefix , final StringBuilder out , final int occ ) { } } | getValue ( occ ) . exportNamespace ( prefix + "." , out ) ; |
public class DiagnosticsInner { /** * List Site Detector Responses .
* List Site Detector Responses .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param siteName Site Name
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses ... | return AzureServiceFuture . fromPageResponse ( listSiteDetectorResponsesSinglePageAsync ( resourceGroupName , siteName ) , new Func1 < String , Observable < ServiceResponse < Page < DetectorResponseInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < DetectorResponseInner > > > call ( String next... |
public class HiveSessionImplwithUGI { /** * setup appropriate UGI for the session */
public void setSessionUGI ( String owner ) throws HiveSQLException { } } | if ( owner == null ) { throw new HiveSQLException ( "No username provided for impersonation" ) ; } if ( UserGroupInformation . isSecurityEnabled ( ) ) { try { sessionUgi = UserGroupInformation . createProxyUser ( owner , UserGroupInformation . getLoginUser ( ) ) ; } catch ( IOException e ) { throw new HiveSQLException ... |
public class InternalXbaseParser { /** * InternalXbase . g : 6026:1 : ruleJvmLowerBound returns [ EObject current = null ] : ( otherlv _ 0 = ' super ' ( ( lv _ typeReference _ 1_0 = ruleJvmTypeReference ) ) ) ; */
public final EObject ruleJvmLowerBound ( ) throws RecognitionException { } } | EObject current = null ; Token otherlv_0 = null ; EObject lv_typeReference_1_0 = null ; enterRule ( ) ; try { // InternalXbase . g : 6032:2 : ( ( otherlv _ 0 = ' super ' ( ( lv _ typeReference _ 1_0 = ruleJvmTypeReference ) ) ) )
// InternalXbase . g : 6033:2 : ( otherlv _ 0 = ' super ' ( ( lv _ typeReference _ 1_0 = r... |
public class ComponentContentSpecV1 { /** * If the last save of the content spec was not valid , the text field will display the
* last valid state , the errors field will be populated , and the failedContentSpec will
* have the invalid spec text .
* In this situation , the UI will display the invalid spec text .... | if ( source . getFailedContentSpec ( ) != null ) { source . setText ( source . getFailedContentSpec ( ) ) ; } |
public class GSLEImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setLINEEND ( Integer newLINEEND ) { } } | Integer oldLINEEND = lineend ; lineend = newLINEEND ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . GSLE__LINEEND , oldLINEEND , lineend ) ) ; |
public class XmlUtil { /** * Return a pretty String version of the Element .
* @ param element the Element to serialize
* @ return the pretty String representation of the Element */
public static String serialize ( Element element ) { } } | StringWriter sw = new StringWriter ( ) ; serialize ( new DOMSource ( element ) , sw ) ; return sw . toString ( ) ; |
public class VForDefinition { /** * Init the loop variable and add it to the parser context
* @ param type Java type of the variable , will look for qualified class name in the context
* @ param name Name of the variable
* @ param context Context of the template parser */
private void initLoopVariable ( String ty... | this . loopVariableInfo = context . addLocalVariable ( context . getFullyQualifiedNameForClassName ( type . trim ( ) ) , name . trim ( ) ) ; |
public class ConverterRegistry { /** * Converts the given tag to a value .
* @ param < T > Tag type to convert from .
* @ param < V > Value type to convert to .
* @ param tag Tag to convert .
* @ return The converted value .
* @ throws ConversionException If a suitable converter could not be found . */
public... | if ( tag == null || tag . getValue ( ) == null ) { return null ; } if ( ! tagToConverter . containsKey ( tag . getClass ( ) ) ) { throw new ConversionException ( "Tag type " + tag . getClass ( ) . getName ( ) + " has no converter." ) ; } TagConverter < T , ? > converter = ( TagConverter < T , ? > ) tagToConverter . get... |
public class LockSession { /** * Unlock this bookmark in this record for this session .
* @ param strRecordName The record to unlock in .
* @ param bookmark The bookmark to unlock ( or null to unlock all for this session ) .
* @ param objSession The session that wants to unlock .
* @ param iLockType The type of... | sessionInfo . m_iRemoteSessionID = this . getSessionID ( ) ; LockTable lockTable = this . getLockTable ( strDatabaseName , strRecordName ) ; if ( bookmark != null ) return lockTable . removeLock ( bookmark , sessionInfo ) ; else return lockTable . unlockAll ( sessionInfo ) ; |
public class AttributeCol52 { /** * Clones this attribute column instance .
* @ return The cloned instance . */
public AttributeCol52 cloneColumn ( ) { } } | AttributeCol52 cloned = new AttributeCol52 ( ) ; cloned . setAttribute ( getAttribute ( ) ) ; cloned . setReverseOrder ( isReverseOrder ( ) ) ; cloned . setUseRowNumber ( isUseRowNumber ( ) ) ; cloned . cloneCommonColumnConfigFrom ( this ) ; return cloned ; |
public class ShapeRenderer { /** * Draw the the given shape filled in . Only the vertices are set .
* The colour has to be set independently of this method .
* @ param shape The shape to fill .
* @ param fill The fill to apply */
public static final void fill ( final Shape shape , final ShapeFill fill ) { } } | if ( ! validFill ( shape ) ) { return ; } Texture t = TextureImpl . getLastBind ( ) ; TextureImpl . bindNone ( ) ; final float center [ ] = shape . getCenter ( ) ; fill ( shape , new PointCallback ( ) { public float [ ] preRenderPoint ( Shape shape , float x , float y ) { fill . colorAt ( shape , x , y ) . bind ( ) ; V... |
public class PrettyTime { /** * Calculate the approximate { @ link Duration } between the reference { @ link Date } and given { @ link Date } . If the given
* { @ link Date } is < code > null < / code > , the current value of { @ link System # currentTimeMillis ( ) } will be used instead .
* See { @ code PrettyTime... | if ( then == null ) then = now ( ) ; Date ref = reference ; if ( null == ref ) ref = now ( ) ; long difference = then . getTime ( ) - ref . getTime ( ) ; return calculateDuration ( difference ) ; |
public class ShanksAgentBayesianReasoningCapability { /** * Add a set of soft - evidences to the Bayesian network to reason with it .
* @ param agent
* @ param softEvidences
* @ throws ShanksException */
public static void addSoftEvidences ( BayesianReasonerShanksAgent agent , HashMap < String , HashMap < String ... | ShanksAgentBayesianReasoningCapability . addSoftEvidences ( agent . getBayesianNetwork ( ) , softEvidences ) ; |
public class scpolicy { /** * Use this API to update scpolicy resources . */
public static base_responses update ( nitro_service client , scpolicy resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { scpolicy updateresources [ ] = new scpolicy [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { updateresources [ i ] = new scpolicy ( ) ; updateresources [ i ] . name = resources [ i ] . name ; updateresources ... |
public class Refund { /** * create */
public static List < Refund > create ( Map < String , Object > params ) throws EasyPostException { } } | return create ( params , null ) ; |
public class Node { /** * Helper method for { @ link # getQualifiedName } to handle GETPROP nodes .
* @ param reserve The number of characters of space to reserve in the StringBuilder
* @ return { @ code null } if this is not a qualified name or a StringBuilder if it is a complex
* qualified name . */
@ Nullable ... | String propName = getLastChild ( ) . getString ( ) ; reserve += 1 + propName . length ( ) ; // + 1 for the ' . '
StringBuilder builder ; if ( first . isGetProp ( ) ) { builder = first . getQualifiedNameForGetProp ( reserve ) ; if ( builder == null ) { return null ; } } else { String left = first . getQualifiedName ( ) ... |
public class Page { /** * Generate previous page url for a list result .
* @ param domain domain to use
* @ param region region to use
* @ return the previous page url */
public String getPreviousPageUrl ( String domain , String region ) { } } | if ( previousPageUrl != null ) { return previousPageUrl ; } return urlFromUri ( domain , region , previousPageUri ) ; |
public class csvserver_cmppolicy_binding { /** * Use this API to fetch csvserver _ cmppolicy _ binding resources of given name . */
public static csvserver_cmppolicy_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | csvserver_cmppolicy_binding obj = new csvserver_cmppolicy_binding ( ) ; obj . set_name ( name ) ; csvserver_cmppolicy_binding response [ ] = ( csvserver_cmppolicy_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class PolicyAssignmentsInner { /** * Gets a policy assignment .
* @ param scope The scope of the policy assignment .
* @ param policyAssignmentName The name of the policy assignment to get .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the Poli... | return getWithServiceResponseAsync ( scope , policyAssignmentName ) . map ( new Func1 < ServiceResponse < PolicyAssignmentInner > , PolicyAssignmentInner > ( ) { @ Override public PolicyAssignmentInner call ( ServiceResponse < PolicyAssignmentInner > response ) { return response . body ( ) ; } } ) ; |
public class CompressorFactory { /** * Creates a compressor from the given compression type .
* @ param compression the name of the compression algorithm e . g . " gz " or " bzip2 " .
* @ return a new { @ link Compressor } instance for the given compression algorithm
* @ throws IllegalArgumentException if the com... | if ( ! CompressionType . isValidCompressionType ( compression ) ) { throw new IllegalArgumentException ( "Unkonwn compression type " + compression ) ; } return createCompressor ( CompressionType . fromString ( compression ) ) ; |
public class DSClient { /** * ( non - Javadoc )
* @ see com . impetus . kundera . client . Client # findIdsByColumn ( java . lang . String , java . lang . String , java . lang . String ,
* java . lang . String , java . lang . Object , java . lang . Class ) */
@ Override public Object [ ] findIdsByColumn ( String sc... | EntityMetadata metadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entityClazz ) ; return getColumnsById ( schemaName , tableName , columnName , ( ( AbstractAttribute ) metadata . getIdAttribute ( ) ) . getJPAColumnName ( ) , columnValue , metadata . getIdAttribute ( ) . getBindableJavaType ( ) ) ... |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public PTD1XPBASE createPTD1XPBASEFromString ( EDataType eDataType , String initialValue ) { } } | PTD1XPBASE result = PTD1XPBASE . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class Generics2 { /** * splits a { @ link CharSequence } by given separator .
* @ param value the value to split
* @ param separator the separator to use to split value
* @ return list of values */
public static List < String > split ( final CharSequence value , final String separator ) { } } | return newArrayList ( Splitter . on ( separator ) . omitEmptyStrings ( ) . trimResults ( ) . split ( value ) ) ; |
public class GuildController { /** * Bans a { @ link net . dv8tion . jda . core . entities . User User } and deletes messages sent by the user
* based on the amount of delDays .
* < br > If you wish to ban a user without deleting any messages , provide delDays with a value of 0.
* This change will be applied imme... | Checks . notNull ( user , "User" ) ; checkPermission ( Permission . BAN_MEMBERS ) ; if ( getGuild ( ) . isMember ( user ) ) // If user is in guild . Check if we are able to ban .
checkPosition ( getGuild ( ) . getMember ( user ) ) ; Checks . notNegative ( delDays , "Deletion Days" ) ; Checks . check ( delDays <= 7 , "D... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.