signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class MapCollectors { /** * Based on < a
* href = " https : / / stackoverflow . com / a / 29090335/8579801 " > https : / / stackoverflow . com / a / 29090335/8579801 < / a > */
@ SuppressWarnings ( "squid:S1452" ) public static < T , K , U > Collector < T , ? , Map < K , U > > toLinkedMap ( Function < ? super ... | return Collectors . toMap ( keyMapper , valueMapper , throwingMerger ( ) , LinkedHashMap :: new ) ; |
public class LoggingUtil { /** * Gets the root j . u . l . Logger and removes all registered handlers
* then redirects all active j . u . l . to SLF4J
* N . B . This should only happen once , hence the flag and locking */
public static void hijackJDKLogging ( ) { } } | JUL_HIJACKING_LOCK . lock ( ) ; try { if ( ! julHijacked ) { SLF4JBridgeHandler . removeHandlersForRootLogger ( ) ; SLF4JBridgeHandler . install ( ) ; julHijacked = true ; } } finally { JUL_HIJACKING_LOCK . unlock ( ) ; } |
public class DescribeDirectConnectGatewayAttachmentsResult { /** * The attachments .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setDirectConnectGatewayAttachments ( java . util . Collection ) } or
* { @ link # withDirectConnectGatewayAttachments ( java... | if ( this . directConnectGatewayAttachments == null ) { setDirectConnectGatewayAttachments ( new com . amazonaws . internal . SdkInternalList < DirectConnectGatewayAttachment > ( directConnectGatewayAttachments . length ) ) ; } for ( DirectConnectGatewayAttachment ele : directConnectGatewayAttachments ) { this . direct... |
public class Parser { /** * ( Expression , . . . BindingIdentifier ) */
private ParseTree parseCoverParenthesizedExpressionAndArrowParameterList ( ) { } } | if ( peekType ( 1 ) == TokenType . FOR ) { return parseGeneratorComprehension ( ) ; } SourcePosition start = getTreeStartLocation ( ) ; eat ( TokenType . OPEN_PAREN ) ; // Case ( )
if ( peek ( TokenType . CLOSE_PAREN ) ) { eat ( TokenType . CLOSE_PAREN ) ; if ( peek ( TokenType . ARROW ) ) { return new FormalParameterL... |
public class ImageLocalNormalization { /** * < p > Normalizes the input image such that local weighted statics are a zero mean and with standard deviation
* of 1 . The image border is handled by truncating the kernel and renormalizing it so that it ' s sum is
* still one . < / p >
* < p > output [ x , y ] = ( inp... | // check preconditions and initialize data structures
initialize ( input , output ) ; // avoid overflow issues by ensuring that the max pixel value is 1
T adjusted = ensureMaxValueOfOne ( input , maxPixelValue ) ; // take advantage of 2D gaussian kernels being separable
if ( border == null ) { GConvolveImageOps . horiz... |
public class LabsInner { /** * Modify properties of labs .
* @ param resourceGroupName The name of the resource group .
* @ param labAccountName The name of the lab Account .
* @ param labName The name of the lab .
* @ param lab Represents a lab .
* @ throws IllegalArgumentException thrown if parameters fail ... | return updateWithServiceResponseAsync ( resourceGroupName , labAccountName , labName , lab ) . map ( new Func1 < ServiceResponse < LabInner > , LabInner > ( ) { @ Override public LabInner call ( ServiceResponse < LabInner > response ) { return response . body ( ) ; } } ) ; |
public class BenchmarkChronosServer { /** * Benchmark ChronosServer and print metrics in another thread . */
public void startBenchmark ( ) { } } | startTime = System . currentTimeMillis ( ) ; LOG . info ( "Start to benchmark chronos server" ) ; Thread t = new Thread ( ) { // new thread to output the metrics
@ Override public void run ( ) { final long collectPeriod = 10000 ; LOG . info ( "Start another thread to export benchmark metrics every " + collectPeriod / 1... |
public class ComponentFinder { /** * Finds the first parent of the given childComponent from the given parentClass and a flag if
* the search shell be continued with the class name if the search with the given parentClass
* returns null .
* @ param childComponent
* the child component
* @ param parentClass
... | Component parent = childComponent . getParent ( ) ; while ( parent != null ) { if ( parent . getClass ( ) . equals ( parentClass ) ) { break ; } parent = parent . getParent ( ) ; } if ( ( parent == null ) && byClassname ) { return findParentByClassname ( childComponent , parentClass ) ; } return parent ; |
public class ProducerSessionProxy { /** * This method performs the actual send , but does no parameter checking
* and gets no locks needed to perform the send . This should be done
* by a suitable ' super ' - method .
* @ param msg
* @ param tran
* @ throws com . ibm . wsspi . sib . core . exception . SISessi... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "_send" ) ; boolean sendSuccessful = false ; // Get the message priority
short jfapPriority = JFapChannelConstants . getJFAPPriority ( msg . getPriority ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . is... |
public class InOutLogger { protected void asyncShow ( RequestManager requestManager , String whole ) { } } | requestManager . getAsyncManager ( ) . async ( new ConcurrentAsyncCall ( ) { @ Override public ConcurrentAsyncImportance importance ( ) { return ConcurrentAsyncImportance . TERTIARY ; // as low priority
} @ Override public void callback ( ) { log ( whole ) ; } } ) ; |
public class BaseEnvelopeSchemaConverter { /** * Get payload field and convert to byte array
* @ param inputRecord the input record which has the payload
* @ return the byte array of the payload in the input record
* @ deprecated use { @ link # getFieldAsBytes ( GenericRecord , String ) } */
@ Deprecated protecte... | try { return getFieldAsBytes ( inputRecord , payloadField ) ; } catch ( Exception e ) { return null ; } |
public class JavaTokenizer { /** * Reads a character from { @ code reader } . In this implementation ,
* all read accesses to the reader pass through this method .
* @ param allowEOF if { @ code false } , throws IOException if EOF is
* reached */
@ Ensures ( { } } | "!allowEOF ? result >= 0 : result >= -1" } ) protected int readChar ( boolean allowEOF ) throws IOException { int c = reader . read ( ) ; if ( c != - 1 ) { ++ currentOffset ; } else { if ( ! allowEOF ) { throw new IOException ( ) ; } } return c ; |
public class Music { /** * Return true if the bar is empty or contains only barline and spacer ( s ) .
* False if barline contain other kind of music element */
public boolean barIsEmptyForAllVoices ( Bar bar ) { } } | for ( Object m_voice : m_voices ) { Voice v = ( Voice ) m_voice ; if ( ! v . barIsEmpty ( bar ) ) return false ; } return true ; |
public class CudaGridExecutioner { /** * This method forces all currently enqueued ops to be executed immediately
* PLEASE NOTE : This call IS non - blocking */
public void flushQueue ( ) { } } | /* Basically we just want to form GridOp and pass it to native executioner
But since we don ' t have GridOp interface yet , we ' ll send everything to underlying CudaExecutioner . */
// logger . info ( " Non - Blocking flush " ) ;
// TODO : proper implementation for GridOp creation required here
/* Deque < OpDescript... |
public class MethodUtils { /** * Gets all class level public methods of the given class that are annotated with the given annotation .
* @ param cls
* the { @ link Class } to query
* @ param annotationCls
* the { @ link Annotation } that must be present on a method to be matched
* @ return a list of Methods (... | return getMethodsListWithAnnotation ( cls , annotationCls , false , false ) ; |
public class FamiliarRecyclerView { /** * FooterView onBindViewHolder callback
* @ param onFooterViewBindViewHolderListener OnFooterViewBindViewHolderListener */
public void setOnFooterViewBindViewHolderListener ( FamiliarRecyclerView . OnFooterViewBindViewHolderListener onFooterViewBindViewHolderListener ) { } } | if ( null != mWrapFamiliarRecyclerViewAdapter ) { mWrapFamiliarRecyclerViewAdapter . setOnFooterViewBindViewHolderListener ( onFooterViewBindViewHolderListener ) ; } else { mTempOnFooterViewBindViewHolderListener = onFooterViewBindViewHolderListener ; } |
public class SeaGlassLookAndFeel { /** * Initialize the menu settings .
* @ param d the UI defaults map . */
private void defineMenus ( UIDefaults d ) { } } | d . put ( "menuItemBackgroundBase" , new Color ( 0x5b7ea4 ) ) ; // Initialize Menu
String c = PAINTER_PREFIX + "MenuPainter" ; String p = "Menu" ; d . put ( p + ".contentMargins" , new InsetsUIResource ( 1 , 12 , 2 , 5 ) ) ; d . put ( p + "[Disabled].textForeground" , d . get ( "seaGlassDisabledText" ) ) ; d . put ( p ... |
public class DoublePoint { /** * Divides values of two points .
* @ param point1 DoublePoint .
* @ param point2 DoublePoint .
* @ return A new DoublePoint with the division operation . */
public DoublePoint Divide ( DoublePoint point1 , DoublePoint point2 ) { } } | DoublePoint result = new DoublePoint ( point1 ) ; result . Divide ( point2 ) ; return result ; |
public class JDBCConnection { /** * < ! - - start generic documentation - - >
* Makes all changes made since the previous
* commit / rollback permanent and releases any database locks
* currently held by this < code > Connection < / code > object .
* This method should be
* used only when auto - commit mode h... | checkClosed ( ) ; try { sessionProxy . commit ( false ) ; } catch ( HsqlException e ) { throw Util . sqlException ( e ) ; } |
public class CloudMe { /** * An invoker that checks response content type = XML : to be used by all API requests
* @ param request API request
* @ return a request invoker specific for API requests */
private RequestInvoker < CResponse > getApiRequestInvoker ( HttpRequestBase request , CPath path ) { } } | return new RequestInvoker < CResponse > ( new HttpRequestor ( request , path , sessionManager ) , API_RESPONSE_VALIDATOR ) ; |
public class Viewport { /** * Write this viewport to the specified parcel . To restore a viewport from a parcel , use readFromParcel ( )
* @ param out The parcel to write the viewport ' s coordinates into */
public void writeToParcel ( Parcel out , int flags ) { } } | out . writeFloat ( left ) ; out . writeFloat ( top ) ; out . writeFloat ( right ) ; out . writeFloat ( bottom ) ; |
public class UNode { /** * are found while scanning . */
private static boolean parseXMLChildElems ( Element elem , List < UNode > childUNodeList ) { } } | assert elem != null ; assert childUNodeList != null ; // Scan for Element nodes ( there could be Comment and other nodes ) .
boolean bDupNodeNames = false ; Set < String > nodeNameSet = new HashSet < String > ( ) ; NodeList nodeList = elem . getChildNodes ( ) ; for ( int index = 0 ; index < nodeList . getLength ( ) ; i... |
public class ScreenshotMaker { /** * Takes a raw string representing the result of the toDataURL ( ) function
* of the HTML5 canvas and calls the callback with a proper mime type
* and the bytes of the image .
* @ see < a href = " http : / / www . whatwg . org / specs / web - apps / current - work / multipage / t... | if ( callback == null ) { return ; } // find the mime type
final String [ ] typeInfoAndData = rawImage . split ( "," ) ; String [ ] mimeAndEncoding = typeInfoAndData [ 0 ] . replaceFirst ( "data:" , "" ) . split ( ";" ) ; if ( typeInfoAndData . length == 2 && mimeAndEncoding . length == 2 && "base64" . equalsIgnoreCase... |
public class InvalidRequestException { /** * The error code associated with the exception .
* @ param emrErrorCode
* The error code associated with the exception . */
@ com . fasterxml . jackson . annotation . JsonProperty ( "ErrorCode" ) public void setEmrErrorCode ( String emrErrorCode ) { } } | this . emrErrorCode = emrErrorCode ; |
public class PDFPageHelper { /** * Gets the pdf page annotation name . It takes into acount the mappings
* defined in { @ link VisualizerInput # mappings } . */
public String getPDFPageAnnotationName ( ) { } } | Properties mappings = input . getMappings ( ) ; if ( mappings != null ) { return mappings . getProperty ( MAPPING_PAGE_KEY , DEFAULT_PAGE_NUMBER_ANNOTATION_NAME ) ; } return DEFAULT_PAGE_NUMBER_ANNOTATION_NAME ; |
public class RowsLogBuffer { /** * Extracting next field value from packed buffer .
* @ see mysql - 5.1.60 / sql / log _ event . cc - log _ event _ print _ value */
final Serializable fetchValue ( String columnName , int columnIndex , int type , final int meta , boolean isBinary ) { } } | int len = 0 ; if ( type == LogEvent . MYSQL_TYPE_STRING ) { if ( meta >= 256 ) { int byte0 = meta >> 8 ; int byte1 = meta & 0xff ; if ( ( byte0 & 0x30 ) != 0x30 ) { /* a long CHAR ( ) field : see # 37426 */
len = byte1 | ( ( ( byte0 & 0x30 ) ^ 0x30 ) << 4 ) ; type = byte0 | 0x30 ; } else { switch ( byte0 ) { case LogEv... |
public class PersistentUserManagedEhcache { /** * { @ inheritDoc } */
@ Override public Map < K , V > getAll ( Set < ? extends K > keys ) throws BulkCacheLoadingException { } } | return cache . getAll ( keys ) ; |
public class ResourceManager { /** * Registers a new TaskExecutor .
* @ param taskExecutorGateway to communicate with the registering TaskExecutor
* @ param taskExecutorAddress address of the TaskExecutor
* @ param taskExecutorResourceId ResourceID of the TaskExecutor
* @ param dataPort port used for data trans... | WorkerRegistration < WorkerType > oldRegistration = taskExecutors . remove ( taskExecutorResourceId ) ; if ( oldRegistration != null ) { // TODO : : suggest old taskExecutor to stop itself
log . debug ( "Replacing old registration of TaskExecutor {}." , taskExecutorResourceId ) ; // remove old task manager registration... |
public class XBELConverter { /** * Create a new JAXB { @ link Marshaller } instance to handle conversion to
* XBEL .
* @ return a new { @ link Marshaller } instance
* @ throws JAXBException Thrown if an error was encountered creating the
* JAXB { @ link Marshaller }
* @ throws PropertyException Thrown if an e... | final Marshaller marshaller = ctxt . createMarshaller ( ) ; marshaller . setProperty ( JAXB_ENCODING , UTF_8 ) ; marshaller . setProperty ( JAXB_FORMATTED_OUTPUT , true ) ; marshaller . setProperty ( JAXB_SCHEMA_LOCATION , XBELConstants . SCHEMA_URI + " " + XBELConstants . SCHEMA_URL ) ; return marshaller ; |
public class SIPRegistrarSbb { /** * call backs from data source child sbb */
@ Override public void getBindingsResult ( int resultCode , List < RegistrationBinding > bindings ) { } } | ServerTransaction serverTransaction = getRegisterTransactionToReply ( ) ; if ( serverTransaction == null ) { tracer . warning ( "failed to find SIP server tx to send response" ) ; return ; } try { if ( resultCode < 300 ) { sendRegisterSuccessResponse ( resultCode , bindings , serverTransaction ) ; } else { sendErrorRes... |
public class PhoneNumberUtil { /** * format phone number in DIN 5008 national format with cursor position handling .
* @ param pphoneNumber phone number as String to format with cursor position
* @ return formated phone number as String with new cursor position */
public final ValueWithPos < String > formatDin5008N... | return valueWithPosDefaults ( this . formatDin5008NationalWithPos ( this . parsePhoneNumber ( pphoneNumber ) ) , pphoneNumber ) ; |
public class CallCenterApp { /** * Prints a one line update on performance that can be printed
* periodically during a benchmark . */
public synchronized void printStatistics ( ) { } } | ClientStats stats = periodicStatsContext . fetchAndResetBaseline ( ) . getStats ( ) ; long time = Math . round ( ( stats . getEndTimestamp ( ) - benchmarkStartTS ) / 1000.0 ) ; System . out . printf ( "%02d:%02d:%02d " , time / 3600 , ( time / 60 ) % 60 , time % 60 ) ; System . out . printf ( "Throughput %d/s, " , stat... |
public class ArrayUtil { /** * Returns the number of elements shared between the two arrays containing
* sets . < p >
* Return the number of elements shared by two column index arrays .
* This method assumes that each of these arrays contains a set ( each
* element index is listed only once in each index array ... | int k = 0 ; for ( int i = 0 ; i < arra . length ; i ++ ) { for ( int j = 0 ; j < arrb . length ; j ++ ) { if ( arra [ i ] == arrb [ j ] ) { k ++ ; } } } return k ; |
public class ResourceAdapterModuleMBeanImpl { /** * setResourceAdapterChild add a child of type ResourceAdapterMBeanImpl to this MBean .
* @ param key the String value which will be used as the key for the ResourceAdapterMBeanImpl item
* @ param ra the ResourceAdapterMBeanImpl value to be associated with the specif... | return raMBeanChildrenList . put ( key , ra ) ; |
public class ImmutableMatrixFactory { /** * Returns an immutable matrix with the same values as the argument .
* @ param source the matrix containing the data for the new immutable matrix
* @ return an immutable matrix containing the same elements as { @ code source }
* @ throws NullPointerException if { @ code s... | if ( source instanceof ImmutableMatrix ) return ( ImmutableMatrix ) source ; if ( source . getColumnCount ( ) == 1 ) return copy ( ( Vector ) source ) ; if ( source . getRowCount ( ) == 2 && source . getColumnCount ( ) == 2 ) return new ImmutableMatrix2 ( ( Matrix2 ) source ) ; if ( source . getRowCount ( ) == 3 && sou... |
public class TimeProvider { /** * Returns a non - decreasing number , assumed to be used as a " timestamp " .
* < p > Approximate system time interval between two calls of this method is retrievable via
* { @ link # systemTimeIntervalBetween ( long , long , TimeUnit ) } , applied to the returned values
* from tho... | long now = MILLISECONDS . toNanos ( millisecondSupplier . getAsLong ( ) ) ; while ( true ) { long lastTime = lastTimeHolder . get ( ) ; if ( now <= lastTime ) return lastTime ; if ( lastTimeHolder . compareAndSet ( lastTime , now ) ) return now ; } |
public class IntListUtil { /** * Converts an array of Integer objects to an array of primitives . */
public static int [ ] unbox ( Integer [ ] list ) { } } | if ( list == null ) { return null ; } int [ ] unboxed = new int [ list . length ] ; for ( int ii = 0 ; ii < list . length ; ii ++ ) { unboxed [ ii ] = list [ ii ] ; } return unboxed ; |
public class RemoteAsyncResultImpl { /** * Unexport this object so that it is not remotely accessible .
* < p > The caller must be holding the monitor lock on the
* RemoteAsyncResultReaper prior to calling this method if the async work
* was successfully scheduled . */
protected void unexportObject ( ) { } } | // d623593
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "unexportObject: " + this ) ; if ( ivObjectID != null ) { // Either the allowed timeout occurred or a method was called and we
// know that the client no longer needs this server... |
public class ManagementEnforcer { /** * addNamedGroupingPolicy adds a named role inheritance rule to the current policy .
* If the rule already exists , the function returns false and the rule will not be added .
* Otherwise the function returns true by adding the new rule .
* @ param ptype the policy type , can ... | return addNamedGroupingPolicy ( ptype , Arrays . asList ( params ) ) ; |
public class DefaultMonetaryAmountFormat { /** * Formats a value of { @ code T } to a { @ code String } . { @ link java . util . Locale }
* passed defines the overall target { @ link Locale } . This locale state , how the
* { @ link MonetaryAmountFormat } should generally behave . The
* { @ link java . util . Loc... | StringBuilder builder = new StringBuilder ( ) ; try { print ( builder , amount ) ; } catch ( IOException e ) { throw new IllegalStateException ( "Error foratting of " + amount , e ) ; } return builder . toString ( ) ; |
public class Jar { /** * Returns an attribute ' s map value from this JAR ' s manifest ' s main section .
* The attributes string value will be split on whitespace into map entries , and each entry will be split on ' = ' to get the key - value pair .
* The returned map may be safely modified .
* @ param name the ... | return mapSplit ( getAttribute ( name ) , defaultValue ) ; |
public class HessianFactory { /** * Creates a new Hessian 2.0 serializer . */
public Hessian2Output createHessian2Output ( ) { } } | Hessian2Output out = _freeHessian2Output . allocate ( ) ; if ( out == null ) { out = new Hessian2Output ( ) ; out . setSerializerFactory ( getSerializerFactory ( ) ) ; } return out ; |
public class PreferenceFragment { /** * Adds a new fragment to a builder , which allows to create wizard dialogs .
* @ param builder
* The builder , the fragment should be added to , as an instance of the class { @ link
* WizardDialog . Builder }
* @ param index
* The index of the fragment , which should be a... | Bundle arguments = new Bundle ( ) ; arguments . putInt ( DialogFragment . INDEX_EXTRA , index ) ; CharSequence title = shouldHeaderBeShown ( ) ? null : String . format ( getString ( R . string . dialog_tab_text ) , index ) ; builder . addFragment ( title , DialogFragment . class , arguments ) ; |
public class ListGroupsResult { /** * Information about a group .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setGroups ( java . util . Collection ) } or { @ link # withGroups ( java . util . Collection ) } if you want to override the
* existing values ... | if ( this . groups == null ) { setGroups ( new java . util . ArrayList < GroupInformation > ( groups . length ) ) ; } for ( GroupInformation ele : groups ) { this . groups . add ( ele ) ; } return this ; |
public class SSTableExport { /** * JSON Hash Key serializer
* @ param out The output steam to write data
* @ param value value to set as a key */
private static void writeKey ( PrintStream out , String value ) { } } | writeJSON ( out , value ) ; out . print ( ": " ) ; |
public class ZKPaths { /** * Given a full path , return the the individual parts , without slashes .
* The root path will return an empty list .
* @ param path the path
* @ return an array of parts */
public static List < String > split ( String path ) { } } | PathUtils . validatePath ( path ) ; return PATH_SPLITTER . splitToList ( path ) ; |
public class ListSecretsResult { /** * A list of the secrets in the account .
* @ param secretList
* A list of the secrets in the account . */
public void setSecretList ( java . util . Collection < SecretListEntry > secretList ) { } } | if ( secretList == null ) { this . secretList = null ; return ; } this . secretList = new java . util . ArrayList < SecretListEntry > ( secretList ) ; |
public class BaseLuceneStorage { /** * Build query to match entry ' s space - id and key .
* @ param spaceId
* @ param key
* @ return */
protected Query buildQuery ( String spaceId , String key ) { } } | BooleanQuery . Builder builder = new BooleanQuery . Builder ( ) ; if ( ! StringUtils . isBlank ( spaceId ) ) { builder . add ( new TermQuery ( new Term ( FIELD_SPACE_ID , spaceId . trim ( ) ) ) , Occur . MUST ) ; } if ( ! StringUtils . isBlank ( key ) ) { builder . add ( new TermQuery ( new Term ( FIELD_KEY , key . tri... |
public class MetaBeanProperty { /** * Get the property of the given object .
* @ param object which to be got
* @ return the property of the given object
* @ throws RuntimeException if the property could not be evaluated */
public Object getProperty ( Object object ) { } } | MetaMethod getter = getGetter ( ) ; if ( getter == null ) { if ( field != null ) return field . getProperty ( object ) ; // TODO : create a WriteOnlyException class ?
throw new GroovyRuntimeException ( "Cannot read write-only property: " + name ) ; } return getter . invoke ( object , MetaClassHelper . EMPTY_ARRAY ) ; |
public class Ifc4FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcPreferredSurfaceCurveRepresentationToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class ReflectionUtil { /** * Returns the parameter { @ link Annotation } s for the
* given { @ link Method } .
* @ param method the { @ link Method }
* @ return the { @ link Annotation } s */
private static List < List < Annotation > > getParameterAnnotations ( Method method ) { } } | if ( methodParamAnnotationCache . containsKey ( method ) ) { return methodParamAnnotationCache . get ( method ) ; } List < List < Annotation > > annotations = new ArrayList < > ( ) ; for ( Annotation [ ] paramAnnotations : method . getParameterAnnotations ( ) ) { List < Annotation > listAnnotations = new ArrayList < > ... |
public class PropertyLoaderFromResource { /** * Load properties from a resource .
* @ param resourceName
* @ param failOnResourceNotFoundOrNotLoaded when true , a ConfigException
* is raised if the resource cannot be found or loaded
* @ return a { @ link Properties } instance with the properties loaded from the... | Properties props = new Properties ( ) ; InputStream resource = PropertyLoaderFromResource . class . getResourceAsStream ( resourceName ) ; boolean resourceNotFound = ( resource == null ) ; if ( resourceNotFound ) { if ( failOnResourceNotFoundOrNotLoaded ) { throw new ConfigException ( "resource " + resourceName + " not... |
public class TrustedCertificates { /** * Returns all signing policies */
public SigningPolicy [ ] getSigningPolicies ( ) { } } | if ( this . policyDNMap == null ) { return null ; } Collection values = this . policyDNMap . values ( ) ; return ( SigningPolicy [ ] ) this . policyDNMap . values ( ) . toArray ( new SigningPolicy [ values . size ( ) ] ) ; |
public class Parameters { /** * Gets a parameter whose value is a ( possibly empty ) comma - separated list of Strings , if
* present . */
public Optional < List < String > > getOptionalStringList ( final String param ) { } } | if ( isPresent ( param ) ) { return Optional . of ( getStringList ( param ) ) ; } return Optional . absent ( ) ; |
public class CSTransformer { /** * Apply the relationships to all of the nodes in the content spec . This should be the last step since all nodes have to be converted
* to levels and topics before this method can work . */
protected static void applyRelationships ( final ContentSpec contentSpec , final Map < Integer ... | // Apply the user defined relationships stored in the database
for ( final CSNodeWrapper node : relationshipFromNodes ) { boolean initialContentTopic = node . getNodeType ( ) == CommonConstants . CS_NODE_INITIAL_CONTENT_TOPIC ; boolean level = EntityUtilities . isNodeALevel ( node ) ; // In 1.3 or lower initial content... |
public class RunningWorkers { /** * Concurrency : Called by multiple threads .
* Parameter : Called exactly once per vortexWorkerManager . */
void addWorker ( final VortexWorkerManager vortexWorkerManager ) { } } | lock . lock ( ) ; try { if ( ! terminated ) { if ( ! removedBeforeAddedWorkers . contains ( vortexWorkerManager . getId ( ) ) ) { this . runningWorkers . put ( vortexWorkerManager . getId ( ) , vortexWorkerManager ) ; this . schedulingPolicy . workerAdded ( vortexWorkerManager ) ; this . workerAggregateFunctionMap . pu... |
public class VirtualHostConfiguration { /** * Return the port that should be used for secure redirect
* from http to https .
* Host aliases are paired : * : 80 < - > * : 443 . If the VirtualHost supports
* several aliases , they may not all be paired for failover .
* @ param hostAlias The http host alias to fin... | com . ibm . wsspi . http . VirtualHost local = config ; if ( local == null ) return - 1 ; else return local . getSecureHttpPort ( hostAlias ) ; |
public class TsdbQuery { /** * Sets the end time for the query . If this isn ' t set , the system time will be
* used when the query is executed or { @ link # getEndTime } is called
* @ param timestamp Unix epoch timestamp in seconds or milliseconds
* @ throws IllegalArgumentException if the timestamp is invalid ... | if ( timestamp < 0 || ( ( timestamp & Const . SECOND_MASK ) != 0 && timestamp > 9999999999999L ) ) { throw new IllegalArgumentException ( "Invalid timestamp: " + timestamp ) ; } else if ( start_time != UNSET && timestamp <= getStartTime ( ) ) { throw new IllegalArgumentException ( "new end time (" + timestamp + ") is l... |
public class UnsupportedAvailabilityZoneException { /** * The supported Availability Zones for your account . Choose subnets in these Availability Zones for your cluster .
* @ param validZones
* The supported Availability Zones for your account . Choose subnets in these Availability Zones for your
* cluster . */
... | if ( validZones == null ) { this . validZones = null ; return ; } this . validZones = new java . util . ArrayList < String > ( validZones ) ; |
public class TableBodyBox { /** * Calculates new cell positions regarding the rowspans */
private void calcOffsets ( ) { } } | // Find the longest line
int rowidx [ ] = new int [ rows . size ( ) ] ; int maxCells = 0 ; for ( int r = 0 ; r < rows . size ( ) ; r ++ ) { int count = rows . elementAt ( r ) . getCellCount ( ) ; if ( count > maxCells ) maxCells = count ; rowidx [ r ] = 0 ; rows . elementAt ( r ) . rewind ( ) ; } // determine the cell ... |
public class BasicBinder { /** * Register an UnMarshaller with the given source and target class .
* The unmarshaller is used as follows : Instances of the source can be marshalled into the target class .
* @ param key Converter Key to use
* @ param converter The FromUnmarshaller to be registered */
public final ... | registerConverter ( key . invert ( ) , new FromUnmarshallerConverter < S , T > ( converter ) ) ; |
public class OptionsBuilder { /** * Adds to the excluded option
* @ param excludes
* List of excluded paths
* @ return updated OptionBuilder instance
* @ see Options # EXCLUDES */
public OptionsBuilder excludes ( String ... excludes ) { } } | return excludes != null ? excludes ( Arrays . asList ( excludes ) ) : this ; |
public class LogSubscriptionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( LogSubscription logSubscription , ProtocolMarshaller protocolMarshaller ) { } } | if ( logSubscription == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( logSubscription . getDirectoryId ( ) , DIRECTORYID_BINDING ) ; protocolMarshaller . marshall ( logSubscription . getLogGroupName ( ) , LOGGROUPNAME_BINDING ) ; protocolM... |
public class RelationalOperations { /** * multipathB . */
private static boolean linearPathOverlapsLinearPath_ ( MultiPath multipathA , MultiPath multipathB , double tolerance ) { } } | int dim = linearPathIntersectsLinearPathMaxDim_ ( multipathA , multipathB , tolerance , null ) ; if ( dim < 1 ) return false ; Envelope2D env_a = new Envelope2D ( ) , env_b = new Envelope2D ( ) ; multipathA . queryEnvelope2D ( env_a ) ; multipathB . queryEnvelope2D ( env_b ) ; boolean bIntAExtB = interiorEnvExteriorEnv... |
public class ConsistentKeyLocker { /** * Try to write a lock record remotely up to the configured number of
* times . If the store produces
* { @ link TemporaryLockingException } , then we ' ll call mutate again to add a
* new column with an updated timestamp and to delete the column that tried
* to write when ... | final StaticBuffer lockKey = serializer . toLockKey ( lockID . getKey ( ) , lockID . getColumn ( ) ) ; StaticBuffer oldLockCol = null ; for ( int i = 0 ; i < lockRetryCount ; i ++ ) { WriteResult wr = tryWriteLockOnce ( lockKey , oldLockCol , txh ) ; if ( wr . isSuccessful ( ) && wr . getDuration ( ) . compareTo ( lock... |
public class SheepdogRedundancy { @ Nonnull public static SheepdogRedundancy full ( @ Nonnull SheepdogRedundancyFull full ) { } } | SheepdogRedundancy self = new SheepdogRedundancy ( ) ; self . type = SheepdogRedundancyType . full ; self . full = full ; return self ; |
public class PipelineBuilder { /** * Creates a pull processor .
* The API server is started by this method .
* The returned pull processor is thread - safe .
* Note that the history will not be used .
* @ return A PullMetricRegistryInstance that performs a scrape and evaluates rules .
* @ throws Exception ind... | ApiServer api = null ; PullMetricRegistryInstance registry = null ; try { final EndpointRegistration epr ; if ( epr_ == null ) epr = api = new ApiServer ( api_sockaddr_ ) ; else epr = epr_ ; registry = cfg_ . create ( PullMetricRegistryInstance :: new , epr ) ; if ( api != null ) api . start ( ) ; return new PullProces... |
public class PromiseSampleService { /** * these methods are identical . . . */
public IPromise < String > getDataSimple ( ) { } } | Promise result = new Promise ( ) ; result . complete ( "Data" , null ) ; return result ; |
public class PathHelper { /** * Return part of the given path before the last separator or the root path ( " / " ) if no separator was found
* @ param path
* @ return name */
public static String getFolderPath ( final String path ) { } } | String cleanedPath = clean ( path ) ; if ( cleanedPath != null && cleanedPath . contains ( PATH_SEP ) ) { return PATH_SEP + StringUtils . substringBeforeLast ( cleanedPath , PATH_SEP ) ; } else { return PATH_SEP ; } |
public class CmsNullIgnoringConcurrentMap { /** * Sets the given map value for the given key , unless either of them is null . < p >
* If the value is null ,
* @ param key the key
* @ param value the value
* @ return the old value
* @ see java . util . Map # put ( java . lang . Object , java . lang . Object )... | if ( ( key != null ) && ( value != null ) ) { return m_internalMap . put ( key , value ) ; } Exception e = new Exception ( ) ; try { // we want to print a stack trace when null is used as a key / value
throw e ; } catch ( Exception e2 ) { e = e2 ; } if ( key == null ) { LOG . warn ( "Invalid null key in map" , e ) ; re... |
public class cacheobject { /** * Use this API to save cacheobject resources . */
public static base_responses save ( nitro_service client , cacheobject resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { cacheobject saveresources [ ] = new cacheobject [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { saveresources [ i ] = new cacheobject ( ) ; saveresources [ i ] . locator = resources [ i ] . locator ; } resul... |
public class DeleteMembersRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteMembersRequest deleteMembersRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteMembersRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteMembersRequest . getAccountIds ( ) , ACCOUNTIDS_BINDING ) ; protocolMarshaller . marshall ( deleteMembersRequest . getDetectorId ( ) , DETECTORID_BINDING ) ; ... |
public class KickflipApiClient { /** * Get public user info
* @ param username The Kickflip user ' s username
* @ param cb This callback will receive a User in { @ link io . kickflip . sdk . api . KickflipCallback # onSuccess ( io . kickflip . sdk . api . json . Response ) }
* or an Exception { @ link io . kickfl... | if ( ! assertActiveUserAvailable ( cb ) ) return ; GenericData data = new GenericData ( ) ; data . put ( "username" , username ) ; post ( GET_USER_PUBLIC , new UrlEncodedContent ( data ) , User . class , new KickflipCallback ( ) { @ Override public void onSuccess ( final Response response ) { if ( VERBOSE ) Log . i ( T... |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcShellBasedSurfaceModel ( ) { } } | if ( ifcShellBasedSurfaceModelEClass == null ) { ifcShellBasedSurfaceModelEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 513 ) ; } return ifcShellBasedSurfaceModelEClass ; |
public class HibernateUpdateClause { /** * Set the lock mode for the given path .
* @ return the current object */
@ SuppressWarnings ( "unchecked" ) public HibernateUpdateClause setLockMode ( Path < ? > path , LockMode lockMode ) { } } | lockModes . put ( path , lockMode ) ; return this ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getIfcDerivedUnitEnum ( ) { } } | if ( ifcDerivedUnitEnumEEnum == null ) { ifcDerivedUnitEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 809 ) ; } return ifcDerivedUnitEnumEEnum ; |
public class JSONObject { /** * Sets a property on the target bean . < br >
* Bean may be a Map or a POJO . */
private static void setProperty ( Object bean , String key , Object value , JsonConfig jsonConfig ) throws Exception { } } | PropertySetStrategy propertySetStrategy = jsonConfig . getPropertySetStrategy ( ) != null ? jsonConfig . getPropertySetStrategy ( ) : PropertySetStrategy . DEFAULT ; propertySetStrategy . setProperty ( bean , key , value , jsonConfig ) ; |
public class HttpRequestManager { /** * Handles request synchronously */
void dispatchRequest ( final HttpRequest request ) { } } | networkQueue . dispatchAsync ( new DispatchTask ( ) { @ Override protected void execute ( ) { request . dispatchSync ( networkQueue ) ; } } ) ; |
public class DescribeSpotPriceHistoryRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < DescribeSpotPriceHistoryRequest > getDryRunRequest ( ) { } } | Request < DescribeSpotPriceHistoryRequest > request = new DescribeSpotPriceHistoryRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class CmsADECache { /** * Caches the given group container under the given key and for the given project . < p >
* @ param key the cache key
* @ param groupContainer the object to cache
* @ param online if to cache in online or offline project */
public void setCacheGroupContainer ( String key , CmsXmlGrou... | try { m_lock . writeLock ( ) . lock ( ) ; if ( online ) { m_groupContainersOnline . put ( key , groupContainer ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_DEBUG_CACHE_SET_ONLINE_2 , new Object [ ] { key , groupContainer } ) ) ; } } else { m_groupContaine... |
public class SiteSwitcherHandlerInterceptor { /** * Creates a site switcher that redirects to a custom domain for normal site requests that either
* originate from a mobile device or indicate a mobile site preference .
* Uses a { @ link CookieSitePreferenceRepository } that saves a cookie that is shared between the... | return new SiteSwitcherHandlerInterceptor ( StandardSiteSwitcherHandlerFactory . standard ( normalServerName , mobileServerName , cookieDomain ) ) ; |
public class DebugViewActivity { /** * 20 MB */
private static OkHttpClient . Builder createOkHttpClientBuilder ( Application app ) { } } | // Install an HTTP cache in the application cache directory .
File cacheDir = new File ( app . getCacheDir ( ) , "okhttp3" ) ; Cache cache = new Cache ( cacheDir , DISK_CACHE_SIZE ) ; return new OkHttpClient . Builder ( ) . cache ( cache ) . addInterceptor ( LogsModule . chuckInterceptor ( app ) ) . addInterceptor ( Ne... |
public class Crossing { /** * Returns how many times ray from point ( x , y ) cross quard curve */
public static int crossQuad ( float x1 , float y1 , float cx , float cy , float x2 , float y2 , float x , float y ) { } } | // LEFT / RIGHT / UP / EMPTY
if ( ( x < x1 && x < cx && x < x2 ) || ( x > x1 && x > cx && x > x2 ) || ( y > y1 && y > cy && y > y2 ) || ( x1 == cx && cx == x2 ) ) { return 0 ; } // DOWN
if ( y < y1 && y < cy && y < y2 && x != x1 && x != x2 ) { if ( x1 < x2 ) { return x1 < x && x < x2 ? 1 : 0 ; } return x2 < x && x < x1... |
public class Transformers { /** * Buffers the source { @ link Flowable } into { @ link List } s , emitting Lists when
* the size of a list reaches { @ code maxSize } or if the elapsed time since last
* emission from the source reaches the given duration .
* { @ link Schedulers # computation } is used for scheduli... | return buffer ( maxSize , Functions . constant ( duration ) , unit ) ; |
public class ForwardingClient { /** * Stop all remote forwarding .
* @ param killActiveTunnels
* Should any active tunnels be closed .
* @ throws SshException */
public synchronized void cancelAllRemoteForwarding ( boolean killActiveTunnels ) throws SshException { } } | if ( remoteforwardings == null ) { return ; } for ( Enumeration < String > e = remoteforwardings . keys ( ) ; e . hasMoreElements ( ) ; ) { String host = ( String ) e . nextElement ( ) ; if ( host == null ) return ; try { int idx = host . indexOf ( ':' ) ; int port = - 1 ; if ( idx == - 1 ) { port = Integer . parseInt ... |
public class SqlAgentImpl { /** * { @ inheritDoc }
* @ see jp . co . future . uroborosql . SqlAgent # insert ( Object ) */
@ SuppressWarnings ( "unchecked" ) @ Override public int insert ( final Object entity ) { } } | @ SuppressWarnings ( "rawtypes" ) EntityHandler handler = this . getEntityHandler ( ) ; if ( ! handler . getEntityType ( ) . isInstance ( entity ) ) { throw new IllegalArgumentException ( "Entity type not supported" ) ; } try { Class < ? > type = entity . getClass ( ) ; TableMetadata metadata = handler . getMetadata ( ... |
public class FastaReader { /** * Return next FASTA record or { @ literal null } if end of stream is reached .
* < p > This method is thread - safe . < / p >
* @ return next FASTA record or { @ literal null } if end of stream is reached */
public FastaRecord < S > take ( ) { } } | RawFastaRecord rawRecord = takeRawRecord ( ) ; // On EOF
if ( rawRecord == null ) return null ; return new FastaRecord < > ( id ++ , rawRecord . description , alphabet . parse ( rawRecord . sequence ) ) ; |
public class TeasyExpectedConditions { /** * Expected condition to look for elements in frames that will return as soon as elements are found in any frame
* @ param locator
* @ return */
public static ExpectedCondition < List < WebElement > > visibilityOfFirstElements ( final By locator ) { } } | return new ExpectedCondition < List < WebElement > > ( ) { @ Override public List < WebElement > apply ( final WebDriver driver ) { return getFirstVisibleWebElements ( driver , null , locator ) ; } @ Override public String toString ( ) { return String . format ( "visibility of element located by %s" , locator ) ; } } ; |
public class JdbcTable { /** * Rename this table
* @ param tableName
* @ param newTableName
* @ return */
public boolean renameTable ( String tableName , String newTableName ) throws DBException { } } | try { if ( DBConstants . TRUE . equals ( ( String ) this . getDatabase ( ) . getProperties ( ) . get ( SQLParams . NO_PREPARED_STATEMENTS_ON_CREATE ) ) ) this . setStatement ( null , DBConstants . SQL_CREATE_TYPE ) ; if ( this . getStatement ( DBConstants . SQL_CREATE_TYPE ) == null ) this . setStatement ( ( ( JdbcData... |
public class CrawlerPack { /** * 取得遠端格式為 HTML / Html5 的資料
* @ param uri required Apache Common VFS supported file systems and response HTML format content .
* @ return org . jsoup . nodes . Document */
public org . jsoup . nodes . Document getFromHtml ( String uri ) { } } | // 取回資料
String html = getFromRemote ( uri ) ; // 轉化為 Jsoup 物件
return htmlToJsoupDoc ( html ) ; |
public class JCRAssert { /** * Asserts the primary node type of the node
* @ param node
* the node whose primary node type should be checked
* @ param nodeType
* the nodetype that is asserted to be the node type of the node
* @ throws RepositoryException */
public static void assertPrimaryNodeType ( final Nod... | final NodeType primaryNodeType = node . getPrimaryNodeType ( ) ; assertEquals ( nodeType , primaryNodeType . getName ( ) ) ; |
public class CommerceOrderNoteUtil { /** * Returns the commerce order note with the primary key or throws a { @ link NoSuchOrderNoteException } if it could not be found .
* @ param commerceOrderNoteId the primary key of the commerce order note
* @ return the commerce order note
* @ throws NoSuchOrderNoteException... | return getPersistence ( ) . findByPrimaryKey ( commerceOrderNoteId ) ; |
public class LocalizationActivityDelegate { /** * Provide method to set application language by country name . */
public final void setLanguage ( Context context , String language ) { } } | Locale locale = new Locale ( language ) ; setLanguage ( context , locale ) ; |
public class HttpClient { /** * returns the inputstream from URLConnection
* @ return InputStream */
public InputStream getInputStream ( ) { } } | try { int responseCode = this . urlConnection . getResponseCode ( ) ; try { // HACK : manually follow redirects , for the login to work
// HTTPUrlConnection auto redirect doesn ' t respect the provided headers
if ( responseCode == 302 ) { HttpClient redirectClient = new HttpClient ( proxyHost , proxyPort , urlConnectio... |
public class PortForward { /** * PortForward to a container .
* @ param namespace The namespace of the Pod
* @ param name The name of the Pod
* @ param ports The ports to forward
* @ return The result of the Port Forward request . */
public PortForwardResult forward ( String namespace , String name , List < Int... | String path = makePath ( namespace , name ) ; WebSocketStreamHandler handler = new WebSocketStreamHandler ( ) ; PortForwardResult result = new PortForwardResult ( handler , ports ) ; List < Pair > queryParams = new ArrayList < > ( ) ; for ( Integer port : ports ) { queryParams . add ( new Pair ( "ports" , port . toStri... |
public class AsynchConsumer { /** * Register the AsynchConsumerCallback . If callback is null then
* this is the equivalent of deregister , i . e . callbackRegistered
* is set to false .
* @ param callback */
void registerCallback ( AsynchConsumerCallback callback ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "registerCallback" , callback ) ; asynchConsumerCallback = callback ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "registerCallback" ) ; |
public class PersonGroupPersonsImpl { /** * Update a person persisted face ' s userData field .
* @ param personGroupId Id referencing a particular person group .
* @ param personId Id referencing a particular person .
* @ param persistedFaceId Id referencing a particular persistedFaceId of an existing face .
*... | return updateFaceWithServiceResponseAsync ( personGroupId , personId , persistedFaceId , updateFaceOptionalParameter ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class NumberGenerator { /** * Returns for given parameter < i > _ name < / i > the instance of class
* { @ link Type } .
* @ param _ name name of the type to get
* @ return instance of class { @ link Type }
* @ throws CacheReloadException on error */
public static NumberGenerator get ( final String _name... | final Cache < String , NumberGenerator > cache = InfinispanCache . get ( ) . < String , NumberGenerator > getCache ( NumberGenerator . NAMECACHE ) ; if ( ! cache . containsKey ( _name ) ) { NumberGenerator . getNumberGeneratorFromDB ( NumberGenerator . SQL_NAME , _name ) ; } return cache . get ( _name ) ; |
public class SwingGroovyMethods { /** * Overloads the left shift operator to provide an easy way to add
* components to a popupMenu . < p >
* @ param self a JPopupMenu
* @ param component a component to be added to the popupMenu .
* @ return same popupMenu , after the value was added to it .
* @ since 1.6.4 *... | self . add ( component ) ; return self ; |
public class DataFrameJoiner { /** * Joins the joiner to the table2 , using the given column for the second table and returns the resulting table
* @ param table2 The table to join with
* @ param col2Name The column to join on . If col2Name refers to a double column , the join is performed after
* rounding to int... | return inner ( table2 , false , col2Name ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.