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


protected boolean rename supported ( ) { return true ; }


sets a valid x - frame - option that can be used by http server 2

public builder set x frame option ( string option ) { this x frame option = x frame option get enum ( option ) ; return this ; }


adds relationship where the current object is the foreign key table in a relationship

public void add association ( e r d association rel , boolean reflect ) { if ( associations = = null ) { associations = new array list < > ( ) ; } associations add ( rel ) ; if ( reflect ) { fire property change ( output , null , rel ) ; } }


returns a shard iterator for the given { @ link sequence number }

private string get shard iterator ( ) throws interrupted exception { return kinesis proxy get shard iterator ( subscribed shard , next starting position get shard iterator type ( ) to string ( ) , next starting position get starting marker ( ) ) ; }


returns the length of a string throws an exception if the column is empty

protected static final int next string length ( byte [ ] bytes , int start pos , int length , char delimiter ) { if ( length < = 0 ) { throw new illegal argument exception ( " invalid input : empty string " ) ; } int limited length = 0 ; final byte del byte = ( byte ) delimiter ; while ( limited length < length & & bytes [ start pos + limited length ] ! = del byte ) { limited length + + ; } return limited length ; }


discards { @ code n } characters of data from the reader this method will block until the full amount has been skipped does not close the reader

public static void skip fully ( reader reader , long n ) throws i o exception { check not null ( reader ) ; while ( n > 0 ) { long amt = reader skip ( n ) ; if ( amt = = 0 ) { throw new e o f exception ( ) ; } n - = amt ; } }


check that throttling was detected ; warn if not

public boolean probe throttling detected ( ) { if ( ! is throttling detected ( ) ) { log warn ( " no throttling detected in { } against { } " , this , ddbms ) ; return false ; } return true ; }


