signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Unchecked { /** * Wrap a { @ link CheckedDoubleUnaryOperator } in a { @ link DoubleUnaryOperator } with a custom handler for checked exceptions . * Example : * < code > < pre > * LongStream . of ( 1.0 , 2.0 , 3.0 ) . map ( Unchecked . doubleUnaryOperator ( * if ( d & lt ; 0.0) * throw new Exception ( " Only positive numbers allowed " ) ; * return d ; * throw new IllegalStateException ( e ) ; * < / pre > < / code > */ public static DoubleUnaryOperator doubleUnaryOperator ( CheckedDoubleUnaryOperator operator , Consumer < Throwable > handler ) { } }
return t -> { try { return operator . applyAsDouble ( t ) ; } catch ( Throwable e ) { handler . accept ( e ) ; throw new IllegalStateException ( "Exception handler must throw a RuntimeException" , e ) ; } } ;
public class ScriptPattern { /** * Returns true if this script is of the form { @ code DUP HASH160 < pubkey hash > EQUALVERIFY CHECKSIG } , ie , payment to an * address like { @ code 1VayNert3x1KzbpzMGt2qdqrAThiRovi8 } . This form was originally intended for the case where you wish * to send somebody money with a written code because their node is offline , but over time has become the standard * way to make payments due to the short and recognizable base58 form addresses come in . */ public static boolean isP2PKH ( Script script ) { } }
List < ScriptChunk > chunks = script . chunks ; if ( chunks . size ( ) != 5 ) return false ; if ( ! chunks . get ( 0 ) . equalsOpCode ( OP_DUP ) ) return false ; if ( ! chunks . get ( 1 ) . equalsOpCode ( OP_HASH160 ) ) return false ; byte [ ] chunk2data = chunks . get ( 2 ) . data ; if ( chunk2data == null ) return false ; if ( chunk2data . length != LegacyAddress . LENGTH ) return false ; if ( ! chunks . get ( 3 ) . equalsOpCode ( OP_EQUALVERIFY ) ) return false ; if ( ! chunks . get ( 4 ) . equalsOpCode ( OP_CHECKSIG ) ) return false ; return true ;
public class AllianceApi { /** * Get alliance information Public information about an alliance - - - This * route is cached for up to 3600 seconds * @ param allianceId * An EVE alliance ID ( required ) * @ param datasource * The server name you would like data from ( optional , default to * tranquility ) * @ param ifNoneMatch * ETag from a previous request . A 304 will be returned if this * matches the current ETag ( optional ) * @ return ApiResponse & lt ; AllianceResponse & gt ; * @ throws ApiException * If fail to call the API , e . g . server error or cannot * deserialize the response body */ public ApiResponse < AllianceResponse > getAlliancesAllianceIdWithHttpInfo ( Integer allianceId , String datasource , String ifNoneMatch ) throws ApiException { } }
com . squareup . okhttp . Call call = getAlliancesAllianceIdValidateBeforeCall ( allianceId , datasource , ifNoneMatch , null ) ; Type localVarReturnType = new TypeToken < AllianceResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ;
public class JDBCStorageConnection { /** * Read Property Values . * @ param identifier * property identifier * @ param cid * Property id * @ param pdata * PropertyData * @ return list of ValueData * @ throws IOException * i / O error * @ throws SQLException * if database errro occurs * @ throws ValueStorageNotFoundException * if no such storage found with Value storageId */ private List < ValueDataWrapper > readValues ( String cid , int cptype , String identifier , int cversion ) throws IOException , SQLException , ValueStorageNotFoundException { } }
List < ValueDataWrapper > data = new ArrayList < ValueDataWrapper > ( ) ; final ResultSet valueRecords = findValuesByPropertyId ( cid ) ; try { while ( valueRecords . next ( ) ) { final int orderNum = valueRecords . getInt ( COLUMN_VORDERNUM ) ; final String storageId = valueRecords . getString ( COLUMN_VSTORAGE_DESC ) ; ValueDataWrapper vdWrapper = valueRecords . wasNull ( ) ? ValueDataUtil . readValueData ( cid , cptype , orderNum , cversion , valueRecords . getBinaryStream ( COLUMN_VDATA ) , containerConfig . spoolConfig ) : readValueData ( identifier , orderNum , cptype , storageId ) ; data . add ( vdWrapper ) ; } } finally { try { valueRecords . close ( ) ; } catch ( SQLException e ) { LOG . error ( "Can't close the ResultSet: " + e . getMessage ( ) ) ; } } return data ;
public class HikariConnectionProvider { @ SuppressWarnings ( "rawtypes" ) @ Override public void configure ( Map props ) throws HibernateException { } }
try { LOGGER . debug ( "Configuring HikariCP" ) ; this . hcfg = HikariConfigurationUtil . loadConfiguration ( props ) ; this . hds = new HikariDataSource ( this . hcfg ) ; } catch ( Exception e ) { throw new HibernateException ( e ) ; } LOGGER . debug ( "HikariCP Configured" ) ;
public class PyramidOps { /** * Computes the gradient for each image the pyramid . * It is assumed that the gradient has the same scales as the input . If not * initialized then it will be initialized . If already initialized it is * assumed to be setup for the same input image size . * @ param input Input pyramid . * @ param gradient Computes image gradient * @ param derivX Pyramid where x - derivative is stored . * @ param derivY Pyramid where y - derivative is stored . */ public static < I extends ImageGray < I > , O extends ImageGray < O > > void gradient ( ImagePyramid < I > input , ImageGradient < I , O > gradient , O [ ] derivX , O [ ] derivY ) { } }
for ( int i = 0 ; i < input . getNumLayers ( ) ; i ++ ) { I imageIn = input . getLayer ( i ) ; gradient . process ( imageIn , derivX [ i ] , derivY [ i ] ) ; }
public class PaySignUtil { /** * 根据参数map获取待签名字符串 * @ param params 待签名参数map * @ param includeEmptyParam 是否包含值为空的参数 : * 与 HMS - SDK 支付能力交互的签名或验签 , 需要为false ( 不包含空参数 ) * 由华为支付服务器回调给开发者的服务器的支付结果验签 , 需要为true ( 包含空参数 ) * @ return 待签名字符串 */ private static String getNoSign ( Map < String , Object > params , boolean includeEmptyParam ) { } }
// 对参数按照key做升序排序 , 对map的所有value进行处理 , 转化成string类型 // 拼接成key = value & key = value & . . . . 格式的字符串 StringBuilder content = new StringBuilder ( ) ; // 按照key做排序 List < String > keys = new ArrayList < String > ( params . keySet ( ) ) ; Collections . sort ( keys ) ; String value = null ; Object object = null ; boolean isFirstParm = true ; for ( int i = 0 ; i < keys . size ( ) ; i ++ ) { String key = ( String ) keys . get ( i ) ; object = params . get ( key ) ; if ( object == null ) { value = "" ; } else if ( object instanceof String ) { value = ( String ) object ; } else { value = String . valueOf ( object ) ; } if ( includeEmptyParam || ! TextUtils . isEmpty ( value ) ) { content . append ( ( isFirstParm ? "" : "&" ) + key + "=" + value ) ; isFirstParm = false ; } else { continue ; } } // 待签名的字符串 return content . toString ( ) ;
public class PtoPLocalMsgsItemStream { /** * Sets the name currently in use by this localization . * @ param newIdentifier */ private void setName ( String newName ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setName" , newName ) ; this . _name = newName ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setName" ) ;
public class VirtualNetworksInner { /** * Checks whether a private IP address is available for use . * @ param resourceGroupName The name of the resource group . * @ param virtualNetworkName The name of the virtual network . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the IPAddressAvailabilityResultInner object */ public Observable < ServiceResponse < IPAddressAvailabilityResultInner > > checkIPAddressAvailabilityWithServiceResponseAsync ( String resourceGroupName , String virtualNetworkName ) { } }
if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( virtualNetworkName == null ) { throw new IllegalArgumentException ( "Parameter virtualNetworkName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } final String apiVersion = "2018-07-01" ; final String ipAddress = null ; return service . checkIPAddressAvailability ( resourceGroupName , virtualNetworkName , this . client . subscriptionId ( ) , ipAddress , apiVersion , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < IPAddressAvailabilityResultInner > > > ( ) { @ Override public Observable < ServiceResponse < IPAddressAvailabilityResultInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < IPAddressAvailabilityResultInner > clientResponse = checkIPAddressAvailabilityDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class Query { /** * @ see org . eclipse . datatools . connectivity . oda . IQuery # setTime ( java . lang . String , java . sql . Time ) */ public void setTime ( String parameterName , Time value ) throws OdaException { } }
// only applies to named input parameter parameters . put ( parameterName , value ) ;
public class HadoopUtils { /** * Set the System properties into Hadoop configuration . * This method won ' t override existing properties even if they are set as System properties . * @ param configuration Hadoop configuration * @ param propertyNames the properties to be set */ private static void setConfigurationFromSystemProperties ( Configuration configuration , PropertyKey [ ] propertyNames ) { } }
for ( PropertyKey propertyName : propertyNames ) { setConfigurationFromSystemProperty ( configuration , propertyName . toString ( ) ) ; }
public class AbstractRemoteClient { /** * { @ inheritDoc } */ @ Override public void removeConnectionStateObserver ( final Observer < Remote , ConnectionState . State > observer ) { } }
connectionStateObservable . removeObserver ( observer ) ;
public class InterceptionProcessor { /** * < p > Accepts the { @ link InvocationContext } and executes any { @ link Interceptor } s which fall within * the scope of the current proxy invocation by passing in the provided { @ link HttpRequestBase } . < / p > * < p > See { @ link AbstractRequestProcessor # process ( InvocationContext , HttpRequestBase ) } . < / p > * @ param context * the { @ link InvocationContext } which will be used to discover all { @ link Interceptor } s * which are within the scope of the current request invocation * < br > < br > * @ param request * the { @ link HttpRequestBase } which will be processed by all discovered { @ link Interceptor } s * < br > < br > * @ return the same instance of { @ link HttpRequestBase } which was processed by the { @ link Interceptor } s * < br > < br > * @ throws RequestProcessorException * if any of the { @ link Interceptor } s failed to process the { @ link HttpRequestBase } * < br > < br > * @ since 1.3.0 */ @ Override protected HttpRequestBase process ( InvocationContext context , HttpRequestBase request ) { } }
try { List < Class < ? extends Interceptor > > interceptors = new ArrayList < Class < ? extends Interceptor > > ( ) ; Intercept endpointMetadata = context . getEndpoint ( ) . getAnnotation ( Intercept . class ) ; Intercept requestMetadata = context . getRequest ( ) . getAnnotation ( Intercept . class ) ; if ( isDetached ( context , Intercept . class ) ) { return request ; } if ( endpointMetadata != null ) { interceptors . addAll ( filterSkipped ( context , Arrays . asList ( endpointMetadata . value ( ) ) ) ) ; } if ( requestMetadata != null ) { interceptors . addAll ( Arrays . asList ( requestMetadata . value ( ) ) ) ; } for ( Class < ? extends Interceptor > interceptorType : interceptors ) { String key = interceptorType . getName ( ) ; Interceptor interceptor = INTERCEPTORS . get ( key ) ; if ( interceptor == null ) { interceptor = interceptorType . newInstance ( ) ; INTERCEPTORS . put ( key , interceptor ) ; } interceptor . intercept ( context , request ) ; } List < Object > requestArgs = context . getArguments ( ) ; if ( requestArgs != null ) { for ( Object arg : requestArgs ) { if ( arg instanceof Interceptor && arg != null ) { ( ( Interceptor ) arg ) . intercept ( context , request ) ; } } } return request ; } catch ( Exception e ) { throw new RequestProcessorException ( context , getClass ( ) , e ) ; }
public class Tree { /** * This method will report all collected errors . * @ param error */ public void collectChildError ( String error ) { } }
if ( _errorText == null ) { _errorText = new InternalStringBuilder ( 32 ) ; } _errorText . append ( error ) ;
public class AccountFiltersInner { /** * Update an Account Filter . * Updates an existing Account Filter in the Media Services account . * @ param resourceGroupName The name of the resource group within the Azure subscription . * @ param accountName The Media Services account name . * @ param filterName The Account Filter name * @ param parameters The request parameters * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws ApiErrorException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the AccountFilterInner object if successful . */ public AccountFilterInner update ( String resourceGroupName , String accountName , String filterName , AccountFilterInner parameters ) { } }
return updateWithServiceResponseAsync ( resourceGroupName , accountName , filterName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ;
public class NettyHelper { /** * 关闭服务端IO线程 ( 只有最后一个使用者关闭才生效 ) * @ param config 服务端配置 */ public static void closeServerIoEventLoopGroup ( ServerTransportConfig config ) { } }
EventLoopGroup ioGroup = serverIoGroups . get ( config . getProtocolType ( ) ) ; if ( closeEventLoopGroupIfNoRef ( ioGroup ) ) { serverIoGroups . remove ( config . getProtocolType ( ) ) ; }
public class LoadBalancersInner { /** * Deletes the specified load balancer . * @ param resourceGroupName The name of the resource group . * @ param loadBalancerName The name of the load balancer . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void beginDelete ( String resourceGroupName , String loadBalancerName ) { } }
beginDeleteWithServiceResponseAsync ( resourceGroupName , loadBalancerName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class ListParentsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListParentsRequest listParentsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listParentsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listParentsRequest . getChildId ( ) , CHILDID_BINDING ) ; protocolMarshaller . marshall ( listParentsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listParentsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class I18nController { /** * Gets the internationalized messages as a JSON document compliant with the I18Next format . * @ param listOfLocales the list of locales * @ param ifNoneMatch the received ETAG if any * @ return the JSON document containing the messages */ @ Route ( method = HttpMethod . GET , uri = "i18n/bundles/{file<.+>}.json" ) public Result getBundleResourceForI18Next ( @ QueryParameter ( "locales" ) String listOfLocales , @ HttpParameter ( HeaderNames . IF_NONE_MATCH ) String ifNoneMatch ) { } }
// Parse the list of locale List < Locale > locales = new ArrayList < > ( ) ; if ( ! Strings . isNullOrEmpty ( listOfLocales ) ) { String [ ] items = listOfLocales . split ( " " ) ; for ( String item : items ) { // Manage the ' dev ' value ( it ' s the default locale used by i18next if ( "dev" . equalsIgnoreCase ( item ) ) { locales . add ( InternationalizationService . DEFAULT_LOCALE ) ; } else { locales . add ( Locale . forLanguageTag ( item ) ) ; } } } String etag ; StringBuilder builder = new StringBuilder ( ) ; for ( Locale locale : locales ) { builder . append ( service . etag ( locale ) ) ; } etag = builder . toString ( ) ; if ( ifNoneMatch != null && ifNoneMatch . equals ( etag ) ) { return new Result ( Status . NOT_MODIFIED ) ; } // i18next use a specific Json Format ObjectNode result = json . newObject ( ) ; for ( Locale locale : locales ) { ObjectNode lang = json . newObject ( ) ; ObjectNode translation = json . newObject ( ) ; lang . set ( "translation" , translation ) ; Collection < ResourceBundle > bundles = service . bundles ( locale ) ; for ( ResourceBundle bundle : bundles ) { for ( String key : bundle . keySet ( ) ) { populateJsonResourceBundle ( translation , key , bundle . getString ( key ) ) ; } } String langName = locale . toLanguageTag ( ) ; if ( locale . equals ( InternationalizationService . DEFAULT_LOCALE ) ) { langName = "dev" ; } result . set ( langName , lang ) ; } return ok ( result ) . with ( HeaderNames . ETAG , etag ) ;
public class Scalr { /** * Used to apply padding around the edges of an image using the given color * to fill the extra padded space and then return the result . { @ link Color } s * using an alpha channel ( i . e . transparency ) are supported . * The amount of < code > padding < / code > specified is applied to all sides ; * more specifically , a < code > padding < / code > of < code > 2 < / code > would add 2 * extra pixels of space ( filled by the given < code > color < / code > ) on the * top , bottom , left and right sides of the resulting image causing the * result to be 4 pixels wider and 4 pixels taller than the < code > src < / code > * image . * < strong > TIP < / strong > : This operation leaves the original < code > src < / code > * image unmodified . If the caller is done with the < code > src < / code > image * after getting the result of this operation , remember to call * { @ link BufferedImage # flush ( ) } on the < code > src < / code > to free up native * resources and make it easier for the GC to collect the unused image . * @ param src * The image the padding will be added to . * @ param padding * The number of pixels of padding to add to each side in the * resulting image . If this value is < code > 0 < / code > then * < code > src < / code > is returned unmodified . * @ param color * The color to fill the padded space with . { @ link Color } s using * an alpha channel ( i . e . transparency ) are supported . * @ param ops * < code > 0 < / code > or more ops to apply to the image . If * < code > null < / code > or empty then < code > src < / code > is return * unmodified . * @ return a new { @ link BufferedImage } representing < code > src < / code > with * the given padding applied to it . * @ throws IllegalArgumentException * if < code > src < / code > is < code > null < / code > . * @ throws IllegalArgumentException * if < code > padding < / code > is & lt ; < code > 1 < / code > . * @ throws IllegalArgumentException * if < code > color < / code > is < code > null < / code > . * @ throws ImagingOpException * if one of the given { @ link BufferedImageOp } s fails to apply . * These exceptions bubble up from the inside of most of the * { @ link BufferedImageOp } implementations and are explicitly * defined on the imgscalr API to make it easier for callers to * catch the exception ( if they are passing along optional ops * to be applied ) . imgscalr takes detailed steps to avoid the * most common pitfalls that will cause { @ link BufferedImageOp } s * to fail , even when using straight forward JDK - image * operations . */ public static BufferedImage pad ( BufferedImage src , int padding , Color color , BufferedImageOp ... ops ) throws IllegalArgumentException , ImagingOpException { } }
long t = - 1 ; if ( DEBUG ) t = System . currentTimeMillis ( ) ; if ( src == null ) throw new IllegalArgumentException ( "src cannot be null" ) ; if ( padding < 1 ) throw new IllegalArgumentException ( "padding [" + padding + "] must be > 0" ) ; if ( color == null ) throw new IllegalArgumentException ( "color cannot be null" ) ; int srcWidth = src . getWidth ( ) ; int srcHeight = src . getHeight ( ) ; /* * Double the padding to account for all sides of the image . More * specifically , if padding is " 1 " we add 2 pixels to width and 2 to * height , so we have 1 new pixel of padding all the way around our * image . */ int sizeDiff = ( padding * 2 ) ; int newWidth = srcWidth + sizeDiff ; int newHeight = srcHeight + sizeDiff ; if ( DEBUG ) log ( 0 , "Padding Image from [originalWidth=%d, originalHeight=%d, padding=%d] to [newWidth=%d, newHeight=%d]..." , srcWidth , srcHeight , padding , newWidth , newHeight ) ; boolean colorHasAlpha = ( color . getAlpha ( ) != 255 ) ; boolean imageHasAlpha = ( src . getTransparency ( ) != BufferedImage . OPAQUE ) ; BufferedImage result ; /* * We need to make sure our resulting image that we render into contains * alpha if either our original image OR the padding color we are using * contain it . */ if ( colorHasAlpha || imageHasAlpha ) { if ( DEBUG ) log ( 1 , "Transparency FOUND in source image or color, using ARGB image type..." ) ; result = new BufferedImage ( newWidth , newHeight , BufferedImage . TYPE_INT_ARGB ) ; } else { if ( DEBUG ) log ( 1 , "Transparency NOT FOUND in source image or color, using RGB image type..." ) ; result = new BufferedImage ( newWidth , newHeight , BufferedImage . TYPE_INT_RGB ) ; } Graphics g = result . getGraphics ( ) ; // Draw the border of the image in the color specified . g . setColor ( color ) ; g . fillRect ( 0 , 0 , newWidth , padding ) ; g . fillRect ( 0 , padding , padding , newHeight ) ; g . fillRect ( padding , newHeight - padding , newWidth , newHeight ) ; g . fillRect ( newWidth - padding , padding , newWidth , newHeight - padding ) ; // Draw the image into the center of the new padded image . g . drawImage ( src , padding , padding , null ) ; g . dispose ( ) ; if ( DEBUG ) log ( 0 , "Padding Applied in %d ms" , System . currentTimeMillis ( ) - t ) ; // Apply any optional operations ( if specified ) . if ( ops != null && ops . length > 0 ) result = apply ( result , ops ) ; return result ;
public class SimpleSolrPersistentEntity { /** * ( non - Javadoc ) * @ see org . springframework . data . solr . core . mapping . SolrPersistentEntity # getScoreProperty ( ) */ @ Nullable @ Override public SolrPersistentProperty getScoreProperty ( ) { } }
SolrPersistentProperty scoreProperty = getPersistentProperty ( Score . class ) ; if ( scoreProperty != null ) { return scoreProperty ; } return getPersistentProperty ( org . springframework . data . solr . repository . Score . class ) ;
public class AmazonWorkLinkClient { /** * Describes the device policy configuration for the specified fleet . * @ param describeDevicePolicyConfigurationRequest * @ return Result of the DescribeDevicePolicyConfiguration operation returned by the service . * @ throws UnauthorizedException * You are not authorized to perform this action . * @ throws InternalServerErrorException * The service is temporarily unavailable . * @ throws InvalidRequestException * The request is not valid . * @ throws ResourceNotFoundException * The requested resource was not found . * @ throws TooManyRequestsException * The number of requests exceeds the limit . * @ sample AmazonWorkLink . DescribeDevicePolicyConfiguration * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / worklink - 2018-09-25 / DescribeDevicePolicyConfiguration " * target = " _ top " > AWS API Documentation < / a > */ @ Override public DescribeDevicePolicyConfigurationResult describeDevicePolicyConfiguration ( DescribeDevicePolicyConfigurationRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDescribeDevicePolicyConfiguration ( request ) ;
public class Property_Builder { /** * Sets the value to be returned by { @ link * org . inferred . freebuilder . processor . property . Property # getGetterName ( ) } . * @ return this { @ code Builder } object * @ throws NullPointerException if { @ code getterName } is null */ public org . inferred . freebuilder . processor . property . Property . Builder setGetterName ( String getterName ) { } }
this . getterName = Objects . requireNonNull ( getterName ) ; _unsetProperties . remove ( Property . GETTER_NAME ) ; return ( org . inferred . freebuilder . processor . property . Property . Builder ) this ;
public class CmsCommentImages { /** * Performs the comment images operation . < p > * @ return true , if the resources were successfully processed , otherwise false * @ throws CmsException if commenting is not successful */ protected boolean performDialogOperation ( ) throws CmsException { } }
// lock the image gallery folder checkLock ( getParamResource ( ) ) ; Iterator < CmsResource > i = getImages ( ) . iterator ( ) ; // loop over all image resources to change the properties while ( i . hasNext ( ) ) { CmsResource res = i . next ( ) ; String imageName = res . getName ( ) ; String propertySuffix = "" + imageName . hashCode ( ) ; // update the title property CmsProperty titleProperty = getCms ( ) . readPropertyObject ( res , CmsPropertyDefinition . PROPERTY_TITLE , false ) ; String newValue = getJsp ( ) . getRequest ( ) . getParameter ( PREFIX_TITLE + propertySuffix ) ; writeProperty ( res , CmsPropertyDefinition . PROPERTY_TITLE , newValue , titleProperty ) ; // update the description property CmsProperty descProperty = getCms ( ) . readPropertyObject ( res , CmsPropertyDefinition . PROPERTY_DESCRIPTION , false ) ; newValue = getJsp ( ) . getRequest ( ) . getParameter ( PREFIX_DESCRIPTION + propertySuffix ) ; writeProperty ( res , CmsPropertyDefinition . PROPERTY_DESCRIPTION , newValue , descProperty ) ; } return true ;
public class AbstractCommonShapeFileWriter { /** * Write the Shape file and its associated files . * @ param elements are the elements to write down * @ throws IOException in case of error . */ public void write ( Collection < ? extends E > elements ) throws IOException { } }
final Progression progressBar = getTaskProgression ( ) ; Progression subTask = null ; if ( progressBar != null ) { progressBar . setProperties ( 0 , 0 , ( elements . size ( ) + 1 ) * 100 , false ) ; } if ( this . fileBounds == null ) { this . fileBounds = getFileBounds ( ) ; } if ( this . fileBounds != null ) { writeHeader ( this . fileBounds , this . elementType , elements ) ; if ( progressBar != null ) { progressBar . setValue ( 100 ) ; subTask = progressBar . subTask ( elements . size ( ) * 100 ) ; subTask . setProperties ( 0 , 0 , elements . size ( ) , false ) ; } for ( final E element : elements ) { writeElement ( this . recordIndex , element , this . elementType ) ; if ( subTask != null ) { subTask . setValue ( this . recordIndex + 1 ) ; } ++ this . recordIndex ; } } else { throw new BoundsNotFoundException ( ) ; } if ( progressBar != null ) { progressBar . end ( ) ; }
public class Pages { /** * Inserts a widget into the tab panel . If the Widget is already attached to * the TabPanel , it will be moved to the requested index . * @ param widget the widget to be inserted * @ param tabText the text to be shown on its tab * @ param asHTML < code > true < / code > to treat the specified text as HTML * @ param beforeIndex the index before which it will be inserted */ public void insert ( Widget widget , String tabText , boolean asHTML , int beforeIndex ) { } }
// Delegate updates to the TabBar to our DeckPanel implementation deck . insertProtected ( widget , tabText , asHTML , beforeIndex ) ;
public class Period { /** * Returns a copy of this period with the specified days subtracted . * This subtracts the amount from the days unit in a copy of this period . * The years and months units are unaffected . * For example , " 1 year , 6 months and 3 days " minus 2 days returns " 1 year , 6 months and 1 day " . * This instance is immutable and unaffected by this method call . * @ param daysToSubtract the months to subtract , positive or negative * @ return a { @ code Period } based on this period with the specified days subtracted , not null * @ throws ArithmeticException if numeric overflow occurs */ public Period minusDays ( long daysToSubtract ) { } }
return ( daysToSubtract == Long . MIN_VALUE ? plusDays ( Long . MAX_VALUE ) . plusDays ( 1 ) : plusDays ( - daysToSubtract ) ) ;
public class ApiOvhOrder { /** * Get prices and contracts information * REST : GET / order / email / pro / { service } / account / { duration } * @ param number [ required ] Number of Accounts to order * @ param service [ required ] The internal name of your pro organization * @ param duration [ required ] Duration */ public OvhOrder email_pro_service_account_duration_GET ( String service , String duration , Long number ) throws IOException { } }
String qPath = "/order/email/pro/{service}/account/{duration}" ; StringBuilder sb = path ( qPath , service , duration ) ; query ( sb , "number" , number ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhOrder . class ) ;
public class AssetDeliveryPolicy { /** * Create an operation that will list all the asset delivery policies at the * given link . * @ param link * Link to request all the asset delivery policies . * @ return The list operation . */ public static DefaultListOperation < AssetDeliveryPolicyInfo > list ( LinkInfo < AssetDeliveryPolicyInfo > link ) { } }
return new DefaultListOperation < AssetDeliveryPolicyInfo > ( link . getHref ( ) , new GenericType < ListResult < AssetDeliveryPolicyInfo > > ( ) { } ) ;
public class AddDynamicSearchAdsCampaign { /** * Runs the example . * @ param adWordsServices the services factory . * @ param session the session . * @ throws ApiException if the API request failed with one or more service errors . * @ throws RemoteException if the API request failed due to other errors . */ public static void runExample ( AdWordsServicesInterface adWordsServices , AdWordsSession session ) throws RemoteException { } }
Budget budget = createBudget ( adWordsServices , session ) ; Campaign campaign = createCampaign ( adWordsServices , session , budget ) ; AdGroup adGroup = createAdGroup ( adWordsServices , session , campaign ) ; createExpandedDSA ( adWordsServices , session , adGroup ) ; addWebPageCriteria ( adWordsServices , session , adGroup ) ;
public class DefaultOAuthAuthorizationCodeService { /** * ~ Methods * * * * * */ @ Transactional @ Override public OAuthAuthorizationCode create ( OAuthAuthorizationCode authCodeEntity ) { } }
requireNotDisposed ( ) ; requireArgument ( StringUtils . isNotBlank ( authCodeEntity . getAuthorizationCode ( ) ) , "authorization_code cannot be null or empty" ) ; requireArgument ( StringUtils . isNotBlank ( authCodeEntity . getState ( ) ) , "state cannot be null or empty" ) ; requireArgument ( StringUtils . isNotBlank ( authCodeEntity . getRedirectUri ( ) ) , "Redirect URI cannot be null or empty" ) ; requireArgument ( authCodeEntity != null , "Cannot update a null authorization code entity" ) ; EntityManager em = emf . get ( ) ; OAuthAuthorizationCode result = em . merge ( authCodeEntity ) ; em . flush ( ) ; _logger . debug ( "Created OAuthAuthorizationCode to : {}" , result ) ; return result ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcRampFlight ( ) { } }
if ( ifcRampFlightEClass == null ) { ifcRampFlightEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 497 ) ; } return ifcRampFlightEClass ;
public class ASN1 { /** * Encode a private key into a PKCS # 8 private key structure . * @ param algorithm - EC curve OID * @ param keyBytes - raw bytes of the key * @ param spki - optional subject public key info structure to include * @ return byte array of encoded bytes * @ throws CoseException - ASN . 1 encoding errors */ public static byte [ ] EncodePKCS8 ( byte [ ] algorithm , byte [ ] keyBytes , byte [ ] spki ) throws CoseException { } }
// PKCS # 8 : : = SEQUENCE { // version INTEGER { 0} // privateKeyALgorithm SEQUENCE { // algorithm OID , // parameters ANY // privateKey ECPrivateKey , // attributes [ 0 ] IMPLICIT Attributes OPTIONAL // publicKey [ 1 ] IMPLICIT BIT STRING OPTIONAL try { ArrayList < byte [ ] > xxx = new ArrayList < byte [ ] > ( ) ; xxx . add ( new byte [ ] { 2 , 1 , 0 } ) ; xxx . add ( algorithm ) ; xxx . add ( OctetStringTag ) ; xxx . add ( ComputeLength ( keyBytes . length ) ) ; xxx . add ( keyBytes ) ; return Sequence ( xxx ) ; } catch ( ArrayIndexOutOfBoundsException e ) { System . out . print ( e . toString ( ) ) ; throw e ; }
public class VBSFaxClientSpi { /** * This function will cancel an existing fax job . * @ param faxJob * The fax job object containing the needed information */ @ Override protected void cancelFaxJobImpl ( FaxJob faxJob ) { } }
String name = VBSFaxClientSpi . VBS_WIN_XP_CANCEL_SCRIPT ; if ( this . useWin2kAPI ) { name = VBSFaxClientSpi . VBS_WIN_2K_CANCEL_SCRIPT ; } // invoke script this . invokeExistingFaxJobAction ( name , faxJob , FaxActionType . CANCEL_FAX_JOB ) ;
public class XElement { /** * Reads the contents of a indexed column as an XML . * @ param rs the result set to read from * @ param index the column index * @ return the parsed XNElement or null if the column contained null * @ throws SQLException on SQL error * @ throws IOException on IO error * @ throws XMLStreamException on parsing error */ public static XElement parseXML ( ResultSet rs , int index ) throws SQLException , IOException , XMLStreamException { } }
try ( InputStream is = rs . getBinaryStream ( index ) ) { if ( is != null ) { return parseXML ( is ) ; } return null ; }
public class MigrationExample { /** * Precondition : * 1 . Make sure the two redis version is same . * 2 . Make sure the single key - value is not very big . ( highly recommend less then 1 MB ) * We running following steps to sync two redis . * 1 . Get rdb stream from source redis . * 2 . Convert source rdb stream to redis dump format . * 3 . Use Jedis RESTORE command to restore that dump format to target redis . * 4 . Get aof stream from source redis and sync to target redis . */ public static void sync ( String sourceUri , String targetUri ) throws IOException , URISyntaxException { } }
RedisURI suri = new RedisURI ( sourceUri ) ; RedisURI turi = new RedisURI ( targetUri ) ; final ExampleClient target = new ExampleClient ( turi . getHost ( ) , turi . getPort ( ) ) ; Configuration tconfig = Configuration . valueOf ( turi ) ; if ( tconfig . getAuthPassword ( ) != null ) { Object auth = target . send ( AUTH , tconfig . getAuthPassword ( ) . getBytes ( ) ) ; System . out . println ( "AUTH:" + auth ) ; } final AtomicInteger dbnum = new AtomicInteger ( - 1 ) ; Replicator r = dress ( new RedisReplicator ( suri ) ) ; r . addEventListener ( new EventListener ( ) { @ Override public void onEvent ( Replicator replicator , Event event ) { if ( event instanceof DumpKeyValuePair ) { DumpKeyValuePair dkv = ( DumpKeyValuePair ) event ; // Step1 : select db DB db = dkv . getDb ( ) ; int index ; if ( db != null && ( index = ( int ) db . getDbNumber ( ) ) != dbnum . get ( ) ) { target . send ( SELECT , toByteArray ( index ) ) ; dbnum . set ( index ) ; System . out . println ( "SELECT:" + index ) ; } // Step2 : restore dump data if ( dkv . getExpiredMs ( ) == null ) { Object r = target . restore ( dkv . getKey ( ) , 0L , dkv . getValue ( ) , true ) ; System . out . println ( r ) ; } else { long ms = dkv . getExpiredMs ( ) - System . currentTimeMillis ( ) ; if ( ms <= 0 ) return ; Object r = target . restore ( dkv . getKey ( ) , ms , dkv . getValue ( ) , true ) ; System . out . println ( r ) ; } } if ( event instanceof DefaultCommand ) { // Step3 : sync aof command DefaultCommand dc = ( DefaultCommand ) event ; Object r = target . send ( dc . getCommand ( ) , dc . getArgs ( ) ) ; System . out . println ( r ) ; } } } ) ; r . addCloseListener ( new CloseListener ( ) { @ Override public void handle ( Replicator replicator ) { target . close ( ) ; } } ) ; r . open ( ) ;
public class CodeBook { /** * returns the number of bits and * modifies a * to the quantization value */ int encodev ( int best , float [ ] a , Buffer b ) { } }
for ( int k = 0 ; k < dim ; k ++ ) { a [ k ] = valuelist [ best * dim + k ] ; } return ( encode ( best , b ) ) ;
public class TaskModel { /** * This method is called from the task class each time an attribute * is added , ensuring that all of the attributes present in each task * record are present in the resource model . * @ param field field identifier */ private void add ( int field ) { } }
if ( field < m_flags . length ) { if ( m_flags [ field ] == false ) { m_flags [ field ] = true ; m_fields [ m_count ] = field ; ++ m_count ; } }
public class HTMLMacro { /** * Parse the passed context using a wiki syntax parser and render the result as an XHTML string . * @ param content the content to parse * @ param transformation the macro transformation to execute macros when wiki is set to true * @ param context the context of the macros transformation process * @ return the output XHTML as a string containing the XWiki Syntax resolved as XHTML * @ throws MacroExecutionException in case there ' s a parsing problem */ private String renderWikiSyntax ( String content , Transformation transformation , MacroTransformationContext context ) throws MacroExecutionException { } }
String xhtml ; try { // Parse the wiki syntax XDOM xdom = this . contentParser . parse ( content , context , false , false ) ; // Force clean = false for sub HTML macro : // - at this point we don ' t know the context of the macro , it can be some < div > directly followed by the // html macro , it this case the macro will be parsed as inline block // - by forcing clean = false , we also make the html macro merge the whole html before cleaning so the cleaner // have the chole context and can clean better List < MacroBlock > macros = xdom . getBlocks ( MACROBLOCKMATCHER , Axes . DESCENDANT ) ; for ( MacroBlock macro : macros ) { if ( "html" . equals ( macro . getId ( ) ) ) { macro . setParameter ( "clean" , "false" ) ; } } MacroBlock htmlMacroBlock = context . getCurrentMacroBlock ( ) ; MacroMarkerBlock htmlMacroMarker = new MacroMarkerBlock ( htmlMacroBlock . getId ( ) , htmlMacroBlock . getParameters ( ) , htmlMacroBlock . getContent ( ) , xdom . getChildren ( ) , htmlMacroBlock . isInline ( ) ) ; // Make sure the context XDOM contains the html macro content htmlMacroBlock . getParent ( ) . replaceChild ( htmlMacroMarker , htmlMacroBlock ) ; try { // Execute the Macro transformation ( ( MutableRenderingContext ) this . renderingContext ) . transformInContext ( transformation , context . getTransformationContext ( ) , htmlMacroMarker ) ; } finally { // Restore context XDOM to its previous state htmlMacroMarker . getParent ( ) . replaceChild ( htmlMacroBlock , htmlMacroMarker ) ; } // Render the whole parsed content as a XHTML string WikiPrinter printer = new DefaultWikiPrinter ( ) ; PrintRenderer renderer = this . xhtmlRendererFactory . createRenderer ( printer ) ; for ( Block block : htmlMacroMarker . getChildren ( ) ) { block . traverse ( renderer ) ; } xhtml = printer . toString ( ) ; } catch ( Exception e ) { throw new MacroExecutionException ( "Failed to parse content [" + content + "]." , e ) ; } return xhtml ;
public class SentenceSeg { /** * loop the reader until the specifield char is found . * @ param echar * @ throws IOException */ protected void readUntil ( char echar ) throws IOException { } }
int ch , i = 0 ; IStringBuffer sb = new IStringBuffer ( ) ; while ( ( ch = readNext ( ) ) != - 1 ) { if ( ++ i >= MAX_QUOTE_LENGTH ) { /* * push back the readed chars * and reset the global idx value . */ for ( int j = sb . length ( ) - 1 ; j >= 0 ; j -- ) { reader . unread ( sb . charAt ( j ) ) ; } idx -= sb . length ( ) ; break ; } sb . append ( ( char ) ch ) ; if ( ch == echar ) { gisb . append ( sb . toString ( ) ) ; break ; } } sb = null ;
public class AbstractRouter { /** * Gets the url of the route handled by the specified action method . This * implementation delegates to { @ link # getReverseRouteFor ( java . lang . Class , String , java . util . Map ) } . * @ param controller the controller object * @ param method the controller method * @ param params map of parameter name - value * @ return the url , { @ literal null } if the action method is not found */ @ Override public String getReverseRouteFor ( Controller controller , String method , Map < String , Object > params ) { } }
return getReverseRouteFor ( controller . getClass ( ) , method , params ) ;
public class DbDevice { public void putPipeProperty ( ArrayList < DbPipe > dbPipes ) throws DevFailed { } }
for ( DbPipe dbPipe : dbPipes ) database . putDevicePipeProperty ( deviceName , dbPipe ) ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getIfcEnergySequenceEnum ( ) { } }
if ( ifcEnergySequenceEnumEEnum == null ) { ifcEnergySequenceEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 832 ) ; } return ifcEnergySequenceEnumEEnum ;
public class Notation { /** * Get local paths for notations * @ param localRepoPath String path * @ param notations List of notations * @ return List of paths * @ throws NaetherException exception */ public static List < String > getLocalPaths ( String localRepoPath , List < String > notations ) throws NaetherException { } }
DefaultServiceLocator locator = new DefaultServiceLocator ( ) ; SimpleLocalRepositoryManagerFactory factory = new SimpleLocalRepositoryManagerFactory ( ) ; factory . initService ( locator ) ; LocalRepository localRepo = new LocalRepository ( localRepoPath ) ; LocalRepositoryManager manager = null ; try { manager = factory . newInstance ( localRepo ) ; } catch ( NoLocalRepositoryManagerException e ) { throw new NaetherException ( "Failed to initial local repository manage" , e ) ; } List < String > localPaths = new ArrayList < String > ( ) ; for ( String notation : notations ) { Dependency dependency = new Dependency ( new DefaultArtifact ( notation ) , "compile" ) ; File path = new File ( localRepo . getBasedir ( ) , manager . getPathForLocalArtifact ( dependency . getArtifact ( ) ) ) ; localPaths . add ( path . toString ( ) ) ; } return localPaths ;
public class MPPUtility { /** * Reads a combined date and time value expressed in tenths of a minute . * @ param data byte array of data * @ param offset location of data as offset into the array * @ return time value */ public static final Date getTimestampFromTenths ( byte [ ] data , int offset ) { } }
long ms = ( ( long ) getInt ( data , offset ) ) * 6000 ; return ( DateHelper . getTimestampFromLong ( EPOCH + ms ) ) ;
public class IntTupleIterables { /** * Returns an iterable returning an iterator that returns * { @ link MutableIntTuple } s up to the given maximum values , in * lexicographical order . < br > * < br > * A copy of the given tuple will be stored internally . < br > * < br > * Also see < a href = " . . / . . / package - summary . html # IterationOrder " > * Iteration Order < / a > * @ param max The maximum values , exclusive * @ return The iterable */ public static Iterable < MutableIntTuple > lexicographicalIterable ( IntTuple max ) { } }
return iterable ( Order . LEXICOGRAPHICAL , IntTuples . zero ( max . getSize ( ) ) , max ) ;
public class AccountFiltersInner { /** * List Account Filters . * List Account Filters in the Media Services account . * @ param resourceGroupName The name of the resource group within the Azure subscription . * @ param accountName The Media Services account name . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; AccountFilterInner & gt ; object */ public Observable < Page < AccountFilterInner > > listAsync ( final String resourceGroupName , final String accountName ) { } }
return listWithServiceResponseAsync ( resourceGroupName , accountName ) . map ( new Func1 < ServiceResponse < Page < AccountFilterInner > > , Page < AccountFilterInner > > ( ) { @ Override public Page < AccountFilterInner > call ( ServiceResponse < Page < AccountFilterInner > > response ) { return response . body ( ) ; } } ) ;
public class MockitoDebuggerImpl { /** * TODO : when MockitoDebugger is deleted , delete this implementation , too */ @ Deprecated public String printInvocations ( Object ... mocks ) { } }
String out = "" ; List < Invocation > invocations = AllInvocationsFinder . find ( asList ( mocks ) ) ; out += line ( "********************************" ) ; out += line ( "*** Mockito interactions log ***" ) ; out += line ( "********************************" ) ; for ( Invocation i : invocations ) { out += line ( i . toString ( ) ) ; out += line ( " invoked: " + i . getLocation ( ) ) ; if ( i . stubInfo ( ) != null ) { out += line ( " stubbed: " + i . stubInfo ( ) . stubbedAt ( ) . toString ( ) ) ; } } invocations = unusedStubsFinder . find ( asList ( mocks ) ) ; if ( invocations . isEmpty ( ) ) { return print ( out ) ; } out += line ( "********************************" ) ; out += line ( "*** Unused stubs ***" ) ; out += line ( "********************************" ) ; for ( Invocation i : invocations ) { out += line ( i . toString ( ) ) ; out += line ( " stubbed: " + i . getLocation ( ) ) ; } return print ( out ) ;
public class WindowsJNIFaxClientSpi { /** * This function will resume an existing fax job . * @ param faxJob * The fax job object containing the needed information */ @ Override protected void resumeFaxJobImpl ( FaxJob faxJob ) { } }
// get fax job ID int faxJobIDInt = WindowsFaxClientSpiHelper . getFaxJobID ( faxJob ) ; // invoke fax action this . winResumeFaxJob ( this . faxServerName , faxJobIDInt ) ;
public class ArithmeticUtils { /** * Negate a number */ public static Number minus ( Number n ) { } }
Number value = normalize ( n ) ; Class < ? > type = value . getClass ( ) ; if ( type == Long . class ) return Long . valueOf ( - n . longValue ( ) ) ; return new Double ( - n . doubleValue ( ) ) ;
public class CounterManager { /** * { @ inheritDoc } */ public synchronized void shutdown ( final boolean killTimer ) { } }
if ( ! m_bShutdown ) { try { // shutdown the counters of this counterManager for ( final ICounter counter : m_aCounters ) if ( counter instanceof ISampledCounter ) ( ( ISampledCounter ) counter ) . shutdown ( ) ; if ( killTimer ) m_aTimer . cancel ( ) ; } finally { m_bShutdown = true ; } }
public class ValidatorWrapper { /** * { @ inheritDoc } */ @ Override public int compareTo ( ValidatorWrapper < T > other ) { } }
if ( this == other || getName ( ) . equals ( other . getName ( ) ) ) { return 0 ; } int result = getPriority ( ) . compareTo ( other . getPriority ( ) ) ; if ( result == 0 ) { result = getInsertionOrder ( ) . compareTo ( other . getInsertionOrder ( ) ) ; } return result ;
public class ExtendedLikeFilterImpl { /** * Convenience method to escape any character that is special to the regex system . * @ param inString * the string to fix * @ return the fixed string */ private String fixSpecials ( final String inString ) { } }
StringBuilder tmp = new StringBuilder ( ) ; for ( int i = 0 ; i < inString . length ( ) ; i ++ ) { char chr = inString . charAt ( i ) ; if ( isSpecial ( chr ) ) { tmp . append ( this . escape ) ; tmp . append ( chr ) ; } else { tmp . append ( chr ) ; } } return tmp . toString ( ) ;
public class SavedState { /** * Get number stored at given location * @ param nameOfField The name of the number to retrieve * @ param defaultValue The value to return if the specified value hasn ' t been set * @ return The number saved at this location */ public double getNumber ( String nameOfField , double defaultValue ) { } }
Double value = ( ( Double ) numericData . get ( nameOfField ) ) ; if ( value == null ) { return defaultValue ; } return value . doubleValue ( ) ;
public class ParameterHistory { /** * Information about the policies assigned to a parameter . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setPolicies ( java . util . Collection ) } or { @ link # withPolicies ( java . util . Collection ) } if you want to override * the existing values . * @ param policies * Information about the policies assigned to a parameter . * @ return Returns a reference to this object so that method calls can be chained together . */ public ParameterHistory withPolicies ( ParameterInlinePolicy ... policies ) { } }
if ( this . policies == null ) { setPolicies ( new com . amazonaws . internal . SdkInternalList < ParameterInlinePolicy > ( policies . length ) ) ; } for ( ParameterInlinePolicy ele : policies ) { this . policies . add ( ele ) ; } return this ;
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getEFG ( ) { } }
if ( efgEClass == null ) { efgEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 243 ) ; } return efgEClass ;
public class Gamma { /** * Gamma function of the specified value . * @ param x Value . * @ return Result . */ public static double Function ( double x ) { } }
double [ ] P = { 1.60119522476751861407E-4 , 1.19135147006586384913E-3 , 1.04213797561761569935E-2 , 4.76367800457137231464E-2 , 2.07448227648435975150E-1 , 4.94214826801497100753E-1 , 9.99999999999999996796E-1 } ; double [ ] Q = { - 2.31581873324120129819E-5 , 5.39605580493303397842E-4 , - 4.45641913851797240494E-3 , 1.18139785222060435552E-2 , 3.58236398605498653373E-2 , - 2.34591795718243348568E-1 , 7.14304917030273074085E-2 , 1.00000000000000000320E0 } ; double p , z ; double q = Math . abs ( x ) ; if ( q > 33.0 ) { if ( x < 0.0 ) { p = Math . floor ( q ) ; if ( p == q ) { try { throw new ArithmeticException ( "Overflow" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } z = q - p ; if ( z > 0.5 ) { p += 1.0 ; z = q - p ; } z = q * Math . sin ( Math . PI * z ) ; if ( z == 0.0 ) { try { throw new ArithmeticException ( "Overflow" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } z = Math . abs ( z ) ; z = Math . PI / ( z * Stirling ( q ) ) ; return - z ; } else { return Stirling ( x ) ; } } z = 1.0 ; while ( x >= 3.0 ) { x -= 1.0 ; z *= x ; } while ( x < 0.0 ) { if ( x == 0.0 ) { throw new ArithmeticException ( ) ; } else if ( x > - 1.0E-9 ) { return ( z / ( ( 1.0 + 0.5772156649015329 * x ) * x ) ) ; } z /= x ; x += 1.0 ; } while ( x < 2.0 ) { if ( x == 0.0 ) { throw new ArithmeticException ( ) ; } else if ( x < 1.0E-9 ) { return ( z / ( ( 1.0 + 0.5772156649015329 * x ) * x ) ) ; } z /= x ; x += 1.0 ; } if ( ( x == 2.0 ) || ( x == 3.0 ) ) return z ; x -= 2.0 ; p = Special . Polevl ( x , P , 6 ) ; q = Special . Polevl ( x , Q , 7 ) ; return z * p / q ;
public class ViewFrustum { /** * Checks if the frustum of this camera intersects the given cuboid vertices . * @ param vertices The cuboid local vertices to check the frustum against * @ param position The position of the cuboid * @ return Whether or not the frustum intersects the cuboid */ public boolean intersectsCuboid ( Vector3f [ ] vertices , Vector3f position ) { } }
return intersectsCuboid ( vertices , position . getX ( ) , position . getY ( ) , position . getZ ( ) ) ;
public class ContextSensitiveCodeRunner { /** * Intended for use with a debugger to evaluate arbitrary expressions / programs * in the context of a source position being debugged , usually at a breakpoint . * @ param enclosingInstance The instance of the object immediately enclosing the source position . * @ param extSyms An array of adjacent name / value pairs corresponding with the names and values of local symbols in scope . * @ param strText The text of the expression / program . * @ param strClassContext The name of the top - level class enclosing the the source position . * @ param strContextElementClass The name of the class immediately enclosing the source position ( can be same as strClassContext ) . * @ param iSourcePosition The index of the source position within the containing file . * @ return The result of the expression or , in the case of a program , the return value of the program . */ public static Object runMeSomeCode ( Object enclosingInstance , ClassLoader cl , Object [ ] extSyms , String strText , final String strClassContext , String strContextElementClass , int iSourcePosition ) { } }
// Must execute in caller ' s classloader try { Class < ? > cls ; try { cls = Class . forName ( ContextSensitiveCodeRunner . class . getName ( ) , false , cl ) ; } catch ( Exception e ) { cls = ContextSensitiveCodeRunner . class ; } Method m = cls . getDeclaredMethod ( "_runMeSomeCode" , Object . class , Object [ ] . class , String . class , String . class , String . class , int . class ) ; m . setAccessible ( true ) ; return m . invoke ( null , enclosingInstance , extSyms , strText , strClassContext , strContextElementClass , iSourcePosition ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; Throwable cause = GosuExceptionUtil . findExceptionCause ( e ) ; if ( cause instanceof ParseResultsException ) { List < IParseIssue > parseExceptions = ( ( ParseResultsException ) cause ) . getParseExceptions ( ) ; if ( parseExceptions != null && parseExceptions . size ( ) >= 0 ) { throw GosuExceptionUtil . forceThrow ( ( Throwable ) parseExceptions . get ( 0 ) ) ; } } throw GosuExceptionUtil . forceThrow ( cause ) ; }
public class JAutoSuggest { /** * Force the suggestions to be displayed ( Useful for buttons * e . g . for using JSuggestionField like a ComboBox ) */ public void showSuggest ( ) { } }
assert ( getText ( ) != null ) ; lastWord = getText ( ) . trim ( ) ; // autoSuggestProvider . getSuggestion ( lastWord ) ; if ( ! getText ( ) . toLowerCase ( ) . contains ( lastWord . toLowerCase ( ) ) ) { suggestions . clear ( ) ; } if ( matcher != null ) { matcher . setStop ( ) ; } matcher = new SuggestionFetcher ( ) ; // SwingUtilities . invokeLater ( matcher ) ; matcher . execute ( ) ; lastWord = getText ( ) . trim ( ) ; updateLocation ( ) ;
public class MarkLogicClient { /** * start Timer task ( write cache ) */ public void initTimer ( ) { } }
stopTimer ( ) ; if ( this . WRITE_CACHE_ENABLED ) { logger . debug ( "configuring write cache with defaults" ) ; timerWriteCache = new TripleWriteCache ( this ) ; writeTimer = new Timer ( ) ; writeTimer . scheduleAtFixedRate ( timerWriteCache , TripleWriteCache . DEFAULT_INITIAL_DELAY , TripleWriteCache . DEFAULT_CACHE_MILLIS ) ; } if ( this . DELETE_CACHE_ENABLED ) { logger . debug ( "configuring delete cache with defaults" ) ; timerDeleteCache = new TripleDeleteCache ( this ) ; deleteTimer = new Timer ( ) ; deleteTimer . scheduleAtFixedRate ( timerDeleteCache , TripleDeleteCache . DEFAULT_INITIAL_DELAY , TripleDeleteCache . DEFAULT_CACHE_MILLIS ) ; }
public class RankingComparator { /** * Compares two solutions according to the ranking attribute . The lower the ranking the better * @ param solution1 Object representing the first solution . * @ param solution2 Object representing the second solution . * @ return - 1 , or 0 , or 1 if o1 is less than , equal , or greater than o2, * respectively . */ @ Override public int compare ( S solution1 , S solution2 ) { } }
int result ; if ( solution1 == null ) { if ( solution2 == null ) { result = 0 ; } else { result = 1 ; } } else if ( solution2 == null ) { result = - 1 ; } else { int rank1 = Integer . MAX_VALUE ; int rank2 = Integer . MAX_VALUE ; if ( ranking . getAttribute ( solution1 ) != null ) { rank1 = ( int ) ranking . getAttribute ( solution1 ) ; } if ( ranking . getAttribute ( solution2 ) != null ) { rank2 = ( int ) ranking . getAttribute ( solution2 ) ; } if ( rank1 < rank2 ) { result = - 1 ; } else if ( rank1 > rank2 ) { result = 1 ; } else { result = 0 ; } } return result ;
public class DatePartitionedNestedRetriever { /** * This method could be overwritten to support more complicated file - loading scheme , * e . g . recursively browsing of the source path . */ protected FileStatus [ ] getFilteredFileStatuses ( Path sourcePath , PathFilter pathFilter ) throws IOException { } }
return this . fs . listStatus ( sourcePath , pathFilter ) ;
public class CommerceTierPriceEntryUtil { /** * Returns all the commerce tier price entries where uuid = & # 63 ; and companyId = & # 63 ; . * @ param uuid the uuid * @ param companyId the company ID * @ return the matching commerce tier price entries */ public static List < CommerceTierPriceEntry > findByUuid_C ( String uuid , long companyId ) { } }
return getPersistence ( ) . findByUuid_C ( uuid , companyId ) ;
public class BaasDocument { /** * Synchronously retrieves the number of document readable to the user that match < code > filter < / code > * in < code > collection < / code > * @ param collection the collection to doCount not < code > null < / code > * @ param filter a filter to apply to the request * @ return the result of the request */ public static BaasResult < Long > countSync ( String collection , BaasQuery . Criteria filter ) { } }
BaasBox box = BaasBox . getDefaultChecked ( ) ; if ( collection == null ) throw new IllegalArgumentException ( "collection cannot be null" ) ; filter = filter == null ? BaasQuery . builder ( ) . count ( true ) . criteria ( ) : filter . buildUpon ( ) . count ( true ) . criteria ( ) ; Count request = new Count ( box , collection , filter , RequestOptions . DEFAULT , null ) ; return box . submitSync ( request ) ;
public class PickerSpinnerAdapter { /** * Finds a spinner item by its id value ( excluding any temporary selection ) . * @ param id The id of the item to search . * @ return The specified TwinTextItem , or null if no item with the given id was found . */ public @ Nullable TwinTextItem getItemById ( int id ) { } }
for ( int index = getCount ( ) - 1 ; index >= 0 ; index -- ) { TwinTextItem item = getItem ( index ) ; if ( item . getId ( ) == id ) return item ; } return null ;
public class UtilValidate { /** * isUSPhoneNumber returns true if string s is a valid U . S . Phone Number . Must be 10 digits . */ public static boolean isUSPhoneNumber ( String s ) { } }
if ( isEmpty ( s ) ) return defaultEmptyOK ; String normalizedPhone = stripCharsInBag ( s , phoneNumberDelimiters ) ; return ( isInteger ( normalizedPhone ) && normalizedPhone . length ( ) == digitsInUSPhoneNumber ) ;
public class ReplacedStep { /** * Groups the idHasContainers by SchemaTable . * Each SchemaTable has a list representing the idHasContainers with the relevant BiPredicate and RecordId * @ return */ private Map < SchemaTable , List < Multimap < BiPredicate , RecordId > > > groupIdsBySchemaTable ( ) { } }
Map < SchemaTable , List < Multimap < BiPredicate , RecordId > > > result = new HashMap < > ( ) ; for ( HasContainer idHasContainer : this . idHasContainers ) { Map < SchemaTable , Boolean > newHasContainerMap = new HashMap < > ( ) ; @ SuppressWarnings ( "unchecked" ) P < Object > idPredicate = ( P < Object > ) idHasContainer . getPredicate ( ) ; BiPredicate biPredicate = idHasContainer . getBiPredicate ( ) ; // This is statement is for g . V ( ) . hasId ( Collection ) where the logic is actually P . within not P . eq if ( biPredicate == Compare . eq && idPredicate . getValue ( ) instanceof Collection && ( ( Collection ) idPredicate . getValue ( ) ) . size ( ) > 1 ) { biPredicate = Contains . within ; } Multimap < BiPredicate , RecordId > biPredicateRecordIdMultimap ; if ( idPredicate . getValue ( ) instanceof Collection ) { @ SuppressWarnings ( "unchecked" ) Collection < Object > ids = ( Collection < Object > ) idPredicate . getValue ( ) ; for ( Object id : ids ) { RecordId recordId = RecordId . from ( id ) ; List < Multimap < BiPredicate , RecordId > > biPredicateRecordIdList = result . get ( recordId . getSchemaTable ( ) ) ; Boolean newHasContainer = newHasContainerMap . get ( recordId . getSchemaTable ( ) ) ; if ( biPredicateRecordIdList == null ) { biPredicateRecordIdList = new ArrayList < > ( ) ; biPredicateRecordIdMultimap = LinkedListMultimap . create ( ) ; biPredicateRecordIdList . add ( biPredicateRecordIdMultimap ) ; result . put ( recordId . getSchemaTable ( ) , biPredicateRecordIdList ) ; newHasContainerMap . put ( recordId . getSchemaTable ( ) , false ) ; } else if ( newHasContainer == null ) { biPredicateRecordIdMultimap = LinkedListMultimap . create ( ) ; biPredicateRecordIdList . add ( biPredicateRecordIdMultimap ) ; newHasContainerMap . put ( recordId . getSchemaTable ( ) , false ) ; } biPredicateRecordIdMultimap = biPredicateRecordIdList . get ( biPredicateRecordIdList . size ( ) - 1 ) ; biPredicateRecordIdMultimap . put ( biPredicate , recordId ) ; } } else { Object id = idPredicate . getValue ( ) ; RecordId recordId = RecordId . from ( id ) ; List < Multimap < BiPredicate , RecordId > > biPredicateRecordIdList = result . computeIfAbsent ( recordId . getSchemaTable ( ) , k -> new ArrayList < > ( ) ) ; biPredicateRecordIdMultimap = LinkedListMultimap . create ( ) ; biPredicateRecordIdList . add ( biPredicateRecordIdMultimap ) ; biPredicateRecordIdMultimap . put ( biPredicate , recordId ) ; } } return result ;
public class MMFF94BasedParameterSetReader { /** * Sets the torsion attribute stored into the parameter set * @ throws Exception Description of the Exception */ private void setTorsion ( ) throws Exception { } }
List data = null ; st . nextToken ( ) ; String scode = st . nextToken ( ) ; // String scode String sid1 = st . nextToken ( ) ; String sid2 = st . nextToken ( ) ; String sid3 = st . nextToken ( ) ; String sid4 = st . nextToken ( ) ; String value1 = st . nextToken ( ) ; String value2 = st . nextToken ( ) ; String value3 = st . nextToken ( ) ; String value4 = st . nextToken ( ) ; String value5 = st . nextToken ( ) ; try { double va1 = new Double ( value1 ) . doubleValue ( ) ; double va2 = new Double ( value2 ) . doubleValue ( ) ; double va3 = new Double ( value3 ) . doubleValue ( ) ; double va4 = new Double ( value4 ) . doubleValue ( ) ; double va5 = new Double ( value5 ) . doubleValue ( ) ; key = "torsion" + scode + ";" + sid1 + ";" + sid2 + ";" + sid3 + ";" + sid4 ; LOG . debug ( "key = " + key ) ; if ( parameterSet . containsKey ( key ) ) { data = ( Vector ) parameterSet . get ( key ) ; data . add ( new Double ( va1 ) ) ; data . add ( new Double ( va2 ) ) ; data . add ( new Double ( va3 ) ) ; data . add ( new Double ( va4 ) ) ; data . add ( new Double ( va5 ) ) ; LOG . debug ( "data = " + data ) ; } else { data = new Vector ( ) ; data . add ( new Double ( va1 ) ) ; data . add ( new Double ( va2 ) ) ; data . add ( new Double ( va3 ) ) ; data . add ( new Double ( va4 ) ) ; data . add ( new Double ( va5 ) ) ; LOG . debug ( "data = " + data ) ; } parameterSet . put ( key , data ) ; } catch ( NumberFormatException nfe ) { throw new IOException ( "setTorsion: Malformed Number due to:" + nfe ) ; }
public class MsgSubstUnitBaseVarNameUtils { /** * Private helper for { @ code genShortestBaseNameForExpr ( ) } and { @ code * genNoncollidingBaseNamesForExprs ( ) } . * < p > Given an expression that ' s a data ref or a global , generates the list of all possible base * names , from short to long . Shortest contains only the last key . Longest contains up to the * first key ( unless there are accesses using expressions to compute non - static keys , in which * case we cannot generate any more base names ) . If no base names can be generated for the given * expression ( i . e . if the expression is not a data ref or global , or the last key is non - static ) , * then returns empty list . * < p > For example , given $ aaa [ 0 ] . bbb . cccDdd , generates the list [ " CCC _ DDD " , " BBB _ CCC _ DDD " , * " AAA _ 0 _ BBB _ CCC _ DDD " ] . One the other hand , given $ aaa [ ' xxx ' ] , generates the empty list ( because * [ ' xxx ' ] parses to a DataRefAccessExprNode ) . * @ param exprNode The expr root of the expression to generate all candidate base names for . * @ return The list of all candidate base names , from shortest to longest . */ @ VisibleForTesting static List < String > genCandidateBaseNamesForExpr ( ExprNode exprNode ) { } }
if ( exprNode instanceof VarRefNode || exprNode instanceof DataAccessNode ) { List < String > baseNames = Lists . newArrayList ( ) ; String baseName = null ; while ( exprNode != null ) { String nameSegment = null ; if ( exprNode instanceof VarRefNode ) { nameSegment = ( ( VarRefNode ) exprNode ) . getName ( ) ; exprNode = null ; } else if ( exprNode instanceof FieldAccessNode ) { FieldAccessNode fieldAccess = ( FieldAccessNode ) exprNode ; nameSegment = fieldAccess . getFieldName ( ) ; exprNode = fieldAccess . getBaseExprChild ( ) ; } else if ( exprNode instanceof ItemAccessNode ) { ItemAccessNode itemAccess = ( ItemAccessNode ) exprNode ; exprNode = itemAccess . getBaseExprChild ( ) ; if ( itemAccess . getKeyExprChild ( ) instanceof IntegerNode ) { // Prefix with index , but don ' t add to baseNames list since it ' s not a valid ident . IntegerNode keyValue = ( IntegerNode ) itemAccess . getKeyExprChild ( ) ; if ( keyValue . getValue ( ) < 0 ) { // Stop if we encounter an invalid key . break ; } nameSegment = Long . toString ( keyValue . getValue ( ) ) ; baseName = BaseUtils . convertToUpperUnderscore ( nameSegment ) + ( ( baseName != null ) ? "_" + baseName : "" ) ; continue ; } else { break ; // Stop if we encounter a non - static key } } else { break ; // Stop if we encounter an expression that is not representable as a name . } baseName = BaseUtils . convertToUpperUnderscore ( nameSegment ) + ( ( baseName != null ) ? "_" + baseName : "" ) ; baseNames . add ( baseName ) ; // new candidate base name whenever we encounter a key } return baseNames ; } else if ( exprNode instanceof GlobalNode ) { String [ ] globalNameParts = ( ( GlobalNode ) exprNode ) . getName ( ) . split ( "\\." ) ; List < String > baseNames = Lists . newArrayList ( ) ; String baseName = null ; for ( int i = globalNameParts . length - 1 ; i >= 0 ; i -- ) { baseName = BaseUtils . convertToUpperUnderscore ( globalNameParts [ i ] ) + ( ( baseName != null ) ? "_" + baseName : "" ) ; baseNames . add ( baseName ) ; } return baseNames ; } else { // We don ' t handle expressions other than data refs and globals . return ImmutableList . of ( ) ; }
public class F0 { /** * Returns a composed function that applies this function to it ' s input and * then applies the { @ code after } function to the result . If evaluation of either * function throws an exception , it is relayed to the caller of the composed * function . * @ param after * the function applies after this function is applied * @ param < T > * the type of the output of the { @ code before } function * @ return the composed function * @ throws NullPointerException * if { @ code before } is null */ public < T > Producer < T > andThen ( final Function < ? super R , ? extends T > after ) { } }
E . NPE ( after ) ; final F0 < R > me = this ; return new Producer < T > ( ) { @ Override public T produce ( ) { return after . apply ( me . apply ( ) ) ; } } ;
public class BELUtilities { /** * Returns { @ code true } if { @ code path } ends with * { @ value PathConstants # BEL _ SCRIPT _ EXTENSION } or * { @ value PathConstants # XBEL _ EXTENSION } , { @ code false } otherwise . * @ param path { @ link String } path * @ return boolean */ public static boolean isBELDocument ( final String path ) { } }
if ( path == null ) { return false ; } if ( path . endsWith ( BEL_SCRIPT_EXTENSION ) ) { return true ; } if ( path . endsWith ( XBEL_EXTENSION ) ) { return true ; } return false ;
public class DescribeInterconnectsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DescribeInterconnectsRequest describeInterconnectsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( describeInterconnectsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeInterconnectsRequest . getInterconnectId ( ) , INTERCONNECTID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DisableDomainAutoRenewRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DisableDomainAutoRenewRequest disableDomainAutoRenewRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( disableDomainAutoRenewRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( disableDomainAutoRenewRequest . getDomainName ( ) , DOMAINNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class SyncMembersInner { /** * Updates an existing sync member . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ param serverName The name of the server . * @ param databaseName The name of the database on which the sync group is hosted . * @ param syncGroupName The name of the sync group on which the sync member is hosted . * @ param syncMemberName The name of the sync member . * @ param parameters The requested sync member resource state . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the SyncMemberInner object if successful . */ public SyncMemberInner update ( String resourceGroupName , String serverName , String databaseName , String syncGroupName , String syncMemberName , SyncMemberInner parameters ) { } }
return updateWithServiceResponseAsync ( resourceGroupName , serverName , databaseName , syncGroupName , syncMemberName , parameters ) . toBlocking ( ) . last ( ) . body ( ) ;
public class WMultiFileWidget { /** * Remove the file . * @ param file the file to remove */ public void removeFile ( final FileWidgetUpload file ) { } }
List < FileWidgetUpload > files = ( List < FileWidgetUpload > ) getData ( ) ; if ( files != null ) { files . remove ( file ) ; if ( files . isEmpty ( ) ) { setData ( null ) ; } }
public class SipServletRequestImpl { /** * ( non - Javadoc ) * @ see javax . servlet . sip . SipServletRequest # setRoutingDirective ( javax . servlet . sip . SipApplicationRoutingDirective , javax . servlet . sip . SipServletRequest ) */ public void setRoutingDirective ( SipApplicationRoutingDirective directive , SipServletRequest origRequest ) throws IllegalStateException { } }
if ( logger . isDebugEnabled ( ) ) { logger . debug ( "setRoutingDirective - directive=" + directive + ", origRequest=" + origRequest ) ; } checkReadOnly ( ) ; SipServletRequestImpl origRequestImpl = ( SipServletRequestImpl ) origRequest ; final MobicentsSipSession session = getSipSession ( ) ; // @ jean . deruelle Commenting this out , why origRequestImpl . isCommitted ( ) is needed ? // if ( ( directive = = SipApplicationRoutingDirective . REVERSE | | directive = = SipApplicationRoutingDirective . CONTINUE ) // & & ( ! origRequestImpl . isInitial ( ) | | origRequestImpl . isCommitted ( ) ) ) { // If directive is CONTINUE or REVERSE , the parameter origRequest must be an // initial request dispatched by the container to this application , // i . e . origRequest . isInitial ( ) must be true if ( ( directive == SipApplicationRoutingDirective . REVERSE || directive == SipApplicationRoutingDirective . CONTINUE ) ) { if ( origRequestImpl == null || ! origRequestImpl . isInitial ( ) ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "directive to set : " + directive ) ; logger . debug ( "Original Request Routing State : " + origRequestImpl . getRoutingState ( ) ) ; } throw new IllegalStateException ( "Bad state -- cannot set routing directive" ) ; } else { // set AR State Info from previous request session . setStateInfo ( origRequestImpl . getSipSession ( ) . getStateInfo ( ) ) ; // needed for application composition currentApplicationName = origRequestImpl . getCurrentApplicationName ( ) ; // linking the requests // FIXME one request can be linked to many more as for B2BUA origRequestImpl . setLinkedRequest ( this ) ; setLinkedRequest ( origRequestImpl ) ; } } else { // This request must be a request created in a new SipSession // or from an initial request , and must not have been sent . // If any one of these preconditions are not met , the method throws an IllegalStateException . Set < Transaction > ongoingTransactions = session . getOngoingTransactions ( ) ; if ( ! State . INITIAL . equals ( session . getState ( ) ) && ongoingTransactions != null && ongoingTransactions . size ( ) > 0 ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "session state : " + session . getState ( ) ) ; logger . debug ( "numbers of ongoing transactions : " + ongoingTransactions . size ( ) ) ; } throw new IllegalStateException ( "Bad state -- cannot set routing directive" ) ; } } routingDirective = directive ; linkedRequest = origRequestImpl ; // @ jean . deruelle Commenting this out , is this really needed ? // RecordRouteHeader rrh = ( RecordRouteHeader ) request // . getHeader ( RecordRouteHeader . NAME ) ; // javax . sip . address . SipURI sipUri = ( javax . sip . address . SipURI ) rrh // . getAddress ( ) . getURI ( ) ; // try { // if ( directive = = SipApplicationRoutingDirective . NEW ) { // sipUri . setParameter ( " rd " , " NEW " ) ; // } else if ( directive = = SipApplicationRoutingDirective . REVERSE ) { // sipUri . setParameter ( " rd " , " REVERSE " ) ; // } else if ( directive = = SipApplicationRoutingDirective . CONTINUE ) { // sipUri . setParameter ( " rd " , " CONTINUE " ) ; // } catch ( Exception ex ) { // String s = " error while setting routing directive " ; // logger . error ( s , ex ) ; // throw new IllegalArgumentException ( s , ex ) ;
public class RESTClient { /** * Add standard headers to the given request and send it . */ private RESTResponse sendAndReceive ( HttpMethod method , String uri , Map < String , String > headers , byte [ ] body ) throws IOException { } }
// Add standard headers assert headers != null ; headers . put ( HttpDefs . HOST , m_host ) ; headers . put ( HttpDefs . ACCEPT , m_acceptFormat . toString ( ) ) ; headers . put ( HttpDefs . CONTENT_LENGTH , Integer . toString ( body == null ? 0 : body . length ) ) ; if ( m_bCompress ) { headers . put ( HttpDefs . ACCEPT_ENCODING , "gzip" ) ; } if ( m_credentials != null ) { String authString = "Basic " + Utils . base64FromString ( m_credentials . getUserid ( ) + ":" + m_credentials . getPassword ( ) ) ; headers . put ( "Authorization" , authString ) ; } // Form the message header . StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( method . toString ( ) ) ; buffer . append ( " " ) ; buffer . append ( addTenantParam ( uri ) ) ; buffer . append ( " HTTP/1.1\r\n" ) ; for ( String name : headers . keySet ( ) ) { buffer . append ( name ) ; buffer . append ( ": " ) ; buffer . append ( headers . get ( name ) ) ; buffer . append ( "\r\n" ) ; } buffer . append ( "\r\n" ) ; m_logger . debug ( "Sending request to uri '{}'; message length={}" , uri , headers . get ( HttpDefs . CONTENT_LENGTH ) ) ; return sendAndReceive ( buffer . toString ( ) , body ) ;
public class ASrvEdit { /** * This is alternative * to avoid problems of overriding Object . equals ( Object other ) * @ param coll1 * @ param coll2 * @ param isOrdered * @ param srvIsEquals * @ return */ @ SuppressWarnings ( "unchecked" ) public < E > boolean isEqualsCollections ( Collection < E > coll1 , Collection < E > coll2 , boolean isOrdered , ISrvIsEquals < E > srvIsEquals ) { } }
if ( ( coll1 == null && coll2 != null ) || ( coll1 != null && coll2 == null ) ) { return false ; } if ( coll1 != null && coll2 != null ) { if ( coll1 . size ( ) != coll2 . size ( ) ) { return false ; } if ( isOrdered ) { Object [ ] arr1 = coll1 . toArray ( ) ; Object [ ] arr2 = coll2 . toArray ( ) ; for ( int i = 0 ; i < coll1 . size ( ) ; i ++ ) { if ( ! srvIsEquals . getIsEquals ( ( E ) arr1 [ i ] , ( E ) arr2 [ i ] ) ) { return false ; } } } else { outer : for ( E e1 : coll1 ) { for ( E e2 : coll2 ) { if ( srvIsEquals . getIsEquals ( e1 , e2 ) ) { continue outer ; } } return false ; } } } return true ;
public class MEDDIT { /** * Computes the medoid of the data * @ param parallel whether or not the computation should be done using multiple cores * @ param X the list of all data * @ param dm the distance metric to get the medoid with respect to * @ return the index of the point in < tt > X < / tt > that is the medoid */ public static int medoid ( boolean parallel , List < ? extends Vec > X , DistanceMetric dm ) { } }
return medoid ( parallel , X , 1.0 / X . size ( ) , dm ) ;
public class Strings { /** * Try to trim a String to the given size . * @ param s The String to trim . * @ param length The trim length . * @ param trimSuffix Flag the specifies if trimming should be applied to the suffix of the String . * @ return */ public static String tryToTrimToSize ( String s , int length , boolean trimSuffix ) { } }
if ( s == null || s . isEmpty ( ) ) { return s ; } else if ( s . length ( ) <= length ) { return s ; } else if ( s . contains ( File . separator ) ) { String before = s . substring ( 0 , s . lastIndexOf ( File . separator ) ) ; String after = s . substring ( s . lastIndexOf ( File . separator ) ) ; if ( ! trimSuffix && length - after . length ( ) > 4 ) { return Strings . tryToTrimToSize ( before , length - after . length ( ) , true ) + after ; } else { return Strings . tryToTrimToSize ( before , length - 3 , true ) + File . separator + ".." ; } } else { return ".." ; }
public class DefaultMailMessageParser { /** * This function returns the file info from the request data . * @ param inputData * The input data * @ return The file info */ @ Override protected FileInfo getFileInfoFromInputDataImpl ( Message inputData ) { } }
FileInfo fileInfo = null ; try { // get file info fileInfo = this . getFileInfo ( inputData ) ; } catch ( MessagingException exception ) { throw new FaxException ( "Unable to extract fax job file data from mail message." , exception ) ; } catch ( IOException exception ) { throw new FaxException ( "Unable to extract fax job file data from mail message." , exception ) ; } return fileInfo ;
public class TypedElementLoader { /** * This method will load instances of all public and non - abstract classes that * implements / extends the interface / class specified as ` value ` option * @ param options must contains an entry indexed with " value " and the value should be a Class type * @ param container the bean spec of the container into which the element will be loaded * @ param genie the dependency injector * @ return the list of bean instances whose class is sub class or implementation of ` hint ` */ @ Override public final Iterable < T > load ( Map < String , Object > options , BeanSpec container , final Genie genie ) { } }
ElementType elementType = ( ElementType ) options . get ( "elementType" ) ; boolean loadNonPublic = ( Boolean ) options . get ( "loadNonPublic" ) ; boolean loadRoot = ( Boolean ) options . get ( "loadRoot" ) ; $ . Var < ElementType > typeVar = $ . var ( elementType ) ; Class < T > targetClass = targetClass ( typeVar , options , container ) ; boolean loadAbstract = typeVar . get ( ) . loadAbstract ( ) && ( Boolean ) options . get ( "loadAbstract" ) ; List < Class < ? extends T > > classes = load ( targetClass , loadNonPublic , loadAbstract , loadRoot ) ; return ( Iterable < T > ) typeVar . get ( ) . transform ( ( List ) classes , genie ) ;
public class Identity { /** * { @ inheritDoc } */ @ Override public < B > Identity < B > flatMap ( Function < ? super A , ? extends Monad < B , Identity < ? > > > f ) { } }
return f . apply ( runIdentity ( ) ) . coerce ( ) ;
public class NettyHelper { /** * 关闭客户端IO线程池 */ public synchronized static void closeClientIOEventGroup ( ) { } }
if ( clientIOEventLoopGroup != null ) { AtomicInteger ref = refCounter . get ( clientIOEventLoopGroup ) ; if ( ref . decrementAndGet ( ) <= 0 ) { if ( ! clientIOEventLoopGroup . isShutdown ( ) && ! clientIOEventLoopGroup . isShuttingDown ( ) ) { clientIOEventLoopGroup . shutdownGracefully ( ) ; } refCounter . remove ( clientIOEventLoopGroup ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Closing Client EventLoopGroup, ref : 0" ) ; } } else { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Client EventLoopGroup still has ref : {}" , ref . get ( ) ) ; } } } clientIOEventLoopGroup = null ;
public class Types { /** * Perform glb for a list of non - primitive , non - error , non - compound types ; * redundant elements are removed . Bounds should be ordered according to * { @ link Symbol # precedes ( TypeSymbol , Types ) } . * @ param flatBounds List of type to glb * @ param errT Original type to use if the result is an error type */ private Type glbFlattened ( List < Type > flatBounds , Type errT ) { } }
List < Type > bounds = closureMin ( flatBounds ) ; if ( bounds . isEmpty ( ) ) { // length = = 0 return syms . objectType ; } else if ( bounds . tail . isEmpty ( ) ) { // length = = 1 return bounds . head ; } else { // length > 1 int classCount = 0 ; List < Type > cvars = List . nil ( ) ; List < Type > lowers = List . nil ( ) ; for ( Type bound : bounds ) { if ( ! bound . isInterface ( ) ) { classCount ++ ; Type lower = cvarLowerBound ( bound ) ; if ( bound != lower && ! lower . hasTag ( BOT ) ) { cvars = cvars . append ( bound ) ; lowers = lowers . append ( lower ) ; } } } if ( classCount > 1 ) { if ( lowers . isEmpty ( ) ) { return createErrorType ( errT ) ; } else { // try again with lower bounds included instead of capture variables List < Type > newBounds = bounds . diff ( cvars ) . appendList ( lowers ) ; return glb ( newBounds ) ; } } } return makeIntersectionType ( bounds ) ;
public class LongStreamEx { /** * Return an ordered stream produced by consecutive calls of the supplied * producer until it returns false . * The producer function may call the passed consumer any number of times * and return true if the producer should be called again or false * otherwise . It ' s guaranteed that the producer will not be called anymore , * once it returns false . * This method is particularly useful when producer changes the mutable * object which should be left in known state after the full stream * consumption . Note however that if a short - circuiting operation is used , * then the final state of the mutable object cannot be guaranteed . * @ param producer a predicate which calls the passed consumer to emit * stream element ( s ) and returns true if it producer should be * applied again . * @ return the new stream * @ since 0.6.0 */ public static LongStreamEx produce ( Predicate < LongConsumer > producer ) { } }
Box < LongEmitter > box = new Box < > ( ) ; return ( box . a = action -> producer . test ( action ) ? box . a : null ) . stream ( ) ;
public class SVGUtil { /** * Remove an element from its parent , if defined . * @ param elem Element to remove */ public static void removeFromParent ( Element elem ) { } }
if ( elem != null && elem . getParentNode ( ) != null ) { elem . getParentNode ( ) . removeChild ( elem ) ; }
public class Files { /** * Returns a buffered writer that writes to a file using the given character set . * @ param file the file to write to * @ param charset the charset used to encode the output stream ; see { @ link StandardCharsets } for * helpful predefined constants * @ return the buffered writer */ public static BufferedWriter newWriter ( File file , Charset charset ) throws FileNotFoundException { } }
checkNotNull ( file ) ; checkNotNull ( charset ) ; return new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( file ) , charset ) ) ;
public class LObjIntConsumerBuilder { /** * Adds full new case for the argument that are of specific classes ( matched by instanceOf , null is a wildcard ) . */ @ Nonnull public < V extends T > LObjIntConsumerBuilder < T > aCase ( Class < V > argC1 , LObjIntConsumer < V > function ) { } }
PartialCase . The pc = partialCaseFactoryMethod ( ( a1 , a2 ) -> ( argC1 == null || argC1 . isInstance ( a1 ) ) ) ; pc . evaluate ( function ) ; return self ( ) ;
public class ThriftConnectionPartition { /** * 添加空闲连接的方法 * @ param thriftConnectionHandle * thrift连接代理对象 * @ throws ThriftConnectionPoolException * 当向连接分区添加空闲连接出现问题时抛出该异常 */ public void addFreeConnection ( ThriftConnectionHandle < T > thriftConnectionHandle ) throws ThriftConnectionPoolException { } }
thriftConnectionHandle . setOriginatingPartition ( this ) ; // 更新创建的连接数 创建数 + 1 updateCreatedConnections ( 1 ) ; if ( ! this . freeConnections . offer ( thriftConnectionHandle ) ) { // 将连接放入队列失败 创建数 - 1 updateCreatedConnections ( - 1 ) ; // 关闭原始连接 thriftConnectionHandle . internalClose ( ) ; }
public class ResourceAdapterImpl { /** * Verify activation spec against bean validation * @ param as The activation spec * @ exception Exception Thrown in case of a violation */ @ SuppressWarnings ( "unchecked" ) private void verifyBeanValidation ( Object as ) throws Exception { } }
if ( beanValidation != null ) { ValidatorFactory vf = null ; try { vf = beanValidation . getValidatorFactory ( ) ; Validator v = vf . getValidator ( ) ; Collection < String > l = bvGroups ; if ( l == null || l . isEmpty ( ) ) l = Arrays . asList ( javax . validation . groups . Default . class . getName ( ) ) ; Collection < Class < ? > > groups = new ArrayList < > ( ) ; for ( String clz : l ) { groups . add ( Class . forName ( clz , true , resourceAdapter . getClass ( ) . getClassLoader ( ) ) ) ; } Set failures = v . validate ( as , groups . toArray ( new Class < ? > [ groups . size ( ) ] ) ) ; if ( ! failures . isEmpty ( ) ) { throw new ConstraintViolationException ( "Violation for " + as , failures ) ; } } finally { if ( vf != null ) vf . close ( ) ; } }
public class DataFormatFilter { /** * Add newline and indentation prior to start tag . * < p > Each tag will begin on a new line , and will be * indented by the current indent step times the number * of ancestors that the element has . < / p > * < p > The newline and indentation will be passed on down * the filter chain through regular characters events . < / p > * @ param uri The element ' s Namespace URI . * @ param localName The element ' s local name . * @ param qName The element ' s qualified ( prefixed ) name . * @ param atts The element ' s attribute list . * @ exception org . xml . sax . SAXException If a filter * further down the chain raises an exception . * @ see org . xml . sax . ContentHandler # startElement */ public void startElement ( String uri , String localName , String qName , Attributes atts ) throws SAXException { } }
if ( ! stateStack . empty ( ) ) { doNewline ( ) ; doIndent ( ) ; } stateStack . push ( SEEN_ELEMENT ) ; state = SEEN_NOTHING ; super . startElement ( uri , localName , qName , atts ) ;
public class DefaultGroovyMethods { /** * Treats the object as iterable , iterating through the values it represents and returns the first non - null result obtained from calling the closure , otherwise returns the defaultResult . * < pre class = " groovyTestCase " > * int [ ] numbers = [ 1 , 2 , 3] * assert numbers . findResult ( 5 ) { if ( it { @ code > } 1 ) return it } = = 2 * assert numbers . findResult ( 5 ) { if ( it { @ code > } 4 ) return it } = = 5 * < / pre > * @ param self an Object with an iterator returning its values * @ param defaultResult an Object that should be returned if all closure results are null * @ param condition a closure that returns a non - null value to indicate that processing should stop and the value should be returned * @ return the first non - null result of the closure , otherwise the default value * @ since 1.7.5 */ public static Object findResult ( Object self , Object defaultResult , Closure condition ) { } }
Object result = findResult ( self , condition ) ; if ( result == null ) return defaultResult ; return result ;
public class AbstractHtmlTableCell { /** * Sets the onMouseOver javascript event for the HTML table cell . * @ param onMouseOver the onMouseOver event . * @ jsptagref . attributedescription The onMouseOver JavaScript event for the HTML table cell . * @ jsptagref . attributesyntaxvalue < i > string _ cellOnMouseOver < / i > * @ netui : attribute required = " false " rtexprvalue = " true " description = " The onMouseOver JavaScript event . " */ public void setCellOnMouseOver ( String onMouseOver ) { } }
_cellState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONMOUSEOVER , onMouseOver ) ;
public class ListDataModel { /** * < p > If row data is available , return the array element at the index * specified by < code > rowIndex < / code > . If no wrapped data is available , * return < code > null < / code > . < / p > * @ throws javax . faces . FacesException if an error occurs getting the row data * @ throws IllegalArgumentException if now row data is available * at the currently specified row index */ public E getRowData ( ) { } }
if ( list == null ) { return ( null ) ; } else if ( ! isRowAvailable ( ) ) { throw new NoRowAvailableException ( ) ; } else { return ( ( E ) list . get ( index ) ) ; }
public class JSONObject { /** * Put a key / long pair in the JSONObject . * @ param key A key string . * @ param value A long which is the value . * @ return this . * @ throws JSONException If the key is null . */ public JSONObject element ( String key , long value ) { } }
verifyIsNull ( ) ; return element ( key , new Long ( value ) ) ;
public class DescribeReplicationTaskAssessmentResultsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DescribeReplicationTaskAssessmentResultsRequest describeReplicationTaskAssessmentResultsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( describeReplicationTaskAssessmentResultsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeReplicationTaskAssessmentResultsRequest . getReplicationTaskArn ( ) , REPLICATIONTASKARN_BINDING ) ; protocolMarshaller . marshall ( describeReplicationTaskAssessmentResultsRequest . getMaxRecords ( ) , MAXRECORDS_BINDING ) ; protocolMarshaller . marshall ( describeReplicationTaskAssessmentResultsRequest . getMarker ( ) , MARKER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class AsyncLibrary { /** * @ see com . ibm . io . async . IAsyncProvider # closeCompletionPort ( long ) */ @ Override public synchronized void closeCompletionPort ( long completionPort ) { } }
final int listSize = completionPorts . size ( ) ; for ( int i = 0 ; i < listSize ; i ++ ) { if ( completionPorts . get ( i ) . longValue ( ) == completionPort ) { try { aio_closeport2 ( completionPort ) ; } catch ( AsyncException ae ) { // just log any errors and continue if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Error closing completion port: " + completionPort + ", error:" + ae . getMessage ( ) ) ; } } completionPorts . remove ( i ) ; break ; } }
public class ServiceBroker { /** * Returns an action by name and nodeID . * @ param actionName * name of the action ( in " service . action " syntax , eg . * " math . add " ) * @ param nodeID * node identifier where the service is located * @ return local or remote action container */ public Action getAction ( String actionName , String nodeID ) { } }
return serviceRegistry . getAction ( actionName , nodeID ) ;