signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AbstractKeyCodeAction { /** * TODO [ larmic ] find a better way */
private UIForm getForm ( UIComponent component ) { } } | while ( component != null ) { if ( component instanceof UIForm ) { break ; } component = component . getParent ( ) ; } return ( UIForm ) component ; |
public class MediaApi { /** * Start monitoring an agent
* Start supervisor monitoring of an agent on the specified media channel . When a monitored agent accepts a chat , the supervisor also receives the chat and all related notifications . If the agent is currently in a chat , the supervisor is added to the agent & # 39 ; s next chat . The supervisor can & # 39 ; t send messages in this mode and only another supervisor can see that the monitoring supervisor joined the chat . If the monitored agent leaves the chat but another agent is still present , the supervisor continues monitoring the chat until it & # 39 ; s completed or placed in a queue . Once you & # 39 ; ve enabled monitoring , you can change the monitoring mode using [ / media / { mediatype } / interactions / { id } / switch - to - barge - in ] ( / reference / workspace / Media / index . html # mediaSwicthToBargeIn ) , [ / media / { mediatype } / interactions / { id } / switch - to - coach ] ( / reference / workspace / Media / index . html # mediaSwicthToCoach ) , and [ / media / { mediatype } / interactions / { id } / switch - to - monitor ] ( / reference / workspace / Media / index . html # mediaSwicthToMonitor ) .
* @ param mediatype The media channel . ( required )
* @ param mediaStartMonitoringData Request parameters . ( optional )
* @ return ApiSuccessResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiSuccessResponse mediaStartMonitoring ( String mediatype , MediaStartMonitoringData mediaStartMonitoringData ) throws ApiException { } } | ApiResponse < ApiSuccessResponse > resp = mediaStartMonitoringWithHttpInfo ( mediatype , mediaStartMonitoringData ) ; return resp . getData ( ) ; |
public class BlobContainersInner { /** * Aborts an unlocked immutability policy . The response of delete has immutabilityPeriodSinceCreationInDays set to 0 . ETag in If - Match is required for this operation . Deleting a locked immutability policy is not allowed , only way is to delete the container after deleting all blobs inside the container .
* @ param resourceGroupName The name of the resource group within the user ' s subscription . The name is case insensitive .
* @ param accountName The name of the storage account within the specified resource group . Storage account names must be between 3 and 24 characters in length and use numbers and lower - case letters only .
* @ param containerName The name of the blob container within the specified storage account . Blob container names must be between 3 and 63 characters in length and use numbers , lower - case letters and dash ( - ) only . Every dash ( - ) character must be immediately preceded and followed by a letter or number .
* @ param ifMatch The entity state ( ETag ) version of the immutability policy to update . A value of " * " can be used to apply the operation only if the immutability policy already exists . If omitted , this operation will always be applied .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the ImmutabilityPolicyInner object if successful . */
public ImmutabilityPolicyInner deleteImmutabilityPolicy ( String resourceGroupName , String accountName , String containerName , String ifMatch ) { } } | return deleteImmutabilityPolicyWithServiceResponseAsync ( resourceGroupName , accountName , containerName , ifMatch ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ZoomableGraphicsContext { /** * Adds segments to the current path to make a quadratic Bezier curve .
* The coordinates are transformed by the current transform as they are
* added to the path and unaffected by subsequent changes to the transform .
* The current path is a path attribute
* used for any of the path methods as specified in the
* Rendering Attributes Table of { @ link GraphicsContext }
* and < b > is not affected < / b > by the { @ link # save ( ) } and
* { @ link # restore ( ) } operations .
* @ param xc the X coordinate of the control point
* @ param yc the Y coordinate of the control point
* @ param x1 the X coordinate of the end point
* @ param y1 the Y coordinate of the end point */
public void quadraticCurveTo ( double xc , double yc , double x1 , double y1 ) { } } | this . gc . quadraticCurveTo ( doc2fxX ( xc ) , doc2fxY ( yc ) , doc2fxX ( x1 ) , doc2fxY ( y1 ) ) ; |
public class ResponseCollector { /** * Waits until all responses have been received , or until a timeout has elapsed .
* @ param timeout Number of milliseconds to wait max . This value needs to be greater than 0 , or else
* it will be adjusted to 2000
* @ return boolean True if all responses have been received within timeout ms , else false ( e . g . if interrupted ) */
public boolean waitForAllResponses ( long timeout ) { } } | if ( timeout <= 0 ) timeout = 2000L ; return cond . waitFor ( this :: hasAllResponses , timeout , TimeUnit . MILLISECONDS ) ; |
public class PublishLayerVersionResult { /** * The layer ' s compatible runtimes .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setCompatibleRuntimes ( java . util . Collection ) } or { @ link # withCompatibleRuntimes ( java . util . Collection ) } if
* you want to override the existing values .
* @ param compatibleRuntimes
* The layer ' s compatible runtimes .
* @ return Returns a reference to this object so that method calls can be chained together .
* @ see Runtime */
public PublishLayerVersionResult withCompatibleRuntimes ( String ... compatibleRuntimes ) { } } | if ( this . compatibleRuntimes == null ) { setCompatibleRuntimes ( new com . amazonaws . internal . SdkInternalList < String > ( compatibleRuntimes . length ) ) ; } for ( String ele : compatibleRuntimes ) { this . compatibleRuntimes . add ( ele ) ; } return this ; |
public class SimpleFormatter { /** * / * [ deutsch ]
* < p > Erzeugt ein neues Format - Objekt f & uuml ; r reine Datumsobjekte mit Hilfe des angegebenen Musters
* in der angegebenen Sprach - und L & auml ; ndereinstellung . < / p >
* < p > Das Formatmuster wird nur beim Formatieren oder Interpretieren gepr & uuml ; ft . < / p >
* @ param pattern format definition as pattern as defined by { @ code SimpleDateFormat }
* @ param locale locale setting
* @ return format object for formatting { @ code PlainDate } - objects using given locale
* @ since 5.0 */
public static SimpleFormatter < PlainDate > ofDatePattern ( String pattern , Locale locale ) { } } | return new SimpleFormatter < > ( PlainDate . class , pattern , locale , Leniency . SMART , null ) ; |
public class ByteUtil { /** * Converts a int value into a byte array .
* @ param val
* - int value to convert
* @ return value with leading byte that are zeroes striped */
public static byte [ ] intToBytesNoLeadZeroes ( int val ) { } } | if ( val == 0 ) return EMPTY_BYTE_ARRAY ; int lenght = 0 ; int tmpVal = val ; while ( tmpVal != 0 ) { tmpVal = tmpVal >>> 8 ; ++ lenght ; } byte [ ] result = new byte [ lenght ] ; int index = result . length - 1 ; while ( val != 0 ) { result [ index ] = ( byte ) ( val & 0xFF ) ; val = val >>> 8 ; index -= 1 ; } return result ; |
public class SwaggerBuilder { /** * Registers a custom object model with Swagger . A model is only registered once .
* @ param swagger
* @ param modelClass
* @ return the Swagger ref of the model */
protected String registerModel ( Swagger swagger , Class < ? > modelClass ) { } } | final Tag modelTag = getModelTag ( modelClass ) ; final String ref = modelTag . getName ( ) ; if ( swagger . getDefinitions ( ) != null && swagger . getDefinitions ( ) . containsKey ( ref ) ) { // model already registered
return ref ; } ModelImpl model = new ModelImpl ( ) ; swagger . addDefinition ( modelTag . getName ( ) , model ) ; if ( ! Strings . isNullOrEmpty ( modelTag . getDescription ( ) ) ) { model . setDescription ( modelTag . getDescription ( ) ) ; } // document any exposed model properties
for ( Field field : ClassUtil . getAllFields ( modelClass ) ) { if ( field . isAnnotationPresent ( Undocumented . class ) ) { // undocumented field , skip
continue ; } if ( ! field . isAnnotationPresent ( ApiProperty . class ) && ! field . isAnnotationPresent ( Param . class ) ) { // not a documented model property
continue ; } Property property ; Class < ? > fieldType = field . getType ( ) ; if ( fieldType . isArray ( ) ) { // ARRAY
Class < ? > componentType = fieldType . getComponentType ( ) ; Property componentProperty = getSwaggerProperty ( swagger , componentType ) ; ArrayProperty arrayProperty = new ArrayProperty ( ) ; arrayProperty . setItems ( componentProperty ) ; property = arrayProperty ; } else if ( Collection . class . isAssignableFrom ( fieldType ) ) { // COLLECTION
Class < ? > componentClass = ClassUtil . getGenericType ( field ) ; Property componentProperty = getSwaggerProperty ( swagger , componentClass ) ; ArrayProperty arrayProperty = new ArrayProperty ( ) ; arrayProperty . setItems ( componentProperty ) ; if ( Set . class . isAssignableFrom ( fieldType ) ) { arrayProperty . setUniqueItems ( true ) ; } property = arrayProperty ; } else { // OBJECT
property = getSwaggerProperty ( swagger , fieldType ) ; } property . setRequired ( field . isAnnotationPresent ( Required . class ) || field . isAnnotationPresent ( NotNull . class ) ) ; if ( field . isAnnotationPresent ( ApiProperty . class ) ) { ApiProperty apiProperty = field . getAnnotation ( ApiProperty . class ) ; if ( ! Strings . isNullOrEmpty ( apiProperty . name ( ) ) ) { property . setName ( apiProperty . name ( ) ) ; } property . setDescription ( translate ( apiProperty . descriptionKey ( ) , apiProperty . description ( ) ) ) ; if ( ! Strings . isNullOrEmpty ( apiProperty . example ( ) ) ) { property . setExample ( apiProperty . example ( ) ) ; } if ( ! Strings . isNullOrEmpty ( apiProperty . defaultValue ( ) ) ) { property . setDefault ( apiProperty . defaultValue ( ) ) ; } if ( apiProperty . readOnly ( ) ) { property . setReadOnly ( true ) ; } } String name = prepareParameterName ( Optional . fromNullable ( property . getName ( ) ) . or ( field . getName ( ) ) ) ; property . setName ( name ) ; model . addProperty ( name , property ) ; } return ref ; |
public class JasperReportsUtil { /** * public static JasperPrint fillReport ( File jasper , Map params , Connection conn ) throws Exception {
* FileInputStream input = new FileInputStream ( jasper ) ;
* return JasperFillManager . fillReport ( input , params , conn ) ; */
public static byte [ ] getPdf ( JasperPrint jasperPrint ) throws JRException { } } | byte [ ] content = null ; ByteArrayOutputStream baos = null ; try { baos = new ByteArrayOutputStream ( ) ; JRPdfExporter exporter = new JRPdfExporter ( ) ; content = getBytes ( exporter , baos , jasperPrint ) ; } finally { if ( baos != null ) { try { baos . flush ( ) ; baos . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } return content ; |
public class IfcElementImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < IfcRelCoversBldgElements > getHasCoverings ( ) { } } | return ( EList < IfcRelCoversBldgElements > ) eGet ( Ifc2x3tc1Package . Literals . IFC_ELEMENT__HAS_COVERINGS , true ) ; |
public class ByteVector { /** * Return the current byte array containing the bytes .
* @ return a copy of the byte array */
public byte [ ] getBytes ( ) { } } | if ( ! changed ) { return buf ; } byte [ ] newBuf = new byte [ bufLen ] ; System . arraycopy ( buf , 0 , newBuf , 0 , bufLen ) ; buf = newBuf ; return buf ; |
public class Entity { /** * Get a total of an attribute thru a multi - relation possibly slicing by a
* filter .
* @ param multiRelationName
* @ param filter
* @ param numericAttributeName
* @ return total of an attribute . */
Double getSum ( String multiRelationName , EntityFilter filter , String numericAttributeName ) { } } | return instance . getSum ( this , multiRelationName , filter , numericAttributeName ) ; |
public class MethodInvocationTrap { /** * Converts a ClosureExpression into the String source .
* @ param expression a closure
* @ return the source the closure was created from */
protected String convertClosureToSource ( ClosureExpression expression ) { } } | try { return ClosureUtils . convertClosureToSource ( source , expression ) ; } catch ( Exception e ) { addError ( e . getMessage ( ) , expression ) ; } return null ; |
public class TechnologyTargeting { /** * Sets the browserLanguageTargeting value for this TechnologyTargeting .
* @ param browserLanguageTargeting * The languages of browsers being targeted by the { @ link LineItem } . */
public void setBrowserLanguageTargeting ( com . google . api . ads . admanager . axis . v201805 . BrowserLanguageTargeting browserLanguageTargeting ) { } } | this . browserLanguageTargeting = browserLanguageTargeting ; |
public class ChangeControl { /** * Returns true if the requested property is set ; false , otherwise .
* @ return
* returned object is { @ link boolean } */
@ Override public boolean isSet ( String propName ) { } } | if ( propName . equals ( "checkPoint" ) ) { return isSetCheckPoint ( ) ; } if ( propName . equals ( "changeTypes" ) ) { return isSetChangeTypes ( ) ; } return super . isSet ( propName ) ; |
public class FormatReaderComposite { /** * public static FormatReaderComposite basicArrayReader ( String input , String arrayDelimiter , String ignore ) {
* return new FormatReaderComposite ( input , new HandlerArrayFromDelimited ( arrayDelimiter ) . ignore ( ignore ) ) ; */
public static FormatReaderComposite basicArrayReader ( String input , String arrayDelimiter ) { } } | return new FormatReaderComposite ( input , new HandlerArrayFromDelimited ( arrayDelimiter ) ) ; |
public class UserAPI { /** * 获取关注者列表
* @ param nextOpenid 下一个用户的ID
* @ return 关注者列表对象 */
public GetUsersResponse getUsers ( String nextOpenid ) { } } | GetUsersResponse response ; LOG . debug ( "获取关注者列表....." ) ; String url = BASE_API_URL + "cgi-bin/user/get?access_token=#" ; if ( StrUtil . isNotBlank ( nextOpenid ) ) { url += "&next_openid=" + nextOpenid ; } BaseResponse r = executeGet ( url ) ; String resultJson = isSuccess ( r . getErrcode ( ) ) ? r . getErrmsg ( ) : r . toJsonString ( ) ; response = JSONUtil . toBean ( resultJson , GetUsersResponse . class ) ; return response ; |
public class TapClient { /** * Shuts down all tap streams that are currently running . */
public void shutdown ( ) { } } | synchronized ( omap ) { for ( Map . Entry < TapStream , TapConnectionProvider > me : omap . entrySet ( ) ) { me . getValue ( ) . shutdown ( ) ; } } |
public class StackTraceSampleCoordinator { /** * Collects stack traces of a task .
* @ param sampleId ID of the sample .
* @ param executionId ID of the sampled task .
* @ param stackTraces Stack traces of the sampled task .
* @ throws IllegalStateException If unknown sample ID and not recently
* finished or cancelled sample . */
public void collectStackTraces ( int sampleId , ExecutionAttemptID executionId , List < StackTraceElement [ ] > stackTraces ) { } } | synchronized ( lock ) { if ( isShutDown ) { return ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Collecting stack trace sample {} of task {}" , sampleId , executionId ) ; } PendingStackTraceSample pending = pendingSamples . get ( sampleId ) ; if ( pending != null ) { pending . collectStackTraces ( executionId , stackTraces ) ; // Publish the sample
if ( pending . isComplete ( ) ) { pendingSamples . remove ( sampleId ) ; rememberRecentSampleId ( sampleId ) ; pending . completePromiseAndDiscard ( ) ; } } else if ( recentPendingSamples . contains ( sampleId ) ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Received late stack trace sample {} of task {}" , sampleId , executionId ) ; } } else { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Unknown sample ID " + sampleId ) ; } } } |
public class CPOptionPersistenceImpl { /** * Returns the cp option with the primary key or throws a { @ link com . liferay . portal . kernel . exception . NoSuchModelException } if it could not be found .
* @ param primaryKey the primary key of the cp option
* @ return the cp option
* @ throws NoSuchCPOptionException if a cp option with the primary key could not be found */
@ Override public CPOption findByPrimaryKey ( Serializable primaryKey ) throws NoSuchCPOptionException { } } | CPOption cpOption = fetchByPrimaryKey ( primaryKey ) ; if ( cpOption == null ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } throw new NoSuchCPOptionException ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } return cpOption ; |
public class SourceLineAnnotation { /** * Create from Method and bytecode offset in a visited class .
* @ param classContext
* ClassContext of visited class
* @ param method
* Method in visited class
* @ param pc
* bytecode offset in visited method
* @ return SourceLineAnnotation describing visited instruction */
public static SourceLineAnnotation fromVisitedInstruction ( ClassContext classContext , Method method , int pc ) { } } | return fromVisitedInstruction ( classContext . getJavaClass ( ) , method , pc ) ; |
public class LocalDateIteratorFactory { /** * given a block of RRULE , EXRULE , RDATE , and EXDATE content lines , parse
* them into a single local date iterable .
* @ param rdata RRULE , EXRULE , RDATE , and EXDATE lines .
* @ param start the first occurrence of the series .
* @ param strict true if any failure to parse should result in a
* ParseException . false causes bad content lines to be logged and ignored . */
public static LocalDateIterable createLocalDateIterable ( String rdata , LocalDate start , boolean strict ) throws ParseException { } } | return createLocalDateIterable ( rdata , start , DateTimeZone . UTC , strict ) ; |
public class AbstractProtoParserListener { /** * Remove common leading whitespaces from all strings in the list .
* Returns new list instance . */
protected List < String > trim ( List < String > comments ) { } } | List < String > trimComments = new ArrayList < > ( ) ; int n = 0 ; boolean tryRemoveWhitespace = true ; while ( tryRemoveWhitespace ) { boolean allLinesAreShorter = true ; for ( String comment : comments ) { if ( comment . length ( ) <= n ) { continue ; } if ( comment . charAt ( n ) != ' ' ) { tryRemoveWhitespace = false ; } allLinesAreShorter = false ; } if ( allLinesAreShorter ) { break ; } if ( tryRemoveWhitespace ) { n ++ ; } } for ( String comment : comments ) { if ( comment . length ( ) > n ) { String substring = comment . substring ( n ) ; trimComments . add ( substring ) ; } else { trimComments . add ( "" ) ; } } return trimComments ; |
public class XmlEmit { /** * / * Write out the tag name , adding the ns abbreviation .
* Also add the namespace declarations if this is the first tag
* @ param tag
* @ throws IOException */
private void emitQName ( final QName tag ) throws IOException { } } | nameSpaces . emitNsAbbr ( tag . getNamespaceURI ( ) , wtr ) ; out ( tag . getLocalPart ( ) ) ; emitNs ( ) ; |
public class SeekBarPreference { /** * Obtains the unit , which is used for textual representation of the preference ' s value , from a
* specific typed array .
* @ param typedArray
* The typed array , the unit should be obtained from , as an instance of the class { @ link
* TypedArray } . The typed array may not be null */
private void obtainUnit ( @ NonNull final TypedArray typedArray ) { } } | setUnit ( typedArray . getText ( R . styleable . AbstractUnitPreference_unit ) ) ; |
public class WhileyFileParser { /** * Parse a logical expression of the form :
* < pre >
* Expr : : = AndOrExpr [ " = = > " UnitExpr ]
* < / pre >
* @ param scope
* The enclosing scope for this statement , which determines the
* set of visible ( i . e . declared ) variables and also the current
* indentation level .
* @ param terminated
* This indicates that the expression is known to be terminated
* ( or not ) . An expression that ' s known to be terminated is one
* which is guaranteed to be followed by something . This is
* important because it means that we can ignore any newline
* characters encountered in parsing this expression , and that
* we ' ll never overrun the end of the expression ( i . e . because
* there ' s guaranteed to be something which terminates this
* expression ) . A classic situation where terminated is true is
* when parsing an expression surrounded in braces . In such case ,
* we know the right - brace will always terminate this expression .
* @ return */
private Expr parseLogicalExpression ( EnclosingScope scope , boolean terminated ) { } } | checkNotEof ( ) ; int start = index ; Expr lhs = parseAndOrExpression ( scope , terminated ) ; Token lookahead = tryAndMatch ( terminated , LogicalImplication , LogicalIff ) ; if ( lookahead != null ) { switch ( lookahead . kind ) { case LogicalImplication : { Expr rhs = parseExpression ( scope , terminated ) ; lhs = new Expr . LogicalImplication ( lhs , rhs ) ; break ; } case LogicalIff : { Expr rhs = parseExpression ( scope , terminated ) ; lhs = new Expr . LogicalIff ( lhs , rhs ) ; break ; } default : throw new RuntimeException ( "deadcode" ) ; // dead - code
} lhs = annotateSourceLocation ( lhs , start ) ; } return lhs ; |
public class PathHandler { /** * Initialize the log . */
@ PostConstruct public void init ( ) throws ConfigException { } } | try { _pathLog . init ( ) ; super . init ( ) ; WriteStream os = _pathLog . getRotateStream ( ) . getStream ( ) ; /* if ( _ timestamp ! = null ) {
_ timestampFilter = new TimestampFilter ( ) ;
_ timestampFilter . setTimestamp ( _ timestamp ) ; */
/* String encoding = System . getProperty ( " file . encoding " ) ;
if ( encoding ! = null ) {
os . setEncoding ( encoding ) ; */
// os . setDisableClose ( true ) ;
_os = os ; } catch ( IOException e ) { throw ConfigException . wrap ( e ) ; } |
public class ComponentClass { /** * Adds the supplied render priority override record to this component class . */
public void addPriorityOverride ( PriorityOverride override ) { } } | if ( _overrides == null ) { _overrides = new ComparableArrayList < PriorityOverride > ( ) ; } _overrides . insertSorted ( override ) ; |
public class TranStrategy { /** * This utility method attempts to resume the global transaction
* associated with the input control object . If it fails , an
* an exception consistent with the EJB exception conventions
* is thrown . < p > */
final void resumeGlobalTx ( Transaction control , int action ) // LIDB1673.2.1.5
throws CSIException { } } | try { txCtrl . resumeGlobalTx ( control , action ) ; // d165585 Begins
if ( TraceComponent . isAnyTracingEnabled ( ) && // d527372
TETxLifeCycleInfo . isTraceEnabled ( ) ) // PQ74774
{ // PQ74774
String idStr = txCtrl . txService . getTransaction ( ) . toString ( ) ; int idx ; idStr = ( idStr != null ) ? ( ( ( idx = idStr . indexOf ( "(" ) ) != - 1 ) ? idStr . substring ( idx + 1 , idStr . indexOf ( ")" ) ) : ( ( idx = idStr . indexOf ( "tid=" ) ) != - 1 ) ? idStr . substring ( idx + 4 ) : idStr ) : "NoTx" ; TETxLifeCycleInfo . traceGlobalTxResume ( idStr , "Resume Global Tx" ) ; } // PQ74774
// d165585 Ends
} catch ( Exception ex ) { // LIDB1673.2.1.5
FFDCFilter . processException ( ex , CLASS_NAME + ".resumeGlobalTx" , "335" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Global tx resume failed" , ex ) ; } throw new CSIException ( "" , ex ) ; } |
public class NumberFunctions { /** * Returned expression results in the arctangent of expression2 / expression1. */
public static Expression atan ( String expression1 , String expression2 ) { } } | return atan ( x ( expression1 ) , x ( expression2 ) ) ; |
public class ConsumerContainer { /** * Filters the consumers matching the given active flag from the list of managed consumers .
* @ param active Whether to filter for active or inactive consumers
* @ return The filtered consumers */
protected List < ConsumerHolder > filterConsumersForActiveFlag ( boolean active ) { } } | List < ConsumerHolder > consumerHolderSubList = new LinkedList < ConsumerHolder > ( ) ; for ( ConsumerHolder consumerHolder : consumerHolders ) { if ( consumerHolder . isActive ( ) == active ) { consumerHolderSubList . add ( consumerHolder ) ; } } return consumerHolderSubList ; |
public class N { /** * Inserts the specified elements at the specified position in the array .
* Shifts the element currently at that position ( if any ) and any subsequent
* elements to the right ( adds one to their indices ) .
* @ param a
* the first array whose elements are added to the new array .
* @ param index
* the position of the new elements start from
* @ param b
* the second array whose elements are added to the new array .
* @ return A new array containing the elements from a and b */
@ SafeVarargs public static boolean [ ] insertAll ( final boolean [ ] a , final int index , final boolean ... b ) { } } | if ( N . isNullOrEmpty ( a ) && index == 0 ) { return b . clone ( ) ; } final boolean [ ] newArray = new boolean [ a . length + b . length ] ; if ( index > 0 ) { copy ( a , 0 , newArray , 0 , index ) ; } copy ( b , 0 , newArray , index , b . length ) ; if ( index < a . length ) { copy ( a , index , newArray , index + b . length , a . length - index ) ; } return newArray ; |
public class GroovyCollections { /** * Finds all combinations of items from the given Iterable aggregate of collections .
* So , < code > combinations ( [ [ true , false ] , [ true , false ] ] ) < / code >
* is < code > [ [ true , true ] , [ false , true ] , [ true , false ] , [ false , false ] ] < / code >
* and < code > combinations ( [ [ ' a ' , ' b ' ] , [ 1 , 2 , 3 ] ] ) < / code >
* is < code > [ [ ' a ' , 1 ] , [ ' b ' , 1 ] , [ ' a ' , 2 ] , [ ' b ' , 2 ] , [ ' a ' , 3 ] , [ ' b ' , 3 ] ] < / code > .
* If a non - collection item is given , it is treated as a singleton collection ,
* i . e . < code > combinations ( [ [ 1 , 2 ] , ' x ' ] ) < / code > is < code > [ [ 1 , ' x ' ] , [ 2 , ' x ' ] ] < / code > .
* @ param collections the Iterable of given collections
* @ return a List of the combinations found
* @ since 2.2.0 */
public static List combinations ( Iterable collections ) { } } | List collectedCombos = new ArrayList ( ) ; for ( Object collection : collections ) { Iterable items = DefaultTypeTransformation . asCollection ( collection ) ; if ( collectedCombos . isEmpty ( ) ) { for ( Object item : items ) { List l = new ArrayList ( ) ; l . add ( item ) ; collectedCombos . add ( l ) ; } } else { List savedCombos = new ArrayList ( collectedCombos ) ; List newCombos = new ArrayList ( ) ; for ( Object value : items ) { for ( Object savedCombo : savedCombos ) { List oldList = new ArrayList ( ( List ) savedCombo ) ; oldList . add ( value ) ; newCombos . add ( oldList ) ; } } collectedCombos = newCombos ; } } return collectedCombos ; |
public class JsassServlet { /** * Resolve the target file for an { @ code @ import } directive .
* @ param url The { @ code import } url .
* @ param previous The file that contains the { @ code import } directive .
* @ return The resolve import objects or { @ code null } if the import file was not found . */
private Collection < Import > doImport ( String url , Import previous ) { } } | try { if ( url . startsWith ( "/" ) ) { // absolute imports are searched in / WEB - INF / scss
return resolveImport ( Paths . get ( "/WEB-INF/scss" ) . resolve ( url ) ) ; } // find in import paths
final List < Path > importPaths = new LinkedList < > ( ) ; // ( a ) relative to the previous import file
final String previousPath = previous . getAbsoluteUri ( ) . getPath ( ) ; final Path previousParentPath = Paths . get ( previousPath ) . getParent ( ) ; importPaths . add ( previousParentPath ) ; // ( b ) within / WEB - INF / assets / foundation
importPaths . add ( Paths . get ( "/WEB-INF/assets/foundation" ) ) ; // ( c ) within / WEB - INF / assets / motion - ui
importPaths . add ( Paths . get ( "/WEB-INF/assets/motion-ui" ) ) ; for ( Path importPath : importPaths ) { Path target = importPath . resolve ( url ) ; Collection < Import > imports = resolveImport ( target ) ; if ( null != imports ) { return imports ; } } // file not found
throw new FileNotFoundException ( url ) ; } catch ( URISyntaxException | IOException e ) { throw new RuntimeException ( e ) ; } |
public class ValueRange { /** * Obtains a fixed value range .
* This factory obtains a range where the minimum and maximum values are fixed .
* For example , the ISO month - of - year always runs from 1 to 12.
* @ param min the minimum value
* @ param max the maximum value
* @ return the ValueRange for min , max , not null
* @ throws IllegalArgumentException if the minimum is greater than the maximum */
public static ValueRange of ( long min , long max ) { } } | if ( min > max ) { throw new IllegalArgumentException ( "Minimum value must be less than maximum value" ) ; } return new ValueRange ( min , min , max , max ) ; |
public class DateIntervalInfo { /** * Check whether one field width is numeric while the other is string .
* TODO ( xji ) : make it general
* @ param fieldWidth one field width
* @ param anotherFieldWidth another field width
* @ param patternLetter pattern letter char
* @ return true if one field width is numeric and the other is string ,
* false otherwise . */
private static boolean stringNumeric ( int fieldWidth , int anotherFieldWidth , char patternLetter ) { } } | if ( patternLetter == 'M' ) { if ( fieldWidth <= 2 && anotherFieldWidth > 2 || fieldWidth > 2 && anotherFieldWidth <= 2 ) { return true ; } } return false ; |
public class MediaEndpoint { /** * Registers a listener for when the { @ link MediaElement } triggers an
* { @ link ErrorEvent } . Notifies the owner with the error .
* @ param element the { @ link MediaElement }
* @ return { @ link ListenerSubscription } that can be used to deregister the
* listener */
protected ListenerSubscription registerElemErrListener ( MediaElement element ) { } } | return element . addErrorListener ( new EventListener < ErrorEvent > ( ) { @ Override public void onEvent ( ErrorEvent event ) { owner . sendMediaError ( event ) ; } } ) ; |
public class URLIdentifier { /** * Load the structure from the URL
* @ return null */
@ Override public Structure loadStructure ( AtomCache cache ) throws StructureException , IOException { } } | StructureFiletype format = StructureFiletype . UNKNOWN ; // Use user - specified format
try { Map < String , String > params = parseQuery ( url ) ; if ( params . containsKey ( FORMAT_PARAM ) ) { String formatStr = params . get ( FORMAT_PARAM ) ; format = StructureIO . guessFiletype ( "." + formatStr ) ; } } catch ( UnsupportedEncodingException e ) { logger . error ( "Unable to decode URL " + url , e ) ; } // Guess format from extension
if ( format == StructureFiletype . UNKNOWN ) { format = StructureIO . guessFiletype ( url . getPath ( ) ) ; } switch ( format ) { case CIF : // need to do mmcif parsing !
InputStreamProvider prov = new InputStreamProvider ( ) ; InputStream inStream = prov . getInputStream ( url ) ; MMcifParser parser = new SimpleMMcifParser ( ) ; SimpleMMcifConsumer consumer = new SimpleMMcifConsumer ( ) ; consumer . setFileParsingParameters ( cache . getFileParsingParams ( ) ) ; parser . addMMcifConsumer ( consumer ) ; try { parser . parse ( new BufferedReader ( new InputStreamReader ( inStream ) ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } // now get the protein structure .
return consumer . getStructure ( ) ; default : case PDB : // pdb file based parsing
PDBFileReader reader = new PDBFileReader ( cache . getPath ( ) ) ; reader . setFetchBehavior ( cache . getFetchBehavior ( ) ) ; reader . setObsoleteBehavior ( cache . getObsoleteBehavior ( ) ) ; reader . setFileParsingParameters ( cache . getFileParsingParams ( ) ) ; return reader . getStructure ( url ) ; } |
public class BibliographyFileReader { /** * Reads the first bytes of the given input stream and tries to
* determine the file format . Resets the input stream to the position
* it had when the method was called . Reads up to 100 KB and before
* giving up . Note that you can supply an additional file name to help
* the method to determine the exact file format . If you don ' t know the
* file name you can pass null , but in this case the method ' s result
* might be wrong ( depending on the input stream ' s contents ) .
* @ param bis a buffered input stream that supports the mark and reset
* methods
* @ param filename the name of the input file ( can be null if you don ' t
* know the name )
* @ return the file format ( or { @ link FileFormat # UNKNOWN } if the format
* could not be determined )
* @ throws IOException if the input stream could not be read */
public FileFormat determineFileFormat ( BufferedInputStream bis , String filename ) throws IOException { } } | int len = 1024 * 100 ; String ext = "" ; if ( filename != null ) { int dot = filename . lastIndexOf ( '.' ) ; if ( dot > 0 ) { ext = filename . substring ( dot + 1 ) ; } } // check the first couple of bytes
bis . mark ( len ) ; try { byte [ ] firstCharacters = new byte [ 6 ] ; bis . read ( firstCharacters ) ; // check if the file starts with a % YAML directive
if ( firstCharacters [ 0 ] == '%' && firstCharacters [ 1 ] == 'Y' && firstCharacters [ 2 ] == 'A' && firstCharacters [ 3 ] == 'M' && firstCharacters [ 4 ] == 'L' && Character . isWhitespace ( firstCharacters [ 5 ] ) ) { return FileFormat . YAML ; } // check if the file starts with an EndNote tag , but
// also make sure the extension is not ' bib ' or ' yml ' / ' yaml '
// because BibTeX comments and YAML directives look like
// EndNote tags
if ( firstCharacters [ 0 ] == '%' && Character . isWhitespace ( firstCharacters [ 2 ] ) && ! ext . equalsIgnoreCase ( "bib" ) && ! ext . equalsIgnoreCase ( "yaml" ) && ! ext . equalsIgnoreCase ( "yml" ) ) { return FileFormat . ENDNOTE ; } // check if the file starts with a RIS type tag
if ( firstCharacters [ 0 ] == 'T' && firstCharacters [ 1 ] == 'Y' && Character . isWhitespace ( firstCharacters [ 2 ] ) && Character . isWhitespace ( firstCharacters [ 3 ] ) && firstCharacters [ 4 ] == '-' ) { return FileFormat . RIS ; } } finally { bis . reset ( ) ; } // now check if it ' s json , bibtex or yaml
bis . mark ( len ) ; try { while ( true ) { int c = bis . read ( ) ; -- len ; if ( c < 0 || len < 2 ) { return FileFormat . UNKNOWN ; } if ( ! Character . isWhitespace ( c ) ) { if ( c == '[' ) { return FileFormat . JSON_ARRAY ; } else if ( c == '{' ) { return FileFormat . JSON_OBJECT ; } if ( ext . equalsIgnoreCase ( "yaml" ) || ext . equalsIgnoreCase ( "yml" ) ) { return FileFormat . YAML ; } return FileFormat . BIBTEX ; } } } finally { bis . reset ( ) ; } |
public class AmBaseBolt { /** * Use anchor function ( child message failed . notify fail to parent message . ) , and not use this class ' s key history function . < br >
* Send message to downstream component with grouping key . < br >
* Use following situation .
* < ol >
* < li > Not use this class ' s key history function . < / li >
* < li > Use storm ' s fault detect function . < / li >
* < / ol >
* @ param message sending message
* @ param groupingKey grouping key */
protected void emitWithOnlyAnchorAndGrouping ( StreamMessage message , String groupingKey ) { } } | getCollector ( ) . emit ( this . getExecutingTuple ( ) , new Values ( groupingKey , message ) ) ; |
public class PingManager { /** * Ping the server if deemed necessary because automatic server pings are
* enabled ( { @ link # setPingInterval ( int ) } ) and the ping interval has expired . */
public void pingServerIfNecessary ( ) { } } | final XMPPConnection connection = connection ( ) ; if ( connection == null ) { // connection has been collected by GC
// which means we can stop the thread by breaking the loop
return ; } if ( pingInterval <= 0 ) { // Ping has been disabled
return ; } long lastStanzaReceived = connection . getLastStanzaReceived ( ) ; if ( lastStanzaReceived > 0 ) { long now = System . currentTimeMillis ( ) ; // Delta since the last stanza was received
int deltaInSeconds = ( int ) ( ( now - lastStanzaReceived ) / 1000 ) ; // If the delta is small then the ping interval , then we can defer the ping
if ( deltaInSeconds < pingInterval ) { maybeSchedulePingServerTask ( deltaInSeconds ) ; return ; } } if ( ! connection . isAuthenticated ( ) ) { LOGGER . warning ( connection + " was not authenticated" ) ; return ; } final long minimumTimeout = TimeUnit . MINUTES . toMillis ( 2 ) ; final long connectionReplyTimeout = connection . getReplyTimeout ( ) ; final long timeout = connectionReplyTimeout > minimumTimeout ? connectionReplyTimeout : minimumTimeout ; SmackFuture < Boolean , Exception > pingFuture = pingAsync ( connection . getXMPPServiceDomain ( ) , timeout ) ; pingFuture . onSuccess ( new SuccessCallback < Boolean > ( ) { @ Override public void onSuccess ( Boolean result ) { // Ping was successful , wind - up the periodic task again
maybeSchedulePingServerTask ( ) ; } } ) ; pingFuture . onError ( new ExceptionCallback < Exception > ( ) { @ Override public void processException ( Exception exception ) { long lastStanzaReceived = connection . getLastStanzaReceived ( ) ; if ( lastStanzaReceived > 0 ) { long now = System . currentTimeMillis ( ) ; // Delta since the last stanza was received
int deltaInSeconds = ( int ) ( ( now - lastStanzaReceived ) / 1000 ) ; // If the delta is smaller then the ping interval , we have got an valid stanza in time
// So not error notification needed
if ( deltaInSeconds < pingInterval ) { maybeSchedulePingServerTask ( deltaInSeconds ) ; return ; } } for ( PingFailedListener l : pingFailedListeners ) { l . pingFailed ( ) ; } } } ) ; |
public class OrientModelGraphUtils { /** * Gets the value for the given field of a graph object . */
public static String getFieldValue ( ODocument document , String fieldname ) { } } | return ( String ) document . field ( fieldname ) ; |
public class PageFlowUtils { /** * Set a named action output , which corresponds to an input declared by the < code > pageInput < / code > JSP tag .
* The actual value can be read from within a JSP using the < code > " pageInput " < / code > databinding context .
* @ deprecated Use { @ link # addActionOutput } instead .
* @ param name the name of the action output .
* @ param value the value of the action output .
* @ param request the current ServletRequest . */
public static void addPageInput ( String name , Object value , ServletRequest request ) { } } | addActionOutput ( name , value , request ) ; |
public class ExcelWriter { /** * 设置列宽 ( 单位为一个字符的宽度 , 例如传入width为10 , 表示10个字符的宽度 )
* @ param columnIndex 列号 ( 从0开始计数 , - 1表示所有列的默认宽度 )
* @ param width 宽度 ( 单位1 ~ 256个字符宽度 )
* @ return this
* @ since 4.0.8 */
public ExcelWriter setColumnWidth ( int columnIndex , int width ) { } } | if ( columnIndex < 0 ) { this . sheet . setDefaultColumnWidth ( width ) ; } else { this . sheet . setColumnWidth ( columnIndex , width * 256 ) ; } return this ; |
public class BeanHelper { /** * Applies bean action by using default factory .
* < p > Bean actions are :
* < p > List item property remove by adding ' # ' to the end of pattern .
* < p > E . g . list . 3 - same as list . remove ( 3)
* < p > List item property assign by adding ' = ' to the end of pattern
* < p > E . g . list . 3 = hint same as list . set ( 3 , factory . get ( cls , hint ) )
* < p > List item creation to the end of the list .
* < p > E . g . list + same as add ( factory . get ( cls , null ) )
* < p > E . g . list + hint same as add ( factory . get ( cls , hint ) )
* @ param < T >
* @ param base
* @ param fieldname
* @ return true if pattern was applied */
public static final < T > T applyList ( Object base , String fieldname ) { } } | return applyList ( base , fieldname , BeanHelper :: defaultFactory ) ; |
public class AtmosRequestMappingHandlerMapping { /** * convert httpMethods String array to RequestMethod array
* @ param httpMethods
* @ return */
private RequestMethodsRequestCondition getRequestMethodsRequestCondition ( String [ ] httpMethods ) { } } | RequestMethod [ ] requestMethods = new RequestMethod [ httpMethods . length ] ; for ( int i = 0 ; i < requestMethods . length ; i ++ ) { requestMethods [ i ] = RequestMethod . valueOf ( httpMethods [ i ] ) ; } return new RequestMethodsRequestCondition ( requestMethods ) ; |
public class ArrayFile { /** * Loads this ArrayFile into a memory - based long array .
* @ throws IOException */
public void load ( MemoryLongArray longArray ) throws IOException { } } | if ( ! _file . exists ( ) || _file . length ( ) == 0 ) { return ; } Chronos c = new Chronos ( ) ; DataReader r = IOFactory . createDataReader ( _file , _type ) ; try { r . open ( ) ; r . position ( DATA_START_POSITION ) ; for ( int i = 0 ; i < _arrayLength ; i ++ ) { longArray . set ( i , r . readLong ( ) ) ; } _log . info ( _file . getName ( ) + " loaded in " + c . getElapsedTime ( ) ) ; } finally { r . close ( ) ; } |
public class LocationIndexTree { /** * Searches also neighbouring tiles until the maximum distance from the query point is reached
* ( minResolutionInMeter * regionAround ) . Set to 1 for to force avoiding a fall back , good if you
* have strict performance and lookup - quality requirements . Default is 4. */
public LocationIndexTree setMaxRegionSearch ( int numTiles ) { } } | if ( numTiles < 1 ) throw new IllegalArgumentException ( "Region of location index must be at least 1 but was " + numTiles ) ; // see # 232
if ( numTiles % 2 == 1 ) numTiles ++ ; this . maxRegionSearch = numTiles ; return this ; |
public class NettyContainer { /** * / * horrible , looks like rubby */
private String [ ] extractBasicAuthCredentials ( String authorizationHeader ) { } } | if ( authorizationHeader == null ) { return null ; } String [ ] schemeUserPass = new String [ 3 ] ; String credentials ; final String [ ] headerParts = authorizationHeader . split ( " " ) ; if ( headerParts != null && headerParts . length == 2 ) { schemeUserPass [ 0 ] = headerParts [ 0 ] . equalsIgnoreCase ( "basic" ) ? SecurityContext . BASIC_AUTH : null ; credentials = Base64 . decodeAsString ( headerParts [ 1 ] ) ; final String [ ] userPass = credentials . split ( ":" ) ; if ( userPass != null && userPass . length == 2 ) { schemeUserPass [ 1 ] = userPass [ 0 ] . replaceAll ( "%40" , "@" ) ; schemeUserPass [ 2 ] = userPass [ 1 ] ; } return schemeUserPass ; } return null ; |
public class Matrix4x3d { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix4x3dc # transpose3x3 ( org . joml . Matrix4x3d ) */
public Matrix4x3d transpose3x3 ( Matrix4x3d dest ) { } } | double nm00 = m00 ; double nm01 = m10 ; double nm02 = m20 ; double nm10 = m01 ; double nm11 = m11 ; double nm12 = m21 ; double nm20 = m02 ; double nm21 = m12 ; double nm22 = m22 ; dest . m00 = nm00 ; dest . m01 = nm01 ; dest . m02 = nm02 ; dest . m10 = nm10 ; dest . m11 = nm11 ; dest . m12 = nm12 ; dest . m20 = nm20 ; dest . m21 = nm21 ; dest . m22 = nm22 ; dest . properties = properties ; return dest ; |
public class GetOpenIdTokenForDeveloperIdentityRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetOpenIdTokenForDeveloperIdentityRequest getOpenIdTokenForDeveloperIdentityRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getOpenIdTokenForDeveloperIdentityRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getOpenIdTokenForDeveloperIdentityRequest . getIdentityPoolId ( ) , IDENTITYPOOLID_BINDING ) ; protocolMarshaller . marshall ( getOpenIdTokenForDeveloperIdentityRequest . getIdentityId ( ) , IDENTITYID_BINDING ) ; protocolMarshaller . marshall ( getOpenIdTokenForDeveloperIdentityRequest . getLogins ( ) , LOGINS_BINDING ) ; protocolMarshaller . marshall ( getOpenIdTokenForDeveloperIdentityRequest . getTokenDuration ( ) , TOKENDURATION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class JCollapsiblePaneBeanInfo { /** * Gets the icon .
* @ param type Description of the Parameter
* @ return The icon value */
@ Override public Image getIcon ( int type ) { } } | if ( type == BeanInfo . ICON_COLOR_16x16 ) { return iconColor16 ; } if ( type == BeanInfo . ICON_MONO_16x16 ) { return iconMono16 ; } if ( type == BeanInfo . ICON_COLOR_32x32 ) { return iconColor32 ; } if ( type == BeanInfo . ICON_MONO_32x32 ) { return iconMono32 ; } return null ; |
public class Conversions { /** * Tries conversion of any value to a decimal */
public static BigDecimal toDecimal ( Object value , EvaluationContext ctx ) { } } | if ( value instanceof Boolean ) { return ( ( Boolean ) value ) ? BigDecimal . ONE : BigDecimal . ZERO ; } else if ( value instanceof Integer ) { return new BigDecimal ( ( Integer ) value ) ; } else if ( value instanceof BigDecimal ) { return ( BigDecimal ) value ; } else if ( value instanceof String ) { try { return new BigDecimal ( ( String ) value ) ; } catch ( NumberFormatException e ) { } } throw new EvaluationError ( "Can't convert '" + value + "' to a decimal" ) ; |
public class PropertyUtil { /** * expand a keyString that may contain references to properties
* located in provided Properties object
* @ return expanded
* @ param keyString string
* @ param properties properties */
public static String expand ( String keyString , Properties properties ) { } } | return PropertyUtil . expand ( keyString , ( Map ) properties ) ; |
public class SegmentedByteArray { /** * Ensures that the segment at segmentIndex exists
* @ param segmentIndex */
private void ensureCapacity ( int segmentIndex ) { } } | while ( segmentIndex >= segments . length ) { segments = Arrays . copyOf ( segments , segments . length * 3 / 2 ) ; } long numSegmentsPopulated = length >> log2OfSegmentSize ; for ( long i = numSegmentsPopulated ; i <= segmentIndex ; i ++ ) { segments [ ( int ) i ] = memoryPool . getSegment ( ) ; length += 1 << log2OfSegmentSize ; } |
public class SimpleConceptId { /** * Returns a concept propId with the given string identifier .
* @ param id a concept identifier { @ link String } . Cannot be
* < code > null < / code > .
* @ return a { @ link PropDefConceptId } . */
public static ConceptId getInstance ( String id , Metadata metadata ) { } } | List < Object > key = new ArrayList < > ( 1 ) ; key . add ( id ) ; ConceptId result = metadata . getFromConceptIdCache ( key ) ; if ( result != null ) { return result ; } else { result = new SimpleConceptId ( id , metadata ) ; metadata . putInConceptIdCache ( key , result ) ; return result ; } |
public class DefaultGroovyMethods { /** * Finds the items matching the IDENTITY Closure ( i . e . & # 160 ; matching Groovy truth ) .
* Example :
* < pre class = " groovyTestCase " >
* def items = [ 1 , 2 , 0 , false , true , ' ' , ' foo ' , [ ] , [ 4 , 5 ] , null ] as Set
* assert items . findAll ( ) = = [ 1 , 2 , true , ' foo ' , [ 4 , 5 ] ] as Set
* < / pre >
* @ param self a Set
* @ return a Set of the values found
* @ since 2.4.0
* @ see Closure # IDENTITY */
public static < T > Set < T > findAll ( Set < T > self ) { } } | return findAll ( self , Closure . IDENTITY ) ; |
public class RuntimeUpdateManagerImpl { /** * Call the { @ code ServerQuiesceListener # serverStopping ( ) } method on all discovered
* references . Calls are queued to a small thread pool , which is then stopped .
* All invocations are then allowed to complete .
* @ param listenerRefs Collection of { @ code ServiceReference } s for { @ code ServerQuiesceListener } s */
private void quiesceListeners ( Collection < ServiceReference < ServerQuiesceListener > > listenerRefs ) { } } | // Make a copy of existing notifications : we can ' t hold the lock around notifications
// to iterate while waiting for the existing notifications to complete because that would
// lock - out cleanupNotifications .
final Map < String , RuntimeUpdateNotification > existingNotifications = new HashMap < String , RuntimeUpdateNotification > ( ) ; synchronized ( notifications ) { existingNotifications . putAll ( notifications ) ; } if ( listenerRefs . isEmpty ( ) && existingNotifications . isEmpty ( ) ) return ; if ( isServer ( ) ) Tr . audit ( tc , "quiesce.begin" ) ; else Tr . audit ( tc , "client.quiesce.begin" ) ; // If there are RuntimeUpdateNotifications outstanding , submit a thread to wait on them
if ( ! existingNotifications . isEmpty ( ) ) { executorService . execute ( new Runnable ( ) { @ Override public void run ( ) { try { for ( RuntimeUpdateNotification notification : existingNotifications . values ( ) ) { if ( ! notification . ignoreOnQuiesce ( ) ) notification . waitForCompletion ( ) ; } } catch ( Throwable t ) { // Auto - FFDC here . .
} } } ) ; } // Queue the notification of each listener ( unbounded queue )
final ConcurrentLinkedQueue < ServerQuiesceListener > listeners = new ConcurrentLinkedQueue < ServerQuiesceListener > ( ) ; for ( ServiceReference < ServerQuiesceListener > ref : listenerRefs ) { final ServerQuiesceListener listener = bundleCtx . getService ( ref ) ; if ( listener != null ) { executorService . execute ( new Runnable ( ) { @ Override public void run ( ) { try { listeners . add ( listener ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Invoking serverStopping() on listener: " + listener ) ; } listener . serverStopping ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "serverStopping() method completed on listener: " + listener ) ; } } catch ( Throwable t ) { // Auto - FFDC here . .
} finally { listeners . remove ( listener ) ; } } } ) ; } } if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "About to begin quiesce of executor service threads." ) ; // Notify the executor service that we are quiescing
ThreadQuiesce tq = ( ThreadQuiesce ) executorService ; if ( tq . quiesceThreads ( ) ) { if ( isServer ( ) ) Tr . info ( tc , "quiesce.end" ) ; else Tr . info ( tc , "client.quiesce.end" ) ; } else { if ( tc . isDebugEnabled ( ) ) { // If debug is enabled we will dump threads so that we can determine what was still running
libertyProcess . createJavaDump ( Collections . singleton ( "thread" ) ) ; } int count = tq . getActiveThreads ( ) ; // we timed out - we now have to stop waiting for existing notifications to finish . . .
// we set the normal stop to false and issue the timeout warning after the diagnostics to
// ensure that we have valid diagnostics ( to avoid situations where the long running threads
// finish right after we issue the warning - then we wouldn ' t see them in the diagnostics ) .
normalServerStop . set ( false ) ; Tr . warning ( tc , "quiece.warning" ) ; int notificationCount = 0 ; for ( RuntimeUpdateNotification notification : existingNotifications . values ( ) ) { if ( ! ! ! notification . isDone ( ) ) { notificationCount ++ ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Notification did not complete during quiesce: " , notification . getName ( ) ) ; } } } if ( notificationCount > 0 ) { Tr . warning ( tc , "notifications.not.complete" , notificationCount ) ; } if ( listeners . size ( ) > 0 ) { Tr . warning ( tc , "quiesce.listeners.not.complete" , listeners . size ( ) ) ; } if ( tc . isDebugEnabled ( ) ) { for ( ServerQuiesceListener sql : listeners ) { Tr . debug ( tc , "Quiesce listener did not complete during quiesce: " , sql . getClass ( ) . getName ( ) ) ; } } count = count - notificationCount - listeners . size ( ) ; if ( count > 0 ) { Tr . warning ( tc , "quiesce.waiting.on.threads" , count ) ; } } |
public class ColorXMLProcessor { /** * Register for " * " and " xml " file extensions the ColorResourceFactoryImpl factory .
* < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override protected Map < String , Resource . Factory > getRegistrations ( ) { } } | if ( registrations == null ) { super . getRegistrations ( ) ; registrations . put ( XML_EXTENSION , new ColorResourceFactoryImpl ( ) ) ; registrations . put ( STAR_EXTENSION , new ColorResourceFactoryImpl ( ) ) ; } return registrations ; |
public class MenuPanel { /** * Override preparePaintComponent in order to populate the recently accessed menu when a user accesses this panel
* for the first time .
* @ param request the request being responded to . */
@ Override protected void preparePaintComponent ( final Request request ) { } } | super . preparePaintComponent ( request ) ; if ( ! isInitialised ( ) ) { updateRecentMenu ( ) ; setInitialised ( true ) ; } boolean hasRecentMenu = menu . getMenuItems ( ) . size ( ) > 0 ; menu . setVisible ( hasRecentMenu ) ; recentMenuHeading . setVisible ( hasRecentMenu ) ; |
public class AbstractIdentityDeserializationInfo { /** * { @ inheritDoc } */
@ Override public final Object readId ( JsonReader reader , JsonDeserializationContext ctx ) { } } | return getDeserializer ( ) . deserialize ( reader , ctx ) ; |
public class Transforms { /** * Raises a square matrix to a power < i > n < / i > , which can be positive , negative , or zero .
* The behavior is similar to the numpy matrix _ power ( ) function . The algorithm uses
* repeated squarings to minimize the number of mmul ( ) operations needed
* < p > If < i > n < / i > is zero , the identity matrix is returned . < / p >
* < p > If < i > n < / i > is negative , the matrix is inverted and raised to the abs ( n ) power . < / p >
* @ param in A square matrix to raise to an integer power , which will be changed if dup is false .
* @ param n The integer power to raise the matrix to .
* @ param dup If dup is true , the original input is unchanged .
* @ return The result of raising < i > in < / i > to the < i > n < / i > th power . */
public static INDArray mpow ( INDArray in , int n , boolean dup ) { } } | Preconditions . checkState ( in . isMatrix ( ) && in . isSquare ( ) , "Input must be a square matrix: got input with shape %s" , in . shape ( ) ) ; if ( n == 0 ) { if ( dup ) return Nd4j . eye ( in . rows ( ) ) ; else return in . assign ( Nd4j . eye ( in . rows ( ) ) ) ; } INDArray temp ; if ( n < 0 ) { temp = InvertMatrix . invert ( in , ! dup ) ; n = - n ; } else temp = in . dup ( ) ; INDArray result = temp . dup ( ) ; if ( n < 4 ) { for ( int i = 1 ; i < n ; i ++ ) { result . mmuli ( temp ) ; } if ( dup ) return result ; else return in . assign ( result ) ; } else { // lets try to optimize by squaring itself a bunch of times
int squares = ( int ) ( Math . log ( n ) / Math . log ( 2.0 ) ) ; for ( int i = 0 ; i < squares ; i ++ ) result = result . mmul ( result ) ; int diff = ( int ) Math . round ( n - Math . pow ( 2.0 , squares ) ) ; for ( int i = 0 ; i < diff ; i ++ ) result . mmuli ( temp ) ; if ( dup ) return result ; else return in . assign ( result ) ; } |
public class CheckJSDoc { /** * Checks that an @ implicitCast annotation is in the externs */
private void validateImplicitCast ( Node n , JSDocInfo info ) { } } | if ( ! inExterns && info != null && info . isImplicitCast ( ) ) { report ( n , TypeCheck . ILLEGAL_IMPLICIT_CAST ) ; } |
public class ExportJobResourceMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ExportJobResource exportJobResource , ProtocolMarshaller protocolMarshaller ) { } } | if ( exportJobResource == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( exportJobResource . getRoleArn ( ) , ROLEARN_BINDING ) ; protocolMarshaller . marshall ( exportJobResource . getS3UrlPrefix ( ) , S3URLPREFIX_BINDING ) ; protocolMarshaller . marshall ( exportJobResource . getSegmentId ( ) , SEGMENTID_BINDING ) ; protocolMarshaller . marshall ( exportJobResource . getSegmentVersion ( ) , SEGMENTVERSION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AWSComprehendMedicalClient { /** * Inspects the clinical text for personal health information ( PHI ) entities and entity category , location , and
* confidence score on that information .
* @ param detectPHIRequest
* @ return Result of the DetectPHI operation returned by the service .
* @ throws InternalServerException
* An internal server error occurred . Retry your request .
* @ throws ServiceUnavailableException
* The Comprehend Medical service is temporarily unavailable . Please wait and then retry your request .
* @ throws TooManyRequestsException
* You have made too many requests within a short period of time . Wait for a short time and then try your
* request again . Contact customer support for more information about a service limit increase .
* @ throws InvalidRequestException
* The request that you made is invalid . Check your request to determine why it ' s invalid and then retry the
* request .
* @ throws InvalidEncodingException
* The input text was not in valid UTF - 8 character encoding . Check your text then retry your request .
* @ throws TextSizeLimitExceededException
* The size of the text you submitted exceeds the size limit . Reduce the size of the text or use a smaller
* document and then retry your request .
* @ sample AWSComprehendMedical . DetectPHI
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / comprehendmedical - 2018-10-30 / DetectPHI " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public DetectPHIResult detectPHI ( DetectPHIRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDetectPHI ( request ) ; |
public class BaseFixData { /** * GetRecordFromCode Method . */
public static Record getRecordFromCode ( BaseField field , String strDesc , String strFieldName , Record recSecond ) { } } | if ( ( strDesc == null ) || ( strDesc . length ( ) == 0 ) ) return null ; BaseField fldSecond = null ; if ( strFieldName != null ) fldSecond = recSecond . getField ( strFieldName ) ; if ( fldSecond == null ) fldSecond = recSecond . getField ( "Code" ) ; if ( fldSecond == null ) return null ; recSecond . setKeyArea ( fldSecond ) ; fldSecond . setString ( strDesc ) ; try { if ( recSecond . seek ( DBConstants . EQUALS ) ) return recSecond ; } catch ( DBException e ) { e . printStackTrace ( ) ; } return null ; |
public class InteractiveElement { /** * ( non - Javadoc )
* @ see qc . automation . framework . widget . IInteractiveElement # isEnabled ( ) */
@ Override public boolean isEnabled ( ) throws WidgetException { } } | try { return getWebElement ( ) . isEnabled ( ) ; } catch ( Exception e ) { throw new WidgetException ( "Error while determing whether element is enabled" , getByLocator ( ) , e ) ; } |
public class ArrayUtil { /** * 以 conjunction 为分隔符将数组转换为字符串
* @ param array 数组
* @ param conjunction 分隔符
* @ return 连接后的字符串 */
public static String join ( Object array , CharSequence conjunction ) { } } | if ( isArray ( array ) ) { final Class < ? > componentType = array . getClass ( ) . getComponentType ( ) ; if ( componentType . isPrimitive ( ) ) { final String componentTypeName = componentType . getName ( ) ; switch ( componentTypeName ) { case "long" : return join ( ( long [ ] ) array , conjunction ) ; case "int" : return join ( ( int [ ] ) array , conjunction ) ; case "short" : return join ( ( short [ ] ) array , conjunction ) ; case "char" : return join ( ( char [ ] ) array , conjunction ) ; case "byte" : return join ( ( byte [ ] ) array , conjunction ) ; case "boolean" : return join ( ( boolean [ ] ) array , conjunction ) ; case "float" : return join ( ( float [ ] ) array , conjunction ) ; case "double" : return join ( ( double [ ] ) array , conjunction ) ; default : throw new UtilException ( "Unknown primitive type: [{}]" , componentTypeName ) ; } } else { return join ( ( Object [ ] ) array , conjunction ) ; } } throw new UtilException ( StrUtil . format ( "[{}] is not a Array!" , array . getClass ( ) ) ) ; |
public class MapFormat { /** * Designated method . It gets the string , initializes HashFormat object
* and returns converted string . It scans < code > pattern < / code >
* for { } brackets , then parses enclosed string and replaces it
* with argument ' s < code > get ( ) < / code > value .
* @ param pattern String to be parsed .
* @ param arguments Map with key - value pairs to replace .
* @ return Formatted string */
public static String format ( String pattern , Map arguments ) { } } | MapFormat temp = new MapFormat ( arguments ) ; return temp . format ( pattern ) ; |
public class ComputeNodeOperations { /** * Gets the specified compute node .
* @ param poolId The ID of the pool .
* @ param nodeId the ID of the compute node to get from the pool .
* @ return A { @ link ComputeNode } containing information about the specified compute node .
* @ throws BatchErrorException Exception thrown when an error response is received from the Batch service .
* @ throws IOException Exception thrown when there is an error in serialization / deserialization of data sent to / received from the Batch service . */
public ComputeNode getComputeNode ( String poolId , String nodeId ) throws BatchErrorException , IOException { } } | return getComputeNode ( poolId , nodeId , null , null ) ; |
public class Scroller { /** * Scrolls horizontally .
* @ param side the side to which to scroll ; { @ link Side # RIGHT } or { @ link Side # LEFT }
* @ param scrollPosition the position to scroll to , from 0 to 1 where 1 is all the way . Example is : 0.55.
* @ param stepCount how many move steps to include in the scroll . Less steps results in a faster scroll */
@ SuppressWarnings ( "deprecation" ) public void scrollToSide ( Side side , float scrollPosition , int stepCount ) { } } | WindowManager windowManager = ( WindowManager ) inst . getTargetContext ( ) . getSystemService ( Context . WINDOW_SERVICE ) ; int screenHeight = windowManager . getDefaultDisplay ( ) . getHeight ( ) ; int screenWidth = windowManager . getDefaultDisplay ( ) . getWidth ( ) ; float x = screenWidth * scrollPosition ; float y = screenHeight / 2.0f ; if ( side == Side . LEFT ) drag ( 70 , x , y , y , stepCount ) ; else if ( side == Side . RIGHT ) drag ( x , 0 , y , y , stepCount ) ; |
public class ResolveResult { /** * better option ? we don ' t have variance */
@ SuppressWarnings ( "unchecked" ) ResolveResult < AbstractConfigObject > asObjectResult ( ) { } } | if ( ! ( value instanceof AbstractConfigObject ) ) throw new ConfigException . BugOrBroken ( "Expecting a resolve result to be an object, but it was " + value ) ; Object o = this ; return ( ResolveResult < AbstractConfigObject > ) o ; |
public class KeyResolver18 { /** * region Key Wrapping */
private static String wrapSymmetricKey ( KeyPair wrapperKey , SecretKey symmetricKey ) throws NoSuchPaddingException , NoSuchAlgorithmException , InvalidKeyException , IllegalBlockSizeException { } } | Cipher cipher = Cipher . getInstance ( WRAPPER_TRANSFORMATION ) ; cipher . init ( Cipher . WRAP_MODE , wrapperKey . getPublic ( ) ) ; byte [ ] decodedData = cipher . wrap ( symmetricKey ) ; return Base64 . encodeToString ( decodedData , Base64 . DEFAULT ) ; |
public class DerbyDdlParser { /** * Parses DDL CREATE ROLE statement
* @ param tokens the tokenized { @ link DdlTokenStream } of the DDL input content ; may not be null
* @ param parentNode the parent { @ link AstNode } node ; may not be null
* @ return the parsed CREATE ROLE statement node
* @ throws ParsingException */
protected AstNode parseCreateRole ( DdlTokenStream tokens , AstNode parentNode ) throws ParsingException { } } | assert tokens != null ; assert parentNode != null ; markStartOfStatement ( tokens ) ; tokens . consume ( CREATE , "ROLE" ) ; String functionName = parseName ( tokens ) ; AstNode functionNode = nodeFactory ( ) . node ( functionName , parentNode , TYPE_CREATE_ROLE_STATEMENT ) ; markEndOfStatement ( tokens , functionNode ) ; return functionNode ; |
public class AsyncMessage { /** * { @ inheritDoc } */
@ Override protected void addParameters ( StringBuilder result ) { } } | super . addParameters ( result ) ; result . append ( ",correlationId=" ) ; result . append ( correlationId ) ; |
public class SecurityExceptionProcessor { /** * Catches any exception thrown by the processor chain . If the exception is an instance of a { @ link
* SecurityProviderException } , the exception is handled to see if authentication is required
* ( { @ link AuthenticationRequiredException } ) , or if access to the resource is denied
* ( { @ link AccessDeniedException } ) .
* @ param context the context which holds the current request and response
* @ param processorChain the processor chain , used to call the next processor
* @ throws Exception */
public void processRequest ( RequestContext context , RequestSecurityProcessorChain processorChain ) throws Exception { } } | try { processorChain . processRequest ( context ) ; } catch ( IOException e ) { throw e ; } catch ( Exception e ) { SecurityProviderException se = findSecurityException ( e ) ; if ( se != null ) { handleSecurityProviderException ( se , context ) ; } else { throw e ; } } |
public class JSONEmitter { /** * / / / Main ( for testing / demo ) */
public static void main ( String args [ ] ) { } } | // Here ' s an example of how to use JSONEmitter . This produces the following JSON :
// { " doc " : {
// " fields " : [
// { " Title " : " Zen and the Art of Motorcycle Maintenance " } ,
// { " Amazon - Link " : " http : / / www . amazon . com / " } ,
// { " Author " : " Robert Pirsig " } ,
// { " Publisher " : " Harper Perennial Modern Classics " }
// Note : Not necessarily correct Doradus syntax !
JSONEmitter json = new JSONEmitter ( ) ; json . startDocument ( ) . startGroup ( "doc" ) . startArray ( "fields" ) . addObject ( "Title" , "Zen and the Art of Motorcycle Maintenance" ) . addObject ( "Amazon-Link" , "http://www.amazon.com/" ) . addObject ( "Author" , "Robert\tPirsig" ) . addObject ( "Publisher" , "Harper Perennial Modern Classics\r\n" ) . endArray ( ) // fields
. endGroup ( ) // doc
. endDocument ( ) ; String text = json . toString ( ) ; System . out . println ( text ) ; |
public class AppLinkNavigation { /** * Navigates to an { @ link AppLink } for the given destination using the default
* App Link resolution strategy .
* @ param context the Context from which the navigation should be performed .
* @ param destination the destination URL for the App Link .
* @ return the { @ link NavigationResult } performed by navigating . */
public static Task < NavigationResult > navigateInBackground ( Context context , Uri destination ) { } } | return navigateInBackground ( context , destination , getResolver ( context ) ) ; |
public class BaseProcessRecords { /** * GetFullPackageName Method . */
public String getFullPackageName ( String classProjectID , String classPackageName ) { } } | if ( classProjectID == null ) return DBConstants . BLANK ; String packageName = classProjectPackages . get ( classProjectID ) ; if ( packageName == null ) return null ; // This class is not accessible
if ( packageName . startsWith ( "." ) ) packageName = Constants . ROOT_PACKAGE . substring ( 0 , Constants . ROOT_PACKAGE . length ( ) - 1 ) + packageName ; if ( classPackageName == null ) classPackageName = DBConstants . BLANK ; if ( classPackageName . startsWith ( "." ) ) packageName = packageName + classPackageName ; else if ( classPackageName . length ( ) > 0 ) packageName = classPackageName ; return packageName ; |
public class ComponentTree { /** * Send the event to all matching handlers .
* @ param event the event
* @ param channels the channels the event is sent to */
@ SuppressWarnings ( "PMD.UseVarargs" ) /* default */
void dispatch ( EventPipeline pipeline , EventBase < ? > event , Channel [ ] channels ) { } } | HandlerList handlers = getEventHandlers ( event , channels ) ; handlers . process ( pipeline , event ) ; |
public class DdlUtils { /** * 获取DRDS下表的拆分字段 , 返回格式为 id , name
* @ param dataSource
* @ param schemaName
* @ param tableName
* @ return */
public static String getShardKeyByDRDS ( final JdbcTemplate jdbcTemplate , final String catalogName , final String schemaName , final String tableName ) { } } | try { return ( String ) jdbcTemplate . execute ( "show partitions from ?" , new PreparedStatementCallback ( ) { public Object doInPreparedStatement ( PreparedStatement ps ) throws SQLException , DataAccessException { DatabaseMetaData metaData = ps . getConnection ( ) . getMetaData ( ) ; // String sName = getIdentifierName ( schemaName , metaData ) ;
String convertTableName = tableName ; if ( metaData . storesUpperCaseIdentifiers ( ) ) { convertTableName = tableName . toUpperCase ( ) ; } if ( metaData . storesLowerCaseIdentifiers ( ) ) { convertTableName = tableName . toLowerCase ( ) ; } String tName = convertTableName ; ps . setString ( 1 , tName ) ; ResultSet rs = ps . executeQuery ( ) ; String log = null ; if ( rs . next ( ) ) { log = rs . getString ( "KEYS" ) ; } rs . close ( ) ; return log ; } } ) ; } catch ( DataAccessException e ) { // 兼容下oracle源库和目标库DRDS表名不一致的情况 , 识别一下表名不存在
Throwable cause = e . getRootCause ( ) ; if ( cause instanceof SQLException ) { // ER _ NO _ SUCH _ TABLE
if ( ( ( SQLException ) cause ) . getErrorCode ( ) == 1146 ) { return null ; } } throw e ; } |
public class CaptureActivityIntents { /** * Get the width of the scanning rectangle in pixels from { @ code Intent } .
* @ param intent Target intent . It can be { @ code null } .
* @ return Width of scanning rectangle in pixels if specified , or zero otherwise . */
public static int getWidthOfScanningRectangleInPxOrZero ( Intent intent ) { } } | if ( intent == null ) return 0 ; return intent . getIntExtra ( Intents . Scan . WIDTH , 0 ) ; |
public class JaxWsHttpServletRequestAdapter { /** * ( non - Javadoc )
* @ see javax . servlet . ServletRequest # getServerName ( ) */
@ Override public String getServerName ( ) { } } | try { collaborator . preInvoke ( componentMetaData ) ; return request . getServerName ( ) ; } finally { collaborator . postInvoke ( ) ; } |
public class DB2JCCHelper { /** * This method returns a sqljConnectContext . It will go to DB2 to get the connection Context .
* We need to create a new WSJccConnection to get the phsyical sqlj context . So the sqlj runtime
* will use our WSJccConnection to do the work .
* @ param a managedConnection
* @ param DefaultContext the sqlj . runtime . ref . DefaultContext class
* @ return a physical sqlj connectionContext -
* @ exception a SQLException if can ' t get a DefaultContext */
@ Override public Object getSQLJContext ( WSRdbManagedConnectionImpl mc , Class < ? > DefaultContext , WSConnectionManager connMgr ) throws SQLException { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "getSQLJContext" ) ; Object rtnctx = null ; try { if ( mc . cachedConnection == null ) { mc . cachedConnection = mcf . jdbcRuntime . newConnection ( mc , mc . sqlConn , WSRdbManagedConnectionImpl . key , mc . threadID ) ; mc . cachedConnection . initialize ( connMgr , WSRdbManagedConnectionImpl . key ) ; mc . cachedConnection . setCurrentAutoCommit ( mc . currentAutoCommit , WSRdbManagedConnectionImpl . key ) ; } else { /* * Need to set the mc ' s threadid to prevent false multi thread detection . */
mc . cachedConnection . setThreadID ( mc . threadID , WSRdbManagedConnectionImpl . key ) ; } } catch ( ResourceException rex ) { FFDCFilter . processException ( rex , getClass ( ) . getName ( ) , "550" , this ) ; SQLException sqlX = AdapterUtil . toSQLException ( rex ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getSQLJContext" , rex ) ; throw sqlX ; } catch ( SQLException sqlx ) { FFDCFilter . processException ( sqlx , getClass ( ) . getName ( ) , "1009" , this ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getSQLJContext" , sqlx ) ; throw WSJdbcUtil . mapException ( mc . cachedConnection , sqlx ) ; } try { rtnctx = DefaultContext . getConstructor ( Connection . class ) . newInstance ( mc . cachedConnection ) ; } catch ( Exception x ) { FFDCFilter . processException ( x , getClass ( ) . getName ( ) , "549" , this ) ; if ( x instanceof InvocationTargetException && x . getCause ( ) instanceof SQLException ) { SQLException sqlX = WSJdbcUtil . mapException ( mc . cachedConnection , ( SQLException ) x . getCause ( ) ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getSQLJContext" , sqlX ) ; throw sqlX ; } else { RuntimeException rx = x instanceof RuntimeException ? ( RuntimeException ) x : new RuntimeException ( x ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getSQLJContext" , x ) ; throw rx ; } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getSQLJContext" , rtnctx ) ; return rtnctx ; |
public class GoogleHadoopFileSystemBase { /** * Concat existing files into one file .
* @ param trg the path to the target destination .
* @ param psrcs the paths to the sources to use for the concatenation .
* @ throws IOException IO failure */
@ Override public void concat ( Path trg , Path [ ] psrcs ) throws IOException { } } | logger . atFine ( ) . log ( "GHFS.concat: %s, %s" , trg , lazy ( ( ) -> Arrays . toString ( psrcs ) ) ) ; checkArgument ( psrcs . length > 0 , "psrcs must have at least one source" ) ; URI trgPath = getGcsPath ( trg ) ; List < URI > srcPaths = Arrays . stream ( psrcs ) . map ( this :: getGcsPath ) . collect ( toImmutableList ( ) ) ; checkArgument ( ! srcPaths . contains ( trgPath ) , "target must not be contained in sources" ) ; List < List < URI > > partitions = Lists . partition ( srcPaths , GoogleCloudStorage . MAX_COMPOSE_OBJECTS - 1 ) ; logger . atFine ( ) . log ( "GHFS.concat: %s, %d partitions" , trg , partitions . size ( ) ) ; for ( List < URI > partition : partitions ) { // We need to include the target in the list of sources to compose since
// the GCS FS compose operation will overwrite the target , whereas the Hadoop
// concat operation appends to the target .
List < URI > sources = Lists . newArrayList ( trgPath ) ; sources . addAll ( partition ) ; logger . atFine ( ) . log ( "GHFS.concat compose: %s, %s" , trgPath , sources ) ; getGcsFs ( ) . compose ( sources , trgPath , CreateFileOptions . DEFAULT_CONTENT_TYPE ) ; } logger . atFine ( ) . log ( "GHFS.concat:=> " ) ; |
public class DefaultClassPathResourceLoader { /** * Obtains a stream of resource URLs .
* @ param path The path
* @ return A resource stream */
public Stream < URL > getResources ( String path ) { } } | Enumeration < URL > all ; try { all = classLoader . getResources ( prefixPath ( path ) ) ; } catch ( IOException e ) { return Stream . empty ( ) ; } Stream . Builder < URL > builder = Stream . builder ( ) ; while ( all . hasMoreElements ( ) ) { URL url = all . nextElement ( ) ; builder . accept ( url ) ; } return builder . build ( ) ; |
public class MaterialToast { /** * Quick fire your toast .
* @ param msg Message text for your toast .
* @ param className class name to custom style your toast . */
public static void fireToast ( String msg , String className ) { } } | new MaterialToast ( ) . toast ( msg , DURATION , className ) ; |
public class DoubleSum { /** * { @ inheritDoc } */
@ Override public synchronized String execute ( SampleResult previousResult , Sampler currentSampler ) throws InvalidVariableException { } } | JMeterVariables vars = getVariables ( ) ; Double sum = 0D ; String varName = ( ( CompoundVariable ) values [ values . length - 1 ] ) . execute ( ) . trim ( ) ; for ( int i = 0 ; i < values . length - 1 ; i ++ ) { sum += Double . parseDouble ( ( ( CompoundVariable ) values [ i ] ) . execute ( ) ) ; } try { sum += Double . parseDouble ( varName ) ; varName = null ; // there is no variable name
} catch ( NumberFormatException ignored ) { } String totalString = Double . toString ( sum ) ; if ( vars != null && varName != null && varName . length ( ) > 0 ) { // vars will be null on TestPlan
vars . put ( varName , totalString ) ; } return totalString ; |
public class AbstractPool { /** * { @ inheritDoc } */
@ Override public synchronized void flush ( FlushMode mode ) { } } | if ( isShutdown ( ) ) return ; for ( Credential credential : pools . keySet ( ) ) { ManagedConnectionPool mcp = pools . get ( credential ) ; if ( mcp != null ) { mcp . flush ( mode ) ; if ( mcp . isEmpty ( ) && ! poolConfiguration . isPrefill ( ) ) { mcp . shutdown ( ) ; pools . remove ( credential ) ; if ( Tracer . isEnabled ( ) ) Tracer . destroyManagedConnectionPool ( poolConfiguration . getId ( ) , mcp ) ; } } } |
public class RepositoryResourceImpl { /** * Moves the resource to the desired state
* @ param resource
* @ param state
* @ throws RepositoryBackendException
* @ throws RepositoryResourceException */
public void moveToState ( State state ) throws RepositoryBackendException , RepositoryResourceException { } } | if ( getState ( ) == null ) { return ; } int counter = 0 ; while ( getState ( ) != state ) { counter ++ ; StateAction nextAction = getState ( ) . getNextAction ( state ) ; performLifeCycle ( nextAction ) ; if ( counter >= 10 ) { throw new RepositoryResourceLifecycleException ( "Unable to move to state " + state + " after 10 state transistion attempts. Resource left in state " + getState ( ) , getId ( ) , getState ( ) , nextAction ) ; } } |
public class PushSelectCriteria { /** * Push the criteria node as close to the originating node as possible . In general , the criteria node usually ends up being
* moved to be a parent of the supplied originating node , except in a couple of cases :
* < ul >
* < li > There are already criteria nodes immediately above the originating node ; in this case , the supplied criteria node is
* placed above all these existing criteria nodes . < / li >
* < li > The originating node is below a JOIN node that is itself below an ACCESS node ; in this case , the criteria node is
* placed immediately above the JOIN node . < / li >
* < li > The originating node is below a LIMIT with a single SORT child node ; in this case , the criteria node is placed
* immediately above the LIMIT node . < / li >
* < / ul >
* @ param criteriaNode the criteria node that is to be pushed down ; may not be null
* @ param originatingNode the target node that represents the node above which the criteria node should be inserted ; may not
* be null
* @ return true if the criteria node was pushed down , or false if the criteria node could not be pushed down */
protected boolean pushTowardsOriginatingNode ( PlanNode criteriaNode , PlanNode originatingNode ) { } } | // To keep things stable , ' originatingNode ' should be the top - most SELECT ( criteria ) node above a SOURCE . . .
while ( originatingNode . getParent ( ) . getType ( ) == Type . SELECT ) { originatingNode = originatingNode . getParent ( ) ; if ( originatingNode == criteriaNode ) return false ; } // Find out the best node above which the criteria node should be placed . . .
PlanNode bestChild = findBestChildForCriteria ( criteriaNode , originatingNode ) ; if ( bestChild == criteriaNode ) return false ; criteriaNode . extractFromParent ( ) ; bestChild . insertAsParent ( criteriaNode ) ; assert atBoundary ( criteriaNode , originatingNode ) ; return true ; |
public class Configuration { /** * This method allows you to set maximum host allocation . However , it ' s recommended to leave it as default : Xmx + something .
* @ param max amount of memory in bytes */
public Configuration setMaximumZeroAllocation ( long max ) { } } | long xmx = Runtime . getRuntime ( ) . maxMemory ( ) ; if ( max < xmx ) log . warn ( "Setting maximum memory below -Xmx value can cause problems" ) ; if ( max <= 0 ) throw new IllegalStateException ( "You can't set maximum host memory <= 0" ) ; maximumZeroAllocation = max ; return this ; |
public class ClassTree { /** * Return the sub - class / interface list for the class / interface passed .
* @ param cd class / interface whose sub - class / interface list is required .
* @ param isEnum true if the subclasses should be forced to come from the
* enum tree . */
public List < ClassDoc > subs ( ClassDoc cd , boolean isEnum ) { } } | if ( isEnum ) { return get ( subEnums , cd ) ; } else if ( cd . isAnnotationType ( ) ) { return get ( subAnnotationTypes , cd ) ; } else if ( cd . isInterface ( ) ) { return get ( subinterfaces , cd ) ; } else if ( cd . isClass ( ) ) { return get ( subclasses , cd ) ; } else { return null ; } |
public class AnswerFunctionalInterfaces { /** * Construct an answer from a two parameter answer interface
* @ param answer answer interface
* @ param < T > return type
* @ param < A > input parameter 1 type
* @ param < B > input parameter 2 type
* @ return a new answer object */
public static < T , A , B > Answer < T > toAnswer ( final Answer2 < T , A , B > answer ) { } } | return new Answer < T > ( ) { @ SuppressWarnings ( "unchecked" ) public T answer ( InvocationOnMock invocation ) throws Throwable { return answer . answer ( ( A ) invocation . getArgument ( 0 ) , ( B ) invocation . getArgument ( 1 ) ) ; } } ; |
public class ModuleAssets { /** * Publish an Asset .
* @ param asset Asset
* @ return { @ link CMAAsset } result instance
* @ throws IllegalArgumentException if asset is null .
* @ throws IllegalArgumentException if asset has no id .
* @ throws IllegalArgumentException if asset has no space id . */
public CMAAsset publish ( CMAAsset asset ) { } } | assertNotNull ( asset , "asset" ) ; final String assetId = getResourceIdOrThrow ( asset , "asset" ) ; final String spaceId = getSpaceIdOrThrow ( asset , "asset" ) ; final String environmentId = asset . getEnvironmentId ( ) ; return service . publish ( asset . getSystem ( ) . getVersion ( ) , spaceId , environmentId , assetId ) . blockingFirst ( ) ; |
public class DeleteTaskRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteTaskRequest deleteTaskRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteTaskRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteTaskRequest . getTaskArn ( ) , TASKARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class PollForJobsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( PollForJobsRequest pollForJobsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( pollForJobsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( pollForJobsRequest . getActionTypeId ( ) , ACTIONTYPEID_BINDING ) ; protocolMarshaller . marshall ( pollForJobsRequest . getMaxBatchSize ( ) , MAXBATCHSIZE_BINDING ) ; protocolMarshaller . marshall ( pollForJobsRequest . getQueryParam ( ) , QUERYPARAM_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ClassFileImporter { /** * Imports all class files at the given { @ link Path file paths } . If a { @ link Path } refers to a single
* class file , that file is imported . If a path refers to a directory ,
* all class files from that directory as well as sub directories will be imported .
* < br > < br >
* For information about the impact of the imported classes on the evaluation of rules ,
* as well as configuration and details , refer to { @ link ClassFileImporter } . */
@ PublicAPI ( usage = ACCESS ) public JavaClasses importPaths ( Collection < Path > paths ) { } } | Set < Location > locations = new HashSet < > ( ) ; for ( Path path : paths ) { locations . add ( Location . of ( path ) ) ; } return importLocations ( locations ) ; |
public class AssistantInitiationActionsUpdater { /** * Add the requested post parameters to the Request .
* @ param request Request to add post params to */
private void addPostParams ( final Request request ) { } } | if ( initiationActions != null ) { request . addPostParam ( "InitiationActions" , Converter . mapToJson ( initiationActions ) ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.