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 ( ) ; expiryQueue . 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 siteName Site Name
* ServiceResponse < PageImpl < DiagnosticCategoryInner > > * @ param slot Slot Name
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; DiagnosticCategoryInner & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < DiagnosticCategoryInner > > > listSiteDiagnosticCategoriesSlotSinglePageAsync ( final String resourceGroupName , final String siteName , final String slot ) { } } | 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 ( "Parameter slot is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . listSiteDiagnosticCategoriesSlot ( resourceGroupName , siteName , slot , this . client . subscriptionId ( ) , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < DiagnosticCategoryInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < DiagnosticCategoryInner > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < DiagnosticCategoryInner > > result = listSiteDiagnosticCategoriesSlotDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < DiagnosticCategoryInner > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
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 TransactionalProtocolClient old , final boolean shuttingDown ) { } } | // 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 reconnection
if ( ! shuttingDown && requiredState == InternalState . SERVER_STARTED ) { final InternalState state = internalState ; if ( state == InternalState . PROCESS_STOPPED || state == InternalState . PROCESS_STOPPING || state == InternalState . STOPPED ) { // In case it stopped we don ' t reconnect
return true ; } // In case we are reloading , it will reconnect automatically
if ( state == InternalState . RELOADING ) { return true ; } try { ROOT_LOGGER . logf ( DEBUG_LEVEL , "trying to reconnect to %s current-state (%s) required-state (%s)" , serverName , state , requiredState ) ; internalSetState ( new ReconnectTask ( ) , state , InternalState . SEND_STDIN ) ; } catch ( Exception e ) { ROOT_LOGGER . logf ( DEBUG_LEVEL , e , "failed to send reconnect task" ) ; } return false ; } else { return true ; } } |
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 static initializer
* has been reach the state of the MockRepository would have been wiped out .
* This is generally not a problem because most state will be added again
* but suppression of static initializers are different because this state
* can only be set once per class per CL . That ' s why we cannot remove this
* state . */
public synchronized static void clear ( ) { } } | newSubstitutions . clear ( ) ; classMocks . clear ( ) ; instanceMocks . clear ( ) ; objectsToAutomaticallyReplayAndVerify . clear ( ) ; additionalState . clear ( ) ; suppressConstructor . clear ( ) ; suppressMethod . clear ( ) ; substituteReturnValues . clear ( ) ; suppressField . clear ( ) ; suppressFieldTypes . clear ( ) ; methodProxies . clear ( ) ; for ( Runnable runnable : afterMethodRunners ) { runnable . run ( ) ; } afterMethodRunners . 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 ( maybeSuperInstanceType == null ) { return false ; } if ( maybeSuperInstanceType . isUnknownType ( ) || maybeSuperInstanceType . isEmptyType ( ) ) { return true ; } ctor = maybeSuperInstanceType . getConstructor ( ) ; if ( ctor == null ) { return false ; } checkState ( ctor . isConstructor ( ) || ctor . isInterface ( ) ) ; } |
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_delta gdd = new path_dictionary_delta ( ) ; gdd . id = allocated ; gdd . value = new_path_ ( group . getPath ( ) ) ; // Append new entry to array .
dict_delta . gdd = Stream . concat ( Arrays . stream ( dict_delta . gdd ) , Stream . of ( gdd ) ) . toArray ( path_dictionary_delta [ ] :: new ) ; LOG . log ( Level . FINE , "dict_delta.gdd: {0} items (added {1})" , new Object [ ] { dict_delta . gdd . length , group } ) ; return allocated ; |
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 calling this API
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < List < UUID > > addCustomPrebuiltDomainAsync ( UUID appId , String versionId , AddCustomPrebuiltDomainModelsOptionalParameter addCustomPrebuiltDomainOptionalParameter , final ServiceCallback < List < UUID > > serviceCallback ) { } } | 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 servlet */
public WebDavServletController createWebDavServlet ( Path rootPath , String contextPath ) { } } | 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 , T2 > > buildingFunction ) { } } | 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 MutableTreeNode
* @ param index an index
* @ param node the node to insert at the given index
* @ since 1.6.4 */
public static void putAt ( MutableTreeNode self , int index , MutableTreeNode node ) { } } | 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 " + TextFormatting . GREEN + port ; else md . description = TextFormatting . RED + "ERROR: No mission control port - check configuration" ; // See if changing the port should lead to changing the login details :
// AuthenticationHelper . update ( MalmoMod . instance . getModPermanentConfigFile ( ) ) ;
} |
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 */
public static Optional < BigDecimal > createBigDecimal ( final String str ) { } } | 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 HttpException */
public static Response forwardPost ( URI uri , HttpServletRequest request , boolean forwardHeaders ) throws URISyntaxException , HttpException { } } | 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 ( new HttpPost ( uri ) , body , ct , null , headersToForward ) ; |
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 <= WebhookMessageBuilder . MAX_FILES , "Cannot add more than %d files to a message" , WebhookMessageBuilder . MAX_FILES ) ; MessageAttachment [ ] files = new MessageAttachment [ fileAmount ] ; files [ 0 ] = convertAttachment ( name1 , data1 ) ; for ( int i = 0 , j = 1 ; i < attachments . length ; j ++ , i += 2 ) { Object name = attachments [ i ] ; Object data = attachments [ i + 1 ] ; if ( ! ( name instanceof String ) ) throw new IllegalArgumentException ( "Provided arguments must be pairs for (String, Data). Expected String and found " + ( name == null ? null : name . getClass ( ) . getName ( ) ) ) ; files [ j ] = convertAttachment ( ( String ) name , data ) ; } return new WebhookMessage ( null , null , null , null , false , files ) ; |
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 ) ; hillshadeWR . setSample ( 1 , y , 0 , 0 ) ; hillshadeWR . setSample ( width - 2 , y , 0 , 0 ) ; hillshadeWR . setSample ( width - 1 , y , 0 , 0 ) ; } for ( int x = 2 ; x < width - 2 ; x ++ ) { hillshadeWR . setSample ( x , 0 , 0 , 0 ) ; hillshadeWR . setSample ( x , 1 , 0 , 0 ) ; hillshadeWR . setSample ( x , height - 2 , 0 , 0 ) ; hillshadeWR . setSample ( x , height - 1 , 0 , 0 ) ; } |
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 to retrieve Azure storage account details .
* @ param storageAccountName The name of the Azure Storage account for which to retrieve the details .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the StorageAccountInfoInner object */
public Observable < StorageAccountInfoInner > getStorageAccountAsync ( String resourceGroupName , String accountName , String storageAccountName ) { } } | return getStorageAccountWithServiceResponseAsync ( resourceGroupName , accountName , storageAccountName ) . map ( new Func1 < ServiceResponse < StorageAccountInfoInner > , StorageAccountInfoInner > ( ) { @ Override public StorageAccountInfoInner call ( ServiceResponse < StorageAccountInfoInner > response ) { return response . body ( ) ; } } ) ; |
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 ( propertyValue ) . iterator ( ) ; } return Collections . emptyIterator ( ) ; } // no properties in filter
if ( propertyKeys . length == 0 ) { // all properties ( return a copy since properties iterator can be modified by calling remove ( ) )
return properties . values ( ) . stream ( ) . map ( value -> ( Property < V > ) value ) . collect ( Collectors . toList ( ) ) . iterator ( ) ; } // filter properties ( return a copy since properties iterator can be modified by calling remove ( ) )
return Arrays . stream ( propertyKeys ) . map ( key -> ( Property < V > ) properties . get ( key ) ) . filter ( Objects :: nonNull ) . collect ( Collectors . toList ( ) ) . iterator ( ) ; |
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 ( ) ) { q . add ( rr ) ; } } |
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 } object */
public ServiceFuture < Iteration > trainProjectAsync ( UUID projectId , final ServiceCallback < Iteration > serviceCallback ) { } } | 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 >
* @ param iterator Iterator as source of data to evaluate
* @ param outputVariable The variable to evaluate
* @ param evaluations The evaluations to perform */
public void evaluate ( DataSetIterator iterator , String outputVariable , IEvaluation ... evaluations ) { } } | 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 ( outputVariable , 0 ) ) ; |
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 addRelevantPluginDependenciesToClasspath ( Set < URL > path ) throws MojoExecutionException { } } | 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 . NoClassDefFoundError : org . osgi . vendor . framework property not set
if ( classPathElement . getArtifactId ( ) . equals ( "org.osgi.core" ) ) { getLog ( ) . debug ( "Skipping org.osgi.core -> " + classPathElement . getGroupId ( ) + "/" + classPathElement . getArtifactId ( ) + "/" + classPathElement . getVersion ( ) ) ; continue ; } getLog ( ) . debug ( "Adding plugin dependency artifact: " + classPathElement . getArtifactId ( ) + " to classpath" ) ; path . add ( classPathElement . getFile ( ) . toURI ( ) . toURL ( ) ) ; } } catch ( MalformedURLException e ) { throw new MojoExecutionException ( "Error during setting up classpath" , e ) ; } |
public class Smb2TreeConnectResponse { /** * { @ inheritDoc }
* @ throws Smb2ProtocolDecodingException
* @ see jcifs . internal . smb2 . ServerMessageBlock2 # readBytesWireFormat ( byte [ ] , int ) */
@ Override protected int readBytesWireFormat ( byte [ ] buffer , int bufferIndex ) throws SMBProtocolDecodingException { } } | 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 , bufferIndex ) ; bufferIndex += 4 ; this . capabilities = SMBUtil . readInt4 ( buffer , bufferIndex ) ; bufferIndex += 4 ; this . maximalAccess = SMBUtil . readInt4 ( buffer , bufferIndex ) ; bufferIndex += 4 ; return bufferIndex - start ; |
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 credentials
* The credentials used to use to sign the request . */
public void sign ( SignableRequest < ? > request , AWSCredentials credentials ) throws SdkClientException { } } | 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 ( ( shared != null ) && m_cms . existsResource ( shared , CmsResourceFilter . ONLY_VISIBLE_NO_DELETED ) ) { addOption ( Type . shared , shared , org . opencms . workplace . Messages . get ( ) . getBundle ( OpenCms . getWorkplaceManager ( ) . getWorkplaceLocale ( m_cms ) ) . key ( org . opencms . workplace . Messages . GUI_SHARED_TITLE_0 ) ) ; } |
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 MapViewPosition knows nothing about them ) .
* @ param zoomLevel the zoomlevel to compute the x / y coordinates for
* @ return the x / y coordinates of the map pivot point if set or null otherwise . */
public synchronized Point getPivotXY ( byte zoomLevel ) { } } | 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 when creating the FileInputStream .
* @ throws ArchiveException if the archiver name is not known */
static ArchiveInputStream createArchiveInputStream ( File archive ) throws IOException , ArchiveException { } } | 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 to their respective quotes
* @ throws java . io . IOException when there ' s a connection problem or the request is incorrect
* @ see # getFx ( java . lang . String ) */
public static Map < String , FxQuote > getFx ( String [ ] symbols ) throws IOException { } } | 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 , "," ) ) ; quotes = request . getResult ( ) ; } Map < String , FxQuote > result = new HashMap < String , FxQuote > ( ) ; for ( FxQuote quote : quotes ) { result . put ( quote . getSymbol ( ) , quote ) ; } return result ; |
public class AnalyzeDataSourceRiskDetails { /** * < code >
* . google . privacy . dlp . v2 . AnalyzeDataSourceRiskDetails . CategoricalStatsResult categorical _ stats _ result = 4;
* < / code > */
public com . google . privacy . dlp . v2 . AnalyzeDataSourceRiskDetails . CategoricalStatsResult getCategoricalStatsResult ( ) { } } | 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 ConvexMultivariateRealFunction ( ) { @ Override public double value ( double [ ] Y ) { DoubleMatrix1D y = DoubleFactory1D . dense . make ( Y ) ; DoubleMatrix1D X = y . viewPart ( 0 , dim ) ; return originalFi . value ( X . toArray ( ) ) - y . get ( dimPh1 - 1 ) ; } @ Override public double [ ] gradient ( double [ ] Y ) { DoubleMatrix1D y = DoubleFactory1D . dense . make ( Y ) ; DoubleMatrix1D X = y . viewPart ( 0 , dim ) ; DoubleMatrix1D origGrad = F1 . make ( originalFi . gradient ( X . toArray ( ) ) ) ; DoubleMatrix1D ret = F1 . make ( 1 , - 1 ) ; ret = F1 . append ( origGrad , ret ) ; return ret . toArray ( ) ; } @ Override public double [ ] [ ] hessian ( double [ ] Y ) { DoubleMatrix1D y = DoubleFactory1D . dense . make ( Y ) ; DoubleMatrix1D X = y . viewPart ( 0 , dim ) ; DoubleMatrix2D origHess ; double [ ] [ ] origFiHessX = originalFi . hessian ( X . toArray ( ) ) ; if ( origFiHessX == FunctionsUtils . ZEROES_2D_ARRAY_PLACEHOLDER ) { return FunctionsUtils . ZEROES_2D_ARRAY_PLACEHOLDER ; } else { origHess = F2 . make ( origFiHessX ) ; DoubleMatrix2D [ ] [ ] parts = new DoubleMatrix2D [ ] [ ] { { origHess , null } , { null , F2 . make ( 1 , 1 ) } } ; return F2 . compose ( parts ) . toArray ( ) ; } } @ Override public int getDim ( ) { return dimPh1 ; } } ; inequalitiesPh1 [ i ] = fi ; } BarrierFunction bfPh1 = new LogarithmicBarrier ( inequalitiesPh1 , dimPh1 ) ; return bfPh1 ; |
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 delimiter , int [ ] info ) { } } | 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 < del . length ; i ++ ) { if ( c == del [ i ] ) { info [ 0 ] ++ ; list = list . substring ( 1 ) ; continue outer ; } } break ; } int len ; outer : while ( list . length ( ) > 0 ) { c = list . charAt ( list . length ( ) - 1 ) ; for ( int i = 0 ; i < del . length ; i ++ ) { if ( c == del [ i ] ) { info [ 1 ] ++ ; len = list . length ( ) ; list = list . substring ( 0 , len - 1 < 0 ? 0 : len - 1 ) ; continue outer ; } } break ; } return listToArray ( list , delimiter ) ; |
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 recovery services vault .
* @ param resourceGroupName The name of the resource group where the recovery services vault is present .
* @ param fabricName Name of the fabric where the container belongs .
* @ param containerName Name of the container which needs to be unregistered from the Recovery Services Vault .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < Void > unregisterAsync ( String vaultName , String resourceGroupName , String fabricName , String containerName , final ServiceCallback < Void > serviceCallback ) { } } | 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 the last matching cp option category , or < code > null < / code > if a matching cp option category could not be found */
public static CPOptionCategory fetchByUuid_C_Last ( String uuid , long companyId , OrderByComparator < CPOptionCategory > orderByComparator ) { } } | 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 contentDir can have different underlying FileSystems
return outputDir . resolve ( finalOutput ) ; |
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 ( tc , "dereferenceControlAdapter" ) ; |
public class DescribeScheduledInstanceAvailabilityResult { /** * Information about the available Scheduled Instances .
* @ param scheduledInstanceAvailabilitySet
* Information about the available Scheduled Instances . */
public void setScheduledInstanceAvailabilitySet ( java . util . Collection < ScheduledInstanceAvailability > scheduledInstanceAvailabilitySet ) { } } | 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 DoubleStreamEx constant ( double value , long length ) { } } | 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 to 1.
* @ param perPage Optional . Number of photos to return per page . If this argument is & le ; = zero , it defaults to 1000.
* The maximum allowed value is 1000.
* @ return object containing contacts matching the parameters .
* @ throws JinxException if required parameters are null or empty , or if there are any errors .
* @ see < a href = " https : / / www . flickr . com / services / api / flickr . contacts . getPublicList . html " > flickr . contacts . getPublicList < / a > */
public Contacts getPublicList ( String userId , int page , int perPage ) throws JinxException { } } | 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" , Integer . toString ( perPage ) ) ; } return jinx . flickrGet ( params , Contacts . class ) ; |
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 possible using the current cluster topology ( # hosts and # disks ) and does NOT
* take into account free space on the disk , size of disks , etc . If policy is not satisfiable , the API returns the
* reason for not being able to satisfy the policy . If the policy is satisfiable , the API returns the cost of
* provisioning objects with the new policy . This cost can be combined with current available free disk space to
* compute if a particular operation is expected to succeed or fail .
* Please note : This API ignores forceProvisioning .
* @ param pcbs List of PolicyChangeBatch structure with uuids and policies .
* @ param ignoreSatisfiability Optionally populate PolicyCost even though object cannot be reconfigured in the current cluster topology .
* @ return List of PolicySatisfiability objects , one for each specified UUID .
* @ throws RemoteException
* @ throws RuntimeFault
* @ throws VimFault
* @ since 6.0 */
public VsanPolicySatisfiability [ ] reconfigurationSatisfiable ( VsanPolicyChangeBatch [ ] pcbs , Boolean ignoreSatisfiability ) throws RemoteException , RuntimeFault , VimFault { } } | 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 web server .
mWebServer . addHandler ( mPMetricsServlet . getHandler ( ) ) ; // start web ui
mWebServer . start ( ) ; |
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 begin the tx , but not complete it
// until a subsequent method call . d157262
if ( state != COMMITTED && state != ROLLEDBACK ) { return ; } // Simply clear all instance variables that may hold a reference to
// another object . d215317
afterList = null ; beanOList = null ; beanOs = null ; cmdAccessor = null ; containerAS = null ; currentBeanOs = null ; finderSyncList = null ; homesForPMManagedBeans = null ; ivContainer = null ; ivPostProcessingException = null ; // PQ90221
ivTxKey = null ; tempList = null ; txListener = null ; uowCtrl = null ; timersQueuedToStart = null ; // F743-425 . CodRev
timersCanceled = null ; // F743-425 . CodRev |
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 provided risk ID is not valid ( not an integer nor a valid risk ID ) . */
private int getRiskId ( JSONObject parameters ) throws ApiException { } } | 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 > Alert . RISK_HIGH ) { throwInvalidRiskId ( ) ; } return 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 ensure
// that the necessary invariants hold at the beginning of the search
assert l < r ; assert arr [ l ] <= pos ; assert pos < arr [ r ] ; return searchForChunkContainingPos ( arr , pos , l , r ) ; |
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 .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < List < DetectorResponseInner > > listSiteDetectorResponsesAsync ( final String resourceGroupName , final String siteName , final ListOperationCallback < DetectorResponseInner > serviceCallback ) { } } | return AzureServiceFuture . fromPageResponse ( listSiteDetectorResponsesSinglePageAsync ( resourceGroupName , siteName ) , new Func1 < String , Observable < ServiceResponse < Page < DetectorResponseInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < DetectorResponseInner > > > call ( String nextPageLink ) { return listSiteDetectorResponsesNextSinglePageAsync ( nextPageLink ) ; } } , serviceCallback ) ; |
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 ( "Couldn't setup proxy user" , e ) ; } } else { sessionUgi = UserGroupInformation . createRemoteUser ( owner ) ; } |
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 = ruleJvmTypeReference ) ) )
{ // InternalXbase . g : 6033:2 : ( otherlv _ 0 = ' super ' ( ( lv _ typeReference _ 1_0 = ruleJvmTypeReference ) ) )
// InternalXbase . g : 6034:3 : otherlv _ 0 = ' super ' ( ( lv _ typeReference _ 1_0 = ruleJvmTypeReference ) )
{ otherlv_0 = ( Token ) match ( input , 73 , FOLLOW_13 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { newLeafNode ( otherlv_0 , grammarAccess . getJvmLowerBoundAccess ( ) . getSuperKeyword_0 ( ) ) ; } // InternalXbase . g : 6038:3 : ( ( lv _ typeReference _ 1_0 = ruleJvmTypeReference ) )
// InternalXbase . g : 6039:4 : ( lv _ typeReference _ 1_0 = ruleJvmTypeReference )
{ // InternalXbase . g : 6039:4 : ( lv _ typeReference _ 1_0 = ruleJvmTypeReference )
// InternalXbase . g : 6040:5 : lv _ typeReference _ 1_0 = ruleJvmTypeReference
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getJvmLowerBoundAccess ( ) . getTypeReferenceJvmTypeReferenceParserRuleCall_1_0 ( ) ) ; } pushFollow ( FOLLOW_2 ) ; lv_typeReference_1_0 = ruleJvmTypeReference ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElementForParent ( grammarAccess . getJvmLowerBoundRule ( ) ) ; } set ( current , "typeReference" , lv_typeReference_1_0 , "org.eclipse.xtext.xbase.Xtype.JvmTypeReference" ) ; afterParserOrEnumRuleCall ( ) ; } } } } } if ( state . backtracking == 0 ) { leaveRule ( ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
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 . So we copy the invalid text
* into the text field , and edit as usual . This provides a workflow much like topics where
* the user can save invalid data , and will receive a warning about it when the save is completed .
* @ param source The spec to fix */
public static void fixDisplayedText ( final RESTTextContentSpecV1 source ) { } } | 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 type , String name , TemplateParserContext context ) { } } | 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 static < T extends Tag , V > V convertToValue ( T tag ) throws ConversionException { } } | 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 ( tag . getClass ( ) ) ; return ( V ) converter . convert ( tag ) ; |
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 lock ( wait or error lock ) .
* @ return True if successful . */
public boolean unlockThisRecord ( String strDatabaseName , String strRecordName , Object bookmark , SessionInfo sessionInfo ) throws DBException , RemoteException { } } | 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 ( ) ; Vector2f offset = fill . getOffsetAt ( shape , x , y ) ; return new float [ ] { offset . x + x , offset . y + y } ; } } ) ; if ( t == null ) { TextureImpl . bindNone ( ) ; } else { t . bind ( ) ; } |
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 # getReference ( ) } . */
public Duration approximateDuration ( Date then ) { } } | 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 , Double > > softEvidences ) throws ShanksException { } } | 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 [ i ] . url = resources [ i ] . url ; updateresources [ i ] . rule = resources [ i ] . rule ; updateresources [ i ] . delay = resources [ i ] . delay ; updateresources [ i ] . maxconn = resources [ i ] . maxconn ; updateresources [ i ] . action = resources [ i ] . action ; updateresources [ i ] . altcontentsvcname = resources [ i ] . altcontentsvcname ; updateresources [ i ] . altcontentpath = resources [ i ] . altcontentpath ; } result = update_bulk_request ( client , updateresources ) ; } return result ; |
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 private StringBuilder getQualifiedNameForGetProp ( int reserve ) { } } | 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 ( ) ; if ( left == null ) { return null ; } builder = new StringBuilder ( left . length ( ) + reserve ) ; builder . append ( left ) ; } builder . append ( '.' ) . append ( propName ) ; return builder ; |
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 PolicyAssignmentInner object */
public Observable < PolicyAssignmentInner > getAsync ( String scope , String policyAssignmentName ) { } } | 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 compression type is unknown */
public static Compressor createCompressor ( String compression ) throws IllegalArgumentException { } } | 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 schemaName , String tableName , String pKeyName , String columnName , Object columnValue , Class entityClazz ) { } } | EntityMetadata metadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entityClazz ) ; return getColumnsById ( schemaName , tableName , columnName , ( ( AbstractAttribute ) metadata . getIdAttribute ( ) ) . getJPAColumnName ( ) , columnValue , metadata . getIdAttribute ( ) . getBindableJavaType ( ) ) . toArray ( ) ; |
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 immediately .
* < p > < b > Note : < / b > { @ link net . dv8tion . jda . core . entities . Guild # getMembers ( ) } will still contain the { @ link net . dv8tion . jda . core . entities . User User ' s }
* { @ link net . dv8tion . jda . core . entities . Member Member } object ( if the User was in the Guild )
* until Discord sends the { @ link net . dv8tion . jda . core . events . guild . member . GuildMemberLeaveEvent GuildMemberLeaveEvent } .
* < p > Possible { @ link net . dv8tion . jda . core . requests . ErrorResponse ErrorResponses } caused by
* the returned { @ link net . dv8tion . jda . core . requests . RestAction RestAction } include the following :
* < ul >
* < li > { @ link net . dv8tion . jda . core . requests . ErrorResponse # MISSING _ PERMISSIONS MISSING _ PERMISSIONS }
* < br > The target Member cannot be banned due to a permission discrepancy < / li >
* < li > { @ link net . dv8tion . jda . core . requests . ErrorResponse # MISSING _ ACCESS MISSING _ ACCESS }
* < br > We were removed from the Guild before finishing the task < / li >
* < li > { @ link net . dv8tion . jda . core . requests . ErrorResponse # UNKNOWN _ MEMBER UNKNOWN _ MEMBER }
* < br > The specified Member was removed from the Guild before finishing the task < / li >
* < / ul >
* @ param user
* The { @ link net . dv8tion . jda . core . entities . User User } to ban .
* @ param delDays
* The history of messages , in days , that will be deleted .
* @ param reason
* The reason for this action or { @ code null } if there is no specified reason
* @ throws net . dv8tion . jda . core . exceptions . InsufficientPermissionException
* If the logged in account does not have the { @ link net . dv8tion . jda . core . Permission # BAN _ MEMBERS } permission .
* @ throws net . dv8tion . jda . core . exceptions . HierarchyException
* If the logged in account cannot ban the other user due to permission hierarchy position .
* < br > See { @ link net . dv8tion . jda . core . utils . PermissionUtil # canInteract ( Member , Member ) PermissionUtil . canInteract ( Member , Member ) }
* @ throws java . lang . IllegalArgumentException
* < ul >
* < li > If the provided amount of days ( delDays ) is less than 0 . < / li >
* < li > If the provided amount of days ( delDays ) is bigger than 7 . < / li >
* < li > If the provided user is null < / li >
* < / ul >
* @ return { @ link net . dv8tion . jda . core . requests . restaction . AuditableRestAction AuditableRestAction } */
@ CheckReturnValue public AuditableRestAction < Void > ban ( User user , int delDays , String reason ) { } } | 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 , "Deletion Days must not be bigger than 7." ) ; final String userId = user . getId ( ) ; Route . CompiledRoute route = Route . Guilds . BAN . compile ( getGuild ( ) . getId ( ) , userId ) ; if ( reason != null && ! reason . isEmpty ( ) ) route = route . withQueryParams ( "reason" , MiscUtil . encodeUTF8 ( reason ) ) ; if ( delDays > 0 ) route = route . withQueryParams ( "delete-message-days" , Integer . toString ( delDays ) ) ; return new AuditableRestAction < Void > ( getGuild ( ) . getJDA ( ) , route ) { @ Override protected void handleResponse ( Response response , Request < Void > request ) { if ( response . isOk ( ) ) request . onSuccess ( null ) ; else request . onFailure ( response ) ; } } ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.