signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ZooKeeperMasterModel { /** * redundantDeployment determines whether or not rollingUpdateUndeploy should actually emit
* RollingUpdateOps to undeploy a job .
* < p > Jobs are undeployed in two cases :
* < p > 1 . During a rolling update
* 2 . When a host leaves a deployment group
* < p > In case 1... | // This deployment was not created by this deployment group .
if ( ! Objects . equals ( deployment . getDeploymentGroupName ( ) , deploymentGroup . getName ( ) ) ) { return false ; } // This deployment is not of the deployment group ' s job .
if ( ! deployment . getJobId ( ) . equals ( deploymentGroup . getJobId ( ) ) ... |
public class GpfdistServer { /** * Start a server .
* @ return the http server
* @ throws Exception the exception */
public synchronized HttpServer < Buffer , Buffer > start ( ) throws Exception { } } | if ( server == null ) { server = createProtocolListener ( ) ; } return server ; |
public class FeatureSupportsInner { /** * It will validate if given feature with resource properties is supported in service .
* @ param azureRegion Azure region to hit Api
* @ param parameters Feature support request object
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return... | if ( azureRegion == null ) { throw new IllegalArgumentException ( "Parameter azureRegion is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( parameters == null ... |
public class RequestWrapper { /** * @ Override
* public < X > void body ( BodyReader < X > reader , Result < X > result )
* delegate ( ) . body ( reader , result ) ; */
@ Override public < X > void body ( Class < X > type , Result < X > result ) { } } | delegate ( ) . body ( type , result ) ; |
public class CUstream_flags { /** * Returns the String identifying the given CUstream _ flags
* @ param n The CUstream _ flags
* @ return The String identifying the given CUstream _ flags */
public static String stringFor ( int n ) { } } | if ( n == 0 ) { return "CU_STREAM_DEFAULT" ; } String result = "" ; if ( ( n & CU_STREAM_NON_BLOCKING ) != 0 ) result += "CU_STREAM_NON_BLOCKING " ; return result ; |
public class PoolEnableAutoScaleOptions { /** * Set a timestamp indicating the last modified time of the resource known to the client . The operation will be performed only if the resource on the service has not been modified since the specified time .
* @ param ifUnmodifiedSince the ifUnmodifiedSince value to set
... | if ( ifUnmodifiedSince == null ) { this . ifUnmodifiedSince = null ; } else { this . ifUnmodifiedSince = new DateTimeRfc1123 ( ifUnmodifiedSince ) ; } return this ; |
public class WDataTable { /** * Determine the row ids for the provided index range .
* @ param startIndex the startIndex
* @ param endIndex the endIndex
* @ return the list of rowIds for the provided index range */
private List < Integer > getRowIds ( final int startIndex , final int endIndex ) { } } | // If the table is sorted , we may require a mapping for table row index < - - > data model index .
int [ ] rowIndexMapping = getComponentModel ( ) . rowIndexMapping ; // Check if sort mapping needs updating
if ( isSorted ( ) && rowIndexMapping != null && rowIndexMapping . length != getDataModel ( ) . getRowCount ( ) )... |
public class JMXJsonServlet { /** * Renders MBean attributes to jg .
* The queries parameter allows selection of a subset of mbeans .
* @ param jg
* JsonGenerator that will be written to
* @ param mBeanNames
* Optional list of mbean names to render . If null , every
* mbean will be returned .
* @ return i... | jg . writeStartObject ( ) ; Set < ObjectName > nameQueries , queriedObjects ; nameQueries = new HashSet < ObjectName > ( ) ; queriedObjects = new HashSet < ObjectName > ( ) ; // if no mbean names provided , add one null entry to query everything
if ( mBeanNames == null ) { nameQueries . add ( null ) ; } else { for ( St... |
public class ReflectionHelper { /** * Gets the default value as String for the primitive types .
* @ param type the primitive type
* @ return the default value as String */
public static String getPrimitiveDefault ( Class type ) { } } | if ( type == Boolean . class ) { return "false" ; } if ( type == Character . class ) { return Character . toString ( ( char ) 0 ) ; } return "0" ; |
public class LocaleUtils { /** * Returns a list of languages and countries of the { @ code Locale } s ( as { @ code String } , for example " en _ GB " ) , of default
* language and available translations .
* The list is sorted by language / country codes with default locale , always , at first position .
* @ retu... | List < String > locales = readAvailableLocales ( ) ; Collections . sort ( locales ) ; // Always put English at the top
locales . add ( 0 , DEFAULT_LOCALE ) ; return locales ; |
public class PeerGroup { /** * Starts the PeerGroup and begins network activity .
* @ return A future that completes when first connection activity has been triggered ( note : not first connection made ) . */
public ListenableFuture startAsync ( ) { } } | // This is run in a background thread by the Service implementation .
if ( chain == null ) { // Just try to help catch what might be a programming error .
log . warn ( "Starting up with no attached block chain. Did you forget to pass one to the constructor?" ) ; } checkState ( ! vUsedUp , "Cannot start a peer group twi... |
public class RootVisitor { /** * Visit the Root . From here we will look through the top level objects for
* Persons .
* @ see GedObjectVisitor # visit ( Root ) */
@ Override public void visit ( final Root root ) { } } | final Map < String , GedObject > objectMap = root . getObjects ( ) ; final Collection < GedObject > objects = objectMap . values ( ) ; for ( final GedObject gob : objects ) { gob . accept ( this ) ; } |
public class ClassPathResource { /** * 根据给定资源初始化URL */
private void initUrl ( ) { } } | if ( null != this . clazz ) { super . url = this . clazz . getResource ( this . path ) ; } else if ( null != this . classLoader ) { super . url = this . classLoader . getResource ( this . path ) ; } else { super . url = ClassLoader . getSystemResource ( this . path ) ; } if ( null == super . url ) { throw new NoResourc... |
public class KeyGroupedMutableObjectIterator { /** * Moves the iterator to the next key . This method may skip any values that have not yet been returned by the
* iterator created by the { @ link # getValues ( ) } method . Hence , if called multiple times it " removes " pairs .
* @ return true if the input iterator... | // first element
if ( this . next == null ) { this . next = this . serializer . createInstance ( ) ; if ( ( this . next = this . iterator . next ( this . next ) ) != null ) { this . comparator . setReference ( this . next ) ; this . nextIsFresh = false ; this . valuesIterator = new ValuesIterator ( ) ; this . valuesIte... |
public class FSNamesystem { /** * Allocate a number of parity blocks
* Require a write lock
* @ param numParityBlocks */
private Block [ ] allocateParityBlocks ( int numParityBlocks ) throws IOException { } } | Block [ ] blocks = new Block [ numParityBlocks ] ; for ( int i = 0 ; i < numParityBlocks ; i ++ ) { Block b = new Block ( generateBlockId ( ) , 0 , 0 ) ; while ( isValidBlock ( b ) ) { b . setBlockId ( generateBlockId ( ) ) ; } b . setGenerationStamp ( getGenerationStamp ( ) ) ; blocks [ i ] = b ; } return blocks ; |
public class MongoDbDeviceRegistry { /** * API operations */
@ Override public Device get ( String deviceId ) { } } | DBCursor devices = devicesCollection ( ) . find ( new BasicDBObject ( ImmutableMap . of ( "deviceId" , deviceId ) ) ) ; if ( devices . hasNext ( ) ) { return dbObjectToDevice ( devices . next ( ) ) ; } return null ; |
public class RecordBuffer { /** * Claim a record in the buffer . Each record has a unique key .
* @ param key the key to claim the record with .
* @ return the offset at which record was claimed or { @ code DID _ NOT _ CLAIM _ RECORD } if the claim failed .
* @ see RecordBuffer # commit ( int ) */
public int clai... | int offset = endOfPositionField ; while ( offset < position ( ) ) { if ( key == key ( offset ) ) { // If someone else is writing something with the same key then abort
if ( statusVolatile ( offset ) == PENDING ) { return DID_NOT_CLAIM_RECORD ; } else // state = = COMMITTED
{ compareAndSetStatus ( offset , COMMITTED , P... |
public class DocumentRoot { /** * Returns the absolute document root when it points to a valid directory , logging a
* warning and returning { @ code null } otherwise .
* @ return the valid document root */
public final File getValidDirectory ( ) { } } | File file = this . directory ; file = ( file != null ) ? file : getWarFileDocumentRoot ( ) ; file = ( file != null ) ? file : getExplodedWarFileDocumentRoot ( ) ; file = ( file != null ) ? file : getCommonDocumentRoot ( ) ; if ( file == null && this . logger . isDebugEnabled ( ) ) { logNoDocumentRoots ( ) ; } else if (... |
public class StreamUtils { /** * Copy a stream .
* @ param src the source input stream
* @ param dest the destination output stream
* @ param closeStreams TRUE if the streams should be closed on completion
* @ throws IOException if an IO error occurs
* @ throws NullArgumentException if either the src or dest ... | copyStream ( null , null , 0 , src , dest , closeStreams ) ; |
public class StandardAlgConfigPanel { /** * Searches inside the children of " root " for ' target ' . If found it is removed and the
* previous component . */
protected static void removeChildAndPrevious ( JComponent root , JComponent target ) { } } | int N = root . getComponentCount ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( root . getComponent ( i ) == target ) { root . remove ( i ) ; root . remove ( i - 1 ) ; return ; } } throw new RuntimeException ( "Can't find component" ) ; |
public class Taint { /** * Returns the merge of the facts such that it can represent any of them
* @ param a first state to merge
* @ param b second state to merge
* @ return constructed merge of the specified facts */
public static Taint merge ( Taint a , Taint b ) { } } | if ( a == null ) { if ( b == null ) { return null ; } else { return new Taint ( b ) ; } } else if ( b == null ) { return new Taint ( a ) ; } assert a != null && b != null ; Taint result = new Taint ( State . merge ( a . getState ( ) , b . getState ( ) ) ) ; if ( a . variableIndex == b . variableIndex ) { result . varia... |
public class DatabaseDAODefaultImpl { public DbDevImportInfo import_device ( Database database , String deviceName ) throws DevFailed { } } | DevVarLongStringArray info ; // ALWAYS Authorized ( e . g . import TAC itself )
int tmp_access = database . access ; database . access = TangoConst . ACCESS_WRITE ; try { DeviceData argIn = new DeviceData ( ) ; argIn . insert ( deviceName ) ; // System . out . println ( " DbImportDevice " + deviceName ) ;
DeviceData ar... |
public class RegexHashMap { /** * returns the keysets of both the container and cache hashmaps */
public Set < String > keySet ( ) { } } | // prepare container
HashSet < String > set = new HashSet < String > ( ) ; // add container keys
set . addAll ( container . keySet ( ) ) ; // add cache keys
set . addAll ( cache . keySet ( ) ) ; return set ; |
public class Expression { /** * Returns this Expression ' s IType . */
public IType getType ( ) { } } | IType type = getTypeImpl ( ) ; if ( TypeSystem . isDeleted ( type ) ) { type = TypeSystem . getErrorType ( ) ; } return type ; |
public class ChangesHolder { /** * Serialize the value into the given { @ link ObjectOutput }
* @ param out the stream in which we serialize the value
* @ param field the field from which we extract the value
* @ throws IOException if the value could not be serialized */
private static void writeValue ( ObjectOut... | Object o = field . stringValue ( ) ; if ( o != null ) { // Use writeObject instead of writeUTF because the value could contain unsupported
// characters
out . writeObject ( o ) ; return ; } o = field . tokenStreamValue ( ) ; if ( o != null ) { out . writeObject ( o ) ; return ; } o = field . readerValue ( ) ; throw new... |
public class Asm { /** * Create xmmword ( 16 bytes ) pointer operand
* ! @ note This constructor is provided only for convenience for sse programming . */
public static final Mem xmmword_ptr_abs ( long target , long disp , SEGMENT segmentPrefix ) { } } | return _ptr_build_abs ( target , disp , segmentPrefix , SIZE_DQWORD ) ; |
public class LabelingJobS3DataSourceMarshaller { /** * Marshall the given parameter object . */
public void marshall ( LabelingJobS3DataSource labelingJobS3DataSource , ProtocolMarshaller protocolMarshaller ) { } } | if ( labelingJobS3DataSource == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( labelingJobS3DataSource . getManifestS3Uri ( ) , MANIFESTS3URI_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request t... |
public class CommandLine { /** * < p > getOptionWithShortForm . < / p >
* @ param shortForm a { @ link java . lang . String } object .
* @ return a { @ link com . greenpepper . util . cli . Option } object .
* @ throws com . greenpepper . util . cli . InvalidOptionException if any . */
public Option getOptionWith... | for ( Option option : options ) { if ( shortForm . equals ( option . getShortForm ( ) ) ) return option ; } throw new InvalidOptionException ( shortForm ) ; |
public class JDefaultInternet { /** * generates a random username in the format of Firstname intial + lastname + random 2 digit
* ie tjones67
* @ return */
public static String userName ( ) { } } | return fixNonWord ( StringUtils . left ( JDefaultName . firstName ( ) , 1 ) . toLowerCase ( ) + JDefaultName . lastName ( ) . toLowerCase ( ) + JDefaultNumber . randomNumberString ( 2 ) ) ; |
public class Reference { /** * < p > newInstance . < / p >
* @ param requirement a { @ link com . greenpepper . server . domain . Requirement } object .
* @ param specification a { @ link com . greenpepper . server . domain . Specification } object .
* @ param sut a { @ link com . greenpepper . server . domain . ... | Reference reference = new Reference ( ) ; reference . setSections ( sections ) ; reference . setRequirement ( requirement ) ; reference . setSpecification ( specification ) ; reference . setSystemUnderTest ( sut ) ; requirement . getReferences ( ) . add ( reference ) ; specification . getReferences ( ) . add ( referenc... |
public class VoiceApi { /** * Complete a previously initiated two - step conference identified by the provided IDs . Once completed ,
* the two separate calls are brought together so that all three parties are participating in the same call .
* @ param connId The connection ID of the consult call ( established ) . ... | this . completeConference ( connId , parentConnId , null , null ) ; |
public class HttpUrlConnectionRpcSession { /** * Sets the connection content - type and content - length and sends the post data . */
protected void sendPostData ( final HttpURLConnection connection , final RpcRequest request ) throws IOException { } } | String post = buildParamsQuery ( request . getPost ( ) ) ; byte [ ] data = post . getBytes ( UTF8 ) ; connection . setRequestProperty ( CONTENT_TYPE_HEADER , APPLICATION_X_WWW_FORM_URLENCODED ) ; connection . setRequestProperty ( CONTENT_LENGTH_HEADER , String . valueOf ( data . length ) ) ; OutputStream out = new Buff... |
public class DateUtil { /** * Compares dates < code > d1 < / code > and < code > d2 < / code > taking into
* consideration only the year , month and day
* @ param d1 the first date
* @ param d2 the second date
* @ return < code > true < / code > if < code > d1 < / code > is after < code > d2 < / code > ,
* < ... | d1 = floor ( d1 ) ; Calendar c1 = Calendar . getInstance ( ) ; c1 . setTime ( d1 ) ; d2 = floor ( d2 ) ; Calendar c2 = Calendar . getInstance ( ) ; c2 . setTime ( d2 ) ; return c1 . after ( c2 ) ; |
public class AbstractDisplayer { /** * Get the current filter selected interval indexes for the given data set column .
* @ param columnId The column identifier .
* @ return A list of interval indexes */
public List < Integer > filterIndexes ( String columnId ) { } } | List < Integer > result = new ArrayList < > ( ) ; List < Interval > selected = columnSelectionMap . get ( columnId ) ; if ( selected == null ) { return result ; } for ( Interval interval : selected ) { result . add ( interval . getIndex ( ) ) ; } return result ; |
public class CommerceShipmentItemPersistenceImpl { /** * Returns the last commerce shipment item in the ordered set where commerceShipmentId = & # 63 ; .
* @ param commerceShipmentId the commerce shipment ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @... | int count = countByCommerceShipment ( commerceShipmentId ) ; if ( count == 0 ) { return null ; } List < CommerceShipmentItem > list = findByCommerceShipment ( commerceShipmentId , count - 1 , count , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; |
public class AbstractDirectoryWalker { /** * Method that finds all files that meets some criteria .
* @ return List of files which meets the defined criteria . */
@ Override public List < File > scan ( ) { } } | File baseDirFile = new File ( baseDir ) ; List < File > includedFiles = walkDirectory ( baseDirFile ) ; return includedFiles ; |
public class JTrees { /** * Translates one TreePath to a new TreeModel . This methods assumes
* DefaultMutableTreeNodes , and identifies the path based on the
* equality of user objects using the given equality predicate .
* @ param newTreeModel The new tree model
* @ param oldPath The old tree path
* @ param... | Object newRoot = newTreeModel . getRoot ( ) ; List < Object > newPath = new ArrayList < Object > ( ) ; newPath . add ( newRoot ) ; Object newPreviousElement = newRoot ; for ( int i = 1 ; i < oldPath . getPathCount ( ) ; i ++ ) { Object oldElement = oldPath . getPathComponent ( i ) ; Object oldUserObject = getUserObject... |
public class ChainedInterceptor { /** * { @ inheritDoc } */
public Object processInvocation ( final InterceptorContext context ) throws Exception { } } | final int oldNext = context . getNextInterceptorIndex ( ) ; final Interceptor [ ] old = context . getInterceptors ( ) ; context . setInterceptors ( interceptors ) ; try { return context . proceed ( ) ; } finally { context . setInterceptors ( old , oldNext ) ; } |
public class ValidationUtils { /** * Validates objects .
* @ param content an object to be validated
* @ param app the current app
* @ return a list of error messages or empty if object is valid */
public static String [ ] validateObject ( App app , ParaObject content ) { } } | if ( content == null || app == null ) { return new String [ ] { "Object cannot be null." } ; } try { String type = content . getType ( ) ; boolean isCustomType = ( content instanceof Sysprop ) && ! type . equals ( Utils . type ( Sysprop . class ) ) ; // Validate custom types and user - defined properties
if ( ! app . g... |
public class ZipFileReaper { /** * Reap the pending closes .
* Reaping is performed in two modes : Un - forced , which occurs a set delay after the first
* pending close , and forced , which occurs when shutting down .
* An un - forced reap will see pending closes in several different configurations :
* First ,... | String methodName = "reap" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " At [ " + toRelSec ( initialAt , reapAt ) + " (s) ] Force [ " + isShutdownReap + " ]" ) ; Tr . debug ( tc , methodName + " All [ " + storage . size ( ) + " ]" + " Pending Quick [ " +... |
public class ReportDownloader { /** * Returns a CharSource of report contents with { @ code ReportDownloadOptions } . The ExportFormat
* must be string - based , such as { @ link
* com . google . api . ads . admanager . axis . v201805 . ExportFormat # CSV _ DUMP } .
* @ param options the options to download the r... | Preconditions . checkArgument ( SUPPORTED_CHARSOURCE_EXPORT_FORMATS . contains ( options . getExportFormat ( ) ) , "ExportFormat " + options . getExportFormat ( ) + " cannot be used with CharSource" ) ; ByteSource byteSource = Resources . asByteSource ( getDownloadUrl ( options ) ) ; return ( options . getUseGzipCompre... |
public class ResultSetResult { /** * { @ inheritDoc } */
@ Override public int getInt ( int columnIndex ) { } } | int value ; try { value = resultSet . getInt ( resultIndexToResultSetIndex ( columnIndex ) ) ; } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to get int value for column index: " + columnIndex , e ) ; } return value ; |
public class JDBCUtils { /** * Returns true if the query result has at least one row . */
public static boolean queryHasResult ( Statement stmt , String sql ) { } } | try { ResultSet rs = stmt . executeQuery ( sql ) ; try { return rs . next ( ) ; } finally { rs . close ( ) ; } } catch ( SQLException e ) { throw new DukeException ( e ) ; } |
public class InternalService { /** * Returns observable to create a conversation .
* @ param conversationId ID of a conversation to delete .
* @ param eTag ETag for server to check if local version of the data is the same as the one the server side .
* @ param callback Callback to deliver new session instance . *... | adapter . adapt ( deleteConversation ( conversationId , eTag ) , callback ) ; |
public class NaaccrOptions { /** * Convenience method that computes if a given item needs to be ignored , based on the include / exclude lists .
* @ param naaccrId NAACCR ID
* @ return true if the corresponding item needs to be processed . */
public boolean processItem ( String naaccrId ) { } } | if ( _itemsToInclude != null ) return _itemsToInclude . contains ( naaccrId ) ; else if ( _itemsToExclude != null ) return ! _itemsToExclude . contains ( naaccrId ) ; return true ; |
public class Capabilities { /** * Sauce labs has specific capabilities to manage the selenium version used . The version is obtained from the
* POM ( or could be passed in via CMD to override ) and then set so that Sauce sets the specific selenium version ,
* instead of their default : https : / / wiki . saucelabs ... | if ( Sauce . isSauce ( ) ) { // set the selenium version
desiredCapabilities . setCapability ( "seleniumVersion" , System . getProperty ( "selenium.version" ) ) ; // set the ie driver if needed
if ( desiredCapabilities . getBrowserName ( ) . equals ( "internet explorer" ) ) { desiredCapabilities . setCapability ( "iedr... |
public class JsonTextMessageValidator { /** * Constructs the error message of a failed validation based on the processing report passed from
* com . github . fge . jsonschema . core . report
* @ param report The report containing the error message
* @ return A string representation of all messages contained in th... | StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( "Json validation failed: " ) ; report . forEach ( processingMessage -> stringBuilder . append ( processingMessage . getMessage ( ) ) ) ; return stringBuilder . toString ( ) ; |
public class CPMeasurementUnitLocalServiceUtil { /** * Creates a new cp measurement unit with the primary key . Does not add the cp measurement unit to the database .
* @ param CPMeasurementUnitId the primary key for the new cp measurement unit
* @ return the new cp measurement unit */
public static com . liferay .... | return getService ( ) . createCPMeasurementUnit ( CPMeasurementUnitId ) ; |
public class Statements { /** * Set the statement parameters , starting at the index , in the order of the params .
* @ since 3.0.0 */
public static PreparedStatement setLongs ( int index , PreparedStatement stmt , long ... params ) throws SQLException { } } | return set ( index , stmt , null , params , null ) ; |
public class Capacitor { /** * Ring Functions . Reuse allocated memory */
private ByteBuffer ringGet ( ) { } } | ByteBuffer bb = null ; synchronized ( ring ) { bb = ring [ start ] ; ring [ start ] = null ; if ( bb != null && ++ start > 15 ) start = 0 ; } if ( bb == null ) { bb = ByteBuffer . allocate ( DEFAULT_CHUNK ) ; } else { bb . clear ( ) ; // refresh reused buffer
} return bb ; |
public class QueryParameters { /** * Checks is specified key is OUT parameter .
* OUT and INOUT parameter would be considered as OUT parameter
* @ param key Key
* @ return true - if key is OUT parameter */
public boolean isOutParameter ( String key ) { } } | boolean isOut = false ; if ( this . getDirection ( processKey ( key ) ) == Direction . INOUT || this . getDirection ( processKey ( key ) ) == Direction . OUT ) { isOut = true ; } return isOut ; |
public class MobileDevice { /** * Gets the deviceType value for this MobileDevice .
* @ return deviceType * < span class = " constraint ReadOnly " > This field is read only and
* will be ignored when sent to the API . < / span > */
public com . google . api . ads . adwords . axis . v201809 . cm . MobileDeviceDevice... | return deviceType ; |
public class FuzzyLite { /** * Sets whether the library is set to log information
* @ param logging indicates whether the library is set to log information */
public static void setLogging ( boolean logging ) { } } | if ( logging ) { logger . setLevel ( debugging ? Level . FINE : Level . INFO ) ; } else { logger . setLevel ( Level . OFF ) ; } |
public class Instant { /** * Calculates the amount of time until another instant in terms of the specified unit .
* This calculates the amount of time between two { @ code Instant }
* objects in terms of a single { @ code TemporalUnit } .
* The start and end points are { @ code this } and the specified instant . ... | Instant end = Instant . from ( endExclusive ) ; if ( unit instanceof ChronoUnit ) { ChronoUnit f = ( ChronoUnit ) unit ; switch ( f ) { case NANOS : return nanosUntil ( end ) ; case MICROS : return nanosUntil ( end ) / 1000 ; case MILLIS : return Math . subtractExact ( end . toEpochMilli ( ) , toEpochMilli ( ) ) ; case... |
public class CheckRunManager { /** * Run analysis with feedback
* @ param onStatus Command executed repeatedly receiving status update
* @ param onCompletion Command executed on completion */
public void run ( final StatusUpdate onStatus , final Command onCompletion ) { } } | // Ensure active analysis is cancelled
cancelExistingAnalysis ( ) ; // If there are no checks to run simply return
if ( rechecks . isEmpty ( ) ) { if ( onCompletion != null ) { onCompletion . execute ( ) ; return ; } } checkRunner . run ( rechecks , onStatus , onCompletion ) ; rechecks . clear ( ) ; |
public class N { /** * Mostly it ' s designed for one - step operation to complete the operation in one step .
* < code > java . util . stream . Stream < / code > is preferred for multiple phases operation .
* @ param a
* @ param fromIndex
* @ param toIndex
* @ param func
* @ return */
public static < T , E... | checkFromToIndex ( fromIndex , toIndex , size ( c ) ) ; N . checkArgNotNull ( func ) ; if ( N . isNullOrEmpty ( c ) && fromIndex == 0 && toIndex == 0 ) { return new LongList ( ) ; } final LongList result = new LongList ( toIndex - fromIndex ) ; if ( c instanceof List && c instanceof RandomAccess ) { final List < T > li... |
public class ManagedDatabasesInner { /** * Gets a list of managed databases .
* ServiceResponse < PageImpl < ManagedDatabaseInner > > * @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return th... | if ( nextPageLink == null ) { throw new IllegalArgumentException ( "Parameter nextPageLink is required and cannot be null." ) ; } String nextUrl = String . format ( "%s" , nextPageLink ) ; return service . listByInstanceNext ( nextUrl , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( ne... |
public class CholeskyDecomposition { /** * Computes the determinant of A
* @ return the determinant of A */
public double getDet ( ) { } } | double det = 1 ; for ( int i = 0 ; i < L . rows ( ) ; i ++ ) det *= L . get ( i , i ) ; return det ; |
public class ServicesInner { /** * Start service .
* The services resource is the top - level resource that represents the Data Migration Service . This action starts the service and the service can be used for data migration .
* @ param groupName Name of the resource group
* @ param serviceName Name of the servi... | return ServiceFuture . fromResponse ( beginStartWithServiceResponseAsync ( groupName , serviceName ) , serviceCallback ) ; |
public class Quaterniond { /** * Set this quaternion to be a copy of q .
* @ param q
* the { @ link Quaterniondc } to copy
* @ return this */
public Quaterniond set ( Quaterniondc q ) { } } | x = q . x ( ) ; y = q . y ( ) ; z = q . z ( ) ; w = q . w ( ) ; return this ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIDDUNITBASEToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class CmsAttributeHandler { /** * Return true if there is a single remaining value , which is optional . < p >
* @ return true if this has only one optional value */
public boolean hasSingleOptionalValue ( ) { } } | return ( ( getEntityType ( ) . getAttributeMinOccurrence ( m_attributeName ) == 0 ) && ( m_entity . getAttribute ( m_attributeName ) != null ) && ( m_entity . getAttribute ( m_attributeName ) . getValueCount ( ) == 1 ) ) ; |
public class CmsLoginController { /** * Called on initialization . < p > */
public void onInit ( ) { } } | String authToken = m_params . getAuthToken ( ) ; if ( authToken != null ) { m_ui . showForgotPasswordView ( authToken ) ; } else if ( m_params . isReset ( ) ) { m_ui . showPasswordResetDialog ( ) ; } else { boolean loggedIn = ! A_CmsUI . getCmsObject ( ) . getRequestContext ( ) . getCurrentUser ( ) . isGuestUser ( ) ; ... |
public class CmsImportVersion7 { /** * Rewrites all parseable files , to assure link check . < p >
* This is a global process , that is executed only once at the
* end of the import to be sure that all link targets are
* available . < p >
* @ see # addXmlDigesterRules ( Digester ) */
public void rewriteParseabl... | if ( m_parseables . isEmpty ( ) ) { return ; } I_CmsReport report = getReport ( ) ; CmsObject cms = getCms ( ) ; cms . getRequestContext ( ) . setAttribute ( CmsLogEntry . ATTR_LOG_ENTRY , Boolean . FALSE ) ; report . println ( Messages . get ( ) . container ( Messages . RPT_START_PARSE_LINKS_0 ) , I_CmsReport . FORMAT... |
public class DefaultImageDecoder { /** * Decodes gif into CloseableImage .
* @ param encodedImage input image ( encoded bytes plus meta data )
* @ return a CloseableImage */
public CloseableImage decodeGif ( final EncodedImage encodedImage , final int length , final QualityInfo qualityInfo , final ImageDecodeOption... | if ( ! options . forceStaticImage && mAnimatedGifDecoder != null ) { return mAnimatedGifDecoder . decode ( encodedImage , length , qualityInfo , options ) ; } return decodeStaticImage ( encodedImage , options ) ; |
public class AppDescriptor { /** * Create an ` AppDescriptor ` with appName and entry class specified .
* If ` appName ` is ` null ` or blank , it will try the following
* approach to get app name :
* 1 . check the { @ link Version # getArtifactId ( ) artifact id } and use it unless
* 2 . if artifact id is null... | System . setProperty ( "osgl.version.suppress-var-found-warning" , "true" ) ; return of ( appName , entryClass , Version . of ( entryClass ) ) ; |
public class CmsSite { /** * Returns the site path for the given root path in case the root path
* actually starts with this site root , or < code > null < / code > in case
* the root path does not . < p >
* @ param rootPath the root path to get the site path for
* @ return the site path for the given root path... | String result = null ; if ( CmsStringUtil . isNotEmpty ( rootPath ) ) { if ( rootPath . startsWith ( m_siteRoot ) ) { result = rootPath . substring ( m_siteRoot . length ( ) ) ; } } return result ; |
public class CodepointHelper { /** * Insert a codepoint into the buffer , automatically dealing with surrogate
* pairs
* @ param aSeq
* source sequence
* @ param nIndex
* index
* @ param aCodepoint
* codepoint to be inserted */
public static void insert ( final CharSequence aSeq , final int nIndex , @ Non... | insert ( aSeq , nIndex , aCodepoint . getValue ( ) ) ; |
public class FileOperations { /** * Delete an existing directory if it is existing . The directory needs to be
* empty before it can be deleted .
* @ param aDir
* The directory to be deleted . May not be < code > null < / code > .
* @ return A non - < code > null < / code > error code .
* @ see # deleteDir ( ... | final FileIOError aError = deleteDir ( aDir ) ; if ( aError . getErrorCode ( ) . equals ( EFileIOErrorCode . SOURCE_DOES_NOT_EXIST ) ) return EFileIOErrorCode . NO_ERROR . getAsIOError ( EFileIOOperation . DELETE_DIR , aDir ) ; return aError ; |
public class QueryBuilder { /** * Remove the provided { @ link FeatureCode } from the set of query constraints .
* @ param code1 the first { @ link FeatureCode } to remove
* @ param codes the subsequent { @ link FeatureCode } s to remove
* @ return this */
public QueryBuilder removeFeatureCodes ( final FeatureCod... | featureCodes . remove ( code1 ) ; featureCodes . removeAll ( Arrays . asList ( codes ) ) ; return this ; |
public class ApplicationFeatureViewModel { /** * region > helpers */
< T extends ApplicationFeatureViewModel > List < T > asViewModels ( final SortedSet < ApplicationFeatureId > members ) { } } | final Function < ApplicationFeatureId , T > function = Functions . < T > asViewModelForId ( applicationFeatureRepository , container ) ; return Lists . newArrayList ( Iterables . transform ( members , function ) ) ; |
public class TagletWriterImpl { /** * { @ inheritDoc } */
public Content deprecatedTagOutput ( Doc doc ) { } } | ContentBuilder result = new ContentBuilder ( ) ; Tag [ ] deprs = doc . tags ( "deprecated" ) ; if ( doc instanceof ClassDoc ) { if ( utils . isDeprecated ( ( ProgramElementDoc ) doc ) ) { result . addContent ( HtmlTree . SPAN ( HtmlStyle . deprecatedLabel , new StringContent ( configuration . getText ( "doclet.Deprecat... |
public class PersistenceUtils { /** * Delete children that are no longer contained in list of collection items .
* @ param resource Parent resource
* @ param data List of collection items */
public static void deleteChildrenNotInCollection ( Resource resource , ConfigurationCollectionPersistData data ) { } } | Set < String > collectionItemNames = data . getItems ( ) . stream ( ) . map ( item -> item . getCollectionItemName ( ) ) . collect ( Collectors . toSet ( ) ) ; for ( Resource child : resource . getChildren ( ) ) { if ( ! collectionItemNames . contains ( child . getName ( ) ) && ! StringUtils . equals ( JCR_CONTENT , ch... |
public class JMessageClient { /** * remove members from chat room
* @ param roomId chat room id
* @ param members { @ link Members }
* @ return No content
* @ throws APIConnectionException connect exception
* @ throws APIRequestException request exception */
public ResponseWrapper removeChatRoomMembers ( long... | return _chatRoomClient . removeChatRoomMembers ( roomId , members ) ; |
public class ExecutedTradeHandler { /** * { @ inheritDoc } */
@ Override public void handleChannelData ( final String action , final JSONArray jsonArray ) throws BitfinexClientException { } } | try { final List < BitfinexExecutedTrade > trades = new ArrayList < > ( ) ; if ( action == "tu" ) { return ; // Ignore tu messages ( see issue # 13)
} // Snapshots contain multiple executes entries , updates only one
if ( jsonArray . get ( 0 ) instanceof JSONArray ) { for ( int pos = 0 ; pos < jsonArray . length ( ) ; ... |
public class GoAPIGenerator { /** * Writes the function arguments */
private void writeOutArgs ( List < String > elements , Writer out , boolean hasParams ) throws IOException { } } | if ( elements != null && elements . size ( ) > 0 ) { ArrayList < String > args = new ArrayList < String > ( ) ; for ( String param : elements ) { if ( param . equalsIgnoreCase ( "boolean" ) ) { args . add ( "boolean bool" ) ; } else if ( param . equalsIgnoreCase ( "integer" ) ) { args . add ( "i int" ) ; } else if ( pa... |
public class ColorGenerator { /** * Returns the next random color */
public Color next ( ) { } } | int r = rand . nextInt ( 256 ) ; int g = rand . nextInt ( 256 ) ; int b = rand . nextInt ( 256 ) ; return ( seed == null ) ? new Color ( r , g , b ) : new Color ( ( r + seed . getRed ( ) ) / 2 , ( g + seed . getGreen ( ) ) / 2 , ( b + seed . getBlue ( ) ) / 2 ) ; |
public class TreeBuilder { /** * Convert data content for all resources matching the resource selector and within the sub path
* @ param converter content converter
* @ param subpath sub path
* @ param resourceSelector resource selector
* @ return builder */
public TreeBuilder < T > convert ( ContentConverter <... | return convert ( converter , PathUtil . subpathSelector ( subpath ) , resourceSelector ) ; |
public class MviBasePresenter { /** * Actually subscribes the view as consumer to the internally view relay .
* @ param view The mvp view */
@ MainThread private void subscribeViewStateConsumerActually ( @ NonNull final V view ) { } } | if ( view == null ) { throw new NullPointerException ( "View is null" ) ; } if ( viewStateConsumer == null ) { throw new NullPointerException ( ViewStateConsumer . class . getSimpleName ( ) + " is null. This is a Mosby internal bug. Please file an issue at https://github.com/sockeqwe/mosby/issues" ) ; } viewRelayConsum... |
public class ConfigBuilder { /** * Build the config for a ECO topology definition
* @ param topologyDefinition - ECO topology definition */
public Config buildConfig ( EcoTopologyDefinition topologyDefinition ) throws IllegalArgumentException { } } | Map < String , Object > configMap = topologyDefinition . getConfig ( ) ; Config config = new Config ( ) ; for ( Map . Entry < String , Object > entry : configMap . entrySet ( ) ) { if ( entry . getKey ( ) . equals ( COMPONENT_RESOURCE_MAP ) ) { setComponentLevelResource ( config , entry ) ; } else if ( entry . getKey (... |
public class ControlsView { /** * Change activation of all buttons .
* @ param enable true to enable all buttons false otherwise */
void activateButtons ( final boolean enable ) { } } | this . unloadButton . setDisable ( ! enable ) ; this . playPauseButton . setDisable ( ! enable ) ; this . backwardButton . setDisable ( ! enable ) ; this . forwardButton . setDisable ( ! enable ) ; this . stopButton . setDisable ( ! enable ) ; |
public class TranslationServiceClient { /** * Deletes a glossary , or cancels glossary construction if the glossary isn ' t created yet . Returns
* NOT _ FOUND , if the glossary doesn ' t exist .
* < p > Sample code :
* < pre > < code >
* try ( TranslationServiceClient translationServiceClient = TranslationServ... | return deleteGlossaryOperationCallable ( ) . futureCall ( request ) ; |
public class UserDetail { /** * A list of IAM groups that the user is in .
* @ return A list of IAM groups that the user is in . */
public java . util . List < String > getGroupList ( ) { } } | if ( groupList == null ) { groupList = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return groupList ; |
public class SelfExtractRun { /** * Determine user home based on platform type .
* Java user . home property is correct in all cases except
* for cygwin . For cygwin , user . home is Windows home ,
* so use HOME env var instead .
* @ return user home directory */
private static String getUserHome ( ) { } } | String home ; if ( platformType == SelfExtractUtils . PlatformType_CYGWIN ) { home = System . getenv ( "HOME" ) ; } else { home = System . getProperty ( "user.home" ) ; } return home ; |
public class VictimsRecord { /** * Test if this instance of { @ link VictimsRecord } contains all the file
* hashes present in the given instance . Comparison is done on all available
* algorithms until a subset match is found . If for an algorithm , either
* this or that record is empty , check is skipped .
* ... | if ( ! ( o instanceof VictimsRecord ) ) { return false ; } VictimsRecord that = ( VictimsRecord ) o ; for ( Algorithms algorithm : VictimsConfig . algorithms ( ) ) { if ( ! ( this . containsAlgorithm ( algorithm ) && that . containsAlgorithm ( algorithm ) ) ) { // skip if both this and that do not have the current algo... |
public class BasicAuthenticator { @ Override void authenticate ( Map < String , Object > options ) { } } | final Map < String , Object > auth = new HashMap < > ( ) ; auth . put ( AbstractReplicatorConfiguration . REPLICATOR_AUTH_TYPE , AbstractReplicatorConfiguration . AUTH_TYPE_BASIC ) ; auth . put ( AbstractReplicatorConfiguration . REPLICATOR_AUTH_USER_NAME , username ) ; auth . put ( AbstractReplicatorConfiguration . RE... |
public class JDBC4ResultSet { /** * ResultSet object as a byte array in the Java programming language . */
@ Override public byte [ ] getBytes ( int columnIndex ) throws SQLException { } } | checkColumnBounds ( columnIndex ) ; try { if ( table . getColumnType ( columnIndex - 1 ) == VoltType . STRING ) return table . getStringAsBytes ( columnIndex - 1 ) ; else if ( table . getColumnType ( columnIndex - 1 ) == VoltType . VARBINARY ) return table . getVarbinary ( columnIndex - 1 ) ; else throw SQLError . get ... |
public class PackedLocalDate { /** * Returns the quarter of the year of the given date as an int from 1 to 4 , or - 1 , if the argument is the
* MISSING _ VALUE for DateColumn */
public static int getQuarter ( int packedDate ) { } } | if ( packedDate == DateColumnType . missingValueIndicator ( ) ) { return - 1 ; } Month month = getMonth ( packedDate ) ; switch ( month ) { case JANUARY : case FEBRUARY : case MARCH : return 1 ; case APRIL : case MAY : case JUNE : return 2 ; case JULY : case AUGUST : case SEPTEMBER : return 3 ; case OCTOBER : case NOVE... |
public class Tuple { /** * Returns true if the given binding can be added to the give tuple . */
private static boolean isBindingCompatible ( Tuple tuple , VarBindingDef binding ) { } } | VarValueDef currentValue = tuple . getBinding ( binding . getVarDef ( ) ) ; return ( currentValue == null || currentValue . equals ( binding . getValueDef ( ) ) ) ; |
public class XmlResponsesSaxParser { /** * Parses an AccessControlListHandler response XML document from an input
* stream .
* @ param inputStream
* XML data input stream .
* @ return the XML handler object populated with data parsed from the XML
* stream .
* @ throws SdkClientException */
public AccessCont... | AccessControlListHandler handler = new AccessControlListHandler ( ) ; parseXmlInputStream ( handler , inputStream ) ; return handler ; |
public class HashUtils { /** * Calculate SHA - 256 hash of a File
* @ param file - the File to hash
* @ return the SHA - 256 hash value
* @ throws IOException */
public static String getFileSHA256String ( File file ) throws IOException { } } | MessageDigest messageDigest = getMessageDigest ( SHA256 ) ; return getFileHashString ( file , messageDigest ) ; |
public class VisualContext { /** * Updates this context according to the given style . Moreover given Graphics is updated
* to this style and used for taking the font metrics .
* @ param style the style data to be used
* @ param g Graphics to be updated and used */
public void updateForGraphics ( NodeData style ,... | if ( style != null ) update ( style ) ; updateGraphics ( g ) ; fm = g . getFontMetrics ( ) ; // update the width units
// em has been updated in update ( )
FontRenderContext frc = new FontRenderContext ( null , false , false ) ; TextLayout layout = new TextLayout ( "x" , font , frc ) ; ex = layout . getBounds ( ) . get... |
public class AbstractPropertyWidget { /** * Executes a " widget batch update " . Listeners and other effects of updating
* individual parts of a widget may be turned off during batch updates .
* @ param action
* the action to execute */
public final void batchUpdateWidget ( final Runnable action ) { } } | _batchUpdateCounter ++ ; try { action . run ( ) ; } catch ( final RuntimeException e ) { logger . error ( "Exception occurred in widget batch update, fireValueChanged() will not be invoked" , e ) ; throw e ; } finally { _batchUpdateCounter -- ; } if ( _batchUpdateCounter == 0 ) { onBatchFinished ( ) ; } |
public class CassandraSchemaManager { /** * On set comment .
* @ param cfDef
* the cf def
* @ param cfProperties
* the cf properties
* @ param builder
* the builder */
private void onSetComment ( CfDef cfDef , Properties cfProperties , StringBuilder builder ) { } } | String comment = cfProperties . getProperty ( CassandraConstants . COMMENT ) ; if ( comment != null ) { if ( builder != null ) { String comment_Str = CQLTranslator . getKeyword ( CassandraConstants . COMMENT ) ; builder . append ( comment_Str ) ; builder . append ( CQLTranslator . EQ_CLAUSE ) ; builder . append ( CQLTr... |
public class AbcNode { /** * Returns the value parsed into integer if label is DIGIT or DIGITS , else */
protected int getIntValue ( ) { } } | if ( label . equals ( AbcTokens . DIGIT ) || label . equals ( AbcTokens . DIGITS ) ) { try { return Integer . parseInt ( value ) ; } catch ( NumberFormatException nfe ) { return - 1 ; } } else return - 1 ; |
public class ForwardCurve { /** * Create a forward curve from given times and given forwards .
* @ param name The name of this curve .
* @ param referenceDate The reference date for this code , i . e . , the date which defines t = 0.
* @ param paymentOffsetCode The maturity of the index modeled by this curve .
... | LocalDate referenceDataAsLocalDate = Instant . ofEpochMilli ( referenceDate . getTime ( ) ) . atZone ( ZoneId . systemDefault ( ) ) . toLocalDate ( ) ; return createForwardCurveFromForwards ( name , referenceDataAsLocalDate , paymentOffsetCode , paymentBusinessdayCalendar , paymentDateRollConvention , interpolationMeth... |
public class Balancer { /** * / * wait for all block move confirmations
* by checking each target ' s pendingMove queue */
private void waitForMoveCompletion ( ) { } } | boolean shouldWait ; int waitedIterations = 0 ; do { shouldWait = false ; for ( BalancerDatanode target : plan . targets ) { if ( ! target . isPendingQEmpty ( ) ) { shouldWait = true ; } } if ( shouldWait ) { try { if ( waitedIterations > MAX_WAIT_ITERATIONS ) { for ( BalancerDatanode target : plan . targets ) { target... |
public class VelocityInterceptor { /** * Renders the component using the velocity template which has been provided .
* @ param renderContext the context for rendering . */
@ Override public void paint ( final RenderContext renderContext ) { } } | if ( ! ( renderContext instanceof WebXmlRenderContext ) ) { throw new SystemException ( "Unable to render to " + renderContext ) ; } PrintWriter writer = ( ( WebXmlRenderContext ) renderContext ) . getWriter ( ) ; Template template = null ; try { template = VelocityEngineFactory . getVelocityEngine ( ) . getTemplate ( ... |
public class RequestMessage { /** * @ see javax . . HttpServletRequest # getRequestURI ( ) */
@ Override public String getRequestURI ( ) { } } | if ( null == this . strippedURI ) { this . strippedURI = SessionInfo . stripURL ( this . request . getURI ( ) , this . sessionData ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "getRequestURI: " + this . strippedURI ) ; } return this . strippedURI ; |
public class ComponentUtils { /** * Duplicate code from OmniFacew project under apache license :
* https : / / github . com / omnifaces / omnifaces / blob / develop / license . txt
* URI - encode the given string using UTF - 8 . URIs ( paths and filenames ) have different encoding rules as compared to
* URL query... | if ( string == null ) { return null ; } return URLEncoder . encode ( string , "UTF-8" ) . replace ( "+" , "%20" ) . replace ( "%21" , "!" ) . replace ( "%27" , "'" ) . replace ( "%28" , "(" ) . replace ( "%29" , ")" ) . replace ( "%7E" , "~" ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.