signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class FastTrackTable { /** * Retrieve a specific row by index number , creating a blank row if this row does not exist .
* @ param index index number
* @ return MapRow instance */
private MapRow getRow ( int index ) { } } | MapRow result ; if ( index == m_rows . size ( ) ) { result = new MapRow ( this , new HashMap < FastTrackField , Object > ( ) ) ; m_rows . add ( result ) ; } else { result = m_rows . get ( index ) ; } return result ; |
public class SpringMain { /** * Displays the command line options . */
public void showOptions ( ) { } } | showOptionsHeader ( ) ; for ( Option option : options ) { System . out . println ( option . getInformation ( ) ) ; } |
public class TaxinvoiceServiceImp { /** * / * ( non - Javadoc )
* @ see com . popbill . api . TaxinvoiceService # issue ( java . lang . String , com . popbill . api . taxinvoice . MgtKeyType , java . lang . String , java . lang . String ) */
@ Override public IssueResponse issue ( String CorpNum , MgtKeyType KeyType ... | return issue ( CorpNum , KeyType , MgtKey , Memo , null ) ; |
public class DoubleIntegerDBIDKNNHeap { /** * Do a full update for the heap .
* @ param distance
* Distance
* @ param iid
* Object id */
private void updateHeap ( final double distance , final int iid ) { } } | final double prevdist = kdist ; final int previd = heap . peekValue ( ) ; heap . replaceTopElement ( distance , iid ) ; kdist = heap . peekKey ( ) ; // If the kdist improved , zap ties .
if ( kdist < prevdist ) { numties = 0 ; } else { addToTies ( previd ) ; } |
public class FrameMetadata { /** * TODO : UGH : use reflection ! */
public static HashMap < String , Object > makeEmptyFrameMeta ( ) { } } | HashMap < String , Object > hm = new LinkedHashMap < > ( ) ; // preserve insertion order
for ( String key : FrameMetadata . METAVALUES ) hm . put ( key , null ) ; return hm ; |
public class CalibratingTimer { /** * Initializes this timer . Must be called before the timer is used .
* @ param milliDivider - value by which current ( ) must be divided to get milliseconds
* @ param microDivider - value by which current ( ) must be divided to get microseconds */
protected void init ( long milli... | _milliDivider = milliDivider ; _microDivider = microDivider ; reset ( ) ; log . info ( "Using " + getClass ( ) + " timer" , "mfreq" , _milliDivider , "ufreq" , _microDivider , "start" , _startStamp ) ; |
public class ReflectUtil { /** * 设置field值
* @ param obj 对象
* @ param field 对象的字段
* @ param fieldValue 字段值
* @ param < T > 字段值泛型
* @ return 字段值 */
public static < T extends Object > T setFieldValue ( Object obj , Field field , T fieldValue ) { } } | Assert . notNull ( obj , "obj不能为空" ) ; Assert . notNull ( field , "field不能为空" ) ; try { field . set ( obj , fieldValue ) ; } catch ( IllegalAccessException e ) { String msg = StringUtils . format ( "类型[{0}]的字段[{1}]不允许设置" , obj . getClass ( ) , field . getName ( ) ) ; log . error ( msg ) ; throw new ReflectException ( m... |
public class PadOperation { /** * Returns the character which is used for the padding . If the character string is longer than one char , the first
* char will be used . */
private Character getPadCharacter ( String characterString ) { } } | if ( characterString . length ( ) > 0 ) { getLogger ( ) . debug ( "The given character string is longer than one element. The first character is used." ) ; } return characterString . charAt ( 0 ) ; |
public class LottieDrawable { /** * These Drawable . Callback methods proxy the calls so that this is the drawable that is
* actually invalidated , not a child one which will not pass the view ' s validateDrawable check . */
@ Override public void invalidateDrawable ( @ NonNull Drawable who ) { } } | Callback callback = getCallback ( ) ; if ( callback == null ) { return ; } callback . invalidateDrawable ( this ) ; |
public class CommonsConnector { /** * It close the logical connection .
* @ param clusterName the connection identifier . */
@ Override public void close ( ClusterName clusterName ) { } } | logger . info ( "Close connection to cluster [" + clusterName + "] from connector [" + this . getClass ( ) . getSimpleName ( ) + "]" ) ; connectionHandler . closeConnection ( clusterName . getName ( ) ) ; |
public class CommercePriceEntryPersistenceImpl { /** * Returns the first commerce price entry in the ordered set where CPInstanceUuid = & # 63 ; .
* @ param CPInstanceUuid the cp instance uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the fir... | CommercePriceEntry commercePriceEntry = fetchByCPInstanceUuid_First ( CPInstanceUuid , orderByComparator ) ; if ( commercePriceEntry != null ) { return commercePriceEntry ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "CPInstanceUuid=" ) ; msg . append ( CPI... |
public class InterconnectClient { /** * Retrieves the list of interconnect available to the specified project .
* < p > Sample code :
* < pre > < code >
* try ( InterconnectClient interconnectClient = InterconnectClient . create ( ) ) {
* ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ;
* for ( In... | ListInterconnectsHttpRequest request = ListInterconnectsHttpRequest . newBuilder ( ) . setProject ( project ) . build ( ) ; return listInterconnects ( request ) ; |
public class Key { /** * Generate a random key
* @ param random
* source of entropy
* @ return a new shared secret key */
public static Key generateKey ( final Random random ) { } } | final byte [ ] signingKey = new byte [ signingKeyBytes ] ; random . nextBytes ( signingKey ) ; final byte [ ] encryptionKey = new byte [ encryptionKeyBytes ] ; random . nextBytes ( encryptionKey ) ; return new Key ( signingKey , encryptionKey ) ; |
public class CommerceShipmentItemPersistenceImpl { /** * Returns the commerce shipment item with the primary key or throws a { @ link com . liferay . portal . kernel . exception . NoSuchModelException } if it could not be found .
* @ param primaryKey the primary key of the commerce shipment item
* @ return the comm... | CommerceShipmentItem commerceShipmentItem = fetchByPrimaryKey ( primaryKey ) ; if ( commerceShipmentItem == null ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } throw new NoSuchShipmentItemException ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } return co... |
public class PrimitiveIntegerArrayJsonDeserializer { /** * { @ inheritDoc } */
@ Override protected int [ ] doDeserializeSingleArray ( JsonReader reader , JsonDeserializationContext ctx , JsonDeserializerParameters params ) { } } | return new int [ ] { IntegerJsonDeserializer . getInstance ( ) . deserialize ( reader , ctx , params ) } ; |
public class LogRecord { /** * Returns the position of the byte cursor for the mapped byte buffer .
* @ return The byte cursor position . */
protected int position ( ) { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "position" , this ) ; int position = _absolutePosition + _buffer . position ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "position" , new Integer ( position ) ) ; return position ; |
public class RootMembership { /** * This method essentially drives the initial loading of the cache layer from the
* persistence layer .
* @ throws SevereMessageStoreException */
public final void initialize ( ) throws PersistenceException , SevereMessageStoreException { } } | PersistentMessageStore pm = _messageStore . getPersistentMessageStore ( ) ; final HashMap tupleMap = _buildTupleMap ( pm ) ; _buildStreamTree ( tupleMap ) ; _recoverStreamsWithInDoubts ( pm ) ; |
public class UserCoreDao { /** * Build where ( or selection ) LIKE statement for a single field
* @ param field
* field name
* @ param value
* column value
* @ return where clause
* @ since 3.0.1 */
public String buildWhereLike ( String field , ColumnValue value ) { } } | String where ; if ( value != null ) { if ( value . getTolerance ( ) != null ) { throw new GeoPackageException ( "Field value tolerance not supported for LIKE query, Field: " + field + ", Value: " + ", Tolerance: " + value . getTolerance ( ) ) ; } where = buildWhereLike ( field , value . getValue ( ) ) ; } else { where ... |
public class AbstractIntObjectMap { /** * Fills all keys and values < i > sorted ascending by key < / i > into the specified lists .
* Fills into the lists , starting at index 0.
* After this call returns the specified lists both have a new size that equals < tt > this . size ( ) < / tt > .
* < b > Example : < / ... | keys ( keyList ) ; keyList . sort ( ) ; valueList . setSize ( keyList . size ( ) ) ; for ( int i = keyList . size ( ) ; -- i >= 0 ; ) { valueList . setQuick ( i , get ( keyList . getQuick ( i ) ) ) ; } |
public class JsonParser { /** * Advance one character ahead , or return { @ link Token # EOF } on end of input . */
private int advanceChar ( ) throws JsonParserException { } } | if ( eof ) return - 1 ; int c = string . charAt ( index ) ; if ( c == '\n' ) { linePos ++ ; rowPos = index + 1 ; utf8adjust = 0 ; } index ++ ; if ( index >= bufferLength ) eof = true ; return c ; |
public class MessageBuilder { /** * Creates a FILE _ HEADER message .
* @ param length the lenght of the file .
* @ return a protobuf message . */
public static Message buildFileHeader ( long length ) { } } | ZabMessage . FileHeader header = ZabMessage . FileHeader . newBuilder ( ) . setLength ( length ) . build ( ) ; return Message . newBuilder ( ) . setType ( MessageType . FILE_HEADER ) . setFileHeader ( header ) . build ( ) ; |
public class ConfigOption { /** * # # # # # HELPER METHODS # # # # # */
public static final < E extends Enum > E getEnumValue ( String str , Class < E > enumClass ) { } } | str = str . trim ( ) ; if ( StringUtils . isBlank ( str ) ) return null ; for ( E e : enumClass . getEnumConstants ( ) ) { if ( e . toString ( ) . equalsIgnoreCase ( str ) ) return e ; } throw new IllegalArgumentException ( "Invalid enum string provided for [" + enumClass + "]: " + str ) ; |
public class CSSDecoder { /** * Returns the length in pixels from a CSS definition . < code > null < / code > values
* of the lengths are interpreted as zero .
* @ param value The length or percentage value to be converted
* @ param auto True , if the property is set to < code > auto < / code >
* @ param defval... | TermLengthOrPercent val = value ; if ( value == null ) val = defval ; if ( auto ) val = autoval ; if ( val != null ) return ( int ) context . pxLength ( val , whole ) ; else return 0 ; |
public class BucketManager { /** * TODO : 准备干掉setImage 、 unsetImage , 重写 */
public Response setImage ( String bucket , String srcSiteUrl , String host ) throws QiniuException { } } | String encodedSiteUrl = UrlSafeBase64 . encodeToString ( srcSiteUrl ) ; String encodedHost = null ; if ( host != null && host . length ( ) > 0 ) { encodedHost = UrlSafeBase64 . encodeToString ( host ) ; } String path = String . format ( "/image/%s/from/%s" , bucket , encodedSiteUrl ) ; if ( encodedHost != null ) { path... |
public class IPv6AddressRange { /** * Extend the range just enough at its head or tail such that the given address is included .
* @ param address address to extend the range to
* @ return new ( bigger ) range */
public IPv6AddressRange extend ( IPv6Address address ) { } } | if ( address . compareTo ( first ) < 0 ) return fromFirstAndLast ( address , last ) ; else if ( address . compareTo ( last ) > 0 ) return fromFirstAndLast ( first , address ) ; else return this ; |
public class XmlMarshaller { /** * 根据结构体 , 构建XML内容 */
private StringBuffer buildXMLNodeByString ( NodeConfig config , int deep ) { } } | StringBuffer xmlBuffer = new StringBuffer ( ) ; String tagName = config . getName ( ) ; if ( isLowCase == true ) { tagName = StringUtils . lowerCase ( config . getName ( ) ) ; } List < Namespace > namespaces = config . getNamespace ( ) ; if ( namespaces != null && namespaces . size ( ) > 0 ) { Namespace namespace = nam... |
public class Capsule3d { /** * Replies the center point of the capsule .
* @ return the center point . */
@ Pure @ Override public Point3d getCenter ( ) { } } | return new Point3d ( ( this . medial1 . getX ( ) + this . medial2 . getX ( ) ) / 2. , ( this . medial1 . getY ( ) + this . medial2 . getY ( ) ) / 2. , ( this . medial1 . getZ ( ) + this . medial2 . getZ ( ) ) / 2. ) ; |
public class RestletUtilSesameRealm { /** * Returns the modifiable list of root groups .
* @ return The modifiable list of root groups . */
public List < Group > getRootGroups ( ) { } } | List < Group > results = this . cachedRootGroups ; if ( results == null ) { synchronized ( this ) { results = this . cachedRootGroups ; if ( results == null ) { results = new ArrayList < Group > ( ) ; RepositoryConnection conn = null ; try { conn = this . getRepository ( ) . getConnection ( ) ; final RepositoryResult <... |
public class FramesHandler { /** * Remove ALL an unlocked frames . Throws IAE for all deletes that failed
* ( perhaps because the Frames were locked & in - use ) . */
@ SuppressWarnings ( "unused" ) // called through reflection by RequestServer
public FramesV3 deleteAll ( int version , FramesV3 frames ) { } } | final Key [ ] keys = KeySnapshot . globalKeysOfClass ( Frame . class ) ; ArrayList < String > missing = new ArrayList < > ( ) ; Futures fs = new Futures ( ) ; for ( Key key : keys ) { try { getFromDKV ( "(none)" , key ) . delete ( null , fs ) ; } catch ( IllegalArgumentException iae ) { missing . add ( key . toString (... |
public class FunctionApplication { /** * Exit and print an error message if debug flag set .
* @ param isDebug flag for print error
* @ param e exception passed in */
static void exitWithError ( Boolean isDebug , Exception e ) { } } | System . err . println ( "Error executing function (Use -x for more information): " + e . getMessage ( ) ) ; if ( isDebug ) { System . err . println ( ) ; System . err . println ( "Error Detail" ) ; System . err . println ( "------------" ) ; e . printStackTrace ( System . err ) ; } System . exit ( 1 ) ; |
public class StrSpliter { /** * 通过正则切分字符串为字符串数组
* @ param str 被切分的字符串
* @ param separatorPattern 分隔符正则 { @ link Pattern }
* @ param limit 限制分片数
* @ param isTrim 是否去除切分字符串后每个元素两边的空格
* @ param ignoreEmpty 是否忽略空串
* @ return 切分后的集合
* @ since 3.0.8 */
public static String [ ] splitToArray ( String str , Patter... | return toArray ( split ( str , separatorPattern , limit , isTrim , ignoreEmpty ) ) ; |
public class Branch { /** * < p > Initialises a session with the Branch API , with associated data from the supplied
* { @ link Uri } . < / p >
* @ param data A { @ link Uri } variable containing the details of the source link that led to this
* initialisation action .
* @ param activity The calling { @ link Ac... | readAndStripParam ( data , activity ) ; return initSession ( ( BranchReferralInitListener ) null , activity ) ; |
public class FoundationLoggingDispatcher { /** * { @ inheritDoc } */
public void run ( ) { } } | boolean isActive = true ; // if interrupted ( unlikely ) , end thread
try { // loop until the AsyncAppender is closed .
while ( isActive ) { LoggingEvent [ ] events = null ; // extract pending events while synchronized
// on buffer
synchronized ( buffer ) { int bufferSize = buffer . size ( ) ; isActive = ! isAsyncAppen... |
public class Config { /** * Extends the runtime classpath to include the files or directories specified .
* @ param files one or more File objects representing a single JAR file or a directory containing JARs .
* @ since 1.0.0 */
public void expandClasspath ( File ... files ) { } } | ClassLoader classLoader = ClassLoader . getSystemClassLoader ( ) ; Class < URLClassLoader > urlClass = URLClassLoader . class ; for ( File file : files ) { LOGGER . info ( "Expanding classpath to include: " + file . getAbsolutePath ( ) ) ; URI fileUri = file . toURI ( ) ; try { Method method = urlClass . getDeclaredMet... |
public class Path { /** * Add a line to the contour or hole which ends at the specified
* location .
* @ param x The x coordinate to draw the line to
* @ param y The y coordiante to draw the line to */
public void lineTo ( float x , float y ) { } } | if ( hole != null ) { hole . add ( new float [ ] { x , y } ) ; } else { localPoints . add ( new float [ ] { x , y } ) ; } cx = x ; cy = y ; pointsDirty = true ; |
public class MapboxMapMatching { /** * Wrapper method for Retrofits { @ link Call # enqueue ( Callback ) } call returning a response specific
* to the Map Matching API . Use this method to make a directions request on the Main Thread .
* @ param callback a { @ link Callback } which is used once the { @ link MapMatc... | getCall ( ) . enqueue ( new Callback < MapMatchingResponse > ( ) { @ Override public void onResponse ( Call < MapMatchingResponse > call , Response < MapMatchingResponse > response ) { MatchingResponseFactory factory = new MatchingResponseFactory ( MapboxMapMatching . this ) ; Response < MapMatchingResponse > generated... |
public class PhoneNumberUtil { /** * parse phone number .
* @ param pphoneNumber phone number as string
* @ param pphoneNumberData phone number data to fill
* @ param pcountryData country data
* @ return PhoneNumberData , the same as in second parameter */
public ValueWithPos < PhoneNumberData > parsePhoneNumbe... | if ( pphoneNumber == null || pphoneNumberData == null ) { return null ; } int cursorpos = pphoneNumber . getPos ( ) ; int cursorpossub = 0 ; for ( int pos = 0 ; pos < cursorpos && pos < StringUtils . length ( pphoneNumber . getValue ( ) ) ; pos ++ ) { final char character = pphoneNumber . getValue ( ) . charAt ( pos ) ... |
public class AbstractResultSetWrapper { /** * { @ inheritDoc }
* @ see java . sql . ResultSet # updateSQLXML ( java . lang . String , java . sql . SQLXML ) */
@ Override public void updateSQLXML ( final String columnLabel , final SQLXML xmlObject ) throws SQLException { } } | wrapped . updateSQLXML ( columnLabel , xmlObject ) ; |
public class ArrayFunctions { /** * Returned expression results in new array with value appended . */
public static Expression arrayAppend ( Expression expression , Expression value ) { } } | return x ( "ARRAY_APPEND(" + expression . toString ( ) + ", " + value . toString ( ) + ")" ) ; |
public class BaseRecordMessageFilter { /** * Are these filters functionally the same ?
* @ return true if they are . */
public boolean isSameFilter ( BaseMessageFilter filter ) { } } | if ( filter . getClass ( ) . equals ( this . getClass ( ) ) ) { if ( this . get ( DB_NAME ) != null ) if ( this . get ( DB_NAME ) . equals ( filter . get ( DB_NAME ) ) ) if ( this . get ( TABLE_NAME ) != null ) if ( this . get ( TABLE_NAME ) . equals ( filter . get ( TABLE_NAME ) ) ) { return true ; } if ( filter . isF... |
public class SimpleExecutionRunnable { /** * Creates InProgress execution message for the next step , base on current execution message - used for short cut ! */
private ExecutionMessage createInProgressExecutionMessage ( Execution nextStepExecution ) { } } | // Take care of worker group
String groupName = nextStepExecution . getGroupName ( ) ; if ( groupName == null ) { groupName = WorkerNode . DEFAULT_WORKER_GROUPS [ 0 ] ; } Long id = queueStateIdGeneratorService . generateStateId ( ) ; // Stay in the same worker in the next step
return new ExecutionMessage ( id , executi... |
public class ThreadObjectHprofGCRoot { /** * ~ Methods - - - - - */
public StackTraceElement [ ] getStackTrace ( ) { } } | int stackTraceSerialNumber = getStackTraceSerialNumber ( ) ; if ( stackTraceSerialNumber != 0 ) { StackTrace stackTrace = heap . getStackTraceSegment ( ) . getStackTraceBySerialNumber ( stackTraceSerialNumber ) ; if ( stackTrace != null ) { StackFrame [ ] frames = stackTrace . getStackFrames ( ) ; StackTraceElement [ ]... |
public class IR { /** * helper methods */
private static Node binaryOp ( Token token , Node expr1 , Node expr2 ) { } } | checkState ( mayBeExpression ( expr1 ) , expr1 ) ; checkState ( mayBeExpression ( expr2 ) , expr2 ) ; return new Node ( token , expr1 , expr2 ) ; |
public class MolfileEncoder { /** * method to compress the given molfile in a gezipped Base64 string
* @ param str given molfile
* @ throws EncoderException */
private static String compress ( String str ) throws EncoderException { } } | ByteArrayOutputStream rstBao = null ; GZIPOutputStream zos = null ; try { rstBao = new ByteArrayOutputStream ( ) ; zos = new GZIPOutputStream ( rstBao ) ; zos . write ( str . getBytes ( ) ) ; IOUtils . closeQuietly ( zos ) ; byte [ ] bytes = rstBao . toByteArray ( ) ; return Base64 . encodeBase64String ( bytes ) ; } ca... |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcOwnerHistory ( ) { } } | if ( ifcOwnerHistoryEClass == null ) { ifcOwnerHistoryEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 343 ) ; } return ifcOwnerHistoryEClass ; |
public class CmsColorSelector { /** * Fires whenever the user generates picking events along the color picker bar . < p >
* @ param y the distance along the y - axis */
public void onBarSelected ( int y ) { } } | switch ( m_colorMode ) { case CmsSliderBar . HUE : m_hue = 360 - percentOf ( y , 360 ) ; m_tbHue . setText ( Integer . toString ( m_hue ) ) ; onChange ( m_tbHue ) ; break ; case CmsSliderBar . SATURATIN : m_saturation = 100 - percentOf ( y , 100 ) ; m_tbSaturation . setText ( Integer . toString ( m_saturation ) ) ; onC... |
public class EventReader { /** * Clean up the message after CPL finishes the processing .
* < li > If the source is filtered out , the message will be deleted with { @ link ProgressState # deleteFilteredMessage } . < / li >
* < li > If the processing is successful , the message with be deleted with { @ link Progres... | if ( filterSourceOut ) { deleteMessageAfterProcessSource ( ProgressState . deleteFilteredMessage , source ) ; } else if ( processSourceSuccess || sqsManager . shouldDeleteMessageUponFailure ( ! downloadLogsSuccess ) ) { deleteMessageAfterProcessSource ( ProgressState . deleteMessage , source ) ; } |
public class CurrentSpanUtils { /** * Wraps a { @ link Runnable } so that it executes with the { @ code span } as the current { @ code Span } .
* @ param span the { @ code Span } to be set as current .
* @ param endSpan if { @ code true } the returned { @ code Runnable } will close the { @ code Span } .
* @ param... | return new RunnableInSpan ( span , runnable , endSpan ) ; |
public class ResourcesInner { /** * Checks by ID whether a resource exists .
* @ param resourceId The fully qualified ID of the resource , including the resource name and resource type . Use the format , / subscriptions / { guid } / resourceGroups / { resource - group - name } / { resource - provider - namespace } / ... | if ( resourceId == null ) { throw new IllegalArgumentException ( "Parameter resourceId is required and cannot be null." ) ; } if ( apiVersion == null ) { throw new IllegalArgumentException ( "Parameter apiVersion is required and cannot be null." ) ; } return service . checkExistenceById ( resourceId , apiVersion , this... |
public class TrackerMeanShiftLikelihood { /** * Updates the target ' s location in the image by performing a mean - shift search . Returns if it was
* successful at finding the target or not . If it fails once it will need to be re - initialized
* @ param image Most recent image in the sequence
* @ return true fo... | if ( failed ) return false ; targetModel . setImage ( image ) ; // mark the region where the pdf has been modified as dirty
dirty . set ( location . x0 , location . y0 , location . x0 + location . width , location . y0 + location . height ) ; // compute the pdf inside the initial rectangle
updatePdfImage ( location . x... |
public class LineBuffer { /** * Clear the entire buffer , and the terminal area it represents . */
public void clear ( ) { } } | if ( buffer . size ( ) > 0 ) { terminal . format ( "\r%s" , CURSOR_ERASE ) ; for ( int i = 1 ; i < buffer . size ( ) ; ++ i ) { terminal . format ( "%s%s" , UP , CURSOR_ERASE ) ; } buffer . clear ( ) ; } |
public class Validator { /** * Add message when validate failure . */
protected void addError ( String errorKey , String errorMessage ) { } } | invalid = true ; controller . setAttr ( errorKey , errorMessage ) ; if ( shortCircuit ) { throw new ValidateException ( ) ; } |
public class MockArtifactStore { /** * { @ inheritDoc } */
public synchronized Set < String > getVersions ( String groupId , String artifactId ) { } } | Map < String , Map < String , Map < Artifact , Content > > > artifactMap = contents . get ( groupId ) ; Map < String , Map < Artifact , Content > > versionMap = ( artifactMap == null ? null : artifactMap . get ( artifactId ) ) ; return new TreeSet < String > ( versionMap == null ? Collections . < String > emptySet ( ) ... |
public class BenchmarkOutputParser { /** * Opens a resource from classpath .
* @ param file
* Filename of resource
* @ return Stream of given file
* @ throws IOException
* Failed to open resource */
private static InputStream openResource ( final String file ) throws IOException { } } | InputStream stream = HtmlConverterApplication . class . getResourceAsStream ( "/" + file ) ; if ( stream == null ) { throw new FileNotFoundException ( file ) ; } else { return stream ; } |
public class ComputeFunction { /** * Sets the new value of this vertex .
* < p > This should be called at most once per ComputeFunction .
* @ param newValue The new vertex value . */
public final void setNewVertexValue ( VV newValue ) { } } | if ( setNewVertexValueCalled ) { throw new IllegalStateException ( "setNewVertexValue should only be called at most once per updateVertex" ) ; } setNewVertexValueCalled = true ; outVertex . f1 = newValue ; out . collect ( Either . Left ( outVertex ) ) ; |
public class Decoder { /** * < p > Decodes a QR Code represented as a { @ link BitMatrix } . A 1 or " true " is taken to mean a black module . < / p >
* @ param bits booleans representing white / black QR Code modules
* @ param hints decoding hints that should be used to influence decoding
* @ return text and byt... | // Construct a parser and read version , error - correction level
BitMatrixParser parser = new BitMatrixParser ( bits ) ; FormatException fe = null ; ChecksumException ce = null ; try { return decode ( parser , hints ) ; } catch ( FormatException e ) { fe = e ; } catch ( ChecksumException e ) { ce = e ; } try { // Reve... |
public class ResolvedTargets { /** * A list of parameter values sent to targets that resolved during the Automation execution .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setParameterValues ( java . util . Collection ) } or { @ link # withParameterValues... | if ( this . parameterValues == null ) { setParameterValues ( new com . amazonaws . internal . SdkInternalList < String > ( parameterValues . length ) ) ; } for ( String ele : parameterValues ) { this . parameterValues . add ( ele ) ; } return this ; |
public class Function { /** * Logging of an Exception in a function with a simple message outputting the name and call parameters of the function
* @ param caller The element that caused the error
* @ param t The thrown Exception
* @ param parameters The method parameters */
protected void logException ( final Ob... | logException ( t , "{}: Exception in '{}' for parameters: {}" , new Object [ ] { getReplacement ( ) , caller , getParametersAsString ( parameters ) } ) ; |
public class FnInteger { /** * It performs the operation target < sup > power < / sup > and returns its value . The result
* precision and rounding mode is specified by the given { @ link MathContext }
* @ param power the power to raise the target to
* @ param mathContext the { @ link MathContext } to specify pre... | return new Pow ( power , mathContext ) ; |
public class AlertPolicyCache { /** * Returns the cache of alert channels for the given policy , creating one if it doesn ' t exist .
* @ param policyId The id of the policy for the cache of alert channels
* @ return The cache of alert channels for the given policy */
public AlertChannelCache alertChannels ( long p... | AlertChannelCache cache = channels . get ( policyId ) ; if ( cache == null ) channels . put ( policyId , cache = new AlertChannelCache ( policyId ) ) ; return cache ; |
public class Sessions { /** * 获取客服聊天记录
* @ param start 开始时间
* @ param end 结束时间
* @ param index 查询第几页
* @ param size 每页大小
* @ return 聊天记录 */
public List < SessionLog > listSessionLogs ( Date start , Date end , int index , int size ) { } } | String url = WxEndpoint . get ( "url.care.session.logs" ) ; Map < String , Object > request = new HashMap < > ( ) ; request . put ( "starttime" , start . getTime ( ) / 1000 ) ; request . put ( "endtime" , end . getTime ( ) / 1000 ) ; request . put ( "pageindex" , index ) ; request . put ( "pagesize" , size ) ; String j... |
public class WebUtils { /** * Put recaptcha settings flow scope .
* @ param context the context
* @ param googleRecaptcha the properties */
public static void putRecaptchaPropertiesFlowScope ( final RequestContext context , final GoogleRecaptchaProperties googleRecaptcha ) { } } | val flowScope = context . getFlowScope ( ) ; flowScope . put ( "recaptchaSiteKey" , googleRecaptcha . getSiteKey ( ) ) ; flowScope . put ( "recaptchaInvisible" , googleRecaptcha . isInvisible ( ) ) ; flowScope . put ( "recaptchaPosition" , googleRecaptcha . getPosition ( ) ) ; flowScope . put ( "recaptchaVersion" , goo... |
public class FileLock { /** * 释放锁 */
public void release ( ) { } } | try { if ( lock != null ) { lock . release ( ) ; } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } finally { if ( channel != null ) { try { channel . close ( ) ; // also releases the lock
} catch ( IOException e ) { LOGGER . error ( "file channel close failed." , e ) ; } } } |
public class Tools { /** * Checks the bilingual input ( bitext ) .
* @ param src Source text .
* @ param trg Target text .
* @ param srcLt Source JLanguageTool ( used to analyze the text ) .
* @ param trgLt Target JLanguageTool ( used to analyze the text ) .
* @ param bRules Bilingual rules used in addition t... | AnalyzedSentence srcText = srcLt . getAnalyzedSentence ( src ) ; AnalyzedSentence trgText = trgLt . getAnalyzedSentence ( trg ) ; List < Rule > nonBitextRules = trgLt . getAllRules ( ) ; List < RuleMatch > ruleMatches = trgLt . checkAnalyzedSentence ( JLanguageTool . ParagraphHandling . NORMAL , nonBitextRules , trgTex... |
public class TypicalLoginAssist { /** * Do actually login for the user by given entity . ( no silent )
* @ param givenEntity The given entity for user . ( NotNull )
* @ param option The option of login specified by caller . ( NotNull ) */
protected void doLoginByGivenEntity ( USER_ENTITY givenEntity , LoginSpecifie... | assertGivenEntityRequired ( givenEntity ) ; handleLoginSuccess ( givenEntity , option ) ; |
public class DockerRule { /** * Return { @ link CLI } for jenkins docker container .
* / / TODO no way specify CliPort ( hacky resolution { @ link DockerCLI } ) */
public DockerCLI createCliForInspect ( InspectContainerResponse inspect ) throws IOException , InterruptedException { } } | LOG . debug ( "Creating CLI for {}" , inspect ) ; Integer httpPort = null ; // CLI mess around ports
Integer cliPort = null ; // should be this
Integer jnlpAgentPort = null ; // but in reality used this
final Map < ExposedPort , Ports . Binding [ ] > bindings = inspect . getNetworkSettings ( ) . getPorts ( ) . getBindi... |
public class ChatRoomClient { /** * Add members to chat room
* @ param roomId chat room id
* @ param members { @ link Members }
* @ return No content
* @ throws APIConnectionException connect exception
* @ throws APIRequestException request exception */
public ResponseWrapper addChatRoomMember ( long roomId ,... | Preconditions . checkArgument ( roomId > 0 , "room id is invalid" ) ; Preconditions . checkArgument ( members != null , "members should not be empty" ) ; return _httpClient . sendPut ( _baseUrl + mChatRoomPath + "/" + roomId + "/members" , members . toString ( ) ) ; |
public class PoolablePreparedStatement { /** * Method setDate .
* @ param parameterIndex
* @ param x
* @ throws SQLException
* @ see java . sql . PreparedStatement # setDate ( int , Date ) */
@ Override public void setDate ( int parameterIndex , Date x ) throws SQLException { } } | internalStmt . setDate ( parameterIndex , x ) ; |
public class BigtableDataGrpcClient { /** * { @ inheritDoc } */
@ Override public ListenableFuture < List < SampleRowKeysResponse > > sampleRowKeysAsync ( SampleRowKeysRequest request ) { } } | if ( shouldOverrideAppProfile ( request . getAppProfileId ( ) ) ) { request = request . toBuilder ( ) . setAppProfileId ( clientDefaultAppProfileId ) . build ( ) ; } return createStreamingListener ( request , sampleRowKeysAsync , request . getTableName ( ) ) . getAsyncResult ( ) ; |
public class BasicDoubleLinkedNode { /** * This method inserts the given { @ code node } into the list immediately before the position represented by this node .
* @ param node is the { @ link BasicDoubleLinkedNode node } to add . */
public void insertAsPrevious ( BasicDoubleLinkedNode < V > node ) { } } | if ( this . previous != null ) { this . previous . setNext ( node ) ; node . previous = this . previous ; } node . setNext ( this ) ; this . previous = node ; |
public class CrumbIssuerDescriptor { /** * Set the request parameter name . Must not be null .
* @ param requestField */
public void setCrumbRequestField ( String requestField ) { } } | if ( Util . fixEmptyAndTrim ( requestField ) == null ) { crumbRequestField = CrumbIssuer . DEFAULT_CRUMB_NAME ; } else { crumbRequestField = requestField ; } |
public class TCAbortMessageImpl { /** * ( non - Javadoc )
* @ see org . restcomm . protocols . ss7 . tcap . asn . Encodable # decode ( org . mobicents . protocols . asn . AsnInputStream ) */
public void decode ( AsnInputStream ais ) throws ParseException { } } | this . destinationTransactionId = null ; this . dp = null ; this . pAbortCause = null ; this . userAbortInformation = null ; try { AsnInputStream localAis = ais . readSequenceStream ( ) ; // transaction portion
TransactionID tid = TcapFactory . readTransactionID ( localAis ) ; if ( tid . getFirstElem ( ) == null || tid... |
public class HazelcastCachingProvider { /** * Create the { @ link java . util . Properties } with the provided config file location .
* @ param configFileLocation the location of the config file to configure
* @ return properties instance pre - configured with the configuration location */
public static Properties ... | Properties properties = new Properties ( ) ; properties . setProperty ( HAZELCAST_CONFIG_LOCATION , configFileLocation ) ; return properties ; |
public class DraggableContainment { /** * Method setting the right parameter
* @ param arrayParam
* Array parameter
* @ param helperEnumParam
* ContainmentEnum parameter
* @ param stringParam
* Selector or Element
* @ param selector
* Selector */
private void setParam ( ArrayItemOptions < IntegerItemOpt... | this . arrayParam = arrayParam ; this . containmentEnumParam = containmentEnumParam ; this . stringParam = stringParam ; this . selector = selector ; |
public class ExpressionTemplate { /** * Generates a { @ link SuggestedFix } replacing the specified match ( usually of another template )
* with this template . */
@ Override public Fix replace ( ExpressionTemplateMatch match ) { } } | Inliner inliner = match . createInliner ( ) ; Context context = inliner . getContext ( ) ; if ( annotations ( ) . containsKey ( UseImportPolicy . class ) ) { ImportPolicy . bind ( context , annotations ( ) . getInstance ( UseImportPolicy . class ) . value ( ) ) ; } else { ImportPolicy . bind ( context , ImportPolicy . ... |
public class CmsEntity { /** * Clones the given entity keeping all entity ids . < p >
* @ return returns the cloned instance */
public CmsEntity cloneEntity ( ) { } } | CmsEntity clone = new CmsEntity ( getId ( ) , getTypeName ( ) ) ; for ( CmsEntityAttribute attribute : getAttributes ( ) ) { if ( attribute . isSimpleValue ( ) ) { List < String > values = attribute . getSimpleValues ( ) ; for ( String value : values ) { clone . addAttributeValue ( attribute . getAttributeName ( ) , va... |
public class FNLPCorpus { /** * 将数据输出到一个文件
* @ param path */
public void writeOne ( String path ) { } } | File f = new File ( path ) ; if ( ! f . getParentFile ( ) . exists ( ) ) { f . getParentFile ( ) . mkdirs ( ) ; } Writer out = null ; try { out = new OutputStreamWriter ( new FileOutputStream ( path ) , "utf8" ) ; Iterator < FNLPDoc > it = docs . iterator ( ) ; while ( it . hasNext ( ) ) { FNLPDoc doc = it . next ( ) ;... |
public class JSLocalConsumerPoint { /** * If a message has been attached to this LCP , detach it and return it
* NOTE : Callers to this method will have the JSLocalConsumerPoint locked
* @ return The message which was attached
* @ throws SIResourceException */
SIMPMessage getAttachedMessage ( ) throws SIResourceE... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getAttachedMessage" , this ) ; SIMPMessage msg = null ; // check if there really is a message attached
if ( _msgAttached ) { // If the message wasn ' t locked when it was attached ( we are a forwardScanning
// consumer ) we... |
public class DefaultAccess { /** * Resumes an in - progress listing of object fields .
* @ param context
* the context of this request
* @ param sessionToken
* the token of the session in which the remaining results can be
* obtained
* @ return the next set of results from the initial field search
* @ thr... | m_authorizationModule . enforceFindObjects ( context ) ; return m_manager . resumeFindObjects ( context , sessionToken ) ; |
public class PasswordEditText { /** * Verifies the strength of the current password , depending on the constraints , which have been
* added and adapts the appearance of the view accordingly . */
private void verifyPasswordStrength ( ) { } } | if ( isEnabled ( ) && ! constraints . isEmpty ( ) && ! TextUtils . isEmpty ( getText ( ) ) ) { float score = getPasswordStrength ( ) ; adaptHelperText ( score ) ; } else { setHelperText ( regularHelperText ) ; } |
public class QuartzSchedulerThread { /** * The main processing loop of the < code > QuartzSchedulerThread < / code > . */
@ Override public void run ( ) { } } | boolean lastAcquireFailed = false ; while ( ! halted . get ( ) ) { try { // check if we ' re supposed to pause . . .
synchronized ( sigLock ) { while ( paused && ! halted . get ( ) ) { try { // wait until togglePause ( false ) is called . . .
sigLock . wait ( 1000L ) ; } catch ( InterruptedException ignore ) { } } if (... |
public class Nfs3 { /** * Convenience method to check String parameters that cannot be blank .
* @ param value The parameter value .
* @ param name The parameter name , for exception messages . */
private void checkForBlank ( String value , String name ) { } } | if ( StringUtils . isBlank ( value ) ) { throw new IllegalArgumentException ( name + " cannot be empty" ) ; } |
public class SEPWorker { /** * collection at the same time */
private void startSpinning ( ) { } } | assert get ( ) == Work . WORKING ; pool . spinningCount . incrementAndGet ( ) ; set ( Work . SPINNING ) ; |
public class SEPAParserFactory { /** * Gibt den passenden SEPA Parser für die angegebene PAIN - Version .
* @ param version die PAIN - Version .
* @ return ISEPAParser */
public static ISEPAParser get ( SepaVersion version ) { } } | ISEPAParser parser = null ; String className = version . getParserClass ( ) ; try { log . debug ( "trying to init SEPA parser: " + className ) ; Class cl = Class . forName ( className ) ; parser = ( ISEPAParser ) cl . newInstance ( ) ; } catch ( Exception e ) { String msg = "Error creating SEPA parser" ; throw new HBCI... |
public class ParameterUtil { /** * Get child dependent parameters
* @ param params list of parameters
* @ param p current parameter
* @ return a map of all parameters that use the current parameter in theirs source definition */
public static Map < String , QueryParameter > getChildDependentParameters ( List < Qu... | Map < String , QueryParameter > result = new HashMap < String , QueryParameter > ( ) ; for ( QueryParameter param : params ) { if ( ! param . equals ( p ) ) { if ( param . isDependent ( ) ) { List < String > names = param . getDependentParameterNames ( ) ; if ( names . contains ( p . getName ( ) ) ) { result . put ( pa... |
public class CmsJspCategoryAccessBean { /** * Returns all categories that are direct children of the current main category .
* @ return all categories that are direct children of the current main category . */
public List < CmsCategory > getTopItems ( ) { } } | List < CmsCategory > categories = new ArrayList < CmsCategory > ( ) ; String matcher = Pattern . quote ( m_mainCategoryPath ) + "[^/]*/" ; for ( CmsCategory category : m_categories ) { if ( category . getPath ( ) . matches ( matcher ) ) { categories . add ( category ) ; } } return categories ; |
public class GeomUtil { /** * Get a line between two points in a shape
* @ param shape The shape
* @ param sx The x coordinate of the start point
* @ param sy The y coordinate of the start point
* @ param e The index of the end point
* @ return The line between the two points */
public Line getLine ( Shape sh... | float [ ] end = shape . getPoint ( e ) ; Line line = new Line ( sx , sy , end [ 0 ] , end [ 1 ] ) ; return line ; |
public class PFCImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . PFC__PFC_FLGS : return PFC_FLGS_EDEFAULT == null ? pfcFlgs != null : ! PFC_FLGS_EDEFAULT . equals ( pfcFlgs ) ; case AfplibPackage . PFC__TRIPLETS : return triplets != null && ! triplets . isEmpty ( ) ; } return super . eIsSet ( featureID ) ; |
public class LambdaFactory { /** * Convenience wrapper for { @ link # createLambda ( String , TypeReference ) }
* which throws unchecked exception instead of checked one .
* @ see # createLambda ( String , TypeReference ) */
public < T > T createLambdaUnchecked ( String code , TypeReference < T > type ) { } } | try { return createLambda ( code , type ) ; } catch ( LambdaCreationException e ) { throw new LambdaCreationRuntimeException ( e ) ; } |
public class XmlConfiguration { /** * Call a set method . This method makes a best effort to find a matching set method . The type of
* the value is used to find a suitable set method by 1 . Trying for a trivial type match . 2.
* Looking for a native type match . 3 . Trying all correctly named methods for an auto
... | String attr = node . getAttribute ( "name" ) ; String name = "set" + attr . substring ( 0 , 1 ) . toUpperCase ( ) + attr . substring ( 1 ) ; Object value = value ( obj , node ) ; Object [ ] arg = { value } ; Class oClass = nodeClass ( node ) ; if ( oClass != null ) obj = null ; else oClass = obj . getClass ( ) ; Class ... |
public class ImgUtil { /** * 获取 { @ link ImageOutputStream }
* @ param out { @ link OutputStream }
* @ return { @ link ImageOutputStream }
* @ throws IORuntimeException IO异常
* @ since 3.1.2 */
public static ImageOutputStream getImageOutputStream ( OutputStream out ) throws IORuntimeException { } } | try { return ImageIO . createImageOutputStream ( out ) ; } catch ( IOException e ) { throw new IORuntimeException ( e ) ; } |
public class CommonDictionaryMaker { /** * 同compute
* @ param sentenceList */
public void learn ( List < Sentence > sentenceList ) { } } | List < List < IWord > > s = new ArrayList < List < IWord > > ( sentenceList . size ( ) ) ; for ( Sentence sentence : sentenceList ) { s . add ( sentence . wordList ) ; } compute ( s ) ; |
public class Assertions { /** * Assert condition flag is TRUE . GEL will be notified about error .
* @ param message message describing situation
* @ param condition condition which must be true
* @ throws AssertionError if the condition is not true
* @ since 1.0 */
public static void assertTrue ( @ Nullable fi... | if ( ! condition ) { final AssertionError error = new AssertionError ( GetUtils . ensureNonNull ( message , "Condition must be TRUE" ) ) ; MetaErrorListeners . fireError ( error . getMessage ( ) , error ) ; throw error ; } |
public class UnpeerVpcRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UnpeerVpcRequest unpeerVpcRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( unpeerVpcRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class UpdateClusterRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateClusterRequest updateClusterRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateClusterRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateClusterRequest . getClusterId ( ) , CLUSTERID_BINDING ) ; protocolMarshaller . marshall ( updateClusterRequest . getRoleARN ( ) , ROLEARN_BINDING ) ; protocol... |
public class ClientService { /** * Return all Clients for a profile
* @ param profileId ID of profile clients belong to
* @ return collection of the Clients found
* @ throws Exception exception */
public List < Client > findAllClients ( int profileId ) throws Exception { } } | ArrayList < Client > clients = new ArrayList < Client > ( ) ; PreparedStatement query = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { query = sqlConnection . prepareStatement ( "SELECT * FROM " + Constants . DB_TABLE_CLIENT + " WHERE " + Constants . GENERIC_PROFIL... |
public class IPv6AddressHelpers { /** * Replaces a w . x . y . z substring at the end of the given string with corresponding hexadecimal notation . This is useful in case the
* string was using IPv4 - Mapped address notation . */
static String rewriteIPv4MappedNotation ( String string ) { } } | if ( ! string . contains ( "." ) ) { return string ; } else { int lastColon = string . lastIndexOf ( ":" ) ; String firstPart = string . substring ( 0 , lastColon + 1 ) ; String mappedIPv4Part = string . substring ( lastColon + 1 ) ; if ( mappedIPv4Part . contains ( "." ) ) { String [ ] dotSplits = DOT_DELIM . split ( ... |
public class NumberConverter { /** * 转换为BigInteger < br >
* 如果给定的值为空 , 或者转换失败 , 返回默认值 < br >
* 转换失败不会报错
* @ param value 被转换的值
* @ return 结果 */
private BigInteger toBigInteger ( Object value ) { } } | if ( value instanceof Long ) { return BigInteger . valueOf ( ( Long ) value ) ; } else if ( value instanceof Boolean ) { return BigInteger . valueOf ( ( boolean ) value ? 1 : 0 ) ; } final String valueStr = convertToStr ( value ) ; if ( StrUtil . isBlank ( valueStr ) ) { return null ; } return new BigInteger ( valueStr... |
public class ExecutorHealthChecker { /** * Groups Executable flow by Executors to reduce number of REST calls .
* @ return executor to list of flows map */
private Map < Optional < Executor > , List < ExecutableFlow > > getFlowToExecutorMap ( ) { } } | final HashMap < Optional < Executor > , List < ExecutableFlow > > exFlowMap = new HashMap < > ( ) ; try { for ( final Pair < ExecutionReference , ExecutableFlow > runningFlow : this . executorLoader . fetchActiveFlows ( ) . values ( ) ) { final Optional < Executor > executor = runningFlow . getFirst ( ) . getExecutor (... |
public class DefaultCacheableResourceService { /** * Download and copy the resource for use .
* @ param resourceLocation { @ link String } , the resource location
* @ param type { @ link ResourceType } , the type of resource
* @ return the resource copy { @ link File } ready for processing
* @ throws ResourceDo... | File downloadResource = downloadResource ( resourceLocation , type ) ; return copyResource ( downloadResource , resourceLocation ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.