signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ArtifactFactoryConfig { /** * Initializes the object .
* @ param context
* Current context .
* @ param vars
* Variables from all parents .
* @ return This instance . */
@ NotNull public final ArtifactFactoryConfig init ( @ NotNull final SrcGen4JContext context , final Map < String , String > vars ) { } } | Contract . requireArgNotNull ( "context" , context ) ; this . context = context ; inheritVariables ( vars ) ; return this ; |
public class ListSubscriptionsByTopicResult { /** * A list of subscriptions .
* @ return A list of subscriptions . */
public java . util . List < Subscription > getSubscriptions ( ) { } } | if ( subscriptions == null ) { subscriptions = new com . amazonaws . internal . SdkInternalList < Subscription > ( ) ; } return subscriptions ; |
public class Logger { /** * Issue a log message with a level of ERROR .
* @ param message the message */
public void error ( Object message ) { } } | doLog ( Level . ERROR , FQCN , message , null , null ) ; |
public class SecurityContext { /** * Extract the appropriate username from this security context
* @ return */
public String getUserName ( boolean notAlternateUser ) { } } | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getUserName" , new Object [ ] { new Boolean ( notAlternateUser ) } ) ; String userName = null ; if ( ! notAlternateUser // this catches the case where we want the
// user associated with the subject
&& isAlternateUserBased ( ) ) { userName = alternateUser ; } else if ( isSubjectBased ( ) ) { if ( authorisationUtils != null ) { userName = authorisationUtils . getUserName ( subject ) ; } } else if ( isUserIdBased ( ) ) { userName = userId ; } else if ( isMsgBased ( ) ) { userName = msg . getSecurityUserid ( ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getUserName" , userName ) ; return userName ; |
public class Intersectionf { /** * Test whether the ray with the given < code > origin < / code > and normalized direction < code > dir < / code >
* intersects the sphere with the given < code > center < / code > and square radius < code > radiusSquared < / code > ,
* and store the values of the parameter < i > t < / i > in the ray equation < i > p ( t ) = origin + t * dir < / i > for both points ( near
* and far ) of intersections into the given < code > result < / code > vector .
* This method returns < code > true < / code > for a ray whose origin lies inside the sphere .
* Reference : < a href = " http : / / www . scratchapixel . com / lessons / 3d - basic - rendering / minimal - ray - tracer - rendering - simple - shapes / ray - sphere - intersection " > http : / / www . scratchapixel . com / < / a >
* @ param origin
* the ray ' s origin
* @ param dir
* the ray ' s normalized direction
* @ param center
* the sphere ' s center
* @ param radiusSquared
* the sphere radius squared
* @ param result
* a vector that will contain the values of the parameter < i > t < / i > in the ray equation
* < i > p ( t ) = origin + t * dir < / i > for both points ( near , far ) of intersections with the sphere
* @ return < code > true < / code > if the ray intersects the sphere ; < code > false < / code > otherwise */
public static boolean intersectRaySphere ( Vector3fc origin , Vector3fc dir , Vector3fc center , float radiusSquared , Vector2f result ) { } } | return intersectRaySphere ( origin . x ( ) , origin . y ( ) , origin . z ( ) , dir . x ( ) , dir . y ( ) , dir . z ( ) , center . x ( ) , center . y ( ) , center . z ( ) , radiusSquared , result ) ; |
public class MessageBuilder { /** * Appends code to the message .
* @ param language The language , e . g . " java " .
* @ param code The code .
* @ return The current instance in order to chain call methods . */
public MessageBuilder appendCode ( String language , String code ) { } } | delegate . appendCode ( language , code ) ; return this ; |
public class SnackbarBuilder { /** * Add some text to append to the message shown on the Snackbar and a colour to make it .
* @ param messageResId String resource of the text to append to the Snackbar message .
* @ param colorResId Resource of the colour to make the appended text .
* @ return This instance . */
@ SuppressWarnings ( "WeakerAccess" ) public SnackbarBuilder appendMessage ( @ StringRes int messageResId , @ ColorRes int colorResId ) { } } | return appendMessage ( context . getString ( messageResId ) , getColor ( colorResId ) ) ; |
public class PresentationManager { /** * Setter for an object property value
* @ param obj The object
* @ param name The property name
* @ param value The value to set */
public void set ( Object obj , String name , Object value ) { } } | try { PropertyUtils . setNestedProperty ( obj , name , value ) ; } catch ( Exception e ) { error ( e ) ; } |
public class UimaMultiWordExp { /** * / * private static List < Token > groupTokens ( List < Token > toks , List < Span > spans ) {
* if ( spans = = null | | spans . size ( ) = = 0 ) {
* return toks ;
* List < Token > grouped = new ArrayList < Token > ( toks ) ;
* int lastTokVisited = 0;
* List < Integer > toMerge = new ArrayList < Integer > ( ) ;
* for ( int i = 0 ; i < spans . size ( ) ; i + + ) {
* Span s = spans . get ( i ) ;
* boolean canStop = false ;
* for ( int j = lastTokVisited ; j < toks . size ( ) ; j + + ) {
* Token t = toks . get ( j ) ;
* if ( s . intersects ( t . getSpan ( ) ) ) {
* toMerge . add ( j ) ;
* canStop = true ;
* } else if ( canStop ) {
* lastTokVisited = j ;
* break ;
* mergeTokens ( grouped , toMerge ) ;
* return grouped ; */
private static void mergeTokens ( List < Token > grouped , List < Integer > toMerge ) { } } | if ( toMerge . size ( ) > 0 ) { StringBuilder sb = new StringBuilder ( ) ; int s = grouped . get ( toMerge . get ( 0 ) ) . getSpan ( ) . getStart ( ) ; int e = grouped . get ( toMerge . get ( toMerge . size ( ) - 1 ) ) . getSpan ( ) . getEnd ( ) ; for ( int i = 0 ; i < toMerge . size ( ) ; i ++ ) { int index = toMerge . get ( i ) ; sb . append ( grouped . get ( index ) . getLexeme ( ) + "_" ) ; } String lexeme = sb . substring ( 0 , sb . length ( ) - 1 ) ; for ( int i = toMerge . size ( ) - 1 ; i > 0 ; i -- ) { grouped . remove ( toMerge . get ( i ) . intValue ( ) ) ; } grouped . set ( toMerge . get ( 0 ) . intValue ( ) , new TokenCogroo ( lexeme , new Span ( s , e ) ) ) ; } |
public class SecurityFunctions { /** * Applies an AES encryption on the string { @ code plainText } with they given key
* Keys have to be generated using the { @ link # generateKey ( ) } function
* @ param plainText the string to encrypt
* @ param key the key to use during the encryption
* @ return a byte array containing the encrypted data */
public byte [ ] encryptAES ( String plainText , SecretKey key ) { } } | byte [ ] byteCipherText = new byte [ 0 ] ; try { Cipher cipher = Cipher . getInstance ( "AES" , "BC" ) ; cipher . init ( Cipher . ENCRYPT_MODE , key ) ; byteCipherText = cipher . doFinal ( plainText . getBytes ( "UTF-8" ) ) ; } catch ( BadPaddingException | NoSuchAlgorithmException | IllegalBlockSizeException | NoSuchPaddingException | InvalidKeyException | UnsupportedEncodingException | NoSuchProviderException e ) { logger . error ( "Unable to apply AES encryption" , e ) ; } return byteCipherText ; |
public class SequenceRenderer { /** * Set the system cursor visibility .
* @ param visible < code > true < / code > if visible , < code > false < / code > else . */
void setSystemCursorVisible ( boolean visible ) { } } | if ( screen == null ) { cursorVisibility = Boolean . valueOf ( visible ) ; } else { if ( visible ) { screen . showCursor ( ) ; } else { screen . hideCursor ( ) ; } } |
public class PrefixedProperties { /** * Store to yaml .
* @ param os
* the os
* @ throws IOException
* Signals that an I / O exception has occurred . */
public void storeToYAML ( final OutputStream os ) throws IOException { } } | lock . readLock ( ) . lock ( ) ; try { final YAMLFactory f = new YAMLFactory ( ) ; final YAMLGenerator generator = f . createGenerator ( os , JsonEncoding . UTF8 ) ; generator . useDefaultPrettyPrinter ( ) ; generator . writeStartObject ( ) ; writeJsonOrYaml ( generator , getTreeMap ( ) ) ; generator . writeEndObject ( ) ; generator . flush ( ) ; } finally { lock . readLock ( ) . unlock ( ) ; } |
public class AVIMClient { /** * Create a new Chatroom
* @ param conversationMembers
* @ param name
* @ param attributes
* @ param isUnique deprecated chatroom is always not unique .
* @ param callback */
public void createChatRoom ( final List < String > conversationMembers , String name , final Map < String , Object > attributes , final boolean isUnique , final AVIMConversationCreatedCallback callback ) { } } | this . createConversation ( conversationMembers , name , attributes , true , false , callback ) ; |
public class PhotosetsInterface { /** * Get a collection of Photo objects for the specified Photoset .
* This method does not require authentication .
* @ see com . flickr4java . flickr . photos . Extras
* @ see com . flickr4java . flickr . Flickr # PRIVACY _ LEVEL _ NO _ FILTER
* @ see com . flickr4java . flickr . Flickr # PRIVACY _ LEVEL _ PUBLIC
* @ see com . flickr4java . flickr . Flickr # PRIVACY _ LEVEL _ FRIENDS
* @ see com . flickr4java . flickr . Flickr # PRIVACY _ LEVEL _ FRIENDS _ FAMILY
* @ see com . flickr4java . flickr . Flickr # PRIVACY _ LEVEL _ FAMILY
* @ see com . flickr4java . flickr . Flickr # PRIVACY _ LEVEL _ FRIENDS
* @ param photosetId
* The photoset ID
* @ param extras
* Set of extra - fields
* @ param privacy _ filter
* filter value for authenticated calls
* @ param perPage
* The number of photos per page
* @ param page
* The page offset
* @ return PhotoList The Collection of Photo objects
* @ throws FlickrException */
public PhotoList < Photo > getPhotos ( String photosetId , Set < String > extras , int privacy_filter , int perPage , int page ) throws FlickrException { } } | PhotoList < Photo > photos = new PhotoList < Photo > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_PHOTOS ) ; parameters . put ( "photoset_id" , photosetId ) ; if ( perPage > 0 ) { parameters . put ( "per_page" , String . valueOf ( perPage ) ) ; } if ( page > 0 ) { parameters . put ( "page" , String . valueOf ( page ) ) ; } if ( privacy_filter > 0 ) { parameters . put ( "privacy_filter" , "" + privacy_filter ) ; } if ( extras != null && ! extras . isEmpty ( ) ) { parameters . put ( Extras . KEY_EXTRAS , StringUtilities . join ( extras , "," ) ) ; } Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photoset = response . getPayload ( ) ; NodeList photoElements = photoset . getElementsByTagName ( "photo" ) ; photos . setPage ( photoset . getAttribute ( "page" ) ) ; photos . setPages ( photoset . getAttribute ( "pages" ) ) ; photos . setPerPage ( photoset . getAttribute ( "per_page" ) ) ; photos . setTotal ( photoset . getAttribute ( "total" ) ) ; for ( int i = 0 ; i < photoElements . getLength ( ) ; i ++ ) { Element photoElement = ( Element ) photoElements . item ( i ) ; photos . add ( PhotoUtils . createPhoto ( photoElement , photoset ) ) ; } return photos ; |
public class DoubleSummaryStatistics { /** * Incorporate a new double value using Kahan summation /
* compensated summation . */
private void sumWithCompensation ( double value ) { } } | double tmp = value - sumCompensation ; double velvel = sum + tmp ; // Little wolf of rounding error
sumCompensation = ( velvel - sum ) - tmp ; sum = velvel ; |
public class ZipUtil { /** * 解压到文件名相同的目录中
* @ param zipFile 压缩文件
* @ param charset 编码
* @ return 解压的目录
* @ throws UtilException IO异常
* @ since 3.2.2 */
public static File unzip ( File zipFile , Charset charset ) throws UtilException { } } | return unzip ( zipFile , FileUtil . file ( zipFile . getParentFile ( ) , FileUtil . mainName ( zipFile ) ) , charset ) ; |
public class SUPERVISOR { /** * Installs a new rule
* @ param name The name of the rule
* @ param interval Number of ms between executions of the rule
* @ param rule The rule */
public void installRule ( String name , long interval , Rule rule ) { } } | rule . supervisor ( this ) . log ( log ) . init ( ) ; Future < ? > future = timer . scheduleAtFixedRate ( rule , interval , interval , TimeUnit . MILLISECONDS ) ; Tuple < Rule , Future < ? > > existing = rules . put ( name != null ? name : rule . name ( ) , new Tuple < > ( rule , future ) ) ; if ( existing != null ) existing . getVal2 ( ) . cancel ( true ) ; |
public class CommonOps_DDF2 { /** * Returns the absolute value of the element in the matrix that has the largest absolute value . < br >
* < br >
* Max { | a < sub > ij < / sub > | } for all i and j < br >
* @ param a A matrix . Not modified .
* @ return The max abs element value of the matrix . */
public static double elementMaxAbs ( DMatrix2x2 a ) { } } | double max = Math . abs ( a . a11 ) ; double tmp = Math . abs ( a . a12 ) ; if ( tmp > max ) max = tmp ; tmp = Math . abs ( a . a21 ) ; if ( tmp > max ) max = tmp ; tmp = Math . abs ( a . a22 ) ; if ( tmp > max ) max = tmp ; return max ; |
public class JobThreadRootControllerImpl { /** * Follow similar pattern for end of step in BaseStepControllerImpl
* 1 . Execute the very last artifacts ( jobListener )
* 2 . transition to final batch status
* 3 . default ExitStatus if necessary
* 4 . persist statuses and end time data
* We don ' t want to give up on the orderly process of 2,3,4 , if we blow up
* in after job , so catch that and keep on going . */
protected void endOfJob ( ) { } } | // 1 . Execute the very last artifacts ( jobListener )
try { jobListenersAfterJob ( ) ; } catch ( Throwable t ) { StringWriter sw = new StringWriter ( ) ; PrintWriter pw = new PrintWriter ( sw ) ; t . printStackTrace ( pw ) ; logger . warning ( "Error invoking jobListener.afterJob(). Stack trace: " + sw . toString ( ) ) ; batchStatusFailedFromException ( ) ; } // 2 . transition to final batch status
transitionToFinalBatchStatus ( ) ; // 3 . default ExitStatus if necessary
if ( jobContext . getExitStatus ( ) == null ) { logger . fine ( "No job-level exitStatus set, defaulting to job batch Status = " + jobContext . getBatchStatus ( ) ) ; jobContext . setExitStatus ( jobContext . getBatchStatus ( ) . name ( ) ) ; } // 4 . persist statuses and end time data
logger . fine ( "Job complete for job id=" + jobExecution . getJobInstance ( ) . getJobName ( ) + ", executionId=" + jobExecution . getExecutionId ( ) + ", batchStatus=" + jobContext . getBatchStatus ( ) + ", exitStatus=" + jobContext . getExitStatus ( ) ) ; persistJobBatchAndExitStatus ( ) ; |
public class RouterChain { /** * 构建Router链
* @ param consumerBootstrap 服务端订阅者配置
* @ return 路由链 */
public static RouterChain buildConsumerChain ( ConsumerBootstrap consumerBootstrap ) { } } | ConsumerConfig < ? > consumerConfig = consumerBootstrap . getConsumerConfig ( ) ; List < Router > customRouters = consumerConfig . getRouterRef ( ) == null ? new ArrayList < Router > ( ) : new CopyOnWriteArrayList < Router > ( consumerConfig . getRouterRef ( ) ) ; // 先解析是否有特殊处理
HashSet < String > excludes = parseExcludeRouter ( customRouters ) ; // 准备数据 : 用户通过别名的方式注入的router , 需要解析
List < ExtensionClass < Router > > extensionRouters = new ArrayList < ExtensionClass < Router > > ( ) ; List < String > routerAliases = consumerConfig . getRouter ( ) ; if ( CommonUtils . isNotEmpty ( routerAliases ) ) { for ( String routerAlias : routerAliases ) { if ( startsWithExcludePrefix ( routerAlias ) ) { // 排除用的特殊字符
excludes . add ( routerAlias . substring ( 1 ) ) ; } else { extensionRouters . add ( EXTENSION_LOADER . getExtensionClass ( routerAlias ) ) ; } } } // 解析自动加载的router
if ( ! excludes . contains ( StringUtils . ALL ) && ! excludes . contains ( StringUtils . DEFAULT ) ) { // 配了 - * 和 - default表示不加载内置
for ( Map . Entry < String , ExtensionClass < Router > > entry : CONSUMER_AUTO_ACTIVES . entrySet ( ) ) { if ( ! excludes . contains ( entry . getKey ( ) ) ) { extensionRouters . add ( entry . getValue ( ) ) ; } } } excludes = null ; // 不需要了
// 按order从小到大排序
if ( extensionRouters . size ( ) > 1 ) { Collections . sort ( extensionRouters , new OrderedComparator < ExtensionClass > ( ) ) ; } List < Router > actualRouters = new ArrayList < Router > ( ) ; for ( ExtensionClass < Router > extensionRouter : extensionRouters ) { Router actualRoute = extensionRouter . getExtInstance ( ) ; actualRouters . add ( actualRoute ) ; } // 加入自定义的过滤器
actualRouters . addAll ( customRouters ) ; return new RouterChain ( actualRouters , consumerBootstrap ) ; |
public class GraphQLObjectType { /** * This helps you transform the current GraphQLObjectType into another one by starting a builder with all
* the current values and allows you to transform it how you want .
* @ param builderConsumer the consumer code that will be given a builder to transform
* @ return a new object based on calling build on that builder */
public GraphQLObjectType transform ( Consumer < Builder > builderConsumer ) { } } | Builder builder = newObject ( this ) ; builderConsumer . accept ( builder ) ; return builder . build ( ) ; |
public class NvdCveUpdater { /** * Downloads the latest NVD CVE XML file from the web and imports it into
* the current CVE Database . A lock on a file is obtained in an attempt to
* prevent more then one thread / JVM from updating the database at the same
* time . This method may sleep upto 5 minutes .
* @ param engine a reference to the dependency - check engine
* @ return whether or not an update was made to the CveDB
* @ throws UpdateException is thrown if there is an error updating the
* database */
@ Override public synchronized boolean update ( Engine engine ) throws UpdateException { } } | this . settings = engine . getSettings ( ) ; this . cveDb = engine . getDatabase ( ) ; if ( isUpdateConfiguredFalse ( ) ) { return false ; } boolean updatesMade = false ; try { dbProperties = cveDb . getDatabaseProperties ( ) ; if ( checkUpdate ( ) ) { final UpdateableNvdCve updateable = getUpdatesNeeded ( ) ; if ( updateable . isUpdateNeeded ( ) ) { initializeExecutorServices ( ) ; performUpdate ( updateable ) ; updatesMade = true ; } dbProperties . save ( DatabaseProperties . LAST_CHECKED , Long . toString ( System . currentTimeMillis ( ) ) ) ; } } catch ( MalformedURLException ex ) { throw new UpdateException ( "NVD CVE properties files contain an invalid URL, unable to update the data to use the most current data." , ex ) ; } catch ( DownloadFailedException ex ) { LOGGER . warn ( "Unable to download the NVD CVE data; the results may not include the most recent CPE/CVEs from the NVD." ) ; if ( settings . getString ( Settings . KEYS . PROXY_SERVER ) == null ) { LOGGER . warn ( "If you are behind a proxy you may need to configure dependency-check to use the proxy." ) ; } final String jre = System . getProperty ( "java.version" ) ; if ( jre == null || jre . startsWith ( "1.4" ) || jre . startsWith ( "1.5" ) || jre . startsWith ( "1.6" ) || jre . startsWith ( "1.7" ) ) { LOGGER . warn ( "An old JRE is being used ({} {}), and likely does not have the correct root certificates or algorithms " + "to connect to the NVD - consider upgrading your JRE." , System . getProperty ( "java.vendor" ) , jre ) ; } throw new UpdateException ( "Unable to download the NVD CVE data." , ex ) ; } catch ( DatabaseException ex ) { throw new UpdateException ( "Database Exception, unable to update the data to use the most current data." , ex ) ; } finally { shutdownExecutorServices ( ) ; } return updatesMade ; |
public class CmsStringUtil { /** * Parses a duration and returns the corresponding number of milliseconds .
* Durations consist of a space - separated list of components of the form { number } { time unit } ,
* for example 1d 5m . The available units are d ( days ) , h ( hours ) , m ( months ) , s ( seconds ) , ms ( milliseconds ) . < p >
* @ param durationStr the duration string
* @ param defaultValue the default value to return in case the pattern does not match
* @ return the corresponding number of milliseconds */
public static final long parseDuration ( String durationStr , long defaultValue ) { } } | durationStr = durationStr . toLowerCase ( ) . trim ( ) ; Matcher matcher = DURATION_NUMBER_AND_UNIT_PATTERN . matcher ( durationStr ) ; long millis = 0 ; boolean matched = false ; while ( matcher . find ( ) ) { long number = Long . valueOf ( matcher . group ( 1 ) ) . longValue ( ) ; String unit = matcher . group ( 2 ) ; long multiplier = 0 ; for ( int j = 0 ; j < DURATION_UNTIS . length ; j ++ ) { if ( unit . equals ( DURATION_UNTIS [ j ] ) ) { multiplier = DURATION_MULTIPLIERS [ j ] ; break ; } } if ( multiplier == 0 ) { LOG . warn ( "parseDuration: Unknown unit " + unit ) ; } else { matched = true ; } millis += number * multiplier ; } if ( ! matched ) { millis = defaultValue ; } return millis ; |
public class IssueCategoryRegistry { /** * Loads the related graph vertex for the given { @ link IssueCategory # getCategoryID ( ) } . */
@ SuppressWarnings ( "unchecked" ) public static IssueCategoryModel loadFromGraph ( FramedGraph framedGraph , String issueCategoryID ) { } } | Iterable < Vertex > vertices = ( Iterable < Vertex > ) framedGraph . traverse ( g -> framedGraph . getTypeResolver ( ) . hasType ( g . V ( ) , IssueCategoryModel . class ) ) . traverse ( g -> g . has ( IssueCategoryModel . CATEGORY_ID , issueCategoryID ) ) . getRawTraversal ( ) . toList ( ) ; IssueCategoryModel result = null ; for ( Vertex vertex : vertices ) { if ( result != null ) throw new DuplicateIssueCategoryException ( "Found more than one issue category for this id: " + issueCategoryID ) ; result = framedGraph . frameElement ( vertex , IssueCategoryModel . class ) ; } return result ; |
public class StartInstancesRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < StartInstancesRequest > getDryRunRequest ( ) { } } | Request < StartInstancesRequest > request = new StartInstancesRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class UniqueDevicesClient { /** * Main routine creates a benchmark instance and kicks off the run method .
* @ param args Command line arguments .
* @ throws Exception if anything goes wrong .
* @ see { @ link UniqueDevicesConfig } */
public static void main ( String [ ] args ) throws Exception { } } | // create a configuration from the arguments
UniqueDevicesConfig config = new UniqueDevicesConfig ( ) ; config . parse ( UniqueDevicesClient . class . getName ( ) , args ) ; UniqueDevicesClient udc = new UniqueDevicesClient ( config ) ; udc . runBenchmark ( ) ; |
public class XLSReader { /** * 判断data的类型 , 尝试解析成日期类型 ( 返回 { @ link Date } ) , 其次布尔类型 ( 返回 { @ link Boolean } ) ,
* 然后数字类型 ( 转变成字符串输出 ) ,
* 前三种均解析失败则直接返回字符串data
* @ param data
* @ return 解析后的值 */
private Object getValue ( String data ) { } } | Object value = null ; try { // 判断是否是日期类型
Date date = DateUtils . parseDate ( data , DATE_PATTERN ) ; value = date ; } catch ( ParseException e ) { // 抛异常证明非日期类型
if ( "true" . equalsIgnoreCase ( data ) ) { value = Boolean . TRUE ; } else if ( "false" . equalsIgnoreCase ( data ) ) { value = Boolean . FALSE ; } else { // 判断是否数字
try { BigDecimal bd = new BigDecimal ( data ) ; if ( this . scale == null || this . scale <= 0 ) { // 不四舍五入 , 直接输出
value = data ; } else { value = bd . toString ( ) . contains ( "." ) ? bd . setScale ( this . scale , RoundingMode . HALF_UP ) . toString ( ) : data ; } } catch ( NumberFormatException e1 ) { // 证明不是数字 , 直接输出
value = data ; } } } return value ; |
public class ContextRuleAssistant { /** * Returns the translet name of the prefix and suffix are combined .
* @ param transletName the translet name
* @ return the string */
public String applyTransletNamePattern ( String transletName ) { } } | if ( transletName == null ) { return null ; } return transletRuleRegistry . applyTransletNamePattern ( transletName , true ) ; |
public class LocalLog { /** * Reopen the associated static logging stream . Set to null to redirect to System . out . */
public static void openLogFile ( String logPath ) { } } | if ( logPath == null ) { printStream = System . out ; } else { try { printStream = new PrintStream ( new File ( logPath ) ) ; } catch ( FileNotFoundException e ) { throw new IllegalArgumentException ( "Log file " + logPath + " was not found" , e ) ; } } |
public class PermissionUtils { /** * Get file permissions in octal mode , e . g . 0755.
* Note : it uses ` java . nio . file . attribute . PosixFilePermission ` if OS supports this , otherwise reverts to
* using standard Java file operations , e . g . ` java . io . File # canExecute ( ) ` . In the first case permissions will
* be precisely as reported by the OS , in the second case ' owner ' and ' group ' will have equal permissions and
* ' others ' will have no permissions , e . g . if file on Windows OS is ` read - only ` permissions will be ` 0550 ` .
* @ throws NullPointerException if file is null .
* @ throws IllegalArgumentException if file does not exist . */
public static int permissions ( File f ) { } } | if ( f == null ) { throw new NullPointerException ( "File is null." ) ; } if ( ! f . exists ( ) ) { throw new IllegalArgumentException ( "File " + f + " does not exist." ) ; } return isPosix ? posixPermissions ( f ) : standardPermissions ( f ) ; |
public class AkkaHelper { /** * Helper util to access the private [ akka ] system . actorFor method
* This is used for performance optimization , we encode the session Id
* in the ActorRef path . Session Id is used to identity sender Task .
* @ param system ActorSystem
* @ param path Relative or absolute path of this Actor System .
* @ return Full qualified ActorRef . */
@ SuppressWarnings ( "deprecation" ) public static ActorRef actorFor ( ActorSystem system , String path ) { } } | return system . actorFor ( path ) ; |
public class StatementWebService { /** * private static final Logger LOG = LoggerFactory . getLogger ( StatementWebService . class ) ; */
@ POST @ Path ( "close" ) public void close ( String id ) { } } | Statement statement = StatementHolder . get ( ) . get ( id ) ; try { statement . close ( ) ; StatementHolder . get ( ) . remove ( id ) ; } catch ( SQLException e ) { // TODO
throw new RuntimeException ( e ) ; } |
public class TransformersLogger { /** * Log a warning for the given operation at the provided address for the given attributes , using the provided detail
* message .
* @ param address where warning occurred
* @ param operation where which problem occurred
* @ param message custom error message to append
* @ param attributes attributes we that have problems about */
public void logAttributeWarning ( PathAddress address , ModelNode operation , String message , Set < String > attributes ) { } } | messageQueue . add ( new AttributeLogEntry ( address , operation , message , attributes ) ) ; |
public class LOiToSrtFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static < T > LOiToSrtFunction < T > oiToSrtFunctionFrom ( Consumer < LOiToSrtFunctionBuilder < T > > buildingFunction ) { } } | LOiToSrtFunctionBuilder builder = new LOiToSrtFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class SchemaServer { /** * For a given version and Iced class return an appropriate Schema instance , if any .
* @ param version Version of the schema to create , or pass - 1 to use the latest version .
* @ param impl _ class Create schema corresponds to this implementation class .
* @ throws H2OIllegalArgumentException if Class . newInstance ( ) throws
* @ see # schema ( int , java . lang . String )
* @ deprecated */
public static Schema schema ( int version , Class < ? extends Iced > impl_class ) { } } | if ( version == - 1 ) version = getLatestVersion ( ) ; return schema ( version , impl_class . getSimpleName ( ) ) ; |
public class NumberGenerator { /** * Generate random long values
* @ param startthe minimum value of the generated numbers , inclusive
* @ param end the maximum value of the generated numbers , inclusive
* @ param size number of random numbers to return . a . k . a . the size of the returned array .
* @ return the random values in an array . The values are guaranteed to be within [ start , end ] range . */
static public long [ ] randomLongs ( long start , long end , int size ) { } } | Preconditions . checkArgument ( start < end , "Start must be less than end." ) ; Random random = new Random ( ) ; random . setSeed ( System . currentTimeMillis ( ) ) ; long [ ] result = new long [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { long l = random . nextLong ( ) ; double d = ( double ) ( end - start ) / ( Long . MAX_VALUE - Long . MIN_VALUE ) * l + start ; if ( d <= start ) { l = start ; } else if ( d >= end ) { l = end ; } else { l = ( long ) d ; } result [ i ] = l ; } return result ; |
public class Currency { /** * Returns the number of the number of fraction digits that should
* be displayed for this currency with Usage .
* @ param Usage the usage of currency ( Standard or Cash )
* @ return a non - negative number of fraction digits to be
* displayed */
public int getDefaultFractionDigits ( CurrencyUsage Usage ) { } } | CurrencyMetaInfo info = CurrencyMetaInfo . getInstance ( ) ; CurrencyDigits digits = info . currencyDigits ( subType , Usage ) ; return digits . fractionDigits ; |
public class BufferStage { /** * Wait for all files to finish uploading and schedule stage for processing
* @ throws IOException raises an exception if IO error occurs */
void completeUploading ( ) throws IOException { } } | LOGGER . debug ( "name: {}, currentSize: {}, Threshold: {}," + " fileCount: {}, fileBucketSize: {}" , _file . getAbsolutePath ( ) , _currentSize , this . _csvFileSize , _fileCount , this . _csvFileBucketSize ) ; _outstream . flush ( ) ; _outstream . close ( ) ; // last file
if ( _currentSize > 0 ) { FileUploader fu = new FileUploader ( _loader , _location , _file ) ; fu . upload ( ) ; _uploaders . add ( fu ) ; } else { // delete empty file
_file . delete ( ) ; } for ( FileUploader fu : _uploaders ) { // Finish all files being uploaded
fu . join ( ) ; } // Delete the directory once we are done ( for easier tracking
// of what is going on )
_directory . deleteOnExit ( ) ; if ( this . _rowCount == 0 ) { setState ( State . EMPTY ) ; } |
public class SpecialMatchExpt { /** * Show results in a simple format . */
public void displayResults ( boolean showMismatches , PrintStream out ) throws IOException { } } | PrintfFormat fmt = new PrintfFormat ( "%s %3d %7.2f | %30s | %30s\n" ) ; for ( int i = 0 ; i < pairs . length ; i ++ ) { if ( pairs [ i ] != null ) { String label = pairs [ i ] . isCorrect ( ) ? "+" : "-" ; String aText = ( pairs [ i ] . getA ( ) == null ) ? "***" : pairs [ i ] . getA ( ) . unwrap ( ) ; String bText = ( pairs [ i ] . getB ( ) == null ) ? "***" : pairs [ i ] . getB ( ) . unwrap ( ) ; if ( showMismatches || "+" . equals ( label ) ) { out . print ( fmt . sprintf ( new Object [ ] { label , new Integer ( i + 1 ) , new Double ( pairs [ i ] . getDistance ( ) ) , aText , bText } ) ) ; } } } |
public class RealConnection { /** * Does all the work to build an HTTPS connection over a proxy tunnel . The catch here is that a
* proxy server can issue an auth challenge and then close the connection . */
private void connectTunnel ( int connectTimeout , int readTimeout , int writeTimeout , Call call , EventListener eventListener ) throws IOException { } } | Request tunnelRequest = createTunnelRequest ( ) ; HttpUrl url = tunnelRequest . url ( ) ; for ( int i = 0 ; i < MAX_TUNNEL_ATTEMPTS ; i ++ ) { connectSocket ( connectTimeout , readTimeout , call , eventListener ) ; tunnelRequest = createTunnel ( readTimeout , writeTimeout , tunnelRequest , url ) ; if ( tunnelRequest == null ) break ; // Tunnel successfully created .
// The proxy decided to close the connection after an auth challenge . We need to create a new
// connection , but this time with the auth credentials .
closeQuietly ( rawSocket ) ; rawSocket = null ; sink = null ; source = null ; eventListener . connectEnd ( call , route . socketAddress ( ) , route . proxy ( ) , null ) ; } |
public class Job { /** * Blocks until the Job completes */
public T get ( ) { } } | Barrier2 bar = _barrier ; if ( bar != null ) // Barrier may be null if task already completed
bar . join ( ) ; // Block on the * barrier * task , which blocks until the fjtask on * Completion code runs completely
assert isStopped ( ) ; if ( _ex != null ) throw new RuntimeException ( ( Throwable ) AutoBuffer . javaSerializeReadPojo ( _ex ) ) ; // Maybe null return , if the started fjtask does not actually produce a result at this Key
return _result == null ? null : _result . get ( ) ; |
public class Contracts { /** * End Contract
* @ param reference Contract reference
* @ param params Parameters
* @ throwsJSONException If error occurred
* @ return { @ link JSONObject } */
public JSONObject endContract ( String reference , HashMap < String , String > params ) throws JSONException { } } | return oClient . delete ( "/hr/v2/contracts/" + reference , params ) ; |
public class Server { /** * ( non - Javadoc )
* @ see org . restcomm . protocols . ss7 . map . api . service . supplementary . MAPServiceSupplementaryListener
* # onUnstructuredSSRequestIndication ( org . mobicents . protocols . ss7 . map . api . service
* . supplementary . UnstructuredSSRequestIndication ) */
@ Override public void onUnstructuredSSRequest ( UnstructuredSSRequest unstrReqInd ) { } } | // Server shouldn ' t be getting UnstructuredSSRequestIndication
logger . error ( String . format ( "onUnstructuredSSRequestIndication for Dialog=%d and invokeId=%d" , unstrReqInd . getMAPDialog ( ) . getLocalDialogId ( ) , unstrReqInd . getInvokeId ( ) ) ) ; |
public class DurationDatatype { /** * Returns the number of days spanned by a period of months starting with a particular
* reference year and month . */
private static BigInteger computeDays ( BigInteger months , int refYear , int refMonth ) { } } | switch ( months . signum ( ) ) { case 0 : return BigInteger . valueOf ( 0 ) ; case - 1 : return computeDays ( months . negate ( ) , refYear , refMonth ) . negate ( ) ; } // Complete cycle of Gregorian calendar is 400 years
BigInteger [ ] tem = months . divideAndRemainder ( BigInteger . valueOf ( 400 * 12 ) ) ; -- refMonth ; // use 0 base to match Java
int total = 0 ; for ( int rem = tem [ 1 ] . intValue ( ) ; rem > 0 ; rem -- ) { total += daysInMonth ( refYear , refMonth ) ; if ( ++ refMonth == 12 ) { refMonth = 0 ; refYear ++ ; } } // In the Gregorian calendar , there are 97 ( = 100 + 4 - 1 ) leap years every 400 years .
return tem [ 0 ] . multiply ( BigInteger . valueOf ( 365 * 400 + 97 ) ) . add ( BigInteger . valueOf ( total ) ) ; |
public class ReflectionUtils { /** * 调用Setter方法 . 使用value的Class来查找Setter方法 . */
public static void invokeSetterMethod ( Object obj , String propertyName , Object value ) { } } | invokeSetterMethod ( obj , propertyName , value , null ) ; |
public class YamlMappingNode { /** * Adds the specified { @ code key } / { @ code value } pair to this mapping .
* @ param key the key
* @ param value the value
* @ return { @ code this } */
public T put ( YamlNode key , Short value ) { } } | return put ( key , getNodeFactory ( ) . shortNode ( value ) ) ; |
public class ExtendedMappedParametrizedObjectEntry { /** * { @ inheritDoc } */
@ Override public void setParameters ( List < SimpleParameterEntry > parameters ) { } } | super . setParameters ( parameters ) ; if ( systemParameterUpdater != null ) { systemParameterUpdater . setParameters ( this ) ; } |
public class ArraysUtil { /** * Shuffle an array .
* @ param array Array .
* @ param seed Random seed . */
public static void Shuffle ( double [ ] array , long seed ) { } } | Random random = new Random ( ) ; if ( seed != 0 ) random . setSeed ( seed ) ; for ( int i = array . length - 1 ; i > 0 ; i -- ) { int index = random . nextInt ( i + 1 ) ; double temp = array [ index ] ; array [ index ] = array [ i ] ; array [ i ] = temp ; } |
public class MetricsRegistry { /** * Add a new metrics to the registry
* @ param metricsName - the name
* @ param theMetricsObj - the metrics
* @ throws IllegalArgumentException if a name is already registered */
public void add ( final String metricsName , final MetricsBase theMetricsObj ) { } } | if ( metricsList . putIfAbsent ( metricsName , theMetricsObj ) != null ) { throw new IllegalArgumentException ( "Duplicate metricsName:" + metricsName ) ; } |
public class TextGroupElement { /** * Add a child text element .
* @ param text the child text to add
* @ param position the position of the child relative to this parent */
public void addChild ( String text , Position position ) { } } | this . children . add ( new Child ( text , position ) ) ; |
public class BundleServiceRunner { /** * To be called from the host { @ link android . app . Activity } ' s { @ link
* android . app . Activity # onSaveInstanceState } . Calls the registrants ' { @ link Bundler # onSave }
* methods . */
public void onSaveInstanceState ( Bundle outState ) { } } | if ( state != State . IDLE ) { throw new IllegalStateException ( "Cannot handle onSaveInstanceState while " + state ) ; } rootBundle = outState ; state = State . SAVING ; // Make a dwindling copy of the services , in case one is deleted as a side effect
// of another ' s onSave .
List < Map . Entry < String , BundleService > > servicesToBeSaved = new ArrayList < > ( scopedServices . entrySet ( ) ) ; while ( ! servicesToBeSaved . isEmpty ( ) ) { Map . Entry < String , BundleService > entry = servicesToBeSaved . remove ( 0 ) ; if ( scopedServices . containsKey ( entry . getKey ( ) ) ) entry . getValue ( ) . saveToRootBundle ( rootBundle ) ; } state = State . IDLE ; |
public class SubscriptionDefinitionImpl { /** * Sets the noLocal .
* @ param noLocal The noLocal to set */
public void setNoLocal ( boolean noLocal ) { } } | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setNoLocal" , new Boolean ( noLocal ) ) ; this . noLocal = noLocal ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setNoLocal" ) ; |
public class MessageServiceImp { /** * ( non - Javadoc )
* @ see com . popbill . api . MessageService # getStates ( java . lang . String , java . lang . String [ ] ) */
@ Override public MessageBriefInfo [ ] getStates ( String corpNum , String [ ] receiptNumList ) throws PopbillException { } } | return getStates ( corpNum , receiptNumList , null ) ; |
public class AbstractBitwiseHierarchyImpl { public Collection < H > lowerDescendants ( BitSet key ) { } } | List < H > vals = new LinkedList < H > ( ) ; int l = key . length ( ) ; if ( l == 0 || line . isEmpty ( ) ) { return new ArrayList ( getSortedMembers ( ) ) ; } int n = line . lastKey ( ) . length ( ) ; if ( l > n ) { return vals ; } BitSet start = new BitSet ( n ) ; BitSet end = new BitSet ( n ) ; start . or ( key ) ; start . set ( l - 1 ) ; end . set ( n ) ; for ( J val : line . subMap ( start , end ) . values ( ) ) { BitSet x = val . getBitMask ( ) ; if ( superset ( x , key ) >= 0 ) { vals . add ( val . getValue ( ) ) ; } } start . clear ( l - 1 ) ; return vals ; |
public class CandidateCluster { /** * Merges the elements assigned to the other cluster into this one . */
public void merge ( CandidateCluster other ) { } } | indices . addAll ( other . indices ) ; VectorMath . add ( sumVector , other . sumVector ) ; centroid = null ; |
public class LogCursorImpl { /** * Closes the LogCursorImpl when it is no longer required . This is required to allow
* any ' locking ' rules imposed by the providers of the LogCursorImpl ( ie those methods
* that return LogCursors ) to be followed .
* This method should be invoked once for each instance of LogCursorImpl . After this
* call has been made , the LogCursorImpl is considered to be invalid and must not be
* accessed again . */
public void close ( ) { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "close" , this ) ; if ( _controlLock != null ) { try { _controlLock . releaseSharedLock ( LOCK_REQUEST_ID_LCI ) ; } catch ( NoSharedLockException exc ) { // This should not happen as we get a shared lock in the constructor and this is the
// only place we release it . Ignore this exception .
FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.LogCursorImpl.close" , "401" , this ) ; } } _iterator1 = null ; _iterator2 = null ; _removeIterator = null ; _controlLock = null ; _singleObject = null ; _empty = true ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "close" ) ; |
public class BlobSnippets { /** * [ VARIABLE " move _ blob _ name " ] */
public Blob moveTo ( String destBucket , String destBlob ) { } } | // [ START storageMoveFile ]
CopyWriter copyWriter = blob . copyTo ( destBucket , destBlob ) ; Blob copiedBlob = copyWriter . getResult ( ) ; boolean deleted = blob . delete ( ) ; // [ END storageMoveFile ]
if ( deleted ) { return copiedBlob ; } else { return null ; } |
public class RollingSink { /** * Opens a new part file .
* < p > This closes the old bucket file and retrieves a new bucket path from the { @ code Bucketer } . */
private void openNewPartFile ( ) throws Exception { } } | closeCurrentPartFile ( ) ; Path newBucketDirectory = bucketer . getNextBucketPath ( new Path ( basePath ) ) ; if ( ! newBucketDirectory . equals ( currentBucketDirectory ) ) { currentBucketDirectory = newBucketDirectory ; try { if ( fs . mkdirs ( currentBucketDirectory ) ) { LOG . debug ( "Created new bucket directory: {}" , currentBucketDirectory ) ; } } catch ( IOException e ) { throw new RuntimeException ( "Could not create base path for new rolling file." , e ) ; } } int subtaskIndex = getRuntimeContext ( ) . getIndexOfThisSubtask ( ) ; currentPartPath = new Path ( currentBucketDirectory , partPrefix + "-" + subtaskIndex + "-" + partCounter ) ; // This should work since there is only one parallel subtask that tries names with
// our subtask id . Otherwise we would run into concurrency issues here .
while ( fs . exists ( currentPartPath ) || fs . exists ( getPendingPathFor ( currentPartPath ) ) || fs . exists ( getInProgressPathFor ( currentPartPath ) ) ) { partCounter ++ ; currentPartPath = new Path ( currentBucketDirectory , partPrefix + "-" + subtaskIndex + "-" + partCounter ) ; } // increase , so we don ' t have to check for this name next time
partCounter ++ ; LOG . debug ( "Next part path is {}" , currentPartPath . toString ( ) ) ; Path inProgressPath = getInProgressPathFor ( currentPartPath ) ; writer . open ( fs , inProgressPath ) ; isWriterOpen = true ; |
public class nitro_util { /** * create a string ( without quotes ) out of the object fields that are set
* @ param obj Object
* @ return String in Json format .
* @ throws Exception Nitro exception is thrown . */
public static String object_to_string_withoutquotes ( java . lang . Object obj ) throws Exception { } } | String str = null ; Class < ? > c = obj . getClass ( ) ; Field [ ] flds = c . getDeclaredFields ( ) ; if ( flds != null ) { for ( int i = 0 ; i < flds . length ; i ++ ) { flds [ i ] . setAccessible ( true ) ; if ( flds [ i ] . get ( obj ) != null ) { String strtmp = "" ; if ( flds [ i ] . getType ( ) . isArray ( ) ) { Object tmp = flds [ i ] . get ( obj ) ; if ( tmp instanceof String [ ] ) { String [ ] tmp1 = ( String [ ] ) tmp ; for ( int j = 0 ; j < tmp1 . length ; j ++ ) { strtmp += tmp1 [ j ] + " " ; } } else if ( tmp instanceof Integer [ ] ) { Integer [ ] tmp1 = ( Integer [ ] ) tmp ; for ( int j = 0 ; j < tmp1 . length ; j ++ ) { strtmp += tmp1 [ j ] . toString ( ) + " " ; } } else if ( tmp instanceof Long [ ] ) { Long [ ] tmp1 = ( Long [ ] ) tmp ; for ( int j = 0 ; j < tmp1 . length ; j ++ ) { strtmp += tmp1 [ j ] . toString ( ) + " " ; } } else if ( tmp instanceof Double [ ] ) { Double [ ] tmp1 = ( Double [ ] ) tmp ; for ( int j = 0 ; j < tmp1 . length ; j ++ ) { strtmp += tmp1 [ j ] . toString ( ) + " " ; } } else if ( tmp instanceof Boolean [ ] ) { Boolean [ ] tmp1 = ( Boolean [ ] ) tmp ; for ( int j = 0 ; j < tmp1 . length ; j ++ ) { strtmp += tmp1 [ j ] . toString ( ) + " " ; } } strtmp = strtmp . trim ( ) ; } else { strtmp = flds [ i ] . get ( obj ) . toString ( ) ; } if ( str != null ) str = str + "," ; if ( str == null ) { str = flds [ i ] . getName ( ) + ":" + encode ( strtmp ) ; } else { str = str + flds [ i ] . getName ( ) + ":" + encode ( strtmp ) ; } } } } return str ; |
public class ModelsImpl { /** * Adds a pattern . any entity extractor to the application .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param extractorCreateObject A model object containing the name and explicit list for the new Pattern . Any entity extractor .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the UUID object if successful . */
public UUID createPatternAnyEntityModel ( UUID appId , String versionId , PatternAnyModelCreateObject extractorCreateObject ) { } } | return createPatternAnyEntityModelWithServiceResponseAsync ( appId , versionId , extractorCreateObject ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class RamUsageEstimator { /** * Returns < code > size < / code > in human - readable units ( GB , MB , KB or bytes ) . */
static String humanReadableUnits ( long bytes ) { } } | return humanReadableUnits ( bytes , new DecimalFormat ( "0.#" , DecimalFormatSymbols . getInstance ( Locale . ROOT ) ) ) ; |
public class SubscribeForm { /** * Sets the minimum number of milliseconds between sending notification digests .
* @ param frequency The frequency in milliseconds */
public void setDigestFrequency ( int frequency ) { } } | addField ( SubscribeOptionFields . digest_frequency , FormField . Type . text_single ) ; setAnswer ( SubscribeOptionFields . digest_frequency . getFieldName ( ) , frequency ) ; |
public class DescribeDeviceRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeDeviceRequest describeDeviceRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeDeviceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeDeviceRequest . getFleetArn ( ) , FLEETARN_BINDING ) ; protocolMarshaller . marshall ( describeDeviceRequest . getDeviceId ( ) , DEVICEID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CpnlElFunctions { /** * Builds the URL for a repository path using the LinkUtil . getUnmappedURL ( ) method .
* @ param request the current request ( domain host hint )
* @ param path the repository path
* @ return the URL built in the context of the requested domain host */
public static String unmappedUrl ( SlingHttpServletRequest request , String path ) { } } | return LinkUtil . getUnmappedUrl ( request , path ) ; |
public class XMLCaster { /** * casts a value to a XML Object defined by type parameter
* @ param doc XML Document
* @ param o Object to cast
* @ param type type to cast to
* @ return XML Text Object
* @ throws PageException */
public static Node toNode ( Document doc , Object o , short type ) throws PageException { } } | if ( Node . TEXT_NODE == type ) toText ( doc , o ) ; else if ( Node . ATTRIBUTE_NODE == type ) toAttr ( doc , o ) ; else if ( Node . COMMENT_NODE == type ) toComment ( doc , o ) ; else if ( Node . ELEMENT_NODE == type ) toElement ( doc , o ) ; throw new ExpressionException ( "invalid node type definition" ) ; |
public class ChannelSummary { /** * The endpoints where outgoing connections initiate from
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setEgressEndpoints ( java . util . Collection ) } or { @ link # withEgressEndpoints ( java . util . Collection ) } if you
* want to override the existing values .
* @ param egressEndpoints
* The endpoints where outgoing connections initiate from
* @ return Returns a reference to this object so that method calls can be chained together . */
public ChannelSummary withEgressEndpoints ( ChannelEgressEndpoint ... egressEndpoints ) { } } | if ( this . egressEndpoints == null ) { setEgressEndpoints ( new java . util . ArrayList < ChannelEgressEndpoint > ( egressEndpoints . length ) ) ; } for ( ChannelEgressEndpoint ele : egressEndpoints ) { this . egressEndpoints . add ( ele ) ; } return this ; |
public class SetupOptions { /** * Determines the location of the TE _ BASE directory by looking for either 1)
* a system property or 2 ) an environment variable named { @ value # TE _ BASE } .
* Finally , if neither is set then the " teamengine " subdirectory is created
* in the user home directory ( $ { user . home } / teamengine ) .
* @ return A File denoting the location of the base configuration directory . */
public static File getBaseConfigDirectory ( ) { } } | if ( null != teBaseDir ) { return teBaseDir ; } String basePath = System . getProperty ( TE_BASE ) ; if ( null == basePath ) { basePath = System . getenv ( TE_BASE ) ; } if ( null == basePath ) { basePath = System . getProperty ( "user.home" ) + System . getProperty ( "file.separator" ) + "teamengine" ; } File baseDir = new File ( basePath ) ; if ( ! baseDir . isDirectory ( ) ) { baseDir . mkdirs ( ) ; } Logger . getLogger ( SetupOptions . class . getName ( ) ) . log ( Level . CONFIG , "Using TE_BASE at " + baseDir ) ; return baseDir ; |
public class LevelUpgrader { /** * Converts a BioPAX Model , Level 1 or 2 , to the Level 3.
* @ param model BioPAX model to upgrade
* @ return new Level3 model */
public Model filter ( Model model ) { } } | if ( model == null || model . getLevel ( ) != BioPAXLevel . L2 ) return model ; // nothing to do
preparePep2PEIDMap ( model ) ; final Model newModel = factory . createModel ( ) ; newModel . getNameSpacePrefixMap ( ) . putAll ( model . getNameSpacePrefixMap ( ) ) ; newModel . setXmlBase ( model . getXmlBase ( ) ) ; // facilitate the conversion
normalize ( model ) ; // First , map classes ( and only set ID ) if possible ( pre - processing )
for ( BioPAXElement bpe : model . getObjects ( ) ) { Level3Element l3element = mapClass ( bpe ) ; if ( l3element != null ) { newModel . add ( l3element ) ; } else { log . debug ( "Skipping " + bpe + " " + bpe . getModelInterface ( ) . getSimpleName ( ) ) ; } } /* process each L2 element ( mapping properties ) ,
* except for pEPs and oCVs that must be processed as values
* ( anyway , we do not want dangling elements ) */
for ( BioPAXElement e : model . getObjects ( ) ) { if ( e instanceof physicalEntityParticipant || e instanceof openControlledVocabulary ) { continue ; } // map properties
traverse ( ( Level2Element ) e , newModel ) ; } log . info ( "Done: new L3 model contains " + newModel . getObjects ( ) . size ( ) + " BioPAX individuals." ) ; // fix new model ( e . g . , add PathwayStep ' s processes to the pathway components ; ) )
normalize ( newModel ) ; return newModel ; |
public class Tuple3 { /** * Sets new values to all fields of the tuple .
* @ param value0 The value for field 0
* @ param value1 The value for field 1
* @ param value2 The value for field 2 */
public void setFields ( T0 value0 , T1 value1 , T2 value2 ) { } } | this . f0 = value0 ; this . f1 = value1 ; this . f2 = value2 ; |
public class ProvFactory { /** * Factory method for Key - entity entries . Key - entity entries are used to identify the members of a dictionary .
* @ param key indexing the entity in the dictionary
* @ param entity a { @ link QualifiedName } denoting an entity
* @ return an instance of { @ link Entry } */
public Entry newEntry ( Key key , QualifiedName entity ) { } } | Entry res = of . createEntry ( ) ; res . setKey ( key ) ; res . setEntity ( entity ) ; return res ; |
public class ModelsImpl { /** * Get All Entity Roles for a given entity .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param entityId entity Id
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the List & lt ; EntityRole & gt ; object if successful . */
public List < EntityRole > getEntityRoles ( UUID appId , String versionId , UUID entityId ) { } } | return getEntityRolesWithServiceResponseAsync ( appId , versionId , entityId ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class PropertyNameQueryMarshaller { /** * Marshall the given parameter object . */
public void marshall ( PropertyNameQuery propertyNameQuery , ProtocolMarshaller protocolMarshaller ) { } } | if ( propertyNameQuery == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( propertyNameQuery . getPropertyNameHint ( ) , PROPERTYNAMEHINT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class RqLive { /** * Checks whether or not the next byte to read is a Line Feed .
* < p > < i > Please note that this method assumes that the previous byte read
* was a Carriage Return . < / i >
* @ param input The input stream to read
* @ param baos Current read header
* @ param position Header line number
* @ throws IOException If the next byte is not a Line Feed as expected */
private static void checkLineFeed ( final InputStream input , final ByteArrayOutputStream baos , final Integer position ) throws IOException { } } | if ( input . read ( ) != '\n' ) { throw new HttpException ( HttpURLConnection . HTTP_BAD_REQUEST , String . format ( "there is no LF after CR in header, line #%d: \"%s\"" , position , new Utf8String ( baos . toByteArray ( ) ) . asString ( ) ) ) ; } |
public class CmsHelpNavigationListView { /** * Returns a string containing the navigation created by using the internal members . < p >
* The navigation is a nested html list . < p >
* @ return a string containing the navigation created by using the internal members */
public String createNavigation ( ) { } } | StringBuffer buffer = new StringBuffer ( 2048 ) ; int endlevel = calculateEndLevel ( ) ; String spaces = getSpaces ( ( endlevel - m_depth ) * 2 ) ; if ( m_navRootPath != null ) { buffer . append ( "\n" ) . append ( spaces ) . append ( "<p>\n" ) ; buffer . append ( spaces ) . append ( " <ul>\n" ) ; List < CmsJspNavElement > navElements = m_jsp . getNavigation ( ) . getSiteNavigation ( m_navRootPath , endlevel ) ; if ( navElements . size ( ) > 0 ) { createNavigationInternal ( buffer , navElements ) ; } buffer . append ( spaces ) . append ( " </ul>\n" ) ; buffer . append ( spaces ) . append ( "</p>" ) ; return buffer . toString ( ) ; } else { CmsIllegalArgumentException ex = new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HELP_ERR_SITEMAP_MISSING_PARAM_1 , "navRootPath" ) ) ; throw ex ; } |
public class WTable { /** * Track the row keys that have been rendered .
* Note - Only used for when the table is editable .
* @ param rowKey the row key that has been rendered . */
protected void addPrevRenderedRow ( final Object rowKey ) { } } | WTableComponentModel model = getOrCreateComponentModel ( ) ; if ( model . prevRenderedRows == null ) { model . prevRenderedRows = new HashSet < > ( ) ; } model . prevRenderedRows . add ( rowKey ) ; |
public class CompositePredicate { /** * Get the filtered servers from primary predicate , and if the number of the filtered servers
* are not enough , trying the fallback predicates */
@ Override public List < Server > getEligibleServers ( List < Server > servers , Object loadBalancerKey ) { } } | List < Server > result = super . getEligibleServers ( servers , loadBalancerKey ) ; Iterator < AbstractServerPredicate > i = fallbacks . iterator ( ) ; while ( ! ( result . size ( ) >= minimalFilteredServers && result . size ( ) > ( int ) ( servers . size ( ) * minimalFilteredPercentage ) ) && i . hasNext ( ) ) { AbstractServerPredicate predicate = i . next ( ) ; result = predicate . getEligibleServers ( servers , loadBalancerKey ) ; } return result ; |
public class AWSSecurityHubClient { /** * Lists details about all member accounts for the current Security Hub master account .
* @ param listMembersRequest
* @ return Result of the ListMembers operation returned by the service .
* @ throws InternalException
* Internal server error .
* @ throws InvalidInputException
* The request was rejected because an invalid or out - of - range value was supplied for an input parameter .
* @ throws InvalidAccessException
* AWS Security Hub is not enabled for the account used to make this request .
* @ throws LimitExceededException
* The request was rejected because it attempted to create resources beyond the current AWS account limits .
* The error code describes the limit exceeded .
* @ sample AWSSecurityHub . ListMembers
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / securityhub - 2018-10-26 / ListMembers " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ListMembersResult listMembers ( ListMembersRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListMembers ( request ) ; |
public class ReferenceCompositeGroupService { /** * Returns a pre - existing < code > IEntityGroup < / code > or null if the < code > IGroupMember < / code >
* does not exist . */
@ Override public IEntityGroup findGroup ( String key ) throws GroupsException { } } | CompositeEntityIdentifier ent = newCompositeEntityIdentifier ( key ) ; IIndividualGroupService service = getComponentService ( ent ) ; return ( service == null ) ? null : service . findGroup ( ent ) ; |
public class DictionaryFactory { /** * create the ADictionary according to the JcsegTaskConfig
* @ param config
* @ param loadDic
* @ return ADictionary */
public static ADictionary createDefaultDictionary ( JcsegTaskConfig config , boolean loadDic ) { } } | return createDefaultDictionary ( config , config . isAutoload ( ) , loadDic ) ; |
public class OgmConfiguration { /** * Applies configuration options to the bootstrapped session factory . Use either this method or pass a
* { @ link OptionConfigurator } via { @ link OgmProperties # OPTION _ CONFIGURATOR } but don ' t use both at the same time .
* @ param datastoreType represents the datastore to be configured ; it is the responsibility of the caller to make
* sure that this matches the underlying datastore provider .
* @ return a context object representing the entry point into the fluent configuration API . */
@ Override public < D extends DatastoreConfiguration < G > , G extends GlobalContext < ? , ? > > G configureOptionsFor ( Class < D > datastoreType ) { } } | ConfigurableImpl configurable = new ConfigurableImpl ( ) ; getProperties ( ) . put ( InternalProperties . OGM_OPTION_CONTEXT , configurable . getContext ( ) ) ; return configurable . configureOptionsFor ( datastoreType ) ; |
public class ProgramRegistry { /** * Get a program type registry for the file at given path . If the
* registry is not created yet , it will be created .
* @ param path The thrift file path .
* @ return The associated program type registry . */
@ Nonnull public ProgramTypeRegistry registryForPath ( String path ) { } } | return registryMap . computeIfAbsent ( path , p -> new ProgramTypeRegistry ( programNameFromPath ( path ) ) ) ; |
public class ListTagsForResourcesResult { /** * A list of < code > ResourceTagSet < / code > s containing tags associated with the specified resources .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setResourceTagSets ( java . util . Collection ) } or { @ link # withResourceTagSets ( java . util . Collection ) } if you
* want to override the existing values .
* @ param resourceTagSets
* A list of < code > ResourceTagSet < / code > s containing tags associated with the specified resources .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListTagsForResourcesResult withResourceTagSets ( ResourceTagSet ... resourceTagSets ) { } } | if ( this . resourceTagSets == null ) { setResourceTagSets ( new com . amazonaws . internal . SdkInternalList < ResourceTagSet > ( resourceTagSets . length ) ) ; } for ( ResourceTagSet ele : resourceTagSets ) { this . resourceTagSets . add ( ele ) ; } return this ; |
public class GeoPackageIOUtils { /** * Add a the file extension to the file
* @ param file
* file
* @ param extension
* file extension
* @ return new file with extension
* @ since 3.0.2 */
public static File addFileExtension ( File file , String extension ) { } } | return new File ( file . getAbsolutePath ( ) + "." + extension ) ; |
public class PropertiesManager { /** * Save the current values of all properties . < br >
* < br >
* This method will block and wait for the properties to be saved . See
* { @ link # saveNB ( ) } for a non - blocking version .
* @ throws IOException
* if there is an error while attempting to save the properties */
public void save ( ) throws IOException { } } | try { Future < Void > task = saveNB ( ) ; task . get ( ) ; } catch ( ExecutionException e ) { Throwable t = e . getCause ( ) ; if ( t instanceof IOException ) { throw ( IOException ) t ; } throw new IOException ( t ) ; } catch ( InterruptedException e ) { throw new IOException ( "Saving of the properties file \"" + getFile ( ) . getAbsolutePath ( ) + "\" was interrupted." ) ; } |
public class Stapler { /** * Gets the URL ( e . g . , " / WEB - INF / side - files / fully / qualified / class / name / jspName " )
* from a class and the JSP name . */
public static String getViewURL ( Class clazz , String jspName ) { } } | return "/WEB-INF/side-files/" + clazz . getName ( ) . replace ( '.' , '/' ) + '/' + jspName ; |
public class FormatStep { /** * < p > Rechnet die angegebene Anzahl von F & uuml ; llzeichen hinzu . < / p >
* @ param padLeft count of left - padding chars
* @ param padRight count of right - padding chars
* @ return updated format step */
FormatStep pad ( int padLeft , int padRight ) { } } | return new FormatStep ( this . processor , this . level , this . section , this . sectionalAttrs , null , // called before build of formatter
this . reserved , this . padLeft + padLeft , this . padRight + padRight , this . orMarker , this . lastOrBlockIndex ) ; |
public class TransactionWriteRequest { /** * Adds update operation ( to be executed on object ) to the list of transaction write operations .
* transactionWriteExpression is used to conditionally update object .
* returnValuesOnConditionCheckFailure specifies which attributes values ( of existing item ) should be returned if condition check fails . */
public TransactionWriteRequest addUpdate ( Object object , DynamoDBTransactionWriteExpression transactionWriteExpression , ReturnValuesOnConditionCheckFailure returnValuesOnConditionCheckFailure ) { } } | transactionWriteOperations . add ( new TransactionWriteOperation ( object , TransactionWriteOperationType . Update , transactionWriteExpression , returnValuesOnConditionCheckFailure ) ) ; return this ; |
public class MarkupEngine { /** * Checks if header separator demarcates end of metadata header
* @ param contents
* @ return true if header separator resides at end of metadata header , false if not */
private boolean headerSeparatorDemarcatesHeader ( List < String > contents ) { } } | List < String > subContents = null ; int index = contents . indexOf ( configuration . getHeaderSeparator ( ) ) ; if ( index != - 1 ) { // get every line above header separator
subContents = contents . subList ( 0 , index ) ; for ( String line : subContents ) { // header should only contain empty lines or lines with ' = ' in
if ( ! line . contains ( "=" ) && ! line . isEmpty ( ) ) { return false ; } } return true ; } else { return false ; } |
public class VertexLabel { /** * Called via { @ link Schema # ensureEdgeLabelExist ( String , VertexLabel , VertexLabel , Map ) }
* This is called when the { @ link EdgeLabel } does not exist and needs to be created .
* @ param edgeLabelName The edge ' s label .
* @ param inVertexLabel The edge ' s in vertex .
* @ param properties The edge ' s properties .
* @ param identifiers The edge ' s user defined identifiers .
* @ return The new EdgeLabel . */
EdgeLabel addEdgeLabel ( String edgeLabelName , VertexLabel inVertexLabel , Map < String , PropertyType > properties , ListOrderedSet < String > identifiers ) { } } | EdgeLabel edgeLabel = EdgeLabel . createEdgeLabel ( edgeLabelName , this , inVertexLabel , properties , identifiers ) ; if ( this . schema . isSqlgSchema ( ) ) { this . outEdgeLabels . put ( this . schema . getName ( ) + "." + edgeLabel . getLabel ( ) , edgeLabel ) ; inVertexLabel . inEdgeLabels . put ( this . schema . getName ( ) + "." + edgeLabel . getLabel ( ) , edgeLabel ) ; } else { this . uncommittedOutEdgeLabels . put ( this . schema . getName ( ) + "." + edgeLabel . getLabel ( ) , edgeLabel ) ; inVertexLabel . uncommittedInEdgeLabels . put ( this . schema . getName ( ) + "." + edgeLabel . getLabel ( ) , edgeLabel ) ; } return edgeLabel ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public ColorManagementResourceDescriptorProcMode createColorManagementResourceDescriptorProcModeFromString ( EDataType eDataType , String initialValue ) { } } | ColorManagementResourceDescriptorProcMode result = ColorManagementResourceDescriptorProcMode . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class DefaultDatastoreWriter { /** * Updates the given list of entities in the Cloud Datastore .
* @ param entities
* the entities to update . The passed in entities must have their ID set for the update
* to work .
* @ return the updated entities
* @ throws EntityManagerException
* if any error occurs while inserting . */
@ SuppressWarnings ( "unchecked" ) public < E > List < E > update ( List < E > entities ) { } } | if ( entities == null || entities . isEmpty ( ) ) { return new ArrayList < > ( ) ; } try { Class < E > entityClass = ( Class < E > ) entities . get ( 0 ) . getClass ( ) ; entityManager . executeEntityListeners ( CallbackType . PRE_UPDATE , entities ) ; Intent intent = ( nativeWriter instanceof Batch ) ? Intent . BATCH_UPDATE : Intent . UPDATE ; Entity [ ] nativeEntities = toNativeEntities ( entities , entityManager , intent ) ; nativeWriter . update ( nativeEntities ) ; List < E > updatedEntities = toEntities ( entityClass , nativeEntities ) ; entityManager . executeEntityListeners ( CallbackType . POST_UPDATE , updatedEntities ) ; return updatedEntities ; } catch ( DatastoreException exp ) { throw DatastoreUtils . wrap ( exp ) ; } |
public class HttpInputStreamEE7 { /** * with the current set of data */
public void initialRead ( ) { } } | try { this . buffer = this . isc . getRequestBodyBuffer ( ) ; if ( null != this . buffer ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Buffer returned from getRequestBodyBuffer : " + this . buffer ) ; } // record the new amount of data read from the channel
this . bytesRead += this . buffer . remaining ( ) ; } } catch ( IOException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Exception encountered during initialRead : " + e ) ; } } |
public class GetAccountRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetAccountRequest getAccountRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getAccountRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Arrays { /** * Finds the number of repeated entries
* @ param num
* Maximum index value
* @ param ind
* Indices to check for repetitions
* @ return Array of length < code > num < / code > with the number of repeated
* indices of < code > ind < / code > */
public static int [ ] bandwidth ( int num , int [ ] ind ) { } } | int [ ] nz = new int [ num ] ; for ( int i = 0 ; i < ind . length ; ++ i ) nz [ ind [ i ] ] ++ ; return nz ; |
public class DeleteGroupRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteGroupRequest deleteGroupRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteGroupRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteGroupRequest . getGroupName ( ) , GROUPNAME_BINDING ) ; protocolMarshaller . marshall ( deleteGroupRequest . getGroupARN ( ) , GROUPARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CPDefinitionOptionValueRelPersistenceImpl { /** * Returns the last cp definition option value rel in the ordered set where uuid = & # 63 ; .
* @ param uuid the uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching cp definition option value rel
* @ throws NoSuchCPDefinitionOptionValueRelException if a matching cp definition option value rel could not be found */
@ Override public CPDefinitionOptionValueRel findByUuid_Last ( String uuid , OrderByComparator < CPDefinitionOptionValueRel > orderByComparator ) throws NoSuchCPDefinitionOptionValueRelException { } } | CPDefinitionOptionValueRel cpDefinitionOptionValueRel = fetchByUuid_Last ( uuid , orderByComparator ) ; if ( cpDefinitionOptionValueRel != null ) { return cpDefinitionOptionValueRel ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "uuid=" ) ; msg . append ( uuid ) ; msg . append ( "}" ) ; throw new NoSuchCPDefinitionOptionValueRelException ( msg . toString ( ) ) ; |
public class ReadRowsResponse { /** * < code > repeated . google . bigtable . v2 . ReadRowsResponse . CellChunk chunks = 1 ; < / code > */
public java . util . List < com . google . bigtable . v2 . ReadRowsResponse . CellChunk > getChunksList ( ) { } } | return chunks_ ; |
public class SparkLine { /** * Sets the color that will be used for a custom area gradient at bottom
* @ param CUSTOM _ AREA _ FILL _ COLOR _ BOTTOM */
public void setCustomAreaFillBottom ( final Color CUSTOM_AREA_FILL_COLOR_BOTTOM ) { } } | customAreaFillBottom = CUSTOM_AREA_FILL_COLOR_BOTTOM ; init ( INNER_BOUNDS . width , INNER_BOUNDS . height ) ; repaint ( INNER_BOUNDS ) ; |
public class MtasRBTree { /** * Flip colors .
* @ param n the n */
private void flipColors ( MtasRBTreeNode n ) { } } | // n must have opposite color of its two children
assert ( n != null ) && ( n . leftChild != null ) && ( n . rightChild != null ) ; assert ( ! isRed ( n ) && isRed ( n . leftChild ) && isRed ( n . rightChild ) ) || ( isRed ( n ) && ! isRed ( n . leftChild ) && ! isRed ( n . rightChild ) ) ; n . color ^= 1 ; n . leftChild . color ^= 1 ; n . rightChild . color ^= 1 ; |
public class ResourceHandler { /** * Sends an Error response with status message
* @ param ctx channel context
* @ param status status */
private void sendError ( ChannelHandlerContext ctx , HttpResponseStatus status ) { } } | HttpResponse response = new DefaultHttpResponse ( HttpVersion . HTTP_1_1 , status ) ; response . headers ( ) . set ( HttpHeaderNames . CONTENT_TYPE , "text/plain; charset=UTF-8" ) ; ByteBuf content = Unpooled . copiedBuffer ( "Failure: " + status . toString ( ) + "\r\n" , CharsetUtil . UTF_8 ) ; ctx . write ( response ) ; // Close the connection as soon as the error message is sent .
ctx . writeAndFlush ( content ) . addListener ( ChannelFutureListener . CLOSE ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.