signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class NfsAccessResponse { /** * ( non - Javadoc )
* @ see com . emc . ecs . nfsclient . nfs . NfsResponseBase # unmarshalling ( com . emc . ecs .
* nfsclient . rpc . Xdr ) */
public void unmarshalling ( Xdr xdr ) throws RpcException { } } | super . unmarshalling ( xdr ) ; unmarshallingAttributes ( xdr ) ; if ( stateIsOk ( ) ) { _access = xdr . getUnsignedInt ( ) ; } |
public class Matchers { /** * Matches a type cast AST node if both of the given matchers match .
* @ param typeMatcher The matcher to apply to the type .
* @ param expressionMatcher The matcher to apply to the expression . */
public static Matcher < TypeCastTree > typeCast ( final Matcher < Tree > typeMatcher , final Matcher < ExpressionTree > expressionMatcher ) { } } | return new Matcher < TypeCastTree > ( ) { @ Override public boolean matches ( TypeCastTree t , VisitorState state ) { return typeMatcher . matches ( t . getType ( ) , state ) && expressionMatcher . matches ( t . getExpression ( ) , state ) ; } } ; |
public class AbstractLifecycle { /** * Executes stages until the stage requested has been reached .
* @ param lifecycleStage The lifecycle stage to reach .
* @ throws IllegalStateException If the cycle ends before this stage is reached . */
@ Override public void executeTo ( @ Nonnull final LifecycleStage lifecycleStage ) { } } | boolean foundStage = false ; do { final LifecycleStage nextStage = lifecycleDriver . getNextStage ( ) ; if ( nextStage == null ) { throw new IllegalStateException ( "Never reached stage '" + lifecycleStage . getName ( ) + "' before ending the lifecycle." ) ; } foundStage = nextStage . equals ( lifecycleStage ) ; execute ( nextStage ) ; } while ( ! foundStage ) ; |
public class HelloSignClient { /** * Retrieves the final PDF copy of a signature request , if it exists .
* @ param requestId String SignatureRequest ID
* @ return File final copy file , or null if it does not yet exist
* @ throws HelloSignException thrown if there ' s a problem processing the
* HTTP request or the JSON response .
* @ deprecated Use { { @ link # getFiles ( String ) } */
public File getFinalCopy ( String requestId ) throws HelloSignException { } } | String url = BASE_URI + SIGNATURE_REQUEST_FINAL_COPY_URI + "/" + requestId ; String filename = FINAL_COPY_FILE_NAME + "." + FINAL_COPY_FILE_EXT ; return httpClient . withAuth ( auth ) . get ( url ) . asFile ( filename ) ; |
public class PropertyConverter { /** * Converts a string denoting an amount of time into milliseconds and adds it to the current date . Strings are expected to follow this form where # equals a digit : # M The following are permitted for denoting time : H = hours , M = minutes , S = seconds
* @ param time
* time
* @ return time in milliseconds */
public static long convertStringToFutureTimeMillis ( String time ) { } } | Calendar exp = Calendar . getInstance ( ) ; if ( time . endsWith ( "H" ) ) { exp . add ( Calendar . HOUR , Integer . valueOf ( StringUtils . remove ( time , 'H' ) ) ) ; } else if ( time . endsWith ( "M" ) ) { exp . add ( Calendar . MINUTE , Integer . valueOf ( StringUtils . remove ( time , 'M' ) ) ) ; } else if ( time . endsWith ( "S" ) ) { exp . add ( Calendar . MILLISECOND , Integer . valueOf ( StringUtils . remove ( time , 'S' ) ) * 1000 ) ; } return exp . getTimeInMillis ( ) ; |
public class PrivateZonesInner { /** * Updates a Private DNS zone . Does not modify virtual network links or DNS records within the zone .
* @ param resourceGroupName The name of the resource group .
* @ param privateZoneName The name of the Private DNS zone ( without a terminating dot ) .
* @ param parameters Parameters supplied to the Update operation .
* @ param ifMatch The ETag of the Private DNS zone . Omit this value to always overwrite the current zone . Specify the last - seen ETag value to prevent accidentally overwriting any concurrent changes .
* @ 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 < PrivateZoneInner > beginUpdateAsync ( String resourceGroupName , String privateZoneName , PrivateZoneInner parameters , String ifMatch , final ServiceCallback < PrivateZoneInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( beginUpdateWithServiceResponseAsync ( resourceGroupName , privateZoneName , parameters , ifMatch ) , serviceCallback ) ; |
public class MultiRuntimeConfigurationBuilder { /** * Sets the submission runtime . Submission runtime is used for launching the job driver .
* @ param runtimeName the submission runtime name
* @ return The builder instance */
public MultiRuntimeConfigurationBuilder setSubmissionRuntime ( final String runtimeName ) { } } | Validate . isTrue ( SUPPORTED_SUBMISSION_RUNTIMES . contains ( runtimeName ) , "Unsupported submission runtime " + runtimeName ) ; Validate . isTrue ( this . submissionRuntime == null , "Submission runtime was already added" ) ; this . submissionRuntime = runtimeName ; return this ; |
public class CmsSimpleSearchConfigurationParser { /** * Returns the initial SOLR query . < p >
* @ return the SOLR query */
public CmsSolrQuery getInitialQuery ( ) { } } | Map < String , String [ ] > queryParams = new HashMap < String , String [ ] > ( ) ; if ( ! m_cms . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) && m_config . isShowExpired ( ) ) { queryParams . put ( "fq" , new String [ ] { "released:[* TO *]" , "expired:[* TO *]" } ) ; } return new CmsSolrQuery ( null , queryParams ) ; |
public class EncodingWriter { /** * Writes a character buffer using the correct encoding .
* @ param cbuf character buffer receiving the data .
* @ param off starting offset into the buffer .
* @ param len number of characters to write
* @ return */
public int write ( OutputStreamWithBuffer os , char [ ] cbuf , int off , int len ) throws IOException { } } | for ( int i = 0 ; i < len ; i ++ ) { write ( os , cbuf [ off + i ] ) ; } return len ; |
public class BigRational { /** * Reduces this rational number to the smallest numerator / denominator with the same value .
* @ return the reduced rational number */
public BigRational reduce ( ) { } } | BigInteger n = numerator . toBigInteger ( ) ; BigInteger d = denominator . toBigInteger ( ) ; BigInteger gcd = n . gcd ( d ) ; n = n . divide ( gcd ) ; d = d . divide ( gcd ) ; return valueOf ( n , d ) ; |
public class MetadataWriter { /** * Returns the modifiers for a specified type , including internal ones .
* All class modifiers are defined in the JVM specification , table 4.1. */
private static int getTypeModifiers ( TypeElement type ) { } } | int modifiers = ElementUtil . fromModifierSet ( type . getModifiers ( ) ) ; if ( type . getKind ( ) . isInterface ( ) ) { modifiers |= java . lang . reflect . Modifier . INTERFACE | java . lang . reflect . Modifier . ABSTRACT | java . lang . reflect . Modifier . STATIC ; } if ( ElementUtil . isSynthetic ( type ) ) { modifiers |= ElementUtil . ACC_SYNTHETIC ; } if ( ElementUtil . isAnnotationType ( type ) ) { modifiers |= ElementUtil . ACC_ANNOTATION ; } if ( ElementUtil . isEnum ( type ) ) { modifiers |= ElementUtil . ACC_ENUM ; } if ( ElementUtil . isAnonymous ( type ) ) { modifiers |= ElementUtil . ACC_ANONYMOUS ; } return modifiers ; |
public class ImmutableMatrixFactory { /** * Returns an immutable identity matrix of the specified dimension .
* @ param size the dimension of the matrix
* @ return a < code > size < / code > × < code > size < / code > identity matrix
* @ throws IllegalArgumentException if the size is not positive */
public static ImmutableMatrix identity ( final int size ) { } } | if ( size <= 0 ) throw new IllegalArgumentException ( "Invalid size" ) ; return create ( new ImmutableData ( size , size ) { @ Override public double getQuick ( int row , int col ) { return row == col ? 1 : 0 ; } } ) ; |
public class FamilyOrderAnalyzer { /** * { @ inheritDoc } */
@ Override public OrderAnalyzerResult analyze ( ) { } } | seenFamily = null ; final PersonNavigator navigator = new PersonNavigator ( person ) ; for ( final Family family : navigator . getFamilies ( ) ) { setCurrentDate ( null ) ; setSeenEvent ( null ) ; checkFamily ( family ) ; } return getResult ( ) ; |
public class Krb5TokenUtils { /** * Generate the service ticket that will be passed to the cluster master for authentication */
public static byte [ ] initiateSecurityContext ( Subject subject , String servicePrincipalName ) throws GSSException { } } | GSSManager manager = GSSManager . getInstance ( ) ; GSSName serverName = manager . createName ( servicePrincipalName , GSSName . NT_HOSTBASED_SERVICE ) ; final GSSContext context = manager . createContext ( serverName , krb5Oid , null , GSSContext . DEFAULT_LIFETIME ) ; // The GSS context initiation has to be performed as a privileged action .
return Subject . doAs ( subject , ( PrivilegedAction < byte [ ] > ) ( ) -> { try { byte [ ] token = new byte [ 0 ] ; // This is a one pass context initialization .
context . requestMutualAuth ( false ) ; context . requestCredDeleg ( false ) ; return context . initSecContext ( token , 0 , token . length ) ; } catch ( GSSException e ) { log . error ( Util . getMessage ( "Krb5TokenKerberosContextProcessingException" ) , e ) ; return null ; } } ) ; |
public class DSUtil { /** * Put in < code > newColl < / code > all elements of < code > coll < / code >
* that satisfy the predicate < code > pred < / code > .
* @ return newColl , the collection with the filtered elements . */
public static < E > Collection < E > filterColl ( Iterable < E > coll , Predicate < E > pred , Collection < E > newColl ) { } } | for ( E elem : coll ) { if ( pred . check ( elem ) ) { newColl . add ( elem ) ; } } return newColl ; |
public class ComputerMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Computer computer , ProtocolMarshaller protocolMarshaller ) { } } | if ( computer == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( computer . getComputerId ( ) , COMPUTERID_BINDING ) ; protocolMarshaller . marshall ( computer . getComputerName ( ) , COMPUTERNAME_BINDING ) ; protocolMarshaller . marshall ( computer . getComputerAttributes ( ) , COMPUTERATTRIBUTES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Parameters { /** * Recherche la valeur d ' un paramètre qui peut être défini par ordre de priorité croissant : < br / >
* - dans les paramètres d ' initialisation du filtre ( fichier web . xml dans la webapp ) < br / >
* - dans les paramètres du contexte de la webapp avec le préfixe " javamelody . " ( fichier xml de contexte dans Tomcat ) < br / >
* - dans les variables d ' environnement du système d ' exploitation avec le préfixe " javamelody . " < br / >
* - dans les propriétés systèmes avec le préfixe " javamelody . " ( commande de lancement java ) .
* @ param parameter Enum du paramètre
* @ return valeur du paramètre ou null si pas de paramètre défini */
public static String getParameterValue ( Parameter parameter ) { } } | assert parameter != null ; final String name = parameter . getCode ( ) ; return getParameterValueByName ( name ) ; |
public class Iterators { /** * Creates an iterator which subsequently iterates over all given iterators .
* @ param iterators An array of iterators .
* @ return A composite iterator iterating the values of all given iterators
* in given order . */
@ SafeVarargs public static < T > ElementIterator < T > compositeIterator ( Iterator < T > ... iterators ) { } } | Require . nonNull ( iterators , "iterators" ) ; final Iterator < T > result ; if ( iterators . length == 0 ) { result = Collections . emptyIterator ( ) ; } else if ( iterators . length == 1 ) { if ( iterators [ 0 ] instanceof ElementIterator < ? > ) { return ( ElementIterator < T > ) iterators [ 0 ] ; } result = iterators [ 0 ] ; } else { result = new CompoundIterator < > ( iterators ) ; } return ElementIterator . wrap ( result ) ; |
public class ServiceRemoveStepHandler { /** * If the { @ link OperationContext # isResourceServiceRestartAllowed ( ) context allows resource removal } ,
* attempts to restore services by invoking the { @ code performRuntime } method on the @ { code addOperation }
* handler passed to the constructor ; otherwise puts the process in reload - required state .
* { @ inheritDoc } */
@ Override protected void recoverServices ( OperationContext context , ModelNode operation , ModelNode model ) throws OperationFailedException { } } | if ( context . isResourceServiceRestartAllowed ( ) ) { addOperation . performRuntime ( context , operation , model ) ; } else { context . revertReloadRequired ( ) ; } |
public class CommerceWarehouseLocalServiceBaseImpl { /** * Updates the commerce warehouse in the database or adds it if it does not yet exist . Also notifies the appropriate model listeners .
* @ param commerceWarehouse the commerce warehouse
* @ return the commerce warehouse that was updated */
@ Indexable ( type = IndexableType . REINDEX ) @ Override public CommerceWarehouse updateCommerceWarehouse ( CommerceWarehouse commerceWarehouse ) { } } | return commerceWarehousePersistence . update ( commerceWarehouse ) ; |
public class SerializerIntrinsics { /** * Insert Dword ( SSE4.1 ) . */
public final void pinsrd ( XMMRegister dst , Register src , Immediate imm8 ) { } } | emitX86 ( INST_PINSRD , dst , src , imm8 ) ; |
public class SkuManager { /** * Returns a list of SKU for a store .
* @ param appstoreName The app store name .
* @ return list of SKU that mapped to the store . Null if the store has no mapped SKUs .
* @ throws java . lang . IllegalArgumentException If the store name is null or empty .
* @ see # mapSku ( String , String , String ) */
@ Nullable public List < String > getAllStoreSkus ( @ NotNull final String appstoreName ) { } } | if ( TextUtils . isEmpty ( appstoreName ) ) { throw SkuMappingException . newInstance ( SkuMappingException . REASON_STORE_NAME ) ; } Map < String , String > skuMap = sku2storeSkuMappings . get ( appstoreName ) ; return skuMap == null ? null : Collections . unmodifiableList ( new ArrayList < String > ( skuMap . values ( ) ) ) ; |
public class AsyncLookupInBuilder { /** * Get the count of values inside the JSON document .
* This method is only available with Couchbase Server 5.0 and later .
* @ param path the path inside the document where to get the count from .
* @ param optionsBuilder { @ link SubdocOptionsBuilder }
* @ return this builder for chaining . */
public AsyncLookupInBuilder getCount ( String path , SubdocOptionsBuilder optionsBuilder ) { } } | if ( path == null ) { throw new IllegalArgumentException ( "Path is mandatory for subdoc get count" ) ; } if ( optionsBuilder . createPath ( ) ) { throw new IllegalArgumentException ( "Options createPath are not supported for lookup" ) ; } this . specs . add ( new LookupSpec ( Lookup . GET_COUNT , path , optionsBuilder ) ) ; return this ; |
public class PdfCopyForms { /** * Concatenates a PDF document selecting the pages to keep . The pages are described as
* ranges . The page ordering can be changed but
* no page repetitions are allowed .
* @ param reader the PDF document
* @ param ranges the comma separated ranges as described in { @ link SequenceList }
* @ throws DocumentException on error */
public void addDocument ( PdfReader reader , String ranges ) throws DocumentException , IOException { } } | fc . addDocument ( reader , SequenceList . expand ( ranges , reader . getNumberOfPages ( ) ) ) ; |
public class ModelsEngine { /** * Verify if the current station ( i ) is already into the arrays .
* @ param xStation the x coordinate of the stations
* @ param yStation the y coordinate of the stations
* @ param zStation the z coordinate of the stations
* @ param hStation the h value of the stations
* @ param xTmp
* @ param yTmp
* @ param zTmp
* @ param hTmp
* @ param i the current index
* @ param doMean if the h value of a double station have different value then do the mean .
* @ param pm
* @ return true if there is already this station .
* @ throws Exception */
public static boolean verifyDoubleStation ( double [ ] xStation , double [ ] yStation , double [ ] zStation , double [ ] hStation , double xTmp , double yTmp , double zTmp , double hTmp , int i , boolean doMean , IHMProgressMonitor pm ) throws Exception { } } | for ( int j = 0 ; j < i - 1 ; j ++ ) { if ( dEq ( xTmp , xStation [ j ] ) && dEq ( yTmp , yStation [ j ] ) && dEq ( zTmp , zStation [ j ] ) && dEq ( hTmp , hStation [ j ] ) ) { if ( ! doMean ) { throw new IllegalArgumentException ( msg . message ( "verifyStation.equalsStation1" ) + xTmp + "/" + yTmp ) ; } return true ; } else if ( dEq ( xTmp , xStation [ j ] ) && dEq ( yTmp , yStation [ j ] ) && dEq ( zTmp , zStation [ j ] ) ) { if ( ! doMean ) { throw new IllegalArgumentException ( msg . message ( "verifyStation.equalsStation2" ) + xTmp + "/" + yTmp ) ; } if ( ! isNovalue ( hStation [ j ] ) && ! isNovalue ( hTmp ) ) { hStation [ j ] = ( hStation [ j ] + hTmp ) / 2 ; } else { hStation [ j ] = doubleNovalue ; } return true ; } } return false ; |
public class JvmAnnotationValueImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case TypesPackage . JVM_ANNOTATION_VALUE__OPERATION : return operation != null ; } return super . eIsSet ( featureID ) ; |
public class JWSHeader { /** * Construct JWSHeader from json string .
* @ param json
* json string .
* @ return Constructed JWSHeader */
public static JWSHeader deserialize ( String json ) throws IOException { } } | ObjectMapper mapper = new ObjectMapper ( ) ; return mapper . readValue ( json , JWSHeader . class ) ; |
public class SyncRemoteTable { /** * Update the current record .
* @ param The data to update .
* @ exception DBException File exception . */
public void set ( Object data , int iOpenMode ) throws DBException , RemoteException { } } | synchronized ( m_objSync ) { m_tableRemote . set ( data , iOpenMode ) ; } |
public class JdbcUtil { /** * Executes the specified SQL with the specified params and connection . . .
* @ param sql the specified SQL
* @ param paramList the specified params
* @ param connection the specified connection
* @ param isDebug the specified debug flag
* @ return { @ code true } if success , returns { @ false } otherwise
* @ throws SQLException SQLException */
public static boolean executeSql ( final String sql , final List < Object > paramList , final Connection connection , final boolean isDebug ) throws SQLException { } } | if ( isDebug || LOGGER . isTraceEnabled ( ) ) { LOGGER . log ( Level . INFO , "Executing SQL [" + sql + "]" ) ; } final PreparedStatement preparedStatement = connection . prepareStatement ( sql ) ; for ( int i = 1 ; i <= paramList . size ( ) ; i ++ ) { preparedStatement . setObject ( i , paramList . get ( i - 1 ) ) ; } final boolean isSuccess = preparedStatement . execute ( ) ; preparedStatement . close ( ) ; return isSuccess ; |
public class LocalSuffixFinders { /** * Searches for a distinguishing suffixes by checking for counterexample yielding access sequence transformations in
* linear ascending order .
* @ param ceQuery
* the initial counterexample query
* @ param asTransformer
* the access sequence transformer
* @ param hypOutput
* interface to the hypothesis output , for checking whether the oracle output contradicts the hypothesis
* @ param oracle
* interface to the SUL
* @ return the index of the respective suffix , or { @ code - 1 } if no counterexample could be found
* @ see LocalSuffixFinder */
public static < S , I , D > int findLinear ( Query < I , D > ceQuery , AccessSequenceTransformer < I > asTransformer , SuffixOutput < I , D > hypOutput , MembershipOracle < I , D > oracle ) { } } | return AcexLocalSuffixFinder . findSuffixIndex ( AcexAnalyzers . LINEAR_FWD , true , ceQuery , asTransformer , hypOutput , oracle ) ; |
public class sms_server { /** * < pre >
* Performs generic data validation for the operation to be performed
* < / pre > */
protected void validate ( String operationType ) throws Exception { } } | super . validate ( operationType ) ; MPSString id_validator = new MPSString ( ) ; id_validator . setConstraintIsReq ( MPSConstants . DELETE_CONSTRAINT , true ) ; id_validator . setConstraintIsReq ( MPSConstants . MODIFY_CONSTRAINT , true ) ; id_validator . validate ( operationType , id , "\"id\"" ) ; MPSString server_name_validator = new MPSString ( ) ; server_name_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; server_name_validator . setConstraintMinStrLen ( MPSConstants . GENERIC_CONSTRAINT , 1 ) ; server_name_validator . setConstraintIsReq ( MPSConstants . ADD_CONSTRAINT , true ) ; server_name_validator . validate ( operationType , server_name , "\"server_name\"" ) ; MPSString username_key_validator = new MPSString ( ) ; username_key_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; username_key_validator . validate ( operationType , username_key , "\"username_key\"" ) ; MPSString username_val_validator = new MPSString ( ) ; username_val_validator . setConstraintCharSetRegEx ( MPSConstants . GENERIC_CONSTRAINT , "[ a-zA-Z0-9_#.:@=-]+" ) ; username_val_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; username_val_validator . validate ( operationType , username_val , "\"username_val\"" ) ; MPSString password_key_validator = new MPSString ( ) ; password_key_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; password_key_validator . validate ( operationType , password_key , "\"password_key\"" ) ; MPSString password_val_validator = new MPSString ( ) ; password_val_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; password_val_validator . validate ( operationType , password_val , "\"password_val\"" ) ; MPSString optional1_key_validator = new MPSString ( ) ; optional1_key_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; optional1_key_validator . validate ( operationType , optional1_key , "\"optional1_key\"" ) ; MPSString optional1_val_validator = new MPSString ( ) ; optional1_val_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; optional1_val_validator . validate ( operationType , optional1_val , "\"optional1_val\"" ) ; MPSString optional2_key_validator = new MPSString ( ) ; optional2_key_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; optional2_key_validator . validate ( operationType , optional2_key , "\"optional2_key\"" ) ; MPSString optional2_val1_validator = new MPSString ( ) ; optional2_val1_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; optional2_val1_validator . validate ( operationType , optional2_val1 , "\"optional2_val1\"" ) ; MPSString optional3_key_validator = new MPSString ( ) ; optional3_key_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; optional3_key_validator . validate ( operationType , optional3_key , "\"optional3_key\"" ) ; MPSString optional3_val_validator = new MPSString ( ) ; optional3_val_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; optional3_val_validator . validate ( operationType , optional3_val , "\"optional3_val\"" ) ; MPSString base_url_validator = new MPSString ( ) ; base_url_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 2000 ) ; base_url_validator . validate ( operationType , base_url , "\"base_url\"" ) ; MPSString to_key_validator = new MPSString ( ) ; to_key_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; to_key_validator . validate ( operationType , to_key , "\"to_key\"" ) ; MPSString to_seperater_validator = new MPSString ( ) ; to_seperater_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; to_seperater_validator . validate ( operationType , to_seperater , "\"to_seperater\"" ) ; MPSString message_key_validator = new MPSString ( ) ; message_key_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; message_key_validator . validate ( operationType , message_key , "\"message_key\"" ) ; MPSString message_word_sperater_validator = new MPSString ( ) ; message_word_sperater_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; message_word_sperater_validator . validate ( operationType , message_word_sperater , "\"message_word_sperater\"" ) ; MPSString type_validator = new MPSString ( ) ; type_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; type_validator . validate ( operationType , type , "\"type\"" ) ; MPSBoolean is_ssl_validator = new MPSBoolean ( ) ; is_ssl_validator . validate ( operationType , is_ssl , "\"is_ssl\"" ) ; |
public class Serializer { /** * Converts a signed int to a variable length byte array .
* The first bit is for continuation info , the other six ( last byte ) or seven ( all other bytes ) bits for data . The
* second bit in the last byte indicates the sign of the number .
* @ param value the int value .
* @ return an array with 1-5 bytes . */
public static byte [ ] getVariableByteSigned ( int value ) { } } | long absValue = Math . abs ( ( long ) value ) ; if ( absValue < 64 ) { // 2 ^ 6
// encode the number in a single byte
if ( value < 0 ) { return new byte [ ] { ( byte ) ( absValue | 0x40 ) } ; } return new byte [ ] { ( byte ) absValue } ; } else if ( absValue < 8192 ) { // 2 ^ 13
// encode the number in two bytes
if ( value < 0 ) { return new byte [ ] { ( byte ) ( absValue | 0x80 ) , ( byte ) ( ( absValue >> 7 ) | 0x40 ) } ; } return new byte [ ] { ( byte ) ( absValue | 0x80 ) , ( byte ) ( absValue >> 7 ) } ; } else if ( absValue < 1048576 ) { // 2 ^ 20
// encode the number in three bytes
if ( value < 0 ) { return new byte [ ] { ( byte ) ( absValue | 0x80 ) , ( byte ) ( ( absValue >> 7 ) | 0x80 ) , ( byte ) ( ( absValue >> 14 ) | 0x40 ) } ; } return new byte [ ] { ( byte ) ( absValue | 0x80 ) , ( byte ) ( ( absValue >> 7 ) | 0x80 ) , ( byte ) ( absValue >> 14 ) } ; } else if ( absValue < 134217728 ) { // 2 ^ 27
// encode the number in four bytes
if ( value < 0 ) { return new byte [ ] { ( byte ) ( absValue | 0x80 ) , ( byte ) ( ( absValue >> 7 ) | 0x80 ) , ( byte ) ( ( absValue >> 14 ) | 0x80 ) , ( byte ) ( ( absValue >> 21 ) | 0x40 ) } ; } return new byte [ ] { ( byte ) ( absValue | 0x80 ) , ( byte ) ( ( absValue >> 7 ) | 0x80 ) , ( byte ) ( ( absValue >> 14 ) | 0x80 ) , ( byte ) ( absValue >> 21 ) } ; } else { // encode the number in five bytes
if ( value < 0 ) { return new byte [ ] { ( byte ) ( absValue | 0x80 ) , ( byte ) ( ( absValue >> 7 ) | 0x80 ) , ( byte ) ( ( absValue >> 14 ) | 0x80 ) , ( byte ) ( ( absValue >> 21 ) | 0x80 ) , ( byte ) ( ( absValue >> 28 ) | 0x40 ) } ; } return new byte [ ] { ( byte ) ( absValue | 0x80 ) , ( byte ) ( ( absValue >> 7 ) | 0x80 ) , ( byte ) ( ( absValue >> 14 ) | 0x80 ) , ( byte ) ( ( absValue >> 21 ) | 0x80 ) , ( byte ) ( absValue >> 28 ) } ; } |
public class AbstractMBeanServerExecutor { /** * { @ inheritDoc } */
public < T > T call ( ObjectName pObjectName , MBeanAction < T > pMBeanAction , Object ... pExtraArgs ) throws IOException , ReflectionException , MBeanException , AttributeNotFoundException , InstanceNotFoundException { } } | InstanceNotFoundException objNotFoundException = null ; for ( MBeanServerConnection server : getMBeanServers ( ) ) { // Only the first MBeanServer holding the MBean wins
try { // Still to decide : Should we check eagerly or let an InstanceNotFound Exception
// bubble ? Exception bubbling was the former behaviour , so it is left in . However ,
// it would be interesting how large the performance impact is here . All unit tests BTW are
// prepared for switching the guard below on or off .
// if ( server . isRegistered ( pObjectName ) ) {
return pMBeanAction . execute ( server , pObjectName , pExtraArgs ) ; } catch ( InstanceNotFoundException exp ) { // Remember exceptions for later use
objNotFoundException = exp ; } } // Must be ! = null , otherwise we would not have left the loop
throw objNotFoundException ; // When we reach this , no MBeanServer know about the requested MBean .
// Hence , we throw our own InstanceNotFoundException here
// throw exception ! = null ?
// new IllegalArgumentException ( errorMsg + " : " + exception , exception ) :
// new IllegalArgumentException ( errorMsg ) ; |
public class AbstractServerConnection { /** * Resets the channel to its original state , effectively disabling all current conduit
* wrappers . The current state is encapsulated inside a { @ link ConduitState } object that
* can be used the restore the channel .
* @ return An opaque representation of the previous channel state */
public ConduitState resetChannel ( ) { } } | ConduitState ret = new ConduitState ( channel . getSinkChannel ( ) . getConduit ( ) , channel . getSourceChannel ( ) . getConduit ( ) ) ; channel . getSinkChannel ( ) . setConduit ( originalSinkConduit ) ; channel . getSourceChannel ( ) . setConduit ( originalSourceConduit ) ; return ret ; |
public class MathBindings { /** * Binding for { @ link java . lang . Math # copySign ( float , float ) }
* @ param magnitude the parameter providing the magnitude of the result
* @ param sign the parameter providing the sign of the result
* @ return a value with the magnitude of { @ code magnitude }
* and the sign of { @ code sign } . */
public static FloatBinding copySign ( final ObservableFloatValue magnitude , ObservableFloatValue sign ) { } } | return createFloatBinding ( ( ) -> Math . copySign ( magnitude . get ( ) , sign . get ( ) ) , magnitude , sign ) ; |
public class ImageStatistics { /** * Returns the sum of all the pixels in the image .
* @ param img Input image . Not modified . */
public static int sum ( GrayS32 img ) { } } | if ( BoofConcurrency . USE_CONCURRENT ) { return ImplImageStatistics_MT . sum ( img ) ; } else { return ImplImageStatistics . sum ( img ) ; } |
public class MergedClass { /** * Just create the bytecode for the merged class , but don ' t load it . Since
* no ClassInjector is provided to resolve name conflicts , the class name
* must be manually provided .
* @ param className name to give to merged class
* @ param classes Source classes used to derive merged class
* @ param prefixes Optional prefixes to apply to methods of each generated
* class to eliminate duplicate method names */
public static ClassFile buildClassFile ( String className , Class < ? > [ ] classes , String [ ] prefixes ) { } } | return buildClassFile ( className , classes , prefixes , null , OBSERVER_DISABLED ) ; |
public class PsiToBiopax3Converter { /** * Converts the PSI - MITAB inputStream into BioPAX outputStream .
* Streams will be closed by the converter .
* @ param inputStream psi - mitab
* @ param outputStream biopax
* @ param forceInteractionToComplex - always generate Complex instead of MolecularInteraction
* @ throws IOException when an I / O error occur
* @ throws PsimiTabException when there ' s a problem within the PSI - MITAB parser */
public void convertTab ( InputStream inputStream , OutputStream outputStream , boolean forceInteractionToComplex ) throws IOException , PsimiTabException { } } | // check args
if ( inputStream == null || outputStream == null ) { throw new IllegalArgumentException ( "convertTab(): " + "one or more null arguments." ) ; } // unmarshall the data , close the stream
PsimiTabReader reader = new PsimiTabReader ( ) ; Collection < BinaryInteraction > interactions = reader . read ( inputStream ) ; Tab2Xml tab2Xml = new Tab2Xml ( ) ; EntrySet entrySet ; try { entrySet = tab2Xml . convert ( interactions ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; } catch ( XmlConversionException e ) { throw new RuntimeException ( e ) ; } inputStream . close ( ) ; // convert
convert ( entrySet , outputStream , forceInteractionToComplex ) ; |
public class FieldMap { /** * Creates a field map for resources .
* @ param props props data */
public void createResourceFieldMap ( Props props ) { } } | byte [ ] fieldMapData = null ; for ( Integer key : RESOURCE_KEYS ) { fieldMapData = props . getByteArray ( key ) ; if ( fieldMapData != null ) { break ; } } if ( fieldMapData == null ) { populateDefaultData ( getDefaultResourceData ( ) ) ; } else { createFieldMap ( fieldMapData ) ; } |
public class AbstractCacheService { /** * Registers and { @ link com . hazelcast . cache . impl . CacheEventListener } for specified { @ code cacheNameWithPrefix }
* @ param cacheNameWithPrefix the full name of the cache ( including manager scope prefix )
* that { @ link com . hazelcast . cache . impl . CacheEventListener } will be registered for
* @ param listener the { @ link com . hazelcast . cache . impl . CacheEventListener } to be registered
* for specified { @ code cacheNameWithPrefix }
* @ param localOnly true if only events originated from this member wants be listened , false if all
* invalidation events in the cluster wants to be listened
* @ return the ID which is unique for current registration */
@ Override public String addInvalidationListener ( String cacheNameWithPrefix , CacheEventListener listener , boolean localOnly ) { } } | EventService eventService = nodeEngine . getEventService ( ) ; EventRegistration registration ; if ( localOnly ) { registration = eventService . registerLocalListener ( SERVICE_NAME , cacheNameWithPrefix , listener ) ; } else { registration = eventService . registerListener ( SERVICE_NAME , cacheNameWithPrefix , listener ) ; } return registration . getId ( ) ; |
public class BatchDetachFromIndexResponseMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BatchDetachFromIndexResponse batchDetachFromIndexResponse , ProtocolMarshaller protocolMarshaller ) { } } | if ( batchDetachFromIndexResponse == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( batchDetachFromIndexResponse . getDetachedObjectIdentifier ( ) , DETACHEDOBJECTIDENTIFIER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ConfiguredEqualsVerifier { /** * Adds a factory to generate prefabricated values for instance fields of
* classes with 1 generic type parameter that EqualsVerifier cannot
* instantiate by itself .
* @ param < S > The class of the prefabricated values .
* @ param otherType The class of the prefabricated values .
* @ param factory A factory to generate an instance of { @ code S } , given a
* value of its generic type parameter .
* @ return { @ code this } , for easy method chaining .
* @ throws NullPointerException if either { @ code otherType } or
* { @ code factory } is null . */
public < S > ConfiguredEqualsVerifier withGenericPrefabValues ( Class < S > otherType , Func1 < ? , S > factory ) { } } | PrefabValuesApi . addGenericPrefabValues ( factoryCache , otherType , factory ) ; return this ; |
public class CorpusAdministration { /** * / / / Helper */
protected void writeDatabasePropertiesFile ( String host , String port , String database , String user , String password , boolean useSSL , String schema ) { } } | File file = new File ( System . getProperty ( "annis.home" ) + "/conf" , "database.properties" ) ; try ( BufferedWriter writer = new BufferedWriter ( new FileWriterWithEncoding ( file , "UTF-8" ) ) ; ) { writer . write ( "# database configuration\n" ) ; writer . write ( "datasource.driver=org.postgresql.Driver\n" ) ; writer . write ( "datasource.url=jdbc:postgresql://" + host + ":" + port + "/" + database + "\n" ) ; writer . write ( "datasource.username=" + user + "\n" ) ; writer . write ( "datasource.password=" + password + "\n" ) ; writer . write ( "datasource.ssl=" + ( useSSL ? "true" : "false" ) + "\n" ) ; if ( schema != null ) { writer . write ( "datasource.schema=" + schema + "\n" ) ; } } catch ( IOException e ) { log . error ( "Couldn't write database properties file" , e ) ; throw new FileAccessException ( e ) ; } log . info ( "Wrote database configuration to " + file . getAbsolutePath ( ) ) ; |
public class QuickSort { /** * Conditional swap , only swaps the values if array [ i ] & gt ; array [ j ]
* @ param array the array to potentially swap values in
* @ param i the 1st index
* @ param j the 2nd index */
public static void swapC ( double [ ] array , int i , int j ) { } } | double tmp_i = array [ i ] ; double tmp_j = array [ j ] ; if ( tmp_i > tmp_j ) { array [ i ] = tmp_j ; array [ j ] = tmp_i ; } |
public class OperatorSimplifyCursor { /** * Reviewed vs . Feb 8 2011 */
@ Override public Geometry next ( ) { } } | Geometry geometry ; if ( ( geometry = m_inputGeometryCursor . next ( ) ) != null ) // if ( geometry =
// m _ inputGeometryCursor - > Next ( ) )
{ m_index = m_inputGeometryCursor . getGeometryID ( ) ; if ( ( m_progressTracker != null ) && ! ( m_progressTracker . progress ( - 1 , - 1 ) ) ) throw new RuntimeException ( "user_canceled" ) ; return simplify ( geometry ) ; } return null ; |
public class OperationSlaveStepHandler { /** * Directly handles the op in the standard way the default prepare step handler would
* @ param context the operation execution context
* @ param operation the operation
* @ throws OperationFailedException if no handler is registered for the operation */
private void addBasicStep ( OperationContext context , ModelNode operation , ModelNode localReponse ) throws OperationFailedException { } } | final String operationName = operation . require ( OP ) . asString ( ) ; final PathAddress pathAddress = PathAddress . pathAddress ( operation . get ( OP_ADDR ) ) ; final OperationEntry entry = context . getRootResourceRegistration ( ) . getOperationEntry ( pathAddress , operationName ) ; if ( entry != null ) { if ( ! context . isBooting ( ) && entry . getType ( ) == OperationEntry . EntryType . PRIVATE && operation . hasDefined ( OPERATION_HEADERS , CALLER_TYPE ) && USER . equals ( operation . get ( OPERATION_HEADERS , CALLER_TYPE ) . asString ( ) ) ) { throw new OperationFailedException ( ControllerLogger . ROOT_LOGGER . noHandlerForOperation ( operationName , pathAddress ) ) ; } if ( context . isBooting ( ) || localHostControllerInfo . isMasterDomainController ( ) ) { context . addModelStep ( localReponse , operation , entry . getOperationDefinition ( ) , entry . getOperationHandler ( ) , false ) ; } else { final OperationStepHandler wrapper ; // For slave host controllers wrap the operation handler to synchronize missing configuration
// TODO better configuration of ignore unaffected configuration
if ( localHostControllerInfo . isRemoteDomainControllerIgnoreUnaffectedConfiguration ( ) ) { final PathAddress address = PathAddress . pathAddress ( operation . require ( OP_ADDR ) ) ; wrapper = SyncModelOperationHandlerWrapper . wrapHandler ( localHostControllerInfo . getLocalHostName ( ) , operationName , address , entry ) ; } else { wrapper = entry . getOperationHandler ( ) ; } context . addModelStep ( localReponse , operation , entry . getOperationDefinition ( ) , wrapper , false ) ; } } else { throw new OperationFailedException ( ControllerLogger . ROOT_LOGGER . noHandlerForOperation ( operationName , pathAddress ) ) ; } |
public class UnixUserGroupInformation { /** * Read a UGI from the given < code > conf < / code >
* The object is expected to store with the property name < code > attr < / code >
* as a comma separated string that starts
* with the user name followed by group names .
* If the property name is not defined , return null .
* It ' s assumed that there is only one UGI per user . If this user already
* has a UGI in the ugi map , return the ugi in the map .
* Otherwise , construct a UGI from the configuration , store it in the
* ugi map and return it .
* @ param conf configuration
* @ param attr property name
* @ return a UnixUGI
* @ throws LoginException if the stored string is ill - formatted . */
public static UnixUserGroupInformation readFromConf ( Configuration conf , String attr ) throws LoginException { } } | String [ ] ugi = conf . getStrings ( attr ) ; if ( ugi == null ) { return null ; } UnixUserGroupInformation currentUGI = null ; if ( ugi . length > 0 ) { currentUGI = user2UGIMap . get ( ugi [ 0 ] ) ; } if ( currentUGI == null ) { try { currentUGI = new UnixUserGroupInformation ( ugi ) ; user2UGIMap . put ( currentUGI . getUserName ( ) , currentUGI ) ; } catch ( IllegalArgumentException e ) { throw new LoginException ( "Login failed: " + e . getMessage ( ) ) ; } } return currentUGI ; |
public class ListStatistics { /** * Instead of just triggering spilling when we have a certain number of
* Items on a stream we now have the ability to trigger spilling if the
* total size of the Items on a stream goes over a pre - defined limit .
* This should allow us to control the memory usage of a stream in a
* more intuitive fashion .
* For the count limit we use a moving average as this allows us to
* flatten out and short term spikes in the number of items on the
* stream . This allows us to pop over the item count for a short while
* without triggering spilling and slowing item consumption even more .
* For the size limit we do not use a moving average as this would
* flatten off any spikes in the memory usage of the queue . In the
* size case we need to pay attention to any spikes as they could
* quickly blow the heap if allowed to build up .
* i . e . a moving average of 20
* 19 x 1k message + 1 x 100MB message = 20 messages
* Moving average totals | Moving average
* 1K |
* 1K + 2k |
* 1K + 2K + 3K |
* 1K + 2K + . . . . + 19K + 100MB | 105,052,160 / 20 = 5,252,608
* So a queue with over 100MB of message data on it would only produce
* an average of just over 5MB . This inconsistency makes it difficult
* to control the actual amount of memory being used and also for the
* user to judge the correct values for the limits . */
public final void checkSpillLimits ( ) { } } | long currentTotal ; long currentSize ; synchronized ( this ) { currentTotal = _countTotal ; currentSize = _countTotalBytes ; } if ( ! _spilling ) { // We are not currently spilling so we need to calculate the moving average
// for the number of items on our stream and then check the moving average
// and the total size of the items on the stream against our configured limits .
// moving total is accumulated value over last 20 calculations minus the
// immediately previous value . This saves both a division and storing the
// last average . To get the current running total we add the current total
// to the _ movingTotal
_movingTotal = _movingTotal + currentTotal ; // we calculate the moving average by dividing moving total by number of
// cycles in the moving window .
long movingAverage = _movingTotal / MOVING_AVERAGE_LENGTH ; // we then diminish the moving total by the moving average leaving it free for next time .
_movingTotal = _movingTotal - movingAverage ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Stream is NOT SPILLING" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Current size :" + currentSize ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Current total :" + currentTotal ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Moving average:" + movingAverage ) ; if ( movingAverage >= _movingAverageHighLimit || // There are too many items on the stream
currentSize >= _totalSizeHighLimit ) // The size of items on the stream is too large
{ _spilling = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Stream has STARTED SPILLING" ) ; } } else { // We are spilling so we just need to check against our configured limits and
// if we are below them for both number of items and total size of items then
// we can stop spilling . If we do stop spilling we also need to reset our moving
// average counter .
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Stream is SPILLING" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Current size :" + currentSize ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Current total :" + currentTotal ) ; if ( currentTotal <= _movingAverageLowLimit && // There are only a few items on the stream
currentSize <= _totalSizeLowLimit ) // AND The items on the stream are small
{ _spilling = false ; _movingTotal = _movingAverageLowLimit * ( MOVING_AVERAGE_LENGTH - 1 ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Stream has STOPPED SPILLING" ) ; } } |
public class Consumers { /** * Yields the last element .
* @ param < E > the iterator element type
* @ param iterator the iterator that will be consumed @ throw
* IllegalArgumentException if no element is found
* @ return the last element */
public static < E > E last ( Iterator < E > iterator ) { } } | return new LastElement < E > ( ) . apply ( iterator ) ; |
public class WaitForState { /** * Waits for the element to not be enabled . The provided wait time will be used
* and if the element isn ' t present after that time , it will fail , and log
* the issue with a screenshot for traceability and added debugging support .
* @ param seconds - how many seconds to wait for */
public void notEnabled ( double seconds ) { } } | double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; try { double timeTook = elementPresent ( seconds ) ; WebDriverWait wait = new WebDriverWait ( element . getDriver ( ) , ( long ) ( seconds - timeTook ) , DEFAULT_POLLING_INTERVAL ) ; wait . until ( ExpectedConditions . not ( ExpectedConditions . elementToBeClickable ( element . defineByElement ( ) ) ) ) ; timeTook = Math . min ( ( seconds * 1000 ) - ( end - System . currentTimeMillis ( ) ) , seconds * 1000 ) / 1000 ; checkNotEnabled ( seconds , timeTook ) ; } catch ( TimeoutException e ) { checkNotEnabled ( seconds , seconds ) ; } |
public class VaultsInner { /** * Updates the vault .
* @ param resourceGroupName The name of the resource group where the recovery services vault is present .
* @ param vaultName The name of the recovery services vault .
* @ param vault Recovery Services Vault to be created .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the VaultInner object */
public Observable < VaultInner > updateAsync ( String resourceGroupName , String vaultName , PatchVault vault ) { } } | return updateWithServiceResponseAsync ( resourceGroupName , vaultName , vault ) . map ( new Func1 < ServiceResponse < VaultInner > , VaultInner > ( ) { @ Override public VaultInner call ( ServiceResponse < VaultInner > response ) { return response . body ( ) ; } } ) ; |
public class DuracloudContentWriter { /** * This method implements the ContentWriter interface for writing content
* to a DataStore . In this case , the DataStore is durastore .
* @ param spaceId destination space of arg chunkable content
* @ param chunkable content to be written
* @ throws NotFoundException if space is not found */
@ Override public ChunksManifest write ( String spaceId , ChunkableContent chunkable , Map < String , String > contentProperties ) throws NotFoundException { } } | return write ( spaceId , chunkable , contentProperties , true ) ; |
public class CommerceCurrencyPersistenceImpl { /** * Returns the commerce currency where groupId = & # 63 ; and code = & # 63 ; or returns < code > null < / code > if it could not be found . Uses the finder cache .
* @ param groupId the group ID
* @ param code the code
* @ return the matching commerce currency , or < code > null < / code > if a matching commerce currency could not be found */
@ Override public CommerceCurrency fetchByG_C ( long groupId , String code ) { } } | return fetchByG_C ( groupId , code , true ) ; |
public class JdbcUtil { /** * Unconditionally close the < code > ResultSet , Statement , Connection < / code > .
* Equivalent to { @ link ResultSet # close ( ) } , { @ link Statement # close ( ) } , { @ link Connection # close ( ) } , except any exceptions will be ignored .
* This is typically used in finally blocks .
* @ param rs
* @ param stmt
* @ param conn */
public static void closeQuietly ( final ResultSet rs , final Statement stmt , final Connection conn ) { } } | if ( rs != null ) { try { rs . close ( ) ; } catch ( Exception e ) { logger . error ( "Failed to close ResultSet" , e ) ; } } if ( stmt != null ) { if ( stmt instanceof PreparedStatement ) { try { ( ( PreparedStatement ) stmt ) . clearParameters ( ) ; } catch ( Exception e ) { logger . error ( "Failed to clear parameters" , e ) ; } } try { stmt . close ( ) ; } catch ( Exception e ) { logger . error ( "Failed to close Statement" , e ) ; } } if ( conn != null ) { try { conn . close ( ) ; } catch ( Exception e ) { logger . error ( "Failed to close Connection" , e ) ; } } |
public class CmsPropertyAdvanced { /** * Performs the define property action , will be called by the JSP page . < p >
* @ throws JspException if problems including sub - elements occur */
public void actionDefine ( ) throws JspException { } } | // save initialized instance of this class in request attribute for included sub - elements
getJsp ( ) . getRequest ( ) . setAttribute ( SESSION_WORKPLACE_CLASS , this ) ; try { performDefineOperation ( ) ; // set the request parameters before returning to the overview
setParamAction ( DIALOG_SHOW_DEFAULT ) ; setParamNewproperty ( null ) ; sendForward ( CmsWorkplace . VFS_PATH_COMMONS + "property_advanced.jsp" , paramsAsParameterMap ( ) ) ; } catch ( Throwable e ) { // error defining property , show error dialog
includeErrorpage ( this , e ) ; } |
public class JsonObject { /** * Removes a member with the specified name from this object . If this object contains multiple members with the given
* name , only the last one is removed . If this object does not contain a member with the specified name , the object is
* not modified .
* @ param name
* the name of the member to remove
* @ return the object itself , to enable method chaining */
public JsonObject remove ( String name ) { } } | if ( name == null ) { throw new NullPointerException ( NAME_IS_NULL ) ; } int index = indexOf ( name ) ; if ( index != - 1 ) { table . remove ( index ) ; names . remove ( index ) ; values . remove ( index ) ; } return this ; |
public class DefaultDataBufferFactory { /** * This method will create new DataBuffer of the same dataType & same length
* @ param buffer
* @ param workspace
* @ return */
@ Override public DataBuffer createSame ( DataBuffer buffer , boolean init , MemoryWorkspace workspace ) { } } | return create ( buffer . dataType ( ) , buffer . length ( ) , init , workspace ) ; |
public class EarlToHtmlTransformation { /** * Transform EARL result into HTML report using XSLT .
* @ param outputDir */
public void earlHtmlReport ( String outputDir ) { } } | ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; String resourceDir = cl . getResource ( "com/occamlab/te/earl/lib" ) . getPath ( ) ; String earlXsl = cl . getResource ( "com/occamlab/te/earl_html_report.xsl" ) . toString ( ) ; File htmlOutput = new File ( outputDir , "result" ) ; htmlOutput . mkdir ( ) ; File earlResult = findEarlResultFile ( outputDir ) ; LOGR . log ( FINE , "Try to transform earl result file '" + earlResult + "' to directory " + htmlOutput ) ; try { if ( earlResult != null && earlResult . exists ( ) ) { Transformer transformer = TransformerFactory . newInstance ( ) . newTransformer ( new StreamSource ( earlXsl ) ) ; transformer . setParameter ( "outputDir" , htmlOutput ) ; File indexHtml = new File ( htmlOutput , "index.html" ) ; indexHtml . createNewFile ( ) ; // Fortify Mod : Make sure the FileOutputStream is closed when we are done with it .
// transformer . transform ( new StreamSource ( earlResult ) ,
// new StreamResult ( new FileOutputStream ( indexHtml ) ) ) ;
FileOutputStream fo = new FileOutputStream ( indexHtml ) ; transformer . transform ( new StreamSource ( earlResult ) , new StreamResult ( fo ) ) ; fo . close ( ) ; FileUtils . copyDirectory ( new File ( resourceDir ) , htmlOutput ) ; } } catch ( Exception e ) { LOGR . log ( SEVERE , "Transformation of EARL to HTML failed." , e ) ; } |
public class IllegalArgumentExceptionMapper { /** * ~ Methods * * * * * */
@ Override public Response toResponse ( IllegalArgumentException ex ) { } } | return Response . status ( Status . BAD_REQUEST ) . entity ( new ErrorMessage ( Status . BAD_REQUEST . getStatusCode ( ) , ex . getMessage ( ) ) ) . type ( MediaType . APPLICATION_JSON_TYPE ) . build ( ) ; |
public class UserAttrs { /** * Set user - defined - attribute
* @ param path
* @ param attribute user : attribute name . user : can be omitted . . user : can be omitted .
* @ param value
* @ param options
* @ throws IOException */
public static final void setIntAttribute ( Path path , String attribute , int value , LinkOption ... options ) throws IOException { } } | attribute = attribute . startsWith ( "user:" ) ? attribute : "user:" + attribute ; Files . setAttribute ( path , attribute , Primitives . writeInt ( value ) , options ) ; |
public class GabowSCC { /** * Creates a VertexNumber object for every vertex in the graph and stores
* them in a HashMap . */
private void createVertexNumber ( ) { } } | c = graph . vertexSet ( ) . size ( ) ; vertexToVertexNumber = new HashMap < > ( c ) ; for ( V vertex : graph . vertexSet ( ) ) { vertexToVertexNumber . put ( vertex , new VertexNumber < V > ( vertex , 0 ) ) ; } stack = new ArrayDeque < > ( c ) ; B = new ArrayDeque < > ( c ) ; |
public class HtmlUtils { /** * Determine if the given < code > value < / code > contains an HTML entity .
* @ param value the value to check for an entity
* @ return < code > true < / code > if the value contains an entity ; < code > false < / code > otherwise . */
public static boolean containsEntity ( String value ) { } } | assert ( value != null ) : "Parameter 'value' must not be null" ; int pos = value . indexOf ( '&' ) ; if ( pos == - 1 ) return false ; int end = value . indexOf ( ';' ) ; if ( end != - 1 && pos < end ) { // extract the entity and then verify it is
// a valid unicode identifier .
String entity = value . substring ( pos + 1 , end ) ; if ( entity . length ( ) == 0 ) return false ; char [ ] chars = entity . toCharArray ( ) ; // verify the start is an indentifier start
// and the rest is a part .
if ( ! Character . isUnicodeIdentifierStart ( chars [ 0 ] ) ) { if ( chars [ 0 ] == '#' && chars . length > 1 ) { for ( int i = 1 ; i < chars . length ; i ++ ) { if ( ! Character . isDigit ( chars [ i ] ) ) return false ; } return true ; } return false ; } for ( int i = 1 ; i < chars . length ; i ++ ) { if ( ! Character . isUnicodeIdentifierPart ( chars [ i ] ) ) return false ; } // good indentifier
return true ; } return false ; |
public class RegisterTaskDefinitionRequest { /** * An array of placement constraint objects to use for the task . You can specify a maximum of 10 constraints per
* task ( this limit includes constraints in the task definition and those specified at runtime ) .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setPlacementConstraints ( java . util . Collection ) } or { @ link # withPlacementConstraints ( java . util . Collection ) }
* if you want to override the existing values .
* @ param placementConstraints
* An array of placement constraint objects to use for the task . You can specify a maximum of 10 constraints
* per task ( this limit includes constraints in the task definition and those specified at runtime ) .
* @ return Returns a reference to this object so that method calls can be chained together . */
public RegisterTaskDefinitionRequest withPlacementConstraints ( TaskDefinitionPlacementConstraint ... placementConstraints ) { } } | if ( this . placementConstraints == null ) { setPlacementConstraints ( new com . amazonaws . internal . SdkInternalList < TaskDefinitionPlacementConstraint > ( placementConstraints . length ) ) ; } for ( TaskDefinitionPlacementConstraint ele : placementConstraints ) { this . placementConstraints . add ( ele ) ; } return this ; |
public class ElementBase { /** * Returns true if this element may accept a child . Updates the reject reason with the result .
* @ return True if this element may accept a child . Updates the reject reason with the result . */
public boolean canAcceptChild ( ) { } } | if ( maxChildren == 0 ) { rejectReason = getDisplayName ( ) + " does not accept any children." ; } else if ( getChildCount ( ) >= maxChildren ) { rejectReason = "Maximum child count exceeded for " + getDisplayName ( ) + "." ; } else { rejectReason = null ; } return rejectReason == null ; |
public class HitsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Hits hits , ProtocolMarshaller protocolMarshaller ) { } } | if ( hits == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( hits . getFound ( ) , FOUND_BINDING ) ; protocolMarshaller . marshall ( hits . getStart ( ) , START_BINDING ) ; protocolMarshaller . marshall ( hits . getCursor ( ) , CURSOR_BINDING ) ; protocolMarshaller . marshall ( hits . getHit ( ) , HIT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ChunkedInputStream { /** * read single byte from chunk body . */
public int read ( ) throws IOException { } } | if ( this . bytesRead == this . length ) { // All chunks and final additional chunk are read .
// This means we have reached EOF .
return - 1 ; } try { // Read a chunk from given input stream when
// it is first chunk or all bytes in chunk body is read
if ( this . streamBytesRead == 0 || this . chunkPos == this . chunkBody . length ) { // Check if there are data available to read from given input stream .
if ( this . streamBytesRead != this . streamSize ) { // Send all data chunks .
int chunkSize = CHUNK_SIZE ; if ( this . streamBytesRead + chunkSize > this . streamSize ) { chunkSize = this . streamSize - this . streamBytesRead ; } if ( readChunk ( chunkSize ) < 0 ) { return - 1 ; } this . streamBytesRead += chunkSize ; } else { // Send final additional chunk to complete chunk upload .
byte [ ] chunk = new byte [ 0 ] ; createChunkBody ( chunk ) ; } } this . bytesRead ++ ; // Value must be between 0 to 255.
int value = this . chunkBody [ this . chunkPos ] & 0xFF ; this . chunkPos ++ ; return value ; } catch ( NoSuchAlgorithmException | InvalidKeyException | InsufficientDataException | InternalException e ) { throw new IOException ( e . getCause ( ) ) ; } |
public class EncodingSchemeIDImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . ENCODING_SCHEME_ID__ESID_CP : return ESID_CP_EDEFAULT == null ? eSidCP != null : ! ESID_CP_EDEFAULT . equals ( eSidCP ) ; case AfplibPackage . ENCODING_SCHEME_ID__ESID_UD : return ESID_UD_EDEFAULT == null ? eSidUD != null : ! ESID_UD_EDEFAULT . equals ( eSidUD ) ; } return super . eIsSet ( featureID ) ; |
public class ResolveVisitor { /** * and class as property */
private Expression correctClassClassChain ( PropertyExpression pe ) { } } | LinkedList < Expression > stack = new LinkedList < Expression > ( ) ; ClassExpression found = null ; for ( Expression it = pe ; it != null ; it = ( ( PropertyExpression ) it ) . getObjectExpression ( ) ) { if ( it instanceof ClassExpression ) { found = ( ClassExpression ) it ; break ; } else if ( ! ( it . getClass ( ) == PropertyExpression . class ) ) { return pe ; } stack . addFirst ( it ) ; } if ( found == null ) return pe ; if ( stack . isEmpty ( ) ) return pe ; Object stackElement = stack . removeFirst ( ) ; if ( ! ( stackElement . getClass ( ) == PropertyExpression . class ) ) return pe ; PropertyExpression classPropertyExpression = ( PropertyExpression ) stackElement ; String propertyNamePart = classPropertyExpression . getPropertyAsString ( ) ; if ( propertyNamePart == null || ! propertyNamePart . equals ( "class" ) ) return pe ; found . setSourcePosition ( classPropertyExpression ) ; if ( stack . isEmpty ( ) ) return found ; stackElement = stack . removeFirst ( ) ; if ( ! ( stackElement . getClass ( ) == PropertyExpression . class ) ) return pe ; PropertyExpression classPropertyExpressionContainer = ( PropertyExpression ) stackElement ; classPropertyExpressionContainer . setObjectExpression ( found ) ; return pe ; |
public class ConstantsSummaryWriterImpl { /** * Get the type column for the constant summary table row .
* @ param member the field to be documented .
* @ return the type column of the constant table row */
private Content getTypeColumn ( VariableElement member ) { } } | Content anchor = getMarkerAnchor ( currentTypeElement . getQualifiedName ( ) + "." + member . getSimpleName ( ) ) ; Content tdType = HtmlTree . TD ( HtmlStyle . colFirst , anchor ) ; Content code = new HtmlTree ( HtmlTag . CODE ) ; for ( Modifier mod : member . getModifiers ( ) ) { Content modifier = new StringContent ( mod . toString ( ) ) ; code . addContent ( modifier ) ; code . addContent ( Contents . SPACE ) ; } Content type = getLink ( new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . CONSTANT_SUMMARY , member . asType ( ) ) ) ; code . addContent ( type ) ; tdType . addContent ( code ) ; return tdType ; |
public class Util { /** * Helper method for resolving manifest metadata string value
* @ return null if key is missing or exception is thrown */
public static String getManifestMetadataString ( Context context , String key ) { } } | if ( context == null ) { throw new IllegalArgumentException ( "Context is null" ) ; } if ( key == null ) { throw new IllegalArgumentException ( "Key is null" ) ; } try { String appPackageName = context . getPackageName ( ) ; PackageManager packageManager = context . getPackageManager ( ) ; PackageInfo packageInfo = packageManager . getPackageInfo ( appPackageName , PackageManager . GET_META_DATA | PackageManager . GET_RECEIVERS ) ; Bundle metaData = packageInfo . applicationInfo . metaData ; if ( metaData != null ) { return Util . trim ( metaData . getString ( key ) ) ; } } catch ( Exception e ) { ApptentiveLog . e ( e , "Unexpected error while reading application or package info." ) ; logException ( e ) ; } return null ; |
public class ParserAdapter { /** * Process a qualified ( prefixed ) name .
* < p > If the name has an undeclared prefix , use only the qname
* and make an ErrorHandler . error callback in case the app is
* interested . < / p >
* @ param qName The qualified ( prefixed ) name .
* @ param isAttribute true if this is an attribute name .
* @ return The name split into three parts .
* @ exception SAXException The client may throw
* an exception if there is an error callback . */
private String [ ] processName ( String qName , boolean isAttribute , boolean useException ) throws SAXException { } } | String parts [ ] = nsSupport . processName ( qName , nameParts , isAttribute ) ; if ( parts == null ) { if ( useException ) throw makeException ( "Undeclared prefix: " + qName ) ; reportError ( "Undeclared prefix: " + qName ) ; parts = new String [ 3 ] ; parts [ 0 ] = parts [ 1 ] = "" ; parts [ 2 ] = qName . intern ( ) ; } return parts ; |
public class Arrays { /** * Returns < code > true < / code > if the specified array contains the specified sub - array at the specified index .
* @ param array the array to search in
* @ param searchFor the sub - array to search for
* @ param index the index at which to search
* @ return whether or not the specified array contains the specified sub - array at the specified index */
public static boolean containsAt ( byte [ ] array , byte [ ] searchFor , int index ) { } } | for ( int i = 0 ; i < searchFor . length ; i ++ ) { if ( index + i >= array . length || array [ index + i ] != searchFor [ i ] ) { return false ; } } return true ; |
public class StaticMockitoSessionBuilder { /** * Sets up spying for static methods of a class .
* @ param clazz The class to set up static spying for
* @ return This builder */
@ UnstableApi public < T > StaticMockitoSessionBuilder spyStatic ( Class < T > clazz ) { } } | staticMockings . add ( new StaticMocking < > ( clazz , ( ) -> Mockito . mock ( clazz , withSettings ( ) . defaultAnswer ( CALLS_REAL_METHODS ) ) ) ) ; return this ; |
public class AuthorityServiceImpl { /** * { @ inheritDoc } */
@ Override public final List < Authority > findByname ( final String name ) { } } | // Authority auth = this . authorityRepository . findByName ( name ) ;
final Authority authority = new Authority ( ) ; authority . setUserRoleName ( UserRoleName . valueOf ( name ) ) ; final List < Authority > authorities = new ArrayList < > ( ) ; authorities . add ( authority ) ; return authorities ; |
public class UsersApi { /** * Get User Device Types
* Retrieve User & # 39 ; s Device Types
* @ param userId User ID . ( required )
* @ param offset Offset for pagination . ( optional )
* @ param count Desired count of items in the result set ( optional )
* @ param includeShared Optional . Boolean ( true / false ) - If false , only return the user & # 39 ; s device types . If true , also return device types shared by other users . ( optional )
* @ return ApiResponse & lt ; DeviceTypesEnvelope & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < DeviceTypesEnvelope > getUserDeviceTypesWithHttpInfo ( String userId , Integer offset , Integer count , Boolean includeShared ) throws ApiException { } } | com . squareup . okhttp . Call call = getUserDeviceTypesValidateBeforeCall ( userId , offset , count , includeShared , null , null ) ; Type localVarReturnType = new TypeToken < DeviceTypesEnvelope > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class ArgumentParser { /** * Handle the - - propertyfile argument . */
private void handleArgPropertyFile ( final String arg , final Deque < String > args ) { } } | final Map . Entry < String , String > entry = parse ( arg . substring ( 2 ) , args ) ; if ( entry . getValue ( ) == null ) { throw new BuildException ( "You must specify a property filename when using the --propertyfile argument" ) ; } propertyFiles . addElement ( entry . getValue ( ) ) ; |
public class Stopwatch { /** * Stops the stopwatch . Future reads will return the fixed duration that had
* elapsed up to this point .
* @ return this { @ code Stopwatch } instance
* @ throws IllegalStateException if the stopwatch is already stopped . */
public Stopwatch stop ( ) { } } | long tick = ticker . read ( ) ; Assert . isTrue ( isRunning ) ; isRunning = false ; elapsedNanos += tick - startTick ; return this ; |
public class H2InboundLink { /** * ( non - Javadoc )
* @ see com . ibm . ws . http . channel . internal . inbound . HttpInboundLink # destroy ( java . lang . Exception ) */
@ Override public void destroy ( Exception e ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "destroy entry" ) ; } H2StreamProcessor stream ; for ( Integer i : streamTable . keySet ( ) ) { stream = streamTable . get ( i ) ; // notify streams waiting for a window update
synchronized ( stream ) { stream . notifyAll ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "destroying " + stream + ", " + stream . getId ( ) ) ; } if ( stream . getId ( ) != 0 ) { stream . getWrappedInboundLink ( ) . destroy ( e ) ; } } initialVC = null ; frameReadProcessor = null ; h2MuxReadCallback = null ; h2MuxTCPConnectionContext = null ; h2MuxTCPReadContext = null ; h2MuxTCPWriteContext = null ; localConnectionSettings = null ; remoteConnectionSettings = null ; readContextTable = null ; writeContextTable = null ; super . destroy ( e ) ; |
public class VoiceRecorderDialog { /** * 显示录音对话框 */
public void show ( ) { } } | if ( null == dialog ) { dialog = new Dialog ( context , R . style . HLKLIB_Voice_Recorder_Dialog ) ; View view = View . inflate ( context , R . layout . hlklib_voice_recorder_dialog , null ) ; ViewUtility . bind ( this , view ) ; mImageView = ( ImageView ) view . findViewById ( R . id . hlklib_voice_recorder_image ) ; mWarningText = ( TextView ) view . findViewById ( R . id . hlklib_voice_recorder_warning ) ; dialog . setContentView ( view ) ; dialog . setOnDismissListener ( dismissListener ) ; } dialog . show ( ) ; |
public class RepositoryContainer { /** * Initialize worspaces ( root node and jcr : system for system workspace ) .
* Runs on container start .
* @ throws RepositoryException
* @ throws RepositoryConfigurationException */
private void init ( ) throws RepositoryException , RepositoryConfigurationException { } } | List < WorkspaceEntry > wsEntries = config . getWorkspaceEntries ( ) ; NodeTypeDataManager typeManager = ( NodeTypeDataManager ) this . getComponentInstanceOfType ( NodeTypeDataManager . class ) ; NamespaceRegistryImpl namespaceRegistry = ( NamespaceRegistryImpl ) this . getComponentInstanceOfType ( NamespaceRegistry . class ) ; for ( WorkspaceEntry ws : wsEntries ) { initWorkspace ( ws ) ; WorkspaceContainer workspaceContainer = getWorkspaceContainer ( ws . getName ( ) ) ; SearchManager searchManager = ( SearchManager ) workspaceContainer . getComponentInstanceOfType ( SearchManager . class ) ; // if ( searchManager ! = null )
// typeManager . addQueryHandler ( searchManager . getHandler ( ) ) ;
// namespaceRegistry . addQueryHandler ( searchManager . getHandler ( ) ) ;
// else
// log . warn ( " Search manager not configured for " + ws . getName ( ) ) ;
} SystemSearchManagerHolder searchManager = ( SystemSearchManagerHolder ) this . getComponentInstanceOfType ( SystemSearchManagerHolder . class ) ; // if ( searchManager ! = null )
// typeManager . addQueryHandler ( searchManager . get ( ) . getHandler ( ) ) ;
// namespaceRegistry . addQueryHandler ( searchManager . get ( ) . getHandler ( ) ) ;
// else
// log . warn ( " System search manager not configured " ) ; |
public class WTree { /** * Iterate through nodes to check expanded nodes have their child nodes .
* If a node is flagged as having children and has none , then load them from the tree model .
* @ param node the node to check
* @ param expandedRows the expanded rows */
private void processCheckExpandedCustomNodes ( final TreeItemIdNode node , final Set < String > expandedRows ) { } } | // Node has no children
if ( ! node . hasChildren ( ) ) { return ; } // Check node is expanded
boolean expanded = getExpandMode ( ) == WTree . ExpandMode . CLIENT || expandedRows . contains ( node . getItemId ( ) ) ; if ( ! expanded ) { return ; } if ( node . getChildren ( ) . isEmpty ( ) ) { // Add children from the model
loadCustomNodeChildren ( node ) ; } else { // Check the expanded child nodes
for ( TreeItemIdNode child : node . getChildren ( ) ) { processCheckExpandedCustomNodes ( child , expandedRows ) ; } } |
public class GitlabAPI { /** * Get build artifacts of a project build
* @ param project The Project
* @ param job The build
* @ throws IOException on gitlab api call error */
public byte [ ] getJobArtifact ( GitlabProject project , GitlabJob job ) throws IOException { } } | return getJobArtifact ( project . getId ( ) , job . getId ( ) ) ; |
public class ReflectionUtils { /** * Create a dynamic proxy that adapts the given { @ link Supplier } to a { @ link Randomizer } .
* @ param supplier to adapt
* @ param < T > target type
* @ return the proxy randomizer */
@ SuppressWarnings ( "unchecked" ) public static < T > Randomizer < T > asRandomizer ( final Supplier < T > supplier ) { } } | class RandomizerProxy implements InvocationHandler { private final Supplier < ? > target ; private RandomizerProxy ( final Supplier < ? > target ) { this . target = target ; } @ Override public Object invoke ( final Object proxy , final Method method , final Object [ ] args ) throws Throwable { if ( "getRandomValue" . equals ( method . getName ( ) ) ) { Method getMethod = target . getClass ( ) . getMethod ( "get" ) ; getMethod . setAccessible ( true ) ; return getMethod . invoke ( target ) ; } return null ; } } return ( Randomizer < T > ) Proxy . newProxyInstance ( Randomizer . class . getClassLoader ( ) , new Class [ ] { Randomizer . class } , new RandomizerProxy ( supplier ) ) ; |
public class JDBC4DatabaseMetaData { /** * Retrieves a description of all the data types supported by this database . */
@ Override public ResultSet getTypeInfo ( ) throws SQLException { } } | checkClosed ( ) ; this . sysCatalog . setString ( 1 , "TYPEINFO" ) ; ResultSet res = this . sysCatalog . executeQuery ( ) ; return res ; |
public class EdirEntries { /** * Convert a Instant to the Zulu String format .
* See the < a href = " http : / / developer . novell . com / documentation / ndslib / schm _ enu / data / sdk5701 . html " > eDirectory Time attribute syntax definition < / a > for more details .
* @ param instant The Date to be converted
* @ return A string formatted such as " 199412161032Z " . */
public static String convertInstantToZulu ( final Instant instant ) { } } | if ( instant == null ) { throw new NullPointerException ( ) ; } try { return EDIR_TIMESTAMP_FORMATTER . format ( instant . atZone ( ZoneOffset . UTC ) ) ; } catch ( DateTimeParseException e ) { throw new IllegalArgumentException ( "unable to format zulu time-string: " + e . getMessage ( ) ) ; } |
public class ComputerVisionImpl { /** * This operation generates a list of words , or tags , that are relevant to the content of the supplied image . The Computer Vision API can return tags based on objects , living beings , scenery or actions found in images . Unlike categories , tags are not organized according to a hierarchical classification system , but correspond to image content . Tags may contain hints to avoid ambiguity or provide context , for example the tag ' cello ' may be accompanied by the hint ' musical instrument ' . All tags are in English .
* @ param url Publicly reachable URL of an image
* @ param tagImageOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the TagResult object */
public Observable < TagResult > tagImageAsync ( String url , TagImageOptionalParameter tagImageOptionalParameter ) { } } | return tagImageWithServiceResponseAsync ( url , tagImageOptionalParameter ) . map ( new Func1 < ServiceResponse < TagResult > , TagResult > ( ) { @ Override public TagResult call ( ServiceResponse < TagResult > response ) { return response . body ( ) ; } } ) ; |
public class SystemBar { /** * Set the content layout full the NavigationBar , but do not hide NavigationBar . */
public static void invasionNavigationBar ( Activity activity ) { } } | if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) invasionNavigationBar ( activity . getWindow ( ) ) ; |
public class ListOfIfcNormalisedRatioMeasureImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcNormalisedRatioMeasure > getList ( ) { } } | return ( EList < IfcNormalisedRatioMeasure > ) eGet ( Ifc4Package . Literals . LIST_OF_IFC_NORMALISED_RATIO_MEASURE__LIST , true ) ; |
public class MultiPartParser { /** * Mime Field strings are treated as UTF - 8 as per https : / / tools . ietf . org / html / rfc7578 # section - 5.1 */
private String takeString ( ) { } } | String s = _string . toString ( ) ; // trim trailing whitespace .
if ( s . length ( ) > _length ) s = s . substring ( 0 , _length ) ; _string . reset ( ) ; _length = - 1 ; return s ; |
public class CPOptionValuePersistenceImpl { /** * Removes all the cp option values where companyId = & # 63 ; from the database .
* @ param companyId the company ID */
@ Override public void removeByCompanyId ( long companyId ) { } } | for ( CPOptionValue cpOptionValue : findByCompanyId ( companyId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( cpOptionValue ) ; } |
public class Reflect { /** * Manually create enum values array without using enum . values ( ) .
* @ param enm enum class to query
* @ return array of enum values */
@ SuppressWarnings ( "unchecked" ) static < T > T [ ] getEnumConstants ( Class < T > enm ) { } } | return Stream . of ( enm . getFields ( ) ) . filter ( f -> f . getType ( ) == enm ) . map ( f -> { try { return f . get ( null ) ; } catch ( Exception e ) { return null ; } } ) . filter ( Objects :: nonNull ) . toArray ( len -> ( T [ ] ) Array . newInstance ( enm , len ) ) ; |
public class DFSClient { /** * Set permissions to a file or directory .
* @ param src path name .
* @ param permission
* @ throws < code > FileNotFoundException < / code > is file does not exist . */
public void setPermission ( String src , FsPermission permission ) throws IOException { } } | checkOpen ( ) ; clearFileStatusCache ( ) ; try { namenode . setPermission ( src , permission ) ; } catch ( RemoteException re ) { throw re . unwrapRemoteException ( AccessControlException . class , FileNotFoundException . class ) ; } |
public class AbstractMetricsContext { /** * Starts timer if it is not already started */
private synchronized void startTimer ( ) { } } | if ( timer == null ) { timer = new Timer ( "Timer thread for monitoring " + getContextName ( ) , true ) ; TimerTask task = new TimerTask ( ) { public void run ( ) { try { timerEvent ( ) ; } catch ( IOException ioe ) { ioe . printStackTrace ( ) ; } } } ; long millis = period * 1000 ; timer . scheduleAtFixedRate ( task , millis , millis ) ; } |
public class ExceptionDestinationHandlerImpl { /** * Fire an event notification of type TYPE _ SIB _ MESSAGE _ EXCEPTIONED
* @ param newState */
private void fireMessageExceptionedEvent ( String apiMsgId , SIMPMessage message , int exceptionReason ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "fireMessageExceptionedEvent" , new Object [ ] { apiMsgId , message , Integer . valueOf ( exceptionReason ) } ) ; JsMessagingEngine me = _messageProcessor . getMessagingEngine ( ) ; RuntimeEventListener listener = _messageProcessor . getRuntimeEventListener ( ) ; String systemMessageId = message . getMessage ( ) . getSystemMessageId ( ) ; // Check that we have a RuntimeEventListener
if ( listener != null ) { // Build the message for the Notification
String nlsMessage = nls_mt . getFormattedMessage ( "MESSAGE_EXCEPTION_DESTINATIONED_CWSJU0012" , new Object [ ] { apiMsgId , systemMessageId , _exceptionDestinationName , Integer . valueOf ( exceptionReason ) , message . getMessage ( ) . getExceptionMessage ( ) } , null ) ; // Build the properties for the Notification
Properties props = new Properties ( ) ; // Set values for the intended destination
String intendedDestinationName = "" ; String intendedDestinationUuid = SIBUuid12 . toZeroString ( ) ; if ( _originalDestination != null ) { intendedDestinationName = _originalDestination . getName ( ) ; intendedDestinationUuid = _originalDestination . getUuid ( ) . toString ( ) ; } props . put ( SibNotificationConstants . KEY_INTENDED_DESTINATION_NAME , intendedDestinationName ) ; props . put ( SibNotificationConstants . KEY_INTENDED_DESTINATION_UUID , intendedDestinationUuid ) ; // Set values for the exception destination
props . put ( SibNotificationConstants . KEY_EXCEPTION_DESTINATION_NAME , _exceptionDestination . getName ( ) ) ; props . put ( SibNotificationConstants . KEY_EXCEPTION_DESTINATION_UUID , _exceptionDestination . getUuid ( ) . toString ( ) ) ; props . put ( SibNotificationConstants . KEY_SYSTEM_MESSAGE_IDENTIFIER , ( systemMessageId == null ) ? "" : systemMessageId ) ; props . put ( SibNotificationConstants . KEY_MESSAGE_EXCEPTION_REASON , String . valueOf ( exceptionReason ) ) ; // Fire the event
listener . runtimeEventOccurred ( me , SibNotificationConstants . TYPE_SIB_MESSAGE_EXCEPTIONED , nlsMessage , props ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Null RuntimeEventListener, cannot fire event" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "fireMessageExceptionedEvent" ) ; |
public class GoogleCloudStorageFileSystem { /** * Releases resources used by this instance . */
public void close ( ) { } } | if ( gcs != null ) { logger . atFine ( ) . log ( "close()" ) ; try { gcs . close ( ) ; } finally { gcs = null ; if ( updateTimestampsExecutor != null ) { try { shutdownExecutor ( updateTimestampsExecutor , /* waitSeconds = */
10 ) ; } finally { updateTimestampsExecutor = null ; } } if ( cachedExecutor != null ) { try { shutdownExecutor ( cachedExecutor , /* waitSeconds = */
5 ) ; } finally { cachedExecutor = null ; } } } } |
public class ServiceCall { /** * Issues stream of service requests to service which returns stream of service messages back .
* @ param publisher of service requests .
* @ param responseType type of responses .
* @ return flux publisher of service responses . */
public Flux < ServiceMessage > requestBidirectional ( Publisher < ServiceMessage > publisher , Class < ? > responseType ) { } } | return Flux . from ( publisher ) . switchOnFirst ( ( first , messages ) -> { if ( first . hasValue ( ) ) { ServiceMessage request = first . get ( ) ; String qualifier = request . qualifier ( ) ; if ( methodRegistry . containsInvoker ( qualifier ) ) { // local service .
return methodRegistry . getInvoker ( qualifier ) . invokeBidirectional ( messages , ServiceMessageCodec :: decodeData ) . map ( this :: throwIfError ) ; } else { // remote service
return addressLookup ( request ) . flatMapMany ( address -> requestBidirectional ( messages , responseType , address ) ) ; } } return messages ; } ) ; |
public class JavaScriptExpression { /** * { @ inheritDoc } */
@ Override public Operation listValue ( CssFormatter formatter ) { } } | eval ( formatter ) ; if ( type == LIST ) { Operation op = new Operation ( this ) ; for ( Object obj : ( ( Collection ) result ) ) { op . addOperand ( new ValueExpression ( this , obj ) ) ; } return op ; } else { return super . listValue ( formatter ) ; } |
public class EqualsVerifierApi { /** * Adds prefabricated values for instance fields of classes that
* EqualsVerifier cannot instantiate by itself .
* @ param < S > The class of the prefabricated values .
* @ param otherType The class of the prefabricated values .
* @ param red An instance of { @ code S } .
* @ param black Another instance of { @ code S } , not equal to { @ code red } .
* @ return { @ code this } , for easy method chaining .
* @ throws NullPointerException If either { @ code otherType } , { @ code red } ,
* or { @ code black } is null .
* @ throws IllegalArgumentException If { @ code red } equals { @ code black } . */
public < S > EqualsVerifierApi < T > withPrefabValues ( Class < S > otherType , S red , S black ) { } } | PrefabValuesApi . addPrefabValues ( factoryCache , otherType , red , black ) ; return this ; |
public class RSAUtils { /** * Construct the RSA private key from a key string data .
* @ param base64KeyData
* RSA private key in base64 ( base64 of { @ link RSAPrivateKey # getEncoded ( ) } )
* @ return
* @ throws NoSuchAlgorithmException
* @ throws InvalidKeySpecException */
public static RSAPrivateKey buildPrivateKey ( final String base64KeyData ) throws NoSuchAlgorithmException , InvalidKeySpecException { } } | byte [ ] keyData = Base64 . getDecoder ( ) . decode ( base64KeyData ) ; return buildPrivateKey ( keyData ) ; |
public class PartnersInner { /** * Creates or updates an integration account partner .
* @ param resourceGroupName The resource group name .
* @ param integrationAccountName The integration account name .
* @ param partnerName The integration account partner name .
* @ param partner The integration account partner .
* @ 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 IntegrationAccountPartnerInner object if successful . */
public IntegrationAccountPartnerInner createOrUpdate ( String resourceGroupName , String integrationAccountName , String partnerName , IntegrationAccountPartnerInner partner ) { } } | return createOrUpdateWithServiceResponseAsync ( resourceGroupName , integrationAccountName , partnerName , partner ) . toBlocking ( ) . single ( ) . body ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.