signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Error { /** * Thrown when the xml configuration of the clazz doesn ' t exist .
* @ param clazz class to check */
public static void classNotConfigured ( Class < ? > clazz ) { } } | throw new MappingNotFoundException ( MSG . INSTANCE . message ( Constants . mappingNotFoundException1 , clazz . getSimpleName ( ) ) ) ; |
public class Monitoring { /** * < pre >
* Monitoring configurations for sending metrics to the consumer project .
* There can be multiple consumer destinations . A monitored resouce type may
* appear in multiple monitoring destinations if different aggregations are
* needed for different sets of metrics associated with that monitored
* resource type . A monitored resource and metric pair may only be used once
* in the Monitoring configuration .
* < / pre >
* < code > repeated . google . api . Monitoring . MonitoringDestination consumer _ destinations = 2 ; < / code > */
public java . util . List < ? extends com . google . api . Monitoring . MonitoringDestinationOrBuilder > getConsumerDestinationsOrBuilderList ( ) { } } | return consumerDestinations_ ; |
public class GetBasePathMappingsResult { /** * The current page of elements from this collection .
* @ param items
* The current page of elements from this collection . */
public void setItems ( java . util . Collection < BasePathMapping > items ) { } } | if ( items == null ) { this . items = null ; return ; } this . items = new java . util . ArrayList < BasePathMapping > ( items ) ; |
public class OrderList { /** * Whether all individual orders are the same
* @ return */
public boolean hasCommonOrder ( ) { } } | Order lastOrder = null ; for ( OrderEntry oe : list ) { if ( lastOrder == null ) lastOrder = oe . order ; else if ( lastOrder != oe . order ) return false ; } return true ; |
public class CmsContainerPageElementPanel { /** * Adds the collector edit buttons . < p >
* @ param editable the marker element for an editable list element */
private void addListCollectorEditorButtons ( Element editable ) { } } | CmsListCollectorEditor editor = new CmsListCollectorEditor ( editable , m_clientId ) ; add ( editor , editable . getParentElement ( ) ) ; if ( CmsDomUtil . hasDimension ( editable . getParentElement ( ) ) ) { editor . setParentHasDimensions ( true ) ; editor . setPosition ( CmsDomUtil . getEditablePosition ( editable ) , getElement ( ) ) ; } else { editor . setParentHasDimensions ( false ) ; } m_editables . put ( editable , editor ) ; |
public class Never { /** * < p > If called outside a transaction context , managed bean method execution
* must then continue outside a transaction context . < / p >
* < p > If called inside a transaction context , a TransactionalException with
* a nested InvalidTransactionException must be thrown . < / p > */
@ AroundInvoke public Object never ( final InvocationContext context ) throws Exception { } } | if ( getUOWM ( ) . getUOWType ( ) == UOWSynchronizationRegistry . UOW_TYPE_GLOBAL_TRANSACTION ) { throw new TransactionalException ( "TxType.NEVER method called within a global tx" , new InvalidTransactionException ( ) ) ; } return runUnderUOWNoEnablement ( UOWSynchronizationRegistry . UOW_TYPE_LOCAL_TRANSACTION , true , context , "NEVER" ) ; |
public class GoldenGrammarError { /** * getter for error - gets
* @ generated */
public String getError ( ) { } } | if ( GoldenGrammarError_Type . featOkTst && ( ( GoldenGrammarError_Type ) jcasType ) . casFeat_error == null ) jcasType . jcas . throwFeatMissing ( "error" , "cogroo.uima.GoldenGrammarError" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( GoldenGrammarError_Type ) jcasType ) . casFeatCode_error ) ; |
public class RecurlyClient { /** * Update Account
* Updates an existing account .
* @ param accountCode recurly account id
* @ param account account object
* @ return the updated account object on success , null otherwise */
public Account updateAccount ( final String accountCode , final Account account ) { } } | return doPUT ( Account . ACCOUNT_RESOURCE + "/" + accountCode , account , Account . class ) ; |
public class Dispatcher { void dispatch ( ServletRequest servletRequest , ServletResponse servletResponse , int type ) throws ServletException , IOException { } } | HttpServletRequest httpServletRequest = ( HttpServletRequest ) servletRequest ; HttpServletResponse httpServletResponse = ( HttpServletResponse ) servletResponse ; HttpConnection httpConnection = _servletHandler . getHttpContext ( ) . getHttpConnection ( ) ; ServletHttpRequest servletHttpRequest = ( ServletHttpRequest ) httpConnection . getRequest ( ) . getWrapper ( ) ; // wrap the request and response
DispatcherRequest request = new DispatcherRequest ( httpServletRequest , servletHttpRequest , type ) ; DispatcherResponse response = new DispatcherResponse ( request , httpServletResponse ) ; if ( type == Dispatcher . __FORWARD ) servletResponse . resetBuffer ( ) ; // Merge parameters
String query = _query ; MultiMap parameters = null ; if ( query != null ) { Map old_params = httpServletRequest . getParameterMap ( ) ; // Add the parameters
parameters = new MultiMap ( ) ; UrlEncoded . decodeTo ( query , parameters , request . getCharacterEncoding ( ) ) ; if ( old_params != null && old_params . size ( ) > 0 ) { // Merge old parameters .
Iterator iter = old_params . entrySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) iter . next ( ) ; String name = ( String ) entry . getKey ( ) ; String [ ] values = ( String [ ] ) entry . getValue ( ) ; for ( int i = 0 ; i < values . length ; i ++ ) parameters . add ( name , values [ i ] ) ; } } request . setParameters ( parameters ) ; String old_query = httpServletRequest . getQueryString ( ) ; if ( old_query != null ) request . setQuery ( query + "&" + old_query ) ; else request . setQuery ( query ) ; } Object old_scope = null ; try { if ( request . crossContext ( ) ) { // Setup new _ context
old_scope = _servletHandler . getHttpContext ( ) . enterContextScope ( httpConnection . getRequest ( ) , httpConnection . getResponse ( ) ) ; } if ( isNamed ( ) ) { // No further modifications required .
if ( _servletHandler instanceof WebApplicationHandler ) { JSR154Filter filter = ( ( WebApplicationHandler ) _servletHandler ) . getJsr154Filter ( ) ; if ( filter != null && filter . isUnwrappedDispatchSupported ( ) ) { filter . setDispatch ( request , response ) ; _servletHandler . dispatch ( null , httpServletRequest , httpServletResponse , _holder , type ) ; } else _servletHandler . dispatch ( null , request , response , _holder , type ) ; } else _servletHandler . dispatch ( null , request , response , _holder , type ) ; } else { // Adjust servlet paths
request . setPaths ( _servletHandler . getHttpContext ( ) . getContextPath ( ) , PathMap . pathMatch ( _pathSpec , _pathInContext ) , PathMap . pathInfo ( _pathSpec , _pathInContext ) ) ; // are we wrap over or wrap under
if ( _servletHandler instanceof WebApplicationHandler ) { JSR154Filter filter = ( ( WebApplicationHandler ) _servletHandler ) . getJsr154Filter ( ) ; if ( filter != null && filter . isUnwrappedDispatchSupported ( ) ) { filter . setDispatch ( request , response ) ; _servletHandler . dispatch ( _pathInContext , httpServletRequest , httpServletResponse , _holder , type ) ; } else _servletHandler . dispatch ( _pathInContext , request , response , _holder , type ) ; } else _servletHandler . dispatch ( _pathInContext , request , response , _holder , type ) ; if ( type != Dispatcher . __INCLUDE ) response . close ( ) ; else if ( response . isFlushNeeded ( ) ) response . flushBuffer ( ) ; } } finally { // restore _ context
if ( request . crossContext ( ) ) _servletHandler . getHttpContext ( ) . leaveContextScope ( httpConnection . getRequest ( ) , httpConnection . getResponse ( ) , old_scope ) ; } |
public class InstanceClient { /** * Sets an instance ' s scheduling options .
* < p > Sample code :
* < pre > < code >
* try ( InstanceClient instanceClient = InstanceClient . create ( ) ) {
* ProjectZoneInstanceName instance = ProjectZoneInstanceName . of ( " [ PROJECT ] " , " [ ZONE ] " , " [ INSTANCE ] " ) ;
* Scheduling schedulingResource = Scheduling . newBuilder ( ) . build ( ) ;
* Operation response = instanceClient . setSchedulingInstance ( instance , schedulingResource ) ;
* < / code > < / pre >
* @ param instance Instance name for this request .
* @ param schedulingResource Sets the scheduling options for an Instance .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation setSchedulingInstance ( ProjectZoneInstanceName instance , Scheduling schedulingResource ) { } } | SetSchedulingInstanceHttpRequest request = SetSchedulingInstanceHttpRequest . newBuilder ( ) . setInstance ( instance == null ? null : instance . toString ( ) ) . setSchedulingResource ( schedulingResource ) . build ( ) ; return setSchedulingInstance ( request ) ; |
public class JDBC4PreparedStatement { /** * Executes the SQL statement in this PreparedStatement object , which may be any kind of SQL statement . */
@ Override public boolean execute ( ) throws SQLException { } } | checkClosed ( ) ; boolean result = this . execute ( this . Query . getExecutableQuery ( this . parameters ) ) ; this . parameters = this . Query . getParameterArray ( ) ; return result ; |
public class Matrix4f { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix4fc # transformDirection ( org . joml . Vector3fc , org . joml . Vector3f ) */
public Vector3f transformDirection ( Vector3fc v , Vector3f dest ) { } } | return transformDirection ( v . x ( ) , v . y ( ) , v . z ( ) , dest ) ; |
public class RecordReferenceField { /** * Make the record that this field references .
* Typically , you override this method to set the referenced class if it doesn ' t exist .
* < p > < pre >
* For Example :
* return new RecordName ( screen ) ;
* < / pre >
* @ param recordOwner The recordowner .
* @ return tour . db . Record */
public final Record makeReferenceRecord ( ) { } } | if ( m_recordReference != null ) return m_recordReference ; // It already exists
RecordOwner recordOwner = null ; if ( this . getRecord ( ) != null ) recordOwner = Record . findRecordOwner ( this . getRecord ( ) ) ; // This way the record has access to the correct environment .
this . setReferenceRecord ( this . makeReferenceRecord ( recordOwner ) ) ; return m_recordReference ; |
public class EditAutoKeeper { /** * 找到单个Channel , 用于编辑Channel信息界面加载信息
* @ param channelId
* @ param context
* @ throws WebxException */
public void execute ( @ Param ( "clusterId" ) Long clusterId , Context context , Navigator nav ) throws Exception { } } | AutoKeeperCluster autoKeeperCluster = autoKeeperClusterService . findAutoKeeperClusterById ( clusterId ) ; context . put ( "autoKeeperCluster" , autoKeeperCluster ) ; |
public class MarshallableTypeHints { /** * Returns whether the hint on whether a particular type is marshallable or
* not is available . This method can be used to avoid attempting to marshall
* a type , if the hints for the type have already been calculated .
* @ param type Marshallable type to check whether an attempt to mark it as
* marshallable has been made .
* @ return true if the type has been marked as marshallable at all , false
* if no attempt has been made to mark the type as marshallable . */
public boolean isKnownMarshallable ( Class < ? > type ) { } } | MarshallingType marshallingType = typeHints . get ( type ) ; return marshallingType != null && marshallingType . isMarshallable != null ; |
public class AmazonECRClient { /** * Applies a repository policy on a specified repository to control access permissions .
* @ param setRepositoryPolicyRequest
* @ return Result of the SetRepositoryPolicy operation returned by the service .
* @ throws ServerException
* These errors are usually caused by a server - side issue .
* @ throws InvalidParameterException
* The specified parameter is invalid . Review the available parameters for the API request .
* @ throws RepositoryNotFoundException
* The specified repository could not be found . Check the spelling of the specified repository and ensure
* that you are performing operations on the correct registry .
* @ sample AmazonECR . SetRepositoryPolicy
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ecr - 2015-09-21 / SetRepositoryPolicy " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public SetRepositoryPolicyResult setRepositoryPolicy ( SetRepositoryPolicyRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeSetRepositoryPolicy ( request ) ; |
public class GetMethodCachePlugin { /** * Check if request contains header with value
* @ param request request
* @ param headerName header name
* @ param headerValue header value to check */
private boolean headerEq ( HttpRequestBase request , String headerName , String headerValue ) { } } | Header [ ] headers = request . getAllHeaders ( ) ; if ( headers != null ) { for ( Header h : headers ) { if ( headerName . equalsIgnoreCase ( h . getName ( ) ) && headerValue . equalsIgnoreCase ( h . getValue ( ) ) ) { return true ; } } } return false ; |
public class JmsBytesMessageImpl { /** * ( non - Javadoc )
* @ see javax . jms . BytesMessage # getBodyLength ( ) */
@ Override public long getBodyLength ( ) throws JMSException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getBodyLength" ) ; long bLen ; // D175063 CTS requires a MessageNotReadableException . This is entirely
// pointless , so I ' ll leave the rest of the code intact , and just add a
// call to checkBodyReadable . Perhaps the restriction can be lifted in
// future .
// Check that we are in read mode
checkBodyReadable ( "getBodyLength" ) ; if ( requiresInit ) lazyInitForReading ( ) ; if ( dataBuffer == null ) { bLen = 0 ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "buffer null" ) ; } else { // the length is the dataBuffer length - dataStart .
bLen = dataBuffer . length - dataStart ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getBodyLength" , bLen ) ; return bLen ; |
public class HashFunctions { /** * Based on an original suggestion on Robert Jenkin ' s part in 1997 and Thomas Wang 2007 updates . < p / > < h3 > Links < / h3 >
* < a href = " http : / / www . concentric . net / ~ ttwang / tech / inthash . htm " > http : / / www . concentric . net / ~ ttwang / tech / inthash . htm < / a > < br / >
* < a href = " http : / / en . wikipedia . org / wiki / Jenkins _ hash _ function ' s " > http : / / en . wikipedia . org / wiki / Jenkins _ hash _ function ' s < / a > < br / >
* @ param key key to be hashed
* @ return hashed value */
public static long JenkinWang64shift ( long key ) { } } | key = ( ~ key ) + ( key << 21 ) ; // key = ( key < < 21 ) - key - 1;
key = key ^ ( key >>> 24 ) ; key = ( key + ( key << 3 ) ) + ( key << 8 ) ; // key * 265
key = key ^ ( key >>> 14 ) ; key = ( key + ( key << 2 ) ) + ( key << 4 ) ; // key * 21
key = key ^ ( key >>> 28 ) ; key = key + ( key << 31 ) ; return key ; |
public class DestinationManager { /** * < p > This method is used to alter an MQLink that is localised on this ME . < / p >
* @ param vld
* @ param uuid
* @ param ld
* @ throws SINotPossibleInCurrentConfigurationException
* @ throws SIResourceException
* @ throws SIConnectionLostException
* @ throws SIException
* @ throws SIBExceptionBase */
public void alterMQLinkLocalization ( MQLinkDefinition mqld , LocalizationDefinition ld , VirtualLinkDefinition vld ) throws SINotPossibleInCurrentConfigurationException , SIResourceException , SIConnectionLostException , SIException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "alterMQLinkLocalization" , new Object [ ] { vld , mqld , ld } ) ; // Get the destination
LinkTypeFilter filter = new LinkTypeFilter ( ) ; filter . MQLINK = Boolean . TRUE ; // includeInvisible ?
// filter . VISIBLE = Boolean . TRUE ;
MQLinkHandler mqLinkHandler = ( MQLinkHandler ) linkIndex . findByMQLinkUuid ( mqld . getUuid ( ) , filter ) ; checkMQLinkExists ( mqLinkHandler != null , vld . getName ( ) ) ; synchronized ( mqLinkHandler ) { // Get the wrapped mqlinkobject
MQLinkObject mqlinkObject = mqLinkHandler . getMQLinkObject ( ) ; // Call MQLink Component to propagate the update request
mqlinkObject . update ( mqld ) ; // Now we look at those changes that MP needs to act upon .
// We ' ll do this under a tranaction , in the spirit of the code that
// alters destination information . This work is neither coordinated with
// the MQLink component nor the Admin component .
// Create a local UOW
LocalTransaction transaction = txManager . createLocalTransaction ( true ) ; // Try to alter the local destination .
try { // Update the virtual linkdefinition
mqLinkHandler . updateLinkDefinition ( vld , transaction ) ; // Drive the update to the localization definition .
if ( ld != null ) { // Update the localisation definition too .
mqLinkHandler . updateLocalizationDefinition ( ld , transaction ) ; } // Alert the lookups object to handle the re - definition
linkIndex . create ( mqLinkHandler ) ; // If the update was successful then commit the unit of work
transaction . commit ( ) ; } catch ( SIResourceException e ) { // No FFDC code needed
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "alterMQLinkLocalization" , e ) ; handleRollback ( transaction ) ; throw e ; } catch ( RuntimeException e ) { // FFDC
FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.DestinationManager.alterMQLinkLocalization" , "1:3611:1.508.1.7" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exception ( tc , e ) ; SibTr . exit ( tc , "alterMQLinkLocalization" , e ) ; } handleRollback ( transaction ) ; throw e ; } } // eof synchronized on mqLinkHandler
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "alterMQLinkLocalization" ) ; |
public class JsonLdProcessor { /** * Converts an RDF dataset to JSON - LD , using a specific instance of
* { @ link RDFParser } .
* @ param input
* a serialized string of RDF in a format specified by the format
* option or an RDF dataset to convert .
* @ param options
* the options to use : [ format ] the format if input is not an
* array : ' application / nquads ' for N - Quads ( default ) .
* [ useRdfType ] true to use rdf : type , false to use @ type
* ( default : false ) . [ useNativeTypes ] true to convert XSD types
* into native types ( boolean , integer , double ) , false not to
* ( default : true ) .
* @ param parser
* A specific instance of { @ link RDFParser } to use for the
* conversion .
* @ return A JSON - LD object .
* @ throws JsonLdError
* If there is an error converting the dataset to JSON - LD . */
public static Object fromRDF ( Object input , JsonLdOptions options , RDFParser parser ) throws JsonLdError { } } | final RDFDataset dataset = parser . parse ( input ) ; // convert from RDF
final Object rval = new JsonLdApi ( options ) . fromRDF ( dataset ) ; // re - process using the generated context if outputForm is set
if ( options . outputForm != null ) { if ( JsonLdConsts . EXPANDED . equals ( options . outputForm ) ) { return rval ; } else if ( JsonLdConsts . COMPACTED . equals ( options . outputForm ) ) { return compact ( rval , dataset . getContext ( ) , options ) ; } else if ( JsonLdConsts . FLATTENED . equals ( options . outputForm ) ) { return flatten ( rval , dataset . getContext ( ) , options ) ; } else { throw new JsonLdError ( JsonLdError . Error . UNKNOWN_ERROR , "Output form was unknown: " + options . outputForm ) ; } } return rval ; |
public class DefList { public void add ( Element term , Element def ) { } } | terms . addElement ( term ) ; defs . addElement ( def ) ; |
public class FaceDetail { /** * Indicates the location of landmarks on the face . Default attribute .
* @ param landmarks
* Indicates the location of landmarks on the face . Default attribute . */
public void setLandmarks ( java . util . Collection < Landmark > landmarks ) { } } | if ( landmarks == null ) { this . landmarks = null ; return ; } this . landmarks = new java . util . ArrayList < Landmark > ( landmarks ) ; |
public class Unpooled { /** * Creates a new buffer whose content is a copy of the specified
* { @ code buffer } ' s current slice . The new buffer ' s { @ code readerIndex }
* and { @ code writerIndex } are { @ code 0 } and { @ code buffer . remaining }
* respectively . */
public static ByteBuf copiedBuffer ( ByteBuffer buffer ) { } } | int length = buffer . remaining ( ) ; if ( length == 0 ) { return EMPTY_BUFFER ; } byte [ ] copy = PlatformDependent . allocateUninitializedArray ( length ) ; // Duplicate the buffer so we not adjust the position during our get operation .
// See https : / / github . com / netty / netty / issues / 3896
ByteBuffer duplicate = buffer . duplicate ( ) ; duplicate . get ( copy ) ; return wrappedBuffer ( copy ) . order ( duplicate . order ( ) ) ; |
public class JSONObject { /** * 格式化输出JSON字符串
* @ param indentFactor 每层缩进空格数
* @ return JSON字符串
* @ throws JSONException 包含非法数抛出此异常 */
@ Override public String toJSONString ( int indentFactor ) throws JSONException { } } | final StringWriter w = new StringWriter ( ) ; return this . write ( w , indentFactor , 0 ) . toString ( ) ; |
public class CommonOps_DSCC { /** * Returns the value of the element with the largest value
* @ param A ( Input ) Matrix . Not modified .
* @ return scalar */
public static double elementMax ( DMatrixSparseCSC A ) { } } | if ( A . nz_length == 0 ) return 0 ; // if every element is assigned a value then the first element can be a max .
// Otherwise zero needs to be considered
double max = A . isFull ( ) ? A . nz_values [ 0 ] : 0 ; for ( int i = 0 ; i < A . nz_length ; i ++ ) { double val = A . nz_values [ i ] ; if ( val > max ) { max = val ; } } return max ; |
public class TLSEncryptionAdapter { /** * Gather all the frames that comprise a whole Volt Message
* Returns the delta between the original message byte count and encrypted message byte count . */
private int addFramesForCompleteMessage ( ) { } } | boolean added = false ; EncryptFrame frame = null ; int delta = 0 ; while ( ! added && ( frame = m_encryptedFrames . poll ( ) ) != null ) { if ( ! frame . isLast ( ) ) { // TODO : Review - I don ' t think this synchronized ( m _ partialMessages ) is required .
// This is the only method with synchronized ( m _ partialMessages ) and
// it doesn ' t look like this method will be called from multiple threads concurrently .
// Take this out 8.0 release .
synchronized ( m_partialMessages ) { m_partialMessages . add ( frame ) ; ++ m_partialSize ; } continue ; } final int partialSize = m_partialSize ; if ( partialSize > 0 ) { assert frame . chunks == partialSize + 1 : "partial frame buildup has wrong number of preceding pieces" ; // TODO : Review - I don ' t think this synchronized ( m _ partialMessages ) is required .
// See comment above .
// Take this out 8.0 release .
synchronized ( m_partialMessages ) { for ( EncryptFrame frm : m_partialMessages ) { m_encryptedMessages . addComponent ( true , frm . frame ) ; delta += frm . delta ; } m_partialMessages . clear ( ) ; m_partialSize = 0 ; } } m_encryptedMessages . addComponent ( true , frame . frame ) ; delta += frame . delta ; m_numEncryptedMessages += frame . msgs ; added = true ; } return added ? delta : - 1 ; |
public class RangeStringParser { /** * Parses the threshold .
* @ param range
* The threshold to be parsed
* @ param tc
* The configuration
* @ throws RangeException */
public static void parse ( final String range , final RangeConfig tc ) throws RangeException { } } | if ( range == null ) { throw new RangeException ( "Range can't be null" ) ; } ROOT_STAGE . parse ( range , tc ) ; checkBoundaries ( tc ) ; |
public class StoreFactory { /** * Creates a fixed - length { @ link krati . store . ArrayStore ArrayStore } with the default parameters below .
* < pre >
* batchSize : 10000
* numSyncBatches : 10
* segmentCompactFactor : 0.5
* < / pre >
* @ param homeDir - the store home directory
* @ param length - the store length ( i . e . capacity ) which cannot be changed after the store is created
* @ param segmentFileSizeMB - the segment size in MB
* @ param segmentFactory - the segment factory
* @ return A fixed - length ArrayStore .
* @ throws Exception if the store cannot be created . */
public static ArrayStore createStaticArrayStore ( File homeDir , int length , int segmentFileSizeMB , SegmentFactory segmentFactory ) throws Exception { } } | int batchSize = StoreParams . BATCH_SIZE_DEFAULT ; int numSyncBatches = StoreParams . NUM_SYNC_BATCHES_DEFAULT ; double segmentCompactFactor = StoreParams . SEGMENT_COMPACT_FACTOR_DEFAULT ; return createStaticArrayStore ( homeDir , length , batchSize , numSyncBatches , segmentFileSizeMB , segmentFactory , segmentCompactFactor ) ; |
public class IOGroovyMethods { /** * Transforms the lines from a reader with a Closure and
* write them to a writer . Both Reader and Writer are
* closed after the operation .
* @ param reader Lines of text to be transformed . Reader is closed afterwards .
* @ param writer Where transformed lines are written . Writer is closed afterwards .
* @ param closure Single parameter closure that is called to transform each line of
* text from the reader , before writing it to the writer .
* @ throws IOException if an IOException occurs .
* @ since 1.0 */
public static void transformLine ( Reader reader , Writer writer , @ ClosureParams ( value = SimpleType . class , options = "java.lang.String" ) Closure closure ) throws IOException { } } | BufferedReader br = new BufferedReader ( reader ) ; BufferedWriter bw = new BufferedWriter ( writer ) ; String line ; try { while ( ( line = br . readLine ( ) ) != null ) { Object o = closure . call ( line ) ; if ( o != null ) { bw . write ( o . toString ( ) ) ; bw . newLine ( ) ; } } bw . flush ( ) ; Writer temp2 = writer ; writer = null ; temp2 . close ( ) ; Reader temp1 = reader ; reader = null ; temp1 . close ( ) ; } finally { closeWithWarning ( br ) ; closeWithWarning ( reader ) ; closeWithWarning ( bw ) ; closeWithWarning ( writer ) ; } |
public class VariableResponseProvider { /** * Creates a response for a variable of type { @ link ValueType # FILE } . */
protected Response responseForFileVariable ( FileValue fileValue ) { } } | String type = fileValue . getMimeType ( ) != null ? fileValue . getMimeType ( ) : MediaType . APPLICATION_OCTET_STREAM ; if ( fileValue . getEncoding ( ) != null ) { type += "; charset=" + fileValue . getEncoding ( ) ; } Object value = fileValue . getValue ( ) == null ? "" : fileValue . getValue ( ) ; return Response . ok ( value , type ) . header ( "Content-Disposition" , "attachment; filename=" + fileValue . getFilename ( ) ) . build ( ) ; |
public class CreateWebhookRequest { /** * An array of arrays of < code > WebhookFilter < / code > objects used to determine which webhooks are triggered . At least
* one < code > WebhookFilter < / code > in the array must specify < code > EVENT < / code > as its < code > type < / code > .
* For a build to be triggered , at least one filter group in the < code > filterGroups < / code > array must pass . For a
* filter group to pass , each of its filters must pass .
* @ param filterGroups
* An array of arrays of < code > WebhookFilter < / code > objects used to determine which webhooks are triggered .
* At least one < code > WebhookFilter < / code > in the array must specify < code > EVENT < / code > as its
* < code > type < / code > . < / p >
* For a build to be triggered , at least one filter group in the < code > filterGroups < / code > array must pass .
* For a filter group to pass , each of its filters must pass .
* @ return Returns a reference to this object so that method calls can be chained together . */
public CreateWebhookRequest withFilterGroups ( java . util . Collection < java . util . List < WebhookFilter > > filterGroups ) { } } | setFilterGroups ( filterGroups ) ; return this ; |
public class Initiator { /** * Invokes a read operation for the session < code > targetName < / code > and store the read bytes in the buffer
* < code > dst < / code > . Start reading at the logical block address and request < code > transferLength < / code > blocks .
* @ param targetName The name of the session to invoke this read operation .
* @ param dst The buffer to store the read data .
* @ param logicalBlockAddress The logical block address of the beginning .
* @ param transferLength Number of bytes to read .
* @ throws TaskExecutionException if execution fails
* @ throws NoSuchSessionException if session is not found */
public final void read ( final String targetName , final ByteBuffer dst , final int logicalBlockAddress , final long transferLength ) throws NoSuchSessionException , TaskExecutionException { } } | try { multiThreadedRead ( targetName , dst , logicalBlockAddress , transferLength ) . get ( ) ; } catch ( final InterruptedException exc ) { throw new TaskExecutionException ( exc ) ; } catch ( final ExecutionException exc ) { throw new TaskExecutionException ( exc ) ; } |
public class Parser { /** * Builds a parse tree from the given source string .
* @ return an { @ link AstRoot } object representing the parsed program . If
* the parse fails , { @ code null } will be returned . ( The parse failure will
* result in a call to the { @ link ErrorReporter } from
* { @ link CompilerEnvirons } . ) */
public AstRoot parse ( String sourceString , String sourceURI , int lineno ) { } } | if ( parseFinished ) throw new IllegalStateException ( "parser reused" ) ; this . sourceURI = sourceURI ; if ( compilerEnv . isIdeMode ( ) ) { this . sourceChars = sourceString . toCharArray ( ) ; } this . ts = new TokenStream ( this , null , sourceString , lineno ) ; try { return parse ( ) ; } catch ( IOException iox ) { // Should never happen
throw new IllegalStateException ( ) ; } finally { parseFinished = true ; } |
public class QueryParsers { /** * Get the parser for the supplied language .
* @ param language the language in which the query is expressed ; must case - insensitively match one of the supported
* { @ link # getLanguages ( ) languages }
* @ return the query parser , or null if the supplied language is not supported
* @ throws IllegalArgumentException if the language is null */
public QueryParser getParserFor ( String language ) { } } | CheckArg . isNotNull ( language , "language" ) ; return parsers . get ( language . trim ( ) . toLowerCase ( ) ) ; |
public class CharUtil { /** * belongs in number utils or charutil ? */
public long parseLong ( char [ ] arr , int start , int end ) { } } | long x = 0 ; boolean negative = arr [ start ] == '-' ; for ( int i = negative ? start + 1 : start ; i < end ; i ++ ) { // If constructing the largest negative number , this will overflow
// to the largest negative number . This is OK since the negation of
// the largest negative number is itself in two ' s complement .
x = x * 10 + ( arr [ i ] - '0' ) ; } // could replace conditional - move with multiplication of sign . . . not sure
// which is faster .
return negative ? - x : x ; |
public class MDAGNode { /** * 重新设置转移状态函数的目标
* Reassigns the target node of one of this node ' s outgoing transitions .
* @ param letter the char which labels the outgoing _ transition of interest
* @ param oldTargetNode the MDAGNode that is currently the target of the _ transition of interest
* @ param newTargetNode the MDAGNode that is to be the target of the _ transition of interest */
public void reassignOutgoingTransition ( char letter , MDAGNode oldTargetNode , MDAGNode newTargetNode ) { } } | oldTargetNode . incomingTransitionCount -- ; newTargetNode . incomingTransitionCount ++ ; outgoingTransitionTreeMap . put ( letter , newTargetNode ) ; |
public class CmsPublishList { /** * Gets the sub - resources of a list of folders which are missing from the publish list . < p >
* @ param cms the current CMS context
* @ param folders the folders which should be checked
* @ return a list of missing sub resources
* @ throws CmsException if something goes wrong */
protected List < CmsResource > getMissingSubResources ( CmsObject cms , List < CmsResource > folders ) throws CmsException { } } | List < CmsResource > result = new ArrayList < CmsResource > ( ) ; CmsObject rootCms = OpenCms . initCmsObject ( cms ) ; rootCms . getRequestContext ( ) . setSiteRoot ( "" ) ; for ( CmsResource folder : folders ) { List < CmsResource > subResources = rootCms . readResources ( folder . getRootPath ( ) , CmsResourceFilter . ALL , true ) ; for ( CmsResource resource : subResources ) { if ( ! containsResource ( resource ) ) { result . add ( resource ) ; } } } return result ; |
public class AdjustableNumberGenerator { /** * Change the value that is returned by this generator .
* @ param value The new value to return . */
public void setValue ( T value ) { } } | try { lock . writeLock ( ) . lock ( ) ; this . value = value ; } finally { lock . writeLock ( ) . unlock ( ) ; } |
public class JavaDoubleMultiplicationBenchmark { /** * Compute C = A * B */
private void mmuli ( int n , double [ ] A , double [ ] B , double [ ] C ) { } } | for ( int i = 0 ; i < n * n ; i ++ ) { C [ i ] = 0 ; } for ( int j = 0 ; j < n ; j ++ ) { int jn = j * n ; for ( int k = 0 ; k < n ; k ++ ) { int kn = k * n ; double bkjn = B [ k + jn ] ; for ( int i = 0 ; i < n ; i ++ ) { C [ i + jn ] += A [ i + kn ] * bkjn ; } } } |
public class ExtensionLoader { /** * 根据服务别名查找扩展类
* @ param alias 扩展别名
* @ return 扩展类对象 */
public ExtensionClass < T > getExtensionClass ( String alias ) { } } | return all == null ? null : all . get ( alias ) ; |
public class Discovery { /** * Update an environment .
* Updates an environment . The environment ' s * * name * * and * * description * * parameters can be changed . You must specify
* a * * name * * for the environment .
* @ param updateEnvironmentOptions the { @ link UpdateEnvironmentOptions } containing the options for the call
* @ return a { @ link ServiceCall } with a response type of { @ link Environment } */
public ServiceCall < Environment > updateEnvironment ( UpdateEnvironmentOptions updateEnvironmentOptions ) { } } | Validator . notNull ( updateEnvironmentOptions , "updateEnvironmentOptions cannot be null" ) ; String [ ] pathSegments = { "v1/environments" } ; String [ ] pathParameters = { updateEnvironmentOptions . environmentId ( ) } ; RequestBuilder builder = RequestBuilder . put ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "discovery" , "v1" , "updateEnvironment" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; if ( updateEnvironmentOptions . name ( ) != null ) { contentJson . addProperty ( "name" , updateEnvironmentOptions . name ( ) ) ; } if ( updateEnvironmentOptions . description ( ) != null ) { contentJson . addProperty ( "description" , updateEnvironmentOptions . description ( ) ) ; } if ( updateEnvironmentOptions . size ( ) != null ) { contentJson . addProperty ( "size" , updateEnvironmentOptions . size ( ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Environment . class ) ) ; |
public class Matrix3x2d { /** * Store this matrix as an equivalent 3x3 matrix in column - major order into the supplied { @ link DoubleBuffer } starting at the specified
* absolute buffer position / index .
* This method will not increment the position of the given DoubleBuffer .
* @ param index
* the absolute position into the DoubleBuffer
* @ param buffer
* will receive the values of this matrix in column - major order
* @ return the passed in buffer */
public DoubleBuffer get3x3 ( int index , DoubleBuffer buffer ) { } } | MemUtil . INSTANCE . put3x3 ( this , index , buffer ) ; return buffer ; |
public class Iteration { /** * Called internally to actually process the Iteration . Loops over the frames to iterate , and performs their . perform ( . . . ) or . otherwise ( . . . )
* parts . */
public void perform ( GraphRewrite event , EvaluationContext context ) { } } | Variables variables = Variables . instance ( event ) ; Iterable < ? extends WindupVertexFrame > frames = getSelectionManager ( ) . getFrames ( event , context ) ; boolean hasCommitOperation = OperationUtil . hasCommitOperation ( operationPerform ) || OperationUtil . hasCommitOperation ( operationOtherwise ) ; boolean hasIterationOperation = OperationUtil . hasIterationProgress ( operationPerform ) || OperationUtil . hasIterationProgress ( operationOtherwise ) ; DefaultOperationBuilder commit = new NoOp ( ) ; DefaultOperationBuilder iterationProgressOperation = new NoOp ( ) ; if ( ! hasCommitOperation || ! hasIterationOperation ) { int frameCount = Iterables . size ( frames ) ; if ( frameCount > 100 ) { if ( ! hasCommitOperation ) commit = Commit . every ( 1000 ) ; if ( ! hasIterationOperation ) { // Use 500 here as 100 might be noisy .
iterationProgressOperation = IterationProgress . monitoring ( "Rule Progress" , 500 ) ; } } } Operation commitAndProgress = commit . and ( iterationProgressOperation ) ; event . getRewriteContext ( ) . put ( DEFAULT_VARIABLE_LIST_STRING , frames ) ; // set the current frames
try { for ( WindupVertexFrame frame : frames ) try { variables . push ( ) ; getPayloadManager ( ) . setCurrentPayload ( variables , frame ) ; boolean conditionResult = true ; if ( condition != null ) { final String payloadVariableName = getPayloadVariableName ( event , context ) ; passInputVariableNameToConditionTree ( condition , payloadVariableName ) ; conditionResult = condition . evaluate ( event , context ) ; /* * Add special clear layer for perform , because condition used one and could have added new variables . The condition result put into
* variables is ignored . */
variables . push ( ) ; getPayloadManager ( ) . setCurrentPayload ( variables , frame ) ; } if ( conditionResult ) { if ( operationPerform != null ) { operationPerform . perform ( event , context ) ; } } else if ( condition != null ) { if ( operationOtherwise != null ) { operationOtherwise . perform ( event , context ) ; } } commitAndProgress . perform ( event , context ) ; getPayloadManager ( ) . removeCurrentPayload ( variables ) ; // remove the perform layer
variables . pop ( ) ; if ( condition != null ) { // remove the condition layer
variables . pop ( ) ; } } catch ( WindupStopException ex ) { throw new WindupStopException ( Util . WINDUP_BRAND_NAME_ACRONYM + " stop requested in " + this . toString ( ) , ex ) ; } catch ( Exception e ) { throw new WindupException ( "Failed when iterating " + frame . toPrettyString ( ) + ", due to: " + e . getMessage ( ) , e ) ; } } finally { event . getRewriteContext ( ) . put ( DEFAULT_VARIABLE_LIST_STRING , null ) ; } |
public class CadmiumCli { /** * The main entry point to Cadmium cli .
* @ param args */
public static void main ( String [ ] args ) { } } | try { jCommander = new JCommander ( ) ; jCommander . setProgramName ( "cadmium" ) ; HelpCommand helpCommand = new HelpCommand ( ) ; jCommander . addCommand ( "help" , helpCommand ) ; Map < String , CliCommand > commands = wireCommands ( jCommander ) ; try { jCommander . parse ( args ) ; } catch ( ParameterException pe ) { System . err . println ( pe . getMessage ( ) ) ; System . exit ( 1 ) ; } String commandName = jCommander . getParsedCommand ( ) ; if ( commandName == null ) { System . out . println ( "Please use one of the following commands:" ) ; for ( String command : jCommander . getCommands ( ) . keySet ( ) ) { String desc = jCommander . getCommands ( ) . get ( command ) . getObjects ( ) . get ( 0 ) . getClass ( ) . getAnnotation ( Parameters . class ) . commandDescription ( ) ; System . out . format ( " %16s -%s\n" , command , desc ) ; } } else if ( commandName . equals ( "help" ) ) { if ( helpCommand . subCommand == null || helpCommand . subCommand . size ( ) == 0 ) { jCommander . usage ( ) ; return ; } else { JCommander subCommander = jCommander . getCommands ( ) . get ( helpCommand . subCommand . get ( 0 ) ) ; if ( subCommander == null ) { System . out . println ( "Unknown sub command " + commandName ) ; return ; } subCommander . usage ( ) ; return ; } } else if ( commands . containsKey ( commandName ) ) { CliCommand command = commands . get ( commandName ) ; if ( command instanceof AuthorizedOnly ) { setupSsh ( ( ( AuthorizedOnly ) command ) . isAuthQuiet ( ) ) ; setupAuth ( ( AuthorizedOnly ) command ) ; } command . execute ( ) ; } } catch ( Exception e ) { System . err . println ( "Error: " + e . getMessage ( ) ) ; logger . debug ( "Cli Failed" , e ) ; e . printStackTrace ( ) ; System . exit ( 1 ) ; } |
public class Coercions { /** * Coerces the given value to the specified class . */
public static Object coerce ( Object pValue , Class pClass , Logger pLogger ) throws ELException { } } | if ( pClass == String . class ) { return coerceToString ( pValue , pLogger ) ; } else if ( isPrimitiveNumberClass ( pClass ) ) { return coerceToPrimitiveNumber ( pValue , pClass , pLogger ) ; } else if ( pClass == Character . class || pClass == Character . TYPE ) { return coerceToCharacter ( pValue , pLogger ) ; } else if ( pClass == Boolean . class || pClass == Boolean . TYPE ) { return coerceToBoolean ( pValue , pLogger ) ; } else { return coerceToObject ( pValue , pClass , pLogger ) ; } |
public class AnnotationClassRef { /** * / * ( non - Javadoc )
* @ see io . github . classgraph . ScanResultObject # setScanResult ( io . github . classgraph . ScanResult ) */
@ Override void setScanResult ( final ScanResult scanResult ) { } } | super . setScanResult ( scanResult ) ; if ( typeSignature != null ) { typeSignature . setScanResult ( scanResult ) ; } |
public class TransactionTopologyBuilder { /** * * * * * * build spout declarer * * * * * */
@ Override public SpoutDeclarer setSpout ( String id , IRichSpout spout , Number parallelismHint ) throws IllegalArgumentException { } } | return setSpout ( id , spout , parallelismHint , true ) ; |
public class GVRAndroidResource { /** * Save the stream position , for later use with { @ link # reset ( ) } .
* All { @ link GVRAndroidResource } streams support
* { @ link InputStream # mark ( int ) mark ( ) } and { @ link InputStream # reset ( )
* reset ( ) . } Calling { @ link # mark ( ) } right after construction will allow you
* to read the header then { @ linkplain # reset ( ) rewind the stream } if you
* can ' t handle the file format .
* @ throws IOException
* @ since 1.6.7 */
private void mark ( ) throws IOException { } } | if ( streamState == StreamStates . OPEN ) { if ( stream . markSupported ( ) ) { stream . mark ( Integer . MAX_VALUE ) ; } else { // In case a inputStream ( e . g . , fileInputStream ) doesn ' t support
// mark , throw a exception
throw new IOException ( "Input stream doesn't support mark" ) ; } } |
public class LeaderAppender { /** * Handles an append failure . */
protected void handleAppendResponseFailure ( MemberState member , AppendRequest request , Throwable error ) { } } | // Trigger commit futures if necessary .
updateHeartbeatTime ( member , error ) ; super . handleAppendResponseFailure ( member , request , error ) ; |
public class DetectModerationLabelsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DetectModerationLabelsRequest detectModerationLabelsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( detectModerationLabelsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( detectModerationLabelsRequest . getImage ( ) , IMAGE_BINDING ) ; protocolMarshaller . marshall ( detectModerationLabelsRequest . getMinConfidence ( ) , MINCONFIDENCE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Validate { /** * < p > Validate that the specified argument object fall between the two
* exclusive values specified ; otherwise , throws an exception . < / p >
* < pre > Validate . exclusiveBetween ( 0 , 2 , 1 ) ; < / pre >
* @ param < T > the type of the argument object
* @ param start the exclusive start value , not null
* @ param end the exclusive end value , not null
* @ param value the object to validate , not null
* @ throws IllegalArgumentException if the value falls outside the boundaries
* @ see # exclusiveBetween ( Object , Object , Comparable , String , Object . . . )
* @ since 3.0 */
public static < T > void exclusiveBetween ( final T start , final T end , final Comparable < T > value ) { } } | // TODO when breaking BC , consider returning value
if ( value . compareTo ( start ) <= 0 || value . compareTo ( end ) >= 0 ) { throw new IllegalArgumentException ( StringUtils . simpleFormat ( DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE , value , start , end ) ) ; } |
public class Popups { /** * Shows the supplied popup panel near the specified target . */
public static < T extends PopupPanel > T showAbove ( T popup , Widget target ) { } } | return show ( popup , Position . ABOVE , target ) ; |
public class RegxCriteria { /** * { @ inheritDoc } */
@ Override public boolean isSelected ( final Comparable < E > value , final boolean caseSensitive ) { } } | if ( pattern == null ) if ( caseSensitive ) this . pattern = Pattern . compile ( patternParm ) ; else this . pattern = Pattern . compile ( patternParm , Pattern . CASE_INSENSITIVE ) ; final Matcher m = pattern . matcher ( value . toString ( ) ) ; return m . matches ( ) ; |
public class AsynchronousRequest { /** * For more info on specializations API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / specializations " > here < / a > < br / >
* Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwable ) } methods for custom interactions
* @ param ids list of specialization id
* @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) }
* @ throws GuildWars2Exception empty ID list
* @ throws NullPointerException if given { @ link Callback } is empty
* @ see Specialization specialization info */
public void getSpecializationInfo ( int [ ] ids , Callback < List < Specialization > > callback ) throws GuildWars2Exception , NullPointerException { } } | isParamValid ( new ParamChecker ( ids ) ) ; gw2API . getSpecializationInfo ( processIds ( ids ) , GuildWars2 . lang . getValue ( ) ) . enqueue ( callback ) ; |
public class ListELResolver { /** * If the base object is a list , returns the value at the given index .
* The index is specified by the < code > property < / code > argument , and
* coerced into an integer . If the coercion could not be performed ,
* an < code > IllegalArgumentException < / code > is thrown . If the index is
* out of bounds , < code > null < / code > is returned .
* < p > If the base is a < code > List < / code > , the < code > propertyResolved < / code >
* property of the < code > ELContext < / code > object must be set to
* < code > true < / code > by this resolver , before returning . If this property
* is not < code > true < / code > after this method is called , the caller
* should ignore the return value . < / p >
* @ param context The context of this evaluation .
* @ param base The list to be analyzed . Only bases of type
* < code > List < / code > are handled by this resolver .
* @ param property The index of the value to be returned . Will be coerced
* into an integer .
* @ return If the < code > propertyResolved < / code > property of
* < code > ELContext < / code > was set to < code > true < / code > , then
* the value at the given index or < code > null < / code >
* if the index was out of bounds . Otherwise , undefined .
* @ throws IllegalArgumentException if the property could not be coerced
* into an integer .
* @ throws NullPointerException if context is < code > null < / code > .
* @ throws ELException if an exception was thrown while performing
* the property or variable resolution . The thrown exception
* must be included as the cause property of this exception , if
* available . */
public Object getValue ( ELContext context , Object base , Object property ) { } } | if ( context == null ) { throw new NullPointerException ( ) ; } if ( base != null && base instanceof List ) { context . setPropertyResolved ( base , property ) ; List list = ( List ) base ; int index = toInteger ( property ) ; if ( index < 0 || index >= list . size ( ) ) { return null ; } return list . get ( index ) ; } return null ; |
public class KnowledgeBuilderImpl { /** * Load a rule package from DRL source .
* @ throws DroolsParserException
* @ throws java . io . IOException */
public void addPackageFromDrl ( final Reader reader ) throws DroolsParserException , IOException { } } | addPackageFromDrl ( reader , new ReaderResource ( reader , ResourceType . DRL ) ) ; |
public class AbstractMapper { /** * / * ( non - Javadoc )
* @ see com . abubusoft . kripton . BinderMapper # parseCollection ( com . abubusoft . kripton . BinderContext , com . abubusoft . kripton . persistence . ParserWrapper , java . util . Collection ) */
@ Override public < L extends Collection < E > > L parseCollection ( BinderContext context , ParserWrapper parserWrapper , L collection ) throws Exception { } } | switch ( context . getSupportedFormat ( ) ) { case XML : { throw ( new KriptonRuntimeException ( context . getSupportedFormat ( ) + " context does not support direct collection persistance" ) ) ; } default : { JacksonWrapperParser wrapperParser = ( JacksonWrapperParser ) parserWrapper ; JsonParser parser = wrapperParser . jacksonParser ; try { collection . clear ( ) ; if ( parser . nextToken ( ) != JsonToken . START_ARRAY ) { throw ( new KriptonRuntimeException ( "Invalid input format" ) ) ; } if ( context . getSupportedFormat ( ) . onlyText ) { while ( parser . nextToken ( ) != JsonToken . END_ARRAY ) { collection . add ( parseOnJacksonAsString ( parser ) ) ; } } else { while ( parser . nextToken ( ) != JsonToken . END_ARRAY ) { collection . add ( parseOnJackson ( parser ) ) ; } } return collection ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw ( new KriptonRuntimeException ( e ) ) ; } } } |
public class RemovePreferenceHeaderDialogBuilder { /** * Initializes the dialog ' s buttons . */
private void initializeButtons ( ) { } } | setPositiveButton ( android . R . string . ok , createRemovePreferenceHeaderClickListener ( ) ) ; setNegativeButton ( android . R . string . cancel , null ) ; |
public class PropertiesReader { /** * Reads a collection of properties based on a prefix .
* @ param prefix The prefix for which to read properties .
* @ param factory The factory to call for each property name in the collection .
* @ param < T > The collection value type .
* @ return The collection . */
public < T > Collection < T > getCollection ( String prefix , Function < String , T > factory ) { } } | Collection < T > collection = new ArrayList < > ( ) ; for ( String property : properties . stringPropertyNames ( ) ) { if ( property . startsWith ( prefix + "." ) ) { collection . add ( factory . apply ( property ) ) ; } } return collection ; |
public class ReadaheadPool { /** * Submit a request to readahead on the given file descriptor .
* @ param identifier a textual identifier used in error messages , etc .
* @ param fd the file descriptor to readahead
* @ param off the offset at which to start the readahead
* @ param len the number of bytes to read
* @ return an object representing this pending request */
public ReadaheadRequest submitReadahead ( String identifier , FileDescriptor fd , long off , long len ) { } } | ReadaheadRequestImpl req = new ReadaheadRequestImpl ( identifier , fd , off , len ) ; pool . execute ( req ) ; if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "submit readahead: " + req ) ; } return req ; |
public class ComponentMaximiserMouseListener { /** * Convenience method that programmatically triggers the ( un ) maximisation logic .
* If a component is already maximised it ' s unmaximised , otherwise it is maximised the given { @ code component } . This is the
* same logic that ' s executed when a component is clicked twice , being the { @ code component } the source of the mouse event .
* The call to this method has no effect if there ' s no { @ code ComponentMaximiser } .
* @ param component the component that will be maximised , if none is maximised already
* @ throws IllegalArgumentException if the given { @ code component } is { @ code null } and there ' s no component maximised .
* @ see # setComponentMaximiser ( ComponentMaximiser ) */
public void triggerMaximisation ( Component component ) { } } | if ( componentMaximiser == null ) { return ; } if ( componentMaximiser . isComponentMaximised ( ) ) { componentMaximiser . unmaximiseComponent ( ) ; } else if ( confirmMaximisation ( ) ) { componentMaximiser . maximiseComponent ( component ) ; } |
public class SystemStatus { /** * Load average in the last 1 - minute , 5 - minute , and 15 - minute periods . For more information , see < a href =
* " https : / / docs . aws . amazon . com / elasticbeanstalk / latest / dg / health - enhanced - metrics . html # health - enhanced - metrics - os "
* > Operating System Metrics < / a > .
* @ return Load average in the last 1 - minute , 5 - minute , and 15 - minute periods . For more information , see < a href =
* " https : / / docs . aws . amazon . com / elasticbeanstalk / latest / dg / health - enhanced - metrics . html # health - enhanced - metrics - os "
* > Operating System Metrics < / a > . */
public java . util . List < Double > getLoadAverage ( ) { } } | if ( loadAverage == null ) { loadAverage = new com . amazonaws . internal . SdkInternalList < Double > ( ) ; } return loadAverage ; |
public class ParseDuration { /** * { @ inheritDoc }
* @ throws SuperCsvCellProcessorException
* if value is null or is not a String */
public Object execute ( final Object value , final CsvContext context ) { } } | validateInputNotNull ( value , context ) ; if ( ! ( value instanceof String ) ) { throw new SuperCsvCellProcessorException ( String . class , value , context , this ) ; } final Duration result ; try { result = Duration . parse ( ( String ) value ) ; } catch ( IllegalArgumentException e ) { throw new SuperCsvCellProcessorException ( "Failed to parse value as a Duration" , context , this , e ) ; } return next . execute ( result , context ) ; |
public class SelfRegisteringRemote { /** * Adding the browser described by the capability , automatically finding out what platform the
* node is launched from
* @ param cap describing the browser
* @ param instances number of times this browser can be started on the node . */
public void addBrowser ( DesiredCapabilities cap , int instances ) { } } | String s = cap . getBrowserName ( ) ; if ( s == null || "" . equals ( s ) ) { throw new InvalidParameterException ( cap + " does seems to be a valid browser." ) ; } if ( cap . getPlatform ( ) == null ) { cap . setPlatform ( Platform . getCurrent ( ) ) ; } cap . setCapability ( RegistrationRequest . MAX_INSTANCES , instances ) ; registrationRequest . getConfiguration ( ) . capabilities . add ( cap ) ; registrationRequest . getConfiguration ( ) . fixUpCapabilities ( ) ; |
public class CommerceOrderPersistenceImpl { /** * Removes all the commerce orders where userId = & # 63 ; from the database .
* @ param userId the user ID */
@ Override public void removeByUserId ( long userId ) { } } | for ( CommerceOrder commerceOrder : findByUserId ( userId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( commerceOrder ) ; } |
public class RestClientOptions { /** * Set global headers which will be appended to every HTTP request .
* The headers defined per request will override this headers .
* @ param headers The headers to add
* @ return a reference to this so multiple method calls can be chained together */
public RestClientOptions putGlobalHeaders ( MultiMap headers ) { } } | for ( Map . Entry < String , String > header : headers ) { globalHeaders . add ( header . getKey ( ) , header . getValue ( ) ) ; } return this ; |
public class Model { /** * Sets the value for the threshold of the gauge
* @ param THRESHOLD */
public void setThreshold ( final double THRESHOLD ) { } } | if ( Double . compare ( THRESHOLD , minValue ) >= 0 && Double . compare ( THRESHOLD , maxValue ) <= 0 ) { threshold = THRESHOLD ; } else { if ( THRESHOLD < niceMinValue ) { threshold = niceMinValue ; } if ( THRESHOLD > niceMaxValue ) { threshold = niceMaxValue ; } } fireStateChanged ( ) ; |
public class PersistenceHandler { /** * ( non - Javadoc )
* @ see io . ddf . content . IHandlePersistence # copy ( java . lang . String , java . lang . String , java . lang . String ,
* java . lang . String , boolean ) */
@ Override public void duplicate ( String fromNamespace , String fromName , String toNamespace , String toName , boolean doOverwrite ) throws DDFException { } } | IPersistible from = this . load ( fromNamespace , fromName ) ; if ( from instanceof DDF ) { DDF to = ( DDF ) from ; // to . setNamespace ( toNamespace ) ;
to . getManager ( ) . setDDFName ( to , toName ) ; to . persist ( ) ; } else { throw new DDFException ( "Can only duplicate DDFs" ) ; } |
public class VersionManager { /** * Request version information from a given JID .
* @ param jid
* @ return the version information or { @ code null } if not supported by JID
* @ throws NoResponseException
* @ throws XMPPErrorException
* @ throws NotConnectedException
* @ throws InterruptedException */
public Version getVersion ( Jid jid ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } } | if ( ! isSupported ( jid ) ) { return null ; } return connection ( ) . createStanzaCollectorAndSend ( new Version ( jid ) ) . nextResultOrThrow ( ) ; |
public class HintedHandoff { /** * A callback that handles requestComplete event from NIO selector manager
* Will try any possible nodes and pass itself as callback util all nodes
* are exhausted
* @ param slopKey
* @ param slopVersioned
* @ param nodesToTry List of nodes to try to contact . Will become shorter
* after each callback */
private void sendOneAsyncHint ( final ByteArray slopKey , final Versioned < byte [ ] > slopVersioned , final List < Node > nodesToTry ) { } } | Node nodeToHostHint = null ; boolean foundNode = false ; while ( nodesToTry . size ( ) > 0 ) { nodeToHostHint = nodesToTry . remove ( 0 ) ; if ( ! failedNodes . contains ( nodeToHostHint ) && failureDetector . isAvailable ( nodeToHostHint ) ) { foundNode = true ; break ; } } if ( ! foundNode ) { Slop slop = slopSerializer . toObject ( slopVersioned . getValue ( ) ) ; logger . error ( "Trying to send an async hint but used up all nodes. key: " + slop . getKey ( ) + " version: " + slopVersioned . getVersion ( ) . toString ( ) ) ; return ; } final Node node = nodeToHostHint ; int nodeId = node . getId ( ) ; NonblockingStore nonblockingStore = nonblockingSlopStores . get ( nodeId ) ; Utils . notNull ( nonblockingStore ) ; final Long startNs = System . nanoTime ( ) ; NonblockingStoreCallback callback = new NonblockingStoreCallback ( ) { @ Override public void requestComplete ( Object result , long requestTime ) { Slop slop = null ; boolean loggerDebugEnabled = logger . isDebugEnabled ( ) ; if ( loggerDebugEnabled ) { slop = slopSerializer . toObject ( slopVersioned . getValue ( ) ) ; } Response < ByteArray , Object > response = new Response < ByteArray , Object > ( node , slopKey , result , requestTime ) ; if ( response . getValue ( ) instanceof Exception && ! ( response . getValue ( ) instanceof ObsoleteVersionException ) ) { if ( ! failedNodes . contains ( node ) ) failedNodes . add ( node ) ; if ( response . getValue ( ) instanceof UnreachableStoreException ) { UnreachableStoreException use = ( UnreachableStoreException ) response . getValue ( ) ; if ( loggerDebugEnabled ) { logger . debug ( "Write of key " + slop . getKey ( ) + " for " + slop . getNodeId ( ) + " to node " + node + " failed due to unreachable: " + use . getMessage ( ) ) ; } failureDetector . recordException ( node , ( System . nanoTime ( ) - startNs ) / Time . NS_PER_MS , use ) ; } sendOneAsyncHint ( slopKey , slopVersioned , nodesToTry ) ; } if ( loggerDebugEnabled ) logger . debug ( "Slop write of key " + slop . getKey ( ) + " for node " + slop . getNodeId ( ) + " to node " + node + " succeeded in " + ( System . nanoTime ( ) - startNs ) + " ns" ) ; failureDetector . recordSuccess ( node , ( System . nanoTime ( ) - startNs ) / Time . NS_PER_MS ) ; } } ; nonblockingStore . submitPutRequest ( slopKey , slopVersioned , null , callback , timeoutMs ) ; |
public class UserScreenRecord { /** * Add this field in the Record ' s field sequence . */
public BaseField setupField ( int iFieldSeq ) { } } | BaseField field = null ; if ( iFieldSeq == 0 ) field = new StringField ( this , NAME_SORT , 10 , null , null ) ; if ( iFieldSeq == 1 ) field = new UserGroupFilter ( this , USER_GROUP_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 2 ) field = new StringField ( this , HEADER_TYPE , 30 , null , null ) ; if ( iFieldSeq == 3 ) field = new StringField ( this , USER , 50 , null , null ) ; if ( iFieldSeq == 4 ) field = new PasswordField ( this , PASSWORD , 80 , null , null ) ; if ( iFieldSeq == 5 ) field = new BooleanField ( this , SAVEUSER , Constants . DEFAULT_FIELD_LENGTH , null , new Boolean ( true ) ) ; if ( iFieldSeq == 6 ) field = new StringField ( this , STATUS_LINE , 60 , null , null ) ; if ( iFieldSeq == 7 ) { field = new PasswordField ( this , CURRENT_PASSWORD , 80 , null , null ) ; field . setMinimumLength ( 6 ) ; } if ( iFieldSeq == 8 ) { field = new PasswordField ( this , NEW_PASSWORD_1 , 80 , null , null ) ; field . setMinimumLength ( 6 ) ; } if ( iFieldSeq == 9 ) { field = new PasswordField ( this , NEW_PASSWORD_2 , 80 , null , null ) ; field . setMinimumLength ( 6 ) ; } if ( iFieldSeq == 10 ) field = new HtmlField ( this , TERMS , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( field == null ) field = super . setupField ( iFieldSeq ) ; return field ; |
public class FileUtil { /** * Change the permissions on a filename .
* @ param filename the name of the file to change
* @ param perm the permission string
* @ return the exit code from the command
* @ throws IOException
* @ throws InterruptedException */
public static int chmod ( String filename , String perm ) throws IOException , InterruptedException { } } | return chmod ( filename , perm , false ) ; |
public class OjbTagsHandler { /** * Processes the template if the property value of the current object on the specified level equals the given value .
* @ param template The template
* @ param attributes The attributes of the tag
* @ exception XDocletException If an error occurs
* @ doc . tag type = " block "
* @ doc . param name = " level " optional = " false " description = " The level for the current object "
* values = " class , field , reference , collection "
* @ doc . param name = " name " optional = " false " description = " The name of the property "
* @ doc . param name = " value " optional = " false " description = " The value to check for "
* @ doc . param name = " default " optional = " true " description = " A default value to use if the property
* is not defined " */
public void ifPropertyValueEquals ( String template , Properties attributes ) throws XDocletException { } } | String value = getPropertyValue ( attributes . getProperty ( ATTRIBUTE_LEVEL ) , attributes . getProperty ( ATTRIBUTE_NAME ) ) ; String expected = attributes . getProperty ( ATTRIBUTE_VALUE ) ; if ( value == null ) { value = attributes . getProperty ( ATTRIBUTE_DEFAULT ) ; } if ( expected . equals ( value ) ) { generate ( template ) ; } |
public class SnapshotCodecProvider { /** * Retrieve the current snapshot codec , that is , the codec with the highest known version .
* @ return the current codec
* @ throws java . lang . IllegalStateException if no codecs are registered */
private SnapshotCodec getCurrentCodec ( ) { } } | if ( codecs . isEmpty ( ) ) { throw new IllegalStateException ( String . format ( "No codecs are registered." ) ) ; } return codecs . get ( codecs . lastKey ( ) ) ; |
public class DashboardServiceImpl { /** * Get all the dashboards that have the collector items
* @ param collectorItems collector items
* @ param collectorType type of the collector
* @ return a list of dashboards */
@ Override public List < Dashboard > getDashboardsByCollectorItems ( Set < CollectorItem > collectorItems , CollectorType collectorType ) { } } | if ( org . apache . commons . collections4 . CollectionUtils . isEmpty ( collectorItems ) ) { return new ArrayList < > ( ) ; } List < ObjectId > collectorItemIds = collectorItems . stream ( ) . map ( BaseModel :: getId ) . collect ( Collectors . toList ( ) ) ; // Find the components that have these collector items
List < com . capitalone . dashboard . model . Component > components = componentRepository . findByCollectorTypeAndItemIdIn ( collectorType , collectorItemIds ) ; List < ObjectId > componentIds = components . stream ( ) . map ( BaseModel :: getId ) . collect ( Collectors . toList ( ) ) ; return dashboardRepository . findByApplicationComponentIdsIn ( componentIds ) ; |
public class CommerceTaxFixedRatePersistenceImpl { /** * Clears the cache for all commerce tax fixed rates .
* The { @ link EntityCache } and { @ link FinderCache } are both cleared by this method . */
@ Override public void clearCache ( ) { } } | entityCache . clearCache ( CommerceTaxFixedRateImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; |
public class XMLSerializer { /** * { @ inheritDoc } */
@ Override protected void emitEndDocument ( ) { } } | try { if ( mSerializeRest ) { write ( "</rest:item></rest:sequence>" ) ; } mOut . flush ( ) ; } catch ( final IOException exc ) { exc . printStackTrace ( ) ; } |
public class ExtendedBitOutput { public static int writeAscii ( final BitOutput bitOutput , final int lengthSize , final String value ) throws IOException { } } | return writeBytes ( bitOutput , lengthSize , true , 7 , value . getBytes ( "ASCII" ) ) ; |
public class Docket { /** * Directly substitutes a model class with the supplied substitute
* e . g
* < code > directModelSubstitute ( LocalDate . class , Date . class ) < / code >
* would substitute LocalDate with Date
* @ param clazz class to substitute
* @ param with the class which substitutes ' clazz '
* @ return this Docket */
public Docket directModelSubstitute ( final Class clazz , final Class with ) { } } | this . ruleBuilders . add ( newSubstitutionFunction ( clazz , with ) ) ; return this ; |
public class Logger { /** * Logs message log level has been set at least to { @ link LogLevel # ERROR } .
* @ param msg Message to be logged */
public void e ( final String msg ) { } } | logMgr . log ( tag , LogLevelConst . ERROR , msg , null ) ; |
public class DefaultVOMSTrustStore { /** * Loads all the certificates in the local directory . Only files with the
* extension matching the { @ link # CERTIFICATE _ FILENAME _ PATTERN } are
* considered .
* @ param directory */
private void loadCertificatesFromDirectory ( File directory ) { } } | directorySanityChecks ( directory ) ; synchronized ( listenerLock ) { listener . notifyCertficateLookupEvent ( directory . getAbsolutePath ( ) ) ; } File [ ] certFiles = directory . listFiles ( new FilenameFilter ( ) { public boolean accept ( File dir , String name ) { return name . endsWith ( CERTIFICATE_FILENAME_SUFFIX ) ; } } ) ; for ( File f : certFiles ) loadCertificateFromFile ( f ) ; |
public class Timestamp { /** * Applies the local time zone offset from UTC to the applicable time field
* values . Depending on the local time zone offset , adjustments
* ( i . e . rollover ) will be made to the Year , Day , Hour , Minute time field
* values .
* @ param offset the local offset , in minutes from UTC . */
private void apply_offset ( int offset ) { } } | if ( offset == 0 ) return ; if ( offset < - 24 * 60 || offset > 24 * 60 ) { throw new IllegalArgumentException ( "bad offset " + offset ) ; } // To convert _ to _ UTC you must SUBTRACT the local offset
offset = - offset ; int hour_offset = offset / 60 ; int min_offset = offset - ( hour_offset * 60 ) ; if ( offset < 0 ) { _minute += min_offset ; // lower the minute value by adding a negative offset
_hour += hour_offset ; if ( _minute < 0 ) { _minute += 60 ; _hour -= 1 ; } if ( _hour >= 0 ) return ; // hour is 0-23
_hour += 24 ; _day -= 1 ; if ( _day >= 1 ) return ; // day is 1-31
// we can ' t do this until we ' ve figured out the month and year : _ day + = last _ day _ in _ month ( _ year , _ month ) ;
_month -= 1 ; if ( _month >= 1 ) { _day += last_day_in_month ( _year , _month ) ; // now we know ( when the year doesn ' t change
assert ( _day == last_day_in_month ( _year , _month ) ) ; return ; // 1-12
} _month += 12 ; _year -= 1 ; if ( _year < 1 ) throw new IllegalArgumentException ( "year is less than 1" ) ; _day += last_day_in_month ( _year , _month ) ; // and now we know , even if the year did change
assert ( _day == last_day_in_month ( _year , _month ) ) ; } else { _minute += min_offset ; // lower the minute value by adding a negative offset
_hour += hour_offset ; if ( _minute > 59 ) { _minute -= 60 ; _hour += 1 ; } if ( _hour < 24 ) return ; // hour is 0-23
_hour -= 24 ; _day += 1 ; if ( _day <= last_day_in_month ( _year , _month ) ) return ; // day is 1-31
// we can ' t do this until we figure out the final month and year : _ day - = last _ day _ in _ month ( _ year , _ month ) ;
_day = 1 ; // this is always the case
_month += 1 ; if ( _month <= 12 ) { return ; // 1-12
} _month -= 12 ; _year += 1 ; if ( _year > 9999 ) throw new IllegalArgumentException ( "year exceeds 9999" ) ; } |
public class PTD1Impl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . PTD1__XPBASE : return getXPBASE ( ) ; case AfplibPackage . PTD1__YPBASE : return getYPBASE ( ) ; case AfplibPackage . PTD1__XPUNITVL : return getXPUNITVL ( ) ; case AfplibPackage . PTD1__YPUNITVL : return getYPUNITVL ( ) ; case AfplibPackage . PTD1__XPEXTENT : return getXPEXTENT ( ) ; case AfplibPackage . PTD1__YPEXTENT : return getYPEXTENT ( ) ; case AfplibPackage . PTD1__RESERVED : return getRESERVED ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class SQLUtils { /** * Update table rows
* @ param connection
* connection
* @ param table
* table name
* @ param values
* content values
* @ param whereClause
* where clause
* @ param whereArgs
* where arguments
* @ return updated count */
public static int update ( Connection connection , String table , ContentValues values , String whereClause , String [ ] whereArgs ) { } } | StringBuilder update = new StringBuilder ( ) ; update . append ( "update " ) . append ( CoreSQLUtils . quoteWrap ( table ) ) . append ( " set " ) ; int setValuesSize = values . size ( ) ; int argsSize = ( whereArgs == null ) ? setValuesSize : ( setValuesSize + whereArgs . length ) ; Object [ ] args = new Object [ argsSize ] ; int i = 0 ; for ( String colName : values . keySet ( ) ) { update . append ( ( i > 0 ) ? "," : "" ) ; update . append ( CoreSQLUtils . quoteWrap ( colName ) ) ; args [ i ++ ] = values . get ( colName ) ; update . append ( "=?" ) ; } if ( whereArgs != null ) { for ( i = setValuesSize ; i < argsSize ; i ++ ) { args [ i ] = whereArgs [ i - setValuesSize ] ; } } if ( whereClause != null ) { update . append ( " WHERE " ) ; update . append ( whereClause ) ; } String sql = update . toString ( ) ; PreparedStatement statement = null ; int count = 0 ; try { statement = connection . prepareStatement ( sql ) ; setArguments ( statement , args ) ; count = statement . executeUpdate ( ) ; } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to execute SQL update statement: " + sql , e ) ; } finally { closeStatement ( statement , sql ) ; } return count ; |
public class UpdateRunner { /** * Run the processing queue now . This should usually be only invoked by the
* UpdateSynchronizer */
public void runQueue ( ) { } } | synchronized ( sync ) { while ( ! queue . isEmpty ( ) ) { Runnable r = queue . poll ( ) ; if ( r != null ) { try { r . run ( ) ; } catch ( Exception e ) { // Alternatively , we could allow the specification of exception
// handlers for each runnable in the API . For now we ' ll just log .
// TODO : handle exceptions here better !
LoggingUtil . exception ( e ) ; } } else { LoggingUtil . warning ( "Tried to run a 'null' Object." ) ; } } } |
public class ConvertKit { /** * string转inputStream按编码
* @ param string 字符串
* @ param charsetName 编码格式
* @ return 输入流 */
public static InputStream string2InputStream ( final String string , final String charsetName ) { } } | if ( string == null || isSpace ( charsetName ) ) return null ; try { return new ByteArrayInputStream ( string . getBytes ( charsetName ) ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; return null ; } |
public class SubscriptionRegistrar { /** * Method isKnownNonSelectorExpression
* Checks whether a consumer without a selector has already been registered on the
* specified topicexpression
* @ param topicExpression
* @ param isWildcarded
* @ return */
public boolean isKnownNonSelectorExpression ( String topicExpression , boolean isWildcarded ) { } } | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isKnownNonSelectorExpression" , new Object [ ] { topicExpression , new Boolean ( isWildcarded ) } ) ; boolean isCategorised = false ; // No Selector expression
if ( isWildcarded ) { // No selector and wildcarded
isCategorised = _wildcardNonSelectorSubs . containsKey ( topicExpression ) ; } else { // No selector and not wildcarded
isCategorised = _exactNonSelectorSubs . containsKey ( topicExpression ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isKnownNonSelectorExpression" , new Boolean ( isCategorised ) ) ; return isCategorised ; |
public class Empty { /** * { @ inheritDoc } */
public ByteCodeElement . Token . TokenList < ParameterDescription . Token > asTokenList ( ElementMatcher < ? super TypeDescription > matcher ) { } } | return new ByteCodeElement . Token . TokenList < ParameterDescription . Token > ( ) ; |
public class ViewPagerEx { /** * You can call this function yourself to have the scroll view perform
* scrolling from a key event , just as if the event had been dispatched to
* it by the view hierarchy .
* @ param event The key event to execute .
* @ return Return true if the event was handled , else false . */
public boolean executeKeyEvent ( KeyEvent event ) { } } | boolean handled = false ; if ( event . getAction ( ) == KeyEvent . ACTION_DOWN ) { switch ( event . getKeyCode ( ) ) { case KeyEvent . KEYCODE_DPAD_LEFT : handled = arrowScroll ( FOCUS_LEFT ) ; break ; case KeyEvent . KEYCODE_DPAD_RIGHT : handled = arrowScroll ( FOCUS_RIGHT ) ; break ; case KeyEvent . KEYCODE_TAB : if ( Build . VERSION . SDK_INT >= 11 ) { // The focus finder had a bug handling FOCUS _ FORWARD and FOCUS _ BACKWARD
// before Android 3.0 . Ignore the tab key on those devices .
if ( KeyEventCompat . hasNoModifiers ( event ) ) { handled = arrowScroll ( FOCUS_FORWARD ) ; } else if ( KeyEventCompat . hasModifiers ( event , KeyEvent . META_SHIFT_ON ) ) { handled = arrowScroll ( FOCUS_BACKWARD ) ; } } break ; } } return handled ; |
public class Cnf { /** * Return refactored conjunction formed by removing superfluous terms . */
public static IConjunct refactor ( IConjunct conjunct ) { } } | // Is there a single assertion term ?
Iterator < IDisjunct > disjuncts = conjunct . getDisjuncts ( ) ; IAssertion assertion = null ; while ( disjuncts . hasNext ( ) && ( assertion = toAssertion ( disjuncts . next ( ) ) ) == null ) ; return assertion == null // No , return original conjunction
? conjunct // Yes , return refactored conjunction
: simplify ( new Conjunction ( assertion ) . append ( refactor ( remainder ( conjunct , assertion ) ) ) ) ; |
public class ProcessInitiator { /** * Starts RTS process .
* @ throws IOException */
public void startRTS ( ) throws IOException { } } | List < HubDataSource > dataSources = hubDataStore . getHubDataSources ( ) ; List < String > com = Lists . newArrayList ( ) ; com . add ( getHostPort ( hubDataStore . getHubAddress ( ) ) ) ; com . add ( hubDataStore . getInstanceName ( ) ) ; for ( HubDataSource source : dataSources ) { com . add ( source . getName ( ) ) ; } ExternalProgramExecutor executorService = new ExternalProgramExecutor ( "RTS" , new File ( binLocation , "rts" ) , com . toArray ( new String [ com . size ( ) ] ) ) ; rtsExecutor . add ( executorService ) ; LOG . info ( "Starting RTS : {}" , executorService ) ; executorService . startAndWait ( ) ; |
public class IOUtils { /** * write file
* @ param file the file to be opened for writing .
* @ param stream the input stream
* @ param append if < code > true < / code > , then bytes will be written to the end of the file rather than the beginning
* @ return return true
* @ throws IOException if an error occurs while operator FileOutputStream */
public static boolean writeStream ( File file , InputStream stream , boolean append ) throws IOException { } } | OutputStream o = null ; try { makeDirs ( file . getAbsolutePath ( ) ) ; o = new FileOutputStream ( file , append ) ; byte data [ ] = new byte [ 1024 ] ; int length = - 1 ; while ( ( length = stream . read ( data ) ) != - 1 ) { o . write ( data , 0 , length ) ; } o . flush ( ) ; return true ; } finally { closeQuietly ( o ) ; closeQuietly ( stream ) ; } |
public class JvmAnyTypeReferenceImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case TypesPackage . JVM_ANY_TYPE_REFERENCE__TYPE : if ( resolve ) return getType ( ) ; return basicGetType ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class Functions { /** * Increases the opacity of the given color by the given amount .
* @ param generator the surrounding generator
* @ param input the function call to evaluate
* @ return the result of the evaluation */
public static Expression opacify ( Generator generator , FunctionCall input ) { } } | Color color = input . getExpectedColorParam ( 0 ) ; float amount = input . getExpectedFloatParam ( 1 ) ; return new Color ( color . getR ( ) , color . getG ( ) , color . getB ( ) , color . getA ( ) + amount ) ; |
public class TypeReferences { /** * / * @ NotNull */
public JvmTypeReference getTypeForName ( Class < ? > clazz , Notifier context , JvmTypeReference ... params ) { } } | if ( clazz == null ) throw new NullPointerException ( "clazz" ) ; JvmType declaredType = findDeclaredType ( clazz , context ) ; if ( declaredType == null ) return getUnknownTypeReference ( clazz . getName ( ) ) ; JvmParameterizedTypeReference result = createTypeRef ( declaredType , params ) ; return result ; |
public class WRadioButton { /** * This method will only process the request if the value for the group matches the button ' s value .
* @ param request the request being processed . */
@ Override public void handleRequest ( final Request request ) { } } | // Protect against client - side tampering of disabled / read - only fields .
if ( isDisabled ( ) || isReadOnly ( ) ) { return ; } RadioButtonGroup currentGroup = getGroup ( ) ; // Check if the group is not on the request ( do nothing )
if ( ! currentGroup . isPresent ( request ) ) { return ; } // Check if the group has a null value ( will be handled by the group handle request )
if ( request . getParameter ( currentGroup . getId ( ) ) == null ) { return ; } // Get the groups value on the request
String requestValue = currentGroup . getRequestValue ( request ) ; // Check if this button ' s value matches the request
boolean onRequest = Util . equals ( requestValue , getValue ( ) ) ; if ( onRequest ) { boolean changed = currentGroup . handleButtonOnRequest ( request ) ; if ( changed && ( UIContextHolder . getCurrent ( ) != null ) && ( UIContextHolder . getCurrent ( ) . getFocussed ( ) == null ) && currentGroup . isCurrentAjaxTrigger ( ) ) { setFocussed ( ) ; } } |
public class ListUserPoolsResult { /** * The user pools from the response to list users .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setUserPools ( java . util . Collection ) } or { @ link # withUserPools ( java . util . Collection ) } if you want to
* override the existing values .
* @ param userPools
* The user pools from the response to list users .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListUserPoolsResult withUserPools ( UserPoolDescriptionType ... userPools ) { } } | if ( this . userPools == null ) { setUserPools ( new java . util . ArrayList < UserPoolDescriptionType > ( userPools . length ) ) ; } for ( UserPoolDescriptionType ele : userPools ) { this . userPools . add ( ele ) ; } return this ; |
public class Tensor { /** * Returns an integer array of the same length as dims that matches the configIx ' th configuration
* if enumerated configurations in order such that the leftmost dimension changes slowest */
public static int [ ] unravelIndex ( int configIx , int ... dims ) { } } | int numConfigs = IntArrays . prod ( dims ) ; assert configIx < numConfigs ; int [ ] strides = getStrides ( dims ) ; return unravelIndexFromStrides ( configIx , strides ) ; |
public class RuleDefinitionFileConstant { /** * Get SQL statement rule definition file name .
* @ param rootDir root dir
* @ param databaseType database type
* @ return SQL statement rule definition file name */
public static String getSQLStatementRuleDefinitionFileName ( final String rootDir , final DatabaseType databaseType ) { } } | return Joiner . on ( '/' ) . join ( rootDir , databaseType . name ( ) . toLowerCase ( ) , SQL_STATEMENT_RULE_DEFINITION_FILE_NAME ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.