signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class RequestConvertImpl { /** * TODO not correctly formulated doc */
public < T > T parseBody ( Class < T > clazz ) throws ParsableException , MediaTypeException { } } | String contentType = request . getContentType ( ) ; // if the content type header was not provided , we throw
if ( contentType == null || contentType . isEmpty ( ) ) { throw new MediaTypeException ( "Missing media type header" ) ; } // extract the actual content type in case charset is also a part of the string
contentType = HttpHeaderUtil . getContentTypeFromContentTypeAndCharacterSetting ( contentType ) ; ParserEngine engine = parserEngineManager . getParserEngineForContentType ( contentType ) ; if ( engine == null ) { throw new MediaTypeException ( "An engine for media type (" + contentType + ") was not found" ) ; } try { return engine . invoke ( request . getInputStream ( ) , clazz ) ; } catch ( IOException e ) { throw new ParsableException ( e ) ; } |
public class MwsUtl { /** * Calculate String to Sign for SignatureVersion 0
* @ param parameters
* request parameters
* @ return String to Sign */
private static String calculateStringToSignV0 ( Map < String , String > parameters ) { } } | StringBuilder data = new StringBuilder ( ) ; data . append ( parameters . get ( "Action" ) ) . append ( parameters . get ( "Timestamp" ) ) ; return data . toString ( ) ; |
public class Utils { /** * Causes the current thread to wait until it is signalled or interrupted ,
* or the specified waiting time elapses . This method originally appears
* in the { @ link Condition } interface , but it was moved to here since it
* can only be emulated , with very little accuracy guarantees : the
* efficient implementation requires accurate nanosecond timer and native
* support for nanosecond - precision wait queues , which are not usually
* present in JVMs prior to 1.5 . Loss of precision may cause total waiting
* times to be systematically shorter than specified when re - waits occur .
* < p > The lock associated with this condition is atomically
* released and the current thread becomes disabled for thread scheduling
* purposes and lies dormant until < em > one < / em > of five things happens :
* < ul >
* < li > Some other thread invokes the { @ link
* org . apache . beehive . netui . util . concurrent . locks . Condition # signal }
* method for this
* < tt > Condition < / tt > and the current thread happens to be chosen as the
* thread to be awakened ; or
* < li > Some other thread invokes the { @ link
* org . apache . beehive . netui . util . concurrent . locks . Condition # signalAll }
* method for this
* < tt > Condition < / tt > ; or
* < li > Some other thread { @ link Thread # interrupt interrupts } the current
* thread , and interruption of thread suspension is supported ; or
* < li > The specified waiting time elapses ; or
* < li > A & quot ; < em > spurious wakeup < / em > & quot ; occurs .
* < / ul >
* < p > In all cases , before this method can return the current thread must
* re - acquire the lock associated with this condition . When the
* thread returns it is < em > guaranteed < / em > to hold this lock .
* < p > If the current thread :
* < ul >
* < li > has its interrupted status set on entry to this method ; or
* < li > is { @ link Thread # interrupt interrupted } while waiting
* and interruption of thread suspension is supported ,
* < / ul >
* then { @ link InterruptedException } is thrown and the current thread ' s
* interrupted status is cleared . It is not specified , in the first
* case , whether or not the test for interruption occurs before the lock
* is released .
* < p > The method returns an estimate of the number of nanoseconds
* remaining to wait given the supplied < tt > nanosTimeout < / tt >
* value upon return , or a value less than or equal to zero if it
* timed out . Accuracy of this estimate is directly dependent on the
* accuracy of { @ link # nanoTime } . This value can be used to determine
* whether and how long to re - wait in cases where the wait returns but an
* awaited condition still does not hold . Typical uses of this method take
* the following form :
* < pre >
* synchronized boolean aMethod ( long timeout , TimeUnit unit ) {
* long nanosTimeout = unit . toNanos ( timeout ) ;
* while ( ! conditionBeingWaitedFor ) {
* if ( nanosTimeout & gt ; 0)
* nanosTimeout = theCondition . awaitNanos ( nanosTimeout ) ;
* else
* return false ;
* < / pre >
* < p > < b > Implementation Considerations < / b >
* < p > The current thread is assumed to hold the lock associated with this
* < tt > Condition < / tt > when this method is called .
* It is up to the implementation to determine if this is
* the case and if not , how to respond . Typically , an exception will be
* thrown ( such as { @ link IllegalMonitorStateException } ) and the
* implementation must document that fact .
* < p > A condition implementation can favor responding to an interrupt over
* normal method return in response to a signal , or over indicating the
* elapse of the specified waiting time . In either case the implementation
* must ensure that the signal is redirected to another waiting thread , if
* there is one .
* @ param cond the condition to wait for
* @ param nanosTimeout the maximum time to wait , in nanoseconds
* @ return A value less than or equal to zero if the wait has
* timed out ; otherwise an estimate , that
* is strictly less than the < tt > nanosTimeout < / tt > argument ,
* of the time still remaining when this method returned .
* @ throws InterruptedException if the current thread is interrupted ( and
* interruption of thread suspension is supported ) . */
public static long awaitNanos ( Condition cond , long nanosTimeout ) throws InterruptedException { } } | if ( nanosTimeout <= 0 ) return nanosTimeout ; long now = nanoTime ( ) ; cond . await ( nanosTimeout , TimeUnit . NANOSECONDS ) ; return nanosTimeout - ( nanoTime ( ) - now ) ; |
public class Metric { /** * < code > optional string instance = 1 ; < / code > */
public java . lang . String getInstance ( ) { } } | java . lang . Object ref = instance_ ; if ( ref instanceof java . lang . String ) { return ( java . lang . String ) ref ; } else { com . google . protobuf . ByteString bs = ( com . google . protobuf . ByteString ) ref ; java . lang . String s = bs . toStringUtf8 ( ) ; if ( bs . isValidUtf8 ( ) ) { instance_ = s ; } return s ; } |
public class StreamUtils { /** * Copies the content of the Reader to the provided OutputStream using the provided encoding .
* @ param in The character data to convert .
* @ param out The OutputStream to send the data to .
* @ param encoding The character encoding that should be used for the byte stream .
* @ param close true if the Reader and OutputStream should be closed after the completion .
* @ throws IOException If an underlying I / O Exception occurs . */
public static void copyReaderToStream ( Reader in , OutputStream out , String encoding , boolean close ) throws IOException { } } | OutputStreamWriter writer = new OutputStreamWriter ( out , encoding ) ; copyReaderToWriter ( in , writer , close ) ; |
public class SVG { /** * Change the document positioning by altering the " preserveAspectRatio "
* attribute of the root { @ code < svg > } element . See the
* documentation for { @ link PreserveAspectRatio } for more information
* on how positioning works .
* @ param preserveAspectRatio the new { @ code preserveAspectRatio } setting for the root { @ code < svg > } element .
* @ throws IllegalArgumentException if there is no current SVG document loaded . */
@ SuppressWarnings ( { } } | "WeakerAccess" , "unused" } ) public void setDocumentPreserveAspectRatio ( PreserveAspectRatio preserveAspectRatio ) { if ( this . rootElement == null ) throw new IllegalArgumentException ( "SVG document is empty" ) ; this . rootElement . preserveAspectRatio = preserveAspectRatio ; |
public class CWF2XML { /** * Returns the exclusion lookup key for the property .
* @ param name The property name .
* @ param cmpname The component name ( may be null ) .
* @ param value The property value ( may be null ) .
* @ return The exclusion lookup key . */
private String excludeKey ( String name , String cmpname , String value ) { } } | StringBuilder sb = new StringBuilder ( cmpname == null ? "" : cmpname + "." ) ; sb . append ( name ) . append ( value == null ? "" : "=" + value ) ; return sb . toString ( ) ; |
public class AbstractErrorWebExceptionHandler { /** * Render the given error data as a view , using a template view if available or a
* static HTML file if available otherwise . This will return an empty
* { @ code Publisher } if none of the above are available .
* @ param viewName the view name
* @ param responseBody the error response being built
* @ param error the error data as a map
* @ return a Publisher of the { @ link ServerResponse } */
protected Mono < ServerResponse > renderErrorView ( String viewName , ServerResponse . BodyBuilder responseBody , Map < String , Object > error ) { } } | if ( isTemplateAvailable ( viewName ) ) { return responseBody . render ( viewName , error ) ; } Resource resource = resolveResource ( viewName ) ; if ( resource != null ) { return responseBody . body ( BodyInserters . fromResource ( resource ) ) ; } return Mono . empty ( ) ; |
public class PermissionEvaluator { /** * Checks if the operated account is a direct child of effective account
* @ param operatedAccount
* @ return */
public boolean isDirectChildOfAccount ( final Account effectiveAccount , final Account operatedAccount ) { } } | return operatedAccount . getParentSid ( ) . equals ( effectiveAccount . getSid ( ) ) ; |
public class Projections { /** * Create a typed array projection for the given type and expressions
* @ param < T > type of projection
* @ param type type of the projection
* @ param exprs arguments for the projection
* @ return factory expression */
public static < T > ArrayConstructorExpression < T > array ( Class < T [ ] > type , Expression < T > ... exprs ) { } } | return new ArrayConstructorExpression < T > ( type , exprs ) ; |
public class Utils { /** * Trims all elements inside the array , modifying the original array .
* @ param strings The string array
* @ return The passed string array , trimmed */
public static String [ ] trimArray ( String [ ] strings ) { } } | for ( int i = 0 ; i < strings . length ; i ++ ) { strings [ i ] = strings [ i ] . trim ( ) ; } return strings ; |
public class BugResolution { /** * Reports an exception to the user . This method could be overwritten by a
* subclass to handle some exceptions individual .
* @ param e
* not null */
protected void reportException ( Exception e ) { } } | Assert . isNotNull ( e ) ; FindbugsPlugin . getDefault ( ) . logException ( e , e . getLocalizedMessage ( ) ) ; MessageDialog . openError ( FindbugsPlugin . getShell ( ) , "BugResolution failed." , e . getLocalizedMessage ( ) ) ; |
public class ContextFromVertx { /** * Like { @ link # parameter ( String , String ) } , but converts the
* parameter to Integer if found .
* The parameter is decoded by default .
* @ param name The name of the parameter
* @ param defaultValue A default value if parameter not found .
* @ return The value of the parameter of the defaultValue if not found . */
@ Override public Integer parameterAsInteger ( String name , Integer defaultValue ) { } } | return request . parameterAsInteger ( name , defaultValue ) ; |
public class AWSGlueClient { /** * Updates a trigger definition .
* @ param updateTriggerRequest
* @ return Result of the UpdateTrigger operation returned by the service .
* @ throws InvalidInputException
* The input provided was not valid .
* @ throws InternalServiceException
* An internal service error occurred .
* @ throws EntityNotFoundException
* A specified entity does not exist
* @ throws OperationTimeoutException
* The operation timed out .
* @ throws ConcurrentModificationException
* Two processes are trying to modify a resource simultaneously .
* @ sample AWSGlue . UpdateTrigger
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / glue - 2017-03-31 / UpdateTrigger " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public UpdateTriggerResult updateTrigger ( UpdateTriggerRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateTrigger ( request ) ; |
public class AbstractOrientedBox3F { /** * Replies if the specified boxes intersect .
* This function is assuming that < var > lx1 < / var > is lower
* or equal to < var > ux1 < / var > , < var > ly1 < / var > is lower
* or equal to < var > uy1 < / var > , and so on .
* The extents are assumed to be positive or zero .
* The lengths of the given arrays are assumed to be < code > 3 < / code > .
* This function uses the " separating axis theorem " which states that
* for any two OBBs ( AABB is a special case of OBB )
* that do not touch , a separating axis can be found .
* This function uses an optimized algorithm for AABB as first parameter .
* The general intersection type between two OBB is given by
* { @ link # intersectsOrientedBoxOrientedBox ( double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double , double ) }
* @ param centerx is the center point of the oriented box .
* @ param centery is the center point of the oriented box .
* @ param centerz is the center point of the oriented box .
* @ param axis1x are the unit vectors of the oriented box axis .
* @ param axis1y are the unit vectors of the oriented box axis .
* @ param axis1z are the unit vectors of the oriented box axis .
* @ param axis2x are the unit vectors of the oriented box axis .
* @ param axis2y are the unit vectors of the oriented box axis .
* @ param axis2z are the unit vectors of the oriented box axis .
* @ param axis3x are the unit vectors of the oriented box axis .
* @ param axis3y are the unit vectors of the oriented box axis .
* @ param axis3z are the unit vectors of the oriented box axis .
* @ param extentAxis1 are the sizes of the oriented box .
* @ param extentAxis2 are the sizes of the oriented box .
* @ param extentAxis3 are the sizes of the oriented box .
* @ param lowerx coordinates of the lowest point of the first AABB box .
* @ param lowery coordinates of the lowest point of the first AABB box .
* @ param lowerz coordinates of the lowest point of the first AABB box .
* @ param upperx coordinates of the uppermost point of the first AABB box .
* @ param uppery coordinates of the uppermost point of the first AABB box .
* @ param upperz coordinates of the uppermost point of the first AABB box .
* @ return < code > true < / code > if intersecting , otherwise < code > false < / code >
* @ see " RTCD pages 102-105"
* @ see < a href = " http : / / www . gamasutra . com / features / 19991018 / Gomez _ 5 . htm " > OBB collision detection on Gamasutra . com < / a > */
@ Pure public static boolean intersectsOrientedBoxAlignedBox ( double centerx , double centery , double centerz , double axis1x , double axis1y , double axis1z , double axis2x , double axis2y , double axis2z , double axis3x , double axis3y , double axis3z , double extentAxis1 , double extentAxis2 , double extentAxis3 , double lowerx , double lowery , double lowerz , double upperx , double uppery , double upperz ) { } } | assert ( lowerx <= upperx ) ; assert ( lowery <= uppery ) ; assert ( lowerz <= upperz ) ; assert ( extentAxis1 >= 0 ) ; assert ( extentAxis2 >= 0 ) ; assert ( extentAxis3 >= 0 ) ; double aabbCenterx , aabbCentery , aabbCenterz ; aabbCenterx = ( upperx + lowerx ) / 2.f ; aabbCentery = ( uppery + lowery ) / 2.f ; aabbCenterz = ( upperz + lowerz ) / 2.f ; return intersectsOrientedBoxOrientedBox ( aabbCenterx , aabbCentery , aabbCenterz , 1 , 0 , 0 , // Axis 1
0 , 1 , 0 , // Axis 2
0 , 0 , 1 , // Axis 3
upperx - aabbCenterx , uppery - aabbCentery , upperz - aabbCenterz , centerx , centery , centerz , axis1x , axis1y , axis1z , axis2x , axis2y , axis2z , axis3x , axis3y , axis3z , extentAxis1 , extentAxis2 , extentAxis3 ) ; |
public class StringType { /** * { @ inheritDoc } */
@ Override public Object readValue ( final Attribute _attribute , final List < Object > _objectList ) throws EFapsException { } } | Object ret = null ; if ( _objectList . size ( ) < 1 ) { ret = null ; } else if ( _objectList . size ( ) > 1 ) { final List < String > list = new ArrayList < String > ( ) ; for ( final Object object : _objectList ) { list . add ( object == null ? "" : object . toString ( ) . trim ( ) ) ; } ret = list ; } else { final Object object = _objectList . get ( 0 ) ; ret = object == null ? "" : object . toString ( ) . trim ( ) ; } return ret ; |
public class ScannerRegistry { /** * Returns the correct implementation of a { @ link LocationScanner }
* depending on the scheme or null of no scanner for this scheme is
* registered .
* @ param scheme the scheme that should be supported
* @ return { @ link JarLocationScanner } if scheme is " jar " , { @ link FileSystemLocationScanner }
* if the scheme is " file " or null if an unknown scheme is given
* @ throws IllegalArgumentException in case scheme is null or empty */
public LocationScanner getScanner ( String scheme ) { } } | notNullOrEmpty ( scheme , "scheme" ) ; return this . scanners . get ( scheme . toLowerCase ( ) ) ; |
public class xen_health_sr { /** * < pre >
* Converts API response of bulk operation into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } } | xen_health_sr_responses result = ( xen_health_sr_responses ) service . get_payload_formatter ( ) . string_to_resource ( xen_health_sr_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result . message , result . errorcode , ( base_response [ ] ) result . xen_health_sr_response_array ) ; } xen_health_sr [ ] result_xen_health_sr = new xen_health_sr [ result . xen_health_sr_response_array . length ] ; for ( int i = 0 ; i < result . xen_health_sr_response_array . length ; i ++ ) { result_xen_health_sr [ i ] = result . xen_health_sr_response_array [ i ] . xen_health_sr [ 0 ] ; } return result_xen_health_sr ; |
public class RestNodeHandler { /** * Deletes the subgraph at the node with the specified id , including all descendants .
* @ param request the servlet request ; may not be null or unauthenticated
* @ param rawRepositoryName the URL - encoded repository name
* @ param rawWorkspaceName the URL - encoded workspace name
* @ param id the node identifier
* @ throws NotFoundException if no item exists at { @ code path }
* @ throws javax . ws . rs . NotAuthorizedException if the user does not have the access required to delete the node with this id .
* @ throws RepositoryException if any other error occurs */
public void deleteNodeWithId ( HttpServletRequest request , String rawRepositoryName , String rawWorkspaceName , String id ) throws NotFoundException , NotAuthorizedException , RepositoryException { } } | assert rawRepositoryName != null ; assert rawWorkspaceName != null ; assert id != null ; Session session = getSession ( request , rawRepositoryName , rawWorkspaceName ) ; Node node = nodeWithId ( id , session ) ; node . remove ( ) ; session . save ( ) ; |
public class ShanksAgentMovementCapability { /** * Move the agent to the target location with the specific speed . Call this
* method always you want to move . This method only moves the agent a
* fragment equals to the velocity .
* @ param simulation
* @ param agent
* @ param currentLocation
* @ param targetLocation
* @ param speed */
public static void goTo ( ShanksSimulation simulation , MobileShanksAgent agent , Location currentLocation , Location targetLocation , double speed ) { } } | if ( currentLocation . is2DLocation ( ) && targetLocation . is2DLocation ( ) ) { ShanksAgentMovementCapability . goTo ( simulation , agent , currentLocation . getLocation2D ( ) , targetLocation . getLocation2D ( ) , speed ) ; } else if ( currentLocation . is3DLocation ( ) && targetLocation . is3DLocation ( ) ) { ShanksAgentMovementCapability . goTo ( simulation , agent , currentLocation . getLocation3D ( ) , targetLocation . getLocation3D ( ) , speed ) ; } |
public class TCPPort { /** * Processes a new connection by scheduling initial read .
* @ param socket */
public void processNewConnection ( SocketIOChannel socket ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "processNewConnection" ) ; } VirtualConnection vc = vcf . createConnection ( ) ; TCPConnLink bc = ( TCPConnLink ) tcpChannel . getConnectionLink ( vc ) ; TCPReadRequestContextImpl bcRead = bc . getTCPReadConnLink ( ) ; bc . setSocketIOChannel ( socket ) ; ConnectionDescriptor cd = vc . getConnectionDescriptor ( ) ; Socket s = socket . getSocket ( ) ; InetAddress remote = s . getInetAddress ( ) ; InetAddress local = s . getLocalAddress ( ) ; if ( cd != null ) { cd . setAddrs ( remote , local ) ; } else { ConnectionDescriptorImpl cdi = new ConnectionDescriptorImpl ( remote , local ) ; vc . setConnectionDescriptor ( cdi ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Processing Connection: " + vc . getConnectionDescriptor ( ) ) ; } int rc = vc . attemptToSetFileChannelCapable ( VirtualConnection . FILE_CHANNEL_CAPABLE_ENABLED ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "FileChannelCapable set in VC to: " + rc ) ; } bcRead . setJITAllocateSize ( bc . getConfig ( ) . getNewConnectionBufferSize ( ) ) ; int timeout = bc . getConfig ( ) . getInactivityTimeout ( ) ; if ( timeout == ValidateUtils . INACTIVITY_TIMEOUT_NO_TIMEOUT ) { timeout = TCPRequestContext . NO_TIMEOUT ; } // Set a chain property that is used later by the SSL channel on Z only
// ( CRA )
// This is needed to support a Z unique client certificate mapping function
// which may be moved to non Z platforms in the future .
vc . getStateMap ( ) . put ( "REMOTE_ADDRESS" , bc . getRemoteAddress ( ) . getHostAddress ( ) ) ; bcRead . read ( 1 , cc , true , timeout ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "processNewConnection" ) ; } |
public class StartTime { /** * Returns { @ link Date } representation of StartTime as parsed at a given timezone .
* Master does not return a timezone associated with StartTime timestamp string ,
* therefore an explicit timezone needs to be provided for correct parsing .
* @ param tz TimeZone associated with master .
* @ return { @ link Date } representation of StartTime at provided timezone */
public synchronized Date getDate ( TimeZone tz ) { } } | if ( dateString == null ) { return null ; } startJobDateFormat . setTimeZone ( tz ) ; try { return startJobDateFormat . parse ( dateString ) ; } catch ( ParseException e ) { // This exception should not be possible . Even when dealing with TZ DST
// transitions , all dates exist . Time that does not exist because of
// forward DST transition , get automatically forwarded during parsing .
throw new RuntimeException ( "Internal problem with Java and timezones " + dateString + " @TZ: " + tz . toString ( ) ) ; } |
public class PinViewBaseHelper { /** * Generate a Split { @ link TextView } with all attributes to add to { @ link PinView }
* @ param i index of new split
* @ return new split */
TextView generateSplit ( int i ) { } } | TextView split = new TextView ( getContext ( ) ) ; int generateViewId = PinViewUtils . generateViewId ( ) ; split . setId ( generateViewId ) ; setStylesSplit ( split ) ; pinSplitsIds [ i ] = generateViewId ; return split ; |
public class ClassPathMapperScanner { /** * Calls the parent search that will search and register all the candidates .
* Then the registered objects are post processed to set them as
* MapperFactoryBeans */
@ Override public Set < BeanDefinitionHolder > doScan ( String ... basePackages ) { } } | Set < BeanDefinitionHolder > beanDefinitions = super . doScan ( basePackages ) ; if ( beanDefinitions . isEmpty ( ) ) { logger . warn ( "No MyBatis mapper was found in '" + Arrays . toString ( basePackages ) + "' package. Please check your configuration." ) ; } else { processBeanDefinitions ( beanDefinitions ) ; } return beanDefinitions ; |
public class DeadCodeEliminator { /** * Remove the OCNI comment associated with a native method , if it exists . */
private void removeMethodOCNI ( MethodDeclaration method ) { } } | int methodStart = method . getStartPosition ( ) ; String src = unit . getSource ( ) . substring ( methodStart , methodStart + method . getLength ( ) ) ; if ( src . contains ( "/*-[" ) ) { int ocniStart = methodStart + src . indexOf ( "/*-[" ) ; Iterator < Comment > commentsIter = unit . getCommentList ( ) . iterator ( ) ; while ( commentsIter . hasNext ( ) ) { Comment comment = commentsIter . next ( ) ; if ( comment . isBlockComment ( ) && comment . getStartPosition ( ) == ocniStart ) { commentsIter . remove ( ) ; break ; } } } |
public class Gson { /** * This method serializes the specified object into its equivalent representation as a tree of
* { @ link JsonElement } s . This method should be used when the specified object is not a generic
* type . This method uses { @ link Class # getClass ( ) } to get the type for the specified object , but
* the { @ code getClass ( ) } loses the generic type information because of the Type Erasure feature
* of Java . Note that this method works fine if the any of the object fields are of generic type ,
* just the object itself should not be of a generic type . If the object is of generic type , use
* { @ link # toJsonTree ( Object , Type ) } instead .
* @ param src the object for which Json representation is to be created setting for Gson
* @ return Json representation of { @ code src } .
* @ since 1.4 */
public JsonElement toJsonTree ( Object src ) { } } | if ( src == null ) { return JsonNull . INSTANCE ; } return toJsonTree ( src , src . getClass ( ) ) ; |
public class ClassWriterImpl { /** * { @ inheritDoc } */
@ Override public void addSubClassInfo ( Content classInfoTree ) { } } | if ( utils . isClass ( typeElement ) ) { if ( typeElement . getQualifiedName ( ) . toString ( ) . equals ( "java.lang.Object" ) || typeElement . getQualifiedName ( ) . toString ( ) . equals ( "org.omg.CORBA.Object" ) ) { return ; // Don ' t generate the list , too huge
} Set < TypeElement > subclasses = classtree . directSubClasses ( typeElement , false ) ; if ( ! subclasses . isEmpty ( ) ) { Content label = contents . subclassesLabel ; Content dt = HtmlTree . DT ( label ) ; Content dl = HtmlTree . DL ( dt ) ; dl . addContent ( getClassLinks ( LinkInfoImpl . Kind . SUBCLASSES , subclasses ) ) ; classInfoTree . addContent ( dl ) ; } } |
public class BTools { /** * < b > getSpaces < / b > < br >
* public static String getSpaces ( int SpacesCount ) < br >
* Returns asked count of spaces . < br >
* If count of spaces is < 0 returns ' ? ' .
* @ param SpacesCount = spaces count
* @ return spaces */
public static String getSpaces ( int SpacesCount ) { } } | if ( SpacesCount < 0 ) return "?" ; String Info = "" ; for ( int K = 1 ; K <= SpacesCount ; K ++ ) { Info += " " ; } return Info ; |
public class ControlMessageInjector { /** * Apply injections to the input { @ link RecordStreamWithMetadata } .
* { @ link ControlMessage } s may be injected before , after , or around the input record .
* A { @ link MetadataUpdateControlMessage } will update the current input { @ link GlobalMetadata } and pass the
* updated input { @ link GlobalMetadata } to the next processor to propagate the metadata update down the pipeline . */
@ Override public RecordStreamWithMetadata < DI , SI > processStream ( RecordStreamWithMetadata < DI , SI > inputStream , WorkUnitState workUnitState ) throws StreamProcessingException { } } | init ( workUnitState ) ; setInputGlobalMetadata ( inputStream . getGlobalMetadata ( ) , workUnitState ) ; Flowable < StreamEntity < DI > > outputStream = inputStream . getRecordStream ( ) . flatMap ( in -> { if ( in instanceof ControlMessage ) { if ( in instanceof MetadataUpdateControlMessage ) { setInputGlobalMetadata ( ( ( MetadataUpdateControlMessage ) in ) . getGlobalMetadata ( ) , workUnitState ) ; } getMessageHandler ( ) . handleMessage ( ( ControlMessage ) in ) ; return Flowable . just ( in ) ; } else if ( in instanceof RecordEnvelope ) { RecordEnvelope < DI > recordEnvelope = ( RecordEnvelope < DI > ) in ; Iterable < ControlMessage < DI > > injectedBeforeIterable = injectControlMessagesBefore ( recordEnvelope , workUnitState ) ; Iterable < ControlMessage < DI > > injectedAfterIterable = injectControlMessagesAfter ( recordEnvelope , workUnitState ) ; if ( injectedBeforeIterable == null && injectedAfterIterable == null ) { // nothing injected so return the record envelope
return Flowable . just ( recordEnvelope ) ; } else { Flowable < StreamEntity < DI > > flowable ; if ( injectedBeforeIterable != null ) { flowable = Flowable . < StreamEntity < DI > > fromIterable ( injectedBeforeIterable ) . concatWith ( Flowable . just ( recordEnvelope ) ) ; } else { flowable = Flowable . just ( recordEnvelope ) ; } if ( injectedAfterIterable != null ) { flowable . concatWith ( Flowable . fromIterable ( injectedAfterIterable ) ) ; } return flowable ; } } else { throw new UnsupportedOperationException ( ) ; } } , 1 ) ; outputStream = outputStream . doOnComplete ( this :: close ) ; return inputStream . withRecordStream ( outputStream , inputStream . getGlobalMetadata ( ) ) ; |
public class Pattern7 { /** * Matches when all observable sequences have an available
* element and projects the elements by invoking the selector function .
* @ param selector
* the function that will be invoked for elements in the source sequences .
* @ return the plan for the matching
* @ throws NullPointerException
* if selector is null */
public < R > Plan0 < R > then ( Func7 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , R > selector ) { } } | if ( selector == null ) { throw new NullPointerException ( ) ; } return new Plan7 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , R > ( this , selector ) ; |
public class ZealotKhala { /** * 生成带 " AND " 前缀的 " NOT IN " 范围查询的SQL片段 .
* @ param field 数据库字段
* @ param values 数组的值
* @ return ZealotKhala实例 */
public ZealotKhala andNotIn ( String field , Object [ ] values ) { } } | return this . doIn ( ZealotConst . AND_PREFIX , field , values , true , false ) ; |
public class EntityInfo { /** * 获取Entity的DELETE SQL
* @ param bean Entity对象
* @ return String */
public String getDeleteNamesPrepareSQL ( T bean ) { } } | if ( this . tableStrategy == null ) return deleteNamesPrepareSQL ; return deleteNamesPrepareSQL . replace ( "${newtable}" , getTable ( bean ) ) ; |
public class NotificationInvocationHandler { /** * { @ inheritDoc } */
public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { } } | Object returnValue = null ; try { returnValue = method . invoke ( target , args ) ; } catch ( InvocationTargetException ite ) { throw ite . getTargetException ( ) ; } if ( messaging != null && ! exec . isShutdown ( ) ) { exec . submit ( new Notifier ( method , args , returnValue ) ) ; } return returnValue ; |
public class InstanceSet { /** * 用本样本集合默认的 “ 数据类型转换管道 ” 通过 “ 数据读取器 ” 批量建立样本集合
* @ param reader 数据读取器
* @ throws Exception */
public void loadThruPipes ( Reader reader ) throws Exception { } } | // 通过迭代加入样本
while ( reader . hasNext ( ) ) { Instance inst = reader . next ( ) ; if ( pipes != null ) pipes . addThruPipe ( inst ) ; this . add ( inst ) ; } |
public class UTF8ByteArrayUtils { /** * Find the first occurrence of the given byte b in a UTF - 8 encoded string
* @ param utf a byte array containing a UTF - 8 encoded string
* @ param start starting offset
* @ param end ending position
* @ param b the byte to find
* @ return position that first byte occures otherwise - 1 */
public static int findByte ( byte [ ] utf , int start , int end , byte b ) { } } | for ( int i = start ; i < end ; i ++ ) { if ( utf [ i ] == b ) { return i ; } } return - 1 ; |
public class QueryAgreementApi { /** * 请求push协议展示 */
public void queryAgreement ( QueryAgreementHandler handler ) { } } | HMSAgentLog . i ( "queryAgreement:handler=" + StrUtils . objDesc ( handler ) ) ; this . handler = handler ; connect ( ) ; |
public class CmsColorpickerWidget { /** * Check the stored color value to prevent display issues in the generated HTML ouput . < p >
* @ param color the color value to check
* @ return the checked color value */
private String checkColor ( String color ) { } } | if ( color != null ) { if ( color . indexOf ( "#" ) == - 1 ) { // add the " # " to the color string
color = "#" + color ; } int colLength = color . length ( ) ; if ( ( colLength == 4 ) || ( colLength == 7 ) ) { return color ; } } return "#FFFFFF" ; |
public class AABBUtils { /** * Create stair shaped bounding boxes . < br >
* The position of the bounding boxes corners are interpolated between < code > fx [ 0 ] < / code > ( start ) and < code > fx [ 1 ] < / code > ( end ) . < br >
* The second index determines the mininum ( < code > fx [ . ] < b > [ 0 ] < / b > < / code > ) and maximum ( < code > fx [ . ] < b > [ 1 ] < / b > < / code > ) bounds for the
* bounding boxes . < br >
* Same applies for < code > fy < / code > and < code > fz < / code > . < br >
* If < code > vertical < / code > is false , the bounding boxes will be stacked horizontally .
* @ param slices number of bounding boxes composing the global shape
* @ param fx bounds for the x axis for the bounding boxes
* @ param fy bounds for the y axis for the bounding boxes
* @ param fz bounds for the z axis for the bounding boxes
* @ param vertical true if the bounding boxes should be stack vertically
* @ return the bounding boxes creating the shapes */
public static AxisAlignedBB [ ] slice ( int slices , float fx [ ] [ ] , float fy [ ] [ ] , float fz [ ] [ ] , boolean vertical ) { } } | final float delta = 1 / ( float ) slices ; final int START = 0 ; final int MIN = 0 ; final int END = 1 ; final int MAX = 1 ; AxisAlignedBB [ ] aabb = new AxisAlignedBB [ slices ] ; for ( int i = 0 ; i < slices ; i ++ ) { float bx = fx [ START ] [ MIN ] + ( fx [ END ] [ MIN ] - fx [ START ] [ MIN ] ) * i * delta ; float bX = fx [ START ] [ MAX ] + ( fx [ END ] [ MAX ] - fx [ START ] [ MAX ] ) * i * delta ; float by = fy [ START ] [ MIN ] + ( fy [ END ] [ MIN ] - fy [ START ] [ MIN ] ) * i * delta ; float bY = fy [ START ] [ MAX ] + ( fy [ END ] [ MAX ] - fy [ START ] [ MAX ] ) * i * delta ; float bz = fz [ START ] [ MIN ] + ( fz [ END ] [ MIN ] - fz [ START ] [ MIN ] ) * i * delta ; float bZ = fz [ START ] [ MAX ] + ( fz [ END ] [ MAX ] - fz [ START ] [ MAX ] ) * i * delta ; if ( vertical ) { by = i * delta ; bY = by + delta ; } else { bx = i * delta ; bX = bx + delta ; } aabb [ i ] = new AxisAlignedBB ( bx , by , bz , bX , bY , bZ ) ; } return aabb ; |
public class SynchronizeFXTomcatChannel { /** * CommandTransferServer */
@ Override public void onConnectFinished ( final Object client ) { } } | synchronized ( connections ) { final SynchronizeFXTomcatConnection syncFxClient = ( SynchronizeFXTomcatConnection ) client ; connections . add ( syncFxClient ) ; connectionThreads . put ( syncFxClient , Executors . newSingleThreadExecutor ( new ThreadFactory ( ) { @ Override public Thread newThread ( final Runnable runnable ) { final Thread thread = new Thread ( runnable , "synchronizefx client connection thread-" + System . identityHashCode ( runnable ) ) ; thread . setDaemon ( true ) ; return thread ; } } ) ) ; } |
public class XPathScanner { /** * Return the token that will be returned by the scanner after the call of
* nextToken ( ) , without changing the internal state of the scanner .
* @ param paramNext
* number of next tokens to be read
* @ return token that will be read after calling nextToken ( ) */
public IXPathToken lookUpTokens ( final int paramNext ) { } } | int nextCount = paramNext ; // save current position of the scanner , to restore it later
final int lastPos = mPos ; IXPathToken token = nextToken ( ) ; while ( -- nextCount > 0 ) { token = nextToken ( ) ; if ( token . getType ( ) == TokenType . SPACE ) { nextCount ++ ; } } // reset position
mPos = lastPos ; return token ; |
public class InsightClient { /** * Perform a Standard Insight Request with a number and country .
* @ param number A single phone number that you need insight about in national or international format .
* @ param country If a number does not have a country code or it is uncertain , set the two - character country code .
* @ return A { @ link StandardInsightResponse } representing the response from the Nexmo Number Insight API .
* @ throws IOException if a network error occurred contacting the Nexmo Nexmo Number Insight API .
* @ throws NexmoClientException if there was a problem with the Nexmo request or response objects . */
public StandardInsightResponse getStandardNumberInsight ( String number , String country ) throws IOException , NexmoClientException { } } | return getStandardNumberInsight ( StandardInsightRequest . withNumberAndCountry ( number , country ) ) ; |
public class DescribeJobRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeJobRequest describeJobRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeJobRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeJobRequest . getJobId ( ) , JOBID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class StreamingIndexedData { /** * Return the next page from pageBuffer that has a non - zero position count , or null if none available */
private static Page extractNonEmptyPage ( PageBuffer pageBuffer ) { } } | Page page = pageBuffer . poll ( ) ; while ( page != null && page . getPositionCount ( ) == 0 ) { page = pageBuffer . poll ( ) ; } return page ; |
public class ImageInfo { /** * To use this class as a command line application , give it either
* some file names as parameters ( information on them will be
* printed to standard output , one line per file ) or call
* it with no parameters . It will then check data given to it
* via standard input .
* @ param args the program arguments which must be file names */
public static void _main ( String [ ] args ) { } } | ImageInfo imageInfo = new ImageInfo ( ) ; imageInfo . setDetermineImageNumber ( true ) ; boolean verbose = determineVerbosity ( args ) ; if ( args . length == 0 ) { run ( null , System . in , imageInfo , verbose ) ; } else { int index = 0 ; while ( index < args . length ) { InputStream in = null ; try { String name = args [ index ++ ] ; System . out . print ( name + ";" ) ; if ( name . startsWith ( "http://" ) ) { in = new URL ( name ) . openConnection ( ) . getInputStream ( ) ; } else { in = new FileInputStream ( name ) ; } run ( name , in , imageInfo , verbose ) ; in . close ( ) ; } catch ( IOException e ) { System . out . println ( e ) ; try { if ( in != null ) { in . close ( ) ; } } catch ( IOException ee ) { } } } } |
public class ListRecordsResult { /** * A list of all records .
* @ param records
* A list of all records . */
public void setRecords ( java . util . Collection < Record > records ) { } } | if ( records == null ) { this . records = null ; return ; } this . records = new com . amazonaws . internal . SdkInternalList < Record > ( records ) ; |
public class Tokenizer { /** * Returns an array of tokens that is optimized .
* Eliminates unnecessary white spaces for the first and last tokens .
* @ param tokens the tokens before optimizing
* @ return the optimized tokens */
public static Token [ ] optimize ( Token [ ] tokens ) { } } | if ( tokens == null ) { return null ; } String firstVal = null ; String lastVal = null ; if ( tokens . length == 1 ) { if ( tokens [ 0 ] . getType ( ) == TokenType . TEXT ) { firstVal = tokens [ 0 ] . getDefaultValue ( ) ; } } else if ( tokens . length > 1 ) { if ( tokens [ 0 ] . getType ( ) == TokenType . TEXT ) { firstVal = tokens [ 0 ] . getDefaultValue ( ) ; } if ( tokens [ tokens . length - 1 ] . getType ( ) == TokenType . TEXT ) { lastVal = tokens [ tokens . length - 1 ] . getDefaultValue ( ) ; } } if ( firstVal != null ) { String text = trimLeadingWhitespace ( firstVal ) ; if ( ! Objects . equals ( firstVal , text ) ) { tokens [ 0 ] = new Token ( text ) ; } } if ( lastVal != null && ! lastVal . isEmpty ( ) ) { String text = trimTrailingWhitespace ( lastVal ) ; if ( ! Objects . equals ( lastVal , text ) ) { tokens [ tokens . length - 1 ] = new Token ( text ) ; } } return tokens ; |
public class WebAppConfiguration { /** * Returns the serveServletsByClassname .
* @ return boolean */
public boolean isServeServletsByClassnameEnabled ( ) { } } | // PK52059 START
disallowServeServletsByClassnameProp = WCCustomProperties . DISALLOW_SERVE_SERVLETS_BY_CLASSNAME_PROP ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "isServeServletsByClassnameEnabled" , "disallowServeServletsByClassnameProp = " + disallowServeServletsByClassnameProp ) ; } if ( disallowServeServletsByClassnameProp != null ) { try { if ( Boolean . valueOf ( disallowServeServletsByClassnameProp ) . booleanValue ( ) ) { this . serveServletsByClassnameEnabled = Boolean . FALSE ; } if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "isServeServletsByClassnameEnabled" , "PK52059: disallowServeServletsByClassnameProp set to " + disallowServeServletsByClassnameProp + " for application: " + this . getApplicationName ( ) ) ; } } catch ( Exception x ) { logger . logp ( Level . SEVERE , CLASS_NAME , "isServeServletsByClassnameEnabled" , "Illegal value set for property com.ibm.ws.webcontainer.disallowserveservletsbyclassname" ) ; } } // PK52059 END
if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "isServeServletsByClassnameEnabled" , "value = " + ( this . serveServletsByClassnameEnabled != null ? this . serveServletsByClassnameEnabled . booleanValue ( ) : WCCustomProperties . SERVE_SERVLETS_BY_CLASSNAME_ENABLED ) ) ; } if ( this . serveServletsByClassnameEnabled != null ) return this . serveServletsByClassnameEnabled . booleanValue ( ) ; return WCCustomProperties . SERVE_SERVLETS_BY_CLASSNAME_ENABLED ; |
public class Collections { /** * Concatenate two Iterators
* @ param a a non - null Iterator
* @ param b a non - null Iterator
* @ return an Iterator that will iterate through all the values of ' a ' , and then all the values of ' b '
* @ param < T > the value type */
public static < T > Iterator < T > concat ( final Iterator < T > a , final Iterator < T > b ) { } } | assert ( a != null ) ; assert ( b != null ) ; return new Iterator < T > ( ) { @ Override public boolean hasNext ( ) { return a . hasNext ( ) || b . hasNext ( ) ; } @ Override public T next ( ) { if ( a . hasNext ( ) ) { return a . next ( ) ; } return b . next ( ) ; } @ Override public void remove ( ) { throw new UnsupportedOperationException ( ) ; } } ; |
public class DirtyItemList { /** * Appends the dirty object tile at the given coordinates to the dirty item list .
* @ param scobj the scene object that is dirty . */
public void appendDirtyObject ( SceneObject scobj ) { } } | DirtyItem item = getDirtyItem ( ) ; item . init ( scobj , scobj . info . x , scobj . info . y ) ; _items . add ( item ) ; |
public class DefaultReconfigurationProblem { /** * A naive heuristic to be sure every variables will be instantiated . */
private void defaultHeuristic ( ) { } } | IntStrategy intStrat = Search . intVarSearch ( new FirstFail ( csp ) , new IntDomainMin ( ) , csp . retrieveIntVars ( true ) ) ; SetStrategy setStrat = new SetStrategy ( csp . retrieveSetVars ( ) , new InputOrder < > ( csp ) , new SetDomainMin ( ) , true ) ; RealStrategy realStrat = new RealStrategy ( csp . retrieveRealVars ( ) , new Occurrence < > ( ) , new RealDomainMiddle ( ) ) ; solver . setSearch ( new StrategiesSequencer ( intStrat , realStrat , setStrat ) ) ; |
public class ClassUseWriter { /** * Add the package use information .
* @ param pkg the package that uses the given class
* @ param contentTree the content tree to which the package use information will be added */
protected void addPackageUse ( PackageElement pkg , Content contentTree ) { } } | Content thFirst = HtmlTree . TH_ROW_SCOPE ( HtmlStyle . colFirst , getHyperLink ( getPackageAnchorName ( pkg ) , new StringContent ( utils . getPackageName ( pkg ) ) ) ) ; contentTree . addContent ( thFirst ) ; HtmlTree tdLast = new HtmlTree ( HtmlTag . TD ) ; tdLast . addStyle ( HtmlStyle . colLast ) ; addSummaryComment ( pkg , tdLast ) ; contentTree . addContent ( tdLast ) ; |
public class PiElectronegativityDescriptor { /** * Sets the parameters attribute of the PiElectronegativityDescriptor
* object
* @ param params The number of maximum iterations . 1 = maxIterations . 2 = maxResonStruc .
* @ exception CDKException Description of the Exception */
@ Override public void setParameters ( Object [ ] params ) throws CDKException { } } | if ( params . length > 3 ) throw new CDKException ( "PartialPiChargeDescriptor only expects three parameter" ) ; if ( ! ( params [ 0 ] instanceof Integer ) ) throw new CDKException ( "The parameter must be of type Integer" ) ; maxIterations = ( Integer ) params [ 0 ] ; if ( params . length > 1 && params [ 1 ] != null ) { if ( ! ( params [ 1 ] instanceof Boolean ) ) throw new CDKException ( "The parameter must be of type Boolean" ) ; lpeChecker = ( Boolean ) params [ 1 ] ; } if ( params . length > 2 && params [ 2 ] != null ) { if ( ! ( params [ 2 ] instanceof Integer ) ) throw new CDKException ( "The parameter must be of type Integer" ) ; maxResonStruc = ( Integer ) params [ 2 ] ; } |
public class LdiSrl { public static boolean isQuotedAnything ( String str , String quotation ) { } } | assertStringNotNull ( str ) ; assertQuotationNotNull ( quotation ) ; return isQuotedAnything ( str , quotation , quotation ) ; |
public class Bean { /** * Report a bound indexed property update to any registered listeners . < p >
* No event is fired if old and new values are equal and non - null .
* @ param propertyName The programmatic name of the property that was changed .
* @ param index index of the property element that was changed .
* @ param oldValue The old value of the property .
* @ param newValue The new value of the property .
* @ since 2.0 */
protected final void fireIndexedPropertyChange ( String propertyName , int index , Object oldValue , Object newValue ) { } } | PropertyChangeSupport aChangeSupport = this . changeSupport ; if ( aChangeSupport == null ) { return ; } aChangeSupport . fireIndexedPropertyChange ( propertyName , index , oldValue , newValue ) ; |
public class ThriftConnectionPool { /** * 判断连接代理类是否可用的方法
* @ param connection
* 需要检测的连接代理类对象
* @ return true为可用 false为不可用 */
public boolean isConnectionHandleAlive ( ThriftConnectionHandle < T > connection ) { } } | boolean result = false ; boolean logicallyClosed = connection . logicallyClosed . get ( ) ; try { connection . logicallyClosed . compareAndSet ( true , false ) ; // 反射调用ping方法
T client = null ; if ( this . thriftServiceType == ThriftServiceType . SINGLE_INTERFACE ) { client = connection . getClient ( ) ; } else { Map < String , T > muiltServiceClients = connection . getMuiltServiceClients ( ) ; if ( muiltServiceClients . size ( ) == 0 ) { // 没有可用的客户端 直接返回
return false ; } Iterator < T > iterator = muiltServiceClients . values ( ) . iterator ( ) ; if ( iterator . hasNext ( ) ) { client = iterator . next ( ) ; } else { return false ; } } try { Method method = client . getClass ( ) . getMethod ( "ping" ) ; method . invoke ( client ) ; } catch ( Exception e ) { return false ; } result = true ; } finally { connection . logicallyClosed . set ( logicallyClosed ) ; connection . setConnectionLastResetInMs ( System . currentTimeMillis ( ) ) ; } return result ; |
public class AppEventsLogger { /** * Logs a purchase event with Facebook , in the specified amount and with the specified currency . Additional
* detail about the purchase can be passed in through the parameters bundle .
* @ param purchaseAmount Amount of purchase , in the currency specified by the ' currency ' parameter . This value
* will be rounded to the thousandths place ( e . g . , 12.34567 becomes 12.346 ) .
* @ param currency Currency used to specify the amount .
* @ param parameters Arbitrary additional information for describing this event . Should have no more than
* 10 entries , and keys should be mostly consistent from one purchase event to the next . */
public void logPurchase ( BigDecimal purchaseAmount , Currency currency , Bundle parameters ) { } } | if ( purchaseAmount == null ) { notifyDeveloperError ( "purchaseAmount cannot be null" ) ; return ; } else if ( currency == null ) { notifyDeveloperError ( "currency cannot be null" ) ; return ; } if ( parameters == null ) { parameters = new Bundle ( ) ; } parameters . putString ( AppEventsConstants . EVENT_PARAM_CURRENCY , currency . getCurrencyCode ( ) ) ; logEvent ( AppEventsConstants . EVENT_NAME_PURCHASED , purchaseAmount . doubleValue ( ) , parameters ) ; eagerFlush ( ) ; |
public class AbstractChainableEvent { /** * { @ inheritDoc }
* @ since 1.2.0 */
@ Override public ChainableEvent onFailure ( Event onFailureEvent ) { } } | this . onFailureChains . add ( new ChainLink ( ) . onFailure ( linkChainIdentifier ( onFailureEvent ) ) ) ; return this ; |
public class SSLEngineImpl { /** * Non - application OutputRecords go through here . */
void writeRecord ( EngineOutputRecord eor ) throws IOException { } } | // eventually compress as well .
writer . writeRecord ( eor , writeMAC , writeCipher ) ; /* * Check the sequence number state
* Note that in order to maintain the connection I / O
* properly , we check the sequence number after the last
* record writing process . As we request renegotiation
* or close the connection for wrapped sequence number
* when there is enough sequence number space left to
* handle a few more records , so the sequence number
* of the last record cannot be wrapped . */
if ( ( connectionState < cs_ERROR ) && ! isOutboundDone ( ) ) { checkSequenceNumber ( writeMAC , eor . contentType ( ) ) ; } |
public class Line { /** * Marks this line empty . Also sets previous / next line ' s empty attributes . */
public void setEmpty ( ) { } } | m_sValue = "" ; m_nLeading = 0 ; m_nTrailing = 0 ; m_bIsEmpty = true ; if ( m_aNext != null ) m_aNext . m_bPrevEmpty = true ; |
public class RowList { /** * Tries to get BLOB from raw | value | .
* @ param value the binary value
* @ return the created BLOB
* @ throws SQLException if fails to create the BLOB */
public java . sql . Blob getBlob ( final Object value ) throws SQLException { } } | if ( value instanceof java . sql . Blob ) return ( java . sql . Blob ) value ; if ( value instanceof byte [ ] ) { return new SerialBlob ( ( byte [ ] ) value ) ; |
public class Program { /** * Add a piecewise function .
* @ param name is the name of the function
* @ param argumentName argument name
* @ return the function */
public PiecewiseFunction addPiecewiseFunction ( String name , String argumentName ) { } } | return addFunction ( new PiecewiseFunction ( name , argumentName ) ) ; |
public class DeviceProxyDAODefaultImpl { public int read_attribute_asynch ( final DeviceProxy deviceProxy , final String [ ] attnames ) throws DevFailed { } } | checkIfTango ( deviceProxy , "read_attributes_asynch" ) ; build_connection ( deviceProxy ) ; // Create the request object
Request request ; if ( deviceProxy . device_5 != null ) { request = deviceProxy . device_5 . _request ( "read_attributes_5" ) ; setRequestArgsForReadAttr ( request , attnames , get_source ( deviceProxy ) , DevLockManager . getInstance ( ) . getClntIdent ( ) , AttributeValueList_5Helper . type ( ) ) ; request . exceptions ( ) . add ( MultiDevFailedHelper . type ( ) ) ; } else if ( deviceProxy . device_4 != null ) { request = deviceProxy . device_4 . _request ( "read_attributes_4" ) ; setRequestArgsForReadAttr ( request , attnames , get_source ( deviceProxy ) , DevLockManager . getInstance ( ) . getClntIdent ( ) , AttributeValueList_4Helper . type ( ) ) ; request . exceptions ( ) . add ( MultiDevFailedHelper . type ( ) ) ; } else if ( deviceProxy . device_3 != null ) { request = deviceProxy . device_3 . _request ( "read_attributes_3" ) ; setRequestArgsForReadAttr ( request , attnames , get_source ( deviceProxy ) , null , AttributeValueList_3Helper . type ( ) ) ; } else if ( deviceProxy . device_2 != null ) { request = deviceProxy . device_2 . _request ( "read_attributes_2" ) ; setRequestArgsForReadAttr ( request , attnames , get_source ( deviceProxy ) , null , AttributeValueListHelper . type ( ) ) ; } else { request = deviceProxy . device . _request ( "read_attributes" ) ; setRequestArgsForReadAttr ( request , attnames , null , null , AttributeValueListHelper . type ( ) ) ; } // send it ( defered or just one way )
request . send_deferred ( ) ; // store request reference to read reply later
return ApiUtil . put_async_request ( new AsyncCallObject ( request , deviceProxy , ATT_R , attnames ) ) ; |
public class WiringPage { /** * returns true if location is not already set in the properties , otherwise false */
private boolean setLocation ( String global , String context , Map < String , Object > properties ) { } } | String locationKey = "location." + context ; Object propvalue = properties . get ( locationKey ) ; if ( propvalue == null ) { properties . put ( locationKey , global ) ; } else if ( propvalue . getClass ( ) . isArray ( ) ) { Object [ ] locations = ( Object [ ] ) propvalue ; if ( ArrayUtils . contains ( locations , global ) ) { return false ; } Object [ ] newArray = Arrays . copyOf ( locations , locations . length + 1 ) ; newArray [ locations . length ] = global ; properties . put ( locationKey , newArray ) ; } else { if ( ( ( String ) propvalue ) . equals ( global ) ) { return false ; } Object [ ] newArray = new Object [ 2 ] ; newArray [ 0 ] = propvalue ; newArray [ 1 ] = global ; properties . put ( locationKey , newArray ) ; } return true ; |
public class ScoreTemplate { /** * Sets the text attributes of several fields
* @ param fields
* one of { @ link ScoreElements } constants
* @ param attrib
* Map of attributes
* @ see java . awt . font . TextAttribute */
public void setTextAttributes ( byte [ ] fields , Hashtable attrib ) { } } | for ( byte field : fields ) { getFieldInfos ( field ) . m_textAttributes = attrib ; } notifyListeners ( ) ; |
public class BsFavoriteLogCB { public FavoriteLogCB acceptPK ( String id ) { } } | assertObjectNotNull ( "id" , id ) ; BsFavoriteLogCB cb = this ; cb . query ( ) . docMeta ( ) . setId_Equal ( id ) ; return ( FavoriteLogCB ) this ; |
public class TemperatureConversion { /** * Convert a temperature value from the Farenheit temperature scale to another .
* @ param to TemperatureScale
* @ param temperature value in degrees Farenheit
* @ return converted temperature value in the requested to scale */
public static double convertFromFarenheit ( TemperatureScale to , double temperature ) { } } | switch ( to ) { case FARENHEIT : return temperature ; case CELSIUS : return convertFarenheitToCelsius ( temperature ) ; case KELVIN : return convertFarenheitToKelvin ( temperature ) ; case RANKINE : return convertFarenheitToRankine ( temperature ) ; default : throw ( new RuntimeException ( "Invalid termpature conversion" ) ) ; } |
public class SelectFormat { /** * / * package */
static int findSubMessage ( MessagePattern pattern , int partIndex , String keyword ) { } } | int count = pattern . countParts ( ) ; int msgStart = 0 ; // Iterate over ( ARG _ SELECTOR , message ) pairs until ARG _ LIMIT or end of select - only pattern .
do { MessagePattern . Part part = pattern . getPart ( partIndex ++ ) ; MessagePattern . Part . Type type = part . getType ( ) ; if ( type == MessagePattern . Part . Type . ARG_LIMIT ) { break ; } assert type == MessagePattern . Part . Type . ARG_SELECTOR ; // part is an ARG _ SELECTOR followed by a message
if ( pattern . partSubstringMatches ( part , keyword ) ) { // keyword matches
return partIndex ; } else if ( msgStart == 0 && pattern . partSubstringMatches ( part , "other" ) ) { msgStart = partIndex ; } partIndex = pattern . getLimitPartIndex ( partIndex ) ; } while ( ++ partIndex < count ) ; return msgStart ; |
public class NetFlowV5Parser { /** * < pre >
* | BYTES | CONTENTS | DESCRIPTION |
* | 0-1 | version | NetFlow export format version number |
* | 2-3 | count | Number of flows exported in this packet ( 1-30 ) |
* | 4-7 | sys _ uptime | Current time in milliseconds since the export device booted |
* | 8-11 | unix _ secs | Current count of seconds since 0000 UTC 1970 |
* | 12-15 | unix _ nsecs | Residual nanoseconds since 0000 UTC 1970 |
* | 16-19 | flow _ sequence | Sequence counter of total flows seen |
* | 20 | engine _ type | Type of flow - switching engine |
* | 21 | engine _ id | Slot number of the flow - switching engine |
* | 22-23 | sampling _ interval | First two bits hold the sampling mode ; remaining 14 bits hold value of sampling interval |
* < / pre > */
private static NetFlowV5Header parseHeader ( ByteBuf bb ) { } } | final int version = bb . readUnsignedShort ( ) ; if ( version != 5 ) { throw new InvalidFlowVersionException ( version ) ; } final int count = bb . readUnsignedShort ( ) ; final long sysUptime = bb . readUnsignedInt ( ) ; final long unixSecs = bb . readUnsignedInt ( ) ; final long unixNsecs = bb . readUnsignedInt ( ) ; final long flowSequence = bb . readUnsignedInt ( ) ; final short engineType = bb . readUnsignedByte ( ) ; final short engineId = bb . readUnsignedByte ( ) ; final short sampling = bb . readShort ( ) ; final int samplingMode = ( sampling >> 14 ) & 3 ; final int samplingInterval = sampling & 0x3fff ; return NetFlowV5Header . create ( version , count , sysUptime , unixSecs , unixNsecs , flowSequence , engineType , engineId , samplingMode , samplingInterval ) ; |
public class TimerNpImpl { /** * Determines if Timer methods are allowed based on the ' cancelled ' state
* of the timer instance relative to the current thread and transaction .
* NoSuchObjectLocalException is thrown if the timer has been cancelled . < p >
* Returns true if the current thread is running in the scope of the timeout
* method , and access is allowed to Timer state even if another thread has
* cancelled the timer ; otherwise returns false .
* Note that if the current thread is running in the scope of the timeout
* method , it should have access to timer state even if another thread
* cancels the timer . However , if the timeout method calls cancel , then
* that access is no longer allowed . The EJB specification does indicate
* that calling Timer methods should fail after calling cancel , and not
* specifically commit of the cancel transaction .
* This is similar to the caching support provided for persistent timers .
* Must be called by all Timer methods to insure EJB Specification
* compliance . < p >
* @ throws NoSuchObjectLocalException if this instance has been cancelled
* relative to the current thread and transaction . */
private void checkIfCancelled ( ) { } } | // If a cancel has been committed then the timer " does not exist " ,
// unless the cancel occurred after the timer started running
// and the current thread is for that running timeout method .
if ( ivDestroyed && ivTimeoutThread != Thread . currentThread ( ) ) { String msg = "Timer with ID " + ivTaskId + " has been canceled." ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "checkIfCancelled: NoSuchObjectLocalException : " + msg ) ; throw new NoSuchObjectLocalException ( msg ) ; } // If cancel was called during the current transaction then the timer
// " does not exist " , regardless of whether or not the current thread
// is a running timeout method .
ContainerTx tx = ivContainer . getCurrentContainerTx ( ) ; if ( tx != null && tx . timersCanceled != null && tx . timersCanceled . containsValue ( this ) ) { String msg = "Timer with ID " + ivTaskId + " has been canceled in the current transaction." ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "checkIfCancelled: NoSuchObjectLocalException : " + msg ) ; throw new NoSuchObjectLocalException ( msg ) ; } |
public class CmsDriverManager { /** * Removes a resource from the given organizational unit . < p >
* @ param dbc the current db context
* @ param orgUnit the organizational unit to remove the resource from
* @ param resource the resource that is to be removed from the organizational unit
* @ throws CmsException if something goes wrong
* @ see org . opencms . security . CmsOrgUnitManager # addResourceToOrgUnit ( CmsObject , String , String )
* @ see org . opencms . security . CmsOrgUnitManager # addResourceToOrgUnit ( CmsObject , String , String ) */
public void removeResourceFromOrgUnit ( CmsDbContext dbc , CmsOrganizationalUnit orgUnit , CmsResource resource ) throws CmsException { } } | m_monitor . flushCache ( CmsMemoryMonitor . CacheType . HAS_ROLE , CmsMemoryMonitor . CacheType . ROLE_LIST ) ; getUserDriver ( dbc ) . removeResourceFromOrganizationalUnit ( dbc , orgUnit , resource ) ; |
public class JsonRuntimeReporterHelper { /** * This method will generate Configuration summary by fetching the details from ReportDataGenerator */
private JsonObject generateConfigSummary ( ) throws JsonParseException { } } | logger . entering ( ) ; if ( jsonConfigSummary == null ) { jsonConfigSummary = new JsonObject ( ) ; for ( Entry < String , String > temp : ConfigSummaryData . getConfigSummary ( ) . entrySet ( ) ) { jsonConfigSummary . addProperty ( temp . getKey ( ) , temp . getValue ( ) ) ; } } logger . exiting ( jsonConfigSummary ) ; return jsonConfigSummary ; |
public class ScheduleRunConfigurationMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ScheduleRunConfiguration scheduleRunConfiguration , ProtocolMarshaller protocolMarshaller ) { } } | if ( scheduleRunConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( scheduleRunConfiguration . getExtraDataPackageArn ( ) , EXTRADATAPACKAGEARN_BINDING ) ; protocolMarshaller . marshall ( scheduleRunConfiguration . getNetworkProfileArn ( ) , NETWORKPROFILEARN_BINDING ) ; protocolMarshaller . marshall ( scheduleRunConfiguration . getLocale ( ) , LOCALE_BINDING ) ; protocolMarshaller . marshall ( scheduleRunConfiguration . getLocation ( ) , LOCATION_BINDING ) ; protocolMarshaller . marshall ( scheduleRunConfiguration . getVpceConfigurationArns ( ) , VPCECONFIGURATIONARNS_BINDING ) ; protocolMarshaller . marshall ( scheduleRunConfiguration . getCustomerArtifactPaths ( ) , CUSTOMERARTIFACTPATHS_BINDING ) ; protocolMarshaller . marshall ( scheduleRunConfiguration . getRadios ( ) , RADIOS_BINDING ) ; protocolMarshaller . marshall ( scheduleRunConfiguration . getAuxiliaryApps ( ) , AUXILIARYAPPS_BINDING ) ; protocolMarshaller . marshall ( scheduleRunConfiguration . getBillingMethod ( ) , BILLINGMETHOD_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class EventBus { /** * Remove the sticky events which can be assigned to specified < code > eventType < / code > and posted with the specified < code > eventId < / code > .
* @ param eventType
* @ param eventId
* @ return true if one or one more than sticky events are removed , otherwise , < code > false < / code > . */
public boolean removeStickyEvents ( final Class < ? > eventType , final String eventId ) { } } | final List < Object > keyToRemove = new ArrayList < > ( ) ; synchronized ( stickyEventMap ) { for ( Map . Entry < Object , String > entry : stickyEventMap . entrySet ( ) ) { if ( N . equals ( entry . getValue ( ) , eventId ) && eventType . isAssignableFrom ( entry . getKey ( ) . getClass ( ) ) ) { keyToRemove . add ( entry ) ; } } if ( N . notNullOrEmpty ( keyToRemove ) ) { synchronized ( stickyEventMap ) { for ( Object event : keyToRemove ) { stickyEventMap . remove ( event ) ; } this . mapOfStickyEvent = null ; } return true ; } } return false ; |
public class BackendTransaction { /** * Applies the specified insertion and deletion mutations on the property index to the provided key .
* Both , the list of additions or deletions , may be empty or NULL if there is nothing to be added and / or deleted .
* @ param key Key
* @ param additions List of entries ( column + value ) to be added
* @ param deletions List of columns to be removed */
public void mutateIndex ( StaticBuffer key , List < Entry > additions , List < Entry > deletions ) throws BackendException { } } | indexStore . mutateEntries ( key , additions , deletions , storeTx ) ; |
public class Payload { /** * Create a PayloadFetcher to execute fetch .
* @ param pathAccountSid The SID of the Account that created the resource to
* fetch
* @ param pathReferenceSid The SID of the recording to which the AddOnResult
* resource that contains the payload to fetch belongs
* @ param pathAddOnResultSid The SID of the AddOnResult to which the payload to
* fetch belongs
* @ param pathSid The unique string that identifies the resource to fetch
* @ return PayloadFetcher capable of executing the fetch */
public static PayloadFetcher fetcher ( final String pathAccountSid , final String pathReferenceSid , final String pathAddOnResultSid , final String pathSid ) { } } | return new PayloadFetcher ( pathAccountSid , pathReferenceSid , pathAddOnResultSid , pathSid ) ; |
public class TransformJobDefinitionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TransformJobDefinition transformJobDefinition , ProtocolMarshaller protocolMarshaller ) { } } | if ( transformJobDefinition == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( transformJobDefinition . getMaxConcurrentTransforms ( ) , MAXCONCURRENTTRANSFORMS_BINDING ) ; protocolMarshaller . marshall ( transformJobDefinition . getMaxPayloadInMB ( ) , MAXPAYLOADINMB_BINDING ) ; protocolMarshaller . marshall ( transformJobDefinition . getBatchStrategy ( ) , BATCHSTRATEGY_BINDING ) ; protocolMarshaller . marshall ( transformJobDefinition . getEnvironment ( ) , ENVIRONMENT_BINDING ) ; protocolMarshaller . marshall ( transformJobDefinition . getTransformInput ( ) , TRANSFORMINPUT_BINDING ) ; protocolMarshaller . marshall ( transformJobDefinition . getTransformOutput ( ) , TRANSFORMOUTPUT_BINDING ) ; protocolMarshaller . marshall ( transformJobDefinition . getTransformResources ( ) , TRANSFORMRESOURCES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ISO9660Directory { /** * Add file
* @ param file File to be added */
public void addFile ( ISO9660File file ) { } } | file . setParentDirectory ( this ) ; files . add ( file ) ; sorted = false ; |
public class ClassUtils { /** * Flattens the array into a single , long string . The separator string gets
* added between the objects , but not after the last one . Uses the " toString ( ) "
* method of the objects to turn them into a string .
* @ param linesthe lines to flatten
* @ param septhe separator
* @ returnthe generated string */
public static String flatten ( Object [ ] lines , String sep ) { } } | StringBuilder result ; int i ; result = new StringBuilder ( ) ; for ( i = 0 ; i < lines . length ; i ++ ) { if ( i > 0 ) result . append ( sep ) ; result . append ( lines [ i ] . toString ( ) ) ; } return result . toString ( ) ; |
public class CloudFormation { /** * signal success to the given CloudFormation stack . < br >
* < br >
* Needed AWS actions :
* < ul >
* < li > cloudformation : SignalResource < / li >
* < / ul > */
public void signalReady ( String stackName , String resourceName ) { } } | Preconditions . checkArgument ( stackName != null && ! stackName . isEmpty ( ) ) ; Preconditions . checkArgument ( resourceName != null && ! resourceName . isEmpty ( ) ) ; SignalResourceRequest req = new SignalResourceRequest ( ) ; req . setLogicalResourceId ( resourceName ) ; req . setStackName ( stackName ) ; req . setStatus ( ResourceSignalStatus . SUCCESS ) ; req . setUniqueId ( this . ec2Context . getInstanceId ( ) ) ; this . cloudFormationClient . signalResource ( req ) ; |
public class ErrorTools { /** * Log a JMS exception with an error level
* @ param e
* @ param log */
public static void log ( String context , JMSException e , Log log ) { } } | StringBuilder message = new StringBuilder ( ) ; if ( context != null ) { message . append ( "[" ) ; message . append ( context ) ; message . append ( "] " ) ; } if ( e . getErrorCode ( ) != null ) { message . append ( "error={" ) ; message . append ( e . getErrorCode ( ) ) ; message . append ( "} " ) ; } message . append ( e . getMessage ( ) ) ; log . error ( message . toString ( ) ) ; if ( e . getLinkedException ( ) != null ) log . error ( "Linked exception was :" , e . getLinkedException ( ) ) ; |
public class EntityField { /** * 获取指定的注解
* @ param annotationClass
* @ param < T >
* @ return */
public < T extends Annotation > T getAnnotation ( Class < T > annotationClass ) { } } | T result = null ; if ( field != null ) { result = field . getAnnotation ( annotationClass ) ; } if ( result == null && setter != null ) { result = setter . getAnnotation ( annotationClass ) ; } if ( result == null && getter != null ) { result = getter . getAnnotation ( annotationClass ) ; } return result ; |
public class AbstractAsyncChannel { /** * Performs a read or write operation .
* @ param buffers -
* a Direct ByteBuffer array for the operation
* @ param position -
* a position in a file for the operation .
* @ param isRead -
* true for a read operation , false for a write operation
* @ return a future representing the IO operation underway */
IAsyncFuture multiIO ( ByteBuffer [ ] buffers , long position , boolean isRead , boolean forceQueue , long bytesRequested , boolean useJITBuffer , VirtualConnection vci , boolean asyncIO ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "multiIO(.," + position + "," + isRead + "," + forceQueue + "," + bytesRequested + "," + useJITBuffer + ",.," + asyncIO ) ; } // Sanity check on the arguments
if ( buffers == null ) { throw new IllegalArgumentException ( ) ; } // Allocate a future representing this operation
AsyncFuture theFuture = null ; CompletionKey iocb = null ; // set it everytime , faster than doing and " if ( channelVCI = = null ) "
this . channelVCI = vci ; if ( isRead ) { theFuture = this . readFuture ; iocb = this . readIOCB ; if ( asyncIO ) { iocb . setCallIdentifier ( this . channelIndex | READ_INDEX ) ; } else { iocb . setCallIdentifier ( this . channelIndex | SYNC_READ_INDEX ) ; } } else { theFuture = this . writeFuture ; iocb = this . writeIOCB ; if ( asyncIO ) { iocb . setCallIdentifier ( this . channelIndex | WRITE_INDEX ) ; } else { iocb . setCallIdentifier ( this . channelIndex | SYNC_WRITE_INDEX ) ; } } theFuture . resetFuture ( ) ; theFuture . setBuffers ( buffers ) ; if ( ! isOpen ( ) ) { theFuture . completed ( new ClosedChannelException ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "multiIO" , theFuture ) ; } return theFuture ; } // Prepare the buffer arrays
int count = 0 ; for ( int i = 0 ; i < buffers . length ; i ++ ) { // If the buffer array entry is null , stop processing the array
if ( buffers [ i ] == null ) break ; count ++ ; } if ( count == 0 ) { // Should always have at least one buffer , if not , its an error .
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "no buffers passed on I/O call" ) ; } AsyncException exception = new AsyncException ( "no buffers passed on I/O call" ) ; FFDCFilter . processException ( exception , getClass ( ) . getName ( ) , "384" , this ) ; // We were asked to do no work
theFuture . completed ( exception ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "multiIO" , theFuture ) ; } return theFuture ; } else if ( count > iocb . getBufferCount ( ) ) { // too many buffers to fit in Completion Key , so expand it
iocb . expandBuffers ( count ) ; } for ( int i = 0 ; i < count ; i ++ ) { // Set the start address of the data in each buffer
iocb . setBuffer ( ( getBufAddress ( buffers [ i ] ) + buffers [ i ] . position ( ) ) , buffers [ i ] . remaining ( ) , i ) ; } // Make the OS call and see if it completes immediately or asyncronously .
boolean pending = false ; iocb . setBytesAffected ( 0 ) ; try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Requesting IO from native for " + " call id: " + Long . toHexString ( iocb . getCallIdentifier ( ) ) + " channel id: " + iocb . getChannelIdentifier ( ) ) ; } iocb . preNativePrep ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "CompleteKey in AbstractAsyncChannel.multiIO before preNativePrep() call" , iocb ) ; } pending = provider . multiIO3 ( iocb . getAddress ( ) , position , count , isRead , forceQueue , bytesRequested , useJITBuffer ) ; iocb . postNativePrep ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "CompleteKey in AbstractAsyncChannel.multiIO after postNativePrep() call" , iocb ) ; } // For pending operations , ensure that someone is listening . . .
if ( pending ) { if ( vci . isInputStateTrackingOperational ( ) ) { synchronized ( vci . getLockObject ( ) ) { if ( asyncIO ) { // only allow closes of outstanding async reads / writes
if ( isRead ) { vci . setReadStatetoCloseAllowedNoSync ( ) ; } else { vci . setWriteStatetoCloseAllowedNoSync ( ) ; } } if ( vci . getCloseWaiting ( ) ) { vci . getLockObject ( ) . notify ( ) ; } } // end - sync
} } else { // For calls that complete immediately , complete the future
// according to the returned data
int rc = iocb . getReturnCode ( ) ; if ( rc == 0 ) { // Defend against erroneous combination of values returned from native
if ( iocb . getBytesAffected ( ) == 0 && bytesRequested > 0 ) { IOException ioe = new IOException ( "Async IO operation failed, internal error" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Error processing multiIO request, exception: " + ioe . getMessage ( ) ) ; } theFuture . completed ( ioe ) ; } else { // The IO operation succeeded , set the buffer position to reflect the number of bytes read / written .
theFuture . completed ( iocb . getBytesAffected ( ) ) ; } } else { // The operation completed immediately with an IO error .
theFuture . completed ( AsyncLibrary . getIOException ( "Async IO operation failed (1), reason: " , rc ) ) ; } } } catch ( AsyncException exception ) { // If a problem occurs invoking the async call , then the operation
// completes immediately , with an Exception .
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Error processing multiIO request, exception: " + exception . getMessage ( ) ) ; } FFDCFilter . processException ( exception , getClass ( ) . getName ( ) , "420" , this ) ; theFuture . completed ( exception ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "multiIO" , theFuture ) ; } return theFuture ; |
public class Cluster { /** * Primary callback which is triggered upon successful Zookeeper connection . */
void onConnect ( ) throws InterruptedException , IOException { } } | if ( state . get ( ) != NodeState . Fresh ) { if ( previousZKSessionStillActive ( ) ) { LOG . info ( "ZooKeeper session re-established before timeout." ) ; return ; } LOG . warn ( "Rejoined after session timeout. Forcing shutdown and clean startup." ) ; ensureCleanStartup ( ) ; } LOG . info ( "Connected to Zookeeper (ID: {})." , myNodeID ) ; ZKUtils . ensureOrdasityPaths ( zk , name , config . workUnitName , config . workUnitShortName ) ; joinCluster ( ) ; listener . onJoin ( zk ) ; if ( watchesRegistered . compareAndSet ( false , true ) ) { registerWatchers ( ) ; } initialized . set ( true ) ; initializedLatch . countDown ( ) ; setState ( NodeState . Started ) ; claimer . requestClaim ( ) ; verifyIntegrity ( ) ; balancingPolicy . onConnect ( ) ; if ( config . enableAutoRebalance ) { scheduleRebalancing ( ) ; } |
public class PooledClusterConnectionProvider { /** * Reset the internal connection cache . This is necessary because the { @ link Partitions } have no reference to the connection
* cache .
* Synchronize on { @ code stateLock } to initiate a happens - before relation and clear the thread caches of other threads . */
private void resetFastConnectionCache ( ) { } } | synchronized ( stateLock ) { Arrays . fill ( writers , null ) ; Arrays . fill ( readers , null ) ; } |
public class HMac { /** * 初始化
* @ param algorithm 算法
* @ param key 密钥
* @ return { @ link HMac }
* @ throws CryptoException Cause by IOException */
public HMac init ( String algorithm , byte [ ] key ) { } } | return init ( algorithm , ( null == key ) ? null : new SecretKeySpec ( key , algorithm ) ) ; |
public class TimestampUtils { /** * Get a shared calendar , applying the supplied time zone or the default time zone if null .
* @ param timeZone time zone to be set for the calendar
* @ return The shared calendar . */
public Calendar getSharedCalendar ( TimeZone timeZone ) { } } | if ( timeZone == null ) { timeZone = getDefaultTz ( ) ; } Calendar tmp = calendarWithUserTz ; tmp . setTimeZone ( timeZone ) ; return tmp ; |
public class BooleanUtils { /** * Performs a logical AND on all the Boolean values and returns true if an only if all Boolean values evaluate
* to true , as determined by the BooleanUtils . valueOf method on the Boolean wrapper object . If the Boolean array
* is null , then the result of the AND operation is false .
* @ param values the array of Boolean values evaluated with the logical AND operator .
* @ return a boolean value of true if the Boolean array is not null and all Boolean wrapper object evaluate to true .
* @ see # valueOf ( Boolean ) */
@ SuppressWarnings ( "all" ) @ NullSafe public static boolean and ( Boolean ... values ) { } } | boolean result = ( values != null ) ; // innocent until proven guilty
if ( result ) { for ( Boolean value : values ) { result &= valueOf ( value ) ; if ( ! result ) { // short - circuit if we find a false value
break ; } } } return result ; |
public class BrowseIterator { /** * Loads the next page
* @ return false if there are no more pages to load */
private boolean loadPage ( ) { } } | Collection < T > list ; if ( pages . size ( ) <= pageIndex ) { return false ; } list = pages . get ( pageIndex ) ; currentPage = list . iterator ( ) ; return true ; |
public class Vector { /** * Sets the size of this vector . If the new size is greater than the
* current size , new { @ code null } items are added to the end of
* the vector . If the new size is less than the current size , all
* components at index { @ code newSize } and greater are discarded .
* @ param newSize the new size of this vector
* @ throws ArrayIndexOutOfBoundsException if the new size is negative */
public synchronized void setSize ( int newSize ) { } } | modCount ++ ; if ( newSize > elementCount ) { ensureCapacityHelper ( newSize ) ; } else { for ( int i = newSize ; i < elementCount ; i ++ ) { elementData [ i ] = null ; } } elementCount = newSize ; |
public class DCProgressBar { /** * Sets the value of the progress bar , if the new value is greater than the
* previous value .
* @ param newValue
* @ return whether or not the value was greater , and thus updated */
public boolean setValueIfGreater ( final int newValue ) { } } | final boolean greater = _value . setIfSignificantToUser ( newValue ) ; if ( greater ) { WidgetUtils . invokeSwingAction ( ( ) -> DCProgressBar . super . setValue ( newValue ) ) ; } return greater ; |
public class Client { /** * ( non - Javadoc )
* @ see org . restcomm . protocols . ss7 . map . api . service . supplementary . MAPServiceSupplementaryListener
* # onProcessUnstructuredSSRequestIndication ( org . mobicents . protocols . ss7 . map .
* api . service . supplementary . ProcessUnstructuredSSRequestIndication ) */
@ Override public void onProcessUnstructuredSSRequest ( ProcessUnstructuredSSRequest procUnstrReqInd ) { } } | // This error condition . Client should never receive the
// ProcessUnstructuredSSRequestIndication
logger . error ( String . format ( "onProcessUnstructuredSSRequestIndication for Dialog=%d and invokeId=%d" , procUnstrReqInd . getMAPDialog ( ) . getLocalDialogId ( ) , procUnstrReqInd . getInvokeId ( ) ) ) ; |
public class ParallelLists { /** * implements the visitor to reset the opcode stack , and the file maps
* @ param obj
* the currently parsed method code block */
@ Override public void visitCode ( final Code obj ) { } } | stack . resetForMethodEntry ( this ) ; indexToFieldMap . clear ( ) ; super . visitCode ( obj ) ; |
public class IOGroovyMethods { /** * Iterates through the given reader line by line . Each line is passed to the
* given 1 or 2 arg closure . If the closure has two arguments , the line count is passed
* as the second argument . The Reader is closed before this method returns .
* @ param self a Reader , closed after the method returns
* @ param firstLine the line number value used for the first line ( default is 1 , set to 0 to start counting from 0)
* @ param closure a closure which will be passed each line ( or for 2 arg closures the line and line count )
* @ return the last value returned by the closure
* @ throws IOException if an IOException occurs .
* @ since 1.5.7 */
public static < T > T eachLine ( Reader self , int firstLine , @ ClosureParams ( value = FromString . class , options = { } } | "String" , "String,Integer" } ) Closure < T > closure ) throws IOException { BufferedReader br ; int count = firstLine ; T result = null ; if ( self instanceof BufferedReader ) br = ( BufferedReader ) self ; else br = new BufferedReader ( self ) ; try { while ( true ) { String line = br . readLine ( ) ; if ( line == null ) { break ; } else { result = callClosureForLine ( closure , line , count ) ; count ++ ; } } Reader temp = self ; self = null ; temp . close ( ) ; return result ; } finally { closeWithWarning ( self ) ; closeWithWarning ( br ) ; } |
public class TaskInfo { /** * Serialize task information .
* @ param out The stream to which this object is serialized .
* @ throws IOException */
private void writeObject ( ObjectOutputStream out ) throws IOException { } } | final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "writeObject" , new Object [ ] { nonserTaskClassName , nonserTriggerClassName , "initial delay " + initialDelay , "interval " + interval , isFixedRate ? "fixed rate" : false , submittedAsCallable ? "callable" : "runnable" , threadContext } ) ; if ( threadContextBytes == null ) threadContextBytes = threadContext == null ? null : threadContext . serialize ( ) ; PutField fields = out . putFields ( ) ; fields . put ( INITIAL_DELAY , initialDelay ) ; fields . put ( INTERVAL , interval ) ; fields . put ( IS_FIXED_RATE , isFixedRate ) ; fields . put ( NONSER_TASK_CLASS_NAME , nonserTaskClassName ) ; fields . put ( NONSER_TRIGGER_CLASS_NAME , nonserTriggerClassName ) ; fields . put ( SUBMITTED_AS_CALLABLE , submittedAsCallable ) ; fields . put ( THREAD_CONTEXT_DESCRIPTOR , threadContextBytes ) ; out . writeFields ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "writeObject" ) ; |
public class ViewsFilter { /** * Resolves the view for the given method and response body . Subclasses can override to customize .
* @ param route Request route
* @ param responseBody Response body
* @ return view name to be rendered */
@ SuppressWarnings ( "WeakerAccess" ) protected Optional < String > resolveView ( AnnotationMetadata route , Object responseBody ) { } } | Optional optionalViewName = route . getValue ( View . class ) ; if ( optionalViewName . isPresent ( ) ) { return Optional . of ( ( String ) optionalViewName . get ( ) ) ; } else if ( responseBody instanceof ModelAndView ) { return ( ( ModelAndView ) responseBody ) . getView ( ) ; } return Optional . empty ( ) ; |
public class GISTreeSetUtil { /** * Replies the bounds of the area covered by the node and normalize it to
* fit as well as possible the coordinates of the given reference .
* The normalization is done by { @ link # normalize ( Rectangle2d , Rectangle2afp ) } .
* @ param node is the node for which the bounds must be extracted and reploed .
* @ param reference is the bounding object which is the reference for the normalization .
* @ return the normalized rectangle . */
@ Pure public static Rectangle2d getNormalizedNodeBuildingBounds ( AbstractGISTreeSetNode < ? , ? > node , Rectangle2afp < ? , ? , ? , ? , ? , ? > reference ) { } } | final Rectangle2d b = getNodeBuildingBounds ( node ) ; assert b != null ; normalize ( b , reference ) ; return b ; |
public class FSABuilder { /** * Build a minimal , deterministic automaton from a sorted list of byte
* sequences .
* @ param input Input sequences to build automaton from .
* @ return Returns the automaton encoding all input sequences . */
public static FSA build ( byte [ ] [ ] input ) { } } | final FSABuilder builder = new FSABuilder ( ) ; for ( byte [ ] chs : input ) { builder . add ( chs , 0 , chs . length ) ; } return builder . complete ( ) ; |
public class AuditingInterceptor { /** * Store the SecurityEvent generated for this request to a persistent store ( database , file , JMS , etc )
* @ param auditEvent
* the SecurityEvent generated for this request
* @ throws Exception
* if the data store is not configured or if an error occurs during storage */
protected void store ( SecurityEvent auditEvent ) throws Exception { } } | if ( myDataStore == null ) throw new InternalErrorException ( "No data store provided to persist audit events" ) ; myDataStore . store ( auditEvent ) ; |
public class ColorUtils { /** * Calculate the mix color of 2 colors .
* @ param color1
* first color
* @ param color2
* second color
* @ param weight
* balance point between the two colors in range of 0 to 1.
* @ return the resulting color */
static double mix ( double color1 , double color2 , double weight ) { } } | long col1 = Double . doubleToRawLongBits ( color1 ) ; long col2 = Double . doubleToRawLongBits ( color2 ) ; int alpha1 = ( int ) ( col1 >>> 48 ) ; int red1 = ( int ) ( col1 >> 32 ) & 0xFFFF ; int green1 = ( int ) ( col1 >> 16 ) & 0xFFFF ; int blue1 = ( int ) ( col1 ) & 0xFFFF ; int alpha2 = ( int ) ( col2 >>> 48 ) ; int red2 = ( int ) ( col2 >> 32 ) & 0xFFFF ; int green2 = ( int ) ( col2 >> 16 ) & 0xFFFF ; int blue2 = ( int ) ( col2 ) & 0xFFFF ; double w = weight * 2 - 1 ; double a = ( alpha1 - alpha2 ) / ( double ) 0XFFFF ; double w1 = ( ( ( w * a == - 1 ) ? w : ( w + a ) / ( 1 + w * a ) ) + 1 ) / 2.0 ; double w2 = 1 - w1 ; long red = Math . round ( red1 * w1 + red2 * w2 ) ; long green = Math . round ( green1 * w1 + green2 * w2 ) ; long blue = Math . round ( blue1 * w1 + blue2 * w2 ) ; long alpha = Math . round ( alpha1 * weight + alpha2 * ( 1 - weight ) ) ; long color = ( alpha << 48 ) | ( red << 32 ) | ( green << 16 ) | ( blue ) ; return Double . longBitsToDouble ( color ) ; |
public class DefaultAESCBCCipher { /** * This method is used to encrypt ( Symmetric ) plainText coming in input using AES algorithm
* @ param plainText the plain text string to be encrypted
* @ return Base64 encoded AES encrypted cipher text */
@ Override public String encrypt ( String plainText ) { } } | this . encryptionLock . lock ( ) ; try { byte [ ] cipherBytes = null ; try { cipherBytes = encryptCipher . doFinal ( plainText . getBytes ( charset ) ) ; } catch ( UnsupportedEncodingException | IllegalBlockSizeException | BadPaddingException e ) { logger . error ( "DefaultAESCBCCipher failed to encrypt text" , e ) ; throw new JsonDBException ( "DefaultAESCBCCipher failed to encrypt text" , e ) ; } return Base64 . getEncoder ( ) . encodeToString ( cipherBytes ) ; } finally { this . encryptionLock . unlock ( ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.