exit a parse tree produced by the { @ code back quoted identifier } labeled alternative in { @ link sql base parser # quote identifier }

void exit back quoted identifier ( sql base parser back quoted identifier context ctx ) ;


< code > optional bool sex = 5 ; < code >

public boolean get sex ( ) { return sex ; }


creates a wildcard name symmetric to { @ link # create random name ( string ) }

public static string create wildcard name ( string prefix ) { return prefix + " * " ; }


returns the labels of exported targets and artifacts reached transitively through the " exports " attribute

public nested set < label > get transitive exports ( ) { return transitive exports ; }


returns the corresponding primitive type of { @ code type } if it is a wrapper type ; otherwise returns { @ code type } itself idempotent unwrap ( integer class ) = = int class unwrap ( int class ) = = int class unwrap ( string class ) = = string class

public static < t > class < t > unwrap ( class < t > type ) { check not null ( type ) ; / / cast is safe : long class and long class are both of type class < long > @ suppress warnings ( " unchecked " ) class < t > unwrapped = ( class < t > ) wrapper to primitive type get ( type ) ; return ( unwrapped = = null ) ? type : unwrapped ; }


clients should override this method if the post - processing cannot be done in place if the post - processing can be done in place , clients should override the { @ link # process ( bitmap ) } method the provided destination bitmap is of the same size as the source bitmap there are no guarantees on the initial content of the destination bitmap , so the implementation has to make sure that it properly populates it the source bitmap must not be modified as it may be shared by the other clients the implementation must use the provided destination bitmap as its output

public void process ( bitmap dest bitmap , bitmap source bitmap ) { internal copy bitmap ( dest bitmap , source bitmap ) ; process ( dest bitmap ) ; }


return the maximum allowable size of the dynamic table

public long capacity ( ) { return capacity ; }


returns a new , empty builder for { @ link immutable double array } instances , sized to hold up to { @ code initial capacity } values without resizing the returned builder is not thread - safe < b > performance note : < b > when feasible , { @ code initial capacity } should be the exact number of values that will be added , if that knowledge is readily available it is better to guess a value slightly too high than slightly too low if the value is not exact , the { @ link immutable double array } that is built will very likely occupy more memory than strictly necessary ; to trim memory usage , build using { @ code builder build ( ) trimmed ( ) }

public static builder builder ( int initial capacity ) { check argument ( initial capacity > = 0 , " invalid initial capacity : % s " , initial capacity ) ; return new builder ( initial capacity ) ; }


returns the { @ code key selector } that must be used for partitioning keyed state in this sink

public key selector < t , ? > get state key selector ( ) { return state key selector ; }


the size of the serialized , uncompressed key in bytes if key is null , the returned size is - 1

public int serialized key size ( ) { return this serialized key size ; }


compute the median absolute deviation of a sorted list

public static double compute mad ( list < double > sorted values ) { if ( sorted values size ( ) = = 0 ) { throw new illegal argument exception ( " cannot compute the median absolute deviation " + " of an empty list " ) ; } / / first get the median of the values double median = compute median ( sorted values ) ; list < double > deviations = new array list < > ( sorted values ) ; / / then update the list to store deviation from the median for ( int i = 0 ; i < sorted values size ( ) ; + + i ) { deviations set ( i , math abs ( sorted values get ( i ) - median ) ) ; } / / finally get the median absolute deviation collections sort ( deviations ) ; return compute median ( deviations ) * mad multiplier ; }


assert that a future raises an expected exception cause type return the exception cause if the assertion succeeds ; otherwise raise assertion error

public static < t extends throwable > t assert future throws ( future < ? > future , class < t > exception cause class ) { execution exception exception = assert throws ( execution exception class , future : : get ) ; assert true ( exception cause class is instance ( exception get cause ( ) ) , " unexpected exception cause " + exception get cause ( ) ) ; return exception cause class cast ( exception get cause ( ) ) ; }


gets the y coordinate of the pivot point

public float get pivot y ( ) { return calc average ( m detector get start y ( ) , m detector get pointer count ( ) ) ; }


public void set network timeout ( executor executor , int milliseconds ) throws s q l exception { delegate set network timeout ( executor , milliseconds ) ; network timeout = milliseconds ; dirty bits | = dirty bit nettimeout ; }


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

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


the atn with bypass alternatives is expensive to create so we create it lazily

public atn get a t n with bypass alts ( ) { string serialized atn = get serialized a t n ( ) ; if ( serialized atn = = null ) { throw new unsupported operation exception ( " the current parser does not support an atn with bypass alternatives " ) ; } synchronized ( bypass alts atn cache ) { atn result = bypass alts atn cache get ( serialized atn ) ; if ( result = = null ) { a t n deserialization options deserialization options = new a t n deserialization options ( ) ; deserialization options set generate rule bypass transitions ( true ) ; result = new a t n deserializer ( deserialization options ) deserialize ( serialized atn to char array ( ) ) ; bypass alts atn cache put ( serialized atn , result ) ; } return result ; } }


determines whether this permission grants the specified privilege on the given resource an { @ link application permission } consists of a sequence of permission entries , where each entry contains a single { @ link application privilege } and one or more resource patterns this method returns { @ code true } if , one or more of those entries meet the following criteria the entry ' s application , when interpreted as an { @ link automaton } { @ link automatons # pattern ( string ) pattern } matches the application given in the argument ( interpreted as a raw string ) the { @ link application privilege # get automaton automaton that defines the entry ' s actions } entirely covers the automaton given in the argument ( that is , the argument is a subset of the entry ' s automaton ) the entry ' s resources , when interpreted as an { @ link automaton } { @ link automatons # patterns ( string ) } set of patterns } entirely covers the resource given in the argument ( also interpreted as an { @ link automaton } { @ link automatons # pattern ( string ) pattern }

public boolean grants ( application privilege other , string resource ) { automaton resource automaton = automatons patterns ( resource ) ; final boolean matched = permissions stream ( ) any match ( e - > e grants ( other , resource automaton ) ) ; logger trace ( " permission [ { } ] { } grant [ { } , { } ] " , this , matched ? " does " : " does not " , other , resource ) ; return matched ; }


get ' s the source tool from the vt session

plugin tool get source tool ( ) { return source tool ; }


public void incr authorization failures ( ) { rpc authorization failures incr ( ) ; }


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


returns true if this die has a dw at declaration attribute

public boolean is partial declaration ( ) { return has attribute ( d w a r f attribute dw at declaration ) ; }


process the input stat if it is a file , return the file stat if it is a directory , traverse the directory if recursive is true ; ignore it if recursive is false

private void handle file stat ( located file status stat ) throws i o exception { if ( stat is file ( ) ) { / / file cur file = stat ; } else if ( recursive ) { / / directory itors push ( cur itor ) ; cur itor = list located status ( stat get path ( ) ) ; } }


test the property ' name wrapped array '

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


set the soap action uri to specify on the stub

public void set soap action uri ( @ nullable string soap action uri ) { this soap action uri = soap action uri ; }


returns the double array which this buffer is based on , if there is one

public final double [ ] array ( ) { return protected array ( ) ; }


public integer get int 3 2 ( ) { return int 3 2 ; }


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


constructs a new parser using the specified stream and name

public static xml pull parser create ( input stream input , string input name , error handler err handler , boolean validate ) throws s a x exception , i o exception { return new threaded xml pull parser impl ( input , input name , err handler , validate , 1000 ) ; }


serializes shard snapshot metadata info into json

public x content builder to x content ( x content builder builder , params params ) throws i o exception { builder field ( name , snapshot ) ; builder field ( index version , index version ) ; builder field ( start time , start time ) ; builder field ( time , time ) ; builder field ( incremental file count , incremental file count ) ; builder field ( incremental size , incremental size ) ; builder start array ( files ) ; for ( file info file info : index files ) { file info to x content ( file info , builder ) ; } builder end array ( ) ; return builder ; }


to test special tags to test special tags and operation id starting with number

public client call 1 2 3test special tags ( client body ) throws api exception { api response < client > local var resp = call 1 2 3test special tags with http info ( body ) ; return local var resp get data ( ) ; }


example of when we round past when local clocks were wound backwards , and then past the time they were wound forwards before that so , we jumped back a long , long way

public void test interval two transitions ( ) { zone id tz = zone id of ( " america / detroit " ) ; rounding rounding = rounding builder ( time value time value days ( 279 ) ) time zone ( tz ) build ( ) ; assert that ( rounding round ( time ( " 1982 - 11 - 10t02 : 51 : 22 662z " ) ) , is date ( time ( " 1982 - 03 - 23t05 : 00 : 00z " ) , tz ) ) ; }


the { @ link task id } of the async execution in the task manager

public task id get task id ( ) { return task id ; }


protected void do validate ( object bean ) { assert state ( this validator ! = null , " no validator set " ) ; object object to validate = aop proxy utils get singleton target ( bean ) ; if ( object to validate = = null ) { object to validate = bean ; } set < constraint violation < object > > result = this validator validate ( object to validate ) ; if ( ! result is empty ( ) ) { string builder sb = new string builder ( " bean state is invalid : " ) ; for ( iterator < constraint violation < object > > it = result iterator ( ) ; it has next ( ) ; ) { constraint violation < object > violation = it next ( ) ; sb append ( violation get property path ( ) ) append ( " - " ) append ( violation get message ( ) ) ; if ( it has next ( ) ) { sb append ( " ; " ) ; } } throw new bean initialization exception ( sb to string ( ) ) ; } }


return an { @ link java util iterator } over all values in the set < b > note : < b > this is a fairly inefficient way to access the array contents , it requires generating a number of temporary objects and allocates additional state information associated with the container that will remain for the life of the container

public iterator < e > iterator ( ) { return get collection ( ) get key set ( ) iterator ( ) ; }


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


extract dynamic index pattern string from index pattern string

string extract dynamic index pattern str ( string index ) { int start = index index of ( " { " ) ; int end = index last index of ( " } " ) ; return index substring ( start , end + 1 ) ; }


returns true iff < code > o < code > is a text with the same length and same contents

public boolean equals ( object o ) { if ( o instanceof text ) return super equals ( o ) ; return false ; }


convert durations to the given time unit

public builder convert durations to ( time unit duration unit ) { this duration unit = duration unit ; return this ; }


block until the user completes the current merge operation , or cancels the merge process

protected synchronized void wait for input ( ) { for ( ; ; ) { if ( is cancelled | | input received ) { return ; } try { prompting = true ; wait ( ) ; } catch ( interrupted exception e ) { / / loop again } } }


create a panel for all checkboxes related to applying differences

private j panel create diff panel ( ) { j panel panel = new j panel ( ) ; titled border border = new titled border ( " do differences on " ) ; panel set border ( border ) ; panel add ( create diff filter panel ( ) ) ; return panel ; }


retrieves , but does not remove , the head of the queue represented by this deque ( in other words , the first element of this deque ) this method differs from { @ link # peek peek } only in that it throws an exception if this deque is empty < p > this method is equivalent to { @ link # get first ( ) get first }


private find options create options ( ) { find options options = new find options ( ) ; options set out ( out ) ; options set err ( err ) ; options set in ( system in ) ; options set command factory ( get command factory ( ) ) ; options set configuration ( get conf ( ) ) ; return options ; }


add the path spec to the filter path mapping

protected void add filter path mapping ( string path spec , servlet context handler web app ctx ) { servlet handler handler = web app ctx get servlet handler ( ) ; for ( string name : filter names ) { filter mapping fmap = new filter mapping ( ) ; fmap set path spec ( path spec ) ; fmap set filter name ( name ) ; fmap set dispatches ( filter mapping all ) ; handler add filter mapping ( fmap ) ; } }


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 ( log log , java io closeable closeables ) { for ( java io closeable c : closeables ) { if ( c ! = null ) { try { c close ( ) ; } catch ( throwable e ) { if ( log ! = null & & log is debug enabled ( ) ) { log debug ( " exception in closing " + c , e ) ; } } } } }


method called when the action is invoked

public void action performed ( listing action context context ) { address entry = null ; address set view body = null ; if ( context has selection ( ) ) { body = context get selection ( ) ; entry = body get min address ( ) ; } else { entry = context get address ( ) ; } if ( entry = = null ) { return ; } string name = null ; function func = context get program ( ) get function manager ( ) get function containing ( entry ) ; if ( func ! = null & & func get entry point ( ) equals ( entry ) ) { if ( create thunk ) { msg show error ( this , null , " thunk conflict " , " thunk function conflicts with an existing function ! " ) ; return ; } func plugin get tool ( ) set status info ( " function \ " " + func get name ( ) + " \ " at " + func get entry point ( ) + " already exists " ) ; int result = option dialog show option no cancel dialog ( null , " function already exists at this location " , " function \ " " + func get name ( ) + " \ " at " + func get entry point ( ) + " already exists at this location \ n " + " are you sure you want to proceed ? \ n doing so , will cause analysis to be re - run on this function " , create thunk ? " create thunk " : " & re - create " , " & no " , option dialog question message ) ; if ( result ! = option dialog option one ) { return ; } func plugin get tool ( ) clear status info ( ) ; } background command cmd ; if ( create thunk ) { cmd = get create thunk function cmd ( context get program ( ) , entry , body ) ; if ( cmd = = null ) { return ; / / cancelled } } else { cmd = new create function cmd ( name , entry , body , source type user defined , allow existing , allow existing ) ; } func plugin execute ( context get program ( ) , cmd ) ; }


returns the property map object that is associated with the specified property name

public property map get property map ( string property name ) { return property map mgr get property map ( property name ) ; }


resources names of resources that have be deleted and to be removed from the mcp client removed resources for missing resources can be ignored < code > repeated string removed resources = 3 ; < code >

public com google protobuf protocol string list get removed resources list ( ) { return removed resources get unmodifiable view ( ) ; }


sets the source from which the attributes of this method will be copied

void set method attributes source ( final int method info offset , final int method info length ) { / / don ' t copy the attributes yet , instead store their location in the source class reader so / / they can be copied later , in { @ link # put method info } note that we skip the 6 header bytes / / of the method info jvms structure this source offset = method info offset + 6 ; this source length = method info length - 6 ; }


check whether the given object is in the session cache

boolean contains ( object entity ) throws data access exception ;


returns the target model class that should be used to deserialize the input data this function can be invoked for any ofone of composed models with discriminator mappings the discriminator mappings are used to determine the target model class

class < ? > get class for element ( json node node , set < class < ? > > visited classes ) { if ( visited classes contains ( model class ) ) { / / class has already been visited return null ; } / / determine the value of the discriminator property in the input data string discr value = get discriminator value ( node ) ; if ( discr value = = null ) { return null ; } class < ? > cls = discriminator mappings get ( discr value ) ; / / it may not be sufficient to return this cls directly because that target class / / may itself be a composed schema , possibly with its own discriminator visited classes add ( model class ) ; for ( class < ? > child class : discriminator mappings values ( ) ) { class discriminator mapping child cdm = model discriminators get ( child class ) ; if ( child cdm = = null ) { continue ; } if ( ! discriminator name equals ( child cdm discriminator name ) ) { discr value = get discriminator value ( node ) ; if ( discr value = = null ) { continue ; } } if ( child cdm ! = null ) { / / recursively traverse the discriminator mappings class < ? > child discr = child cdm get class for element ( node , visited classes ) ; if ( child discr ! = null ) { return child discr ; } } } return cls ; }


public address set get view ( ) { return view set ; }


test that the sort builder nested object gets created in the sort field

public void test build nested ( ) throws i o exception { query shard context shard context mock = create mock shard context ( ) ; field sort builder sort builder = new field sort builder ( " field name " ) set nested sort ( new nested sort builder ( " path " ) set filter ( query builders term query ( mapped string fieldname , " value " ) ) ) ; sort field sort field = sort builder build ( shard context mock ) field ; assert that ( sort field get comparator source ( ) , instance of ( x field comparator source class ) ) ; x field comparator source comparator source = ( x field comparator source ) sort field get comparator source ( ) ; nested nested = comparator source nested ( ) ; assert not null ( nested ) ; assert equals ( new term query ( new term ( mapped string fieldname , " value " ) ) , nested get inner query ( ) ) ; nested sort builder nested sort = new nested sort builder ( " path " ) ; sort builder = new field sort builder ( " field name " ) set nested sort ( nested sort ) ; sort field = sort builder build ( shard context mock ) field ; assert that ( sort field get comparator source ( ) , instance of ( x field comparator source class ) ) ; comparator source = ( x field comparator source ) sort field get comparator source ( ) ; nested = comparator source nested ( ) ; assert not null ( nested ) ; assert equals ( new term query ( new term ( nested path field mapper name , " path " ) ) , nested get inner query ( ) ) ; nested sort set filter ( query builders term query ( mapped string fieldname , " value " ) ) ; sort builder = new field sort builder ( " field name " ) set nested sort ( nested sort ) ; sort field = sort builder build ( shard context mock ) field ; assert that ( sort field get comparator source ( ) , instance of ( x field comparator source class ) ) ; comparator source = ( x field comparator source ) sort field get comparator source ( ) ; nested = comparator source nested ( ) ; assert not null ( nested ) ; assert equals ( new term query ( new term ( mapped string fieldname , " value " ) ) , nested get inner query ( ) ) ; }


apply configuratio changes after admin has approved them

private void apply changes ( print writer out , reconfigurable reconf , http servlet request req ) throws reconfiguration exception { configuration old conf = reconf get conf ( ) ; configuration new conf = new configuration ( ) ; enumeration < string > params = get params ( req ) ; synchronized ( old conf ) { while ( params has more elements ( ) ) { string raw param = params next element ( ) ; string param = string escape utils unescape html 4 ( raw param ) ; string value = string escape utils unescape html 4 ( req get parameter ( raw param ) ) ; if ( value ! = null ) { if ( value equals ( new conf get raw ( param ) ) | | value equals ( " default " ) | | value equals ( " null " ) | | value is empty ( ) ) { if ( ( value equals ( " default " ) | | value equals ( " null " ) | | value is empty ( ) ) & & old conf get raw ( param ) ! = null ) { out println ( " < p > changed \ " " + string escape utils escape html 4 ( param ) + " \ " from \ " " + string escape utils escape html 4 ( old conf get raw ( param ) ) + " \ " to default < / p > " ) ; reconf reconfigure property ( param , null ) ; } else if ( ! value equals ( " default " ) & & ! value equals ( " null " ) & & ! value is empty ( ) & & ( old conf get raw ( param ) = = null | | ! old conf get raw ( param ) equals ( value ) ) ) { / / change from default or value to different value if ( old conf get raw ( param ) = = null ) { out println ( " < p > changed \ " " + string escape utils escape html 4 ( param ) + " \ " from default to \ " " + string escape utils escape html 4 ( value ) + " \ " < / p > " ) ; } else { out println ( " < p > changed \ " " + string escape utils escape html 4 ( param ) + " \ " from \ " " + string escape utils escape html 4 ( old conf get raw ( param ) ) + " \ " to \ " " + string escape utils escape html 4 ( value ) + " \ " < / p > " ) ; } reconf reconfigure property ( param , value ) ; } else { log info ( " property " + param + " unchanged " ) ; } } else { / / parameter value ! = new conf value out println ( " < p > \ " " + string escape utils escape html 4 ( param ) + " \ " not changed because value has changed from \ " " + string escape utils escape html 4 ( value ) + " \ " to \ " " + string escape utils escape html 4 ( new conf get raw ( param ) ) + " \ " since approval < / p > " ) ; } } } } }


updates the queue tracker with a reported timeline change

public void on timeline changed ( player player ) { current player media period = find current player media period in queue ( player , media period queue , playing media period , period ) ; update media period timelines ( / * preferred timeline = * / player get current timeline ( ) ) ; }


gets the configured directory permissions for the user directories in the directory of the intermediate done history files the user and the group both need full permissions , this is enforced by this method

public static fs permission get configured history intermediate user done dir permissions ( configuration conf ) { string user done dir permissions = conf get ( j h admin config mr history intermediate user done dir permissions ) ; if ( user done dir permissions = = null ) { return new fs permission ( j h admin config default mr history intermediate user done dir permissions ) ; } fs permission permission = new fs permission ( user done dir permissions ) ; if ( permission get user action ( ) ! = fs action all | | permission get group action ( ) ! = fs action all ) { permission = new fs permission ( fs action all , fs action all , permission get other action ( ) , permission get sticky bit ( ) ) ; log warn ( " unsupported permission configured in " + j h admin config mr history intermediate user done dir permissions + " , the user and the group permission must be 7 ( rwx ) " + " the permission was set to " + permission to string ( ) ) ; } return permission ; }


checks the address to make sure the listing won ' t navigate outside the addresses it currently has loaded if it is not a valid address it will set a status message on the dual listing

private boolean validate address ( address addr ) { if ( addr = = null ) { return false ; } address set view addresses = is left side ? dual listing get left addresses ( ) : dual listing get right addresses ( ) ; if ( ! addresses contains ( addr ) ) { dual listing set status info ( " \ " " + addr to string ( ) + " \ " is outside the current listing ' s view " ) ; return false ; } return true ; }


protected subscription upstream ( ) { return subscription ; }


public void close ( ) { if ( writer ! = null ) { writer on completed ( ) ; } }


private static byte [ ] get buffer array ( byte buffer buffer ) { byte [ ] buff = new byte [ buffer remaining ( ) ] ; if ( buffer has array ( ) ) { buff = buffer array ( ) ; } else { buffer slice ( ) get ( buff ) ; } return buff ; }


makes sure that the workspace deletion link is not provided when the user doesn ' t have an access

public void wipe workspace protected 2 ( ) throws exception { ( ( global matrix authorization strategy ) j jenkins get authorization strategy ( ) ) add ( abstract project workspace , " anonymous " ) ; / / make sure that the deletion is protected in the same way wipe workspace protected ( ) ; / / there shouldn ' t be any " wipe out workspace " link for anonymous user jenkins rule web client web client = j create web client ( ) ; html page page = web client get page ( j jenkins get item ( " test 0 " ) ) ; page = page get anchor by text ( " workspace " ) click ( ) ; try { string wipe out label = resource bundle get bundle ( " hudson / model / abstract project / sidepanel " ) get string ( " wipe out workspace " ) ; page get anchor by text ( wipe out label ) ; fail ( " shouldn ' t find a link " ) ; } catch ( element not found exception e ) { / / ok } }


writes the java sources for a given package

public void write sources to ( path source out , string package name , collection < resource symbols > package symbols , boolean final fields ) throws i o exception { r source generator with ( source out , as initializers ( ) , final fields ) write ( package name , merge ( package symbols ) as initializers ( ) ) ; }


verifies that we set the flags for placeholder id correctly when applying a placeholder id via another request options

public void placeholder id flag after applying id via other request options is set ( ) { assert that ( options placeholder ( new color drawable ( color red ) ) apply ( new request options ( ) apply ( new request options ( ) placeholder ( android r drawable star on ) ) ) get placeholder drawable ( ) ) is null ( ) ; }


assume that the connection is not released : throws an exception if it is

private synchronized void assume not released ( ) throws swift connection closed exception { if ( released | | in stream = = null ) { throw new swift connection closed exception ( reason closed ) ; } }


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


flag to indicate that all failures in sql should be logged but not cause a failure defaults to { @ code false }

public void set continue on error ( boolean continue on error ) { this continue on error = continue on error ; }


public static void ensure service sso access is allowed ( final registered service registered service , final service service , final ticket granting ticket ticket granting ticket ) { ensure service sso access is allowed ( registered service , service , ticket granting ticket , false ) ; }


multiplies the vectors with the top most 3x 3 sub - matrix of the given matrix the matrix array is assumed to hold a 4x 4 column major matrix as you can get from { @ link matrix 4 # val } the vectors array is assumed to hold 3 - component vectors offset specifies the offset into the array where the x - component of the first vector is located the num vecs parameter specifies the number of vectors stored in the vectors array the stride parameter specifies the number of floats between subsequent vectors and must be > = 3 this is the same as { @ link vector 3 # rot ( matrix 4 ) } applied to multiple vectors

public static native void rot ( float [ ] mat , float [ ] vecs , int offset , int num vecs , int stride ) / * - { } - * / ; / * float * vec ptr = vecs + offset ; for ( int i = 0 ; i < num vecs ; i + + ) { matrix 4 rot ( mat , vec ptr ) ; vec ptr + = stride ; } * / / / @ on


adds a part to the uploads without any size limitations this method is non - blocking and does not wait for the part upload to complete

public void upload part ( ref counted f s output stream file ) throws i o exception { / / this is to guarantee that nobody is / / writing to the file we are uploading check state ( file is closed ( ) ) ; final completable future < part e tag > future = new completable future < > ( ) ; uploads in progress add ( future ) ; final long part length = file get pos ( ) ; current upload info register new part ( part length ) ; file retain ( ) ; / / keep the file while the async upload still runs upload thread pool execute ( new upload task ( s 3 access helper , current upload info , file , future ) ) ; }


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


returns a stream of the g tree nodes in the subtree of this node

public stream < g tree node > stream ( boolean depth first ) { return collection utils as stream ( iterator ( depth first ) ) ; }


reads all bytes from input stream and writes them to output stream when all bytes are read output stream to byte buffer is called and obtained memory pooled byte buffer is returned

memory pooled byte buffer new byte buf ( input stream input stream , memory pooled byte buffer output stream output stream ) throws i o exception { m pooled byte streams copy ( input stream , output stream ) ; return output stream to byte buffer ( ) ; }


public int get hit count ( ) { return this hit count get ( ) ; }


returns { @ code true } if the given user event should be handled if { @ code false } it will be passed to the next { @ link channel inbound handler } in the { @ link channel pipeline }

protected boolean accept event ( object evt ) throws exception { return matcher match ( evt ) ; }


sets the { @ link caption callback } to handle requests to enable or disable captions

public void set caption callback ( @ nullable caption callback caption callback ) { if ( this caption callback ! = caption callback ) { unregister command receiver ( this caption callback ) ; this caption callback = caption callback ; register command receiver ( this caption callback ) ; } }


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

public static fields find by name ( string name ) { return by name get ( name ) ; }


public static void drop table ( database db , boolean if exists ) { string sql = " drop table " + ( if exists ? " if exists " : " " ) + " \ " keep entity \ " " ; db exec s q l ( sql ) ; }


creates a file path with a filename that is under the system temp directory the path returned will not point to an existing file the suffix of the file will be < code > tmp < code >

public string create temp file path ( string name ) throws i o exception { string path = create temp file path ( name , " tmp " ) ; return path ; }


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

public boolean is set e ( ) { return this e ! = null ; }


list the current loggers that have their levels explicitly set and their log levels

public response list loggers ( ) { map < string , map < string , string > > loggers = new tree map < > ( ) ; enumeration < logger > enumeration = current loggers ( ) ; collections list ( enumeration ) stream ( ) filter ( logger - > logger get level ( ) ! = null ) for each ( logger - > loggers put ( logger get name ( ) , level to map ( logger ) ) ) ; logger root = root logger ( ) ; if ( root get level ( ) ! = null ) { loggers put ( root logger name , level to map ( root ) ) ; } return response ok ( loggers ) build ( ) ; }


create { @ link test input topic } to be used for piping records to topic uses current system time as start timestamp for records auto - advance is disabled

public final < k , v > test input topic < k , v > create input topic ( final string topic name , final serializer < k > key serializer , final serializer < v > value serializer ) { return new test input topic < > ( this , topic name , key serializer , value serializer , instant now ( ) , duration zero ) ; }


views the array as an immutable list checks for nulls ; does not copy

private static < e > immutable list < e > construct ( object elements ) { return as immutable list ( check elements not null ( elements ) ) ; }


login via a ugi requres ugi to have been set up

public static user group information login u g i ( string user , file keytab ) throws i o exception { log info ( " logging in as { } from { } " , user , keytab ) ; return user group information login user from keytab and return u g i ( user , keytab get absolute path ( ) ) ; }


return the name of the persistence provider ' s root package ( e g " oracle toplink essentials " ) will be used for excluding provider classes from temporary class overriding

default string get persistence provider root package ( ) { return null ; }


flag to indicate that this test is being executed in parallel this is used by some of the scale tests to validate test time expectations

protected boolean is parallel execution ( ) { return boolean get boolean ( s 3 a test constants key parallel test execution ) ; }


tgs must have the server principal of the form " krbtgt f o o @ foo "

private static boolean is ticket granting server principal ( kerberos principal principal ) { if ( principal = = null ) { return false ; } if ( principal get name ( ) equals ( " krbtgt / " + principal get realm ( ) + " @ " + principal get realm ( ) ) ) { return true ; } return false ; }


public static bitmap to round corner ( final bitmap src , final float radius ) { return to round corner ( src , radius , 0 , 0 , false ) ; }


return true if this type holder default 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 ; } type holder default type holder default = ( type holder default ) o ; return objects equals ( this string item , type holder default string item ) & & objects equals ( this number item , type holder default number item ) & & objects equals ( this integer item , type holder default integer item ) & & objects equals ( this bool item , type holder default bool item ) & & objects equals ( this array item , type holder default array item ) ; }


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


advances the read position to the specified absolute position

private void advance read to ( long absolute position ) { while ( absolute position > = read allocation node end position ) { read allocation node = read allocation node next ; } }


sets the partitioning of the { @ link data stream } so that the output elements are forwarded to the local subtask of the next operation

public data stream < t > forward ( ) { return set connection type ( new forward partitioner < t > ( ) ) ; }


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


public static void do and ignore ( final checked consumer < object > consumer , final object params ) { unchecked consumer ( s - > consumer accept ( params ) ) accept ( null ) ; }


sets the input to the union of the given operators

public void set inputs ( list < operator < in > > inputs ) { check not null ( inputs , " the inputs may not be null " ) ; this input = operator create union cascade ( inputs ) ; }


test that server trash configuration is respected even when the client configuration is set

public void test server config respected with client ( ) throws exception { delete file using trash ( true , true ) ; }


create a scratch file in the given filesystem , with the given path name , consisting of a set of lines the method returns a path instance for the scratch file

void write file ( string file name , string lines ) throws i o exception ;


public date histogram interval get interval ( ) { return interval ; }


sets the require alias request flag on the destination index

public reindex request set require alias ( boolean require alias ) { this get destination ( ) set require alias ( require alias ) ; return this ; }


returns the { @ link type } for a specific byte value as defined in the proxy protocol 1 5 spec if the byte value is not an official one , it will return { @ link type # other }

public static type type for byte value ( byte byte value ) { switch ( byte value ) { case 0x 0 1 : return pp2 type alpn ; case 0x 0 2 : return pp2 type authority ; case 0x 2 0 : return pp2 type ssl ; case 0x 2 1 : return pp2 type ssl version ; case 0x 2 2 : return pp2 type ssl cn ; case 0x 3 0 : return pp2 type netns ; default : return other ; } }


certify the checked stream integrity by checking the header length and format

private static boolean is valid checked stream ( file f ) throws i o exception { try ( random access file raf = new random access file ( f , " r " ) ) { / / including the header and the last / bytes / / the snapshot should be at least 10 bytes if ( raf length ( ) < 10 ) { return false ; } raf seek ( raf length ( ) - 5 ) ; byte [ ] bytes = new byte [ 5 ] ; int readlen = 0 ; int l ; while ( readlen < 5 & & ( l = raf read ( bytes , readlen , bytes length - readlen ) ) > = 0 ) { readlen + = l ; } if ( readlen ! = bytes length ) { log info ( " invalid snapshot { } too short , len = { } bytes " , f get name ( ) , readlen ) ; return false ; } byte buffer bb = byte buffer wrap ( bytes ) ; int len = bb get int ( ) ; byte b = bb get ( ) ; if ( len ! = 1 | | b ! = ' / ' ) { log info ( " invalid snapshot { } len = { } , byte = { } " , f get name ( ) , len , ( b & 0xff ) ) ; return false ; } } return true ; }


witness classes that are added since 0 63 0

protected string [ ] witness classes ( ) { return new string [ ] { " com linecorp armeria client endpoint dns dns endpoint group " , " com linecorp armeria common immutable http headers " } ; }


set a view visibility to visible ( true ) or gone ( false )

public base adapter helper set visible ( int view id , boolean visible ) { view view = retrieve view ( view id ) ; view set visibility ( visible ? view visible : view gone ) ; return this ; }


executes the given task , within a concurrency throttle if configured ( through the superclass ' s settings ) executes urgent tasks ( with ' immediate ' timeout ) directly , bypassing the concurrency throttle ( if active ) all other tasks are subject to throttling

public void execute ( runnable task , long start timeout ) { assert not null ( task , " runnable must not be null " ) ; runnable task to use = ( this task decorator ! = null ? this task decorator decorate ( task ) : task ) ; if ( is throttle active ( ) & & start timeout > timeout immediate ) { this concurrency throttle before access ( ) ; do execute ( new concurrency throttling runnable ( task to use ) ) ; } else { do execute ( task to use ) ; } }


returns true if the element is package - private

public final boolean is package private ( ) { return ! is private ( ) & & ! is public ( ) & & ! is protected ( ) ; }


add the passed { @ link user } to the paid user group list

public static void add user to paid group ( final user user ) throws illegal argument exception { if ( free group contains ( user ) ) { throw new illegal argument exception ( " user all ready member of free group " ) ; } else { if ( ! paid group contains ( user ) ) { paid group add ( user ) ; } } }


create a { @ code http range } from the given fist to last position

public static http range create byte range ( long first byte pos , long last byte pos ) { return new byte range ( first byte pos , last byte pos ) ; }


returns all co - location groups in the job

set < co location group > get co location groups ( ) ;


the window update ratio is used to determine when a window update must be sent if the ratio of bytes processed since the last update has meet or exceeded this ratio then a window update will be sent this window update ratio will only be applied to { @ code stream id } note it is the responsibly of the caller to ensure that the the initial { @ code settings } frame is sent before this is called it would be considered a { @ link http 2 error # protocol error } if a { @ code window update } was generated by this method before the initial { @ code settings } frame is sent

public void window update ratio ( http 2 stream stream , float ratio ) throws http 2 exception { assert ctx ! = null & & ctx executor ( ) in event loop ( ) ; check valid ratio ( ratio ) ; flow state state = state ( stream ) ; state window update ratio ( ratio ) ; state write window update if needed ( ) ; }


build a model with the given name , including the given suites this method should be called before any command line filters are applied the given { @ code properties } map will be applied to the root { @ link test suite node }

public test suite model build ( string suite name , map < string , string > properties , description top level suites ) { if ( build was called ) { throw new illegal state exception ( " builder build ( ) was already called " ) ; } build was called = true ; if ( sharding environment is sharding enabled ( ) ) { sharding filter = get sharding filter ( top level suites ) ; } root node = new test suite node ( description create suite description ( suite name ) , properties ) ; for ( description top level suite : top level suites ) { add test suite ( root node , top level suite ) ; root node get description ( ) add child ( top level suite ) ; } return new test suite model ( this ) ; }


sets the maximum depth for nested sets constructed by the starlark { @ code depset } function ( as set by { @ code - - nested set depth limit } )

public static boolean set depth limit ( int new limit ) { int old value = depth limit get and set ( new limit ) ; return old value ! = new limit ; }


if a value is present in { @ code optional } , returns a stream containing only that element , otherwise returns an empty stream < b > java 9 users : < b > use { @ code optional stream ( ) } instead

public static long stream stream ( optional long optional ) { return optional is present ( ) ? long stream of ( optional get as long ( ) ) : long stream empty ( ) ; }


public static void main ( string [ ] args ) { var wizard = new wizard ( ) ; var goblin = new goblin ( ) ; goblin print status ( ) ; wizard cast spell ( goblin : : change size ) ; goblin print status ( ) ; wizard cast spell ( goblin : : change visibility ) ; goblin print status ( ) ; wizard undo last spell ( ) ; goblin print status ( ) ; wizard undo last spell ( ) ; goblin print status ( ) ; wizard redo last spell ( ) ; goblin print status ( ) ; wizard redo last spell ( ) ; goblin print status ( ) ; }


split a string at the first occurrence of the delimiter does not include the delimiter in the result

public static string [ ] split ( string to split , string delimiter ) { if ( ! has length ( to split ) | | ! has length ( delimiter ) ) { return null ; } int offset = to split index of ( delimiter ) ; if ( offset < 0 ) { return null ; } string before delimiter = to split substring ( 0 , offset ) ; string after delimiter = to split substring ( offset + delimiter length ( ) ) ; return new string [ ] { before delimiter , after delimiter } ; }


puts the previous editable cell into edit mode

protected boolean edit previous field ( int current row ) { if ( locate previous edit field ( current row ) ) { return begin edit field ( model get row ( ) , model get column ( ) ) ; } return false ; }


helper method to configure the usernamepassword for basic auth or password o auth

public void set credentials ( string username , string password ) { for ( request interceptor api authorization : api authorizations values ( ) ) { if ( api authorization instanceof http basic auth ) { http basic auth basic auth = ( http basic auth ) api authorization ; basic auth set credentials ( username , password ) ; return ; } if ( api authorization instanceof o auth ) { o auth oauth = ( o auth ) api authorization ; oauth get token request builder ( ) set username ( username ) set password ( password ) ; return ; } } throw new runtime exception ( " no basic authentication or o auth configured ! " ) ; }


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


register a listener that will be called when this model visibility has changed the listener will contribute to this model ' s hash code state per the { @ link com airbnb epoxy epoxy attribute option # do not hash } rules

public model with annotation on visibility changed ( on model visibility changed listener < model with annotation , object > listener ) { on mutation ( ) ; this on model visibility changed listener epoxy generated model = listener ; return this ; }


attempts to use to the abfs stream after it is closed

public void test write after close ( ) throws throwable { final azure blob file system fs = get file system ( ) ; path test path = new path ( test folder path , test child file ) ; f s data output stream out = fs create ( test path ) ; out close ( ) ; intercept ( i o exception class , ( ) - > out write ( ' a ' ) ) ; intercept ( i o exception class , ( ) - > out write ( new byte [ ] { ' a ' } ) ) ; / / hsync is not ignored on a closed stream / / out hsync ( ) ; out flush ( ) ; out close ( ) ; }


if { @ code true } , indicates that the call is capable of sending additional messages without requiring excessive buffering internally this event is just a suggestion and the application is free to ignore it , however doing so may result in excessive buffering within the call if { @ code false } , { @ link listener # on ready ( ) } will be called after { @ code is ready ( ) } transitions to { @ code true } this abstract class ' s implementation always returns { @ code true } implementations generally override the method

public boolean is ready ( ) { return true ; }


we expect an arithmetic exception exception here because last ( ) emits a single value but then we divide by 0

public void map with error in func ( ) { observable range ( 1 , 1 ) last element ( ) map ( new function < integer , integer > ( ) { @ override public integer apply ( integer i ) { return i / 0 ; } } ) blocking get ( ) ; } / / fixme rs subscribers can ' t throw / / @ test ( expected = on error not implemented exception class ) / / public void verify exception is thrown if there is no exception handler ( ) { / / / / observable source < object > creator = new observable source < object > ( ) { / / / / @ override / / public void subscribe actual ( observer < ? super object > observer ) { / / observer on subscribe ( empty disposable instance ) ; / / observer on next ( " a " ) ; / / observer on next ( " b " ) ; / / observer on next ( " c " ) ; / / observer on complete ( ) ; / / } / / } ; / / / / function < object , observable < object > > many mapper = new function < object , observable < object > > ( ) { / / / / @ override / / public observable < object > apply ( object object ) { / / return observable just ( object ) ; / / } / / } ; / / / / function < object , object > mapper = new function < object , object > ( ) { / / private int count = 0 ; / / / / @ override / / public object apply ( object object ) { / / + + count ; / / if ( count > 2 ) { / / throw new runtime exception ( ) ; / / } / / return object ; / / } / / } ; / / / / consumer < object > on next = new consumer < object > ( ) { / / / / @ override / / public void accept ( object object ) { / / system out println ( object to string ( ) ) ; / / } / / } ; / / / / try { / / observable unsafe create ( creator ) flat map ( many mapper ) map ( mapper ) subscribe ( on next ) ; / / } catch ( runtime exception e ) { / / e print stack trace ( ) ; / / throw e ; / / } / / }


test that program merge filter works as expected

public void test merge filter ( ) throws exception { program merge = new program merge manager ( p 1 , p 2 , task monitor adapter dummy monitor ) ; / / check that default filter has all difference types set assert equals ( new program merge filter ( ) , program merge get merge filter ( ) ) ; / / see if we set it to all differences and merging , that is what we get program merge set merge filter ( new program merge filter ( program merge filter all , program merge filter merge ) ) ; assert equals ( new program merge filter ( program merge filter all , program merge filter merge ) , program merge get merge filter ( ) ) ; / / see if we set it to all differences with no merging , that is what we get program merge set merge filter ( new program merge filter ( program merge filter all , program merge filter replace ) ) ; assert equals ( new program merge filter ( program merge filter all , program merge filter replace ) , program merge get merge filter ( ) ) ; / / see if we set it to specific differences , that is what we get program merge set merge filter ( new program merge filter ( program merge filter code units | program merge filter comments , program merge filter merge ) ) ; assert equals ( new program merge filter ( program merge filter code units | program merge filter comments , program merge filter merge ) , program merge get merge filter ( ) ) ; }


do not attempt to create gv2 groups , i e will force creation of gv1 or mms groups

public synchronized boolean gv 2 do not create gv 2 groups ( ) { return feature flags internal user ( ) & & get boolean ( gv2 do not create gv2 , false ) ; }


test that we can edit a tag in latest and add it to a function in my to create a conflict

public void test edit my add latest no conflict ( ) throws exception { mtf initialize ( notepad , new original program modifier listener ( ) { @ override public void modify latest ( program d b program ) throws exception { int transaction i d = program start transaction ( " latest " ) ; try { edit tag name ( program , tag name a , tag name a latest ) ; } finally { program end transaction ( transaction i d , true ) ; } } @ override public void modify private ( program d b program ) throws exception { int transaction i d = program start transaction ( " my " ) ; try { add tag to function ( tag name a , program , " 1 0 0 2 9 9e " ) ; } finally { program end transaction ( transaction i d , true ) ; } } @ override public void modify original ( program d b program ) throws exception { int transaction i d = program start transaction ( " original " ) ; try { function tag manager tag manager = get tag manager ( program ) ; tag manager create function tag ( tag name a , " " ) ; add tag to function ( tag name a , program , " 1 0 0 1 9 4b " ) ; } finally { program end transaction ( transaction i d , true ) ; } } } ) ; execute merge ( ask user ) ; int conflicts = get tag listing conflict count ( ) ; assert true ( conflicts = = 1 ) ; choose function tag button ( latest button , false ) ; wait for merge completion ( ) ; assert true ( is tag in program ( tag name a latest , mtf get result program ( ) ) ) ; assert true ( ! is tag in program ( tag name a , mtf get result program ( ) ) ) ; assert true ( is tag in function ( tag name a latest , mtf get result program ( ) , " 1 0 0 1 9 4b " ) ) ; assert true ( is tag in function ( tag name a latest , mtf get result program ( ) , " 1 0 0 2 9 9e " ) ) ; }


set the gap ( in pixels ) between two consecutive cards

public void set card gap ( float m card gap ) { this m card gap = m card gap ; }


return a { @ link resolvable type } for the specified { @ link method } return type

public static resolvable type for method return type ( method method ) { assert not null ( method , " method must not be null " ) ; return for method parameter ( new method parameter ( method , - 1 ) ) ; }


to be invoked only by the jackson json serializer

public hash map < string , state pair > get states ( ) { return pool ; }


this implementation converts a text message back to a string , a byte message back to a byte array , a map message back to a map , and an object message back to a serializable object returns the plain message object in case of an unknown message type

public object from message ( message message ) throws j m s exception , message conversion exception { if ( message instanceof text message ) { return extract string from message ( ( text message ) message ) ; } else if ( message instanceof bytes message ) { return extract byte array from message ( ( bytes message ) message ) ; } else if ( message instanceof map message ) { return extract map from message ( ( map message ) message ) ; } else if ( message instanceof object message ) { return extract serializable from message ( ( object message ) message ) ; } else { return message ; } }


protected < k , v > kafka producer < k , v > get kafka producer ( properties props ) { return new kafka producer < > ( props ) ; }


check if identity is allowed to access the specified catalog

default void check can access catalog ( identity identity , access control context context , string catalog name ) { deny catalog access ( catalog name ) ; }


public void add contents ( dex file file ) { super add contents ( file ) ; type ids section type ids = file get type ids ( ) ; type ids intern ( get field ref ( ) get type ( ) ) ; }


will change globbing characters to work as expected in ghidra , unless the special characters are escaped with a backslash

private static string convert globbing characters to regex ( string input ) { / / note : order is important ! / / replace all unescaped ' ? ' chars matcher question matcher = question pattern matcher ( input ) ; string question replaced = question matcher replace all ( " " ) ; / / replace all unescaped ' * ' chars matcher star matcher = star pattern matcher ( question replaced ) ; / / * ? is a reluctant quantifier , matching zero or more ' * ' is the quantifier , ' ? ' makes / / it reluctant string star replaced = star matcher replace all ( " * ? " ) ; return star replaced ; }


public void set show next button ( boolean show next button ) { this show next button = show next button ; update navigation ( ) ; }


sets an offset to be applied to positions returned by { @ link # seek to us ( long ) }

public void set seek to us offset ( long seek offset us ) { this seek offset us = seek offset us ; }


get the intrinsic width of the underlying animation or { @ link # intrinsic dimension unset } if not available this value is used by the underlying drawable for aspect ratio computations , similar to { @ link drawable # get intrinsic width ( ) }


adds an authorization to be used by the client

public api client add authorization ( string auth name , interceptor authorization ) { if ( api authorizations contains key ( auth name ) ) { throw new runtime exception ( " auth name \ " " + auth name + " \ " already in api authorizations " ) ; } api authorizations put ( auth name , authorization ) ; if ( ok builder = = null ) { throw new runtime exception ( " the api client was created with a built ok http client so it ' s not possible to add an authorization interceptor to it " ) ; } ok builder add interceptor ( authorization ) ; return this ; }


helper for { @ link # visit constant } where the constant is an { @ code int }

private void visit literal int ( int opcode , int offset , int length , int value ) { string comment or space = ( length = = 1 ) ? " / / " : " " ; string value str ; opcode = bytes get unsigned byte ( offset ) ; / / compare with orig op below if ( ( length = = 1 ) | | ( opcode = = byte ops bipush ) ) { value str = " # " + hex s 1 ( value ) ; } else if ( opcode = = byte ops sipush ) { value str = " # " + hex s 2 ( value ) ; } else { value str = " # " + hex s 4 ( value ) ; } observer parsed ( bytes , offset , length , header ( offset ) + comment or space + value str ) ; }


public void read exception ( ) { read exceptions increment and get ( ) ; }


void on tracks selected ( boolean is disabled , list < selection override > overrides ) ;


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

public static fields find by name ( string name ) { return by name get ( name ) ; }


equivalent to calling { @ link # get ( string ) } and casting the result to a integer

public integer get int 3 2 ( string field name ) { return ( integer ) get check type ( field name , schema type int32 ) ; }


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


sets the { @ code reader index } and { @ code writer index } of this buffer in one shot this method is useful when you have to worry about the invocation order of { @ link # reader index ( int ) } and { @ link # writer index ( int ) } methods for example , the following code will fail : < p > create a buffer whose reader index , writer index and capacity are 0 , 0 and 8 respectively { @ link channel buffer } buf = { @ link channel buffers } buffer ( 8 ) ; index out of bounds exception is thrown because the specified reader index ( 2 ) cannot be greater than the current writer index ( 0 ) buf reader index ( 2 ) ; buf writer index ( 4 ) ; < p > the following code will also fail : < p > create a buffer whose reader index , writer index and capacity are 0 , 8 and 8 respectively { @ link channel buffer } buf = { @ link channel buffers } wrapped buffer ( new byte [ 8 ] ) ; reader index becomes 8 buf read long ( ) ; index out of bounds exception is thrown because the specified writer index ( 4 ) cannot be less than the current reader index ( 8 ) buf writer index ( 4 ) ; buf reader index ( 2 ) ; < p > by contrast , { @ link # set index ( int , int ) } guarantees that it never throws an { @ link index out of bounds exception } as long as the specified indexes meet basic constraints , regardless what the current index values of the buffer are : < p > no matter what the current state of the buffer is , the following call always succeeds as long as the capacity of the buffer is not less than 4 buf set index ( 2 , 4 ) ;

void set index ( int reader index , int writer index ) ;


this method is synchronized in order to avoid messy of logs ' order

private synchronized void log ( int priority , @ nullable throwable throwable , @ non null string msg , @ nullable object args ) { check not null ( msg ) ; string tag = get tag ( ) ; string message = create message ( msg , args ) ; log ( priority , tag , message , throwable ) ; }


helper method that encodes any of the three - unit register - range formats

private static void encode register range ( decoded instruction insn , code output out ) { out write ( code unit ( insn get opcode ( ) , insn get register count ( ) ) , insn get index unit ( ) , insn get a unit ( ) ) ; }


starts multiple nodes with the given settings and returns their names

public synchronized list < string > start nodes ( settings extra settings ) { final int new master count = math to int exact ( stream of ( extra settings ) filter ( discovery node : : is master node ) count ( ) ) ; final list < node and client > nodes = new array list < > ( ) ; final int prev master count = get master nodes count ( ) ; int auto bootstrap master node index = auto manage master nodes & & prev master count = = 0 & & new master count > 0 & & arrays stream ( extra settings ) all match ( s - > discovery node is master node ( s ) = = false | | zen2 discovery type equals ( discovery type setting get ( s ) ) ) ? random numbers random int between ( random , 0 , new master count - 1 ) : - 1 ; final int num of nodes = extra settings length ; final int first node id = next node id get and increment ( ) ; final list < settings > settings = new array list < > ( ) ; for ( int i = 0 ; i < num of nodes ; i + + ) { settings add ( get node settings ( first node id + i , random next long ( ) , extra settings [ i ] ) ) ; } next node id set ( first node id + num of nodes ) ; final list < string > initial master nodes = settings stream ( ) filter ( discovery node : : is master node ) map ( node node name setting : : get ) collect ( collectors to list ( ) ) ; final list < settings > updated settings = bootstrap master node with specified index ( settings ) ; for ( int i = 0 ; i < num of nodes ; i + + ) { final settings node settings = updated settings get ( i ) ; final builder builder = settings builder ( ) ; if ( discovery node is master node ( node settings ) ) { if ( auto bootstrap master node index = = 0 ) { builder put list ( initial master nodes setting get key ( ) , initial master nodes ) ; } auto bootstrap master node index - = 1 ; } final node and client node and client = build node ( first node id + i , builder put ( node settings ) build ( ) , false , ( ) - > rebuild unicast host files ( nodes ) ) ; nodes add ( node and client ) ; } start and publish nodes and clients ( nodes ) ; if ( auto manage master nodes ) { validate cluster formed ( ) ; } return nodes stream ( ) map ( node and client : : get name ) collect ( collectors to list ( ) ) ; }


gets the { @ code enclosing method } attribute out of a given { @ link attribute list } , if any , translating it to an annotation if the class really has an enclosing method , this returns an { @ code enclosing method } annotation ; if not , this returns an { @ code enclosing class } annotation

private static annotation translate enclosing method ( attribute list attribs ) { att enclosing method enclosing method = ( att enclosing method ) attribs find first ( att enclosing method attribute name ) ; if ( enclosing method = = null ) { return null ; } cst type enclosing class = enclosing method get enclosing class ( ) ; cst nat nat = enclosing method get method ( ) ; if ( nat = = null ) { / * * dalvik doesn ' t use enclosing method annotations unless * there really is an enclosing method anonymous classes * are unambiguously identified by having an inner class * annotation with an empty name along with an appropriate * enclosing class * / return annotation utils make enclosing class ( enclosing class ) ; } return annotation utils make enclosing method ( new cst method ref ( enclosing class , nat ) ) ; }


implementation of inputformat : : create record reader ( )

public record reader < k , v > create record reader ( input split input split , task attempt context task attempt context ) throws i o exception , interrupted exception { chunk context = get chunk context ( task attempt context get configuration ( ) ) ; return new dynamic record reader < k , v > ( chunk context ) ; }


returns whether the current window is live , or { @ code false } if the { @ link timeline } is empty


verify split sampler contract , that an equal number of records are taken from the first splits

public void test split sampler ( ) throws exception { final int tot splits = 15 ; final int num splits = 5 ; final int step sample = 5 ; final int num samples = num splits * step sample ; input sampler sampler < int writable , null writable > sampler = new input sampler split sampler < int writable , null writable > ( num samples , num splits ) ; int inits [ ] = new int [ tot splits ] ; for ( int i = 0 ; i < tot splits ; + + i ) { inits [ i ] = i * step sample ; } job ignored = job get instance ( ) ; object [ ] samples = sampler get sample ( new test input sampler i f ( 100000 , tot splits , inits ) , ignored ) ; assert equals ( num samples , samples length ) ; arrays sort ( samples , new int writable comparator ( ) ) ; for ( int i = 0 ; i < num samples ; + + i ) { assert equals ( i , ( ( int writable ) samples [ i ] ) get ( ) ) ; } }


adds a condition that has to be satisfied by an event in order to be considered a match if another condition has already been set , the new one is going to be combined with the previous with a logical { @ code or } in other case , this is going to be the only condition

public pattern < t , f > or ( iterative condition < f > condition ) { preconditions check not null ( condition , " the condition cannot be null " ) ; closure cleaner clean ( condition , execution config closure cleaner level recursive , true ) ; if ( this condition = = null ) { this condition = condition ; } else { this condition = new rich or condition < > ( this condition , condition ) ; } return this ; }


public void upload file ( long pet id , string additional metadata , async file file , api client auth info auth info , handler < async result < model api response > > result handler ) { delegate upload file ( pet id , additional metadata , file , auth info , result handler ) ; }


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


constructs a key for loading a regular ( non - prelude ) bzl

public static key key ( root root , label label ) { return key create ( root , label , kind normal ) ; }


returns the starting position of the highlight

public int get start ( ) { return start + offset ; }


if the stream is only closed , we remove the produced file ( cleanup through the auto close feature , for example ) this method throws no exception if the deletion fails , but only logs the error

public void close ( ) { if ( ! closed ) { closed = true ; / / make sure write requests need to go to ' flush to file ( ) ' where they recognized / / that the stream is closed pos = write buffer length ; if ( out stream ! = null ) { try { out stream close ( ) ; } catch ( throwable throwable ) { log warn ( " could not close the state stream for { } " , state path , throwable ) ; } finally { try { fs delete ( state path , false ) ; } catch ( exception e ) { log warn ( " cannot delete closed and discarded state stream for { } " , state path , e ) ; } } } } }


select the content - type header ' s value from the given array : if json exists in the given array , use it ; otherwise use the first one of the array

public string select header content type ( string [ ] content types ) { if ( content types length = = 0 ) { return " application / json " ; } for ( string content type : content types ) { if ( is json mime ( content type ) ) { return content type ; } } return content types [ 0 ] ; }


return the socket factory of this client

socket factory get socket factory ( ) { return socket factory ; }


sets the write timeout ( in milliseconds ) a value of 0 means no timeout , otherwise values must be between 1 and { @ link integer # max value }

public api client set write timeout ( int write timeout ) { http client = http client new builder ( ) write timeout ( write timeout , time unit milliseconds ) build ( ) ; return this ; }


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


how many nanoseconds should a batch of last batch size have taken if it were perfectly throttled ? package private for testing

float perfectly throttled batch time ( int last batch size ) { if ( requests per second = = float positive infinity ) { return 0 ; } / / requests / / - - - - - - - - - - - - - - - - - - - = = seconds / / request per seconds float target batch time in seconds = last batch size / requests per second ; / / nanoseconds per seconds * seconds = = nanoseconds return time unit seconds to nanos ( 1 ) * target batch time in seconds ; }


try to enqueue the reader once receiving credit notification from the consumer or receiving non - empty reader notification from the producer note : only one thread would trigger the actual enqueue after checking the reader ' s availability , so there is no race condition here

private void enqueue available reader ( final network sequence view reader reader ) throws exception { if ( reader is registered as available ( ) | | ! reader is available ( ) ) { return ; } / / queue an available reader for consumption if the queue is empty , / / we try trigger the actual write otherwise this will be handled by / / the write and flush next message if possible calls boolean trigger write = available readers is empty ( ) ; register available reader ( reader ) ; if ( trigger write ) { write and flush next message if possible ( ctx channel ( ) ) ; } }


create a variant of { @ link java util properties } that sorts properties alphanumerically based on their keys this can be useful when storing the { @ link properties } instance in a properties file , since it allows such files to be generated in a repeatable manner with consistent ordering of properties comments in generated properties files can also be optionally omitted

public static properties create sorted properties ( boolean omit comments ) { return new sorted properties ( omit comments ) ; }


get a new generation stamp together with an access token for a block under construction this method is called for recovering a failed write or setting up a block for appended

located block bump block generation stamp ( extended block block , string client name ) throws i o exception { final located block located block ; check operation ( operation category write ) ; write lock ( ) ; try { check operation ( operation category write ) ; / / check vadility of parameters final i node file file = check u c block ( block , client name ) ; / / get a new generation stamp and an access token block set generation stamp ( next generation stamp ( block manager is legacy block ( block get local block ( ) ) ) ) ; located block = block manager new located block ( block , file get last block ( ) , null , - 1 ) ; block manager set block token ( located block , block token identifier access mode write ) ; } finally { write unlock ( " bump block generation stamp " ) ; } / / ensure we record the new generation stamp get edit log ( ) log sync ( ) ; return located block ; }


this implementation always returns { @ code true }

public boolean exists ( ) { return true ; }


sets the exec group for this action by name this does not check that { @ code exec group } is being set to a valid exec group ( i e one that actually exists ) this method expects callers to do that work

public builder set exec group ( string exec group ) { this exec group = exec group ; return this ; }


when nn failover happens , if the client did not receive the response and send a retry request to the other nn , the same response should be received based on the retry cache

public void test client retry with failover ( final at most once op op ) throws exception { final map < string , object > results = new concurrent hash map < > ( ) ; op prepare ( ) ; / / set dummy retry invocation handler # block to true dummy retry invocation handler block set ( true ) ; new thread ( ) { @ override public void run ( ) { try { op invoke ( ) ; object result = op get result ( ) ; log info ( " operation " + op name + " finished " ) ; results put ( op name , result = = null ? " success " : result ) ; } catch ( exception e ) { log info ( " got exception while calling " + op name , e ) ; } finally { i o utils cleanup ( null , op client ) ; } } } start ( ) ; / / make sure the client ' s call has actually been handled by the active nn assert true ( " after waiting the operation " + op name + " still has not taken effect on nn yet " , op check namenode before return ( ) ) ; / / force the failover cluster transition to standby ( 0 ) ; cluster transition to active ( 1 ) ; / / disable the block in dummy handler log info ( " setting block to false " ) ; dummy retry invocation handler block set ( false ) ; generic test utils wait for ( ( ) - > results contains key ( op name ) , 5 , 10000 ) ; log info ( " got the result of " + op name + " : " + results get ( op name ) ) ; / / waiting for failover generic test utils wait for ( ( ) - > ! cluster get namesystem ( 1 ) is in standby state ( ) , 5 , 10000 ) ; final long [ ] hits n n = new long [ ] { 0 , 0 } ; generic test utils wait for ( ( ) - > { hits n n [ 0 ] = cluster get namesystem ( 0 ) get retry cache ( ) get metrics for tests ( ) get cache hit ( ) ; hits n n [ 1 ] = cluster get namesystem ( 1 ) get retry cache ( ) get metrics for tests ( ) get cache hit ( ) ; return ( hits n n [ 0 ] + hits n n [ 1 ] ) > 0 ; } , 5 , 10000 ) ; assert true ( " cache hit : " + hits n n [ 0 ] + " , " + hits n n [ 1 ] , + hits n n [ 0 ] + hits n n [ 1 ] > 0 ) ; final long [ ] updates n n = new long [ ] { 0 , 0 } ; generic test utils wait for ( ( ) - > { updates n n [ 0 ] = cluster get namesystem ( 0 ) get retry cache ( ) get metrics for tests ( ) get cache updated ( ) ; updates n n [ 1 ] = cluster get namesystem ( 1 ) get retry cache ( ) get metrics for tests ( ) get cache updated ( ) ; return updates n n [ 0 ] > 0 & & updates n n [ 1 ] > 0 ; } , 5 , 10000 ) ; / / cache updated metrics on nn0 should be > 0 since the op was process on nn0 assert true ( " cache updated on nn0 : " + updates n n [ 0 ] , updates n n [ 0 ] > 0 ) ; / / cache updated metrics on nn0 should be > 0 since nn1 applied the editlog assert true ( " cache updated on nn1 : " + updates n n [ 1 ] , updates n n [ 1 ] > 0 ) ; long expected update count = op get expected cache update count ( ) ; if ( expected update count > 0 ) { assert equals ( " cache updated on nn0 : " + updates n n [ 0 ] , expected update count , updates n n [ 0 ] ) ; assert equals ( " cache updated on nn0 : " + updates n n [ 1 ] , expected update count , updates n n [ 1 ] ) ; } }


apply the action to an item ; log at info afterwards with both the before and after string values of the item

void process ( item i ) throws i o exception { this item = i ; int count = counter increment and get ( ) ; if ( limit = = count ) { i fail ( ) ; log info ( " { } : failed { } " , this , i ) ; throw new i o exception ( string format ( " % s : limit % d reached for % s " , this , limit , i ) ) ; } string before = i to string ( ) ; action map ( a - > a apply ( i ) ) ; log info ( " { } : { } - > { } " , this , before , i ) ; }


determines whether the latest external program name and my external program name are equals

private boolean same ( string latest name , string my name ) { return system utilities is equal ( latest name , my name ) ; }


return the limit for array and collection auto - growing

public int get auto grow collection limit ( ) { return this auto grow collection limit ; }


checks that the ( original ) remote file is either owned by the user who started the app or public

boolean verify access ( ) throws i o exception { / / if it is in the public cache , it ' s trivially ok if ( resource get visibility ( ) = = local resource visibility public ) { return true ; } final path remote path ; try { remote path = resource get resource ( ) to path ( ) ; } catch ( u r i syntax exception e ) { throw new i o exception ( " invalid resource " , e ) ; } / / get the file status of the hdfs file file system remote fs = remote path get file system ( conf ) ; file status status = remote fs get file status ( remote path ) ; / / check to see if the file has been modified in any way if ( status get modification time ( ) ! = resource get timestamp ( ) ) { log warn ( " the remote file " + remote path + " has changed since it ' s localized ; will not consider it for upload " ) ; return false ; } / / check for the user ownership if ( status get owner ( ) equals ( user ) ) { return true ; / / the user owns the file } / / check if the file is publicly readable otherwise return file is public ( remote path , remote fs , status ) ; }


returns the { @ link method } instance for { @ link # test add supported null present ( ) } so that tests can suppress it see { @ link collection add tester # get add null supported method ( ) } for details

public static method get add supported null present method ( ) { return helpers get method ( set add tester class , " test add supported null present " ) ; }


< code > optional string value = 3 ; < code >

public com google protobuf byte string get value bytes ( ) { return instance get value bytes ( ) ; }


utility function for mapping { @ link file system # get path handle } to a fixed set of handle options

public static function < file status , path handle > resolve ( file system fs , handle opt opt ) { return resolve ( fs : : get path handle , opt ) ; }


aborts this edit this releases the edit lock so another edit may be started on the same key

public void abort ( ) throws i o exception { complete edit ( this , false ) ; }


public http headers get response headers ( ) { return this response headers ; }


return whether statements should be capable of returning auto - generated keys

public boolean is return generated keys ( ) { return this return generated keys ; }


multiply the x , y , z , w components of the passed in quaternion with the scalar and add them to the components of this quaternion

public quaternion mul add ( final quaternion quaternion , float scalar ) { this x + = quaternion x * scalar ; this y + = quaternion y * scalar ; this z + = quaternion z * scalar ; this w + = quaternion w * scalar ; return this ; }


does the same as { @ code ao set accessible ( true ) } , but never throws { @ link java lang reflect inaccessible object exception }

public abstract void make accessible ( accessible object ao ) ;


public void capital camel test ( ) { / / todo : test capital camel }


the shard routing passed to { @ link # can allocate ( shard routing , routing node , routing allocation ) } is not the initializing shard to this node but : - the unassigned shard routing in case if we want to assign an unassigned shard to this node - the initializing shard routing if we want to assign the initializing shard to this node instead - the started shard routing in case if we want to check if we can relocate to this node - the relocating shard routing if we want to relocate to this node now instead this method returns the corresponding initializing shard that would be allocated to this node

private shard routing initializing shard ( shard routing shard routing , string current node id ) { final shard routing initializing shard ; if ( shard routing unassigned ( ) ) { initializing shard = shard routing initialize ( current node id , null , shard routing unavailable expected shard size ) ; } else if ( shard routing initializing ( ) ) { unassigned info unassigned info = shard routing unassigned info ( ) ; if ( unassigned info = = null ) { / / unassigned shards must have unassigned info ( initializing shards might not ) unassigned info = new unassigned info ( unassigned info reason allocation failed , " fake " ) ; } initializing shard = shard routing move to unassigned ( unassigned info ) initialize ( current node id , null , shard routing unavailable expected shard size ) ; } else if ( shard routing relocating ( ) ) { initializing shard = shard routing cancel relocation ( ) relocate ( current node id , shard routing unavailable expected shard size ) get target relocating shard ( ) ; } else { assert shard routing started ( ) ; initializing shard = shard routing relocate ( current node id , shard routing unavailable expected shard size ) get target relocating shard ( ) ; } assert initializing shard initializing ( ) ; return initializing shard ; }


sets the folder in classpath serving static files observe : this method must be called before all other methods - note : contemplate changing tonew static files paradigm { @ link spark service static files }

public static void static file location ( string folder ) { get instance ( ) static file location ( folder ) ; }


private j s o n writer append ( string s ) throws j s o n exception { if ( s = = null ) { throw new j s o n exception ( " null pointer " ) ; } if ( this mode = = ' o ' | | this mode = = ' a ' ) { try { if ( this comma & & this mode = = ' a ' ) { this writer write ( ' , ' ) ; } this writer write ( s ) ; } catch ( i o exception e ) { throw new j s o n exception ( e ) ; } if ( this mode = = ' o ' ) { this mode = ' k ' ; } this comma = true ; return this ; } throw new j s o n exception ( " value out of sequence " ) ; }


public boolean use long keys ( ) { return schema use long key nodes ( ) ; }


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


return a variant of this { @ code method parameter } which points to the same parameter but one nesting level deeper in case of a { @ link java util optional } declaration

public method parameter nested if optional ( ) { return ( get parameter type ( ) = = optional class ? nested ( ) : this ) ; }


same as { @ link # sort ( indexed sortable , int , int ) } , but indicate progress periodically

void sort ( indexed sortable s , int l , int r , progressable rep ) ;


set the < code > priority < code > of the request

public scheduling request builder priority ( priority priority ) { scheduling request set priority ( priority ) ; return this ; }


clears any data cached in this build view to be called when the attached skyframe executor is reset

void reset ( ) { configurations = null ; skyframe analysis was discarded = false ; clear legacy data ( ) ; }


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


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


public static oracle u i activator get default ( ) { return plugin ; }


set the rounding options to be used or null if the image should not be rounded

public t round ( @ nullable rounding options rounding options ) { m rounding options = rounding options ; return get this ( ) ; }


sets the optional launcher to be used as the executable for this deploy jar

public deploy archive builder set launcher ( @ nullable artifact launcher ) { this launcher = launcher ; return this ; }


write out an input file containing an integer

private path make number file ( int file num , int value ) throws i o exception { path work dir = get number dir path ( ) ; path file path = new path ( work dir , " file " + file num ) ; configuration conf = new configuration ( ) ; file system fs = file system get local ( conf ) ; output stream os = fs create ( file path ) ; buffered writer w = new buffered writer ( new output stream writer ( os ) ) ; w write ( " " + value ) ; w close ( ) ; return file path ; }


test : 1 hash arrays same size 2 hash arrays contain same elements 3 elements are not in the same order 4 elements do not contain the same values expected result : not equal

public void test equality 7 ( ) { hash entry [ ] hash entries 1 = new hash entry [ ] { entry 1 , entry 3 } ; hash entry [ ] hash entries 2 = new hash entry [ ] { entry 3 , entry 1 } ; vec 1 set hash entries ( hash entries 1 ) ; vec 2 set hash entries ( hash entries 2 ) ; assert assert false ( " failed to recognize that vector elements are not in the same order " , vec 1 equals ( vec 2 ) ) ; }


list of sort orders in the same order as the list of variables returned from ` get order by variables ( ) ` this means for index i , variable ` get order by variables ( ) get ( i ) ` has order ` get ordering list ( ) get ( i ) `

private static list < sort order > get ordering list ( ordering scheme ordering scheme ) { return ordering scheme get order by variables ( ) stream ( ) map ( ordering scheme get orderings map ( ) : : get ) collect ( to immutable list ( ) ) ; }


this is a scaling factor for the density independent pixel unit , following the same conventions as android util display metrics # density , where one dip is one pixel on an approximately 160 dpi screen thus on a 1 6 0dpi screen this density value will be 1 ; on a 120 dpi screen it would be 75 ; etc


configure an unhealthy result with an { @ code error }

public result builder unhealthy ( throwable error ) { this error = error ; return this unhealthy ( ) with message ( error get message ( ) ) ; }


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


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


returns a snapshot of this counter ' s values note that this may be an inconsistent view , as it may be interleaved with update operations


write the supplied trace message and { @ link throwable } to the supplied { @ code log } instance to be called by { @ link # invoke under trace } for enterexit outcomes , potentially including an exception note that an exception ' s stack trace won ' t get logged when { @ link # set log exception stack trace } is " false " by default messages are written at { @ code trace } level subclasses can override this method to control which level the message is written at , typically also overriding { @ link # is log enabled } accordingly

protected void write to log ( log logger , string message , @ nullable throwable ex ) { if ( ex ! = null & & this log exception stack trace ) { logger trace ( message , ex ) ; } else { logger trace ( message ) ; } }


public void inc ( string name ) { inc ( name , 1 ) ; }


default void create role ( connector session session , string role , optional < presto principal > grantor ) { throw new presto exception ( not supported , " this connector does not support create role " ) ; }


set the mappings of bean keys to a comma - separated list of interface names the property key should match the bean key and the property value should match the list of interface names when searching for interfaces for a bean , spring will check these mappings first

public void set interface mappings ( @ nullable properties mappings ) { this interface mappings = mappings ; }


delete the given directory using { @ link file util # fully delete ( file ) }

public boolean fully delete ( @ nullable fs volume spi volume , file dir ) { final long begin = profiling event hook before metadata op ( volume , delete ) ; try { fault injector event hook before metadata op ( volume , delete ) ; boolean deleted = file util fully delete ( dir ) ; profiling event hook after metadata op ( volume , delete , begin ) ; return deleted ; } catch ( exception e ) { on failure ( volume , begin ) ; throw e ; } }


combines all the masks in the data - structure together into a single byte stream

private mask value combine instruction masks ( list < byte [ ] > masks , list < byte [ ] > values , int length ) { if ( masks size ( ) ! = values size ( ) ) { throw new illegal argument exception ( ) ; } / * * this portion of code takes the masks and values from each of the * different commands and concatenates them together to form * a single mask and value byte array * / byte [ ] final value array = new byte [ length ] ; byte [ ] final mask array = new byte [ length ] ; int index = 0 ; for ( int x = 0 ; x < values size ( ) ; x + + ) { / / iterates through each mnemonic for ( int i = 0 ; i < values get ( x ) length & & index < length ; i + + ) { final value array [ index ] = values get ( x ) [ i ] ; final mask array [ index ] = masks get ( x ) [ i ] ; index + + ; } } return new mask value ( final mask array , final value array ) ; }


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


int array argument that is equal to the given array , i e it has to have the same length , and each element has to be equal see examples in javadoc for { @ link additional matchers } class

public static int [ ] ary eq ( int [ ] value ) { report matcher ( new array equals ( value ) ) ; return null ; }


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

public single < client > rx test client model ( client body , api client auth info auth info ) { return single create ( new io vertx rx java single on subscribe adapter < > ( fut - > delegate test client model ( body , auth info , fut ) ) ) ; }


get the test ca certificate used with the test server

public static string get test pki c a certs path ( ) { return get pki test directory ( ) get absolute path ( ) + file separator + " test - cacerts crt " ; }


set the optional parameters when initiating the request ( encryption , headers , storage , etc )

protected void set optional multipart upload request parameters ( initiate multipart upload request request ) { generate s s e aws key params ( ) if present ( request : : set s s e aws key management params ) ; generate s s e customer key ( ) if present ( request : : set s s e customer key ) ; }


verify that different file contents have different checksums , and that that they aren ' t the same as the empty file

public void test non empty file checksums ( ) throws throwable { final s 3 a file system fs = get file system ( ) ; final path file 3 = mk file ( " file 3 " , hello ) ; final etag checksum checksum 1 = fs get file checksum ( file 3 , 0 ) ; assert not null ( " file 3 checksum " , checksum 1 ) ; final path file 4 = touch file ( " file 4 " ) ; final etag checksum checksum 2 = fs get file checksum ( file 4 , 0 ) ; assert not equals ( " checksums " , checksum 1 , checksum 2 ) ; / / overwrite create file ( fs , file 4 , true , " hello , world " get bytes ( standard charsets utf 8 ) ) ; assert not equals ( checksum 2 , fs get file checksum ( file 4 , 0 ) ) ; }


public length string set [ ] get names ( ) { return names ; }


retrieves and casts the provider from the given target

public static config feature flag provider from target ( transitive info collection target ) { return target get ( starlark constructor ) ; }


shift operators don ' t yet adopt the return value with compound assignment

public void test shift compound assignment def ( ) { assert equals ( ( byte ) 10 , exec ( " def x = 5l ; return ( byte ) ( x < < = 1 ) ; " ) ) ; assert equals ( ( short ) 10 , exec ( " def x = 5l ; return ( short ) ( x < < = 1 ) ; " ) ) ; assert equals ( ( char ) 10 , exec ( " def x = 5l ; return ( char ) ( x < < = 1 ) ; " ) ) ; assert equals ( 10 , exec ( " def x = 5l ; return ( int ) ( x < < = 1 ) ; " ) ) ; assert equals ( 10f , exec ( " def x = 5l ; return ( float ) ( x < < = 1 ) ; " ) ) ; assert equals ( 10l , exec ( " def x = 5l ; return ( long ) ( x < < = 1 ) ; " ) ) ; assert equals ( 10d , exec ( " def x = 5l ; return ( double ) ( x < < = 1 ) ; " ) ) ; }


any partial matches for " methods " , " consumes " , and " produces " ?

public boolean has produces mismatch ( ) { for ( partial match match : this partial matches ) { if ( match has produces match ( ) ) { return false ; } } return true ; }


public path get input file for write ( task i d map id , long size , configuration conf ) throws i o exception { return l dir alloc get local path for write ( string format ( reduce input file format string , tasktracker output , map id get id ( ) ) , size , conf ) ; }


sets this dialog to remember its location from one invocation to the next the default is to remember location

public void set remember location ( boolean remember location ) { this remember location = remember location ; }


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


parses a set of strings declaring distribution types

public static set < distribution type > parse distributions ( collection < string > dist strings ) throws license parsing exception { if ( dist strings is empty ( ) ) { return collections unmodifiable set ( enum set of ( distribution type internal ) ) ; } else { set < distribution type > result = enum set none of ( distribution type class ) ; for ( string dist str : dist strings ) { try { distribution type dist = distribution type value of ( dist str to upper case ( locale english ) ) ; result add ( dist ) ; } catch ( illegal argument exception e ) { throw new license parsing exception ( " invalid distribution type ' " + dist str + " ' " ) ; } } return collections unmodifiable set ( result ) ; } }


public void run ( ) { log debug ( " running deletion task : { } " , this ) ; linux container executor exec = ( ( linux container executor ) get deletion service ( ) get container executor ( ) ) ; exec remove docker container ( container id ) ; }


inserts the specified number of items at the specified index the new items will have values equal to the values at those indices before the insertion

public void insert range ( int index , int count ) { if ( index > size ) throw new index out of bounds exception ( " index can ' t be > size : " + index + " > " + size ) ; int size needed = size + count ; if ( size needed > items length ) items = resize ( math max ( math max ( 8 , size needed ) , ( int ) ( size * 1 7 5f ) ) ) ; system arraycopy ( items , index , items , index + count , size - index ) ; size = size needed ; }


removes the given partition from listening to incoming task events , thus forbidding calls to { @ link # subscribe to event ( result partition i d , event listener , class ) }

public void unregister partition ( result partition i d partition id ) { check not null ( partition id ) ; synchronized ( registered handlers ) { log debug ( " unregistering { } " , partition id ) ; / / note : tolerate un - registration of non - registered task ( unregister is always called / / in the cleanup phase of a task even if it never came to the registration - see / / task java ) registered handlers remove ( partition id ) ; } }


generate the stream of bytes as hex pairs separated by ' '

public string to string ( ) { return int stream range ( 0 , size ) map to obj ( idx - > string format ( " % 0 2x " , bytes [ idx ] ) ) collect ( collectors joining ( " " ) ) ; }


the settings to create the index with ( either json or yaml format )

public create index request settings ( string source , x content type x content type ) { this settings = settings builder ( ) load from source ( source , x content type ) build ( ) ; return this ; }


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

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


does this file contain all the commit metadata ?

private boolean is commit metadata file ( list < string > elements ) { string last = elements get ( elements size ( ) - 1 ) ; return last ends with ( commit constants pending suffix ) | | last ends with ( commit constants pendingset suffix ) ; }