signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class FFMQJNDIContext { /** * ( non - Javadoc )
* @ see javax . naming . Context # rebind ( java . lang . String , java . lang . Object ) */
@ Override public void rebind ( String name , Object obj ) throws NamingException { } } | rebind ( new CompositeName ( name ) , obj ) ; |
public class ItemRef { /** * Increments by one a given attribute of an item . If the attribute doesn ' t exist , it is set to zero before the operation .
* < pre >
* StorageRef storage = new StorageRef ( " your _ app _ key " , " your _ token " ) ;
* TableRef tableRef = storage . table ( " your _ table " ) ;
* ItemRef itemRef = tableRef . item ( new ItemAttribute ( " your _ primary _ key _ value " ) ,
* new ItemAttribute ( " your _ secondary _ key _ value " ) ) ;
* itemRef . incr ( " your _ property " , new OnItemSnapshot ( ) {
* & # 064 ; Override
* public void run ( ItemSnapshot itemSnapshot ) {
* if ( itemSnapshot ! = null ) {
* Log . d ( " ItemRef " , " Item incremented : " + itemSnapshot . val ( ) ) ;
* } , new OnError ( ) {
* & # 064 ; Override
* public void run ( Integer integer , String errorMessage ) {
* Log . e ( " ItemRef " , " Error incrementing item : " + errorMessage ) ;
* < / pre >
* @ param property The name of the item attribute .
* @ param onItemSnapshot The callback invoked once the attribute has been incremented successfully . The callback is called with the snapshot of the item as argument .
* @ param onError The callback invoked if an error occurred . Called with the error description .
* @ return Current item reference */
public ItemRef incr ( final String property , final OnItemSnapshot onItemSnapshot , final OnError onError ) { } } | return this . incr ( property , null , onItemSnapshot , onError ) ; |
public class QueueBatchUniqueProcessor { /** * This method is overridden over parent class so that a batch of data is taken
* from the queue and { @ link # process ( Set ) } is invoked . < br >
* 这个方法被重载了 , 从而队列中的一批数据会被取出并调用 { @ link # process ( Set ) } 方法 。 */
@ Override protected void consume ( ) { } } | int size = 0 ; LinkedHashSet < E > batch = new LinkedHashSet < E > ( ) ; E obj = null ; try { obj = queue . take ( ) ; } catch ( InterruptedException e ) { return ; } batch . add ( obj ) ; size ++ ; if ( pollTimeout == 0 ) { // no waiting
while ( size < maxBatchSize && ( obj = queue . poll ( ) ) != null ) { batch . add ( obj ) ; size ++ ; } } else { // need to wait for a while
try { while ( size < maxBatchSize && ( obj = queue . poll ( pollTimeout , pollTimeoutUnit ) ) != null ) { batch . add ( obj ) ; size ++ ; } } catch ( InterruptedException e ) { // do nothing because we need to have the batch processed ;
} } process ( batch ) ; |
public class Task { /** * The Critical field indicates whether a task has any room in the schedule
* to slip , or if a task is on the critical path . The Critical field contains
* Yes if the task is critical and No if the task is not critical .
* @ return boolean */
public boolean getCritical ( ) { } } | Boolean critical = ( Boolean ) getCachedValue ( TaskField . CRITICAL ) ; if ( critical == null ) { Duration totalSlack = getTotalSlack ( ) ; ProjectProperties props = getParentFile ( ) . getProjectProperties ( ) ; int criticalSlackLimit = NumberHelper . getInt ( props . getCriticalSlackLimit ( ) ) ; if ( criticalSlackLimit != 0 && totalSlack . getDuration ( ) != 0 && totalSlack . getUnits ( ) != TimeUnit . DAYS ) { totalSlack = totalSlack . convertUnits ( TimeUnit . DAYS , props ) ; } critical = Boolean . valueOf ( totalSlack . getDuration ( ) <= criticalSlackLimit && NumberHelper . getInt ( getPercentageComplete ( ) ) != 100 && ( ( getTaskMode ( ) == TaskMode . AUTO_SCHEDULED ) || ( getDurationText ( ) == null && getStartText ( ) == null && getFinishText ( ) == null ) ) ) ; set ( TaskField . CRITICAL , critical ) ; } return ( BooleanHelper . getBoolean ( critical ) ) ; |
public class HtmlDocletWriter { /** * Adds the comment tags .
* @ param doc the doc for which the comment tags will be generated
* @ param holderTag the block tag context for the inline tags
* @ param tags the first sentence tags for the doc
* @ param depr true if it is deprecated
* @ param first true if the first sentence tags should be added
* @ param htmltree the documentation tree to which the comment tags will be added */
private void addCommentTags ( Doc doc , Tag holderTag , Tag [ ] tags , boolean depr , boolean first , Content htmltree ) { } } | if ( configuration . nocomment ) { return ; } Content div ; Content result = commentTagsToContent ( null , doc , tags , first ) ; if ( depr ) { Content italic = HtmlTree . SPAN ( HtmlStyle . deprecationComment , result ) ; div = HtmlTree . DIV ( HtmlStyle . block , italic ) ; htmltree . addContent ( div ) ; } else { div = HtmlTree . DIV ( HtmlStyle . block , result ) ; htmltree . addContent ( div ) ; } if ( tags . length == 0 ) { htmltree . addContent ( getSpace ( ) ) ; } |
public class JooqTxnInterceptor { /** * Invokes the method wrapped within a unit of work and a transaction .
* @ param methodInvocation the method to be invoked within a transaction
* @ return the result of the call to the invoked method
* @ throws Throwable if an exception occurs during the method invocation , transaction , or unit of
* work */
private Object invokeInTransactionAndUnitOfWork ( MethodInvocation methodInvocation ) throws Throwable { } } | boolean unitOfWorkAlreadyStarted = unitOfWork . isActive ( ) ; if ( ! unitOfWorkAlreadyStarted ) { unitOfWork . begin ( ) ; } Throwable originalThrowable = null ; try { return dslContextProvider . get ( ) . transactionResult ( ( ) -> { try { return methodInvocation . proceed ( ) ; } catch ( Throwable e ) { if ( e instanceof RuntimeException ) { throw ( RuntimeException ) e ; } throw new RuntimeException ( e ) ; } } ) ; } catch ( Throwable t ) { originalThrowable = t ; throw t ; } finally { if ( ! unitOfWorkAlreadyStarted ) { endUnitOfWork ( originalThrowable ) ; } } |
public class ChannelArbitrateEvent { /** * 停止对应的channel同步 , 是个异步调用 */
public boolean pause ( Long channelId , boolean needTermin ) { } } | ChannelStatus currstatus = status ( channelId ) ; boolean status = false ; boolean result = ! needTermin ; if ( currstatus . isStart ( ) ) { // stop的优先级高于pause , 这里只针对start状态进行状态更新
updateStatus ( channelId , ChannelStatus . PAUSE ) ; status = true ; // 避免stop时发生rollback报警
} if ( needTermin ) { try { // 调用termin进行关闭
result |= termin ( channelId , TerminType . ROLLBACK ) ; } catch ( Throwable e ) { updateStatus ( channelId , ChannelStatus . PAUSE ) ; // 出错了 , 直接挂起
throw new ArbitrateException ( e ) ; } } return result && status ; |
public class AffineTransformation { /** * Transform a relative vector into homogeneous coordinates .
* @ param v initial vector
* @ return vector of dim + 1 , with new column having the value 0.0 */
public double [ ] homogeneRelativeVector ( double [ ] v ) { } } | assert ( v . length == dim ) ; // TODO : this only works properly when trans [ dim ] [ dim ] = = 1.0 , right ?
double [ ] dv = Arrays . copyOf ( v , dim + 1 ) ; dv [ dim ] = 0.0 ; return dv ; |
public class HashtableOnDisk { /** * Given an index into the hash table and a value to store there , find it
* on disk and write the value . */
private void writeHashIndex ( int index , long value , int tableid ) throws IOException { } } | long diskloc = header . calcOffset ( index , tableid ) ; filemgr . seek ( diskloc ) ; filemgr . writeLong ( value ) ; updateHtindex ( index , value , tableid ) ; |
public class CoverageUtilities { /** * Creates a useless { @ link GridCoverage2D } that might be usefull as placeholder .
* @ return the dummy grod coverage . */
public static GridCoverage2D buildDummyCoverage ( ) { } } | HashMap < String , Double > envelopeParams = new HashMap < String , Double > ( ) ; envelopeParams . put ( NORTH , 1.0 ) ; envelopeParams . put ( SOUTH , 0.0 ) ; envelopeParams . put ( WEST , 0.0 ) ; envelopeParams . put ( EAST , 1.0 ) ; envelopeParams . put ( XRES , 1.0 ) ; envelopeParams . put ( YRES , 1.0 ) ; envelopeParams . put ( ROWS , 1.0 ) ; envelopeParams . put ( COLS , 1.0 ) ; double [ ] [ ] dataMatrix = new double [ 1 ] [ 1 ] ; dataMatrix [ 0 ] [ 0 ] = 0 ; WritableRaster writableRaster = createWritableRasterFromMatrix ( dataMatrix , true ) ; return buildCoverage ( "dummy" , writableRaster , envelopeParams , DefaultGeographicCRS . WGS84 ) ; // $ NON - NLS - 1 $ |
public class PrimitiveDataChecksum { /** * Note : leaves the checksum untouched if given value is null ( provide a special value for stronger hashing ) . */
public void updateUtf8 ( String string ) { } } | if ( string != null ) { byte [ ] bytes ; try { bytes = string . getBytes ( "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } update ( bytes , 0 , bytes . length ) ; } |
public class FlatMapIterator { /** * Delegates calls to the { @ link # flatMap ( Object ) } method . */
@ Override public final void flatMap ( IN value , Collector < OUT > out ) throws Exception { } } | for ( Iterator < OUT > iter = flatMap ( value ) ; iter . hasNext ( ) ; ) { out . collect ( iter . next ( ) ) ; } |
public class AbstractAmazonSQSAsync { /** * Simplified method form for invoking the ChangeMessageVisibilityBatch operation .
* @ see # changeMessageVisibilityBatchAsync ( ChangeMessageVisibilityBatchRequest ) */
@ Override public java . util . concurrent . Future < ChangeMessageVisibilityBatchResult > changeMessageVisibilityBatchAsync ( String queueUrl , java . util . List < ChangeMessageVisibilityBatchRequestEntry > entries ) { } } | return changeMessageVisibilityBatchAsync ( new ChangeMessageVisibilityBatchRequest ( ) . withQueueUrl ( queueUrl ) . withEntries ( entries ) ) ; |
public class ConcurrentSummaryStats { /** * Adds a value to the stream .
* @ param x the new value . */
public synchronized void add ( double x ) { } } | final double oldA = a ; a += ( x - a ) / ++ size ; q += ( x - a ) * ( x - oldA ) ; min = Math . min ( min , x ) ; max = Math . max ( max , x ) ; |
public class Histogram { /** * Return the average of the histogram . */
public Optional < Double > avg ( ) { } } | if ( isEmpty ( ) ) return Optional . empty ( ) ; return Optional . of ( sum ( ) / getEventCount ( ) ) ; |
public class DataSet { /** * Runs a { @ link CustomUnaryOperation } on the data set . Custom operations are typically complex
* operators that are composed of multiple steps .
* @ param operation The operation to run .
* @ return The data set produced by the operation . */
public < X > DataSet < X > runOperation ( CustomUnaryOperation < T , X > operation ) { } } | Preconditions . checkNotNull ( operation , "The custom operator must not be null." ) ; operation . setInput ( this ) ; return operation . createResult ( ) ; |
public class Mork { /** * - - the real functionality */
public boolean compile ( Job job ) throws IOException { } } | boolean result ; currentJob = job ; result = compileCurrent ( ) ; currentJob = null ; return result ; |
public class StaticFilesHandler { /** * < pre >
* Regular expression that matches the file paths for all files that should be
* referenced by this handler .
* < / pre >
* < code > string upload _ path _ regex = 2 ; < / code > */
public com . google . protobuf . ByteString getUploadPathRegexBytes ( ) { } } | java . lang . Object ref = uploadPathRegex_ ; if ( ref instanceof java . lang . String ) { com . google . protobuf . ByteString b = com . google . protobuf . ByteString . copyFromUtf8 ( ( java . lang . String ) ref ) ; uploadPathRegex_ = b ; return b ; } else { return ( com . google . protobuf . ByteString ) ref ; } |
public class Utils { /** * システム設定に従いラベルを正規化する 。
* @ since 1.1
* @ param text セルのラベル
* @ param config システム設定
* @ return true : ラベルが一致する 。 */
public static String normalize ( final String text , final Configuration config ) { } } | if ( text != null && config . isNormalizeLabelText ( ) ) { return text . trim ( ) . replaceAll ( "[\n\r]" , "" ) . replaceAll ( "[\t ]+" , " " ) ; } return text ; |
public class TextToSpeech { /** * Delete a custom word .
* Deletes a single word from the specified custom voice model . You must use credentials for the instance of the
* service that owns a model to delete its words .
* * * Note : * * This method is currently a beta release .
* * * See also : * * [ Deleting a word from a custom
* model ] ( https : / / cloud . ibm . com / docs / services / text - to - speech / custom - entries . html # cuWordDelete ) .
* @ param deleteWordOptions the { @ link DeleteWordOptions } containing the options for the call
* @ return a { @ link ServiceCall } with a response type of Void */
public ServiceCall < Void > deleteWord ( DeleteWordOptions deleteWordOptions ) { } } | Validator . notNull ( deleteWordOptions , "deleteWordOptions cannot be null" ) ; String [ ] pathSegments = { "v1/customizations" , "words" } ; String [ ] pathParameters = { deleteWordOptions . customizationId ( ) , deleteWordOptions . word ( ) } ; RequestBuilder builder = RequestBuilder . delete ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "text_to_speech" , "v1" , "deleteWord" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getVoid ( ) ) ; |
public class AiNodeAnim { /** * Returns the buffer with rotation keys of this animation channel . < p >
* Rotation keys consist of a time value ( double ) and a quaternion ( 4D
* vector of floats ) , resulting in a total of 24 bytes per entry . The
* buffer contains { @ link # getNumRotKeys ( ) } of these entries . < p >
* If there are rotation keys , there will also be at least one
* scaling and one position key .
* @ return a native order , direct ByteBuffer */
public ByteBuffer getRotKeyBuffer ( ) { } } | ByteBuffer buf = m_rotKeys . duplicate ( ) ; buf . order ( ByteOrder . nativeOrder ( ) ) ; return buf ; |
public class QueryHints { /** * Returns null if hint is not provided . */
public Object get ( QueryHint hint ) { } } | return hint == null ? null : ( mMap == null ? null : mMap . get ( hint ) ) ; |
public class OsLoginServiceClient { /** * Adds an SSH public key and returns the profile information . Default POSIX account information
* is set when no username and UID exist as part of the login profile .
* < p > Sample code :
* < pre > < code >
* try ( OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient . create ( ) ) {
* UserName parent = UserName . of ( " [ USER ] " ) ;
* SshPublicKey sshPublicKey = SshPublicKey . newBuilder ( ) . build ( ) ;
* ImportSshPublicKeyResponse response = osLoginServiceClient . importSshPublicKey ( parent , sshPublicKey ) ;
* < / code > < / pre >
* @ param parent The unique ID for the user in format ` users / { user } ` .
* @ param sshPublicKey The SSH public key and expiration time .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final ImportSshPublicKeyResponse importSshPublicKey ( UserName parent , SshPublicKey sshPublicKey ) { } } | ImportSshPublicKeyRequest request = ImportSshPublicKeyRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . setSshPublicKey ( sshPublicKey ) . build ( ) ; return importSshPublicKey ( request ) ; |
public class MesosFramework { /** * Handle status update from mesos master
* 1 . It does nothing except logging under states :
* - TASK _ STAGING ,
* - TASK _ STARTING ,
* - TASK _ RUNNING ,
* 2 . It does severe logging under states :
* - TASK _ FINISHED
* since heron - executor should be long live in normal production running .
* This state can occur during DEBUG mode . And we would not consider it as failure .
* 3 . It considers the task a failure and tries to restart it under states :
* - TASK _ FAILED
* - TASK _ KILLED
* - TASK _ LOST
* - TASK _ ERROR
* @ param taskId the taskId of container to handle
* @ param status the TasksStatus to handle */
protected void handleMesosStatusUpdate ( String taskId , Protos . TaskStatus status ) { } } | // We would determine what to do basing on current taskId and mesos status update
switch ( status . getState ( ) ) { case TASK_STAGING : LOG . info ( String . format ( "Task with id '%s' STAGING" , status . getTaskId ( ) . getValue ( ) ) ) ; LOG . severe ( "Framework status updates should not use" ) ; break ; case TASK_STARTING : LOG . info ( String . format ( "Task with id '%s' STARTING" , status . getTaskId ( ) . getValue ( ) ) ) ; break ; case TASK_RUNNING : LOG . info ( String . format ( "Task with id '%s' RUNNING" , status . getTaskId ( ) . getValue ( ) ) ) ; break ; case TASK_FINISHED : LOG . info ( String . format ( "Task with id '%s' FINISHED" , status . getTaskId ( ) . getValue ( ) ) ) ; LOG . severe ( "Heron job should not finish!" ) ; break ; case TASK_FAILED : LOG . info ( String . format ( "Task with id '%s' FAILED" , status . getTaskId ( ) . getValue ( ) ) ) ; handleMesosFailure ( taskId ) ; break ; case TASK_KILLED : LOG . info ( "Task killed which is supported running. " + "It could be triggered by manual restart command" ) ; handleMesosFailure ( taskId ) ; break ; case TASK_LOST : LOG . info ( String . format ( "Task with id '%s' LOST" , status . getTaskId ( ) . getValue ( ) ) ) ; handleMesosFailure ( taskId ) ; break ; case TASK_ERROR : LOG . info ( String . format ( "Task with id '%s' ERROR" , status . getTaskId ( ) . getValue ( ) ) ) ; handleMesosFailure ( taskId ) ; break ; default : LOG . severe ( "Unknown TaskState:" + status . getState ( ) + " for taskId: " + status . getTaskId ( ) . getValue ( ) ) ; break ; } |
public class WSX509TrustManager { /** * @ see javax . net . ssl . X509TrustManager # checkServerTrusted ( java . security . cert .
* X509Certificate [ ] , java . lang . String ) */
@ Override public void checkServerTrusted ( X509Certificate [ ] chain , String authType ) throws CertificateException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "checkServerTrusted" ) ; Map < String , Object > currentConnectionInfo = ThreadManager . getInstance ( ) . getOutboundConnectionInfoInternal ( ) ; if ( currentConnectionInfo != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "original peerHost: " + peerHost ) ; Tr . debug ( tc , "currentConnectionInfo: " + currentConnectionInfo ) ; } peerHost = ( String ) currentConnectionInfo . get ( Constants . CONNECTION_INFO_REMOTE_HOST ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "current peerHost: " + peerHost ) ; } else { currentConnectionInfo = extendedInfo ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "currentConnectionInfo from extendedInfo: " + currentConnectionInfo ) ; } extendedInfo = JSSEHelper . getInstance ( ) . getOutboundConnectionInfo ( ) ; if ( extendedInfo != null ) peerHost = ( String ) extendedInfo . get ( Constants . CONNECTION_INFO_REMOTE_HOST ) ; // if we do not have host and port just go ahead and default it to unknown
// to avoid null ' s
if ( peerHost == null || 0 == peerHost . length ( ) ) { peerHost = "unknown" ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Target host: " + peerHost ) ; for ( int j = 0 ; j < chain . length ; j ++ ) { Tr . debug ( tc , "Certificate information:" ) ; Tr . debug ( tc , " Subject DN: " + chain [ j ] . getSubjectDN ( ) ) ; Tr . debug ( tc , " Issuer DN: " + chain [ j ] . getIssuerDN ( ) ) ; Tr . debug ( tc , " Serial number: " + chain [ j ] . getSerialNumber ( ) ) ; } } for ( int i = 0 ; i < tm . length ; i ++ ) { if ( tm [ i ] != null && tm [ i ] instanceof X509TrustManager ) { // skip the default trust manager if configured to do so .
try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Delegating to X509TrustManager: " + tm [ i ] . getClass ( ) . getName ( ) ) ; ( ( X509TrustManager ) tm [ i ] ) . checkServerTrusted ( chain , authType ) ; } catch ( CertificateException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Certificate Exception occurred: " + e . getMessage ( ) ) ; // if the reason for the CertificateException is due to
// an expired date , don ' t accept it .
boolean dateValid = checkIfExpiredBeforeOrAfter ( chain ) ; if ( ! dateValid ) { throw e ; } try { // If this is a client process then we may prompt the user to accept the signer certificate
if ( ! isServer ) { if ( ! autoAccept ) { // prompt user
if ( userAcceptedPrompt ( chain ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "prompt user - adding certificate to the truststore." ) ; setCertificateToTruststore ( chain ) ; } else { printClientHandshakeError ( config , tsFile , e , chain ) ; throw e ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "autoacceptsigner - adding certificate to the truststore." ) ; setCertificateToTruststore ( chain ) ; } } else { // IBM JDK will throw the exception in obfuscated code , get the cause
Exception excpt = e ; if ( excpt . getClass ( ) . toString ( ) . startsWith ( "class com.ibm.jsse2" ) ) { excpt = ( Exception ) excpt . getCause ( ) ; } // This the server print a message and rethrow the exception
FFDCFilter . processException ( excpt , getClass ( ) . getName ( ) , "checkServerTrusted" , this , new Object [ ] { chain , authType } ) ; printClientHandshakeError ( config , tsFile , e , chain ) ; throw excpt ; } } catch ( Exception ex ) { throw new CertificateException ( ex . getMessage ( ) ) ; } } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Server is trusted by all X509TrustManagers." ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "checkServerTrusted" ) ; |
public class StatusUpdateManager { /** * instantiate a status update
* @ param typeIdentifier
* status update type identifier
* @ param values
* form item list containing all status update items necessary
* @ return status update instance of type specified
* @ throws StatusUpdateInstantiationFailedException
* if the status update could not be instantiated with the
* parameters passed
* @ throws IllegalArgumentException
* if template internal errors occur */
public static StatusUpdate instantiateStatusUpdate ( final String typeIdentifier , final FormItemList values ) throws StatusUpdateInstantiationFailedException { } } | final StatusUpdateTemplate template = getStatusUpdateTemplate ( typeIdentifier ) ; final Class < ? > templateInstantiationClass = template . getInstantiationClass ( ) ; try { // instantiate status update
final StatusUpdate statusUpdate = ( StatusUpdate ) templateInstantiationClass . newInstance ( ) ; // set status update fields
String value ; try { for ( String fieldName : template . getFields ( ) . keySet ( ) ) { try { value = values . getField ( fieldName ) ; } catch ( final IllegalArgumentException e ) { throw new StatusUpdateInstantiationFailedException ( e . getMessage ( ) ) ; } templateInstantiationClass . getField ( fieldName ) . set ( statusUpdate , value ) ; } // set status update file paths
for ( String fileName : template . getFiles ( ) . keySet ( ) ) { try { value = values . getFile ( fileName ) . getAbsoluteFilePath ( ) ; } catch ( final IllegalArgumentException e ) { throw new StatusUpdateInstantiationFailedException ( e . getMessage ( ) ) ; } templateInstantiationClass . getField ( fileName ) . set ( statusUpdate , value ) ; } } catch ( final IllegalArgumentException e ) { throw new StatusUpdateInstantiationFailedException ( "The types of the parameters passed do not match the status update template." ) ; } return statusUpdate ; } catch ( final SecurityException e ) { throw new IllegalArgumentException ( "failed to load the status update type specified, SecurityException occurred!" ) ; } catch ( final InstantiationException e ) { throw new IllegalArgumentException ( "failed to load the status update type specified, InstantiationException occurred!" ) ; } catch ( final IllegalAccessException e ) { throw new IllegalArgumentException ( "failed to load the status update type specified, IllegalAccessException occurred!" ) ; } catch ( final NoSuchFieldException e ) { throw new IllegalArgumentException ( "failed to load the status update type specified, NoSuchFieldException occurred!" ) ; } |
public class QueryAtomContainer { /** * Returns an array of all SingleElectron connected to the given atom .
* @ param atom The atom on which the single electron is located
* @ return The array of SingleElectron of this AtomContainer */
@ Override public List < ISingleElectron > getConnectedSingleElectronsList ( IAtom atom ) { } } | List < ISingleElectron > lps = new ArrayList < ISingleElectron > ( ) ; for ( int i = 0 ; i < singleElectronCount ; i ++ ) { if ( singleElectrons [ i ] . contains ( atom ) ) lps . add ( singleElectrons [ i ] ) ; } return lps ; |
public class CmsContainerPageElementPanel { /** * Updates the option bar position . < p > */
public void updateOptionBarPosition ( ) { } } | // only if attached to the DOM
if ( ( m_elementOptionBar != null ) && RootPanel . getBodyElement ( ) . isOrHasChild ( getElement ( ) ) ) { int absoluteTop = getElement ( ) . getAbsoluteTop ( ) ; int absoluteRight = getElement ( ) . getAbsoluteRight ( ) ; CmsPositionBean dimensions = CmsPositionBean . getBoundingClientRect ( getElement ( ) ) ; int top = 0 ; int right = 0 ; int offsetLeft = 0 ; int offsetTop = 0 ; final Style style = m_elementOptionBar . getElement ( ) . getStyle ( ) ; if ( m_positioningInstructionParser . tryParse ( getElement ( ) . getClassName ( ) ) ) { offsetLeft = m_positioningInstructionParser . getOffsetLeft ( ) ; offsetTop = m_positioningInstructionParser . getOffsetTop ( ) ; } if ( Math . abs ( absoluteTop - dimensions . getTop ( ) ) > 20 ) { absoluteTop = ( dimensions . getTop ( ) - absoluteTop ) + 2 ; top = absoluteTop ; } if ( Math . abs ( absoluteRight - dimensions . getLeft ( ) - dimensions . getWidth ( ) ) > 20 ) { absoluteRight = ( absoluteRight - dimensions . getLeft ( ) - dimensions . getWidth ( ) ) + 2 ; right = absoluteRight ; } top += offsetTop ; right -= offsetLeft ; if ( top != 0 ) { style . setTop ( top , Unit . PX ) ; } else { style . clearTop ( ) ; } if ( right != 0 ) { style . setRight ( right , Unit . PX ) ; } else { style . clearRight ( ) ; } if ( isOptionbarIFrameCollision ( absoluteTop , m_elementOptionBar . getCalculatedWidth ( ) ) ) { style . setPosition ( Position . RELATIVE ) ; int marginLeft = getElement ( ) . getClientWidth ( ) - m_elementOptionBar . getCalculatedWidth ( ) ; if ( marginLeft > 0 ) { style . setMarginLeft ( marginLeft , Unit . PX ) ; } } else { style . clearPosition ( ) ; style . clearMarginLeft ( ) ; } } |
public class GetMountTablePResponse { /** * Use { @ link # getMountPointsMap ( ) } instead . */
@ java . lang . Deprecated public java . util . Map < java . lang . String , alluxio . grpc . MountPointInfo > getMountPoints ( ) { } } | return getMountPointsMap ( ) ; |
public class SwipeActionAdapter { /** * We need the ListView to be able to modify it ' s OnTouchListener
* @ param listView the ListView to which the adapter will be attached
* @ return A reference to the current instance so that commands can be chained */
public SwipeActionAdapter setListView ( ListView listView ) { } } | this . mListView = listView ; mTouchListener = new SwipeActionTouchListener ( listView , this ) ; this . mListView . setOnTouchListener ( mTouchListener ) ; this . mListView . setOnScrollListener ( mTouchListener . makeScrollListener ( ) ) ; this . mListView . setClipChildren ( false ) ; mTouchListener . setFadeOut ( mFadeOut ) ; mTouchListener . setDimBackgrounds ( mDimBackgrounds ) ; mTouchListener . setFixedBackgrounds ( mFixedBackgrounds ) ; mTouchListener . setNormalSwipeFraction ( mNormalSwipeFraction ) ; mTouchListener . setFarSwipeFraction ( mFarSwipeFraction ) ; return this ; |
public class MongoDBUtils { /** * Insert data in a MongoDB Collection .
* @ param collection
* @ param table */
public void insertIntoMongoDBCollection ( String collection , DataTable table ) { } } | // Primero pasamos la fila del datatable a un hashmap de ColumnName - Type
List < String [ ] > colRel = coltoArrayList ( table ) ; // Vamos insertando fila a fila
for ( int i = 1 ; i < table . raw ( ) . size ( ) ; i ++ ) { // Obtenemos la fila correspondiente
BasicDBObject doc = new BasicDBObject ( ) ; List < String > row = table . raw ( ) . get ( i ) ; for ( int x = 0 ; x < row . size ( ) ; x ++ ) { String [ ] colNameType = colRel . get ( x ) ; Object data = castSTringTo ( colNameType [ 1 ] , row . get ( x ) ) ; doc . put ( colNameType [ 0 ] , data ) ; } this . dataBase . getCollection ( collection ) . insert ( doc ) ; } |
public class TransformerHandlerImpl { /** * Filter an error event .
* @ param e The error as an exception .
* @ throws SAXException The client may throw
* an exception during processing .
* @ see org . xml . sax . ErrorHandler # error */
public void error ( SAXParseException e ) throws SAXException { } } | // % REVIEW % I don ' t think this should be called . - sb
// clearCoRoutine ( e ) ;
// This is not great , but we really would rather have the error
// handler be the error listener if it is a error handler . Coroutine ' s fatalError
// can ' t really be configured , so I think this is the best thing right now
// for error reporting . Possibly another JAXP 1.1 hole . - sb
javax . xml . transform . ErrorListener errorListener = m_transformer . getErrorListener ( ) ; if ( errorListener instanceof ErrorHandler ) { ( ( ErrorHandler ) errorListener ) . error ( e ) ; if ( null != m_errorHandler ) m_errorHandler . error ( e ) ; // may not be called .
} else { try { errorListener . error ( new javax . xml . transform . TransformerException ( e ) ) ; if ( null != m_errorHandler ) m_errorHandler . error ( e ) ; // may not be called .
} catch ( javax . xml . transform . TransformerException te ) { throw e ; } } |
public class SoundexComparator { /** * Produces the Soundex key for the given string . */
public static String soundex ( String str ) { } } | if ( str . length ( ) < 1 ) return "" ; // no soundex key for the empty string ( could use 000)
char [ ] key = new char [ 4 ] ; key [ 0 ] = str . charAt ( 0 ) ; int pos = 1 ; char prev = '0' ; for ( int ix = 1 ; ix < str . length ( ) && pos < 4 ; ix ++ ) { char ch = str . charAt ( ix ) ; int charno ; if ( ch >= 'A' && ch <= 'Z' ) charno = ch - 'A' ; else if ( ch >= 'a' && ch <= 'z' ) charno = ch - 'a' ; else continue ; if ( number [ charno ] != '0' && number [ charno ] != prev ) key [ pos ++ ] = number [ charno ] ; prev = number [ charno ] ; } for ( ; pos < 4 ; pos ++ ) key [ pos ] = '0' ; return new String ( key ) ; |
public class CmsTreeItem { /** * Sets the tree item style to leaf , hiding the list opener . < p >
* @ param isLeaf < code > true < / code > to set to leaf style */
public void setLeafStyle ( boolean isLeaf ) { } } | if ( isLeaf ) { m_leafStyleVar . setValue ( CSS . listTreeItemLeaf ( ) ) ; } else { m_leafStyleVar . setValue ( CSS . listTreeItemInternal ( ) ) ; } |
public class FSNamesystem { /** * Schedule blocks for deletion at datanodes
* @ param nodesToProcess number of datanodes to schedule deletion work
* @ return total number of block for deletion */
int computeInvalidateWork ( int nodesToProcess ) { } } | int numOfNodes = 0 ; ArrayList < String > keyArray = null ; readLock ( ) ; try { numOfNodes = recentInvalidateSets . size ( ) ; // get an array of the keys
keyArray = new ArrayList < String > ( recentInvalidateSets . keySet ( ) ) ; } finally { readUnlock ( ) ; } nodesToProcess = Math . min ( numOfNodes , nodesToProcess ) ; // randomly pick up < i > nodesToProcess < / i > nodes
// and put them at [ 0 , nodesToProcess )
int remainingNodes = numOfNodes - nodesToProcess ; if ( nodesToProcess < remainingNodes ) { for ( int i = 0 ; i < nodesToProcess ; i ++ ) { int keyIndex = r . nextInt ( numOfNodes - i ) + i ; Collections . swap ( keyArray , keyIndex , i ) ; // swap to front
} } else { for ( int i = 0 ; i < remainingNodes ; i ++ ) { int keyIndex = r . nextInt ( numOfNodes - i ) ; Collections . swap ( keyArray , keyIndex , numOfNodes - i - 1 ) ; // swap to end
} } int blockCnt = 0 ; for ( int nodeCnt = 0 ; nodeCnt < nodesToProcess ; nodeCnt ++ ) { blockCnt += invalidateWorkForOneNode ( keyArray . get ( nodeCnt ) ) ; } return blockCnt ; |
public class Languages { /** * Returns the language component of a language string .
* @ param language
* @ return the language component */
public String getLanguageComponent ( String language ) { } } | if ( StringUtils . isNullOrEmpty ( language ) ) { return "" ; } if ( language . contains ( "-" ) ) { return language . split ( "-" ) [ 0 ] ; } else if ( language . contains ( "_" ) ) { return language . split ( "_" ) [ 0 ] ; } return language ; |
public class FieldIterator { /** * Is this field in my field list already ? */
private boolean inBaseField ( String strFieldFileName , String [ ] rgstrClassNames ) { } } | for ( int i = 0 ; i < rgstrClassNames . length - 1 ; i ++ ) { // In my base ( but not in this ( top ) class ) .
if ( strFieldFileName . equals ( rgstrClassNames [ i ] ) ) return true ; } return false ; |
public class ShrinkWrapFileAttributes { /** * { @ inheritDoc }
* @ see java . nio . file . attribute . BasicFileAttributes # isDirectory ( ) */
@ Override public boolean isDirectory ( ) { } } | final ArchivePath archivePath = ArchivePaths . create ( path . toString ( ) ) ; Node node = archive . get ( archivePath ) ; return node . getAsset ( ) == null ; |
public class BOSHClient { /** * Adds a response message listener to the session .
* @ param listener response listener to add , if not already added */
public void addBOSHClientResponseListener ( final BOSHClientResponseListener listener ) { } } | if ( listener == null ) { throw ( new IllegalArgumentException ( NULL_LISTENER ) ) ; } responseListeners . add ( listener ) ; |
public class AbstractAggregatorImpl { /** * Called when the aggregator is shutting down . Note that there is inconsistency
* among servlet bridge implementations over when { @ link HttpServlet # destroy ( ) }
* is called relative to when ( or even if ) the bundle is stopped . So this method
* may be called from the destroy method or the bundle listener or both . */
synchronized protected void shutdown ( ) { } } | final String sourceMethod = "shutdown" ; // $ NON - NLS - 1 $
boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( AbstractAggregatorImpl . class . getName ( ) , sourceMethod ) ; } currentRequest . remove ( ) ; if ( ! isShuttingDown ) { isShuttingDown = true ; IServiceReference [ ] refs = null ; try { refs = getPlatformServices ( ) . getServiceReferences ( IShutdownListener . class . getName ( ) , "(name=" + getName ( ) + ")" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
} catch ( PlatformServicesException e ) { if ( log . isLoggable ( Level . SEVERE ) ) { log . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( refs != null ) { for ( IServiceReference ref : refs ) { IShutdownListener listener = ( IShutdownListener ) getPlatformServices ( ) . getService ( ref ) ; if ( listener != null ) { try { listener . shutdown ( this ) ; } catch ( Exception e ) { if ( log . isLoggable ( Level . SEVERE ) ) { log . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } finally { getPlatformServices ( ) . ungetService ( ref ) ; } } } } for ( IServiceRegistration registration : registrations ) { registration . unregister ( ) ; } for ( IServiceReference ref : serviceReferences ) { getPlatformServices ( ) . ungetService ( ref ) ; } registrations . clear ( ) ; serviceReferences . clear ( ) ; // Clear references to objects that can potentially reference this object
// so as to avoid memory leaks due to circular references .
resourceFactoryExtensions . clear ( ) ; resourceConverterExtensions . clear ( ) ; moduleBuilderExtensions . clear ( ) ; serviceProviderExtensions . clear ( ) ; currentRequest . remove ( ) ; resourcePaths = null ; httpTransportExtension = null ; initParams = null ; cacheMgr = null ; config = null ; deps = null ; } if ( isTraceLogging ) { log . exiting ( AbstractAggregatorImpl . class . getName ( ) , sourceMethod ) ; } |
public class FctConvertersToFromString { /** * < p > Create put CnvTfsHasId ( Integer ) . < / p >
* @ param pBeanName - bean name
* @ param pClass - bean class
* @ param pIdName - bean ID name
* @ return requested CnvTfsHasId ( Integer )
* @ throws Exception - an exception */
protected final CnvTfsHasId < IHasId < Integer > , Integer > createHasIntegerIdConverter ( final String pBeanName , final Class pClass , final String pIdName ) throws Exception { } } | CnvTfsHasId < IHasId < Integer > , Integer > convrt = new CnvTfsHasId < IHasId < Integer > , Integer > ( ) ; convrt . setUtlReflection ( getUtlReflection ( ) ) ; convrt . setIdConverter ( lazyGetCnvTfsInteger ( ) ) ; convrt . init ( pClass , pIdName ) ; this . convertersMap . put ( pBeanName , convrt ) ; return convrt ; |
public class MultiUserChatLight { /** * Set the room configurations .
* @ param roomName
* @ param customConfigs
* @ throws NoResponseException
* @ throws XMPPErrorException
* @ throws NotConnectedException
* @ throws InterruptedException */
public void setRoomConfigs ( String roomName , HashMap < String , String > customConfigs ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } } | MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ ( room , roomName , customConfigs ) ; connection . createStanzaCollectorAndSend ( mucLightSetConfigIQ ) . nextResultOrThrow ( ) ; |
public class Workspace { /** * Called when deserialising JSON , to re - create the object graph
* based upon element / relationship IDs . */
public void hydrate ( ) { } } | if ( viewSet == null ) { viewSet = createViewSet ( ) ; } if ( documentation == null ) { documentation = createDocumentation ( ) ; } hydrateModel ( ) ; hydrateViewSet ( ) ; hydrateDocumentation ( ) ; |
public class ClassUtil { /** * Refer to setPropValue ( Method , Object , Object ) .
* @ param entity
* @ param propName
* is case insensitive
* @ param propValue */
public static void setPropValue ( final Object entity , final String propName , final Object propValue ) { } } | setPropValue ( entity , propName , propValue , false ) ; |
public class CxxReportSensor { /** * resolveFilename normalizes the report full path
* @ param baseDir of the project
* @ param filename of the report
* @ return String */
@ Nullable public static String resolveFilename ( final String baseDir , @ Nullable final String filename ) { } } | if ( filename != null ) { // Normalization can return null if path is null , is invalid ,
// or is a path with back - ticks outside known directory structure
String normalizedPath = FilenameUtils . normalize ( filename ) ; if ( ( normalizedPath != null ) && ( new File ( normalizedPath ) . isAbsolute ( ) ) ) { return normalizedPath ; } // Prefix with absolute module base directory , attempt normalization again - - can still get null here
normalizedPath = FilenameUtils . normalize ( baseDir + File . separator + filename ) ; if ( normalizedPath != null ) { return normalizedPath ; } } return null ; |
public class UpdatableResultSet { /** * { inheritDoc } . */
public void updateAsciiStream ( int columnIndex , InputStream inputStream , int length ) throws SQLException { } } | updateAsciiStream ( columnIndex , inputStream , ( long ) length ) ; |
public class Work { /** * Parse a set of characters and return an instance of { @ link Tree } .
* This tree can then be fed into < code > Assert . assertTree ( . . . ) < / code > .
* This method will throw an exception if there was an error parsing . It
* will also throw { @ link ParserException } if the parsing failed and the
* test has indicated that the parser should fail on error ; see
* { @ link ParserOption # failOnError ( boolean ) } .
* @ param walkerRule the starting walker rule
* @ param tree the tree to be walked
* @ return true on success
* @ throws Exception if there is an error during walking
* @ see # withRule ( String , com . toolazydogs . aunit . Work . ArgumentBuilder ) */
public static boolean walk ( SelectedRule walkerRule , TreeBuilder tree ) throws Exception { } } | if ( walkerRule == null ) throw new IllegalArgumentException ( "WalkerRule cannot be null, please use rule()" ) ; if ( tree == null ) throw new IllegalArgumentException ( "Tree cannot be null" ) ; if ( AunitRuntime . getTreeParserFactory ( ) == null ) throw new IllegalStateException ( "Walker factory not set by configuration" ) ; TreeParser treeParser = AunitRuntime . getTreeParserFactory ( ) . generate ( new CommonTreeNodeStream ( tree . get ( ) ) ) ; RuleReturnScope rs = walkerRule . invoke ( treeParser ) ; TreeParserWrapper wrapper = ( TreeParserWrapper ) treeParser ; if ( wrapper . isFailOnError ( ) && ! wrapper . getErrors ( ) . isEmpty ( ) ) { throw new ParserException ( wrapper . getErrors ( ) ) ; } return true ; |
public class CertificatesInner { /** * Create or update a certificate .
* Create or update a certificate .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the certificate .
* @ param certificateEnvelope Details of certificate , if it exists already .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < CertificateInner > updateAsync ( String resourceGroupName , String name , CertificatePatchResource certificateEnvelope , final ServiceCallback < CertificateInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( updateWithServiceResponseAsync ( resourceGroupName , name , certificateEnvelope ) , serviceCallback ) ; |
public class Option { /** * 设置symbolList值
* @ param symbolList */
public Option symbolList ( Symbol ... symbolList ) { } } | if ( symbolList == null || symbolList . length == 0 ) { return this ; } this . symbolList ( ) . addAll ( Arrays . asList ( symbolList ) ) ; return this ; |
public class Expression { /** * Tell the user of an error , and probably throw an
* exception .
* @ param xctxt The XPath runtime context .
* @ param msg An error msgkey that corresponds to one of the constants found
* in { @ link org . apache . xpath . res . XPATHErrorResources } , which is
* a key for a format string .
* @ param args An array of arguments represented in the format string , which
* may be null .
* @ throws TransformerException if the current ErrorListoner determines to
* throw an exception .
* @ throws javax . xml . transform . TransformerException */
public void error ( XPathContext xctxt , String msg , Object [ ] args ) throws javax . xml . transform . TransformerException { } } | java . lang . String fmsg = XSLMessages . createXPATHMessage ( msg , args ) ; if ( null != xctxt ) { ErrorListener eh = xctxt . getErrorListener ( ) ; TransformerException te = new TransformerException ( fmsg , this ) ; eh . fatalError ( te ) ; } |
public class LabelingJobOutputConfigMarshaller { /** * Marshall the given parameter object . */
public void marshall ( LabelingJobOutputConfig labelingJobOutputConfig , ProtocolMarshaller protocolMarshaller ) { } } | if ( labelingJobOutputConfig == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( labelingJobOutputConfig . getS3OutputPath ( ) , S3OUTPUTPATH_BINDING ) ; protocolMarshaller . marshall ( labelingJobOutputConfig . getKmsKeyId ( ) , KMSKEYID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ComponentEnvDispatcher { public ComponentDef dispatch ( Class < ? > componentClass ) { } } | if ( ! canDispatch ( componentClass ) ) { // already checked but just in case
return null ; } return doDispatch ( componentClass , findEnvDispatch ( componentClass ) ) ; |
public class FileSystem { /** * Convert a string to an URL according to several rules .
* < p > The rules are ( the first succeeded is replied ) :
* < ul >
* < li > if { @ code urlDescription } is < code > null < / code > or empty , return < code > null < / code > ; < / li >
* < li > try to build an { @ link URL } with { @ code urlDescription } as parameter ; < / li >
* < li > if { @ code allowResourceSearch } is < code > true < / code > and
* { @ code urlDescription } starts with { @ code " resource : " } , call
* { @ link Resources # getResource ( String ) } with the rest of the string as parameter ; < / li >
* < li > if { @ code allowResourceSearch } is < code > true < / code > , call
* { @ link Resources # getResource ( String ) } with the { @ code urlDescription } as
* parameter ; < / li >
* < li > if { @ code repliesFileURL } is < code > true < / code > and
* assuming that the { @ code urlDescription } is
* a filename , call { @ link File # toURI ( ) } to retreive an URI and then
* { @ link URI # toURL ( ) } ; < / li >
* < li > If everything else failed , return < code > null < / code > . < / li >
* < / ul >
* @ param urlDescription is a string which is describing an URL .
* @ param allowResourceSearch indicates if the convertion must take into account the Java resources .
* @ param repliesFileURL indicates if urlDescription is allowed to be a filename .
* @ param supportWindowsPaths indicates if Windows paths should be treated in particular way .
* @ return the URL .
* @ throws IllegalArgumentException is the string could not be formatted to URL .
* @ see Resources # getResource ( String ) */
@ Pure @ SuppressWarnings ( { } } | "checkstyle:cyclomaticcomplexity" , "checkstyle:npathcomplexity" , "checkstyle:nestedifdepth" } ) static URL convertStringToURL ( String urlDescription , boolean allowResourceSearch , boolean repliesFileURL , boolean supportWindowsPaths ) { URL url = null ; if ( urlDescription != null && urlDescription . length ( ) > 0 ) { if ( supportWindowsPaths && isWindowsNativeFilename ( urlDescription ) ) { final File file = normalizeWindowsNativeFilename ( urlDescription ) ; if ( file != null ) { return convertFileToURL ( file ) ; } } if ( URISchemeType . RESOURCE . isScheme ( urlDescription ) ) { if ( allowResourceSearch ) { final String resourceName = urlDescription . substring ( 9 ) ; url = Resources . getResource ( resourceName ) ; } } else if ( URISchemeType . FILE . isScheme ( urlDescription ) ) { final File file = new File ( URISchemeType . FILE . removeScheme ( urlDescription ) ) ; try { url = new URL ( URISchemeType . FILE . name ( ) , "" , fromFileStandardToURLStandard ( file ) ) ; // $ NON - NLS - 1 $
} catch ( MalformedURLException e ) { } } else { try { url = new URL ( urlDescription ) ; } catch ( MalformedURLException exception ) { // ignore error
} } if ( url == null ) { if ( allowResourceSearch ) { url = Resources . getResource ( urlDescription ) ; } if ( url == null && URISchemeType . RESOURCE . isScheme ( urlDescription ) ) { return null ; } if ( url == null && repliesFileURL ) { final String urlPart = URISchemeType . removeAnyScheme ( urlDescription ) ; // Try to parse a malformed JAR url :
// jar : { malformed - url } ! / { entry }
if ( URISchemeType . JAR . isScheme ( urlDescription ) ) { final int idx = urlPart . indexOf ( JAR_URL_FILE_ROOT ) ; if ( idx > 0 ) { final URL jarURL = convertStringToURL ( urlPart . substring ( 0 , idx ) , allowResourceSearch ) ; if ( jarURL != null ) { try { url = toJarURL ( jarURL , urlPart . substring ( idx + 2 ) ) ; } catch ( MalformedURLException exception ) { } } } } // Standard local file
if ( url == null ) { try { final File file = new File ( urlPart ) ; url = new URL ( URISchemeType . FILE . name ( ) , "" , // $ NON - NLS - 1 $
fromFileStandardToURLStandard ( file ) ) ; } catch ( MalformedURLException e ) { // ignore error
} } } } } return url ; |
public class PolymerClassRewriter { /** * Returns an assign replacing the equivalent var or let declaration . */
private static Node varToAssign ( Node var ) { } } | Node assign = IR . assign ( var . getFirstChild ( ) . cloneNode ( ) , var . getFirstChild ( ) . removeFirstChild ( ) ) ; return IR . exprResult ( assign ) . useSourceInfoIfMissingFromForTree ( var ) ; |
public class FileContentCryptorImpl { /** * visible for testing */
ByteBuffer encryptChunk ( ByteBuffer cleartextChunk , long chunkNumber , byte [ ] headerNonce , SecretKey fileKey ) { } } | try { // nonce :
byte [ ] nonce = new byte [ NONCE_SIZE ] ; random . nextBytes ( nonce ) ; // payload :
final Cipher cipher = CipherSupplier . AES_CTR . forEncryption ( fileKey , new IvParameterSpec ( nonce ) ) ; final ByteBuffer outBuf = ByteBuffer . allocate ( NONCE_SIZE + cipher . getOutputSize ( cleartextChunk . remaining ( ) ) + MAC_SIZE ) ; outBuf . put ( nonce ) ; int bytesEncrypted = cipher . doFinal ( cleartextChunk , outBuf ) ; // mac :
final ByteBuffer ciphertextBuf = outBuf . asReadOnlyBuffer ( ) ; ciphertextBuf . position ( NONCE_SIZE ) . limit ( NONCE_SIZE + bytesEncrypted ) ; byte [ ] authenticationCode = calcChunkMac ( macKey , headerNonce , chunkNumber , nonce , ciphertextBuf ) ; assert authenticationCode . length == MAC_SIZE ; outBuf . put ( authenticationCode ) ; // flip and return :
outBuf . flip ( ) ; return outBuf ; } catch ( ShortBufferException e ) { throw new IllegalStateException ( "Buffer allocated for reported output size apparently not big enough." , e ) ; } catch ( IllegalBlockSizeException | BadPaddingException e ) { throw new IllegalStateException ( "Unexpected exception for CTR ciphers." , e ) ; } |
public class ColumnList { /** * add a new column
* @ param stt
* @ param column
* @ param alias */
public void add ( SchemaTableTree stt , String column , String alias ) { } } | add ( stt . getSchemaTable ( ) , column , stt . getStepDepth ( ) , alias ) ; |
public class AlphabeticIndex { /** * This method is called to get the index exemplars . Normally these come from the locale directly ,
* but if they aren ' t available , we have to synthesize them . */
private void addIndexExemplars ( ULocale locale ) { } } | UnicodeSet exemplars = LocaleData . getExemplarSet ( locale , 0 , LocaleData . ES_INDEX ) ; if ( exemplars != null ) { initialLabels . addAll ( exemplars ) ; return ; } // The locale data did not include explicit Index characters .
// Synthesize a set of them from the locale ' s standard exemplar characters .
exemplars = LocaleData . getExemplarSet ( locale , 0 , LocaleData . ES_STANDARD ) ; exemplars = exemplars . cloneAsThawed ( ) ; // question : should we add auxiliary exemplars ?
if ( exemplars . containsSome ( 'a' , 'z' ) || exemplars . size ( ) == 0 ) { exemplars . addAll ( 'a' , 'z' ) ; } if ( exemplars . containsSome ( 0xAC00 , 0xD7A3 ) ) { // Hangul syllables
// cut down to small list
exemplars . remove ( 0xAC00 , 0xD7A3 ) . add ( 0xAC00 ) . add ( 0xB098 ) . add ( 0xB2E4 ) . add ( 0xB77C ) . add ( 0xB9C8 ) . add ( 0xBC14 ) . add ( 0xC0AC ) . add ( 0xC544 ) . add ( 0xC790 ) . add ( 0xCC28 ) . add ( 0xCE74 ) . add ( 0xD0C0 ) . add ( 0xD30C ) . add ( 0xD558 ) ; } if ( exemplars . containsSome ( 0x1200 , 0x137F ) ) { // Ethiopic block
// cut down to small list
// make use of the fact that Ethiopic is allocated in 8 ' s , where
// the base is 0 mod 8.
UnicodeSet ethiopic = new UnicodeSet ( "[[:Block=Ethiopic:]&[:Script=Ethiopic:]]" ) ; UnicodeSetIterator it = new UnicodeSetIterator ( ethiopic ) ; while ( it . next ( ) && it . codepoint != UnicodeSetIterator . IS_STRING ) { if ( ( it . codepoint & 0x7 ) != 0 ) { exemplars . remove ( it . codepoint ) ; } } } // Upper - case any that aren ' t already so .
// ( We only do this for synthesized index characters . )
for ( String item : exemplars ) { initialLabels . add ( UCharacter . toUpperCase ( locale , item ) ) ; } |
public class DefaultImportationLinker { /** * Get the filters ImporterServiceFilter and ImportDeclarationFilter from the properties , stop the instance if one of .
* them is invalid . */
private void processProperties ( ) { } } | state = true ; try { importerServiceFilter = getFilter ( importerServiceFilterProperty ) ; } catch ( InvalidFilterException invalidFilterException ) { LOG . debug ( "The value of the Property " + FILTER_IMPORTERSERVICE_PROPERTY + " is invalid," + " the recuperation of the Filter has failed. The instance gonna stop." , invalidFilterException ) ; state = false ; return ; } try { importDeclarationFilter = getFilter ( importDeclarationFilterProperty ) ; } catch ( InvalidFilterException invalidFilterException ) { LOG . debug ( "The value of the Property " + FILTER_IMPORTDECLARATION_PROPERTY + " is invalid," + " the recuperation of the Filter has failed. The instance gonna stop." , invalidFilterException ) ; state = false ; return ; } |
public class ReflectionOnObjectMethods { /** * implements the visitor to reset the opcode stack and clear the local variable map @
* @ param obj
* the context object of the currently parsed code block */
@ Override public void visitCode ( Code obj ) { } } | stack . resetForMethodEntry ( this ) ; localClassTypes . clear ( ) ; super . visitCode ( obj ) ; |
public class TranslateToPyExprVisitor { /** * Generates the code for key access given the name of a variable to be used as a key , e . g . { @ code
* . get ( key ) } .
* @ param key an expression to be used as a key
* @ param notFoundBehavior What should happen if the key is not in the structure .
* @ param coerceKeyToString Whether or not the key should be coerced to a string . */
private static String genCodeForKeyAccess ( String containerExpr , PyExpr key , NotFoundBehavior notFoundBehavior , CoerceKeyToString coerceKeyToString ) { } } | if ( coerceKeyToString == CoerceKeyToString . YES ) { key = new PyFunctionExprBuilder ( "runtime.maybe_coerce_key_to_string" ) . addArg ( key ) . asPyExpr ( ) ; } switch ( notFoundBehavior . getType ( ) ) { case RETURN_NONE : return new PyFunctionExprBuilder ( "runtime.key_safe_data_access" ) . addArg ( new PyExpr ( containerExpr , Integer . MAX_VALUE ) ) . addArg ( key ) . build ( ) ; case THROW : return new PyFunctionExprBuilder ( containerExpr + ".get" ) . addArg ( key ) . build ( ) ; case DEFAULT_VALUE : return new PyFunctionExprBuilder ( containerExpr + ".get" ) . addArg ( key ) . addArg ( notFoundBehavior . getDefaultValue ( ) ) . build ( ) ; } throw new AssertionError ( notFoundBehavior . getType ( ) ) ; |
public class ErrorUtils { /** * Pretty prints the given parse error showing its location in the given input buffer .
* @ param error the parse error
* @ param formatter the formatter for InvalidInputErrors
* @ return the pretty print text */
public static String printParseError ( ParseError error , Formatter < InvalidInputError > formatter ) { } } | checkArgNotNull ( error , "error" ) ; checkArgNotNull ( formatter , "formatter" ) ; String message = error . getErrorMessage ( ) != null ? error . getErrorMessage ( ) : error instanceof InvalidInputError ? formatter . format ( ( InvalidInputError ) error ) : error . getClass ( ) . getSimpleName ( ) ; return printErrorMessage ( "%s (line %s, pos %s):" , message , error . getStartIndex ( ) , error . getEndIndex ( ) , error . getInputBuffer ( ) ) ; |
public class Handshaker { /** * The previous caller failed for some reason , report back the
* Exception . We won ' t worry about Error ' s .
* Locked by SSLEngine . this . */
void checkThrown ( ) throws SSLException { } } | synchronized ( thrownLock ) { if ( thrown != null ) { String msg = thrown . getMessage ( ) ; if ( msg == null ) { msg = "Delegated task threw Exception/Error" ; } /* * See what the underlying type of exception is . We should
* throw the same thing . Chain thrown to the new exception . */
Exception e = thrown ; thrown = null ; if ( e instanceof RuntimeException ) { throw ( RuntimeException ) new RuntimeException ( msg ) . initCause ( e ) ; } else if ( e instanceof SSLHandshakeException ) { throw ( SSLHandshakeException ) new SSLHandshakeException ( msg ) . initCause ( e ) ; } else if ( e instanceof SSLKeyException ) { throw ( SSLKeyException ) new SSLKeyException ( msg ) . initCause ( e ) ; } else if ( e instanceof SSLPeerUnverifiedException ) { throw ( SSLPeerUnverifiedException ) new SSLPeerUnverifiedException ( msg ) . initCause ( e ) ; } else if ( e instanceof SSLProtocolException ) { throw ( SSLProtocolException ) new SSLProtocolException ( msg ) . initCause ( e ) ; } else { /* * If it ' s SSLException or any other Exception ,
* we ' ll wrap it in an SSLException . */
throw ( SSLException ) new SSLException ( msg ) . initCause ( e ) ; } } } |
public class ImageComponent { /** * Returns the transformation that is applied to the image . Most commonly the transformation
* is the concatenation of a uniform scale and a translation .
* The < code > AffineTransform < / code >
* instance returned by this method should not be modified .
* @ return the transformation applied to the image before painting
* @ throws IllegalStateException if there is no image set or if the size of the viewer is 0 ( for example because
* it is not in a visible component ) */
public AffineTransform getImageTransform ( ) { } } | if ( getImage ( ) == null ) throw new IllegalStateException ( "No image" ) ; if ( ! hasSize ( ) ) throw new IllegalStateException ( "Viewer size is zero" ) ; double currentZoom ; switch ( resizeStrategy ) { case NO_RESIZE : currentZoom = 1 ; break ; case SHRINK_TO_FIT : currentZoom = Math . min ( getSizeRatio ( ) , 1 ) ; break ; case RESIZE_TO_FIT : currentZoom = getSizeRatio ( ) ; break ; case CUSTOM_ZOOM : currentZoom = zoomFactor ; break ; default : throw new Error ( "Unhandled resize strategy" ) ; } AffineTransform tr = new AffineTransform ( ) ; tr . setToTranslation ( ( getWidth ( ) - image . getWidth ( ) * currentZoom ) / 2.0 , ( getHeight ( ) - image . getHeight ( ) * currentZoom ) / 2.0 ) ; tr . scale ( currentZoom , currentZoom ) ; return tr ; |
public class Adresse { /** * Liefert eine Adresse mit den uebergebenen Parametern .
* @ param ort the ort
* @ param strasse the strasse
* @ param hausnummer the hausnummer
* @ return Adresse
* @ since 2.1 */
public static Adresse of ( Ort ort , String strasse , int hausnummer ) { } } | return of ( ort , strasse , Integer . toString ( hausnummer ) ) ; |
public class StandardCovarianceMatrixBuilder { /** * Compute Covariance Matrix for a collection of database IDs .
* @ param ids a collection of ids
* @ param database the database used
* @ return Covariance Matrix */
@ Override public double [ ] [ ] processIds ( DBIDs ids , Relation < ? extends NumberVector > database ) { } } | return CovarianceMatrix . make ( database , ids ) . destroyToPopulationMatrix ( ) ; |
public class CommerceShipmentItemUtil { /** * Returns the first commerce shipment item in the ordered set where commerceShipmentId = & # 63 ; .
* @ param commerceShipmentId the commerce shipment ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce shipment item
* @ throws NoSuchShipmentItemException if a matching commerce shipment item could not be found */
public static CommerceShipmentItem findByCommerceShipment_First ( long commerceShipmentId , OrderByComparator < CommerceShipmentItem > orderByComparator ) throws com . liferay . commerce . exception . NoSuchShipmentItemException { } } | return getPersistence ( ) . findByCommerceShipment_First ( commerceShipmentId , orderByComparator ) ; |
public class ByteArrayISO8859Writer { public void write ( char c ) throws IOException { } } | ensureSpareCapacity ( 1 ) ; if ( c >= 0 && c <= 0x7f ) _buf [ _size ++ ] = ( byte ) c ; else { char [ ] ca = { c } ; writeEncoded ( ca , 0 , 1 ) ; } |
public class AbstractExecutorService { /** * Returns a { @ code RunnableFuture } for the given runnable and default
* value .
* @ param runnable the runnable task being wrapped
* @ param value the default value for the returned future
* @ param < T > the type of the given value
* @ return a { @ code RunnableFuture } which , when run , will run the
* underlying runnable and which , as a { @ code Future } , will yield
* the given value as its result and provide for cancellation of
* the underlying task
* @ since 1.6 */
protected < T > RunnableFuture < T > newTaskFor ( Runnable runnable , T value ) { } } | return new FutureTask < T > ( runnable , value ) ; |
public class ExcelFunctions { /** * Converts time stored in text to an actual time */
public static OffsetTime timevalue ( EvaluationContext ctx , Object text ) { } } | return Conversions . toTime ( text , ctx ) ; |
public class TenantService { /** * Verify that the given tenant and command can be accessed using by the user
* represented by the given userID and password . An { @ link UnauthorizedException } is
* thrown if the given credentials are invalid for the given tenant / command or if the
* user has insufficient rights for the command being accessed .
* If the given tenant does not exist , a { @ link NotFoundException } is thrown .
* @ param tenant { @ link Tenant } being accessed .
* @ param userid User ID of caller . May be null .
* @ param password Password of caller . May be null .
* @ param permNeeded { @ link Permission } needed by the invoking command .
* @ param isPrivileged True if the command being accessed is privileged .
* @ throws NotFoundException if the given tenant does not exist .
* @ throws UnauthorizedException if the given credentials are invalid or
* have insufficient rights for the given tenant and command . */
public void validateTenantAccess ( Tenant tenant , String userid , String password , Permission permNeeded , boolean isPrivileged ) throws UnauthorizedException , NotFoundException { } } | // So we can allow / _ logs and other commands before the DBService has initialized ,
// allow valid privileged commands without checking the tenant .
if ( isPrivileged ) { if ( ! isValidSystemCredentials ( userid , password ) ) { throw new UnauthorizedException ( "Unrecognized system user id/password" ) ; } return ; } // Here the DB connection must be established .
checkServiceState ( ) ; if ( ! isValidTenantUserAccess ( tenant , userid , password , permNeeded ) ) { throw new UnauthorizedException ( "Invalid tenant credentials or insufficient permission" ) ; } |
public class StringGroovyMethods { /** * Replaces sequences of whitespaces with tabs .
* @ param self A CharSequence to unexpand
* @ param tabStop The number of spaces a tab represents
* @ return an unexpanded String
* @ since 1.8.2 */
public static String unexpand ( CharSequence self , int tabStop ) { } } | String s = self . toString ( ) ; if ( s . length ( ) == 0 ) return s ; try { StringBuilder builder = new StringBuilder ( ) ; for ( String line : readLines ( ( CharSequence ) s ) ) { builder . append ( unexpandLine ( line , tabStop ) ) ; builder . append ( "\n" ) ; } // remove the normalized ending line ending if it was not present
if ( ! s . endsWith ( "\n" ) ) { builder . deleteCharAt ( builder . length ( ) - 1 ) ; } return builder . toString ( ) ; } catch ( IOException e ) { /* ignore */
} return s ; |
public class IR { /** * It isn ' t possible to always determine if a detached node is a expression ,
* so make a best guess . */
public static boolean mayBeExpression ( Node n ) { } } | switch ( n . getToken ( ) ) { case FUNCTION : case CLASS : // FUNCTION and CLASS are used both in expression and statement
// contexts .
return true ; case ADD : case AND : case ARRAYLIT : case ASSIGN : case ASSIGN_BITOR : case ASSIGN_BITXOR : case ASSIGN_BITAND : case ASSIGN_LSH : case ASSIGN_RSH : case ASSIGN_URSH : case ASSIGN_ADD : case ASSIGN_SUB : case ASSIGN_MUL : case ASSIGN_EXPONENT : case ASSIGN_DIV : case ASSIGN_MOD : case AWAIT : case BITAND : case BITOR : case BITNOT : case BITXOR : case CALL : case CAST : case COMMA : case DEC : case DELPROP : case DIV : case EQ : case EXPONENT : case FALSE : case GE : case GETPROP : case GETELEM : case GT : case HOOK : case IN : case INC : case INSTANCEOF : case LE : case LSH : case LT : case MOD : case MUL : case NAME : case NE : case NEG : case NEW : case NEW_TARGET : case NOT : case NUMBER : case NULL : case OBJECTLIT : case OR : case POS : case REGEXP : case RSH : case SHEQ : case SHNE : case STRING : case SUB : case SUPER : case TEMPLATELIT : case TAGGED_TEMPLATELIT : case THIS : case TYPEOF : case TRUE : case URSH : case VOID : case YIELD : return true ; default : return false ; } |
public class EditableComboBoxAutoCompletion { /** * Handle a key release event . See if what they ' ve type so far matches anything in the
* selectable items list . If so , then show the popup and select the item . If not , then
* hide the popup .
* @ param e key event */
public void keyReleased ( KeyEvent e ) { } } | char ch = e . getKeyChar ( ) ; if ( ch == KeyEvent . CHAR_UNDEFINED || Character . isISOControl ( ch ) ) return ; int pos = editor . getCaretPosition ( ) ; String str = editor . getText ( ) ; if ( str . length ( ) == 0 ) return ; boolean matchFound = false ; for ( int k = 0 ; k < comboBox . getItemCount ( ) ; k ++ ) { String item = comboBox . getItemAt ( k ) . toString ( ) ; if ( startsWithIgnoreCase ( item , str ) ) { comboBox . setSelectedIndex ( k ) ; editor . setText ( item ) ; editor . setCaretPosition ( item . length ( ) ) ; editor . moveCaretPosition ( pos ) ; // show popup when the user types
if ( comboBox . isDisplayable ( ) ) comboBox . setPopupVisible ( true ) ; matchFound = true ; break ; } } if ( ! matchFound ) { // hide popup when there is no match
comboBox . setPopupVisible ( false ) ; } |
public class BundleUtils { /** * Returns a optional byte array value . In other words , returns the value mapped by key if it exists and is a byte array .
* The bundle argument is allowed to be { @ code null } . If the bundle is null , this method returns null .
* @ param bundle a bundle . If the bundle is null , this method will return a fallback value .
* @ param key a key for the value .
* @ param fallback fallback value .
* @ return a byte array value if exists , null otherwise .
* @ see android . os . Bundle # getByteArray ( String ) */
@ Nullable public static byte [ ] optByteArray ( @ Nullable Bundle bundle , @ Nullable String key , @ Nullable byte [ ] fallback ) { } } | if ( bundle == null ) { return fallback ; } return bundle . getByteArray ( key ) ; |
public class Layout { /** * The size of the ViewPort ( virtual area used by the list rendering engine )
* If { @ link Layout # mViewPort } is set to true the ViewPort is applied during layout .
* The unlimited size can be specified for the layout .
* @ param enable true to apply the view port , false - otherwise , all items are rendered in the list even if they
* occupy larger space than the container size is . */
public void enableClipping ( boolean enable ) { } } | if ( mViewPort . isClippingEnabled ( ) != enable ) { mViewPort . enableClipping ( enable ) ; if ( mContainer != null ) { mContainer . onLayoutChanged ( this ) ; } } |
public class DefaultHistoryReferencesTableModel { /** * Removes and returns all the row indexes greater than or equal to { @ code fromRowIndex } contained in { @ code rowIndexes } .
* @ param fromRowIndex the start row index
* @ return the removed row indexes
* @ see # rowIndexes */
private RowIndex [ ] removeRowIndexes ( RowIndex fromRowIndex ) { } } | SortedSet < RowIndex > indexes = rowIndexes . tailSet ( fromRowIndex ) ; RowIndex [ ] removedIndexes = new RowIndex [ indexes . size ( ) ] ; removedIndexes = indexes . toArray ( removedIndexes ) ; indexes . clear ( ) ; return removedIndexes ; |
public class OperationsInner { /** * Gets a list of compute operations .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; OperationValueInner & gt ; object */
public Observable < List < OperationValueInner > > listAsync ( ) { } } | return listWithServiceResponseAsync ( ) . map ( new Func1 < ServiceResponse < List < OperationValueInner > > , List < OperationValueInner > > ( ) { @ Override public List < OperationValueInner > call ( ServiceResponse < List < OperationValueInner > > response ) { return response . body ( ) ; } } ) ; |
public class LongExtensions { /** * The binary < code > equals < / code > operator . This is the equivalent to the Java < code > = = < / code > operator .
* @ param a a long .
* @ param b a double .
* @ return < code > a = = b < / code >
* @ since 2.3 */
@ Pure @ Inline ( value = "($1 == $2)" , constantExpression = true ) public static boolean operator_equals ( long a , double b ) { } } | return a == b ; |
public class SoundPagingQuery { /** * Specify a field to return in the results using the Fluent API approach . Users may specify this method multiple
* times to define the collection of fields they want returning , and / or use
* { @ link SoundPagingQuery # includeFields ( Set ) } to define them as a batch .
* @ param field The field to include in the results
* @ return The current query */
@ SuppressWarnings ( "unchecked" ) public Q includeField ( final String field ) { } } | if ( this . fields == null ) { this . fields = new HashSet < > ( ) ; } if ( field != null ) { this . fields . add ( field ) ; } return ( Q ) this ; |
public class HudsonPrivateSecurityRealm { /** * Try to make this user a super - user */
private void tryToMakeAdmin ( User u ) { } } | AuthorizationStrategy as = Jenkins . getInstance ( ) . getAuthorizationStrategy ( ) ; for ( PermissionAdder adder : ExtensionList . lookup ( PermissionAdder . class ) ) { if ( adder . add ( as , u , Jenkins . ADMINISTER ) ) { return ; } } |
public class Util { /** * Frees the memory for the given direct buffer */
private static void free ( ByteBuffer buf ) { } } | Cleaner cleaner = ( ( DirectBuffer ) buf ) . cleaner ( ) ; if ( cleaner != null ) { cleaner . clean ( ) ; } |
public class HessianOutput { /** * Writes any object to the output stream . */
public void writeObject ( Object object ) throws IOException { } } | if ( object == null ) { writeNull ( ) ; return ; } Serializer serializer ; serializer = _serializerFactory . getSerializer ( object . getClass ( ) ) ; serializer . writeObject ( object , this ) ; |
public class Equation { /** * Operators which affect the variables to its left and right */
protected static boolean isOperatorLR ( Symbol s ) { } } | if ( s == null ) return false ; switch ( s ) { case ELEMENT_DIVIDE : case ELEMENT_TIMES : case ELEMENT_POWER : case RDIVIDE : case LDIVIDE : case TIMES : case POWER : case PLUS : case MINUS : case ASSIGN : return true ; } return false ; |
public class JavacState { /** * Utility method to recursively find all files below a directory . */
private static Set < File > findAllFiles ( File dir ) { } } | Set < File > foundFiles = new HashSet < > ( ) ; if ( dir == null ) { return foundFiles ; } recurse ( dir , foundFiles ) ; return foundFiles ; |
public class AmazonElastiCacheClient { /** * Reboots some , or all , of the cache nodes within a provisioned cluster . This operation applies any modified cache
* parameter groups to the cluster . The reboot operation takes place as soon as possible , and results in a momentary
* outage to the cluster . During the reboot , the cluster status is set to REBOOTING .
* The reboot causes the contents of the cache ( for each cache node being rebooted ) to be lost .
* When the reboot is complete , a cluster event is created .
* Rebooting a cluster is currently supported on Memcached and Redis ( cluster mode disabled ) clusters . Rebooting is
* not supported on Redis ( cluster mode enabled ) clusters .
* If you make changes to parameters that require a Redis ( cluster mode enabled ) cluster reboot for the changes to
* be applied , see < a
* href = " http : / / docs . aws . amazon . com / AmazonElastiCache / latest / red - ug / Clusters . Rebooting . html " > Rebooting a Cluster < / a >
* for an alternate process .
* @ param rebootCacheClusterRequest
* Represents the input of a < code > RebootCacheCluster < / code > operation .
* @ return Result of the RebootCacheCluster operation returned by the service .
* @ throws InvalidCacheClusterStateException
* The requested cluster is not in the < code > available < / code > state .
* @ throws CacheClusterNotFoundException
* The requested cluster ID does not refer to an existing cluster .
* @ sample AmazonElastiCache . RebootCacheCluster
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / elasticache - 2015-02-02 / RebootCacheCluster " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public CacheCluster rebootCacheCluster ( RebootCacheClusterRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeRebootCacheCluster ( request ) ; |
public class DBScan { /** * Performs DBSCAN cluster analysis .
* @ param points the points to cluster
* @ return the list of clusters
* @ throws NullArgumentException if the data points are null */
public List < Cluster > cluster ( final Collection < Point2D > points ) { } } | final List < Cluster > clusters = new ArrayList < Cluster > ( ) ; final Map < Point2D , PointStatus > visited = new HashMap < Point2D , DBScan . PointStatus > ( ) ; KDTree < Point2D > tree = new KDTree < Point2D > ( 2 ) ; // Populate the kdTree
for ( final Point2D point : points ) { double [ ] key = { point . x , point . y } ; tree . insert ( key , point ) ; } for ( final Point2D point : points ) { if ( visited . get ( point ) != null ) { continue ; } final List < Point2D > neighbors = getNeighbors ( point , tree ) ; if ( neighbors . size ( ) >= minPoints ) { // DBSCAN does not care about center points
final Cluster cluster = new Cluster ( clusters . size ( ) ) ; clusters . add ( expandCluster ( cluster , point , neighbors , tree , visited ) ) ; } else { visited . put ( point , PointStatus . NOISE ) ; } } for ( Cluster cluster : clusters ) { cluster . calculateCentroid ( ) ; } return clusters ; |
public class NotificationConfigurationStaxUnmarshaller { /** * Id ( aka configuration name ) isn ' t modeled on the actual { @ link NotificationConfiguration }
* class but as the key name in the map of configurations in
* { @ link BucketNotificationConfiguration } */
@ Override public Entry < String , NotificationConfiguration > unmarshall ( StaxUnmarshallerContext context ) throws Exception { } } | int originalDepth = context . getCurrentDepth ( ) ; int targetDepth = originalDepth + 1 ; if ( context . isStartOfDocument ( ) ) { targetDepth += 1 ; } T topicConfig = createConfiguration ( ) ; String id = null ; while ( true ) { XMLEvent xmlEvent = context . nextEvent ( ) ; if ( xmlEvent . isEndDocument ( ) ) { return new SimpleEntry < String , NotificationConfiguration > ( id , topicConfig ) ; } if ( xmlEvent . isAttribute ( ) || xmlEvent . isStartElement ( ) ) { if ( handleXmlEvent ( topicConfig , context , targetDepth ) ) { // Do nothing , subclass has handled it
} else if ( context . testExpression ( "Id" , targetDepth ) ) { id = StringStaxUnmarshaller . getInstance ( ) . unmarshall ( context ) ; } else if ( context . testExpression ( "Event" , targetDepth ) ) { topicConfig . addEvent ( StringStaxUnmarshaller . getInstance ( ) . unmarshall ( context ) ) ; } else if ( context . testExpression ( "Filter" , targetDepth ) ) { topicConfig . setFilter ( FilterStaxUnmarshaller . getInstance ( ) . unmarshall ( context ) ) ; } } else if ( xmlEvent . isEndElement ( ) ) { if ( context . getCurrentDepth ( ) < originalDepth ) { return new SimpleEntry < String , NotificationConfiguration > ( id , topicConfig ) ; } } } |
public class CPAttachmentFileEntryLocalServiceBaseImpl { /** * Returns the cp attachment file entry matching the UUID and group .
* @ param uuid the cp attachment file entry ' s UUID
* @ param groupId the primary key of the group
* @ return the matching cp attachment file entry
* @ throws PortalException if a matching cp attachment file entry could not be found */
@ Override public CPAttachmentFileEntry getCPAttachmentFileEntryByUuidAndGroupId ( String uuid , long groupId ) throws PortalException { } } | return cpAttachmentFileEntryPersistence . findByUUID_G ( uuid , groupId ) ; |
public class FragmentManagerUtils { /** * Find a fragment that is under { @ link android . support . v4 . app . FragmentManager } ' s control by the id .
* @ param manager the fragment manager .
* @ param id the fragment id .
* @ param < F > the concrete fragment class parameter .
* @ return the fragment . */
@ SuppressWarnings ( "unchecked" ) // we know that the returning fragment is child of fragment .
public static < F extends android . support . v4 . app . Fragment > F supportFindFragmentById ( android . support . v4 . app . FragmentManager manager , int id ) { } } | return ( F ) manager . findFragmentById ( id ) ; |
public class DataWriterBuilder { /** * Tell the writer which branch it is associated with .
* @ param branch branch index
* @ return this { @ link DataWriterBuilder } instance */
public DataWriterBuilder < S , D > forBranch ( int branch ) { } } | this . branch = branch ; log . debug ( "For branch: {}" , this . branch ) ; return this ; |
public class IOUtil { /** * 一次性读入纯文本
* @ param path
* @ return */
public static String readTxt ( String path ) { } } | if ( path == null ) return null ; try { InputStream in = IOAdapter == null ? new FileInputStream ( path ) : IOAdapter . open ( path ) ; byte [ ] fileContent = new byte [ in . available ( ) ] ; int read = readBytesFromOtherInputStream ( in , fileContent ) ; in . close ( ) ; // 处理 UTF - 8 BOM
if ( read >= 3 && fileContent [ 0 ] == - 17 && fileContent [ 1 ] == - 69 && fileContent [ 2 ] == - 65 ) return new String ( fileContent , 3 , fileContent . length - 3 , Charset . forName ( "UTF-8" ) ) ; return new String ( fileContent , Charset . forName ( "UTF-8" ) ) ; } catch ( FileNotFoundException e ) { logger . warning ( "找不到" + path + e ) ; return null ; } catch ( IOException e ) { logger . warning ( "读取" + path + "发生IO异常" + e ) ; return null ; } |
public class GVRTransform { /** * Modify the transform ' s current rotation in angle / axis terms , around a
* pivot other than the origin .
* @ param angle
* Angle of rotation in degrees .
* @ param axisX
* ' X ' component of the axis .
* @ param axisY
* ' Y ' component of the axis .
* @ param axisZ
* ' Z ' component of the axis .
* @ param pivotX
* ' X ' component of the pivot ' s location .
* @ param pivotY
* ' Y ' component of the pivot ' s location .
* @ param pivotZ
* ' Z ' component of the pivot ' s location . */
public void rotateByAxisWithPivot ( float angle , float axisX , float axisY , float axisZ , float pivotX , float pivotY , float pivotZ ) { } } | NativeTransform . rotateByAxisWithPivot ( getNative ( ) , angle * TO_RADIANS , axisX , axisY , axisZ , pivotX , pivotY , pivotZ ) ; |
public class CmsWrapperPreference { /** * Returns the first non - null value . < p >
* @ param a a value
* @ param b another value
* @ return the first non - null value */
String firstNotNull ( String a , String b ) { } } | return a != null ? a : b ; |
public class SortUtil { /** * See http : / / stereopsis . com / radix . html for more details . */
public static void putDoubleNormalizedKey ( double value , MemorySegment target , int offset , int numBytes ) { } } | long lValue = Double . doubleToLongBits ( value ) ; lValue ^= ( ( lValue >> ( Long . SIZE - 1 ) ) | Long . MIN_VALUE ) ; NormalizedKeyUtil . putUnsignedLongNormalizedKey ( lValue , target , offset , numBytes ) ; |
public class TopicsDetectionJobPropertiesMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TopicsDetectionJobProperties topicsDetectionJobProperties , ProtocolMarshaller protocolMarshaller ) { } } | if ( topicsDetectionJobProperties == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( topicsDetectionJobProperties . getJobId ( ) , JOBID_BINDING ) ; protocolMarshaller . marshall ( topicsDetectionJobProperties . getJobName ( ) , JOBNAME_BINDING ) ; protocolMarshaller . marshall ( topicsDetectionJobProperties . getJobStatus ( ) , JOBSTATUS_BINDING ) ; protocolMarshaller . marshall ( topicsDetectionJobProperties . getMessage ( ) , MESSAGE_BINDING ) ; protocolMarshaller . marshall ( topicsDetectionJobProperties . getSubmitTime ( ) , SUBMITTIME_BINDING ) ; protocolMarshaller . marshall ( topicsDetectionJobProperties . getEndTime ( ) , ENDTIME_BINDING ) ; protocolMarshaller . marshall ( topicsDetectionJobProperties . getInputDataConfig ( ) , INPUTDATACONFIG_BINDING ) ; protocolMarshaller . marshall ( topicsDetectionJobProperties . getOutputDataConfig ( ) , OUTPUTDATACONFIG_BINDING ) ; protocolMarshaller . marshall ( topicsDetectionJobProperties . getNumberOfTopics ( ) , NUMBEROFTOPICS_BINDING ) ; protocolMarshaller . marshall ( topicsDetectionJobProperties . getDataAccessRoleArn ( ) , DATAACCESSROLEARN_BINDING ) ; protocolMarshaller . marshall ( topicsDetectionJobProperties . getVolumeKmsKeyId ( ) , VOLUMEKMSKEYID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MoskitoHttpServlet { /** * Override this method to react on http trace method . */
protected void moskitoDoTrace ( HttpServletRequest req , HttpServletResponse res ) throws ServletException , IOException { } } | super . doTrace ( req , res ) ; |
public class IfcPropertyDefinitionImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < IfcRelAssociates > getHasAssociations ( ) { } } | return ( EList < IfcRelAssociates > ) eGet ( Ifc2x3tc1Package . Literals . IFC_PROPERTY_DEFINITION__HAS_ASSOCIATIONS , true ) ; |
public class AbstractTTTLearner { /** * Performs a membership query , using an access sequence as its prefix .
* @ param accessSeqProvider
* the object from which to obtain the access sequence
* @ param suffix
* the suffix part of the query
* @ return the output */
protected D query ( AccessSequenceProvider < I > accessSeqProvider , Word < I > suffix ) { } } | return query ( accessSeqProvider . getAccessSequence ( ) , suffix ) ; |
public class EigenvalueDecomposition { /** * Nonsymmetric reduction to Hessenberg form . */
private void orthes ( ) { } } | // FIXME : does this fail on NaN / inf values ?
// This is derived from the Algol procedures orthes and ortran ,
// by Martin and Wilkinson , Handbook for Auto . Comp . ,
// Vol . ii - Linear Algebra , and the corresponding
// Fortran subroutines in EISPACK .
final int low = 0 , high = n - 1 ; for ( int m = low + 1 ; m <= high - 1 ; m ++ ) { // Scale column .
double scale = 0.0 ; for ( int i = m ; i <= high ; i ++ ) { scale += abs ( H [ i ] [ m - 1 ] ) ; } if ( scale > 0.0 || scale < 0.0 ) { // Compute Householder transformation .
double h = 0.0 ; for ( int i = high ; i >= m ; i -- ) { double oi = ort [ i ] = H [ i ] [ m - 1 ] / scale ; h += oi * oi ; } double g = FastMath . sqrt ( h ) , om = ort [ m ] ; g = ( om > 0 ) ? - g : g ; h -= om * g ; ort [ m ] = om - g ; // Apply Householder similarity transformation
// H = ( I - u * u ' / h ) * H * ( I - u * u ' ) / h )
for ( int j = m ; j < n ; j ++ ) { double f = 0.0 ; for ( int i = high ; i >= m ; i -- ) { f += ort [ i ] * H [ i ] [ j ] ; } f /= h ; for ( int i = m ; i <= high ; i ++ ) { H [ i ] [ j ] -= f * ort [ i ] ; } } for ( int i = 0 ; i <= high ; i ++ ) { final double [ ] Hi = H [ i ] ; double f = 0.0 ; for ( int j = high ; j >= m ; j -- ) { f += ort [ j ] * Hi [ j ] ; } f /= h ; for ( int j = m ; j <= high ; j ++ ) { Hi [ j ] -= f * ort [ j ] ; } } ort [ m ] *= scale ; H [ m ] [ m - 1 ] = scale * g ; } } // Accumulate transformations ( Algol ' s ortran ) .
for ( int i = 0 ; i < n ; i ++ ) { Arrays . fill ( V [ i ] , 0. ) ; V [ i ] [ i ] = 1. ; } for ( int m = high - 1 ; m >= low + 1 ; m -- ) { final double [ ] H_m = H [ m ] ; if ( H_m [ m - 1 ] != 0.0 ) { for ( int i = m + 1 ; i <= high ; i ++ ) { ort [ i ] = H [ i ] [ m - 1 ] ; } final double ort_m = ort [ m ] ; for ( int j = m ; j <= high ; j ++ ) { double g = 0.0 ; for ( int i = m ; i <= high ; i ++ ) { g += ort [ i ] * V [ i ] [ j ] ; } // Double division avoids possible underflow
g = ( g / ort_m ) / H_m [ m - 1 ] ; for ( int i = m ; i <= high ; i ++ ) { V [ i ] [ j ] += g * ort [ i ] ; } } } } |
public class JPAEMFactory { /** * Instance serialization . */
private void writeObject ( java . io . ObjectOutputStream out ) throws IOException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "writeObject : " + ivPuId + ", " + ivJ2eeName ) ; out . writeObject ( ivPuId ) ; out . writeObject ( ivJ2eeName ) ; // d510184
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "writeObject" ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.