signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class WebXml { /** * should be called when initialising Servlet
* @ param context */
public static void init ( ExternalContext context ) { } } | WebXmlParser parser = new WebXmlParser ( context ) ; WebXml webXml = parser . parse ( ) ; context . getApplicationMap ( ) . put ( WEB_XML_ATTR , webXml ) ; MyfacesConfig mfconfig = MyfacesConfig . getCurrentInstance ( context ) ; long configRefreshPeriod = mfconfig . getConfigRefreshPeriod ( ) ; webXml . setParsingTime ( System . currentTimeMillis ( ) ) ; webXml . setDelegateFacesServlet ( mfconfig . getDelegateFacesServlet ( ) ) ; refreshPeriod = ( configRefreshPeriod * 1000 ) ; |
public class AmazonInspectorClient { /** * Lists all the event subscriptions for the assessment template that is specified by the ARN of the assessment
* template . For more information , see < a > SubscribeToEvent < / a > and < a > UnsubscribeFromEvent < / a > .
* @ param listEventSubscriptionsRequest
* @ return Result of the ListEventSubscriptions operation returned by the service .
* @ throws InternalException
* Internal server error .
* @ throws InvalidInputException
* The request was rejected because an invalid or out - of - range value was supplied for an input parameter .
* @ throws AccessDeniedException
* You do not have required permissions to access the requested resource .
* @ throws NoSuchEntityException
* The request was rejected because it referenced an entity that does not exist . The error code describes
* the entity .
* @ sample AmazonInspector . ListEventSubscriptions
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / inspector - 2016-02-16 / ListEventSubscriptions "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public ListEventSubscriptionsResult listEventSubscriptions ( ListEventSubscriptionsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListEventSubscriptions ( request ) ; |
public class SpanOperationsBenchmark { /** * Add attributes as a map . */
@ Benchmark @ BenchmarkMode ( Mode . AverageTime ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public Span putAttributes ( Data data ) { } } | Span span = data . attributeSpan ; span . putAttributes ( data . attributeMap ) ; return span ; |
public class ApiVersionUtil { /** * Separates apiGroupName for apiGroupName / apiGroupVersion combination .
* @ param apiVersion The apiGroupVersion or apiGroupName / apiGroupVersion combo .
* @ return Just the apiGroupName part without the apiGroupName , or apiVersion if no separator is found . */
private static String trimGroup ( String apiVersion ) { } } | if ( apiVersion != null && apiVersion . contains ( "/" ) ) { String [ ] versionParts = apiVersion . split ( "/" ) ; return versionParts [ 0 ] ; } return apiVersion ; |
public class EmoServiceWithZK { /** * Start an in - memory copy of ZooKeeper . */
private static TestingServer startLocalZooKeeper ( ) throws Exception { } } | // ZooKeeper is too noisy by default .
( ( Logger ) LoggerFactory . getLogger ( "org.apache.zookeeper" ) ) . setLevel ( Level . ERROR ) ; // Start the testing server .
TestingServer zooKeeperServer = new TestingServer ( 2181 ) ; // Configure EmoDB to use the testing server .
System . setProperty ( "dw.zooKeeper.connectString" , zooKeeperServer . getConnectString ( ) ) ; return zooKeeperServer ; |
public class LockTable { /** * Grants an islock on the specified item . If any conflict lock exists when
* the method is called , then the calling thread will be placed on a wait
* list until the lock is released . If the thread remains on the wait list
* for a certain amount of time , then an exception is thrown .
* @ param obj
* a lockable item
* @ param txNum
* a transaction number */
void isLock ( Object obj , long txNum ) { } } | Object anchor = getAnchor ( obj ) ; txWaitMap . put ( txNum , anchor ) ; synchronized ( anchor ) { Lockers lks = prepareLockers ( obj ) ; if ( hasIsLock ( lks , txNum ) ) return ; try { long timestamp = System . currentTimeMillis ( ) ; while ( ! isLockable ( lks , txNum ) && ! waitingTooLong ( timestamp ) ) { avoidDeadlock ( lks , txNum , IS_LOCK ) ; lks . requestSet . add ( txNum ) ; anchor . wait ( MAX_TIME ) ; lks . requestSet . remove ( txNum ) ; } if ( ! isLockable ( lks , txNum ) ) throw new LockAbortException ( ) ; lks . isLockers . add ( txNum ) ; getObjectSet ( txNum ) . add ( obj ) ; } catch ( InterruptedException e ) { throw new LockAbortException ( ) ; } } txWaitMap . remove ( txNum ) ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public MFCMFCScpe createMFCMFCScpeFromString ( EDataType eDataType , String initialValue ) { } } | MFCMFCScpe result = MFCMFCScpe . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class ScanCollectionDefault { /** * Unloads spectra from scans that match { @ code subset } variable and do not match all of subsets
* from { @ code exclude } variable .
* @ param scansInSubsetByNumber pre - filtered scan map , e . g . by scan numbers , ms - levels , etc . */
private void unloadSpectraConditionally ( NavigableMap < Integer , IScan > scansInSubsetByNumber , LCMSDataSubset subset , Set < LCMSDataSubset > exlude ) { } } | boolean isOkToUnload ; for ( IScan scan : scansInSubsetByNumber . values ( ) ) { if ( subset . isInSubset ( scan ) ) { isOkToUnload = true ; for ( LCMSDataSubset exludedSubset : exlude ) { if ( exludedSubset . isInSubset ( scan ) ) { isOkToUnload = false ; break ; } } if ( isOkToUnload ) { scan . setSpectrum ( null , false ) ; } } } |
public class Entry { /** * Aggregate the given < code > Kernel < / code > to the < code > buffer < / code >
* cluster of this entry .
* @ param pointToInsert The cluster to aggregate to the buffer .
* @ param currentTime The time at which the aggregation occurs .
* @ param negLambda A parameter needed to weight the current state of the
* buffer . */
protected void aggregateToBuffer ( ClusKernel pointToInsert , long currentTime , double negLambda ) { } } | ClusKernel currentBuffer = this . getBuffer ( ) ; currentBuffer . aggregate ( pointToInsert , currentTime - this . timestamp , negLambda ) ; this . timestamp = currentTime ; |
public class FinderPattern { /** * < p > Determines if this finder pattern " about equals " a finder pattern at the stated
* position and size - - meaning , it is at nearly the same center with nearly the same size . < / p > */
boolean aboutEquals ( float moduleSize , float i , float j ) { } } | if ( Math . abs ( i - getY ( ) ) <= moduleSize && Math . abs ( j - getX ( ) ) <= moduleSize ) { float moduleSizeDiff = Math . abs ( moduleSize - estimatedModuleSize ) ; return moduleSizeDiff <= 1.0f || moduleSizeDiff <= estimatedModuleSize ; } return false ; |
public class SSLHelper { /** * Get an ssl socket factory , if configured */
public static SSLSocketFactory getSSLSocketFactory ( Object sslConfig ) throws Exception { } } | SSLSocketFactory sslSF = null ; if ( sslConfig != null ) { String sslAlias = ( ( com . ibm . wsspi . ssl . SSLConfiguration ) sslConfig ) . getAlias ( ) ; final com . ibm . websphere . ssl . JSSEHelper helper = com . ibm . websphere . ssl . JSSEHelper . getInstance ( ) ; final Properties sslProps = helper . getProperties ( sslAlias ) ; sslSF = AccessController . doPrivileged ( new PrivilegedExceptionAction < SSLSocketFactory > ( ) { @ Override public SSLSocketFactory run ( ) throws Exception { return helper . getSSLSocketFactory ( Collections . < String , Object > emptyMap ( ) , sslProps ) ; } } ) ; } return sslSF ; |
public class MediaType { /** * Get the { @ link MediaType } of the file .
* @ param fileName file name .
* @ return { @ link MediaType } , cannot be null . */
public static MediaType getFileMediaType ( String fileName ) { } } | String extension = getUrlExtension ( fileName ) ; if ( ! MimeTypeMap . getSingleton ( ) . hasExtension ( extension ) ) { return MediaType . APPLICATION_OCTET_STREAM ; } String mimeType = MimeTypeMap . getSingleton ( ) . getMimeTypeFromExtension ( extension ) ; try { return MediaType . parseMediaType ( mimeType ) ; } catch ( Exception e ) { return MediaType . APPLICATION_OCTET_STREAM ; } |
public class CSVLoader { /** * Parse args into CSVConfig object . */
private void parseArgs ( String [ ] args ) { } } | int index = 0 ; while ( index < args . length ) { String name = args [ index ] ; if ( name . equals ( "-?" ) || name . equalsIgnoreCase ( "-help" ) ) { usage ( ) ; } if ( name . charAt ( 0 ) != '-' ) { m_logger . error ( "Unrecognized parameter: {}" , name ) ; usage ( ) ; } if ( ++ index >= args . length ) { m_logger . error ( "Another parameter expected after '{}'" , name ) ; usage ( ) ; } String value = args [ index ] ; try { m_config . set ( name . substring ( 1 ) , value ) ; } catch ( Exception e ) { m_logger . error ( e . toString ( ) ) ; usage ( ) ; } index ++ ; } |
public class AmazonSageMakerClient { /** * Terminates the ML compute instance . Before terminating the instance , Amazon SageMaker disconnects the ML storage
* volume from it . Amazon SageMaker preserves the ML storage volume .
* To access data on the ML storage volume for a notebook instance that has been terminated , call the
* < code > StartNotebookInstance < / code > API . < code > StartNotebookInstance < / code > launches another ML compute instance ,
* configures it , and attaches the preserved ML storage volume so you can continue your work .
* @ param stopNotebookInstanceRequest
* @ return Result of the StopNotebookInstance operation returned by the service .
* @ sample AmazonSageMaker . StopNotebookInstance
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / sagemaker - 2017-07-24 / StopNotebookInstance " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public StopNotebookInstanceResult stopNotebookInstance ( StopNotebookInstanceRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeStopNotebookInstance ( request ) ; |
public class JaccServiceImpl { /** * check DataConstraints
* true if permission is is implied .
* false otherwise . */
protected boolean checkDataConstraints ( String applicationName , String moduleName , String uriName , String methodName , Object req , String transportType ) { } } | boolean result = false ; WebSecurityValidator wsv = getWsv ( servletServiceRef . getService ( ) ) ; if ( wsv != null ) { result = checkDataConstraints ( wsv , applicationName , moduleName , uriName , methodName , req , transportType ) ; } else { Tr . error ( tc , "JACC_NO_WEB_PLUGIN" ) ; } return result ; |
public class JStormUtils { /** * Get Topology Metrics
* @ param topologyName topology name
* @ param metricType , please refer to MetaType , default to MetaType . TASK . getT ( )
* @ param window , please refer to AsmWindow , default to AsmWindow . M1 _ WINDOW
* @ return topology metrics */
public static Map < String , Double > getMetrics ( Map conf , String topologyName , MetaType metricType , Integer window ) { } } | NimbusClientWrapper nimbusClient = null ; Iface client = null ; Map < String , Double > summary = new HashMap < > ( ) ; try { nimbusClient = new NimbusClientWrapper ( ) ; nimbusClient . init ( conf ) ; client = nimbusClient . getClient ( ) ; String topologyId = client . getTopologyId ( topologyName ) ; if ( metricType == null ) { metricType = MetaType . TASK ; } List < MetricInfo > allTaskMetrics = client . getMetrics ( topologyId , metricType . getT ( ) ) ; if ( allTaskMetrics == null ) { throw new RuntimeException ( "Failed to get metrics" ) ; } if ( window == null || ! AsmWindow . TIME_WINDOWS . contains ( window ) ) { window = AsmWindow . M1_WINDOW ; } for ( MetricInfo taskMetrics : allTaskMetrics ) { Map < String , Map < Integer , MetricSnapshot > > metrics = taskMetrics . get_metrics ( ) ; if ( metrics == null ) { System . out . println ( "Failed to get task metrics" ) ; continue ; } for ( Entry < String , Map < Integer , MetricSnapshot > > entry : metrics . entrySet ( ) ) { String key = entry . getKey ( ) ; MetricSnapshot metric = entry . getValue ( ) . get ( window ) ; if ( metric == null ) { throw new RuntimeException ( "Failed to get one minute metrics of " + key ) ; } if ( metric . get_metricType ( ) == MetricType . COUNTER . getT ( ) ) { summary . put ( key , ( double ) metric . get_longValue ( ) ) ; } else if ( metric . get_metricType ( ) == MetricType . GAUGE . getT ( ) ) { summary . put ( key , metric . get_doubleValue ( ) ) ; } else { summary . put ( key , metric . get_mean ( ) ) ; } } } return summary ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } finally { if ( client != null ) { nimbusClient . cleanup ( ) ; } } |
public class ImageGray { /** * Creates a single band image of the specified type that will have the same
* shape as this image */
public < B extends ImageGray < B > > B createSameShape ( Class < B > type ) { } } | return GeneralizedImageOps . createSingleBand ( type , width , height ) ; |
public class Version { /** * < pre >
* Email address of the user who created this version .
* & # 64 ; OutputOnly
* < / pre >
* < code > string created _ by = 16 ; < / code > */
public java . lang . String getCreatedBy ( ) { } } | java . lang . Object ref = createdBy_ ; if ( ref instanceof java . lang . String ) { return ( java . lang . String ) ref ; } else { com . google . protobuf . ByteString bs = ( com . google . protobuf . ByteString ) ref ; java . lang . String s = bs . toStringUtf8 ( ) ; createdBy_ = s ; return s ; } |
public class FSImage { /** * Check if the remote image / journal storage info is the same as ours */
private void checkConsistency ( StorageInfo remote , StorageInfo local , boolean image , Object name ) throws IOException { } } | if ( ! remote . equals ( local ) ) { throwIOException ( "Remote " + ( image ? "image" : "edits" ) + " storage is different than local. Local: (" + local . toColonSeparatedString ( ) + "), remote: " + name . toString ( ) + " (" + remote . toColonSeparatedString ( ) + ")" ) ; } |
public class FunctionLibrary { /** * Try to find function in library by name .
* @ param functionName function name .
* @ return the function instance .
* @ throws NoSuchFunctionException */
public Function getFunction ( String functionName ) throws NoSuchFunctionException { } } | if ( ! members . containsKey ( functionName ) ) { throw new NoSuchFunctionException ( "Can not find function " + functionName + " in library " + name + " (" + prefix + ")" ) ; } return members . get ( functionName ) ; |
public class JFXRippler { /** * this method will be set to private in future versions of JFoenix ,
* user the method { @ link # setOverlayVisible ( boolean ) } */
@ Deprecated public void showOverlay ( ) { } } | if ( rippler . overlayRect != null ) { rippler . overlayRect . outAnimation . stop ( ) ; } rippler . createOverlay ( ) ; rippler . overlayRect . inAnimation . play ( ) ; |
public class STIXSchema { /** * Return the namespace URI from the package for the class of the object .
* @ param obj
* Expects a JAXB model object .
* @ return Name of the XML namespace . */
public static String getNamespaceURI ( Object obj ) { } } | Package pkg = obj . getClass ( ) . getPackage ( ) ; XmlSchema xmlSchemaAnnotation = pkg . getAnnotation ( XmlSchema . class ) ; return xmlSchemaAnnotation . namespace ( ) ; |
public class CompanyServiceClient { /** * Retrieves specified company .
* < p > Sample code :
* < pre > < code >
* try ( CompanyServiceClient companyServiceClient = CompanyServiceClient . create ( ) ) {
* CompanyName name = CompanyWithTenantName . of ( " [ PROJECT ] " , " [ TENANT ] " , " [ COMPANY ] " ) ;
* Company response = companyServiceClient . getCompany ( name . toString ( ) ) ;
* < / code > < / pre >
* @ param name Required .
* < p > The resource name of the company to be retrieved .
* < p > The format is " projects / { project _ id } / tenants / { tenant _ id } / companies / { company _ id } " , for
* example , " projects / api - test - project / tenants / foo / companies / bar " .
* < p > Tenant id is optional and the default tenant is used if unspecified , for example ,
* " projects / api - test - project / companies / bar " .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final Company getCompany ( String name ) { } } | GetCompanyRequest request = GetCompanyRequest . newBuilder ( ) . setName ( name ) . build ( ) ; return getCompany ( request ) ; |
public class HttpOSC100ReadCallback { /** * Helper method to handle when new work is around and we need to parse it
* and watch for errors / check for headersParsed being true .
* @ param sc
* @ param vc
* @ return boolean ( have headers been fully parsed yet ? ) */
private boolean handleNewData ( HttpOutboundServiceContextImpl sc , VirtualConnection vc ) { } } | if ( ! sc . headersParsed ( ) ) { try { return sc . parseMessage ( ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".handleNewData" , "73" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Caught exception: " + e . getMessage ( ) ) ; } sc . setPersistent ( false ) ; sc . getAppWriteCallback ( ) . error ( vc , e ) ; return false ; } } return true ; |
public class CachingPersonAttributeDaoImpl { /** * Wraps the call to the specified cachedPersonAttributesDao IPersonAttributeDao delegate with
* a caching layer . Results are cached using keys generated by { @ link # getCacheKeyGenerator ( ) } .
* @ see IPersonAttributeDao # getPeopleWithMultivaluedAttributes ( java . util . Map , IPersonAttributeDaoFilter ) */
@ Override public Set < IPersonAttributes > getPeopleWithMultivaluedAttributes ( final Map < String , List < Object > > seed , final IPersonAttributeDaoFilter filter ) { } } | // Ensure the arguments and state are valid
if ( seed == null ) { throw new IllegalArgumentException ( "The query seed Map cannot be null." ) ; } if ( this . cachedPersonAttributesDao == null ) { throw new IllegalStateException ( "No 'cachedPersonAttributesDao' has been specified." ) ; } if ( this . userInfoCache == null ) { throw new IllegalStateException ( "No 'userInfoCache' has been specified." ) ; } // Get the cache key
final MethodInvocation methodInvocation = new PersonAttributeDaoMethodInvocation ( seed ) ; final Serializable cacheKey = this . cacheKeyGenerator . generateKey ( methodInvocation ) ; if ( cacheKey != null ) { Set < IPersonAttributes > cacheResults = this . userInfoCache . get ( cacheKey ) ; if ( cacheResults != null ) { // If the returned object is the null results object , set the cache results to null
if ( this . nullResultsObject . equals ( cacheResults ) ) { cacheResults = null ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Retrieved query from cache for " + beanName + ". key='" + cacheKey + "', results='" + cacheResults + "'" ) ; } this . queries ++ ; if ( statsLogger . isDebugEnabled ( ) ) { statsLogger . debug ( "Cache Stats " + beanName + ": queries=" + this . queries + ", hits=" + ( this . queries - this . misses ) + ", misses=" + this . misses ) ; } return cacheResults ; } } final Set < IPersonAttributes > queryResults = this . cachedPersonAttributesDao . getPeopleWithMultivaluedAttributes ( seed , filter ) ; if ( cacheKey != null ) { if ( queryResults != null ) { this . userInfoCache . put ( cacheKey , queryResults ) ; } else if ( this . cacheNullResults ) { this . userInfoCache . put ( cacheKey , this . nullResultsObject ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Retrieved query from wrapped IPersonAttributeDao and stored in cache for " + beanName + ". key='" + cacheKey + "', results='" + queryResults + "'" ) ; } this . queries ++ ; this . misses ++ ; if ( statsLogger . isDebugEnabled ( ) ) { statsLogger . debug ( "Cache Stats " + beanName + ": queries=" + this . queries + ", hits=" + ( this . queries - this . misses ) + ", misses=" + this . misses ) ; } } return queryResults ; |
public class FTPServerFacade { /** * Start the local server
* @ param port required server port ; can be set to ANY _ PORT
* @ param queue max size of queue of awaiting new connection
* requests
* @ return the server address */
public HostPort setPassive ( int port , int queue ) throws IOException { } } | if ( serverSocket == null ) { ServerSocketFactory factory = ServerSocketFactory . getDefault ( ) ; serverSocket = factory . createServerSocket ( port , queue ) ; } session . serverMode = Session . SERVER_PASSIVE ; String address = Util . getLocalHostAddress ( ) ; int localPort = serverSocket . getLocalPort ( ) ; if ( remoteControlChannel . isIPv6 ( ) ) { String version = HostPort6 . getIPAddressVersion ( address ) ; session . serverAddress = new HostPort6 ( version , address , localPort ) ; } else { session . serverAddress = new HostPort ( address , localPort ) ; } logger . debug ( "started passive server at port " + session . serverAddress . getPort ( ) ) ; return session . serverAddress ; |
public class CmsLoginUserAgreement { /** * Stores the information about the accepted user agreement in the current users additional info . < p > */
public void acceptAgreement ( ) { } } | // store accepted flag in current users settings
getSettings ( ) . setUserAgreementAccepted ( true ) ; // check accepted agreement version
if ( getAcceptedVersion ( ) < getRequiredVersion ( ) ) { // a new ( higher ) version was accepted , increase version to store and reset accepted count
setAcceptedVersion ( getRequiredVersion ( ) ) ; setAcceptedCount ( 0 ) ; } // increase accepted count
setAcceptedCount ( getAcceptedCount ( ) + 1 ) ; // create the JSON data structure that is stored in the additional info
JSONObject jsonData = new JSONObject ( ) ; try { jsonData . put ( KEY_ACCEPTED_VERSION , getRequiredVersion ( ) ) ; jsonData . put ( KEY_ACCEPTED_COUNT , m_acceptedCount ) ; // store accepted data in users additional information
CmsUser user = getCms ( ) . getRequestContext ( ) . getCurrentUser ( ) ; user . setAdditionalInfo ( CmsUserSettings . LOGIN_USERAGREEMENT_ACCEPTED , jsonData . toString ( ) ) ; // write the changed user
getCms ( ) . writeUser ( user ) ; } catch ( Exception e ) { LOG . error ( e ) ; } |
public class URLCodec { /** * Convenience method for { @ link # encode ( CharSequence , Charset , Appendable ) } . */
public static void encode ( CharSequence in , Appendable out ) throws IOException { } } | encode ( in , UTF_8 , out ) ; |
public class GVRSkeletonAnimation { /** * Find the channel in the animation that animates the named bone .
* @ param boneName name of bone to animate . */
public GVRAnimationChannel findChannel ( String boneName ) { } } | int boneId = mSkeleton . getBoneIndex ( boneName ) ; if ( boneId >= 0 ) { return mBoneChannels [ boneId ] ; } return null ; |
public class UserManagedCacheBuilder { /** * Adds a { @ link ResourcePools } configuration to the returned builder .
* @ param resourcePools the resource pools to use
* @ return a new builder with the configured resource pools
* @ see # withResourcePools ( ResourcePoolsBuilder ) */
public final UserManagedCacheBuilder < K , V , T > withResourcePools ( ResourcePools resourcePools ) { } } | UserManagedCacheBuilder < K , V , T > otherBuilder = new UserManagedCacheBuilder < > ( this ) ; otherBuilder . resourcePools = resourcePools ; return otherBuilder ; |
public class Beans { /** * Injects EJBs and other EE resources .
* @ param resourceInjectionsHierarchy
* @ param beanInstance
* @ param ctx */
public static < T > void injectEEFields ( Iterable < Set < ResourceInjection < ? > > > resourceInjectionsHierarchy , T beanInstance , CreationalContext < T > ctx ) { } } | for ( Set < ResourceInjection < ? > > resourceInjections : resourceInjectionsHierarchy ) { for ( ResourceInjection < ? > resourceInjection : resourceInjections ) { resourceInjection . injectResourceReference ( beanInstance , ctx ) ; } } |
public class WebReporter { /** * This method immediately sends UI report to specified target using POST request
* @ param target
* @ param entity */
public void postReport ( WebTarget target , Entity entity ) { } } | Response resp = target . request ( MediaType . APPLICATION_JSON ) . accept ( MediaType . APPLICATION_JSON ) . post ( entity ) ; log . debug ( "{}" , resp ) ; |
public class CommerceDiscountUtil { /** * Returns the first commerce discount in the ordered set where groupId = & # 63 ; .
* @ param groupId the group ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce discount , or < code > null < / code > if a matching commerce discount could not be found */
public static CommerceDiscount fetchByGroupId_First ( long groupId , OrderByComparator < CommerceDiscount > orderByComparator ) { } } | return getPersistence ( ) . fetchByGroupId_First ( groupId , orderByComparator ) ; |
public class Trie { /** * Gets the offset to data which the BMP character points to
* Treats a lead surrogate as a normal code point .
* @ param ch BMP character
* @ return offset to data */
protected final int getBMPOffset ( char ch ) { } } | return ( ch >= UTF16 . LEAD_SURROGATE_MIN_VALUE && ch <= UTF16 . LEAD_SURROGATE_MAX_VALUE ) ? getRawOffset ( LEAD_INDEX_OFFSET_ , ch ) : getRawOffset ( 0 , ch ) ; // using a getRawOffset ( ch ) makes no diff |
public class LogMetadata { /** * Create a new metadata marker with a single key - value pair .
* @ param key the key to add
* @ param value the value to add for that key */
public static LogMetadata of ( String key , Object value ) { } } | Map < String , Object > map = new HashMap < > ( ) ; map . put ( key , value ) ; return new LogMetadata ( map ) ; |
public class EntityDocumentImpl { /** * Returns the string id of the entity that this document refers to . Only
* for use by Jackson during serialization .
* @ return string id */
@ JsonInclude ( Include . NON_EMPTY ) @ JsonProperty ( "id" ) public String getJsonId ( ) { } } | if ( ! EntityIdValue . SITE_LOCAL . equals ( this . siteIri ) ) { return this . entityId ; } else { return null ; } |
public class Wikipedia { /** * Protected method that is much faster than the public version , but exposes too much implementation details .
* Get a set with all { @ code pageIDs } . Returning all page objects is much too expensive .
* Does not include redirects , as they are only pointers to real pages .
* As ids can be useful for several application ( e . g . in combination with
* the RevisionMachine , they have been made publicly available via
* { @ link # getPageIds ( ) } .
* @ return A set with all { @ code pageIDs } . Returning all pages is much to expensive . */
protected Set < Integer > __getPages ( ) { } } | Session session = this . __getHibernateSession ( ) ; session . beginTransaction ( ) ; List < Integer > idList = session . createQuery ( "select page.pageId from Page as page" , Integer . class ) . list ( ) ; Set < Integer > pageSet = new HashSet < Integer > ( idList ) ; session . getTransaction ( ) . commit ( ) ; return pageSet ; |
public class AbstractHibernateCriteriaBuilder { /** * Orders by the specified property name ( defaults to ascending )
* @ param propertyName The property name to order by
* @ return A Order instance */
public org . grails . datastore . mapping . query . api . Criteria order ( String propertyName ) { } } | if ( criteria == null ) { throwRuntimeException ( new IllegalArgumentException ( "Call to [order] with propertyName [" + propertyName + "]not allowed here." ) ) ; } propertyName = calculatePropertyName ( propertyName ) ; Order o = Order . asc ( propertyName ) ; addOrderInternal ( this . criteria , o ) ; return this ; |
public class RedmineJSONParser { /** * Parses a status .
* @ param object
* object to parse .
* @ return parsed tracker .
* @ throws RedmineFormatException
* if object is not a valid tracker . */
public static IssueStatus parseStatus ( JSONObject object ) throws JSONException { } } | final int id = JsonInput . getInt ( object , "id" ) ; final String name = JsonInput . getStringNotNull ( object , "name" ) ; final IssueStatus result = new IssueStatus ( id , name ) ; if ( object . has ( "is_default" ) ) result . setDefaultStatus ( JsonInput . getOptionalBool ( object , "is_default" ) ) ; if ( object . has ( "is_closed" ) ) result . setClosed ( JsonInput . getOptionalBool ( object , "is_closed" ) ) ; return result ; |
public class Compiler { /** * Sets up the skeleton of the AST ( the externs and root ) . */
private void initAST ( ) { } } | jsRoot = IR . root ( ) ; externsRoot = IR . root ( ) ; externAndJsRoot = IR . root ( externsRoot , jsRoot ) ; |
public class DescribeHostReservationsRequest { /** * The host reservation IDs .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setHostReservationIdSet ( java . util . Collection ) } or { @ link # withHostReservationIdSet ( java . util . Collection ) }
* if you want to override the existing values .
* @ param hostReservationIdSet
* The host reservation IDs .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeHostReservationsRequest withHostReservationIdSet ( String ... hostReservationIdSet ) { } } | if ( this . hostReservationIdSet == null ) { setHostReservationIdSet ( new com . amazonaws . internal . SdkInternalList < String > ( hostReservationIdSet . length ) ) ; } for ( String ele : hostReservationIdSet ) { this . hostReservationIdSet . add ( ele ) ; } return this ; |
public class AllureThreadContext { /** * Removes latest added uuid . Ignores empty context .
* @ return removed uuid . */
public Optional < String > stop ( ) { } } | final LinkedList < String > uuids = context . get ( ) ; if ( ! uuids . isEmpty ( ) ) { return Optional . of ( uuids . pop ( ) ) ; } return Optional . empty ( ) ; |
public class ScreenBaseAwt { /** * Initialize the main frame .
* @ return The created main frame .
* @ throws LionEngineException If the engine has not been started . */
private JFrame initMainFrame ( ) { } } | final String title = getTitle ( ) ; final JFrame jframe = new JFrame ( title , conf ) ; jframe . setDefaultCloseOperation ( WindowConstants . DO_NOTHING_ON_CLOSE ) ; jframe . addWindowListener ( new WindowAdapter ( ) { @ Override public void windowClosing ( WindowEvent event ) { listeners . forEach ( ScreenListener :: notifyClosed ) ; } } ) ; jframe . setResizable ( false ) ; jframe . setUndecorated ( false ) ; jframe . setIgnoreRepaint ( true ) ; return jframe ; |
public class CmsSolrFieldConfiguration { /** * Adds the additional fields to the configuration , if they are not null . < p >
* @ param additionalFields the additional fields to add */
public void addAdditionalFields ( List < CmsSolrField > additionalFields ) { } } | if ( additionalFields != null ) { for ( CmsSolrField solrField : additionalFields ) { m_solrFields . put ( solrField . getName ( ) , solrField ) ; } } |
public class SuperPositionAbstract { /** * Check that the input to the superposition algorithms is valid .
* @ param fixed
* @ param moved */
protected void checkInput ( Point3d [ ] fixed , Point3d [ ] moved ) { } } | if ( fixed . length != moved . length ) throw new IllegalArgumentException ( "Point arrays to superpose are of different lengths." ) ; |
public class Assert { /** * Equivalent to
* assert ( o = = null ) : msg . get ( ) ;
* Note : message string is computed lazily . */
public static void checkNull ( Object o , Supplier < String > msg ) { } } | if ( o != null ) error ( msg . get ( ) ) ; |
public class TableCandidate { /** * Sets an empty metadata file
* @ param YNum
* the total number of table lines including footnote
* @ param cc
* the total number of table columns
* @ param wordsOfAPage
* the list of words in a document page
* @ param m _ docInfo
* an object of DocInfo */
public void setEmptyMetadataStructureLevel ( int YNum , int cc , List < TextPiece > wordsOfAPage , DocInfo m_docInfo ) { } } | String meta = "" ; meta = "<TableColumnHeading>\n" + "</TableColumnHeading>" + "\n" ; meta = meta + "<TableContent>\n" ; meta = meta + "</TableContent>" + "\n" ; meta = meta + "<TableRowHeading>" + "</TableRowHeading>" + "\n" ; meta = meta + "<TableFootnote>" ; meta = meta + "... </TableFootnote>" + "\n" ; meta = meta + "<ColumnNum>" + "</ColumnNum>" + "\n" ; meta = meta + "<RowNum>" + "</RowNum>" + "\n" ; meta = meta + "<ColumnCoordinates>" + "</ColumnCoordinates>" + "\n" ; meta = meta + "<TableHeight>" + "</TableHeight>" + "\n" ; meta = meta + "<TableWidth>" + "</TableWidth>" + "\n" ; meta = meta + "<isWideTable>" + m_WideTable + "</isWideTable>\n" ; m_referenceText = replaceAllSpecialChracters ( m_referenceText ) ; meta = meta + "<TableReferenceText>" + m_referenceText + "</TableReferenceText>" + "\n" ; meta = meta + "</Table>" + "\n" ; setMetadataStructureLevel ( meta ) ; int tableNum = m_docInfo . getTableNum ( ) ; |
public class AbstractHalProcessor { /** * - - - - - logging */
protected void debug ( String msg , Object ... args ) { } } | if ( processingEnv . getOptions ( ) . containsKey ( "debug" ) ) { messager . printMessage ( NOTE , String . format ( msg , args ) ) ; } |
public class BinaryStorage { /** * Creates a default storage configuration , which will be used whenever no specific binary store is configured .
* @ return a { @ link org . modeshape . jboss . service . BinaryStorage } instance , never { @ code null } */
static BinaryStorage defaultConfig ( ) { } } | // By default binaries are not stored on disk
EditableDocument binaries = Schematic . newDocument ( ) ; binaries . set ( RepositoryConfiguration . FieldName . TYPE , RepositoryConfiguration . FieldValue . BINARY_STORAGE_TYPE_TRANSIENT ) ; return new BinaryStorage ( binaries ) ; |
public class FaceletCompositionContextImpl { /** * Pushes validationGroups to the stack .
* @ param validationGroups
* @ since 2.0 */
@ Override public void pushValidationGroupsToStack ( String validationGroups ) { } } | if ( _validationGroupsStack == null ) { _validationGroupsStack = new LinkedList < String > ( ) ; } _validationGroupsStack . addFirst ( validationGroups ) ; |
public class FNCImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . FNC__RETIRED : return RETIRED_EDEFAULT == null ? retired != null : ! RETIRED_EDEFAULT . equals ( retired ) ; case AfplibPackage . FNC__PAT_TECH : return PAT_TECH_EDEFAULT == null ? patTech != null : ! PAT_TECH_EDEFAULT . equals ( patTech ) ; case AfplibPackage . FNC__RESERVED1 : return RESERVED1_EDEFAULT == null ? reserved1 != null : ! RESERVED1_EDEFAULT . equals ( reserved1 ) ; case AfplibPackage . FNC__FNT_FLAGS : return FNT_FLAGS_EDEFAULT == null ? fntFlags != null : ! FNT_FLAGS_EDEFAULT . equals ( fntFlags ) ; case AfplibPackage . FNC__XUNIT_BASE : return XUNIT_BASE_EDEFAULT == null ? xUnitBase != null : ! XUNIT_BASE_EDEFAULT . equals ( xUnitBase ) ; case AfplibPackage . FNC__YUNIT_BASE : return YUNIT_BASE_EDEFAULT == null ? yUnitBase != null : ! YUNIT_BASE_EDEFAULT . equals ( yUnitBase ) ; case AfplibPackage . FNC__XFT_UNITS : return XFT_UNITS_EDEFAULT == null ? xftUnits != null : ! XFT_UNITS_EDEFAULT . equals ( xftUnits ) ; case AfplibPackage . FNC__YFT_UNITS : return YFT_UNITS_EDEFAULT == null ? yftUnits != null : ! YFT_UNITS_EDEFAULT . equals ( yftUnits ) ; case AfplibPackage . FNC__MAX_BOX_WD : return MAX_BOX_WD_EDEFAULT == null ? maxBoxWd != null : ! MAX_BOX_WD_EDEFAULT . equals ( maxBoxWd ) ; case AfplibPackage . FNC__MAX_BOX_HT : return MAX_BOX_HT_EDEFAULT == null ? maxBoxHt != null : ! MAX_BOX_HT_EDEFAULT . equals ( maxBoxHt ) ; case AfplibPackage . FNC__FNORG_LEN : return FNORG_LEN_EDEFAULT == null ? fnorgLen != null : ! FNORG_LEN_EDEFAULT . equals ( fnorgLen ) ; case AfplibPackage . FNC__FNIRG_LEN : return FNIRG_LEN_EDEFAULT == null ? fnirgLen != null : ! FNIRG_LEN_EDEFAULT . equals ( fnirgLen ) ; case AfplibPackage . FNC__PAT_ALIGN : return PAT_ALIGN_EDEFAULT == null ? patAlign != null : ! PAT_ALIGN_EDEFAULT . equals ( patAlign ) ; case AfplibPackage . FNC__RPAT_DCNT : return RPAT_DCNT_EDEFAULT == null ? rPatDCnt != null : ! RPAT_DCNT_EDEFAULT . equals ( rPatDCnt ) ; case AfplibPackage . FNC__FNPRG_LEN : return FNPRG_LEN_EDEFAULT == null ? fnprgLen != null : ! FNPRG_LEN_EDEFAULT . equals ( fnprgLen ) ; case AfplibPackage . FNC__FNMRG_LEN : return FNMRG_LEN_EDEFAULT == null ? fnmrgLen != null : ! FNMRG_LEN_EDEFAULT . equals ( fnmrgLen ) ; case AfplibPackage . FNC__RES_XU_BASE : return RES_XU_BASE_EDEFAULT == null ? resXUBase != null : ! RES_XU_BASE_EDEFAULT . equals ( resXUBase ) ; case AfplibPackage . FNC__RES_YU_BASE : return RES_YU_BASE_EDEFAULT == null ? resYUBase != null : ! RES_YU_BASE_EDEFAULT . equals ( resYUBase ) ; case AfplibPackage . FNC__XFR_UNITS : return XFR_UNITS_EDEFAULT == null ? xfrUnits != null : ! XFR_UNITS_EDEFAULT . equals ( xfrUnits ) ; case AfplibPackage . FNC__YFR_UNITS : return YFR_UNITS_EDEFAULT == null ? yfrUnits != null : ! YFR_UNITS_EDEFAULT . equals ( yfrUnits ) ; case AfplibPackage . FNC__OPAT_DCNT : return OPAT_DCNT_EDEFAULT == null ? oPatDCnt != null : ! OPAT_DCNT_EDEFAULT . equals ( oPatDCnt ) ; case AfplibPackage . FNC__RESERVED2 : return RESERVED2_EDEFAULT == null ? reserved2 != null : ! RESERVED2_EDEFAULT . equals ( reserved2 ) ; case AfplibPackage . FNC__FNNRG_LEN : return FNNRG_LEN_EDEFAULT == null ? fnnrgLen != null : ! FNNRG_LEN_EDEFAULT . equals ( fnnrgLen ) ; case AfplibPackage . FNC__FNND_CNT : return FNND_CNT_EDEFAULT == null ? fnndCnt != null : ! FNND_CNT_EDEFAULT . equals ( fnndCnt ) ; case AfplibPackage . FNC__FNN_MAP_CNT : return FNN_MAP_CNT_EDEFAULT == null ? fnnMapCnt != null : ! FNN_MAP_CNT_EDEFAULT . equals ( fnnMapCnt ) ; case AfplibPackage . FNC__TRIPLETS : return triplets != null && ! triplets . isEmpty ( ) ; } return super . eIsSet ( featureID ) ; |
public class backup_file { /** * < pre >
* Converts API response of bulk operation into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } } | backup_file_responses result = ( backup_file_responses ) service . get_payload_formatter ( ) . string_to_resource ( backup_file_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result . message , result . errorcode , ( base_response [ ] ) result . backup_file_response_array ) ; } backup_file [ ] result_backup_file = new backup_file [ result . backup_file_response_array . length ] ; for ( int i = 0 ; i < result . backup_file_response_array . length ; i ++ ) { result_backup_file [ i ] = result . backup_file_response_array [ i ] . backup_file [ 0 ] ; } return result_backup_file ; |
public class AmazonInspectorClient { /** * Describes the assessment targets that are specified by the ARNs of the assessment targets .
* @ param describeAssessmentTargetsRequest
* @ return Result of the DescribeAssessmentTargets operation returned by the service .
* @ throws InternalException
* Internal server error .
* @ throws InvalidInputException
* The request was rejected because an invalid or out - of - range value was supplied for an input parameter .
* @ sample AmazonInspector . DescribeAssessmentTargets
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / inspector - 2016-02-16 / DescribeAssessmentTargets "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DescribeAssessmentTargetsResult describeAssessmentTargets ( DescribeAssessmentTargetsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeAssessmentTargets ( request ) ; |
public class KllFloatsSketch { /** * Merges another sketch into this one .
* @ param other sketch to merge into this one */
public void merge ( final KllFloatsSketch other ) { } } | if ( ( other == null ) || other . isEmpty ( ) ) { return ; } if ( m_ != other . m_ ) { throw new SketchesArgumentException ( "incompatible M: " + m_ + " and " + other . m_ ) ; } final long finalN = n_ + other . n_ ; for ( int i = other . levels_ [ 0 ] ; i < other . levels_ [ 1 ] ; i ++ ) { update ( other . items_ [ i ] ) ; } if ( other . numLevels_ >= 2 ) { mergeHigherLevels ( other , finalN ) ; } if ( Float . isNaN ( minValue_ ) || ( other . minValue_ < minValue_ ) ) { minValue_ = other . minValue_ ; } if ( Float . isNaN ( maxValue_ ) || ( other . maxValue_ > maxValue_ ) ) { maxValue_ = other . maxValue_ ; } n_ = finalN ; assertCorrectTotalWeight ( ) ; if ( other . isEstimationMode ( ) ) { minK_ = min ( minK_ , other . minK_ ) ; } |
public class ListEnabledProductsForImportResult { /** * A list of ARNs for the resources that represent your subscriptions to products .
* @ param productSubscriptions
* A list of ARNs for the resources that represent your subscriptions to products . */
public void setProductSubscriptions ( java . util . Collection < String > productSubscriptions ) { } } | if ( productSubscriptions == null ) { this . productSubscriptions = null ; return ; } this . productSubscriptions = new java . util . ArrayList < String > ( productSubscriptions ) ; |
public class ValidatorElementList { /** * 获取验证器链
* @ return 验证器链 */
public List < ValidatorElement > getAllValidatorElements ( ) { } } | List < ValidatorElement > ret = CollectionUtil . createArrayList ( ) ; for ( ListAble < ValidatorElement > e : validatorElementLinkedList ) { ret . addAll ( e . getAsList ( ) ) ; } return ret ; |
public class ExponentialTimer { /** * Attempts to perform a timer tick . One of three scenarios can be encountered :
* 1 . the timer has expired
* 2 . the next event is not ready
* 3 . the next event is generated
* The last option has the side - effect of updating the internal state of the timer to reflect
* the generation of the event .
* @ return the { @ link Result } that indicates which scenario was encountered */
public Result tick ( ) { } } | if ( System . currentTimeMillis ( ) >= mLastEventHorizonMs ) { return Result . EXPIRED ; } if ( System . currentTimeMillis ( ) < mNextEventMs ) { return Result . NOT_READY ; } mNextEventMs = System . currentTimeMillis ( ) + mIntervalMs ; long next = Math . min ( mIntervalMs * 2 , mMaxIntervalMs ) ; // Account for overflow .
if ( next < mIntervalMs ) { next = Integer . MAX_VALUE ; } mIntervalMs = next ; mNumEvents ++ ; return Result . READY ; |
public class AiMesh { /** * Returns the z - coordinate of a vertex tangent .
* @ param vertex the vertex index
* @ return the z coordinate */
public float getTangentZ ( int vertex ) { } } | if ( ! hasTangentsAndBitangents ( ) ) { throw new IllegalStateException ( "mesh has no tangents" ) ; } checkVertexIndexBounds ( vertex ) ; return m_tangents . getFloat ( ( vertex * 3 + 2 ) * SIZEOF_FLOAT ) ; |
public class EXXMarketDataServiceRaw { /** * getEXXTicker
* @ return Object
* @ throws IOException */
public EXXTickerResponse getExxTicker ( CurrencyPair currencyPair ) throws IOException { } } | return exx . getTicker ( EXXAdapters . toSymbol ( currencyPair ) ) ; |
public class SqlGeneratorDefaultImpl { /** * @ param crit Selection criteria
* 26/06/99 Change statement to a StringBuffer for efficiency */
public String asSQLStatement ( Criteria crit , ClassDescriptor cld ) { } } | Enumeration e = crit . getElements ( ) ; StringBuffer statement = new StringBuffer ( ) ; while ( e . hasMoreElements ( ) ) { Object o = e . nextElement ( ) ; if ( o instanceof Criteria ) { String addAtStart ; String addAtEnd ; Criteria pc = ( Criteria ) o ; // need to add parenthesises ?
if ( pc . isEmbraced ( ) ) { addAtStart = " (" ; addAtEnd = ") " ; } else { addAtStart = "" ; addAtEnd = "" ; } switch ( pc . getType ( ) ) { case ( Criteria . OR ) : { statement . append ( " OR " ) . append ( addAtStart ) ; statement . append ( asSQLStatement ( pc , cld ) ) ; statement . append ( addAtEnd ) ; break ; } case ( Criteria . AND ) : { statement . insert ( 0 , "( " ) ; statement . append ( ") " ) ; statement . append ( " AND " ) . append ( addAtStart ) ; statement . append ( asSQLStatement ( pc , cld ) ) ; statement . append ( addAtEnd ) ; break ; } } } else { SelectionCriteria c = ( SelectionCriteria ) o ; if ( statement . length ( ) == 0 ) { statement . append ( asSQLClause ( c , cld ) ) ; } else { statement . insert ( 0 , "(" ) ; statement . append ( ") " ) ; statement . append ( " AND " ) ; statement . append ( asSQLClause ( c , cld ) ) ; } } } // while
if ( statement . length ( ) == 0 ) { return null ; } return statement . toString ( ) ; |
public class MoneyParseContext { /** * Merges the child context back into this instance .
* @ param child the child context , not null */
void mergeChild ( MoneyParseContext child ) { } } | setLocale ( child . getLocale ( ) ) ; setText ( child . getText ( ) ) ; setIndex ( child . getIndex ( ) ) ; setErrorIndex ( child . getErrorIndex ( ) ) ; setCurrency ( child . getCurrency ( ) ) ; setAmount ( child . getAmount ( ) ) ; |
public class StoriesBase { /** * Updates the story and returns the full record for the updated story .
* Only comment stories can have their text updated , and only comment stories and
* attachment stories can be pinned . Only one of ` text ` and ` html _ text ` can be specified .
* @ param story Globally unique identifier for the story .
* @ return Request object */
public ItemRequest < Story > update ( String story ) { } } | String path = String . format ( "/stories/%s" , story ) ; return new ItemRequest < Story > ( this , Story . class , path , "PUT" ) ; |
public class Vector2d { /** * / * ( non - Javadoc )
* @ see org . joml . Vector2dc # negate ( org . joml . Vector2d ) */
public Vector2d negate ( Vector2d dest ) { } } | dest . x = - x ; dest . y = - y ; return dest ; |
public class DMatrixRMaj { /** * Creates a new DMatrixRMaj around the provided data . The data must encode
* a row - major matrix . Any modification to the returned matrix will modify the
* provided data .
* @ param numRows Number of rows in the matrix .
* @ param numCols Number of columns in the matrix .
* @ param data Data that is being wrapped . Referenced Saved .
* @ return A matrix which references the provided data internally . */
public static DMatrixRMaj wrap ( int numRows , int numCols , double [ ] data ) { } } | DMatrixRMaj s = new DMatrixRMaj ( ) ; s . data = data ; s . numRows = numRows ; s . numCols = numCols ; return s ; |
public class ProviderHelper { /** * Parse url string to ProviderInfo .
* @ param url the url
* @ return ProviderInfo */
public static ProviderInfo toProviderInfo ( String url ) { } } | ProviderInfo providerInfo = new ProviderInfo ( ) ; providerInfo . setOriginUrl ( url ) ; try { int protocolIndex = url . indexOf ( "://" ) ; String remainUrl ; if ( protocolIndex > - 1 ) { String protocol = url . substring ( 0 , protocolIndex ) . toLowerCase ( ) ; providerInfo . setProtocolType ( protocol ) ; remainUrl = url . substring ( protocolIndex + 3 ) ; } else { // 默认
remainUrl = url ; } int addressIndex = remainUrl . indexOf ( StringUtils . CONTEXT_SEP ) ; String address ; if ( addressIndex > - 1 ) { address = remainUrl . substring ( 0 , addressIndex ) ; remainUrl = remainUrl . substring ( addressIndex ) ; } else { int itfIndex = remainUrl . indexOf ( '?' ) ; if ( itfIndex > - 1 ) { address = remainUrl . substring ( 0 , itfIndex ) ; remainUrl = remainUrl . substring ( itfIndex ) ; } else { address = remainUrl ; remainUrl = "" ; } } String [ ] ipAndPort = address . split ( ":" , - 1 ) ; // TODO 不支持ipv6
providerInfo . setHost ( ipAndPort [ 0 ] ) ; if ( ipAndPort . length > 1 ) { providerInfo . setPort ( CommonUtils . parseInt ( ipAndPort [ 1 ] , providerInfo . getPort ( ) ) ) ; } // 后面可以解析remainUrl得到interface等 / xxx ? a = 1 & b = 2
if ( remainUrl . length ( ) > 0 ) { int itfIndex = remainUrl . indexOf ( '?' ) ; if ( itfIndex > - 1 ) { String itf = remainUrl . substring ( 0 , itfIndex ) ; providerInfo . setPath ( itf ) ; // 剩下是params , 例如a = 1 & b = 2
remainUrl = remainUrl . substring ( itfIndex + 1 ) ; String [ ] params = remainUrl . split ( "&" , - 1 ) ; for ( String parm : params ) { String [ ] kvpair = parm . split ( "=" , - 1 ) ; if ( ProviderInfoAttrs . ATTR_WEIGHT . equals ( kvpair [ 0 ] ) && StringUtils . isNotEmpty ( kvpair [ 1 ] ) ) { int weight = CommonUtils . parseInt ( kvpair [ 1 ] , providerInfo . getWeight ( ) ) ; providerInfo . setWeight ( weight ) ; providerInfo . setStaticAttr ( ProviderInfoAttrs . ATTR_WEIGHT , String . valueOf ( weight ) ) ; } else if ( ProviderInfoAttrs . ATTR_RPC_VERSION . equals ( kvpair [ 0 ] ) && StringUtils . isNotEmpty ( kvpair [ 1 ] ) ) { providerInfo . setRpcVersion ( CommonUtils . parseInt ( kvpair [ 1 ] , providerInfo . getRpcVersion ( ) ) ) ; } else if ( ProviderInfoAttrs . ATTR_SERIALIZATION . equals ( kvpair [ 0 ] ) && StringUtils . isNotEmpty ( kvpair [ 1 ] ) ) { providerInfo . setSerializationType ( kvpair [ 1 ] ) ; } else { providerInfo . getStaticAttrs ( ) . put ( kvpair [ 0 ] , kvpair [ 1 ] ) ; } } } else { providerInfo . setPath ( remainUrl ) ; } } else { providerInfo . setPath ( StringUtils . EMPTY ) ; } } catch ( Exception e ) { throw new IllegalArgumentException ( "Failed to convert url to provider, the wrong url is:" + url , e ) ; } return providerInfo ; |
public class Try { /** * Given a < code > { @ link CheckedSupplier } & lt ; { @ link AutoCloseable } & gt ; < / code > < code > aSupplier < / code > and a
* { @ link Function } < code > fn < / code > , apply < code > fn < / code > to the result of < code > aSupplier < / code > , ensuring
* that the result has its { @ link AutoCloseable # close ( ) close } method invoked , regardless of the outcome .
* If the resource creation process throws , the function body throws , or the
* { @ link AutoCloseable # close ( ) close method } throws , the result is a failure . If both the function body and the
* { @ link AutoCloseable # close ( ) close method } throw , the result is a failure over the function body
* { @ link Throwable } with the { @ link AutoCloseable # close ( ) close method } { @ link Throwable } added as a
* { @ link Throwable # addSuppressed ( Throwable ) suppressed } { @ link Throwable } . If only the
* { @ link AutoCloseable # close ( ) close method } throws , the result is a failure over that { @ link Throwable } .
* Note that < code > withResources < / code > calls can be nested , in which case all of the above specified exception
* handling applies , where closing the previously created resource is considered part of the body of the next
* < code > withResources < / code > calls , and { @ link Throwable Throwables } are considered suppressed in the same manner .
* Additionally , { @ link AutoCloseable # close ( ) close methods } are invoked in the inverse order of resource creation .
* This is { @ link Try } ' s equivalent of
* < a href = " https : / / docs . oracle . com / javase / tutorial / essential / exceptions / tryResourceClose . html " target = " _ top " >
* try - with - resources < / a > , introduced in Java 7.
* @ param aSupplier the resource supplier
* @ param fn the function body
* @ param < A > the resource type
* @ param < B > the function return type
* @ return a { @ link Try } representing the result of the function ' s application to the resource */
@ SuppressWarnings ( "try" ) public static < A extends AutoCloseable , B > Try < Exception , B > withResources ( CheckedSupplier < ? extends Exception , A > aSupplier , CheckedFn1 < ? extends Exception , ? super A , ? extends Try < ? extends Exception , ? extends B > > fn ) { } } | return trying ( ( ) -> { try ( A resource = aSupplier . get ( ) ) { return fn . apply ( resource ) . < Exception , B > biMap ( upcast ( ) , upcast ( ) ) ; } } ) . flatMap ( id ( ) ) ; |
public class UnsafeBuffer { public String getStringAscii ( final int index ) { } } | if ( SHOULD_BOUNDS_CHECK ) { boundsCheck0 ( index , SIZE_OF_INT ) ; } final int length = UNSAFE . getInt ( byteArray , addressOffset + index ) ; return getStringAscii ( index , length ) ; |
public class MutableDouble { /** * Use the supplied function to perform a lazy transform operation when getValue is called
* < pre >
* { @ code
* MutableDouble mutable = MutableDouble . fromExternal ( ( ) - > ! this . value , val - > ! this . value ) ;
* Mutable < Double > withOverride = mutable . mapOutputToObj ( b - > {
* if ( override )
* return 10.0;
* return b ;
* < / pre >
* @ param fn Map function to be applied to the result when getValue is called
* @ return Mutable that lazily applies the provided function when getValue is called to the return value */
public < R > Mutable < R > mapOutputToObj ( final Function < Double , R > fn ) { } } | final MutableDouble host = this ; return new Mutable < R > ( ) { @ Override public R get ( ) { return fn . apply ( host . get ( ) ) ; } } ; |
public class DomConfigurationFactory { /** * Parse constant pattern element
* @ param el DOM element
* @ param ignoreCase if true the constant must ignore case
* @ return constant definition */
private Constant parseConstant ( Node el , boolean ignoreCase ) { } } | return new Constant ( nodeAttribute ( el , TAG_CONSTANT_ATTR_VALUE ) , nodeAttribute ( el , TAG_CONSTANT_ATTR_IGNORE_CASE , ignoreCase ) , nodeAttribute ( el , TAG_ATTR_GHOST , PatternElement . DEFAULT_GHOST_VALUE ) ) ; |
public class MapboxIsochrone { /** * Build a new { @ link MapboxIsochrone } object with the initial value set for
* { @ link # baseUrl ( ) } .
* @ return a { @ link MapboxIsochrone . Builder } object for creating this object
* @ since 4.6.0 */
public static Builder builder ( ) { } } | return new AutoValue_MapboxIsochrone . Builder ( ) . baseUrl ( Constants . BASE_API_URL ) . user ( IsochroneCriteria . PROFILE_DEFAULT_USER ) ; |
public class AssayDepotImpl { /** * Provider refs are actually opened and closed with the JSON Array chars ' [ ' and ' ] '
* @ param jp
* @ param results
* @ throws JsonParseException
* @ throws IOException */
private void parseProviderRefs ( JsonParser jp , Results results ) throws JsonParseException , IOException { } } | ProviderRef pRef = null ; String fieldName = null ; while ( jp . nextToken ( ) != JsonToken . END_ARRAY ) { pRef = new ProviderRef ( ) ; pRef . setLocations ( new ArrayList < Map < String , String > > ( ) ) ; while ( jp . nextToken ( ) != JsonToken . END_OBJECT ) { fieldName = jp . getCurrentName ( ) ; if ( "id" . equals ( fieldName ) ) { pRef . setId ( jp . getText ( ) ) ; } else if ( "slug" . equals ( fieldName ) ) { pRef . setSlug ( jp . getText ( ) ) ; } else if ( "name" . equals ( fieldName ) ) { pRef . setName ( jp . getText ( ) ) ; } else if ( "snippet" . equals ( fieldName ) ) { pRef . setSnippet ( jp . getText ( ) ) ; } else if ( "permission" . equals ( fieldName ) ) { pRef . setPermission ( jp . getText ( ) ) ; } else if ( "score" . equals ( fieldName ) ) { // pRef . setScore ( jp . getFloatValue ( ) ) ;
} else if ( "locations" . equals ( fieldName ) ) { getLocations ( jp , pRef ) ; } else if ( "urls" . equals ( fieldName ) ) { getUrls ( jp , pRef ) ; } } results . getProviderRefs ( ) . add ( pRef ) ; } |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getDIR ( ) { } } | if ( dirEClass == null ) { dirEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 327 ) ; } return dirEClass ; |
public class MoveAnalysis { @ Override public void visitDereference ( Expr . Dereference expr , Boolean consumed ) { } } | visitExpression ( expr . getOperand ( ) , false ) ; |
public class MongoDBClientFactory { /** * ( non - Javadoc )
* @ see
* com . impetus . kundera . loader . GenericClientFactory # onValidation ( java . lang
* . String , java . lang . String ) */
@ Override protected void onValidation ( final String contactNode , final String defaultPort ) { } } | if ( contactNode != null ) { // allow configuration as comma - separated list of host : port
// addresses without the default port
boolean allAddressesHaveHostAndPort = true ; for ( String node : contactNode . split ( Constants . COMMA ) ) { if ( StringUtils . countMatches ( node , Constants . COLON ) == 1 ) { // node is given with hostname and port
// count = = 1 is to exclude IPv6 addresses
if ( StringUtils . isNumeric ( node . split ( Constants . COLON ) [ 1 ] ) ) { continue ; } } allAddressesHaveHostAndPort = false ; break ; } if ( allAddressesHaveHostAndPort ) { return ; } } // fall back to the generic validation which requires the default port
// to be set
super . onValidation ( contactNode , defaultPort ) ; |
public class SshX509RsaSha1PublicKey { /** * Encode the public key into a blob of binary data , the encoded result will
* be passed into init to recreate the key .
* @ return an encoded byte array
* @ throws SshException
* @ todo Implement this com . sshtools . ssh . SshPublicKey method */
public byte [ ] getEncoded ( ) throws SshException { } } | ByteArrayWriter baw = new ByteArrayWriter ( ) ; try { baw . writeString ( getAlgorithm ( ) ) ; baw . writeBinaryString ( cert . getEncoded ( ) ) ; return baw . toByteArray ( ) ; } catch ( Throwable ex ) { throw new SshException ( "Failed to encoded key data" , SshException . INTERNAL_ERROR , ex ) ; } finally { try { baw . close ( ) ; } catch ( IOException e ) { } } |
public class E1Function { /** * { @ inheritDoc } */
protected void updateScores ( int newCentroidIndex , int oldCentroidIndex , DoubleVector vector ) { } } | simToComplete [ newCentroidIndex ] += VectorMath . dotProduct ( completeCentroid , vector ) ; simToComplete [ oldCentroidIndex ] -= VectorMath . dotProduct ( completeCentroid , vector ) ; |
public class ActionButton { /** * Used to display a progress bar and disable the button .
* @ param show whether to show the progress bar or not . */
public void showProgress ( boolean show ) { } } | Log . v ( TAG , show ? "Disabling the button while showing progress" : "Enabling the button and hiding progress" ) ; setEnabled ( ! show ) ; progress . setVisibility ( show ? VISIBLE : GONE ) ; if ( show ) { icon . setVisibility ( INVISIBLE ) ; labeledLayout . setVisibility ( INVISIBLE ) ; return ; } icon . setVisibility ( shouldShowLabel ? GONE : VISIBLE ) ; labeledLayout . setVisibility ( ! shouldShowLabel ? GONE : VISIBLE ) ; |
public class Sorting { /** * Parse the sorting part of the URI and return sortBy and sortDirection counterparts
* @ param url String representing the sorting part of the URI , which is of the form SortBy = < field > : < direction > ' , for example : ' ? SortBy = date _ created : asc '
* @ return a map containing sortBy and sortDirection
* @ throws Exception if there is a parsing error */
public static Map < String , String > parseUrl ( String url ) throws Exception { } } | final String [ ] values = url . split ( ":" , 2 ) ; HashMap < String , String > sortParameters = new HashMap < String , String > ( ) ; sortParameters . put ( SORT_BY_KEY , values [ 0 ] ) ; if ( values . length > 1 ) { sortParameters . put ( SORT_DIRECTION_KEY , values [ 1 ] ) ; if ( sortParameters . get ( SORT_BY_KEY ) . isEmpty ( ) ) { throw new Exception ( "Error parsing the SortBy parameter: missing field to sort by" ) ; } if ( ! sortParameters . get ( SORT_DIRECTION_KEY ) . equalsIgnoreCase ( Direction . ASC . name ( ) ) && ! sortParameters . get ( SORT_DIRECTION_KEY ) . equalsIgnoreCase ( Direction . DESC . name ( ) ) ) { throw new Exception ( "Error parsing the SortBy parameter: sort direction needs to be either " + Direction . ASC + " or " + Direction . DESC ) ; } } else if ( values . length == 1 ) { // Default to ascending if only the sorting field has been passed without direction
sortParameters . put ( SORT_DIRECTION_KEY , Direction . ASC . name ( ) ) ; } return sortParameters ; |
public class AtomicLongMap { /** * Removes all mappings from this map whose values are zero .
* < p > This method is not atomic : the map may be visible in intermediate states , where some of the
* zero values have been removed and others have not . */
public void removeAllZeros ( ) { } } | Iterator < Map . Entry < K , AtomicLong > > entryIterator = map . entrySet ( ) . iterator ( ) ; while ( entryIterator . hasNext ( ) ) { Map . Entry < K , AtomicLong > entry = entryIterator . next ( ) ; AtomicLong atomic = entry . getValue ( ) ; if ( atomic != null && atomic . get ( ) == 0L ) { entryIterator . remove ( ) ; } } |
public class SpacefillingKNNPreprocessor { /** * Initialize an integer value range .
* @ param start Starting value
* @ param end End value ( exclusive )
* @ return Array of integers start . . end , excluding end . */
public static int [ ] range ( int start , int end ) { } } | int [ ] out = new int [ end - start ] ; for ( int i = 0 , j = start ; j < end ; i ++ , j ++ ) { out [ i ] = j ; } return out ; |
public class AppServiceCertificateOrdersInner { /** * Renew an existing certificate order .
* Renew an existing certificate order .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param certificateOrderName Name of the certificate order .
* @ param renewCertificateOrderRequest Renew parameters
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < Void > renewAsync ( String resourceGroupName , String certificateOrderName , RenewCertificateOrderRequest renewCertificateOrderRequest ) { } } | return renewWithServiceResponseAsync ( resourceGroupName , certificateOrderName , renewCertificateOrderRequest ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class InternalSARLLexer { /** * $ ANTLR start " T _ _ 104" */
public final void mT__104 ( ) throws RecognitionException { } } | try { int _type = T__104 ; int _channel = DEFAULT_TOKEN_CHANNEL ; // InternalSARL . g : 90:8 : ( ' fires ' )
// InternalSARL . g : 90:10 : ' fires '
{ match ( "fires" ) ; } state . type = _type ; state . channel = _channel ; } finally { } |
public class CassandraDataHandlerBase { /** * Compose and add .
* @ param entity
* the entity
* @ param cqlMetadata
* the cql metadata
* @ param thriftColumnValue
* the thrift column value
* @ param thriftColumnName
* the thrift column name */
private void composeAndAdd ( HashMap entity , CqlMetadata cqlMetadata , Object thriftColumnValue , String thriftColumnName ) { } } | byte [ ] columnName = thriftColumnName . getBytes ( ) ; Map < ByteBuffer , String > schemaTypes = this . clientBase . getCqlMetadata ( ) . getValue_types ( ) ; AbstractType < ? > type = null ; try { type = TypeParser . parse ( schemaTypes . get ( ByteBuffer . wrap ( ( byte [ ] ) columnName ) ) ) ; } catch ( SyntaxException | ConfigurationException e ) { log . error ( e . getMessage ( ) ) ; throw new KunderaException ( "Error while parsing CQL Type " + e ) ; } entity . put ( thriftColumnName , type . compose ( ByteBuffer . wrap ( ( byte [ ] ) thriftColumnValue ) ) ) ; |
public class Messager { /** * print the warning and increment count */
private void printWarning ( String prefix , String msg ) { } } | if ( nwarnings < MaxWarnings ) { PrintWriter warnWriter = getWriter ( WriterKind . WARNING ) ; printRawLines ( warnWriter , prefix + ": " + getText ( "javadoc.warning" ) + " - " + msg ) ; warnWriter . flush ( ) ; nwarnings ++ ; } |
public class DynamoDBExecutor { /** * And it may cause error because the " Object " is ambiguous to any type . */
PutItemResult putItem ( final String tableName , final Object entity ) { } } | return putItem ( tableName , toItem ( entity ) ) ; |
public class VdmProject { /** * Just do the basics : create a basic project .
* @ param location
* @ param projectName */
private static IProject createBaseProject ( String projectName , URI location ) { } } | // it is acceptable to use the ResourcesPlugin class
IProject newProject = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProject ( projectName ) ; if ( ! newProject . exists ( ) ) { URI projectLocation = location ; IProjectDescription desc = newProject . getWorkspace ( ) . newProjectDescription ( newProject . getName ( ) ) ; if ( location != null || ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getLocationURI ( ) . equals ( location ) ) { projectLocation = null ; } desc . setLocationURI ( projectLocation ) ; try { newProject . create ( desc , null ) ; if ( ! newProject . isOpen ( ) ) { newProject . open ( null ) ; } } catch ( CoreException e ) { VdmCore . log ( "VdmModelManager createBaseProject" , e ) ; } } return newProject ; |
public class Matrix4x3f { /** * Set only the translation components < code > ( m30 , m31 , m32 ) < / code > of this matrix to the values < code > ( xyz . x , xyz . y , xyz . z ) < / code > .
* To build a translation matrix instead , use { @ link # translation ( Vector3fc ) } .
* To apply a translation , use { @ link # translate ( Vector3fc ) } .
* @ see # translation ( Vector3fc )
* @ see # translate ( Vector3fc )
* @ param xyz
* the units to translate in < code > ( x , y , z ) < / code >
* @ return this */
public Matrix4x3f setTranslation ( Vector3fc xyz ) { } } | return setTranslation ( xyz . x ( ) , xyz . y ( ) , xyz . z ( ) ) ; |
public class JXMapViewer { /** * Converts the specified Point2D in the JXMapViewer ' s local coordinate space to a GeoPosition on the map . This
* method is especially useful for determining the GeoPosition under the mouse cursor .
* @ param pt a point in the local coordinate space of the map
* @ return the point converted to a GeoPosition */
public GeoPosition convertPointToGeoPosition ( Point2D pt ) { } } | // convert from local to world bitmap
Rectangle bounds = getViewportBounds ( ) ; Point2D pt2 = new Point2D . Double ( pt . getX ( ) + bounds . getX ( ) , pt . getY ( ) + bounds . getY ( ) ) ; // convert from world bitmap to geo
GeoPosition pos = getTileFactory ( ) . pixelToGeo ( pt2 , getZoom ( ) ) ; return pos ; |
public class AsynchronousRequest { /** * For more info on stories seasons API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / stories / seasons " > here < / a > < br / >
* Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwable ) } methods for custom interactions
* @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) }
* @ throws NullPointerException if given { @ link Callback } is empty
* @ see StorySeason story season info */
public void getAllStorySeasonID ( Callback < List < String > > callback ) throws NullPointerException { } } | gw2API . getAllStorySeasonIDs ( ) . enqueue ( callback ) ; |
public class OgmEntityPersister { /** * Adds the given entity to the inverse associations it manages . */
private void addToInverseAssociations ( Tuple resultset , int tableIndex , Serializable id , SharedSessionContractImplementor session ) { } } | new EntityAssociationUpdater ( this ) . id ( id ) . resultset ( resultset ) . session ( session ) . tableIndex ( tableIndex ) . propertyMightRequireInverseAssociationManagement ( propertyMightBeMainSideOfBidirectionalAssociation ) . addNavigationalInformationForInverseSide ( ) ; |
public class OrRule { /** * { @ inheritDoc } */
public boolean evaluate ( final LoggingEvent event , Map matches ) { } } | if ( matches == null ) { return ( rule1 . evaluate ( event , null ) || rule2 . evaluate ( event , null ) ) ; } Map tempMatches1 = new HashMap ( ) ; Map tempMatches2 = new HashMap ( ) ; // not short - circuiting because we want to build the matches list
boolean result1 = rule1 . evaluate ( event , tempMatches1 ) ; boolean result2 = rule2 . evaluate ( event , tempMatches2 ) ; boolean result = result1 || result2 ; if ( result ) { for ( Iterator iter = tempMatches1 . entrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) iter . next ( ) ; Object key = entry . getKey ( ) ; Set value = ( Set ) entry . getValue ( ) ; Set mainSet = ( Set ) matches . get ( key ) ; if ( mainSet == null ) { mainSet = new HashSet ( ) ; matches . put ( key , mainSet ) ; } mainSet . addAll ( value ) ; } for ( Iterator iter = tempMatches2 . entrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) iter . next ( ) ; Object key = entry . getKey ( ) ; Set value = ( Set ) entry . getValue ( ) ; Set mainSet = ( Set ) matches . get ( key ) ; if ( mainSet == null ) { mainSet = new HashSet ( ) ; matches . put ( key , mainSet ) ; } mainSet . addAll ( value ) ; } } return result ; |
public class Matrix4x3f { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix4x3fc # getTranslation ( org . joml . Vector3f ) */
public Vector3f getTranslation ( Vector3f dest ) { } } | dest . x = m30 ; dest . y = m31 ; dest . z = m32 ; return dest ; |
public class Levenshtein { /** * Searches the given collection of strings and returns a collection of
* strings similar to a given string < code > t < / code > . Uses reasonable default
* values for human - readable strings . The returned collection will be
* sorted according to their similarity with the string with the best
* match at the first position .
* @ param < T > the type of the strings in the given collection
* @ param ss the collection to search
* @ param t the string to compare to
* @ return a collection with similar strings */
public static < T extends CharSequence > Collection < T > findSimilar ( Collection < T > ss , CharSequence t ) { } } | // look for strings prefixed by ' t '
Collection < T > result = new LinkedHashSet < > ( ) ; for ( T s : ss ) { if ( StringUtils . startsWithIgnoreCase ( s , t ) ) { result . add ( s ) ; } } // find strings according to their levenshtein distance
Collection < T > mins = findMinimum ( ss , t , 5 , Math . min ( t . length ( ) - 1 , 7 ) ) ; result . addAll ( mins ) ; return result ; |
public class VisualContext { /** * Returns true if the font family is available .
* @ return The exact name of the font family or null if it ' s not available */
private String fontAvailable ( String family , String [ ] avail ) { } } | for ( int i = 0 ; i < avail . length ; i ++ ) if ( avail [ i ] . equalsIgnoreCase ( family ) ) return avail [ i ] ; return null ; |
public class JavacParser { /** * If tree is a concatenation of string literals , replace it
* by a single literal representing the concatenated string . */
protected JCExpression foldStrings ( JCExpression tree ) { } } | if ( ! allowStringFolding ) return tree ; ListBuffer < JCExpression > opStack = new ListBuffer < > ( ) ; ListBuffer < JCLiteral > litBuf = new ListBuffer < > ( ) ; boolean needsFolding = false ; JCExpression curr = tree ; while ( true ) { if ( curr . hasTag ( JCTree . Tag . PLUS ) ) { JCBinary op = ( JCBinary ) curr ; needsFolding |= foldIfNeeded ( op . rhs , litBuf , opStack , false ) ; curr = op . lhs ; } else { needsFolding |= foldIfNeeded ( curr , litBuf , opStack , true ) ; break ; // last one !
} } if ( needsFolding ) { List < JCExpression > ops = opStack . toList ( ) ; JCExpression res = ops . head ; for ( JCExpression op : ops . tail ) { res = F . at ( op . getStartPosition ( ) ) . Binary ( optag ( TokenKind . PLUS ) , res , op ) ; storeEnd ( res , getEndPos ( op ) ) ; } return res ; } else { return tree ; } |
public class InetAddress { /** * Do not delete . Called from native code . */
public static InetAddress getByAddress ( String host , byte [ ] addr , int scopeId ) throws UnknownHostException { } } | if ( host != null && host . length ( ) > 0 && host . charAt ( 0 ) == '[' ) { if ( host . charAt ( host . length ( ) - 1 ) == ']' ) { host = host . substring ( 1 , host . length ( ) - 1 ) ; } } if ( addr != null ) { if ( addr . length == Inet4Address . INADDRSZ ) { return new Inet4Address ( host , addr ) ; } else if ( addr . length == Inet6Address . INADDRSZ ) { byte [ ] newAddr = IPAddressUtil . convertFromIPv4MappedAddress ( addr ) ; if ( newAddr != null ) { return new Inet4Address ( host , newAddr ) ; } else { return new Inet6Address ( host , addr , scopeId ) ; } } } throw new UnknownHostException ( "addr is of illegal length" ) ; |
public class SwipeBack { /** * Attaches the SwipeBack to the Activity .
* @ param activity
* The activity the swipe back will be attached to .
* @ param type
* The { @ link SwipeBack . Type } of the drawer .
* @ param position
* Where to position the swipe back .
* @ param transformer
* @ return The created SwipeBack instance . */
public static SwipeBack attach ( Activity activity , Type type , Position position , SwipeBackTransformer transformer ) { } } | return attach ( activity , type , position , DRAG_WINDOW , transformer ) ; |
public class Policy { /** * < pre >
* Associates a list of ` members ` to a ` role ` .
* Multiple ` bindings ` must not be specified for the same ` role ` .
* ` bindings ` with no members will result in an error .
* < / pre >
* < code > repeated . google . iam . v1 . Binding bindings = 4 ; < / code > */
public com . google . iam . v1 . BindingOrBuilder getBindingsOrBuilder ( int index ) { } } | return bindings_ . get ( index ) ; |
public class RabbitmqClientFactory { /** * RabbitmqClientを初期化する 。
* @ return 初期化したインスタンス
* @ throws RabbitmqCommunicateException 初期化に失敗した場合 */
public RabbitmqClient createRabbitmqClient ( ) throws RabbitmqCommunicateException { } } | List < RabbitmqClusterContext > contextList = this . reader . readConfiguration ( ) ; return createRabbitmqClient ( contextList ) ; |
public class ReflectionUtils { /** * Determine whether the given method explicitly declares the given
* exception or one of its superclasses , which means that an exception of
* that type can be propagated as - is within a reflective invocation .
* @ param method the declaring method
* @ param exceptionType the exception to throw
* @ return { @ code true } if the exception can be thrown as - is ;
* { @ code false } if it needs to be wrapped */
public static boolean declaresException ( Method method , Class < ? > exceptionType ) { } } | Assert . notNull ( method , "Method must not be null" ) ; Class < ? > [ ] declaredExceptions = method . getExceptionTypes ( ) ; for ( Class < ? > declaredException : declaredExceptions ) { if ( declaredException . isAssignableFrom ( exceptionType ) ) { return true ; } } return false ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.