signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AESUtils { /** * AES key should be 16 bytes in length .
* @ param key
* @ return */
public static byte [ ] normalizeKey ( byte [ ] keyData ) { } } | if ( keyData == null ) { return RSG . generate ( 16 ) . getBytes ( StandardCharsets . UTF_8 ) ; } else { return normalizeKey ( new String ( keyData , StandardCharsets . UTF_8 ) ) . getBytes ( StandardCharsets . UTF_8 ) ; } |
public class NagiosWriter { /** * The meat of the output . Nagios format . . */
@ Override public void internalWrite ( Server server , Query query , ImmutableList < Result > results ) throws Exception { } } | checkFile ( query ) ; List < String > typeNames = getTypeNames ( ) ; for ( Result result : results ) { String [ ] keyString = KeyUtils . getKeyString ( server , query , result , typeNames , null ) . split ( "\\." ) ; if ( isNumeric ( result . getValue ( ) ) && filters . contains ( keyString [ 2 ] ) ) { int thresholdPos... |
public class CreateCreativesFromTemplates { /** * Runs the example .
* @ param adManagerServices the services factory .
* @ param session the session .
* @ param advertiserId the ID of the advertiser ( company ) that all creatives will be assigned to .
* @ throws ApiException if the API request failed with one ... | // Get the CreativeService .
CreativeServiceInterface creativeService = adManagerServices . get ( session , CreativeServiceInterface . class ) ; // Create creative size .
Size size = new Size ( ) ; size . setWidth ( 600 ) ; size . setHeight ( 315 ) ; size . setIsAspectRatio ( false ) ; // Use the image banner with opti... |
public class Logger { /** * adding a new anonymous Logger object is handled by doSetParent ( ) . */
@ CallerSensitive public static Logger getAnonymousLogger ( String resourceBundleName ) { } } | LogManager manager = LogManager . getLogManager ( ) ; // cleanup some Loggers that have been GC ' ed
manager . drainLoggerRefQueueBounded ( ) ; // Android - changed : Use VMStack . getStackClass1.
/* J2ObjC modified .
Logger result = new Logger ( null , resourceBundleName ,
VMStack . getStackClass1 ( ) ) ; */
Logge... |
public class WSCredentialProvider { /** * Checks if the subject is valid . Currently , a subject is REQUIRED to have
* a WSCredential , and it is only valid if the WSCredential is not expired .
* @ param subject The subject to validate , { @ code null } is not supported .
* @ return < code > true < / code > if th... | CredentialDestroyedException . class , CredentialExpiredException . class } ) public boolean isSubjectValid ( Subject subject ) { boolean valid = false ; try { WSCredential wsCredential = getWSCredential ( subject ) ; if ( wsCredential != null ) { long credentialExpirationInMillis = wsCredential . getExpiration ( ) ; D... |
public class JTablePanel { /** * Set the model used by the left table .
* @ param model table model */
public void setLeftTableModel ( TableModel model ) { } } | TableModel old = m_leftTable . getModel ( ) ; m_leftTable . setModel ( model ) ; firePropertyChange ( "leftTableModel" , old , model ) ; |
public class CalendarModifiedPrecedingHandler { /** * If the current date of the give calculator is a non - working day , it will
* be moved according to the algorithm implemented .
* @ param calculator
* the calculator
* @ return the date which may have moved . */
@ Override public Calendar moveCurrentDate ( f... | return adjustDate ( calculator . getCurrentBusinessDate ( ) , - 1 , calculator ) ; |
public class FLACDecoder { /** * Read the next data frame .
* @ return The next frame
* @ throws IOException on read error */
public Frame readNextFrame ( ) throws IOException { } } | // boolean got _ a _ frame ;
try { while ( true ) { // switch ( state ) {
// case STREAM _ DECODER _ SEARCH _ FOR _ METADATA :
// findMetadata ( ) ;
// break ;
// case STREAM _ DECODER _ READ _ METADATA :
// readMetadata ( ) ; / * above function sets the status for us * /
// break ;
// case DECODER _ SEARCH _ FOR _ FRA... |
public class CommonOps_DDF3 { /** * Sets every element in the vector to the specified value . < br >
* < br >
* a < sub > i < / sub > = value
* @ param a A vector whose elements are about to be set . Modified .
* @ param v The value each element will have . */
public static void fill ( DMatrix3 a , double v ) {... | a . a1 = v ; a . a2 = v ; a . a3 = v ; |
public class DialogPreference { /** * Obtains the title color of the dialog , which is shown by the preference , from a specific
* typed array .
* @ param typedArray
* The typed array , the title color should be obtained from , as an instance of the class
* { @ link TypedArray } . The typed array may not be nul... | setDialogTitleColor ( typedArray . getColor ( R . styleable . DialogPreference_dialogTitleColor , - 1 ) ) ; |
public class WebFragmentDescriptorImpl { /** * If not already created , a new < code > security - role < / code > element will be created and returned .
* Otherwise , the first existing < code > security - role < / code > element will be returned .
* @ return the instance defined for the element < code > security -... | List < Node > nodeList = model . get ( "security-role" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new SecurityRoleTypeImpl < WebFragmentDescriptor > ( this , "security-role" , model , nodeList . get ( 0 ) ) ; } return createSecurityRole ( ) ; |
public class AssociateCertificateRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AssociateCertificateRequest associateCertificateRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( associateCertificateRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( associateCertificateRequest . getArn ( ) , ARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + ... |
public class UrlValidator { /** * Returns true if the query is null or it ' s a properly formatted query string .
* @ param query Query value to validate .
* @ return true if query is valid . */
protected boolean isValidQuery ( String query ) { } } | if ( query == null ) { return true ; } return QUERY_PATTERN . matcher ( query ) . matches ( ) ; |
public class RepositoryCreationServiceImpl { /** * { @ inheritDoc } */
public String reserveRepositoryName ( String repositoryName ) throws RepositoryCreationException { } } | if ( rpcService != null ) { // reserve RepositoryName at coordinator - node
try { Object result = rpcService . executeCommandOnCoordinator ( reserveRepositoryName , true , repositoryName ) ; if ( result instanceof String ) { return ( String ) result ; } else if ( result instanceof Throwable ) { throw new RepositoryCrea... |
public class DocPath { /** * Return the inverse path for a package .
* For example , if the package is java . lang ,
* the inverse path is . . / . . . */
public static DocPath forRoot ( PackageElement pkgElement ) { } } | String name = ( pkgElement == null || pkgElement . isUnnamed ( ) ) ? "" : pkgElement . getQualifiedName ( ) . toString ( ) ; return new DocPath ( name . replace ( '.' , '/' ) . replaceAll ( "[^/]+" , ".." ) ) ; |
public class VarBindingBuilder { /** * Adds a binding annotation . */
public VarBindingBuilder has ( String name , Object value ) { } } | varBinding_ . setAnnotation ( name , Objects . toString ( value , null ) ) ; return this ; |
public class BigQueryOutputConfiguration { /** * Gets the write disposition of the output table . This specifies the action that occurs if the
* destination table already exists . By default , if the table already exists , BigQuery appends
* data to the output table .
* @ param conf the configuration to reference... | return conf . get ( BigQueryConfiguration . OUTPUT_TABLE_WRITE_DISPOSITION_KEY , BigQueryConfiguration . OUTPUT_TABLE_WRITE_DISPOSITION_DEFAULT ) ; |
public class FLUSH { /** * Starts the flush protocol
* @ param members List of participants in the flush protocol . Guaranteed to be non - null */
private void onSuspend ( final List < Address > members ) { } } | Message msg = null ; Collection < Address > participantsInFlush = null ; synchronized ( sharedLock ) { flushCoordinator = localAddress ; // start FLUSH only on group members that we need to flush
participantsInFlush = members ; participantsInFlush . retainAll ( currentView . getMembers ( ) ) ; flushMembers . clear ( ) ... |
public class DefaultZoomableController { /** * Sets the image bounds , in view - absolute coordinates . */
@ Override public void setImageBounds ( RectF imageBounds ) { } } | if ( ! imageBounds . equals ( mImageBounds ) ) { mImageBounds . set ( imageBounds ) ; onTransformChanged ( ) ; if ( mImageBoundsListener != null ) { mImageBoundsListener . onImageBoundsSet ( mImageBounds ) ; } } |
public class CmsEntity { /** * Removes the attribute without triggering any change events . < p >
* @ param attributeName the attribute name */
public void removeAttributeSilent ( String attributeName ) { } } | CmsEntityAttribute attr = getAttribute ( attributeName ) ; if ( attr != null ) { if ( attr . isSimpleValue ( ) ) { m_simpleAttributes . remove ( attributeName ) ; } else { for ( CmsEntity child : attr . getComplexValues ( ) ) { removeChildChangeHandler ( child ) ; } m_entityAttributes . remove ( attributeName ) ; } } |
public class ArgumentParser { /** * Get argument name */
private String getArgumentName ( final String arg ) { } } | int pos = arg . indexOf ( "=" ) ; if ( pos == - 1 ) { pos = arg . indexOf ( ":" ) ; } return arg . substring ( 0 , pos != - 1 ? pos : arg . length ( ) ) ; |
public class CmsContainerpageService { /** * Converts container page element data to a bean which can be saved in a container page . < p >
* @ param cms the current CMS context
* @ param containerpageRootPath the container page root path
* @ param container the container containing the element
* @ param element... | String elementClientId = elementData . getClientId ( ) ; boolean hasUuidPrefix = ( elementClientId != null ) && elementClientId . matches ( CmsUUID . UUID_REGEX + ".*$" ) ; boolean isCreateNew = elementData . isCreateNew ( ) ; if ( elementData . isNew ( ) && ! hasUuidPrefix ) { // Due to the changed save system without... |
public class LoadBalancerAttributes { /** * This parameter is reserved .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAdditionalAttributes ( java . util . Collection ) } or { @ link # withAdditionalAttributes ( java . util . Collection ) }
* if you wa... | if ( this . additionalAttributes == null ) { setAdditionalAttributes ( new com . amazonaws . internal . SdkInternalList < AdditionalAttribute > ( additionalAttributes . length ) ) ; } for ( AdditionalAttribute ele : additionalAttributes ) { this . additionalAttributes . add ( ele ) ; } return this ; |
public class Constituent { /** * getter for parent - gets The parent in a constituency tree , C
* @ generated
* @ return value of the feature */
public Constituent getParent ( ) { } } | if ( Constituent_Type . featOkTst && ( ( Constituent_Type ) jcasType ) . casFeat_parent == null ) jcasType . jcas . throwFeatMissing ( "parent" , "de.julielab.jules.types.Constituent" ) ; return ( Constituent ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Constituent_Type ) jca... |
public class AbstractParsedStmt { /** * Perform various optimizations for IN / EXISTS subqueries if possible
* @ param expr to optimize
* @ return optimized expression */
private AbstractExpression optimizeInExpressions ( AbstractExpression expr ) { } } | ExpressionType exprType = expr . getExpressionType ( ) ; if ( ExpressionType . CONJUNCTION_AND == exprType || ExpressionType . CONJUNCTION_OR == exprType ) { AbstractExpression optimizedLeft = optimizeInExpressions ( expr . getLeft ( ) ) ; expr . setLeft ( optimizedLeft ) ; AbstractExpression optimizedRight = optimizeI... |
public class AbstractSailthruClient { /** * HTTP POST Request with Interface implementation of ApiParams and ApiFileParams
* @ param data
* @ param fileParams
* @ throws IOException */
public JsonResponse apiPost ( ApiParams data , ApiFileParams fileParams ) throws IOException { } } | return httpRequestJson ( HttpRequestMethod . POST , data , fileParams ) ; |
public class OrientationHelperEx { /** * Creates a vertical OrientationHelper for the given LayoutManager .
* @ param layoutManager The LayoutManager to attach to .
* @ return A new OrientationHelper */
public static OrientationHelperEx createVerticalHelper ( ExposeLinearLayoutManagerEx layoutManager ) { } } | return new OrientationHelperEx ( layoutManager ) { @ Override public int getEndAfterPadding ( ) { return mLayoutManager . getHeight ( ) - mLayoutManager . getPaddingBottom ( ) ; } @ Override public int getEnd ( ) { return mLayoutManager . getHeight ( ) ; } @ Override public void offsetChildren ( int amount ) { mLayoutM... |
public class ServletHttpResponse { public void setBufferSize ( int size ) { } } | HttpOutputStream out = ( HttpOutputStream ) _httpResponse . getOutputStream ( ) ; if ( out . isWritten ( ) || _writer != null && _writer . isWritten ( ) ) throw new IllegalStateException ( "Output written" ) ; out . setBufferSize ( size ) ; |
public class CmsXmlContentDefinition { /** * Returns a content handler instance for the given resource . < p >
* @ param cms the cms - object
* @ param resource the resource
* @ return the content handler
* @ throws CmsException if something goes wrong */
public static I_CmsXmlContentHandler getContentHandlerFo... | return getContentDefinitionForResource ( cms , resource ) . getContentHandler ( ) ; |
public class AbstractReferencedValueMap { /** * Create a storage object that permits to put the specified
* elements inside this map .
* @ param key is the key associated to the value
* @ param value is the value
* @ return the new storage object */
protected final ReferencableValue < K , V > makeValue ( K key ... | return makeValue ( key , value , this . queue ) ; |
public class TimeCounter { /** * Stops or suspends the time count .
* @ return This { @ link TimeCounter } . */
public TimeCounter stop ( ) { } } | switch ( state ) { case UNSTARTED : throw new IllegalStateException ( "Not started. " ) ; case STOPPED : throw new IllegalStateException ( "Already stopped. " ) ; case RUNNING : watch . suspend ( ) ; } state = State . STOPPED ; return this ; |
public class UResourceBundle { /** * Returns a resource in a given resource that has a given index , or null if the
* resource is not found .
* @ param index the index of the resource
* @ return the resource , or null
* @ see # get ( int )
* @ deprecated This API is ICU internal only .
* @ hide draft / prov... | // NOTE : this _ barely _ works for top - level resources . For resources at lower
// levels , it fails when you fall back to the parent , since you ' re now
// looking at root resources , not at the corresponding nested resource .
// Not only that , but unless the indices correspond 1 - to - 1 , the index will
// lose... |
public class GetVpcLinksResult { /** * The current page of elements from this collection .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setItems ( java . util . Collection ) } or { @ link # withItems ( java . util . Collection ) } if you want to override t... | if ( this . items == null ) { setItems ( new java . util . ArrayList < VpcLink > ( items . length ) ) ; } for ( VpcLink ele : items ) { this . items . add ( ele ) ; } return this ; |
public class JCuda { /** * [ C + + API ] Binds an array to a surface
* < pre >
* template < class T , int dim > cudaError _ t cudaBindSurfaceToArray (
* const surface < T ,
* dim > & surf ,
* cudaArray _ const _ t array ,
* const cudaChannelFormatDesc & desc ) [ inline ]
* < / pre >
* < div >
* < p > ... | return checkResult ( cudaBindSurfaceToArrayNative ( surfref , array , desc ) ) ; |
public class ClassificationServiceCache { /** * Indicates whether or not the given { @ link FileModel } is already attached to the { @ link ClassificationModel } .
* Note that this assumes all { @ link ClassificationModel } attachments are handled via the { @ link ClassificationService } .
* Outside of tests , this... | String key = getClassificationFileModelCacheKey ( classificationModel , fileModel ) ; Boolean linked = getCache ( event ) . get ( key ) ; if ( linked == null ) { GraphTraversal < Vertex , Vertex > existenceCheck = new GraphTraversalSource ( event . getGraphContext ( ) . getGraph ( ) ) . V ( classificationModel . getEle... |
public class DirectLogFetcher { /** * Put 32 - bit integer in the buffer .
* @ param i32 the integer to put in the buffer */
protected final void putInt32 ( long i32 ) { } } | ensureCapacity ( position + 4 ) ; byte [ ] buf = buffer ; buf [ position ++ ] = ( byte ) ( i32 & 0xff ) ; buf [ position ++ ] = ( byte ) ( i32 >>> 8 ) ; buf [ position ++ ] = ( byte ) ( i32 >>> 16 ) ; buf [ position ++ ] = ( byte ) ( i32 >>> 24 ) ; |
public class Reflect { /** * Create a proxy for the wrapped object allowing to typesafely invoke
* methods on it using a custom interface
* @ param proxyType The interface type that is implemented by the proxy
* @ return A proxy for the wrapped object */
@ SuppressWarnings ( "unchecked" ) public < P > P as ( fina... | final boolean isMap = ( object instanceof Map ) ; final InvocationHandler handler = new InvocationHandler ( ) { @ Override @ SuppressWarnings ( "null" ) public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { String name = method . getName ( ) ; // Actual method name matches always co... |
public class SipCall { /** * This method sends a basic response to a previously received MESSAGE request . The response is
* constructed based on the parameters passed in . Call this method after waitForMessage ( ) returns
* true . Call this method multiple times to send multiple responses to the received MESSAGE .... | return sendMessageResponse ( statusCode , reasonPhrase , expires , null , null , null ) ; |
public class CollectionUtil { /** * < p > toPrimitiveDoubleArray . < / p >
* @ param values a { @ link java . util . List } object .
* @ return a { @ link java . lang . Object } object . */
public static Object toPrimitiveDoubleArray ( List < ? > values ) { } } | double [ ] array = new double [ values . size ( ) ] ; int cursor = 0 ; for ( Object o : values ) { array [ cursor ] = ( Double ) o ; cursor ++ ; } return array ; |
public class CmsToolBar { /** * Creates a properly styled toolbar button . < p >
* @ param icon the button icon
* @ param title the button title , will be used for the tooltip
* @ return the button */
public static Button createButton ( Resource icon , String title ) { } } | return createButton ( icon , title , false ) ; |
public class CmsCreateSiteThread { /** * Creates online version of given CmsObject . < p >
* @ param cms given CmsObject
* @ return online CmsObject */
private CmsObject getOnlineCmsObject ( CmsObject cms ) { } } | CmsObject res = null ; try { res = OpenCms . initCmsObject ( cms ) ; res . getRequestContext ( ) . setCurrentProject ( cms . readProject ( CmsProject . ONLINE_PROJECT_ID ) ) ; } catch ( CmsException e ) { LOG . error ( "Cannot create CmsObject" , e ) ; } return res ; |
public class KeyWrapper { /** * Encodes the given { @ link PublicKey } < em > without wrapping < / em > . Since a
* public key is public , this is a convenience method provided to convert it
* to a String for unprotected storage .
* This method internally calls { @ link ByteArray # toBase64 ( byte [ ] ) } ,
* p... | byte [ ] bytes = key . getEncoded ( ) ; return BEGIN + "\n" + new String ( Base64 . encodeBase64Chunked ( bytes ) , StandardCharsets . UTF_8 ) . trim ( ) + "\n" + END ; |
public class SdkUtils { /** * Helper method that wraps given arrays inside of a single outputstream .
* @ param outputStreams an array of multiple outputstreams .
* @ return a single outputstream that will write to provided outputstreams . */
public static OutputStream createArrayOutputStream ( final OutputStream [... | return new OutputStream ( ) { @ Override public void close ( ) throws IOException { for ( OutputStream o : outputStreams ) { o . close ( ) ; } super . close ( ) ; } @ Override public void flush ( ) throws IOException { for ( OutputStream o : outputStreams ) { o . flush ( ) ; } super . flush ( ) ; } @ Override public vo... |
public class AnnotationId { /** * Construct an instance . It initially contains no elements .
* @ param declaringType the type declaring the program element .
* @ param type the annotation type .
* @ param annotatedElement the program element type to be annotated .
* @ return an annotation { @ code AnnotationId... | if ( annotatedElement != ElementType . TYPE && annotatedElement != ElementType . METHOD && annotatedElement != ElementType . FIELD && annotatedElement != ElementType . PARAMETER ) { throw new IllegalArgumentException ( "element type is not supported to annotate yet." ) ; } return new AnnotationId < > ( declaringType , ... |
public class AmazonIdentityManagementClient { /** * Deletes a virtual MFA device .
* < note >
* You must deactivate a user ' s virtual MFA device before you can delete it . For information about deactivating MFA
* devices , see < a > DeactivateMFADevice < / a > .
* < / note >
* @ param deleteVirtualMFADeviceR... | request = beforeClientExecution ( request ) ; return executeDeleteVirtualMFADevice ( request ) ; |
public class OneKey { /** * Compares the key ' s assigned algorithm with the provided value , indicating if the values are the
* same .
* @ param algorithmId
* the algorithm to compare or { @ code null } to check for no assignment .
* @ return { @ code true } if the current key has the provided algorithm assign... | CBORObject thisObj = get ( KeyKeys . Algorithm ) ; CBORObject thatObj = ( algorithmId == null ? null : algorithmId . AsCBOR ( ) ) ; boolean result ; if ( thatObj == null ) { result = ( thisObj == null ) ; } else { result = thatObj . equals ( thisObj ) ; } return result ; |
public class TypeUtil { /** * Gets the parameterization of the given base type .
* For example , given the following
* < pre > { @ code
* interface Foo < T > extends List < List < T > > { }
* interface Bar extends Foo < String > { }
* } < / pre >
* This method works like this :
* < pre > { @ code
* getB... | return baseClassFinder . visit ( type , baseType ) ; |
public class EventsHelper { /** * Bind a function to the focus event of each matched element .
* @ param jsScope
* Scope to use
* @ return the jQuery code */
public static ChainableStatement focus ( JsScope jsScope ) { } } | return new DefaultChainableStatement ( StateEvent . FOCUS . getEventLabel ( ) , jsScope . render ( ) ) ; |
public class ShellUtils { /** * Copy a URL package to a target folder
* @ param uri the URI to download core release package
* @ param destination the target filename to download the release package to
* @ param isVerbose display verbose output or not
* @ return true if successful */
public static boolean curlP... | // get the directory containing the target file
File parentDirectory = Paths . get ( destination ) . getParent ( ) . toFile ( ) ; // using curl copy the url to the target file
String cmd = String . format ( "curl %s -o %s" , uri , destination ) ; int ret = runSyncProcess ( isVerbose , isInheritIO , splitTokens ( cmd ) ... |
public class DfuServiceInitiator { /** * Sets custom UUIDs for the Buttonless DFU Service from SDK 14 ( or later ) .
* Use this method if your DFU implementation uses different UUID for at least one of the given
* UUIDs . Parameter set to < code > null < / code > will reset the UUID to the default value .
* @ par... | final ParcelUuid [ ] uuids = new ParcelUuid [ 2 ] ; uuids [ 0 ] = buttonlessDfuServiceUuid != null ? new ParcelUuid ( buttonlessDfuServiceUuid ) : null ; uuids [ 1 ] = buttonlessDfuControlPointUuid != null ? new ParcelUuid ( buttonlessDfuControlPointUuid ) : null ; buttonlessDfuWithBondSharingUuids = uuids ; return thi... |
public class MapPolygon { /** * Replies if this element has an intersection
* with the specified rectangle .
* @ return < code > true < / code > if this MapElement is intersecting the specified area ,
* otherwise < code > false < / code > */
@ Override @ Pure public boolean intersects ( Shape2D < ? , ? , ? , ? , ... | if ( boundsIntersects ( rectangle ) ) { final Path2d p = toPath2D ( ) ; return p . intersects ( rectangle ) ; } return false ; |
public class Base64Utils { /** * Base64 - decode the given byte array from an UTF - 8 String .
* @ param src the encoded UTF - 8 String ( may be { @ code null } )
* @ return the original byte array ( or { @ code null } if the input was { @ code null } )
* @ throws IllegalStateException if Base64 encoding is not s... | assertSupported ( ) ; if ( src == null ) { return null ; } if ( src . length ( ) == 0 ) { return new byte [ 0 ] ; } return delegate . decode ( src . getBytes ( DEFAULT_CHARSET ) ) ; |
public class BidiLine { /** * Gets the width of a range of characters .
* @ param startIdx the first index to calculate
* @ param lastIdx the last inclusive index to calculate
* @ return the sum of all widths */
public float getWidth ( int startIdx , int lastIdx ) { } } | char c = 0 ; PdfChunk ck = null ; float width = 0 ; for ( ; startIdx <= lastIdx ; ++ startIdx ) { boolean surrogate = Utilities . isSurrogatePair ( text , startIdx ) ; if ( surrogate ) { width += detailChunks [ startIdx ] . getCharWidth ( Utilities . convertToUtf32 ( text , startIdx ) ) ; ++ startIdx ; } else { c = tex... |
public class PiwikRequest { /** * Get the value at the specified index from the json array at the specified
* parameter .
* @ param key the key of the json array to access
* @ param index the index of the value in the json array
* @ return the value at the index in the json array */
private JsonValue getFromJso... | PiwikJsonArray a = ( PiwikJsonArray ) parameters . get ( key ) ; if ( a == null ) { return null ; } return a . get ( index ) ; |
public class BluetoothLeScannerCompat { /** * Start Bluetooth LE scan . The scan results will be delivered through { @ code callback } .
* Requires { @ link Manifest . permission # BLUETOOTH _ ADMIN } permission .
* An app must hold
* { @ link Manifest . permission # ACCESS _ COARSE _ LOCATION ACCESS _ FINE _ LOC... | Manifest . permission . BLUETOOTH_ADMIN , Manifest . permission . BLUETOOTH } ) public final void startScan ( @ Nullable final List < ScanFilter > filters , @ Nullable final ScanSettings settings , @ NonNull final ScanCallback callback ) { // noinspection ConstantConditions
if ( callback == null ) { throw new IllegalAr... |
public class SagaExecutionTask { /** * Similar to { @ link # handle ( ) } but intended for execution on any thread . < p / >
* May throw a runtime exception in case something went wrong invoking the target saga message handler . */
@ Override public void run ( ) { } } | try { handle ( ) ; } catch ( Exception e ) { Throwables . throwIfUnchecked ( e ) ; throw new RuntimeException ( e ) ; } |
public class Reflection { /** * recursive method . */
private static List < Field > getAllFieldsRec ( Class clazz , List < Field > fieldList ) { } } | Class superClazz = clazz . getSuperclass ( ) ; if ( superClazz != null ) { getAllFieldsRec ( superClazz , fieldList ) ; } fieldList . addAll ( ArrayUtil . toList ( clazz . getDeclaredFields ( ) , Field . class ) ) ; return fieldList ; |
public class SettingsMode { /** * CLI Utility Methods */
public static SettingsMode get ( Map < String , String [ ] > clArgs ) { } } | String [ ] params = clArgs . remove ( "-mode" ) ; if ( params == null ) { Cql3NativeOptions opts = new Cql3NativeOptions ( ) ; opts . accept ( "cql3" ) ; opts . accept ( "native" ) ; opts . accept ( "prepared" ) ; return new SettingsMode ( opts ) ; } GroupedOptions options = GroupedOptions . select ( params , new Thrif... |
public class DailyCalendar { /** * Determines the next time included by the < CODE > DailyCalendar < / CODE > after
* the specified time .
* @ param timeInMillis
* the initial date / time after which to find an included time
* @ return the time in milliseconds representing the next time included after
* the s... | long nextIncludedTime = timeInMillis + oneMillis ; while ( ! isTimeIncluded ( nextIncludedTime ) ) { if ( ! m_bInvertTimeRange ) { // If the time is in a range excluded by this calendar , we can
// move to the end of the excluded time range and continue
// testing from there . Otherwise , if nextIncludedTime is
// excl... |
public class ExpandableButtonMenu { /** * Initialized animation properties */
private void calculateAnimationProportions ( ) { } } | TRANSLATION_Y = sHeight * buttonDistanceY ; TRANSLATION_X = sWidth * buttonDistanceX ; anticipation = new AnticipateInterpolator ( INTERPOLATOR_WEIGHT ) ; overshoot = new OvershootInterpolator ( INTERPOLATOR_WEIGHT ) ; |
public class JKDateTimeUtil { /** * Checks if is date eqaualed .
* @ param date1 the date 1
* @ param date2 the date 2
* @ return true , if is date eqaualed */
public static boolean isDateEqaualed ( final java . util . Date date1 , final java . util . Date date2 ) { } } | final String d1 = JKFormatUtil . formatDate ( date1 , JKFormatUtil . MYSQL_DATE_DB_PATTERN ) ; final String d2 = JKFormatUtil . formatDate ( date2 , JKFormatUtil . MYSQL_DATE_DB_PATTERN ) ; return d1 . equalsIgnoreCase ( d2 ) ; |
public class RTTextLogger { /** * ( non - Javadoc )
* @ see org . overture . interpreter . messages . rtlog . IRTLogger # enable ( boolean ) */
@ Override public synchronized void enable ( boolean on ) { } } | if ( ! on ) { dump ( true ) ; cached = null ; } enabled = on ; |
public class StormpathShiroIniEnvironment { /** * Wraps the original FilterChainResolver in a priority based instance , which will detect Stormpath API based logins
* ( form , auth headers , etc ) .
* @ return */
@ Override protected FilterChainResolver createFilterChainResolver ( ) { } } | FilterChainResolver originalFilterChainResolver = super . createFilterChainResolver ( ) ; if ( originalFilterChainResolver == null ) { return null ; } return getFilterChainResolverFactory ( originalFilterChainResolver ) . getInstance ( ) ; |
public class JournalQueue { /** * Migrate all operations to the given target queue
* @ param otherQueue target journal queue */
public void migrateTo ( JournalQueue otherQueue ) { } } | if ( head == null ) return ; // Empty
if ( otherQueue . head == null ) { // Other queue was empty , copy everything
otherQueue . head = head ; otherQueue . tail = tail ; otherQueue . size = size ; } else { // Other queue is not empty , append operations
otherQueue . tail . setNext ( head ) ; otherQueue . tail = tail ; ... |
public class InternalUtils { /** * TODO : make this pluggable */
public static Object unwrapFormBean ( ActionForm form ) { } } | if ( form == null ) return null ; if ( form instanceof AnyBeanActionForm ) { return ( ( AnyBeanActionForm ) form ) . getBean ( ) ; } return form ; |
public class ByteArrayDiskQueue { /** * Creates a new disk - based queue of byte arrays .
* @ param file the file that will be used to dump the queue on disk .
* @ param bufferSize the number of items in the circular buffer ( will be possibly decreased so to be a power of two ) .
* @ param direct whether the { @ ... | return new ByteArrayDiskQueue ( ByteDiskQueue . createNew ( file , bufferSize , direct ) ) ; |
public class AmazonGameLiftClient { /** * Updates capacity settings for a fleet . Use this action to specify the number of EC2 instances ( hosts ) that you
* want this fleet to contain . Before calling this action , you may want to call < a > DescribeEC2InstanceLimits < / a > to
* get the maximum capacity based on ... | request = beforeClientExecution ( request ) ; return executeUpdateFleetCapacity ( request ) ; |
public class DocumentBlock { /** * setter for hasBold - sets
* @ generated
* @ param v value to set into the feature */
public void setHasBold ( boolean v ) { } } | if ( DocumentBlock_Type . featOkTst && ( ( DocumentBlock_Type ) jcasType ) . casFeat_hasBold == null ) jcasType . jcas . throwFeatMissing ( "hasBold" , "ch.epfl.bbp.uima.types.DocumentBlock" ) ; jcasType . ll_cas . ll_setBooleanValue ( addr , ( ( DocumentBlock_Type ) jcasType ) . casFeatCode_hasBold , v ) ; |
public class ServerInventoryService { /** * { @ inheritDoc } */
@ Override public synchronized void start ( StartContext context ) throws StartException { } } | ROOT_LOGGER . debug ( "Starting Host Controller Server Inventory" ) ; try { final ProcessControllerConnectionService processControllerConnectionService = client . getValue ( ) ; URI managementURI = new URI ( protocol , null , NetworkUtils . formatAddress ( getNonWildCardManagementAddress ( ) ) , port , null , null , nu... |
public class DefaultGroovyMethods { /** * Convert an iterator to a Set . The iterator will become
* exhausted of elements after making this conversion .
* @ param self an iterator
* @ return a Set
* @ since 1.8.0 */
public static < T > Set < T > toSet ( Iterator < T > self ) { } } | Set < T > answer = new HashSet < T > ( ) ; while ( self . hasNext ( ) ) { answer . add ( self . next ( ) ) ; } return answer ; |
public class RefUpdate { /** * Returns the ref ( refspec ) representing this RefUpdate .
* @ return the ref */
public String getRef ( ) { } } | if ( refName != null ) { if ( ! refName . startsWith ( "refs/" ) ) { return REFS_HEADS + refName ; } return refName ; } return null ; |
public class RebalanceUtils { /** * Given the current cluster and final cluster , generates an interim cluster
* with empty new nodes ( and zones ) .
* @ param currentCluster Current cluster metadata
* @ param finalCluster Final cluster metadata
* @ return Returns a new interim cluster which contains nodes and ... | List < Node > newNodeList = new ArrayList < Node > ( currentCluster . getNodes ( ) ) ; for ( Node node : finalCluster . getNodes ( ) ) { if ( ! currentCluster . hasNodeWithId ( node . getId ( ) ) ) { newNodeList . add ( UpdateClusterUtils . updateNode ( node , new ArrayList < Integer > ( ) ) ) ; } } Collections . sort ... |
public class ProjectCalendar { /** * Sets the ProjectCalendar instance from which this calendar is derived .
* @ param calendar base calendar instance */
public void setParent ( ProjectCalendar calendar ) { } } | // I ' ve seen a malformed MSPDI file which sets the parent calendar to itself .
// Silently ignore this here .
if ( calendar != this ) { if ( getParent ( ) != null ) { getParent ( ) . removeDerivedCalendar ( this ) ; } super . setParent ( calendar ) ; if ( calendar != null ) { calendar . addDerivedCalendar ( this ) ; ... |
public class PolishWordTokenizer { /** * Tokenizes text .
* The Polish tokenizer differs from the standard one
* in the following respects :
* < ol >
* < li > it does not treat the hyphen as part of the
* word if the hyphen is at the end of the word ; < / li >
* < li > it includes n - dash and m - dash as t... | final List < String > l = new ArrayList < > ( ) ; final StringTokenizer st = new StringTokenizer ( text , plTokenizing , true ) ; while ( st . hasMoreElements ( ) ) { final String token = st . nextToken ( ) ; if ( token . length ( ) > 1 ) { if ( token . endsWith ( "-" ) ) { l . add ( token . substring ( 0 , token . len... |
public class ToolTips { /** * Adds a data with label with coordinates ( xOffset , yOffset ) . This point will be highlighted with
* a circle centering ( xOffset , yOffset ) */
public void addData ( double xOffset , double yOffset , String label ) { } } | DataPoint dp = new DataPoint ( xOffset , yOffset , label ) ; dataPointList . add ( dp ) ; |
public class Messenger { /** * Adding reaction to a message
* @ param peer destination peer
* @ param rid random id of message
* @ param code reaction code
* @ return Command for execution */
@ ObjectiveCName ( "addReactionWithPeer:withRid:withCode:" ) public Command < Void > addReaction ( Peer peer , long rid ... | return callback -> modules . getMessagesModule ( ) . addReaction ( peer , rid , code ) . then ( v -> callback . onResult ( v ) ) . failure ( e -> callback . onError ( e ) ) ; |
public class SipSessionImpl { /** * Does it need to be synchronized ? */
protected Map < String , Object > getAttributeMap ( ) { } } | if ( this . sipSessionAttributeMap == null ) { this . sipSessionAttributeMap = new ConcurrentHashMap < String , Object > ( ) ; } return this . sipSessionAttributeMap ; |
public class LocationHelper { /** * Register the listener with the Location Manager to receive location updates */
@ RequiresPermission ( anyOf = { } } | Manifest . permission . ACCESS_COARSE_LOCATION , Manifest . permission . ACCESS_FINE_LOCATION } ) public synchronized void startLocalization ( ) { if ( ! started && hasSignificantlyOlderLocation ( ) ) { started = true ; // get all enabled providers
List < String > enabledProviders = locationManager . getProviders ( tru... |
public class IntervalCollection { /** * / * [ deutsch ]
* < p > Ermittelt die gemeinsame Schnittmenge . < / p >
* @ param other another interval collection
* @ return new interval collection with disjunct blocks containing all time points in both interval collections
* @ since 3.8/4.5 */
public IntervalCollecti... | if ( this . isEmpty ( ) || other . isEmpty ( ) ) { List < ChronoInterval < T > > zero = Collections . emptyList ( ) ; return this . create ( zero ) ; } List < ChronoInterval < T > > list = new ArrayList < > ( ) ; for ( ChronoInterval < T > a : this . intervals ) { for ( ChronoInterval < T > b : other . intervals ) { Li... |
public class ImmutabilityTools { /** * This method takes a immutable boolean term and convert it into an old mutable boolean function . */
public Expression convertToMutableBooleanExpression ( ImmutableExpression booleanExpression ) { } } | OperationPredicate pred = booleanExpression . getFunctionSymbol ( ) ; return termFactory . getExpression ( pred , convertToMutableTerms ( booleanExpression . getTerms ( ) ) ) ; |
public class JdbcQueue { /** * Setter for { @ link # jdbcHelper } .
* @ param jdbcHelper
* @ param setMyOwnJdbcHelper
* @ return
* @ since 0.7.1 */
protected JdbcQueue < ID , DATA > setJdbcHelper ( IJdbcHelper jdbcHelper , boolean setMyOwnJdbcHelper ) { } } | if ( this . jdbcHelper != null && myOwnJdbcHelper && this . jdbcHelper instanceof AbstractJdbcHelper ) { ( ( AbstractJdbcHelper ) this . jdbcHelper ) . destroy ( ) ; } this . jdbcHelper = jdbcHelper ; myOwnJdbcHelper = setMyOwnJdbcHelper ; return this ; |
public class TypedQuery { /** * Execute the typed query and return an iterator of entities
* @ return Iterator & lt ; ENTITY & gt ; */
@ Override public Iterator < ENTITY > iterator ( ) { } } | StatementWrapper statementWrapper = new BoundStatementWrapper ( getOperationType ( boundStatement ) , meta , boundStatement , encodedBoundValues ) ; if ( LOGGER . isTraceEnabled ( ) ) { LOGGER . trace ( String . format ( "Generate iterator for typed query : %s" , statementWrapper . getBoundStatement ( ) . preparedState... |
public class KryoSerializer { /** * Utility method that takes lists of registered types and their serializers , and resolve
* them into a single list such that the result will resemble the final registration
* result in Kryo . */
private static LinkedHashMap < String , KryoRegistration > buildKryoRegistrations ( Cl... | final LinkedHashMap < String , KryoRegistration > kryoRegistrations = new LinkedHashMap < > ( ) ; kryoRegistrations . put ( serializedType . getName ( ) , new KryoRegistration ( serializedType ) ) ; for ( Class < ? > registeredType : checkNotNull ( registeredTypes ) ) { kryoRegistrations . put ( registeredType . getNam... |
public class UnixPath { /** * Returns { @ code true } if { @ code path } starts with { @ code other } .
* @ see java . nio . file . Path # startsWith ( java . nio . file . Path ) */
public boolean startsWith ( UnixPath other ) { } } | UnixPath me = removeTrailingSeparator ( ) ; other = other . removeTrailingSeparator ( ) ; if ( other . path . length ( ) > me . path . length ( ) ) { return false ; } else if ( me . isAbsolute ( ) != other . isAbsolute ( ) ) { return false ; } else if ( ! me . path . isEmpty ( ) && other . path . isEmpty ( ) ) { return... |
public class PercentileTimer { /** * Returns a PercentileTimer limited to the specified range . */
private PercentileTimer withRange ( long min , long max ) { } } | return ( this . min == min && this . max == max ) ? this : new PercentileTimer ( registry , id , min , max , counters ) ; |
public class Permission { /** * The permission that you want to give to the AWS user that is listed in Grantee . Valid values include :
* < ul >
* < li >
* < code > READ < / code > : The grantee can read the thumbnails and metadata for thumbnails that Elastic Transcoder adds
* to the Amazon S3 bucket .
* < / ... | if ( access == null ) { this . access = null ; return ; } this . access = new com . amazonaws . internal . SdkInternalList < String > ( access ) ; |
public class StoreFactory { /** * Creates a fixed - capacity { @ link krati . store . DataStore DataStore } with the default parameters below .
* < pre >
* batchSize : 10000
* numSyncBatches : 10
* segmentCompactFactor : 0.5
* < / pre >
* @ param homeDir - the store home directory
* @ param capacity - the... | int batchSize = StoreParams . BATCH_SIZE_DEFAULT ; int numSyncBatches = StoreParams . NUM_SYNC_BATCHES_DEFAULT ; double segmentCompactFactor = StoreParams . SEGMENT_COMPACT_FACTOR_DEFAULT ; return createStaticDataStore ( homeDir , capacity , batchSize , numSyncBatches , segmentFileSizeMB , segmentFactory , segmentCompa... |
public class XBProjector { /** * Ensures that the given object is a projection created by a projector .
* @ param projection
* @ return */
private DOMAccess checkProjectionInstance ( final Object projection ) { } } | if ( java . lang . reflect . Proxy . isProxyClass ( projection . getClass ( ) ) ) { InvocationHandler invocationHandler = java . lang . reflect . Proxy . getInvocationHandler ( projection ) ; if ( invocationHandler instanceof ProjectionInvocationHandler ) { if ( projection instanceof DOMAccess ) { return ( DOMAccess ) ... |
public class JspViewDeclarationLanguageBase { /** * { @ inheritDoc } */
@ Override public void renderView ( FacesContext context , UIViewRoot view ) throws IOException { } } | // Try not to use native objects in this class . Both MyFaces and the bridge
// provide implementations of buildView but they do not override this class .
checkNull ( context , "context" ) ; checkNull ( view , "view" ) ; // do not render the view if the rendered attribute for the view is false
if ( ! view . isRendered ... |
public class RDF4JHelper { /** * TODO : could we have a RDF sub - class of ValueConstant ? */
public static Literal getLiteral ( ValueConstant literal ) { } } | Objects . requireNonNull ( literal ) ; TermType type = literal . getType ( ) ; if ( ! ( type instanceof RDFDatatype ) ) // TODO : throw a proper exception
throw new IllegalStateException ( "A ValueConstant given to OWLAPI must have a RDF datatype" ) ; RDFDatatype datatype = ( RDFDatatype ) type ; return datatype . getL... |
public class CResponse { /** * Open a raw stream on the response body .
* @ return The stream */
public InputStream openStream ( ) { } } | if ( entity == null ) { return null ; } try { return entity . getContent ( ) ; } catch ( IOException ex ) { throw new CStorageException ( "Can't open stream" , ex ) ; } |
public class MetadataUtils { /** * Gets the embedded collection instance .
* @ param embeddedCollectionField
* the embedded collection field
* @ return the embedded collection instance */
public static Collection getEmbeddedCollectionInstance ( Field embeddedCollectionField ) { } } | Collection embeddedCollection = null ; Class embeddedCollectionFieldClass = embeddedCollectionField . getType ( ) ; if ( embeddedCollection == null || embeddedCollection . isEmpty ( ) ) { if ( embeddedCollectionFieldClass . equals ( List . class ) ) { embeddedCollection = new ArrayList < Object > ( ) ; } else if ( embe... |
public class JavacParser { /** * Return the lesser of two positions , making allowance for either one
* being unset . */
static int earlier ( int pos1 , int pos2 ) { } } | if ( pos1 == Position . NOPOS ) return pos2 ; if ( pos2 == Position . NOPOS ) return pos1 ; return ( pos1 < pos2 ? pos1 : pos2 ) ; |
public class Access { /** * Gets the .
* @ param _ accessType the access type
* @ param _ instances the instances
* @ return the access */
public static Access get ( final AccessType _accessType , final Collection < Instance > _instances ) { } } | return new Access ( _accessType , _instances ) ; |
public class AWSLicenseManagerClient { /** * Modifies the attributes of an existing license configuration object . A license configuration is an abstraction of
* a customer license agreement that can be consumed and enforced by License Manager . Components include
* specifications for the license type ( Instances ,... | request = beforeClientExecution ( request ) ; return executeUpdateLicenseConfiguration ( request ) ; |
public class ProductPartition { /** * Sets the caseValue value for this ProductPartition .
* @ param caseValue * Dimension value with which this product partition is refining
* its parent . Undefined for the
* root partition . */
public void setCaseValue ( com . google . api . ads . adwords . axis . v201809 . cm ... | this . caseValue = caseValue ; |
public class OgnlOps { /** * Returns the constant from the NumericTypes interface that best expresses the type
* of an operation , which can be either numeric or not , on the two given types .
* @ param localt1 type of one argument to an operator
* @ param localt2 type of the other argument
* @ param canBeNonNu... | int localt1 = t1 ; int localt2 = t2 ; if ( localt1 == localt2 ) return localt1 ; if ( canBeNonNumeric && ( localt1 == NONNUMERIC || localt2 == NONNUMERIC || localt1 == CHAR || localt2 == CHAR ) ) return NONNUMERIC ; // Try to interpret strings as doubles . . .
if ( localt1 == NONNUMERIC ) { localt1 = DOUBLE ; } // Try ... |
public class JDBCBackendDataSource { /** * Get connections .
* @ param connectionMode connection mode
* @ param dataSourceName data source name
* @ param connectionSize size of connections to get
* @ return connections
* @ throws SQLException SQL exception */
public List < Connection > getConnections ( final ... | return getConnections ( connectionMode , dataSourceName , connectionSize , TransactionType . LOCAL ) ; |
public class StringUtils { /** * https : / / developer . apple . com / reference / foundation / nsstring / 1411141 - stringbydeletinglastpathcomponen */
public static String stringByDeletingLastPathComponent ( final String str ) { } } | String path = str ; int start = str . length ( ) - 1 ; while ( path . charAt ( start ) == '/' ) { start -- ; } final int index = path . lastIndexOf ( '/' , start ) ; path = ( index < 0 ) ? "" : path . substring ( 0 , index ) ; if ( path . length ( ) == 0 && str . charAt ( 0 ) == '/' ) { return "/" ; } return path ; |
public class ListStepsResult { /** * The filtered list of steps for the cluster .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setSteps ( java . util . Collection ) } or { @ link # withSteps ( java . util . Collection ) } if you want to override the
* ex... | if ( this . steps == null ) { setSteps ( new com . amazonaws . internal . SdkInternalList < StepSummary > ( steps . length ) ) ; } for ( StepSummary ele : steps ) { this . steps . add ( ele ) ; } return this ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.