private static void replace checkboxes ( final u i defaults defaults ) { defaults put ( " check box u i " , m t check box u i class get name ( ) ) ; defaults put ( m t check box u i class get name ( ) , m t check box u i class ) ; defaults put ( " check box menu item u i " , m t check box menu item u i class get name ( ) ) ; defaults put ( m t check box menu item u i class get name ( ) , m t check box menu item u i class ) ; defaults put ( " check box border " , new m t check box border ( ) ) ; }


returns an immutable multimap containing the given entries , in order repeated occurrences of an entry ( according to { @ link object # equals } ) after the first are ignored

public static < k , v > immutable set multimap < k , v > of ( k k 1 , v v 1 , k k 2 , v v 2 ) { immutable set multimap builder < k , v > builder = immutable set multimap builder ( ) ; builder put ( k 1 , v 1 ) ; builder put ( k 2 , v 2 ) ; return builder build ( ) ; }


protected static boolean match tokens ( string [ ] tokens , string [ ] patterns ) { int pat ndx start = 0 ; int pat ndx end = patterns length - 1 ; int tok ndx start = 0 ; int tok ndx end = tokens length - 1 ; while ( ( pat ndx start < = pat ndx end ) & & ( tok ndx start < = tok ndx end ) ) { / / find first * * string pat dir = patterns [ pat ndx start ] ; if ( pat dir equals ( path match ) ) { break ; } if ( ! match ( tokens [ tok ndx start ] , pat dir ) ) { return false ; } pat ndx start + + ; tok ndx start + + ; } if ( tok ndx start > tok ndx end ) { for ( int i = pat ndx start ; i < = pat ndx end ; i + + ) { / / string is finished if ( ! patterns [ i ] equals ( path match ) ) { return false ; } } return true ; } if ( pat ndx start > pat ndx end ) { return false ; / / string is not finished , but pattern is } while ( ( pat ndx start < = pat ndx end ) & & ( tok ndx start < = tok ndx end ) ) { / / to the last * * string pat dir = patterns [ pat ndx end ] ; if ( pat dir equals ( path match ) ) { break ; } if ( ! match ( tokens [ tok ndx end ] , pat dir ) ) { return false ; } pat ndx end - - ; tok ndx end - - ; } if ( tok ndx start > tok ndx end ) { for ( int i = pat ndx start ; i < = pat ndx end ; i + + ) { / / string is finished if ( ! patterns [ i ] equals ( path match ) ) { return false ; } } return true ; } while ( ( pat ndx start ! = pat ndx end ) & & ( tok ndx start < = tok ndx end ) ) { int pat idx tmp = - 1 ; for ( int i = pat ndx start + 1 ; i < = pat ndx end ; i + + ) { if ( patterns [ i ] equals ( path match ) ) { pat idx tmp = i ; break ; } } if ( pat idx tmp = = pat ndx start + 1 ) { pat ndx start + + ; / / skip * *


public string insn comment string ( dalv insn insn , boolean note indices ) { return branch comment ( insn ) ; }


creates a { @ code compact hash set } instance , with a high enough " initial capacity " that it should hold { @ code expected size } elements without growth

public static < e > compact hash set < e > create with expected size ( int expected size ) { return new compact hash set < > ( expected size ) ; }


removes the bottom component ( the conflict component ) from the listing merge panel this should be called when the conflict apply button is activated

private void remove bottom component ( ) { try { swing utilities invoke and wait ( new runnable ( ) { @ override public void run ( ) { if ( merge panel ! = null ) { merge panel set bottom component ( null ) ; } } } ) ; } catch ( interrupted exception e ) { msg error ( this , " unexpected exception : " + e get message ( ) , e ) ; } catch ( invocation target exception e ) { msg error ( this , " unexpected exception : " + e get message ( ) , e ) ; } }


where the element was defined < code > optional aapt pb source source = 1 ; < code >


specifies whether to analyze wildcards defaults to false if unset

public void analyze wildcard ( boolean analyze wildcard ) { this analyze wildcard = analyze wildcard ; }


given a bit index , return the byte index containing it

private static int byte index ( int bit index ) { return bit index > > > address bits per word ; }


ends the tar archive without closing the underlying output stream the result is that the two eof records of nulls are written

public void finish ( ) throws i o exception { / / see bugzilla 28776 for a discussion on this / / http : / / issues apache org / bugzilla / show bug cgi ? id = 28776 this write e o f record ( ) ; this write e o f record ( ) ; }


wrap the given component and return a new root

component create wrapper ( component context c , component root ) ;


parse namespace from a string the string must be in legal format defined by each { @ link allocation tag namespace type }

public static target applications namespace parse ( string namespace str ) throws invalid allocation tags query exception { / / return the default namespace if no valid string is given if ( strings is null or empty ( namespace str ) ) { return new self ( ) ; } / / normalize the input , escape additional chars list < string > ns values = normalize ( namespace str ) ; / / the first string should be the prefix string ns prefix = ns values get ( 0 ) ; allocation tag namespace type allocation tag namespace type = from string ( ns prefix ) ; switch ( allocation tag namespace type ) { case self : return new self ( ) ; case not self : return new not self ( ) ; case all : return new all ( ) ; case app id : if ( ns values size ( ) ! = 2 ) { throw new invalid allocation tags query exception ( " missing the application id in the namespace string : " + namespace str ) ; } string app i d str = ns values get ( 1 ) ; return parse app i d ( app i d str ) ; case app tag : if ( ns values size ( ) ! = 2 ) { throw new invalid allocation tags query exception ( " missing the application tag in the namespace string : " + namespace str ) ; } return new app tag ( ns values get ( 1 ) ) ; default : throw new invalid allocation tags query exception ( " invalid namespace string " + namespace str ) ; } }


sets the main class entry for the manifest a value of < code > null < code > ( the default ) will omit the entry

public void set main class ( string main class ) { this main class = main class ; }


compares the given program against original to determine if any tags differ between the two any tags in original that are not in the given program indicate deletions

private collection < ? extends function tag > get deleted tags ( program program , task monitor monitor ) { / / 1 get all tags in the original database function manager d b orig function manager d b = ( function manager d b ) original pgm get function manager ( ) ; collection < ? extends function tag > original tags = orig function manager d b get function tag manager ( ) get all function tags ( ) ; / / 2 get all tags in the given program database function manager d b my function manager d b = ( function manager d b ) program get function manager ( ) ; collection < ? extends function tag > program tags = my function manager d b get function tag manager ( ) get all function tags ( ) ; / / 3 determine which ones are in original but not in the given program original tags remove all ( program tags ) ; return original tags ; }


adds a standard id column required by standard android classes , e g list adapters

public property builder add id property ( ) { property builder builder = add long property ( " id " ) ; builder db name ( " id " ) primary key ( ) ; return builder ; }


public map < string , map < string , string > > get map map string ( ) { return map map string ; }


forwards the touch event to the controller

public boolean on touch event ( motion event event ) { if ( ! is controller valid ( ) ) { return false ; } return m controller on touch event ( event ) ; }


calling this method signals that the mailbox - thread should ( temporarily ) stop invoking the default action , e g because there is currently no input available

private mailbox default action suspension suspend default action ( @ nullable timer gauge suspension timer ) { check state ( mailbox is mailbox thread ( ) , " suspending must only be called from the mailbox thread ! " ) ; check state ( suspended default action = = null , " default action has already been suspended " ) ; if ( suspended default action = = null ) { suspended default action = new default action suspension ( suspension timer ) ; ensure control flow signal check ( ) ; } return suspended default action ; }


public void shutdown now ( ) { if ( dispatch executor ! = null ) { dispatch executor shutdown now ( ) ; } }


returns < code > true < code > iff the resource behind this entity is still open ie entities associated with it can remain in the cache ie index shard is still open


returns the list of files that are required to execute this spawn ( e g the compiler binary ) , in contrast to files necessary for the tool to do its work ( e g source code to be compiled ) the returned set of files is a subset of what get input files ( ) returns this method explicitly does not expand middleman artifacts pass the result to an appropriate utility method on { @ link com google devtools build lib actions artifact } to expand the middlemen this is for use with persistent workers , so we can restart workers when their binaries have changed

nested set < ? extends action input > get tool files ( ) ;


set a custom x stream { @ link name coder } to use the default is an { @ link xml friendly name coder }

public void set name coder ( name coder name coder ) { this name coder = name coder ; }


enable help for this component ; used the model name as part of the help id

private void enable help ( ) { help service help service = help get help service ( ) ; if ( help service ! = null ) { help service register help ( this , model get help location ( ) ) ; } }


synthesize the subscribed { @ link url u r ls }

list < url > synthesize ( url subscribed u r l , collection < service instance > service instances ) ;


test that empty transporthttp types are not printed out as part of the cluster stats xcontent output

public void test network types to x content ( ) throws exception { cluster stats nodes network types stats = new cluster stats nodes network types ( empty list ( ) ) ; assert equals ( " { \ " transport types \ " : { } , \ " http types \ " : { } } " , to x content ( stats , x content type json , random boolean ( ) ) utf 8 to string ( ) ) ; list < node info > node infos = singleton list ( create node info ( " node 0 " , null , null ) ) ; stats = new cluster stats nodes network types ( node infos ) ; assert equals ( " { \ " transport types \ " : { } , \ " http types \ " : { } } " , to x content ( stats , x content type json , random boolean ( ) ) utf 8 to string ( ) ) ; node infos = arrays as list ( create node info ( " node 1 " , " " , " " ) , create node info ( " node 2 " , " custom " , " custom " ) , create node info ( " node 3 " , null , " custom " ) ) ; stats = new cluster stats nodes network types ( node infos ) ; assert equals ( " { " + " \ " transport types \ " : { \ " custom \ " : 1 } , " + " \ " http types \ " : { \ " custom \ " : 2 } " + " } " , to x content ( stats , x content type json , random boolean ( ) ) utf 8 to string ( ) ) ; }


this method attempts to find the bottom - right alignment pattern in the image it is a bit messy since it ' s pretty performance - critical and so is written to be fast foremost

alignment pattern find ( ) throws not found exception { int start x = this start x ; int height = this height ; int max j = start x + width ; int middle i = start y + ( height / 2 ) ; / / we are looking for black / white / black modules in 1 : 1 : 1 ratio ; / / this tracks the number of black / white / black modules seen so far int [ ] state count = new int [ 3 ] ; for ( int i gen = 0 ; i gen < height ; i gen + + ) { / / search from middle outwards int i = middle i + ( ( i gen & 0x 0 1 ) = = 0 ? ( i gen + 1 ) / 2 : - ( ( i gen + 1 ) / 2 ) ) ; state count [ 0 ] = 0 ; state count [ 1 ] = 0 ; state count [ 2 ] = 0 ; int j = start x ; / / burn off leading white pixels before anything else ; if we start in the middle of / / a white run , it doesn ' t make sense to count its length , since we don ' t know if the / / white run continued to the left of the start point while ( j < max j & & ! image get ( j , i ) ) { j + + ; } int current state = 0 ; while ( j < max j ) { if ( image get ( j , i ) ) { / / black pixel if ( current state = = 1 ) { / / counting black pixels state count [ 1 ] + + ; } else { / / counting white pixels if ( current state = = 2 ) { / / a winner ? if ( found pattern cross ( state count ) ) { / / yes alignment pattern confirmed = handle possible center ( state count , i , j ) ; if ( confirmed ! = null ) { return confirmed ; } } state count [ 0 ] = state count [ 2 ] ; state count [ 1 ] = 1 ; state count [ 2 ] = 0 ; current state = 1 ; } else { state count [ + + current state ] + + ; } } } else { / / white pixel if ( current state = = 1 ) { / / counting black pixels current state + + ; } state count [ current state ] + + ; } j + + ; } if ( found pattern cross ( state count ) ) { alignment pattern confirmed = handle possible center ( state count , i , max j ) ; if ( confirmed ! = null ) { return confirmed ; } } } / / hmm , nothing we saw was observed and confirmed twice if we had / / any guess at all , return it if ( ! possible centers is empty ( ) ) { return possible centers get ( 0 ) ; } throw not found exception get not found instance ( ) ; }


updates each row within the grid such that it ' s x values are set to center the row in the grid each row will be updated so that all its columns start at zero after that , each column will be centered in the grid

public void center rows ( ) { list < row < v > > rows = rows ( ) ; int max col = column count ( rows ) ; for ( row < v > row : rows ) { row = zero row columns ( row ) ; int row column count = row get column count ( ) ; if ( row column count = = max col ) { continue ; / / already the full size ; no need to center } int delta = max col - row column count ; int offset = delta / 2 ; list < v > vertices = row get vertices ( ) ; for ( v v : vertices ) { if ( v = = null ) { continue ; } int old col = col ( v ) ; set ( v , row index , old col + offset ) ; } row dispose ( ) ; } }


return the cached entries for the given hostname

list < ? extends dns cache entry > get ( string hostname , dns record [ ] additionals ) ;


gets the model package name for generated sources

public string get model package ( ) { return model package ; }


returns method descriptor to the proto service method

method descriptor get method descriptor ( ) ;


return the string representation of the object in the output format if h option is false file sizes are returned in bytes if h option is true file sizes are returned in human readable

public string to string ( boolean h option , boolean t option , list < storage type > types ) { if ( t option ) { return get types quota usage ( h option , types ) ; } return get quota usage ( h option ) ; }


# simulates the behavior of a system restart : # the pid directory is deleted by the operating system # but it should not block es from starting # see https : github comelasticelasticsearchissues 1 1 5 9 4

public void test 8 0 delete p i d d i rand restart ( ) throws exception { assume true ( is systemd ( ) ) ; rm ( installation pid dir ) ; sh run ( " systemd - tmpfiles - - create " ) ; start elasticsearch ( ) ; final path pid file = installation pid dir resolve ( " elasticsearch pid " ) ; assert that ( pid file , file exists ( ) ) ; stop elasticsearch ( ) ; }


sets this matrix to a concatenation of translation , rotation and scale it is a more efficient form for : < code > idt ( ) translate ( x , y ) rotate ( degrees ) scale ( scale x , scale y ) < code >

public affine 2 set to trn rot scl ( float x , float y , float degrees , float scale x , float scale y ) { m 0 2 = x ; m 1 2 = y ; if ( degrees = = 0 ) { m 0 0 = scale x ; m 0 1 = 0 ; m 1 0 = 0 ; m 1 1 = scale y ; } else { float sin = math utils sin deg ( degrees ) ; float cos = math utils cos deg ( degrees ) ; m 0 0 = cos * scale x ; m 0 1 = - sin * scale y ; m 1 0 = sin * scale x ; m 1 1 = cos * scale y ; } return this ; }


returns the timestamp of the day ' s start ( which is midnight 00 : 00 : 00 am ) for a given input timestamp

public static long get top of the day timestamp ( long time stamp ) { return time stamp - ( time stamp % millis one day ) ; }


public abstract immutable list < string > standard javacopts ( ) ;


return if native hadoop libraries , if present , can be used for this job

public boolean get load native libraries ( configuration conf ) { return conf get boolean ( common configuration keys io native lib available key , common configuration keys io native lib available default ) ; }


register all the files in the provided lib directories as yarn local resources with public visibility , which means that they will be cached in the nodes and reused by different applications

list < string > register provided local resources ( ) { check not null ( local resources ) ; final array list < string > class paths = new array list < > ( ) ; provided shared libs for each ( ( file name , file status ) - > { final path file path = file status get path ( ) ; log debug ( " using remote file { } to register local resource " , file path ) ; final yarn local resource descriptor descriptor = yarn local resource descriptor from file status ( file name , file status , local resource visibility public , local resource type file ) ; local resources put ( file name , descriptor to local resource ( ) ) ; remote paths add ( file path ) ; env ship resource list add ( descriptor ) ; if ( ! is flink dist jar ( file path get name ( ) ) & & ! is plugin ( file path ) ) { class paths add ( file name ) ; } else if ( is flink dist jar ( file path get name ( ) ) ) { flink dist = descriptor ; } } ) ; return class paths ; }


patch fake : to test \ & quot ; client \ & quot ; model to test \ & quot ; client \ & quot ; model

public response entity < client > test client model ( @ api param ( value = " client model " , required = true ) @ valid @ request body client body ) { for ( media type media type : media type parse media types ( request get header ( " accept " ) ) ) { if ( media type is compatible with ( media type value of ( " application / json " ) ) ) { string example string = " { \ " client \ " : \ " client \ " } " ; api util set example response ( request , " application / json " , example string ) ; break ; } } return new response entity < > ( http status not implemented ) ; }


gets the type corresponding to an array of this type

public type get array type ( ) { if ( array type = = null ) { array type = put intern ( new type ( ' [ ' + descriptor , bt object ) ) ; } return array type ; }


process a sock j s http request see the " base url " , " static u r ls " , and " session u r ls " sections of the < a href = " https : sockjs github iosockjs - protocolsockjs - protocol - 0 3 3 html " > sock j s protocol for details on the types of u r ls expected

void handle request ( server http request request , server http response response , @ nullable string sock js path , web socket handler handler ) throws sock js exception ;


returns the number of temporary memory bytes allocated to process the records this size depends on whether the records need decompression andor conversion : non compressed , no conversion : zero non compressed , with conversion : size of the converted buffer compressed , no conversion : size of the original buffer after decompression compressed , with conversion : size of the original buffer after decompression + size of the converted buffer uncompressed

public long temporary memory bytes ( ) { return temporary memory bytes ; }


initialize config , such as check dist path

public void init ( ) { file dist = new file ( analyze result dist ) ; if ( ! dist exists ( ) ) { dist mkdirs ( ) ; return ; } if ( dist is file ( ) ) { throw new illegal argument exception ( analyze result dist + " must be a directory " ) ; } }


advance cursor by n positions within the block

private void in block advance ( long n ) throws i o exception { for ( long i = 0 ; i < n ; + + i ) { check key ( ) ; if ( ! value buffer input stream is closed ( ) ) { value buffer input stream close ( ) ; } klen = - 1 ; current location inc record index ( ) ; } }


returns an immutable array containing the given values , in order

public static immutable long array copy of ( collection < long > values ) { return values is empty ( ) ? empty : new immutable long array ( longs to array ( values ) ) ; }


returns the { @ link constraint value info } for the given { @ link constraint setting info } , or { @ code null } if none exists

public constraint value info get ( constraint setting info constraint ) { / / first , check locally if ( constraints ( ) contains key ( constraint ) ) { return constraints ( ) get ( constraint ) ; } / / then , check the parent , directly to ignore defaults if ( parent ( ) ! = null ) { return parent ( ) get ( constraint ) ; } / / finally , since this constraint isn ' t set , fall back to the default return constraint default constraint value ( ) ; }


checking if a unit included by known units is an expensive operation this can be avoided in critical path in rm

public void set units without validation ( string r units ) { this units = r units ; }


loads a { @ link fingerprint } from the storage with the given unique id

public static @ check for null fingerprint load ( @ non null string id ) throws i o exception { long start = 0 ; if ( logger is loggable ( level fine ) ) { start = system current time millis ( ) ; } fingerprint storage configured fingerprint storage = fingerprint storage get ( ) ; fingerprint storage file fingerprint storage = file fingerprint storage get file fingerprint storage ( ) ; fingerprint loaded = configured fingerprint storage load ( id ) ; if ( loaded = = null & & ! ( configured fingerprint storage instanceof file fingerprint storage ) & & file fingerprint storage is ready ( ) ) { loaded = file fingerprint storage load ( id ) ; if ( loaded ! = null ) { init facets ( loaded ) ; configured fingerprint storage save ( loaded ) ; file fingerprint storage delete ( id ) ; } } else { init facets ( loaded ) ; } if ( logger is loggable ( level fine ) ) { logger fine ( " loading fingerprint took " + ( system current time millis ( ) - start ) + " ms " ) ; } return loaded ; }


sets the concurrency level that will be used by the to - be - built { @ link interner }

public interner builder concurrency level ( int concurrency level ) { this map maker concurrency level ( concurrency level ) ; return this ; }


rename a file under a snapshottable directory , file does not exist in a snapshot

public void test rename file not in snapshot ( ) throws exception { hdfs mkdirs ( sub 1 ) ; hdfs allow snapshot ( sub 1 ) ; hdfs create snapshot ( sub 1 , snap 1 ) ; d f s test util create file ( hdfs , file 1 , blocksize , repl , seed ) ; hdfs rename ( file 1 , file 2 ) ; / / query the diff report and make sure it looks as expected snapshot diff report diff report = hdfs get snapshot diff report ( sub 1 , snap 1 , " " ) ; list < diff report entry > entries = diff report get diff list ( ) ; assert true ( entries size ( ) = = 2 ) ; assert true ( exists in diff report ( entries , diff type modify , " " , null ) ) ; assert true ( exists in diff report ( entries , diff type create , file 2 get name ( ) , null ) ) ; }


public long [ ] get longs ( string name , long [ ] default value ) { return map contains key ( name ) ? ( long [ ] ) map get ( name ) : default value ; }


test basic directory creation , access , removal

public void test basic dir ( ) throws i o exception { file d = new file ( mount point , " dir 1 " ) ; / / mkdir , access and rm via the mount exec assert succeeds ( " mkdir " + d get absolute path ( ) ) ; exec assert succeeds ( " ls " + d get absolute path ( ) ) ; exec assert succeeds ( " rmdir " + d get absolute path ( ) ) ; / / the dir should no longer exist exec assert fails ( " ls " + d get absolute path ( ) ) ; }


public void uuid test ( ) { / / todo : test uuid }


prune files , in batches there ' s optionally a sleep between each batch

public long prune ( prune mode prune mode , long cutoff , string key prefix ) throws i o exception { log debug ( " prune { } under { } with age { } " , prune mode = = prune mode all by modtime ? " files and tombstones " : " tombstones " , key prefix , cutoff ) ; final item collection < scan outcome > items = expired files ( prune mode , cutoff , key prefix ) ; return inner prune ( prune mode , cutoff , key prefix , items ) ; }


scenario : explicitly configure to not add attachment verify : no id attribute added in attachment

public void test attach invocation id if async force not attache ( ) { url url = url value of ( " dubbo : / / localhost / ? test async = true & " + auto attach invocationid key + " = false " ) ; invocation inv = new rpc invocation ( " test " , " demo service " , " " , new class [ ] { } , new string [ ] { } ) ; rpc utils attach invocation id if async ( url , inv ) ; assert null ( rpc utils get invocation id ( inv ) ) ; }


clears the stack all items will be removed

public void clear ( ) { list clear ( ) ; }


public void update clipboard ( ) { remove ( filter table ) ; filter table dispose ( ) ; pattern info table = new pattern info table model ( plugin ) ; filter table = new g filter table < > ( pattern info table ) ; add ( filter table , 0 ) ; update u i ( ) ; }


encode initial x where it is usually pronounced as s

boolean encode initial x ( ) { / / current chinese pinyin spelling if ( string at ( 0 , 3 , " xia " , " xio " , " xie " , " " ) | | string at ( 0 , 2 , " xu " , " " ) ) { metaph add ( " x " ) ; m current + + ; return true ; } / / else if ( ( m current = = 0 ) ) { metaph add ( " s " ) ; m current + + ; return true ; } return false ; }


public void name test ( ) { / / todo : test name }


stops async lazy persist service for a volume

synchronized void remove volume ( fs volume impl volume ) { string storage id = volume get storage i d ( ) ; if ( executors = = null ) { throw new runtime exception ( " async disk service is already shutdown " ) ; } thread pool executor executor = executors get ( storage id ) ; if ( executor = = null ) { throw new runtime exception ( " can not find volume with storage id " + storage id + " to remove " ) ; } else { executor shutdown ( ) ; executors remove ( storage id ) ; } }


applies the given window function to each window the window function is called for each evaluation of the window for each key individually the output of the window function is interpreted as a regular non - windowed stream arriving data is incrementally aggregated using the given aggregate function this means that the window function typically has only a single value to process when called

public < acc , v , r > single output stream operator < r > aggregate ( aggregate function < t , acc , v > agg function , window function < v , r , k , w > window function ) { check not null ( agg function , " agg function " ) ; check not null ( window function , " window function " ) ; type information < acc > accumulator type = type extractor get aggregate function accumulator type ( agg function , input get type ( ) , null , false ) ; type information < v > agg result type = type extractor get aggregate function return type ( agg function , input get type ( ) , null , false ) ; type information < r > result type = get window function return type ( window function , agg result type ) ; return aggregate ( agg function , window function , accumulator type , result type ) ; }


returns an iterator for all varnodes in the tree ordered by address

public iterator < varnode a s t > loc range ( ) { return vbank loc range ( ) ; }


sets the { @ link cache data source flags } the default is { @ code 0 }

public factory set flags ( @ cache data source flags int flags ) { this flags = flags ; return this ; }


hook designed for extensibility so one can pass a different cache on each resolution attempt instead of using the global one

protected void do resolve ( string inet host , dns record [ ] additionals , promise < inet address > promise , dns cache resolve cache ) throws exception { if ( inet host = = null | | inet host is empty ( ) ) { / / if an empty hostname is used we should use " localhost " , just like inet address get by name ( ) does promise set success ( loopback address ( ) ) ; return ; } final byte [ ] bytes = net util create byte array from ip address string ( inet host ) ; if ( bytes ! = null ) { / / the inet host is actually an ipaddress promise set success ( inet address get by address ( bytes ) ) ; return ; } final string hostname = hostname ( inet host ) ; inet address hosts file entry = resolve hosts file entry ( hostname ) ; if ( hosts file entry ! = null ) { promise set success ( hosts file entry ) ; return ; } if ( ! do resolve cached ( hostname , additionals , promise , resolve cache ) ) { do resolve uncached ( hostname , additionals , promise , resolve cache , true ) ; } }


public optional < encrypt table > find encrypt table ( final string logic table ) { return optional of nullable ( tables get ( logic table ) ) ; }


the time when the service was created , e g 2016 - 03 - 16t01 : 01 : 49 000z

public service launch time ( date launch time ) { this launch time = launch time = = null ? null : ( date ) launch time clone ( ) ; return this ; }


returns a sample value for the field , to be used when querying the field normally this is the same format as what is indexed as part of a document , and returned by { @ link # get sample value for document ( ) } , but there are cases where fields are queried differently frow how they are indexed e g token count or runtime fields

protected object get sample value for query ( ) { return get sample value for document ( ) ; }


the command uses post ( not sure why ? ) but does not actually modify any state so it does not require csrf

public void do post ( http servlet request request , http servlet response response ) throws servlet exception , i o exception { project project = request get parameter ( " project " ) ! = null ? get project ( request ) : null ; preference store ps = project ! = null ? project get metadata ( ) get preference store ( ) : project manager singleton get preference store ( ) ; map < string , object > map = new hash map < > ( ) ; for ( string key : ps get keys ( ) ) { object pref = ps get ( key ) ; if ( pref = = null | | pref instanceof string | | pref instanceof number | | pref instanceof boolean ) { map put ( key , pref ) ; } } respond j s o n ( response , map ) ; }


poll the launched name node ' s jmx for a specific value , waiting for it to cross some threshold continues until the threshold has been crossed or { @ code should exit } returns true periodically logs the current value

private static void wait for name node j m x value ( string value name , string jmx bean query , string jmx property , double threshold , double print threshold , boolean decreasing , properties name node properties , supplier < boolean > should exit , logger log ) throws interrupted exception { double last printed value = decreasing ? double max value : double min value ; double value ; int retry count = 0 ; long start time = time monotonic now ( ) ; while ( ! should exit get ( ) ) { try { value = double parse double ( fetch name node j m x value ( name node properties , jmx bean query , jmx property ) ) ; if ( ( decreasing & & value < = threshold ) | | ( ! decreasing & & value > = threshold ) ) { log info ( string format ( " % s = % 2f ; % s threshold of % 2f ; done waiting after % d ms " , value name , value , decreasing ? " below " : " above " , threshold , time monotonic now ( ) - start time ) ) ; break ; } else if ( math abs ( value - last printed value ) > = print threshold ) { log info ( string format ( " % s : % 2f " , value name , value ) ) ; last printed value = value ; } } catch ( i o exception ioe ) { if ( + + retry count % 20 = = 0 ) { log warn ( " unable to fetch { } ; retried { } times / waited { } ms " , value name , retry count , time monotonic now ( ) - start time , ioe ) ; } } thread sleep ( 3000 ) ; } }


public void set poolable ( boolean poolable ) throws s q l exception { check closed ( ) ; }


gets the name map , based on the given map and a given descriptor a new empty map is created if necessary

static map retrieve name map ( map descriptor map , string descriptor ) { / / see if we can find the nested map with this descriptor key map name map = ( map ) descriptor map get ( descriptor ) ; / / create a new one if not if ( name map = = null ) { name map = new hash map ( ) ; descriptor map put ( descriptor , name map ) ; } return name map ; }


returns the reference from the data to the given address

public final reference get reference ( data data , address to address ) { reference [ ] references = current program get reference manager ( ) get references from ( data get min address ( ) ) ; for ( reference reference : references ) { if ( reference get to address ( ) equals ( to address ) ) { return reference ; } } return null ; }


find the fields constant that matches field id , or null if its not found

public static fields find by thrift id ( int field id ) { switch ( field id ) { case 1 : / / file return file ; default : return null ; } }


return { @ link shards allocator } implementations added by this plugin the key of the returned { @ link map } is the name of the allocator , and the value is a function to construct the allocator

default map < string , supplier < shards allocator > > get shards allocators ( settings settings , cluster settings cluster settings ) { return collections empty map ( ) ; }


cancels this item , which updates { @ link # future } to notify the listener , and also leaves the queue

/ * package * / boolean cancel ( queue q ) { boolean r = leave ( q ) ; if ( r ) { future set as cancelled ( ) ; left item li = new left item ( this ) ; li enter ( q ) ; } return r ; }


inserts the specified element at the front of this deque

public void add first ( e e ) { if ( e = = null ) throw new null pointer exception ( " e = = null " ) ; elements [ head = ( head - 1 ) & ( elements length - 1 ) ] = e ; if ( head = = tail ) double capacity ( ) ; }


find the first matching delimiter and return the index of the last byte of the delimiter , or { @ code - 1 } if not found


put the bytes provided into the buffer at the specified offset the number of bytes stored is determined by the length of the bytes array

public void put ( int offset , byte [ ] bytes ) throws i o exception { synchronized ( dbh ) { dbh check transaction ( ) ; buf put ( offset , bytes ) ; } }


public offset date time get ship date ( ) { return ship date ; }


return the files that satisfy the filter in directory

public static list < file > list files in dir with filter ( final file dir , final file filter filter , final boolean is recursive , final comparator < file > comparator ) { list < file > files = list files in dir with filter inner ( dir , filter , is recursive ) ; if ( comparator ! = null ) { collections sort ( files , comparator ) ; } return files ; }


display local thumbnail previews , for example exif thumbnails

public t local thumbnail previews enabled ( boolean local thumbnail previews enabled ) { m local thumbnail previews enabled = local thumbnail previews enabled ; return get this ( ) ; }


public void apply angular impulse ( float impulse ) { if ( m type ! = body type dynamic ) { return ; } if ( is awake ( ) = = false ) { set awake ( true ) ; } m angular velocity + = m inv i * impulse ; }


d b d document find document ( @ not null d b r progress monitor monitor , map < string , object > key ) throws d b exception ;


calculate the shares for { @ code first } and { @ code second } according to { @ code cluster res } , and store the results in { @ code first shares } and { @ code second shares } , respectively { @ code max } will be populated with the max shares from { @ code first share } and { @ code second share } in the first and second indices , respectively all parameters must be non - null , and { @ code max } must have a length of at least 2

private void calculate shares ( resource information [ ] cluster res , resource first , resource second , double [ ] first shares , double [ ] second shares , double [ ] max ) { resource information [ ] first res = first get resources ( ) ; resource information [ ] second res = second get resources ( ) ; max [ 0 ] = 0 0 ; max [ 1 ] = 0 0 ; int max length = resource utils get number of countable resource types ( ) ; for ( int i = 0 ; i < max length ; i + + ) { first shares [ i ] = calculate share ( cluster res [ i ] , first res [ i ] ) ; second shares [ i ] = calculate share ( cluster res [ i ] , second res [ i ] ) ; if ( first shares [ i ] = = float positive infinity | | second shares [ i ] = = float positive infinity ) { continue ; } if ( first shares [ i ] > max [ 0 ] ) { max [ 0 ] = first shares [ i ] ; } if ( second shares [ i ] > max [ 1 ] ) { max [ 1 ] = second shares [ i ] ; } } }


invoked after having rendered all groups


set the single type of { @ link callback } to use this may be used instead of { @ link # set callback } when calling { @ link # create class } , since it may not be possible to have an array of actual callback instances

public void set callback type ( class callback type ) { set callback types ( new class [ ] { callback type } ) ; }


gets the executor , provided by this rpc service this executor can be used for example for the { @ code handle async ( ) } or { @ code then accept async ( ) } methods of futures < b > important : < b > this executor does not isolate the method invocations against any concurrent invocations and is therefore not suitable to run completion methods of futures that modify state of an { @ link rpc endpoint } for such operations , one needs to use the { @ link rpc endpoint # get main thread executor ( ) main thread execution context } of that { @ code rpc endpoint }


public string get small snake ( ) { return small snake ; }


public void map map anytype test ( ) { / / todo : test map map anytype }


returns the highest value in the snapshot

public long get max ( ) { if ( values length = = 0 ) { return 0 ; } return values [ values length - 1 ] ; }


called after a new file system instance is constructed

public void initialize ( final uri the uri , final configuration conf ) throws i o exception { super initialize ( the uri , conf ) ; set conf ( conf ) ; config = conf ; enable inner cache = config get boolean ( config viewfs enable inner cache , config viewfs enable inner cache default ) ; fs getter fs getter = fs getter ( ) ; final inner cache inner cache = new inner cache ( fs getter ) ; / / now build client side view ( i e client side mount table ) from config final string authority = the uri get authority ( ) ; string table name = authority ; if ( the uri get port ( ) ! = - 1 & & config get boolean ( config viewfs ignore port in mount table name , config viewfs ignore port in mount table name default ) ) { table name = the uri get host ( ) ; } try { my uri = new uri ( get scheme ( ) , authority , " / " , null , null ) ; boolean initing uri as fallback on no mounts = support auto adding fallback on no mounts ( ) ; fs state = new inode tree < file system > ( conf , table name , my uri , initing uri as fallback on no mounts ) { @ override protected file system get target file system ( final uri uri ) throws u r i syntax exception , i o exception { file system fs ; if ( enable inner cache ) { fs = inner cache get ( uri , config ) ; } else { fs = fs getter get ( uri , config ) ; } return new ch rooted file system ( fs , uri ) ; } @ override protected file system get target file system ( final i node dir < file system > dir ) throws u r i syntax exception { return new internal dir of view fs ( dir , creation time , ugi , my uri , config , this ) ; } @ override protected file system get target file system ( final string settings , final uri [ ] uris ) throws u r i syntax exception , i o exception { return nfly f system create file system ( uris , config , settings , fs getter ) ; } } ; working dir = this get home directory ( ) ; rename strategy = rename strategy value of ( conf get ( constants config viewfs rename strategy , rename strategy same mountpoint to string ( ) ) ) ; } catch ( u r i syntax exception e ) { throw new i o exception ( " u r i syntax exception : " + the uri ) ; } if ( enable inner cache ) { / / all fs instances are created and cached on startup the cache is / / readonly after the initialize ( ) so the concurrent access of the cache / / is safe cache = inner cache ; } }


invoke the handler , wrapping any exception to a { @ link listener execution failed exception } with a dedicated error message

private object invoke handler ( javax jms message jms message , @ nullable session session , message < ? > message ) { invocable handler method handler method = get handler method ( ) ; try { return handler method invoke ( message , jms message , session ) ; } catch ( messaging exception ex ) { throw new listener execution failed exception ( create messaging error message ( " listener method could not be invoked with incoming message " ) , ex ) ; } catch ( exception ex ) { throw new listener execution failed exception ( " listener method ' " + handler method get method ( ) to generic string ( ) + " ' threw exception " , ex ) ; } }


sets the name of the specified value and adds it after the last child

public void add child ( string name , json value value ) { if ( name = = null ) throw new illegal argument exception ( " name cannot be null " ) ; value name = name ; add child ( value ) ; }


public static void wait until active ( final dynamo db client dynamo , final string table name ) throws exception { wait until active ( dynamo , table name , default wait timeout , default wait interval ) ; }


set the order for the resulting { @ link simple url handler mapping } relative to other handler mappings configured in spring mvc the default value is 1

public void set order ( int order ) { this order = order ; }


waits for the value returned by the supplier to be non - null , throwing an exception if that does not happen by the default timeout

public static < t > t wait for ( supplier < t > supplier ) { return wait for value ( supplier ) ; }


override this method to specify the color to draw the given area

public paint get item paint ( int row , int column ) { return super get item paint ( row , column ) ; }


add reference to variable < code > name < code >

public builder add variable ( string name ) { builder add ( expander - > expander apply ( name ) ) ; is primitive = false ; return this ; }


gets the total number of atn lookahead operations for sll prediction across all decisions made during parsing

public long get total s l l a t n lookahead ops ( ) { decision info [ ] decisions = atn simulator get decision info ( ) ; long k = 0 ; for ( int i = 0 ; i < decisions length ; i + + ) { k + = decisions [ i ] sll a t n transitions ; } return k ; }


public void file test ( ) { / / todo : test file }


returns an immutable list containing the given elements , in order if { @ code elements } is a { @ link collection } , this method behaves exactly as { @ link # copy of ( collection ) } ; otherwise , it behaves exactly as { @ code copy of ( elements iterator ( ) }

public static < e > immutable list < e > copy of ( iterable < ? extends e > elements ) { check not null ( elements ) ; / / todo ( kevinb ) : is this here only for gwt ? return ( elements instanceof collection ) ? copy of ( ( collection < ? extends e > ) elements ) : copy of ( elements iterator ( ) ) ; }


to test \ & quot ; client \ & quot ; model to test \ & quot ; client \ & quot ; model

public void test client model test ( ) throws api exception { client client = null ; client response = api test client model ( client ) ; / / todo : test validations }


public static < k , v > immutable list multimap < k , v > of ( ) { return ( immutable list multimap < k , v > ) empty immutable list multimap instance ; }


constructs an { @ link artifact dependencies } for the provided { @ code derived artifact } returns { @ code null } if any dependencies are not yet ready

static artifact dependencies discover dependencies ( artifact derived artifact derived artifact , sky function environment env ) throws interrupted exception { action lookup data generating action key = derived artifact get generating action key ( ) ; action lookup value action lookup value = artifact function get action lookup value ( generating action key get action lookup key ( ) , env ) ; if ( action lookup value = = null ) { return null ; } return new artifact dependencies ( derived artifact , action lookup value ) ; }


clears all modifications of the instruction at the given offset

public void clear modifications ( int instruction offset ) { if ( instruction offset < 0 | | instruction offset > = code length ) { throw new illegal argument exception ( " invalid instruction offset [ " + instruction offset + " ] in code with length [ " + code length + " ] " ) ; } pre insertions [ instruction offset ] = null ; replacements [ instruction offset ] = null ; post insertions [ instruction offset ] = null ; deleted [ instruction offset ] = false ; }


static located blocks to located blocks ( final map < ? , ? > json ) throws i o exception { if ( json = = null ) { return null ; } final map < ? , ? > m = ( map < ? , ? > ) json get ( located blocks class get simple name ( ) ) ; final long file length = ( ( number ) m get ( " file length " ) ) long value ( ) ; final boolean is under construction = ( boolean ) m get ( " is under construction " ) ; final list < located block > located blocks = to located block list ( get list ( m , " located blocks " ) ) ; final located block last located block = to located block ( ( map < ? , ? > ) m get ( " last located block " ) ) ; final boolean is last block complete = ( boolean ) m get ( " is last block complete " ) ; return new located blocks ( file length , is under construction , located blocks , last located block , is last block complete , null , null ) ; }


ensures the bounds of this window have a valid location and size

private void adjust bounds ( ) { if ( bounds height = = 0 | | bounds width = = 0 ) { window pack ( ) ; dimension d = window get size ( ) ; bounds height = d height ; bounds width = d width ; } window active window = win mgr get active window ( ) ; point p = bounds get location ( ) ; if ( p x = = 0 & & p y = = 0 ) { p = window utilities center on screen ( active window , bounds get size ( ) ) ; bounds set location ( p ) ; } window utilities ensure on screen ( active window , bounds ) ; }


returns the array of texture regions that represents each texture page of glyphs

public array < texture region > get regions ( ) { return regions ; }


will remove the current message , mark its { @ link channel promise } as failure using the given { @ link throwable } and return { @ code true } if no flushed message exists at the time this method is called it will return { @ code false } to signal that no more messages are ready to be handled

public boolean remove ( throwable cause ) { return remove 0 ( cause , true ) ; }


returns an html description of this filter < p > note : the html string returned does not start with the html tag so that it can be combined with other text

public string get html representation ( ) { return get html representation ( constraint sets ) ; }


return a min - width dialog theme styled according to the ( default ) selected theme

public static int get min width dialog theme ( final context context ) { return is light theme selected ( context ) ? r style light dialog min width theme : r style dark dialog min width theme ; }


returns the length of the stderr contents

public long err size ( ) throws i o exception { return get file error stream ( ) get recorded output size ( ) ; }


test that get content summary on standby should should throw standby exception

public void test get content summary on standby ( ) throws exception { configuration nn 1conf = cluster get configuration ( 1 ) ; / / just reset the standby reads to default i e false on standby h a util set allow standby reads ( nn 1conf , false ) ; cluster restart name node ( 1 ) ; cluster get name node rpc ( 1 ) get content summary ( " / " ) ; }


find next legal line separator to return next offset ( first byte offset of next line ) note : because of the particularity of utf - 8 encoding , we can determine the number of bytes of this character only by comparing the first byte , so we do not need to traverse mn in comparison

private long find next line start offset ( ) throws i o exception { boolean uses escape char = csv schema uses escape char ( ) ; byte [ ] escape bytes = character to string ( ( char ) csv schema get escape char ( ) ) get bytes ( standard charsets utf 8 ) ; long start pos = stream get pos ( ) ; byte b ; while ( ( b = ( byte ) stream read ( ) ) ! = - 1 ) { if ( b = = ' \ r ' | | b = = ' \ n ' ) { / / if there may be escape tags ahead if ( uses escape char & & stream get pos ( ) - start pos < = escape bytes length ) { long front = stream get pos ( ) - escape bytes length - 1 ; if ( front > 0 ) { stream seek ( front ) ; byte [ ] read bytes = new byte [ escape bytes length ] ; stream read ( read bytes ) ; / / we have judge front must bigger than zero stream read ( ) ; / / back to current next one if ( arrays equals ( escape bytes , read bytes ) ) { / / equal , we should skip this one line separator continue ; } } } long pos = stream get pos ( ) ; / / deal with " \ r \ n " , next one maybe ' \ n ' , so we need skip it if ( b = = ' \ r ' & & ( byte ) stream read ( ) = = ' \ n ' ) { return stream get pos ( ) ; } else { return pos ; } } else if ( uses escape char & & b = = escape bytes [ 0 ] ) { boolean equal = true ; for ( int i = 1 ; i < escape bytes length ; i + + ) { if ( ( byte ) stream read ( ) ! = escape bytes [ i ] ) { equal = false ; break ; } } if ( equal ) { / / equal , we should skip next one stream skip ( 1 ) ; } } } return stream get pos ( ) ; }


a comma separated list of routing values to control the shards the count will be executed on

public count request routing ( string routings ) { this routing = strings array to comma delimited string ( routings ) ; return this ; }


returns { @ link exit code success } if the build event upload was a success , otherwise , return an exit code that corresponds to the error that occurred during the build event upload

public exit code get exit code ( ) { return exit code ; }


create a frame out of the { @ link byte buf } and return it

public byte buf extract ( channel handler context ctx , byte buf buffer ) throws exception { final int eoh = find end of header ( buffer ) ; if ( ! discarding ) { if ( eoh > = 0 ) { final int length = eoh - buffer reader index ( ) ; if ( length > max header size ) { buffer reader index ( eoh + delimiter length ( buffer , eoh ) ) ; fail over limit ( ctx , length ) ; return null ; } byte buf frame = buffer read slice ( length ) ; buffer skip bytes ( delimiter length ( buffer , eoh ) ) ; return frame ; } else { final int length = buffer readable bytes ( ) ; if ( length > max header size ) { discarded bytes = length ; buffer skip bytes ( length ) ; discarding = true ; if ( fail fast ) { fail over limit ( ctx , " over " + discarded bytes ) ; } } return null ; } } else { if ( eoh > = 0 ) { final int length = discarded bytes + eoh - buffer reader index ( ) ; buffer reader index ( eoh + delimiter length ( buffer , eoh ) ) ; discarded bytes = 0 ; discarding = false ; if ( ! fail fast ) { fail over limit ( ctx , " over " + length ) ; } } else { discarded bytes + = buffer readable bytes ( ) ; buffer skip bytes ( buffer readable bytes ( ) ) ; } return null ; } }


match handlers that are assignable to a given type

public builder assignable type ( class < ? > types ) { this assignable types add all ( arrays as list ( types ) ) ; return this ; }


the response resources wrapped in the common mcp resource message these are typed resources that match the type url in the incremental mesh config request < code > repeated istio mcp v 1alpha 1 resource resources = 2 ; < code >

public com alibaba nacos istio model mcp resource get resources ( int index ) { if ( resources builder = = null ) { return resources get ( index ) ; } else { return resources builder get message ( index ) ; } }


the set of values defined for this entry , each corresponding to a different configurationvariant < code > repeated aapt pb config value config value = 4 ; < code >


do the actual work to construct an assembler from a sleigh language

protected void generate assembler ( ) throws sleigh exception { if ( generated ) { return ; } generated = true ; try { build grammar ( ) ; grammar verify ( ) ; build context ( ) ; build context graph ( ) ; build parser ( ) ; } catch ( sleigh exception e ) { / / not sure this can actually happen here throw e ; } catch ( exception e ) { throw new runtime exception ( e ) ; } }


create an instance with default behavior which uses { @ code random } to control variance and failure calculation

public static network behavior create ( random random ) { if ( random = = null ) throw new null pointer exception ( " random = = null " ) ; return new network behavior ( random ) ; }


determines if any deleted tags from one program were added to a function in the other if so , updates the conflict list with the offending tagaddress if there is no conflict for a particular address , the changes are automatically merged

private void process changed addresses ( address set view changed addresses , collection < ? extends function tag > deleted tags , program program added to ) throws i o exception { function manager d b function manager = ( function manager d b ) result pgm get function manager ( ) ; address iterator iter = changed addresses get addresses ( true ) ; while ( iter has next ( ) ) { address addr = iter next ( ) ; function function = function manager get function at ( addr ) ; if ( function = = null ) { continue ; } / / get all the tags added to the function and compare against / / the delete list collection < function tag > tags = get tags added to function ( program added to , addr ) ; for ( function tag tag : tags ) { if ( deleted tags contains ( tag ) ) { add to conflicts ( addr , tag ) ; continue ; } / / not a conflict , so add to result function add tag ( tag get name ( ) ) ; } } }


scenario s1 4 : iterating through elements given an intrusive collection has been created and the intrusive collection contains multiple elements when i iterate through the intrusive collection then i get each element in the collection , successively

public void test iterate should return all elements ( ) { intrusive collection < simple element > intrusive collection = new intrusive collection < > ( ) ; simple element elem 1 = new simple element ( ) ; simple element elem 2 = new simple element ( ) ; simple element elem 3 = new simple element ( ) ; intrusive collection add ( elem 1 ) ; intrusive collection add ( elem 2 ) ; intrusive collection add ( elem 3 ) ; iterator < simple element > iterator = intrusive collection iterator ( ) ; assert equals ( " first element returned is incorrect " , elem 1 , iterator next ( ) ) ; assert equals ( " second element returned is incorrect " , elem 2 , iterator next ( ) ) ; assert equals ( " third element returned is incorrect " , elem 3 , iterator next ( ) ) ; assert false ( " iterator should not have next element " , iterator has next ( ) ) ; }


public float get restitution ( ) { return jni get restitution ( addr ) ; }


test used to verify the happy path of { @ link thread async executor # start process ( callable ) }

void test successful task without callback ( ) throws exception { assert timeout ( of millis ( 3000 ) , ( ) - > { / / instantiate a new executor and start a new ' null ' task final var executor = new thread async executor ( ) ; final var result = new object ( ) ; when ( task call ( ) ) then return ( result ) ; final var async result = executor start process ( task ) ; assert not null ( async result ) ; async result await ( ) ; / / prevent timing issues , and wait until the result is available assert true ( async result is completed ( ) ) ; / / our task should only execute once verify ( task , times ( 1 ) ) call ( ) ; / / and the result should be exactly the same object assert same ( result , async result get value ( ) ) ; } ) ; }


if this chained buffer was not completely filledinitialized a data source may be used obtain the initial values when needed when an uninitialized area is written , any unwritten areas within the containing block ( s ) will be initialized from the uninitialized data source the same uninitialized read - only data source used for a chained buffer should be re - applied anytime this chained buffer is re - instantiated

private void set unintialized data source ( buffer data source , int data source offset ) { if ( data source offset < 0 ) { throw new illegal argument exception ( " invalid data source offset : " + data source offset ) ; } int max offset = data source offset - 1 + size ; if ( max offset < 0 | | max offset > = data source length ( ) ) { throw new illegal argument exception ( " data source has insufficient bytes ( need " + size + " bytes at offset " + data source offset ) ; } this uninitialized data source = data source ; this uninitialized data source offset = data source offset ; }


public void prefix array test ( ) { / / todo : test prefix array }


invokes the dialog to add a new label in the given program at the given address

public void add label ( address address , program target program , component provider provider ) { init dialog for add ( target program , address ) ; tool show dialog ( this , provider ) ; }


gets the large icon for the current media item when a bitmap needs to be loaded asynchronously , a placeholder bitmap ( or null ) should be returned the actual bitmap should be passed to the { @ link bitmap callback } once it has been loaded because the adapter may be called multiple times for the same media item , bitmaps should be cached by the app and returned synchronously when possible see { @ link notification compat builder # set large icon ( bitmap ) }

bitmap get current large icon ( player player , bitmap callback callback ) ;


implementations should wait until the condition evaluates to a value that is neither null nor false because of this contract , the return type must not be void if the condition does not become true within a certain time ( as defined by the implementing class ) , this method will throw a non - specified { @ link throwable } this is so that an implementor may throw whatever is idiomatic for a given test infrastructure ( e g j unit 4 would throw { @ link assertion error } )

< t > t until ( function < ? super f , t > is true ) ;


test that version map cache works , is evicted on close , etc

public void test cache ( ) throws exception { int size = versions and seq no resolver lookup states size ( ) ; directory dir = new directory ( ) ; index writer writer = new index writer ( dir , new index writer config ( lucene standard analyzer ) ) ; document doc = new document ( ) ; doc add ( new field ( id field mapper name , " 6 " , id field mapper defaults field type ) ) ; doc add ( new numeric doc values field ( version field mapper name , 87 ) ) ; doc add ( new numeric doc values field ( seq no field mapper name , random non negative long ( ) ) ) ; doc add ( new numeric doc values field ( seq no field mapper primary term name , random long between ( 1 , long max value ) ) ) ; writer add document ( doc ) ; directory reader reader = directory reader open ( writer ) ; / / should increase cache size by 1 assert equals ( 87 , load doc id and version ( reader , new term ( id field mapper name , " 6 " ) , random boolean ( ) ) version ) ; assert equals ( size + 1 , versions and seq no resolver lookup states size ( ) ) ; / / should be cache hit assert equals ( 87 , load doc id and version ( reader , new term ( id field mapper name , " 6 " ) , random boolean ( ) ) version ) ; assert equals ( size + 1 , versions and seq no resolver lookup states size ( ) ) ; reader close ( ) ; writer close ( ) ; / / core should be evicted from the map assert equals ( size , versions and seq no resolver lookup states size ( ) ) ; dir close ( ) ; }


returns the folder item path within the repository

public string get path name ( ) { return folder path + file system separator + item name ; }


public double value double value ( ) { throw new illegal argument exception ( " value \ " " + this to string ( ) + " \ " is not a double value [ " + this get class ( ) get name ( ) + " ] " ) ; }


load server flow config for a specific namespace

public static void load flow config ( string namespace , server flow config config ) { assert util not empty ( namespace , " namespace cannot be empty " ) ; / / todo : support namespace - scope server flow config global flow property update value ( config ) ; }


create empty original indexed filesystem the original index file lacked any version indicator but will be treated as a version 0 index

public static indexed local file system create original indexed filesystem ( string root path , boolean is versioned , boolean read only , boolean enable asyncronous dispatching ) throws i o exception { create root dir ( root path ) ; return null ; }


generates the name of the index that conforms to the default naming convention for backing indices on data streams given the specified data stream name , generation , and time

public static string get default backing index name ( string data stream name , long generation , long epoch millis ) { return string format ( locale root , backing index prefix + " % s - % s - % 0 6d " , data stream name , date formatter format millis ( epoch millis ) , generation ) ; }


configure the { @ code decoder } to use for server - sent events by default if this is not set , and jackson is available , the { @ link # jackson 2 json decoder } override is used instead use this property if you want to further customize the sse decoder note that { @ link # max in memory size ( int ) } , if configured , will be applied to the given decoder

void server sent event decoder ( decoder < ? > decoder ) ;


this implementation returns the hash code of the underlying servlet context resource location

public int hash code ( ) { return this path hash code ( ) ; }


gets the exception handling decode format for the indicated code

public static dwarf e h data decode format value of ( int code ) { for ( dwarf e h data decode format mod : dwarf e h data decode format values ( ) ) { if ( mod code = = code ) { return mod ; } } return null ; }


this is called by { @ link # report error } when the exception is a { @ link failed predicate exception }

protected void report failed predicate ( parser recognizer , failed predicate exception e ) { string rule name = recognizer get rule names ( ) [ recognizer ctx get rule index ( ) ] ; string msg = " rule " + rule name + " " + e get message ( ) ; recognizer notify error listeners ( e get offending token ( ) , msg , e ) ; }


wait until the bp is registered , upto the configured amount of time throws an exception if times out , which should fail the client request

void check and wait for b p ( final extended block block ) throws i o exception { string bp id = block get block pool id ( ) ; / / the registration is only missing in relatively short time window / / optimistically perform this first try { datanode get d n registration for b p ( bp id ) ; return ; } catch ( i o exception ioe ) { / / not registered } / / retry long bp ready timeout = dn conf get bp ready timeout ( ) ; stop watch sw = new stop watch ( ) ; sw start ( ) ; while ( sw now ( time unit seconds ) < = bp ready timeout ) { try { datanode get d n registration for b p ( bp id ) ; return ; } catch ( i o exception ioe ) { / / not registered } / / sleep before trying again try { thread sleep ( 1000 ) ; } catch ( interrupted exception ie ) { throw new i o exception ( " interrupted while serving request aborting " ) ; } } / / failed to obtain registration throw new i o exception ( " not ready to serve the block pool , " + bp id + " " ) ; }


annotates ( adds context to ) the given exception with information about this frame

public void annotate ( exception with context ex ) { locals annotate ( ex ) ; stack annotate ( ex ) ; }


returns whether the controller is currently visible

public boolean is visible ( ) { return get visibility ( ) = = visible ; }


trim a path to get the immediate predecessor

private string parent path ( string path ) throws keeper exception bad arguments exception { int last slash = path last index of ( ' / ' ) ; if ( last slash = = - 1 | | path index of ( ' \ 0 ' ) ! = - 1 | | get z k database ( ) is special path ( path ) ) { throw new keeper exception bad arguments exception ( path ) ; } return last slash = = 0 ? " / " : path substring ( 0 , last slash ) ; }


public badged icon add badge ( icon badge , badge position position ) { badge map get ( position ) add icon ( badge ) ; height = math max ( height , badge get icon height ( ) ) ; width = math max ( width , badge get icon width ( ) ) ; cached this = null ; return this ; }


specifically test interaction with a scheduler with subscribe on

public void issue 2 1 9 1 scheduler unsubscribe ( ) throws throwable { / / setup mocks consumer < integer > source next = mock ( consumer class ) ; action source completed = mock ( action class ) ; action source unsubscribed = mock ( action class ) ; final test scheduler mock scheduler = new test scheduler ( ) ; observer < integer > mock observer before connect = test helper mock observer ( ) ; observer < integer > mock observer after connect = test helper mock observer ( ) ; / / observable under test connectable observable < integer > replay = observable just ( 1 , 2 , 3 ) do on next ( source next ) do on dispose ( source unsubscribed ) do on complete ( source completed ) subscribe on ( mock scheduler ) replay ( ) ; replay subscribe ( mock observer before connect ) ; replay connect ( ) ; replay subscribe ( mock observer after connect ) ; verify ( mock observer before connect ) on subscribe ( ( disposable ) any ( ) ) ; verify ( mock observer after connect ) on subscribe ( ( disposable ) any ( ) ) ; mock scheduler advance time by ( 1 , time unit seconds ) ; / / verify interactions verify ( source next , times ( 1 ) ) accept ( 1 ) ; verify ( source next , times ( 1 ) ) accept ( 2 ) ; verify ( source next , times ( 1 ) ) accept ( 3 ) ; verify ( source completed , times ( 1 ) ) run ( ) ; verify observer mock ( mock observer before connect , 1 , 3 ) ; verify observer mock ( mock observer after connect , 1 , 3 ) ; / / fixme not supported / / verify ( spied worker , times ( 1 ) ) is unsubscribed ( ) ; / / fixme publish calls cancel too / / verify ( source unsubscribed , times ( 1 ) ) run ( ) ; verify no more interactions ( source next ) ; verify no more interactions ( source completed ) ; verify no more interactions ( source unsubscribed ) ; verify no more interactions ( mock observer before connect ) ; verify no more interactions ( mock observer after connect ) ; }


enables a dark shadow for this circular image view

public void set shadow enabled ( boolean enabled ) { shadow enabled = enabled ; update shadow ( ) ; }


queues the glyphs in the nehe character set ( codepoints 32 through 128 ) to be loaded note that the glyphs are not actually loaded until { @ link # load glyphs ( ) } is called

public void add nehe glyphs ( ) { add glyphs ( 32 , 32 + 96 ) ; }


set the array of { @ link path } s as the list of inputs for the map - reduce job

public static void set input paths ( job conf conf , path input paths ) { path path = new path ( conf get working directory ( ) , input paths [ 0 ] ) ; string buffer str = new string buffer ( string utils escape string ( path to string ( ) ) ) ; for ( int i = 1 ; i < input paths length ; i + + ) { str append ( string utils comma str ) ; path = new path ( conf get working directory ( ) , input paths [ i ] ) ; str append ( string utils escape string ( path to string ( ) ) ) ; } conf set ( org apache hadoop mapreduce lib input file input format input dir , str to string ( ) ) ; }


creates a { @ link char stream } given a path to a file on disk and the charset of the bytes contained in the file reads the entire contents of the file into the result before returning

public static char stream from path ( path path , charset charset ) throws i o exception { long size = files size ( path ) ; try ( readable byte channel channel = files new byte channel ( path ) ) { return from channel ( channel , charset , default buffer size , coding error action replace , path to string ( ) , size ) ; } }


see original { @ link mockito # do throw ( class ) }

public static b d d stubber will throw ( class < ? extends throwable > to be thrown , class < ? extends throwable > throwable types ) { return new b d d stubber impl ( mockito do throw ( to be thrown , throwable types ) ) ; }


for this test , the body for this request much reference a schema named & # x 6 0 ; file & # x 6 0 ;

void test body with file schema ( file schema test class body ) ;


consumes the non - execute prefix if it exists

private void consume non execute prefix ( ) throws i o exception { / / fast forward through the leading whitespace next non whitespace ( true ) ; pos - - ; int p = pos ; if ( p + 5 > limit & & ! fill buffer ( 5 ) ) { return ; } char [ ] buf = buffer ; if ( buf [ p ] ! = ' ) ' | | buf [ p + 1 ] ! = ' ] ' | | buf [ p + 2 ] ! = ' } ' | | buf [ p + 3 ] ! = ' \ ' ' | | buf [ p + 4 ] ! = ' \ n ' ) { return ; / / not a security token ! }


public void load configuration ( ) { try { nacos logging load configuration ( ) ; } catch ( throwable t ) { if ( is logback ) { logger warn ( " load logback configuration of nacos fail , message : { } " , t get message ( ) ) ; } else { logger warn ( " load log 4j configuration of nacos fail , message : { } " , t get message ( ) ) ; } } }


delete the reference decrease the reference count for the instance , if any on all references removal delete the instance from the map

public void remove ( e key ) { e value = reference map get ( key ) ; if ( value ! = null & & value decrement and get ref count ( ) = = 0 ) { reference map remove ( key ) ; } }


timeout to wait for the shards on to be available for each bulk request ?

public time value get timeout ( ) { return timeout ; }


close the bundle view factories on context shutdown

public void destroy ( ) throws beans exception { for ( configurable application context factory : this bundle cache values ( ) ) { factory close ( ) ; } this locale cache clear ( ) ; this bundle cache clear ( ) ; }


fake endpoint for testing various parameters 가짜 엔드 포인트 fake endpoint for testing various parameters 가짜 엔드 포인트

public void test endpoint parameters ( big decimal number , double double , string pattern without delimiter , byte [ ] byte , integer integer , integer int 3 2 , long int 6 4 , float float , string string , attachment binary detail , local date date , date date time , string password , string param callback ) { }


remove any converters from { @ code source type } to { @ code target type }

void remove convertible ( class < ? > source type , class < ? > target type ) ;


boolean shared exists ( ) { try { return get folder data ( ) shared exists ( ) ; } catch ( file not found exception e ) { return false ; } }


determine if current name is a default name this is more important for parameters so always returning false for locals is ok

protected boolean has default name ( ) { return false ; }


check if the associations between self model and associated model is already saved into intermediate join table < br > make sure base obj and associated model are saved already , or the result might be wrong

private boolean is data exists ( lite pal support base obj , lite pal support associated model ) { boolean exists = false ; s q lite database db = connector get database ( ) ; cursor cursor = null ; try { cursor = db query ( get join table name ( base obj , associated model ) , null , get selection ( base obj , associated model ) , get selection args ( base obj , associated model ) , null , null , null ) ; exists = cursor get count ( ) > 0 ; } catch ( exception e ) { e print stack trace ( ) ; return true ; } finally { cursor close ( ) ; } return exists ; }


convert a path to a cananonical form all instances of " " and " " are factored out null is returned if the path tries to above its root

public static string canonical ( string path ) { if ( path = = null | | path length ( ) = = 0 ) { return path ; } int end = path length ( ) ; int start = path last index of ( ' / ' , end ) ; search : while ( end > 0 ) { switch ( end - start ) { case 2 : / / possible single dot if ( path char at ( start + 1 ) ! = ' ' ) { break ; } break search ; case 3 : / / possible double dot if ( path char at ( start + 1 ) ! = ' ' | | path char at ( start + 2 ) ! = ' ' ) { break ; } break search ; } end = start ; start = path last index of ( ' / ' , end - 1 ) ; } / / if we have checked the entire string if ( start > = end ) { return path ; } string builder buf = new string builder ( path ) ; int del start = - 1 ; int del end = - 1 ; int skip = 0 ; while ( end > 0 ) { switch ( end - start ) { case 2 : / / possible single dot if ( buf char at ( start + 1 ) ! = ' ' ) { if ( skip > 0 & & - - skip = = 0 ) { del start = start > = 0 ? start : 0 ; if ( del start > 0 & & del end = = buf length ( ) & & buf char at ( del end - 1 ) = = ' ' ) { del start + + ; } } break ; } if ( start < 0 & & buf length ( ) > 2 & & buf char at ( 1 ) = = ' / ' & & buf char at ( 2 ) = = ' / ' ) { break ; } if ( del end < 0 ) { del end = end ; } del start = start ; if ( del start < 0 | | del start = = 0 & & buf char at ( del start ) = = ' / ' ) { del start + + ; if ( del end < buf length ( ) & & buf char at ( del end ) = = ' / ' ) { del end + + ; } break ; } if ( end = = buf length ( ) ) { del start + + ; } end = start - - ; while ( start > = 0 & & buf char at ( start ) ! = ' / ' ) { start - - ; } continue ; case 3 : / / possible double dot if ( buf char at ( start + 1 ) ! = ' ' | | buf char at ( start + 2 ) ! = ' ' ) { if ( skip > 0 & & - - skip = = 0 ) { del start = start > = 0 ? start : 0 ; if ( del start > 0 & & del end = = buf length ( ) & & buf char at ( del end - 1 ) = = ' ' ) { del start + + ; } } break ; } del start = start ; if ( del end < 0 ) { del end = end ; } skip + + ; end = start - - ; while ( start > = 0 & & buf char at ( start ) ! = ' / ' ) { start - - ; } continue ; default : if ( skip > 0 & & - - skip = = 0 ) { del start = start > = 0 ? start : 0 ; if ( del end = = buf length ( ) & & buf char at ( del end - 1 ) = = ' ' ) { del start + + ; } } } / / do the delete if ( skip < = 0 & & del start > = 0 & & del end > = del start ) { buf delete ( del start , del end ) ; del start = del end = - 1 ; } end = start - - ; while ( start > = 0 & & buf char at ( start ) ! = ' / ' ) { start - - ; } } / / too many if ( skip > 0 ) { return null ; } / / do the delete if ( del end > = 0 ) { buf delete ( del start , del end ) ; } return buf to string ( ) ; }


puts the given double value in the double array at the given index

public void put ( int index , double [ ] value ) { if ( value = = null ) { remove ( index ) ; return ; } if ( index > = starts length ) { adjust array sizes ( math max ( index + 1 , starts length * 2 ) ) ; } if ( index > last start ) { last start = index ; } / / is there already something here ? if ( starts [ index ] > 0 ) { / / if so , does the new array fit in the already allocated space ? if ( lengths [ index ] > = value length ) { / / if it does , subtract the difference the allocated space total total space allocated - = lengths [ index ] - value length ; } else { / / otherwise , subtract the entire space from the allocated space total / / and allocate new space total space allocated - = lengths [ index ] ; starts [ index ] = alloc space ( value length ) ; } } else { starts [ index ] = alloc space ( value length ) ; } lengths [ index ] = ( short ) value length ; system arraycopy ( value , 0 , doubles , starts [ index ] , value length ) ; }


returns estimated cache size bytes each entry size is calculated by { @ link # estimate size of ( java lang object , java lang object ) }

public long estimated size bytes ( ) { return estimated size bytes get ( ) ; }


get a datanode which does not contain the block

private datanode info get datanode out of the block ( located striped block blk ) throws exception { datanode info [ ] all dn infos = client datanode report ( datanode report type live ) ; datanode info [ ] blk dn inos = blk get locations ( ) ; for ( datanode info dn info : all dn infos ) { boolean in = false ; for ( datanode info blk dn info : blk dn inos ) { if ( blk dn info equals ( dn info ) ) { in = true ; } } if ( ! in ) { return dn info ; } } return null ; }


get the punctuators scheduled so far the returned list is not affected by subsequent calls to { @ code schedule ( ) }

public list < captured punctuator > scheduled punctuators ( ) { return new linked list < > ( punctuators ) ; }


public static string get rules ( ) { string rule string = null ; if ( rules ! = null ) { string builder sb = new string builder ( ) ; for ( rule rule : rules ) { sb append ( rule to string ( ) ) append ( " \ n " ) ; } rule string = sb to string ( ) trim ( ) ; } return rule string ; }


public big decimal get big decimal ( ) { return big decimal ; }


public d w a r f attribute specification [ ] get attributes ( ) { return attributes ; }


reads a quad word from the program ' s memory starting at the indicated address

public static long read q word ( program program , address addr ) throws memory access exception { return program get memory ( ) get long ( addr ) ; }


scenario : using the standard context but adding your own variables

public void test scenario defining variables that will be accessible in expressions ( ) throws exception { / / create a parser spel expression parser parser = new spel expression parser ( ) ; / / use the standard evaluation context standard evaluation context ctx = new standard evaluation context ( ) ; ctx set variable ( " favourite colour " , " blue " ) ; list < integer > primes = arrays as list ( 2 , 3 , 5 , 7 , 11 , 13 , 17 ) ; ctx set variable ( " primes " , primes ) ; expression expr = parser parse raw ( " # favourite colour " ) ; object value = expr get value ( ctx ) ; assert that ( value ) is equal to ( " blue " ) ; expr = parser parse raw ( " # primes get ( 1 ) " ) ; value = expr get value ( ctx ) ; assert that ( value ) is equal to ( 3 ) ; / / all prime numbers > 10 from the list ( using selection ? { } ) expr = parser parse raw ( " # primes ? [ # this > 10 ] " ) ; value = expr get value ( ctx ) ; assert that ( value to string ( ) ) is equal to ( " [ 11 , 13 , 17 ] " ) ; }


private void repartition split state ( map < string , list < tuple 2 < stream state handle , operator state handle state meta info > > > name to distribute state , int new parallelism , list < map < stream state handle , operator state handle > > merge map list ) { int start parallel op = 0 ; / / iterate all named states and repartition one named state at a time per iteration for ( map entry < string , list < tuple 2 < stream state handle , operator state handle state meta info > > > e : name to distribute state entry set ( ) ) { list < tuple 2 < stream state handle , operator state handle state meta info > > current = e get value ( ) ; / / determine actual number of partitions for this named state int total partitions = 0 ; for ( tuple 2 < stream state handle , operator state handle state meta info > offsets : current ) { total partitions + = offsets f 1 get offsets ( ) length ; } / / repartition the state across the parallel operator instances int lst idx = 0 ; int offset idx = 0 ; int base fraction = total partitions / new parallelism ; int remainder = total partitions % new parallelism ; int new start parallel op = start parallel op ; for ( int i = 0 ; i < new parallelism ; + + i ) { / / preparation : calculate the actual index considering wrap around int parallel op idx = ( i + start parallel op ) % new parallelism ; / / now calculate the number of partitions we will assign to the parallel instance in / / this round int number of partitions to assign = base fraction ; / / and distribute odd partitions while we still have some , one at a time if ( remainder > 0 ) { + + number of partitions to assign ; - - remainder ; } else if ( remainder = = 0 ) { / / we are out of odd partitions now and begin our next redistribution round with / / the current / / parallel operator to ensure fair load balance new start parallel op = parallel op idx ; - - remainder ; } / / now start collection the partitions for the parallel instance into this list while ( number of partitions to assign > 0 ) { tuple 2 < stream state handle , operator state handle state meta info > handle with offsets = current get ( lst idx ) ; long [ ] offsets = handle with offsets f 1 get offsets ( ) ; int remaining = offsets length - offset idx ; / / repartition offsets long [ ] offs ; if ( remaining > number of partitions to assign ) { offs = arrays copy of range ( offsets , offset idx , offset idx + number of partitions to assign ) ; offset idx + = number of partitions to assign ; } else { if ( optimize memory use ) { handle with offsets f 1 = null ; / / gc } offs = arrays copy of range ( offsets , offset idx , offsets length ) ; offset idx = 0 ; + + lst idx ; } number of partitions to assign - = remaining ; / / as a last step we merge partitions that use the same stream state handle in a / / single / / operator state handle map < stream state handle , operator state handle > merge map = merge map list get ( parallel op idx ) ; operator state handle operator state handle = merge map get ( handle with offsets f 0 ) ; if ( operator state handle = = null ) { operator state handle = new operator stream state handle ( new hash map < > ( name to distribute state size ( ) ) , handle with offsets f 0 ) ; merge map put ( handle with offsets f 0 , operator state handle ) ; } operator state handle get state name to partition offsets ( ) put ( e get key ( ) , new operator state handle state meta info ( offs , operator state handle mode split distribute ) ) ; } } start parallel op = new start parallel op ; e set value ( null ) ; } }


test the single - file method hard link create hard link ( ) also tests get link count ( ) with values greater than one

public void test create hard link ( ) throws i o exception { / / hardlink a single file and confirm expected result create hard link ( x 1 , x 1 one ) ; assert true ( x 1 one exists ( ) ) ; assert equals ( 2 , get link count ( x 1 ) ) ; / / x 1 and x 1 one are linked now assert equals ( 2 , get link count ( x 1 one ) ) ; / / so they both have count " 2 " / / confirm that x 2 , which we didn ' t change , still shows count " 1 " assert equals ( 1 , get link count ( x 2 ) ) ; / / now do a few more create hard link ( x 2 , y one ) ; create hard link ( x 3 , x 3 one ) ; assert equals ( 2 , get link count ( x 2 ) ) ; assert equals ( 2 , get link count ( x 3 ) ) ; / / create another link to a file that already has count 2 create hard link ( x 1 , x 1 1 one ) ; assert equals ( 3 , get link count ( x 1 ) ) ; / / x 1 , x 1 one , and x 1 1 one assert equals ( 3 , get link count ( x 1 one ) ) ; / / are all linked , so they assert equals ( 3 , get link count ( x 1 1 one ) ) ; / / should all have count " 3 " / / validate by contents validate tgt one ( ) ; / / validate that change of content is reflected in the other linked files append to file ( x 1 one , str 3 ) ; assert true ( fetch file contents ( x 1 one ) equals ( str 1 + str 3 ) ) ; assert true ( fetch file contents ( x 1 1 one ) equals ( str 1 + str 3 ) ) ; assert true ( fetch file contents ( x 1 ) equals ( str 1 + str 3 ) ) ; }


private void init java home save file ( file install dir ) throws file not found exception { boolean is dev = new file ( install dir , " build gradle " ) is file ( ) ; / / ensure there is a user home directory ( there definitely should be ) string user home dir path = system get property ( " user home " ) ; if ( user home dir path = = null | | user home dir path is empty ( ) ) { throw new file not found exception ( " user home directory is not known " ) ; } file user home dir = new file ( user home dir path ) ; if ( ! user home dir is directory ( ) ) { throw new file not found exception ( " user home directory does not exist : " + user home dir ) ; } / / get the java home save file from user home directory ( it might not exist yet ) file user settings parent dir = new file ( user home dir , " " + application name replace all ( " \ \ s " , " " ) to lower case ( ) ) ; string user settings dir name = user settings parent dir get name ( ) + " " + application version + " " + application release name replace all ( " \ \ s " , " " ) to upper case ( ) ; if ( is dev ) { user settings dir name + = " location " + install dir get parent file ( ) get name ( ) ; } file user settings dir = new file ( user settings parent dir , user settings dir name ) ; java home save file = new file ( user settings dir , java home save name ) ; }


join a list of strings with the given separator

public static string join ( collection < string > list , string separator ) { iterator < string > iterator = list iterator ( ) ; string builder out = new string builder ( ) ; if ( iterator has next ( ) ) { out append ( iterator next ( ) ) ; } while ( iterator has next ( ) ) { out append ( separator ) append ( iterator next ( ) ) ; } return out to string ( ) ; }


check for well known error cases , which would mean that loading has finished , but an error condition was seen if an error has occurred throw an error , possibly by using j unit ' s assert assert methods

protected void is error ( ) throws error { / / no - op by default }


stores the given throwable and rethrows it it will be rethrown as is if it is an { @ code i o exception } , { @ code runtime exception } , { @ code error } or a checked exception of either of the given types otherwise , it will be rethrown wrapped in a { @ code runtime exception } < b > note : < b > be sure to declare all of the checked exception types your try block can throw when calling an overload of this method so as to avoid losing the original exception type this method always throws , and as such should be called as { @ code throw closer rethrow ( e , ) ; } to ensure the compiler knows that it will throw

public < x1 extends exception , x2 extends exception > runtime exception rethrow ( throwable e , class < x1 > declared type 1 , class < x2 > declared type 2 ) throws i o exception , x1 , x2 { check not null ( e ) ; thrown = e ; throwables propagate if possible ( e , i o exception class ) ; throwables propagate if possible ( e , declared type 1 , declared type 2 ) ; throw new runtime exception ( e ) ; }


public completable future < job details info > get job details ( job i d job id ) { final job details headers details headers = job details headers get instance ( ) ; final job message parameters params = new job message parameters ( ) ; params job path parameter resolve ( job id ) ; return send request ( details headers , params ) ; }


grant a proxy ticket for a specific service

proxy ticket grant proxy ticket ( string id , service service , expiration policy expiration policy , boolean only track most recent session ) ;


predicate to verify login details are defined

public boolean has login ( ) { return string utils is not empty ( password ) | | string utils is not empty ( user ) ; }


public void make window ( ) { set queue type ( window ) ; }


set the additional ( undeclared ) property with the specified name and value if the property does not already exist , create it otherwise replace it

public additional properties object put additional property ( string key , map value ) { if ( this additional properties = = null ) { this additional properties = new hash map < string , map > ( ) ; } this additional properties put ( key , value ) ; return this ; }


returns the file offset to the line numbers for this section

public int get pointer to line numbers ( ) { return s lnnoptr ; }


returns the configured heap size used by the tasks

public long get task heap ( ) { return task heap ; }


public pet get pet by id ( long pet id ) throws api exception { object local var post body = null ; / / verify the required parameter ' pet id ' is set if ( pet id = = null ) { throw new api exception ( 400 , " missing the required parameter ' pet id ' when calling get pet by id " ) ; } / / create path and map variables string local var path = " / pet / { pet id } " replace all ( " \ \ { format \ \ } " , " json " ) replace all ( " \ \ { " + " pet id " + " \ \ } " , api client escape string ( pet id to string ( ) ) ) ; / / query params list < pair > local var query params = new array list < pair > ( ) ; map < string , string > local var header params = new hash map < string , string > ( ) ; map < string , string > local var cookie params = new hash map < string , string > ( ) ; map < string , object > local var form params = new hash map < string , object > ( ) ; final string [ ] local var accepts = { " application / xml " , " application / json " } ; final string local var accept = api client select header accept ( local var accepts ) ; final string [ ] local var content types = { } ; final string local var content type = api client select header content type ( local var content types ) ; string [ ] local var auth names = new string [ ] { " api key " } ; generic type < pet > local var return type = new generic type < pet > ( ) { } ; return api client invoke a p i ( local var path , " get " , local var query params , local var post body , local var header params , local var cookie params , local var form params , local var accept , local var content type , local var auth names , local var return type ) ; }


parses specific offsets string to map specific offsets string format was given as following : scan startup specific - offsets = partition : 0 , offset : 42 ; partition : 1 , offset : 300

public static map < integer , long > parse specific offsets ( string specific offsets str , string option key ) { final map < integer , long > offset map = new hash map < > ( ) ; final string [ ] pairs = specific offsets str split ( " ; " ) ; final string validation exception message = string format ( " invalid properties ' % s ' should follow the format " + " ' partition : 0 , offset : 42 ; partition : 1 , offset : 300 ' , but is ' % s ' " , option key , specific offsets str ) ; if ( pairs length = = 0 ) { throw new validation exception ( validation exception message ) ; } for ( string pair : pairs ) { if ( null = = pair | | pair length ( ) = = 0 | | ! pair contains ( " , " ) ) { throw new validation exception ( validation exception message ) ; } final string [ ] kv = pair split ( " , " ) ; if ( kv length ! = 2 | | ! kv [ 0 ] starts with ( partition + ' : ' ) | | ! kv [ 1 ] starts with ( offset + ' : ' ) ) { throw new validation exception ( validation exception message ) ; } string partition value = kv [ 0 ] substring ( kv [ 0 ] index of ( " : " ) + 1 ) ; string offset value = kv [ 1 ] substring ( kv [ 1 ] index of ( " : " ) + 1 ) ; try { final integer partition = integer value of ( partition value ) ; final long offset = long value of ( offset value ) ; offset map put ( partition , offset ) ; } catch ( number format exception e ) { throw new validation exception ( validation exception message , e ) ; } } return offset map ; }


public static my s q l binary column type value of j d b c type ( final int jdbc type ) { if ( jdbc type and column type map contains key ( jdbc type ) ) { return jdbc type and column type map get ( jdbc type ) ; } throw new illegal argument exception ( string format ( " cannot find jdbc type ' % s ' in column type " , jdbc type ) ) ; }


creates a new package prefix in the given new superpackage , with the given package name factory

private string generate unique package prefix ( string new super package prefix , name factory package name factory ) { / / come up with package names until we get an original one string new package prefix ; do { / / let the factory produce a package name new package prefix = new super package prefix + package name factory next name ( ) + class constants package separator ; } while ( package prefix map contains value ( new package prefix ) ) ; return new package prefix ; }


see { @ link visibility events test # test full impression event ( ) }

public void test in range all bounds visible ( ) { incremental item impl item = new incremental item impl ( left , 5 , 10 , 10 , " id 1 " ) ; item enter range height ratio ( 1 0f ) ; m incremental module perform incremental mount ( new rect ( left , 0 , right , 10 ) , item ) ; assert that ( item m enter range called ) is true ( ) ; }


for this test , the body for this request much reference a schema named & # x 6 0 ; file & # x 6 0 ;

public void test body with file schema ( file schema test class body , handler < async result < void > > result handler ) { test body with file schema ( body , null , result handler ) ; }


write splits in the following format { @ code < count > < class 1 > < class 2 > < classn > < split 1 > < split 2 > < splitn > }

public void write ( data output out ) throws i o exception { writable utils write v int ( out , splits length ) ; for ( input split s : splits ) { text write string ( out , s get class ( ) get name ( ) ) ; } for ( input split s : splits ) { serialization factory factory = new serialization factory ( conf ) ; serializer serializer = factory get serializer ( s get class ( ) ) ; serializer open ( ( data output stream ) out ) ; serializer serialize ( s ) ; } }


get the mapped - byte - count ( left - hand value in mapping ratio )

public int get mapped byte count ( ) { if ( is one to one mapping ( ) ) { return 1 ; } return mapped byte count ; }


append a list of records into an atomic batch we guarantee all records are included in the same underlying record batch so that either all of the records become committed or none of them do

public long append ( int epoch , list < t > records ) { if ( epoch ! = this epoch ) { / / if the epoch does not match , then the state machine probably / / has not gotten the notification about the latest epoch change / / in this case , ignore the append and return a large offset value / / which will never be committed return long max value ; } object serde context = serde new write context ( ) ; int batch size = 0 ; for ( t record : records ) { batch size + = serde record size ( record , serde context ) ; } if ( batch size > max batch size ) { throw new illegal argument exception ( " the total size of " + records + " is " + batch size + " , which exceeds the maximum allowed batch size of " + max batch size ) ; } append lock lock ( ) ; try { maybe complete drain ( ) ; batch builder < t > batch = maybe allocate batch ( batch size ) ; if ( batch = = null ) { return null ; } / / restart the linger timer if necessary if ( ! linger timer is running ( ) ) { linger timer reset ( time milliseconds ( ) + linger ms ) ; } for ( t record : records ) { batch append record ( record , serde context ) ; next offset + = 1 ; } return next offset - 1 ; } finally { append lock unlock ( ) ; } }


return the number of leased { @ link decompressor } s for this { @ link compression codec }

public static int get leased decompressors count ( compression codec codec ) { return ( codec = = null ) ? 0 : get lease count ( decompressor counts , codec get decompressor type ( ) ) ; }


for this test , the body for this request much reference a schema named & # x 6 0 ; file & # x 6 0 ; < b > 200 < b > - success

public void test body with file schema ( file schema test class body ) throws rest client exception { test body with file schema with http info ( body ) ; }


post pet { pet id } upload image : uploads an image

default response entity < model api response > upload file ( @ api param ( value = " id of pet to update " , required = true ) @ path variable ( " pet id " ) long pet id , @ api param ( value = " additional data to pass to server " ) @ valid @ request part ( value = " additional metadata " , required = false ) string additional metadata , @ api param ( value = " file to upload " ) @ valid @ request part ( value = " file " , required = false ) multipart file file ) { get request ( ) if present ( request - > { for ( media type media type : media type parse media types ( request get header ( " accept " ) ) ) { if ( media type is compatible with ( media type value of ( " application / json " ) ) ) { string example string = " { \ " code \ " : 0 , \ " type \ " : \ " type \ " , \ " message \ " : \ " message \ " } " ; api util set example response ( request , " application / json " , example string ) ; break ; } } } ) ; return new response entity < > ( http status not implemented ) ; }


public string get my string ( ) { return my string ; }


you can also modify the body of this method to customize your error messages for example , cases like loop detected and invalid lexical state are not of end - users concern , so you can return something like : < p > " internal error : please file a bug report " < p > from this method for such cases in the release version of your parser

public string get message ( ) { return super get message ( ) ; }


returns an exception for an unexpected error during type inference

public static table exception create unexpected exception ( call context call context , throwable cause ) { return new table exception ( string format ( " unexpected error in type inference logic of function ' % s ' this is a bug " , call context get name ( ) ) , cause ) ; }


public final int cursor ( ) { return cursor ; }


test to verify that server shouldn ' t start with invalid credentials if the configuration is set to quorum auth server require sasl = true , quorum auth learner require sasl = true

public void test sasl required invalid credentials ( ) throws exception { map < string , string > auth configs = new hash map < string , string > ( ) ; auth configs put ( quorum auth quorum learner sasl login context , " quorum learner invalid " ) ; auth configs put ( quorum auth quorum sasl auth enabled , " true " ) ; auth configs put ( quorum auth quorum server sasl auth required , " true " ) ; auth configs put ( quorum auth quorum learner sasl auth required , " true " ) ; int server count = 2 ; final int [ ] client ports = start quorum ( server count , new string builder ( ) , auth configs , server count , false ) ; for ( int i = 0 ; i < server count ; i + + ) { boolean wait for server up = client base wait for server up ( " 127 0 0 1 : " + client ports [ i ] , quorum peer test base timeout ) ; assert false ( wait for server up , " shouldn ' t start server with invalid credentials " ) ; } }


gets whether the class that this method is part of is defined with { @ code acc super }

public boolean get acc super ( ) { return acc super ; }