signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class OpenIntObjectHashMap { /** * Returns the value associated with the specified key .
* It is often a good idea to first check with { @ link # containsKey ( int ) } whether the given key has a value associated or not , i . e . whether there exists an association for the given key or not .
* @ param key th... | int i = indexOfKey ( key ) ; if ( i < 0 ) return null ; // not contained
return values [ i ] ; |
public class Utils { /** * Substitute the variables in the given expression with the
* values from the resolver
* @ param pResolver
* @ param pExpression */
public static String replaceVariables ( final VariableResolver pResolver , final String pExpression , final String pOpen , final String pClose ) { } } | final char [ ] open = pOpen . toCharArray ( ) ; final char [ ] close = pClose . toCharArray ( ) ; final StringBuilder out = new StringBuilder ( ) ; StringBuilder sb = new StringBuilder ( ) ; char [ ] last = null ; int wo = 0 ; int wc = 0 ; int level = 0 ; for ( char c : pExpression . toCharArray ( ) ) { if ( c == open ... |
public class HessianInput { /** * Reads a byte array
* < pre >
* B b16 b8 data value
* < / pre > */
public byte [ ] readBytes ( ) throws IOException { } } | int tag = read ( ) ; switch ( tag ) { case 'N' : return null ; case 'B' : case 'b' : _isLastChunk = tag == 'B' ; _chunkLength = ( read ( ) << 8 ) + read ( ) ; ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; int data ; while ( ( data = parseByte ( ) ) >= 0 ) bos . write ( data ) ; return bos . toByteArray ( ... |
public class Expression { /** * Cast result object to a string .
* @ param xctxt The XPath runtime context .
* @ return The string this wraps or the empty string if null
* @ throws javax . xml . transform . TransformerException */
public XMLString xstr ( XPathContext xctxt ) throws javax . xml . transform . Trans... | return execute ( xctxt ) . xstr ( ) ; |
public class AmazonRedshiftClient { /** * Returns one or more cluster subnet group objects , which contain metadata about your cluster subnet groups . By
* default , this operation returns information about all cluster subnet groups that are defined in you AWS account .
* If you specify both tag keys and tag values... | request = beforeClientExecution ( request ) ; return executeDescribeClusterSubnetGroups ( request ) ; |
public class Templates { /** * 获取模板 , 容易被微信的文档误导 , 这里其实是获取模板到服务号的管理端 , 并不单纯是获取ID那么简单
* 对于相同的code , 每调用一次微信后台会生成一条新的记录
* @ param code 模板库中模板的编号 , 有 “ TM * * ” 和 “ OPENTMTM * * ” 等形式
* @ return */
public String fetch ( String code ) { } } | String url = WxEndpoint . get ( "url.template.get" ) ; String json = String . format ( "{\"template_id_short\":\"%s\"}" , code ) ; logger . debug ( "template message, get template id: {}" , json ) ; String response = wxClient . post ( url , json ) ; Map < String , Object > result = JsonMapper . defaultMapper ( ) . json... |
public class MarkLogicRepositoryConnection { /** * overload for prepareBooleanQuery
* @ param queryString
* @ return MarkLogicBooleanQuery
* @ throws RepositoryException
* @ throws MalformedQueryException */
@ Override public MarkLogicBooleanQuery prepareBooleanQuery ( String queryString ) throws RepositoryExce... | return prepareBooleanQuery ( QueryLanguage . SPARQL , queryString , null ) ; |
public class CLIQUE { /** * Updates the minima and maxima array according to the specified feature
* vector .
* @ param featureVector the feature vector
* @ param minima the array of minima
* @ param maxima the array of maxima */
private void updateMinMax ( NumberVector featureVector , double [ ] minima , doubl... | assert ( minima . length == featureVector . getDimensionality ( ) ) ; for ( int d = 0 ; d < featureVector . getDimensionality ( ) ; d ++ ) { double v = featureVector . doubleValue ( d ) ; if ( v == v ) { // Avoid NaN .
maxima [ d ] = MathUtil . max ( v , maxima [ d ] ) ; minima [ d ] = MathUtil . min ( v , minima [ d ]... |
public class AsynchronousRequest { /** * For more info on event detail API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 1 / event _ details " > here < / a > < br / >
* @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) }
* @ throws NullPointerException ... | gw2API . getAllEventDetailedInfo ( GuildWars2 . lang . getValue ( ) ) . enqueue ( callback ) ; |
public class AmazonPinpointEmailClient { /** * Create a new pool of dedicated IP addresses . A pool can include one or more dedicated IP addresses that are
* associated with your Amazon Pinpoint account . You can associate a pool with a configuration set . When you send an
* email that uses that configuration set ,... | request = beforeClientExecution ( request ) ; return executeCreateDedicatedIpPool ( request ) ; |
public class CmsGalleryService { /** * Generates the pre - loaded contents for the VFS tab of the gallery dialog . < p >
* @ param cms the current CMS context
* @ param vfsState the saved VFS tree state ( may be null )
* @ param folders the saved search folders ( may be null )
* @ return the root tree entry for... | CmsVfsEntryBean vfsPreloadData = null ; A_CmsTreeTabDataPreloader < CmsVfsEntryBean > vfsloader = new A_CmsTreeTabDataPreloader < CmsVfsEntryBean > ( ) { @ SuppressWarnings ( "synthetic-access" ) @ Override protected CmsVfsEntryBean createEntry ( CmsObject innerCms , CmsResource resource ) throws CmsException { String ... |
public class LinguisticServices { /** * Returns true if the spell check is positive */
@ Override public boolean isCorrectSpell ( String word , Language lang ) { } } | return isCorrectSpell ( word , getLocale ( lang ) ) ; |
public class QueryParsers { /** * Add one or more languages to this engine by supplying the corresponding parsers .
* @ param firstLanguage the query parser for the first language
* @ param additionalLanguages the query parsers for the additional languages
* @ throws IllegalArgumentException if the language parse... | addLanguage ( firstLanguage ) ; for ( QueryParser language : additionalLanguages ) { addLanguage ( language ) ; } |
public class LargeBlockManager { /** * Store the given block with the given ID to disk .
* @ param blockId the ID of the block
* @ param block the bytes for the block
* @ throws IOException */
void storeBlock ( BlockId blockId , ByteBuffer block ) throws IOException { } } | synchronized ( m_accessLock ) { if ( m_blockPathMap . containsKey ( blockId ) ) { throw new IllegalArgumentException ( "Request to store block that is already stored: " + blockId . toString ( ) ) ; } int origPosition = block . position ( ) ; block . position ( 0 ) ; Path blockPath = makeBlockPath ( blockId ) ; try ( Se... |
public class FileStorage { /** * Handle input by writing it to the file , if a channel exists .
* @ param event the event
* @ param channel the channel */
@ Handler public void onInput ( Input < ByteBuffer > event , Channel channel ) { } } | Writer writer = inputWriters . get ( channel ) ; if ( writer != null ) { writer . write ( event . buffer ( ) ) ; } |
public class TrellisWebDAV { /** * Update properties on a resource .
* @ param response the async response
* @ param request the request
* @ param uriInfo the URI info
* @ param headers the headers
* @ param security the security context
* @ param propertyUpdate the property update request
* @ throws Pars... | APPLICATION_XML } ) @ Produces ( { APPLICATION_XML } ) @ Timed public void updateProperties ( @ Suspended final AsyncResponse response , @ Context final Request request , @ Context final UriInfo uriInfo , @ Context final HttpHeaders headers , @ Context final SecurityContext security , final DavPropertyUpdate propertyUp... |
public class TimelineCallback { /** * On simon creation a timeline attribute is added ( for Stopwatches only ) .
* @ param simon created simon */
@ Override public void onSimonCreated ( Simon simon ) { } } | if ( simon instanceof Stopwatch ) { simon . setAttribute ( timelineAttributeName , new StopwatchTimeline ( timelineCapacity , timeRangeWidth ) ) ; } |
public class ServerStatusTool { /** * Show a human - readable form of the latest message in the server status
* file . If the status file doesn ' t yet exist , this will print a special
* status message indicating the server is new . The response will have the
* following form .
* < pre >
* STATE : Some State... | ServerStatusMessage message ; if ( _statusFile . exists ( ) ) { ServerStatusMessage [ ] messages = getAllMessages ( ) ; message = messages [ messages . length - 1 ] ; } else { message = ServerStatusMessage . NEW_SERVER_MESSAGE ; } System . out . println ( message . toString ( ) ) ; |
public class OsmConnection { /** * Make a request to the Http Osm Api
* @ param call HTTP path and URL parameters ( if any )
* @ param method HTTP method . Defaults to " GET "
* @ param authenticate whether to make this request as a logged in user
* @ param writer the writer to send the request payload to the s... | HttpURLConnection connection = null ; try { connection = sendRequest ( call , method , authenticate , writer ) ; handleResponseCode ( connection ) ; if ( reader != null ) return handleResponse ( connection , reader ) ; else return null ; } catch ( IOException e ) { throw new OsmConnectionException ( e ) ; } catch ( OAu... |
public class OMVRBTreeMapEntryProvider { /** * Serialize only the new values or the changed . */
protected byte [ ] serializeStreamValue ( final int iIndex ) throws IOException { } } | if ( serializedValues [ iIndex ] <= 0 ) { // NEW OR MODIFIED : MARSHALL CONTENT
OProfiler . getInstance ( ) . updateCounter ( "OMVRBTreeMapEntry.serializeValue" , 1 ) ; return ( ( OMVRBTreeMapProvider < K , V > ) treeDataProvider ) . valueSerializer . toStream ( values [ iIndex ] ) ; } // RETURN ORIGINAL CONTENT
return... |
public class NotifierUtils { /** * return all the ancestors of the given path , include itself .
* @ param eventPath
* @ return */
public static List < String > getAllAncestors ( String eventPath ) { } } | // check if the path is valid .
if ( eventPath == null || ! eventPath . startsWith ( Path . SEPARATOR ) ) { return null ; } if ( eventPath . equals ( Path . SEPARATOR ) ) { return Arrays . asList ( Path . SEPARATOR ) ; } List < String > ancestors = new ArrayList < String > ( ) ; while ( eventPath . length ( ) > 0 ) { a... |
public class StreamingJsonBuilder { /** * Delegates to { @ link # call ( Iterable , Closure ) } */
public Object call ( Collection coll , @ DelegatesTo ( StreamingJsonDelegate . class ) Closure c ) throws IOException { } } | return call ( ( Iterable ) coll , c ) ; |
public class TimedMessage { /** * Add a timed message .
* @ param message The message string .
* @ param x The horizontal location .
* @ param y The vertical location .
* @ param time The remaining time . */
public void addMessage ( String message , int x , int y , long time ) { } } | messages . add ( new MessageData ( message , x , y , time ) ) ; hasMessage = true ; |
public class DateUtil { /** * 偏移周
* @ param date 日期
* @ param offset 偏移周数 , 正数向未来偏移 , 负数向历史偏移
* @ return 偏移后的日期 */
public static DateTime offsetWeek ( Date date , int offset ) { } } | return offset ( date , DateField . WEEK_OF_YEAR , offset ) ; |
public class ReferNotifySender { /** * Same as the other processRefer ( ) except allows for a couple of overrides for testing error
* handling by the far end outbound REFER side : ( a ) takes a duration for adding ExpiresHeader to
* the REFER response ( the response shouldn ' t have an expires header ) , and ( b ) ... | setErrorMessage ( "" ) ; PhoneB b = new PhoneB ( timeout + 500 , statusCode , reasonPhrase , duration , overrideEvent ) ; b . start ( ) ; |
public class Convert { /** * 转换为Date < br >
* 如果给定的值为空 , 或者转换失败 , 返回默认值 < br >
* 转换失败不会报错
* @ param value 被转换的值
* @ param defaultValue 转换错误时的默认值
* @ return 结果
* @ since 4.1.6 */
public static Date toDate ( Object value , Date defaultValue ) { } } | return convert ( Date . class , value , defaultValue ) ; |
public class ChocoMapper { /** * Register a mapping between an api - side view and its choco implementation .
* It is expected from the implementation to exhibit a constructor that takes the api - side constraint as argument .
* @ param c the api - side view
* @ param cc the choco implementation
* @ throws Ille... | views . put ( c , cc ) ; |
public class CliUtils { /** * Returns IndexOperator from string representation
* @ param operator - string representing IndexOperator ( = , > = , > , < , < = )
* @ return IndexOperator - enum value of IndexOperator or null if not found */
public static IndexOperator getIndexOperator ( String operator ) { } } | if ( operator . equals ( "=" ) ) { return IndexOperator . EQ ; } else if ( operator . equals ( ">=" ) ) { return IndexOperator . GTE ; } else if ( operator . equals ( ">" ) ) { return IndexOperator . GT ; } else if ( operator . equals ( "<" ) ) { return IndexOperator . LT ; } else if ( operator . equals ( "<=" ) ) { re... |
public class ConsumerDispatcherState { /** * Sets the noLocal flag .
* @ param noLocal The noLocal to set */
public void setNoLocal ( boolean noLocal ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setNoLocal" , Boolean . valueOf ( noLocal ) ) ; this . noLocal = noLocal ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setNoLocal" ) ; |
public class RenderAPI { /** * TODO 数据模型为对象而不仅仅是Map */
@ Deprecated public static void debug ( XWPFTemplate template , Map < String , Object > datas ) { } } | List < ElementTemplate > all = template . getElementTemplates ( ) ; LOGGER . debug ( "Template tag number is:{}" , ( null == all ? 0 : all . size ( ) ) ) ; if ( ( all == null || all . isEmpty ( ) ) && ( null == datas || datas . isEmpty ( ) ) ) { LOGGER . debug ( "No template gramer find and no render data find" ) ; ret... |
public class ObservableReplay { /** * Creates a replaying ConnectableObservable with an unbounded buffer .
* @ param < T > the value type
* @ param source the source observable
* @ return the new ConnectableObservable instance */
@ SuppressWarnings ( "unchecked" ) public static < T > ConnectableObservable < T > c... | ObservableSource < T > sourceCast = ( ObservableSource < T > ) source ; return create ( sourceCast , DEFAULT_UNBOUNDED_FACTORY ) ; |
public class scparameter { /** * Use this API to unset the properties of scparameter resource .
* Properties that need to be unset are specified in args array . */
public static base_response unset ( nitro_service client , scparameter resource , String [ ] args ) throws Exception { } } | scparameter unsetresource = new scparameter ( ) ; return unsetresource . unset_resource ( client , args ) ; |
public class SuperHero { /** * Creates a new instance of { @ link SuperHero } . */
public static SuperHero create ( String name , List < String > powers , Optional < Civilian > alterEgo ) { } } | return new AutoValue_SuperHero ( name , powers , alterEgo ) ; |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcProcedureTypeEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class KeystoreManager { /** * Loads a keystore .
* @ param server the server the keystore is intended for
* @ param keystore a keystore containing your private key and the certificate signed by Apple ( File , InputStream , byte [ ] , KeyStore or String for a file path )
* @ return a loaded keystore
* @ t... | return loadKeystore ( server , keystore , false ) ; |
public class ArrayIntSet { /** * Creates an array of shorts from the contents of this set . Any values outside the range of a
* short will be truncated by way of a cast . */
public short [ ] toShortArray ( ) { } } | short [ ] values = new short [ _size ] ; for ( int ii = 0 ; ii < _size ; ii ++ ) { values [ ii ] = ( short ) _values [ ii ] ; } return values ; |
public class BatchUtil { /** * Given an ( ordered ) { @ link Collection } of non - < code > null < / code > , iterate
* over the collection and return a list of ranges of the given batchSize . The
* last range may be smaller and contains the remainder if the collection is
* not equally divisible in batchSize rang... | List < Range < E > > rangeList = new LinkedList < Range < E > > ( ) ; E currentMin = null ; // Check for edge cases
if ( ( collection != null ) && ( collection . size ( ) > 0 ) && ( batchSize > 0 ) ) { int index = 1 ; for ( E element : collection ) { // Bootstrap first element in the next range
if ( currentMin == null ... |
public class TranslateAndSynthesizeExample { /** * Write the input stream to a file . */
private static void writeToFile ( InputStream in , File file ) { } } | try { OutputStream out = new FileOutputStream ( file ) ; byte [ ] buf = new byte [ 1024 ] ; int len ; while ( ( len = in . read ( buf ) ) > 0 ) { out . write ( buf , 0 , len ) ; } out . close ( ) ; in . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } |
public class PersistentNode { /** * You must call start ( ) to initiate the persistent node . An attempt to create the node
* in the background will be started */
public void start ( ) { } } | Preconditions . checkState ( state . compareAndSet ( State . LATENT , State . STARTED ) , "Already started" ) ; client . getConnectionStateListenable ( ) . addListener ( connectionStateListener ) ; createNode ( ) ; |
public class HtmlTree { /** * Adds an attribute for the HTML tag .
* @ param attrName name of the attribute
* @ param attrValue value of the attribute */
public void addAttr ( HtmlAttr attrName , String attrValue ) { } } | if ( attrs . isEmpty ( ) ) attrs = new LinkedHashMap < HtmlAttr , String > ( 3 ) ; attrs . put ( nullCheck ( attrName ) , escapeHtmlChars ( attrValue ) ) ; |
public class DocumentStore { /** * Initializes this instance . */
@ Override public IDocumentStore initialize ( ) { } } | if ( initialized ) { return this ; } assertValidConfiguration ( ) ; try { if ( getConventions ( ) . getDocumentIdGenerator ( ) == null ) { // don ' t overwrite what the user is doing
MultiDatabaseHiLoIdGenerator generator = new MultiDatabaseHiLoIdGenerator ( this , getConventions ( ) ) ; _multiDbHiLo = generator ; getC... |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link String } { @ code > } } */
@ XmlElementDecl ( namespace = "" , name = "skipped" ) public JAXBElement < String > createSkipped ( String value ) { } } | return new JAXBElement < String > ( _Skipped_QNAME , String . class , null , value ) ; |
public class TrainingsImpl { /** * Update a specific project .
* @ param projectId The id of the project to update
* @ param updatedProject The updated project model
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server... | return updateProjectWithServiceResponseAsync ( projectId , updatedProject ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ValidationResult { /** * Create an OperationOutcome resource which contains all of the messages found as a result of this validation */
public IBaseOperationOutcome toOperationOutcome ( ) { } } | IBaseOperationOutcome oo = ( IBaseOperationOutcome ) myCtx . getResourceDefinition ( "OperationOutcome" ) . newInstance ( ) ; populateOperationOutcome ( oo ) ; return oo ; |
public class CmsWorkplace { /** * Returns the html for an invisible spacer between button bar contents like buttons , labels , etc . < p >
* @ param width the width of the invisible spacer
* @ return the html for the invisible spacer */
public String buttonBarSpacer ( int width ) { } } | StringBuffer result = new StringBuffer ( 128 ) ; result . append ( "<td><span class=\"norm\"><span unselectable=\"on\" class=\"txtbutton\" style=\"width: " ) ; result . append ( width ) ; result . append ( "px;\"></span></span></td>\n" ) ; return result . toString ( ) ; |
public class CommerceNotificationQueueEntryPersistenceImpl { /** * Returns the first commerce notification queue entry in the ordered set where sentDate & lt ; & # 63 ; .
* @ param sentDate the sent date
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ ret... | List < CommerceNotificationQueueEntry > list = findByLtS ( sentDate , 0 , 1 , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; |
public class CombinedWriter { /** * { @ inheritDoc } */
@ Override public void writeUberBucket ( final UberBucket pBucket ) throws TTException { } } | mService . submit ( new Callable < Void > ( ) { @ Override public Void call ( ) throws Exception { mSecondWriter . writeUberBucket ( pBucket ) ; return null ; } } ) ; mFirstWriter . writeUberBucket ( pBucket ) ; |
public class NetworkModule { /** * http : / / stackoverflow . com / questions / 11555366 / enable - disable - data - connection - in - android - programmatically
* Try to enabled / disable mobile network state using reflection .
* Returns true if succeeded
* @ param enabled */
private boolean setMobileNetworkEnab... | try { final Class conmanClass = Class . forName ( connectivityManager . getClass ( ) . getName ( ) ) ; final Field iConnectivityManagerField = conmanClass . getDeclaredField ( "mService" ) ; iConnectivityManagerField . setAccessible ( true ) ; final Object iConnectivityManager = iConnectivityManagerField . get ( connec... |
public class SimpleDOReader { /** * { @ inheritDoc } */
@ Override public Set < RelationshipTuple > getRelationships ( SubjectNode subject , PredicateNode predicate , ObjectNode object ) { } } | return m_obj . getRelationships ( subject , predicate , object ) ; |
public class AbstractFrame { /** * Saves the location of this frame , but only , if window state is ' normal ' .
* If window state is iconfied or maximized , the location is not saved !
* @ param point */
private void saveWindowLocation ( Point point ) { } } | if ( point != null ) { if ( getExtendedState ( ) == Frame . NORMAL ) { if ( logger . isDebugEnabled ( ) ) logger . debug ( "Saving preference " + PREF_WINDOW_POSITION + "=" + point . x + "," + point . y ) ; this . preferences . put ( prefnzPrefix + PREF_WINDOW_POSITION , point . x + "," + point . y ) ; } else { if ( lo... |
public class EntryStream { /** * Returns a new { @ code EntryStream } which is a concatenation of two
* supplied key - value pairs and this stream .
* This is a < a href = " package - summary . html # StreamOps " > quasi - intermediate
* operation < / a > with < a href = " package - summary . html # TSO " > tail ... | @ SuppressWarnings ( "unchecked" ) SimpleImmutableEntry < K , V > [ ] array = new SimpleImmutableEntry [ ] { new SimpleImmutableEntry < > ( k1 , v1 ) , new SimpleImmutableEntry < > ( k2 , v2 ) } ; return prependSpliterator ( null , Spliterators . spliterator ( array , Spliterator . ORDERED ) ) ; |
public class XMLUtil { /** * Read an enumeration value .
* @ param < T > is the type of the enumeration .
* @ param document is the XML document to explore .
* @ param type is the type of the enumeration .
* @ param caseSensitive indicates of the { @ code path } ' s components are case sensitive .
* @ param p... | assert document != null : AssertMessages . notNullParameter ( 0 ) ; return getAttributeEnumWithDefault ( document , type , caseSensitive , null , path ) ; |
public class FileSystem { /** * Initializes output directories on distributed file systems according to the given write mode .
* WriteMode . CREATE & parallel output :
* - A directory is created if the output path does not exist .
* - An existing file or directory raises an exception .
* WriteMode . CREATE & NO... | if ( ! this . isDistributedFS ( ) ) { return false ; } // check if path exists
if ( this . exists ( outPath ) ) { // path exists , check write mode
switch ( writeMode ) { case NO_OVERWRITE : // file or directory may not be overwritten
throw new IOException ( "File or directory already exists. Existing files and directo... |
public class Hidden { /** * Generate the hidden input tag .
* @ throws JspException if a JSP exception has occurred */
public int doEndTag ( ) throws JspException { } } | Object val = evaluateDataSource ( ) ; ServletRequest req = pageContext . getRequest ( ) ; if ( _dataInput != null ) { val = _dataInput . toString ( ) ; } // if there were expression errors report them
if ( hasErrors ( ) ) return reportAndExit ( SKIP_BODY ) ; if ( val != null ) { _value = val . toString ( ) ; } // Creat... |
public class SelfAssignment { /** * If the given expression is a call to a method checking the nullity of its first parameter , and
* otherwise returns that parameter . */
private static ExpressionTree stripNullCheck ( ExpressionTree expression , VisitorState state ) { } } | if ( expression != null && expression . getKind ( ) == METHOD_INVOCATION ) { MethodInvocationTree methodInvocation = ( MethodInvocationTree ) expression ; if ( NON_NULL_MATCHER . matches ( methodInvocation , state ) ) { return methodInvocation . getArguments ( ) . get ( 0 ) ; } } return expression ; |
public class DirectConnectGatewayMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DirectConnectGateway directConnectGateway , ProtocolMarshaller protocolMarshaller ) { } } | if ( directConnectGateway == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( directConnectGateway . getDirectConnectGatewayId ( ) , DIRECTCONNECTGATEWAYID_BINDING ) ; protocolMarshaller . marshall ( directConnectGateway . getDirectConnectGat... |
public class AmazonCloudDirectoryClient { /** * Returns a paginated list of < code > TypedLink < / code > facet names for a particular schema . For more information , see
* < a href =
* " https : / / docs . aws . amazon . com / clouddirectory / latest / developerguide / directory _ objects _ links . html # director... | request = beforeClientExecution ( request ) ; return executeListTypedLinkFacetNames ( request ) ; |
public class SerializationUtils { /** * Deserialize an object .
* @ param < T > the type parameter
* @ param inBytes The bytes to be deserialized
* @ param clazz the clazz
* @ return the object
* @ since 5.0.0 */
public static < T > T deserialize ( final byte [ ] inBytes , final Class < T > clazz ) { } } | val inputStream = new ByteArrayInputStream ( inBytes ) ; return deserialize ( inputStream , clazz ) ; |
public class JobManager { /** * Starts the Jetty Infoserver for the Jobmanager */
public void startInfoServer ( ) { } } | final Configuration config = GlobalConfiguration . getConfiguration ( ) ; // Start InfoServer
try { int port = config . getInteger ( ConfigConstants . JOB_MANAGER_WEB_PORT_KEY , ConfigConstants . DEFAULT_JOB_MANAGER_WEB_FRONTEND_PORT ) ; server = new WebInfoServer ( config , port , this ) ; server . start ( ) ; } catch... |
public class PurandareFirstOrder { /** * Calculates the first order co - occurrence statics to determine the feature
* set for each term , then clusters the feature vectors for each terms
* contexts and finally induces the sense - specific vectors for each term . */
@ SuppressWarnings ( "unchecked" ) private void p... | compressedDocumentsWriter . close ( ) ; // Generate the reverse index - to - term mapping . We will need this for
// assigning specific senses to each term
String [ ] indexToTerm = new String [ termToIndex . size ( ) ] ; for ( Map . Entry < String , Integer > e : termToIndex . entrySet ( ) ) indexToTerm [ e . getValue ... |
public class JDABuilder { /** * Flags used to enable selective parts of the JDA cache to reduce the runtime memory footprint .
* < br > < b > It is highly recommended to use { @ link # setDisabledCacheFlags ( EnumSet ) } instead
* for backwards compatibility < / b > . We might add more flags in the future which you... | this . cacheFlags = flags == null ? EnumSet . noneOf ( CacheFlag . class ) : EnumSet . copyOf ( flags ) ; return this ; |
public class ReferenceCache { /** * Asynchronously initialize a new cache value to associate with key .
* If key is null or key already exist will do nothing .
* Wraps the create method in a future task and starts a new process .
* @ param key associated with cache value */
public void init ( K key ) { } } | if ( null == key ) return ; CacheReference < K > refKey = keyFactory . createKey ( key , queue ) ; if ( cache . containsKey ( refKey ) ) return ; FutureTask < CacheReference < V > > task = new FutureTask < > ( ( ) -> { V created = requireNonNull ( create ( key ) ) ; return valueFactory . createValue ( created , queue )... |
public class MessageProcessor { /** * First sets the { @ link MessageProcessor # HEADER _ BASIC _ MESSAGE _ CLASS } string property of { @ code destination } to
* { @ code basicMessage . getClass ( ) . getName ( ) } , then copies all headers from { @ code basicMessage . getHeaders ( ) } to
* { @ code destination } ... | log . infof ( "Setting [%s] = [%s] on a message of type [%s]" , MessageProcessor . HEADER_BASIC_MESSAGE_CLASS , basicMessage . getClass ( ) . getName ( ) , destination . getClass ( ) . getName ( ) ) ; destination . setStringProperty ( MessageProcessor . HEADER_BASIC_MESSAGE_CLASS , basicMessage . getClass ( ) . getName... |
public class EvaluatorImpl { /** * Get the String value of a node .
* @ param inNode
* @ return */
protected String getStringFromNode ( Object inNode ) { } } | if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . entry ( cclass , "getStringFromNode" , inNode ) ; String strValue = null ; if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "getStringFromNode" , strValue ) ; return strValue ; |
public class AbstractIncrementalGenerator { /** * This method generates the source code for a public method declaration including the opening brace and indentation .
* @ param sourceWriter is the { @ link SourceWriter } .
* @ param method is the { @ link JMethod } to implement . */
protected final void generateSour... | StringBuilder arguments = new StringBuilder ( ) ; for ( JParameter parameter : method . getParameters ( ) ) { if ( arguments . length ( ) > 0 ) { arguments . append ( ", " ) ; } arguments . append ( parameter . getType ( ) . getQualifiedSourceName ( ) ) ; arguments . append ( " " ) ; arguments . append ( parameter . ge... |
public class MemoryHandler { /** * Store a < tt > LogRecord < / tt > in an internal buffer .
* If there is a < tt > Filter < / tt > , its < tt > isLoggable < / tt >
* method is called to check if the given log record is loggable .
* If not we return . Otherwise the given record is copied into
* an internal circ... | if ( ! isLoggable ( record ) ) { return ; } int ix = ( start + count ) % buffer . length ; buffer [ ix ] = record ; if ( count < buffer . length ) { count ++ ; } else { start ++ ; start %= buffer . length ; } if ( record . getLevel ( ) . intValue ( ) >= pushLevel . intValue ( ) ) { push ( ) ; } |
public class StringUtils { /** * Case insensitive version of { @ link String # indexOf ( java . lang . String , int ) } . Equivalent to
* { @ code text . indexOf ( str , startIndex ) } , except the matching is case insensitive . */
public static int indexOfIgnoreCase ( String text , String str , int startIndex ) { } ... | Matcher m = Pattern . compile ( Pattern . quote ( str ) , Pattern . CASE_INSENSITIVE ) . matcher ( text ) ; return m . find ( startIndex ) ? m . start ( ) : - 1 ; |
public class PersistentEntityStoreImpl { /** * Deletes specified entity clearing all its properties and deleting all its outgoing links .
* @ param entity to delete . */
boolean deleteEntity ( @ NotNull final PersistentStoreTransaction txn , @ NotNull final PersistentEntity entity ) { } } | clearProperties ( txn , entity ) ; clearBlobs ( txn , entity ) ; deleteLinks ( txn , entity ) ; final PersistentEntityId id = entity . getId ( ) ; final int entityTypeId = id . getTypeId ( ) ; final long entityLocalId = id . getLocalId ( ) ; final ByteIterable key = LongBinding . longToCompressedEntry ( entityLocalId )... |
public class ResourceUtils { /** * Convenient method to get resources from adaptables
* @ param element
* an IAdaptable object which may provide an adapter for
* IResource
* @ return resource object or null */
@ javax . annotation . CheckForNull public static IResource getResource ( Object element ) { } } | if ( element instanceof IJavaElement ) { return ( ( IJavaElement ) element ) . getResource ( ) ; } return Util . getAdapter ( IResource . class , element ) ; |
public class LongUnaryOperatorBuilder { /** * 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 LongUnaryOperator longUnaryOperatorFrom ( Consumer < LongUnaryOperatorBuilder > buildingFunction ) { } } | LongUnaryOperatorBuilder builder = new LongUnaryOperatorBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class AOProtocolItemStream { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . impl . store . itemstreams . SIMPItemStream # getPersistentData ( java . io . ObjectOutputStream ) */
public void getPersistentData ( ObjectOutputStream dout ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getPersistentData" , dout ) ; try { dout . writeUTF ( remoteMEId . toString ( ) ) ; dout . writeUTF ( streamId . toString ( ) ) ; String id = NULL ; if ( gatheringTargetDestUuid != null ) id = gatheringTargetDestUuid . toSt... |
public class CacheingSearchResults { /** * Caches a matcher */
void setMatcher ( ContentMatcher m ) { } } | if ( tc . isEntryEnabled ( ) ) tc . entry ( this , cclass , "setMatcher" , "matcher: " + m + ", hasContent: " + new Boolean ( hasContent ) ) ; wildMatchers . add ( m ) ; this . hasContent |= m . hasTests ( ) ; if ( tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "setMatcher" ) ; |
public class ShardCache { /** * Clear all cached shard information for the given application .
* @ param appDef { @ link ApplicationDefinition } of an application . */
public synchronized void clear ( ApplicationDefinition appDef ) { } } | String appName = appDef . getAppName ( ) ; for ( TableDefinition tableDef : appDef . getTableDefinitions ( ) . values ( ) ) { m_cacheMap . remove ( appName + "/" + tableDef . getTableName ( ) ) ; // might have no entry
} m_appShardMap . remove ( appName ) ; |
public class EventImpl { /** * { @ inheritDoc } */
public void waitForCompletion ( ) { } } | if ( futures == null ) { return ; } for ( Future < ? > future : futures ) { try { future . wait ( ) ; } catch ( InterruptedException e ) { // TODO Should we catch the exception or should we throw it ?
// Instrumentation will log to ffdc
} } |
public class BodyFilters { /** * Creates a { @ link BodyFilter } that replaces the properties in the form url encoded body with given replacement .
* @ param properties query names properties to replace
* @ param replacement String to replace the properties values
* @ return BodyFilter generated */
@ API ( status... | final Predicate < String > formUrlEncoded = MediaTypeQuery . compile ( "application/x-www-form-urlencoded" ) ; final QueryFilter delegate = properties . stream ( ) . map ( name -> QueryFilters . replaceQuery ( name , replacement ) ) . reduce ( QueryFilter :: merge ) . orElseGet ( QueryFilter :: none ) ; return ( conten... |
public class ListClosedWorkflowExecutionsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListClosedWorkflowExecutionsRequest listClosedWorkflowExecutionsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listClosedWorkflowExecutionsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listClosedWorkflowExecutionsRequest . getDomain ( ) , DOMAIN_BINDING ) ; protocolMarshaller . marshall ( listClosedWorkflowExecutionsRequest . getSta... |
public class ReflectUtils { /** * 调用方法
* @ param object 对象
* @ param methodName 方法名
* @ param parameterTypes 参数类型
* @ param parameters 参数
* @ return 方法返回的结果
* @ throws NoSuchMethodException 异常
* @ throws InvocationTargetException 异常
* @ throws IllegalAccessException 异常 */
public static Object invokeMeth... | if ( Checker . isEmpty ( parameters ) ) { return object . getClass ( ) . getMethod ( methodName ) . invoke ( object ) ; } else { return object . getClass ( ) . getMethod ( methodName , parameterTypes ) . invoke ( object , parameters ) ; } |
public class Parser { /** * 12.5 If Statement */
private IfStatementTree parseIfStatement ( ) { } } | SourcePosition start = getTreeStartLocation ( ) ; eat ( TokenType . IF ) ; eat ( TokenType . OPEN_PAREN ) ; ParseTree condition = parseExpression ( ) ; eat ( TokenType . CLOSE_PAREN ) ; ParseTree ifClause = parseStatement ( ) ; ParseTree elseClause = null ; if ( peek ( TokenType . ELSE ) ) { eat ( TokenType . ELSE ) ; ... |
public class XsdGeneratorHelper { /** * Parses the provided InputStream to create a dom Document .
* @ param xmlStream An InputStream connected to an XML document .
* @ return A DOM Document created from the contents of the provided stream . */
public static Document parseXmlStream ( final Reader xmlStream ) { } } | // Build a DOM model of the provided xmlFileStream .
final DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; try { return factory . newDocumentBuilder ( ) . parse ( new InputSource ( xmlStream ) ) ; } catch ( Exception e ) { throw new IllegalArgumentExcep... |
public class RetryingReadRowsOperation { /** * Special retry handling for watchdog timeouts , which uses its own fail counter .
* @ return true if a retry has been scheduled */
private void handleTimeoutError ( Status status ) { } } | Preconditions . checkArgument ( status . getCause ( ) instanceof StreamWaitTimeoutException , "status is not caused by a StreamWaitTimeoutException" ) ; StreamWaitTimeoutException e = ( ( StreamWaitTimeoutException ) status . getCause ( ) ) ; // Cancel the existing rpc .
rpcTimerContext . close ( ) ; failedCount ++ ; /... |
public class IonizationPotentialTool { /** * Looking if the IAtom belongs to the halogen family .
* The IAtoms are F , Cl , Br , I .
* @ param atom The IAtom
* @ return True , if it belongs */
private static boolean familyHalogen ( IAtom atom ) { } } | String symbol = atom . getSymbol ( ) ; if ( symbol . equals ( "F" ) || symbol . equals ( "Cl" ) || symbol . equals ( "Br" ) || symbol . equals ( "I" ) ) return true ; else return false ; |
public class BatchWriteItemResult { /** * The response object as a result of < code > BatchWriteItem < / code > call .
* This is essentially a map of table name to
* < code > ConsumedCapacityUnits < / code > .
* Returns a reference to this object so that method calls can be chained together .
* @ param response... | setResponses ( responses ) ; return this ; |
public class CloudStorageFileSystemProvider { /** * Lists the project ' s buckets . But use the one in CloudStorageFileSystem .
* < p > Example of listing buckets , specifying the page size and a name prefix .
* < pre > { @ code
* String prefix = " bucket _ " ;
* Page < Bucket > buckets = provider . listBuckets... | initStorage ( ) ; return storage . list ( options ) ; |
public class DistributedFileSystem { /** * Fetch the list of files that have been open longer than a
* specified amount of time .
* @ param prefix path prefix specifying subset of files to examine
* @ param millis select files that have been open longer that this
* @ param start where to start searching in the ... | return dfs . iterativeGetOpenFiles ( prefix , millis , start ) ; |
public class FunctionCall { /** * Returns the parameter at the expected index .
* @ param index the number of the parameter to access
* @ return the expression representing at the given index
* @ throws IllegalArgumentException if the index is out of bounds */
public Expression getExpectedParam ( int index ) { } ... | if ( parameters . size ( ) <= index ) { throw new IllegalArgumentException ( "Parameter index out of bounds: " + index + ". Function call: " + this ) ; } return parameters . get ( index ) ; |
public class Utils { /** * Closes a result set .
* @ param st
* @ param logger */
public static void closeResultSet ( ResultSet resultSet , Logger logger ) { } } | try { if ( resultSet != null ) resultSet . close ( ) ; } catch ( SQLException e ) { // Not important .
Utils . logException ( logger , e ) ; } |
public class ClustersInner { /** * Creates a new HDInsight cluster with the specified parameters .
* @ param resourceGroupName The name of the resource group .
* @ param clusterName The name of the cluster .
* @ param parameters The cluster create request .
* @ param serviceCallback the async ServiceCallback to... | return ServiceFuture . fromResponse ( createWithServiceResponseAsync ( resourceGroupName , clusterName , parameters ) , serviceCallback ) ; |
public class AppServiceEnvironmentsInner { /** * Get properties of a multi - role pool .
* Get properties of a multi - role pool .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service Environment .
* @ param serviceCallback the async Servi... | return ServiceFuture . fromResponse ( getMultiRolePoolWithServiceResponseAsync ( resourceGroupName , name ) , serviceCallback ) ; |
public class SamlProfileSamlAssertionBuilder { /** * Sign assertion .
* @ param assertion the assertion
* @ param request the request
* @ param response the response
* @ param service the service
* @ param adaptor the adaptor
* @ param binding the binding
* @ param authnRequest the authn request
* @ thr... | if ( service . isSignAssertions ( ) ) { LOGGER . debug ( "SAML registered service [{}] requires assertions to be signed" , adaptor . getEntityId ( ) ) ; samlObjectSigner . encode ( assertion , service , adaptor , response , request , binding , authnRequest ) ; } else { LOGGER . debug ( "SAML registered service [{}] doe... |
public class AsyncAccessEventAppenderFactory { /** * Creates an { @ link AsyncAppenderFactory } of type { @ link IAccessEvent } that prepares events
* for deferred processing
* @ return the { @ link AsyncAppenderFactory } */
@ Override public AsyncAppenderBase < IAccessEvent > build ( ) { } } | return new AsyncAppenderBase < IAccessEvent > ( ) { @ Override protected void preprocess ( IAccessEvent event ) { event . prepareForDeferredProcessing ( ) ; } } ; |
public class EnvironmentSettingsInner { /** * Starts a template by starting all resources inside the template . This operation can take a while to complete .
* @ param resourceGroupName The name of the resource group .
* @ param labAccountName The name of the lab Account .
* @ param labName The name of the lab . ... | startWithServiceResponseAsync ( resourceGroupName , labAccountName , labName , environmentSettingName ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class MaxAgeWhereClauseMatchCriteria { /** * { @ inheritDoc } */
public List < ? > getParameterValues ( ) { } } | final Calendar cal = Calendar . getInstance ( ) ; cal . add ( Calendar . DAY_OF_MONTH , - this . maxAge ) ; return Collections . singletonList ( cal . getTime ( ) ) ; |
public class LambdaUtil { /** * Runs the given runnable with the given ClassLoader as the thread ' s
* { @ link Thread # setContextClassLoader ( ClassLoader ) context class loader } .
* < p > The method will make sure to set the context class loader of the calling thread
* back to what it was before after the run... | try ( TemporaryClassLoaderContext tmpCl = new TemporaryClassLoaderContext ( cl ) ) { return s . get ( ) ; } |
public class ValidationContext { /** * Asserts that the string represents a valid reference path expression .
* @ param path Path expression to validate .
* @ param propertyName Name of property . */
public void assertIsValidReferencePath ( String path , String propertyName ) { } } | if ( path == null ) { return ; } if ( path . isEmpty ( ) ) { problemReporter . report ( new Problem ( this , String . format ( "%s cannot be empty" , propertyName ) ) ) ; return ; } |
public class ExecuteMethodChecker { protected void checkJsonBeanValidator ( ) { } } | final Class < ? > returnType = executeMethod . getReturnType ( ) ; if ( ! JsonResponse . class . isAssignableFrom ( returnType ) ) { return ; } final Type genericReturnType = executeMethod . getGenericReturnType ( ) ; if ( genericReturnType == null || ! ( genericReturnType instanceof ParameterizedType ) ) { // just in ... |
public class WaveformFinder { /** * We have received notification that a device is no longer on the network , so clear out all its waveforms .
* @ param announcement the packet which reported the device ’ s disappearance */
private void clearWaveforms ( DeviceAnnouncement announcement ) { } } | final int player = announcement . getNumber ( ) ; // Iterate over a copy to avoid concurrent modification issues
for ( DeckReference deck : new HashSet < DeckReference > ( previewHotCache . keySet ( ) ) ) { if ( deck . player == player ) { previewHotCache . remove ( deck ) ; if ( deck . hotCue == 0 ) { deliverWaveformP... |
public class Task { /** * - - - - - OTHER METHODS - - - - - */
final boolean abort ( ) { } } | if ( ! taken . get ( ) ) { // aborting always runs before connection
// happens . If we reach this point the request
// can be active or suspended
// but nor delivered or committed
result = BaasResult . cancel ( ) ; // we can simply forcefully set the value
// to ABORTED to let the resource been cleaned up
suspendableH... |
public class ScriptsActiveScanner { /** * Tells whether or not the scanner should be skipped . The scanner should be skipped when the { @ code ExtensionScript } is not
* enabled , when there are no scripts , or if there are none is enabled .
* @ return { @ code true } if the scanner should be skipped , { @ code fal... | if ( this . getExtension ( ) == null ) { return true ; } List < ScriptWrapper > scripts = getActiveScripts ( ) ; if ( scripts . isEmpty ( ) ) { return true ; } for ( ScriptWrapper script : scripts ) { if ( script . isEnabled ( ) ) { return false ; } } return true ; |
public class VirtualHost { /** * Method findContext .
* @ param path
* @ return ServletContext */
public ServletContext findContext ( String path ) { } } | WebGroup g = ( WebGroup ) requestMapper . map ( path ) ; if ( g != null ) return g . getContext ( ) ; else return null ; |
public class PropertiesUtils { /** * Extract all the keys that start with a < code > prefix < / code > in { @ link Properties } to a new { @ link Properties }
* instance .
* @ param properties the given { @ link Properties } instance
* @ param prefix of keys to be extracted
* @ return a { @ link Properties } in... | Preconditions . checkNotNull ( properties ) ; Preconditions . checkNotNull ( prefix ) ; Properties extractedProperties = new Properties ( ) ; for ( Map . Entry < Object , Object > entry : properties . entrySet ( ) ) { if ( StringUtils . startsWith ( entry . getKey ( ) . toString ( ) , prefix . or ( StringUtils . EMPTY ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.