signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Model { /** * Registers date format for specified attributes . This format will be used to convert between
* Date - > String - > java . sql . Date when using the appropriate getters and setters .
* < p > See example in { @ link # dateFormat ( String , String . . . ) } .
* @ param format format to use for conversion
* @ param attributeNames attribute names */
protected static void dateFormat ( DateFormat format , String ... attributeNames ) { } } | ModelDelegate . dateFormat ( modelClass ( ) , format , attributeNames ) ; |
public class BlockLocation { /** * < code > optional string tierAlias = 3 ; < / code > */
public java . lang . String getTierAlias ( ) { } } | java . lang . Object ref = tierAlias_ ; 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 ( ) ) { tierAlias_ = s ; } return s ; } |
public class LinkedList { /** * Removes the first occurrence of the specified element from this list ,
* if it is present . If this list does not contain the element , it is
* unchanged . More formally , removes the element with the lowest index
* { @ code i } such that
* < tt > ( o = = null & nbsp ; ? & nbsp ; get ( i ) = = null & nbsp ; : & nbsp ; o . equals ( get ( i ) ) ) < / tt >
* ( if such an element exists ) . Returns { @ code true } if this list
* contained the specified element ( or equivalently , if this list
* changed as a result of the call ) .
* @ param o element to be removed from this list , if present
* @ return { @ code true } if this list contained the specified element */
public boolean remove ( Object o ) { } } | if ( o == null ) { for ( Node < E > x = first ; x != null ; x = x . next ) { if ( x . item == null ) { unlink ( x ) ; return true ; } } } else { for ( Node < E > x = first ; x != null ; x = x . next ) { if ( o . equals ( x . item ) ) { unlink ( x ) ; return true ; } } } return false ; |
public class InternalXtextParser { /** * InternalXtext . g : 1204:1 : ruleTerminalTokenElement : ( ( rule _ _ TerminalTokenElement _ _ Alternatives ) ) ; */
public final void ruleTerminalTokenElement ( ) throws RecognitionException { } } | int stackSize = keepStackSize ( ) ; try { // InternalXtext . g : 1208:2 : ( ( ( rule _ _ TerminalTokenElement _ _ Alternatives ) ) )
// InternalXtext . g : 1209:2 : ( ( rule _ _ TerminalTokenElement _ _ Alternatives ) )
{ // InternalXtext . g : 1209:2 : ( ( rule _ _ TerminalTokenElement _ _ Alternatives ) )
// InternalXtext . g : 1210:3 : ( rule _ _ TerminalTokenElement _ _ Alternatives )
{ before ( grammarAccess . getTerminalTokenElementAccess ( ) . getAlternatives ( ) ) ; // InternalXtext . g : 1211:3 : ( rule _ _ TerminalTokenElement _ _ Alternatives )
// InternalXtext . g : 1211:4 : rule _ _ TerminalTokenElement _ _ Alternatives
{ pushFollow ( FollowSets000 . FOLLOW_2 ) ; rule__TerminalTokenElement__Alternatives ( ) ; state . _fsp -- ; } after ( grammarAccess . getTerminalTokenElementAccess ( ) . getAlternatives ( ) ) ; } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { restoreStackSize ( stackSize ) ; } return ; |
public class DigitalRadial { /** * < editor - fold defaultstate = " collapsed " desc = " Initialization " > */
@ Override public final AbstractGauge init ( final int WIDTH , final int HEIGHT ) { } } | if ( WIDTH <= 1 || HEIGHT <= 1 ) { return this ; } if ( isLcdVisible ( ) ) { if ( isDigitalFont ( ) ) { setLcdValueFont ( getModel ( ) . getDigitalBaseFont ( ) . deriveFont ( 0.7f * WIDTH * 0.15f ) ) ; } else { setLcdValueFont ( getModel ( ) . getStandardBaseFont ( ) . deriveFont ( 0.625f * WIDTH * 0.15f ) ) ; } if ( isCustomLcdUnitFontEnabled ( ) ) { setLcdUnitFont ( getCustomLcdUnitFont ( ) . deriveFont ( 0.25f * WIDTH * 0.15f ) ) ; } else { setLcdUnitFont ( getModel ( ) . getStandardBaseFont ( ) . deriveFont ( 0.25f * WIDTH * 0.15f ) ) ; } setLcdInfoFont ( getModel ( ) . getStandardInfoFont ( ) . deriveFont ( 0.15f * WIDTH * 0.15f ) ) ; } // Create Background Image
if ( bImage != null ) { bImage . flush ( ) ; } bImage = UTIL . createImage ( WIDTH , WIDTH , Transparency . TRANSLUCENT ) ; // Create Foreground Image
if ( fImage != null ) { fImage . flush ( ) ; } fImage = UTIL . createImage ( WIDTH , WIDTH , Transparency . TRANSLUCENT ) ; if ( isFrameVisible ( ) ) { switch ( getFrameType ( ) ) { case ROUND : FRAME_FACTORY . createRadialFrame ( WIDTH , getFrameDesign ( ) , getCustomFrameDesign ( ) , getFrameEffect ( ) , bImage ) ; break ; case SQUARE : FRAME_FACTORY . createLinearFrame ( WIDTH , WIDTH , getFrameDesign ( ) , getCustomFrameDesign ( ) , getFrameEffect ( ) , bImage ) ; break ; default : FRAME_FACTORY . createRadialFrame ( WIDTH , getFrameDesign ( ) , getCustomFrameDesign ( ) , getFrameEffect ( ) , bImage ) ; break ; } } if ( isBackgroundVisible ( ) ) { create_BACKGROUND_Image ( WIDTH , "" , "" , bImage ) ; } if ( isForegroundVisible ( ) ) { switch ( getFrameType ( ) ) { case SQUARE : FOREGROUND_FACTORY . createLinearForeground ( WIDTH , WIDTH , false , bImage ) ; break ; case ROUND : default : FOREGROUND_FACTORY . createRadialForeground ( WIDTH , false , getForegroundType ( ) , fImage ) ; break ; } } if ( isLcdVisible ( ) ) { createLcdImage ( new Rectangle2D . Double ( ( ( getGaugeBounds ( ) . width - WIDTH * 0.48 ) / 2.0 ) , ( getGaugeBounds ( ) . height * 0.425 ) , ( WIDTH * 0.48 ) , ( WIDTH * 0.15 ) ) , getLcdColor ( ) , getCustomLcdBackground ( ) , bImage ) ; LCD . setRect ( ( ( getGaugeBounds ( ) . width - WIDTH * 0.4 ) / 2.0 ) , ( getGaugeBounds ( ) . height * 0.55 ) , WIDTH * 0.48 , WIDTH * 0.15 ) ; // Create the lcd threshold indicator image
if ( lcdThresholdImage != null ) { lcdThresholdImage . flush ( ) ; } lcdThresholdImage = create_LCD_THRESHOLD_Image ( ( int ) ( LCD . getHeight ( ) * 0.2045454545 ) , ( int ) ( LCD . getHeight ( ) * 0.2045454545 ) , getLcdColor ( ) . TEXT_COLOR ) ; } if ( disabledImage != null ) { disabledImage . flush ( ) ; } disabledImage = create_DISABLED_Image ( WIDTH ) ; ledPosition = new java . awt . Point [ ] { // LED 1
new java . awt . Point ( ( int ) ( WIDTH * 0.186915887850467 ) , ( int ) ( WIDTH * 0.649532710280374 ) ) , // LED 2
new java . awt . Point ( ( int ) ( WIDTH * 0.116822429906542 ) , ( int ) ( WIDTH * 0.546728971962617 ) ) , // LED 3
new java . awt . Point ( ( int ) ( WIDTH * 0.088785046728972 ) , ( int ) ( WIDTH * 0.41588785046729 ) ) , // LED 4
new java . awt . Point ( ( int ) ( WIDTH * 0.116822429906542 ) , ( int ) ( WIDTH * 0.285046728971963 ) ) , // LED 5
new java . awt . Point ( ( int ) ( WIDTH * 0.177570093457944 ) , ( int ) ( WIDTH * 0.182242990654206 ) ) , // LED 6
new java . awt . Point ( ( int ) ( WIDTH * 0.280373831775701 ) , ( int ) ( WIDTH * 0.117222429906542 ) ) , // LED 7
new java . awt . Point ( ( int ) ( WIDTH * 0.411214953271028 ) , ( int ) ( WIDTH * 0.0794392523364486 ) ) , // LED 8
new java . awt . Point ( ( int ) ( WIDTH * 0.542056074766355 ) , ( int ) ( WIDTH * 0.117222429906542 ) ) , // LED 9
new java . awt . Point ( ( int ) ( WIDTH * 0.649532710280374 ) , ( int ) ( WIDTH * 0.182242990654206 ) ) , // LED 10
new java . awt . Point ( ( int ) ( WIDTH * 0.719626168224299 ) , ( int ) ( WIDTH * 0.285046728971963 ) ) , // LED 11
new java . awt . Point ( ( int ) ( WIDTH * 0.738317757009346 ) , ( int ) ( WIDTH * 0.41588785046729 ) ) , // LED 12
new java . awt . Point ( ( int ) ( WIDTH * 0.710280373831776 ) , ( int ) ( WIDTH * 0.546728971962617 ) ) , // LED 13
new java . awt . Point ( ( int ) ( WIDTH * 0.64018691588785 ) , ( int ) ( WIDTH * 0.649532710280374 ) ) } ; ledGreenOff . flush ( ) ; ledGreenOff = create_LED_OFF_Image ( WIDTH , LedColor . GREEN ) ; ledYellowOff . flush ( ) ; ledYellowOff = create_LED_OFF_Image ( WIDTH , LedColor . YELLOW ) ; ledRedOff . flush ( ) ; ledRedOff = create_LED_OFF_Image ( WIDTH , LedColor . RED ) ; ledGreenOn . flush ( ) ; ledGreenOn = create_LED_ON_Image ( WIDTH , LedColor . GREEN ) ; ledYellowOn . flush ( ) ; ledYellowOn = create_LED_ON_Image ( WIDTH , LedColor . YELLOW ) ; ledRedOn . flush ( ) ; ledRedOn = create_LED_ON_Image ( WIDTH , LedColor . RED ) ; return this ; |
public class MoreCollectors { /** * Collector which traverses a stream and returns either a single element
* ( if there was only one element ) or empty ( if there were 0 or more than 1
* elements ) . It traverses the entire stream , even if two elements
* have been encountered and the empty return value is now certain .
* Implementation credit to Misha < a href = " http : / / stackoverflow . com / a / 26812693/1153071 " > on StackOverflow < / a > . */
public static < T > Collector < T , ? , Optional < T > > singleOrEmpty ( ) { } } | return Collectors . collectingAndThen ( Collectors . toList ( ) , lst -> lst . size ( ) == 1 ? Optional . of ( lst . get ( 0 ) ) : Optional . empty ( ) ) ; |
public class AceDataset { /** * Add an Experiment to the dataset .
* Add a new Experiment from a { @ code byte [ ] } consisting of the JSON
* for that experiment data .
* @ param source JSON experiment data
* @ throws IOException if there is an I / O error */
public void addExperiment ( byte [ ] source ) throws IOException { } } | AceExperiment experiment = new AceExperiment ( source ) ; String eid = experiment . getId ( ) ; if ( this . experimentMap . containsKey ( "eid" ) ) { LOG . error ( "Duplicate data found for experiment: {}" , experiment . getValueOr ( "exname" , "" ) ) ; } else { this . experimentMap . put ( eid , experiment ) ; } this . eidMap . put ( experiment . getValueOr ( "exname" , "" ) , eid ) ; |
public class Assistant { /** * List counterexamples .
* List the counterexamples for a workspace . Counterexamples are examples that have been marked as irrelevant input .
* This operation is limited to 2500 requests per 30 minutes . For more information , see * * Rate limiting * * .
* @ param listCounterexamplesOptions the { @ link ListCounterexamplesOptions } containing the options for the call
* @ return a { @ link ServiceCall } with a response type of { @ link CounterexampleCollection } */
public ServiceCall < CounterexampleCollection > listCounterexamples ( ListCounterexamplesOptions listCounterexamplesOptions ) { } } | Validator . notNull ( listCounterexamplesOptions , "listCounterexamplesOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "counterexamples" } ; String [ ] pathParameters = { listCounterexamplesOptions . workspaceId ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "listCounterexamples" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( listCounterexamplesOptions . pageLimit ( ) != null ) { builder . query ( "page_limit" , String . valueOf ( listCounterexamplesOptions . pageLimit ( ) ) ) ; } if ( listCounterexamplesOptions . includeCount ( ) != null ) { builder . query ( "include_count" , String . valueOf ( listCounterexamplesOptions . includeCount ( ) ) ) ; } if ( listCounterexamplesOptions . sort ( ) != null ) { builder . query ( "sort" , listCounterexamplesOptions . sort ( ) ) ; } if ( listCounterexamplesOptions . cursor ( ) != null ) { builder . query ( "cursor" , listCounterexamplesOptions . cursor ( ) ) ; } if ( listCounterexamplesOptions . includeAudit ( ) != null ) { builder . query ( "include_audit" , String . valueOf ( listCounterexamplesOptions . includeAudit ( ) ) ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( CounterexampleCollection . class ) ) ; |
public class EsApiKeyAuthScheme { /** * Returns the text to send via the Authenticate header on the next request . */
@ Override public String authenticate ( Credentials credentials , HttpMethod method ) throws AuthenticationException { } } | return authenticate ( credentials ) ; |
public class AbstractLogger { /** * Sets the minimum log level .
* @ param logLevel
* The log level */
public final void setLogLevel ( LogLevel logLevel ) { } } | LogLevel updatedLogLevel = logLevel ; if ( updatedLogLevel == null ) { updatedLogLevel = LogLevel . NONE ; } this . logLevel = updatedLogLevel ; |
public class DynamicOutputBuffer { /** * Removes a buffer from the list of internal buffers and saves it for
* reuse if this feature is enabled .
* @ param n the number of the buffer to remove */
protected void deallocateBuffer ( int n ) { } } | ByteBuffer bb = _buffers . set ( n , null ) ; if ( bb != null && _reuseBuffersCount > 0 ) { if ( _buffersToReuse == null ) { _buffersToReuse = new LinkedList < ByteBuffer > ( ) ; } if ( _reuseBuffersCount > _buffersToReuse . size ( ) ) { _buffersToReuse . add ( bb ) ; } } |
public class appfwxmlerrorpage { /** * Use this API to fetch all the appfwxmlerrorpage resources that are configured on netscaler . */
public static appfwxmlerrorpage get ( nitro_service service ) throws Exception { } } | appfwxmlerrorpage obj = new appfwxmlerrorpage ( ) ; appfwxmlerrorpage [ ] response = ( appfwxmlerrorpage [ ] ) obj . get_resources ( service ) ; return response [ 0 ] ; |
public class ServerAsyncResult { /** * This get method returns the result of the asynch method call . This method
* must not be called unless ivGate indicates that results are available .
* @ param timeout - the timeout value
* @ param unit - the time unit for the timeout value ( e . g . milliseconds , seconds , etc . )
* @ return - the result object
* @ throws InterruptedException - if the thread is interrupted while waiting
* @ throws CancellationException - if the async method was canceled successfully
* @ throws ExecutionException - if the async method ended with an exception
* @ throws TimeoutException - if the timeout period expires before the asynch method completes */
private Object getResult ( long timeout , TimeUnit unit ) throws InterruptedException , ExecutionException , TimeoutException { } } | if ( ivCancelled ) { // F743-11774
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getResult: throwing CancellationException" ) ; } throw new CancellationException ( ) ; // F743-11774
} // Method ended with an exception
if ( ivException != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getResult: " + ivException ) ; } throw new ExecutionException ( ivException ) ; } // F743-609CodRev
// If the result object is itself a Future object , we need to call " get " on it
// so that we unwrap the results and place them in this Future object . This
// is done to support asynchronous method calls that return results wrapped
// in Future objects , and also to support nested asynchronous method calls .
// Also , note that " null " is an acceptable result .
// F743-16193
// Remove instanceof check for Future object . Return type validation check
// moved to EJBMDOrchestrator . java
Object resultToReturn = null ; if ( ivFuture != null ) { // AsyncResult EJB3.2 API just throws IllegalStateExceptions for everything but . get ( ) .
// Even in EJB3.1 API get ( timeout , unit ) just immediately returned . In a long nested
// chain of futures , only the last one will be AsyncResult so we won ' t need to pass
// down the remaining timeout anyway .
if ( ivFuture instanceof AsyncResult ) { resultToReturn = ivFuture . get ( ) ; } else { resultToReturn = ivFuture . get ( timeout , unit ) ; // d650178
} } return ( resultToReturn ) ; |
public class WatchTextBatchSpout { /** * ファイルのチェックを行い 、 初回は読み込みを行い 、 以後は更新された場合にのみデータを取得する 。
* @ param collector Collector
* @ throws IOException ファイル入出力エラー発生時
* @ throws InterruptedException 割り込み例外発生時 */
@ SuppressWarnings ( { } } | "rawtypes" } ) protected void checkDataFile ( TridentCollector collector ) throws IOException , InterruptedException { // 初回は更新がない場合でも読みこみを行い 、 その上でファイル更新監視を開始する 。
if ( this . isInitialReaded == false ) { List < String > fileContents = FileUtils . readLines ( this . targetFile ) ; emitTuples ( fileContents , collector ) ; this . isInitialReaded = true ; // ファイル更新監視を開始
Path dirPath = new File ( this . dataFileDir ) . toPath ( ) ; FileSystem fileSystem = dirPath . getFileSystem ( ) ; this . watcherService = fileSystem . newWatchService ( ) ; this . watchKey = dirPath . register ( this . watcherService , new Kind [ ] { StandardWatchEventKinds . ENTRY_CREATE , StandardWatchEventKinds . ENTRY_MODIFY } ) ; return ; } // ファイル更新が行なわれているかを確認する 。
WatchKey detectedKey = this . watcherService . poll ( 1 , TimeUnit . SECONDS ) ; // ファイルの更新イベントが取得できなかった場合 、 または監視対象のイベントではない場合 、 終了する 。
if ( detectedKey == null || detectedKey . equals ( this . watchKey ) == false ) { return ; } try { // ファイル更新イベントが存在した場合 、 中身のファイルを読み込んで送信し 、 イベントの受付を再開する 。
for ( WatchEvent event : detectedKey . pollEvents ( ) ) { Path filePath = ( Path ) event . context ( ) ; // 同一ディレクトリ配下の別名ファイルの場合は読み込みを行わない 。
if ( filePath == null || this . targetFile . toPath ( ) . getFileName ( ) . equals ( filePath . getFileName ( ) ) == false ) { continue ; } List < String > fileContents = FileUtils . readLines ( this . targetFile ) ; emitTuples ( fileContents , collector ) ; } } finally { detectedKey . reset ( ) ; } |
public class XMLRuleHandler { /** * Adds Match objects for all references to tokens
* ( including ' \ 1 ' and the like ) . */
@ Nullable protected List < Match > addLegacyMatches ( List < Match > existingSugMatches , String messageStr , boolean inMessage ) { } } | List < Match > sugMatch = new ArrayList < > ( ) ; int pos = 0 ; int ind = 0 ; int matchCounter = 0 ; while ( pos != - 1 ) { pos = messageStr . indexOf ( '\\' , ind ) ; if ( pos != - 1 && messageStr . length ( ) > pos && Character . isDigit ( messageStr . charAt ( pos + 1 ) ) ) { if ( pos == 0 || messageStr . charAt ( pos - 1 ) != '\u0001' ) { Match mWorker = new Match ( null , null , false , null , null , Match . CaseConversion . NONE , false , false , Match . IncludeRange . NONE ) ; mWorker . setInMessageOnly ( true ) ; sugMatch . add ( mWorker ) ; } else if ( messageStr . charAt ( pos - 1 ) == '\u0001' ) { // real suggestion marker
sugMatch . add ( existingSugMatches . get ( matchCounter ) ) ; if ( inMessage ) { message . deleteCharAt ( pos - 1 - matchCounter ) ; } else { suggestionsOutMsg . deleteCharAt ( pos - 1 - matchCounter ) ; } matchCounter ++ ; } } ind = pos + 1 ; } if ( sugMatch . isEmpty ( ) ) { return existingSugMatches ; } return sugMatch ; |
public class DRL5Lexer { /** * $ ANTLR start " UnicodeEscape " */
public final void mUnicodeEscape ( ) throws RecognitionException { } } | try { // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 143:5 : ( ' \ \ \ \ ' ' u ' HexDigit HexDigit HexDigit HexDigit )
// src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 143:9 : ' \ \ \ \ ' ' u ' HexDigit HexDigit HexDigit HexDigit
{ match ( '\\' ) ; if ( state . failed ) return ; match ( 'u' ) ; if ( state . failed ) return ; mHexDigit ( ) ; if ( state . failed ) return ; mHexDigit ( ) ; if ( state . failed ) return ; mHexDigit ( ) ; if ( state . failed ) return ; mHexDigit ( ) ; if ( state . failed ) return ; } } finally { // do for sure before leaving
} |
public class TypeConverter { /** * Convert the passed source value to char
* @ param aSrcValue
* The source value . May not be < code > null < / code > .
* @ return The converted value .
* @ throws TypeConverterException
* if the source value is < code > null < / code > or if no converter was
* found or if the converter returned a < code > null < / code > object .
* @ throws RuntimeException
* If the converter itself throws an exception
* @ see TypeConverterProviderBestMatch */
public static char convertToChar ( @ Nonnull final Object aSrcValue ) { } } | if ( aSrcValue == null ) throw new TypeConverterException ( char . class , EReason . NULL_SOURCE_NOT_ALLOWED ) ; final Character aValue = convert ( aSrcValue , Character . class ) ; return aValue . charValue ( ) ; |
public class UpdateUfsModePRequest { /** * < code > optional . alluxio . grpc . file . UpdateUfsModePOptions options = 2 ; < / code > */
public alluxio . grpc . UpdateUfsModePOptions getOptions ( ) { } } | return options_ == null ? alluxio . grpc . UpdateUfsModePOptions . getDefaultInstance ( ) : options_ ; |
public class MinioClient { /** * Returns an presigned URL to download the object in the bucket with given expiry time .
* < / p > < b > Example : < / b > < br >
* < pre > { @ code String url = minioClient . presignedGetObject ( " my - bucketname " , " my - objectname " , 60 * 60 * 24 ) ;
* System . out . println ( url ) ; } < / pre >
* @ param bucketName Bucket name .
* @ param objectName Object name in the bucket .
* @ param expires Expiration time in seconds of presigned URL .
* @ return string contains URL to download the object .
* @ throws InvalidBucketNameException upon invalid bucket name is given
* @ throws NoSuchAlgorithmException
* upon requested algorithm was not found during signature calculation
* @ throws InsufficientDataException upon getting EOFException while reading given
* InputStream even before reading given length
* @ throws IOException upon connection error
* @ throws InvalidKeyException
* upon an invalid access key or secret key
* @ throws NoResponseException upon no response from server
* @ throws XmlPullParserException upon parsing response xml
* @ throws ErrorResponseException upon unsuccessful execution
* @ throws InternalException upon internal library error
* @ throws InvalidExpiresRangeException upon input expires is out of range */
public String presignedGetObject ( String bucketName , String objectName , Integer expires ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException , InvalidExpiresRangeException { } } | return presignedGetObject ( bucketName , objectName , expires , null ) ; |
public class CmsSearchControllerFacetRange { /** * Adds the query parts for the facet options , except the filter parts .
* @ param query The query part that is extended with the facet options . */
protected void addFacetOptions ( StringBuffer query ) { } } | // start
appendFacetOption ( query , "range.start" , m_config . getStart ( ) ) ; // end
appendFacetOption ( query , "range.end" , m_config . getEnd ( ) ) ; // gap
appendFacetOption ( query , "range.gap" , m_config . getGap ( ) ) ; // other
for ( I_CmsSearchConfigurationFacetRange . Other o : m_config . getOther ( ) ) { appendFacetOption ( query , "range.other" , o . toString ( ) ) ; } // hardend
appendFacetOption ( query , "range.hardend" , Boolean . toString ( m_config . getHardEnd ( ) ) ) ; // mincount
if ( m_config . getMinCount ( ) != null ) { appendFacetOption ( query , "mincount" , m_config . getMinCount ( ) . toString ( ) ) ; } |
public class CmsUploadTimeoutWatcher { /** * Returns < code > true < / code > if the upload process is frozen . < p >
* @ return < code > true < / code > if the upload process is frozen */
private boolean isFrozen ( ) { } } | long now = ( new Date ( ) ) . getTime ( ) ; if ( m_listener . getBytesRead ( ) > m_lastBytesRead ) { m_lastData = now ; m_lastBytesRead = m_listener . getBytesRead ( ) ; } else if ( ( now - m_lastData ) > CmsUploadBean . DEFAULT_UPLOAD_TIMEOUT ) { return true ; } return false ; |
public class LRExporter { /** * Attempt to configure the exporter with the values used in the constructor
* This must be called before an exporter can be used and after any setting of configuration values
* @ throws LRException */
public void configure ( ) throws LRException { } } | // Trim or nullify strings
nodeHost = StringUtil . nullifyBadInput ( nodeHost ) ; publishAuthUser = StringUtil . nullifyBadInput ( publishAuthUser ) ; publishAuthPassword = StringUtil . nullifyBadInput ( publishAuthPassword ) ; // Throw an exception if any of the required fields are null
if ( nodeHost == null ) { throw new LRException ( LRException . NULL_FIELD ) ; } // Throw an error if the batch size is zero
if ( batchSize == 0 ) { throw new LRException ( LRException . BATCH_ZERO ) ; } this . batchSize = batchSize ; this . publishFullUrl = publishProtocol + "://" + nodeHost + publishServiceUrl ; this . publishAuthUser = publishAuthUser ; this . publishAuthPassword = publishAuthPassword ; this . configured = true ; |
public class Predicate { /** * Returns a type - safe reference to the shared instance of a predicate that always returns
* < code > false < / code > . */
public static < T > Predicate < T > falseInstance ( ) { } } | @ SuppressWarnings ( "unchecked" ) Predicate < T > pred = ( Predicate < T > ) FALSE_INSTANCE ; return pred ; |
public class SparseMisoSceneWriter { /** * Writes just the scene data which is handy for derived classes which
* may wish to add their own scene data to the scene output . */
protected void writeSceneData ( SparseMisoSceneModel model , DataWriter writer ) throws SAXException { } } | writer . dataElement ( "swidth" , Integer . toString ( model . swidth ) ) ; writer . dataElement ( "sheight" , Integer . toString ( model . sheight ) ) ; writer . dataElement ( "defTileSet" , Integer . toString ( model . defTileSet ) ) ; writer . startElement ( "sections" ) ; for ( Iterator < Section > iter = model . getSections ( ) ; iter . hasNext ( ) ; ) { Section sect = iter . next ( ) ; if ( sect . isBlank ( ) ) { continue ; } AttributesImpl attrs = new AttributesImpl ( ) ; attrs . addAttribute ( "" , "x" , "" , "" , String . valueOf ( sect . x ) ) ; attrs . addAttribute ( "" , "y" , "" , "" , String . valueOf ( sect . y ) ) ; attrs . addAttribute ( "" , "width" , "" , "" , String . valueOf ( sect . width ) ) ; writer . startElement ( "" , "section" , "" , attrs ) ; writer . dataElement ( "base" , StringUtil . toString ( sect . baseTileIds , "" , "" ) ) ; // write our uninteresting object tile information
writer . startElement ( "objects" ) ; for ( int ii = 0 ; ii < sect . objectTileIds . length ; ii ++ ) { attrs = new AttributesImpl ( ) ; attrs . addAttribute ( "" , "tileId" , "" , "" , String . valueOf ( sect . objectTileIds [ ii ] ) ) ; attrs . addAttribute ( "" , "x" , "" , "" , String . valueOf ( sect . objectXs [ ii ] ) ) ; attrs . addAttribute ( "" , "y" , "" , "" , String . valueOf ( sect . objectYs [ ii ] ) ) ; writer . emptyElement ( "" , "object" , "" , attrs ) ; } // write our interesting object tile information
for ( ObjectInfo element : sect . objectInfo ) { writeInterestingObject ( element , writer ) ; } writer . endElement ( "objects" ) ; writer . endElement ( "section" ) ; } writer . endElement ( "sections" ) ; |
public class RefreshEndpoint { /** * Refresh application state only if environment has changed ( unless < code > force < / code > is set to true ) .
* @ param force { @ link Nullable } body property to indicate whether to force all { @ link io . micronaut . runtime . context . scope . Refreshable } beans to be refreshed
* @ return array of change keys if applicable */
@ Write public String [ ] refresh ( @ Nullable Boolean force ) { } } | if ( force != null && force ) { eventPublisher . publishEvent ( new RefreshEvent ( ) ) ; return new String [ 0 ] ; } else { Map < String , Object > changes = environment . refreshAndDiff ( ) ; if ( ! changes . isEmpty ( ) ) { eventPublisher . publishEvent ( new RefreshEvent ( changes ) ) ; } Set < String > keys = changes . keySet ( ) ; return keys . toArray ( new String [ 0 ] ) ; } |
public class HarIndex { /** * Finds the index entry corresponding to a file in the archive */
public IndexEntry findEntryByFileName ( String fileName ) { } } | for ( IndexEntry e : entries ) { if ( fileName . equals ( e . fileName ) ) { return e ; } } return null ; |
public class MessageDispatcher { public static void sendErrorResponse ( SipApplicationDispatcher sipApplicationDispatcher , int errorCode , SipServletRequestImpl sipServletRequest , SipProvider sipProvider ) { } } | if ( logger . isDebugEnabled ( ) ) { logger . debug ( "sendErrorResponse - errorCode=" + errorCode + ", sipServletRequest=" + sipServletRequest ) ; } MessageDispatcher . sendErrorResponse ( sipApplicationDispatcher , errorCode , ( ServerTransaction ) sipServletRequest . getTransaction ( ) , ( Request ) sipServletRequest . getMessage ( ) , sipProvider ) ; if ( sipServletRequest . getSipSession ( ) != null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "sendErrorResponse - sip session is not null" ) ; } sipServletRequest . getSipSession ( ) . updateStateOnResponse ( ( SipServletResponseImpl ) sipServletRequest . createResponse ( SipServletResponseImpl . SC_SERVER_INTERNAL_ERROR ) , false ) ; } |
public class JVMUtil { /** * Fallback when checking CompressedOopsEnabled . */
@ SuppressFBWarnings ( "NP_BOOLEAN_RETURN_NULL" ) static Boolean isObjectLayoutCompressedOopsOrNull ( ) { } } | if ( ! UNSAFE_AVAILABLE ) { return null ; } Integer referenceSize = ReferenceSizeEstimator . getReferenceSizeOrNull ( ) ; if ( referenceSize == null ) { return null ; } // when reference size does not equal address size then it ' s safe to assume references are compressed
return referenceSize != UNSAFE . addressSize ( ) ; |
public class DoSServerFilter { /** * Called when connections , requests or bytes reach to the limit .
* @ param remoteAddr
* @ param connections
* @ param requests
* @ param bytes */
protected void onBlock ( ConnectionFilter filter , String remoteAddr , int connections , int requests , int bytes ) { } } | filter . disconnect ( ) ; filter . onDisconnect ( ) ; |
public class XGBoostAutoBuffer { /** * Used to communicate with external frameworks , for example XGBoost */
public String getStr ( ) { } } | int len = ab . get4 ( ) ; return len == - 1 ? null : new String ( ab . getA1 ( len ) , UTF_8 ) ; |
public class EditDistance { /** * x和y肯定不同的
* @ param x
* @ param y
* @ return 代价 */
protected static float costReplace ( char x , char y ) { } } | int cost = 1 ; for ( char [ ] xy : repCostChars ) { if ( xy [ 0 ] == x && xy [ 1 ] == y ) { cost = 2 ; break ; } else if ( xy [ 0 ] == y && xy [ 1 ] == x ) { cost = 2 ; break ; } } return cost ; // noCostChars . indexOf ( c ) ! = - 1?1:0; |
public class Jackson { /** * https : / / gitee . com / jfinal / jfinal - weixin / issues / I875U */
protected void config ( ) { } } | objectMapper . configure ( com . fasterxml . jackson . core . JsonParser . Feature . ALLOW_UNQUOTED_CONTROL_CHARS , true ) ; objectMapper . configure ( com . fasterxml . jackson . core . JsonParser . Feature . ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER , true ) ; |
public class CurrencyFormat { /** * Override Format . format ( ) .
* @ see java . text . Format # format ( java . lang . Object , java . lang . StringBuffer , java . text . FieldPosition ) */
public StringBuffer format ( Object obj , StringBuffer toAppendTo , FieldPosition pos ) { } } | if ( ! ( obj instanceof CurrencyAmount ) ) { throw new IllegalArgumentException ( "Invalid type: " + obj . getClass ( ) . getName ( ) ) ; } CurrencyAmount currency = ( CurrencyAmount ) obj ; fmt . setCurrency ( currency . getCurrency ( ) ) ; return fmt . format ( currency . getNumber ( ) , toAppendTo , pos ) ; |
public class JideOverlayService { /** * { @ inheritDoc } */
public Boolean uninstallOverlay ( JComponent targetComponent , JComponent overlay , Insets insets ) { } } | Assert . notNull ( targetComponent , JideOverlayService . TARGET_COMPONENT_PARAM ) ; Assert . notNull ( overlay , JideOverlayService . OVERLAY ) ; final DefaultOverlayable overlayable = this . findOverlayable ( targetComponent ) ; // If overlay is installed . . .
if ( ( overlayable != null ) && this . isOverlayInstalled ( overlayable , overlay ) ) { // Uninstall overlay
overlayable . removeOverlayComponent ( overlay ) ; // If location insets are not null then change them
if ( insets != null ) { overlayable . setOverlayLocationInsets ( insets ) ; } return Boolean . TRUE ; } else if ( overlayable == null ) { JideOverlayService . LOGGER . warn ( JideOverlayService . NOT_FOUND_FMT . format ( new String [ ] { targetComponent . getName ( ) } ) ) ; return Boolean . FALSE ; } else { JideOverlayService . LOGGER . warn ( JideOverlayService . NOT_INSTALLED_FMT . format ( new String [ ] { overlay . getName ( ) , targetComponent . getName ( ) } ) ) ; return Boolean . FALSE ; } |
public class Initiator { /** * Removes the < code > Session < / code > instances form the sessions queue .
* @ param sessionReq The Session to remove
* @ throws NoSuchSessionException if the Session does not exist in the Map */
public final void removeSession ( final Session sessionReq ) throws NoSuchSessionException { } } | final Session session = sessions . get ( sessionReq . getTargetName ( ) ) ; if ( session != null ) { sessions . remove ( sessionReq . getTargetName ( ) ) ; } else { throw new NoSuchSessionException ( "Session " + sessionReq . getTargetName ( ) + " not found!" ) ; } |
public class PortletExecutionManager { /** * / * ( non - Javadoc )
* @ see org . apereo . portal . portlet . rendering . IPortletExecutionManager # getPortletOutput ( org . apereo . portal . portlet . om . IPortletWindowId , javax . servlet . http . HttpServletRequest , javax . servlet . http . HttpServletResponse ) */
@ Override public String getPortletOutput ( IPortletWindowId portletWindowId , HttpServletRequest request , HttpServletResponse response ) { } } | final IPortletRenderExecutionWorker tracker = getRenderedPortletBodyWorker ( portletWindowId , request , response ) ; final long timeout = getPortletRenderTimeout ( portletWindowId , request ) ; try { final String output = tracker . getOutput ( timeout ) ; return output == null ? "" : output ; } catch ( Exception e ) { final IPortletFailureExecutionWorker failureWorker = this . portletWorkerFactory . createFailureWorker ( request , response , portletWindowId , e ) ; // TODO publish portlet error event ?
try { failureWorker . submit ( ) ; return failureWorker . getOutput ( timeout ) ; } catch ( Exception e1 ) { logger . error ( "Failed to render error portlet for: " + portletWindowId , e1 ) ; return "Error Portlet Unavailable. Please contact your portal administrators." ; } } |
public class AesEncrypter { /** * Decrypt .
* @ param encryptedText the encrypted text
* @ param secretKey the secret key
* @ return the string */
public static final String decrypt ( String secretKey , String encryptedText ) { } } | if ( encryptedText == null ) { return null ; } if ( encryptedText . startsWith ( "$CRYPT::" ) ) { // $ NON - NLS - 1 $
byte [ ] decoded = Base64 . decodeBase64 ( encryptedText . substring ( 8 ) ) ; Cipher cipher ; try { SecretKeySpec skeySpec = keySpecFromSecretKey ( secretKey ) ; cipher = Cipher . getInstance ( "AES" ) ; // $ NON - NLS - 1 $
cipher . init ( Cipher . DECRYPT_MODE , skeySpec ) ; } catch ( NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e ) { throw new RuntimeException ( e ) ; } try { return new String ( cipher . doFinal ( decoded ) ) ; } catch ( IllegalBlockSizeException | BadPaddingException e ) { throw new RuntimeException ( e ) ; } } else { return encryptedText ; } |
public class AmazonWebServiceRequest { /** * Returns the root object from which the current object was cloned ; or null if there isn ' t one . */
public AmazonWebServiceRequest getCloneRoot ( ) { } } | AmazonWebServiceRequest cloneRoot = cloneSource ; if ( cloneRoot != null ) { while ( cloneRoot . getCloneSource ( ) != null ) { cloneRoot = cloneRoot . getCloneSource ( ) ; } } return cloneRoot ; |
public class AggregationQueryBuilder { /** * / / / / / old metrics */
private static void pushOp ( String operation , Stack < MetricExpression > expressions , Stack < String > operations ) { } } | if ( operation . equals ( "(" ) ) { operations . push ( operation ) ; return ; } if ( operation . equals ( ")" ) ) { while ( ! operations . isEmpty ( ) ) { String op = operations . pop ( ) ; if ( op . equals ( "(" ) ) return ; doOperation ( op , expressions , operations ) ; } } if ( operation . equals ( "*" ) || operation . equals ( "/" ) ) { if ( operations . isEmpty ( ) ) operations . push ( operation ) ; else { String op1 = operations . peek ( ) ; if ( ! op1 . equals ( "(" ) ) { if ( op1 . equals ( "+" ) || op1 . equals ( "-" ) ) { operations . push ( operation ) ; } else { doOperation ( operations . pop ( ) , expressions , operations ) ; operations . push ( operation ) ; } } else { operations . push ( operation ) ; } } } if ( operation . equals ( "+" ) || operation . equals ( "-" ) ) { if ( operations . isEmpty ( ) ) operations . push ( operation ) ; else { String op1 = operations . peek ( ) ; if ( ! op1 . equals ( "(" ) ) { doOperation ( operations . pop ( ) , expressions , operations ) ; } operations . push ( operation ) ; } } |
public class SipServletResponseImpl { /** * ( non - Javadoc )
* @ see javax . servlet . sip . SipServletMessage # isCommitted ( ) */
public boolean isCommitted ( ) { } } | Transaction tx = getTransaction ( ) ; // Issue 1571 : http : / / code . google . com / p / mobicents / issues / detail ? id = 1571
// NullPointerException in SipServletResponseImpl . isCommitted
if ( tx != null ) { // the message is an incoming non - reliable provisional response received by a servlet acting as a UAC
if ( tx instanceof ClientTransaction && getStatus ( ) >= 101 && getStatus ( ) <= 199 && getHeader ( "RSeq" ) == null ) { if ( this . proxyBranch == null ) { // Make sure this is not a proxy . Proxies are allowed to modify headers .
return true ; } else { return false ; } } // the message is an incoming reliable provisional response for which PRACK has already been generated . ( Note that this scenario applies to containers that support the 100rel extension . )
if ( tx instanceof ClientTransaction && getStatus ( ) >= 101 && getStatus ( ) <= 199 && getHeader ( "RSeq" ) != null && TransactionState . TERMINATED . equals ( tx . getState ( ) ) ) { if ( this . proxyBranch == null ) { // Make sure this is not a proxy . Proxies are allowed to modify headers .
return true ; } else { return false ; } } // the message is an incoming final response received by a servlet acting as a UAC for a Non INVITE transaction
if ( tx instanceof ClientTransaction && getStatus ( ) >= 200 && getStatus ( ) <= 999 && ! Request . INVITE . equals ( ( ( SIPClientTransaction ) tx ) . getMethod ( ) ) ) { if ( this . proxyBranch == null ) { // Make sure this is not a proxy . Proxies are allowed to modify headers .
return true ; } else { return false ; } } // the message is a response which has been forwarded upstream
if ( isResponseForwardedUpstream ) { return true ; } // message is an incoming final response to an INVITE transaction and an ACK has been generated
if ( tx instanceof ClientTransaction && getStatus ( ) >= 200 && getStatus ( ) <= 999 && TransactionState . TERMINATED . equals ( tx . getState ( ) ) && isAckGenerated ) { return true ; } } return false ; |
public class AddTorrentParams { /** * Url seeds to be added to the torrent ( ` BEP 17 ` _ ) .
* @ return the url seeds */
public ArrayList < String > urlSeeds ( ) { } } | string_vector v = p . get_url_seeds ( ) ; int size = ( int ) v . size ( ) ; ArrayList < String > l = new ArrayList < > ( ) ; for ( int i = 0 ; i < size ; i ++ ) { l . add ( v . get ( i ) ) ; } return l ; |
public class DashboardDto { /** * Sets the template variables used in this dashboard .
* @ param templateVars A list of template variables . If the list is null or empty then existing templateVars are cleared . */
public void setTemplateVars ( List < TemplateVar > templateVars ) { } } | this . templateVars . clear ( ) ; if ( templateVars != null && ! templateVars . isEmpty ( ) ) { this . templateVars . addAll ( templateVars ) ; } |
public class HttpRequest { /** * Represents array of any type as list of objects so we can easily iterate over it
* @ param array of elements
* @ return list with the same elements */
private static List < Object > arrayToList ( final Object array ) { } } | if ( array instanceof Object [ ] ) return Arrays . asList ( ( Object [ ] ) array ) ; List < Object > result = new ArrayList < Object > ( ) ; // Arrays of the primitive types can ' t be cast to array of Object , so this :
if ( array instanceof int [ ] ) for ( int value : ( int [ ] ) array ) result . add ( value ) ; else if ( array instanceof boolean [ ] ) for ( boolean value : ( boolean [ ] ) array ) result . add ( value ) ; else if ( array instanceof long [ ] ) for ( long value : ( long [ ] ) array ) result . add ( value ) ; else if ( array instanceof float [ ] ) for ( float value : ( float [ ] ) array ) result . add ( value ) ; else if ( array instanceof double [ ] ) for ( double value : ( double [ ] ) array ) result . add ( value ) ; else if ( array instanceof short [ ] ) for ( short value : ( short [ ] ) array ) result . add ( value ) ; else if ( array instanceof byte [ ] ) for ( byte value : ( byte [ ] ) array ) result . add ( value ) ; else if ( array instanceof char [ ] ) for ( char value : ( char [ ] ) array ) result . add ( value ) ; return result ; |
public class GraphQLTypeUtil { /** * This will return the type in graphql SDL format , eg [ typeName ! ] !
* @ param type the type in play
* @ return the type in graphql SDL format , eg [ typeName ! ] ! */
public static String simplePrint ( GraphQLType type ) { } } | StringBuilder sb = new StringBuilder ( ) ; if ( isNonNull ( type ) ) { sb . append ( simplePrint ( unwrapOne ( type ) ) ) ; sb . append ( "!" ) ; } else if ( isList ( type ) ) { sb . append ( "[" ) ; sb . append ( simplePrint ( unwrapOne ( type ) ) ) ; sb . append ( "]" ) ; } else { sb . append ( type . getName ( ) ) ; } return sb . toString ( ) ; |
public class IndexMultiList { /** * Deletes a list . */
void deleteList ( int list ) { } } | int ptr = getFirst ( list ) ; while ( ptr != nullNode ( ) ) { int p = ptr ; ptr = getNext ( ptr ) ; freeNode_ ( p ) ; } if ( m_b_allow_navigation_between_lists ) { int prevList = m_lists . getField ( list , 2 ) ; int nextList = m_lists . getField ( list , 3 ) ; if ( prevList != nullNode ( ) ) m_lists . setField ( prevList , 3 , nextList ) ; else m_list_of_lists = nextList ; if ( nextList != nullNode ( ) ) m_lists . setField ( nextList , 2 , prevList ) ; } freeList_ ( list ) ; |
public class DirectoryRebase { /** * Recursively traverses the registered directories . Directories which were not roots sometime in the past will
* be cancelled and removed . If a directory was a root ( known by { @ link Directory # hasKeys ( ) } ) , then it will be
* added to the list specified . This list contains sub - directories which need to be converted back into
* root directories .
* @ param pDiscardedParent Parent directory which was discarded , never { @ code null }
* @ param pToBeConverted List of sub - directories which need to be converted into root - directories , never { @ code null } */
private void cancelDiscardedDirectories ( final Directory pDiscardedParent , final Collection < Directory > pToBeConverted ) { } } | final Collection < Directory > toBeDiscarded = new LinkedList < > ( ) ; dirs . values ( ) . removeIf ( dir -> { if ( pDiscardedParent . isDirectParentOf ( dir ) ) { if ( dir . hasKeys ( ) ) { pToBeConverted . add ( dir ) ; } else { toBeDiscarded . add ( dir ) ; dir . cancelKey ( ) ; return true ; } } return false ; } ) ; toBeDiscarded . forEach ( dir -> cancelDiscardedDirectories ( dir , pToBeConverted ) ) ; |
public class RocksDBStateBackend { /** * Sets the directories in which the local RocksDB database puts its files ( like SST and
* metadata files ) . These directories do not need to be persistent , they can be ephemeral ,
* meaning that they are lost on a machine failure , because state in RocksDB is persisted
* in checkpoints .
* < p > If nothing is configured , these directories default to the TaskManager ' s local
* temporary file directories .
* < p > Each distinct state will be stored in one path , but when the state backend creates
* multiple states , they will store their files on different paths .
* < p > Passing { @ code null } to this function restores the default behavior , where the configured
* temp directories will be used .
* @ param paths The paths across which the local RocksDB database files will be spread . */
public void setDbStoragePaths ( String ... paths ) { } } | if ( paths == null ) { localRocksDbDirectories = null ; } else if ( paths . length == 0 ) { throw new IllegalArgumentException ( "empty paths" ) ; } else { File [ ] pp = new File [ paths . length ] ; for ( int i = 0 ; i < paths . length ; i ++ ) { final String rawPath = paths [ i ] ; final String path ; if ( rawPath == null ) { throw new IllegalArgumentException ( "null path" ) ; } else { // we need this for backwards compatibility , to allow URIs like ' file : / / / ' . . .
URI uri = null ; try { uri = new Path ( rawPath ) . toUri ( ) ; } catch ( Exception e ) { // cannot parse as a path
} if ( uri != null && uri . getScheme ( ) != null ) { if ( "file" . equalsIgnoreCase ( uri . getScheme ( ) ) ) { path = uri . getPath ( ) ; } else { throw new IllegalArgumentException ( "Path " + rawPath + " has a non-local scheme" ) ; } } else { path = rawPath ; } } pp [ i ] = new File ( path ) ; if ( ! pp [ i ] . isAbsolute ( ) ) { throw new IllegalArgumentException ( "Relative paths are not supported" ) ; } } localRocksDbDirectories = pp ; } |
import java . util . ArrayList ; import java . util . List ; public class Main { /** * Shifts elements of a given list to the left by a specified number of positions .
* This function moves the elements from ' startPos ' up to ' endPos ' from the left of the list to the end of it .
* Examples :
* shiftLeft ( [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] , 3 , 4 ) - > [ 4 , 5 , 6 , 7 , 8 , 9 , 10 , 1 , 2 , 3 , 4]
* shiftLeft ( [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] , 2 , 2 ) - > [ 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 1 , 2]
* shiftLeft ( [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] , 5 , 2 ) - > [ 6 , 7 , 8 , 9 , 10 , 1 , 2]
* @ param targetList The list to be shifted .
* @ param startPos The starting position for the shift .
* @ param endPos The position until where the shift occurs .
* @ return A shifted version of the target list . */
public static List < Integer > shiftLeft ( List < Integer > targetList , int startPos , int endPos ) { } } | List < Integer > result = new ArrayList < > ( ) ; result . addAll ( targetList . subList ( startPos , targetList . size ( ) ) ) ; result . addAll ( targetList . subList ( 0 , endPos ) ) ; return result ; |
public class IntToLongFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static IntToLongFunction intToLongFunctionFrom ( Consumer < IntToLongFunctionBuilder > buildingFunction ) { } } | IntToLongFunctionBuilder builder = new IntToLongFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class RowAVL { /** * Returns the Node for the next Index on this database row , given the
* Node for any Index . */
NodeAVL getNextNode ( NodeAVL n ) { } } | if ( n == null ) { n = nPrimaryNode ; } else { n = n . nNext ; } return n ; |
public class DescribeAnalysisSchemesResult { /** * The analysis scheme descriptions .
* @ return The analysis scheme descriptions . */
public java . util . List < AnalysisSchemeStatus > getAnalysisSchemes ( ) { } } | if ( analysisSchemes == null ) { analysisSchemes = new com . amazonaws . internal . SdkInternalList < AnalysisSchemeStatus > ( ) ; } return analysisSchemes ; |
public class ChatGlyph { /** * Render the chat glyph with no thought to dirty rectangles or
* restoring composites . */
public void render ( Graphics2D gfx ) { } } | Object oalias = SwingUtil . activateAntiAliasing ( gfx ) ; gfx . setColor ( getBackground ( ) ) ; gfx . fill ( _shape ) ; gfx . setColor ( _outline ) ; gfx . draw ( _shape ) ; SwingUtil . restoreAntiAliasing ( gfx , oalias ) ; if ( _icon != null ) { _icon . paintIcon ( _owner . getTarget ( ) , gfx , _ipos . x , _ipos . y ) ; } gfx . setColor ( Color . BLACK ) ; _label . render ( gfx , _lpos . x , _lpos . y ) ; |
public class JasperEngine { /** * useful for edit jasper parameters : do not need here the values as in getReportUserParameters */
public Map < String , Serializable > getReportUserParametersForEdit ( Report report ) throws Exception { } } | Map < String , Serializable > result = new LinkedHashMap < String , Serializable > ( ) ; JasperReport jr = getJasperReport ( report ) ; Map < String , Serializable > map = JasperReportsUtil . getJasperReportUserParameters ( jr ) ; for ( String key : map . keySet ( ) ) { JasperParameter jp = ( JasperParameter ) map . get ( key ) ; JasperParameterSource sp = getParameterSources ( report , jp ) ; // this parameter is not defined inside the file
if ( sp == null ) { sp = new JasperParameterSource ( jp . getName ( ) ) ; sp . setValueClassName ( JasperReportsUtil . getValueClassName ( storageService , report . getDataSource ( ) , jp ) ) ; } result . put ( sp . getName ( ) , sp ) ; } return result ; |
public class WMI4Java { /** * Query a list of object data for an specific class < br >
* This method should be used to retrieve a list of objects instead of a
* flat key / value object . < br >
* For example , you can use it to retrieve hardware elements information
* ( processors , printers , screens , etc )
* @ param wmiClass
* Enum that contains the most used classes ( root / cimv2)
* @ return List of key / value elements . Each element in the list is a found
* object */
public List < Map < String , String > > getWMIObjectList ( String wmiClass ) throws WMIException { } } | List < Map < String , String > > foundWMIClassProperties = new ArrayList < Map < String , String > > ( ) ; try { String rawData ; if ( this . properties != null || this . filters != null ) { rawData = getWMIStub ( ) . queryObject ( wmiClass , this . properties , this . filters , this . namespace , this . computerName ) ; } else { rawData = getWMIStub ( ) . listObject ( wmiClass , this . namespace , this . computerName ) ; } String [ ] dataStringObjects = rawData . split ( NEWLINE_REGEX + NEWLINE_REGEX ) ; for ( String dataStringObject : dataStringObjects ) { String [ ] dataStringLines = dataStringObject . split ( NEWLINE_REGEX ) ; Map < String , String > objectProperties = new HashMap < String , String > ( ) ; for ( final String line : dataStringLines ) { if ( ! line . isEmpty ( ) ) { String [ ] entry = line . split ( ":" ) ; if ( entry . length == 2 ) { objectProperties . put ( entry [ 0 ] . trim ( ) , entry [ 1 ] . trim ( ) ) ; } } } foundWMIClassProperties . add ( objectProperties ) ; } } catch ( WMIException ex ) { Logger . getLogger ( WMI4Java . class . getName ( ) ) . log ( Level . SEVERE , GENERIC_ERROR_MSG , ex ) ; throw new WMIException ( ex ) ; } return foundWMIClassProperties ; |
public class Proxy { /** * Returns a property value .
* @ param propertyName The property name .
* @ return The property value , or null if none . */
private String getProperty ( String propertyName ) { } } | return propertyName == null ? null : ( String ) getPropertyValue ( propertyName ) ; |
public class CmsCodeMirror { /** * Adds a blur listener . < p >
* @ param listener the blur listener */
public void addBlurListener ( FieldEvents . BlurListener listener ) { } } | addListener ( FieldEvents . BlurEvent . class , listener , BLUR_METHOD ) ; markAsDirty ( ) ; |
public class GIntegralImageFeatureIntensity { /** * Computes an approximation to the Hessian ' s determinant .
* @ param integral Integral image transform of input image . Not modified .
* @ param skip How many pixels should it skip over .
* @ param size Hessian kernel ' s size .
* @ param intensity Output intensity image . */
public static < T extends ImageGray < T > > void hessian ( T integral , int skip , int size , GrayF32 intensity ) { } } | if ( integral instanceof GrayF32 ) { IntegralImageFeatureIntensity . hessian ( ( GrayF32 ) integral , skip , size , intensity ) ; } else if ( integral instanceof GrayS32 ) { IntegralImageFeatureIntensity . hessian ( ( GrayS32 ) integral , skip , size , intensity ) ; } else { throw new IllegalArgumentException ( "Unsupported input type" ) ; } |
public class DistanceFormatter { /** * Returns a formatted SpannableString with bold and size formatting . I . e . , " 10 mi " , " 350 m "
* @ param distance in meters
* @ return SpannableString representation which has a bolded number and units which have a
* relative size of . 65 times the size of the number */
public SpannableString formatDistance ( double distance ) { } } | double distanceSmallUnit = TurfConversion . convertLength ( distance , TurfConstants . UNIT_METERS , smallUnit ) ; double distanceLargeUnit = TurfConversion . convertLength ( distance , TurfConstants . UNIT_METERS , largeUnit ) ; // If the distance is greater than 10 miles / kilometers , then round to nearest mile / kilometer
if ( distanceLargeUnit > LARGE_UNIT_THRESHOLD ) { return getDistanceString ( roundToDecimalPlace ( distanceLargeUnit , 0 ) , largeUnit ) ; // If the distance is less than 401 feet / meters , round by fifty feet / meters
} else if ( distanceSmallUnit < SMALL_UNIT_THRESHOLD ) { return getDistanceString ( roundToClosestIncrement ( distanceSmallUnit ) , smallUnit ) ; // If the distance is between 401 feet / meters and 10 miles / kilometers , then round to one decimal place
} else { return getDistanceString ( roundToDecimalPlace ( distanceLargeUnit , 1 ) , largeUnit ) ; } |
public class CommerceAccountOrganizationRelPersistenceImpl { /** * Returns the last commerce account organization rel in the ordered set where organizationId = & # 63 ; .
* @ param organizationId the organization ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce account organization rel
* @ throws NoSuchAccountOrganizationRelException if a matching commerce account organization rel could not be found */
@ Override public CommerceAccountOrganizationRel findByOrganizationId_Last ( long organizationId , OrderByComparator < CommerceAccountOrganizationRel > orderByComparator ) throws NoSuchAccountOrganizationRelException { } } | CommerceAccountOrganizationRel commerceAccountOrganizationRel = fetchByOrganizationId_Last ( organizationId , orderByComparator ) ; if ( commerceAccountOrganizationRel != null ) { return commerceAccountOrganizationRel ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "organizationId=" ) ; msg . append ( organizationId ) ; msg . append ( "}" ) ; throw new NoSuchAccountOrganizationRelException ( msg . toString ( ) ) ; |
public class AbstractInstrumentMojo { /** * Instruments all classes in a path recursively .
* @ param log maven logger
* @ param classpath classpath for classes being instrumented
* @ param path directory containing files to instrument
* @ throws MojoExecutionException if any exception occurs */
protected final void instrumentPath ( Log log , List < String > classpath , File path ) throws MojoExecutionException { } } | try { Instrumenter instrumenter = getInstrumenter ( log , classpath ) ; InstrumentationSettings settings = new InstrumentationSettings ( markerType , debugMode , autoSerializable ) ; PluginHelper . instrument ( instrumenter , settings , path , path , log :: info ) ; } catch ( Exception ex ) { throw new MojoExecutionException ( "Unable to get compile classpath elements" , ex ) ; } |
public class iOSVariantEndpoint { /** * Add iOS Variant
* @ param form new iOS Variant
* @ param pushApplicationID id of { @ link PushApplication }
* @ param uriInfo uri
* @ return created { @ link iOSVariant }
* @ statuscode 201 The iOS Variant created successfully
* @ statuscode 400 The format of the client request was incorrect
* @ statuscode 404 The requested PushApplication resource does not exist */
@ POST @ Consumes ( MediaType . MULTIPART_FORM_DATA ) @ Produces ( MediaType . APPLICATION_JSON ) public Response registeriOSVariant ( @ MultipartForm iOSApplicationUploadForm form , @ PathParam ( "pushAppID" ) String pushApplicationID , @ Context UriInfo uriInfo ) { } } | // find the root push app
PushApplication pushApp = getSearch ( ) . findByPushApplicationIDForDeveloper ( pushApplicationID ) ; if ( pushApp == null ) { return Response . status ( Status . NOT_FOUND ) . entity ( "Could not find requested PushApplicationEntity" ) . build ( ) ; } // some model validation on the uploaded form
try { validateModelClass ( form ) ; } catch ( ConstraintViolationException cve ) { logger . trace ( "Unable to validate given form upload" ) ; // Build and return the 400 ( Bad Request ) response
ResponseBuilder builder = createBadRequestResponse ( cve . getConstraintViolations ( ) ) ; return builder . build ( ) ; } // extract form values :
iOSVariant iOSVariant = new iOSVariant ( ) ; iOSVariant . setName ( form . getName ( ) ) ; iOSVariant . setDescription ( form . getDescription ( ) ) ; iOSVariant . setPassphrase ( form . getPassphrase ( ) ) ; iOSVariant . setCertificate ( form . getCertificate ( ) ) ; iOSVariant . setProduction ( form . getProduction ( ) ) ; // some model validation on the entity :
try { validateModelClass ( iOSVariant ) ; } catch ( ConstraintViolationException cve ) { logger . trace ( "Unable to create iOS variant entity" ) ; // Build and return the 400 ( Bad Request ) response
ResponseBuilder builder = createBadRequestResponse ( cve . getConstraintViolations ( ) ) ; return builder . build ( ) ; } logger . trace ( "Register iOS variant with Push Application '{}'" , pushApplicationID ) ; // store the iOS variant :
variantService . addVariant ( iOSVariant ) ; // add iOS variant , and merge :
pushAppService . addVariant ( pushApp , iOSVariant ) ; return Response . created ( uriInfo . getAbsolutePathBuilder ( ) . path ( String . valueOf ( iOSVariant . getVariantID ( ) ) ) . build ( ) ) . entity ( iOSVariant ) . build ( ) ; |
public class ThriftClient { /** * Returns a new client for the specified host , setting the specified keyspace .
* @ param host the Cassandra host address .
* @ param port the Cassandra host RPC port .
* @ param keyspace the name of the Cassandra keyspace to set .
* @ return a new client for the specified host , setting the specified keyspace .
* @ throws TException if there is any problem with the { @ code set _ keyspace } call . */
public static ThriftClient build ( String host , int port , String keyspace ) throws TException { } } | TTransport transport = new TFramedTransport ( new TSocket ( host , port ) ) ; TProtocol protocol = new TBinaryProtocol ( transport ) ; ThriftClient client = new ThriftClient ( protocol ) ; transport . open ( ) ; if ( keyspace != null ) { client . set_keyspace ( keyspace ) ; } return client ; |
public class ByteUtilities { /** * Convert a byte array to an float ( little endian ) .
* @ param data the byte array to convert .
* @ return the float . */
public static float byteArrayToFloatLE ( byte [ ] data ) { } } | ByteBuffer buffer = ByteBuffer . wrap ( data ) ; buffer . order ( ByteOrder . LITTLE_ENDIAN ) ; return buffer . getFloat ( ) ; |
public class IntervalParser { /** * < p > Factory method with either solidus or hyphen as separation char . < / p >
* @ param < T > generic temporal type
* @ param < I > generic interval type
* @ param factory interval factory
* @ param parser boundary parser
* @ param policy bracket policy
* @ return new interval parser
* @ since 2.0 */
static < T extends Temporal < ? super T > , I extends IsoInterval < T , I > > IntervalParser < T , I > of ( IntervalFactory < T , I > factory , ChronoParser < T > parser , BracketPolicy policy ) { } } | if ( parser == null ) { throw new NullPointerException ( "Missing boundary parser." ) ; } return new IntervalParser < > ( factory , parser , parser , policy , null ) ; |
public class GeoPackageJavaProperties { /** * Get a float property by base property and property name
* @ param base
* base property
* @ param property
* property
* @ param required
* required flag
* @ return property value */
public static Float getFloatProperty ( String base , String property , boolean required ) { } } | return getFloatProperty ( base + JavaPropertyConstants . PROPERTY_DIVIDER + property , required ) ; |
public class TextCommandFactory { /** * ( non - Javadoc )
* @ seenet . rubyeye . xmemcached . CommandFactory # createStatsCommand ( java . net . InetSocketAddress ,
* java . util . concurrent . CountDownLatch ) */
public final Command createStatsCommand ( InetSocketAddress server , CountDownLatch latch , String itemName ) { } } | return new TextStatsCommand ( server , latch , itemName ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcCharacterStyleSelect ( ) { } } | if ( ifcCharacterStyleSelectEClass == null ) { ifcCharacterStyleSelectEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 940 ) ; } return ifcCharacterStyleSelectEClass ; |
public class CsvReader { @ SuppressWarnings ( "unchecked" ) private < T > T toType ( String cell , DataType dataType ) { } } | switch ( dataType ) { case Long : return cell != null && cell . length ( ) > 0 ? ( T ) Long . valueOf ( cell ) : ( T ) Long . valueOf ( - 1 ) ; default : return ( T ) cell ; } |
public class ProcessConsolePageParticipant { /** * ( non - Javadoc )
* @ see org . eclipse . ui . console . IConsolePageParticipant # deactivated ( ) */
public void deactivated ( ) { } } | // remove EOF submissions
IPageSite site = fPage . getSite ( ) ; IHandlerService handlerService = ( IHandlerService ) site . getService ( IHandlerService . class ) ; IContextService contextService = ( IContextService ) site . getService ( IContextService . class ) ; handlerService . deactivateHandler ( fActivatedHandler ) ; contextService . deactivateContext ( fActivatedContext ) ; fActivatedContext = null ; fActivatedHandler = null ; |
public class PTXImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . PTX__CS : return getCS ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class SqlSelectStatement { /** * Return the Fields to be selected .
* @ return the Fields to be selected */
protected FieldDescriptor [ ] getFieldsForSelect ( ) { } } | if ( fieldsForSelect == null || fieldsForSelect . get ( ) == null ) { fieldsForSelect = new WeakReference ( buildFieldsForSelect ( getSearchClassDescriptor ( ) ) ) ; } return ( FieldDescriptor [ ] ) fieldsForSelect . get ( ) ; |
public class GlobalizationPreferences { /** * This function can be overridden by subclasses to use different heuristics .
* < b > It MUST return a ' safe ' value ,
* one whose modification will not affect this object . < / b >
* @ param dateStyle
* @ param timeStyle
* @ hide draft / provisional / internal are hidden on Android */
protected DateFormat guessDateFormat ( int dateStyle , int timeStyle ) { } } | DateFormat result ; ULocale dfLocale = getAvailableLocale ( TYPE_DATEFORMAT ) ; if ( dfLocale == null ) { dfLocale = ULocale . ROOT ; } if ( timeStyle == DF_NONE ) { result = DateFormat . getDateInstance ( getCalendar ( ) , dateStyle , dfLocale ) ; } else if ( dateStyle == DF_NONE ) { result = DateFormat . getTimeInstance ( getCalendar ( ) , timeStyle , dfLocale ) ; } else { result = DateFormat . getDateTimeInstance ( getCalendar ( ) , dateStyle , timeStyle , dfLocale ) ; } return result ; |
public class JsonReader { /** * Simple JSON parse method taking only the most basic parameters .
* @ param aReader
* The reader to read from . Should be buffered . May not be
* < code > null < / code > .
* @ param aParserHandler
* The parser handler . May not be < code > null < / code > .
* @ return { @ link ESuccess } */
@ Nonnull public static ESuccess parseJson ( @ Nonnull @ WillClose final Reader aReader , @ Nonnull final IJsonParserHandler aParserHandler ) { } } | return parseJson ( aReader , aParserHandler , ( IJsonParserCustomizeCallback ) null , ( IJsonParseExceptionCallback ) null ) ; |
public class Plane4d { /** * Set this pane with the given factors .
* @ param a is the first factor of the plane equation .
* @ param b is the first factor of the plane equation .
* @ param c is the first factor of the plane equation .
* @ param d is the first factor of the plane equation . */
public void set ( double a , double b , double c , double d ) { } } | this . aProperty . set ( a ) ; this . bProperty . set ( b ) ; this . cProperty . set ( c ) ; this . dProperty . set ( d ) ; clearBufferedValues ( ) ; |
public class ReferenceCountedOpenSslEngine { /** * { @ inheritDoc }
* TLS doesn ' t support a way to advertise non - contiguous versions from the client ' s perspective , and the client
* just advertises the max supported version . The TLS protocol also doesn ' t support all different combinations of
* discrete protocols , and instead assumes contiguous ranges . OpenSSL has some unexpected behavior
* ( e . g . handshake failures ) if non - contiguous protocols are used even where there is a compatible set of protocols
* and ciphers . For these reasons this method will determine the minimum protocol and the maximum protocol and
* enabled a contiguous range from [ min protocol , max protocol ] in OpenSSL . */
@ Override public final void setEnabledProtocols ( String [ ] protocols ) { } } | if ( protocols == null ) { // This is correct from the API docs
throw new IllegalArgumentException ( ) ; } int minProtocolIndex = OPENSSL_OP_NO_PROTOCOLS . length ; int maxProtocolIndex = 0 ; for ( String p : protocols ) { if ( ! OpenSsl . SUPPORTED_PROTOCOLS_SET . contains ( p ) ) { throw new IllegalArgumentException ( "Protocol " + p + " is not supported." ) ; } if ( p . equals ( PROTOCOL_SSL_V2 ) ) { if ( minProtocolIndex > OPENSSL_OP_NO_PROTOCOL_INDEX_SSLV2 ) { minProtocolIndex = OPENSSL_OP_NO_PROTOCOL_INDEX_SSLV2 ; } if ( maxProtocolIndex < OPENSSL_OP_NO_PROTOCOL_INDEX_SSLV2 ) { maxProtocolIndex = OPENSSL_OP_NO_PROTOCOL_INDEX_SSLV2 ; } } else if ( p . equals ( PROTOCOL_SSL_V3 ) ) { if ( minProtocolIndex > OPENSSL_OP_NO_PROTOCOL_INDEX_SSLV3 ) { minProtocolIndex = OPENSSL_OP_NO_PROTOCOL_INDEX_SSLV3 ; } if ( maxProtocolIndex < OPENSSL_OP_NO_PROTOCOL_INDEX_SSLV3 ) { maxProtocolIndex = OPENSSL_OP_NO_PROTOCOL_INDEX_SSLV3 ; } } else if ( p . equals ( PROTOCOL_TLS_V1 ) ) { if ( minProtocolIndex > OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1 ) { minProtocolIndex = OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1 ; } if ( maxProtocolIndex < OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1 ) { maxProtocolIndex = OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1 ; } } else if ( p . equals ( PROTOCOL_TLS_V1_1 ) ) { if ( minProtocolIndex > OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_1 ) { minProtocolIndex = OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_1 ; } if ( maxProtocolIndex < OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_1 ) { maxProtocolIndex = OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_1 ; } } else if ( p . equals ( PROTOCOL_TLS_V1_2 ) ) { if ( minProtocolIndex > OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_2 ) { minProtocolIndex = OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_2 ; } if ( maxProtocolIndex < OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_2 ) { maxProtocolIndex = OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_2 ; } } else if ( p . equals ( PROTOCOL_TLS_V1_3 ) ) { if ( minProtocolIndex > OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_3 ) { minProtocolIndex = OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_3 ; } if ( maxProtocolIndex < OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_3 ) { maxProtocolIndex = OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_3 ; } } } synchronized ( this ) { if ( ! isDestroyed ( ) ) { // Clear out options which disable protocols
SSL . clearOptions ( ssl , SSL . SSL_OP_NO_SSLv2 | SSL . SSL_OP_NO_SSLv3 | SSL . SSL_OP_NO_TLSv1 | SSL . SSL_OP_NO_TLSv1_1 | SSL . SSL_OP_NO_TLSv1_2 | SSL . SSL_OP_NO_TLSv1_3 ) ; int opts = 0 ; for ( int i = 0 ; i < minProtocolIndex ; ++ i ) { opts |= OPENSSL_OP_NO_PROTOCOLS [ i ] ; } assert maxProtocolIndex != MAX_VALUE ; for ( int i = maxProtocolIndex + 1 ; i < OPENSSL_OP_NO_PROTOCOLS . length ; ++ i ) { opts |= OPENSSL_OP_NO_PROTOCOLS [ i ] ; } // Disable protocols we do not want
SSL . setOptions ( ssl , opts ) ; } else { throw new IllegalStateException ( "failed to enable protocols: " + Arrays . asList ( protocols ) ) ; } } |
public class RNAUtils { /** * method to generate the natural analogue sequence of a rna / dna of a given
* polymer
* @ param polymer
* PolymerNotation
* @ return sequence natural analogue sequence
* @ throws HELM2HandledException
* if the polymer contains HELM2 features
* @ throws RNAUtilsException
* if the polymer is not RNA or DNA
* @ throws ChemistryException
* if the Chemistry Engine can not be initialized */
public static String getNaturalAnalogSequence ( PolymerNotation polymer ) throws HELM2HandledException , RNAUtilsException , ChemistryException { } } | checkRNA ( polymer ) ; return FastaFormat . generateFastaFromRNA ( MethodsMonomerUtils . getListOfHandledMonomers ( polymer . getPolymerElements ( ) . getListOfElements ( ) ) ) ; |
public class WebSiteManagementClientImpl { /** * Gets a list of meters for a given location .
* Gets a list of meters for a given location .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; BillingMeterInner & gt ; object */
public Observable < Page < BillingMeterInner > > listBillingMetersNextAsync ( final String nextPageLink ) { } } | return listBillingMetersNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < BillingMeterInner > > , Page < BillingMeterInner > > ( ) { @ Override public Page < BillingMeterInner > call ( ServiceResponse < Page < BillingMeterInner > > response ) { return response . body ( ) ; } } ) ; |
public class DBEntitySequenceFactory { /** * / * ( non - Javadoc )
* @ see com . dell . doradus . search . aggregate . EntitySequenceFactory # getSequence ( com . dell . doradus . common . TableDefinition , java . lang . Iterable ) */
@ Override public < T > EntitySequence getSequence ( TableDefinition tableDef , Iterable < T > collection ) { } } | return getSequence ( tableDef , collection , null , null ) ; |
public class AbstractMessage { /** * / * ( non - Javadoc )
* @ see javax . jms . Message # setJMSRedelivered ( boolean ) */
@ Override public final void setJMSRedelivered ( boolean redelivered ) { } } | this . redelivered = redelivered ; // Update raw cache accordingly
if ( rawMessage != null ) { byte flags = rawMessage . readByte ( 1 ) ; if ( redelivered ) flags = ( byte ) ( flags | ( 1 << 4 ) ) ; else flags = ( byte ) ( flags & ~ ( 1 << 4 ) ) ; rawMessage . writeByte ( flags , 1 ) ; } |
public class IOUtils { /** * Returns whether the given file is a symbolic link .
* @ since 1.16 */
public static boolean isSymbolicLink ( File file ) throws IOException { } } | // first try using Java 7
try { // use reflection here
Class < ? > filesClass = Class . forName ( "java.nio.file.Files" ) ; Class < ? > pathClass = Class . forName ( "java.nio.file.Path" ) ; Object path = File . class . getMethod ( "toPath" ) . invoke ( file ) ; return ( ( Boolean ) filesClass . getMethod ( "isSymbolicLink" , pathClass ) . invoke ( null , path ) ) . booleanValue ( ) ; } catch ( InvocationTargetException exception ) { Throwable cause = exception . getCause ( ) ; Throwables . propagateIfPossible ( cause , IOException . class ) ; // shouldn ' t reach this point , but just in case . . .
throw new RuntimeException ( cause ) ; } catch ( ClassNotFoundException exception ) { // handled below
} catch ( IllegalArgumentException exception ) { // handled below
} catch ( SecurityException exception ) { // handled below
} catch ( IllegalAccessException exception ) { // handled below
} catch ( NoSuchMethodException exception ) { // handled below
} // backup option compatible with earlier Java
// this won ' t work on Windows , which is where separator char is ' \ \ '
if ( File . separatorChar == '\\' ) { return false ; } File canonical = file ; if ( file . getParent ( ) != null ) { canonical = new File ( file . getParentFile ( ) . getCanonicalFile ( ) , file . getName ( ) ) ; } return ! canonical . getCanonicalFile ( ) . equals ( canonical . getAbsoluteFile ( ) ) ; |
public class Acceptor { /** * parse
* Note : I ' m processing by index to avoid lots of memory creation , which speeds things
* up for this time critical section of code .
* @ param code
* @ param cntnt
* @ return */
protected boolean parse ( HttpCode < TRANS , ? > code , String cntnt ) { } } | byte bytes [ ] = cntnt . getBytes ( ) ; int cis , cie = - 1 , cend ; int sis , sie , send ; String name ; ArrayList < String > props = new ArrayList < String > ( ) ; do { // Clear these in case more than one Semi
props . clear ( ) ; // on loop , do not want mixed properties
name = null ; cis = cie + 1 ; // find comma start
while ( cis < bytes . length && Character . isSpaceChar ( bytes [ cis ] ) ) ++ cis ; cie = cntnt . indexOf ( ',' , cis ) ; // find comma end
cend = cie < 0 ? bytes . length : cie ; // If no comma , set comma end to full length , else cie
while ( cend > cis && Character . isSpaceChar ( bytes [ cend - 1 ] ) ) -- cend ; // Start SEMIS
sie = cis - 1 ; do { sis = sie + 1 ; // semi start is one after previous end
while ( sis < bytes . length && Character . isSpaceChar ( bytes [ sis ] ) ) ++ sis ; sie = cntnt . indexOf ( ';' , sis ) ; send = sie > cend || sie < 0 ? cend : sie ; // if the Semicolon is after the comma , or non - existent , use comma end , else keep
while ( send > sis && Character . isSpaceChar ( bytes [ send - 1 ] ) ) -- send ; if ( name == null ) { // first entry in Comma set is the name , not a property
name = new String ( bytes , sis , send - sis ) ; } else { // We ' ve looped past the first Semi , now process as properties
// If there are additional elements ( more entities within Semi Colons )
// apply Properties
int eq = cntnt . indexOf ( '=' , sis ) ; if ( eq > sis && eq < send ) { props . add ( new String ( bytes , sis , eq - sis ) ) ; props . add ( new String ( bytes , eq + 1 , send - ( eq + 1 ) ) ) ; } } // End Property
} while ( sie <= cend && sie >= cis ) ; // End SEMI processing
// Now evaluate Comma set and return if true
if ( eval ( code , name , props ) ) return true ; // else loop again to check next comma
} while ( cie >= 0 ) ; // loop to next comma
return false ; // didn ' t get even one match |
public class Database { public List < ForwardedAttributeDatum > getForwardedAttributeInfoForDevice ( String deviceName ) throws DevFailed { } } | List < String [ ] > data = databaseDAO . getForwardedAttributeDataForDevice ( this , deviceName ) ; List < ForwardedAttributeDatum > info = new ArrayList < ForwardedAttributeDatum > ( ) ; for ( String [ ] datum : data ) { info . add ( new ForwardedAttributeDatum ( datum [ 0 ] , datum [ 1 ] , datum [ 2 ] ) ) ; } return info ; |
public class BatchDetectKeyPhrasesResult { /** * A list of objects containing the results of the operation . The results are sorted in ascending order by the
* < code > Index < / code > field and match the order of the documents in the input list . If all of the documents contain
* an error , the < code > ResultList < / code > is empty .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setResultList ( java . util . Collection ) } or { @ link # withResultList ( java . util . Collection ) } if you want to
* override the existing values .
* @ param resultList
* A list of objects containing the results of the operation . The results are sorted in ascending order by
* the < code > Index < / code > field and match the order of the documents in the input list . If all of the
* documents contain an error , the < code > ResultList < / code > is empty .
* @ return Returns a reference to this object so that method calls can be chained together . */
public BatchDetectKeyPhrasesResult withResultList ( BatchDetectKeyPhrasesItemResult ... resultList ) { } } | if ( this . resultList == null ) { setResultList ( new java . util . ArrayList < BatchDetectKeyPhrasesItemResult > ( resultList . length ) ) ; } for ( BatchDetectKeyPhrasesItemResult ele : resultList ) { this . resultList . add ( ele ) ; } return this ; |
public class Streamables { /** * Writes the given { @ link ByteBuffer } into the given { @ link DataOutput } .
* @ param out The { @ link DataOutput } into which the buffer will be written .
* @ param buffer The buffer to write into the { @ link DataOutput } .
* @ throws IOException */
public static void writeBuffer ( DataOutput out , ByteBuffer buffer ) throws IOException { } } | if ( buffer . hasArray ( ) ) { out . write ( buffer . array ( ) , buffer . arrayOffset ( ) + buffer . position ( ) , buffer . remaining ( ) ) ; buffer . position ( buffer . limit ( ) ) ; } else { final byte [ ] array = new byte [ buffer . remaining ( ) ] ; buffer . get ( array ) ; assert buffer . remaining ( ) == 0 && buffer . position ( ) == buffer . limit ( ) ; out . write ( array ) ; } |
public class ModuleItem { /** * refresh the stats tree to remove any stats : called when a module item is removed */
private void updateStatsTree ( ) { } } | if ( myStatsWithChildren == null ) return ; ArrayList colMembers = myStatsWithChildren . subCollections ( ) ; if ( colMembers == null ) return ; colMembers . clear ( ) ; // getStats from children
ModuleItem [ ] items = children ( ) ; if ( items != null ) { for ( int i = 0 ; i < items . length ; i ++ ) colMembers . add ( items [ i ] . getStats ( true ) ) ; } |
public class ParseHelper { /** * 判断Zealot标签中 ` match ` 中的表达式是否匹配通过 .
* @ param match match表达式
* @ param paramObj 参数上下文对象
* @ return 布尔值 */
public static boolean isMatch ( String match , Object paramObj ) { } } | return StringHelper . isBlank ( match ) || isTrue ( match , paramObj ) ; |
public class Log { /** * Print the text of a message , translating newlines appropriately
* for the platform . */
public void printRawLines ( String msg ) { } } | PrintWriter noticeWriter = writers . get ( WriterKind . NOTICE ) ; printRawLines ( noticeWriter , msg ) ; |
public class Server { /** * Queues a { @ link Packet } to all connected { @ link Client } s except the one ( s ) specified .
* < br > < br >
* No { @ link Client } will receive this { @ link Packet } until { @ link Client # flush ( ) } is called for that respective
* { @ link Client } .
* @ param < T > A { @ link Client } or any of its children .
* @ param clients A variable amount of { @ link Client } s to exclude from receiving the { @ link Packet } . */
@ SafeVarargs public final < T extends Client > void writeToAllExcept ( Packet packet , T ... clients ) { } } | writeHelper ( packet :: write , clients ) ; |
public class DataFactory { /** * Method use to get float
* @ param pAnnotation
* annotation
* @ param pBit
* bit utils
* @ return */
private static Float getFloat ( final AnnotationData pAnnotation , final BitUtils pBit ) { } } | Float ret = null ; if ( BCD_FORMAT . equals ( pAnnotation . getFormat ( ) ) ) { ret = Float . parseFloat ( pBit . getNextHexaString ( pAnnotation . getSize ( ) ) ) ; } else { ret = ( float ) getInteger ( pAnnotation , pBit ) ; } return ret ; |
public class KeyVaultClientBaseImpl { /** * Lists deleted storage accounts for the specified vault .
* The Get Deleted Storage Accounts operation returns the storage accounts that have been deleted for a vault enabled for soft - delete . This operation requires the storage / list permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param maxresults Maximum number of results to return in a page . If not specified the service will return up to 25 results .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws KeyVaultErrorException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the PagedList & lt ; DeletedStorageAccountItem & gt ; object if successful . */
public PagedList < DeletedStorageAccountItem > getDeletedStorageAccounts ( final String vaultBaseUrl , final Integer maxresults ) { } } | ServiceResponse < Page < DeletedStorageAccountItem > > response = getDeletedStorageAccountsSinglePageAsync ( vaultBaseUrl , maxresults ) . toBlocking ( ) . single ( ) ; return new PagedList < DeletedStorageAccountItem > ( response . body ( ) ) { @ Override public Page < DeletedStorageAccountItem > nextPage ( String nextPageLink ) { return getDeletedStorageAccountsNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ; |
public class RfSessionFactoryImpl { @ Override public void doRfAccountingRequestEvent ( ServerRfSession appSession , RfAccountingRequest acr ) throws InternalException , IllegalDiameterStateException , RouteException , OverloadException { } } | logger . info ( "Diameter Base RfSessionFactory :: doAccRequestEvent :: appSession[" + appSession + "], Request[" + acr + "]" ) ; |
public class MessagePactProviderRule { /** * / * ( non - Javadoc )
* @ see org . junit . rules . ExternalResource # apply ( org . junit . runners . model . Statement , org . junit . runner . Description ) */
@ Override public Statement apply ( final Statement base , final Description description ) { } } | return new Statement ( ) { @ Override public void evaluate ( ) throws Throwable { PactVerifications pactVerifications = description . getAnnotation ( PactVerifications . class ) ; if ( pactVerifications != null ) { evaluatePactVerifications ( pactVerifications , base , description ) ; return ; } PactVerification pactDef = description . getAnnotation ( PactVerification . class ) ; // no pactVerification ? execute the test normally
if ( pactDef == null ) { base . evaluate ( ) ; return ; } Message providedMessage = null ; Map < String , Message > pacts ; if ( StringUtils . isNoneEmpty ( pactDef . fragment ( ) ) ) { Optional < Method > possiblePactMethod = findPactMethod ( pactDef ) ; if ( ! possiblePactMethod . isPresent ( ) ) { base . evaluate ( ) ; return ; } pacts = new HashMap < > ( ) ; Method method = possiblePactMethod . get ( ) ; Pact pact = method . getAnnotation ( Pact . class ) ; MessagePactBuilder builder = MessagePactBuilder . consumer ( pact . consumer ( ) ) . hasPactWith ( provider ) ; messagePact = ( MessagePact ) method . invoke ( testClassInstance , builder ) ; for ( Message message : messagePact . getMessages ( ) ) { pacts . put ( message . getProviderStates ( ) . stream ( ) . map ( ProviderState :: getName ) . collect ( Collectors . joining ( ) ) , message ) ; } } else { pacts = parsePacts ( ) ; } if ( pactDef . value ( ) . length == 2 && ! pactDef . value ( ) [ 1 ] . trim ( ) . isEmpty ( ) ) { providedMessage = pacts . get ( pactDef . value ( ) [ 1 ] . trim ( ) ) ; } else if ( ! pacts . isEmpty ( ) ) { providedMessage = pacts . values ( ) . iterator ( ) . next ( ) ; } if ( providedMessage == null ) { base . evaluate ( ) ; return ; } setMessage ( providedMessage , description ) ; try { base . evaluate ( ) ; PactFolder pactFolder = testClassInstance . getClass ( ) . getAnnotation ( PactFolder . class ) ; if ( pactFolder != null ) { messagePact . write ( pactFolder . value ( ) , PactSpecVersion . V3 ) ; } else { messagePact . write ( PactConsumerConfig . INSTANCE . getPactDirectory ( ) , PactSpecVersion . V3 ) ; } } catch ( Throwable t ) { throw t ; } } } ; |
public class Annotation { /** * Returns true if the class is configured in annotation , false otherwise .
* @ param classToCheck class to check
* @ return true if the class is configured in annotation , false otherwise */
public static boolean isInheritedMapped ( Class < ? > classToCheck ) { } } | for ( Class < ? > clazz : getAllsuperClasses ( classToCheck ) ) if ( ! isNull ( clazz . getAnnotation ( JGlobalMap . class ) ) ) return true ; for ( Field field : getListOfFields ( classToCheck ) ) if ( ! isNull ( field . getAnnotation ( JMap . class ) ) ) return true ; return false ; |
public class AbstractJobStatus { /** * Stop listening to events . */
public void stopListening ( ) { } } | if ( isIsolated ( ) ) { this . loggerManager . popLogListener ( ) ; } else { this . observationManager . removeListener ( this . logListener . getName ( ) ) ; } this . observationManager . removeListener ( this . progress . getName ( ) ) ; // Make sure the progress is closed
this . progress . getRootStep ( ) . finish ( ) ; |
public class LiveData { /** * Adds the given observer to the observers list . This call is similar to
* { @ link LiveData # observe ( LifecycleOwner , Observer ) } with a LifecycleOwner , which
* is always active . This means that the given observer will receive all events and will never
* be automatically removed . You should manually call { @ link # removeObserver ( Observer ) } to stop
* observing this LiveData .
* While LiveData has one of such observers , it will be considered
* as active .
* If the observer was already added with an owner to this LiveData , LiveData throws an
* { @ link IllegalArgumentException } .
* @ param observer The observer that will receive the events */
@ MainThread public void observeForever ( @ NonNull Observer < ? super T > observer ) { } } | assertMainThread ( "observeForever" ) ; AlwaysActiveObserver wrapper = new AlwaysActiveObserver ( observer ) ; ObserverWrapper existing = mObservers . putIfAbsent ( observer , wrapper ) ; if ( existing != null && existing instanceof LiveData . LifecycleBoundObserver ) { throw new IllegalArgumentException ( "Cannot add the same observer" + " with different lifecycles" ) ; } if ( existing != null ) { return ; } wrapper . activeStateChanged ( true ) ; |
public class DataAdapterXmPrivilegedRequestContext { /** * { @ inheritDoc } */
@ Override public < T > T getValueOrDefault ( String key , Class < T > type , T defaultValue ) { } } | return data . getValueOrDefault ( key , type , defaultValue ) ; |
public class KeyVaultClientBaseImpl { /** * Retrieves information about the specified deleted certificate .
* The GetDeletedCertificate operation retrieves the deleted certificate information plus its attributes , such as retention interval , scheduled permanent deletion and the current deletion recovery level . This operation requires the certificates / get permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param certificateName The name of the certificate
* @ 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 < DeletedCertificateBundle > getDeletedCertificateAsync ( String vaultBaseUrl , String certificateName , final ServiceCallback < DeletedCertificateBundle > serviceCallback ) { } } | return ServiceFuture . fromResponse ( getDeletedCertificateWithServiceResponseAsync ( vaultBaseUrl , certificateName ) , serviceCallback ) ; |
public class DateUtils { /** * < p > Returns the number of milliseconds within the
* fragment . All datefields greater than the fragment will be ignored . < / p >
* < p > Asking the milliseconds of any date will only return the number of milliseconds
* of the current second ( resulting in a number between 0 and 999 ) . This
* method will retrieve the number of milliseconds for any fragment .
* For example , if you want to calculate the number of seconds past today ,
* your fragment is Calendar . DATE or Calendar . DAY _ OF _ YEAR . The result will
* be all seconds of the past hour ( s ) , minutes ( s ) and second ( s ) . < / p >
* < p > Valid fragments are : Calendar . YEAR , Calendar . MONTH , both
* Calendar . DAY _ OF _ YEAR and Calendar . DATE , Calendar . HOUR _ OF _ DAY ,
* Calendar . MINUTE , Calendar . SECOND and Calendar . MILLISECOND
* A fragment less than or equal to a MILLISECOND field will return 0 . < / p >
* < ul >
* < li > January 1 , 2008 7:15:10.538 with Calendar . SECOND as fragment will return 538
* ( equivalent to calendar . get ( Calendar . MILLISECOND ) ) < / li >
* < li > January 6 , 2008 7:15:10.538 with Calendar . SECOND as fragment will return 538
* ( equivalent to calendar . get ( Calendar . MILLISECOND ) ) < / li >
* < li > January 6 , 2008 7:15:10.538 with Calendar . MINUTE as fragment will return 10538
* ( 10*1000 + 538 ) < / li >
* < li > January 16 , 2008 7:15:10.538 with Calendar . MILLISECOND as fragment will return 0
* ( a millisecond cannot be split in milliseconds ) < / li >
* < / ul >
* @ param calendar the calendar to work with , not null
* @ param fragment the { @ code Calendar } field part of calendar to calculate
* @ return number of milliseconds within the fragment of date
* @ throws IllegalArgumentException if the date is < code > null < / code > or
* fragment is not supported
* @ since 2.4 */
@ GwtIncompatible ( "incompatible method" ) public static long getFragmentInMilliseconds ( final Calendar calendar , final int fragment ) { } } | return getFragment ( calendar , fragment , TimeUnit . MILLISECONDS ) ; |
public class SimpleExcerptProvider { /** * { @ inheritDoc } */
public String getExcerpt ( String id , int maxFragments , int maxFragmentSize ) throws IOException { } } | StringBuilder text = new StringBuilder ( ) ; try { ItemData node = ism . getItemData ( id ) ; String separator = "" ; List < PropertyData > childs = ism . getChildPropertiesData ( ( NodeData ) node ) ; for ( PropertyData property : childs ) { if ( property . getType ( ) == PropertyType . STRING ) { text . append ( separator ) ; separator = " ... " ; List < ValueData > values = property . getValues ( ) ; for ( int i = 0 ; i < values . size ( ) ; i ++ ) { text . append ( ValueDataUtil . getString ( values . get ( i ) ) ) ; } } } } catch ( RepositoryException e ) { // ignore
LOG . warn ( e . getLocalizedMessage ( ) ) ; } if ( text . length ( ) > maxFragmentSize ) { int lastSpace = text . lastIndexOf ( " " , maxFragmentSize ) ; if ( lastSpace != - 1 ) { text . setLength ( lastSpace ) ; } else { text . setLength ( maxFragmentSize ) ; } text . append ( " ..." ) ; } return "<excerpt><fragment>" + text . toString ( ) + "</fragment></excerpt>" ; |
public class TileDao { /** * Query for Tiles at a zoom level and column
* @ param column
* column
* @ param zoomLevel
* zoom level
* @ return tile result set */
public TileResultSet queryForTilesInColumn ( long column , long zoomLevel ) { } } | Map < String , Object > fieldValues = new HashMap < String , Object > ( ) ; fieldValues . put ( TileTable . COLUMN_TILE_COLUMN , column ) ; fieldValues . put ( TileTable . COLUMN_ZOOM_LEVEL , zoomLevel ) ; return queryForFieldValues ( fieldValues ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.