signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CompressionCodec { /** * A { @ link RedisCodec } that compresses values from a delegating { @ link RedisCodec } .
* @ param delegate codec used for key - value encoding / decoding , must not be { @ literal null } .
* @ param compressionType the compression type , must not be { @ literal null } .
* @ param < K > Key type .
* @ param < V > Value type .
* @ return Value - compressing codec . */
@ SuppressWarnings ( { } } | "rawtypes" , "unchecked" } ) public static < K , V > RedisCodec < K , V > valueCompressor ( RedisCodec < K , V > delegate , CompressionType compressionType ) { LettuceAssert . notNull ( delegate , "RedisCodec must not be null" ) ; LettuceAssert . notNull ( compressionType , "CompressionType must not be null" ) ; return ( RedisCodec ) new CompressingValueCodecWrapper ( ( RedisCodec ) delegate , compressionType ) ; |
public class UASparser { /** * Searches in the os regex table . if found a match copies the os data
* @ param useragent
* @ param retObj */
private void processOsRegex ( String useragent , UserAgentInfo retObj ) { } } | try { lock . lock ( ) ; for ( Map . Entry < Pattern , Long > entry : osRegMap . entrySet ( ) ) { Matcher matcher = entry . getKey ( ) . matcher ( useragent ) ; if ( matcher . find ( ) ) { // simply copy the OS data into the result object
Long idOs = entry . getValue ( ) ; OsEntry os = osMap . get ( idOs ) ; if ( os != null ) { os . copyTo ( retObj ) ; } break ; } } } finally { lock . unlock ( ) ; } |
public class LBiObjBoolFunctionBuilder { /** * One of ways of creating builder . In most cases ( considering all _ functional _ builders ) it requires to provide generic parameters ( in most cases redundantly ) */
@ Nonnull public static < T1 , T2 , R > LBiObjBoolFunctionBuilder < T1 , T2 , R > biObjBoolFunction ( ) { } } | return new LBiObjBoolFunctionBuilder ( ) ; |
public class AnnotatedCallablePreparableBase { /** * Executes a method named " doPrepare " by mapping blocks by name to blocks
* annotated with the Named annotation
* @ see com . impossibl . stencil . api . Named */
public Object prepare ( Map < String , ? > params ) throws Throwable { } } | return AnnotatedExtensions . exec ( getPrepareMethod ( ) , getParameterNames ( ) , params , this ) ; |
public class FulltextIndex { /** * CALL apoc . index . addNodeByName ( ' name ' , joe , [ ' name ' , ' age ' , ' city ' ] ) */
@ Procedure ( mode = Mode . WRITE ) @ Description ( "apoc.index.addNodeByName('name',node,['prop1',...]) add node to an index for the given name" ) public void addNodeByName ( @ Name ( "name" ) String name , @ Name ( "node" ) Node node , @ Name ( "properties" ) List < String > propKeys ) { } } | Index < Node > index = getNodeIndex ( name , null ) ; indexEntityProperties ( node , propKeys , index ) ; |
public class StreamHelper { /** * Read all bytes from the passed input stream into a byte array .
* @ param aISP
* The input stream provider to read from . May be < code > null < / code > .
* @ return The byte array or < code > null < / code > if the parameter or the resolved
* input stream is < code > null < / code > . */
@ Nullable public static byte [ ] getAllBytes ( @ Nullable final IHasInputStream aISP ) { } } | if ( aISP == null ) return null ; return getAllBytes ( aISP . getInputStream ( ) ) ; |
public class OntopRepositoryConfig { /** * This method has two roles :
* - Validating in depth the configuration : basic field validation + consistency of
* the OWL and mapping files ( the latter is done when initializing the repository ) .
* - Building the repository ( as an ordinary factory ) .
* This method is usually called two times :
* - At validation time ( see validate ( ) ) .
* - At the repository construction time ( see OntopRepositoryFactory . getRepository ( ) ) .
* However , the repository is only build once and then kept in cache . */
public OntopRepository buildRepository ( ) throws RepositoryConfigException { } } | /* * Cache ( computed only once ) */
if ( repository != null ) return repository ; /* * Common validation .
* May throw a RepositoryConfigException */
validateFields ( ) ; try { /* * Creates the repository according to the Quest type . */
OntopSQLOWLAPIConfiguration . Builder configurationBuilder = OntopSQLOWLAPIConfiguration . defaultBuilder ( ) ; if ( ! obdaFile . getName ( ) . endsWith ( ".obda" ) ) { // probably an r2rml file
configurationBuilder . r2rmlMappingFile ( obdaFile ) ; } else { configurationBuilder . nativeOntopMappingFile ( obdaFile ) ; } owlFile . ifPresent ( configurationBuilder :: ontologyFile ) ; configurationBuilder . propertyFile ( propertiesFile ) ; constraintFile . ifPresent ( configurationBuilder :: basicImplicitConstraintFile ) ; repository = OntopRepository . defaultRepository ( configurationBuilder . build ( ) ) ; } /* * Problem during the repository instantiation .
* - - > Exception is re - thrown as a RepositoryConfigException . */
catch ( Exception e ) { e . printStackTrace ( ) ; throw new RepositoryConfigException ( "Could not create RDF4J Repository! Reason: " + e . getMessage ( ) ) ; } return repository ; |
public class HttpSupport { /** * Returns a collection of uploaded files and form fields from a multi - part request .
* This method uses < a href = " http : / / commons . apache . org / proper / commons - fileupload / apidocs / org / apache / commons / fileupload / disk / DiskFileItemFactory . html " > DiskFileItemFactory < / a > .
* As a result , it is recommended to add the following to your web . xml file :
* < pre >
* & lt ; listener & gt ;
* & lt ; listener - class & gt ;
* org . apache . commons . fileupload . servlet . FileCleanerCleanup
* & lt ; / listener - class & gt ;
* & lt ; / listener & gt ;
* < / pre >
* For more information , see : < a href = " http : / / commons . apache . org / proper / commons - fileupload / using . html " > Using FileUpload < / a >
* @ param encoding specifies the character encoding to be used when reading the headers of individual part .
* When not specified , or null , the request encoding is used . If that is also not specified , or null ,
* the platform default encoding is used .
* @ param maxUploadSize maximum size of the upload in bytes . A value of - 1 indicates no maximum .
* @ return a collection of uploaded files from a multi - part request . */
protected List < FormItem > multipartFormItems ( String encoding , long maxUploadSize ) { } } | // we are thread safe , because controllers are pinned to a thread and discarded after each request .
if ( RequestContext . getFormItems ( ) != null ) { return RequestContext . getFormItems ( ) ; } HttpServletRequest req = RequestContext . getHttpRequest ( ) ; if ( req instanceof AWMockMultipartHttpServletRequest ) { // running inside a test , and simulating upload .
RequestContext . setFormItems ( ( ( AWMockMultipartHttpServletRequest ) req ) . getFormItems ( ) ) ; } else { if ( ! ServletFileUpload . isMultipartContent ( req ) ) throw new ControllerException ( "this is not a multipart request, be sure to add this attribute to the form: ... enctype=\"multipart/form-data\" ..." ) ; DiskFileItemFactory factory = new DiskFileItemFactory ( ) ; factory . setSizeThreshold ( Configuration . getMaxUploadSize ( ) ) ; factory . setRepository ( Configuration . getTmpDir ( ) ) ; ServletFileUpload upload = new ServletFileUpload ( factory ) ; if ( encoding != null ) upload . setHeaderEncoding ( encoding ) ; upload . setFileSizeMax ( maxUploadSize ) ; try { List < org . apache . commons . fileupload . FileItem > apacheFileItems = upload . parseRequest ( RequestContext . getHttpRequest ( ) ) ; ArrayList items = new ArrayList < > ( ) ; for ( FileItem apacheItem : apacheFileItems ) { ApacheFileItemFacade f = new ApacheFileItemFacade ( apacheItem ) ; if ( f . isFormField ( ) ) { items . add ( new FormItem ( f ) ) ; } else { items . add ( new org . javalite . activeweb . FileItem ( f ) ) ; } } RequestContext . setFormItems ( items ) ; } catch ( Exception e ) { throw new ControllerException ( e ) ; } } return RequestContext . getFormItems ( ) ; |
public class ProcessThread { /** * Match thread that is waiting on lock identified by < tt > className < / tt > . */
public static @ Nonnull Predicate waitingToLock ( final @ Nonnull String className ) { } } | return new Predicate ( ) { @ Override public boolean isValid ( @ Nonnull ProcessThread < ? , ? , ? > thread ) { final ThreadLock lock = thread . getWaitingToLock ( ) ; return lock != null && lock . getClassName ( ) . equals ( className ) ; } } ; |
public class SystemProperties { /** * Gets a system property int , or a replacement value if the property is
* null or blank or not parseable
* @ param key
* @ param valueIfNullOrNotParseable
* @ return */
public static long getInt ( String key , int valueIfNullOrNotParseable ) { } } | String value = System . getProperty ( key ) ; if ( Strings . isNullOrEmpty ( value ) ) { return valueIfNullOrNotParseable ; } try { return Integer . parseInt ( value ) ; } catch ( NumberFormatException e ) { return valueIfNullOrNotParseable ; } |
public class GrailsPrintWriter { /** * Print an object . The string produced by the < code > { @ link
* java . lang . String # valueOf ( Object ) } < / code > method is translated into bytes
* according to the platform ' s default character encoding , and these bytes
* are written in exactly the manner of the < code > { @ link # write ( int ) } < / code >
* method .
* @ param obj The < code > Object < / code > to be printed
* @ see java . lang . Object # toString ( ) */
public void print ( final Object obj ) { } } | if ( trouble || obj == null ) { usageFlag = true ; return ; } Class < ? > clazz = obj . getClass ( ) ; if ( clazz == String . class ) { write ( ( String ) obj ) ; } else if ( clazz == StreamCharBuffer . class ) { write ( ( StreamCharBuffer ) obj ) ; } else if ( clazz == GStringImpl . class ) { write ( ( Writable ) obj ) ; } else if ( obj instanceof Writable ) { write ( ( Writable ) obj ) ; } else if ( obj instanceof CharSequence ) { try { usageFlag = true ; CharSequences . writeCharSequence ( getOut ( ) , ( CharSequence ) obj ) ; } catch ( IOException e ) { handleIOException ( e ) ; } } else { write ( String . valueOf ( obj ) ) ; } |
public class HostMessenger { /** * Get a unique ID for this cluster
* @ return */
public InstanceId getInstanceId ( ) { } } | if ( m_instanceId == null ) { try { byte [ ] data = m_zk . getData ( CoreZK . instance_id , false , null ) ; JSONObject idJSON = new JSONObject ( new String ( data , "UTF-8" ) ) ; m_instanceId = new InstanceId ( idJSON . getInt ( "coord" ) , idJSON . getLong ( "timestamp" ) ) ; } catch ( Exception e ) { String msg = "Unable to get instance ID info from " + CoreZK . instance_id ; hostLog . error ( msg ) ; throw new RuntimeException ( msg , e ) ; } } return m_instanceId ; |
public class Token { /** * Decrypt a message with this token .
* @ param msg The message to decrypt .
* @ return The encrypted message . Null if decryption failed . */
public byte [ ] decrypt ( byte [ ] msg ) { } } | if ( msg == null ) return null ; try { Cipher cipher = Cipher . getInstance ( ENCRYPTION_ALGORITHM_IMPLEMENTATION ) ; SecretKeySpec key = new SecretKeySpec ( getMd5 ( ) , ENCRYPTION_ALGORITHM ) ; IvParameterSpec iv = new IvParameterSpec ( getIv ( ) ) ; cipher . init ( Cipher . DECRYPT_MODE , key , iv ) ; return cipher . doFinal ( msg ) ; } catch ( Exception e ) { return null ; } |
public class NamedJdbcCursorItemReader { /** * Obtain a parsed representation of the given SQL statement .
* < p > The default implementation uses an LRU cache with an upper limit
* of 256 entries .
* @ param sql the original SQL
* @ return a representation of the parsed SQL statement */
protected ExposedParsedSql getParsedSql ( String sql ) { } } | if ( getCacheLimit ( ) <= 0 ) { return new ExposedParsedSql ( NamedParameterUtils . parseSqlStatement ( sql ) ) ; } synchronized ( this . parsedSqlCache ) { ExposedParsedSql parsedSql = this . parsedSqlCache . get ( sql ) ; if ( parsedSql == null ) { parsedSql = new ExposedParsedSql ( NamedParameterUtils . parseSqlStatement ( sql ) ) ; this . parsedSqlCache . put ( sql , parsedSql ) ; } return parsedSql ; } |
public class MetadataService { /** * Removes the specified { @ code member } from the { @ link ProjectMetadata } in the specified
* { @ code projectName } . It also removes permission of the specified { @ code member } from every
* { @ link RepositoryMetadata } . */
public CompletableFuture < Revision > removeMember ( Author author , String projectName , User member ) { } } | requireNonNull ( author , "author" ) ; requireNonNull ( projectName , "projectName" ) ; requireNonNull ( member , "member" ) ; final String commitSummary = "Remove the member '" + member . id ( ) + "' from the project " + projectName ; return metadataRepo . push ( projectName , Project . REPO_DOGMA , author , commitSummary , ( ) -> fetchMetadata ( projectName ) . thenApply ( metadataWithRevision -> { final ImmutableList . Builder < JsonPatchOperation > patches = ImmutableList . builder ( ) ; metadataWithRevision . object ( ) . repos ( ) . values ( ) . stream ( ) . filter ( r -> r . perUserPermissions ( ) . containsKey ( member . id ( ) ) ) . forEach ( r -> patches . add ( new RemoveOperation ( perUserPermissionPointer ( r . name ( ) , member . id ( ) ) ) ) ) ; patches . add ( new RemoveOperation ( JsonPointer . compile ( "/members" + encodeSegment ( member . id ( ) ) ) ) ) ; final Change < JsonNode > change = Change . ofJsonPatch ( METADATA_JSON , Jackson . valueToTree ( patches . build ( ) ) ) ; return HolderWithRevision . of ( change , metadataWithRevision . revision ( ) ) ; } ) ) ; |
public class LastaPrepareFilter { protected void saveMessageResourcesToHolder ( ServletContext context ) { } } | final MessageResources resources = getMessageResources ( context ) ; final RutsMessageResourceGateway gateway = newRutsMessageResourceGateway ( resources ) ; getMessageResourceHolder ( ) . acceptGateway ( gateway ) ; |
public class nstrafficdomain { /** * Use this API to clear nstrafficdomain . */
public static base_response clear ( nitro_service client , nstrafficdomain resource ) throws Exception { } } | nstrafficdomain clearresource = new nstrafficdomain ( ) ; clearresource . td = resource . td ; return clearresource . perform_operation ( client , "clear" ) ; |
public class ReviewsImpl { /** * The reviews created would show up for Reviewers on your team . As Reviewers complete reviewing , results of the Review would be POSTED ( i . e . HTTP POST ) on the specified CallBackEndpoint .
* & lt ; h3 & gt ; CallBack Schemas & lt ; / h3 & gt ;
* & lt ; h4 & gt ; Review Completion CallBack Sample & lt ; / h4 & gt ;
* & lt ; p & gt ;
* { & lt ; br / & gt ;
* " ReviewId " : " & lt ; Review Id & gt ; " , & lt ; br / & gt ;
* " ModifiedOn " : " 2016-10-11T22:36:32.9934851Z " , & lt ; br / & gt ;
* " ModifiedBy " : " & lt ; Name of the Reviewer & gt ; " , & lt ; br / & gt ;
* " CallBackType " : " Review " , & lt ; br / & gt ;
* " ContentId " : " & lt ; The ContentId that was specified input & gt ; " , & lt ; br / & gt ;
* " Metadata " : { & lt ; br / & gt ;
* " adultscore " : " 0 . xxx " , & lt ; br / & gt ;
* " a " : " False " , & lt ; br / & gt ;
* " racyscore " : " 0 . xxx " , & lt ; br / & gt ;
* " r " : " True " & lt ; br / & gt ;
* } , & lt ; br / & gt ;
* " ReviewerResultTags " : { & lt ; br / & gt ;
* " a " : " False " , & lt ; br / & gt ;
* " r " : " True " & lt ; br / & gt ;
* } & lt ; br / & gt ;
* } & lt ; br / & gt ;
* & lt ; / p & gt ; .
* @ param teamName Your team name .
* @ param contentType The content type .
* @ param createVideoReviewsBody Body for create reviews API
* @ param subTeam SubTeam of your team , you want to assign the created review to .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; String & gt ; object */
public Observable < ServiceResponse < List < String > > > createVideoReviewsWithServiceResponseAsync ( String teamName , String contentType , List < CreateVideoReviewsBodyItem > createVideoReviewsBody , String subTeam ) { } } | if ( this . client . baseUrl ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.baseUrl() is required and cannot be null." ) ; } if ( teamName == null ) { throw new IllegalArgumentException ( "Parameter teamName is required and cannot be null." ) ; } if ( contentType == null ) { throw new IllegalArgumentException ( "Parameter contentType is required and cannot be null." ) ; } if ( createVideoReviewsBody == null ) { throw new IllegalArgumentException ( "Parameter createVideoReviewsBody is required and cannot be null." ) ; } Validator . validate ( createVideoReviewsBody ) ; String parameterizedHost = Joiner . on ( ", " ) . join ( "{baseUrl}" , this . client . baseUrl ( ) ) ; return service . createVideoReviews ( teamName , contentType , subTeam , createVideoReviewsBody , this . client . acceptLanguage ( ) , parameterizedHost , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < List < String > > > > ( ) { @ Override public Observable < ServiceResponse < List < String > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < List < String > > clientResponse = createVideoReviewsDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class BuilderImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . security . jwt . internal . Builder # signWith ( java . lang . String , java . lang . String ) */
@ Override public Builder signWith ( String algorithm , String key ) throws KeyException { } } | if ( algorithm == null || algorithm . isEmpty ( ) || ! algorithm . equals ( Constants . SIGNATURE_ALG_HS256 ) ) { String err = Tr . formatMessage ( tc , "JWT_INVALID_ALGORITHM_ERR" , new Object [ ] { algorithm , Constants . SIGNATURE_ALG_HS256 } ) ; throw new KeyException ( err ) ; } if ( key == null || key . isEmpty ( ) ) { String err = Tr . formatMessage ( tc , "JWT_INVALID_KEY_ERR" , new Object [ ] { algorithm , key } ) ; throw new KeyException ( err ) ; } alg = algorithm ; sharedKey = key ; return this ; |
public class AzureBatchJobSubmissionHandler { /** * Invoked when JobSubmissionEvent is triggered .
* @ param jobSubmissionEvent triggered job submission event . */
@ Override public void onNext ( final JobSubmissionEvent jobSubmissionEvent ) { } } | LOG . log ( Level . FINEST , "Submitting job: {0}" , jobSubmissionEvent ) ; try { this . applicationId = createApplicationId ( jobSubmissionEvent ) ; final String folderName = this . azureBatchFileNames . getStorageJobFolder ( this . applicationId ) ; LOG . log ( Level . FINE , "Creating a job folder on Azure at: {0}." , folderName ) ; final URI jobFolderURL = this . azureStorageClient . getJobSubmissionFolderUri ( folderName ) ; LOG . log ( Level . FINE , "Getting a shared access signature for {0}." , folderName ) ; final String storageContainerSAS = this . azureStorageClient . createContainerSharedAccessSignature ( ) ; LOG . log ( Level . FINE , "Assembling Configuration for the Driver." ) ; final Configuration driverConfiguration = makeDriverConfiguration ( jobSubmissionEvent , this . applicationId , jobFolderURL ) ; LOG . log ( Level . FINE , "Making Job JAR." ) ; final File jobSubmissionJarFile = this . jobJarMaker . createJobSubmissionJAR ( jobSubmissionEvent , driverConfiguration ) ; LOG . log ( Level . FINE , "Uploading Job JAR to Azure." ) ; final URI jobJarSasUri = this . azureStorageClient . uploadFile ( folderName , jobSubmissionJarFile ) ; LOG . log ( Level . FINE , "Assembling application submission." ) ; final String command = this . launchCommandBuilder . buildDriverCommand ( jobSubmissionEvent ) ; this . azureBatchHelper . submitJob ( getApplicationId ( ) , storageContainerSAS , jobJarSasUri , command ) ; } catch ( final IOException e ) { LOG . log ( Level . SEVERE , "Error submitting Azure Batch request: {0}" , e ) ; throw new RuntimeException ( e ) ; } |
public class UIComponentClassicTagBase { /** * Invoke encodeBegin on the associated UIComponent . Subclasses can override this method to perform custom
* processing before or after the UIComponent method invocation . */
protected void encodeBegin ( ) throws IOException { } } | if ( log . isLoggable ( Level . FINE ) ) { log . fine ( "Entered encodeBegin for client-Id: " + _componentInstance . getClientId ( getFacesContext ( ) ) ) ; } _componentInstance . encodeBegin ( getFacesContext ( ) ) ; if ( log . isLoggable ( Level . FINE ) ) { log . fine ( "Exited encodeBegin" ) ; } |
public class LambdaToMethod { /** * Translate a lambda into a method to be inserted into the class .
* Then replace the lambda site with an invokedynamic call of to lambda
* meta - factory , which will use the lambda method .
* @ param tree */
@ Override public void visitLambda ( JCLambda tree ) { } } | LambdaTranslationContext localContext = ( LambdaTranslationContext ) context ; MethodSymbol sym = localContext . translatedSym ; MethodType lambdaType = ( MethodType ) sym . type ; { Symbol owner = localContext . owner ; ListBuffer < Attribute . TypeCompound > ownerTypeAnnos = new ListBuffer < Attribute . TypeCompound > ( ) ; ListBuffer < Attribute . TypeCompound > lambdaTypeAnnos = new ListBuffer < Attribute . TypeCompound > ( ) ; for ( Attribute . TypeCompound tc : owner . getRawTypeAttributes ( ) ) { if ( tc . position . onLambda == tree ) { lambdaTypeAnnos . append ( tc ) ; } else { ownerTypeAnnos . append ( tc ) ; } } if ( lambdaTypeAnnos . nonEmpty ( ) ) { owner . setTypeAttributes ( ownerTypeAnnos . toList ( ) ) ; sym . setTypeAttributes ( lambdaTypeAnnos . toList ( ) ) ; } } // create the method declaration hoisting the lambda body
JCMethodDecl lambdaDecl = make . MethodDef ( make . Modifiers ( sym . flags_field ) , sym . name , make . QualIdent ( lambdaType . getReturnType ( ) . tsym ) , List . < JCTypeParameter > nil ( ) , localContext . syntheticParams , lambdaType . getThrownTypes ( ) == null ? List . < JCExpression > nil ( ) : make . Types ( lambdaType . getThrownTypes ( ) ) , null , null ) ; lambdaDecl . sym = sym ; lambdaDecl . type = lambdaType ; // translate lambda body
// As the lambda body is translated , all references to lambda locals ,
// captured variables , enclosing members are adjusted accordingly
// to refer to the static method parameters ( rather than i . e . acessing to
// captured members directly ) .
lambdaDecl . body = translate ( makeLambdaBody ( tree , lambdaDecl ) ) ; // Add the method to the list of methods to be added to this class .
kInfo . addMethod ( lambdaDecl ) ; // now that we have generated a method for the lambda expression ,
// we can translate the lambda into a method reference pointing to the newly
// created method .
// Note that we need to adjust the method handle so that it will match the
// signature of the SAM descriptor - this means that the method reference
// should be added the following synthetic arguments :
// * the " this " argument if it is an instance method
// * enclosing locals captured by the lambda expression
ListBuffer < JCExpression > syntheticInits = new ListBuffer < > ( ) ; if ( localContext . methodReferenceReceiver != null ) { syntheticInits . append ( localContext . methodReferenceReceiver ) ; } else if ( ! sym . isStatic ( ) ) { syntheticInits . append ( makeThis ( sym . owner . enclClass ( ) . asType ( ) , localContext . owner . enclClass ( ) ) ) ; } // add captured locals
for ( Symbol fv : localContext . getSymbolMap ( CAPTURED_VAR ) . keySet ( ) ) { if ( fv != localContext . self ) { JCTree captured_local = make . Ident ( fv ) . setType ( fv . type ) ; syntheticInits . append ( ( JCExpression ) captured_local ) ; } } // add captured outer this instances ( used only when ` this ' capture itself is illegal )
for ( Symbol fv : localContext . getSymbolMap ( CAPTURED_OUTER_THIS ) . keySet ( ) ) { JCTree captured_local = make . QualThis ( fv . type ) ; syntheticInits . append ( ( JCExpression ) captured_local ) ; } // then , determine the arguments to the indy call
List < JCExpression > indy_args = translate ( syntheticInits . toList ( ) , localContext . prev ) ; // build a sam instance using an indy call to the meta - factory
int refKind = referenceKind ( sym ) ; // convert to an invokedynamic call
result = makeMetafactoryIndyCall ( context , refKind , sym , indy_args ) ; |
public class PrcRefreshItemsInList { /** * < p > Retrieve I18nItem list . < / p >
* @ param < T > item type
* @ param pReqVars additional param
* @ param pI18nItemClass I18nItem Class
* @ param pItemIdsIn Item ' s IDs
* @ return list
* @ throws Exception - an exception */
public final < T extends AI18nName < ? , ? > > List < T > retrieveI18nItem ( final Map < String , Object > pReqVars , final Class < T > pI18nItemClass , final String pItemIdsIn ) throws Exception { } } | pReqVars . put ( pI18nItemClass . getSimpleName ( ) + "hasNamedeepLevel" , 1 ) ; pReqVars . put ( pI18nItemClass . getSimpleName ( ) + "langdeepLevel" , 1 ) ; List < T > i18nItemLst = getSrvOrm ( ) . retrieveListWithConditions ( pReqVars , pI18nItemClass , "where HASNAME in " + pItemIdsIn ) ; pReqVars . remove ( pI18nItemClass . getSimpleName ( ) + "hasNamedeepLevel" ) ; pReqVars . remove ( pI18nItemClass . getSimpleName ( ) + "langdeepLevel" ) ; return i18nItemLst ; |
public class LayoutMap { /** * Returns { @ code true } if this map or a parent map - if any - contains a mapping for the
* specified key .
* @ param key key whose presence in this LayoutMap chain is to be tested .
* @ return { @ code true } if this map contains a column mapping for the specified key .
* @ throws NullPointerException if the key is { @ code null } .
* @ see Map # containsKey ( Object ) */
public boolean columnContainsKey ( String key ) { } } | String resolvedKey = resolveColumnKey ( key ) ; return columnMap . containsKey ( resolvedKey ) || parent != null && parent . columnContainsKey ( resolvedKey ) ; |
public class CalendarPanel { /** * setSizeOfWeekNumberLabels , This sets the minimum and preferred size of the week number
* labels , to be able to hold largest week number in the current week number label font .
* Note : The week number labels need to be added to the panel before this method can be called . */
private void setSizeOfWeekNumberLabels ( ) { } } | JLabel firstLabel = weekNumberLabels . get ( 0 ) ; Font font = firstLabel . getFont ( ) ; FontMetrics fontMetrics = firstLabel . getFontMetrics ( font ) ; int width = fontMetrics . stringWidth ( "53 " ) ; width += constantWeekNumberLabelInsets . left ; width += constantWeekNumberLabelInsets . right ; Dimension size = new Dimension ( width , 1 ) ; for ( JLabel currentLabel : weekNumberLabels ) { currentLabel . setMinimumSize ( size ) ; currentLabel . setPreferredSize ( size ) ; } topLeftLabel . setMinimumSize ( size ) ; topLeftLabel . setPreferredSize ( size ) ; |
public class CodeBuilderUtil { /** * Returns true if a public final method exists which matches the given
* specification . */
public static boolean isPublicMethodFinal ( Class clazz , String name , TypeDesc retType , TypeDesc [ ] params ) { } } | if ( ! clazz . isInterface ( ) ) { Class [ ] paramClasses ; if ( params == null || params . length == 0 ) { paramClasses = null ; } else { paramClasses = new Class [ params . length ] ; for ( int i = 0 ; i < params . length ; i ++ ) { paramClasses [ i ] = params [ i ] . toClass ( ) ; } } try { Method existing = clazz . getMethod ( name , paramClasses ) ; if ( Modifier . isFinal ( existing . getModifiers ( ) ) ) { if ( retType == null ) { retType = TypeDesc . forClass ( void . class ) ; } if ( TypeDesc . forClass ( existing . getReturnType ( ) ) == retType ) { // Method is already implemented and is final .
return true ; } } } catch ( NoSuchMethodException e ) { } } return false ; |
public class SerializationUtil { /** * Writes a collection to an { @ link ObjectDataOutput } . The collection ' s size is written
* to the data output , then each object in the collection is serialized .
* The collection is allowed to be null .
* @ param items collection of items to be serialized
* @ param out data output to write to
* @ param < T > type of items
* @ throws IOException when an error occurs while writing to the output */
public static < T > void writeNullableCollection ( Collection < T > items , ObjectDataOutput out ) throws IOException { } } | // write true when the collection is NOT null
out . writeBoolean ( items != null ) ; if ( items == null ) { return ; } writeCollection ( items , out ) ; |
public class CmsLocaleManager { /** * Returns the the appropriate locale / encoding for a request ,
* using the " right " locale handler for the given resource . < p >
* Certain system folders ( like the Workplace ) require a special
* locale handler different from the configured handler .
* Use this method if you want to resolve locales exactly like
* the system does for a request . < p >
* @ param req the current http request
* @ param user the current user
* @ param project the current project
* @ param resource the URI of the requested resource ( with full site root added )
* @ return the i18n information to use for the given request context */
public CmsI18nInfo getI18nInfo ( HttpServletRequest req , CmsUser user , CmsProject project , String resource ) { } } | CmsI18nInfo i18nInfo = null ; // check if this is a request against a Workplace folder
if ( OpenCms . getSiteManager ( ) . isWorkplaceRequest ( req ) ) { // The list of configured localized workplace folders
List < String > wpLocalizedFolders = OpenCms . getWorkplaceManager ( ) . getLocalizedFolders ( ) ; for ( int i = wpLocalizedFolders . size ( ) - 1 ; i >= 0 ; i -- ) { if ( resource . startsWith ( wpLocalizedFolders . get ( i ) ) ) { // use the workplace locale handler for this resource
i18nInfo = OpenCms . getWorkplaceManager ( ) . getI18nInfo ( req , user , project , resource ) ; break ; } } } if ( i18nInfo == null ) { // use default locale handler
i18nInfo = m_localeHandler . getI18nInfo ( req , user , project , resource ) ; } // check the request for special parameters overriding the locale handler
Locale locale = null ; String encoding = null ; if ( req != null ) { String localeParam = req . getParameter ( CmsLocaleManager . PARAMETER_LOCALE ) ; // check request for parameters
if ( localeParam != null ) { // " _ _ locale " parameter found in request
locale = CmsLocaleManager . getLocale ( localeParam ) ; } // check for " _ _ encoding " parameter in request
encoding = req . getParameter ( CmsLocaleManager . PARAMETER_ENCODING ) ; } // merge values from request with values from locale handler
if ( locale == null ) { locale = i18nInfo . getLocale ( ) ; } if ( encoding == null ) { encoding = i18nInfo . getEncoding ( ) ; } // still some values might be " null "
if ( locale == null ) { locale = getDefaultLocale ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_LOCALE_NOT_FOUND_1 , locale ) ) ; } } if ( encoding == null ) { encoding = OpenCms . getSystemInfo ( ) . getDefaultEncoding ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ENCODING_NOT_FOUND_1 , encoding ) ) ; } } // return the merged values
return new CmsI18nInfo ( locale , encoding ) ; |
public class Strings { /** * Joins the { @ linkplain String } representation of multiple { @ linkplain Object } s into a single { @ linkplain String } .
* The { @ linkplain Object # toString ( ) } is used to retrieve the Objects ' { @ linkplain String } representation .
* @ param objects the { @ linkplain Objects } s to join .
* @ param delim the delimiter to use for joining .
* @ return the joined { @ linkplain String } . */
public static String join ( Object [ ] objects , String delim ) { } } | return join ( Arrays . asList ( objects ) , delim , Integer . MAX_VALUE , ELLIPSIS ) ; |
public class DefaultGroovyMethods { /** * Truncate the value
* @ param number a BigDecimal
* @ param precision the number of decimal places to keep
* @ return a BigDecimal truncated to the number of decimal places specified by precision
* @ see # trunc ( java . math . BigDecimal )
* @ since 2.5.0 */
public static BigDecimal trunc ( BigDecimal number , int precision ) { } } | return number . setScale ( precision , RoundingMode . DOWN ) ; |
public class VisitUrl { /** * Get Resource Url for GetVisit
* @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter should only be used to retrieve data . Attempting to update data using this parameter may cause data loss .
* @ param visitId Unique identifier of the customer visit to update .
* @ return String Resource Url */
public static MozuUrl getVisitUrl ( String responseFields , String visitId ) { } } | UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/visits/{visitId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "visitId" , visitId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; |
public class DownloadFilesActionListener { /** * Cancels the file download .
* @ param hideWindowImmediately
* determines if the download progress window should be hidden
* immediately or only when the progress of cancelling the
* download has occurred gracefully . */
public void cancelDownload ( final boolean hideWindowImmediately ) { } } | logger . info ( "Cancel of download requested" ) ; _cancelled = true ; if ( hideWindowImmediately && _downloadProgressWindow != null ) { WidgetUtils . invokeSwingAction ( _downloadProgressWindow :: close ) ; } |
public class ReceiptTemplate { /** * Set Element
* @ param title the receipt element title
* @ param subtitle the receipt element subtitle
* @ param quantity the receipt element quantity
* @ param price the receipt element price
* @ param currency the receipt element currency
* @ param image _ url the receipt element image url */
public void setElement ( String title , String subtitle , String quantity , String price , String currency , String image_url ) { } } | HashMap < String , String > element = new HashMap < String , String > ( ) ; element . put ( "title" , title ) ; element . put ( "subtitle" , subtitle ) ; element . put ( "quantity" , quantity ) ; element . put ( "price" , price ) ; element . put ( "currency" , currency ) ; element . put ( "image_url" , image_url ) ; this . elements . add ( element ) ; |
public class ObstacleAvoidanceQuery { /** * vector normalization that ignores the y - component . */
void dtNormalize2D ( float [ ] v ) { } } | float d = ( float ) Math . sqrt ( v [ 0 ] * v [ 0 ] + v [ 2 ] * v [ 2 ] ) ; if ( d == 0 ) return ; d = 1.0f / d ; v [ 0 ] *= d ; v [ 2 ] *= d ; |
public class RtfPageSetting { /** * Writes the page size / page margin definition */
public void writeDefinition ( final OutputStream result ) throws IOException { } } | result . write ( PAGE_WIDTH ) ; result . write ( intToByteArray ( pageWidth ) ) ; result . write ( PAGE_HEIGHT ) ; result . write ( intToByteArray ( pageHeight ) ) ; result . write ( MARGIN_LEFT ) ; result . write ( intToByteArray ( marginLeft ) ) ; result . write ( MARGIN_RIGHT ) ; result . write ( intToByteArray ( marginRight ) ) ; result . write ( MARGIN_TOP ) ; result . write ( intToByteArray ( marginTop ) ) ; result . write ( MARGIN_BOTTOM ) ; result . write ( intToByteArray ( marginBottom ) ) ; this . document . outputDebugLinebreak ( result ) ; |
public class KeyVaultClientBaseImpl { /** * Lists deleted secrets for the specified vault .
* The Get Deleted Secrets operation returns the secrets that have been deleted for a vault enabled for soft - delete . This operation requires the secrets / list permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param maxresults Maximum number of results to return in a page . If not specified the service will return up to 25 results .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; DeletedSecretItem & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < DeletedSecretItem > > > getDeletedSecretsSinglePageAsync ( final String vaultBaseUrl , final Integer maxresults ) { } } | if ( vaultBaseUrl == null ) { throw new IllegalArgumentException ( "Parameter vaultBaseUrl is required and cannot be null." ) ; } if ( this . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.apiVersion() is required and cannot be null." ) ; } String parameterizedHost = Joiner . on ( ", " ) . join ( "{vaultBaseUrl}" , vaultBaseUrl ) ; return service . getDeletedSecrets ( maxresults , this . apiVersion ( ) , this . acceptLanguage ( ) , parameterizedHost , this . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < DeletedSecretItem > > > > ( ) { @ Override public Observable < ServiceResponse < Page < DeletedSecretItem > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < DeletedSecretItem > > result = getDeletedSecretsDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < DeletedSecretItem > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class ColorBuilder { /** * Build a Gray color .
* @ param gColor the gray color enum
* @ return the javafx color */
private Color buildGrayColor ( final GrayColor gColor ) { } } | Color color = null ; if ( gColor . opacity ( ) >= 1.0 ) { color = Color . gray ( gColor . gray ( ) ) ; } else { color = Color . gray ( gColor . gray ( ) , gColor . opacity ( ) ) ; } return color ; |
public class DetectPolygonFromContour { /** * Returns the undistorted contour for a shape . Data is potentially recycled the next time
* any function in this class is invoked .
* @ param info Which shape
* @ return List of points in the contour */
public List < Point2D_I32 > getContour ( Info info ) { } } | contourTmp . reset ( ) ; contourFinder . loadContour ( info . contour . externalIndex , contourTmp ) ; return contourTmp . toList ( ) ; |
public class ContentsDao { /** * Get or create a Geometry Columns DAO
* @ return geometry columns dao
* @ throws SQLException
* upon dao creation failure */
private GeometryColumnsDao getGeometryColumnsDao ( ) throws SQLException { } } | if ( geometryColumnsDao == null ) { geometryColumnsDao = DaoManager . createDao ( connectionSource , GeometryColumns . class ) ; } return geometryColumnsDao ; |
public class LinkedDeque { /** * Unlinks the non - null last element . */
E unlinkLast ( ) { } } | final E l = last ; final E prev = l . getPrevious ( ) ; l . setPrevious ( null ) ; last = prev ; if ( prev == null ) { first = null ; } else { prev . setNext ( null ) ; } return l ; |
public class QNotIn { /** * { @ inheritDoc } */
@ Override public QNotIn appendSQL ( final SQLSelect _sql ) throws EFapsException { } } | getAttribute ( ) . appendSQL ( _sql ) ; _sql . addPart ( SQLPart . NOT ) . addPart ( SQLPart . IN ) . addPart ( SQLPart . PARENTHESIS_OPEN ) ; getValue ( ) . appendSQL ( _sql ) ; _sql . addPart ( SQLPart . PARENTHESIS_CLOSE ) ; return this ; |
public class NumberStyleHelper { /** * Append the 19.348 number : grouping attribute . Default = false .
* @ param util a util for XML writing
* @ param appendable where to write
* @ throws IOException If an I / O error occurs */
private void appendGroupingAttribute ( final XMLUtil util , final Appendable appendable ) throws IOException { } } | if ( this . grouping ) util . appendAttribute ( appendable , "number:grouping" , "true" ) ; |
public class MonetaryFormat { /** * Prefix formatted output by currency code . This configuration is not relevant for parsing . */
public MonetaryFormat prefixCode ( ) { } } | if ( codePrefixed ) return this ; else return new MonetaryFormat ( negativeSign , positiveSign , zeroDigit , decimalMark , minDecimals , decimalGroups , shift , roundingMode , codes , codeSeparator , true ) ; |
public class NettyNetworkManager { /** * { @ inheritDoc }
* @ throws IllegalStateException If manager is already closed . */
@ Override public Channel openChannel ( ) throws IOException , IllegalStateException { } } | assertOpen ( ) ; try { return this . bootstrap . clone ( ) . register ( ) . sync ( ) . channel ( ) ; } catch ( Exception e ) { throw new IOException ( "Could not open channel." , e ) ; } |
public class Binder { /** * Catch the given exception type from the downstream chain and handle it with the
* given function .
* @ param throwable the exception type to catch
* @ param function the function to use for handling the exception
* @ return a new Binder */
public Binder catchException ( Class < ? extends Throwable > throwable , MethodHandle function ) { } } | return new Binder ( this , new Catch ( throwable , function ) ) ; |
public class SynonymsLibrary { /** * 刷新一个 , 将值设置为null
* @ param key
* @ return */
public static void reload ( String key ) { } } | if ( ! MyStaticValue . ENV . containsKey ( key ) ) { // 如果变量中不存在直接删掉这个key不解释了
remove ( key ) ; } putIfAbsent ( key , MyStaticValue . ENV . get ( key ) ) ; KV < String , SmartForest < List < String > > > kv = SYNONYMS . get ( key ) ; init ( key , kv , true ) ; |
public class TransactionImpl { /** * Only lock the specified object , represented by
* the { @ link RuntimeObject } instance .
* @ param cld The { @ link org . apache . ojb . broker . metadata . ClassDescriptor }
* of the object to acquire a lock on .
* @ param oid The { @ link org . apache . ojb . broker . Identity } of the object to lock .
* @ param lockMode lock mode to acquire . The lock modes
* are < code > READ < / code > , < code > UPGRADE < / code > , and < code > WRITE < / code > .
* @ exception LockNotGrantedException Description of Exception */
void doSingleLock ( ClassDescriptor cld , Object obj , Identity oid , int lockMode ) throws LockNotGrantedException { } } | LockManager lm = implementation . getLockManager ( ) ; if ( cld . isAcceptLocks ( ) ) { if ( lockMode == Transaction . READ ) { if ( log . isDebugEnabled ( ) ) log . debug ( "Do READ lock on object: " + oid ) ; if ( ! lm . readLock ( this , oid , obj ) ) { throw new LockNotGrantedException ( "Can not lock for READ: " + oid ) ; } } else if ( lockMode == Transaction . WRITE ) { if ( log . isDebugEnabled ( ) ) log . debug ( "Do WRITE lock on object: " + oid ) ; if ( ! lm . writeLock ( this , oid , obj ) ) { throw new LockNotGrantedException ( "Can not lock for WRITE: " + oid ) ; } } else if ( lockMode == Transaction . UPGRADE ) { if ( log . isDebugEnabled ( ) ) log . debug ( "Do UPGRADE lock on object: " + oid ) ; if ( ! lm . upgradeLock ( this , oid , obj ) ) { throw new LockNotGrantedException ( "Can not lock for UPGRADE: " + oid ) ; } } } else { if ( log . isDebugEnabled ( ) ) { log . debug ( "Class '" + cld . getClassNameOfObject ( ) + "' doesn't accept locks" + " (accept-locks=false) when implicite locked, so OJB skip this object: " + oid ) ; } } |
public class TheMovieDbApi { /** * The similar movies method will let you retrieve the similar movies for a
* particular movie .
* This data is created dynamically but with the help of users votes on
* TMDb .
* The data is much better with movies that have more keywords
* @ param movieId movieId
* @ param language language
* @ param page page
* @ return
* @ throws MovieDbException exception */
public ResultList < MovieInfo > getSimilarMovies ( int movieId , Integer page , String language ) throws MovieDbException { } } | return tmdbMovies . getSimilarMovies ( movieId , page , language ) ; |
public class IndexImage { /** * Creates an { @ code IndexColorModel } from the given image , using an adaptive
* palette .
* @ param pImage the image to get { @ code IndexColorModel } from
* @ param pNumberOfColors the number of colors for the { @ code IndexColorModel }
* @ param pHints use fast mode if possible ( might give slightly lower
* quality )
* @ return a new { @ code IndexColorModel } created from the given image */
private static IndexColorModel createIndexColorModel ( BufferedImage pImage , int pNumberOfColors , int pHints ) { } } | // TODO : Use ImageUtil . hasTransparentPixels ( pImage , true ) | |
// - - haraldK , 20021024 , experimental , try to use one transparent pixel
boolean useTransparency = isTransparent ( pHints ) ; if ( useTransparency ) { pNumberOfColors -- ; } // System . out . println ( " Transp : " + useTransparency + " colors : " + pNumberOfColors ) ;
int width = pImage . getWidth ( ) ; int height = pImage . getHeight ( ) ; // Using 4 bits from R , G & B .
@ SuppressWarnings ( "unchecked" ) List < Counter > [ ] colors = new List [ 1 << 12 ] ; // [4096]
// Speedup , doesn ' t decrease image quality much
int step = 1 ; if ( isFast ( pHints ) ) { step += ( width * height / 16384 ) ; // 128x128px
} int sampleCount = 0 ; int rgb ; // for ( int x = 0 ; x < width ; x + + ) {
// for ( int y = 0 ; y < height ; y + + ) {
for ( int x = 0 ; x < width ; x ++ ) { for ( int y = x % step ; y < height ; y += step ) { // Count the number of color samples
sampleCount ++ ; // Get ARGB pixel from image
rgb = ( pImage . getRGB ( x , y ) & 0xFFFFFF ) ; // Get index from high four bits of each component .
int index = ( ( ( rgb & 0xF00000 ) >>> 12 ) | ( ( rgb & 0x00F000 ) >>> 8 ) | ( ( rgb & 0x0000F0 ) >>> 4 ) ) ; // Get the ' hash vector ' for that key .
List < Counter > v = colors [ index ] ; if ( v == null ) { // No colors in this bin yet so create vector and
// add color .
v = new ArrayList < Counter > ( ) ; v . add ( new Counter ( rgb ) ) ; colors [ index ] = v ; } else { // Find our color in the bin or create a counter for it .
Iterator i = v . iterator ( ) ; while ( true ) { if ( i . hasNext ( ) ) { // try adding our color to each counter . . .
if ( ( ( Counter ) i . next ( ) ) . add ( rgb ) ) { break ; } } else { v . add ( new Counter ( rgb ) ) ; break ; } } } } } // All colours found , reduce to pNumberOfColors
int numberOfCubes = 1 ; int fCube = 0 ; Cube [ ] cubes = new Cube [ pNumberOfColors ] ; cubes [ 0 ] = new Cube ( colors , sampleCount ) ; // cubes [ 0 ] = new Cube ( colors , width * height ) ;
while ( numberOfCubes < pNumberOfColors ) { while ( cubes [ fCube ] . isDone ( ) ) { fCube ++ ; if ( fCube == numberOfCubes ) { break ; } } if ( fCube == numberOfCubes ) { break ; } Cube cube = cubes [ fCube ] ; Cube newCube = cube . split ( ) ; if ( newCube != null ) { if ( newCube . count > cube . count ) { Cube tmp = cube ; cube = newCube ; newCube = tmp ; } int j = fCube ; int count = cube . count ; for ( int i = fCube + 1 ; i < numberOfCubes ; i ++ ) { if ( cubes [ i ] . count < count ) { break ; } cubes [ j ++ ] = cubes [ i ] ; } cubes [ j ++ ] = cube ; count = newCube . count ; while ( j < numberOfCubes ) { if ( cubes [ j ] . count < count ) { break ; } j ++ ; } System . arraycopy ( cubes , j , cubes , j + 1 , numberOfCubes - j ) ; cubes [ j ] = newCube ; numberOfCubes ++ ; } } // Create RGB arrays with correct number of colors
// If we have transparency , the last color will be the transparent one
byte [ ] r = new byte [ useTransparency ? numberOfCubes + 1 : numberOfCubes ] ; byte [ ] g = new byte [ useTransparency ? numberOfCubes + 1 : numberOfCubes ] ; byte [ ] b = new byte [ useTransparency ? numberOfCubes + 1 : numberOfCubes ] ; for ( int i = 0 ; i < numberOfCubes ; i ++ ) { int val = cubes [ i ] . averageColor ( ) ; r [ i ] = ( byte ) ( ( val >> 16 ) & 0xFF ) ; g [ i ] = ( byte ) ( ( val >> 8 ) & 0xFF ) ; b [ i ] = ( byte ) ( ( val ) & 0xFF ) ; // System . out . println ( " Color [ " + i + " ] : # " +
// ( ( ( val > > 16 ) < 16 ) ? " 0 " : " " ) +
// Integer . toHexString ( val ) ) ;
} // For some reason using less than 8 bits causes a bug in the dither
// - transparency added to all totally black colors ?
int numOfBits = 8 ; // - - haraldK , 20021024 , as suggested by Thomas E . Deweese
// plus adding a transparent pixel
IndexColorModel icm ; if ( useTransparency ) { icm = new InverseColorMapIndexColorModel ( numOfBits , r . length , r , g , b , r . length - 1 ) ; } else { icm = new InverseColorMapIndexColorModel ( numOfBits , r . length , r , g , b ) ; } return icm ; |
public class XmlParser { /** * Parse a processing instruction and do a call - back .
* < pre >
* [ 16 ] PI : : = ' & lt ; ? ' PITarget
* ( S ( Char * - ( Char * ' ? & gt ; ' Char * ) ) ) ?
* ' ? & gt ; '
* [ 17 ] PITarget : : = Name - ( ( ' X ' | ' x ' ) ( ' M ' | m ' ) ( ' L ' | l ' ) )
* < / pre >
* ( The < code > & lt ; ? < / code > has already been read . ) */
private void parsePI ( ) throws SAXException , IOException { } } | String name ; boolean saved = expandPE ; expandPE = false ; name = readNmtoken ( true ) ; // NE08
if ( name . indexOf ( ':' ) >= 0 ) { fatal ( "Illegal character(':') in processing instruction name " , name , null ) ; } if ( "xml" . equalsIgnoreCase ( name ) ) { fatal ( "Illegal processing instruction target" , name , null ) ; } if ( ! tryRead ( endDelimPI ) ) { requireWhitespace ( ) ; parseUntil ( endDelimPI ) ; } expandPE = saved ; handler . processingInstruction ( name , dataBufferToString ( ) ) ; |
public class DevLockManager { public int getJvmPid ( ) { } } | int pid = - 1 ; if ( strPID != null ) { try { pid = Integer . parseInt ( strPID ) ; } catch ( NumberFormatException e ) { } } return pid ; |
public class AmqpChannel { /** * Confirms to the peer that a flow command was received and processed .
* @ return AmqpChannel */
private AmqpChannel closeOkChannel ( ) { } } | if ( readyState == ReadyState . CLOSED ) { // If the channel has been closed , just bail .
return this ; } Object [ ] args = { } ; WrappedByteBuffer bodyArg = null ; HashMap < String , Object > headersArg = null ; String methodName = "closeOkChannel" ; String methodId = "20" + "41" ; AmqpMethod amqpMethod = MethodLookup . LookupMethod ( methodId ) ; ; Object [ ] arguments = { this , amqpMethod , this . id , args , bodyArg , headersArg } ; asyncClient . enqueueAction ( methodName , "channelWrite" , arguments , null , null ) ; return this ; |
public class URAPIs_UserGroupSearchBases { /** * Tear down the test . */
@ AfterClass public static void teardownClass ( ) throws Exception { } } | try { if ( libertyServer != null ) { libertyServer . stopServer ( "CWIML4537E" ) ; } } finally { if ( ds != null ) { ds . shutDown ( true ) ; } } libertyServer . deleteFileFromLibertyInstallRoot ( "lib/features/internalfeatures/securitylibertyinternals-1.0.mf" ) ; |
public class BootiqueSarlcMain { /** * Run the batch compiler .
* < p > This function runs the compiler and exits with the return code .
* @ param args the command line arguments .
* @ return the exit code . */
public int runCompiler ( String ... args ) { } } | try { final BQRuntime runtime = createRuntime ( args ) ; final CommandOutcome outcome = runtime . run ( ) ; if ( ! outcome . isSuccess ( ) && outcome . getException ( ) != null ) { Logger . getRootLogger ( ) . error ( outcome . getMessage ( ) , outcome . getException ( ) ) ; } return outcome . getExitCode ( ) ; } catch ( ProvisionException exception ) { final Throwable ex = Throwables . getRootCause ( exception ) ; if ( ex != null ) { Logger . getRootLogger ( ) . error ( ex . getLocalizedMessage ( ) ) ; } else { Logger . getRootLogger ( ) . error ( exception . getLocalizedMessage ( ) ) ; } } catch ( Throwable exception ) { Logger . getRootLogger ( ) . error ( exception . getLocalizedMessage ( ) ) ; } return Constants . ERROR_CODE ; |
public class LinearStochasticLaw { /** * Replies a random value that respect
* the current stochastic law .
* @ param minX is the lower bound of the distribution
* @ param maxX is the upper bound of the distribution
* @ param ascendent indicates of the distribution function is ascendent or not
* @ return a value depending of the stochastic law parameters
* @ throws MathException when error in the math definition . */
@ Pure public static double random ( double minX , double maxX , boolean ascendent ) throws MathException { } } | return StochasticGenerator . generateRandomValue ( new LinearStochasticLaw ( minX , maxX , ascendent ) ) ; |
public class SimpleScriptRunner { /** * Expects a property ' script ' , containing the actual script to be run .
* Specify ' page _ interval _ in _ minutes ' and ' page _ offset _ in _ minutes '
* to have script run periodically . */
public void setProperties ( Properties properties ) { } } | script = properties . getProperty ( "script" , script ) ; pageIntervalInMinutes = Integer . parseInt ( properties . getProperty ( "page_interval_in_minutes" , "" + pageIntervalInMinutes ) ) ; pageOffsetInMinutes = Integer . parseInt ( properties . getProperty ( "page_offset_in_minutes" , "" + pageOffsetInMinutes ) ) ; |
public class ConfigCheckReport { /** * < pre >
* Scope name as key
* < / pre >
* < code > map & lt ; string , . alluxio . grpc . meta . InconsistentProperties & gt ; errors = 1 ; < / code > */
public boolean containsErrors ( java . lang . String key ) { } } | if ( key == null ) { throw new java . lang . NullPointerException ( ) ; } return internalGetErrors ( ) . getMap ( ) . containsKey ( key ) ; |
public class ExpressionsRetinaApiImpl { /** * { @ inheritDoc } */
@ Override public List < Context > getContexts ( Pagination pagination , Boolean includeFingerprint , Double sparsity , String jsonModel ) throws JsonProcessingException , ApiException { } } | pagination = initPagination ( pagination ) ; LOG . debug ( "Retrieve contexts for expression: model: " + jsonModel + " pagination: " + pagination . toString ( ) + " sparsity: " + sparsity + " include fingerprint: " + includeFingerprint ) ; return this . expressionsApi . getContextsForExpression ( jsonModel , includeFingerprint , retinaName , pagination . getStartIndex ( ) , pagination . getMaxResults ( ) , sparsity ) ; |
public class TransposePathElement { /** * This method is used when the TransposePathElement is used on the LFH as data .
* Aka , normal " evaluate " returns either a Number or a String .
* @ param walkedPath WalkedPath to evaluate against
* @ return The data specified by this TransposePathElement . */
public Optional < Object > objectEvaluate ( WalkedPath walkedPath ) { } } | // Grap the data we need from however far up the tree we are supposed to go
PathStep pathStep = walkedPath . elementFromEnd ( upLevel ) ; if ( pathStep == null ) { return Optional . empty ( ) ; } Object treeRef = pathStep . getTreeRef ( ) ; // Now walk down from that level using the subPathReader
if ( subPathReader == null ) { return Optional . of ( treeRef ) ; } else { return subPathReader . read ( treeRef , walkedPath ) ; } |
public class Choice3 { /** * Specialize this choice ' s projection to a { @ link Tuple3 } .
* @ return a { @ link Tuple3} */
@ Override public Tuple3 < Maybe < A > , Maybe < B > , Maybe < C > > project ( ) { } } | return into3 ( HList :: tuple , CoProduct3 . super . project ( ) ) ; |
public class OnBindViewHolderListenerImpl { /** * is called in onBindViewHolder to bind the data on the ViewHolder
* @ param viewHolder the viewHolder for the type at this position
* @ param position the position of this viewHolder
* @ param payloads the payloads provided by the adapter */
@ Override public void onBindViewHolder ( RecyclerView . ViewHolder viewHolder , int position , List < Object > payloads ) { } } | Object tag = viewHolder . itemView . getTag ( R . id . fastadapter_item_adapter ) ; if ( tag instanceof FastAdapter ) { FastAdapter fastAdapter = ( ( FastAdapter ) tag ) ; IItem item = fastAdapter . getItem ( position ) ; if ( item != null ) { item . bindView ( viewHolder , payloads ) ; if ( viewHolder instanceof FastAdapter . ViewHolder ) { ( ( FastAdapter . ViewHolder ) viewHolder ) . bindView ( item , payloads ) ; } // set the R . id . fastadapter _ item tag of this item to the item object ( can be used when retrieving the view )
viewHolder . itemView . setTag ( R . id . fastadapter_item , item ) ; } } |
public class ParaClient { /** * Searches for objects that have similar property values to a given text . A " find like this " query .
* @ param < P > type of the object
* @ param type the type of object to search for . See { @ link com . erudika . para . core . ParaObject # getType ( ) }
* @ param filterKey exclude an object with this key from the results ( optional )
* @ param fields a list of property names
* @ param liketext text to compare to
* @ param pager a { @ link com . erudika . para . utils . Pager }
* @ return a list of objects found */
public < P extends ParaObject > List < P > findSimilar ( String type , String filterKey , String [ ] fields , String liketext , Pager ... pager ) { } } | MultivaluedMap < String , String > params = new MultivaluedHashMap < > ( ) ; params . put ( "fields" , fields == null ? null : Arrays . asList ( fields ) ) ; params . putSingle ( "filterid" , filterKey ) ; params . putSingle ( "like" , liketext ) ; params . putSingle ( Config . _TYPE , type ) ; params . putAll ( pagerToParams ( pager ) ) ; return getItems ( find ( "similar" , params ) , pager ) ; |
public class JDBCValueContentAddressStorageImpl { /** * { @ inheritDoc } */
public boolean hasSharedContent ( String propertyId ) throws VCASException { } } | try { Connection con = dataSource . getConnection ( ) ; PreparedStatement ps = null ; try { ps = con . prepareStatement ( sqlSelectSharingProps ) ; ps . setString ( 1 , propertyId ) ; return ps . executeQuery ( ) . next ( ) ; } finally { if ( ps != null ) { try { ps . close ( ) ; } catch ( SQLException e ) { LOG . error ( "Can't close the Statement: " + e . getMessage ( ) ) ; } } con . close ( ) ; } } catch ( SQLException e ) { throw new VCASException ( "VCAS HAS SHARED IDs database error: " + e , e ) ; } |
public class TimeTileSkin { /** * * * * * * Resizing * * * * * */
@ Override protected void resizeDynamicText ( ) { } } | double fontSize = size * 0.24 ; leftText . setFont ( Fonts . latoRegular ( fontSize ) ) ; rightText . setFont ( Fonts . latoRegular ( fontSize ) ) ; |
public class TSDB { /** * Given a prefix search , returns matching metric names .
* @ param search A prefix to search .
* @ param max _ results Maximum number of results to return .
* @ since 2.0 */
public List < String > suggestMetrics ( final String search , final int max_results ) { } } | return metrics . suggest ( search , max_results ) ; |
public class BigQueryOutputConfiguration { /** * A helper function to set the required output keys in the given configuration .
* @ param conf the configuration to set the keys on .
* @ param qualifiedOutputTableId the qualified id of the output table in the form : < code > ( Optional
* ProjectId ) : [ DatasetId ] . [ TableId ] < / code > . If the project id is missing , the default project
* id is attempted { @ link BigQueryConfiguration # PROJECT _ ID _ KEY } .
* @ param outputTableSchemaJson the schema of the BigQuery output table .
* @ param outputGcsPath the path in GCS to stage data in . Example : ' gs : / / bucket / job ' .
* @ param outputFileFormat the formatting of the data being written by the output format class .
* @ param outputFormatClass the file output format that will write files to GCS .
* @ throws IOException */
@ SuppressWarnings ( "rawtypes" ) public static void configure ( Configuration conf , String qualifiedOutputTableId , String outputTableSchemaJson , String outputGcsPath , BigQueryFileFormat outputFileFormat , Class < ? extends FileOutputFormat > outputFormatClass ) throws IOException { } } | Preconditions . checkArgument ( ! Strings . isNullOrEmpty ( outputTableSchemaJson ) , "outputTableSchemaJson must not be null or empty." ) ; TableReference outputTable = BigQueryStrings . parseTableReference ( qualifiedOutputTableId ) ; configure ( conf , outputTable . getProjectId ( ) , outputTable . getDatasetId ( ) , outputTable . getTableId ( ) , Optional . of ( outputTableSchemaJson ) , outputGcsPath , outputFileFormat , outputFormatClass ) ; |
public class BraveTracer { /** * Injects the underlying context using B3 encoding by default . */
@ Override public < C > void inject ( SpanContext spanContext , Format < C > format , C carrier ) { } } | Injector < TextMap > injector = formatToInjector . get ( format ) ; if ( injector == null ) { throw new UnsupportedOperationException ( format + " not in " + formatToInjector . keySet ( ) ) ; } TraceContext traceContext = ( ( BraveSpanContext ) spanContext ) . unwrap ( ) ; injector . inject ( traceContext , ( TextMap ) carrier ) ; |
public class TimeRangeMeter { /** * Return the probe ' s next sample . */
public final double sampleCount ( ) { } } | long count = _count . get ( ) ; long lastCount = _lastCount . getAndSet ( count ) ; return count - lastCount ; |
public class SqlSelectByPkStatement { /** * Build a Pk - Query base on the ClassDescriptor .
* @ param cld
* @ return a select by PK query */
private static Query buildQuery ( ClassDescriptor cld ) { } } | FieldDescriptor [ ] pkFields = cld . getPkFields ( ) ; Criteria crit = new Criteria ( ) ; for ( int i = 0 ; i < pkFields . length ; i ++ ) { crit . addEqualTo ( pkFields [ i ] . getAttributeName ( ) , null ) ; } return new QueryByCriteria ( cld . getClassOfObject ( ) , crit ) ; |
public class LazyTreeReader { /** * Returns the value corresponding to currentRow , suitable for calling from outside
* @ param currentRow
* @ param previous
* @ return
* @ throws IOException */
public Object get ( long currentRow , Object previous ) throws IOException { } } | seekToRow ( currentRow ) ; return next ( previous ) ; |
public class Csv2ExtJsLocaleService { /** * Extracts the column index of the given locale in the CSV file .
* @ param locale
* @ param csvReader
* @ return
* @ throws IOException
* @ throws Exception */
private int detectColumnIndexOfLocale ( String locale , CSVReader csvReader ) throws Exception { } } | int indexOfLocale = - 1 ; List < String > headerLine = Arrays . asList ( ArrayUtils . nullToEmpty ( csvReader . readNext ( ) ) ) ; if ( headerLine == null || headerLine . isEmpty ( ) ) { throw new Exception ( "CSV locale file seems to be empty." ) ; } if ( headerLine . size ( ) < 3 ) { // we expect at least three columns : component ; field ; locale1
throw new Exception ( "CSV locale file is invalid: Not enough columns." ) ; } // start with the third column as the first two columns must not be a
// locale column
for ( int i = 2 ; i < headerLine . size ( ) ; i ++ ) { String columnName = headerLine . get ( i ) ; if ( locale . equalsIgnoreCase ( columnName ) ) { indexOfLocale = headerLine . indexOf ( columnName ) ; break ; } } if ( indexOfLocale < 0 ) { throw new Exception ( "Could not find locale " + locale + " in CSV file" ) ; } return indexOfLocale ; |
public class QuadCurve { /** * Configures the start , control , and end points for this curve . */
public void setCurve ( XY p1 , XY cp , XY p2 ) { } } | setCurve ( p1 . x ( ) , p1 . y ( ) , cp . x ( ) , cp . y ( ) , p2 . x ( ) , p2 . y ( ) ) ; |
public class CmsEditModelPageMenuEntry { /** * Opens the editor for a model page menu entry . < p >
* @ param resourcePath the resource path of the model page
* @ param isModelGroup if the given entry is a model group page */
public static void editModelPage ( final String resourcePath , boolean isModelGroup ) { } } | if ( CmsSitemapView . getInstance ( ) . getController ( ) . getData ( ) . isShowModelEditConfirm ( ) ) { I_CmsConfirmDialogHandler handler = new I_CmsConfirmDialogHandler ( ) { public void onClose ( ) { // noop
} public void onOk ( ) { openEditor ( resourcePath ) ; } } ; String dialogTitle ; String dialogContent ; if ( isModelGroup ) { dialogTitle = Messages . get ( ) . key ( Messages . GUI_EDIT_MODEL_GROUPS_CONFIRM_TITLE_0 ) ; dialogContent = Messages . get ( ) . key ( Messages . GUI_EDIT_MODEL_GROUP_CONFIRM_CONTENT_0 ) ; } else { dialogTitle = Messages . get ( ) . key ( Messages . GUI_EDIT_MODELPAGE_CONFIRM_TITLE_0 ) ; dialogContent = Messages . get ( ) . key ( Messages . GUI_EDIT_MODELPAGE_CONFIRM_CONTENT_0 ) ; } String buttonText = Messages . get ( ) . key ( Messages . GUI_EDIT_MODELPAGE_OK_0 ) ; CmsConfirmDialog dialog = new CmsConfirmDialog ( dialogTitle , dialogContent ) ; dialog . getOkButton ( ) . setText ( buttonText ) ; dialog . setHandler ( handler ) ; dialog . center ( ) ; } else { openEditor ( resourcePath ) ; } |
public class GlobalUsersInner { /** * Get personal preferences for a user .
* @ param userName The name of the user .
* @ param personalPreferencesOperationsPayload Represents payload for any Environment operations like get , start , stop , connect
* @ 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 < GetPersonalPreferencesResponseInner > getPersonalPreferencesAsync ( String userName , PersonalPreferencesOperationsPayload personalPreferencesOperationsPayload , final ServiceCallback < GetPersonalPreferencesResponseInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( getPersonalPreferencesWithServiceResponseAsync ( userName , personalPreferencesOperationsPayload ) , serviceCallback ) ; |
public class MyExceptionHandler { /** * 参数错误
* @ param paramErrors
* @ param errorCode
* @ return */
private ModelAndView paramError ( Map < String , String > paramErrors , ErrorCode errorCode ) { } } | JsonObjectBase jsonObject = JsonObjectUtils . buildFieldError ( paramErrors , errorCode ) ; LOG . warn ( jsonObject . toString ( ) ) ; return JsonObjectUtils . JsonObjectError2ModelView ( ( JsonObjectError ) jsonObject ) ; |
public class DbsUtilities { /** * Create a polygon using boundaries .
* @ param minX the min x .
* @ param minY the min y .
* @ param maxX the max x .
* @ param maxY the max y .
* @ return the created geomerty . */
public static Polygon createPolygonFromBounds ( double minX , double minY , double maxX , double maxY ) { } } | Coordinate [ ] c = new Coordinate [ ] { new Coordinate ( minX , minY ) , new Coordinate ( minX , maxY ) , new Coordinate ( maxX , maxY ) , new Coordinate ( maxX , minY ) , new Coordinate ( minX , minY ) } ; return gf ( ) . createPolygon ( c ) ; |
public class AbstractCRUDRestService { /** * { @ inheritDoc } */
@ Override public O doGetObject ( Integer id , final Wave wave ) { } } | LOGGER . trace ( "Get Planet." ) ; final O object = baseWebTarget ( ) . request ( MediaType . APPLICATION_XML ) . get ( genericSingle ) ; return object ; |
public class FileSystem { /** * Loads the factories for the file systems directly supported by Flink .
* Aside from the { @ link LocalFileSystem } , these file systems are loaded
* via Java ' s service framework .
* @ return A map from the file system scheme to corresponding file system factory . */
private static List < FileSystemFactory > loadFileSystemFactories ( Collection < Supplier < Iterator < FileSystemFactory > > > factoryIteratorsSuppliers ) { } } | final ArrayList < FileSystemFactory > list = new ArrayList < > ( ) ; // by default , we always have the local file system factory
list . add ( new LocalFileSystemFactory ( ) ) ; LOG . debug ( "Loading extension file systems via services" ) ; for ( Supplier < Iterator < FileSystemFactory > > factoryIteratorsSupplier : factoryIteratorsSuppliers ) { try { addAllFactoriesToList ( factoryIteratorsSupplier . get ( ) , list ) ; } catch ( Throwable t ) { // catching Throwable here to handle various forms of class loading
// and initialization errors
ExceptionUtils . rethrowIfFatalErrorOrOOM ( t ) ; LOG . error ( "Failed to load additional file systems via services" , t ) ; } } return Collections . unmodifiableList ( list ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Object } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link Object } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/citygml/waterbody/1.0" , name = "_GenericApplicationPropertyOfWaterClosureSurface" ) public JAXBElement < Object > create_GenericApplicationPropertyOfWaterClosureSurface ( Object value ) { } } | return new JAXBElement < Object > ( __GenericApplicationPropertyOfWaterClosureSurface_QNAME , Object . class , null , value ) ; |
public class ODMGSessionBean { /** * Lookup the OJB ODMG implementation .
* It ' s recommended to bind an instance of the Implementation class in JNDI
* ( at appServer start ) , open the database and lookup this instance via JNDI in
* ejbCreate ( ) . */
public void ejbCreate ( ) { } } | log . info ( "ejbCreate was called" ) ; odmg = ODMGHelper . getODMG ( ) ; db = odmg . getDatabase ( null ) ; |
public class GenericLogicDiscoverer { /** * Discover registered operations that consume some ( i . e . , at least one ) of the types of input provided . That is , all
* those that have as input the types provided .
* @ param inputTypes the types of input to be consumed
* @ return a Set containing all the matching operations . If there are no solutions , the Set should be empty , not null . */
@ Override public Map < URI , MatchResult > findOperationsConsumingSome ( Set < URI > inputTypes ) { } } | return findServicesClassifiedBySome ( inputTypes , LogicConceptMatchType . Plugin ) ; |
public class CmsAfterPublishStaticExportHandler { /** * Exports all non template resources found in a list of published resources . < p >
* @ param cms the current cms object
* @ param publishedResources the list of published resources
* @ param report an I _ CmsReport instance to print output message , or null to write messages to the log file
* @ return true if some template resources were found while looping the list of published resources
* @ throws CmsException in case of errors accessing the VFS
* @ throws IOException in case of errors writing to the export output stream
* @ throws ServletException in case of errors accessing the servlet */
protected boolean exportNonTemplateResources ( CmsObject cms , List < CmsPublishedResource > publishedResources , I_CmsReport report ) throws CmsException , IOException , ServletException { } } | report . println ( Messages . get ( ) . container ( Messages . RPT_STATICEXPORT_NONTEMPLATE_RESOURCES_BEGIN_0 ) , I_CmsReport . FORMAT_HEADLINE ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_EXPORTING_NON_TEMPLATE_1 , new Integer ( publishedResources . size ( ) ) ) ) ; } CmsStaticExportManager manager = OpenCms . getStaticExportManager ( ) ; List < CmsStaticExportData > resourcesToExport = new ArrayList < CmsStaticExportData > ( ) ; boolean templatesFound = readNonTemplateResourcesToExport ( cms , publishedResources , resourcesToExport ) ; int count = 1 ; int size = resourcesToExport . size ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_NUM_EXPORT_1 , new Integer ( size ) ) ) ; } // now do the export
Iterator < CmsStaticExportData > i = resourcesToExport . iterator ( ) ; while ( i . hasNext ( ) ) { CmsStaticExportData exportData = i . next ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_EXPORT_FILE_2 , exportData . getVfsName ( ) , exportData . getRfsName ( ) ) ) ; } report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_SUCCESSION_2 , new Integer ( count ++ ) , new Integer ( size ) ) , I_CmsReport . FORMAT_NOTE ) ; report . print ( Messages . get ( ) . container ( Messages . RPT_EXPORTING_0 ) , I_CmsReport . FORMAT_NOTE ) ; report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_ARGUMENT_1 , exportData . getVfsName ( ) ) ) ; report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_DOTS_0 ) ) ; int status = manager . export ( null , null , cms , exportData ) ; if ( status == HttpServletResponse . SC_OK ) { report . println ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_OK_0 ) , I_CmsReport . FORMAT_OK ) ; } else { report . println ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_IGNORED_0 ) , I_CmsReport . FORMAT_NOTE ) ; } if ( LOG . isInfoEnabled ( ) ) { Object [ ] arguments = new Object [ ] { exportData . getVfsName ( ) , exportData . getRfsName ( ) , new Integer ( status ) } ; LOG . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_EXPORT_FILE_STATUS_3 , arguments ) ) ; } // don ' t lock up the CPU exclusively - allow other Threads to run as well
Thread . yield ( ) ; } resourcesToExport = null ; report . println ( Messages . get ( ) . container ( Messages . RPT_STATICEXPORT_NONTEMPLATE_RESOURCES_END_0 ) , I_CmsReport . FORMAT_HEADLINE ) ; return templatesFound ; |
public class PropertyEditorBase { /** * Revert changes to the property value .
* @ return True if the operation was successful . */
public boolean revert ( ) { } } | try { setWrongValueMessage ( null ) ; setValue ( propInfo . getPropertyValue ( target ) ) ; updateValue ( ) ; return true ; } catch ( Exception e ) { setWrongValueException ( e ) ; return false ; } |
public class PassThruTable { /** * Add a listener to the chain .
* The listener must be cloned and added to all records on the list .
* @ param listener The listener to add . */
public void addListener ( Record record , FileListener listener ) { } } | if ( this . getNextTable ( ) != null ) this . getNextTable ( ) . addListener ( record , listener ) ; |
public class GBMModelV3 { /** * Version & Schema - specific filling into the impl */
@ Override public GBMModel createImpl ( ) { } } | GBMV3 . GBMParametersV3 p = this . parameters ; GBMModel . GBMParameters parms = p . createImpl ( ) ; return new GBMModel ( model_id . key ( ) , parms , new GBMModel . GBMOutput ( null ) ) ; |
public class DirectoryWatcher { /** * Walk the directories under given path , and register a watcher for every directory .
* @ param dir the starting point under which to listen for changes , if it doesn ' t exist , do nothing . */
public void watchDirectoryTree ( Path dir ) { } } | if ( _watchedDirectories == null ) { throw new IllegalStateException ( "DirectoryWatcher.close() was called. Please make a new instance." ) ; } try { if ( Files . exists ( dir ) ) { Files . walkFileTree ( dir , new SimpleFileVisitor < Path > ( ) { @ Override public FileVisitResult preVisitDirectory ( Path dir , BasicFileAttributes attrs ) throws IOException { watchDirectory ( dir ) ; return FileVisitResult . CONTINUE ; } } ) ; } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } |
public class DeleteRemoteAccessSessionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteRemoteAccessSessionRequest deleteRemoteAccessSessionRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteRemoteAccessSessionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteRemoteAccessSessionRequest . getArn ( ) , ARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ReflectUtils { /** * 将字符串转成代码 , 并执行
* < br > < a href = " https : / / blog . csdn . net / qq _ 26954773 / article / details / 80379015#3 - % E6 % B5%8B % E8 % AF % 95 " > 怎么使用 < / a >
* @ param jexlExpression 代码表达式
* @ param map 参数映射
* @ return 执行结果
* @ since 1.0.8 */
public static Object executeExpression ( String jexlExpression , Map < String , Object > map ) { } } | JexlExpression expression = jexlEngine . createExpression ( jexlExpression ) ; JexlContext context = new MapContext ( ) ; if ( Checker . isNotEmpty ( map ) ) { map . forEach ( context :: set ) ; } return expression . evaluate ( context ) ; |
public class PendingCall { /** * { @ inheritDoc } */
public void setResult ( Object result ) { } } | this . result = result ; if ( this . status == STATUS_PENDING || this . status == STATUS_SUCCESS_NULL || this . status == STATUS_SUCCESS_RESULT ) { setStatus ( result == null ? STATUS_SUCCESS_NULL : STATUS_SUCCESS_RESULT ) ; } |
public class SingleInputSemanticProperties { /** * Adds , to the existing information , a field that is forwarded directly
* from the source record ( s ) to the destination record ( s ) .
* @ param sourceField the position in the source record ( s )
* @ param targetField the position in the destination record ( s ) */
public void addForwardedField ( int sourceField , int targetField ) { } } | if ( isTargetFieldPresent ( targetField ) ) { throw new InvalidSemanticAnnotationException ( "Target field " + targetField + " was added twice." ) ; } FieldSet targetFields = fieldMapping . get ( sourceField ) ; if ( targetFields != null ) { fieldMapping . put ( sourceField , targetFields . addField ( targetField ) ) ; } else { fieldMapping . put ( sourceField , new FieldSet ( targetField ) ) ; } |
public class TransliteratorRegistry { /** * Register an ID and a resource name . This adds an entry to the
* dynamic store , or replaces an existing entry . Any entry in the
* underlying static locale resource store is masked . */
public void put ( String ID , String resourceName , int dir , boolean visible ) { } } | registerEntry ( ID , new ResourceEntry ( resourceName , dir ) , visible ) ; |
public class InternalXbaseWithAnnotationsParser { /** * InternalXbaseWithAnnotations . g : 220:1 : ruleXAnnotationElementValuePair returns [ EObject current = null ] : ( ( ( ( ( ( ruleValidID ) ) ' = ' ) ) = > ( ( ( ruleValidID ) ) otherlv _ 1 = ' = ' ) ) ( ( lv _ value _ 2_0 = ruleXAnnotationElementValue ) ) ) ; */
public final EObject ruleXAnnotationElementValuePair ( ) throws RecognitionException { } } | EObject current = null ; Token otherlv_1 = null ; EObject lv_value_2_0 = null ; enterRule ( ) ; try { // InternalXbaseWithAnnotations . g : 226:2 : ( ( ( ( ( ( ( ruleValidID ) ) ' = ' ) ) = > ( ( ( ruleValidID ) ) otherlv _ 1 = ' = ' ) ) ( ( lv _ value _ 2_0 = ruleXAnnotationElementValue ) ) ) )
// InternalXbaseWithAnnotations . g : 227:2 : ( ( ( ( ( ( ruleValidID ) ) ' = ' ) ) = > ( ( ( ruleValidID ) ) otherlv _ 1 = ' = ' ) ) ( ( lv _ value _ 2_0 = ruleXAnnotationElementValue ) ) )
{ // InternalXbaseWithAnnotations . g : 227:2 : ( ( ( ( ( ( ruleValidID ) ) ' = ' ) ) = > ( ( ( ruleValidID ) ) otherlv _ 1 = ' = ' ) ) ( ( lv _ value _ 2_0 = ruleXAnnotationElementValue ) ) )
// InternalXbaseWithAnnotations . g : 228:3 : ( ( ( ( ( ruleValidID ) ) ' = ' ) ) = > ( ( ( ruleValidID ) ) otherlv _ 1 = ' = ' ) ) ( ( lv _ value _ 2_0 = ruleXAnnotationElementValue ) )
{ // InternalXbaseWithAnnotations . g : 228:3 : ( ( ( ( ( ruleValidID ) ) ' = ' ) ) = > ( ( ( ruleValidID ) ) otherlv _ 1 = ' = ' ) )
// InternalXbaseWithAnnotations . g : 229:4 : ( ( ( ( ruleValidID ) ) ' = ' ) ) = > ( ( ( ruleValidID ) ) otherlv _ 1 = ' = ' )
{ // InternalXbaseWithAnnotations . g : 238:4 : ( ( ( ruleValidID ) ) otherlv _ 1 = ' = ' )
// InternalXbaseWithAnnotations . g : 239:5 : ( ( ruleValidID ) ) otherlv _ 1 = ' = '
{ // InternalXbaseWithAnnotations . g : 239:5 : ( ( ruleValidID ) )
// InternalXbaseWithAnnotations . g : 240:6 : ( ruleValidID )
{ // InternalXbaseWithAnnotations . g : 240:6 : ( ruleValidID )
// InternalXbaseWithAnnotations . g : 241:7 : ruleValidID
{ if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElement ( grammarAccess . getXAnnotationElementValuePairRule ( ) ) ; } } if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXAnnotationElementValuePairAccess ( ) . getElementJvmOperationCrossReference_0_0_0_0 ( ) ) ; } pushFollow ( FOLLOW_8 ) ; ruleValidID ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { afterParserOrEnumRuleCall ( ) ; } } } otherlv_1 = ( Token ) match ( input , 17 , FOLLOW_9 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { newLeafNode ( otherlv_1 , grammarAccess . getXAnnotationElementValuePairAccess ( ) . getEqualsSignKeyword_0_0_1 ( ) ) ; } } } // InternalXbaseWithAnnotations . g : 261:3 : ( ( lv _ value _ 2_0 = ruleXAnnotationElementValue ) )
// InternalXbaseWithAnnotations . g : 262:4 : ( lv _ value _ 2_0 = ruleXAnnotationElementValue )
{ // InternalXbaseWithAnnotations . g : 262:4 : ( lv _ value _ 2_0 = ruleXAnnotationElementValue )
// InternalXbaseWithAnnotations . g : 263:5 : lv _ value _ 2_0 = ruleXAnnotationElementValue
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXAnnotationElementValuePairAccess ( ) . getValueXAnnotationElementValueParserRuleCall_1_0 ( ) ) ; } pushFollow ( FOLLOW_2 ) ; lv_value_2_0 = ruleXAnnotationElementValue ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElementForParent ( grammarAccess . getXAnnotationElementValuePairRule ( ) ) ; } set ( current , "value" , lv_value_2_0 , "org.eclipse.xtext.xbase.annotations.XbaseWithAnnotations.XAnnotationElementValue" ) ; afterParserOrEnumRuleCall ( ) ; } } } } } if ( state . backtracking == 0 ) { leaveRule ( ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class JREDateTimeUtil { /** * internally we use a other instance to avoid conflicts */
private static Calendar _getThreadCalendar ( Locale l , TimeZone tz ) { } } | Calendar c = _localeCalendar . get ( tz , l ) ; if ( tz == null ) tz = ThreadLocalPageContext . getTimeZone ( ) ; c . setTimeZone ( tz ) ; return c ; |
public class QuantityClientParam { /** * Use the given quantity prefix
* @ param thePrefix The prefix , or < code > null < / code > for no prefix */
public IMatches < IAndUnits > withPrefix ( final ParamPrefixEnum thePrefix ) { } } | return new NumberClientParam . IMatches < IAndUnits > ( ) { @ Override public IAndUnits number ( long theNumber ) { return new AndUnits ( thePrefix , Long . toString ( theNumber ) ) ; } @ Override public IAndUnits number ( String theNumber ) { return new AndUnits ( thePrefix , theNumber ) ; } } ; |
public class SendRequest { /** * Simply wraps a pre - built incomplete transaction provided by you . */
public static SendRequest forTx ( Transaction tx ) { } } | SendRequest req = new SendRequest ( ) ; req . tx = tx ; return req ; |
public class XMLUpdateShredder { /** * Insert a text node .
* @ param paramText
* { @ link Characters } , which is going to be inserted .
* @ throws TTException
* In case any exception occurs while moving the cursor or
* deleting nodes in Treetank .
* @ throws XMLStreamException
* In case of any StAX parsing error . */
private void insertTextNode ( final Characters paramText ) throws TTException , XMLStreamException { } } | assert paramText != null ; /* * Add node if it ' s either not found among right siblings ( and the
* cursor on the shreddered file is on a right sibling ) or if it ' s not
* found in the structure and it is a new last right sibling . */
mDelete = EDelete . NODELETE ; mRemovedNode = false ; switch ( mInsert ) { case ATTOP : // Insert occurs at the top of a subtree ( no end tag has been parsed
// immediately before ) .
// Move to parent .
mWtx . moveTo ( mWtx . getNode ( ) . getParentKey ( ) ) ; // Insert as first child .
addNewText ( EAdd . ASFIRSTCHILD , paramText ) ; // Move to next node if no end tag follows ( thus cursor isn ' t moved
// to parent in processEndTag ( ) ) .
if ( mReader . peek ( ) . getEventType ( ) != XMLStreamConstants . END_ELEMENT ) { if ( mWtx . moveTo ( ( ( ITreeStructData ) mWtx . getNode ( ) ) . getRightSiblingKey ( ) ) ) { mMovedToRightSibling = true ; } else { mMovedToRightSibling = false ; } } else if ( ( ( ITreeStructData ) mWtx . getNode ( ) ) . hasRightSibling ( ) ) { mMovedToRightSibling = false ; mInserted = true ; mKeyMatches = - 1 ; mDelete = EDelete . ATBOTTOM ; deleteNode ( ) ; } mInsert = EInsert . INTERMEDIATE ; break ; case INTERMEDIATE : // Inserts have been made before .
EAdd addNode = EAdd . ASFIRSTCHILD ; if ( mInsertedEndTag ) { /* * An end tag has been read while inserting , so move back to
* left sibling if there is one and insert as right sibling . */
if ( mMovedToRightSibling ) { mWtx . moveTo ( ( ( ITreeStructData ) mWtx . getNode ( ) ) . getLeftSiblingKey ( ) ) ; } addNode = EAdd . ASRIGHTSIBLING ; mInsertedEndTag = false ; } // Insert element as right sibling .
addNewText ( addNode , paramText ) ; // Move to next node if no end tag follows ( thus cursor isn ' t moved
// to parent in processEndTag ( ) ) .
if ( mReader . peek ( ) . getEventType ( ) != XMLStreamConstants . END_ELEMENT ) { if ( mWtx . moveTo ( ( ( ITreeStructData ) mWtx . getNode ( ) ) . getRightSiblingKey ( ) ) ) { mMovedToRightSibling = true ; } else { mMovedToRightSibling = false ; } } break ; case ATMIDDLEBOTTOM : // Insert occurs in the middle or end of a subtree .
// Move one sibling back .
if ( mMovedToRightSibling ) { mWtx . moveTo ( ( ( ITreeStructData ) mWtx . getNode ( ) ) . getLeftSiblingKey ( ) ) ; } // Insert element as right sibling .
addNewText ( EAdd . ASRIGHTSIBLING , paramText ) ; // Move to next node .
mWtx . moveTo ( ( ( ITreeStructData ) mWtx . getNode ( ) ) . getRightSiblingKey ( ) ) ; mInsert = EInsert . INTERMEDIATE ; break ; default : throw new AssertionError ( "Enum value not known!" ) ; } mInserted = true ; |
public class PTable { /** * Free this table if it is no longer being used .
* @ param pTableOwner The table owner to remove . */
public synchronized int removePTableOwner ( ThinPhysicalTableOwner pTableOwner , boolean bFreeIfEmpty ) { } } | if ( pTableOwner != null ) { m_setPTableOwners . remove ( pTableOwner ) ; pTableOwner . setPTable ( null ) ; } if ( m_setPTableOwners . size ( ) == 0 ) if ( bFreeIfEmpty ) { this . free ( ) ; return 0 ; } m_lTimeLastUsed = System . currentTimeMillis ( ) ; return m_setPTableOwners . size ( ) ; |
public class MCWrapper { /** * Retrieves a new connection handle from the < code > ManagedConnection < / code > .
* Also keeps track of the PMI data relative to the number of handles in use .
* @ param subj Security Subject
* @ param cri ConnectionRequestInfo object .
* @ return Connection handle .
* @ exception ResourceException */
protected java . lang . Object getConnection ( Subject subj , ConnectionRequestInfo cri ) throws ResourceException { } } | final boolean isTracingEnabled = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTracingEnabled && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "getConnection" ) ; } Object connection = null ; // Get the a Connection from the ManagedConnection to return to our caller , and increment the
// number of open connections for this ManagedConnection .
try { connection = mc . getConnection ( subj , cri ) ; if ( isValidating . get ( ) != null && Boolean . FALSE . equals ( testConnection ( ) ) ) throw new ResourceAllocationException ( "ManagedConnection.testConnection() indicates connection is not valid." ) ; if ( _supportsReAuth ) { /* * If we have a userDataPending userData , we need
* to set the current userData to the userDataPending
* value . Right now we are doing this for every
* matchManagedConnection ( MMC ) , since we do not know which
* resource adapters support reauthentication . The MMC
* does not reauthenticate , the reauthentication is done
* on the mc . getConnection . This is the reason for doing
* the update after the the mc . getConnection is successful .
* If the mc . getConnection fails , we have a better chance
* to recover corrently with the current userData values
* in the PoolManager code . */
_subject = subj ; _cri = cri ; hashMapBucket = _hashMapBucketReAuth ; } incrementHandleCount ( ) ; // Need PMI Call here .
} catch ( SharingViolationException e ) { // If there is a sharing violation , it means that there is already at LEAST one connection
// handle out . Therefore we can ' t release the ManagedConnection yet . Just log and rethrow .
com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ejs.j2c.MCWrapper.getConnection" , "1677" , this ) ; String cfName = "No longer available" ; if ( cm != null ) { cfName = gConfigProps . cfName ; } Tr . error ( tc , "FAILED_CONNECTION_J2CA0021" , new Object [ ] { e , cfName } ) ; throw e ; } catch ( ResourceException e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ejs.j2c.MCWrapper.getConnection" , "873" , this ) ; String cfName = "No longer available" ; if ( cm != null ) { cfName = gConfigProps . cfName ; } Tr . error ( tc , "FAILED_CONNECTION_J2CA0021" , new Object [ ] { e , cfName } ) ; /* * If the Resource Adapter throws a ResourceException and we are not in a
* transaction and there are no other connections open on the ManagedConnection ,
* return the ManagedConnection to the pool before
* rethrowing the exception . The ManagedConnection is probably OK - the exception
* may only be a logon failure or similar so the MC shouldn ' t be ' lost ' .
* If we are in a transaction , just throw the exception . Assume we will cleanup during
* the aftercompletion call on the tran wrapper . */
/* * if ( ( uowCoord = = null ) & & ( mcConnectionCount = = 0 ) ) {
* try {
* pm . release ( this , uowCoord ) ;
* catch ( Exception exp ) { / / don ' t rethrow , already on exception path
* com . ibm . ws . ffdc . FFDCFilter . processException ( exp , " com . ibm . ejs . j2c . MCWrapper . getConnection " , " 893 " , this ) ;
* / / add pmiName to message
* Tr . error ( tc , " FAILED _ CONNECTION _ RELEASE _ J2CA0022 " , new Object [ ] { exp , pmiName } ) ;
* } end / */
throw e ; } catch ( Exception e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ejs.j2c.MCWrapper.getConnection" , "901" , this ) ; String cfName = "No longer available" ; if ( cm != null ) { cfName = gConfigProps . cfName ; } Tr . error ( tc , "FAILED_CONNECTION_J2CA0021" , new Object [ ] { e , cfName } ) ; /* * If the Resource Adapter throws an Exception and we are not in a
* transaction and there are no other connections open on the ManagedConnection ,
* return the ManagedConnection to the pool before
* rethrowing the exception . The ManagedConnection is probably OK - the exception
* may only be a logon failure or similar so the MC shouldn ' t be ' lost ' .
* If we are in a transaction , just throw the exception . Assume we will cleanup during
* the aftercompletion call on the tran wrapper . */
/* * if ( ( uowCoord = = null ) & & ( mcConnectionCount = = 0 ) ) {
* try {
* pm . release ( this , uowCoord ) ;
* catch ( Exception exp ) { / / don ' t rethrow , already on exception path
* com . ibm . ws . ffdc . FFDCFilter . processException ( exp , " com . ibm . ejs . j2c . MCWrapper . getConnection " , " 921 " , this ) ;
* / / add pmiName to message
* Tr . error ( tc , " FAILED _ CONNECTION _ RELEASE _ J2CA0022 " , new Object [ ] { exp , pmiName } ) ; */
// See if per chance the component - managed auth alias used on the first lookup has become invalid :
String remsg = "" ; String xpathId = gConfigProps . getXpathId ( ) ; if ( xpathId != null ) { final Object originalAlias = J2CUtilityClass . pmiNameToCompAlias . get ( xpathId ) ; if ( ( originalAlias != null ) && ( ! originalAlias . equals ( "" ) ) ) { remsg = "Component-managed authentication alias " + originalAlias + " for connection factory or datasource " + cfName + " is invalid. It may be necessary to re-start the server(s) for " + " previous configuration changes to take effect." ; } // end originalAlias not null or blank
} // end pmiName ! = null
ResourceException re = new ResourceException ( remsg ) ; re . initCause ( e ) ; throw re ; } // end catch Exception e
if ( isTracingEnabled && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "getConnection" , connection ) ; } return connection ; |
public class RuntimeUtil { /** * 执行系统命令 , 使用系统默认编码
* @ param charset 编码
* @ param cmds 命令列表 , 每个元素代表一条命令
* @ return 执行结果
* @ throws IORuntimeException IO异常
* @ since 3.1.2 */
public static String execForStr ( Charset charset , String ... cmds ) throws IORuntimeException { } } | return getResult ( exec ( cmds ) , charset ) ; |
public class ResourceProcessor { /** * Check attributes for registered ObjectFactory ' s .
* @ param resourceBinding
* @ param extensionFactory
* @ throws InjectionConfigurationException */
private void checkObjectFactoryAttributes ( ResourceInjectionBinding resourceBinding , ObjectFactoryInfo extensionFactory ) // d675976
throws InjectionConfigurationException { } } | Resource resourceAnnotation = resourceBinding . getAnnotation ( ) ; if ( ! extensionFactory . isAttributeAllowed ( "authenticationType" ) ) { checkObjectFactoryAttribute ( resourceBinding , "authenticationType" , resourceAnnotation . authenticationType ( ) , AuthenticationType . CONTAINER ) ; } if ( ! extensionFactory . isAttributeAllowed ( "shareable" ) ) { checkObjectFactoryAttribute ( resourceBinding , "shareable" , resourceAnnotation . shareable ( ) , true ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.