signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AppFramework { /** * Registers an object with the framework and relevant subsystems ( e . g . , the context manager ) .
* @ param object Object to register
* @ return True if object successfully registered . False if object was already registered . */
public synchronized boolean registerObject ( Object object ) { } } | if ( ! MiscUtil . containsInstance ( registeredObjects , object ) ) { if ( object instanceof IRegisterEvent ) { IRegisterEvent onRegister = ( IRegisterEvent ) object ; onRegisterList . add ( onRegister ) ; for ( Object obj : registeredObjects ) { onRegister . registerObject ( obj ) ; } } registeredObjects . add ( object ) ; for ( IRegisterEvent onRegister : onRegisterList ) { onRegister . registerObject ( object ) ; } return true ; } return false ; |
public class TaskState { /** * Adjust job - level metrics when the task gets retried .
* @ param branches number of forked branches */
public void adjustJobMetricsOnRetry ( int branches ) { } } | TaskMetrics metrics = TaskMetrics . get ( this ) ; for ( int i = 0 ; i < branches ; i ++ ) { String forkBranchId = ForkOperatorUtils . getForkId ( this . taskId , i ) ; long recordsWritten = metrics . getCounter ( MetricGroup . TASK . name ( ) , forkBranchId , RECORDS ) . getCount ( ) ; long bytesWritten = metrics . getCounter ( MetricGroup . TASK . name ( ) , forkBranchId , BYTES ) . getCount ( ) ; metrics . getCounter ( MetricGroup . JOB . name ( ) , this . jobId , RECORDS ) . dec ( recordsWritten ) ; metrics . getCounter ( MetricGroup . JOB . name ( ) , this . jobId , BYTES ) . dec ( bytesWritten ) ; } |
public class MetricsSystem { /** * Builds metric registry name for worker instance . The pattern is instance . uniqueId . metricName .
* @ param name the metric name
* @ return the metric registry name */
private static String getWorkerMetricName ( String name ) { } } | String result = CACHED_METRICS . get ( name ) ; if ( result != null ) { return result ; } return CACHED_METRICS . computeIfAbsent ( name , n -> getMetricNameWithUniqueId ( InstanceType . WORKER , name ) ) ; |
public class UpdateFunctionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateFunctionRequest updateFunctionRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateFunctionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateFunctionRequest . getApiId ( ) , APIID_BINDING ) ; protocolMarshaller . marshall ( updateFunctionRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( updateFunctionRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( updateFunctionRequest . getFunctionId ( ) , FUNCTIONID_BINDING ) ; protocolMarshaller . marshall ( updateFunctionRequest . getDataSourceName ( ) , DATASOURCENAME_BINDING ) ; protocolMarshaller . marshall ( updateFunctionRequest . getRequestMappingTemplate ( ) , REQUESTMAPPINGTEMPLATE_BINDING ) ; protocolMarshaller . marshall ( updateFunctionRequest . getResponseMappingTemplate ( ) , RESPONSEMAPPINGTEMPLATE_BINDING ) ; protocolMarshaller . marshall ( updateFunctionRequest . getFunctionVersion ( ) , FUNCTIONVERSION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getPGP ( ) { } } | if ( pgpEClass == null ) { pgpEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 313 ) ; } return pgpEClass ; |
public class Context { /** * Set threshold of executed instructions counter that triggers call to
* < code > observeInstructionCount ( ) < / code > .
* When the threshold is zero , instruction counting is disabled ,
* otherwise each time the run - time executes at least the threshold value
* of script instructions , < code > observeInstructionCount ( ) < / code > will
* be called . < br >
* Note that the meaning of " instruction " is not guaranteed to be
* consistent between compiled and interpretive modes : executing a given
* script or function in the different modes will result in different
* instruction counts against the threshold .
* { @ link # setGenerateObserverCount } is called with true if
* < code > threshold < / code > is greater than zero , false otherwise .
* @ param threshold The instruction threshold */
public final void setInstructionObserverThreshold ( int threshold ) { } } | if ( sealed ) onSealedMutation ( ) ; if ( threshold < 0 ) throw new IllegalArgumentException ( ) ; instructionThreshold = threshold ; setGenerateObserverCount ( threshold > 0 ) ; |
public class ValueNumberDataflow { /** * Build map of value numbers to param indices . The first parameter has
* index 0 , the second has index 1 , etc .
* @ param method
* the method analyzed by the ValueNumberAnalysis
* @ return the value number to parameter index map */
public Map < ValueNumber , Integer > getValueNumberToParamMap ( Method method ) { } } | return getValueNumberToParamMap ( method . getSignature ( ) , method . isStatic ( ) ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcTextLiteralWithExtent ( ) { } } | if ( ifcTextLiteralWithExtentEClass == null ) { ifcTextLiteralWithExtentEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 602 ) ; } return ifcTextLiteralWithExtentEClass ; |
public class SpiderParam { /** * Sets the how the spider handles parameters when checking URIs visited .
* @ param handleParametersVisited the new handle parameters visited value */
public void setHandleParameters ( HandleParametersOption handleParametersVisited ) { } } | this . handleParametersVisited = handleParametersVisited ; getConfig ( ) . setProperty ( SPIDER_HANDLE_PARAMETERS , handleParametersVisited . toString ( ) ) ; |
public class EndpointInfoBuilder { /** * Sets the fragment of the { @ code pathMapping } . */
public EndpointInfoBuilder fragment ( String fragment ) { } } | requireNonNull ( fragment , "fragment" ) ; checkState ( regexPathPrefix == null , "fragment cannot be set with regexPathPrefix: %s" , regexPathPrefix ) ; this . fragment = fragment ; return this ; |
public class CommerceOrderPersistenceImpl { /** * Returns the last commerce order in the ordered set where billingAddressId = & # 63 ; .
* @ param billingAddressId the billing address ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce order
* @ throws NoSuchOrderException if a matching commerce order could not be found */
@ Override public CommerceOrder findByBillingAddressId_Last ( long billingAddressId , OrderByComparator < CommerceOrder > orderByComparator ) throws NoSuchOrderException { } } | CommerceOrder commerceOrder = fetchByBillingAddressId_Last ( billingAddressId , orderByComparator ) ; if ( commerceOrder != null ) { return commerceOrder ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "billingAddressId=" ) ; msg . append ( billingAddressId ) ; msg . append ( "}" ) ; throw new NoSuchOrderException ( msg . toString ( ) ) ; |
public class ReadIndexSummary { /** * Records the removal of an element of the given size from the given generation .
* @ param size The size of the element to remove .
* @ param generation The generation of the element to remove . */
synchronized void remove ( long size , int generation ) { } } | Preconditions . checkArgument ( size >= 0 , "size must be a non-negative number" ) ; this . totalSize -= size ; if ( this . totalSize < 0 ) { this . totalSize = 0 ; } removeFromGeneration ( generation ) ; |
public class TrainingsImpl { /** * Update a tag .
* @ param projectId The project id
* @ param tagId The id of the target tag
* @ param updatedTag The updated tag model
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the Tag object */
public Observable < Tag > updateTagAsync ( UUID projectId , UUID tagId , Tag updatedTag ) { } } | return updateTagWithServiceResponseAsync ( projectId , tagId , updatedTag ) . map ( new Func1 < ServiceResponse < Tag > , Tag > ( ) { @ Override public Tag call ( ServiceResponse < Tag > response ) { return response . body ( ) ; } } ) ; |
public class DbxClientV1 { /** * Takes a copy of the file at the given revision and saves it over the current latest copy .
* This will create a new revision , but the file contents will match the revision you
* specified .
* @ param path
* The Dropbox path of the file to restore .
* @ param rev
* The revision of the file you want to use to overwrite the latest revision .
* @ return
* If the specified { @ code path } / { @ code rev } couldn ' t be found , return { @ code null } .
* Otherwise , return metadata for the newly - created latest revision of the file . */
public DbxEntry . /* @ Nullable */
File restoreFile ( String path , String rev ) throws DbxException { } } | DbxPathV1 . checkArgNonRoot ( "path" , path ) ; if ( rev == null ) throw new IllegalArgumentException ( "'rev' can't be null" ) ; if ( rev . length ( ) == 0 ) throw new IllegalArgumentException ( "'rev' can't be empty" ) ; String apiPath = "1/restore/auto" + path ; /* @ Nullable */
String [ ] params = { "rev" , rev , } ; return doGet ( host . getApi ( ) , apiPath , params , null , new DbxRequestUtil . ResponseHandler < DbxEntry . /* @ Nullable */
File > ( ) { public DbxEntry . /* @ Nullable */
File handle ( HttpRequestor . Response response ) throws DbxException { if ( response . getStatusCode ( ) == 404 ) return null ; if ( response . getStatusCode ( ) != 200 ) throw DbxRequestUtil . unexpectedStatus ( response ) ; return DbxRequestUtil . readJsonFromResponse ( DbxEntry . File . Reader , response ) ; } } ) ; |
public class ScriptableObject { /** * Defines a property on an object .
* Based on [ [ DefineOwnProperty ] ] from 8.12.10 of the spec .
* @ param cx the current Context
* @ param id the name / index of the property
* @ param desc the new property descriptor , as described in 8.6.1
* @ param checkValid whether to perform validity checks */
protected void defineOwnProperty ( Context cx , Object id , ScriptableObject desc , boolean checkValid ) { } } | Slot slot = getSlot ( cx , id , SlotAccess . QUERY ) ; boolean isNew = slot == null ; if ( checkValid ) { ScriptableObject current = slot == null ? null : slot . getPropertyDescriptor ( cx , this ) ; checkPropertyChange ( id , current , desc ) ; } boolean isAccessor = isAccessorDescriptor ( desc ) ; final int attributes ; if ( slot == null ) { // new slot
slot = getSlot ( cx , id , isAccessor ? SlotAccess . MODIFY_GETTER_SETTER : SlotAccess . MODIFY ) ; attributes = applyDescriptorToAttributeBitset ( DONTENUM | READONLY | PERMANENT , desc ) ; } else { attributes = applyDescriptorToAttributeBitset ( slot . getAttributes ( ) , desc ) ; } if ( isAccessor ) { if ( ! ( slot instanceof GetterSlot ) ) { slot = getSlot ( cx , id , SlotAccess . MODIFY_GETTER_SETTER ) ; } GetterSlot gslot = ( GetterSlot ) slot ; Object getter = getProperty ( desc , "get" ) ; if ( getter != NOT_FOUND ) { gslot . getter = getter ; } Object setter = getProperty ( desc , "set" ) ; if ( setter != NOT_FOUND ) { gslot . setter = setter ; } gslot . value = Undefined . instance ; gslot . setAttributes ( attributes ) ; } else { if ( slot instanceof GetterSlot && isDataDescriptor ( desc ) ) { slot = getSlot ( cx , id , SlotAccess . CONVERT_ACCESSOR_TO_DATA ) ; } Object value = getProperty ( desc , "value" ) ; if ( value != NOT_FOUND ) { slot . value = value ; } else if ( isNew ) { slot . value = Undefined . instance ; } slot . setAttributes ( attributes ) ; } |
public class InetAddress { /** * Returns the address of the local host . This is achieved by retrieving
* the name of the host from the system , then resolving that name into
* an < code > InetAddress < / code > .
* < P > Note : The resolved address may be cached for a short period of time .
* < p > If there is a security manager , its
* < code > checkConnect < / code > method is called
* with the local host name and < code > - 1 < / code >
* as its arguments to see if the operation is allowed .
* If the operation is not allowed , an InetAddress representing
* the loopback address is returned .
* @ return the address of the local host .
* @ exception UnknownHostException if the local host name could not
* be resolved into an address .
* @ see SecurityManager # checkConnect
* @ see java . net . InetAddress # getByName ( java . lang . String ) */
public static InetAddress getLocalHost ( ) throws UnknownHostException { } } | String local = Libcore . os . uname ( ) . nodename ; try { return impl . lookupAllHostAddr ( local , NETID_UNSET ) [ 0 ] ; } catch ( UnknownHostException e ) { try { // iOS devices don ' t map the hostname to an ip .
return impl . lookupAllHostAddr ( "127.0.0.1" , NETID_UNSET ) [ 0 ] ; } catch ( UnknownHostException e2 ) { throw e ; } } |
public class NetUtils { /** * 是否本地地址 127 . x . x . x 或者 localhost
* @ param host 地址
* @ return 是否本地地址 */
public static boolean isLocalHost ( String host ) { } } | return StringUtils . isNotBlank ( host ) && ( LOCAL_IP_PATTERN . matcher ( host ) . matches ( ) || "localhost" . equalsIgnoreCase ( host ) ) ; |
public class QuadTree { /** * Gets an iterator on the QuadTree . */
public QuadTreeIterator getIterator ( ) { } } | QuadTreeImpl . QuadTreeIteratorImpl iterator = m_impl . getIterator ( ) ; return new QuadTreeIterator ( iterator , false ) ; |
public class Element { /** * Parse a DOM attribute into MessageML element properties . */
void buildAttribute ( org . w3c . dom . Node item ) throws InvalidInputException { } } | switch ( item . getNodeName ( ) ) { case CLASS_ATTR : attributes . put ( CLASS_ATTR , getStringAttribute ( item ) ) ; break ; case STYLE_ATTR : final String styleAttribute = getStringAttribute ( item ) ; Styles . validate ( styleAttribute ) ; attributes . put ( STYLE_ATTR , styleAttribute ) ; break ; default : throw new InvalidInputException ( "Attribute \"" + item . getNodeName ( ) + "\" is not allowed in \"" + getMessageMLTag ( ) + "\"" ) ; } |
public class FileSnap { /** * find the last ( maybe ) valid n snapshots . this does some
* minor checks on the validity of the snapshots . It just
* checks for / at the end of the snapshot . This does
* not mean that the snapshot is truly valid but is
* valid with a high probability . also , the most recent
* will be first on the list .
* @ param n the number of most recent snapshots
* @ return the last n snapshots ( the number might be
* less than n in case enough snapshots are not available ) .
* @ throws IOException */
private List < File > findNValidSnapshots ( int n ) throws IOException { } } | List < File > files = Util . sortDataDir ( snapDir . listFiles ( ) , "snapshot" , false ) ; int count = 0 ; List < File > list = new ArrayList < File > ( ) ; for ( File f : files ) { // we should catch the exceptions
// from the valid snapshot and continue
// until we find a valid one
try { if ( Util . isValidSnapshot ( f ) ) { list . add ( f ) ; count ++ ; if ( count == n ) { break ; } } } catch ( IOException e ) { LOG . info ( "invalid snapshot " + f , e ) ; } } return list ; |
public class IgnoredResourcesPolicy { /** * Evaluates whether the destination provided matches any of the configured
* rules
* @ param config
* The { @ link IgnoredResourcesConfig } containing the
* rules
* @ param destination
* The destination to evaluate
* @ param verb
* HTTP verb or ' * ' for all verbs
* @ return true if any path matches the destination . false otherwise */
private boolean satisfiesAnyPath ( IgnoredResourcesConfig config , String destination , String verb ) { } } | if ( destination == null || destination . trim ( ) . length ( ) == 0 ) { destination = "/" ; // $ NON - NLS - 1 $
} for ( IgnoredResource resource : config . getRules ( ) ) { String resourceVerb = resource . getVerb ( ) ; boolean verbMatches = verb == null || IgnoredResource . VERB_MATCH_ALL . equals ( resourceVerb ) || verb . equalsIgnoreCase ( resourceVerb ) ; // $ NON - NLS - 1 $
boolean destinationMatches = destination . matches ( resource . getPathPattern ( ) ) ; if ( verbMatches && destinationMatches ) { return true ; } } return false ; |
public class NamingService { /** * Get the naming service for the nodes associated to a model .
* @ param mo the model to look at
* @ return the view if attached . { @ code null } otherwise */
@ SuppressWarnings ( "unchecked" ) public static NamingService < Node > getNodeNames ( Model mo ) { } } | return ( NamingService < Node > ) mo . getView ( ID + Node . TYPE ) ; |
public class SchemaEvolutionValidator { /** * / * package private */
void compareMapTypes ( Schema oldSchema , Schema newSchema , List < Message > messages , String name ) { } } | if ( oldSchema == null || newSchema == null || oldSchema . getType ( ) != Schema . Type . MAP ) { throw new IllegalArgumentException ( "Old schema must be MAP type. Name=" + name + ". Type=" + oldSchema ) ; } if ( newSchema . getType ( ) != Schema . Type . MAP ) { messages . add ( new Message ( Level . ERROR , "Illegal type change from " + oldSchema . getType ( ) + " to " + newSchema . getType ( ) + " for field " + name ) ) ; return ; } // Compare the array element types
compareTypes ( oldSchema . getValueType ( ) , newSchema . getValueType ( ) , messages , name + ".<map element>" ) ; |
public class CmsDbSettingsPanel { /** * Accesses a property from the DB configuration for the selected DB .
* @ param name the name of the property
* @ return the value of the property */
private String dbProp ( String name ) { } } | String dbType = m_setupBean . getDatabase ( ) ; Object prop = m_setupBean . getDatabaseProperties ( ) . get ( dbType ) . get ( dbType + "." + name ) ; if ( prop == null ) { return "" ; } return prop . toString ( ) ; |
public class CmsConfigurationCache { /** * Removes a published resource from the cache . < p >
* @ param res the published resource */
public void remove ( CmsPublishedResource res ) { } } | remove ( res . getStructureId ( ) , res . getRootPath ( ) , res . getType ( ) ) ; |
public class Util { /** * WARNING : The stream must have read up to the OID length .
* This method reads and decodes the OID after the length . */
private static String readOID ( ByteArrayInputStream bais , int oid_len ) throws IOException { } } | byte [ ] oid_tmp_arr = new byte [ oid_len ] ; bais . read ( oid_tmp_arr , 0 , oid_len ) ; byte [ ] oid_arr = new byte [ oid_len + 2 ] ; oid_arr [ 0 ] = ASN_TAG_OID ; oid_arr [ 1 ] = ( byte ) oid_len ; System . arraycopy ( oid_tmp_arr , 0 , oid_arr , 2 , oid_len ) ; return decodeOID ( oid_arr ) ; |
public class ServicesAmpImpl { /** * newService ( ) creates a new service from a bean */
@ Override public < T > ServiceBuilderAmp newService ( Class < T > type ) { } } | Objects . requireNonNull ( type ) ; return new ServiceBuilderImpl < > ( this , type ) ; |
public class Strands { /** * Disables the current strand for thread scheduling purposes , for up to
* the specified waiting time , unless the permit is available .
* If the permit is available then it is consumed and the call
* returns immediately ; otherwise the current strand becomes disabled
* for scheduling purposes and lies dormant until one of four
* things happens :
* < ul >
* < li > Some other strand invokes { @ link # unpark unpark } with the
* current strand as the target ; or
* < li > Some other strand interrupts
* the current strand ; or
* < li > The specified waiting time elapses ; or
* < li > The call spuriously ( that is , for no reason ) returns .
* < / ul >
* This method does < em > not < / em > report which of these caused the
* method to return . Callers should re - check the conditions which caused
* the strand to park in the first place . Callers may also determine ,
* for example , the interrupt status of the strand , or the elapsed time
* upon return .
* @ param blocker the synchronization object responsible for this strand parking
* @ param nanos the maximum number of nanoseconds to wait */
public static void parkNanos ( Object blocker , long nanos ) { } } | try { Strand . parkNanos ( blocker , nanos ) ; } catch ( SuspendExecution e ) { throw RuntimeSuspendExecution . of ( e ) ; } |
public class Ix { /** * Collects the elements of this sequence into a multi - Map where the key is
* determined from each element via the keySelector function .
* @ param < K > the key type
* @ param keySelector the function that receives the current element and returns
* a key for it to be used as the Map key .
* @ return the new Map instance
* @ throws NullPointerException if keySelector is null
* @ since 1.0 */
public final < K > Map < K , Collection < T > > toMultimap ( IxFunction < ? super T , ? extends K > keySelector ) { } } | return this . < K > collectToMultimap ( keySelector ) . first ( ) ; |
public class ManifestFileProcessor { /** * Retrieves a map of features definitions associated with the specified product name .
* @ param productName The product name whose feature definitions to return .
* @ return The feature definitions associated with the input product name . */
public Map < String , ProvisioningFeatureDefinition > getFeatureDefinitions ( String productName ) { } } | if ( productName . equals ( CORE_PRODUCT_NAME ) ) { return getCoreProductFeatureDefinitions ( ) ; } else if ( productName . equals ( USR_PRODUCT_EXT_NAME ) ) { return getUsrProductFeatureDefinitions ( ) ; } else { return getProductExtFeatureDefinitions ( productName ) ; } |
public class TextReport { /** * Suite prologue . */
private void emitSuiteStart ( Description description , long startTimestamp ) throws IOException { } } | String suiteName = description . getDisplayName ( ) ; if ( useSimpleNames ) { if ( suiteName . lastIndexOf ( '.' ) >= 0 ) { suiteName = suiteName . substring ( suiteName . lastIndexOf ( '.' ) + 1 ) ; } } logShort ( shortTimestamp ( startTimestamp ) + "Suite: " + FormattingUtils . padTo ( maxClassNameColumns , suiteName , "[...]" ) ) ; |
public class VoltCompiler { /** * Simplified interface for loading a ddl file with full support for VoltDB
* extensions ( partitioning , procedures , export ) , but no support for " project file " input .
* This is , at least initially , only a back door to create a fully functional catalog for
* the purposes of planner unit testing .
* @ param hsql an interface to the hsql frontend , initialized and potentially reused by the caller .
* @ param whichProcs indicates which ddl - defined procedures to load : none , single - statement , or all
* @ param ddlFilePaths schema file paths
* @ throws VoltCompilerException */
public Catalog loadSchema ( HSQLInterface hsql , DdlProceduresToLoad whichProcs , String ... ddlFilePaths ) throws VoltCompilerException { } } | m_catalog = new Catalog ( ) ; m_catalog . execute ( "add / clusters cluster" ) ; Database db = initCatalogDatabase ( m_catalog ) ; List < VoltCompilerReader > ddlReaderList = DDLPathsToReaderList ( ddlFilePaths ) ; final VoltDDLElementTracker voltDdlTracker = new VoltDDLElementTracker ( this ) ; InMemoryJarfile jarOutput = new InMemoryJarfile ( ) ; compileDatabase ( db , hsql , voltDdlTracker , null , null , ddlReaderList , null , whichProcs , jarOutput ) ; return m_catalog ; |
public class XSLTAttributeDef { /** * Set a value on an attribute .
* @ param handler non - null reference to current StylesheetHandler that is constructing the Templates .
* @ param attrUri The Namespace URI of the attribute , or an empty string .
* @ param attrLocalName The local name ( without prefix ) , or empty string if not namespace processing .
* @ param attrRawName The raw name of the attribute , including possible prefix .
* @ param attrValue The attribute ' s value .
* @ param elem The object that should contain a property that represents the attribute .
* @ throws org . xml . sax . SAXException */
boolean setAttrValue ( StylesheetHandler handler , String attrUri , String attrLocalName , String attrRawName , String attrValue , ElemTemplateElement elem ) throws org . xml . sax . SAXException { } } | if ( attrRawName . equals ( "xmlns" ) || attrRawName . startsWith ( "xmlns:" ) ) return true ; String setterString = getSetterMethodName ( ) ; // If this is null , then it is a foreign namespace and we
// do not process it .
if ( null != setterString ) { try { Method meth ; Object [ ] args ; if ( setterString . equals ( S_FOREIGNATTR_SETTER ) ) { // workaround for possible crimson bug
if ( attrUri == null ) attrUri = "" ; // First try to match with the primative value .
Class sclass = attrUri . getClass ( ) ; Class [ ] argTypes = new Class [ ] { sclass , sclass , sclass , sclass } ; meth = elem . getClass ( ) . getMethod ( setterString , argTypes ) ; args = new Object [ ] { attrUri , attrLocalName , attrRawName , attrValue } ; } else { Object value = processValue ( handler , attrUri , attrLocalName , attrRawName , attrValue , elem ) ; // If a warning was issued because the value for this attribute was
// invalid , then the value will be null . Just return
if ( null == value ) return false ; // First try to match with the primative value .
Class [ ] argTypes = new Class [ ] { getPrimativeClass ( value ) } ; try { meth = elem . getClass ( ) . getMethod ( setterString , argTypes ) ; } catch ( NoSuchMethodException nsme ) { Class cl = ( ( Object ) value ) . getClass ( ) ; // If this doesn ' t work , try it with the non - primative value ;
argTypes [ 0 ] = cl ; meth = elem . getClass ( ) . getMethod ( setterString , argTypes ) ; } args = new Object [ ] { value } ; } meth . invoke ( elem , args ) ; } catch ( NoSuchMethodException nsme ) { if ( ! setterString . equals ( S_FOREIGNATTR_SETTER ) ) { handler . error ( XSLTErrorResources . ER_FAILED_CALLING_METHOD , new Object [ ] { setterString } , nsme ) ; // " Failed calling " + setterString + " method ! " , nsme ) ;
return false ; } } catch ( IllegalAccessException iae ) { handler . error ( XSLTErrorResources . ER_FAILED_CALLING_METHOD , new Object [ ] { setterString } , iae ) ; // " Failed calling " + setterString + " method ! " , iae ) ;
return false ; } catch ( InvocationTargetException nsme ) { handleError ( handler , XSLTErrorResources . WG_ILLEGAL_ATTRIBUTE_VALUE , new Object [ ] { Constants . ATTRNAME_NAME , getName ( ) } , nsme ) ; return false ; } } return true ; |
public class Frames { /** * Parse a dataset into a Frame . */
public static Frame parse ( File file ) { } } | Key fkey = NFSFileVec . make ( file ) ; Key dest = Key . make ( file . getName ( ) ) ; Frame frame = ParseDataset2 . parse ( dest , new Key [ ] { fkey } ) ; return frame ; |
public class ChannelFinderClientImpl { /** * Get a list of names of all the tags currently present on the
* channelfinder service .
* @ return a list of names of all the existing { @ link Tag } s . */
public Collection < String > getAllTags ( ) { } } | return wrappedSubmit ( new Callable < Collection < String > > ( ) { @ Override public Collection < String > call ( ) throws Exception { Collection < String > allTags = new HashSet < String > ( ) ; ObjectMapper mapper = new ObjectMapper ( ) ; List < XmlTag > xmltags = new ArrayList < XmlTag > ( ) ; try { xmltags = mapper . readValue ( service . path ( resourceTags ) . accept ( MediaType . APPLICATION_JSON ) . get ( String . class ) , new TypeReference < List < XmlTag > > ( ) { } ) ; } catch ( JsonParseException e ) { // TODO Auto - generated catch block
e . printStackTrace ( ) ; } catch ( JsonMappingException e ) { // TODO Auto - generated catch block
e . printStackTrace ( ) ; } catch ( ClientHandlerException e ) { // TODO Auto - generated catch block
e . printStackTrace ( ) ; } catch ( IOException e ) { // TODO Auto - generated catch block
e . printStackTrace ( ) ; } for ( XmlTag xmltag : xmltags ) { allTags . add ( xmltag . getName ( ) ) ; } return allTags ; } } ) ; |
public class ArgumentProcessor { /** * Process argument array and pass values to given bean
* @ param arguments Arary of arguments
* @ param bean Bean to pass values to
* @ return the processed bean . */
public T process ( String [ ] arguments , T bean ) { } } | return process ( Arrays . asList ( arguments ) , bean ) ; |
public class Tuple2 { /** * Given a value of type < code > A < / code > , produce an instance of this tuple with each slot set to that value .
* @ param a the value to fill the tuple with
* @ param < A > the value type
* @ return the filled tuple */
public static < A > Tuple2 < A , A > fill ( A a ) { } } | return tuple ( a , a ) ; |
public class BoxApiFile { /** * Gets a request that restores a trashed file
* @ param id id of file to restore
* @ return request to restore a file from the trash */
public BoxRequestsFile . RestoreTrashedFile getRestoreTrashedFileRequest ( String id ) { } } | BoxRequestsFile . RestoreTrashedFile request = new BoxRequestsFile . RestoreTrashedFile ( id , getFileInfoUrl ( id ) , mSession ) ; return request ; |
public class MessageSourceMessageResolverAdapter { /** * ( non - Javadoc )
* @ see es . sandbox . ui . messages . resolver . MessageResolverStrategy # resolve ( java . lang . String , java . lang . Object [ ] ) */
@ Override public String resolve ( String code , Object ... arguments ) { } } | return this . messageSourceAccessor . getMessage ( code , arguments , code ) ; |
public class AbstractShapeFileWriter { /** * { @ inheritDoc } */
@ Override public void close ( ) throws IOException { } } | super . close ( ) ; if ( this . shxWriter != null ) { this . shxWriter . close ( ) ; } if ( this . dbfWriter != null ) { this . dbfWriter . close ( ) ; this . attrContainers = null ; } |
public class GreenPepperMacroWithBodyMigrator { /** * { @ inheritDoc } */
public MacroDefinition migrate ( MacroDefinition macroDefinition , ConversionContext context ) { } } | MacroBody body = macroDefinition . getBody ( ) ; WikiStyleRenderer wikiStyleRenderer = ( WikiStyleRenderer ) ContainerManager . getComponent ( "wikiStyleRenderer" ) ; String content = wikiStyleRenderer . convertWikiToXHtml ( new PageContext ( context . getEntity ( ) ) , body . getBody ( ) ) ; MacroBody newBody = new RichTextMacroBody ( content ) ; macroDefinition . setBody ( newBody ) ; return macroDefinition ; |
public class SnappyFramedInputStream { /** * { @ inheritDoc } */
@ Override public int read ( ByteBuffer dst ) throws IOException { } } | if ( dst == null ) { throw new IllegalArgumentException ( "dst is null" ) ; } if ( closed ) { throw new ClosedChannelException ( ) ; } if ( dst . remaining ( ) == 0 ) { return 0 ; } if ( ! ensureBuffer ( ) ) { return - 1 ; } final int size = min ( dst . remaining ( ) , available ( ) ) ; dst . put ( buffer , position , size ) ; position += size ; return size ; |
public class XSDocument { /** * $ constraint = " $ defaultValue " */
public XSDocument constraint ( Constraint constraint , String constraintValue ) throws SAXException { } } | if ( constraint != Constraint . NONE ) xml . addAttribute ( constraint . name ( ) . toLowerCase ( ) , constraintValue ) ; return this ; |
public class OnBindViewHolderListenerImpl { /** * is called in onViewDetachedFromWindow when the view is detached from the window
* @ param viewHolder the viewHolder for the type at this position
* @ param position the position of this viewHolder */
@ Override public void onViewDetachedFromWindow ( RecyclerView . ViewHolder viewHolder , int position ) { } } | IItem item = FastAdapter . getHolderAdapterItemTag ( viewHolder ) ; if ( item != null ) { item . detachFromWindow ( viewHolder ) ; if ( viewHolder instanceof FastAdapter . ViewHolder ) { ( ( FastAdapter . ViewHolder ) viewHolder ) . detachFromWindow ( item ) ; } } |
public class DeploymentParameter { /** * Create a new entry in the database . No commit performed . */
public static DeploymentParameter create ( DbConn cnx , Boolean enabled , Integer nodeId , Integer nbThread , Integer pollingInterval , Integer qId ) { } } | QueryResult r = cnx . runUpdate ( "dp_insert" , enabled , nbThread , pollingInterval , nodeId , qId ) ; DeploymentParameter res = new DeploymentParameter ( ) ; res . id = r . getGeneratedId ( ) ; res . node = nodeId ; res . nbThread = nbThread ; res . pollingInterval = pollingInterval ; res . queue = qId ; return res ; |
public class SRTServletResponse { /** * Adds a date header with the specified time . If this is called more than once ,
* the current value will replace the previous value .
* @ param name The header field name .
* @ param t The time in milliseconds since the epoch . */
public void setDateHeader ( String name , long t ) { } } | // 311717
if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { // 306998.15
logger . entering ( CLASS_NAME , "setDateHeader" , " name --> " + name + " value --> " + String . valueOf ( t ) + " [" + this + "]" ) ; } // d151464 - check the include flag
WebAppDispatcherContext dispatchContext = ( WebAppDispatcherContext ) getRequest ( ) . getWebAppDispatcherContext ( ) ; if ( dispatchContext . isInclude ( ) == true ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { // 306998.15
logger . logp ( Level . FINE , CLASS_NAME , "setDateHeader" , nls . getString ( "Illegal.from.included.servlet" , "Illegal from included servlet" ) ) ; // 311717
} } else { // d128646 - if we ' re not ignoring state errors and response is committed or closed , throw an exception
if ( ! _ignoreStateErrors && isCommitted ( ) ) { // log a warning ( only the first time ) . . . ignore headers set after response is committed
IServletWrapper wrapper = dispatchContext . getCurrentServletReference ( ) ; if ( logWarningActionNow ( wrapper ) ) { logAlreadyCommittedWarning ( new Throwable ( ) , "setDateHeader" ) ; } else { logger . logp ( Level . FINE , CLASS_NAME , "setDateHeader" , "Cannot set header. Response already committed." ) ; } if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { // 306998.15
logger . exiting ( CLASS_NAME , "setDateHeader" , "Response already committed" ) ; } return ; } // _ header . setDateField ( name , t ) ;
_response . setDateHeader ( name , t ) ; } if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { // 306998.15
logger . exiting ( CLASS_NAME , "setDateHeader" ) ; } |
public class DRL5Lexer { /** * $ ANTLR start " OR _ ASSIGN " */
public final void mOR_ASSIGN ( ) throws RecognitionException { } } | try { int _type = OR_ASSIGN ; int _channel = DEFAULT_TOKEN_CHANNEL ; // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 176:5 : ( ' | = ' )
// src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 176:7 : ' | = '
{ match ( "|=" ) ; if ( state . failed ) return ; } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving
} |
public class AnnotationSource { /** * Returns true if { @ code annotation } has a single element named " value " , letting us drop the
* ' value = ' prefix in the source code . */
private static boolean hasSingleValueWithDefaultKey ( AnnotationMirror annotation ) { } } | if ( annotation . getElementValues ( ) . size ( ) != 1 ) { return false ; } ExecutableElement key = getOnlyElement ( annotation . getElementValues ( ) . keySet ( ) ) ; return key . getSimpleName ( ) . contentEquals ( "value" ) ; |
public class CmsWorkplaceManager { /** * Sets the Workplace default user settings . < p >
* @ param defaultUserSettings the user settings to set */
public void setDefaultUserSettings ( CmsDefaultUserSettings defaultUserSettings ) { } } | m_defaultUserSettings = defaultUserSettings ; if ( CmsLog . INIT . isInfoEnabled ( ) ) { CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_DEFAULT_USER_SETTINGS_1 , m_defaultUserSettings . getClass ( ) . getName ( ) ) ) ; } |
public class SystemInputJson { /** * Returns the contents of the given JSON array as a list of identifiers . */
private static List < String > toIdentifiers ( JsonArray array ) { } } | return IntStream . range ( 0 , array . size ( ) ) . mapToObj ( i -> validIdentifier ( array . getString ( i ) ) ) . collect ( toList ( ) ) ; |
public class LanguageResourceService { /** * Adds or overlays all languages defined within the / translations
* directory of the given ServletContext . If no such language files exist ,
* nothing is done . If a language is already defined , the strings from the
* will be overlaid on top of the existing strings , augmenting or
* overriding the available strings for that language . The language key
* for each language file is derived from the filename .
* @ param context
* The ServletContext from which language files should be loaded . */
public void addLanguageResources ( ServletContext context ) { } } | // Get the paths of all the translation files
Set < ? > resourcePaths = context . getResourcePaths ( TRANSLATION_PATH ) ; // If no translation files found , nothing to add
if ( resourcePaths == null ) return ; // Iterate through all the found language files and add them to the map
for ( Object resourcePathObject : resourcePaths ) { // Each resource path is guaranteed to be a string
String resourcePath = ( String ) resourcePathObject ; // Parse language key from path
String languageKey = getLanguageKey ( resourcePath ) ; if ( languageKey == null ) { logger . warn ( "Invalid language file name: \"{}\"" , resourcePath ) ; continue ; } // Add / overlay new resource
addLanguageResource ( languageKey , new WebApplicationResource ( context , "application/json" , resourcePath ) ) ; } |
public class QueryUtil { /** * Get a linear scan query for the given similarity query .
* @ param < O > Object type
* @ param simQuery similarity query
* @ return Range query */
public static < O > RangeQuery < O > getLinearScanSimilarityRangeQuery ( SimilarityQuery < O > simQuery ) { } } | // Slight optimizations of linear scans
if ( simQuery instanceof PrimitiveSimilarityQuery ) { final PrimitiveSimilarityQuery < O > pdq = ( PrimitiveSimilarityQuery < O > ) simQuery ; return new LinearScanPrimitiveSimilarityRangeQuery < > ( pdq ) ; } return new LinearScanSimilarityRangeQuery < > ( simQuery ) ; |
public class CloudSpannerXAConnection { /** * Preconditions : 1 . Flags is one of TMSUCCESS , TMFAIL , TMSUSPEND 2 . xid ! = null 3 . Connection is
* associated with transaction xid
* Implementation deficiency preconditions : 1 . Flags is not TMSUSPEND
* Postconditions : 1 . connection is disassociated from the transaction .
* @ see XAResource # end ( Xid , int ) */
@ Override public void end ( Xid xid , int flags ) throws XAException { } } | if ( logger . logDebug ( ) ) { debug ( "ending transaction xid = " + xid ) ; } // Check preconditions
if ( flags != XAResource . TMSUSPEND && flags != XAResource . TMFAIL && flags != XAResource . TMSUCCESS ) { throw new CloudSpannerXAException ( CloudSpannerXAException . INVALID_FLAGS , Code . INVALID_ARGUMENT , XAException . XAER_INVAL ) ; } if ( xid == null ) { throw new CloudSpannerXAException ( CloudSpannerXAException . XID_NOT_NULL , Code . INVALID_ARGUMENT , XAException . XAER_INVAL ) ; } if ( state != STATE_ACTIVE || ! currentXid . equals ( xid ) ) { throw new CloudSpannerXAException ( CloudSpannerXAException . END_WITHOUT_START , Code . FAILED_PRECONDITION , XAException . XAER_PROTO ) ; } // Check implementation deficiency preconditions
if ( flags == XAResource . TMSUSPEND ) { throw new CloudSpannerXAException ( CloudSpannerXAException . SUSPEND_NOT_IMPLEMENTED , Code . UNIMPLEMENTED , XAException . XAER_RMERR ) ; } // We ignore TMFAIL . It ' s just a hint to the RM . We could roll back
// immediately
// if TMFAIL was given .
// All clear . We don ' t have any real work to do .
state = STATE_ENDED ; |
public class DefaultXPathEvaluator { /** * Evaluate the XPath as an array of the given type .
* @ param componentType
* Possible values : primitive types ( e . g . Short . Type ) , Projection interfaces , any
* class with a String constructor or a String factory method , and org . w3c . Node
* @ return an array of return type that reflects the evaluation result . */
@ SuppressWarnings ( "unchecked" ) @ Override public < T > T [ ] asArrayOf ( final Class < T > componentType ) { } } | Class < ? > callerClass = ReflectionHelper . getDirectCallerClass ( ) ; List < T > list = evaluateMultiValues ( componentType , callerClass ) ; return list . toArray ( ( T [ ] ) java . lang . reflect . Array . newInstance ( componentType , list . size ( ) ) ) ; |
public class ClassInfo { /** * Get the classes that have this class as an annotation .
* @ return A list of standard classes and non - annotation interfaces that are annotated by this class , if this is
* an annotation class , or the empty list if none . Also handles the { @ link Inherited } meta - annotation ,
* which causes an annotation on a class to be inherited by all of its subclasses . */
public ClassInfoList getClassesWithAnnotation ( ) { } } | if ( ! scanResult . scanSpec . enableAnnotationInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableAnnotationInfo() before #scan()" ) ; } if ( ! isAnnotation ) { throw new IllegalArgumentException ( "Class is not an annotation: " + getName ( ) ) ; } // Get classes that have this annotation
final ReachableAndDirectlyRelatedClasses classesWithAnnotation = this . filterClassInfo ( RelType . CLASSES_WITH_ANNOTATION , /* strictWhitelist = */
! isExternalClass ) ; if ( isInherited ) { // If this is an inherited annotation , add into the result all subclasses of the annotated classes .
final Set < ClassInfo > classesWithAnnotationAndTheirSubclasses = new LinkedHashSet < > ( classesWithAnnotation . reachableClasses ) ; for ( final ClassInfo classWithAnnotation : classesWithAnnotation . reachableClasses ) { classesWithAnnotationAndTheirSubclasses . addAll ( classWithAnnotation . getSubclasses ( ) ) ; } return new ClassInfoList ( classesWithAnnotationAndTheirSubclasses , classesWithAnnotation . directlyRelatedClasses , /* sortByName = */
true ) ; } else { // If not inherited , only return the annotated classes
return new ClassInfoList ( classesWithAnnotation , /* sortByName = */
true ) ; } |
public class MockEC2QueryHandler { /** * Handles " createSubnet " request to create Subnet and returns response with a subnet .
* @ param vpcId vpc Id for subnet .
* @ param cidrBlock VPC cidr block .
* @ return a CreateSubnetResponseType with our new Subnet */
private CreateSubnetResponseType createSubnet ( final String vpcId , final String cidrBlock ) { } } | CreateSubnetResponseType ret = new CreateSubnetResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; MockSubnet mockSubnet = mockSubnetController . createSubnet ( cidrBlock , vpcId ) ; SubnetType subnetType = new SubnetType ( ) ; subnetType . setVpcId ( mockSubnet . getVpcId ( ) ) ; subnetType . setSubnetId ( mockSubnet . getSubnetId ( ) ) ; ret . setSubnet ( subnetType ) ; return ret ; |
public class AbstractHttpQuery { /** * Returns the value of the given query string parameter .
* If this parameter occurs multiple times in the URL , only the last value
* is returned and others are silently ignored .
* @ param paramname Name of the query string parameter to get .
* @ return The value of the parameter or { @ code null } if this parameter
* wasn ' t passed in the URI . */
public String getQueryStringParam ( final String paramname ) { } } | final List < String > params = getQueryString ( ) . get ( paramname ) ; return params == null ? null : params . get ( params . size ( ) - 1 ) ; |
public class Request { /** * Executes requests that have already been serialized into an HttpURLConnection . No validation is done that the
* contents of the connection actually reflect the serialized requests , so it is the caller ' s responsibility to
* ensure that it will correctly generate the desired responses .
* This should only be called if you have transitioned off the UI thread .
* @ param connection
* the HttpURLConnection that the requests were serialized into
* @ param requests
* the RequestBatch represented by the HttpURLConnection
* @ return a list of Responses corresponding to the requests
* @ throws FacebookException
* If there was an error in the protocol used to communicate with the service */
public static List < Response > executeConnectionAndWait ( HttpURLConnection connection , RequestBatch requests ) { } } | List < Response > responses = Response . fromHttpConnection ( connection , requests ) ; Utility . disconnectQuietly ( connection ) ; int numRequests = requests . size ( ) ; if ( numRequests != responses . size ( ) ) { throw new FacebookException ( String . format ( "Received %d responses while expecting %d" , responses . size ( ) , numRequests ) ) ; } runCallbacks ( requests , responses ) ; // See if any of these sessions needs its token to be extended . We do this after issuing the request so as to
// reduce network contention .
HashSet < Session > sessions = new HashSet < Session > ( ) ; for ( Request request : requests ) { if ( request . session != null ) { sessions . add ( request . session ) ; } } for ( Session session : sessions ) { session . extendAccessTokenIfNeeded ( ) ; } return responses ; |
public class SimpleFilteredSentenceBreakIterator { /** * Is there an exception at this point ?
* @ param n
* @ return */
private final boolean breakExceptionAt ( int n ) { } } | // Note : the C + + version of this function is SimpleFilteredSentenceBreakIterator : : breakExceptionAt ( )
int bestPosn = - 1 ; int bestValue = - 1 ; // loops while ' n ' points to an exception
text . setIndex ( n ) ; backwardsTrie . reset ( ) ; int uch ; // Assume a space is following the ' . ' ( so we handle the case : " Mr . / Brown " )
if ( ( uch = text . previousCodePoint ( ) ) == ' ' ) { // TODO : skip a class of chars here ? ?
// TODO only do this the 1st time ?
} else { uch = text . nextCodePoint ( ) ; } BytesTrie . Result r = BytesTrie . Result . INTERMEDIATE_VALUE ; while ( ( uch = text . previousCodePoint ( ) ) != UCharacterIterator . DONE && // more to consume backwards and . .
( ( r = backwardsTrie . nextForCodePoint ( uch ) ) . hasNext ( ) ) ) { // more in the trie
if ( r . hasValue ( ) ) { // remember the best match so far
bestPosn = text . getIndex ( ) ; bestValue = backwardsTrie . getValue ( ) ; } } if ( r . matches ( ) ) { // exact match ?
bestValue = backwardsTrie . getValue ( ) ; bestPosn = text . getIndex ( ) ; } if ( bestPosn >= 0 ) { if ( bestValue == Builder . MATCH ) { // exact match !
return true ; // Exception here .
} else if ( bestValue == Builder . PARTIAL && forwardsPartialTrie != null ) { // make sure there ' s a forward trie
// We matched the " Ph . " in " Ph . D . " - now we need to run everything through the forwards trie
// to see if it matches something going forward .
forwardsPartialTrie . reset ( ) ; BytesTrie . Result rfwd = BytesTrie . Result . INTERMEDIATE_VALUE ; text . setIndex ( bestPosn ) ; // hope that ' s close . .
while ( ( uch = text . nextCodePoint ( ) ) != BreakIterator . DONE && ( ( rfwd = forwardsPartialTrie . nextForCodePoint ( uch ) ) . hasNext ( ) ) ) { } if ( rfwd . matches ( ) ) { // Exception here
return true ; } // else fall through
} // else fall through
} // else fall through
return false ; // No exception here . |
public class Generics { /** * Return the real return type of a method .
* Normally it returns { @ link Method # getReturnType ( ) }
* In case a method is declared in a super type and the return type is declared as a generic { @ link TypeVariable } ,
* when a sub class with type variable implementation presented , then it shall return the implementation type . E . g
* Super type :
* ` ` ` java
* public abstract class Foo < T > {
* T getFoo ( ) ;
* Sub type :
* ` ` ` java
* public class StringFoo extends Foo < String > {
* String getFoo ( ) { return " foo " ; }
* Usage of ` getReturnType ` :
* ` ` ` java
* Method method = Foo . class . getMethod ( " getFoo " ) ;
* Class < ? > realReturnType = Generics . getReturnType ( method , StringFoo . class ) ; / / return String . class
* @ param method the method
* @ param theClass the class on which the method is invoked
* @ return the return type */
public static Class < ? > getReturnType ( Method method , Class < ? > theClass ) { } } | Type type = method . getGenericReturnType ( ) ; if ( type == Class . class ) { return $ . cast ( type ) ; } if ( type instanceof TypeVariable ) { Map < String , Class > lookup = Generics . buildTypeParamImplLookup ( theClass ) ; String name = ( ( TypeVariable ) type ) . getName ( ) ; Class < ? > realType = lookup . get ( name ) ; if ( null != realType ) { return realType ; } } return method . getReturnType ( ) ; |
public class HyperGeometricDistribution { /** * Uses inversion by chop - down search from the mode when the mean & lt ; 20
* and the patchwork - rejection method when the mean & gt ; 20. */
@ Override public double rand ( ) { } } | int mm = m ; int nn = n ; if ( mm > N / 2 ) { // invert mm
mm = N - mm ; } if ( nn > N / 2 ) { // invert nn
nn = N - nn ; } if ( nn > mm ) { // swap nn and mm
int swap = nn ; nn = mm ; mm = swap ; } if ( rng == null ) { if ( ( double ) nn * mm >= 20 * N ) { // use ratio - of - uniforms method
rng = new Patchwork ( N , mm , nn ) ; } else { // inversion method , using chop - down search from mode
rng = new Inversion ( N , mm , nn ) ; } } return rng . rand ( ) ; |
public class ODatabaseDocumentTx { /** * Returns the number of the records of the class iClassName . */
public long countClass ( final String iClassName ) { } } | final OClass cls = getMetadata ( ) . getSchema ( ) . getClass ( iClassName ) ; if ( cls == null ) throw new IllegalArgumentException ( "Class '" + iClassName + "' not found in database" ) ; return cls . count ( ) ; |
public class VariableAssignment { /** * setter for value - sets
* @ generated
* @ param v value to set into the feature */
public void setValue ( float v ) { } } | if ( VariableAssignment_Type . featOkTst && ( ( VariableAssignment_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "ch.epfl.bbp.uima.types.VariableAssignment" ) ; jcasType . ll_cas . ll_setFloatValue ( addr , ( ( VariableAssignment_Type ) jcasType ) . casFeatCode_value , v ) ; |
public class Base { /** * Adds a batch statement using given < code > java . sql . PreparedStatement < / code > and parameters .
* @ param ps < code > java . sql . PreparedStatement < / code > to add batch to .
* @ param parameters parameters for the query in < code > java . sql . PreparedStatement < / code > . Parameters will be
* set on the statement in the same order as provided here . */
public static void addBatch ( PreparedStatement ps , Object ... parameters ) { } } | new DB ( DB . DEFAULT_NAME ) . addBatch ( ps , parameters ) ; |
public class l3param { /** * Use this API to fetch all the l3param resources that are configured on netscaler . */
public static l3param get ( nitro_service service ) throws Exception { } } | l3param obj = new l3param ( ) ; l3param [ ] response = ( l3param [ ] ) obj . get_resources ( service ) ; return response [ 0 ] ; |
public class AbstractHttpTransport { /** * Returns the value of the requested parameter from the request , or null
* @ param request
* the request object
* @ param aliases
* array of query arg names by which the request may be specified
* @ return the value of the param , or null if it is not specified under the
* specified names */
protected static String getParameter ( HttpServletRequest request , String [ ] aliases ) { } } | final String sourceMethod = "getParameter" ; // $ NON - NLS - 1 $
boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( sourceClass , sourceMethod , new Object [ ] { request . getQueryString ( ) , Arrays . asList ( aliases ) } ) ; } Map < String , String [ ] > params = request . getParameterMap ( ) ; String result = null ; for ( Map . Entry < String , String [ ] > entry : params . entrySet ( ) ) { String name = entry . getKey ( ) ; for ( String alias : aliases ) { if ( alias . equalsIgnoreCase ( name ) ) { String [ ] values = entry . getValue ( ) ; result = values [ values . length - 1 ] ; // return last value in array
} } } if ( isTraceLogging ) { log . exiting ( sourceClass , sourceMethod , result ) ; } return result ; |
public class CmsJSONSearchConfigurationParser { /** * Returns the configured Solr core , or < code > null < / code > if no core is configured .
* @ return The configured Solr core , or < code > null < / code > if no core is configured . */
protected String getCore ( ) { } } | try { return m_configObject . getString ( JSON_KEY_CORE ) ; } catch ( JSONException e ) { if ( null == m_baseConfig ) { if ( LOG . isInfoEnabled ( ) ) { LOG . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_NO_CORE_SPECIFIED_0 ) , e ) ; } return null ; } else { return m_baseConfig . getGeneralConfig ( ) . getSolrCore ( ) ; } } |
public class ComponentProxy { /** * Checks if the method is derived from Object . finalize ( )
* @ param method method being tested
* @ return true if the method is defined from Object . finalize ( ) , false otherwise */
protected static boolean isFinalizeMethod ( Method method ) { } } | return method . getReturnType ( ) == void . class && method . getParameterTypes ( ) . length == 0 && method . getName ( ) . equals ( "finalize" ) ; |
public class Matrix4d { /** * Pre - multiply a rotation to this matrix by rotating the given amount of radians
* about the specified < code > ( x , y , z ) < / code > axis .
* The axis described by the three components needs to be a unit vector .
* When used with a right - handed coordinate system , the produced rotation will rotate a vector
* counter - clockwise around the rotation axis , when viewing along the negative axis direction towards the origin .
* When used with a left - handed coordinate system , the rotation is clockwise .
* If < code > M < / code > is < code > this < / code > matrix and < code > R < / code > the rotation matrix ,
* then the new matrix will be < code > R * M < / code > . So when transforming a
* vector < code > v < / code > with the new matrix by using < code > R * M * v < / code > , the
* rotation will be applied last !
* In order to set the matrix to a rotation matrix without pre - multiplying the rotation
* transformation , use { @ link # rotation ( double , double , double , double ) rotation ( ) } .
* Reference : < a href = " http : / / en . wikipedia . org / wiki / Rotation _ matrix # Rotation _ matrix _ from _ axis _ and _ angle " > http : / / en . wikipedia . org < / a >
* @ see # rotation ( double , double , double , double )
* @ param ang
* the angle in radians
* @ param x
* the x component of the axis
* @ param y
* the y component of the axis
* @ param z
* the z component of the axis
* @ return this */
public Matrix4d rotateLocal ( double ang , double x , double y , double z ) { } } | return rotateLocal ( ang , x , y , z , this ) ; |
public class WampSession { /** * Set the value with the given name replacing an existing value ( if any ) .
* @ param name the name of the attribute
* @ param value the value for the attribute */
public void setAttribute ( String name , Object value ) { } } | this . webSocketSession . getAttributes ( ) . put ( name , value ) ; |
public class CPTaxCategoryUtil { /** * Returns a range of all the cp tax categories where groupId = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CPTaxCategoryModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param groupId the group ID
* @ param start the lower bound of the range of cp tax categories
* @ param end the upper bound of the range of cp tax categories ( not inclusive )
* @ return the range of matching cp tax categories */
public static List < CPTaxCategory > findByGroupId ( long groupId , int start , int end ) { } } | return getPersistence ( ) . findByGroupId ( groupId , start , end ) ; |
public class StorableGenerator { /** * Defines a hashCode method . */
private void addHashCodeMethod ( ) { } } | Modifiers modifiers = Modifiers . PUBLIC . toSynchronized ( true ) ; MethodInfo mi = addMethodIfNotFinal ( modifiers , "hashCode" , TypeDesc . INT , null ) ; if ( mi == null ) { return ; } CodeBuilder b = new CodeBuilder ( mi ) ; boolean mixIn = false ; for ( StorableProperty property : mAllProperties . values ( ) ) { if ( property . isDerived ( ) || property . isJoin ( ) ) { continue ; } TypeDesc fieldType = TypeDesc . forClass ( property . getType ( ) ) ; b . loadThis ( ) ; b . loadField ( property . getName ( ) , fieldType ) ; CodeBuilderUtil . addValueHashCodeCall ( b , fieldType , true , mixIn ) ; mixIn = true ; } b . returnValue ( TypeDesc . INT ) ; |
public class Throwables { /** * Gets a { @ code Throwable } cause chain as a list . The first entry in the list will be { @ code
* throwable } followed by its cause hierarchy . Note that this is a snapshot of the cause chain and
* will not reflect any subsequent changes to the cause chain .
* < p > Here ' s an example of how it can be used to find specific types of exceptions in the cause
* chain :
* < pre >
* Iterables . filter ( Throwables . getCausalChain ( e ) , IOException . class ) ) ;
* < / pre >
* @ param throwable the non - null { @ code Throwable } to extract causes from
* @ return an unmodifiable list containing the cause chain starting with { @ code throwable } */
@ Beta // TODO ( kevinb ) : decide best return type
public static List < Throwable > getCausalChain ( Throwable throwable ) { } } | checkNotNull ( throwable ) ; List < Throwable > causes = new ArrayList < Throwable > ( 4 ) ; while ( throwable != null ) { causes . add ( throwable ) ; throwable = throwable . getCause ( ) ; } return Collections . unmodifiableList ( causes ) ; |
public class MockPropertyService { /** * Initializes the properties from a multiple resources .
* @ param resources Sources of properties .
* @ throws IOException IO exception . */
public void setResources ( Resource [ ] resources ) throws IOException { } } | clear ( ) ; for ( Resource resource : resources ) { addResource ( resource ) ; } |
public class AbstractDao { /** * - - - transactional methods - - - */
public < R > R withCommitTransaction ( TransFunc < R > transFunc ) throws IOException { } } | return withTransaction ( transFunc , true ) ; |
public class StAXUtils { /** * Extract or create an instance of { @ link XMLStreamReader } from the provided { @ link Source } .
* @ param factory the { @ link XMLStreamReader } to use ( if needed )
* @ param source the source
* @ return the { @ link XMLStreamReader }
* @ throws XMLStreamException when failing to extract xml stream reader
* @ since 9.5
* @ since 9.6RC1 */
public static XMLStreamReader getXMLStreamReader ( XMLInputFactory factory , Source source ) throws XMLStreamException { } } | XMLStreamReader xmlStreamReader ; if ( source instanceof StAXSource ) { // StAXSource is not supported by standard XMLInputFactory
StAXSource staxSource = ( StAXSource ) source ; if ( staxSource . getXMLStreamReader ( ) != null ) { xmlStreamReader = staxSource . getXMLStreamReader ( ) ; } else { // TODO : add support for XMLStreamReader - > XMLEventReader
throw new XMLStreamException ( "XMLEventReader is not supported as source" ) ; } } else { xmlStreamReader = factory . createXMLStreamReader ( source ) ; } return xmlStreamReader ; |
public class DomConfigurationWriter { /** * Externalizes a { @ link CsvDatastore } to a XML element .
* @ param datastore the datastore to externalize
* @ param filename the filename / path to use in the XML element . Since the appropriate path will depend on the
* reading application ' s environment ( supported { @ link Resource } types ) , this specific property of the
* datastore is provided separately .
* @ return a XML element representing the datastore . */
public Element toElement ( final CsvDatastore datastore , final String filename ) { } } | final Element datastoreElement = getDocument ( ) . createElement ( "csv-datastore" ) ; datastoreElement . setAttribute ( "name" , datastore . getName ( ) ) ; final String description = datastore . getDescription ( ) ; if ( ! Strings . isNullOrEmpty ( description ) ) { datastoreElement . setAttribute ( "description" , description ) ; } appendElement ( datastoreElement , "filename" , filename ) ; appendElement ( datastoreElement , "quote-char" , datastore . getQuoteChar ( ) ) ; appendElement ( datastoreElement , "separator-char" , datastore . getSeparatorChar ( ) ) ; appendElement ( datastoreElement , "escape-char" , datastore . getEscapeChar ( ) ) ; appendElement ( datastoreElement , "encoding" , datastore . getEncoding ( ) ) ; appendElement ( datastoreElement , "fail-on-inconsistencies" , datastore . isFailOnInconsistencies ( ) ) ; appendElement ( datastoreElement , "multiline-values" , datastore . isMultilineValues ( ) ) ; appendElement ( datastoreElement , "header-line-number" , datastore . getHeaderLineNumber ( ) ) ; if ( datastore . getCustomColumnNames ( ) != null && datastore . getCustomColumnNames ( ) . size ( ) > 0 ) { final Element customColumnNamesElement = getDocument ( ) . createElement ( "custom-column-names" ) ; datastoreElement . appendChild ( customColumnNamesElement ) ; datastore . getCustomColumnNames ( ) . forEach ( columnName -> appendElement ( customColumnNamesElement , "column-name" , columnName ) ) ; } return datastoreElement ; |
public class TypeUtil { /** * Factory method for { @ link Properties } from an even - sized String array .
* @ param _ keysAndVals String array of keys and values , may be null or even - numbered String array
* @ return new Properties object */
public static Properties createProperties ( String ... _keysAndVals ) { } } | if ( _keysAndVals != null && _keysAndVals . length % 2 != 0 ) { throw new IllegalArgumentException ( "Even number of String parameters required." ) ; } Properties props = new Properties ( ) ; if ( _keysAndVals != null ) { for ( int i = 0 ; i < _keysAndVals . length ; i += 2 ) { props . setProperty ( _keysAndVals [ i ] , _keysAndVals [ i + 1 ] ) ; } } return props ; |
public class User { /** * Validates a token sent for email confirmation .
* @ param token a token
* @ return true if valid */
public final boolean isValidEmailConfirmationToken ( String token ) { } } | Sysprop s = CoreUtils . getInstance ( ) . getDao ( ) . read ( getAppid ( ) , identifier ) ; return isValidToken ( s , Config . _EMAIL_TOKEN , token ) ; |
public class JSONs { /** * Read partitions of VMs .
* @ param mo the associated model to browse
* @ param o the object to parse
* @ param id the key in the map that points to the partitions
* @ return the parsed partition
* @ throws JSONConverterException if the key does not point to partitions of VMs */
public static Set < Collection < VM > > requiredVMPart ( Model mo , JSONObject o , String id ) throws JSONConverterException { } } | Set < Collection < VM > > vms = new HashSet < > ( ) ; Object x = o . get ( id ) ; if ( ! ( x instanceof JSONArray ) ) { throw new JSONConverterException ( "Set of identifiers sets expected at key '" + id + "'" ) ; } for ( Object obj : ( JSONArray ) x ) { vms . add ( vmsFromJSON ( mo , ( JSONArray ) obj ) ) ; } return vms ; |
public class LFltFunctionBuilder { /** * One of ways of creating builder . This might be the only way ( considering all _ functional _ builders ) that might be utilize to specify generic params only once . */
@ Nonnull public static < R > LFltFunctionBuilder < R > fltFunction ( Consumer < LFltFunction < R > > consumer ) { } } | return new LFltFunctionBuilder ( consumer ) ; |
public class Components { /** * Figure out connectivity and generate Java statements .
* @ param comps */
public static void figureOutConnect ( PrintStream w , Object ... comps ) { } } | // add all the components via Proxy .
List < ComponentAccess > l = new ArrayList < ComponentAccess > ( ) ; for ( Object c : comps ) { l . add ( new ComponentAccess ( c ) ) ; } // find all out slots
for ( ComponentAccess cp_out : l ) { w . println ( "// connect " + objName ( cp_out ) ) ; // over all input slots .
for ( Access fout : cp_out . outputs ( ) ) { String s = " out2in(" + objName ( cp_out ) + ", \"" + fout . getField ( ) . getName ( ) + "\"" ; for ( ComponentAccess cp_in : l ) { // skip if it is the same component .
if ( cp_in == cp_out ) { continue ; } // out points to in
for ( Access fin : cp_in . inputs ( ) ) { // name equivalence enought for now .
if ( fout . getField ( ) . getName ( ) . equals ( fin . getField ( ) . getName ( ) ) ) { s = s + ", " + objName ( cp_in ) ; } } } w . println ( s + ");" ) ; } w . println ( ) ; } |
public class DbUtil { /** * Gets the < code > String < / code > denoting the specified SQL data type .
* @ param type The data type to get the name of . Valid type values
* consist of the static fields of { @ link java . sql . Types } .
* @ param length The length to assign to data types for those types
* that require a length ( e . g . , < code > VARCHAR ( n ) < / code > ) , or zero
* to indicate that no length is required .
* @ param typeInfo The < code > ResultSet < / code > containing the type information
* for the database . This must be obtained using
* { @ link java . sql . DatabaseMetaData # getTypeInfo ( ) } .
* @ return The name of the type , or < code > null < / code > if no such type
* exists .
* @ throws SQLException If an error occurs while communicating with the
* database .
* @ see java . sql . Types
* @ see java . sql . DatabaseMetaData # getTypeInfo ( ) */
private static String getTypeName ( int type , int length , ResultSet typeInfo ) throws SQLException { } } | int dataTypeColumn = typeInfo . findColumn ( "DATA_TYPE" ) ; while ( typeInfo . next ( ) ) { if ( typeInfo . getInt ( dataTypeColumn ) == type ) { String typeName = typeInfo . getString ( "TYPE_NAME" ) ; if ( length > 0 ) { if ( typeName . contains ( "()" ) ) { return typeName . replaceAll ( "\\(\\)" , "(" + length + ")" ) ; } else { return typeName + "(" + length + ")" ; } } else { return typeName ; } } } return null ; |
public class StoreFactory { /** * If the store must be unique , here is it .
* @ return unique storage
* @ throws java . io . IOException in case no temp folder has been found . */
public static Store < InputStream > anonymousStore ( ) throws IOException { } } | File temp = File . createTempFile ( "ops4j-store-anonymous-" , "" ) ; temp . delete ( ) ; temp . mkdir ( ) ; return new TemporaryStore ( temp , true ) ; |
public class AbstractRouter { /** * Gets the url of the route handled by the specified action method . The action does not takes parameters . This
* implementation delegates to { @ link # getReverseRouteFor ( String , String , java . util . Map ) } .
* @ param className the controller class
* @ param method the controller method
* @ return the url , { @ literal null } if the action method is not found */
@ Override public String getReverseRouteFor ( String className , String method ) { } } | return getReverseRouteFor ( className , method , null ) ; |
public class SVGEffects { /** * Static method to prepare a SVG document for light gradient effects .
* Invoke this from an appropriate update thread !
* @ param svgp Plot to prepare */
public static void addLightGradient ( SVGPlot svgp ) { } } | Element gradient = svgp . getIdElement ( LIGHT_GRADIENT_ID ) ; if ( gradient == null ) { gradient = svgp . svgElement ( SVGConstants . SVG_LINEAR_GRADIENT_TAG ) ; gradient . setAttribute ( SVGConstants . SVG_ID_ATTRIBUTE , LIGHT_GRADIENT_ID ) ; gradient . setAttribute ( SVGConstants . SVG_X1_ATTRIBUTE , "0" ) ; gradient . setAttribute ( SVGConstants . SVG_Y1_ATTRIBUTE , "0" ) ; gradient . setAttribute ( SVGConstants . SVG_X2_ATTRIBUTE , "0" ) ; gradient . setAttribute ( SVGConstants . SVG_Y2_ATTRIBUTE , "1" ) ; Element stop0 = svgp . svgElement ( SVGConstants . SVG_STOP_TAG ) ; stop0 . setAttribute ( SVGConstants . SVG_STOP_COLOR_ATTRIBUTE , "white" ) ; stop0 . setAttribute ( SVGConstants . SVG_STOP_OPACITY_ATTRIBUTE , "1" ) ; stop0 . setAttribute ( SVGConstants . SVG_OFFSET_ATTRIBUTE , "0" ) ; gradient . appendChild ( stop0 ) ; Element stop04 = svgp . svgElement ( SVGConstants . SVG_STOP_TAG ) ; stop04 . setAttribute ( SVGConstants . SVG_STOP_COLOR_ATTRIBUTE , "white" ) ; stop04 . setAttribute ( SVGConstants . SVG_STOP_OPACITY_ATTRIBUTE , "0" ) ; stop04 . setAttribute ( SVGConstants . SVG_OFFSET_ATTRIBUTE , ".4" ) ; gradient . appendChild ( stop04 ) ; Element stop06 = svgp . svgElement ( SVGConstants . SVG_STOP_TAG ) ; stop06 . setAttribute ( SVGConstants . SVG_STOP_COLOR_ATTRIBUTE , "black" ) ; stop06 . setAttribute ( SVGConstants . SVG_STOP_OPACITY_ATTRIBUTE , "0" ) ; stop06 . setAttribute ( SVGConstants . SVG_OFFSET_ATTRIBUTE , ".6" ) ; gradient . appendChild ( stop06 ) ; Element stop1 = svgp . svgElement ( SVGConstants . SVG_STOP_TAG ) ; stop1 . setAttribute ( SVGConstants . SVG_STOP_COLOR_ATTRIBUTE , "black" ) ; stop1 . setAttribute ( SVGConstants . SVG_STOP_OPACITY_ATTRIBUTE , ".5" ) ; stop1 . setAttribute ( SVGConstants . SVG_OFFSET_ATTRIBUTE , "1" ) ; gradient . appendChild ( stop1 ) ; svgp . getDefs ( ) . appendChild ( gradient ) ; svgp . putIdElement ( LIGHT_GRADIENT_ID , gradient ) ; } |
public class GosuStringUtil { /** * < p > Overlays part of a String with another String . < / p >
* < pre >
* GosuStringUtil . overlayString ( null , * , * , * ) = NullPointerException
* GosuStringUtil . overlayString ( * , null , * , * ) = NullPointerException
* GosuStringUtil . overlayString ( " " , " abc " , 0 , 0 ) = " abc "
* GosuStringUtil . overlayString ( " abcdef " , null , 2 , 4 ) = " abef "
* GosuStringUtil . overlayString ( " abcdef " , " " , 2 , 4 ) = " abef "
* GosuStringUtil . overlayString ( " abcdef " , " zzzz " , 2 , 4 ) = " abzzzzef "
* GosuStringUtil . overlayString ( " abcdef " , " zzzz " , 4 , 2 ) = " abcdzzzzcdef "
* GosuStringUtil . overlayString ( " abcdef " , " zzzz " , - 1 , 4 ) = IndexOutOfBoundsException
* GosuStringUtil . overlayString ( " abcdef " , " zzzz " , 2 , 8 ) = IndexOutOfBoundsException
* < / pre >
* @ param text the String to do overlaying in , may be null
* @ param overlay the String to overlay , may be null
* @ param start the position to start overlaying at , must be valid
* @ param end the position to stop overlaying before , must be valid
* @ return overlayed String , < code > null < / code > if null String input
* @ throws NullPointerException if text or overlay is null
* @ throws IndexOutOfBoundsException if either position is invalid
* @ deprecated Use better named { @ link # overlay ( String , String , int , int ) } instead .
* Method will be removed in Commons Lang 3.0. */
public static String overlayString ( String text , String overlay , int start , int end ) { } } | return new StringBuffer ( start + overlay . length ( ) + text . length ( ) - end + 1 ) . append ( text . substring ( 0 , start ) ) . append ( overlay ) . append ( text . substring ( end ) ) . toString ( ) ; |
public class AmazonCloudDirectoryClient { /** * Attaches a typed link to a specified source and target object . For more information , see < a href =
* " https : / / docs . aws . amazon . com / clouddirectory / latest / developerguide / directory _ objects _ links . html # directory _ objects _ links _ typedlink "
* > Typed Links < / a > .
* @ param attachTypedLinkRequest
* @ return Result of the AttachTypedLink operation returned by the service .
* @ throws InternalServiceException
* Indicates a problem that must be resolved by Amazon Web Services . This might be a transient error in
* which case you can retry your request until it succeeds . Otherwise , go to the < a
* href = " http : / / status . aws . amazon . com / " > AWS Service Health Dashboard < / a > site to see if there are any
* operational issues with the service .
* @ throws InvalidArnException
* Indicates that the provided ARN value is not valid .
* @ throws RetryableConflictException
* Occurs when a conflict with a previous successful write is detected . For example , if a write operation
* occurs on an object and then an attempt is made to read the object using “ SERIALIZABLE ” consistency , this
* exception may result . This generally occurs when the previous write did not have time to propagate to the
* host serving the current request . A retry ( with appropriate backoff logic ) is the recommended response to
* this exception .
* @ throws ValidationException
* Indicates that your request is malformed in some manner . See the exception message .
* @ throws LimitExceededException
* Indicates that limits are exceeded . See < a
* href = " https : / / docs . aws . amazon . com / clouddirectory / latest / developerguide / limits . html " > Limits < / a > for more
* information .
* @ throws AccessDeniedException
* Access denied . Check your permissions .
* @ throws DirectoryNotEnabledException
* Operations are only permitted on enabled directories .
* @ throws ResourceNotFoundException
* The specified resource could not be found .
* @ throws InvalidAttachmentException
* Indicates that an attempt to make an attachment was invalid . For example , attaching two nodes with a link
* type that is not applicable to the nodes or attempting to apply a schema to a directory a second time .
* @ throws ValidationException
* Indicates that your request is malformed in some manner . See the exception message .
* @ throws FacetValidationException
* The < a > Facet < / a > that you provided was not well formed or could not be validated with the schema .
* @ sample AmazonCloudDirectory . AttachTypedLink
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / clouddirectory - 2017-01-11 / AttachTypedLink " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public AttachTypedLinkResult attachTypedLink ( AttachTypedLinkRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeAttachTypedLink ( request ) ; |
public class ApiOvhDbaasqueue { /** * Get one region
* REST : GET / dbaas / queue / { serviceName } / region / { regionId }
* @ param serviceName [ required ] Application ID
* @ param regionId [ required ] Region ID
* API beta */
public OvhRegion serviceName_region_regionId_GET ( String serviceName , String regionId ) throws IOException { } } | String qPath = "/dbaas/queue/{serviceName}/region/{regionId}" ; StringBuilder sb = path ( qPath , serviceName , regionId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhRegion . class ) ; |
public class KeywordEstimate { /** * Gets the max value for this KeywordEstimate .
* @ return max * The upper bound on the estimated stats .
* < p > This is not a guarantee that actual performance
* will never be higher than
* these stats . */
public com . google . api . ads . adwords . axis . v201809 . o . StatsEstimate getMax ( ) { } } | return max ; |
public class RandomVariableDifferentiableAADPathwise { /** * / * ( non - Javadoc )
* @ see net . finmath . stochastic . RandomVariable # getQuantileExpectation ( double , double ) */
@ Override public double getQuantileExpectation ( double quantileStart , double quantileEnd ) { } } | return ( ( RandomVariableDifferentiableAADPathwise ) getValues ( ) ) . getValues ( ) . getQuantileExpectation ( quantileStart , quantileEnd ) ; |
public class PresenterLifecycleDelegate { /** * { @ link ViewWithPresenter # setPresenterFactory ( PresenterFactory ) } */
public void setPresenterFactory ( @ Nullable PresenterFactory < P > presenterFactory ) { } } | if ( presenter != null ) throw new IllegalArgumentException ( "setPresenterFactory() should be called before onResume()" ) ; this . presenterFactory = presenterFactory ; |
public class Key { /** * Builds Key from method ' s generic return type and method ' s qualifying
* annotations . A qualifying annotation is marked with a { @ code @ Qualifier } .
* @ param method method for deriving return type and annotations from
* @ param < T > target type
* @ return instance of a Key */
public static < T > Key < T > of ( Method method ) { } } | return new Key ( method . getGenericReturnType ( ) , qualifiers ( method . getAnnotations ( ) ) ) ; |
public class CalculateSum { /** * This function computes the sum of integers from 1 up to and including n .
* > > > CalculateSum . calculate _ sum ( 30)
* 465
* > > > CalculateSum . calculate _ sum ( 100)
* 5050
* > > > CalculateSum . calculate _ sum ( 5)
* 15
* > > > CalculateSum . calculate _ sum ( 10)
* 55
* > > > CalculateSum . calculate _ sum ( 1) */
public static int calculateSum ( int n ) { } } | return ( n * ( n + 1 ) ) / 2 ; |
public class MarshallUtil { /** * Unmarshal a { @ link Collection } .
* @ param in { @ link ObjectInput } to read .
* @ param builder { @ link CollectionBuilder } builds the concrete { @ link Collection } based on size .
* @ param reader { @ link ElementReader } reads one element from the input .
* @ param < E > Collection ' s element type .
* @ param < T > { @ link Collection } implementation .
* @ return The concrete { @ link Collection } implementation .
* @ throws IOException If any of the usual Input / Output related exceptions occur .
* @ throws ClassNotFoundException If the class of a serialized object cannot be found . */
public static < E , T extends Collection < E > > T unmarshallCollection ( ObjectInput in , CollectionBuilder < E , T > builder , ElementReader < E > reader ) throws IOException , ClassNotFoundException { } } | final int size = unmarshallSize ( in ) ; if ( size == NULL_VALUE ) { return null ; } T collection = Objects . requireNonNull ( builder , "CollectionBuilder must be non-null" ) . build ( size ) ; for ( int i = 0 ; i < size ; ++ i ) { // noinspection unchecked
collection . add ( reader . readFrom ( in ) ) ; } return collection ; |
public class HttpRequest { /** * 获取指定的header的int值 , 没有返回默认int值
* @ param radix 进制数
* @ param name header名
* @ param defaultValue 默认int值
* @ return header值 */
public int getIntHeader ( int radix , String name , int defaultValue ) { } } | return header . getIntValue ( radix , name , defaultValue ) ; |
public class SingleObjectBundle { /** * Append a single representation to the object .
* @ param meta Meta for the representation
* @ param data Data to append */
public void append ( SimpleTypeInformation < ? > meta , Object data ) { } } | this . meta . add ( meta ) ; this . contents . add ( data ) ; |
public class MisoScenePanel { /** * This is called when our view position has changed by more than one tile in any direction .
* Herein we do a whole crapload of stuff :
* < ul >
* < li > Queue up loads for any new influential blocks . < / li >
* < li > Flush any blocks that are no longer influential . < / li >
* < li > Recompute the list of potentially visible scene objects . < / li >
* < / ul >
* @ return the count of blocks pending after this rethink . */
protected int rethink ( ) { } } | // recompute our " area of influence "
computeInfluentialBounds ( ) ; // Log . info ( " Rethinking vb : " + StringUtil . toString ( _ vbounds ) +
// " ul : " + StringUtil . toString ( _ ulpos ) +
// " ibounds : " + StringUtil . toString ( _ ibounds ) ) ;
// not to worry if we presently have no scene model
if ( _model == null ) { return 0 ; } // compute the intersecting set of blocks
_applicator . applyToTiles ( _ibounds , _rethinkOp ) ; // Log . info ( " Influential blocks " +
// StringUtil . toString ( _ rethinkOp . blocks ) + " . " ) ;
// prune any blocks that are no longer influential
Point key = new Point ( ) ; for ( Iterator < SceneBlock > iter = _blocks . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { SceneBlock block = iter . next ( ) ; key . x = block . getBounds ( ) . x ; key . y = block . getBounds ( ) . y ; if ( ! _rethinkOp . blocks . contains ( key ) ) { log . debug ( "Flushing block " + block + "." ) ; if ( _dpanel != null ) { _dpanel . blockCleared ( block ) ; } iter . remove ( ) ; } } for ( Point origin : _rethinkOp . blocks ) { int bx = MathUtil . floorDiv ( origin . x , _metrics . blockwid ) ; int by = MathUtil . floorDiv ( origin . y , _metrics . blockhei ) ; int bkey = compose ( bx , by ) ; if ( ! _blocks . containsKey ( bkey ) ) { SceneBlock block = new SceneBlock ( this , origin . x , origin . y , _metrics . blockwid , _metrics . blockhei ) ; boolean visible = block . getFootprint ( ) . getBounds ( ) . intersects ( _vibounds ) ; block . setVisiBlock ( visible ) ; _blocks . put ( bkey , block ) ; // queue the block up to be resolved
_pendingBlocks ++ ; if ( visible ) { _visiBlocks . add ( block ) ; } _resolver . resolveBlock ( block , visible ) ; if ( _dpanel != null ) { _dpanel . queuedBlock ( block ) ; } } } _rethinkOp . blocks . clear ( ) ; // recompute our visible object set
recomputeVisible ( ) ; log . debug ( "Rethunk [pending=" + _pendingBlocks + ", visible=" + _visiBlocks . size ( ) + "]." ) ; return _visiBlocks . size ( ) ; |
public class Imports { /** * Pass in a possible Theme . If it is " " or null , it will resolve to default Theme set in Imports
* @ param theTheme
* @ return */
@ Override public String themePath ( String theTheme ) { } } | StringBuilder src = dots ( new StringBuilder ( ) ) ; if ( theTheme == null || theTheme . length ( ) == 0 ) { src . append ( theme ) ; if ( theme . length ( ) > 0 ) src . append ( '/' ) ; } else { src . append ( theTheme ) ; src . append ( '/' ) ; } return src . toString ( ) ; |
public class ThymeleafFactory { /** * Constructs the template resolver bean .
* @ param viewsConfiguration The views configuration
* @ param rendererConfiguration The renderer configuration
* @ return The template resolver */
@ Singleton public AbstractConfigurableTemplateResolver templateResolver ( ViewsConfiguration viewsConfiguration , ThymeleafViewsRendererConfiguration rendererConfiguration ) { } } | ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver ( ) ; templateResolver . setPrefix ( viewsConfiguration . getFolder ( ) ) ; templateResolver . setCharacterEncoding ( rendererConfiguration . getCharacterEncoding ( ) ) ; templateResolver . setTemplateMode ( rendererConfiguration . getTemplateMode ( ) ) ; templateResolver . setSuffix ( rendererConfiguration . getSuffix ( ) ) ; templateResolver . setForceSuffix ( rendererConfiguration . getForceSuffix ( ) ) ; templateResolver . setForceTemplateMode ( rendererConfiguration . getForceTemplateMode ( ) ) ; templateResolver . setCacheTTLMs ( rendererConfiguration . getCacheTTLMs ( ) ) ; templateResolver . setCheckExistence ( rendererConfiguration . getCheckExistence ( ) ) ; templateResolver . setCacheable ( rendererConfiguration . getCacheable ( ) ) ; return templateResolver ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.