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 . createSoc... |
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... | 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 !=... |
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 ( n... |
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 < ? > descri... | 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\"... |
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
* @... | resolver . addMethodFunction ( new DefaultFunction ( ) ) ; resolver . addMethodFunction ( new GetAttributeFunction ( ) ) ; resolver . addMethodFunction ( new SetAttributeFunction ( ) ) ; resolver . addMethodFunction ( new NewEntityFunction ( ) ) ; resolver . addMethodFunction ( new GetEntityFunction ( ) ) ; resolver . ... |
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 data... | /* 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 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 SdkClientExcepti... |
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 J... | 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 ;... |
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 ( ) ;... |
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 [ ] { k... |
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
* Tra... | 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 ( AUGMENTATION... |
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 par... | 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 IOExcept... | 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... | 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 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 .... | 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 . ... |
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 th... | 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 , cu... |
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 _... | 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... | 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 >... | 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 fi... | 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... | // 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... |
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 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 (... |
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 f... | 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 > funct... | 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 } .
*... | 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 , Jso... | 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 : ... | 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 ( ... |
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 )... |
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 >... | 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 MapAbs... |
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... | 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 , f... | 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... | 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 ; /... |
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 ++ ... |
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 . unders... | 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 ( delimiterC... |
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 > <... | 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 s... | 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 ) ; re... |
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 ... |
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 o... | // Get the AdGroupCriterionService .
AdGroupCriterionServiceInterface adGroupCriterionService = adWordsServices . get ( session , AdGroupCriterionServiceInterface . class ) ; // Create ad group criterion with updated bid .
Criterion criterion = new Criterion ( ) ; criterion . setId ( keywordId ) ; BiddableAdGroupCriter... |
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 checkTemporaryDestinat... | 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 = au... |
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 } / resourceGrou... | 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 w... | 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 . ... |
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 > getMetricsByInstanceTypeAndN... | 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... |
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 '... | 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 ... |
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 collec... | ComputeNodeDisableSchedulingOptions options = new ComputeNodeDisableSchedulingOptions ( ) ; BehaviorManager bhMgr = new BehaviorManager ( this . customBehaviors ( ) , additionalBehaviors ) ; bhMgr . applyRequestBehaviors ( options ) ; this . parentBatchClient . protocolLayer ( ) . computeNodes ( ) . disableScheduling (... |
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 = e... |
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 p... | 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 { paintBackgr... |
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 > operat... | 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 ;... |
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
s... |
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" ) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.