signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CommonOps_DDRM { /** * Element - wise power operation < br >
* c < sub > ij < / sub > = a < sub > ij < / sub > ^ b
* @ param A left side
* @ param b right scalar
* @ param C output ( modified ) */
public static void elementPower ( DMatrixD1 A , double b , DMatrixD1 C ) { } } | if ( A . numRows != C . numRows || A . numCols != C . numCols ) { throw new MatrixDimensionException ( "All matrices must be the same shape" ) ; } int size = A . getNumElements ( ) ; for ( int i = 0 ; i < size ; i ++ ) { C . data [ i ] = Math . pow ( A . data [ i ] , b ) ; } |
public class Not { /** * Returns true if this condition is satisfied by the given test case properties . */
public boolean satisfied ( PropertySet properties ) { } } | boolean isSatisfied ; Iterator < ICondition > conditions ; for ( conditions = getConditions ( ) , isSatisfied = true ; isSatisfied && conditions . hasNext ( ) ; isSatisfied = ! conditions . next ( ) . satisfied ( properties ) ) ; return isSatisfied ; |
public class IntArrayList { /** * Index of the first element with this value .
* @ param value for the element .
* @ return the index if found otherwise - 1. */
public @ DoNotSub int indexOf ( final int value ) { } } | for ( @ DoNotSub int i = 0 ; i < size ; i ++ ) { if ( value == elements [ i ] ) { return i ; } } return - 1 ; |
public class Order { /** * Returns the total of the { @ link Order } .
* @ return */
public BigDecimal getTotal ( ) { } } | BigDecimal total = BigDecimal . ZERO ; for ( LineItem item : lineItems ) { total = total . add ( item . getTotal ( ) ) ; } return total ; |
public class ConfigManager { /** * Updates the configuration and writes it to the { @ link # getConfigFile ( ) file } , overwriting
* the previous content of the file .
* @ param config the new configuration
* @ param createBackup if true a . bak file is copied from the original as a backup
* @ throws Exception... | if ( config == null ) { throw new IllegalArgumentException ( "config must not be null" ) ; } Lock lock = this . configurationLock . writeLock ( ) ; lock . lock ( ) ; try { save ( this . configFile , config , createBackup ) ; this . configuration = new Configuration ( config ) ; } finally { lock . unlock ( ) ; } |
public class AtomicFileWriter { /** * Wraps potential { @ link java . nio . file . InvalidPathException } thrown by { @ link File # toPath ( ) } in an
* { @ link IOException } for backward compatibility .
* @ param file
* @ return the path for that file
* @ see File # toPath ( ) */
private static Path toPath ( ... | try { return file . toPath ( ) ; } catch ( InvalidPathException e ) { throw new IOException ( e ) ; } |
public class AsyncTask { /** * Waits if necessary for at most the given time for the computation
* to complete , and then retrieves its result .
* @ param timeout Time to wait before cancelling the operation .
* @ param unit The time unit for the timeout .
* @ return The computed result .
* @ throws Cancellat... | return mFuture . get ( timeout , unit ) ; |
public class StatementManager { /** * Sets object for statement at specific index , adhering to platform - and null - rules .
* @ param stmt the statement
* @ param index the current parameter index
* @ param value the value to set
* @ param sqlType the JDBC SQL - type of the value
* @ throws SQLException on ... | if ( value == null ) { m_platform . setNullForStatement ( stmt , index , sqlType ) ; } else { m_platform . setObjectForStatement ( stmt , index , value , sqlType ) ; } |
public class WorkItemConfigurationsInner { /** * Gets default work item configurations that exist for the application .
* @ param resourceGroupName The name of the resource group .
* @ param resourceName The name of the Application Insights component resource .
* @ throws IllegalArgumentException thrown if parame... | return getDefaultWithServiceResponseAsync ( resourceGroupName , resourceName ) . map ( new Func1 < ServiceResponse < WorkItemConfigurationInner > , WorkItemConfigurationInner > ( ) { @ Override public WorkItemConfigurationInner call ( ServiceResponse < WorkItemConfigurationInner > response ) { return response . body ( ... |
public class MatchCache { /** * Tests if the specified object is a key in this hashtable .
* @ param key possible key .
* @ return < code > true < / code > if the specified object is a key in this
* hashtable ; < code > false < / code > otherwise .
* @ see java . util . Hashtable # contains ( java . lang . Obje... | FastHashtableEntry tab [ ] = table ; int hash = key . hashCode ( ) ; int index = ( hash & 0x7FFFFFFF ) % tab . length ; for ( FastHashtableEntry e = tab [ index ] ; e != null ; e = e . next ) { if ( ( e . hash == hash ) && e . key . equals ( key ) ) { return true ; } } return false ; |
public class CoinbaseAccountServiceRaw { /** * Authenticated resource which lets the user resend a money request .
* @ param transactionId
* @ return true if resending the request was successful .
* @ throws IOException
* @ see < a
* href = " https : / / coinbase . com / api / doc / 1.0 / transactions / resen... | final CoinbaseBaseResponse response = coinbase . resendRequest ( transactionId , exchange . getExchangeSpecification ( ) . getApiKey ( ) , signatureCreator , exchange . getNonceFactory ( ) ) ; return handleResponse ( response ) ; |
public class ServiceConfigUtil { /** * Gets a list from an object for the given key . If the key is not present , this returns null .
* If the value is not a List , throws an exception . */
@ SuppressWarnings ( "unchecked" ) @ Nullable static List < ? > getList ( Map < String , ? > obj , String key ) { } } | assert key != null ; if ( ! obj . containsKey ( key ) ) { return null ; } Object value = obj . get ( key ) ; if ( ! ( value instanceof List ) ) { throw new ClassCastException ( String . format ( "value '%s' for key '%s' in '%s' is not List" , value , key , obj ) ) ; } return ( List < ? > ) value ; |
public class SlaveMain { /** * Try waiting for a GC to happen . This is a dirty heuristic but if we ' re
* here we ' re neck deep in sh * t anyway ( OOMs all over ) . */
private static void tryWaitingForGC ( ) { } } | // We could try to preallocate memory mx bean and count collections . . .
// there is no guarantee it doesn ' t allocate stuff too though .
final long timeout = System . currentTimeMillis ( ) + 2000 ; while ( System . currentTimeMillis ( ) < timeout ) { System . gc ( ) ; try { Thread . sleep ( 250 ) ; } catch ( Interru... |
public class CustomerAccountUrl { /** * Get Resource Url for GetLoginStateByUserName
* @ param customerSetCode The unique idenfitier of the customer set .
* @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter shoul... | UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/accounts/loginstatebyusername?userName={userName}&customerSetCode={customerSetCode}&responseFields={responseFields}" ) ; formatter . formatUrl ( "customerSetCode" , customerSetCode ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; forma... |
public class NotificationManager { /** * Clean up timed out clients .
* TODO : If all clients leave and nobody ever comes up , then we won ' t cleanup . Need to
* think of a place outside of notifications package that could trigger a cleanup . */
public void cleanUp ( RESTRequest request ) { } } | // We need to loop through the clients but we don ' t want to synchronize
// the entire map , which would block new clients from entering and block existing
// clients from continuing their work . So we iterate and possibly remove by just
// using the built - in concurrency of ConcurrentHashMap .
final Iterator < Entry... |
public class DeviceImpl { /** * Get info of this device in IDL3
* @ return info
* @ throws DevFailed */
@ Override public DevInfo_3 info_3 ( ) throws DevFailed { } } | MDC . setContextMap ( contextMap ) ; xlogger . entry ( ) ; deviceMonitoring . startRequest ( "Operation info_3" ) ; final DevInfo_3 info3 = new DevInfo_3 ( ) ; final DevInfo info = info ( ) ; info3 . dev_class = info . dev_class ; info3 . doc_url = info . doc_url ; info3 . server_host = info . server_host ; info3 . ser... |
public class Mapper { /** * Create a new Map by using the iterator objects as keys , and the mapping result as values . Discard keys which
* return null values from the mapper .
* @ param mapper a Mapper to map the values
* @ param i Iterator
* @ return a new Map with values mapped */
public static Map makeMap ... | return makeMap ( mapper , i , false ) ; |
public class StringUtils { /** * Undoubles the quotes inside the string < br > Example : < br >
* < pre >
* hello " " world becomes hello " world
* < / pre >
* @ param str input string to dequote
* @ param quote the quoting char
* @ return dequoted string */
public static String dequote ( String str , char ... | // Is there anything to dequote ?
if ( str == null ) { return null ; } return dequote ( str , 0 , str . length ( ) , quote ) ; |
public class Groups { /** * Partitions elements from the array into two collections containing
* elements that match the predicate ( left side collection ) and elements
* that don ' t ( right side collection ) . E . g :
* < code > partition ( [ 1,2,3,4 ] , isOdd ) - > ( [ 1,3 ] , [ 2,4 ] ) < / code >
* @ param ... | return new PartitionBy < > ( partitioner , acceptedCollectionProvider , refusedCollectionProvider ) . apply ( new ArrayIterator < > ( values ) ) ; |
public class StringUtilities { /** * Appends a string to a buffer , prepending with a delimiter string . For
* instance , this may be used to create a string of comma - delimited values .
* This does not ignore empty strings .
* @ param buffer
* Our initial buffer string .
* @ param string
* String we are a... | if ( string == null ) { return ; } // Only append the delimiter in front if the buffer isn ' t empty .
if ( buffer . length ( ) == 0 || delimiter == null ) { buffer . append ( string ) ; } else { buffer . append ( delimiter ) . append ( string ) ; } |
public class WebFacesConfigDescriptorImpl { /** * Returns all < code > managed - bean < / code > elements
* @ return list of < code > managed - bean < / code > */
public List < FacesConfigManagedBeanType < WebFacesConfigDescriptor > > getAllManagedBean ( ) { } } | List < FacesConfigManagedBeanType < WebFacesConfigDescriptor > > list = new ArrayList < FacesConfigManagedBeanType < WebFacesConfigDescriptor > > ( ) ; List < Node > nodeList = model . get ( "managed-bean" ) ; for ( Node node : nodeList ) { FacesConfigManagedBeanType < WebFacesConfigDescriptor > type = new FacesConfigM... |
public class AnotB { /** * Perform A - and - not - B set operation on the two given sketches and return the result as an
* ordered CompactSketch on the heap .
* @ param a The incoming sketch for the first argument
* @ param b The incoming sketch for the second argument
* @ return an ordered CompactSketch on the... | return aNotB ( a , b , true , null ) ; |
public class ListTargetsForPolicyResult { /** * The policy targets .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setTargets ( java . util . Collection ) } or { @ link # withTargets ( java . util . Collection ) } if you want to override
* the existing va... | if ( this . targets == null ) { setTargets ( new java . util . ArrayList < String > ( targets . length ) ) ; } for ( String ele : targets ) { this . targets . add ( ele ) ; } return this ; |
public class AwsSecurityFindingFilters { /** * The source of the threat intel .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setThreatIntelIndicatorSource ( java . util . Collection ) } or
* { @ link # withThreatIntelIndicatorSource ( java . util . Colle... | if ( this . threatIntelIndicatorSource == null ) { setThreatIntelIndicatorSource ( new java . util . ArrayList < StringFilter > ( threatIntelIndicatorSource . length ) ) ; } for ( StringFilter ele : threatIntelIndicatorSource ) { this . threatIntelIndicatorSource . add ( ele ) ; } return this ; |
public class StringUtils { /** * Masks the useless checked exception from URLEncoder . encode ( ) */
public static String urlEncode ( String string ) { } } | try { return URLEncoder . encode ( string , "utf-8" ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } |
public class WebSocketServerHandshaker { /** * Performs the opening handshake
* When call this method you < strong > MUST NOT < / strong > retain the { @ link HttpRequest } which is passed in .
* @ param channel
* Channel
* @ param req
* HTTP Request
* @ param responseHeaders
* Extra headers to add to the... | if ( req instanceof FullHttpRequest ) { return handshake ( channel , ( FullHttpRequest ) req , responseHeaders , promise ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "{} WebSocket version {} server handshake" , channel , version ( ) ) ; } ChannelPipeline p = channel . pipeline ( ) ; ChannelHandlerContext... |
public class InodeLockList { /** * Locks an edge leading out of the last inode in the list .
* For example , if the lock list is [ a , a - > b , b ] , lockEdge ( c ) will add b - > c to the list , resulting
* in [ a , a - > b , b , b - > c ] .
* @ param childName the child to lock
* @ param mode the mode to loc... | Preconditions . checkState ( endsInInode ( ) ) ; Preconditions . checkState ( mLockMode == LockMode . READ ) ; lockEdgeInternal ( childName , mode ) ; mLockMode = mode ; |
public class CertificatesInner { /** * Retrieve the certificate identified by certificate name .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ param certificateName The name of certificate .
* @ param serviceCallback the as... | return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( resourceGroupName , automationAccountName , certificateName ) , serviceCallback ) ; |
public class Editors { /** * Converts the given text string to an object of the given type class .
* < br / >
* If no editor is registered for the given type class , or if it fails the conversion , the default
* property editor from { @ link PropertyEditorManager } is tried .
* @ param text the text string to c... | Class < ? extends PropertyEditor > editorClass = null ; synchronized ( editors ) { editorClass = editors . get ( typeClass ) ; } if ( editorClass != null ) { PropertyEditor editor = newPropertyEditor ( editorClass ) ; if ( editor != null ) { try { return ( T ) convertFromString ( editor , text ) ; } catch ( IllegalArgu... |
public class Arguments { /** * Creates a new object with the list of arguments . It checks for the number of argument entries and creates an
* empty arguments object if necessary .
* @ param values values without name
* @ param params parameters ( name - value pairs )
* @ return the created object */
public sta... | if ( values == null ) { values = emptyList ( ) ; } if ( params == null ) { params = emptyMap ( ) ; } if ( values . isEmpty ( ) && params . isEmpty ( ) ) { return NONE ; } return new Arguments ( values , params ) ; |
public class BloatedSynchronizedBlock { /** * implement the visitor to reset the sync count , the stack , and gather some information
* @ param obj
* the context object for the currently parsed method */
@ Override public void visitCode ( Code obj ) { } } | Method m = getMethod ( ) ; if ( prescreen ( m ) ) { if ( m . isSynchronized ( ) ) { syncPC = 0 ; } else { syncPC = - 1 ; } isStatic = m . isStatic ( ) ; unsafeAliases . clear ( ) ; unsafeAliases . set ( 0 ) ; branchInfo . clear ( ) ; unsafeCallOccurred = false ; stack . resetForMethodEntry ( this ) ; } |
public class JavaClassService { /** * This simply adds the interface to the provided { @ link JavaClassModel } while checking for duplicate entries . */
public void addInterface ( JavaClassModel jcm , JavaClassModel interfaceJCM ) { } } | for ( JavaClassModel existingInterface : jcm . getInterfaces ( ) ) { if ( existingInterface . equals ( interfaceJCM ) ) return ; } jcm . addInterface ( interfaceJCM ) ; |
public class AT_Row { /** * Sets left and right padding for all cells in the row .
* @ param padding new padding for left and right , ignored if smaller than 0
* @ return this to allow chaining */
public AT_Row setPaddingLeftRight ( int padding ) { } } | if ( this . hasCells ( ) ) { for ( AT_Cell cell : this . getCells ( ) ) { cell . getContext ( ) . setPaddingLeftRight ( padding ) ; } } return this ; |
public class ManualDescriptor { /** * indexed getter for chemicalList - gets an indexed value - A collection of objects of type uima . julielab . uima . Chemical , O
* @ generated
* @ param i index in the array to get
* @ return value of the element at index i */
public Chemical getChemicalList ( int i ) { } } | if ( ManualDescriptor_Type . featOkTst && ( ( ManualDescriptor_Type ) jcasType ) . casFeat_chemicalList == null ) jcasType . jcas . throwFeatMissing ( "chemicalList" , "de.julielab.jules.types.pubmed.ManualDescriptor" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( ManualDescrip... |
public class ModifyVpcEndpointRequest { /** * ( Interface endpoint ) One or more security group IDs to disassociate from the network interface .
* @ param removeSecurityGroupIds
* ( Interface endpoint ) One or more security group IDs to disassociate from the network interface . */
public void setRemoveSecurityGroup... | if ( removeSecurityGroupIds == null ) { this . removeSecurityGroupIds = null ; return ; } this . removeSecurityGroupIds = new com . amazonaws . internal . SdkInternalList < String > ( removeSecurityGroupIds ) ; |
public class SeaGlassTextFieldUI { /** * DOCUMENT ME !
* @ param action DOCUMENT ME ! */
protected void fireAction ( ActionListener action ) { } } | int modifiers = 0 ; AWTEvent currentEvent = EventQueue . getCurrentEvent ( ) ; if ( currentEvent instanceof InputEvent ) { modifiers = ( ( InputEvent ) currentEvent ) . getModifiers ( ) ; } else if ( currentEvent instanceof ActionEvent ) { modifiers = ( ( ActionEvent ) currentEvent ) . getModifiers ( ) ; } ActionEvent ... |
public class JCudaDriver { /** * Copies memory from Host to Device .
* < pre >
* CUresult cuMemcpyHtoD (
* CUdeviceptr dstDevice ,
* const void * srcHost ,
* size _ t ByteCount )
* < / pre >
* < div >
* < p > Copies memory from Host to Device .
* Copies from host memory to device memory . < tt > dstDe... | return checkResult ( cuMemcpyHtoDNative ( dstDevice , srcHost , ByteCount ) ) ; |
public class FileSize { /** * Build file size representation for given numeric value and units .
* @ param fileSize file size numeric part value ,
* @ param units file size units .
* @ return formated file size . */
private String format ( double fileSize , Units units ) { } } | StringBuilder builder = new StringBuilder ( ) ; builder . append ( numberFormat . format ( fileSize ) ) ; builder . append ( ' ' ) ; builder . append ( units . name ( ) ) ; return builder . toString ( ) ; |
public class PhotonCSS { /** * Unregister an existing CSS item only from this request
* @ param aCSSPathProvider
* The CSS path provider to use . May not be < code > null < / code > . */
public static void unregisterCSSIncludeFromThisRequest ( @ Nonnull final ICSSPathProvider aCSSPathProvider ) { } } | final CSSResourceSet aSet = _getPerRequestSet ( false ) ; if ( aSet != null ) aSet . removeItem ( aCSSPathProvider ) ; |
public class MergeRegionMeanShift { /** * Takes the mode of a region and searches the local area around it for other regions . If the region ' s mode
* is also within the local area its color is checked to see if it ' s similar enough . If the color is similar
* enough then the two regions are marked for merger . *... | for ( int targetId = 0 ; targetId < modeLocation . size && ! stopRequested ; targetId ++ ) { float [ ] color = regionColor . get ( targetId ) ; Point2D_I32 location = modeLocation . get ( targetId ) ; int x0 = location . x - searchRadius ; int x1 = location . x + searchRadius + 1 ; int y0 = location . y - searchRadius ... |
public class ComputationGraph { /** * Calculate the gradient of the network with respect to some external errors .
* Note that this is typically used for things like reinforcement learning , not typical networks that include
* an OutputLayer or RnnOutputLayer
* @ param epsilons Epsilons ( errors ) at the output .... | if ( epsilons == null || epsilons . length != numOutputArrays ) throw new IllegalArgumentException ( "Invalid input: must have epsilons length equal to number of output arrays" ) ; try { calcBackpropGradients ( true , configuration . getBackpropType ( ) == BackpropType . TruncatedBPTT , epsilons ) ; return gradient ; }... |
public class MoreStringUtil { /** * 高性能的Split , 针对char的分隔符号 , 比JDK String自带的高效 .
* copy from Commons Lange 3.5 StringUtils 并做优化
* @ see # split ( String , char , int ) */
public static List < String > split ( @ Nullable final String str , final char separatorChar ) { } } | return split ( str , separatorChar , 10 ) ; |
public class DefaultGroovyMethods { /** * Bitwise XOR together two Numbers . Called when the ' ^ ' operator is used .
* @ param left a Number
* @ param right another Number to bitwse XOR
* @ return the bitwise XOR of both Numbers
* @ since 1.0 */
public static Number xor ( Number left , Number right ) { } } | return NumberMath . xor ( left , right ) ; |
public class FirestoreAdminClient { /** * Updates a field configuration . Currently , field updates apply only to single field index
* configuration . However , calls to
* [ FirestoreAdmin . UpdateField ] [ google . firestore . admin . v1 . FirestoreAdmin . UpdateField ] should
* provide a field mask to avoid cha... | UpdateFieldRequest request = UpdateFieldRequest . newBuilder ( ) . setField ( field ) . build ( ) ; return updateField ( request ) ; |
public class JOGLTypeConversions { /** * Convert pixel types to GL constants .
* @ param p The pixel type .
* @ return The resulting GL constant . */
public static int pixelTypeToGL ( final JCGLPixelFormat p ) { } } | switch ( p ) { case PIXEL_COMPONENT_BYTE : return GL . GL_BYTE ; case PIXEL_COMPONENT_FLOAT : return GL . GL_FLOAT ; case PIXEL_COMPONENT_INT : return GL2ES2 . GL_INT ; case PIXEL_COMPONENT_SHORT : return GL . GL_SHORT ; case PIXEL_COMPONENT_UNSIGNED_BYTE : return GL . GL_UNSIGNED_BYTE ; case PIXEL_COMPONENT_UNSIGNED_I... |
public class QueryEngine { /** * Select records filtered by Qualifiers
* @ param stmt A Statement object containing Namespace , Set and the Bins to be returned .
* @ param metaOnly Set to true to return only the record meta data
* @ param qualifiers Zero or more Qualifiers for the update query
* @ return A KeyR... | /* * no filters */
if ( qualifiers == null || qualifiers . length == 0 ) { RecordSet recordSet = null ; if ( node != null ) recordSet = this . client . queryNode ( queryPolicy , stmt , node ) ; else recordSet = this . client . query ( queryPolicy , stmt ) ; return new KeyRecordIterator ( stmt . getNamespace ( ) , recor... |
public class EntityDataModelUtil { /** * Gets the OData type of the property ; if the property is a collection , gets the OData type of the elements of the
* collection .
* @ param entityDataModel The entity data model
* @ param property The property .
* @ return The OData type of the property ; if the property... | return getAndCheckType ( entityDataModel , getPropertyTypeName ( property ) ) ; |
public class GitHubClient { /** * Get github client .
* @ return Github retrofit interface */
public static GitHub getClient ( ) { } } | RestAdapter restAdapter = new RestAdapter . Builder ( ) . setEndpoint ( API_URL ) . setLogLevel ( RestAdapter . LogLevel . BASIC ) . build ( ) ; return restAdapter . create ( GitHub . class ) ; |
public class BaseExchangeRateProvider { /** * Access a { @ link javax . money . convert . CurrencyConversion } that can be applied as a
* { @ link javax . money . MonetaryOperator } to an amount .
* @ param term term { @ link javax . money . CurrencyUnit } , not { @ code null }
* @ return a new instance of a corr... | return getCurrencyConversion ( ConversionQueryBuilder . of ( ) . setTermCurrency ( term ) . build ( ) ) ; |
public class IndexSettingsReader { /** * Read index settings
* @ param root dir within the classpath
* @ param index index name
* @ return Settings
* @ throws IOException if connection with elasticsearch is failing */
public static String readSettings ( String root , String index ) throws IOException { } } | if ( root == null ) { return readSettings ( index ) ; } return readSettings ( root , index , Defaults . IndexSettingsFileName ) ; |
public class Settings { /** * Locate the configuration file , if present , for a Portlet or Servlet .
* @ param webappRootContext Context URL ( in String form ) from which
* < code > userSpecifiedContextLocation < / code > will be evaluated by
* < code > ResourceHelper < / code > , if specified
* @ param userSp... | // Assertions .
if ( webappRootContext == null ) { String msg = "Argument 'webappRootContext' cannot be null." ; throw new IllegalArgumentException ( msg ) ; } // NB : Both ' userSpecifiedContextLocation ' & ' defaultLocation ' may be null
URL rslt = null ; if ( userSpecifiedContextLocation != null ) { /* * SPECIAL HAN... |
public class BSHPrimaryExpression { /** * Called from BSHArrayInitializer during node creation informing us
* that we are an array expression .
* If parent BSHAssignment has an ASSIGN operation then this is a map
* expression . If the initializer reference has multiple dimensions
* it gets configure as being a ... | this . isArrayExpression = true ; if ( parent instanceof BSHAssignment ) { BSHAssignment ass = ( BSHAssignment ) parent ; if ( null != ass . operator && ass . operator == ParserConstants . ASSIGN ) this . isMapExpression = true ; if ( this . isMapExpression && init . jjtGetParent ( ) instanceof BSHArrayInitializer ) in... |
public class AxesChartSeriesNumericalNoErrorBars { /** * Finds the min and max of a dataset
* @ param data
* @ return */
double [ ] findMinMax ( double [ ] data ) { } } | double min = Double . MAX_VALUE ; double max = - Double . MAX_VALUE ; for ( double dataPoint : data ) { if ( Double . isNaN ( dataPoint ) ) { continue ; } else { if ( dataPoint < min ) { min = dataPoint ; } if ( dataPoint > max ) { max = dataPoint ; } } } return new double [ ] { min , max } ; |
public class AbstractElement { /** * Gets the path .
* @ return the path
* @ throws EFapsException the eFaps exception */
public String getPath ( ) { } } | final StringBuilder path = new StringBuilder ( ) ; if ( getPrevious ( ) != null ) { path . append ( getPrevious ( ) . getPath ( ) ) ; } return path . toString ( ) ; |
public class DateTimeUtils { /** * Add / Subtract the specified amount of milliseconds to the given { @ link Calendar } .
* The returned { @ link Calendar } has its fields synced .
* @ param origin
* @ param value
* @ return
* @ since 0.9.2 */
public static Calendar addMilliseconds ( Calendar origin , int val... | Calendar cal = sync ( ( Calendar ) origin . clone ( ) ) ; cal . add ( Calendar . MILLISECOND , value ) ; return sync ( cal ) ; |
public class GetInventoryRequest { /** * The list of inventory item types to return .
* @ param resultAttributes
* The list of inventory item types to return . */
public void setResultAttributes ( java . util . Collection < ResultAttribute > resultAttributes ) { } } | if ( resultAttributes == null ) { this . resultAttributes = null ; return ; } this . resultAttributes = new com . amazonaws . internal . SdkInternalList < ResultAttribute > ( resultAttributes ) ; |
public class SessionBeanTypeImpl { /** * If not already created , a new < code > after - begin - method < / code > element with the given value will be created .
* Otherwise , the existing < code > after - begin - method < / code > element will be returned .
* @ return a new or existing instance of < code > NamedMe... | Node node = childNode . getOrCreate ( "after-begin-method" ) ; NamedMethodType < SessionBeanType < T > > afterBeginMethod = new NamedMethodTypeImpl < SessionBeanType < T > > ( this , "after-begin-method" , childNode , node ) ; return afterBeginMethod ; |
public class ListPolicyVersionsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListPolicyVersionsRequest listPolicyVersionsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listPolicyVersionsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listPolicyVersionsRequest . getPolicyName ( ) , POLICYNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to ... |
public class Polygon { /** * Returns true if point is inside a polygon .
* @ param testx
* @ param testy
* @ return
* @ see < a href = " http : / / www . ecse . rpi . edu / Homepages / wrf / Research / Short _ Notes / pnpoly . html " > PNPOLY - Point Inclusion in Polygon Test W . Randolph Franklin ( WRF ) < / a... | if ( ! bounds . isInside ( testx , testy ) ) { return false ; } return isRawHit ( points , testx , testy ) ; |
public class AbstractRectangularShape2ifx { /** * Replies the property that is the minimum x coordinate of the box .
* @ return the minX property . */
@ Pure public IntegerProperty minXProperty ( ) { } } | if ( this . minX == null ) { this . minX = new SimpleIntegerProperty ( this , MathFXAttributeNames . MINIMUM_X ) { @ Override protected void invalidated ( ) { final int currentMin = get ( ) ; final int currentMax = getMaxX ( ) ; if ( currentMax < currentMin ) { // min - max constrain is broken
maxXProperty ( ) . set ( ... |
public class LOiToFltFunctionBuilder { /** * Adds full new case for the argument that are of specific classes ( matched by instanceOf , null is a wildcard ) . */
@ Nonnull public < V extends T > LOiToFltFunctionBuilder < T > aCase ( Class < V > argC1 , LOiToFltFunction < V > function ) { } } | PartialCaseWithFltProduct . The pc = partialCaseFactoryMethod ( ( a1 , a2 ) -> ( argC1 == null || argC1 . isInstance ( a1 ) ) ) ; pc . evaluate ( function ) ; return self ( ) ; |
public class MultiGetQuery { /** * Start the work of firing up X concurrent get requests . */
private void startFetch ( ) { } } | prepareConcurrentMultiGetTasks ( ) ; // set the time of starting
fetch_start_time = System . currentTimeMillis ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Start to fetch data using multiget, there will be " + multi_get_wait_cnt + " multigets to call" ) ; } for ( int con_idx = 0 ; con_idx < concurrency_multi_... |
public class BaseNeo4jEntityQueries { /** * Looks something like :
* OPTIONAL MATCH ( owner ) - [ r ] - > ( emb )
* OPTIONAL MATCH ( emb ) - [ r2 * ] - > ( emb _ 2)
* The reason we make this split to the path towards the embedded nodes is
* to make the query faster . */
private static void appendOptionalMatchOw... | queryBuilder . append ( " OPTIONAL MATCH (" ) ; queryBuilder . append ( ENTITY_ALIAS ) ; queryBuilder . append ( ") -[" ) ; queryBuilder . append ( FIRST_EMBEDDED_REL_ALIAS ) ; queryBuilder . append ( "]->(" ) ; queryBuilder . append ( FIRST_EMBEDDED_ALIAS ) ; queryBuilder . append ( ":" ) ; queryBuilder . append ( Nod... |
public class WhatLinksHereView { /** * TODO : Is there a computationally inexpensive way to see if anything links here ( without full page tree traversal ? ) */
@ Override public boolean isApplicable ( ServletContext servletContext , HttpServletRequest request , HttpServletResponse response , Page page ) throws Servlet... | return true ; |
public class JsfFaceletScannerPlugin { /** * Parses the xml file with a { @ link DocumentBuilder } .
* @ param resource
* the file to read
* @ return a { @ link Document }
* @ throws SAXException
* see { @ link DocumentBuilder # parse ( java . io . File ) }
* @ throws IOException
* see { @ link DocumentBu... | return documentBuilder . parse ( resource . getFile ( ) ) ; |
public class IntegerChromosome { /** * Returns an int array containing all of the elements in this chromosome
* in proper sequence . If the chromosome fits in the specified array , it is
* returned therein . Otherwise , a new array is allocated with the length of
* this chromosome .
* @ since 3.0
* @ param ar... | final int [ ] a = array . length >= length ( ) ? array : new int [ length ( ) ] ; for ( int i = length ( ) ; -- i >= 0 ; ) { a [ i ] = intValue ( i ) ; } return a ; |
public class ExtensionAlert { /** * Shows the " Edit Alert " dialogue , with the given alert .
* @ param alert the alert to be edited .
* @ since 2.7.0 */
public void showAlertEditDialog ( Alert alert ) { } } | if ( dialogAlertAdd == null || ! dialogAlertAdd . isVisible ( ) ) { dialogAlertAdd = new AlertAddDialog ( getView ( ) . getMainFrame ( ) , false ) ; dialogAlertAdd . setVisible ( true ) ; dialogAlertAdd . setAlert ( alert ) ; } |
public class AlertView { /** * Animates the View from top down to its set position .
* If a non - null duration is passed , a countdown loading bar will show to
* indicate the View will be automatically dismissed if not clicked .
* @ param alertText text to be shown in the View
* @ param duration in millisecond... | this . alertText . setText ( alertText ) ; alertProgressBar . setProgress ( alertProgressBar . getMax ( ) ) ; // Start animation based on current visibility
if ( getVisibility ( ) == INVISIBLE ) { setVisibility ( VISIBLE ) ; startAnimation ( slideDownTop ) ; // If a duration is found , start the countdown
if ( duration... |
public class XmlEscape { /** * Perform an XML 1.0 level 2 ( markup - significant and all non - ASCII chars ) < strong > escape < / strong > operation
* on a < tt > String < / tt > input meant to be an XML attribute value , writing results to a < tt > Writer < / tt > .
* < em > Level 2 < / em > means this method wil... | escapeXml ( text , writer , XmlEscapeSymbols . XML10_ATTRIBUTE_SYMBOLS , XmlEscapeType . CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA , XmlEscapeLevel . LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT ) ; |
public class br_device_profile { /** * < pre >
* Use this operation to get device profiles .
* < / pre > */
public static br_device_profile [ ] get ( nitro_service client ) throws Exception { } } | br_device_profile resource = new br_device_profile ( ) ; resource . validate ( "get" ) ; return ( br_device_profile [ ] ) resource . get_resources ( client ) ; |
public class DownloadImpl { /** * ( non - Javadoc )
* @ see com . amazonaws . services . s3 . transfer . Download # pause ( ) */
@ Override public PersistableDownload pause ( ) throws PauseException { } } | boolean forceCancel = true ; TransferState currentState = getState ( ) ; this . monitor . getFuture ( ) . cancel ( true ) ; if ( persistableDownload == null ) { throw new PauseException ( TransferManagerUtils . determinePauseStatus ( currentState , forceCancel ) ) ; } return persistableDownload ; |
public class ViewPagerEx { /** * This method will be invoked when the current page is scrolled , either as part
* of a programmatically initiated smooth scroll or a user initiated touch scroll .
* If you override this method you must call through to the superclass implementation
* ( e . g . super . onPageScrolled... | // Offset any decor views if needed - keep them on - screen at all times .
if ( mDecorChildCount > 0 ) { final int scrollX = getScrollX ( ) ; int paddingLeft = getPaddingLeft ( ) ; int paddingRight = getPaddingRight ( ) ; final int width = getWidth ( ) ; final int childCount = getChildCount ( ) ; for ( int i = 0 ; i < ... |
public class CmsImageCacheHelper { /** * Reads the size of a single image . < p >
* @ param cms CmsObejct
* @ param res CmsResource to be read
* @ return a String representation of the dimension of the given image */
private String getSingleSize ( CmsObject cms , CmsResource res ) { } } | try { BufferedImage img = Simapi . read ( cms . readFile ( res ) . getContents ( ) ) ; return "" + img . getWidth ( ) + " x " + img . getHeight ( ) + "px" ; } catch ( CmsException | IOException e ) { return "" ; } |
public class AttributeHelper { /** * Extract data from DeviceAttribute to a Float
* @ param deviceAttributeRead
* the DeviceAttribute attribute to read
* @ return Float the result in Float format
* @ throws DevFailed */
public static Float extractToFloat ( final DeviceAttribute deviceAttributeRead ) throws DevF... | final Object value = AttributeHelper . extract ( deviceAttributeRead ) ; Float argout = null ; if ( value instanceof Short ) { argout = Float . valueOf ( ( ( Short ) value ) . floatValue ( ) ) ; } else if ( value instanceof String ) { try { argout = Float . valueOf ( ( String ) value ) ; } catch ( final Exception e ) {... |
public class TemplateFactory { /** * @ Autowired
* public void setLoadStrategyI ( LoadStrategyI loadStrategyI ) throws TemplateException {
* this . loadStrategyI = loadStrategyI ;
* loadTemplates ( ) ; */
public void loadTemplates ( ) throws TemplateException { } } | loadStrategyI . loadTemplates ( ) ; this . templateSet = loadStrategyI . getTemplates ( ) ; this . templateOrders = loadStrategyI . getOrders ( ) ; |
public class Either { /** * Perform side - effects against a wrapped right or left value , returning back the < code > Either < / code > unaltered .
* @ param leftConsumer the effecting consumer for left values
* @ param rightConsumer the effecting consumer for right values
* @ return the Either , unaltered */
pu... | return Peek2 . peek2 ( leftConsumer , rightConsumer , this ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EEnum getIfcDoorPanelOperationEnum ( ) { } } | if ( ifcDoorPanelOperationEnumEEnum == null ) { ifcDoorPanelOperationEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 965 ) ; } return ifcDoorPanelOperationEnumEEnum ; |
public class DescribeJobFlowsRequest { /** * Return only job flows whose job flow ID is contained in this list .
* @ param jobFlowIds
* Return only job flows whose job flow ID is contained in this list . */
public void setJobFlowIds ( java . util . Collection < String > jobFlowIds ) { } } | if ( jobFlowIds == null ) { this . jobFlowIds = null ; return ; } this . jobFlowIds = new com . amazonaws . internal . SdkInternalList < String > ( jobFlowIds ) ; |
public class GeometryIndexService { /** * Given a certain geometry index , add more levels to it ( This method will not change the underlying geometry ! ) .
* @ param index The index to start out from .
* @ param type Add more levels to it , where the deepest level should be of this type .
* @ param values A list... | return fromDelegate ( delegate . addChildren ( toDelegate ( index ) , toDelegate ( type ) , values ) ) ; |
public class MetricValueMarshaller { /** * Marshall the given parameter object . */
public void marshall ( MetricValue metricValue , ProtocolMarshaller protocolMarshaller ) { } } | if ( metricValue == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( metricValue . getAmount ( ) , AMOUNT_BINDING ) ; protocolMarshaller . marshall ( metricValue . getUnit ( ) , UNIT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientEx... |
public class StorageBuilder { /** * Set the user credentials repository . This setter must always be called during the build
* @ param userCredentialsRepo The repository
* @ param userId The user identifier ( may be null if the identifier is unknown )
* @ return The builder */
public StorageBuilder setUserCredent... | this . userCredentialsRepo = userCredentialsRepo ; this . userId = userId ; return this ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getIfcBenchmarkEnum ( ) { } } | if ( ifcBenchmarkEnumEEnum == null ) { ifcBenchmarkEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 785 ) ; } return ifcBenchmarkEnumEEnum ; |
public class VerbFeats { /** * setter for aspect - sets Aspect
* @ generated
* @ param v value to set into the feature */
public void setAspect ( String v ) { } } | if ( VerbFeats_Type . featOkTst && ( ( VerbFeats_Type ) jcasType ) . casFeat_aspect == null ) jcasType . jcas . throwFeatMissing ( "aspect" , "de.julielab.jules.types.VerbFeats" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( VerbFeats_Type ) jcasType ) . casFeatCode_aspect , v ) ; |
public class ResultIterator { /** * Replace and append limit .
* @ param parsedQuery
* parsed cql3 query .
* @ return cql3 query appended with limit clause . */
private String replaceAndAppendLimit ( String parsedQuery ) { } } | StringBuilder builder = new StringBuilder ( parsedQuery ) ; onLimit ( builder ) ; parsedQuery = builder . toString ( ) ; return parsedQuery ; |
public class ConfigCheckReport { /** * < pre >
* Scope name as key
* < / pre >
* < code > map & lt ; string , . alluxio . grpc . meta . InconsistentProperties & gt ; warns = 2 ; < / code > */
public java . util . Map < java . lang . String , alluxio . grpc . InconsistentProperties > getWarnsMap ( ) { } } | return internalGetWarns ( ) . getMap ( ) ; |
public class JvmCompoundTypeReferenceImplCustom { /** * { @ inheritDoc }
* Returns the value of the ' Type ' reference . If there is no type set ,
* a reference to < code > java . lang . Object < / code > is assumed as soon as there is more
* than one contained reference .
* If there is only one contained refer... | if ( references != null && ! references . isEmpty ( ) ) { if ( references . size ( ) == 1 ) { return references . get ( 0 ) . getType ( ) ; } if ( type == null ) { JvmGenericType objectType = TypesFactory . eINSTANCE . createJvmGenericType ( ) ; String objectClassName = Object . class . getName ( ) ; ( ( InternalEObjec... |
public class PrimaryBackupMessageContext { /** * Returns the event subject for the given session .
* @ param sessionId the session for which to return the event subject
* @ return the event subject for the given session */
String eventSubject ( long sessionId ) { } } | if ( prefix == null ) { return String . format ( "event-%d" , sessionId ) ; } else { return String . format ( "%s-event-%d" , prefix , sessionId ) ; } |
public class ExcelDateUtil { /** * Given an Excel date with either 1900 or 1904 date windowing , converts it
* to a java . util . Date .
* @ param excelDate
* The Excel date .
* @ param use1904windowing
* true if date uses 1904 windowing , or false if using 1900 date
* windowing .
* @ return Java represen... | final Calendar javaCalendar = getJavaCalendar ( excelDate , use1904windowing ) ; if ( javaCalendar == null ) { return null ; } return Utils . blastTime ( javaCalendar ) . getTime ( ) ; |
public class LocalDateAndTimeStampImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setHundSec ( Integer newHundSec ) { } } | Integer oldHundSec = hundSec ; hundSec = newHundSec ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . LOCAL_DATE_AND_TIME_STAMP__HUND_SEC , oldHundSec , hundSec ) ) ; |
public class FelixClassLoaderHandler { /** * Get the content location .
* @ param content
* the content object
* @ return the content location */
private static String getContentLocation ( final Object content ) { } } | final File file = ( File ) ReflectionUtils . invokeMethod ( content , "getFile" , false ) ; return file != null ? file . toURI ( ) . toString ( ) : null ; |
public class DBRImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . DBR__RLENGTH : return RLENGTH_EDEFAULT == null ? rlength != null : ! RLENGTH_EDEFAULT . equals ( rlength ) ; case AfplibPackage . DBR__RWIDTH : return RWIDTH_EDEFAULT == null ? rwidth != null : ! RWIDTH_EDEFAULT . equals ( rwidth ) ; case AfplibPackage . DBR__RWIDTHFRACTION :... |
public class WTable { /** * Retrieves the actions for the table .
* @ return the list of table actions */
public List < WButton > getActions ( ) { } } | final int numActions = actions . getChildCount ( ) ; List < WButton > buttons = new ArrayList < > ( numActions ) ; for ( int i = 0 ; i < numActions ; i ++ ) { WButton button = ( WButton ) actions . getChildAt ( i ) ; buttons . add ( button ) ; } return Collections . unmodifiableList ( buttons ) ; |
public class EmbeddableIntrospector { /** * Introspects the given Embeddable class and returns the metadata .
* @ param embeddableClass
* the Embeddable class
* @ return the metadata of the given class */
public static EmbeddableMetadata introspect ( Class < ? > embeddableClass ) { } } | EmbeddableIntrospector introspector = new EmbeddableIntrospector ( embeddableClass ) ; introspector . introspect ( ) ; return introspector . metadata ; |
public class BindSharedPreferencesBuilder { /** * Generate single read method .
* @ param entity
* the entity */
private static void generateSingleReadMethod ( PrefsEntity entity ) { } } | // read method
PrefsTransform transform ; Converter < String , String > converter = CaseFormat . LOWER_CAMEL . converterTo ( CaseFormat . UPPER_CAMEL ) ; for ( PrefsProperty item : entity . getCollection ( ) ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "get" + converter . convert ( item . getNa... |
public class BaseFont { /** * Gets a list of the document fonts in a particular page . Each element of the < CODE > ArrayList < / CODE >
* contains a < CODE > Object [ ] { String , PRIndirectReference } < / CODE > with the font name
* and the indirect reference to it .
* @ param reader the document where the font... | IntHashtable hits = new IntHashtable ( ) ; ArrayList fonts = new ArrayList ( ) ; recourseFonts ( reader . getPageN ( page ) , hits , fonts , 1 ) ; return fonts ; |
public class GetBlacklistReportsRequest { /** * A list of IP addresses that you want to retrieve blacklist information about . You can only specify the dedicated
* IP addresses that you use to send email using Amazon Pinpoint or Amazon SES .
* @ param blacklistItemNames
* A list of IP addresses that you want to r... | if ( blacklistItemNames == null ) { this . blacklistItemNames = null ; return ; } this . blacklistItemNames = new java . util . ArrayList < String > ( blacklistItemNames ) ; |
public class Predicate { /** * Short - circuited OR operation .
* @ return A predicate that is false iff both < code > a < / code > and
* < code > b < / code > are false . Evaluation stops as soon as the
* final result is known . */
public static < T > Predicate < T > OR ( final Predicate < T > a , final Predicat... | return new Predicate < T > ( ) { public boolean check ( T obj ) { return a . check ( obj ) || b . check ( obj ) ; } } ; |
public class TravellingSalesmanApplet { /** * Helper method to create a background task for running the travelling
* salesman algorithm .
* @ param cities The set of cities to generate a route for .
* @ return A Swing task that will execute on a background thread and update
* the GUI when it is done . */
privat... | final TravellingSalesmanStrategy strategy = strategyPanel . getStrategy ( ) ; return new SwingBackgroundTask < List < String > > ( ) { private long elapsedTime = 0 ; @ Override protected List < String > performTask ( ) { long startTime = System . currentTimeMillis ( ) ; List < String > result = strategy . calculateShor... |
public class QueryNode { /** * / / / Getter / Setter */
@ XmlTransient public Set < QueryAnnotation > getEdgeAnnotations ( ) { } } | Set < QueryAnnotation > edgeAnnotations = new TreeSet < > ( ) ; for ( Join j : ingoingJoins ) { edgeAnnotations . addAll ( j . getEdgeAnnotations ( ) ) ; } return Collections . unmodifiableSet ( edgeAnnotations ) ; |
public class HttpQuery { /** * Escapes a string appropriately to be a valid in JSON .
* Valid JSON strings are defined in RFC 4627 , Section 2.5.
* @ param s The string to escape , which is assumed to be in .
* @ param buf The buffer into which to write the escaped string . */
static void escapeJson ( final Strin... | final int length = s . length ( ) ; int extra = 0 ; // First count how many extra chars we ' ll need , if any .
for ( int i = 0 ; i < length ; i ++ ) { final char c = s . charAt ( i ) ; switch ( c ) { case '"' : case '\\' : case '\b' : case '\f' : case '\n' : case '\r' : case '\t' : extra ++ ; continue ; } if ( c < 0x0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.