signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class NonBlockingClient { /** * Unsubscribes from a destination . This is equivalent to calling : * < code > unsubscribe ( topicPattern , null , ttl ) < / code > * @ param topicPattern a topic pattern that identifies the destination to unsubscribe from . This must match * one of the topic patterns previously subscribed to using the * { @ link NonBlockingClient # subscribe ( String , SubscribeOptions , DestinationListener , CompletionListener , Object ) } * method . * @ param ttl the new time - to - live value to assign to the destination . Currently the only supported value for this * parameter is zero . * @ param listener a listener that is notified when the unsubscribe operation has completed . Invocation of this * listener is deferred until any messages , buffered pending delivery to a < code > DestiantionListener < / code > * registered with the client , have been delivered . If a value of < code > null < / code > is supplied for this * parameter then no notification will be generated . * @ param context a context object that is passed into the listener . This can be used within the listener code to * identify the specific instance of the stop method relating to the listener invocation . * @ param < T > the type of the context , used to propagate an arbitrary object between method calls on an * instance of this object , and the various listeners that are used to provide notification * of client related events . * @ return the instance of < code > NonBlockingClient < / code > that the unsubscribe method was invoked upon . This is to * allow invocations of the unsubscribe method to be chained . * @ throws UnsubscribedException if an attempt is made to unsubscribe from a destination that the client is not * currently subscribed to . * @ throws StoppedException if the client is in stopped or stopping state when this method is invoked . * @ throws IllegalArgumentException if an invalid value is specified for one of the arguments . * @ see NonBlockingClient # unsubscribe ( String , String , int , CompletionListener , Object ) */ public < T > NonBlockingClient unsubscribe ( String topicPattern , int ttl , CompletionListener < T > listener , T context ) throws UnsubscribedException , StoppedException , IllegalArgumentException { } }
return unsubscribe ( topicPattern , null , ttl , listener , context ) ;
public class CaptureInfo { /** * returns all the implicit params that come after explicit params in a constructor . */ public Iterable < VariableElement > getImplicitPostfixParams ( TypeElement type ) { } }
if ( ElementUtil . isEnum ( type ) ) { return implicitEnumParams ; } return Collections . emptyList ( ) ;
public class Transmitter { /** * Releases resources held with the request or response of { @ code exchange } . This should be called * when the request completes normally or when it fails due to an exception , in which case { @ code * e } should be non - null . * < p > If the exchange was canceled or timed out , this will wrap { @ code e } in an exception that * provides that additional context . Otherwise { @ code e } is returned as - is . */ @ Nullable IOException exchangeMessageDone ( Exchange exchange , boolean requestDone , boolean responseDone , @ Nullable IOException e ) { } }
boolean exchangeDone = false ; synchronized ( connectionPool ) { if ( exchange != this . exchange ) { return e ; // This exchange was detached violently ! } boolean changed = false ; if ( requestDone ) { if ( ! exchangeRequestDone ) changed = true ; this . exchangeRequestDone = true ; } if ( responseDone ) { if ( ! exchangeResponseDone ) changed = true ; this . exchangeResponseDone = true ; } if ( exchangeRequestDone && exchangeResponseDone && changed ) { exchangeDone = true ; this . exchange . connection ( ) . successCount ++ ; this . exchange = null ; } } if ( exchangeDone ) { e = maybeReleaseConnection ( e , false ) ; } return e ;
public class EnterpriseBeanProxyMethodHandler { /** * Looks up the EJB in the container and executes the method on it * @ param self the proxy instance . * @ param method the overridden method declared in the super class or * interface . * @ param proceed the forwarder method for invoking the overridden method . It * is null if the overridden method is abstract or declared in the * interface . * @ param args an array of objects containing the values of the arguments * passed in the method invocation on the proxy instance . If a * parameter type is a primitive type , the type of the array * element is a wrapper class . * @ return the resulting value of the method invocation . * @ throws Throwable if the method invocation fails . */ @ Override public Object invoke ( Object self , Method method , Method proceed , Object [ ] args ) throws Throwable { } }
if ( "destroy" . equals ( method . getName ( ) ) && Marker . isMarker ( 0 , method , args ) ) { if ( bean . getEjbDescriptor ( ) . isStateful ( ) ) { if ( ! reference . isRemoved ( ) ) { reference . remove ( ) ; } } return null ; } if ( ! bean . isClientCanCallRemoveMethods ( ) && isRemoveMethod ( method ) ) { throw BeanLogger . LOG . invalidRemoveMethodInvocation ( method ) ; } Class < ? > businessInterface = getBusinessInterface ( method ) ; if ( reference . isRemoved ( ) && isToStringMethod ( method ) ) { return businessInterface . getName ( ) + " [REMOVED]" ; } Object proxiedInstance = reference . getBusinessObject ( businessInterface ) ; if ( ! Modifier . isPublic ( method . getModifiers ( ) ) ) { throw new EJBException ( "Not a business method " + method . toString ( ) + ". Do not call non-public methods on EJB's." ) ; } Object returnValue = Reflections . invokeAndUnwrap ( proxiedInstance , method , args ) ; BeanLogger . LOG . callProxiedMethod ( method , proxiedInstance , args , returnValue ) ; return returnValue ;
public class PaxDate { /** * Returns a copy of this { @ code PaxDate } with the specified period in years added . * This method adds the specified amount to the years field in two steps : * < ol > * < li > Add the input years to the year field < / li > * < li > If necessary , shift the index to account for the inserted / deleted leap - month . < / li > * < / ol > * In the Pax Calendar , the month of December is 13 in non - leap - years , and 14 in leap years . * Shifting the index of the month thus means the month would still be the same . * In the case of moving from the inserted leap - month ( destination year is non - leap ) , the month index is retained . * This has the effect of retaining the same day - of - year . * This instance is immutable and unaffected by this method call . * @ param yearsToAdd the years to add , may be negative * @ return a { @ code PaxDate } based on this date with the years added , not null * @ throws DateTimeException if the result exceeds the supported date range */ @ Override PaxDate plusYears ( long yearsToAdd ) { } }
if ( yearsToAdd == 0 ) { return this ; } int newYear = YEAR . checkValidIntValue ( getProlepticYear ( ) + yearsToAdd ) ; // Retain actual month ( not index ) in the case where a leap month is to be inserted . if ( month == MONTHS_IN_YEAR && ! isLeapYear ( ) && PaxChronology . INSTANCE . isLeapYear ( newYear ) ) { return of ( newYear , MONTHS_IN_YEAR + 1 , getDayOfMonth ( ) ) ; } // Otherwise , one of the following is true : // 1 - Before the leap month , nothing to do ( most common ) // 2 - Both source and destination in leap - month , nothing to do // 3 - Both source and destination after leap month in leap year , nothing to do // 4 - Source in leap month , but destination year not leap . Retain month index , preserving day - of - year . // 5 - Source after leap month , but destination year not leap . Move month index back . return resolvePreviousValid ( newYear , month , day ) ;
public class LNDImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . LND__LND_FLGS : return LND_FLGS_EDEFAULT == null ? lndFlgs != null : ! LND_FLGS_EDEFAULT . equals ( lndFlgs ) ; case AfplibPackage . LND__IPOS : return IPOS_EDEFAULT == null ? iPos != null : ! IPOS_EDEFAULT . equals ( iPos ) ; case AfplibPackage . LND__BPOS : return BPOS_EDEFAULT == null ? bPos != null : ! BPOS_EDEFAULT . equals ( bPos ) ; case AfplibPackage . LND__TXT_ORENT : return TXT_ORENT_EDEFAULT == null ? txtOrent != null : ! TXT_ORENT_EDEFAULT . equals ( txtOrent ) ; case AfplibPackage . LND__FNT_LID : return FNT_LID_EDEFAULT == null ? fntLID != null : ! FNT_LID_EDEFAULT . equals ( fntLID ) ; case AfplibPackage . LND__CHNL_CDE : return CHNL_CDE_EDEFAULT == null ? chnlCde != null : ! CHNL_CDE_EDEFAULT . equals ( chnlCde ) ; case AfplibPackage . LND__NLN_DSKP : return NLN_DSKP_EDEFAULT == null ? nlnDskp != null : ! NLN_DSKP_EDEFAULT . equals ( nlnDskp ) ; case AfplibPackage . LND__NLN_DSP : return NLN_DSP_EDEFAULT == null ? nlnDsp != null : ! NLN_DSP_EDEFAULT . equals ( nlnDsp ) ; case AfplibPackage . LND__NLN_DREU : return NLN_DREU_EDEFAULT == null ? nlnDreu != null : ! NLN_DREU_EDEFAULT . equals ( nlnDreu ) ; case AfplibPackage . LND__SUP_NAME : return SUP_NAME_EDEFAULT == null ? supName != null : ! SUP_NAME_EDEFAULT . equals ( supName ) ; case AfplibPackage . LND__SO_LID : return SO_LID_EDEFAULT == null ? soLid != null : ! SO_LID_EDEFAULT . equals ( soLid ) ; case AfplibPackage . LND__DATA_STRT : return DATA_STRT_EDEFAULT == null ? dataStrt != null : ! DATA_STRT_EDEFAULT . equals ( dataStrt ) ; case AfplibPackage . LND__DATA_LGTH : return DATA_LGTH_EDEFAULT == null ? dataLgth != null : ! DATA_LGTH_EDEFAULT . equals ( dataLgth ) ; case AfplibPackage . LND__TXT_COLOR : return TXT_COLOR_EDEFAULT == null ? txtColor != null : ! TXT_COLOR_EDEFAULT . equals ( txtColor ) ; case AfplibPackage . LND__NLN_DCCP : return NLN_DCCP_EDEFAULT == null ? nlnDccp != null : ! NLN_DCCP_EDEFAULT . equals ( nlnDccp ) ; case AfplibPackage . LND__SUBPG_ID : return SUBPG_ID_EDEFAULT == null ? subpgID != null : ! SUBPG_ID_EDEFAULT . equals ( subpgID ) ; case AfplibPackage . LND__CCPID : return CCPID_EDEFAULT == null ? ccpid != null : ! CCPID_EDEFAULT . equals ( ccpid ) ; case AfplibPackage . LND__TRIPLETS : return triplets != null && ! triplets . isEmpty ( ) ; } return super . eIsSet ( featureID ) ;
public class SpaceVerifier { /** * ( non - Javadoc ) * @ see org . springframework . batch . core . StepExecutionListener # afterStep ( org . * springframework . batch . core . StepExecution ) */ @ Override public ExitStatus afterStep ( final StepExecution stepExecution ) { } }
if ( getErrors ( ) . size ( ) == 0 ) { List < String > verifyErrors = verifySpace ( verifier ) ; for ( String error : verifyErrors ) { addError ( error ) ; } } ExitStatus status = stepExecution . getExitStatus ( ) ; List < String > errors = getErrors ( ) ; if ( errors . size ( ) > 0 ) { status = status . and ( ExitStatus . FAILED ) ; for ( String error : errors ) { status = status . addExitDescription ( error ) ; } failExecution ( ) ; log . error ( "space verification step finished: step_execution_id={} " + "job_execution_id={} spaceId={} status=\"{}\"" , stepExecution . getId ( ) , stepExecution . getJobExecutionId ( ) , spaceId , status ) ; } else { status = status . and ( ExitStatus . COMPLETED ) ; log . info ( "space verification step finished: step_execution_id={} " + "job_execution_id={} spaceId={} exit_status={} " , stepExecution . getId ( ) , stepExecution . getJobExecutionId ( ) , spaceId , status ) ; } return status ;
public class GrowingSparseMatrix { /** * { @ inheritDoc } */ public double get ( int row , int col ) { } }
checkIndices ( row , col ) ; SparseDoubleVector sv = rowToColumns . get ( row ) ; return ( sv == null ) ? 0 : sv . get ( col ) ;
public class Maps { /** * Creates a map that maps consecutive integer values to the * corresponding elements in the given array . * @ param < T > The value type * @ param elements The elements * @ return The map */ @ SafeVarargs public static < T > Map < Integer , T > fromElements ( T ... elements ) { } }
return fromIterable ( Arrays . asList ( elements ) ) ;
public class ChannelImpl { /** * Cleans up the channel name by applying the following : 1 ) trim any * whitespace 2 ) convert to upper case for easy string comparisions 3 ) strip * of the masquerade prefix if it exists and mark the channel as * masquerading 4 ) strip the zombie suffix and mark it as being a zombie . * @ param name * @ return */ private String cleanChannelName ( final String name ) { } }
String cleanedName = name . trim ( ) . toUpperCase ( ) ; // If if the channel is the console this . _isConsole = false ; if ( name . compareToIgnoreCase ( "Console/dsp" ) == 0 ) // $ NON - NLS - 1 $ { this . _isConsole = true ; } // Check if the channel is in an action boolean wasInAction = this . _isInAction ; this . _isInAction = false ; for ( final String prefix : ChannelImpl . _actions ) { if ( cleanedName . startsWith ( prefix ) ) { this . _isInAction = true ; this . _actionPrefix = cleanedName . substring ( 0 , prefix . length ( ) - 1 ) ; cleanedName = cleanedName . substring ( prefix . length ( ) ) ; break ; } } if ( wasInAction != this . _isInAction ) { logger . debug ( "Channel " + this + " : inaction status changed from " + wasInAction + " to " + this . _isInAction ) ; } // Channels can be marked as in a zombie state // so we need to strip of the zombie suffix and just mark the channel // as a // zombie . this . _isZombie = false ; if ( cleanedName . contains ( ChannelImpl . ZOMBIE ) ) { this . _isZombie = true ; cleanedName = cleanedName . substring ( 0 , cleanedName . indexOf ( ChannelImpl . ZOMBIE ) ) ; } // Channels can be marked as in a MASQ state // This happens during transfers ( and other times ) when the channel is // replaced // by a new channel in the call . The old channel is renamed with the // word // < MASQ > added as a suffix . this . _isMasqueraded = false ; if ( cleanedName . contains ( ChannelImpl . MASQ ) ) { this . _isMasqueraded = true ; cleanedName = cleanedName . substring ( 0 , cleanedName . indexOf ( ChannelImpl . MASQ ) ) ; } return cleanedName ;
public class AbstractBigtableTable { /** * { @ inheritDoc } */ @ Override public void delete ( List < Delete > deletes ) throws IOException { } }
LOG . trace ( "delete(List<Delete>)" ) ; try ( Scope scope = TRACER . spanBuilder ( "BigtableTable.delete" ) . startScopedSpan ( ) ) { getBatchExecutor ( ) . batch ( deletes ) ; }
public class SeaGlassSliderUI { /** * Calculates the pad for the label at the specified index . * @ param index * index of the label to calculate pad for . * @ return padding required to keep label visible . */ private int getPadForLabel ( int i ) { } }
Dictionary dictionary = slider . getLabelTable ( ) ; int pad = 0 ; Object o = dictionary . get ( i ) ; if ( o != null ) { Component c = ( Component ) o ; int centerX = xPositionForValue ( i ) ; int cHalfWidth = c . getPreferredSize ( ) . width / 2 ; if ( centerX - cHalfWidth < insetCache . left ) { pad = Math . max ( pad , insetCache . left - ( centerX - cHalfWidth ) ) ; } if ( centerX + cHalfWidth > slider . getWidth ( ) - insetCache . right ) { pad = Math . max ( pad , ( centerX + cHalfWidth ) - ( slider . getWidth ( ) - insetCache . right ) ) ; } } return pad ;
public class JBaseScreen { /** * Initialize this class . * @ param parent Typically , you pass the BaseApplet as the parent . * @ param record and the record or GridTableModel as the parent . */ public void init ( Object parent , Object record ) { } }
super . init ( parent , record ) ; if ( record instanceof FieldList ) this . addFieldList ( ( FieldList ) record , 0 ) ; else this . addFieldList ( this . buildFieldList ( ) , 0 ) ; if ( this . getFieldList ( ) != null ) { boolean bAddCache = true ; if ( this instanceof JScreen ) bAddCache = false ; this . getBaseApplet ( ) . linkNewRemoteTable ( this . getFieldList ( ) , bAddCache ) ; if ( this . getFieldList ( ) . getTable ( ) != null ) { if ( this . getFieldList ( ) . getEditMode ( ) == Constants . EDIT_NONE ) { try { this . getFieldList ( ) . getTable ( ) . addNew ( ) ; } catch ( DBException ex ) { ex . printStackTrace ( ) ; // Never . } } } }
public class QueryParser { /** * src / riemann / Query . g : 57:1 : lesser : field ( WS ) * LESSER ( WS ) * value ; */ public final QueryParser . lesser_return lesser ( ) throws RecognitionException { } }
QueryParser . lesser_return retval = new QueryParser . lesser_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; Token WS46 = null ; Token LESSER47 = null ; Token WS48 = null ; QueryParser . field_return field45 = null ; QueryParser . value_return value49 = null ; CommonTree WS46_tree = null ; CommonTree LESSER47_tree = null ; CommonTree WS48_tree = null ; try { // src / riemann / Query . g : 57:8 : ( field ( WS ) * LESSER ( WS ) * value ) // src / riemann / Query . g : 57:10 : field ( WS ) * LESSER ( WS ) * value { root_0 = ( CommonTree ) adaptor . nil ( ) ; pushFollow ( FOLLOW_field_in_lesser394 ) ; field45 = field ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , field45 . getTree ( ) ) ; // src / riemann / Query . g : 57:16 : ( WS ) * loop17 : do { int alt17 = 2 ; int LA17_0 = input . LA ( 1 ) ; if ( ( LA17_0 == WS ) ) { alt17 = 1 ; } switch ( alt17 ) { case 1 : // src / riemann / Query . g : 57:16 : WS { WS46 = ( Token ) match ( input , WS , FOLLOW_WS_in_lesser396 ) ; WS46_tree = ( CommonTree ) adaptor . create ( WS46 ) ; adaptor . addChild ( root_0 , WS46_tree ) ; } break ; default : break loop17 ; } } while ( true ) ; LESSER47 = ( Token ) match ( input , LESSER , FOLLOW_LESSER_in_lesser399 ) ; LESSER47_tree = ( CommonTree ) adaptor . create ( LESSER47 ) ; root_0 = ( CommonTree ) adaptor . becomeRoot ( LESSER47_tree , root_0 ) ; // src / riemann / Query . g : 57:28 : ( WS ) * loop18 : do { int alt18 = 2 ; int LA18_0 = input . LA ( 1 ) ; if ( ( LA18_0 == WS ) ) { alt18 = 1 ; } switch ( alt18 ) { case 1 : // src / riemann / Query . g : 57:28 : WS { WS48 = ( Token ) match ( input , WS , FOLLOW_WS_in_lesser402 ) ; WS48_tree = ( CommonTree ) adaptor . create ( WS48 ) ; adaptor . addChild ( root_0 , WS48_tree ) ; } break ; default : break loop18 ; } } while ( true ) ; pushFollow ( FOLLOW_value_in_lesser405 ) ; value49 = value ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , value49 . getTree ( ) ) ; } retval . stop = input . LT ( - 1 ) ; retval . tree = ( CommonTree ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( CommonTree ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { } return retval ;
public class GenericSignatureParser { /** * POST : symbol = the next symbol AFTER the identifier . */ void scanIdentifier ( ) { } }
if ( ! eof ) { StringBuilder identBuf = new StringBuilder ( 32 ) ; if ( ! isStopSymbol ( symbol ) ) { identBuf . append ( symbol ) ; do { char ch = buffer [ pos ] ; if ( ( ch >= 'a' ) && ( ch <= 'z' ) || ( ch >= 'A' ) && ( ch <= 'Z' ) || ! isStopSymbol ( ch ) ) { identBuf . append ( ch ) ; pos ++ ; } else { identifier = identBuf . toString ( ) ; scanSymbol ( ) ; return ; } } while ( pos != buffer . length ) ; identifier = identBuf . toString ( ) ; symbol = 0 ; eof = true ; } else { // Ident starts with incorrect char . symbol = 0 ; eof = true ; throw new GenericSignatureFormatError ( ) ; } } else { throw new GenericSignatureFormatError ( ) ; }
public class JavaURLContext { /** * This operation is not supported in the java : read - only namespace . * @ throws { @ link OperationNotSupportedException } */ @ Override public NamingEnumeration < Binding > listBindings ( String s ) throws NamingException { } }
return listBindings ( newCompositeName ( s ) ) ;
public class PredictionsImpl { /** * Predict an image url without saving the result . * @ param projectId The project id * @ param predictImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the ImagePrediction object if successful . */ public ImagePrediction predictImageUrlWithNoStore ( UUID projectId , PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter ) { } }
return predictImageUrlWithNoStoreWithServiceResponseAsync ( projectId , predictImageUrlWithNoStoreOptionalParameter ) . toBlocking ( ) . single ( ) . body ( ) ;
public class InputOutput { /** * Prints the given { @ code object } to { @ link System # out System . out } . Useful to log partial expressions to trap * errors , e . g . the following is possible : < code > 1 + print ( 2 ) + 3 < / code > * @ param o * the to - be - printed object * @ return the printed object . */ public static < T > T print ( T o ) { } }
System . out . print ( o ) ; return o ;
public class FunctionInitializer { /** * This method is designed to be called when using the { @ link FunctionInitializer } from a static Application main method . * @ param args The arguments passed to main * @ param supplier The function that executes this function * @ throws IOException If an error occurs */ public void run ( String [ ] args , Function < ParseContext , ? > supplier ) throws IOException { } }
ApplicationContext applicationContext = this . applicationContext ; this . functionExitHandler = applicationContext . findBean ( FunctionExitHandler . class ) . orElse ( this . functionExitHandler ) ; ParseContext context = new ParseContext ( args ) ; try { Object result = supplier . apply ( context ) ; if ( result != null ) { LocalFunctionRegistry bean = applicationContext . getBean ( LocalFunctionRegistry . class ) ; StreamFunctionExecutor . encode ( applicationContext . getEnvironment ( ) , bean , result . getClass ( ) , result , System . out ) ; functionExitHandler . exitWithSuccess ( ) ; } } catch ( Exception e ) { functionExitHandler . exitWithError ( e , context . debug ) ; }
public class MetricAlarm { /** * The actions to execute when this alarm transitions to the < code > INSUFFICIENT _ DATA < / code > state from any other * state . Each action is specified as an Amazon Resource Name ( ARN ) . * @ param insufficientDataActions * The actions to execute when this alarm transitions to the < code > INSUFFICIENT _ DATA < / code > state from any * other state . Each action is specified as an Amazon Resource Name ( ARN ) . */ public void setInsufficientDataActions ( java . util . Collection < String > insufficientDataActions ) { } }
if ( insufficientDataActions == null ) { this . insufficientDataActions = null ; return ; } this . insufficientDataActions = new com . amazonaws . internal . SdkInternalList < String > ( insufficientDataActions ) ;
public class ProductKDE { /** * Performs the main work for performing a density query . * @ param x the query vector * @ param validIndecies the empty set that will be altered to contain the * indices of vectors that had a non zero contribution to the density * @ param logProd an empty sparce vector that will be modified to contain the log of the product of the * kernels for each data point . Some indices that have zero contribution to the density will have non * zero values . < tt > validIndecies < / tt > should be used to access the correct indices . * @ return The log product of the bandwidths that normalizes the values stored in the < tt > logProd < / tt > vector . */ private double queryWork ( Vec x , Set < Integer > validIndecies , SparseVector logProd ) { } }
if ( originalVecs == null ) throw new UntrainedModelException ( "Model has not yet been created, queries can not be perfomed" ) ; double logH = 0 ; for ( int i = 0 ; i < sortedDimVals . length ; i ++ ) { double [ ] X = sortedDimVals [ i ] ; double h = bandwidth [ i ] ; logH += log ( h ) ; double xi = x . get ( i ) ; // Only values within a certain range will have an effect on the result , so we will skip to that range ! int from = Arrays . binarySearch ( X , xi - h * k . cutOff ( ) ) ; int to = Arrays . binarySearch ( X , xi + h * k . cutOff ( ) ) ; // Mostly likely the exact value of x is not in the list , so it retursn the inseration points from = from < 0 ? - from - 1 : from ; to = to < 0 ? - to - 1 : to ; Set < Integer > subIndecies = new IntSet ( ) ; for ( int j = max ( 0 , from ) ; j < min ( X . length , to + 1 ) ; j ++ ) { int trueIndex = sortedIndexVals [ i ] [ j ] ; if ( i == 0 ) { validIndecies . add ( trueIndex ) ; logProd . set ( trueIndex , log ( k . k ( ( xi - X [ j ] ) / h ) ) ) ; } else if ( validIndecies . contains ( trueIndex ) ) { logProd . increment ( trueIndex , log ( k . k ( ( xi - X [ j ] ) / h ) ) ) ; subIndecies . add ( trueIndex ) ; } } if ( i > 0 ) { validIndecies . retainAll ( subIndecies ) ; if ( validIndecies . isEmpty ( ) ) break ; } } return logH ;
public class TinafwExpectedConditions { /** * An expectation for checking that at least one of the elements matching the locator * is visible . * @ param locator used to find the elements * @ return the first visible WebElement that is found */ public static ExpectedCondition < WebElement > visibilityOfOneOfElementsLocatedBy ( final By locator ) { } }
return new ExpectedCondition < WebElement > ( ) { @ Override public WebElement apply ( WebDriver driver ) { for ( WebElement element : driver . findElements ( locator ) ) { if ( element . isDisplayed ( ) ) { return element ; } } return null ; } @ Override public String toString ( ) { return "visibility of one of the elements located by " + locator ; } } ;
public class BlockingInputStream { /** * Closes the stream . Writes to a closed stream will fail , reads will successfully read the bytes that are already * in the buffer and then return - 1 ( EOF ) * @ throws IOException */ public void close ( ) throws IOException { } }
lock . lock ( ) ; try { if ( closed ) return ; closed = true ; not_empty . signalAll ( ) ; not_full . signalAll ( ) ; } finally { lock . unlock ( ) ; }
public class DeactivateCustomFields { /** * Runs the example . * @ param adManagerServices the services factory . * @ param session the session . * @ param customFieldId the ID of the custom field to deactivate . * @ throws ApiException if the API request failed with one or more service errors . * @ throws RemoteException if the API request failed due to other errors . */ public static void runExample ( AdManagerServices adManagerServices , AdManagerSession session , long customFieldId ) throws RemoteException { } }
// Get the CustomFieldService . CustomFieldServiceInterface customFieldService = adManagerServices . get ( session , CustomFieldServiceInterface . class ) ; // Create a statement to select a custom field . StatementBuilder statementBuilder = new StatementBuilder ( ) . where ( "WHERE id = :id" ) . orderBy ( "id ASC" ) . limit ( StatementBuilder . SUGGESTED_PAGE_LIMIT ) . withBindVariableValue ( "id" , customFieldId ) ; // Default for total result set size . int totalResultSetSize = 0 ; do { // Get custom fields by statement . CustomFieldPage page = customFieldService . getCustomFieldsByStatement ( statementBuilder . toStatement ( ) ) ; if ( page . getResults ( ) != null ) { totalResultSetSize = page . getTotalResultSetSize ( ) ; int i = page . getStartIndex ( ) ; for ( CustomField customField : page . getResults ( ) ) { System . out . printf ( "%d) Custom field with ID %d will be deactivated.%n" , i ++ , customField . getId ( ) ) ; } } statementBuilder . increaseOffsetBy ( StatementBuilder . SUGGESTED_PAGE_LIMIT ) ; } while ( statementBuilder . getOffset ( ) < totalResultSetSize ) ; System . out . printf ( "Number of custom fields to be deactivated: %d%n" , totalResultSetSize ) ; if ( totalResultSetSize > 0 ) { // Remove limit and offset from statement . statementBuilder . removeLimitAndOffset ( ) ; // Create action . com . google . api . ads . admanager . axis . v201808 . DeactivateCustomFields action = new com . google . api . ads . admanager . axis . v201808 . DeactivateCustomFields ( ) ; // Perform action . UpdateResult result = customFieldService . performCustomFieldAction ( action , statementBuilder . toStatement ( ) ) ; if ( result != null && result . getNumChanges ( ) > 0 ) { System . out . printf ( "Number of custom fields deactivated: %d%n" , result . getNumChanges ( ) ) ; } else { System . out . println ( "No custom fields were deactivated." ) ; } }
public class MarkedSection { /** * Gets the title of this MarkedSection . * @ returna MarkObject with a Paragraph containing the title of a Section * @ sinceiText 2.0.8 */ public MarkedObject getTitle ( ) { } }
Paragraph result = Section . constructTitle ( ( Paragraph ) title . element , ( ( Section ) element ) . numbers , ( ( Section ) element ) . numberDepth , ( ( Section ) element ) . numberStyle ) ; MarkedObject mo = new MarkedObject ( result ) ; mo . markupAttributes = title . markupAttributes ; return mo ;
public class RecordCacheHandler { /** * Cache the target field using the current record . */ public boolean isCached ( ) { } }
try { Record record = this . getOwner ( ) ; Object objKey = record . getHandle ( DBConstants . OBJECT_ID_HANDLE ) ; return ( m_hsCache . contains ( objKey ) ) ; // True if cache value exists } catch ( DBException ex ) { ex . printStackTrace ( ) ; } return false ; // Never
public class DataStoreUtil { /** * Make a new storage , to associate the given ids with an object of class * dataclass . * @ param ids DBIDs to store data for * @ param hints Hints for the storage manager * @ return new data store */ public static WritableIntegerDataStore makeIntegerStorage ( DBIDs ids , int hints ) { } }
return DataStoreFactory . FACTORY . makeIntegerStorage ( ids , hints ) ;
public class Container { /** * Computes the bitwise AND of this container with another ( intersection ) . This container as well * as the provided container are left unaffected . * @ param x other container * @ return aggregated container */ public Container and ( Container x ) { } }
if ( x instanceof ArrayContainer ) { return and ( ( ArrayContainer ) x ) ; } else if ( x instanceof BitmapContainer ) { return and ( ( BitmapContainer ) x ) ; } return and ( ( RunContainer ) x ) ;
public class NavigationManager { /** * Starts the framework , rendering the { @ link View # defaultView ( ) } to the page . * @ param rootContainer The body widget of the page . Usually < code > RootLayoutPanel . get ( ) < / code > . */ public static void start ( Panel rootContainer ) { } }
manager . setRootContainer ( rootContainer ) ; History . addValueChangeHandler ( manager ) ; History . fireCurrentHistoryState ( ) ;
public class Option { /** * Add an icon to the option . * @ param iconType */ public void setIcon ( final IconType iconType ) { } }
if ( iconType != null ) attrMixin . setAttribute ( ICON , iconType . getCssName ( ) ) ; else attrMixin . removeAttribute ( ICON ) ;
public class UIComponent { /** * The visit tree method , visit tree walks over a subtree and processes * the callback object to perform some operation on the subtree * there are some details in the implementation which according to the spec have * to be in place : * a ) before calling the callback and traversing into the subtree pushComponentToEL * has to be called * b ) after the processing popComponentFromEL has to be performed to remove the component * from the el * The tree traversal optimizations are located in the visit context and can be replaced * via the VisitContextFactory in the faces - config factory section * @ param context the visit context which handles the processing details * @ param callback the callback to be performed * @ return false if the processing is not done true if we can shortcut * the visiting because we are done with everything * @ since 2.0 */ public boolean visitTree ( VisitContext context , VisitCallback callback ) { } }
try { pushComponentToEL ( context . getFacesContext ( ) , this ) ; if ( ! isVisitable ( context ) ) { return false ; } VisitResult res = context . invokeVisitCallback ( this , callback ) ; switch ( res ) { // we are done nothing has to be processed anymore case COMPLETE : return true ; case REJECT : return false ; // accept default : if ( getFacetCount ( ) > 0 ) { for ( UIComponent facet : getFacets ( ) . values ( ) ) { if ( facet . visitTree ( context , callback ) ) { return true ; } } } int childCount = getChildCount ( ) ; if ( childCount > 0 ) { for ( int i = 0 ; i < childCount ; i ++ ) { UIComponent child = getChildren ( ) . get ( i ) ; if ( child . visitTree ( context , callback ) ) { return true ; } } } return false ; } } finally { // all components must call popComponentFromEl after visiting is finished popComponentFromEL ( context . getFacesContext ( ) ) ; }
public class ArgusHttpClient { /** * / * The actual request call . Factored for test mocking . */ HttpResponse _doHttpRequest ( RequestType requestType , String url , String json ) throws IOException { } }
StringEntity entity = null ; if ( json != null ) { entity = new StringEntity ( json , StandardCharsets . UTF_8 . name ( ) ) ; entity . setContentEncoding ( StandardCharsets . UTF_8 . name ( ) ) ; entity . setContentType ( ContentType . APPLICATION_JSON . getMimeType ( ) ) ; } switch ( requestType ) { case POST : HttpPost post = new HttpPost ( url ) ; post . setEntity ( entity ) ; post . setHeader ( HttpHeaders . AUTHORIZATION , "Bearer " + accessToken ) ; return _httpClient . execute ( post , _httpContext ) ; case GET : HttpGet httpGet = new HttpGet ( url ) ; httpGet . setHeader ( HttpHeaders . AUTHORIZATION , "Bearer " + accessToken ) ; return _httpClient . execute ( httpGet , _httpContext ) ; case DELETE : HttpDelete httpDelete = new HttpDelete ( url ) ; httpDelete . setHeader ( HttpHeaders . AUTHORIZATION , "Bearer " + accessToken ) ; return _httpClient . execute ( httpDelete , _httpContext ) ; case PUT : HttpPut httpput = new HttpPut ( url ) ; httpput . setEntity ( entity ) ; httpput . setHeader ( HttpHeaders . AUTHORIZATION , "Bearer " + accessToken ) ; return _httpClient . execute ( httpput , _httpContext ) ; default : throw new IllegalArgumentException ( " Request Type " + requestType + " not a valid request type. " ) ; }
public class AbstractItem { /** * Use this method to persist the redelivered count for the item . * @ param redeliveredCount * @ throws SevereMessageStoreException */ public void persistRedeliveredCount ( int redeliveredCount ) throws SevereMessageStoreException { } }
Membership thisItemLink = _getMembership ( ) ; if ( null == thisItemLink ) { throw new NotInMessageStore ( ) ; } thisItemLink . persistRedeliveredCount ( redeliveredCount ) ;
public class GosuClassParser { public void parseDefinitions ( IGosuClass gsCls ) { } }
IGosuClassInternal gsClass = ( IGosuClassInternal ) gsCls ; getTokenizer ( ) . pushOffsetMarker ( this ) ; boolean bPushedScope = pushScopeIfNeeded ( gsClass ) ; gsClass . setCompilingDefinitions ( true ) ; GosuClassParseInfo parseInfo = gsClass . getParseInfo ( ) ; ClassStatement classStmt = parseInfo . getClassStatement ( ) ; setClassStatement ( classStmt ) ; clearParseTree ( gsClass ) ; ScriptPartId scriptPartId = new ScriptPartId ( gsClass , null ) ; getOwner ( ) . pushScriptPart ( scriptPartId ) ; GosuClassCompilingStack . pushCompilingType ( gsClass ) ; getOwner ( ) . _iReturnOk ++ ; if ( isDeprecated ( ( ModifierInfo ) gsCls . getModifierInfo ( ) ) ) { getOwner ( ) . pushIgnoreTypeDeprecation ( ) ; } try { try { if ( ! gsClass . isDefinitionsCompiled ( ) ) { // Don ' t need an isolated scope here because class members are all dynamic // and , therefore , don ' t have to be indexed wrt an isolated scope . getSymbolTable ( ) . pushScope ( ) ; try { // Reset the tokenizer to prepare for secon . . er third pass getTokenizer ( ) . reset ( ) ; if ( isTopLevelClass ( gsClass ) || TypeLord . isEvalProgram ( gsClass ) ) { getLocationsList ( ) . clear ( ) ; } else { removeInnerClassDelcarationsFromLocationsList ( gsClass ) ; } // Parse the whole class , including inner types // Note function definitions are parsed as no - op statements , but are // pushed onto the dynamic function symobl stack . // # # todo : do we really need to parse the header * again * ( maybe for annotations ? ) parseHeader ( gsClass , false , false , true ) ; if ( gsClass instanceof IGosuEnhancementInternal ) { parseClassStatementAsEnhancement ( gsClass ) ; } else { parseClassStatement ( ) ; } } finally { getSymbolTable ( ) . popScope ( ) ; if ( gsClass instanceof IGosuProgramInternal ) { ( ( IGosuProgramInternal ) gsClass ) . setParsingExecutableProgramStatements ( true ) ; try { FunctionStatement fs = parseExecutableProgramStatements ( ( IGosuProgramInternal ) gsClass ) ; makeExprRootFunction ( ( IGosuProgramInternal ) gsClass , fs ) ; } finally { ( ( IGosuProgramInternal ) gsClass ) . setParsingExecutableProgramStatements ( false ) ; } } boolean b = isInnerClass ( gsClass ) || match ( null , SourceCodeTokenizer . TT_EOF ) ; if ( ! verify ( classStmt , b , Res . MSG_END_OF_STMT ) ) { consumeTrailingTokens ( ) ; } gsClass . setDefinitionsCompiled ( ) ; } } if ( isTopLevelClass ( gsClass ) || TypeLord . isEvalProgram ( gsClass ) ) { getOwner ( ) . setParsed ( true ) ; } } finally { pushStatement ( classStmt ) ; setLocation ( _iClassOffset , _iClassLineNum , _iClassColumn , true ) ; if ( isTopLevelClass ( gsClass ) || TypeLord . isEvalProgram ( gsClass ) ) { popStatement ( ) ; pushStatement ( classStmt . getClassFileStatement ( ) ) ; setLocation ( 0 , 1 , _iClassColumn , true ) ; popStatement ( ) ; } assignTokens ( classStmt ) ; } try { verifyParsedElement ( isInnerClass ( gsClass ) && ! TypeLord . isEvalProgram ( gsClass ) ? classStmt : classStmt . getClassFileStatement ( ) ) ; } catch ( ParseResultsException pre ) { gsClass . setParseResultsException ( pre ) ; } } finally { try { gsClass . setCompilingDefinitions ( false ) ; gsClass . setDefinitionsCompiled ( ) ; getOwner ( ) . popScriptPart ( scriptPartId ) ; } finally { GosuClassCompilingStack . popCompilingType ( ) ; } popScopeIfNeeded ( bPushedScope , gsClass ) ; getTokenizer ( ) . popOffsetMarker ( this ) ; removeTypeVarsFromParserMap ( gsClass ) ; getOwner ( ) . _iReturnOk -- ; pushStatement ( _classStmt . getClassFileStatement ( ) ) ; setLocation ( 0 , 1 , _iClassColumn , true ) ; popStatement ( ) ; if ( isDeprecated ( ( ModifierInfo ) gsCls . getModifierInfo ( ) ) ) { getOwner ( ) . popIgnoreTypeDeprecation ( ) ; } gsClass . syncGenericAndParameterizedClasses ( ) ; getOwner ( ) . clearDfsStack ( ) ; _classStmt = null ; VarInitializationVerifier . verifyFinalFields ( gsClass ) ; VarInitializationVerifier . verifyLocalVars ( gsClass , true ) ; if ( isTopLevelClass ( gsClass ) ) { postDefinitionVerify ( classStmt ) ; } }
public class CmsShowResourceTable { /** * Get principal from id . < p > * @ param cms CmsObject * @ param type user or group * @ param id id of principal * @ return Principal * @ throws CmsException exception */ private CmsPrincipal getPrincipal ( CmsObject cms , DialogType type , CmsUUID id ) throws CmsException { } }
if ( type . equals ( DialogType . Group ) ) { return cms . readGroup ( id ) ; } if ( type . equals ( DialogType . User ) ) { return cms . readUser ( id ) ; } return null ;
public class AddResourcesListener { /** * Look whether a b : iconAwesome component is used . If so , the font - awesome . css * is removed from the resource list because it ' s loaded from the CDN . * @ return true , if the font - awesome . css is found in the resource list . Note the * side effect of this method ! */ private boolean isFontAwesomeComponentUsedAndRemoveIt ( ) { } }
FacesContext fc = FacesContext . getCurrentInstance ( ) ; UIViewRoot viewRoot = fc . getViewRoot ( ) ; ListIterator < UIComponent > resourceIterator = ( viewRoot . getComponentResources ( fc , "head" ) ) . listIterator ( ) ; UIComponent fontAwesomeResource = null ; while ( resourceIterator . hasNext ( ) ) { UIComponent resource = resourceIterator . next ( ) ; String name = ( String ) resource . getAttributes ( ) . get ( "name" ) ; // rw . write ( " \ n < ! - - res : ' " + name + " ' - - > " ) ; if ( name != null ) { if ( name . endsWith ( "font-awesome.css" ) ) fontAwesomeResource = resource ; } } if ( null != fontAwesomeResource ) { fontAwesomeResource . setInView ( false ) ; viewRoot . removeComponentResource ( fc , fontAwesomeResource ) ; // System . out . println ( " - 3 " + fontAwesomeResource . getClientId ( ) ) ; return true ; } return false ;
public class Schema { /** * remove the given global unique index * @ param index the index to remove * @ param preserveData should we keep the sql data ? */ void removeGlobalUniqueIndex ( GlobalUniqueIndex index , boolean preserveData ) { } }
getTopology ( ) . lock ( ) ; String fn = index . getName ( ) ; if ( ! uncommittedRemovedGlobalUniqueIndexes . contains ( fn ) ) { uncommittedRemovedGlobalUniqueIndexes . add ( fn ) ; TopologyManager . removeGlobalUniqueIndex ( sqlgGraph , fn ) ; if ( ! preserveData ) { getVertexLabel ( index . getName ( ) ) . ifPresent ( ( VertexLabel vl ) -> vl . remove ( false ) ) ; } getTopology ( ) . fire ( index , "" , TopologyChangeAction . DELETE ) ; }
public class FileCopyProgressPanel { /** * Set the number of the current byte transferred . If called outside the EDT * this method will switch to the UI thread using * < code > SwingUtilities . invokeLater ( Runnable ) < / code > . * @ param n * The N value in " N of M " . */ public final void setCurrentByte ( final int n ) { } }
if ( SwingUtilities . isEventDispatchThread ( ) ) { setCurrentByteIntern ( n ) ; } else { try { SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { setCurrentByteIntern ( n ) ; } } ) ; } catch ( final Exception ex ) { ignore ( ) ; } }
public class FormatConversionBase { /** * Appends { @ code csq } to { @ code a } , right - justified . * @ param a * @ param csq * @ param pad padding character * @ param width minimum of characters that will be written * @ throws IOException */ protected static void justifyRight ( Appendable a , CharSequence csq , char pad , int width ) throws IOException { } }
final int padLen = width - csq . length ( ) ; for ( int i = 0 ; i < padLen ; i ++ ) a . append ( pad ) ; a . append ( csq ) ;
public class Tags { /** * Extracts the value ID of the given tag UD name from the given row key . * @ param tsdb The TSDB instance to use for UniqueId lookups . * @ param row The row key in which to search the tag name . * @ param tag _ id The name of the tag to search in the row key . * @ return The value ID associated with the given tag ID , or null if this * tag ID isn ' t present in this row key . */ static byte [ ] getValueId ( final TSDB tsdb , final byte [ ] row , final byte [ ] tag_id ) { } }
final short name_width = tsdb . tag_names . width ( ) ; final short value_width = tsdb . tag_values . width ( ) ; // TODO ( tsuna ) : Can do a binary search . for ( short pos = ( short ) ( Const . SALT_WIDTH ( ) + tsdb . metrics . width ( ) + Const . TIMESTAMP_BYTES ) ; pos < row . length ; pos += name_width + value_width ) { if ( rowContains ( row , pos , tag_id ) ) { pos += name_width ; return Arrays . copyOfRange ( row , pos , pos + value_width ) ; } } return null ;
public class Scoreds { /** * Easy way to pass a { @ link Predicate } through to the score of a < code > Scored < T > < / code > . * @ param pred The < code > Predicate < / code > to apply to the score * @ return A < code > Predicate < / code > on < code > Scored < X > s < / code > which applies the supplied * predicate to the score . */ public static < X > Predicate < Scored < X > > scoreIs ( final Predicate < Double > pred ) { } }
return new Predicate < Scored < X > > ( ) { @ Override public boolean apply ( final Scored < X > x ) { return pred . apply ( x . score ( ) ) ; } } ;
public class SecurityRulesInner { /** * Creates or updates a security rule in the specified network security group . * @ param resourceGroupName The name of the resource group . * @ param networkSecurityGroupName The name of the network security group . * @ param securityRuleName The name of the security rule . * @ param securityRuleParameters Parameters supplied to the create or update network security rule operation . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < SecurityRuleInner > beginCreateOrUpdateAsync ( String resourceGroupName , String networkSecurityGroupName , String securityRuleName , SecurityRuleInner securityRuleParameters , final ServiceCallback < SecurityRuleInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , networkSecurityGroupName , securityRuleName , securityRuleParameters ) , serviceCallback ) ;
public class LuceneSerializer { /** * template method * @ param leftHandSide * left hand side * @ param rightHandSide * right hand side * @ return results */ protected String [ ] convert ( Path < ? > leftHandSide , Expression < ? > rightHandSide , QueryMetadata metadata ) { } }
if ( rightHandSide instanceof Operation ) { Operation < ? > operation = ( Operation < ? > ) rightHandSide ; if ( operation . getOperator ( ) == LuceneOps . PHRASE ) { return Iterables . toArray ( WS_SPLITTER . split ( operation . getArg ( 0 ) . toString ( ) ) , String . class ) ; } else if ( operation . getOperator ( ) == LuceneOps . TERM ) { return new String [ ] { operation . getArg ( 0 ) . toString ( ) } ; } else { throw new IllegalArgumentException ( rightHandSide . toString ( ) ) ; } } else if ( rightHandSide instanceof ParamExpression < ? > ) { Object value = metadata . getParams ( ) . get ( rightHandSide ) ; if ( value == null ) { throw new ParamNotSetException ( ( ParamExpression < ? > ) rightHandSide ) ; } return convert ( leftHandSide , value ) ; } else if ( rightHandSide instanceof Constant < ? > ) { return convert ( leftHandSide , ( ( Constant < ? > ) rightHandSide ) . getConstant ( ) ) ; } else { throw new IllegalArgumentException ( rightHandSide . toString ( ) ) ; }
public class HeaderElement { /** * Query the raw bytes value . If the storage is based on a larger value where * the actual header value is a subset of the array , then the caller should * be checking the getOffset ( ) and getValueLength ( ) methods to know how much * of this returned array to use . * @ return byte [ ] , null if no value is present */ protected byte [ ] asRawBytes ( ) { } }
if ( null == this . bValue ) { if ( null != this . sValue ) { this . bValue = GenericUtils . getEnglishBytes ( this . sValue ) ; } else { // try to extract from the parse buffers if ( ! extractInitialValue ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "no byte[] value present" ) ; } } } } return this . bValue ;
public class JobsMonitor { /** * { @ inheritDoc } */ @ Override public void jobWasExecuted ( JobExecutionContext context , JobExecutionException jobException ) { } }
final String message ; final String stacktrace ; if ( jobException == null ) { message = null ; stacktrace = null ; } else { message = jobException . getMessage ( ) ; StringWriter stackTraceWriter = new StringWriter ( 200 ) ; jobException . printStackTrace ( new PrintWriter ( stackTraceWriter ) ) ; stacktrace = stackTraceWriter . toString ( ) ; } JobStatsContext statsContext = statsContextThreadLocal . get ( ) ; statsContextThreadLocal . remove ( ) ; if ( statsContext != null ) { addExecution ( statsContext , message , stacktrace ) ; }
public class JavascriptEngine { /** * Launch eval function on the argument given in parameter * @ param arg * the argument * @ return the evaluated object */ public Object execEval ( String arg ) { } }
try { return scriptEngine . eval ( "eval(" + arg + ")" ) ; } catch ( ScriptException e ) { throw new BundlingProcessException ( "Error while evaluating a script" , e ) ; }
public class MutableByte { /** * Set with the specified new value and returns < code > true < / code > if < code > predicate < / code > returns true . * Otherwise just return < code > false < / code > without setting the value to new value . * @ param newValue * @ param predicate - test the current value . * @ return */ public < E extends Exception > boolean setIf ( byte newValue , Try . BytePredicate < E > predicate ) throws E { } }
if ( predicate . test ( this . value ) ) { this . value = newValue ; return true ; } return false ;
public class Options { /** * Returns an immutable set of open options for opening a new file channel . */ public static ImmutableSet < OpenOption > getOptionsForChannel ( Set < ? extends OpenOption > options ) { } }
if ( options . isEmpty ( ) ) { return DEFAULT_READ ; } boolean append = options . contains ( APPEND ) ; boolean write = append || options . contains ( WRITE ) ; boolean read = ! write || options . contains ( READ ) ; if ( read ) { if ( append ) { throw new UnsupportedOperationException ( "'READ' + 'APPEND' not allowed" ) ; } if ( ! write ) { // ignore all write related options return options . contains ( LinkOption . NOFOLLOW_LINKS ) ? DEFAULT_READ_NOFOLLOW_LINKS : DEFAULT_READ ; } } // options contains write or append and may also contain read // it does not contain both read and append return addWrite ( options ) ;
public class AggregateOperationFactory { /** * Converts an API class to a resolved window for planning with expressions already resolved . * It performs following validations : * < ul > * < li > The alias is represented with an unresolved reference < / li > * < li > The time attribute is a single field reference of a { @ link TimeIndicatorTypeInfo } ( stream ) , * { @ link SqlTimeTypeInfo } ( batch ) , or { @ link BasicTypeInfo # LONG _ TYPE _ INFO } ( batch ) type < / li > * < li > The size & slide are value literals of either { @ link RowIntervalTypeInfo # INTERVAL _ ROWS } , * or { @ link TimeIntervalTypeInfo } type < / li > * < li > The size & slide are of the same type < / li > * < li > The gap is a value literal of a { @ link TimeIntervalTypeInfo } type < / li > * < / ul > * @ param window window to resolve * @ param resolver resolver to resolve potential unresolved field references * @ return window with expressions resolved */ public ResolvedGroupWindow createResolvedWindow ( GroupWindow window , ExpressionResolver resolver ) { } }
Expression alias = window . getAlias ( ) ; if ( ! ( alias instanceof UnresolvedReferenceExpression ) ) { throw new ValidationException ( "Only unresolved reference supported for alias of a group window." ) ; } final String windowName = ( ( UnresolvedReferenceExpression ) alias ) . getName ( ) ; FieldReferenceExpression timeField = getValidatedTimeAttribute ( window , resolver ) ; if ( window instanceof TumbleWithSizeOnTimeWithAlias ) { return validateAndCreateTumbleWindow ( ( TumbleWithSizeOnTimeWithAlias ) window , windowName , timeField ) ; } else if ( window instanceof SlideWithSizeAndSlideOnTimeWithAlias ) { return validateAndCreateSlideWindow ( ( SlideWithSizeAndSlideOnTimeWithAlias ) window , windowName , timeField ) ; } else if ( window instanceof SessionWithGapOnTimeWithAlias ) { return validateAndCreateSessionWindow ( ( SessionWithGapOnTimeWithAlias ) window , windowName , timeField ) ; } else { throw new TableException ( "Unknown window type: " + window ) ; }
public class UrlStringUtils { /** * Takes a URL , in String format , and adds the important parts of the URL to * a list of strings . < / p > * Example , given the following input : < / p > * < code > " https : / / www . somedomain . com / path1 / path2 / file . php ? id = 439 " < / code > * The function would return : < / p > * < code > { " some . domain " , " path1 " , " path2 " , " file " } < / code > * @ param text a URL * @ return importantParts a list of the important parts of the URL * @ throws MalformedURLException thrown if the URL is malformed */ @ SuppressWarnings ( "StringSplitter" ) public static List < String > extractImportantUrlData ( String text ) throws MalformedURLException { } }
final List < String > importantParts = new ArrayList < > ( ) ; final URL url = new URL ( text ) ; final String [ ] domain = url . getHost ( ) . split ( "\\." ) ; // add the domain except www and the tld . for ( int i = 0 ; i < domain . length - 1 ; i ++ ) { final String sub = domain [ i ] ; if ( Arrays . binarySearch ( IGNORE_LIST , sub . toLowerCase ( ) ) < 0 ) { importantParts . add ( sub ) ; } } final String document = url . getPath ( ) ; final String [ ] pathParts = document . split ( "[\\//]" ) ; for ( int i = 0 ; i < pathParts . length - 1 ; i ++ ) { if ( ! pathParts [ i ] . isEmpty ( ) ) { importantParts . add ( pathParts [ i ] ) ; } } if ( pathParts . length > 0 && ! pathParts [ pathParts . length - 1 ] . isEmpty ( ) ) { final String tmp = pathParts [ pathParts . length - 1 ] ; final int pos = tmp . lastIndexOf ( '.' ) ; if ( pos > 1 ) { importantParts . add ( tmp . substring ( 0 , pos ) ) ; } else if ( pos == 0 && tmp . length ( ) > 1 ) { importantParts . add ( tmp . substring ( 1 ) ) ; } else { importantParts . add ( tmp ) ; } } return importantParts ;
public class RepositoryBackupChainImpl { /** * { @ inheritDoc } */ public int getState ( ) { } }
if ( state != FINISHED ) { if ( LOG . isDebugEnabled ( ) ) { for ( BackupChain bc : workspaceBackups ) { LOG . debug ( repositoryBackupId + " : " + getState ( bc . getFullBackupState ( ) ) ) ; } } int fullBackupsState = - 1 ; int incrementalBackupsState = - 1 ; for ( BackupChain bc : workspaceBackups ) { fullBackupsState = bc . getFullBackupState ( ) ; if ( fullBackupsState != BackupJob . FINISHED ) { break ; } } for ( BackupChain bChein : workspaceBackups ) { if ( bChein . getBackupConfig ( ) . getBackupType ( ) == BackupManager . FULL_AND_INCREMENTAL ) { incrementalBackupsState = bChein . getIncrementalBackupState ( ) ; if ( incrementalBackupsState == BackupJob . WORKING ) { break ; } } } if ( config . getBackupType ( ) == BackupManager . FULL_BACKUP_ONLY ) { if ( fullBackupsState == BackupJob . FINISHED ) { state = FINISHED ; } else { state = WORKING ; } } else { if ( fullBackupsState == BackupJob . FINISHED && incrementalBackupsState == BackupJob . FINISHED ) { state = FINISHED ; } else if ( fullBackupsState == BackupJob . FINISHED && incrementalBackupsState == BackupJob . WORKING ) { state = FULL_BACKUP_FINISHED_INCREMENTAL_BACKUP_WORKING ; } else { state = WORKING ; } } } return state ;
public class AbstractWComponent { /** * Collates all the visible components in this branch of the WComponent tree . WComponents are added to the * < code > list < / code > in depth - first order , as this list is traversed in order during the request handling phase . * @ param component the current branch to collate visible items in . * @ param list the list to add the visible components to . */ private static void collateVisible ( final WComponent component , final List < WComponent > list ) { } }
if ( component . isVisible ( ) ) { if ( component instanceof Container ) { final int size = ( ( Container ) component ) . getChildCount ( ) ; for ( int i = 0 ; i < size ; i ++ ) { collateVisible ( ( ( Container ) component ) . getChildAt ( i ) , list ) ; } } list . add ( component ) ; }
public class BitfinexFundingSymbol { /** * Build from bitfinex string * @ param symbol * @ return */ public static BitfinexFundingSymbol fromBitfinexString ( final String symbol ) { } }
final BitfinexFundingCurrency bitfinexCurrency = BitfinexFundingCurrency . fromSymbolString ( symbol ) ; return BitfinexSymbols . funding ( bitfinexCurrency ) ;
public class ReComputeFieldHandler { /** * The Field has Changed . * Get the value of this listener ' s owner , pass it to the computeValue method and * set the returned value to the target field . * @ param bDisplayOption If true , display the change . * @ param iMoveMode The type of move being done ( init / read / screen ) . * @ return The error code ( or NORMAL _ RETURN if okay ) . * Field changed , re - compute the value in this field . */ public int fieldChanged ( boolean bDisplayOption , int iMoveMode ) { } }
double srcValue = ( ( NumberField ) this . getOwner ( ) ) . getValue ( ) ; BaseField fldTarget = this . getFieldTarget ( ) ; if ( this . getOwner ( ) . isNull ( ) ) // If null , set the target to null return fldTarget . moveFieldToThis ( this . getOwner ( ) , bDisplayOption , iMoveMode ) ; // zero out the field boolean [ ] rgbListeners = null ; if ( m_bDisableTarget ) rgbListeners = fldTarget . setEnableListeners ( false ) ; int iErrorCode = fldTarget . setValue ( this . computeValue ( srcValue ) , bDisplayOption , iMoveMode ) ; if ( m_bDisableTarget ) fldTarget . setEnableListeners ( rgbListeners ) ; return iErrorCode ;
public class HttpTransportFactory { /** * Create an { @ link ApacheHttpTransport } for calling Google APIs with an optional HTTP proxy . * @ param proxyUri Optional HTTP proxy URI to use with the transport . * @ param proxyCredentials Optional HTTP proxy credentials to authenticate with the transport * proxy . * @ return The resulting HttpTransport . * @ throws IOException If there is an issue connecting to Google ' s certification server . * @ throws GeneralSecurityException If there is a security issue with the keystore . */ public static ApacheHttpTransport createApacheHttpTransport ( @ Nullable URI proxyUri , @ Nullable Credentials proxyCredentials ) throws IOException , GeneralSecurityException { } }
checkArgument ( proxyUri != null || proxyCredentials == null , "if proxyUri is null than proxyCredentials should be null too" ) ; ApacheHttpTransport transport = new ApacheHttpTransport . Builder ( ) . trustCertificates ( GoogleUtils . getCertificateTrustStore ( ) ) . setProxy ( proxyUri == null ? null : new HttpHost ( proxyUri . getHost ( ) , proxyUri . getPort ( ) ) ) . build ( ) ; if ( proxyCredentials != null ) { ( ( DefaultHttpClient ) transport . getHttpClient ( ) ) . getCredentialsProvider ( ) . setCredentials ( new AuthScope ( proxyUri . getHost ( ) , proxyUri . getPort ( ) ) , proxyCredentials ) ; } return transport ;
public class TableFactory14 { /** * Adds columns to a Table instance . * @ param file parent project file * @ param table parent table instance * @ param data column data */ private void processColumnData ( ProjectFile file , Table table , byte [ ] data ) { } }
// System . out . println ( " Table = " + table ) ; // System . out . println ( ByteArrayHelper . hexdump ( data , 12 , data . length - 12 , true , 115 , " " ) ) ; if ( data != null ) { int columnCount = MPPUtility . getShort ( data , 4 ) + 1 ; int index = 12 ; Column column ; int alignment ; for ( int loop = 0 ; loop < columnCount ; loop ++ ) { column = new Column ( file ) ; int fieldType = MPPUtility . getShort ( data , index ) ; if ( table . getResourceFlag ( ) == false ) { column . setFieldType ( MPPTaskField14 . getInstance ( fieldType ) ) ; } else { column . setFieldType ( MPPResourceField14 . getInstance ( fieldType ) ) ; } // System . out . println ( fieldType ) ; // if ( column . getFieldType ( ) = = null ) // System . out . println ( loop + " : Unknown column type " + fieldType ) ; // else // System . out . println ( loop + " : " + column . getFieldType ( ) ) ; column . setWidth ( MPPUtility . getByte ( data , index + 4 ) ) ; String columnTitle = MPPUtility . getUnicodeString ( data , index + 13 ) ; if ( columnTitle . length ( ) != 0 ) { column . setTitle ( columnTitle ) ; } alignment = MPPUtility . getByte ( data , index + 5 ) ; if ( ( alignment & 0x0F ) == 0x00 ) { column . setAlignTitle ( Column . ALIGN_LEFT ) ; } else { if ( ( alignment & 0x0F ) == 0x01 ) { column . setAlignTitle ( Column . ALIGN_CENTER ) ; } else { column . setAlignTitle ( Column . ALIGN_RIGHT ) ; } } alignment = MPPUtility . getByte ( data , index + 7 ) ; if ( ( alignment & 0x0F ) == 0x00 ) { column . setAlignData ( Column . ALIGN_LEFT ) ; } else { if ( ( alignment & 0x0F ) == 0x01 ) { column . setAlignData ( Column . ALIGN_CENTER ) ; } else { column . setAlignData ( Column . ALIGN_RIGHT ) ; } } table . addColumn ( column ) ; index += 115 ; } }
public class AggregatePlanNode { /** * single min ( ) without GROUP BY ? */ public boolean isTableMin ( ) { } }
// do not support GROUP BY for now if ( m_groupByExpressions . isEmpty ( ) == false ) { return false ; } if ( m_aggregateTypes . size ( ) != 1 ) { return false ; } if ( m_aggregateTypes . get ( 0 ) . equals ( ExpressionType . AGGREGATE_MIN ) == false ) { return false ; } return true ;
public class MetadataDocumentEnumTypeWriter { /** * Write an { @ code < EnumType > } element for the given { @ code EnumType } . * @ param type The given complex type . It can not be { @ code null } . * @ throws javax . xml . stream . XMLStreamException If unable to write to strem */ public void write ( EnumType type ) throws XMLStreamException { } }
LOG . debug ( "Writing type {} of type {}" , type . getName ( ) , type . getMetaType ( ) ) ; xmlWriter . writeStartElement ( ENUM_TYPE ) ; xmlWriter . writeAttribute ( NAME , type . getName ( ) ) ; for ( EnumMember member : type . getMembers ( ) ) { xmlWriter . writeStartElement ( ENUM_MEMBER ) ; xmlWriter . writeAttribute ( NAME , member . getName ( ) ) ; xmlWriter . writeEndElement ( ) ; } xmlWriter . writeEndElement ( ) ;
public class ConfusingAutoboxedOverloading { /** * returns whether a method signature has either a Character or primitive * @ param sig * the method signature * @ return whether a method signature has either a Character or primitive */ private static boolean isPossiblyConfusingSignature ( String sig ) { } }
List < String > types = SignatureUtils . getParameterSignatures ( sig ) ; for ( String typeSig : types ) { if ( primitiveSigs . contains ( typeSig ) || SignatureUtils . classToSignature ( Values . SLASHED_JAVA_LANG_CHARACTER ) . equals ( typeSig ) ) { return true ; } } return false ;
public class BeanDescriptor { /** * Gets the getter for a property as a Method object . * @ param name the name of the property * @ return the getter Method * @ throws NoSuchMethodException when a getter method cannot be found */ public Method getGetter ( String name ) throws NoSuchMethodException { } }
Method method = getterMethods . get ( name ) ; if ( method == null ) { throw new NoSuchMethodException ( "There is no READABLE property named '" + name + "' in class '" + className + "'" ) ; } return method ;
public class LoggerCache { /** * Get the logger to be used for the given class . * @ param clazz - The class for which the logger needs to be returned * @ return - The log4j logger object */ public Logger getOrCreateLogger ( String clazz ) { } }
Logger logger = appenderLoggerMap . get ( clazz ) ; if ( logger == null ) { // If multiple threads do the puts , that is fine as it is a one time thing logger = Logger . getLogger ( clazz ) ; appenderLoggerMap . put ( clazz , logger ) ; } return logger ;
public class UserServiceImpl { /** * { @ inheritDoc } */ @ PreAuthorize ( "hasRole('ADMIN')" ) @ Override public final List < SecurityUser > findAll ( ) throws AccessDeniedException { } }
final List < SecurityUser > result = new ArrayList < > ( ) ; for ( final SecurityUser user : users ) { result . add ( user ) ; } return result ;
public class JGridScreen { /** * Is this control a focus target ? */ public boolean isFocusTarget ( int col ) { } }
if ( this . getGridModel ( ) != null ) if ( this . getGridModel ( ) . getColumnClass ( col ) == String . class ) return true ; return false ;
public class SymbolTable { /** * Helper for addSymbolsFrom , to determine whether a reference is acceptable . A reference must be * in the normal source tree . */ private boolean isGoodRefToAdd ( @ Nullable StaticRef ref ) { } }
return ref != null && ref . getNode ( ) != null && ref . getNode ( ) . getStaticSourceFile ( ) != null && ! Compiler . SYNTHETIC_EXTERNS . equals ( ref . getNode ( ) . getStaticSourceFile ( ) . getName ( ) ) ;
public class EmptyStringIllegalValidator { /** * ( non - Javadoc ) * @ see * com . fs . commons . desktop . validation . Validator # validate ( com . fs . commons . desktop . * validation . Problems , java . lang . String , java . lang . Object ) */ @ Override public boolean validate ( final Problems problems , final String compName , final Object model ) { } }
final boolean result = model != null && model . toString ( ) . length ( ) > 0 ; if ( ! result ) { final String message = ValidationBundle . getMessage ( EmptyStringIllegalValidator . class , "MSG_MAY_NOT_BE_EMPTY" , compName ) ; // NOI18N problems . add ( message ) ; } return result ;
public class OsLoginServiceClient { /** * Deletes an SSH public key . * < p > Sample code : * < pre > < code > * try ( OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient . create ( ) ) { * FingerprintName name = FingerprintName . of ( " [ USER ] " , " [ FINGERPRINT ] " ) ; * osLoginServiceClient . deleteSshPublicKey ( name ) ; * < / code > < / pre > * @ param name The fingerprint of the public key to update . Public keys are identified by their * SHA - 256 fingerprint . The fingerprint of the public key is in format * ` users / { user } / sshPublicKeys / { fingerprint } ` . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final void deleteSshPublicKey ( FingerprintName name ) { } }
DeleteSshPublicKeyRequest request = DeleteSshPublicKeyRequest . newBuilder ( ) . setName ( name == null ? null : name . toString ( ) ) . build ( ) ; deleteSshPublicKey ( request ) ;
public class JKNumbersUtil { /** * Sub amounts . * @ param n1 the n 1 * @ param n2 the n 2 * @ return the double */ public static double subAmounts ( final double n1 , final double n2 ) { } }
final BigDecimal b1 = new BigDecimal ( n1 ) ; final BigDecimal b2 = new BigDecimal ( n2 ) ; BigDecimal b3 = b1 . subtract ( b2 ) ; b3 = b3 . setScale ( 3 , BigDecimal . ROUND_HALF_UP ) ; final double result = b3 . doubleValue ( ) ; return result ;
public class BytecodeHelper { /** * array types are special : * eg . : String [ ] : classname : [ Ljava / lang / String ; * int [ ] : [ I * @ return the ASM type description */ private static String getTypeDescription ( ClassNode c , boolean end ) { } }
ClassNode d = c ; if ( ClassHelper . isPrimitiveType ( d . redirect ( ) ) ) { d = d . redirect ( ) ; } String desc = TypeUtil . getDescriptionByType ( d ) ; if ( ! end && desc . endsWith ( ";" ) ) { desc = desc . substring ( 0 , desc . length ( ) - 1 ) ; } return desc ;
public class WorkflowExecutionTerminatedEventAttributesMarshaller { /** * Marshall the given parameter object . */ public void marshall ( WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes , ProtocolMarshaller protocolMarshaller ) { } }
if ( workflowExecutionTerminatedEventAttributes == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( workflowExecutionTerminatedEventAttributes . getReason ( ) , REASON_BINDING ) ; protocolMarshaller . marshall ( workflowExecutionTerminatedEventAttributes . getDetails ( ) , DETAILS_BINDING ) ; protocolMarshaller . marshall ( workflowExecutionTerminatedEventAttributes . getChildPolicy ( ) , CHILDPOLICY_BINDING ) ; protocolMarshaller . marshall ( workflowExecutionTerminatedEventAttributes . getCause ( ) , CAUSE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class NamespaceDto { /** * Converts list of alert entity objects to list of alertDto objects . * @ param namespaces users alerts List of alert entities . Cannot be null . * @ return List of alertDto objects . * @ throws WebApplicationException If an error occurs . */ public static List < NamespaceDto > transformToDto ( List < Namespace > namespaces ) { } }
if ( namespaces == null ) { throw new WebApplicationException ( "Null entity object cannot be converted to Dto object." , Status . INTERNAL_SERVER_ERROR ) ; } List < NamespaceDto > result = new ArrayList < > ( ) ; for ( Namespace namespace : namespaces ) { result . add ( transformToDto ( namespace ) ) ; } return result ;
public class AgentRoster { /** * Fires event to listeners . */ private void fireEvent ( int eventType , Object eventObject ) { } }
AgentRosterListener [ ] listeners ; synchronized ( this . listeners ) { listeners = new AgentRosterListener [ this . listeners . size ( ) ] ; this . listeners . toArray ( listeners ) ; } for ( int i = 0 ; i < listeners . length ; i ++ ) { switch ( eventType ) { case EVENT_AGENT_ADDED : listeners [ i ] . agentAdded ( ( EntityBareJid ) eventObject ) ; break ; case EVENT_AGENT_REMOVED : listeners [ i ] . agentRemoved ( ( EntityBareJid ) eventObject ) ; break ; case EVENT_PRESENCE_CHANGED : listeners [ i ] . presenceChanged ( ( Presence ) eventObject ) ; break ; } }
public class DateUtils { /** * < p > Returns the number of minutes within the * fragment . All datefields greater than the fragment will be ignored . < / p > * < p > Asking the minutes of any date will only return the number of minutes * of the current hour ( resulting in a number between 0 and 59 ) . This * method will retrieve the number of minutes for any fragment . * For example , if you want to calculate the number of minutes past this month , * your fragment is Calendar . MONTH . The result will be all minutes of the * past day ( s ) and hour ( s ) . < / p > * < p > Valid fragments are : Calendar . YEAR , Calendar . MONTH , both * Calendar . DAY _ OF _ YEAR and Calendar . DATE , Calendar . HOUR _ OF _ DAY , * Calendar . MINUTE , Calendar . SECOND and Calendar . MILLISECOND * A fragment less than or equal to a MINUTE field will return 0 . < / p > * < ul > * < li > January 1 , 2008 7:15:10.538 with Calendar . HOUR _ OF _ DAY as fragment will return 15 * ( equivalent to deprecated date . getMinutes ( ) ) < / li > * < li > January 6 , 2008 7:15:10.538 with Calendar . HOUR _ OF _ DAY as fragment will return 15 * ( equivalent to deprecated date . getMinutes ( ) ) < / li > * < li > January 1 , 2008 7:15:10.538 with Calendar . MONTH as fragment will return 15 < / li > * < li > January 6 , 2008 7:15:10.538 with Calendar . MONTH as fragment will return 435 ( 7*60 + 15 ) < / li > * < li > January 16 , 2008 7:15:10.538 with Calendar . MILLISECOND as fragment will return 0 * ( a millisecond cannot be split in minutes ) < / li > * < / ul > * @ param date the date to work with , not null * @ param fragment the { @ code Calendar } field part of date to calculate * @ return number of minutes within the fragment of date * @ throws IllegalArgumentException if the date is < code > null < / code > or * fragment is not supported * @ since 2.4 */ @ GwtIncompatible ( "incompatible method" ) public static long getFragmentInMinutes ( final Date date , final int fragment ) { } }
return getFragment ( date , fragment , TimeUnit . MINUTES ) ;
public class DnDManager { /** * Reset dnd to a starting state . */ protected void reset ( ) { } }
_scrollTimer . stop ( ) ; _source = null ; _sourceComp = null ; _lastComp = null ; _lastTarget = null ; _data [ 0 ] = null ; _cursors [ 0 ] = null ; _cursors [ 1 ] = null ; _topComp = null ; _topCursor = null ; _curCursor = null ; _scrollComp = null ; _scrollDim = null ; _scrollPoint = null ;
public class CodeChunk { /** * Temporary method to ease migration to the CodeChunk DSL . * < p > Because of the recursive nature of the JS codegen system , it is generally not possible to * convert one codegen method at a time to use the CodeChunk DSL . However , the business logic * inside those methods can be migrated incrementally . Methods that do not yet use the CodeChunk * DSL can " unwrap " inputs using this method and " wrap " results using { @ link * CodeChunk # fromExpr ( JsExpr ) } . This is safe as long as each CodeChunk generated for production * code is { @ link Expression # isRepresentableAsSingleExpression } . * < p > TODO ( b / 32224284 ) : remove . */ public final JsExpr assertExprAndCollectRequires ( RequiresCollector collector ) { } }
Expression expression = ( Expression ) this ; if ( ! expression . isRepresentableAsSingleExpression ( ) ) { throw new IllegalStateException ( String . format ( "Not an expr:\n%s" , this . getCode ( ) ) ) ; } collectRequires ( collector ) ; return expression . singleExprOrName ( ) ;
public class MessageUtil { /** * A convenience method for calling { @ link # compose ( String , Object [ ] ) } with an array of * arguments that will be automatically tainted ( see { @ link # taint } ) . */ public static String tcompose ( String key , Object ... args ) { } }
int acount = args . length ; String [ ] targs = new String [ acount ] ; for ( int ii = 0 ; ii < acount ; ii ++ ) { targs [ ii ] = taint ( args [ ii ] ) ; } return compose ( key , ( Object [ ] ) targs ) ;
public class OModificationLock { /** * Tells the lock that thread is going to perform data modifications in storage . This method allows to perform several data * modifications in parallel . */ public void requestModificationLock ( ) { } }
lock . readLock ( ) . lock ( ) ; if ( ! veto ) return ; if ( throwException ) { lock . readLock ( ) . unlock ( ) ; throw new OModificationOperationProhibitedException ( "Modification requests are prohibited" ) ; } boolean wasInterrupted = false ; Thread thread = Thread . currentThread ( ) ; waiters . add ( thread ) ; while ( veto ) { LockSupport . park ( this ) ; if ( Thread . interrupted ( ) ) wasInterrupted = true ; } waiters . remove ( thread ) ; if ( wasInterrupted ) thread . interrupt ( ) ;
public class PolicyAssignmentsInner { /** * Creates a policy assignment by ID . * Policy assignments are inherited by child resources . For example , when you apply a policy to a resource group that policy is assigned to all resources in the group . When providing a scope for the assigment , use ' / subscriptions / { subscription - id } / ' for subscriptions , ' / subscriptions / { subscription - id } / resourceGroups / { resource - group - name } ' for resource groups , and ' / subscriptions / { subscription - id } / resourceGroups / { resource - group - name } / providers / { resource - provider - namespace } / { resource - type } / { resource - name } ' for resources . * @ param policyAssignmentId The ID of the policy assignment to create . Use the format ' / { scope } / providers / Microsoft . Authorization / policyAssignments / { policy - assignment - name } ' . * @ param parameters Parameters for policy assignment . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the PolicyAssignmentInner object if successful . */ public PolicyAssignmentInner createById ( String policyAssignmentId , PolicyAssignmentInner parameters ) { } }
return createByIdWithServiceResponseAsync ( policyAssignmentId , parameters ) . toBlocking ( ) . single ( ) . body ( ) ;
public class NodeImpl { /** * create bean node . * @ param parent parent node * @ return new node implementation */ public static NodeImpl createBeanNode ( final NodeImpl parent ) { } }
return new NodeImpl ( null , parent , false , null , null , ElementKind . BEAN , EMPTY_CLASS_ARRAY , null , null , null , null ) ;
public class BatchDeletePhoneNumberRequest { /** * List of phone number IDs . * @ param phoneNumberIds * List of phone number IDs . */ public void setPhoneNumberIds ( java . util . Collection < String > phoneNumberIds ) { } }
if ( phoneNumberIds == null ) { this . phoneNumberIds = null ; return ; } this . phoneNumberIds = new java . util . ArrayList < String > ( phoneNumberIds ) ;
public class CmsSetupDb { /** * Creates and executes a database statement from a String returning the result set . < p > * @ param query the query to execute * @ param replacer the replacements to perform in the script * @ param params the list of parameters for the statement * @ return the result set of the query * @ throws SQLException if something goes wrong */ public CmsSetupDBWrapper executeSqlStatement ( String query , Map < String , String > replacer , List < Object > params ) throws SQLException { } }
CmsSetupDBWrapper dbwrapper = new CmsSetupDBWrapper ( m_con ) ; String queryToExecute = query ; // Check if a map of replacements is given if ( replacer != null ) { queryToExecute = replaceTokens ( query , replacer ) ; } dbwrapper . createPreparedStatement ( queryToExecute , params ) ; dbwrapper . excecutePreparedQuery ( ) ; return dbwrapper ;
public class FsCrawlerUtil { /** * Unzip a jar file * @ param jarFile Jar file url like file : / path / to / foo . jar * @ param destination Directory where we want to extract the content to * @ throws IOException In case of any IO problem */ public static void unzip ( String jarFile , Path destination ) throws IOException { } }
Map < String , String > zipProperties = new HashMap < > ( ) ; /* We want to read an existing ZIP File , so we set this to false */ zipProperties . put ( "create" , "false" ) ; zipProperties . put ( "encoding" , "UTF-8" ) ; URI zipFile = URI . create ( "jar:" + jarFile ) ; try ( FileSystem zipfs = FileSystems . newFileSystem ( zipFile , zipProperties ) ) { Path rootPath = zipfs . getPath ( "/" ) ; Files . walkFileTree ( rootPath , new SimpleFileVisitor < Path > ( ) { @ Override public FileVisitResult preVisitDirectory ( Path dir , BasicFileAttributes attrs ) throws IOException { Path targetPath = destination . resolve ( rootPath . relativize ( dir ) . toString ( ) ) ; if ( ! Files . exists ( targetPath ) ) { Files . createDirectory ( targetPath ) ; } return FileVisitResult . CONTINUE ; } @ Override public FileVisitResult visitFile ( Path file , BasicFileAttributes attrs ) throws IOException { Files . copy ( file , destination . resolve ( rootPath . relativize ( file ) . toString ( ) ) , StandardCopyOption . COPY_ATTRIBUTES , StandardCopyOption . REPLACE_EXISTING ) ; return FileVisitResult . CONTINUE ; } } ) ; }
public class Converter { /** * convertDateString */ private static void convertDateValue ( String str ) { } }
try { display ( "Millis to date: " + Utils . formatDateUTC ( new Date ( Long . parseLong ( str ) ) ) ) ; } catch ( Exception e ) { }
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getObjectClassification ( ) { } }
if ( objectClassificationEClass == null ) { objectClassificationEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 366 ) ; } return objectClassificationEClass ;
public class SpatialiteWKBReader { /** * Reads a single { @ link Geometry } in WKB format from a byte array . * @ param bytes the byte array to read from * @ return the geometry read * @ throws ParseException if the WKB is ill - formed */ public Geometry read ( byte [ ] bytes ) throws ParseException { } }
// possibly reuse the ByteArrayInStream ? // don ' t throw IOExceptions , since we are not doing any I / O try { return read ( new ByteArrayInStream ( bytes ) ) ; } catch ( IOException ex ) { throw new RuntimeException ( "Unexpected IOException caught: " + ex . getMessage ( ) ) ; }
public class DataTree { /** * update the quota for the given path * @ param path * the path to be used */ private void updateQuotaForPath ( String path ) { } }
Counts c = new Counts ( ) ; getCounts ( path , c ) ; StatsTrack strack = new StatsTrack ( ) ; strack . setBytes ( c . bytes ) ; strack . setCount ( c . count ) ; String statPath = Quotas . quotaZookeeper + path + "/" + Quotas . statNode ; DataNode node = getNode ( statPath ) ; // it should exist if ( node == null ) { LOG . warn ( "Missing quota stat node " + statPath ) ; return ; } synchronized ( node ) { node . data = strack . toString ( ) . getBytes ( ) ; }
public class SDMath { /** * Returns an output variable with diagonal values equal to the specified values ; off - diagonal values will be set to 0 < br > * For example , if input = [ 1,2,3 ] , then output is given by : < br > * [ 1 , 0 , 0 ] < br > * [ 0 , 2 , 0 ] < br > * [ 0 , 0 , 3 ] < br > * < br > * Higher input ranks are also supported : if input has shape [ a , . . . , R - 1 ] then output [ i , . . . , k , i , . . . , k ] = input [ i , . . . , k ] . * i . e . , for input rank R , output has rank 2R * @ param name Name of the output variable * @ param x Input variable * @ return Output variable */ public SDVariable diag ( String name , SDVariable x ) { } }
SDVariable ret = f ( ) . diag ( x ) ; return updateVariableNameAndReference ( ret , name ) ;
public class AbstractExternalHighlightingFragment2 { /** * Replies the basename of the XML file to generate . * @ param defaultName the name to reply if the basename was not set . * @ return the basename . */ @ Pure public String getBasename ( String defaultName ) { } }
if ( Strings . isEmpty ( this . basename ) ) { return defaultName ; } return this . basename ;
public class BitVector { /** * length guaranteed to be non - zero */ private void setBitsImpl ( int position , long value , int length ) { } }
int i = position >> ADDRESS_BITS ; int s = position & ADDRESS_MASK ; long m = length == ADDRESS_SIZE ? - 1L : ( 1L << length ) - 1L ; long v = value & m ; performAdjSet ( length , i , s , m , v ) ;
public class EqualsBean { /** * Indicates whether some other object is " equal to " the object passed in the constructor , as * defined by the Object equals ( ) method . * To be used by classes using EqualsBean in a delegation pattern , * @ param obj1 The reference object with which to compare . * @ param obj2 The object to which to compare . * @ return < b > true < / b > if the object passed in the constructor is equal to the ' obj ' object . */ public static boolean beanEquals ( Class < ? > beanClass , final Object obj1 , final Object obj2 ) { } }
boolean eq ; if ( obj1 == null && obj2 == null ) { // both are null eq = true ; } else if ( obj1 == null || obj2 == null ) { // one of the objects is null eq = false ; } else if ( ! beanClass . isInstance ( obj2 ) ) { // not of the same type eq = false ; } else { eq = true ; try { final List < PropertyDescriptor > propertyDescriptors = BeanIntrospector . getPropertyDescriptorsWithGetters ( beanClass ) ; for ( final PropertyDescriptor propertyDescriptor : propertyDescriptors ) { final Method getter = propertyDescriptor . getReadMethod ( ) ; final Object value1 = getter . invoke ( obj1 , NO_PARAMS ) ; final Object value2 = getter . invoke ( obj2 , NO_PARAMS ) ; eq = doEquals ( value1 , value2 ) ; if ( ! eq ) { break ; } } } catch ( final Exception ex ) { throw new RuntimeException ( "Could not execute equals()" , ex ) ; } } return eq ;
public class TypeLord { /** * Todo : the above method is nearly identical to this one . lets see about combining them */ public static IType findParameterizedTypeInHierarchy ( IType sourceType , IType rawGenericType ) { } }
if ( sourceType == null ) { return null ; } if ( sourceType . isParameterizedType ( ) && sourceType . getGenericType ( ) . equals ( rawGenericType ) ) { return sourceType ; } IType [ ] list = sourceType . getInterfaces ( ) ; for ( int i = 0 ; i < list . length ; i ++ ) { IType returnType = findParameterizedTypeInHierarchy ( list [ i ] , rawGenericType ) ; if ( returnType != null ) { return returnType ; } } return findParameterizedTypeInHierarchy ( sourceType . getSupertype ( ) , rawGenericType ) ;
public class BigIntStringChecksum { /** * / * private */ static String computeMd5ChecksumLimit6 ( String inAsHex2 ) { } }
byte [ ] bytes = computeMd5ChecksumFull ( inAsHex2 ) ; String md5checksum = bytesToHexString ( bytes [ 2 ] , bytes [ 1 ] , bytes [ 0 ] ) ; return md5checksum ;
public class ApiKeyFilter { /** * Adds the API key to the client request . * @ param request The client request */ public void filter ( ClientRequestContext request ) throws IOException { } }
if ( ! request . getHeaders ( ) . containsKey ( "X-Api-Key" ) ) request . getHeaders ( ) . add ( "X-Api-Key" , this . apikey ) ;
public class ClassUtil { /** * Returns the list of all classes within a package . * @ param packageNames * @ return a collection of classes */ public static Collection < Class < ? > > getClasses ( String ... packageNames ) { } }
List < Class < ? > > classes = new ArrayList < > ( ) ; for ( String packageName : packageNames ) { final String packagePath = packageName . replace ( '.' , '/' ) ; final String packagePrefix = packageName + '.' ; List < URL > packageUrls = getResources ( packagePath ) ; for ( URL packageUrl : packageUrls ) { if ( packageUrl . getProtocol ( ) . equals ( "jar" ) ) { log . debug ( "Scanning jar {} for classes" , packageUrl ) ; try { String jar = packageUrl . toString ( ) . substring ( "jar:" . length ( ) ) . split ( "!" ) [ 0 ] ; File file = new File ( new URI ( jar ) ) ; try ( JarInputStream is = new JarInputStream ( new FileInputStream ( file ) ) ) { JarEntry entry = null ; while ( ( entry = is . getNextJarEntry ( ) ) != null ) { if ( ! entry . isDirectory ( ) && entry . getName ( ) . endsWith ( ".class" ) ) { String className = entry . getName ( ) . replace ( ".class" , "" ) . replace ( '/' , '.' ) ; if ( className . startsWith ( packagePrefix ) ) { Class < ? > aClass = getClass ( className ) ; classes . add ( aClass ) ; } } } } } catch ( URISyntaxException | IOException e ) { throw new FathomException ( e , "Failed to get classes for package '{}'" , packageName ) ; } } else { log . debug ( "Scanning filesystem {} for classes" , packageUrl ) ; log . debug ( packageUrl . getProtocol ( ) ) ; try ( InputStream is = packageUrl . openStream ( ) ) { Preconditions . checkNotNull ( is , "Package url %s stream is null!" , packageUrl ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( is , StandardCharsets . UTF_8 ) ) ) { classes . addAll ( reader . lines ( ) . filter ( line -> line != null && line . endsWith ( ".class" ) ) . map ( line -> { String className = line . replace ( ".class" , "" ) . replace ( '/' , '.' ) ; try { Class < ? > aClass = getClass ( packagePrefix + className ) ; return aClass ; } catch ( Exception e ) { log . error ( "Failed to find {}" , line , e ) ; } return null ; } ) . collect ( Collectors . toList ( ) ) ) ; } } catch ( IOException e ) { throw new FathomException ( e , "Failed to get classes for package '{}'" , packageName ) ; } } } } return Collections . unmodifiableCollection ( classes ) ;
public class WingsDbHelper { /** * Checks out a list of { @ link ShareRequest } that need to be processed , filtered by destination . The list is sorted * by time of creation , from the earliest to most recent . This method internally changes the checked out records to * a processing state , so a call to { @ link # markSuccessful ( int ) } or { @ link # markFailed ( int ) } is expected to be * called on each of those records . * @ param destination the destination of the { @ link ShareRequest } to checkout . * @ return the list of { @ link ShareRequest } ; may be empty . */ public synchronized List < ShareRequest > checkoutShareRequests ( Destination destination ) { } }
List < ShareRequest > shareRequests = new ArrayList < ShareRequest > ( ) ; SQLiteDatabase db = null ; Cursor cursor = null ; try { db = getWritableDatabase ( ) ; // Get all records for the requested destination in the pending state . cursor = db . query ( ShareRequestTable . NAME , new String [ ] { ShareRequestTable . COLUMN_ID , ShareRequestTable . COLUMN_FILE_PATH , ShareRequestTable . COLUMN_DESTINATION } , WHERE_CLAUSE_BY_DESTINATION_AND_STATE , new String [ ] { String . valueOf ( destination . getHash ( ) ) , String . valueOf ( ShareRequest . STATE_PENDING ) } , null , null , SORT_ORDER_TIME_CREATED ) ; if ( cursor != null && cursor . moveToFirst ( ) ) { do { int id = cursor . getInt ( cursor . getColumnIndex ( ShareRequestTable . COLUMN_ID ) ) ; String filePath = cursor . getString ( cursor . getColumnIndex ( ShareRequestTable . COLUMN_FILE_PATH ) ) ; int destinationHash = cursor . getInt ( cursor . getColumnIndex ( ShareRequestTable . COLUMN_DESTINATION ) ) ; // Update state back to processing . ContentValues values = new ContentValues ( ) ; values . put ( ShareRequestTable . COLUMN_STATE , ShareRequest . STATE_PROCESSING ) ; if ( db . update ( ShareRequestTable . NAME , values , WHERE_CLAUSE_BY_ID , new String [ ] { String . valueOf ( id ) } ) > 0 ) { // Add record to list . Destination resultDestination = Destination . from ( destinationHash ) ; shareRequests . add ( new ShareRequest ( id , filePath , resultDestination ) ) ; sLogger . log ( WingsDbHelper . class , "checkoutShareRequests" , "id=" + id + " filePath=" + filePath + " destination=" + resultDestination . getHash ( ) ) ; } } while ( cursor . moveToNext ( ) ) ; } } catch ( SQLException e ) { // Do nothing . } finally { if ( cursor != null ) { cursor . close ( ) ; } db . close ( ) ; } return shareRequests ;
public class LinkUtil { /** * Makes a URL already built external ; the url should be built by the ' getUrl ' method . * @ param request the request as the externalization context * @ param url the url value ( the local URL ) * @ return */ public static String getAbsoluteUrl ( SlingHttpServletRequest request , String url ) { } }
if ( ! isExternalUrl ( url ) && url . startsWith ( "/" ) ) { String scheme = request . getScheme ( ) . toLowerCase ( ) ; url = scheme + "://" + getAuthority ( request ) + url ; } return url ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getIfcElectricHeaterTypeEnum ( ) { } }
if ( ifcElectricHeaterTypeEnumEEnum == null ) { ifcElectricHeaterTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 827 ) ; } return ifcElectricHeaterTypeEnumEEnum ;
public class ReflectionUtil { /** * Retrieves all the fields contained in the given object and its superclasses . * @ param obj the object to examine * @ param excludeStatic if true , static fields will be omitted * @ param excludeTransient if true , transient fields will be omitted * @ return a list of fields for the given object */ public static List getAllFields ( final Object obj , final boolean excludeStatic , final boolean excludeTransient ) { } }
List fieldList = new ArrayList ( ) ; for ( Class clazz = obj . getClass ( ) ; clazz != null ; clazz = clazz . getSuperclass ( ) ) { Field [ ] declaredFields = clazz . getDeclaredFields ( ) ; for ( int i = 0 ; i < declaredFields . length ; i ++ ) { int mods = declaredFields [ i ] . getModifiers ( ) ; if ( ( ! excludeStatic || ! Modifier . isStatic ( mods ) ) && ( ! excludeTransient || ! Modifier . isTransient ( mods ) ) ) { declaredFields [ i ] . setAccessible ( true ) ; fieldList . add ( declaredFields [ i ] ) ; } } } return fieldList ;
public class HBaseGridScreen { /** * display this screen in html input format . * @ return The HTML options . * @ exception DBException File exception . */ public int getPrintOptions ( ) throws DBException { } }
int iHtmlOptions = HtmlConstants . HTML_DISPLAY ; if ( ( ( BaseGridScreen ) this . getScreenField ( ) ) . getEditing ( ) ) iHtmlOptions |= HtmlConstants . HTML_INPUT ; String strParamForm = this . getProperty ( HtmlConstants . FORMS ) ; // Display record if ( ( strParamForm == null ) || ( strParamForm . length ( ) == 0 ) ) strParamForm = HtmlConstants . BOTHIFDATA ; // First , move any params up boolean bPrintReport = true ; if ( ( strParamForm . equalsIgnoreCase ( HtmlConstants . INPUT ) ) || ( strParamForm . equalsIgnoreCase ( HtmlConstants . BOTHIFDATA ) ) || ( strParamForm . equalsIgnoreCase ( HtmlConstants . BOTH ) ) ) { // For these options , check to see if the input data has been entered . bPrintReport = false ; boolean bScreenFound = false ; int iNumCols = ( ( BaseGridScreen ) this . getScreenField ( ) ) . getSFieldCount ( ) ; for ( int iIndex = 0 ; iIndex < iNumCols ; iIndex ++ ) { ScreenField sField = ( ( BaseGridScreen ) this . getScreenField ( ) ) . getSField ( iIndex ) ; if ( sField instanceof ToolScreen ) if ( ( ! ( sField instanceof DisplayToolbar ) ) && ( ! ( sField instanceof MaintToolbar ) ) && ( ! ( sField instanceof MenuToolbar ) ) ) { // Output the Input screen HScreenField vField = ( HScreenField ) sField . getScreenFieldView ( ) ; if ( vField . moveControlInput ( Constants . BLANK ) == DBConstants . NORMAL_RETURN ) // I already moved them , but I need to know if they were passed bPrintReport = true ; bScreenFound = true ; } } if ( ! bScreenFound ) bPrintReport = true ; // If no screen , say params were entered if ( ! bPrintReport ) if ( this . getProperty ( DBConstants . STRING_OBJECT_ID_HANDLE ) != null ) bPrintReport = true ; // Special Grid with a header record = found } if ( strParamForm . equalsIgnoreCase ( HtmlConstants . DISPLAY ) ) iHtmlOptions |= HtmlConstants . HTML_DISPLAY ; // No toolbar , print report else if ( strParamForm . equalsIgnoreCase ( HtmlConstants . DATA ) ) iHtmlOptions |= HtmlConstants . PRINT_TOOLBAR_BEFORE ; // Toolbar and report else if ( strParamForm . equalsIgnoreCase ( HtmlConstants . INPUT ) ) iHtmlOptions |= HtmlConstants . PRINT_TOOLBAR_BEFORE | HtmlConstants . DONT_PRINT_SCREEN ; // Toolbar , no report else if ( strParamForm . equalsIgnoreCase ( HtmlConstants . BOTH ) ) iHtmlOptions |= HtmlConstants . PRINT_TOOLBAR_BEFORE ; // Toolbar and report else if ( strParamForm . equalsIgnoreCase ( HtmlConstants . BOTHIFDATA ) ) { iHtmlOptions |= HtmlConstants . PRINT_TOOLBAR_BEFORE ; // Toolscreen is always displayed if ( ! bPrintReport ) iHtmlOptions |= HtmlConstants . DONT_PRINT_SCREEN ; } return iHtmlOptions ;
public class ResourceAddressFactory { /** * Creates a new resource address for the given location and options * @ param options cannot be null , otherwise NullPointerException is thrown * @ return resource address */ public ResourceAddress newResourceAddress ( String location , ResourceOptions options ) { } }
return newResourceAddress ( location , options , null /* qualifier */ ) ;
public class BackedHashMap { /** * Method used to keep track of ids that have been recently invalidated . If the checkRecentlyInvalidList * property is set and we know that it has been recently invalidated , we will not query the backend for * this session . */ protected void addToRecentlyInvalidatedList ( String id ) { } }
if ( ! _smc . getCheckRecentlyInvalidList ( ) ) return ; if ( com . ibm . websphere . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , "addToRecentlyInvalidatedList" , "Adding to recently InvalidatedList" ) ; } synchronized ( recentInvalidIds ) { recentInvalidIds . put ( id , id ) ; }