signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ContentKey { /** * Rebind content key with specified content key and X509 Certificate .
* @ param contentKeyId
* the content key id
* @ param x509Certificate
* the x509 certificate
* @ return the entity action operation */
public static EntityTypeActionOperation < String > rebind ( String contentKeyId , String x509Certificate ) { } } | return new RebindContentKeyActionOperation ( contentKeyId , x509Certificate ) ; |
public class HiveJsonSerDeMarshaller { /** * Marshall the given parameter object . */
public void marshall ( HiveJsonSerDe hiveJsonSerDe , ProtocolMarshaller protocolMarshaller ) { } } | if ( hiveJsonSerDe == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( hiveJsonSerDe . getTimestampFormats ( ) , TIMESTAMPFORMATS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MinioClient { /** * Executes DELETE method for given request parameters .
* @ param bucketName Bucket name .
* @ param objectName Object name in the bucket .
* @ param queryParamMap Map of HTTP query parameters of the request . */
private HttpResponse executeDelete ( String bucketName , String objectName , Map < String , String > queryParamMap ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { } } | HttpResponse response = execute ( Method . DELETE , getRegion ( bucketName ) , bucketName , objectName , null , queryParamMap , null , 0 ) ; response . body ( ) . close ( ) ; return response ; |
public class SearchParams { /** * Shorthand for creationGte ( start ) . creationLte ( end ) . */
public SearchParams between ( final Date start , final Date end ) { } } | return this . creationGte ( start ) . creationLte ( end ) ; |
public class SimonConsolePluginManager { /** * Register a plugin
* @ param pluginTypeName Plugin type */
public void addPlugin ( String pluginTypeName ) { } } | try { Class < ? > pluginType = Class . forName ( pluginTypeName ) ; if ( SimonConsolePlugin . class . isAssignableFrom ( pluginType ) ) { addPlugin ( ( Class < ? extends SimonConsolePlugin > ) pluginType ) ; } else { throw new IllegalArgumentException ( "Invalid plugin type " + pluginTypeName ) ; } } catch ( ClassNotFoundException classNotFoundException ) { throw new IllegalArgumentException ( "Invalid plugin type " + pluginTypeName , classNotFoundException ) ; } |
public class AnnotationValue { /** * Subclasses can override to provide a custom convertible values instance .
* @ param values The values
* @ return The instance */
private ConvertibleValues < Object > newConvertibleValues ( Map < CharSequence , Object > values ) { } } | if ( CollectionUtils . isEmpty ( values ) ) { return ConvertibleValues . EMPTY ; } else { return ConvertibleValues . of ( values ) ; } |
public class Database { /** * Removes a document from the database .
* < p > The object must have the correct { @ code _ id } and { @ code _ rev } values . < / p >
* < P > Example usage : < / P >
* < pre >
* { @ code
* / / get a Bar object from the database
* Bar bar = db . find ( Bar . class , " exampleId " ) ;
* / / now remove the remote Bar
* Response response = db . remove ( bar ) ;
* < / pre >
* @ param object the document to remove as an object
* @ return { @ link com . cloudant . client . api . model . Response }
* @ throws NoDocumentException If the document is not found in the database .
* @ see < a
* href = " https : / / console . bluemix . net / docs / services / Cloudant / api / document . html # delete "
* target = " _ blank " > Documents - delete < / a > */
public com . cloudant . client . api . model . Response remove ( Object object ) { } } | Response couchDbResponse = db . remove ( object ) ; com . cloudant . client . api . model . Response response = new com . cloudant . client . api . model . Response ( couchDbResponse ) ; return response ; |
public class Kmeans { /** * { @ inheritDoc } */
@ Override protected void _fit ( Dataframe trainingData ) { } } | ModelParameters modelParameters = knowledgeBase . getModelParameters ( ) ; Set < Object > goldStandardClasses = modelParameters . getGoldStandardClasses ( ) ; // check if there are any gold standard classes
for ( Record r : trainingData ) { Object theClass = r . getY ( ) ; if ( theClass != null ) { goldStandardClasses . add ( theClass ) ; } } // calculate the weights of the features
calculateFeatureWeights ( trainingData ) ; // initialize clusters
initializeClusters ( trainingData ) ; // calculate clusters
calculateClusters ( trainingData ) ; clearClusters ( ) ; |
public class Dtd { /** * Creates DTD schema file containing all possible tags and their attributes . Any problems with the generation will
* be logged . This is a relatively heavy operation and should be done only during development .
* @ param parser contains parsing data . Used to create mock - up actors . The skin MUST be fully loaded and contain all
* used actors ' styles for the generator to work properly .
* @ param builder values will be appended to this object .
* @ throws IOException when unable to append . */
public void getDtdSchema ( final LmlParser parser , final Appendable builder ) throws IOException { } } | appendActorTags ( builder , parser ) ; appendActorAttributes ( parser , builder ) ; appendMacroTags ( builder , parser ) ; appendMacroAttributes ( parser , builder ) ; |
public class DefaultDataGridConfig { /** * Create a { @ link DataGridStateCodec } for a grid with the given name for the given { @ link ServletRequest } .
* @ param request the current request
* @ param gridName a data grid ' s name
* @ return the state encoder / decoder for a data grid ' s request state */
public DataGridStateCodec createStateCodec ( ServletRequest request , String gridName ) { } } | DefaultDataGridStateCodec codec = new DefaultDataGridStateCodec ( this ) ; codec . setServletRequest ( request ) ; codec . setGridName ( gridName ) ; return codec ; |
public class IntegerBinding { /** * Serializes unsigned { @ code int } value to the compressed { @ linkplain ArrayByteIterable } entry .
* @ param object non - negative value to serialize
* @ return { @ linkplain ArrayByteIterable } entry
* @ see # entryToInt ( ByteIterable )
* @ see # intToEntry ( int )
* @ see # compressedEntryToInt ( ByteIterable )
* @ see # compressedEntryToSignedInt ( ByteIterable )
* @ see # signedIntToCompressedEntry ( int ) */
public static ArrayByteIterable intToCompressedEntry ( final int object ) { } } | if ( object < 0 ) { throw new IllegalArgumentException ( ) ; } final LightOutputStream output = new LightOutputStream ( 5 ) ; writeCompressed ( output , object ) ; return output . asArrayByteIterable ( ) ; |
public class GetCommentsForComparedCommitResult { /** * A list of comment objects on the compared commit .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setCommentsForComparedCommitData ( java . util . Collection ) } or
* { @ link # withCommentsForComparedCommitData ( java . util . Collection ) } if you want to override the existing values .
* @ param commentsForComparedCommitData
* A list of comment objects on the compared commit .
* @ return Returns a reference to this object so that method calls can be chained together . */
public GetCommentsForComparedCommitResult withCommentsForComparedCommitData ( CommentsForComparedCommit ... commentsForComparedCommitData ) { } } | if ( this . commentsForComparedCommitData == null ) { setCommentsForComparedCommitData ( new java . util . ArrayList < CommentsForComparedCommit > ( commentsForComparedCommitData . length ) ) ; } for ( CommentsForComparedCommit ele : commentsForComparedCommitData ) { this . commentsForComparedCommitData . add ( ele ) ; } return this ; |
public class BasicHttpClient { /** * This is the usual http request builder most widely used using Apache Http Client . In case you want to build
* or prepare the requests differently , you can override this method .
* Please see the following request builder to handle file uploads .
* - BasicHttpClient # createFileUploadRequestBuilder ( java . lang . String , java . lang . String , java . lang . String )
* You can override this method via @ UseHttpClient ( YourCustomHttpClient . class )
* @ param httpUrl
* @ param methodName
* @ param reqBodyAsString
* @ return */
public RequestBuilder createDefaultRequestBuilder ( String httpUrl , String methodName , String reqBodyAsString ) { } } | RequestBuilder requestBuilder = RequestBuilder . create ( methodName ) . setUri ( httpUrl ) ; if ( reqBodyAsString != null ) { HttpEntity httpEntity = EntityBuilder . create ( ) . setContentType ( APPLICATION_JSON ) . setText ( reqBodyAsString ) . build ( ) ; requestBuilder . setEntity ( httpEntity ) ; } return requestBuilder ; |
public class EJBLinkResolver { /** * Encapsulates the common code and exception handling for obtaining
* a remote home reference ( Stub ) for the specified home interface ,
* for lookup or injection . < p >
* @ param home the internal home object of the referenced ejb .
* @ param interfaceName the remote home interface to be injected . */
private Object getRemoteHomeReference ( EJSHome home , String interfaceName ) throws EJBException , NoSuchObjectException { } } | Object retObj = null ; try { checkHomeSupported ( home , interfaceName ) ; EJBRuntime runtime = home . getContainer ( ) . getEJBRuntime ( ) ; runtime . checkRemoteSupported ( home , interfaceName ) ; EJSWrapper wrapper = home . getWrapper ( ) . getRemoteWrapper ( ) ; retObj = runtime . getRemoteReference ( wrapper ) ; } catch ( Throwable ex ) { // ClassNotFoundException , CreateException , and NoSuchObjectException
// must be caught here . . . but basically all failures that may occur
// while creating the bean instance must cause the injection to fail .
FFDCFilter . processException ( ex , CLASS_NAME + ".getRemoteHomeReference" , "281" , this ) ; EJBException ejbex = ExceptionUtil . EJBException ( "Failure obtaining remote home reference of " + home . getJ2EEName ( ) + " of type " + interfaceName , ex ) ; // TODO : Tr . error
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getRemoteHomeReference: " + ejbex ) ; throw ejbex ; } // This should never occur , but does cover the following 2 possibilites :
// 1 ) one of the above factory calls returns null ( unlikely )
// 2 ) an attempt is being made to inject an MDB or 2.1 Entity ( not supported )
if ( retObj == null ) { EJBException ejbex = new EJBException ( "Unable to obtain remote reference of " + home . getJ2EEName ( ) + " of type " + interfaceName ) ; // TODO : Tr . error
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getRemoteHomeReference: " + ejbex ) ; throw ejbex ; } return retObj ; |
public class vpnclientlessaccesspolicy { /** * Use this API to update vpnclientlessaccesspolicy . */
public static base_response update ( nitro_service client , vpnclientlessaccesspolicy resource ) throws Exception { } } | vpnclientlessaccesspolicy updateresource = new vpnclientlessaccesspolicy ( ) ; updateresource . name = resource . name ; updateresource . rule = resource . rule ; updateresource . profilename = resource . profilename ; return updateresource . update_resource ( client ) ; |
public class ProviderDescriptionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ProviderDescription providerDescription , ProtocolMarshaller protocolMarshaller ) { } } | if ( providerDescription == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( providerDescription . getProviderName ( ) , PROVIDERNAME_BINDING ) ; protocolMarshaller . marshall ( providerDescription . getProviderType ( ) , PROVIDERTYPE_BINDING ) ; protocolMarshaller . marshall ( providerDescription . getLastModifiedDate ( ) , LASTMODIFIEDDATE_BINDING ) ; protocolMarshaller . marshall ( providerDescription . getCreationDate ( ) , CREATIONDATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SolrManager { /** * Remove a core .
* @ param coreName Core name
* @ throws SolrException SolrException */
public void removeCore ( String coreName ) throws SolrException { } } | try { CoreAdminRequest . unloadCore ( coreName , true , true , solrClient ) ; } catch ( SolrServerException | IOException e ) { throw new SolrException ( SolrException . ErrorCode . SERVER_ERROR , e . getMessage ( ) , e ) ; } |
public class SeleniumHelper { /** * Simulates ' select all ' ( e . g . Ctrl + A on Windows ) on the active element .
* @ return whether an active element was found . */
public boolean selectAll ( ) { } } | boolean result = false ; WebElement element = getActiveElement ( ) ; if ( element != null ) { if ( connectedToMac ( ) ) { executeJavascript ( "arguments[0].select()" , element ) ; } else { element . sendKeys ( Keys . CONTROL , "a" ) ; } result = true ; } return result ; |
public class MapboxNavigation { /** * Critical to place inside your navigation activity so that when your application gets destroyed
* the navigation service unbinds and gets destroyed , preventing any memory leaks . Calling this
* also removes all listeners that have been attached . */
public void onDestroy ( ) { } } | stopNavigation ( ) ; removeOffRouteListener ( null ) ; removeProgressChangeListener ( null ) ; removeMilestoneEventListener ( null ) ; removeNavigationEventListener ( null ) ; removeFasterRouteListener ( null ) ; removeRawLocationListener ( null ) ; |
public class KryoSerializer { /** * Deserializes { @ code byte [ ] } to SynchronizeFX { @ link Command } s .
* This method is thread save .
* @ param commands The serialized form of SynchronizeFX { @ link Command } s that was created by
* { @ link KryoSerializer # serialize ( List ) } .
* @ return The original { @ link Command } s . */
@ Override @ SuppressWarnings ( "unchecked" ) public List < Command > deserialize ( final byte [ ] commands ) { } } | return kryo . get ( ) . readObject ( new Input ( commands ) , LinkedList . class ) ; |
public class BDAImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setYoffset ( Integer newYoffset ) { } } | Integer oldYoffset = yoffset ; yoffset = newYoffset ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . BDA__YOFFSET , oldYoffset , yoffset ) ) ; |
public class AgentSession { /** * Allows the removal of data from the agent ' s meta data , if the key represents existing data ,
* the revised meta data will be rebroadcast in an agent ' s presence broadcast .
* @ param key the meta data key .
* @ throws XMPPException if an exception occurs .
* @ throws SmackException
* @ throws InterruptedException */
public void removeMetaData ( String key ) throws XMPPException , SmackException , InterruptedException { } } | synchronized ( this . metaData ) { List < String > oldVal = metaData . remove ( key ) ; if ( oldVal != null ) { setStatus ( presenceMode , maxChats ) ; } } |
public class SheetDiscussionResourcesImpl { /** * Create a discussion with attachments on a sheet .
* It mirrors to the following Smartsheet REST API method : POST / sheets / { sheetId } / discussions
* @ param sheetId the sheet id
* @ param discussion the discussion object
* @ param file the file to attach
* @ param contentType the type of file
* @ return the created discussion
* @ throws IllegalArgumentException if any argument is null or empty string
* @ throws InvalidRequestException if there is any problem with the REST API request
* @ throws AuthorizationException if there is any problem with the REST API authorization ( access token )
* @ throws ResourceNotFoundException if the resource cannot be found
* @ throws ServiceUnavailableException if the REST API service is not available ( possibly due to rate limiting )
* @ throws SmartsheetException if there is any other error during the operation
* @ throws IOException is there is with file */
public Discussion createDiscussionWithAttachment ( long sheetId , Discussion discussion , File file , String contentType ) throws SmartsheetException , IOException { } } | Util . throwIfNull ( discussion , file , contentType ) ; String path = "sheets/" + sheetId + "/discussions" ; return this . createDiscussionWithAttachment ( path , discussion , new FileInputStream ( file ) , contentType , file . getName ( ) ) ; |
public class DEBBuilder { /** * Add debian / control Depends field .
* @ param name
* @ param version
* @ param dependency
* @ return */
@ Override public DEBBuilder addRequire ( String name , String version , Condition ... dependency ) { } } | control . addDepends ( release , version , dependency ) ; return this ; |
public class Hyperion { /** * Set the sensitivity threshold of shake detection in G ' s . Default is 3
* @ param sensitivity Sensitivity of shake detection in G ' s . Lower is easier to activate . */
public static void setShakeGestureSensitivity ( float sensitivity ) { } } | requireApplication ( ) ; AppComponent . Holder . getInstance ( application ) . getPublicControl ( ) . setShakeGestureSensitivity ( sensitivity ) ; |
public class MicroProfileJwtConfigImpl { /** * { @ inheritDoc } */
@ Override @ FFDCIgnore ( MpJwtProcessingException . class ) public String getTrustStoreRef ( ) { } } | if ( this . sslRefInfo == null ) { MicroProfileJwtService service = mpJwtServiceRef . getService ( ) ; if ( service == null ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "MP JWT service is not available" ) ; } return null ; } sslRefInfo = new SslRefInfoImpl ( service . getSslSupport ( ) , service . getKeyStoreServiceRef ( ) , sslRef , trustAliasName ) ; } try { return sslRefInfo . getTrustStoreName ( ) ; } catch ( MpJwtProcessingException e ) { // We already logged the error
} return null ; |
public class EXXAdapters { /** * Adapts a to a OrderBook Object
* @ param currencyPair ( e . g . BTC / USD )
* @ param timeScale polled order books provide a timestamp in seconds , stream in ms
* @ return The XChange OrderBook */
public static OrderBook adaptOrderBook ( EXXOrderbook exxOrderbook , CurrencyPair currencyPair ) { } } | List < LimitOrder > asks = new ArrayList < LimitOrder > ( ) ; List < LimitOrder > bids = new ArrayList < LimitOrder > ( ) ; for ( BigDecimal [ ] exxAsk : exxOrderbook . getAsks ( ) ) { asks . add ( new LimitOrder ( OrderType . ASK , exxAsk [ 1 ] , currencyPair , null , null , exxAsk [ 0 ] ) ) ; } for ( BigDecimal [ ] exxBid : exxOrderbook . getBids ( ) ) { bids . add ( new LimitOrder ( OrderType . BID , exxBid [ 1 ] , currencyPair , null , null , exxBid [ 0 ] ) ) ; } return new OrderBook ( new Date ( ) , asks , bids ) ; |
public class ASTPrinter { /** * Prints a single comment pretty much unmolested */
public static String print ( final String indent , JavaComment comment ) { } } | return comment . match ( new JavaComment . MatchBlock < String > ( ) { @ Override public String _case ( JavaDocComment x ) { final StringBuilder builder = new StringBuilder ( indent ) ; builder . append ( x . start ) ; for ( JDToken token : x . generalSection ) { builder . append ( print ( indent , token ) ) ; } for ( JDTagSection tagSection : x . tagSections ) { for ( JDToken token : tagSection . tokens ) { builder . append ( print ( indent , token ) ) ; } } builder . append ( x . end ) ; return builder . toString ( ) ; } @ Override public String _case ( JavaBlockComment comment ) { final StringBuilder builder = new StringBuilder ( indent ) ; for ( List < BlockToken > line : comment . lines ) { for ( BlockToken token : line ) { builder . append ( token . match ( new BlockToken . MatchBlock < String > ( ) { @ Override public String _case ( BlockWord x ) { return x . word ; } @ Override public String _case ( BlockWhiteSpace x ) { return x . ws ; } @ Override public String _case ( BlockEOL x ) { return x . content + indent ; } } ) ) ; } } return builder . toString ( ) ; } @ Override public String _case ( JavaEOLComment x ) { return x . comment ; } } ) ; |
public class RqMtBase { /** * Make a request .
* Scans the origin request until the boundary reached . Caches
* the content into a temporary file and returns it as a new request .
* @ param boundary Boundary
* @ param body Origin request body
* @ return Request
* @ throws IOException If fails */
private Request make ( final byte [ ] boundary , final ReadableByteChannel body ) throws IOException { } } | final File file = File . createTempFile ( RqMultipart . class . getName ( ) , ".tmp" ) ; try ( WritableByteChannel channel = Files . newByteChannel ( file . toPath ( ) , StandardOpenOption . READ , StandardOpenOption . WRITE ) ) { channel . write ( ByteBuffer . wrap ( this . head ( ) . iterator ( ) . next ( ) . getBytes ( RqMtBase . ENCODING ) ) ) ; channel . write ( ByteBuffer . wrap ( RqMtBase . CRLF . getBytes ( RqMtBase . ENCODING ) ) ) ; this . copy ( channel , boundary , body ) ; } return new RqTemp ( file ) ; |
public class AmazonIdentityManagementAsyncClient { /** * Simplified method form for invoking the GetAccountSummary operation with an AsyncHandler .
* @ see # getAccountSummaryAsync ( GetAccountSummaryRequest , com . amazonaws . handlers . AsyncHandler ) */
@ Override public java . util . concurrent . Future < GetAccountSummaryResult > getAccountSummaryAsync ( com . amazonaws . handlers . AsyncHandler < GetAccountSummaryRequest , GetAccountSummaryResult > asyncHandler ) { } } | return getAccountSummaryAsync ( new GetAccountSummaryRequest ( ) , asyncHandler ) ; |
public class AbstractGeneratorMojo { /** * Updates the StatusFile ( defined via { @ link # statusFile } ) . This file
* indicates the last successful execution of the code generator and is used
* to check the state of the source files .
* @ param createdFiles
* list of files created by the code generator */
protected boolean updateStatusFile ( List < File > createdFiles ) { } } | boolean success ; final Properties statusProperties = new Properties ( ) ; try { for ( File createdFile : createdFiles ) { try { statusProperties . setProperty ( getProjectRelativePath ( createdFile ) , calculateChecksum ( createdFile ) ) ; } catch ( IOException e ) { getLog ( ) . warn ( "Checksum calculation failed: " + e . getMessage ( ) ) ; } } final FileWriter statusWriter = new FileWriter ( statusFile ) ; try { statusProperties . store ( statusWriter , "Sculptor created the following " + createdFiles . size ( ) + " files" ) ; success = true ; } finally { statusWriter . close ( ) ; } } catch ( IOException e ) { getLog ( ) . warn ( "Updating status file failed: " + e . getMessage ( ) ) ; success = false ; } return success ; |
public class FileExecutor { /** * 批量重命名文件
* @ param folder 文件夹
* @ param prefix 文件前缀
* @ param suffix 文件后缀
* @ param start 开始位置 */
public static void renameFiles ( String folder , String prefix , String suffix , int start ) { } } | renameFiles ( scanFolderAsArray ( folder ) , prefix , suffix , start ) ; |
public class EmbeddedChannel { /** * Register this { @ code Channel } on its { @ link EventLoop } . */
public void register ( ) throws Exception { } } | ChannelFuture future = loop . register ( this ) ; assert future . isDone ( ) ; Throwable cause = future . cause ( ) ; if ( cause != null ) { PlatformDependent . throwException ( cause ) ; } |
public class CmsSolrQuery { /** * Sets the textSearchFields . < p >
* @ param textSearchFields the textSearchFields to set */
public void setTextSearchFields ( List < String > textSearchFields ) { } } | m_textSearchFields = textSearchFields ; if ( m_text != null ) { setText ( m_text ) ; } |
public class IntrospectionUtils { /** * Creates and returns a new instance of a persistence class for the given metadata . The returned
* object will be an instance of the primary persistence class or its Builder .
* @ param metadata
* the metadata of the class
* @ return a new instance of the of the Class to which the given metadata belongs .
* @ throws EntityManagerException
* if any error occurs during instantiation . */
public static Object instantiate ( MetadataBase metadata ) { } } | try { return metadata . getConstructorMetadata ( ) . getConstructorMethodHandle ( ) . invoke ( ) ; } catch ( Throwable t ) { throw new EntityManagerException ( t ) ; } |
public class HelpFormatter { /** * Print the help for < code > options < / code > with the specified command line
* syntax . This method prints help information to System . out .
* @ param sCmdLineSyntax
* the syntax for this application
* @ param sHeader
* the banner to display at the beginning of the help
* @ param aOptions
* the Options instance
* @ param sFooter
* the banner to display at the end of the help
* @ param bAutoUsage
* whether to print an automatically generated usage statement */
public void printHelp ( @ Nonnull @ Nonempty final String sCmdLineSyntax , @ Nullable final String sHeader , @ Nonnull final Options aOptions , @ Nullable final String sFooter , final boolean bAutoUsage ) { } } | printHelp ( getWidth ( ) , sCmdLineSyntax , sHeader , aOptions , sFooter , bAutoUsage ) ; |
public class AbstractType { /** * An alternative comparison function used by CollectionsType in conjunction with CompositeType .
* This comparator is only called to compare components of a CompositeType . It gets the value of the
* previous component as argument ( or null if it ' s the first component of the composite ) .
* Unless you ' re doing something very similar to CollectionsType , you shouldn ' t override this . */
public int compareCollectionMembers ( ByteBuffer v1 , ByteBuffer v2 , ByteBuffer collectionName ) { } } | return compare ( v1 , v2 ) ; |
public class ScatterChartPanel { /** * Returns the Y - coordinate for a given value of the second dimension ( Y ) ,
* considering the actual operation - mode { @ link # zeroBased } . < br >
* This implementation simply returns a value that reflects the position of the given value with respect to the coordinate axis Y .
* @ param value Value of the maintained Y - dimension
* @ return Y - coordinate for the given value */
protected Integer getYFor ( Number value ) { } } | double offset = zeroBased ? 0.0 : getTickInfo ( ValueDimension . Y ) . getFirstTick ( ) ; return getPaintingRegion ( ) . getBottomLeft ( ) . y - ( int ) Math . round ( ( value . doubleValue ( ) - offset ) * getPaintingRegion ( ) . getUnit ( ValueDimension . Y ) ) ; |
public class AWSCodePipelineClient { /** * Provides the response to a manual approval request to AWS CodePipeline . Valid responses include Approved and
* Rejected .
* @ param putApprovalResultRequest
* Represents the input of a PutApprovalResult action .
* @ return Result of the PutApprovalResult operation returned by the service .
* @ throws InvalidApprovalTokenException
* The approval request already received a response or has expired .
* @ throws ApprovalAlreadyCompletedException
* The approval action has already been approved or rejected .
* @ throws PipelineNotFoundException
* The specified pipeline was specified in an invalid format or cannot be found .
* @ throws StageNotFoundException
* The specified stage was specified in an invalid format or cannot be found .
* @ throws ActionNotFoundException
* The specified action cannot be found .
* @ throws ValidationException
* The validation was specified in an invalid format .
* @ sample AWSCodePipeline . PutApprovalResult
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / codepipeline - 2015-07-09 / PutApprovalResult " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public PutApprovalResultResult putApprovalResult ( PutApprovalResultRequest request ) { } } | request = beforeClientExecution ( request ) ; return executePutApprovalResult ( request ) ; |
public class StoreDefinitionUtils { /** * If provided with an AVRO schema , validates it and checks if there are
* backwards compatible .
* TODO should probably place some similar checks for other serializer types
* as well ?
* @ param serializerDef */
private static void validateIfAvroSchema ( SerializerDefinition serializerDef ) { } } | if ( serializerDef . getName ( ) . equals ( AVRO_GENERIC_VERSIONED_TYPE_NAME ) || serializerDef . getName ( ) . equals ( AVRO_GENERIC_TYPE_NAME ) ) { SchemaEvolutionValidator . validateAllAvroSchemas ( serializerDef ) ; // check backwards compatibility if needed
if ( serializerDef . getName ( ) . equals ( AVRO_GENERIC_VERSIONED_TYPE_NAME ) ) { SchemaEvolutionValidator . checkSchemaCompatibility ( serializerDef ) ; } } |
public class StringDuplicationDetector { /** * Checks if a string ' s beginning and end are equal .
* @ param input The input string
* @ param beginTo The beginning string ends at this point .
* @ param endFrom The ending string starts from this point .
* @ return
* True if the two parts are equals , otherwise false . */
private static boolean hasEqualParts ( final String input , final int beginTo , final int endFrom ) { } } | String begin = input . substring ( 0 , beginTo ) ; String end = input . substring ( endFrom ) ; return begin . equals ( end ) ; |
public class ReadOnlyStyledDocumentBuilder { /** * Adds to the list a paragraph that has only one segment that has the same given style throughout . */
public ReadOnlyStyledDocumentBuilder < PS , SEG , S > addParagraph ( SEG segment , S style ) { } } | return addParagraph ( segment , style , null ) ; |
public class AnnotationExtensions { /** * Search for the given annotationClass in the given componentClass and return it if search was
* successful .
* @ param < T >
* the generic type
* @ param componentClass
* the component class
* @ param annotationClass
* the annotation class
* @ return the annotation */
public static < T extends Annotation > T getAnnotation ( final Class < ? > componentClass , final Class < T > annotationClass ) { } } | T annotation = componentClass . getAnnotation ( annotationClass ) ; if ( annotation != null ) { return annotation ; } for ( final Class < ? > ifc : componentClass . getInterfaces ( ) ) { annotation = getAnnotation ( ifc , annotationClass ) ; if ( annotation != null ) { return annotation ; } } if ( ! Annotation . class . isAssignableFrom ( componentClass ) ) { for ( final Annotation ann : componentClass . getAnnotations ( ) ) { annotation = getAnnotation ( ann . annotationType ( ) , annotationClass ) ; if ( annotation != null ) { return annotation ; } } } final Class < ? > superClass = componentClass . getSuperclass ( ) ; if ( superClass == null || superClass . equals ( Object . class ) ) { return null ; } return getAnnotation ( superClass , annotationClass ) ; |
public class ApplicationMetadata { /** * Returns true , if query is named native or native , else false
* @ param name
* mapped name .
* @ return boolean value */
public boolean isNative ( String name ) { } } | QueryWrapper wrapper = namedNativeQueries != null && name != null ? namedNativeQueries . get ( name ) : null ; return wrapper != null ? wrapper . isNativeQuery ( ) : false ; |
public class AwsSecurityFindingFilters { /** * The canonical user ID of the owner of the S3 bucket .
* @ param resourceAwsS3BucketOwnerId
* The canonical user ID of the owner of the S3 bucket . */
public void setResourceAwsS3BucketOwnerId ( java . util . Collection < StringFilter > resourceAwsS3BucketOwnerId ) { } } | if ( resourceAwsS3BucketOwnerId == null ) { this . resourceAwsS3BucketOwnerId = null ; return ; } this . resourceAwsS3BucketOwnerId = new java . util . ArrayList < StringFilter > ( resourceAwsS3BucketOwnerId ) ; |
public class HijrahDate { /** * Returns month days from the beginning of year .
* @ param month month ( 0 - based )
* @ parma year year
* @ return month days from the beginning of year */
private static int getMonthDays ( int month , int year ) { } } | Integer [ ] newMonths = getAdjustedMonthDays ( year ) ; return newMonths [ month ] . intValue ( ) ; |
public class SarlSkillBuilderImpl { /** * Change the super type .
* @ param superType the qualified name of the super type ,
* or < code > null < / code > if the default type . */
public void setExtends ( String superType ) { } } | if ( ! Strings . isEmpty ( superType ) && ! Skill . class . getName ( ) . equals ( superType ) ) { JvmParameterizedTypeReference superTypeRef = newTypeRef ( this . sarlSkill , superType ) ; JvmTypeReference baseTypeRef = findType ( this . sarlSkill , Skill . class . getCanonicalName ( ) ) ; if ( isSubTypeOf ( this . sarlSkill , superTypeRef , baseTypeRef ) ) { this . sarlSkill . setExtends ( superTypeRef ) ; return ; } } this . sarlSkill . setExtends ( null ) ; |
public class JmxUtil { /** * Register the given dynamic JMX MBean .
* @ param mbean Dynamic MBean to register
* @ param objectName { @ link ObjectName } under which to register the MBean .
* @ param mBeanServer { @ link MBeanServer } where to store the MBean .
* @ throws Exception If registration could not be completed . */
public static void registerMBean ( Object mbean , ObjectName objectName , MBeanServer mBeanServer ) throws Exception { } } | if ( ! mBeanServer . isRegistered ( objectName ) ) { try { SecurityActions . registerMBean ( mbean , objectName , mBeanServer ) ; log . tracef ( "Registered %s under %s" , mbean , objectName ) ; } catch ( InstanceAlreadyExistsException e ) { // this might happen if multiple instances are trying to concurrently register same objectName
log . couldNotRegisterObjectName ( objectName , e ) ; } } else { log . debugf ( "Object name %s already registered" , objectName ) ; } |
public class ConverterServerBuilder { /** * Configures a worker pool for the converter .
* @ param corePoolSize The core pool size of the worker pool .
* @ param maximumPoolSize The maximum pool size of the worker pool .
* @ param keepAliveTime The keep alive time of the worker pool .
* @ param unit The time unit of the specified keep alive time .
* @ return This builder instance . */
public ConverterServerBuilder workerPool ( int corePoolSize , int maximumPoolSize , long keepAliveTime , TimeUnit unit ) { } } | assertNumericArgument ( corePoolSize , true ) ; assertNumericArgument ( maximumPoolSize , true ) ; assertNumericArgument ( corePoolSize + maximumPoolSize , false ) ; assertNumericArgument ( keepAliveTime , true ) ; this . corePoolSize = corePoolSize ; this . maximumPoolSize = maximumPoolSize ; this . keepAliveTime = unit . toMillis ( keepAliveTime ) ; return this ; |
public class Surface { /** * Create a plot canvas with the 3D surface plot of given data .
* @ param x the x - axis values of surface .
* @ param y the y - axis values of surface .
* @ param z the z - axis values of surface . */
public static PlotCanvas plot ( double [ ] x , double [ ] y , double [ ] [ ] z ) { } } | double [ ] lowerBound = { Math . min ( x ) , Math . min ( y ) , Math . min ( z ) } ; double [ ] upperBound = { Math . max ( x ) , Math . max ( y ) , Math . max ( z ) } ; PlotCanvas canvas = new PlotCanvas ( lowerBound , upperBound ) ; Surface surface = new Surface ( x , y , z ) ; canvas . add ( surface ) ; return canvas ; |
public class ObjectReaderImpl { /** * { @ inheritDoc } */
public long skip ( long n ) throws IOException { } } | if ( n <= 0 ) return 0 ; long remaining = n ; int nr ; byte [ ] skipBuffer = new byte [ SerializationConstants . INTERNAL_BUFFER_SIZE ] ; while ( remaining > 0 ) { nr = in . read ( skipBuffer , 0 , ( int ) Math . min ( SerializationConstants . INTERNAL_BUFFER_SIZE , remaining ) ) ; if ( nr < 0 ) { break ; } remaining -= nr ; } return n - remaining ; |
public class PageImpl { /** * Utility method to construct the options map for the next page request .
* @ param < T > the value type that the page holds . Instances of { @ code T } should be { @ code
* Serializable }
* @ param pageTokenOption the key for the next page cursor option in the options map
* @ param cursor the cursor for the next page
* @ param optionMap the previous options map
* @ return the options map for the next page request */
public static < T > Map < T , Object > nextRequestOptions ( T pageTokenOption , String cursor , Map < T , ? > optionMap ) { } } | ImmutableMap . Builder < T , Object > builder = ImmutableMap . builder ( ) ; if ( cursor != null ) { builder . put ( pageTokenOption , cursor ) ; } for ( Map . Entry < T , ? > option : optionMap . entrySet ( ) ) { if ( ! Objects . equals ( option . getKey ( ) , pageTokenOption ) ) { builder . put ( option . getKey ( ) , option . getValue ( ) ) ; } } return builder . build ( ) ; |
public class ScriptModuleUtils { /** * Create module path from module moduleIdentifier .
* @ param moduleIdentifier module identifier to create path for
* @ return path to module for given moduleIdentifier */
public static Path createModulePath ( ModuleIdentifier moduleIdentifier ) { } } | return Paths . get ( moduleIdentifier . getName ( ) + "-" + moduleIdentifier . getSlot ( ) ) ; |
public class WebUtilities { /** * Double encode open or closed brackets in the input String .
* @ param input the String to double encode open or closed brackets
* @ return the String with double encoded open or closed brackets */
public static String doubleEncodeBrackets ( final String input ) { } } | if ( input == null || input . length ( ) == 0 ) { // For performance reasons don ' t use Util . empty
return input ; } return DOUBLE_ENCODE_BRACKETS . translate ( input ) ; |
public class GroundyCodeGen { /** * Makes sure method is public , returns void and all its parameters are annotated too . */
private static List < NameAndType > getParamNames ( Element callbackMethod ) { } } | Element parentClass = callbackMethod . getEnclosingElement ( ) ; String methodFullInfo = parentClass + "#" + callbackMethod ; ExecutableElement method = ( ExecutableElement ) callbackMethod ; if ( ! method . getModifiers ( ) . contains ( Modifier . PUBLIC ) ) { LOGGER . info ( methodFullInfo + " must be public." ) ; System . exit ( - 1 ) ; } if ( method . getReturnType ( ) . getKind ( ) != TypeKind . VOID ) { LOGGER . info ( methodFullInfo + " must return void." ) ; System . exit ( - 1 ) ; } List < NameAndType > paramNames = new ArrayList < NameAndType > ( ) ; for ( VariableElement param : method . getParameters ( ) ) { Param paramAnnotation = param . getAnnotation ( Param . class ) ; if ( paramAnnotation == null ) { LOGGER . info ( methodFullInfo + ": all parameters must be annotated with the @" + Param . class . getName ( ) ) ; System . exit ( - 1 ) ; } paramNames . add ( new NameAndType ( paramAnnotation . value ( ) , param . asType ( ) . toString ( ) ) ) ; } return paramNames ; |
public class IDCard { /** * 获取用户年龄
* @ param idCard 用户身份证号
* @ return 用户年龄 */
public static int getAge ( String idCard ) { } } | int age ; // 计算用户年龄
int year = Integer . parseInt ( idCard . substring ( 6 , 10 ) ) ; int monthDay = Integer . parseInt ( idCard . substring ( 10 , 14 ) ) ; Calendar calendar = Calendar . getInstance ( ) ; int nowYear = calendar . get ( Calendar . YEAR ) ; int nowMonthDay = calendar . get ( Calendar . MONTH ) * 100 + calendar . get ( Calendar . DATE ) ; if ( nowMonthDay > monthDay ) { age = nowYear - year ; } else { age = nowYear - year - 1 ; } if ( age < 0 ) { logger . warn ( "身份证年龄应该大于等于0,但是实际年龄为{}" , age ) ; } return age ; |
public class ChannelReaderInputView { /** * Gets the next segment from the asynchronous block reader . If more requests are to be issued , the method
* first sends a new request with the current memory segment . If no more requests are pending , the method
* adds the segment to the readers return queue , which thereby effectively collects all memory segments .
* Secondly , the method fetches the next non - consumed segment
* returned by the reader . If no further segments are available , this method thrown an { @ link EOFException } .
* @ param current The memory segment used for the next request .
* @ return The memory segment to read from next .
* @ throws EOFException Thrown , if no further segments are available .
* @ throws IOException Thrown , if an I / O error occurred while reading
* @ see AbstractPagedInputView # nextSegment ( org . apache . flink . core . memory . MemorySegment ) */
@ Override protected MemorySegment nextSegment ( MemorySegment current ) throws IOException { } } | // check if we are at our end
if ( this . inLastBlock ) { throw new EOFException ( ) ; } // send a request first . if we have only a single segment , this same segment will be the one obtained in
// the next lines
if ( current != null ) { sendReadRequest ( current ) ; } // get the next segment
final MemorySegment seg = this . reader . getNextReturnedBlock ( ) ; // check the header
if ( seg . getShort ( 0 ) != ChannelWriterOutputView . HEADER_MAGIC_NUMBER ) { throw new IOException ( "The current block does not belong to a ChannelWriterOutputView / " + "ChannelReaderInputView: Wrong magic number." ) ; } if ( ( seg . getShort ( ChannelWriterOutputView . HEADER_FLAGS_OFFSET ) & ChannelWriterOutputView . FLAG_LAST_BLOCK ) != 0 ) { // last block
this . numRequestsRemaining = 0 ; this . inLastBlock = true ; } return seg ; |
public class RepositoryResourceImpl { /** * Creates an object which can be used to compare with another resource ' s to determine if
* they represent the same asset .
* @ return */
public RepositoryResourceMatchingData createMatchingData ( ) { } } | RepositoryResourceMatchingData matchingData = new RepositoryResourceMatchingData ( ) ; matchingData . setName ( getName ( ) ) ; matchingData . setProviderName ( getProviderName ( ) ) ; matchingData . setType ( getType ( ) ) ; return matchingData ; |
public class WindowedStream { /** * Applies the given window function to each window . The window function is called for each
* evaluation of the window for each key individually . The output of the window function is
* interpreted as a regular non - windowed stream .
* < p > Arriving data is incrementally aggregated using the given fold function .
* @ param initialValue the initial value to be passed to the first invocation of the fold function
* @ param foldFunction The fold function .
* @ param foldResultType The result type of the fold function .
* @ param windowFunction The process window function .
* @ param windowResultType The process window function result type .
* @ return The data stream that is the result of applying the fold function to the window .
* @ deprecated use { @ link # aggregate ( AggregateFunction , WindowFunction , TypeInformation , TypeInformation ) } instead */
@ Deprecated @ Internal public < R , ACC > SingleOutputStreamOperator < R > fold ( ACC initialValue , FoldFunction < T , ACC > foldFunction , ProcessWindowFunction < ACC , R , K , W > windowFunction , TypeInformation < ACC > foldResultType , TypeInformation < R > windowResultType ) { } } | if ( foldFunction instanceof RichFunction ) { throw new UnsupportedOperationException ( "FoldFunction can not be a RichFunction." ) ; } if ( windowAssigner instanceof MergingWindowAssigner ) { throw new UnsupportedOperationException ( "Fold cannot be used with a merging WindowAssigner." ) ; } // clean the closures
windowFunction = input . getExecutionEnvironment ( ) . clean ( windowFunction ) ; foldFunction = input . getExecutionEnvironment ( ) . clean ( foldFunction ) ; final String opName = generateOperatorName ( windowAssigner , trigger , evictor , foldFunction , windowFunction ) ; KeySelector < T , K > keySel = input . getKeySelector ( ) ; OneInputStreamOperator < T , R > operator ; if ( evictor != null ) { @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) TypeSerializer < StreamRecord < T > > streamRecordSerializer = ( TypeSerializer < StreamRecord < T > > ) new StreamElementSerializer ( input . getType ( ) . createSerializer ( getExecutionEnvironment ( ) . getConfig ( ) ) ) ; ListStateDescriptor < StreamRecord < T > > stateDesc = new ListStateDescriptor < > ( "window-contents" , streamRecordSerializer ) ; operator = new EvictingWindowOperator < > ( windowAssigner , windowAssigner . getWindowSerializer ( getExecutionEnvironment ( ) . getConfig ( ) ) , keySel , input . getKeyType ( ) . createSerializer ( getExecutionEnvironment ( ) . getConfig ( ) ) , stateDesc , new InternalIterableProcessWindowFunction < > ( new FoldApplyProcessWindowFunction < > ( initialValue , foldFunction , windowFunction , foldResultType ) ) , trigger , evictor , allowedLateness , lateDataOutputTag ) ; } else { FoldingStateDescriptor < T , ACC > stateDesc = new FoldingStateDescriptor < > ( "window-contents" , initialValue , foldFunction , foldResultType . createSerializer ( getExecutionEnvironment ( ) . getConfig ( ) ) ) ; operator = new WindowOperator < > ( windowAssigner , windowAssigner . getWindowSerializer ( getExecutionEnvironment ( ) . getConfig ( ) ) , keySel , input . getKeyType ( ) . createSerializer ( getExecutionEnvironment ( ) . getConfig ( ) ) , stateDesc , new InternalSingleValueProcessWindowFunction < > ( windowFunction ) , trigger , allowedLateness , lateDataOutputTag ) ; } return input . transform ( opName , windowResultType , operator ) ; |
public class Check { /** * Ensures that a readable sequence of { @ code char } values is numeric . Numeric arguments consist only of the
* characters 0-9 and may start with 0 ( compared to number arguments , which must be valid numbers - think of a bank
* account number ) .
* @ param value
* a readable sequence of { @ code char } values which must be a number
* @ param name
* name of object reference ( in source code )
* @ return the given string argument
* @ throws IllegalNumberArgumentException
* if the given argument { @ code value } is no number */
@ ArgumentsChecked @ Throws ( { } } | IllegalNullArgumentException . class , IllegalNumericArgumentException . class } ) public static < T extends CharSequence > T isNumeric ( @ Nonnull final T value , @ Nullable final String name ) { Check . notNull ( value , "value" ) ; if ( ! matches ( NumericRegularExpressionHolder . getPattern ( ) , value ) ) { throw new IllegalNumericArgumentException ( name , value ) ; } return value ; |
public class ServletStartedListener { /** * Sets the given security metadata on the deployed module ' s web module metadata for retrieval later .
* @ param deployedModule the deployed module to get the web module metadata
* @ param securityMetadataFromDD the security metadata processed from the deployment descriptor */
private void setModuleSecurityMetaData ( Container moduleContainer , SecurityMetadata securityMetadataFromDD ) { } } | try { WebModuleMetaData wmmd = moduleContainer . adapt ( WebModuleMetaData . class ) ; wmmd . setSecurityMetaData ( securityMetadataFromDD ) ; } catch ( UnableToAdaptException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "There was a problem setting the security meta data." , e ) ; } } |
public class CommerceAccountOrganizationRelUtil { /** * Returns the commerce account organization rels before and after the current commerce account organization rel in the ordered set where commerceAccountId = & # 63 ; .
* @ param commerceAccountOrganizationRelPK the primary key of the current commerce account organization rel
* @ param commerceAccountId the commerce account ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the previous , current , and next commerce account organization rel
* @ throws NoSuchAccountOrganizationRelException if a commerce account organization rel with the primary key could not be found */
public static CommerceAccountOrganizationRel [ ] findByCommerceAccountId_PrevAndNext ( CommerceAccountOrganizationRelPK commerceAccountOrganizationRelPK , long commerceAccountId , OrderByComparator < CommerceAccountOrganizationRel > orderByComparator ) throws com . liferay . commerce . account . exception . NoSuchAccountOrganizationRelException { } } | return getPersistence ( ) . findByCommerceAccountId_PrevAndNext ( commerceAccountOrganizationRelPK , commerceAccountId , orderByComparator ) ; |
public class FileOutputFormat { /** * Get the { @ link Path } to the output directory for the map - reduce job .
* @ return the { @ link Path } to the output directory for the map - reduce job .
* @ see FileOutputFormat # getWorkOutputPath ( TaskInputOutputContext ) */
public static Path getOutputPath ( JobContext job ) { } } | String name = job . getConfiguration ( ) . get ( "mapred.output.dir" ) ; return name == null ? null : new Path ( name ) ; |
public class Expressions { /** * Create a new Template expression
* @ deprecated Use { @ link # booleanTemplate ( String , List ) } instead .
* @ param template template
* @ param args template parameters
* @ return template expression */
@ Deprecated public static BooleanTemplate booleanTemplate ( String template , ImmutableList < ? > args ) { } } | return booleanTemplate ( createTemplate ( template ) , args ) ; |
public class Pointer { /** * Returns a ByteBuffer that corresponds to the memory that this
* pointer points to . < br >
* < br >
* The returned byte buffer will have the byte order that is implied
* by < code > ByteOrder # nativeOrder ( ) < / code > . It will be a slice of the
* buffer that is stored internally . So it will share the same memory ,
* but its position and limit will be independent of the internal buffer .
* < br >
* This function may only be applied to pointers that have been set to
* point to a region of host - or unified memory using one of these
* methods :
* < ul >
* < li > { @ link jcuda . driver . JCudaDriver # cuMemAllocHost } < / li >
* < li > { @ link jcuda . driver . JCudaDriver # cuMemHostAlloc } < / li >
* < li > { @ link jcuda . driver . JCudaDriver # cuMemAllocManaged } < / li >
* < li > { @ link jcuda . runtime . JCuda # cudaMallocHost } < / li >
* < li > { @ link jcuda . runtime . JCuda # cudaHostAlloc } < / li >
* < li > { @ link jcuda . runtime . JCuda # cudaMallocManaged } < / li >
* < li > { @ link Pointer # to ( byte [ ] ) } < / li >
* < / ul >
* < br >
* For other pointer types , < code > null < / code > is returned .
* @ return The byte buffer */
public ByteBuffer getByteBuffer ( ) { } } | if ( buffer == null ) { return null ; } if ( ! ( buffer instanceof ByteBuffer ) ) { return null ; } ByteBuffer internalByteBuffer = ( ByteBuffer ) buffer ; ByteBuffer byteBuffer = internalByteBuffer . slice ( ) ; return byteBuffer . order ( ByteOrder . nativeOrder ( ) ) ; |
public class Filelistener { /** * Add a new filelistener to the system .
* @ param pResourcename
* @ param pListenerPath
* @ return return true if there has been a success .
* @ throws FileNotFoundException
* @ throws IOException
* @ throws ClassNotFoundException */
public static boolean addFilelistener ( String pResourcename , String pListenerPath ) throws FileNotFoundException , IOException , ClassNotFoundException { } } | mFilelistenerToPaths = new HashMap < String , String > ( ) ; File listenerFilePaths = new File ( StorageManager . ROOT_PATH + File . separator + "mapping.data" ) ; getFileListenersFromSystem ( listenerFilePaths ) ; mFilelistenerToPaths . put ( pResourcename , pListenerPath ) ; ByteArrayDataOutput output = ByteStreams . newDataOutput ( ) ; for ( Entry < String , String > e : mFilelistenerToPaths . entrySet ( ) ) { output . write ( ( e . getKey ( ) + "\n" ) . getBytes ( ) ) ; output . write ( ( e . getValue ( ) + "\n" ) . getBytes ( ) ) ; } java . nio . file . Files . write ( listenerFilePaths . toPath ( ) , output . toByteArray ( ) , StandardOpenOption . TRUNCATE_EXISTING ) ; return true ; |
public class LabelParameterVersionRequest { /** * One or more labels to attach to the specified parameter version .
* @ param labels
* One or more labels to attach to the specified parameter version . */
public void setLabels ( java . util . Collection < String > labels ) { } } | if ( labels == null ) { this . labels = null ; return ; } this . labels = new com . amazonaws . internal . SdkInternalList < String > ( labels ) ; |
public class ServiceUtil { /** * Returns java method name for corresponding rpc method . */
public static String getMethodName ( ServiceMethod serviceMethod ) { } } | String name = serviceMethod . getName ( ) ; String formattedName = Formatter . toCamelCase ( name ) ; if ( isReservedKeyword ( formattedName ) ) { return formattedName + '_' ; } return formattedName ; |
public class HttpRequest { /** * Adds one query string parameter to match which can specified using plain strings or regular expressions
* ( for more details of the supported regex syntax see http : / / docs . oracle . com / javase / 6 / docs / api / java / util / regex / Pattern . html )
* @ param name the parameter name
* @ param values the parameter values which can be a varags of strings or regular expressions */
public HttpRequest withQueryStringParameter ( String name , String ... values ) { } } | this . queryStringParameters . withEntry ( name , values ) ; return this ; |
public class StringParser { /** * Parse the given { @ link String } as double .
* @ param sStr
* The string to parse . May be < code > null < / code > .
* @ param dDefault
* The default value to be returned if the passed object could not be
* converted to a valid value .
* @ return The default value if the string does not represent a valid value . */
public static double parseDouble ( @ Nullable final String sStr , final double dDefault ) { } } | // parseDouble throws a NPE if parameter is null
if ( sStr != null && sStr . length ( ) > 0 ) try { // Single point where we replace " , " with " . " for parsing !
return Double . parseDouble ( _getUnifiedDecimal ( sStr ) ) ; } catch ( final NumberFormatException ex ) { // Fall through
} return dDefault ; |
public class ClustersInner { /** * Gets the gateway settings for the specified cluster .
* @ param resourceGroupName The name of the resource group .
* @ param clusterName The name of the cluster .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the GatewaySettingsInner object */
public Observable < ServiceResponse < GatewaySettingsInner > > getGatewaySettingsWithServiceResponseAsync ( String resourceGroupName , String clusterName ) { } } | if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( clusterName == null ) { throw new IllegalArgumentException ( "Parameter clusterName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . getGatewaySettings ( this . client . subscriptionId ( ) , resourceGroupName , clusterName , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < GatewaySettingsInner > > > ( ) { @ Override public Observable < ServiceResponse < GatewaySettingsInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < GatewaySettingsInner > clientResponse = getGatewaySettingsDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class DBEngineVersion { /** * The types of logs that the database engine has available for export to CloudWatch Logs .
* @ param exportableLogTypes
* The types of logs that the database engine has available for export to CloudWatch Logs . */
public void setExportableLogTypes ( java . util . Collection < String > exportableLogTypes ) { } } | if ( exportableLogTypes == null ) { this . exportableLogTypes = null ; return ; } this . exportableLogTypes = new java . util . ArrayList < String > ( exportableLogTypes ) ; |
public class WriteTimeoutHandler { /** * Is called when a write timeout was detected */
protected void writeTimedOut ( ChannelHandlerContext ctx ) throws Exception { } } | if ( ! closed ) { ctx . fireExceptionCaught ( WriteTimeoutException . INSTANCE ) ; ctx . close ( ) ; closed = true ; } |
public class PBDRegularSegment { /** * Set or clear segment as ' final ' , i . e . whether segment is complete and logically immutable .
* NOTES :
* This is a best - effort feature : On any kind of I / O failure , the exception is swallowed and the operation is a
* no - op : this will be the case on filesystems that do no support extended file attributes . Also note that the
* { @ code FileStore . supportsFileAttributeView } method does not provide a reliable way to test for the availability
* of the extended file attributes .
* Must be called with ' true ' by segment owner when it has filled the segment , written all segment metadata , and
* after it has either closed or sync ' d the segment file .
* Must be called with ' false ' whenever opening segment for writing new data .
* Note that all calls to ' setFinal ' are done by the class owning the segment because the segment itself generally
* lacks context to decide whether it ' s final or not .
* @ param isFinal true if segment is set to final , false otherwise
* @ throws IOException */
void setFinal ( boolean isFinal ) throws IOException { } } | if ( isFinal != m_isFinal ) { if ( PBDSegment . setFinal ( m_file , isFinal ) ) { if ( ! isFinal ) { // It is dangerous to leave final on a segment so make sure the metadata is flushed
m_fc . force ( true ) ; } } else if ( PBDSegment . isFinal ( m_file ) && ! isFinal ) { throw new IOException ( "Could not remove the final attribute from " + m_file . getName ( ) ) ; } // It is OK for m _ isFinal to be true when isFinal ( File ) returns false but not the other way
m_isFinal = isFinal ; } |
public class AndRange { /** * ( non - Javadoc )
* @ see net . ossindex . version . impl . AbstractCommonRange # invert ( ) */
@ Override public IVersionRange invert ( ) { } } | IVersionRange irange1 = range1 . invert ( ) ; IVersionRange irange2 = range2 . invert ( ) ; return new OrRange ( irange1 , irange2 ) ; |
public class QuotedPrintable { /** * Encode the given input . */
public static ByteBuffer encode ( byte [ ] input ) { } } | int pos = input . length + input . length / 3 ; if ( pos < 64 ) pos = 64 ; byte [ ] out = new byte [ pos ] ; pos = 0 ; int lineCount = 0 ; for ( int i = 0 ; i < input . length ; ++ i ) { byte b = input [ i ] ; if ( ( b >= 33 && b <= 60 ) || ( b >= 62 && b <= 126 ) || ( ( b == 9 || b == 32 ) && lineCount < 73 && i < input . length - 1 ) ) { if ( lineCount == 73 ) { if ( pos >= out . length - 4 ) out = increaseBuffer ( out , pos ) ; out [ pos ++ ] = '=' ; out [ pos ++ ] = '\r' ; out [ pos ++ ] = '\n' ; lineCount = 0 ; } else if ( pos >= out . length - 1 ) out = increaseBuffer ( out , pos ) ; out [ pos ++ ] = b ; lineCount ++ ; continue ; } // need to encode
if ( lineCount >= 73 - ( i < input . length - 1 ? 1 : 0 ) ) { if ( pos >= out . length - 7 ) out = increaseBuffer ( out , pos ) ; out [ pos ++ ] = '=' ; out [ pos ++ ] = '\r' ; out [ pos ++ ] = '\n' ; lineCount = 0 ; } if ( pos >= out . length - 3 ) out = increaseBuffer ( out , pos ) ; out [ pos ++ ] = '=' ; out [ pos ++ ] = ( byte ) StringUtil . encodeHexaDigit ( ( b & 0xF0 ) >> 4 ) ; out [ pos ++ ] = ( byte ) StringUtil . encodeHexaDigit ( b & 0xF ) ; lineCount += 3 ; } return ByteBuffer . wrap ( out , 0 , pos ) ; |
public class XsDateTimeConversionJava7 { /** * Returns a DateFormat for each calling thread , using { @ link ThreadLocal } .
* @ return a DateFormat that is safe to use in multi - threaded environments */
private static DateFormat getDateFormat ( ) { } } | if ( IS_JAVA7 ) { SoftReference < DateFormat > softReference = THREAD_LOCAL_DF . get ( ) ; if ( softReference != null ) { DateFormat dateFormat = softReference . get ( ) ; if ( dateFormat != null ) { return dateFormat ; } } DateFormat result = new SimpleDateFormat ( "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" , Locale . US ) ; softReference = new SoftReference < DateFormat > ( result ) ; THREAD_LOCAL_DF . set ( softReference ) ; return result ; } else { throw new RuntimeException ( "Error parsing XES log. This method should not be called unless running on Java 7!" ) ; } |
public class CommerceNotificationTemplatePersistenceImpl { /** * Returns the commerce notification templates before and after the current commerce notification template in the ordered set where uuid = & # 63 ; .
* @ param commerceNotificationTemplateId the primary key of the current commerce notification template
* @ param uuid the uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the previous , current , and next commerce notification template
* @ throws NoSuchNotificationTemplateException if a commerce notification template with the primary key could not be found */
@ Override public CommerceNotificationTemplate [ ] findByUuid_PrevAndNext ( long commerceNotificationTemplateId , String uuid , OrderByComparator < CommerceNotificationTemplate > orderByComparator ) throws NoSuchNotificationTemplateException { } } | CommerceNotificationTemplate commerceNotificationTemplate = findByPrimaryKey ( commerceNotificationTemplateId ) ; Session session = null ; try { session = openSession ( ) ; CommerceNotificationTemplate [ ] array = new CommerceNotificationTemplateImpl [ 3 ] ; array [ 0 ] = getByUuid_PrevAndNext ( session , commerceNotificationTemplate , uuid , orderByComparator , true ) ; array [ 1 ] = commerceNotificationTemplate ; array [ 2 ] = getByUuid_PrevAndNext ( session , commerceNotificationTemplate , uuid , orderByComparator , false ) ; return array ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; } |
public class OrmLiteCursorAdapter { /** * This is here to make sure that the user really wants to override it . */
protected void doBindView ( View itemView , Context context , Cursor cursor ) { } } | try { @ SuppressWarnings ( "unchecked" ) ViewType itemViewType = ( ViewType ) itemView ; bindView ( itemViewType , context , cursorToObject ( cursor ) ) ; } catch ( SQLException e ) { throw new RuntimeException ( e ) ; } |
public class ConnectionImpl { /** * Determines whether a destination prefix for a System destination is valid or not .
* < p > If the destination prefix has more than 24
* characters , then it is invalid .
* < p > The destination prefix is invalid if it contains any characters not in the following
* list :
* < ul >
* < li > a - z ( lower - case alphas ) < / li >
* < li > A - Z ( upper - case alphas ) < / li >
* < li > 0-9 ( numerics ) < / li >
* < li > . ( period ) < / li >
* < li > / ( slash ) < / li >
* < li > % ( percent ) < / li >
* < / ul >
* < p > null and empty string values for a destination prefix are valid , and
* simply indicate an empty prefix .
* @ param destinationPrefix The destination prefix to which the validity
* check is applied .
* @ return true if the destination prefix is valid , false if the destination prefix is
* invalid . */
private static final boolean isDestinationPrefixValid ( String destinationPrefix ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isDestinationPrefixValid" , destinationPrefix ) ; boolean isValid = true ; // Assume the prefix is valid until we know otherwise .
// null indicates that no destination prefix is being used .
if ( null != destinationPrefix ) { // Check for the length first .
int len = destinationPrefix . length ( ) ; if ( len > 24 ) { isValid = false ; } else { // Cycle through each character in the prefix until we find an invalid character ,
// or until we come to the end of the string .
int along = 0 ; while ( ( along < len ) && isValid ) { char c = destinationPrefix . charAt ( along ) ; if ( ! ( ( 'A' <= c ) && ( 'Z' >= c ) ) ) { if ( ! ( ( 'a' <= c ) && ( 'z' >= c ) ) ) { if ( ! ( ( '0' <= c ) && ( '9' >= c ) ) ) { if ( '.' != c && '/' != c && '%' != c ) { // This character isn ' t a valid one . . .
isValid = false ; } } } } // Move along to the next character in the string .
along += 1 ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isDestinationPrefixValid" , Boolean . valueOf ( isValid ) ) ; return isValid ; |
public class RuleHelper { /** * This method returns an instrumented proxy output stream , to wrap
* the supplied output stream , which will record the written data .
* @ param os The original output stream
* @ return The instrumented output stream */
public OutputStream createInOutputStream ( OutputStream os ) { } } | return new InstrumentedOutputStream ( collector ( ) , Direction . In , os , null ) ; |
public class DOType { /** * Answer the field - ( attribute ) definitions declared by this type and all it ' s super types .
* @ return a list of DOField */
public List < DOField > getFields ( ) { } } | List < DOField > ret = new ArrayList < DOField > ( ) ; DOType typ = this ; while ( typ != null ) { ret . addAll ( typ . getDeclaredFields ( ) ) ; typ = typ . getSuperType ( ) ; } return ret ; |
public class CommerceNotificationAttachmentLocalServiceBaseImpl { /** * Adds the commerce notification attachment to the database . Also notifies the appropriate model listeners .
* @ param commerceNotificationAttachment the commerce notification attachment
* @ return the commerce notification attachment that was added */
@ Indexable ( type = IndexableType . REINDEX ) @ Override public CommerceNotificationAttachment addCommerceNotificationAttachment ( CommerceNotificationAttachment commerceNotificationAttachment ) { } } | commerceNotificationAttachment . setNew ( true ) ; return commerceNotificationAttachmentPersistence . update ( commerceNotificationAttachment ) ; |
public class NoxView { /** * Checks the X and Y scroll offset to update that values into the Shape configured previously . */
private void updateShapeOffset ( ) { } } | int offsetX = scroller . getOffsetX ( ) ; int offsetY = scroller . getOffsetY ( ) ; shape . setOffset ( offsetX , offsetY ) ; |
public class ControlBrowseEndImpl { /** * Get summary trace line for this message
* Javadoc description supplied by ControlMessage interface . */
public void getTraceSummaryLine ( StringBuilder buff ) { } } | // Get the common fields for control messages
super . getTraceSummaryLine ( buff ) ; buff . append ( ",browseID=" ) ; buff . append ( getBrowseID ( ) ) ; buff . append ( ",exceptionCode=" ) ; buff . append ( getExceptionCode ( ) ) ; |
public class Container { /** * Indicates the specified component installed or not in the container .
* @ param component The component class to be examined .
* @ return < code > true < / code > if the specified component installed in the
* container . */
public boolean installed ( Class < ? > component ) { } } | Preconditions . checkArgument ( component != null , "Parameter 'component' must not be [" + component + "]" ) ; return installed . contains ( component ) ; |
public class EcodInstallation { /** * Parses the domains from the local file
* @ throws IOException */
private void parseDomains ( ) throws IOException { } } | domainsFileLock . writeLock ( ) . lock ( ) ; logger . trace ( "LOCK writelock" ) ; try { EcodParser parser = new EcodParser ( getDomainFile ( ) ) ; allDomains = parser . getDomains ( ) ; parsedVersion = parser . getVersion ( ) ; } finally { logger . trace ( "UNLOCK writelock" ) ; domainsFileLock . writeLock ( ) . unlock ( ) ; } |
public class TCPInputPoller { /** * / * ( non - Javadoc )
* @ see java . lang . Thread # run ( )
* Start waiting for TCP messages . */
public void run ( ) { } } | this . serverSocket = null ; try { Log ( Level . INFO , "Attempting to create SocketServer..." ) ; // If requrestedPortNumber is 0 and we have a range of ports specified , then attempt to allocate a port dynamically from that range .
if ( this . requestedPortNumber == 0 && this . portRangeMax != - 1 && this . portRangeMin != - 1 ) { this . serverSocket = TCPUtils . getSocketInRange ( this . portRangeMin , this . portRangeMax , this . choosePortRandomly ) ; if ( this . serverSocket == null ) throw new Exception ( "Could not allocate port from range." ) ; } else // Attempt to use the requested port - if it ' s 0 , the system will allocate one dynamically .
this . serverSocket = new ServerSocket ( this . requestedPortNumber ) ; // Use the specified port number
} catch ( Exception e ) { SysLog ( Level . SEVERE , "Failed to create SocketServer: " + e ) ; this . failedToCreate = true ; return ; } SysLog ( Level . INFO , "Listening for messages on port " + this . serverSocket . getLocalPort ( ) ) ; while ( keepRunning ) { Socket socket = null ; try { Log ( Level . INFO , "Waiting for incoming message..." ) ; socket = this . serverSocket . accept ( ) ; if ( socket != null ) Log ( Level . INFO , "Connected to: " + socket . getLocalAddress ( ) + "(local), " + socket . getRemoteSocketAddress ( ) + "(remote)" ) ; else Log ( Level . WARNING , "Accept() returns a null socket!?" ) ; } catch ( SocketException e ) { SysLog ( Level . INFO , "Socket exception - usually caused by ServerSocket being closed under our feet (normal for stopping polling): " + e ) ; } catch ( IOException e ) { SysLog ( Level . SEVERE , "Failed to accept socket request: " + e ) ; } if ( socket != null ) { this . connection_count ++ ; Runnable connectionHandler = new TCPConnectionHandler ( socket , this , this . logname + ":S#" + this . connection_count ) ; new Thread ( connectionHandler ) . start ( ) ; } } if ( this . serverSocket != null ) { try { Log ( Level . INFO , "Closing server socket..." ) ; this . serverSocket . close ( ) ; Log ( Level . INFO , "...closed okay." ) ; } catch ( IOException e ) { Log ( Level . SEVERE , "Something went wrong closing server socket: " + e ) ; } } |
public class WebDirectoryResourceListSource { /** * { @ inheritDoc } */
protected List getDirectories ( ) { } } | List dirs = new ArrayList ( 1 ) ; dirs . add ( path + File . separator + "classes" ) ; return dirs ; |
public class EntryStream { /** * Returns a stream consisting of the entries of this stream , additionally
* performing the provided action on each entry key - value pair as entries
* are consumed from the resulting stream .
* This is an < a href = " package - summary . html # StreamOps " > intermediate < / a >
* operation .
* For parallel stream pipelines , the action may be called at whatever time
* and in whatever thread the element is made available by the upstream
* operation . If the action modifies shared state , it is responsible for
* providing the required synchronization .
* @ param action a non - interfering action to perform on the keys and values
* of the entries as they are consumed from the stream
* @ return the new stream
* @ since 0.2.3 */
public EntryStream < K , V > peekKeyValue ( BiConsumer < ? super K , ? super V > action ) { } } | return peek ( toConsumer ( action ) ) ; |
public class BaseConfigFileService { /** * Validate the config with the supplied { @ link ValidationService } , calls { @ link # withoutDefaultLogin ( Config ) }
* and { @ link # withHashedPasswords ( Config ) } before setting the config , and calls { @ link # postUpdate }
* before writing the config to a file .
* @ param config The new config
* @ throws IOException If an error occurs writing out the config file
* @ throws ConfigValidationException If the supplied config is invalid .
* @ throws Exception if an unspecified error occurs in postUpdate */
@ Override public void updateConfig ( final T config ) throws Exception { } } | final ValidationResults validationResults = validationService . validateEnabledConfig ( config ) ; if ( ! validationResults . isValid ( ) ) { throw new ConfigValidationException ( validationResults ) ; } final T initialConfig = getConfig ( ) ; setConfig ( config ) ; safePostUpdate ( config , initialConfig ) ; try { writeOutConfigFile ( this . config . get ( ) , getConfigFileLocation ( ) ) ; } catch ( final IOException e ) { setConfig ( initialConfig ) ; safePostUpdate ( initialConfig , initialConfig ) ; throw e ; } |
public class HtmlUnitRegExpProxy { /** * { @ inheritDoc } */
@ Override public Object compileRegExp ( final Context cx , final String source , final String flags ) { } } | try { return wrapped_ . compileRegExp ( cx , source , flags ) ; } catch ( final Exception e ) { // LOG . warn ( " compileRegExp ( ) threw for > " + source + " < , flags : > "
// + flags + " < . "
// + " Replacing with a ' # # # # shouldNotFindAnything # # # ' " ) ;
return wrapped_ . compileRegExp ( cx , "####shouldNotFindAnything###" , "" ) ; } |
public class IdpMetadataGenerator { /** * List of bindings to be included in the generated metadata for Web Single Sign - On Holder of Key . Ordering of
* bindings affects inclusion in the generated metadata .
* " post " ( or
* " urn : oasis : names : tc : SAML : 2.0 : bindings : HTTP - POST " ) .
* By default there are no included bindings for the profile .
* @ param bindingsHoKSSO
* bindings for web single sign - on holder - of - key */
public void setBindingsHoKSSO ( Collection < String > bindingsHoKSSO ) { } } | if ( bindingsHoKSSO == null ) { this . bindingsHoKSSO = Collections . emptyList ( ) ; } else { this . bindingsHoKSSO = bindingsHoKSSO ; } |
public class DexMaker { /** * parent class types . */
private String generateFileName ( ) { } } | int checksum = 1 ; Set < TypeId < ? > > typesKeySet = types . keySet ( ) ; Iterator < TypeId < ? > > it = typesKeySet . iterator ( ) ; int [ ] checksums = new int [ typesKeySet . size ( ) ] ; int i = 0 ; while ( it . hasNext ( ) ) { TypeId < ? > typeId = it . next ( ) ; TypeDeclaration decl = getTypeDeclaration ( typeId ) ; Set < MethodId > methodSet = decl . methods . keySet ( ) ; if ( decl . supertype != null ) { int sum = 31 * decl . supertype . hashCode ( ) + decl . interfaces . hashCode ( ) ; checksums [ i ++ ] = 31 * sum + methodSet . hashCode ( ) ; } } Arrays . sort ( checksums ) ; for ( int sum : checksums ) { checksum *= 31 ; checksum += sum ; } return "Generated_" + checksum + ".jar" ; |
public class Abbreviations { /** * Count number of upper case chars . */
private int countUpper ( String str ) { } } | if ( str == null ) return 0 ; int num = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) if ( Character . isUpperCase ( str . charAt ( i ) ) ) num ++ ; return num ; |
public class BibliographyCommand { /** * Performs CSL conversion and generates a bibliography
* @ param style the CSL style
* @ param locale the CSL locale
* @ param format the output format
* @ param citationIds the citation ids given on the command line
* @ param provider a provider containing all citation item data
* @ param out the print stream to write the output to
* @ return the exit code
* @ throws IOException if the CSL processor could not be initialized */
private int generateCSL ( String style , String locale , String format , List < String > citationIds , ItemDataProvider provider , PrintWriter out ) throws IOException { } } | if ( ! checkStyle ( style ) ) { return 1 ; } // initialize citation processor
try ( CSL citeproc = new CSL ( provider , style , locale ) ) { // set output format
citeproc . setOutputFormat ( format ) ; // register citation items
String [ ] citationIdsArr = new String [ citationIds . size ( ) ] ; citationIdsArr = citationIds . toArray ( citationIdsArr ) ; if ( citationIds . isEmpty ( ) ) { citationIdsArr = provider . getIds ( ) ; } citeproc . registerCitationItems ( citationIdsArr ) ; // generate bibliography
doGenerateCSL ( citeproc , citationIdsArr , out ) ; } catch ( FileNotFoundException e ) { error ( e . getMessage ( ) ) ; return 1 ; } return 0 ; |
public class SystemOutputInterceptor { /** * Stops intercepting System . out / System . err , sending output to wherever it was
* going when this interceptor was created . */
public void stop ( ) { } } | if ( output ) { System . setOut ( ( PrintStream ) out ) ; } else { System . setErr ( ( PrintStream ) out ) ; } |
public class AbstractDatabase { /** * Adds a new check key to given SQL table .
* @ param _ con SQL connection
* @ param _ tableName name of the SQL table for which the check key must be
* created
* @ param _ checkKeyName name of check key to create
* @ param _ condition condition of the check key
* @ throws SQLException if check key could not be defined for SQL table */
public void addCheckKey ( final Connection _con , final String _tableName , final String _checkKeyName , final String _condition ) throws SQLException { } } | final StringBuilder cmd = new StringBuilder ( ) . append ( "alter table " ) . append ( _tableName ) . append ( " " ) . append ( "add constraint " ) . append ( _checkKeyName ) . append ( " " ) . append ( "check(" ) . append ( _condition ) . append ( ")" ) ; AbstractDatabase . LOG . debug ( " ..SQL> " + cmd . toString ( ) ) ; // excecute statement
final Statement stmt = _con . createStatement ( ) ; try { stmt . execute ( cmd . toString ( ) ) ; } finally { stmt . close ( ) ; } |
public class U { /** * Documented , # last */
public static < E > E last ( final List < E > list ) { } } | return list . get ( list . size ( ) - 1 ) ; |
public class MLEDependencyGrammar { /** * Score a tag binned dependency . */
public double scoreTB ( IntDependency dependency ) { } } | return op . testOptions . depWeight * Math . log ( probTB ( dependency ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.