signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class MetadataFinder { /** * Requests the cue list for a specific track ID , given a dbserver connection to a player that has already
* been set up .
* @ param rekordboxId the track of interest
* @ param slot identifies the media slot we are querying
* @ param client the dbserver client that is communica... | Message response = client . simpleRequest ( Message . KnownType . CUE_LIST_REQ , null , client . buildRMST ( Message . MenuIdentifier . DATA , slot ) , new NumberField ( rekordboxId ) ) ; if ( response . knownType == Message . KnownType . CUE_LIST ) { return new CueList ( response ) ; } logger . error ( "Unexpected res... |
public class EQL { /** * Prints the .
* @ param _ oid the oid
* @ return the prints the */
public static Print print ( final String ... _oid ) { } } | return ( Print ) org . efaps . eql2 . EQL2 . print ( _oid ) ; |
public class SiteRoot { /** * Gets site root level path of a site .
* @ param resource Resource within the site
* @ return Site root path for the site . The path is not checked for validness . */
public String getRootPath ( Resource resource ) { } } | int rootLevel = urlHandlerConfig . getSiteRootLevel ( resource ) ; if ( rootLevel > 0 ) { return Path . getAbsoluteParent ( resource . getPath ( ) , rootLevel , resource . getResourceResolver ( ) ) ; } return null ; |
public class HttpConnection { /** * Get the Remote address .
* @ return the remote host name */
public String getRemoteAddr ( ) { } } | if ( _remoteAddr == null ) { if ( _remoteInetAddress == null ) return "127.0.0.1" ; _remoteAddr = _remoteInetAddress . getHostAddress ( ) ; } return _remoteAddr ; |
public class ServerAzureADAdministratorsInner { /** * Deletes an existing server Active Directory Administrator .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the... | return beginDeleteWithServiceResponseAsync ( resourceGroupName , serverName ) . map ( new Func1 < ServiceResponse < ServerAzureADAdministratorInner > , ServerAzureADAdministratorInner > ( ) { @ Override public ServerAzureADAdministratorInner call ( ServiceResponse < ServerAzureADAdministratorInner > response ) { return... |
public class ManipulationUtils { /** * Adds the retreiveModelName method to the class . */
private static void addRetrieveModelName ( CtClass clazz ) throws CannotCompileException , NotFoundException { } } | CtClass [ ] params = generateClassField ( ) ; CtMethod method = new CtMethod ( cp . get ( String . class . getName ( ) ) , "retrieveModelName" , params , clazz ) ; StringBuilder builder = new StringBuilder ( ) ; builder . append ( createTrace ( "Called retrieveModelName" ) ) . append ( String . format ( "return \"%s\";... |
public class CommercePriceListUtil { /** * Returns the commerce price list where uuid = & # 63 ; and groupId = & # 63 ; or throws a { @ link NoSuchPriceListException } if it could not be found .
* @ param uuid the uuid
* @ param groupId the group ID
* @ return the matching commerce price list
* @ throws NoSuchP... | return getPersistence ( ) . findByUUID_G ( uuid , groupId ) ; |
public class MemcmpDecoder { /** * A fixed is decoded by just reading length bytes , and placing the bytes read
* into the bytes array , starting at index start .
* @ param bytes
* The bytes array to populate .
* @ param start
* The index in bytes to place the read bytes .
* @ param length
* The number of... | int i = in . read ( bytes , start , length ) ; if ( i < length ) { throw new EOFException ( ) ; } |
public class Log { /** * delete of files more than 1 day old */
private static void deleteOldAndEmptyFiles ( ) { } } | File dir = LOG_FILE_DIR ; if ( dir . exists ( ) ) { File [ ] files = dir . listFiles ( ) ; for ( File f : files ) { if ( f . length ( ) == 0 || f . lastModified ( ) + MAXFILEAGE < System . currentTimeMillis ( ) ) { f . delete ( ) ; } } } |
public class AbstractPrintQuery { /** * Method to get the instances used for an select .
* @ param _ selectStmt selectstatement the attribute is wanted for
* @ return List of instances for the select or an empty list in case that
* the onselect is not found
* @ throws EFapsException on error */
public List < In... | final OneSelect oneselect = this . selectStmt2OneSelect . get ( _selectStmt ) ; return oneselect == null ? new ArrayList < > ( ) : oneselect . getInstances ( ) ; |
public class WmsServiceImpl { @ Override public String getLegendGraphicUrl ( WmsLayerConfiguration wmsConfig , LegendConfig legendConfig ) { } } | StringBuilder url = getBaseUrlBuilder ( wmsConfig ) ; // Parameter : service
int pos = url . lastIndexOf ( "?" ) ; if ( pos > 0 ) { url . append ( "&service=WMS" ) ; } else { url . append ( "?service=WMS" ) ; } // Parameter : version
url . append ( "&version=" ) ; url . append ( wmsConfig . getVersion ( ) . toString ( ... |
public class ZanataInterface { /** * Get all of the Document ID ' s available from Zanata for the configured project .
* @ return A List of Resource Objects that contain information such as Document ID ' s . */
public List < ResourceMeta > getZanataResources ( ) { } } | ClientResponse < List < ResourceMeta > > response = null ; try { final ISourceDocResource client = proxyFactory . getSourceDocResource ( details . getProject ( ) , details . getVersion ( ) ) ; response = client . get ( null ) ; final Status status = Response . Status . fromStatusCode ( response . getStatus ( ) ) ; if (... |
public class UsageStatistics { /** * Returns true if it ' s time for us to check for new version . */
public boolean isDue ( ) { } } | // user opted out . no data collection .
if ( ! Jenkins . getInstance ( ) . isUsageStatisticsCollected ( ) || DISABLED ) return false ; long now = System . currentTimeMillis ( ) ; if ( now - lastAttempt > DAY ) { lastAttempt = now ; return true ; } return false ; |
public class ResourceUtilsCore { /** * Extract resource provider from a resource ID string .
* @ param id the resource ID string
* @ return the resource group name */
public static String resourceProviderFromResourceId ( String id ) { } } | return ( id != null ) ? ResourceId . fromString ( id ) . providerNamespace ( ) : null ; |
public class MoneyFormatter { /** * Parses the text extracting monetary information .
* This method parses the input providing low - level access to the parsing state .
* The resulting context contains the parsed text , indicator of error , position
* following the parse and the parsed currency and amount .
* T... | checkNotNull ( text , "Text must not be null" ) ; if ( startIndex < 0 || startIndex > text . length ( ) ) { throw new StringIndexOutOfBoundsException ( "Invalid start index: " + startIndex ) ; } if ( isParser ( ) == false ) { throw new UnsupportedOperationException ( "MoneyFomatter has not been configured to be able to... |
public class AllureResultsUtils { /** * Write throwable as attachment .
* @ param throwable to write
* @ param title title of attachment
* @ return Created { @ link ru . yandex . qatools . allure . model . Attachment } */
public static Attachment writeAttachmentWithErrorMessage ( Throwable throwable , String titl... | String message = throwable . getMessage ( ) ; try { return writeAttachment ( message . getBytes ( CONFIG . getAttachmentsEncoding ( ) ) , title ) ; } catch ( Exception e ) { e . addSuppressed ( throwable ) ; LOGGER . error ( String . format ( "Can't write attachment \"%s\"" , title ) , e ) ; } return new Attachment ( )... |
public class MeteredBalancingPolicy { /** * Begins by claiming all work units that are pegged to this node .
* Then , continues to claim work from the available pool until we ' ve claimed
* equal to or slightly more than the total desired load . */
@ Override public void claimWork ( ) throws InterruptedException { ... | synchronized ( cluster . allWorkUnits ) { for ( String workUnit : getUnclaimed ( ) ) { if ( isPeggedToMe ( workUnit ) ) { claimWorkPeggedToMe ( workUnit ) ; } } final double evenD = evenDistribution ( ) ; LinkedList < String > unclaimed = new LinkedList < String > ( getUnclaimed ( ) ) ; while ( myLoad ( ) <= evenD && !... |
public class DateAdapter { /** * Unmarshal a Date .
* @ param value String from which to unmarshal .
* @ return the unmarshalled Date object */
public Date unmarshal ( String value ) { } } | if ( value != null ) { if ( value . length ( ) >= lengthOfDateFmtYYYY_MM_DD ) { // Extract just the date from the string YYYY - MM - DD
value = value . substring ( 0 , lengthOfDateFmtYYYY_MM_DD ) ; boolean isMatch = value . matches ( datePattern ) ; if ( isMatch ) { return DatatypeConverter . parseDate ( value ) . getT... |
public class CommerceNotificationTemplateUtil { /** * Returns the first commerce notification template in the ordered set where uuid = & # 63 ; .
* @ param uuid the uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce no... | return getPersistence ( ) . findByUuid_First ( uuid , orderByComparator ) ; |
public class SQLExpressions { /** * REGR _ SYY makes the following computation after the elimination of null ( arg1 , arg2 ) pairs :
* < p > { @ code REGR _ COUNT ( arg1 , arg2 ) * VAR _ POP ( arg1 ) } < / p >
* @ param arg1 first arg
* @ param arg2 second arg
* @ return regr _ syy ( arg1 , arg2) */
public stat... | return new WindowOver < Double > ( Double . class , SQLOps . REGR_SYY , arg1 , arg2 ) ; |
public class PingManager { /** * Query the specified entity to see if it supports the Ping protocol ( XEP - 0199 ) .
* @ param jid The id of the entity the query is being sent to
* @ return true if it supports ping , false otherwise .
* @ throws XMPPErrorException An XMPP related error occurred during the request... | return ServiceDiscoveryManager . getInstanceFor ( connection ( ) ) . supportsFeature ( jid , Ping . NAMESPACE ) ; |
public class XMLValidator { /** * Check some limits of our simplified XML output . */
public void checkSimpleXMLString ( String xml ) throws IOException { } } | Pattern pattern = Pattern . compile ( "(<error.*?/>)" , Pattern . DOTALL | Pattern . MULTILINE ) ; Matcher matcher = pattern . matcher ( xml ) ; int pos = 0 ; while ( matcher . find ( pos ) ) { String errorElement = matcher . group ( ) ; pos = matcher . end ( ) ; if ( errorElement . contains ( "\n" ) || errorElement . ... |
public class ResourceDAO { /** * TODO : Rename */
public Resource updateArchived ( Resource resource , Boolean archived , User modifier ) { } } | return updateUrlNameAndArchived ( resource , resource . getUrlName ( ) , archived , modifier ) ; |
public class RpcWrapper { /** * Select an IP address to use for communication , based on the
* < code > key < / code > and < code > policy < / code > .
* @ param key
* The key to use when selecting an IP address .
* @ return The IP address to use for communication .
* @ throws IOException */
public String cho... | if ( _ips == null || _ips . length == 0 ) { if ( _server != null ) { LOG . warn ( "ip list is not initialized, fallback to server" ) ; return _server ; } throw new IOException ( "ip list is not initialized" ) ; } return _ips [ Math . abs ( Arrays . hashCode ( key ) ) % _ips . length ] ; |
public class ObjectInputStream { /** * Read a new object from the stream . It is assumed the object has not been
* loaded yet ( not a cyclic reference ) . Return the object read .
* If the object implements < code > Externalizable < / code > its
* < code > readExternal < / code > is called . Otherwise , all field... | ObjectStreamClass classDesc = readClassDesc ( ) ; if ( classDesc == null ) { throw missingClassDescriptor ( ) ; } int newHandle = nextHandle ( ) ; Class < ? > objectClass = classDesc . forClass ( ) ; Object result = null ; Object registeredResult = null ; if ( objectClass != null ) { // Now we know which class to insta... |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getFontHorizontalScaleFactor ( ) { } } | if ( fontHorizontalScaleFactorEClass == null ) { fontHorizontalScaleFactorEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 377 ) ; } return fontHorizontalScaleFactorEClass ; |
public class Log { /** * Send an ERROR log message with { @ link SUBSYSTEM # MAIN } as default one .
* @ param tag Used to identify the source of a log message . It usually identifies the class or
* activity where the log call occurs .
* @ param msg The message you would like logged .
* @ return */
public stati... | return e ( SUBSYSTEM . MAIN , tag , msg ) ; |
public class ForkJoinTask { /** * If not done , sets SIGNAL status and performs Object . wait ( timeout ) . This task may or may not be
* done on exit . Ignores interrupts .
* @ param timeout using Object . wait conventions . */
final void internalWait ( long timeout ) { } } | int s ; if ( ( s = status ) >= 0 && // force completer to issue notify
U . compareAndSwapInt ( this , STATUS , s , s | SIGNAL ) ) { synchronized ( this ) { if ( status >= 0 ) try { wait ( timeout ) ; } catch ( InterruptedException ie ) { } else notifyAll ( ) ; } } |
public class AmazonRoute53Client { /** * Gets information about a specified traffic policy instance .
* < note >
* After you submit a < code > CreateTrafficPolicyInstance < / code > or an < code > UpdateTrafficPolicyInstance < / code >
* request , there ' s a brief delay while Amazon Route 53 creates the resource... | request = beforeClientExecution ( request ) ; return executeGetTrafficPolicyInstance ( request ) ; |
public class DSLMapLexer { /** * $ ANTLR start " EOL " */
public final void mEOL ( ) throws RecognitionException { } } | try { int _type = EOL ; int _channel = DEFAULT_TOKEN_CHANNEL ; // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 281:6 : ( ( ( ' \ \ r \ \ n ' ) = > ' \ \ r \ \ n ' | ' \ \ r ' | ' \ \ n ' ) )
// src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 282:12 : ( ( ' \ ... |
public class BugInstance { /** * Add a class annotation . If this is the first class annotation added , it
* becomes the primary class annotation .
* @ param className
* the name of the class
* @ param sourceFileName
* the source file of the class
* @ return this object */
@ Nonnull public BugInstance addCl... | ClassAnnotation classAnnotation = new ClassAnnotation ( className , sourceFileName ) ; add ( classAnnotation ) ; return this ; |
public class CategoryGraph { /** * Computes and sets the diameter , the average degree and the average shortest path length of the graph .
* Do not call this in the constructor . May run a while .
* It is called in the getters , if parameters are not yet initialized when retrieved . */
private void setGraphParamete... | // Diameter is the maximum of all shortest path lengths
// Average shortest path length is ( as the name says ) the average of the shortest path length between all node pairs
double maxPathLength = 0.0 ; double shortestPathLengthSum = 0.0 ; double degreeSum = 0.0 ; double clusterCoefficientSum = 0.0 ; // iterate over a... |
public class Smushing { /** * Return definition of smushing logic to be applied .
* @ param oldLayout Old _ Layout describes horizontal layout , older fonts may only provide this .
* @ param fullLayout Full _ Layout describes ALL information about horizontal and vertical layout .
* @ return Smushing logic to be a... | List < SmushingRule > horizontalSmushingRules = new ArrayList < SmushingRule > ( ) ; List < SmushingRule > verticalSmushingRules = new ArrayList < SmushingRule > ( ) ; SmushingRule . Layout horizontalLayout = null ; SmushingRule . Layout verticalLayout = null ; int layout = fullLayout != null ? fullLayout : oldLayout ;... |
public class WebApplicationHandler { public void addFilterHolder ( FilterHolder holder ) { } } | _filterMap . put ( holder . getName ( ) , holder ) ; _filters . add ( holder ) ; addComponent ( holder ) ; |
public class DefaultMapSerializer { /** * ( non - Javadoc )
* @ see org . togglz . core . util . MapSerializer # convertFromString ( java . lang . String ) */
@ Override public Map < String , String > deserialize ( String s ) { } } | try { String input = multiline ? s : s . replace ( '&' , '\n' ) ; Properties props = new Properties ( ) ; if ( s != null ) { props . load ( new StringReader ( input ) ) ; } LinkedHashMap < String , String > result = new LinkedHashMap < String , String > ( ) ; for ( Entry < Object , Object > entry : props . entrySet ( )... |
public class Hash2 { /** * Checks whether expansion is needed and expand when { @ link # insertWithinLock ( Entry , int , int ) } is used .
* No lock may be hold when calling this method , since the table must be locked completely using
* the proper lock order .
* < p > Need for expansion is only checked by compa... | int si = _hash & LOCK_MASK ; long _size = segmentSize [ si ] . get ( ) ; if ( _size > segmentMaxFill ) { eventuallyExpand ( si ) ; } |
public class RBFKernel { /** * Another common ( equivalent ) form of the RBF kernel is k ( x , y ) =
* exp ( - & gamma ; | | x - y | | < sup > 2 < / sup > ) . This method converts the & sigma ; value
* used by this class to the equivalent & gamma ; value .
* @ param sigma the value of & sigma ;
* @ return the e... | if ( sigma <= 0 || Double . isNaN ( sigma ) || Double . isInfinite ( sigma ) ) throw new IllegalArgumentException ( "sigma must be positive, not " + sigma ) ; return 1 / ( 2 * sigma * sigma ) ; |
public class MicroMetaDao { /** * 锟斤拷锟絪ql锟斤拷锟斤拷 */
public int updateObjByCondition ( String sql ) { } } | // JdbcTemplate jdbcTemplate = ( JdbcTemplate ) MicroDbHolder . getDbSource ( dbName ) ;
JdbcTemplate jdbcTemplate = getMicroJdbcTemplate ( ) ; logger . debug ( sql ) ; Integer retStatus = jdbcTemplate . update ( sql ) ; return retStatus ; |
public class CommandFactory { /** * 添加一个命令
* @ param pCommand */
public void addCommand ( Command pCommand ) { } } | if ( ! mCommands . containsKey ( pCommand . getName ( ) ) ) { mCommands . put ( pCommand . getName ( ) , pCommand ) ; } |
public class CurrentlyTracedCall { /** * This is a debug method used to dump out the call into stdout . */
public void dumpOut ( ) { } } | System . out . println ( this . toString ( ) ) ; TraceStep root = getRootStep ( ) ; dumpOut ( root , 1 ) ; |
public class HomeController { /** * Since we are using the convention , the URI for this method is
* / home / login
* The method parameters are set with request parameters named
* login and password . Thus if we have the request :
* POST / home / login
* login = john
* password = nobodyknows
* VRaptor wil... | // search for the user in the database
final User currentUser = dao . find ( login , password ) ; // if no user is found , adds an error message to the validator
// " invalid _ login _ or _ password " is the message key from messages . properties ,
// and that key is used with the fmt taglib in index . jsp , for exampl... |
public class BusSupport { /** * This performs the same feature as { @ link # wrapEventHandler ( String , String , Object , String ) } , just parse the params from jsonObject .
* @ param subscriber Original subscriber object
* @ param jsonObject Json params
* @ return An EventHandlerWrapper wrapping a subscriber a... | String type = jsonObject . optString ( "type" ) ; if ( TextUtils . isEmpty ( type ) ) { return null ; } String producer = jsonObject . optString ( "producer" ) ; // String subscriber = jsonObject . optString ( " subscriber " ) ;
String action = jsonObject . optString ( "action" ) ; return new EventHandlerWrapper ( type... |
public class VAlarmProcedureValidator { /** * { @ inheritDoc } */
public void validate ( VAlarm target ) throws ValidationException { } } | /* * ; the following are all REQUIRED ,
* ; but MUST NOT occur more than once action / attach / trigger /
* ; ' duration ' and ' repeat ' are both optional ,
* ; and MUST NOT occur more than once each ,
* ; but if one occurs , so MUST the other duration / repeat /
* ; ' description ' is optional ,
* ; and M... |
public class ComposeEnvironmentsRequest { /** * A list of version labels , specifying one or more application source bundles that belong to the target
* application . Each source bundle must include an environment manifest that specifies the name of the environment
* and the name of the solution stack to use , and ... | if ( versionLabels == null ) { this . versionLabels = null ; return ; } this . versionLabels = new com . amazonaws . internal . SdkInternalList < String > ( versionLabels ) ; |
public class JSTalkBackFilter { /** * Returns parameter value from request if exists , otherwise - default value .
* @ param req { @ link HttpServletRequest }
* @ param paramName name of the parameter
* @ param defaultValue parameter default value
* @ return request parameter value */
private String getValueOrD... | final String value = req . getParameter ( paramName ) ; return StringUtils . isEmpty ( value ) ? defaultValue : value ; |
public class CmsDefaultValidationHandler { /** * The email should only be composed by digits and standard english letters , points ,
* underscores and exact one " At " symbol . < p >
* @ see org . opencms . security . I _ CmsValidationHandler # checkEmail ( java . lang . String ) */
public void checkEmail ( String ... | if ( CmsStringUtil . isNotEmpty ( email ) ) { email = email . trim ( ) ; email = email . toLowerCase ( Locale . ROOT ) ; } if ( ! CmsStringUtil . validateRegex ( email , EMAIL_REGEX , false ) ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . ERR_EMAIL_VALIDATION_1 , email ) ) ; } |
public class LoggingHandlerEnvironmentFacet { /** * Restores the original root Logger state , including Level and Handlers . */
public void restore ( ) { } } | if ( ! restored ) { // Remove the extra Handler from the RootLogger
rootLogger . removeHandler ( mavenLogHandler ) ; // Restore the original state to the Root logger
rootLogger . setLevel ( originalRootLoggerLevel ) ; for ( Handler current : originalHandlers ) { rootLogger . addHandler ( current ) ; } // All done .
res... |
public class AlgorithmParameterGenerator { /** * Initializes this parameter generator with a set of algorithm - specific
* parameter generation values .
* @ param genParamSpec the set of algorithm - specific parameter generation values .
* @ param random the source of randomness .
* @ exception InvalidAlgorithm... | paramGenSpi . engineInit ( genParamSpec , random ) ; |
public class DiagonalMatrix { /** * { @ inheritDoc } */
public SparseDoubleVector getRowVector ( int row ) { } } | checkIndices ( row , 0 ) ; SparseDoubleVector vector = new SparseHashDoubleVector ( values . length ) ; vector . set ( row , values [ row ] ) ; return vector ; |
public class PolylineEncoding { /** * Encodes a sequence of LatLngs into an encoded path string . */
public static String encode ( final List < LatLng > path ) { } } | long lastLat = 0 ; long lastLng = 0 ; final StringBuilder result = new StringBuilder ( ) ; for ( final LatLng point : path ) { long lat = Math . round ( point . lat * 1e5 ) ; long lng = Math . round ( point . lng * 1e5 ) ; long dLat = lat - lastLat ; long dLng = lng - lastLng ; encode ( dLat , result ) ; encode ( dLng ... |
public class RDBMEntityLockStore { /** * Updates the lock ' s < code > expiration < / code > and < code > lockType < / code > in the underlying store .
* The SQL is over - qualified to make sure the row has not been updated since the lock was last
* checked .
* @ param lock
* @ param newExpiration java . util .... | Integer typeID = EntityTypesLocator . getEntityTypes ( ) . getEntityIDFromType ( lock . getEntityType ( ) ) ; String key = lock . getEntityKey ( ) ; int oldLockType = lock . getLockType ( ) ; int newLockType = ( newType == null ) ? oldLockType : newType . intValue ( ) ; java . sql . Timestamp oldTs = new java . sql . T... |
public class DynatraceMeterRegistry { /** * VisibleForTesting */
List < DynatraceBatchedPayload > createPostMessages ( String type , List < DynatraceTimeSeries > timeSeries ) { } } | final String header = "{\"type\":\"" + type + '\"' + ",\"series\":[" ; final String footer = "]}" ; final int headerFooterBytes = header . getBytes ( UTF_8 ) . length + footer . getBytes ( UTF_8 ) . length ; final int maxMessageSize = MAX_MESSAGE_SIZE - headerFooterBytes ; List < DynatraceBatchedPayload > payloadBodies... |
public class BlockPlacementPolicyConfigurable { /** * Picks up a remote machine within defined window
* @ param rackIdx rack the request is coming from and that should be avoided
* @ param firstRack rack that starts window
* @ param rackWindow rack window size
* @ param machineIdx index of first replica within ... | // randomly choose one node from remote racks
readLock ( ) ; try { HashSet < Integer > excludedRacks = new HashSet < Integer > ( ) ; excludedRacks . add ( rackIdx ) ; int n = racks . size ( ) ; int currRackSize = racksMap . get ( racks . get ( rackIdx ) ) . rackNodes . size ( ) ; while ( excludedRacks . size ( ) < rack... |
public class Complex { /** * return a / b */
public Complex divides ( Complex b ) { } } | Complex a = this ; return a . times ( b . reciprocal ( ) ) ; |
public class ForkJoinPool { /** * Submits a ForkJoinTask for execution .
* @ param task the task to submit
* @ return the task
* @ throws NullPointerException if the task is null
* @ throws RejectedExecutionException if the task cannot be
* scheduled for execution */
public < T > ForkJoinTask < T > submit ( F... | if ( task == null ) throw new NullPointerException ( ) ; doSubmit ( task ) ; return task ; |
public class SelectStageListener { /** * 尝试载入一下上一次未使用的processId , 可能发生mainstem切换 , 新的S模块需要感知前S模块已创建但未使用的process , 不然就是一个死锁 。 而针对已经使用的processId会由e / t / l节点进行处理 */
private void recovery ( Long pipelineId ) { } } | List < Long > currentProcessIds = stageMonitor . getCurrentProcessIds ( false ) ; for ( Long processId : currentProcessIds ) { String path = StagePathUtils . getProcess ( pipelineId , processId ) ; try { byte [ ] bytes = zookeeper . readData ( path ) ; ProcessNodeEventData nodeData = JsonUtils . unmarshalFromByte ( byt... |
public class VarSet { /** * Returns the member variable with the given name . */
public IVarDef getMember ( String name ) { } } | int i = findMember ( name ) ; return i >= 0 ? members_ . get ( i ) : null ; |
public class ConditionalCheck { /** * Ensures that a String argument is a number . This overload supports all subclasses of { @ code Number } . The number
* is first converted to a BigInteger
* @ param condition
* condition must be { @ code true } ^ so that the check will be performed
* @ param value
* value ... | IllegalNullArgumentException . class , IllegalNumberArgumentException . class } ) public static < T extends Number > void isNumber ( final boolean condition , @ Nonnull final String value , @ Nonnull final Class < T > type ) { if ( condition ) { Check . isNumber ( value , type ) ; } |
public class DataBlock { /** * < p > When Data Matrix Codes use multiple data blocks , they actually interleave the bytes of each of them .
* That is , the first byte of data block 1 to n is written , then the second bytes , and so on . This
* method will separate the data into original blocks . < / p >
* @ param... | // Figure out the number and size of data blocks used by this version
Version . ECBlocks ecBlocks = version . getECBlocks ( ) ; // First count the total number of data blocks
int totalBlocks = 0 ; Version . ECB [ ] ecBlockArray = ecBlocks . getECBlocks ( ) ; for ( Version . ECB ecBlock : ecBlockArray ) { totalBlocks +=... |
public class DataSet { /** * Creates a union of this DataSet with an other DataSet . The other DataSet must be of the same data type .
* @ param other The other DataSet which is unioned with the current DataSet .
* @ return The resulting DataSet . */
public UnionOperator < T > union ( DataSet < T > other ) { } } | return new UnionOperator < > ( this , other , Utils . getCallLocationName ( ) ) ; |
public class InternalAuthentication { /** * Returns a list of users matching the search .
* @ param search The search string to execute .
* @ return A list of usernames ( String ) that match the search .
* @ throws AuthenticationException if there was an error searching . */
@ Override public List < User > search... | // Complete list of users
String [ ] users = file_store . keySet ( ) . toArray ( new String [ file_store . size ( ) ] ) ; List < User > found = new ArrayList < User > ( ) ; // Look through the list for anyone who matches
for ( int i = 0 ; i < users . length ; i ++ ) { if ( users [ i ] . toLowerCase ( ) . contains ( sea... |
public class MapMetaReader { /** * read map files .
* @ param filename filename */
@ Override public void read ( final File filename ) { } } | filePath = filename ; // clear the history on global metadata table
globalMeta . clear ( ) ; super . read ( filename ) ; |
public class LandmarkStorage { /** * This method forces the landmark preparation to skip the landmark search and uses the specified landmark list instead .
* Useful for manual tuning of larger areas to safe import time or improve quality . */
public LandmarkStorage setLandmarkSuggestions ( List < LandmarkSuggestion >... | if ( landmarkSuggestions == null ) throw new IllegalArgumentException ( "landmark suggestions cannot be null" ) ; this . landmarkSuggestions = landmarkSuggestions ; return this ; |
public class AbstractAmazonSNSAsync { /** * Simplified method form for invoking the ListSubscriptionsByTopic operation with an AsyncHandler .
* @ see # listSubscriptionsByTopicAsync ( ListSubscriptionsByTopicRequest , com . amazonaws . handlers . AsyncHandler ) */
@ Override public java . util . concurrent . Future <... | return listSubscriptionsByTopicAsync ( new ListSubscriptionsByTopicRequest ( ) . withTopicArn ( topicArn ) , asyncHandler ) ; |
public class EnvironmentsInner { /** * Create or replace an existing Environment .
* @ param resourceGroupName The name of the resource group .
* @ param labAccountName The name of the lab Account .
* @ param labName The name of the lab .
* @ param environmentSettingName The name of the environment Setting .
... | return createOrUpdateWithServiceResponseAsync ( resourceGroupName , labAccountName , labName , environmentSettingName , environmentName , environment ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class DataExtractionProcessor { /** * Main method . Processes the whole dump using this processor . To change
* which dump file to use and whether to run in offline mode , modify the
* settings in { @ link ExampleHelpers } .
* @ param args
* @ throws IOException */
public static void main ( String [ ] ar... | ExampleHelpers . configureLogging ( ) ; DataExtractionProcessor . printDocumentation ( ) ; DataExtractionProcessor processor = new DataExtractionProcessor ( ) ; ExampleHelpers . processEntitiesFromWikidataDump ( processor ) ; processor . close ( ) ; |
public class ExpansionPointGroupMember { /** * Attempts to add the given member to this expansion point . The member will not be added if
* an equivalent entry ( according to its equals ( ) method ) already exists . If added , the member ' s
* { @ link GroupMember # onAdded ( ) } method will be called .
* @ param... | Assert . notNull ( member , "member" ) ; if ( members . add ( member ) ) { member . onAdded ( ) ; } |
public class ProfileContainer { /** * Override afterPaint to write the statistics after the component is painted .
* @ param renderContext the renderContext to send output to . */
@ Override protected void afterPaint ( final RenderContext renderContext ) { } } | super . afterPaint ( renderContext ) ; // UIC serialization stats
UicStats stats = new UicStats ( UIContextHolder . getCurrent ( ) ) ; stats . analyseWC ( this ) ; if ( renderContext instanceof WebXmlRenderContext ) { PrintWriter writer = ( ( WebXmlRenderContext ) renderContext ) . getWriter ( ) ; writer . println ( "<... |
public class br_broker { /** * < pre >
* Use this operation to get Unified Repeater Instance .
* < / pre > */
public static br_broker [ ] get ( nitro_service client ) throws Exception { } } | br_broker resource = new br_broker ( ) ; resource . validate ( "get" ) ; return ( br_broker [ ] ) resource . get_resources ( client ) ; |
public class DynamicReturnGeneratedKeys { /** * 检查DAO返回的类型是否合格
* @ param returnType DAO方法的返回类型 ( 如果方法声明的返回类型是泛型 , 框架会根据上下文信息解析为运行时实际应该返回的真正类型 )
* @ throws InvalidDataAccessApiUsageException DAO方法的返回类型不合格 */
public void checkMethodReturnType ( Class < ? > returnType , StatementMetaData metaData ) { } } | if ( returnType != void . class && ! Number . class . isAssignableFrom ( returnType ) ) { throw new InvalidDataAccessApiUsageException ( "error return type, only support int/long/double/float/void type for method with @ReturnGeneratedKeys:" + metaData . getMethod ( ) ) ; } |
public class XMLParser { /** * Reads an attribute list declaration such as the following : < ! ATTLIST foo
* bar CDATA # IMPLIED quux ( a | b | c ) " c " baz NOTATION ( a | b | c ) # FIXED " c " >
* Each attribute has a name , type and default .
* Types are one of the built - in types ( CDATA , ID , IDREF , IDREF... | read ( START_ATTLIST ) ; skip ( ) ; String elementName = readName ( ) ; while ( true ) { skip ( ) ; int c = peekCharacter ( ) ; if ( c == '>' ) { position ++ ; return ; } // attribute name
String attributeName = readName ( ) ; // attribute type
skip ( ) ; if ( position + 1 >= limit && ! fillBuffer ( 2 ) ) { throw new K... |
public class AttributesImplSerializer { /** * This method gets the index of an attribute given its qName .
* @ param qname the qualified name of the attribute , e . g . " prefix1 : locName1"
* @ return the integer index of the attribute .
* @ see org . xml . sax . Attributes # getIndex ( String ) */
public final ... | int index ; if ( super . getLength ( ) < MAX ) { // if we haven ' t got too many attributes let the
// super class look it up
index = super . getIndex ( qname ) ; return index ; } // we have too many attributes and the super class is slow
// so find it quickly using our Hashtable .
Integer i = ( Integer ) m_indexFromQN... |
public class Link { /** * Only used for dummy head @ param link */
final void _setAsHead ( LinkedList parent , Link tail ) { } } | _nextLink = tail ; _parent = parent ; _state = LinkState . HEAD ; |
public class JMFiles { /** * Gets line stream .
* @ param path the path
* @ param charset the charset
* @ return the line stream */
public static Stream < String > getLineStream ( Path path , Charset charset ) { } } | try { return charset == null ? Files . lines ( path ) : Files . lines ( path , charset ) ; } catch ( Exception e ) { return JMExceptionManager . handleExceptionAndReturn ( log , e , "getLineStream" , Stream :: empty , path , charset ) ; } |
public class JQMList { /** * Remove the divider with the given text . This method will search all the dividers and remove the first divider
* found with the given text .
* @ return true if a divider with the given text was found and removed , otherwise false . */
public boolean removeDivider ( String text ) { } } | for ( int k = 0 ; k < list . getWidgetCount ( ) ; k ++ ) { Widget w = list . getWidget ( k ) ; if ( isDivider ( w ) && w . getElement ( ) . getInnerText ( ) . equals ( text ) ) { list . remove ( k ) ; items . remove ( k ) ; return true ; } } return false ; |
public class CommercePriceListUserSegmentEntryRelPersistenceImpl { /** * Clears the cache for all commerce price list user segment entry rels .
* The { @ link EntityCache } and { @ link FinderCache } are both cleared by this method . */
@ Override public void clearCache ( ) { } } | entityCache . clearCache ( CommercePriceListUserSegmentEntryRelImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; |
public class HibernateDocumentDao { /** * { @ inheritDoc } */
public List < Execution > getSpecificationExecutions ( Specification specification , SystemUnderTest sut , int maxResults ) { } } | final Criteria crit = sessionService . getSession ( ) . createCriteria ( Execution . class ) ; crit . add ( Restrictions . eq ( "specification.id" , specification . getId ( ) ) ) ; if ( sut != null ) { crit . createAlias ( "systemUnderTest" , "sut" ) ; crit . add ( Restrictions . eq ( "sut.name" , sut . getName ( ) ) )... |
public class DisruptorQueue { /** * { @ inheritDoc }
* @ throws QueueException . EphemeralIsFull
* if the ephemeral storage is full */
@ Override public IQueueMessage < ID , DATA > take ( ) throws QueueException . EphemeralIsFull { } } | if ( ! isEphemeralDisabled ( ) ) { int ephemeralMaxSize = getEphemeralMaxSize ( ) ; if ( ephemeralMaxSize > 0 && ephemeralStorage . size ( ) >= ephemeralMaxSize ) { throw new QueueException . EphemeralIsFull ( ephemeralMaxSize ) ; } } IQueueMessage < ID , DATA > msg = takeFromRingBuffer ( ) ; if ( msg != null && ! isEp... |
public class AbstractAWSSigner { /** * Hashes the binary data using the SHA - 256 algorithm .
* @ param data
* The binary data to hash .
* @ return The hashed bytes from the specified data .
* @ throws SdkClientException
* If the hash cannot be computed . */
public byte [ ] hash ( byte [ ] data ) throws SdkCl... | try { MessageDigest md = getMessageDigestInstance ( ) ; md . update ( data ) ; return md . digest ( ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to compute hash while signing request: " + e . getMessage ( ) , e ) ; } |
public class JPAEntityManager { /** * ( non - Javadoc )
* @ see javax . persistence . EntityManager # createNamedQuery ( java . lang . String ) */
@ Override public Query createNamedQuery ( String name ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "em.createNamedQuery(" + name + ");\n" + toString ( ) ) ; return getEMInvocationInfo ( false ) . createNamedQuery ( name ) ; |
public class MessageBirdClient { /** * Retrieves the information of an existing contact . You only need to supply
* the unique contact ID that was returned upon creation or receiving . */
public Contact viewContact ( final String id ) throws NotFoundException , GeneralException , UnauthorizedException { } } | if ( id == null ) { throw new IllegalArgumentException ( "Contact ID must be specified." ) ; } return messageBirdService . requestByID ( CONTACTPATH , id , Contact . class ) ; |
public class DatabaseAdminClientSnippets { /** * [ VARIABLE my _ database _ id ] */
public void updateDatabaseDdl ( String instanceId , String databaseId ) { } } | // [ START updateDatabaseDdl ]
try { dbAdminClient . updateDatabaseDdl ( instanceId , databaseId , Arrays . asList ( "ALTER TABLE Albums ADD COLUMN MarketingBudget INT64" ) , null ) . get ( ) ; } catch ( ExecutionException e ) { throw ( SpannerException ) e . getCause ( ) ; } catch ( InterruptedException e ) { throw Sp... |
public class cachepolicylabel_stats { /** * Use this API to fetch statistics of cachepolicylabel _ stats resource of given name . */
public static cachepolicylabel_stats get ( nitro_service service , String labelname ) throws Exception { } } | cachepolicylabel_stats obj = new cachepolicylabel_stats ( ) ; obj . set_labelname ( labelname ) ; cachepolicylabel_stats response = ( cachepolicylabel_stats ) obj . stat_resource ( service ) ; return response ; |
public class GoogleAdapter { /** * Return the current user profile . */
public UserProfile fetchUserProfile ( final Google google ) { } } | final UserInfo userInfo = google . oauth2Operations ( ) . getUserinfo ( ) ; return new UserProfileBuilder ( ) . setUsername ( userInfo . getId ( ) ) . setId ( userInfo . getId ( ) ) . setEmail ( userInfo . getEmail ( ) ) . setName ( userInfo . getName ( ) ) . setFirstName ( userInfo . getGivenName ( ) ) . setLastName (... |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcDocumentInformationRelationship ( ) { } } | if ( ifcDocumentInformationRelationshipEClass == null ) { ifcDocumentInformationRelationshipEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 190 ) ; } return ifcDocumentInformationRelationshipEClass ; |
public class SimpleQueueSpecificationGenerator { /** * Given a { @ link FlowSpecification } .
* @ param input { @ link FlowSpecification }
* @ return A { @ link com . google . common . collect . Table } */
@ Override public Table < Node , String , Set < QueueSpecification > > create ( FlowSpecification input ) { } ... | Table < Node , String , Set < QueueSpecification > > table = HashBasedTable . create ( ) ; String flow = input . getName ( ) ; Map < String , FlowletDefinition > flowlets = input . getFlowlets ( ) ; // Iterate through connections of a flow .
for ( FlowletConnection connection : input . getConnections ( ) ) { final Stri... |
public class TimeFilter { /** * Returns the type of the time filter .
* @ return */
public TimeFrameFilterType getType ( ) { } } | if ( startDate == null && endDate == null ) { return TimeFrameFilterType . INOPERATIVE ; } else if ( startDate != null && endDate == null ) { return TimeFrameFilterType . MIN_DATE ; } else if ( startDate == null && endDate != null ) { return TimeFrameFilterType . MAX_DATE ; } else { return TimeFrameFilterType . TIMEFRA... |
public class AbstractBatcher { /** * { @ inheritDoc } */
@ Override public final boolean addOrWait ( T item ) throws InterruptedException { } } | requireNonNull ( item ) ; checkState ( ! isClosed , "The batcher has been closed" ) ; backingQueue . put ( item ) ; return true ; |
public class JsJmsStreamMessageImpl { /** * Write a byte value into the payload Stream .
* Javadoc description supplied by JsJmsMessage interface . */
public void writeByte ( byte value ) throws UnsupportedEncodingException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "writeByte" , Byte . valueOf ( value ) ) ; getBodyList ( ) . add ( Byte . valueOf ( value ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "writeByte" ) ; |
public class ZipkinQueryApiV2 { /** * This is inlined here as there isn ' t enough re - use to warrant it being in the zipkin2 library */
static byte [ ] writeTraces ( SpanBytesEncoder codec , List < List < zipkin2 . Span > > traces ) { } } | // Get the encoded size of the nested list so that we don ' t need to grow the buffer
int length = traces . size ( ) ; int sizeInBytes = 2 ; if ( length > 1 ) sizeInBytes += length - 1 ; // comma to join elements
for ( int i = 0 ; i < length ; i ++ ) { List < zipkin2 . Span > spans = traces . get ( i ) ; int jLength = ... |
public class JmsDestinationImpl { /** * Static method that allows a replyTo destination to be obtained from a JsJmsMessage ,
* a ReverseRoutingPath and an optional JMS Core Connection object .
* @ param _ msg CoreSPI message for which the JMS replyTo dest should be generated
* @ param rrp Reverse routing path of ... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getJMSReplyToInternal" , new Object [ ] { _msg , rrp , _siConn } ) ; JmsDestinationImpl tempReplyTo = null ; // Case a ) - check for JMS specific data in compressed byte form .
byte [ ] replyURIBytes = _msg . getJmsReplyTo ... |
public class HashOrderMixing { /** * A constant { @ link HashOrderMixingStrategy } . This is useful if one needs to have
* deterministic key distribution but wishes to control it manually .
* Do not use the same constant for more than one container .
* Consider using { @ linkplain ObjectScatterSet scatter maps or... | return new HashOrderMixingStrategy ( ) { @ Override public int newKeyMixer ( int newContainerBufferSize ) { return ( int ) BitMixer . mix64 ( newContainerBufferSize ^ seed ) ; } @ Override public HashOrderMixingStrategy clone ( ) { return this ; } } ; |
public class DataSiftPush { /** * Create a push subscription to be consumed via { @ link # pull ( PushSubscription , int , String ) } using a live stream
* @ param historics the historic query which will be consumed via pull
* @ param name a name for the subscription
* @ param initialStatus the initial status of ... | return createPull ( jsonMeta , historics , null , name , initialStatus , start , end ) ; |
public class JavassistUtils { /** * Checks if an annotation with the given name is either in the invisible or in the visible annotation attributes . */
private static boolean checkAnnotation ( AnnotationsAttribute invisible , AnnotationsAttribute visible , String annotationName ) { } } | boolean exist1 = false ; boolean exist2 = false ; if ( invisible != null ) { exist1 = invisible . getAnnotation ( annotationName ) != null ; } if ( visible != null ) { exist2 = visible . getAnnotation ( annotationName ) != null ; } return exist1 || exist2 ; |
public class HSlicePredicate { /** * Set the columnName on which we will end .
* Switches to { @ link PredicateType # Range } */
public HSlicePredicate < N > setEndOn ( N finish ) { } } | this . finish = finish ; predicateType = PredicateType . Range ; return this ; |
public class VideoMultipleWrapper { /** * Set the maximum number to be selected .
* @ param count the maximum number . */
public VideoMultipleWrapper selectCount ( @ IntRange ( from = 1 , to = Integer . MAX_VALUE ) int count ) { } } | this . mLimitCount = count ; return this ; |
public class HttpServletRaSessionListener { /** * ( non - Javadoc )
* @ see javax . servlet . http . HttpSessionListener # sessionCreated ( javax . servlet . http . HttpSessionEvent ) */
public void sessionCreated ( HttpSessionEvent httpSessionEvent ) { } } | if ( active ) { if ( log . isDebugEnabled ( ) ) log . debug ( "sessionCreated sessionId = " + httpSessionEvent . getSession ( ) . getId ( ) ) ; } |
public class FrontUtils { /** * Given a front , converts it to a Solution set of PointSolutions
* @ param front
* @ return A front as a List < FrontSolution > */
public static List < PointSolution > convertFrontToSolutionList ( Front front ) { } } | if ( front == null ) { throw new NullFrontException ( ) ; } int numberOfObjectives ; int solutionSetSize = front . getNumberOfPoints ( ) ; if ( front . getNumberOfPoints ( ) == 0 ) { numberOfObjectives = 0 ; } else { numberOfObjectives = front . getPoint ( 0 ) . getDimension ( ) ; } List < PointSolution > solutionSet =... |
public class Crouton { /** * Creates a { @ link Crouton } with provided text - resource and style for a given
* activity .
* @ param activity
* The { @ link Activity } that represents the context in which the Crouton should exist .
* @ param customView
* The custom { @ link View } to display
* @ param viewG... | return new Crouton ( activity , customView , viewGroup ) ; |
public class Maybe { /** * { @ inheritDoc } */
@ SuppressWarnings ( "RedundantTypeArguments" ) @ Override public final < B > Maybe < B > flatMap ( Function < ? super A , ? extends Monad < B , Maybe < ? > > > f ) { } } | return match ( constantly ( nothing ( ) ) , f . andThen ( Monad < B , Maybe < ? > > :: coerce ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.