signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ObservableDataBuilder { /** * Each emission of this observable appends to the elements of the data . */
@ NonNull public ObservableDataBuilder < T > appends ( @ Nullable Observable < ? extends Collection < ? extends T > > appends ) { } } | mAppends = appends ; return this ; |
public class Matrix4x3d { /** * Set this matrix to a model transformation for a right - handed coordinate system ,
* that aligns the local < code > - z < / code > axis with < code > dir < / code > .
* In order to apply the rotation transformation to a previous existing transformation ,
* use { @ link # rotateTowa... | return rotationTowards ( dir . x ( ) , dir . y ( ) , dir . z ( ) , up . x ( ) , up . y ( ) , up . z ( ) ) ; |
public class AbstractService { /** * test node existence at path
* @ param session the session
* @ param path the path
* @ return whether T exists at the given path */
public boolean exists ( final FedoraSession session , final String path ) { } } | final Session jcrSession = getJcrSession ( session ) ; try { return jcrSession . nodeExists ( path ) ; } catch ( final RepositoryException e ) { throw new RepositoryRuntimeException ( e ) ; } |
public class MOEADD { /** * find the index of the solution ' indiv ' in the population */
public int findPosition ( S indiv ) { } } | for ( int i = 0 ; i < populationSize ; i ++ ) { if ( indiv . equals ( population . get ( i ) ) ) { return i ; } } return - 1 ; |
public class BasicWriter { /** * { @ inheritDoc } */
@ SuppressWarnings ( "unchecked" ) @ Override public void write ( Record record ) throws IOException , InterruptedException { } } | if ( record . isKeyEmpty ( ) ) { defaultRecord . getKey ( ) . getSort ( ) . clear ( ) ; record . setKey ( defaultRecord . getKey ( ) ) ; } else { if ( record . getKey ( ) . isGroupingEmpty ( ) && ! record . getKey ( ) . isSortEmpty ( ) ) { record . getKey ( ) . setGrouping ( defaultRecord . getKey ( ) . getGrouping ( )... |
public class CacheHandler { /** * 生成缓存KeyTO
* @ param target 类名
* @ param methodName 方法名
* @ param arguments 参数
* @ param keyExpression key表达式
* @ param hfieldExpression hfield表达式
* @ param result 执行实际方法的返回值
* @ return CacheKeyTO */
public CacheKeyTO getCacheKey ( Object target , String methodName , Objec... | String key = null ; String hfield = null ; if ( null != keyExpression && keyExpression . trim ( ) . length ( ) > 0 ) { try { key = scriptParser . getDefinedCacheKey ( keyExpression , target , arguments , result , hasRetVal ) ; if ( null != hfieldExpression && hfieldExpression . trim ( ) . length ( ) > 0 ) { hfield = sc... |
public class LFltIntConsumerBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static LFltIntConsumer fltIntConsumerFrom ( Consumer < LFltIntConsumerBuilder > buildingFunction ) { } } | LFltIntConsumerBuilder builder = new LFltIntConsumerBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class NioSocketConnectorEx { /** * { @ inheritDoc } */
@ Override protected NioSessionEx newSession ( IoProcessor < NioSessionEx > processor , SocketChannel handle ) { } } | final NioSocketSessionEx nioSocketSession = new NioSocketSessionEx ( this , processor , handle ) ; // NB : We do not catch the RuntimeIoException for this
// call because catching one and returning null leads to NPE .
nioSocketSession . initSessionConfig ( ) ; return nioSocketSession ; |
public class Utilities { /** * Unescapes an URL . All the " % xx " are replaced by the ' xx ' hex char value .
* @ param src the url to unescape
* @ return the unescaped value */
public static String unEscapeURL ( String src ) { } } | StringBuffer bf = new StringBuffer ( ) ; char [ ] s = src . toCharArray ( ) ; for ( int k = 0 ; k < s . length ; ++ k ) { char c = s [ k ] ; if ( c == '%' ) { if ( k + 2 >= s . length ) { bf . append ( c ) ; continue ; } int a0 = PRTokeniser . getHex ( s [ k + 1 ] ) ; int a1 = PRTokeniser . getHex ( s [ k + 2 ] ) ; if ... |
public class AsteriskQueueImpl { /** * Notifies all registered listener that an entry joins the queue .
* @ param entry that joins the queue */
void fireNewEntry ( AsteriskQueueEntryImpl entry ) { } } | synchronized ( listeners ) { for ( AsteriskQueueListener listener : listeners ) { try { listener . onNewEntry ( entry ) ; } catch ( Exception e ) { logger . warn ( "Exception in onNewEntry()" , e ) ; } } } |
public class ArrayDeque { /** * Inserts the specified element at the front of this deque .
* @ param e the element to add
* @ throws NullPointerException if the specified element is null */
public void addFirst ( E e ) { } } | if ( e == null ) throw new NullPointerException ( ) ; elements [ head = ( head - 1 ) & ( elements . length - 1 ) ] = e ; if ( head == tail ) doubleCapacity ( ) ; |
public class BooleanOperation { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div >
* < div color = ' red ' style = " font - size : 18px ; color : red " > < i > less than or equal < / i > < / div >
* < br / > */
public < E > Terminal... | getPredicateExpression ( ) . setOperator ( Operator . LTE ) ; getPredicateExpression ( ) . setValue_2 ( value ) ; TerminalResult ret = APIAccess . createTerminalResult ( this . getPredicateExpression ( ) ) ; QueryRecorder . recordInvocation ( this , "LTE" , ret , QueryRecorder . placeHolder ( value ) ) ; return ret ; |
public class MarkLogicRepositoryConnection { /** * overload for prepareUpdate
* @ param queryString
* @ param baseURI
* @ return MarkLogicUpdateQuery
* @ throws RepositoryException
* @ throws MalformedQueryException */
@ Override public MarkLogicUpdateQuery prepareUpdate ( String queryString , String baseURI ... | return prepareUpdate ( QueryLanguage . SPARQL , queryString , baseURI ) ; |
public class QValueParser { /** * Parses a set of headers that take q values to determine the most preferred one .
* It returns the result in the form of a sorted list of list , with every element in
* the list having the same q value . This means the highest priority items are at the
* front of the list . The co... | final List < QValueResult > found = new ArrayList < > ( ) ; QValueResult current = null ; for ( final String header : headers ) { final int l = header . length ( ) ; // we do not use a string builder
// we just keep track of where the current string starts and call substring ( )
int stringStart = 0 ; for ( int i = 0 ; ... |
public class StringUtil { /** * Replaces each substring of this string that matches the given
* regular expression with the given pReplacement .
* An invocation of this method of the form
* < tt > replaceAll ( < i > str < / i > , < i > pRegex < / i > , < i > repl < / i > < ) < / tt >
* yields exactly the same r... | return Pattern . compile ( pRegex ) . matcher ( pString ) . replaceAll ( pReplacement ) ; |
public class Attributes { /** * Get the HTML representation of these attributes .
* @ return HTML
* @ throws SerializationException if the HTML representation of the attributes cannot be constructed . */
public String html ( ) { } } | StringBuilder sb = StringUtil . borrowBuilder ( ) ; try { html ( sb , ( new Document ( "" ) ) . outputSettings ( ) ) ; // output settings a bit funky , but this html ( ) seldom used
} catch ( IOException e ) { // ought never happen
throw new SerializationException ( e ) ; } return StringUtil . releaseBuilder ( sb ) ; |
public class AsyncContextImpl { /** * End : PM90834 */
@ Override public synchronized Collection < WrapperRunnable > getAndClearStartRunnables ( ) { } } | if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) { logger . entering ( CLASS_NAME , "getAndClearStartRunnables" , this ) ; } // set the pointer to null so that the remove cannot remove an Runnable
// in the middle of traversing over the list .
Collection ... |
public class CmsVfsSitemapService { /** * Un - deletes a resource according to the change data . < p >
* @ param change the change data
* @ return the changed entry or < code > null < / code >
* @ throws CmsException if something goes wrong */
private CmsSitemapChange undelete ( CmsSitemapChange change ) throws C... | CmsObject cms = getCmsObject ( ) ; CmsResource deleted = cms . readResource ( change . getEntryId ( ) , CmsResourceFilter . ALL ) ; if ( deleted . getState ( ) . isDeleted ( ) ) { ensureLock ( deleted ) ; cms . undeleteResource ( getCmsObject ( ) . getSitePath ( deleted ) , true ) ; tryUnlock ( deleted ) ; } String par... |
public class SparseIntArray { /** * Sets the value of the index to the value using the Java primitives
* without auto - boxing . if { @ code value } is 0 , and the value at { @ code
* index } is already zero , this will be a no - op . */
public void setPrimitive ( int index , int value ) { } } | int pos = Arrays . binarySearch ( indices , index ) ; if ( value != 0 ) { // need to make room in the indices array
if ( pos < 0 ) { int newPos = 0 - ( pos + 1 ) ; int [ ] newIndices = new int [ indices . length + 1 ] ; int [ ] newValues = new int [ values . length + 1 ] ; // copy the existing array contents that are v... |
public class Grid { /** * / * package */
synchronized Key < Model > putModel ( long checksum , Key < Model > modelKey ) { } } | return _models . put ( IcedLong . valueOf ( checksum ) , modelKey ) ; |
public class AWSCodePipelineClient { /** * Gets a summary of the most recent executions for a pipeline .
* @ param listPipelineExecutionsRequest
* Represents the input of a ListPipelineExecutions action .
* @ return Result of the ListPipelineExecutions operation returned by the service .
* @ throws ValidationEx... | request = beforeClientExecution ( request ) ; return executeListPipelineExecutions ( request ) ; |
public class CertificatesImpl { /** * Gets information about the specified certificate .
* @ param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter . This must be sha1.
* @ param thumbprint The thumbprint of the certificate to get .
* @ throws IllegalArgumentException thrown if parameters... | return getWithServiceResponseAsync ( thumbprintAlgorithm , thumbprint ) . map ( new Func1 < ServiceResponseWithHeaders < Certificate , CertificateGetHeaders > , Certificate > ( ) { @ Override public Certificate call ( ServiceResponseWithHeaders < Certificate , CertificateGetHeaders > response ) { return response . body... |
public class Xsd2AvroTranslatorMain { /** * Make sure mandatory parameters have default values . */
private void setDefaults ( ) { } } | if ( xsdInput == null ) { setXsdInput ( DEFAULT_INPUT_FOLDER_PATH ) ; } if ( output == null ) { setOutput ( DEFAULT_OUTPUT_FOLDER_PATH ) ; } if ( avroNamespacePrefix == null ) { setAvroNamespacePrefix ( DEFAULT_AVRO_NAMESPACE_PREFIX ) ; } |
public class LinearGeometry { /** * Returns the points composing this Geometry .
* @ return { @ code Iterable < Point > } a Guava lazy Iterable . */
public List < Point > points ( ) { } } | return positions ( ) . children ( ) . stream ( ) . map ( Point :: new ) . collect ( Collectors . toList ( ) ) ; |
public class ByteArrayList { /** * Adds the specified { @ link ByteArray } to
* the beginning of the list
* @ param ba
* The ByteArray to be added to the list */
public void addFirst ( ByteArray ba ) { } } | addNode ( new Node ( ba ) , header . next ) ; firstByte -= ba . last ( ) ; |
public class TypeLexer { /** * $ ANTLR start " ENDTYPEPARAM " */
public final void mENDTYPEPARAM ( ) throws RecognitionException { } } | try { int _type = ENDTYPEPARAM ; int _channel = DEFAULT_TOKEN_CHANNEL ; // org / javaruntype / type / parser / Type . g : 33:14 : ( ' > ' )
// org / javaruntype / type / parser / Type . g : 33:16 : ' > '
{ match ( '>' ) ; } state . type = _type ; state . channel = _channel ; } finally { } |
public class Ingest { /** * Print error message and show usage for command - line interface . */
public static void badArgs ( String msg ) { } } | System . err . println ( "Command: fedora-ingest" ) ; System . err . println ( ) ; System . err . println ( "Summary: Ingests one or more objects into a Fedora repository, from either" ) ; System . err . println ( " the local filesystem or another Fedora repository." ) ; System . err . println ( ) ; System . er... |
public class NonObservingFSJobCatalog { /** * Allow user to programmatically add a new JobSpec .
* The method will materialized the jobSpec into real file .
* @ param jobSpec The target JobSpec Object to be materialized .
* Noted that the URI return by getUri is a relative path . */
@ Override public synchronized... | Preconditions . checkState ( state ( ) == State . RUNNING , String . format ( "%s is not running." , this . getClass ( ) . getName ( ) ) ) ; Preconditions . checkNotNull ( jobSpec ) ; try { long startTime = System . currentTimeMillis ( ) ; Path jobSpecPath = getPathForURI ( this . jobConfDirPath , jobSpec . getUri ( ) ... |
public class ToggleCommand { /** * Set the selection state of the command . */
public final void setSelected ( boolean selected ) { } } | if ( isExclusiveGroupMember ( ) ) { boolean oldState = isSelected ( ) ; exclusiveController . handleSelectionRequest ( this , selected ) ; // set back button state if controller didn ' t change this command ;
// needed b / c of natural button check box toggling in swing
if ( oldState == isSelected ( ) ) { Iterator iter... |
public class ManagedInstancesInner { /** * Creates or updates a managed instance .
* @ 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 managedInstanceName The name of the managed instance .
... | return createOrUpdateWithServiceResponseAsync ( resourceGroupName , managedInstanceName , parameters ) . map ( new Func1 < ServiceResponse < ManagedInstanceInner > , ManagedInstanceInner > ( ) { @ Override public ManagedInstanceInner call ( ServiceResponse < ManagedInstanceInner > response ) { return response . body ( ... |
public class AWSElasticBeanstalkClient { /** * Updates the specified configuration template to have the specified properties or configuration option values .
* < note >
* If a property ( for example , < code > ApplicationName < / code > ) is not provided , its value remains unchanged . To clear
* such properties ... | request = beforeClientExecution ( request ) ; return executeUpdateConfigurationTemplate ( request ) ; |
public class QueueReferenceMarshaller { /** * Marshall the given parameter object . */
public void marshall ( QueueReference queueReference , ProtocolMarshaller protocolMarshaller ) { } } | if ( queueReference == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( queueReference . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( queueReference . getArn ( ) , ARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientExc... |
public class SearchExpression { /** * A list of nested filter objects .
* @ param nestedFilters
* A list of nested filter objects . */
public void setNestedFilters ( java . util . Collection < NestedFilters > nestedFilters ) { } } | if ( nestedFilters == null ) { this . nestedFilters = null ; return ; } this . nestedFilters = new java . util . ArrayList < NestedFilters > ( nestedFilters ) ; |
public class Value { /** * Tests if this value is older than the specified SetElement .
* @ param other the value to be compared
* @ return true if this value is older than other */
public boolean isOlderThan ( Value other ) { } } | if ( other == null ) { return true ; } return this . timestamp . isOlderThan ( other . timestamp ) ; |
public class DocBookUtilities { /** * Finds the first title element in a DocBook XML file .
* @ param doc The docbook xml transformed into a DOM Document to find the title from .
* @ return The first title found in the xml . */
public static String findTitle ( final Document doc ) { } } | if ( doc == null ) return null ; // loop through the child nodes until the title element is found
final NodeList childNodes = doc . getDocumentElement ( ) . getChildNodes ( ) ; for ( int i = 0 ; i < childNodes . getLength ( ) ; i ++ ) { Node node = childNodes . item ( i ) ; // check if the node is the title and if its ... |
public class GlobusPathMatchingResourcePatternResolver { /** * Returns a substring of the locationPattern from the beginning
* to the first occurrence of * or ?
* If this is unsuccessful , start at current directory . /
* @ param locationPatternString The Ant - Style location pattern .
* @ return A substring of... | String currentLocationPatternString ; int locationPatternStringLength = locationPatternString . length ( ) ; // Find the first occurrence of * or ? , if none , set idx to locationPatternLength
int startIndex , questionMarkIndex ; if ( ( startIndex = locationPatternString . indexOf ( '*' ) ) == - 1 ) startIndex = locati... |
public class QuerySqlTranslator { /** * Checks for the existence of an operator in a query clause list */
protected static boolean isOperatorFoundInClause ( String operator , List < Object > clause ) { } } | boolean found = false ; // first check for the existence of $ not so that we can find negated operators :
// if we find $ not then recurse with the value associated with it in the query map
for ( Object rawTerm : clause ) { if ( rawTerm instanceof Map ) { Map term = ( Map ) rawTerm ; if ( term . size ( ) == 1 && term .... |
public class CmsTool { /** * Returns the necessary html code for a link to this tool . < p >
* @ param wp the jsp page to write the code to
* @ return html code */
public String buttonHtml ( CmsWorkplace wp ) { } } | if ( ! m_handler . isVisible ( wp ) ) { return "" ; } String link = CmsToolManager . linkForToolPath ( wp . getJsp ( ) , getHandler ( ) . getPath ( ) , getHandler ( ) . getParameters ( wp ) ) ; String onClic = "openPage('" + link + "');" ; return A_CmsHtmlIconButton . defaultButtonHtml ( CmsHtmlIconButtonStyleEnum . BI... |
public class BootstrapMojo { /** * Interactively ask the user which sql conf should be used . */
private void chooseSampleSqlAndConf ( BufferedReader br ) throws IOException { } } | while ( true ) { printInstruction ( "Which sample SQL schema would you like to use?" ) ; for ( int i = 0 ; i < getSqlConfInfos ( ) . size ( ) ; i ++ ) { System . out . println ( " " + ( i + 1 ) + ") " + getSqlConfInfos ( ) . get ( i ) . getName ( ) ) ; System . out . println ( " " + getSqlConfInfos ( ) . get ( i ) .... |
public class ArchiveBase { /** * { @ inheritDoc }
* @ see org . jboss . shrinkwrap . api . Archive # add ( java . lang . String , org . jboss . shrinkwrap . api . asset . Asset ) */
@ Override public T add ( final Asset asset , final String target ) throws IllegalArgumentException { } } | // Precondition checks
Validate . notNullOrEmpty ( target , "target must be specified" ) ; Validate . notNull ( asset , "asset must be specified" ) ; // Make a Path from the target
final ArchivePath path = new BasicPath ( target ) ; // Delegate
return this . add ( asset , path ) ; |
public class LifecycleEventHandlers { /** * 懒加载 , 并发安全的 */
public static void loadLifecycleHandlers ( ) { } } | if ( ! loadedLock . get ( ) ) { synchronized ( loadedLock ) { if ( ! loadedLock . get ( ) ) { Set < Class < ? extends LifecycleHandler > > subClasses = Reflection . getNonAbstractSubclasses ( LifecycleHandler . class ) ; for ( Class < ? extends LifecycleHandler > clazz : subClasses ) { if ( clazz . isAnnotationPresent ... |
public class VelocityEngineFactory { /** * Prepare the VelocityEngine instance and return it .
* @ return the VelocityEngine instance
* @ throws IOException if the config file wasn ' t found
* @ throws VelocityException on Velocity initialization failure */
public VelocityEngine createVelocityEngine ( ) throws IO... | VelocityEngine velocityEngine = newVelocityEngine ( ) ; Map < String , Object > props = new HashMap < String , Object > ( ) ; // Load config file if set .
if ( this . configLocation != null ) { if ( logger . isInfoEnabled ( ) ) { logger . info ( "Loading Velocity config from [" + this . configLocation + "]" ) ; } Colle... |
public class ModeSDecoder { /** * Clean state by removing decoders not used for more than an hour . This happens automatically
* every 1 Mio messages if more than 50000 aircraft are tracked . */
public void gc ( ) { } } | List < Integer > toRemove = new ArrayList < Integer > ( ) ; for ( Integer transponder : decoderData . keySet ( ) ) if ( decoderData . get ( transponder ) . posDec . getLastUsedTime ( ) < latestTimestamp - 3600000 ) toRemove . add ( transponder ) ; for ( Integer transponder : toRemove ) decoderData . remove ( transponde... |
public class ReferenceIndividualGroupService { /** * Returns an < code > IGroupMember < / code > representing either a group or a portal entity , based on
* the < code > EntityIdentifier < / code > , which refers to the UNDERLYING entity for the < code >
* IGroupMember < / code > . */
@ Override public IGroupMember... | return getGroupMember ( underlyingEntityIdentifier . getKey ( ) , underlyingEntityIdentifier . getType ( ) ) ; |
public class Scope { /** * Return the server instance connected to this scope .
* @ return the server instance */
public IServer getServer ( ) { } } | if ( hasParent ( ) ) { final IScope parent = getParent ( ) ; if ( parent instanceof Scope ) { return ( ( Scope ) parent ) . getServer ( ) ; } else if ( parent instanceof IGlobalScope ) { return ( ( IGlobalScope ) parent ) . getServer ( ) ; } } return null ; |
public class AWSGlueClient { /** * Retrieves a list of connection definitions from the Data Catalog .
* @ param getConnectionsRequest
* @ return Result of the GetConnections operation returned by the service .
* @ throws EntityNotFoundException
* A specified entity does not exist
* @ throws OperationTimeoutEx... | request = beforeClientExecution ( request ) ; return executeGetConnections ( request ) ; |
public class Interface { /** * Use this API to update Interface resources . */
public static base_responses update ( nitro_service client , Interface resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { Interface updateresources [ ] = new Interface [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { updateresources [ i ] = new Interface ( ) ; updateresources [ i ] . id = resources [ i ] . id ; updateresources [... |
public class KAMStoreImpl { /** * { @ inheritDoc } */
@ Override public int coalesceKamEdges ( KamInfo info ) { } } | try { KAMUpdateDao updateDao = kamUpdateDao ( info ) ; return updateDao . coalesceKamEdges ( ) ; } catch ( SQLException e ) { final String msg = "error coalescing edges" ; throw new KAMStoreException ( msg , e ) ; } |
public class TagCrawler { /** * Method to get { @ link TagHandler } by tag , can be overridden to change the logic of handler searching
* @ param tag
* - tag to be handled
* @ return - this for chaining */
public TagHandler getHandler ( Tag tag ) { } } | if ( handlers . containsKey ( tag . getName ( ) ) ) { return handlers . get ( tag . getName ( ) ) ; } return null ; |
public class JsApiHdrsImpl { /** * Get the contents of the ApiMessageId field from the message header .
* Javadoc description supplied by JsApiMessage interface . */
public final String getApiMessageId ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getApiMessageId" ) ; String value = null ; /* The ApiMessageId is held as hexBinary & so we need to convert to an */
/* ID : xxxx format . */
byte [ ] binValue = ( byte [ ] ) getApi ( ) . getField ( JsApiAccess . MES... |
public class VodClient { /** * get media source download url .
* @ param mediaId The unique ID for each media resource
* @ param expiredInSeconds The expire time
* @ return */
public GetMediaSourceDownloadResponse getMediaSourceDownload ( String mediaId , long expiredInSeconds ) { } } | GetMediaSourceDownloadRequest request = new GetMediaSourceDownloadRequest ( ) . withMediaId ( mediaId ) . withExpiredInSeconds ( expiredInSeconds ) ; return getMediaSourceDownload ( request ) ; |
public class PlainTimestamp { /** * / * [ deutsch ]
* < p > Definiert eine nat & uuml ; rliche Ordnung , die auf der zeitlichen
* Position basiert . < / p >
* < p > Der Vergleich ist konsistent mit { @ code equals ( ) } . < / p >
* @ see # isBefore ( PlainTimestamp )
* @ see # isAfter ( PlainTimestamp ) */
@ ... | if ( this . date . isAfter ( timestamp . date ) ) { return 1 ; } else if ( this . date . isBefore ( timestamp . date ) ) { return - 1 ; } return this . time . compareTo ( timestamp . time ) ; |
public class CryptoUtils { /** * Returns true if it ' s a password match , that is , if the hashed clear password equals the given hash .
* @ param hashedPswdAndSalt the hashed password + { @ link # PASSWORD _ SEP } + salt , as returned by
* { @ link # hashPassword ( String ) }
* @ param clearPswd the password th... | if ( StringUtils . isNotEmpty ( hashedPswdAndSalt ) && StringUtils . isNotEmpty ( clearPswd ) ) { int idxOfSep = hashedPswdAndSalt . indexOf ( PASSWORD_SEP ) ; String storedHash = hashedPswdAndSalt . substring ( 0 , idxOfSep ) ; String salt = hashedPswdAndSalt . substring ( idxOfSep + 1 ) ; SimpleDigest digest = new Si... |
public class FastAdapterDiffUtil { /** * This method will compute a { @ link androidx . recyclerview . widget . DiffUtil . DiffResult } based on the given adapter , and the list of new items .
* It automatically collapses all expandables ( if enabled ) as they are not supported by the diff util ,
* pre sort the ite... | if ( adapter . isUseIdDistributor ( ) ) { adapter . getIdDistributor ( ) . checkIds ( items ) ; } // The FastAdapterDiffUtil does not handle expanded items . Call collapse if possible
collapseIfPossible ( adapter . getFastAdapter ( ) ) ; // if we have a comparator then sort
if ( adapter . getItemList ( ) instanceof Com... |
public class ListBackupSelectionsResult { /** * An array of backup selection list items containing metadata about each resource in the list .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setBackupSelectionsList ( java . util . Collection ) } or { @ link # ... | if ( this . backupSelectionsList == null ) { setBackupSelectionsList ( new java . util . ArrayList < BackupSelectionsListMember > ( backupSelectionsList . length ) ) ; } for ( BackupSelectionsListMember ele : backupSelectionsList ) { this . backupSelectionsList . add ( ele ) ; } return this ; |
public class InternalService { /** * Returns observable to add a list of participants to a conversation .
* @ param conversationId ID of a conversation to update .
* @ param participants New conversation participants details .
* @ return Observable to add participants to a conversation . */
public Observable < Co... | final String token = getToken ( ) ; if ( sessionController . isCreatingSession ( ) ) { return getTaskQueue ( ) . queueAddParticipants ( conversationId , participants ) ; } else if ( TextUtils . isEmpty ( token ) ) { return Observable . error ( getSessionStateErrorDescription ( ) ) ; } else { return doAddParticipants ( ... |
public class Resty { /** * Create a content object from a JSON object . Use this to POST the content to a URL .
* @ param someJson
* the JSON object to use
* @ return the content to send */
public static Content content ( JSONObject someJson ) { } } | Content c = null ; try { c = new Content ( "application/json; charset=UTF-8" , someJson . toString ( ) . getBytes ( "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { /* UTF - 8 is never unsupported */
} return c ; |
public class Rule { /** * Gets the ruleType value for this Rule .
* @ return ruleType * Rule type is used to determine how to group rule item groups
* and rule items inside rule item
* group . Currently , conjunctive normal form ( AND of
* ORs ) is only supported for
* ExpressionRuleUserList . If no ruleType ... | return ruleType ; |
public class Matrix { /** * Alters the matrix < i > A < / i > so that it contains the result of < i > A < / i >
* times a sparse matrix represented by only its diagonal values or
* < i > A = A * diag ( < b > b < / b > ) < / i > . This is equivalent to the code
* < code >
* A = A { @ link # multiply ( jsat . lin... | if ( A . cols ( ) != b . length ( ) ) throw new ArithmeticException ( "Could not multiply, matrix dimensions must agree" ) ; for ( int i = 0 ; i < A . rows ( ) ; i ++ ) RowColumnOps . multRow ( A , i , b ) ; |
public class ProjectApi { /** * Get a Stream of projects that were forked from the specified project .
* < pre > < code > GET / projects / : id / forks < / code > < / pre >
* @ param projectIdOrPath projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance , required
* @... | return ( getForks ( projectIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; |
public class Jenkins { /** * Reloads the configuration . */
@ RequirePOST public synchronized HttpResponse doReload ( ) throws IOException { } } | checkPermission ( ADMINISTER ) ; LOGGER . log ( Level . WARNING , "Reloading Jenkins as requested by {0}" , getAuthentication ( ) . getName ( ) ) ; // engage " loading . . . " UI and then run the actual task in a separate thread
WebApp . get ( servletContext ) . setApp ( new HudsonIsLoading ( ) ) ; new Thread ( "Jenkin... |
public class DataStream { /** * Extracts a timestamp from an element and assigns it as the internal timestamp of that element .
* The internal timestamps are , for example , used to to event - time window operations .
* < p > If you know that the timestamps are strictly increasing you can use an
* { @ link Ascend... | // match parallelism to input , otherwise dop = 1 sources could lead to some strange
// behaviour : the watermark will creep along very slowly because the elements
// from the source go to each extraction operator round robin .
int inputParallelism = getTransformation ( ) . getParallelism ( ) ; ExtractTimestampsOperato... |
public class StringFieldBuilder { /** * Add a sub - field . A { @ code SortedMap } is required for consistency of the index settings hash . */
private T addSubField ( String fieldName , SortedMap < String , String > fieldDefinition ) { } } | subFields . put ( fieldName , fieldDefinition ) ; return castThis ( ) ; |
public class PathNormalizer { /** * converts a generation path ( such as jar : / some / path / file ) into a request
* path that the request handler can understand and process .
* @ param path
* the path
* @ param registry
* the generator registry
* @ param randomParam
* the random parameter
* @ return ... | String requestPath = null ; try { requestPath = registry . getDebugModeGenerationPath ( path ) ; if ( randomParam != null ) { requestPath += "?" + randomParam + "&" ; } else { requestPath += "?" ; } requestPath += JawrRequestHandler . GENERATION_PARAM + "=" + URLEncoder . encode ( path , "UTF-8" ) ; } catch ( Unsupport... |
public class CodeBuilderUtil { /** * Defines a Storable prepare method , which assumes that a support field
* exists and a single - argument constructor exists which accepts a support
* instance .
* @ param cf file to which to add the prepare method
* @ since 1.2 */
public static void definePrepareMethod ( Clas... | definePrepareMethod ( cf , storableClass , supportCtorType , StorableGenerator . SUPPORT_FIELD_NAME , TypeDesc . forClass ( TriggerSupport . class ) ) ; |
public class LanguageResourceService { /** * Merges the given JSON objects . Any leaf node in overlay will overwrite
* the corresponding path in original .
* @ param original
* The original JSON object to which changes should be applied .
* @ param overlay
* The JSON object containing changes that should be a... | // If we are at a leaf node , the result of merging is simply the overlay
if ( ! overlay . isObject ( ) || original == null ) return overlay ; // Create mutable copy of original
ObjectNode newNode = JsonNodeFactory . instance . objectNode ( ) ; Iterator < String > fieldNames = original . getFieldNames ( ) ; while ( fie... |
public class QueryParserKraken { /** * Parses the references clause . */
public void parseReferences ( ArrayList < String > name ) { } } | String foreignTable = parseIdentifier ( ) ; Token token = scanToken ( ) ; ArrayList < String > foreignColumns = new ArrayList < String > ( ) ; if ( token == Token . LPAREN ) { _token = token ; foreignColumns = parseColumnNames ( ) ; } else { _token = token ; } |
public class CreateDirectoryConfigRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateDirectoryConfigRequest createDirectoryConfigRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createDirectoryConfigRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createDirectoryConfigRequest . getDirectoryName ( ) , DIRECTORYNAME_BINDING ) ; protocolMarshaller . marshall ( createDirectoryConfigRequest . getOrganizati... |
public class ExcelUtils { /** * 基于模板 、 注解导出 { @ code Map [ String , List [ ? ] ] } 类型数据
* 模板定制详见定制说明
* @ param templatePath Excel模板路径
* @ param data 待导出的 { @ code Map < String , List < ? > > } 类型数据
* @ param extendMap 扩展内容Map数据 ( 具体就是key匹配替换模板 # key内容 , 详情请查阅Excel模板定制方法 )
* @ param clazz 映射对象Class
* @ param... | try ( SheetTemplate sheetTemplate = exportExcelByMapHandler ( templatePath , 0 , data , extendMap , clazz , true ) ) { sheetTemplate . write2File ( targetPath ) ; } catch ( IOException e ) { throw new Excel4JException ( e ) ; } |
public class Collectors { /** * Returns a { @ code Collector } that produces the maximal element according
* to a given { @ code Comparator } , described as an { @ code Optional < T > } .
* @ implSpec
* This produces a result equivalent to :
* < pre > { @ code
* reducing ( BinaryOperator . maxBy ( comparator ... | return reducing ( BinaryOperator . maxBy ( comparator ) ) ; |
public class MutableArray { /** * Adds an object to the end of the array .
* @ param value the object
* @ return The self object */
@ NonNull @ Override public MutableArray addValue ( Object value ) { } } | synchronized ( lock ) { internalArray . append ( Fleece . toCBLObject ( value ) ) ; return this ; } |
public class ISUPMessageImpl { public void addParameter ( ISUPParameter param ) throws ParameterException { } } | if ( param == null ) { throw new IllegalArgumentException ( "Argument must not be null" ) ; } int paramCode = param . getCode ( ) ; if ( this . mandatoryCodes . contains ( paramCode ) ) { int index = this . mandatoryCodeToIndex . get ( paramCode ) ; this . f_Parameters . put ( index , ( AbstractISUPParameter ) param ) ... |
public class HttpResponse { /** * Returns the _ first _ cookie matching < tt > cookieName < / tt > . Objects returned
* by this method are of the class burp . impl . Cookie which implements the
* burp . ICookie interface .
* @ param cookieName The name of the cookie to return
* @ return The cookie , or null if ... | for ( ICookie cookie : cookies ) { if ( cookie . getName ( ) . equals ( cookieName ) ) { return cookie ; } } return null ; |
public class RSAUtils { /** * Generate a random RSA keypair .
* @ param numBits
* key ' s length in bits , should be power of 2)
* @ return
* @ throws NoSuchAlgorithmException */
public static KeyPair generateKeys ( int numBits ) throws NoSuchAlgorithmException { } } | int numBitsPow2 = 1 ; while ( numBitsPow2 < numBits ) { numBitsPow2 <<= 1 ; } KeyPairGenerator kpg = KeyPairGenerator . getInstance ( CIPHER_ALGORITHM ) ; kpg . initialize ( numBitsPow2 , SECURE_RNG ) ; KeyPair keyPair = kpg . generateKeyPair ( ) ; return keyPair ; |
public class AzureAffinityGroupSupport { /** * Lists all of the affinity groups visible to the current account
* @ param options Filtering options for the list
* @ return All the affinity groups visible to current account
* @ throws org . dasein . cloud . InternalException an error occurred within the Dasein Clou... | AzureMethod method = new AzureMethod ( this . provider ) ; final AffinityGroupsModel affinityGroupsModel = method . get ( AffinityGroupsModel . class , RESOURCE_AFFINITYGROUPS ) ; ArrayList < AffinityGroup > affinityGroups = new ArrayList < AffinityGroup > ( ) ; for ( AffinityGroupModel affinityGroupModel : affinityGro... |
public class AutoClientBundleGenerator { /** * Filter file set , preferring * . mp3 files where alternatives exist . */
private HashSet < Resource > preferMp3 ( HashSet < Resource > files ) { } } | HashMap < String , Resource > map = new HashMap < String , Resource > ( ) ; for ( Resource file : files ) { String path = stripExtension ( file . getPath ( ) ) ; if ( file . getPath ( ) . endsWith ( ".mp3" ) || ! map . containsKey ( path ) ) { map . put ( path , file ) ; } } return new HashSet < Resource > ( map . valu... |
public class BinaryType { /** * Get the binary type for the given value type .
* @ param type The type to check .
* @ return The binary type ID . */
public static byte forType ( @ Nonnull PType type ) { } } | switch ( type ) { case VOID : return VOID ; case BOOL : return BOOL ; case BYTE : return BYTE ; case I16 : return I16 ; case I32 : return I32 ; case I64 : return I64 ; case DOUBLE : return DOUBLE ; case STRING : return STRING ; case BINARY : return STRING ; case ENUM : return I32 ; case MAP : return MAP ; case SET : re... |
public class DefaultCommunicationClientImpl { /** * 直接提交一个异步任务 */
public Future submit ( Callable call ) { } } | Assert . notNull ( this . factory , "No factory specified" ) ; return executor . submit ( call ) ; |
public class VerificationConditionGenerator { /** * Translate a WhileyFile into a WyalFile which contains the verification
* conditions necessary to establish that all functions and methods in the
* WhileyFile meet their specifications , and that no array - out - of - bounds or
* division - by - zero exceptions a... | for ( WyilFile . Decl . Unit unit : wyilFile . getModule ( ) . getUnits ( ) ) { translate ( unit ) ; } for ( WyilFile . Decl . Unit unit : wyilFile . getModule ( ) . getExterns ( ) ) { translate ( unit ) ; } return wyalFile ; |
public class FragmentBuilder { /** * This method determines if the fragment is complete
* with the exception of ignored nodes .
* @ return Whether the fragment is complete with the exception of
* ignored nodes */
public boolean isCompleteExceptIgnoredNodes ( ) { } } | synchronized ( nodeStack ) { if ( nodeStack . isEmpty ( ) && retainedNodes . isEmpty ( ) ) { return true ; } else { // Check that remaining nodes can be ignored
for ( int i = 0 ; i < nodeStack . size ( ) ; i ++ ) { if ( ! ignoredNodes . contains ( nodeStack . get ( i ) ) ) { return false ; } } for ( int i = 0 ; i < ret... |
public class AliasedDiscoveryConfigUtils { /** * Checks whether all aliased discovery configs have the tag { @ literal < use - public - ip > true < / use - public - ip } .
* Note that if no config is enabled , then the method returns { @ literal false } . */
public static boolean allUsePublicAddress ( List < AliasedD... | boolean atLeastOneEnabled = false ; for ( AliasedDiscoveryConfig config : configs ) { if ( config . isEnabled ( ) ) { atLeastOneEnabled = true ; if ( ! config . isUsePublicIp ( ) ) { return false ; } } } return atLeastOneEnabled ; |
public class Node { /** * uses default excludes */
public List < T > find ( String ... includes ) throws IOException { } } | return find ( getWorld ( ) . filter ( ) . include ( includes ) ) ; |
public class Util { /** * Returns the total item capacity of an updatable , non - compact combined buffer
* given < i > k < / i > and < i > n < / i > . If total levels = 0 , this returns the ceiling power of 2
* size for the base buffer or the MIN _ BASE _ BUF _ SIZE , whichever is larger .
* @ param k sketch par... | final int totLevels = computeNumLevelsNeeded ( k , n ) ; if ( totLevels == 0 ) { final int bbItems = computeBaseBufferItems ( k , n ) ; return Math . max ( 2 * DoublesSketch . MIN_K , ceilingPowerOf2 ( bbItems ) ) ; } return ( 2 + totLevels ) * k ; |
public class QrPose3DUtils { /** * Specifies PNP parameters for a single feature
* @ param which Landmark ' s index
* @ param row row in the QR code ' s grid coordinate system
* @ param col column in the QR code ' s grid coordinate system
* @ param N width of grid
* @ param pixel observed pixel coordinate of ... | set3D ( row , col , N , point23 . get ( which ) . location ) ; pixelToNorm . compute ( pixel . x , pixel . y , point23 . get ( which ) . observation ) ; |
public class JsonRuntimeReporterHelper { /** * Provides a JSON object representing the counts of tests passed , failed , skipped and running .
* @ param testObjects
* Array of the current tests as a { @ link JsonArray } .
* @ return A { @ link JsonObject } with counts for various test results . */
private JsonObj... | logger . entering ( testObjects ) ; int runningCount = 0 ; int skippedCount = 0 ; int passedCount = 0 ; int failedCount = 0 ; String result ; for ( JsonElement test : testObjects ) { result = test . getAsJsonObject ( ) . get ( "status" ) . getAsString ( ) ; switch ( result ) { case "Running" : runningCount += 1 ; break... |
public class QueryExecutor { /** * Parse query and return a string query that will be passed to prepared
* statement ( substitute parameter with ' ? ' char ) . */
private String createQueryString ( ) { } } | QueryChunk [ ] chunks = query . getChunks ( ) ; if ( ( chunks == null ) || ( chunks . length == 0 ) ) { // no query chunks
return "" ; } StringBuffer sb = new StringBuffer ( ) ; QueryChunk chunk = null ; int position = 1 ; for ( int i = 0 ; i < chunks . length ; i ++ ) { chunk = chunks [ i ] ; // System . out . println... |
public class AWSIotClient { /** * Updates supported fields of the specified job .
* @ param updateJobRequest
* @ return Result of the UpdateJob operation returned by the service .
* @ throws InvalidRequestException
* The request is not valid .
* @ throws ResourceNotFoundException
* The specified resource do... | request = beforeClientExecution ( request ) ; return executeUpdateJob ( request ) ; |
public class RolesInner { /** * Create or update a role .
* @ param deviceName The device name .
* @ param name The role name .
* @ param resourceGroupName The resource group name .
* @ param role The role properties .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return t... | return beginCreateOrUpdateWithServiceResponseAsync ( deviceName , name , resourceGroupName , role ) . map ( new Func1 < ServiceResponse < RoleInner > , RoleInner > ( ) { @ Override public RoleInner call ( ServiceResponse < RoleInner > response ) { return response . body ( ) ; } } ) ; |
public class BELScriptWalker { /** * BELScriptWalker . g : 121:1 : set _ document : ( ' SET ' dkt = DOCUMENT _ KEYWORD ) prop = document _ property ' = ' ( qv = QUOTED _ VALUE | oi = OBJECT _ IDENT ) ; */
public final BELScriptWalker . set_document_return set_document ( ) throws RecognitionException { } } | BELScriptWalker . set_document_return retval = new BELScriptWalker . set_document_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; CommonTree _first_0 = null ; CommonTree _last = null ; CommonTree dkt = null ; CommonTree qv = null ; CommonTree oi = null ; CommonTree string_literal13 = null ; ... |
public class SpatialDirectoryEntry { /** * Calls the super method and reads the MBR object of this entry from the
* specified input stream .
* @ param in the stream to read data from in order to restore the object
* @ throws java . io . IOException if I / O errors occur
* @ throws ClassNotFoundException If the ... | this . id = in . readInt ( ) ; this . mbr = new ModifiableHyperBoundingBox ( ) ; this . mbr . readExternal ( in ) ; |
public class ClassUtils { /** * This will return a class of the type T [ ] from a given class . When we read
* from the AG pipe , Java needs a reference to a generic array type .
* @ param klass a class to turn into an array class
* @ param < T > the type of the class .
* @ return an array of klass with a lengt... | return ( Class < T [ ] > ) Array . newInstance ( klass , 1 ) . getClass ( ) ; |
public class AuthenticationProcessingFilter2 { /** * Leave the information about login failure .
* Otherwise it seems like Acegi doesn ' t really leave the detail of the failure anywhere . */
@ Override protected void onUnsuccessfulAuthentication ( HttpServletRequest request , HttpServletResponse response , Authentic... | super . onUnsuccessfulAuthentication ( request , response , failed ) ; LOGGER . log ( Level . FINE , "Login attempt failed" , failed ) ; Authentication auth = failed . getAuthentication ( ) ; if ( auth != null ) { SecurityListener . fireFailedToLogIn ( auth . getName ( ) ) ; } |
public class ReportedData { /** * Returns a new ReportedData if the stanza is used for reporting data and includes an
* extension that matches the elementName and namespace " x " , " jabber : x : data " .
* @ param packet the stanza used for reporting data .
* @ return ReportedData from the packet if present , ot... | // Check if the packet includes the DataForm extension
DataForm dataForm = DataForm . from ( packet ) ; if ( dataForm != null ) { if ( dataForm . getReportedData ( ) != null ) return new ReportedData ( dataForm ) ; } // Otherwise return null
return null ; |
public class Policy { /** * buildRoleLinks initializes the roles in RBAC .
* @ param rm the role manager . */
public void buildRoleLinks ( RoleManager rm ) { } } | if ( model . containsKey ( "g" ) ) { for ( Assertion ast : model . get ( "g" ) . values ( ) ) { ast . buildRoleLinks ( rm ) ; } } |
public class XMLSystemProperties { /** * Limit the number of content model nodes that may be created when building a
* grammar for a W3C XML Schema that contains maxOccurs attributes with values
* other than " unbounded " . < br >
* This setting only takes effect if a parser with < b > explicitly < / b > disabled... | SystemProperties . setPropertyValue ( SYSTEM_PROPERTY_MAX_OCCUR , sMaxOccur ) ; SystemProperties . setPropertyValue ( SYSTEM_PROPERTY_JDX_XML_MAX_OCCUR , sMaxOccur ) ; _onSystemPropertyChange ( ) ; |
public class LittleEndian { /** * Sets a 16 - bit integer in the given byte array at the given offset . */
public static void setInt16 ( byte [ ] dst , int offset , int value ) { } } | assert ( value & 0xffff ) == value : "value out of range" ; dst [ offset + 0 ] = ( byte ) ( value & 0xFF ) ; dst [ offset + 1 ] = ( byte ) ( ( value >>> 8 ) & 0xFF ) ; |
public class ValueList { /** * Add Text to the Tokens .
* @ param _ text Text to be added */
public void addText ( final String _text ) { } } | this . tokens . add ( new Token ( ValueList . TokenType . TEXT , _text ) ) ; |
public class JSONArray { /** * Get an optional { @ link Number } value associated with a key , or the default if there
* is no such key or if the value is not a number . If the value is a string ,
* an attempt will be made to evaluate it as a number ( { @ link BigDecimal } ) . This method
* would be used in cases... | Object val = this . opt ( index ) ; if ( JSONObject . NULL . equals ( val ) ) { return defaultValue ; } if ( val instanceof Number ) { return ( Number ) val ; } if ( val instanceof String ) { try { return JSONObject . stringToNumber ( ( String ) val ) ; } catch ( Exception e ) { return defaultValue ; } } return default... |
public class LinePath { /** * Return a copy of the path , translated by the specified amounts . */
public Path getTranslatedInstance ( int x , int y ) { } } | if ( _source == null ) { return new LinePath ( null , new Point ( _dest . x + x , _dest . y + y ) , _duration ) ; } else { return new LinePath ( _source . x + x , _source . y + y , _dest . x + x , _dest . y + y , _duration ) ; } |
public class BeanIntrospector { /** * Returns a Map of all the available properties on a given class including
* write - only and indexed properties .
* @ return Map < String , BeanProperty > an unmodifiable mapping of property
* names ( Strings ) to BeanProperty objects . */
public static Map < String , BeanProp... | synchronized ( cPropertiesCache ) { Map < String , BeanProperty > properties ; SoftReference < Map < String , BeanProperty > > ref = cPropertiesCache . get ( clazz ) ; if ( ref != null ) { properties = ref . get ( ) ; if ( properties != null ) { return properties ; } } properties = createProperties ( clazz ) ; cPropert... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.