signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ClassByImplementationBenchmark { /** * Performs a benchmark of an interface implementation using the Java Class Library ' s utilities .
* @ return The created instance , in order to avoid JIT removal .
* @ throws java . lang . Exception If the reflective invocation causes an exception . */
@ Benchmark public ExampleInterface benchmarkJdkProxy ( ) throws Exception { } } | return ( ExampleInterface ) Proxy . newProxyInstance ( newClassLoader ( ) , new Class < ? > [ ] { baseClass } , new InvocationHandler ( ) { public Object invoke ( Object proxy , Method method , Object [ ] args ) { Class < ? > returnType = method . getReturnType ( ) ; if ( returnType . isPrimitive ( ) ) { if ( returnType == boolean . class ) { return defaultBooleanValue ; } else if ( returnType == byte . class ) { return defaultByteValue ; } else if ( returnType == short . class ) { return defaultShortValue ; } else if ( returnType == char . class ) { return defaultCharValue ; } else if ( returnType == int . class ) { return defaultIntValue ; } else if ( returnType == long . class ) { return defaultLongValue ; } else if ( returnType == float . class ) { return defaultFloatValue ; } else { return defaultDoubleValue ; } } else { return defaultReferenceValue ; } } } ) ; |
public class FnFloat { /** * Determines whether the target object and the specified object are NOT equal
* by calling the < tt > equals < / tt > method on the target object .
* @ param object the { @ link Float } to compare to the target
* @ return false if both objects are equal , true if not . */
public static final Function < Float , Boolean > notEq ( final Float object ) { } } | return ( Function < Float , Boolean > ) ( ( Function ) FnObject . notEq ( object ) ) ; |
public class CmsJspTagContentLoad { /** * Load the next file name from the initialized list of file names . < p >
* @ throws CmsException if something goes wrong */
protected void doLoadNextFile ( ) throws CmsException { } } | super . doLoadNextResource ( ) ; if ( m_resource == null ) { return ; } // upgrade the resource to a file
CmsFile file = m_cms . readFile ( m_resource ) ; // unmarshal the XML content from the resource , don ' t use unmarshal ( CmsObject , CmsResource )
// as no support for getting the historic version that has been cached by a CmsHistoryResourceHandler
// will come from there !
m_content = CmsXmlContentFactory . unmarshal ( m_cms , file , pageContext . getRequest ( ) ) ; // check if locale is available
m_contentLocale = m_locale ; if ( ! m_content . hasLocale ( m_contentLocale ) ) { Iterator < Locale > it = OpenCms . getLocaleManager ( ) . getDefaultLocales ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Locale locale = it . next ( ) ; if ( m_content . hasLocale ( locale ) ) { // found a matching locale
m_contentLocale = locale ; break ; } } } |
public class FieldInfo { /** * For numeric fields , get the current value .
* Usually overidden .
* @ return the field ' s value . */
public double getValue ( ) { } } | Object objData = this . getData ( ) ; if ( objData != null ) { Class < ? > classData = this . getDataClass ( ) ; if ( classData != Object . class ) if ( classData == objData . getClass ( ) ) { if ( classData == Short . class ) return ( ( Short ) objData ) . shortValue ( ) ; else if ( classData == Integer . class ) return ( ( Integer ) objData ) . intValue ( ) ; else if ( classData == Float . class ) return ( ( Float ) objData ) . floatValue ( ) ; else if ( classData == Double . class ) return ( ( Double ) objData ) . doubleValue ( ) ; else if ( classData == java . util . Date . class ) return ( ( Date ) objData ) . getTime ( ) ; else if ( classData == Boolean . class ) return ( ( ( Boolean ) objData ) . booleanValue ( ) ? 1 : 0 ) ; else if ( classData != String . class ) { try { return this . stringToDouble ( ( String ) objData ) . doubleValue ( ) ; } catch ( Exception ex ) { // Ignore the exception
} } } } return super . getValue ( ) ; // Return a 0 |
public class XFunctionTypeRefImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case XtypePackage . XFUNCTION_TYPE_REF__PARAM_TYPES : getParamTypes ( ) . clear ( ) ; getParamTypes ( ) . addAll ( ( Collection < ? extends JvmTypeReference > ) newValue ) ; return ; case XtypePackage . XFUNCTION_TYPE_REF__RETURN_TYPE : setReturnType ( ( JvmTypeReference ) newValue ) ; return ; case XtypePackage . XFUNCTION_TYPE_REF__TYPE : setType ( ( JvmType ) newValue ) ; return ; case XtypePackage . XFUNCTION_TYPE_REF__INSTANCE_CONTEXT : setInstanceContext ( ( Boolean ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class LoggingContext { /** * Get the location information of the logging event . If the information has
* been cached it is retrieved from the MDC ( for asynchronous events MDCs
* are retained ) , else it is generated .
* @ param event
* - The logging event
* @ return - The location information of the logging event . */
public LocationInfo getLocationInfo ( LoggingEvent event ) { } } | if ( event != loggingEvent . get ( ) ) { loggingEvent . set ( event ) ; clearLocationInfo ( ) ; } // For async appenders , the locationInfo is set in the MDC and not with
// the thread since the thread that processes the logging is different
// from the one that
// generates location information .
LocationInfo locationInfo = ( LocationInfo ) event . getMDC ( LOCATION_INFO ) ; if ( locationInfo == null ) { locationInfo = this . generateLocationInfo ( event ) ; } return locationInfo ; |
public class FlowPath { /** * This method allows to toggle wasExecuted ( ) state for specified node
* @ param nodeName
* @ param executed */
public void markExecuted ( @ NonNull String nodeName , boolean executed ) { } } | states . get ( nodeName ) . setExecuted ( executed ) ; |
public class BasePGPCommon { /** * reads the PGP public key from a PublicKeyRing
* @ param publicKeyRing
* the source public key ring
* @ param keyFilter
* the filter to apply
* @ return the matching PGP public or null if none matches */
protected PGPPublicKey retrievePublicKey ( PGPPublicKeyRing publicKeyRing , KeyFilter < PGPPublicKey > keyFilter ) { } } | LOGGER . trace ( "retrievePublicKey(PGPPublicKeyRing, KeyFilter<PGPPublicKey>)" ) ; PGPPublicKey result = null ; Iterator < PGPPublicKey > publicKeyIterator = publicKeyRing . getPublicKeys ( ) ; LOGGER . debug ( "Iterating through public keys in public key ring" ) ; while ( result == null && publicKeyIterator . hasNext ( ) ) { PGPPublicKey key = publicKeyIterator . next ( ) ; LOGGER . info ( "Found secret key: {}" , key . getKeyID ( ) ) ; LOGGER . debug ( "Checking public key with filter" ) ; if ( keyFilter . accept ( key ) ) { LOGGER . info ( "Public key {} selected from key ring" , key . getKeyID ( ) ) ; result = key ; } } return result ; |
public class Card { /** * Bank code . See < a
* href = " http : / / es . wikipedia . org / w / index . php ? title = CLABE & oldid = 71482742 # C . C3 . B3digo _ de _ Banco " > this < / a > for an
* incomplete list as of December , 2013. */
public Card bankCode ( final Integer bankCode ) { } } | if ( bankCode == null ) { this . bankCode = null ; } else { this . bankCode = String . format ( "%03d" , bankCode ) ; } return this ; |
public class ImageMiscOps { /** * Sets each value in the image to a value drawn from an uniform distribution that has a range of min & le ; X & lt ; max .
* @ param img Image which is to be filled . Modified ,
* @ param rand Random number generator
* @ param min Minimum value of the distribution , inclusive
* @ param max Maximum value of the distribution , inclusive */
public static void fillUniform ( GrayF64 img , Random rand , double min , double max ) { } } | double range = max - min ; double [ ] data = img . data ; for ( int y = 0 ; y < img . height ; y ++ ) { int index = img . getStartIndex ( ) + y * img . getStride ( ) ; for ( int x = 0 ; x < img . width ; x ++ ) { data [ index ++ ] = rand . nextDouble ( ) * range + min ; } } |
public class SignalServiceAccountManager { /** * Checks whether a contact is currently registered with the server .
* @ param e164number The contact to check .
* @ return An optional ContactTokenDetails , present if registered , absent if not .
* @ throws IOException */
public Optional < ContactTokenDetails > getContact ( String e164number ) throws IOException { } } | String contactToken = createDirectoryServerToken ( e164number , true ) ; ContactTokenDetails contactTokenDetails = this . pushServiceSocket . getContactTokenDetails ( contactToken ) ; if ( contactTokenDetails != null ) { contactTokenDetails . setNumber ( e164number ) ; } return Optional . fromNullable ( contactTokenDetails ) ; |
public class AWSKMSClient { /** * Returns a list of all tags for the specified customer master key ( CMK ) .
* You cannot perform this operation on a CMK in a different AWS account .
* @ param listResourceTagsRequest
* @ return Result of the ListResourceTags operation returned by the service .
* @ throws KMSInternalException
* The request was rejected because an internal exception occurred . The request can be retried .
* @ throws NotFoundException
* The request was rejected because the specified entity or resource could not be found .
* @ throws InvalidArnException
* The request was rejected because a specified ARN was not valid .
* @ throws InvalidMarkerException
* The request was rejected because the marker that specifies where pagination should next begin is not
* valid .
* @ sample AWSKMS . ListResourceTags
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / kms - 2014-11-01 / ListResourceTags " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ListResourceTagsResult listResourceTags ( ListResourceTagsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListResourceTags ( request ) ; |
public class Symbol { /** * The outermost class which indirectly owns this symbol . */
public ClassSymbol outermostClass ( ) { } } | Symbol sym = this ; Symbol prev = null ; while ( sym . kind != PCK ) { prev = sym ; sym = sym . owner ; } return ( ClassSymbol ) prev ; |
public class InputComponents { /** * Returns the completer associated with this { @ link InputComponent } or null if it is not available
* @ param inputComponent
* @ return the { @ link UICompleter } associated with this { @ link InputComponent } or null if not available or the
* { @ link InputComponent } does not implement { @ link HasCompleter } */
public static < VALUETYPE > UICompleter < VALUETYPE > getCompleterFor ( InputComponent < ? , VALUETYPE > inputComponent ) { } } | final UICompleter < VALUETYPE > result ; if ( inputComponent instanceof HasCompleter ) { result = ( ( HasCompleter ) inputComponent ) . getCompleter ( ) ; } else { result = null ; } return result ; |
public class QueueBufferFuture { /** * Report that the task this future represents has failed . */
public synchronized void setFailure ( Exception paramE ) { } } | if ( done ) return ; // can ' t mark done twice
e = paramE ; done = true ; notifyAll ( ) ; // if we have a callback to call , schedule
// it on a different thread . Who knows what this
// thread is doing .
if ( callback != null ) { QueueBuffer . executor . submit ( new Callable < Void > ( ) { public Void call ( ) throws Exception { callback . onError ( e ) ; return null ; } } ) ; } |
public class DistributedCache { /** * Checks if the cache has already been localized and is fresh */
private static boolean ifExistsAndFresh ( Configuration conf , FileSystem fs , URI cache , long confFileStamp , CacheStatus lcacheStatus , FileStatus fileStatus ) throws IOException { } } | // check for existence of the cache
long dfsFileStamp ; if ( fileStatus != null ) { dfsFileStamp = fileStatus . getModificationTime ( ) ; } else { dfsFileStamp = getTimestamp ( conf , cache ) ; } // ensure that the file on hdfs hasn ' t been modified since the job started
if ( dfsFileStamp != confFileStamp ) { LOG . fatal ( "File: " + cache + " has changed on HDFS since job started" ) ; throw new IOException ( "File: " + cache + " has changed on HDFS since job started" ) ; } if ( dfsFileStamp != lcacheStatus . mtime ) { // needs refreshing
return false ; } return true ; |
public class Client { /** * Makes a set of calls in parallel . Each parameter is sent to the
* corresponding address . When all values are available , or have timed out
* or errored , the collected results are returned in an array . The array
* contains nulls for calls that timed out or errored . */
public Writable [ ] call ( Writable [ ] params , InetSocketAddress [ ] addresses , Class < ? > protocol , UserGroupInformation ticket ) throws IOException { } } | if ( addresses . length == 0 ) return new Writable [ 0 ] ; ParallelResults results = new ParallelResults ( params . length ) ; synchronized ( results ) { for ( int i = 0 ; i < params . length ; i ++ ) { ParallelCall call = new ParallelCall ( params [ i ] , results , i ) ; try { Connection connection = getConnection ( addresses [ i ] , protocol , ticket , 0 , call ) ; connection . sendParam ( call , false ) ; // send each parameter
} catch ( RejectedExecutionException e ) { throw new IOException ( "connection has been closed" , e ) ; } catch ( IOException e ) { // log errors
LOG . info ( "Calling " + addresses [ i ] + " caught: " + e . getMessage ( ) , e ) ; results . size -- ; // wait for one fewer result
} catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; LOG . warn ( "interrupted waiting to send params to server" , e ) ; throw new IOException ( e ) ; } } while ( results . count != results . size ) { try { results . wait ( ) ; // wait for all results
} catch ( InterruptedException e ) { } } return results . values ; } |
public class ECheckService { /** * Method to retrieve ECheck
* @ param eCheckId
* @ return
* @ throws BaseException */
public ECheck retrieve ( String eCheckId ) throws BaseException { } } | logger . debug ( "Enter ECheckService::retrieve" ) ; if ( StringUtils . isBlank ( eCheckId ) ) { logger . error ( "IllegalArgumentException {}" , eCheckId ) ; throw new IllegalArgumentException ( "eCheckId cannot be empty or null" ) ; } // prepare API url
String apiUrl = requestContext . getBaseUrl ( ) + "echecks/{id}" . replaceAll ( "\\{format\\}" , "json" ) . replaceAll ( "\\{" + "id" + "\\}" , eCheckId . toString ( ) ) ; logger . info ( "apiUrl - " + apiUrl ) ; // assign TypeReference for deserialization
TypeReference < ECheck > typeReference = new TypeReference < ECheck > ( ) { } ; // prepare service request
Request request = new Request . RequestBuilder ( MethodType . GET , apiUrl ) . typeReference ( typeReference ) . context ( requestContext ) . build ( ) ; // make API call
Response response = sendRequest ( request ) ; // retrieve response
ECheck eCheckResponse = ( ECheck ) response . getResponseObject ( ) ; // set additional attributes
prepareResponse ( request , response , eCheckResponse ) ; return eCheckResponse ; |
public class IniFile { /** * Sets the specified java . sql . Timestamp property .
* @ param pstrSection the INI section name .
* @ param pstrProp the property to be set .
* @ param ptsVal the timestamp value to be persisted . */
public void setTimestampProperty ( String pstrSection , String pstrProp , Timestamp ptsVal , String pstrComments ) { } } | INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec == null ) { objSec = new INISection ( pstrSection ) ; this . mhmapSections . put ( pstrSection , objSec ) ; } objSec . setProperty ( pstrProp , timeToStr ( ptsVal , this . mstrTimeStampFmt ) , pstrComments ) ; |
public class JSDocInfoBuilder { /** * Adds a textual block to the current marker . */
public void markText ( String text , int startLineno , int startCharno , int endLineno , int endCharno ) { } } | if ( currentMarker != null ) { JSDocInfo . StringPosition position = new JSDocInfo . StringPosition ( ) ; position . setItem ( text ) ; position . setPositionInformation ( startLineno , startCharno , endLineno , endCharno ) ; currentMarker . setDescription ( position ) ; } |
public class RuntimeUtil { /** * 执行命令 < br >
* 命令带参数时参数可作为其中一个参数 , 也可以将命令和参数组合为一个字符串传入
* @ param cmds 命令
* @ return { @ link Process } */
public static Process exec ( String ... cmds ) { } } | if ( ArrayUtil . isEmpty ( cmds ) ) { throw new NullPointerException ( "Command is empty !" ) ; } // 单条命令的情况
if ( 1 == cmds . length ) { final String cmd = cmds [ 0 ] ; if ( StrUtil . isBlank ( cmd ) ) { throw new NullPointerException ( "Command is empty !" ) ; } cmds = StrUtil . splitToArray ( cmd , StrUtil . C_SPACE ) ; } Process process ; try { process = new ProcessBuilder ( cmds ) . redirectErrorStream ( true ) . start ( ) ; } catch ( IOException e ) { throw new IORuntimeException ( e ) ; } return process ; |
public class GRPCDriverClientService { /** * Helper methods */
private boolean isIdle ( ) { } } | LOG . log ( Level . INFO , "Clock idle {0}, outstanding evaluators {1}, current evaluators {2}" , new Object [ ] { this . clock . get ( ) . isIdle ( ) , this . outstandingEvaluatorCount , this . evaluatorBridgeMap . isEmpty ( ) } ) ; return clock . get ( ) . isIdle ( ) && this . outstandingEvaluatorCount == 0 && this . evaluatorBridgeMap . isEmpty ( ) ; |
public class JavaParsingAtomicQueueGenerator { /** * Generates something like < code > field = newValue < / code >
* @ param fieldName
* @ param valueName
* @ return */
protected BlockStmt fieldAssignment ( String fieldName , String valueName ) { } } | BlockStmt body = new BlockStmt ( ) ; body . addStatement ( new ExpressionStmt ( new AssignExpr ( new NameExpr ( fieldName ) , new NameExpr ( valueName ) , Operator . ASSIGN ) ) ) ; return body ; |
public class JSModule { /** * Gets the names of the modules that this module depends on ,
* sorted alphabetically . */
List < String > getSortedDependencyNames ( ) { } } | List < String > names = new ArrayList < > ( ) ; for ( JSModule module : getDependencies ( ) ) { names . add ( module . getName ( ) ) ; } Collections . sort ( names ) ; return names ; |
public class MXmlWriter { /** * { @ inheritDoc } */
@ Override public void print ( MBasicTable table , OutputStream out ) throws IOException { } } | // xml possible qu ' avec MTable
if ( table instanceof MListTable ) { writeXml ( ( MListTable < ? > ) table , out ) ; } else { throw new IllegalArgumentException ( ) ; } |
public class FeatureState { /** * Adds a single user to the list of users
* @ deprecated This method will be removed soon . Use { @ link # setParameter ( String , String ) } instead to modify the
* corresponding strategy parameter . */
@ Deprecated public FeatureState addUsers ( Collection < String > users ) { } } | Set < String > set = new LinkedHashSet < > ( ) ; set . addAll ( this . getUsers ( ) ) ; set . addAll ( users ) ; String setAsString = Strings . trimToNull ( Strings . join ( set , "," ) ) ; setParameter ( UsernameActivationStrategy . PARAM_USERS , setAsString ) ; return this ; |
public class ServerSocketSettings { /** * endregion */
public void applySettings ( @ NotNull ServerSocketChannel channel ) throws IOException { } } | if ( receiveBufferSize != 0 ) { channel . setOption ( SO_RCVBUF , receiveBufferSize ) ; } if ( reuseAddress != DEF_BOOL ) { channel . setOption ( SO_REUSEADDR , reuseAddress != FALSE ) ; } |
public class Customers { /** * This method is used to delete a saved credit card of an customer .
* @ param creditCardId
* { @ code String } the Moip credit card external ID .
* @ param setup
* { @ code Setup } the setup object .
* @ return { @ code Map < String , Object > } */
public Map < String , Object > deleteCreditCard ( String creditCardId , Setup setup ) { } } | this . requestMaker = new RequestMaker ( setup ) ; RequestProperties props = new RequestPropertiesBuilder ( ) . method ( "DELETE" ) . endpoint ( String . format ( "/v2/fundinginstruments/%s" , creditCardId ) ) . type ( Customers . class ) . contentType ( CONTENT_TYPE ) . build ( ) ; return this . requestMaker . doRequest ( props ) ; |
public class CassandraOutputFormatBase { /** * Closes all resources used . */
@ Override public void close ( ) throws IOException { } } | try { if ( session != null ) { session . close ( ) ; } } catch ( Exception e ) { LOG . error ( "Error while closing session." , e ) ; } try { if ( cluster != null ) { cluster . close ( ) ; } } catch ( Exception e ) { LOG . error ( "Error while closing cluster." , e ) ; } |
public class RepeatRecordFilter { /** * Configures the default logging handlers to use an instance of this
* filter . */
public static void configureDefaultHandler ( int maxRepeat ) { } } | Logger logger = LogManager . getLogManager ( ) . getLogger ( "" ) ; Handler [ ] handlers = logger . getHandlers ( ) ; RepeatRecordFilter filter = new RepeatRecordFilter ( maxRepeat ) ; for ( int ii = 0 ; ii < handlers . length ; ii ++ ) { handlers [ ii ] . setFilter ( filter ) ; } |
public class CommonOps_DDRM { /** * Performs an in - place element by element scalar multiplication . < br >
* < br >
* a < sub > ij < / sub > = & alpha ; * a < sub > ij < / sub >
* @ param a The matrix that is to be scaled . Modified .
* @ param alpha the amount each element is multiplied by . */
public static void scale ( double alpha , DMatrixD1 a ) { } } | // on very small matrices ( 2 by 2 ) the call to getNumElements ( ) can slow it down
// slightly compared to other libraries since it involves an extra multiplication .
final int size = a . getNumElements ( ) ; for ( int i = 0 ; i < size ; i ++ ) { a . data [ i ] *= alpha ; } |
public class DescribeModelRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeModelRequest describeModelRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeModelRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeModelRequest . getModelName ( ) , MODELNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MediaUtils { /** * Handle the activity result of an intent launched to capture a photo or choose an image
* @ see # getCameraCaptureIntent ( Context , String )
* @ see # getChooseMediaIntent ( String )
* @ param context the activity context
* @ param resultCode the result of the return code
* @ param requestCode the request code that launched the activity that caused the result
* @ param data the data from the result */
public static Observable < File > handleActivityResult ( final Context context , int resultCode , int requestCode , Intent data ) { } } | if ( resultCode == Activity . RESULT_OK ) { switch ( requestCode ) { case CAPTURE_PHOTO_REQUEST_CODE : if ( mCurrentCaptureUri != null ) { revokePermissions ( context , mCurrentCaptureUri ) ; File file = getAccessibleTempFile ( context , mCurrentCaptureUri ) ; mCurrentCaptureUri = null ; return Observable . just ( file ) ; } return Observable . error ( new FileNotFoundException ( "Unable to find camera capture" ) ) ; case PICK_MEDIA_REQUEST_CODE : final Uri mediaUri = data . getData ( ) ; final String fileName = getFileName ( context , mediaUri ) ; if ( mediaUri != null ) { return Observable . fromCallable ( new Callable < File > ( ) { @ Override public File call ( ) throws Exception { ParcelFileDescriptor parcelFileDescriptor = null ; try { parcelFileDescriptor = context . getContentResolver ( ) . openFileDescriptor ( mediaUri , "r" ) ; // Now that we have the file description , get the associated input stream
FileDescriptor fileDescriptor = parcelFileDescriptor . getFileDescriptor ( ) ; FileInputStream fis = new FileInputStream ( fileDescriptor ) ; FileOutputStream fos = null ; // Generate temporary output file and output file data to it
try { File tempFile = createTempFile ( context , fileName ) ; fos = new FileOutputStream ( tempFile ) ; byte [ ] buffer = new byte [ 1024 ] ; int len ; while ( ( len = fis . read ( buffer ) ) > 0 ) { fos . write ( buffer , 0 , len ) ; } return tempFile ; } catch ( IOException e ) { throw OnErrorThrowable . from ( e ) ; } finally { try { parcelFileDescriptor . close ( ) ; fis . close ( ) ; if ( fos != null ) { fos . close ( ) ; } } catch ( IOException e1 ) { e1 . printStackTrace ( ) ; } } } catch ( FileNotFoundException e ) { throw OnErrorThrowable . from ( e ) ; } } } ) . compose ( RxUtils . < File > applyWorkSchedulers ( ) ) ; } return Observable . error ( new FileNotFoundException ( "Unable to load selected file" ) ) ; default : return Observable . empty ( ) ; } } return Observable . empty ( ) ; |
public class LssClient { /** * list your streams by app name
* @ param app app name
* @ return the response */
public ListAppStreamsResponse listAppStreams ( String app ) { } } | ListAppStreamsRequest request = new ListAppStreamsRequest ( ) ; request . setApp ( app ) ; return listAppStreams ( request ) ; |
public class GenerateRunnersMojo { /** * Overrides the parameters with cucumber . options if they have been specified . Plugins have
* somewhat limited support . */
private OverriddenCucumberOptionsParameters overrideParametersWithCucumberOptions ( ) throws MojoExecutionException { } } | try { final OverriddenCucumberOptionsParameters overriddenParameters = new OverriddenCucumberOptionsParameters ( ) . setTags ( tags ) . setGlue ( glue ) . setStrict ( strict ) . setPlugins ( parseFormatAndPlugins ( format , plugins == null ? new ArrayList < Plugin > ( ) : plugins ) ) . setMonochrome ( monochrome ) ; if ( cucumberOptions != null && cucumberOptions . length ( ) > 0 ) { final RuntimeOptions options = new RuntimeOptions ( cucumberOptions ) ; overriddenParameters . overrideTags ( options . getFilters ( ) ) . overrideGlue ( options . getGlue ( ) ) . overridePlugins ( parsePlugins ( options . getPluginNames ( ) ) ) . overrideStrict ( options . isStrict ( ) ) . overrideMonochrome ( options . isMonochrome ( ) ) ; } return overriddenParameters ; } catch ( IllegalArgumentException e ) { throw new MojoExecutionException ( this , "Invalid parameter. " , e . getMessage ( ) ) ; } |
public class Activator { /** * Called whenever the OSGi framework starts our bundle */
public void start ( BundleContext bc ) throws Exception { } } | httpServiceRef = bc . getServiceReference ( HttpService . class ) ; if ( httpServiceRef != null ) { httpService = ( HttpService ) bc . getService ( httpServiceRef ) ; httpService . registerServlet ( "/status" , new StatusServlet ( ) , null , null ) ; httpService . registerServlet ( "/status-with-auth" , new StatusServlet ( ) , null , new AuthHttpContext ( ) ) ; } |
public class PactDslJsonArray { /** * Element that must be the specified value
* @ param value string value */
public PactDslJsonArray stringValue ( String value ) { } } | if ( value == null ) { body . put ( JSONObject . NULL ) ; } else { body . put ( value ) ; } return this ; |
public class PtoPMessageItemStream { /** * Returns the messagingEngineUuid .
* @ return SIBUuid */
public SIBUuid8 getLocalizingMEUuid ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getLocalizingMEUuid" ) ; SibTr . exit ( tc , "getLocalizingMEUuid" , messagingEngineUuid ) ; } return messagingEngineUuid ; |
public class TerminalEmulatorDeviceConfiguration { /** * Copies the current configuration . The new object has the given value .
* @ param cursorColor Color of the terminal text cursor
* @ return A copy of the current configuration with the changed value . */
public TerminalEmulatorDeviceConfiguration withCursorColor ( TextColor cursorColor ) { } } | if ( this . cursorColor == cursorColor ) { return this ; } else { return new TerminalEmulatorDeviceConfiguration ( this . lineBufferScrollbackSize , this . blinkLengthInMilliSeconds , this . cursorStyle , cursorColor , this . cursorBlinking , this . clipboardAvailable ) ; } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link TopoComplexMemberType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link TopoComplexMemberType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "maximalComplex" ) public JAXBElement < TopoComplexMemberType > createMaximalComplex ( TopoComplexMemberType value ) { } } | return new JAXBElement < TopoComplexMemberType > ( _MaximalComplex_QNAME , TopoComplexMemberType . class , null , value ) ; |
public class ProvidersInner { /** * Get available application frameworks and their versions .
* Get available application frameworks and their versions .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; ApplicationStackInner & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < ApplicationStackInner > > > getAvailableStacksSinglePageAsync ( ) { } } | if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } final String osTypeSelected = null ; return service . getAvailableStacks ( osTypeSelected , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < ApplicationStackInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < ApplicationStackInner > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < ApplicationStackInner > > result = getAvailableStacksDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < ApplicationStackInner > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class EntityInfo { /** * 数据库的值转换成数字段值
* @ param attr Attribute
* @ param entity 记录对象
* @ return Object */
public Serializable getFieldValue ( Attribute < T , Serializable > attr , T entity ) { } } | Serializable val = attr . get ( entity ) ; CryptHandler cryptHandler = attr . attach ( ) ; if ( cryptHandler != null ) val = ( Serializable ) cryptHandler . decrypt ( val ) ; return val ; |
public class TypeUtil { /** * 获取方法的参数类型 < br >
* 优先获取方法的GenericParameterTypes , 如果获取不到 , 则获取ParameterTypes
* @ param method 方法
* @ param index 第几个参数的索引 , 从0开始计数
* @ return { @ link Type } , 可能为 { @ code null } */
public static Type getParamType ( Method method , int index ) { } } | Type [ ] types = getParamTypes ( method ) ; if ( null != types && types . length > index ) { return types [ index ] ; } return null ; |
public class PoolUpdatePropertiesOptions { /** * Set the time the request was issued . Client libraries typically set this to the current system clock time ; set it explicitly if you are calling the REST API directly .
* @ param ocpDate the ocpDate value to set
* @ return the PoolUpdatePropertiesOptions object itself . */
public PoolUpdatePropertiesOptions withOcpDate ( DateTime ocpDate ) { } } | if ( ocpDate == null ) { this . ocpDate = null ; } else { this . ocpDate = new DateTimeRfc1123 ( ocpDate ) ; } return this ; |
public class Cache2kBuilder { /** * If a loader exception happens , this is the maximum time interval after a
* retry attempt is made . For retries an exponential backoff algorithm is used .
* It starts with the retry time and then increases the time to the maximum
* according to an exponential pattern .
* < p > By default identical to { @ link # resilienceDuration } */
public final Cache2kBuilder < K , V > maxRetryInterval ( long v , TimeUnit u ) { } } | config ( ) . setMaxRetryInterval ( u . toMillis ( v ) ) ; return this ; |
public class RetentionSet { /** * Find retention record on or before the given size .
* @ param size size
* @ return reference record which is greatest lower bound for given size . It returns null if no such record exists in the set . */
public StreamCutReferenceRecord findStreamCutReferenceForSize ( long size ) { } } | int beforeIndex = getGreatestLowerBound ( this , size , StreamCutReferenceRecord :: getRecordingSize ) ; if ( beforeIndex < 0 ) { return null ; } return retentionRecords . get ( beforeIndex ) ; |
public class GenericDao { /** * 查询符合条件的结果计数
* @ param column 条件字段
* @ param value 条件字段的值 。 支持集合对象 , 支持数组 , 会按照in 操作来组装条件
* @ return */
public int count ( String column , Object value ) { } } | return count ( Operators . match ( column , value ) ) ; |
public class UpdatePreferencesServlet { /** * Remove an element from the layout .
* @ param request
* @ param response
* @ return
* @ throws IOException */
@ RequestMapping ( method = RequestMethod . POST , params = "action=removeElement" ) public ModelAndView removeElement ( HttpServletRequest request , HttpServletResponse response ) throws IOException { } } | IUserInstance ui = userInstanceManager . getUserInstance ( request ) ; IPerson per = getPerson ( ui , response ) ; UserPreferencesManager upm = ( UserPreferencesManager ) ui . getPreferencesManager ( ) ; IUserLayoutManager ulm = upm . getUserLayoutManager ( ) ; try { // Delete the requested element node . This code is the same for
// all node types , so we can just have a generic action .
String elementId = request . getParameter ( "elementID" ) ; if ( ! ulm . deleteNode ( elementId ) ) { logger . info ( "Failed to remove element ID {} from layout root folder ID {}, delete node returned false" , elementId , ulm . getRootFolderId ( ) ) ; response . sendError ( HttpServletResponse . SC_FORBIDDEN ) ; return new ModelAndView ( "jsonView" , Collections . singletonMap ( "error" , getMessage ( "error.element.update" , "Unable to update element" , RequestContextUtils . getLocale ( request ) ) ) ) ; } ulm . saveUserLayout ( ) ; return new ModelAndView ( "jsonView" , Collections . emptyMap ( ) ) ; } catch ( PortalException e ) { return handlePersistError ( request , response , e ) ; } |
public class DescribeActivityTypeRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeActivityTypeRequest describeActivityTypeRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeActivityTypeRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeActivityTypeRequest . getDomain ( ) , DOMAIN_BINDING ) ; protocolMarshaller . marshall ( describeActivityTypeRequest . getActivityType ( ) , ACTIVITYTYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class DatabaseProviderVertx { /** * Execute a transaction on a Vert . x worker thread , with default semantics ( commit if
* the code completes successfully , or rollback if it throws an error ) . The provided
* result handler will be call after the commit or rollback , and will run on the event
* loop thread ( the same thread that is calling this method ) . */
public < T > void transactAsync ( final DbCodeTypedTx < T > code , Handler < AsyncResult < T > > resultHandler ) { } } | VertxUtil . executeBlocking ( executor , future -> { try { T returnValue = null ; Transaction tx = new TransactionImpl ( ) ; tx . setRollbackOnError ( true ) ; tx . setRollbackOnly ( false ) ; boolean complete = false ; try { returnValue = code . run ( this , tx ) ; complete = true ; } catch ( ThreadDeath | DatabaseException t ) { throw t ; } catch ( Throwable t ) { throw new DatabaseException ( "Error during transaction" , t ) ; } finally { if ( ( ! complete && tx . isRollbackOnError ( ) ) || tx . isRollbackOnly ( ) ) { rollbackAndClose ( ) ; } else { commitAndClose ( ) ; } } future . complete ( returnValue ) ; } catch ( ThreadDeath t ) { throw t ; } catch ( Throwable t ) { future . fail ( t ) ; } } , resultHandler ) ; |
public class PayloadSender { /** * Sends payload asynchronously . Returns boolean flag immediately indicating if payload send was
* scheduled
* @ throws IllegalArgumentException is payload is null */
synchronized boolean sendPayload ( final PayloadData payload ) { } } | if ( payload == null ) { throw new IllegalArgumentException ( "Payload is null" ) ; } // we don ' t allow concurrent payload sending
if ( isSendingPayload ( ) ) { return false ; } // we mark the sender as " busy " so no other payloads would be sent until we ' re done
sendingFlag = true ; try { sendPayloadRequest ( payload ) ; } catch ( Exception e ) { ApptentiveLog . e ( e , "Exception while sending payload: %s" , payload ) ; logException ( e ) ; // for NullPointerException , the message object would be null , we should handle it separately
// TODO : add a helper class for handling that
String message = e . getMessage ( ) ; if ( message == null ) { message = StringUtils . format ( "%s is thrown" , e . getClass ( ) . getSimpleName ( ) ) ; } // if an exception was thrown - mark payload as failed
handleFinishSendingPayload ( payload , false , message , - 1 , null ) ; // TODO : a better approach
} return true ; |
public class RTMPUtils { /** * Encodes header size marker and channel id into header marker .
* @ param out output buffer
* @ param headerSize Header size marker
* @ param channelId Channel used */
public static void encodeHeaderByte ( IoBuffer out , byte headerSize , int channelId ) { } } | if ( channelId <= 63 ) { out . put ( ( byte ) ( ( headerSize << 6 ) + channelId ) ) ; } else if ( channelId <= 319 ) { out . put ( ( byte ) ( headerSize << 6 ) ) ; out . put ( ( byte ) ( channelId - 64 ) ) ; } else { out . put ( ( byte ) ( ( headerSize << 6 ) | 1 ) ) ; channelId -= 64 ; out . put ( ( byte ) ( channelId & 0xff ) ) ; out . put ( ( byte ) ( channelId >> 8 ) ) ; } |
public class AbstractSegment3F { /** * Replies the distance between the line of this segment and the given point .
* @ param point
* @ return the distance . */
@ Pure public double distanceLine ( Point3D point ) { } } | return distanceLinePoint ( getX1 ( ) , getY1 ( ) , getZ1 ( ) , getX2 ( ) , getY2 ( ) , getZ2 ( ) , point . getX ( ) , point . getY ( ) , point . getZ ( ) ) ; |
public class AbstractMySQLQuery { /** * The GROUP BY clause permits a WITH ROLLUP modifier that causes extra rows to be added to the
* summary output . These rows represent higher - level ( or super - aggregate ) summary operations .
* ROLLUP thus enables you to answer questions at multiple levels of analysis with a single query .
* It can be used , for example , to provide support for OLAP ( Online Analytical Processing ) operations .
* @ return the current object */
@ WithBridgeMethods ( value = MySQLQuery . class , castRequired = true ) public C withRollup ( ) { } } | return addFlag ( Position . AFTER_GROUP_BY , WITH_ROLLUP ) ; |
public class GetPersonTrackingResult { /** * An array of the persons detected in the video and the time ( s ) their path was tracked throughout the video . An
* array element will exist for each time a person ' s path is tracked .
* @ param persons
* An array of the persons detected in the video and the time ( s ) their path was tracked throughout the video .
* An array element will exist for each time a person ' s path is tracked . */
public void setPersons ( java . util . Collection < PersonDetection > persons ) { } } | if ( persons == null ) { this . persons = null ; return ; } this . persons = new java . util . ArrayList < PersonDetection > ( persons ) ; |
public class XBELValidator { /** * { @ inheritDoc } */
@ Override public void validate ( final String s ) throws SAXException , IOException { } } | final Source s2 = new StreamSource ( new StringReader ( s ) ) ; validate ( s2 , null ) ; |
public class CouchDBObjectMapper { /** * Gets the json object .
* @ param columns
* the columns
* @ param object
* the object
* @ return the json object */
private static JsonObject getJsonObject ( Set < Attribute > columns , Object object ) { } } | JsonObject jsonObject = new JsonObject ( ) ; for ( Attribute column : columns ) { if ( ! column . isAssociation ( ) ) { Object valueObject = PropertyAccessorHelper . getObject ( object , ( Field ) column . getJavaMember ( ) ) ; jsonObject . add ( ( ( AbstractAttribute ) column ) . getJPAColumnName ( ) , getJsonPrimitive ( valueObject , column . getJavaType ( ) ) ) ; } } return jsonObject ; |
public class HttpUtils { /** * Creates a map from the parameters in the specified request . Multi value parameters will be in an array .
* @ param request the request */
public static Map < String , Object > createRequestParamsMap ( HttpServletRequest request ) { } } | Map < String , Object > paramsMap = new HashMap < > ( ) ; for ( Enumeration paramNameEnum = request . getParameterNames ( ) ; paramNameEnum . hasMoreElements ( ) ; ) { String paramName = ( String ) paramNameEnum . nextElement ( ) ; String [ ] paramValues = request . getParameterValues ( paramName ) ; if ( paramValues . length == 1 ) { paramsMap . put ( paramName , paramValues [ 0 ] ) ; } else { paramsMap . put ( paramName , paramValues ) ; } } return paramsMap ; |
public class Engine { /** * Get template engine singleton .
* @ param configPath - config path
* @ param configProperties - config properties
* @ return template engine */
public static Engine getEngine ( String configPath , Properties configProperties ) { } } | if ( StringUtils . isEmpty ( configPath ) ) { configPath = HTTL_PROPERTIES ; } VolatileReference < Engine > reference = ENGINES . get ( configPath ) ; if ( reference == null ) { reference = new VolatileReference < Engine > ( ) ; // quickly
VolatileReference < Engine > old = ENGINES . putIfAbsent ( configPath , reference ) ; if ( old != null ) { // duplicate
reference = old ; } } assert ( reference != null ) ; Engine engine = reference . get ( ) ; if ( engine == null ) { synchronized ( reference ) { // reference lock
engine = reference . get ( ) ; if ( engine == null ) { // double check
engine = BeanFactory . createBean ( Engine . class , initProperties ( configPath , configProperties ) ) ; // slowly
reference . set ( engine ) ; } } } assert ( engine != null ) ; return engine ; |
public class HttpImageUploadChannel { /** * Create a post request encapsulating bytes from the given
* ByteArrayOutputStream . */
private HttpPost setupRequest ( ByteArrayOutputStream bos ) { } } | ContentBody cb = new ByteArrayBody ( bos . toByteArray ( ) , "image" ) ; HttpPost postRequest = new HttpPost ( uri + "/uploadImage" ) ; MultipartEntity reqEntity = new MultipartEntity ( HttpMultipartMode . BROWSER_COMPATIBLE ) ; // add a single part to the request
reqEntity . addPart ( "file" , cb ) ; postRequest . setEntity ( reqEntity ) ; return postRequest ; |
public class Lists { /** * Creates a < i > mutable < / i > { @ code ArrayList } instance containing the given elements .
* @ param elements the elements that the list should contain , in order
* @ return a new { @ code ArrayList } containing those elements */
@ SafeVarargs public static < E > ArrayList < E > newArrayList ( E ... elements ) { } } | ArrayList < E > list = new ArrayList < E > ( ) ; Collections . addAll ( list , elements ) ; return list ; |
public class Order { /** * syntactic sugar */
public Reference addDetail ( ) { } } | Reference t = new Reference ( ) ; if ( this . detail == null ) this . detail = new ArrayList < Reference > ( ) ; this . detail . add ( t ) ; return t ; |
public class StorageSnippets { /** * [ VARIABLE 42 " ] */
public byte [ ] readBlobFromStringsWithGeneration ( String bucketName , String blobName , long blobGeneration ) { } } | // [ START readBlobFromStringsWithGeneration ]
byte [ ] content = storage . readAllBytes ( bucketName , blobName , BlobSourceOption . generationMatch ( blobGeneration ) ) ; // [ END readBlobFromStringsWithGeneration ]
return content ; |
public class ArrayHeap { /** * iterative heapify up : move item o at index up until correctly placed */
private int heapifyUp ( HeapEntry < E > entry ) { } } | int numSwaps = 0 ; while ( true ) { if ( entry . index == 0 ) { break ; } HeapEntry < E > parentEntry = parent ( entry ) ; if ( compare ( entry , parentEntry ) >= 0 ) { break ; } numSwaps ++ ; swap ( entry , parentEntry ) ; } return numSwaps ; |
public class AbstractResource { /** * Gets all objects managed by this resource . By default , only users with
* the < code > admin < / code > role are authorized to use this API . Setting
* the < code > restricted < / code > field to < code > false < / code > in the two -
* argument constructor will change this behavior so that non - admin users
* may also make this API call .
* @ param req the HTTP servlet request .
* @ return the list of objects managed by this resource .
* @ throws HttpStatusException if an error occurred , for example , the user
* is not authorized to make this call . */
@ GET @ Produces ( MediaType . APPLICATION_JSON ) public List < C > getAll ( @ Context HttpServletRequest req ) { } } | if ( isRestricted ( ) && ! req . isUserInRole ( "admin" ) ) { throw new HttpStatusException ( Response . Status . FORBIDDEN ) ; } List < C > results = new ArrayList < > ( ) ; for ( E userEntity : this . dao . getAll ( ) ) { results . add ( toComm ( userEntity , req ) ) ; } return results ; |
public class Vector3f { /** * / * ( non - Javadoc )
* @ see org . joml . Vector3fc # div ( float , org . joml . Vector3f ) */
public Vector3f div ( float scalar , Vector3f dest ) { } } | float inv = 1.0f / scalar ; dest . x = x * inv ; dest . y = y * inv ; dest . z = z * inv ; return dest ; |
public class Beans { /** * Chooses a method / constructor of a given name , whose signature best matches the given list of argument types .
* @ param < T > the type of the member / constructor to return
* @ param candidates the list of method / constructor candidates to choose from
* @ param pe the ParameterExtractor
* @ param name the name of the method / constructor
* @ param argumentTypes the argument types
* @ return the method / constructor
* @ throws NoSuchMethodException if an appropriate method / constructor cannot be found */
public static < T extends AccessibleObject & Member > T choose ( T [ ] candidates , ParameterExtractor pe , String name , Class < ? > [ ] argumentTypes ) throws NoSuchMethodException { } } | T chosenCandidate = null ; Class < ? > [ ] chosenParamTypes = null ; // try to find the most applicable candidate
Search : for ( int i = 0 ; i < candidates . length ; i ++ ) { // System . err . println ( " Looking at candidate " + candidates [ i ] ) ;
// ignore functions with different name
if ( name != null && ! candidates [ i ] . getName ( ) . equals ( name ) ) continue ; // ignore covariance on static candidates
if ( Modifier . isStatic ( candidates [ i ] . getModifiers ( ) ) ) continue ; // Class < ? > [ ] parameterTypes = candidates [ i ] . getParameterTypes ( ) ;
Class < ? > [ ] parameterTypes = pe . getParameterTypes ( candidates [ i ] ) ; // ignore functions with wrong number of parameters
if ( parameterTypes . length != argumentTypes . length ) continue ; // coerce the primitives to objects
boxPrimitives ( parameterTypes ) ; // ignore functions with incompatible parameter types
for ( int j = 0 ; j < parameterTypes . length ; j ++ ) { if ( ! parameterTypes [ j ] . isAssignableFrom ( argumentTypes [ j ] ) ) continue Search ; } // System . err . println ( " Considering candidate " + candidates [ i ] ) ;
// if this is the first match then save it
if ( chosenCandidate == null ) { chosenCandidate = candidates [ i ] ; chosenParamTypes = parameterTypes ; } else { // if this candidate is more specific in compatibility then save it
for ( int j = 0 ; j < chosenParamTypes . length ; j ++ ) { if ( ! chosenParamTypes [ j ] . isAssignableFrom ( parameterTypes [ j ] ) ) continue Search ; } // this is the best fit so far
chosenCandidate = candidates [ i ] ; chosenParamTypes = parameterTypes ; // System . err . println ( " Best candidate so far " + chosenCandidate ) ;
} } // return to the caller indicating that candidate was not found
if ( chosenCandidate == null ) { throw ( new NoSuchMethodException ( "Method not found: " + name ) ) ; } // System . err . println ( " Chosen candidate is " + chosenCandidate ) ;
// return the covariant candidate
return accessible ( chosenCandidate ) ; // Java bug # 4071957 - have to call setAccessible even on public methods |
public class DynamicOutputBuffer { /** * Encodes the given string as UTF - 8 , puts it into the buffer
* and increases the write position accordingly .
* @ param s the string to put
* @ return the number of UTF - 8 bytes put */
public int putUTF8 ( String s ) { } } | int written = putUTF8 ( _position , s ) ; _position += written ; return written ; |
public class Log4JLogger { /** * Log a message at level TRACE according to the specified format and
* argument .
* This form avoids superfluous object creation when the logger is disabled
* for level TRACE .
* @ param format
* the format string
* @ param arg
* the argument */
@ Override public void trace ( String format , Object arg ) { } } | if ( isTraceEnabled ( ) ) { FormattingTuple ft = MessageFormatter . format ( format , arg ) ; logger . log ( FQCN , traceCapable ? Level . TRACE : Level . DEBUG , ft . getMessage ( ) , ft . getThrowable ( ) ) ; } |
public class SeekableByteChannelPrefetcher { /** * Reads a sequence of bytes from this channel into the given buffer .
* < p > Bytes are read starting at this channel ' s current position , and then the position is updated
* with the number of bytes actually read . Otherwise this method behaves exactly as specified in
* the { @ link java . nio . channels . ReadableByteChannel } interface .
* @ param dst buffer to write into */
@ Override public synchronized int read ( ByteBuffer dst ) throws IOException { } } | if ( ! open ) { throw new ClosedChannelException ( ) ; } try { if ( trackTime ) { msBetweenCallsToRead += betweenCallsToRead . elapsed ( TimeUnit . MILLISECONDS ) ; } ByteBuffer src ; try { Stopwatch waitingForData ; if ( trackTime ) { waitingForData = Stopwatch . createStarted ( ) ; } src = fetch ( position ) ; if ( trackTime ) { msWaitingForData += waitingForData . elapsed ( TimeUnit . MILLISECONDS ) ; } } catch ( InterruptedException e ) { // Restore interrupted status
Thread . currentThread ( ) . interrupt ( ) ; return 0 ; } catch ( ExecutionException e ) { throw new RuntimeException ( e ) ; } if ( null == src ) { // the caller is asking for a block past EOF
nbReadsPastEnd ++ ; return - 1 ; // EOF
} Stopwatch copyingData ; if ( trackTime ) { copyingData = Stopwatch . createStarted ( ) ; } // src . position is how far we ' ve written into the array
long blockIndex = position / bufSize ; int offset = ( int ) ( position - ( blockIndex * bufSize ) ) ; // src | = = = = = - - - - - |
// : < - - - src . pos - - > - - - - - src . limit - - - - - > :
// | - - - : - - position - >
// : < - - offset - - >
// ^ blockIndex * bufSize
int availableToCopy = src . position ( ) - offset ; if ( availableToCopy < 0 ) { // the caller is asking to read past the end of the file
nbReadsPastEnd ++ ; return - 1 ; // EOF
} int bytesToCopy = dst . remaining ( ) ; byte [ ] array = src . array ( ) ; if ( availableToCopy < bytesToCopy ) { bytesToCopy = availableToCopy ; } dst . put ( array , offset , bytesToCopy ) ; position += bytesToCopy ; if ( trackTime ) { msCopyingData += copyingData . elapsed ( TimeUnit . MILLISECONDS ) ; } bytesReturned += bytesToCopy ; if ( availableToCopy == 0 ) { // EOF
return - 1 ; } return bytesToCopy ; } finally { if ( trackTime ) { betweenCallsToRead . reset ( ) ; betweenCallsToRead . start ( ) ; } } |
public class PostalAddress { /** * region > title */
public String title ( ) { } } | if ( getPlaceId ( ) != null ) { return getFormattedAddress ( ) ; } else { final TitleBuffer buf = new TitleBuffer ( ) ; buf . append ( getAddressLine1 ( ) ) . append ( "," , getAddressLine2 ( ) ) . append ( "," , getAddressLine3 ( ) ) . append ( "," , getAddressLine4 ( ) ) . append ( "," , getPostalCode ( ) ) . append ( "," , getCountry ( ) ) ; return StringUtils . abbreviateMiddle ( buf . toString ( ) , "..." , 30 ) ; } |
public class BitsUtil { /** * Copy a bitset .
* Note : Bits beyond mincap < em > may < / em > be retained !
* @ param v Array to copy
* @ param mincap Target < em > minimum < / em > capacity
* @ param shift Number of bits to shift left
* @ return Copy with space for at least " capacity " bits */
public static long [ ] copy ( long [ ] v , int mincap , int shift ) { } } | int words = ( ( mincap - 1 ) >>> LONG_LOG2_SIZE ) + 1 ; if ( v . length == words && shift == 0 ) { return Arrays . copyOf ( v , v . length ) ; } long [ ] ret = new long [ words ] ; final int shiftWords = shift >>> LONG_LOG2_SIZE ; final int shiftBits = shift & LONG_LOG2_MASK ; // Simple case - multiple of word size
if ( shiftBits == 0 ) { for ( int i = shiftWords ; i < ret . length ; i ++ ) { ret [ i ] |= v [ i - shiftWords ] ; } return ret ; } // Overlapping case
final int unshiftBits = Long . SIZE - shiftBits ; final int end = Math . min ( ret . length , v . length + shiftWords ) - 1 ; for ( int i = end ; i > shiftWords ; i -- ) { final int src = i - shiftWords ; ret [ i ] |= ( v [ src ] << shiftBits ) | ( v [ src - 1 ] >>> unshiftBits ) ; } ret [ shiftWords ] |= v [ 0 ] << shiftBits ; return ret ; |
public class FactorGraph { /** * Identical to { @ link # outcomeToAssignment ( List , List ) } , but with
* arrays .
* @ param factorVariables
* @ param outcome
* @ return */
public Assignment outcomeToAssignment ( String [ ] factorVariables , Object [ ] outcome ) { } } | return outcomeToAssignment ( Arrays . asList ( factorVariables ) , Arrays . asList ( outcome ) ) ; |
public class ExpansionPointGroupMember { /** * Returns the group member that manages the command with the given id , or null if none of the
* members in this expansion point manage a command with that id .
* @ param commandId The id of the command whose managing member is to be returned .
* @ return The group member that manages the command with the given id , or null . */
public GroupMember getMemberFor ( String commandId ) { } } | for ( Iterator it = members . iterator ( ) ; it . hasNext ( ) ; ) { GroupMember member = ( GroupMember ) it . next ( ) ; if ( member . managesCommand ( commandId ) ) { return member ; } } return null ; |
public class Job { /** * Set the named arguments .
* @ param vars
* the new named arguments */
@ SuppressWarnings ( "unchecked" ) public void setVars ( final Map < String , ? extends Object > vars ) { } } | this . vars = ( Map < String , Object > ) vars ; |
public class QueryImpl { /** * Sets the relation entities .
* @ param enhanceEntities
* the enhance entities
* @ param client
* the client
* @ param m
* the m
* @ return the list */
protected List < Object > setRelationEntities ( List enhanceEntities , Client client , EntityMetadata m ) { } } | // Enhance entities can contain or may not contain relation .
// if it contain a relation means it is a child
// if it does not then it means it is a parent .
List < Object > result = new ArrayList < Object > ( ) ; // Stack of objects . To be used for referring any similar object found
// later .
// This prevents infinite recursive loop and hence prevents stack
// overflow .
Map < Object , Object > relationStack = new HashMap < Object , Object > ( ) ; if ( enhanceEntities != null ) { for ( Object e : enhanceEntities ) { addToRelationStack ( relationStack , e , m ) ; } } if ( enhanceEntities != null ) { for ( Object e : enhanceEntities ) { if ( ! ( e instanceof EnhanceEntity ) ) { e = new EnhanceEntity ( e , PropertyAccessorHelper . getId ( e , m ) , null ) ; } EnhanceEntity ee = ( EnhanceEntity ) e ; result . add ( getReader ( ) . recursivelyFindEntities ( ee . getEntity ( ) , ee . getRelations ( ) , m , persistenceDelegeator , false , relationStack ) ) ; } } return result ; |
public class DTMDefaultBase { /** * Diagnostics function to dump the DTM . */
public void dumpDTM ( OutputStream os ) { } } | try { if ( os == null ) { File f = new File ( "DTMDump" + ( ( Object ) this ) . hashCode ( ) + ".txt" ) ; System . err . println ( "Dumping... " + f . getAbsolutePath ( ) ) ; os = new FileOutputStream ( f ) ; } PrintStream ps = new PrintStream ( os ) ; while ( nextNode ( ) ) { } int nRecords = m_size ; ps . println ( "Total nodes: " + nRecords ) ; for ( int index = 0 ; index < nRecords ; ++ index ) { int i = makeNodeHandle ( index ) ; ps . println ( "=========== index=" + index + " handle=" + i + " ===========" ) ; ps . println ( "NodeName: " + getNodeName ( i ) ) ; ps . println ( "NodeNameX: " + getNodeNameX ( i ) ) ; ps . println ( "LocalName: " + getLocalName ( i ) ) ; ps . println ( "NamespaceURI: " + getNamespaceURI ( i ) ) ; ps . println ( "Prefix: " + getPrefix ( i ) ) ; int exTypeID = _exptype ( index ) ; ps . println ( "Expanded Type ID: " + Integer . toHexString ( exTypeID ) ) ; int type = _type ( index ) ; String typestring ; switch ( type ) { case DTM . ATTRIBUTE_NODE : typestring = "ATTRIBUTE_NODE" ; break ; case DTM . CDATA_SECTION_NODE : typestring = "CDATA_SECTION_NODE" ; break ; case DTM . COMMENT_NODE : typestring = "COMMENT_NODE" ; break ; case DTM . DOCUMENT_FRAGMENT_NODE : typestring = "DOCUMENT_FRAGMENT_NODE" ; break ; case DTM . DOCUMENT_NODE : typestring = "DOCUMENT_NODE" ; break ; case DTM . DOCUMENT_TYPE_NODE : typestring = "DOCUMENT_NODE" ; break ; case DTM . ELEMENT_NODE : typestring = "ELEMENT_NODE" ; break ; case DTM . ENTITY_NODE : typestring = "ENTITY_NODE" ; break ; case DTM . ENTITY_REFERENCE_NODE : typestring = "ENTITY_REFERENCE_NODE" ; break ; case DTM . NAMESPACE_NODE : typestring = "NAMESPACE_NODE" ; break ; case DTM . NOTATION_NODE : typestring = "NOTATION_NODE" ; break ; case DTM . NULL : typestring = "NULL" ; break ; case DTM . PROCESSING_INSTRUCTION_NODE : typestring = "PROCESSING_INSTRUCTION_NODE" ; break ; case DTM . TEXT_NODE : typestring = "TEXT_NODE" ; break ; default : typestring = "Unknown!" ; break ; } ps . println ( "Type: " + typestring ) ; int firstChild = _firstch ( index ) ; if ( DTM . NULL == firstChild ) ps . println ( "First child: DTM.NULL" ) ; else if ( NOTPROCESSED == firstChild ) ps . println ( "First child: NOTPROCESSED" ) ; else ps . println ( "First child: " + firstChild ) ; if ( m_prevsib != null ) { int prevSibling = _prevsib ( index ) ; if ( DTM . NULL == prevSibling ) ps . println ( "Prev sibling: DTM.NULL" ) ; else if ( NOTPROCESSED == prevSibling ) ps . println ( "Prev sibling: NOTPROCESSED" ) ; else ps . println ( "Prev sibling: " + prevSibling ) ; } int nextSibling = _nextsib ( index ) ; if ( DTM . NULL == nextSibling ) ps . println ( "Next sibling: DTM.NULL" ) ; else if ( NOTPROCESSED == nextSibling ) ps . println ( "Next sibling: NOTPROCESSED" ) ; else ps . println ( "Next sibling: " + nextSibling ) ; int parent = _parent ( index ) ; if ( DTM . NULL == parent ) ps . println ( "Parent: DTM.NULL" ) ; else if ( NOTPROCESSED == parent ) ps . println ( "Parent: NOTPROCESSED" ) ; else ps . println ( "Parent: " + parent ) ; int level = _level ( index ) ; ps . println ( "Level: " + level ) ; ps . println ( "Node Value: " + getNodeValue ( i ) ) ; ps . println ( "String Value: " + getStringValue ( i ) ) ; } } catch ( IOException ioe ) { ioe . printStackTrace ( System . err ) ; throw new RuntimeException ( ioe . getMessage ( ) ) ; } |
public class ConfigurationContext { /** * Called when context configuration is finished ( but extensions installation is not finished yet ) .
* Merges disabled items configuration with registered items or creates new items to hold disable info . */
public void finalizeConfiguration ( ) { } } | for ( ConfigItem type : disabledItemsHolder . keys ( ) ) { for ( Class < ? > item : disabledItemsHolder . get ( type ) ) { final DisableSupport info = getOrCreateInfo ( type , item ) ; info . getDisabledBy ( ) . addAll ( disabledByHolder . get ( getType ( item ) ) ) ; } } |
public class VirtualCdj { /** * Tell a device to become tempo master .
* @ param deviceNumber the device we want to take over the role of tempo master
* @ throws IOException if there is a problem sending the command to the device
* @ throws IllegalStateException if the { @ code VirtualCdj } is not active
* @ throws IllegalArgumentException if { @ code deviceNumber } is not found on the network */
public void appointTempoMaster ( int deviceNumber ) throws IOException { } } | final DeviceUpdate update = getLatestStatusFor ( deviceNumber ) ; if ( update == null ) { throw new IllegalArgumentException ( "Device " + deviceNumber + " not found on network." ) ; } appointTempoMaster ( update ) ; |
public class ControllerHandler { /** * Specify the Response content - type by . . .
* < ol >
* < li > setting the first Produces content type < / li >
* < li > negotiating with the Request if multiple content - types are specified in Produces < / li >
* < / ol >
* @ param routeContext */
protected void specifyContentType ( RouteContext routeContext ) { } } | if ( ! declaredProduces . isEmpty ( ) ) { // Specify first Produces content - type
String defaultContentType = declaredProduces . get ( 0 ) ; routeContext . getResponse ( ) . contentType ( defaultContentType ) ; if ( declaredProduces . size ( ) > 1 ) { // negotiate content - type from Request Accept / Content - Type
routeContext . negotiateContentType ( ) ; } } |
public class InternalSimpleExpressionsParser { /** * InternalSimpleExpressions . g : 760:1 : entryRuleFQN returns [ String current = null ] : iv _ ruleFQN = ruleFQN EOF ; */
public final String entryRuleFQN ( ) throws RecognitionException { } } | String current = null ; AntlrDatatypeRuleToken iv_ruleFQN = null ; try { // InternalSimpleExpressions . g : 761:2 : ( iv _ ruleFQN = ruleFQN EOF )
// InternalSimpleExpressions . g : 762:2 : iv _ ruleFQN = ruleFQN EOF
{ newCompositeNode ( grammarAccess . getFQNRule ( ) ) ; pushFollow ( FOLLOW_1 ) ; iv_ruleFQN = ruleFQN ( ) ; state . _fsp -- ; current = iv_ruleFQN . getText ( ) ; match ( input , EOF , FOLLOW_2 ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class ServiceUpdater { /** * Add the requested post parameters to the Request .
* @ param request Request to add post params to */
private void addPostParams ( final Request request ) { } } | if ( webhookUrl != null ) { request . addPostParam ( "WebhookUrl" , webhookUrl . toString ( ) ) ; } if ( friendlyName != null ) { request . addPostParam ( "FriendlyName" , friendlyName ) ; } if ( reachabilityWebhooksEnabled != null ) { request . addPostParam ( "ReachabilityWebhooksEnabled" , reachabilityWebhooksEnabled . toString ( ) ) ; } if ( aclEnabled != null ) { request . addPostParam ( "AclEnabled" , aclEnabled . toString ( ) ) ; } |
public class LoginUnauthorizedException { public OptionalThing < Redirectable > getMappedRedirectable ( ) { } } | // exists after application exception handling
final Class < ? > exType = getClass ( ) ; return OptionalThing . ofNullable ( mappedRedirectable , ( ) -> { throw new IllegalStateException ( "Not found the mapped redirectable in exception: " + exType ) ; } ) ; |
public class RefreshEvent { /** * sync metric meta from rocks db into mem cache on startup */
private void syncMetaFromCache ( String topology , TopologyMetricContext tmContext ) { } } | if ( ! tmContext . syncMeta ( ) ) { Map < String , Long > meta = context . getMetricCache ( ) . getMeta ( topology ) ; if ( meta != null ) { tmContext . getMemMeta ( ) . putAll ( meta ) ; } tmContext . setSyncMeta ( true ) ; } |
public class UfsInfo { /** * < code > optional . alluxio . grpc . file . MountPOptions properties = 2 ; < / code > */
public alluxio . grpc . MountPOptionsOrBuilder getPropertiesOrBuilder ( ) { } } | return properties_ == null ? alluxio . grpc . MountPOptions . getDefaultInstance ( ) : properties_ ; |
public class JobsImpl { /** * Lists the jobs that have been created under the specified job schedule .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ param serviceFuture the ServiceFuture object tracking the Retrofit calls
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < List < CloudJob > > listFromJobScheduleNextAsync ( final String nextPageLink , final ServiceFuture < List < CloudJob > > serviceFuture , final ListOperationCallback < CloudJob > serviceCallback ) { } } | return AzureServiceFuture . fromHeaderPageResponse ( listFromJobScheduleNextSinglePageAsync ( nextPageLink ) , new Func1 < String , Observable < ServiceResponseWithHeaders < Page < CloudJob > , JobListFromJobScheduleHeaders > > > ( ) { @ Override public Observable < ServiceResponseWithHeaders < Page < CloudJob > , JobListFromJobScheduleHeaders > > call ( String nextPageLink ) { return listFromJobScheduleNextSinglePageAsync ( nextPageLink , null ) ; } } , serviceCallback ) ; |
public class UllmannState { /** * Refines the compatibility removing any mappings which have now become
* invalid ( since the last mapping ) . The matrix is refined from the row
* after the current { @ code row } - all previous rows are fixed . If when
* refined we find a query vertex has no more candidates left in the target
* we can never reach a feasible matching and refinement is aborted ( false
* is returned ) .
* @ param row refine from here
* @ return match is still feasible */
private boolean refine ( int row ) { } } | int marking = - ( row + 1 ) ; boolean changed ; do { changed = false ; // for every feasible mapping verify if it is still valid
for ( int n = row + 1 ; n < matrix . nRows ; n ++ ) { for ( int m = 0 ; m < matrix . mCols ; m ++ ) { if ( matrix . get ( n , m ) && ! verify ( n , m ) ) { // remove the now invalid mapping
matrix . mark ( n , m , marking ) ; changed = true ; // no more mappings for n in the feasibility matrix
if ( ! hasCandidate ( n ) ) return false ; } } } } while ( changed ) ; return true ; |
public class RulePrunerFactory { /** * Updating the coverage ranges .
* @ param range the global range array .
* @ param grammar The grammar ( i . e . set of rules ) used for this update .
* @ return an updated array . */
public static boolean [ ] updateRanges ( boolean [ ] range , GrammarRules grammar ) { } } | boolean [ ] res = Arrays . copyOf ( range , range . length ) ; for ( GrammarRuleRecord r : grammar ) { if ( 0 == r . getRuleNumber ( ) ) { continue ; } res = updateRanges ( res , r . getRuleIntervals ( ) ) ; } return res ; |
public class BaseSimulator { /** * Stops the simulator . */
@ Override public void stop ( ) { } } | try { logger . info ( "\n###stopping..." ) ; connection . close ( ) ; this . isRunning = false ; logger . info ( "\n#" + getSimulatorName ( ) + "\nstopped." ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } |
public class AbstractTrimDirectiveModel { /** * Parse string parameter .
* @ param params the params
* @ param paramName the param name
* @ return the string */
@ SuppressWarnings ( "rawtypes" ) protected String parseStringParameter ( Map params , String paramName ) { } } | Object paramModel = params . get ( paramName ) ; if ( paramModel == null ) { return null ; } if ( ! ( paramModel instanceof SimpleScalar ) ) { throw new IllegalArgumentException ( paramName + " must be string" ) ; } return ( ( SimpleScalar ) paramModel ) . getAsString ( ) ; |
public class Expressive { /** * Report whether a polled sample of the variable is { @ code true } . */
public boolean the ( Sampler < Boolean > variable , Ticker ticker ) { } } | return the ( variable , ticker , isQuietlyTrue ( ) ) ; |
public class AbstrCFMLScriptTransformer { /** * Liest ein einzelnes Statement ein ( if , for , while usw . ) . < br / >
* EBNF : < br / >
* < code > " ; " | " if " spaces " ( " ifStatement | " function " funcStatement | " while " spaces " ( " whileStatement |
* " do " spaces " { " doStatement | " for " spaces " ( " forStatement | " return " returnStatement |
* " break " breakStatement | " continue " continueStatement | " / * " comment | expressionStatement ; < / code >
* @ param parent uebergeornetes Element dem das Statement zugewiesen wird .
* @ throws TemplateException */
private final void statement ( Data data , Body parent ) throws TemplateException { } } | statement ( data , parent , data . context ) ; |
public class EventEngineImpl { /** * Process the service configuration looking for properties that
* fit the format < code > stage . < i > stage name < / i > . topics < / code > and
* that point to a list of topics to associate with the stage .
* @ param config
* the service configuration properties */
protected void processWorkStageProperties ( Map < String , Object > config ) { } } | for ( Map . Entry < String , Object > entry : config . entrySet ( ) ) { if ( entry . getKey ( ) . startsWith ( CFG_KEY_STAGE_PREFIX ) ) { String [ ] topics ; Object o = entry . getValue ( ) ; if ( o instanceof String [ ] ) { topics = ( String [ ] ) o ; } else if ( o instanceof String ) { topics = new String [ ] { ( String ) o } ; } else { topics = new String [ 0 ] ; } String stageName = entry . getKey ( ) . substring ( CFG_KEY_STAGE_PREFIX . length ( ) ) ; topicCache . setStageTopics ( stageName , topics ) ; } } |
public class Clock { /** * Sets the current minute of the clock
* @ param MINUTE */
public void setMinute ( final int MINUTE ) { } } | minute = MINUTE % 60 ; calculateAngles ( hour , minute , second ) ; repaint ( getInnerBounds ( ) ) ; |
public class FlexibleLOF { /** * Get the kNN queries for the algorithm .
* @ param relation the data
* @ param stepprog the progress logger
* @ return the kNN queries for the algorithm */
private Pair < KNNQuery < O > , KNNQuery < O > > getKNNQueries ( Database database , Relation < O > relation , StepProgress stepprog ) { } } | DistanceQuery < O > distQ = database . getDistanceQuery ( relation , reachabilityDistanceFunction , DatabaseQuery . HINT_HEAVY_USE ) ; // " HEAVY " flag for knnReach since it is used more than once
KNNQuery < O > knnReach = database . getKNNQuery ( distQ , kreach , DatabaseQuery . HINT_HEAVY_USE , DatabaseQuery . HINT_OPTIMIZED_ONLY , DatabaseQuery . HINT_NO_CACHE ) ; // No optimized kNN query - use a preprocessor !
if ( ! ( knnReach instanceof PreprocessorKNNQuery ) ) { if ( stepprog != null ) { if ( referenceDistanceFunction . equals ( reachabilityDistanceFunction ) ) { stepprog . beginStep ( 1 , "Materializing neighborhoods w.r.t. reference neighborhood distance function." , LOG ) ; } else { stepprog . beginStep ( 1 , "Not materializing neighborhoods w.r.t. reference neighborhood distance function, but materializing neighborhoods w.r.t. reachability distance function." , LOG ) ; } } int kpreproc = ( referenceDistanceFunction . equals ( reachabilityDistanceFunction ) ) ? Math . max ( kreach , krefer ) : kreach ; knnReach = DatabaseUtil . precomputedKNNQuery ( database , relation , reachabilityDistanceFunction , kpreproc ) ; } // knnReach is only used once
KNNQuery < O > knnRefer ; if ( referenceDistanceFunction == reachabilityDistanceFunction || referenceDistanceFunction . equals ( reachabilityDistanceFunction ) ) { knnRefer = knnReach ; } else { // do not materialize the first neighborhood , since it is used only once
knnRefer = QueryUtil . getKNNQuery ( relation , referenceDistanceFunction , krefer ) ; } return new Pair < > ( knnRefer , knnReach ) ; |
public class ProcessEventCommand { /** * Create a ballModel instance .
* @ param event the create event */
private void createBallModel ( final JRebirthEvent event ) { } } | switch ( event . eventType ( ) ) { case CREATE_APPLICATION : case CREATE_NOTIFIER : case CREATE_GLOBAL_FACADE : case CREATE_COMMAND_FACADE : case CREATE_SERVICE_FACADE : case CREATE_UI_FACADE : case CREATE_COMMAND : case CREATE_SERVICE : case CREATE_MODEL : case CREATE_VIEW : case CREATE_CONTROLLER : // final BallModel ballModel = getModel ( BallModel . class , event ) ;
callCommand ( CreateBallCommand . class , WBuilder . waveData ( EditorWaves . EVENT , event ) ) ; break ; case CREATE_WAVE : default : } |
public class JawnServletContext { /** * Returns an instance of < code > java . util . Map < / code > containing parameter names as keys and parameter values as map values .
* The keys in the parameter map are of type String . The values in the parameter map are of type String array .
* MTD : re - mapped the return value to accommodate a different coding style
* @ return an instance < code > java . util . Map < / code > containing parameter names as keys and parameter values as map values .
* The keys in the parameter map are of type String . The values in the parameter map are of type String array . */
public MultiList < String > /* Map < String , List < String > > */
params ( ) { } } | // MTD : deleted class SimpleHash as its only contribution was an unnecessary # toString ( )
// - for the curious , it wrote : { first : [ more ] , of : [ it ] } as opposed to standard : { first = [ more ] , of = [ it ] }
// # getParameterMap ( ) is by default unmodifiable , so we need to re - map it
Map < String , String [ ] > requestParams = request . getParameterMap ( ) ; MultiList < String > params = new MultiList < > ( ) ; for ( Entry < String , String [ ] > entry : requestParams . entrySet ( ) ) { params . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } if ( getId ( ) != null ) params . put ( "id" , getId ( ) ) ; Map < String , String > routeParameters = route . getPathParametersEncoded ( routedPath ) ; // requestContext / * getRequestContext ( ) * / . getUserSegments ( ) ;
for ( Entry < String , String > entry : routeParameters . entrySet ( ) ) { params . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } // MTD : added wildcard to params
// String wildCard = requestContext . getWildCardName ( ) ;
// if ( wildCard ! = null )
// params . put ( wildCard , requestContext . getWildCardValue ( ) ) ;
return params ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcSectionedSpine ( ) { } } | if ( ifcSectionedSpineEClass == null ) { ifcSectionedSpineEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 590 ) ; } return ifcSectionedSpineEClass ; |
public class BackupsInner { /** * Triggers backup for specified backed up item . This is an asynchronous operation . To know the status of the operation , call GetProtectedItemOperationResult API .
* @ param vaultName The name of the recovery services vault .
* @ param resourceGroupName The name of the resource group where the recovery services vault is present .
* @ param fabricName Fabric name associated with the backup item .
* @ param containerName Container name associated with the backup item .
* @ param protectedItemName Backup item for which backup needs to be triggered .
* @ param parameters resource backup request
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */
public void trigger ( String vaultName , String resourceGroupName , String fabricName , String containerName , String protectedItemName , BackupRequestResource parameters ) { } } | triggerWithServiceResponseAsync ( vaultName , resourceGroupName , fabricName , containerName , protectedItemName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class DateParser { /** * Parses a Date out of a string using an array of masks .
* It uses the masks in order until one of them succedes or all fail .
* @ param masks array of masks to use for parsing the string
* @ param sDate string to parse for a date .
* @ return the Date represented by the given string using one of the given masks . It returns
* < b > null < / b > if it was not possible to parse the the string with any of the masks . */
private static Date parseUsingMask ( final String [ ] masks , String sDate , final Locale locale ) { } } | if ( sDate != null ) { sDate = sDate . trim ( ) ; } ParsePosition pp = null ; Date d = null ; for ( int i = 0 ; d == null && i < masks . length ; i ++ ) { final DateFormat df = new SimpleDateFormat ( masks [ i ] , locale ) ; // df . setLenient ( false ) ;
df . setLenient ( true ) ; try { pp = new ParsePosition ( 0 ) ; d = df . parse ( sDate , pp ) ; if ( pp . getIndex ( ) != sDate . length ( ) ) { d = null ; } } catch ( final Exception ex1 ) { } } return d ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.