signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class FragmentManager { /** * This method reports diagnostic information to the log . */
public void diagnostics ( ) { } } | log . finest ( "Thread count = " + threadCounter ) ; if ( threadCounter . get ( ) > 0 ) { log . finest ( "Thread names:" ) ; synchronized ( threadNames ) { for ( String name : threadNames ) { log . finest ( "\t" + name ) ; } } } |
public class ParseContext { /** * Keeps track of a date - time property value that uses a timezone so it can
* be parsed later . Timezones cannot be handled until the entire iCalendar
* object has been parsed .
* @ param tzid the timezone ID ( TZID parameter )
* @ param property the property
* @ param date th... | timezonedDates . put ( tzid , new TimezonedDate ( date , property ) ) ; |
public class SmapGenerator { /** * Adds the given SmapStratum object , representing a Stratum with
* logically associated FileSection and LineSection blocks , to
* the current SmapGenerator . If < tt > default < / tt > is true , this
* stratum is made the default stratum , overriding any previously
* set defaul... | strata . add ( stratum ) ; if ( defaultStratum ) this . defaultStratum = stratum . getStratumName ( ) ; |
public class Partitions { /** * Adds the { @ link RedisClusterNode } to this { @ link Partitions } .
* @ param redisClusterNode must not be { @ literal null }
* @ return { @ literal true } if this { @ link Partitions } changed as a result of the call */
@ Override public boolean add ( RedisClusterNode redisClusterN... | synchronized ( partitions ) { LettuceAssert . notNull ( redisClusterNode , "RedisClusterNode must not be null" ) ; boolean add = getPartitions ( ) . add ( redisClusterNode ) ; updateCache ( ) ; return add ; } |
public class IndexLookup { /** * Scans the index table , applying the index based on the given column constraints to return a set of tablet splits .
* If this function returns true , the output parameter tabletSplits contains a list of TabletSplitMetadata objects .
* These in turn contain a collection of Ranges con... | // Early out if index is disabled
if ( ! isOptimizeIndexEnabled ( session ) ) { LOG . debug ( "Secondary index is disabled" ) ; return false ; } LOG . debug ( "Secondary index is enabled" ) ; // Collect Accumulo ranges for each indexed column constraint
Multimap < AccumuloColumnConstraint , Range > constraintRanges = g... |
public class SARLQuickfixProvider { /** * Replies the size of a sequence of whitespaces .
* @ param document the document .
* @ param offset the offset of the first character of the sequence .
* @ return the number of whitespaces at the given offset .
* @ throws BadLocationException if there is a problem with t... | int size = 0 ; char c = document . getChar ( offset + size ) ; while ( Character . isWhitespace ( c ) ) { size ++ ; c = document . getChar ( offset + size ) ; } return size ; |
public class MatchPatternIterator { /** * Returns the next node in the set and advances the position of the
* iterator in the set . After a NodeIterator is created , the first call
* to nextNode ( ) returns the first node in the set .
* @ return The next < code > Node < / code > in the set being iterated over , o... | if ( m_foundLast ) return DTM . NULL ; int next ; org . apache . xpath . VariableStack vars ; int savedStart ; if ( - 1 != m_stackFrame ) { vars = m_execContext . getVarStack ( ) ; // These three statements need to be combined into one operation .
savedStart = vars . getStackFrame ( ) ; vars . setStackFrame ( m_stackFr... |
public class Cells { /** * Returns the { @ code Long } value of the { @ link Cell } ( associated to { @ code table } ) whose name iscellName , or null
* if this Cells object contains no cell whose name is cellName .
* @ param nameSpace the name of the owning table
* @ param cellName the name of the Cell we want t... | return getValue ( nameSpace , cellName , Long . class ) ; |
public class Mixer { /** * < p > append . < / p >
* @ param samples a { @ link java . util . List } object .
* @ return a { @ link ameba . captcha . audio . Sample } object . */
public final static Sample append ( List < Sample > samples ) { } } | if ( samples . size ( ) == 0 ) { return buildSample ( 0 , new double [ 0 ] ) ; } int sampleCount = 0 ; // append voices to each other
double [ ] first = samples . get ( 0 ) . getInterleavedSamples ( ) ; sampleCount += samples . get ( 0 ) . getSampleCount ( ) ; double [ ] [ ] samples_ary = new double [ samples . size ( ... |
public class BidiTransform { /** * Performs transformation of text from the bidi layout defined by the
* input ordering scheme to the bidi layout defined by the output ordering
* scheme , and applies character mirroring and Arabic shaping operations .
* In terms of < code > { @ link Bidi } < / code > class , such... | if ( text == null || inOrder == null || outOrder == null || doMirroring == null ) { throw new IllegalArgumentException ( ) ; } this . text = text . toString ( ) ; byte [ ] levels = { inParaLevel , outParaLevel } ; resolveBaseDirection ( levels ) ; ReorderingScheme currentScheme = findMatchingScheme ( levels [ 0 ] , inO... |
public class DbPro { /** * Update record with default primary key .
* < pre >
* Example :
* Db . use ( ) . update ( " user " , record ) ;
* < / pre >
* @ see # update ( String , String , Record ) */
public boolean update ( String tableName , Record record ) { } } | return update ( tableName , config . dialect . getDefaultPrimaryKey ( ) , record ) ; |
public class ExcelUtil { /** * 获取Excel读取器 , 通过调用 { @ link ExcelReader } 的read或readXXX方法读取Excel内容
* @ param bookFile Excel文件
* @ param sheetName sheet名 , 第一个默认是sheet1
* @ return { @ link ExcelReader } */
public static ExcelReader getReader ( File bookFile , String sheetName ) { } } | try { return new ExcelReader ( bookFile , sheetName ) ; } catch ( NoClassDefFoundError e ) { throw new DependencyException ( ObjectUtil . defaultIfNull ( e . getCause ( ) , e ) , PoiChecker . NO_POI_ERROR_MSG ) ; } |
public class Allele { /** * A method to simulate double crossover between Allele objects whereby the sequence from one allele is joined to the other within a specific region of overlap .
* @ param right allele
* @ return a new crossed - over allele . This implementation treats the original alleles as immutable thus... | if ( this . overlaps ( right ) ) { // System . out . println ( " this range " + this . toString ( ) + " sequence = " + this . sequence . seqString ( ) + " sequence length = " + sequence . length ( ) ) ;
Locus homologue = intersection ( right ) ; // System . out . println ( " homologue = " + homologue ) ;
SymbolList cop... |
public class DefaultTree { /** * Low - low - level */
private void insertNodeIntoIndex ( QueryNode queryNode , TreeNode treeNode ) { } } | nodeIndex . put ( queryNode , treeNode ) ; if ( queryNode instanceof TrueNode ) { trueNodes . add ( ( TrueNode ) queryNode ) ; } else if ( queryNode instanceof IntensionalDataNode ) { intensionalNodes . add ( ( IntensionalDataNode ) queryNode ) ; } updateVersionNumber ( ) ; |
public class RegisteredServiceCouchDbRepository { /** * Overload wrapper for long type . Get service by ID .
* @ param id Service ID
* @ return service */
public RegisteredServiceDocument get ( final long id ) { } } | try { return this . get ( String . valueOf ( id ) ) ; } catch ( final DocumentNotFoundException e ) { LOGGER . debug ( "Service [{}] not found. [{}]" , id , e . getMessage ( ) ) ; return null ; } |
public class MessageLogger { /** * Logs a message by the provided key to the provided { @ link Logger } at error level after substituting the parameters in the message by the provided objects .
* @ param logger the logger to log to
* @ param messageKey the key of the message in the bundle
* @ param objects the su... | logger . error ( getMessage ( messageKey , objects ) ) ; |
public class TcpClient { /** * Attach an IO handler to react on connected client
* @ param handler an IO handler that can dispose underlying connection when { @ link
* Publisher } terminates .
* @ return a new { @ link TcpClient } */
public final TcpClient handle ( BiFunction < ? super NettyInbound , ? super Nett... | Objects . requireNonNull ( handler , "handler" ) ; return doOnConnected ( c -> { if ( log . isDebugEnabled ( ) ) { log . debug ( format ( c . channel ( ) , "Handler is being applied: {}" ) , handler ) ; } Mono . fromDirect ( handler . apply ( ( NettyInbound ) c , ( NettyOutbound ) c ) ) . subscribe ( c . disposeSubscri... |
public class JKExceptionHandlerFactory { /** * Sets the handler .
* @ param clas the clas
* @ param handler the handler */
public void setHandler ( final Class < ? extends Throwable > clas , final JKExceptionHandler handler ) { } } | this . handlers . put ( clas , handler ) ; |
public class ImageVectorizer { /** * Takes and returns a vectorization result from the pool .
* @ return the vectorization result , or null in no results are ready
* @ throws Exception
* for a failed vectorization task */
public ImageVectorizationResult getImageVectorizationResult ( ) throws Exception { } } | Future < ImageVectorizationResult > future = pool . poll ( ) ; if ( future == null ) { return null ; } else { try { ImageVectorizationResult imvr = future . get ( ) ; return imvr ; } catch ( Exception e ) { throw e ; } finally { // in any case ( Exception or not ) the numPendingTask should be reduced
numPendingTasks --... |
public class WDropdownTriggerActionExample { /** * Retrieves the regions in a state .
* @ param state the state .
* @ return the regions in the given state . */
private static String [ ] getRegions ( final String state ) { } } | if ( "ACT" . equals ( state ) ) { return ACT_REGIONS ; } else if ( "VIC" . equals ( state ) ) { return VIC_REGIONS ; } else { return null ; } |
public class PreferencesFxUtils { /** * Goes through the list of parent categories and adds each category it visists to the flatList .
* @ param flatList list to which the categories for the flattened list should be added
* @ param categories list of parent categories to go through recursively
* @ implNote Intern... | categories . forEach ( category -> { flatList . add ( category ) ; List < Category > children = category . getChildren ( ) ; if ( children != null ) { flattenCategories ( flatList , children ) ; } } ) ; |
public class Meta { /** * Some aspects of the provided methods are caller - configurable .
* Use this method to alter these aspects of the configuration .
* If { @ link # meta ( ) } was used to instantiate the instance any changes to { @ link MetaConfig . ObjectEqualsPolicy }
* will result in an error . Use { @ l... | Ensure . that ( config != null , "config != null" ) ; // noinspection ConstantConditions
if ( type == null && ( config . getInstanceCheckPolicy ( ) != MetaConfig . defaultConfig ( ) . getInstanceCheckPolicy ( ) ) ) { String message = "Not enough type information to guarantee equals contract. Use Meta.meta(Class) to con... |
public class RequestedGlobalProperties { /** * Sets these properties to request some partitioning on the given fields . This will allow
* both hash partitioning and range partitioning to match .
* If the fields are provided as { @ link FieldSet } , then any permutation of the fields is a
* valid partitioning , in... | if ( partitionedFields == null ) { throw new NullPointerException ( ) ; } this . partitioning = PartitioningProperty . ANY_PARTITIONING ; this . partitioningFields = partitionedFields ; this . ordering = null ; |
public class ToStringStyle { /** * < p > Sets the text to output when < code > null < / code > found . < / p >
* < p > < code > null < / code > is accepted , but will be converted to
* an empty String . < / p >
* @ param nullText the new text to output when null found */
protected void setNullText ( String nullTe... | if ( nullText == null ) { nullText = StringUtils . EMPTY ; } this . nullText = nullText ; |
public class CertificatesInner { /** * Get all certificates in a resource group .
* Get all certificates in a resource group .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observ... | return listByResourceGroupWithServiceResponseAsync ( resourceGroupName ) . map ( new Func1 < ServiceResponse < Page < CertificateInner > > , Page < CertificateInner > > ( ) { @ Override public Page < CertificateInner > call ( ServiceResponse < Page < CertificateInner > > response ) { return response . body ( ) ; } } ) ... |
public class OjbTagsHandler { /** * Returns the name of the current object on the specified level .
* @ param attributes The attributes of the tag
* @ return The property value
* @ exception XDocletException If an error occurs
* @ doc . tag type = " content "
* @ doc . param name = " level " optional = " fals... | return getDefForLevel ( attributes . getProperty ( ATTRIBUTE_LEVEL ) ) . getName ( ) ; |
public class GetRestoreTaskRunner { /** * Create URL to call bridge app */
protected String buildBridgeURL ( GetRestoreTaskParameters params ) { } } | if ( params . getRestoreId ( ) != null ) { return MessageFormat . format ( "{0}/restore/{1}" , buildBridgeBaseURL ( ) , params . getRestoreId ( ) ) ; } else { return MessageFormat . format ( "{0}/restore/by-snapshot/{1}" , buildBridgeBaseURL ( ) , params . getSnapshotId ( ) ) ; } |
public class AbstractFFmpegStreamBuilder { /** * Sets the Audio sample rate , for example 44_000.
* @ param sample _ rate Samples measured in Hz
* @ return this
* @ see net . bramp . ffmpeg . FFmpeg # AUDIO _ SAMPLE _ 8000
* @ see net . bramp . ffmpeg . FFmpeg # AUDIO _ SAMPLE _ 11025
* @ see net . bramp . ff... | checkArgument ( sample_rate > 0 , "sample rate must be positive" ) ; this . audio_enabled = true ; this . audio_sample_rate = sample_rate ; return getThis ( ) ; |
public class DefaultArbitrator { /** * { @ inheritDoc } */
@ Override public Difference compare ( Node a , Node b ) { } } | if ( a instanceof Content && b instanceof Content ) { // - content character data
String textA = ( ( Content ) a ) . getText ( ) ; String textB = ( ( Content ) b ) . getText ( ) ; if ( ! textA . equals ( textB ) ) { return new Difference ( a , b , "Content is different" ) ; } } else if ( a instanceof Element && b insta... |
public class EditShape { /** * Sets value to the given user index on a geometry . */
void setGeometryUserIndex ( int geom , int index , int value ) { } } | AttributeStreamOfInt32 stream = m_geometry_indices . get ( index ) ; int pindex = getGeometryIndex_ ( geom ) ; if ( pindex >= stream . size ( ) ) stream . resize ( Math . max ( ( int ) ( pindex * 1.25 ) , ( int ) 16 ) , - 1 ) ; stream . write ( pindex , value ) ; |
public class PixelConvertingSpliterator { /** * Example implementation of a { @ code PixelConvertingSpliterator < double [ ] > } .
* The elements of the returned spliterator will be { @ code double [ ] } of length 3
* with normalized red , green and blue channels on index 0 , 1 and 2.
* < b > Code : < / b >
* <... | PixelConvertingSpliterator < PixelBase , double [ ] > arraySpliterator = new PixelConvertingSpliterator < > ( pixelSpliterator , getDoubleArrayConverter ( ) ) ; return arraySpliterator ; |
public class CmsVaadinUtils { /** * Reads a layout from a resource , applies basic i18n macro substitution on the contained text , and returns a stream of the transformed
* data . < p >
* @ param layoutClass the class relative to which the layout resource will be looked up
* @ param relativeName the file name of ... | CmsMacroResolver resolver = new CmsMacroResolver ( ) { @ Override public String getMacroValue ( String macro ) { return CmsEncoder . escapeXml ( super . getMacroValue ( macro ) ) ; } } ; resolver . setMessages ( CmsVaadinUtils . getWpMessagesForCurrentLocale ( ) ) ; InputStream layoutStream = CmsVaadinUtils . filterUtf... |
public class TransactionalCache { /** * Removes an instance from the cache .
* @ param id
* The id . */
public void remove ( Id id ) { } } | readCache . remove ( new CacheKey ( id ) ) ; writeCache . remove ( id ) ; |
public class CommandLineUtil { /** * Search for an argument " - & lt ; option & gt ; = & lt ; value & gt ; " where option is the given option name , and return the value . */
public static String getOptionValue ( String [ ] args , String optionName ) { } } | String opt = "-" + optionName + "=" ; for ( String arg : args ) { if ( arg . startsWith ( opt ) ) return arg . substring ( opt . length ( ) ) ; } return null ; |
public class CertUtil { /** * 使用模和指数生成RSA公钥 注意 : 此代码用了默认补位方式 , 为RSA / None / PKCS1Padding , 不同JDK默认的补位方式可能不同
* @ param modulus
* @ param exponent
* 指数
* @ return */
private static PublicKey getPublicKey ( String modulus , String exponent ) { } } | try { BigInteger b1 = new BigInteger ( modulus ) ; BigInteger b2 = new BigInteger ( exponent ) ; KeyFactory keyFactory = KeyFactory . getInstance ( "RSA" , "BC" ) ; RSAPublicKeySpec keySpec = new RSAPublicKeySpec ( b1 , b2 ) ; return keyFactory . generatePublic ( keySpec ) ; } catch ( Exception e ) { LogUtil . writeErr... |
public class LockableValue { /** * Can be executed only between create / release lock calls */
@ MainThread public void change ( T obj ) { } } | if ( ! isLockEnabled ) { throw new RuntimeException ( "changing of values only cen be performed in locked state" ) ; } modifiedValue = obj ; notifyInMainThread ( modifiedValue ) ; |
public class CFFFontSubset { /** * Function Checks how the current operator effects the run time stack after being run
* An operator may increase or decrease the stack size */
protected void HandelStack ( ) { } } | // Find out what the operator does to the stack
int StackHandel = StackOpp ( ) ; if ( StackHandel < 2 ) { // The operators that enlarge the stack by one
if ( StackHandel == 1 ) PushStack ( ) ; // The operators that pop the stack
else { // Abs value for the for loop
StackHandel *= - 1 ; for ( int i = 0 ; i < StackHandel... |
public class EthereumUtil { /** * Calculates the chain Id
* @ param eTrans Ethereum Transaction of which the chain id should be calculated
* @ return chainId : 0 , Ethereum testnet ( aka Olympic ) ; 1 : Ethereum mainet ( aka Frontier , Homestead , Metropolis ) - also Classic ( from fork ) - also Expanse ( alternati... | Long result = null ; long rawResult = EthereumUtil . convertVarNumberToLong ( new RLPElement ( new byte [ 0 ] , eTrans . getSig_v ( ) ) ) ; if ( ! ( ( rawResult == EthereumUtil . LOWER_REAL_V ) || ( rawResult == ( LOWER_REAL_V + 1 ) ) ) ) { result = ( rawResult - EthereumUtil . CHAIN_ID_INC ) / 2 ; } return result ; |
public class DeltaEncoder { /** * Computes the size in bytes for storing a list of WayDataBlock objects as unsigned var - bytes .
* @ param blocks the blocks which should be encoded
* @ return the number of bytes needed for the encoding */
public static int simulateSerialization ( List < WayDataBlock > blocks ) { }... | int sum = 0 ; for ( WayDataBlock wayDataBlock : blocks ) { sum += mSimulateSerialization ( wayDataBlock . getOuterWay ( ) ) ; if ( wayDataBlock . getInnerWays ( ) != null ) { for ( List < Integer > list : wayDataBlock . getInnerWays ( ) ) { sum += mSimulateSerialization ( list ) ; } } } return sum ; |
public class JFapOutboundConnLink { /** * Returns the interface provided by this channel . Always ourself . */
public Object getChannelAccessor ( ) // F177053
{ } } | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getChannelAccessor" ) ; // F177053
if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getChannelAccessor" , this ) ; // F177053
return this ; |
public class NodeList { /** * Provides lookup of elements by non - namespaced name .
* @ param name the name or shortcut key for nodes of interest
* @ return the nodes of interest which match name */
public NodeList getAt ( String name ) { } } | NodeList answer = new NodeList ( ) ; for ( Object child : this ) { if ( child instanceof Node ) { Node childNode = ( Node ) child ; Object temp = childNode . get ( name ) ; if ( temp instanceof Collection ) { answer . addAll ( ( Collection ) temp ) ; } else { answer . add ( temp ) ; } } } return answer ; |
public class BosClient { /** * Gets the object stored in Bos under the specified bucket and key .
* @ param bucketName The name of the bucket containing the desired object .
* @ param key The key under which the desired object is stored .
* @ return The object stored in Bos in the specified bucket and key . */
pu... | return this . getObject ( new GetObjectRequest ( bucketName , key ) ) ; |
public class RtfParagraphStyle { /** * Writes the start information of this RtfParagraphStyle .
* @ param result The < code > OutputStream < / code > to write to .
* @ throws IOException On i / o errors . */
public void writeBegin ( final OutputStream result ) throws IOException { } } | result . write ( DocWriter . getISOBytes ( "\\s" ) ) ; result . write ( intToByteArray ( this . styleNumber ) ) ; writeParagraphSettings ( result ) ; |
public class EntityFormat { /** * check if the specified string is an valid Latin Date string
* like " 2017/02/22 " , " 2017-02-22 " or " 2017.02.22"
* @ param str
* @ return boolean */
public static final String isDate ( String str , char delimiter ) { } } | int length = str . length ( ) ; if ( length > 10 ) { return null ; } int sIdx = 0 , eIdx = 0 , idx = 0 ; String [ ] parts = new String [ ] { null , null , null } ; while ( ( eIdx = str . indexOf ( delimiter , sIdx ) ) > - 1 ) { parts [ idx ++ ] = str . substring ( sIdx , eIdx ) ; sIdx = eIdx + 1 ; if ( idx > 2 ) { retu... |
public class OrderingTypeImpl { /** * If not already created , a new < code > after < / code > element with the given value will be created .
* Otherwise , the existing < code > after < / code > element will be returned .
* @ return a new or existing instance of < code > OrderingOrderingType < OrderingType < T > > ... | Node node = childNode . getOrCreate ( "after" ) ; OrderingOrderingType < OrderingType < T > > after = new OrderingOrderingTypeImpl < OrderingType < T > > ( this , "after" , childNode , node ) ; return after ; |
public class LongStream { /** * Performs provided action on each element .
* < p > This is an intermediate operation .
* @ param action the action to be performed on each element
* @ return the new stream */
@ NotNull public LongStream peek ( @ NotNull final LongConsumer action ) { } } | return new LongStream ( params , new LongPeek ( iterator , action ) ) ; |
public class ParserDDL { /** * Responsible for handling check constraints section of CREATE TABLE . . .
* @ param c check constraint */
void readCheckConstraintCondition ( Constraint c ) { } } | readThis ( Tokens . OPENBRACKET ) ; startRecording ( ) ; isCheckOrTriggerCondition = true ; Expression condition = XreadBooleanValueExpression ( ) ; isCheckOrTriggerCondition = false ; Token [ ] tokens = getRecordedStatement ( ) ; readThis ( Tokens . CLOSEBRACKET ) ; c . check = condition ; c . checkStatement = Token .... |
public class Construct { /** * Checks that a factory method with the required number of arguments is found .
* @ param arguments */
private void checkFactoryMethodArguments ( int arguments ) { } } | for ( Method m : typeDef . getMethods ( ) ) { int a = m . getArguments ( ) != null ? m . getArguments ( ) . size ( ) : 0 ; if ( m . getName ( ) . equals ( staticFactoryMethod ) && a == arguments && m . isStatic ( ) ) { return ; } } throw new IllegalArgumentException ( "No static method found on " + typeDef . getName ( ... |
public class PrettyLogger { /** * Pretty log an object . Its class name will be used as a description .
* @ param channels
* the channels to pretty log to
* @ param obj
* the object to be pretty logged */
public static void log ( RedwoodChannels channels , Object obj ) { } } | log ( channels , obj . getClass ( ) . getSimpleName ( ) , obj ) ; |
public class SRTServletResponse { /** * Returns an output stream for writing binary response data .
* @ see reinitStreamState */
public ServletOutputStream getOutputStream ( ) { } } | final boolean isTraceOn = com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && logger . isLoggable ( Level . FINE ) ) // 306998.15
logger . entering ( CLASS_NAME , "getOutputStream" , "gotWriter=" + String . valueOf ( _gotWriter ) + " [" + this + "]" ) ; if ( ! _ignoreStateErrors && _got... |
public class ORBEnabledRemoteObjectInstanceFactoryImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . clientcontainer . remote . common . object . RemoteObjectInstanceFactory # create ( java . rmi . Remote , java . lang . String ) */
@ Override public RemoteObjectInstance create ( Remote remoteObject , String int... | return new RemoteCORBAObjectInstanceImpl ( remoteObject , interfaceNameToNarrowTo ) ; |
public class BaseFColletion { /** * - - - Group - - - */
protected < K > FMap < K , C > groupByInternal ( Function < ? super E , ? extends K > f ) { } } | LinkedHashFMap < K , CollectionBuilder < E , C > > build = new LinkedHashFMap < > ( new LinkedHashMap < > ( ) ) ; for ( E e : this ) { build . computeIfAbsent ( f . apply ( e ) , k -> builder ( ) ) . add ( e ) ; } LinkedHashFMap < K , C > ret = new LinkedHashFMap < > ( new LinkedHashMap < > ( ) ) ; for ( Entry < K , Co... |
public class HashUtil { /** * JS算法
* @ param str 字符串
* @ return hash值 */
public static int jsHash ( String str ) { } } | int hash = 1315423911 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { hash ^= ( ( hash << 5 ) + str . charAt ( i ) + ( hash >> 2 ) ) ; } return hash & 0x7FFFFFFF ; |
public class CommerceNotificationQueueEntryModelImpl { /** * Converts the soap model instances into normal model instances .
* @ param soapModels the soap model instances to convert
* @ return the normal model instances */
public static List < CommerceNotificationQueueEntry > toModels ( CommerceNotificationQueueEnt... | if ( soapModels == null ) { return null ; } List < CommerceNotificationQueueEntry > models = new ArrayList < CommerceNotificationQueueEntry > ( soapModels . length ) ; for ( CommerceNotificationQueueEntrySoap soapModel : soapModels ) { models . add ( toModel ( soapModel ) ) ; } return models ; |
public class DateTimePerformance { /** * Start the stopwatch . */
private void start ( String str1 , String str2 ) { } } | result = ( Result ) results . get ( str1 + str2 ) ; if ( result == null ) { result = new Result ( ) ; result . object = str1 ; result . name = str2 ; results . put ( str1 + str2 , result ) ; resultList . add ( result ) ; } start = System . currentTimeMillis ( ) ; |
public class CmsPublishService { /** * Returns the cached publish options , creating it if it doesn ' t already exist . < p >
* @ return the cached publish options */
private CmsPublishOptions getCachedOptions ( ) { } } | CmsPublishOptions cache = ( CmsPublishOptions ) getRequest ( ) . getSession ( ) . getAttribute ( SESSION_ATTR_ADE_PUB_OPTS_CACHE ) ; if ( cache == null ) { CmsUserSettings settings = new CmsUserSettings ( getCmsObject ( ) ) ; cache = new CmsPublishOptions ( ) ; cache . setIncludeSiblings ( settings . getDialogPublishSi... |
public class J2EESecurityManager { /** * Decide if the annotated element allows access to the current user .
* @ param bean the action bean ; used for security decisions
* @ param handler the event handler ; used for security decisions
* @ param element the element to check authorization for
* @ return { @ link... | // Default decision : none .
Boolean allowed = null ; if ( element . isAnnotationPresent ( DenyAll . class ) ) { // The element denies access .
allowed = false ; } else if ( element . isAnnotationPresent ( PermitAll . class ) ) { // The element allows access to all security roles ( i . e . any authenticated user ) .
al... |
public class ValidStorageOptions { /** * The valid range of provisioned IOPS . For example , 1000-20000.
* @ return The valid range of provisioned IOPS . For example , 1000-20000. */
public java . util . List < Range > getProvisionedIops ( ) { } } | if ( provisionedIops == null ) { provisionedIops = new com . amazonaws . internal . SdkInternalList < Range > ( ) ; } return provisionedIops ; |
public class DateUtils { /** * convert from local date to UTC */
public static Date toUtcDate ( TimeZone browserTZ , TimeZone targetTZ , String localDate ) { } } | if ( localDate == null ) { return null ; } return toUtcDate ( browserTZ , targetTZ , Long . valueOf ( localDate ) ) ; |
public class AtomMetadataWriter { /** * Write a { @ code < updated > } element .
* @ throws XMLStreamException If unable to write to stream */
void writeUpdate ( ZonedDateTime dateTime ) throws XMLStreamException { } } | xmlWriter . writeStartElement ( ATOM_UPDATED ) ; xmlWriter . writeCharacters ( dateTime . format ( DateTimeFormatter . ISO_INSTANT ) ) ; xmlWriter . writeEndElement ( ) ; |
public class LightMetaProperty { /** * Creates an instance from a derived { @ code Method } .
* @ param < P > the property type
* @ param metaBean the meta bean , not null
* @ param getMethod the get method , not null
* @ param constructorIndex the index of the property
* @ return the property , not null */
@... | MethodHandle getter ; try { getter = lookup . unreflect ( getMethod ) ; } catch ( IllegalArgumentException | IllegalAccessException ex ) { throw new UnsupportedOperationException ( "Property cannot be read: " + propertyName , ex ) ; } return new LightMetaProperty < > ( metaBean , propertyName , ( Class < P > ) getMetho... |
public class HelloConfiguration { /** * Returns a new { @ link HealthChecker } that marks the server as unhealthy when Tomcat becomes unavailable . */
@ Bean public HealthChecker tomcatConnectorHealthChecker ( ServletWebServerApplicationContext applicationContext ) { } } | final Connector connector = getConnector ( applicationContext ) ; return ( ) -> connector . getState ( ) . isAvailable ( ) ; |
public class TagResourceRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TagResourceRequest tagResourceRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( tagResourceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( tagResourceRequest . getResource ( ) , RESOURCE_BINDING ) ; protocolMarshaller . marshall ( tagResourceRequest . getTags ( ) , TAGS_BINDING ) ; } catch ( Exception e ... |
public class GatewayMicroService { /** * The shared state component . */
protected void registerSharedStateComponent ( ) { } } | String componentPropName = GatewayConfigProperties . COMPONENT_PREFIX + ISharedStateComponent . class . getSimpleName ( ) ; setConfigProperty ( componentPropName , ESSharedStateComponent . class . getName ( ) ) ; setConfigProperty ( componentPropName + ".client.type" , "jest" ) ; setConfigProperty ( componentPropName +... |
public class ConfluenceGreenPepper { /** * < p > getRemoteUser . < / p >
* @ return a { @ link com . atlassian . user . User } object . */
public User getRemoteUser ( ) { } } | HttpServletRequest request = ServletActionContext . getRequest ( ) ; if ( request != null ) { String remoteUserName = request . getRemoteUser ( ) ; if ( remoteUserName != null ) { return getUserAccessor ( ) . getUserIfAvailable ( remoteUserName ) ; } } return AuthenticatedUserThreadLocal . getUser ( ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcPresentationStyle ( ) { } } | if ( ifcPresentationStyleEClass == null ) { ifcPresentationStyleEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 382 ) ; } return ifcPresentationStyleEClass ; |
public class N { /** * Returns an immutable empty < code > NavigableMap < / code > if the specified NavigableMap is < code > null < / code > , otherwise itself is returned .
* @ param map
* @ return */
public static < K , V > NavigableMap < K , V > nullToEmpty ( final NavigableMap < K , V > map ) { } } | return map == null ? N . < K , V > emptyNavigableMap ( ) : map ; |
public class PaymentChannelV1ClientState { /** * < p > When the servers signature for the refund transaction is received , call this to verify it and sign the
* complete refund ourselves . < / p >
* < p > If this does not throw an exception , we are secure against the loss of funds and can safely provide the server... | checkNotNull ( theirSignature ) ; stateMachine . checkState ( State . WAITING_FOR_SIGNED_REFUND ) ; TransactionSignature theirSig = TransactionSignature . decodeFromBitcoin ( theirSignature , true , false ) ; if ( theirSig . sigHashMode ( ) != Transaction . SigHash . NONE || ! theirSig . anyoneCanPay ( ) ) throw new Ve... |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link String } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.ibm.com/websphere/wim" , name = "employeeType" ) public JAXBElement < String > createEmployeeType ( String value ) { } } | return new JAXBElement < String > ( _EmployeeType_QNAME , String . class , null , value ) ; |
public class FileSystem { /** * Set the default filesystem URI in a configuration .
* @ param conf the configuration to alter
* @ param uri the new default filesystem uri */
public static void setDefaultUri ( Configuration conf , String uri ) { } } | setDefaultUri ( conf , URI . create ( fixName ( uri ) ) ) ; |
public class systemcore { /** * Use this API to fetch all the systemcore resources that are configured on netscaler . */
public static systemcore get ( nitro_service service ) throws Exception { } } | systemcore obj = new systemcore ( ) ; systemcore [ ] response = ( systemcore [ ] ) obj . get_resources ( service ) ; return response [ 0 ] ; |
public class Drawer { /** * Get the current state of the drawer .
* True if the drawer is currently open .
* @ return */
public boolean isDrawerOpen ( ) { } } | if ( mDrawerBuilder . mDrawerLayout != null && mDrawerBuilder . mSliderLayout != null ) { return mDrawerBuilder . mDrawerLayout . isDrawerOpen ( mDrawerBuilder . mDrawerGravity ) ; } return false ; |
public class DateBuilder { /** * Returns a date that is rounded to the next even minute above the given
* date .
* For example an input date with a time of 08:13:54 would result in a date
* with the time of 08:14:00 . If the date ' s time is in the 59th minute , then
* the hour ( and possibly the day ) will be ... | final Calendar c = PDTFactory . createCalendar ( ) ; c . setTime ( date != null ? date : new Date ( ) ) ; c . setLenient ( true ) ; c . set ( Calendar . MINUTE , c . get ( Calendar . MINUTE ) + 1 ) ; c . set ( Calendar . SECOND , 0 ) ; c . set ( Calendar . MILLISECOND , 0 ) ; return c . getTime ( ) ; |
public class StartRserve { /** * attempt to start Rserve . Note : parameters are < b > not < / b > quoted , so avoid
* using any quotes in arguments
* @ param todo command to execute in R
* @ param Rcmd command necessary to start R
* @ param rargs arguments are are to be passed to R ( e . g . - - vanilla - q ) ... | Process p = null ; try { String Rout = new SimpleDateFormat ( "yyyy-MM-dd_HH-mm-ss" ) . format ( Calendar . getInstance ( ) . getTime ( ) ) + ".Rout" ; String command = Rcmd + " " + rargs + " -e \"" + todo + "\" " + ( redirect ? " > " + Rout + ( ! RserveDaemon . isWindows ( ) ? " 2>&1" : "" ) : "" ) ; Log . Out . print... |
public class HttpRequest { /** * 文件表单项 < br >
* 一旦有文件加入 , 表单变为multipart / form - data
* @ param name 名
* @ param file 需要上传的文件
* @ return this */
public HttpRequest form ( String name , File file ) { } } | return form ( name , file , file . getName ( ) ) ; |
public class TinkerforgeEndpoint { /** * Extract values out from Functions
* init = functionName1 ( ' parameter ' : ' value ' , ' parameter2 ' : ' value2 ' ) , functionName1 ( ' parameter ' : ' value ' , ' parameter2 ' : ' value2 ' ) */
public Object getFunctionsValue ( String parameter , String function ) { } } | Object value = null ; return value ; |
public class Percentile { /** * Add a measurement to estimate
* @ param x - the value of the measurement */
public void add ( final float x ) { } } | if ( isInitializing ) { q [ ni ++ ] = x ; if ( ni == 2 * m + 3 + 1 ) { Arrays . sort ( q ) ; isInitializing = false ; } } else { addMeasurement ( x ) ; } |
public class WCardManager { /** * Override method to show Warning indicators on the visible card .
* @ param diags the list of diagnostics containing warnings . */
@ Override public void showWarningIndicators ( final List < Diagnostic > diags ) { } } | WComponent visibleComponent = getVisible ( ) ; visibleComponent . showWarningIndicators ( diags ) ; |
public class DaoHelper { /** * 设置所有参数
* @ param query
* @ param parameterWrap
* @ return */
public static Query setParameter ( Query query , QueryParameterWrap parameterWrap ) { } } | setBasicParameter ( query , parameterWrap ) ; setPageParameter ( query , parameterWrap . getPageable ( ) ) ; setResultTransformerType ( query , parameterWrap . getResultTransformerType ( ) ) ; return query ; |
public class RadiusClientFactory { /** * RADIUS server network address .
* @ param address Network address as a string . */
public void setInetAddress ( final String address ) { } } | try { this . inetAddress = InetAddress . getByName ( address ) ; } catch ( final UnknownHostException e ) { throw new RuntimeException ( "Invalid address " + address ) ; } |
public class CUDA_MEMCPY3D_PEER { /** * Creates and returns a string representation of this object ,
* using the given separator for the fields
* @ param f Separator
* @ return A String representation of this object */
private String createString ( String f ) { } } | return "srcXInBytes=" + srcXInBytes + f + "srcY=" + srcY + f + "srcZ=" + srcZ + f + "srcLOD=" + srcLOD + f + "srcMemoryType=" + CUmemorytype . stringFor ( srcMemoryType ) + f + "srcHost=" + srcHost + f + "srcDevice=" + srcDevice + f + "srcArray=" + srcArray + f + "srcContext=" + srcContext + f + "srcPitch=" + srcPitch ... |
public class Base32Utils { /** * This function encodes a byte array using base 32 with a specific indentation of new lines .
* @ param bytes The byte array to be encoded .
* @ param indentation The indentation string to be inserted before each new line .
* @ return The base 32 encoded string . */
static public St... | StringBuilder result = new StringBuilder ( ) ; int length = bytes . length ; if ( length == 0 ) return "" ; // empty byte array
if ( indentation != null ) result . append ( indentation ) ; encodeBytes ( bytes [ 0 ] , bytes [ 0 ] , 0 , result ) ; for ( int i = 1 ; i < length ; i ++ ) { if ( i % 50 == 0 ) { // format to ... |
public class Files { /** * Convert file path to an Unix like path string . If given < code > path < / code > is Windows like replaces drive letter
* with Unix path root and all Windows path separators to Unix counterpart .
* < pre >
* D : \ \ temp \ file . txt - & gt ; / temp / file . txt
* < / pre >
* If < c... | if ( path == null ) { return null ; } if ( path . endsWith ( "/" ) || path . endsWith ( "\\" ) ) { path = path . substring ( 0 , path . length ( ) - 1 ) ; } return path . replaceAll ( "(^[a-zA-Z]\\:\\\\?)?\\\\" , "/" ) ; |
public class AbstractIoSession { /** * { @ inheritDoc } */
@ Override public WriteFuture write ( Object message , SocketAddress remoteAddress ) { } } | if ( message == null ) { throw new NullPointerException ( "message" ) ; } // We can ' t send a message to a connected session if we don ' t have
// the remote address
if ( ! getTransportMetadata ( ) . isConnectionless ( ) && remoteAddress != null ) { throw new UnsupportedOperationException ( ) ; } // If the session has... |
public class PropertiesField { /** * Set this property in the user ' s property area .
* @ param strProperty The property key .
* @ param strValue The property value . */
public int setProperties ( Map < String , Object > properties ) { } } | return this . setProperties ( properties , DBConstants . DISPLAY , DBConstants . SCREEN_MOVE ) ; |
public class MultipartConfigFactory { /** * Create a new { @ link MultipartConfigElement } instance .
* @ return the multipart config element */
public MultipartConfigElement createMultipartConfig ( ) { } } | long maxFileSizeBytes = convertToBytes ( this . maxFileSize , - 1 ) ; long maxRequestSizeBytes = convertToBytes ( this . maxRequestSize , - 1 ) ; long fileSizeThresholdBytes = convertToBytes ( this . fileSizeThreshold , 0 ) ; return new MultipartConfigElement ( this . location , maxFileSizeBytes , maxRequestSizeBytes ,... |
public class RevisionApi { /** * Returns a map of timestamps mapped on the corresponding DiffPart - Collections . Can be used to
* compile statistics over all changes that have been made in one article .
* In order to make this query fast , create a MySQL - Index ( BTREE ) on the ArticleID in the
* revisions - ta... | Map < Timestamp , Collection < DiffPart > > tsDiffPartsMap = new HashMap < Timestamp , Collection < DiffPart > > ( ) ; try { if ( articleID < 1 ) { throw new IllegalArgumentException ( ) ; } PreparedStatement statement = null ; ResultSet result = null ; RevisionDecoder decoder = new RevisionDecoder ( config . getCharac... |
public class Bzip2BitReader { /** * Checks that the specified number of bytes available for reading .
* @ param count The number of bytes to check
* @ return { @ code true } if { @ code count } bytes are available for reading , otherwise { @ code false } */
boolean hasReadableBytes ( int count ) { } } | if ( count < 0 || count > MAX_COUNT_OF_READABLE_BYTES ) { throw new IllegalArgumentException ( "count: " + count + " (expected: 0-" + MAX_COUNT_OF_READABLE_BYTES + ')' ) ; } return hasReadableBits ( count << 3 ) ; |
public class ExpandableGridView { /** * Returns the type of the item , which corresponds to a specific packed position .
* @ param packedPosition
* The packed position of the item , whose type should be returned , as an { @ link Integer }
* value
* @ return The type of the item , which corresponds to the given ... | if ( packedPosition == PACKED_POSITION_VALUE_NULL ) { return PACKED_POSITION_TYPE_NULL ; } return ( packedPosition & PACKED_POSITION_MASK_TYPE ) == PACKED_POSITION_MASK_TYPE ? PACKED_POSITION_TYPE_CHILD : PACKED_POSITION_TYPE_GROUP ; |
public class Document { /** * setter for entities - sets
* @ generated
* @ param v value to set into the feature */
public void setEntities ( FSArray v ) { } } | if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_entities == null ) jcasType . jcas . throwFeatMissing ( "entities" , "de.julielab.jules.types.ace.Document" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_entities , jcasType . ll_cas . ll_getFSRef (... |
public class Static { /** * Create all required header so content can be cache by Caching servers or Browsers
* @ param request
* @ param props */
private void writeHeaders ( final YokeRequest request , final FileProps props ) { } } | MultiMap headers = request . response ( ) . headers ( ) ; if ( ! headers . contains ( "etag" ) ) { headers . set ( "etag" , "\"" + props . size ( ) + "-" + props . lastModifiedTime ( ) + "\"" ) ; } if ( ! headers . contains ( "date" ) ) { headers . set ( "date" , format ( new Date ( ) ) ) ; } if ( ! headers . contains ... |
public class HashUtil { /** * need to mix the value , but have to keep it compatible with Double . hashcode ! ! */
public static final int hash ( double d , boolean isNull ) { } } | if ( isNull ) return NULL_HASH ; long longVal = Double . doubleToLongBits ( d ) ; return ( int ) ( longVal ^ ( longVal >>> 32 ) ) ; |
public class GenericObject { /** * List all fields
* @ return the array of generic fields */
public GenericField [ ] getFields ( ) { } } | Collection < GenericField > values = fieldMap . values ( ) ; if ( values == null || values . isEmpty ( ) ) return null ; GenericField [ ] fieldMirrors = new GenericField [ values . size ( ) ] ; values . toArray ( fieldMirrors ) ; return fieldMirrors ; |
public class Groups { /** * Check if a group with the given groupName exists in the
* list or not .
* The check will be done case - sensitive .
* @ param groupName The name we are searching for .
* @ return true if the group has been found false otherwise . */
public boolean hasGroup ( String groupName ) { } } | boolean result = false ; for ( Group item : getGroupsList ( ) ) { if ( item . getName ( ) . equals ( groupName ) ) { result = true ; } } return result ; |
public class PathUtils { /** * Suffix all < code > extensions < / code > to < code > path < / code > .
* < pre >
* PathUtils . addExtension ( " / tmp / data / file " , " . txt " ) = file . txt
* PathUtils . addExtension ( " / tmp / data / file . txt . gpg " , " . zip " ) = file . txt . gpg . zip
* PathUtils . a... | StringBuilder pathStringBuilder = new StringBuilder ( path . toString ( ) ) ; for ( String extension : extensions ) { if ( ! Strings . isNullOrEmpty ( extension ) ) { pathStringBuilder . append ( extension ) ; } } return new Path ( pathStringBuilder . toString ( ) ) ; |
public class PluginImpl { /** * { @ inheritDoc } */
@ Override public void stop ( ) throws Exception { } } | LOGGER . log ( Level . FINE , "Stopping SSH Slaves plugin." ) ; closeRegisteredConnections ( ) ; LOGGER . log ( Level . FINE , "SSH Slaves plugin stopped." ) ; |
public class Dokumentpakke { /** * Based on the { @ code private } { @ link java . nio . file . Files # copy ( InputStream , OutputStream ) } . This
* implementation is included here to avoid depending on Apache Commons IO just for this simple case . */
private static void copy ( InputStream source , OutputStream sin... | byte [ ] buf = new byte [ 8192 ] ; int n ; while ( ( n = source . read ( buf ) ) > 0 ) { sink . write ( buf , 0 , n ) ; } |
public class ConnectionPoolMonitor { /** * Code which sets the entry time for queueRequest for wait time . We set it in ThreadLocal variable */
@ ProbeAtEntry @ ProbeSite ( clazz = "com.ibm.ejs.j2c.FreePool" , method = "queueRequest" ) public void waitTimeEntry ( ) { } } | if ( tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "waitTimeEntry" ) ; } tlocalforwtTime . set ( System . currentTimeMillis ( ) ) ; if ( tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "waitTimeEntry" ) ; } |
public class SpeechToText { /** * List custom acoustic models .
* Lists information about all custom acoustic models that are owned by an instance of the service . Use the ` language `
* parameter to see all custom acoustic models for the specified language . Omit the parameter to see all custom
* acoustic models... | String [ ] pathSegments = { "v1/acoustic_customizations" } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments ) ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "speech_to_text" , "v1" , "listAcousticModels" ) ; for ( Entry < String ,... |
public class Stream { /** * Zip together the " a " , " b " and " c " arrays until one of them runs out of values .
* Each triple of values is combined into a single value using the supplied zipFunction function .
* @ param a
* @ param b
* @ return */
public static < A , B , C , R > Stream < R > zip ( final Coll... | return zip ( a . iterator ( ) , b . iterator ( ) , c . iterator ( ) , zipFunction ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.