signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class MediaClient { /** * Creates a new transcoder job which converts media files in BOS buckets with specified preset . * @ param pipelineName The name of pipeline used by this job . * @ param sourceKey The key of the source media file in the bucket specified in the pipeline . * @ param targetKey The key of the target media file in the bucket specified in the pipeline . * @ param presetName The name of the preset used by this job . * @ return The newly created job ID . */ public CreateTranscodingJobResponse createTranscodingJob ( String pipelineName , String sourceKey , String targetKey , String presetName ) { } }
return createTranscodingJob ( pipelineName , sourceKey , targetKey , presetName , null , null ) ;
public class Resolve { /** * where */ Symbol ambiguityError ( Symbol m1 , Symbol m2 ) { } }
if ( ( ( m1 . flags ( ) | m2 . flags ( ) ) & CLASH ) != 0 ) { return ( m1 . flags ( ) & CLASH ) == 0 ? m1 : m2 ; } else { return new AmbiguityError ( m1 , m2 ) ; }
public class BucketTimer { /** * { @ inheritDoc } */ @ Override public void record ( long duration ) { } }
totalTime . increment ( duration ) ; min . update ( duration ) ; max . update ( duration ) ; final long [ ] buckets = bucketConfig . getBuckets ( ) ; final long bucketDuration = bucketConfig . getTimeUnit ( ) . convert ( duration , timeUnit ) ; for ( int i = 0 ; i < buckets . length ; i ++ ) { if ( bucketDuration <= buckets [ i ] ) { bucketCount [ i ] . increment ( ) ; return ; } } overflowCount . increment ( ) ;
public class Strings { /** * Turns a list of Strings into an array . * @ param coll collection of Strings * @ return never null */ public static String [ ] toArray ( Collection < String > coll ) { } }
String [ ] ar ; ar = new String [ coll . size ( ) ] ; coll . toArray ( ar ) ; return ar ;
public class ModificationChangeConstraint { /** * Checks if any element in the set contains the term . * @ param terms changed terms * @ return true if any changed terms contains a desired substring */ private boolean termsContainDesired ( Set < String > terms ) { } }
if ( terms . isEmpty ( ) ) return false ; if ( featureSubstring . length == 0 ) return true ; for ( String term : terms ) { for ( String sub : featureSubstring ) { if ( term . contains ( sub ) ) return true ; } } return false ;
public class CSSClassManager { /** * Merge CSS classes , for example to merge two plots . * @ param other Other class to merge with * @ return success code * @ throws CSSNamingConflict If there is a naming conflict . */ public boolean mergeCSSFrom ( CSSClassManager other ) throws CSSNamingConflict { } }
for ( CSSClass clss : other . getClasses ( ) ) { this . addClass ( clss ) ; } return true ;
public class ImageLoaderCurrent { /** * Process image with full path name * @ param in image stream * @ param v visitor * @ param numInodes number of indoes to read * @ param skipBlocks skip blocks or not * @ throws IOException if there is any error occurs */ private void processFullNameINodes ( DataInputStream in , ImageVisitor v , long numInodes , boolean skipBlocks ) throws IOException { } }
for ( long i = 0 ; i < numInodes ; i ++ ) { processINode ( in , v , skipBlocks , null ) ; }
public class M3U8Utils { /** * If the URL follows the following structure it will be used to generate * MP4 URLS from it . < br > * This structure is needed : * < code > http : / / adaptiv . wdr . de / i / medp / [ region ] / [ fsk ] / [ unkownNumber ] / [ videoId ] / , [ Qualitie 01 ] , [ Qualitie 02 ] , [ Qualitie . . . ] , . mp4 . csmil / master . m3u8 < / code > < br > * @ param aWDRM3U8Url * The M3U8 URL . * @ return A Map containing the URLs and Qualities which was found . An empty * Map if nothing was found . */ public static Map < Qualities , String > gatherUrlsFromWdrM3U8 ( String aWDRM3U8Url ) { } }
Map < Qualities , String > urlAndQualities = new EnumMap < > ( Qualities . class ) ; if ( aWDRM3U8Url . contains ( M3U8_WDR_URL_BEGIN ) || aWDRM3U8Url . contains ( M3U8_WDR_URL_ALTERNATIV_BEGIN ) ) { String m3u8Url = aWDRM3U8Url . replaceAll ( REGEX_ALL_BEFORE_PATTERN + M3U8_WDR_URL_BEGIN , "" ) . replaceAll ( REGEX_ALL_BEFORE_PATTERN + M3U8_WDR_URL_ALTERNATIV_BEGIN , "" ) ; urlAndQualities . putAll ( convertM3U8Url ( m3u8Url ) ) ; } return urlAndQualities ;
public class InsertBuilder { /** * Inserts a column name , value pair into the SQL . * @ param column * Name of the table column . * @ param value * Value to substitute in . InsertBuilder does * no * interpretation * of this . If you want a string constant inserted , you must * provide the single quotes and escape the internal quotes . It * is more common to use a question mark or a token in the style * of { @ link ParameterizedPreparedStatementCreator } , e . g . " : foo " . */ public InsertBuilder set ( String column , String value ) { } }
columns . add ( column ) ; values . add ( value ) ; return this ;
public class BrowserMobProxyHandler { /** * Copied from original SeleniumProxyHandler * Changed SslRelay to SslListener and getSslRelayOrCreateNew to getSslRelayOrCreateNewOdo * No other changes to the function * @ param pathInContext * @ param pathParams * @ param request * @ param response * @ throws HttpException * @ throws IOException */ public void handleConnectOriginal ( String pathInContext , String pathParams , HttpRequest request , HttpResponse response ) throws HttpException , IOException { } }
URI uri = request . getURI ( ) ; try { LOG . fine ( "CONNECT: " + uri ) ; InetAddrPort addrPort ; // When logging , we ' ll attempt to send messages to hosts that don ' t exist if ( uri . toString ( ) . endsWith ( ".selenium.doesnotexist:443" ) ) { // so we have to do set the host to be localhost ( you can ' t new up an IAP with a non - existent hostname ) addrPort = new InetAddrPort ( 443 ) ; } else { addrPort = new InetAddrPort ( uri . toString ( ) ) ; } if ( isForbidden ( HttpMessage . __SSL_SCHEME , addrPort . getHost ( ) , addrPort . getPort ( ) , false ) ) { sendForbid ( request , response , uri ) ; } else { HttpConnection http_connection = request . getHttpConnection ( ) ; http_connection . forceClose ( ) ; HttpServer server = http_connection . getHttpServer ( ) ; SslListener listener = getSslRelayOrCreateNewOdo ( uri , addrPort , server ) ; int port = listener . getPort ( ) ; // Get the timeout int timeoutMs = 30000 ; Object maybesocket = http_connection . getConnection ( ) ; if ( maybesocket instanceof Socket ) { Socket s = ( Socket ) maybesocket ; timeoutMs = s . getSoTimeout ( ) ; } // Create the tunnel HttpTunnel tunnel = newHttpTunnel ( request , response , InetAddress . getByName ( null ) , port , timeoutMs ) ; if ( tunnel != null ) { // TODO - need to setup semi - busy loop for IE . if ( _tunnelTimeoutMs > 0 ) { tunnel . getSocket ( ) . setSoTimeout ( _tunnelTimeoutMs ) ; if ( maybesocket instanceof Socket ) { Socket s = ( Socket ) maybesocket ; s . setSoTimeout ( _tunnelTimeoutMs ) ; } } tunnel . setTimeoutMs ( timeoutMs ) ; customizeConnection ( pathInContext , pathParams , request , tunnel . getSocket ( ) ) ; request . getHttpConnection ( ) . setHttpTunnel ( tunnel ) ; response . setStatus ( HttpResponse . __200_OK ) ; response . setContentLength ( 0 ) ; } request . setHandled ( true ) ; } } catch ( Exception e ) { LOG . fine ( "error during handleConnect" , e ) ; response . sendError ( HttpResponse . __500_Internal_Server_Error , e . toString ( ) ) ; }
public class CertificatesImpl { /** * Lists all of the certificates that have been added to the specified account . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the PagedList & lt ; Certificate & gt ; object wrapped in { @ link ServiceResponseWithHeaders } if successful . */ public Observable < ServiceResponseWithHeaders < Page < Certificate > , CertificateListHeaders > > listSinglePageAsync ( ) { } }
if ( this . client . batchUrl ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.batchUrl() is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } final CertificateListOptions certificateListOptions = null ; String filter = null ; String select = null ; Integer maxResults = null ; Integer timeout = null ; UUID clientRequestId = null ; Boolean returnClientRequestId = null ; DateTime ocpDate = null ; String parameterizedHost = Joiner . on ( ", " ) . join ( "{batchUrl}" , this . client . batchUrl ( ) ) ; DateTimeRfc1123 ocpDateConverted = null ; if ( ocpDate != null ) { ocpDateConverted = new DateTimeRfc1123 ( ocpDate ) ; } return service . list ( this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , filter , select , maxResults , timeout , clientRequestId , returnClientRequestId , ocpDateConverted , parameterizedHost , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponseWithHeaders < Page < Certificate > , CertificateListHeaders > > > ( ) { @ Override public Observable < ServiceResponseWithHeaders < Page < Certificate > , CertificateListHeaders > > call ( Response < ResponseBody > response ) { try { ServiceResponseWithHeaders < PageImpl < Certificate > , CertificateListHeaders > result = listDelegate ( response ) ; return Observable . just ( new ServiceResponseWithHeaders < Page < Certificate > , CertificateListHeaders > ( result . body ( ) , result . headers ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class ConfigProto { /** * Use { @ link # getDeviceCountMap ( ) } instead . */ @ java . lang . Deprecated public java . util . Map < java . lang . String , java . lang . Integer > getDeviceCount ( ) { } }
return getDeviceCountMap ( ) ;
public class TouchActions { /** * Allows the execution of flick gestures starting in a location ' s element . * @ param onElement The { @ link WebElement } to flick on * @ param xOffset The x offset relative to the viewport * @ param yOffset The y offset relative to the viewport * @ param speed speed to flick , 0 = normal , 1 = fast , 2 = slow * @ return self */ public TouchActions flick ( WebElement onElement , int xOffset , int yOffset , int speed ) { } }
if ( touchScreen != null ) { action . addAction ( new FlickAction ( touchScreen , ( Locatable ) onElement , xOffset , yOffset , speed ) ) ; } return this ;
public class SslContext { /** * Build a { @ link TrustManagerFactory } from a certificate chain file . * @ param certChainFile The certificate file to build from . * @ param trustManagerFactory The existing { @ link TrustManagerFactory } that will be used if not { @ code null } . * @ return A { @ link TrustManagerFactory } which contains the certificates in { @ code certChainFile } */ @ Deprecated protected static TrustManagerFactory buildTrustManagerFactory ( File certChainFile , TrustManagerFactory trustManagerFactory ) throws NoSuchAlgorithmException , CertificateException , KeyStoreException , IOException { } }
X509Certificate [ ] x509Certs = toX509Certificates ( certChainFile ) ; return buildTrustManagerFactory ( x509Certs , trustManagerFactory ) ;
public class Filters { /** * The Channel to use as a filter for the metrics returned . Only VOICE is supported . * @ param channels * The Channel to use as a filter for the metrics returned . Only VOICE is supported . * @ return Returns a reference to this object so that method calls can be chained together . * @ see Channel */ public Filters withChannels ( Channel ... channels ) { } }
java . util . ArrayList < String > channelsCopy = new java . util . ArrayList < String > ( channels . length ) ; for ( Channel value : channels ) { channelsCopy . add ( value . toString ( ) ) ; } if ( getChannels ( ) == null ) { setChannels ( channelsCopy ) ; } else { getChannels ( ) . addAll ( channelsCopy ) ; } return this ;
public class AbstractTTTLearner { /** * Private helper methods . */ @ Override public void startLearning ( ) { } }
if ( hypothesis . isInitialized ( ) ) { throw new IllegalStateException ( ) ; } TTTState < I , D > init = hypothesis . initialize ( ) ; AbstractBaseDTNode < I , D > initNode = dtree . sift ( init . getAccessSequence ( ) , false ) ; link ( initNode , init ) ; initializeState ( init ) ; closeTransitions ( ) ;
public class CircularImageView { /** * Draws the checked state . * @ param canvas * @ param w * @ param h */ protected void drawCheckedState ( Canvas canvas , int w , int h ) { } }
int x = w / 2 ; int y = h / 2 ; canvas . drawCircle ( x , y , mRadius - ( mShadowRadius * 1.5f ) , mCheckedBackgroundPaint ) ; canvas . save ( ) ; int shortStrokeHeight = ( int ) ( mLongStrokeHeight * .4f ) ; int halfH = ( int ) ( mLongStrokeHeight * .5f ) ; int offset = ( int ) ( shortStrokeHeight * .3f ) ; int sx = x + offset ; int sy = y - offset ; mPath . reset ( ) ; mPath . moveTo ( sx , sy - halfH ) ; mPath . lineTo ( sx , sy + halfH ) ; // draw long stroke mPath . moveTo ( sx + ( getCheckMarkStrokeWidthInPixels ( ) * .5f ) , sy + halfH ) ; mPath . lineTo ( sx - shortStrokeHeight , sy + halfH ) ; // draw short stroke // Rotates the canvas to draw an angled check mark canvas . rotate ( 45f , x , y ) ; canvas . drawPath ( mPath , mCheckMarkPaint ) ; // Restore the canvas to previously saved state canvas . restore ( ) ;
public class ExtractingParseObserver { /** * ALL ASSIST METHODS / CLASSES BELOW HERE : */ private static String makePath ( String tag , String attr ) { } }
StringBuilder sb = new StringBuilder ( tag . length ( ) + PATH_SEPARATOR . length ( ) + attr . length ( ) ) ; return sb . append ( tag ) . append ( PATH_SEPARATOR ) . append ( attr ) . toString ( ) ;
public class ContentSpecValidator { /** * Validates a topic against the database and for formatting issues . * @ param specTopic The topic to be validated . * @ param specTopics The list of topics that exist within the content specification . * @ param processedFixedUrls * @ param bookType The type of book the topic is to be validated against . * @ param contentSpec The content spec the topic belongs to . @ return True if the topic is valid otherwise false . */ public boolean preValidateTopic ( final SpecTopic specTopic , final Map < String , SpecTopic > specTopics , final Set < String > processedFixedUrls , final BookType bookType , final ContentSpec contentSpec ) { } }
return preValidateTopic ( specTopic , specTopics , processedFixedUrls , bookType , true , contentSpec ) ;
public class WhitesourceService { /** * Gets vulnerabilities data for given dependencies . * @ param orgToken Organization token uniquely identifying the account at white source . * @ param product The product name or token to update . * @ param productVersion The product version . * @ param projectInfos OSS usage information to send to white source . * @ param userKey user key uniquely identifying the account at white source . * @ param requesterEmail Email of the WhiteSource user that requests to update WhiteSource . * @ return Vulnerabilities for given dependencies . * @ throws WssServiceException */ @ Deprecated public CheckVulnerabilitiesResult checkVulnerabilities ( String orgToken , String product , String productVersion , Collection < AgentProjectInfo > projectInfos , String userKey , String requesterEmail , String productToken ) throws WssServiceException { } }
return client . checkVulnerabilities ( requestFactory . newCheckVulnerabilitiesRequest ( orgToken , product , productVersion , projectInfos , userKey , requesterEmail , productToken ) ) ;
public class ModelHelper { /** * 通过注解获取表名称 * @ param pClazz * @ return */ public static String getTableName ( Class < ? > pClazz ) { } }
Table table = pClazz . getAnnotation ( Table . class ) ; if ( null != table ) { return table . name ( ) ; } else if ( ! Object . class . equals ( pClazz . getSuperclass ( ) ) ) { return getTableName ( pClazz . getSuperclass ( ) ) ; } return StringUtil . EMPTY_STRING ;
public class RandomDateUtils { /** * Returns a random { @ link Year } that is before the given { @ link RandomDateUtils # MIN _ INSTANT } . * @ param before the value that returned { @ link Year } must be before * @ return the random { @ link Year } * @ throws IllegalArgumentException if before is less than or equal to 1970 */ public static Year randomYearBefore ( int before ) { } }
checkArgument ( before > MIN_YEAR , "Before must be after %s" , MIN_YEAR ) ; return Year . of ( RandomUtils . nextInt ( MIN_YEAR , before ) ) ;
public class SButtonBox { /** * Set this control ' s converter to this HTML param . * ie . , Check to see if this button was pressed . */ public int setSFieldValue ( String strParamValue , boolean bDisplayOption , int iMoveMode ) { } }
String strButtonDesc = this . getButtonDesc ( ) ; String strButtonCommand = this . getButtonCommand ( ) ; if ( strButtonCommand != null ) if ( strButtonDesc != null ) if ( strButtonDesc . equals ( strParamValue ) ) { // Button was pressed , do command this . handleCommand ( strButtonCommand , this , ScreenConstants . USE_NEW_WINDOW ) ; return DBConstants . NORMAL_RETURN ; } // Often this is called in a report needing a value set , so set it : return super . setSFieldValue ( strParamValue , bDisplayOption , iMoveMode ) ;
public class OSMTablesFactory { /** * Store all relation members * @ param connection * @ param relationMemberTable * @ return * @ throws SQLException */ public static PreparedStatement createRelationMemberTable ( Connection connection , String relationMemberTable ) throws SQLException { } }
try ( Statement stmt = connection . createStatement ( ) ) { StringBuilder sb = new StringBuilder ( "CREATE TABLE " ) ; sb . append ( relationMemberTable ) ; sb . append ( "(ID_RELATION BIGINT, ID_SUB_RELATION BIGINT, ROLE VARCHAR, RELATION_ORDER INT);" ) ; stmt . execute ( sb . toString ( ) ) ; } return connection . prepareStatement ( "INSERT INTO " + relationMemberTable + " VALUES ( ?,?,?,?);" ) ;
public class ElasticJoinProducer { /** * Inherit the per partition txnid from the long since gone * partition that existed in the past */ private long [ ] fetchPerPartitionTxnId ( ) { } }
ZooKeeper zk = VoltDB . instance ( ) . getHostMessenger ( ) . getZK ( ) ; byte partitionTxnIdsBytes [ ] = null ; try { partitionTxnIdsBytes = zk . getData ( VoltZK . perPartitionTxnIds , false , null ) ; } catch ( KeeperException . NoNodeException e ) { return null ; } // Can be no node if the cluster was never restored catch ( Exception e ) { VoltDB . crashLocalVoltDB ( "Error retrieving per partition txn ids" , true , e ) ; } ByteBuffer buf = ByteBuffer . wrap ( partitionTxnIdsBytes ) ; int count = buf . getInt ( ) ; Long partitionTxnId = null ; long partitionTxnIds [ ] = new long [ count ] ; for ( int ii = 0 ; ii < count ; ii ++ ) { long txnId = buf . getLong ( ) ; partitionTxnIds [ ii ] = txnId ; int partitionId = TxnEgo . getPartitionId ( txnId ) ; if ( partitionId == m_partitionId ) { partitionTxnId = txnId ; continue ; } } if ( partitionTxnId != null ) { return partitionTxnIds ; } return null ;
public class TelegramBot { /** * This allows you to edit the text of an inline message you have sent previously . ( The inline message must have an * InlineReplyMarkup object attached in order to be editable ) * @ param inlineMessageId The ID of the inline message you want to edit * @ param text The new text you want to display * @ param parseMode The ParseMode that should be used with this new text * @ param disableWebPagePreview Whether any URLs should be displayed with a preview of their content * @ param inlineReplyMarkup Any InlineReplyMarkup object you want to edit into the message * @ return True if the edit succeeded , otherwise false */ public boolean editInlineMessageText ( String inlineMessageId , String text , ParseMode parseMode , boolean disableWebPagePreview , InlineReplyMarkup inlineReplyMarkup ) { } }
if ( inlineMessageId != null && text != null ) { JSONObject jsonResponse = this . editMessageText ( null , null , inlineMessageId , text , parseMode , disableWebPagePreview , inlineReplyMarkup ) ; if ( jsonResponse != null ) { if ( jsonResponse . getBoolean ( "result" ) ) return true ; } } return false ;
public class BeanDefinitionParserUtils { /** * Sets the property reference on bean definition in case reference * is set properly . * @ param builder the bean definition builder to be configured * @ param beanReference bean reference to populate the property * @ param propertyName the name of the property */ public static void setPropertyReference ( BeanDefinitionBuilder builder , String beanReference , String propertyName ) { } }
if ( StringUtils . hasText ( beanReference ) ) { builder . addPropertyReference ( propertyName , beanReference ) ; }
public class AtomicGrowingSparseMatrix { /** * Returns an immutable view of the row ' s data as a non - atomic vector , which * may present an inconsistent view of the data if this matrix is being * concurrently modified . This method should only be used in special cases * where the vector is being accessed at a time when the matrix ( or this * particular row ) will not be modified . * @ param row the row whose values should be returned * @ return an unsafe , non - atomic view of the row ' s data */ public SparseDoubleVector getRowVectorUnsafe ( int row ) { } }
AtomicSparseVector rowEntry = sparseMatrix . get ( row ) ; return ( rowEntry == null ) ? new CompactSparseVector ( cols . get ( ) ) : Vectors . immutable ( Vectors . subview ( rowEntry . getVector ( ) , 0 , cols . get ( ) ) ) ;
public class GeometryUtils { /** * Calculate the normal of a surface defined by points < code > ( v1X , v1Y , v1Z ) < / code > , < code > ( v2X , v2Y , v2Z ) < / code > and < code > ( v3X , v3Y , v3Z ) < / code > * and store it in < code > dest < / code > . * @ param v0X * the x coordinate of the first position * @ param v0Y * the y coordinate of the first position * @ param v0Z * the z coordinate of the first position * @ param v1X * the x coordinate of the second position * @ param v1Y * the y coordinate of the second position * @ param v1Z * the z coordinate of the second position * @ param v2X * the x coordinate of the third position * @ param v2Y * the y coordinate of the third position * @ param v2Z * the z coordinate of the third position * @ param dest * will hold the result */ public static void normal ( float v0X , float v0Y , float v0Z , float v1X , float v1Y , float v1Z , float v2X , float v2Y , float v2Z , Vector3f dest ) { } }
dest . x = ( ( v1Y - v0Y ) * ( v2Z - v0Z ) ) - ( ( v1Z - v0Z ) * ( v2Y - v0Y ) ) ; dest . y = ( ( v1Z - v0Z ) * ( v2X - v0X ) ) - ( ( v1X - v0X ) * ( v2Z - v0Z ) ) ; dest . z = ( ( v1X - v0X ) * ( v2Y - v0Y ) ) - ( ( v1Y - v0Y ) * ( v2X - v0X ) ) ; dest . normalize ( ) ;
public class autoscaleaction { /** * Use this API to add autoscaleaction resources . */ public static base_responses add ( nitro_service client , autoscaleaction resources [ ] ) throws Exception { } }
base_responses result = null ; if ( resources != null && resources . length > 0 ) { autoscaleaction addresources [ ] = new autoscaleaction [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { addresources [ i ] = new autoscaleaction ( ) ; addresources [ i ] . name = resources [ i ] . name ; addresources [ i ] . type = resources [ i ] . type ; addresources [ i ] . profilename = resources [ i ] . profilename ; addresources [ i ] . parameters = resources [ i ] . parameters ; addresources [ i ] . vmdestroygraceperiod = resources [ i ] . vmdestroygraceperiod ; addresources [ i ] . quiettime = resources [ i ] . quiettime ; addresources [ i ] . vserver = resources [ i ] . vserver ; } result = add_bulk_request ( client , addresources ) ; } return result ;
public class Spans { /** * Attempts to get a { @ link Span } facet from the given object , if it * supports { @ link SpanProvider # currentSpan ( ) } . * @ param spanProvider may be null . * @ return null if there ' s not a current span supporting * { @ code spanFacetType } . */ public static < T > T currentSpan ( Class < T > spanFacetType , Object spanProvider ) { } }
Span span = currentSpan ( spanProvider ) ; T spanFacet = asFacet ( spanFacetType , span ) ; return spanFacet ;
public class CoverageDataCore { /** * Get the Bilinear Interpolation coverage data value * @ param offsetX * x source pixel offset * @ param offsetY * y source pixel offset * @ param minX * min x value * @ param maxX * max x value * @ param minY * min y value * @ param maxY * max y value * @ param topLeft * top left coverage value * @ param topRight * top right coverage value * @ param bottomLeft * bottom left coverage value * @ param bottomRight * bottom right coverage value * @ return coverage data value */ protected Double getBilinearInterpolationValue ( float offsetX , float offsetY , float minX , float maxX , float minY , float maxY , Double topLeft , Double topRight , Double bottomLeft , Double bottomRight ) { } }
Double value = null ; if ( topLeft != null && ( topRight != null || minX == maxX ) && ( bottomLeft != null || minY == maxY ) && ( bottomRight != null || ( minX == maxX && minY == maxY ) ) ) { float diffX = maxX - minX ; double topRow ; Double bottomRow ; if ( diffX == 0 ) { topRow = topLeft ; bottomRow = bottomLeft ; } else { float diffLeft = offsetX ; float diffRight = diffX - offsetX ; topRow = ( ( diffRight / diffX ) * topLeft ) + ( ( diffLeft / diffX ) * topRight ) ; bottomRow = ( ( diffRight / diffX ) * bottomLeft ) + ( ( diffLeft / diffX ) * bottomRight ) ; } float diffY = maxY - minY ; double result ; if ( diffY == 0 ) { result = topRow ; } else { float diffTop = offsetY ; float diffBottom = diffY - offsetY ; result = ( ( diffBottom / diffY ) * topRow ) + ( ( diffTop / diffY ) * bottomRow ) ; } value = result ; } return value ;
public class Main { /** * Logging : ERROR * @ param o The object * @ param t The throwable */ @ SuppressWarnings ( "unchecked" ) private static void error ( Object o , Throwable t ) { } }
if ( logging != null ) { try { Class < ? > clz = logging . getClass ( ) ; Method mError = clz . getMethod ( "error" , Object . class , Throwable . class ) ; mError . invoke ( logging , new Object [ ] { o , t } ) ; } catch ( Throwable th ) { // Nothing we can do } } else { if ( o != null ) System . out . println ( o . toString ( ) ) ; if ( t != null ) t . printStackTrace ( System . out ) ; }
public class Yank { /** * Executes a given INSERT SQL prepared statement . Returns the auto - increment id of the inserted * row using the default connection pool . Note : This only works when the auto - increment table * column is in the first column in the table ! * @ param sql The query to execute * @ param params The replacement parameters * @ return the auto - increment id of the inserted row , or null if no id is available */ public static Long insert ( String sql , Object [ ] params ) throws YankSQLException { } }
return insert ( YankPoolManager . DEFAULT_POOL_NAME , sql , params ) ;
public class CmsIconUtil { /** * Returns the CSS classes of the resource icon for the given resource type and filename . < p > * Use this the resource type and filename is known . < p > * @ param resourceTypeName the resource type name * @ param fileName the filename * @ param small if true , get the icon classes for the small icon , else for the biggest one available * @ return the CSS classes */ private static String getResourceIconClasses ( String resourceTypeName , String fileName , boolean small ) { } }
StringBuffer sb = new StringBuffer ( CmsGwtConstants . TYPE_ICON_CLASS ) ; sb . append ( " " ) . append ( getResourceTypeIconClass ( resourceTypeName , small ) ) . append ( " " ) . append ( getFileTypeIconClass ( resourceTypeName , fileName , small ) ) ; return sb . toString ( ) ;
public class IconAwesome { /** * Use the paid ' regular ' font of FontAwesome 5 . As a side effect , every FontAwesome icon on the same page is switched to FontAwesome 5.2.0 . By default , the icon set is the older version 4.7.0 . < P > * Usually this method is called internally by the JSF engine . */ public void setRegular ( boolean _regular ) { } }
if ( _regular ) { AddResourcesListener . setFontAwesomeVersion ( 5 , this ) ; } getStateHelper ( ) . put ( PropertyKeys . regular , _regular ) ;
public class DefaultSecurityHelper { /** * The afterGettingConnection ( ) method is used to allow * special security processing to be performed after calling * a resource adapter to get a connection . * @ param Subject subject * @ param ConnectionRequestInfo reqInfo * @ param Object credentialToken * @ return void * @ exception ResourceException */ @ Override public void afterGettingConnection ( Subject subject , ConnectionRequestInfo reqInfo , Object credentialToken ) throws ResourceException { } }
final boolean isTracingEnabled = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTracingEnabled && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "afterGettingConnection" ) ; } // Since the beforeGettingConnection never pushes the Subject // to the thread , ignore the input credToken Object and // simply return without doing anything . if ( isTracingEnabled && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "afterGettingConnection" ) ; }
public class HttpResponse { /** * 获取响应主体 * @ return String * @ throws HttpException 包装IO异常 */ public String body ( ) throws HttpException { } }
try { return HttpUtil . getString ( bodyBytes ( ) , this . charset , null == this . charsetFromResponse ) ; } catch ( IOException e ) { throw new HttpException ( e ) ; }
public class ChainImpl { /** * { @ inheritDoc } */ @ Override public List < Group > getAtomLigands ( ) { } }
List < Group > ligands = new ArrayList < > ( ) ; for ( Group g : groups ) if ( ! seqResGroups . contains ( g ) && ! g . isWater ( ) ) ligands . add ( g ) ; return ligands ;
public class Bootstrap2Dialect { /** * { @ inheritDoc } */ @ Override public Set < IProcessor > getProcessors ( ) { } }
final Set < IProcessor > processors = new HashSet < > ( ) ; processors . add ( new Bootstrap2FieldAttrProcessor ( ) ) ; processors . add ( new Bootstrap2NameAttrProcessor ( ) ) ; return processors ;
public class RESTServlet { /** * the Content - Length and a Content - Type of Text / plain . */ private void sendResponse ( HttpServletResponse servletResponse , RESTResponse restResponse ) throws IOException { } }
servletResponse . setStatus ( restResponse . getCode ( ) . getCode ( ) ) ; Map < String , String > responseHeaders = restResponse . getHeaders ( ) ; if ( responseHeaders != null ) { for ( Map . Entry < String , String > mapEntry : responseHeaders . entrySet ( ) ) { if ( mapEntry . getKey ( ) . equalsIgnoreCase ( HttpDefs . CONTENT_TYPE ) ) { servletResponse . setContentType ( mapEntry . getValue ( ) ) ; } else { servletResponse . setHeader ( mapEntry . getKey ( ) , mapEntry . getValue ( ) ) ; } } } byte [ ] bodyBytes = restResponse . getBodyBytes ( ) ; int bodyLen = bodyBytes == null ? 0 : bodyBytes . length ; servletResponse . setContentLength ( bodyLen ) ; if ( bodyLen > 0 && servletResponse . getContentType ( ) == null ) { servletResponse . setContentType ( "text/plain" ) ; } if ( bodyLen > 0 ) { servletResponse . getOutputStream ( ) . write ( restResponse . getBodyBytes ( ) ) ; }
public class StatelessBeanO { /** * Chanced EnterpriseBean to Object . d366807.1 */ @ Override public final Object preInvoke ( EJSDeployedSupport s , ContainerTx tx ) // d139352-2 throws RemoteException { } }
// If this bean is reentrant then its state is meaningless // since methods will be entering and exiting in no strict // order so don ' t bother tracking its state . if ( ! reentrant ) { setState ( POOLED , IN_METHOD ) ; } // Set isolation level to that associated with method // being invoked on this instance , and save current isolation // level so it may be restored in postInvoke . int tmp = currentIsolationLevel ; currentIsolationLevel = s . currentIsolationLevel ; s . currentIsolationLevel = tmp ; return ivEjbInstance ;
public class LocatorClientEnabler { /** * If the String argument locatorSelectionStrategy is as key in the map representing the locatorSelectionStrategies , the * corresponding strategy is selected , else it remains unchanged . * @ param locatorSelectionStrategy */ private LocatorSelectionStrategy getLocatorSelectionStrategy ( String locatorSelectionStrategy ) { } }
if ( null == locatorSelectionStrategy ) { return locatorSelectionStrategyMap . get ( DEFAULT_STRATEGY ) . getInstance ( ) ; } if ( LOG . isLoggable ( Level . FINE ) ) { LOG . log ( Level . FINE , "Strategy " + locatorSelectionStrategy + " was set for LocatorClientRegistrar." ) ; } if ( locatorSelectionStrategyMap . containsKey ( locatorSelectionStrategy ) ) { return locatorSelectionStrategyMap . get ( locatorSelectionStrategy ) . getInstance ( ) ; } else { if ( LOG . isLoggable ( Level . WARNING ) ) { LOG . log ( Level . WARNING , "LocatorSelectionStrategy " + locatorSelectionStrategy + " not registered at LocatorClientEnabler." ) ; } return locatorSelectionStrategyMap . get ( DEFAULT_STRATEGY ) . getInstance ( ) ; }
public class BorderLayoutRenderer { /** * Paints all the child components with the given constraint . * @ param children the list of potential children to paint . * @ param renderContext the RenderContext to paint to . * @ param constraint the target constraint . */ private void paintChildrenWithConstraint ( final List < Duplet < WComponent , BorderLayoutConstraint > > children , final WebXmlRenderContext renderContext , final BorderLayoutConstraint constraint ) { } }
String containingTag = null ; XmlStringBuilder xml = renderContext . getWriter ( ) ; final int size = children . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { Duplet < WComponent , BorderLayoutConstraint > child = children . get ( i ) ; if ( constraint . equals ( child . getSecond ( ) ) ) { if ( containingTag == null ) { containingTag = getTag ( constraint ) ; xml . appendTag ( containingTag ) ; } child . getFirst ( ) . paint ( renderContext ) ; } } if ( containingTag != null ) { xml . appendEndTag ( containingTag ) ; }
public class AbstractIntObjectMap { /** * Returns < tt > true < / tt > if the receiver contains the specified value . * Tests for identity . * @ return < tt > true < / tt > if the receiver contains the specified value . */ public boolean containsValue ( final Object value ) { } }
return ! forEachPair ( new IntObjectProcedure ( ) { public boolean apply ( int iterKey , Object iterValue ) { return ( value != iterValue ) ; } } ) ;
public class XSDocument { /** * if minOccurs ! = 1 * minOccurs = " $ minOccurs " * if maxOccurs ! = 1 * maxOccurs = " $ maxOccurs " */ public void occurs ( int minOccurs , int maxOccurs ) throws SAXException { } }
if ( minOccurs != 1 ) xml . addAttribute ( "minOccurs" , String . valueOf ( minOccurs ) ) ; if ( maxOccurs != 1 ) xml . addAttribute ( "maxOccurs" , maxOccurs == - 1 ? "unbounded" : String . valueOf ( maxOccurs ) ) ;
public class ASMUtil { /** * Append the call of proper extract primitive type of an boxed object . */ protected static void autoUnBoxing1 ( MethodVisitor mv , Type fieldType ) { } }
switch ( fieldType . getSort ( ) ) { case Type . BOOLEAN : mv . visitTypeInsn ( CHECKCAST , "java/lang/Boolean" ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Boolean" , "booleanValue" , "()Z" ) ; break ; case Type . BYTE : mv . visitTypeInsn ( CHECKCAST , "java/lang/Byte" ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Byte" , "byteValue" , "()B" ) ; break ; case Type . CHAR : mv . visitTypeInsn ( CHECKCAST , "java/lang/Character" ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Character" , "charValue" , "()C" ) ; break ; case Type . SHORT : mv . visitTypeInsn ( CHECKCAST , "java/lang/Short" ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Short" , "shortValue" , "()S" ) ; break ; case Type . INT : mv . visitTypeInsn ( CHECKCAST , "java/lang/Integer" ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Integer" , "intValue" , "()I" ) ; break ; case Type . FLOAT : mv . visitTypeInsn ( CHECKCAST , "java/lang/Float" ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Float" , "floatValue" , "()F" ) ; break ; case Type . LONG : mv . visitTypeInsn ( CHECKCAST , "java/lang/Long" ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Long" , "longValue" , "()J" ) ; break ; case Type . DOUBLE : mv . visitTypeInsn ( CHECKCAST , "java/lang/Double" ) ; mv . visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Double" , "doubleValue" , "()D" ) ; break ; case Type . ARRAY : mv . visitTypeInsn ( CHECKCAST , fieldType . getInternalName ( ) ) ; break ; default : mv . visitTypeInsn ( CHECKCAST , fieldType . getInternalName ( ) ) ; }
public class BpmnParse { /** * Parses the given element as conditional boundary event . * @ param element the XML element which contains the conditional event information * @ param interrupting indicates if the event is interrupting or not * @ param conditionalActivity the conditional event activity * @ return the boundary conditional event behavior which contains the condition */ public BoundaryConditionalEventActivityBehavior parseBoundaryConditionalEventDefinition ( Element element , boolean interrupting , ActivityImpl conditionalActivity ) { } }
conditionalActivity . getProperties ( ) . set ( BpmnProperties . TYPE , ActivityTypes . BOUNDARY_CONDITIONAL ) ; ConditionalEventDefinition conditionalEventDefinition = parseConditionalEventDefinition ( element , conditionalActivity ) ; conditionalEventDefinition . setInterrupting ( interrupting ) ; addEventSubscriptionDeclaration ( conditionalEventDefinition , conditionalActivity . getEventScope ( ) , element ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseBoundaryConditionalEventDefinition ( element , interrupting , conditionalActivity ) ; } return new BoundaryConditionalEventActivityBehavior ( conditionalEventDefinition ) ;
public class WhileyFileParser { /** * Skip over any empty lines . That is lines which contain only whitespace * and comments . */ private void skipEmptyLines ( ) { } }
int tmp = index ; do { tmp = skipLineSpace ( tmp ) ; if ( tmp < tokens . size ( ) && tokens . get ( tmp ) . kind != Token . Kind . NewLine ) { return ; // done } else if ( tmp >= tokens . size ( ) ) { index = tmp ; return ; // end - of - file reached } // otherwise , skip newline and continue tmp = tmp + 1 ; index = tmp ; } while ( true ) ; // deadcode
public class CxDxClientSessionImpl { /** * ( non - Javadoc ) * @ see org . jdiameter . api . cxdx . ClientCxDxSession # sendUserAuthorizationRequest ( org . jdiameter . api . cxdx . events . JUserAuthorizationRequest ) */ @ Override public void sendUserAuthorizationRequest ( JUserAuthorizationRequest request ) throws InternalException , IllegalDiameterStateException , RouteException , OverloadException { } }
send ( Event . Type . SEND_MESSAGE , request , null ) ;
public class Converter { /** * Returns an iterable that applies { @ code convert } to each element of * { @ code fromIterable } . The conversion is done lazily . * The returned iterable ' s iterator supports { @ code remove ( ) } if the input * iterator does . After a successful { @ code remove ( ) } call , * { @ code fromIterable } no longer contains the corresponding element . * @ param fromIterable * the from iterable * @ return the iterable */ public Iterable < B > convertAll ( final Iterable < ? extends A > fromIterable ) { } }
checkNotNull ( fromIterable , "fromIterable" ) ; return new Iterable < B > ( ) { @ Override public Iterator < B > iterator ( ) { return new Iterator < B > ( ) { private final Iterator < ? extends A > fromIterator = fromIterable . iterator ( ) ; @ Override public boolean hasNext ( ) { return fromIterator . hasNext ( ) ; } @ Override public B next ( ) { return convert ( fromIterator . next ( ) ) ; } @ Override public void remove ( ) { fromIterator . remove ( ) ; } } ; } } ;
public class WebStackImportSelector { /** * ( non - Javadoc ) * @ see org . springframework . context . annotation . ImportSelector # selectImports ( org . springframework . core . type . AnnotationMetadata ) */ @ Override public String [ ] selectImports ( AnnotationMetadata metadata ) { } }
Map < String , Object > attributes = metadata . getAnnotationAttributes ( EnableHypermediaSupport . class . getName ( ) ) ; // Configuration class imported but not through @ EnableHypermediaSupport if ( attributes == null ) { return new String [ 0 ] ; } WebStack [ ] stacks = ( WebStack [ ] ) attributes . get ( "stacks" ) ; if ( stacks . length == 0 ) { throw new IllegalStateException ( String . format ( WEB_STACK_MISSING , metadata . getClassName ( ) ) ) ; } return Arrays . stream ( stacks ) . filter ( WebStack :: isAvailable ) . map ( CONFIGS :: get ) . toArray ( String [ ] :: new ) ;
public class LoggingProfileContextSelector { /** * Get or create the log context based on the logging profile . * @ param loggingProfile the logging profile to get or create the log context for * @ return the log context that was found or a new log context */ protected LogContext getOrCreate ( final String loggingProfile ) { } }
LogContext result = profileContexts . get ( loggingProfile ) ; if ( result == null ) { result = LogContext . create ( ) ; final LogContext current = profileContexts . putIfAbsent ( loggingProfile , result ) ; if ( current != null ) { result = current ; } } return result ;
public class SwipeViewGroup { /** * Move all backgrounds to the edge of the Layout so they can be swiped in */ public void translateBackgrounds ( ) { } }
this . setClipChildren ( false ) ; for ( Map . Entry < SwipeDirection , View > entry : mBackgroundMap . entrySet ( ) ) { int signum = entry . getKey ( ) . isLeft ( ) ? 1 : - 1 ; entry . getValue ( ) . setTranslationX ( signum * entry . getValue ( ) . getWidth ( ) ) ; }
public class AccountHeaderBuilder { /** * a small helper to handle the selectionView * @ param on */ private void handleSelectionView ( IProfile profile , boolean on ) { } }
if ( on ) { if ( Build . VERSION . SDK_INT >= 23 ) { mAccountHeaderContainer . setForeground ( AppCompatResources . getDrawable ( mAccountHeaderContainer . getContext ( ) , mAccountHeaderTextSectionBackgroundResource ) ) ; } else { // todo foreground thing ? } mAccountHeaderContainer . setOnClickListener ( onSelectionClickListener ) ; mAccountHeaderContainer . setTag ( R . id . material_drawer_profile_header , profile ) ; } else { if ( Build . VERSION . SDK_INT >= 23 ) { mAccountHeaderContainer . setForeground ( null ) ; } else { // TODO foreground reset } mAccountHeaderContainer . setOnClickListener ( null ) ; }
public class GitFlowGraphMonitor { /** * Get an edge label from the edge properties * @ param source source data node id * @ param destination destination data node id * @ param edgeName simple name of the edge ( e . g . file name without extension of the edge file ) * @ return a string label identifying the edge */ private String getEdgeId ( String source , String destination , String edgeName ) { } }
return Joiner . on ( FLOW_EDGE_LABEL_JOINER_CHAR ) . join ( source , destination , edgeName ) ;
public class ZWaveController { /** * Transmits the SerialMessage to a single Z - Wave Node . * Sets the transmission options as well . * @ param serialMessage the Serial message to send . */ public void sendData ( SerialMessage serialMessage ) { } }
if ( serialMessage . getMessageClass ( ) != SerialMessage . SerialMessageClass . SendData ) { logger . error ( String . format ( "Invalid message class %s (0x%02X) for sendData" , serialMessage . getMessageClass ( ) . getLabel ( ) , serialMessage . getMessageClass ( ) . getKey ( ) ) ) ; return ; } if ( serialMessage . getMessageType ( ) != SerialMessage . SerialMessageType . Request ) { logger . error ( "Only request messages can be sent" ) ; return ; } ZWaveNode node = this . getNode ( serialMessage . getMessageNode ( ) ) ; if ( node . getNodeStage ( ) == NodeStage . NODEBUILDINFO_DEAD ) { logger . debug ( "Node {} is dead, not sending message." , node . getNodeId ( ) ) ; return ; } if ( ! node . isListening ( ) && serialMessage . getPriority ( ) != SerialMessage . SerialMessagePriority . Low ) { ZWaveWakeUpCommandClass wakeUpCommandClass = ( ZWaveWakeUpCommandClass ) node . getCommandClass ( ZWaveCommandClass . CommandClass . WAKE_UP ) ; if ( wakeUpCommandClass != null && ! wakeUpCommandClass . isAwake ( ) ) { wakeUpCommandClass . putInWakeUpQueue ( serialMessage ) ; // it ' s a battery operated device , place in wake - up queue . return ; } } serialMessage . setTransmitOptions ( TRANSMIT_OPTION_ACK | TRANSMIT_OPTION_AUTO_ROUTE | TRANSMIT_OPTION_EXPLORE ) ; if ( ++ sentDataPointer > 0xFF ) sentDataPointer = 1 ; serialMessage . setCallbackId ( sentDataPointer ) ; logger . debug ( "Callback ID = {}" , sentDataPointer ) ; this . enqueue ( serialMessage ) ;
public class GrapesClient { /** * Send a get module request * @ param name * @ param version * @ return the targeted module * @ throws GrapesCommunicationException */ public Module getModule ( final String name , final String version ) throws GrapesCommunicationException { } }
final Client client = getClient ( ) ; final WebResource resource = client . resource ( serverURL ) . path ( RequestUtils . getModulePath ( name , version ) ) ; final ClientResponse response = resource . accept ( MediaType . APPLICATION_JSON ) . get ( ClientResponse . class ) ; client . destroy ( ) ; if ( ClientResponse . Status . OK . getStatusCode ( ) != response . getStatus ( ) ) { final String message = String . format ( FAILED_TO_GET_MODULE , "get module details" , name , version ) ; if ( LOG . isErrorEnabled ( ) ) { LOG . error ( String . format ( HTTP_STATUS_TEMPLATE_MSG , message , response . getStatus ( ) ) ) ; } throw new GrapesCommunicationException ( message , response . getStatus ( ) ) ; } return response . getEntity ( Module . class ) ;
public class FieldLengthConverter { /** * Initialize this converter . * @ param converter The next converter in the converter chain . * @ param iFakeLength The maximum field length to return . */ public void init ( Converter converter , int iFakeLength , int iMinimumLength ) { } }
super . init ( converter ) ; m_iFakeLength = iFakeLength ; m_iMinimumLength = iMinimumLength ;
public class BaseClient { /** * Get status of the API . * @ throws ExecutionException indicates an error in the HTTP backend * @ throws InterruptedException indicates an interruption during the HTTP operation * @ throws IOException indicates an error from the API response */ public String getStatus ( ) throws ExecutionException , InterruptedException , IOException { } }
return ( new FutureAPIResponse ( client . prepareGet ( apiUrl ) . execute ( getHandler ( ) ) ) ) . get ( ) . getMessage ( ) ;
public class InputMapTemplate { /** * If the given { @ link EventPattern } matches the given event type , does nothing and does not attempt * to match additional { @ code InputMap } s ( if they exist ) . */ public static < S , T extends Event , U extends T > InputMapTemplate < S , U > ignore ( EventPattern < ? super T , ? extends U > eventPattern ) { } }
return new PatternActionTemplate < > ( eventPattern , PatternActionTemplate . CONST_IGNORE ) ;
public class TcpConnection { /** * Reads the peer ' s address . First a cookie has to be sent which has to * match my own cookie , otherwise the connection will be refused */ protected Address readPeerAddress ( Socket client_sock ) throws Exception { } }
int timeout = client_sock . getSoTimeout ( ) ; client_sock . setSoTimeout ( server . peerAddressReadTimeout ( ) ) ; try { // read the cookie first byte [ ] input_cookie = new byte [ cookie . length ] ; in . readFully ( input_cookie , 0 , input_cookie . length ) ; if ( ! Arrays . equals ( cookie , input_cookie ) ) throw new SocketException ( String . format ( "%s: BaseServer.TcpConnection.readPeerAddress(): cookie sent by " + "%s:%d does not match own cookie; terminating connection" , server . localAddress ( ) , client_sock . getInetAddress ( ) , client_sock . getPort ( ) ) ) ; // then read the version short version = in . readShort ( ) ; if ( ! Version . isBinaryCompatible ( version ) ) throw new IOException ( "packet from " + client_sock . getInetAddress ( ) + ":" + client_sock . getPort ( ) + " has different version (" + Version . print ( version ) + ") from ours (" + Version . printVersion ( ) + "); discarding it" ) ; in . readShort ( ) ; // address length is only needed by NioConnection Address client_peer_addr = new IpAddress ( ) ; client_peer_addr . readFrom ( in ) ; updateLastAccessed ( ) ; return client_peer_addr ; } finally { client_sock . setSoTimeout ( timeout ) ; }
public class Flash { /** * put value to next * @ param key * @ param value */ public Object put ( Object key , Object value ) { } }
return next . put ( key , value ) ;
public class WorkspaceView { /** * This is a bit of a hack to get over a limitation in the JIDE * docking framework . When focus is regained to the workspace by * activation the currently activated document the * documentComponentActivated is not fired . This needs to be fired * when we know the workspace has become active . For some reason * it dosen ' t work when using the componentFocusGained method */ public void fireFocusGainedOnActiveComponent ( ) { } }
String documentName = contentPane . getActiveDocumentName ( ) ; if ( documentName != null ) { PageComponent component = ( PageComponent ) pageComponentMap . get ( documentName ) ; JideApplicationPage page = ( JideApplicationPage ) getActiveWindow ( ) . getPage ( ) ; page . fireFocusGained ( component ) ; }
public class Cache { /** * 根据参数 count 的值 , 移除列表中与参数 value 相等的元素 。 * count 的值可以是以下几种 : * count > 0 : 从表头开始向表尾搜索 , 移除与 value 相等的元素 , 数量为 count 。 * count < 0 : 从表尾开始向表头搜索 , 移除与 value 相等的元素 , 数量为 count 的绝对值 。 * count = 0 : 移除表中所有与 value 相等的值 。 */ public Long lrem ( Object key , long count , Object value ) { } }
Jedis jedis = getJedis ( ) ; try { return jedis . lrem ( keyToBytes ( key ) , count , valueToBytes ( value ) ) ; } finally { close ( jedis ) ; }
public class DBCluster { /** * Provides the list of instances that make up the DB cluster . * @ param dBClusterMembers * Provides the list of instances that make up the DB cluster . */ public void setDBClusterMembers ( java . util . Collection < DBClusterMember > dBClusterMembers ) { } }
if ( dBClusterMembers == null ) { this . dBClusterMembers = null ; return ; } this . dBClusterMembers = new com . amazonaws . internal . SdkInternalList < DBClusterMember > ( dBClusterMembers ) ;
public class ManagementClientAsync { /** * Creates a new subscription for a given topic in the service namespace with the given name . * See { @ link SubscriptionDescription } for default values of subscription properties . * @ param topicPath - The name of the topic relative to the service namespace base address . * @ param subscriptionName - The name of the subscription . * @ return { @ link SubscriptionDescription } of the newly created subscription . * @ throws IllegalArgumentException - Entity name is null , empty , too long or uses illegal characters . */ public CompletableFuture < SubscriptionDescription > createSubscriptionAsync ( String topicPath , String subscriptionName ) { } }
return this . createSubscriptionAsync ( new SubscriptionDescription ( topicPath , subscriptionName ) ) ;
public class FragDiscardingPennTreeReader { @ Override public Tree readTree ( ) throws IOException { } }
Tree tr = super . readTree ( ) ; while ( tr != null && tr . firstChild ( ) . value ( ) . equals ( "FRAG" ) ) { // if ( pw ! = null ) { // pw . println ( " Discarding Tree : " ) ; // tr . pennPrint ( pw ) ; tr = super . readTree ( ) ; } return tr ;
public class JSONArray { /** * Write the contents of the JSONArray as JSON text to a writer . For compactness , no whitespace is added . * Warning : This method assumes that the signalData structure is acyclical . * @ return The writer . * @ throws JSONException */ public Writer write ( Writer writer ) throws JSONException { } }
try { boolean b = false ; int len = length ( ) ; writer . write ( '[' ) ; for ( int i = 0 ; i < len ; i += 1 ) { if ( b ) { writer . write ( ',' ) ; } Object v = this . myArrayList . get ( i ) ; if ( v instanceof JSONObject ) { ( ( JSONObject ) v ) . write ( writer ) ; } else if ( v instanceof JSONArray ) { ( ( JSONArray ) v ) . write ( writer ) ; } else { writer . write ( JSONObject . valueToString ( v ) ) ; } b = true ; } writer . write ( ']' ) ; return writer ; } catch ( IOException e ) { throw new JSONException ( e ) ; }
public class Session { /** * Add a request to the list of pending * @ param req the request to add */ private void addPendingRequest ( ResourceRequestInfo req ) { } }
idToPendingRequests . put ( req . getId ( ) , req ) ; if ( req . getHosts ( ) != null && req . getHosts ( ) . size ( ) > 0 ) { Context c = getContext ( req . getType ( ) ) ; for ( RequestedNode node : req . getRequestedNodes ( ) ) { String host = node . getHost ( ) ; List < ResourceRequestInfo > hostReqs = c . hostToPendingRequests . get ( host ) ; if ( hostReqs == null ) { hostReqs = new LinkedList < ResourceRequestInfo > ( ) ; c . hostToPendingRequests . put ( host , hostReqs ) ; } hostReqs . add ( req ) ; Node rack = node . getRack ( ) ; List < ResourceRequestInfo > rackReqs = c . rackToPendingRequests . get ( rack ) ; if ( rackReqs == null ) { rackReqs = new LinkedList < ResourceRequestInfo > ( ) ; c . rackToPendingRequests . put ( rack , rackReqs ) ; } rackReqs . add ( req ) ; } } // Always add to the " any " list . Context c = getContext ( req . getType ( ) ) ; c . anyHostRequests . add ( req ) ; addPendingRequestForType ( req ) ;
public class AbstractExecutorService { /** * Returns a { @ code RunnableFuture } for the given callable task . * @ param callable the callable task being wrapped * @ param < T > the type of the callable ' s result * @ return a { @ code RunnableFuture } which , when run , will call the * underlying callable and which , as a { @ code Future } , will yield * the callable ' s result as its result and provide for * cancellation of the underlying task * @ since 1.6 */ protected < T > RunnableFuture < T > newTaskFor ( Callable < T > callable ) { } }
return new FutureTask < T > ( callable ) ;
public class Html { /** * This method will return the TagRenderBase enum value for the document type . The default * value is HTML 4.01. * @ return int */ public int getTargetDocumentType ( ) { } }
if ( _rendering != TagRenderingBase . UNKNOWN_RENDERING ) return _rendering ; if ( _docType != null ) { if ( _docType . equals ( HTML_401 ) ) _rendering = TagRenderingBase . HTML_RENDERING ; else if ( _docType . equals ( HTML_401_QUIRKS ) ) _rendering = TagRenderingBase . HTML_RENDERING_QUIRKS ; else if ( _docType . equals ( XHTML_10 ) ) _rendering = TagRenderingBase . XHTML_RENDERING ; else _rendering = TagRenderingBase . getDefaultDocType ( ) ; } else { _rendering = TagRenderingBase . getDefaultDocType ( ) ; } return _rendering ;
public class HttpISCWriteCallback { /** * Called by the channel below us when a write has finished . * @ param vc * @ param wsc */ @ Override public void complete ( VirtualConnection vc , TCPWriteRequestContext wsc ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "complete() called: vc=" + vc ) ; } HttpInboundServiceContextImpl mySC = ( HttpInboundServiceContextImpl ) vc . getStateMap ( ) . get ( CallbackIDs . CALLBACK_HTTPISC ) ; if ( null != wsc ) { wsc . setBuffers ( null ) ; } // access logging if the finishResponse API was used if ( mySC . isMessageSent ( ) ) { mySC . logFinalResponse ( mySC . getNumBytesWritten ( ) ) ; HttpInvalidMessageException inv = mySC . checkResponseValidity ( ) ; if ( null != inv ) { // response was invalid in some way . . . error scenario mySC . setPersistent ( false ) ; if ( null != mySC . getAppWriteCallback ( ) ) { mySC . getAppWriteCallback ( ) . error ( vc , inv ) ; } return ; } } // if a callback exists above , pass along the complete . But if the // app channel didn ' t give us a callback ( it doesn ' t care ) then we // can ' t pass anything along and we stop further work here if ( null != mySC . getAppWriteCallback ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Calling write complete callback of app channel." ) ; } if ( mySC . getResponseImpl ( ) . isTemporaryStatusCode ( ) ) { // allow other responses to follow a temporary one if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Temp response sent, resetting send flags" ) ; } mySC . resetWrite ( ) ; } mySC . getAppWriteCallback ( ) . complete ( vc ) ; } else { // this is dangerous since we ' re not notifying the channel above // of the complete work , but they don ' t care since they didn ' t // give us a callback to use . . . hopefully they will continue this // connection properly . if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "No available app channel callback" ) ; } }
public class EntityScannerBuilder { /** * Only include rows which are missing this field , this was the only possible * way to do it . * @ param fieldName * The field which should be missing * @ return ScannerBuilder */ public EntityScannerBuilder < E > addIsMissingFilter ( String fieldName ) { } }
SingleFieldEntityFilter singleFieldEntityFilter = new SingleFieldEntityFilter ( entityMapper . getEntitySchema ( ) , entityMapper . getEntitySerDe ( ) , fieldName , "++++NON_SHALL_PASS++++" , CompareFilter . CompareOp . EQUAL ) ; SingleColumnValueFilter filter = ( SingleColumnValueFilter ) singleFieldEntityFilter . getFilter ( ) ; filter . setFilterIfMissing ( false ) ; filterList . add ( filter ) ; return this ;
public class WsByteBufferUtils { /** * Convert an array of buffers to a String . * @ param list * @ return String */ public static final String asString ( WsByteBuffer [ ] list ) { } }
byte [ ] data = asByteArray ( list ) ; return ( null != data ) ? new String ( data ) : null ;
public class Routes { /** * can be cached ? I don ' t think so . */ private Map < String , RouteEntry > getAcceptedMimeTypes ( List < RouteEntry > routes ) { } }
Map < String , RouteEntry > acceptedTypes = new HashMap < > ( ) ; for ( RouteEntry routeEntry : routes ) { if ( ! acceptedTypes . containsKey ( routeEntry . acceptedType ) ) { acceptedTypes . put ( routeEntry . acceptedType , routeEntry ) ; } } return acceptedTypes ;
public class WrappedObjectMapperProcessor { /** * Compute the getter name . * @ param name * the name of the property to read . * @ return the getter name . */ private String computeGetterName ( String name ) { } }
StringBuilder _result = new StringBuilder ( ) . append ( PREFIX__GETTER ) ; _result . append ( Character . toUpperCase ( name . charAt ( 0 ) ) ) . append ( name . substring ( 1 ) ) ; return _result . toString ( ) ;
public class Tracy { /** * Creates Tracy worker thread context to be bound to the worker thread * The context returned contains only parentage information * Note : This needs to be called from the requester thread * @ return Context to be bound to the worker thread */ public static TracyThreadContext createWorkerTheadContext ( ) { } }
TracyThreadContext currentCtx = threadContext . get ( ) ; TracyThreadContext workerCtx = null ; if ( isValidContext ( currentCtx ) ) { workerCtx = new TracyThreadContext ( currentCtx . getTaskId ( ) , currentCtx . getOptId ( ) , null ) ; } return workerCtx ;
public class StructureImpl { /** * { @ inheritDoc } */ @ Override public String getIdentifier ( ) { } }
// 1 . StructureIdentifier if ( getStructureIdentifier ( ) != null ) { return getStructureIdentifier ( ) . getIdentifier ( ) ; } // 2 . Name if ( getName ( ) != null ) { return getName ( ) ; } // 3 . PDBCode + ranges return toCanonical ( ) . getIdentifier ( ) ;
public class DiscoveredBdas { /** * Returns true if the given archive is accessible to all modules of the given module type * < ul > * < li > EAR and shared libraries are available to all modules < / li > * < li > EJB and RAR modules are accessible to all other EJB modules , RAR modules and Web modules < / li > * < li > Web and App Client modules are not accessible to other modules < / li > * < / ul > * @ param archiveType the module type * @ param archive an archive * @ return true if the archive is available to all modules of archiveType , otherwise false * @ throws CDIException */ public boolean isAlreadyAccessible ( ArchiveType archiveType , CDIArchive archive ) throws CDIException { } }
String path = archive . getPath ( ) ; if ( libraryPaths . contains ( path ) ) { return true ; } else if ( archiveType == ArchiveType . EAR_LIB || archiveType == ArchiveType . RAR_MODULE || archiveType == ArchiveType . EJB_MODULE || archiveType == ArchiveType . WEB_MODULE || archiveType == ArchiveType . CLIENT_MODULE ) { return modulePaths . contains ( path ) ; } else { return false ; }
public class NetworkConnectionServiceImpl { /** * Open a channel for destination identifier of NetworkConnectionService . * @ param connectionFactoryId * @ param remoteEndPointId * @ throws NetworkException */ < T > Link < NetworkConnectionServiceMessage < T > > openLink ( final Identifier connectionFactoryId , final Identifier remoteEndPointId ) throws NetworkException { } }
final Identifier remoteId = getEndPointIdWithConnectionFactoryId ( connectionFactoryId , remoteEndPointId ) ; try { final SocketAddress address = nameResolver . lookup ( remoteId ) ; if ( address == null ) { throw new NetworkException ( "Lookup " + remoteId + " is null" ) ; } return transport . open ( address , nsCodec , nsLinkListener ) ; } catch ( final Exception e ) { throw new NetworkException ( e ) ; }
public class SSLComponent { /** * Protected so it can be called via unit test . * @ return Map < String , String > filled with global properties from ssl config instance */ Map < String , Object > getGlobalProps ( ) { } }
Map < String , Object > props = getProperties ( ) ; String repertoire = ( String ) props . get ( LibertyConstants . KEY_DEFAULT_REPERTOIRE ) ; if ( repertoire != null ) { props . put ( Constants . SSLPROP_DEFAULT_ALIAS , repertoire ) ; } else { props . put ( Constants . SSLPROP_DEFAULT_ALIAS , LibertyConstants . DEFAULT_SSL_CONFIG_ID ) ; } String outBoundDefault = ( String ) props . get ( LibertyConstants . KEY_OUTBOUND_DEFAULT_REPERTOIRE ) ; if ( outBoundDefault != null ) { props . put ( LibertyConstants . SSLPROP_OUTBOUND_DEFAULT_ALIAS , outBoundDefault ) ; } String hostNameVerification = ( String ) props . get ( LibertyConstants . KEY_OUTBOUND_HOSTNAME_VERIFICATION ) ; if ( hostNameVerification != null ) { props . put ( Constants . SSLPROP_URL_HOSTNAME_VERIFICATION , hostNameVerification ) ; } return props ;
public class ApiOvhXdsl { /** * Get this object properties * REST : GET / xdsl / templateModem / { name } * @ param name [ required ] Name of the Modem Template * API beta */ public OvhTemplateModem templateModem_name_GET ( String name ) throws IOException { } }
String qPath = "/xdsl/templateModem/{name}" ; StringBuilder sb = path ( qPath , name ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhTemplateModem . class ) ;
public class FileServersInner { /** * Creates a File Server in the given workspace . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param workspaceName The name of the workspace . Workspace names can only contain a combination of alphanumeric characters along with dash ( - ) and underscore ( _ ) . The name must be from 1 through 64 characters long . * @ param fileServerName The name of the file server within the specified resource group . File server names can only contain a combination of alphanumeric characters along with dash ( - ) and underscore ( _ ) . The name must be from 1 through 64 characters long . * @ param parameters The parameters to provide for File Server creation . * @ 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 < FileServerInner > createAsync ( String resourceGroupName , String workspaceName , String fileServerName , FileServerCreateParameters parameters , final ServiceCallback < FileServerInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( createWithServiceResponseAsync ( resourceGroupName , workspaceName , fileServerName , parameters ) , serviceCallback ) ;
public class ExtendedJTATransactionImpl { /** * Null out levels that will never be referenced again . * Null entries are candidates to be the next current level . */ private static void garbageCollectUnusedLevels ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "garbageCollectUnusedLevels" ) ; final int numLevels = _syncLevels . size ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Levels: " + numLevels ) ; // No need to do anything if we only have one level if ( numLevels < 2 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "garbageCollectUnusedLevels" , "Doing nothing" ) ; return ; } final int [ ] counts = new int [ numLevels ] ; // Check through all transactions to see which levels are still in use final TransactionImpl [ ] txns = LocalTIDTable . getAllTransactions ( ) ; // Record the levels with transactions referring to them // Record the levels with transactions referring to them for ( int i = txns . length ; -- i >= 0 ; ) { // TransactionImpl has a dependency on CORBA which we definitely don ' t want // Skip this step to avoid a classcastexception // TODO can we work around the dependency ? int level = 0 ; // final int level = ( ( com . ibm . ws . tx . jta . TransactionImpl ) txns [ i ] ) . getExtJTASyncLevel ( ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Not generating any counts for garbageCollectUnusedLevels()" ) ; } if ( level >= 0 && level < numLevels ) { counts [ level ] ++ ; } } // Now null out the levels with no references for ( int i = counts . length ; -- i >= 0 ; ) { // We never want to null out the current level if ( i != _syncLevel ) { if ( counts [ i ] == 0 ) { _syncLevels . set ( i , null ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "garbageCollectUnusedLevels" , _syncLevels . size ( ) ) ;
public class RAExpressionAttributes { /** * JOIN USING * @ param re1 a { @ link RAExpressionAttributes } * @ param re2 a { @ link RAExpressionAttributes } * @ param using a { @ link ImmutableSet } < { @ link QuotedID } > * @ return a { @ link RAExpressionAttributes } * @ throws IllegalJoinException if the same alias occurs in both arguments * or one of the ` using ' attributes is ambiguous or absent */ public static RAExpressionAttributes joinUsing ( RAExpressionAttributes re1 , RAExpressionAttributes re2 , ImmutableSet < QuotedID > using ) throws IllegalJoinException { } }
checkRelationAliasesConsistency ( re1 , re2 ) ; if ( using . stream ( ) . anyMatch ( id -> ! re1 . isUnique ( id ) || ! re2 . isUnique ( id ) ) ) { ImmutableList < QuotedID > notFound = using . stream ( ) . filter ( id -> re1 . isAbsent ( id ) || re2 . isAbsent ( id ) ) . collect ( ImmutableCollectors . toList ( ) ) ; ImmutableList < QuotedID > ambiguous = using . stream ( ) . filter ( id -> re1 . isAmbiguous ( id ) || re2 . isAmbiguous ( id ) ) . collect ( ImmutableCollectors . toList ( ) ) ; throw new IllegalJoinException ( re1 , re2 , ( ! notFound . isEmpty ( ) ? "Attribute(s) " + notFound + " cannot be found" : "" ) + ( ! notFound . isEmpty ( ) && ! ambiguous . isEmpty ( ) ? ", " : "" ) + ( ! ambiguous . isEmpty ( ) ? "Attribute(s) " + ambiguous + " are ambiguous" : "" ) ) ; } ImmutableMap < QualifiedAttributeID , Term > attributes = merge ( re1 . selectAttributes ( id -> ( id . getRelation ( ) != null && ! using . contains ( id . getAttribute ( ) ) ) || ( id . getRelation ( ) == null && re2 . isAbsent ( id . getAttribute ( ) ) ) || ( id . getRelation ( ) == null && using . contains ( id . getAttribute ( ) ) ) ) , re2 . selectAttributes ( id -> ( id . getRelation ( ) != null && ! using . contains ( id . getAttribute ( ) ) ) || ( id . getRelation ( ) == null && re1 . isAbsent ( id . getAttribute ( ) ) ) ) ) ; ImmutableMap < QuotedID , ImmutableSet < RelationID > > attributeOccurrences = getAttributeOccurrences ( re1 , re2 , id -> using . contains ( id ) ? re1 . attributeOccurrences . get ( id ) : attributeOccurrencesUnion ( id , re1 , re2 ) ) ; return new RAExpressionAttributes ( attributes , attributeOccurrences ) ;
public class SmartBinder { /** * Create a new SmartBinder with from the given types and argument name . * @ param retType the type of the return value to start with * @ param name the name of the sole argument * @ param type the sole argument ' s type * @ return a new SmartBinder */ public static SmartBinder from ( Class < ? > retType , String name , Class < ? > type ) { } }
return from ( Signature . returning ( retType ) . appendArg ( name , type ) ) ;
public class GeneralName { /** * Encode the name to the specified DerOutputStream . * @ param out the DerOutputStream to encode the the GeneralName to . * @ exception IOException on encoding errors . */ public void encode ( DerOutputStream out ) throws IOException { } }
DerOutputStream tmp = new DerOutputStream ( ) ; name . encode ( tmp ) ; int nameType = name . getType ( ) ; if ( nameType == GeneralNameInterface . NAME_ANY || nameType == GeneralNameInterface . NAME_X400 || nameType == GeneralNameInterface . NAME_EDI ) { // implicit , constructed form out . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , true , ( byte ) nameType ) , tmp ) ; } else if ( nameType == GeneralNameInterface . NAME_DIRECTORY ) { // explicit , constructed form since underlying tag is CHOICE // ( see X . 680 section 30.6 , part c ) out . write ( DerValue . createTag ( DerValue . TAG_CONTEXT , true , ( byte ) nameType ) , tmp ) ; } else { // implicit , primitive form out . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , false , ( byte ) nameType ) , tmp ) ; }
public class SegmentAggregator { /** * Seals the StreamSegment in Storage , if necessary . * @ param flushResult The FlushResult from a previous Flush operation . This will just be passed - through . * @ param timer Timer for the operation . * @ return The FlushResult passed in as an argument . */ private CompletableFuture < WriterFlushResult > sealIfNecessary ( WriterFlushResult flushResult , TimeoutTimer timer ) { } }
if ( ! this . hasSealPending . get ( ) || ! ( this . operations . getFirst ( ) instanceof StreamSegmentSealOperation ) ) { // Either no Seal is pending or the next operation is not a seal - we cannot execute a seal . return CompletableFuture . completedFuture ( flushResult ) ; } long traceId = LoggerHelpers . traceEnterWithContext ( log , this . traceObjectId , "sealIfNecessary" ) ; CompletableFuture < Void > sealTask ; if ( this . handle . get ( ) == null ) { // Segment is empty . It might not have been created yet , so don ' t do anything . assert this . metadata . getStorageLength ( ) == 0 : "handle is null but Metadata.StorageLength is non-zero" ; sealTask = CompletableFuture . completedFuture ( null ) ; } else { // Segment is non - empty ; it should exist . sealTask = this . storage . seal ( this . handle . get ( ) , timer . getRemaining ( ) ) ; } return sealTask . thenComposeAsync ( v -> sealAttributes ( timer . getRemaining ( ) ) , this . executor ) . handleAsync ( ( v , ex ) -> { ex = Exceptions . unwrap ( ex ) ; if ( ex != null && ! ( ex instanceof StreamSegmentSealedException ) ) { // The operation failed , and it was not because the Segment was already Sealed . Throw it again . // We consider the Seal to succeed if the Segment in Storage is already sealed - it ' s an idempotent operation . if ( ex instanceof StreamSegmentNotExistsException ) { // The segment does not exist ( anymore ) . This is possible if it got merged into another one . // Begin a reconciliation to determine the actual state . setState ( AggregatorState . ReconciliationNeeded ) ; } throw new CompletionException ( ex ) ; } updateStatePostSeal ( ) ; LoggerHelpers . traceLeave ( log , this . traceObjectId , "sealIfNecessary" , traceId , flushResult ) ; return flushResult ; } , this . executor ) ;
public class AbstractRadial { /** * Sets the color of the small inner frame of the gauge * @ param INNER _ FRAME _ COLOR */ public void setInnerFrameColor ( final Paint INNER_FRAME_COLOR ) { } }
FRAME_FACTORY . setInnerFrameColor ( INNER_FRAME_COLOR ) ; init ( getInnerBounds ( ) . width , getInnerBounds ( ) . height ) ; repaint ( getInnerBounds ( ) ) ;
public class PrivateKeyWriter { /** * Write the given { @ link PrivateKey } into the given { @ link OutputStream } in the given formats . * @ param privateKey * the private key * @ param outputStream * the output stream * @ param fileFormat * the file format * @ param keyFormat * the private key format * @ throws IOException * Signals that an I / O exception has occurred . */ public static void write ( final PrivateKey privateKey , final @ NonNull OutputStream outputStream , final KeyFileFormat fileFormat , final KeyFormat keyFormat ) throws IOException { } }
final byte [ ] privateKeyBytes = privateKey . getEncoded ( ) ; switch ( fileFormat ) { case PEM : if ( keyFormat == null || keyFormat . equals ( KeyFormat . PKCS_8 ) ) { String privateKeyAsBase64String = PrivateKeyExtensions . toPemFormat ( privateKey ) ; outputStream . write ( privateKeyAsBase64String . getBytes ( StandardCharsets . US_ASCII ) ) ; break ; } else if ( keyFormat . equals ( KeyFormat . PKCS_1 ) ) { final byte [ ] privateKeyPKCS1Formatted = PrivateKeyExtensions . toPKCS1Format ( privateKey ) ; String pemFormat = PrivateKeyExtensions . fromPKCS1ToPemFormat ( privateKeyPKCS1Formatted ) ; outputStream . write ( pemFormat . getBytes ( StandardCharsets . US_ASCII ) ) ; break ; } default : // DER is default final PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec ( privateKeyBytes ) ; outputStream . write ( keySpec . getEncoded ( ) ) ; break ; } outputStream . close ( ) ;
public class NodeBuilder { /** * Sets the node host / port . * @ param host the host name * @ param port the port number * @ return the node builder * @ throws io . atomix . utils . net . MalformedAddressException if a valid { @ link Address } cannot be constructed from the arguments * @ deprecated since 3.1 . Use { @ link # withHost ( String ) } and { @ link # withPort ( int ) } instead */ @ Deprecated public NodeBuilder withAddress ( String host , int port ) { } }
return withAddress ( Address . from ( host , port ) ) ;
public class LdapConnection { /** * Rename an entity . * @ param dn The distinguished name to rename . * @ param newDn The new distinguished name . * @ throws WIMException If there was an issue getting or releasing a context , or the context is on a * fail - over server and writing to fail - over servers is prohibited , or the distinguished * name does not exist . */ public void rename ( String dn , String newDn ) throws WIMException { } }
TimedDirContext ctx = iContextManager . getDirContext ( ) ; iContextManager . checkWritePermission ( ctx ) ; try { try { ctx . rename ( dn , newDn ) ; } catch ( NamingException e ) { if ( ! ContextManager . isConnectionException ( e ) ) { throw e ; } ctx = iContextManager . reCreateDirContext ( ctx , e . toString ( ) ) ; ctx . rename ( dn , newDn ) ; } } catch ( NamingException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ; throw new WIMSystemException ( WIMMessageKey . NAMING_EXCEPTION , msg , e ) ; } finally { iContextManager . releaseDirContext ( ctx ) ; }
public class AbstractJoiner { /** * Prepares the cluster state for cluster merge by changing it to { @ link ClusterState # FROZEN } . It expects the current * cluster state to be { @ link ClusterState # ACTIVE } or { @ link ClusterState # NO _ MIGRATION } . * The method will keep trying to change the cluster state until { @ link GroupProperty # MERGE _ NEXT _ RUN _ DELAY _ SECONDS } elapses * or until the sleep period between two attempts has been interrupted . * @ param clusterService the cluster service used for state change * @ return true if the cluster state was successfully prepared */ private boolean prepareClusterState ( ClusterServiceImpl clusterService , int expectedMemberListVersion ) { } }
if ( ! preCheckClusterState ( clusterService ) ) { return false ; } long until = Clock . currentTimeMillis ( ) + mergeNextRunDelayMs ; while ( Clock . currentTimeMillis ( ) < until ) { ClusterState clusterState = clusterService . getClusterState ( ) ; if ( ! clusterState . isMigrationAllowed ( ) && ! clusterState . isJoinAllowed ( ) && clusterState != IN_TRANSITION ) { return ( clusterService . getMemberListVersion ( ) == expectedMemberListVersion ) ; } if ( clusterService . getMemberListVersion ( ) != expectedMemberListVersion ) { logger . warning ( "Could not change cluster state to FROZEN because local member list version: " + clusterService . getMemberListVersion ( ) + " is different than expected member list version: " + expectedMemberListVersion ) ; return false ; } // If state is IN _ TRANSITION , then skip trying to change state . // Otherwise transaction will print noisy warning logs . if ( clusterState != IN_TRANSITION ) { try { clusterService . changeClusterState ( FROZEN ) ; return verifyMemberListVersionAfterStateChange ( clusterService , clusterState , expectedMemberListVersion ) ; } catch ( Exception e ) { String error = e . getClass ( ) . getName ( ) + ": " + e . getMessage ( ) ; logger . warning ( "While changing cluster state to FROZEN! " + error ) ; } } try { TimeUnit . SECONDS . sleep ( 1 ) ; } catch ( InterruptedException e ) { logger . warning ( "Interrupted while preparing cluster for merge!" ) ; // restore interrupt flag Thread . currentThread ( ) . interrupt ( ) ; return false ; } } logger . warning ( "Could not change cluster state to FROZEN in time. Postponing merge process until next attempt." ) ; return false ;
public class RestRequestValidator { /** * Retrieve the routing type value from the REST request . * " X _ VOLD _ ROUTING _ TYPE _ CODE " is the routing type header . * By default , the routing code is set to NORMAL * TODO REST - Server 1 . Change the header name to a better name . 2 . Assumes * that integer is passed in the header */ protected void parseRoutingCodeHeader ( ) { } }
String rtCode = this . request . getHeader ( RestMessageHeaders . X_VOLD_ROUTING_TYPE_CODE ) ; if ( rtCode != null ) { try { int routingTypeCode = Integer . parseInt ( rtCode ) ; this . parsedRoutingType = RequestRoutingType . getRequestRoutingType ( routingTypeCode ) ; } catch ( NumberFormatException nfe ) { logger . error ( "Exception when validating request. Incorrect routing type parameter. Cannot parse this to long: " + rtCode , nfe ) ; RestErrorHandler . writeErrorResponse ( this . messageEvent , HttpResponseStatus . BAD_REQUEST , "Incorrect routing type parameter. Cannot parse this to long: " + rtCode ) ; } catch ( VoldemortException ve ) { logger . error ( "Exception when validating request. Incorrect routing type code: " + rtCode , ve ) ; RestErrorHandler . writeErrorResponse ( this . messageEvent , HttpResponseStatus . BAD_REQUEST , "Incorrect routing type code: " + rtCode ) ; } }
public class EnumConstantBuilder { /** * Construct a new EnumConstantsBuilder . * @ param context the build context . * @ param classDoc the class whoses members are being documented . * @ param writer the doclet specific writer . */ public static EnumConstantBuilder getInstance ( Context context , ClassDoc classDoc , EnumConstantWriter writer ) { } }
return new EnumConstantBuilder ( context , classDoc , writer ) ;
public class KnowledgeBasesClient { /** * Deletes the specified knowledge base . * < p > Sample code : * < pre > < code > * try ( KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient . create ( ) ) { * KnowledgeBaseName name = KnowledgeBaseName . of ( " [ PROJECT ] " , " [ KNOWLEDGE _ BASE ] " ) ; * knowledgeBasesClient . deleteKnowledgeBase ( name . toString ( ) ) ; * < / code > < / pre > * @ param name Required . The name of the knowledge base to delete . Format : ` projects / & lt ; Project * ID & gt ; / knowledgeBases / & lt ; Knowledge Base ID & gt ; ` . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final void deleteKnowledgeBase ( String name ) { } }
DeleteKnowledgeBaseRequest request = DeleteKnowledgeBaseRequest . newBuilder ( ) . setName ( name ) . build ( ) ; deleteKnowledgeBase ( request ) ;
public class GitFlowGraphMonitor { /** * check whether the file has the proper naming and hierarchy * @ param file the relative path from the repo root * @ return false if the file does not conform */ private boolean checkFilePath ( String file , int depth ) { } }
// The file is either a node file or an edge file and needs to be stored at either : // flowGraphDir / nodeName / nodeName . properties ( if it is a node file ) , or // flowGraphDir / nodeName / nodeName / edgeName . properties ( if it is an edge file ) Path filePath = new Path ( file ) ; String fileExtension = Files . getFileExtension ( filePath . getName ( ) ) ; if ( filePath . depth ( ) != depth || ! checkFileLevelRelativeToRoot ( filePath , depth ) || ! ( this . javaPropsExtensions . contains ( fileExtension ) ) ) { log . warn ( "Changed file does not conform to directory structure and file name format, skipping: " + filePath ) ; return false ; } return true ;
public class RouterImpl { /** * Persist */ public void store ( ) { } }
// TODO : Should we keep reference to Objects rather than recreating // everytime ? try { XMLObjectWriter writer = XMLObjectWriter . newInstance ( new FileOutputStream ( persistFile . toString ( ) ) ) ; writer . setBinding ( binding ) ; writer . setIndentation ( TAB_INDENT ) ; writer . write ( longMessageRules , LONG_MESSAGE_RULE , LongMessageRuleMap . class ) ; writer . write ( saps , MTP3_SERVICE_ACCESS_POINT , Mtp3ServiceAccessPointMap . class ) ; writer . close ( ) ; } catch ( Exception e ) { logger . error ( "Error while persisting the Rule state in file" , e ) ; }
public class AbstractProcessor { /** * Registers a file transform . * @ param pattern One or more file patterns separated by commas . * @ param transform The transform . */ public void registerTransform ( String pattern , AbstractTransform transform ) { } }
transforms . add ( new Transform ( new WildcardFileFilter ( pattern . split ( "\\," ) ) , transform ) ) ;