test chmod 1 create and write file on fs 2 verify that exit code for chmod on existing file is 0 3 verify that exit code for chmod on non - existing file is 1 4 verify that exit code for chmod with glob input on non - existing file is 1 5 verify that exit code for chmod with glob input on existing file in 0

public void test chmod ( ) throws exception { path p 1 = new path ( test root dir , " test chmod / file exists " ) ; final string f 1 = p 1 to uri ( ) get path ( ) ; final string f 2 = new path ( test root dir , " test chmod / file does not exist " ) to uri ( ) get path ( ) ; final string f 3 = new path ( test root dir , " test chmod / non existingfiles * " ) to uri ( ) get path ( ) ; final path p 4 = new path ( test root dir , " test chmod / file 1 " ) ; final path p 5 = new path ( test root dir , " test chmod / file 2 " ) ; final path p 6 = new path ( test root dir , " test chmod / file 3 " ) ; final string f 7 = new path ( test root dir , " test chmod / file * " ) to uri ( ) get path ( ) ; / / create and write test file write file ( file sys , p 1 ) ; assert true ( file sys exists ( p 1 ) ) ; / / test 1 : test 1 : exit code for chmod on existing is 0 string argv [ ] = { " - chmod " , " 777 " , f 1 } ; assert equals ( 0 , fs shell run ( argv ) ) ; / / test 2 : exit code for chmod on non - existing path is 1 string argv 2 [ ] = { " - chmod " , " 777 " , f 2 } ; assert equals ( 1 , fs shell run ( argv 2 ) ) ; / / test 3 : exit code for chmod on non - existing path with globbed input is 1 string argv 3 [ ] = { " - chmod " , " 777 " , f 3 } ; assert equals ( 1 , fs shell run ( argv 3 ) ) ; / / create required files write file ( file sys , p 4 ) ; assert true ( file sys exists ( p 4 ) ) ; write file ( file sys , p 5 ) ; assert true ( file sys exists ( p 5 ) ) ; write file ( file sys , p 6 ) ; assert true ( file sys exists ( p 6 ) ) ; / / test 4 : exit code for chmod on existing path with globbed input is 0 string argv 4 [ ] = { " - chmod " , " 777 " , f 7 } ; assert equals ( 0 , fs shell run ( argv 4 ) ) ; }


{ @ inherit doc } always returns null for { @ code phi insn } s

public insn get original rop insn ( ) { return null ; }


default string path ( ) { return request path ( ) path within application ( ) value ( ) ; }


formats an { @ code int } as a 3 - byte unsigned hex value

public static string u 3 ( int v ) { char [ ] result = new char [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) { result [ 5 - i ] = character for digit ( v & 0x 0f , 16 ) ; v > > = 4 ; } return new string ( result ) ; }


helper method to create failover proxy provider

private < t > r m failover proxy provider < t > create r m failover proxy provider ( configuration conf , class < t > protocol ) { class < ? extends r m failover proxy provider < t > > default provider class ; try { default provider class = ( class < ? extends r m failover proxy provider < t > > ) class for name ( yarn configuration default client failover proxy provider ) ; } catch ( exception e ) { throw new yarn runtime exception ( " invalid default failover provider class " + yarn configuration default client failover proxy provider , e ) ; } r m failover proxy provider < t > provider = reflection utils new instance ( conf get class ( yarn configuration client failover proxy provider , default provider class , r m failover proxy provider class ) , conf ) ; provider init ( conf , ( r m proxy < t > ) this , protocol ) ; return provider ; }


determines the name to be used for the provided resource

protected string determine resource name ( final resource resource ) { string resource name ; if ( resource instanceof context resource ) { resource name = ( ( context resource ) resource ) get path within context ( ) ; } else if ( resource instanceof byte array resource ) { resource name = resource get description ( ) ; } else { try { resource name = resource get file ( ) get absolute path ( ) ; } catch ( i o exception e ) { resource name = resource get filename ( ) ; } } return resource name ; }


assume following scenario : indexing request is written to primary , but fails to be replicated to active replica the primary instructs master to fail replica before acknowledging write to client in the meanwhile , the node of the replica was removed from the cluster ( disassociate dead nodes ) this means that the shard routing of the replica was failed , but it ' s allocation id is still part of the in - sync set we have to make sure that the fail shard request from the primary removes the allocation id from the in - sync set

public void test dead nodes before replica failed ( ) throws exception { cluster state cluster state = create one primary one replica cluster state ( allocation ) ; logger info ( " remove replica node " ) ; index shard routing table shard routing table = cluster state routing table ( ) index ( " test " ) shard ( 0 ) ; shard routing replica shard = shard routing table replica shards ( ) get ( 0 ) ; cluster state = cluster state builder ( cluster state ) nodes ( discovery nodes builder ( cluster state nodes ( ) ) remove ( replica shard current node id ( ) ) ) build ( ) ; cluster state = allocation disassociate dead nodes ( cluster state , true , " reroute " ) ; assert that ( cluster state metadata ( ) index ( " test " ) in sync allocation ids ( 0 ) size ( ) , equal to ( 2 ) ) ; logger info ( " fail replica ( for which there is no shard routing in the cs anymore ) " ) ; assert null ( cluster state get routing nodes ( ) get by allocation id ( replica shard shard id ( ) , replica shard allocation id ( ) get id ( ) ) ) ; shard state action shard failed cluster state task executor failed cluster state task executor = new shard state action shard failed cluster state task executor ( allocation , null , logger ) ; long primary term = cluster state metadata ( ) index ( " test " ) primary term ( 0 ) ; cluster state = failed cluster state task executor execute ( cluster state , arrays as list ( new failed shard entry ( shard routing table shard id ( ) , replica shard allocation id ( ) get id ( ) , primary term , " dummy " , null , true ) ) ) resulting state ; assert that ( cluster state metadata ( ) index ( " test " ) in sync allocation ids ( 0 ) size ( ) , equal to ( 1 ) ) ; }


returns the next pseudorandom , uniformly distributed int value from the given < code > random < code > sequence

public static int next int ( random random ) { return random next int ( ) ; }


notify the component tree that it needs to asynchronously perform a state update

public void update state async ( state update state update , string attribution ) { check if no state updates method ( ) ; if ( m component tree = = null ) { return ; } m component tree update state async ( get global key ( ) , state update , attribution , is create layout in progress ( ) ) ; }


tests basic single threaded set permission scenario

public void test single threaded block blob set permission scenario ( ) throws throwable { create empty file ( create test account ( ) , test path ) ; fs delete ( test path , true ) ; fs set permission ( test path , new fs permission ( fs action execute , fs action read , fs action read ) ) ; }


public void get user by name test ( ) throws i o exception { string username = null ; user response = api get user by name ( username ) ; / / todo : test validations }


sets the maximum frame that the animation will end at when playing or looping the value will be clamped to the composition bounds for example , setting integer max value would result in the same thing as composition end frame

public void set max frame ( final int max frame ) { if ( composition = = null ) { lazy composition tasks add ( new lazy composition task ( ) { @ override public void run ( lottie composition composition ) { set max frame ( max frame ) ; } } ) ; return ; } animator set max frame ( max frame + 0 9 9f ) ; }


convenience method to indicate if this provider is the active provider ( has focus )

public boolean is active ( ) { return docking tool is active ( this ) ; }


submits the single { @ code worker } instance { @ code m task runner } to the underlying executor an additional time if there are fewer than { @ code m max concurrency } pending submissions does nothing if the maximum number of workers is already pending

