signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ClassByImplementationBenchmark { /** * Performs a benchmark of an interface implementation using the Java Class Library ' s utilities .
* @ return The created instance , in order to avoid JIT removal .
* @ throws java . lang . Exception If the reflective invocation causes an exception . */
@ Benchmark ... | return ( ExampleInterface ) Proxy . newProxyInstance ( newClassLoader ( ) , new Class < ? > [ ] { baseClass } , new InvocationHandler ( ) { public Object invoke ( Object proxy , Method method , Object [ ] args ) { Class < ? > returnType = method . getReturnType ( ) ; if ( returnType . isPrimitive ( ) ) { if ( returnTyp... |
public class FnFloat { /** * Determines whether the target object and the specified object are NOT equal
* by calling the < tt > equals < / tt > method on the target object .
* @ param object the { @ link Float } to compare to the target
* @ return false if both objects are equal , true if not . */
public static ... | return ( Function < Float , Boolean > ) ( ( Function ) FnObject . notEq ( object ) ) ; |
public class CmsJspTagContentLoad { /** * Load the next file name from the initialized list of file names . < p >
* @ throws CmsException if something goes wrong */
protected void doLoadNextFile ( ) throws CmsException { } } | super . doLoadNextResource ( ) ; if ( m_resource == null ) { return ; } // upgrade the resource to a file
CmsFile file = m_cms . readFile ( m_resource ) ; // unmarshal the XML content from the resource , don ' t use unmarshal ( CmsObject , CmsResource )
// as no support for getting the historic version that has been ca... |
public class FieldInfo { /** * For numeric fields , get the current value .
* Usually overidden .
* @ return the field ' s value . */
public double getValue ( ) { } } | Object objData = this . getData ( ) ; if ( objData != null ) { Class < ? > classData = this . getDataClass ( ) ; if ( classData != Object . class ) if ( classData == objData . getClass ( ) ) { if ( classData == Short . class ) return ( ( Short ) objData ) . shortValue ( ) ; else if ( classData == Integer . class ) retu... |
public class XFunctionTypeRefImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case XtypePackage . XFUNCTION_TYPE_REF__PARAM_TYPES : getParamTypes ( ) . clear ( ) ; getParamTypes ( ) . addAll ( ( Collection < ? extends JvmTypeReference > ) newValue ) ; return ; case XtypePackage . XFUNCTION_TYPE_REF__RETURN_TYPE : setReturnType ( ( JvmTypeReference ) newValue ) ; return ; c... |
public class LoggingContext { /** * Get the location information of the logging event . If the information has
* been cached it is retrieved from the MDC ( for asynchronous events MDCs
* are retained ) , else it is generated .
* @ param event
* - The logging event
* @ return - The location information of the ... | if ( event != loggingEvent . get ( ) ) { loggingEvent . set ( event ) ; clearLocationInfo ( ) ; } // For async appenders , the locationInfo is set in the MDC and not with
// the thread since the thread that processes the logging is different
// from the one that
// generates location information .
LocationInfo location... |
public class FlowPath { /** * This method allows to toggle wasExecuted ( ) state for specified node
* @ param nodeName
* @ param executed */
public void markExecuted ( @ NonNull String nodeName , boolean executed ) { } } | states . get ( nodeName ) . setExecuted ( executed ) ; |
public class BasePGPCommon { /** * reads the PGP public key from a PublicKeyRing
* @ param publicKeyRing
* the source public key ring
* @ param keyFilter
* the filter to apply
* @ return the matching PGP public or null if none matches */
protected PGPPublicKey retrievePublicKey ( PGPPublicKeyRing publicKeyRin... | LOGGER . trace ( "retrievePublicKey(PGPPublicKeyRing, KeyFilter<PGPPublicKey>)" ) ; PGPPublicKey result = null ; Iterator < PGPPublicKey > publicKeyIterator = publicKeyRing . getPublicKeys ( ) ; LOGGER . debug ( "Iterating through public keys in public key ring" ) ; while ( result == null && publicKeyIterator . hasNext... |
public class Card { /** * Bank code . See < a
* href = " http : / / es . wikipedia . org / w / index . php ? title = CLABE & oldid = 71482742 # C . C3 . B3digo _ de _ Banco " > this < / a > for an
* incomplete list as of December , 2013. */
public Card bankCode ( final Integer bankCode ) { } } | if ( bankCode == null ) { this . bankCode = null ; } else { this . bankCode = String . format ( "%03d" , bankCode ) ; } return this ; |
public class ImageMiscOps { /** * Sets each value in the image to a value drawn from an uniform distribution that has a range of min & le ; X & lt ; max .
* @ param img Image which is to be filled . Modified ,
* @ param rand Random number generator
* @ param min Minimum value of the distribution , inclusive
* @... | double range = max - min ; double [ ] data = img . data ; for ( int y = 0 ; y < img . height ; y ++ ) { int index = img . getStartIndex ( ) + y * img . getStride ( ) ; for ( int x = 0 ; x < img . width ; x ++ ) { data [ index ++ ] = rand . nextDouble ( ) * range + min ; } } |
public class SignalServiceAccountManager { /** * Checks whether a contact is currently registered with the server .
* @ param e164number The contact to check .
* @ return An optional ContactTokenDetails , present if registered , absent if not .
* @ throws IOException */
public Optional < ContactTokenDetails > get... | String contactToken = createDirectoryServerToken ( e164number , true ) ; ContactTokenDetails contactTokenDetails = this . pushServiceSocket . getContactTokenDetails ( contactToken ) ; if ( contactTokenDetails != null ) { contactTokenDetails . setNumber ( e164number ) ; } return Optional . fromNullable ( contactTokenDet... |
public class AWSKMSClient { /** * Returns a list of all tags for the specified customer master key ( CMK ) .
* You cannot perform this operation on a CMK in a different AWS account .
* @ param listResourceTagsRequest
* @ return Result of the ListResourceTags operation returned by the service .
* @ throws KMSInt... | request = beforeClientExecution ( request ) ; return executeListResourceTags ( request ) ; |
public class Symbol { /** * The outermost class which indirectly owns this symbol . */
public ClassSymbol outermostClass ( ) { } } | Symbol sym = this ; Symbol prev = null ; while ( sym . kind != PCK ) { prev = sym ; sym = sym . owner ; } return ( ClassSymbol ) prev ; |
public class InputComponents { /** * Returns the completer associated with this { @ link InputComponent } or null if it is not available
* @ param inputComponent
* @ return the { @ link UICompleter } associated with this { @ link InputComponent } or null if not available or the
* { @ link InputComponent } does no... | final UICompleter < VALUETYPE > result ; if ( inputComponent instanceof HasCompleter ) { result = ( ( HasCompleter ) inputComponent ) . getCompleter ( ) ; } else { result = null ; } return result ; |
public class QueueBufferFuture { /** * Report that the task this future represents has failed . */
public synchronized void setFailure ( Exception paramE ) { } } | if ( done ) return ; // can ' t mark done twice
e = paramE ; done = true ; notifyAll ( ) ; // if we have a callback to call , schedule
// it on a different thread . Who knows what this
// thread is doing .
if ( callback != null ) { QueueBuffer . executor . submit ( new Callable < Void > ( ) { public Void call ( ) throw... |
public class DistributedCache { /** * Checks if the cache has already been localized and is fresh */
private static boolean ifExistsAndFresh ( Configuration conf , FileSystem fs , URI cache , long confFileStamp , CacheStatus lcacheStatus , FileStatus fileStatus ) throws IOException { } } | // check for existence of the cache
long dfsFileStamp ; if ( fileStatus != null ) { dfsFileStamp = fileStatus . getModificationTime ( ) ; } else { dfsFileStamp = getTimestamp ( conf , cache ) ; } // ensure that the file on hdfs hasn ' t been modified since the job started
if ( dfsFileStamp != confFileStamp ) { LOG . fa... |
public class Client { /** * Makes a set of calls in parallel . Each parameter is sent to the
* corresponding address . When all values are available , or have timed out
* or errored , the collected results are returned in an array . The array
* contains nulls for calls that timed out or errored . */
public Writab... | if ( addresses . length == 0 ) return new Writable [ 0 ] ; ParallelResults results = new ParallelResults ( params . length ) ; synchronized ( results ) { for ( int i = 0 ; i < params . length ; i ++ ) { ParallelCall call = new ParallelCall ( params [ i ] , results , i ) ; try { Connection connection = getConnection ( a... |
public class ECheckService { /** * Method to retrieve ECheck
* @ param eCheckId
* @ return
* @ throws BaseException */
public ECheck retrieve ( String eCheckId ) throws BaseException { } } | logger . debug ( "Enter ECheckService::retrieve" ) ; if ( StringUtils . isBlank ( eCheckId ) ) { logger . error ( "IllegalArgumentException {}" , eCheckId ) ; throw new IllegalArgumentException ( "eCheckId cannot be empty or null" ) ; } // prepare API url
String apiUrl = requestContext . getBaseUrl ( ) + "echecks/{id}"... |
public class IniFile { /** * Sets the specified java . sql . Timestamp property .
* @ param pstrSection the INI section name .
* @ param pstrProp the property to be set .
* @ param ptsVal the timestamp value to be persisted . */
public void setTimestampProperty ( String pstrSection , String pstrProp , Timestamp p... | INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec == null ) { objSec = new INISection ( pstrSection ) ; this . mhmapSections . put ( pstrSection , objSec ) ; } objSec . setProperty ( pstrProp , timeToStr ( ptsVal , this . mstrTimeStampFmt ) , pstrComments ) ; |
public class JSDocInfoBuilder { /** * Adds a textual block to the current marker . */
public void markText ( String text , int startLineno , int startCharno , int endLineno , int endCharno ) { } } | if ( currentMarker != null ) { JSDocInfo . StringPosition position = new JSDocInfo . StringPosition ( ) ; position . setItem ( text ) ; position . setPositionInformation ( startLineno , startCharno , endLineno , endCharno ) ; currentMarker . setDescription ( position ) ; } |
public class RuntimeUtil { /** * 执行命令 < br >
* 命令带参数时参数可作为其中一个参数 , 也可以将命令和参数组合为一个字符串传入
* @ param cmds 命令
* @ return { @ link Process } */
public static Process exec ( String ... cmds ) { } } | if ( ArrayUtil . isEmpty ( cmds ) ) { throw new NullPointerException ( "Command is empty !" ) ; } // 单条命令的情况
if ( 1 == cmds . length ) { final String cmd = cmds [ 0 ] ; if ( StrUtil . isBlank ( cmd ) ) { throw new NullPointerException ( "Command is empty !" ) ; } cmds = StrUtil . splitToArray ( cmd , StrUtil . C_SPACE ... |
public class GRPCDriverClientService { /** * Helper methods */
private boolean isIdle ( ) { } } | LOG . log ( Level . INFO , "Clock idle {0}, outstanding evaluators {1}, current evaluators {2}" , new Object [ ] { this . clock . get ( ) . isIdle ( ) , this . outstandingEvaluatorCount , this . evaluatorBridgeMap . isEmpty ( ) } ) ; return clock . get ( ) . isIdle ( ) && this . outstandingEvaluatorCount == 0 && this .... |
public class JavaParsingAtomicQueueGenerator { /** * Generates something like < code > field = newValue < / code >
* @ param fieldName
* @ param valueName
* @ return */
protected BlockStmt fieldAssignment ( String fieldName , String valueName ) { } } | BlockStmt body = new BlockStmt ( ) ; body . addStatement ( new ExpressionStmt ( new AssignExpr ( new NameExpr ( fieldName ) , new NameExpr ( valueName ) , Operator . ASSIGN ) ) ) ; return body ; |
public class JSModule { /** * Gets the names of the modules that this module depends on ,
* sorted alphabetically . */
List < String > getSortedDependencyNames ( ) { } } | List < String > names = new ArrayList < > ( ) ; for ( JSModule module : getDependencies ( ) ) { names . add ( module . getName ( ) ) ; } Collections . sort ( names ) ; return names ; |
public class MXmlWriter { /** * { @ inheritDoc } */
@ Override public void print ( MBasicTable table , OutputStream out ) throws IOException { } } | // xml possible qu ' avec MTable
if ( table instanceof MListTable ) { writeXml ( ( MListTable < ? > ) table , out ) ; } else { throw new IllegalArgumentException ( ) ; } |
public class FeatureState { /** * Adds a single user to the list of users
* @ deprecated This method will be removed soon . Use { @ link # setParameter ( String , String ) } instead to modify the
* corresponding strategy parameter . */
@ Deprecated public FeatureState addUsers ( Collection < String > users ) { } } | Set < String > set = new LinkedHashSet < > ( ) ; set . addAll ( this . getUsers ( ) ) ; set . addAll ( users ) ; String setAsString = Strings . trimToNull ( Strings . join ( set , "," ) ) ; setParameter ( UsernameActivationStrategy . PARAM_USERS , setAsString ) ; return this ; |
public class ServerSocketSettings { /** * endregion */
public void applySettings ( @ NotNull ServerSocketChannel channel ) throws IOException { } } | if ( receiveBufferSize != 0 ) { channel . setOption ( SO_RCVBUF , receiveBufferSize ) ; } if ( reuseAddress != DEF_BOOL ) { channel . setOption ( SO_REUSEADDR , reuseAddress != FALSE ) ; } |
public class Customers { /** * This method is used to delete a saved credit card of an customer .
* @ param creditCardId
* { @ code String } the Moip credit card external ID .
* @ param setup
* { @ code Setup } the setup object .
* @ return { @ code Map < String , Object > } */
public Map < String , Object > ... | this . requestMaker = new RequestMaker ( setup ) ; RequestProperties props = new RequestPropertiesBuilder ( ) . method ( "DELETE" ) . endpoint ( String . format ( "/v2/fundinginstruments/%s" , creditCardId ) ) . type ( Customers . class ) . contentType ( CONTENT_TYPE ) . build ( ) ; return this . requestMaker . doReque... |
public class CassandraOutputFormatBase { /** * Closes all resources used . */
@ Override public void close ( ) throws IOException { } } | try { if ( session != null ) { session . close ( ) ; } } catch ( Exception e ) { LOG . error ( "Error while closing session." , e ) ; } try { if ( cluster != null ) { cluster . close ( ) ; } } catch ( Exception e ) { LOG . error ( "Error while closing cluster." , e ) ; } |
public class RepeatRecordFilter { /** * Configures the default logging handlers to use an instance of this
* filter . */
public static void configureDefaultHandler ( int maxRepeat ) { } } | Logger logger = LogManager . getLogManager ( ) . getLogger ( "" ) ; Handler [ ] handlers = logger . getHandlers ( ) ; RepeatRecordFilter filter = new RepeatRecordFilter ( maxRepeat ) ; for ( int ii = 0 ; ii < handlers . length ; ii ++ ) { handlers [ ii ] . setFilter ( filter ) ; } |
public class CommonOps_DDRM { /** * Performs an in - place element by element scalar multiplication . < br >
* < br >
* a < sub > ij < / sub > = & alpha ; * a < sub > ij < / sub >
* @ param a The matrix that is to be scaled . Modified .
* @ param alpha the amount each element is multiplied by . */
public static... | // on very small matrices ( 2 by 2 ) the call to getNumElements ( ) can slow it down
// slightly compared to other libraries since it involves an extra multiplication .
final int size = a . getNumElements ( ) ; for ( int i = 0 ; i < size ; i ++ ) { a . data [ i ] *= alpha ; } |
public class DescribeModelRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeModelRequest describeModelRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeModelRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeModelRequest . getModelName ( ) , MODELNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e ... |
public class MediaUtils { /** * Handle the activity result of an intent launched to capture a photo or choose an image
* @ see # getCameraCaptureIntent ( Context , String )
* @ see # getChooseMediaIntent ( String )
* @ param context the activity context
* @ param resultCode the result of the return code
* @ p... | if ( resultCode == Activity . RESULT_OK ) { switch ( requestCode ) { case CAPTURE_PHOTO_REQUEST_CODE : if ( mCurrentCaptureUri != null ) { revokePermissions ( context , mCurrentCaptureUri ) ; File file = getAccessibleTempFile ( context , mCurrentCaptureUri ) ; mCurrentCaptureUri = null ; return Observable . just ( file... |
public class LssClient { /** * list your streams by app name
* @ param app app name
* @ return the response */
public ListAppStreamsResponse listAppStreams ( String app ) { } } | ListAppStreamsRequest request = new ListAppStreamsRequest ( ) ; request . setApp ( app ) ; return listAppStreams ( request ) ; |
public class GenerateRunnersMojo { /** * Overrides the parameters with cucumber . options if they have been specified . Plugins have
* somewhat limited support . */
private OverriddenCucumberOptionsParameters overrideParametersWithCucumberOptions ( ) throws MojoExecutionException { } } | try { final OverriddenCucumberOptionsParameters overriddenParameters = new OverriddenCucumberOptionsParameters ( ) . setTags ( tags ) . setGlue ( glue ) . setStrict ( strict ) . setPlugins ( parseFormatAndPlugins ( format , plugins == null ? new ArrayList < Plugin > ( ) : plugins ) ) . setMonochrome ( monochrome ) ; if... |
public class Activator { /** * Called whenever the OSGi framework starts our bundle */
public void start ( BundleContext bc ) throws Exception { } } | httpServiceRef = bc . getServiceReference ( HttpService . class ) ; if ( httpServiceRef != null ) { httpService = ( HttpService ) bc . getService ( httpServiceRef ) ; httpService . registerServlet ( "/status" , new StatusServlet ( ) , null , null ) ; httpService . registerServlet ( "/status-with-auth" , new StatusServl... |
public class PactDslJsonArray { /** * Element that must be the specified value
* @ param value string value */
public PactDslJsonArray stringValue ( String value ) { } } | if ( value == null ) { body . put ( JSONObject . NULL ) ; } else { body . put ( value ) ; } return this ; |
public class PtoPMessageItemStream { /** * Returns the messagingEngineUuid .
* @ return SIBUuid */
public SIBUuid8 getLocalizingMEUuid ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getLocalizingMEUuid" ) ; SibTr . exit ( tc , "getLocalizingMEUuid" , messagingEngineUuid ) ; } return messagingEngineUuid ; |
public class TerminalEmulatorDeviceConfiguration { /** * Copies the current configuration . The new object has the given value .
* @ param cursorColor Color of the terminal text cursor
* @ return A copy of the current configuration with the changed value . */
public TerminalEmulatorDeviceConfiguration withCursorCol... | if ( this . cursorColor == cursorColor ) { return this ; } else { return new TerminalEmulatorDeviceConfiguration ( this . lineBufferScrollbackSize , this . blinkLengthInMilliSeconds , this . cursorStyle , cursorColor , this . cursorBlinking , this . clipboardAvailable ) ; } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link TopoComplexMemberType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link TopoComplexMemberType } { ... | return new JAXBElement < TopoComplexMemberType > ( _MaximalComplex_QNAME , TopoComplexMemberType . class , null , value ) ; |
public class ProvidersInner { /** * Get available application frameworks and their versions .
* Get available application frameworks and their versions .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; ApplicationStackInner & gt ; object wrapped in { @ ... | if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } final String osTypeSelected = null ; return service . getAvailableStacks ( osTypeSelected , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) ... |
public class EntityInfo { /** * 数据库的值转换成数字段值
* @ param attr Attribute
* @ param entity 记录对象
* @ return Object */
public Serializable getFieldValue ( Attribute < T , Serializable > attr , T entity ) { } } | Serializable val = attr . get ( entity ) ; CryptHandler cryptHandler = attr . attach ( ) ; if ( cryptHandler != null ) val = ( Serializable ) cryptHandler . decrypt ( val ) ; return val ; |
public class TypeUtil { /** * 获取方法的参数类型 < br >
* 优先获取方法的GenericParameterTypes , 如果获取不到 , 则获取ParameterTypes
* @ param method 方法
* @ param index 第几个参数的索引 , 从0开始计数
* @ return { @ link Type } , 可能为 { @ code null } */
public static Type getParamType ( Method method , int index ) { } } | Type [ ] types = getParamTypes ( method ) ; if ( null != types && types . length > index ) { return types [ index ] ; } return null ; |
public class PoolUpdatePropertiesOptions { /** * Set the time the request was issued . Client libraries typically set this to the current system clock time ; set it explicitly if you are calling the REST API directly .
* @ param ocpDate the ocpDate value to set
* @ return the PoolUpdatePropertiesOptions object itse... | if ( ocpDate == null ) { this . ocpDate = null ; } else { this . ocpDate = new DateTimeRfc1123 ( ocpDate ) ; } return this ; |
public class Cache2kBuilder { /** * If a loader exception happens , this is the maximum time interval after a
* retry attempt is made . For retries an exponential backoff algorithm is used .
* It starts with the retry time and then increases the time to the maximum
* according to an exponential pattern .
* < p ... | config ( ) . setMaxRetryInterval ( u . toMillis ( v ) ) ; return this ; |
public class RetentionSet { /** * Find retention record on or before the given size .
* @ param size size
* @ return reference record which is greatest lower bound for given size . It returns null if no such record exists in the set . */
public StreamCutReferenceRecord findStreamCutReferenceForSize ( long size ) { ... | int beforeIndex = getGreatestLowerBound ( this , size , StreamCutReferenceRecord :: getRecordingSize ) ; if ( beforeIndex < 0 ) { return null ; } return retentionRecords . get ( beforeIndex ) ; |
public class GenericDao { /** * 查询符合条件的结果计数
* @ param column 条件字段
* @ param value 条件字段的值 。 支持集合对象 , 支持数组 , 会按照in 操作来组装条件
* @ return */
public int count ( String column , Object value ) { } } | return count ( Operators . match ( column , value ) ) ; |
public class UpdatePreferencesServlet { /** * Remove an element from the layout .
* @ param request
* @ param response
* @ return
* @ throws IOException */
@ RequestMapping ( method = RequestMethod . POST , params = "action=removeElement" ) public ModelAndView removeElement ( HttpServletRequest request , HttpSe... | IUserInstance ui = userInstanceManager . getUserInstance ( request ) ; IPerson per = getPerson ( ui , response ) ; UserPreferencesManager upm = ( UserPreferencesManager ) ui . getPreferencesManager ( ) ; IUserLayoutManager ulm = upm . getUserLayoutManager ( ) ; try { // Delete the requested element node . This code is ... |
public class DescribeActivityTypeRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeActivityTypeRequest describeActivityTypeRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeActivityTypeRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeActivityTypeRequest . getDomain ( ) , DOMAIN_BINDING ) ; protocolMarshaller . marshall ( describeActivityTypeRequest . getActivityType ( ) , ACTIVITY... |
public class DatabaseProviderVertx { /** * Execute a transaction on a Vert . x worker thread , with default semantics ( commit if
* the code completes successfully , or rollback if it throws an error ) . The provided
* result handler will be call after the commit or rollback , and will run on the event
* loop thr... | VertxUtil . executeBlocking ( executor , future -> { try { T returnValue = null ; Transaction tx = new TransactionImpl ( ) ; tx . setRollbackOnError ( true ) ; tx . setRollbackOnly ( false ) ; boolean complete = false ; try { returnValue = code . run ( this , tx ) ; complete = true ; } catch ( ThreadDeath | DatabaseExc... |
public class PayloadSender { /** * Sends payload asynchronously . Returns boolean flag immediately indicating if payload send was
* scheduled
* @ throws IllegalArgumentException is payload is null */
synchronized boolean sendPayload ( final PayloadData payload ) { } } | if ( payload == null ) { throw new IllegalArgumentException ( "Payload is null" ) ; } // we don ' t allow concurrent payload sending
if ( isSendingPayload ( ) ) { return false ; } // we mark the sender as " busy " so no other payloads would be sent until we ' re done
sendingFlag = true ; try { sendPayloadRequest ( payl... |
public class RTMPUtils { /** * Encodes header size marker and channel id into header marker .
* @ param out output buffer
* @ param headerSize Header size marker
* @ param channelId Channel used */
public static void encodeHeaderByte ( IoBuffer out , byte headerSize , int channelId ) { } } | if ( channelId <= 63 ) { out . put ( ( byte ) ( ( headerSize << 6 ) + channelId ) ) ; } else if ( channelId <= 319 ) { out . put ( ( byte ) ( headerSize << 6 ) ) ; out . put ( ( byte ) ( channelId - 64 ) ) ; } else { out . put ( ( byte ) ( ( headerSize << 6 ) | 1 ) ) ; channelId -= 64 ; out . put ( ( byte ) ( channelId... |
public class AbstractSegment3F { /** * Replies the distance between the line of this segment and the given point .
* @ param point
* @ return the distance . */
@ Pure public double distanceLine ( Point3D point ) { } } | return distanceLinePoint ( getX1 ( ) , getY1 ( ) , getZ1 ( ) , getX2 ( ) , getY2 ( ) , getZ2 ( ) , point . getX ( ) , point . getY ( ) , point . getZ ( ) ) ; |
public class AbstractMySQLQuery { /** * The GROUP BY clause permits a WITH ROLLUP modifier that causes extra rows to be added to the
* summary output . These rows represent higher - level ( or super - aggregate ) summary operations .
* ROLLUP thus enables you to answer questions at multiple levels of analysis with ... | return addFlag ( Position . AFTER_GROUP_BY , WITH_ROLLUP ) ; |
public class GetPersonTrackingResult { /** * An array of the persons detected in the video and the time ( s ) their path was tracked throughout the video . An
* array element will exist for each time a person ' s path is tracked .
* @ param persons
* An array of the persons detected in the video and the time ( s ... | if ( persons == null ) { this . persons = null ; return ; } this . persons = new java . util . ArrayList < PersonDetection > ( persons ) ; |
public class XBELValidator { /** * { @ inheritDoc } */
@ Override public void validate ( final String s ) throws SAXException , IOException { } } | final Source s2 = new StreamSource ( new StringReader ( s ) ) ; validate ( s2 , null ) ; |
public class CouchDBObjectMapper { /** * Gets the json object .
* @ param columns
* the columns
* @ param object
* the object
* @ return the json object */
private static JsonObject getJsonObject ( Set < Attribute > columns , Object object ) { } } | JsonObject jsonObject = new JsonObject ( ) ; for ( Attribute column : columns ) { if ( ! column . isAssociation ( ) ) { Object valueObject = PropertyAccessorHelper . getObject ( object , ( Field ) column . getJavaMember ( ) ) ; jsonObject . add ( ( ( AbstractAttribute ) column ) . getJPAColumnName ( ) , getJsonPrimitiv... |
public class HttpUtils { /** * Creates a map from the parameters in the specified request . Multi value parameters will be in an array .
* @ param request the request */
public static Map < String , Object > createRequestParamsMap ( HttpServletRequest request ) { } } | Map < String , Object > paramsMap = new HashMap < > ( ) ; for ( Enumeration paramNameEnum = request . getParameterNames ( ) ; paramNameEnum . hasMoreElements ( ) ; ) { String paramName = ( String ) paramNameEnum . nextElement ( ) ; String [ ] paramValues = request . getParameterValues ( paramName ) ; if ( paramValues .... |
public class Engine { /** * Get template engine singleton .
* @ param configPath - config path
* @ param configProperties - config properties
* @ return template engine */
public static Engine getEngine ( String configPath , Properties configProperties ) { } } | if ( StringUtils . isEmpty ( configPath ) ) { configPath = HTTL_PROPERTIES ; } VolatileReference < Engine > reference = ENGINES . get ( configPath ) ; if ( reference == null ) { reference = new VolatileReference < Engine > ( ) ; // quickly
VolatileReference < Engine > old = ENGINES . putIfAbsent ( configPath , referenc... |
public class HttpImageUploadChannel { /** * Create a post request encapsulating bytes from the given
* ByteArrayOutputStream . */
private HttpPost setupRequest ( ByteArrayOutputStream bos ) { } } | ContentBody cb = new ByteArrayBody ( bos . toByteArray ( ) , "image" ) ; HttpPost postRequest = new HttpPost ( uri + "/uploadImage" ) ; MultipartEntity reqEntity = new MultipartEntity ( HttpMultipartMode . BROWSER_COMPATIBLE ) ; // add a single part to the request
reqEntity . addPart ( "file" , cb ) ; postRequest . set... |
public class Lists { /** * Creates a < i > mutable < / i > { @ code ArrayList } instance containing the given elements .
* @ param elements the elements that the list should contain , in order
* @ return a new { @ code ArrayList } containing those elements */
@ SafeVarargs public static < E > ArrayList < E > newArr... | ArrayList < E > list = new ArrayList < E > ( ) ; Collections . addAll ( list , elements ) ; return list ; |
public class Order { /** * syntactic sugar */
public Reference addDetail ( ) { } } | Reference t = new Reference ( ) ; if ( this . detail == null ) this . detail = new ArrayList < Reference > ( ) ; this . detail . add ( t ) ; return t ; |
public class StorageSnippets { /** * [ VARIABLE 42 " ] */
public byte [ ] readBlobFromStringsWithGeneration ( String bucketName , String blobName , long blobGeneration ) { } } | // [ START readBlobFromStringsWithGeneration ]
byte [ ] content = storage . readAllBytes ( bucketName , blobName , BlobSourceOption . generationMatch ( blobGeneration ) ) ; // [ END readBlobFromStringsWithGeneration ]
return content ; |
public class ArrayHeap { /** * iterative heapify up : move item o at index up until correctly placed */
private int heapifyUp ( HeapEntry < E > entry ) { } } | int numSwaps = 0 ; while ( true ) { if ( entry . index == 0 ) { break ; } HeapEntry < E > parentEntry = parent ( entry ) ; if ( compare ( entry , parentEntry ) >= 0 ) { break ; } numSwaps ++ ; swap ( entry , parentEntry ) ; } return numSwaps ; |
public class AbstractResource { /** * Gets all objects managed by this resource . By default , only users with
* the < code > admin < / code > role are authorized to use this API . Setting
* the < code > restricted < / code > field to < code > false < / code > in the two -
* argument constructor will change this ... | if ( isRestricted ( ) && ! req . isUserInRole ( "admin" ) ) { throw new HttpStatusException ( Response . Status . FORBIDDEN ) ; } List < C > results = new ArrayList < > ( ) ; for ( E userEntity : this . dao . getAll ( ) ) { results . add ( toComm ( userEntity , req ) ) ; } return results ; |
public class Vector3f { /** * / * ( non - Javadoc )
* @ see org . joml . Vector3fc # div ( float , org . joml . Vector3f ) */
public Vector3f div ( float scalar , Vector3f dest ) { } } | float inv = 1.0f / scalar ; dest . x = x * inv ; dest . y = y * inv ; dest . z = z * inv ; return dest ; |
public class Beans { /** * Chooses a method / constructor of a given name , whose signature best matches the given list of argument types .
* @ param < T > the type of the member / constructor to return
* @ param candidates the list of method / constructor candidates to choose from
* @ param pe the ParameterExtra... | T chosenCandidate = null ; Class < ? > [ ] chosenParamTypes = null ; // try to find the most applicable candidate
Search : for ( int i = 0 ; i < candidates . length ; i ++ ) { // System . err . println ( " Looking at candidate " + candidates [ i ] ) ;
// ignore functions with different name
if ( name != null && ! candi... |
public class DynamicOutputBuffer { /** * Encodes the given string as UTF - 8 , puts it into the buffer
* and increases the write position accordingly .
* @ param s the string to put
* @ return the number of UTF - 8 bytes put */
public int putUTF8 ( String s ) { } } | int written = putUTF8 ( _position , s ) ; _position += written ; return written ; |
public class Log4JLogger { /** * Log a message at level TRACE according to the specified format and
* argument .
* This form avoids superfluous object creation when the logger is disabled
* for level TRACE .
* @ param format
* the format string
* @ param arg
* the argument */
@ Override public void trace ... | if ( isTraceEnabled ( ) ) { FormattingTuple ft = MessageFormatter . format ( format , arg ) ; logger . log ( FQCN , traceCapable ? Level . TRACE : Level . DEBUG , ft . getMessage ( ) , ft . getThrowable ( ) ) ; } |
public class SeekableByteChannelPrefetcher { /** * Reads a sequence of bytes from this channel into the given buffer .
* < p > Bytes are read starting at this channel ' s current position , and then the position is updated
* with the number of bytes actually read . Otherwise this method behaves exactly as specified... | if ( ! open ) { throw new ClosedChannelException ( ) ; } try { if ( trackTime ) { msBetweenCallsToRead += betweenCallsToRead . elapsed ( TimeUnit . MILLISECONDS ) ; } ByteBuffer src ; try { Stopwatch waitingForData ; if ( trackTime ) { waitingForData = Stopwatch . createStarted ( ) ; } src = fetch ( position ) ; if ( t... |
public class PostalAddress { /** * region > title */
public String title ( ) { } } | if ( getPlaceId ( ) != null ) { return getFormattedAddress ( ) ; } else { final TitleBuffer buf = new TitleBuffer ( ) ; buf . append ( getAddressLine1 ( ) ) . append ( "," , getAddressLine2 ( ) ) . append ( "," , getAddressLine3 ( ) ) . append ( "," , getAddressLine4 ( ) ) . append ( "," , getPostalCode ( ) ) . append ... |
public class BitsUtil { /** * Copy a bitset .
* Note : Bits beyond mincap < em > may < / em > be retained !
* @ param v Array to copy
* @ param mincap Target < em > minimum < / em > capacity
* @ param shift Number of bits to shift left
* @ return Copy with space for at least " capacity " bits */
public static... | int words = ( ( mincap - 1 ) >>> LONG_LOG2_SIZE ) + 1 ; if ( v . length == words && shift == 0 ) { return Arrays . copyOf ( v , v . length ) ; } long [ ] ret = new long [ words ] ; final int shiftWords = shift >>> LONG_LOG2_SIZE ; final int shiftBits = shift & LONG_LOG2_MASK ; // Simple case - multiple of word size
if ... |
public class FactorGraph { /** * Identical to { @ link # outcomeToAssignment ( List , List ) } , but with
* arrays .
* @ param factorVariables
* @ param outcome
* @ return */
public Assignment outcomeToAssignment ( String [ ] factorVariables , Object [ ] outcome ) { } } | return outcomeToAssignment ( Arrays . asList ( factorVariables ) , Arrays . asList ( outcome ) ) ; |
public class ExpansionPointGroupMember { /** * Returns the group member that manages the command with the given id , or null if none of the
* members in this expansion point manage a command with that id .
* @ param commandId The id of the command whose managing member is to be returned .
* @ return The group mem... | for ( Iterator it = members . iterator ( ) ; it . hasNext ( ) ; ) { GroupMember member = ( GroupMember ) it . next ( ) ; if ( member . managesCommand ( commandId ) ) { return member ; } } return null ; |
public class Job { /** * Set the named arguments .
* @ param vars
* the new named arguments */
@ SuppressWarnings ( "unchecked" ) public void setVars ( final Map < String , ? extends Object > vars ) { } } | this . vars = ( Map < String , Object > ) vars ; |
public class QueryImpl { /** * Sets the relation entities .
* @ param enhanceEntities
* the enhance entities
* @ param client
* the client
* @ param m
* the m
* @ return the list */
protected List < Object > setRelationEntities ( List enhanceEntities , Client client , EntityMetadata m ) { } } | // Enhance entities can contain or may not contain relation .
// if it contain a relation means it is a child
// if it does not then it means it is a parent .
List < Object > result = new ArrayList < Object > ( ) ; // Stack of objects . To be used for referring any similar object found
// later .
// This prevents infin... |
public class DTMDefaultBase { /** * Diagnostics function to dump the DTM . */
public void dumpDTM ( OutputStream os ) { } } | try { if ( os == null ) { File f = new File ( "DTMDump" + ( ( Object ) this ) . hashCode ( ) + ".txt" ) ; System . err . println ( "Dumping... " + f . getAbsolutePath ( ) ) ; os = new FileOutputStream ( f ) ; } PrintStream ps = new PrintStream ( os ) ; while ( nextNode ( ) ) { } int nRecords = m_size ; ps . println ( "... |
public class ConfigurationContext { /** * Called when context configuration is finished ( but extensions installation is not finished yet ) .
* Merges disabled items configuration with registered items or creates new items to hold disable info . */
public void finalizeConfiguration ( ) { } } | for ( ConfigItem type : disabledItemsHolder . keys ( ) ) { for ( Class < ? > item : disabledItemsHolder . get ( type ) ) { final DisableSupport info = getOrCreateInfo ( type , item ) ; info . getDisabledBy ( ) . addAll ( disabledByHolder . get ( getType ( item ) ) ) ; } } |
public class VirtualCdj { /** * Tell a device to become tempo master .
* @ param deviceNumber the device we want to take over the role of tempo master
* @ throws IOException if there is a problem sending the command to the device
* @ throws IllegalStateException if the { @ code VirtualCdj } is not active
* @ th... | final DeviceUpdate update = getLatestStatusFor ( deviceNumber ) ; if ( update == null ) { throw new IllegalArgumentException ( "Device " + deviceNumber + " not found on network." ) ; } appointTempoMaster ( update ) ; |
public class ControllerHandler { /** * Specify the Response content - type by . . .
* < ol >
* < li > setting the first Produces content type < / li >
* < li > negotiating with the Request if multiple content - types are specified in Produces < / li >
* < / ol >
* @ param routeContext */
protected void specif... | if ( ! declaredProduces . isEmpty ( ) ) { // Specify first Produces content - type
String defaultContentType = declaredProduces . get ( 0 ) ; routeContext . getResponse ( ) . contentType ( defaultContentType ) ; if ( declaredProduces . size ( ) > 1 ) { // negotiate content - type from Request Accept / Content - Type
ro... |
public class InternalSimpleExpressionsParser { /** * InternalSimpleExpressions . g : 760:1 : entryRuleFQN returns [ String current = null ] : iv _ ruleFQN = ruleFQN EOF ; */
public final String entryRuleFQN ( ) throws RecognitionException { } } | String current = null ; AntlrDatatypeRuleToken iv_ruleFQN = null ; try { // InternalSimpleExpressions . g : 761:2 : ( iv _ ruleFQN = ruleFQN EOF )
// InternalSimpleExpressions . g : 762:2 : iv _ ruleFQN = ruleFQN EOF
{ newCompositeNode ( grammarAccess . getFQNRule ( ) ) ; pushFollow ( FOLLOW_1 ) ; iv_ruleFQN = ruleFQN ... |
public class ServiceUpdater { /** * Add the requested post parameters to the Request .
* @ param request Request to add post params to */
private void addPostParams ( final Request request ) { } } | if ( webhookUrl != null ) { request . addPostParam ( "WebhookUrl" , webhookUrl . toString ( ) ) ; } if ( friendlyName != null ) { request . addPostParam ( "FriendlyName" , friendlyName ) ; } if ( reachabilityWebhooksEnabled != null ) { request . addPostParam ( "ReachabilityWebhooksEnabled" , reachabilityWebhooksEnabled... |
public class LoginUnauthorizedException { public OptionalThing < Redirectable > getMappedRedirectable ( ) { } } | // exists after application exception handling
final Class < ? > exType = getClass ( ) ; return OptionalThing . ofNullable ( mappedRedirectable , ( ) -> { throw new IllegalStateException ( "Not found the mapped redirectable in exception: " + exType ) ; } ) ; |
public class RefreshEvent { /** * sync metric meta from rocks db into mem cache on startup */
private void syncMetaFromCache ( String topology , TopologyMetricContext tmContext ) { } } | if ( ! tmContext . syncMeta ( ) ) { Map < String , Long > meta = context . getMetricCache ( ) . getMeta ( topology ) ; if ( meta != null ) { tmContext . getMemMeta ( ) . putAll ( meta ) ; } tmContext . setSyncMeta ( true ) ; } |
public class UfsInfo { /** * < code > optional . alluxio . grpc . file . MountPOptions properties = 2 ; < / code > */
public alluxio . grpc . MountPOptionsOrBuilder getPropertiesOrBuilder ( ) { } } | return properties_ == null ? alluxio . grpc . MountPOptions . getDefaultInstance ( ) : properties_ ; |
public class JobsImpl { /** * Lists the jobs that have been created under the specified job schedule .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ param serviceFuture the ServiceFuture object tracking the Retrofit calls
* @ param serviceCallback the async ServiceC... | return AzureServiceFuture . fromHeaderPageResponse ( listFromJobScheduleNextSinglePageAsync ( nextPageLink ) , new Func1 < String , Observable < ServiceResponseWithHeaders < Page < CloudJob > , JobListFromJobScheduleHeaders > > > ( ) { @ Override public Observable < ServiceResponseWithHeaders < Page < CloudJob > , JobL... |
public class UllmannState { /** * Refines the compatibility removing any mappings which have now become
* invalid ( since the last mapping ) . The matrix is refined from the row
* after the current { @ code row } - all previous rows are fixed . If when
* refined we find a query vertex has no more candidates left ... | int marking = - ( row + 1 ) ; boolean changed ; do { changed = false ; // for every feasible mapping verify if it is still valid
for ( int n = row + 1 ; n < matrix . nRows ; n ++ ) { for ( int m = 0 ; m < matrix . mCols ; m ++ ) { if ( matrix . get ( n , m ) && ! verify ( n , m ) ) { // remove the now invalid mapping
m... |
public class RulePrunerFactory { /** * Updating the coverage ranges .
* @ param range the global range array .
* @ param grammar The grammar ( i . e . set of rules ) used for this update .
* @ return an updated array . */
public static boolean [ ] updateRanges ( boolean [ ] range , GrammarRules grammar ) { } } | boolean [ ] res = Arrays . copyOf ( range , range . length ) ; for ( GrammarRuleRecord r : grammar ) { if ( 0 == r . getRuleNumber ( ) ) { continue ; } res = updateRanges ( res , r . getRuleIntervals ( ) ) ; } return res ; |
public class BaseSimulator { /** * Stops the simulator . */
@ Override public void stop ( ) { } } | try { logger . info ( "\n###stopping..." ) ; connection . close ( ) ; this . isRunning = false ; logger . info ( "\n#" + getSimulatorName ( ) + "\nstopped." ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } |
public class AbstractTrimDirectiveModel { /** * Parse string parameter .
* @ param params the params
* @ param paramName the param name
* @ return the string */
@ SuppressWarnings ( "rawtypes" ) protected String parseStringParameter ( Map params , String paramName ) { } } | Object paramModel = params . get ( paramName ) ; if ( paramModel == null ) { return null ; } if ( ! ( paramModel instanceof SimpleScalar ) ) { throw new IllegalArgumentException ( paramName + " must be string" ) ; } return ( ( SimpleScalar ) paramModel ) . getAsString ( ) ; |
public class Expressive { /** * Report whether a polled sample of the variable is { @ code true } . */
public boolean the ( Sampler < Boolean > variable , Ticker ticker ) { } } | return the ( variable , ticker , isQuietlyTrue ( ) ) ; |
public class AbstrCFMLScriptTransformer { /** * Liest ein einzelnes Statement ein ( if , for , while usw . ) . < br / >
* EBNF : < br / >
* < code > " ; " | " if " spaces " ( " ifStatement | " function " funcStatement | " while " spaces " ( " whileStatement |
* " do " spaces " { " doStatement | " for " spaces " (... | statement ( data , parent , data . context ) ; |
public class EventEngineImpl { /** * Process the service configuration looking for properties that
* fit the format < code > stage . < i > stage name < / i > . topics < / code > and
* that point to a list of topics to associate with the stage .
* @ param config
* the service configuration properties */
protecte... | for ( Map . Entry < String , Object > entry : config . entrySet ( ) ) { if ( entry . getKey ( ) . startsWith ( CFG_KEY_STAGE_PREFIX ) ) { String [ ] topics ; Object o = entry . getValue ( ) ; if ( o instanceof String [ ] ) { topics = ( String [ ] ) o ; } else if ( o instanceof String ) { topics = new String [ ] { ( Str... |
public class Clock { /** * Sets the current minute of the clock
* @ param MINUTE */
public void setMinute ( final int MINUTE ) { } } | minute = MINUTE % 60 ; calculateAngles ( hour , minute , second ) ; repaint ( getInnerBounds ( ) ) ; |
public class FlexibleLOF { /** * Get the kNN queries for the algorithm .
* @ param relation the data
* @ param stepprog the progress logger
* @ return the kNN queries for the algorithm */
private Pair < KNNQuery < O > , KNNQuery < O > > getKNNQueries ( Database database , Relation < O > relation , StepProgress st... | DistanceQuery < O > distQ = database . getDistanceQuery ( relation , reachabilityDistanceFunction , DatabaseQuery . HINT_HEAVY_USE ) ; // " HEAVY " flag for knnReach since it is used more than once
KNNQuery < O > knnReach = database . getKNNQuery ( distQ , kreach , DatabaseQuery . HINT_HEAVY_USE , DatabaseQuery . HINT_... |
public class ProcessEventCommand { /** * Create a ballModel instance .
* @ param event the create event */
private void createBallModel ( final JRebirthEvent event ) { } } | switch ( event . eventType ( ) ) { case CREATE_APPLICATION : case CREATE_NOTIFIER : case CREATE_GLOBAL_FACADE : case CREATE_COMMAND_FACADE : case CREATE_SERVICE_FACADE : case CREATE_UI_FACADE : case CREATE_COMMAND : case CREATE_SERVICE : case CREATE_MODEL : case CREATE_VIEW : case CREATE_CONTROLLER : // final BallModel... |
public class JawnServletContext { /** * Returns an instance of < code > java . util . Map < / code > containing parameter names as keys and parameter values as map values .
* The keys in the parameter map are of type String . The values in the parameter map are of type String array .
* MTD : re - mapped the return ... | // MTD : deleted class SimpleHash as its only contribution was an unnecessary # toString ( )
// - for the curious , it wrote : { first : [ more ] , of : [ it ] } as opposed to standard : { first = [ more ] , of = [ it ] }
// # getParameterMap ( ) is by default unmodifiable , so we need to re - map it
Map < String , Str... |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcSectionedSpine ( ) { } } | if ( ifcSectionedSpineEClass == null ) { ifcSectionedSpineEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 590 ) ; } return ifcSectionedSpineEClass ; |
public class BackupsInner { /** * Triggers backup for specified backed up item . This is an asynchronous operation . To know the status of the operation , call GetProtectedItemOperationResult API .
* @ param vaultName The name of the recovery services vault .
* @ param resourceGroupName The name of the resource gro... | triggerWithServiceResponseAsync ( vaultName , resourceGroupName , fabricName , containerName , protectedItemName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class DateParser { /** * Parses a Date out of a string using an array of masks .
* It uses the masks in order until one of them succedes or all fail .
* @ param masks array of masks to use for parsing the string
* @ param sDate string to parse for a date .
* @ return the Date represented by the given str... | if ( sDate != null ) { sDate = sDate . trim ( ) ; } ParsePosition pp = null ; Date d = null ; for ( int i = 0 ; d == null && i < masks . length ; i ++ ) { final DateFormat df = new SimpleDateFormat ( masks [ i ] , locale ) ; // df . setLenient ( false ) ;
df . setLenient ( true ) ; try { pp = new ParsePosition ( 0 ) ; ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.