public static void main ( string [ ] args ) { / / an executor that provides methods to manage termination and methods that can / / produce a future for tracking progress of one or more asynchronous tasks executor service executor = null ; try { / / create a message queue object var msg queue = new message queue ( ) ; logger info ( " submitting task generators and service executor threads " ) ; / / create three task generator threads each of them will submit different number of jobs final var task runnable 1 = new task generator ( msg queue , 5 ) ; final var task runnable 2 = new task generator ( msg queue , 1 ) ; final var task runnable 3 = new task generator ( msg queue , 2 ) ; / / create e service which should process the submitted jobs final var srv runnable = new service executor ( msg queue ) ; / / create a thread pool of 2 threads and / / submit all runnable task for execution to executor executor = executors new fixed thread pool ( 2 ) ; executor submit ( task runnable 1 ) ; executor submit ( task runnable 2 ) ; executor submit ( task runnable 3 ) ; / / submitting service executor thread to the executor service executor submit ( srv runnable ) ; / / initiates an orderly shutdown logger info ( " initiating shutdown " + " executor will shutdown only after all the threads are completed " ) ; executor shutdown ( ) ; / / wait for shutdown time seconds for all the threads to complete / / their tasks and then shut down the executor and then exit if ( ! executor await termination ( shutdown time , time unit seconds ) ) { logger info ( " executor was shut down and exiting " ) ; executor shutdown now ( ) ; } } catch ( exception e ) { logger error ( e get message ( ) ) ; } }


return the configured destination resolver

public destination resolver < d > get destination resolver ( ) { return this destination resolver ; }


protected void place 0 ( section added to , int offset ) { / / encode the data and note the size try { encoded = encode ( added to get file ( ) , null , null , null , false ) ; set write size ( encoded length ) ; } catch ( runtime exception ex ) { throw exception with context with context ( ex , " while placing debug info for " + ref to human ( ) ) ; } }


calculate the ratio of time spent in the specified state

public double duration ratio ( state ratio state , long now ) { if ( state = = null ) { return 0 0d ; } long duration current = now - start time ; / / since last state change long duration desired = ratio state = = state ? duration current : 0l ; switch ( ratio state ) { case unassigned : duration desired + = unassigned total time ms ; break ; case running : duration desired + = running total time ms ; break ; case paused : duration desired + = paused total time ms ; break ; case failed : duration desired + = failed total time ms ; break ; case destroyed : duration desired + = destroyed total time ms ; break ; } long total = duration current + unassigned total time ms + running total time ms + paused total time ms + failed total time ms + destroyed total time ms ; return total = = 0 0d ? 0 0d : ( double ) duration desired / total ; }


put faketest - query - paramters to test the collection format in query parameters

default response entity < void > test query parameter collection format ( @ not null @ api param ( value = " " , required = true ) @ valid @ request param ( value = " pipe " , required = true ) list < string > pipe , @ not null @ api param ( value = " " , required = true ) @ valid @ request param ( value = " ioutil " , required = true ) list < string > ioutil , @ not null @ api param ( value = " " , required = true ) @ valid @ request param ( value = " http " , required = true ) list < string > http , @ not null @ api param ( value = " " , required = true ) @ valid @ request param ( value = " url " , required = true ) list < string > url , @ not null @ api param ( value = " " , required = true ) @ valid @ request param ( value = " context " , required = true ) list < string > context ) { return new response entity < > ( http status not implemented ) ; }


sets the < code > message < code > property

public model api response message ( string message ) { this message = message ; return this ; }


add a link regex to the config for the specified mount table

public static void add link regex ( configuration conf , final string mount table name , final string src regex , final string target str , final string interceptor settings ) { string prefix = get config view fs prefix ( mount table name ) + " " + constants config viewfs link regex + " " ; if ( ( interceptor settings ! = null ) & & ( ! interceptor settings is empty ( ) ) ) { prefix = prefix + interceptor settings + regex mount point setting srcregex sep ; } string key = prefix + src regex ; conf set ( key , target str ) ; }


