signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ManagedObject { /** * Driven when the object is locked within a transaction .
* This is an intent lock , indicating an intention to update the object .
* The lock is lifted after commit or backout of the transaction .
* @ param newTransactionLock being associated with this ManagedObject .
* @ throws ObjectManagerException */
protected void lock ( TransactionLock newTransactionLock ) throws ObjectManagerException { } } | final String methodName = "lock" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , newTransactionLock ) ; // Already locked to the requesting Transaction ?
while ( transactionLock != newTransactionLock ) { synchronized ( this ) { if ( ! transactionLock . isLocked ( ) ) { setState ( nextStateForLock ) ; // Make the state change .
// Not yet part of a transaction .
transactionLock = newTransactionLock ; // Create the before immage .
try { // TODO Don ' t realy need this if we are stateAdded
beforeImmage = ( ManagedObject ) this . clone ( ) ; } catch ( java . lang . CloneNotSupportedException exception ) { // No FFDC Code Needed .
ObjectManager . ffdc . processException ( this , cclass , "lock" , exception , "1:807:1.34" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , exception ) ; throw new UnexpectedExceptionException ( this , exception ) ; } // catch CloneNotSupportedException .
} else if ( transactionLock == newTransactionLock ) { // Do nothing another thread got the lock after we passed the while ( ) above
// but before we hit the synchronized block .
} else { // Already part of another transaction .
// throw new AlreadyLockedException ( this
threadsWaitingForLock ++ ; // Count the waiting threads .
try { if ( Tracing . isAnyTracingEnabled ( ) && trace . isDebugEnabled ( ) ) trace . debug ( this , cclass , methodName , new Object [ ] { "About to wait()" , transactionLock . getLockingTransaction ( ) , new Integer ( threadsWaitingForLock ) } ) ; wait ( ) ; } catch ( InterruptedException exception ) { // No FFDC Code Needed .
ObjectManager . ffdc . processException ( this , cclass , "lock" , exception , "1:829:1.34" ) ; threadsWaitingForLock -- ; // Count the waiting threads .
// Just bail out without taking the lock .
if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , exception ) ; throw new UnexpectedExceptionException ( this , exception ) ; } // catch ( InterruptedException . . .
threadsWaitingForLock -- ; // Count the waiting threads .
} // if ( transactionLock = = null . . .
} // synchronized ( this ) .
} // while ( lockingTransaction ! = internalTransaction ) .
numberOfLocksTaken ++ ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; |
public class DevicesInner { /** * Creates or updates a Data Box Edge / Gateway resource .
* @ param deviceName The device name .
* @ param resourceGroupName The resource group name .
* @ param dataBoxEdgeDevice The resource object .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < DataBoxEdgeDeviceInner > createOrUpdateAsync ( String deviceName , String resourceGroupName , DataBoxEdgeDeviceInner dataBoxEdgeDevice ) { } } | return createOrUpdateWithServiceResponseAsync ( deviceName , resourceGroupName , dataBoxEdgeDevice ) . map ( new Func1 < ServiceResponse < DataBoxEdgeDeviceInner > , DataBoxEdgeDeviceInner > ( ) { @ Override public DataBoxEdgeDeviceInner call ( ServiceResponse < DataBoxEdgeDeviceInner > response ) { return response . body ( ) ; } } ) ; |
public class AbstractJSPExtensionProcessor { /** * PM10362 Start */
protected boolean isValidFilePath ( String filePath ) { } } | if ( filePath == null ) return false ; int len = filePath . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( filePath . charAt ( i ) < ' ' ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "isValidFilePath" , " invalid char in filePath --> [" + filePath + "]" ) ; return false ; } } return true ; |
public class ColumnMetadata { /** * Extract the column name for the given path , returns the path name , if no ColumnMetadata is attached
* @ param path patch
* @ return column name or path name */
public static String getName ( Path < ? > path ) { } } | Path < ? > parent = path . getMetadata ( ) . getParent ( ) ; if ( parent instanceof EntityPath ) { Object columnMetadata = ( ( EntityPath < ? > ) parent ) . getMetadata ( path ) ; if ( columnMetadata instanceof ColumnMetadata ) { return ( ( ColumnMetadata ) columnMetadata ) . getName ( ) ; } } return path . getMetadata ( ) . getName ( ) ; |
public class MessageBuilder { /** * Adds an attachment to the message .
* @ param image The image to add as an attachment .
* @ param fileName The file name of the image .
* @ return The current instance in order to chain call methods . */
public MessageBuilder addAttachment ( BufferedImage image , String fileName ) { } } | delegate . addAttachment ( image , fileName ) ; return this ; |
public class RestServiceExceptionFacade { /** * Create a response message as a JSON - String from the given parts .
* @ param status is the HTTP { @ link Status } .
* @ param error is the catched or wrapped { @ link NlsRuntimeException } .
* @ param errorsMap is a map with all validation errors
* @ return the corresponding { @ link Response } . */
protected Response createResponse ( Status status , NlsRuntimeException error , Map < String , List < String > > errorsMap ) { } } | String message ; if ( this . exposeInternalErrorDetails ) { message = getExposedErrorDetails ( error ) ; } else { message = error . getLocalizedMessage ( ) ; } return createResponse ( status , error , message , errorsMap ) ; |
public class ImplSurfDescribeOps { /** * Simple algorithm for computing the gradient of a region . Can handle image borders */
public static < T extends ImageGray < T > > void naiveGradient ( T ii , double tl_x , double tl_y , double samplePeriod , int regionSize , double kernelSize , boolean useHaar , double [ ] derivX , double derivY [ ] ) { } } | SparseScaleGradient < T , ? > gg = SurfDescribeOps . createGradient ( useHaar , ( Class < T > ) ii . getClass ( ) ) ; gg . setWidth ( kernelSize ) ; gg . setImage ( ii ) ; SparseGradientSafe g = new SparseGradientSafe ( gg ) ; // add 0.5 to c _ x and c _ y to have it round when converted to an integer pixel
// this is faster than the straight forward method
tl_x += 0.5 ; tl_y += 0.5 ; int i = 0 ; for ( int y = 0 ; y < regionSize ; y ++ ) { for ( int x = 0 ; x < regionSize ; x ++ , i ++ ) { int xx = ( int ) ( tl_x + x * samplePeriod ) ; int yy = ( int ) ( tl_y + y * samplePeriod ) ; GradientValue deriv = g . compute ( xx , yy ) ; derivX [ i ] = deriv . getX ( ) ; derivY [ i ] = deriv . getY ( ) ; // System . out . printf ( " % 2d % 2d % 2d % 2d dx = % 6.2f dy = % 6.2f \ n " , x , y , xx , yy , derivX [ i ] , derivY [ i ] ) ;
} } |
public class ParticipantReader { /** * Make the request to the Twilio API to perform the read .
* @ param client TwilioRestClient with which to make the request
* @ return Participant ResourceSet */
@ Override public ResourceSet < Participant > read ( final TwilioRestClient client ) { } } | return new ResourceSet < > ( this , client , firstPage ( client ) ) ; |
public class EDBConverter { /** * Returns the entry name for a map key in the EDB format . E . g . the map key for the property " map " with the index 0
* would be " map . 0 . key " . */
public static String getEntryNameForMapKey ( String property , Integer index ) { } } | return getEntryNameForMap ( property , true , index ) ; |
public class ZookeeperMgr { /** * Zoo的新建目录
* @ param dir */
public void makeDir ( String dir , String data ) { } } | try { boolean deafult_path_exist = store . exists ( dir ) ; if ( ! deafult_path_exist ) { LOGGER . info ( "create: " + dir ) ; this . writePersistentUrl ( dir , data ) ; } else { } } catch ( KeeperException e ) { LOGGER . error ( "cannot create path: " + dir , e ) ; } catch ( Exception e ) { LOGGER . error ( "cannot create path: " + dir , e ) ; } |
public class Utility { /** * Format a String for representation in a source file . This includes
* breaking it into lines and escaping characters using octal notation
* when necessary ( control characters and double quotes ) . */
static public final String formatForSource ( String s ) { } } | StringBuilder buffer = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; ) { if ( i > 0 ) buffer . append ( '+' ) . append ( LINE_SEPARATOR ) ; buffer . append ( " \"" ) ; int count = 11 ; while ( i < s . length ( ) && count < 80 ) { char c = s . charAt ( i ++ ) ; if ( c < '\u0020' || c == '"' || c == '\\' ) { if ( c == '\n' ) { buffer . append ( "\\n" ) ; count += 2 ; } else if ( c == '\t' ) { buffer . append ( "\\t" ) ; count += 2 ; } else if ( c == '\r' ) { buffer . append ( "\\r" ) ; count += 2 ; } else { // Represent control characters , backslash and double quote
// using octal notation ; otherwise the string we form
// won ' t compile , since Unicode escape sequences are
// processed before tokenization .
buffer . append ( '\\' ) ; buffer . append ( HEX_DIGIT [ ( c & 0700 ) >> 6 ] ) ; // HEX _ DIGIT works for octal
buffer . append ( HEX_DIGIT [ ( c & 0070 ) >> 3 ] ) ; buffer . append ( HEX_DIGIT [ ( c & 0007 ) ] ) ; count += 4 ; } } else if ( c <= '\u007E' ) { buffer . append ( c ) ; count += 1 ; } else { buffer . append ( "\\u" ) ; buffer . append ( HEX_DIGIT [ ( c & 0xF000 ) >> 12 ] ) ; buffer . append ( HEX_DIGIT [ ( c & 0x0F00 ) >> 8 ] ) ; buffer . append ( HEX_DIGIT [ ( c & 0x00F0 ) >> 4 ] ) ; buffer . append ( HEX_DIGIT [ ( c & 0x000F ) ] ) ; count += 6 ; } } buffer . append ( '"' ) ; } return buffer . toString ( ) ; |
public class Controller { /** * Redirects to referrer if one exists . If a referrer does not exist , it will be redirected to
* the < code > defaultReference < / code > .
* @ param defaultReference where to redirect - can be absolute or relative ; this will be used in case
* the request does not provide a " Referrer " header .
* @ return { @ link HttpSupport . HttpBuilder } , to accept additional information . */
protected void redirectToReferrer ( String defaultReference ) { } } | String referrer = context . requestHeader ( "Referer" ) ; referrer = referrer == null ? defaultReference : referrer ; redirect ( referrer ) ; |
public class SingleTaskDataPublisher { /** * Get an instance of { @ link SingleTaskDataPublisher } .
* @ param dataPublisherClass A concrete class that extends { @ link SingleTaskDataPublisher } .
* @ param state A { @ link State } used to instantiate the { @ link SingleTaskDataPublisher } .
* @ return A { @ link SingleTaskDataPublisher } instance .
* @ throws ReflectiveOperationException */
public static SingleTaskDataPublisher getInstance ( Class < ? extends DataPublisher > dataPublisherClass , State state ) throws ReflectiveOperationException { } } | Preconditions . checkArgument ( SingleTaskDataPublisher . class . isAssignableFrom ( dataPublisherClass ) , String . format ( "Cannot instantiate %s since it does not extend %s" , dataPublisherClass . getSimpleName ( ) , SingleTaskDataPublisher . class . getSimpleName ( ) ) ) ; return ( SingleTaskDataPublisher ) DataPublisher . getInstance ( dataPublisherClass , state ) ; |
public class TokenStream { /** * Attempt to consume this current token as the next tokens as long as they match the expected values , or throw an exception
* if the token does not match .
* The { @ link # ANY _ VALUE ANY _ VALUE } constant can be used in the expected values as a wildcard .
* @ param expected the expected value of the current token
* @ param expectedForNextTokens the expected values fo the following tokens
* @ throws ParsingException if the current token doesn ' t match the supplied value
* @ throws IllegalStateException if this method was called before the stream was { @ link # start ( ) started } */
public void consume ( String expected , String ... expectedForNextTokens ) throws ParsingException , IllegalStateException { } } | consume ( expected ) ; for ( String nextExpected : expectedForNextTokens ) { consume ( nextExpected ) ; } |
public class CurrencyUnitDataProvider { /** * Registers a currency allowing it to be used .
* This method is called by { @ link # registerCurrencies ( ) } to perform the
* actual creation of a currency .
* @ param currencyCode the currency code , not null
* @ param numericCurrencyCode the numeric currency code , - 1 if none
* @ param decimalPlaces the number of decimal places that the currency
* normally has , from 0 to 3 , or - 1 for a pseudo - currency */
protected final void registerCurrency ( String currencyCode , int numericCurrencyCode , int decimalPlaces ) { } } | CurrencyUnit . registerCurrency ( currencyCode , numericCurrencyCode , decimalPlaces , true ) ; |
public class HiveJsonSerDe { /** * Indicates how you want Kinesis Data Firehose to parse the date and timestamps that may be present in your input
* data JSON . To specify these format strings , follow the pattern syntax of JodaTime ' s DateTimeFormat format
* strings . For more information , see < a
* href = " https : / / www . joda . org / joda - time / apidocs / org / joda / time / format / DateTimeFormat . html " > Class DateTimeFormat < / a > .
* You can also use the special value < code > millis < / code > to parse timestamps in epoch milliseconds . If you don ' t
* specify a format , Kinesis Data Firehose uses < code > java . sql . Timestamp : : valueOf < / code > by default .
* @ param timestampFormats
* Indicates how you want Kinesis Data Firehose to parse the date and timestamps that may be present in your
* input data JSON . To specify these format strings , follow the pattern syntax of JodaTime ' s DateTimeFormat
* format strings . For more information , see < a
* href = " https : / / www . joda . org / joda - time / apidocs / org / joda / time / format / DateTimeFormat . html " > Class
* DateTimeFormat < / a > . You can also use the special value < code > millis < / code > to parse timestamps in epoch
* milliseconds . If you don ' t specify a format , Kinesis Data Firehose uses
* < code > java . sql . Timestamp : : valueOf < / code > by default . */
public void setTimestampFormats ( java . util . Collection < String > timestampFormats ) { } } | if ( timestampFormats == null ) { this . timestampFormats = null ; return ; } this . timestampFormats = new java . util . ArrayList < String > ( timestampFormats ) ; |
public class Collector { /** * Deallocate the handlers before removing the specified sources from the TaskMap
* @ param sourcesToUnsubscribe The list of sources we have unsubscribed from and await final deallocation */
private void deconfigure ( List < String > sourcesToUnsubscribe ) { } } | for ( String sourceName : sourcesToUnsubscribe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Task deConfig " + this , sourceName ) ; } taskMap . get ( sourceName ) . setHandlerName ( null ) ; // taskMap . get ( sourceName ) . setConfig ( null ) ;
taskMap . remove ( sourceName ) ; } |
public class EmojiParser { /** * Removes a set of emojis from a String
* @ param str the string to process
* @ param emojisToRemove the emojis to remove from this string
* @ return the string without the emojis that were removed */
public static String removeEmojis ( String str , final Collection < Emoji > emojisToRemove ) { } } | EmojiTransformer emojiTransformer = new EmojiTransformer ( ) { public String transform ( UnicodeCandidate unicodeCandidate ) { if ( ! emojisToRemove . contains ( unicodeCandidate . getEmoji ( ) ) ) { return unicodeCandidate . getEmoji ( ) . getUnicode ( ) + unicodeCandidate . getFitzpatrickUnicode ( ) ; } return "" ; } } ; return parseFromUnicode ( str , emojiTransformer ) ; |
public class TechnologyTargeting { /** * Sets the mobileDeviceTargeting value for this TechnologyTargeting .
* @ param mobileDeviceTargeting * The mobile devices being targeted by the { @ link LineItem } . */
public void setMobileDeviceTargeting ( com . google . api . ads . admanager . axis . v201805 . MobileDeviceTargeting mobileDeviceTargeting ) { } } | this . mobileDeviceTargeting = mobileDeviceTargeting ; |
public class MemoryLogTensorAllocation { /** * < pre >
* Allocated tensor details .
* < / pre >
* < code > optional . tensorflow . TensorDescription tensor = 3 ; < / code > */
public org . tensorflow . framework . TensorDescription getTensor ( ) { } } | return tensor_ == null ? org . tensorflow . framework . TensorDescription . getDefaultInstance ( ) : tensor_ ; |
public class Cache { /** * Clear all entries ( if anything exists ) for the given hostname and return { @ code true } if anything was removed . */
final boolean clear ( String hostname ) { } } | Entries entries = resolveCache . remove ( hostname ) ; return entries != null && entries . clearAndCancel ( ) ; |
public class AbstractMaterialDialogBuilder { /** * Obtains the scrollable area from a specific theme .
* @ param themeResourceId
* The resource id of the theme , the scrollable area should be obtained from , as an
* { @ link Integer } value */
private void obtainScrollableArea ( @ StyleRes final int themeResourceId ) { } } | TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogScrollableAreaTop , R . attr . materialDialogScrollableAreaBottom } ) ; int topIndex = typedArray . getInt ( 0 , - 1 ) ; int bottomIndex = typedArray . getInt ( 1 , - 1 ) ; if ( topIndex != - 1 ) { Area top = Area . fromIndex ( topIndex ) ; if ( bottomIndex != - 1 ) { Area bottom = Area . fromIndex ( bottomIndex ) ; setScrollableArea ( top , bottom ) ; } else { setScrollableArea ( top ) ; } } else { setScrollableArea ( null , null ) ; } |
public class HylaFaxClientSpi { /** * Creates and returns the hylafax client connection factory .
* @ param className
* The connection factory class name
* @ return The hylafax client connection factory */
protected final HylaFAXClientConnectionFactory createHylaFAXClientConnectionFactory ( String className ) { } } | // create new instance
HylaFAXClientConnectionFactory factory = ( HylaFAXClientConnectionFactory ) ReflectionHelper . createInstance ( className ) ; // initialize
factory . initialize ( this ) ; return factory ; |
public class ReverseSubsequenceMove { /** * Reverse the subsequence by performing a series of swaps in the given permutation solution .
* @ param solution permutation solution to which the move is to be applied */
@ Override public void apply ( PermutationSolution solution ) { } } | int start = from ; int stop = to ; int n = solution . size ( ) ; // reverse subsequence by performing a series of swaps
// ( works cyclically when start > stop )
int reversedLength ; if ( start < stop ) { reversedLength = stop - start + 1 ; } else { reversedLength = n - ( start - stop - 1 ) ; } int numSwaps = reversedLength / 2 ; for ( int k = 0 ; k < numSwaps ; k ++ ) { solution . swap ( start , stop ) ; start = ( start + 1 ) % n ; stop = ( stop - 1 + n ) % n ; } |
public class ViewMover { /** * Checks whether there is enough space left to move the view horizontally within
* its parent container
* Calls { @ link # calculateEndLeftBound ( float ) } and { @ link # calculateEndRightBound ( float ) }
* to calculate the resulting X coordinate of the view ' s left and right bounds
* @ param xAxisDelta X - axis delta in actual pixels
* @ return true if there is enough space to move the view horizontally , otherwise false */
private boolean hasHorizontalSpaceToMove ( float xAxisDelta ) { } } | int parentWidth = getParentView ( ) . getWidth ( ) ; LOGGER . trace ( "Parent view width is: {}" , parentWidth ) ; int endLeftBound = calculateEndLeftBound ( xAxisDelta ) ; int endRightBound = calculateEndRightBound ( xAxisDelta ) ; LOGGER . trace ( "Calculated end bounds: left = {}, right = {}" , endLeftBound , endRightBound ) ; return endLeftBound >= 0 && endRightBound <= parentWidth ; |
public class Para { /** * Creates the root application and returns the credentials for it .
* @ return credentials for the root app */
public static Map < String , String > setup ( ) { } } | return newApp ( Config . getRootAppIdentifier ( ) , Config . APP_NAME , false , false ) ; |
public class XData { /** * stores a datanode in a xdata file using the given marshallers . For all classes other
* than these a special marshaller is required to map the class ' data to a data node
* deSerializedObject :
* < ul >
* < li > Boolean < / li >
* < li > Long < / li >
* < li > Integer < / li >
* < li > String < / li >
* < li > Float < / li >
* < li > Double < / li >
* < li > Byte < / li >
* < li > Short < / li >
* < li > Character < / li >
* < li > DataNode < / li >
* < li > List & lt ; ? & gt ; < / li >
* < / ul >
* Also take a look at { @ link com . moebiusgames . xdata . marshaller } . There are a bunch of
* standard marshallers that ARE INCLUDED by default . So you don ' t need to add them here
* to work .
* @ param node
* @ param out
* @ param addChecksum if this is true then a sha - 256 checksum is added at the end of this xdata stream
* @ param ignoreMissingMarshallers if this is set to true then classes that can ' t be marshalled are
* silently replaced with null values
* @ param progressListener
* @ param marshallers
* @ throws IOException */
public static void store ( DataNode node , OutputStream out , boolean addChecksum , boolean ignoreMissingMarshallers , ProgressListener progressListener , AbstractDataMarshaller < ? > ... marshallers ) throws IOException { } } | final Map < String , AbstractDataMarshaller < ? > > marshallerMap = generateMarshallerMap ( true , Arrays . asList ( marshallers ) ) ; marshallerMap . putAll ( generateMarshallerMap ( true , DEFAULT_MARSHALLERS ) ) ; GZIPOutputStream gzipOutputStream = null ; try { gzipOutputStream = new GZIPOutputStream ( out ) ; OutputStream outputStream = gzipOutputStream ; MessageDigestOutputStream messageDigestOutputStream = null ; if ( addChecksum ) { messageDigestOutputStream = new MessageDigestOutputStream ( outputStream , CHECKSUM_ALGORITHM ) ; outputStream = messageDigestOutputStream ; } final DataOutputStream dOut = new DataOutputStream ( outputStream ) ; // write header
dOut . write ( XDATA_HEADER ) ; // serialize the node
serialize ( marshallerMap , dOut , node , ignoreMissingMarshallers , progressListener ) ; if ( addChecksum ) { final byte [ ] digest = messageDigestOutputStream . getDigest ( ) ; dOut . writeBoolean ( true ) ; dOut . write ( digest ) ; } } catch ( NoSuchAlgorithmException ex ) { throw new IOException ( "Checksum algorithm not available" , ex ) ; } finally { gzipOutputStream . close ( ) ; } |
public class UIComponentBase { /** * Save state of the behaviors map .
* @ param context the { @ link FacesContext } for this request .
* @ return map converted to the array of < code > Object < / code > or null if no behaviors have been set . */
private Object saveBehaviorsState ( FacesContext context ) { } } | Object state = null ; if ( null != behaviors && behaviors . size ( ) > 0 ) { boolean stateWritten = false ; Object [ ] attachedBehaviors = new Object [ behaviors . size ( ) ] ; int i = 0 ; for ( List < ClientBehavior > eventBehaviors : behaviors . values ( ) ) { // we need to take different action depending on whether
// or not markInitialState ( ) was called . If it ' s not called ,
// assume JSF 1.2 style state saving and call through to
// saveAttachedState ( ) , otherwise , call saveState ( ) on the
// behaviors directly .
Object [ ] attachedEventBehaviors = new Object [ eventBehaviors . size ( ) ] ; for ( int j = 0 ; j < attachedEventBehaviors . length ; j ++ ) { attachedEventBehaviors [ j ] = ( ( initialStateMarked ( ) ) ? saveBehavior ( context , eventBehaviors . get ( j ) ) : saveAttachedState ( context , eventBehaviors . get ( j ) ) ) ; if ( ! stateWritten ) { stateWritten = ( attachedEventBehaviors [ j ] != null ) ; } } attachedBehaviors [ i ++ ] = attachedEventBehaviors ; } if ( stateWritten ) { state = new Object [ ] { behaviors . keySet ( ) . toArray ( new String [ behaviors . size ( ) ] ) , attachedBehaviors } ; } } return state ; |
public class Footer { /** * Render this tag . This method renders during the data grid ' s { @ link DataGridTagModel # RENDER _ STATE _ FOOTER }
* state in order to add table rows to the end of a data grid ' s HTML table . If the data grid is rendering
* HTML row groups , this tag will output an HTML & lt ; tfoot & gt ; tag . Then , if this tag is rendering
* a table row , it will produce an HTML & lt ; tr & gt ; tag . Then the content of the body will be rendered . If
* table row rendering is disabled , the page author is responsible for rendering the appropriate HTML
* table row tags as this tag renders inside of the HTML table opened by the data grid .
* @ throws IOException
* @ throws JspException when the { @ link DataGridTagModel } can not be found in the { @ link JspContext } */
public void doTag ( ) throws IOException , JspException { } } | JspContext jspContext = getJspContext ( ) ; DataGridTagModel dgm = DataGridUtil . getDataGridTagModel ( jspContext ) ; if ( dgm == null ) throw new JspException ( Bundle . getErrorString ( "DataGridTags_MissingDataGridModel" ) ) ; if ( dgm . getRenderState ( ) == DataGridTagModel . RENDER_STATE_FOOTER ) { JspFragment fragment = getJspBody ( ) ; if ( fragment != null ) { StringWriter sw = new StringWriter ( ) ; TableRenderer tableRenderer = dgm . getTableRenderer ( ) ; assert tableRenderer != null ; StyleModel styleModel = dgm . getStyleModel ( ) ; assert styleModel != null ; AbstractRenderAppender appender = new WriteRenderAppender ( jspContext ) ; if ( dgm . isRenderRowGroups ( ) ) { if ( _tfootTag . styleClass == null ) _tfootTag . styleClass = styleModel . getTableFootClass ( ) ; tableRenderer . openTableFoot ( _tfootTag , appender ) ; } TrTag . State trState = null ; if ( _renderRow ) { trState = new TrTag . State ( ) ; trState . styleClass = styleModel . getFooterRowClass ( ) ; tableRenderer . openFooterRow ( trState , appender ) ; } fragment . invoke ( sw ) ; appender . append ( sw . toString ( ) ) ; if ( _renderRow ) { assert trState != null ; tableRenderer . closeFooterRow ( appender ) ; } if ( dgm . isRenderRowGroups ( ) ) { tableRenderer . closeTableFoot ( appender ) ; String tfootScript = null ; if ( _tfootTag . id != null ) { HttpServletRequest request = JspUtil . getRequest ( getJspContext ( ) ) ; tfootScript = renderNameAndId ( request , _tfootTag , null ) ; } if ( tfootScript != null ) appender . append ( tfootScript ) ; } } } |
public class OmemoManager { /** * Returns true , if the contact has any active devices published in a deviceList .
* @ param contact contact
* @ return true if contact has at least one OMEMO capable device .
* @ throws SmackException . NotConnectedException
* @ throws InterruptedException
* @ throws SmackException . NoResponseException
* @ throws PubSubException . NotALeafNodeException
* @ throws XMPPException . XMPPErrorException */
public boolean contactSupportsOmemo ( BareJid contact ) throws InterruptedException , PubSubException . NotALeafNodeException , XMPPException . XMPPErrorException , SmackException . NotConnectedException , SmackException . NoResponseException { } } | synchronized ( LOCK ) { OmemoCachedDeviceList deviceList = getOmemoService ( ) . refreshDeviceList ( connection ( ) , getOwnDevice ( ) , contact ) ; return ! deviceList . getActiveDevices ( ) . isEmpty ( ) ; } |
public class WhiteboxImpl { /** * Get the type of an anonymous inner class .
* @ param declaringClass The class in which the anonymous inner class is declared .
* @ param occurrence The occurrence of the anonymous inner class . For example if
* you have two anonymous inner classes classes in the
* { @ code declaringClass } you must pass in { @ code 1 } if
* you want to get the type for the first one or { @ code 2}
* if you want the second one .
* @ return The type .
* @ throws ClassNotFoundException the class not found exception */
@ SuppressWarnings ( "unchecked" ) public static Class < Object > getAnonymousInnerClassType ( Class < ? > declaringClass , int occurrence ) throws ClassNotFoundException { } } | return ( Class < Object > ) Class . forName ( declaringClass . getName ( ) + "$" + occurrence ) ; |
public class SessionManager { /** * Retrieves the common SYS Session . */
public Session getSysSession ( ) { } } | sysSession . currentSchema = sysSession . database . schemaManager . getDefaultSchemaHsqlName ( ) ; sysSession . isProcessingScript = false ; sysSession . isProcessingLog = false ; sysSession . setUser ( sysSession . database . getUserManager ( ) . getSysUser ( ) ) ; return sysSession ; |
public class ns_cluster { /** * < pre >
* Use this operation to modify Cluster IP admin ns password .
* < / pre > */
public static ns_cluster modify_password ( nitro_service client , ns_cluster resource ) throws Exception { } } | return ( ( ns_cluster [ ] ) resource . perform_operation ( client , "modify_password" ) ) [ 0 ] ; |
public class MultifactorAuthenticationUtils { /** * Evaluate event for provider in context set .
* @ param principal the principal
* @ param service the service
* @ param context the context
* @ param provider the provider
* @ return the set */
public static Set < Event > evaluateEventForProviderInContext ( final Principal principal , final RegisteredService service , final Optional < RequestContext > context , final MultifactorAuthenticationProvider provider ) { } } | LOGGER . debug ( "Attempting check for availability of multifactor authentication provider [{}] for [{}]" , provider , service ) ; if ( provider != null ) { LOGGER . debug ( "Provider [{}] is successfully verified" , provider ) ; val id = provider . getId ( ) ; val event = MultifactorAuthenticationUtils . validateEventIdForMatchingTransitionInContext ( id , context , MultifactorAuthenticationUtils . buildEventAttributeMap ( principal , Optional . of ( service ) , provider ) ) ; return CollectionUtils . wrapSet ( event ) ; } LOGGER . debug ( "Provider could not be verified" ) ; return new HashSet < > ( 0 ) ; |
public class CurrentDatetimeBehavior { /** * { @ inheritDoc } */
@ Override public void renderHead ( final Component component , final IHeaderResponse response ) { } } | super . renderHead ( component , response ) ; response . render ( JavaScriptHeaderItem . forReference ( Application . get ( ) . getJavaScriptLibrarySettings ( ) . getJQueryReference ( ) ) ) ; response . render ( JavaScriptHeaderItem . forReference ( CurrentDatetimeBehavior . DATETIME_PLUGIN_REFERENCE ) ) ; final String js = generateJS ( datetimeTemplate ) ; System . out . println ( js ) ; response . render ( OnLoadHeaderItem . forScript ( generateJS ( datetimeTemplate ) ) ) ; |
public class AbstractSpecWithPrimaryKey { /** * Sets the primary key with the specified key components . */
public AbstractSpecWithPrimaryKey < T > withPrimaryKey ( KeyAttribute ... components ) { } } | if ( components == null ) this . keyComponents = null ; else this . keyComponents = Arrays . asList ( components ) ; return this ; |
public class CmsSecurityManager { /** * Returns the resources that were subscribed by a user or group set in the filter . < p >
* @ param context the request context
* @ param poolName the name of the database pool to use
* @ param filter the filter that is used to get the subscribed resources
* @ return the resources that were subscribed by a user or group set in the filter
* @ throws CmsException if something goes wrong */
public List < CmsResource > readSubscribedResources ( CmsRequestContext context , String poolName , CmsSubscriptionFilter filter ) throws CmsException { } } | List < CmsResource > result = null ; CmsDbContext dbc = m_dbContextFactory . getDbContext ( context ) ; try { result = m_driverManager . readSubscribedResources ( dbc , poolName , filter ) ; } catch ( Exception e ) { dbc . report ( null , Messages . get ( ) . container ( Messages . ERR_READ_SUBSCRIBED_RESOURCES_1 , filter . toString ( ) ) , e ) ; } finally { dbc . clear ( ) ; } return result ; |
public class ChorusAssert { /** * Asserts that an object is null . If it isn ' t an { @ link AssertionError } is
* thrown .
* Message contains : Expected : null but was : object
* @ param object
* Object to check or < code > null < / code > */
static public void assertNull ( Object object ) { } } | String message = "Expected: <null> but was: " + String . valueOf ( object ) ; assertNull ( message , object ) ; |
public class UCharacter { /** * < strong > [ icu ] < / strong > Returns the names for each of the characters in a string
* @ param s string to format
* @ param separator string to go between names
* @ return string of names */
public static String getName ( String s , String separator ) { } } | if ( s . length ( ) == 1 ) { // handle common case
return getName ( s . charAt ( 0 ) ) ; } int cp ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; i += Character . charCount ( cp ) ) { cp = s . codePointAt ( i ) ; if ( i != 0 ) sb . append ( separator ) ; sb . append ( UCharacter . getName ( cp ) ) ; } return sb . toString ( ) ; |
public class SlotReference { /** * Get a unique reference to a media slot on the network from which tracks can be loaded .
* @ param player the player in which the slot is found
* @ param slot the specific type of the slot
* @ return the instance that will always represent the specified slot
* @ throws NullPointerException if { @ code slot } is { @ code null } */
@ SuppressWarnings ( "WeakerAccess" ) public static synchronized SlotReference getSlotReference ( int player , CdjStatus . TrackSourceSlot slot ) { } } | Map < CdjStatus . TrackSourceSlot , SlotReference > playerMap = instances . get ( player ) ; if ( playerMap == null ) { playerMap = new HashMap < CdjStatus . TrackSourceSlot , SlotReference > ( ) ; instances . put ( player , playerMap ) ; } SlotReference result = playerMap . get ( slot ) ; if ( result == null ) { result = new SlotReference ( player , slot ) ; playerMap . put ( slot , result ) ; } return result ; |
public class HtmlBuilder { /** * Icon image representing Simon Type .
* @ param simonType Simon Type
* @ param rootPath Path to root of Simon Console resources */
public T simonTypeImg ( SimonType simonType , String rootPath ) throws IOException { } } | String image = null ; switch ( simonType ) { case COUNTER : image = "TypeCounter.png" ; break ; case STOPWATCH : image = "TypeStopwatch.png" ; break ; case UNKNOWN : image = "TypeUnknown.png" ; break ; } String label = simonType . name ( ) . toLowerCase ( ) ; doBegin ( "img" , null , label + " icon" ) ; attr ( "src" , rootPath + "resource/images/" + image ) ; attr ( "alt" , label ) ; writer . write ( " />" ) ; return ( T ) this ; |
public class AbstractHibernateCriteriaBuilder { /** * Orders by the specified property name and direction
* @ param propertyName The property name to order by
* @ param direction Either " asc " for ascending or " desc " for descending
* @ return A Order instance */
public org . grails . datastore . mapping . query . api . Criteria order ( String propertyName , String direction ) { } } | if ( criteria == null ) { throwRuntimeException ( new IllegalArgumentException ( "Call to [order] with propertyName [" + propertyName + "]not allowed here." ) ) ; } propertyName = calculatePropertyName ( propertyName ) ; Order o ; if ( direction . equals ( ORDER_DESCENDING ) ) { o = Order . desc ( propertyName ) ; } else { o = Order . asc ( propertyName ) ; } if ( paginationEnabledList ) { orderEntries . add ( o ) ; } else { criteria . addOrder ( o ) ; } return this ; |
public class InstanceStatusSummary { /** * The system instance health or application instance health .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setDetails ( java . util . Collection ) } or { @ link # withDetails ( java . util . Collection ) } if you want to override
* the existing values .
* @ param details
* The system instance health or application instance health .
* @ return Returns a reference to this object so that method calls can be chained together . */
public InstanceStatusSummary withDetails ( InstanceStatusDetails ... details ) { } } | if ( this . details == null ) { setDetails ( new com . amazonaws . internal . SdkInternalList < InstanceStatusDetails > ( details . length ) ) ; } for ( InstanceStatusDetails ele : details ) { this . details . add ( ele ) ; } return this ; |
public class PortletDefinitionSearcher { /** * Internal search , so shouldn ' t be called as case insensitive . */
@ Override public EntityIdentifier [ ] searchForEntities ( String query , SearchMethod method ) throws GroupsException { } } | boolean allowPartial = true ; switch ( method ) { case DISCRETE : allowPartial = false ; break ; case STARTS_WITH : query = query + "%" ; break ; case ENDS_WITH : query = "%" + query ; break ; case CONTAINS : query = "%" + query + "%" ; break ; default : throw new GroupsException ( "Unknown search type" ) ; } // get the list of matching portlet definitions
final List < IPortletDefinition > definitions = this . portletDefinitionRegistry . searchForPortlets ( query , allowPartial ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Found " + definitions . size ( ) + " matching definitions for query " + query ) ; } // initialize an appropriately - sized array of EntityIdentifiers
final EntityIdentifier [ ] identifiers = new EntityIdentifier [ definitions . size ( ) ] ; // add an identifier for each matching portlet
for ( final ListIterator < IPortletDefinition > defIter = definitions . listIterator ( ) ; defIter . hasNext ( ) ; ) { final IPortletDefinition definition = defIter . next ( ) ; identifiers [ defIter . previousIndex ( ) ] = new EntityIdentifier ( definition . getPortletDefinitionId ( ) . getStringId ( ) , this . getType ( ) ) ; } return identifiers ; |
public class JPAPUnitInfo { /** * F1879-16302 */
String dump ( ) { } } | StringBuilder sbuf = new StringBuilder ( ) ; sbuf . append ( "\n" ) . append ( toString ( ) ) ; sbuf . append ( "\n PersistenceUnit name : " ) . append ( ivArchivePuId . getPuName ( ) ) ; sbuf . append ( "\n Schema Version : " ) . append ( xmlSchemaVersion ) ; // F743-8064
sbuf . append ( "\t Archive name : " ) . append ( ivArchivePuId . getModJarName ( ) ) ; sbuf . append ( "\t Application name : " ) . append ( ivArchivePuId . getApplName ( ) ) ; sbuf . append ( "\n Root URL : " ) . append ( ivPUnitRootURL ) ; sbuf . append ( "\n Transaction Type : " ) . append ( ivTxType ) ; sbuf . append ( "\n Description : " ) . append ( ivDesc ) ; sbuf . append ( "\n Provider class name : " ) . append ( ivProviderClassName ) ; sbuf . append ( "\n JTA Data Source : " ) . append ( ivJtaDataSourceJNDIName ) . append ( " | " ) . append ( ivJtaDataSource ) ; sbuf . append ( "\n Non JTA Data Source : " ) . append ( ivNonJtaDataSourceJNDIName ) . append ( " | " ) . append ( ivNonJtaDataSource ) ; sbuf . append ( "\n ExcludeUnlistedClass : " ) . append ( ivExcludeUnlistedClasses ) ; sbuf . append ( "\n SharedCacheMode : " ) . append ( ivCaching ) ; // d597764
sbuf . append ( "\n ValidationMode : " ) . append ( ivValidationMode ) ; // d597764
sbuf . append ( "\n Properties : " ) . append ( ivProperties ) ; boolean first ; sbuf . append ( "\n Mapping Files : [" ) ; if ( ivMappingFileNames != null ) { first = true ; for ( String fname : ivMappingFileNames ) { sbuf . append ( first ? "" : "," ) . append ( fname ) ; first = false ; } } sbuf . append ( ']' ) ; sbuf . append ( "\n Jar Files : [" ) ; if ( ivJarFileURLs != null ) { first = true ; for ( URL jarUrl : ivJarFileURLs ) { sbuf . append ( first ? "" : "," ) . append ( jarUrl ) ; first = false ; } } sbuf . append ( ']' ) ; sbuf . append ( "\n ManagedClasses : [" ) ; if ( ivManagedClassNames != null ) { first = true ; for ( String className : ivManagedClassNames ) { sbuf . append ( first ? "" : "," ) . append ( className ) ; first = false ; } } sbuf . append ( ']' ) ; sbuf . append ( "\n ClassLoader : " ) . append ( ivClassLoader ) ; sbuf . append ( "\n Temp ClassLoader : " ) . append ( tempClassLoader ) ; sbuf . append ( "\n Transformer : [" ) ; if ( ivTransformers != null ) { first = true ; for ( ClassTransformer transformer : ivTransformers ) { sbuf . append ( first ? "" : "," ) . append ( transformer ) ; first = false ; } } sbuf . append ( ']' ) ; return sbuf . toString ( ) ; |
public class IO { /** * Write a character to a { @ link Writer } .
* The writer is leave open after the character after writing .
* @ param c
* the character to be written
* @ param writer
* the writer to which the character is written */
public static void write ( char c , Writer writer ) { } } | try { writer . write ( c ) ; } catch ( IOException e ) { throw E . ioException ( e ) ; } |
import java . util . * ; class ElementFrequency { /** * Calculate the frequency of each element in a list of lists .
* Examples :
* > > > elementFrequency ( Arrays . asList ( Arrays . asList ( 1 , 2 , 3 , 2 ) , Arrays . asList ( 4 , 5 , 6 , 2 ) , Arrays . asList ( 7 , 1 , 9 , 5 ) ) )
* { 2 = 3 , 1 = 2 , 5 = 2 , 3 = 1 , 4 = 1 , 6 = 1 , 7 = 1 , 9 = 1}
* > > > elementFrequency ( Arrays . asList ( Arrays . asList ( 1 , 2 , 3 , 4 ) , Arrays . asList ( 5 , 6 , 7 , 8 ) , Arrays . asList ( 9 , 10 , 11 , 12 ) ) )
* { 1 = 1 , 2 = 1 , 3 = 1 , 4 = 1 , 5 = 1 , 6 = 1 , 7 = 1 , 8 = 1 , 9 = 1 , 10 = 1 , 11 = 1 , 12 = 1}
* > > > elementFrequency ( Arrays . asList ( Arrays . asList ( 15 , 20 , 30 , 40 ) , Arrays . asList ( 80 , 90 , 100 , 110 ) , Arrays . asList ( 30 , 30 , 80 , 90 ) ) )
* { 30 = 3 , 80 = 2 , 90 = 2 , 15 = 1 , 20 = 1 , 40 = 1 , 100 = 1 , 110 = 1}
* @ param lists List of lists storing the numbers .
* @ return A HashMap object that includes each number as a key and its frequency as a value . */
public static HashMap < Integer , Integer > elementFrequency ( List < List < Integer > > lists ) { } } | HashMap < Integer , Integer > freqTable = new HashMap < Integer , Integer > ( ) ; for ( List < Integer > list : lists ) { for ( Integer elem : list ) { freqTable . put ( elem , freqTable . getOrDefault ( elem , 0 ) + 1 ) ; } } return freqTable ; |
public class TSDB { /** * Collects the stats for a { @ link UniqueId } .
* @ param uid The instance from which to collect stats .
* @ param collector The collector to use . */
private static void collectUidStats ( final UniqueId uid , final StatsCollector collector ) { } } | collector . record ( "uid.cache-hit" , uid . cacheHits ( ) , "kind=" + uid . kind ( ) ) ; collector . record ( "uid.cache-miss" , uid . cacheMisses ( ) , "kind=" + uid . kind ( ) ) ; collector . record ( "uid.cache-size" , uid . cacheSize ( ) , "kind=" + uid . kind ( ) ) ; collector . record ( "uid.random-collisions" , uid . randomIdCollisions ( ) , "kind=" + uid . kind ( ) ) ; collector . record ( "uid.rejected-assignments" , uid . rejectedAssignments ( ) , "kind=" + uid . kind ( ) ) ; |
public class MapLoader { /** * Loads the specified values into the specified object instance .
* @ param item the object into which values are being loaded
* @ param vals the values to load into the object */
public void load ( T item , Map vals ) { } } | for ( Object k : vals . keySet ( ) ) { Class cls = item . getClass ( ) ; String key = ( String ) k ; Object val = vals . get ( key ) ; Field f = null ; int mod ; while ( f == null ) { try { f = cls . getDeclaredField ( key ) ; } catch ( NoSuchFieldException e ) { // ignore
} if ( f == null ) { cls = cls . getSuperclass ( ) ; if ( cls == null || cls . getName ( ) . equals ( Object . class . getName ( ) ) ) { break ; } } } if ( f == null ) { continue ; } mod = f . getModifiers ( ) ; if ( Modifier . isTransient ( mod ) || Modifier . isStatic ( mod ) ) { continue ; } try { f . setAccessible ( true ) ; f . set ( item , val ) ; } catch ( IllegalAccessException e ) { String msg = "Error setting value for " + key + ":\n" ; if ( val == null ) { msg = msg + " (null)" ; } else { msg = msg + " (" + val + ":" + val . getClass ( ) . getName ( ) + ")" ; } msg = msg + ":\n" + e . getClass ( ) . getName ( ) + ":\n" ; throw new CacheManagementException ( msg + e . getMessage ( ) ) ; } catch ( IllegalArgumentException e ) { String msg = "Error setting value for " + key ; if ( val == null ) { msg = msg + " (null)" ; } else { msg = msg + " (" + val + ":" + val . getClass ( ) . getName ( ) + ")" ; } msg = msg + ":\n" + e . getClass ( ) . getName ( ) + ":\n" ; throw new CacheManagementException ( msg + e . getMessage ( ) ) ; } } |
public class Logger { /** * Remove the specified appender from the appender list .
* @ param appender the < code > Appender < / code > to remove . */
public void removeAppender ( Appender appender ) throws IllegalArgumentException { } } | if ( appender == null ) { throw new IllegalArgumentException ( "The appender must not be null." ) ; } if ( appender . isLogOpen ( ) ) { try { appender . close ( ) ; } catch ( IOException e ) { Log . e ( TAG , "Failed to close appender. " + e ) ; } } appenderList . remove ( appender ) ; |
public class LayoutParser { /** * { @ inheritDoc } */
@ Override public void startElement ( String namespaceURI , String sName , String qName , Attributes attrs ) throws SAXException { } } | if ( isParsing || qName . equals ( currentRoot ) ) { isParsing = true ; currentNode = new XMLNode ( currentNode , qName ) ; for ( int i = 0 ; i < attrs . getLength ( ) ; i ++ ) currentNode . attrs . put ( attrs . getLocalName ( i ) , attrs . getValue ( i ) ) ; if ( qName . equals ( currentRoot ) ) xmlElementsMap . put ( qName , currentNode ) ; } |
public class FileCopyProgressInputStream { /** * { @ inheritDoc } */
public final synchronized void reset ( ) throws IOException { } } | in . reset ( ) ; bytesRead = size - in . available ( ) ; if ( listener != null ) { listener . updateByte ( bytesRead ) ; } |
public class NDArrayMessage { /** * Returns the size needed in bytes
* for a bytebuffer for a given ndarray message .
* The formula is :
* { @ link AeronNDArraySerde # byteBufferSizeFor ( INDArray ) }
* + size of dimension length ( 4)
* + time stamp size ( 8)
* + index size ( 8)
* + 4 * message . getDimensions . length
* @ param message the message to get the length for
* @ return the size of the byte buffer for a message */
public static int byteBufferSizeForMessage ( NDArrayMessage message ) { } } | int enumSize = 4 ; int nInts = 4 * message . getDimensions ( ) . length ; int sizeofDimensionLength = 4 ; int timeStampSize = 8 ; int indexSize = 8 ; return enumSize + nInts + sizeofDimensionLength + timeStampSize + indexSize + AeronNDArraySerde . byteBufferSizeFor ( message . getArr ( ) ) ; |
public class JsonConverter { /** * 受信したログデータに以下のフィールドが存在した場合 、 数値に変換する 。 < br >
* 変換対象のフィールドは以下の通り 。 < br >
* @ param jsonMap 受信したログデータ ( JSON ) */
private void convertToNumeric ( Map < String , Object > jsonMap ) { } } | if ( jsonMap . containsKey ( "reqtime" ) == true ) { Long reqtime = Long . parseLong ( jsonMap . get ( "reqtime" ) . toString ( ) ) ; jsonMap . put ( "reqtime" , reqtime ) ; } else { jsonMap . put ( "reqtime" , 0L ) ; } if ( jsonMap . containsKey ( "reqtime_microsec" ) == true ) { Long reqtimeMicro = Long . parseLong ( jsonMap . get ( "reqtime_microsec" ) . toString ( ) ) ; jsonMap . put ( "reqtime_microsec" , reqtimeMicro ) ; } else { jsonMap . put ( "reqtime_microsec" , 0L ) ; } if ( jsonMap . containsKey ( "size" ) == true ) { String sizeStr = jsonMap . get ( "size" ) . toString ( ) ; if ( "-" . equals ( sizeStr ) ) { jsonMap . put ( "size" , 0L ) ; } else { Long size = Long . parseLong ( sizeStr ) ; jsonMap . put ( "size" , size ) ; } } else { jsonMap . put ( "size" , 0L ) ; } |
public class Privateer { /** * Calls the specified method on the Object o with the specified arguments . Returns the
* result as an Object . Only methods declared on the class for Object o can be called .
* The length of the vararg list of arguments to be passed to the method must match
* what the method expects . If no arguments are expected , null can be passed . If one
* argument is expected , that argument can be passed as an object . If multiple
* arguments are expected , they can be passed as an Object array or as a comma - separated
* list .
* @ param o Object to access
* @ param methodName Name of method to call
* @ param args Vararg list of arguments to pass to method
* @ return Object that is the result of calling the named method
* @ throws NoSuchMethodException if the name or arguments don ' t match any declared method
* @ throws IllegalAccessException
* @ throws InvocationTargetException if some unexpected error occurs when invoking a method that was thought to match
* @ throws IllegalArgumentException if the argument count doesn ' t match any method that has the same name */
public Object callMethod ( Object o , String methodName , Object ... args ) throws NoSuchMethodException , IllegalAccessException , InvocationTargetException { } } | Method method = null ; if ( args == null || args . length == 0 ) { method = o . getClass ( ) . getDeclaredMethod ( methodName ) ; } else { Class < ? > [ ] types = new Class [ args . length ] ; for ( int i = 0 ; i < args . length ; i ++ ) { types [ i ] = args [ i ] . getClass ( ) ; } try { method = o . getClass ( ) . getDeclaredMethod ( methodName , types ) ; } catch ( NoSuchMethodException e ) { // Try more complex comparison for matching args to supertypes in the params
method = findSupertypeMethod ( o , methodName , types ) ; } } if ( method == null ) { throw new NoSuchMethodException ( "Found no method named" + methodName + " with matching params" ) ; } method . setAccessible ( true ) ; return method . invoke ( o , args ) ; |
public class ZookeeperUtil { /** * Parses server section of Zookeeper connection string */
public static String parseServers ( String zookeepers ) { } } | int slashIndex = zookeepers . indexOf ( "/" ) ; if ( slashIndex != - 1 ) { return zookeepers . substring ( 0 , slashIndex ) ; } return zookeepers ; |
public class JPAAuditLogService { /** * / * ( non - Javadoc )
* @ see org . jbpm . process . audit . AuditLogService # findProcessInstances ( java . lang . String ) */
@ Override public List < ProcessInstanceLog > findProcessInstances ( String processId ) { } } | EntityManager em = getEntityManager ( ) ; Query query = em . createQuery ( "FROM ProcessInstanceLog p WHERE p.processId = :processId" ) . setParameter ( "processId" , processId ) ; return executeQuery ( query , em , ProcessInstanceLog . class ) ; |
public class ServersInner { /** * Gets a list of servers in a resource groups .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; ServerInner & gt ; object */
public Observable < Page < ServerInner > > listByResourceGroupAsync ( final String resourceGroupName ) { } } | return listByResourceGroupWithServiceResponseAsync ( resourceGroupName ) . map ( new Func1 < ServiceResponse < Page < ServerInner > > , Page < ServerInner > > ( ) { @ Override public Page < ServerInner > call ( ServiceResponse < Page < ServerInner > > response ) { return response . body ( ) ; } } ) ; |
public class WebApp31 { /** * New method added for HttpSessionIdListener */
private void addHttpSessionIdListener ( HttpSessionIdListener listener , boolean securityCheckNeeded ) throws SecurityException { } } | if ( securityCheckNeeded ) { SecurityManager sm = System . getSecurityManager ( ) ; if ( sm != null ) { sm . checkPermission ( perm ) ; } } ( ( IHttpSessionContext31 ) this . getSessionContext ( ) ) . addHttpSessionIdListener ( listener , name ) ; |
public class Optional { /** * Invokes the given mapping function on inner value if present .
* @ param < U > the type of result value
* @ param mapper mapping function
* @ return an { @ code Optional } with transformed value if present ,
* otherwise an empty { @ code Optional }
* @ throws NullPointerException if value is present and
* { @ code mapper } is { @ code null } */
@ NotNull public < U > Optional < U > map ( @ NotNull Function < ? super T , ? extends U > mapper ) { } } | if ( ! isPresent ( ) ) return empty ( ) ; return Optional . ofNullable ( mapper . apply ( value ) ) ; |
public class HttpTunnelServer { /** * Handle an incoming HTTP connection .
* @ param httpConnection the HTTP connection
* @ throws IOException in case of I / O errors */
protected void handle ( HttpConnection httpConnection ) throws IOException { } } | try { getServerThread ( ) . handleIncomingHttp ( httpConnection ) ; httpConnection . waitForResponse ( ) ; } catch ( ConnectException ex ) { httpConnection . respond ( HttpStatus . GONE ) ; } |
public class InternalSimpleAntlrParser { /** * InternalSimpleAntlr . g : 445:1 : entryRuleParameter returns [ EObject current = null ] : iv _ ruleParameter = ruleParameter EOF ; */
public final EObject entryRuleParameter ( ) throws RecognitionException { } } | EObject current = null ; EObject iv_ruleParameter = null ; try { // InternalSimpleAntlr . g : 446:2 : ( iv _ ruleParameter = ruleParameter EOF )
// InternalSimpleAntlr . g : 447:2 : iv _ ruleParameter = ruleParameter EOF
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getParameterRule ( ) ) ; } pushFollow ( FOLLOW_1 ) ; iv_ruleParameter = ruleParameter ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = iv_ruleParameter ; } match ( input , EOF , FOLLOW_2 ) ; if ( state . failed ) return current ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getIfcRoleEnum ( ) { } } | if ( ifcRoleEnumEEnum == null ) { ifcRoleEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 888 ) ; } return ifcRoleEnumEEnum ; |
public class Bridge { /** * Convenience method to create a Bridge object from two call ids
* @ param client the client
* @ param callId1 the call id
* @ param callId2 the call id
* @ return the Bridge
* @ throws IOException unexpected error . */
public static Bridge create ( final BandwidthClient client , final String callId1 , final String callId2 ) throws Exception { } } | assert ( callId1 != null ) ; final HashMap < String , Object > params = new HashMap < String , Object > ( ) ; params . put ( "bridgeAudio" , "true" ) ; String [ ] callIds = null ; if ( callId1 != null && callId2 != null ) { callIds = new String [ ] { callId1 , callId2 } ; } else if ( callId1 != null && callId2 == null ) { callIds = new String [ ] { callId1 } ; } else if ( callId1 == null && callId2 != null ) { callIds = new String [ ] { callId2 } ; } params . put ( "callIds" , callIds == null ? Collections . emptyList ( ) : Arrays . asList ( callIds ) ) ; return create ( client , params ) ; |
public class FastaAFPChainConverter { /** * Prints out the XML representation of an AFPChain from a file containing exactly two FASTA sequences .
* @ param args
* A String array of fasta - file structure - 1 - name structure - 2 - name
* @ throws StructureException
* @ throws IOException */
public static void main ( String [ ] args ) throws StructureException , IOException { } } | if ( args . length != 3 ) { System . err . println ( "Usage: FastaAFPChainConverter fasta-file structure-1-name structure-2-name" ) ; return ; } File fasta = new File ( args [ 0 ] ) ; Structure structure1 = StructureTools . getStructure ( args [ 1 ] ) ; Structure structure2 = StructureTools . getStructure ( args [ 2 ] ) ; if ( structure1 == null ) throw new IllegalArgumentException ( "No structure for " + args [ 1 ] + " was found" ) ; if ( structure2 == null ) throw new IllegalArgumentException ( "No structure for " + args [ 2 ] + " was found" ) ; AFPChain afpChain = fastaFileToAfpChain ( fasta , structure1 , structure2 ) ; String xml = AFPChainXMLConverter . toXML ( afpChain ) ; System . out . println ( xml ) ; |
public class Sum { /** * Returns true if one of the sub - constraints still contains mandatory cases
* @ return true if at least on of the sub - constraints contains at least one mandatory case */
@ Override public boolean hasNextCase ( ) { } } | for ( ConstraintWrap wrap : summands ) { if ( wrap . constraint . hasNextCase ( ) ) { return true ; } } return false ; |
public class Sorting { /** * Adds field to sort by .
* @ param fieldName Property name to sort by .
* @ param sortDirection Sort direction . */
public void addField ( String fieldName , SortDirection sortDirection ) { } } | if ( sortFields == null ) sortFields = new HashMap < > ( ) ; sortFields . put ( fieldName , sortDirection ) ; |
public class FileUtils { /** * Replaces OS specific illegal characters from any filename with ' _ ' ,
* including ( / \ n \ r \ t ) on all operating systems , ( ? * \ < > | " )
* on Windows , ( ` ) on unix .
* @ param name the filename to check for illegal characters
* @ return String containing the cleaned filename */
public static String removeIllegalCharsFromFileName ( String name ) { } } | // if the name is too long , reduce it . We don ' t go all the way
// up to 256 because we don ' t know how long the directory name is
// We want to keep the extension , though .
if ( name . length ( ) > 180 ) { int extStart = name . lastIndexOf ( '.' ) ; if ( extStart == - 1 ) { // no extension , weird , but possible
name = name . substring ( 0 , 180 ) ; } else { // if extension is greater than 11 , we concat it .
// ( 11 = ' . ' + 10 extension characters )
int extLength = name . length ( ) - extStart ; int extEnd = extLength > 11 ? extStart + 11 : name . length ( ) ; name = name . substring ( 0 , 180 - extLength ) + name . substring ( extStart , extEnd ) ; } } for ( int i = 0 ; i < ILLEGAL_CHARS_ANY_OS . length ; i ++ ) name = name . replace ( ILLEGAL_CHARS_ANY_OS [ i ] , '_' ) ; if ( SystemUtils . IS_OS_WINDOWS ) { for ( int i = 0 ; i < ILLEGAL_CHARS_WINDOWS . length ; i ++ ) name = name . replace ( ILLEGAL_CHARS_WINDOWS [ i ] , '_' ) ; } else if ( SystemUtils . IS_OS_UNIX ) { for ( int i = 0 ; i < ILLEGAL_CHARS_UNIX . length ; i ++ ) name = name . replace ( ILLEGAL_CHARS_UNIX [ i ] , '_' ) ; } return name ; |
public class SimpleExpressionsPackageImpl { /** * Creates the meta - model objects for the package . This method is
* guarded to have no affect on any invocation but its first .
* < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void createPackageContents ( ) { } } | if ( isCreated ) return ; isCreated = true ; // Create classes and their features
ifConditionEClass = createEClass ( IF_CONDITION ) ; createEAttribute ( ifConditionEClass , IF_CONDITION__ELSEIF ) ; createEReference ( ifConditionEClass , IF_CONDITION__CONDITION ) ; expressionEClass = createEClass ( EXPRESSION ) ; numberLiteralEClass = createEClass ( NUMBER_LITERAL ) ; createEAttribute ( numberLiteralEClass , NUMBER_LITERAL__VALUE ) ; booleanLiteralEClass = createEClass ( BOOLEAN_LITERAL ) ; createEAttribute ( booleanLiteralEClass , BOOLEAN_LITERAL__VALUE ) ; methodCallEClass = createEClass ( METHOD_CALL ) ; createEAttribute ( methodCallEClass , METHOD_CALL__VALUE ) ; orExpressionEClass = createEClass ( OR_EXPRESSION ) ; createEReference ( orExpressionEClass , OR_EXPRESSION__LEFT ) ; createEReference ( orExpressionEClass , OR_EXPRESSION__RIGHT ) ; andExpressionEClass = createEClass ( AND_EXPRESSION ) ; createEReference ( andExpressionEClass , AND_EXPRESSION__LEFT ) ; createEReference ( andExpressionEClass , AND_EXPRESSION__RIGHT ) ; comparisonEClass = createEClass ( COMPARISON ) ; createEReference ( comparisonEClass , COMPARISON__LEFT ) ; createEAttribute ( comparisonEClass , COMPARISON__OPERATOR ) ; createEReference ( comparisonEClass , COMPARISON__RIGHT ) ; notExpressionEClass = createEClass ( NOT_EXPRESSION ) ; createEReference ( notExpressionEClass , NOT_EXPRESSION__EXPRESSION ) ; |
public class CmsEditorCssHandlerDefault { /** * Finds the style sheet by reading the template property of the template for a given path . < p >
* @ param cms the current CMS context
* @ param editedResourcePath the resource path
* @ return the CSS uri from the template for the given path */
private String internalGetUriStyleSheet ( CmsObject cms , String editedResourcePath ) { } } | if ( editedResourcePath == null ) { return "" ; } String result = "" ; try { // determine the path of the template
String templatePath = "" ; try { templatePath = cms . readPropertyObject ( editedResourcePath , CmsPropertyDefinition . PROPERTY_TEMPLATE , true ) . getValue ( "" ) ; if ( CmsTemplateContextManager . isProvider ( templatePath ) ) { I_CmsTemplateContextProvider provider = OpenCms . getTemplateContextManager ( ) . getTemplateContextProvider ( templatePath ) ; if ( provider != null ) { String providerResult = provider . getEditorStyleSheet ( cms , editedResourcePath ) ; if ( providerResult != null ) { return providerResult ; } } } } catch ( CmsException e ) { if ( LOG . isWarnEnabled ( ) ) { LOG . warn ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_READ_TEMPLATE_PROP_FAILED_0 ) , e ) ; } } if ( CmsStringUtil . isNotEmpty ( templatePath ) ) { // read the template property value from the template file where the absolute CSS path is ( or should be ) stored
result = cms . readPropertyObject ( templatePath , CmsPropertyDefinition . PROPERTY_TEMPLATE , false ) . getValue ( "" ) ; } } catch ( CmsException e ) { if ( LOG . isWarnEnabled ( ) ) { LOG . warn ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_READ_TEMPLATE_PROP_STYLESHEET_FAILED_0 ) , e ) ; } } return result ; |
public class AbstractWrapAdapter { /** * overwrite the getItemViewType to correctly return the value from the FastAdapter
* @ param position
* @ return */
@ Override public int getItemViewType ( int position ) { } } | if ( shouldInsertItemAtPosition ( position ) ) { return getItem ( position ) . getType ( ) ; } else { return mAdapter . getItemViewType ( position - itemInsertedBeforeCount ( position ) ) ; } |
public class PopupButtonClicker { /** * Commander which clicks on a popup button .
* @ param timeout the timeout value ; String - the button text .
* @ return true if the command is successfully performed .
* @ throws QTasteException */
@ Override public Boolean executeCommand ( int timeout , String componentName , Object ... data ) throws QTasteException { } } | setData ( data ) ; long maxTime = System . currentTimeMillis ( ) + 1000 * timeout ; String buttonText = mData [ 0 ] . toString ( ) ; component = null ; while ( System . currentTimeMillis ( ) < maxTime ) { JDialog targetPopup = null ; for ( JDialog dialog : findPopups ( ) ) { if ( ! dialog . isVisible ( ) || ! dialog . isEnabled ( ) ) { String msg = "Ignore the dialog '" + dialog . getTitle ( ) + "' cause:\n " ; if ( ! dialog . isVisible ( ) ) { msg += "\t is not visible" ; } if ( ! dialog . isEnabled ( ) ) { msg += "\t is not enabled" ; } LOGGER . info ( msg ) ; continue ; } if ( activateAndFocusComponentWindow ( dialog ) ) { targetPopup = dialog ; break ; } else { LOGGER . info ( "Ignore the dialog '" + dialog . getTitle ( ) + "' cause:\n \t is not focused" ) ; } } component = findButtonComponent ( targetPopup , buttonText ) ; if ( component != null && component . isEnabled ( ) && checkComponentIsVisible ( component ) ) { break ; } try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { LOGGER . warn ( "Exception during the component search sleep..." ) ; } } if ( component == null ) { throw new QTasteTestFailException ( "The button with the text \"" + buttonText + "\" is not found." ) ; } if ( ! component . isEnabled ( ) ) { throw new QTasteTestFailException ( "The button with the text \"" + buttonText + "\" is not enabled." ) ; } if ( ! checkComponentIsVisible ( component ) ) { throw new QTasteTestFailException ( "The button with the text \"" + buttonText + "\" is not visible!" ) ; } prepareActions ( ) ; SwingUtilities . invokeLater ( this ) ; synchronizeThreads ( ) ; return true ; |
public class Lock { /** * This method is called to request a shared lock . There are conditions under which a
* shared lock cannot be granted and this method will block until no such conditions
* apply . When the method returns the thread has been granted an additional shared
* lock . A single thread may hold any number of shared locks , but the number of
* requests must be matched by an equal number of releases .
* @ param requestId The ' identifier ' of the lock requester . This is used ONLY for
* trace output . It should be used to ' pair up ' get / set pairs in
* the code . */
public void getSharedLock ( int requestId ) { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getSharedLock" , new Object [ ] { this , new Integer ( requestId ) } ) ; Thread currentThread = Thread . currentThread ( ) ; Integer count = null ; synchronized ( this ) { // If this thread does not have any existing shared locks and there is a thread waiting to get the exclusive
// lock or a thread ( other than this thread ) who already holds the exclusive lock then we will have to wait
// until the exclusive lock is eventually dropped before granting the shared lock .
if ( ( ! _sharedThreads . containsKey ( currentThread ) ) && ( ( _threadRequestingExclusiveLock != null ) || ( ( _threadHoldingExclusiveLock != null ) && ( ! _threadHoldingExclusiveLock . equals ( currentThread ) ) ) ) ) { while ( ( _threadHoldingExclusiveLock != null ) || ( _threadRequestingExclusiveLock != null ) ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Thread " + Integer . toHexString ( currentThread . hashCode ( ) ) + " is waiting for the exclusive lock to be released" ) ; try { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Thread " + Integer . toHexString ( currentThread . hashCode ( ) ) + " waiting.." ) ; this . wait ( ) ; } catch ( java . lang . InterruptedException exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.Lock.getSharedLock" , "180" , this ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Thread " + Integer . toHexString ( currentThread . hashCode ( ) ) + " was interrupted unexpectedly during wait. Retesting condition" ) ; // This exception is recieved if another thread interrupts this thread by calling this threads
// Thread . interrupt method . The Lock class does not use this mechanism for breaking out of the
// wait call - it uses notifyAll to wake up all waiting threads . This exception should never
// be generated . If for some reason it is called then ignore it and start to wait again .
} } if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Thread " + Integer . toHexString ( currentThread . hashCode ( ) ) + " is has detected that the exclusive lock has been released" ) ; } count = ( Integer ) _sharedThreads . get ( currentThread ) ; if ( count == null ) { count = new Integer ( 1 ) ; } else { count = new Integer ( count . intValue ( ) + 1 ) ; } _sharedThreads . put ( currentThread , count ) ; } if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Count: " + count ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getSharedLock" ) ; |
public class GobblinConstructorUtils { /** * Utility method to create an instance of < code > clsName < / code > using the constructor matching the arguments , < code > args < / code >
* @ param superType of < code > clsName < / code > . The new instance is cast to superType
* @ param clsName complete cannonical name of the class to be instantiated
* @ param args constructor args to be used
* @ throws IllegalArgumentException if there was an issue creating the instance due to
* { @ link NoSuchMethodException } , { @ link InvocationTargetException } , { @ link InstantiationException } ,
* { @ link ClassNotFoundException }
* @ return A new instance of < code > clsName < / code > */
@ SuppressWarnings ( "unchecked" ) public static < T > T invokeConstructor ( final Class < T > superType , final String clsName , Object ... args ) { } } | try { return ( T ) ConstructorUtils . invokeConstructor ( Class . forName ( clsName ) , args ) ; } catch ( NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException | ClassNotFoundException e ) { throw new IllegalArgumentException ( e ) ; } |
public class SessionImpl { /** * Check for possible expiration of this existing session . This will
* update the last access time if still valid , and changes the isNew
* flag to false if not already ( since we now know the client has
* re - used the session information ) . This will return true if the
* session is expired or false if still valid . The caller should
* start the invalidation process if this returned true .
* @ param updateAccessTime
* @ return boolean */
public boolean checkExpiration ( boolean updateAccessTime ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "checkExpiration: " + this ) ; } if ( isInvalid ( ) ) { // we ' re marked invalid already
return true ; } long now = System . currentTimeMillis ( ) ; if ( ( NO_TIMEOUT == this . maxInactiveTime ) || ( this . maxInactiveTime > ( now - this . lastAccesss ) ) ) { // still valid session
if ( updateAccessTime ) { this . isNew = false ; this . lastAccesss = now ; } return false ; } return true ; |
public class ProbeManagerImpl { /** * Determine if the named class is one that should be excluded from
* monitoring via probe injection . The patterns below generally
* include classes required to implement JVM function on which the
* monitoring code depends .
* @ param className the internal name of the class */
public boolean isExcludedClass ( String className ) { } } | // We rely heavily on reflection to deliver probes
if ( className . startsWith ( "java/lang/reflect" ) ) { return true ; } // Miscellaneous sun . misc classes
if ( className . startsWith ( "sun/misc" ) ) { return true ; } // Sun VM generated accessors wreak havoc
if ( className . startsWith ( "sun/reflect" ) ) { return true ; } // IBM J9 VM internals
if ( className . startsWith ( "com/ibm/oti/" ) ) { return true ; } // Don ' t allow hooking into the monitoring code
if ( className . startsWith ( "com/ibm/ws/monitor/internal" ) ) { return true ; } if ( className . startsWith ( "com/ibm/websphere/monitor" ) ) { return true ; } if ( className . startsWith ( "com/ibm/ws/boot/delegated/monitoring" ) ) { return true ; } if ( ( className . startsWith ( "com/ibm/ws/pmi" ) ) || ( className . startsWith ( "com/ibm/websphere/pmi" ) ) || ( className . startsWith ( "com/ibm/wsspi/pmi" ) ) ) { return true ; } // D89497 - Excluding those classes which are not part of the Set .
if ( ( ! ( probeMonitorSet . contains ( ( className . replace ( "/" , "." ) ) ) ) ) ) { return true ; } return false ; |
public class MasterSlaveTopologyRefresh { /** * Load master replica nodes . Result contains an ordered list of { @ link RedisNodeDescription } s . The sort key is the latency .
* Nodes with lower latency come first .
* @ param seed collection of { @ link RedisURI } s
* @ return mapping between { @ link RedisURI } and { @ link Partitions } */
public Mono < List < RedisNodeDescription > > getNodes ( RedisURI seed ) { } } | CompletableFuture < List < RedisNodeDescription > > future = topologyProvider . getNodesAsync ( ) ; Mono < List < RedisNodeDescription > > initialNodes = Mono . fromFuture ( future ) . doOnNext ( nodes -> { addPasswordIfNeeded ( nodes , seed ) ; } ) ; return initialNodes . map ( this :: getConnections ) . flatMap ( asyncConnections -> asyncConnections . asMono ( seed . getTimeout ( ) , eventExecutors ) ) . flatMap ( connections -> { Requests requests = connections . requestPing ( ) ; CompletionStage < List < RedisNodeDescription > > nodes = requests . getOrTimeout ( seed . getTimeout ( ) , eventExecutors ) ; return Mono . fromCompletionStage ( nodes ) . flatMap ( it -> ResumeAfter . close ( connections ) . thenEmit ( it ) ) ; } ) ; |
public class AnnotationProcessor { /** * Find mathing definition for same method . . .
* @ param add to search
* @ param method base
* @ return found definition or null if no match found */
private static RouteDefinition find ( Map < RouteDefinition , Method > add , Method method ) { } } | if ( add == null || add . size ( ) == 0 ) { return null ; } for ( RouteDefinition additional : add . keySet ( ) ) { Method match = add . get ( additional ) ; if ( isMatching ( method , match ) ) { return additional ; } } return null ; |
public class MAP { /** * Method to return the AP ( average precision ) value at a particular cutoff
* level for a given user .
* @ param user the user
* @ param at cutoff level
* @ return the AP ( average precision ) corresponding to the requested user at
* the cutoff level */
@ Override public double getValueAt ( final U user , final int at ) { } } | if ( userMAPAtCutoff . containsKey ( at ) && userMAPAtCutoff . get ( at ) . containsKey ( user ) ) { double map = userMAPAtCutoff . get ( at ) . get ( user ) ; return map ; } return Double . NaN ; |
public class StaxClientConfiguration { /** * Bootstrap mechanism that loads the configuration for the client object based
* on the specified configuration reading mechanism .
* The reference implementation of the configuration is XML - based , but this interface
* allows for whatever mechanism is desired
* @ param configurationReader desired configuration reader */
private ClientConfiguration loadConfiguration ( ClientConfigurationReader configurationReader ) throws ConfigurationException { } } | ClientConfiguration configuration = configurationReader . read ( ) ; return configuration ; |
public class ZoomablePane { /** * Replies the property that indicates the sensibility of the panning moves .
* The sensibility is a strictly positive number that is multiplied to the
* distance covered by the mouse motion for obtaining the move to
* apply to the document .
* The default value is 1.
* @ return the property . */
public DoubleProperty panSensitivityProperty ( ) { } } | if ( this . panSensitivity == null ) { this . panSensitivity = new StyleableDoubleProperty ( DEFAULT_PAN_SENSITIVITY ) { @ Override public void invalidated ( ) { if ( get ( ) <= MIN_PAN_SENSITIVITY ) { set ( MIN_PAN_SENSITIVITY ) ; } } @ Override public CssMetaData < ZoomablePane < ? > , Number > getCssMetaData ( ) { return StyleableProperties . PAN_SENSITIVITY ; } @ Override public Object getBean ( ) { return ZoomablePane . this ; } @ Override public String getName ( ) { return PAN_SENSITIVITY_PROPERTY ; } } ; } return this . panSensitivity ; |
public class Trigger { /** * Returns a subset of { @ link TriggerDescriptor } s that applys to the given item . */
public static List < TriggerDescriptor > for_ ( Item i ) { } } | List < TriggerDescriptor > r = new ArrayList < > ( ) ; for ( TriggerDescriptor t : all ( ) ) { if ( ! t . isApplicable ( i ) ) continue ; if ( i instanceof TopLevelItem ) { // ugly
TopLevelItemDescriptor tld = ( ( TopLevelItem ) i ) . getDescriptor ( ) ; // tld shouldn ' t be really null in contract , but we often write test Describables that
// doesn ' t have a Descriptor .
if ( tld != null && ! tld . isApplicable ( t ) ) continue ; } r . add ( t ) ; } return r ; |
public class JMJson { /** * With rest or file path or classpath t .
* @ param < T > the type parameter
* @ param resourceRestOrFilePathOrClasspath the resource rest or file path or classpath
* @ param typeReference the type reference
* @ return the t */
public static < T > T withRestOrFilePathOrClasspath ( String resourceRestOrFilePathOrClasspath , TypeReference < T > typeReference ) { } } | return withJsonString ( JMRestfulResource . getStringWithRestOrFilePathOrClasspath ( resourceRestOrFilePathOrClasspath ) , typeReference ) ; |
public class ByteUtils { /** * Compare a byte array ( b1 ) with a sub
* @ param b1 The first array
* @ param b2 The second array
* @ param offset The offset in b2 from which to compare
* @ param to The least offset in b2 which we don ' t compare
* @ return - 1 if b1 < b2 , 1 if b1 > b2 , and 0 if they are equal */
public static int compare ( byte [ ] b1 , byte [ ] b2 , int offset , int to ) { } } | int j = offset ; int b2Length = to - offset ; if ( to > b2 . length ) throw new IllegalArgumentException ( "To offset (" + to + ") should be <= than length (" + b2 . length + ")" ) ; for ( int i = 0 ; i < b1 . length && j < to ; i ++ , j ++ ) { int a = ( b1 [ i ] & 0xff ) ; int b = ( b2 [ j ] & 0xff ) ; if ( a != b ) { return ( a - b ) / ( Math . abs ( a - b ) ) ; } } return ( b1 . length - b2Length ) / ( Math . max ( 1 , Math . abs ( b1 . length - b2Length ) ) ) ; |
public class GreenMailUtil { /** * Create new multipart with a text part and an attachment
* @ param msg Message text
* @ param attachment Attachment data
* @ param contentType MIME content type of body
* @ param filename File name of the attachment
* @ param description Description of the attachment
* @ return New multipart */
public static MimeMultipart createMultipartWithAttachment ( String msg , final byte [ ] attachment , final String contentType , final String filename , String description ) { } } | try { MimeMultipart multiPart = new MimeMultipart ( ) ; MimeBodyPart textPart = new MimeBodyPart ( ) ; multiPart . addBodyPart ( textPart ) ; textPart . setText ( msg ) ; MimeBodyPart binaryPart = new MimeBodyPart ( ) ; multiPart . addBodyPart ( binaryPart ) ; DataSource ds = new DataSource ( ) { @ Override public InputStream getInputStream ( ) throws IOException { return new ByteArrayInputStream ( attachment ) ; } @ Override public OutputStream getOutputStream ( ) throws IOException { ByteArrayOutputStream byteStream = new ByteArrayOutputStream ( ) ; byteStream . write ( attachment ) ; return byteStream ; } @ Override public String getContentType ( ) { return contentType ; } @ Override public String getName ( ) { return filename ; } } ; binaryPart . setDataHandler ( new DataHandler ( ds ) ) ; binaryPart . setFileName ( filename ) ; binaryPart . setDescription ( description ) ; return multiPart ; } catch ( MessagingException e ) { throw new IllegalArgumentException ( "Can not create multipart message with attachment" , e ) ; } |
public class GeometryExpression { /** * / * ( non - Javadoc )
* @ see com . querydsl . core . types . dsl . SimpleExpression # eq ( com . querydsl . core . types . Expression ) */
@ Override public BooleanExpression eq ( Expression < ? super T > right ) { } } | return Expressions . booleanOperation ( SpatialOps . EQUALS , mixin , right ) ; |
public class ByteArrayWriter { /** * Encode an integer into a 4 byte array .
* @ param i
* @ return a byte [ 4 ] containing the encoded integer . */
public static byte [ ] encodeInt ( int i ) { } } | byte [ ] raw = new byte [ 4 ] ; raw [ 0 ] = ( byte ) ( i >> 24 ) ; raw [ 1 ] = ( byte ) ( i >> 16 ) ; raw [ 2 ] = ( byte ) ( i >> 8 ) ; raw [ 3 ] = ( byte ) ( i ) ; return raw ; |
public class CommandLineArgumentParser { /** * Expand any collection value that references a filename that ends in one of the accepted expansion
* extensions , and add the contents of the file to the list of values for that argument .
* @ param argumentDefinition ArgumentDefinition for the arg being populated
* @ param stringValue the argument value as presented on the command line
* @ param originalValuesForPreservation list of original values provided on the command line
* @ return a list containing the original entries in { @ code originalValues } , with any
* values from list files expanded in place , preserving both the original list order and
* the file order */
public List < String > expandFromExpansionFile ( final ArgumentDefinition argumentDefinition , final String stringValue , final List < String > originalValuesForPreservation ) { } } | List < String > expandedValues = new ArrayList < > ( ) ; if ( EXPANSION_FILE_EXTENSIONS . stream ( ) . anyMatch ( ext -> stringValue . endsWith ( ext ) ) ) { // If any value provided for this argument is an expansion file , expand it in place ,
// but preserve the original values for subsequent retrieval during command line
// display , since expansion files can result in very large post - expansion command lines
// ( its harmless to update this multiple times ) .
expandedValues . addAll ( loadCollectionListFile ( stringValue ) ) ; argumentDefinition . setOriginalCommandLineValues ( originalValuesForPreservation ) ; } else { expandedValues . add ( stringValue ) ; } return expandedValues ; |
public class RetentionSet { /** * Find retention record on or before the given time .
* @ param time time
* @ return reference record which is greatest lower bound for given time . It returns null if no such record exists in the set . */
public StreamCutReferenceRecord findStreamCutReferenceForTime ( long time ) { } } | int beforeIndex = getGreatestLowerBound ( this , time , StreamCutReferenceRecord :: getRecordingTime ) ; if ( beforeIndex < 0 ) { return null ; } return retentionRecords . get ( beforeIndex ) ; |
public class CmsDriverManager { /** * Return a cache key build from the provided information . < p >
* @ param prefix a prefix for the key
* @ param flag a boolean flag for the key ( only used if prefix is not null )
* @ param projectId the project for which to generate the key
* @ param resource the resource for which to generate the key
* @ return String a cache key build from the provided information */
private String getCacheKey ( String prefix , boolean flag , CmsUUID projectId , String resource ) { } } | StringBuffer b = new StringBuffer ( 64 ) ; if ( prefix != null ) { b . append ( prefix ) ; b . append ( flag ? '+' : '-' ) ; } b . append ( CmsProject . isOnlineProject ( projectId ) ? '+' : '-' ) ; return b . append ( resource ) . toString ( ) ; |
public class JSONArray { /** * 将JSON内容写入Writer
* @ param writer writer
* @ param indentFactor 缩进因子 , 定义每一级别增加的缩进量
* @ param indent 本级别缩进量
* @ return Writer
* @ throws IOException IO相关异常 */
private Writer doWrite ( Writer writer , int indentFactor , int indent ) throws IOException { } } | writer . write ( CharUtil . BRACKET_START ) ; final int newindent = indent + indentFactor ; final boolean isIgnoreNullValue = this . config . isIgnoreNullValue ( ) ; boolean isFirst = true ; for ( Object obj : this . rawList ) { if ( ObjectUtil . isNull ( obj ) && isIgnoreNullValue ) { continue ; } if ( isFirst ) { isFirst = false ; } else { writer . write ( CharUtil . COMMA ) ; } if ( indentFactor > 0 ) { writer . write ( CharUtil . LF ) ; } InternalJSONUtil . indent ( writer , newindent ) ; InternalJSONUtil . writeValue ( writer , obj , indentFactor , newindent , this . config ) ; } if ( indentFactor > 0 ) { writer . write ( CharUtil . LF ) ; } InternalJSONUtil . indent ( writer , indent ) ; writer . write ( CharUtil . BRACKET_END ) ; return writer ; |
public class WebserviceDescriptionMetaData { /** * Serialize as a String
* @ return string */
public String serialize ( ) { } } | StringBuilder buffer = new StringBuilder ( "<webservice-description>" ) ; buffer . append ( "<webservice-description-name>" ) . append ( webserviceDescriptionName ) . append ( "</webservice-description-name>" ) ; buffer . append ( "<wsdl-file>" ) . append ( wsdlFile ) . append ( "</wsdl-file>" ) ; buffer . append ( "<jaxrpc-mapping-file>" ) . append ( jaxrpcMappingFile ) . append ( "</jaxrpc-mapping-file>" ) ; for ( PortComponentMetaData pm : portComponents ) buffer . append ( pm . serialize ( ) ) ; buffer . append ( "</webservice-description>" ) ; return buffer . toString ( ) ; |
public class RotationAxis { /** * Returns the rotation axis and angle in a single javax . vecmath . AxisAngle4d object
* @ return */
public AxisAngle4d getAxisAngle4d ( ) { } } | return new AxisAngle4d ( rotationAxis . getX ( ) , rotationAxis . getY ( ) , rotationAxis . getZ ( ) , theta ) ; |
public class FldExporter { /** * Parses the string into a list of values unless the string starts with ` # `
* @ param values is a space - separated set of values
* @ return a vector of values */
public List < Double > parse ( String values ) { } } | List < Double > inputValues = new ArrayList < Double > ( ) ; if ( ! ( values . isEmpty ( ) || values . charAt ( 0 ) == '#' ) ) { StringTokenizer tokenizer = new StringTokenizer ( values ) ; while ( tokenizer . hasMoreTokens ( ) ) { inputValues . add ( Op . toDouble ( tokenizer . nextToken ( ) ) ) ; } } return inputValues ; |
public class current_timezone { /** * Use this API to fetch filtered set of current _ timezone resources .
* filter string should be in JSON format . eg : " vm _ state : DOWN , name : [ a - z ] + " */
public static current_timezone [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | current_timezone obj = new current_timezone ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; current_timezone [ ] response = ( current_timezone [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class RuleModel { /** * Add metaData
* @ param metadata */
public void addMetadata ( final RuleMetadata metadata ) { } } | final RuleMetadata [ ] newList = new RuleMetadata [ this . metadataList . length + 1 ] ; for ( int i = 0 ; i < this . metadataList . length ; i ++ ) { newList [ i ] = this . metadataList [ i ] ; } newList [ this . metadataList . length ] = metadata ; this . metadataList = newList ; |
public class UIContainer { /** * Gets the { @ link UIComponent } matching the specified name . If recursive is true , looks for the { @ code UIComponent } inside it child
* { @ link UIContainer } too .
* @ param name the name
* @ param recursive if true , look inside child { @ code UIContainer }
* @ return the component */
public UIComponent getComponent ( String name , boolean recursive ) { } } | if ( StringUtils . isEmpty ( name ) ) return null ; for ( UIComponent c : content . components ) { if ( name . equals ( c . getName ( ) ) ) return c ; } if ( ! recursive ) return null ; for ( UIComponent c : content . components ) { if ( c instanceof UIContainer ) { UIComponent found = getComponent ( name , true ) ; if ( found != null ) return found ; } } return null ; |
public class FileUtils { /** * Tell whether a string ends with a particular suffix , with case sensitivity determined by the operating system .
* @ param str the String to test .
* @ param suffix the suffix to look for .
* @ return < code > true < / code > when :
* < ul >
* < li > < code > str < / code > ends with < code > suffix < / code > , or , < / li >
* < li > the operating system is not case - sensitive with regard to file names , and < code > str < / code > ends with
* < code > suffix < / code > , ignoring case . < / li >
* < / ul >
* @ see # isOSCaseSensitive ( ) */
public static boolean osSensitiveEndsWith ( String str , String suffix ) { } } | if ( OS_CASE_SENSITIVE ) { return str . endsWith ( suffix ) ; } else { int strLen = str . length ( ) ; int suffixLen = suffix . length ( ) ; if ( strLen < suffixLen ) { return false ; } return ( str . substring ( strLen - suffixLen ) . equalsIgnoreCase ( suffix ) ) ; } |
public class SslCertificateUtils { /** * Tells whether or not the given ( { @ code . pem } file ) contents contain a section with the given begin and end tokens .
* @ param contents the ( { @ code . pem } file ) contents to check if contains the section .
* @ param beginToken the begin token of the section .
* @ param endToken the end token of the section .
* @ return { @ code true } if the section was found , { @ code false } otherwise . */
private static boolean containsSection ( String contents , String beginToken , String endToken ) { } } | int idxToken ; if ( ( idxToken = contents . indexOf ( beginToken ) ) == - 1 || contents . indexOf ( endToken ) < idxToken ) { return false ; } return true ; |
public class SGraphPoint { /** * Add the given segments in the connection .
* @ param segments the segments to add . */
void add ( Iterable < SGraphSegment > segments ) { } } | for ( final SGraphSegment segment : segments ) { this . segments . add ( segment ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.