signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ImmutableRoaringBitmap { /** * Computes XOR between input bitmaps in the given range , from rangeStart ( inclusive ) to rangeEnd
* ( exclusive )
* @ param bitmaps input bitmaps , these are not modified
* @ param rangeStart inclusive beginning of range
* @ param rangeEnd exclusive ending of range
... | Iterator < ImmutableRoaringBitmap > bitmapsIterator ; bitmapsIterator = selectRangeWithoutCopy ( bitmaps , rangeStart , rangeEnd ) ; return BufferFastAggregation . xor ( bitmapsIterator ) ; |
public class SingletonMap { /** * Check if the given key is in the map , and if so , return the value of { @ link # newInstance ( Object , LogNode ) }
* for that key , or block on the result of { @ link # newInstance ( Object , LogNode ) } if another thread is currently
* creating the new instance .
* If the give... | final SingletonHolder < V > singletonHolder = map . get ( key ) ; V instance = null ; if ( singletonHolder != null ) { // There is already a SingletonHolder in the map for this key - - get the value
instance = singletonHolder . get ( ) ; } else { // There is no SingletonHolder in the map for this key , need to create o... |
public class PoolManager { /** * Get the maximum map or reduce slots for the given pool .
* @ return the cap set on this pool , or Integer . MAX _ VALUE if not set . */
int getMaxSlots ( String poolName , TaskType taskType ) { } } | Map < String , Integer > maxMap = ( taskType == TaskType . MAP ? poolMaxMaps : poolMaxReduces ) ; if ( maxMap . containsKey ( poolName ) ) { return maxMap . get ( poolName ) ; } else { return Integer . MAX_VALUE ; } |
public class UIComponentClassicTagBase { /** * Creates a transient UIOutput using the Application , with the following characteristics :
* < code > componentType < / code > is < code > javax . faces . HtmlOutputText < / code > .
* < code > transient < / code > is < code > true < / code > .
* < code > escape < / c... | UIOutput verbatimComp = ( UIOutput ) getFacesContext ( ) . getApplication ( ) . createComponent ( "javax.faces.HtmlOutputText" ) ; verbatimComp . setTransient ( true ) ; verbatimComp . getAttributes ( ) . put ( "escape" , Boolean . FALSE ) ; verbatimComp . setId ( getFacesContext ( ) . getViewRoot ( ) . createUniqueId ... |
public class GreenPepperXmlRpcClient { /** * { @ inheritDoc } */
@ SuppressWarnings ( "unchecked" ) public Set < Reference > getReferences ( Requirement requirement , String identifier ) throws GreenPepperServerException { } } | Vector params = CollectionUtil . toVector ( requirement . marshallize ( ) ) ; log . debug ( "Retrieving Requirement " + requirement . getName ( ) + " References" ) ; Vector < Object > referencesParams = ( Vector < Object > ) execute ( XmlRpcMethodName . getRequirementReferences , params , identifier ) ; return XmlRpcDa... |
public class hqlParser { /** * hql . g : 321:1 : alias : i = identifier - > ^ ( ALIAS [ $ i . start ] ) ; */
public final hqlParser . alias_return alias ( ) throws RecognitionException { } } | hqlParser . alias_return retval = new hqlParser . alias_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; ParserRuleReturnScope i = null ; RewriteRuleSubtreeStream stream_identifier = new RewriteRuleSubtreeStream ( adaptor , "rule identifier" ) ; try { // hql . g : 322:2 : ( i = identifier - >... |
public class VersionsImpl { /** * Creates a new version using the current snapshot of the selected application version .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param cloneOptionalParameter the object representing the optional parameters to be set before calling this API
* ... | return ServiceFuture . fromResponse ( cloneWithServiceResponseAsync ( appId , versionId , cloneOptionalParameter ) , serviceCallback ) ; |
public class PropertyChangeUtils { /** * Tries to add the given PropertyChangeListener to the given target
* object .
* If the given target object does not
* { @ link # maintainsNamedPropertyChangeListeners ( Class )
* maintain named PropertyChangeListeners } , then nothing is done .
* @ param target The targ... | Objects . requireNonNull ( target , "The target may not be null" ) ; Objects . requireNonNull ( propertyName , "The propertyName may not be null" ) ; Objects . requireNonNull ( propertyChangeListener , "The propertyChangeListener may not be null" ) ; if ( maintainsNamedPropertyChangeListeners ( target . getClass ( ) ) ... |
public class FontLoader { /** * Get a typeface for a given the font name / path
* @ param ctx the context to load the typeface from assets
* @ param fontName the name / path of of the typeface to load
* @ return the loaded typeface , or null */
public static Typeface getTypeface ( Context ctx , String fontName ) ... | Typeface existing = mLoadedTypefaces . get ( fontName ) ; if ( existing == null ) { existing = Typeface . createFromAsset ( ctx . getAssets ( ) , fontName ) ; mLoadedTypefaces . put ( fontName , existing ) ; } return existing ; |
public class ObjectGraphNode { /** * Calculates the size of a field value obtained using the reflection API .
* @ param fieldType the Field ' s type ( class ) , needed to return the correct values for primitives .
* @ param fieldValue the field ' s value ( primitives are boxed ) .
* @ return an approximation of a... | Integer fieldSize = SIMPLE_SIZES . get ( fieldType ) ; if ( fieldSize != null ) { if ( PRIMITIVE_TYPES . contains ( fieldType ) ) { return fieldSize ; } return OBJREF_SIZE + fieldSize ; } else if ( fieldValue instanceof String ) { return ( OBJREF_SIZE + OBJECT_SHELL_SIZE ) * 2 // One for the String Object itself , and ... |
public class IndexedDataStoreFactory { /** * Creates a { @ link IndexedDataStore } with keys and values in the form of byte array .
* @ param config - the store configuration
* @ return the newly created IndexedDataStore .
* @ throws IOException if the store cannot be created . */
@ Override public IndexedDataSto... | try { return StoreFactory . createIndexedDataStore ( config ) ; } catch ( Exception e ) { if ( e instanceof IOException ) { throw ( IOException ) e ; } else { throw new IOException ( e ) ; } } |
public class SAXDriver { /** * make layered SAX2 DTD validation more conformant */
void verror ( String message ) throws SAXException { } } | SAXParseException err ; err = new SAXParseException ( message , this ) ; errorHandler . error ( err ) ; |
public class DefaultServiceGroup { /** * { @ inheritDoc } */
@ Override public void addService ( Service service ) { } } | Preconditions . checkNotNull ( service ) ; services . put ( service . fullName ( ) , service ) ; |
public class CommerceOrderUtil { /** * Returns a range of all the commerce orders where groupId = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result s... | return getPersistence ( ) . findByGroupId ( groupId , start , end ) ; |
public class SimpleRandomSampling { /** * Returns the minimum required sample size when we set a specific maximum Xbar STD Error for finite population size .
* @ param maximumXbarStd
* @ param populationStd
* @ param populationN
* @ return */
public static int minimumSampleSizeForMaximumXbarStd ( double maximum... | if ( populationN <= 0 ) { throw new IllegalArgumentException ( "The populationN parameter must be positive." ) ; } double minimumSampleN = 1.0 / ( Math . pow ( maximumXbarStd / populationStd , 2 ) + 1.0 / populationN ) ; return ( int ) Math . ceil ( minimumSampleN ) ; |
public class JSONs { /** * Read an expected integer .
* @ param o the object to parse
* @ param id the key in the map that points to an integer
* @ return the int
* @ throws JSONConverterException if the key does not point to a int */
public static int requiredInt ( JSONObject o , String id ) throws JSONConvert... | checkKeys ( o , id ) ; try { return ( Integer ) o . get ( id ) ; } catch ( ClassCastException e ) { throw new JSONConverterException ( "Unable to read a int from string '" + id + "'" , e ) ; } |
public class GraphPath { /** * Remove the path ' s elements before the
* specified one which is starting
* at the specified point . The specified element will
* be removed .
* < p > This function removes until the < i > first occurence < / i >
* of the given object .
* @ param obj is the segment to remove
... | return removeUntil ( indexOf ( obj , pt ) , true ) ; |
public class UpgradeScanner10 { /** * Returns segments for a table in reverse sequence order .
* The reverse order minimizes extra pages reads , because older pages
* don ' t need to be read . */
private ArrayList < Segment10 > tableSegments ( TableEntry10 table ) { } } | ArrayList < Segment10 > tableSegments = new ArrayList < > ( ) ; for ( Segment10 segment : _segments ) { if ( Arrays . equals ( segment . key ( ) , table . key ( ) ) ) { tableSegments . add ( segment ) ; } } Collections . sort ( tableSegments , ( x , y ) -> Long . signum ( y . sequence ( ) - x . sequence ( ) ) ) ; retur... |
public class KeywordImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case SimpleAntlrPackage . KEYWORD__VALUE : setValue ( ( String ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class HazelcastPortableMessageFormatter { /** * Method to append readPortable from hazelcast _ portable .
* @ param message JMessage with the information .
* < pre >
* { @ code
* public void readPortable ( com . hazelcast . nio . serialization . PortableReader portableReader ) throws java . io . IOExcept... | writer . appendln ( "@Override" ) . formatln ( "public void readPortable(%s %s) throws %s {" , PortableReader . class . getName ( ) , PORTABLE_READER , IOException . class . getName ( ) ) . begin ( ) ; // TODO : This should be short [ ] instead , as field IDs are restricted to 16bit .
writer . formatln ( "int[] field_i... |
public class EmailIntentSender { /** * Builds an email intent with attachments
* @ param subject the message subject
* @ param body the message body
* @ param attachments the attachments
* @ return email intent */
@ NonNull protected Intent buildAttachmentIntent ( @ NonNull String subject , @ Nullable String bo... | final Intent intent = new Intent ( Intent . ACTION_SEND_MULTIPLE ) ; intent . putExtra ( Intent . EXTRA_EMAIL , new String [ ] { mailConfig . mailTo ( ) } ) ; intent . addFlags ( Intent . FLAG_ACTIVITY_NEW_TASK ) ; intent . putExtra ( Intent . EXTRA_SUBJECT , subject ) ; intent . setType ( "message/rfc822" ) ; intent .... |
public class AbstractActivator { /** * Registers a service .
* @ param clazz
* @ param service
* @ param props
* @ return */
@ SuppressWarnings ( "rawtypes" ) protected < S > ServiceRegistration registerService ( Class < S > clazz , S service , Map < String , ? > props ) { } } | if ( service instanceof IBundleAwareService ) { ( ( IBundleAwareService ) service ) . setBundle ( bundle ) ; } Dictionary < String , Object > _p = new Hashtable < String , Object > ( ) ; if ( props != null ) { for ( Entry < String , ? > entry : props . entrySet ( ) ) { _p . put ( entry . getKey ( ) , entry . getValue (... |
public class SystemBarTintManager { /** * Apply the specified alpha to the system status bar .
* @ param alpha The alpha to use */
@ TargetApi ( 11 ) public void setStatusBarAlpha ( float alpha ) { } } | if ( mStatusBarAvailable && Build . VERSION . SDK_INT >= Build . VERSION_CODES . HONEYCOMB ) { mStatusBarTintView . setAlpha ( alpha ) ; } |
public class ListenerHelper { /** * A utility method to build process start JMS message .
* @ param processId
* @ param eventInstId
* @ param masterRequestId
* @ param parameters
* @ return */
public InternalEvent buildProcessStartMessage ( Long processId , Long eventInstId , String masterRequestId , Map < St... | InternalEvent evMsg = InternalEvent . createProcessStartMessage ( processId , OwnerType . DOCUMENT , eventInstId , masterRequestId , null , null , null ) ; evMsg . setParameters ( parameters ) ; evMsg . setCompletionCode ( StartActivity . STANDARD_START ) ; // completion
// code -
// indicating
// standard start
return... |
public class FCAlignHelper { /** * record the aligned pairs in alignList [ ] [ 0 ] , alignList [ ] [ 1 ] ;
* return the number of aligned pairs
* @ param alignList
* @ return the number of aligned pairs */
public int getAlignPos ( int [ ] [ ] alignList ) { } } | int i = B1 ; int j = B2 ; int s = 0 ; int a = 0 ; int op ; while ( i <= E1 && j <= E2 ) { op = sapp0 [ s ++ ] ; if ( op == 0 ) { alignList [ 0 ] [ a ] = i - 1 ; // i - 1
alignList [ 1 ] [ a ] = j - 1 ; a ++ ; i ++ ; j ++ ; } else if ( op > 0 ) { j += op ; } else { i -= op ; } } return a ; |
public class ErrorHandler { /** * Record a message signifying an error condition .
* @ param msg signifying an error . */
public void error ( final String msg ) { } } | errors ++ ; if ( ! suppressOutput ) { out . println ( "ERROR: " + msg ) ; } if ( stopOnError ) { throw new IllegalArgumentException ( msg ) ; } |
public class DataProvider { /** * Returns a mock List of Person objects */
public static List < Person > getMockPeopleSet1 ( ) { } } | List < Person > listPeople = new ArrayList < Person > ( ) ; listPeople . add ( new Person ( "Henry Blair" , "07123456789" , R . drawable . male1 ) ) ; listPeople . add ( new Person ( "Jenny Curtis" , "07123456789" , R . drawable . female1 ) ) ; listPeople . add ( new Person ( "Vincent Green" , "07123456789" , R . drawa... |
public class RelaxedDataBinder { /** * Add aliases to the { @ link DataBinder } .
* @ param name the property name to alias
* @ param alias aliases for the property names
* @ return this instance */
public RelaxedDataBinder withAlias ( String name , String ... alias ) { } } | for ( String value : alias ) { this . nameAliases . add ( name , value ) ; } return this ; |
public class RETURN { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div >
* < div color = ' red ' style = " font - size : 18px ; color : red " > < i > select a named ( identified ) value < / i > < / div >
* < div color = ' red ' styl... | RSortable ret = RFactory . value ( element ) ; ASTNode an = APIObjectAccess . getAstNode ( ret ) ; an . setClauseType ( ClauseType . RETURN ) ; return ret ; |
public class AmazonSimpleEmailServiceClient { /** * Creates an empty receipt rule set .
* For information about setting up receipt rule sets , see the < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / receiving - email - receipt - rule - set . html " > Amazon SES
* Developer Gu... | request = beforeClientExecution ( request ) ; return executeCreateReceiptRuleSet ( request ) ; |
public class CompatibilityMatrix { /** * Reset all values marked with ( marking ) from row i onwards .
* @ param i row index
* @ param marking the marking to reset ( should be negative ) */
void resetRows ( int i , int marking ) { } } | for ( int j = ( i * mCols ) ; j < data . length ; j ++ ) if ( data [ j ] == marking ) data [ j ] = 1 ; |
public class UserProperties { /** * Set a property with this field ' s name as the key to this field ' s current value .
* ( Utility method ) .
* @ param field The field to save . */
public void saveField ( BaseField field ) { } } | String strFieldName = field . getFieldName ( ) ; // Fieldname only
String strData = field . getString ( ) ; this . setProperty ( strFieldName , strData ) ; |
public class Expressions { /** * Create a new Path expression
* @ param type type of expression
* @ param parent parent path
* @ param property property name
* @ return property path */
public static < T extends Comparable < ? > > TimePath < T > timePath ( Class < ? extends T > type , Path < ? > parent , String... | return new TimePath < T > ( type , PathMetadataFactory . forProperty ( parent , property ) ) ; |
public class MainActivity { /** * Request notification permission . */
private void requestNotification ( ) { } } | AndPermission . with ( this ) . notification ( ) . permission ( ) . rationale ( new NotifyRationale ( ) ) . onGranted ( new Action < Void > ( ) { @ Override public void onAction ( Void data ) { toast ( R . string . successfully ) ; } } ) . onDenied ( new Action < Void > ( ) { @ Override public void onAction ( Void data... |
public class FixedBucketsHistogram { /** * Get a sum of bucket counts from either the start of a histogram ' s range or end , up to a specified cutoff value .
* For example , if I have the following histogram with a range of 0-40 , with 4 buckets and
* per - bucket counts of 5 , 2 , 10 , and 7:
* | 5 | 2 | 24 | 7... | int cutoffBucket = ( int ) ( ( cutoff - lowerLimit ) / bucketSize ) ; double count = 0 ; if ( fromStart ) { for ( int i = 0 ; i <= cutoffBucket ; i ++ ) { if ( i == cutoffBucket ) { double bucketStart = i * bucketSize + lowerLimit ; double partialCount = ( ( cutoff - bucketStart ) / bucketSize ) * histogram [ i ] ; cou... |
public class AWTDrawVisitor { /** * { @ inheritDoc } */
@ Override public void setRendererModel ( RendererModel rendererModel ) { } } | this . rendererModel = rendererModel ; if ( rendererModel . hasParameter ( UseAntiAliasing . class ) ) { if ( rendererModel . getParameter ( UseAntiAliasing . class ) . getValue ( ) ) { graphics . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; // g . setStroke ( new Basic... |
public class ALU { /** * negative */
public static Object negative ( final Object o1 ) { } } | requireNonNull ( o1 ) ; switch ( getTypeMark ( o1 ) ) { case INTEGER : return - ( ( Integer ) o1 ) ; case LONG : return - ( ( Long ) o1 ) ; case DOUBLE : return - ( ( Double ) o1 ) ; case FLOAT : return - ( ( Float ) o1 ) ; case SHORT : return - ( ( Short ) o1 ) ; case BIG_INTEGER : return ( ( BigInteger ) o1 ) . negat... |
public class SecurityIdentityInterceptor { /** * { @ inheritDoc } */
public Object processInvocation ( final InterceptorContext context ) throws Exception { } } | final SecurityIdentity identity = context . getPrivateData ( SecurityIdentity . class ) ; if ( identity != null ) try { return identity . runAs ( context ) ; } catch ( PrivilegedActionException e ) { throw e . getException ( ) ; } else { return context . proceed ( ) ; } |
public class sslfipskey { /** * Use this API to delete sslfipskey resources of given names . */
public static base_responses delete ( nitro_service client , String fipskeyname [ ] ) throws Exception { } } | base_responses result = null ; if ( fipskeyname != null && fipskeyname . length > 0 ) { sslfipskey deleteresources [ ] = new sslfipskey [ fipskeyname . length ] ; for ( int i = 0 ; i < fipskeyname . length ; i ++ ) { deleteresources [ i ] = new sslfipskey ( ) ; deleteresources [ i ] . fipskeyname = fipskeyname [ i ] ; ... |
public class Classpath { /** * Stores the dependencies from the given project into the ' dependencies . json ' file .
* @ param project the project
* @ throws IOException if the file cannot be created . */
public static void store ( MavenProject project ) throws IOException { } } | final File output = new File ( project . getBasedir ( ) , Constants . DEPENDENCIES_FILE ) ; output . getParentFile ( ) . mkdirs ( ) ; ProjectDependencies dependencies = new ProjectDependencies ( project ) ; mapper . writer ( ) . withDefaultPrettyPrinter ( ) . writeValue ( output , dependencies ) ; |
public class FileSystem { /** * Replies if the specified file has the specified extension .
* < p > The test is dependent of the case - sensitive attribute of operating system .
* @ param filename is the filename to parse
* @ param extension is the extension to test .
* @ return < code > true < / code > if the ... | if ( filename == null ) { return false ; } assert extension != null ; String extent = extension ; if ( ! "" . equals ( extent ) && ! extent . startsWith ( EXTENSION_SEPARATOR ) ) { // $ NON - NLS - 1 $
extent = EXTENSION_SEPARATOR + extent ; } final String ext = extension ( filename ) ; if ( ext == null ) { return fals... |
public class OkHttpClientFactory { /** * This method creates an instance of OKHttpClient according to the provided parameters .
* It is used internally and is not intended to be used directly .
* @ param loggingEnabled Enable logging in the created OkHttpClient .
* @ param tls12Enforced Enforce TLS 1.2 in the cre... | return modifyClient ( new OkHttpClient ( ) , loggingEnabled , tls12Enforced , connectTimeout , readTimeout , writeTimeout ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EEnum getIfcTrimmingPreference ( ) { } } | if ( ifcTrimmingPreferenceEEnum == null ) { ifcTrimmingPreferenceEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 1092 ) ; } return ifcTrimmingPreferenceEEnum ; |
public class LinkUtil { /** * URL encoding for a resource path ( without the encoding for the ' / ' path delimiters ) .
* @ param path the path to encode
* @ return the URL encoded path */
public static String encodePath ( String path ) { } } | if ( path != null ) { path = encodeUrl ( path ) ; path = path . replaceAll ( "/jcr:" , "/_jcr_" ) ; path = path . replaceAll ( "\\?" , "%3F" ) ; path = path . replaceAll ( "=" , "%3D" ) ; path = path . replaceAll ( ";" , "%3B" ) ; path = path . replaceAll ( ":" , "%3A" ) ; path = path . replaceAll ( "\\+" , "%2B" ) ; p... |
public class HashTimeWheel { /** * add a task
* @ param delay after x milliseconds than execute runnable
* @ param run run task in future
* @ return The task future */
public Future add ( long delay , Runnable run ) { } } | final int curSlot = currentSlot ; final int ticks = delay > interval ? ( int ) ( delay / interval ) : 1 ; // figure out how many ticks need
final int index = ( curSlot + ( ticks % maxTimers ) ) % maxTimers ; // figure out the wheel ' s index
final int round = ( ticks - 1 ) / maxTimers ; // the round number of spin
Time... |
public class Visualizer { /** * Creates a buffered image that displays the structure of the PE file .
* @ param file
* the PE file to create an image from
* @ return buffered image
* @ throws IOException
* if sections can not be read */
public BufferedImage createImage ( File file ) throws IOException { } } | resetAvailabilityFlags ( ) ; this . data = PELoader . loadPE ( file ) ; image = new BufferedImage ( fileWidth , height , IMAGE_TYPE ) ; drawSections ( ) ; Overlay overlay = new Overlay ( data ) ; if ( overlay . exists ( ) ) { long overlayOffset = overlay . getOffset ( ) ; drawPixels ( colorMap . get ( OVERLAY ) , overl... |
public class MapCacheStoreAdapter { /** * { @ inheritDoc } */
public void put ( CacheItem item ) throws Exception { } } | getScopeCache ( item . getScope ( ) ) . put ( item . getKey ( ) , item ) ; |
public class WorkflowBulkResource { /** * Resume the list of workflows .
* @ param workflowIds - list of workflow Ids to perform resume operation on
* @ return bulk response object containing a list of succeeded workflows and a list of failed ones with errors */
@ PUT @ Path ( "/resume" ) @ ApiOperation ( "Resume t... | return workflowBulkService . resumeWorkflow ( workflowIds ) ; |
public class ConsoleProgressMonitor { /** * / * ( non - Javadoc )
* @ see ca . eandb . util . progress . ProgressMonitor # notifyProgress ( int , int ) */
public boolean notifyProgress ( int value , int maximum ) { } } | this . progress = ( double ) value / ( double ) maximum ; this . value = value ; this . maximum = maximum ; this . printProgressBar ( ) ; return true ; |
public class BlowfishECB { /** * to clear data in the boxes before an instance is freed */
public void cleanUp ( ) { } } | int nI ; for ( nI = 0 ; nI < PBOX_ENTRIES ; nI ++ ) m_pbox [ nI ] = 0 ; for ( nI = 0 ; nI < SBOX_ENTRIES ; nI ++ ) m_sbox1 [ nI ] = m_sbox2 [ nI ] = m_sbox3 [ nI ] = m_sbox4 [ nI ] = 0 ; |
public class CoverageUtilities { /** * Replace the current internal novalue with a given value .
* @ param renderedImage a { @ link RenderedImage } .
* @ param newValue the value to put in instead of the novalue .
* @ return the rendered image with the substituted novalue . */
public static WritableRaster replace... | WritableRaster tmpWR = ( WritableRaster ) renderedImage . getData ( ) ; RandomIter pitTmpIterator = RandomIterFactory . create ( renderedImage , null ) ; int height = renderedImage . getHeight ( ) ; int width = renderedImage . getWidth ( ) ; for ( int y = 0 ; y < height ; y ++ ) { for ( int x = 0 ; x < width ; x ++ ) {... |
public class Attribute { /** * Returns the value of the attribute in the given environment .
* @ param in the environment to look up
* @ return the value of the attribute in the given environment */
public Value getValue ( final Environment in ) { } } | log . debug ( "looking up value for " + name + " in " + in ) ; return attributeValue . get ( in ) ; |
public class CameraEncoder { /** * Called from UI thread */
public void startRecording ( ) { } } | if ( mState != STATE . INITIALIZED ) { Log . e ( TAG , "startRecording called in invalid state. Ignoring" ) ; return ; } synchronized ( mReadyForFrameFence ) { mFrameNum = 0 ; mRecording = true ; mState = STATE . RECORDING ; } |
public class AptAnnotationHelper { /** * Returns the value of a particular element as a String */
public String getStringValue ( String elemName ) { } } | if ( _valueMap . containsKey ( elemName ) ) return _valueMap . get ( elemName ) . toString ( ) ; return null ; |
public class BProgramRunner { /** * Adds a listener to the BProgram .
* @ param < R > Actual type of listener .
* @ param aListener the listener to add .
* @ return The added listener , to allow call chaining . */
public < R extends BProgramRunnerListener > R addListener ( R aListener ) { } } | listeners . add ( aListener ) ; return aListener ; |
public class CmsInfoButton { /** * The layout which is shown in window by triggering onclick event of button . < p >
* @ param htmlLines to be shown
* @ param additionalElements further vaadin elements
* @ return vertical layout */
protected VerticalLayout getLayout ( final List < String > htmlLines , final List ... | VerticalLayout layout = new VerticalLayout ( ) ; Label label = new Label ( ) ; label . setWidthUndefined ( ) ; layout . setMargin ( true ) ; label . setContentMode ( ContentMode . HTML ) ; layout . addStyleName ( OpenCmsTheme . INFO ) ; String htmlContent = "" ; for ( String line : htmlLines ) { htmlContent += line ; }... |
public class Activator { /** * Perform rollback - time processing for the specified transaction and
* bean . This method should be called for each bean which was
* participating in a transaction which was rolled back .
* Removes the transaction - local instance from the cache .
* @ param tx The transaction whic... | bean . getActivationStrategy ( ) . atRollback ( tx , bean ) ; |
public class HibernateCRUDTemplate { /** * / * ( non - Javadoc )
* @ see com . jdon . model . crud . DaoCRUDTemplate # loadById ( java . lang . Class , java . lang . String ) */
public Object loadById ( Class entity , Serializable id ) throws Exception { } } | return getHibernateTemplate ( ) . load ( entity , id ) ; |
public class Checks { /** * Performs check with the predicate .
* @ param reference reference to check
* @ param predicate the predicate to use
* @ param throwableType the throwable type to throw
* @ param errorMessageTemplate a template for the exception message should the
* check fail . The message is forme... | checkArgument ( reference != null , "Expected non-null reference" ) ; checkArgument ( predicate != null , "Expected non-null predicate" ) ; checkArgument ( throwableType != null , "Expected non-null throwableType" ) ; check ( reference , predicate , ( Supplier < E > ) ( ) -> throwable ( throwableType , parameters ( Str... |
public class RegExUtils { /** * < p > Replaces the first substring of the text string that matches the given regular expression pattern
* with the given replacement . < / p >
* This method is a { @ code null } safe equivalent to :
* < ul >
* < li > { @ code pattern . matcher ( text ) . replaceFirst ( replacemen... | if ( text == null || regex == null || replacement == null ) { return text ; } return regex . matcher ( text ) . replaceFirst ( replacement ) ; |
public class StunMessage { /** * Returns the length of this message ' s body .
* @ return the length of the data in this message . */
public char getDataLength ( ) { } } | char length = 0 ; List < StunAttribute > attrs = getAttributes ( ) ; for ( StunAttribute att : attrs ) { int attLen = att . getDataLength ( ) + StunAttribute . HEADER_LENGTH ; // take attribute padding into account :
attLen += ( 4 - ( attLen % 4 ) ) % 4 ; length += attLen ; } return length ; |
public class Objects2 { /** * Performs emptiness and nullness check . Supports the following types :
* String , CharSequence , Optional , Iterator , Iterable , Collection , Map , Object [ ] , primitive [ ] */
public static < T > T checkNotEmpty ( T reference , String errorMessageTemplate , Object ... errorMessageArgs... | checkNotNull ( reference , errorMessageTemplate , errorMessageArgs ) ; checkArgument ( not ( Decisions . isEmpty ( ) ) . apply ( reference ) , errorMessageTemplate , errorMessageArgs ) ; return reference ; |
public class CommandTemplate { /** * Provides a message which describes the expected format and arguments
* for this command . This is used to provide user feedback when a command
* request is malformed .
* @ return A message describing the command protocol format . */
protected String getExpectedMessage ( ) { } ... | StringBuilder syntax = new StringBuilder ( "<tag> " ) ; syntax . append ( getName ( ) ) ; String args = getArgSyntax ( ) ; if ( args != null && args . length ( ) > 0 ) { syntax . append ( ' ' ) ; syntax . append ( args ) ; } return syntax . toString ( ) ; |
public class HammerWidget { /** * Change initial settings of this widget .
* @ param option { @ link org . geomajas . hammergwt . client . option . GestureOption }
* @ param value T look at { @ link org . geomajas . hammergwt . client . option . GestureOptions }
* interface for all possible types
* @ param < T ... | hammertime . setOption ( option , value ) ; |
public class CloseableTab { /** * Adds a { @ link CloseableTab } with the given title and component to
* the given tabbed pane . The given { @ link CloseCallback } will be
* consulted to decide whether the tab may be closed
* @ param tabbedPane The tabbed pane
* @ param title The title of the tab
* @ param co... | int index = tabbedPane . getTabCount ( ) ; tabbedPane . addTab ( title , component ) ; tabbedPane . setTabComponentAt ( index , new CloseableTab ( tabbedPane , closeCallback ) ) ; tabbedPane . setSelectedIndex ( index ) ; |
public class FBFrame { /** * Helps above method , runs through all components recursively . */
protected void setFontSizeHelper ( float size , Component ... comps ) { } } | for ( Component comp : comps ) { comp . setFont ( comp . getFont ( ) . deriveFont ( size ) ) ; if ( comp instanceof Container ) { setFontSizeHelper ( size , ( ( Container ) comp ) . getComponents ( ) ) ; } } |
public class BucketConfigurationXmlFactory { /** * Converts the specified logging configuration into an XML byte array .
* @ param loggingConfiguration
* The configuration to convert .
* @ return The XML byte array representation . */
public byte [ ] convertToXmlByteArray ( BucketLoggingConfiguration loggingConfi... | // Default log file prefix to the empty string if none is specified
String logFilePrefix = loggingConfiguration . getLogFilePrefix ( ) ; if ( logFilePrefix == null ) logFilePrefix = "" ; XmlWriter xml = new XmlWriter ( ) ; xml . start ( "BucketLoggingStatus" , "xmlns" , Constants . XML_NAMESPACE ) ; if ( loggingConfigu... |
public class CmsJspNavBuilder { /** * Collect all navigation elements from the files in the given folder . < p >
* @ param folder the selected folder
* @ param visibility the visibility mode
* @ param resourceFilter the filter to use reading the resources
* @ return A sorted ( ascending to navigation position )... | folder = CmsFileUtil . removeTrailingSeparator ( folder ) ; List < CmsJspNavElement > result = new ArrayList < CmsJspNavElement > ( ) ; List < CmsResource > resources = null ; try { resources = m_cms . getResourcesInFolder ( folder , resourceFilter ) ; } catch ( Exception e ) { // should never happen
LOG . error ( e . ... |
public class ChainingAttributeReleasePolicy { /** * Add policies .
* @ param policies the policies */
public void addPolicies ( final RegisteredServiceAttributeReleasePolicy ... policies ) { } } | this . policies . addAll ( Arrays . stream ( policies ) . collect ( Collectors . toList ( ) ) ) ; |
public class TrivialSwap { /** * Swap two elements of a char array at the specified positions
* @ param charArray array that will have two of its values swapped .
* @ param index1 one of the indexes of the array .
* @ param index2 other index of the array . */
public static void swap ( char [ ] charArray , int in... | TrivialSwap . swap ( charArray , index1 , charArray , index2 ) ; |
public class FloatUtils { /** * Returns next bigger float value considering precision of the argument . */
public static float nextUpF ( float f ) { } } | if ( Float . isNaN ( f ) || f == Float . POSITIVE_INFINITY ) { return f ; } else { f += 0.0f ; return Float . intBitsToFloat ( Float . floatToRawIntBits ( f ) + ( ( f >= 0.0f ) ? + 1 : - 1 ) ) ; } |
public class MetricProcessor { /** * ~ Methods * * * * * */
@ Override public void run ( ) { } } | while ( ! Thread . currentThread ( ) . isInterrupted ( ) ) { try { AsyncBatchedMetricQuery query = batchService . executeNextQuery ( 5000 ) ; if ( query != null ) { LOGGER . info ( "Finished processing " + query . getExpression ( ) + " of batch " + query . getBatchId ( ) ) ; } Thread . sleep ( POLL_INTERVAL_MS ) ; } ca... |
public class IfcComplexNumberImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < String > getWrappedValueAsString ( ) { } } | return ( EList < String > ) eGet ( Ifc2x3tc1Package . Literals . IFC_COMPLEX_NUMBER__WRAPPED_VALUE_AS_STRING , true ) ; |
public class AddressDivisionGrouping { /** * In the case where the prefix sits at a segment boundary , and the prefix sequence is null - null - 0 , this changes to prefix sequence of null - x - 0 , where x is segment bit length .
* Note : We allow both [ null , null , 0 ] and [ null , x , 0 ] where x is segment lengt... | // we ' ve already verified segment prefixes in super constructor . We simply need to check the case where the prefix is at a segment boundary ,
// whether the network side has the correct prefix
int networkSegmentIndex = getNetworkSegmentIndex ( sectionPrefixBits , segmentByteCount , segmentBitCount ) ; if ( networkSe... |
public class ProjectUtilities { /** * Removes the FindBugs nature from a project .
* @ param project
* The project the nature will be removed from .
* @ param monitor
* A progress monitor . Must not be null .
* @ throws CoreException */
public static void removeFindBugsNature ( IProject project , IProgressMon... | if ( ! hasFindBugsNature ( project ) ) { return ; } IProjectDescription description = project . getDescription ( ) ; String [ ] prevNatures = description . getNatureIds ( ) ; ArrayList < String > newNaturesList = new ArrayList < > ( ) ; for ( int i = 0 ; i < prevNatures . length ; i ++ ) { if ( ! FindbugsPlugin . NATUR... |
public class Errors { /** * Converts this { @ code Consumer < Throwable > } to a { @ code Consumer < Optional < Throwable > > } . */
public Consumer < Optional < Throwable > > asTerminal ( ) { } } | return errorOpt -> { if ( errorOpt . isPresent ( ) ) { accept ( errorOpt . get ( ) ) ; } } ; |
public class LongChromosome { /** * Create a new random { @ code LongChromosome } .
* @ param min the min value of the { @ link LongGene } s ( inclusively ) .
* @ param max the max value of the { @ link LongGene } s ( inclusively ) .
* @ param length the length of the chromosome .
* @ return a new { @ code Long... | return of ( min , max , IntRange . of ( length ) ) ; |
public class AbstractExtendedSet { /** * { @ inheritDoc } */
@ Override public ExtendedSet < T > difference ( Collection < ? extends T > other ) { } } | ExtendedSet < T > clone = clone ( ) ; clone . removeAll ( other ) ; return clone ; |
public class CompilerInput { /** * Gets a list of namespaces and paths depended on by this input , but does not attempt to
* regenerate the dependency information . Typically this occurs from module rewriting . */
ImmutableCollection < Require > getKnownRequires ( ) { } } | return concat ( dependencyInfo != null ? dependencyInfo . getRequires ( ) : ImmutableList . of ( ) , extraRequires ) ; |
public class Utf16RevReader { /** * Reads into a character buffer using the correct encoding . */
public int read ( char [ ] cbuf , int off , int len ) throws IOException { } } | int i = 0 ; for ( i = 0 ; i < len ; i ++ ) { int ch1 = is . read ( ) ; int ch2 = is . read ( ) ; if ( ch1 < 0 ) return i == 0 ? - 1 : i ; cbuf [ off + i ] = ( char ) ( ( ch2 << 8 ) + ch1 ) ; } return i ; |
public class FieldValueMappingCallback { /** * The fieldType is a collection . However , the component type of
* the collection is a property type , e . g . List & lt ; String & gt ; . We must
* fetch the property with the array - type of the component type ( e . g . String [ ] )
* and add the values to a new ins... | Class < ? > arrayType = field . metaData . getArrayTypeOfTypeParameter ( ) ; Object [ ] elements = ( Object [ ] ) resolvePropertyTypedValue ( field , arrayType ) ; if ( elements != null ) { @ SuppressWarnings ( "unchecked" ) Collection < Object > collection = ReflectionUtil . instantiateCollectionType ( ( Class < Colle... |
public class XMLPrettyPrinter { protected void write ( Writer writer , String s ) { } } | try { writer . write ( s ) ; } catch ( IOException e ) { throw new DukeException ( e ) ; } |
public class PropertyChangeSupport { /** * Remove a PropertyChangeListener for a specific property .
* If < code > listener < / code > was added more than once to the same event
* source for the specified property , it will be notified one less time
* after being removed .
* If < code > propertyName < / code > ... | if ( listener == null || propertyName == null ) { return ; } listener = this . map . extract ( listener ) ; if ( listener != null ) { this . map . remove ( propertyName , listener ) ; } |
public class ScopedAttributeResolver { /** * returns null if not found */
private static Map < String , Object > findScopedMap ( final FacesContext facesContext , final Object property ) { } } | if ( facesContext == null ) { return null ; } final ExternalContext extContext = facesContext . getExternalContext ( ) ; if ( extContext == null ) { return null ; } final boolean startup = ( extContext instanceof StartupServletExternalContextImpl ) ; Map < String , Object > scopedMap ; // request scope ( not available ... |
public class ESRIBounds { /** * Ensure that min and max values are correctly ordered . */
public void ensureMinMax ( ) { } } | double t ; if ( this . maxx < this . minx ) { t = this . minx ; this . minx = this . maxx ; this . maxx = t ; } if ( this . maxy < this . miny ) { t = this . miny ; this . miny = this . maxy ; this . maxy = t ; } if ( this . maxz < this . minz ) { t = this . minz ; this . minz = this . maxz ; this . maxz = t ; } if ( t... |
public class BundleBuilderFactory { /** * private static List < String > createExportPackageFromResource ( Resource jar ) { / / get all
* directories List < Resource > dirs = ResourceUtil . listRecursive ( jar , DirectoryResourceFilter . FILTER ) ;
* List < String > rtn = new ArrayList < String > ( ) ; / / remove d... | if ( list == null ) return false ; Iterator < String > it = list . iterator ( ) ; while ( it . hasNext ( ) ) { if ( "*" . equals ( it . next ( ) ) ) return true ; } return false ; |
public class ZipUtil { /** * 解压
* @ param zipFilePath 压缩文件的路径
* @ param outFileDir 解压到的目录
* @ param charset 编码
* @ return 解压的目录
* @ throws UtilException IO异常 */
public static File unzip ( String zipFilePath , String outFileDir , Charset charset ) throws UtilException { } } | return unzip ( FileUtil . file ( zipFilePath ) , FileUtil . mkdir ( outFileDir ) , charset ) ; |
public class WebSocketConnection { /** * On subscription of the returned { @ link Observable } , writes the passed message stream on the underneath channel
* and flushes the channel , everytime , { @ code flushSelector } returns { @ code true } . Any writes issued before
* subscribing , will also be flushed . Howev... | return delegate . write ( msgs , flushSelector ) ; |
public class CompositeDateFormat { /** * { @ inheritDoc } */
@ Override public Date parse ( final String dateStr , final ParsePosition pos ) { } } | final ParsePosition posCopy = new ParsePosition ( pos . getIndex ( ) ) ; Date date = null ; boolean success = false ; for ( final DateFormatFactory dfFactory : DATE_FORMAT_FACTORIES ) { posCopy . setIndex ( pos . getIndex ( ) ) ; posCopy . setErrorIndex ( pos . getErrorIndex ( ) ) ; date = dfFactory . create ( ) . pars... |
public class KeyExchange { /** * Fetches the secret key from a protocol above us
* @ return The secret key and its version */
protected Tuple < SecretKey , byte [ ] > getSecretKeyFromAbove ( ) { } } | return ( Tuple < SecretKey , byte [ ] > ) up_prot . up ( new Event ( Event . GET_SECRET_KEY ) ) ; |
public class ModelCurator { /** * When refering to self using the same local and reference _ id remove it
* @ param model
* @ param modelList
* @ return */
private void removeUnnecessaryHasManyToSelf ( ) { } } | model . getPrimaryAttributes ( ) ; String [ ] hasMany = model . getHasMany ( ) ; String [ ] hasManyLocalColumn = model . getHasManyLocalColumn ( ) ; String [ ] hasManyReferencedColumn = model . getHasManyReferencedColumn ( ) ; for ( int i = 0 ; i < hasMany . length ; i ++ ) { boolean hasManyLocalInPrimary = CStringUtil... |
public class SecretListEntry { /** * A list of all of the currently assigned < code > SecretVersionStage < / code > staging labels and the
* < code > SecretVersionId < / code > that each is attached to . Staging labels are used to keep track of the different
* versions during the rotation process .
* < note >
*... | setSecretVersionsToStages ( secretVersionsToStages ) ; return this ; |
public class ObjectFunctionSetSpecificationImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setArchVrsn ( Integer newArchVrsn ) { } } | Integer oldArchVrsn = archVrsn ; archVrsn = newArchVrsn ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . OBJECT_FUNCTION_SET_SPECIFICATION__ARCH_VRSN , oldArchVrsn , archVrsn ) ) ; |
public class TransactionRomanticMemoriesBuilder { protected void setupResultExp ( StringBuilder sb , TransactionSavedRecentResult result ) { } } | final Class < ? > resultType = result . getResultType ( ) ; // not null
final Map < String , Object > resultMap = result . getResultMap ( ) ; // not null
sb . append ( resultType . getSimpleName ( ) ) . append ( ":" ) . append ( buildResultExp ( resultMap ) ) ; |
public class FileUtils { /** * Converts an file permissions mode integer to a PosixFilePermission set .
* @ param aMode An integer permissions mode .
* @ return A PosixFilePermission set */
public static Set < PosixFilePermission > convertToPermissionsSet ( final int aMode ) { } } | final Set < PosixFilePermission > result = EnumSet . noneOf ( PosixFilePermission . class ) ; if ( isSet ( aMode , 0400 ) ) { result . add ( PosixFilePermission . OWNER_READ ) ; } if ( isSet ( aMode , 0200 ) ) { result . add ( PosixFilePermission . OWNER_WRITE ) ; } if ( isSet ( aMode , 0100 ) ) { result . add ( PosixF... |
public class ComponentImpl { /** * duplicate the datamember in the map , ignores the udfs
* @ param c
* @ param map
* @ param newMap
* @ param deepCopy
* @ return */
public static MapPro duplicateDataMember ( ComponentImpl c , MapPro map , MapPro newMap , boolean deepCopy ) { } } | Iterator it = map . entrySet ( ) . iterator ( ) ; Map . Entry entry ; Object value ; while ( it . hasNext ( ) ) { entry = ( Entry ) it . next ( ) ; value = entry . getValue ( ) ; if ( ! ( value instanceof UDF ) ) { if ( deepCopy ) value = Duplicator . duplicate ( value , deepCopy ) ; newMap . put ( entry . getKey ( ) ,... |
public class AvatarStorageSetup { /** * For non - shared storage , we enforce file uris */
private static String checkFileURIScheme ( Collection < URI > uris ) { } } | for ( URI uri : uris ) if ( uri . getScheme ( ) . compareTo ( JournalType . FILE . name ( ) . toLowerCase ( ) ) != 0 ) return "The specified path is not a file." + "Avatar supports file non-shared storage only... " ; return "" ; |
public class ClientConversationState { /** * Gets the proxy queue group associated with this conversation .
* @ return ProxyQueueConversationGroup */
public ProxyQueueConversationGroup getProxyQueueConversationGroup ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getProxyQueueConversationGroup" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getProxyQueueConversationGroup" , proxyGroup ) ; return proxyGroup ; |
public class Database { /** * Finds a unique result from database , converting the database row to long using default mechanisms .
* Returns empty if there are no results or if single null result is returned .
* @ throws NonUniqueResultException if there are multiple result rows */
public @ NotNull OptionalLong fin... | Optional < Long > value = findOptional ( Long . class , query ) ; return value . isPresent ( ) ? OptionalLong . of ( value . get ( ) ) : OptionalLong . empty ( ) ; |
public class CertificatesMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Certificates certificates , ProtocolMarshaller protocolMarshaller ) { } } | if ( certificates == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( certificates . getClusterCsr ( ) , CLUSTERCSR_BINDING ) ; protocolMarshaller . marshall ( certificates . getHsmCertificate ( ) , HSMCERTIFICATE_BINDING ) ; protocolMarshall... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.