private void start worker if needed ( ) { / / perform a compare - and - swap retry loop for synchronization to make sure we don ' t start more / / workers than desired int current count = m pending workers get ( ) ; while ( current count < m max concurrency ) { int updated count = current count + 1 ; if ( m pending workers compare and set ( current count , updated count ) ) { / / start a new worker f log v ( tag , " % s : starting worker % d of % d " , m name , updated count , m max concurrency ) ; m executor execute ( m task runner ) ; break ; } / / else : compare and set failed due to race ; snapshot the new count and try again f log v ( tag , " % s : race in start worker if needed ; retrying " , m name ) ; current count = m pending workers get ( ) ; } }


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

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


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 " ) ; }


empty configured values are ignored and the fallback is used instead

private static formatter get configured formatter property ( formatter builder value , string configured name , formatter fallback value ) { return get configured property ( builder value , configured name , val - > { val = val trim ( ) ; if ( val length ( ) > 0 ) { try { return ( formatter ) class loader get system class loader ( ) load class ( val ) get declared constructor ( ) new instance ( ) ; } catch ( reflective operation exception e ) { throw new illegal argument exception ( e ) ; } } else { return fallback value ; } } , fallback value ) ; }


returns the weighted standard deviation of the values in the snapshot

public double get std dev ( ) { / / two - pass algorithm for variance , avoids numeric overflow if ( values length < = 1 ) { return 0 ; } final double mean = get mean ( ) ; double variance = 0 ; for ( int i = 0 ; i < values length ; i + + ) { final double diff = values [ i ] - mean ; variance + = norm weights [ i ] * diff * diff ; } return math sqrt ( variance ) ; }


returns a { @ code top k selector } that collects the greatest { @ code k } elements added to it , relative to the natural ordering of the elements , and returns them via { @ link # top k } in descending order

public static < t extends comparable < ? super t > > top k selector < t > greatest ( int k ) { return greatest ( k , ordering natural ( ) ) ; }


merges the properties of the two commands

public mergeable background command merge commands ( mergeable background command command ) { system utilities assert true ( command instanceof analysis background command , " this code assumes that the " + " two commands are both analysis background commands and this is not the case " ) ; analysis background command abc = ( analysis background command ) command ; system utilities assert true ( mgr = = abc mgr , " this code assumes that the " + " managers of the two commands are the same instance and this is not the case " ) ; / / once we encounter a mark as analyzed value that is true , then leave it on mark as analyzed = mark as analyzed | abc mark as analyzed ; return this ; }


log the throwable , which occurs in dubbo rpc service

private void deal exception ( throwable throwable ) { abstract span span = context manager active span ( ) ; span log ( throwable ) ; }


overridden to avoid generating events when nothing changed

protected void sort ( list < bundle status > data , table sorting context < bundle status > sorting context ) { / / notify accesses listeners , must be done on swing thread system utilities assert this is the swing thread ( " must be called on the swing thread " ) ; if ( sorting context is unsorted ( ) ) { / / this is the ' no sort ' state sort completed ( sorting context ) ; notify model sorted ( false ) ; return ; } has ever sorted = true ; / / signal that we have sorted at least one time / / wrap the assigned comparator to detect if the order changes atomic boolean changed = new atomic boolean ( false ) ; comparator < bundle status > wrapper = new comparator < bundle status > ( ) { comparator < bundle status > comparator = sorting context get comparator ( ) ; @ override public int compare ( bundle status o 1 , bundle status o 2 ) { int result = comparator compare ( o 1 , o 2 ) ; if ( result < 0 ) { changed set ( true ) ; } return result ; } } ; collections sort ( data , wrapper ) ; sort completed ( sorting context ) ; if ( changed get ( ) ) { notify model sorted ( false ) ; } }


the cipher suites to enable , in the order of preference { @ code null } to use default cipher suites

public ssl context builder ciphers ( iterable < string > ciphers ) { return ciphers ( ciphers , identity cipher suite filter instance ) ; }


put a single entity if there is an error , add a timeline put error to the given response

private long put entities ( tree map < long , rolling write batch > entity updates , tree map < long , rolling write batch > index updates , timeline entity entity , timeline put response response ) { long put count = 0 ; list < entity identifier > related entities without start times = new array list < entity identifier > ( ) ; byte [ ] rev start time = null ; map < string , set < object > > primary filters = null ; try { list < timeline event > events = entity get events ( ) ; / / look up the start time for the entity long start time = get and set start time ( entity get entity id ( ) , entity get entity type ( ) , entity get start time ( ) , events ) ; if ( start time = = null ) { / / if no start time is found , add an error and return timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error no start time ) ; response add error ( error ) ; return put count ; } / / must have a domain if ( string utils is empty ( entity get domain id ( ) ) ) { timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error no domain ) ; response add error ( error ) ; return put count ; } rev start time = write reverse ordered long ( start time ) ; long rounded start time = entitydb compute current check millis ( start time ) ; rolling write batch rolling write batch = entity updates get ( rounded start time ) ; if ( rolling write batch = = null ) { db db = entitydb get d b for start time ( start time ) ; if ( db ! = null ) { write batch write batch = db create write batch ( ) ; rolling write batch = new rolling write batch ( db , write batch ) ; entity updates put ( rounded start time , rolling write batch ) ; } } if ( rolling write batch = = null ) { / / if no start time is found , add an error and return timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error expired entity ) ; response add error ( error ) ; return put count ; } write batch write batch = rolling write batch get write batch ( ) ; / / save off the get bytes conversion to avoid unnecessary cost byte [ ] entity id bytes = entity get entity id ( ) get bytes ( utf 8 ) ; byte [ ] entity type bytes = entity get entity type ( ) get bytes ( utf 8 ) ; byte [ ] domain id bytes = entity get domain id ( ) get bytes ( utf 8 ) ; / / write entity marker byte [ ] marker key = key builder new instance ( 3 ) add ( entity type bytes , true ) add ( rev start time ) add ( entity id bytes , true ) get bytes for lookup ( ) ; write batch put ( marker key , empty bytes ) ; + + put count ; / / write domain id entry byte [ ] domainkey = key builder new instance ( 4 ) add ( entity type bytes , true ) add ( rev start time ) add ( entity id bytes , true ) add ( domain id column ) get bytes ( ) ; write batch put ( domainkey , domain id bytes ) ; + + put count ; / / write event entries if ( events ! = null ) { for ( timeline event event : events ) { byte [ ] revts = write reverse ordered long ( event get timestamp ( ) ) ; byte [ ] key = key builder new instance ( ) add ( entity type bytes , true ) add ( rev start time ) add ( entity id bytes , true ) add ( events column ) add ( revts ) add ( event get event type ( ) get bytes ( utf 8 ) ) get bytes ( ) ; byte [ ] value = fst conf as byte array ( event get event info ( ) ) ; write batch put ( key , value ) ; + + put count ; } } / / write primary filter entries primary filters = entity get primary filters ( ) ; if ( primary filters ! = null ) { for ( entry < string , set < object > > primary filter : primary filters entry set ( ) ) { for ( object primary filter value : primary filter get value ( ) ) { byte [ ] key = key builder new instance ( 6 ) add ( entity type bytes , true ) add ( rev start time ) add ( entity id bytes , true ) add ( primary filters column ) add ( primary filter get key ( ) ) add ( fst conf as byte array ( primary filter value ) ) get bytes ( ) ; write batch put ( key , empty bytes ) ; + + put count ; } } } / / write other info entries map < string , object > other info = entity get other info ( ) ; if ( other info ! = null ) { for ( entry < string , object > info : other info entry set ( ) ) { byte [ ] key = key builder new instance ( 5 ) add ( entity type bytes , true ) add ( rev start time ) add ( entity id bytes , true ) add ( other info column ) add ( info get key ( ) ) get bytes ( ) ; byte [ ] value = fst conf as byte array ( info get value ( ) ) ; write batch put ( key , value ) ; + + put count ; } } / / write related entity entries map < string , set < string > > related entities = entity get related entities ( ) ; if ( related entities ! = null ) { for ( entry < string , set < string > > related entity list : related entities entry set ( ) ) { string related entity type = related entity list get key ( ) ; for ( string related entity id : related entity list get value ( ) ) { / / look up start time of related entity long related start time long = get start time long ( related entity id , related entity type ) ; / / delay writing the related entity if no start time is found if ( related start time long = = null ) { related entities without start times add ( new entity identifier ( related entity id , related entity type ) ) ; continue ; } byte [ ] related entity start time = write reverse ordered long ( related start time long ) ; long related rounded start time = entitydb compute current check millis ( related start time long ) ; rolling write batch related rolling write batch = entity updates get ( related rounded start time ) ; if ( related rolling write batch = = null ) { db db = entitydb get d b for start time ( related start time long ) ; if ( db ! = null ) { write batch related write batch = db create write batch ( ) ; related rolling write batch = new rolling write batch ( db , related write batch ) ; entity updates put ( related rounded start time , related rolling write batch ) ; } } if ( related rolling write batch = = null ) { / / if no start time is found , add an error and return timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error expired entity ) ; response add error ( error ) ; continue ; } / / this is the existing entity byte [ ] related domain id bytes = related rolling write batch get d b ( ) get ( create domain id key ( related entity id , related entity type , related entity start time ) ) ; / / the timeline data created by the server before 2 6 won ' t have / / the domain field we assume this timeline data is in the / / default timeline domain string domain id = null ; if ( related domain id bytes = = null ) { domain id = timeline data manager default domain id ; } else { domain id = new string ( related domain id bytes , utf 8 ) ; } if ( ! domain id equals ( entity get domain id ( ) ) ) { / / in this case the entity will be put , but the relation will be / / ignored timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error forbidden relation ) ; response add error ( error ) ; continue ; } / / write " forward " entry ( related entity - > entity ) byte [ ] key = create related entity key ( related entity id , related entity type , related entity start time , entity get entity id ( ) , entity get entity type ( ) ) ; write batch related write batch = related rolling write batch get write batch ( ) ; related write batch put ( key , empty bytes ) ; + + put count ; } } } / / write index entities rolling write batch index rolling write batch = index updates get ( rounded start time ) ; if ( index rolling write batch = = null ) { db db = indexdb get d b for start time ( start time ) ; if ( db ! = null ) { write batch index write batch = db create write batch ( ) ; index rolling write batch = new rolling write batch ( db , index write batch ) ; index updates put ( rounded start time , index rolling write batch ) ; } } if ( index rolling write batch = = null ) { / / if no start time is found , add an error and return timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error expired entity ) ; response add error ( error ) ; return put count ; } write batch index write batch = index rolling write batch get write batch ( ) ; put count + = write primary filter entries ( index write batch , primary filters , marker key , empty bytes ) ; } catch ( i o exception e ) { log error ( " error putting entity " + entity get entity id ( ) + " of type " + entity get entity type ( ) , e ) ; timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error io exception ) ; response add error ( error ) ; } for ( entity identifier related entity : related entities without start times ) { try { long related entity start and insert time = get and set start time ( related entity get id ( ) , related entity get type ( ) , read reverse ordered long ( rev start time , 0 ) , null ) ; if ( related entity start and insert time = = null ) { throw new i o exception ( " error setting start time for related entity " ) ; } long related start time long = related entity start and insert time ; long related rounded start time = entitydb compute current check millis ( related start time long ) ; rolling write batch related rolling write batch = entity updates get ( related rounded start time ) ; if ( related rolling write batch = = null ) { db db = entitydb get d b for start time ( related start time long ) ; if ( db ! = null ) { write batch related write batch = db create write batch ( ) ; related rolling write batch = new rolling write batch ( db , related write batch ) ; entity updates put ( related rounded start time , related rolling write batch ) ; } } if ( related rolling write batch = = null ) { / / if no start time is found , add an error and return timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error expired entity ) ; response add error ( error ) ; continue ; } write batch related write batch = related rolling write batch get write batch ( ) ; byte [ ] related entity start time = write reverse ordered long ( related entity start and insert time ) ; / / this is the new entity , the domain should be the same byte [ ] key = create domain id key ( related entity get id ( ) , related entity get type ( ) , related entity start time ) ; related write batch put ( key , entity get domain id ( ) get bytes ( utf 8 ) ) ; + + put count ; related write batch put ( create related entity key ( related entity get id ( ) , related entity get type ( ) , related entity start time , entity get entity id ( ) , entity get entity type ( ) ) , empty bytes ) ; + + put count ; related write batch put ( create entity marker key ( related entity get id ( ) , related entity get type ( ) , related entity start time ) , empty bytes ) ; + + put count ; } catch ( i o exception e ) { log error ( " error putting related entity " + related entity get id ( ) + " of type " + related entity get type ( ) + " for entity " + entity get entity id ( ) + " of type " + entity get entity type ( ) , e ) ; timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error io exception ) ; response add error ( error ) ; } } return put count ; }


set the date and time at which the message is no longer valid , as specified by the { @ code expires } header

public void set expires ( instant expires ) { set instant ( expires , expires ) ; }


post fake { pet id } upload image with required file : uploads an image ( required )

response entity < model api response > upload file with required file ( @ api param ( value = " id of pet to update " , required = true ) @ path variable ( " pet id " ) long pet id , @ api param ( value = " file to upload " ) @ valid @ request part ( value = " required file " , required = true ) multipart file required file , @ api param ( value = " additional data to pass to server " ) @ valid @ request part ( value = " additional metadata " , required = false ) string additional metadata ) ;


tests that a remote rpc call with a non - serializable argument fails with an { @ link i o exception } ( or an { @ link java lang reflect undeclared throwable exception } if the the method declaration does not include the { @ link i o exception } as throwable )

public void test non serializable remote message transfer ( ) throws exception { linked blocking queue < object > linked blocking queue = new linked blocking queue < > ( ) ; test endpoint test endpoint = new test endpoint ( akka rpc service 1 , linked blocking queue ) ; test endpoint start ( ) ; string address = test endpoint get address ( ) ; completable future < test gateway > remote gateway future = akka rpc service 2 connect ( address , test gateway class ) ; test gateway remote gateway = remote gateway future get ( timeout get size ( ) , timeout get unit ( ) ) ; remote gateway foobar ( new object ( ) ) ; fail ( " should have failed because object is not serializable " ) ; }


called when a track of type { @ code track type } is not supported by the player

void on unsupported track ( int track type ) ;


generate { @ link operator i d } ' s from { @ code uid } ' s { @ link org apache flink streaming api graph stream graph hasher v 2 # traverse stream graph and generate hashes ( stream graph ) } ) }

public static operator i d from uid ( string uid ) { byte [ ] hash = hashing murmur 3 128 ( 0 ) new hasher ( ) put string ( uid , utf 8 ) hash ( ) as bytes ( ) ; return new operator i d ( hash ) ; }


verifies if the path informed is a valid absolute path

static boolean is valid absolute path ( final string path ) { return path ! = null & & path starts with ( path separator ) ; }


private void test app attempt new state ( ) { assert equals ( r m app attempt state new , application attempt get app attempt state ( ) ) ; assert equals ( 0 , application attempt get diagnostics ( ) length ( ) ) ; assert equals ( 0 , application attempt get just finished containers ( ) size ( ) ) ; assert null ( application attempt get master container ( ) ) ; assert equals ( 0 0 , ( double ) application attempt get progress ( ) , 0 0001 ) ; assert equals ( 0 , application get ran nodes ( ) size ( ) ) ; assert null ( application attempt get final application status ( ) ) ; assert not null ( application attempt get tracking url ( ) ) ; assert false ( " n / a " equals ( application attempt get tracking url ( ) ) ) ; }


public long get pet id ( ) { return pet id ; }


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 ) ; }


tells whether it is microsoft intermediate language

public boolean is microsoft intermediate language ( ) { return is microsoft intermediate language ; }


protected dist cp context get context ( ) { return context ; }


sets dummy hash values for the given program

private static void set program hashes ( program program ) { int id = program start transaction ( " sethashes " ) ; try { string md 5 = random string utils random numeric ( 32 ) ; program set executable m d 5 ( md 5 ) ; string sha 2 5 6 = random string utils random numeric ( 64 ) ; program set executable s h a 2 5 6 ( sha 2 5 6 ) ; } finally { program end transaction ( id , true ) ; } }


build a form - encoding request body with the given form parameters

public request body build request body form encoding ( map < string , object > form params ) { okhttp 3 form body builder form builder = new okhttp 3 form body builder ( ) ; for ( entry < string , object > param : form params entry set ( ) ) { form builder add ( param get key ( ) , parameter to string ( param get value ( ) ) ) ; } return form builder build ( ) ; }


helper method to set api key prefix for the first api key authentication

public void set api key prefix ( string api key prefix ) { for ( authentication auth : authentications values ( ) ) { if ( auth instanceof api key auth ) { ( ( api key auth ) auth ) set api key prefix ( api key prefix ) ; return ; } } throw new runtime exception ( " no api key authentication configured ! " ) ; }


determine a media type for the given resource , if possible

public static optional < media type > get media type ( @ nullable resource resource ) { return optional of nullable ( resource ) map ( resource : : get filename ) flat map ( media type factory : : get media type ) ; }


like { @ link # port ( ) } except returns a primitive where zero implies absent using this method will avoid allocation , so is encouraged when copying data

public int port as int ( ) { return port ; }


tests the effect of { @ link with plugin }

@ test public void with recipe hpi ( ) { assert not null ( r jenkins get plugin ( " legacy " ) ) ; }


returns the result bound to the broadcast variable identified by the given { @ code name } important : the broadcast variable data structure is shared between the parallel tasks on one machine any access that modifies its internal state needs to be manually synchronized by the caller

< rt > list < rt > get broadcast variable ( string name ) ;


to test enum parameters to test enum parameters

public api response < void > test enum parameters with http info ( list < string > enum header string array , string enum header string , list < string > enum query string array , string enum query string , integer enum query integer , double enum query double , list < string > enum form string array , string enum form string ) throws api exception { okhttp 3 call local var call = test enum parameters validate before call ( enum header string array , enum header string , enum query string array , enum query string , enum query integer , enum query double , enum form string array , enum form string , null ) ; return local var api client execute ( local var call ) ; }


record the number of rows and amount of physical bytes that were read by an operator this metric is valid only for source operators

public void record raw input ( long size in bytes , long position count ) { raw input data size update ( size in bytes ) ; raw input positions update ( position count ) ; }


returns a " smart " node client to a random node in the cluster

public client smart client ( ) { node and client random node and client = get random node and client ( ) ; if ( random node and client ! = null ) { return random node and client node client ( ) ; } throw new assertion error ( " no smart client found " ) ; }


public queue info [ ] get root queues ( ) throws i o exception , interrupted exception { return client get root queues ( ) ; }


set the { @ link string } representations of the bytes immediately before ( and including ) a return instruction

public void set return bytes ( list < string > return bytes ) { this return bytes = return bytes ; }


deletes a range of addresses from this set

public final void delete range ( address start , address end ) { delete ( start , end ) ; }


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

public okhttp 3 call test endpoint parameters async ( big decimal number , double double , string pattern without delimiter , byte [ ] byte , integer integer , integer int 3 2 , long int 6 4 , float float , string string , file binary , local date date , offset date time date time , string password , string param callback , final api callback < void > callback ) throws api exception { okhttp 3 call local var call = test endpoint parameters validate before call ( number , double , pattern without delimiter , byte , integer , int 3 2 , int 6 4 , float , string , binary , date , date time , password , param callback , callback ) ; local var api client execute async ( local var call , callback ) ; return local var call ; }


runs a number of steps for incremental rehashing

private void incremental rehash ( ) { state map entry < k , n , s > [ ] old map = primary table ; state map entry < k , n , s > [ ] new map = incremental rehash table ; int old capacity = old map length ; int new mask = new map length - 1 ; int required version = highest required snapshot version ; int rh idx = rehash index ; int transferred = 0 ; / / we migrate a certain minimum amount of entries from the old to the new table while ( transferred < min transferred per incremental rehash ) { state map entry < k , n , s > e = old map [ rh idx ] ; while ( e ! = null ) { / / copy - on - write check for entry if ( e entry version < required version ) { e = new state map entry < > ( e , state map version ) ; } state map entry < k , n , s > n = e next ; int pos = e hash & new mask ; e next = new map [ pos ] ; new map [ pos ] = e ; e = n ; + + transferred ; } old map [ rh idx ] = null ; if ( + + rh idx = = old capacity ) { / / here , the rehash is complete and we release resources and reset fields primary table = new map ; incremental rehash table = ( state map entry < k , n , s > [ ] ) empty table ; primary table size + = incremental rehash table size ; incremental rehash table size = 0 ; rehash index = 0 ; return ; } } / / sync our local bookkeeping the with official bookkeeping fields primary table size - = transferred ; incremental rehash table size + = transferred ; rehash index = rh idx ; }


this test returns mocked kms token when { @ link web hdfs file system # add delegation tokens ( string , credentials ) } method is called

public void add mock kms token ( ) throws exception { user group information create remote user ( " job tracker " ) ; web hdfs file system webfs = web hdfs test util get web hdfs file system ( conf , web hdfs constants webhdfs scheme ) ; key provider key provider = mockito mock ( key provider class , with settings ( ) extra interfaces ( delegation token extension class , crypto extension class ) ) ; mockito when ( key provider get conf ( ) ) then return ( conf ) ; byte [ ] test identifier = " test identifier for delegation token " get bytes ( ) ; token test token = new token ( test identifier , new byte [ 0 ] , new text ( " kms - dt " ) , new text ( ) ) ; mockito when ( ( ( delegation token issuer ) key provider ) get canonical service name ( ) ) then return ( " service " ) ; mockito when ( ( ( delegation token issuer ) key provider ) get delegation token ( any string ( ) ) ) then return ( test token ) ; webfs set test provider ( key provider ) ; credentials creds = new credentials ( ) ; final token < ? > [ ] tokens = webfs add delegation tokens ( " job tracker " , creds ) ; assert assert equals ( 2 , tokens length ) ; assert assert equals ( tokens [ 1 ] , test token ) ; assert assert equals ( 2 , creds number of tokens ( ) ) ; }


resize the array to the exact provided size

public long array resize ( long array array , long size ) { if ( array instanceof big long array ) { return resize in place ( ( big long array ) array , size ) ; } else { abstract array arr = ( abstract array ) array ; final long array new array = new long array ( size , arr clear on resize ) ; for ( long i = 0 , end = math min ( size , array size ( ) ) ; i < end ; + + i ) { new array set ( i , array get ( i ) ) ; } array close ( ) ; return new array ; } }


public boolean equals ( object other ) { if ( this = = other ) { return true ; } if ( other = = null | | get class ( ) ! = other get class ( ) ) { return false ; } model size stats that = ( model size stats ) other ; return this model bytes = = that model bytes & & objects equals ( this peak model bytes , that peak model bytes ) & & objects equals ( this model bytes exceeded , that model bytes exceeded ) & & objects equals ( this model bytes memory limit , that model bytes memory limit ) & & this total by field count = = that total by field count & & this total over field count = = that total over field count & & this total partition field count = = that total partition field count & & this bucket allocation failures count = = that bucket allocation failures count & & objects equals ( this memory status , that memory status ) & & objects equals ( this assignment memory basis , that assignment memory basis ) & & this categorized doc count = = that categorized doc count & & this total category count = = that total category count & & this frequent category count = = that frequent category count & & this rare category count = = that rare category count & & this dead category count = = that dead category count & & this failed category count = = that failed category count & & objects equals ( this categorization status , that categorization status ) & & objects equals ( this timestamp , that timestamp ) & & objects equals ( this log time , that log time ) & & objects equals ( this job id , that job id ) ; }


creates an artifact in a directory that is unique to the package that contains the rule , thus guaranteeing that it never clashes with artifacts created by rules in other packages

public artifact get bin artifact ( string relative ) { return get bin artifact ( path fragment create ( relative ) ) ; }


displays the given file in an editor using the java perspective if something goes wrong , this method has no effect

public static void display in editor ( i file file , i workbench workbench ) { new u i job ( " display in editor " ) { @ override public i status run in u i thread ( i progress monitor m ) { try { i workbench window window = workbench get active workbench window ( ) ; ide open editor ( window get active page ( ) , file ) ; workbench show perspective ( " org eclipse jdt ui java perspective " , window ) ; return status ok status ; } catch ( null pointer exception | workbench exception e ) { return status cancel status ; } } } schedule ( ) ; }


create a memory block that uses the bytes located at a different location with a 1 : 1 byte mapping scheme

public memory block create byte mapped block ( string name , address start , address mapped address , long length , byte mapping scheme byte mapping scheme , boolean overlay ) throws lock exception , memory conflict exception , address overflow exception , illegal argument exception ;


return the configured default destination

public d get default destination ( ) { return this default destination ; }


normalize the path by suppressing sequences like " path " and inner simple dots the result is convenient for path comparison for other uses , notice that windows separators ( " \ " ) are replaced by simple slashes

public static string clean path ( string path ) { if ( path = = null ) { return null ; } string path to use = replace ( path , windows folder separator , folder separator ) ; / / strip prefix from path to analyze , to not treat it as part of the / / first path element this is necessary to correctly parse paths like / / " file : core / / core / io / resource class " , where the " " should just / / strip the first " core " directory while keeping the " file : " prefix int prefix index = path to use index of ( " : " ) ; string prefix = " " ; if ( prefix index ! = - 1 ) { prefix = path to use substring ( 0 , prefix index + 1 ) ; path to use = path to use substring ( prefix index + 1 ) ; } if ( path to use starts with ( folder separator ) ) { prefix = prefix + folder separator ; path to use = path to use substring ( 1 ) ; } string [ ] path array = delimited list to string array ( path to use , folder separator ) ; list < string > path elements = new linked list < > ( ) ; int tops = 0 ; for ( int i = path array length - 1 ; i > = 0 ; i - - ) { string element = path array [ i ] ; if ( current path equals ( element ) ) { / / points to current directory - drop it } else if ( top path equals ( element ) ) { / / registering top path found tops + + ; } else { if ( tops > 0 ) { / / merging path element with element corresponding to top path tops - - ; } else { / / normal path element found path elements add ( 0 , element ) ; } } } / / remaining top paths need to be retained for ( int i = 0 ; i < tops ; i + + ) { path elements add ( 0 , top path ) ; } return prefix + collection to delimited string ( path elements , folder separator ) ; }


verify that locked ram is released when blocks are evicted from ram disk

public void test release on eviction ( ) throws exception { get cluster builder ( ) set num datanodes ( 1 ) set max locked memory ( block size ) set ram disk replica capacity ( block size * 2 - 1 ) build ( ) ; final string method name = generic test utils get method name ( ) ; final fs dataset impl fsd = ( fs dataset impl ) cluster get data nodes ( ) get ( 0 ) get f s dataset ( ) ; path path 1 = new path ( " / " + method name + " 01 dat " ) ; make test file ( path 1 , block size , true ) ; assert that ( fsd get cache used ( ) , is ( ( long ) block size ) ) ; / / wait until the replica is written to persistent storage wait for metric ( " ram disk blocks lazy persisted " , 1 ) ; / / trigger eviction and verify locked bytes were released fsd evict lazy persist blocks ( long max value ) ; verify ram disk j m x metric ( " ram disk blocks evicted " , 1 ) ; wait for locked bytes used ( fsd , 0 ) ; }


the asynchronous version of get children

public void get children ( string path , boolean watch , children 2 callback cb , object ctx ) { get children ( path , get default watcher ( watch ) , cb , ctx ) ; }


returns the version of content type note this is the version of the structurestorage for the content type , not the users version of their data

public int get content type version ( ) { throw new unsupported operation exception ( " get content type version is not applicable to versioned item " ) ; }


adds a data { @ link source } to the environment to get a { @ link data stream } the result will be either a bounded data stream ( that can be processed in a batch way ) or an unbounded data stream ( that must be processed in a streaming way ) , based on the boundedness property of the source , as defined by { @ link source # get boundedness ( ) } this method takes an explicit type information for the produced data stream , so that callers can define directly what typeserializer will be used for the produced stream for sources that describe their produced type , the method { @ link # from source ( source , watermark strategy , string ) } can be used to avoid specifying the produced type redundantly

public < out > data stream source < out > from source ( source < out , ? , ? > source , watermark strategy < out > timestamps and watermarks , string source name , type information < out > type info ) { final type information < out > resolved type info = get type info ( source , source name , source class , type info ) ; return new data stream source < > ( this , check not null ( source , " source " ) , check not null ( timestamps and watermarks , " timestamps and watermarks " ) , check not null ( resolved type info ) , check not null ( source name ) ) ; }


gets the service config parsed by { @ link name resolver helper # parse service config ( map ) }

public config or error get service config ( ) { return service config ; }


public context get context ( ) { return context ; }


this method must be implemented to provide a user implementation of a co group it is called for each pair of element groups where the elements share the same key

void co group ( iterable < in1 > first , iterable < in2 > second , collector < o > out ) throws exception ;


override the default kotlin serialization json { @ code decoder }

void kotlin serialization json decoder ( decoder < ? > decoder ) ;


get a proxy connection to a remote server

public static < t > t wait for proxy ( class < t > protocol , long client version , inet socket address addr , configuration conf , long conn timeout ) throws i o exception { return wait for protocol proxy ( protocol , client version , addr , conf , conn timeout ) get proxy ( ) ; }


public long get int 6 4 ( ) { return int 6 4 ; }


perform a lookup on the given method and return associated metadata , if any


public final void remove reference ( reference reference ) { current program get reference manager ( ) delete ( reference ) ; }


tests that the current leader is notified when his leader connection information in zoo keeper are overwritten the leader must re - establish the correct leader connection information in zoo keeper

public void test leader should be corrected when overwritten ( ) throws exception { final string faulty contender url = " faulty contender " ; final string leader path = " / leader " ; configuration set string ( high availability options ha zookeeper leader path , leader path ) ; final testing leader election event handler election event handler = new testing leader election event handler ( test leader ) ; final testing leader retrieval event handler retrieval event handler = new testing leader retrieval event handler ( ) ; leader election driver leader election driver = null ; leader retrieval driver leader retrieval driver = null ; curator framework another client = null ; try { leader election driver = create and init leader election driver ( client , election event handler ) ; election event handler wait for leader ( timeout ) ; assert that ( election event handler get confirmed leader information ( ) , is ( test leader ) ) ; another client = zoo keeper utils start curator framework ( configuration ) ; byte array output stream baos = new byte array output stream ( ) ; object output stream oos = new object output stream ( baos ) ; oos write u t f ( faulty contender url ) ; oos write object ( uuid random u u i d ( ) ) ; oos close ( ) ; / / overwrite the current leader address , the leader should notice that boolean data written = false ; while ( ! data written ) { another client delete ( ) for path ( leader path ) ; try { another client create ( ) for path ( leader path , baos to byte array ( ) ) ; data written = true ; } catch ( keeper exception node exists exception e ) { / / this can happen if the leader election service was faster } } / / the faulty leader should be corrected on zoo keeper leader retrieval driver = zoo keeper utils create leader retrieval driver factory ( client , configuration ) create leader retrieval driver ( retrieval event handler , retrieval event handler : : handle error ) ; if ( retrieval event handler wait for new leader ( timeout ) equals ( faulty contender url ) ) { retrieval event handler wait for new leader ( timeout ) ; } assert that ( retrieval event handler get leader session i d ( ) , is ( test leader get leader session i d ( ) ) ) ; assert that ( retrieval event handler get address ( ) , is ( test leader get leader address ( ) ) ) ; } finally { if ( leader election driver ! = null ) { leader election driver close ( ) ; } if ( leader retrieval driver ! = null ) { leader retrieval driver close ( ) ; } if ( another client ! = null ) { another client close ( ) ; } } }


default string get service group ( string key ) { key = prefix service root + config split char + prefix service mapping + key ; if ( ! service group name contains ( key ) ) { configuration cache add config listener ( key ) ; service group name add ( key ) ; } return configuration factory get instance ( ) get config ( key ) ; }


public static void socket await ( final socket u d t socket , final status u d t status array ) throws exception { while ( true ) { for ( final status u d t status : status array ) { if ( socket status ( ) = = status ) { return ; } else { thread sleep ( 50 ) ; } } } }


creates a csv reader to read a comma separated value ( csv ) file the reader has options to define parameters and field types and will eventually produce the data set that corresponds to the read and parsed csv input

public csv reader read csv file ( string file path ) { return new csv reader ( file path , this ) ; }


a factory of path package locators from a list of path elements elements may contain " % workspace % " , indicating the workspace if any of the paths given do not exist , an exception will be thrown

public static path package locator create ( path output base , list < string > path elements , event handler event handler , path workspace , path client working directory , list < build file name > build files by priority ) { return create internal ( output base , path elements , event handler , workspace , client working directory , build files by priority , true ) ; }


returns the number of bytes that can be read from this input stream without blocking this method simply performs < code > in available ( ) < code > and returns the result

public int available ( ) throws i o exception { return in available ( ) ; }


expect that the cookie with the given name is present

public web test client response spec exists ( string name ) { get cookie ( name ) ; return this response spec ; }


return the name of this parameter in the operation signature

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


utility function to ensure that the configured base znode exists this recursively creates the znode as well as all of its parents

public synchronized void ensure parent z node ( ) throws i o exception , interrupted exception , keeper exception { preconditions check state ( ! want to be in election , " ensure parent z node ( ) may not be called while in the election " ) ; if ( zk client = = null ) { create connection ( ) ; } string path parts [ ] = znode working dir split ( " / " ) ; preconditions check argument ( path parts length > = 1 & & path parts [ 0 ] is empty ( ) , " invalid path : % s " , znode working dir ) ; string builder sb = new string builder ( ) ; for ( int i = 1 ; i < path parts length ; i + + ) { sb append ( " / " ) append ( path parts [ i ] ) ; string prefix path = sb to string ( ) ; log debug ( " ensuring existence of " + prefix path ) ; try { create with retries ( prefix path , new byte [ ] { } , zk acl , create mode persistent ) ; } catch ( keeper exception e ) { if ( is node exists ( e code ( ) ) ) { / / set a c ls for parent node , if they do not exist or are different try { set acls with retries ( prefix path ) ; } catch ( keeper exception e 1 ) { throw new i o exception ( " couldn ' t set a c ls on parent z node : " + prefix path , e 1 ) ; } } else { throw new i o exception ( " couldn ' t create " + prefix path , e ) ; } } } log info ( " successfully created " + znode working dir + " in zk " ) ; }


return the day of week in chinese the pattern is { @ code yyyy - mm - dd hh : mm : ss }

public static string get chinese week ( final string time ) { return get chinese week ( string 2 date ( time , get default format ( ) ) ) ; }


issue : add at least one assertion to this test case solution : inserted assertion to check whether the execution of the main method in { @ link app } throws an exception

void should execute application without exception ( ) { assert does not throw ( ( ) - > app main ( new string [ ] { } ) ) ; }


public void set previous offset ( int offset ) { / / do nothing }


should be removed as part of kafka - 10217

public static streams metrics impl get metrics impl ( final state store context context ) { return ( streams metrics impl ) context metrics ( ) ; }


public string name ( ) { return name ; }


starts executing the plan , exits when the plan is done executing

private void execute plan ( ) { preconditions check state ( lock is held by current thread ( ) ) ; this block mover set runnable ( ) ; if ( this scheduler is shutdown ( ) ) { this scheduler = executors new single thread executor ( ) ; } this future = scheduler submit ( new runnable ( ) { @ override public void run ( ) { thread current thread ( ) set name ( " disk balancer thread " ) ; log info ( " executing disk balancer plan plan file : { } , plan id : { } " , plan file , plan i d ) ; for ( map entry < volume pair , disk balancer work item > entry : work map entry set ( ) ) { block mover set runnable ( ) ; block mover copy blocks ( entry get key ( ) , entry get value ( ) ) ; } } } ) ; }


a sensible definition of { @ link # contains } in terms of { @ link # count } if you override { @ link # count } , you may wish to override { @ link # contains } to forward to this implementation

protected boolean standard contains ( @ nullable decl object object ) { return count ( object ) > 0 ; }


set the < code > placement constraint expression < code > of the request

public scheduling request builder placement constraint expression ( placement constraint placement constraint expression ) { scheduling request set placement constraint ( placement constraint expression ) ; return this ; }


get the value of the ' { @ code type } ' attribute subclasses can override this to change the type of ' { @ code input } ' element rendered default value is ' { @ code submit } '

protected string get type ( ) { return " submit " ; }


public final multi search template response msearch template ( multi search template request multi search template request , request options options ) throws i o exception { return perform request and parse entity ( multi search template request , request converters : : multi search template , options , multi search template response : : from x context , empty set ( ) ) ; }


records entry to a { @ code load ( ) } , throwing an exception if a cycle is detected

private void begin load ( bzl load value key key ) throws bzl load failed exception { if ( ! load stack add ( key ) ) { immutable list < bzl load value key > cycle = cycle utils split into path and chain ( predicates equal to ( key ) , load stack ) second ; throw new bzl load failed exception ( " starlark load cycle : " + cycle , code cycle ) ; } }


public list < big decimal > get array number ( ) { return array number ; }


public void do trim ( ) { if ( value ! = null ) { value = value trim ( ) ; } }


tries to get a read only adapter for the database whose handle is passed to this method

static function parameter adapter find read only adapter ( d b handle handle ) throws version exception { try { return new function parameter adapter v 0 ( handle ) ; } catch ( version exception e ) { if ( ! e is upgradable ( ) ) { throw e ; } } return new function parameter adapter no table ( handle ) ; }


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


returns the count of { @ code node } ' s incoming edges ( equal to { @ code predecessors ( node ) size ( ) } ) in a directed graph in an undirected graph , returns the { @ link # degree ( object ) } if the count is greater than { @ code integer max value } , returns { @ code integer max value }


return the name of the constructor argument

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


returns the flammability of the used for fire calculations takes flammability of floor liquid into account

public float get flammability ( ) { if ( ! block has items ) { if ( floor liquid drop ! = null & & ! block solid ) { return floor liquid drop flammability ; } return 0 ; } else if ( build ! = null ) { float result = build items sum ( ( item , amount ) - > item flammability * amount ) ; if ( block has liquids ) { result + = build liquids sum ( ( liquid , amount ) - > liquid flammability * amount / 3f ) ; } return result ; } return 0 ; }


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 ( ) ; 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 ] ) ) ; } return builder build ( ) ; }


public void load xml resource ( package pkg , string name ) throws i o exception { string pkg name = pkg get name ( ) ; pkg name = pkg name replace ( ' ' , ' / ' ) ; string resource name = " / " + pkg name + " / " + name ; input stream is = get class ( ) get resource as stream ( resource name ) ; if ( is = = null ) { throw new i o exception ( " could not find resource : " + resource name ) ; } buffered reader br = new buffered reader ( new input stream reader ( is ) ) ; string line = " " ; while ( line ! = null ) { line = br read line ( ) ; if ( line ! = null ) { xml list add ( line ) ; } } br close ( ) ; }


private transformation < row data > create sort row time ( row type input type , transformation < row data > input transform , table config table config ) { generated record comparator row comparator = null ; if ( sort spec get field size ( ) > 1 ) { / / skip the first field which is the rowtime field and would be ordered by timer sort spec spec exclude time = sort spec create sub sort spec ( 1 ) ; row comparator = comparator code generator gen ( table config , " row time sort comparator " , input type , spec exclude time ) ; } row time sort operator sort operator = new row time sort operator ( internal type info of ( input type ) , sort spec get field spec ( 0 ) get field index ( ) , row comparator ) ; one input transformation < row data , row data > transform = new one input transformation < > ( input transform , get desc ( ) , sort operator , internal type info of ( input type ) , input transform get parallelism ( ) ) ; if ( inputs contain singleton ( ) ) { transform set parallelism ( 1 ) ; transform set max parallelism ( 1 ) ; } empty row data key selector selector = empty row data key selector instance ; transform set state key selector ( selector ) ; transform set state key type ( selector get produced type ( ) ) ; return transform ; }


protected path get create file ( ) { path fn = get finder ( ) get file ( ) ; return fn ; }


leaves this monitor may be called only by a thread currently occupying this monitor

public void leave ( ) { final reentrant lock lock = this lock ; try { / / no need to signal if we will still be holding the lock when we return if ( lock get hold count ( ) = = 1 ) { signal next waiter ( ) ; } } finally { lock unlock ( ) ; / / will throw illegal monitor state exception if not held } }


print a collection of parse trees to the debug printer

protected static void dbg print trees ( collection < assembly parse result > trees ) { dbg println ( " got " + trees size ( ) + " tree ( s ) " ) ; set < string > suggestions = new tree set < > ( ) ; for ( assembly parse result result : trees ) { if ( ! result is error ( ) ) { assembly parse accept result acc = ( assembly parse accept result ) result ; assembly parse tree node tree = acc get tree ( ) ; tree print ( dbg ) ; } else { assembly parse error result err = ( assembly parse error result ) result ; dbg println ( err ) ; if ( err get buffer ( ) equals ( " " ) ) { suggestions add all ( err get suggestions ( ) ) ; } } } dbg println ( " proposals : " + suggestions ) ; }


updates a pet in the store with form data

public void update pet with form ( long pet id , string name , string status ) throws api exception { update pet with form with http info ( pet id , name , status ) ; }


adds the given element to the given array the array is extended if necessary

public static object [ ] add ( object [ ] array , int size , object element ) { array = extend array ( array , size + 1 ) ; array [ size ] = element ; return array ; }


order by activity name ( needs to be followed by { @ link # asc ( ) } or { @ link # desc ( ) } )

historic activity instance query order by activity name ( ) ;


append the specified indentation to a builder

private void append ( string builder builder , int indent , char c ) { for ( int i = 0 ; i < indent ; i + + ) { builder append ( c ) ; } }


return all interfaces ( and subinterfaces ) on the system

static list < network interface > get interfaces ( ) throws socket exception { list < network interface > all = new array list < > ( ) ; add all interfaces ( all , collections list ( network interface get network interfaces ( ) ) ) ; collections sort ( all , new comparator < network interface > ( ) { @ override public int compare ( network interface left , network interface right ) { return integer compare ( left get index ( ) , right get index ( ) ) ; } } ) ; return all ; }


return the list of nodes whose connection setup has timed out

public list < string > nodes with connection setup timeout ( long now ) { return connecting nodes stream ( ) filter ( id - > is connection setup timeout ( id , now ) ) collect ( collectors to list ( ) ) ; }


public void close ( ) { if ( curator ! = null ) { curator close ( ) ; } }


this test iterates over the test cases table for datanode storage and attempts to startup the data node normally

public void test d n storage states ( ) throws exception { string [ ] base dirs ; / / first setup the datanode storage directory for ( int num dirs = 1 ; num dirs < = 2 ; num dirs + + ) { conf = new hdfs configuration ( ) ; conf set int ( d f s config keys dfs datanode scan period hours key , - 1 ) ; conf = upgrade utilities initialize storage state conf ( num dirs , conf ) ; for ( int i = 0 ; i < num dn test cases ; i + + ) { boolean [ ] test case = test cases [ i ] ; boolean should recover = test case [ should recover ] ; boolean cur after recover = test case [ current should exist after recover ] ; boolean prev after recover = test case [ previous should exist after recover ] ; log ( " data node recovery " , num dirs , i , test case ) ; create name node storage state ( new boolean [ ] { true , true , false , false , false } ) ; cluster = create cluster ( conf ) ; base dirs = create data node storage state ( test case ) ; if ( ! test case [ current exists ] & & ! test case [ previous exists ] & & ! test case [ previous tmp exists ] & & ! test case [ removed tmp exists ] ) { / / data node will create and format current if no directories exist cluster start data nodes ( conf , 1 , false , startup option regular , null ) ; } else { if ( should recover ) { cluster start data nodes ( conf , 1 , false , startup option regular , null ) ; check result data node ( base dirs , cur after recover , prev after recover ) ; } else { cluster start data nodes ( conf , 1 , false , startup option regular , null ) ; assert false ( cluster get data nodes ( ) get ( 0 ) is datanode up ( ) ) ; } } cluster shutdown ( ) ; } / / end test cases loop } / / end num dirs loop }


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 ; }


add a property callback for the specified { @ link key path } this { @ link key path } can resolve to multiple contents in that case , the callback ' s value will apply to all of them internally , this will check if the { @ link key path } has already been resolved with { @ link # resolve key path ( key path ) } and will resolve it if it hasn ' t

public < t > void add value callback ( key path key path , t property , lottie value callback < t > callback ) { lottie drawable add value callback ( key path , property , callback ) ; }


adds a hint that data should be represented using the given class when entering or leaving the table ecosystem a supported conversion class depends on the logical type and its nullability property please see the implementation of { @ link logical type # supports input conversion ( class ) } , { @ link logical type # supports output conversion ( class ) } , or the documentation for more information about supported conversions

t bridged to ( class < ? > new conversion class ) ;


public void update instance ( string namespace id , string service name , instance instance ) throws nacos exception { service service = get service ( namespace id , service name ) ; if ( service = = null ) { throw new nacos exception ( nacos exception invalid param , " service not found , namespace : " + namespace id + " , service : " + service name ) ; } if ( ! service all i ps ( ) contains ( instance ) ) { throw new nacos exception ( nacos exception invalid param , " instance not exist : " + instance ) ; } add instance ( namespace id , service name , instance is ephemeral ( ) , instance ) ; }


get the default value of attribute on the specified annotation

static < t > t get default value ( annotation annotation , string attribute name ) { return get default value ( annotation annotation type ( ) , attribute name ) ; }


public static int get snap count ( ) { return snap count ; }


create a mapping of rules based on rule type and family

private void create rule mapping ( iterable < rule documentation > doc entries , map < string , list multimap < rule type , rule documentation > > rule mapping ) throws build encyclopedia doc exception { for ( rule documentation rule doc : doc entries ) { rule class rule class = rule class provider get rule class map ( ) get ( rule doc get rule name ( ) ) ; if ( rule class ! = null ) { string rule family = rule doc get rule family ( ) ; if ( ! rule mapping contains key ( rule family ) ) { rule mapping put ( rule family , linked list multimap < rule type , rule documentation > create ( ) ) ; } if ( rule class is documented ( ) ) { rule mapping get ( rule family ) put ( rule doc get rule type ( ) , rule doc ) ; } } else { throw rule doc create exception ( " can ' t find rule class for " + rule doc get rule name ( ) ) ; } } }


one or more endpoints associated with the service < code > repeated istio networking v 1alpha 3 service entry endpoint endpoints = 6 ; < code >

public java util list < ? extends com alibaba nacos istio model naming service entry endpoint or builder > get endpoints or builder list ( ) { if ( endpoints builder ! = null ) { return endpoints builder get message or builder list ( ) ; } else { return java util collections unmodifiable list ( endpoints ) ; } }


returns the name of a cascading sub - menu name to use when when showing this provider in the " window " menu if the group name is null , the item will appear in the top - level menu

public string get window sub menu name ( ) { return window menu group ; }


public api response < health check result > fake health get with http info ( ) throws api exception { object local var post body = null ; / / create path and map variables string local var path = " / fake / health " ; / / query params list < pair > local var query params = new array list < pair > ( ) ; map < string , string > local var header params = new hash map < string , string > ( ) ; map < string , string > local var cookie params = new hash map < string , string > ( ) ; map < string , object > local var form params = new hash map < string , object > ( ) ; final string [ ] local var accepts = { " application / json " } ; final string local var accept = api client select header accept ( local var accepts ) ; final string [ ] local var content types = { } ; final string local var content type = api client select header content type ( local var content types ) ; string [ ] local var auth names = new string [ ] { } ; generic type < health check result > local var return type = new generic type < health check result > ( ) { } ; return api client invoke a p i ( " fake api fake health get " , local var path , " get " , local var query params , local var post body , local var header params , local var cookie params , local var form params , local var accept , local var content type , local var auth names , local var return type , false ) ; }


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


return whether to use the message code as default message instead of throwing a no such message exception useful for development and debugging default is " false " alternatively , consider overriding the { @ link # get default message } method to return a custom fallback message for an unresolvable code

protected boolean is use code as default message ( ) { return this use code as default message ; }


public string get type ( ) { return type ; }


public void patch ( string path , route route , response transformer transformer ) { add route ( http method patch , response transformer route impl create ( path , route , transformer ) ) ; }


< code > optional int 6 4 num = 4 ; < code >

public builder set num ( long value ) { bit field 0 | = 0x 0 0 0 0 0 0 0 8 ; num = value ; on changed ( ) ; return this ; }


add additional hidden choices this function can be called multiple times these choices will not be printed in the usage string

public choice parameter add hidden choices ( string hidden choices ) { collections add all ( this hidden choices , hidden choices ) ; return this ; }


creates an xml item this route creates an xml item

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


nn exceptions contain the stack trace as part of the exception message when it ' s a known error , pretty - print the error and squish the stack trace

static string prettify exception ( exception e ) { if ( e get localized message ( ) ! = null ) { return e get class ( ) get simple name ( ) + " : " + e get localized message ( ) split ( " \ n " ) [ 0 ] ; } else if ( e get stack trace ( ) ! = null & & e get stack trace ( ) length > 0 ) { return e get class ( ) get simple name ( ) + " at " + e get stack trace ( ) [ 0 ] ; } else { return e get class ( ) get simple name ( ) ; } }


returns a string representation of the { @ code unsigned integer } value , in base { @ code radix } if { @ code radix < character min radix } or { @ code radix > character max radix } , the radix { @ code 10 } is used

public string to string ( int radix ) { return unsigned ints to string ( value , radix ) ; }


attempts to asynchronously index a snapshot lifecycle management history entry

public void put async ( snapshot history item item ) { if ( slm history enabled = = false ) { logger trace ( " not recording snapshot history item because [ { } ] is [ false ] : [ { } ] " , slm history index enabled setting get key ( ) , item ) ; return ; } logger trace ( " about to index snapshot history item in data stream [ { } ] : [ { } ] " , slm history data stream , item ) ; metadata metadata = cluster service state ( ) get metadata ( ) ; if ( metadata data streams ( ) contains key ( slm history data stream ) = = false & & metadata templates v 2 ( ) contains key ( slm template name ) = = false ) { logger error ( new parameterized message ( " failed to index snapshot history item , data stream [ { } ] and template [ { } ] don ' t exist " , slm history data stream , slm template name ) ) ; return ; } try ( x content builder builder = x content factory json builder ( ) ) { item to x content ( builder , to x content empty params ) ; index request request = new index request ( slm history data stream ) op type ( doc write request op type create ) source ( builder ) ; client index ( request , action listener wrap ( index response - > { logger debug ( " successfully indexed snapshot history item with id [ { } ] in data stream [ { } ] : [ { } ] " , index response get id ( ) , slm history data stream , item ) ; } , exception - > { logger error ( new parameterized message ( " failed to index snapshot history item in data stream [ { } ] : [ { } ] " , slm history data stream , item ) , exception ) ; } ) ) ; } catch ( i o exception exception ) { logger error ( new parameterized message ( " failed to index snapshot history item in data stream [ { } ] : [ { } ] " , slm history data stream , item ) , exception ) ; } }


check the origin and determine the origin for the response the default implementation simply delegates to { @ link cors configuration # check origin ( string ) }

protected string check origin ( cors configuration config , @ nullable string request origin ) { return config check origin ( request origin ) ; }


saves ( see { @ link # save ( object ) } ) the given entities in the database using a transaction

public void save in tx ( t entities ) { save in tx ( arrays as list ( entities ) ) ; }


override this to match self characteristics alone typically , the implementation will use a visitor to extract information to perform matching

protected boolean match self ( metadata reader metadata reader ) { return false ; }


acquires a single permit from this { @ code rate limiter } , blocking until the request can be granted tells the amount of time slept , if any this method is equivalent to { @ code acquire ( 1 ) }

public double acquire ( ) { return acquire ( 1 ) ; }


return the compressed bitmap using scale

public static bitmap compress by scale ( final bitmap src , final float scale width , final float scale height , final boolean recycle ) { return scale ( src , scale width , scale height , recycle ) ; }


finalize the block and close the block file

private void finalize block ( long start time ) throws i o exception { long end time = 0 ; / / hold a volume reference to finalize block try ( replica handler handler = block receiver this claim replica handler ( ) ) { block receiver this close ( ) ; end time = client trace log is info enabled ( ) ? system nano time ( ) : 0 ; block set num bytes ( replica info get num bytes ( ) ) ; datanode data finalize block ( block , dir sync on finalize ) ; } if ( pinning ) { datanode data set pinning ( block ) ; } datanode close block ( block , null , replica info get storage uuid ( ) , replica info is on transient storage ( ) ) ; if ( client trace log is info enabled ( ) & & is client ) { long offset = 0 ; datanode registration dn r = datanode get d n registration for b p ( block get block pool id ( ) ) ; client trace log info ( string format ( dn clienttrace format , in addr , my addr , block get num bytes ( ) , " hdfs write " , clientname , offset , dn r get datanode uuid ( ) , block , end time - start time ) ) ; } else { log info ( " received " + block + " size " + block get num bytes ( ) + " from " + in addr ) ; } }


sets the element at the given index the given element must be immutable

public void set ( int n , annotations a ) { a throw if mutable ( ) ; set 0 ( n , a ) ; }


returns whether this is a single - byte codepoint ( i e , ascii ) with the form ' 0xxxxxxx '

private static boolean is one byte ( byte b ) { return b > = 0 ; }


ensure that zipkin uses the legacy resource path when priority is not set

@ test void check create legacy index template resource path version 7 8 ( ) { server enqueue ( aggregated http response of ( http status ok , media type json utf 8 , " { \ " version \ " : { \ " number \ " : \ " 7 8 0 \ " } } " ) ) ; server enqueue ( success response ) ; / / get span template server enqueue ( success response ) ; / / get dependency template server enqueue ( success response ) ; / / get autocomplete template server enqueue ( success response ) ; / / cluster health storage check ( ) ; server take request ( ) ; / / get version assert that ( server take request ( ) request ( ) path ( ) ) / / get span template starts with ( " / template / zipkin - span template " ) ; assert that ( server take request ( ) request ( ) path ( ) ) / / / / get dependency template starts with ( " / template / zipkin - dependency template " ) ; assert that ( server take request ( ) request ( ) path ( ) ) / / get autocomplete template starts with ( " / template / zipkin - autocomplete template " ) ; }


return true if this enum test object is equal to o

public boolean equals ( object o ) { if ( this = = o ) { return true ; } if ( o = = null | | get class ( ) ! = o get class ( ) ) { return false ; } enum test enum test = ( enum test ) o ; return objects equals ( this enum string , enum test enum string ) & & objects equals ( this enum string required , enum test enum string required ) & & objects equals ( this enum integer , enum test enum integer ) & & objects equals ( this enum number , enum test enum number ) & & objects equals ( this outer enum , enum test outer enum ) & & objects equals ( this outer enum integer , enum test outer enum integer ) & & objects equals ( this outer enum default value , enum test outer enum default value ) & & objects equals ( this outer enum integer default value , enum test outer enum integer default value ) ; }


public void enable motor ( boolean flag ) { joint enable motor ( flag ) ; }


returns the number of line data sets this object contains

public int get data set count ( ) { if ( m data sets = = null ) return 0 ; return m data sets size ( ) ; }


returns the sum of file sizes plus protobuf sizes used to represent this merkle tree

public long get input bytes ( ) { return input bytes ; }


public integer get integer ( ) { return integer ; }


reads from buffer serialized in t binary protocol

public static dependencies from thrift ( byte buffer bytes ) { long start ts = 0l ; long end ts = 0l ; list < dependency link > links = collections empty list ( ) ; read buffer buffer = read buffer wrap unsafe ( bytes ) ; while ( true ) { thrift field thrift field = thrift field read ( buffer ) ; if ( thrift field type = = type stop ) break ; if ( thrift field is equal to ( start ts ) ) { start ts = buffer read long ( ) ; } else if ( thrift field is equal to ( end ts ) ) { end ts = buffer read long ( ) ; } else if ( thrift field is equal to ( links ) ) { int length = thrift codec read list length ( buffer ) ; if ( length = = 0 ) continue ; links = new array list < dependency link > ( length ) ; for ( int i = 0 ; i < length ; i + + ) { links add ( dependency link adapter read ( buffer ) ) ; } } else { skip ( buffer , thrift field type ) ; } } return dependencies create ( start ts , end ts , links ) ; }


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

private void set str ( com android aapt resources string value ) { if ( value = = null ) { throw new null pointer exception ( ) ; } str = value ; bit field 0 | = 0x 0 0 0 0 0 0 0 2 ; }


whether user has enabled development settings

public static boolean is development settings enabled ( ) { return settings global get int ( utils get app ( ) get content resolver ( ) , settings global development settings enabled , 0 ) > 0 ; }


returns the initial vote value of the peer epoch

private long get peer epoch ( ) { if ( self get learner type ( ) = = learner type participant ) { try { return self get current epoch ( ) ; } catch ( i o exception e ) { runtime exception re = new runtime exception ( e get message ( ) ) ; re set stack trace ( e get stack trace ( ) ) ; throw re ; } } else { return long min value ; } }


get the number of properties on this page

int get size ( ) { return key set size ( ) ; }


given a set of votes , return the synced learner tracker which is used to determines if have sufficient to declare the end of the election round

protected synced learner tracker get vote tracker ( map < long , vote > votes , vote vote ) { synced learner tracker vote set = new synced learner tracker ( ) ; vote set add quorum verifier ( self get quorum verifier ( ) ) ; if ( self get last seen quorum verifier ( ) ! = null & & self get last seen quorum verifier ( ) get version ( ) > self get quorum verifier ( ) get version ( ) ) { vote set add quorum verifier ( self get last seen quorum verifier ( ) ) ; } / * * first make the views consistent sometimes peers will have different * zxids for a server depending on timing * / for ( map entry < long , vote > entry : votes entry set ( ) ) { if ( vote equals ( entry get value ( ) ) ) { vote set add ack ( entry get key ( ) ) ; } } return vote set ; }


public int get pending conn size ( ) { return pending conn size ; }


public void rename snapshot ( final i nodes in path iip , final string snapshot root , final string old snapshot name , final string new snapshot name , long now ) throws i o exception { final i node directory src root = get snapshottable root ( iip ) ; src root rename snapshot ( snapshot root , old snapshot name , new snapshot name , now ) ; }


public string get name ( ) { return name ; }


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 " ) ; }


remove all listeners registered with this multicaster after a remove call , the multicaster will perform no action on event notification until new listeners are registered


prepares the matrix that contains all offsets

public void prepare matrix offset ( boolean inverted ) { m matrix offset reset ( ) ; / / offset post translate ( m offset left , get height ( ) - m offset bottom ) ; if ( ! inverted ) m matrix offset post translate ( m view port handler offset left ( ) , m view port handler get chart height ( ) - m view port handler offset bottom ( ) ) ; else { m matrix offset set translate ( m view port handler offset left ( ) , - m view port handler offset top ( ) ) ; m matrix offset post scale ( 1 0f , - 1 0f ) ; } }


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


public list < integer > get prefix array ( ) { return prefix array ; }


open a file for reading through a builder api ultimately calls { @ link # open ( path handle , int ) } unless a subclass executes the open command differently if path handles are unsupported , this may fail in the { @ code f s data input stream builder build ( ) } command , rather than in this { @ code open file ( ) } operation

public future data input stream builder open file ( path handle path handle ) throws i o exception , unsupported operation exception { return create data input stream builder ( this , path handle ) get this builder ( ) ; }


making a { @ link bean factory } available is optional ; if not set , { @ link scheduling configurer } beans won ' t get autodetected and a { @ link # set scheduler scheduler } has to be explicitly configured

public void set bean factory ( bean factory bean factory ) { this bean factory = bean factory ; }


applies a process function to the detected pattern sequence for each pattern sequence the provided { @ link pattern process function } is called in order to process timed out partial matches as well one can use { @ link timed out partial match handler } as additional interface

public < r > single output stream operator < r > process ( final pattern process function < t , r > pattern process function ) { final type information < r > return type = type extractor get unary operator return type ( pattern process function , pattern process function class , 0 , 1 , type extractor no index , builder get input type ( ) , null , false ) ; return process ( pattern process function , return type ) ; }


called when the format of the media being consumed by an audio renderer changes

default void on audio input format changed ( event time event time , format format ) { }


default boolean change ( final credential c , final password change request bean ) throws invalid password exception { return false ; }


this test checks that if a node is re - registered with a new software version after the heartbeat expiry interval but before the heartbeat manager has a chance to detect this and remove it , the node ' s version will still be correctly decremented

public void test num versions correct after reregister ( ) throws i o exception , interrupted exception { / / create the datanode manager which will be tested f s namesystem fsn = mockito mock ( f s namesystem class ) ; mockito when ( fsn has write lock ( ) ) then return ( true ) ; configuration conf = new configuration ( ) ; conf set long ( d f s config keys dfs heartbeat interval key , 0 ) ; conf set long ( d f s config keys dfs namenode heartbeat recheck interval key , 10 ) ; datanode manager dm = mock datanode manager ( fsn , conf ) ; string storage i d = " some storage i d 1 " ; string ip = " some i p " + storage i d ; / / register then reregister the same node but with a different version for ( int i = 0 ; i < = 1 ; i + + ) { dm register datanode ( new datanode registration ( new datanode i d ( ip , " " , storage i d , 9000 , 0 , 0 , 0 ) , null , null , " version " + i ) ) ; if ( i = = 0 ) { thread sleep ( 25 ) ; } } / / verify datanode manager has the correct count map < string , integer > map to check = dm get datanodes software versions ( ) ; assert null ( " should be no more version 0 nodes " , map to check get ( " version 0 " ) ) ; assert equals ( " should be one version 1 node " , map to check get ( " version 1 " ) int value ( ) , 1 ) ; }


gets the { @ link fetch source context } which defines how the source should be fetched

public fetch source context fetch source ( ) { return fetch source context ; }


returns the least of the specified values according to this ordering if there are multiple least values , the first of those is returned < b > java 8 users : < b > if { @ code iterable } is a { @ link collection } , use { @ code collections min ( collection , this comparator ) } instead otherwise , use { @ code streams stream ( iterable ) min ( this comparator ) get ( ) } instead note that these alternatives do not guarantee which tied minimum element is returned )

public < e extends t > e min ( iterable < e > iterable ) { return min ( iterable iterator ( ) ) ; }


waits for threads to finish or error out

public synchronized void wait for ( long millis ) throws exception { long end time = time now ( ) + millis ; while ( should run ( ) & & finished threads size ( ) < test threads size ( ) ) { long left = end time - time now ( ) ; if ( left < = 0 ) break ; check exception ( ) ; wait ( left ) ; } check exception ( ) ; }


static void terminate bits ( int num data bytes , bit array bits ) throws writer exception { int capacity = num data bytes * 8 ; if ( bits get size ( ) > capacity ) { throw new writer exception ( " data bits cannot fit in the qr code " + bits get size ( ) + " > " + capacity ) ; } for ( int i = 0 ; i < 4 & & bits get size ( ) < capacity ; + + i ) { bits append bit ( false ) ; } / / append termination bits see 8 4 8 of jisx0510 : 2004 ( p 24 ) for details / / if the last byte isn ' t 8 - bit aligned , we ' ll add padding bits int num bits in last byte = bits get size ( ) & 0x 0 7 ; if ( num bits in last byte > 0 ) { for ( int i = num bits in last byte ; i < 8 ; i + + ) { bits append bit ( false ) ; } } / / if we have more space , we ' ll fill the space with padding patterns defined in 8 4 9 ( p 24 ) int num padding bytes = num data bytes - bits get size in bytes ( ) ; for ( int i = 0 ; i < num padding bytes ; + + i ) { bits append bits ( ( i & 0x 0 1 ) = = 0 ? 0x e c : 0x 1 1 , 8 ) ; } if ( bits get size ( ) ! = capacity ) { throw new writer exception ( " bits size does not equal capacity " ) ; } }


[ the " bsd license " ] copyright ( c ) 2011 cay horstmann all rights reserved redistribution and use in source and binary forms , with or without modification , are permitted provided that the following conditions are met : 1 redistributions of source code must retain the above copyright notice , this list of conditions and the following disclaimer 2 redistributions in binary form must reproduce the above copyright notice , this list of conditions and the following disclaimer in the documentation andor other materials provided with the distribution 3 the name of the author may not be used to endorse or promote products derived from this software without specific prior written permission this software is provided by the author ` ` as is ' ' and any express or implied warranties , including , but not limited to , the implied warranties of merchantability and fitness for a particular purpose are disclaimed in no event shall the author be liable for any direct , indirect , incidental , special , exemplary , or consequential damages ( including , but not limited to , procurement of substitute goods or services ; loss of use , data , or profits ; or business interruption ) however caused and on any theory of liability , whether in contract , strict liability , or tort ( including negligence or otherwise ) arising in any way out of the use of this software , even if advised of the possibility of such damage

public static void save image ( final j component comp , string file name ) throws i o exception , print exception { if ( file name ends with ( " ps " ) | | file name ends with ( " eps " ) ) { doc flavor flavor = doc flavor service formatted printable ; string mime type = " application / postscript " ; stream print service factory [ ] factories = stream print service factory lookup stream print service factories ( flavor , mime type ) ; system out println ( arrays to string ( factories ) ) ; if ( factories length > 0 ) { file output stream out = new file output stream ( file name ) ; print service service = factories [ 0 ] get print service ( out ) ; simple doc doc = new simple doc ( new printable ( ) { @ override public int print ( graphics g , page format pf , int page ) { if ( page > = 1 ) return printable no such page ; else { graphics 2 d g 2 = ( graphics 2 d ) g ; g 2 translate ( ( pf get width ( ) - pf get imageable width ( ) ) / 2 , ( pf get height ( ) - pf get imageable height ( ) ) / 2 ) ; if ( comp get width ( ) > pf get imageable width ( ) | | comp get height ( ) > pf get imageable height ( ) ) { double sf 1 = pf get imageable width ( ) / ( comp get width ( ) + 1 ) ; double sf 2 = pf get imageable height ( ) / ( comp get height ( ) + 1 ) ; double s = math min ( sf 1 , sf 2 ) ; g 2 scale ( s , s ) ; } comp paint ( g ) ; return printable page exists ; } } } , flavor , null ) ; doc print job job = service create print job ( ) ; print request attribute set attributes = new hash print request attribute set ( ) ; job print ( doc , attributes ) ; out close ( ) ; } } else { / / parrt : works with [ image / jpeg , image / png , image / x - png , image / vnd wap wbmp , image / bmp , image / gif ] rectangle rect = comp get bounds ( ) ; buffered image image = new buffered image ( rect width , rect height , buffered image type int rgb ) ; graphics 2 d g = ( graphics 2 d ) image get graphics ( ) ; g set color ( color white ) ; g fill ( rect ) ; / / g set color ( color black ) ; comp paint ( g ) ; string extension = file name substring ( file name last index of ( ' ' ) + 1 ) ; boolean result = image i o write ( image , extension , new file ( file name ) ) ; if ( ! result ) { system err println ( " now imager for " + extension ) ; } g dispose ( ) ; } }


this implementation returns { @ code null }

public property editor registry get property editor registry ( ) { return null ; }


constructs an { @ link entity descriptor } that contains a single { @ link s p s s o descriptor }

public entity descriptor build ( ) throws exception { final s p s s o descriptor sp role descriptor = new s p s s o descriptor builder ( ) build object ( ) ; sp role descriptor remove all supported protocols ( ) ; sp role descriptor add supported protocol ( s a m l constants saml20p ns ) ; sp role descriptor set want assertions signed ( true ) ; sp role descriptor set authn requests signed ( this authn requests signed ) ; if ( strings is null or empty ( name id format ) = = false ) { sp role descriptor get name i d formats ( ) add ( build name id format ( ) ) ; } sp role descriptor get assertion consumer services ( ) add ( build assertion consumer service ( ) ) ; if ( attribute names size ( ) > 0 ) { sp role descriptor get attribute consuming services ( ) add ( build attribute consumer service ( ) ) ; } if ( strings has text ( single logout service url ) ) { sp role descriptor get single logout services ( ) add ( build single logout service ( ) ) ; } sp role descriptor get key descriptors ( ) add all ( build key descriptors ( ) ) ; final entity descriptor descriptor = new entity descriptor builder ( ) build object ( ) ; descriptor set entity i d ( this entity id ) ; descriptor get role descriptors ( ) add ( sp role descriptor ) ; if ( organization ! = null ) { descriptor set organization ( build organization ( ) ) ; } if ( contacts size ( ) > 0 ) { contacts for each ( c - > descriptor get contact persons ( ) add ( build contact ( c ) ) ) ; } return descriptor ; }


a directory for use by the o s gi framework as a cache

protected static path get cache dir ( ) { return bundle host get osgi dir ( ) resolve ( " felixcache " ) ; }


public bit set compatible regs ( dalv insn insn ) { register spec list regs = insn get registers ( ) ; bit set bits = new bit set ( 2 ) ; int r 0 = regs get ( 0 ) get reg ( ) ; int r 1 = regs get ( 1 ) get reg ( ) ; switch ( regs size ( ) ) { case 2 : { bits set ( 0 , unsigned fits in nibble ( r 0 ) ) ; bits set ( 1 , unsigned fits in nibble ( r 1 ) ) ; break ; } case 3 : { if ( r 0 ! = r 1 ) { bits set ( 0 , false ) ; bits set ( 1 , false ) ; } else { boolean dst reg comp = unsigned fits in nibble ( r 1 ) ; bits set ( 0 , dst reg comp ) ; bits set ( 1 , dst reg comp ) ; } bits set ( 2 , unsigned fits in nibble ( regs get ( 2 ) get reg ( ) ) ) ; break ; } default : { throw new assertion error ( ) ; } } return bits ; }


sorts the elements of { @ code array } between { @ code from index } inclusive and { @ code to index } exclusive in descending order , interpreting them as unsigned 8 - bit integers

public static void sort descending ( byte [ ] array , int from index , int to index ) { check not null ( array ) ; check position indexes ( from index , to index , array length ) ; for ( int i = from index ; i < to index ; i + + ) { array [ i ] ^ = byte max value ; } arrays sort ( array , from index , to index ) ; for ( int i = from index ; i < to index ; i + + ) { array [ i ] ^ = byte max value ; } }


returns the vertices of the graph in pre - order pre - order is the order the vertices are encountered when performing a depth - first traversal

public static < v , e extends g edge < v > > list < v > get vertices in pre order ( g directed graph < v , e > g , graph navigator < v , e > navigator ) { list < v > pre order = depth first sorter pre order ( g , navigator ) ; return pre order ; }


sets the stroke width to be drawn around the circular image view during click events when the selector is enabled

public void set selector stroke width ( int selector stroke width ) { this selector stroke width = selector stroke width ; this request layout ( ) ; this invalidate ( ) ; }


set the time the resource was last changed , as specified by the { @ code last - modified } header the date should be specified as the number of milliseconds since january 1 , 1970 gmt

builder < t > last modified ( instant last modified ) ;


syntactic sugar for : client ( ) prepare index ( index ) set source ( source ) execute ( ) action get ( ) ;

protected final index response index ( string index , x content builder source ) { return client ( ) prepare index ( index ) set source ( source ) execute ( ) action get ( ) ; }


public static object mapper get object mapper ( ) { return mapper ; }


test serialization of outer boolean types

public void fake outer boolean serialize test ( ) throws api exception { boolean body = null ; boolean response = api fake outer boolean serialize ( body ) ; / / todo : test validations }