performs a { @ link # go forward ( ) } until the given item becomes the current item this is useful if you wish to go forward to a specific item in the list

public void go forward to ( t t ) { while ( ! get current history item ( ) equals ( t ) & & has next ( ) ) { go forward ( ) ; } }


this builds a initial index ordering where the indices are returned in most unbalanced first we need this in order to prevent over allocations on added nodes from one index when the weight parameters for global balance overrule the index balance at an intermediate state for example this can happen if we have 3 nodes and 3 indices with 3 primary and 1 replica shards at the first stage all three nodes hold 2 shard for each index now we add another node and the first index is balanced moving three shards from two of the nodes over to the new node since it has no shards yet and global balance for the node is way below average to re - balance we need to move shards back eventually likely to the nodes we relocated them from

private string [ ] build weight ordered indices ( ) { final string [ ] indices = allocation routing table ( ) indices routing ( ) keys ( ) to array ( string class ) ; final float [ ] deltas = new float [ indices length ] ; for ( int i = 0 ; i < deltas length ; i + + ) { sorter reset ( indices [ i ] ) ; deltas [ i ] = sorter delta ( ) ; } new intro sorter ( ) { float pivot weight ; @ override protected void swap ( int i , int j ) { final string tmp idx = indices [ i ] ; indices [ i ] = indices [ j ] ; indices [ j ] = tmp idx ; final float tmp delta = deltas [ i ] ; deltas [ i ] = deltas [ j ] ; deltas [ j ] = tmp delta ; } @ override protected int compare ( int i , int j ) { return float compare ( deltas [ j ] , deltas [ i ] ) ; } @ override protected void set pivot ( int i ) { pivot weight = deltas [ i ] ; } @ override protected int compare pivot ( int j ) { return float compare ( deltas [ j ] , pivot weight ) ; } } sort ( 0 , deltas length ) ; return indices ; }


returns the image width if known , else - 1

public int get width ( ) { parse metadata if needed ( ) ; return m width ; }


creates the metric query service scope for this group

protected abstract query scope info create query service metric info ( character filter filter ) ;


private fs permission get permissions ( ls entry sftp file ) { return new fs permission ( ( short ) sftp file get attrs ( ) get permissions ( ) ) ; }


this test will use the regular mechanism ( delegate execution get process engine ( ) get runtime service ( ) ) to obtain the { @ link runtime service } to start a new process

public void test use runtime service not injected in service task ( ) { runtime service start process instance by key ( " start process from delegate " ) ; / / starting the process should lead to two processes being started , / / the other one started from the java delegate in the service task list < process instance > process instances = runtime service create process instance query ( ) list ( ) ; assert that ( process instances ) has size ( 2 ) ; boolean start process from delegate found = false ; boolean one task process found = false ; for ( process instance process instance : process instances ) { process definition process definition = repository service get process definition ( process instance get process definition id ( ) ) ; if ( process definition get key ( ) equals ( " start process from delegate " ) ) { start process from delegate found = true ; } else if ( process definition get key ( ) equals ( " one task process " ) ) { one task process found = true ; } } assert that ( start process from delegate found ) is true ( ) ; assert that ( one task process found ) is true ( ) ; }


add the record from the given source split

public void add ( source split split , e record ) { add ( split split id ( ) , record ) ; }


returns the actor for this cell , or null

public @ null t get actor ( ) { return ( t ) actor ; }


encrypt the field value with targeted algorithm

protected object encrypt value ( string algorithm , object field value ) { if ( algorithm ! = null & & field value ! = null ) { if ( lite pal support aes equals ignore case ( algorithm ) ) { field value = cipher util aes encrypt ( ( string ) field value ) ; } else if ( lite pal support md5 equals ignore case ( algorithm ) ) { field value = cipher util md 5 encrypt ( ( string ) field value ) ; } } return field value ; }


fallback if none of the other { @ code decorrelate rel } methods match

public frame decorrelate rel ( rel node rel ) { rel node new rel = rel copy ( rel get trait set ( ) , rel get inputs ( ) ) ; if ( rel get inputs ( ) size ( ) > 0 ) { list < rel node > old inputs = rel get inputs ( ) ; list < rel node > new inputs = new array list < > ( ) ; for ( int i = 0 ; i < old inputs size ( ) ; + + i ) { final frame frame = get invoke ( old inputs get ( i ) , rel ) ; if ( frame = = null | | ! frame cor def outputs is empty ( ) ) { / / if input is not rewritten , or if it produces correlated / / variables , terminate rewrite return null ; } new inputs add ( frame r ) ; new rel replace input ( i , frame r ) ; } if ( ! util equal shallow ( old inputs , new inputs ) ) { new rel = rel copy ( rel get trait set ( ) , new inputs ) ; } } / / the output position should not change since there are no cor vars / / coming from below return register ( rel , new rel , identity map ( rel get row type ( ) get field count ( ) ) , immutable sorted map of ( ) ) ; }


public base configuration properties loader get loader ( final resource resource , final string name ) { val filename = string utils default string ( resource get filename ( ) ) to lower case ( ) ; if ( filename ends with ( " properties " ) ) { return new simple configuration properties loader ( this configuration cipher executor , name , resource ) ; } if ( filename ends with ( " groovy " ) ) { return new groovy configuration properties loader ( this configuration cipher executor , name , get application profiles ( environment ) , resource ) ; } if ( filename ends with ( " yaml " ) | | filename ends with ( " yml " ) ) { return new yaml configuration properties loader ( this configuration cipher executor , name , resource ) ; } throw new illegal argument exception ( " unable to determine configuration loader for " + resource ) ; }


invoked when a processing - time timer fires

public void on processing time ( internal timer < row data , void namespace > timer ) throws exception { if ( state cleaning enabled ) { row data key = timer get key ( ) ; long timestamp = timer get timestamp ( ) ; reuse timer row data set long ( 2 , timestamp ) ; reuse timer row data set field ( 3 , key ) ; udf input type serializer serialize ( reuse timer row data , baos wrapper ) ; python function runner process ( baos to byte array ( ) ) ; baos reset ( ) ; element count + + ; } }


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


one of the block pools has successfully connected to its nn this initializes the local storage for that block pool , checks consistency of the nn ' s cluster id , etc if this is the first block pool to register , this also initializes the datanode - scoped storage

void init block pool ( b p offer service bpos ) throws i o exception { namespace info ns info = bpos get namespace info ( ) ; if ( ns info = = null ) { throw new i o exception ( " namespace info not found : block pool " + bpos + " should have retrieved namespace info before init block pool " ) ; } set cluster id ( ns info cluster i d , ns info get block pool i d ( ) ) ; / / register the new block pool with the bp manager block pool manager add block pool ( bpos ) ; / / in the case that this is the first block pool to connect , initialize / / the dataset , block scanners , etc init storage ( ns info ) ; try { data add block pool ( ns info get block pool i d ( ) , get conf ( ) ) ; } catch ( add block pool exception e ) { handle add block pool error ( e ) ; } / / hdfs - 14993 : check disk after add the block pool info check disk error ( ) ; block scanner enable block pool id ( bpos get block pool id ( ) ) ; init directory scanner ( get conf ( ) ) ; init disk balancer ( data , get conf ( ) ) ; }


shift buckets by random offset between [ 2 interval ] from setup we have 1 doc per values from 1 numdocs special care needs to be taken for expecations on counts in first and last bucket

public void test single valued field with random offset ( ) throws exception { int offset = random int between ( 2 , interval ) ; search response response = client ( ) prepare search ( " idx " ) add aggregation ( histogram ( " histo " ) field ( single valued field name ) interval ( interval ) offset ( offset ) ) get ( ) ; assert search response ( response ) ; / / shifting by offset > 2 creates new extra bucket [ 0 , offset - 1 ] / / if offset is > = number of values in original last bucket , that effect is canceled int expected number of buckets = ( offset > = ( num docs % interval + 1 ) ) ? num value buckets : num value buckets + 1 ; histogram histo = response get aggregations ( ) get ( " histo " ) ; assert that ( histo , not null value ( ) ) ; assert that ( histo get name ( ) , equal to ( " histo " ) ) ; assert that ( histo get buckets ( ) size ( ) , equal to ( expected number of buckets ) ) ; int docs counted = 0 ; for ( int i = 0 ; i < expected number of buckets ; + + i ) { histogram bucket bucket = histo get buckets ( ) get ( i ) ; assert that ( bucket , not null value ( ) ) ; assert that ( ( ( number ) bucket get key ( ) ) long value ( ) , equal to ( ( long ) ( ( i - 1 ) * interval + offset ) ) ) ; if ( i = = 0 ) { / / first bucket long expected first bucket count = offset - 1 ; assert that ( bucket get doc count ( ) , equal to ( expected first bucket count ) ) ; docs counted + = expected first bucket count ; } else if ( i < expected number of buckets - 1 ) { assert that ( bucket get doc count ( ) , equal to ( ( long ) interval ) ) ; docs counted + = interval ; } else { assert that ( bucket get doc count ( ) , equal to ( ( long ) num docs - docs counted ) ) ; } } }


moves all the actions associated with the old placeholder into the new placeholder

private void move actions ( component placeholder old placeholder , component placeholder new placeholder ) { if ( new placeholder = = old placeholder ) { return ; } iterator < docking action if > it = old placeholder get actions ( ) ; while ( it has next ( ) ) { docking action if action = it next ( ) ; new placeholder add action ( action ) ; } }


makes sure that the given info collection has a { @ link cc toolchain provider } ( gives an error otherwise ) , and returns a reference to that { @ link cc toolchain provider } the method never returns { @ code null } , even if there is no toolchain

public static cc toolchain provider get toolchain ( rule context rule context , transitive info collection dep ) { label toolchain type = get toolchain type from rule class ( rule context ) ; return get toolchain ( rule context , dep , toolchain type ) ; }


override this method so that we can record which alternative was taken at each decision point for non - left recursive rules , it ' s simple set decision states that set outer alt num in context indicates which decision states should set the outer alternative number left recursive rules are much more complicated to deal with : there is typically a decision for the primary alternatives and a decision to choose between the recursive operator alternatives for example , the following left recursive rule has two primary and 2 recursive alternatives e : e ' ' e | ' - ' int | e ' + ' e | id ; antlr rewrites that rule to be e [ int precedence ] : ( ' - ' int | id ) ( { } ? ' ' e [ 5 ] | { } ? ' + ' e [ 3 ] ) ; so , there are two decisions associated with picking the outermost alt this complicates our tracking significantly the outermost alternative number is a function of the decision ( atn state ) within a left recursive rule and the predicted alternative coming back from adaptive predict ( ) we use state to alts map as a cache to avoid expensive calls to get recursive op alts ( )

protected int visit decision state ( decision state p ) { int predicted alt = super visit decision state ( p ) ; if ( p get number of transitions ( ) > 1 ) { / / system out println ( " decision " + p decision + " : " + predicted alt ) ; if ( p decision = = this override decision & & this input index ( ) = = this override decision input index ) { override decision root = ( grammar interpreter rule context ) get context ( ) ; } } grammar interpreter rule context ctx = ( grammar interpreter rule context ) ctx ; if ( decision states that set outer alt num in context get ( p state number ) ) { ctx outer alt num = predicted alt ; rule r = g get rule ( p rule index ) ; if ( atn rule to start state [ r index ] is left recursive rule ) { int [ ] alts = state to alts map [ p state number ] ; left recursive rule lr = ( left recursive rule ) g get rule ( p rule index ) ; if ( p get state type ( ) = = a t n state block start ) { if ( alts = = null ) { alts = lr get primary alts ( ) ; state to alts map [ p state number ] = alts ; / / cache it } } else if ( p get state type ( ) = = a t n state star block start ) { if ( alts = = null ) { alts = lr get recursive op alts ( ) ; state to alts map [ p state number ] = alts ; / / cache it } } ctx outer alt num = alts [ predicted alt ] ; } } return predicted alt ; }


constructs a target expression on a node attribute it is satisfied if the specified node attribute has one of the specified values

public static target expression node attribute ( string attribute key , string attribute values ) { return new target expression ( target type node attribute , attribute key , attribute values ) ; }


adds the given { @ link simple cache span } which contains a part of the content

public void add span ( simple cache span span ) { cached spans add ( span ) ; }


produce a j s o n array containing the values of the members of this j s o n object

public j s o n array to j s o n array ( j s o n array names ) throws j s o n exception { if ( names = = null | | names length ( ) = = 0 ) { return null ; } j s o n array ja = new j s o n array ( ) ; for ( int i = 0 ; i < names length ( ) ; i + = 1 ) { ja put ( this opt ( names get string ( i ) ) ) ; } return ja ; }


public set < android library > get all awb librarys ( ) { set < android library > sets = new hash set < > ( ) ; for ( awb bundle awb bundle : get awb bundles ( ) ) { sets add ( awb bundle get android library ( ) ) ; } return sets ; }


whether member key represents a constructor

public final boolean is constructor ( ) { return " < init > " equals ( name ( ) ) ; }


gets all incoming connections of this node this method needs to be overridden by subclasses to return the children

public abstract list < dag connection > get incoming connections ( ) ;


asserts that the specified { @ code value } is not present in { @ code collection }

public static < t > void assert contains ( collection < t > collection , t value ) { for ( t entry : collection ) { if ( entry equals ( value ) ) { return ; } } assert fail ( value + " not present in " + collection ) ; }


returns < code > true < code > iff the current allocation run has not processed all of the in - flight or available shard or store fetches otherwise < code > true < code >

public boolean has pending async fetch ( ) { return has pending async fetch ; }


creates a new builder , which delegates to the given managed channel builder the provided { @ code builder } becomes " owned " by android channel builder the caller should not modify the provided builder and android channel builder may modify it that implies reusing the provided builder to build another channel may result with unexpected configurations that usage should be discouraged

public static android channel builder using builder ( managed channel builder < ? > builder ) { return new android channel builder ( builder ) ; }


bazel maintains a host configuration cache that stores configurations instantiated outside of skyframe we shouldn ' t , in general , instantiate configurations outside of { @ link build configuration value } but in this specific case bazel performance suffers through the skyframe interface and maintaining a local cache is much faster see { @ link skyframe build view } for details one consequence of this is that requesting a config that would be a skyframe cache hit can still produce a distinct instance meaning you can get cases where { @ code config 1 equals ( config 2 ) & & config 1 ! = config 2 } this test checks for such a case : perform three consecutive bazel builds the first builds with default options , producing top - level host config h1 and configured target < host generated file producer , h1 > the second builds with { @ code - - host copt = a = b } , producing host config h2 ( and clearing the top - level host config cache since the host config changed ) the third builds back with default options this once again clears the host config cache , since the host config changed again so that cache creates a new config h3 where h3 equals ( h1 ) and instantiates new configured target < host src 3 cc , h3 > it then requests dependency < host generated file producer , h3 > from skyframe , but the skyframe sky key interner reduces this to the previously seen < host generated file producer , h1 > and returns that instead this produces the expected scenario where the output file ' s config is value - equal but not reference - equal to its generating rule ' s config

public void host config switch ( ) throws exception { scratch file ( " foo / build " , " genrule ( " , " name = ' host generated file producer ' , " , " srcs = [ ] , " , " outs = [ " , " ' host src 1 cc ' , " , " ' host src 2 cc ' , " , " ' host src 3 cc ' , " , " ] , " , " cmd = ' echo hi > $ ( location host src 1 cc ) ; echo hi > $ ( location host src 2 cc ) ; " + " echo hi > $ ( location host src 3 cc ) ' ) " , " " , " cc binary ( name = ' host generated file consumer 1 ' , srcs = [ ' host src 1 cc ' ] ) " , " cc binary ( name = ' host generated file consumer 2 ' , srcs = [ ' host src 2 cc ' ] ) " , " cc binary ( name = ' host generated file consumer 3 ' , srcs = [ ' host src 3 cc ' ] ) " , " " , " genrule ( name = ' gen 1 ' , srcs = [ ] , outs = [ ' gen 1 out ' ] , cmd = ' echo hi > $ @ ' , " , " tools = [ ' : host generated file consumer 1 ' ] ) " , " genrule ( name = ' gen 2 ' , srcs = [ ] , outs = [ ' gen 2 out ' ] , cmd = ' echo hi > $ @ ' , " , " tools = [ ' : host generated file consumer 2 ' ] ) " , " genrule ( name = ' gen 3 ' , srcs = [ ] , outs = [ ' gen 3 out ' ] , cmd = ' echo hi > $ @ ' , " , " tools = [ ' : host generated file consumer 3 ' ] ) " ) ; use configuration ( ) ; update ( " / / foo : gen 1 " ) ; use configuration ( " - - host copt " , " a = b " ) ; update ( " / / foo : gen 2 " ) ; use configuration ( ) ; update ( " / / foo : gen 3 " ) ; configured target and data host src 3 = get configured target and data ( " / / foo : host src 3 cc " , get host configuration ( ) ) ; configured target host generated file consumer 3 = ( ( output file configured target ) host src 3 get configured target ( ) ) get generating rule ( ) ; assert that ( host src 3 get configuration ( ) ) is equal to ( get configuration ( host generated file consumer 3 ) ) ; / / todo ( gregce ) : enable below for bazel tests , which for some reason realize the same instance / / assert that ( host src 3 get configuration ( ) ) / / is not same as ( host generated file consumer 3 get configuration ( ) ) ; }


returns the plugin ' s resource bundle ,

public static resource bundle get resource bundle ( ) { return resource bundle ; }


specify whether parameters should be bound by name

public void set named binding ( boolean named binding ) { this named binding = named binding ; }


removes all blocks containing only g o t os from the control flow although much of this work will be done later when converting from rop to dex , not all simplification cases can be handled there furthermore , any no - op block between the exit block and blocks containing the real return or throw statements must be removed

private void remove empty gotos ( ) { final array list < ssa basic block > blocks = ssa meth get blocks ( ) ; ssa meth for each block depth first ( false , new ssa basic block visitor ( ) { public void visit block ( ssa basic block b , ssa basic block parent ) { array list < ssa insn > insns = b get insns ( ) ; if ( ( insns size ( ) = = 1 ) & & ( insns get ( 0 ) get opcode ( ) = = rops goto ) ) { bit set preds = ( bit set ) b get predecessors ( ) clone ( ) ; for ( int i = preds next set bit ( 0 ) ; i > = 0 ; i = preds next set bit ( i + 1 ) ) { ssa basic block pb = blocks get ( i ) ; pb replace successor ( b get index ( ) , b get primary successor index ( ) ) ; } } } } ) ; }


index of the action in question in the node keyed by { @ link # get action lookup key } should be passed to { @ link com google devtools build lib actions action lookup value # get action }

int get action index ( ) { return action index ; }


full ll prediction termination can we stop looking ahead during atn simulation or is there some uncertainty as to which alternative we will ultimately pick , after consuming more input ? even if there are partial conflicts , we might know that everything is going to resolve to the same minimum alternative that means we can stop since no more lookahead will change that fact on the other hand , there might be multiple conflicts that resolve to different minimums that means we need more look ahead to decide which of those alternatives we should predict the basic idea is to split the set of configurations { @ code c } , into conflicting subsets { @ code ( s , , ctx , ) } and singleton subsets with non - conflicting configurations two configurations conflict if they have identical { @ link a t n config # state } and { @ link a t n config # context } values but different { @ link a t n config # alt } value , e g { @ code ( s , i , ctx , ) } and { @ code ( s , j , ctx , ) } for { @ code i ! = j } reduce these configuration subsets to the set of possible alternatives you can compute the alternative subsets in one pass as follows : { @ code a s , ctx = { i | ( s , i , ctx , ) } } for each configuration in { @ code c } holding { @ code s } and { @ code ctx } fixed or in pseudo - code , for each configuration { @ code c } in { @ code c } : map [ c ] u = c { @ link a t n config # alt alt } # map hashequals uses s and x , not alt and not pred the values in { @ code map } are the set of { @ code a s , ctx } sets if { @ code | a s , ctx | = 1 } then there is no conflict associated with { @ code s } and { @ code ctx } reduce the subsets to singletons by choosing a minimum of each subset if the union of these alternative subsets is a singleton , then no amount of more lookahead will help us we will always pick that alternative if , however , there is more than one alternative , then we are uncertain which alternative to predict and must continue looking for resolution we may or may not discover an ambiguity in the future , even if there are no conflicting subsets this round the biggest sin is to terminate early because it means we ' ve made a decision but were uncertain as to the eventual outcome we haven ' t used enough lookahead on the other hand , announcing a conflict too late is no big deal ; you will still have the conflict it ' s just inefficient it might even look until the end of file no special consideration for semantic predicates is required because predicates are evaluated on - the - fly for full ll prediction , ensuring that no configuration contains a semantic context during the termination check conflicting configs two configurations { @ code ( s , i , x ) } and { @ code ( s , j , x ' ) } , conflict when { @ code i ! = j } but { @ code x = x ' } because we merge all { @ code ( s , i , ) } configurations together , that means that there are at most { @ code n } configurations associated with state { @ code s } for { @ code n } possible alternatives in the decision the merged stacks complicate the comparison of configuration contexts { @ code x } and { @ code x ' } sam checks to see if one is a subset of the other by calling merge and checking to see if the merged result is either { @ code x } or { @ code x ' } if the { @ code x } associated with lowest alternative { @ code i } is the superset , then { @ code i } is the only possible prediction since the others resolve to { @ code min ( i ) } as well however , if { @ code x } is associated with { @ code j > i } then at least one stack configuration for { @ code j } is not in conflict with alternative { @ code i } the algorithm should keep going , looking for more lookahead due to the uncertainty for simplicity , i ' m doing a equality check between { @ code x } and { @ code x ' } that lets the algorithm continue to consume lookahead longer than necessary the reason i like the equality is of course the simplicity but also because that is the test you need to detect the alternatives that are actually in conflict continuestop rule continue if union of resolved alternative sets from non - conflicting and conflicting alternative subsets has more than one alternative we are uncertain about which alternative to predict the complete set of alternatives , { @ code [ i for ( , i , ) ] } , tells us which alternatives are still in the running for the amount of input we ' ve consumed at this point the conflicting sets let us to strip away configurations that won ' t lead to more states because we resolve conflicts to the configuration with a minimum alternate for the conflicting set cases no conflicts and more than 1 alternative in set = & gt ; continue { @ code ( s , 1 , x ) } , { @ code ( s , 2 , x ) } , { @ code ( s , 3 , z ) } , { @ code ( s ' , 1 , y ) } , { @ code ( s ' , 2 , y ) } yields non - conflicting set { @ code { 3 } } u conflicting sets { @ code min ( { 1 , 2 } ) } u { @ code min ( { 1 , 2 } ) } = { @ code { 1 , 3 } } = & gt ; continue { @ code ( s , 1 , x ) } , { @ code ( s , 2 , x ) } , { @ code ( s ' , 1 , y ) } , { @ code ( s ' , 2 , y ) } , { @ code ( s ' ' , 1 , z ) } yields non - conflicting set { @ code { 1 } } u conflicting sets { @ code min ( { 1 , 2 } ) } u { @ code min ( { 1 , 2 } ) } = { @ code { 1 } } = & gt ; stop and predict 1 { @ code ( s , 1 , x ) } , { @ code ( s , 2 , x ) } , { @ code ( s ' , 1 , y ) } , { @ code ( s ' , 2 , y ) } yields conflicting , reduced sets { @ code { 1 } } u { @ code { 1 } } = { @ code { 1 } } = & gt ; stop and predict 1 , can announce ambiguity { @ code { 1 , 2 } } { @ code ( s , 1 , x ) } , { @ code ( s , 2 , x ) } , { @ code ( s ' , 2 , y ) } , { @ code ( s ' , 3 , y ) } yields conflicting , reduced sets { @ code { 1 } } u { @ code { 2 } } = { @ code { 1 , 2 } } = & gt ; continue { @ code ( s , 1 , x ) } , { @ code ( s , 2 , x ) } , { @ code ( s ' , 3 , y ) } , { @ code ( s ' , 4 , y ) } yields conflicting , reduced sets { @ code { 1 } } u { @ code { 3 } } = { @ code { 1 , 3 } } = & gt ; continue exact ambiguity detection if all states report the same conflicting set of alternatives , then we know we have the exact ambiguity set < code > | a i | & gt ; 1 < code > and < code > a i = a j < code > for all i , j in other words , we continue examining lookahead until all { @ code a i } have more than one alternative and all { @ code a i } are the same if { @ code a = { { 1 , 2 } , { 1 , 3 } } } , then regular ll prediction would terminate because the resolved set is { @ code { 1 } } to determine what the real ambiguity is , we have to know whether the ambiguity is between one and two or one and three so we keep going we can only stop prediction when we need exact ambiguity detection when the sets look like { @ code a = { { 1 , 2 } } } or { @ code { { 1 , 2 } , { 1 , 2 } } } , etc

public static int resolves to just one viable alt ( collection < bit set > altsets ) { return get single viable alt ( altsets ) ; }


tests concurrent calls to { @ link blob server # get storage location ( job i d , blob key ) }

public void test server content addressable get storage location concurrent for job ( ) throws exception { test server content addressable get storage location concurrent ( new job i d ( ) ) ; }


get the list of input { @ link path } s for the map - reduce job

public static path [ ] get input paths ( job context context ) { string dirs = context get configuration ( ) get ( input dir , " " ) ; string [ ] list = string utils split ( dirs ) ; path [ ] result = new path [ list length ] ; for ( int i = 0 ; i < list length ; i + + ) { result [ i ] = new path ( string utils un escape string ( list [ i ] ) ) ; } return result ; }


registering a duration adds the success and failure counters

protected final void duration ( statistic op ) { counter ( op get symbol ( ) , op get description ( ) ) ; counter ( op get symbol ( ) + suffix failures , op get description ( ) ) ; }


calculate minimal width required by tabs and set tab mode accordingly

private void remeasure tabs ( ) { if ( prev visibility ! = view visible ) { return ; } if ( layout width = = 0 ) { return ; } final int count = get tab count ( ) ; int content width = 0 ; for ( int i = 0 ; i < count ; i + + ) { final view child = get tab at ( i ) view ; if ( child get visibility ( ) = = view visible ) { / / use tab ' s minimum requested width should actual content be too small content width + = math max ( child get minimum width ( ) , child get measured width ( ) ) ; } } if ( content width > layout width ) { set mode ( tab layout mode scrollable ) ; } else { set mode ( tab layout mode fixed ) ; } }


loads the internal doc id and sequence number of the latest copy for a given uid from the provided reader the result is either null or the live and latest version of the given uid

public static doc id and seq no load doc id and seq no ( index reader reader , term term ) throws i o exception { final per thread i d version and seq no lookup [ ] lookups = get lookup state ( reader , term field ( ) ) ; final list < leaf reader context > leaves = reader leaves ( ) ; / / iterate backwards to optimize for the frequently updated documents / / which are likely to be in the last segments for ( int i = leaves size ( ) - 1 ; i > = 0 ; i - - ) { final leaf reader context leaf = leaves get ( i ) ; final per thread i d version and seq no lookup lookup = lookups [ leaf ord ] ; final doc id and seq no result = lookup lookup seq no ( term bytes ( ) , leaf ) ; if ( result ! = null ) { return result ; } } return null ; }


tries to open an index for the given location this includes reading the segment infos and possible corruption markers if the index can not be opened , an exception is thrown

public static void try open index ( path index location , shard id shard id , node environment shard locker shard locker , logger logger ) throws i o exception , shard lock obtain failed exception { try ( shard lock lock = shard locker lock ( shard id , " open index " , time unit seconds to millis ( 5 ) ) ; directory dir = new simple f s directory ( index location ) ) { fail if corrupted ( dir ) ; segment infos seg info = lucene read segment infos ( dir ) ; logger trace ( " { } loaded segment info [ { } ] " , shard id , seg info ) ; } }


replaces the contents of the table with the given list of extensions

public void set extensions ( set < extension details > extensions ) { table model set model data ( new array list < > ( extensions ) ) ; }


returns the transient { @ link action } s associated with the computer

public list < action > get actions ( ) { list < action > result = new array list < > ( super get actions ( ) ) ; synchronized ( this ) { if ( transient actions = = null ) { transient actions = transient computer action factory create all for ( this ) ; } result add all ( transient actions ) ; } return collections unmodifiable list ( result ) ; } @ suppress warnings ( { " constant conditions " , " deprecation " }


gets the maximum client connections per host

public int get max client cnxns per host ( ) { return max client cnxns per host ; }


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 list < integer > get prefix ns array ( ) { return prefix ns array ; }


no op authentication attribute release policy

static authentication attribute release policy no op ( ) { return ( authentication , assertion , model , service ) - > new hash map < > ( 0 ) ; }


public boolean on touch event ( final motion event event ) { switch ( event get action masked ( ) ) { case motion event action move : { / / update pointers update pointers on move ( event ) ; / / start a new gesture if not already started if ( ! m gesture in progress & & m pointer count > 0 & & should start gesture ( ) ) { start gesture ( ) ; } / / notify listener if ( m gesture in progress & & m listener ! = null ) { m listener on gesture update ( this ) ; } break ; } case motion event action down : case motion event action pointer down : case motion event action pointer up : case motion event action up : { / / restart gesture whenever the number of pointers changes m new pointer count = get pressed pointer count ( event ) ; stop gesture ( ) ; update pointers on tap ( event ) ; if ( m pointer count > 0 & & should start gesture ( ) ) { start gesture ( ) ; } break ; } case motion event action cancel : { m new pointer count = 0 ; stop gesture ( ) ; reset ( ) ; break ; } } return true ; }


tests that async code is not executed if the fencing token changes

public void test run async with fencing ( ) throws exception { final time short timeout = time milliseconds ( 100l ) ; final uuid new fencing token = uuid random u u i d ( ) ; final completable future < uuid > result future = new completable future < > ( ) ; test run async ( endpoint - > { endpoint run async ( ( ) - > result future complete ( endpoint get fencing token ( ) ) ) ; return result future ; } , new fencing token ) ; try { result future get ( short timeout to milliseconds ( ) , time unit milliseconds ) ; fail ( " the async run operation should not complete since it is filtered out due to the changed fencing token " ) ; } catch ( timeout exception ignored ) { } }


returns an immutable map containing the given entries , in order

public static < k , v > immutable map < k , v > of ( k k 1 , v v 1 , k k 2 , v v 2 ) { check entry not null ( k 1 , v 1 ) ; check entry not null ( k 2 , v 2 ) ; return regular immutable map create ( 2 , new object [ ] { k 1 , v 1 , k 2 , v 2 } ) ; }


finds pets by status multiple status values can be provided with comma separated strings

public list < pet > find pets by status ( list < string > status ) { / / todo : implement return null ; }


public void attribute integer test ( ) { / / todo : test attribute integer }


only allows alias overriding if bean definition overriding is allowed

protected boolean allow alias overriding ( ) { return is allow bean definition overriding ( ) ; }


creates the cie augmentation data length

private address process augmentation data length ( address addr ) throws memory access exception { / * * create a new augmentation data length field at the specified address * and sets an appropriate comment for the new structure * / string comment = " ( cie ) augmentation data length " ; unsigned leb 1 2 8 data type uleb = unsigned leb 1 2 8 data type data type ; mem buffer buf = new dumb mem buffer impl ( program get memory ( ) , addr ) ; int encoded len = uleb get length ( buf , abstract leb 1 2 8 data type max leb128 encoded value len ) ; object aug len obj = uleb get value ( buf , uleb get default settings ( ) , encoded len ) ; augmentation data length = ( int ) ( ( scalar ) aug len obj ) get unsigned value ( ) ; create and comment data ( program , addr , uleb , comment , code unit eol comment ) ; cur size + = encoded len ; return addr add ( encoded len ) ; }


expand the environment variable based on client os environment variable expansion syntax ( e g $ var for linux and % var % for windows ) note : use $ $ ( ) method for cross - platform practice i e submit an application from a windows client to a linux unix server or vice versa

public string $ ( ) { if ( shell windows ) { return " % " + variable + " % " ; } else { return " $ " + variable ; } }


put user { username } : updated user this can only be done by the logged in user

default response entity < void > update user ( @ api param ( value = " name that need to be deleted " , required = true ) @ path variable ( " username " ) string username , @ api param ( value = " updated user object " , required = true ) @ valid @ request body user body ) { return new response entity < > ( http status not implemented ) ; }


visits a ldc instruction note that new constant types may be added in future versions of the java virtual machine to easily detect new constant types , implementations of this method should check for unexpected constant types , like this : if ( cst instanceof integer ) { } else if ( cst instanceof float ) { } else if ( cst instanceof long ) { } else if ( cst instanceof double ) { } else if ( cst instanceof string ) { } else if ( cst instanceof type ) { int sort = ( ( type ) cst ) get sort ( ) ; if ( sort = = type object ) { } else if ( sort = = type array ) { } else if ( sort = = type method ) { } else { throw an exception } } else if ( cst instanceof handle ) { } else if ( cst instanceof constant dynamic ) { } else { throw an exception }

public void visit ldc insn ( final object value ) { if ( api < opcodes asm5 & & ( value instanceof handle | | ( value instanceof type & & ( ( type ) value ) get sort ( ) = = type method ) ) ) { throw new unsupported operation exception ( requires asm5 ) ; } if ( api < opcodes asm7 & & value instanceof constant dynamic ) { throw new unsupported operation exception ( " this feature requires asm7 " ) ; } if ( mv ! = null ) { mv visit ldc insn ( value ) ; } }


trigger the currently - running lease monitor to re - check its leases immediately this is for use by unit tests

public void trigger monitor check now ( ) { preconditions check state ( lmthread ! = null , " lease monitor is not running " ) ; lmthread interrupt ( ) ; }


run a given command in a subprocess , including threads to copy its stdout and stderr to our stdout and stderr

static process run client ( list < string > command , map < string , string > env ) throws i o exception { process builder builder = new process builder ( command ) ; if ( env ! = null ) { builder environment ( ) put all ( env ) ; } process result = builder start ( ) ; return result ; }


exit a parse tree produced by { @ link eql base parser # event query }

void exit event query ( eql base parser event query context ctx ) ;


adds the provided class node to the class loader

public void add class ( class node cn ) { classes put ( cn name replace ( " / " , " " ) , cn ) ; }


returns the protocol version of this message


public void remove ( long key ) { delete ( key ) ; }


the sink node making the request < code > istio mcp v 1alpha 1 sink node sink node = 1 ; < code >

public boolean has sink node ( ) { return sink node builder ! = null | | sink node ! = null ; }


public void my string test ( ) { / / todo : test my string }


test that if we try and execute a command with a cache key without initializing request variable that it gives an error

public void test cache key execution requires request variable ( ) throws exception { / * force the request variable to not be initialized * / hystrix request context set context on current thread ( null ) ; test circuit breaker circuit breaker = new test circuit breaker ( ) ; successful cacheable command command = new successful cacheable command < string > ( circuit breaker , true , " one " ) ; assert equals ( " one " , command execute ( ) ) ; successful cacheable command command 2 = new successful cacheable command < string > ( circuit breaker , true , " two " ) ; assert equals ( " two " , command 2 queue ( ) get ( ) ) ; }


public string to string ( ) { return buffer to string ( ) ; }


public static compressor type get by code ( int code ) { for ( compressor type b : compressor type values ( ) ) { if ( code = = b code ) { return b ; } } throw new illegal argument exception ( " unknown codec : " + code ) ; }


create a loop this automatically adjusts connectivity

public void create loop ( float [ ] vertices ) { vec 2 [ ] v = new vec 2 [ vertices length / 2 ] ; for ( int i = 0 , vi = 0 ; i < vertices length ; i + = 2 , vi + + ) { v [ vi ] = new vec 2 ( vertices [ i ] , vertices [ i + 1 ] ) ; } shape create loop ( v , v length ) ; is looped = true ; }


verify that the storage locations passed - con - match the restrictions for this payload

private void check parameter restrictions ( inject context con , address addr ) { int insize = ( con inputlist = = null ) ? 0 : con inputlist size ( ) ; if ( inputlist length ! = insize ) throw new sleigh exception ( " input parameters do not match injection specification : " + source ) ; for ( int i = 0 ; i < inputlist length ; + + i ) { int sz = inputlist [ i ] get size ( ) ; if ( sz ! = 0 & & sz ! = con inputlist get ( i ) get size ( ) ) throw new sleigh exception ( " input parameter size does not match injection specification : " + source ) ; } int outsize = ( con output = = null ) ? 0 : con output size ( ) ; if ( output length ! = outsize ) throw new sleigh exception ( " output does not match injection specification : " + source ) ; for ( int i = 0 ; i < output length ; + + i ) { int sz = output [ i ] get size ( ) ; if ( sz ! = 0 & & sz ! = con output get ( i ) get size ( ) ) throw new sleigh exception ( " output size does not match injection specification : " + source ) ; } }


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


for compositional checking , the history can be partitioned into sub - histories

default collection < list < event > > partition ( list < event > events ) { return collections singleton ( events ) ; }


builds a { @ link resource } with a configured jersey testing environment

protected resource build resource ( ) { if ( bootstrap logging ) { bootstrap logging bootstrap ( ) ; } consumer < client config > extended configurator = config - > { client configurator accept ( config ) ; config property ( http url connector provider set method workaround , true ) ; } ; return new resource ( new resource test jersey configuration ( singletons , providers , properties , mapper , metric registry , validator , extended configurator , test container factory , register default exception mappers ) ) ; }


returns the line number of this location


sets the last modification and change times to the current time

protected synchronized void mark modification time ( ) { preconditions check state ( clock ! = null ) ; last modified time = clock current time millis ( ) ; last change time = last modified time ; }


public boolean is terminated ( ) { return delegate is terminated ( ) ; }


add current exception count of the resource name

void on error ( resource wrapper rw , throwable throwable , int batch count , object [ ] args ) ;


if the test class of the supplied { @ linkplain test context test context } is annotated with { @ code @ dirties context } and the { @ linkplain dirties context # class mode ( ) class mode } is set to { @ link class mode # before class before class } , the { @ linkplain application context application context } of the test context will be { @ linkplain test context # mark application context dirty marked as dirty } , and the { @ link dependency injection test execution listener # reinject dependencies attribute reinject dependencies attribute } in the test context will be set to { @ code true }

public void before test class ( test context test context ) throws exception { before or after test class ( test context , before class ) ; }


public boolean is empty ( ) { return size ( ) = = 0 ; }


adds a configuration properties for the kafka consumer

public kafka property ( string key , string value ) { preconditions check not null ( key ) ; preconditions check not null ( value ) ; if ( this kafka properties = = null ) { this kafka properties = new hash map < > ( ) ; } kafka properties put ( key , value ) ; return this ; }


extracts the local state directories as defined by { @ link checkpointing options # local recovery task manager state root dirs }

public static string [ ] parse local state directories ( configuration configuration ) { string config value = configuration get string ( checkpointing options local recovery task manager state root dirs , " " ) ; return split paths ( config value ) ; }


patch fake classname test : to test class name in snake case to test class name in snake case

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


returns the value of the - - output groups flag

public set < string > output groups ( ) { return output groups ; }


sets the preferred number of rows ( lines ) for this text area used to calculate preferred height

public void set pref rows ( float pref rows ) { this pref rows = pref rows ; }


configures this builder produce a test suite with the given name

public b named ( string name ) { if ( name contains ( " ( " ) ) { throw new illegal argument exception ( " eclipse hides all characters after " + " ' ( ' ; please use ' [ ] ' or other characters instead of parentheses " ) ; } this name = name ; return self ( ) ; }


slices the given buffer to the given index ( exclusive )

public static data buffer slice to ( data buffer buf , int idx ) { int pos = buf read position ( ) ; int len = idx - pos + 1 ; return buf retained slice ( pos , len ) ; }


updates the value used for replication streams hard limit , which is set by { @ code d f s config keys dfs namenode replication streams hard limit key } initially

public void set replication streams hard limit ( int new val ) { ensure positive int ( new val , d f s config keys dfs namenode replication streams hard limit key ) ; replication streams hard limit = new val ; }


analyze a functions references populates the addressvalue pairs of resource address and id

public void analyze function ( hash map < address , long > const use , decomp interface decompiler , program prog , function f , address ref addr , int param index , array list < pcode op > def use list ) { if ( f = = null ) { return ; } instruction instr = prog get listing ( ) get instruction at ( ref addr ) ; if ( instr = = null ) { return ; } decompile function ( f , decompiler ) ; if ( hfunction = = null ) { return ; / / failed to decompile } iterator < pcode op a s t > ops = hfunction get pcode ops ( ref addr ) ; while ( ops has next ( ) ) { if ( monitor is cancelled ( ) ) { break ; } pcode op a s t pcode op a s t = ops next ( ) ; if ( pcode op a s t get opcode ( ) = = pcode op call ) { / / get the second parameter varnode parm = pcode op a s t get input ( param index ) ; / / 1st param is the call dest if ( parm = = null ) { return ; } / / see if it is a constant if ( parm is constant ( ) ) { / / then this is a resource id / / lookup the resource and create a reference long value = parm get offset ( ) ; / / todo : not so fast , if there is a def use list , must apply it to get the real constant used ! try { value = apply def use list ( value , def use list ) ; const use put ( instr get address ( ) , value ) ; } catch ( invalid input exception exc ) { / / don ' t worry about error } } else { follow to param ( const use , def use list , hfunction , parm , null ) ; } / / if this is anything else , get the high variable to see if it can be traced back to a param / / then repeat with any calls to this function at whatever the param is } } }


public void string item test ( ) { / / todo : test string item }


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


stores a collection of values with the same key in the built multimap

public builder < k , v > put all ( k key , iterable < ? extends v > values ) { if ( key = = null ) { throw new null pointer exception ( " null key in entry : null = " + iterables to string ( values ) ) ; } collection < v > value collection = builder map get ( key ) ; if ( value collection ! = null ) { for ( v value : values ) { check entry not null ( key , value ) ; value collection add ( value ) ; } return this ; } iterator < ? extends v > values itr = values iterator ( ) ; if ( ! values itr has next ( ) ) { return this ; } value collection = new mutable value collection ( ) ; while ( values itr has next ( ) ) { v value = values itr next ( ) ; check entry not null ( key , value ) ; value collection add ( value ) ; } builder map put ( key , value collection ) ; return this ; }


gets the base data type of the specified data type

private data type get base data type ( final data type dt ) { data type base dt = dt ; while ( ( base dt instanceof pointer ) | | ( base dt instanceof array ) | | ( base dt instanceof type def ) ) { if ( base dt instanceof pointer ) { base dt = ( ( pointer ) base dt ) get data type ( ) ; } else if ( base dt instanceof array ) { base dt = ( ( array ) base dt ) get data type ( ) ; } else { base dt = ( ( type def ) base dt ) get data type ( ) ; } } return base dt ; }


delegates to { @ link # create request mapping info ( request mapping , request condition ) } , supplying the appropriate custom { @ link request condition } depending on whether the supplied { @ code annotated element } is a class or method

private request mapping info create request mapping info ( annotated element element ) { request mapping request mapping = annotated element utils find merged annotation ( element , request mapping class ) ; request condition < ? > condition = ( element instanceof class ? get custom type condition ( ( class < ? > ) element ) : get custom method condition ( ( method ) element ) ) ; return ( request mapping ! = null ? create request mapping info ( request mapping , condition ) : null ) ; }


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


returns true if the exception was reported false otherwise currently this is a copy of what we did in pre - skyframe execution the main implication is that we are printing the error to the top level reporter instead of the action reporter because of that skyframe values do not know about the errors happening in the execution phase even if we change in the future to log to the action reporter ( that would be done in action execution function compute ( ) when we get an action execution exception ) , we probably do not want to also store the std err output , so dump recorded out err ( ) should still be called here

private boolean report error if not aborting mode ( action execution exception ex , file out err out err buffer ) { / / for some actions ( e g , many local actions ) the poll interrupted status ( ) / / won ' t notice that we had an interrupted job it will continue / / for that reason we must take care to not report errors if we ' re / / in the ' aborting ' mode : any cancelled action would show up here synchronized ( this reporter ) { if ( ! is builder aborting ( ) ) { / / oops the action aborted report the problem print error ( ex get message ( ) , ex get action ( ) , out err buffer ) ; return true ; } } return false ; }


initialize the cache back to a clear state

private void initialize ( long new initial txn id ) { data map clear ( ) ; total size = 0 ; initial txn id = new initial txn id ; lowest txn id = initial txn id ; highest txn id = invalid txn id ; / / this will be set later }


int alloc arrays ( ) { preconditions check state ( needs alloc arrays ( ) , " arrays already allocated " ) ; int expected size = metadata ; int buckets = compact hashing table size ( expected size ) ; this table = compact hashing create table ( buckets ) ; set hash table mask ( buckets - 1 ) ; this entries = new int [ expected size ] ; this elements = new object [ expected size ] ; return expected size ; }


the children will be displayed last to first

public vertical group reverse ( ) { this reverse = true ; return this ; }


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


public ascii string ascii name ( ) { return name ; }


public void set extension js ( string extension js ) { this extension js = extension js ; }


return true if there is another task scheduled to run

private synchronized boolean has task ( ) { if ( scheduled task = = null ) { task thread = null ; current task = null ; return false ; } current task = scheduled task ; current delay = scheduled delay ; scheduled task = null ; return true ; }


tests exclusive access of the write lock

public void test write lock ( ) throws exception { string testname = name get method name ( ) ; final thread local < boolean > locked = new thread local < boolean > ( ) ; locked set ( boolean false ) ; instrumented read write lock read write lock = new instrumented read write lock ( true , testname , log , 2000 , 300 ) ; final auto closeable lock write lock = new auto closeable lock ( read write lock write lock ( ) ) { @ override public auto closeable lock acquire ( ) { auto closeable lock lock = super acquire ( ) ; locked set ( boolean true ) ; return lock ; } @ override public void release ( ) { super release ( ) ; locked set ( boolean false ) ; } } ; final auto closeable lock read lock = new auto closeable lock ( read write lock read lock ( ) ) ; try ( auto closeable lock lock = write lock acquire ( ) ) { thread competing write thread = new thread ( ) { @ override public void run ( ) { assert false ( write lock try lock ( ) ) ; } } ; competing write thread start ( ) ; competing write thread join ( ) ; thread competing read thread = new thread ( ) { @ override public void run ( ) { assert false ( read lock try lock ( ) ) ; } ; } ; competing read thread start ( ) ; competing read thread join ( ) ; } assert false ( locked get ( ) ) ; locked remove ( ) ; }


put faketest - query - paramters to test the collection format in query parameters

default response entity < void > test query parameter collection format ( list < string > pipe , list < string > ioutil , list < string > http , list < string > url , list < string > context ) { return new response entity < > ( http status not implemented ) ; }


returns all declared parameters of this { @ code invokable } note that if this is a constructor of a non - static inner class , unlike { @ link constructor # get parameter types } , the hidden { @ code this } parameter of the enclosing class is excluded from the returned parameters

public final immutable list < parameter > get parameters ( ) { type [ ] parameter types = get generic parameter types ( ) ; annotation [ ] [ ] annotations = get parameter annotations ( ) ; annotated type [ ] annotated types = get annotated parameter types ( ) ; immutable list builder < parameter > builder = immutable list builder ( ) ; for ( int i = 0 ; i < parameter types length ; i + + ) { builder add ( new parameter ( this , i , type token of ( parameter types [ i ] ) , annotations [ i ] , annotated types [ i ] ) ) ; } return builder build ( ) ; }


whether this is a private clone of a public token

public boolean is private clone of ( text the public service ) { return public service equals ( the public service ) ; }


public void delete task ( string task id ) { log info ( " removing handle for { } task in connector { } " , task id , connector name ) ; task handles remove ( task id ) ; }


provides the current state of the connector or task

public string state ( ) { return state ; }


returns value with leading zeros if the value represents a positive number ; returns value with leading blanks if the value represents a negative number

private string pad ( string value ) { string buffer sb = new string buffer ( ) ; int len = symbol size - value length ( ) ; for ( int i = 0 ; i < len ; i + + ) { sb append ( " " ) ; } sb append ( value ) ; return ( sb to string ( ) ) ; }


private void create identifier ( dependency node node ) { if ( null = = node parent ) { node identifier = " 1 " ; } list < dependency node > children = node children ; for ( int i = 1 ; i < = children size ( ) ; i + + ) { dependency node child = children get ( i - 1 ) ; if ( i > = 10 ) { / / if adding divider between each num , consider 1 - 1 - 10 and 1 - 1 - 1 , which will / / be treated as circle - dependency mistakenly child identifier = string format ( " % s ( % s ) " , node identifier , i ) ; } else { child identifier = node identifier + i ; } create identifier ( child ) ; } }


return a copy of the underlying header values as a { @ link message headers } object this method can be invoked many times , with modifications in between where each new call returns a fresh copy of the current header values

public message headers to message headers ( ) { return new message headers ( this headers ) ; }


gets the next address indicating the address after this call site table

address get next address ( ) { return next address ; }


execute a python file using this interpreter

public synchronized void exec file ( resource file file , python script script ) throws illegal state exception { if ( cleaned up ) { throw new illegal state exception ( " ghidra python interpreter has already been cleaned up " ) ; } inject script hierarchy ( script ) ; py get thread state ( ) tracefunc = interrupt trace function ; / / if the remote python debugger is alive , initialize it by calling settrace ( ) if ( ! system utilities is in development mode ( ) & & ! system utilities is in headless mode ( ) ) { if ( py dev utils get py dev src dir ( ) ! = null ) { try { inet address localhost = inet address get local host ( ) ; new socket ( localhost , py dev utils pydev remote debugger port ) close ( ) ; msg info ( this , " python debugger found " ) ; exec ( " import pydevd ; pydevd settrace ( host = \ " " + localhost get host name ( ) + " \ " , port = " + py dev utils pydev remote debugger port + " , suspend = false ) ; " ) ; msg info ( this , " connected to a python debugger " ) ; } catch ( i o exception e ) { msg info ( this , " not connected to a python debugger " ) ; } } } / / run python file execfile ( file get absolute path ( ) ) ; }


handles a fatal build problem ( exception ) that occurred during the build

private void handle fatal build problem ( @ non null build listener listener , @ non null throwable e ) { if ( listener ! = null ) { logger log ( fine , get display name ( ) + " failed to build " , e ) ; if ( e instanceof i o exception ) util display i o exception ( ( i o exception ) e , listener ) ; functions print stack trace ( e , listener fatal error ( e get message ( ) ) ) ; } else { logger log ( severe , get display name ( ) + " failed to build and we don ' t even have a listener " , e ) ; } }


configures the given { @ link http u r l connection } instance

public http u r l connection configure ( http u r l connection conn ) throws i o exception ;


private native void gav 1 close ( long context ) ;


performs a parallel dns lookup for all addresses if the dns lookup fails , then address remain unmodified

public void recreate socket addresses ( ) { addresses = addresses parallel stream ( ) map ( this : : recreate socket address ) collect ( collectors to collection ( multiple addresses : : new concurrent hash set ) ) ; }


public void reset ( ) { min val = null ; }


name to desc java util map [ ] [ ] = > " [ [ ljavautil map ; "

public static string name 2desc ( string name ) { string builder sb = new string builder ( ) ; int c = 0 , index = name index of ( ' [ ' ) ; if ( index > 0 ) { c = ( name length ( ) - index ) / 2 ; name = name substring ( 0 , index ) ; } while ( c - - > 0 ) { sb append ( " [ " ) ; } if ( " void " equals ( name ) ) { sb append ( jvm void ) ; } else if ( " boolean " equals ( name ) ) { sb append ( jvm boolean ) ; } else if ( " byte " equals ( name ) ) { sb append ( jvm byte ) ; } else if ( " char " equals ( name ) ) { sb append ( jvm char ) ; } else if ( " double " equals ( name ) ) { sb append ( jvm double ) ; } else if ( " float " equals ( name ) ) { sb append ( jvm float ) ; } else if ( " int " equals ( name ) ) { sb append ( jvm int ) ; } else if ( " long " equals ( name ) ) { sb append ( jvm long ) ; } else if ( " short " equals ( name ) ) { sb append ( jvm short ) ; } else { sb append ( ' l ' ) append ( name replace ( ' ' , ' / ' ) ) append ( ' ; ' ) ; } return sb to string ( ) ; }


uses reflection to execute the constructor for the given class with the given parameters the new instance of the given class will be returned

public static object invoke constructor ( class < ? > containing class , class < ? > [ ] parameter types , object [ ] args ) throws runtime exception { object result = null ; try { constructor < ? > constructor = locate constructor on class ( containing class , parameter types ) ; if ( constructor = = null ) { throw new no such method exception ( " unable to find a constructor " + " on the class " + containing class + " with the given parameters " ) ; } / / make sure we have access constructor set accessible ( true ) ; / / execute the method and get the result result = constructor new instance ( args ) ; } catch ( exception e ) { throw new runtime exception ( " unable to use reflection to call " + " constructor from class : " + containing class , e ) ; } return result ; }


create a name from the full kerberos principal name

public static kerberos name parse ( string principal name ) { matcher match = name parser matcher ( principal name ) ; if ( ! match matches ( ) ) { if ( principal name contains ( " @ " ) ) { throw new illegal argument exception ( " malformed kerberos name : " + principal name ) ; } else { return new kerberos name ( principal name , null , null ) ; } } else { return new kerberos name ( match group ( 1 ) , match group ( 3 ) , match group ( 4 ) ) ; } }


public string get application data ( ) { return application data ; }


uses the given name to find a matching script this method only works because of the limitation that all script names in ghidra must be unique if the given name has multiple script matches , then a warning will be logged

public script info find script info by name ( string script name ) { list < resource file > matching files = script name to files map get ( script name ) ; if ( matching files ! = null & & ! matching files is empty ( ) ) { script info info = script file to info map get ( matching files get ( 0 ) ) ; if ( matching files size ( ) > 1 ) { msg warn ( ghidra script info manager class , " found duplicate scripts for name : " + script name + " binding to script : " + info get source file ( ) ) ; } return info ; } / / don ' t search in paths return null ; }


gets a state handle from zoo keeper and optionally locks it

private retrievable state handle < t > get ( string path in zoo keeper , boolean lock ) throws exception { check not null ( path in zoo keeper , " path in zoo keeper " ) ; final string path = normalize path ( path in zoo keeper ) ; if ( lock ) { / / try to lock the node try { client create ( ) with mode ( create mode ephemeral ) for path ( get lock path ( path ) ) ; } catch ( keeper exception node exists exception ignored ) { / / we have already created the lock } catch ( keeper exception no node exception ex ) { / / we could run into this exception because the parent node does not exist when we / / are trying to lock / / we wrap the exception here so that it could be caught in default job graph store throw new not exist exception ( " zoo keeper node " + path + " does not exist " , ex ) ; } } boolean success = false ; try { byte [ ] data = client get data ( ) for path ( path ) ; retrievable state handle < t > retrievable state handle = instantiation util deserialize object ( data , thread current thread ( ) get context class loader ( ) ) ; success = true ; return retrievable state handle ; } catch ( keeper exception no node exception ex ) { / / we wrap the exception here so that it could be caught in default job graph store throw new not exist exception ( " zoo keeper node " + path + " does not exist " , ex ) ; } catch ( i o exception | class not found exception e ) { throw new i o exception ( " failed to deserialize state handle from zoo keeper data from " + path + ' ' , e ) ; } finally { if ( ! success & & lock ) { / / release the lock release ( path ) ; } } }


tests purge when logs are rolling or a new snapshot is created , then these newer files should alse be excluded in the current cycle for frequent snapshotting , configured snap count to 30 there are three threads which will create 1000 znodes each and simultaneously do purge call

public void test purge when log rolling in progress ( ) throws exception { client base setup test env ( ) ; zoo keeper server zks = new zoo keeper server ( tmp dir , tmp dir , 3000 ) ; sync request processor set snap count ( 30 ) ; final int port = integer parse int ( hostport split ( " : " ) [ 1 ] ) ; server cnxn factory f = server cnxn factory create factory ( port , - 1 ) ; f startup ( zks ) ; assert true ( client base wait for server up ( hostport , connection timeout ) , " waiting for server being up " ) ; final zoo keeper zk = client base create z k client ( hostport ) ; final count down latch do purge = new count down latch ( 1 ) ; final count down latch purge finished = new count down latch ( 1 ) ; final atomic boolean op failed = new atomic boolean ( false ) ; new thread ( ) { public void run ( ) { try { do purge await ( op timeout in millis / 2 , time unit milliseconds ) ; purge txn log purge ( tmp dir , tmp dir , 3 ) ; } catch ( i o exception ioe ) { log error ( " exception when purge " , ioe ) ; op failed set ( true ) ; } catch ( interrupted exception ie ) { log error ( " exception when purge " , ie ) ; op failed set ( true ) ; } finally { purge finished count down ( ) ; } } } start ( ) ; final int th count = 3 ; list < string > znodes = many client ops ( zk , do purge , th count , " / invalidsnap " ) ; assert true ( purge finished await ( op timeout in millis , time unit milliseconds ) , " purging is not finished ! " ) ; assert false ( op failed get ( ) , " purging failed ! " ) ; for ( string znode : znodes ) { try { zk get data ( znode , false , null ) ; } catch ( exception ke ) { log error ( " unexpected exception when visiting znode ! " , ke ) ; fail ( " unexpected exception when visiting znode ! " ) ; } } zk close ( ) ; f shutdown ( ) ; zks shutdown ( ) ; zks get txn log factory ( ) close ( ) ; }


byte argument less than or equal to the given value see examples in javadoc for { @ link additional matchers } class

public static byte leq ( byte value ) { report matcher ( new less or equal < byte > ( value ) ) ; return 0 ; }


public list < string > get photo urls ( ) { return photo urls ; }


returns the bootstrap ' s { @ link configuration source provider }

public configuration source provider get configuration source provider ( ) { return configuration source provider ; }


public static double apply sum ( sparse vector x 1 , sparse vector x 2 , bi function < double , double , double > func ) { double s = 0 ; int p 1 = 0 ; int p 2 = 0 ; int [ ] x 1 indices = x 1 get indices ( ) ; double [ ] x 1 values = x 1 get values ( ) ; int [ ] x 2 indices = x 2 get indices ( ) ; double [ ] x 2 values = x 2 get values ( ) ; int nnz 1 = x 1 indices length ; int nnz 2 = x 2 indices length ; while ( p 1 < nnz 1 | | p 2 < nnz 2 ) { if ( p 1 < nnz 1 & & p 2 < nnz 2 ) { if ( x 1 indices [ p 1 ] = = x 2 indices [ p 2 ] ) { s + = func apply ( x 1 values [ p 1 ] , x 2 values [ p 2 ] ) ; p 1 + + ; p 2 + + ; } else if ( x 1 indices [ p 1 ] < x 2 indices [ p 2 ] ) { s + = func apply ( x 1 values [ p 1 ] , 0 ) ; p 1 + + ; } else { s + = func apply ( 0 , x 2 values [ p 2 ] ) ; p 2 + + ; } } else { if ( p 1 < nnz 1 ) { s + = func apply ( x 1 values [ p 1 ] , 0 ) ; p 1 + + ; } else { / / p 2 < nnz 2 s + = func apply ( 0 , x 2 values [ p 2 ] ) ; p 2 + + ; } } } return s ; }


returns the { @ link socket address } which is bound locally

protected abstract socket address local address 0 ( ) ;


call when the screen moves so that the shape can be updated

void reset shape ( ) { arrow body = null ; arrow head = null ; clickable shapes clear ( ) ; }


get the difference between two snapshots ( or between a snapshot and the current status ) of a snapshottable directory

snapshot diff report listing get snapshot diff report listing ( string path , string from snapshot , string to snapshot , byte [ ] start path , int index ) throws i o exception { final string operation name = " compute snapshot diff " ; snapshot diff report listing diffs = null ; check operation ( operation category read ) ; string from snapshot root = ( from snapshot = = null | | from snapshot is empty ( ) ) ? path : snapshot get snapshot path ( path , from snapshot ) ; string to snapshot root = ( to snapshot = = null | | to snapshot is empty ( ) ) ? path : snapshot get snapshot path ( path , to snapshot ) ; final f s permission checker pc = get permission checker ( ) ; f s permission checker set operation type ( operation name ) ; try { read lock ( ) ; try { check operation ( operation category read ) ; diffs = f s dir snapshot op get snapshot diff report listing ( dir , pc , snapshot manager , path , from snapshot , to snapshot , start path , index , snapshot diff report limit ) ; } finally { read unlock ( operation name , get lock report info supplier ( from snapshot root , to snapshot root ) ) ; } } catch ( access control exception ace ) { log audit event ( false , operation name , from snapshot root , to snapshot root , null ) ; throw ace ; } log audit event ( true , operation name , from snapshot root , to snapshot root , null ) ; return diffs ; }


internal method to simplify an expression unlike the public { @ link # simplify ( rex node ) } and { @ link # simplify unknown as false ( rex node ) } methods , never calls { @ link # verify ( rex node , rex node , rex unknown as ) } verify adds an overhead that is only acceptable for a top - level call

rex node simplify ( rex node e , rex unknown as unknown as ) { if ( strong is null ( e ) ) { / / only boolean null ( aka unknown ) can be converted to false even in / / unknown as = false mode , we must not convert a null integer ( say ) to false if ( e get type ( ) get sql type name ( ) = = sql type name boolean ) { switch ( unknown as ) { case false : case true : return rex builder make literal ( unknown as to boolean ( ) ) ; } } return rex builder make null literal ( e get type ( ) ) ; } switch ( e get kind ( ) ) { case and : return simplify and ( ( rex call ) e , unknown as ) ; case or : return simplify or ( ( rex call ) e , unknown as ) ; case not : return simplify not ( ( rex call ) e , unknown as ) ; case case : return simplify case ( ( rex call ) e , unknown as ) ; case coalesce : return simplify coalesce ( ( rex call ) e ) ; case cast : return simplify cast ( ( rex call ) e ) ; case ceil : case floor : return simplify ceil floor ( ( rex call ) e ) ; case is null : case is not null : case is true : case is not true : case is false : case is not false : assert e instanceof rex call ; return simplify is ( ( rex call ) e , unknown as ) ; case equals : case greater than : case greater than or equal : case less than : case less than or equal : case not equals : return simplify comparison ( ( rex call ) e , unknown as ) ; case search : return simplify search ( ( rex call ) e , unknown as ) ; case like : return simplify like ( ( rex call ) e ) ; case minus prefix : return simplify unary minus ( ( rex call ) e , unknown as ) ; case plus prefix : return simplify unary plus ( ( rex call ) e , unknown as ) ; default : if ( e get class ( ) = = rex call class ) { return simplify generic node ( ( rex call ) e ) ; } else { return e ; } } }


check if this reference is from a call instruction that also falls through to the called location

private boolean fallthrough call ( program program , reference ref ) { / / get the instruction that is calling here / / if it falls through to here , then this is a fallthrough call address from = ref get from address ( ) ; instruction instr = program get listing ( ) get instruction at ( from ) ; if ( instr = = null ) { return false ; } if ( instr get fall through ( ) = = ref get to address ( ) ) { return true ; } return false ; }


returns the block file name for the block

public string get block name ( ) { return block get block name ( ) ; }


create an instance using { @ code context } for conversion

public static jaxb converter factory create ( j a x b context context ) { if ( context = = null ) throw new null pointer exception ( " context = = null " ) ; return new jaxb converter factory ( context ) ; }


public void get user by name test ( ) { string username = null ; / / user response = api get user by name ( username ) ; / / assert not null ( response ) ; / / todo : test validations }


the value of the line number item must give the corresponding line number in the original source file

public int get line number ( ) { return line number & 0xffff ; }


returns true if the data being managed by this model is of type { @ link data }

public boolean is data ( ) { return data ! = null ; }


reserve at a lower priority and verify the lower priority request gets allocated

public void test reservation with multiple priorities ( ) throws i o exception { scheduler init ( conf ) ; scheduler start ( ) ; scheduler reinitialize ( conf , resource manager get r m context ( ) ) ; / / add a node r m node node 1 = mock nodes new node info ( 1 , resources create resource ( 2048 , 2 ) ) ; node added scheduler event node event 1 = new node added scheduler event ( node 1 ) ; scheduler handle ( node event 1 ) ; node update scheduler event update event = new node update scheduler event ( node 1 ) ; / / create first app and take up half resources so the second app that asks / / for the entire node won ' t have enough f s app attempt app 1 = scheduler get scheduler app ( create scheduling request ( 1024 , 1 , " queue " , " user " , 1 ) ) ; scheduler update ( ) ; scheduler handle ( update event ) ; assert equals ( " basic allocation failed " , 1 , app 1 get live containers ( ) size ( ) ) ; / / create another app and reserve at a lower priority first application attempt id att id = create scheduling request ( 2048 , 2 , " queue 1 " , " user 1 " , 1 , 2 ) ; f s app attempt app 2 = scheduler get scheduler app ( att id ) ; scheduler update ( ) ; scheduler handle ( update event ) ; assert equals ( " reservation at lower priority failed " , 1 , app 2 get reserved containers ( ) size ( ) ) ; / / request container on the second app at a higher priority create scheduling request existing application ( 2048 , 2 , 1 , att id ) ; / / complete the first container so we can trigger allocation for app 2 container id container id = app 1 get live containers ( ) iterator ( ) next ( ) get container id ( ) ; scheduler allocate ( app 1 get application attempt id ( ) , new array list < > ( ) , null , arrays as list ( container id ) , null , null , null update requests ) ; / / trigger allocation for app 2 scheduler handle ( update event ) ; / / reserved container ( at lower priority ) should be run collection < r m container > live containers = app 2 get live containers ( ) ; assert equals ( " allocation post completion failed " , 1 , live containers size ( ) ) ; assert equals ( " high prio container allocated against low prio reservation " , 2 , live containers iterator ( ) next ( ) get container ( ) get priority ( ) get priority ( ) ) ; }


called when the model wants to end cell editing that is in progress this is due to an attempt to modify the composite data type in the editor while the model ' s field edit state indicates a field is being edited it is up to the application to determine whether to cancel or apply the field edits

public abstract void end field editing ( ) ;


returns the long at the specified index the 8 bytes starting at the specified index are composed into a long according to the current byte order and returned the position is not changed

public abstract long get long ( int index ) ;


void set new end address ( address new end ) { message = " " ; new end addr = new end ; new start addr = get start address ( new end ) ; if ( new start addr = = null ) { message = " end address is too small " ; } listener state changed ( ) ; }


public string get program path ( ) { return program path ; }


create zoom inout buttons on the default help window toolbar

protected void add custom toolbar items ( final j help j help ) { for ( component component : j help get components ( ) ) { if ( component instanceof j tool bar ) { j tool bar toolbar = ( j tool bar ) component ; toolbar add separator ( ) ; image icon zoom out icon = resource manager get scaled icon ( zoom out icon , 24 , 24 ) ; j button zoom out btn = new j button ( zoom out icon ) ; zoom out btn set tool tip text ( " zoom out " ) ; zoom out btn add action listener ( e - > { g help h t m l editor kit zoom out ( ) ; / / need to reload the page to force the scroll panes to resize properly a / / simple revalidate / repaint won ' t do it reload help page ( get current u r l ( ) ) ; } ) ; toolbar add ( zoom out btn ) ; image icon zoom in icon = resource manager get scaled icon ( zoom in icon , 24 , 24 ) ; j button zoom in btn = new j button ( zoom in icon ) ; zoom in btn set tool tip text ( " zoom in " ) ; zoom in btn add action listener ( e - > { g help h t m l editor kit zoom in ( ) ; / / need to reload the page to force the scroll panes to resize properly a / / simple revalidate / repaint won ' t do it reload help page ( get current u r l ( ) ) ; } ) ; toolbar add ( zoom in btn ) ; / / once we ' ve found the toolbar we can break out of the loop and stop looking for it break ; } } }


returns a read - only slice of this buffer ' s readable bytes , i e between { @ link # get reader index ( ) } and { @ link # get size ( ) } reader and writer indices as well as markers are not shared reference counters are shared but the slice is not { @ link # retain buffer ( ) retained } automatically


shortcut for { @ link # body ( body inserter ) } with a { @ linkplain body inserters # from value value inserter } as of 5 2 this method delegates to { @ link # body value ( object ) }

request headers spec < ? > sync body ( object body ) ;


public void write to ( dex file file , annotated output out ) { int map off = file get map ( ) get file offset ( ) ; section first data section = file get first data section ( ) ; section last data section = file get last data section ( ) ; int data off = first data section get file offset ( ) ; int data size = last data section get file offset ( ) + last data section write size ( ) - data off ; string magic = file get dex options ( ) get magic ( ) ; if ( out annotates ( ) ) { out annotate ( 8 , " magic : " + new cst string ( magic ) to quoted ( ) ) ; out annotate ( 4 , " checksum " ) ; out annotate ( 20 , " signature " ) ; out annotate ( 4 , " file size : " + hex u 4 ( file get file size ( ) ) ) ; out annotate ( 4 , " header size : " + hex u 4 ( size of header item ) ) ; out annotate ( 4 , " endian tag : " + hex u 4 ( dex format endian tag ) ) ; out annotate ( 4 , " link size : 0 " ) ; out annotate ( 4 , " link off : 0 " ) ; out annotate ( 4 , " map off : " + hex u 4 ( map off ) ) ; } / / write the magic number for ( int i = 0 ; i < 8 ; i + + ) { out write byte ( magic char at ( i ) ) ; } / / leave space for the checksum and signature out write zeroes ( 24 ) ; out write int ( file get file size ( ) ) ; out write int ( size of header item ) ; out write int ( dex format endian tag ) ; / * * write zeroes for the link size and data , as the output * isn ' t a staticly linked file * / out write zeroes ( 8 ) ; out write int ( map off ) ; / / write out each section ' s respective header part file get string ids ( ) write header part ( out ) ; file get type ids ( ) write header part ( out ) ; file get proto ids ( ) write header part ( out ) ; file get field ids ( ) write header part ( out ) ; file get method ids ( ) write header part ( out ) ; file get class defs ( ) write header part ( out ) ; if ( out annotates ( ) ) { out annotate ( 4 , " data size : " + hex u 4 ( data size ) ) ; out annotate ( 4 , " data off : " + hex u 4 ( data off ) ) ; } out write int ( data size ) ; out write int ( data off ) ; }


pseudoconstructor for serialization support

void init ( int expected size ) { preconditions check argument ( expected size > = 0 , " expected size must be non - negative " ) ; this mod count = math max ( 1 , expected size ) ; / / save expected size for use in alloc arrays ( ) }


string get type name ( ) { if ( nested type definition applier = = null ) { return " " ; } return nested type definition applier get ms type ( ) get name ( ) ; }


are there any threads currently waiting on a flush ? package private for test

boolean flush in progress ( ) { return flushes in progress get ( ) > 0 ; }


get the clickable span that is at the exact coordinates

private clickable span get clickable span in coords ( int x , int y ) { final int offset = get text offset at ( x , y ) ; if ( ! ( m text instanceof spanned ) | | offset < 0 ) { return null ; } final clickable span [ ] clickable spans = ( ( spanned ) m text ) get spans ( offset , offset , clickable span class ) ; if ( clickable spans ! = null & & clickable spans length > 0 ) { return clickable spans [ 0 ] ; } return null ; }


verify iterator of { @ link map state } supporting arbitrary access , see [ flink - 10267 ] to know more details

public void test map state iterator arbitrary access ( ) throws exception { map state descriptor < integer , long > kv id = new map state descriptor < > ( " id " , integer class , long class ) ; checkpointable keyed state backend < integer > backend = create keyed backend ( int serializer instance ) ; try { map state < integer , long > state = backend get partitioned state ( void namespace instance , void namespace serializer instance , kv id ) ; backend set current key ( 1 ) ; int state size = 4096 ; for ( int i = 0 ; i < state size ; i + + ) { state put ( i , i * 2l ) ; } iterator < map entry < integer , long > > iterator = state iterator ( ) ; int iterator count = 0 ; while ( iterator has next ( ) ) { map entry < integer , long > entry = iterator next ( ) ; assert equals ( iterator count , ( int ) entry get key ( ) ) ; switch ( thread local random current ( ) next int ( ) % 3 ) { case 0 : / / remove twice iterator remove ( ) ; try { iterator remove ( ) ; fail ( ) ; } catch ( illegal state exception e ) { / / ignore expected exception } break ; case 1 : / / has next - > remove iterator has next ( ) ; iterator remove ( ) ; break ; case 2 : / / nothing to do break ; } iterator count + + ; } assert equals ( state size , iterator count ) ; } finally { backend dispose ( ) ; } }


centers the viewport to the specified y value on the y - axis this also refreshes the chart by calling invalidate ( )

public void center view to y ( float y value , axis dependency axis ) { float vals in view = get axis range ( axis ) / m view port handler get scale y ( ) ; runnable job = move view job get instance ( m view port handler , 0f , y value + vals in view / 2f , get transformer ( axis ) , this ) ; add viewport job ( job ) ; }


returns a class ' s { @ link class # get simple name } , but also includes the outer class ' s simple name if this is an inner class for example , given { @ code my inner class } under { @ code my outer class } , returns { @ code " my outer class $ my inner class " }

public static string get simple name with outer ( class < ? > clazz ) { string name = clazz get name ( ) ; return name substring ( name last index of ( " " ) + 1 ) ; }


returns true if field uptime secs is set ( has been assigned a value ) and false otherwise

public boolean is set uptime secs ( ) { return isset bit vector get ( uptime secs isset id ) ; }


calls the smallest sub set overload that filters out the extreme values

sorted set < e > create sub set ( sorted set < e > set , e first exclusive , e last exclusive ) { if ( from = = bound no bound & & to = = bound exclusive ) { return set head set ( last exclusive ) ; } else if ( from = = bound inclusive & & to = = bound no bound ) { return set tail set ( first inclusive ) ; } else if ( from = = bound inclusive & & to = = bound exclusive ) { return set sub set ( first inclusive , last exclusive ) ; } else { throw new illegal argument exception ( ) ; } }


get the list of all fixtures attached to this body

public final fixture get fixture list ( ) { return m fixture list ; }


returns the mask settings for the selected instructions

public mask value get mask ( program program , program selection selection ) { load selected instructions ( program , selection ) ; return get final mask and value ( ) ; }


get job submit host address for this job

string get job submit host address ( ) { string hostadd = get ( m r job config job submithostaddr ) ; return hostadd ; }


gets the { @ link pseudo header name # scheme } header or { @ code null } if there is no such header


loads { @ link will be unloaded exception } in a separate { @ code class loader } , calls { @ code get checked ( future , will be unloaded exception class ) } , and returns the loader the caller can then test that the { @ code class loader } can still be g ced the test amounts to a test that { @ code get checked } holds no strong references to the class

private weak reference < ? > do test class unloading ( ) throws exception { u r l class loader shadow loader = new u r l class loader ( parse java class path ( ) , null ) ; @ suppress warnings ( " unchecked " ) class < will be unloaded exception > shadow class = ( class < will be unloaded exception > ) class for name ( will be unloaded exception class get name ( ) , false , shadow loader ) ; assert not same ( shadow class , will be unloaded exception class ) ; get checked ( immediate future ( " foo " ) , shadow class ) ; return new weak reference < > ( shadow loader ) ; }


returns the members injector used to inject dependencies into methods and fields on instances of the given type { @ code t } the returned members injector will not be valid until the main { @ link injector } has been created the members injector will throw an { @ code illegal state exception } if you try to use it beforehand

< t > members injector < t > get members injector ( type literal < t > type literal ) ;


changes the permission status on the given key

public void change permission status ( string key , permission status new permission ) throws azure exception { try { check container ( container access type read then write ) ; cloud blob wrapper blob = get blob reference ( key ) ; blob download attributes ( get instrumented context ( ) ) ; store permission status ( blob , new permission ) ; blob upload metadata ( get instrumented context ( ) ) ; } catch ( exception e ) { throw new azure exception ( e ) ; } }


resolve a filename as a path ( suppressing forbidden a p is ) protected so tests can map string path - names to real path objects

protected path resolve path ( string name ) { return path utils get ( name ) normalize ( ) to absolute path ( ) ; }


begins reporting metrics using the configured { @ link scheduled reporter }

public void start ( ) throws exception { reporter start ( period get quantity ( ) , period get unit ( ) ) ; }


public list < list < read only first > > get array array of model ( ) { return array array of model ; }


split a freeform string into a host and port , without strict validation note that the host - only formats will leave the port field undefined you can use { @ link # with default port ( int ) } to patch in a default value

public static host address from string ( string host port string ) { require non null ( host port string , " host port string is null " ) ; string host ; string port string = null ; if ( host port string starts with ( " [ " ) ) { / / parse a bracketed host , typically an i pv 6 literal matcher matcher = bracket pattern matcher ( host port string ) ; if ( ! matcher matches ( ) ) { throw new illegal argument exception ( " invalid bracketed host / port : " + host port string ) ; } host = matcher group ( 1 ) ; port string = matcher group ( 2 ) ; / / could be null } else { int colon pos = host port string index of ( ' : ' ) ; if ( colon pos > = 0 & & host port string index of ( ' : ' , colon pos + 1 ) = = - 1 ) { / / exactly 1 colon split into host : port host = host port string substring ( 0 , colon pos ) ; port string = host port string substring ( colon pos + 1 ) ; } else { / / 0 or 2 + colons bare hostname or i pv 6 literal host = host port string ; } } int port = no port ; if ( port string ! = null & & port string length ( ) ! = 0 ) { / / try to parse the whole port string as a number / / jdk7 accepts leading plus signs we don ' t want to if ( port string starts with ( " + " ) ) { throw new illegal argument exception ( " unparseable port number : " + host port string ) ; } try { port = integer parse int ( port string ) ; } catch ( number format exception e ) { throw new illegal argument exception ( " unparseable port number : " + host port string ) ; } if ( ! is valid port ( port ) ) { throw new illegal argument exception ( " port number out of range : " + host port string ) ; } } return new host address ( host , port ) ; }


encodes the an integer as a string with given radix , then uses { @ link ints # try parse ( string , int ) } to parse the result asserts the result is the same as what we started with

private static void radix encode parse and assert equals ( integer value , int radix ) { assert equals ( " radix : " + radix , value , ints try parse ( integer to string ( value , radix ) , radix ) ) ; }


returns the underlying implementation , useful for the footprint benchmark


start services for backup node the following services should be muted ( not run or not pass any control commands to data nodes ) on backup node : { @ link lease manager monitor } protected by safe mode { @ link block manager redundancy monitor } protected by safe mode { @ link heartbeat manager monitor } protected by safe mode { @ link datanode admin manager monitor } need to prohibit refresh nodes ( ) { @ link pending reconstruction blocks pending reconstruction monitor } harmless , because redundancy monitor is muted

public void start active services ( ) throws i o exception { try { namesystem start active services ( ) ; } catch ( throwable t ) { do immediate shutdown ( t ) ; } }


check if the path has a file extension and whether the extension is either on the list of { @ link # safe extensions safe extensions } or explicitly { @ link content negotiation manager # get all file extensions ( ) registered } if not , and the status is in the 2xx range , a ' content - disposition ' header with a safe attachment file name ( " f txt " ) is added to prevent rfd exploits

private void add content disposition header ( servlet server http request request , servlet server http response response ) { http headers headers = response get headers ( ) ; if ( headers contains key ( http headers content disposition ) ) { return ; } try { int status = response get servlet response ( ) get status ( ) ; if ( status < 200 | | ( status > 299 & & status < 400 ) ) { return ; } } catch ( throwable ex ) { / / ignore } http servlet request servlet request = request get servlet request ( ) ; string request uri = url path helper raw path instance get originating request uri ( servlet request ) ; int index = request uri last index of ( ' / ' ) + 1 ; string filename = request uri substring ( index ) ; string path params = " " ; index = filename index of ( ' ; ' ) ; if ( index ! = - 1 ) { path params = filename substring ( index ) ; filename = filename substring ( 0 , index ) ; } filename = url path helper default instance decode request string ( servlet request , filename ) ; string ext = string utils get filename extension ( filename ) ; path params = url path helper default instance decode request string ( servlet request , path params ) ; string ext in path params = string utils get filename extension ( path params ) ; if ( ! safe extension ( servlet request , ext ) | | ! safe extension ( servlet request , ext in path params ) ) { headers add ( http headers content disposition , " inline ; filename = f txt " ) ; } }


return the jsf attribute map for the specified scope

protected map < string , object > get attribute map ( int scope ) { if ( scope = = scope request ) { return get external context ( ) get request map ( ) ; } else { return get external context ( ) get session map ( ) ; } }