signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class EJSContainer { /** * addBean */
public boolean lockBean ( BeanO beanO , ContainerTx containerTx ) throws RemoteException { } } | return activator . lockBean ( containerTx , beanO . beanId ) ; // d140003.29 |
public class ImageMiscOps { /** * Rotates the image 90 degrees in the clockwise direction . */
public static void rotateCW ( GrayS32 input , GrayS32 output ) { } } | if ( input . width != output . height || input . height != output . width ) throw new IllegalArgumentException ( "Incompatible shapes" ) ; int h = input . height - 1 ; for ( int y = 0 ; y < input . height ; y ++ ) { int indexIn = input . startIndex + y * input . stride ; for ( int x = 0 ; x < input . width ; x ++ ) { o... |
public class Char { /** * Decodes all ampersand sequences in the string */
public static String decodeAmpersand ( String s ) { } } | if ( s == null || s . indexOf ( '&' ) == - 1 ) return ( s ) ; StringBuilder result = new StringBuilder ( ) ; int [ ] eatLength = new int [ 1 ] ; // add this in order to multithread safe
while ( s . length ( ) != 0 ) { char c = eatAmpersand ( s , eatLength ) ; if ( eatLength [ 0 ] > 1 ) { result . append ( c ) ; s = s .... |
public class OrderNoteUrl { /** * Get Resource Url for GetReturnNote
* @ param noteId Unique identifier of a particular note to retrieve .
* @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter should only be used t... | UrlFormatter formatter = new UrlFormatter ( "/api/commerce/returns/{returnId}/notes/{noteId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "noteId" , noteId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "returnId" , returnId ) ; return new MozuUrl ( formatter .... |
public class SwingUtil { /** * Center the given window within the screen boundaries .
* @ param window the window to be centered . */
public static void centerWindow ( Window window ) { } } | Rectangle bounds ; try { bounds = GraphicsEnvironment . getLocalGraphicsEnvironment ( ) . getDefaultScreenDevice ( ) . getDefaultConfiguration ( ) . getBounds ( ) ; } catch ( Throwable t ) { Toolkit tk = window . getToolkit ( ) ; Dimension ss = tk . getScreenSize ( ) ; bounds = new Rectangle ( ss ) ; } int width = wind... |
public class WebGL10 { /** * < p > { @ code glAttachShader } attaches the shader object specified by { @ code shaderID } to the program object
* specified by { @ code programID } . This indicates that shader will be included in link operations that will be
* performed on program . < / p >
* < p > { @ link # GL _ ... | checkContextCompatibility ( ) ; JavaScriptObject program = WebGLObjectMap . get ( ) . toProgram ( programID ) ; JavaScriptObject shader = WebGLObjectMap . get ( ) . toShader ( shaderID ) ; nglAttachShader ( program , shader ) ; |
public class StructrCMISService { /** * - - - - - interface CmisService - - - - - */
@ Override public void deleteObjectOrCancelCheckOut ( String repositoryId , String objectId , Boolean allVersions , ExtensionsData extension ) { } } | objectService . deleteObject ( repositoryId , objectId , allVersions , extension ) ; |
public class CompactingHashTable { /** * Replaces record in hash table if record already present or append record if not .
* May trigger expensive compaction .
* @ param record record to insert or replace
* @ param tempHolder instance of T that will be overwritten
* @ throws IOException */
public void insertOrR... | final int searchHashCode = hash ( this . buildSideComparator . hash ( record ) ) ; final int posHashCode = searchHashCode % this . numBuckets ; // get the bucket for the given hash code
MemorySegment originalBucket = this . buckets [ posHashCode >> this . bucketsPerSegmentBits ] ; int originalBucketOffset = ( posHashCo... |
public class SSLContext { /** * Cipher Suite available for negotiation in SSL handshake .
* < br >
* This complex directive uses a colon - separated cipher - spec string consisting
* of OpenSSL cipher specifications to configure the Cipher Suite the client
* is permitted to negotiate in the SSL handshake phase ... | return setCipherSuite ( ctx , ciphers , false ) ; |
public class AWSDeviceFarmClient { /** * Deletes the run , given the run ARN .
* < b > Note < / b > Deleting this resource does not stop an in - progress run .
* @ param deleteRunRequest
* Represents a request to the delete run operation .
* @ return Result of the DeleteRun operation returned by the service .
... | request = beforeClientExecution ( request ) ; return executeDeleteRun ( request ) ; |
public class HldSeSelEntityProcNms { /** * < p > Get processor name for Entity with file delete . < / p >
* @ param pClass a Class
* @ return a thing */
protected final String getForFDelete ( final Class < ? > pClass ) { } } | if ( SeGoodsSpecifics . class == pClass || SeServiceSpecifics . class == pClass ) { return PrcEntityFDelete . class . getSimpleName ( ) ; } return null ; |
public class PrcPaymentToSave { /** * < p > Make save preparations before insert / update block if it ' s need . < / p >
* @ param pAddParam additional param
* @ param pEntity entity
* @ param pRequestData Request Data
* @ throws Exception - an exception */
@ Override public final void makeFirstPrepareForSave (... | // BeigeORM refresh :
pEntity . setAccCash ( getSrvOrm ( ) . retrieveEntity ( pAddParam , pEntity . getAccCash ( ) ) ) ; if ( pEntity . getAccCash ( ) . getSubaccType ( ) != null && pEntity . getSubaccCashId ( ) == null ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "select_subaccount" ) ; } if... |
public class DefaultCommandMethodVerifier { /** * Verify a { @ link CommandMethod } with its { @ link CommandSegments } . This method verifies that the command exists and that
* the required number of arguments is declared .
* @ param commandSegments
* @ param commandMethod */
public void validate ( CommandSegmen... | LettuceAssert . notEmpty ( commandSegments . getCommandType ( ) . name ( ) , "Command name must not be empty" ) ; CommandDetail commandDetail = findCommandDetail ( commandSegments . getCommandType ( ) . name ( ) ) . orElseThrow ( ( ) -> syntaxException ( commandSegments . getCommandType ( ) . name ( ) , commandMethod )... |
public class StorageReader { /** * Read the data at the given offset , the data can be spread over multiple data buffers */
private byte [ ] getMMapBytes ( long offset ) throws IOException { } } | // Read the first 4 bytes to get the size of the data
ByteBuffer buf = getDataBuffer ( offset ) ; int maxLen = ( int ) Math . min ( 5 , dataSize - offset ) ; int size ; if ( buf . remaining ( ) >= maxLen ) { // Continuous read
int pos = buf . position ( ) ; size = LongPacker . unpackInt ( buf ) ; // Used in case of dat... |
public class LazyReact { /** * Start a reactive flow from a Collection using an Iterator
* < pre >
* { @ code
* new LazyReact ( 10,10 ) . from ( myList )
* . map ( this : : process ) ;
* < / pre >
* @ param collection - Collection SimpleReact will iterate over at the skip of the flow
* @ return FutureStre... | return fromStream ( collection . stream ( ) ) ; |
public class MultiBuf { /** * Reads data from the channel and appends it to the buffer .
* Precondition : received event that the channel has data to be read . */
@ Override public int append ( ReadableByteChannel channel ) throws IOException { } } | assert invariant ( true ) ; int totalRead = 0 ; try { boolean done ; // precondition : the channel has data
do { ByteBuffer dest = writableBuf ( ) ; int space = dest . remaining ( ) ; assert space > 0 ; int read = channel . read ( dest ) ; if ( read >= 0 ) { totalRead += read ; } else { // end of stream ( e . g . the o... |
public class StreamMetrics { /** * This method increments the counter of failed Stream deletions in the system as well as the failed deletion
* attempts for this specific Stream .
* @ param scope Scope .
* @ param streamName Name of the Stream . */
public void deleteStreamFailed ( String scope , String streamName... | DYNAMIC_LOGGER . incCounterValue ( globalMetricName ( DELETE_STREAM_FAILED ) , 1 ) ; DYNAMIC_LOGGER . incCounterValue ( DELETE_STREAM_FAILED , 1 , streamTags ( scope , streamName ) ) ; |
public class BeanMapping { /** * 创建srcClass和targetClass之间的BeanMapping操作 */
public static BeanMapping create ( Class srcClass , Class targetClass ) { } } | BeanMappingObject config = BeanMappingConfigHelper . getInstance ( ) . getBeanMappingObject ( srcClass , targetClass ) ; if ( config == null ) { throw new BeanMappingException ( "can not found mapping config for srcClass[" + srcClass . toString ( ) + "] targetClass[" + targetClass + "]" ) ; } return new BeanMapping ( c... |
public class TableCellWithActionExample { /** * Creates and configures the table to be used by the example . The table is configured with global rather than user
* data . Although this is not a realistic scenario , it will suffice for this example .
* @ return a new configured table . */
private WDataTable createTa... | WDataTable table = new WDataTable ( ) ; table . addColumn ( new WTableColumn ( "First name" , new WTextField ( ) ) ) ; table . addColumn ( new WTableColumn ( "Last name" , new WTextField ( ) ) ) ; table . addColumn ( new WTableColumn ( "DOB" , new WDateField ( ) ) ) ; table . addColumn ( new WTableColumn ( "Action" , n... |
public class PersonGroupPersonsImpl { /** * Create a new person in a specified person group .
* @ param personGroupId Id referencing a particular person group .
* @ param createOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException t... | return createWithServiceResponseAsync ( personGroupId , createOptionalParameter ) . map ( new Func1 < ServiceResponse < Person > , Person > ( ) { @ Override public Person call ( ServiceResponse < Person > response ) { return response . body ( ) ; } } ) ; |
public class SBGNLayoutManager { /** * This method replaces ports of arc objects with their owners .
* @ param arcs Arc list of SBGN model */
private void removePortsFromArcs ( List < Arc > arcs ) { } } | for ( Arc arc : arcs ) { // If source is port , first clear port indicators else retrieve it from hashmaps
if ( arc . getSource ( ) instanceof Port ) { Glyph source = portIDToOwnerGlyph . get ( ( ( Port ) arc . getSource ( ) ) . getId ( ) ) ; arc . setSource ( source ) ; } // If target is port , first clear port indica... |
public class Task { /** * Blocks until the task is complete or times out .
* @ return { @ code true } if the task completed ( has a result , an error , or was cancelled ) .
* { @ code false } otherwise . */
public boolean waitForCompletion ( long duration , TimeUnit timeUnit ) throws InterruptedException { } } | synchronized ( lock ) { if ( ! isCompleted ( ) ) { lock . wait ( timeUnit . toMillis ( duration ) ) ; } return isCompleted ( ) ; } |
public class NmeaStreamProcessor { /** * Returns the index of the closest matching message in terms of arrival
* time . Matching equates to having a referenced checksum . If not found
* returns null . If there is a problem parsing the message an
* { @ link AisParseException } is thrown .
* @ param time
* @ pa... | // find the closest matching ais message in terms of arrival time
Long lowestTimeDiff = null ; Integer lowestTimeDiffIndex = null ; for ( int i = 0 ; i < getNumLines ( ) ; i ++ ) { String msg = getLine ( i ) ; Long msgTime = getLineTime ( i ) ; if ( ! isExactEarthTimestamp ( msg ) ) { try { AisNmeaMessage nmea = new Ai... |
public class TransportProtocol { /** * Disconnect from the remote host . No more messages can be sent after this
* method has been called .
* @ param reason
* @ param disconnectReason
* , description
* @ throws IOException */
public void disconnect ( int reason , String disconnectReason ) { } } | ByteArrayWriter baw = new ByteArrayWriter ( ) ; try { this . disconnectReason = disconnectReason ; baw . write ( SSH_MSG_DISCONNECT ) ; baw . writeInt ( reason ) ; baw . writeString ( disconnectReason ) ; baw . writeString ( "" ) ; Log . info ( this , "Sending SSH_MSG_DISCONNECT [" + disconnectReason + "]" ) ; sendMess... |
public class PubSubCommandHandler { /** * Check whether { @ link ResponseHeaderReplayOutput } contains a Pub / Sub message that requires Pub / Sub dispatch instead of to
* be used as Command output .
* @ param replay
* @ return */
private static boolean isPubSubMessage ( ResponseHeaderReplayOutput < ? , ? > repla... | if ( replay == null ) { return false ; } String firstElement = replay . firstElement ; if ( replay . multiCount != null && firstElement != null ) { if ( replay . multiCount == 3 && firstElement . equalsIgnoreCase ( PubSubOutput . Type . message . name ( ) ) ) { return true ; } if ( replay . multiCount == 4 && firstElem... |
public class KeyValuePairKeyComparator { /** * { @ inheritDoc } */
@ Override public int compare ( final KeyValuePair < K , V > o1 , final KeyValuePair < K , V > o2 ) { } } | return o1 . getKey ( ) . compareTo ( o2 . getKey ( ) ) ; |
public class WssServiceClientImpl { /** * The method extract the data from the given { @ link org . whitesource . agent . api . dispatch . ResultEnvelope } .
* @ param response HTTP response as string .
* @ return String with logical result in JSON format .
* @ throws IOException
* @ throws WssServiceException ... | // parse response
ResultEnvelope envelope = gson . fromJson ( response , ResultEnvelope . class ) ; if ( envelope == null ) { throw new WssServiceException ( "Empty response, response data is: " + response ) ; } // extract info from envelope
String message = envelope . getMessage ( ) ; String data = envelope . getData ... |
public class DatabasesInner { /** * Add Database principals permissions .
* @ param resourceGroupName The name of the resource group containing the Kusto cluster .
* @ param clusterName The name of the Kusto cluster .
* @ param databaseName The name of the database in the Kusto cluster .
* @ param value The lis... | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( clusterName == null ) { throw new IllegalArgumentException ( "Parameter clusterName is required and cannot be null." ) ; } if ( databaseName == null ) { throw new IllegalArgum... |
import java . util . * ; class Main { /** * This function creates a list by inserting given string after every element of the input tuple .
* > > > insert _ string ( { 5 , 6 , 7 , 4 , 9 } , ' FDF ' )
* [ 5 , ' FDF ' , 6 , ' FDF ' , 7 , ' FDF ' , 4 , ' FDF ' , 9 , ' FDF ' ]
* > > > insert _ string ( { 7 , 8 , 9 , ... | List < Object > result = new ArrayList < > ( ) ; for ( Integer ele : inputList ) { result . add ( ele ) ; result . add ( inputStr ) ; } return result ; |
public class JWTPayload { /** * Sets the subject claim identifying the principal that is the subject of the JWT or { @ code null } for none .
* Overriding is only supported for the purpose of calling the super implementation and changing
* the return type , but nothing else . */
public JWTPayload setSubject ( Strin... | this . subject = subject ; this . put ( PayloadConstants . SUBJECT , subject ) ; return this ; |
public class KafkaSimpleStreamingExtractor { /** * Return the next record when available . Will never time out since this is a streaming source . */
@ Override public RecordEnvelope < D > readRecordEnvelopeImpl ( ) throws DataRecordException , IOException { } } | if ( ! _isStarted . get ( ) ) { throw new IOException ( "Streaming extractor has not been started." ) ; } while ( ( _records == null ) || ( ! _records . hasNext ( ) ) ) { synchronized ( _consumer ) { if ( _close . get ( ) ) { throw new ClosedChannelException ( ) ; } _records = _consumer . poll ( this . fetchTimeOut ) .... |
public class TransformerFactoryImpl { /** * Look up the value of a feature .
* < p > The feature name is any fully - qualified URI . It is
* possible for an TransformerFactory to recognize a feature name but
* to be unable to return its value ; this is especially true
* in the case of an adapter for a SAX1 Pars... | // feature name cannot be null
if ( name == null ) { throw new NullPointerException ( XSLMessages . createMessage ( XSLTErrorResources . ER_GET_FEATURE_NULL_NAME , null ) ) ; } // Try first with identity comparison , which
// will be faster .
if ( ( DOMResult . FEATURE == name ) || ( DOMSource . FEATURE == name ) || ( ... |
public class CommerceShippingFixedOptionRelUtil { /** * Returns the commerce shipping fixed option rel with the primary key or throws a { @ link NoSuchShippingFixedOptionRelException } if it could not be found .
* @ param commerceShippingFixedOptionRelId the primary key of the commerce shipping fixed option rel
* @... | return getPersistence ( ) . findByPrimaryKey ( commerceShippingFixedOptionRelId ) ; |
public class RTMPProtocolEncoder { /** * { @ inheritDoc } */
public IoBuffer encodeBytesRead ( BytesRead bytesRead ) { } } | final IoBuffer out = IoBuffer . allocate ( 4 ) ; out . putInt ( bytesRead . getBytesRead ( ) ) ; return out ; |
public class StringParser { /** * Parse the given { @ link String } as unsigned { @ link Integer } with radix
* { @ link # DEFAULT _ RADIX } .
* @ param sStr
* The string to parse . May be < code > null < / code > .
* @ param aDefault
* The default value to be returned if the passed string could not be
* co... | return parseUnsignedIntObj ( sStr , DEFAULT_RADIX , aDefault ) ; |
public class Params { /** * Test if file parameter is not null and has not empty path .
* @ param parameter invocation file parameter ,
* @ param name the name of invocation parameter .
* @ throws IllegalArgumentException if < code > parameter < / code > is null or its path is empty . */
public static void notNul... | if ( parameter == null || parameter . getPath ( ) . isEmpty ( ) ) { throw new IllegalArgumentException ( name + " path is null or empty." ) ; } |
public class SessionMapper { /** * Remove all non - serializable fields from session . */
public void sessionWillPassivate ( HttpSessionEvent event ) { } } | for ( Entry < String , SessionFieldMapper > entry : this . entrySet ( ) ) { if ( ! entry . getValue ( ) . serializable ) { event . getSession ( ) . removeAttribute ( entry . getKey ( ) ) ; } } |
public class MultiInstanceActivityBehavior { @ SuppressWarnings ( "rawtypes" ) protected int resolveNrOfInstances ( DelegateExecution execution ) { } } | if ( loopCardinalityExpression != null ) { return resolveLoopCardinality ( execution ) ; } else if ( usesCollection ( ) ) { Collection collection = resolveAndValidateCollection ( execution ) ; return collection . size ( ) ; } else { throw new ActivitiIllegalArgumentException ( "Couldn't resolve collection expression no... |
public class CmsUIServlet { /** * Sets the current cms context . < p >
* @ param cms the current cms context to set */
public synchronized void setCms ( CmsObject cms ) { } } | if ( m_perThreadCmsObject == null ) { m_perThreadCmsObject = new ThreadLocal < CmsObject > ( ) ; } m_perThreadCmsObject . set ( cms ) ; |
public class CalendarThinTableModel { /** * Notify listeners this row is selected ; pass a - 1 to de - select all rows . */
public void fireTableRowSelected ( Object source , int iRowIndex , int iSelectionType ) { } } | this . fireMySelectionChanged ( new MyListSelectionEvent ( source , this , iRowIndex , iSelectionType ) ) ; |
public class Util { /** * Adapted from { @ code com . google . common . io . ByteStreams . toByteArray ( ) } . */
public static byte [ ] toByteArray ( InputStream in ) throws IOException { } } | checkNotNull ( in , "in" ) ; try { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; copy ( in , out ) ; return out . toByteArray ( ) ; } finally { ensureClosed ( in ) ; } |
public class StringUtils { /** * Returns true if given text contains given word ; false otherwise .
* @ param text string text to be tested .
* @ param word string word to be tested .
* @ return true if given text contains given word ; false otherwise . */
public static boolean containsWord ( final String text , ... | if ( text == null || word == null ) { return false ; } if ( text . contains ( word ) ) { Matcher matcher = matchText ( text ) ; for ( ; matcher . find ( ) ; ) { String matchedWord = matcher . group ( 0 ) ; if ( matchedWord . equals ( word ) ) { return true ; } } } return false ; |
public class BinomialBoundsN { /** * The above remarks about specialNStar ( ) also apply here . */
private static long specialNPrimeB ( final long numSamplesI , final double p , final double delta ) { } } | final double q , numSamplesF , oneMinusDelta ; double tot , curTerm ; long m ; assertTrue ( numSamplesI >= 1 ) ; assertTrue ( ( 0.0 < p ) && ( p < 1.0 ) ) ; assertTrue ( ( 0.0 < delta ) && ( delta < 1.0 ) ) ; q = 1.0 - p ; oneMinusDelta = 1.0 - delta ; numSamplesF = numSamplesI ; curTerm = Math . pow ( p , numSamplesF ... |
public class JsonRequestHandler { /** * Handle a request for a single server and throw an
* { @ link javax . management . InstanceNotFoundException }
* if the request cannot be handle by the provided server .
* Does a check for restrictions as well
* @ param pServer server to try
* @ param pRequest request to... | checkForRestriction ( pRequest ) ; checkHttpMethod ( pRequest ) ; return doHandleRequest ( pServer , pRequest ) ; |
public class EntitySerDe { /** * Deserialize the entity field that has a keyAsColumn mapping .
* @ param fieldName
* The name of the entity ' s field we are deserializing .
* @ param family
* The column family this field is mapped to
* @ param prefix
* The column qualifier prefix each
* @ param result
*... | // Construct a map of keyAsColumn field values . From this we ' ll be able
// to use the entityComposer to construct the entity field value .
byte [ ] prefixBytes = prefix != null ? prefix . getBytes ( ) : null ; Map < CharSequence , Object > fieldValueAsMap = new HashMap < CharSequence , Object > ( ) ; Map < byte [ ] ... |
public class PrcManufacturingProcessSave { /** * < p > Make save preparations before insert / update block if it ' s need . < / p >
* @ param pAddParam additional param
* @ param pEntity entity
* @ param pRequestData Request Data
* @ throws Exception - an exception */
@ Override public final void makeFirstPrepa... | if ( pEntity . getItsQuantity ( ) . doubleValue ( ) == 0 ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "Quantity is 0! " + pAddParam . get ( "user" ) ) ; } pEntity . setInvItem ( getSrvOrm ( ) . retrieveEntity ( pAddParam , pEntity . getInvItem ( ) ) ) ; if ( ! InvItem . WORK_IN_PROGRESS_ID . ... |
public class LightWeightBitSet { /** * Set the bit for the given position to false .
* @ param bits - bitset
* @ param pos - position to be set to false */
public static void clear ( long [ ] bits , int pos ) { } } | int offset = pos >> LONG_SHIFT ; if ( offset >= bits . length ) throw new IndexOutOfBoundsException ( ) ; bits [ offset ] &= ~ ( 1L << pos ) ; |
public class RadialCounter { /** * < editor - fold defaultstate = " collapsed " desc = " Visualization " > */
@ Override protected void paintComponent ( Graphics g ) { } } | if ( ! isInitialized ( ) ) { return ; } final Graphics2D G2 = ( Graphics2D ) g . create ( ) ; G2 . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; G2 . setRenderingHint ( RenderingHints . KEY_RENDERING , RenderingHints . VALUE_RENDER_QUALITY ) ; G2 . setRenderingHint ( Ren... |
public class YearView { /** * ~ Methoden - - - - - */
@ Override protected void buildContent ( ) { } } | for ( int i = 0 , n = this . getCalendarSystem ( ) . getMaxCountOfMonths ( ) ; i < n ; i ++ ) { Button button = new Button ( ) ; button . getStyleClass ( ) . add ( CSS_CALENDAR_CELL_INSIDE_RANGE ) ; button . setMaxWidth ( Double . MAX_VALUE ) ; button . setMaxHeight ( Double . MAX_VALUE ) ; GridPane . setVgrow ( button... |
public class CustomTypeface { /** * This is a shortcut to let { @ code CustomTypeface } create directly a { @ link Typeface }
* for you . This will create the Typeface from a file located in the assets directory .
* For more information see the { @ link # registerTypeface ( String , Typeface ) } method .
* @ para... | Typeface typeface = Typeface . createFromAsset ( assets , filePath ) ; mTypefaces . put ( typefaceName , typeface ) ; |
public class DefaultGroovyMethods { /** * Finds all elements of the array matching the given Closure condition .
* < pre class = " groovyTestCase " >
* def items = [ 1,2,3,4 ] as Integer [ ]
* assert [ 2,4 ] = = items . findAll { it % 2 = = 0 }
* < / pre >
* @ param self an array
* @ param condition a closu... | Collection < T > answer = new ArrayList < T > ( ) ; return findAll ( condition , answer , new ArrayIterator < T > ( self ) ) ; |
public class BpmnParse { /** * Parses the messages of the given definitions file . Messages are not
* contained within a process element , but they can be referenced from inner
* process elements . */
public void parseMessages ( ) { } } | for ( Element messageElement : rootElement . elements ( "message" ) ) { String id = messageElement . attribute ( "id" ) ; String messageName = messageElement . attribute ( "name" ) ; Expression messageExpression = null ; if ( messageName != null ) { messageExpression = expressionManager . createExpression ( messageName... |
public class CmsLink { /** * Returns the first parameter value for the given parameter name . < p >
* @ param name the name of the parameter
* @ return the first value for this name or < code > null < / code > */
public String getParameter ( String name ) { } } | String [ ] p = getParameterMap ( ) . get ( name ) ; if ( p != null ) { return p [ 0 ] ; } return null ; |
public class MysqlExportService { /** * This is the entry point for exporting
* the database . It performs validation and
* the initial object initializations ,
* database connection and setup
* before ca
* @ throws IOException exception
* @ throws SQLException exception
* @ throws ClassNotFoundException ... | // check if properties is set or not
if ( ! isValidateProperties ( ) ) { logger . error ( "Invalid config properties: The config properties is missing important parameters: DB_NAME, DB_USERNAME and DB_PASSWORD" ) ; return ; } // connect to the database
database = properties . getProperty ( DB_NAME ) ; String jdbcURL = ... |
public class BuildWrapper { /** * Provides an opportunity for a { @ link BuildWrapper } to decorate a { @ link Launcher } to be used in the build .
* This hook is called very early on in the build ( even before { @ link # setUp ( AbstractBuild , Launcher , BuildListener ) } is invoked . )
* The typical use of { @ l... | return launcher ; |
public class Schematic { /** * Returns a DB with reads the given input stream as a configuration document { @ code Document } . This document is
* expected to contain a { @ link Schematic # TYPE _ FIELD type field } to indicate the type
* of DB .
* @ see # getDb ( Document , ClassLoader )
* @ throws ParsingExce... | Document document = Json . read ( configInputStream ) . withVariablesReplacedWithSystemProperties ( ) ; return getDb ( document , Schematic . class . getClassLoader ( ) ) ; |
public class DeviceImpl { public DevCmdInfo_2 command_query_2 ( final String command ) throws DevFailed , SystemException { } } | Util . out4 . println ( "Device_2Impl.command_query_2(" + command + ") arrived" ) ; // Retrieve number of command and allocate memory to send back info
final int nb_cmd = device_class . get_command_list ( ) . size ( ) ; Util . out4 . println ( nb_cmd + " command(s) for device" ) ; DevCmdInfo_2 back = null ; for ( int i... |
public class StorageAccountsInner { /** * Gets the specified Azure Storage container associated with the given Data Lake Analytics and Azure Storage accounts .
* @ param resourceGroupName The name of the Azure resource group .
* @ param accountName The name of the Data Lake Analytics account .
* @ param storageAc... | return getStorageContainerWithServiceResponseAsync ( resourceGroupName , accountName , storageAccountName , containerName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ApiOvhEmailexchange { /** * Alter this object properties
* REST : PUT / email / exchange / { organizationName } / service / { exchangeService } / externalContact / { externalEmailAddress }
* @ param body [ required ] New object properties
* @ param organizationName [ required ] The internal name of y... | String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}" ; StringBuilder sb = path ( qPath , organizationName , exchangeService , externalEmailAddress ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ; |
public class Component { /** * 构建MD5签名参数
* @ param payParams 支付参数 */
void buildMd5SignParams ( Map < String , String > payParams ) { } } | String payString = buildSignString ( payParams ) ; String sign = md5 ( payString ) ; payParams . put ( AlipayField . SIGN_TYPE . field ( ) , SignType . MD5 . value ( ) ) ; payParams . put ( AlipayField . SIGN . field ( ) , sign ) ; |
public class RegionBackendServiceClient { /** * Creates a regional BackendService resource in the specified project using the data included in
* the request . There are several restrictions and guidelines to keep in mind when creating a
* regional backend service . Read Restrictions and Guidelines for more informat... | InsertRegionBackendServiceHttpRequest request = InsertRegionBackendServiceHttpRequest . newBuilder ( ) . setRegion ( region == null ? null : region . toString ( ) ) . setBackendServiceResource ( backendServiceResource ) . build ( ) ; return insertRegionBackendService ( request ) ; |
public class DisplayReadHandler { /** * Called when a valid record is read from the table / query .
* Reads the secondary record and set ' s the record not found message if not found .
* @ param bDisplayOption If true , display any changes . */
public void doValidRecord ( boolean bDisplayOption ) { } } | if ( m_fldMain == null ) m_fldMain = this . getOwner ( ) . getField ( mainFieldName ) ; if ( m_fldMain == null ) return ; // Error - Field not found ?
if ( fileKeyFieldName != null ) m_FileToRead . getField ( fileKeyFieldName ) . moveFieldToThis ( m_fldMain , DBConstants . DISPLAY , DBConstants . SCREEN_MOVE ) ; // SCR... |
public class CmsSetupBean { /** * Sets the connection string to the database to the given value . < p >
* @ param dbWorkConStr the connection string used by the OpenCms core */
public void setDbWorkConStr ( String dbWorkConStr ) { } } | String driver ; String pool = '.' + getPool ( ) + '.' ; driver = getDbProperty ( m_databaseKey + ".driver" ) ; setExtProperty ( CmsDbPoolV11 . KEY_DATABASE_POOL + pool + CmsDbPoolV11 . KEY_JDBC_DRIVER , driver ) ; setExtProperty ( CmsDbPoolV11 . KEY_DATABASE_POOL + pool + CmsDbPoolV11 . KEY_JDBC_URL , dbWorkConStr ) ; ... |
public class ManagedHttpHealthCheckService { /** * Updates health status using the specified { @ link HttpRequest } . */
private CompletionStage < AggregatedHttpMessage > updateHealthStatus ( ServiceRequestContext ctx , HttpRequest req ) { } } | return mode ( ctx , req ) . thenApply ( mode -> { if ( ! mode . isPresent ( ) ) { return BAD_REQUEST_RES ; } final boolean isHealthy = mode . get ( ) ; serverHealth . setHealthy ( isHealthy ) ; return isHealthy ? TURN_ON_RES : TURN_OFF_RES ; } ) ; |
public class NotificationManager { /** * Whenever a new event triggers it will use this method to add the corresponding notification
* to the notification lists .
* @ param e
* the event that for the notification .
* @ param interaction */
@ SuppressWarnings ( "unchecked" ) public static void addNotification ( ... | NotificationManager . notifications . add ( new InteractionNotification ( getNotificationID ( ) , NotificationManager . sim . getSchedule ( ) . getSteps ( ) , e . getLauncher ( ) , interaction , ( List < Object > ) e . getAffected ( ) ) ) ; logger . fine ( "New notification added to notifications list. There is current... |
public class Bio { /** * Gets the value of the rid property .
* This accessor method returns a reference to the live list ,
* not a snapshot . Therefore any modification you make to the
* returned list will be present inside the JAXB object .
* This is why there is not a < CODE > set < / CODE > method for the r... | if ( rid == null ) { rid = new ArrayList < Object > ( ) ; } return this . rid ; |
public class WSJobRepositoryImpl { /** * { @ inheritDoc } */
@ Override public Set < String > getJobNames ( ) { } } | if ( authService == null || authService . isAdmin ( ) || authService . isMonitor ( ) ) { return persistenceManagerService . getJobNamesSet ( ) ; } else if ( authService . isSubmitter ( ) ) { return persistenceManagerService . getJobNamesSet ( authService . getRunAsUser ( ) ) ; } throw new JobSecurityException ( "The cu... |
public class JmsBolt { /** * Consumes a tuple and sends a JMS message .
* If autoAck is true , the tuple will be acknowledged
* after the message is sent .
* If JMS sending fails , the tuple will be failed . */
@ Override public void execute ( Tuple input ) { } } | // write the tuple to a JMS destination . . .
LOG . debug ( "Tuple received. Sending JMS message." ) ; try { Message msg = this . producer . toMessage ( this . session , input ) ; if ( msg != null ) { if ( msg . getJMSDestination ( ) != null ) { this . messageProducer . send ( msg . getJMSDestination ( ) , msg ) ; } el... |
public class DeepLearning { /** * Helper to update a Frame and adding it to the local trash at the same time
* @ param target Frame referece , to be overwritten
* @ param src Newly made frame , to be deleted via local trash
* @ return src */
Frame updateFrame ( Frame target , Frame src ) { } } | if ( src != target ) ltrash ( src ) ; return src ; |
public class ListTasksResult { /** * The list of task ARN entries for the < code > ListTasks < / code > request .
* @ return The list of task ARN entries for the < code > ListTasks < / code > request . */
public java . util . List < String > getTaskArns ( ) { } } | if ( taskArns == null ) { taskArns = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return taskArns ; |
public class HamtPMap { /** * Appends this map ' s contents to a string builder . */
private void appendTo ( StringBuilder sb ) { } } | if ( sb . length ( ) > 1 ) { sb . append ( ", " ) ; } sb . append ( key ) . append ( ": " ) . append ( value ) ; for ( HamtPMap < K , V > child : children ) { child . appendTo ( sb ) ; } |
public class Occurrence { /** * 计算右熵
* @ param pair
* @ return */
public double computeRightEntropy ( PairFrequency pair ) { } } | Set < Map . Entry < String , TriaFrequency > > entrySet = trieTria . prefixSearch ( pair . getKey ( ) + RIGHT ) ; return computeEntropy ( entrySet ) ; |
public class CrawlerMetricsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CrawlerMetrics crawlerMetrics , ProtocolMarshaller protocolMarshaller ) { } } | if ( crawlerMetrics == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( crawlerMetrics . getCrawlerName ( ) , CRAWLERNAME_BINDING ) ; protocolMarshaller . marshall ( crawlerMetrics . getTimeLeftSeconds ( ) , TIMELEFTSECONDS_BINDING ) ; protoc... |
public class FileUtils { /** * < p > Attempts to get the directory for a given file . Will return itself if the passed in file is a directory . Will
* always return a trailing slash . < / p >
* @ param file The file
* @ return The path of the file spec or null if it is null */
public static String directory ( Str... | if ( StringUtils . isNullOrBlank ( file ) ) { return StringUtils . EMPTY ; } file = StringUtils . trim ( file ) ; int separator = indexOfLastSeparator ( file ) ; int extension = indexOfFileExtension ( file ) ; if ( extension == - 1 ) { return addTrailingSlashIfNeeded ( file ) ; } else if ( separator == - 1 ) { return S... |
public class JavaUtils { /** * Tests if this class loader is a JBoss RepositoryClassLoader
* @ param loader
* @ return */
public static boolean isJBossRepositoryClassLoader ( ClassLoader loader ) { } } | Class < ? > clazz = loader . getClass ( ) ; while ( ! clazz . getName ( ) . startsWith ( "java" ) ) { if ( "org.jboss.mx.loading.RepositoryClassLoader" . equals ( clazz . getName ( ) ) ) return true ; clazz = clazz . getSuperclass ( ) ; } return false ; |
public class OperationProcessor { /** * Cancels those Operations in the given list that have not yet completed with the given exception . */
private void cancelIncompleteOperations ( Iterable < CompletableOperation > operations , Throwable failException ) { } } | assert failException != null : "no exception to set" ; int cancelCount = 0 ; for ( CompletableOperation o : operations ) { if ( ! o . isDone ( ) ) { this . state . failOperation ( o , failException ) ; cancelCount ++ ; } } log . warn ( "{}: Cancelling {} operations with exception: {}." , this . traceObjectId , cancelCo... |
public class ReOpenableHashPartition { /** * Spills this partition to disk . This method is invoked once after the initial open ( ) method
* @ return Number of memorySegments in the writeBehindBuffers ! */
int spillInMemoryPartition ( Channel . ID targetChannel , IOManager ioManager , LinkedBlockingQueue < MemorySegm... | this . initialPartitionBuffersCount = partitionBuffers . length ; // for ReOpenableHashMap
this . initialBuildSideChannel = targetChannel ; initialBuildSideWriter = ioManager . createBlockChannelWriter ( targetChannel , writeBehindBuffers ) ; final int numSegments = this . partitionBuffers . length ; for ( int i = 0 ; ... |
public class TabViewRenderer { /** * Encode the list of links that render the tabs
* @ param context
* @ param writer
* @ param tabView
* @ param currentlyActiveIndex
* @ param tabs
* @ param clientId
* @ param hiddenInputFieldID
* @ throws IOException */
private static void encodeTabLinks ( FacesContex... | writer . startElement ( "ul" , tabView ) ; writer . writeAttribute ( "id" , clientId , "id" ) ; Tooltip . generateTooltip ( context , tabView , writer ) ; String classes = "nav " ; if ( "left" . equalsIgnoreCase ( tabView . getTabPosition ( ) ) || "right" . equalsIgnoreCase ( tabView . getTabPosition ( ) ) ) { classes ... |
public class GridSampler { /** * < p > Checks a set of points that have been transformed to sample points on an image against
* the image ' s dimensions to see if the point are even within the image . < / p >
* < p > This method will actually " nudge " the endpoints back onto the image if they are found to be
* b... | int width = image . getWidth ( ) ; int height = image . getHeight ( ) ; // Check and nudge points from start until we see some that are OK :
boolean nudged = true ; int maxOffset = points . length - 1 ; // points . length must be even
for ( int offset = 0 ; offset < maxOffset && nudged ; offset += 2 ) { int x = ( int )... |
public class ProjectClient { /** * Gets service resources ( a . k . a service project ) associated with this host project .
* < p > Sample code :
* < pre > < code >
* try ( ProjectClient projectClient = ProjectClient . create ( ) ) {
* ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ;
* for ( XpnRe... | GetXpnResourcesProjectsHttpRequest request = GetXpnResourcesProjectsHttpRequest . newBuilder ( ) . setProject ( project ) . build ( ) ; return getXpnResourcesProjects ( request ) ; |
public class AtomicLongMapSubject { /** * Fails if the { @ link AtomicLongMap } does not contain the given entry . */
@ SuppressWarnings ( "unchecked" ) // worse case should be a ClassCastException
/* * TODO ( cpovirk ) : Consider requiring key to be a K here . But AtomicLongMapSubject isn ' t currently
* parameteriz... | checkNotNull ( key , "AtomicLongMap does not support null keys" ) ; long actualValue = ( ( AtomicLongMap < Object > ) actual ( ) ) . get ( key ) ; if ( actualValue != value ) { failWithActual ( "expected to contain entry" , immutableEntry ( key , value ) ) ; } |
public class AlternativesImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public NotificationChain eInverseRemove ( InternalEObject otherEnd , int featureID , NotificationChain msgs ) { } } | switch ( featureID ) { case SimpleAntlrPackage . ALTERNATIVES__GROUPS : return ( ( InternalEList < ? > ) getGroups ( ) ) . basicRemove ( otherEnd , msgs ) ; } return super . eInverseRemove ( otherEnd , featureID , msgs ) ; |
public class JAASLoginModuleConfigImpl { /** * Process the properties from the server . xml / client . xml
* @ param props */
private void processConfigProps ( Map < String , Object > props ) { } } | controlFlag = setControlFlag ( moduleConfig . controlFlag ( ) ) ; Map < String , Object > options = extractOptions ( props ) ; String originalLoginModuleClassName = moduleConfig . className ( ) ; if ( isDefaultLoginModule ( ) ) { String target = getTargetClassName ( originalLoginModuleClassName , options ) ; Class < ? ... |
public class Wxs { /** * 创建一条文本响应 */
public static WxOutMsg respText ( String to , String content ) { } } | WxOutMsg out = new WxOutMsg ( "text" ) ; out . setContent ( content ) ; if ( to != null ) out . setToUserName ( to ) ; return out ; |
public class WebApp { /** * defect 39851 needs to stop the exception from always being thrown */
@ FFDCIgnore ( Exception . class ) protected void addStaticFilePatternMappings ( RequestProcessor proxyReqProcessor ) { } } | String nextPattern ; ExtensionProcessor fileExtensionProcessor = getDefaultExtensionProcessor ( this , getConfiguration ( ) . getFileServingAttributes ( ) ) ; List patternList = fileExtensionProcessor . getPatternList ( ) ; Iterator patternIter = patternList . iterator ( ) ; int globalPatternsCount = 0 ; while ( patter... |
public class FileFrom { /** * Match filenames against the provided parameterized string . */
public File inFileNamed ( String filenamePattern ) { } } | if ( filenamePattern != null && ! filenamePattern . isEmpty ( ) ) { f . setFilenamePattern ( new RegexParameterizedPatternParser ( filenamePattern ) ) ; } return f ; |
public class MinimizationResult { /** * Retrieves all ( original ) states in a block .
* @ param block
* the block .
* @ return a collection containing all original states in this block . */
public static < S , L > Collection < S > getStatesInBlock ( Block < S , L > block ) { } } | return new OriginalStateCollection < > ( block . getStates ( ) ) ; |
public class RawFormatReader { /** * Depending on the next token read either a value , a list or a map .
* @ param input
* @ return
* @ throws IOException */
private static Object readDynamic ( StreamingInput input ) throws IOException { } } | switch ( input . peek ( ) ) { case VALUE : input . next ( ) ; return input . getValue ( ) ; case NULL : input . next ( ) ; return input . getValue ( ) ; case LIST_START : return readList ( input ) ; case OBJECT_START : return readMap ( input ) ; } throw new SerializationException ( "Unable to read file, unknown start o... |
public class AccountClient { /** * Revoke a secret associated with a specific API key .
* @ param apiKey The API key that the secret is associated to .
* @ param secretId The id of the secret to revoke .
* @ throws IOException if a network error occurred contacting the Nexmo Account API
* @ throws NexmoClientEx... | revokeSecret ( new SecretRequest ( apiKey , secretId ) ) ; |
public class NetworkMonitor { /** * Returns IP Address < br >
* Requires READ _ PHONE _ STATE , ACCESS _ WIFI _ STATE and INTERNET permissions < br >
* @ param ipv6
* Option to choose IP address type
* @ return IP address made up of IPv6 if parameter ipv6 is true or IPv4 if
* parameter ipv6 is false ; null if... | try { for ( Enumeration < NetworkInterface > networkInterfaces = NetworkInterface . getNetworkInterfaces ( ) ; networkInterfaces . hasMoreElements ( ) ; ) { NetworkInterface networkInterface = networkInterfaces . nextElement ( ) ; for ( Enumeration < InetAddress > addresses = networkInterface . getInetAddresses ( ) ; a... |
public class Scanner { /** * Returns if this checker should be suppressed on the current tree path .
* @ param suppressible holds information about the suppressibility of a checker
* @ param errorProneOptions Options object configuring whether or not to suppress non - errors in
* generated code . */
protected Sup... | boolean suppressedInGeneratedCode = errorProneOptions . disableWarningsInGeneratedCode ( ) && severityMap ( ) . get ( suppressible . canonicalName ( ) ) != SeverityLevel . ERROR ; return currentSuppressions . suppressedState ( suppressible , suppressedInGeneratedCode ) ; |
public class JDBCUtil { /** * Converts the date to a string and surrounds it in single - quotes via the escape method . If the
* date is null , returns null . */
public String quote ( Date date ) { } } | return ( date == null ) ? null : escape ( String . valueOf ( date ) ) ; |
public class StreamingQueryInfo { /** * get the value of that named property */
@ Override public Object getMember ( String name ) { } } | switch ( name ) { case "name" : return F_name ; case "id" : return F_id ; case "sourceStatuses" : return F_sourceStatuses ; case "sinkStatus" : return F_sinkStatus ; case "awaitTermination" : } return super . getMember ( name ) ; |
public class AppiumServiceBuilder { /** * Provides a measure of how strongly this { @ link DriverService } supports the given
* { @ code capabilities } . A score of 0 or less indicates that this { @ link DriverService } does not
* support instances of { @ link org . openqa . selenium . WebDriver } that require { @ ... | int score = 0 ; if ( capabilites . getCapability ( PLATFORM_NAME ) != null ) { score ++ ; } String browserName = capabilites . getBrowserName ( ) ; if ( browserName . equals ( BrowserType . CHROME ) || browserName . equals ( BrowserType . ANDROID ) || browserName . equals ( BrowserType . SAFARI ) ) { score ++ ; } retur... |
public class Const { /** * { @ inheritDoc } */
@ Override public < C > Const < A , C > zip ( Applicative < Function < ? super B , ? extends C > , Const < A , ? > > appFn ) { } } | return Monad . super . zip ( appFn ) . coerce ( ) ; |
public class AbstractClientServerSupport { /** * Determines whether the { @ link ServerSocket } is alive and accepting client connections .
* @ param serverSocket { @ link ServerSocket } to evaluate .
* @ return a boolean value indicating whether the { @ link ServerSocket } is valid .
* @ see java . net . ServerS... | return Optional . ofNullable ( serverSocket ) . map ( localServerSocket -> ! localServerSocket . isClosed ( ) && localServerSocket . isBound ( ) ) . orElse ( false ) ; |
public class HashtableOnDisk { /** * Retrieve the object pointer from the table . If we are in the process of
* doubling , this method finds the correct table to update ( since there are
* two tables active during the doubling process ) . */
long getHtindex ( int index , int tableid ) { } } | if ( tableid == header . currentTableId ( ) ) { return htindex [ index ] ; } else { return new_htindex [ index ] ; } |
public class ListTagsLogGroupResult { /** * The tags for the log group .
* @ param tags
* The tags for the log group .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListTagsLogGroupResult withTags ( java . util . Map < String , String > tags ) { } } | setTags ( tags ) ; return this ; |
public class Normalizer { /** * Auto - generates standard and other names for the datasource
* from either its ID ( if URN ) or one of its existing names ( preferably - standard name )
* @ param pro data source ( BioPAX Provenance ) */
public static void autoName ( Provenance pro ) { } } | if ( ! ( pro . getUri ( ) . startsWith ( "urn:miriam:" ) || pro . getUri ( ) . startsWith ( "http://identifiers.org/" ) ) && pro . getName ( ) . isEmpty ( ) ) { log . info ( "Skipping: cannot normalize Provenance: " + pro . getUri ( ) ) ; } else { // i . e . , ' name ' is not empty or ID is the URN
final SortedSet < St... |
public class ArrayFunctions { /** * Returned expression results in new array with at most n occurrences of value1 replaced with value2. */
public static Expression arrayReplace ( JsonArray array , Expression value1 , Expression value2 , long n ) { } } | return arrayReplace ( x ( array ) , value1 , value2 , n ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.