signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ValueElement { /** * < 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 > convert the argument to a float , return a < b > JcNumber < / b > , if the conversion fails return NULL < / i > < / div >
* < br / > */
public JcNumber toFloat ( ) { } } | JcNumber ret = new JcNumber ( null , this , new FunctionInstance ( FUNCTION . Common . TOFLOAT , 1 ) ) ; QueryRecorder . recordInvocationConditional ( this , "toFloat" , ret ) ; return ret ; |
public class CmsPublishGroupPanel { /** * Returns true if the corresponding group has only resources with problems . < p >
* @ return true if the group for this panel has only resources with problems . */
protected boolean hasOnlyProblemResources ( ) { } } | return m_model . getGroups ( ) . get ( m_groupIndex ) . getResources ( ) . size ( ) == m_model . countResourcesInGroup ( new CmsPublishDataModel . HasProblems ( ) , m_model . getGroups ( ) . get ( m_groupIndex ) . getResources ( ) ) ; |
public class ModelsImpl { /** * Adds a regex entity model to the application version .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param regexEntityExtractorCreateObj A model object containing the name and regex pattern for the new regex entity extractor .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the UUID object if successful . */
public UUID createRegexEntityModel ( UUID appId , String versionId , RegexModelCreateObject regexEntityExtractorCreateObj ) { } } | return createRegexEntityModelWithServiceResponseAsync ( appId , versionId , regexEntityExtractorCreateObj ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class NumberUtils { /** * < p > Returns the minimum value in an array . < / p >
* @ param array an array , must not be null or empty
* @ return the minimum value in the array
* @ throws IllegalArgumentException if < code > array < / code > is < code > null < / code >
* @ throws IllegalArgumentException if < code > array < / code > is empty
* @ see IEEE754rUtils # min ( double [ ] ) IEEE754rUtils for a version of this method that handles NaN differently
* @ since 3.4 Changed signature from min ( double [ ] ) to min ( double . . . ) */
public static double min ( final double ... array ) { } } | // Validates input
validateArray ( array ) ; // Finds and returns min
double min = array [ 0 ] ; for ( int i = 1 ; i < array . length ; i ++ ) { if ( Double . isNaN ( array [ i ] ) ) { return Double . NaN ; } if ( array [ i ] < min ) { min = array [ i ] ; } } return min ; |
public class CmsAliasView { /** * Replaces the contents of the live data row list with another list of rows . < p >
* @ param data the new list of rows to be placed into the live data list
* @ param rewriteData the list of rewrite alias data */
public void setData ( List < CmsAliasTableRow > data , List < CmsRewriteAliasTableRow > rewriteData ) { } } | m_table . getLiveDataList ( ) . clear ( ) ; m_table . getLiveDataList ( ) . addAll ( data ) ; m_rewriteTable . getLiveDataList ( ) . clear ( ) ; m_rewriteTable . getLiveDataList ( ) . addAll ( rewriteData ) ; |
public class ExpressRouteCircuitsInner { /** * Gets information about the specified express route circuit .
* @ param resourceGroupName The name of the resource group .
* @ param circuitName The name of express route circuit .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ExpressRouteCircuitInner object */
public Observable < ExpressRouteCircuitInner > getByResourceGroupAsync ( String resourceGroupName , String circuitName ) { } } | return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , circuitName ) . map ( new Func1 < ServiceResponse < ExpressRouteCircuitInner > , ExpressRouteCircuitInner > ( ) { @ Override public ExpressRouteCircuitInner call ( ServiceResponse < ExpressRouteCircuitInner > response ) { return response . body ( ) ; } } ) ; |
public class DefaultEventsStream { /** * Compute future blocking states not on disk for add - ons associated to this ( base ) events stream */
@ Override public Collection < BlockingState > computeAddonsBlockingStatesForFutureSubscriptionBaseEvents ( ) { } } | if ( ! ProductCategory . BASE . equals ( subscription . getCategory ( ) ) ) { // Only base subscriptions have add - ons
return ImmutableList . of ( ) ; } // We need to find the first " trigger " transition , from which we will create the add - ons cancellation events .
// This can either be a future entitlement cancel . . .
if ( isEntitlementFutureCancelled ( ) ) { // Note that in theory we could always only look subscription base as we assume entitlement cancel means subscription base cancel
// but we want to use the effective date of the entitlement cancel event to create the add - on cancel event
final BlockingState futureEntitlementCancelEvent = getEntitlementCancellationEvent ( subscription . getId ( ) ) ; return computeAddonsBlockingStatesForNextSubscriptionBaseEvent ( futureEntitlementCancelEvent . getEffectiveDate ( ) , false ) ; } else if ( isEntitlementFutureChanged ( ) ) { // . . . or a subscription change ( i . e . a change plan where the new plan has an impact on the existing add - on ) .
// We need to go back to subscription base as entitlement doesn ' t know about these
return computeAddonsBlockingStatesForNextSubscriptionBaseEvent ( utcNow , true ) ; } else { return ImmutableList . of ( ) ; } |
public class PhotosInterface { /** * Search for photos which match the given search parameters .
* @ param params
* The search parameters
* @ param perPage
* The number of photos to show per page
* @ param page
* The page offset
* @ return A PhotoList
* @ throws FlickrException */
public PhotoList < Photo > search ( SearchParameters params , int perPage , int page ) throws FlickrException { } } | PhotoList < Photo > photos = new PhotoList < Photo > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_SEARCH ) ; parameters . putAll ( params . getAsParameters ( ) ) ; if ( perPage > 0 ) { parameters . put ( "per_page" , "" + perPage ) ; } if ( page > 0 ) { parameters . put ( "page" , "" + page ) ; } Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; photos . setPage ( photosElement . getAttribute ( "page" ) ) ; photos . setPages ( photosElement . getAttribute ( "pages" ) ) ; photos . setPerPage ( photosElement . getAttribute ( "perpage" ) ) ; photos . setTotal ( photosElement . getAttribute ( "total" ) ) ; NodeList photoNodes = photosElement . getElementsByTagName ( "photo" ) ; for ( int i = 0 ; i < photoNodes . getLength ( ) ; i ++ ) { Element photoElement = ( Element ) photoNodes . item ( i ) ; photos . add ( PhotoUtils . createPhoto ( photoElement ) ) ; } return photos ; |
public class CanonicalStore { /** * Remove any mapping for the provided id
* @ param id */
public boolean remove ( V value ) { } } | // peek at what is in the map
K key = value . getKey ( ) ; Ref < V > ref = map . get ( key ) ; // only try to remove the mapping if it matches the provided class loader
return ( ref != null && ref . get ( ) == value ) ? map . remove ( key , ref ) : false ; |
public class BlogsInterface { /** * Get the collection of configured blogs for the calling user .
* @ return The Collection of configured blogs */
public Collection < Blog > getList ( ) throws FlickrException { } } | List < Blog > blogs = new ArrayList < Blog > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_LIST ) ; Response response = transportAPI . post ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element blogsElement = response . getPayload ( ) ; NodeList blogNodes = blogsElement . getElementsByTagName ( "blog" ) ; for ( int i = 0 ; i < blogNodes . getLength ( ) ; i ++ ) { Element blogElement = ( Element ) blogNodes . item ( i ) ; Blog blog = new Blog ( ) ; blog . setId ( blogElement . getAttribute ( "id" ) ) ; blog . setName ( blogElement . getAttribute ( "name" ) ) ; blog . setNeedPassword ( "1" . equals ( blogElement . getAttribute ( "needspassword" ) ) ) ; blog . setUrl ( blogElement . getAttribute ( "url" ) ) ; blogs . add ( blog ) ; } return blogs ; |
public class DateTimeUtils { /** * Extracts a time unit from a time value ( milliseconds since midnight ) . */
public static int unixTimeExtract ( TimeUnitRange range , int time ) { } } | assert time >= 0 ; assert time < MILLIS_PER_DAY ; switch ( range ) { case HOUR : return time / ( int ) MILLIS_PER_HOUR ; case MINUTE : final int minutes = time / ( int ) MILLIS_PER_MINUTE ; return minutes % 60 ; case SECOND : final int seconds = time / ( int ) MILLIS_PER_SECOND ; return seconds % 60 ; default : throw new ValidationException ( "unit " + range + " can not be applied to time variable" ) ; } |
public class SelectorReplayDispatcher { /** * Value of { @ code mimetype } field indicating { @ code Content - Type }
* is unavailable in the response .
* Default is { @ code unk } ( compatible with CDX - Writer ) .
* { @ link IndexWorker } puts { @ code application / http } , apparently .
* @ param missingMimeType */
public void setMissingMimeType ( String missingMimeType ) { } } | if ( missingMimeType == null || missingMimeType . isEmpty ( ) ) this . missingMimeType = DEFAULT_MISSING_MIMETYPE ; else this . missingMimeType = missingMimeType ; |
public class MscRuntimeContainerDelegate { /** * Lifecycle / / / / / */
public void start ( StartContext context ) throws StartException { } } | serviceContainer = context . getController ( ) . getServiceContainer ( ) ; childTarget = context . getChildTarget ( ) ; startTrackingServices ( ) ; createJndiBindings ( ) ; // set this implementation as Runtime Container
RuntimeContainerDelegate . INSTANCE . set ( this ) ; |
public class ParserContextImpl { /** * Writes characters into current writer . */
void characters ( CharSequence csq , int start , int end ) throws IOException { } } | getCurrent ( ) . characters ( csq , start , end ) ; |
public class CommerceNotificationTemplateUserSegmentRelUtil { /** * Returns the last commerce notification template user segment rel in the ordered set where commerceUserSegmentEntryId = & # 63 ; .
* @ param commerceUserSegmentEntryId the commerce user segment entry ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce notification template user segment rel , or < code > null < / code > if a matching commerce notification template user segment rel could not be found */
public static CommerceNotificationTemplateUserSegmentRel fetchByCommerceUserSegmentEntryId_Last ( long commerceUserSegmentEntryId , OrderByComparator < CommerceNotificationTemplateUserSegmentRel > orderByComparator ) { } } | return getPersistence ( ) . fetchByCommerceUserSegmentEntryId_Last ( commerceUserSegmentEntryId , orderByComparator ) ; |
public class ChangesItem { /** * Leave in { @ link ChangesItem } only changes being apply asynchronously
* and return ones to apply instantly . */
public ChangesItem extractSyncChanges ( ) { } } | ChangesItem syncChangesItem = new ChangesItem ( ) ; Iterator < String > iter = calculatedChangedNodesSize . keySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) && ! asyncUpdate . isEmpty ( ) ) { String nodePath = iter . next ( ) ; if ( ! asyncUpdate . contains ( nodePath ) ) { Long chanagedSize = calculatedChangedNodesSize . get ( nodePath ) ; syncChangesItem . calculatedChangedNodesSize . put ( nodePath , chanagedSize ) ; syncChangesItem . workspaceChangedSize += chanagedSize ; this . asyncUpdate . remove ( nodePath ) ; this . workspaceChangedSize -= chanagedSize ; iter . remove ( ) ; } } return syncChangesItem ; |
public class BaseStreamWriter { /** * Package methods , output validation problem reporting */
protected void reportInvalidContent ( int evtType ) throws XMLStreamException { } } | switch ( mVldContent ) { case XMLValidator . CONTENT_ALLOW_NONE : reportValidationProblem ( ErrorConsts . ERR_VLD_EMPTY , getTopElementDesc ( ) , ErrorConsts . tokenTypeDesc ( evtType ) ) ; break ; case XMLValidator . CONTENT_ALLOW_WS : reportValidationProblem ( ErrorConsts . ERR_VLD_NON_MIXED , getTopElementDesc ( ) ) ; break ; case XMLValidator . CONTENT_ALLOW_VALIDATABLE_TEXT : case XMLValidator . CONTENT_ALLOW_ANY_TEXT : /* Not 100 % sure if this should ever happen . . . depends on
* interpretation of ' any ' content model ? */
reportValidationProblem ( ErrorConsts . ERR_VLD_ANY , getTopElementDesc ( ) , ErrorConsts . tokenTypeDesc ( evtType ) ) ; break ; default : // should never occur :
reportValidationProblem ( "Internal error: trying to report invalid content for " + evtType ) ; } |
public class GenericMaster { /** * Finds the generic type ( parametrized type ) of the field . If the field is not generic it returns Object . class .
* @ param field the field to inspect */
public Class < ? > getGenericType ( Field field ) { } } | Type generic = field . getGenericType ( ) ; if ( generic instanceof ParameterizedType ) { Type actual = ( ( ParameterizedType ) generic ) . getActualTypeArguments ( ) [ 0 ] ; if ( actual instanceof Class ) { return ( Class < ? > ) actual ; } else if ( actual instanceof ParameterizedType ) { // in case of nested generics we don ' t go deep
return ( Class < ? > ) ( ( ParameterizedType ) actual ) . getRawType ( ) ; } } return Object . class ; |
public class UfsJournalReader { /** * Updates the journal input stream by closing the current journal input stream if it is done and
* opening a new one . */
private void updateInputStream ( ) throws IOException { } } | if ( mInputStream != null && ( mInputStream . mFile . isIncompleteLog ( ) || ! mInputStream . isDone ( ) ) ) { return ; } if ( mInputStream != null ) { mInputStream . close ( ) ; mInputStream = null ; } if ( mFilesToProcess . isEmpty ( ) ) { UfsJournalSnapshot snapshot = UfsJournalSnapshot . getSnapshot ( mJournal ) ; if ( snapshot . getCheckpoints ( ) . isEmpty ( ) && snapshot . getLogs ( ) . isEmpty ( ) ) { return ; } int index = 0 ; if ( ! snapshot . getCheckpoints ( ) . isEmpty ( ) ) { UfsJournalFile checkpoint = snapshot . getLatestCheckpoint ( ) ; if ( mNextSequenceNumber < checkpoint . getEnd ( ) ) { String location = checkpoint . getLocation ( ) . toString ( ) ; LOG . info ( "Reading checkpoint {}" , location ) ; mCheckpointStream = new CheckpointInputStream ( mUfs . open ( location , OpenOptions . defaults ( ) . setRecoverFailedOpen ( true ) ) ) ; mNextSequenceNumber = checkpoint . getEnd ( ) ; } for ( ; index < snapshot . getLogs ( ) . size ( ) ; index ++ ) { UfsJournalFile file = snapshot . getLogs ( ) . get ( index ) ; if ( file . getEnd ( ) > checkpoint . getEnd ( ) ) { break ; } } // index now points to the first log with mEnd > checkpoint . mEnd .
} for ( ; index < snapshot . getLogs ( ) . size ( ) ; index ++ ) { UfsJournalFile file = snapshot . getLogs ( ) . get ( index ) ; if ( ( ! mReadIncompleteLog && file . isIncompleteLog ( ) ) || mNextSequenceNumber >= file . getEnd ( ) ) { continue ; } mFilesToProcess . add ( snapshot . getLogs ( ) . get ( index ) ) ; } } if ( ! mFilesToProcess . isEmpty ( ) ) { mInputStream = new JournalInputStream ( mFilesToProcess . poll ( ) ) ; } |
public class EmptyMemoryRecord { /** * Add this field in the Record ' s field sequence . */
public BaseField setupField ( int iFieldSeq ) { } } | BaseField field = null ; if ( iFieldSeq == 0 ) field = new CounterField ( this , ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( field == null ) field = super . setupField ( iFieldSeq ) ; return field ; |
public class MediatorLiveData { /** * / * ( non - Javadoc )
* @ see android . arch . lifecycle . LiveData # onActive ( ) */
@ CallSuper @ Override protected void onActive ( ) { } } | for ( Map . Entry < LiveData < ? > , Source < ? > > source : mSources ) { source . getValue ( ) . plug ( ) ; } |
public class ObjectTreeParser { /** * Find a method in a class by it ' s name . Note that this method is
* only needed because the general reflection method is case
* sensitive
* @ param clazz The clazz to search
* @ param name The name of the method to search for
* @ return The method or null if none could be located */
private Method findMethod ( Class clazz , String name ) { } } | Method [ ] methods = clazz . getDeclaredMethods ( ) ; for ( int i = 0 ; i < methods . length ; i ++ ) { if ( methods [ i ] . getName ( ) . equalsIgnoreCase ( name ) ) { Method method = methods [ i ] ; Class [ ] params = method . getParameterTypes ( ) ; if ( params . length == 1 ) { return method ; } } } return null ; |
public class Log { /** * Returns true if lost space is above the threshold */
boolean forceDefrag ( ) { } } | long megas = properties . getIntegerProperty ( HsqlDatabaseProperties . hsqldb_defrag_limit , 200 ) ; long defraglimit = megas * 1024L * 1024 ; long lostSize = cache . freeBlocks . getLostBlocksSize ( ) ; return lostSize > defraglimit ; |
public class BasicAtomGenerator { /** * { @ inheritDoc } */
@ Override public List < IGeneratorParameter < ? > > getParameters ( ) { } } | return Arrays . asList ( new IGeneratorParameter < ? > [ ] { atomColor , atomColorer , atomRadius , colorByType , compactShape , isCompact , isKekule , showEndCarbons , showExplicitHydrogens } ) ; |
public class KeyDecoder { /** * Decodes a signed short from exactly 2 bytes , as encoded for descending
* order .
* @ param src source of encoded bytes
* @ param srcOffset offset into source array
* @ return signed short value */
public static short decodeShortDesc ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { } } | try { return ( short ) ( ( ( src [ srcOffset ] << 8 ) | ( src [ srcOffset + 1 ] & 0xff ) ) ^ 0x7fff ) ; } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingException ( null , e ) ; } |
public class IOUtils { /** * Checks to see if the wanted byte pattern is found in the
* within bytes from the given offset
* @ param wanted Byte sequence to look for
* @ param within Bytes to find in
* @ param withinOffset Offset to check from */
public static boolean byteRangeMatches ( byte [ ] wanted , byte [ ] within , int withinOffset ) { } } | for ( int i = 0 ; i < wanted . length ; i ++ ) { if ( wanted [ i ] != within [ i + withinOffset ] ) return false ; } return true ; |
public class CPIRGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . CPIRG__GCGID : setGCGID ( GCGID_EDEFAULT ) ; return ; case AfplibPackage . CPIRG__PRT_FLAGS : setPrtFlags ( PRT_FLAGS_EDEFAULT ) ; return ; case AfplibPackage . CPIRG__CODE_POINT : setCodePoint ( CODE_POINT_EDEFAULT ) ; return ; case AfplibPackage . CPIRG__COUNT : setCount ( COUNT_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class DateTimeUtils { /** * Date of local date .
* @ param time the time
* @ return the date */
public static Date dateOf ( final LocalDate time ) { } } | return Date . from ( time . atStartOfDay ( ZoneOffset . UTC ) . toInstant ( ) ) ; |
public class RendererFactory { /** * Returns the JS Bundle renderer
* @ param bundler
* the ResourceBundlesHandler
* @ param type
* the script type attribute
* @ param useRandomParam
* the flag indicating if it should use the random param
* @ param async
* the flag indicating the value of the async attribute
* @ param defer
* the flag indicating the value of the deferred attribute
* @ param crossorigin
* the value of the crossorigin attribute
* @ return the JS Bundle renderer */
public final static JsBundleLinkRenderer getJsBundleRenderer ( ResourceBundlesHandler bundler , String type , Boolean useRandomParam , Boolean async , Boolean defer , String crossorigin ) { } } | JsBundleLinkRenderer renderer = ( JsBundleLinkRenderer ) ClassLoaderResourceUtils . buildObjectInstance ( bundler . getConfig ( ) . getJsBundleLinkRenderClass ( ) ) ; renderer . init ( bundler , type , useRandomParam , async , defer , crossorigin ) ; return renderer ; |
public class FnString { /** * Converts a String into a BigDecimal , using the specified locale for decimal
* point and thousands separator configuration and establishing the specified scale . Rounding
* mode is used for setting the scale to the specified value .
* @ param scale the desired scale for the resulting BigDecimal object
* @ param roundingMode the rounding mode to be used when setting the scale
* @ param locale the locale defining the way in which the number was written
* @ return the resulting BigDecimal object */
public static final Function < String , BigDecimal > toBigDecimal ( final int scale , final RoundingMode roundingMode , final Locale locale ) { } } | return new ToBigDecimal ( scale , roundingMode , locale ) ; |
public class TrivialSwap { /** * Swap two elements of a double array at the specified positions
* @ param doubleArray 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 ( double [ ] doubleArray , int index1 , int index2 ) { } } | TrivialSwap . swap ( doubleArray , index1 , doubleArray , index2 ) ; |
public class SetCache { /** * Adds the given { @ link DataSet } to this cache for the given ID .
* @ param id Set ID
* @ param set DataSet to add
* @ param < D > DataSet class */
public < D extends DataSet < ? > > void add ( int id , D set ) { } } | cacheSetType ( id , SetType . DATA_SET ) ; dataSets . put ( id , set ) ; |
public class Gram { /** * Unwraps and discards frame of a token according to the GRAM " renew "
* protocol for use in a GSI delegation handshake . The input token is
* received from a globus job manager and comes wrapped ( SSL mode ) and
* framed with a 4 byte big - endian token length header .
* @ param c The context to use to unwrap the token
* @ param wrappedToken Token received from job manager during GSI handshake
* @ throws GSSException if an error occurs during token wrapping or if
* context is insufficient
* @ return a token that can be passed to the context ' s next initDelegation */
private static byte [ ] consumeRenewToken ( ExtendedGSSContext c , byte [ ] wrappedToken ) throws GSSException { } } | if ( ! GSIConstants . MODE_SSL . equals ( c . getOption ( GSSConstants . GSS_MODE ) ) ) { throw new GSSException ( GSSException . NO_CONTEXT ) ; } byte [ ] framedToken = c . unwrap ( wrappedToken , 0 , wrappedToken . length , null ) ; byte [ ] token = new byte [ framedToken . length - 4 ] ; System . arraycopy ( framedToken , 4 , token , 0 , framedToken . length - 4 ) ; return token ; |
public class GCCHSTImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setCP ( String newCP ) { } } | String oldCP = cp ; cp = newCP ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . GCCHST__CP , oldCP , cp ) ) ; |
public class Transform2D { /** * Invert this transformation .
* The inverse transform Tx ' of this transform Tx
* maps coordinates transformed by Tx back
* to their original coordinates .
* In other words , Tx ' ( Tx ( p ) ) = p = Tx ( Tx ' ( p ) ) .
* < p > If this transform maps all coordinates onto a point or a line
* then it will not have an inverse , since coordinates that do
* not lie on the destination point or line will not have an inverse
* mapping .
* The < code > determinant < / code > method can be used to determine if this
* transform has no inverse , in which case an exception will be
* thrown if the < code > createInverse < / code > method is called .
* @ see # determinant ( )
* @ throws SingularMatrixException if the matrix cannot be inverted . */
@ Override public void invert ( ) { } } | final double det = this . m00 * this . m11 - this . m01 * this . m10 ; if ( MathUtil . isEpsilonZero ( det ) ) { throw new SingularMatrixException ( Locale . getString ( "E1" , det ) ) ; // $ NON - NLS - 1 $
} set ( this . m11 / det , - this . m01 / det , ( this . m01 * this . m12 - this . m11 * this . m02 ) / det , - this . m10 / det , this . m00 / det , ( this . m10 * this . m02 - this . m00 * this . m12 ) / det ) ; |
public class ValueUtils { /** * Compares the two given values by taking null and NaN values into account .
* Two null values will be considered equal . Two NaN values ( either Double or Float ) will be considered equal .
* @ param value1 First value .
* @ param value2 Second value .
* @ return True if both values are equal or if both are null . */
public static boolean areEqual ( Object value1 , Object value2 ) { } } | return ( ( value1 == null ) && ( value2 == null ) ) || ( isNaN ( value1 ) && isNaN ( value2 ) ) || ( ( value1 != null ) && value1 . equals ( value2 ) ) ; |
public class LogRepositoryManagerImpl { /** * get the directory of the controlling process ( this process ) . Used for this process and for prefixing the paths of
* child process files ( this process does the naming for those files ) .
* @ param timestamp
* @ param pid */
private void getControllingProcessDirectory ( long timestamp , String pid ) { } } | int count = 0 ; while ( ivSubDirectory == null ) { ivSubDirectory = makeLogDirectory ( timestamp , pid ) ; if ( ivSubDirectory == null ) { if ( ++ count > FAILED_MAX_COUNT ) { ivSubDirectory = makeLogDirectory ( timestamp , pid , true ) ; if ( ivSubDirectory == null ) { if ( debugLogger . isLoggable ( Level . FINE ) && isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "UnableToMakeDirectory" , "Unable to create instance directory forcefully , throwing Runtime Exception" ) ; } throw new RuntimeException ( "Failed to create instance log repository. See SystemOut.log for details." ) ; } } try { Thread . sleep ( FAILED_WAIT_TIME ) ; } catch ( InterruptedException ex ) { // Ignore it , assume that we had enough sleep .
} } } |
public class KxPublisherActor { /** * private / as validation needs to be done synchronously , its on callerside . This is the async part of impl */
public IPromise < KSubscription > _subscribe ( Callback subscriber ) { } } | if ( subscribers == null ) subscribers = new HashMap < > ( ) ; int id = subsIdCount ++ ; KSubscription subs = new KSubscription ( self ( ) , id ) ; subscribers . put ( id , new SubscriberEntry ( id , subs , subscriber ) ) ; return new Promise < > ( subs ) ; |
public class MM2BasedParameterSetReader { /** * Sets the dipole attribute stored into the parameter set
* @ exception Exception Description of the Exception */
private void setDipole ( ) throws Exception { } } | List data = new Vector ( ) ; st . nextToken ( ) ; String sid1 = st . nextToken ( ) ; String sid2 = st . nextToken ( ) ; String value1 = st . nextToken ( ) ; String value2 = st . nextToken ( ) ; try { double va1 = new Double ( value1 ) . doubleValue ( ) ; double va2 = new Double ( value2 ) . doubleValue ( ) ; data . add ( new Double ( va1 ) ) ; data . add ( new Double ( va2 ) ) ; } catch ( NumberFormatException nfe ) { throw new IOException ( "setDipole: " + "Malformed Number" ) ; } key = "dipole" + sid1 + ";" + sid2 ; parameterSet . put ( key , data ) ; |
public class MyOwnInterpreter { /** * { @ inheritDoc } */
public void interpret ( Specification specification ) { } } | Statistics stats = new Statistics ( ) ; Example table = specification . nextExample ( ) ; for ( Example row = table . at ( 0 , 1 ) ; row != null ; row = row . nextSibling ( ) ) { doRow ( row ) ; } specification . exampleDone ( stats ) ; |
public class WasHttpAppSessionGlobalAttributeObserver { /** * Method sessionAttributeSet
* @ see com . ibm . wsspi . session . ISessionStateObserver # sessionAttributeSet ( com . ibm . wsspi . session . ISession , java . lang . Object , java . lang . Object , java . lang . Object ) */
public void sessionAttributeSet ( ISession session , Object name , Object oldValue , Boolean oldIsListener , Object newValue , Boolean newIsListener ) { } } | HttpSession httpsession = ( HttpSession ) _adapter . adapt ( session ) ; HttpSessionBindingEvent addEvent = null ; // only init if necessary
HttpSessionBindingEvent replaceEvent = null ; // only init this if
// necessary . . done below
// do binding listeners first to be consistent with v6.1
if ( ( oldValue != null ) && ( oldIsListener . booleanValue ( ) ) ) { replaceEvent = new HttpSessionBindingEvent ( httpsession , ( String ) name , oldValue ) ; // if ( oldValue instanceof HttpSessionBindingListener )
( ( HttpSessionBindingListener ) oldValue ) . valueUnbound ( replaceEvent ) ; } if ( ( newValue != null ) && ( newIsListener . booleanValue ( ) ) ) { // ( newValue instanceof HttpSessionBindingListener ) ) {
addEvent = new HttpSessionBindingEvent ( httpsession , ( String ) name , newValue ) ; ( ( HttpSessionBindingListener ) newValue ) . valueBound ( addEvent ) ; } |
public class VectorAlgebra { /** * Performs x + cy */
static double [ ] addVector ( double [ ] x , double [ ] y , double c , double [ ] reuse ) { } } | if ( reuse == null ) { reuse = new double [ x . length ] ; } for ( int i = 0 ; i < x . length ; i ++ ) { reuse [ i ] = x [ i ] + c * y [ i ] ; } return reuse ; |
public class PolizasPeriodov11 { /** * FUNCIONES AUXILIARES */
private static JAXBContext getContext ( String [ ] contexts ) throws Exception { } } | List < String > ctx = Lists . asList ( BASE_CONTEXT , contexts ) ; return JAXBContext . newInstance ( JOINER . join ( ctx ) ) ; |
public class ContentSpec { /** * Set the JIRA Labels to be applied during building .
* @ param jiraLabels The keywords to be set in jira . */
public void setJIRALabels ( final String jiraLabels ) { } } | if ( jiraLabels == null && this . jiraLabels == null ) { return ; } else if ( jiraLabels == null ) { removeChild ( this . jiraLabels ) ; this . jiraLabels = null ; } else if ( this . jiraLabels == null ) { this . jiraLabels = new KeyValueNode < String > ( CommonConstants . CS_JIRA_LABELS_TITLE , jiraLabels ) ; appendChild ( this . jiraLabels , false ) ; } else { this . jiraLabels . setValue ( jiraLabels ) ; } |
public class AbstractDateFunction { /** * Parse offset string and add or subtract date offset value .
* @ param offsetString
* @ param c
* @ return */
protected int getDateValueOffset ( String offsetString , char c ) { } } | ArrayList < Character > charList = new ArrayList < Character > ( ) ; int index = offsetString . indexOf ( c ) ; if ( index != - 1 ) { for ( int i = index - 1 ; i >= 0 ; i -- ) { if ( Character . isDigit ( offsetString . charAt ( i ) ) ) { charList . add ( 0 , offsetString . charAt ( i ) ) ; } else { StringBuffer offsetValue = new StringBuffer ( ) ; offsetValue . append ( "0" ) ; for ( int j = 0 ; j < charList . size ( ) ; j ++ ) { offsetValue . append ( charList . get ( j ) ) ; } if ( offsetString . charAt ( i ) == '-' ) { return Integer . valueOf ( "-" + offsetValue . toString ( ) ) ; } else { return Integer . valueOf ( offsetValue . toString ( ) ) ; } } } } return 0 ; |
public class RdfCollector { /** * Handles all attributes ( location , role , type , etc ) . Returns a list of
* Attribute objects . */
public List < Attribute > collectAttributes ( QualifiedName context , QualifiedName qualifiedName , Types . ProvType type ) { } } | List < Attribute > attributes = new ArrayList < Attribute > ( ) ; List < Statement > statements = collators . get ( context ) . get ( qualifiedName ) ; for ( Statement statement : statements ) { QualifiedName predQ = convertURIToQualifiedName ( statement . getPredicate ( ) ) ; Value value = statement . getObject ( ) ; if ( statement . getPredicate ( ) . equals ( RDF . TYPE ) ) { Object obj = valueToObject ( statement . getObject ( ) ) ; if ( obj != null ) { Value vobj = statement . getObject ( ) ; Boolean sameAsType = false ; if ( vobj instanceof URI ) { // TODO : Nasty .
URI uri = ( URI ) ( vobj ) ; String uriVal = uri . getNamespace ( ) + uri . getLocalName ( ) ; sameAsType = uriVal . equals ( types . find ( type ) ) ; } if ( ! sameAsType ) { if ( statement . getObject ( ) instanceof Resource ) { QualifiedName typeQ = convertResourceToQualifiedName ( ( Resource ) statement . getObject ( ) ) ; if ( isProvURI ( typeQ ) && DM_TYPES . indexOf ( typeQ ) == - 1 ) { // System . out . println ( " Skipping type : " + typeQ ) ;
} else { attributes . add ( pFactory . newAttribute ( name . PROV_TYPE , typeQ , name . PROV_QUALIFIED_NAME ) ) ; } } else if ( statement . getObject ( ) instanceof Literal ) { Literal lit = ( Literal ) statement . getObject ( ) ; Attribute attr = newAttribute ( lit , name . PROV_TYPE ) ; attributes . add ( attr ) ; } } } else { System . out . println ( value ) ; System . out . println ( "Value wasn't a suitable type" ) ; } } if ( predQ . equals ( onto . QualifiedName_PROVO_hadRole ) ) { Value obj = statement . getObject ( ) ; Attribute attr = newAttributeForValue ( obj , name . PROV_ROLE ) ; attributes . add ( attr ) ; } if ( predQ . equals ( onto . QualifiedName_PROVO_atLocation ) ) { Value obj = statement . getObject ( ) ; Attribute attr = newAttributeForValue ( obj , name . PROV_LOCATION ) ; attributes . add ( attr ) ; } if ( predQ . equals ( onto . QualifiedName_RDFS_LABEL ) ) { Literal lit = ( Literal ) ( statement . getObject ( ) ) ; Attribute attr = newAttribute ( lit , name . PROV_LABEL ) ; attributes . add ( attr ) ; } if ( predQ . equals ( onto . QualifiedName_PROVO_value ) ) { Attribute attr = newAttributeForValue ( value , name . PROV_VALUE ) ; attributes . add ( attr ) ; } if ( ! isProvURI ( predQ ) ) { if ( ! predQ . equals ( onto . QualifiedName_RDF_TYPE ) && ! predQ . equals ( onto . QualifiedName_RDFS_LABEL ) ) { Attribute attr = newAttributeForValue ( value , predQ ) ; attributes . add ( attr ) ; } } } return attributes ; |
public class EntityListenersImpl { /** * Returns all < code > entity - listener < / code > elements
* @ return list of < code > entity - listener < / code > */
public List < EntityListener < EntityListeners < T > > > getAllEntityListener ( ) { } } | List < EntityListener < EntityListeners < T > > > list = new ArrayList < EntityListener < EntityListeners < T > > > ( ) ; List < Node > nodeList = childNode . get ( "entity-listener" ) ; for ( Node node : nodeList ) { EntityListener < EntityListeners < T > > type = new EntityListenerImpl < EntityListeners < T > > ( this , "entity-listener" , childNode , node ) ; list . add ( type ) ; } return list ; |
public class MessageProcessorMatching { /** * Method registerConsumerSetMonitor
* Checks whether there are any potential consumers for messages published on the
* specified topic ( s ) . The potential set will be determined using an optimistic
* approach that caters for wildcards and selectors by returning true if there is
* any possibility of a match .
* Additionally registers a callback that will be driven when the potential set of
* consumers drops to zero or rises above zero .
* Returns true if the potential set of consumers is currently greater than zero ,
* false if it is zero .
* @ param topicSpace
* @ param discriminatorExpression
* @ param callback
* @ return
* @ throws SIDiscriminatorSyntaxException
* @ throws SIErrorException */
public boolean registerConsumerSetMonitor ( DestinationHandler topicSpace , String discriminatorExpression , ConnectionImpl connection , ConsumerSetChangeCallback callback ) throws SIDiscriminatorSyntaxException , SIErrorException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "registerConsumerSetMonitor" , new Object [ ] { topicSpace , discriminatorExpression , connection , callback } ) ; boolean isWildcarded = isWildCarded ( discriminatorExpression ) ; // Get the uuid for the topicspace
SIBUuid12 topicSpaceUuid = topicSpace . getBaseUuid ( ) ; String topicSpaceStr = topicSpaceUuid . toString ( ) ; // Combine the topicSpace and topic
String tExpression = buildAddTopicExpression ( topicSpaceStr , discriminatorExpression ) ; String wildcardStem = null ; if ( isWildcarded ) { // Retrieve the non - wildcarded stem
wildcardStem = retrieveNonWildcardStem ( tExpression ) ; } boolean areConsumers = false ; // Register under a lock on the targets table
synchronized ( _targets ) { areConsumers = _consumerMonitoring . registerConsumerSetMonitor ( connection , topicSpace , topicSpaceUuid , discriminatorExpression , tExpression , callback , isWildcarded , wildcardStem , this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "registerConsumerSetMonitor" , Boolean . valueOf ( areConsumers ) ) ; return areConsumers ; |
public class ReplicationOperation { /** * Returns the ringbuffer config for the provided namespace . The namespace
* provides information whether the requested ringbuffer is a ringbuffer
* that the user is directly interacting with through a ringbuffer proxy
* or if this is a backing ringbuffer for an event journal .
* If a ringbuffer configuration for an event journal is requested , this
* method will expect the configuration for the relevant map or cache
* to be available .
* @ param service the ringbuffer service
* @ param ns the object namespace for which we are creating a ringbuffer
* @ return the ringbuffer configuration
* @ throws CacheNotExistsException if a config for a cache event journal was requested
* and the cache configuration was not found */
private RingbufferConfig getRingbufferConfig ( RingbufferService service , ObjectNamespace ns ) { } } | final String serviceName = ns . getServiceName ( ) ; if ( RingbufferService . SERVICE_NAME . equals ( serviceName ) ) { return service . getRingbufferConfig ( ns . getObjectName ( ) ) ; } else if ( MapService . SERVICE_NAME . equals ( serviceName ) ) { final MapService mapService = getNodeEngine ( ) . getService ( MapService . SERVICE_NAME ) ; final MapEventJournal journal = mapService . getMapServiceContext ( ) . getEventJournal ( ) ; final EventJournalConfig journalConfig = journal . getEventJournalConfig ( ns ) ; return journal . toRingbufferConfig ( journalConfig , ns ) ; } else if ( CacheService . SERVICE_NAME . equals ( serviceName ) ) { final CacheService cacheService = getNodeEngine ( ) . getService ( CacheService . SERVICE_NAME ) ; final CacheEventJournal journal = cacheService . getEventJournal ( ) ; final EventJournalConfig journalConfig = journal . getEventJournalConfig ( ns ) ; return journal . toRingbufferConfig ( journalConfig , ns ) ; } else { throw new IllegalArgumentException ( "Unsupported ringbuffer service name " + serviceName ) ; } |
public class ClassSourceImpl { /** * < p > Attempt to process this class source using cache data . < / p >
* @ param streamer The streamer used to process the class source .
* @ param i _ seedClassNames The class names of the class source .
* @ param scanPolicy The policy of this class source .
* @ return True or false telling if the class was successfully
* processed using cache data . */
protected boolean processFromCache ( ClassSource_Streamer streamer , Set < String > i_seedClassNames , ScanPolicy scanPolicy ) { } } | if ( streamer == null ) { return false ; } Index jandexIndex = getJandexIndex ( ) ; if ( jandexIndex == null ) { return false ; } processedUsingJandex = true ; String useClassSourceName = getCanonicalName ( ) ; for ( org . jboss . jandex . ClassInfo nextJandexClassInfo : jandexIndex . getKnownClasses ( ) ) { DotName nextClassDotName = nextJandexClassInfo . name ( ) ; String nextClassName = nextClassDotName . toString ( ) ; markResult ( ClassSource_ScanCounts . ResultField . ENTRY ) ; markResult ( ClassSource_ScanCounts . ResultField . NON_CONTAINER ) ; markResult ( ClassSource_ScanCounts . ResultField . CLASS ) ; // Processing notes :
// Make sure to record the class before attempting processing .
// Only one version of the class is to be processed , even if processing
// fails on that one version .
// That is , if two child class sources have versions of a class , and
// the version from the first class source is non - valid , the version
// of the class in the second class source is still masked by the
// version in the first class source .
String i_nextClassName = internClassName ( nextClassName ) ; boolean didAdd = i_maybeAdd ( i_nextClassName , i_seedClassNames ) ; if ( ! didAdd ) { incrementClassExclusionCount ( ) ; markResult ( ClassSource_ScanCounts . ResultField . DUPLICATE_CLASS ) ; } else { incrementClassInclusionCount ( ) ; boolean didProcess ; if ( ! streamer . doProcess ( i_nextClassName , scanPolicy ) ) { didProcess = false ; } else { try { didProcess = streamer . process ( useClassSourceName , nextJandexClassInfo , scanPolicy ) ; } catch ( ClassSource_Exception e ) { didProcess = false ; // CWWKC0065W : An exception occurred while processing class [ { 0 } ] . The identifier for the class source is [ { 1 } ] . The exception was { 2 } .
Tr . warning ( tc , "JANDEX_SCAN_EXCEPTION" , i_nextClassName , getHashText ( ) , e ) ; } } if ( didProcess ) { markResult ( ClassSource_ScanCounts . ResultField . PROCESSED_CLASS ) ; } else { markResult ( ClassSource_ScanCounts . ResultField . UNPROCESSED_CLASS ) ; } } } return true ; |
public class CLICommand { /** * Get long description as a string . */
@ Restricted ( NoExternalUse . class ) public final String getLongDescription ( ) { } } | ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; PrintStream ps = new PrintStream ( out ) ; printUsageSummary ( ps ) ; ps . close ( ) ; return out . toString ( ) ; |
public class QueryColumnUtil { /** * redefine type of value
* @ param value
* @ return redefined type of the value */
protected static Object reDefineType ( QueryColumnImpl column , Object value ) { } } | column . typeChecked = false ; if ( value == null || column . type == Types . OTHER ) return value ; if ( value instanceof String && ( ( String ) value ) . isEmpty ( ) ) return value ; switch ( column . type ) { // Numeric Values
case Types . DOUBLE : return reDefineDouble ( column , value ) ; case Types . BIGINT : return reDefineDecimal ( column , value ) ; case Types . NUMERIC : return reDefineDouble ( column , value ) ; case Types . INTEGER : return reDefineInteger ( column , value ) ; case Types . TINYINT : return reDefineTinyInt ( column , value ) ; case Types . FLOAT : return reDefineFloat ( column , value ) ; case Types . DECIMAL : return reDefineDecimal ( column , value ) ; case Types . REAL : return reDefineFloat ( column , value ) ; case Types . SMALLINT : return reDefineShort ( column , value ) ; // DateTime Values
case Types . TIMESTAMP : return reDefineDateTime ( column , value ) ; case Types . DATE : return reDefineDateTime ( column , value ) ; case Types . TIME : return reDefineDateTime ( column , value ) ; // Char
case Types . CHAR : return reDefineString ( column , value ) ; case Types . VARCHAR : return reDefineString ( column , value ) ; case Types . LONGVARCHAR : return reDefineString ( column , value ) ; case Types . CLOB : return reDefineClob ( column , value ) ; // Boolean
case Types . BOOLEAN : return reDefineBoolean ( column , value ) ; case Types . BIT : return reDefineBoolean ( column , value ) ; // Binary
case Types . BINARY : return reDefineBinary ( column , value ) ; case Types . VARBINARY : return reDefineBinary ( column , value ) ; case Types . LONGVARBINARY : return reDefineBinary ( column , value ) ; case Types . BLOB : return reDefineBlob ( column , value ) ; // Others
case Types . ARRAY : return reDefineOther ( column , value ) ; case Types . DATALINK : return reDefineOther ( column , value ) ; case Types . DISTINCT : return reDefineOther ( column , value ) ; case Types . JAVA_OBJECT : return reDefineOther ( column , value ) ; case Types . NULL : return reDefineOther ( column , value ) ; case Types . STRUCT : return reDefineOther ( column , value ) ; case Types . REF : return reDefineOther ( column , value ) ; default : return value ; } |
public class CreateInputRequest { /** * The source URLs for a PULL - type input . Every PULL type input needs exactly two source URLs for redundancy . Only
* specify sources for PULL type Inputs . Leave Destinations empty .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setSources ( java . util . Collection ) } or { @ link # withSources ( java . util . Collection ) } if you want to override
* the existing values .
* @ param sources
* The source URLs for a PULL - type input . Every PULL type input needs exactly two source URLs for redundancy .
* Only specify sources for PULL type Inputs . Leave Destinations empty .
* @ return Returns a reference to this object so that method calls can be chained together . */
public CreateInputRequest withSources ( InputSourceRequest ... sources ) { } } | if ( this . sources == null ) { setSources ( new java . util . ArrayList < InputSourceRequest > ( sources . length ) ) ; } for ( InputSourceRequest ele : sources ) { this . sources . add ( ele ) ; } return this ; |
public class ListDeviceEventsResult { /** * The device events requested for the device ARN .
* @ param deviceEvents
* The device events requested for the device ARN . */
public void setDeviceEvents ( java . util . Collection < DeviceEvent > deviceEvents ) { } } | if ( deviceEvents == null ) { this . deviceEvents = null ; return ; } this . deviceEvents = new java . util . ArrayList < DeviceEvent > ( deviceEvents ) ; |
public class BDSup2SubWrapper { /** * Update width , height and offsets of target SubPicture . < br >
* This is needed if cropping captions during decode ( i . e . the source image
* size changes ) .
* @ param index
* Index of caption
* @ return true : image size has changed , false : image size didn ' t change . */
private boolean updateTrgPic ( int index ) { } } | SubPicture picSrc = subtitleStream . getSubPicture ( index ) ; SubPicture picTrg = subPictures [ index ] ; double scaleX = ( double ) picTrg . getWidth ( ) / picSrc . getWidth ( ) ; double scaleY = ( double ) picTrg . getHeight ( ) / picSrc . getHeight ( ) ; double fx ; double fy ; if ( configuration . getApplyFreeScale ( ) ) { fx = configuration . getFreeScaleFactorX ( ) ; fy = configuration . getFreeScaleFactorY ( ) ; } else { fx = 1.0 ; fy = 1.0 ; } int wOld = picTrg . getImageWidth ( ) ; int hOld = picTrg . getImageHeight ( ) ; int wNew = ( int ) ( picSrc . getImageWidth ( ) * scaleX * fx + 0.5 ) ; if ( wNew < MIN_IMAGE_DIMENSION ) { wNew = picSrc . getImageWidth ( ) ; } else if ( wNew > picTrg . getWidth ( ) ) { wNew = picTrg . getWidth ( ) ; } int hNew = ( int ) ( picSrc . getImageHeight ( ) * scaleY * fy + 0.5 ) ; if ( hNew < MIN_IMAGE_DIMENSION ) { hNew = picSrc . getImageHeight ( ) ; } else if ( hNew > picTrg . getHeight ( ) ) { hNew = picTrg . getHeight ( ) ; } picTrg . setImageWidth ( wNew ) ; picTrg . setImageHeight ( hNew ) ; if ( wNew != wOld ) { int xOfs = ( int ) ( picSrc . getXOffset ( ) * scaleX + 0.5 ) ; int spaceSrc = ( int ) ( ( picSrc . getWidth ( ) - picSrc . getImageWidth ( ) ) * scaleX + 0.5 ) ; int spaceTrg = picTrg . getWidth ( ) - wNew ; xOfs += ( spaceTrg - spaceSrc ) / 2 ; if ( xOfs < 0 ) { xOfs = 0 ; } else if ( xOfs + wNew > picTrg . getWidth ( ) ) { xOfs = picTrg . getWidth ( ) - wNew ; } picTrg . setOfsX ( xOfs ) ; } if ( hNew != hOld ) { int yOfs = ( int ) ( picSrc . getYOffset ( ) * scaleY + 0.5 ) ; int spaceSrc = ( int ) ( ( picSrc . getHeight ( ) - picSrc . getImageHeight ( ) ) * scaleY + 0.5 ) ; int spaceTrg = picTrg . getHeight ( ) - hNew ; yOfs += ( spaceTrg - spaceSrc ) / 2 ; if ( yOfs + hNew > picTrg . getHeight ( ) ) { yOfs = picTrg . getHeight ( ) - hNew ; } picTrg . setOfsY ( yOfs ) ; } // was image cropped ?
return ( wNew != wOld ) || ( hNew != hOld ) ; |
public class State { /** * Add all argument attributes to next ( if not already contained in next ) */
public void addArgAttrs ( List < Attribute > result ) { } } | int i ; int max ; Alternative ab ; max = alternatives . size ( ) ; for ( i = 0 ; i < max ; i ++ ) { ab = alternatives . get ( i ) ; ab . addArgAttrs ( result ) ; } |
public class MathUtilImpl { /** * This method gets the singleton instance of { @ link MathUtil } . < br >
* < b > ATTENTION : < / b > < br >
* Please prefer dependency - injection instead of using this method .
* @ return the singleton instance . */
public static MathUtil getInstance ( ) { } } | if ( instance == null ) { synchronized ( MathUtilImpl . class ) { if ( instance == null ) { MathUtilImpl impl = new MathUtilImpl ( ) ; impl . initialize ( ) ; instance = impl ; } } } return instance ; |
public class TenantService { /** * hashed format . */
private void validateTenantUsers ( TenantDefinition tenantDef ) { } } | for ( UserDefinition userDef : tenantDef . getUsers ( ) . values ( ) ) { Utils . require ( ! Utils . isEmpty ( userDef . getPassword ( ) ) , "Password is required; user ID=" + userDef . getID ( ) ) ; userDef . setHash ( PasswordManager . hash ( userDef . getPassword ( ) ) ) ; userDef . setPassword ( null ) ; } |
public class ServerCommand { /** * Writes a command or command response to a socket channel .
* < p > This method is not safe for use by multiple concurrent threads .
* @ param sc the socket channel
* @ param s the command or command response */
protected void write ( SocketChannel sc , String s ) throws IOException { } } | sc . write ( encoder . encode ( CharBuffer . wrap ( s ) ) ) ; |
public class Utils { /** * Returns the closest { @ link EObject # eContainer ( ) container object } that is validating the predicate .
* @ param element the element to start from .
* @ param predicate the predicate to test .
* @ return the container or { @ code null } .
* @ since 0.5
* @ see EcoreUtil2 # getContainerOfType ( EObject , Class ) */
public static EObject getFirstContainerForPredicate ( EObject element , Function1 < ? super EObject , ? extends Boolean > predicate ) { } } | if ( predicate == null || element == null ) { return null ; } EObject elt = element . eContainer ( ) ; while ( elt != null ) { if ( predicate . apply ( elt ) ) { return elt ; } elt = elt . eContainer ( ) ; } return null ; |
public class SequenceUtil { /** * Ambiguous DNA chars : AGTCRYMKSWHBVDN / / differs from protein in only one
* ( ! ) - B char */
public static boolean isNonAmbNucleotideSequence ( String sequence ) { } } | sequence = SequenceUtil . cleanSequence ( sequence ) ; if ( SequenceUtil . DIGIT . matcher ( sequence ) . find ( ) ) { return false ; } if ( SequenceUtil . NON_NUCLEOTIDE . matcher ( sequence ) . find ( ) ) { return false ; /* * System . out . format ( " I found the text starting at " +
* " index % d and ending at index % d . % n " , nonDNAmatcher . start ( ) ,
* nonDNAmatcher . end ( ) ) ; */
} final Matcher DNAmatcher = SequenceUtil . NUCLEOTIDE . matcher ( sequence ) ; return DNAmatcher . find ( ) ; |
public class OkHttpClientBuilder { /** * Inspired from sun . security . ssl . SSLContextImpl # getDefaultKeyManager ( ) */
private static synchronized KeyManager [ ] getDefaultKeyManager ( ) throws KeyStoreException , NoSuchProviderException , IOException , CertificateException , NoSuchAlgorithmException , UnrecoverableKeyException { } } | final String defaultKeyStore = System . getProperty ( "javax.net.ssl.keyStore" , "" ) ; String defaultKeyStoreType = System . getProperty ( "javax.net.ssl.keyStoreType" , KeyStore . getDefaultType ( ) ) ; String defaultKeyStoreProvider = System . getProperty ( "javax.net.ssl.keyStoreProvider" , "" ) ; logDebug ( "keyStore is : " + defaultKeyStore ) ; logDebug ( "keyStore type is : " + defaultKeyStoreType ) ; logDebug ( "keyStore provider is : " + defaultKeyStoreProvider ) ; if ( P11KEYSTORE . equals ( defaultKeyStoreType ) && ! NONE . equals ( defaultKeyStore ) ) { throw new IllegalArgumentException ( "if keyStoreType is " + P11KEYSTORE + ", then keyStore must be " + NONE ) ; } KeyStore ks = null ; String defaultKeyStorePassword = System . getProperty ( "javax.net.ssl.keyStorePassword" , "" ) ; char [ ] passwd = defaultKeyStorePassword . isEmpty ( ) ? null : defaultKeyStorePassword . toCharArray ( ) ; // Try to initialize key store .
if ( ! defaultKeyStoreType . isEmpty ( ) ) { logDebug ( "init keystore" ) ; if ( defaultKeyStoreProvider . isEmpty ( ) ) { ks = KeyStore . getInstance ( defaultKeyStoreType ) ; } else { ks = KeyStore . getInstance ( defaultKeyStoreType , defaultKeyStoreProvider ) ; } if ( ! defaultKeyStore . isEmpty ( ) && ! NONE . equals ( defaultKeyStore ) ) { try ( FileInputStream fs = new FileInputStream ( defaultKeyStore ) ) { ks . load ( fs , passwd ) ; } } else { ks . load ( null , passwd ) ; } } // Try to initialize key manager .
logDebug ( "init keymanager of type " + KeyManagerFactory . getDefaultAlgorithm ( ) ) ; KeyManagerFactory kmf = KeyManagerFactory . getInstance ( KeyManagerFactory . getDefaultAlgorithm ( ) ) ; if ( P11KEYSTORE . equals ( defaultKeyStoreType ) ) { // do not pass key passwd if using token
kmf . init ( ks , null ) ; } else { kmf . init ( ks , passwd ) ; } return kmf . getKeyManagers ( ) ; |
public class RestoreJobsListMemberMarshaller { /** * Marshall the given parameter object . */
public void marshall ( RestoreJobsListMember restoreJobsListMember , ProtocolMarshaller protocolMarshaller ) { } } | if ( restoreJobsListMember == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( restoreJobsListMember . getRestoreJobId ( ) , RESTOREJOBID_BINDING ) ; protocolMarshaller . marshall ( restoreJobsListMember . getRecoveryPointArn ( ) , RECOVERYPOINTARN_BINDING ) ; protocolMarshaller . marshall ( restoreJobsListMember . getCreationDate ( ) , CREATIONDATE_BINDING ) ; protocolMarshaller . marshall ( restoreJobsListMember . getCompletionDate ( ) , COMPLETIONDATE_BINDING ) ; protocolMarshaller . marshall ( restoreJobsListMember . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( restoreJobsListMember . getStatusMessage ( ) , STATUSMESSAGE_BINDING ) ; protocolMarshaller . marshall ( restoreJobsListMember . getPercentDone ( ) , PERCENTDONE_BINDING ) ; protocolMarshaller . marshall ( restoreJobsListMember . getBackupSizeInBytes ( ) , BACKUPSIZEINBYTES_BINDING ) ; protocolMarshaller . marshall ( restoreJobsListMember . getIamRoleArn ( ) , IAMROLEARN_BINDING ) ; protocolMarshaller . marshall ( restoreJobsListMember . getExpectedCompletionTimeMinutes ( ) , EXPECTEDCOMPLETIONTIMEMINUTES_BINDING ) ; protocolMarshaller . marshall ( restoreJobsListMember . getCreatedResourceArn ( ) , CREATEDRESOURCEARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ServerImpl { /** * Bind and start the server .
* @ return { @ code this } object
* @ throws IllegalStateException if already started
* @ throws IOException if unable to bind */
@ Override public ServerImpl start ( ) throws IOException { } } | synchronized ( lock ) { checkState ( ! started , "Already started" ) ; checkState ( ! shutdown , "Shutting down" ) ; // Start and wait for any ports to actually be bound .
ServerListenerImpl listener = new ServerListenerImpl ( ) ; for ( InternalServer ts : transportServers ) { ts . start ( listener ) ; activeTransportServers ++ ; } executor = Preconditions . checkNotNull ( executorPool . getObject ( ) , "executor" ) ; started = true ; return this ; } |
public class PrivilegedMasterSecretValidator { /** * Double check the master secret of an SSL session is not null
* @ param socket
* connected socket
* @ return True if master secret is valid ( i . e . non - null ) or master secret cannot be validated ,
* false otherwise */
public boolean isMasterSecretValid ( final Socket socket ) { } } | return AccessController . doPrivileged ( new PrivilegedAction < Boolean > ( ) { @ Override public Boolean run ( ) { return privilegedIsMasterSecretValid ( socket ) ; } } ) ; |
public class ImageSlideView { /** * TODO To complete .
* @ return */
private FadeTransition getSlideLabelTransition ( final Duration gap ) { } } | return FadeTransitionBuilder . create ( ) . node ( this . slideLabel ) . delay ( gap ) . duration ( Duration . millis ( 1200 ) ) . fromValue ( 0 ) . toValue ( 1 ) . build ( ) ; |
public class CreateAppProfileRequest { /** * Sets the routing policy for all read / write requests that use this app profile . */
@ SuppressWarnings ( "WeakerAccess" ) public CreateAppProfileRequest setRoutingPolicy ( RoutingPolicy routingPolicy ) { } } | Preconditions . checkNotNull ( routingPolicy ) ; if ( routingPolicy instanceof MultiClusterRoutingPolicy ) { proto . getAppProfileBuilder ( ) . setMultiClusterRoutingUseAny ( ( ( MultiClusterRoutingPolicy ) routingPolicy ) . toProto ( ) ) ; } else if ( routingPolicy instanceof SingleClusterRoutingPolicy ) { proto . getAppProfileBuilder ( ) . setSingleClusterRouting ( ( ( SingleClusterRoutingPolicy ) routingPolicy ) . toProto ( ) ) ; } else { throw new IllegalArgumentException ( "Unknown policy type: " + routingPolicy ) ; } return this ; |
public class BaseClient { /** * 为公有云用户填充http header , 传入的request中body & param已经ready
* 对于DEV用户 , 则将access _ token放到url中 */
protected void postOperation ( AipRequest request ) { } } | if ( isBceKey . get ( ) ) { // add aipSdk param
request . addParam ( "aipSdk" , "java" ) ; String bodyStr = request . getBodyStr ( ) ; try { int len = bodyStr . getBytes ( request . getContentEncoding ( ) ) . length ; request . addHeader ( Headers . CONTENT_LENGTH , Integer . toString ( len ) ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } request . addHeader ( Headers . CONTENT_MD5 , SignUtil . md5 ( bodyStr , request . getContentEncoding ( ) ) ) ; String timestamp = Util . getCanonicalTime ( ) ; request . addHeader ( Headers . HOST , request . getUri ( ) . getHost ( ) ) ; request . addHeader ( Headers . BCE_DATE , timestamp ) ; request . addHeader ( Headers . AUTHORIZATION , CloudAuth . sign ( request , this . aipKey , this . aipToken , timestamp ) ) ; } else { request . addParam ( "aipSdk" , "java" ) ; request . addParam ( "access_token" , accessToken ) ; } |
public class HTTPConduit { /** * Relative Location values are also supported */
private static String convertToAbsoluteUrlIfNeeded ( String conduitName , String lastURL , String newURL , Message message ) throws IOException { } } | if ( newURL != null && ! newURL . startsWith ( "http" ) ) { if ( MessageUtils . isTrue ( message . getContextualProperty ( AUTO_REDIRECT_ALLOW_REL_URI ) ) ) { return URI . create ( lastURL ) . resolve ( newURL ) . toString ( ) ; } else { String msg = "Relative Redirect detected on Conduit '" + conduitName + "' on '" + newURL + "'" ; LOG . log ( Level . INFO , msg ) ; throw new IOException ( msg ) ; } } else { return newURL ; } |
public class ReservationRepository { /** * find reservations by chargingstationid , evseid and userId
* @ param chargingStationId
* @ param evseid
* @ param UserId
* @ return
* @ throws NoResultException */
public Reservation findByChargingStationIdEvseIdUserId ( ChargingStationId chargingStationId , EvseId evseid , UserIdentity UserId ) throws NoResultException { } } | EntityManager entityManager = getEntityManager ( ) ; try { return entityManager . createQuery ( "SELECT t FROM io.motown.operatorapi.viewmodel.persistence.entities.Reservation AS t WHERE t.chargingStationId = :chargingStationId AND evseId = :evseId AND userId = :userId" , Reservation . class ) . setParameter ( "chargingStationId" , chargingStationId . getId ( ) ) . setParameter ( "evseId" , evseid ) . setParameter ( "userId" , UserId . getId ( ) ) . getSingleResult ( ) ; } finally { entityManager . close ( ) ; } |
public class ListDataSourcesResult { /** * The < code > DataSource < / code > objects .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setDataSources ( java . util . Collection ) } or { @ link # withDataSources ( java . util . Collection ) } if you want to
* override the existing values .
* @ param dataSources
* The < code > DataSource < / code > objects .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListDataSourcesResult withDataSources ( DataSource ... dataSources ) { } } | if ( this . dataSources == null ) { setDataSources ( new java . util . ArrayList < DataSource > ( dataSources . length ) ) ; } for ( DataSource ele : dataSources ) { this . dataSources . add ( ele ) ; } return this ; |
public class AbstractPool { /** * Prefill the connection pool */
@ Override public void prefill ( ) { } } | if ( isShutdown ( ) ) return ; if ( poolConfiguration . isPrefill ( ) ) { ManagedConnectionPool mcp = pools . get ( getPrefillCredential ( ) ) ; if ( mcp == null ) { // Trigger the initial - pool - size prefill by creating the ManagedConnectionPool
getManagedConnectionPool ( getPrefillCredential ( ) ) ; } else { // Standard prefill request
mcp . prefill ( ) ; } } |
public class NetworkProfilesInner { /** * Gets all the network profiles in a subscription .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; NetworkProfileInner & gt ; object */
public Observable < Page < NetworkProfileInner > > listAsync ( ) { } } | return listWithServiceResponseAsync ( ) . map ( new Func1 < ServiceResponse < Page < NetworkProfileInner > > , Page < NetworkProfileInner > > ( ) { @ Override public Page < NetworkProfileInner > call ( ServiceResponse < Page < NetworkProfileInner > > response ) { return response . body ( ) ; } } ) ; |
public class CPDefinitionVirtualSettingWrapper { /** * Sets the localized terms of use contents of this cp definition virtual setting from the map of locales and localized terms of use contents .
* @ param termsOfUseContentMap the locales and localized terms of use contents of this cp definition virtual setting */
@ Override public void setTermsOfUseContentMap ( Map < java . util . Locale , String > termsOfUseContentMap ) { } } | _cpDefinitionVirtualSetting . setTermsOfUseContentMap ( termsOfUseContentMap ) ; |
public class Binding { /** * < pre >
* Role that is assigned to ` members ` .
* For example , ` roles / viewer ` , ` roles / editor ` , or ` roles / owner ` .
* Required
* < / pre >
* < code > string role = 1 ; < / code > */
public java . lang . String getRole ( ) { } } | java . lang . Object ref = role_ ; if ( ref instanceof java . lang . String ) { return ( java . lang . String ) ref ; } else { com . google . protobuf . ByteString bs = ( com . google . protobuf . ByteString ) ref ; java . lang . String s = bs . toStringUtf8 ( ) ; role_ = s ; return s ; } |
public class LayerUtil { /** * Converts the supplied point from screen coordinates to coordinates
* relative to the specified layer . */
public static Point screenToLayer ( Layer layer , float x , float y ) { } } | Point into = new Point ( x , y ) ; return screenToLayer ( layer , into , into ) ; |
public class AS2ClientBuilder { /** * Set the factory to create { @ link AS2Client } objects internally . Overwrite
* this if you need a proxy in the AS2Client object . By default a new instance
* of AS2Client is created so you don ' t need to call this method .
* @ param aAS2ClientFactory
* The factory to be used . May not be < code > null < / code > .
* @ return this for chaining */
@ Nonnull public AS2ClientBuilder setAS2ClientFactory ( @ Nonnull final ISupplier < AS2Client > aAS2ClientFactory ) { } } | m_aAS2ClientFactory = ValueEnforcer . notNull ( aAS2ClientFactory , "AS2ClientFactory" ) ; return this ; |
public class PemObjectReader { /** * Reads the given { @ link File } ( in * . pem format ) that contains a password protected private
* key .
* @ param keyFile
* the file with the password protected private key
* @ param password
* the password
* @ return the { @ link PrivateKey } object
* @ throws IOException
* Signals that an I / O exception has occurred . */
public static PrivateKey readPemPrivateKey ( File keyFile , String password ) throws IOException { } } | Security . addProvider ( new BouncyCastleProvider ( ) ) ; try ( PEMParser pemParser = new PEMParser ( new InputStreamReader ( new FileInputStream ( keyFile ) ) ) ) { PEMEncryptedKeyPair encryptedKeyPair = ( PEMEncryptedKeyPair ) pemParser . readObject ( ) ; PEMDecryptorProvider decryptorProvider = new JcePEMDecryptorProviderBuilder ( ) . build ( password . toCharArray ( ) ) ; PEMKeyPair pemKeyPair = encryptedKeyPair . decryptKeyPair ( decryptorProvider ) ; JcaPEMKeyConverter converter = new JcaPEMKeyConverter ( ) . setProvider ( SecurityProvider . BC . name ( ) ) ; return converter . getPrivateKey ( pemKeyPair . getPrivateKeyInfo ( ) ) ; } |
public class SegmentIteratorImpl { /** * Moves the iterator to next path and returns true if successful . */
public boolean nextPath ( ) { } } | // post - increment
m_currentPathIndex = m_nextPathIndex ; if ( m_currentPathIndex >= m_parent . getPathCount ( ) ) return false ; m_currentSegmentIndex = - 1 ; m_nextSegmentIndex = 0 ; m_segmentCount = _getSegmentCount ( m_currentPathIndex ) ; m_pathBegin = m_parent . getPathStart ( m_currentPathIndex ) ; m_nextPathIndex ++ ; return true ; |
public class Prefs { /** * Stores a double value as a long raw bits value .
* @ param key The name of the preference to modify .
* @ param value The double value to be save in the preferences .
* @ see android . content . SharedPreferences . Editor # putLong ( String , long ) */
public static void putDouble ( final String key , final double value ) { } } | final Editor editor = getPreferences ( ) . edit ( ) ; editor . putLong ( key , Double . doubleToRawLongBits ( value ) ) ; editor . apply ( ) ; |
public class WebSiteManagementClientImpl { /** * List all apps that are assigned to a hostname .
* List all apps that are assigned to a hostname .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws DefaultErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the PagedList & lt ; IdentifierInner & gt ; object if successful . */
public PagedList < IdentifierInner > listSiteIdentifiersAssignedToHostNameNext ( final String nextPageLink ) { } } | ServiceResponse < Page < IdentifierInner > > response = listSiteIdentifiersAssignedToHostNameNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < IdentifierInner > ( response . body ( ) ) { @ Override public Page < IdentifierInner > nextPage ( String nextPageLink ) { return listSiteIdentifiersAssignedToHostNameNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ; |
public class CsvDataProvider { /** * { @ inheritDoc } */
@ Override public String [ ] readLine ( int line , boolean readResult ) { } } | logger . debug ( "readLine at line {}" , line ) ; try { final CSVReader reader = openInputData ( ) ; final List < String [ ] > a = reader . readAll ( ) ; if ( line >= a . size ( ) ) { return null ; } final String [ ] row = a . get ( line ) ; if ( "" . equals ( row [ 0 ] ) ) { return null ; } else { final String [ ] ret = readResult ? new String [ columns . size ( ) ] : new String [ columns . size ( ) - 1 ] ; for ( int i = 0 ; i < ret . length ; i ++ ) { ret [ i ] = row [ i ] ; } return ret ; } } catch ( final IOException e ) { logger . error ( "error CsvDataProvider.readLine()" , e ) ; return null ; } |
public class Matrix4d { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix4dc # rotateZ ( double , org . joml . Matrix4d ) */
public Matrix4d rotateZ ( double ang , Matrix4d dest ) { } } | if ( ( properties & PROPERTY_IDENTITY ) != 0 ) return dest . rotationZ ( ang ) ; double sin = Math . sin ( ang ) ; double cos = Math . cosFromSin ( sin , ang ) ; return rotateTowardsXY ( sin , cos , dest ) ; |
public class RetryerBuilder { /** * Configures the retryer to retry if the result satisfies the given predicate .
* @ param resultPredicate a predicate applied to the result , and which causes the retryer
* to retry if the predicate is satisfied
* @ return < code > this < / code > */
public RetryerBuilder < V > retryIfResult ( @ Nonnull Predicate < V > resultPredicate ) { } } | Preconditions . checkNotNull ( resultPredicate , "resultPredicate may not be null" ) ; rejectionPredicate = Predicates . or ( rejectionPredicate , new ResultPredicate < V > ( resultPredicate ) ) ; return this ; |
public class RepositoryApi { /** * Get an archive of the complete repository by SHA ( optional ) and saves to the specified directory .
* If the archive already exists in the directory it will be overwritten .
* < pre > < code > GitLab Endpoint : GET / projects / : id / repository / archive < / code > < / pre >
* @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance
* @ param sha the SHA of the archive to get
* @ param directory the File instance of the directory to save the archive to , if null will use " java . io . tmpdir "
* @ param format The archive format , defaults to " tar . gz " if null
* @ return a File instance pointing to the downloaded instance
* @ throws GitLabApiException if format is not a valid archive format or any exception occurs */
public File getRepositoryArchive ( Object projectIdOrPath , String sha , File directory , String format ) throws GitLabApiException { } } | ArchiveFormat archiveFormat = ArchiveFormat . forValue ( format ) ; return ( getRepositoryArchive ( projectIdOrPath , sha , directory , archiveFormat ) ) ; |
public class ParamTaglet { /** * Given an array of < code > ParamTag < / code > s , return its string representation .
* @ param holder the member that holds the param tags .
* @ param writer the TagletWriter that will write this tag .
* @ return the TagletOutput representation of these < code > ParamTag < / code > s . */
public Content getTagletOutput ( Element holder , TagletWriter writer ) { } } | Utils utils = writer . configuration ( ) . utils ; if ( utils . isExecutableElement ( holder ) ) { ExecutableElement member = ( ExecutableElement ) holder ; Content output = getTagletOutput ( false , member , writer , member . getTypeParameters ( ) , utils . getTypeParamTrees ( member ) ) ; output . addContent ( getTagletOutput ( true , member , writer , member . getParameters ( ) , utils . getParamTrees ( member ) ) ) ; return output ; } else { TypeElement typeElement = ( TypeElement ) holder ; return getTagletOutput ( false , typeElement , writer , typeElement . getTypeParameters ( ) , utils . getTypeParamTrees ( typeElement ) ) ; } |
public class StringConcatenation { /** * Append the contents of a given StringConcatenation to this sequence . Does nothing
* if the concatenation is < code > null < / code > . The given indentation will be prepended to each line except
* the first one .
* @ param concat
* the to - be - appended StringConcatenation .
* @ param indentation
* the indentation string that should be prepended . May not be < code > null < / code > .
* @ since 2.11 */
public void append ( StringConcatenation concat , String indentation ) { } } | if ( indentation . isEmpty ( ) ) { append ( concat ) ; } else if ( concat != null ) appendSegments ( indentation , segments . size ( ) , concat . getSignificantContent ( ) , concat . lineDelimiter ) ; |
public class NetworkManager { /** * Deploys a component . */
private void deployComponent ( final ComponentContext < ? > component , final Handler < AsyncResult < Void > > doneHandler ) { } } | log . info ( String . format ( "%s - Deploying %d instances of %s" , NetworkManager . this , component . instances ( ) . size ( ) , component . isModule ( ) ? component . asModule ( ) . module ( ) : component . asVerticle ( ) . main ( ) ) ) ; log . debug ( String . format ( "%s - Deploying component:%n%s" , NetworkManager . this , component . toString ( true ) ) ) ; // If the component is installable then we first need to install the
// component to all the nodes in the cluster .
if ( component . isModule ( ) ) { final ModuleContext module = component . asModule ( ) ; // If the component has a group then install the module to the group .
if ( component . group ( ) != null ) { // Make sure to install the module only to the appropriate deployment group .
cluster . getGroup ( component . group ( ) , new Handler < AsyncResult < Group > > ( ) { @ Override public void handle ( AsyncResult < Group > result ) { if ( result . failed ( ) ) { new DefaultFutureResult < Void > ( result . cause ( ) ) . setHandler ( doneHandler ) ; } else { result . result ( ) . getNodes ( new Handler < AsyncResult < Collection < Node > > > ( ) { @ Override public void handle ( AsyncResult < Collection < Node > > result ) { if ( result . failed ( ) ) { new DefaultFutureResult < Void > ( result . cause ( ) ) . setHandler ( doneHandler ) ; } else { final CountingCompletionHandler < Void > counter = new CountingCompletionHandler < Void > ( result . result ( ) . size ( ) ) ; counter . setHandler ( new Handler < AsyncResult < Void > > ( ) { @ Override public void handle ( AsyncResult < Void > result ) { if ( result . failed ( ) ) { new DefaultFutureResult < Void > ( result . cause ( ) ) . setHandler ( doneHandler ) ; } else { deployInstances ( component . instances ( ) , doneHandler ) ; } } } ) ; for ( Node node : result . result ( ) ) { installModule ( node , module , counter ) ; } } } } ) ; } } } ) ; } else { // If the component doesn ' t have a group then it needs to be installed
// to the cluster .
cluster . getNodes ( new Handler < AsyncResult < Collection < Node > > > ( ) { @ Override public void handle ( AsyncResult < Collection < Node > > result ) { if ( result . failed ( ) ) { new DefaultFutureResult < Void > ( result . cause ( ) ) . setHandler ( doneHandler ) ; } else { final CountingCompletionHandler < Void > counter = new CountingCompletionHandler < Void > ( result . result ( ) . size ( ) ) ; counter . setHandler ( new Handler < AsyncResult < Void > > ( ) { @ Override public void handle ( AsyncResult < Void > result ) { if ( result . failed ( ) ) { new DefaultFutureResult < Void > ( result . cause ( ) ) . setHandler ( doneHandler ) ; } else { deployInstances ( component . instances ( ) , doneHandler ) ; } } } ) ; for ( Node node : result . result ( ) ) { installModule ( node , module , counter ) ; } } } } ) ; } } else { deployInstances ( component . instances ( ) , doneHandler ) ; } |
public class YamlDataProviderImpl { /** * Gets yaml data by key identifiers . Only compatible with a yaml file formatted to return a map . < br >
* < br >
* YAML file example :
* < pre >
* test1:
* name : 1
* email : user1 @ paypal . com
* userId : 10686626
* test2:
* name : 2
* email : user2 @ paypal . com
* userId : 10686627
* < / pre >
* @ param keys
* A String array that represents the keys .
* @ return Object [ ] [ ] two dimensional object to be used with TestNG DataProvider */
@ Override public Object [ ] [ ] getDataByKeys ( String [ ] keys ) { } } | logger . entering ( Arrays . toString ( keys ) ) ; InputStream inputStream = resource . getInputStream ( ) ; Yaml yaml = constructYaml ( resource . getCls ( ) ) ; LinkedHashMap < ? , ? > map = ( LinkedHashMap < ? , ? > ) yaml . load ( inputStream ) ; Object [ ] [ ] objArray = DataProviderHelper . getDataByKeys ( map , keys ) ; logger . exiting ( ( Object [ ] ) objArray ) ; return objArray ; |
public class NetworkEndpointGroupClient { /** * Detach a list of network endpoints from the specified network endpoint group .
* < p > Sample code :
* < pre > < code >
* try ( NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient . create ( ) ) {
* ProjectZoneNetworkEndpointGroupName networkEndpointGroup = ProjectZoneNetworkEndpointGroupName . of ( " [ PROJECT ] " , " [ ZONE ] " , " [ NETWORK _ ENDPOINT _ GROUP ] " ) ;
* NetworkEndpointGroupsDetachEndpointsRequest networkEndpointGroupsDetachEndpointsRequestResource = NetworkEndpointGroupsDetachEndpointsRequest . newBuilder ( ) . build ( ) ;
* Operation response = networkEndpointGroupClient . detachNetworkEndpointsNetworkEndpointGroup ( networkEndpointGroup , networkEndpointGroupsDetachEndpointsRequestResource ) ;
* < / code > < / pre >
* @ param networkEndpointGroup The name of the network endpoint group where you are removing
* network endpoints . It should comply with RFC1035.
* @ param networkEndpointGroupsDetachEndpointsRequestResource
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation detachNetworkEndpointsNetworkEndpointGroup ( ProjectZoneNetworkEndpointGroupName networkEndpointGroup , NetworkEndpointGroupsDetachEndpointsRequest networkEndpointGroupsDetachEndpointsRequestResource ) { } } | DetachNetworkEndpointsNetworkEndpointGroupHttpRequest request = DetachNetworkEndpointsNetworkEndpointGroupHttpRequest . newBuilder ( ) . setNetworkEndpointGroup ( networkEndpointGroup == null ? null : networkEndpointGroup . toString ( ) ) . setNetworkEndpointGroupsDetachEndpointsRequestResource ( networkEndpointGroupsDetachEndpointsRequestResource ) . build ( ) ; return detachNetworkEndpointsNetworkEndpointGroup ( request ) ; |
public class PropertiesParser { /** * Provides a set of workspace components parameters short names ( without long prefixes
* e . g . " exo . jcr . config . force . all " ) defined ( no matter how many times )
* via system properties . Set is ok to be used because it is assumed that there should be
* no naming collisions between different components ' parameter names . */
public Set < String > getParameterNames ( Set < String > allParameterNames ) { } } | Set < String > names = new HashSet < String > ( ) ; for ( String propertyName : allParameterNames ) { int index = propertyNameMatchIndex ( propertyName ) ; if ( index > 0 ) { names . add ( propertyName . substring ( index ) ) ; } } return names ; |
public class ApplicationGatewaysInner { /** * Gets the backend health of the specified application gateway in a resource group .
* @ param resourceGroupName The name of the resource group .
* @ param applicationGatewayName The name of the application gateway .
* @ param expand Expands BackendAddressPool and BackendHttpSettings referenced in backend health .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ApplicationGatewayBackendHealthInner object */
public Observable < ApplicationGatewayBackendHealthInner > beginBackendHealthAsync ( String resourceGroupName , String applicationGatewayName , String expand ) { } } | return beginBackendHealthWithServiceResponseAsync ( resourceGroupName , applicationGatewayName , expand ) . map ( new Func1 < ServiceResponse < ApplicationGatewayBackendHealthInner > , ApplicationGatewayBackendHealthInner > ( ) { @ Override public ApplicationGatewayBackendHealthInner call ( ServiceResponse < ApplicationGatewayBackendHealthInner > response ) { return response . body ( ) ; } } ) ; |
public class ReferenceContextImpl { /** * Merge resource references . Each array in < tt > totalResRefs < / tt > contains
* resource references from the input components categorized by resource
* reference name . Each array has a length equal to the number of input
* components , and the entry in the array represents the resource reference
* with a given name contributed by that component . If the component does
* not have a reference by that name , the entry will be < tt > null < / tt > .
* @ param masterCompNSConfig the output component configuration
* @ param compNSConfigs the input component configurations
* @ param totalResRefs mapping of resource reference name to array of
* resources indexed by component index
* @ return < tt > true < / tt > if the merge was successful , or < tt > false < / tt > if
* conflicts were reported */
private static boolean mergeResRefs ( ComponentNameSpaceConfiguration masterCompNSConfig , List < ComponentNameSpaceConfiguration > compNSConfigs , Map < String , ResourceRefConfig [ ] > totalResRefs ) { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . entry ( tc , "mergeResRefs" ) ; ResourceRefConfigList resRefList = InternalInjectionEngineAccessor . getInstance ( ) . createResourceRefConfigList ( ) ; masterCompNSConfig . setResourceRefConfigList ( resRefList ) ; List < ResourceRefConfig . MergeConflict > conflicts = new ArrayList < ResourceRefConfig . MergeConflict > ( ) ; for ( Map . Entry < String , ResourceRefConfig [ ] > entry : totalResRefs . entrySet ( ) ) { ResourceRefConfig mergedResRef = resRefList . findOrAddByName ( entry . getKey ( ) ) ; mergedResRef . mergeBindingsAndExtensions ( entry . getValue ( ) , conflicts ) ; } boolean success = conflicts . isEmpty ( ) ; if ( ! success ) { for ( ResourceRefConfig . MergeConflict conflict : conflicts ) { Tr . error ( tc , "CONFLICTING_REFERENCES_CWNEN0062E" , compNSConfigs . get ( conflict . getIndex1 ( ) ) . getDisplayName ( ) , compNSConfigs . get ( conflict . getIndex2 ( ) ) . getDisplayName ( ) , masterCompNSConfig . getModuleName ( ) , masterCompNSConfig . getApplicationName ( ) , conflict . getAttributeName ( ) , conflict . getResourceRefConfig ( ) . getName ( ) , conflict . getValue1 ( ) , conflict . getValue2 ( ) ) ; } } if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . exit ( tc , "mergeResRefs: " + success ) ; return success ; |
public class Skill { /** * Replies the caller of the capacity functions .
* < p > The replied value has a meaning inside the skills ' functions that
* are implemented the capacities ' functions .
* @ return the caller , or { @ code null } if the caller is unknown ( assuming that the caller is the agent itself ) .
* @ since 0.7 */
@ SuppressWarnings ( "static-method" ) @ Pure @ Inline ( value = "$1.getCaller()" , imported = Capacities . class , constantExpression = true ) protected AgentTrait getCaller ( ) { } } | return Capacities . getCaller ( ) ; |
public class GetMethodResponseRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetMethodResponseRequest getMethodResponseRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getMethodResponseRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getMethodResponseRequest . getRestApiId ( ) , RESTAPIID_BINDING ) ; protocolMarshaller . marshall ( getMethodResponseRequest . getResourceId ( ) , RESOURCEID_BINDING ) ; protocolMarshaller . marshall ( getMethodResponseRequest . getHttpMethod ( ) , HTTPMETHOD_BINDING ) ; protocolMarshaller . marshall ( getMethodResponseRequest . getStatusCode ( ) , STATUSCODE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class PolicyInfo { /** * Sets the destination path on which this policy has to be applied */
public void addDestPath ( String in , Properties repl ) throws IOException { } } | Path dPath = new Path ( in ) ; if ( ! dPath . isAbsolute ( ) || ! dPath . toUri ( ) . isAbsolute ( ) ) { throw new IOException ( "Path " + in + " is not absolute." ) ; } PathInfo pinfo = new PathInfo ( dPath , repl ) ; if ( this . destPath == null ) { this . destPath = new ArrayList < PathInfo > ( ) ; } this . destPath . add ( pinfo ) ; |
public class ScopeEcmascriptService { /** * Queries for the given runtime ID
* @ param runtimeID The runtime id to query for
* @ return { @ link Runtime } object if found , < code > null < / code > otherwise */
private Runtime getRuntime ( int runtimeID ) { } } | ListRuntimesArg . Builder builder = ListRuntimesArg . newBuilder ( ) ; builder . addRuntimeIDList ( runtimeID ) ; builder . setCreate ( true ) ; Response response = executeMessage ( EcmascriptMessage . LIST_RUNTIMES , builder ) ; RuntimeList . Builder runtimeListBuilder = RuntimeList . newBuilder ( ) ; buildPayload ( response , runtimeListBuilder ) ; List < Runtime > runtimes = runtimeListBuilder . build ( ) . getRuntimeListList ( ) ; return ( runtimes . isEmpty ( ) ) ? null : runtimes . get ( 0 ) ; |
public class CmsImageScaler { /** * Calculate the width and height of a source image if scaled inside the given box . < p >
* @ param sourceWidth the width of the source image
* @ param sourceHeight the height of the source image
* @ param boxWidth the width of the target box
* @ param boxHeight the height of the target box
* @ return the width [ 0 ] and height [ 1 ] of the source image if scaled inside the given box */
public static int [ ] calculateDimension ( int sourceWidth , int sourceHeight , int boxWidth , int boxHeight ) { } } | int [ ] result = new int [ 2 ] ; if ( ( sourceWidth <= boxWidth ) && ( sourceHeight <= boxHeight ) ) { result [ 0 ] = sourceWidth ; result [ 1 ] = sourceHeight ; } else { float scaleWidth = ( float ) boxWidth / ( float ) sourceWidth ; float scaleHeight = ( float ) boxHeight / ( float ) sourceHeight ; float scale = Math . min ( scaleHeight , scaleWidth ) ; result [ 0 ] = Math . round ( sourceWidth * scale ) ; result [ 1 ] = Math . round ( sourceHeight * scale ) ; } return result ; |
public class AbstractInstrumentation { /** * Add package configuration information . */
protected void addPackageInfo ( PackageInfo packageInfo ) { } } | if ( packageInfo != null ) { packageInfoMap . put ( packageInfo . getInternalPackageName ( ) , packageInfo ) ; } |
public class AndroidPoiPersistenceManager { /** * DB open created a new file , so let ' s create its tables . */
private void createTables ( ) { } } | this . db . execSQL ( DbConstants . DROP_METADATA_STATEMENT ) ; this . db . execSQL ( DbConstants . DROP_INDEX_STATEMENT ) ; this . db . execSQL ( DbConstants . DROP_CATEGORY_MAP_STATEMENT ) ; this . db . execSQL ( DbConstants . DROP_DATA_STATEMENT ) ; this . db . execSQL ( DbConstants . DROP_CATEGORIES_STATEMENT ) ; this . db . execSQL ( DbConstants . CREATE_CATEGORIES_STATEMENT ) ; this . db . execSQL ( DbConstants . CREATE_DATA_STATEMENT ) ; this . db . execSQL ( DbConstants . CREATE_CATEGORY_MAP_STATEMENT ) ; this . db . execSQL ( DbConstants . CREATE_INDEX_STATEMENT ) ; this . db . execSQL ( DbConstants . CREATE_METADATA_STATEMENT ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.