signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class TreeGenerator { /** * / < returns > < / returns > */
public static Primitive anyPrimitive ( Program program , int allowableDepth , TGPInitializationStrategy method , RandEngine randEngine ) { } } | int terminal_count = ( program . getVariableSet ( ) . size ( ) + program . getConstantSet ( ) . size ( ) ) ; int function_count = program . getOperatorSet ( ) . size ( ) ; double terminal_prob = ( double ) terminal_count / ( terminal_count + function_count ) ; if ( allowableDepth <= 0 || ( method == TGPInitializationStrategy . INITIALIZATION_METHOD_GROW && randEngine . uniform ( ) <= terminal_prob ) ) { return program . anyTerminal ( randEngine ) ; } else { return program . anyOperator ( randEngine ) ; } |
public class MutableURI { /** * Sets the host .
* @ param host host */
public void setHost ( String host ) { } } | _host = null ; if ( host != null && host . length ( ) > 0 ) { // Here ' s some very minimal support for IPv6 addresses .
// If the literal IPv6 address is not enclosed in square brackets
// then add them .
boolean needBrackets = ( ( host . indexOf ( ':' ) >= 0 ) && ! host . startsWith ( "[" ) && ! host . endsWith ( "]" ) ) ; if ( needBrackets ) { _host = '[' + host + ']' ; } else { _host = host ; } _opaque = false ; setSchemeSpecificPart ( null ) ; } if ( _host == null ) { setUserInfo ( null ) ; setPort ( UNDEFINED_PORT ) ; } |
public class InstantiateOperation { /** * Tries to initiate an object of the target class through a constructor with the given object as parameter . */
private Object initiateByConstructor ( Class < ? > targetClass , List < Object > objects ) throws Exception { } } | Constructor < ? > constr = targetClass . getConstructor ( getClassList ( objects ) ) ; return constr . newInstance ( objects . toArray ( ) ) ; |
public class CmsBrokenLinkRenderer { /** * Renders the source of a broken link as a list of CmsBrokenLinkBean instances . < p >
* @ param target the broken link target
* @ param source the broken link source
* @ return the list of broken link beans to display to the user
* @ throws CmsException if something goes wrong */
public List < CmsBrokenLinkBean > renderBrokenLink ( CmsResource target , CmsResource source ) throws CmsException { } } | I_CmsResourceType resType = OpenCms . getResourceManager ( ) . getResourceType ( source ) ; String typeName = resType . getTypeName ( ) ; if ( typeName . equals ( CmsResourceTypeXmlContainerPage . INHERIT_CONTAINER_CONFIG_TYPE_NAME ) ) { return renderBrokenLinkInheritanceGroup ( target , source ) ; } else if ( CmsResourceTypeXmlContainerPage . GROUP_CONTAINER_TYPE_NAME . equals ( typeName ) ) { return renderBrokenLinkGroupContainer ( target , source ) ; } else { return renderBrokenLinkDefault ( target , source ) ; } |
public class ClientAuthInterceptor { /** * Generate a JWT - specific service URI . The URI is simply an identifier with enough information
* for a service to know that the JWT was intended for it . The URI will commonly be verified with
* a simple string equality check . */
private URI serviceUri ( Channel channel , MethodDescriptor < ? , ? > method ) throws StatusException { } } | String authority = channel . authority ( ) ; if ( authority == null ) { throw Status . UNAUTHENTICATED . withDescription ( "Channel has no authority" ) . asException ( ) ; } // Always use HTTPS , by definition .
final String scheme = "https" ; final int defaultPort = 443 ; String path = "/" + method . getServiceName ( ) ; URI uri ; try { uri = new URI ( scheme , authority , path , null , null ) ; } catch ( URISyntaxException e ) { throw Status . UNAUTHENTICATED . withDescription ( "Unable to construct service URI for auth" ) . withCause ( e ) . asException ( ) ; } // The default port must not be present . Alternative ports should be present .
if ( uri . getPort ( ) == defaultPort ) { uri = removePort ( uri ) ; } return uri ; |
public class DiscriminatorJdbcBuilder { /** * Add a discriminator matching predicate with its associated type .
* @ param predicate the predicate
* @ param type the type
* @ return the current builder */
public DiscriminatorJdbcSubBuilder when ( Predicate < String > predicate , Type type ) { } } | final DiscriminatorJdbcSubBuilder subBuilder = new DiscriminatorJdbcSubBuilder ( predicate , type ) ; builders . add ( subBuilder ) ; return subBuilder ; |
public class RDFStructureParser { /** * ( non - Javadoc )
* @ see
* io . redlink . sdk . impl . analysis . model . EnhancementsParser # parseEntity ( java
* . lang . String ) */
public Entity parseEntity ( String entityUri , String dataset ) throws EnhancementParserException { } } | try { RepositoryConnection conn = repository . getConnection ( ) ; conn . begin ( ) ; Entity result = parseEntity ( conn , entityUri , dataset ) ; conn . close ( ) ; return result ; } catch ( RepositoryException e ) { throw new EnhancementParserException ( "Error querying the RDF Model obtained as Service Response" , e ) ; } |
public class AbstractPropertyAccessStrategy { /** * Returns the index of the last nested property separator in the given
* property path , ignoring dots in keys ( like " map [ my . key ] " ) . */
protected int getLastPropertySeparatorIndex ( String propertyPath ) { } } | boolean inKey = false ; for ( int i = propertyPath . length ( ) - 1 ; i >= 0 ; i -- ) { switch ( propertyPath . charAt ( i ) ) { case PropertyAccessor . PROPERTY_KEY_SUFFIX_CHAR : inKey = true ; break ; case PropertyAccessor . PROPERTY_KEY_PREFIX_CHAR : return i ; case PropertyAccessor . NESTED_PROPERTY_SEPARATOR_CHAR : if ( ! inKey ) { return i ; } break ; } } return - 1 ; |
public class JMStream { /** * Build reversed stream stream .
* @ param < T > the type parameter
* @ param collection the collection
* @ return the stream */
public static < T > Stream < T > buildReversedStream ( Collection < T > collection ) { } } | return JMCollections . getReversed ( collection ) . stream ( ) ; |
public class VerticalRecordsProcessor { /** * 表の見出しから 、 レコードのJavaクラスの定義にあるカラムの定義で初めて見つかるリストのインデックスを取得する 。
* < p > カラムの定義とは 、 アノテーション 「 @ XlsColumn 」 が付与されたもの 。
* @ param headers 表の見出し情報 。
* @ param recordClass アノテーション 「 @ XlsColumn 」 が定義されたフィールドを持つレコード用のクラス 。
* @ param annoReader { @ link AnnotationReader }
* @ param config システム設定
* @ return 引数 「 headers 」 の該当する要素のインデックス番号 。 不明な場合は0を返す 。 */
private int getStartHeaderIndexForLoading ( final List < RecordHeader > headers , Class < ? > recordClass , final AnnotationReader annoReader , final Configuration config ) { } } | // レコードクラスが不明の場合 、 0を返す 。
if ( ( recordClass == null || recordClass . equals ( Object . class ) ) ) { return 0 ; } for ( int i = 0 ; i < headers . size ( ) ; i ++ ) { RecordHeader headerInfo = headers . get ( i ) ; final List < FieldAccessor > propeties = FieldAccessorUtils . getColumnPropertiesByName ( recordClass , annoReader , config , headerInfo . getLabel ( ) ) . stream ( ) . filter ( p -> p . isReadable ( ) ) . collect ( Collectors . toList ( ) ) ; if ( ! propeties . isEmpty ( ) ) { return i ; } } return 0 ; |
public class PluginClassloaderFactory { /** * A plugin can export some resources to other plugins */
private void exportResources ( PluginClassLoaderDef def , ClassloaderBuilder builder , Collection < PluginClassLoaderDef > allPlugins ) { } } | // export the resources to all other plugins
builder . setExportMask ( def . getBasePluginKey ( ) , def . getExportMask ( ) ) ; for ( PluginClassLoaderDef other : allPlugins ) { if ( ! other . getBasePluginKey ( ) . equals ( def . getBasePluginKey ( ) ) ) { builder . addSibling ( def . getBasePluginKey ( ) , other . getBasePluginKey ( ) , new Mask ( ) ) ; } } |
public class TrustedAdvisorResourceDetail { /** * Additional information about the identified resource . The exact metadata and its order can be obtained by
* inspecting the < a > TrustedAdvisorCheckDescription < / a > object returned by the call to
* < a > DescribeTrustedAdvisorChecks < / a > . < b > Metadata < / b > contains all the data that is shown in the Excel download ,
* even in those cases where the UI shows just summary data .
* @ return Additional information about the identified resource . The exact metadata and its order can be obtained by
* inspecting the < a > TrustedAdvisorCheckDescription < / a > object returned by the call to
* < a > DescribeTrustedAdvisorChecks < / a > . < b > Metadata < / b > contains all the data that is shown in the Excel
* download , even in those cases where the UI shows just summary data . */
public java . util . List < String > getMetadata ( ) { } } | if ( metadata == null ) { metadata = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return metadata ; |
public class EventEngineImpl { /** * Activate the EventEngine implementation . This method will be called by
* OSGi Declarative Services implementation when the component is initially
* activated and when changes to our configuration have occurred .
* @ param componentContext
* the OSGi DS context */
@ Activate protected void activate ( ComponentContext componentContext , Map < String , Object > props ) { } } | this . componentContext = componentContext ; // / / Parse the configuration that we ' ve been provided
// Dictionary < ? , ? > configProperties = componentContext . getProperties ( ) ;
// processConfigProperties ( configProperties ) ;
// Hold a reference to the bundle context
bundleContext = componentContext . getBundleContext ( ) ; // Start listening to the framework events so we can publish them
// as specified in section 113.6.3
frameworkEventAdapter = new FrameworkEventAdapter ( this ) ; bundleContext . addFrameworkListener ( frameworkEventAdapter ) ; // Start listening to the bundle events so we can publish them
// as specified in section 113.6.4
bundleEventAdapter = new BundleEventAdapter ( this ) ; bundleContext . addBundleListener ( bundleEventAdapter ) ; // Start listening to the service events so we can publish them
// as specified in section 113.6.5
serviceEventAdapter = new ServiceEventAdapter ( this ) ; bundleContext . addServiceListener ( serviceEventAdapter ) ; processConfigProperties ( props ) ; |
public class ListExclusionsResult { /** * A list of exclusions ' ARNs returned by the action .
* @ param exclusionArns
* A list of exclusions ' ARNs returned by the action . */
public void setExclusionArns ( java . util . Collection < String > exclusionArns ) { } } | if ( exclusionArns == null ) { this . exclusionArns = null ; return ; } this . exclusionArns = new java . util . ArrayList < String > ( exclusionArns ) ; |
public class RepositoryFileApi { /** * Get file from repository . Allows you to receive information about file in repository like name , size , content .
* Note that file content is Base64 encoded .
* < pre > < code > GitLab Endpoint : GET / projects / : id / repository / files < / code > < / pre >
* @ param filePath ( required ) - Full path to the file . Ex . lib / class . rb
* @ param projectId ( required ) - the project ID
* @ param ref ( required ) - The name of branch , tag or commit
* @ return a RepositoryFile instance with the file info and file content
* @ throws GitLabApiException if any exception occurs
* @ deprecated Will be removed in version 5.0 , replaced by { @ link # getFile ( Object , String , String ) } */
@ Deprecated public RepositoryFile getFile ( String filePath , Integer projectId , String ref ) throws GitLabApiException { } } | if ( isApiVersion ( ApiVersion . V3 ) ) { return ( getFileV3 ( filePath , projectId , ref ) ) ; } else { return ( getFile ( projectId , filePath , ref , true ) ) ; } |
public class FormattedStringBuilder { /** * Appends the stack trace of the Throwable argument to this sequence .
* @ param t Exception to print .
* @ return The updated instance of FormattedStringBuilder . */
public FormattedStringBuilder append ( Throwable t ) { } } | ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; PrintStream p = new PrintStream ( os ) ; t . printStackTrace ( p ) ; p . close ( ) ; return append ( os . toString ( ) ) ; |
public class GeoPackageCoreImpl { /** * { @ inheritDoc } */
@ Override public GeometryColumnsSqlMmDao getGeometryColumnsSqlMmDao ( ) { } } | GeometryColumnsSqlMmDao dao = createDao ( GeometryColumnsSqlMm . class ) ; verifyTableExists ( dao ) ; return dao ; |
public class MaskedCardView { /** * Set the card data displayed using a { @ link Card } object . Note that
* the full number will not be accessed here .
* @ param card the { @ link Card } to be partially displayed */
void setCard ( @ NonNull Card card ) { } } | mCardBrand = card . getBrand ( ) ; mLast4 = card . getLast4 ( ) ; updateBrandIcon ( ) ; updateCardInformation ( ) ; |
public class Session { /** * Adds a value to the session , overwriting an existing value
* @ param key The key to store the value
* @ param value The value to store */
public void put ( String key , String value ) { } } | if ( INVALID_CHRACTERTS . contains ( key ) || INVALID_CHRACTERTS . contains ( value ) ) { LOG . error ( "Session key or value can not contain the following characters: spaces, |, & or :" ) ; } else { this . changed = true ; this . values . put ( key , value ) ; } |
public class SheetBindingErrors { /** * フィールドエラーのビルダーを作成します 。
* @ param field フィールドパス 。
* @ param errorCode エラーコード
* @ return { @ link FieldError } のインスタンスを組み立てるビルダクラス 。 */
public InternalFieldErrorBuilder createFieldError ( final String field , final String errorCode ) { } } | return createFieldError ( field , new String [ ] { errorCode } ) ; |
public class EvaluatorImpl { /** * Multiply two values */
private static Number times ( Number a , Number b ) { } } | int aType = getType ( a ) ; int bType = getType ( b ) ; int compType = ( aType >= bType ) ? aType : bType ; switch ( compType ) { case INT : return new Integer ( a . intValue ( ) * b . intValue ( ) ) ; case LONG : return new Long ( a . longValue ( ) * b . longValue ( ) ) ; case FLOAT : return new Float ( a . floatValue ( ) * b . floatValue ( ) ) ; case DOUBLE : return new Double ( a . doubleValue ( ) * b . doubleValue ( ) ) ; default : throw new IllegalStateException ( ) ; } |
public class ChainedCollectorMapDriver { @ Override public void setup ( AbstractInvokable parent ) { } } | @ SuppressWarnings ( "unchecked" ) final GenericCollectorMap < IT , OT > mapper = RegularPactTask . instantiateUserCode ( this . config , userCodeClassLoader , GenericCollectorMap . class ) ; this . mapper = mapper ; mapper . setRuntimeContext ( getUdfRuntimeContext ( ) ) ; |
public class MessageAction { /** * Sets the { @ link net . dv8tion . jda . core . entities . MessageEmbed MessageEmbed }
* that should be used for this Message .
* Refer to { @ link net . dv8tion . jda . core . EmbedBuilder EmbedBuilder } for more information .
* @ param embed
* The { @ link net . dv8tion . jda . core . entities . MessageEmbed MessageEmbed } that should
* be attached to this message , { @ code null } to use no embed .
* @ throws java . lang . IllegalArgumentException
* If the provided MessageEmbed is not sendable according to
* { @ link net . dv8tion . jda . core . entities . MessageEmbed # isSendable ( net . dv8tion . jda . core . AccountType ) MessageEmbed . isSendable ( AccountType ) } !
* If the provided MessageEmbed is an unknown implementation this operation will fail as we are unable to deserialize it .
* @ return Updated MessageAction for chaining convenience */
@ CheckReturnValue public MessageAction embed ( final MessageEmbed embed ) { } } | if ( embed != null ) { final AccountType type = getJDA ( ) . getAccountType ( ) ; Checks . check ( embed . isSendable ( type ) , "Provided Message contains an empty embed or an embed with a length greater than %d characters, which is the max for %s accounts!" , type == AccountType . BOT ? MessageEmbed . EMBED_MAX_LENGTH_BOT : MessageEmbed . EMBED_MAX_LENGTH_CLIENT , type ) ; } this . embed = embed ; return this ; |
public class ApiOvhTelephony { /** * Compatible rate codes related to this value added service
* REST : GET / telephony / { billingAccount } / rsva / { serviceName } / allowedRateCodes
* @ param billingAccount [ required ] The name of your billingAccount
* @ param serviceName [ required ] */
public ArrayList < OvhRateCodeInformation > billingAccount_rsva_serviceName_allowedRateCodes_GET ( String billingAccount , String serviceName ) throws IOException { } } | String qPath = "/telephony/{billingAccount}/rsva/{serviceName}/allowedRateCodes" ; StringBuilder sb = path ( qPath , billingAccount , serviceName ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t18 ) ; |
public class Cache { /** * Return element for the given key but do not pin the element . In addition ,
* if object is found , add adjustPinCount to the pinned state . < p >
* Note : This method is added to support the scenario in the activation
* strategy classes that multiple cache . unpin ( ) are called immediately
* after the find ( ) operation to negate the pin operation from the
* find ( ) as well as other unpin requires to unwind the other pin
* operation initiated from transaction and / or activation operation .
* This is mainly designed for performance . Typically this will save
* about between 75 to 428 instructions or even more depending on
* the hashcode implementation of the key object . < p >
* @ param key key for the object to locate in the cache .
* @ param adjustPinCount additional pin adjustment count .
* @ return the object from the cache , or null if there is no object
* associated with the key in the cache .
* @ see Cache # pin
* @ see Cache # unpin */
@ Override public Object findDontPinNAdjustPinCount ( Object key , int adjustPinCount ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "findDontPinNAdjustPinCount" , key + ", adujust pin count=" + adjustPinCount ) ; Bucket bucket = getBucketForKey ( key ) ; Object object = null ; if ( bucket != null ) // d739870
{ synchronized ( bucket ) { Element element = bucket . findByKey ( key ) ; if ( element != null ) { // Touch the LRU flag ; since an object cannot be evicted when
// pinned , this is the only time when we bother to set the
// flag
element . accessedSweep = numSweeps ; object = element . object ; element . pinned += adjustPinCount ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "findDontPinNAdjustPinCount" , object ) ; return object ; |
public class SecurityActions { /** * WARNING : Calling this method in non modular context has the side effect to load the Module class .
* This is problematic , the system packages required to properly execute an embedded - server will not
* be correct . */
static < T > T loadAndInstantiateFromModule ( final String moduleId , final Class < T > iface , final String name ) throws Exception { } } | if ( ! WildFlySecurityManager . isChecking ( ) ) { return internalLoadAndInstantiateFromModule ( moduleId , iface , name ) ; } else { try { return doPrivileged ( new PrivilegedExceptionAction < T > ( ) { @ Override public T run ( ) throws Exception { return internalLoadAndInstantiateFromModule ( moduleId , iface , name ) ; } } ) ; } catch ( PrivilegedActionException e ) { Throwable t = e . getCause ( ) ; if ( t instanceof RuntimeException ) { throw ( RuntimeException ) t ; } throw new Exception ( t ) ; } } |
public class BpmnParse { /** * Removes a job declaration which belongs to the given activity and has the given job configuration .
* @ param activity the activity of the job declaration
* @ param jobConfiguration the job configuration of the declaration */
protected void removeMessageJobDeclarationWithJobConfiguration ( ActivityImpl activity , String jobConfiguration ) { } } | List < MessageJobDeclaration > messageJobDeclarations = ( List < MessageJobDeclaration > ) activity . getProperty ( PROPERTYNAME_MESSAGE_JOB_DECLARATION ) ; if ( messageJobDeclarations != null ) { Iterator < MessageJobDeclaration > iter = messageJobDeclarations . iterator ( ) ; while ( iter . hasNext ( ) ) { MessageJobDeclaration msgDecl = iter . next ( ) ; if ( msgDecl . getJobConfiguration ( ) . equalsIgnoreCase ( jobConfiguration ) && msgDecl . getActivityId ( ) . equalsIgnoreCase ( activity . getActivityId ( ) ) ) { iter . remove ( ) ; } } } ProcessDefinition procDef = ( ProcessDefinition ) activity . getProcessDefinition ( ) ; List < JobDeclaration < ? , ? > > declarations = jobDeclarations . get ( procDef . getKey ( ) ) ; if ( declarations != null ) { Iterator < JobDeclaration < ? , ? > > iter = declarations . iterator ( ) ; while ( iter . hasNext ( ) ) { JobDeclaration < ? , ? > jobDcl = iter . next ( ) ; if ( jobDcl . getJobConfiguration ( ) . equalsIgnoreCase ( jobConfiguration ) && jobDcl . getActivityId ( ) . equalsIgnoreCase ( activity . getActivityId ( ) ) ) { iter . remove ( ) ; } } } |
public class ExtensionsHolder { /** * Order extension according to { @ link ru . vyarus . dropwizard . guice . module . installer . order . Order } annotation .
* Installer must implement { @ link ru . vyarus . dropwizard . guice . module . installer . order . Ordered } otherwise
* no order appear . */
public void order ( ) { } } | final OrderComparator comparator = new OrderComparator ( ) ; for ( Class < ? extends FeatureInstaller > installer : installerTypes ) { if ( Ordered . class . isAssignableFrom ( installer ) ) { final List < Class < ? > > extensions = this . extensions . get ( installer ) ; if ( extensions == null || extensions . size ( ) <= 1 ) { continue ; } extensions . sort ( comparator ) ; } } |
public class GeneralizedLogisticDistribution { /** * log Cumulative density function .
* TODO : untested .
* @ param val Value
* @ param loc Location
* @ param scale Scale
* @ param shape Shape
* @ return log PDF */
public static double logcdf ( double val , double loc , double scale , double shape ) { } } | val = ( val - loc ) / scale ; return FastMath . log1p ( FastMath . exp ( - val ) ) * - shape ; |
public class CommercePriceEntryPersistenceImpl { /** * Removes all the commerce price entries where companyId = & # 63 ; from the database .
* @ param companyId the company ID */
@ Override public void removeByCompanyId ( long companyId ) { } } | for ( CommercePriceEntry commercePriceEntry : findByCompanyId ( companyId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( commercePriceEntry ) ; } |
public class AmazonApiGatewayClient { /** * Creates a new < a > RestApi < / a > resource .
* @ param createRestApiRequest
* The POST Request to add a new < a > RestApi < / a > resource to your collection .
* @ return Result of the CreateRestApi operation returned by the service .
* @ throws UnauthorizedException
* The request is denied because the caller has insufficient permissions .
* @ throws LimitExceededException
* The request exceeded the rate limit . Retry after the specified time period .
* @ throws BadRequestException
* The submitted request is not valid , for example , the input is incomplete or incorrect . See the
* accompanying error message for details .
* @ throws TooManyRequestsException
* The request has reached its throttling limit . Retry after the specified time period .
* @ sample AmazonApiGateway . CreateRestApi */
@ Override public CreateRestApiResult createRestApi ( CreateRestApiRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeCreateRestApi ( request ) ; |
public class AbcGrammar { /** * midi - program : : = " program " 1 * WSP [ midi - channel - number 1 * WSP ] midi - program - number */
Rule MidiProgram ( ) { } } | return Sequence ( String ( "program" ) , OneOrMore ( WSP ( ) ) , Optional ( Sequence ( MidiChannelNumber ( ) , OneOrMore ( WSP ( ) ) ) ) , MidiProgramNumber ( ) ) . label ( MidiProgram ) ; |
public class StateDescriptor { /** * Returns the default value . */
public T getDefaultValue ( ) { } } | if ( defaultValue != null ) { if ( serializer != null ) { return serializer . copy ( defaultValue ) ; } else { throw new IllegalStateException ( "Serializer not yet initialized." ) ; } } else { return null ; } |
public class GuidCompressor { /** * Converts a Guid - object into a uncompressed String representation of a GUID
* @ param guid the Guid - object to be converted
* @ return the uncompressed String representation of a GUID */
public static String getUncompressedStringFromGuid ( Guid guid ) { } } | String result = new String ( ) ; result += String . format ( "%1$08x" , guid . Data1 ) ; result += "-" ; result += String . format ( "%1$04x" , guid . Data2 ) ; result += "-" ; result += String . format ( "%1$04x" , guid . Data3 ) ; result += "-" ; result += String . format ( "%1$02x%2$02x" , ( int ) guid . Data4 [ 0 ] , ( int ) guid . Data4 [ 1 ] ) ; result += "-" ; result += String . format ( "%1$02x%2$02x%3$02x%4$02x%5$02x%6$02x" , ( int ) guid . Data4 [ 2 ] , ( int ) guid . Data4 [ 3 ] , ( int ) guid . Data4 [ 4 ] , ( int ) guid . Data4 [ 5 ] , ( int ) guid . Data4 [ 6 ] , ( int ) guid . Data4 [ 7 ] ) ; return result ; |
public class DateTimeUtil { /** * Check Date is " yyyyMMdd "
* @ param val String to check
* @ return boolean
* @ throws BadDateException on format error */
public static boolean isISODate ( final String val ) throws BadDateException { } } | try { if ( val . length ( ) != 8 ) { return false ; } fromISODate ( val ) ; return true ; } catch ( Throwable t ) { return false ; } |
public class Record { /** * Writes the column ' s buffer byte array data into the { @ code column }
* contained by the record buffer .
* @ param colBuffer Column buffer data
* @ param column Column to write
* @ param recBuffer Record buffer
* @ throws InvalidArgument Thrown if either buffer or column is invalid , or
* either buffer is null */
public final void writeColumn ( byte [ ] colBuffer , int column , byte [ ] recBuffer ) { } } | if ( colBuffer == null ) { throw new InvalidArgument ( "colBuffer may not be null" ) ; } else if ( recBuffer == null ) { throw new InvalidArgument ( "recBuffer may not be null" ) ; } else if ( column < 0 || column >= columns . length ) { final String fmt = "invalid column: %d" ; final String msg = format ( fmt , column ) ; throw new InvalidArgument ( msg ) ; } else if ( recBuffer . length != recordSize ) { final String fmt = "invalid record buffer (%d bytes, expected %d)" ; final String msg = format ( fmt , recBuffer . length , recordSize ) ; throw new InvalidArgument ( msg ) ; } int i = 0 , offset = 0 ; for ( ; i < column ; i ++ ) { offset += columns [ i ] . size ; } Column < ? > c = columns [ i ] ; if ( colBuffer . length != c . size ) { final String fmt = "invalid column buffer (%d bytes, expected %d)" ; final String msg = format ( fmt , colBuffer . length , c . size ) ; throw new InvalidArgument ( msg ) ; } arraycopy ( colBuffer , 0 , recBuffer , offset , colBuffer . length ) ; return ; |
public class ServiceDirectoryImpl { /** * Shutdown the ServiceDirectory and the ServiceDirectoryManagerFactory . */
public void shutdown ( ) { } } | synchronized ( this ) { if ( ! isShutdown ) { if ( directoryManagerFactory != null ) { if ( directoryManagerFactory instanceof Closable ) { ( ( Closable ) directoryManagerFactory ) . stop ( ) ; } directoryManagerFactory = null ; } if ( client != null ) { client . close ( ) ; client = null ; } this . isShutdown = true ; } } |
public class AbstractCsiv2SubsystemFactory { /** * { @ inheritDoc } */
@ Override public void register ( ReadyListener listener , Map < String , Object > properties , List < IIOPEndpoint > endpoints ) { } } | String timeoutValue = ( String ) properties . get ( "orbSSLInitTimeout" ) ; if ( timeoutValue != null & timeoutValue . length ( ) > 0 ) { TIMEOUT_SECONDS = Long . valueOf ( timeoutValue ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "TIMEOUT_SECONDS = " + TIMEOUT_SECONDS ) ; } } ReadyRegistration rr = new ReadyRegistration ( extractSslRefs ( properties , endpoints ) , listener ) ; regs . add ( rr ) ; rr . check ( ) ; |
public class NetworkEndpointGroupClient { /** * Creates a network endpoint group in the specified project using the parameters that are
* included in the request .
* < p > Sample code :
* < pre > < code >
* try ( NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient . create ( ) ) {
* ProjectZoneName zone = ProjectZoneName . of ( " [ PROJECT ] " , " [ ZONE ] " ) ;
* NetworkEndpointGroup networkEndpointGroupResource = NetworkEndpointGroup . newBuilder ( ) . build ( ) ;
* Operation response = networkEndpointGroupClient . insertNetworkEndpointGroup ( zone . toString ( ) , networkEndpointGroupResource ) ;
* < / code > < / pre >
* @ param zone The name of the zone where you want to create the network endpoint group . It should
* comply with RFC1035.
* @ param networkEndpointGroupResource Represents a collection of network endpoints .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation insertNetworkEndpointGroup ( String zone , NetworkEndpointGroup networkEndpointGroupResource ) { } } | InsertNetworkEndpointGroupHttpRequest request = InsertNetworkEndpointGroupHttpRequest . newBuilder ( ) . setZone ( zone ) . setNetworkEndpointGroupResource ( networkEndpointGroupResource ) . build ( ) ; return insertNetworkEndpointGroup ( request ) ; |
public class StochasticUtils { /** * - - - - - MOMENTS - - - - - */
public static double getMoment ( Collection < Double > values , int degree ) { } } | return getMoments ( values , Arrays . asList ( degree ) ) . get ( degree ) ; |
public class ConnectionResolver { /** * Resolves a single component connection . If connections are configured to be
* retrieved from Discovery service it finds a IDiscovery and resolves the
* connection there .
* @ param correlationId ( optional ) transaction id to trace execution through
* call chain .
* @ return resolved connection parameters or null if nothing was found .
* @ throws ApplicationException when error occured .
* @ see IDiscovery */
public ConnectionParams resolve ( String correlationId ) throws ApplicationException { } } | if ( _connections . size ( ) == 0 ) return null ; // Return connection that doesn ' t require discovery
for ( ConnectionParams connection : _connections ) { if ( ! connection . useDiscovery ( ) ) return connection ; } // Return connection that require discovery
for ( ConnectionParams connection : _connections ) { if ( connection . useDiscovery ( ) ) { ConnectionParams resolvedConnection = resolveInDiscovery ( correlationId , connection ) ; if ( resolvedConnection != null ) { // Merge configured and new parameters
resolvedConnection = new ConnectionParams ( ConfigParams . mergeConfigs ( connection , resolvedConnection ) ) ; return resolvedConnection ; } } } return null ; |
public class Type { /** * Returns the name of the class corresponding to this type .
* @ return the fully qualified name of the class corresponding to this type . */
public String getClassName ( ) { } } | switch ( sort ) { case VOID : return "void" ; case BOOLEAN : return "boolean" ; case CHAR : return "char" ; case BYTE : return "byte" ; case SHORT : return "short" ; case INT : return "int" ; case FLOAT : return "float" ; case LONG : return "long" ; case DOUBLE : return "double" ; case ARRAY : StringBuffer b = new StringBuffer ( getElementType ( ) . getClassName ( ) ) ; for ( int i = getDimensions ( ) ; i > 0 ; -- i ) { b . append ( "[]" ) ; } return b . toString ( ) ; // case OBJECT :
default : return new String ( buf , off , len ) . replace ( '/' , '.' ) ; } |
public class DescribeSuggestersResult { /** * The suggesters configured for the domain specified in the request .
* @ return The suggesters configured for the domain specified in the request . */
public java . util . List < SuggesterStatus > getSuggesters ( ) { } } | if ( suggesters == null ) { suggesters = new com . amazonaws . internal . SdkInternalList < SuggesterStatus > ( ) ; } return suggesters ; |
public class GetScheduleRequest { /** * check the parameters for validation .
* @ throws OpsGenieClientValidationException when api key is null ! */
@ Override public void validate ( ) throws OpsGenieClientValidationException { } } | super . validate ( ) ; if ( name == null && id == null ) throw OpsGenieClientValidationException . missingMultipleMandatoryProperty ( OpsGenieClientConstants . API . NAME , OpsGenieClientConstants . API . ID ) ; |
public class JavascriptEngine { /** * ( non - Javadoc )
* @ see javax . script . Invocable # invokeFunction ( java . lang . String ,
* java . lang . Object [ ] ) */
@ Override public Object invokeFunction ( String name , Object ... args ) throws ScriptException , NoSuchMethodException { } } | return ( ( Invocable ) scriptEngine ) . invokeFunction ( name , args ) ; |
public class DeleteFleetRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteFleetRequest deleteFleetRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteFleetRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteFleetRequest . getFleetArn ( ) , FLEETARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class UserNameStrValidator { /** * Check that a given string is a well - formed user id .
* @ param value
* Value to check .
* @ return Returns < code > true < / code > if it ' s a valid user id else < code > false < / code > is returned . */
public static final boolean isValid ( final String value ) { } } | if ( value == null ) { return true ; } if ( ( value . length ( ) < 3 ) || ( value . length ( ) > 20 ) ) { return false ; } return PATTERN . matcher ( value . toString ( ) ) . matches ( ) ; |
public class PassthroughResourcesImpl { /** * Issue an HTTP POST request .
* @ param endpoint the API endpoint
* @ param payload a JSON payload string
* @ param parameters optional list of resource parameters
* @ return a JSON response string
* @ throws IllegalArgumentException if any argument is null or empty string
* @ throws InvalidRequestException if there is any problem with the REST API request
* @ throws AuthorizationException if there is any problem with the REST API authorization ( access token )
* @ throws ResourceNotFoundException if the resource cannot be found
* @ throws ServiceUnavailableException if the REST API service is not available ( possibly due to rate limiting )
* @ throws SmartsheetException if there is any other error during the operation */
public String postRequest ( String endpoint , String payload , HashMap < String , Object > parameters ) throws SmartsheetException { } } | Util . throwIfNull ( payload ) ; return passthroughRequest ( HttpMethod . POST , endpoint , payload , parameters ) ; |
public class ConfigurationAsyncClientBuilder { /** * Sets the credentials to use when authenticating HTTP requests . Also , sets the
* { @ link ConfigurationAsyncClientBuilder # serviceEndpoint ( String ) serviceEndpoint } for this ConfigurationAsyncClientBuilder .
* @ param credentials The credentials to use for authenticating HTTP requests .
* @ return The updated ConfigurationAsyncClientBuilder object .
* @ throws NullPointerException If { @ code credentials } is { @ code null } . */
public ConfigurationAsyncClientBuilder credentials ( ConfigurationClientCredentials credentials ) { } } | Objects . requireNonNull ( credentials ) ; this . credentials = credentials ; this . serviceEndpoint = credentials . baseUri ( ) ; return this ; |
public class AppServiceEnvironmentsInner { /** * Create or update an App Service Environment .
* Create or update an App Service Environment .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service Environment .
* @ param hostingEnvironmentEnvelope Configuration details of the App Service Environment .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < AppServiceEnvironmentResourceInner > createOrUpdateAsync ( String resourceGroupName , String name , AppServiceEnvironmentResourceInner hostingEnvironmentEnvelope , final ServiceCallback < AppServiceEnvironmentResourceInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( createOrUpdateWithServiceResponseAsync ( resourceGroupName , name , hostingEnvironmentEnvelope ) , serviceCallback ) ; |
public class DateHelper { /** * Creates a timestamp from the equivalent long value . This conversion
* takes account of the time zone and any daylight savings time .
* @ param timestamp timestamp expressed as a long integer
* @ return new Date instance */
public static Date getTimestampFromLong ( long timestamp ) { } } | TimeZone tz = TimeZone . getDefault ( ) ; Date result = new Date ( timestamp - tz . getRawOffset ( ) ) ; if ( tz . inDaylightTime ( result ) == true ) { int savings ; if ( HAS_DST_SAVINGS == true ) { savings = tz . getDSTSavings ( ) ; } else { savings = DEFAULT_DST_SAVINGS ; } result = new Date ( result . getTime ( ) - savings ) ; } return ( result ) ; |
public class QYWeixinControllerSupport { /** * 绑定微信服务器
* @ param request 请求
* @ return 结果 */
@ RequestMapping ( method = RequestMethod . GET ) @ ResponseBody protected final String bind ( HttpServletRequest request ) { } } | return legalStr ( request ) ; |
public class CommerceOrderNotePersistenceImpl { /** * Returns all the commerce order notes where commerceOrderId = & # 63 ; .
* @ param commerceOrderId the commerce order ID
* @ return the matching commerce order notes */
@ Override public List < CommerceOrderNote > findByCommerceOrderId ( long commerceOrderId ) { } } | return findByCommerceOrderId ( commerceOrderId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; |
public class Model { /** * Fires an state change event every time the data model changes */
protected void fireStateChanged ( ) { } } | Object [ ] listeners = LISTENER_LIST . getListenerList ( ) ; // Process the listeners last to first , notifying
// those that are interested in this event
for ( int i = listeners . length - 2 ; i >= 0 ; i -= 2 ) { if ( listeners [ i ] == javax . swing . event . ChangeListener . class ) { if ( changeEvent == null ) { changeEvent = new javax . swing . event . ChangeEvent ( this ) ; } ( ( javax . swing . event . ChangeListener ) listeners [ i + 1 ] ) . stateChanged ( changeEvent ) ; } } |
public class StreamingJobsInner { /** * Updates an existing streaming job . This can be used to partially update ( ie . update one or two properties ) a streaming job without affecting the rest the job definition .
* @ 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 jobName The name of the streaming job .
* @ param streamingJob A streaming job object . The properties specified here will overwrite the corresponding properties in the existing streaming job ( ie . Those properties will be updated ) . Any properties that are set to null here will mean that the corresponding property in the existing input will remain the same and not change as a result of this PATCH operation .
* @ param ifMatch The ETag of the streaming job . Omit this value to always overwrite the current record set . Specify the last - seen ETag value to prevent accidentally overwritting concurrent changes .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the StreamingJobInner object */
public Observable < StreamingJobInner > updateAsync ( String resourceGroupName , String jobName , StreamingJobInner streamingJob , String ifMatch ) { } } | return updateWithServiceResponseAsync ( resourceGroupName , jobName , streamingJob , ifMatch ) . map ( new Func1 < ServiceResponseWithHeaders < StreamingJobInner , StreamingJobsUpdateHeaders > , StreamingJobInner > ( ) { @ Override public StreamingJobInner call ( ServiceResponseWithHeaders < StreamingJobInner , StreamingJobsUpdateHeaders > response ) { return response . body ( ) ; } } ) ; |
public class SamplingRuleMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SamplingRule samplingRule , ProtocolMarshaller protocolMarshaller ) { } } | if ( samplingRule == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( samplingRule . getRuleName ( ) , RULENAME_BINDING ) ; protocolMarshaller . marshall ( samplingRule . getRuleARN ( ) , RULEARN_BINDING ) ; protocolMarshaller . marshall ( samplingRule . getResourceARN ( ) , RESOURCEARN_BINDING ) ; protocolMarshaller . marshall ( samplingRule . getPriority ( ) , PRIORITY_BINDING ) ; protocolMarshaller . marshall ( samplingRule . getFixedRate ( ) , FIXEDRATE_BINDING ) ; protocolMarshaller . marshall ( samplingRule . getReservoirSize ( ) , RESERVOIRSIZE_BINDING ) ; protocolMarshaller . marshall ( samplingRule . getServiceName ( ) , SERVICENAME_BINDING ) ; protocolMarshaller . marshall ( samplingRule . getServiceType ( ) , SERVICETYPE_BINDING ) ; protocolMarshaller . marshall ( samplingRule . getHost ( ) , HOST_BINDING ) ; protocolMarshaller . marshall ( samplingRule . getHTTPMethod ( ) , HTTPMETHOD_BINDING ) ; protocolMarshaller . marshall ( samplingRule . getURLPath ( ) , URLPATH_BINDING ) ; protocolMarshaller . marshall ( samplingRule . getVersion ( ) , VERSION_BINDING ) ; protocolMarshaller . marshall ( samplingRule . getAttributes ( ) , ATTRIBUTES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class DataDirEntry { /** * Returns the section table entry of the section that the data directory
* entry is pointing to .
* @ param table
* @ return the section table entry of the section that the data directory
* entry is pointing to
* @ throws IllegalStateException
* if data dir entry is not in a section */
public SectionHeader getSectionTableEntry ( SectionTable table ) { } } | Optional < SectionHeader > entry = maybeGetSectionTableEntry ( table ) ; if ( entry . isPresent ( ) ) { return entry . get ( ) ; } throw new IllegalStateException ( "there is no section for this data directory entry" ) ; |
public class VertxCompletableFuture { /** * Creates a new { @ link VertxCompletableFuture } from the given { @ link Vertx } instance and given
* { @ link CompletableFuture } . The returned future uses the current Vert . x context , or creates a new one .
* The created { @ link VertxCompletableFuture } is completed successfully or not when the given completable future
* completes successfully or not .
* @ param vertx the Vert . x instance
* @ param future the future
* @ param < T > the type of the result
* @ return the new { @ link VertxCompletableFuture } */
public static < T > VertxCompletableFuture < T > from ( Vertx vertx , CompletableFuture < T > future ) { } } | return from ( vertx . getOrCreateContext ( ) , future ) ; |
public class KTypeArrayList { /** * { @ inheritDoc } */
@ Override public int indexOf ( KType e1 ) { } } | for ( int i = 0 ; i < elementsCount ; i ++ ) { if ( Intrinsics . equals ( this , e1 , buffer [ i ] ) ) { return i ; } } return - 1 ; |
public class FullDTDReader { /** * Handling of PE matching problems is actually intricate ; one type
* will be a WFC ( " PE Between Declarations " , which refers to PEs that
* start from outside declarations ) , and another just a VC
* ( " Proper Declaration / PE Nesting " , when PE is contained within
* declaration ) */
@ Override protected void handleIncompleteEntityProblem ( WstxInputSource closing ) throws XMLStreamException { } } | // Did it start outside of declaration ?
if ( closing . getScopeId ( ) == 0 ) { // yup
// and being WFC , need not be validating
_reportWFCViolation ( entityDesc ( closing ) + ": " + "Incomplete PE: has to fully contain a declaration (as per xml 1.0.3, section 2.8, WFC 'PE Between Declarations')" ) ; } else { // whereas the other one is only sent in validating mode . .
if ( mCfgFullyValidating ) { _reportVCViolation ( entityDesc ( closing ) + ": " + "Incomplete PE: has to be fully contained in a declaration (as per xml 1.0.3, section 2.8, VC 'Proper Declaration/PE Nesting')" ) ; } } |
public class SAMLCredentialPersonAttributeDao { /** * Per AbstractQueryPersonAttributeDao , this method returns " unmapped
* attributes " which are transformed using the resultAttributeMapping
* collection . Use Attribute . name ( rather than Attribute . friendlyName ) in
* these mapping definitions . */
@ Override protected List < IPersonAttributes > getPeopleForQuery ( QueryBuilder queryBuilder , String queryUserName ) { } } | final String currentUserName = currentUserProvider . getCurrentUserName ( ) ; ; if ( currentUserName == null ) { this . logger . warn ( "A null name was returned by the currentUserProvider, returning null." ) ; return Collections . emptyList ( ) ; } if ( currentUserName . equals ( queryUserName ) ) { if ( this . logger . isDebugEnabled ( ) ) { this . logger . debug ( "Adding attributes from the SAMLCredential for user " + currentUserName ) ; } Authentication authentication = SecurityContextHolder . getContext ( ) . getAuthentication ( ) ; if ( authentication != null ) { SAMLCredential credential = ( SAMLCredential ) authentication . getCredentials ( ) ; if ( credential != null ) { // Provide some optional , TRACE - level logging for what we found
if ( logger . isTraceEnabled ( ) ) { StringBuilder msg = new StringBuilder ( ) ; msg . append ( "Credential obtained!" ) ; for ( Attribute a : credential . getAttributes ( ) ) { msg . append ( "\n a.getName()=" ) . append ( a . getName ( ) ) . append ( "\n a.getFriendlyName()=" ) . append ( a . getFriendlyName ( ) ) ; for ( XMLObject xmlo : a . getAttributeValues ( ) ) { String str = extractStringValue ( xmlo ) ; msg . append ( "\n value=" + str ) ; } } logger . trace ( msg . toString ( ) ) ; } // Marshall what we found into an ( unmapped ) IPersonAttributes object
final Map < String , List < Object > > attributes = new HashMap < > ( ) ; for ( Attribute a : credential . getAttributes ( ) ) { List < Object > list = new ArrayList < Object > ( ) ; for ( XMLObject xmlo : a . getAttributeValues ( ) ) { String str = extractStringValue ( xmlo ) ; if ( str != null ) { list . add ( str ) ; } } attributes . put ( a . getName ( ) , list ) ; } final IPersonAttributes personAttributes = new CaseInsensitiveNamedPersonImpl ( currentUserName , attributes ) ; return Collections . singletonList ( personAttributes ) ; } } } else { // Optionally log the fact that we _ didn ' t _ add attributes
if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Skipping this DAO because " + "!currentUserName.equals(queryUserName); currentUserName=" + currentUserName + ", queryUserName=" + queryUserName ) ; } } return Collections . emptyList ( ) ; |
public class SRTServletResponse { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . webcontainer . core . Response # initForNextResponse ( com . ibm . ws . webcontainer . channel . IWCCResponse ) */
public void initForNextResponse ( IResponse resp ) { } } | if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) // 306998.15
logger . entering ( CLASS_NAME , "initForNextResponse" , "resp = " + resp + " [" + this + "]" ) ; if ( resp == null ) { _rawOut . init ( null ) ; _bufferedWriter . clean ( ) ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) // 306998.15
logger . exiting ( CLASS_NAME , "initForNextResponse" ) ; return ; } // reset the state before initializing it again and before calling setCommonHeaders .
resetState ( ) ; resp . setStatusCode ( 200 ) ; resp . setReason ( REASON_OK ) ; _statusCode = 200 ; // _ responseContext . set ( new SRTServletResponseContext ( ) ) ;
this . _response = resp ; setCommonHeaders ( ) ; try { _rawOut . init ( _response . getOutputStream ( ) ) ; } catch ( IOException e ) { logger . logp ( Level . SEVERE , CLASS_NAME , "initForNextResponse" , "error.initializing.output.stream" , e ) ; /* @283348.1 */
} // LIBERTY _ bufferedOut . reset ( ) ;
_bufferedWriter . reset ( ) ; // LIBERTY _ responseBuffer = null ;
// PK53885 start
_bufferSize = DEFAULT_BUFFER_SIZE ; this . _bufferedOut = createOutputStream ( DEFAULT_BUFFER_SIZE ) ; // LIBERTY
if ( this . _bufferedOut instanceof WCOutputStream ) { ( ( ( WCOutputStream ) this . _bufferedOut ) . getOutput ( ) ) . setObserver ( this ) ; } _encoding = null ; _gotOutputStream = false ; _gotWriter = false ; this . _pwriter = null ; // Pk53885 end
if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) // 306998.15
logger . exiting ( CLASS_NAME , "initForNextResponse" ) ; |
public class GlobalSuffixFinders { /** * Returns the suffix ( plus all of its suffixes , if { @ code allSuffixes } is true ) found by the binary search access
* sequence transformation .
* @ param ceQuery
* the counterexample query
* @ param asTransformer
* the access sequence transformer
* @ param hypOutput
* interface to the hypothesis output
* @ param oracle
* interface to the SUL output
* @ param allSuffixes
* whether or not to include all suffixes of the found suffix
* @ return the distinguishing suffixes
* @ see LocalSuffixFinders # findRivestSchapire ( Query , AccessSequenceTransformer , SuffixOutput , MembershipOracle ) */
public static < I , O > List < Word < I > > findRivestSchapire ( Query < I , O > ceQuery , AccessSequenceTransformer < I > asTransformer , SuffixOutput < I , O > hypOutput , MembershipOracle < I , O > oracle , boolean allSuffixes ) { } } | int idx = LocalSuffixFinders . findRivestSchapire ( ceQuery , asTransformer , hypOutput , oracle ) ; return suffixesForLocalOutput ( ceQuery , idx , allSuffixes ) ; |
public class Events { /** * Returns this object as a list of common event objects .
* @ param ctx
* In case the XML JAXB unmarshalling is used , you have to pass
* the JAXB context here .
* @ return Converted list . */
public List < CommonEvent > asCommonEvents ( final JAXBContext ctx ) { } } | final List < CommonEvent > list = new ArrayList < CommonEvent > ( ) ; for ( final Event event : events ) { list . add ( event . asCommonEvent ( ctx ) ) ; } return list ; |
public class ConnectionPoolManagerImpl { /** * Gets a named connection pool .
* @ param poolName
* The name of the connection pool .
* @ return The named connection pool .
* @ throws ConnectionPoolNotFoundException
* If the specified connection pool cannot be found . */
public ConnectionPool getPool ( String poolName ) throws ConnectionPoolNotFoundException { } } | ConnectionPool connectionPool = null ; try { if ( h_ConnectionPools . containsKey ( poolName ) ) { connectionPool = h_ConnectionPools . get ( poolName ) ; } else { // Error : pool was never initialized or name could not be found
throw new ConnectionPoolNotFoundException ( "Connection pool " + "not found: " + poolName ) ; } } catch ( Throwable th ) { throw new ConnectionPoolNotFoundException ( "The specified connection " + "pool \"" + poolName + "\" could not be found. The underlying " + "error was a " + th . getClass ( ) . getName ( ) + "The message was \"" + th . getMessage ( ) + "\"." ) ; } return connectionPool ; |
public class FileSource { /** * { @ inheritDoc } */
@ Override public InputStream stream ( ) { } } | InputStream stream ; try { stream = new FileInputStream ( file ) ; } catch ( FileNotFoundException e ) { stream = new ByteArrayInputStream ( new byte [ 0 ] ) ; } // create buffered stream
stream = new BufferedInputStream ( stream ) ; return stream ; |
public class Cluster { /** * Get all the supervisors on the specified < code > host < / code > .
* @ param host hostname of the supervisor
* @ return the < code > SupervisorDetails < / code > object . */
public List < SupervisorDetails > getSupervisorsByHost ( String host ) { } } | List < String > nodeIds = this . hostToId . get ( host ) ; List < SupervisorDetails > ret = new ArrayList < > ( ) ; if ( nodeIds != null ) { for ( String nodeId : nodeIds ) { ret . add ( this . getSupervisorById ( nodeId ) ) ; } } return ret ; |
public class DOMConfigurator { /** * Used internally to parse a filter element . */
protected void parseFilters ( Element element , Appender appender ) { } } | String clazz = subst ( element . getAttribute ( CLASS_ATTR ) ) ; Filter filter = ( Filter ) OptionConverter . instantiateByClassName ( clazz , Filter . class , null ) ; if ( filter != null ) { PropertySetter propSetter = new PropertySetter ( filter ) ; NodeList children = element . getChildNodes ( ) ; final int length = children . getLength ( ) ; for ( int loop = 0 ; loop < length ; loop ++ ) { Node currentNode = children . item ( loop ) ; if ( currentNode . getNodeType ( ) == Node . ELEMENT_NODE ) { Element currentElement = ( Element ) currentNode ; String tagName = currentElement . getTagName ( ) ; if ( tagName . equals ( PARAM_TAG ) ) { setParameter ( currentElement , propSetter ) ; } else { quietParseUnrecognizedElement ( filter , currentElement , props ) ; } } } propSetter . activate ( ) ; LogLog . debug ( "Adding filter of type [" + filter . getClass ( ) + "] to appender named [" + appender . getName ( ) + "]." ) ; appender . addFilter ( filter ) ; } |
public class Neighbour { /** * checkForeignSecurityAttributesChanged is called in order to determine
* whether security attributes have changed .
* @ param sub The stored subscription
* @ param foreignSecuredProxy Flag to indicate whether the new proxy sub
* originated from a foreign bus where the home
* bus is secured .
* @ param MESubUserId Userid to be stored when securing foreign proxy subs
* @ return An MESubscription if a new Subscription is created . */
private boolean checkForeignSecurityAttributesChanged ( MESubscription sub , boolean foreignSecuredProxy , String MESubUserId ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkForeignSecurityAttributesChanged" , new Object [ ] { sub , new Boolean ( foreignSecuredProxy ) , MESubUserId } ) ; boolean attrChanged = false ; if ( foreignSecuredProxy ) { if ( sub . isForeignSecuredProxy ( ) ) { // Need to check the userids
if ( MESubUserId != null ) { if ( sub . getMESubUserId ( ) != null ) { // Neither string is null , check whether they
// are equal
if ( ! MESubUserId . equals ( sub . getMESubUserId ( ) ) ) { sub . setMESubUserId ( MESubUserId ) ; attrChanged = true ; } } else { // Stored subscription was null
sub . setMESubUserId ( MESubUserId ) ; attrChanged = true ; } } else // MESubUserid is null
{ if ( sub . getMESubUserId ( ) != null ) { sub . setMESubUserId ( null ) ; attrChanged = true ; } } } else { // The stored subscription was not foreign secured
sub . setForeignSecuredProxy ( true ) ; sub . setMESubUserId ( MESubUserId ) ; attrChanged = true ; } } else // the new proxy sub is not foreign secured
{ if ( sub . isForeignSecuredProxy ( ) ) { // The stored subscription was foreign secured
sub . setForeignSecuredProxy ( false ) ; sub . setMESubUserId ( null ) ; attrChanged = true ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkForeignSecurityAttributesChanged" , new Boolean ( attrChanged ) ) ; return attrChanged ; |
public class Handler { /** * Update the add list . Prepare features , add to main list and notify listeners . */
private void updateAdd ( ) { } } | if ( willAdd ) { for ( final Featurable featurable : toAdd ) { featurables . add ( featurable ) ; for ( final HandlerListener listener : listeners ) { listener . notifyHandlableAdded ( featurable ) ; } if ( featurable . hasFeature ( Transformable . class ) ) { final Transformable transformable = featurable . getFeature ( Transformable . class ) ; transformable . teleport ( transformable . getX ( ) , transformable . getY ( ) ) ; } } toAdd . clear ( ) ; willAdd = false ; } |
public class Table { /** * Returns a pivot on this table , where :
* The first column contains unique values from the index column1
* There are n additional columns , one for each unique value in column2
* The values in each of the cells in these new columns are the result of applying the given AggregateFunction
* to the data in column3 , grouped by the values of column1 and column2 */
public Table pivot ( CategoricalColumn < ? > column1 , CategoricalColumn < ? > column2 , NumberColumn < ? > column3 , AggregateFunction < ? , ? > aggregateFunction ) { } } | return PivotTable . pivot ( this , column1 , column2 , column3 , aggregateFunction ) ; |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getEFM ( ) { } } | if ( efmEClass == null ) { efmEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 244 ) ; } return efmEClass ; |
public class ExecutorsUtils { /** * Shutdown an { @ link ExecutorService } gradually , first disabling new task submissions and
* later cancelling existing tasks .
* This method calls { @ link # shutdownExecutorService ( ExecutorService , Optional , long , TimeUnit ) }
* with default timeout time { @ link # EXECUTOR _ SERVICE _ SHUTDOWN _ TIMEOUT } and time unit
* { @ link # EXECUTOR _ SERVICE _ SHUTDOWN _ TIMEOUT _ TIMEUNIT } .
* @ param executorService the { @ link ExecutorService } to shutdown
* @ param logger an { @ link Optional } wrapping a { @ link Logger } to be used during shutdown */
public static void shutdownExecutorService ( ExecutorService executorService , Optional < Logger > logger ) { } } | shutdownExecutorService ( executorService , logger , EXECUTOR_SERVICE_SHUTDOWN_TIMEOUT , EXECUTOR_SERVICE_SHUTDOWN_TIMEOUT_TIMEUNIT ) ; |
public class CodeBook { /** * returns the number of bits */
int encode ( int a , Buffer b ) { } } | b . write ( codelist [ a ] , c . lengthlist [ a ] ) ; return ( c . lengthlist [ a ] ) ; |
public class DescriptionBuilder { /** * Add a Boolean property
* @ param name name
* @ param defaultValue default
* @ param required true if required
* @ param propTitle optional title
* @ param propDescription optional description
* @ return this builder */
public DescriptionBuilder booleanProperty ( final String name , final String defaultValue , final boolean required , final String propTitle , final String propDescription ) { } } | properties . add ( PropertyUtil . bool ( name , propTitle , propDescription , required , defaultValue ) ) ; return this ; |
public class ImageRetinaApiImpl { /** * { @ inheritDoc } */
@ Override public ByteArrayInputStream getImage ( Integer scalar , ImagePlotShape shape , ImageEncoding imageEncoding , Double sparsity , Model model ) throws JsonProcessingException , ApiException { } } | validateRequiredModels ( model ) ; return getImage ( scalar , shape , imageEncoding , sparsity , model . toJson ( ) ) ; |
public class HandleGetter { /** * Generates a getter on the stated field .
* Used by { @ link HandleData } .
* The difference between this call and the handle method is as follows :
* If there is a { @ code lombok . Getter } annotation on the field , it is used and the
* same rules apply ( e . g . warning if the method already exists , stated access level applies ) .
* If not , the getter is still generated if it isn ' t already there , though there will not
* be a warning if its already there . The default access level is used .
* @ param fieldNode The node representing the field you want a getter for .
* @ param pos The node responsible for generating the getter ( the { @ code @ Data } or { @ code @ Getter } annotation ) . */
public void generateGetterForField ( JavacNode fieldNode , DiagnosticPosition pos , AccessLevel level , boolean lazy , List < JCAnnotation > onMethod ) { } } | if ( hasAnnotation ( Getter . class , fieldNode ) ) { // The annotation will make it happen , so we can skip it .
return ; } createGetterForField ( level , fieldNode , fieldNode , false , lazy , onMethod ) ; |
public class Transfer { /** * Method declaration */
private void saveTable ( ) { } } | if ( tCurrent == null ) { return ; } TransferTable t = tCurrent ; t . Stmts . sSourceTable = tSourceTable . getText ( ) ; t . Stmts . sDestTable = tDestTable . getText ( ) ; t . Stmts . sDestDrop = tDestDrop . getText ( ) ; t . Stmts . sDestCreateIndex = tDestCreateIndex . getText ( ) ; t . Stmts . sDestDropIndex = tDestDropIndex . getText ( ) ; t . Stmts . sDestCreate = tDestCreate . getText ( ) ; t . Stmts . sDestDelete = tDestDelete . getText ( ) ; t . Stmts . sSourceSelect = tSourceSelect . getText ( ) ; t . Stmts . sDestInsert = tDestInsert . getText ( ) ; t . Stmts . sDestAlter = tDestAlter . getText ( ) ; t . Stmts . bTransfer = cTransfer . getState ( ) ; t . Stmts . bDrop = cDrop . getState ( ) ; t . Stmts . bCreate = cCreate . getState ( ) ; t . Stmts . bDelete = cDelete . getState ( ) ; t . Stmts . bInsert = cInsert . getState ( ) ; t . Stmts . bAlter = cAlter . getState ( ) ; t . Stmts . bCreateIndex = cCreateIndex . getState ( ) ; t . Stmts . bDropIndex = cDropIndex . getState ( ) ; if ( ! t . Stmts . bTransfer ) { t . Stmts . bInsert = false ; cInsert . setState ( false ) ; } boolean reparsetable = ( ( t . Stmts . bFKForced != cFKForced . getState ( ) ) || ( t . Stmts . bIdxForced != cIdxForced . getState ( ) ) ) ; t . Stmts . bFKForced = cFKForced . getState ( ) ; t . Stmts . bIdxForced = cIdxForced . getState ( ) ; if ( reparsetable ) { try { sourceDb . getTableStructure ( t , targetDb ) ; } catch ( Exception e ) { trace ( "Exception reading source tables: " + e ) ; e . printStackTrace ( ) ; } } |
public class Requests { /** * Create a { @ link SubscribeRequest } with one { @ link SubscribeElement } .
* @ param el the { @ link SubscribeElement } that is added to the new
* { @ link SubscribeRequest } . This can either be { @ link SubscribeUpdate } or
* { @ link SubscribeDelete } .
* @ return the new { @ link SubscribeRequest } */
public static SubscribeRequest createSubscribeReq ( SubscribeElement el ) { } } | if ( el == null ) { throw new NullPointerException ( "el is not allowed to be null" ) ; } SubscribeRequest ret = createSubscribeReq ( ) ; ret . addSubscribeElement ( el ) ; return ret ; |
public class SparkStream { /** * Maps the objects in the stream by block using the given function
* @ param < R > the component type of the returning stream
* @ param function the function to use to map objects
* @ return the new stream */
public < R > SparkStream < R > mapPartitions ( @ NonNull SerializableFunction < Iterator < ? super T > , ? extends R > function ) { } } | return new SparkStream < > ( rdd . mapPartitions ( iterator -> { Configurator . INSTANCE . configure ( configBroadcast . value ( ) ) ; return Cast . as ( function . apply ( iterator ) ) ; } ) ) ; |
public class CorporationApi { /** * Get alliance history Get a list of all the alliances a corporation has
* been a member of - - - This route is cached for up to 3600 seconds
* @ param corporationId
* An EVE corporation 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 ; List & lt ; CorporationAlliancesHistoryResponse & gt ; & gt ;
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public ApiResponse < List < CorporationAlliancesHistoryResponse > > getCorporationsCorporationIdAlliancehistoryWithHttpInfo ( Integer corporationId , String datasource , String ifNoneMatch ) throws ApiException { } } | com . squareup . okhttp . Call call = getCorporationsCorporationIdAlliancehistoryValidateBeforeCall ( corporationId , datasource , ifNoneMatch , null ) ; Type localVarReturnType = new TypeToken < List < CorporationAlliancesHistoryResponse > > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class AnalysisPass { /** * Instantiate all of the detectors in this pass as objects implementing the
* BCEL - only Detector interface . Detectors that do not support this
* interface will not be created . Therefore , new code should use the
* instantiateDetector2sInPass ( ) method , which can support all detectors .
* @ param bugReporter
* the BugReporter
* @ return array of Detectors
* @ deprecated call instantiateDetector2sInPass ( ) instead */
@ Deprecated public Detector [ ] instantiateDetectorsInPass ( BugReporter bugReporter ) { } } | int count ; count = 0 ; for ( DetectorFactory factory : orderedFactoryList ) { if ( factory . isDetectorClassSubtypeOf ( Detector . class ) ) { count ++ ; } } Detector [ ] detectorList = new Detector [ count ] ; count = 0 ; for ( DetectorFactory factory : orderedFactoryList ) { if ( factory . isDetectorClassSubtypeOf ( Detector . class ) ) { detectorList [ count ++ ] = factory . create ( bugReporter ) ; } } return detectorList ; |
public class Queue { /** * Return first element of the underlying list and remove it . If no element exists , wait ( max . timeout milliseconds )
* until the queue is filled again .
* @ param timeout
* 0 to disable timeout
* @ return the first queue element
* @ throws TimeoutException
* Thrown if timeout is reached while waiting for data in queue
* @ throws ClosedException
* Thrown if queue is already closed
* @ throws InterruptedException
* Might be thrown by the internally used Java - wait method . */
public Object dequeue ( final long timeout ) throws TimeoutException , ClosedException , InterruptedException { } } | return list . remove ( timeout == 0 ? this . timeout : timeout ) ; |
public class NetWorkCenter { /** * 处理HTTP请求
* 基于org . apache . http . client包做了简单的二次封装
* @ param method HTTP请求类型
* @ param url 请求对应的URL地址
* @ param paramData 请求所带参数 , 目前支持JSON格式的参数
* @ param fileList 需要一起发送的文件列表
* @ param callback 请求收到响应后回调函数 , 参数有2个 , 第一个为resultCode , 即响应码 , 比如200为成功 , 404为不存在 , 500为服务器发生错误 ;
* 第二个为resultJson , 即响应回来的数据报文 */
private static void doRequest ( final RequestMethod method , final String url , final String paramData , final List < File > fileList , final ResponseCallback callback ) { } } | // 如果url没有传入 , 则直接返回
if ( null == url || url . isEmpty ( ) ) { LOG . warn ( "The url is null or empty!!You must give it to me!OK?" ) ; return ; } // 默认期望调用者传入callback函数
boolean haveCallback = true ; /* * 支持不传回调函数 , 只输出一个警告 , 并改变haveCallback标识
* 用于一些不需要后续处理的请求 , 比如只是发送一个心跳包等等 */
if ( null == callback ) { LOG . warn ( "--------------no callback block!--------------" ) ; haveCallback = false ; } LOG . debug ( "-----------------请求地址:{}-----------------" , url ) ; // 配置请求参数
RequestConfig config = RequestConfig . custom ( ) . setConnectionRequestTimeout ( CONNECT_TIMEOUT ) . setConnectTimeout ( CONNECT_TIMEOUT ) . setSocketTimeout ( CONNECT_TIMEOUT ) . build ( ) ; CloseableHttpClient client = HttpClientBuilder . create ( ) . setDefaultRequestConfig ( config ) . build ( ) ; HttpUriRequest request = null ; switch ( method ) { case GET : String getUrl = url ; if ( null != paramData ) { getUrl += "?" + paramData ; } request = new HttpGet ( getUrl ) ; break ; case POST : LOG . debug ( "请求入参:" ) ; LOG . debug ( paramData ) ; request = new HttpPost ( url ) ; // 上传文件
if ( null != fileList && ! fileList . isEmpty ( ) ) { LOG . debug ( "上传文件..." ) ; MultipartEntityBuilder builder = MultipartEntityBuilder . create ( ) ; for ( File file : fileList ) { // 只能上传文件哦 ^ _ ^
if ( file . isFile ( ) ) { FileBody fb = new FileBody ( file ) ; builder . addPart ( "media" , fb ) ; } else { // 如果上传内容有不是文件的 , 则不发起本次请求
LOG . warn ( "The target '{}' not a file,please check and try again!" , file . getPath ( ) ) ; return ; } } if ( null != paramData ) { builder . addPart ( "description" , new StringBody ( paramData , ContentType . APPLICATION_JSON ) ) ; } ( ( HttpPost ) request ) . setEntity ( builder . build ( ) ) ; } else { // 不上传文件的普通请求
if ( null != paramData ) { // 目前支持JSON格式的数据
StringEntity jsonEntity = new StringEntity ( paramData , ContentType . APPLICATION_JSON ) ; ( ( HttpPost ) request ) . setEntity ( jsonEntity ) ; } } break ; case PUT : case DELETE : default : LOG . warn ( "-----------------请求类型:{} 暂不支持-----------------" , method . toString ( ) ) ; break ; } CloseableHttpResponse response = null ; try { long start = System . currentTimeMillis ( ) ; // 发起请求
response = client . execute ( request ) ; long time = System . currentTimeMillis ( ) - start ; LOG . debug ( "本次请求'{}'耗时:{}ms" , url . substring ( url . lastIndexOf ( "/" ) + 1 , url . length ( ) ) , time ) ; int resultCode = response . getStatusLine ( ) . getStatusCode ( ) ; HttpEntity entity = response . getEntity ( ) ; // 此流不是操作系统资源 , 不用关闭 , ByteArrayOutputStream源码里close也是个空方法 - 0_0-
// OutputStream os = new ByteArrayOutputStream ( ) ;
// entity . writeTo ( os ) ;
// String resultJson = os . toString ( ) ;
String resultJson = EntityUtils . toString ( entity , UTF_8 ) ; // 返回码200 , 请求成功 ; 其他情况都为请求出现错误
if ( HttpStatus . SC_OK == resultCode ) { LOG . debug ( "-----------------请求成功-----------------" ) ; LOG . debug ( "响应结果:" ) ; LOG . debug ( resultJson ) ; if ( haveCallback ) { callback . onResponse ( resultCode , resultJson ) ; } } else { if ( haveCallback ) { LOG . warn ( "-----------------请求出现错误,错误码:{}-----------------" , resultCode ) ; callback . onResponse ( resultCode , resultJson ) ; } } } catch ( ClientProtocolException e ) { LOG . error ( "ClientProtocolException:" , e ) ; LOG . warn ( "-----------------请求出现异常:{}-----------------" , e . toString ( ) ) ; if ( haveCallback ) { callback . onResponse ( HttpStatus . SC_INTERNAL_SERVER_ERROR , e . toString ( ) ) ; } } catch ( IOException e ) { LOG . error ( "IOException:" , e ) ; LOG . warn ( "-----------------请求出现IO异常:{}-----------------" , e . toString ( ) ) ; if ( haveCallback ) { callback . onResponse ( HttpStatus . SC_INTERNAL_SERVER_ERROR , e . toString ( ) ) ; } } catch ( Exception e ) { LOG . error ( "Exception:" , e ) ; LOG . warn ( "-----------------请求出现其他异常:{}-----------------" , e . toString ( ) ) ; if ( haveCallback ) { callback . onResponse ( HttpStatus . SC_INTERNAL_SERVER_ERROR , e . toString ( ) ) ; } } finally { // abort the request
if ( null != request && ! request . isAborted ( ) ) { request . abort ( ) ; } // close the connection
HttpClientUtils . closeQuietly ( client ) ; HttpClientUtils . closeQuietly ( response ) ; } |
public class SslHandler { /** * Encrypt provided buffer . Encrypted data returned by getOutNetBuffer ( ) .
* @ param src data to encrypt
* @ throws SSLException on errors */
public void encrypt ( ByteBuffer src ) throws SSLException { } } | if ( ! handshakeComplete ) { throw new IllegalStateException ( ) ; } if ( ! src . hasRemaining ( ) ) { if ( outNetBuffer == null ) { outNetBuffer = emptyBuffer ; } return ; } createOutNetBuffer ( src . remaining ( ) ) ; // Loop until there is no more data in src
while ( src . hasRemaining ( ) ) { SSLEngineResult result = sslEngine . wrap ( src , outNetBuffer . buf ( ) ) ; if ( result . getStatus ( ) == SSLEngineResult . Status . OK ) { if ( result . getHandshakeStatus ( ) == SSLEngineResult . HandshakeStatus . NEED_TASK ) { doTasks ( ) ; } } else if ( result . getStatus ( ) == SSLEngineResult . Status . BUFFER_OVERFLOW ) { outNetBuffer . capacity ( outNetBuffer . capacity ( ) << 1 ) ; outNetBuffer . limit ( outNetBuffer . capacity ( ) ) ; } else { throw new SSLException ( "SSLEngine error during encrypt: " + result . getStatus ( ) + " src: " + src + "outNetBuffer: " + outNetBuffer ) ; } } outNetBuffer . flip ( ) ; |
public class SmartBinder { /** * Cast the named argument to the given type .
* @ param name the name of the argument to cast
* @ param type the type to which that argument will be cast
* @ return a new SmartBinder with the cast applied */
public SmartBinder castArg ( String name , Class < ? > type ) { } } | Signature newSig = signature ( ) . replaceArg ( name , name , type ) ; return new SmartBinder ( this , newSig , binder . cast ( newSig . type ( ) ) ) ; |
public class Timer { /** * toc .
* @ return a long . */
public long toc ( ) { } } | Date end = new Date ( ) ; difference = end . getTime ( ) - start . getTime ( ) ; return difference ; |
public class GetDeploymentRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetDeploymentRequest getDeploymentRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getDeploymentRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getDeploymentRequest . getDeploymentId ( ) , DEPLOYMENTID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SnippetsApi { /** * Removes Snippet .
* < pre > < code > GitLab Endpoint : DELETE / snippets / : id < / code > < / pre >
* @ param snippetId the snippet ID to remove
* @ throws GitLabApiException if any exception occurs */
public void deleteSnippet ( Integer snippetId ) throws GitLabApiException { } } | if ( snippetId == null ) { throw new RuntimeException ( "snippetId can't be null" ) ; } delete ( Response . Status . NO_CONTENT , null , "snippets" , snippetId ) ; |
public class ArtifactorySearch { /** * Process the Artifactory response .
* @ param dependency the dependency
* @ param conn the HTTP URL Connection
* @ return a list of the Maven Artifact information
* @ throws IOException thrown if there is an I / O error */
protected List < MavenArtifact > processResponse ( Dependency dependency , HttpURLConnection conn ) throws IOException { } } | final JsonObject asJsonObject ; try ( final InputStreamReader streamReader = new InputStreamReader ( conn . getInputStream ( ) , StandardCharsets . UTF_8 ) ) { asJsonObject = new JsonParser ( ) . parse ( streamReader ) . getAsJsonObject ( ) ; } final JsonArray results = asJsonObject . getAsJsonArray ( "results" ) ; final int numFound = results . size ( ) ; if ( numFound == 0 ) { throw new FileNotFoundException ( "Artifact " + dependency + " not found in Artifactory" ) ; } final List < MavenArtifact > result = new ArrayList < > ( numFound ) ; for ( JsonElement jsonElement : results ) { final JsonObject checksumList = jsonElement . getAsJsonObject ( ) . getAsJsonObject ( "checksums" ) ; final JsonPrimitive sha256Primitive = checksumList . getAsJsonPrimitive ( "sha256" ) ; final String sha1 = checksumList . getAsJsonPrimitive ( "sha1" ) . getAsString ( ) ; final String sha256 = sha256Primitive == null ? null : sha256Primitive . getAsString ( ) ; final String md5 = checksumList . getAsJsonPrimitive ( "md5" ) . getAsString ( ) ; checkHashes ( dependency , sha1 , sha256 , md5 ) ; final String downloadUri = jsonElement . getAsJsonObject ( ) . getAsJsonPrimitive ( "downloadUri" ) . getAsString ( ) ; final String path = jsonElement . getAsJsonObject ( ) . getAsJsonPrimitive ( "path" ) . getAsString ( ) ; final Matcher pathMatcher = PATH_PATTERN . matcher ( path ) ; if ( ! pathMatcher . matches ( ) ) { throw new IllegalStateException ( "Cannot extract the Maven information from the apth retrieved in Artifactory " + path ) ; } final String groupId = pathMatcher . group ( "groupId" ) . replace ( '/' , '.' ) ; final String artifactId = pathMatcher . group ( "artifactId" ) ; final String version = pathMatcher . group ( "version" ) ; result . add ( new MavenArtifact ( groupId , artifactId , version , downloadUri , MavenArtifact . derivePomUrl ( artifactId , version , downloadUri ) ) ) ; } return result ; |
public class GeoPackageExtensions { /** * Delete all table extensions for the table within the GeoPackage
* @ param geoPackage
* GeoPackage
* @ param table
* table name */
public static void deleteTableExtensions ( GeoPackageCore geoPackage , String table ) { } } | // Handle deleting any extensions with extra tables here
NGAExtensions . deleteTableExtensions ( geoPackage , table ) ; deleteRTreeSpatialIndex ( geoPackage , table ) ; deleteRelatedTables ( geoPackage , table ) ; deleteGriddedCoverage ( geoPackage , table ) ; deleteSchema ( geoPackage , table ) ; deleteMetadata ( geoPackage , table ) ; delete ( geoPackage , table ) ; |
public class JQMWidget { /** * Complimentary to setDataFilter ( ) . Sets filter search text of associated JQMFilterable widget . */
public void setFilterSearchText ( String value ) { } } | Element elt = getFilterSearchElt ( ) ; if ( elt == null ) return ; refreshFilterSearch ( elt , value ) ; |
public class MBeanGroup { /** * Extract a metric group name from a JMX ObjectName .
* @ param obj _ name a JMX object name from which to derive a metric name .
* @ param resolvedMap a resolver map to use when generating the group name .
* @ return A metric name for the given ObjectName , with tags . */
private static GroupName nameFromObjectName ( ObjectName obj_name , NamedResolverMap resolvedMap ) { } } | String name = obj_name . getKeyProperty ( "name" ) ; String type = obj_name . getKeyProperty ( "type" ) ; String domain = obj_name . getDomain ( ) ; Map < String , MetricValue > tags = obj_name . getKeyPropertyList ( ) . entrySet ( ) . stream ( ) . filter ( ( entry ) -> ! entry . getKey ( ) . equals ( "name" ) ) . filter ( ( entry ) -> ! entry . getKey ( ) . equals ( "type" ) ) . map ( Tag :: valueOf ) . collect ( Collectors . toMap ( ( Tag t ) -> t . getName ( ) , ( Tag t ) -> t . getValue ( ) ) ) ; final List < String > path = new ArrayList < > ( ) ; if ( name != null ) { path . addAll ( Arrays . asList ( name . split ( "\\." ) ) ) ; } else if ( type != null ) { path . addAll ( Arrays . asList ( domain . split ( "\\." ) ) ) ; path . add ( type ) ; } else { path . addAll ( Arrays . asList ( domain . split ( "\\." ) ) ) ; } return resolvedMap . getGroupName ( path , tags ) ; |
public class Tokenizer { /** * Gets the next token from a tokenizer and parses it as if it were a TTL .
* @ return The next token in the stream , as an unsigned 32 bit integer .
* @ throws TextParseException The input was not valid .
* @ throws IOException An I / O error occurred .
* @ see TTL */
public long getTTLLike ( ) throws IOException { } } | String next = _getIdentifier ( "a TTL-like value" ) ; try { return TTL . parse ( next , false ) ; } catch ( NumberFormatException e ) { throw exception ( "expected a TTL-like value" ) ; } |
public class Database { /** * Finds a unique result from database , converting the database row to given class using default mechanisms .
* @ throws NonUniqueResultException if there is more then one row
* @ throws EmptyResultException if there are no rows */
public < T > T findUnique ( @ NotNull Class < T > cl , @ NotNull SqlQuery query ) { } } | return executeQuery ( rowMapperForClass ( cl ) . unique ( ) , query ) ; |
public class UPropertyAliases { /** * " pnam " */
private void load ( ByteBuffer bytes ) throws IOException { } } | // dataVersion = ICUBinary . readHeaderAndDataVersion ( bytes , DATA _ FORMAT , IS _ ACCEPTABLE ) ;
ICUBinary . readHeader ( bytes , DATA_FORMAT , IS_ACCEPTABLE ) ; int indexesLength = bytes . getInt ( ) / 4 ; // inIndexes [ IX _ VALUE _ MAPS _ OFFSET ] / 4
if ( indexesLength < 8 ) { // formatVersion 2 initially has 8 indexes
throw new IOException ( "pnames.icu: not enough indexes" ) ; } int [ ] inIndexes = new int [ indexesLength ] ; inIndexes [ 0 ] = indexesLength * 4 ; for ( int i = 1 ; i < indexesLength ; ++ i ) { inIndexes [ i ] = bytes . getInt ( ) ; } // Read the valueMaps .
int offset = inIndexes [ IX_VALUE_MAPS_OFFSET ] ; int nextOffset = inIndexes [ IX_BYTE_TRIES_OFFSET ] ; int numInts = ( nextOffset - offset ) / 4 ; valueMaps = ICUBinary . getInts ( bytes , numInts , 0 ) ; // Read the bytesTries .
offset = nextOffset ; nextOffset = inIndexes [ IX_NAME_GROUPS_OFFSET ] ; int numBytes = nextOffset - offset ; bytesTries = new byte [ numBytes ] ; bytes . get ( bytesTries ) ; // Read the nameGroups and turn them from ASCII bytes into a Java String .
offset = nextOffset ; nextOffset = inIndexes [ IX_RESERVED3_OFFSET ] ; numBytes = nextOffset - offset ; StringBuilder sb = new StringBuilder ( numBytes ) ; for ( int i = 0 ; i < numBytes ; ++ i ) { sb . append ( ( char ) bytes . get ( ) ) ; } nameGroups = sb . toString ( ) ; |
public class ActionBuilderImpl { /** * Converts the first character to lower case .
* @ param s the string to convert .
* @ return the converted string . */
private static String lcFirst ( String s ) { } } | if ( s == null || s . isEmpty ( ) ) { return s ; } return Character . toLowerCase ( s . charAt ( 0 ) ) + ( s . length ( ) == 1 ? "" : s . substring ( 1 ) ) ; |
public class PixelTools { /** * Returns true if the colors of all pixels in the array are within the given tolerance
* compared to the referenced color */
public static boolean colorMatches ( Color color , int tolerance , Pixel [ ] pixels ) { } } | if ( tolerance < 0 || tolerance > 255 ) throw new RuntimeException ( "Tolerance value must be between 0 and 255 inclusive" ) ; if ( tolerance == 0 ) return uniform ( color , pixels ) ; else return approx ( color , tolerance , pixels ) ; |
public class GenerateDataKeyWithoutPlaintextRequest { /** * A set of key - value pairs that represents additional authenticated data .
* For more information , see < a
* href = " http : / / docs . aws . amazon . com / kms / latest / developerguide / encryption - context . html " > Encryption Context < / a > in the
* < i > AWS Key Management Service Developer Guide < / i > .
* @ param encryptionContext
* A set of key - value pairs that represents additional authenticated data . < / p >
* For more information , see < a
* href = " http : / / docs . aws . amazon . com / kms / latest / developerguide / encryption - context . html " > Encryption Context < / a >
* in the < i > AWS Key Management Service Developer Guide < / i > .
* @ return Returns a reference to this object so that method calls can be chained together . */
public GenerateDataKeyWithoutPlaintextRequest withEncryptionContext ( java . util . Map < String , String > encryptionContext ) { } } | setEncryptionContext ( encryptionContext ) ; return this ; |
public class TextClassifier { /** * Generates a Dataframe with the predictions for the provided data file .
* The data file should contain the text of one observation per row .
* @ param datasetURI
* @ return */
public Dataframe predict ( URI datasetURI ) { } } | // create a dummy dataset map
Map < Object , URI > dataset = new HashMap < > ( ) ; dataset . put ( null , datasetURI ) ; TrainingParameters trainingParameters = ( TrainingParameters ) knowledgeBase . getTrainingParameters ( ) ; Dataframe testDataset = Dataframe . Builder . parseTextFiles ( dataset , AbstractTextExtractor . newInstance ( trainingParameters . getTextExtractorParameters ( ) ) , knowledgeBase . getConfiguration ( ) ) ; predict ( testDataset ) ; return testDataset ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.