moves the last entry in the entry array into { @ code dst index } , and nulls out its old position

void move last entry ( int dst index , int mask ) { int src index = size ( ) - 1 ; if ( dst index < src index ) { / / move last entry to deleted spot @ nullable decl object object = elements [ src index ] ; elements [ dst index ] = object ; elements [ src index ] = null ; / / move the last entry to the removed spot , just like we moved the element entries [ dst index ] = entries [ src index ] ; entries [ src index ] = 0 ; / / also need to update whoever ' s " next " pointer was pointing to the last entry place int table index = smeared hash ( object ) & mask ; int next = compact hashing table get ( table , table index ) ; int src next = src index + 1 ; if ( next = = src next ) { / / we need to update the root pointer compact hashing table set ( table , table index , dst index + 1 ) ; } else { / / we need to update a pointer in an entry int entry index ; int entry ; do { entry index = next - 1 ; entry = entries [ entry index ] ; next = compact hashing get next ( entry , mask ) ; } while ( next ! = src next ) ; / / here , entries [ entry index ] points to the old entry location ; update it entries [ entry index ] = compact hashing mask combine ( entry , dst index + 1 , mask ) ; } } else { elements [ dst index ] = null ; entries [ dst index ] = 0 ; } }


reads up to < code > b length < code > bytes of data from this input stream into an array of bytes the < code > read < code > method of < code > input stream < code > calls the < code > read < code > method of three arguments with the arguments < code > b < code > , < code > 0 < code > , and < code > b length < code >

public int read ( byte [ ] b ) throws i o exception { return read ( b , 0 , b length ) ; }


computes the hyperlink to actions , to handle the situation when the { @ link action # get url name ( ) } returns absolute url

public static @ check for null string get action url ( string it url , action action ) { string url name = action get url name ( ) ; if ( url name = = null ) return null ; / / should not be displayed try { if ( new uri ( url name ) is absolute ( ) ) { return url name ; } } catch ( u r i syntax exception x ) { logger get logger ( functions class get name ( ) ) log ( level warning , " failed to parse url for { 0 } : { 1 } " , new object [ ] { action , x } ) ; return null ; } if ( url name starts with ( " / " ) ) return join path ( stapler get current request ( ) get context path ( ) , url name ) ; else / / relative url name return join path ( stapler get current request ( ) get context path ( ) + ' / ' + it url , url name ) ; }


serviecomb chassis consumers and providers need to register at the service center if the consumer is not registered then return false

private boolean check register status ( invocation invocation ) { return null ! = invocation get operation meta ( ) & & null ! = invocation get endpoint ( ) ; }


returns fragments required by deps this includes : requirements transitively required by deps iff { @ link core options # include required config fragments provider } is { @ link core options include config fragments enum # transitive } , dependencies on starlark build settings iff { @ link core options # include required config fragments provider } is not { @ link core options include config fragments enum # off } these are considered direct requirements on the rule

private static immutable set < string > get required fragments from deps ( build configuration configuration , iterable < configured target and data > prerequisites ) { tree set < string > required fragments = new tree set < > ( ) ; core options core options = configuration get options ( ) get ( core options class ) ; if ( core options include required config fragments provider = = core options include config fragments enum off ) { return immutable set of ( ) ; } for ( configured target and data prereq : prerequisites ) { / / if the target depends on a starlark build setting , conceptually that means it directly / / requires that as an option ( even though it ' s technically a dependency ) build setting provider build setting provider = prereq get configured target ( ) get provider ( build setting provider class ) ; if ( build setting provider ! = null ) { required fragments add ( build setting provider get label ( ) to string ( ) ) ; } if ( core options include required config fragments provider = = core options include config fragments enum transitive ) { / / add fragments only required because transitive deps need them required config fragments provider dep provider = prereq get configured target ( ) get provider ( required config fragments provider class ) ; if ( dep provider ! = null ) { required fragments add all ( dep provider get required config fragments ( ) ) ; } } } return immutable set copy of ( required fragments ) ; }


public void run ( frame frame , int offset , int opcode ) { / * * this is the stack pointer after the opcode ' s arguments have been * popped * / int stack pointer = max locals + frame get stack ( ) size ( ) ; / / the sources have to be retrieved before super run ( ) gets called register spec list sources = get sources ( opcode , stack pointer ) ; int source count = sources size ( ) ; super run ( frame , offset , opcode ) ; source position pos = method make source posistion ( offset ) ; register spec local target = get local target ( opcode = = byte ops istore ) ; int dest count = result count ( ) ; register spec dest ; if ( dest count = = 0 ) { dest = null ; switch ( opcode ) { case byte ops pop : case byte ops pop2 : { / / these simply don ' t appear in the rop form return ; } } } else if ( local target ! = null ) { dest = local target ; } else if ( dest count = = 1 ) { dest = register spec make ( stack pointer , result ( 0 ) ) ; } else { / * * this clause only ever applies to the stack manipulation * ops that have results ( that is , dup * and swap but not * pop * ) * * what we do is first move all the source registers into * the " temporary stack " area defined for the method , and * then move stuff back down onto the main " stack " in the * arrangement specified by the stack op pattern * * note : this code ends up emitting a lot of what will * turn out to be superfluous moves ( e g , moving back and * forth to the same local when doing a dup ) ; however , * that makes this code a bit easier ( and goodness knows * it doesn ' t need any extra complexity ) , and all the ssa * stuff is going to want to deal with this sort of * superfluous assignment anyway , so it should be a wash * in the end * / int scratch at = ropper get first temp stack reg ( ) ; register spec [ ] scratch regs = new register spec [ source count ] ; for ( int i = 0 ; i < source count ; i + + ) { register spec src = sources get ( i ) ; type bearer type = src get type bearer ( ) ; register spec scratch = src with reg ( scratch at ) ; insns add ( new plain insn ( rops op move ( type ) , pos , scratch , src ) ) ; scratch regs [ i ] = scratch ; scratch at + = src get category ( ) ; } for ( int pattern = get aux int ( ) ; pattern ! = 0 ; pattern > > = 4 ) { int which = ( pattern & 0x 0f ) - 1 ; register spec scratch = scratch regs [ which ] ; type bearer type = scratch get type bearer ( ) ; insns add ( new plain insn ( rops op move ( type ) , pos , scratch with reg ( stack pointer ) , scratch ) ) ; stack pointer + = type get type ( ) get category ( ) ; } return ; } type bearer dest type = ( dest ! = null ) ? dest : type void ; constant cst = get aux cst ( ) ; int rop opcode ; rop rop ; insn insn ; if ( opcode = = byte ops multianewarray ) { block can throw = true ; / / add the extra instructions for handling multianewarray extra block count = 6 ; / * * add an array constructor for the int [ ] containing all the * dimensions * / register spec dims reg = register spec make ( dest get next reg ( ) , type int array ) ; rop = rops op filled new array ( type int array , source count ) ; insn = new throwing cst insn ( rop , pos , sources , catches , cst type int array ) ; insns add ( insn ) ; / / add a move - result for the new - filled - array rop = rops op move result ( type int array ) ; insn = new plain insn ( rop , pos , dims reg , register spec list empty ) ; insns add ( insn ) ; / * * add a const - class instruction for the specified array * class * / / * * remove as many dimensions from the originally specified * class as are given in the explicit list of dimensions , * so as to pass the right component class to the standard * java library array constructor * / type component type = ( ( cst type ) cst ) get class type ( ) ; for ( int i = 0 ; i < source count ; i + + ) { component type = component type get component type ( ) ; } register spec class reg = register spec make ( dest get reg ( ) , type class ) ; if ( component type is primitive ( ) ) { / * * the component type is primitive ( e g , int as opposed * to integer ) , so we have to fetch the corresponding * type class * / cst field ref type field = cst field ref for primitive type ( component type ) ; insn = new throwing cst insn ( rops get static object , pos , register spec list empty , catches , type field ) ; } else { / * * the component type is an object type , so just make a * normal class reference * / insn = new throwing cst insn ( rops const object , pos , register spec list empty , catches , new cst type ( component type ) ) ; } insns add ( insn ) ; / / add a move - result - pseudo for the get - static or const rop = rops op move result pseudo ( class reg get type ( ) ) ; insn = new plain insn ( rop , pos , class reg , register spec list empty ) ; insns add ( insn ) ; / * * add a call to the " multianewarray method , " that is , * array new instance ( class , dims ) note : the result type * of new instance ( ) is object , which is why the last * instruction in this sequence is a cast to the right * type for the original instruction * / register spec object reg = register spec make ( dest get reg ( ) , type object ) ; insn = new throwing cst insn ( rops op invoke static ( multianewarray method get prototype ( ) ) , pos , register spec list make ( class reg , dims reg ) , catches , multianewarray method ) ; insns add ( insn ) ; / / add a move - result rop = rops op move result ( multianewarray method get prototype ( ) get return type ( ) ) ; insn = new plain insn ( rop , pos , object reg , register spec list empty ) ; insns add ( insn ) ; / * * and finally , set up for the remainder of this method to * add an appropriate cast * / opcode = byte ops checkcast ; sources = register spec list make ( object reg ) ; } else if ( opcode = = byte ops jsr ) { / / jsr has no rop instruction has jsr = true ; return ; } else if ( opcode = = byte ops ret ) { try { return address = ( return address ) arg ( 0 ) ; } catch ( class cast exception ex ) { throw new runtime exception ( " argument to ret was not a return address " , ex ) ; } / / ret has no rop instruction return ; } rop opcode = jop to rop opcode ( opcode , cst ) ; rop = rops rop for ( rop opcode , dest type , sources , cst ) ; insn move result = null ; if ( dest ! = null & & rop is call like ( ) ) { / * * we ' re going to want to have a move - result in the next * basic block * / extra block count + + ; move result = new plain insn ( rops op move result ( ( ( cst method ref ) cst ) get prototype ( ) get return type ( ) ) , pos , dest , register spec list empty ) ; dest = null ; } else if ( dest ! = null & & rop can throw ( ) ) { / * * we ' re going to want to have a move - result - pseudo in the * next basic block * / extra block count + + ; move result = new plain insn ( rops op move result pseudo ( dest get type bearer ( ) ) , pos , dest , register spec list empty ) ; dest = null ; } if ( rop opcode = = reg ops new array ) { / * * in the original bytecode , this was either a primitive * array constructor " newarray " or an object array * constructor " anewarray " in the former case , there is * no explicit constant , and in the latter , the constant * is for the element type and not the array type the rop * instruction form for both of these is supposed to be * the resulting array type , so we initialize / alter * " cst " here , accordingly conveniently enough , the rop * opcode already gets constructed with the proper array * type * / cst = cst type intern ( rop get result ( ) ) ; } else if ( ( cst = = null ) & & ( source count = = 2 ) ) { type bearer first type = sources get ( 0 ) get type bearer ( ) ; type bearer last type = sources get ( 1 ) get type bearer ( ) ; if ( ( last type is constant ( ) | | first type is constant ( ) ) & & advice has constant operation ( rop , sources get ( 0 ) , sources get ( 1 ) ) ) { if ( last type is constant ( ) ) { / * * the target architecture has an instruction that can * build in the constant found in the second argument , * so pull it out of the sources and just use it as a * constant here * / cst = ( constant ) last type ; sources = sources without last ( ) ; / / for subtraction , change to addition and invert constant if ( rop get opcode ( ) = = reg ops sub ) { rop opcode = reg ops add ; cst integer cst int = ( cst integer ) last type ; cst = cst integer make ( - cst int get value ( ) ) ; } } else { / * * the target architecture has an instruction that can * build in the constant found in the first argument , * so pull it out of the sources and just use it as a * constant here * / cst = ( constant ) first type ; sources = sources without first ( ) ; } rop = rops rop for ( rop opcode , dest type , sources , cst ) ; } } switch list cases = get aux cases ( ) ; array list < constant > init values = get init values ( ) ; boolean can throw = rop can throw ( ) ; block can throw | = can throw ; if ( cases ! = null ) { if ( cases size ( ) = = 0 ) { / / it ' s a default - only switch statement it can happen ! insn = new plain insn ( rops goto , pos , null , register spec list empty ) ; primary successor index = 0 ; } else { int list values = cases get values ( ) ; insn = new switch insn ( rop , pos , dest , sources , values ) ; primary successor index = values size ( ) ; } } else if ( rop opcode = = reg ops return ) { / * * returns get turned into the combination of a move ( if * non - void and if the return doesn ' t already mention * register 0 ) and a goto ( to the return block ) * / if ( sources size ( ) ! = 0 ) { register spec source = sources get ( 0 ) ; type bearer type = source get type bearer ( ) ; if ( source get reg ( ) ! = 0 ) { insns add ( new plain insn ( rops op move ( type ) , pos , register spec make ( 0 , type ) , source ) ) ; } } insn = new plain insn ( rops goto , pos , null , register spec list empty ) ; primary successor index = 0 ; update return op ( rop , pos ) ; returns = true ; } else if ( cst ! = null ) { if ( can throw ) { insn = new throwing cst insn ( rop , pos , sources , catches , cst ) ; catches used = true ; primary successor index = catches size ( ) ; } else { insn = new plain cst insn ( rop , pos , dest , sources , cst ) ; } } else if ( can throw ) { insn = new throwing insn ( rop , pos , sources , catches ) ; catches used = true ; if ( opcode = = byte ops athrow ) { / * * the op athrow is the only one where it ' s possible * to have non - empty successors and yet not have a * primary successor * / primary successor index = - 1 ; } else { primary successor index = catches size ( ) ; } } else { insn = new plain insn ( rop , pos , dest , sources ) ; } insns add ( insn ) ; if ( move result ! = null ) { insns add ( move result ) ; } / * * if init values is non - null , it means that the parser has * seen a group of compatible constant initialization * bytecodes that are applied to the current newarray the * action we take here is to convert these initialization * bytecodes into a single fill - array - data rop which lays out * all the constant values in a table * / if ( init values ! = null ) { extra block count + + ; insn = new fill array data insn ( rops fill array data , pos , register spec list make ( move result get result ( ) ) , init values , cst ) ; insns add ( insn ) ; } }


passwords are never read from database it is used to createalter schemauser

public string get password ( ) { return password ; }


public void set newer than ( long newer than ) { if ( older than ! = null ) { throw new unsupported operation exception ( " cannot set ' newer than ' ' older than ' already set " ) ; } this newer than = newer than ; }


keep accessing the given file until the namenode reports that the given block in the file contains the given number of corrupt replicas

public static void wait corrupt replicas ( file system fs , f s namesystem ns , path file , extended block b , int corrupt repls ) throws timeout exception , interrupted exception { int count = 0 ; final int attempts = 50 ; int repls = ns get block manager ( ) num corrupt replicas ( b get local block ( ) ) ; while ( repls ! = corrupt repls & & count < attempts ) { try { i o utils copy bytes ( fs open ( file ) , new i o utils null output stream ( ) , 512 , true ) ; } catch ( i o exception e ) { / / swallow exceptions } system out println ( " waiting for " + corrupt repls + " corrupt replicas " ) ; count + + ; / / check more often so corrupt block reports are not easily missed for ( int i = 0 ; i < 10 ; i + + ) { repls = ns get block manager ( ) num corrupt replicas ( b get local block ( ) ) ; thread sleep ( 100 ) ; if ( repls = = corrupt repls ) { break ; } } } if ( count = = attempts ) { throw new timeout exception ( " timed out waiting for corrupt replicas " + " waiting for " + corrupt repls + " , but only found " + repls ) ; } }


returns true if field corresponding to field i d is set ( has been assigned a value ) and false otherwise

public boolean is set ( fields field ) { if ( field = = null ) { throw new illegal argument exception ( ) ; } switch ( field ) { case executor info : return is set executor info ( ) ; case component id : return is set component id ( ) ; case host : return is set host ( ) ; case port : return is set port ( ) ; case uptime secs : return is set uptime secs ( ) ; case stats : return is set stats ( ) ; } throw new illegal state exception ( ) ; }


freeze the clock if not frozen and advance it by the given amount of seconds

public void fast forward seconds ( int seconds ) { fast forward ( time value time value seconds ( seconds ) ) ; }


public static string get cas server host name ( ) { val host name = inet address get local host ( ) get host name ( ) ; val index = host name index of ( ' ' ) ; if ( index > 0 ) { return host name substring ( 0 , index ) ; } return host name ; }


clean up any known side - effects that the running spawn may have had on the output tree this is supposed to leave the output tree as it was right after { @ link com google devtools build lib skyframe skyframe action executor } created the output directories for the spawn , which means that any outputs have to be deleted but any top - level directory for tree artifacts has to be kept behind ( and empty )

private void maybe cleanup on interrupt ( ) { if ( ! local execution options local lockfree output ) { / / if we don ' t allow lockfree executions of local subprocesses , there is no need to clean up / / anything : we would have already locked the output tree upfront , so we " own " it return ; } if ( ! need cleanup ) { / / if the subprocess has not yet started , there is no need to worry about checking on - disk / / state return ; } for ( action input output : spawn get output files ( ) ) { path path = context get path resolver ( ) to path ( output ) ; try { if ( path exists ( ) ) { step log ( info , " clearing output % s after interrupt " , path ) ; if ( output instanceof artifact & & ( ( artifact ) output ) is tree artifact ( ) ) { path delete trees below ( ) ; } else { path delete tree ( ) ; } } } catch ( i o exception e ) { step log ( severe , e , " cannot delete local output % s after interrupt " , path ) ; } } }


get the fully qualified name for this category

public string get category path name ( ) { category path path = get category path ( ) ; return path get path ( ) ; }


returns the value associated with the given key as an integer

public int get integer ( string key , int default value ) { return get raw value ( key ) map ( configuration utils : : convert to int ) or else ( default value ) ; }


get the list of children , indexed by corresponding symbol from the rhs

public list < assembly parse tree node > get substitutions ( ) { return collections unmodifiable list ( substs ) ; }


this test verified that after a completed checkpoint a certain time has passed before another is triggered

public void test min time between checkpoints interval ( ) throws exception { final job i d jid = new job i d ( ) ; / / create some mock execution vertices and trigger some checkpoint final execution attempt i d attempt i d = new execution attempt i d ( ) ; final execution vertex vertex = mock execution vertex ( attempt i d ) ; final execution execution attempt = vertex get current execution attempt ( ) ; final blocking queue < long > trigger calls = new linked blocking queue < > ( ) ; do answer ( invocation - > { trigger calls add ( ( long ) invocation get arguments ( ) [ 0 ] ) ; return null ; } ) when ( execution attempt ) trigger checkpoint ( any long ( ) , any long ( ) , any ( checkpoint options class ) ) ; final long delay = 50 ; final long checkpoint interval = 12 ; checkpoint coordinator configuration checkpoint coordinator configuration = new checkpoint coordinator configuration builder ( ) set checkpoint interval ( checkpoint interval ) / / periodic interval is 12 ms set checkpoint timeout ( 200 000 ) / / timeout is very long ( 200 s ) set min pause between checkpoints ( delay ) / / 50 ms delay between checkpoints set max concurrent checkpoints ( 1 ) build ( ) ; final checkpoint coordinator checkpoint coordinator = new checkpoint coordinator builder ( ) set job id ( jid ) set checkpoint coordinator configuration ( checkpoint coordinator configuration ) set tasks ( new execution vertex [ ] { vertex } ) set completed checkpoint store ( new standalone completed checkpoint store ( 2 ) ) set timer ( manually triggered scheduled executor ) build ( ) ; try { checkpoint coordinator start checkpoint scheduler ( ) ; manually triggered scheduled executor trigger periodic scheduled tasks ( ) ; manually triggered scheduled executor trigger all ( ) ; / / wait until the first checkpoint was triggered long first call id = trigger calls take ( ) ; assert equals ( 1l , first call id long value ( ) ) ; acknowledge checkpoint ack msg = new acknowledge checkpoint ( jid , attempt i d , 1l ) ; / / tell the coordinator that the checkpoint is done final long ack time = system nano time ( ) ; checkpoint coordinator receive acknowledge message ( ack msg , task manager location info ) ; manually triggered scheduled executor trigger periodic scheduled tasks ( ) ; manually triggered scheduled executor trigger all ( ) ; while ( trigger calls is empty ( ) ) { / / sleeps for a while to simulate periodic scheduling thread sleep ( checkpoint interval ) ; manually triggered scheduled executor trigger periodic scheduled tasks ( ) ; manually triggered scheduled executor trigger all ( ) ; } / / wait until the next checkpoint is triggered long next call id = trigger calls take ( ) ; final long next checkpoint time = system nano time ( ) ; assert equals ( 2l , next call id long value ( ) ) ; final long delay millis = ( next checkpoint time - ack time ) / 1 000 000 ; / / we need to add one ms here to account for rounding errors if ( delay millis + 1 < delay ) { fail ( " checkpoint came too early : delay was " + delay millis + " but should have been at least " + delay ) ; } } finally { checkpoint coordinator stop checkpoint scheduler ( ) ; checkpoint coordinator shutdown ( ) ; } }


a signal to this graph that a group has been created and added to the graph

public void group added ( grouped function graph vertex group ) { group add group listener ( group listener ) ; remove associated groups ( group get vertices ( ) ) ; }


convert the given object to string with each line indented by 4 spaces ( except the first line )

private string to indented string ( object o ) { if ( o = = null ) { return " null " ; } return o to string ( ) replace ( " \ n " , " \ n " ) ; }


public void test truncatewith renameand snapshot ( ) throws exception { final path dir = new path ( " / dir " ) ; fs mkdirs ( dir , new fs permission ( ( short ) 0777 ) ) ; final path file = new path ( dir , " file " ) ; final path moved file = new path ( " / file " ) ; / / 1 create a file and snapshot for dir which is having a file d f s test util create file ( fs , file , 10 , ( short ) 3 , 0 ) ; fs allow snapshot ( dir ) ; path snapshot path = fs create snapshot ( dir , " s 0 " ) ; assert true ( fs exists ( snapshot path ) ) ; / / 2 move the file fs rename ( file , new path ( " / " ) ) ; / / 3 truncate the moved file final boolean is ready = fs truncate ( moved file , 5 ) ; if ( ! is ready ) { check block recovery ( moved file ) ; } file status file status = fs get file status ( moved file ) ; assert equals ( 5 , file status get len ( ) ) ; / / 4 get block locations of file which is in snapshot located blocks locations = fs get client ( ) get namenode ( ) get block locations ( " / dir / snapshot / s 0 / file " , 0 , 10 ) ; assert equals ( 10 , locations get ( 0 ) get block size ( ) ) ; }


set one or more customizers to be applied to this evaluator ' s compiler configuration note that this modifies the shared compiler configuration held by this evaluator

public void set compilation customizers ( compilation customizer compilation customizers ) { this compiler configuration add compilation customizers ( compilation customizers ) ; }


create a pre - configured tokenizer that may not vary at all

public static pre configured tokenizer singleton ( string name , supplier < tokenizer > create ) { return new pre configured tokenizer ( name , caching strategy one , version - > create get ( ) ) ; }


creates a new tuple and assigns the given values to the tuple ' s fields this is more convenient than using the constructor , because the compiler can infer the generic type arguments implicitly for example : { @ code tuple 3 of ( n , x , s ) } instead of { @ code new tuple 3 < integer , double , string > ( n , x , s ) }


load a string as the java version of a json type , either list ( json array ) , map ( json object ) , number , boolean or string

public static object load ( string json ) throws i o exception { x content parser parser = json x content json x content create parser ( named x content registry empty , deprecation handler throw unsupported operation , json ) ; switch ( parser next token ( ) ) { case start array : return parser list ( ) ; case start object : return parser map ( ) ; case value number : return parser number value ( ) ; case value boolean : return parser boolean value ( ) ; case value string : return parser text ( ) ; default : return null ; } }


public void test snapshot path i nodes ( ) throws exception { / / create a snapshot for the dir , and check the inodes for the path / / pointing to a snapshot file hdfs allow snapshot ( sub 1 ) ; hdfs create snapshot ( sub 1 , " s 1 " ) ; / / the path when accessing the snapshot file of file 1 is / / / test snapshot / sub 1 / snapshot / s 1 / file 1 string snapshot path = sub 1 to string ( ) + " / snapshot / s 1 / file 1 " ; byte [ ] [ ] components = i node get path components ( snapshot path ) ; i nodes in path nodes in path = i nodes in path resolve ( fsdir root dir , components , false ) ; / / length of inodes should be ( components length - 1 ) , since we will ignore / / " snapshot " assert equals ( nodes in path length ( ) , components length - 1 ) ; / / snapshot root index should be 3 : { root , testsnapshot , sub 1 , s 1 , file 1 } final snapshot snapshot = get snapshot ( nodes in path , " s 1 " , 3 ) ; assert snapshot ( nodes in path , true , snapshot , 3 ) ; assert equals ( " snapshot / s 1 " , d f s util bytes 2 string ( nodes in path get path component ( 3 ) ) ) ; assert true ( nodes in path get i node ( 3 ) instanceof snapshot root ) ; assert equals ( " s 1 " , nodes in path get i node ( 3 ) get local name ( ) ) ; / / check the i node for file 1 ( snapshot file ) i node snapshot file node = nodes in path get last i node ( ) ; assert i node file ( snapshot file node , file 1 ) ; assert true ( snapshot file node get parent ( ) is with snapshot ( ) ) ; / / call get existing path i nodes and request only one i node nodes in path = i nodes in path resolve ( fsdir root dir , components , false ) ; assert equals ( nodes in path length ( ) , components length - 1 ) ; assert snapshot ( nodes in path , true , snapshot , 3 ) ; / / check the i node for file 1 ( snapshot file ) assert i node file ( nodes in path get last i node ( ) , file 1 ) ; / / resolve the path " / test snapshot / sub 1 / snapshot " string dot snapshot path = sub 1 to string ( ) + " / snapshot " ; components = i node get path components ( dot snapshot path ) ; nodes in path = i nodes in path resolve ( fsdir root dir , components , false ) ; / / the number of i nodes returned should still be components length / / since we put a null in the inode array for " snapshot " assert equals ( nodes in path length ( ) , components length ) ; assert equals ( " snapshot " , d f s util bytes 2 string ( nodes in path get last local name ( ) ) ) ; assert null ( nodes in path get last i node ( ) ) ; / / ensure parent inodes can strip the snapshot assert equals ( sub 1 to string ( ) , nodes in path get parent i nodes in path ( ) get path ( ) ) ; / / no snapshot root dir is included in the resolved inodes assert snapshot ( nodes in path , true , snapshot , - 1 ) ; / / the last i node should be null , the last but 1 should be sub 1 assert null ( nodes in path get last i node ( ) ) ; assert equals ( nodes in path get i node ( - 2 ) get full path name ( ) , sub 1 to string ( ) ) ; assert true ( nodes in path get i node ( - 2 ) is directory ( ) ) ; string [ ] invalid path component = { " invalid dir " , " foo " , " snapshot " , " bar " } ; path invalid path = new path ( invalid path component [ 0 ] ) ; for ( int i = 1 ; i < invalid path component length ; i + + ) { invalid path = new path ( invalid path , invalid path component [ i ] ) ; try { hdfs get file status ( invalid path ) ; assert fail ( ) ; } catch ( file not found exception fnfe ) { system out println ( " the exception is expected : " + fnfe ) ; } } hdfs delete snapshot ( sub 1 , " s 1 " ) ; hdfs disallow snapshot ( sub 1 ) ; }


return the start and stop offsets for each term if they were stored or skip offsets

public term vectors request offsets ( boolean offsets ) { set flag ( flag offsets , offsets ) ; return this ; }


calculates compression level on the basis of block size

private static int compression level ( int block size ) { if ( block size < min block size | | block size > max block size ) { throw new illegal argument exception ( string format ( " block size : % d ( expected : % d - % d ) " , block size , min block size , max block size ) ) ; } int compression level = 32 - integer number of leading zeros ( block size - 1 ) ; / / ceil of log 2 compression level = math max ( 0 , compression level - compression level base ) ; return compression level ; }


same { { @ link # mkdirs ( string , fs permission , boolean ) } except that the permissions has already been masked against umask

public boolean primitive mkdir ( string src , fs permission abs permission ) throws i o exception { return primitive mkdir ( src , abs permission , true ) ; }


returns the repository name , with leading " { @ literal @ } " ( or " " for the default repository )

public string get name ( ) { return name ; }


resolve the given message with a user destination to one or more messages with actual destinations , one for each active user session

user destination result resolve destination ( message < ? > message ) ;


create user this can only be done by the logged in user

public void create user test ( ) throws api exception { user body = null ; api create user ( body ) ; / / todo : test validations }


returns { @ code true } if each element in { @ code iterable } after the first is strictly greater than the element that preceded it , according to the specified comparator note that this is always true when the iterable has fewer than two elements

public static < t > boolean is in strict order ( iterable < ? extends t > iterable , comparator < t > comparator ) { check not null ( comparator ) ; iterator < ? extends t > it = iterable iterator ( ) ; if ( it has next ( ) ) { t prev = it next ( ) ; while ( it has next ( ) ) { t next = it next ( ) ; if ( comparator compare ( prev , next ) > = 0 ) { return false ; } prev = next ; } } return true ; }


returns the type mirror corresponding to { @ code clazz }

private type mirror get type ( class < ? > clazz ) { return auto codec util get type ( clazz , env ) ; }


animates the rendering of the chart on the y - axis with the specified animation time if animate ( ) is called , no further calling of invalidate ( ) is necessary to refresh the chart animations only work for api level 11 ( android 3 0 x ) and higher

public void animate y ( int duration millis ) { m animator animate y ( duration millis ) ; }


private void append history file ( version ver ) { file history file = get history file ( ) ; try { buffered writer out = new buffered writer ( new file writer ( history file , true ) ) ; out write ( encode version ( ver ) ) ; out new line ( ) ; out close ( ) ; } catch ( i o exception e ) { item log ( " error ! failed to update history file : " + e to string ( ) , null ) ; } }


glue hive metastore currently uses aws default credential provider chain , see https : docs aws amazon comsdk - for - javav 1developer - guidecredentials html # credentials - default on ways to set your aws credentials which will be needed to run this test

protected extended hive metastore create metastore ( file temp dir ) { hive client config hive client config = new hive client config ( ) ; metastore client config metastore client config = new metastore client config ( ) ; hdfs configuration hdfs configuration = new hive hdfs configuration ( new hdfs configuration initializer ( hive client config , metastore client config ) , immutable set of ( ) ) ; hdfs environment hdfs environment = new hdfs environment ( hdfs configuration , metastore client config , new no hdfs authentication ( ) ) ; glue hive metastore config glue config = new glue hive metastore config ( ) ; glue config set default warehouse dir ( temp dir to u r i ( ) to string ( ) ) ; return new glue hive metastore ( hdfs environment , glue config , executor ) ; }


update an existing pet ( asynchronously )

public okhttp 3 call update pet async ( pet body , final api callback < void > callback ) throws api exception { okhttp 3 call local var call = update pet validate before call ( body , callback ) ; local var api client execute async ( local var call , callback ) ; return local var call ; }


tests vertical composition first pointcut matches all setters second one matches all getters in the my test bean class test bean getters shouldn ' t pass

public void test union of all setters and subclass setters ( ) { assert that ( pointcuts matches ( my test bean setter pointcut , test bean set age , test bean class , 6 ) ) is false ( ) ; assert that ( pointcuts matches ( my test bean setter pointcut , test bean set age , my test bean class , 6 ) ) is true ( ) ; assert that ( pointcuts matches ( my test bean setter pointcut , test bean get age , test bean class ) ) is false ( ) ; pointcut union = pointcuts union ( my test bean setter pointcut , all class getter pointcut ) ; assert that ( pointcuts matches ( union , test bean get age , test bean class ) ) is true ( ) ; assert that ( pointcuts matches ( union , test bean get age , my test bean class ) ) is true ( ) ; / / still doesn ' t match superclass setter assert that ( pointcuts matches ( union , test bean set age , my test bean class , 6 ) ) is true ( ) ; assert that ( pointcuts matches ( union , test bean set age , test bean class , 6 ) ) is false ( ) ; }


public void add ( int value ) { int index = ints binarysearch ( value ) ; if ( index < 0 ) { ints insert ( - ( index + 1 ) , value ) ; } }


invoked to notify the logger about an error

void on webp error log ( string message , @ nullable string extra ) ;


asynchronous version of { @ link abstract dao # insert in tx ( object ) }

public < e > async operation insert in tx ( class < e > entity class , int flags , e entities ) { return enque entity operation ( operation type insert in tx array , entity class , entities , flags ) ; }


< code > optional aapt pb string str = 2 ; < code >

public com android aapt resources string get str ( ) { return str = = null ? com android aapt resources string get default instance ( ) : str ; }


create the { @ link yaml } instance to use the default implementation sets the " allow duplicate keys " flag to { @ code false } , enabling built - in duplicate key handling in snake y a m l 1 18 + as of spring framework 5 1 16 , if custom { @ linkplain # set supported types supported types } have been configured , the default implementation creates a { @ code yaml } instance that filters out unsupported types encountered in yaml documents if an unsupported type is encountered , an { @ link illegal state exception } will be thrown when the node is processed

protected yaml create yaml ( ) { loader options loader options = new loader options ( ) ; loader options set allow duplicate keys ( false ) ; if ( ! this supported types is empty ( ) ) { return new yaml ( new filtering constructor ( loader options ) , new representer ( ) , new dumper options ( ) , loader options ) ; } return new yaml ( loader options ) ; }


returns the ghidra version string ( used to create the library )

public string get ghidra version ( ) { return record get string ( ghidra version col ) ; }


return the request uri of the original request , that is , the invoked url without parameters this is particularly useful as html form action target , possibly in combination with the original query string delegates to the url path helper for decoding

public string get request uri ( ) { return this url path helper get originating request uri ( this request ) ; }


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 0 : / / success return success ; default : return null ; } }


accept the given visitor default implementation calls { @ link request predicates visitor # unknown ( request predicate ) } ; composed { @ code request predicate } implementations are expected to call { @ code accept } for all components that make up this request predicate

default void accept ( request predicates visitor visitor ) { visitor unknown ( this ) ; }


returns the immutable set of declared include directories , relative to a " - i " or " - iquote " directory " ( possibly empty but never null )

public nested set < path fragment > get loose hdrs dirs ( ) { return loose hdrs dirs ; }


copies all of the mappings from the specified map to this map the effect of this call is equivalent to that of calling { @ code put ( k , v ) } on this map once for each mapping from key { @ code k } to value { @ code v } in the specified map the behavior of this operation is undefined if the specified map is modified while the operation is in progress

public void put all ( map < ? extends k , ? extends long > m ) { for ( entry < ? extends k , ? extends long > entry : m entry set ( ) ) { put ( entry get key ( ) , entry get value ( ) ) ; } }


the list of subject alternate names allowed for workload instances that implement this service this information is used to enforce [ secure - naming ] ( https : istio iodocsconceptssecurity # secure - naming ) if specified , the proxy will verify that the server certificate ' s subject alternate name matches one of the specified values < code > repeated string subject alt names = 8 ; < code >

public builder add all subject alt names ( java lang iterable < java lang string > values ) { ensure subject alt names is mutable ( ) ; com google protobuf abstract message lite builder add all ( values , subject alt names ) ; on changed ( ) ; return this ; }


public list < x attr > get x attrs ( ) { if ( x attrs = = null ) { return x attr format to x attrs ( attrs ) ; } else { if ( attrs = = null ) { return x attrs ; } else { list < x attr > result = new array list < > ( ) ; result add all ( x attr format to x attrs ( attrs ) ) ; result add all ( x attrs ) ; return result ; } } }


callback invoked after new cluster state is published note that this method is not invoked if the cluster state was not updated note that this method will be executed using system context

default void cluster state published ( cluster changed event cluster changed event ) { }


tests that track selector will prefer tracks that are within renderer ' s capabilities over track that exceed renderer ' s capabilities

public void select tracks prefer track within capabilities ( ) throws exception { format builder format builder = audio format build upon ( ) ; format supported format = format builder set id ( " supported format " ) build ( ) ; format exceeded format = format builder set id ( " exceeded format " ) build ( ) ; track group array track groups = wrap formats ( exceeded format , supported format ) ; map < string , integer > mapped capabilities = new hash map < > ( ) ; mapped capabilities put ( supported format id , format handled ) ; mapped capabilities put ( exceeded format id , format exceeds capabilities ) ; renderer capabilities mapped audio renderer capabilities = new fake mapped renderer capabilities ( c track type audio , mapped capabilities ) ; track selector result result = track selector select tracks ( new renderer capabilities [ ] { mapped audio renderer capabilities } , track groups , period id , timeline ) ; assert fixed selection ( result selections get ( 0 ) , track groups , supported format ) ; }


public void set show rewind button ( boolean show rewind button ) { control view layout manager set show button ( rewind button , show rewind button ) ; update navigation ( ) ; }


sets whether to acquire or release the { @ link wifi lock } the wifi lock will not be acquired unless handling has been enabled through { @ link # set enabled ( boolean ) }

public void set stay awake ( boolean stay awake ) { this stay awake = stay awake ; update wifi lock ( ) ; }


convenience method that returns a { @ link file type # external } file handle

public file handle external ( string path ) ;


public void set ascii stream ( int parameter index , input stream x ) throws s q l exception { }


< code > optional int 3 2 blah = 1 ; < code >

public int get blah ( ) { return blah ; }


public float get max motor force ( ) { return joint get max motor force ( ) ; }


test the property ' quadrilateral type '

public void quadrilateral type test ( ) { / / todo : test quadrilateral type }


public void println ( ) { println ( " " ) ; }


public get calendars response get calendars ( get calendars request request , request options options ) throws i o exception { return rest high level client perform request and parse entity ( request , m l request converters : : get calendars , options , get calendars response : : from x content , collections empty set ( ) ) ; }


if this is a compiled xml file , this is the root node < code > optional aapt pb xml node xml root = 5 ; < code >


concatenates this string and the specified string

public ascii string concat ( char sequence string ) { int this len = length ( ) ; int that len = string length ( ) ; if ( that len = = 0 ) { return this ; } if ( string instanceof ascii string ) { ascii string that = ( ascii string ) string ; if ( is empty ( ) ) { return that ; } byte [ ] new value = platform dependent allocate uninitialized array ( this len + that len ) ; system arraycopy ( value , array offset ( ) , new value , 0 , this len ) ; system arraycopy ( that value , that array offset ( ) , new value , this len , that len ) ; return new ascii string ( new value , false ) ; } if ( is empty ( ) ) { return new ascii string ( string ) ; } byte [ ] new value = platform dependent allocate uninitialized array ( this len + that len ) ; system arraycopy ( value , array offset ( ) , new value , 0 , this len ) ; for ( int i = this len , j = 0 ; i < new value length ; i + + , j + + ) { new value [ i ] = c 2b ( string char at ( j ) ) ; } return new ascii string ( new value , false ) ; }


determines if the security settings seem to match the defaults here , we only really care about and test for hudson private security realm and the user setup other settings are irrelevant

/ * package * / boolean is using security defaults ( ) { jenkins j = jenkins get ( ) ; if ( j get security realm ( ) instanceof hudson private security realm ) { hudson private security realm security realm = ( hudson private security realm ) j get security realm ( ) ; try { if ( security realm get all users ( ) size ( ) = = 1 ) { hudson private security realm details details = security realm load ( setup wizard initial setup admin user name ) ; file path iapf = get initial admin password file ( ) ; if ( iapf exists ( ) ) { if ( details is password correct ( iapf read to string ( ) trim ( ) ) ) { return true ; } } } } catch ( username not found exception | i o exception | interrupted exception e ) { return false ; / / not initial security setup if no transitional admin user / password found } } return false ; }


check that whether debugging is enabled for this api client

public boolean is debugging ( ) { return debugging ; }


type of resource collection that is being requested , e g istionetworkingv 1alpha 3 virtual service k 8s & lt ; api version & gt ; & lt ; kind & gt ; < code > string collection = 2 ; < code >

public java lang string get collection ( ) { java lang object ref = collection ; if ( ref instanceof java lang string ) { return ( java lang string ) ref ; } else { com google protobuf byte string bs = ( com google protobuf byte string ) ref ; java lang string s = bs to string utf 8 ( ) ; collection = s ; return s ; } }


close the object and de - allocate the memory used


execute a method in a new http client instance if the auth failed , authenticate then retry the method

private < m extends http uri request > http response exec ( http client client , m req ) throws i o exception { http response resp = exec with debug output ( req , client ) ; int status code = resp get status line ( ) get status code ( ) ; if ( ( status code = = http status sc unauthorized | | status code = = http status sc bad request ) & & req instanceof auth post request & & ! use keystone authentication ) { if ( log is debug enabled ( ) ) { log debug ( " operation failed with status " + status code + " attempting keystone auth " ) ; } / / if rackspace key authentication failed - try custom keystone authentication use keystone authentication = true ; final auth post request authentication = ( auth post request ) req ; / / replace rackspace auth with keystone one authentication set entity ( get authentication requst ( keystone auth request ) ) ; resp = exec with debug output ( req , client ) ; } if ( status code = = http status sc unauthorized ) { / / unauthed - or the auth uri rejected it if ( req instanceof auth post request ) { / / unauth response from the auth uri itself throw new swift authentication failed exception ( auth request to string ( ) , " auth " , auth uri , resp ) ; } / / any other url : try again if ( log is debug enabled ( ) ) { log debug ( " reauthenticating " ) ; } / / re - auth , this may recurse into the same dir authenticate ( ) ; if ( log is debug enabled ( ) ) { log debug ( " retrying original request " ) ; } resp = exec with debug output ( req , client ) ; } return resp ; }


returns the wall time taken by the { @ link spawn } ' s execution

optional < duration > get wall time ( ) ;


result is combined from all reduce output files and is written to result file in the format column 1 :

private static void analyze result ( file system fs , int test type , long exec time , path res file name ) throws i o exception { log info ( " analyzing results " ) ; data output stream out = null ; buffered writer writer = null ; try { out = new data output stream ( fs create ( res file name ) ) ; writer = new buffered writer ( new output stream writer ( out ) ) ; writer write ( " series \ t p e r i o d \ t t y p e \ t s l o t hour \ n " ) ; file status [ ] reduce files = fs list status ( output dir ) ; assert reduce files length = = j h l a partitioner num reducers ; for ( int i = 0 ; i < j h l a partitioner num reducers ; i + + ) { data input stream in = null ; buffered reader lines = null ; try { in = fs open ( reduce files [ i ] get path ( ) ) ; lines = new buffered reader ( new input stream reader ( in ) ) ; string line ; while ( ( line = lines read line ( ) ) ! = null ) { string tokenizer tokens = new string tokenizer ( line , " \ t * " ) ; string attr = tokens next token ( ) ; string date time = tokens next token ( ) ; string task type = tokens next token ( ) ; double val = long parse long ( tokens next token ( ) ) / ( double ) default time interval msec ; writer write ( attr substring ( 2 ) ) ; / / skip the stat type " l : " writer write ( " \ t " ) ; writer write ( date time ) ; writer write ( " \ t " ) ; writer write ( task type ) ; writer write ( " \ t " ) ; writer write ( string value of ( ( float ) val ) ) ; writer new line ( ) ; } } finally { if ( lines ! = null ) lines close ( ) ; if ( in ! = null ) in close ( ) ; } } } finally { if ( writer ! = null ) writer close ( ) ; if ( out ! = null ) out close ( ) ; } log info ( " analyzing results done " ) ; }


an application has new outstanding requests

synchronized public void activate application ( string user , application id application id ) { set < application id > user apps = users applications get ( user ) ; if ( user apps = = null ) { user apps = new hash set < application id > ( ) ; users applications put ( user , user apps ) ; + + active users ; metrics incr active users ( ) ; log debug ( " user { } added to active users , currently : { } " , user , active users ) ; } if ( user apps add ( application id ) ) { metrics activate app ( user ) ; } }


location to write api files you can use the api package ( ) as defined when the class is instantiated

public string api file folder ( ) { return output folder + file separator + api package ( ) replace ( ' ' , file separator char ) ; }


return an array that maps predicted alt from recursive op decision to original alt of rule for following rule , return [ 0 , 1 , 3 ] e : e ' ' e | int | e ' + ' e | id ; that maps predicted alt 1 to original alt 1 and predicted 2 to alt 3

public int [ ] get recursive op alts ( ) { if ( rec op alts size ( ) = = 0 ) return null ; int [ ] alts = new int [ rec op alts size ( ) + 1 ] ; int alt = 1 ; for ( left recursive rule alt info alt info : rec op alts values ( ) ) { alts [ alt ] = alt info alt num ; alt + + ; / / rec op alts has alts possibly with gaps } return alts ; }


returns the first eight bytes of { @ linkplain # as bytes ( ) this hashcode ' s bytes } , converted to a { @ code long } value in little - endian order


public void add listener ( remote adapter listener listener ) { listener list add ( listener ) ; }


< code > map & lt ; string , org apache dubbo metadata definition protobuf model phone number & gt ; double map = 9 ; < code >

public boolean contains double map ( java lang string key ) { if ( key = = null ) { throw new java lang null pointer exception ( ) ; } return internal get double map ( ) get map ( ) contains key ( key ) ; }


estimates load starting from the ' start ' timestamp , up to the ' end ' timestamp

public iterable < future load > predict ( mapping worksheet plan , computer computer , long start , long end ) { / / maintain backward compatibility by calling the old signature return predict ( computer , start , end ) ; }


the string value is this class name and the string values of nested providers

public string to string ( ) { return " a w s credential provider list [ " + name + " refcount = " + ref count get ( ) + " : [ " + string utils join ( providers , " , " ) + ' ] ' + ( last provider ! = null ? ( " last provider : " + last provider ) : " " ) ; }


returns a fully - populated { @ link recipient } based off of a uuid and phone number , creating one in the database if necessary we want both piece of information so we ' re able to associate them both together , depending on which are available in particular , while we ' ll eventually get the uuid of a user created via a phone number ( through a directory sync ) , the only way we can store the phone number is by retrieving it from sent messages and whatnot so we should store it when available

public static @ non null recipient external push ( @ non null context context , @ nullable uuid uuid , @ nullable string e 1 6 4 , boolean high trust ) { if ( uuid util unknown uuid equals ( uuid ) ) { throw new assertion error ( ) ; } recipient database db = database factory get recipient database ( context ) ; recipient id recipient id = db get and possibly merge ( uuid , e 1 6 4 , high trust ) ; return resolved ( recipient id ) ; }


compares a { @ code char sequence } to this { @ code string } to determine if their contents are equal

public boolean content equals ( char sequence a ) { if ( this = = a ) { return true ; } if ( a = = null | | a length ( ) ! = length ( ) ) { return false ; } if ( a instanceof ascii string ) { return equals ( a ) ; } for ( int i = array offset ( ) , j = 0 ; j < a length ( ) ; + + i , + + j ) { if ( b 2c ( value [ i ] ) ! = a char at ( j ) ) { return false ; } } return true ; }


returns an immutable set containing the given elements , minus duplicates , in the order each was first specified that is , if multiple elements are { @ linkplain object # equals equal } , all except the first are ignored the array { @ code others } must not be longer than { @ code integer max value - 6 }

public static < e > immutable set < e > of ( e e 1 , e e 2 , e e 3 , e e 4 , e e 5 , e e 6 , e others ) { check argument ( others length < = integer max value - 6 , " the total number of elements must fit in an int " ) ; final int param count = 6 ; object [ ] elements = new object [ param count + others length ] ; elements [ 0 ] = e 1 ; elements [ 1 ] = e 2 ; elements [ 2 ] = e 3 ; elements [ 3 ] = e 4 ; elements [ 4 ] = e 5 ; elements [ 5 ] = e 6 ; system arraycopy ( others , 0 , elements , param count , others length ) ; return construct ( elements length , elements ) ; }


return the transfer data with the given data flavor

public synchronized object get transfer data ( data flavor f ) throws unsupported flavor exception , i o exception { if ( f equals ( local data type flavor ) ) { return info list ; } throw new unsupported flavor exception ( f ) ; }


public void write ( short code unit ) { array [ cursor ( ) ] = code unit ; advance ( 1 ) ; }


sets a new value of an entry adds newly created entries at the end of the access queue

void set value ( reference entry < k , v > entry , k key , v value , long now ) { value reference < k , v > previous = entry get value reference ( ) ; int weight = map weigher weigh ( key , value ) ; check state ( weight > = 0 , " weights must be non - negative " ) ; value reference < k , v > value reference = map value strength reference value ( this , entry , value , weight ) ; entry set value reference ( value reference ) ; record write ( entry , weight , now ) ; previous notify new value ( value ) ; }


public void start ( ) { registry add listener ( listener ) ; }


the implementation of the stack trace cleaner

public static stack trace cleaner provider get stack trace cleaner provider ( ) { return registry get stack trace cleaner provider ( ) ; }


invoke the given callback on all locally declared fields in the given class

public static void do with local fields ( class < ? > clazz , field callback fc ) { for ( field field : get declared fields ( clazz ) ) { try { fc do with ( field ) ; } catch ( illegal access exception ex ) { throw new illegal state exception ( " not allowed to access field ' " + field get name ( ) + " ' : " + ex ) ; } } }


{ @ inherit doc } the default implementation returns the result of calling { @ link # visit children } on { @ code ctx }

@ override public t visit identifier ( sql base parser identifier context ctx ) { return visit children ( ctx ) ; }


create a new instance of { @ code repartitioned } with the provided key serde

public repartitioned < k , v > with key serde ( final serde < k > key serde ) { return new repartitioned < > ( name , key serde , value serde , number of partitions , partitioner ) ; }


creates a { @ link channel } from the given channel builder and command transport this method can be used to allow { @ link computer launcher } s to create channels not based on io streams

public void set channel ( @ non null channel builder cb , @ non null command transport command transport , @ check for null channel listener listener ) throws i o exception , interrupted exception { for ( channel configurator cc : channel configurator all ( ) ) { cc on channel building ( cb , this ) ; } output stream header stream = cb get header stream ( ) ; if ( header stream = = null ) { logger log ( level warning , " no header stream defined when setting channel for computer { 0 } " + " launch log won ' t be printed " , this ) ; } channel channel = cb build ( command transport ) ; set channel ( channel , header stream , listener ) ; }


returns an exception handler that exits the system this is particularly useful for the main thread , which may start up other , non - daemon threads , but fail to fully initialize the application successfully example usage : public static void main ( string [ ] args ) { thread current thread ( ) set uncaught exception handler ( uncaught exception handlers system exit ( ) ) ; the returned handler logs any exception at severity { @ code severe } and then shuts down the process with an exit status of 1 , indicating abnormal termination

public static uncaught exception handler system exit ( ) { return new exiter ( runtime get runtime ( ) ) ; }


the instance of the discovered extension

public t get instance ( ) { return instance ; }


returns true iff < code > o < code > is a byte writable with the same value

public boolean equals ( object o ) { if ( ! ( o instanceof byte writable ) ) { return false ; } byte writable other = ( byte writable ) o ; return this value = = other value ; }


this test tests slice direct selective stream reader for the case where all elements to read are empty strings the output block should be a valid variable width block with an empty slice it is to simulate a problem seen in production the state of slice direct selective stream reader to reproduce the problem is : - data stream : null - present stream : null - length stream : not null - filter : null - output required : true - offsets array : non zeros the test issues two reads , the first one reads a non - empty string and populates non - zero offsets the second one reads the empty string with the above conditions met

public void test empty strings ( ) throws exception { type type = varchar ; list < type > types = immutable list of ( type ) ; list < list < ? > > values = immutable list of ( immutable list of ( " a " , " " ) ) ; for ( orc tester format format : formats ) { if ( ! types stream ( ) all match ( read type - > format supports type ( read type ) ) ) { return ; } for ( compression kind compression : compressions ) { temp file temp file = new temp file ( ) ; write orc columns presto ( temp file get file ( ) , format , compression , optional empty ( ) , types , values , new orc writer stats ( ) ) ; orc predicate orc predicate = create orc predicate ( types , values , dwrf , false ) ; map < integer , type > included columns = int stream range ( 0 , types size ( ) ) boxed ( ) collect ( to immutable map ( function identity ( ) , types : : get ) ) ; list < integer > output columns = int stream range ( 0 , types size ( ) ) boxed ( ) collect ( to immutable list ( ) ) ; orc aggregated memory context system memory usage = new testing hive orc aggregated memory context ( ) ; try ( orc selective record reader record reader = create custom orc selective record reader ( temp file get file ( ) , format get orc encoding ( ) , orc predicate , types , 1 , immutable map of ( ) , immutable list of ( ) , immutable map of ( ) , orc tester orc reader settings builder ( ) build ( ) get required subfields ( ) , immutable map of ( ) , included columns , output columns , false , system memory usage ) ) { assert equals ( record reader get reader position ( ) , 0 ) ; assert equals ( record reader get file position ( ) , 0 ) ; selective stream reader stream reader = record reader get stream readers ( ) [ 0 ] ; / / read the first non - empty element do not call stream reader get block ( ) to preserve the offsets array in slice direct selective stream reader int batch size = min ( record reader prepare next batch ( ) , 1 ) ; int [ ] positions = int stream range ( 0 , batch size ) to array ( ) ; stream reader read ( 0 , positions , batch size ) ; record reader batch read ( batch size ) ; / / read the second element : an empty string set the data stream in slice direct selective stream reader to null to simulate the conditions causing the problem ( ( slice selective stream reader ) stream reader ) reset data stream ( ) ; batch size = min ( record reader prepare next batch ( ) , 1 ) ; positions = int stream range ( 0 , batch size ) to array ( ) ; stream reader read ( 0 , positions , batch size ) ; record reader batch read ( batch size ) ; block block = stream reader get block ( positions , batch size ) ; list < ? > expected values = immutable list of ( " " ) ; assert block equals ( type , block , expected values , 0 ) ; assert equals ( record reader get reader position ( ) , 1 ) ; assert equals ( record reader get file position ( ) , 1 ) ; } } } }


given a partition of the graph into sets of nodes , returns the image of this graph under the function which maps each node to the partition - set in which it appears the labels of the new graph are the ( immutable ) sets of the partition , and the edges of the new graph are the edges of the original graph , mapped via the same function note : the resulting graph may contain self - edges if these are not wanted , call < code > remove self edges ( ) < code > > on the result interesting special case : if the partition is the set of strongly - connected components , the result of this function is the strong - component graph

public digraph < set < node < t > > > create image under partition ( collection < set < node < t > > > partition ) { / / build mapping function : each node label is mapped to its equiv class : map < t , set < node < t > > > label to image = new hash map < > ( ) ; for ( set < node < t > > set : partition ) { / / it ' s important to use immutable sets of node labels when sets are keys / / in a map ; see immutable set class for explanation set < node < t > > image set = immutable set copy of ( set ) ; for ( node < t > node : image set ) { label to image put ( node get label ( ) , image set ) ; } } if ( label to image size ( ) ! = get node count ( ) ) { throw new illegal argument exception ( " create image under partition ( ) : argument is not a partition " ) ; } return create image under mapping ( label to image ) ; }


this is the main interface for reading values from the memory state if there is no registered memory bank for the desired address space , or if there is some other error , an exception is thrown

public final long get value ( address space spc , long off , int size ) { if ( spc is constant space ( ) ) { return off ; } byte [ ] bytes = new byte [ size ] ; get chunk ( bytes , spc , off , size , false ) ; return utils bytes to long ( bytes , size , language is big endian ( ) ) ; }


return a provider for the specified bean , allowing for lazy on - demand retrieval of instances , including availability and uniqueness options

< t > object provider < t > get bean provider ( class < t > required type , boolean allow eager init ) ;


shift the bits logically { @ code n } positions right this implements an unsigned shift

public masked long shift right logical ( long n ) { if ( n = = 0 ) { return this ; } / / zeros , not unknowns , fill in the left long atleft = long min value > > ( n - 1 ) ; return from mask and value ( ( this msk > > > n ) | atleft , this val > > > n ) ; }


advances the timer and evicts entries that have expired

public void advance ( long current time nanos ) { long previous time nanos = nanos ; try { nanos = current time nanos ; for ( int i = 0 ; i < shift length ; i + + ) { long previous ticks = ( previous time nanos > > > shift [ i ] ) ; long current ticks = ( current time nanos > > > shift [ i ] ) ; if ( ( current ticks - previous ticks ) < = 0l ) { break ; } expire ( i , previous ticks , current ticks ) ; } } catch ( throwable t ) { nanos = previous time nanos ; throw t ; } }


remove the range indices if this range is found in existing ranges , the existing ranges are shrunk if range is of 0 length , doesn ' t do anything

synchronized void remove ( range range ) { if ( range is empty ( ) ) { return ; } long start index = range get start index ( ) ; long end index = range get end index ( ) ; / / make sure that there are no overlapping ranges sorted set < range > head set = ranges head set ( range ) ; if ( head set size ( ) > 0 ) { range previous range = head set last ( ) ; log debug ( " previous range " + previous range ) ; if ( start index < previous range get end index ( ) ) { / / previous range overlaps this range / / narrow down the previous range if ( ranges remove ( previous range ) ) { indices count - = previous range get length ( ) ; log debug ( " removed previous range " + previous range ) ; } add ( previous range get start index ( ) , start index ) ; if ( end index < = previous range get end index ( ) ) { add ( end index , previous range get end index ( ) ) ; } } } iterator < range > tail set it = ranges tail set ( range ) iterator ( ) ; while ( tail set it has next ( ) ) { range next range = tail set it next ( ) ; log debug ( " next range " + next range + " start index : " + start index + " end index : " + end index ) ; if ( end index > next range get start index ( ) ) { / / next range overlaps this range / / narrow down the next range tail set it remove ( ) ; indices count - = next range get length ( ) ; if ( end index < next range get end index ( ) ) { add ( end index , next range get end index ( ) ) ; break ; } } else { break ; } } }


adds an accumulator by prepending the given name with a random string

public < v , a extends serializable > void add accumulator ( string name , accumulator < v , a > accumulator ) { get runtime context ( ) add accumulator ( id + separator + name , accumulator ) ; }


fades out the current track , unless it has already been silenced

protected void silence ( ) { play ( null ) ; }


get the named attribute hint based on either an ordinal or label name use of the ordinal takes precedence

attribute get attribute hint ( int ordinal , string name , string attr name ) { list < attribute > list = ordinal attribute map get ( ordinal ) ; if ( list ! = null ) { attribute attr = get attribute ( list , attr name ) ; if ( attr ! = null ) { return attr ; } } list = name attribute map get ( name ) ; if ( list ! = null ) { attribute attr = get attribute ( list , attr name ) ; if ( attr ! = null ) { return attr ; } } return null ; }


checks to see if this { @ link cookie } can only be accessed via http if this returns true , the { @ link cookie } cannot be accessed through client side script - but only if the browser supports it for more information , please look < a href = " https : owasp orgwww - community http only " > here


reads a long integer value ( 6 4bit , 8 bytes ) from the given position , in little endian byte order this method ' s speed depends on the system ' s native byte order , and it is possibly slower than { @ link # get long ( int ) } for most cases ( such as transient storage in memory or serialization for io and network ) , it suffices to know that the byte order in which the value is written is the same as the one in which it is read , and { @ link # get long ( int ) } is the preferable choice

public final long get long little endian ( int index ) { if ( little endian ) { return get long ( index ) ; } else { return long reverse bytes ( get long ( index ) ) ; } }


specify the jdbc driver implementation class to use an instance of this driver class will be created and held within the simple driver data source

public void set driver class ( class < ? extends driver > driver class ) { this driver = bean utils instantiate class ( driver class ) ; }


created in response to issue 14 : http : code google compgoogle - gsonissuesdetail ? id = 14

public void test null object fields deserialization ( ) throws exception { string json = " { \ " bag \ " : null } " ; class with objects target = gson from json ( json , class with objects class ) ; assert null ( target bag ) ; }


public float get float item ( ) { return float item ; }


copied from d f s admin java - - creates a connection to data node

public client datanode protocol get data node proxy ( string datanode ) throws i o exception { inet socket address datanode addr = net utils create socket addr ( datanode ) ; / / for datanode proxy the server principal should be dn ' s one get conf ( ) set ( common configuration keys hadoop security service user name key , get conf ( ) get ( d f s config keys dfs datanode kerberos principal key , " " ) ) ; / / create the client client datanode protocol dn protocol = d f s util client create client datanode protocol proxy ( datanode addr , get u g i ( ) , get conf ( ) , net utils get socket factory ( get conf ( ) , client datanode protocol class ) ) ; return dn protocol ; }


crop the image to a circle and resize to the specified widthheight the circle crop will have the same width and height equal to the min - edge of the result image

public static bitmap circle crop ( @ non null bitmap pool pool , @ non null bitmap in bitmap , int dest width , int dest height ) { int dest min edge = math min ( dest width , dest height ) ; float radius = dest min edge / 2f ; int src width = in bitmap get width ( ) ; int src height = in bitmap get height ( ) ; float scale x = dest min edge / ( float ) src width ; float scale y = dest min edge / ( float ) src height ; float max scale = math max ( scale x , scale y ) ; float scaled width = max scale * src width ; float scaled height = max scale * src height ; float left = ( dest min edge - scaled width ) / 2f ; float top = ( dest min edge - scaled height ) / 2f ; rect f dest rect = new rect f ( left , top , left + scaled width , top + scaled height ) ; / / alpha is required for this transformation bitmap to transform = get alpha safe bitmap ( pool , in bitmap ) ; bitmap config out config = get alpha safe config ( in bitmap ) ; bitmap result = pool get ( dest min edge , dest min edge , out config ) ; result set has alpha ( true ) ; bitmap drawable lock lock ( ) ; try { canvas canvas = new canvas ( result ) ; / / draw a circle canvas draw circle ( radius , radius , radius , circle crop shape paint ) ; / / draw the bitmap in the circle canvas draw bitmap ( to transform , null , dest rect , circle crop bitmap paint ) ; clear ( canvas ) ; } finally { bitmap drawable lock unlock ( ) ; } if ( ! to transform equals ( in bitmap ) ) { pool put ( to transform ) ; } return result ; }


public void test list encrypted dir ( ) throws exception { path path a b c = path ( " test list encrypted dir / a / b / c / " ) ; path path a b = path a b c get parent ( ) ; path path a = path a b get parent ( ) ; path nested directory = create test path ( path a b c ) ; assert true ( get file system ( ) mkdirs ( nested directory ) ) ; fs key b = create new file system with s s e c key ( key 4 ) ; fs key b list files ( path a , true ) ; fs key b list files ( path a b , true ) ; fs key b list files ( path a b c , false ) ; configuration conf = this create configuration ( ) ; conf unset ( server side encryption algorithm ) ; conf unset ( server side encryption key ) ; s 3 a contract contract = ( s 3 a contract ) create contract ( conf ) ; contract init ( ) ; file system unencrypted file system = contract get test file system ( ) ; / / unencrypted can access until the final directory unencrypted file system list files ( path a , true ) ; unencrypted file system list files ( path a b , true ) ; unencrypted file system list files ( path a b c , false ) ; }


exit a parse tree produced by { @ link sql base parser # table identifier }

void exit table identifier ( sql base parser table identifier context ctx ) ;


public string raw path ( ) { return raw path ; }


the class loaded by this method means it only should be loaded once in bootstrap classloader , when bootstrap instrumentation active by any plugin

private static void load high priority class ( map < string , byte [ ] > loaded type map , string class name ) throws plugin exception { byte [ ] enhanced instance class file ; try { string class resource name = class name replace all ( " \ \ " , " / " ) + " class " ; input stream resource as stream = agent class loader get default ( ) get resource as stream ( class resource name ) ; if ( resource as stream = = null ) { throw new plugin exception ( " high priority class " + class name + " not found " ) ; } byte array output stream os = new byte array output stream ( ) ; byte [ ] buffer = new byte [ 1024 ] ; int len ; / / read bytes from the input stream and store them in buffer while ( ( len = resource as stream read ( buffer ) ) ! = - 1 ) { / / write bytes from the buffer into output stream os write ( buffer , 0 , len ) ; } enhanced instance class file = os to byte array ( ) ; } catch ( i o exception e ) { throw new plugin exception ( e get message ( ) , e ) ; } loaded type map put ( class name , enhanced instance class file ) ; }


set the user - agent header ' s value ( by adding to the default header map )

public api client set user agent ( string user agent ) { user agent = user agent ; add default header ( " user - agent " , user agent ) ; return this ; }


returns a new ordering which sorts iterables by comparing corresponding elements pairwise until a nonzero result is found ; imposes " dictionary order " if the end of one iterable is reached , but not the other , the shorter iterable is considered to be less than the longer one for example , a lexicographical natural ordering over integers considers { @ code [ ] < [ 1 ] < [ 1 , 1 ] < [ 1 , 2 ] < [ 2 ] } note that { @ code ordering lexicographical ( ) reverse ( ) } is not equivalent to { @ code ordering reverse ( ) lexicographical ( ) } ( consider how each would order { @ code [ 1 ] } and { @ code [ 1 , 1 ] } ) < b > java 8 users : < b > use { @ link comparators # lexicographical ( comparator ) } instead

public < s extends t > ordering < iterable < s > > lexicographical ( ) { / * * note that technically the returned ordering should be capable of * handling not just { @ code iterable < s > } instances , but also any { @ code * iterable < ? extends s > } however , the need for this comes up so rarely * that it doesn ' t justify making everyone else deal with the very ugly * wildcard * / return new lexicographical ordering < s > ( this ) ; }


tests the annotated element is annotated all specified annotations or not

static boolean is all annotation present ( class < ? > type , class < ? extends annotation > annotation types ) { return is annotation present ( type , true , annotation types ) ; }


prepares the open g l state for sprite cache rendering

public void begin ( ) { if ( drawing ) throw new illegal state exception ( " end must be called before begin " ) ; if ( current cache ! = null ) throw new illegal state exception ( " end cache must be called before begin " ) ; render calls = 0 ; combined matrix set ( projection matrix ) mul ( transform matrix ) ; gdx gl 2 0 gl depth mask ( false ) ; if ( custom shader ! = null ) { custom shader bind ( ) ; custom shader set uniform matrix ( " u proj " , projection matrix ) ; custom shader set uniform matrix ( " u trans " , transform matrix ) ; custom shader set uniform matrix ( " u proj trans " , combined matrix ) ; custom shader set uniformi ( " u texture " , 0 ) ; mesh bind ( custom shader ) ; } else { shader bind ( ) ; shader set uniform matrix ( " u projection view matrix " , combined matrix ) ; shader set uniformi ( " u texture " , 0 ) ; mesh bind ( shader ) ; } drawing = true ; }


private path handle inner complete ( upload handle multipart upload id , path file path , map < integer , part handle > handle map ) throws i o exception { check path ( file path ) ; check upload id ( multipart upload id to byte array ( ) ) ; check part handles ( handle map ) ; list < map entry < integer , part handle > > handles = new array list < > ( handle map entry set ( ) ) ; handles sort ( comparator comparing int ( map entry : : get key ) ) ; list < path > part handles = handles stream ( ) map ( pair - > { byte [ ] byte array = pair get value ( ) to byte array ( ) ; return new path ( new string ( byte array , 0 , byte array length , charsets utf 8 ) ) ; } ) collect ( collectors to list ( ) ) ; int count = part handles size ( ) ; / / built up to identify duplicates - if the size of this set is / / below that of the number of parts , then there ' s a duplicate entry set < path > values = new hash set < > ( count ) ; values add all ( part handles ) ; preconditions check argument ( values size ( ) = = count , " duplicate part handles " ) ; byte [ ] upload id byte array = multipart upload id to byte array ( ) ; path collector path = new path ( new string ( upload id byte array , 0 , upload id byte array length , charsets utf 8 ) ) ; boolean empty file = total parts len ( part handles ) = = 0 ; if ( empty file ) { fs create ( file path ) close ( ) ; } else { path file path inside collector = merge paths ( collector path , new path ( path separator + file path get name ( ) ) ) ; fs create ( file path inside collector ) close ( ) ; fs concat ( file path inside collector , part handles to array ( new path [ handles size ( ) ] ) ) ; new internal operations ( ) rename ( fs , file path inside collector , file path , options rename overwrite ) ; } fs delete ( collector path , true ) ; return get path handle ( file path ) ; }


public namenode bean metrics get namenode metrics ( ) { return this nn metrics ; }


one request followed by one response response has cache control headers set such that a caching http proxy ( such as gfe ) can satisfy subsequent requests

public io grpc testing integration messages simple response cacheable unary call ( io grpc testing integration messages simple request request ) { return io grpc stub client calls blocking unary call ( get channel ( ) , get cacheable unary call method ( ) , get call options ( ) , request ) ; }


creates a previous button for the given tabbed pane

private j button create previous button ( final tabbed pane tabbed pane ) { j button browse button = new j button ( msg ( " previous " ) ) ; browse button add action listener ( new action listener ( ) { public void action performed ( action event e ) { tabbed pane previous ( ) ; } } ) ; return browse button ; }


get the current value of the named metric , which may have already been removed from the { @ link org apache kafka common metrics metrics } but will have been captured before it was removed

public static object current metric value ( connect metrics metrics , metric group metric group , string name ) { metric name metric name = metric group metric name ( name ) ; for ( metrics reporter reporter : metrics metrics ( ) reporters ( ) ) { if ( reporter instanceof mock metrics reporter ) { return ( ( mock metrics reporter ) reporter ) current metric value ( metric name ) ; } } return null ; }


actually unregister the specified m bean from the server

protected void do unregister ( object name object name ) { assert state ( this server ! = null , " no m bean server set " ) ; boolean actually unregistered = false ; synchronized ( this registered beans ) { if ( this registered beans remove ( object name ) ) { try { / / m bean might already have been unregistered by an external process if ( this server is registered ( object name ) ) { this server unregister m bean ( object name ) ; actually unregistered = true ; } else { if ( logger is info enabled ( ) ) { logger info ( " could not unregister m bean [ " + object name + " ] as said m bean " + " is not registered ( perhaps already unregistered by an external process ) " ) ; } } } catch ( j m exception ex ) { if ( logger is info enabled ( ) ) { logger info ( " could not unregister m bean [ " + object name + " ] " , ex ) ; } } } } if ( actually unregistered ) { on unregister ( object name ) ; } }


sets the given button ' s tooltip text to match that of the given action

static void set tool tip text ( j button button , docking action if action ) { string tool tip text = get tool tip text ( action ) ; string key binding text = get key binding accelerator text ( button , action get key binding ( ) ) ; if ( key binding text ! = null ) { button set tool tip text ( combing tool tip text with key binding ( tool tip text , key binding text ) ) ; } else { button set tool tip text ( tool tip text ) ; } }


check whether the given iterator contains the given element

public static boolean contains ( @ nullable iterator < ? > iterator , object element ) { if ( iterator ! = null ) { while ( iterator has next ( ) ) { object candidate = iterator next ( ) ; if ( object utils null safe equals ( candidate , element ) ) { return true ; } } } return false ; }


creates a completely random update when the job is null or a random update that is is valid for the given job

public static job update create random ( string job id ) { job update builder update = new job update builder ( job id ) ; if ( random boolean ( ) ) { int groups num = random int between ( 0 , 10 ) ; list < string > groups = new array list < > ( groups num ) ; for ( int i = 0 ; i < groups num ; i + + ) { groups add ( job tests random valid job id ( ) ) ; } update set groups ( groups ) ; } if ( random boolean ( ) ) { update set description ( random alpha of length ( 20 ) ) ; } if ( random boolean ( ) ) { update set detector updates ( create random detector updates ( ) ) ; } if ( random boolean ( ) ) { update set model plot config ( model plot config tests create randomized ( ) ) ; } if ( random boolean ( ) ) { update set analysis limits ( analysis limits tests create randomized ( ) ) ; } if ( random boolean ( ) ) { update set renormalization window days ( random non negative long ( ) ) ; } if ( random boolean ( ) ) { update set background persist interval ( time value time value hours ( random int between ( 1 , 24 ) ) ) ; } if ( random boolean ( ) ) { update set model snapshot retention days ( random non negative long ( ) ) ; } if ( random boolean ( ) ) { update set daily model snapshot retention after days ( random non negative long ( ) ) ; } if ( random boolean ( ) ) { update set results retention days ( random non negative long ( ) ) ; } if ( random boolean ( ) ) { update set categorization filters ( arrays as list ( generate random string array ( 10 , 10 , false ) ) ) ; } if ( random boolean ( ) ) { update set custom settings ( collections singleton map ( random alpha of length ( 10 ) , random alpha of length ( 10 ) ) ) ; } if ( random boolean ( ) ) { update set allow lazy open ( random boolean ( ) ) ; } return update build ( ) ; }


get number of part uploads under given path

public static int count uploads at ( s 3 a file system fs , path path ) throws i o exception { string key = fs path to key ( path ) ; multipart utils upload iterator uploads = fs list uploads ( key ) ; int count = 0 ; while ( uploads has next ( ) ) { multipart upload upload = uploads next ( ) ; count + + ; } return count ; }


tests that when multiple conditions match but one condition is more specialized than the others , it is chosen and there is no error

public void multiple matches unambiguous ( ) throws exception { scratch file ( " conditions / build " , " config setting ( " , " name = ' a ' , " , " values = { ' define ' : ' a = 1 ' } ) " , " config setting ( " , " name = ' b ' , " , " values = { ' compilation mode ' : ' opt ' } ) " , " config setting ( " , " name = ' c ' , " , " values = { ' test arg ' : ' baz ' } ) " , " config setting ( " , " name = ' b a c ' , " , / / named to come alphabetically after a and b but before c " values = { ' define ' : ' a = 1 ' , ' test arg ' : ' baz ' , ' compilation mode ' : ' opt ' } ) " ) ; scratch file ( " java / a / build " , " java binary ( " , " name = ' binary ' , " , " srcs = [ ' binary java ' ] , " , " deps = select ( { " , " ' / / conditions : a ' : [ ' : a ' ] , " , " ' / / conditions : b ' : [ ' : b ' ] , " , " ' / / conditions : c ' : [ ' : c ' ] , " , " ' / / conditions : b a c ' : [ ' : b a c ' ] , " , " } ) ) " , " java library ( " , " name = ' a ' , " , " srcs = [ ' a java ' ] ) " , " java library ( " , " name = ' b ' , " , " srcs = [ ' b java ' ] ) " , " java library ( " , " name = ' c ' , " , " srcs = [ ' c java ' ] ) " , " java library ( " , " name = ' b a c ' , " , " srcs = [ ' b a c java ' ] ) " ) ; check rule ( " / / java / a : binary " , immutable list of ( " - - define " , " a = 1 " , " - - compilation mode " , " opt " , " - - test arg " , " baz " ) , / * expected : * / immutable list of ( " bin java / a / libb a c jar " ) , / * not expected : * / immutable list of ( " bin java / a / liba jar " , " bin java / a / libb jar " , " bin java / a / libc jar " ) ) ; }


given an array of weights , find the index with the highest weight

private static int find highest weight index ( double [ ] weights ) { double highest weight = double negative infinity ; int highest weight format index = - 1 ; for ( int index = 0 ; index < weights length ; + + index ) { double weight = weights [ index ] ; if ( weight > highest weight ) { highest weight = weight ; highest weight format index = index ; } } return highest weight format index ; }


test whether resource manager passes user - provided conf to user group information class if it reads this ( incorrect ) authentication method enum an exception is thrown

public void test user provided u g i conf ( ) throws exception { thrown expect ( illegal argument exception class ) ; thrown expect message ( " invalid attribute value for " + common configuration keys public hadoop security authentication + " of dummyauth " ) ; configuration dummy conf = new yarn configuration ( ) ; dummy conf set ( common configuration keys public hadoop security authentication , " dummyauth " ) ; resource manager dummy resource manager = new resource manager ( ) ; try { dummy resource manager init ( dummy conf ) ; } finally { dummy resource manager stop ( ) ; } }


get and return the byte size of encoding

private int get current size ( string content ) { try { return content get bytes ( charset for name ( constants encode ) ) length ; } catch ( exception e ) { logger error ( " [ capacity management ] get current size " , e ) ; } return 0 ; }


checks to see if the current resource routine is found in the programs symbol table

private symbol lookup routine ( string resource routine , boolean print script msgs ) { symbol found sym = null ; / / get the symbols that match the current resource routine symbol iterator symbols = current program get symbol table ( ) get symbols ( resource routine ) ; while ( symbols has next ( ) ) { / / if a match is found get the function at the address of the found symbol found sym = symbols next ( ) ; function function at = current program get function manager ( ) get function at ( found sym get address ( ) ) ; if ( function at ! = null ) { return found sym ; } } if ( found sym ! = null & & print script msgs ) { println ( " references to the " + resource routine + " routine : " ) ; } return found sym ; }


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 0 : / / success return success ; default : return null ; } }


returns a description of the specified { @ code topology }

public synchronized topology description describe ( ) { return internal topology builder describe ( ) ; }


public array list < entry > process ( file [ ] files , file output root ) throws exception { if ( output root = = null ) output root = new file ( " " ) ; output files clear ( ) ; linked hash map < file , array list < entry > > dir to entries = new linked hash map ( ) ; process ( files , output root , output root , dir to entries , 0 ) ; array list < entry > all entries = new array list ( ) ; for ( java util map entry < file , array list < entry > > map entry : dir to entries entry set ( ) ) { array list < entry > dir entries = map entry get value ( ) ; if ( comparator ! = null ) collections sort ( dir entries , entry comparator ) ; file input dir = map entry get key ( ) ; file new output dir = null ; if ( flatten output ) new output dir = output root ; else if ( ! dir entries is empty ( ) ) / / new output dir = dir entries get ( 0 ) output dir ; string output name = input dir get name ( ) ; if ( output suffix ! = null ) output name = output name replace all ( " ( * ) \ \ * " , " $ 1 " ) + output suffix ; entry entry = new entry ( ) ; entry input file = map entry get key ( ) ; entry output dir = new output dir ; if ( new output dir ! = null ) entry output file = new output dir length ( ) = = 0 ? new file ( output name ) : new file ( new output dir , output name ) ; try { process dir ( entry , dir entries ) ; } catch ( exception ex ) { throw new exception ( " error processing directory : " + entry input file get absolute path ( ) , ex ) ; } all entries add all ( dir entries ) ; } if ( comparator ! = null ) collections sort ( all entries , entry comparator ) ; for ( entry entry : all entries ) { try { process file ( entry ) ; } catch ( exception ex ) { throw new exception ( " error processing file : " + entry input file get absolute path ( ) , ex ) ; } } return output files ; }


public acknowledged response put script ( put stored script request put stored script request , request options options ) throws i o exception { return perform request and parse entity ( put stored script request , request converters : : put script , options , acknowledged response : : from x content , empty set ( ) ) ; }


returns the next resource in the enumeration

public object next element ( ) { url ret = this next resource ; if ( ret = = null ) { throw new no such element exception ( ) ; } find next resource ( ) ; return ret ; }


the forecast expiration in seconds ( duration added to start time )

public long get expires in ( ) { return expires in ; }


casts the given value to a 32 bit integer , if it can be safely done if the cast would change the numeric value , this method raises an exception this method is a protection in places where one expects to be able to safely case , but where unexpected situations could make the cast unsafe and would cause hidden problems that are hard to track down

public static int checked down cast ( long value ) { int down cast = ( int ) value ; if ( down cast ! = value ) { throw new illegal argument exception ( " cannot downcast long value " + value + " to integer " ) ; } return down cast ; }


public boolean is empty ( ) { return fifo queue is empty ( ) & & head record = = null ; }


public abstract numeric type get numeric type ( ) ;


get the request object of the underlying rpc protocol , e g http servlet request

public object get request ( ) { return request ; }


public index request op type ( op type op type ) { if ( op type ! = op type create & & op type ! = op type index ) { throw new illegal argument exception ( " op type must be ' create ' or ' index ' , found : [ " + op type + " ] " ) ; } this op type = op type ; return this ; }


returns an array with { @ link # count ( ) } { @ link native datagram packet } s filled

native datagram packet [ ] packets ( ) { return packets ; }


public cancellable split async ( org elasticsearch action admin indices shrink resize request resize request , request options options , action listener < org elasticsearch action admin indices shrink resize response > listener ) { return rest high level client perform request async and parse entity ( resize request , indices request converters : : split , options , org elasticsearch action admin indices shrink resize response : : from x content , listener , empty set ( ) ) ; }


gets a headless analyzer instance , with the assumption that the application has already been initialized if this is called before the application has been initialized , it will initialize the application with no logging

public static headless analyzer get instance ( ) throws i o exception { / / prevent more than one headless analyzer from being instantiated too much about it / / messes with global system settings , so under the current design of ghidra , allowing / / more than one to exist could result in unpredictable behavior if ( instance ! = null ) { return instance ; } / / initialize application ( if necessary ) if ( ! application is initialized ( ) ) { application configuration configuration = new headless ghidra application configuration ( ) ; configuration set initialize logging ( false ) ; msg set error logger ( new headless error logger ( null ) ) ; application initialize application ( get application layout ( ) , configuration ) ; } / / instantiate and return singleton headless analyzer instance = new headless analyzer ( ) ; return instance ; }


create { @ link annotation type mappings } for the specified annotation type

static annotation type mappings for annotation type ( class < ? extends annotation > annotation type , annotation filter annotation filter ) { return for annotation type ( annotation type , repeatable containers standard repeatables ( ) , annotation filter ) ; }


child class implements this method to realize { @ code array ( ) }

abstract short [ ] protected array ( ) ;


accept the given class loader as cache - safe , even if its classes would not qualify as cache - safe in this cached introspection results class this configuration method is only relevant in scenarios where the spring classes reside in a ' common ' class loader ( e g the system class loader ) whose lifecycle is not coupled to the application in such a scenario , cached introspection results would by default not cache any of the application ' s classes , since they would create a leak in the common class loader any { @ code accept class loader } call at application startup should be paired with a { @ link # clear class loader } call at application shutdown

public static void accept class loader ( @ nullable class loader class loader ) { if ( class loader ! = null ) { accepted class loaders add ( class loader ) ; } }


get a query string which removes the passed parameter

public static string remove query params ( http servlet request http request , string parameter name ) { return get u r l encoded query string ( http request , parameter name ) ; }


checks if an item ' s range top is above the bottom range if true , it means the item is inside range

private static boolean is above viewport bottom ( rect visible rect , incremental module item item ) { return ! is below viewport bottom ( visible rect , item ) ; }


convert the given object to string with each line indented by 4 spaces ( except the first line )

private string to indented string ( object o ) { if ( o = = null ) { return " null " ; } return o to string ( ) replace ( " \ n " , " \ n " ) ; }


open a { @ code java io reader } for the specified resource , using the specified { @ link # get charset ( ) charset } or { @ linkplain # get encoding ( ) encoding } ( if any )

public reader get reader ( ) throws i o exception { if ( this charset ! = null ) { return new input stream reader ( this resource get input stream ( ) , this charset ) ; } else if ( this encoding ! = null ) { return new input stream reader ( this resource get input stream ( ) , this encoding ) ; } else { return new input stream reader ( this resource get input stream ( ) ) ; } }


return all beans of the given type or subtypes , also picking up beans defined in ancestor bean factories if the current bean factory is a hierarchical bean factory the returned map will only contain beans of this type does consider objects created by factory beans , which means that factory beans will get initialized if the object created by the factory bean doesn ' t match , the raw factory bean itself will be matched against the type < b > note : beans of the same name will take precedence at the ' lowest ' factory level , i e such beans will be returned from the lowest factory that they are being found in , hiding corresponding beans in ancestor factories < b > this feature allows for ' replacing ' beans by explicitly choosing the same bean name in a child factory ; the bean in the ancestor factory won ' t be visible then , not even for by - type lookups

public static < t > map < string , t > beans of type including ancestors ( listable bean factory lbf , class < t > type ) throws beans exception { assert not null ( lbf , " listable bean factory must not be null " ) ; map < string , t > result = new linked hash map < > ( 4 ) ; result put all ( lbf get beans of type ( type ) ) ; if ( lbf instanceof hierarchical bean factory ) { hierarchical bean factory hbf = ( hierarchical bean factory ) lbf ; if ( hbf get parent bean factory ( ) instanceof listable bean factory ) { map < string , t > parent result = beans of type including ancestors ( ( listable bean factory ) hbf get parent bean factory ( ) , type ) ; parent result for each ( ( bean name , bean instance ) - > { if ( ! result contains key ( bean name ) & & ! hbf contains local bean ( bean name ) ) { result put ( bean name , bean instance ) ; } } ) ; } } return result ; }


this public interface is provided specially for huawei mrs list the statuses of the filesdirectories in the given path if the path is a directory when recursive is true , iterator all objects in the given path and its sub directories

public file status [ ] list status ( final path f , final boolean recursive ) throws file not found exception , i o exception { long start time = system current time millis ( ) ; long thread id = thread current thread ( ) get id ( ) ; try { file status [ ] statuses = o b s common utils inner list status ( this , f , recursive ) ; long end time = system current time millis ( ) ; log debug ( " list status for path : { } , thread : { } , time used in milli sec : { } " , f , thread id , end time - start time ) ; return statuses ; } catch ( obs exception e ) { throw o b s common utils translate exception ( " list status with recursive flag [ " + ( recursive ? " true ] " : " false ] " ) , f , e ) ; } }


returns a { @ link set } of all the results