signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class DumpProcessingController { /** * Registers an MwRevisionProcessor , which will henceforth be notified of
* all revisions that are encountered in the dump .
* This only is used when processing dumps that contain revisions . In
* particular , plain JSON dumps contain no revision information .
* Impor... | registerProcessor ( mwRevisionProcessor , model , onlyCurrentRevisions , this . mwRevisionProcessors ) ; |
public class GuacamoleWebSocketTunnelServlet { /** * Sends the given status on the given WebSocket connection
* and closes the connection .
* @ param connection
* The WebSocket connection to close .
* @ param guacStatus
* The status to send . */
private static void closeConnection ( Connection connection , Gu... | closeConnection ( connection , guacStatus . getGuacamoleStatusCode ( ) , guacStatus . getWebSocketCode ( ) ) ; |
public class AbstractFormatter { /** * Is given object < i > empty < / i > ( null or empty string ) ? */
protected boolean isEmpty ( Object o ) { } } | if ( o == null ) { return true ; } else if ( o instanceof String ) { return ! StringUtils . hasText ( ( String ) o ) ; } else { return false ; } |
public class TransportResolver { /** * Initialize Transport Resolver and wait until it is completely uninitialized .
* @ throws SmackException
* @ throws InterruptedException */
public void initializeAndWait ( ) throws XMPPException , SmackException , InterruptedException { } } | this . initialize ( ) ; try { LOGGER . fine ( "Initializing transport resolver..." ) ; while ( ! this . isInitialized ( ) ) { LOGGER . fine ( "Resolver init still pending" ) ; Thread . sleep ( 1000 ) ; } LOGGER . fine ( "Transport resolved" ) ; } catch ( Exception e ) { LOGGER . log ( Level . WARNING , "exception" , e ... |
public class EnhancedDebugger { /** * Adds the received stanza detail to the messages table .
* @ param dateFormatter the SimpleDateFormat to use to format Dates
* @ param packet the read stanza to add to the table */
private void addReadPacketToTable ( final SimpleDateFormat dateFormatter , final TopLevelStreamEle... | SwingUtilities . invokeLater ( new Runnable ( ) { @ Override public void run ( ) { String messageType ; Jid from ; String stanzaId ; if ( packet instanceof Stanza ) { Stanza stanza = ( Stanza ) packet ; from = stanza . getFrom ( ) ; stanzaId = stanza . getStanzaId ( ) ; } else { from = null ; stanzaId = "(Nonza)" ; } S... |
public class PartOfSpeechTagDictionary { /** * 翻译词性
* @ param tag
* @ return */
public static String translate ( String tag ) { } } | String cn = translator . get ( tag ) ; if ( cn == null ) return tag ; return cn ; |
public class ReflectUtil { /** * Returns the setter - method for the given field name or null if no setter exists . */
public static Method getSetter ( String fieldName , Class < ? > clazz , Class < ? > fieldType ) { } } | String setterName = buildSetterName ( fieldName ) ; try { // Using getMathods ( ) , getMathod ( . . . ) expects exact parameter type
// matching and ignores inheritance - tree .
Method [ ] methods = clazz . getMethods ( ) ; for ( Method method : methods ) { if ( method . getName ( ) . equals ( setterName ) ) { Class < ... |
public class DefaultArtifactUtil { /** * { @ inheritDoc } */
public Set < Artifact > resolveTransitively ( Set < Artifact > jarResourceArtifacts , Set < MavenProject > siblingProjects , Artifact originateArtifact , ArtifactRepository localRepository , List < ArtifactRepository > remoteRepositories , ArtifactFilter arti... | Set < Artifact > resultArtifacts = new LinkedHashSet < > ( ) ; if ( CollectionUtils . isNotEmpty ( siblingProjects ) ) { // getting transitive dependencies from project
for ( MavenProject siblingProject : siblingProjects ) { Set < Artifact > artifacts = siblingProject . getArtifacts ( ) ; for ( Artifact artifact : arti... |
public class AbstractAgiServer { /** * Creates a new ThreadPoolExecutor to serve the AGI requests . The nature of
* this pool defines how many concurrent requests can be handled . The
* default implementation returns a dynamic thread pool defined by the
* poolSize and maximumPoolSize properties .
* You can over... | return new ThreadPoolExecutor ( poolSize , ( maximumPoolSize < poolSize ) ? poolSize : maximumPoolSize , 50000L , TimeUnit . MILLISECONDS , new SynchronousQueue < Runnable > ( ) , new DaemonThreadFactory ( ) ) ; |
public class CassandraClientBase { /** * Sets the batch size .
* @ param persistenceUnit
* the persistence unit
* @ param puProperties
* the pu properties */
private void setBatchSize ( String persistenceUnit , Map < String , Object > puProperties ) { } } | String batch_Size = null ; PersistenceUnitMetadata puMetadata = KunderaMetadataManager . getPersistenceUnitMetadata ( kunderaMetadata , persistenceUnit ) ; String externalBatchSize = puProperties != null ? ( String ) puProperties . get ( PersistenceProperties . KUNDERA_BATCH_SIZE ) : null ; Integer intbatch = null ; if... |
public class CharStreams { /** * Copies all characters between the { @ link Readable } and { @ link Appendable } objects . Does not
* close or flush either object .
* @ param from the object to read from
* @ param to the object to write to
* @ return the number of characters copied
* @ throws IOException if a... | checkNotNull ( from ) ; checkNotNull ( to ) ; CharBuffer buf = createBuffer ( ) ; long total = 0 ; while ( from . read ( buf ) != - 1 ) { buf . flip ( ) ; to . append ( buf ) ; total += buf . remaining ( ) ; buf . clear ( ) ; } return total ; |
public class NetworkProfileMarshaller { /** * Marshall the given parameter object . */
public void marshall ( NetworkProfile networkProfile , ProtocolMarshaller protocolMarshaller ) { } } | if ( networkProfile == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( networkProfile . getArn ( ) , ARN_BINDING ) ; protocolMarshaller . marshall ( networkProfile . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( networkProfi... |
public class cacheobject { /** * Use this API to fetch all the cacheobject resources that are configured on netscaler . */
public static cacheobject [ ] get ( nitro_service service ) throws Exception { } } | cacheobject obj = new cacheobject ( ) ; cacheobject [ ] response = ( cacheobject [ ] ) obj . get_resources ( service ) ; return response ; |
public class BaseImageRecordReader { /** * Called once at initialization .
* @ param conf a configuration for initialization
* @ param split the split that defines the range of records to read
* @ param imageTransform the image transform to use to transform images while loading them
* @ throws java . io . IOExc... | this . imageLoader = null ; this . imageTransform = imageTransform ; initialize ( conf , split ) ; |
public class GrammaticalStructure { /** * Get a list of GrammaticalRelation between gov and dep . Useful for getting extra dependencies , in which
* two nodes can be linked by multiple arcs . */
public static List < GrammaticalRelation > getListGrammaticalRelation ( TreeGraphNode gov , TreeGraphNode dep ) { } } | List < GrammaticalRelation > list = new ArrayList < GrammaticalRelation > ( ) ; TreeGraphNode govH = gov . highestNodeWithSameHead ( ) ; TreeGraphNode depH = dep . highestNodeWithSameHead ( ) ; /* System . out . println ( " Extra gov node " + gov ) ;
System . out . println ( " govH " + govH ) ;
System . out . print... |
public class JawrWicketLinkTagHandler { /** * ( non - Javadoc )
* @ see
* org . apache . wicket . markup . parser . AbstractMarkupFilter # onComponentTag ( org
* . apache . wicket . markup . ComponentTag ) */
@ Override protected MarkupElement onComponentTag ( ComponentTag tag ) throws ParseException { } } | if ( tag == null ) { return tag ; } // Only xml tags not already identified as Wicket components will be
// considered for autolinking . This is because it is assumed that Wicket
// components like images or all other kind of Wicket Links will handle
// it themselves .
// Subclass analyzeAutolinkCondition ( ) to implem... |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcOrientedEdge ( ) { } } | if ( ifcOrientedEdgeEClass == null ) { ifcOrientedEdgeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 401 ) ; } return ifcOrientedEdgeEClass ; |
public class DayOfMonthValueMatcher { /** * 给定的日期是否匹配当前匹配器
* @ param value 被检查的值 , 此处为日
* @ param month 实际的月份
* @ param isLeapYear 是否闰年
* @ return 是否匹配 */
public boolean match ( int value , int month , boolean isLeapYear ) { } } | return ( super . match ( value ) // 在约定日范围内的某一天
// 匹配器中用户定义了最后一天 ( 32表示最后一天 )
|| ( value > 27 && match ( 32 ) && isLastDayOfMonth ( value , month , isLeapYear ) ) ) ; |
public class JDOExpressions { /** * Create a new detached { @ link JDOQuery } instance with the given projection
* @ param expr projection
* @ param < T >
* @ return select ( expr ) */
public static < T > JDOQuery < T > select ( Expression < T > expr ) { } } | return new JDOQuery < Void > ( ) . select ( expr ) ; |
public class AbstractBox { /** * Gets the full size of the box including header and content .
* @ return the box ' s size */
public long getSize ( ) { } } | long size = isParsed ? getContentSize ( ) : content . limit ( ) ; size += ( 8 + // size | type
( size >= ( ( 1L << 32 ) - 8 ) ? 8 : 0 ) + // 32bit - 8 byte size and type
( UserBox . TYPE . equals ( getType ( ) ) ? 16 : 0 ) ) ; size += ( deadBytes == null ? 0 : deadBytes . limit ( ) ) ; return size ; |
public class FaceDetail { /** * Indicates the location of landmarks on the face . Default attribute .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setLandmarks ( java . util . Collection ) } or { @ link # withLandmarks ( java . util . Collection ) } if you... | if ( this . landmarks == null ) { setLandmarks ( new java . util . ArrayList < Landmark > ( landmarks . length ) ) ; } for ( Landmark ele : landmarks ) { this . landmarks . add ( ele ) ; } return this ; |
public class LongHashMap { /** * Returns index for Object x . */
private static int hash ( long x , int length ) { } } | int h = ( int ) ( x ^ ( x >>> 32 ) ) ; // This function ensures that hashCodes that differ only by
// constant multiples at each bit position have a bounded
// number of collisions ( approximately 8 at default load factor ) .
h ^= ( h >>> 20 ) ^ ( h >>> 12 ) ; h ^= ( h >>> 7 ) ^ ( h >>> 4 ) ; return ( h ) & ( length - ... |
public class AnnotationScannerFactory { /** * Get the annotation scanner
* @ return The scanner */
public static AnnotationScanner getAnnotationScanner ( ) { } } | if ( active != null ) return active ; if ( defaultImplementation == null ) throw new IllegalStateException ( bundle . noAnnotationScanner ( ) ) ; return defaultImplementation ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link AbstractReferenceSystemType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link AbstractReferenceSys... | return new JAXBElement < AbstractReferenceSystemType > ( __ReferenceSystem_QNAME , AbstractReferenceSystemType . class , null , value ) ; |
public class SREsPreferencePage { /** * Returns the default SRE or < code > null < / code > if none .
* @ return the default SRE or < code > null < / code > if none */
public ISREInstall getDefaultSRE ( ) { } } | final Object [ ] objects = this . sresList . getCheckedElements ( ) ; if ( objects . length == 0 ) { return null ; } return ( ISREInstall ) objects [ 0 ] ; |
public class IconicsDrawable { /** * Set contour color from color res .
* @ return The current IconicsDrawable for chaining . */
@ NonNull public IconicsDrawable contourColorRes ( @ ColorRes int colorResId ) { } } | return contourColor ( ContextCompat . getColor ( mContext , colorResId ) ) ; |
public class HAConfUtil { /** * Is value of b smaller than value of a .
* @ return True , if b is smaller than a . Always true , if value of a is null . */
static boolean isSmaller ( Long a , Long b ) { } } | return a == null || ( b != null && b < a ) ; |
public class StatementHandle { /** * # ifdef JDK > 6 */
public void setPoolable ( boolean poolable ) throws SQLException { } } | checkClosed ( ) ; try { this . internalStatement . setPoolable ( poolable ) ; } catch ( SQLException e ) { throw this . connectionHandle . markPossiblyBroken ( e ) ; } |
public class ChangeLogActivity { /** * Lifecycle Methods */
@ Override protected void onCreate ( Bundle savedInstanceState ) { } } | super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . activity_changelog ) ; mAppbar = ButterKnife . findById ( this , R . id . appbar ) ; mContainer = ButterKnife . findById ( this , R . id . container ) ; configAppBar ( ) ; parseExtras ( savedInstanceState ) ; |
public class AbcGrammar { /** * paren - voice : : = " ( " single - voice 1 * ( 1 * WSP single - voice ) " ) "
* on same staff */
Rule ParenVoice ( ) { } } | return Sequence ( '(' , SingleVoice ( ) , OneOrMore ( Sequence ( OneOrMore ( WSP ( ) ) , SingleVoice ( ) ) ) ) . label ( ParenVoice ) ; |
public class Team { /** * Update a group of oTask / Activity records
* @ param company Company ID
* @ param params Parameters
* @ throwsJSONException If error occurred
* @ return { @ link JSONObject } */
public JSONObject updateBatch ( String company , HashMap < String , String > params ) throws JSONException {... | return oClient . put ( "/otask/v1/tasks/companies/" + company + "/tasks/batch" , params ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcRelConnects ( ) { } } | if ( ifcRelConnectsEClass == null ) { ifcRelConnectsEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 533 ) ; } return ifcRelConnectsEClass ; |
public class RNCryptorNative { /** * Decrypts encrypted base64 string and returns via callback
* @ param encrypted base64 string
* @ param password strong generated password
* @ param RNCryptorNativeCallback just a callback */
public static void decryptAsync ( String encrypted , String password , RNCryptorNativeC... | String decrypted ; try { decrypted = new RNCryptorNative ( ) . decrypt ( encrypted , password ) ; RNCryptorNativeCallback . done ( decrypted , null ) ; } catch ( Exception e ) { RNCryptorNativeCallback . done ( null , e ) ; } |
public class SVG { /** * Change the width of the document by altering the " width " attribute
* of the root { @ code < svg > } element .
* @ param value A valid SVG ' length ' attribute , such as " 100px " or " 10cm " .
* @ throws SVGParseException if { @ code value } cannot be parsed successfully .
* @ throws ... | "WeakerAccess" , "unused" } ) public void setDocumentWidth ( String value ) throws SVGParseException { if ( this . rootElement == null ) throw new IllegalArgumentException ( "SVG document is empty" ) ; this . rootElement . width = SVGParser . parseLength ( value ) ; |
public class ZealotKhala { /** * 生成带 " OR " 前缀大于等于查询的SQL片段 .
* @ param field 数据库字段
* @ param value 值
* @ return ZealotKhala实例 */
public ZealotKhala orMoreEqual ( String field , Object value ) { } } | return this . doNormal ( ZealotConst . OR_PREFIX , field , value , ZealotConst . GTE_SUFFIX , true ) ; |
public class LargestChainDescriptor { /** * Gets the parameters attribute of the LargestChainDescriptor object .
* @ return The parameters value
* @ see # setParameters */
@ Override public Object [ ] getParameters ( ) { } } | // return the parameters as used for the descriptor calculation
Object [ ] params = new Object [ 2 ] ; params [ 0 ] = checkAromaticity ; params [ 1 ] = checkRingSystem ; return params ; |
public class TypeVariableName { /** * Returns type variable equivalent to { @ code element } . */
public static TypeVariableName get ( TypeParameterElement element ) { } } | String name = element . getSimpleName ( ) . toString ( ) ; List < ? extends TypeMirror > boundsMirrors = element . getBounds ( ) ; List < TypeName > boundsTypeNames = new ArrayList < > ( ) ; for ( TypeMirror typeMirror : boundsMirrors ) { boundsTypeNames . add ( TypeName . get ( typeMirror ) ) ; } return TypeVariableNa... |
public class ZooKeeperMasterModel { /** * Undeploys the job specified by { @ code jobId } on { @ code host } . */
@ Override public Deployment undeployJob ( final String host , final JobId jobId , final String token ) throws HostNotFoundException , JobNotDeployedException , TokenVerificationException { } } | log . info ( "undeploying {}: {}" , jobId , host ) ; final ZooKeeperClient client = provider . get ( "undeployJob" ) ; assertHostExists ( client , host ) ; final Deployment deployment = getDeployment ( host , jobId ) ; if ( deployment == null ) { throw new JobNotDeployedException ( host , jobId ) ; } final Job job = ge... |
public class RubyOutputHandler { /** * rb _ syck _ output _ handler */
public void handle ( Emitter emitter , byte [ ] str , int len ) { } } | YEmitter . Extra bonus = ( YEmitter . Extra ) emitter . bonus ; IRubyObject dest = bonus . port ; if ( dest instanceof RubyString ) { ( ( RubyString ) dest ) . cat ( new ByteList ( str , 0 , len , false ) ) ; } else { dest . callMethod ( runtime . getCurrentContext ( ) , "write" , RubyString . newStringShared ( runtime... |
public class JSONValue { /** * remap field from java to json .
* @ since 2.1.1 */
public static < T > void remapField ( Class < T > type , String jsonFieldName , String javaFieldName ) { } } | defaultReader . remapField ( type , jsonFieldName , javaFieldName ) ; defaultWriter . remapField ( type , javaFieldName , jsonFieldName ) ; |
public class ApiOvhHostingreseller { /** * Change language of the Plesk instance
* REST : POST / hosting / reseller / { serviceName } / language
* @ param serviceName [ required ] The internal name of your reseller service
* @ param language [ required ] Locale value */
public String serviceName_language_POST ( S... | String qPath = "/hosting/reseller/{serviceName}/language" ; StringBuilder sb = path ( qPath , serviceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "language" , language ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , String . c... |
public class PotentialDeclaration { /** * Remove this " potential declaration " completely .
* Usually , this is because the same symbol has already been declared in this file . */
final void remove ( AbstractCompiler compiler ) { } } | if ( isDetached ( ) ) { return ; } Node statement = getRemovableNode ( ) ; NodeUtil . deleteNode ( statement , compiler ) ; statement . removeChildren ( ) ; |
public class HttpRequestFactory { /** * Builds a { @ code DELETE } request for the given URL .
* @ param url HTTP request URL or { @ code null } for none
* @ return new HTTP request */
public HttpRequest buildDeleteRequest ( GenericUrl url ) throws IOException { } } | return buildRequest ( HttpMethods . DELETE , url , null ) ; |
public class CommerceCountryUtil { /** * Returns a range of all the commerce countries where groupId = & # 63 ; and shippingAllowed = & # 63 ; and active = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code... | return getPersistence ( ) . findByG_S_A ( groupId , shippingAllowed , active , start , end ) ; |
public class SID { /** * Adds sub - authority : a principal relative to the IdentifierAuthority .
* @ param sub sub - authority .
* @ return the current SID instance . */
public SID addSubAuthority ( byte [ ] sub ) { } } | if ( sub == null || sub . length != 4 ) { throw new IllegalArgumentException ( "Invalid sub-authority to be added" ) ; } this . subAuthorities . add ( Arrays . copyOf ( sub , sub . length ) ) ; return this ; |
public class AgentUtils { /** * Collect the main log files into a map .
* @ param karafData the Karaf ' s data directory
* @ return a non - null map */
public static Map < String , byte [ ] > collectLogs ( String karafData ) throws IOException { } } | Map < String , byte [ ] > logFiles = new HashMap < > ( 2 ) ; if ( ! Utils . isEmptyOrWhitespaces ( karafData ) ) { String [ ] names = { "karaf.log" , "roboconf.log" } ; for ( String name : names ) { File log = new File ( karafData , AgentConstants . KARAF_LOGS_DIRECTORY + "/" + name ) ; if ( ! log . exists ( ) ) contin... |
public class WebDriverHelper { /** * Gets a profile with a specific user agent with or without javascript
* enabled .
* @ param userAgent
* the user agent
* @ param javascriptEnabled
* javascript enabled or not
* @ return a FirefoxDriver instance with javascript and user agent seetigs
* configured */
publ... | FirefoxProfile profile = new FirefoxProfile ( ) ; profile . setPreference ( "general.useragent.override" , userAgent ) ; profile . setPreference ( "javascript.enabled" , javascriptEnabled ) ; WebDriver driver = new FirefoxDriver ( profile ) ; return driver ; |
public class AWSGlueClient { /** * Deletes a specified trigger . If the trigger is not found , no exception is thrown .
* @ param deleteTriggerRequest
* @ return Result of the DeleteTrigger operation returned by the service .
* @ throws InvalidInputException
* The input provided was not valid .
* @ throws Int... | request = beforeClientExecution ( request ) ; return executeDeleteTrigger ( request ) ; |
public class PiwikRequest { /** * Set a stored parameter and verify it is a non - empty string .
* @ param key the parameter ' s key
* @ param value the parameter ' s value . Cannot be the empty . Removes the parameter if null
* string */
private void setNonEmptyStringParameter ( String key , String value ) { } } | if ( value == null ) { parameters . remove ( key ) ; } else if ( value . length ( ) == 0 ) { throw new IllegalArgumentException ( "Value cannot be empty." ) ; } else { parameters . put ( key , value ) ; } |
public class DefaultGroovyMethods { /** * Finds all permutations of an iterable .
* Example usage :
* < pre class = " groovyTestCase " > def result = [ 1 , 2 , 3 ] . permutations ( )
* assert result = = [ [ 3 , 2 , 1 ] , [ 3 , 1 , 2 ] , [ 1 , 3 , 2 ] , [ 2 , 3 , 1 ] , [ 2 , 1 , 3 ] , [ 1 , 2 , 3 ] ] as Set < / pr... | Set < List < T > > ans = new HashSet < List < T > > ( ) ; PermutationGenerator < T > generator = new PermutationGenerator < T > ( self ) ; while ( generator . hasNext ( ) ) { ans . add ( generator . next ( ) ) ; } return ans ; |
public class Toothpick { /** * Opens a scope without any parent .
* If a scope by this { @ code name } already exists , it is returned .
* Otherwise a new scope is created .
* @ param name the name of the scope to open .
* @ param shouldCheckMultipleRootScopes whether or not to check that the return scope
* i... | if ( name == null ) { throw new IllegalArgumentException ( "null scope names are not allowed." ) ; } Scope scope = MAP_KEY_TO_SCOPE . get ( name ) ; if ( scope != null ) { return scope ; } scope = new ScopeImpl ( name ) ; Scope previous = MAP_KEY_TO_SCOPE . putIfAbsent ( name , scope ) ; if ( previous != null ) { // if... |
public class PCMProcessors { /** * Process the StreamInfo block .
* @ param info the StreamInfo block
* @ see de . quippy . jflac . PCMProcessor # processStreamInfo ( de . quippy . jflac . metadata . StreamInfo ) */
public void processStreamInfo ( StreamInfo info ) { } } | synchronized ( pcmProcessors ) { Iterator < PCMProcessor > it = pcmProcessors . iterator ( ) ; while ( it . hasNext ( ) ) { PCMProcessor processor = ( PCMProcessor ) it . next ( ) ; processor . processStreamInfo ( info ) ; } } |
public class Communication { /** * Information about the attachments to the case communication .
* @ return Information about the attachments to the case communication . */
public java . util . List < AttachmentDetails > getAttachmentSet ( ) { } } | if ( attachmentSet == null ) { attachmentSet = new com . amazonaws . internal . SdkInternalList < AttachmentDetails > ( ) ; } return attachmentSet ; |
public class TcpClient { /** * Setup all lifecycle callbacks called on or after { @ link io . netty . channel . Channel }
* has been connected and after it has been disconnected .
* @ param doOnConnect a consumer observing client start event
* @ param doOnConnected a consumer observing client started event
* @ ... | Objects . requireNonNull ( doOnConnect , "doOnConnect" ) ; Objects . requireNonNull ( doOnConnected , "doOnConnected" ) ; Objects . requireNonNull ( doOnDisconnected , "doOnDisconnected" ) ; return new TcpClientDoOn ( this , doOnConnect , doOnConnected , doOnDisconnected ) ; |
public class JFapByteBuffer { /** * This method will create a new WsByteBuffer . By default it will be created to hold 200 bytes
* but if the size needed is larger than this then the buffer will simply be allocated to hold
* the exact number of bytes requested .
* @ param sizeNeeded The amount of data waiting to ... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createNewWsByteBuffer" , Integer . valueOf ( sizeNeeded ) ) ; if ( sizeNeeded < DEFAULT_BUFFER_SIZE ) { sizeNeeded = DEFAULT_BUFFER_SIZE ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) ... |
public class UtilIO { /** * Opens up a dialog box asking the user to select a file . If the user cancels
* it either returns null or quits the program .
* @ param exitOnCancel If it should quit on cancel or not .
* @ return Name of the selected file or null if nothing was selected . */
public static String select... | String fileName = null ; JFileChooser fc = new JFileChooser ( ) ; int returnVal = fc . showOpenDialog ( null ) ; if ( returnVal == JFileChooser . APPROVE_OPTION ) { fileName = fc . getSelectedFile ( ) . getAbsolutePath ( ) ; } else if ( exitOnCancel ) { System . exit ( 0 ) ; } return fileName ; |
public class ClusteredCacheConfigurationAdd { /** * Create a Configuration object initialized from the data in the operation .
* @ param cache data representing cache configuration
* @ param builder
* @ param dependencies
* @ return initialised Configuration object */
@ Override void processModelNode ( Operatio... | // process cache attributes and elements
super . processModelNode ( context , containerName , cache , builder , dependencies ) ; // adjust the cache mode used based on the value of clustered attribute MODE
ModelNode modeModel = ClusteredCacheConfigurationResource . MODE . resolveModelAttribute ( context , cache ) ; Cac... |
public class StringUtil { /** * Removes all other characters from a string except digits . A good way
* of cleaing up something like a phone number .
* @ param str0 The string to clean up
* @ return A new String that has all characters except digits removed */
static public String removeAllCharsExceptDigits ( Str... | if ( str0 == null ) { return null ; } if ( str0 . length ( ) == 0 ) { return str0 ; } StringBuilder buf = new StringBuilder ( str0 . length ( ) ) ; int length = str0 . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { char c = str0 . charAt ( i ) ; if ( Character . isDigit ( c ) ) { // append this character to our s... |
public class FlashImpl { /** * Creates a Cookie with the given name and value .
* In addition , it will be configured with maxAge = - 1 , the current request path and secure value .
* @ param name
* @ param value
* @ param externalContext
* @ return */
private Cookie _createFlashCookie ( String name , String ... | Cookie cookie = new Cookie ( name , value ) ; cookie . setMaxAge ( - 1 ) ; cookie . setPath ( _getCookiePath ( externalContext ) ) ; cookie . setSecure ( externalContext . isSecure ( ) ) ; // cookie . setHttpOnly ( true ) ;
if ( ServletSpecifications . isServlet30Available ( ) ) { _Servlet30Utils . setCookieHttpOnly ( ... |
public class ManagerConfiguration { /** * XML Utils */
private Map < String , String > processStartElement ( XMLStreamReader reader , String elementName , String ... requiredAttributes ) throws XMLStreamException { } } | Map < String , String > attrs = processStartElementPrivate ( reader , elementName , requiredAttributes ) ; reader . nextTag ( ) ; return attrs ; |
public class Factory { /** * Create a { @ link Featurable } from its { @ link Media } using a generic way . The concerned class to instantiate and
* its constructor must be public , and can have the following parameter : ( { @ link Setup } ) .
* Automatically add { @ link IdentifiableModel } if feature does not hav... | if ( cache . containsKey ( media ) && ! cache . get ( media ) . isEmpty ( ) ) { final Featurable featurable = cache . get ( media ) . poll ( ) ; featurable . getFeature ( Recycler . class ) . recycle ( ) ; return ( O ) featurable ; } final Setup setup = getSetup ( media ) ; final Class < O > type = setup . getConfigCla... |
public class KriptonContentValues { /** * Adds a value to the set .
* @ param value the data for the value to put */
public void put ( Long value ) { } } | if ( value == null ) { this . compiledStatement . bindNull ( compiledStatementBindIndex ++ ) ; } else { compiledStatement . bindLong ( compiledStatementBindIndex ++ , ( long ) value ) ; } |
public class ListResourceInventoryRequest { /** * One or more filters .
* @ param filters
* One or more filters . */
public void setFilters ( java . util . Collection < InventoryFilter > filters ) { } } | if ( filters == null ) { this . filters = null ; return ; } this . filters = new java . util . ArrayList < InventoryFilter > ( filters ) ; |
public class ThymeleafHtmlRenderer { /** * Thymeleaf ' s reserved words are already checked in Thymeleaf process so no check them here */
protected void checkRegisteredDataUsingReservedWord ( ActionRuntime runtime , WebContext context , String varKey ) { } } | if ( isSuppressRegisteredDataUsingReservedWordCheck ( ) ) { return ; } if ( context . getVariableNames ( ) . contains ( varKey ) ) { throwThymeleafRegisteredDataUsingReservedWordException ( runtime , context , varKey ) ; } |
public class Math { /** * Unitize an array so that L1 norm of x is 1.
* @ param x an array of nonnegative double */
public static void unitize1 ( double [ ] x ) { } } | double n = norm1 ( x ) ; for ( int i = 0 ; i < x . length ; i ++ ) { x [ i ] /= n ; } |
public class CmsSetupBean { /** * Prepares step 8 of the setup wizard . < p >
* @ return true if the workplace should be imported */
public boolean prepareStep8 ( ) { } } | if ( isInitialized ( ) ) { try { checkEthernetAddress ( ) ; // backup the XML configuration
backupConfiguration ( CmsImportExportConfiguration . DEFAULT_XML_FILE_NAME , CmsImportExportConfiguration . DEFAULT_XML_FILE_NAME + CmsConfigurationManager . POSTFIX_ORI ) ; backupConfiguration ( CmsModuleConfiguration . DEFAULT... |
public class XPath { /** * Set the raw expression object for this object .
* @ param exp the raw Expression object , which should not normally be null . */
public void setExpression ( Expression exp ) { } } | if ( null != m_mainExp ) exp . exprSetParent ( m_mainExp . exprGetParent ( ) ) ; // a bit bogus
m_mainExp = exp ; |
public class Context { /** * Notify any registered listeners that a bounded property has changed
* @ see # addPropertyChangeListener ( java . beans . PropertyChangeListener )
* @ see # removePropertyChangeListener ( java . beans . PropertyChangeListener )
* @ see java . beans . PropertyChangeListener
* @ see ja... | Object listeners = propertyListeners ; if ( listeners != null ) { firePropertyChangeImpl ( listeners , property , oldValue , newValue ) ; } |
public class BitfinexCurrencyPair { /** * Retrieves bitfinex currency pair
* @ param currency currency ( from )
* @ param profitCurrency currency ( to )
* @ return BitfinexCurrencyPair */
public static BitfinexCurrencyPair of ( final String currency , final String profitCurrency ) { } } | final String key = buildCacheKey ( currency , profitCurrency ) ; final BitfinexCurrencyPair bcp = instances . get ( key ) ; if ( bcp == null ) { throw new IllegalArgumentException ( "CurrencyPair is not registered: " + currency + " " + profitCurrency ) ; } return bcp ; |
public class StringGroovyMethods { /** * Process each regex group matched substring of the given CharSequence . If the closure
* parameter takes one argument , an array with all match groups is passed to it .
* If the closure takes as many arguments as there are match groups , then each
* parameter will be one ma... | "List<String>" , "String[]" } ) Closure closure ) { eachMatch ( self . toString ( ) , regex . toString ( ) , closure ) ; return self ; |
public class DeploymentUtil { /** * d366807.3 */
private static Method [ ] sortMethods ( ArrayList < Method > methods ) { } } | int numMethods = methods . size ( ) ; Method result [ ] = new Method [ numMethods ] ; // Insert each element of given list of methods into result
// array in sorted order .
for ( int i = 0 ; i < numMethods ; i ++ ) { Method currMethod = methods . get ( i ) ; String currMethodName = currMethod . toString ( ) ; int inser... |
public class ASTUtil { /** * Returns the < CODE > TypeDeclaration < / CODE > for the specified
* < CODE > ClassAnnotation < / CODE > . The type has to be declared in the
* specified < CODE > CompilationUnit < / CODE > .
* @ param compilationUnit
* The < CODE > CompilationUnit < / CODE > , where the
* < CODE >... | requireNonNull ( classAnno , "class annotation" ) ; return getTypeDeclaration ( compilationUnit , classAnno . getClassName ( ) ) ; |
public class ExpectedConditions { /** * An expectation for checking that an element is present on the DOM of a page and visible .
* Visibility means that the element is not only displayed but also has a height and width that is
* greater than 0.
* @ param locator used to find the element
* @ return the WebEleme... | return new ExpectedCondition < WebElement > ( ) { @ Override public WebElement apply ( WebDriver driver ) { try { return elementIfVisible ( driver . findElement ( locator ) ) ; } catch ( StaleElementReferenceException e ) { return null ; } } @ Override public String toString ( ) { return "visibility of element located ... |
public class GenericEditableTableCell { /** * Any action attempting to commit an edit should call this method rather than commit the edit directly itself . This
* method will perform any validation and conversion required on the value . For text values that normally means this
* method just commits the edit but for... | if ( editorNode == null ) { return ; } try { builder . validateValue ( ) ; commitEdit ( ( T ) builder . getValue ( ) ) ; builder . nullEditorNode ( ) ; editorNode = null ; } catch ( Exception ex ) { if ( commitExceptionConsumer != null ) { commitExceptionConsumer . accept ( ex ) ; } if ( losingFocus ) { cancelEdit ( ) ... |
public class LRUProtectionStorage { /** * The touch method can be used to renew an element and move it to the from of the LRU queue .
* @ param key The key of the element to renew
* @ param value A value to newly associate with the key */
public synchronized void touch ( final Object key , final Object value ) { } ... | remove ( key ) ; put ( key , value ) ; |
public class HashMap { /** * Returns a power of two size for the given target capacity . */
static final int tableSizeFor ( int cap ) { } } | int n = cap - 1 ; n |= n >>> 1 ; n |= n >>> 2 ; n |= n >>> 4 ; n |= n >>> 8 ; n |= n >>> 16 ; return ( n < 0 ) ? 1 : ( n >= MAXIMUM_CAPACITY ) ? MAXIMUM_CAPACITY : n + 1 ; |
public class ServiceLoaderUtil { /** * Finds the first implementation of the given service type and creates its instance .
* @ param clazz service type
* @ return the first implementation of the given service type */
public static < T > Optional < T > findFirst ( Class < T > clazz ) { } } | ServiceLoader < T > load = ServiceLoader . load ( clazz ) ; return StreamSupport . stream ( load . spliterator ( ) , false ) . findFirst ( ) ; |
public class ThreadPool { /** * Checks all active threads in this thread pool to determine if
* they are hung . The definition of hung is provided by the
* MonitorPlugin .
* @ see MonitorPlugin */
public void checkAllThreads ( ) { } } | // if nothing is plugged in , exit early
if ( this . monitorPlugin == null ) { return ; } long currentTime = 0 ; // lazily initialize current time
try { for ( Iterator i = this . threads_ . values ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Worker thread = ( Worker ) i . next ( ) ; synchronized ( thread ) { // d204471
i... |
public class ListVersionsResponse { /** * < pre >
* The versions belonging to the requested service .
* < / pre >
* < code > repeated . google . appengine . v1 . Version versions = 1 ; < / code > */
public com . google . appengine . v1 . Version getVersions ( int index ) { } } | return versions_ . get ( index ) ; |
public class Group { /** * Adds user agent .
* @ param userAgent host name */
public void addUserAgent ( String userAgent ) { } } | if ( userAgent . equals ( "*" ) ) { anyAgent = true ; } else { this . userAgents . add ( userAgent ) ; } |
public class ColtUtils { /** * Returns v = beta * A . b .
* Useful in avoiding the need of the copy ( ) in the colt api . */
public static final DoubleMatrix1D zMult ( final DoubleMatrix2D A , final DoubleMatrix1D b , final double beta ) { } } | if ( A . columns ( ) != b . size ( ) ) { throw new IllegalArgumentException ( "wrong matrices dimensions" ) ; } final DoubleMatrix1D ret = DoubleFactory1D . dense . make ( A . rows ( ) ) ; if ( A instanceof SparseDoubleMatrix2D ) { // sparse matrix
A . forEachNonZero ( new IntIntDoubleFunction ( ) { @ Override public d... |
public class ThreadUtils { /** * Determines whether the specified Thread is currently in a timed wait .
* @ param thread the Thread to evaluate .
* @ return a boolean value indicating whether the Thread is currently in a timed wait .
* @ see java . lang . Thread # getState ( )
* @ see java . lang . Thread . Sta... | return ( thread != null && Thread . State . TIMED_WAITING . equals ( thread . getState ( ) ) ) ; |
public class AbstractLoginServlet { /** * OAuth登录过程需要校验 < code > state < / code > 参数是否变化 。
* 默认情况下这个 < code > state < / code > 是调整到SSO登录时生成的随机码 , 如果这个状态被改变说明请求可能被篡改 。
* 校验通过返回 < code > true < / code > , 不通过返回false 。
* @ see # setOauth2LoginState ( HttpServletRequest , HttpServletResponse , String ) */
protected b... | String state = req . getParameter ( "state" ) ; String sessionState = ( String ) req . getSession ( ) . getAttribute ( "oauth2_login_state" ) ; if ( ! Strings . equals ( sessionState , state ) ) { return false ; } return true ; |
public class Client { /** * Returns a list of bindings where provided exchange is the source ( other things are
* bound to it ) .
* @ param vhost vhost of the exchange
* @ param exchange source exchange name
* @ return list of bindings */
public List < BindingInfo > getBindingsBySource ( String vhost , String e... | final String x = exchange . equals ( "" ) ? "amq.default" : exchange ; final URI uri = uriWithPath ( "./exchanges/" + encodePathSegment ( vhost ) + "/" + encodePathSegment ( x ) + "/bindings/source" ) ; return Arrays . asList ( this . rt . getForObject ( uri , BindingInfo [ ] . class ) ) ; |
public class SimilarityQuery { /** * { @ inheritDoc } */
public Query rewrite ( IndexReader reader ) throws IOException { } } | MoreLikeThis more = new MoreLikeThis ( reader ) ; more . setAnalyzer ( analyzer ) ; more . setFieldNames ( new String [ ] { FieldNames . FULLTEXT } ) ; more . setMinWordLen ( 4 ) ; Query similarityQuery = null ; TermDocs td = reader . termDocs ( new Term ( FieldNames . UUID , uuid ) ) ; try { if ( td . next ( ) ) { sim... |
public class GeneralUtils { /** * This method is similar to { @ link # propX ( Expression , Expression ) } but will make sure that if the property
* being accessed is defined inside the classnode provided as a parameter , then a getter call is generated
* instead of a field access .
* @ param annotatedNode the cl... | ClassNode owner = pNode . getDeclaringClass ( ) ; if ( annotatedNode . equals ( owner ) ) { String getterName = "get" + MetaClassHelper . capitalize ( pNode . getName ( ) ) ; if ( ClassHelper . boolean_TYPE . equals ( pNode . getOriginType ( ) ) ) { getterName = "is" + MetaClassHelper . capitalize ( pNode . getName ( )... |
public class FastqBuilder { /** * Return this FASTQ formatted sequence builder configured with the specified sequence .
* @ param sequence sequence for this FASTQ formatted sequence builder , must not be null
* @ return this FASTQ formatted sequence builder configured with the specified sequence */
public FastqBuil... | if ( sequence == null ) { throw new IllegalArgumentException ( "sequence must not be null" ) ; } if ( this . sequence == null ) { this . sequence = new StringBuilder ( sequence . length ( ) ) ; } this . sequence . replace ( 0 , this . sequence . length ( ) , sequence ) ; return this ; |
public class StorePackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getRunServiceAuthorization ( ) { } } | if ( runServiceAuthorizationEClass == null ) { runServiceAuthorizationEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( StorePackage . eNS_URI ) . getEClassifiers ( ) . get ( 119 ) ; } return runServiceAuthorizationEClass ; |
public class ModificationQueue { /** * Checks if the given key is present for the given graph object in the modifiedProperties of this queue . < br > < br >
* This method is convenient if only one key has to be checked . If different
* actions should be taken for different keys one should rather use { @ link # getM... | for ( GraphObjectModificationState state : getSortedModifications ( ) ) { for ( PropertyKey k : state . getModifiedProperties ( ) . keySet ( ) ) { if ( k . equals ( key ) && graphObject . getUuid ( ) . equals ( state . getGraphObject ( ) . getUuid ( ) ) ) { return true ; } } } return false ; |
public class DatatypeConverter { /** * Parse a string representation of a Boolean value .
* @ param value string representation
* @ return Boolean value */
public static Boolean parseBoolean ( String value ) throws ParseException { } } | Boolean result = null ; Integer number = parseInteger ( value ) ; if ( number != null ) { result = number . intValue ( ) == 0 ? Boolean . FALSE : Boolean . TRUE ; } return result ; |
public class CSSInputStream { /** * Sets a new encoding for the input stream . < b > Warning : < / b > this resets the stream
* i . e . a new connection is opened and all the data is read again .
* @ param enc The new encoding name .
* @ throws IOException */
public void setEncoding ( String enc ) throws IOExcept... | if ( source != null ) // applicapble to URL streams only
{ String current = encoding ; if ( current == null ) current = Charset . defaultCharset ( ) . name ( ) ; if ( ! current . equalsIgnoreCase ( enc ) ) { int oldindex = input . index ( ) ; source . close ( ) ; encoding = enc ; CSSInputStream newstream = urlStream ( ... |
public class JCudaDriver { /** * Set attributes on a previously allocated memory region < br >
* < br >
* The supported attributes are :
* < br >
* < ul >
* < li > CU _ POINTER _ ATTRIBUTE _ SYNC _ MEMOPS :
* A boolean attribute that can either be set ( 1 ) or unset ( 0 ) . When set ,
* the region of memo... | return checkResult ( cuPointerSetAttributeNative ( value , attribute , ptr ) ) ; |
public class BaasObject { /** * Asynchronously revoke the access < code > grant < / code > to this object from < code > username < / code > .
* The outcome of the request is handed to the provided < code > handler < / code > .
* @ param grant a non null { @ link com . baasbox . android . Grant }
* @ param usernam... | return grant ( grant , username , RequestOptions . DEFAULT , handler ) ; |
public class TodoItemElement { /** * - - - - - event handler */
private void toggle ( ) { } } | root . classList . toggle ( "completed" , toggle . checked ) ; repository . complete ( item , toggle . checked ) ; application . update ( ) ; |
public class WSManagedConnectionFactoryImpl { /** * This method is to be used by RRA code to set logwriter when needed */
final void reallySetLogWriter ( final PrintWriter out ) throws ResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "setting the logWriter to:" , out ) ; if ( dataSourceOrDriver != null ) { try { AccessController . doPrivileged ( new PrivilegedExceptionAction < Void > ( ) { public Void run ( ) throws SQLException { if ( ! Driver . cla... |
public class ListTagsForResourceRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListTagsForResourceRequest listTagsForResourceRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listTagsForResourceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listTagsForResourceRequest . getResourceArn ( ) , RESOURCEARN_BINDING ) ; protocolMarshaller . marshall ( listTagsForResourceRequest . getLimit ( ) , LIMIT_BI... |
public class V1InstanceCreator { /** * Create a new Message with a subject and recipient .
* @ param subject Message subject .
* @ param messageBody Message body .
* @ param recipients Who this message will go to . May be null .
* @ param attributes additional attributes for the Message .
* @ return A newly m... | Message message = new Message ( instance ) ; message . setName ( subject ) ; message . setDescription ( messageBody ) ; if ( recipients != null ) for ( Member recipient : recipients ) { message . getRecipients ( ) . add ( recipient ) ; } addAttributes ( message , attributes ) ; message . save ( ) ; return message ; |
public class StaticSentinel { /** * The offset defines how many methods of the same name are waiting . */
private synchronized static void waiting ( String classname , int fnr , int offset ) { } } | m . put ( classname , StaticOperationsCounters . waiting [ fnr ] += offset ) ; stateChanged ( ) ; |
public class CodingUtil { /** * Base64加密 url变种 , [ + 替换成 * ] [ / 替换成 _ ] */
public static String encryptToBase64Url ( String url ) { } } | url = encryptToBase64 ( url ) ; if ( url . indexOf ( "+" ) != - 1 ) { url = url . replaceAll ( "\\+" , "*" ) ; } if ( url . indexOf ( "/" ) != - 1 ) { url = url . replaceAll ( "/" , "_" ) ; } return url ; |
public class WrapperBucket { /** * Insert the specified object into the bucket and associate it with
* the specified key . Returns the Element which holds the newly -
* inserted object .
* @ param key key of the object element to be inserted .
* @ param object the object to be inserted for the specified key .
... | EJSWrapperCommon element = ( EJSWrapperCommon ) object ; if ( ivWrappers == null ) { ivWrappers = new HashMap < Object , EJSWrapperCommon > ( DEFAULT_BUCKET_SIZE ) ; } Object duplicate = ivWrappers . put ( key , element ) ; if ( duplicate != null ) { // The wrapper cache does not support duplicates . . . . however , th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.