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 ( ) } ... | 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 OpenCm... |
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 i... | 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 . pu... |
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 . setShowAnimatio... |
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 typeOfSr... | 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... |
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... | 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... |
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 encode... | 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 (... |
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 remo... | 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... |
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 s... |
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 exe... | 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 P... | 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 , 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 ... |
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... | 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 initT... | 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 se... |
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 ar... | DockerMachineConfiguration config = dockerAccessContext . getMachine ( ) ; if ( dockerAccessContext . isSkipMachine ( ) ) { config = null ; } else if ( config == null ) { Properties projectProps = dockerAccessContext . getProjectProperties ( ) ; if ( projectProps . containsKey ( DockerMachineConfiguration . DOCKER_MACH... |
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 . v... |
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 . clea... |
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 ) {
... |
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 sqToler... | 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 )... |
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... |
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 a... | 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... | return listStorageContainersNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < StorageContainerInner > > , Page < StorageContainerInner > > ( ) { @ Override public Page < StorageContainerInner > call ( ServiceResponse < Page < StorageContainerInner > > response ) { return respons... |
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 >... | 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
* @ th... | 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 con... | 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 { Expre... |
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 ... | 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 par... | 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 ... | 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... |
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 tok... | 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 . life... | 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... | 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 se... | 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 ... | 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 { @ li... | 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 < Schem... |
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 userA... |
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 occur... | // 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 ( ) ; // ... |
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 pr... | 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 ... |
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 ... | 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 ) ) ; } Bi... |
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 > } */
... | 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 ( Compo... | 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 ) cm... |
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 ... |
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 ... | // 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 getP... |
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... | checkClosed ( ) ; if ( ! ( destination instanceof SQSQueueDestination ) ) { throw new JMSException ( "Actual type of Destination/Queue has to be SQSQueueDestination" ) ; } SQSMessageConsumer messageConsumer ; synchronized ( stateLock ) { checkClosing ( ) ; messageConsumer = createSQSMessageConsumer ( ( SQSQueueDestinat... |
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 run... | 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
{ newComposit... |
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 throw... | 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 . getPayloadProper... |
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 ... |
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 Str... | 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 . e... |
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 . ... |
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 >
* ( ... | 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 >... | 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 ( pr... |
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 */
delimsC... |
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 g... | if ( CmsResourceTypeFunctionConfig . isFunction ( res ) ) { CmsFormatterConfigurationCacheState formatters = getCachedFormatters ( ) ; I_CmsFormatterBean function = formatters . getFormatters ( ) . get ( res . getStructureId ( ) ) ; if ( function != null ) { return CmsFormatterConfiguration . create ( cms , Collections... |
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 . Cms... | 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... |
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 ... |
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 " " +... | 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 st... | 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 ,... |
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 , conve... | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.