signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AmazonConfigClient { /** * Deletes the retention configuration .
* @ param deleteRetentionConfigurationRequest
* @ return Result of the DeleteRetentionConfiguration operation returned by the service .
* @ throws InvalidParameterValueException
* One or more of the specified parameters are invalid . ... | request = beforeClientExecution ( request ) ; return executeDeleteRetentionConfiguration ( request ) ; |
public class BSHPrimaryExpression { /** * Our children are a prefix expression and any number of suffixes .
* We don ' t eval ( ) any nodes until the suffixes have had an
* opportunity to work through them . This lets the suffixes decide
* how to interpret an ambiguous name ( e . g . for the . class operation ) .... | // We can cache array expressions evaluated during type inference
if ( isArrayExpression && null != cached ) return cached ; Object obj = jjtGetChild ( 0 ) ; int numChildren = jjtGetNumChildren ( ) ; for ( int i = 1 ; i < numChildren ; i ++ ) obj = ( ( BSHPrimarySuffix ) jjtGetChild ( i ) ) . doSuffix ( obj , toLHS , c... |
public class Utils { /** * Generates route list the same way dialog does .
* @ param response
* @ return
* @ throws ParseException */
public static List < RouteHeader > getRouteList ( Response response , HeaderFactory headerFactory ) throws ParseException { } } | // we have record route set , as we are client , this is reversed
final ArrayList < RouteHeader > routeList = new ArrayList < RouteHeader > ( ) ; final ListIterator < ? > rrLit = response . getHeaders ( RecordRouteHeader . NAME ) ; while ( rrLit . hasNext ( ) ) { final RecordRouteHeader rrh = ( RecordRouteHeader ) rrLi... |
public class ICUHumanize { /** * Converts a number to its ordinal as a string .
* < table border = " 0 " cellspacing = " 0 " cellpadding = " 3 " width = " 100 % " >
* < tr >
* < th class = " colFirst " > Input < / th >
* < th class = " colLast " > Output < / th >
* < / tr >
* < tr >
* < td > 1 < / td >
... | return context . get ( ) . getRuleBasedNumberFormat ( RuleBasedNumberFormat . ORDINAL ) . format ( value ) ; |
public class SecurityHandler { public void setAuthMethod ( String method ) { } } | if ( isStarted ( ) && _authMethod != null && ! _authMethod . equals ( method ) ) throw new IllegalStateException ( "Handler started" ) ; _authMethod = method ; |
public class ProtobufProxy { /** * To generate a protobuf proxy java source code for target class .
* @ param os to generate java source code
* @ param cls target class
* @ param charset charset type
* @ throws IOException in case of any io relative exception . */
public static void dynamicCodeGenerate ( Output... | dynamicCodeGenerate ( os , cls , charset , getCodeGenerator ( cls ) ) ; |
public class PHPMethods { /** * Sorts an array in ascending order and returns an array with indexes of
* the original order .
* @ param < T >
* @ param array
* @ return */
public static < T extends Comparable < T > > Integer [ ] asort ( T [ ] array ) { } } | return _asort ( array , false ) ; |
public class ToSAXHandler { /** * Sets the SAX ContentHandler .
* @ param _ saxHandler The ContentHandler to set */
public void setContentHandler ( ContentHandler _saxHandler ) { } } | this . m_saxHandler = _saxHandler ; if ( m_lexHandler == null && _saxHandler instanceof LexicalHandler ) { // we are not overwriting an existing LexicalHandler , and _ saxHandler
// is also implements LexicalHandler , so lets use it
m_lexHandler = ( LexicalHandler ) _saxHandler ; } |
public class RoleManager { /** * Sets the { @ link net . dv8tion . jda . core . Permission Permissions } of the selected { @ link net . dv8tion . jda . core . entities . Role Role } .
* < p > Permissions may only include already present Permissions for the currently logged in account .
* < br > You are unable to gi... | Checks . notNull ( permissions , "Permissions" ) ; return setPermissions ( Arrays . asList ( permissions ) ) ; |
public class RoundLcdClockSkin { /** * * * * * * Initialization * * * * * */
@ Override protected void initGraphics ( ) { } } | // Set initial size
if ( Double . compare ( clock . getPrefWidth ( ) , 0.0 ) <= 0 || Double . compare ( clock . getPrefHeight ( ) , 0.0 ) <= 0 || Double . compare ( clock . getWidth ( ) , 0.0 ) <= 0 || Double . compare ( clock . getHeight ( ) , 0.0 ) <= 0 ) { if ( clock . getPrefWidth ( ) > 0 && clock . getPrefHeight (... |
public class AddTrial { /** * Runs the example .
* @ param adWordsServices the services factory .
* @ param session the session .
* @ param draftId the ID of the draft .
* @ param baseCampaignId the ID of the base campaign .
* @ throws ApiException if the API request failed with one or more service errors .
... | // Get the TrialService .
TrialServiceInterface trialService = adWordsServices . get ( session , TrialServiceInterface . class ) ; Trial trial = new Trial ( ) ; trial . setDraftId ( draftId ) ; trial . setBaseCampaignId ( baseCampaignId ) ; trial . setName ( "Test Trial #" + System . currentTimeMillis ( ) ) ; trial . s... |
public class AppServiceEnvironmentsInner { /** * Get properties of a worker pool .
* Get properties of a worker pool .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service Environment .
* @ param workerPoolName Name of the worker pool .
... | return getWorkerPoolWithServiceResponseAsync ( resourceGroupName , name , workerPoolName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class LimitedConnectionsFileSystem { /** * Atomically removes the given output stream from the set of currently open output streams ,
* and signals that new stream can now be opened . */
void unregisterOutputStream ( OutStream stream ) { } } | lock . lock ( ) ; try { // only decrement if we actually remove the stream
if ( openOutputStreams . remove ( stream ) ) { numReservedOutputStreams -- ; available . signalAll ( ) ; } } finally { lock . unlock ( ) ; } |
public class Avicenna { /** * Internal method which iterates over fields and methods to find and store
* dependency producers . */
private static void addDependencyFactoryToContainer ( Object dependencyFactory ) { } } | try { Class clazz = dependencyFactory . getClass ( ) ; for ( Field field : ReflectionHelper . getFields ( clazz ) ) { if ( field . isAnnotationPresent ( Dependency . class ) ) { qualifiers . clear ( ) ; for ( Annotation annotation : field . getAnnotations ( ) ) { if ( annotation . annotationType ( ) . isAnnotationPrese... |
public class Unchecked { /** * Wrap a { @ link CheckedIntFunction } in a { @ link IntFunction } with a custom handler for checked exceptions .
* Example :
* < code > < pre >
* IntStream . of ( 1 , 2 , 3 ) . mapToObj ( Unchecked . intFunction (
* if ( i & lt ; 0)
* throw new Exception ( " Only positive numbers... | return t -> { try { return function . apply ( t ) ; } catch ( Throwable e ) { handler . accept ( e ) ; throw new IllegalStateException ( "Exception handler must throw a RuntimeException" , e ) ; } } ; |
public class MutatorImpl { /** * { @ inheritDoc } */
@ Override public < N > Mutator < K > addDeletion ( K key , String cf ) { } } | addDeletion ( key , cf , null , null , keyspace . createClock ( ) ) ; return this ; |
public class Util { /** * Returns the ip address of the local machine .
* If the ' ip ' system property is defined it is returned ,
* otherwise , the local ip address is lookup using the
* < code > InetAddress < / code > class . In case the lookup
* fails , the address 127.0.0.1 is returned .
* @ return local... | String ipAddr = CoGProperties . getDefault ( ) . getIPAddress ( ) ; if ( ipAddr == null ) { try { return InetAddress . getLocalHost ( ) . getHostAddress ( ) ; } catch ( UnknownHostException e ) { return "127.0.0.1" ; } } else { return ipAddr ; } |
public class KunderaQuery { /** * Method to skip string literal as per JPA specification . if literal starts is enclose within " ' ' " then skip " ' "
* and include " ' " in case of " ' ' " replace it with " ' " .
* @ param value
* value .
* @ return replaced string in case of string , else will return original... | if ( value != null && value . getClass ( ) . isAssignableFrom ( String . class ) ) { return ( ( String ) value ) . replaceAll ( "^'" , "" ) . replaceAll ( "'$" , "" ) . replaceAll ( "''" , "'" ) ; } return value ; |
public class AutoAnnotationProcessor { /** * Issue a compilation error . This method does not throw an exception , since we want to continue
* processing and perhaps report other errors . */
private void reportError ( Element e , String msg , Object ... msgParams ) { } } | String formattedMessage = String . format ( msg , msgParams ) ; processingEnv . getMessager ( ) . printMessage ( Diagnostic . Kind . ERROR , formattedMessage , e ) ; |
public class CircularLossyQueue { /** * Adds a new item
* @ param newVal
* value to push */
public void push ( final T newVal ) { } } | final int index = ( int ) ( m_aCurrentIndex . incrementAndGet ( ) % m_nMaxSize ) ; m_aCircularArray [ index ] . set ( newVal ) ; |
public class TokenRESTService { /** * Returns the credentials associated with the given request , using the
* provided username and password .
* @ param request
* The request to use to derive the credentials .
* @ param username
* The username to associate with the credentials , or null if the
* username sh... | // If no username / password given , try Authorization header
if ( username == null && password == null ) { String authorization = request . getHeader ( "Authorization" ) ; if ( authorization != null && authorization . startsWith ( "Basic " ) ) { try { // Decode base64 authorization
String basicBase64 = authorization .... |
public class SeekableStreamIndexTaskRunner { /** * Returns true if , given that recordSequenceNumber has already been read and we want to end at endSequenceNumber ,
* there is more left to read . Used in post - read checks to determine if there is anything left to read . */
private boolean isMoreToReadAfterReadingRec... | final int compareNextToEnd = createSequenceNumber ( getNextStartOffset ( recordSequenceNumber ) ) . compareTo ( createSequenceNumber ( endSequenceNumber ) ) ; // Unlike isMoreToReadBeforeReadingRecord , we don ' t care if the end is exclusive or not . If we read it , we ' re done .
return compareNextToEnd < 0 ; |
public class CreateLineItemsWithCustomCriteria { /** * Runs the example .
* @ param adManagerServices the services factory .
* @ param session the session .
* @ param orderId the ID of the order that the line items will belong to .
* @ param customTargetingKeyId1 the key ID for the equality comparison in the fi... | // Get the LineItemService .
LineItemServiceInterface lineItemService = adManagerServices . get ( session , LineItemServiceInterface . class ) ; // Get the NetworkService .
NetworkServiceInterface networkService = adManagerServices . get ( session , NetworkServiceInterface . class ) ; // Get the root ad unit ID used to... |
public class StringUtilities { /** * Gets the last index of a character ignoring characters that have been escaped
* @ param input The string to be searched
* @ param delim The character to be found
* @ return The index of the found character or - 1 if the character wasn ' t found */
public static int lastIndexOf... | return input == null ? - 1 : lastIndexOf ( input , delim , input . length ( ) ) ; |
public class DictTerm { /** * getter for DictCanon - gets canonical form
* @ generated
* @ return value of the feature */
public String getDictCanon ( ) { } } | if ( DictTerm_Type . featOkTst && ( ( DictTerm_Type ) jcasType ) . casFeat_DictCanon == null ) jcasType . jcas . throwFeatMissing ( "DictCanon" , "org.apache.uima.conceptMapper.DictTerm" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( DictTerm_Type ) jcasType ) . casFeatCode_DictCanon ) ; |
public class FlowTypeCheck { /** * From an arbitrary type , extract the reference type it represents which is
* either readable or writeable depending on the context . */
public SemanticType . Reference extractReferenceType ( SemanticType type , Environment environment , ReadWriteTypeExtractor . Combinator < Semantic... | if ( type != null ) { SemanticType . Reference refT = rwTypeExtractor . apply ( type , environment , combinator ) ; if ( refT == null ) { syntaxError ( item , EXPECTED_REFERENCE ) ; } else { return refT ; } } return null ; |
public class base_resource { /** * Use this method to perform an Unset operation on netscaler resource .
* @ param service nitro _ service object .
* @ param args Array of args that are to be unset .
* @ return status of the operation performed .
* @ throws Exception Nitro exception is thrown . */
protected bas... | if ( ! service . isLogin ( ) && ! get_object_type ( ) . equals ( "login" ) ) service . login ( ) ; options option = new options ( ) ; option . set_action ( "unset" ) ; base_response response = unset_request ( service , option , args ) ; return response ; |
public class SpringSecurityXmAuthenticationContext { /** * { @ inheritDoc } */
@ Override public boolean isFullyAuthenticated ( ) { } } | return getAuthentication ( ) . filter ( auth -> ! ANONYMOUS_AUTH_CLASS . isAssignableFrom ( auth . getClass ( ) ) && ! REMEMBER_ME_AUTH_CLASS . isAssignableFrom ( auth . getClass ( ) ) ) . isPresent ( ) ; |
public class InlineMediaSource { /** * Get implementation of inline media item
* @ param ntResourceResource nt : resource node
* @ param media Media metadata
* @ param fileName File name
* @ return Inline media item instance */
private Asset getInlineAsset ( Resource ntResourceResource , Media media , String fi... | return new InlineAsset ( ntResourceResource , media , fileName , adaptable ) ; |
public class XMLCaster { /** * casts a value to a XML Element Array
* @ param doc XML Document
* @ param o Object to cast
* @ return XML Comment Array
* @ throws PageException */
public static Element [ ] toElementArray ( Document doc , Object o ) throws PageException { } } | // Node [ ]
if ( o instanceof Node [ ] ) { Node [ ] nodes = ( Node [ ] ) o ; if ( _isAllOfSameType ( nodes , Node . ELEMENT_NODE ) ) return ( Element [ ] ) nodes ; Element [ ] elements = new Element [ nodes . length ] ; for ( int i = 0 ; i < nodes . length ; i ++ ) { elements [ i ] = toElement ( doc , nodes [ i ] ) ; }... |
public class SibDiagnosticModule { /** * Generates a string representation of the object for FFDC .
* If the object is an Object Array , Collection or Map the
* elements are inspected individually up to a maximum of
* multiple _ object _ count _ to _ ffdc
* @ param obj
* Object to generate a string representa... | if ( obj instanceof Map ) { return toFFDCString ( ( Map ) obj ) ; } else if ( obj instanceof Collection ) { return toFFDCString ( ( Collection ) obj ) ; } else if ( obj instanceof Object [ ] ) { return toFFDCString ( ( Object [ ] ) obj ) ; } return toFFDCStringSingleObject ( obj ) ; |
public class AppServicePlansInner { /** * Get a Virtual Network gateway .
* Get a Virtual Network gateway .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service plan .
* @ param vnetName Name of the Virtual Network .
* @ param gatewayNam... | return getVnetGatewayWithServiceResponseAsync ( resourceGroupName , name , vnetName , gatewayName ) . map ( new Func1 < ServiceResponse < VnetGatewayInner > , VnetGatewayInner > ( ) { @ Override public VnetGatewayInner call ( ServiceResponse < VnetGatewayInner > response ) { return response . body ( ) ; } } ) ; |
public class InvalidationAuditDaemon { /** * This ensures that the specified ExternalCacheFragment has not
* been invalidated .
* @ param externalCacheFragment The unfiltered ExternalCacheFragment .
* @ return The filtered ExternalCacheFragment . */
public ExternalInvalidation filterExternalCacheFragment ( String... | InvalidationTableList invalidationTableList = getInvalidationTableList ( cacheName ) ; try { invalidationTableList . readWriteLock . readLock ( ) . lock ( ) ; return internalFilterExternalCacheFragment ( cacheName , invalidationTableList , externalCacheFragment ) ; } finally { invalidationTableList . readWriteLock . re... |
public class EasterRule { /** * Return true if Easter occurs between the two dates given */
@ Override public boolean isBetween ( Date start , Date end ) { } } | return firstBetween ( start , end ) != null ; // TODO : optimize ? |
public class WebUtils { /** * The Grails dispatch servlet maps URIs like / app / grails / example / index . dispatch . This method infers the
* controller URI for the dispatch URI so that / app / grails / example / index . dispatch becomes / app / example / index
* @ param request The request */
public static Strin... | UrlPathHelper pathHelper = new UrlPathHelper ( ) ; if ( request . getRequestURI ( ) . endsWith ( GRAILS_DISPATCH_EXTENSION ) ) { String path = pathHelper . getPathWithinApplication ( request ) ; if ( path . startsWith ( GRAILS_SERVLET_PATH ) ) { path = path . substring ( GRAILS_SERVLET_PATH . length ( ) , path . length... |
public class FileOutputCommitter { /** * Did this task write any files in the work directory ?
* @ param context the task ' s context */
@ Override public boolean needsTaskCommit ( TaskAttemptContext context ) throws IOException { } } | return workPath != null && outputFileSystem . exists ( workPath ) ; |
public class KmeansCalculator { /** * 対象点と学習モデルを指定し 、 どのクラスタに判別されるかを取得する 。
* @ param targetPoint 判定対象ポイント
* @ param dataSet 学習モデル
* @ return どのクラスタに判別されるかのインデックス */
public static KmeansResult classify ( KmeansPoint targetPoint , KmeansDataSet dataSet ) { } } | // KMeanクラスタリング結果を算出
int nearestCentroidIndex = 0 ; Double minDistance = Double . MAX_VALUE ; double [ ] currentCentroid = null ; Double currentDistance ; for ( int index = 0 ; index < dataSet . getCentroids ( ) . length ; index ++ ) { currentCentroid = dataSet . getCentroids ( ) [ index ] ; if ( currentCentroid != nu... |
public class HostMessenger { /** * Block on this call until the number of ready hosts is
* equal to the number of expected hosts . */
public void waitForAllHostsToBeReady ( int expectedHosts ) { } } | try { m_zk . create ( CoreZK . readyhosts_host , null , Ids . OPEN_ACL_UNSAFE , CreateMode . EPHEMERAL_SEQUENTIAL ) ; while ( true ) { ZKUtil . FutureWatcher fw = new ZKUtil . FutureWatcher ( ) ; int readyHosts = m_zk . getChildren ( CoreZK . readyhosts , fw ) . size ( ) ; if ( readyHosts == expectedHosts ) { break ; }... |
public class ServerEnvironment { /** * Get a File from configuration .
* @ param path the file path
* @ return the CanonicalFile form for the given name . */
private File getFileFromPath ( final String path ) { } } | File result = ( path != null ) ? new File ( path ) : null ; // AS7-1752 see if a non - existent relative path exists relative to the home dir
if ( result != null && homeDir != null && ! result . exists ( ) && ! result . isAbsolute ( ) ) { File relative = new File ( homeDir , path ) ; if ( relative . exists ( ) ) { resu... |
public class SuperCsvCellProcessorException { /** * Assembles the exception message when the value received by a CellProcessor isn ' t of the correct type .
* @ param expectedType
* the expected type
* @ param actualValue
* the value received by the CellProcessor
* @ return the message
* @ throws NullPointe... | if ( expectedType == null ) { throw new NullPointerException ( "expectedType should not be null" ) ; } String expectedClassName = expectedType . getName ( ) ; String actualClassName = ( actualValue != null ) ? actualValue . getClass ( ) . getName ( ) : "null" ; return String . format ( "the input value should be of typ... |
public class StackdriverWriter { /** * Sets up the object and makes sure all the required parameters are available < br / >
* Minimally a Stackdriver API key must be provided using the token setting */
@ Override public void validateSetup ( Server server , Query query ) throws ValidationException { } } | logger . info ( "Starting Stackdriver writer connected to '{}', proxy {} ..." , gatewayUrl , proxy ) ; |
public class SessionBeanTypeImpl { /** * If not already created , a new < code > after - completion - method < / code > element with the given value will be created .
* Otherwise , the existing < code > after - completion - method < / code > element will be returned .
* @ return a new or existing instance of < code... | Node node = childNode . getOrCreate ( "after-completion-method" ) ; NamedMethodType < SessionBeanType < T > > afterCompletionMethod = new NamedMethodTypeImpl < SessionBeanType < T > > ( this , "after-completion-method" , childNode , node ) ; return afterCompletionMethod ; |
public class LinkedList { /** * Synchronized . Remove an Entry from the list .
* @ param removePointer The Entry to be removed
* @ return The Entry which was removed */
public Entry remove ( Entry removePointer ) { } } | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "remove" , new Object [ ] { removePointer } ) ; Entry removedEntry = null ; // check that the entry to be removed is not null and is in this list
if ( contains ( removePointer ) ) { // call the internal unsynchronized remove method on the entry to be removed .
removed... |
public class ApiOvhMe { /** * Enable this SMS account
* REST : POST / me / accessRestriction / sms / { id } / enable
* @ param code [ required ] SMS code send by a cellphone
* @ param id [ required ] The Id of the restriction */
public void accessRestriction_sms_id_enable_POST ( Long id , String code ) throws IOE... | String qPath = "/me/accessRestriction/sms/{id}/enable" ; StringBuilder sb = path ( qPath , id ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "code" , code ) ; exec ( qPath , "POST" , sb . toString ( ) , o ) ; |
public class DateCellEditor { /** * of this method so that everything gets cleaned up . */
@ Override public boolean stopCellEditing ( ) { } } | JFormattedTextField ftf = ( JFormattedTextField ) getComponent ( ) ; if ( ftf . isEditValid ( ) ) { try { ftf . commitEdit ( ) ; } catch ( java . text . ParseException ex ) { } } else { // text is invalid
Toolkit . getDefaultToolkit ( ) . beep ( ) ; textField . selectAll ( ) ; return false ; // don ' t let the editor g... |
public class CorpusConfig { /** * Returns a configuration from the underlying property object .
* @ param configName The name of the configuration .
* @ param def the default value , if no config is found .
* @ return Can be null if the config name does not exists . */
public String getConfig ( String configName ... | if ( config != null ) { return config . getProperty ( configName , def ) ; } else { return def ; } |
public class DeterministicScheduler { /** * Runs the next command scheduled to be executed immediately . */
public void runNextPendingCommand ( ) { } } | ScheduledTask < ? > scheduledTask = deltaQueue . pop ( ) ; scheduledTask . run ( ) ; if ( ! scheduledTask . isCancelled ( ) && scheduledTask . repeats ( ) ) { deltaQueue . add ( scheduledTask . repeatDelay , scheduledTask ) ; } |
public class WurflCapabilityServiceImpl { /** * init will properly initialize this service . this would look for wurfl files
* and instantiate a wurfl holder */
public void init ( ) { } } | // before running init check to see if attributes has been injected / set
if ( wurflDirPath == null ) throw new IllegalStateException ( "wurflDirPath not properly set" ) ; // look for wurfl file and patches
File wurflDir = new File ( wurflDirPath ) ; // if file does not exists , it might be relative to the servlet
if (... |
public class HtmlReport { /** * each report HTML file is { methodQualifiedParentPath } / { methodSimpleName } . html */
public void generate ( List < File > reportInputDataDirs , File reportOutputDir ) throws IllegalDataStructureException , IllegalTestScriptException { } } | deleteDirIfExists ( reportOutputDir ) ; // delete previous execution output
File htmlExternalResRootDir = CommonPath . htmlExternalResourceRootDir ( reportOutputDir ) ; SrcTree srcTree = generateSrcTree ( reportInputDataDirs ) ; List < RunResults > runResultsList = generateRunResultList ( reportInputDataDirs , srcTree ... |
public class SymmetricCrypto { /** * 解密为字符串
* @ param bytes 被解密的bytes
* @ param charset 解密后的charset
* @ return 解密后的String */
public String decryptStr ( byte [ ] bytes , Charset charset ) { } } | return StrUtil . str ( decrypt ( bytes ) , charset ) ; |
public class FwWebDirection { public void directMessage ( Consumer < List < String > > appSetupper , String ... commonNames ) { } } | assertArgumentNotNull ( "appSetupper" , appSetupper ) ; assertArgumentNotNull ( "commonNames" , commonNames ) ; final List < String > nameList = new ArrayList < String > ( 4 ) ; appSetupper . accept ( nameList ) ; nameList . addAll ( Arrays . asList ( commonNames ) ) ; appMessageName = nameList . remove ( 0 ) ; getExte... |
public class JavaScriptEscapeUtil { /** * Perform an unescape operation based on a Reader , writing the results to a Writer .
* Note this reader is going to be read char - by - char , so some kind of buffering might be appropriate if this
* is an inconvenience for the specific Reader implementation . */
static void... | if ( reader == null ) { return ; } int escapei = 0 ; final char [ ] escapes = new char [ 4 ] ; int c1 , c2 , ce ; // c1 : current char , c2 : next char , ce : current escape char
c2 = reader . read ( ) ; while ( c2 >= 0 ) { c1 = c2 ; c2 = reader . read ( ) ; escapei = 0 ; /* * Check the need for an unescape operation a... |
public class AbstractXTree { /** * Inserts the specified leaf entry into this R * - Tree .
* @ param entry the leaf entry to be inserted */
@ Override protected void insertLeafEntry ( SpatialEntry entry ) { } } | // choose subtree for insertion
IndexTreePath < SpatialEntry > subtree = choosePath ( getRootPath ( ) , entry , height , 1 ) ; if ( getLogger ( ) . isDebugging ( ) ) { getLogger ( ) . debugFine ( "insertion-subtree " + subtree + "\n" ) ; } N parent = getNode ( subtree . getEntry ( ) ) ; parent . addLeafEntry ( entry ) ... |
public class AnnotationCollectorTransform { /** * Returns a list of AnnotationNodes for the value attribute of the given
* AnnotationNode .
* @ param collector the node containing the value member with the list
* @ param source the source unit for error reporting
* @ return a list of string constants */
protect... | List < AnnotationNode > stored = getStoredTargetList ( aliasAnnotationUsage , source ) ; List < AnnotationNode > targetList = getTargetListFromValue ( collector , aliasAnnotationUsage , source ) ; int size = targetList . size ( ) + stored . size ( ) ; if ( size == 0 ) { return Collections . emptyList ( ) ; } List < Ann... |
public class EventServiceImplementation { /** * Add a J2SSH Listener to the list of listeners that will be sent events
* @ param threadPrefix
* listen to threads whose name have this prefix , string must not
* contain any ' - ' except the final character which must be a
* @ param listener */
public synchronized... | if ( threadPrefix . trim ( ) . equals ( "" ) ) { globalListeners . addElement ( listener ) ; } else { keyedListeners . put ( threadPrefix . trim ( ) , listener ) ; } |
public class SourceDocumentInformation { /** * getter for lastSegment - gets For a CAS that represents a segment of a larger source document , this flag indicates whether this CAS is the final segment of the source document . This is useful for downstream components that want to take some action after having seen all o... | if ( SourceDocumentInformation_Type . featOkTst && ( ( SourceDocumentInformation_Type ) jcasType ) . casFeat_lastSegment == null ) jcasType . jcas . throwFeatMissing ( "lastSegment" , "org.apache.uima.examples.SourceDocumentInformation" ) ; return jcasType . ll_cas . ll_getBooleanValue ( addr , ( ( SourceDocumentInform... |
public class GradientLookup { /** * * * * * * Initialization * * * * * */
private void init ( ) { } } | if ( stops . isEmpty ( ) ) return ; double minFraction = Collections . min ( stops . keySet ( ) ) ; double maxFraction = Collections . max ( stops . keySet ( ) ) ; if ( Double . compare ( minFraction , 0 ) > 0 ) { stops . put ( 0.0 , new Stop ( 0.0 , stops . get ( minFraction ) . getColor ( ) ) ) ; } if ( Double . comp... |
public class Page { /** * Route String must obey some rules to be valid :
* < UL >
* < LI > no ' / ' at start or end
* < LI > Only characters or digits or the three characters - _ / are allowed
* < / UL >
* @ param route String provided by a page
* @ return Frontend will accept route or not
* @ see java .... | if ( StringUtils . isBlank ( route ) ) { return false ; } if ( route . startsWith ( "/" ) || route . endsWith ( "/" ) ) { return false ; } for ( int i = 0 ; i < route . length ( ) ; i ++ ) { char c = route . charAt ( i ) ; if ( ! ( c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '/' || c ==... |
public class ImageModerationsImpl { /** * Returns the list of faces found .
* @ param imageStream The image file .
* @ param findFacesFileInputOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the valid... | if ( this . client . baseUrl ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.baseUrl() is required and cannot be null." ) ; } if ( imageStream == null ) { throw new IllegalArgumentException ( "Parameter imageStream is required and cannot be null." ) ; } final Boolean cacheImage = findFacesFi... |
public class GeometryMergeService { /** * Clear the entire list of geometries for merging , basically resetting the process .
* @ throws GeometryMergeException In case the merging process has not been started . */
public void clearGeometries ( ) throws GeometryMergeException { } } | if ( ! busy ) { throw new GeometryMergeException ( "Can't clear geometry list if no merging process is active." ) ; } for ( Geometry geometry : geometries ) { eventBus . fireEvent ( new GeometryMergeRemovedEvent ( geometry ) ) ; } geometries . clear ( ) ; |
public class LoganSquare { /** * Returns a JsonMapper for a given class that has been annotated with @ JsonObject .
* @ param cls The class for which the JsonMapper should be fetched . */
public static < E > JsonMapper < E > mapperFor ( Class < E > cls ) throws NoSuchMapperException { } } | JsonMapper < E > mapper = getMapper ( cls ) ; if ( mapper == null ) { throw new NoSuchMapperException ( cls ) ; } else { return mapper ; } |
public class ConvergedStandardSession { /** * ( non - Javadoc )
* @ see javax . servlet . sip . ConvergedHttpSession # encodeURL ( java . lang . String , java . lang . String ) */
public String encodeURL ( String relativePath , String scheme ) { } } | return convergedSessionDelegate . encodeURL ( relativePath , scheme ) ; |
public class SecurityActions { /** * Create a WorkClassLoader
* @ param cb The class bundle
* @ return The class loader */
static WorkClassLoader createWorkClassLoader ( final ClassBundle cb ) { } } | return AccessController . doPrivileged ( new PrivilegedAction < WorkClassLoader > ( ) { public WorkClassLoader run ( ) { return new WorkClassLoader ( cb ) ; } } ) ; |
public class RecurlyClient { /** * Update an account ' s billing info
* When new or updated credit card information is updated , the billing information is only saved if the credit card
* is valid . If the account has a past due invoice , the outstanding balance will be collected to validate the
* billing informa... | final String accountCode = billingInfo . getAccount ( ) . getAccountCode ( ) ; // Unset it to avoid confusing Recurly
billingInfo . setAccount ( null ) ; return doPUT ( Account . ACCOUNT_RESOURCE + "/" + accountCode + BillingInfo . BILLING_INFO_RESOURCE , billingInfo , BillingInfo . class ) ; |
public class TypeHandler { /** * Returns the URL represented by < code > str < / code > .
* @ param str the URL string
* @ return The URL in < code > str < / code > is well - formed
* @ throws ParseException if the URL in < code > str < / code > is not well - formed */
public static URL createURL ( String str ) t... | try { return new URL ( str ) ; } catch ( MalformedURLException e ) { throw new ParseException ( "Unable to parse the URL: " + str ) ; } |
public class VanillaDb { /** * Creates a planner for SQL commands . To change how the planner works ,
* modify this method .
* @ return the system ' s planner for SQL commands */
public static Planner newPlanner ( ) { } } | QueryPlanner qplanner ; UpdatePlanner uplanner ; try { qplanner = ( QueryPlanner ) queryPlannerCls . newInstance ( ) ; uplanner = ( UpdatePlanner ) updatePlannerCls . newInstance ( ) ; } catch ( InstantiationException | IllegalAccessException e ) { e . printStackTrace ( ) ; return null ; } return new Planner ( qplanner... |
public class BuildContext { /** * Set the variable to the given value . If the value is null , then the
* variable will be removed from the context . */
public void setGlobalVariable ( String name , Element value , boolean finalFlag ) { } } | assert ( name != null ) ; // Either modify an existing value ( with appropriate checks ) or add a
// new one .
if ( globalVariables . containsKey ( name ) ) { GlobalVariable gvar = globalVariables . get ( name ) ; gvar . setValue ( value ) ; gvar . setFinalFlag ( finalFlag ) ; } else if ( value != null ) { GlobalVariab... |
public class Classes { /** * Lookup implementation for requested interface into given registry and return a new instance of it .
* @ param implementationsRegistry implementations registry ,
* @ param interfaceType interface to lookup into registry .
* @ param < T > instance type .
* @ return implementation inst... | Class < ? > implementation = getImplementation ( implementationsRegistry , interfaceType ) ; try { return ( T ) implementation . newInstance ( ) ; } catch ( IllegalAccessException e ) { // illegal access exception is thrown if the class or its no - arguments constructor is not accessible
// since we use well known JRE ... |
public class MBeanServerProxy { /** * { @ inheritDoc } */
public Set < ObjectName > queryNames ( ObjectName name , QueryExp query ) { } } | return delegate . queryNames ( name , query ) ; |
public class BufferManager { /** * Obtain a maker object that can create a new { @ link QueueBuffer } .
* @ param serializer the serializer for the value
* @ return the maker ; never null */
public < T > QueueBufferMaker < T > createQueueBuffer ( Serializer < T > serializer ) { } } | return new MakeOrderedBuffer < T > ( "buffer-" + dbCounter . incrementAndGet ( ) , serializer ) ; |
public class RaftSession { /** * Clears command results up to the given sequence number .
* Command output is removed from memory up to the given sequence number . Additionally , since we know the
* client received a response for all commands up to the given sequence number , command futures are removed
* from me... | if ( sequence > commandLowWaterMark ) { for ( long i = commandLowWaterMark + 1 ; i <= sequence ; i ++ ) { results . remove ( i ) ; commandLowWaterMark = i ; } } |
public class MathUtil { /** * Binomial coefficient , also known as " n choose k " .
* @ param n Total number of samples . n & gt ; 0
* @ param k Number of elements to choose . < code > n & gt ; = k < / code > ,
* < code > k & gt ; = 0 < / code >
* @ return n ! / ( k ! * ( n - k ) ! ) */
public static long binom... | final long m = Math . max ( k , n - k ) ; double temp = 1 ; for ( long i = n , j = 1 ; i > m ; i -- , j ++ ) { temp = temp * i / j ; } return ( long ) temp ; |
public class PomHandler { /** * Handles the start element event .
* @ param uri the uri of the element being processed
* @ param localName the local name of the element being processed
* @ param qName the qName of the element being processed
* @ param attributes the attributes of the element being processed
*... | currentText = new StringBuilder ( ) ; stack . push ( qName ) ; if ( LICENSE . equals ( qName ) ) { license = new License ( ) ; } |
public class ServicesInner { /** * Create or update DMS Instance .
* The services resource is the top - level resource that represents the Data Migration Service . The PUT method creates a new service or updates an existing one . When a service is updated , existing child resources ( i . e . tasks ) are unaffected . ... | return beginCreateOrUpdateWithServiceResponseAsync ( groupName , serviceName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class HttpFields { private static FieldInfo getFieldInfo ( char [ ] name , int offset , int length ) { } } | Map . Entry entry = __info . getEntry ( name , offset , length ) ; if ( entry == null ) return new FieldInfo ( new String ( name , offset , length ) , false ) ; return ( FieldInfo ) entry . getValue ( ) ; |
public class TemplateDataTenantOperationsListener { /** * High - level implementation method that brokers the queuing , importing , and reporting that is
* common to Create and Update . */
public TenantOperationResponse importWithResources ( final ITenant tenant , final Set < Resource > resources ) { } } | /* * First load dom4j Documents and sort the entity files into the proper order */
final Map < PortalDataKey , Set < BucketTuple > > importQueue ; try { importQueue = prepareImportQueue ( tenant , resources ) ; } catch ( Exception e ) { final TenantOperationResponse error = new TenantOperationResponse ( this , TenantOp... |
public class DevicesInner { /** * Creates or updates a Data Box Edge / Gateway resource .
* @ param deviceName The device name .
* @ param resourceGroupName The resource group name .
* @ param dataBoxEdgeDevice The resource object .
* @ throws IllegalArgumentException thrown if parameters fail the validation
... | return beginCreateOrUpdateWithServiceResponseAsync ( deviceName , resourceGroupName , dataBoxEdgeDevice ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class MPJwtNoMpJwtConfig { /** * login - config does NOT exist in web . xml
* login - config does NOT exist in the app
* the mpJwt feature is NOT enabled
* We should receive a 401 status in an exception
* @ throws Exception */
@ Test public void MPJwtNoMpJwtConfig_notInWebXML_notInApp ( ) throws Exceptio... | genericLoginConfigVariationTest ( MpJwtFatConstants . LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT , MpJwtFatConstants . LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_NOT_IN_APP , MpJwtFatConstants . MPJWT_APP_CLASS_NO_LOGIN_CONFIG , ExpectedResult . BAD ) ; |
public class ConnectionWatchdog { /** * Reconnect to the remote address that the closed channel was connected to .
* This creates a new { @ link ChannelPipeline } with the same handler instances
* contained in the old channel ' s pipeline .
* @ param timeout Timer task handle .
* @ throws Exception when reconne... | ChannelPipeline old = channel . getPipeline ( ) ; CommandHandler < ? , ? > handler = old . get ( CommandHandler . class ) ; RedisAsyncConnection < ? , ? > connection = old . get ( RedisAsyncConnection . class ) ; ChannelPipeline pipeline = Channels . pipeline ( this , handler , connection ) ; Channel c = bootstrap . ge... |
public class FunctionArgumentSignatureFactory { /** * Determine annotated default parameter value .
* @ param parameter The method parameter .
* @ return The parameters default value . */
public Object getDefaultValue ( Parameter parameter ) { } } | Class < ? > type = parameter . getType ( ) ; if ( TypeUtils . isaString ( type ) ) { return getStringDefaultValue ( parameter ) ; } if ( TypeUtils . isaByte ( type ) ) { return getByteDefaultValue ( parameter ) ; } if ( TypeUtils . isaShort ( type ) ) { return getShortDefaultValue ( parameter ) ; } if ( TypeUtils . isa... |
public class NotificationHubsInner { /** * Patch a NotificationHub in a namespace .
* @ param resourceGroupName The name of the resource group .
* @ param namespaceName The namespace name .
* @ param notificationHubName The notification hub name .
* @ param parameters Parameters supplied to patch a Notification... | return ServiceFuture . fromResponse ( patchWithServiceResponseAsync ( resourceGroupName , namespaceName , notificationHubName , parameters ) , serviceCallback ) ; |
public class RetryHandlingMetaMasterMasterClient { /** * Returns a master id for a master address .
* @ param address the address to get a master id for
* @ return a master id */
public long getId ( final Address address ) throws IOException { } } | return retryRPC ( ( ) -> mClient . getMasterId ( GetMasterIdPRequest . newBuilder ( ) . setMasterAddress ( address . toProto ( ) ) . build ( ) ) . getMasterId ( ) ) ; |
public class Flow { /** * Replaces the top key of the history with the given key and dispatches in the given direction . */
public void replaceTop ( @ NonNull final Object key , @ NonNull final Direction direction ) { } } | setHistory ( getHistory ( ) . buildUpon ( ) . pop ( 1 ) . push ( key ) . build ( ) , direction ) ; |
public class MetadataCommand { /** * { @ inheritDoc }
* @ see org . audit4j . core . Initializable # init ( ) */
@ Override public void init ( ) throws InitializationException { } } | List < String > options = getOptionsByCommand ( getCommand ( ) ) ; options . contains ( ASYNC_OPTION ) ; async = true ; |
public class AbstractJPAFacetImpl { /** * Facet methods */
@ Override public String getEntityPackage ( ) { } } | JavaSourceFacet sourceFacet = getFaceted ( ) . getFacet ( JavaSourceFacet . class ) ; return sourceFacet . getBasePackage ( ) + "." + JavaEEPackageConstants . DEFAULT_ENTITY_PACKAGE ; |
public class CmsVfsSitemapService { /** * Creates a client property bean from a server - side property . < p >
* @ param prop the property from which to create the client property
* @ param preserveOrigin if true , the origin will be copied into the new object
* @ return the new client property */
public static C... | CmsClientProperty result = new CmsClientProperty ( prop . getName ( ) , prop . getStructureValue ( ) , prop . getResourceValue ( ) ) ; if ( preserveOrigin ) { result . setOrigin ( prop . getOrigin ( ) ) ; } return result ; |
public class OutputAccessor { /** * Create an { @ link OutputAccessor } for the given { @ link ByteBuffer } . Instances are pooled within the thread scope .
* @ param poolHolder
* @ param byteBuffer
* @ return */
public static OutputAccessor from ( OutputAccessorPoolHolder poolHolder , ByteBuffer byteBuffer ) { }... | ByteBufferOutputAccessor accessor = poolHolder . getByteBufferOutputAccessor ( ) ; accessor . byteBuffer = byteBuffer ; return accessor ; |
public class CmsLocationController { /** * Displays the values within the picker widget . < p > */
private void displayValue ( ) { } } | if ( m_currentValue == null ) { m_picker . displayValue ( "" ) ; m_picker . setPreviewVisible ( false ) ; m_picker . setLocationInfo ( Collections . < String , String > emptyMap ( ) ) ; } else { m_picker . displayValue ( m_editValue . getAddress ( ) ) ; Map < String , String > infos = new LinkedHashMap < String , Strin... |
public class DataStore { /** * Add a data row , consisting of one column , to the store at a particular time .
* @ param timestamp Timestamp for the data point .
* @ param column The column for a field to value mapping
* @ param value The value for a field to value mapping */
public void add ( long timestamp , St... | if ( ! ( value instanceof Long ) && ! ( value instanceof Integer ) && ! ( value instanceof Double ) && ! ( value instanceof Float ) && ! ( value instanceof Boolean ) && ! ( value instanceof String ) ) { throw new IllegalArgumentException ( "value must be of type: Long, Integer, Double, Float, Boolean, or String" ) ; } ... |
public class A_CmsJspValueWrapper { /** * Returns a lazy initialized Map that provides Booleans which
* indicate if an Object is equal to the wrapped object . < p >
* @ return a lazy initialized Map that provides Booleans which
* indicate if an Object is equal to the wrapped object */
public Map < Object , Boolea... | if ( m_isEqual == null ) { m_isEqual = CmsCollectionsGenericWrapper . createLazyMap ( new CmsIsEqualTransformer ( ) ) ; } return m_isEqual ; |
public class OsUtil { /** * @ param pathElements
* @ return boolean
* @ throws Exception
* @ Description : JOIN PATH
* @ author liaoqiqi
* @ date 2013-6-13 */
public static String pathJoin ( final String ... pathElements ) { } } | final String path ; if ( pathElements == null || pathElements . length == 0 ) { path = File . separator ; } else { final StringBuffer sb = new StringBuffer ( ) ; for ( final String pathElement : pathElements ) { if ( pathElement . length ( ) > 0 ) { sb . append ( pathElement ) ; sb . append ( File . separator ) ; } } i... |
public class DbWebServlet { /** * Perform multiple SQL queries via dbSec .
* queries = {
* key1 : {
* table : < table name >
* , select : [
* < selectExpression >
* , where : [
* ' < columnName > , < comparator > '
* , ' < columnName > , < comparator > '
* , groupBy : [
* < columnName >
* , key2 :... | User user = AuthenticationUtils . getUserFromRequest ( request ) ; String [ ] queriesStrings = request . getParameterValues ( "queries" ) ; if ( 1 != queriesStrings . length ) { throw new Exception ( "Parameter 'queries' must be specified exactly oncce" ) ; } // Create list of Query instances
List < Query > queries = p... |
public class Solo { /** * Returns a View matching the specified tag .
* @ param tag the tag of the { @ link View } to return
* @ return a { @ link View } matching the specified id */
public View getView ( Object tag ) { } } | if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "getView(" + tag + ")" ) ; } return getView ( tag , 0 ) ; |
public class WheelCall { /** * { @ inheritDoc } */
@ Override public Map < String , Object > getPayload ( ) { } } | HashMap < String , Object > payload = new HashMap < > ( ) ; payload . put ( "fun" , getFunction ( ) ) ; kwargs . ifPresent ( payload :: putAll ) ; return payload ; |
public class Matrix { /** * Folds all elements ( in row - by - row manner ) of this matrix with given { @ code accumulator } .
* @ param accumulator the vector accumulator
* @ return the accumulated double array */
public double [ ] foldRows ( VectorAccumulator accumulator ) { } } | double [ ] result = new double [ rows ] ; for ( int i = 0 ; i < rows ; i ++ ) { result [ i ] = foldRow ( i , accumulator ) ; } return result ; |
public class AbstractCollectionJsonDeserializer { /** * < p > newInstance < / p >
* @ param deserializer { @ link JsonDeserializer } used to deserialize the objects inside the { @ link AbstractCollection } .
* @ param < T > Type of the elements inside the { @ link AbstractCollection }
* @ return a new instance of... | return new AbstractCollectionJsonDeserializer < T > ( deserializer ) ; |
public class Ordering { /** * Creates an { @ link Ordering } from the given factory .
* @ param factory factory to use to create the ordering
* @ param annotatedTestClass test class that is annotated with { @ link OrderWith } .
* @ throws InvalidOrderingException if the instance could not be created */
public sta... | if ( factory == null ) { throw new NullPointerException ( "factory cannot be null" ) ; } if ( annotatedTestClass == null ) { throw new NullPointerException ( "annotatedTestClass cannot be null" ) ; } return factory . create ( new Ordering . Context ( annotatedTestClass ) ) ; |
public class UIResults { /** * Extract a generic UIResults from the HttpServletRequest . Probably used
* by a header / footer template . jsp file .
* @ param httpRequest the HttpServletRequest where the UIResults was
* ferreted away
* @ return generic UIResult with info from httpRequest applied . */
public stat... | UIResults results = ( UIResults ) httpRequest . getAttribute ( FERRET_NAME ) ; if ( results == null ) { results = new UIResults ( httpRequest ) ; } return results ; |
public class JavaParser { /** * $ ANTLR start synpred171 _ Java */
public final void synpred171_Java_fragment ( ) throws RecognitionException { } } | // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 787:17 : ( ' if ' parExpression )
// src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 787:17 : ' if ' parExpression
{ match ( input , 87 , FOLLOW_87_in_synpred171_Java3294 ) ; if ( state... |
public class TmsLayer { /** * Adds userToken to url if we are proxying or caching ( eg . indirect calls )
* @ param imageUrl
* @ return */
private String formatUrl ( String imageUrl ) { } } | if ( useProxy || null != authentication || useCache ) { String token = securityContext . getToken ( ) ; if ( null != token ) { StringBuilder url = new StringBuilder ( imageUrl ) ; int pos = url . lastIndexOf ( "?" ) ; if ( pos > 0 ) { url . append ( "&" ) ; } else { url . append ( "?" ) ; } url . append ( "userToken=" ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.