signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Buffer { /** * Copies all bytes .
* @ return number of bytes actually copied */
public long copy ( InputStream in , Node dest ) throws IOException { } } | long result ; try ( OutputStream out = dest . newOutputStream ( ) ) { result = copy ( in , out ) ; } return result ; |
public class TransformDataSourceMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TransformDataSource transformDataSource , ProtocolMarshaller protocolMarshaller ) { } } | if ( transformDataSource == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( transformDataSource . getS3DataSource ( ) , S3DATASOURCE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MavenLoggerFactory { /** * Provide the Log implementation to this factory . It is usually done with { @ link org . apache . maven . plugin . Mojo # getLog ( ) } .
* @ param innerLogger */
public static void registerMavenLogger ( Log innerLogger ) { } } | if ( INSTANCE == null ) { INSTANCE = new MavenLoggerFactory ( innerLogger ) ; } if ( INSTANCE . innerLogger != innerLogger ) { throw new IllegalArgumentException ( "You've previously register a org.apache.maven.plugin.logging.Log that is NOT the one that you're passing !" ) ; } |
public class AWSIotClient { /** * Cancels the execution of a job for a given thing .
* @ param cancelJobExecutionRequest
* @ return Result of the CancelJobExecution operation returned by the service .
* @ throws InvalidRequestException
* The request is not valid .
* @ throws InvalidStateTransitionException
* An attempt was made to change to an invalid state , for example by deleting a job or a job execution which
* is " IN _ PROGRESS " without setting the < code > force < / code > parameter .
* @ throws ResourceNotFoundException
* The specified resource does not exist .
* @ throws ThrottlingException
* The rate exceeds the limit .
* @ throws ServiceUnavailableException
* The service is temporarily unavailable .
* @ throws VersionConflictException
* An exception thrown when the version of an entity specified with the < code > expectedVersion < / code >
* parameter does not match the latest version in the system .
* @ sample AWSIot . CancelJobExecution */
@ Override public CancelJobExecutionResult cancelJobExecution ( CancelJobExecutionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeCancelJobExecution ( request ) ; |
public class ObjectProxy { /** * { @ inheritDoc } */
@ Override @ SuppressWarnings ( "unchecked" ) public void readExternal ( IDataInput input ) { } } | item = ( Map < T , V > ) input . readObject ( ) ; |
public class JMXOverRMIServerSocketFactory { /** * Cleanup sockets created by this factory */
public void close ( ) { } } | if ( ! manageSockets ) throw new IllegalStateException ( "Cannot close an un-managed socket factory" ) ; synchronized ( createdSockets ) { Iterator < ServerSocket > sockets = createdSockets . iterator ( ) ; while ( sockets . hasNext ( ) ) { ServerSocket socket = sockets . next ( ) ; try { socket . close ( ) ; } catch ( Exception e ) { log . error ( "Could not close server socket" , e ) ; } } createdSockets . clear ( ) ; } |
public class NodeFocusFinder { /** * Perform in - order navigation from a given node in a particular direction .
* @ param node The starting node .
* @ param direction The direction to travel .
* @ return The next node in the specified direction , or { @ code null } if
* there are no more nodes . */
public static AccessibilityNodeInfoCompat focusSearch ( AccessibilityNodeInfoCompat node , int direction ) { } } | final AccessibilityNodeInfoRef ref = AccessibilityNodeInfoRef . unOwned ( node ) ; switch ( direction ) { case SEARCH_FORWARD : { if ( ! ref . nextInOrder ( ) ) { return null ; } return ref . release ( ) ; } case SEARCH_BACKWARD : { if ( ! ref . previousInOrder ( ) ) { return null ; } return ref . release ( ) ; } } return null ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcPlane ( ) { } } | if ( ifcPlaneEClass == null ) { ifcPlaneEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 427 ) ; } return ifcPlaneEClass ; |
public class FormSubmitEvent { /** * Fires a form submit event on all registered handlers in the handler manager . If no such
* handlers exist , this method will do nothing .
* @ param < T > the old value type
* @ param source the source of the handlers
* @ param value the value */
public static < T > void fire ( final HasFormSubmitHandlers < T > source , final T value ) { } } | if ( type != null ) { final FormSubmitEvent < T > event = new FormSubmitEvent < > ( value ) ; source . fireEvent ( event ) ; } |
public class TagsInner { /** * Creates a tag value . The name of the tag must already exist .
* @ param tagName The name of the tag .
* @ param tagValue The value of the tag to create .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the TagValueInner object if successful . */
public TagValueInner createOrUpdateValue ( String tagName , String tagValue ) { } } | return createOrUpdateValueWithServiceResponseAsync ( tagName , tagValue ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Box { /** * Sets the gradation mode and colors .
* @ param mode The mode of gradation .
* @ param color1 The color for gradation .
* @ param color2 The color for gradation .
* @ see casmi . GradationMode2D */
public void setGradationColor ( GradationMode3D mode , Color color1 , Color color2 ) { } } | setGradation ( true ) ; if ( startColor == null || endColor == null ) { startColor = new RGBColor ( 0.0 , 0.0 , 0.0 ) ; endColor = new RGBColor ( 0.0 , 0.0 , 0.0 ) ; } startColor = color1 ; endColor = color2 ; this . mode = mode ; setGradationCorner ( ) ; |
public class ExtensionHttpSessions { /** * Checks if a particular default session token was removed by an user as a session token for a
* site .
* @ param site the site . This parameter has to be formed as defined in the
* { @ link ExtensionHttpSessions } class documentation .
* @ param token the token
* @ return true , if it is a previously removed default session token */
private boolean isRemovedDefaultSessionToken ( String site , String token ) { } } | if ( removedDefaultTokens == null ) return false ; HashSet < String > removed = removedDefaultTokens . get ( site ) ; if ( removed == null || ! removed . contains ( token ) ) return false ; return true ; |
public class MathBindings { /** * Binding for { @ link java . lang . Math # abs ( double ) }
* @ param a the argument whose absolute value is to be determined
* @ return the absolute value of the argument . */
public static DoubleBinding abs ( final ObservableDoubleValue a ) { } } | return createDoubleBinding ( ( ) -> Math . abs ( a . get ( ) ) , a ) ; |
public class ServerTransportAcceptListener { /** * Driven in the event that the underlying connection closes . This will only be driven if the
* socket dies before a connection to the ME has had chance to be established .
* @ see com . ibm . ws . sib . jfapchannel . ConnectionClosedListener # connectionClosed ( java . lang . Object ) */
public void connectionClosed ( Object connectionReference ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "connectionClosed" , connectionReference ) ; removeAllConversations ( connectionReference ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "connectionClosed" ) ; |
public class PhaseThreeApplication { /** * Stage five term equivalencing .
* @ param network the { @ link ProtoNetwork network } to equivalence
* @ param pct the parameter equivalencing count to control output */
private void stage5Term ( final ProtoNetwork network , int pct ) { } } | if ( pct > 0 ) { stageOutput ( "Equivalencing terms" ) ; int tct = p2 . stage3EquivalenceTerms ( network ) ; stageOutput ( "(" + tct + " equivalences)" ) ; } else { stageOutput ( "Skipping term equivalencing" ) ; } |
public class WebAppDispatcherContext { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . webcontainer . webapp . IWebAppDispatcherContext # sendError ( int ) */
public void sendError ( int sc ) throws IOException { } } | String message ; RequestProcessor ref = getCurrentServletReference ( ) ; if ( ref != null ) { sendError ( sc , MessageFormat . format ( nls . getString ( "[{0}].reported.an.error" , "[{0}] reported an error" ) , new Object [ ] { ref . getName ( ) } ) ) ; } else { sendError ( sc , MessageFormat . format ( nls . getString ( "[{0}].reported.an.error" , "[{0}] reported an error" ) , new Object [ ] { getWebApp ( ) . getConfiguration ( ) . getDisplayName ( ) } ) ) ; } |
public class ConnectionDialog { /** * This method initializes mainPanel
* @ return javax . swing . JPanel */
private JPanel getMainPanel ( ) { } } | if ( mainPanel == null ) { mainPanel = new JPanel ( ) ; mainPanel . setLayout ( new GridBagLayout ( ) ) ; GridBagConstraints c = new GridBagConstraints ( ) ; c . insets = new Insets ( 5 , 5 , 5 , 5 ) ; c . fill = GridBagConstraints . HORIZONTAL ; c . gridx = 0 ; c . gridy = 0 ; c . weightx = 0.0D ; mainPanel . add ( new JLabel ( "Host" ) , c ) ; c . gridx = 1 ; c . weightx = 1.0D ; mainPanel . add ( getHostField ( ) , c ) ; c . gridx = 0 ; c . gridy = 1 ; c . weightx = 0.0D ; mainPanel . add ( new JLabel ( "User" ) , c ) ; c . gridx = 1 ; c . weightx = 1.0D ; mainPanel . add ( getUserField ( ) , c ) ; c . gridx = 0 ; c . gridy = 2 ; c . weightx = 0.0D ; mainPanel . add ( new JLabel ( "Password" ) , c ) ; c . gridx = 1 ; c . weightx = 1.0D ; mainPanel . add ( getPasswordField ( ) , c ) ; c . gridx = 0 ; c . gridy = 3 ; c . weightx = 1.0D ; c . gridwidth = 2 ; mainPanel . add ( getRememberPasswordCheckBox ( ) , c ) ; c . gridx = 0 ; c . gridy = 4 ; c . weightx = 1.0D ; c . weighty = 1.0D ; c . gridwidth = 2 ; mainPanel . add ( new JPanel ( ) , c ) ; } return mainPanel ; |
public class AbstractFlowUserServlet { /** * Start the auth flow . Don ' t run any code after this method that will change the response object . */
private void startAuthFlow ( HttpServletResponse resp , PersistenceManager pm , ThreeLeggedFlow oauthFlow ) throws IOException { } } | pm . makePersistent ( oauthFlow ) ; String authorizationUrl = oauthFlow . getAuthorizationUrl ( ) ; resp . sendRedirect ( authorizationUrl ) ; |
import java . util . ArrayList ; import java . util . List ; class GenerateList { /** * The function accepts an integer parameter ' size ' ,
* and returns a list of said size where an element at position i is either a factorial of
* i ( when i is even ) , or a sum of numbers from 1 to i ( when i is odd ) . The index starts from 1.
* The factorial is defined as the multiplication of numbers from 1 to i ( 1 * 2 * . . . * i ) .
* Example :
* > > > generate _ list ( 5)
* [ 1 , 2 , 6 , 24 , 15] */
public static List < Integer > generateList ( int size ) { } private static int factorial ( int number ) { int factorialValue = 1 ; for ( int i = 1 ; i <= number ; i ++ ) { factorialValue *= i ; } return factorialValue ; } private static int sumOfNumbers ( int number ) { int sum = 0 ; for ( int i = 1 ; i <= number ; i ++ ) { sum += i ; } return sum ; } } | List < Integer > result = new ArrayList < > ( ) ; for ( int i = 1 ; i <= size ; i ++ ) { if ( i % 2 == 0 ) { int factorialValue = factorial ( i ) ; result . add ( factorialValue ) ; } else { int cumulativeSum = sumOfNumbers ( i ) ; result . add ( cumulativeSum ) ; } } return result ; |
public class JarResource { public static void extract ( Resource resource , File directory , boolean deleteOnExit ) throws IOException { } } | if ( log . isDebugEnabled ( ) ) log . debug ( "Extract " + resource + " to " + directory ) ; JarInputStream jin = new JarInputStream ( resource . getInputStream ( ) ) ; JarEntry entry = null ; while ( ( entry = jin . getNextJarEntry ( ) ) != null ) { File file = new File ( directory , entry . getName ( ) ) ; if ( entry . isDirectory ( ) ) { // Make directory
if ( ! file . exists ( ) ) file . mkdirs ( ) ; } else { // make directory ( some jars don ' t list dirs )
File dir = new File ( file . getParent ( ) ) ; if ( ! dir . exists ( ) ) dir . mkdirs ( ) ; // Make file
FileOutputStream fout = null ; try { fout = new FileOutputStream ( file ) ; IO . copy ( jin , fout ) ; } finally { IO . close ( fout ) ; } // touch the file .
if ( entry . getTime ( ) >= 0 ) file . setLastModified ( entry . getTime ( ) ) ; } if ( deleteOnExit ) file . deleteOnExit ( ) ; } |
public class PropertyAccessorHelper { /** * Sets a byte - array onto a field .
* @ param target
* the target
* @ param field
* the field
* @ param bytes
* the bytes
* @ throws PropertyAccessException
* the property access exception */
public static void set ( Object target , Field field , byte [ ] bytes ) { } } | PropertyAccessor < ? > accessor = PropertyAccessorFactory . getPropertyAccessor ( field ) ; Object value = accessor . fromBytes ( field . getType ( ) , bytes ) ; set ( target , field , value ) ; |
public class DistanceMatrixCalculator { /** * The fractional dissimilarity ( D ) is defined as the percentage of sites
* that differ between two aligned sequences . The percentage of identity
* ( PID ) is the fraction of identical sites between two aligned sequences .
* < pre >
* D = 1 - PID
* < / pre >
* The gapped positons in the alignment are ignored in the calculation . This
* method is a wrapper to the forester implementation of the calculation :
* { @ link PairwiseDistanceCalculator # calcFractionalDissimilarities ( Msa ) }
* @ param msa
* MultipleSequenceAlignment
* @ return DistanceMatrix
* @ throws Exception */
public static < C extends Sequence < D > , D extends Compound > DistanceMatrix fractionalDissimilarity ( MultipleSequenceAlignment < C , D > msa ) throws IOException { } } | Msa fMsa = ForesterWrapper . convert ( msa ) ; DistanceMatrix DM = PairwiseDistanceCalculator . calcFractionalDissimilarities ( fMsa ) ; return DM ; |
public class ChainWriter { /** * Writes a JavaScript script tag that a time in the user ' s locale . Prints < code > & amp ; # 160 ; < / code >
* if the date is < code > null < / code > .
* Writes to the internal < code > PrintWriter < / code > .
* @ see # writeTimeJavaScript ( long , Appendable ) */
public ChainWriter writeTimeJavaScript ( Date date , Sequence sequence , Appendable scriptOut ) throws IOException { } } | writeTimeJavaScript ( date , sequence , out , scriptOut ) ; return this ; |
public class CPAttachmentFileEntryLocalServiceUtil { /** * Creates a new cp attachment file entry with the primary key . Does not add the cp attachment file entry to the database .
* @ param CPAttachmentFileEntryId the primary key for the new cp attachment file entry
* @ return the new cp attachment file entry */
public static com . liferay . commerce . product . model . CPAttachmentFileEntry createCPAttachmentFileEntry ( long CPAttachmentFileEntryId ) { } } | return getService ( ) . createCPAttachmentFileEntry ( CPAttachmentFileEntryId ) ; |
public class CommonOps_DSCC { /** * Concats two matrices along their columns ( horizontal ) .
* @ param left Matrix on the left
* @ param right Matrix on the right
* @ param out ( Output ) ( Optional ) Storage for combined matrix . Resized .
* @ return Combination of the two matrices */
public static DMatrixSparseCSC concatColumns ( DMatrixSparseCSC left , DMatrixSparseCSC right , @ Nullable DMatrixSparseCSC out ) { } } | if ( left . numRows != right . numRows ) throw new MatrixDimensionException ( "Number of rows must match. " + stringShapes ( left , right ) ) ; if ( out == null ) out = new DMatrixSparseCSC ( 0 , 0 , 0 ) ; out . reshape ( left . numRows , left . numCols + right . numCols , left . nz_length + right . nz_length ) ; out . nz_length = left . nz_length + right . nz_length ; System . arraycopy ( left . col_idx , 0 , out . col_idx , 0 , left . numCols + 1 ) ; System . arraycopy ( left . nz_rows , 0 , out . nz_rows , 0 , left . nz_length ) ; System . arraycopy ( left . nz_values , 0 , out . nz_values , 0 , left . nz_length ) ; int index = left . nz_length ; for ( int i = 0 ; i < right . numCols ; i ++ ) { int r0 = right . col_idx [ i ] ; int r1 = right . col_idx [ i + 1 ] ; out . col_idx [ left . numCols + i ] = index ; out . col_idx [ left . numCols + i + 1 ] = index + ( r1 - r0 ) ; for ( int j = r0 ; j < r1 ; j ++ , index ++ ) { out . nz_rows [ index ] = right . nz_rows [ j ] ; out . nz_values [ index ] = right . nz_values [ j ] ; } } out . indicesSorted = left . indicesSorted && right . indicesSorted ; return out ; |
public class Utils { /** * Resolves the getter name for the property whose name is ' propertyName ' whose type is ' valueType '
* in the entity bean whose class is ' entityClass ' .
* If we don ' t find a setter following Java ' s naming conventions , before throwing an exception we try to
* resolve the setter following Scala ' s naming conventions .
* @ param propertyName the field name of the property whose getter we want to resolve .
* @ param entityClass the bean class object in which we want to search for the getter .
* @ return the resolved getter . */
@ SuppressWarnings ( "unchecked" ) public static Method findGetter ( String propertyName , Class entityClass ) { } } | Method getter ; String getterName = "get" + propertyName . substring ( 0 , 1 ) . toUpperCase ( ) + propertyName . substring ( 1 ) ; try { getter = entityClass . getMethod ( getterName ) ; } catch ( NoSuchMethodException e ) { // let ' s try with scala setter name
try { getter = entityClass . getMethod ( propertyName + "_$eq" ) ; } catch ( NoSuchMethodException e1 ) { throw new DeepIOException ( e1 ) ; } } return getter ; |
public class PathBuilder { /** * Create a new String typed path
* @ param path existing path
* @ return property path */
public StringPath get ( StringPath path ) { } } | StringPath newPath = getString ( toString ( path ) ) ; return addMetadataOf ( newPath , path ) ; |
public class Request { /** * Create a < code > Request < / code > that , when processed , will run all the tests
* in a set of classes .
* @ param computer Helps construct Runners from classes
* @ param classes the classes containing the tests
* @ return a < code > Request < / code > that will cause all tests in the classes to be run */
public static Request classes ( Computer computer , Class < ? > ... classes ) { } } | try { AllDefaultPossibilitiesBuilder builder = new AllDefaultPossibilitiesBuilder ( ) ; Runner suite = computer . getSuite ( builder , classes ) ; return runner ( suite ) ; } catch ( InitializationError e ) { return runner ( new ErrorReportingRunner ( e , classes ) ) ; } |
public class RegionUtils { /** * Initializes the region metadata singleton from the given resource .
* @ param clazz the class to use as a base for the resource
* @ param name the path to the resource , relative to the given class
* @ throws SdkClientException on error */
@ Deprecated public static synchronized void initializeFromResource ( final Class < ? > clazz , final String name ) { } } | try { regionMetadata = loadMetadataFromResource ( clazz , name ) ; } catch ( IOException exception ) { throw new SdkClientException ( "Error parsing region metadata from resource " + name , exception ) ; } |
public class CaseExecutionEntity { /** * delete / remove / / / / / */
@ SuppressWarnings ( { } } | "unchecked" , "rawtypes" } ) public void remove ( ) { super . remove ( ) ; for ( VariableInstanceEntity variableInstance : variableStore . getVariables ( ) ) { invokeVariableLifecycleListenersDelete ( variableInstance , this , Arrays . < VariableInstanceLifecycleListener < CoreVariableInstance > > asList ( ( VariableInstanceLifecycleListener ) VariableInstanceEntityPersistenceListener . INSTANCE ) ) ; variableStore . removeVariable ( variableInstance . getName ( ) ) ; } CommandContext commandContext = Context . getCommandContext ( ) ; for ( CaseSentryPartEntity sentryPart : getCaseSentryParts ( ) ) { commandContext . getCaseSentryPartManager ( ) . deleteSentryPart ( sentryPart ) ; } // finally delete this execution
commandContext . getCaseExecutionManager ( ) . deleteCaseExecution ( this ) ; |
public class SensorAggregatorInterface { /** * Responds to exceptions and errors on the aggregator session . If
* { @ code # disconnectOnException } is { @ code true } , then disconnects from the
* aggregator . An OutOfMemory error will force a JVM exit .
* @ param session
* the session that threw the exception or error .
* @ param cause
* the Throwable that was thrown . */
protected void exceptionCaught ( IoSession session , Throwable cause ) { } } | log . error ( "Exception while communicating with " + this + "." , cause ) ; // Nothing to do if we have no memory
if ( cause instanceof OutOfMemoryError ) { System . exit ( 1 ) ; } if ( this . disconnectOnException ) { this . _disconnect ( ) ; } |
public class TransliterationRuleSet { /** * TODO Merge into r . addSourceTargetSet , to avoid duplicate testing */
void addSourceTargetSet ( UnicodeSet filter , UnicodeSet sourceSet , UnicodeSet targetSet ) { } } | UnicodeSet currentFilter = new UnicodeSet ( filter ) ; UnicodeSet revisiting = new UnicodeSet ( ) ; int count = ruleVector . size ( ) ; for ( int i = 0 ; i < count ; ++ i ) { TransliterationRule r = ruleVector . get ( i ) ; r . addSourceTargetSet ( currentFilter , sourceSet , targetSet , revisiting . clear ( ) ) ; currentFilter . addAll ( revisiting ) ; } |
public class QueryOptimizer { /** * Determine index to use .
* Policy :
* 1 ) Check if index are available . If not , do not perform any further query analysis ( for now )
* Query rewriting may still be able to optimize really stupid queries .
* 2 ) Create sub - queries
* 3 ) Analyse sub - queries to determine best index to use . Result may imply that index usage is
* pointless ( whole index range required ) . This could also be if one sub - query does not use
* any index , in which case using an index for the rest slightly increases disk access
* ( index read ) but reduces CPU needs ( only sub - query to process , not whole query ) .
* 4a ) For each sub - query , determine index with smallest range / density .
* 4b ) Check for required sorting . Using an according index can be of advantage , even if range
* is larger .
* 5 ) Merge queries with same index and overlapping ranges
* 6 ) merge results
* @ param queryTree the root of the query tree
* @ return Index to use . */
public List < QueryAdvice > determineIndexToUse ( QueryTreeNode queryTree ) { } } | List < QueryAdvice > advices = new LinkedList < QueryAdvice > ( ) ; List < ZooFieldDef > availableIndices = new LinkedList < ZooFieldDef > ( ) ; for ( ZooFieldDef f : clsDef . getAllFields ( ) ) { if ( f . isIndexed ( ) ) { availableIndices . add ( f ) ; } } // step 1
if ( availableIndices . isEmpty ( ) ) { // no index usage
advices . add ( new QueryAdvice ( queryTree ) ) ; return advices ; } // step 2 - sub - queries
// We split the query tree at every OR into sub queries , such that every sub - query contains
// the full query but only one side of every OR . All ORs are removed .
// - > Optimization : We remove only ( and split only at ) ORs where at least on branch
// uses an index . TODO
List < QueryTreeNode > subQueries = new LinkedList < QueryTreeNode > ( ) ; subQueries . add ( queryTree ) ; queryTree . createSubs ( subQueries ) ; // System . out . println ( " Query2 : " + queryTree . print ( ) ) ;
for ( QueryTreeNode sq : subQueries ) { optimize ( sq ) ; // System . out . println ( " Sub - query : " + sq . print ( ) ) ;
} // TODO filter out terms that cannot become true .
// if none is left , return empty set .
IdentityHashMap < ZooFieldDef , Long > minMap = new IdentityHashMap < ZooFieldDef , Long > ( ) ; IdentityHashMap < ZooFieldDef , Long > maxMap = new IdentityHashMap < ZooFieldDef , Long > ( ) ; for ( QueryTreeNode sq : subQueries ) { advices . add ( determineIndexToUseSub ( sq , minMap , maxMap ) ) ; minMap . clear ( ) ; maxMap . clear ( ) ; } // TODO merge queries
// E . g . :
// - if none uses an index ( or at least one doesn ' t ) , return only the full query
// - if ranges overlap , try to merge ?
// TODO optimisation : merge queries
// for example the following query returns two identical sub - queries :
// " _ int = = 123 | | _ int = = 123 " - - > This is bad and should be avoided .
// check for show - stoppers
// - > in their case , we simply run the un - split query on the full type extent .
for ( QueryAdvice qa : advices ) { // assuming that the term is not an empty term ( contradicting sub - terms )
if ( qa == null ) { // ah , one of them iterates over the whole result set .
advices . clear ( ) ; advices . add ( qa ) ; return advices ; } // TODO instead of fixed values , use min / max of index .
if ( qa . getMin ( ) <= Long . MIN_VALUE && qa . getMax ( ) >= Long . MAX_VALUE ) { // ah , one of them iterates over the whole result set .
advices . clear ( ) ; advices . add ( qa ) ; return advices ; } } // check for overlapping / global min / max
mergeAdvices ( advices ) ; return advices ; |
public class PhoneNumberFetcher { /** * Add the requested query string arguments to the Request .
* @ param request Request to add query string arguments to */
private void addQueryParams ( final Request request ) { } } | if ( countryCode != null ) { request . addQueryParam ( "CountryCode" , countryCode ) ; } if ( type != null ) { for ( String prop : type ) { request . addQueryParam ( "Type" , prop ) ; } } if ( addOns != null ) { for ( String prop : addOns ) { request . addQueryParam ( "AddOns" , prop ) ; } } if ( addOnsData != null ) { Map < String , String > params = PrefixedCollapsibleMap . serialize ( addOnsData , "AddOns" ) ; for ( Map . Entry < String , String > entry : params . entrySet ( ) ) { request . addQueryParam ( entry . getKey ( ) , entry . getValue ( ) ) ; } } |
public class MusicOnHoldApi { /** * Update MOH settings .
* Adds or updates MOH setting .
* @ param musicFile The Name of WAV file . ( required )
* @ param musicEnabled Define is music enabled / disabled . ( required )
* @ return SendMOHSettingsResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public SendMOHSettingsResponse sendMOHSettings ( String musicFile , Boolean musicEnabled ) throws ApiException { } } | ApiResponse < SendMOHSettingsResponse > resp = sendMOHSettingsWithHttpInfo ( musicFile , musicEnabled ) ; return resp . getData ( ) ; |
public class DocumentLine { /** * getter for beginnings - gets
* @ generated
* @ return value of the feature */
public FloatArray getBeginnings ( ) { } } | if ( DocumentLine_Type . featOkTst && ( ( DocumentLine_Type ) jcasType ) . casFeat_beginnings == null ) jcasType . jcas . throwFeatMissing ( "beginnings" , "ch.epfl.bbp.uima.types.DocumentLine" ) ; return ( FloatArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( DocumentLine_Type ) jcasType ) . casFeatCode_beginnings ) ) ) ; |
public class DescribeComplianceByConfigRuleResult { /** * Indicates whether each of the specified AWS Config rules is compliant .
* @ param complianceByConfigRules
* Indicates whether each of the specified AWS Config rules is compliant . */
public void setComplianceByConfigRules ( java . util . Collection < ComplianceByConfigRule > complianceByConfigRules ) { } } | if ( complianceByConfigRules == null ) { this . complianceByConfigRules = null ; return ; } this . complianceByConfigRules = new com . amazonaws . internal . SdkInternalList < ComplianceByConfigRule > ( complianceByConfigRules ) ; |
public class EventServiceImpl { /** * Increase the failure count and log the failure . Every { @ value # WARNING _ LOG _ FREQUENCY } log is logged
* with a higher log level .
* @ param message the log message
* @ param args the log message arguments */
private void logFailure ( String message , Object ... args ) { } } | totalFailures . inc ( ) ; long total = totalFailures . get ( ) ; // it can happen that 2 threads at the same conclude that the level should be warn because of the
// non atomic int / get . This is an acceptable trade of since it is unlikely to happen and you only get
// additional warning under log as a side effect .
Level level = total % WARNING_LOG_FREQUENCY == 0 ? Level . WARNING : Level . FINEST ; if ( logger . isLoggable ( level ) ) { logger . log ( level , String . format ( message , args ) ) ; } |
public class WorkUnitThreadControllerImpl { /** * Call afterJob ( ) on all the job listeners */
private void jobListenersAfterJob ( ) { } } | List < JobListenerProxy > jobListeners = listenerFactory . getJobListeners ( ) ; for ( JobListenerProxy listenerProxy : jobListeners ) { if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( " Invoking afterJob() on jobListener: " + listenerProxy . getDelegate ( ) + " of type: " + listenerProxy . getDelegate ( ) . getClass ( ) ) ; } listenerProxy . afterJob ( ) ; } |
public class ElementWithOptions { /** * Adds an option to the group of this element with the given id .
* If the group is not found , it ' s created with null text .
* @ param value Unique value in this element
* @ param text Option text
* @ param groupId Id of the option group
* @ return This element */
public ElementWithOptions addOptionToGroup ( String value , String text , String groupId ) { } } | if ( value == null ) { value = "" ; } value = value . trim ( ) ; this . addOptionToGroup ( new Option ( value , text ) , groupId ) ; return this ; |
public class TreeRpc { /** * Used to parse a list of TSUIDs from the query string for collision or not
* matched requests . TSUIDs must be comma separated .
* @ param query The HTTP query to work with
* @ return A map with a list of tsuids . If found , the tsuids array will be
* under the " tsuid " key . The map is necessary for compatability with POJO
* parsing . */
private Map < String , Object > parseTSUIDsList ( HttpQuery query ) { } } | final HashMap < String , Object > map = new HashMap < String , Object > ( ) ; map . put ( "treeId" , parseTreeId ( query , true ) ) ; final String tsquery = query . getQueryStringParam ( "tsuids" ) ; if ( tsquery != null ) { final String [ ] tsuids = tsquery . split ( "," ) ; map . put ( "tsuids" , Arrays . asList ( tsuids ) ) ; } return map ; |
public class TypeParameterSubstitutor { /** * / * @ Nullable */
protected LightweightTypeReference getBoundTypeArgument ( ParameterizedTypeReference reference , JvmTypeParameter type , Visiting visiting ) { } } | LightweightMergedBoundTypeArgument boundTypeArgument = typeParameterMapping . get ( type ) ; if ( boundTypeArgument != null ) { LightweightTypeReference boundReference = boundTypeArgument . getTypeReference ( ) ; if ( boundReference != null && reference != boundReference && boundReference . getType ( ) != type ) { return boundReference . accept ( this , visiting ) ; } } return null ; |
public class MetadataColumnDetails { /** * Returns the header for the metadata column .
* @ return The metadata column ' s header . If the header is not present , returns the metadata string . */
public String getColumnHeader ( ) { } } | String result = super . getColumnHeader ( ) ; if ( result == null || result . trim ( ) . length ( ) == 0 ) result = metadata ; return result ; |
public class FlowIdProducerOut { /** * Calling EventProducerInterceptor in case of logging faults .
* @ param exchange
* the message exchange
* @ param reqFid
* the FlowId
* @ throws Fault
* the fault */
protected void handleINEvent ( Exchange exchange , String reqFid ) throws Fault { } } | Message inMsg = exchange . getInMessage ( ) ; EventProducerInterceptor epi = null ; FlowIdHelper . setFlowId ( inMsg , reqFid ) ; ListIterator < Interceptor < ? extends Message > > interceptors = inMsg . getInterceptorChain ( ) . getIterator ( ) ; while ( interceptors . hasNext ( ) && epi == null ) { Interceptor < ? extends Message > interceptor = interceptors . next ( ) ; if ( interceptor instanceof EventProducerInterceptor ) { epi = ( EventProducerInterceptor ) interceptor ; epi . handleMessage ( inMsg ) ; } } |
public class Lireetecrire { /** * je vais moins commenter cette partie c ' est presque la meme chose */
public void lire ( ) { } } | try { String adressedufichier = System . getProperty ( "user.dir" ) + "\\monfichier.txt" ; FileReader fr = new FileReader ( adressedufichier ) ; BufferedReader br = new BufferedReader ( fr ) ; String texte = "" ; int a = 0 ; while ( a < 2 ) // petite boucle 2 fois
{ texte = texte + br . readLine ( ) + "\n" ; a ++ ; } br . close ( ) ; // readLine pour lire une ligne
// note : si il n y a rien , la fonction retournera la valeur null
System . out . println ( texte ) ; // on affiche le texte
} catch ( IOException ioe ) { System . out . println ( "erreur : " + ioe ) ; } |
public class GroupListHelperImpl { /** * ( non - Javadoc )
* @ see org . apereo . portal . layout . dlm . remoting . IGroupListHelper # getEntity ( java . lang . String , java . lang . String , boolean ) */
@ Override public JsonEntityBean getEntity ( String entityType , String entityId , boolean populateChildren ) { } } | // get the EntityEnum for the specified entity type
EntityEnum entityEnum = EntityEnum . getEntityEnum ( entityType ) ; if ( entityEnum == null ) { throw new IllegalArgumentException ( String . format ( "Parameter entityType has an unknown value of [%s]" , entityType ) ) ; } // if the entity type is a group , use the group service ' s findGroup method
// to locate it
if ( entityEnum . isGroup ( ) ) { // attempt to find the entity
IEntityGroup entity = GroupService . findGroup ( entityId ) ; if ( entity == null ) { return null ; } else { JsonEntityBean jsonBean = new JsonEntityBean ( entity , entityEnum ) ; if ( populateChildren ) { Iterator < IGroupMember > members = entity . getChildren ( ) . iterator ( ) ; jsonBean = populateChildren ( jsonBean , members ) ; } if ( jsonBean . getEntityType ( ) . isGroup ( ) || EntityEnum . PERSON . equals ( jsonBean . getEntityType ( ) ) ) { IAuthorizationPrincipal principal = getPrincipalForEntity ( jsonBean ) ; jsonBean . setPrincipalString ( principal . getPrincipalString ( ) ) ; } return jsonBean ; } } // otherwise use the getGroupMember method
else { IGroupMember entity = GroupService . getGroupMember ( entityId , entityEnum . getClazz ( ) ) ; if ( entity == null || entity instanceof IEntityGroup ) { return null ; } JsonEntityBean jsonBean = new JsonEntityBean ( entity , entityEnum ) ; // the group member interface doesn ' t include the entity name , so
// we ' ll need to look that up manually
jsonBean . setName ( lookupEntityName ( jsonBean ) ) ; if ( EntityEnum . GROUP . equals ( jsonBean . getEntityType ( ) ) || EntityEnum . PERSON . equals ( jsonBean . getEntityType ( ) ) ) { IAuthorizationPrincipal principal = getPrincipalForEntity ( jsonBean ) ; jsonBean . setPrincipalString ( principal . getPrincipalString ( ) ) ; } return jsonBean ; } |
public class JCudaDriver { /** * Initializes device memory .
* < pre >
* CUresult cuMemsetD8 (
* CUdeviceptr dstDevice ,
* unsigned char uc ,
* size _ t N )
* < / pre >
* < div >
* < p > Initializes device memory . Sets the
* memory range of < tt > N < / tt > 8 - bit values to the specified value < tt > uc < / tt > .
* < p > Note that this function is asynchronous
* with respect to the host unless < tt > dstDevice < / tt > refers to pinned
* host memory .
* < div >
* < span > Note : < / span >
* < p > Note that this
* function may also return error codes from previous , asynchronous
* launches .
* < / div >
* < / div >
* @ param dstDevice Destination device pointer
* @ param uc Value to set
* @ param N Number of elements
* @ return CUDA _ SUCCESS , CUDA _ ERROR _ DEINITIALIZED , CUDA _ ERROR _ NOT _ INITIALIZED ,
* CUDA _ ERROR _ INVALID _ CONTEXT , CUDA _ ERROR _ INVALID _ VALUE
* @ see JCudaDriver # cuArray3DCreate
* @ see JCudaDriver # cuArray3DGetDescriptor
* @ see JCudaDriver # cuArrayCreate
* @ see JCudaDriver # cuArrayDestroy
* @ see JCudaDriver # cuArrayGetDescriptor
* @ see JCudaDriver # cuMemAlloc
* @ see JCudaDriver # cuMemAllocHost
* @ see JCudaDriver # cuMemAllocPitch
* @ see JCudaDriver # cuMemcpy2D
* @ see JCudaDriver # cuMemcpy2DAsync
* @ see JCudaDriver # cuMemcpy2DUnaligned
* @ see JCudaDriver # cuMemcpy3D
* @ see JCudaDriver # cuMemcpy3DAsync
* @ see JCudaDriver # cuMemcpyAtoA
* @ see JCudaDriver # cuMemcpyAtoD
* @ see JCudaDriver # cuMemcpyAtoH
* @ see JCudaDriver # cuMemcpyAtoHAsync
* @ see JCudaDriver # cuMemcpyDtoA
* @ see JCudaDriver # cuMemcpyDtoD
* @ see JCudaDriver # cuMemcpyDtoDAsync
* @ see JCudaDriver # cuMemcpyDtoH
* @ see JCudaDriver # cuMemcpyDtoHAsync
* @ see JCudaDriver # cuMemcpyHtoA
* @ see JCudaDriver # cuMemcpyHtoAAsync
* @ see JCudaDriver # cuMemcpyHtoD
* @ see JCudaDriver # cuMemcpyHtoDAsync
* @ see JCudaDriver # cuMemFree
* @ see JCudaDriver # cuMemFreeHost
* @ see JCudaDriver # cuMemGetAddressRange
* @ see JCudaDriver # cuMemGetInfo
* @ see JCudaDriver # cuMemHostAlloc
* @ see JCudaDriver # cuMemHostGetDevicePointer
* @ see JCudaDriver # cuMemsetD2D8
* @ see JCudaDriver # cuMemsetD2D8Async
* @ see JCudaDriver # cuMemsetD2D16
* @ see JCudaDriver # cuMemsetD2D16Async
* @ see JCudaDriver # cuMemsetD2D32
* @ see JCudaDriver # cuMemsetD2D32Async
* @ see JCudaDriver # cuMemsetD8Async
* @ see JCudaDriver # cuMemsetD16
* @ see JCudaDriver # cuMemsetD16Async
* @ see JCudaDriver # cuMemsetD32
* @ see JCudaDriver # cuMemsetD32Async */
public static int cuMemsetD8 ( CUdeviceptr dstDevice , byte uc , long N ) { } } | return checkResult ( cuMemsetD8Native ( dstDevice , uc , N ) ) ; |
public class ParosTableAlert { /** * / * ( non - Javadoc )
* @ see org . parosproxy . paros . db . paros . TableAlert # updateHistoryIds ( int , int , int ) */
@ Override public synchronized void updateHistoryIds ( int alertId , int historyId , int sourceHistoryId ) throws DatabaseException { } } | try { psUpdateHistoryIds . setInt ( 1 , historyId ) ; psUpdateHistoryIds . setInt ( 2 , sourceHistoryId ) ; psUpdateHistoryIds . setInt ( 3 , alertId ) ; psUpdateHistoryIds . executeUpdate ( ) ; } catch ( SQLException e ) { throw new DatabaseException ( e ) ; } |
public class ComponentBundler { /** * Composes a triplet of [ class , name , action ] into the path that should be supplied to the
* JarEntry that contains the associated image data . */
protected String composePath ( String [ ] info , String extension ) { } } | return ( info [ 0 ] + "/" + info [ 1 ] + "/" + info [ 2 ] + extension ) ; |
public class dnsaction { /** * Use this API to update dnsaction . */
public static base_response update ( nitro_service client , dnsaction resource ) throws Exception { } } | dnsaction updateresource = new dnsaction ( ) ; updateresource . actionname = resource . actionname ; updateresource . ipaddress = resource . ipaddress ; updateresource . ttl = resource . ttl ; updateresource . viewname = resource . viewname ; updateresource . preferredloclist = resource . preferredloclist ; return updateresource . update_resource ( client ) ; |
public class NodeContentKinds { /** * Returns the unpack function for converting safe protos to JS SanitizedContent . */
public static String toJsUnpackFunction ( Descriptor protoDescriptor ) { } } | return Preconditions . checkNotNull ( PROTO_TO_JS_UNPACK_FN . get ( protoDescriptor . getFullName ( ) ) ) ; |
public class LoadMetadataPOptions { /** * < code > optional . alluxio . grpc . file . FileSystemMasterCommonPOptions commonOptions = 4 ; < / code > */
public alluxio . grpc . FileSystemMasterCommonPOptionsOrBuilder getCommonOptionsOrBuilder ( ) { } } | return commonOptions_ == null ? alluxio . grpc . FileSystemMasterCommonPOptions . getDefaultInstance ( ) : commonOptions_ ; |
public class SchedulerProvider { /** * Sets the { @ code SchedulerListener } s .
* @ param schedulerListeners The { @ code SchedulerListener } s
* @ throws SchedulerException If any error occurs */
@ Inject ( optional = true ) public void addSchedulerListeners ( Set < SchedulerListener > schedulerListeners ) throws SchedulerException { } } | for ( SchedulerListener schedulerListener : schedulerListeners ) { scheduler . getListenerManager ( ) . addSchedulerListener ( schedulerListener ) ; } |
public class ApiOvhDedicatedserver { /** * Create a new Backup FTP ACL
* REST : POST / dedicated / server / { serviceName } / features / backupFTP / access
* @ param nfs [ required ] Wether to allow the NFS protocol for this ACL
* @ param ipBlock [ required ] The IP Block specific to this ACL . It musts belong to your server .
* @ param cifs [ required ] Wether to allow the CIFS ( SMB ) protocol for this ACL
* @ param ftp [ required ] Wether to allow the FTP protocol for this ACL
* @ param serviceName [ required ] The internal name of your dedicated server */
public OvhTask serviceName_features_backupFTP_access_POST ( String serviceName , Boolean cifs , Boolean ftp , String ipBlock , Boolean nfs ) throws IOException { } } | String qPath = "/dedicated/server/{serviceName}/features/backupFTP/access" ; StringBuilder sb = path ( qPath , serviceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "cifs" , cifs ) ; addBody ( o , "ftp" , ftp ) ; addBody ( o , "ipBlock" , ipBlock ) ; addBody ( o , "nfs" , nfs ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhTask . class ) ; |
public class JsGeometryEditService { /** * Register a { @ link GeometryEditTentativeMoveHandler } to listen to mouse move events that point to tentative
* moving . These move events don ' t have to commit to anything . They may result in operations being executed , they
* may not . This is meant mainly for the renderers to respond quickly to user interaction . ( user friendliness and
* all that jazz ) .
* @ param handler
* The { @ link GeometryEditTentativeMoveHandler } to add as listener .
* @ return The registration of the handler . */
public JsHandlerRegistration addGeometryEditTentativeMoveHandler ( final GeometryEditTentativeMoveHandler handler ) { } } | org . geomajas . plugin . editing . client . event . GeometryEditTentativeMoveHandler h ; h = new org . geomajas . plugin . editing . client . event . GeometryEditTentativeMoveHandler ( ) { public void onTentativeMove ( GeometryEditTentativeMoveEvent event ) { handler . onInsertMove ( new org . geomajas . plugin . editing . jsapi . client . event . GeometryEditTentativeMoveEvent ( delegate . getTentativeMoveOrigin ( ) , delegate . getTentativeMoveLocation ( ) ) ) ; } } ; HandlerRegistration registration = delegate . addGeometryEditTentativeMoveHandler ( h ) ; return new JsHandlerRegistration ( new HandlerRegistration [ ] { registration } ) ; |
public class TimephasedUtility { /** * For a given date range , determine the cost , based on the
* timephased resource assignment data .
* This method deals with timescale units of less than a day .
* @ param projectCalendar calendar used for the resource assignment calendar
* @ param rangeUnits timescale units
* @ param range target date range
* @ param assignments timephased resource assignments
* @ param startIndex index at which to start searching through the timephased resource assignments
* @ return work duration */
private Double getRangeCostSubDay ( ProjectCalendar projectCalendar , TimescaleUnits rangeUnits , DateRange range , List < TimephasedCost > assignments , int startIndex ) { } } | throw new UnsupportedOperationException ( "Please request this functionality from the MPXJ maintainer" ) ; |
public class AbstractCluster { /** * 决定超时时间
* @ param request 请求
* @ param consumerConfig 客户端配置
* @ param providerInfo 服务提供者信息
* @ return 调用超时 */
private int resolveTimeout ( SofaRequest request , ConsumerConfig consumerConfig , ProviderInfo providerInfo ) { } } | // 先去调用级别配置
Integer timeout = request . getTimeout ( ) ; if ( timeout == null ) { // 取客户端配置 ( 先方法级别再接口级别 )
timeout = consumerConfig . getMethodTimeout ( request . getMethodName ( ) ) ; if ( timeout == null || timeout < 0 ) { // 再取服务端配置
timeout = ( Integer ) providerInfo . getDynamicAttr ( ATTR_TIMEOUT ) ; if ( timeout == null ) { // 取框架默认值
timeout = getIntValue ( CONSUMER_INVOKE_TIMEOUT ) ; } } } return timeout ; |
public class JPAExEntityManager { /** * JPA 3.3 Persistence Context Lifetime
* When an EntityManager with an extended persistence context is used , the persist , remove ,
* merge , and refresh operations may be called regardless of whether a transaction is active .
* The effects of these operations will be committed to the database when the extended
* persistence context is enlisted in a transaction and the transaction commits .
* ( non - Javadoc )
* @ see com . ibm . ws . jpa . management . JPAEntityManager # getEMInvocationInfo ( boolean , LockModeType ) */
@ Override EntityManager getEMInvocationInfo ( boolean requireTx , LockModeType mode ) { } } | // Obtain the extended - scoped persistence context binding accessor from
// the JPA Service , which was registered by the EJB Container . d515803
JPAExPcBindingContextAccessor exPcAccessor = ivAbstractJPAComponent . getExPcBindingContext ( ) ; // F743-18776
// This should never occur , but if it somehow does , then just throw
// a meaningful exception to let us know what occurred . d515803
if ( exPcAccessor == null ) { throw new IllegalStateException ( "The EJB container has not registered an extended-scoped persistence context binding context accessor with the JPA service. An accessor is required to provide extended-scoped persistence context management for stateful beans." ) ; } JPAExPcBindingContext currentContext = exPcAccessor . getExPcBindingContext ( ) ; // TODO : ejbteam : The currentContext may be null when attempting to use a container managed extended
// persistence context from an asynchbeans thread . This will need to be fixed
// in Pyxis , but until then we will throw a more meaningful exception . / / 473813
if ( currentContext == null ) { Tr . error ( tc , "NO_COMPONENT_CONTEXT_CWWJP0038E" , ivPuRefId . getPuName ( ) ) ; // d479669
throw new RuntimeException ( "The component context does not exist on the thread." + " The server run time environment is not able to associate the operation" + " thread with any Java Platform, Enterprise Edition 5 (Java EE 5)" + " application component. This condition can occur when the client attempts" + " EntityManager operations on a non-server application thread." + " Make sure that a Java EE 5 application does not execute EntityManager" + " operations within static code blocks or in threads that are created by" + " the Java EE application." ) ; } UOWCoordinator uowCoord = ivAbstractJPAComponent . getUOWCurrent ( ) . getUOWCoord ( ) ; SynchronizationRegistryUOWScope uowSyncRegistry = getSynchronizationRegistryUOWScope ( uowCoord ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getEMInvocationInfo" , "tid=" + txIdToString ( uowCoord ) , currentContext . thisToString ( ) ) ; boolean globalTx = uowCoord . isGlobal ( ) ; // Begins d597764
if ( ! globalTx && mode != null && ! LockModeType . NONE . equals ( mode ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getEMInvocationInfo : TransactionRequiredException: " + "No active transaction for " + ivPuRefId ) ; throw new TransactionRequiredException ( "No active transaction for " + ivPuRefId ) ; } // Ends d597764
// JPA 5.6.3.1 Requirements for Persistence Context Propagation
// Persistence contexts are propagated by the container across component invocations as follows .
// If a component is called and there is no JTA transaction or the JTA transaction is not
// propagated , the persistence context is not propagated .
// * If an entity manager is then invoked from within the component :
// * * Invocation of an entity manager defined with PersistenceContext - Type . TRANSACTION will
// result in use of a new persistence context ( as described in section 5.6.1 ) .
// * * Invocation of an entity manager defined with PersistenceContext - Type . EXTENDED will
// result in the use of the existing extended persistence context bound to that component .
// * * If the entity manager is invoked within a JTA transaction , the persistence context will
// be bound to the JTA transaction .
// If a component is called and the JTA transaction is propagated into that component :
// * If the component is a stateful session bean to which an extended persistence context
// has been bound and there is a different persistence context bound to the JTA transaction ,
// an EJBException is thrown by the container .
// * ( JPA 2.1 : 7.6.4.1 ) If there is a persistence context of type SynchronizationType . UNSYNCHRONIZED
// associated with the JTA transaction and the target component specifies a persistence context of type
// SynchronizationType . SYNCHRONIZED , the IllegalStateException is thrown by the container .
// * Otherwise , if there is a persistence context bound to the JTA transaction , that
// persistence context is propagated and used .
// ( JPA 2.1 : 7.6.4.1 ) Note that a component with a persistence context of type
// SynchronizationType . UNSYNCHRONIZED may be called by a component propagating either a persistence context of
// type SynchronizationType . UNSYNCHRONIZED or a persistence context of type SynchronizationType . SYNCHRONIZED
// into it .
// JPA 5.9.1 Container Responsibilities
// For stateful session beans with extended persistence contexts :
// * The container creates an entity manager by calling
// EntityManagerFactory . createEntityManager when a stateful session bean is created that
// declares a dependency on an entity manager with PersistenceContextType . EXTENDED .
// ( See section 5.6.2 ) .
// * The container closes the entity manager by calling EntityManager . close after the
// stateful session bean and all other stateful session beans that have inherited the
// same persistence context as the EntityManager have been removed .
// ExPC is different than TxPC on how the em is determined . However the transaction propagation
// semantics may be required to handle mix Tx / Em Pc invocations and ExPc exception rules .
ExPcBindingKey exPcBindingKey = new ExPcBindingKey ( currentContext . getBindId ( ) , ivPuRefId ) ; ExPcBindingInfo exPcInfo = getExPcBindingInfo ( exPcBindingKey ) ; // creation of provider EntityManager is deferred until first use .
if ( exPcInfo . em == null ) { exPcInfo . em = ivEntityManagerPool . getEntityManager ( globalTx , ivUnsynchronized ) ; // d510184
exPcInfo . txKeyPuId = ivTxKeyPuId ; } EntityManager em = exPcInfo . em ; if ( globalTx ) { JPAExEmInvocation invocationEm = getInvocation ( uowSyncRegistry , ivTxKeyPuId ) ; // d683375 , d689596
if ( invocationEm == null ) { invocationEm = ivAbstractJPAComponent . getJPARuntime ( ) . createExEmInvocation ( uowCoord , em , ivUnsynchronized ) ; setInvocation ( uowSyncRegistry , ivTxKeyPuId , invocationEm ) ; // d683375 , d689596
// JPA 5.9.1 Container Responsibilities
// For stateful session beans with extended persistence contexts :
// * * ( JPA 2.1 : 7.9.1 ) When a business method of the stateful session bean is invoked , if the stateful
// session bean uses container managed transaction demarcation , and the entity manager is not already
// associated with the current JTA transaction , the container associates the entity manager with the
// current JTA transaction and , if the persistence context is of type SynchronizationType . SYNCHRONIZED ,
// the container calls EntityManager . joinTransaction . If there is a different persistence context
// already associated with the JTA transaction , the container throws the EJBException .
// * * ( JPA 2.1 : 7.9.1 ) When a business method of the stateful session bean is invoked , if the stateful
// session bean uses bean managed transaction demarcation and a UserTransaction is begun within the
// method , the container associates the persistence context with the JTA transaction and , if the
// persistence context is of type SynchronizationType . SYNCHRONIZED , the container calls
// EntityManager . joinTransaction .
boolean isCmt = ! currentContext . isBmt ( ) ; boolean isBmtNUserTxBegunInMethod = currentContext . isBmt ( ) && currentContext . hasBmtUserTxBegunInMethod ( ) ; if ( ! ivUnsynchronized && ( isCmt || isBmtNUserTxBegunInMethod ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "CMT=" + isCmt + ", UserTxBegun=" + isBmtNUserTxBegunInMethod + " -> em=" + em ) ; em . joinTransaction ( ) ; } } else { // JPA 5.9.1 Container Responsibilities
// For stateful session beans with extended persistence contexts :
// * * If there is a different persistence context already associated with the JTA
// transaction , the container throws the EJBException .
if ( invocationEm . ivEm != em ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getEMInvocationInfo : Different persistence context already associate with a JTA tx." ) ; throw exPcAccessor . newEJBException ( "5.9.1 A persistence context is associated to the current JTA transaction " + "and it is different than the extend-scoped persistence context bound to this SFSB." ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getEMInvocationInfo : " + em ) ; return em ; |
public class MisoUtil { /** * Given two points in an isometric coordinate system ( in which { @ link
* # NORTH } is in the direction of the negative x - axis and { @ link
* # WEST } in the direction of the negative y - axis ) , return the compass
* direction that point B lies in from point A . This method is used
* to determine direction for both tile coordinates and fine
* coordinates within a tile , since the coordinate systems are the
* same .
* @ param ax the x - position of point A .
* @ param ay the y - position of point A .
* @ param bx the x - position of point B .
* @ param by the y - position of point B .
* @ return the direction specified as one of the < code > Sprite < / code >
* class ' s direction constants , or < code > DirectionCodes . NONE < / code > if
* point B is equivalent to point A . */
public static int getIsoDirection ( int ax , int ay , int bx , int by ) { } } | // head off a div by 0 at the pass . .
if ( bx == ax ) { if ( by == ay ) { return DirectionCodes . NONE ; } return ( by < ay ) ? EAST : WEST ; } // figure direction base on the slope of the line
float slope = ( ( float ) ( ay - by ) ) / ( ( float ) Math . abs ( ax - bx ) ) ; if ( slope > 2f ) { return EAST ; } if ( slope > .5f ) { return ( bx < ax ) ? NORTHEAST : SOUTHEAST ; } if ( slope > - .5f ) { return ( bx < ax ) ? NORTH : SOUTH ; } if ( slope > - 2f ) { return ( bx < ax ) ? NORTHWEST : SOUTHWEST ; } return WEST ; |
public class StatementUtil { /** * 创建 { @ link PreparedStatement }
* @ param conn 数据库连接
* @ param sqlBuilder { @ link SqlBuilder } 包括SQL语句和参数
* @ return { @ link PreparedStatement }
* @ throws SQLException SQL异常
* @ since 4.1.3 */
public static PreparedStatement prepareStatement ( Connection conn , SqlBuilder sqlBuilder ) throws SQLException { } } | return prepareStatement ( conn , sqlBuilder . build ( ) , sqlBuilder . getParamValueArray ( ) ) ; |
public class RedisJobStore { /** * Retrieve the < code > { @ link org . quartz . JobDetail } < / code > for the given
* < code > { @ link org . quartz . Job } < / code > .
* @ param jobKey the { @ link org . quartz . JobKey } describing the desired job
* @ return The desired < code > Job < / code > , or null if there is no match . */
@ Override public JobDetail retrieveJob ( final JobKey jobKey ) throws JobPersistenceException { } } | return doWithLock ( new LockCallback < JobDetail > ( ) { @ Override public JobDetail doWithLock ( JedisCommands jedis ) throws JobPersistenceException { try { return storage . retrieveJob ( jobKey , jedis ) ; } catch ( ClassNotFoundException e ) { throw new JobPersistenceException ( "Error retrieving job: " + e . getMessage ( ) , e ) ; } } } , "Could not retrieve job." ) ; |
public class ssl_key { /** * Use this API to fetch filtered set of ssl _ key resources .
* filter string should be in JSON format . eg : " vm _ state : DOWN , name : [ a - z ] + " */
public static ssl_key [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | ssl_key obj = new ssl_key ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; ssl_key [ ] response = ( ssl_key [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class Variable { /** * Note : UtilEvalError here comes from lhs . getValue ( ) .
* A Variable can represent an LHS for the case of an imported class or
* object field . */
Object getValue ( ) throws UtilEvalError { } } | if ( lhs != null ) return type == null ? lhs . getValue ( ) : Primitive . wrap ( lhs . getValue ( ) , type ) ; return value ; |
public class InMemoryPartition { /** * attempts to allocate specified number of segments and should only be used by compaction partition
* fails silently if not enough segments are available since next compaction could still succeed
* @ param numberOfSegments allocation count */
public void allocateSegments ( int numberOfSegments ) { } } | while ( getBlockCount ( ) < numberOfSegments ) { MemorySegment next = this . availableMemory . nextSegment ( ) ; if ( next != null ) { this . partitionPages . add ( next ) ; } else { return ; } } |
public class CPOptionLocalServiceBaseImpl { /** * Returns the cp option matching the UUID and group .
* @ param uuid the cp option ' s UUID
* @ param groupId the primary key of the group
* @ return the matching cp option
* @ throws PortalException if a matching cp option could not be found */
@ Override public CPOption getCPOptionByUuidAndGroupId ( String uuid , long groupId ) throws PortalException { } } | return cpOptionPersistence . findByUUID_G ( uuid , groupId ) ; |
public class MessageUnpacker { /** * Reads payload bytes of binary , extension , or raw string types .
* This consumes bytes , copies them to the specified buffer , and moves forward position of the byte buffer
* until ByteBuffer . remaining ( ) returns 0.
* @ param dst the byte buffer into which the data is read
* @ throws IOException when underlying input throws IOException */
public void readPayload ( ByteBuffer dst ) throws IOException { } } | while ( true ) { int dstRemaining = dst . remaining ( ) ; int bufferRemaining = buffer . size ( ) - position ; if ( bufferRemaining >= dstRemaining ) { buffer . getBytes ( position , dstRemaining , dst ) ; position += dstRemaining ; return ; } buffer . getBytes ( position , bufferRemaining , dst ) ; position += bufferRemaining ; nextBuffer ( ) ; } |
public class AnnotationTxConfigBuilder { /** * Build transaction config for type .
* @ param type type to analyze
* @ param method method to analyze
* @ param useDefaults true to build default config if annotation not found
* @ return tx config for found annotation , null if useDefaults false and default config otherwise */
public static TxConfig buildConfig ( final Class < ? > type , final Method method , final boolean useDefaults ) { } } | final Transactional transactional = findAnnotation ( type , method , Transactional . class , useDefaults ) ; TxConfig res = null ; if ( transactional != null ) { final TxType txType = findAnnotation ( type , method , TxType . class , true ) ; res = new TxConfig ( wrapExceptions ( transactional . rollbackOn ( ) ) , wrapExceptions ( transactional . ignore ( ) ) , txType . value ( ) ) ; } return res ; |
public class AbstractWbsFormat { /** * Retrieves the formatted parent WBS value .
* @ return formatted parent WBS value */
public String getFormattedParentValue ( ) { } } | String result = null ; if ( m_elements . size ( ) > 2 ) { result = joinElements ( m_elements . size ( ) - 2 ) ; } return result ; |
public class RedisMock { /** * / * IRedisString implementations */
@ Override public synchronized Long append ( final String key , final String value ) throws WrongTypeException { } } | checkType ( key , "string" ) ; if ( ! exists ( key ) ) { try { set ( key , value ) ; } catch ( Exception e ) { } } else { stringCache . set ( key , stringCache . get ( key ) + value ) ; } return strlen ( key ) ; |
public class Crossfader { /** * define the left margin of the given view
* @ param view
* @ param leftMargin */
protected void setLeftMargin ( View view , int leftMargin ) { } } | SlidingPaneLayout . LayoutParams lp = ( SlidingPaneLayout . LayoutParams ) view . getLayoutParams ( ) ; lp . leftMargin = leftMargin ; lp . rightMargin = 0 ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN_MR1 ) { lp . setMarginStart ( leftMargin ) ; lp . setMarginEnd ( 0 ) ; } view . setLayoutParams ( lp ) ; |
public class CacheUtil { /** * Download the resource and hash the contents using { @ link Hasher } .
* @ param remoteLocation { @ link String } , the remote resource location
* @ param type { @ link ResourceType } , the resource type
* @ return { @ link File } the downloaded resource file , decompressed if the
* file is in GZIP format
* @ throws ResourceDownloadError Thrown if the remote resource could not
* be downloaded
* @ throws IOException Thrown if an IO error occurred while handling the
* resources */
public static File downloadResource ( String remoteLocation , ResourceType type ) throws ResourceDownloadError { } } | String localResourcePath = getResourceFolderPath ( type ) + File . separator + encodeLocation ( remoteLocation ) ; String localResourceLocation = CacheLookupService . DEFAULT_RESOURCE_FILE_NAME + type . getResourceExtension ( ) ; File latestResource = resolveResource ( remoteLocation , localResourcePath , localResourceLocation ) ; // attempt to download resource hash
String remoteHashLocation = remoteLocation + SHA256_EXTENSION ; String localHashLocation = localResourceLocation + SHA256_EXTENSION ; try { resolveResource ( remoteHashLocation , localResourcePath , localHashLocation ) ; } catch ( ResourceDownloadError e ) { // remote hash does not exist but create local hash
createLocalHash ( latestResource , remoteLocation ) ; } return latestResource ; |
public class NeedlemanWunschEditDistance { /** * Returns a normalized edit distance between 0 and 1 . This is useful if you are comparing or
* aggregating distances of different pairs of strings */
public static double getNormalizedEditDistance ( String source , String target , boolean caseSensitive , int changeCost , int openGapCost , int continueGapCost ) { } } | if ( source . isEmpty ( ) && target . isEmpty ( ) ) { return 0.0 ; } return ( double ) getEditDistance ( source , target , caseSensitive , changeCost , openGapCost , continueGapCost ) / ( double ) getWorstCaseEditDistance ( source . length ( ) , target . length ( ) , changeCost , openGapCost , continueGapCost ) ; |
public class CommonOps_DDF4 { /** * Performs an in - place transpose . This algorithm is only efficient for square
* matrices .
* @ param m The matrix that is to be transposed . Modified . */
public static void transpose ( DMatrix4x4 m ) { } } | double tmp ; tmp = m . a12 ; m . a12 = m . a21 ; m . a21 = tmp ; tmp = m . a13 ; m . a13 = m . a31 ; m . a31 = tmp ; tmp = m . a14 ; m . a14 = m . a41 ; m . a41 = tmp ; tmp = m . a23 ; m . a23 = m . a32 ; m . a32 = tmp ; tmp = m . a24 ; m . a24 = m . a42 ; m . a42 = tmp ; tmp = m . a34 ; m . a34 = m . a43 ; m . a43 = tmp ; |
public class FailureDetailsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( FailureDetails failureDetails , ProtocolMarshaller protocolMarshaller ) { } } | if ( failureDetails == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( failureDetails . getReason ( ) , REASON_BINDING ) ; protocolMarshaller . marshall ( failureDetails . getMessage ( ) , MESSAGE_BINDING ) ; protocolMarshaller . marshall ( failureDetails . getLogFile ( ) , LOGFILE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class EvaluatorImpl { /** * Evaluate a comparison . Arguments are the two values to compare , a flag saying
* whether the test is equality ( false ) or less - than ( true ) , and a flag saying whether
* conversion rules are strict ( false ) or permissive ( true ) .
* @ param val0
* @ param val1
* @ param lessThan
* @ param permissive
* @ return */
protected static Boolean compare ( // was BooleanValue
Object val0 , Object val1 , boolean lessThan , boolean permissive ) { } } | if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . entry ( cclass , "compare" , new Object [ ] { val0 , val1 , new Boolean ( lessThan ) , new Boolean ( permissive ) } ) ; Boolean theReturn = null ; // Encode the types of the two arguments into sixteen cases based on the classification
// Number / Boolean / String / Serializable . All other types ( and nulls ) result in the NULL
// answer .
int ans0 = ( val0 instanceof Number ) // was NumericValue
? 0 : ( val0 instanceof Boolean ) // was BooleanValue
? 1 : ( val0 instanceof String ) ? 2 : ( val0 instanceof Serializable ) ? 3 : 4 ; int ans1 = ( val1 instanceof Number ) // was NumericValue
? 0 : ( val1 instanceof Boolean ) // was BooleanValue
? 1 : ( val1 instanceof String ) ? 2 : ( val1 instanceof Serializable ) ? 3 : 4 ; if ( ans0 > 3 || ans1 > 3 ) { if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , null ) ; return null ; } int category = ans0 * 4 + ans1 ; // Categories : val1
// val0 Number Boolean String Object
// Number 0 1 2 3
// Boolean 4 5 6 7
// String 8 9 10 11
// Object 12 13 14 15
// For the permissive mode ( only ) do the permissive mode casts according to the
// category .
if ( permissive ) switch ( category ) { case 0 : case 5 : case 10 : case 15 : break ; // equal types : no casts needed
case 2 : // Number / String : attempt to cast val1 to number
val1 = castToNumber ( val1 ) ; if ( val1 == null ) { if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , null ) ; return null ; } category = 0 ; break ; case 6 : // Boolean / String : attempt to cast val1 to Boolean
val1 = castToBoolean ( val1 ) ; if ( val1 == null ) { if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , null ) ; return null ; } category = 5 ; break ; case 8 : // String / Number : attempt to cast val0 to number
val0 = castToNumber ( val0 ) ; if ( val0 == null ) { if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , null ) ; return null ; } category = 0 ; break ; case 9 : // String / Boolean : attempt to cast val0 to Boolean
val0 = castToBoolean ( val0 ) ; if ( val0 == null ) { if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , null ) ; return null ; } category = 4 ; break ; default : // Other cases have no legal casts , even in permissive mode
if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , null ) ; return null ; } // Now do the actual evalution
switch ( category ) { case 0 : // both types are Number . Do the arithimetic in the appropriate precision
// depending on the Java binary promotion rules .
int comp = compare ( ( Number ) val0 , ( Number ) val1 ) ; if ( lessThan ) theReturn = Boolean . valueOf ( comp < 0 ) ; else theReturn = Boolean . valueOf ( comp == 0 ) ; if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , theReturn ) ; return theReturn ; case 5 : case 10 : if ( lessThan ) if ( permissive ) { val1 = castToNumber ( val1 ) ; if ( val1 == null ) { if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , null ) ; return null ; } val0 = castToNumber ( val0 ) ; if ( val0 == null ) { if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , null ) ; return null ; } int comp2 = compare ( ( Number ) val0 , ( Number ) val1 ) ; // was ( ( NumericValue ) val0 ) . compareTo ( val1)
theReturn = Boolean . valueOf ( comp2 < 0 ) ; // was BooleanValue
if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , theReturn ) ; return theReturn ; } else { if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , null ) ; return null ; } case 15 : // Both types are comparable and non - Null , but only equality is defined
if ( lessThan ) { if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , null ) ; return null ; } else { theReturn = Boolean . valueOf ( val0 . equals ( val1 ) ) ; if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , theReturn ) ; return theReturn ; } default : // All other cases are disallowed
if ( tc . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( cclass , "compare" , null ) ; return null ; } |
public class SoyListData { /** * Gets the integer index out of a SoyValue key , or throws SoyDataException if the key is not an
* integer .
* @ param key The SoyValue key .
* @ return The index . */
private int getIntegerIndex ( SoyValue key ) { } } | try { return ( ( IntegerData ) key ) . integerValue ( ) ; } catch ( ClassCastException cce ) { try { // TODO : Remove this old bad behavior after existing code is compliant .
return Integer . parseInt ( key . coerceToString ( ) ) ; } catch ( NumberFormatException nfe ) { throw new SoyDataException ( "SoyList accessed with non-integer key (got key type " + key . getClass ( ) . getName ( ) + ")." ) ; } } |
public class QueryResult { /** * Get a shallow copy of the rows in this query result .
* @ return a List & lt ; Row & gt ; shallow copy of the rows in this query result . */
public List < Row > getRowsCopy ( ) { } } | final List < Row > rows = new ArrayList < > ( this . getRowsCount ( ) ) ; for ( Row cells : this ) { rows . add ( cells ) ; } return rows ; |
public class DBPropertiesUpdate { /** * Insert a new Property .
* @ param _ key Key to insert
* @ param _ value value to insert
* @ return ID of the new Property */
private Instance insertNewProp ( final String _key , final String _value ) { } } | Instance ret = null ; try { final Insert insert = new Insert ( DBPropertiesUpdate . TYPE_PROPERTIES ) ; insert . add ( "BundleID" , this . bundleInstance ) ; insert . add ( "Key" , _key ) ; insert . add ( "Default" , _value ) ; insert . executeWithoutAccessCheck ( ) ; ret = insert . getInstance ( ) ; insert . close ( ) ; } catch ( final EFapsException e ) { DBPropertiesUpdate . LOG . error ( "InsertNew(String, String)" , e ) ; } return ret ; |
public class PropertyCollection { /** * Returns a string property value .
* @ param name Property name .
* @ param dflt Default value if a property value is not found .
* @ return Property value or default value if property value not found . */
public String getValue ( String name , String dflt ) { } } | Property prop = getProperty ( name ) ; return prop == null ? dflt : prop . getValue ( ) ; |
public class AzureBatchTaskStatusAlarmHandler { /** * Enable the period alarm to send status updates . */
public synchronized void enableAlarm ( ) { } } | if ( ! this . isAlarmEnabled ) { LOG . log ( Level . FINE , "Enabling the alarm and scheduling it to fire in {0} ms." , this . taskStatusCheckPeriod ) ; this . isAlarmEnabled = true ; this . scheduleAlarm ( ) ; } else { LOG . log ( Level . FINE , "Alarm is already enabled." ) ; } |
public class DatastoreXmlExternalizer { /** * Externalizes a { @ link JdbcDatastore } to a XML element .
* @ param datastore
* @ param doc
* @ return */
public Element toElement ( JdbcDatastore datastore ) { } } | final Element ds = getDocument ( ) . createElement ( "jdbc-datastore" ) ; ds . setAttribute ( "name" , datastore . getName ( ) ) ; if ( ! StringUtils . isNullOrEmpty ( datastore . getDescription ( ) ) ) { ds . setAttribute ( "description" , datastore . getDescription ( ) ) ; } String jndiUrl = datastore . getDatasourceJndiUrl ( ) ; if ( Strings . isNullOrEmpty ( jndiUrl ) ) { appendElement ( ds , "url" , datastore . getJdbcUrl ( ) ) ; appendElement ( ds , "driver" , datastore . getDriverClass ( ) ) ; appendElement ( ds , "username" , datastore . getUsername ( ) ) ; appendElement ( ds , "password" , datastore . getPassword ( ) ) ; appendElement ( ds , "multiple-connections" , datastore . isMultipleConnections ( ) + "" ) ; } else { appendElement ( ds , "datasource-jndi-url" , jndiUrl ) ; } final TableType [ ] tableTypes = datastore . getTableTypes ( ) ; if ( tableTypes != null && tableTypes . length != 0 && ! Arrays . equals ( TableType . DEFAULT_TABLE_TYPES , tableTypes ) ) { final Element tableTypesElement = getDocument ( ) . createElement ( "table-types" ) ; ds . appendChild ( tableTypesElement ) ; for ( final TableType tableType : tableTypes ) { appendElement ( tableTypesElement , "table-type" , tableType . name ( ) ) ; } } final String catalogName = datastore . getCatalogName ( ) ; if ( ! Strings . isNullOrEmpty ( catalogName ) ) { appendElement ( ds , "catalog-name" , catalogName ) ; } return ds ; |
public class Layout { /** * Sets the name of the current layout .
* @ param value New name for the layout . */
public void setName ( String value ) { } } | layoutName = value ; if ( root != null ) { root . getAttributes ( ) . put ( "name" , value ) ; } |
public class PlotCanvas { /** * Remove a graphical shape from the canvas . */
public void remove ( Plot p ) { } } | shapes . remove ( p ) ; JComponent [ ] tb = p . getToolBar ( ) ; if ( tb != null ) { for ( JComponent comp : tb ) { toolbar . remove ( comp ) ; } } repaint ( ) ; |
public class IncludeTag { /** * Adds a parameter to the { @ code PageContext . REQUEST _ SCOPE } scope .
* If a parameter with the same name as { @ code pName } already exists ,
* then the old parameter is first placed in the { @ code OldParameters }
* member variable . When this tag is finished , the old value will be
* restored .
* @ param pName The name of the new parameter to be stored in the
* { @ code PageContext . REQUEST _ SCOPE } scope .
* @ param pValue The value for the parmeter to be stored in the { @ code
* PageContext . REQUEST _ SCOPE } scope . */
public void addParameter ( String pName , Object pValue ) { } } | // Check that we haven ' t already saved this parameter
if ( ! parameterNames . contains ( pName ) ) { parameterNames . add ( pName ) ; // Now check if this parameter already exists in the page .
Object obj = getRequest ( ) . getAttribute ( pName ) ; if ( obj != null ) { oldParameters . put ( pName , obj ) ; } } // Finally , insert the parameter in the request scope .
getRequest ( ) . setAttribute ( pName , pValue ) ; |
public class EndpointInfoBuilder { /** * build the endpointInfo
* @ param ctx
* @ return
* @ throws Exception */
public EndpointInfo build ( EndpointInfoBuilderContext ctx , String serviceImplBeanClassName , EndpointType endpointType ) throws UnableToAdaptException { } } | EndpointInfo endpointInfo = new EndpointInfo ( serviceImplBeanClassName , endpointType ) ; endpointInfo . setBeanName ( ( String ) ctx . getContextEnv ( JaxWsConstants . ENV_ATTRIBUTE_ENDPOINT_BEAN_NAME ) ) ; endpointInfo . setServletName ( ( String ) ctx . getContextEnv ( JaxWsConstants . ENV_ATTRIBUTE_ENDPOINT_SERVLET_NAME ) ) ; invokeConfigurators ( ctx , ConfigMethod . PREPARE , endpointInfo ) ; invokeConfigurators ( ctx , ConfigMethod . CONFIG , endpointInfo ) ; validate ( ctx , endpointInfo ) ; ctx . clearContextEnv ( ) ; return endpointInfo ; |
public class ModelMapper { /** * Returns the TypeMap for the { @ code sourceType } , { @ code destinationType } , creates TypeMap
* automatically if none exists .
* @ param < S > source type
* @ param < D > destination type
* @ throws IllegalArgumentException is { @ code sourceType } , { @ code destinationType } are null */
public < S , D > TypeMap < S , D > typeMap ( Class < S > sourceType , Class < D > destinationType ) { } } | Assert . notNull ( sourceType , "sourceType" ) ; Assert . notNull ( destinationType , "destinationType" ) ; return config . typeMapStore . getOrCreate ( null , sourceType , destinationType , null , engine ) ; |
public class MemcachedConnection { /** * Handle pending writes for the given node .
* @ param node the node to handle writes for .
* @ throws IOException can be raised during writing failures . */
private void handleWrites ( final MemcachedNode node ) throws IOException { } } | node . fillWriteBuffer ( shouldOptimize ) ; boolean canWriteMore = node . getBytesRemainingToWrite ( ) > 0 ; while ( canWriteMore ) { int wrote = node . writeSome ( ) ; metrics . updateHistogram ( OVERALL_AVG_BYTES_WRITE_METRIC , wrote ) ; node . fillWriteBuffer ( shouldOptimize ) ; canWriteMore = wrote > 0 && node . getBytesRemainingToWrite ( ) > 0 ; } |
public class DebugUtil { /** * Prettyprints a large number .
* @ param pBigNumber
* @ return prettyprinted number with dot - separation each 10e3. */
public static String getLargeNumber ( final long pBigNumber ) { } } | StringBuilder buffer = new StringBuilder ( new Long ( pBigNumber ) . toString ( ) ) ; char [ ] number = new Long ( pBigNumber ) . toString ( ) . toCharArray ( ) ; int reverseIndex = 0 ; for ( int i = number . length ; i >= 0 ; i -- ) { reverseIndex ++ ; if ( ( reverseIndex % 3 == 0 ) && ( i > 1 ) ) { buffer = buffer . insert ( i - 1 , '.' ) ; } } return buffer . toString ( ) ; |
public class AnimaQuery { /** * query List < Map >
* @ return List < Map > */
public List < Map < String , Object > > maps ( ) { } } | this . beforeCheck ( ) ; String sql = this . buildSelectSQL ( true ) ; return this . queryListMap ( sql , paramValues ) ; |
public class JolokiaServerConfig { /** * Initialise and validate early in order to fail fast in case of an configuration error */
protected void initConfigAndValidate ( Map < String , String > agentConfig ) { } } | initContext ( ) ; initProtocol ( agentConfig ) ; initAddress ( agentConfig ) ; port = Integer . parseInt ( agentConfig . get ( "port" ) ) ; backlog = Integer . parseInt ( agentConfig . get ( "backlog" ) ) ; initExecutor ( agentConfig ) ; initThreadNamePrefix ( agentConfig ) ; initThreadNr ( agentConfig ) ; initHttpsRelatedSettings ( agentConfig ) ; initAuthenticator ( ) ; |
public class GoogleHadoopFileSystemBase { /** * { @ inheritDoc } */
@ Override public List < String > listXAttrs ( Path path ) throws IOException { } } | logger . atFine ( ) . log ( "GHFS.listXAttrs: %s" , path ) ; checkNotNull ( path , "path should not be null" ) ; FileInfo fileInfo = getGcsFs ( ) . getFileInfo ( getGcsPath ( path ) ) ; List < String > xAttrs = fileInfo . getAttributes ( ) . keySet ( ) . stream ( ) . filter ( this :: isXAttr ) . map ( this :: getXAttrName ) . collect ( Collectors . toCollection ( ArrayList :: new ) ) ; logger . atFine ( ) . log ( "GHFS.listXAttrs:=> %s" , xAttrs ) ; return xAttrs ; |
public class UnitRequest { /** * 从unit的入参argMap内get元素取值 , 返回类型为泛型 ;
* 注意 , 此方法仅仅是为了方便使用 , 不能保证类型转换不出问题 , 需要调用者来保证类型转换正确性 。
* @ throws ClassCastException 类型转换异常 */
@ SuppressWarnings ( "unchecked" ) public < T > T get ( String key ) { } } | return ( T ) argMap . get ( key ) ; |
public class DrawerBuilder { /** * Add a AccountSwitcherHeader which will be used in this drawer instance . Pass true if it should be sticky
* NOTE : This will overwrite any set headerView or stickyHeaderView ( depends on the boolean ) .
* @ param accountHeader
* @ param accountHeaderSticky
* @ return */
public DrawerBuilder withAccountHeader ( @ NonNull AccountHeader accountHeader , boolean accountHeaderSticky ) { } } | this . mAccountHeader = accountHeader ; this . mAccountHeaderSticky = accountHeaderSticky ; return this ; |
public class EnforcementJobRestEntity { /** * Get the list of available enforcements
* < pre >
* GET / enforcements
* Request :
* GET / enforcements HTTP / 1.1
* Accept : application / xml
* Response :
* { @ code
* < ? xml version = " 1.0 " encoding = " UTF - 8 " ? >
* < collection href = " / enforcements " >
* < items offset = " 0 " total = " 1 " >
* < enforcement _ job >
* < agreement _ id > agreement04 < / agreement _ id >
* < enabled > false < / enabled >
* < / enforcement _ job >
* < / items >
* < / collection >
* < / pre >
* Example : < li > curl http : / / localhost : 8080 / sla - service / enforcements < / li >
* @ return XML information with the different details of the different
* enforcements
* @ throws Exception */
@ GET public List < EnforcementJob > getEnforcements ( ) { } } | logger . debug ( "StartOf getEnforcements - REQUEST for /enforcements" ) ; EnforcementJobHelperE enforcementJobHelper = getHelper ( ) ; List < EnforcementJob > enforcementJobList = enforcementJobHelper . getEnforcements ( ) ; logger . debug ( "EndOf getEnforcements" ) ; return enforcementJobList ; |
public class TimeSpinner { /** * Sets the Spinner ' s selection as time in hour and minute . If the time was not in the possible
* selections , a temporary item is created and passed to selectTemporary ( ) .
* @ param hour The hour to be selected .
* @ param minute The minute in the hour . */
public void setSelectedTime ( int hour , int minute ) { } } | final int count = getAdapter ( ) . getCount ( ) - 1 ; int itemPosition = - 1 ; for ( int i = 0 ; i < count ; i ++ ) { final TimeItem item = ( ( TimeItem ) getAdapter ( ) . getItem ( i ) ) ; if ( item . getHour ( ) == hour && item . getMinute ( ) == minute ) { itemPosition = i ; break ; } } if ( itemPosition >= 0 ) setSelection ( itemPosition ) ; else { // create a temporary TimeItem to select :
selectTemporary ( new TimeItem ( formatTime ( hour , minute ) , hour , minute , NO_ID ) ) ; } |
public class ContinuationIncEval { /** * Override this method in subclasses to implement scoring of search states
* and accumulating features .
* @ return */
public void nextState ( IncEvalState prev , IncEvalState next , Object continuation , Environment env , Object denotation , Object diagram , Object otherArgs , LogFunction log ) { } } | next . set ( continuation , env , denotation , diagram , prev . getProb ( ) , null ) ; |
public class SolverAggregatorInterface { /** * Called when a handshake message is received from the aggregator .
* @ param session
* the session on which the message arrived .
* @ param handshakeMessage
* the received message . */
protected void handshakeReceived ( IoSession session , HandshakeMessage handshakeMessage ) { } } | log . debug ( "Received {}" , handshakeMessage ) ; this . receivedHandshake = handshakeMessage ; Boolean handshakeCheck = this . checkHandshake ( ) ; if ( handshakeCheck == null ) { return ; } if ( Boolean . FALSE . equals ( handshakeCheck ) ) { log . warn ( "Handshakes did not match." ) ; this . _disconnect ( ) ; } if ( Boolean . TRUE . equals ( handshakeCheck ) ) { SubscriptionMessage msg = this . generateGenericSubscriptionMessage ( ) ; this . session . write ( msg ) ; this . connected = true ; } |
public class UtilValidate { /** * isTime returns true if string argument time forms a valid time . */
public static boolean isTime ( String time ) { } } | if ( isEmpty ( time ) ) return defaultEmptyOK ; String hour ; String minute ; String second ; int timeColon1 = time . indexOf ( ":" ) ; int timeColon2 = time . lastIndexOf ( ":" ) ; if ( timeColon1 <= 0 ) return false ; hour = time . substring ( 0 , timeColon1 ) ; if ( timeColon1 == timeColon2 ) { minute = time . substring ( timeColon1 + 1 ) ; second = "0" ; } else { minute = time . substring ( timeColon1 + 1 , timeColon2 ) ; second = time . substring ( timeColon2 + 1 ) ; } return isTime ( hour , minute , second ) ; |
public class MetadataService { /** * Replaces { @ link Permission } s of the specified { @ code path } with the specified { @ code permission } . */
private CompletableFuture < Revision > replacePermissionAtPointer ( Author author , String projectName , JsonPointer path , Collection < Permission > permission , String commitSummary ) { } } | final Change < JsonNode > change = Change . ofJsonPatch ( METADATA_JSON , new ReplaceOperation ( path , Jackson . valueToTree ( permission ) ) . toJsonNode ( ) ) ; return metadataRepo . push ( projectName , Project . REPO_DOGMA , author , commitSummary , change ) ; |
public class GuestPortletEntityPreferencesImpl { /** * Gets the session - stored list of IPortletPreferences for the specified request and
* IPortletEntityId .
* @ return List of IPortletPreferences for the entity and session , may be null if no preferences
* have been set . */
@ SuppressWarnings ( "unchecked" ) protected Map < String , IPortletPreference > getSessionPreferences ( IPortletEntityId portletEntityId , HttpServletRequest httpServletRequest ) { } } | final HttpSession session = httpServletRequest . getSession ( ) ; final Map < IPortletEntityId , Map < String , IPortletPreference > > portletPreferences ; // Sync on the session to ensure the Map isn ' t in the process of being created
synchronized ( session ) { portletPreferences = ( Map < IPortletEntityId , Map < String , IPortletPreference > > ) session . getAttribute ( PORTLET_PREFERENCES_MAP_ATTRIBUTE ) ; } if ( portletPreferences == null ) { return null ; } return portletPreferences . get ( portletEntityId ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.