signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Record { /** * Write this record and re - read if ( if it has been modified ) .
* @ return the bookmark . */
public Object writeAndRefresh ( boolean bRefreshDataIfNoMods ) throws DBException { } } | if ( ! this . isModified ( ) ) { if ( ( this . getEditMode ( ) == DBConstants . EDIT_IN_PROGRESS ) || ( this . getEditMode ( ) == DBConstants . EDIT_CURRENT ) ) { boolean bLocked = ( this . getEditMode ( ) == DBConstants . EDIT_IN_PROGRESS ) ; Object bookmark = this . getHandle ( DBConstants . BOOKMARK_HANDLE ) ; if ( ... |
public class Bugsnag { /** * Set the endpoint to deliver Bugsnag errors report to . This is a convenient
* shorthand for bugsnag . getDelivery ( ) . setEndpoint ( ) ;
* @ param endpoint the endpoint to send reports to
* @ see # setDelivery
* @ deprecated use { @ link Configuration # setEndpoints ( String , Stri... | if ( config . delivery instanceof HttpDelivery ) { ( ( HttpDelivery ) config . delivery ) . setEndpoint ( endpoint ) ; } |
public class PeerJournalStream { /** * write the contents of a journal message . */
@ Override public void write ( byte [ ] buffer , int offset , int length ) { } } | try { OutputStream os = _os ; if ( os != null ) { os . write ( buffer , offset , length ) ; } } catch ( Exception e ) { log . log ( Level . FINER , e . toString ( ) , e ) ; } |
public class TypeChecker { /** * Creates a recursing type checker for a { @ link java . util . Map } .
* @ param keyChecker The typechecker to check the keys with
* @ param valueChecker The typechecker to check the values with
* @ return a typechecker for a Map containing keys and values passing the specified typ... | return new MapTypeChecker < > ( Map . class , keyChecker , valueChecker ) ; |
public class ItemsUnion { /** * Serialize this union to a byte array . Result is an ItemsSketch , serialized in an
* unordered , non - compact form . The resulting byte [ ] can be passed to getInstance for either a
* sketch or union .
* @ param serDe an instance of ArrayOfItemsSerDe
* @ return byte array of thi... | if ( gadget_ == null ) { final ItemsSketch < T > sketch = ItemsSketch . getInstance ( maxK_ , comparator_ ) ; return sketch . toByteArray ( serDe ) ; } return gadget_ . toByteArray ( serDe ) ; |
public class DiscordianDate { /** * Obtains the current { @ code DiscordianDate } from the specified clock .
* This will query the specified clock to obtain the current date - today .
* Using this method allows the use of an alternate clock for testing .
* The alternate clock may be introduced using { @ linkplain... | LocalDate now = LocalDate . now ( clock ) ; return DiscordianDate . ofEpochDay ( now . toEpochDay ( ) ) ; |
public class AsyncHbaseSchemaService { /** * Check if we can perform a faster scan . We can only perform a faster scan when we are trying to discover scopes or metrics
* without having information on any other fields . */
private boolean _canSkipWhileScanning ( MetricSchemaRecordQuery query , RecordType type ) { } } | if ( ( RecordType . METRIC . equals ( type ) || RecordType . SCOPE . equals ( type ) ) && ! SchemaService . containsFilter ( query . getTagKey ( ) ) && ! SchemaService . containsFilter ( query . getTagValue ( ) ) && ! SchemaService . containsFilter ( query . getNamespace ( ) ) ) { if ( RecordType . METRIC . equals ( ty... |
public class Sha1 { /** * Reset athen initialize the digest context .
* Overrides the protected abstract method of
* < code > java . security . MessageDigestSpi < / code > . */
protected void engineReset ( ) { } } | int i = 60 ; do { pad [ i ] = ( byte ) 0x00 ; pad [ i + 1 ] = ( byte ) 0x00 ; pad [ i + 2 ] = ( byte ) 0x00 ; pad [ i + 3 ] = ( byte ) 0x00 ; } while ( ( i -= 4 ) >= 0 ) ; padding = 0 ; bytes = 0 ; init ( ) ; |
public class DefaultQueryAction { /** * Add from and size to the ES query based on the ' LIMIT ' clause
* @ param from
* starts from document at position from
* @ param size
* number of documents to return . */
private void setLimit ( int from , int size ) { } } | request . setFrom ( from ) ; if ( size > - 1 ) { request . setSize ( size ) ; } |
public class CommerceAccountUserRelPersistenceImpl { /** * Returns a range of all the commerce account user rels where commerceAccountId = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primar... | return findByCommerceAccountId ( commerceAccountId , start , end , null ) ; |
public class ArgP { /** * Returns a usage string . */
public String usage ( ) { } } | final StringBuilder buf = new StringBuilder ( 16 * options . size ( ) ) ; addUsageTo ( buf ) ; return buf . toString ( ) ; |
public class DisplayUtil { /** * Returns the width of the device ' s display .
* @ param context
* The context , which should be used , as an instance of the class { @ link Context } . The
* context may not be null
* @ return The width of the device ' s display in pixels as an { @ link Integer } value */
public... | Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; return context . getResources ( ) . getDisplayMetrics ( ) . widthPixels ; |
public class SeimiCrawlerBootstrapListener { /** * Handle an application event .
* @ param event the event to respond to */
@ Override public void onApplicationEvent ( ContextRefreshedEvent event ) { } } | ApplicationContext context = event . getApplicationContext ( ) ; if ( isSpringBoot ) { CrawlerProperties crawlerProperties = context . getBean ( CrawlerProperties . class ) ; if ( ! crawlerProperties . isEnabled ( ) ) { logger . warn ( "{} is not enabled" , Constants . SEIMI_CRAWLER_BOOTSTRAP_ENABLED ) ; return ; } } i... |
public class CPDImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . CPD__CP_DESC : setCPDesc ( CP_DESC_EDEFAULT ) ; return ; case AfplibPackage . CPD__GCGID_LEN : setGCGIDLen ( GCGID_LEN_EDEFAULT ) ; return ; case AfplibPackage . CPD__NUM_CD_PTS : setNumCdPts ( NUM_CD_PTS_EDEFAULT ) ; return ; case AfplibPackage . CPD__GCSGID : setGCSGID ( GC... |
public class JavaUtils { /** * Converts a JVM external name to a JVM signature name . An external name is
* that which is returned from { @ link Class # getName ( ) } A signature name is
* the name in class file format .
* For example :
* [ java . lang . Object
* becomes :
* [ Ljava / lang / Object ;
* @ ... | if ( externalName == null ) return null ; String ret = primitiveNameDescriptors . get ( externalName ) ; if ( ret != null ) return ret ; ret = externalName . replace ( '.' , '/' ) ; return ( ret . charAt ( 0 ) == '[' ) ? ret : "L" + ret + ";" ; |
public class WSManUtils { /** * Checks if a string is a valid UUID or not .
* @ param string The UUID value .
* @ return true if input is a valid UUID or false if input is empty or an invalid UUID format . */
public static boolean isUUID ( String string ) { } } | try { if ( string != null ) { UUID . fromString ( string ) ; return true ; } else { return false ; } } catch ( IllegalArgumentException ex ) { return false ; } |
public class X509CertImpl { /** * Return an enumeration of names of attributes existing within this
* attribute . */
public Enumeration < String > getElements ( ) { } } | AttributeNameEnumeration elements = new AttributeNameEnumeration ( ) ; elements . addElement ( NAME + DOT + INFO ) ; elements . addElement ( NAME + DOT + ALG_ID ) ; elements . addElement ( NAME + DOT + SIGNATURE ) ; elements . addElement ( NAME + DOT + SIGNED_CERT ) ; return elements . elements ( ) ; |
public class BoundingBox { /** * Transform the bounding box using the provided projection transform
* @ param transform
* projection transform
* @ return transformed bounding box
* @ since 3.0.0 */
public BoundingBox transform ( ProjectionTransform transform ) { } } | BoundingBox transformed = this ; if ( transform . isSameProjection ( ) ) { transformed = new BoundingBox ( transformed ) ; } else { if ( transform . getFromProjection ( ) . isUnit ( Units . DEGREES ) ) { transformed = TileBoundingBoxUtils . boundDegreesBoundingBoxWithWebMercatorLimits ( transformed ) ; } GeometryEnvelo... |
public class ExtendedByteBuf { /** * Reads optional range of bytes . Negative lengths are translated to None , 0 length represents empty Array */
public static Optional < byte [ ] > readOptRangedBytes ( ByteBuf bf ) { } } | int length = SignedNumeric . decode ( readUnsignedInt ( bf ) ) ; return length < 0 ? Optional . empty ( ) : Optional . of ( readRangedBytes ( bf , length ) ) ; |
public class ReviewsImpl { /** * Use this method to add frames for a video review . Timescale : This parameter is a factor which is used to convert the timestamp on a frame into milliseconds . Timescale is provided in the output of the Content Moderator video media processor on the Azure Media Services platform . Times... | return addVideoFrameUrlWithServiceResponseAsync ( teamName , reviewId , contentType , videoFrameBody , addVideoFrameUrlOptionalParameter ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class DiskCacheSizeInfo { /** * Call this method to reset the disk cache size info after disk clear */
public synchronized void reset ( ) { } } | final String methodName = "reset()" ; this . currentDataGB = 1 ; if ( this . currentDependencyIdGB > 0 ) { this . currentDependencyIdGB = 1 ; } if ( this . currentTemplateGB > 0 ) { this . currentTemplateGB = 1 ; } if ( this . diskCacheSizeInGBLimit > 0 ) { this . diskCacheSizeInBytesLimit = ( diskCacheSizeInGBLimit - ... |
public class RecoveryMgr { /** * Rolls back the transaction . The method iterates through the log records ,
* calling { @ link LogRecord # undo ( Transaction ) } for each log record it finds
* for the transaction , until it finds the transaction ' s START record . */
void rollback ( Transaction tx ) { } } | ReversibleIterator < LogRecord > iter = new LogRecordIterator ( ) ; LogSeqNum txUnDoNextLSN = null ; while ( iter . hasNext ( ) ) { LogRecord rec = iter . next ( ) ; if ( rec . txNumber ( ) == txNum ) { if ( txUnDoNextLSN != null ) { if ( txUnDoNextLSN . compareTo ( rec . getLSN ( ) ) != 1 ) continue ; } if ( rec . op ... |
public class Person { /** * Reset a person . Meaning ti will be removed from all Caches .
* @ param _ key for the Person to be cleaned from Cache . UUID or Name .
* @ throws EFapsException the e faps exception */
public static void reset ( final String _key ) throws EFapsException { } } | final Person person ; if ( UUIDUtil . isUUID ( _key ) ) { person = Person . get ( UUID . fromString ( _key ) ) ; } else { person = Person . get ( _key ) ; } if ( person != null ) { InfinispanCache . get ( ) . < Long , Person > getCache ( Person . IDCACHE ) . remove ( person . getId ( ) ) ; InfinispanCache . get ( ) . <... |
public class GreedyEnsembleExperiment { /** * Build a single - element " ensemble " .
* @ param ensemble
* @ param vec */
protected void singleEnsemble ( final double [ ] ensemble , final NumberVector vec ) { } } | double [ ] buf = new double [ 1 ] ; for ( int i = 0 ; i < ensemble . length ; i ++ ) { buf [ 0 ] = vec . doubleValue ( i ) ; ensemble [ i ] = voting . combine ( buf , 1 ) ; if ( Double . isNaN ( ensemble [ i ] ) ) { LOG . warning ( "NaN after combining: " + FormatUtil . format ( buf ) + " " + voting . toString ( ) ) ; ... |
public class PendingWriteQueue { /** * Add the given { @ code msg } and { @ link ChannelPromise } . */
public void add ( Object msg , ChannelPromise promise ) { } } | assert ctx . executor ( ) . inEventLoop ( ) ; if ( msg == null ) { throw new NullPointerException ( "msg" ) ; } if ( promise == null ) { throw new NullPointerException ( "promise" ) ; } // It is possible for writes to be triggered from removeAndFailAll ( ) . To preserve ordering ,
// we should add them to the queue and... |
public class JobManagerRunner { public void start ( ) throws Exception { } } | try { leaderElectionService . start ( this ) ; } catch ( Exception e ) { log . error ( "Could not start the JobManager because the leader election service did not start." , e ) ; throw new Exception ( "Could not start the leader election service." , e ) ; } |
public class PoolStatisticsImpl { /** * { @ inheritDoc } */
public void clear ( ) { } } | this . createdCount . set ( 0 ) ; this . destroyedCount . set ( 0 ) ; this . maxCreationTime . set ( Long . MIN_VALUE ) ; this . maxGetTime . set ( Long . MIN_VALUE ) ; this . maxPoolTime . set ( Long . MIN_VALUE ) ; this . maxUsageTime . set ( Long . MIN_VALUE ) ; this . maxUsedCount . set ( Integer . MIN_VALUE ) ; th... |
public class WebSockets { /** * Sends a complete ping message , invoking the callback when complete
* @ param data The data to send
* @ param wsChannel The web socket channel
* @ param callback The callback to invoke on completion */
public static void sendPing ( final ByteBuffer [ ] data , final WebSocketChannel... | sendInternal ( mergeBuffers ( data ) , WebSocketFrameType . PING , wsChannel , callback , null , - 1 ) ; |
public class CreateLayerRequest { /** * An array of < code > Package < / code > objects that describes the layer packages .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setPackages ( java . util . Collection ) } or { @ link # withPackages ( java . util . C... | if ( this . packages == null ) { setPackages ( new com . amazonaws . internal . SdkInternalList < String > ( packages . length ) ) ; } for ( String ele : packages ) { this . packages . add ( ele ) ; } return this ; |
public class IntervalExtensions { /** * Checks if the given time range is between the given time range to check
* @ param timeRange
* the time range
* @ param timeRangeToCheck
* the time range to check
* @ return true , if the given time range is between the given time range to check otherwise
* false */
pu... | return ( ( timeRange . getStart ( ) != null && timeRange . getStart ( ) . isBefore ( timeRangeToCheck . getStart ( ) ) ) && ( timeRange . getEnd ( ) != null && timeRange . getEnd ( ) . isAfter ( timeRangeToCheck . getEnd ( ) ) ) ) ; |
public class Statement { /** * Creates a code chunk that assigns and prints jsDoc above the assignment . */
public static Statement assign ( Expression lhs , Expression rhs , JsDoc jsDoc ) { } } | return Assignment . create ( lhs , rhs , jsDoc ) ; |
public class AbstractRouter { /** * Parse the hash and divides it into shellCreator , route and parameters
* @ param route ths hash to parse
* @ return parse result
* @ throws com . github . nalukit . nalu . client . internal . route . RouterException in case no controller is found for the routing */
public Route... | RouteResult routeResult = new RouteResult ( ) ; String routeValue = route ; // only the part after the first # is intresting :
if ( routeValue . contains ( "#" ) ) { routeValue = routeValue . substring ( routeValue . indexOf ( "#" ) + 1 ) ; } // extract shellCreator first :
if ( routeValue . startsWith ( "/" ) ) { rout... |
public class StreamValueData { /** * { @ inheritDoc } */
@ Override public InputStream getAsStream ( ) throws IOException { } } | if ( isByteArrayAfterSpool ( ) ) { return new ByteArrayInputStream ( data ) ; // from bytes
} else { if ( spoolFile != null ) { return PrivilegedFileHelper . fileInputStream ( spoolFile ) ; // from spool file
} else { throw new IllegalArgumentException ( "Stream already consumed" ) ; } } |
public class GuidedDTDRLPersistence { /** * ActionSetField and ActionUpdateField need to be grouped in this manner . */
private LabelledAction findByLabelledAction ( List < LabelledAction > actions , String boundName , boolean isUpdate ) { } } | for ( LabelledAction labelledAction : actions ) { IAction action = labelledAction . action ; if ( action instanceof ActionFieldList ) { if ( labelledAction . boundName . equals ( boundName ) && labelledAction . isUpdate == isUpdate ) { return labelledAction ; } } } return null ; |
public class Distributions { /** * Creates an { @ code Distribution } with { @ code ExponentialBuckets } .
* @ param numFiniteBuckets initializes the number of finite buckets
* @ param growthFactor initializes the growth factor
* @ param scale initializes the scale
* @ return a { @ code Distribution } with { @ ... | if ( numFiniteBuckets <= 0 ) { throw new IllegalArgumentException ( MSG_BAD_NUM_FINITE_BUCKETS ) ; } if ( growthFactor <= 1.0 ) { throw new IllegalArgumentException ( String . format ( MSG_DOUBLE_TOO_LOW , "growth factor" , 1.0 ) ) ; } if ( scale <= 0.0 ) { throw new IllegalArgumentException ( String . format ( MSG_DOU... |
public class tmglobal_tmtrafficpolicy_binding { /** * Use this API to fetch a tmglobal _ tmtrafficpolicy _ binding resources . */
public static tmglobal_tmtrafficpolicy_binding [ ] get ( nitro_service service ) throws Exception { } } | tmglobal_tmtrafficpolicy_binding obj = new tmglobal_tmtrafficpolicy_binding ( ) ; tmglobal_tmtrafficpolicy_binding response [ ] = ( tmglobal_tmtrafficpolicy_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class ArcaBroadcastManager { private static void addToReceivers ( final BroadcastReceiver receiver , final String action ) { } } | Set < String > actions = RECEIVERS . get ( receiver ) ; if ( actions == null ) { actions = new HashSet < String > ( 1 ) ; RECEIVERS . put ( receiver , actions ) ; } actions . add ( action ) ; |
public class DeleteHlsTaskRunner { /** * Wait for the distribution to be disabled
* Note that this can take up to 15 min */
private void waitForDisabled ( String distId ) { } } | long maxTime = 1800000 ; // 30 min
long start = System . currentTimeMillis ( ) ; boolean deployed = isDeployed ( distId ) ; while ( ! deployed ) { if ( System . currentTimeMillis ( ) < start + maxTime ) { sleep ( 10000 ) ; deployed = isDeployed ( distId ) ; } else { String error = "Timeout Reached waiting for distribut... |
public class StringGroovyMethods { /** * Overloads the left shift operator to provide an easy way to append multiple
* objects as string representations to a String .
* @ param self a String
* @ param value an Object
* @ return a StringBuffer built from this string
* @ since 1.0 */
public static StringBuffer ... | return new StringBuffer ( self ) . append ( value ) ; |
public class ElasticsearchClusterRunner { /** * Wait for green state of a cluster .
* @ param indices indices to check status
* @ return cluster health status */
public ClusterHealthStatus ensureGreen ( final String ... indices ) { } } | final ClusterHealthResponse actionGet = client ( ) . admin ( ) . cluster ( ) . health ( Requests . clusterHealthRequest ( indices ) . waitForGreenStatus ( ) . waitForEvents ( Priority . LANGUID ) . waitForNoRelocatingShards ( true ) ) . actionGet ( ) ; if ( actionGet . isTimedOut ( ) ) { onFailure ( "ensureGreen timed ... |
public class CacheServletWrapper40 { /** * { @ inheritDoc } */
@ Override public void handleRequest ( ServletRequest req , ServletResponse res ) throws Exception { } } | String methodName = "handleRequest" ; // set the MappingMatch here as when the CacheServletWrapper is being used we will not go
// through the path of URIMatcher .
// reqData . setMappingMatch ( this . mapping . getMappingMatch ( ) ) ;
WebAppDispatcherContext40 dispatchContext = ( WebAppDispatcherContext40 ) ( ( SRTSer... |
public class Console { /** * Formats and logs a message . If we are running in HostedMode the log message will be reported
* to its console . If we ' re running in Firefox , the log message will be sent to Firebug if it
* is enabled . */
public static void log ( String message , Object ... args ) { } } | StringBuilder sb = new StringBuilder ( ) ; sb . append ( message ) ; if ( args . length > 1 ) { sb . append ( " [" ) ; for ( int ii = 0 , ll = args . length / 2 ; ii < ll ; ii ++ ) { if ( ii > 0 ) { sb . append ( ", " ) ; } sb . append ( args [ 2 * ii ] ) . append ( "=" ) . append ( args [ 2 * ii + 1 ] ) ; } sb . appen... |
public class ApiTokenClient { /** * Retrieves all user scenarios .
* @ return list of { @ link com . loadimpact . resource . UserScenario } */
public List < UserScenario > getUserScenarios ( ) { } } | return invoke ( USER_SCENARIOS , new RequestClosure < JsonArray > ( ) { @ Override public JsonArray call ( Invocation . Builder request ) { return request . get ( JsonArray . class ) ; } } , new ResponseClosure < JsonArray , List < UserScenario > > ( ) { @ Override public List < UserScenario > call ( JsonArray json ) {... |
public class CalendarCodeGenerator { /** * Generates the date - time classes into the given output directory . */
public Map < LocaleID , ClassName > generate ( Path outputDir , DataReader reader ) throws IOException { } } | Map < LocaleID , ClassName > dateClasses = new TreeMap < > ( ) ; List < DateTimeData > dateTimeDataList = new ArrayList < > ( ) ; for ( Map . Entry < LocaleID , DateTimeData > entry : reader . calendars ( ) . entrySet ( ) ) { DateTimeData dateTimeData = entry . getValue ( ) ; LocaleID localeId = entry . getKey ( ) ; St... |
public class CheckBoxFormComponentInterceptor { /** * Returns the keys used to fetch the extra text from the
* < code > MessageSource < / code > .
* The keys returned are
* < code > & lt ; formModelId & gt ; . & lt ; propertyName & gt ; . & lt ; textKey & gt ; , & lt ; propertyName & gt ; . & lt ; textKey & gt ; ... | return new String [ ] { getFormModel ( ) . getId ( ) + "." + propertyName + "." + textKey , propertyName + "." + textKey , textKey } ; |
public class WhiteboxImpl { /** * Set the value of a field using reflection . Use this method when you need
* to specify in which class the field is declared . This is useful if you
* have two fields in a class hierarchy that has the same name but you like
* to modify the latter .
* @ param object the object to... | if ( object == null || fieldName == null || fieldName . equals ( "" ) || fieldName . startsWith ( " " ) ) { throw new IllegalArgumentException ( "object, field name, and \"where\" must not be empty or null." ) ; } final Field field = getField ( fieldName , where ) ; try { field . set ( object , value ) ; } catch ( Exce... |
public class ListHsmsResult { /** * The list of ARNs that identify the HSMs .
* @ return The list of ARNs that identify the HSMs . */
public java . util . List < String > getHsmList ( ) { } } | if ( hsmList == null ) { hsmList = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return hsmList ; |
public class PeerManager { /** * Invokes the supplied function on < em > all < / em > node objects ( except the local node ) . A caller
* that needs to call an invocation service method on a remote node should use this mechanism
* to locate the appropriate node ( or nodes ) and call the desired method .
* @ retur... | int invoked = 0 ; for ( PeerNode peer : _peers . values ( ) ) { if ( peer . nodeobj != null ) { if ( func . apply ( Tuple . newTuple ( peer . getClient ( ) , peer . nodeobj ) ) ) { invoked ++ ; } } } return invoked ; |
public class DateUtilExtensions { /** * < p > Return a string representation of the time portion of this date
* according to the locale - specific { @ link java . text . DateFormat # MEDIUM } default format .
* For an " en _ UK " system locale , this would be < code > HH : MM : ss < / code > .
* < p > Note that a... | return DateFormat . getTimeInstance ( DateFormat . MEDIUM ) . format ( self ) ; |
public class DimensionGroup { /** * A list of specific dimensions from a dimension group . If this parameter is not present , then it signifies that
* all of the dimensions in the group were requested , or are present in the response .
* Valid values for elements in the < code > Dimensions < / code > array are :
... | if ( dimensions == null ) { this . dimensions = null ; return ; } this . dimensions = new java . util . ArrayList < String > ( dimensions ) ; |
public class Ports { /** * Returns a free port in the defined range , returns null if none is available . */
public static Integer findFree ( int lowIncluse , int highInclusive ) { } } | int low = Math . max ( 1 , Math . min ( lowIncluse , highInclusive ) ) ; int high = Math . min ( 65535 , Math . max ( lowIncluse , highInclusive ) ) ; Integer result = null ; int split = RandomUtils . nextInt ( low , high + 1 ) ; for ( int port = split ; port <= high ; port ++ ) { if ( isFree ( port ) ) { result = port... |
public class Mail { /** * sets a mail param
* @ param type
* @ param file
* @ param name
* @ param value
* @ param contentID
* @ param disposition
* @ throws PageException */
public void setParam ( String type , String file , String fileName , String name , String value , String disposition , String conte... | if ( file != null ) { boolean removeAfterSend = ( oRemoveAfterSend == null ) ? remove : oRemoveAfterSend . booleanValue ( ) ; setMimeattach ( file , fileName , type , disposition , contentID , removeAfterSend ) ; } else { if ( name . equalsIgnoreCase ( "bcc" ) ) setBcc ( value ) ; else if ( name . equalsIgnoreCase ( "c... |
public class Targeting { /** * Sets the mobileApplicationTargeting value for this Targeting .
* @ param mobileApplicationTargeting * Specifies targeting against mobile applications . */
public void setMobileApplicationTargeting ( com . google . api . ads . admanager . axis . v201811 . MobileApplicationTargeting mobil... | this . mobileApplicationTargeting = mobileApplicationTargeting ; |
public class MigrateToExtensionSettings { /** * Gets the set of feed item IDs from the function if it is of the form :
* < code > IN ( FEED _ ITEM _ ID , { xxx , xxx } ) < / code > . Otherwise , returns an empty set . */
private static Set < Long > getFeedItemIdsFromArgument ( Function function ) { } } | if ( function . getLhsOperand ( ) . length == 1 && function . getLhsOperand ( 0 ) instanceof RequestContextOperand ) { RequestContextOperand requestContextOperand = ( RequestContextOperand ) function . getLhsOperand ( 0 ) ; if ( RequestContextOperandContextType . FEED_ITEM_ID . equals ( requestContextOperand . getConte... |
public class EditManager { /** * Create and append an edit directive to the edit set if not there . */
private static void addDirective ( Element plfNode , String attributeName , String type , IPerson person ) throws PortalException { } } | Document plf = ( Document ) person . getAttribute ( Constants . PLF ) ; Element editSet = getEditSet ( plfNode , plf , person , true ) ; // see if attributes has already been marked as being edited
Element child = ( Element ) editSet . getFirstChild ( ) ; Element edit = null ; while ( child != null && edit == null ) { ... |
public class TransportTermsByQueryAction { /** * The operation that executes the query and generates a { @ link TermsByQueryShardResponse } for each shard . */
@ Override protected TermsByQueryShardResponse shardOperation ( TermsByQueryShardRequest shardRequest ) throws ElasticsearchException { } } | IndexService indexService = indicesService . indexServiceSafe ( shardRequest . shardId ( ) . getIndex ( ) ) ; IndexShard indexShard = indexService . shardSafe ( shardRequest . shardId ( ) . id ( ) ) ; TermsByQueryRequest request = shardRequest . request ( ) ; OrderByShardOperation orderByOperation = OrderByShardOperati... |
public class ContentSpecProcessor { /** * Does a validation pass before processing any data .
* @ param processorData The data to be used during processing .
* @ return True if the content spec is valid , otherwise false . */
protected boolean doValidationPass ( final ProcessorData processorData ) { } } | // Validate the content specification before doing any rest calls
if ( ! doFirstValidationPass ( processorData ) ) { return false ; } // Check if the app should be shutdown
if ( isShuttingDown . get ( ) ) { shutdown . set ( true ) ; return false ; } // Validate the content specification bug links before doing the post ... |
public class ObjectFactory { /** * Create an instance of { @ link Document . Projects . Project . Task . ResourceAssignments } */
public Document . Projects . Project . Task . ResourceAssignments createDocumentProjectsProjectTaskResourceAssignments ( ) { } } | return new Document . Projects . Project . Task . ResourceAssignments ( ) ; |
public class RabbitMqQueueFactory { /** * Setter for { @ link # defaultConnectionFactory } .
* @ param connectionFactory
* @ return
* @ since 0.7.1 */
public RabbitMqQueueFactory < T , ID , DATA > setDefaultConnectionFactory ( ConnectionFactory connectionFactory ) { } } | return setDefaultConnectionFactory ( connectionFactory , false ) ; |
public class TimeField { /** * Parses the given string into a corresponding time . The string must
* follow the standard format used by time fields , as defined by
* FORMAT and as would be produced by format ( ) .
* @ param timeString
* The time string to parse , which may be null .
* @ return
* The time co... | // Return null if no time provided
if ( timeString == null || timeString . isEmpty ( ) ) return null ; // Parse time according to format
DateFormat timeFormat = new SimpleDateFormat ( TimeField . FORMAT ) ; return timeFormat . parse ( timeString ) ; |
public class AmazonGameLiftClient { /** * Updates game session properties . This includes the session name , maximum player count , protection policy , which
* controls whether or not an active game session can be terminated during a scale - down event , and the player
* session creation policy , which controls whe... | request = beforeClientExecution ( request ) ; return executeUpdateGameSession ( request ) ; |
public class VimGenerator2 { /** * Generate the Vim numeric constants .
* @ param it the receiver of the generated elements . */
protected void generateNumericConstants ( IStyleAppendable it ) { } } | appendComment ( it , "numerical constants" ) ; // $ NON - NLS - 1 $
appendMatch ( it , "sarlNumber" , "[0-9][0-9]*\\.[0-9]\\+([eE][0-9]\\+)\\?[fFdD]\\?" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
appendMatch ( it , "sarlNumber" , "0[xX][0-9a-fA-F]\\+" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
appendMatch ( it ... |
public class RealRxPermission { /** * Map emitted items from the source observable into { @ link Permission } objects for each
* permission in parameters .
* If one or several permissions have never been requested , invoke the related framework method
* to ask the user if he allows the permissions . */
@ NonNull ... | checkPermissions ( permissions ) ; return new ObservableTransformer < T , Permission > ( ) { @ Override @ NonNull @ CheckReturnValue public ObservableSource < Permission > apply ( final Observable < T > o ) { return request ( o , permissions ) ; } } ; |
public class EVCacheLatchImpl { /** * ( non - Javadoc )
* @ see
* com . netflix . evcache . operation . EVCacheLatchI # addFuture ( net . spy . memcached . internal . ListenableFuture ) */
public void addFuture ( ListenableFuture < Boolean , OperationCompletionListener > future ) { } } | future . addListener ( this ) ; if ( future . isDone ( ) ) countDown ( ) ; this . futures . add ( future ) ; |
public class CodecCollector { /** * Compute termvector number full .
* @ param docSet
* the doc set
* @ param termDocId
* the term doc id
* @ param termsEnum
* the terms enum
* @ param lrc
* the lrc
* @ param postingsEnum
* the postings enum
* @ param positionsData
* the positions data
* @ ret... | TermvectorNumberFull result = new TermvectorNumberFull ( docSet . size ( ) ) ; Iterator < Integer > docIterator = docSet . iterator ( ) ; int localTermDocId = termDocId ; postingsEnum = termsEnum . postings ( postingsEnum , PostingsEnum . FREQS ) ; while ( docIterator . hasNext ( ) ) { int docId = docIterator . next ( ... |
public class CommerceTaxMethodLocalServiceWrapper { /** * Returns the commerce tax method with the primary key .
* @ param commerceTaxMethodId the primary key of the commerce tax method
* @ return the commerce tax method
* @ throws PortalException if a commerce tax method with the primary key could not be found *... | return _commerceTaxMethodLocalService . getCommerceTaxMethod ( commerceTaxMethodId ) ; |
public class DrlParser { /** * This will expand the DRL using the given expander resolver . useful for
* debugging .
* @ param source -
* the source which use a DSL
* @ param resolver -
* the DSL expander resolver itself .
* @ throws DroolsParserException
* If unable to expand in any way . */
public Strin... | final Expander expander = resolver . get ( "*" , null ) ; final String expanded = expander . expand ( source ) ; if ( expander . hasErrors ( ) ) { String err = "" ; for ( ExpanderException ex : expander . getErrors ( ) ) { err = err + "\n Line:[" + ex . getLine ( ) + "] " + ex . getMessage ( ) ; } throw new DroolsParse... |
public class DisqueClient { /** * Create a new client that connects to the supplied uri with default { @ link ClientResources } . You can connect to different
* Redis servers but you must supply a { @ link RedisURI } on connecting .
* @ param uri the Redis URI , must not be { @ literal null }
* @ return a new ins... | LettuceAssert . notNull ( uri , "uri must not be null" ) ; return new DisqueClient ( null , DisqueURI . create ( uri ) ) ; |
public class TRMFacade { /** * Method chooseLink
* @ param linkUuid
* @ return
* @ throws SIResourceException */
public LinkSelection chooseLink ( SIBUuid12 linkUuid ) throws SIResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "chooseLink" , new Object [ ] { linkUuid } ) ; LinkSelection s = null ; // Pick an ME to send the message to .
try { s = _linkManager . select ( linkUuid ) ; } catch ( LinkException e ) { // Error during create of the link .... |
public class CDKMCSHandler { /** * { @ inheritDoc }
* @ param shouldMatchBonds */
@ Override public void searchMCS ( boolean shouldMatchBonds ) { } } | CDKRMapHandler rmap = new CDKRMapHandler ( ) ; try { if ( ( source . getAtomCount ( ) == target . getAtomCount ( ) ) && source . getBondCount ( ) == target . getBondCount ( ) ) { rOnPFlag = true ; rmap . calculateOverlapsAndReduceExactMatch ( source , target , shouldMatchBonds ) ; } else if ( source . getAtomCount ( ) ... |
public class PersistentUserManagedEhcache { /** * { @ inheritDoc } */
@ Override public V replace ( K key , V value ) throws CacheLoadingException , CacheWritingException { } } | return cache . replace ( key , value ) ; |
public class BigtableInstanceAdminClient { /** * Asynchronously lists all app profiles of the specified instance .
* < p > Sample code :
* < pre > { @ code
* ApiFuture < List < AppProfile > > appProfilesFuture = client . listAppProfilesAsync ( " my - instance " ) ;
* List < AppProfile > appProfiles = appProfile... | String instanceName = NameUtil . formatInstanceName ( projectId , instanceId ) ; ListAppProfilesRequest request = ListAppProfilesRequest . newBuilder ( ) . setParent ( instanceName ) . build ( ) ; // TODO ( igorbernstein2 ) : try to upstream pagination spooling or figure out a way to expose the
// paginated responses w... |
public class LikeRule { /** * Deserialize the state of the object .
* @ param in object input stream
* @ throws IOException if IOException during deserialization
* @ throws ClassNotFoundException if class not found . */
private void readObject ( final java . io . ObjectInputStream in ) throws IOException , ClassN... | try { field = ( String ) in . readObject ( ) ; String patternString = ( String ) in . readObject ( ) ; pattern = Pattern . compile ( patternString , Pattern . CASE_INSENSITIVE ) ; } catch ( PatternSyntaxException e ) { throw new IOException ( "Invalid LIKE rule - " + e . getMessage ( ) ) ; } |
public class CollectionHelper { /** * Returns the first item in the given collection */
public static < T > T first ( Iterable < T > objects ) { } } | if ( objects != null ) { for ( T object : objects ) { return object ; } } return null ; |
public class SecurityServiceImpl { /** * Retrieve the AuthenticationService for the specified id .
* @ param id AuthenticationService id to retrieve
* @ return A non - null AuthenticationService instance . */
private AuthenticationService getAuthenticationService ( String id ) { } } | AuthenticationService service = authentication . getService ( id ) ; if ( service == null ) { throwIllegalArgumentExceptionInvalidAttributeValue ( SecurityConfiguration . CFG_KEY_AUTHENTICATION_REF , id ) ; } return service ; |
public class StreamSummaryContainer { /** * Adds the lock information about the key , namely if the key suffer some contention and if the keys was locked or
* not .
* @ param contention { @ code true } if the key was contented .
* @ param failLock { @ code true } if the key was not locked . */
public void addLock... | if ( ! isEnabled ( ) ) { return ; } syncOffer ( Stat . MOST_LOCKED_KEYS , key ) ; if ( contention ) { syncOffer ( Stat . MOST_CONTENDED_KEYS , key ) ; } if ( failLock ) { syncOffer ( Stat . MOST_FAILED_KEYS , key ) ; } |
public class AppContextJdon { /** * ApplicationContextAware ' s method
* at first run , startup Jdon Framework * */
public void setApplicationContext ( ApplicationContext applicationContext ) throws BeansException { } } | this . applicationContext = applicationContext ; if ( servletContext == null ) if ( applicationContext instanceof WebApplicationContext ) { servletContext = ( ( WebApplicationContext ) applicationContext ) . getServletContext ( ) ; if ( servletContext == null ) { System . err . print ( "this class only fit for Spring W... |
public class LoggingFilter { /** * { @ inheritDoc } */
@ Override public void filter ( final ClientRequestContext context ) throws IOException { } } | final long id = _id . incrementAndGet ( ) ; context . setProperty ( LOGGING_ID_PROPERTY , id ) ; final StringBuilder b = new StringBuilder ( ) ; printRequestLine ( b , "Sending client request" , id , context . getMethod ( ) , context . getUri ( ) ) ; printPrefixedHeaders ( b , id , REQUEST_PREFIX , context . getStringH... |
public class CmsDriverManager { /** * Changes the " expire " date of a resource . < p >
* @ param dbc the current database context
* @ param resource the resource to touch
* @ param dateExpired the new expire date of the resource
* @ throws CmsDataAccessException if something goes wrong
* @ see CmsObject # se... | resource . setDateExpired ( dateExpired ) ; if ( resource . getState ( ) . isUnchanged ( ) ) { resource . setState ( CmsResource . STATE_CHANGED ) ; } getVfsDriver ( dbc ) . writeResourceState ( dbc , dbc . currentProject ( ) , resource , UPDATE_STRUCTURE , false ) ; // modify the last modified project reference
getVfs... |
public class JarConfigurationProvider { /** * Return a list of all relation entity classes filtered by relationship
* type .
* @ param relType
* @ return classes */
private List < Class < ? extends RelationshipInterface > > getRelationClassCandidatesForRelType ( final String relType ) { } } | List < Class < ? extends RelationshipInterface > > candidates = new ArrayList ( ) ; for ( final Class < ? extends RelationshipInterface > candidate : getRelationshipEntities ( ) . values ( ) ) { Relation rel = instantiate ( candidate ) ; if ( rel == null ) { continue ; } if ( rel . name ( ) . equals ( relType ) ) { can... |
public class SyncRemoteTable { /** * Move the current position and read the record ( optionally read several records ) .
* @ param iRelPosition relative Position to read the next record .
* @ param iRecordCount Records to read .
* @ return If I read 1 record , this is the record ' s data .
* @ return If I read ... | synchronized ( m_objSync ) { return m_tableRemote . doMove ( iRelPosition , iRecordCount ) ; } |
public class AmazonElasticTranscoderClient { /** * The CreatePreset operation creates a preset with settings that you specify .
* < important >
* Elastic Transcoder checks the CreatePreset settings to ensure that they meet Elastic Transcoder requirements and
* to determine whether they comply with H . 264 standar... | request = beforeClientExecution ( request ) ; return executeCreatePreset ( request ) ; |
public class DebuggerReader { /** * This first prints out the current breakpoint source location before calling the superclass ' run method . The
* synchronization prevents more than one debugging session on the console .
* @ return the exit status */
public ExitStatus run ( ) { } } | synchronized ( DebuggerReader . class ) // Only one console !
{ println ( "Stopped " + breakpoint ) ; println ( interpreter . getSourceLine ( breakpoint . location ) ) ; try { interpreter . setDefaultName ( breakpoint . location . getModule ( ) ) ; } catch ( Exception e ) { throw new InternalException ( 52 , "Cannot se... |
public class JFeatureSpec { /** * Java wrapper for { @ link FeatureSpec # cross ( Tuple2 , Function2 ) } */
public JFeatureSpec < T > cross ( final String x1 , final String x2 , final BiFunction < Double , Double , Double > f ) { } } | Function2 < Object , Object , Object > g = JavaOps . crossFn ( f ) ; return wrap ( self . cross ( Tuple2 . apply ( x1 , x2 ) , g ) ) ; |
public class CheckSumUtils { /** * Returns the MD5 Checksum of the string passed in parameter
* @ param str
* the string content
* @ return the Checksum of the input stream
* @ throws IOException
* if an IO exception occurs */
public static String getMD5Checksum ( String str ) throws IOException { } } | InputStream is = new ByteArrayInputStream ( str . getBytes ( ) ) ; return getMD5Checksum ( is ) ; |
public class BitSet { /** * Sets all bits to true within the given range .
* @ param fromIndex The lower bit index .
* @ param toIndex The upper bit index . */
private static void setInternal ( int [ ] array , int fromIndex , int toIndex ) { } } | int first = wordIndex ( fromIndex ) ; int last = wordIndex ( toIndex ) ; maybeGrowArrayToIndex ( array , last ) ; int startBit = bitOffset ( fromIndex ) ; int endBit = bitOffset ( toIndex ) ; if ( first == last ) { // Set the bits in between first and last .
maskInWord ( array , first , startBit , endBit ) ; } else { /... |
public class ConnectionManagerImpl { /** * Execute batch ( if the batch mode where used ) . */
public void executeBatch ( ) throws OJBBatchUpdateException { } } | if ( batchCon != null ) { try { batchCon . executeBatch ( ) ; } catch ( Throwable th ) { throw new OJBBatchUpdateException ( th ) ; } } |
public class JDBCClobClient { /** * Retrieves a copy of the specified substring in the < code > CLOB < / code >
* value designated by this < code > Clob < / code > object .
* @ param pos the first character of the substring to be extracted . The
* first character is at position 1.
* @ param length the number of... | if ( ! isInLimits ( Long . MAX_VALUE , pos - 1 , length ) ) { throw Util . outOfRangeArgument ( ) ; } try { return clob . getSubString ( session , pos - 1 , length ) ; } catch ( HsqlException e ) { throw Util . sqlException ( e ) ; } |
public class OrientationHistogramSift { /** * Compute the angle . The angle for each neighbor bin is found using the weighted sum
* of the derivative . Then the peak index is found by 2nd order polygon interpolation . These two bits of
* information are combined and used to return the final angle output .
* @ par... | int index0 = CircularIndex . addOffset ( index1 , - 1 , histogramMag . length ) ; int index2 = CircularIndex . addOffset ( index1 , 1 , histogramMag . length ) ; // compute the peak location using a second order polygon
double v0 = histogramMag [ index0 ] ; double v1 = histogramMag [ index1 ] ; double v2 = histogramMag... |
public class TapClient { /** * Gets the next tap message from the queue of received tap messages .
* @ param time the amount of time to wait for a message .
* @ param timeunit the unit of time to use .
* @ return The tap message at the head of the queue or null if the queue is
* empty for the given amount of ti... | try { Object m = rqueue . poll ( time , timeunit ) ; if ( m == null ) { return null ; } else if ( m instanceof ResponseMessage ) { return ( ResponseMessage ) m ; } else if ( m instanceof TapAck ) { TapAck ack = ( TapAck ) m ; tapAck ( ack . getConn ( ) , ack . getNode ( ) , ack . getOpcode ( ) , ack . getOpaque ( ) , a... |
public class BitVector { /** * Factory method for creating a < tt > BitVector < / tt > instance
* wrapping the given byte data .
* @ param data a byte [ ] containing packed bits .
* @ param size Size to set the bit vector to
* @ return the newly created < tt > BitVector < / tt > instance . */
public static BitV... | BitVector bv = new BitVector ( data . length * 8 ) ; bv . setBytes ( data ) ; bv . size = size ; return bv ; |
public class RuleProviderRegistry { /** * Gets the current instance of { @ link RuleProviderRegistry } . */
public static RuleProviderRegistry instance ( GraphRewrite event ) { } } | RuleProviderRegistry instance = ( RuleProviderRegistry ) event . getRewriteContext ( ) . get ( RuleProviderRegistry . class ) ; return instance ; |
public class CommerceShippingFixedOptionLocalServiceUtil { /** * Creates a new commerce shipping fixed option with the primary key . Does not add the commerce shipping fixed option to the database .
* @ param commerceShippingFixedOptionId the primary key for the new commerce shipping fixed option
* @ return the new... | return getService ( ) . createCommerceShippingFixedOption ( commerceShippingFixedOptionId ) ; |
public class CodepointHelper { /** * Verifies a sequence of codepoints using the specified profile
* @ param sStr
* String
* @ param eProfile
* profile to use */
public static void verify ( @ Nullable final String sStr , @ Nonnull final ECodepointProfile eProfile ) { } } | if ( sStr != null ) verify ( new CodepointIteratorCharSequence ( sStr ) , eProfile ) ; |
public class TextAdapterActivity { /** * Typically you should not override this method . ConnectionPoolAdapter
* does override this with internal MDW logic .
* @ param errorCode
* @ throws ActivityException */
protected void handleConnectionException ( int errorCode , Throwable originalCause ) throws ActivityExce... | InternalEvent message = InternalEvent . createActivityStartMessage ( getActivityId ( ) , getProcessInstanceId ( ) , getWorkTransitionInstanceId ( ) , getMasterRequestId ( ) , COMPCODE_AUTO_RETRY ) ; ScheduledEventQueue eventQueue = ScheduledEventQueue . getSingleton ( ) ; int retry_interval = this . getRetryInterval ( ... |
public class WordDataWriter { /** * / * ( non - Javadoc )
* @ see jvntextpro . data . DataWriter # writeFile ( java . util . List , java . lang . String ) */
@ Override public void writeFile ( List lblSeqs , String filename ) { } } | String ret = writeString ( lblSeqs ) ; try { BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( filename ) , "UTF-8" ) ) ; out . write ( ret ) ; out . close ( ) ; } catch ( Exception e ) { } |
public class SecurityUtil { /** * Encrypt a string using SHA
* @ param plaintext the original text
* @ return resultant hash */
public synchronized String encrypt ( String plaintext ) { } } | MessageDigest md = null ; try { md = MessageDigest . getInstance ( "SHA" ) ; md . update ( plaintext . getBytes ( UTF8 ) ) ; } catch ( Exception e ) { LOG . log ( Level . SEVERE , "Should not happen!" , e ) ; } byte raw [ ] = md . digest ( ) ; return encode ( raw ) ; |
public class TopLevelDocumentToApiModelVisitor { /** * Recurse into the child documents converting and adding to the list .
* Several document types require special processing because they have
* split lists .
* @ param document the current document */
protected void addSplitAttributes ( final GedDocument < ? > d... | for ( final GedDocument < ? extends GedObject > attribute : document . getAttributes ( ) ) { final DocumentToApiModelVisitor v = createVisitor ( ) ; attribute . accept ( v ) ; ( ( ApiHasImages ) baseObject ) . addAttribute ( convertToAttribute ( v . getBaseObject ( ) ) ) ; } |
public class Encoder { /** * Append length info . On success , store the result in " bits " . */
static void appendLengthInfo ( int numLetters , Version version , Mode mode , BitArray bits ) throws WriterException { } } | int numBits = mode . getCharacterCountBits ( version ) ; if ( numLetters >= ( 1 << numBits ) ) { throw new WriterException ( numLetters + " is bigger than " + ( ( 1 << numBits ) - 1 ) ) ; } bits . appendBits ( numLetters , numBits ) ; |
public class Ranges { /** * Returns the value normalized within the range . It performs a linear
* transformation where the minimum value of the range becomes 0 while
* the maximum becomes 1.
* @ param range a range
* @ param value a value
* @ return the value transformed based on the range */
public static d... | return normalize ( value , range . getMinimum ( ) . doubleValue ( ) , range . getMaximum ( ) . doubleValue ( ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.