signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class Code { /** * Tests if the value in { @ code source } is assignable to { @ code type } . If it
* is , { @ code target } is assigned to 1 ; otherwise { @ code target } is assigned
* to 0. */
public void instanceOfType ( Local < ? > target , Local < ? > source , TypeId < ? > type ) { } }
|
addInstruction ( new ThrowingCstInsn ( Rops . INSTANCE_OF , sourcePosition , RegisterSpecList . make ( source . spec ( ) ) , catches , type . constant ) ) ; moveResult ( target , true ) ;
|
public class RestApiClient { /** * Lockout user .
* @ param username
* the username
* @ return the response */
public Response lockoutUser ( String username ) { } }
|
return restClient . post ( "lockouts/" + username , null , new HashMap < String , String > ( ) ) ;
|
public class AbstractCommunicationHandler { /** * Before we allocate a new socket , try to delete the old one .
* closeTcpConnection ( ) needs to be a nop for non - opened connections .
* @ return
* @ throws IOException */
private SSLSocket getNewSocket ( ) throws IOException { } }
|
String host = getUrl ( ) . getHost ( ) ; int port = getPort ( ) ; Socket socketConnection = new Socket ( ) ; InetSocketAddress mapServerAddress = new InetSocketAddress ( host , port ) ; socketConnection . connect ( mapServerAddress , mInitialConnectionTimeout ) ; SSLSocket ret = ( SSLSocket ) mSocketFactory . createSocket ( socketConnection , host , port , true ) ; ret . setTcpNoDelay ( true ) ; ret . setWantClientAuth ( true ) ; // Check if all is good . . . Will throw IOException if we don ' t
// like the other end . . .
ret . getSession ( ) . getPeerCertificates ( ) ; if ( ! mHostnameVerifier . verify ( mUrl . getHost ( ) , ret . getSession ( ) ) ) { throw new IOException ( "Hostname Verification failed! " + "Did you set ifmapj.communication.verifypeerhost?" ) ; } return ret ;
|
public class DTMDefaultBase { /** * Find the first index that occurs in the list that is greater than or
* equal to the given value .
* @ param list A list of integers .
* @ param start The start index to begin the search .
* @ param len The number of items to search .
* @ param value Find the slot that has a value that is greater than or
* identical to this argument .
* @ return The index in the list of the slot that is higher or identical
* to the identity argument , or - 1 if no node is higher or equal . */
protected int findGTE ( int [ ] list , int start , int len , int value ) { } }
|
int low = start ; int high = start + ( len - 1 ) ; int end = high ; while ( low <= high ) { int mid = ( low + high ) / 2 ; int c = list [ mid ] ; if ( c > value ) high = mid - 1 ; else if ( c < value ) low = mid + 1 ; else return mid ; } return ( low <= end && list [ low ] > value ) ? low : - 1 ;
|
public class BDXImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } }
|
switch ( featureID ) { case AfplibPackage . BDX__DMX_NAME : setDMXName ( ( String ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
|
public class MessageResponseHttp2 { /** * Deliver the message
* @ param os the physical output stream
* @ param writerHttp the writer context */
@ Override public void deliver ( WriteStream os , OutHttp2 outHttp ) throws IOException { } }
|
ChannelOutHttp2 stream = _request . getChannelOut ( ) ; int streamId = _request . channel ( ) . getId ( ) ; if ( _isHeaders ) { writeHeaders ( outHttp ) ; } int tailFlags ; switch ( getFlagsHttp ( ) ) { case END_STREAM : tailFlags = Http2Constants . END_STREAM ; break ; default : tailFlags = 0 ; break ; } if ( _head != null || tailFlags != 0 ) { stream . addSendBuffer ( _head , ChannelOutHttp2 . FRAME_LENGTH , tailFlags ) ; } stream . writeCont ( outHttp ) ;
|
public class ExpressionEvaluator { /** * TODO : make it stronger ( in case someone uses complex sub - terms such as IS _ NULL ( x ) inside the URI template . . . ) */
private Function simplifyIsNullorNotNullUriTemplate ( Function uriTemplate , boolean isNull ) { } }
|
Set < Variable > variables = uriTemplate . getVariables ( ) ; if ( isNull ) { switch ( variables . size ( ) ) { case 0 : return termFactory . getFunctionIsNull ( uriTemplate ) ; case 1 : return termFactory . getFunctionIsNull ( variables . iterator ( ) . next ( ) ) ; default : return variables . stream ( ) . reduce ( null , ( e , v ) -> e == null ? termFactory . getFunctionIsNull ( v ) : termFactory . getFunctionOR ( e , termFactory . getFunctionIsNull ( v ) ) , ( e1 , e2 ) -> e1 == null ? e2 : ( e2 == null ) ? e1 : termFactory . getFunctionOR ( e1 , e2 ) ) ; } } else { if ( variables . isEmpty ( ) ) return termFactory . getFunctionIsNotNull ( uriTemplate ) ; else return datalogTools . foldBooleanConditions ( variables . stream ( ) . map ( termFactory :: getFunctionIsNotNull ) . collect ( Collectors . toList ( ) ) ) ; }
|
public class Response { /** * Return the status of a specific property .
* @ param descriptor
* The { @ link XmlElementDescriptor } of the property .
* @ return The status of the property or { @ link # STATUS _ NONE } if the property was not found . */
public int getPropertyStatus ( ElementDescriptor < ? > descriptor ) { } }
|
PropStat propStat = mPropStatByProperty . get ( descriptor ) ; if ( propStat == null ) { return STATUS_NONE ; } return propStat . getStatusCode ( ) ;
|
public class HtmlWriter { /** * Generates HTML Output for a { @ link Table } . */
private static String tableToHtml ( Table t ) { } }
|
if ( t == null ) { return "null" ; } StringBuilder result = new StringBuilder ( ) ; int colspan ; try { colspan = t . getTableElement ( t . nrOfTableElements ( ) - 1 ) . getCol ( ) + 1 ; } catch ( Exception e ) { colspan = 1 ; } result . append ( "<table class=\"Table\">\n<tr><th colspan=" + colspan + " class=\"Table\">Table" ) ; if ( t . getTitleElement ( ) != null ) { result . append ( contentElementToHtml ( t . getTitleElement ( ) ) ) ; } result . append ( "</th></tr>\n<tr>\n" ) ; int row = 0 ; for ( int i = 0 ; i < t . nrOfTableElements ( ) ; i ++ ) { TableElement td = t . getTableElement ( i ) ; if ( td . getRow ( ) > row ) { result . append ( "</tr><tr>\n" ) ; row = td . getRow ( ) ; } result . append ( "<td class=\"Table\">\n" + tableElementToHtml ( td ) + "</td>\n" ) ; } result . append ( "</tr>\n</table>\n" ) ; return result . toString ( ) ;
|
public class DefaultEntityProxyFactory { /** * Adds the { @ link EntityMethodFunction } s to the resolver .
* @ see DefaultFunction
* @ see GetAttributeFunction
* @ see SetAttributeFunction
* @ see NewEntityFunction
* @ see GetEntityFunction
* @ see StreamEntitiesFunction
* @ see GetEntitiesFunction
* @ see KillEntityFunction
* @ see KillEntitiesFunction
* @ see MarkAsTypeFunction
* @ see UnmarkAsTypeFunction
* @ see ScheduleForActorFunction */
protected void addResolverFunctions ( ) { } }
|
resolver . addMethodFunction ( new DefaultFunction ( ) ) ; resolver . addMethodFunction ( new GetAttributeFunction ( ) ) ; resolver . addMethodFunction ( new SetAttributeFunction ( ) ) ; resolver . addMethodFunction ( new NewEntityFunction ( ) ) ; resolver . addMethodFunction ( new GetEntityFunction ( ) ) ; resolver . addMethodFunction ( new StreamEntitiesFunction ( ) ) ; resolver . addMethodFunction ( new GetEntitiesFunction ( ) ) ; resolver . addMethodFunction ( new KillEntityFunction ( ) ) ; resolver . addMethodFunction ( new KillEntitiesFunction ( ) ) ; resolver . addMethodFunction ( new MarkAsTypeFunction ( ) ) ; resolver . addMethodFunction ( new UnmarkAsTypeFunction ( ) ) ; resolver . addMethodFunction ( new ScheduleForActorFunction ( ) ) ;
|
public class DataGridTagModel { /** * Setter for the { @ link PagedDataSet } object . In order to canonicalize the type used by
* the data grid to manipulate the data set , the { @ link PagedDataSet } is used to
* navigate the data set .
* @ param dataSet the data set */
public void setDataSet ( PagedDataSet dataSet ) { } }
|
/* todo : would be nice to address this side - effect outside of the setter */
_dataSet = dataSet ; _dataGridState . getPagerModel ( ) . setDataSetSize ( _dataSet . getSize ( ) ) ;
|
public class ThreadLocalRandom { /** * The form of nextDouble used by DoubleStream Spliterators .
* @ param origin the least value , unless greater than bound
* @ param bound the upper bound ( exclusive ) , must not equal origin
* @ return a pseudorandom value */
final double internalNextDouble ( double origin , double bound ) { } }
|
double r = ( nextLong ( ) >>> 11 ) * DOUBLE_UNIT ; if ( origin < bound ) { r = r * ( bound - origin ) + origin ; if ( r >= bound ) // correct for rounding
r = Double . longBitsToDouble ( Double . doubleToLongBits ( bound ) - 1 ) ; } return r ;
|
public class SingleInputPlanNode { @ Override public void accept ( Visitor < PlanNode > visitor ) { } }
|
if ( visitor . preVisit ( this ) ) { this . input . getSource ( ) . accept ( visitor ) ; for ( Channel broadcastInput : getBroadcastInputs ( ) ) { broadcastInput . getSource ( ) . accept ( visitor ) ; } visitor . postVisit ( this ) ; }
|
public class WVideo { /** * Sets the media group .
* @ param mediaGroup The media group name . */
public void setMediaGroup ( final String mediaGroup ) { } }
|
String currMediaGroup = getMediaGroup ( ) ; if ( ! Objects . equals ( mediaGroup , currMediaGroup ) ) { getOrCreateComponentModel ( ) . mediaGroup = mediaGroup ; }
|
public class StopDeliveryStreamEncryptionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( StopDeliveryStreamEncryptionRequest stopDeliveryStreamEncryptionRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( stopDeliveryStreamEncryptionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( stopDeliveryStreamEncryptionRequest . getDeliveryStreamName ( ) , DELIVERYSTREAMNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class HashUtil { /** * Hash function based on Knuth ' s multiplicative method . This version is faster than using Murmur hash but provides
* acceptable behavior .
* @ param k the long for which the hash will be calculated
* @ return the hash */
public static long fastLongMix ( long k ) { } }
|
// phi = 2 ^ 64 / goldenRatio
final long phi = 0x9E3779B97F4A7C15L ; long h = k * phi ; h ^= h >>> 32 ; return h ^ ( h >>> 16 ) ;
|
public class ScriptRuntime { /** * Equivalent to executing " new $ constructorName ( message , sourceFileName , sourceLineNo ) " from JavaScript .
* @ param cx the current context
* @ param scope the current scope
* @ param message the message
* @ return a JavaScriptException you should throw */
public static JavaScriptException throwCustomError ( Context cx , Scriptable scope , String constructorName , String message ) { } }
|
int [ ] linep = { 0 } ; String filename = Context . getSourcePositionFromStack ( linep ) ; final Scriptable error = cx . newObject ( scope , constructorName , new Object [ ] { message , filename , Integer . valueOf ( linep [ 0 ] ) } ) ; return new JavaScriptException ( error , filename , linep [ 0 ] ) ;
|
public class Complex { /** * Creates a new complex number containing the resulting multiplication between this and another
* @ param c the number to multiply by
* @ return < tt > this < / tt > * c */
public Complex multiply ( Complex c ) { } }
|
Complex ret = new Complex ( real , imag ) ; ret . mutableMultiply ( c ) ; return ret ;
|
public class ActivityCreator { /** * Add the requested post parameters to the Request .
* @ param request Request to add post params to */
private void addPostParams ( final Request request ) { } }
|
if ( friendlyName != null ) { request . addPostParam ( "FriendlyName" , friendlyName ) ; } if ( available != null ) { request . addPostParam ( "Available" , available . toString ( ) ) ; }
|
public class druidGLexer { /** * $ ANTLR start " INSERT _ REALTIME " */
public final void mINSERT_REALTIME ( ) throws RecognitionException { } }
|
try { int _type = INSERT_REALTIME ; int _channel = DEFAULT_TOKEN_CHANNEL ; // druidG . g : 583:17 : ( ( ' INSERT _ REALTIME ' | ' insert _ realtime ' ) )
// druidG . g : 583:18 : ( ' INSERT _ REALTIME ' | ' insert _ realtime ' )
{ // druidG . g : 583:18 : ( ' INSERT _ REALTIME ' | ' insert _ realtime ' )
int alt3 = 2 ; int LA3_0 = input . LA ( 1 ) ; if ( ( LA3_0 == 'I' ) ) { alt3 = 1 ; } else if ( ( LA3_0 == 'i' ) ) { alt3 = 2 ; } else { NoViableAltException nvae = new NoViableAltException ( "" , 3 , 0 , input ) ; throw nvae ; } switch ( alt3 ) { case 1 : // druidG . g : 583:19 : ' INSERT _ REALTIME '
{ match ( "INSERT_REALTIME" ) ; } break ; case 2 : // druidG . g : 583:37 : ' insert _ realtime '
{ match ( "insert_realtime" ) ; } break ; } } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving
}
|
public class HessenbergSimilarDecomposition_ZDRM { /** * An upper Hessenberg matrix from the decomposition .
* @ param H If not null then the results will be stored here . Otherwise a new matrix will be created .
* @ return The extracted H matrix . */
public ZMatrixRMaj getH ( ZMatrixRMaj H ) { } }
|
H = UtilDecompositons_ZDRM . checkZeros ( H , N , N ) ; // copy the first row
System . arraycopy ( QH . data , 0 , H . data , 0 , N * 2 ) ; for ( int i = 1 ; i < N ; i ++ ) { System . arraycopy ( QH . data , ( i * N + i - 1 ) * 2 , H . data , ( i * N + i - 1 ) * 2 , ( N - i + 1 ) * 2 ) ; } return H ;
|
public class AbstractParsedStmt { /** * in the EE . */
protected void promoteUnionParametersFromChild ( AbstractParsedStmt childStmt ) { } }
|
getParamsByIndex ( ) . putAll ( childStmt . getParamsByIndex ( ) ) ; m_parameterTveMap . putAll ( childStmt . m_parameterTveMap ) ;
|
public class BootstrapContextImpl { /** * Start task if there is a resource adapter context descriptor .
* @ param raThreadContextDescriptor
* @ return array of thread context , if any */
private ArrayList < ThreadContext > startTask ( ThreadContextDescriptor raThreadContextDescriptor ) { } }
|
return raThreadContextDescriptor == null ? null : raThreadContextDescriptor . taskStarting ( ) ;
|
public class AbstractTreebankLanguagePack { /** * Say whether this character is an annotation introducing
* character .
* @ param ch The character to check
* @ return Whether it is an annotation introducing character */
public boolean isLabelAnnotationIntroducingCharacter ( char ch ) { } }
|
char [ ] cutChars = labelAnnotationIntroducingCharacters ( ) ; for ( char cutChar : cutChars ) { if ( ch == cutChar ) { return true ; } } return false ;
|
public class ReflectUtils { /** * Gets a field from an object .
* @ param obj object from which to read the field
* @ param name the field name to read */
public static Object getField ( Object obj , String name ) { } }
|
try { Class < ? extends Object > klass = obj . getClass ( ) ; do { try { Field field = klass . getDeclaredField ( name ) ; field . setAccessible ( true ) ; return field . get ( obj ) ; } catch ( NoSuchFieldException e ) { klass = klass . getSuperclass ( ) ; } } while ( klass != null ) ; throw new RuntimeException ( ) ; // true no such field exception
} catch ( SecurityException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalArgumentException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; }
|
public class SmileDemo { /** * Required by TreeSelectionListener interface . */
@ Override public void valueChanged ( TreeSelectionEvent e ) { } }
|
DefaultMutableTreeNode node = ( DefaultMutableTreeNode ) tree . getLastSelectedPathComponent ( ) ; if ( node != null && node . isLeaf ( ) ) { int pos = workspace . getDividerLocation ( ) ; workspace . setTopComponent ( ( JPanel ) node . getUserObject ( ) ) ; workspace . setDividerLocation ( pos ) ; }
|
public class OneToManyFacetBinding { @ Override protected void visitFacetChildren ( F facetValue , Predicate < Facet > predicate , PojoVisitor visitor ) { } }
|
elementsOf ( facetValue ) . forEach ( element -> elementBinding . visitChild ( element , predicate , visitor ) ) ;
|
public class CmsPathValue { /** * Creates a new path value with the same value as this one , but with a prefix prepended to the path . < p >
* @ param pathPart the path part which should be prepended to the path
* @ return the new path value */
public CmsPathValue prepend ( String pathPart ) { } }
|
return new CmsPathValue ( m_value , CmsStringUtil . joinPaths ( pathPart , m_path ) ) ;
|
public class HttpQueryParamHeaderValidator { /** * Convert query string key - value expression to map .
* @ param expression
* @ return */
private Map < String , String > convertToMap ( Object expression ) { } }
|
if ( expression instanceof Map ) { return ( Map < String , String > ) expression ; } return Stream . of ( Optional . ofNullable ( expression ) . map ( Object :: toString ) . orElse ( "" ) . split ( "," ) ) . map ( keyValue -> Optional . ofNullable ( StringUtils . split ( keyValue , "=" ) ) . orElse ( new String [ ] { keyValue , "" } ) ) . collect ( Collectors . toMap ( keyValue -> keyValue [ 0 ] , keyValue -> keyValue [ 1 ] ) ) ;
|
public class NTLMUtilities { /** * Extracts the NTLM flags from the type 2 message .
* @ param msg the type 2 message byte array
* @ return the proxy flags as an int */
public static int extractFlagsFromType2Message ( byte [ ] msg ) { } }
|
byte [ ] flagsBytes = new byte [ 4 ] ; System . arraycopy ( msg , 20 , flagsBytes , 0 , 4 ) ; ByteUtilities . changeWordEndianess ( flagsBytes , 0 , 4 ) ; return ByteUtilities . makeIntFromByte4 ( flagsBytes ) ;
|
public class Transliterator { /** * Register a factory object with the given ID . The factory
* method should return a new instance of the given transliterator .
* < p > Because ICU may choose to cache Transliterator objects internally , this must
* be called at application startup , prior to any calls to
* Transliterator . getInstance to avoid undefined behavior .
* @ param ID the ID of this transliterator
* @ param factory the factory object */
public static void registerFactory ( String ID , Factory factory ) { } }
|
registry . put ( ID , factory , true ) ;
|
public class VatIdValidator { /** * calculate square sum .
* @ param pvalue value to calculate square sum for
* @ return square sum */
private static int squareSum ( final int pvalue ) { } }
|
int result = 0 ; for ( final char valueDigit : String . valueOf ( pvalue ) . toCharArray ( ) ) { result += Character . digit ( valueDigit , 10 ) ; } return result ;
|
public class JSONConverter { /** * Build a recorded query from it ' s JSON representation
* @ param json
* @ return */
public RecordedQuery fromJSON ( String json ) { } }
|
RecordedQuery ret = new RecordedQuery ( false ) ; StringReader sr = new StringReader ( json ) ; JsonReader reader = Json . createReader ( sr ) ; JsonObject jsonResult = reader . readObject ( ) ; ret . setGeneric ( jsonResult . getBoolean ( GENERIC ) ) ; JsonArray augmentations = jsonResult . getJsonArray ( AUGMENTATIONS ) ; if ( augmentations != null ) { Map < String , String > augs = new HashMap < String , String > ( ) ; Iterator < JsonValue > ait = augmentations . iterator ( ) ; while ( ait . hasNext ( ) ) { JsonObject a = ( JsonObject ) ait . next ( ) ; augs . put ( a . getString ( KEY ) , a . getString ( VALUE ) ) ; } ret . setAugmentations ( augs ) ; } JsonArray statements = jsonResult . getJsonArray ( STATEMENTS ) ; Iterator < JsonValue > it = statements . iterator ( ) ; while ( it . hasNext ( ) ) { JsonValue s = it . next ( ) ; readStatement ( s , ret . getStatements ( ) , ret ) ; } return ret ;
|
public class MD5Hash { /** * Construct a hash value for a byte array . */
public static MD5Hash digest ( byte [ ] data , int start , int len ) { } }
|
byte [ ] digest ; MessageDigest digester = DIGESTER_FACTORY . get ( ) ; digester . update ( data , start , len ) ; digest = digester . digest ( ) ; return new MD5Hash ( digest ) ;
|
public class Configuration { /** * Adds a new value to the specified default parameter .
* This is only used if the parameter is not specified when building
* the specific mail .
* Please note that parameters are multivalued . This method adds a new
* value . To set a new value you need to clear the default parameter first .
* @ param name the name of the parameter
* @ param value the new value to add to the parameter
* @ return this configuration
* @ see # clearDefaultParameter ( String ) */
public Configuration addDefaultParameter ( String name , String value ) { } }
|
defaultParameters . add ( name , value ) ; return this ;
|
public class IntegerColumn { /** * { @ inheritDoc } */
@ Override protected byte [ ] encodeType ( Integer t ) { } }
|
final ByteBuffer buffer = allocate ( size ) ; // t is guaranteed non - null by superclass
buffer . putInt ( t ) ; return buffer . array ( ) ;
|
public class MavenSettings { /** * Opens a connection with appropriate proxy and credentials , if required .
* @ param url The URL to open .
* @ return The opened connection .
* @ throws IOException If an error occurs establishing the connection . */
public URLConnection openConnection ( URL url ) throws IOException { } }
|
Proxy proxy = getProxyFor ( url ) ; URLConnection conn = null ; if ( proxy != null ) { conn = url . openConnection ( proxy . getProxy ( ) ) ; proxy . authenticate ( conn ) ; } else { conn = url . openConnection ( ) ; } return conn ;
|
public class ChangedList { /** * Retrieves a changed file for processing and removes it from the list of unreserved files .
* Returns null if there are no changed files in the list .
* @ return a file which has changed on the file system */
public synchronized ChangedFile reserve ( ) { } }
|
if ( fileList . isEmpty ( ) || shutdown ) { return null ; } String key = fileList . keySet ( ) . iterator ( ) . next ( ) ; ChangedFile changedFile = fileList . remove ( key ) ; reservedFiles . put ( key , changedFile ) ; incrementVersion ( ) ; fireChangedEventAsync ( ) ; return changedFile ;
|
public class ColVals { /** * < p > Check if field is ID . < / p >
* @ param pNm column name
* @ return if it ' s ID */
public final boolean isId ( final String pNm ) { } }
|
for ( String idNm : this . idColNms ) { if ( idNm . equals ( pNm ) ) { return true ; } } return false ;
|
public class MessageControl { /** * GetSchemaLocation Method . */
public String getSchemaLocation ( String version , String schemaLocation ) { } }
|
if ( schemaLocation != null ) if ( ( schemaLocation . startsWith ( "http" ) ) || ( schemaLocation . startsWith ( "/" ) ) ) return schemaLocation ; MessageVersion recMessageVersion = this . getMessageVersion ( version ) ; return this . getSchemaLocation ( recMessageVersion , schemaLocation ) ;
|
public class QRDecomposition { /** * Return the Householder vectors
* @ return Lower trapezoidal matrix whose columns define the reflections */
public double [ ] [ ] getH ( ) { } }
|
double [ ] [ ] H = new double [ m ] [ n ] ; for ( int i = 0 ; i < m ; i ++ ) { System . arraycopy ( QR [ i ] , 0 , H [ i ] , 0 , i < n ? i : n ) ; } return H ;
|
public class ProxySettings { /** * Reset the proxy settings . To be concrete , parameter values are
* set as shown below .
* < blockquote >
* < table border = " 1 " cellpadding = " 5 " style = " border - collapse : collapse ; " >
* < thead >
* < tr >
* < th > Name < / th >
* < th > Value < / th >
* < th > Description < / th >
* < / tr >
* < / thead >
* < tbody >
* < tr >
* < td > Secure < / td >
* < td > { @ code false } < / td >
* < td > Use TLS to connect to the proxy server or not . < / td >
* < / tr >
* < tr >
* < td > Host < / td >
* < td > { @ code null } < / td >
* < td > The host name of the proxy server . < / td >
* < / tr >
* < tr >
* < td > Port < / td >
* < td > { @ code - 1 } < / td >
* < td > The port number of the proxy server . < / td >
* < / tr >
* < tr >
* < td > ID < / td >
* < td > { @ code null } < / td >
* < td > The ID for authentication at the proxy server . < / td >
* < / tr >
* < tr >
* < td > Password < / td >
* < td > { @ code null } < / td >
* < td > The password for authentication at the proxy server . < / td >
* < / tr >
* < tr >
* < td > Headers < / td >
* < td > Cleared < / td >
* < td > Additional HTTP headers passed to the proxy server . < / td >
* < / tr >
* < tr >
* < td > Server Names < / td >
* < td > { @ code null } < / td >
* < td > Server names for SNI ( Server Name Indication ) . < / td >
* < / tr >
* < / tbody >
* < / table >
* < / blockquote >
* @ return
* { @ code this } object . */
public ProxySettings reset ( ) { } }
|
mSecure = false ; mHost = null ; mPort = - 1 ; mId = null ; mPassword = null ; mHeaders . clear ( ) ; mServerNames = null ; return this ;
|
public class AbstractDocBuilder { /** * Parse tags to get customized return . */
protected APIParameter parseCustomizedReturn ( MethodDoc methodDoc ) { } }
|
Tag [ ] tags = methodDoc . tags ( WRReturnTaglet . NAME ) ; APIParameter result = null ; if ( tags . length > 0 ) { result = WRReturnTaglet . parse ( tags [ 0 ] . text ( ) ) ; } return result ;
|
public class ICUHumanize { /** * Guesses the best locale - dependent pattern to format the date / time fields
* that the skeleton specifies .
* @ param value
* The date to be formatted
* @ param skeleton
* A pattern containing only the variable fields . For example ,
* " MMMdd " and " mmhh " are skeletons .
* @ return A string with a text representation of the date */
public static String smartDateFormat ( final Date value , final String skeleton ) { } }
|
return formatDate ( value , context . get ( ) . getBestPattern ( skeleton ) ) ;
|
public class DriverStatusManager { /** * Sends the final message to the Driver . This is used by DriverRuntimeStopHandler . onNext ( ) .
* @ param exception Exception that caused the job to end ( can be absent ) .
* @ deprecated TODO [ JIRA REEF - 1548 ] Do not use DriverStatusManager as a proxy to the job client .
* After release 0.16 , make this method private and use it inside onRuntimeStop ( ) method instead . */
@ Deprecated public synchronized void sendJobEndingMessageToClient ( final Optional < Throwable > exception ) { } }
|
if ( ! this . isClosing ( ) ) { LOG . log ( Level . SEVERE , "Sending message in a state different that SHUTTING_DOWN or FAILING. " + "This is likely a illegal call to clock.close() at play. Current state: {0}" , this . driverStatus ) ; } if ( this . driverTerminationHasBeenCommunicatedToClient ) { LOG . log ( Level . SEVERE , ".sendJobEndingMessageToClient() called twice. Ignoring the second call" ) ; return ; } // Log the shutdown situation
if ( this . shutdownCause . isPresent ( ) ) { LOG . log ( Level . WARNING , "Sending message about an unclean driver shutdown." , this . shutdownCause . get ( ) ) ; } if ( exception . isPresent ( ) ) { LOG . log ( Level . WARNING , "There was an exception during clock.close()." , exception . get ( ) ) ; } if ( this . shutdownCause . isPresent ( ) && exception . isPresent ( ) ) { LOG . log ( Level . WARNING , "The driver is shutdown because of an exception (see above) and there was " + "an exception during clock.close(). Only the first exception will be sent to the client" ) ; } // Send the earlier exception , if there was one . Otherwise , send the exception passed .
this . clientConnection . send ( getJobEndingMessage ( this . shutdownCause . isPresent ( ) ? this . shutdownCause : exception ) ) ; this . driverTerminationHasBeenCommunicatedToClient = true ;
|
public class Database { /** * Executes an update against the database and return generated keys as extracted by generatedKeysProcessor .
* @ param generatedKeysProcessor processor for handling the generated keys
* @ param columnNames names of columns that contain the generated keys . Can be empty , in which case the
* returned columns depend on the database
* @ param query to execute
* @ return Result of processing the results with { @ code generatedKeysProcessor } . */
public < T > T updateAndProcessGeneratedKeys ( @ NotNull ResultSetProcessor < T > generatedKeysProcessor , @ NotNull List < String > columnNames , @ NotNull SqlQuery query ) { } }
|
return withCurrentTransaction ( query , tx -> { logQuery ( query ) ; try ( PreparedStatement ps = prepareStatement ( tx . getConnection ( ) , query . getSql ( ) , columnNames ) ) { prepareStatementFromQuery ( ps , query ) ; long startTime = currentTimeMillis ( ) ; ps . executeUpdate ( ) ; logQueryExecution ( query , currentTimeMillis ( ) - startTime ) ; try ( ResultSet rs = ps . getGeneratedKeys ( ) ) { return generatedKeysProcessor . process ( rs ) ; } } } ) ;
|
public class RestoreDBInstanceFromS3Request { /** * The list of logs that the restored DB instance is to export to CloudWatch Logs . The values in the list depend on
* the DB engine being used . For more information , see < a href =
* " https : / / docs . aws . amazon . com / AmazonRDS / latest / UserGuide / USER _ LogAccess . html # USER _ LogAccess . Procedural . UploadtoCloudWatch "
* > Publishing Database Logs to Amazon CloudWatch Logs < / a > in the < i > Amazon RDS User Guide < / i > .
* @ return The list of logs that the restored DB instance is to export to CloudWatch Logs . The values in the list
* depend on the DB engine being used . For more information , see < a href =
* " https : / / docs . aws . amazon . com / AmazonRDS / latest / UserGuide / USER _ LogAccess . html # USER _ LogAccess . Procedural . UploadtoCloudWatch "
* > Publishing Database Logs to Amazon CloudWatch Logs < / a > in the < i > Amazon RDS User Guide < / i > . */
public java . util . List < String > getEnableCloudwatchLogsExports ( ) { } }
|
if ( enableCloudwatchLogsExports == null ) { enableCloudwatchLogsExports = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return enableCloudwatchLogsExports ;
|
public class AdminParserUtils { /** * Checks if the required option exists .
* @ param options OptionSet to checked
* @ param opt Required option to check
* @ throws VoldemortException */
public static void checkRequired ( OptionSet options , String opt ) throws VoldemortException { } }
|
List < String > opts = Lists . newArrayList ( ) ; opts . add ( opt ) ; checkRequired ( options , opts ) ;
|
public class ConciseSet { /** * { @ inheritDoc } */
@ Override public ConciseSet symmetricDifference ( IntSet other ) { } }
|
if ( other == this ) { return empty ( ) ; } if ( other == null || other . isEmpty ( ) ) { return clone ( ) ; } return performOperation ( convert ( other ) , Operator . XOR ) ;
|
public class AnnotationValue { /** * Gets a list of { @ link AnnotationValue } for the given member .
* @ param member The member
* @ param type The type
* @ param < T > The type
* @ throws IllegalStateException If no member is available that conforms to the given name and type
* @ return The result */
public @ Nonnull final < T extends Annotation > Optional < AnnotationValue < T > > getAnnotation ( String member , Class < T > type ) { } }
|
return getAnnotations ( member , type ) . stream ( ) . findFirst ( ) ;
|
public class AbstractEndpointBuilder { /** * Sets the Spring application context .
* @ param applicationContext
* @ return */
public AbstractEndpointBuilder < T > applicationContext ( ApplicationContext applicationContext ) { } }
|
if ( getEndpoint ( ) instanceof ApplicationContextAware ) { ( ( ApplicationContextAware ) getEndpoint ( ) ) . setApplicationContext ( applicationContext ) ; } if ( getEndpoint ( ) instanceof BeanFactoryAware ) { ( ( BeanFactoryAware ) getEndpoint ( ) ) . setBeanFactory ( applicationContext ) ; } return this ;
|
public class GosuStringUtil { /** * < p > Centers a String in a larger String of size < code > size < / code > .
* Uses a supplied String as the value to pad the String with . < / p >
* < p > If the size is less than the String length , the String is returned .
* A < code > null < / code > String returns < code > null < / code > .
* A negative size is treated as zero . < / p >
* < pre >
* GosuStringUtil . center ( null , * , * ) = null
* GosuStringUtil . center ( " " , 4 , " " ) = " "
* GosuStringUtil . center ( " ab " , - 1 , " " ) = " ab "
* GosuStringUtil . center ( " ab " , 4 , " " ) = " ab "
* GosuStringUtil . center ( " abcd " , 2 , " " ) = " abcd "
* GosuStringUtil . center ( " a " , 4 , " " ) = " a "
* GosuStringUtil . center ( " a " , 4 , " yz " ) = " yayz "
* GosuStringUtil . center ( " abc " , 7 , null ) = " abc "
* GosuStringUtil . center ( " abc " , 7 , " " ) = " abc "
* < / pre >
* @ param str the String to center , may be null
* @ param size the int size of new String , negative treated as zero
* @ param padStr the String to pad the new String with , must not be null or empty
* @ return centered String , < code > null < / code > if null String input
* @ throws IllegalArgumentException if padStr is < code > null < / code > or empty */
public static String center ( String str , int size , String padStr ) { } }
|
if ( str == null || size <= 0 ) { return str ; } if ( isEmpty ( padStr ) ) { padStr = " " ; } int strLen = str . length ( ) ; int pads = size - strLen ; if ( pads <= 0 ) { return str ; } str = leftPad ( str , strLen + pads / 2 , padStr ) ; str = rightPad ( str , size , padStr ) ; return str ;
|
public class Jar { /** * Adds a directory ( with all its subdirectories ) or the contents of a zip / JAR to this JAR .
* @ param path the path within the JAR where the root of the directory will be placed , or { @ code null } for the JAR ' s root
* @ param dirOrZip the directory to add as an entry or a zip / JAR file whose contents will be extracted and added as entries
* @ return { @ code this } */
public Jar addEntries ( Path path , Path dirOrZip ) throws IOException { } }
|
return addEntries ( path , dirOrZip , null ) ;
|
public class ZooKeeperMain { /** * this method creates a quota node for the path
* @ param zk
* the ZooKeeper client
* @ param path
* the path for which quota needs to be created
* @ param bytes
* the limit of bytes on this path
* @ param numNodes
* the limit of number of nodes on this path
* @ return true if its successful and false if not . */
public static boolean createQuota ( ZooKeeper zk , String path , long bytes , int numNodes ) throws KeeperException , IOException , InterruptedException { } }
|
// check if the path exists . We cannot create
// quota for a path that already exists in zookeeper
// for now .
Stat initStat = zk . exists ( path , false ) ; if ( initStat == null ) { throw new IllegalArgumentException ( path + " does not exist." ) ; } // now check if their is already existing
// parent or child that has quota
String quotaPath = Quotas . quotaZookeeper ; // check for more than 2 children - -
// if zookeeper _ stats and zookeeper _ qutoas
// are not the children then this path
// is an ancestor of some path that
// already has quota
String realPath = Quotas . quotaZookeeper + path ; try { List < String > children = zk . getChildren ( realPath , false ) ; for ( String child : children ) { if ( ! child . startsWith ( "zookeeper_" ) ) { throw new IllegalArgumentException ( path + " has child " + child + " which has a quota" ) ; } } } catch ( KeeperException . NoNodeException ne ) { // this is fine
} // check for any parent that has been quota
checkIfParentQuota ( zk , path ) ; // this is valid node for quota
// start creating all the parents
if ( zk . exists ( quotaPath , false ) == null ) { try { zk . create ( Quotas . procZookeeper , null , Ids . OPEN_ACL_UNSAFE , CreateMode . PERSISTENT ) ; zk . create ( Quotas . quotaZookeeper , null , Ids . OPEN_ACL_UNSAFE , CreateMode . PERSISTENT ) ; } catch ( KeeperException . NodeExistsException ne ) { // do nothing
} } // now create the direct children
// and the stat and quota nodes
String [ ] splits = path . split ( "/" ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( quotaPath ) ; for ( int i = 1 ; i < splits . length ; i ++ ) { sb . append ( "/" + splits [ i ] ) ; quotaPath = sb . toString ( ) ; try { zk . create ( quotaPath , null , Ids . OPEN_ACL_UNSAFE , CreateMode . PERSISTENT ) ; } catch ( KeeperException . NodeExistsException ne ) { // do nothing
} } String statPath = quotaPath + "/" + Quotas . statNode ; quotaPath = quotaPath + "/" + Quotas . limitNode ; StatsTrack strack = new StatsTrack ( null ) ; strack . setBytes ( bytes ) ; strack . setCount ( numNodes ) ; try { zk . create ( quotaPath , strack . toString ( ) . getBytes ( ) , Ids . OPEN_ACL_UNSAFE , CreateMode . PERSISTENT ) ; StatsTrack stats = new StatsTrack ( null ) ; stats . setBytes ( 0L ) ; stats . setCount ( 0 ) ; zk . create ( statPath , stats . toString ( ) . getBytes ( ) , Ids . OPEN_ACL_UNSAFE , CreateMode . PERSISTENT ) ; } catch ( KeeperException . NodeExistsException ne ) { byte [ ] data = zk . getData ( quotaPath , false , new Stat ( ) ) ; StatsTrack strackC = new StatsTrack ( new String ( data ) ) ; if ( bytes != - 1L ) { strackC . setBytes ( bytes ) ; } if ( numNodes != - 1 ) { strackC . setCount ( numNodes ) ; } zk . setData ( quotaPath , strackC . toString ( ) . getBytes ( ) , - 1 ) ; } return true ;
|
public class CmsSessionInfo { /** * Returns a string for given time . < p >
* @ param time as timestamp
* @ return string array containing string for hours , minutes , seconds */
public static String [ ] getHourMinuteSecondTimeString ( long time ) { } }
|
int hours = ( int ) time / ( 1000 * 60 * 60 ) ; int min = ( int ) ( time - ( hours * 1000 * 60 * 60 ) ) / ( 1000 * 60 ) ; int sec = ( int ) ( time - ( hours * 1000 * 60 * 60 ) - ( min * 1000 * 60 ) ) / 1000 ; return new String [ ] { getTwoDigitsString ( hours ) , getTwoDigitsString ( min ) , getTwoDigitsString ( sec ) } ;
|
public class CmsUgcUploadHelper { /** * Processes a request caused by a form submit . < p >
* @ param request the request to process */
void processFormSubmitRequest ( HttpServletRequest request ) { } }
|
String formDataId = getFormDataId ( request ) ; List < FileItem > items = CmsRequestUtil . readMultipartFileItems ( request ) ; m_storedFormData . put ( formDataId , items ) ;
|
public class ByteArrayWrapper { /** * Wrap the content of a String in a certain charset .
* @ param sText
* The String to be wrapped . May not be < code > null < / code > .
* @ param aCharset
* The character set to be used for retrieving the bytes from the
* string . May not be < code > null < / code > .
* @ return ByteArrayWrapper The created instance . Never < code > null < / code > .
* @ since 9.2.1 */
@ Nonnull @ ReturnsMutableCopy public static ByteArrayWrapper create ( @ Nonnull final String sText , @ Nonnull final Charset aCharset ) { } }
|
return new ByteArrayWrapper ( sText . getBytes ( aCharset ) , false ) ;
|
public class PollRing { void insert_except ( DevFailed ex , TimeVal t ) { } }
|
if ( size ( ) >= max_elt ) remove ( 0 ) ; add ( new RingElt ( ex , t ) ) ;
|
public class ExternalType { /** * { @ inheritDoc } */
@ Override public final void to ( String path ) throws IOException { } }
|
if ( path == null ) throw new NullPointerException ( ) ; to ( new File ( path ) ) ;
|
public class JMSService { /** * Connect to the JMS server .
* @ return True if successful . */
private boolean connect ( ) { } }
|
if ( this . factory == null ) { return false ; } if ( isConnected ( ) ) { return true ; } try { this . connection = this . factory . createConnection ( ) ; this . session = ( TopicSession ) this . connection . createSession ( false , Session . AUTO_ACKNOWLEDGE ) ; this . connection . start ( ) ; return true ; } catch ( Exception e ) { log . error ( "Error communicating with JMS server: " + e . getMessage ( ) ) ; disconnect ( ) ; return false ; }
|
public class CmsTreeItem { /** * Enables / disables dropping . < p >
* @ param enabled < code > true < / code > to enable , or < code > false < / code > to disable */
public void setDropEnabled ( boolean enabled ) { } }
|
if ( ( m_dropEnabled != null ) && ( m_dropEnabled . booleanValue ( ) == enabled ) ) { return ; } m_dropEnabled = Boolean . valueOf ( enabled ) ;
|
public class Slider2Renderer { /** * Returns converted value of the provided float value ( to the provided type ) .
* @ param type Type to convert float to . Currently only { @ link Float } and { @ link Integer } are supported .
* @ param value Float value to convert .
* @ return Converted value of the provided float value ( to the provided type ) .
* @ throws IllegalArgumentException If an unsupported type is provided . */
private Number convert ( Class < ? extends Number > type , Float value ) { } }
|
if ( int . class . isAssignableFrom ( type ) || Integer . class . isAssignableFrom ( type ) ) { return value . intValue ( ) ; } if ( float . class . isAssignableFrom ( type ) || Float . class . isAssignableFrom ( type ) ) { return value ; } throw new IllegalArgumentException ( "Use integer or float" ) ;
|
public class SigningImageFormat { /** * The supported formats of an AWS Signer signing image .
* @ param supportedFormats
* The supported formats of an AWS Signer signing image .
* @ see ImageFormat */
public void setSupportedFormats ( java . util . Collection < String > supportedFormats ) { } }
|
if ( supportedFormats == null ) { this . supportedFormats = null ; return ; } this . supportedFormats = new java . util . ArrayList < String > ( supportedFormats ) ;
|
public class Iterate { /** * Sort the list by comparing an attribute defined by the function .
* SortThisBy is a mutating method . The List passed in is also returned . */
public static < T , V extends Comparable < ? super V > , L extends List < T > > L sortThisBy ( L list , Function < ? super T , ? extends V > function ) { } }
|
return Iterate . sortThis ( list , Comparators . byFunction ( function ) ) ;
|
public class ElementsExceptionsFactory { /** * Constructs and initializes a new { @ link ConfigurationException } with the given { @ link String message }
* formatted with the given { @ link Object [ ] arguments } .
* @ param message { @ link String } describing the { @ link ConfigurationException exception } .
* @ param args { @ link Object [ ] arguments } used to replace format placeholders in the { @ link String message } .
* @ return a new { @ link ConfigurationException } with the given { @ link String message } .
* @ see # newConfigurationException ( Throwable , String , Object . . . )
* @ see org . cp . elements . context . configure . ConfigurationException */
public static ConfigurationException newConfigurationException ( String message , Object ... args ) { } }
|
return newConfigurationException ( null , message , args ) ;
|
public class Result { /** * Sets the content of the current result to the JSONP response using the given padding ( callback ) . It also sets
* the content - type header to JavaScript and the charset to UTF - 8.
* @ param node the content
* @ return the current result */
public Result render ( String padding , JsonNode node ) { } }
|
this . content = new RenderableJsonP ( padding , node ) ; setContentType ( MimeTypes . JAVASCRIPT ) ; charset = Charsets . UTF_8 ; return this ;
|
public class ArrayFunctions { /** * Returned expression results in new array with value appended . */
public static Expression arrayAppend ( JsonArray array , Expression value ) { } }
|
return arrayAppend ( x ( array ) , value ) ;
|
public class TriplestoreResource { /** * This code is equivalent to the SPARQL query below .
* < p > < pre > < code >
* SELECT ? subject ? predicate ? object
* WHERE {
* GRAPH trellis : PreferServerManaged {
* ? s ldp : member IDENTIFIER
* ? s ldp : membershipResource ? subject
* AND ? s rdf : type ldp : IndirectContainer
* AND ? s ldp : membershipRelation ? predicate
* AND ? s ldp : insertedContentRelation ? o
* AND ? res dc : isPartOf ? s .
* GRAPH ? res { ? res ? o ? object }
* < / code > < / pre > */
private Stream < Quad > fetchIndirectMemberQuads ( ) { } }
|
final Var s = Var . alloc ( "s" ) ; final Var o = Var . alloc ( "o" ) ; final Var res = Var . alloc ( "res" ) ; final Query q = new Query ( ) ; q . setQuerySelectType ( ) ; q . addResultVar ( SUBJECT ) ; q . addResultVar ( PREDICATE ) ; q . addResultVar ( OBJECT ) ; final ElementPathBlock epb1 = new ElementPathBlock ( ) ; epb1 . addTriple ( create ( s , rdf . asJenaNode ( LDP . member ) , rdf . asJenaNode ( identifier ) ) ) ; epb1 . addTriple ( create ( s , rdf . asJenaNode ( LDP . membershipResource ) , SUBJECT ) ) ; epb1 . addTriple ( create ( s , rdf . asJenaNode ( RDF . type ) , rdf . asJenaNode ( LDP . IndirectContainer ) ) ) ; epb1 . addTriple ( create ( s , rdf . asJenaNode ( LDP . hasMemberRelation ) , PREDICATE ) ) ; epb1 . addTriple ( create ( s , rdf . asJenaNode ( LDP . insertedContentRelation ) , o ) ) ; epb1 . addTriple ( create ( res , rdf . asJenaNode ( DC . isPartOf ) , s ) ) ; final ElementPathBlock epb2 = new ElementPathBlock ( ) ; epb2 . addTriple ( create ( res , o , OBJECT ) ) ; final ElementGroup elg = new ElementGroup ( ) ; elg . addElement ( new ElementNamedGraph ( rdf . asJenaNode ( Trellis . PreferServerManaged ) , epb1 ) ) ; elg . addElement ( new ElementNamedGraph ( res , epb2 ) ) ; q . setQueryPattern ( elg ) ; final Stream . Builder < Quad > builder = builder ( ) ; rdfConnection . querySelect ( q , qs -> builder . accept ( rdf . createQuad ( LDP . PreferMembership , getSubject ( qs ) , getPredicate ( qs ) , getObject ( qs ) ) ) ) ; return builder . build ( ) ;
|
public class StringUtil { /** * check if the specified string is all Latin chars
* @ param str
* @ param beginIndex
* @ param endIndex
* @ return boolean */
public static boolean isLatin ( String str , int beginIndex , int endIndex ) { } }
|
for ( int j = beginIndex ; j < endIndex ; j ++ ) { if ( ! isEnChar ( str . charAt ( j ) ) ) { return false ; } } return true ;
|
public class BitArray { /** * Reverses all bits in the array . */
public void reverse ( ) { } }
|
int [ ] newBits = new int [ bits . length ] ; // reverse all int ' s first
int len = ( size - 1 ) / 32 ; int oldBitsLen = len + 1 ; for ( int i = 0 ; i < oldBitsLen ; i ++ ) { long x = bits [ i ] ; x = ( ( x >> 1 ) & 0x55555555L ) | ( ( x & 0x55555555L ) << 1 ) ; x = ( ( x >> 2 ) & 0x33333333L ) | ( ( x & 0x33333333L ) << 2 ) ; x = ( ( x >> 4 ) & 0x0f0f0f0fL ) | ( ( x & 0x0f0f0f0fL ) << 4 ) ; x = ( ( x >> 8 ) & 0x00ff00ffL ) | ( ( x & 0x00ff00ffL ) << 8 ) ; x = ( ( x >> 16 ) & 0x0000ffffL ) | ( ( x & 0x0000ffffL ) << 16 ) ; newBits [ len - i ] = ( int ) x ; } // now correct the int ' s if the bit size isn ' t a multiple of 32
if ( size != oldBitsLen * 32 ) { int leftOffset = oldBitsLen * 32 - size ; int currentInt = newBits [ 0 ] >>> leftOffset ; for ( int i = 1 ; i < oldBitsLen ; i ++ ) { int nextInt = newBits [ i ] ; currentInt |= nextInt << ( 32 - leftOffset ) ; newBits [ i - 1 ] = currentInt ; currentInt = nextInt >>> leftOffset ; } newBits [ oldBitsLen - 1 ] = currentInt ; } bits = newBits ;
|
public class ChronicleSetBuilder { /** * Inject your SPI code around basic { @ code ChronicleSet } ' s operations with entries :
* removing entries and inserting new entries .
* < p > This affects behaviour of ordinary set . add ( ) , set . remove ( ) , calls , as well as removes
* < i > during iterations < / i > , updates during < i > remote calls < / i > and
* < i > internal replication operations < / i > . */
public ChronicleSetBuilder < K > entryOperations ( SetEntryOperations < K , ? > entryOperations ) { } }
|
chronicleMapBuilder . entryOperations ( new MapEntryOperations < K , DummyValue , Object > ( ) { @ Override public Object remove ( @ NotNull MapEntry < K , DummyValue > entry ) { // noinspection unchecked
return entryOperations . remove ( ( SetEntry < K > ) entry ) ; } @ Override public Object insert ( @ NotNull MapAbsentEntry < K , DummyValue > absentEntry , Data < DummyValue > value ) { // noinspection unchecked
return entryOperations . insert ( ( SetAbsentEntry < K > ) absentEntry ) ; } } ) ; return this ;
|
public class ListPhoneNumberOrdersResult { /** * The phone number order details .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setPhoneNumberOrders ( java . util . Collection ) } or { @ link # withPhoneNumberOrders ( java . util . Collection ) } if
* you want to override the existing values .
* @ param phoneNumberOrders
* The phone number order details .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListPhoneNumberOrdersResult withPhoneNumberOrders ( PhoneNumberOrder ... phoneNumberOrders ) { } }
|
if ( this . phoneNumberOrders == null ) { setPhoneNumberOrders ( new java . util . ArrayList < PhoneNumberOrder > ( phoneNumberOrders . length ) ) ; } for ( PhoneNumberOrder ele : phoneNumberOrders ) { this . phoneNumberOrders . add ( ele ) ; } return this ;
|
public class ConfigurationModule { /** * Binds a set of values to a Param using ConfigurationModule .
* @ param opt Target Param
* @ param values Values to bind to the Param
* @ param < T > type
* @ return the Configuration module */
public final < T > ConfigurationModule setMultiple ( final Param < T > opt , final Iterable < String > values ) { } }
|
ConfigurationModule c = deepCopy ( ) ; for ( final String val : values ) { c = c . set ( opt , val ) ; } return c ;
|
public class MultivariateGaussianDistribution { /** * Algorithm from Alan Genz ( 1992 ) Numerical Computation of
* Multivariate Normal Probabilities , Journal of Computational and
* Graphical Statistics , pp . 141-149.
* The difference between returned value and the true value of the
* CDF is less than 0.001 in 99.9 % time . The maximum number of iterations
* is set to 10000. */
@ Override public double cdf ( double [ ] x ) { } }
|
if ( x . length != dim ) { throw new IllegalArgumentException ( "Sample has different dimension." ) ; } int Nmax = 10000 ; double alph = GaussianDistribution . getInstance ( ) . quantile ( 0.999 ) ; double errMax = 0.001 ; double [ ] v = x . clone ( ) ; Math . minus ( v , mu ) ; double p = 0.0 ; double varSum = 0.0 ; // d is always zero
double [ ] e = new double [ dim ] ; double [ ] f = new double [ dim ] ; e [ 0 ] = GaussianDistribution . getInstance ( ) . cdf ( v [ 0 ] / sigmaL . get ( 0 , 0 ) ) ; f [ 0 ] = e [ 0 ] ; double [ ] y = new double [ dim ] ; double err = 2 * errMax ; int N ; for ( N = 1 ; err > errMax && N <= Nmax ; N ++ ) { double [ ] w = Math . random ( dim - 1 ) ; for ( int i = 1 ; i < dim ; i ++ ) { y [ i - 1 ] = GaussianDistribution . getInstance ( ) . quantile ( w [ i - 1 ] * e [ i - 1 ] ) ; double q = 0.0 ; for ( int j = 0 ; j < i ; j ++ ) { q += sigmaL . get ( i , j ) * y [ j ] ; } e [ i ] = GaussianDistribution . getInstance ( ) . cdf ( ( v [ i ] - q ) / sigmaL . get ( i , i ) ) ; f [ i ] = e [ i ] * f [ i - 1 ] ; } double del = ( f [ dim - 1 ] - p ) / N ; p += del ; varSum = ( N - 2 ) * varSum / N + del * del ; err = alph * Math . sqrt ( varSum ) ; } return p ;
|
public class Maps { /** * Stringifies a Map in a stable fashion . */
public static < K extends Comparable < K > , V > void toStringSorted ( Map < K , V > map , StringBuilder builder ) { } }
|
builder . append ( "{" ) ; List < Entry < K , V > > sortedProperties = Maps . sortedEntries ( map ) ; int index = 0 ; for ( Entry < K , V > entry : sortedProperties ) { if ( index > 0 ) { builder . append ( ", " ) ; } builder . append ( entry . getKey ( ) ) . append ( "=" ) . append ( entry . getValue ( ) ) ; index ++ ; } builder . append ( "}" ) ;
|
public class NfsFileBase { /** * ( non - Javadoc )
* @ see com . emc . ecs . nfsclient . util . NfsFile # createNewFile ( ) */
public boolean createNewFile ( ) throws IOException { } }
|
try { create ( NfsCreateMode . GUARDED , new NfsSetAttributes ( ) , null ) ; } catch ( NfsException e ) { if ( e . getStatus ( ) == NfsStatus . NFS3ERR_EXIST ) { return false ; } throw e ; } return true ;
|
public class Layouts { /** * Create an instance of the view specified in a { @ link Layout } annotation . */
public static android . view . View createView ( Context context , Object screen ) { } }
|
return createView ( context , screen . getClass ( ) ) ;
|
public class Inflector { /** * Makes an underscored form from the expression in the string ( the reverse of the { @ link # camelCase ( String , boolean , char [ ] )
* camelCase } method . Also changes any characters that match the supplied delimiters into underscore .
* Examples :
* < pre >
* inflector . underscore ( & quot ; activeRecord & quot ; ) # = & gt ; & quot ; active _ record & quot ;
* inflector . underscore ( & quot ; ActiveRecord & quot ; ) # = & gt ; & quot ; active _ record & quot ;
* inflector . underscore ( & quot ; firstName & quot ; ) # = & gt ; & quot ; first _ name & quot ;
* inflector . underscore ( & quot ; FirstName & quot ; ) # = & gt ; & quot ; first _ name & quot ;
* inflector . underscore ( & quot ; name & quot ; ) # = & gt ; & quot ; name & quot ;
* inflector . underscore ( & quot ; The . firstName & quot ; ) # = & gt ; & quot ; the _ first _ name & quot ;
* < / pre >
* @ param camelCaseWord the camel - cased word that is to be converted ;
* @ param delimiterChars optional characters that are used to delimit word boundaries ( beyond capitalization )
* @ return a lower - cased version of the input , with separate words delimited by the underscore character . */
public String underscore ( String camelCaseWord , char ... delimiterChars ) { } }
|
if ( camelCaseWord == null ) return null ; String result = camelCaseWord . trim ( ) ; if ( result . length ( ) == 0 ) return "" ; result = result . replaceAll ( "([A-Z]+)([A-Z][a-z])" , "$1_$2" ) ; result = result . replaceAll ( "([a-z\\d])([A-Z])" , "$1_$2" ) ; result = result . replace ( '-' , '_' ) ; if ( delimiterChars != null ) { for ( char delimiterChar : delimiterChars ) { result = result . replace ( delimiterChar , '_' ) ; } } return result . toLowerCase ( ) ;
|
public class Maybe { /** * Asynchronously subscribes subscribers to this Maybe on the specified { @ link Scheduler } .
* < img width = " 640 " height = " 752 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Maybe . subscribeOn . png " alt = " " >
* < dl >
* < dt > < b > Scheduler : < / b > < / dt >
* < dd > you specify which { @ link Scheduler } this operator will use . < / dd >
* < / dl >
* @ param scheduler
* the { @ link Scheduler } to perform subscription actions on
* @ return the new Maybe instance that its subscriptions happen on the specified { @ link Scheduler }
* @ see < a href = " http : / / reactivex . io / documentation / operators / subscribeon . html " > ReactiveX operators documentation : SubscribeOn < / a >
* @ see < a href = " http : / / www . grahamlea . com / 2014/07 / rxjava - threading - examples / " > RxJava Threading Examples < / a >
* @ see # observeOn */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Maybe < T > subscribeOn ( Scheduler scheduler ) { } }
|
ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeSubscribeOn < T > ( this , scheduler ) ) ;
|
public class Period { /** * Returns true if any unit is set .
* @ return true if any unit is set */
public boolean isSet ( ) { } }
|
for ( int i = 0 ; i < counts . length ; ++ i ) { if ( counts [ i ] != 0 ) { return true ; } } return false ;
|
public class ScanningQueryEngine { /** * Create an { @ link ExtractFromRow } instance that produces for given row a single object that can be used to sort all rows in
* the specified order .
* @ param ordering the specification of the sort order ; may not be null or empty
* @ param sourceNamesByAlias the map of selector names keyed by their aliases ; may not be null but may be empty
* @ param context the context in which the query is to be executed ; may not be null
* @ param columns the result column definition ; may not be null
* @ param sources the query sources for the repository ; may not be null
* @ return the extractor ; never null */
protected ExtractFromRow createSortingExtractor ( Ordering ordering , Map < SelectorName , SelectorName > sourceNamesByAlias , QueryContext context , Columns columns , QuerySources sources ) { } }
|
DynamicOperand operand = ordering . getOperand ( ) ; TypeFactory < ? > defaultType = context . getTypeSystem ( ) . getStringFactory ( ) ; // only when ordered column is residual or not
// defined
ExtractFromRow extractor = createExtractFromRow ( operand , context , columns , sources , defaultType , false , false ) ; return RowExtractors . extractorWith ( extractor , ordering . order ( ) , ordering . nullOrder ( ) ) ;
|
public class ThrowsTaglet { /** * Inherit throws documentation for exceptions that were declared but not
* documented . */
private Content inheritThrowsDocumentation ( Element holder , List < ? extends TypeMirror > declaredExceptionTypes , Set < String > alreadyDocumented , TagletWriter writer ) { } }
|
Utils utils = writer . configuration ( ) . utils ; Content result = writer . getOutputInstance ( ) ; if ( utils . isExecutableElement ( holder ) ) { Map < List < ? extends DocTree > , ExecutableElement > declaredExceptionTags = new LinkedHashMap < > ( ) ; for ( TypeMirror declaredExceptionType : declaredExceptionTypes ) { Input input = new DocFinder . Input ( utils , holder , this , utils . getTypeName ( declaredExceptionType , false ) ) ; DocFinder . Output inheritedDoc = DocFinder . search ( writer . configuration ( ) , input ) ; if ( inheritedDoc . tagList . isEmpty ( ) ) { String typeName = utils . getTypeName ( declaredExceptionType , true ) ; input = new DocFinder . Input ( utils , holder , this , typeName ) ; inheritedDoc = DocFinder . search ( writer . configuration ( ) , input ) ; } if ( ! inheritedDoc . tagList . isEmpty ( ) ) { if ( inheritedDoc . holder == null ) { inheritedDoc . holder = holder ; } declaredExceptionTags . put ( inheritedDoc . tagList , ( ExecutableElement ) inheritedDoc . holder ) ; } } result . addContent ( throwsTagsOutput ( declaredExceptionTags , writer , alreadyDocumented , false ) ) ; } return result ;
|
public class UpdateKeyword { /** * Runs the example .
* @ param adWordsServices the services factory .
* @ param session the session .
* @ param adGroupId the ID of the ad group for the criterion .
* @ param keywordId the ID of the criterion to update .
* @ throws ApiException if the API request failed with one or more service errors .
* @ throws RemoteException if the API request failed due to other errors . */
public static void runExample ( AdWordsServicesInterface adWordsServices , AdWordsSession session , Long adGroupId , Long keywordId ) throws RemoteException { } }
|
// Get the AdGroupCriterionService .
AdGroupCriterionServiceInterface adGroupCriterionService = adWordsServices . get ( session , AdGroupCriterionServiceInterface . class ) ; // Create ad group criterion with updated bid .
Criterion criterion = new Criterion ( ) ; criterion . setId ( keywordId ) ; BiddableAdGroupCriterion biddableAdGroupCriterion = new BiddableAdGroupCriterion ( ) ; biddableAdGroupCriterion . setAdGroupId ( adGroupId ) ; biddableAdGroupCriterion . setCriterion ( criterion ) ; // Create bids .
BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration ( ) ; CpcBid bid = new CpcBid ( ) ; bid . setBid ( new Money ( null , 10000000L ) ) ; biddingStrategyConfiguration . setBids ( new Bids [ ] { bid } ) ; biddableAdGroupCriterion . setBiddingStrategyConfiguration ( biddingStrategyConfiguration ) ; // Create operations .
AdGroupCriterionOperation operation = new AdGroupCriterionOperation ( ) ; operation . setOperand ( biddableAdGroupCriterion ) ; operation . setOperator ( Operator . SET ) ; AdGroupCriterionOperation [ ] operations = new AdGroupCriterionOperation [ ] { operation } ; // Update ad group criteria .
AdGroupCriterionReturnValue result = adGroupCriterionService . mutate ( operations ) ; // Display ad group criteria .
for ( AdGroupCriterion adGroupCriterionResult : result . getValue ( ) ) { if ( adGroupCriterionResult instanceof BiddableAdGroupCriterion ) { biddableAdGroupCriterion = ( BiddableAdGroupCriterion ) adGroupCriterionResult ; CpcBid criterionCpcBid = null ; // Find the criterion - level CpcBid among the keyword ' s bids .
for ( Bids bids : biddableAdGroupCriterion . getBiddingStrategyConfiguration ( ) . getBids ( ) ) { if ( bids instanceof CpcBid ) { CpcBid cpcBid = ( CpcBid ) bids ; if ( BidSource . CRITERION . equals ( cpcBid . getCpcBidSource ( ) ) ) { criterionCpcBid = cpcBid ; } } } System . out . printf ( "Ad group criterion with ad group ID %d, criterion ID %d, type " + "'%s', and bid %d was updated.%n" , biddableAdGroupCriterion . getAdGroupId ( ) , biddableAdGroupCriterion . getCriterion ( ) . getId ( ) , biddableAdGroupCriterion . getCriterion ( ) . getCriterionType ( ) , criterionCpcBid . getBid ( ) . getMicroAmount ( ) ) ; } }
|
public class MessagingAuthorizationServiceImpl { /** * @ see com . ibm . ws . messaging . security . authorization . MessagingAuthorizationService # checkTemporaryDestinationAccess ( javax . security . auth . Subject , java . lang . String ,
* java . lang . String ) */
@ Override public boolean checkTemporaryDestinationAccess ( Subject authenticatedSubject , String destinationName , String operationType ) throws MessagingAuthorizationException { } }
|
SibTr . entry ( tc , CLASS_NAME + "checkTemporaryDestinationAccess" , new Object [ ] { authenticatedSubject , destinationName , operationType } ) ; String busName = null ; String messagingEngine = null ; String [ ] roles = null ; if ( auditManager != null ) { if ( auditManager . getJMSBusName ( ) != null ) busName = auditManager . getJMSBusName ( ) ; if ( auditManager . getJMSMessagingEngine ( ) != null ) messagingEngine = auditManager . getJMSMessagingEngine ( ) ; } checkIfUserIsAuthenticated ( authenticatedSubject ) ; String userName = null ; String user = authenticatedSubject . getPrincipals ( ) . iterator ( ) . next ( ) . getName ( ) ; Map < String , TemporaryDestinationPermission > mq = messagingSecurityService . getTemporaryDestinationPermissions ( ) ; roles = messagingSecurityService . getDestinationRoles ( mq , destinationName , user ) ; SibTr . debug ( tc , "checkTemporaryDestinationAccess, roles: " + Arrays . toString ( roles ) ) ; boolean result = false ; try { userName = MessagingSecurityUtility . getUniqueUserName ( authenticatedSubject ) ; } catch ( MessagingSecurityException e ) { if ( auditManager != null && auditManager . getJMSConversationMetaData ( ) != null ) { ConversationMetaData cmd = ( ConversationMetaData ) auditManager . getJMSConversationMetaData ( ) ; Audit . audit ( Audit . EventID . SECURITY_JMS_AUTHZ_01 , user , cmd . getRemoteAddress ( ) . getHostAddress ( ) , new Integer ( cmd . getRemotePort ( ) ) . toString ( ) , cmd . getChainName ( ) , busName , messagingEngine , destinationName , operationType , roles , "temporaryDestination" , Integer . valueOf ( "201" ) ) ; } else { Audit . audit ( Audit . EventID . SECURITY_JMS_AUTHZ_01 , user , null , null , null , busName , messagingEngine , destinationName , operationType , roles , "temporaryDestination" , Integer . valueOf ( "201" ) ) ; } throw new MessagingAuthorizationException ( Tr . formatMessage ( tc , "USER_NOT_AUTHORIZED_MSE1010" , userName , operationType , destinationName ) , e ) ; } Map < String , TemporaryDestinationPermission > tempDestinationPermissions = messagingSecurityService . getTemporaryDestinationPermissions ( ) ; List < String > prefixList = getPrefixMatchingTemporaryDestination ( tempDestinationPermissions . keySet ( ) , destinationName ) ; for ( String prefix : prefixList ) { TemporaryDestinationPermission permission = tempDestinationPermissions . get ( prefix ) ; result = checkPermission ( permission , operationType , userName ) ; if ( result ) break ; } if ( ! result ) { if ( auditManager != null && auditManager . getJMSConversationMetaData ( ) != null ) { ConversationMetaData cmd = ( ConversationMetaData ) auditManager . getJMSConversationMetaData ( ) ; Audit . audit ( Audit . EventID . SECURITY_JMS_AUTHZ_01 , user , cmd . getRemoteAddress ( ) . getHostAddress ( ) , new Integer ( cmd . getRemotePort ( ) ) . toString ( ) , cmd . getChainName ( ) , busName , messagingEngine , destinationName , operationType , roles , "temporaryDestination" , Integer . valueOf ( "201" ) ) ; } else { Audit . audit ( Audit . EventID . SECURITY_JMS_AUTHZ_01 , user , null , null , null , busName , messagingEngine , destinationName , operationType , roles , "temporaryDestination" , Integer . valueOf ( "201" ) ) ; } SibTr . debug ( tc , "USER_NOT_AUTHORIZED_MSE1010" , new Object [ ] { userName , operationType , destinationName } ) ; throw new MessagingAuthorizationException ( Tr . formatMessage ( tc , "USER_NOT_AUTHORIZED_MSE1010" , userName , operationType , destinationName ) ) ; } else { if ( auditManager != null && auditManager . getJMSConversationMetaData ( ) != null ) { ConversationMetaData cmd = ( ConversationMetaData ) auditManager . getJMSConversationMetaData ( ) ; Audit . audit ( Audit . EventID . SECURITY_JMS_AUTHZ_01 , user , cmd . getRemoteAddress ( ) . getHostAddress ( ) , new Integer ( cmd . getRemotePort ( ) ) . toString ( ) , cmd . getChainName ( ) , busName , messagingEngine , destinationName , operationType , roles , "temporaryDestination" , Integer . valueOf ( "200" ) ) ; } else { Audit . audit ( Audit . EventID . SECURITY_JMS_AUTHZ_01 , user , null , null , null , busName , messagingEngine , destinationName , operationType , roles , "temporaryDestination" , Integer . valueOf ( "200" ) ) ; } } SibTr . exit ( tc , CLASS_NAME + "checkTemporaryDestinationAccess" , result ) ; return result ;
|
public class RoleAssignmentsInner { /** * Creates a role assignment .
* @ param scope The scope of the role assignment to create . The scope can be any REST resource instance . For example , use ' / subscriptions / { subscription - id } / ' for a subscription , ' / subscriptions / { subscription - id } / resourceGroups / { resource - group - name } ' for a resource group , and ' / subscriptions / { subscription - id } / resourceGroups / { resource - group - name } / providers / { resource - provider } / { resource - type } / { resource - name } ' for a resource .
* @ param roleAssignmentName The name of the role assignment to create . It can be any valid GUID .
* @ param parameters Parameters for the role assignment .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the RoleAssignmentInner object */
public Observable < RoleAssignmentInner > createAsync ( String scope , String roleAssignmentName , RoleAssignmentCreateParameters parameters ) { } }
|
return createWithServiceResponseAsync ( scope , roleAssignmentName , parameters ) . map ( new Func1 < ServiceResponse < RoleAssignmentInner > , RoleAssignmentInner > ( ) { @ Override public RoleAssignmentInner call ( ServiceResponse < RoleAssignmentInner > response ) { return response . body ( ) ; } } ) ;
|
public class DataFrame { /** * Indicates that a new DataFrame Entry should be opened .
* @ param firstRecordEntry If true , this entry will be marked as the first entry in a record ( records can be split
* across multiple frames , and this helps ensure that , upon reading , the records are recomposed
* starting with the right Data Frame Entry ) .
* @ return True if we were able to start an entry in this Frame , or false otherwise ( this happens in case the frame is full ) .
* If the frame is full , the new entry will need to be started on a new Frame .
* @ throws IllegalStateException If the entry is sealed . */
boolean startNewEntry ( boolean firstRecordEntry ) { } }
|
Preconditions . checkState ( ! this . sealed , "DataFrame is sealed and cannot accept any more entries." ) ; endEntry ( true ) ; if ( getAvailableLength ( ) < MIN_ENTRY_LENGTH_NEEDED ) { // If we cannot fit at least entry header + 1 byte , we cannot record anything in this write frame anymore .
return false ; } this . writeEntryStartIndex = this . writePosition ; this . writeEntryHeader = new WriteEntryHeader ( this . contents . subSegment ( this . writePosition , WriteEntryHeader . HEADER_SIZE ) ) ; this . writeEntryHeader . setFirstRecordEntry ( firstRecordEntry ) ; this . writePosition += WriteEntryHeader . HEADER_SIZE ; return true ;
|
public class ObjectOriginIdentifierImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setSystem ( Integer newSystem ) { } }
|
Integer oldSystem = system ; system = newSystem ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . OBJECT_ORIGIN_IDENTIFIER__SYSTEM , oldSystem , system ) ) ;
|
public class MetricsStore { /** * Gets all the metrics by instance type and the metric name . The supported instance types are
* worker and client .
* @ param instanceType the instance type
* @ param name the metric name
* @ return the set of matched metrics */
public Set < Metric > getMetricsByInstanceTypeAndName ( MetricsSystem . InstanceType instanceType , String name ) { } }
|
if ( instanceType == InstanceType . MASTER ) { return getMasterMetrics ( name ) ; } if ( instanceType == InstanceType . WORKER ) { synchronized ( mWorkerMetrics ) { return mWorkerMetrics . getByField ( NAME_INDEX , name ) ; } } else if ( instanceType == InstanceType . CLIENT ) { synchronized ( mClientMetrics ) { return mClientMetrics . getByField ( NAME_INDEX , name ) ; } } else { throw new IllegalArgumentException ( "Unsupported instance type " + instanceType ) ; }
|
public class Kafka08Fetcher { /** * Find leaders for the partitions .
* < p > From a high level , the method does the following :
* - Get a list of FetchPartitions ( usually only a few partitions )
* - Get the list of topics from the FetchPartitions list and request the partitions for the topics . ( Kafka doesn ' t support getting leaders for a set of partitions )
* - Build a Map & lt ; Leader , List & lt ; FetchPartition & gt ; & gt ; where only the requested partitions are contained .
* @ param partitionsToAssign fetch partitions list
* @ return leader to partitions map */
private static Map < Node , List < KafkaTopicPartitionState < TopicAndPartition > > > findLeaderForPartitions ( List < KafkaTopicPartitionState < TopicAndPartition > > partitionsToAssign , Properties kafkaProperties ) throws Exception { } }
|
if ( partitionsToAssign . isEmpty ( ) ) { throw new IllegalArgumentException ( "Leader request for empty partitions list" ) ; } LOG . info ( "Refreshing leader information for partitions {}" , partitionsToAssign ) ; // this request is based on the topic names
PartitionInfoFetcher infoFetcher = new PartitionInfoFetcher ( getTopics ( partitionsToAssign ) , kafkaProperties ) ; infoFetcher . start ( ) ; // NOTE : The kafka client apparently locks itself up sometimes
// when it is interrupted , so we run it only in a separate thread .
// since it sometimes refuses to shut down , we resort to the admittedly harsh
// means of killing the thread after a timeout .
KillerWatchDog watchDog = new KillerWatchDog ( infoFetcher , 60000 ) ; watchDog . start ( ) ; // this list contains ALL partitions of the requested topics
List < KafkaTopicPartitionLeader > topicPartitionWithLeaderList = infoFetcher . getPartitions ( ) ; // copy list to track unassigned partitions
List < KafkaTopicPartitionState < TopicAndPartition > > unassignedPartitions = new ArrayList < > ( partitionsToAssign ) ; // final mapping from leader - > list ( fetchPartition )
Map < Node , List < KafkaTopicPartitionState < TopicAndPartition > > > leaderToPartitions = new HashMap < > ( ) ; for ( KafkaTopicPartitionLeader partitionLeader : topicPartitionWithLeaderList ) { if ( unassignedPartitions . size ( ) == 0 ) { // we are done : all partitions are assigned
break ; } Iterator < KafkaTopicPartitionState < TopicAndPartition > > unassignedPartitionsIterator = unassignedPartitions . iterator ( ) ; while ( unassignedPartitionsIterator . hasNext ( ) ) { KafkaTopicPartitionState < TopicAndPartition > unassignedPartition = unassignedPartitionsIterator . next ( ) ; if ( unassignedPartition . getKafkaTopicPartition ( ) . equals ( partitionLeader . getTopicPartition ( ) ) ) { // we found the leader for one of the fetch partitions
Node leader = partitionLeader . getLeader ( ) ; List < KafkaTopicPartitionState < TopicAndPartition > > partitionsOfLeader = leaderToPartitions . get ( leader ) ; if ( partitionsOfLeader == null ) { partitionsOfLeader = new ArrayList < > ( ) ; leaderToPartitions . put ( leader , partitionsOfLeader ) ; } partitionsOfLeader . add ( unassignedPartition ) ; unassignedPartitionsIterator . remove ( ) ; // partition has been assigned
break ; } } } if ( unassignedPartitions . size ( ) > 0 ) { throw new RuntimeException ( "Unable to find a leader for partitions: " + unassignedPartitions ) ; } LOG . debug ( "Partitions with assigned leaders {}" , leaderToPartitions ) ; return leaderToPartitions ;
|
public class ComputeNodeOperations { /** * Disables task scheduling on the specified compute node .
* @ param poolId The ID of the pool .
* @ param nodeId The ID of the compute node .
* @ param nodeDisableSchedulingOption Specifies what to do with currently running tasks .
* @ param additionalBehaviors A collection of { @ link BatchClientBehavior } instances that are applied to the Batch service request .
* @ throws BatchErrorException Exception thrown when an error response is received from the Batch service .
* @ throws IOException Exception thrown when there is an error in serialization / deserialization of data sent to / received from the Batch service . */
public void disableComputeNodeScheduling ( String poolId , String nodeId , DisableComputeNodeSchedulingOption nodeDisableSchedulingOption , Iterable < BatchClientBehavior > additionalBehaviors ) throws BatchErrorException , IOException { } }
|
ComputeNodeDisableSchedulingOptions options = new ComputeNodeDisableSchedulingOptions ( ) ; BehaviorManager bhMgr = new BehaviorManager ( this . customBehaviors ( ) , additionalBehaviors ) ; bhMgr . applyRequestBehaviors ( options ) ; this . parentBatchClient . protocolLayer ( ) . computeNodes ( ) . disableScheduling ( poolId , nodeId , nodeDisableSchedulingOption , options ) ;
|
public class GlobalChannelTrafficCounter { /** * Start the monitoring process . */
@ Override public synchronized void start ( ) { } }
|
if ( monitorActive ) { return ; } lastTime . set ( milliSecondFromNano ( ) ) ; long localCheckInterval = checkInterval . get ( ) ; if ( localCheckInterval > 0 ) { monitorActive = true ; monitor = new MixedTrafficMonitoringTask ( ( GlobalChannelTrafficShapingHandler ) trafficShapingHandler , this ) ; scheduledFuture = executor . schedule ( monitor , localCheckInterval , TimeUnit . MILLISECONDS ) ; }
|
public class FieldAccessor { /** * Return the value of the object
* @ param object
* @ return */
public V getValue ( T object ) { } }
|
try { if ( this . getMethod != null ) { return ( V ) this . getMethod . invoke ( object ) ; } else { return ( V ) this . field . get ( object ) ; } } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; } catch ( InvocationTargetException e ) { throw new RuntimeException ( e ) ; }
|
public class RomanticCron4jNativeTaskExecutor { protected void setupLinkedLockIfNeeds ( ) { } }
|
readyLockFieldIfNeeds ( ) ; if ( linkedLock == null ) { synchronized ( attributeLinkLock ) { if ( linkedLock == null ) { linkedLock = getFieldValue ( lockField ) ; } } }
|
public class SeaGlassSynthPainterImpl { /** * Paints the background of the thumb of a slider .
* @ param context SynthContext identifying the < code > JComponent < / code >
* and < code > Region < / code > to paint to
* @ param g < code > Graphics < / code > to paint to
* @ param x X coordinate of the area to paint to
* @ param y Y coordinate of the area to paint to
* @ param w Width of the area to paint to
* @ param h Height of the area to paint to
* @ param orientation One of < code > JSlider . HORIZONTAL < / code > or < code >
* JSlider . VERTICAL < / code > */
public void paintSliderThumbBackground ( SynthContext context , Graphics g , int x , int y , int w , int h , int orientation ) { } }
|
if ( context . getComponent ( ) . getClientProperty ( "Slider.paintThumbArrowShape" ) == Boolean . TRUE ) { if ( orientation == JSlider . HORIZONTAL ) { orientation = JSlider . VERTICAL ; } else { orientation = JSlider . HORIZONTAL ; } paintBackground ( context , g , x , y , w , h , orientation ) ; } else { paintBackground ( context , g , x , y , w , h , orientation ) ; }
|
public class ThriftKeyspaceImpl { /** * Attempt to execute the DDL operation on the same host
* @ param operation
* @ param retry
* @ return
* @ throws OperationException
* @ throws ConnectionException */
private synchronized < R > OperationResult < R > executeDdlOperation ( AbstractOperationImpl < R > operation , RetryPolicy retry ) throws OperationException , ConnectionException { } }
|
ConnectionException lastException = null ; for ( int i = 0 ; i < 2 ; i ++ ) { operation . setPinnedHost ( ddlHost ) ; try { OperationResult < R > result = connectionPool . executeWithFailover ( operation , retry ) ; ddlHost = result . getHost ( ) ; return result ; } catch ( ConnectionException e ) { lastException = e ; if ( e instanceof IsDeadConnectionException ) { ddlHost = null ; } } } throw lastException ;
|
public class XBasePanel { /** * Display the start form in input format .
* @ param out The out stream .
* @ param iPrintOptions The view specific attributes . */
public void printControlStartForm ( PrintWriter out , int iPrintOptions ) { } }
|
if ( ( ( iPrintOptions & HtmlConstants . HEADING_SCREEN ) == HtmlConstants . HEADING_SCREEN ) || ( ( iPrintOptions & HtmlConstants . FOOTING_SCREEN ) == HtmlConstants . FOOTING_SCREEN ) || ( ( iPrintOptions & HtmlConstants . DETAIL_SCREEN ) == HtmlConstants . DETAIL_SCREEN ) ) return ; // Don ' t need on nested forms
super . printControlStartForm ( out , iPrintOptions ) ; String strAction = "post" ; BasePanel modelScreen = ( BasePanel ) this . getScreenField ( ) ; // ? strAction = " postxml " ;
out . println ( Utility . startTag ( "hidden-params" ) ) ; this . addHiddenParams ( out , this . getHiddenParams ( ) ) ; out . println ( Utility . endTag ( "hidden-params" ) ) ; out . println ( "<xform id=\"form1\">" ) ; out . println ( " <submission" ) ; out . println ( " id=\"submit1\"" ) ; out . println ( " method=\"" + strAction + "\"" ) ; out . println ( " localfile=\"temp.xml\"" ) ; out . println ( " action=\"" + modelScreen . getServletPath ( null ) + "\" />" ) ; // ? out . println ( " < model href = \ " form . xsd \ " > " ) ;
// ? out . println ( " < ! - - The model is currently ignored - - > " ) ;
// ? out . println ( " < / model > " ) ;
// ? out . println ( " < instance id = \ " instance1 \ " xmlns = \ " \ " > " ) ;
|
public class Pays { /** * WAP支付
* @ param wapPayDetail 支付字段信息
* @ return 自动提交表单 ( 可直接输出到浏览器 ) */
public String wapPay ( WapPayDetail wapPayDetail ) { } }
|
Map < String , String > wapPayParams = buildWapPayParams ( wapPayDetail ) ; return buildPayForm ( wapPayParams ) ;
|
public class InMemoryLookupTable { /** * Render the words via tsne */
@ Override public void plotVocab ( int numWords , UiConnectionInfo connectionInfo ) { } }
|
BarnesHutTsne tsne = new BarnesHutTsne . Builder ( ) . normalize ( false ) . setFinalMomentum ( 0.8f ) . numDimension ( 2 ) . setMaxIter ( 1000 ) . build ( ) ; plotVocab ( tsne , numWords , connectionInfo ) ;
|
public class CmsMimeType { /** * MIME - types are compared according to the type first , and to the extension second . < p >
* @ see java . lang . Comparable # compareTo ( java . lang . Object ) */
public int compareTo ( CmsMimeType obj ) { } }
|
if ( obj == this ) { return 0 ; } int result = m_type . compareTo ( obj . m_type ) ; if ( result == 0 ) { result = m_extension . compareTo ( obj . m_extension ) ; } return result ;
|
public class nspbr6 { /** * Use this API to apply nspbr6 resources . */
public static base_responses apply ( nitro_service client , nspbr6 resources [ ] ) throws Exception { } }
|
base_responses result = null ; if ( resources != null && resources . length > 0 ) { nspbr6 applyresources [ ] = new nspbr6 [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { applyresources [ i ] = new nspbr6 ( ) ; } result = perform_operation_bulk_request ( client , applyresources , "apply" ) ; } return result ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.