signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class MediaClient { /** * Get a water mark for a given water mark ID .
* @ param watermarkId The ID of water mark .
* @ return The information of the water mark . */
public GetWaterMarkResponse getWaterMark ( String watermarkId ) { } } | GetWaterMarkRequest request = new GetWaterMarkRequest ( ) . withWatermarkId ( watermarkId ) ; return getWaterMark ( request ) ; |
public class CmsScheduleManager { /** * Removes a currently scheduled job from the scheduler . < p >
* @ param cms an OpenCms context object that must have been initialized with " Admin " permissions
* @ param jobId the id of the job to unschedule , obtained with < code > { @ link CmsScheduledJobInfo # getId ( ) } < / code >
* @ return the < code > { @ link CmsScheduledJobInfo } < / code > of the sucessfully unscheduled job ,
* or < code > null < / code > if the job could not be unscheduled
* @ throws CmsRoleViolationException if the user has insufficient role permissions */
public synchronized CmsScheduledJobInfo unscheduleJob ( CmsObject cms , String jobId ) throws CmsRoleViolationException { } } | if ( OpenCms . getRunLevel ( ) > OpenCms . RUNLEVEL_1_CORE_OBJECT ) { // simple unit tests will have runlevel 1 and no CmsObject
OpenCms . getRoleManager ( ) . checkRole ( cms , CmsRole . WORKPLACE_MANAGER ) ; } CmsScheduledJobInfo jobInfo = null ; if ( m_jobs . size ( ) > 0 ) { // try to remove the job from the OpenCms list of jobs
for ( int i = ( m_jobs . size ( ) - 1 ) ; i >= 0 ; i -- ) { CmsScheduledJobInfo job = m_jobs . get ( i ) ; if ( jobId . equals ( job . getId ( ) ) ) { m_jobs . remove ( i ) ; if ( jobInfo != null ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_MULTIPLE_JOBS_FOUND_1 , jobId ) ) ; } jobInfo = job ; } } } if ( ( jobInfo != null ) && jobInfo . isActive ( ) ) { // job currently active , remove it from the Quartz scheduler
try { // try to remove the job from Quartz
m_scheduler . unscheduleJob ( new TriggerKey ( jobId , Scheduler . DEFAULT_GROUP ) ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_UNSCHEDULED_JOB_1 , jobId ) ) ; } } catch ( SchedulerException e ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_UNSCHEDULING_ERROR_1 , jobId ) ) ; } } } return jobInfo ; |
public class WSRdbManagedConnectionImpl { /** * This method is invoked by the connection handle during dissociation to signal the
* ManagedConnection to remove all references to the handle . If the ManagedConnection
* is not associated with the specified handle , this method is a no - op and a warning
* message is traced .
* @ param the connection handle . */
public void dissociateHandle ( WSJdbcConnection connHandle ) { } } | if ( ! cleaningUpHandles && ! removeHandle ( connHandle ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Unable to dissociate Connection handle with current ManagedConnection because it is not currently associated with the ManagedConnection." , connHandle ) ; } |
public class FLVHeader { /** * Writes the FLVHeader to IoBuffer .
* @ param buffer
* IoBuffer to write */
public void write ( IoBuffer buffer ) { } } | // FLV
buffer . put ( signature ) ; // version
buffer . put ( version ) ; // flags
buffer . put ( ( byte ) ( FLV_HEADER_FLAG_HAS_AUDIO * ( flagAudio ? 1 : 0 ) + FLV_HEADER_FLAG_HAS_VIDEO * ( flagVideo ? 1 : 0 ) ) ) ; // data offset
buffer . putInt ( 9 ) ; // previous tag size 0 ( this is the " first " tag )
buffer . putInt ( 0 ) ; buffer . flip ( ) ; |
public class PreferenceFragment { /** * Initializes the preference , which allows to show the alert dialog . */
private void initializeShowAlertDialogPreference ( ) { } } | Preference preference = findPreference ( getString ( R . string . show_alert_dialog_preference_key ) ) ; preference . setOnPreferenceClickListener ( new OnPreferenceClickListener ( ) { @ Override public boolean onPreferenceClick ( final Preference preference ) { initializeAlertDialog ( ) ; alertDialog . setShowAnimation ( createRectangularRevealAnimation ( preference ) ) ; alertDialog . setDismissAnimation ( createRectangularRevealAnimation ( preference ) ) ; alertDialog . setCancelAnimation ( createRectangularRevealAnimation ( preference ) ) ; alertDialog . show ( ) ; return true ; } } ) ; |
public class CalendarSerializer { /** * Serializes a Calendar using the Facebook date format ( YYYY - MM - DDThh : mm ) .
* @ param src
* the src
* @ param typeOfSrc
* the type of src
* @ param context
* the context
* @ return the json element */
public JsonElement serialize ( Calendar src , Type typeOfSrc , JsonSerializationContext context ) { } } | int year = src . get ( Calendar . YEAR ) ; String month = this . formatter . format ( Double . valueOf ( src . get ( Calendar . MONTH ) + 1 ) ) ; String day = this . formatter . format ( Double . valueOf ( src . get ( Calendar . DAY_OF_MONTH ) ) ) ; String hour = this . formatter . format ( Double . valueOf ( src . get ( Calendar . HOUR_OF_DAY ) ) ) ; String minute = this . formatter . format ( Double . valueOf ( src . get ( Calendar . MINUTE ) ) ) ; String formattedDate = year + "-" + month + "-" + day + "T" + hour + ":" + minute ; return context . serialize ( formattedDate ) ; |
public class appfwprofile_xmlsqlinjection_binding { /** * Use this API to fetch appfwprofile _ xmlsqlinjection _ binding resources of given name . */
public static appfwprofile_xmlsqlinjection_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | appfwprofile_xmlsqlinjection_binding obj = new appfwprofile_xmlsqlinjection_binding ( ) ; obj . set_name ( name ) ; appfwprofile_xmlsqlinjection_binding response [ ] = ( appfwprofile_xmlsqlinjection_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class AnnotationRef { /** * thrown */
private Object invokeExplosively ( T instance , Method key ) { } } | Object invoke ; try { invoke = key . invoke ( instance ) ; } catch ( ReflectiveOperationException e ) { // these are unexpected since annotation accessors should be public
throw new RuntimeException ( e ) ; } return invoke ; |
public class RLSSuspendTokenManager { /** * Cancels the suspend request that returned the matching RLSSuspendToken .
* The suspend call ' s alarm , if there is one , will also be cancelled
* In the event that the suspend token is null or not recognized
* throws an RLSInvalidSuspendTokenException
* @ param token
* @ throws RLSInvalidSuspendTokenException */
void registerResume ( RLSSuspendToken token ) throws RLSInvalidSuspendTokenException { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "registerResume" , token ) ; if ( token != null && _tokenMap . containsKey ( token ) ) { // Cast the token to its actual type
// RLSSuspendTokenImpl tokenImpl = ( RLSSuspendTokenImpl ) token ;
synchronized ( _tokenMap ) { // Remove the token and any associated alarm from the map
Alarm alarm = ( Alarm ) _tokenMap . remove ( token /* tokenImpl */
) ; // This suspend token is still active - check if
// it has an alarm associated with it , and if so , cancel
if ( alarm != null ) { alarm . cancel ( ) ; } } } else { // Supplied token is null or could not be found in token map
if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "Throw RLSInvalidSuspendTokenException - suspend token is not recognised" ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "registerResume" , "RLSInvalidSuspendTokenException" ) ; throw new RLSInvalidSuspendTokenException ( ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "registerResume" ) ; |
public class HexDumpController { /** * Command to select a document from the POIFS for viewing .
* @ param entry document to view */
public void viewDocument ( DocumentEntry entry ) { } } | InputStream is = null ; try { is = new DocumentInputStream ( entry ) ; byte [ ] data = new byte [ is . available ( ) ] ; is . read ( data ) ; m_model . setData ( data ) ; updateTables ( ) ; } catch ( IOException ex ) { throw new RuntimeException ( ex ) ; } finally { StreamHelper . closeQuietly ( is ) ; } |
public class AbstractGISElement { /** * Sets the container of this MapElement .
* @ param container the new container .
* @ return the success state of the operation . */
public boolean setContainer ( C container ) { } } | this . mapContainer = container == null ? null : new WeakReference < > ( container ) ; return true ; |
public class CryptoBox { /** * Given the iv , decrypt the provided data
* @ param iv initialization vector
* @ param cipherText data to be decrypted
* @ param encoder encoder provided RAW or HEX
* @ return byte array with the plain text */
public byte [ ] decrypt ( String iv , String cipherText , Encoder encoder ) { } } | return decrypt ( encoder . decode ( iv ) , encoder . decode ( cipherText ) ) ; |
public class TcpListener { /** * or was denied because of accept filters . */
private SocketChannel accept ( ) throws IOException { } } | // The situation where connection cannot be accepted due to insufficient
// resources is considered valid and treated by ignoring the connection .
// Accept one connection and deal with different failure modes .
assert ( fd != null ) ; SocketChannel sock = fd . accept ( ) ; if ( ! options . tcpAcceptFilters . isEmpty ( ) ) { boolean matched = false ; for ( TcpAddress . TcpAddressMask am : options . tcpAcceptFilters ) { if ( am . matchAddress ( address . address ( ) ) ) { matched = true ; break ; } } if ( ! matched ) { try { sock . close ( ) ; } catch ( IOException e ) { } return null ; } } if ( options . tos != 0 ) { TcpUtils . setIpTypeOfService ( sock , options . tos ) ; } // Set the socket buffer limits for the underlying socket .
if ( options . sndbuf != 0 ) { TcpUtils . setTcpSendBuffer ( sock , options . sndbuf ) ; } if ( options . rcvbuf != 0 ) { TcpUtils . setTcpReceiveBuffer ( sock , options . rcvbuf ) ; } if ( ! isWindows ) { TcpUtils . setReuseAddress ( sock , true ) ; } return sock ; |
public class ByteBufferUtils { /** * Decode a String representation .
* @ param buffer a byte buffer holding the string representation
* @ param charset the String encoding charset
* @ return the decoded string */
public static String string ( ByteBuffer buffer , Charset charset ) throws CharacterCodingException { } } | try { return charset . newDecoder ( ) . decode ( buffer . duplicate ( ) ) . toString ( ) ; } catch ( CharacterCodingException e ) { throw Exceptions . runtime ( e ) ; } |
public class Schema { /** * Returns if this has any mapping for the specified cell .
* @ param cell the cell name
* @ return { @ code true } if there is any mapping for the cell , { @ code false } otherwise */
public boolean mapsCell ( String cell ) { } } | return mappers . values ( ) . stream ( ) . anyMatch ( mapper -> mapper . mapsCell ( cell ) ) ; |
public class AmazonEC2Client { /** * [ VPC only ] Updates the description of an egress ( outbound ) security group rule . You can replace an existing
* description , or add a description to a rule that did not have one previously .
* You specify the description as part of the IP permissions structure . You can remove a description for a security
* group rule by omitting the description parameter in the request .
* @ param updateSecurityGroupRuleDescriptionsEgressRequest
* @ return Result of the UpdateSecurityGroupRuleDescriptionsEgress operation returned by the service .
* @ sample AmazonEC2 . UpdateSecurityGroupRuleDescriptionsEgress
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / UpdateSecurityGroupRuleDescriptionsEgress "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateSecurityGroupRuleDescriptionsEgressResult updateSecurityGroupRuleDescriptionsEgress ( UpdateSecurityGroupRuleDescriptionsEgressRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateSecurityGroupRuleDescriptionsEgress ( request ) ; |
public class DescribeTrainingJobRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeTrainingJobRequest describeTrainingJobRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeTrainingJobRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeTrainingJobRequest . getTrainingJobName ( ) , TRAININGJOBNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class NimbusServer { /** * handle manual conf changes , check every 15 sec */
private void mkRefreshConfThread ( final NimbusData nimbusData ) { } } | nimbusData . getScheduExec ( ) . scheduleAtFixedRate ( new RunnableCallback ( ) { @ Override public void run ( ) { LOG . debug ( "checking changes in storm.yaml..." ) ; Map newConf = Utils . readStormConfig ( ) ; if ( Utils . isConfigChanged ( nimbusData . getConf ( ) , newConf ) ) { LOG . warn ( "detected changes in storm.yaml, updating..." ) ; synchronized ( nimbusData . getConf ( ) ) { nimbusData . getConf ( ) . clear ( ) ; nimbusData . getConf ( ) . putAll ( newConf ) ; } RefreshableComponents . refresh ( newConf ) ; } else { LOG . debug ( "no changes detected, stay put." ) ; } } @ Override public Object getResult ( ) { return 15 ; } } , 15 , 15 , TimeUnit . SECONDS ) ; LOG . info ( "Successfully init configuration refresh thread" ) ; |
public class DrizzlePreparedStatement { /** * Sets the designated parameter to a < code > InputStream < / code > object . The inputstream must contain the number of
* characters specified by length otherwise a < code > SQLException < / code > will be generated when the
* < code > PreparedStatement < / code > is executed . This method differs from the < code > setBinaryStream ( int , InputStream ,
* int ) < / code > method because it informs the driver that the parameter value should be sent to the server as a
* < code > BLOB < / code > . When the < code > setBinaryStream < / code > method is used , the driver may have to do extra work to
* determine whether the parameter data should be sent to the server as a < code > LONGVARBINARY < / code > or a
* < code > BLOB < / code >
* @ param parameterIndex index of the first parameter is 1 , the second is 2 , . . .
* @ param inputStream An object that contains the data to set the parameter value to .
* @ param length the number of bytes in the parameter data .
* @ throws java . sql . SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement ;
* if a database access error occurs ; this method is called on a closed
* < code > PreparedStatement < / code > ; if the length specified is less than zero or if the
* number of bytes in the inputstream does not match the specfied length .
* @ throws java . sql . SQLFeatureNotSupportedException
* if the JDBC driver does not support this method
* @ since 1.6 */
public void setBlob ( final int parameterIndex , final InputStream inputStream , final long length ) throws SQLException { } } | if ( inputStream == null ) { setNull ( parameterIndex , Types . BLOB ) ; return ; } try { setParameter ( parameterIndex , new StreamParameter ( inputStream , length ) ) ; } catch ( IOException e ) { throw SQLExceptionMapper . getSQLException ( "Could not read stream" , e ) ; } |
public class ValueReaderLocator { /** * / * Factory methods for non - Bean readers */
public ValueReader enumReader ( Class < ? > enumType ) { } } | Object [ ] enums = enumType . getEnumConstants ( ) ; Map < String , Object > byName = new HashMap < String , Object > ( ) ; for ( Object e : enums ) { byName . put ( e . toString ( ) , e ) ; } return new EnumReader ( enums , byName ) ; |
public class Gridmix { /** * Create each component in the pipeline and start it .
* @ param conf Configuration data , no keys specific to this context
* @ param traceIn Either a Path to the trace data or & quot ; - & quot ; for
* stdin
* @ param ioPath Path from which input data is read
* @ param scratchDir Path into which job output is written
* @ param startFlag Semaphore for starting job trace pipeline */
private void startThreads ( Configuration conf , String traceIn , Path ioPath , Path scratchDir , CountDownLatch startFlag ) throws IOException { } } | monitor = createJobMonitor ( ) ; submitter = createJobSubmitter ( monitor , conf . getInt ( GRIDMIX_SUB_THR , Runtime . getRuntime ( ) . availableProcessors ( ) + 1 ) , conf . getInt ( GRIDMIX_QUE_DEP , 5 ) , new FilePool ( conf , ioPath ) ) ; factory = createJobFactory ( submitter , traceIn , scratchDir , conf , startFlag ) ; monitor . start ( ) ; submitter . start ( ) ; factory . start ( ) ; |
public class ColumnMajorSparseMatrix { /** * Creates a block { @ link ColumnMajorSparseMatrix } of the given blocks { @ code a } ,
* { @ code b } , { @ code c } and { @ code d } . */
public static ColumnMajorSparseMatrix block ( Matrix a , Matrix b , Matrix c , Matrix d ) { } } | return CCSMatrix . block ( a , b , c , d ) ; |
public class PlanNode { /** * Add the supplied node to the end of the list of children .
* @ param child the node that should be added as the last child ; may not be null */
public void addLastChild ( PlanNode child ) { } } | assert child != null ; this . children . addLast ( child ) ; child . removeFromParent ( ) ; child . parent = this ; |
public class FTPConnection { /** * Sends an array of bytes through a data connection
* @ param data The data to be sent
* @ throws ResponseException When an error occurs */
public void sendData ( byte [ ] data ) throws ResponseException { } } | if ( con . isClosed ( ) ) return ; Socket socket = null ; try { socket = conHandler . createDataSocket ( ) ; dataConnections . add ( socket ) ; OutputStream out = socket . getOutputStream ( ) ; Utils . write ( out , data , data . length , conHandler . isAsciiMode ( ) ) ; bytesTransferred += data . length ; out . flush ( ) ; Utils . closeQuietly ( out ) ; Utils . closeQuietly ( socket ) ; } catch ( SocketException ex ) { throw new ResponseException ( 426 , "Transfer aborted" ) ; } catch ( IOException ex ) { throw new ResponseException ( 425 , "An error occurred while transferring the data" ) ; } finally { onUpdate ( ) ; if ( socket != null ) dataConnections . remove ( socket ) ; } |
public class Preconditions { /** * Checks that a string is not null or empty .
* @ param value the string to be tested .
* @ param message the message for the exception in case the string is empty .
* @ throws IllegalArgumentException if the string is empty . */
public static void notEmpty ( String value , String message ) throws IllegalArgumentException { } } | if ( value == null || "" . equals ( value . trim ( ) ) ) { throw new IllegalArgumentException ( "A precondition failed: " + message ) ; } |
public class JvmGenericTypeImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setAnonymous ( boolean newAnonymous ) { } } | boolean oldAnonymous = anonymous ; anonymous = newAnonymous ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , TypesPackage . JVM_GENERIC_TYPE__ANONYMOUS , oldAnonymous , anonymous ) ) ; |
public class ChronosServer { /** * Initialize Thrift server of ChronosServer .
* @ throws TTransportException when error to initialize thrift server
* @ throws FatalChronosException when set a smaller timestamp in ZooKeeper
* @ throws ChronosException when error to set timestamp in ZooKeeper */
private void initThriftServer ( ) throws TTransportException , FatalChronosException , ChronosException { } } | int maxThread = Integer . parseInt ( properties . getProperty ( MAX_THREAD , String . valueOf ( Integer . MAX_VALUE ) ) ) ; String serverHost = properties . getProperty ( FailoverServer . SERVER_HOST ) ; int serverPort = Integer . parseInt ( properties . getProperty ( FailoverServer . SERVER_PORT ) ) ; TServerSocket serverTransport = new TServerSocket ( new InetSocketAddress ( serverHost , serverPort ) ) ; Factory proFactory = new TBinaryProtocol . Factory ( ) ; chronosImplement = new ChronosImplement ( properties , chronosServerWatcher ) ; TProcessor processor = new ChronosService . Processor ( chronosImplement ) ; Args rpcArgs = new Args ( serverTransport ) ; rpcArgs . processor ( processor ) ; rpcArgs . protocolFactory ( proFactory ) ; rpcArgs . maxWorkerThreads ( maxThread ) ; thriftServer = new TThreadPoolServer ( rpcArgs ) ; |
public class DockerAccessFactory { /** * Return a list of providers which could delive connection parameters from
* calling external commands . For this plugin this is docker - machine , but can be overridden
* to add other config options , too .
* @ return list of providers or < code > null < / code > if none are applicable */
private List < DockerConnectionDetector . DockerHostProvider > getDefaultDockerHostProviders ( DockerAccessContext dockerAccessContext , Logger log ) { } } | DockerMachineConfiguration config = dockerAccessContext . getMachine ( ) ; if ( dockerAccessContext . isSkipMachine ( ) ) { config = null ; } else if ( config == null ) { Properties projectProps = dockerAccessContext . getProjectProperties ( ) ; if ( projectProps . containsKey ( DockerMachineConfiguration . DOCKER_MACHINE_NAME_PROP ) ) { config = new DockerMachineConfiguration ( projectProps . getProperty ( DockerMachineConfiguration . DOCKER_MACHINE_NAME_PROP ) , projectProps . getProperty ( DockerMachineConfiguration . DOCKER_MACHINE_AUTO_CREATE_PROP ) , projectProps . getProperty ( DockerMachineConfiguration . DOCKER_MACHINE_REGENERATE_CERTS_AFTER_START_PROP ) ) ; } } List < DockerConnectionDetector . DockerHostProvider > ret = new ArrayList < > ( ) ; ret . add ( new DockerMachine ( log , config ) ) ; return ret ; |
public class ImageViewAware { /** * { @ inheritDoc }
* < br / >
* 3 ) Get < b > maxWidth < / b > . */
@ Override public int getWidth ( ) { } } | int width = super . getWidth ( ) ; if ( width <= 0 ) { ImageView imageView = ( ImageView ) viewRef . get ( ) ; if ( imageView != null ) { width = getImageViewFieldValue ( imageView , "mMaxWidth" ) ; // Check maxWidth parameter
} } return width ; |
public class BplusTree { /** * Find a Key in the Tree
* @ param key to find
* @ return Value found or null if not */
public synchronized V get ( final K key ) { } } | if ( ! validState ) { throw new InvalidStateException ( ) ; } if ( _isEmpty ( ) ) { return null ; } if ( key == null ) { return null ; } try { final LeafNode < K , V > node = findLeafNode ( key , false ) ; if ( node == null ) { return null ; } int slot = node . findSlotByKey ( key ) ; if ( slot >= 0 ) { return node . values [ slot ] ; } return null ; } finally { releaseNodes ( ) ; } |
public class VdmDebugState { /** * Sets a new state , an Assert . IsLegal is asserted if the given state is not valid based on the current state
* @ param newState
* the new state to change into */
public synchronized void setState ( DebugState newState ) { } } | if ( ! states . contains ( newState ) ) { switch ( newState ) { case Disconnected : Assert . isLegal ( canChange ( DebugState . Disconnected ) , "Cannot disconnect a terminated state" ) ; case Terminated : Assert . isLegal ( canChange ( DebugState . Terminated ) , "Cannot terminate a terminated state" ) ; states . clear ( ) ; states . add ( newState ) ; break ; case Suspended : Assert . isLegal ( canChange ( DebugState . Suspended ) , "Can only suspend if resumed" ) ; states . remove ( DebugState . Resumed ) ; states . add ( newState ) ; break ; case IsStepping : Assert . isLegal ( canChange ( DebugState . IsStepping ) , "Cannot step if not suspended" ) ; states . add ( newState ) ; break ; case Resumed : Assert . isLegal ( canChange ( DebugState . Resumed ) , "Cannot resume in a terminated state" ) ; if ( states . contains ( DebugState . IsStepping ) ) { states . clear ( ) ; states . add ( DebugState . IsStepping ) ; } else { states . clear ( ) ; } states . add ( newState ) ; break ; case Deadlocked : states . add ( newState ) ; break ; } } |
public class DssatCRIDHelper { /** * get 2 - bit version of crop id by given string
* @ param str input string of 3 - bit crid
* @ return 2 - bit version of crop id */
public static String get2BitCrid ( String str ) { } } | if ( str != null ) { String crid = LookupCodes . lookupCode ( "CRID" , str , "DSSAT" ) ; if ( crid . equals ( str ) && crid . length ( ) > 2 ) { crid = def2BitVal ; } return crid . toUpperCase ( ) ; } else { return def2BitVal ; } // if ( str = = null ) {
// return def2BitVal ;
// } else if ( str . length ( ) = = 2 ) {
// return str ;
// String ret = crids . get ( str ) ;
// if ( ret = = null | | ret . equals ( " " ) ) {
// return str ;
// } else {
// return ret ; |
public class SortedIntArraySet { /** * Resize array */
private final void resizeArray ( ) { } } | if ( log . isDebugEnabled ( ) ) { log . debug ( "resizeArray size=" + keys . length + " newsize=" + ( keys . length << 1 ) ) ; } final int [ ] newkeys = new int [ keys . length << 1 ] ; // double space
System . arraycopy ( keys , 0 , newkeys , 0 , allocated ) ; keys = newkeys ; |
public class PolylineUtils { /** * Basic distance - based simplification .
* @ param points a list of points to be simplified
* @ param sqTolerance square of amount of simplification
* @ return a list of simplified points */
private static List < Point > simplifyRadialDist ( List < Point > points , double sqTolerance ) { } } | Point prevPoint = points . get ( 0 ) ; ArrayList < Point > newPoints = new ArrayList < > ( ) ; newPoints . add ( prevPoint ) ; Point point = null ; for ( int i = 1 , len = points . size ( ) ; i < len ; i ++ ) { point = points . get ( i ) ; if ( getSqDist ( point , prevPoint ) > sqTolerance ) { newPoints . add ( point ) ; prevPoint = point ; } } if ( ! prevPoint . equals ( point ) ) { newPoints . add ( point ) ; } return newPoints ; |
public class DefaultPromiseAdapter { /** * Converts a { @ link Consumer } for an { @ link AsyncResult } { @ link Handler } to a { @ link Promise }
* @ param consumer
* @ param < T >
* @ return */
@ Override public < T > Promise < T > toPromise ( Consumer < Handler < AsyncResult < T > > > consumer ) { } } | Deferred < T > d = when . defer ( ) ; consumer . accept ( toHandler ( d ) ) ; return d . getPromise ( ) ; |
public class WorkteamMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Workteam workteam , ProtocolMarshaller protocolMarshaller ) { } } | if ( workteam == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( workteam . getWorkteamName ( ) , WORKTEAMNAME_BINDING ) ; protocolMarshaller . marshall ( workteam . getMemberDefinitions ( ) , MEMBERDEFINITIONS_BINDING ) ; protocolMarshaller . marshall ( workteam . getWorkteamArn ( ) , WORKTEAMARN_BINDING ) ; protocolMarshaller . marshall ( workteam . getProductListingIds ( ) , PRODUCTLISTINGIDS_BINDING ) ; protocolMarshaller . marshall ( workteam . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( workteam . getSubDomain ( ) , SUBDOMAIN_BINDING ) ; protocolMarshaller . marshall ( workteam . getCreateDate ( ) , CREATEDATE_BINDING ) ; protocolMarshaller . marshall ( workteam . getLastUpdatedDate ( ) , LASTUPDATEDDATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ThreadUtils { /** * A null - safe method for getting a snapshot of the Thread ' s current stack trace .
* @ param thread the Thread from which the stack trace is returned .
* @ return an array of StackTraceElements indicating the stack trace of the specified Thread ,
* or an empty StackTraceElement array if the Thread is null .
* @ see java . lang . Thread # getStackTrace ( )
* @ see java . lang . StackTraceElement */
@ NullSafe public static StackTraceElement [ ] getStackTrace ( Thread thread ) { } } | return ( thread != null ? thread . getStackTrace ( ) : new StackTraceElement [ 0 ] ) ; |
public class NarPackageMojo { /** * be built , POM ~ / = artifacts ! */
@ Override public final void narExecute ( ) throws MojoExecutionException , MojoFailureException { } } | // let the layout decide which nars to attach
getLayout ( ) . attachNars ( getTargetDirectory ( ) , this . archiverManager , this . projectHelper , getMavenProject ( ) ) ; |
public class StorageAccountsInner { /** * Lists the Azure Storage containers , if any , associated with the specified Data Lake Analytics and Azure Storage account combination . The response includes a link to the next page of results , if any .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; StorageContainerInner & gt ; object */
public Observable < Page < StorageContainerInner > > listStorageContainersNextAsync ( final String nextPageLink ) { } } | return listStorageContainersNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < StorageContainerInner > > , Page < StorageContainerInner > > ( ) { @ Override public Page < StorageContainerInner > call ( ServiceResponse < Page < StorageContainerInner > > response ) { return response . body ( ) ; } } ) ; |
public class PrefixMappedItemCache { /** * Checks if the prefix map contains an exact entry for the given bucket / objectName . */
@ VisibleForTesting boolean containsListRaw ( String bucket , String objectName ) { } } | return prefixMap . containsKey ( new PrefixKey ( bucket , objectName ) ) ; |
public class OrchidUtils { /** * Returns the first item in a list if possible , returning null otherwise .
* @ param items the list
* @ param < T > the type of items in the list
* @ return the first item in the list if the list is not null and not empty , null otherwise */
public static < T > T first ( List < T > items ) { } } | if ( items != null && items . size ( ) > 0 ) { return items . get ( 0 ) ; } return null ; |
public class AWSIoT1ClickProjectsClient { /** * Updates a placement with the given attributes . To clear an attribute , pass an empty value ( i . e . , " " ) .
* @ param updatePlacementRequest
* @ return Result of the UpdatePlacement operation returned by the service .
* @ throws InternalFailureException
* @ throws InvalidRequestException
* @ throws ResourceNotFoundException
* @ throws TooManyRequestsException
* @ sample AWSIoT1ClickProjects . UpdatePlacement
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / iot1click - projects - 2018-05-14 / UpdatePlacement "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdatePlacementResult updatePlacement ( UpdatePlacementRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdatePlacement ( request ) ; |
public class GridBagLayoutFormBuilder { /** * Appends a label and field to the end of the current line .
* The label will be to the left of the field , and be right - justified .
* < br / >
* The field will " grow " horizontally as space allows .
* @ param propertyName the name of the property to create the controls for
* @ param colSpan the number of columns the field should span
* @ return " this " to make it easier to string together append calls
* @ see FormComponentInterceptor # processLabel ( String , JComponent ) */
public GridBagLayoutFormBuilder appendLabeledField ( String propertyName , final JComponent field , LabelOrientation labelOrientation , int colSpan , int rowSpan , boolean expandX , boolean expandY ) { } } | builder . appendLabeledField ( propertyName , field , labelOrientation , colSpan , rowSpan , expandX , expandY ) ; return this ; |
public class Prefs { /** * Stores a long value .
* @ param key The name of the preference to modify .
* @ param value The new value for the preference .
* @ see android . content . SharedPreferences . Editor # putLong ( String , long ) */
public static void putLong ( final String key , final long value ) { } } | final Editor editor = getPreferences ( ) . edit ( ) ; editor . putLong ( key , value ) ; editor . apply ( ) ; |
public class AbstrCFMLScriptTransformer { /** * Liest ein return Statement ein . < br / >
* EBNF : < br / >
* < code > spaces expressionStatement spaces ; < / code >
* @ return return Statement
* @ throws TemplateException */
private final Return returnStatement ( Data data ) throws TemplateException { } } | if ( ! data . srcCode . forwardIfCurrentAndNoVarExt ( "return" ) ) return null ; Position line = data . srcCode . getPosition ( ) ; Return rtn ; comments ( data ) ; if ( checkSemiColonLineFeed ( data , false , false , false ) ) rtn = new Return ( data . factory , line , data . srcCode . getPosition ( ) ) ; else { Expression expr = expression ( data ) ; checkSemiColonLineFeed ( data , true , true , false ) ; rtn = new Return ( expr , line , data . srcCode . getPosition ( ) ) ; } comments ( data ) ; return rtn ; |
public class Main { /** * Java function to verify if the frequency of every digit does not exceed its own value .
* Examples :
* isValid ( 1234 ) - > True
* isValid ( 51241 ) - > False
* isValid ( 321 ) - > True
* @ param n input number .
* @ return if n is a valid number . */
public static boolean isValid ( int n ) { } public static void main ( String [ ] args ) { System . out . println ( isValid ( 1234 ) ) ; System . out . println ( isValid ( 51241 ) ) ; System . out . println ( isValid ( 321 ) ) ; } } | for ( int i = 0 ; i < 10 ; i ++ ) { int temp = n ; int frequency = 0 ; while ( temp > 0 ) { if ( ( temp % 10 ) == i ) { frequency += 1 ; } if ( frequency > i ) { return false ; } temp /= 10 ; } } return true ; |
public class AppServiceEnvironmentsInner { /** * Resume an App Service Environment .
* Resume an App Service Environment .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service Environment .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < Void > syncVirtualNetworkInfoAsync ( String resourceGroupName , String name ) { } } | return syncVirtualNetworkInfoWithServiceResponseAsync ( resourceGroupName , name ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class DistortImageOps { /** * Finds an axis - aligned bounding box which would contain a image after it has been transformed .
* A sanity check is done to made sure it is contained inside the destination image ' s bounds .
* If it is totally outside then a rectangle with negative width or height is returned .
* @ param srcWidth Width of the source image
* @ param srcHeight Height of the source image
* @ param dstWidth Width of the destination image
* @ param dstHeight Height of the destination image
* @ param transform Transform being applied to the image
* @ return Bounding box */
public static RectangleLength2D_I32 boundBox ( int srcWidth , int srcHeight , int dstWidth , int dstHeight , Point2D_F32 work , PixelTransform < Point2D_F32 > transform ) { } } | RectangleLength2D_I32 ret = boundBox ( srcWidth , srcHeight , work , transform ) ; int x0 = ret . x0 ; int y0 = ret . y0 ; int x1 = ret . x0 + ret . width ; int y1 = ret . y0 + ret . height ; if ( x0 < 0 ) x0 = 0 ; if ( x1 > dstWidth ) x1 = dstWidth ; if ( y0 < 0 ) y0 = 0 ; if ( y1 > dstHeight ) y1 = dstHeight ; return new RectangleLength2D_I32 ( x0 , y0 , x1 - x0 , y1 - y0 ) ; |
public class Facebook { /** * Full authorize method .
* Starts either an Activity or a dialog which prompts the user to log in to
* Facebook and grant the requested permissions to the given application .
* This method will , when possible , use Facebook ' s single sign - on for
* Android to obtain an access token . This involves proxying a call through
* the Facebook for Android stand - alone application , which will handle the
* authentication flow , and return an OAuth access token for making API
* calls .
* Because this process will not be available for all users , if single
* sign - on is not possible , this method will automatically fall back to the
* OAuth 2.0 User - Agent flow . In this flow , the user credentials are handled
* by Facebook in an embedded WebView , not by the client application . As
* such , the dialog makes a network request and renders HTML content rather
* than a native UI . The access token is retrieved from a redirect to a
* special URL that the WebView handles .
* Note that User credentials could be handled natively using the OAuth 2.0
* Username and Password Flow , but this is not supported by this SDK .
* See http : / / developers . facebook . com / docs / authentication / and
* http : / / wiki . oauth . net / OAuth - 2 for more details .
* Note that this method is asynchronous and the callback will be invoked in
* the original calling thread ( not in a background thread ) .
* Also note that requests may be made to the API without calling authorize
* first , in which case only public information is returned .
* IMPORTANT : Note that single sign - on authentication will not function
* correctly if you do not include a call to the authorizeCallback ( ) method
* in your onActivityResult ( ) function ! Please see below for more
* information . single sign - on may be disabled by passing FORCE _ DIALOG _ AUTH
* as the activityCode parameter in your call to authorize ( ) .
* This method is deprecated . See { @ link Facebook } and { @ link Session } for more info .
* @ param activity
* The Android activity in which we want to display the
* authorization dialog .
* @ param permissions
* A list of permissions required for this application : e . g .
* " read _ stream " , " publish _ stream " , " offline _ access " , etc . see
* http : / / developers . facebook . com / docs / authentication / permissions
* This parameter should not be null - - if you do not require any
* permissions , then pass in an empty String array .
* @ param activityCode
* Single sign - on requires an activity result to be called back
* to the client application - - if you are waiting on other
* activities to return data , pass a custom activity code here to
* avoid collisions . If you would like to force the use of legacy
* dialog - based authorization , pass FORCE _ DIALOG _ AUTH for this
* parameter . Otherwise just omit this parameter and Facebook
* will use a suitable default . See
* http : / / developer . android . com / reference / android /
* app / Activity . html for more information .
* @ param listener
* Callback interface for notifying the calling application when
* the authentication dialog has completed , failed , or been
* canceled . */
@ Deprecated public void authorize ( Activity activity , String [ ] permissions , int activityCode , final DialogListener listener ) { } } | SessionLoginBehavior behavior = ( activityCode >= 0 ) ? SessionLoginBehavior . SSO_WITH_FALLBACK : SessionLoginBehavior . SUPPRESS_SSO ; authorize ( activity , permissions , activityCode , behavior , listener ) ; |
public class Picasso { /** * Invalidate all memory cached images for the specified { @ code path } . You can also pass a
* { @ linkplain RequestCreator # stableKey stable key } .
* @ see # invalidate ( Uri )
* @ see # invalidate ( File ) */
public void invalidate ( @ Nullable String path ) { } } | if ( path != null ) { invalidate ( Uri . parse ( path ) ) ; } |
public class CPDisplayLayoutLocalServiceUtil { /** * NOTE FOR DEVELOPERS :
* Never modify this class directly . Add custom service methods to { @ link com . liferay . commerce . product . service . impl . CPDisplayLayoutLocalServiceImpl } and rerun ServiceBuilder to regenerate this class . */
public static com . liferay . commerce . product . model . CPDisplayLayout addCPDisplayLayout ( Class < ? > clazz , long classPK , String layoutUuid , com . liferay . portal . kernel . service . ServiceContext serviceContext ) { } } | return getService ( ) . addCPDisplayLayout ( clazz , classPK , layoutUuid , serviceContext ) ; |
public class Database { /** * Finds a unique result from database , converting the database row to double using default mechanisms .
* Returns empty if there are no results or if single null result is returned .
* @ throws NonUniqueResultException if there are multiple result rows */
public @ NotNull OptionalDouble findOptionalDouble ( @ NotNull SqlQuery query ) { } } | Optional < Double > value = findOptional ( Double . class , query ) ; return value . isPresent ( ) ? OptionalDouble . of ( value . get ( ) ) : OptionalDouble . empty ( ) ; |
public class HtmlTree { /** * Generates a DL tag with some content .
* @ param body content for the tag
* @ return an HtmlTree object for the DL tag */
public static HtmlTree DL ( Content body ) { } } | HtmlTree htmltree = new HtmlTree ( HtmlTag . DL , nullCheck ( body ) ) ; return htmltree ; |
public class CommerceTaxMethodLocalServiceWrapper { /** * Returns a range of all the commerce tax methods .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . tax . model . impl . CommerceTaxMethodModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param start the lower bound of the range of commerce tax methods
* @ param end the upper bound of the range of commerce tax methods ( not inclusive )
* @ return the range of commerce tax methods */
@ Override public java . util . List < com . liferay . commerce . tax . model . CommerceTaxMethod > getCommerceTaxMethods ( int start , int end ) { } } | return _commerceTaxMethodLocalService . getCommerceTaxMethods ( start , end ) ; |
public class NumberToChars { /** * @ return new offset in char buffer */
public static int toChars ( int i , char [ ] buf , int offset ) { } } | if ( i < 0 ) { if ( i == Integer . MIN_VALUE ) { writeMinInteger ( buf , offset ) ; return offset + 11 ; } buf [ offset ++ ] = '-' ; i = - i ; } offset += stringSizeOf ( i ) ; getChars ( i , offset , buf ) ; return offset ; |
public class Vector2i { /** * Read this vector from the supplied { @ link ByteBuffer } starting at the
* specified absolute buffer position / index .
* This method will not increment the position of the given ByteBuffer .
* @ param index
* the absolute position into the ByteBuffer
* @ param buffer
* values will be read in < code > x , y < / code > order
* @ return this */
public Vector2i set ( int index , ByteBuffer buffer ) { } } | MemUtil . INSTANCE . get ( this , index , buffer ) ; return this ; |
public class AbstractClientFactory { /** * Makes sure the scheme of the specified { @ link URI } is supported by this { @ link ClientFactory } .
* @ param uri the { @ link URI } of the server endpoint
* @ return the parsed { @ link Scheme }
* @ throws IllegalArgumentException if the scheme of the specified { @ link URI } is not supported by this
* { @ link ClientFactory } */
protected final Scheme validateScheme ( URI uri ) { } } | requireNonNull ( uri , "uri" ) ; final String scheme = uri . getScheme ( ) ; if ( scheme == null ) { throw new IllegalArgumentException ( "URI with missing scheme: " + uri ) ; } if ( uri . getAuthority ( ) == null ) { throw new IllegalArgumentException ( "URI with missing authority: " + uri ) ; } final Optional < Scheme > parsedSchemeOpt = Scheme . tryParse ( scheme ) ; if ( ! parsedSchemeOpt . isPresent ( ) ) { throw new IllegalArgumentException ( "URI with unknown scheme: " + uri ) ; } final Scheme parsedScheme = parsedSchemeOpt . get ( ) ; final Set < Scheme > supportedSchemes = supportedSchemes ( ) ; if ( ! supportedSchemes . contains ( parsedScheme ) ) { throw new IllegalArgumentException ( "URI with unsupported scheme: " + uri + " (expected: " + supportedSchemes + ')' ) ; } return parsedScheme ; |
public class MessageProcessor { /** * This lifecycle phase is implemented by invoking the { @ link Mp # output ( ) } method on the instance
* @ see MessageProcessorLifecycle # invokeOutput ( Object ) */
@ Override public List < KeyedMessageWithType > invokeOutput ( final Mp instance ) throws DempsyException { } } | try { return Arrays . asList ( Optional . ofNullable ( instance . output ( ) ) . orElse ( EMPTY_KEYED_MESSAGE_WITH_TYPE ) ) ; } catch ( final RuntimeException rte ) { throw new DempsyException ( rte , true ) ; } |
public class ClientSideMonitoringRequestHandler { /** * Get the default user agent and append the user agent marker if there are any . */
private String getDefaultUserAgent ( Request < ? > request ) { } } | String userAgentMarker = request . getOriginalRequest ( ) . getRequestClientOptions ( ) . getClientMarker ( RequestClientOptions . Marker . USER_AGENT ) ; String userAgent = ClientConfiguration . DEFAULT_USER_AGENT ; if ( StringUtils . hasValue ( userAgentMarker ) ) { userAgent += " " + userAgentMarker ; } return userAgent ; |
public class Router { /** * Specify a middleware that will be called for a matching HTTP HEAD
* @ param regex A regular expression
* @ param handlers The middleware to call */
public Router head ( @ NotNull final Pattern regex , @ NotNull final IMiddleware ... handlers ) { } } | addRegEx ( "HEAD" , regex , handlers , headBindings ) ; return this ; |
public class ConnectionGroupTree { /** * Adds each of the provided connections to the current tree as children
* of their respective parents . The parent connection groups must already
* be added .
* @ param connections
* The connections to add to the tree .
* @ throws GuacamoleException
* If an error occurs while adding the connection to the tree . */
private void addConnections ( Collection < Connection > connections ) throws GuacamoleException { } } | // Add each connection to the tree
for ( Connection connection : connections ) { // Retrieve the connection ' s parent group
APIConnectionGroup parent = retrievedGroups . get ( connection . getParentIdentifier ( ) ) ; if ( parent != null ) { Collection < APIConnection > children = parent . getChildConnections ( ) ; // Create child collection if it does not yet exist
if ( children == null ) { children = new ArrayList < APIConnection > ( ) ; parent . setChildConnections ( children ) ; } // Add child
APIConnection apiConnection = new APIConnection ( connection ) ; retrievedConnections . put ( connection . getIdentifier ( ) , apiConnection ) ; children . add ( apiConnection ) ; } // Warn of internal consistency issues
else logger . debug ( "Connection \"{}\" cannot be added to the tree: parent \"{}\" does not actually exist." , connection . getIdentifier ( ) , connection . getParentIdentifier ( ) ) ; } // end for each connection |
public class World { /** * Answers the { @ code T } protocol of the newly created { @ code Actor } that is defined by
* the parameters of { @ code definition } that implements the { @ code protocol } .
* @ param protocol the { @ code Class < T > } protocol that the { @ code Actor } supports
* @ param < T > the protocol type
* @ param definition the { @ code Definition } providing parameters to the { @ code Actor }
* @ return T */
public < T > T actorFor ( final Class < T > protocol , final Definition definition ) { } } | if ( isTerminated ( ) ) { throw new IllegalStateException ( "vlingo/actors: Stopped." ) ; } return stage ( ) . actorFor ( protocol , definition ) ; |
public class JsUtils { /** * Converts the given array of { @ link EventLabel } to a { @ link String } . */
public static String implode ( EventLabel ... eventLabels ) { } } | if ( eventLabels . length == 0 ) { return "''" ; } StringBuilder output = new StringBuilder ( ) ; output . append ( '\'' ) . append ( eventLabels [ 0 ] . getEventLabel ( ) ) ; for ( int i = 1 ; i < eventLabels . length ; i ++ ) { EventLabel eventLabel = eventLabels [ i ] ; output . append ( ' ' ) . append ( eventLabel . getEventLabel ( ) ) ; } output . append ( '\'' ) ; return output . toString ( ) ; |
public class BridgeFactory { /** * Sets the { @ link org . leialearns . bridge . BridgeHeadTypeRegistry BridgeHeadTypeRegistry } , registers this factory
* instance with it , and looks up bindings for the methods in the near type .
* @ param registry The BridgeHeadTypeRegistry instance to use */
@ Autowired public void setRegistry ( BridgeHeadTypeRegistry registry ) { } } | this . registry = registry ; registry . register ( this ) ; Method [ ] methods = offerArray ( Object . class . getMethods ( ) , nearType . getMethods ( ) ) ; for ( Method method : methods ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Method: " + display ( method ) + ": in: " + display ( nearType ) ) ; } Binding binding = getBinding ( method . getReturnType ( ) , method . getName ( ) , method . getParameterTypes ( ) ) ; if ( binding == null ) { String message = "No binding found: " + display ( nearType ) + ": " + display ( method ) ; logger . warn ( message ) ; throw new UnsupportedOperationException ( message ) ; } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Binding: " + display ( binding ) ) ; } methodMap . put ( method , binding ) ; } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link ImageDatumType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link ImageDatumType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "ImageDatum" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "_Datum" ) public JAXBElement < ImageDatumType > createImageDatum ( ImageDatumType value ) { } } | return new JAXBElement < ImageDatumType > ( _ImageDatum_QNAME , ImageDatumType . class , null , value ) ; |
public class ModelRegistryService { /** * Converts an URL to a class into a class name */
private String extractClassName ( URL classURL ) { } } | String path = classURL . getPath ( ) ; return path . replaceAll ( "^/" , "" ) . replaceAll ( ".class$" , "" ) . replaceAll ( "\\/" , "." ) ; |
public class OSGiInjectionEngineImpl { /** * Gets the injection scope data for a namespace .
* @ param cmd the component metadata , or null if null should be returned
* @ param namespace the namespace
* @ return the scope data , or null if unavailable */
public OSGiInjectionScopeData getInjectionScopeData ( ComponentMetaData cmd , NamingConstants . JavaColonNamespace namespace ) { } } | if ( cmd == null ) { return null ; } if ( namespace == NamingConstants . JavaColonNamespace . GLOBAL ) { return globalScopeData ; } if ( namespace == NamingConstants . JavaColonNamespace . COMP || namespace == NamingConstants . JavaColonNamespace . COMP_ENV ) { OSGiInjectionScopeData isd = ( OSGiInjectionScopeData ) cmd . getMetaData ( componentMetaDataSlot ) ; if ( isd == null ) { ModuleMetaData mmd = cmd . getModuleMetaData ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "trying module " + mmd ) ; } // WAR java : comp is shared across all components , so the
// bindings are stored in the module metadata .
isd = ( OSGiInjectionScopeData ) cmd . getModuleMetaData ( ) . getMetaData ( moduleMetaDataSlot ) ; if ( isd == null || ! isd . isCompAllowed ( ) ) { return null ; } } return isd ; } ModuleMetaData mmd = cmd . getModuleMetaData ( ) ; if ( namespace == NamingConstants . JavaColonNamespace . MODULE ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "trying " + mmd ) ; } return ( OSGiInjectionScopeData ) mmd . getMetaData ( moduleMetaDataSlot ) ; } if ( namespace == NamingConstants . JavaColonNamespace . APP ) { ApplicationMetaData amd = mmd . getApplicationMetaData ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "trying " + amd ) ; } return ( OSGiInjectionScopeData ) amd . getMetaData ( applicationMetaDataSlot ) ; } return null ; |
public class ProbeManagerImpl { /** * Create a set of { @ link ProbeListener } s that delegate annotated
* methods on the specified monitor .
* @ return the set of listeners to activate */
Set < ProbeListener > buildListenersFromAnnotated ( Object monitor ) { } } | Set < ProbeListener > listeners = new HashSet < ProbeListener > ( ) ; Class < ? > clazz = monitor . getClass ( ) ; for ( Method method : ReflectionHelper . getMethods ( clazz ) ) { ProbeSite probeSite = method . getAnnotation ( ProbeSite . class ) ; if ( probeSite == null ) { continue ; } synchronized ( notMonitorable ) { Class < ? > rClass = null ; for ( Class < ? > tClass : notMonitorable ) { if ( tClass != null && ( ( tClass . getName ( ) ) . equals ( probeSite . clazz ( ) ) ) ) { rClass = tClass ; monitorable . add ( tClass ) ; break ; } } if ( rClass != null ) { notMonitorable . remove ( rClass ) ; } } // TODO : Handle monitoring groups
Monitor monitorData = clazz . getAnnotation ( Monitor . class ) ; ListenerConfiguration config = new ListenerConfiguration ( monitorData , probeSite , method ) ; // ProbeListener listener = new ProbeListener ( this , config , monitor , method ) ;
ProbeListener listener = new ProbeListener ( null , config , monitor , method ) ; listeners . add ( listener ) ; } return listeners ; |
public class AbstractSARLLaunchConfigurationDelegate { /** * Replies the arguments of the program including the boot agent name .
* { @ inheritDoc } */
@ Override @ SuppressWarnings ( "checkstyle:variabledeclarationusagedistance" ) public final String getProgramArguments ( ILaunchConfiguration configuration ) throws CoreException { } } | // The following line get the standard arguments
final String standardProgramArguments = super . getProgramArguments ( configuration ) ; // Get the specific SRE arguments
final ISREInstall sre = getSREInstallFor ( configuration , this . configAccessor , cfg -> getJavaProject ( cfg ) ) ; assert sre != null ; return getProgramArguments ( configuration , sre , standardProgramArguments ) ; |
public class SQSSession { /** * Creates a < code > MessageConsumer < / code > for the specified destination .
* Only queue destinations are supported at this time .
* @ param destination
* a queue destination
* @ return new message consumer
* @ throws JMSException
* If session is closed or queue destination is not used */
@ Override public MessageConsumer createConsumer ( Destination destination ) throws JMSException { } } | checkClosed ( ) ; if ( ! ( destination instanceof SQSQueueDestination ) ) { throw new JMSException ( "Actual type of Destination/Queue has to be SQSQueueDestination" ) ; } SQSMessageConsumer messageConsumer ; synchronized ( stateLock ) { checkClosing ( ) ; messageConsumer = createSQSMessageConsumer ( ( SQSQueueDestination ) destination ) ; messageConsumers . add ( messageConsumer ) ; if ( running ) { messageConsumer . startPrefetch ( ) ; } } return messageConsumer ; |
public class ServicesInner { /** * Create or update DMS Service Instance .
* The services resource is the top - level resource that represents the Data Migration Service . The PATCH method updates an existing service . This method can change the kind , SKU , and network of the service , but if tasks are currently running ( i . e . the service is busy ) , this will fail with 400 Bad Request ( " ServiceIsBusy " ) .
* @ param groupName Name of the resource group
* @ param serviceName Name of the service
* @ param parameters Information about the service
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ApiErrorException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the DataMigrationServiceInner object if successful . */
public DataMigrationServiceInner beginUpdate ( String groupName , String serviceName , DataMigrationServiceInner parameters ) { } } | return beginUpdateWithServiceResponseAsync ( groupName , serviceName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class XcapClientImpl { /** * ( non - Javadoc )
* @ see XcapClient # delete ( java . net . URI ,
* Header [ ] ,
* Credentials ) */
public XcapResponse delete ( URI uri , Header [ ] additionalRequestHeaders , Credentials credentials ) throws IOException { } } | if ( log . isDebugEnabled ( ) ) { log . debug ( "delete(uri=" + uri + " , additionalRequestHeaders = ( " + Arrays . toString ( additionalRequestHeaders ) + " ) )" ) ; } return execute ( new HttpDelete ( uri ) , additionalRequestHeaders , credentials ) ; |
public class SubtitleLineContentToHtmlBase { /** * Appends furigana over the whole word */
protected void appendElements ( RendersnakeHtmlCanvas html , List < SubtitleItem . Inner > elements ) throws IOException { } } | for ( SubtitleItem . Inner element : elements ) { String kanji = element . getKanji ( ) ; if ( kanji != null ) { html . spanKanji ( kanji ) ; } else { html . write ( element . getText ( ) ) ; } } |
public class MessageType { /** * Returns the field named { @ code name } , or null if this type has no such field . */
public Field field ( String name ) { } } | for ( Field field : declaredFields ) { if ( field . name ( ) . equals ( name ) ) { return field ; } } for ( OneOf oneOf : oneOfs ) { for ( Field field : oneOf . fields ( ) ) { if ( field . name ( ) . equals ( name ) ) { return field ; } } } return null ; |
public class StrBuilder { /** * 插入指定字符
* @ param index 位置
* @ param c 字符
* @ return this */
public StrBuilder insert ( int index , char c ) { } } | moveDataAfterIndex ( index , 1 ) ; value [ index ] = c ; this . position = Math . max ( this . position , index ) + 1 ; return this ; |
public class AbstractDataEditorWidget { /** * Returns the commandGroup that should be used to create the popup menu for the table . */
protected CommandGroup getTablePopupMenuCommandGroup ( ) { } } | return getApplicationConfig ( ) . commandManager ( ) . createCommandGroup ( Lists . newArrayList ( getEditRowCommand ( ) , "separator" , getAddRowCommand ( ) , getCloneRowCommand ( ) , getRemoveRowsCommand ( ) , "separator" , getRefreshCommand ( ) , "separator" , getCopySelectedRowsToClipboardCommand ( ) ) ) ; |
public class InternalXtextParser { /** * InternalXtext . g : 3252:1 : entryRuleParenthesizedTerminalElement returns [ EObject current = null ] : iv _ ruleParenthesizedTerminalElement = ruleParenthesizedTerminalElement EOF ; */
public final EObject entryRuleParenthesizedTerminalElement ( ) throws RecognitionException { } } | EObject current = null ; EObject iv_ruleParenthesizedTerminalElement = null ; try { // InternalXtext . g : 3252:69 : ( iv _ ruleParenthesizedTerminalElement = ruleParenthesizedTerminalElement EOF )
// InternalXtext . g : 3253:2 : iv _ ruleParenthesizedTerminalElement = ruleParenthesizedTerminalElement EOF
{ newCompositeNode ( grammarAccess . getParenthesizedTerminalElementRule ( ) ) ; pushFollow ( FollowSets000 . FOLLOW_1 ) ; iv_ruleParenthesizedTerminalElement = ruleParenthesizedTerminalElement ( ) ; state . _fsp -- ; current = iv_ruleParenthesizedTerminalElement ; match ( input , EOF , FollowSets000 . FOLLOW_2 ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class ModuleUtils { /** * Instantiates the given module class { @ code clazz } . First this looks for a constructor taking
* { @ link Parameters } as its only argument and uses it with the supplied { @ code params } if
* possible . Otherwise attempts to find and use a zero - arg constructor . Otherwise throws
* a { @ link RuntimeException } . */
public static Module instantiateModule ( final Class < ? extends Module > clazz , final Parameters params ) throws IllegalAccessException , InvocationTargetException , InstantiationException { } } | return instantiateModule ( clazz , params , Optional . < Class < ? extends Annotation > > absent ( ) ) ; |
public class BaseConvertToMessage { /** * Utility to add the standard payload properties to the message
* @ param msg
* @ param message */
public void addPayloadProperties ( Object msg , BaseMessage message ) { } } | MessageDataDesc messageDataDesc = message . getMessageDataDesc ( null ) ; // Top level only
if ( messageDataDesc != null ) { Map < String , Class < ? > > mapPropertyNames = messageDataDesc . getPayloadPropertyNames ( null ) ; if ( mapPropertyNames != null ) { Map < String , Object > properties = this . getPayloadProperties ( msg , mapPropertyNames ) ; for ( String key : properties . keySet ( ) ) { message . put ( key , properties . get ( key ) ) ; } } } |
public class LogBuffer { /** * Return next 32 - bit unsigned int from buffer . ( big - endian )
* @ see mysql - 5.6.10 / include / myisampack . h - mi _ uint4korr */
public final long getBeUint32 ( ) { } } | if ( position + 3 >= origin + limit ) throw new IllegalArgumentException ( "limit excceed: " + ( position - origin + 3 ) ) ; byte [ ] buf = buffer ; return ( ( long ) ( 0xff & buf [ position ++ ] ) << 24 ) | ( ( long ) ( 0xff & buf [ position ++ ] ) << 16 ) | ( ( long ) ( 0xff & buf [ position ++ ] ) << 8 ) | ( ( long ) ( 0xff & buf [ position ++ ] ) ) ; |
public class ConditionalBuilder { /** * Condition which allows execution if evaluates to true .
* @ param expression */
public ConditionalBuilder when ( Object value , Matcher expression ) { } } | action . setConditionExpression ( new HamcrestConditionExpression ( expression , value ) ) ; return this ; |
public class WebServiceCommunication { /** * Issues HTTP PUT request , returns response body as string .
* @ param endpoint endpoint of request url
* @ param params request line parameters
* @ param json request body
* @ return response body
* @ throws IOException in case of any IO related issue */
public String putJson ( String endpoint , String params , JSONObject json ) throws IOException { } } | return this . putJson ( endpoint , params , json , "" ) ; |
public class XMLObjectImpl { /** * Generic reference to implement x : : ns , x . @ ns : : y , x . . @ ns : : y etc . */
@ Override public Ref memberRef ( Context cx , Object namespace , Object elem , int memberTypeFlags ) { } } | boolean attribute = ( memberTypeFlags & Node . ATTRIBUTE_FLAG ) != 0 ; boolean descendants = ( memberTypeFlags & Node . DESCENDANTS_FLAG ) != 0 ; XMLName rv = XMLName . create ( lib . toNodeQName ( cx , namespace , elem ) , attribute , descendants ) ; rv . initXMLObject ( this ) ; return rv ; |
public class ClientConfigUtil { /** * Compares two avro strings which contains multiple store configs
* @ param configAvro1
* @ param configAvro2
* @ return true if two config avro strings have same content */
public static Boolean compareMultipleClientConfigAvro ( String configAvro1 , String configAvro2 ) { } } | Map < String , Properties > mapStoreToProps1 = readMultipleClientConfigAvro ( configAvro1 ) ; Map < String , Properties > mapStoreToProps2 = readMultipleClientConfigAvro ( configAvro2 ) ; Set < String > keySet1 = mapStoreToProps1 . keySet ( ) ; Set < String > keySet2 = mapStoreToProps2 . keySet ( ) ; if ( ! keySet1 . equals ( keySet2 ) ) { return false ; } for ( String storeName : keySet1 ) { Properties props1 = mapStoreToProps1 . get ( storeName ) ; Properties props2 = mapStoreToProps2 . get ( storeName ) ; if ( ! props1 . equals ( props2 ) ) { return false ; } } return true ; |
public class AbstractRemoveTask { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . msgstore . persistence . Operation # persist ( com . ibm . ws . sib . msgstore . persistence . BatchingContext , int ) */
public final void persist ( BatchingContext batchingContext , TransactionState tranState ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "persist" , new Object [ ] { batchingContext , tranState } ) ; if ( ( tranState == TransactionState . STATE_COMMITTED ) || ( tranState == TransactionState . STATE_COMMITTING_1PC ) || ( tranState == TransactionState . STATE_COMMITTING_2PC ) ) { batchingContext . delete ( getPersistable ( ) ) ; } else if ( ( tranState == TransactionState . STATE_PREPARED ) || ( tranState == TransactionState . STATE_PREPARING ) ) { Persistable tuple = getPersistable ( ) ; tuple . setLogicallyDeleted ( true ) ; batchingContext . updateLogicalDeleteAndXID ( tuple ) ; } else if ( ( tranState == TransactionState . STATE_ROLLEDBACK ) || ( tranState == TransactionState . STATE_ROLLINGBACK ) ) { Persistable tuple = getPersistable ( ) ; tuple . setLogicallyDeleted ( false ) ; batchingContext . updateLogicalDeleteAndXID ( tuple ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "persist" ) ; throw new IllegalStateException ( nls . getFormattedMessage ( "INVALID_TASK_OPERATION_SIMS1520" , new Object [ ] { tranState } , null ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "persist" ) ; |
public class CodeGenBase { /** * This method pre - processes the VDM AST by < br >
* ( 1 ) computing a definition table that can be used during the analysis of the IR to determine if a VDM identifier
* state designator is local or not . < br >
* ( 2 ) Removing unreachable statements from the VDM AST < br >
* ( 3 ) Normalizing old names by replacing tilde signs ' ~ ' with underscores ' _ ' < br >
* ( 4 ) Simplifying the standard libraries by cutting nodes that are not likely to be meaningful during the analysis
* of the VDM AST . Library classes are processed using { @ link # simplifyLibrary ( INode ) } , whereas non - library modules
* or classes are processed using { @ link # preProcessVdmUserClass ( INode ) } .
* @ param ast
* The VDM AST subject to pre - processing .
* @ throws AnalysisException
* In case something goes wrong during the VDM AST analysis . */
protected void preProcessAst ( List < INode > ast ) throws AnalysisException { } } | generator . computeDefTable ( getUserModules ( ast ) ) ; removeUnreachableStms ( ast ) ; handleOldNames ( ast ) ; for ( INode node : ast ) { if ( getInfo ( ) . getAssistantManager ( ) . getDeclAssistant ( ) . isLibrary ( node ) ) { simplifyLibrary ( node ) ; } else { preProcessVdmUserClass ( node ) ; } } |
public class Char { /** * Encodes a char to percentage code , if it is not a path character in the sense of URIs */
public static String encodeURIPathComponent ( String s ) { } } | StringBuilder result = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { result . append ( Char . encodeURIPathComponent ( s . charAt ( i ) ) ) ; } return ( result . toString ( ) ) ; |
public class TrainingDataUtils { /** * Shuffle the data and split by proportion
* @ param trainingData whole data collection .
* @ param proportion scale from 0.1 - 1.0.
* @ return Left - small chunk . Right - large chunk . */
public static Pair < List < Tuple > , List < Tuple > > splitData ( final List < Tuple > trainingData , double proportion ) { } } | if ( proportion < 0 || proportion > 1 ) { throw new RuntimeException ( "Proportion should between 0.0 - 1.0" ) ; } if ( proportion > 0.5 ) { proportion = 1 - proportion ; } List < Tuple > smallList = new ArrayList < > ( ) ; List < Tuple > largeList = new ArrayList < > ( ) ; int smallListSize = ( int ) Math . floor ( proportion * trainingData . size ( ) ) ; int ct = 0 ; Set < Integer > indices = new HashSet < > ( ) ; while ( ct < smallListSize && trainingData . size ( ) > indices . size ( ) ) { int index = ( int ) ( Math . random ( ) * ( trainingData . size ( ) - 1 ) ) ; while ( indices . contains ( index ) ) { index = ( int ) ( Math . random ( ) * ( trainingData . size ( ) - 1 ) ) ; } indices . add ( index ) ; ct ++ ; } smallList . addAll ( indices . stream ( ) . map ( trainingData :: get ) . collect ( Collectors . toList ( ) ) ) ; IntStream . range ( 0 , trainingData . size ( ) ) . filter ( x -> ! indices . contains ( x ) ) . forEach ( i -> largeList . add ( trainingData . get ( i ) ) ) ; return new ImmutablePair < > ( smallList , largeList ) ; |
public class StringTokenizer { /** * Returns the next token from this string tokenizer .
* @ return the next token from this string tokenizer .
* @ exception NoSuchElementException if there are no more tokens in this
* tokenizer ' s string . */
public String nextToken ( ) { } } | /* * If next position already computed in hasMoreElements ( ) and
* delimiters have changed between the computation and this invocation ,
* then use the computed value . */
currentPosition = ( newPosition >= 0 && ! delimsChanged ) ? newPosition : skipDelimiters ( currentPosition ) ; /* Reset these anyway */
delimsChanged = false ; newPosition = - 1 ; if ( currentPosition >= maxPosition ) throw new NoSuchElementException ( ) ; int start = currentPosition ; currentPosition = scanToken ( currentPosition ) ; return str . substring ( start , currentPosition ) ; |
public class Cell { /** * Sets the minWidth and minHeight to the specified values . */
public Cell < C , T > minSize ( Value < C , T > width , Value < C , T > height ) { } } | minWidth = width ; minHeight = height ; return this ; |
public class DecomposableMatchBuilder3 { /** * Builds a { @ link DecomposableMatch3 } . */
public DecomposableMatch3 < T , A , B , C > build ( ) { } } | return new DecomposableMatch3 < > ( fieldMatchers , extractedIndexes , fieldExtractor ) ; |
public class CmsADEConfigData { /** * Gets the formatter configuration for a resource . < p >
* @ param cms the current CMS context
* @ param res the resource for which the formatter configuration should be retrieved
* @ return the configuration of formatters for the resource */
public CmsFormatterConfiguration getFormatters ( CmsObject cms , CmsResource res ) { } } | if ( CmsResourceTypeFunctionConfig . isFunction ( res ) ) { CmsFormatterConfigurationCacheState formatters = getCachedFormatters ( ) ; I_CmsFormatterBean function = formatters . getFormatters ( ) . get ( res . getStructureId ( ) ) ; if ( function != null ) { return CmsFormatterConfiguration . create ( cms , Collections . singletonList ( function ) ) ; } else { if ( ( ! res . getStructureId ( ) . isNullUUID ( ) ) && cms . existsResource ( res . getStructureId ( ) , CmsResourceFilter . IGNORE_EXPIRATION ) ) { // usually if it ' s just been created , but not added to the configuration cache yet
CmsFormatterBeanParser parser = new CmsFormatterBeanParser ( cms , new HashMap < > ( ) ) ; try { function = parser . parse ( CmsXmlContentFactory . unmarshal ( cms , cms . readFile ( res ) ) , res . getRootPath ( ) , "" + res . getStructureId ( ) ) ; return CmsFormatterConfiguration . create ( cms , Collections . singletonList ( function ) ) ; } catch ( Exception e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; return CmsFormatterConfiguration . EMPTY_CONFIGURATION ; } } else { // if a new function has been dragged on the page , it doesn ' t exist in the VFS yet , so we need a different
// instance as a replacement
CmsResource defaultFormatter = CmsFunctionRenderer . getDefaultFunctionInstance ( cms ) ; if ( defaultFormatter != null ) { I_CmsFormatterBean defaultFormatterBean = formatters . getFormatters ( ) . get ( defaultFormatter . getStructureId ( ) ) ; return CmsFormatterConfiguration . create ( cms , Collections . singletonList ( defaultFormatterBean ) ) ; } else { LOG . warn ( "Could not read default formatter for functions." ) ; return CmsFormatterConfiguration . EMPTY_CONFIGURATION ; } } } } else { try { int resTypeId = res . getTypeId ( ) ; return getFormatters ( cms , OpenCms . getResourceManager ( ) . getResourceType ( resTypeId ) , getFormattersFromSchema ( cms , res ) ) ; } catch ( CmsLoaderException e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; return CmsFormatterConfiguration . EMPTY_CONFIGURATION ; } } |
public class CmsSite { /** * Returns the server prefix for the given resource in this site , used to distinguish between
* secure ( https ) and non - secure ( http ) sites . < p >
* This is required since a resource may have an individual " secure " setting using the property
* { @ link org . opencms . file . CmsPropertyDefinition # PROPERTY _ SECURE } , which means this resource
* must be delivered only using a secure protocol . < p >
* The result will look like < code > http : / / site . enterprise . com : 8080 / < / code > or < code > https : / / site . enterprise . com / < / code > . < p >
* @ param cms the current users OpenCms context
* @ param resource the resource to use
* @ return the server prefix for the given resource in this site
* @ see # getServerPrefix ( CmsObject , String ) */
public String getServerPrefix ( CmsObject cms , CmsResource resource ) { } } | return getServerPrefix ( cms , resource . getRootPath ( ) ) ; |
public class ParseContext { /** * Applies { @ code parser } as a new tree node with { @ code name } , and if fails , reports
* " expecting $ name " . */
final boolean applyNewNode ( Parser < ? > parser , String name ) { } } | int physical = at ; int logical = step ; TreeNode latestChild = trace . getLatestChild ( ) ; trace . push ( name ) ; if ( parser . apply ( this ) ) { trace . setCurrentResult ( result ) ; trace . pop ( ) ; return true ; } if ( stillThere ( physical , logical ) ) expected ( name ) ; trace . pop ( ) ; // On failure , the erroneous path shouldn ' t be counted in the parse tree .
trace . setLatestChild ( latestChild ) ; return false ; |
public class GlobalConfiguration { /** * Parse the given control file and initialize this config appropriately . */
void readControlFile ( String fileName ) throws IOException { } } | BufferedReader reader = new BufferedReader ( new FileReader ( fileName ) ) ; try { controlList . clear ( ) ; String line ; while ( ( line = reader . readLine ( ) ) != null ) { line = line . trim ( ) ; if ( line . isEmpty ( ) || line . startsWith ( "#" ) ) { continue ; } int separatorIndex = line . indexOf ( '=' ) ; if ( separatorIndex <= 0 ) { logger . warn ( "Control file line \"" + line + "\" is invalid as does not have '=' separator." ) ; continue ; } String className = line . substring ( 0 , separatorIndex ) ; ControlMode controlMode ; try { controlMode = ControlMode . valueOf ( line . substring ( separatorIndex + 1 ) . trim ( ) . toUpperCase ( ) ) ; } catch ( IllegalArgumentException e ) { logger . warn ( "Control file line \"" + line + "\" is invalid as control mode is unknown." ) ; continue ; } controlList . add ( new ControlEntry ( className . startsWith ( "/" ) && className . endsWith ( "/" ) && className . length ( ) > 2 ? Pattern . compile ( className . substring ( 1 , className . length ( ) - 1 ) ) : Pattern . compile ( className , Pattern . LITERAL ) , controlMode ) ) ; } configurationValues . put ( ConfigurationOption . CONTROL , fileName ) ; } finally { reader . close ( ) ; } |
public class Sneaky { /** * Wrap a { @ link CheckedLongFunction } in a { @ link LongFunction } .
* Example :
* < code > < pre >
* LongStream . of ( 1L , 2L , 3L ) . mapToObj ( Unchecked . longFunction ( l - > {
* if ( l & lt ; 0L )
* throw new Exception ( " Only positive numbers allowed " ) ;
* return " " + l ;
* < / pre > < / code > */
public static < R > LongFunction < R > longFunction ( CheckedLongFunction < R > function ) { } } | return Unchecked . longFunction ( function , Unchecked . RETHROW_ALL ) ; |
public class SoapMustUnderstandEndpointInterceptor { /** * ( non - Javadoc )
* @ see org . springframework . ws . soap . server . SoapEndpointInterceptor # understands ( org . springframework . ws . soap . SoapHeaderElement ) */
public boolean understands ( SoapHeaderElement header ) { } } | // see if header is accepted
if ( header . getName ( ) != null && acceptedHeaders . contains ( header . getName ( ) . toString ( ) ) ) { return true ; } return false ; |
public class LifecycleCallbackHelper { /** * Processes the PostConstruct callback method
* @ param clazz the callback class object
* @ param postConstructs a list of PostConstruct application client module deployment descriptor .
* @ param instance the instance object of the callback class . It can be null for static method .
* @ throws InjectionException */
@ SuppressWarnings ( "rawtypes" ) private void doPostConstruct ( Class clazz , List < LifecycleCallback > postConstructs , Object instance ) throws InjectionException { } } | if ( ! metadataComplete && clazz . getSuperclass ( ) != null ) { doPostConstruct ( clazz . getSuperclass ( ) , postConstructs , instance ) ; } String classname = clazz . getName ( ) ; String methodName = getMethodNameFromDD ( postConstructs , classname ) ; if ( methodName != null ) { invokeMethod ( clazz , methodName , instance ) ; } else if ( ! metadataComplete ) { Method method = getAnnotatedPostConstructMethod ( clazz ) ; if ( method != null ) { invokeMethod ( clazz , method . getName ( ) , instance ) ; } } |
public class AbstractJobLauncher { /** * Prepare the flattened { @ link WorkUnit } s for execution by populating the job and task IDs . */
private WorkUnitStream prepareWorkUnits ( WorkUnitStream workUnits , JobState jobState ) { } } | return workUnits . transform ( new WorkUnitPreparator ( this . jobContext . getJobId ( ) ) ) ; |
public class ConfigUtils { /** * Resolves encrypted config value ( s ) by considering on the path with " encConfigPath " as encrypted .
* ( If encConfigPath is absent or encConfigPath does not exist in config , config will be just returned untouched . )
* It will use Password manager via given config . Thus , convention of PasswordManager need to be followed in order to be decrypted .
* Note that " encConfigPath " path will be removed from the config key , leaving child path on the config key .
* e . g :
* encConfigPath = enc . conf
* - Before : { enc . conf . secret _ key : ENC ( rOF43721f0pZqAXg # 63a ) }
* - After : { secret _ key : decrypted _ val }
* @ param config
* @ param encConfigPath
* @ return */
public static Config resolveEncrypted ( Config config , Optional < String > encConfigPath ) { } } | if ( ! encConfigPath . isPresent ( ) || ! config . hasPath ( encConfigPath . get ( ) ) ) { return config ; } Config encryptedConfig = config . getConfig ( encConfigPath . get ( ) ) ; PasswordManager passwordManager = PasswordManager . getInstance ( configToProperties ( config ) ) ; Map < String , String > tmpMap = Maps . newHashMap ( ) ; for ( Map . Entry < String , ConfigValue > entry : encryptedConfig . entrySet ( ) ) { String val = entry . getValue ( ) . unwrapped ( ) . toString ( ) ; val = passwordManager . readPassword ( val ) ; tmpMap . put ( entry . getKey ( ) , val ) ; } return ConfigFactory . parseMap ( tmpMap ) . withFallback ( config ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.