asserts that { @ link player event listener # on position discontinuity ( int ) } was not called

public void assert no position discontinuities ( ) { assert that ( discontinuity reasons ) is empty ( ) ; }


close the closeable objects and < b > ignore < b > any { @ link throwable } or null pointers must only be used for cleanup in exception handlers

public static void cleanup with logger ( logger logger , java io closeable closeables ) { for ( java io closeable c : closeables ) { if ( c ! = null ) { try { c close ( ) ; } catch ( throwable e ) { if ( logger ! = null ) { logger debug ( " exception in closing { } " , c , e ) ; } } } } }


public static void create table ( database db , boolean if not exists ) { string constraint = if not exists ? " if not exists " : " " ; db exec s q l ( " create table " + constraint + " \ " extends implements entity \ " ( " + / / " \ " id \ " integer primary key , " + / / 0 : id " \ " text \ " text ) ; " ) ; / / 1 : text }


gets selectable multifactor authentication providers

public static list < string > get selectable multifactor authentication providers ( final request context request context ) { return request context get view scope ( ) get ( " mfa selectable providers " , list class ) ; }


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


returns a { @ code comparator < boolean > } that sorts { @ code false } before { @ code true } this is particularly useful in java 8 + in combination with { @ code comparators comparing } , e g { @ code comparators comparing ( foo : : has bar , false first ( ) ) }

public static comparator < boolean > false first ( ) { return boolean comparator false first ; }


declares and initialises a local variable of the specified type

private string append local variable ( string builder buffer , string indent , codegen operation op , codegen variable var , collection < string > local vars , map < string , codegen model > models ) { / / ensure that we ' re using a unique local variable name ( to avoid typing and overwriting conflicts ) string local var = var name ; for ( int i = 2 ; local vars contains ( local var ) ; i + + ) local var = var name + i ; local vars add ( local var ) ; if ( ! load test data from file ) buffer append ( nl ) append ( indent ) append ( var data type ) append ( ' ' ) append ( local var ) append ( " = " ) ; append value ( buffer , indent , op , var , local var , local vars , models ) ; if ( ! load test data from file ) append semicolon ( buffer ) ; return local var ; }


logs a message at the { @ link # deprecation } level the message is also sent to the header warning logger , so that it can be returned to the client

public deprecation logger builder deprecate ( final string key , final string msg , final object params ) { return new deprecation logger builder ( ) with deprecation ( key , msg , params ) ; }


the node id of the node currently acting as a leader for this partition or null if there is no leader

public node leader ( ) { return leader ; }


returns a binder that skips { @ code classes to skip } when identify the calling code the caller ' s { @ link stack trace element } is used to locate the source of configuration errors

binder skip sources ( class < ? > classes to skip ) ;


get the number of elements in this queue added via one of the { @ link # add ( byte buf ) } methods

protected final int size ( ) { return buf and listener pairs size ( ) ; }


get a remote iterator to the open files list managed by name node

public remote iterator < open file entry > list open files ( ) throws i o exception { check open ( ) ; return list open files ( enum set of ( open files type all open files ) , open files iterator filter path default ) ; }


public void add refresh listener ( translog location location , consumer < boolean > listener ) { final boolean read allowed ; if ( is read allowed ( ) ) { read allowed = true ; } else { / / check again under post recovery mutex this is important to create a happens before relationship / / between the switch to post recovery + associated refresh otherwise we may respond / / to a listener before a refresh actually happened that contained that operation synchronized ( post recovery mutex ) { read allowed = is read allowed ( ) ; } } if ( read allowed ) { refresh listeners add or notify ( location , listener ) ; } else { / / we ' re not yet ready fo ready for reads , just ignore refresh cycles listener accept ( false ) ; } }


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


in japanese , the name is written in kanji , which can have multiple readings therefore a hint is often provided , called furigana , which spells the name phonetically

public string get pronunciation ( ) { return pronunciation ; }


get the checksum of a file , if the fs supports checksums

public file checksum get file checksum ( path f ) throws i o exception { return get file checksum ( f , long max value ) ; }


locally sorts the partitions of the data set on the specified field in the specified order data set can be sorted on multiple fields by chaining sort partition ( ) calls

public sort partition operator < t > sort partition ( int field , order order ) { return new sort partition operator < > ( this , field , order , utils get call location name ( ) ) ; }


public abstract file i o channel get channel ( ) ;


set the { @ link database populator } to execute during the bean destruction phase , cleaning up the database and leaving it in a known state for others

public void set database cleaner ( database populator database cleaner ) { this database cleaner = database cleaner ; }


public void parsing proc mem file with bad values ( ) throws i o exception { long mem total = 4058864l ; long mem free = 0l ; / / bad value should return 0 long inactive = 567732l ; long swap total = 2096472l ; long swap free = 0l ; / / bad value should return 0 int nr huge pages = 10 ; string bad free value = " 18446744073709551596 " ; file temp file = new file ( fake memfile ) ; temp file delete on exit ( ) ; file writer f writer = new file writer ( fake memfile ) ; f writer write ( string format ( meminfo format3 , mem total , bad free value , inactive , swap total , bad free value , nr huge pages ) ) ; f writer close ( ) ; assert equals ( plugin get available physical memory size ( ) , 1024l * ( mem free + inactive ) ) ; assert equals ( plugin get available virtual memory size ( ) , 1024l * ( mem free + inactive + swap free ) ) ; assert equals ( plugin get physical memory size ( ) , 1024l * ( mem total - ( nr huge pages * 2048 ) ) ) ; assert equals ( plugin get virtual memory size ( ) , 1024l * ( mem total - ( nr huge pages * 2048 ) + swap total ) ) ; }


gets the opacity from a color inspired by android color drawable

public static int get opacity from color ( int color ) { int color alpha = color > > > 24 ; if ( color alpha = = 255 ) { return pixel format opaque ; } else if ( color alpha = = 0 ) { return pixel format transparent ; } else { return pixel format translucent ; } }


an expectation for checking whether the given frame is available to switch to if the frame is available it switches the given driver to the specified webelement

public static expected condition < web driver > frame to be available and switch to it ( final web element frame locator ) { return new expected condition < web driver > ( ) { @ override public web driver apply ( web driver driver ) { try { return driver switch to ( ) frame ( frame locator ) ; } catch ( no such frame exception e ) { return null ; } } @ override public string to string ( ) { return " frame to be available : " + frame locator ; } } ; }


linearly interpolates between from value to to value on progress position

static public float lerp ( float from value , float to value , float progress ) { return from value + ( to value - from value ) * progress ; }


returns the zip file entry for the specified name , or null if not found

public zip file entry get entry ( string name ) { return zip data get entry ( name ) ; }


provide a standard method for splitting a symbol path into its various namespace and symbol name elements while the current implementation uses a very simplistic approach , this may be improved upon in the future to handle various grouping concepts

public static list < string > split namespace path ( string path ) { return arrays as list ( path trim ( ) split ( namespace delimiter ) ) ; }


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


decide if the given block is a good candidate to move or not

private boolean is good block candidate ( d block block ) { / / source and target must have the same storage type final storage type source storage type = get storage type ( ) ; for ( task t : tasks ) { if ( dispatcher this is good block candidate ( this , t target , source storage type , block ) ) { return true ; } } return false ; }


https : jira spring iobrowse s p r - 2866

public void password value is rendered if show password attribute is set to true ( ) throws exception { this get tag ( ) set path ( " name " ) ; this get password tag ( ) set show password ( true ) ; assert that ( this get tag ( ) do start tag ( ) ) is equal to ( tag skip body ) ; string output = get output ( ) ; assert tag opened ( output ) ; assert tag closed ( output ) ; assert contains attribute ( output , " type " , get type ( ) ) ; assert value attribute ( output , " rob " ) ; }


resource definitions corresponding to an android package < code > repeated aapt pb package package = 2 ; < code >

public builder add package ( com android aapt resources package builder builder for value ) { copy on write ( ) ; instance add package ( builder for value ) ; return this ; }


initialize the metrics for jmx with priority levels

public void init ( int num levels ) { log info ( " initializing rpc stats for { } priority levels " , num levels ) ; queue names for levels = new string [ num levels ] ; processing names for levels = new string [ num levels ] ; for ( int i = 0 ; i < num levels ; i + + ) { queue names for levels [ i ] = get queue name ( i + 1 ) ; processing names for levels [ i ] = get processing name ( i + 1 ) ; } rpc queue rates init ( queue names for levels ) ; rpc processing rates init ( processing names for levels ) ; }


creates a stream joined instance with the provided store suppliers the store suppliers must implement the { @ link window bytes store supplier } interface the store suppliers must provide unique names or a { @ link org apache kafka streams errors streams exception } is thrown

public static < k , v1 , v2 > stream joined < k , v1 , v2 > with ( final window bytes store supplier store supplier , final window bytes store supplier other store supplier ) { return new stream joined < > ( null , null , null , store supplier , other store supplier , null , null , true , new hash map < > ( ) ) ; }


the name of the type this corresponds to the ' type ' part of a full resource name of the form package : typeentry the set of legal type names is listed in resource cpp < code > optional string name = 2 ; < code >

private void set name bytes ( com google protobuf byte string value ) { if ( value = = null ) { throw new null pointer exception ( ) ; } bit field 0 | = 0x 0 0 0 0 0 0 0 2 ; name = value to string utf 8 ( ) ; }


verify that the partitions in an incremental fetch response are contained in the session

string verify incremental fetch response partitions ( fetch response < ? > response ) { set < topic partition > extra = find missing ( response response data ( ) key set ( ) , session partitions key set ( ) ) ; if ( ! extra is empty ( ) ) { string builder bld = new string builder ( ) ; bld append ( " extra = ( " ) append ( utils join ( extra , " , " ) ) append ( " ) , " ) ; bld append ( " response = ( " ) append ( utils join ( response response data ( ) key set ( ) , " , " ) ) append ( " ) , " ) ; return bld to string ( ) ; } return null ; }


add a system property definition - must be used before setting the main entry point

public void sysprop ( string property , string value ) { preconditions check argument ( property ! = null , " null property name " ) ; preconditions check argument ( value ! = null , " null value " ) ; add ( " - d " + property + " = " + value ) ; }


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


returns a { @ code url } pointing to { @ code resource name } if the resource is found using the { @ linkplain thread # get context class loader ( ) context class loader } in simple environments , the context class loader will find resources from the class path in environments where different threads can have different class loaders , for example app servers , the context class loader will typically have been set to an appropriate loader for the current thread in the unusual case where the context class loader is null , the class loader that loaded this class ( { @ code resources } ) will be used instead

public static url get resource ( string resource name ) { final class loader context class loader = thread current thread ( ) get context class loader ( ) ; final class loader loader = context class loader = = null ? resources class get class loader ( ) : context class loader ; final url url = loader get resource ( resource name ) ; if ( url = = null ) { throw new illegal argument exception ( " resource " + resource name + " not found " ) ; } return url ; }


default void parser data binary ( string data binary base 6 4 , list < key value > tags ) { try { log tags log tags = log tags parse from ( base 6 4 get decoder ( ) decode ( data binary base 6 4 ) ) ; log tags get data list ( ) for each ( pair - > tags add ( new key value ( pair get key ( ) , pair get value ( ) ) ) ) ; } catch ( invalid protocol buffer exception e ) { throw new runtime exception ( e ) ; } }


ensures that the joining node has a version that ' s compatible with all current nodes

public static void ensure nodes compatibility ( final version joining node version , discovery nodes current nodes ) { final version min node version = current nodes get min node version ( ) ; final version max node version = current nodes get max node version ( ) ; ensure nodes compatibility ( joining node version , min node version , max node version ) ; }


creates a mutable , empty { @ code linked hash set } instance < b > note : < b > if mutability is not required , use { @ link immutable set # of ( ) } instead < b > note for java 7 and later : < b > this method is now unnecessary and should be treated as deprecated instead , use the { @ code linked hash set } constructor directly , taking advantage of the new < a href = " http : goo gliz 2 wi " > " diamond " syntax

public static < e > linked hash set < e > new linked hash set ( ) { return new linked hash set < e > ( ) ; }


update this holder ' s state with the latest time values

public void update ( date last scheduled execution time , date last actual execution time , date last completion time ) { this last scheduled execution time = last scheduled execution time ; this last actual execution time = last actual execution time ; this last completion time = last completion time ; }


gets the row at the given index note : per isoiec 23271 : 2012 ( e ) iii 1 9 , row indices start from 1 , while heapstream indices start from 0

public cli abstract table row get row ( int row index ) throws index out of bounds exception { return rows get ( row index - 1 ) ; }


gets { @ link update site } by its id used to bind them to url

public update site get by id ( string id ) { for ( update site s : sites ) { if ( s get id ( ) equals ( id ) ) { return s ; } } return null ; }


returns the { @ link socks version } that corresponds to the specified version field value , as defined in the protocol specification

public static socks version value of ( byte b ) { if ( b = = s o c k s 4a byte value ( ) ) { return s o c k s 4a ; } if ( b = = socks5 byte value ( ) ) { return socks5 ; } return unknown ; }


return true if this category 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 ; } category category = ( category ) o ; return objects equals ( this id , category id ) & & objects equals ( this name , category name ) ; }


checks whether the jvm this test is run under is affected by jdk - 8254967 , which causes these tests to fail if a t l sv 1 3 s s l context is used

private static boolean is https server broken with t l sv 1 3 ( ) { return java version current ( ) compare to ( java version parse ( " 16 0 0 " ) ) < 0 ; }


public long total memory ( ) { return this total memory ; }


create a container - managed extended entity manager proxy

public static entity manager create container managed entity manager ( entity manager factory emf , @ nullable map < ? , ? > properties , boolean synchronized with transaction ) { assert not null ( emf , " entity manager factory must not be null " ) ; if ( emf instanceof entity manager factory info ) { entity manager factory info emf info = ( entity manager factory info ) emf ; entity manager raw entity manager = emf info create native entity manager ( properties ) ; return create proxy ( raw entity manager , emf info , true , synchronized with transaction ) ; } else { entity manager raw entity manager = ( ! collection utils is empty ( properties ) ? emf create entity manager ( properties ) : emf create entity manager ( ) ) ; return create proxy ( raw entity manager , null , null , null , null , true , synchronized with transaction ) ; } }


translate an exception raised in an operation into an i o exception http error codes are examined and can be used to build a more specific response

static i o exception translate exception ( final string operation , final string path , final obs exception exception ) { string message = string format ( " % s % s : status [ % d ] - request id [ % s ] " + " - error code [ % s ] - error message [ % s ] - trace : % s " , operation , path ! = null ? " on " + path : " " , exception get response code ( ) , exception get error request id ( ) , exception get error code ( ) , exception get error message ( ) , exception ) ; i o exception ioe ; int status = exception get response code ( ) ; switch ( status ) { case moved permanently code : message = string format ( " received permanent redirect response , " + " status [ % d ] - request id [ % s ] - " + " error code [ % s ] - message [ % s ] " , exception get response code ( ) , exception get error request id ( ) , exception get error code ( ) , exception get error message ( ) ) ; ioe = new o b s i o exception ( message , exception ) ; break ; / / permissions case unauthorized code : case forbidden code : ioe = new access denied exception ( path , null , message ) ; ioe init cause ( exception ) ; break ; / / the object isn ' t there case not found code : case gone code : ioe = new file not found exception ( message ) ; ioe init cause ( exception ) ; break ; / / out of range this may happen if an object is overwritten with / / a shorter one while it is being read case eof code : ioe = new e o f exception ( message ) ; break ; default : / / no specific exit code choose an ioe subclass based on the / / class / / of the caught exception ioe = new o b s i o exception ( message , exception ) ; break ; } return ioe ; }


returns the appropriate { @ code conv } rop for the given types the result is a shared instance

public static rop op conv ( type bearer dest , type bearer source ) { int dbt = dest get basic frame type ( ) ; switch ( source get basic frame type ( ) ) { case type bt int : { switch ( dbt ) { case type bt long : return conv i2l ; case type bt float : return conv i2f ; case type bt double : return conv i2d ; default : break ; } } case type bt long : { switch ( dbt ) { case type bt int : return conv l2i ; case type bt float : return conv l2f ; case type bt double : return conv l2d ; default : break ; } } case type bt float : { switch ( dbt ) { case type bt int : return conv f2i ; case type bt long : return conv f2l ; case type bt double : return conv f2d ; default : break ; } } case type bt double : { switch ( dbt ) { case type bt int : return conv d2i ; case type bt long : return conv d2l ; case type bt float : return conv d2f ; default : break ; } } } return throw bad types ( std type list make ( dest get type ( ) , source get type ( ) ) ) ; }


increments the ref count of this store instance ref counts are used to determine when a store can be closed safely , i e as soon as there are no more references be sure to always call a corresponding { @ link # dec ref } , in a finally clause ; otherwise the store may never be closed note that { @ link # close } simply calls dec ref ( ) , which means that the store will not really be closed until { @ link # dec ref } has been called for all outstanding references note : close can safely be called multiple times

public final void inc ref ( ) { ref counter inc ref ( ) ; }


public outer enum get outer enum ( ) { return outer enum ; }


return the { @ link # set max in memory size configured } byte count limit

public int get max in memory size ( ) { return this max in memory size ; }


test reconfiguration and check the status outputs

private void test data node get reconfiguration status ( boolean expected succuss ) throws i o exception , interrupted exception , timeout exception { reconfiguration util ru = mock ( reconfiguration util class ) ; datanode set reconfiguration util ( ru ) ; list < reconfiguration util property change > changes = new array list < > ( ) ; file new dir = new file ( cluster get data directory ( ) , " data new " ) ; if ( expected succuss ) { new dir mkdirs ( ) ; } else { / / inject failure new dir create new file ( ) ; } changes add ( new reconfiguration util property change ( dfs datanode data dir key , new dir to string ( ) , datanode get conf ( ) get ( dfs datanode data dir key ) ) ) ; changes add ( new reconfiguration util property change ( " random key " , " new 1 2 3 " , " old 4 5 6 " ) ) ; when ( ru parse changed properties ( any ( configuration class ) , any ( configuration class ) ) ) then return ( changes ) ; final int port = datanode get ipc port ( ) ; final string address = " localhost : " + port ; assert that ( admin start reconfiguration ( " datanode " , address ) , is ( 0 ) ) ; final list < string > outs = lists new array list ( ) ; final list < string > errs = lists new array list ( ) ; await reconfiguration finished ( " datanode " , address , outs , errs ) ; if ( expected succuss ) { assert that ( outs size ( ) , is ( 4 ) ) ; } else { assert that ( outs size ( ) , is ( 6 ) ) ; } list < storage location > locations = data node get storage locations ( datanode get conf ( ) ) ; if ( expected succuss ) { assert that ( locations size ( ) , is ( 1 ) ) ; assert that ( new file ( locations get ( 0 ) get uri ( ) ) , is ( new dir ) ) ; / / verify the directory is appropriately formatted assert true ( new file ( new dir , storage storage dir current ) is directory ( ) ) ; } else { assert true ( locations is empty ( ) ) ; } int offset = 1 ; if ( expected succuss ) { assert that ( outs get ( offset ) , contains string ( " success : changed property " + dfs datanode data dir key ) ) ; } else { assert that ( outs get ( offset ) , contains string ( " failed : change property " + dfs datanode data dir key ) ) ; } file dn dir 0 = cluster get instance storage dir ( 0 , 0 ) ; file dn dir 1 = cluster get instance storage dir ( 0 , 1 ) ; assert that ( outs get ( offset + 1 ) , is ( all of ( contains string ( " from : " ) , contains string ( dn dir 0 get name ( ) ) , contains string ( dn dir 1 get name ( ) ) ) ) ) ; assert that ( outs get ( offset + 2 ) , is ( not ( any of ( contains string ( dn dir 0 get name ( ) ) , contains string ( dn dir 1 get name ( ) ) ) ) ) ) ; assert that ( outs get ( offset + 2 ) , is ( all of ( contains string ( " to " ) , contains string ( " data new " ) ) ) ) ; }


convert stack references from old adapter

private void process old adapter stack refs ( task monitor monitor ) throws i o exception , cancelled exception { if ( old stack ref adapter = = null ) { return ; } address map old addr map = addr map get old address map ( ) ; monitor set message ( " processing old stack references " ) ; monitor initialize ( old stack ref adapter get record count ( ) ) ; int cnt = 0 ; record iterator iter = old stack ref adapter get records ( ) ; while ( iter has next ( ) ) { monitor check canceled ( ) ; d b record rec = iter next ( ) ; address from addr = old addr map decode address ( rec get long value ( old stack ref d b adpater from addr col ) ) ; int op index = rec get short value ( old stack ref d b adpater op index col ) ; boolean user defined = rec get boolean value ( old stack ref d b adpater user defined col ) ; int offset = rec get short value ( old stack ref d b adpater stack offset col ) ; add stack reference ( from addr , op index , offset , ref type read , ( user defined ? source type user defined : source type analysis ) ) ; monitor set progress ( + + cnt ) ; } old stack ref adapter = null ; }


returns the proto files that are the direct srcs of the exported dependencies of this rule

private static nested set < proto source > compute public import protos ( immutable list < proto info > exports ) { nested set builder < proto source > result = nested set builder stable order ( ) ; for ( proto info export : exports ) { result add transitive ( export get exported sources ( ) ) ; } return result build ( ) ; }


public void test replace value 2 null pointer exception ( ) { concurrent map c = map ( ) ; try { c replace ( " whatever " , null , " a " ) ; should throw ( ) ; } catch ( null pointer exception success ) { } }


return the kurtosis for the requested field

public double get kurtosis ( string field ) { check field ( field , results kurtosis ) ; return results kurtosis get ( field ) ; }


public void shrink to fit ( ) { super shrink to fit ( ) ; rebuild label to index ( ) ; }


we cannot use value of since the allow from enum differs from its value allow - from this is a helper method that does exactly what valueof does , but allows us to handle the allow from issue gracefully

private static x frame option get enum ( string value ) { preconditions check state ( value ! = null & & ! value is empty ( ) ) ; for ( x frame option xoption : values ( ) ) { if ( value equals ( xoption to string ( ) ) ) { return xoption ; } } throw new illegal argument exception ( " unexpected value in x frame option " ) ; }


generate a suitable string representation

public string to string ( ) { return get value ( ) to string ( ) ; }


public void set image format ( image format image format ) { this m image format = image format ; }


for secure connection , provides a connection spec to specify cipher suite and tls versions by default a modern , http2 - compatible spec will be used this method is only used when building a secure connection for plaintext connection , use { @ link # use plaintext ( ) } instead

public ok http channel builder connection spec ( com squareup okhttp connection spec connection spec ) { preconditions check state ( ! freeze security configuration , " cannot change security when using channel credentials " ) ; preconditions check argument ( connection spec is tls ( ) , " plaintext connection spec is not accepted " ) ; this connection spec = utils convert spec ( connection spec ) ; return this ; }


reads a registered table and returns the resulting { @ link table } a table to scan must be registered in the { @ link table environment } see the documentation of { @ link table environment # use database ( string ) } or { @ link table environment # use catalog ( string ) } for the rules on the path resolution examples : reading a table from default catalog and database { @ code table tab = table env from ( " table name " ) ; } reading a table from a registered catalog { @ code table tab = table env from ( " catalog name db name table name " ) ; } reading a table from a registered catalog with escaping dots in e g a database name must be escaped { @ code table tab = table env from ( " catalog name ` db name ` table " ) ; }


public final content summary compute and convert content summary ( int snapshot id , content summary computation context summary ) throws access control exception { compute content summary ( snapshot id , summary ) ; final content counts counts = summary get counts ( ) ; final content counts snapshot counts = summary get snapshot counts ( ) ; final quota counts q = get quota counts ( ) ; return new content summary builder ( ) length ( counts get length ( ) ) file count ( counts get file count ( ) + counts get symlink count ( ) ) directory count ( counts get directory count ( ) ) quota ( q get name space ( ) ) space consumed ( counts get storagespace ( ) ) space quota ( q get storage space ( ) ) type consumed ( counts get type spaces ( ) ) type quota ( q get type spaces ( ) as array ( ) ) snapshot length ( snapshot counts get length ( ) ) snapshot file count ( snapshot counts get file count ( ) ) snapshot directory count ( snapshot counts get directory count ( ) ) snapshot space consumed ( snapshot counts get storagespace ( ) ) erasure coding policy ( summary get erasure coding policy name ( this ) ) build ( ) ; }


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

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


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


asserts that a message was propagated inbound through the channel

private static < t extends web socket frame > void assert propagated inbound ( t message , embedded channel channel ) { t propagated response = channel read inbound ( ) ; assert equals ( message , propagated response ) ; }


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


gets the format to use on the output of this aggregation

public string format ( ) { return format ; }


loads the map data , given the xml root element and an { @ link image resolver } used to return the tileset textures

private tiled map load map ( element root , file handle tmx file , image resolver image resolver ) { tiled map map = new tiled map ( ) ; element properties = root get child by name ( " properties " ) ; if ( properties ! = null ) { load properties ( map get properties ( ) , properties ) ; } element tilesheets = root get child by name ( " tile sheets " ) ; for ( element tilesheet : tilesheets get children by name ( " tile sheet " ) ) { load tile sheet ( map , tilesheet , tmx file , image resolver ) ; } element layers = root get child by name ( " layers " ) ; for ( element layer : layers get children by name ( " layer " ) ) { load layer ( map , layer ) ; } return map ; }


checks if the user can access a path the mode specifies which access checks to perform if the requested permissions are granted , then the method returns normally if access is denied , then the method throws an { @ link access control exception } the default implementation of this method calls { @ link # get file status ( path ) } and checks the returned permissions against the requested permissions note that the get file status call will be subject to authorization checks typically , this requires search ( execute ) permissions on each directory in the path ' s prefix , but this is implementation - defined any file system that provides a richer authorization model ( such as a c ls ) may override the default implementation so that it checks against that model instead in general , applications should avoid using this method , due to the risk of time - of - checktime - of - use race conditions the permissions on a file may change immediately after the access call returns most applications should prefer running specific file system actions as the desired user represented by a { @ link user group information }

public void access ( final path path , final fs action mode ) throws access control exception , file not found exception , unsupported file system exception , i o exception { final path abs path = fix relative part ( path ) ; new f s link resolver < void > ( ) { @ override public void next ( abstract file system fs , path p ) throws i o exception , unresolved link exception { fs access ( p , mode ) ; return null ; } } resolve ( this , abs path ) ; }


required : a list of server specifications < code > repeated istio networking v 1alpha 3 server servers = 1 ; < code >

public int get servers count ( ) { if ( servers builder = = null ) { return servers size ( ) ; } else { return servers builder get count ( ) ; } }


returns an unmodifiable view of the specified sorted multiset query operations on the returned multiset " read through " to the specified multiset , and attempts to modify the returned multiset result in an { @ link unsupported operation exception } the returned multiset will be serializable if the specified multiset is serializable

public static < e > sorted multiset < e > unmodifiable sorted multiset ( sorted multiset < e > sorted multiset ) { / / it ' s in its own file so it can be emulated for gwt return new unmodifiable sorted multiset < e > ( check not null ( sorted multiset ) ) ; }


public void dispose ( ) { program release ( this ) ; }


private void adjust array ( int size ) { if ( size < min size ) { size = min size ; } byte [ ] new bytes = new byte [ size ] ; int len = math min ( size , bytes length ) ; system arraycopy ( bytes , 0 , new bytes , 0 , len ) ; bytes = new bytes ; }


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

public boolean is set ( fields field ) { if ( field = = null ) { throw new illegal argument exception ( ) ; } switch ( field ) { case id : return is set id ( ) ; } throw new illegal state exception ( ) ; }


creates an android manifest object , with correct preprocessing , from explicit variables attributes included in the rule context will not be used ; use { @ link # from attributes ( rule context , android data context ) } instead in addition , the android semantics - specific manifest processing methods will not be applied in this method the manifest returned by this method will be the same regardless of the android semantics being used use { @ link # from attributes ( rule context , android data context , android semantics ) } instead if you want android semantics - specific behavior

public static android manifest from ( android data context data context , rule error consumer error consumer , @ nullable artifact raw manifest , @ nullable string pkg , boolean exports manifest ) throws interrupted exception { return from ( data context , error consumer , raw manifest , null , pkg , exports manifest ) ; }


return the number of idle objects in the pool

int get idle count ( ) throws unsupported operation exception ;


determines whether a character is a bmp letter according to { @ linkplain character # is letter ( char ) java ' s definition } if you only care to match letters of the latin alphabet , you can use { @ code in range ( ' a ' , ' z ' ) or ( in range ( ' a ' , ' z ' ) ) }

public static char matcher java letter ( ) { return java letter instance ; }


return the symbol for the specified n list looks in the global namespace first

protected symbol get symbol ( n list n list ) { symbol table symbol table = program get symbol table ( ) ; symbol iterator symbol iterator = symbol table get symbols ( n list get string ( ) ) ; if ( symbol iterator has next ( ) ) { return symbol iterator next ( ) ; } return null ; }


insert a failiure injection point for a read call @ throw i o exception , as codepath is on input stream , not other sdk call

private void read failpoint ( int off , int len ) throws i o exception { if ( should inject failure ( get key ( ) ) ) { string error = string format ( " read ( b , % d , % d ) on key % s failed : injecting error % d / % d " + " for test " , off , len , get key ( ) , read failure counter , max read failures ) ; throw new file not found exception ( error ) ; } }


schedule blocks for deletion at datanodes

int compute invalidate work ( int nodes to process ) { final list < datanode info > nodes = invalidate blocks get datanodes ( ) ; collections shuffle ( nodes ) ; nodes to process = math min ( nodes size ( ) , nodes to process ) ; int block cnt = 0 ; for ( datanode info dn info : nodes ) { int blocks = invalidate work for one node ( dn info ) ; if ( blocks > 0 ) { block cnt + = blocks ; if ( - - nodes to process = = 0 ) { break ; } } } return block cnt ; }


test that the exception arose in the thread pool will rethrow to the main thread

public void test multi thread upload thread pool exception rethrow ( ) throws i o exception { specified exception expected exception = new specified exception ( " throw exception while multi thread upload states " ) ; checkpoint stream factory checkpoint state output stream output stream = create failing checkpoint state output stream ( expected exception ) ; checkpoint stream factory checkpoint stream factory = ( checkpointed state scope scope ) - > output stream ; file file = temporary folder new file ( string value of ( uuid random u u i d ( ) ) ) ; generate random file content ( file get path ( ) , 20 ) ; map < state handle i d , path > file paths = new hash map < > ( 1 ) ; file paths put ( new state handle i d ( " mock handle i d " ) , file to path ( ) ) ; try ( rocks d b state uploader rocks d b state uploader = new rocks d b state uploader ( 5 ) ) { rocks d b state uploader upload files to checkpoint fs ( file paths , checkpoint stream factory , new closeable registry ( ) ) ; fail ( ) ; } catch ( exception e ) { assert equals ( expected exception , e ) ; } }


set the executor ( in the form of an { @ link event loop } ) which jmh will use this must be called before jmh requires an executor to execute objects

public static void executor ( event loop service ) { executor = service ; }


copy an object then , if the copy worked , delete it if the copy failed , the source object is not deleted

private void copy then delete object ( swift object path src object , swift object path dest object ) throws i o exception { / / do the copy copy object ( src object , dest object ) ; / / getting here means the copy worked swift rest client delete ( src object ) ; }


@ @ org springframework jmx export metadata managed attribute ( description = " the name attribute " , currency time limit = 20 , default value = " bar " , persist policy = " on update " )

public void set name ( string name ) throws exception { if ( " juergen " equals ( name ) ) { throw new illegal argument exception ( " juergen " ) ; } if ( " juergen class " equals ( name ) ) { throw new class not found exception ( " juergen " ) ; } if ( " juergen io " equals ( name ) ) { throw new i o exception ( " juergen " ) ; } this name = name ; }


public j spinner get spinner ( ) { return spinner ; }


asynchronous version of { @ link query # unique ( ) }

public async operation query unique ( query < ? > query , int flags ) { return enqueue database operation ( operation type query unique , query , flags ) ; }


default response entity < void > test body with query params ( @ not null @ api param ( value = " " , required = true ) @ valid @ request param ( value = " query " , required = true ) string query , @ api param ( value = " " , required = true ) @ valid @ request body user body ) { return new response entity < > ( http status not implemented ) ; }


subclasses can override this method to implement interruption of the future ' s computation the method is invoked automatically by a successful call to { @ link # cancel ( boolean ) cancel ( true ) } the default implementation does nothing


stops the pool of workers this is a blocking call to wait for all tasks to be completed

public void close ( ) { service shutdown ( ) ; try { service await termination ( 10 , time unit seconds ) ; } catch ( interrupted exception ie ) { logger error ( " error waiting for executor service shutdown ! " ) ; } }


set the < code > resource name < code > of the request

public resource request builder resource name ( string resource name ) { resource request set resource name ( resource name ) ; return this ; }


returns true if this array contains the specified element

public boolean contains ( json element element ) { return elements contains ( element ) ; }


advise that the first block replica be written without regard to the client locality

public hdfs data output stream builder ignore client locality ( ) { get flags ( ) add ( create flag ignore client locality ) ; return this ; }


this simlulates a long server operation multiple threads start an operation that takes long time and finally fails the retries in this case end up waiting for the current operation to complete all the retries end up performing the operation again

public void test long operations failure ( ) throws exception { / / test long failed operations / / there is no entry in cache expected when the first operation starts test operations ( r next int ( ) , 100 , 20 , false , false , new call ( ) ) ; }


called when the wrapped { @ link activity behavior } calls the { @ link abstract bpmn activity behavior # leave ( delegate execution ) } method handles the completion of one instance , and executes the logic for the sequential behavior

public void leave ( delegate execution child execution ) { delegate execution multi instance root execution = get multi instance root execution ( child execution ) ; int nr of instances = get loop variable ( multi instance root execution , number of instances ) ; int loop counter = get loop variable ( child execution , get collection element index variable ( ) ) + 1 ; int nr of completed instances = get loop variable ( multi instance root execution , number of completed instances ) + 1 ; int nr of active instances = get loop variable ( multi instance root execution , number of active instances ) ; set loop variable ( multi instance root execution , number of completed instances , nr of completed instances ) ; set loop variable ( child execution , get collection element index variable ( ) , loop counter ) ; log loop details ( child execution , " instance completed " , loop counter , nr of completed instances , nr of active instances , nr of instances ) ; update result collection ( child execution , multi instance root execution ) ; context get command context ( ) get history manager ( ) record activity end ( ( execution entity ) child execution , null ) ; call activity end listeners ( child execution ) ; if ( loop counter > = nr of instances | | completion condition satisfied ( multi instance root execution ) ) { propagate loop data output ref to process instance ( ( execution entity ) multi instance root execution ) ; remove local loop variable ( child execution , get collection element index variable ( ) ) ; multi instance root execution set multi instance root ( false ) ; multi instance root execution set scope ( false ) ; multi instance root execution set current flow element ( child execution get current flow element ( ) ) ; context get command context ( ) get execution entity manager ( ) delete child executions ( ( execution entity ) multi instance root execution , " mi end " ) ; dispatch activity completed event ( child execution ) ; super leave ( multi instance root execution ) ; } else { try { if ( child execution get current flow element ( ) instanceof sub process ) { execution entity manager execution entity manager = context get command context ( ) get execution entity manager ( ) ; execution entity execution to continue = execution entity manager create child execution ( ( execution entity ) multi instance root execution ) ; execution to continue set current flow element ( child execution get current flow element ( ) ) ; execution to continue set scope ( true ) ; set loop variable ( execution to continue , get collection element index variable ( ) , loop counter ) ; execute original behavior ( execution to continue , loop counter ) ; } else { execute original behavior ( child execution , loop counter ) ; } dispatch activity completed event ( child execution ) ; } catch ( bpmn error error ) { / / re - throw business fault so that it can be caught by an error / / intermediate event or error event sub - process in the process throw error ; } catch ( exception e ) { throw new activiti exception ( " could not execute inner activity behavior of multi instance behavior " , e ) ; } } }


copy block references into the snapshot up to the current { @ link # file size } should be done only once

public void set blocks ( block info [ ] blocks ) { if ( this blocks ! = null ) return ; int num blocks = 0 ; for ( long s = 0 ; num blocks < blocks length & & s < file size ; num blocks + + ) s + = blocks [ num blocks ] get num bytes ( ) ; this blocks = arrays copy of ( blocks , num blocks ) ; }


public static string int to ipv 4 string ( int i ) { return new string builder ( 15 ) append ( ( i > > 24 ) & 0xff ) append ( ' ' ) append ( ( i > > 16 ) & 0xff ) append ( ' ' ) append ( ( i > > 8 ) & 0xff ) append ( ' ' ) append ( i & 0xff ) to string ( ) ; }


set the jndi template to use for jndi lookups

public void set jndi template ( jndi template jndi template ) { this jndi locator set jndi template ( jndi template ) ; }


returns a new token object , by default however , if you want , you can create and return subclass objects based on the value of of kind simply add the cases to the switch for all those special cases for example , if you have a subclass of token called i d token that you want to create if of kind is id , simply add something like : < p > case my parser constants id : return new i d token ( of kind , image ) ; < p > to the following switch statement then you can cast matched token variable to the appropriate type and use sit in your lexical actions

public static token new token ( int of kind , string image ) { switch ( of kind ) { default : return new token ( of kind , image ) ; } }


gets the declared output fields for the specified global stream id

public fields get component output fields ( global stream id id ) { return get component output fields ( id get component id ( ) , id get stream id ( ) ) ; }


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


tests finding n recent valid snapshots from set of snapshots and data logs

public void test find n valid snapshots ( ) throws exception { int n recent snap = 4 ; / / n recent snap shots int n recent count = 30 ; int offset = 0 ; file version 2 = new file ( tmp dir to string ( ) , " version - 2 " ) ; assert true ( version 2 mkdir ( ) , " failed to create version 2 dir : " + version 2 to string ( ) ) ; / / test that with no snaps , find n valid snapshots returns empty list file txn snap log txn log = new file txn snap log ( tmp dir , tmp dir ) ; list < file > found snaps = txn log find n valid snapshots ( 1 ) ; assert equals ( 0 , found snaps size ( ) ) ; list < file > expected n recent snap files = new array list < file > ( ) ; int counter = offset + ( 2 * n recent count ) ; for ( int i = 0 ; i < n recent count ; i + + ) { / / simulate log file file log file = new file ( version 2 + " / log " + long to hex string ( - - counter ) ) ; assert true ( log file create new file ( ) , " failed to create log file : " + log file to string ( ) ) ; / / simulate snapshot file file snap file = new file ( version 2 + " / snapshot " + long to hex string ( - - counter ) ) ; assert true ( snap file create new file ( ) , " failed to create snap file : " + snap file to string ( ) ) ; make valid snapshot ( snap file ) ; / / add the n recent snap files for assertion if ( i < n recent snap ) { expected n recent snap files add ( snap file ) ; } } / / test that when we ask for recent snaps we get the number we asked for and / / the files we expected list < file > n recent valid snap files = txn log find n valid snapshots ( n recent snap ) ; assert equals ( 4 , n recent valid snap files size ( ) , " exactly 4 snapshots " ) ; expected n recent snap files remove all ( n recent valid snap files ) ; assert equals ( 0 , expected n recent snap files size ( ) , " didn ' t get the recent snap files " ) ; / / test that when asking for more snaps than we created , we still only get snaps / / not logs or anything else ( per zookeeper - 2420 ) n recent valid snap files = txn log find n valid snapshots ( n recent count + 5 ) ; assert equals ( n recent count , n recent valid snap files size ( ) ) ; for ( file f : n recent valid snap files ) { assert true ( ( util get zxid from name ( f get name ( ) , " snapshot " ) ! = - 1 ) , " find n valid snapshots ( ) returned a non - snapshot : " + f get path ( ) ) ; } txn log close ( ) ; }


gets the transform of the viewport , transforms around the center not a copy

public mat 2 2 get transform ( ) { return box r ; }


allocates a { @ value # default buffer size } byte [ ] for use as a temporary buffer and calls { @ link # copy stream ( input stream , output stream , byte [ ] ) }

public static void copy stream ( input stream input , output stream output ) throws i o exception { copy stream ( input , output , new byte [ default buffer size ] ) ; }


test that the indexed shape routing can be provided if it is required

public void test index shape routing ( ) throws exception { string mapping = " { \ " doc \ " : { \ n " + " \ " routing \ " : { \ n " + " \ " required \ " : true \ n " + " } , \ n " + " \ " properties \ " : { \ n " + " \ " shape \ " : { \ n " + " \ " type \ " : \ " geo shape \ " , \ n " + " \ " tree \ " : \ " quadtree \ " \ n " + " } \ n " + " } \ n " + " } } " ; / / create index assert acked ( client ( ) admin ( ) indices ( ) prepare create ( " test " ) set mapping ( mapping ) get ( ) ) ; ensure green ( ) ; string source = " { \ n " + " \ " shape \ " : { \ n " + " \ " type \ " : \ " bbox \ " , \ n " + " \ " coordinates \ " : [ [ - 45 0 , 45 0 ] , [ 45 0 , - 45 0 ] ] \ n " + " } \ n " + " } " ; index random ( true , client ( ) prepare index ( " test " ) set id ( " 0 " ) set source ( source , x content type json ) set routing ( " abc " ) ) ; search response search response = client ( ) prepare search ( " test " ) set query ( geo shape query ( " shape " , " 0 " ) indexed shape index ( " test " ) indexed shape routing ( " abc " ) ) get ( ) ; assert that ( search response get hits ( ) get total hits ( ) value , equal to ( 1l ) ) ; }


allocate a buffer of the given size this method blocks if there is not enough memory and the buffer pool is configured with blocking mode

public byte buffer allocate ( int size , long max time to block ms ) throws interrupted exception { if ( size > this total memory ) throw new illegal argument exception ( " attempt to allocate " + size + " bytes , but there is a hard limit of " + this total memory + " on memory allocations " ) ; byte buffer buffer = null ; this lock lock ( ) ; if ( this closed ) { this lock unlock ( ) ; throw new kafka exception ( " producer closed while allocating memory " ) ; } try { / / check if we have a free buffer of the right size pooled if ( size = = poolable size & & ! this free is empty ( ) ) return this free poll first ( ) ; / / now check if the request is immediately satisfiable with the / / memory on hand or if we need to block int free list size = free size ( ) * this poolable size ; if ( this non pooled available memory + free list size > = size ) { / / we have enough unallocated or pooled memory to immediately / / satisfy the request , but need to allocate the buffer free up ( size ) ; this non pooled available memory - = size ; } else { / / we are out of memory and will have to block int accumulated = 0 ; condition more memory = this lock new condition ( ) ; try { long remaining time to block ns = time unit milliseconds to nanos ( max time to block ms ) ; this waiters add last ( more memory ) ; / / loop over and over until we have a buffer or have reserved / / enough memory to allocate one while ( accumulated < size ) { long start wait ns = time nanoseconds ( ) ; long time ns ; boolean waiting time elapsed ; try { waiting time elapsed = ! more memory await ( remaining time to block ns , time unit nanoseconds ) ; } finally { long end wait ns = time nanoseconds ( ) ; time ns = math max ( 0l , end wait ns - start wait ns ) ; record wait time ( time ns ) ; } if ( this closed ) throw new kafka exception ( " producer closed while allocating memory " ) ; if ( waiting time elapsed ) { this metrics sensor ( " buffer - exhausted - records " ) record ( ) ; throw new buffer exhausted exception ( " failed to allocate memory within the configured max blocking time " + max time to block ms + " ms " ) ; } remaining time to block ns - = time ns ; / / check if we can satisfy this request from the free list , / / otherwise allocate memory if ( accumulated = = 0 & & size = = this poolable size & & ! this free is empty ( ) ) { / / just grab a buffer from the free list buffer = this free poll first ( ) ; accumulated = size ; } else { / / we ' ll need to allocate memory , but we may only get / / part of what we need on this iteration free up ( size - accumulated ) ; int got = ( int ) math min ( size - accumulated , this non pooled available memory ) ; this non pooled available memory - = got ; accumulated + = got ; } } / / don ' t reclaim memory on throwable since nothing was thrown accumulated = 0 ; } finally { / / when this loop was not able to successfully terminate don ' t loose available memory this non pooled available memory + = accumulated ; this waiters remove ( more memory ) ; } } } finally { / / signal any additional waiters if there is more memory left / / over for them try { if ( ! ( this non pooled available memory = = 0 & & this free is empty ( ) ) & & ! this waiters is empty ( ) ) this waiters peek first ( ) signal ( ) ; } finally { / / another finally otherwise find bugs complains lock unlock ( ) ; } } if ( buffer = = null ) return safe allocate byte buffer ( size ) ; else return buffer ; }


test to verify that server is able to start with valid credentials

public void test valid credentials ( ) throws exception { map < string , string > auth configs = new hash map < string , string > ( ) ; auth configs put ( quorum auth quorum sasl auth enabled , " true " ) ; auth configs put ( quorum auth quorum server sasl auth required , " true " ) ; auth configs put ( quorum auth quorum learner sasl auth required , " true " ) ; string connect str = start quorum ( 3 , auth configs , 3 ) ; countdown watcher watcher = new countdown watcher ( ) ; zoo keeper zk = new zoo keeper ( connect str , client base connection timeout , watcher ) ; watcher wait for connected ( client base connection timeout ) ; for ( int i = 0 ; i < 10 ; i + + ) { zk create ( " / " + i , new byte [ 0 ] , ids open acl unsafe , create mode persistent ) ; } zk close ( ) ; }


public spout declarer set spout ( string id , i rich spout spout ) { return set spout ( id , spout , null ) ; }


reboot the device requires root permission or hold { @ code android : shared user id = " android uid system " } , { @ code < uses - permission android : name = " android permission reboot " > }

public static boolean reboot ( final string reason ) { try { power manager pm = ( power manager ) utils get app ( ) get system service ( context power service ) ; pm reboot ( reason ) ; return true ; } catch ( exception e ) { return false ; } }


create a builder with the status code and headers of the given response

static body builder from ( server response other ) { return new default server response builder ( other ) ; }


test that a structure can contain a pointer in it to a typedef of the same structure

public void test no cyclic dependency problem for typedef pointer ( ) { type def type def = create type def ( struct ) ; pointer typedef pointer = create pointer ( type def , 4 ) ; try { struct add ( typedef pointer ) ; } catch ( illegal argument exception e ) { assert fail ( " should be able to add a structure typedef pointer to the pointer ' s structure " ) ; } try { struct insert ( 0 , typedef pointer ) ; } catch ( illegal argument exception e ) { assert fail ( " should be able to insert a structure typedef pointer into the pointer ' s structure " ) ; } try { struct replace ( 0 , typedef pointer , typedef pointer get length ( ) ) ; } catch ( illegal argument exception e ) { assert fail ( " should be able to replace a structure component with the structure ' s typedef pointer " ) ; } pointer p = ( pointer ) struct get component ( 0 ) get data type ( ) ; typedef data type data type = ( typedef data type ) p get data type ( ) ; assert equals ( data type , type def ) ; assert equals ( data type get base data type ( ) , struct ) ; }


loads a single glyph to the backing texture , if it fits

private boolean render glyph ( glyph glyph , int page x , int page y , int width , int height ) { scratch graphics set composite ( alpha composite clear ) ; scratch graphics fill rect ( 0 , 0 , max glyph size , max glyph size ) ; scratch graphics set composite ( alpha composite src over ) ; byte buffer glyph pixels = scratch byte buffer ; int format ; if ( unicode font get render type ( ) = = render type free type & & unicode font bitmap font ! = null ) { bitmap font data data = unicode font bitmap font get data ( ) ; bitmap font glyph g = data get glyph ( ( char ) glyph get code point ( ) ) ; pixmap font pixmap = unicode font bitmap font get regions ( ) get ( g page ) get texture ( ) get texture data ( ) consume pixmap ( ) ; int font width = font pixmap get width ( ) ; int pad top = unicode font get padding top ( ) , pad bottom = unicode font get padding bottom ( ) ; int pad left bytes = unicode font get padding left ( ) * 4 ; int pad x bytes = pad left bytes + unicode font get padding right ( ) * 4 ; int glyph row bytes = width * 4 , font row bytes = g width * 4 ; byte buffer font pixels = font pixmap get pixels ( ) ; byte [ ] row = new byte [ glyph row bytes ] ; glyph pixels position ( 0 ) ; for ( int i = 0 ; i < pad top ; i + + ) glyph pixels put ( row ) ; glyph pixels position ( ( height - pad bottom ) * glyph row bytes ) ; for ( int i = 0 ; i < pad bottom ; i + + ) glyph pixels put ( row ) ; glyph pixels position ( pad top * glyph row bytes ) ; for ( int y = 0 , n = g height ; y < n ; y + + ) { font pixels position ( ( ( g src y + y ) * font width + g src x ) * 4 ) ; font pixels get ( row , pad left bytes , font row bytes ) ; glyph pixels put ( row ) ; } font pixels position ( 0 ) ; glyph pixels position ( height * glyph row bytes ) ; glyph pixels flip ( ) ; format = gl11 gl rgba ; } else { / / draw the glyph to the scratch image using java 2 d if ( unicode font get render type ( ) = = render type native ) { for ( iterator iter = unicode font get effects ( ) iterator ( ) ; iter has next ( ) ; ) { effect effect = ( effect ) iter next ( ) ; if ( effect instanceof color effect ) scratch graphics set color ( ( ( color effect ) effect ) get color ( ) ) ; } scratch graphics set color ( java awt color white ) ; scratch graphics set font ( unicode font get font ( ) ) ; scratch graphics draw string ( " " + ( char ) glyph get code point ( ) , 0 , unicode font get ascent ( ) ) ; } else if ( unicode font get render type ( ) = = render type java ) { scratch graphics set color ( java awt color white ) ; for ( iterator iter = unicode font get effects ( ) iterator ( ) ; iter has next ( ) ; ) ( ( effect ) iter next ( ) ) draw ( scratch image , scratch graphics , unicode font , glyph ) ; glyph set shape ( null ) ; / / the shape will never be needed again } width = math min ( width , texture get width ( ) ) ; height = math min ( height , texture get height ( ) ) ; writable raster raster = scratch image get raster ( ) ; int [ ] row = new int [ width ] ; for ( int y = 0 ; y < height ; y + + ) { raster get data elements ( 0 , y , width , 1 , row ) ; scratch int buffer put ( row ) ; } format = gl12 gl bgra ; } / / simple deduplication , doesn ' t work across pages of course string hash = " " ; try { message digest md = message digest get instance ( " sha - 256 " ) ; md update ( glyph pixels ) ; big integer big int = new big integer ( 1 , md digest ( ) ) ; hash = big int to string ( 16 ) ; } catch ( no such algorithm exception ex ) { } scratch byte buffer clear ( ) ; scratch int buffer clear ( ) ; try { for ( int i = 0 , n = hashes size ( ) ; i < n ; i + + ) { string other = hashes get ( i ) ; if ( other equals ( hash ) ) { glyph dupe = page glyphs get ( i ) ; glyph set texture ( dupe texture , dupe u , dupe v , dupe u 2 , dupe v 2 ) ; return false ; } } } finally { hashes add ( hash ) ; page glyphs add ( glyph ) ; } gdx gl gl tex sub image 2 d ( texture gl target , 0 , page x , page y , width , height , format , gl11 gl unsigned byte , glyph pixels ) ; float u = page x / ( float ) texture get width ( ) ; float v = page y / ( float ) texture get height ( ) ; float u 2 = ( page x + width ) / ( float ) texture get width ( ) ; float v 2 = ( page y + height ) / ( float ) texture get height ( ) ; glyph set texture ( texture , u , v , u 2 , v 2 ) ; return true ; }


notifies this view updater of a new metric that should be regularly updated

public void notify of added view ( view view ) { synchronized ( lock ) { to add add ( view ) ; } }


setup the expected exception class , and exception message that the test is supposed to fail with

protected void set expected failure message ( string operation , path path ) { expected ex expect ( wasb authorization exception class ) ; expected ex expect message ( string format ( " % s operation for path : % s not allowed " , operation , path make qualified ( fs get uri ( ) , fs get working directory ( ) ) ) ) ; }


make sure that a request using a deterministic script or not using a script get cached ensure requests using nondeterministic scripts do not get cached

public void test script caching ( ) throws exception { assert acked ( prepare create ( " cache test idx " ) set mapping ( " d " , " type = long " ) set settings ( settings builder ( ) put ( " requests cache enable " , true ) put ( " number of shards " , 1 ) put ( " number of replicas " , 1 ) ) get ( ) ) ; index random ( true , client ( ) prepare index ( " cache test idx " ) set id ( " 1 " ) set source ( " s " , 1 ) , client ( ) prepare index ( " cache test idx " ) set id ( " 2 " ) set source ( " s " , 2 ) ) ; / / make sure we are starting with a clear cache assert that ( client ( ) admin ( ) indices ( ) prepare stats ( " cache test idx " ) set request cache ( true ) get ( ) get total ( ) get request cache ( ) get hit count ( ) , equal to ( 0l ) ) ; assert that ( client ( ) admin ( ) indices ( ) prepare stats ( " cache test idx " ) set request cache ( true ) get ( ) get total ( ) get request cache ( ) get miss count ( ) , equal to ( 0l ) ) ; / / test that a request using a nondeterministic script does not get cached search response r = client ( ) prepare search ( " cache test idx " ) set size ( 0 ) add aggregation ( random builder ( ) field ( " d " ) script ( new script ( script type inline , aggregation test scripts plugin name , " math random ( ) " , empty map ( ) ) ) ) get ( ) ; assert search response ( r ) ; assert that ( client ( ) admin ( ) indices ( ) prepare stats ( " cache test idx " ) set request cache ( true ) get ( ) get total ( ) get request cache ( ) get hit count ( ) , equal to ( 0l ) ) ; assert that ( client ( ) admin ( ) indices ( ) prepare stats ( " cache test idx " ) set request cache ( true ) get ( ) get total ( ) get request cache ( ) get miss count ( ) , equal to ( 0l ) ) ; / / test that a request using a deterministic script gets cached r = client ( ) prepare search ( " cache test idx " ) set size ( 0 ) add aggregation ( random builder ( ) field ( " d " ) script ( new script ( script type inline , aggregation test scripts plugin name , " value - 1 " , empty map ( ) ) ) ) get ( ) ; assert search response ( r ) ; assert that ( client ( ) admin ( ) indices ( ) prepare stats ( " cache test idx " ) set request cache ( true ) get ( ) get total ( ) get request cache ( ) get hit count ( ) , equal to ( 0l ) ) ; assert that ( client ( ) admin ( ) indices ( ) prepare stats ( " cache test idx " ) set request cache ( true ) get ( ) get total ( ) get request cache ( ) get miss count ( ) , equal to ( 1l ) ) ; / / ensure that non - scripted requests are cached as normal r = client ( ) prepare search ( " cache test idx " ) set size ( 0 ) add aggregation ( random builder ( ) field ( " d " ) ) get ( ) ; assert search response ( r ) ; assert that ( client ( ) admin ( ) indices ( ) prepare stats ( " cache test idx " ) set request cache ( true ) get ( ) get total ( ) get request cache ( ) get hit count ( ) , equal to ( 0l ) ) ; assert that ( client ( ) admin ( ) indices ( ) prepare stats ( " cache test idx " ) set request cache ( true ) get ( ) get total ( ) get request cache ( ) get miss count ( ) , equal to ( 2l ) ) ; }


schedules a task to occur once after the specified delay and then a number of additional times at the specified interval

public task schedule task ( task task , float delay seconds , float interval seconds , int repeat count ) { if ( task repeat count ! = cancelled ) throw new illegal argument exception ( " the same task may not be scheduled twice " ) ; task execute time millis = time utils nano time ( ) / 1000000 + ( long ) ( delay seconds * 1000 ) ; task interval millis = ( long ) ( interval seconds * 1000 ) ; task repeat count = repeat count ; synchronized ( tasks ) { tasks add ( task ) ; } wake ( ) ; return task ; }


checks if the queue is clogged , and if so , activate { @ link administrative monitor impl }

public void clog check ( ) { administrative monitor all ( ) get ( administrative monitor impl class ) on = is clogged ( ) ; }


utility function for partial evaluation of { @ link file status } instances to a fixed set of handle options

public static function < file status , path handle > resolve ( bi function < file status , handle opt [ ] , path handle > fsr , handle opt opt ) { return ( stat ) - > fsr apply ( stat , opt ) ; }


creates an answer from a functional interface - allows for a strongly typed answer to be created ideally in java 8

public static < t , a , b , c > answer < t > answer ( answer 3 < t , a , b , c > answer ) { return to answer ( answer ) ; }


returns a state over a range that is the intersection between this handle ' s key - group range and the provided key - group range

keyed state handle get intersection ( key group range key group range ) ;


public static assembly parse accept result accept ( assembly parse branch tree ) { return new assembly parse accept result ( tree ) ; }


the property string that specifies that a key store or trust store should use this store file type

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


the reload request should go to only one shard per node the index lives on

protected shards iterator shards ( cluster state cluster state , reload analyzers request request , string [ ] concrete indices ) { routing table routing table = cluster state routing table ( ) ; list < shard routing > shards = new array list < > ( ) ; for ( string index : concrete indices ) { set < string > nodes covered = new hash set < > ( ) ; index routing table index routing table = routing table index ( index ) ; for ( index shard routing table index shard routing table : index routing table ) { for ( shard routing shard routing : index shard routing table ) { if ( nodes covered contains ( shard routing current node id ( ) ) = = false ) { shards add ( shard routing ) ; nodes covered add ( shard routing current node id ( ) ) ; } } } } return new plain shards iterator ( shards ) ; }


find the fields constant that matches field id , throwing an exception if it is not found

public static fields find by thrift id or throw ( int field id ) { fields fields = find by thrift id ( field id ) ; if ( fields = = null ) throw new illegal argument exception ( " field " + field id + " doesn ' t exist ! " ) ; return fields ; }


test with partial record at the end of a compressed input file

public void test partial record compressed in ( ) throws i o exception { compression codec gzip = new gzip codec ( ) ; run partial record test ( gzip ) ; }


public ref get ref ( string column label ) throws s q l exception { return null ; }


removes ' value ' from wrapped collection replacing this collection instance for array list from compact hash set

public synchronized boolean remove ( t value ) { collection < t > collection = this collection ; if ( collection = = null ) { / / null return false ; } int previous size = collection size ( ) ; if ( previous size = = 1 ) { if ( collection contains ( value ) ) { / / - > null this collection = null ; return true ; } else { return false ; } } / / now remove the value if ( collection remove ( value ) ) { / / may need to change representation if ( previous size = = 2 ) { / / - > singleton list list < t > list = collections singleton list ( collection iterator ( ) next ( ) ) ; this collection = list ; return true ; } else if ( previous size = = 1 + arraylist threshold ) { / / - > array list collection < t > new array list = new array list < > ( arraylist threshold ) ; new array list add all ( collection ) ; this collection = new array list ; return true ; } return true ; } return false ; }


returns the values from each provided array combined into a single array for example , { @ code concat ( new short [ ] { a , b } , new short [ ] { } , new short [ ] { c } } returns the array { @ code { a , b , c } }

public static short [ ] concat ( short [ ] arrays ) { int length = 0 ; for ( short [ ] array : arrays ) { length + = array length ; } short [ ] result = new short [ length ] ; int pos = 0 ; for ( short [ ] array : arrays ) { system arraycopy ( array , 0 , result , pos , array length ) ; pos + = array length ; } return result ; }


public double get deviation ( ) { double variance = get variance ( ) ; return ( variance > 0 ) ? math sqrt ( variance ) : 0 ; }


returns always non - null { @ link sasl extensions } consisting of the extension names and values that are sent by the client to the server in the initial client sasl authentication message the default value is { @ link sasl extensions # no sasl extensions } so that if this callback is unhandled the client will see a non - null value

public sasl extensions extensions ( ) { return extensions ; }


< code > optional org apache dubbo common serialize protobuf model phone type type = 2 [ default = home ] ; < code >


utility function that composes a string for logging purposes the string includes the given message and the index of the task in its task group together with the number of tasks in the task group

private string get log string ( string message , string task name ) { return batch task construct log string ( message , task name , this ) ; }


save the values out of the configuaration that we need to write the data

public void setup ( context context ) { configuration conf = context get configuration ( ) ; num bytes to write = conf get long ( bytes per map , 1 * 1024 * 1024 * 1024 ) ; min key size = conf get int ( min key , 10 ) ; key size range = conf get int ( max key , 1000 ) - min key size ; min value size = conf get int ( min value , 0 ) ; value size range = conf get int ( max value , 20000 ) - min value size ; }


append null values for the block as a stream of bits

public static void encode nulls as bits ( slice output slice output , block block ) { boolean may have null = block may have null ( ) ; slice output write boolean ( may have null ) ; if ( ! may have null ) { return ; } int position count = block get position count ( ) ; for ( int position = 0 ; position < ( position count & ~ 0b 1 1 1 ) ; position + = 8 ) { byte value = 0 ; value | = block is null ( position ) ? 0b 1 0 0 0 0000 : 0 ; value | = block is null ( position + 1 ) ? 0b 0 1 0 0 0000 : 0 ; value | = block is null ( position + 2 ) ? 0b 0 0 1 0 0000 : 0 ; value | = block is null ( position + 3 ) ? 0b 0 0 0 1 0000 : 0 ; value | = block is null ( position + 4 ) ? 0b 0 0 0 0 1000 : 0 ; value | = block is null ( position + 5 ) ? 0b 0 0 0 0 0100 : 0 ; value | = block is null ( position + 6 ) ? 0b 0 0 0 0 0010 : 0 ; value | = block is null ( position + 7 ) ? 0b 0 0 0 0 0001 : 0 ; slice output append byte ( value ) ; } / / write last null bits if ( ( position count & 0b 1 1 1 ) > 0 ) { byte value = 0 ; int mask = 0b 1 0 0 0 0000 ; for ( int position = position count & ~ 0b 1 1 1 ; position < position count ; position + + ) { value | = block is null ( position ) ? mask : 0 ; mask > > > = 1 ; } slice output append byte ( value ) ; } }


check the declared attributes of the given annotation , in particular covering google app engine ' s late arrival of { @ code type not present exception proxy } for { @ code class } values ( instead of early { @ code class get annotations ( ) failure } this method not failing indicates that { @ link # get annotation attributes ( annotation ) } won ' t failure either ( when attempted later on )

public static void validate annotation ( annotation annotation ) { attribute methods for annotation type ( annotation annotation type ( ) ) validate ( annotation ) ; }


list of mime types for file upload ( csv )

input $ accept ( string content types ) ;


returns a markdown header string that should appear at the top of stardoc ' s output , providing a summary for the input starlark module

public string render markdown header ( module info module info ) throws i o exception { velocity context context = new velocity context ( ) ; context put ( " util " , new markdown util ( ) ) ; context put ( " module docstring " , module info get module docstring ( ) ) ; string writer string writer = new string writer ( ) ; reader reader = reader from path ( header template filename ) ; try { velocity engine evaluate ( context , string writer , header template filename , reader ) ; } catch ( resource not found exception | parse error exception | method invocation exception e ) { throw new i o exception ( e ) ; } return string writer to string ( ) ; }


before updating model , it will be analyzed first put all the data contained by the model into content values , including the fields value and foreign key value if the associations between models has been removed the foreign key value in database should be cleared too

private void before update ( lite pal support base obj , list < field > supported fields , content values values ) throws security exception , illegal argument exception , no such method exception , illegal access exception , invocation target exception { put fields value ( base obj , supported fields , values ) ; put foreign key value ( values , base obj ) ; for ( string fk name : base obj get list to clear self f k ( ) ) { values put null ( fk name ) ; } }


submit two opportunistic and one guaranteed containers the resources requests by each container as such that only one can run in parallel thus , the opportunistic container that started running , will be killed for the guaranteed container to start once the guaranteed container finishes its execution , the remaining opportunistic container will be executed

public void test kill opportunistic for guaranteed container ( ) throws exception { container manager start ( ) ; list < start container request > list = new array list < > ( ) ; list add ( start container request new instance ( record factory new record instance ( container launch context class ) , create container token ( create container id ( 0 ) , dummy rm identifier , context get node id ( ) , user , builder utils new resource ( 2048 , 1 ) , context get container token secret manager ( ) , null , execution type opportunistic ) ) ) ; list add ( start container request new instance ( record factory new record instance ( container launch context class ) , create container token ( create container id ( 1 ) , dummy rm identifier , context get node id ( ) , user , builder utils new resource ( 2048 , 1 ) , context get container token secret manager ( ) , null , execution type opportunistic ) ) ) ; list add ( start container request new instance ( record factory new record instance ( container launch context class ) , create container token ( create container id ( 2 ) , dummy rm identifier , context get node id ( ) , user , builder utils new resource ( 2048 , 1 ) , context get container token secret manager ( ) , null , execution type guaranteed ) ) ) ; start containers request all requests = start containers request new instance ( list ) ; container manager start containers ( all requests ) ; base container manager test wait for n m container state ( container manager , create container id ( 0 ) , container state done , 40 ) ; thread sleep ( 5000 ) ; / / get container statuses container 0 should be killed , container 1 / / should be queued and container 2 should be running list < container id > stat list = new array list < container id > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { stat list add ( create container id ( i ) ) ; } get container statuses request stat request = get container statuses request new instance ( stat list ) ; list < container status > container statuses = container manager get container statuses ( stat request ) get container statuses ( ) ; for ( container status status : container statuses ) { if ( status get container id ( ) equals ( create container id ( 0 ) ) ) { assert assert true ( status get diagnostics ( ) contains ( " container killed to make room for guaranteed container " ) ) ; } else if ( status get container id ( ) equals ( create container id ( 1 ) ) ) { assert assert equals ( container sub state scheduled , status get container sub state ( ) ) ; } else if ( status get container id ( ) equals ( create container id ( 2 ) ) ) { assert assert equals ( container sub state running , status get container sub state ( ) ) ; } system out println ( " \ n status : [ " + status + " ] \ n " ) ; } assert assert equals ( 1 , metrics get queued opportunistic containers ( ) ) ; assert assert equals ( 0 , metrics get queued guaranteed containers ( ) ) ; / / make sure the remaining opportunistic container starts its execution base container manager test wait for n m container state ( container manager , create container id ( 2 ) , container state done , 40 ) ; thread sleep ( 5000 ) ; stat request = get container statuses request new instance ( arrays as list ( create container id ( 1 ) ) ) ; container status cont status 1 = container manager get container statuses ( stat request ) get container statuses ( ) get ( 0 ) ; assert assert equals ( org apache hadoop yarn api records container state running , cont status 1 get state ( ) ) ; assert assert equals ( 0 , metrics get queued opportunistic containers ( ) ) ; assert assert equals ( 0 , metrics get queued guaranteed containers ( ) ) ; }


this method is called whenever the status of the job changes

void job status changes ( job i d job id , job status new job status , long timestamp , throwable error ) ;


public static byte [ ] get all data ( string server ) throws exception { map < string , string > params = new hash map < > ( 8 ) ; rest result < string > result = http client http get ( " http : / / " + server + env util get context path ( ) + utils and commons nacos naming context + all data get url , new array list < > ( ) , params ) ; if ( result ok ( ) ) { return result get data ( ) get bytes ( ) ; } throw new i o exception ( " failed to req api : " + " http : / / " + server + env util get context path ( ) + utils and commons nacos naming context + all data get url + " code : " + result get code ( ) + " msg : " + result get message ( ) ) ; }


the set of enumsflags defined in this attribute only makes sense if the format includes either format flags : : enum or format flags : : flags having both is an error < code > repeated aapt pb attribute symbol symbol = 4 ; < code >

public builder add all symbol ( java lang iterable < ? extends com android aapt resources attribute symbol > values ) { copy on write ( ) ; instance add all symbol ( values ) ; return this ; }


set a fully qualified static field name to retrieve , e g " example my example class my example field " convenient alternative to specifying target class and target field

public void set static field ( string static field ) { this static field = string utils trim all whitespace ( static field ) ; }


singleton placeholder that indicates a value is being loaded

static < k , v > value reference < k , v > unset ( ) { return ( value reference < k , v > ) unset ; }


public object get anytype 1 ( ) { return anytype 1 ; }


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


creates an instance for testing with the given embedded binaries root

public static bin tools for embedded bin ( path embedded binaries root , iterable < string > tools ) { return new bin tools ( embedded binaries root , immutable list copy of ( tools ) ) ; }


returns { @ code true } if every element in this fluent iterable satisfies the predicate if this fluent iterable is empty , { @ code true } is returned < b > { @ code stream } equivalent : < b > { @ link stream # all match } ( same )

public final boolean all match ( predicate < ? super e > predicate ) { return iterables all ( get delegate ( ) , predicate ) ; }


the { @ link index privilege # values ( ) } map is sorted so that privilege names that offer the least access come before those that offer more access there is no guarantee of ordering between privileges that offer non - overlapping privileges

public void test ordering of privilege names ( ) throws exception { final set < string > names = index privilege values ( ) key set ( ) ; final int all = iterables index of ( names , " all " : : equals ) ; final int manage = iterables index of ( names , " manage " : : equals ) ; final int monitor = iterables index of ( names , " monitor " : : equals ) ; final int read = iterables index of ( names , " read " : : equals ) ; final int write = iterables index of ( names , " write " : : equals ) ; final int index = iterables index of ( names , " index " : : equals ) ; final int create doc = iterables index of ( names , " create doc " : : equals ) ; final int delete = iterables index of ( names , " delete " : : equals ) ; assert that ( read , less than ( all ) ) ; assert that ( manage , less than ( all ) ) ; assert that ( monitor , less than ( manage ) ) ; assert that ( write , less than ( all ) ) ; assert that ( index , less than ( write ) ) ; assert that ( create doc , less than ( index ) ) ; assert that ( delete , less than ( write ) ) ; }


public list < v > sub list ( int from index , int to index ) { throw new unsupported operation exception ( ) ; }


private void update root attr ( i node with additional fields root ) { final quota counts q = root get quota counts ( ) ; final long ns quota = q get name space ( ) ; final long ds quota = q get storage space ( ) ; f s directory fs dir = namesystem dir ; if ( ns quota ! = - 1 | | ds quota ! = - 1 ) { fs dir root dir get directory with quota feature ( ) set quota ( ns quota , ds quota ) ; } fs dir root dir clone modification time ( root ) ; fs dir root dir clone permission status ( root ) ; }


return the isolation level for the current transaction , if any to be called by resource management code when preparing a newly created resource ( for example , a jdbc connection )

public static integer get current transaction isolation level ( ) { return current transaction isolation level get ( ) ; }


public list < e > as list ( ) { if ( non null list = = null ) { if ( array = = null | | array length ( ) = = 0 ) { non null list = collections empty list ( ) ; } else { list < e > list = new array list < > ( array length ( ) ) ; for ( int i = 0 ; i < array length ( ) ; i + + ) { e e = array get ( i ) ; if ( e ! = null ) { list add ( e ) ; } } non null list = list ; } } return non null list ; }


tests that removed partitions will not be removed from subscribed partitions even if it ' s still in restored partitions ( filter restored partitions with discovered is disabled )

public void test disable filter restored paritions with removed topic ( ) throws exception { check filter restored partitions with disovered ( arrays as list ( new string [ ] { " kafka topic 1 " , " kafka topic 2 " } ) , arrays as list ( new string [ ] { " kafka topic 1 " } ) , arrays as list ( new string [ ] { " kafka topic 1 " , " kafka topic 2 " } ) , true ) ; }


set to { @ code true } to force only creation , not an update of an index template if it already exists , it will fail with an { @ link illegal argument exception }

public put index template request create ( boolean create ) { this create = create ; return this ; }


public set < string > get cluster node label names ( ) { read lock lock ( ) ; try { set < string > labels = new hash set < string > ( label collections key set ( ) ) ; labels remove ( no label ) ; return collections unmodifiable set ( labels ) ; } finally { read lock unlock ( ) ; } }


provides an { @ link extract jars transform action } for the archive entry

public static taobao extract jars transform action get action ( @ non null string archive path , boolean extract code ) { / / manifest files are never merged if ( jar file manifest name equals ( archive path ) ) { return taobao extract jars transform action ignore ; } / / split the path into segments string [ ] segments = archive path split ( " / " ) ; / / empty path ? skip to next entry if ( segments length = = 0 ) { return taobao extract jars transform action ignore ; } return packaging utils check file for apk packaging ( archive path , extract code ) ? taobao extract jars transform action copy : taobao extract jars transform action ignore ; }


callback when the global checkpoint is updated or the shard is closed if the shard is closed , the value of the global checkpoint will be set to { @ link org elasticsearch index seqno sequence numbers # unassigned seq no } and the exception will be non - null and an instance of { @ link index shard closed exception } if the listener timed out waiting for notification then the exception will be non - null and an instance of { @ link timeout exception } if the global checkpoint is updated , the exception will be null

void accept ( long global checkpoint , exception e ) ;


whether this column will be shown by default the default implementation is true

public boolean shown by default ( ) { return true ; }


returns the estimated in memory data size for stats of position do not use it for other purpose

long get estimated data size for stats ( int position ) ;


get the number of header bytes the format checker requires


public int pop ( ) { return items [ - - size ] ; }


returns the new class name based on the given class name and the new name of the given referenced class class names of array types are handled properly

private static string new class name ( string class name , clazz referenced class ) { / / if there is no referenced class , the class name won ' t change if ( referenced class = = null ) { return class name ; } / / reconstruct the class name string new class name = referenced class get name ( ) ; / / is it an array type ? if ( class name char at ( 0 ) = = class constants type array ) { / / add the array prefixes and suffix " [ l ; " new class name = class name substring ( 0 , class name index of ( class constants type class start ) + 1 ) + new class name + class constants type class end ; } return new class name ; }


determine whether the given bean class qualifies as an m bean as - is the default implementation delegates to { @ link jmx utils # is m bean } , which checks for { @ link javax management dynamic m bean } classes as well as classes with corresponding " m bean " interface ( standard m beans ) or corresponding " m x bean " interface ( java 6 m x beans )

protected boolean is m bean ( @ nullable class < ? > bean class ) { return jmx utils is m bean ( bean class ) ; }


disables dependency checks done by { @ link com google devtools build lib analysis rule context prerequisite validator }

public builder < type > skip prereq validator check ( ) { return set property flag ( property flag skip prereq validator checks , " skip prereq validator checks " ) ; }


sets the validator to validate the parameter value set by users

public param info builder < v > set validator ( param validator < v > validator ) { this validator = validator ; return this ; }


transitions from the alpha at the time this action starts to the specified alpha

static public alpha action alpha ( float a , float duration , @ null interpolation interpolation ) { alpha action action = action ( alpha action class ) ; action set alpha ( a ) ; action set duration ( duration ) ; action set interpolation ( interpolation ) ; return action ; }


returns an immutable collection of all key - value pairs in the multimap its iterator traverses the values for the first key , the values for the second key , and so on

public immutable set < entry < k , v > > entries ( ) { immutable set < entry < k , v > > result = entries ; return result = = null ? ( entries = new entry set < > ( this ) ) : result ; }


add an active search context to the list of tracked contexts package private for testing

static void add active context ( reader context context ) { active search contexts put ( context , new runtime exception ( context to string ( ) ) ) ; }


public void tear down ( ) throws i o exception { if ( fs ! = null ) { clean ( fs ) ; } if ( mr ! = null ) { mr stop ( ) ; } }


public synchronized mutable gauge long new gauge ( metrics info info , long i val ) { check metric name ( info name ( ) ) ; mutable gauge long ret = new mutable gauge long ( info , i val ) ; metrics map put ( info name ( ) , ret ) ; return ret ; }


tests stepping the cache replication factor up and down , checking the number of cached replicas and blocks as well as the advertised locations

public void test replication factor ( ) throws exception { / / create the pool final string pool = " friendly pool " ; dfs add cache pool ( new cache pool info ( pool ) ) ; / / create some test files final list < path > paths = new linked list < path > ( ) ; paths add ( new path ( " / foo / bar " ) ) ; paths add ( new path ( " / foo / baz " ) ) ; paths add ( new path ( " / foo 2 / bar 2 " ) ) ; paths add ( new path ( " / foo 2 / baz 2 " ) ) ; dfs mkdir ( new path ( " / foo " ) , fs permission get dir default ( ) ) ; dfs mkdir ( new path ( " / foo 2 " ) , fs permission get dir default ( ) ) ; final int num blocks per file = 2 ; for ( path path : paths ) { file system test helper create file ( dfs , path , num blocks per file , ( int ) block size , ( short ) 3 , false ) ; } wait for cached blocks ( namenode , 0 , 0 , " test replication factor : 0 " ) ; check num cached replicas ( dfs , paths , 0 , 0 ) ; / / cache directory long id = dfs add cache directive ( new cache directive info builder ( ) set path ( new path ( " / foo " ) ) set replication ( ( short ) 1 ) set pool ( pool ) build ( ) ) ; wait for cached blocks ( namenode , 4 , 4 , " test replication factor : 1 " ) ; check num cached replicas ( dfs , paths , 4 , 4 ) ; / / step up the replication factor for ( int i = 2 ; i < = 3 ; i + + ) { dfs modify cache directive ( new cache directive info builder ( ) set id ( id ) set replication ( ( short ) i ) build ( ) ) ; wait for cached blocks ( namenode , 4 , 4 * i , " test replication factor : 2 " ) ; check num cached replicas ( dfs , paths , 4 , 4 * i ) ; } / / step it down for ( int i = 2 ; i > = 1 ; i - - ) { dfs modify cache directive ( new cache directive info builder ( ) set id ( id ) set replication ( ( short ) i ) build ( ) ) ; wait for cached blocks ( namenode , 4 , 4 * i , " test replication factor : 3 " ) ; check num cached replicas ( dfs , paths , 4 , 4 * i ) ; } / / remove and watch num cached go to 0 dfs remove cache directive ( id ) ; wait for cached blocks ( namenode , 0 , 0 , " test replication factor : 4 " ) ; check num cached replicas ( dfs , paths , 0 , 0 ) ; }


get the total number of items in the bag

public int size ( ) { return shared list size ( ) ; }


internal version of { @ link grpc negotiation handler }

public static channel handler grpc negotiation handler ( grpc http 2 connection handler next ) { return new grpc negotiation handler ( next ) ; }


returns the { @ linkplain # get sample elements ( ) sample elements } as ordered by { @ link test container generator # order ( list ) } tests should used this method only if they declare requirement { @ link com google common collect testing features collection feature # known order }

protected list < e > get ordered elements ( ) { list < e > list = new array list < e > ( ) ; for ( e e : get subject generator ( ) order ( new array list < e > ( get sample elements ( ) ) ) ) { list add ( e ) ; } return collections unmodifiable list ( list ) ; }


< b > note : < b > setting service context clears all services embedded with it

public void set service context ( r m service context context ) { this service context = context ; }


returns a supplier that caches the instance supplied by the delegate and removes the cached value after the specified time has passed subsequent calls to { @ code get ( ) } return the cached value if the expiration time has not passed after the expiration time , a new value is retrieved , cached , and returned see : < a href = " http : en wikipedia orgwiki memoization " > memoization the returned supplier is thread - safe the supplier ' s serialized form does not contain the cached value , which will be recalculated when { @ code get ( ) } is called on the reserialized instance the actual memoization does not happen when the underlying delegate throws an exception when the underlying delegate throws an exception then this memoizing supplier will keep delegating calls until it returns valid data

public static < t > supplier < t > memoize with expiration ( supplier < t > delegate , long duration , time unit unit ) { return new expiring memoizing supplier < t > ( delegate , duration , unit ) ; }


performs static checks , including resolution of identifiers in { @ code file } in the environment defined by { @ code module } the starlark file is mutated errors are appended to { @ link starlark file # errors }

public static void resolve file ( starlark file file , module module ) { resolver r = new resolver ( file errors , module , file get options ( ) ) ; immutable list < statement > stmts = file get statements ( ) ; / / check that load statements are on top if ( r options require load statements first ( ) ) { r check load after statement ( stmts ) ; } array list < binding > frame = new array list < > ( ) ; r push local block ( file , frame , / * freevars = * / null ) ; / / first pass : creating bindings for statements in this block r create bindings for block ( stmts ) ; / / second pass : visit all references r visit all ( stmts ) ; r pop local block ( ) ; / / if the final statement is an expression , synthesize a return statement int n = stmts size ( ) ; if ( n > 0 & & stmts get ( n - 1 ) instanceof expression statement ) { expression expr = ( ( expression statement ) stmts get ( n - 1 ) ) get expression ( ) ; stmts = immutable list < statement > builder ( ) add all ( stmts sub list ( 0 , n - 1 ) ) add ( return statement make ( expr ) ) build ( ) ; } / / annotate with resolved information about the toplevel function file set resolved function ( new function ( " < toplevel > " , file get start location ( ) , / * params = * / immutable list of ( ) , / * body = * / stmts , / * has varargs = * / false , / * has kwargs = * / false , / * num keyword only params = * / 0 , frame , / * freevars = * / immutable list of ( ) , r globals ) ) ; }


interns the f s r l root so that its parent parts are shared with already interned instances caller needs to hold sync mutex

private f s r l root intern ( f s r l root fsrl ) { if ( local f s r l equals ( fsrl ) ) { return local f s r l ; } fsrl container = fsrl get container ( ) ; if ( container ! = null ) { f s r l root parent f s r l = intern ( container get f s ( ) ) ; if ( parent f s r l ! = container get f s ( ) ) { fsrl interned container = parent f s r l with path ( container ) ; fsrl = f s r l root nested f s ( interned container , fsrl ) ; } } f s r l root existing = fsrl intern map get ( fsrl ) ; if ( existing = = null ) { fsrl intern map put ( fsrl , fsrl ) ; existing = fsrl ; } return existing ; }


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


uid and gid are defined as uint 3 2 in linux some systems create ( intended or unintended ) < nfsnobody , 4294967294 > kind of < name , id > mapping , where 4294967294 is 232 - 2 as unsigned int 3 2 as an example , https : bugzilla redhat comshow bug cgi ? id = 511876 because user or group id are treated as integer ( signed integer or int 3 2 ) here , the number 4294967294 is out of range the solution is to convert uint 3 2 to int 3 2 , so to map the out - of - range id to the negative side of integer , e g 4294967294 maps to - 2 and 4294967295 maps to - 1

private static integer parse id ( final string id str ) { long long val = long parse long ( id str ) ; return integer value of ( ( int ) long val ) ; }


the minimum length a suggest text term must have in order to be corrected defaults to { @ code 4 }

public term suggestion builder min word length ( int min word length ) { if ( min word length < 1 ) { throw new illegal argument exception ( " min word length must be greater or equal to 1 " ) ; } this min word length = min word length ; return this ; }


extension point for deployers to define custom audit resource resolvers to extend the stock resolvers

public map < string , audit resource resolver > custom audit resource resolver map ( ) { return new hash map < > ( 0 ) ; }


override the base implementation to completely ignore watermarks propagated from upstream ( we rely only on the { @ link assigner with periodic watermarks } to emit watermarks from here )

public void process watermark ( watermark mark ) throws exception { / / if we receive a long max value watermark we forward it since it is used / / to signal the end of input and to not block watermark progress downstream if ( mark get timestamp ( ) = = long max value & & current watermark ! = long max value ) { current watermark = long max value ; output emit watermark ( mark ) ; } }


public boolean get prefix boolean ( ) { return prefix boolean ; }


encode a stream of objects of type { @ code t } into a { @ link data buffer } output stream

flux < data buffer > encode ( publisher < ? extends t > input stream , data buffer factory buffer factory , resolvable type element type , @ nullable mime type mime type , @ nullable map < string , object > hints ) ;


public boolean has more ( ) { return cursor ( ) < array length ; }