signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ParameterImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setKpi ( boolean newKpi ) { } } | boolean oldKpi = kpi ; kpi = newKpi ; boolean oldKpiESet = kpiESet ; kpiESet = true ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , BpsimPackage . PARAMETER__KPI , oldKpi , kpi , ! oldKpiESet ) ) ; |
public class FormdefScanner { /** * Scans the input for medium maps and adds to the
* formdef .
* This scanner will modify the AfpInputStreams position .
* If you need to keep position , please provide a new
* AfpInputStream .
* @ param in formdef or afp file to read medium maps from
* @ return formdef in memory representation of the formdef
* @ throws IOException */
public static Formdef scan ( AfpInputStream in ) throws IOException { } } | Formdef formdef = new FormdefImpl ( ) ; SF sf ; LinkedList < SF > sfbuffer = null ; while ( ( sf = in . readStructuredField ( ) ) != null ) { log . trace ( "{}" , sf ) ; switch ( sf . eClass ( ) . getClassifierID ( ) ) { case AfplibPackage . ERG : case AfplibPackage . BDT : return null ; case AfplibPackage . EFM : return formdef ; case AfplibPackage . BDG : sfbuffer = new LinkedList < SF > ( ) ; break ; case AfplibPackage . EDG : sfbuffer . add ( sf ) ; formdef . setBDG ( ( SF [ ] ) sfbuffer . toArray ( new SF [ sfbuffer . size ( ) ] ) ) ; sfbuffer = null ; break ; case AfplibPackage . BMM : sfbuffer = new LinkedList < SF > ( ) ; break ; case AfplibPackage . EMM : sfbuffer . add ( sf ) ; formdef . add ( ( SF [ ] ) sfbuffer . toArray ( new SF [ sfbuffer . size ( ) ] ) ) ; sfbuffer = null ; break ; } if ( sfbuffer != null ) sfbuffer . add ( sf ) ; } return null ; |
public class PactDslJsonArray { /** * Matches a URL that is composed of a base path and a sequence of path expressions
* @ param basePath The base path for the URL ( like " http : / / localhost : 8080 / " ) which will be excluded from the matching
* @ param pathFragments Series of path fragments to match on . These can be strings or regular expressions . */
public PactDslJsonArray matchUrl ( String basePath , Object ... pathFragments ) { } } | UrlMatcherSupport urlMatcher = new UrlMatcherSupport ( basePath , Arrays . asList ( pathFragments ) ) ; body . put ( urlMatcher . getExampleValue ( ) ) ; matchers . addRule ( rootPath + appendArrayIndex ( 0 ) , regexp ( urlMatcher . getRegexExpression ( ) ) ) ; return this ; |
public class EscapedFunctions2 { /** * ifnull translation
* @ param buf The buffer to append into
* @ param parsedArgs arguments
* @ throws SQLException if something wrong happens */
public static void sqlifnull ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { } } | twoArgumentsFunctionCall ( buf , "coalesce(" , "ifnull" , parsedArgs ) ; |
public class CreateHITWithHITTypeRequest { /** * If the HITLayoutId is provided , any placeholder values must be filled in with values using the HITLayoutParameter
* structure . For more information , see HITLayout .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setHITLayoutParameters ( java . util . Collection ) } or { @ link # withHITLayoutParameters ( java . util . Collection ) }
* if you want to override the existing values .
* @ param hITLayoutParameters
* If the HITLayoutId is provided , any placeholder values must be filled in with values using the
* HITLayoutParameter structure . For more information , see HITLayout .
* @ return Returns a reference to this object so that method calls can be chained together . */
public CreateHITWithHITTypeRequest withHITLayoutParameters ( HITLayoutParameter ... hITLayoutParameters ) { } } | if ( this . hITLayoutParameters == null ) { setHITLayoutParameters ( new java . util . ArrayList < HITLayoutParameter > ( hITLayoutParameters . length ) ) ; } for ( HITLayoutParameter ele : hITLayoutParameters ) { this . hITLayoutParameters . add ( ele ) ; } return this ; |
public class AbstractConsumerKey { /** * Is this consumer set suspended because it has breached its concurrency limit ?
* @ return */
public boolean isConsumerSetSuspended ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isConsumerSetSuspended" ) ; boolean consumerSetSuspended = false ; if ( classifyingMessages ) consumerSetSuspended = consumerSet . isConsumerSetSuspended ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isConsumerSetSuspended" , Boolean . valueOf ( consumerSetSuspended ) ) ; return consumerSetSuspended ; |
public class DTMDocumentImpl { /** * Given a node handle , return an ID that represents the node ' s expanded name .
* @ param nodeHandle The handle to the node in question .
* @ return the expanded - name id of the node . */
public int getExpandedTypeID ( int nodeHandle ) { } } | nodes . readSlot ( nodeHandle , gotslot ) ; String qName = m_localNames . indexToString ( gotslot [ 3 ] ) ; // Remove prefix from qName
// % TBD % jjk This is assuming the elementName is the qName .
int colonpos = qName . indexOf ( ":" ) ; String localName = qName . substring ( colonpos + 1 ) ; // Get NS
String namespace = m_nsNames . indexToString ( gotslot [ 0 ] << 16 ) ; // Create expanded name
String expandedName = namespace + ":" + localName ; int expandedNameID = m_nsNames . stringToIndex ( expandedName ) ; return expandedNameID ; |
public class BandwidthSchedulesInner { /** * Creates or updates a bandwidth schedule .
* @ param deviceName The device name .
* @ param name The bandwidth schedule name which needs to be added / updated .
* @ param resourceGroupName The resource group name .
* @ param parameters The bandwidth schedule to be added or updated .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the BandwidthScheduleInner object if successful . */
public BandwidthScheduleInner createOrUpdate ( String deviceName , String name , String resourceGroupName , BandwidthScheduleInner parameters ) { } } | return createOrUpdateWithServiceResponseAsync ( deviceName , name , resourceGroupName , parameters ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class StringParser { /** * Parse the given { @ link String } as float .
* @ param sStr
* The string to parse . May be < code > null < / code > .
* @ param fDefault
* The default value to be returned if the passed object could not be
* converted to a valid value .
* @ return The default value if the string does not represent a valid value . */
public static float parseFloat ( @ Nullable final String sStr , final float fDefault ) { } } | // parseDouble throws a NPE if parameter is null
if ( sStr != null && sStr . length ( ) > 0 ) try { // Single point where we replace " , " with " . " for parsing !
return Float . parseFloat ( _getUnifiedDecimal ( sStr ) ) ; } catch ( final NumberFormatException ex ) { // Fall through
} return fDefault ; |
public class Transaction { /** * Same as { @ link # addSignedInput ( TransactionOutPoint , Script , ECKey , Transaction . SigHash , boolean ) }
* but defaults to { @ link SigHash # ALL } and " false " for the anyoneCanPay flag . This is normally what you want . */
public TransactionInput addSignedInput ( TransactionOutPoint prevOut , Script scriptPubKey , ECKey sigKey ) throws ScriptException { } } | return addSignedInput ( prevOut , scriptPubKey , sigKey , SigHash . ALL , false ) ; |
public class C4BlobStore { /** * Reads the entire contents of a blob into memory . Caller is responsible for freeing it . */
public FLSliceResult getContents ( C4BlobKey blobKey ) throws LiteCoreException { } } | return new FLSliceResult ( getContents ( handle , blobKey . getHandle ( ) ) ) ; |
public class CustomFunctions { /** * Splits a string into equally sized chunks
* @ param text the text to split
* @ param size the chunk size
* @ return the list of chunks */
private static List < String > chunk ( String text , int size ) { } } | List < String > chunks = new ArrayList < > ( ) ; for ( int i = 0 ; i < text . length ( ) ; i += size ) { chunks . add ( StringUtils . substring ( text , i , i + size ) ) ; } return chunks ; |
public class EntityManagerImpl { /** * ( non - Javadoc )
* @ see javax . persistence . EntityManager # createNativeQuery ( java . lang . String ,
* java . lang . Class ) */
@ Override public final Query createNativeQuery ( String sqlString , Class resultClass ) { } } | checkClosed ( ) ; checkTransactionNeeded ( ) ; return getPersistenceDelegator ( ) . createNativeQuery ( sqlString , resultClass ) ; |
public class FeatureGenerators { /** * Gets a feature generator that first converts the data ,
* then applies a given feature generator .
* @ param generator
* @ param converter
* @ return */
public static < A , B , C > FeatureGenerator < A , C > convertingFeatureGenerator ( FeatureGenerator < B , C > generator , Function < A , B > converter ) { } } | return new ConvertingFeatureGenerator < A , B , C > ( generator , converter ) ; |
public class TaskGroup { /** * Handles successful completion of a task .
* If the task is not root ( terminal ) task then this kickoff execution of next set of ready tasks
* @ param completedEntry the entry holding completed task
* @ param context the context object shared across all the task entries in this group during execution
* @ return an observable represents asynchronous operation in the next stage */
private Observable < Indexable > processCompletedTaskAsync ( final TaskGroupEntry < TaskItem > completedEntry , final InvocationContext context ) { } } | reportCompletion ( completedEntry ) ; if ( isRootEntry ( completedEntry ) ) { return Observable . empty ( ) ; } else { return invokeReadyTasksAsync ( context ) ; } |
public class ModelsImpl { /** * Gets information about the composite entity model .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param cEntityId The composite entity extractor ID .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the CompositeEntityExtractor object */
public Observable < CompositeEntityExtractor > getCompositeEntityAsync ( UUID appId , String versionId , UUID cEntityId ) { } } | return getCompositeEntityWithServiceResponseAsync ( appId , versionId , cEntityId ) . map ( new Func1 < ServiceResponse < CompositeEntityExtractor > , CompositeEntityExtractor > ( ) { @ Override public CompositeEntityExtractor call ( ServiceResponse < CompositeEntityExtractor > response ) { return response . body ( ) ; } } ) ; |
public class Configuration { /** * Updates the stored settings of a connection with these values from the response of the iSCSI Target .
* @ param targetName The name of the iSCSI Target .
* @ param connectionID The ID of the connection within this iSCSI Target .
* @ param response The response settings .
* @ throws NoSuchSessionException if a session with this target name is not open . */
public final void update ( final String targetName , final int connectionID , final SettingsMap response ) throws NoSuchSessionException { } } | final SessionConfiguration sc ; synchronized ( sessionConfigs ) { sc = sessionConfigs . get ( targetName ) ; synchronized ( sc ) { if ( sc == null ) { throw new NoSuchSessionException ( "A session with the ID '" + targetName + "' does not exist." ) ; } synchronized ( response ) { SettingEntry se ; for ( Map . Entry < OperationalTextKey , String > e : response . entrySet ( ) ) { synchronized ( globalConfig ) { se = globalConfig . get ( e . getKey ( ) ) ; if ( se == null ) { if ( LOGGER . isWarnEnabled ( ) ) { LOGGER . warn ( "This key " + e . getKey ( ) + " is not in the globalConfig." ) ; } continue ; } synchronized ( se ) { if ( se . getScope ( ) . compareTo ( VALUE_SCOPE_SESSION ) == 0 ) { sc . updateSessionSetting ( e . getKey ( ) , e . getValue ( ) , se . getResult ( ) ) ; } else if ( se . getScope ( ) . compareTo ( VALUE_SCOPE_CONNECTION ) == 0 ) { sc . updateConnectionSetting ( connectionID , e . getKey ( ) , e . getValue ( ) , se . getResult ( ) ) ; } } } } } } } |
public class MessagesApi { /** * Get Normalized Actions
* Get the actions normalized
* @ param uid User ID . If not specified , assume that of the current authenticated user . If specified , it must be that of a user for which the current authenticated user has read access to . ( optional )
* @ param ddid Destination device ID of the actions being searched . ( optional )
* @ param mid The message ID being searched . ( optional )
* @ param offset A string that represents the starting item , should be the value of & # 39 ; next & # 39 ; field received in the last response . ( required for pagination ) ( optional )
* @ param count count ( optional )
* @ param startDate startDate ( optional )
* @ param endDate endDate ( optional )
* @ param order Desired sort order : & # 39 ; asc & # 39 ; or & # 39 ; desc & # 39 ; ( optional )
* @ return ApiResponse & lt ; NormalizedActionsEnvelope & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < NormalizedActionsEnvelope > getNormalizedActionsWithHttpInfo ( String uid , String ddid , String mid , String offset , Integer count , Long startDate , Long endDate , String order ) throws ApiException { } } | com . squareup . okhttp . Call call = getNormalizedActionsValidateBeforeCall ( uid , ddid , mid , offset , count , startDate , endDate , order , null , null ) ; Type localVarReturnType = new TypeToken < NormalizedActionsEnvelope > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class CBADao { /** * We expect a clean up to date invoice , with all the items except the cba , that we will compute in that method */
public InvoiceItemModelDao computeCBAComplexity ( final InvoiceModelDao invoice , @ Nullable final BigDecimal accountCBAOrNull , @ Nullable final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory , final InternalCallContext context ) throws EntityPersistenceException , InvoiceApiException { } } | final BigDecimal balance = getInvoiceBalance ( invoice ) ; if ( balance . compareTo ( BigDecimal . ZERO ) < 0 ) { // Current balance is negative , we need to generate a credit ( positive CBA amount )
return buildCBAItem ( invoice , balance , context ) ; } else if ( balance . compareTo ( BigDecimal . ZERO ) > 0 && invoice . getStatus ( ) == InvoiceStatus . COMMITTED && ! invoice . isWrittenOff ( ) ) { // Current balance is positive and the invoice is COMMITTED , we need to use some of the existing if available ( negative CBA amount )
// PERF : in some codepaths , the CBA maybe have already been computed
BigDecimal accountCBA = accountCBAOrNull ; if ( accountCBAOrNull == null ) { accountCBA = getAccountCBAFromTransaction ( entitySqlDaoWrapperFactory , context ) ; } if ( accountCBA . compareTo ( BigDecimal . ZERO ) <= 0 ) { return null ; } final BigDecimal positiveCreditAmount = accountCBA . compareTo ( balance ) > 0 ? balance : accountCBA ; return buildCBAItem ( invoice , positiveCreditAmount , context ) ; } else { // 0 balance , nothing to do .
return null ; } |
public class RequestContext { /** * Pretty renders .
* @ return this context */
public RequestContext renderPretty ( ) { } } | if ( renderer instanceof JsonRenderer ) { final JsonRenderer r = ( JsonRenderer ) renderer ; r . setPretty ( true ) ; } return this ; |
public class ApiOvhTelephony { /** * Get this object properties
* REST : GET / telephony / { billingAccount } / easyHunting / { serviceName } / screenListConditions / conditions / { conditionId }
* @ param billingAccount [ required ] The name of your billingAccount
* @ param serviceName [ required ]
* @ param conditionId [ required ] */
public OvhEasyHuntingScreenListsConditions billingAccount_easyHunting_serviceName_screenListConditions_conditions_conditionId_GET ( String billingAccount , String serviceName , Long conditionId ) throws IOException { } } | String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions/{conditionId}" ; StringBuilder sb = path ( qPath , billingAccount , serviceName , conditionId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhEasyHuntingScreenListsConditions . class ) ; |
public class MoleculePropertyCalculator { /** * method to get the molecular weight for the whole HELM
* @ param helm2notation input HELM2Notation
* @ return MolecularWeight of the whole HELM
* @ throws BuilderMoleculeException if the whole molecule can not be built
* @ throws CTKException general ChemToolKit exception passed to HELMToolKit
* @ throws ChemistryException if the Chemistry Engine can not be initialized */
public static double getMolecularWeight ( HELM2Notation helm2notation ) throws BuilderMoleculeException , CTKException , ChemistryException { } } | /* First build one big molecule ; List of molecules ? */
List < AbstractMolecule > molecules = buildMolecule ( helm2notation ) ; return calculateMolecularWeight ( molecules ) ; |
public class DuCommand { /** * Prints the size messages .
* @ param sizeMessage the total size message to print
* @ param inAlluxioMessage the in Alluxio size message to print
* @ param inMemMessage the in memory size message to print
* @ param path the path to print */
private void printInfo ( String sizeMessage , String inAlluxioMessage , String inMemMessage , String path ) { } } | System . out . println ( inMemMessage . isEmpty ( ) ? String . format ( SHORT_INFO_FORMAT , sizeMessage , inAlluxioMessage , path ) : String . format ( LONG_INFO_FORMAT , sizeMessage , inAlluxioMessage , inMemMessage , path ) ) ; |
public class Allure { /** * Syntax sugar for { @ link # step ( ThrowableContextRunnable ) } .
* @ param runnable the step ' s body . */
public static void step ( final ThrowableContextRunnableVoid < StepContext > runnable ) { } } | step ( step -> { runnable . run ( step ) ; return null ; } ) ; |
public class SearchIndex { /** * Clone the default Index directory manager
* @ return an initialized { @ link DirectoryManager } .
* @ throws IOException
* if the directory manager cannot be instantiated or an
* exception occurs while initializing the manager . */
protected DirectoryManager cloneDirectoryManager ( DirectoryManager directoryManager , String suffix ) throws IOException { } } | try { DirectoryManager df = directoryManager . getClass ( ) . newInstance ( ) ; df . init ( this . path + suffix ) ; return df ; } catch ( IOException e ) { throw e ; } catch ( Exception e ) { IOException ex = new IOException ( ) ; ex . initCause ( e ) ; throw ex ; } |
public class ServerFactory { /** * 初始化Server实例
* @ param serverConfig 服务端配置
* @ return Server */
public synchronized static Server getServer ( ServerConfig serverConfig ) { } } | try { Server server = SERVER_MAP . get ( Integer . toString ( serverConfig . getPort ( ) ) ) ; if ( server == null ) { // 算下网卡和端口
resolveServerConfig ( serverConfig ) ; ExtensionClass < Server > ext = ExtensionLoaderFactory . getExtensionLoader ( Server . class ) . getExtensionClass ( serverConfig . getProtocol ( ) ) ; if ( ext == null ) { throw ExceptionUtils . buildRuntime ( "server.protocol" , serverConfig . getProtocol ( ) , "Unsupported protocol of server!" ) ; } server = ext . getExtInstance ( ) ; server . init ( serverConfig ) ; SERVER_MAP . put ( serverConfig . getPort ( ) + "" , server ) ; } return server ; } catch ( SofaRpcRuntimeException e ) { throw e ; } catch ( Throwable e ) { throw new SofaRpcRuntimeException ( e . getMessage ( ) , e ) ; } |
public class ResolverSystemFactory { /** * Creates a new { @ link ResolverSystem } instance of the specified user view type using the { @ link Thread } Context
* { @ link ClassLoader } . Will consult a configuration file visible to the { @ link Thread } Context { @ link ClassLoader } named
* " META - INF / services / $ fullyQualfiedClassName " which should contain a key = value format with the key
* { @ link ResolverSystemFactory # KEY _ IMPL _ CLASS _ NAME } . The implementation class name must have a no - arg constructor .
* @ param userViewClass The user view type
* @ return The new { @ link ResolverSystem } instance of the specified user view type created by using the { @ link Thread }
* Context { @ link ClassLoader } .
* @ throws IllegalArgumentException
* If the user view class was not specified */
static < RESOLVERSYSTEMTYPE extends ResolverSystem > RESOLVERSYSTEMTYPE createFromUserView ( final Class < RESOLVERSYSTEMTYPE > userViewClass ) throws IllegalArgumentException { } } | return createFromUserView ( userViewClass , SecurityActions . getThreadContextClassLoader ( ) ) ; |
public class MongoDBSchemaManager { /** * initiate client method initiates the client .
* @ return boolean value ie client started or not . */
protected boolean initiateClient ( ) { } } | for ( String host : hosts ) { if ( host == null || ! StringUtils . isNumeric ( port ) || port . isEmpty ( ) ) { logger . error ( "Host or port should not be null / port should be numeric" ) ; throw new IllegalArgumentException ( "Host or port should not be null / port should be numeric" ) ; } List < MongoCredential > credentials = MongoDBUtils . fetchCredentials ( puMetadata . getProperties ( ) , externalProperties ) ; ServerAddress addr ; try { addr = new ServerAddress ( host , Integer . parseInt ( port ) ) ; } catch ( NumberFormatException ex ) { throw new SchemaGenerationException ( ex ) ; } mongo = new MongoClient ( addr , credentials ) ; db = mongo . getDB ( databaseName ) ; return true ; } return false ; |
public class Internal { /** * Returns a corrected value if this is a floating point value to fix .
* OpenTSDB used to encode all floating point values as ` float ' ( 4 bytes )
* but actually store them on 8 bytes , with 4 leading 0 bytes , and flags
* correctly stating the value was on 4 bytes .
* This function detects such values and returns a corrected value , without
* the 4 leading zeros . Otherwise it returns the value unchanged .
* ( from CompactionQueue )
* @ param flags The least significant byte of a qualifier .
* @ param value The value that may need to be corrected .
* @ throws IllegalDataException if the value is malformed . */
public static byte [ ] fixFloatingPointValue ( final byte flags , final byte [ ] value ) { } } | if ( floatingPointValueToFix ( flags , value ) ) { // The first 4 bytes should really be zeros .
if ( value [ 0 ] == 0 && value [ 1 ] == 0 && value [ 2 ] == 0 && value [ 3 ] == 0 ) { // Just keep the last 4 bytes .
return new byte [ ] { value [ 4 ] , value [ 5 ] , value [ 6 ] , value [ 7 ] } ; } else { // Very unlikely .
throw new IllegalDataException ( "Corrupted floating point value: " + Arrays . toString ( value ) + " flags=0x" + Integer . toHexString ( flags ) + " -- first 4 bytes are expected to be zeros." ) ; } } return value ; |
public class JsonSliceUtil { /** * Encodes the given list of { @ link JsonSlice } s to valid JSON .
* @ param slices List of { @ link JsonSlice } s to encode
* @ return Valid JSON - formatted string
* @ throws JsonFormatException
* @ throws IOException
* @ author vvakame */
public static String slicesToString ( List < JsonSlice > slices ) throws JsonFormatException , IOException { } } | if ( slices == null || slices . size ( ) == 0 ) { throw new JsonFormatException ( "slices is null or empty." ) ; } StringWriter writer = new StringWriter ( ) ; int cnt = slices . size ( ) ; for ( int i = 0 ; i < cnt ; i ++ ) { JsonSlice slice = slices . get ( i ) ; if ( slice == null ) { throw new JsonFormatException ( "slice is null. i=" + i ) ; } switch ( slice . getState ( ) ) { case START_ARRAY : i = slicesToStringInArray ( slices , i , writer ) ; break ; case START_HASH : i = slicesToStringInHash ( slices , i , writer ) ; break ; default : throw new JsonFormatException ( "invalid state. i=" + i + " is " + slice . getState ( ) ) ; } } return writer . toString ( ) ; |
public class ClientFactory { /** * Asynchronously creates a new message receiver to the entity on the messagingFactory .
* @ param messagingFactory messaging factory ( which represents a connection ) on which receiver needs to be created .
* @ param entityPath path of entity
* @ param receiveMode PeekLock or ReceiveAndDelete
* @ return a CompletableFuture representing the pending creation of message receiver */
public static CompletableFuture < IMessageReceiver > createMessageReceiverFromEntityPathAsync ( MessagingFactory messagingFactory , String entityPath , ReceiveMode receiveMode ) { } } | return createMessageReceiverFromEntityPathAsync ( messagingFactory , entityPath , null , receiveMode ) ; |
public class WorldMapProcessor { /** * Counts the coordinates stored in a single statement for the relevant
* property , if they are actually given and valid .
* @ param statement
* @ param itemDocument */
private void countCoordinateStatement ( Statement statement , ItemDocument itemDocument ) { } } | Value value = statement . getValue ( ) ; if ( ! ( value instanceof GlobeCoordinatesValue ) ) { return ; } GlobeCoordinatesValue coordsValue = ( GlobeCoordinatesValue ) value ; if ( ! this . globe . equals ( ( coordsValue . getGlobe ( ) ) ) ) { return ; } int xCoord = ( int ) ( ( ( coordsValue . getLongitude ( ) + 180.0 ) / 360.0 ) * this . width ) % this . width ; int yCoord = ( int ) ( ( ( coordsValue . getLatitude ( ) + 90.0 ) / 180.0 ) * this . height ) % this . height ; if ( xCoord < 0 || yCoord < 0 || xCoord >= this . width || yCoord >= this . height ) { System . out . println ( "Dropping out-of-range coordinate: " + coordsValue ) ; return ; } countCoordinates ( xCoord , yCoord , itemDocument ) ; this . count += 1 ; if ( this . count % 100000 == 0 ) { reportProgress ( ) ; writeImages ( ) ; } |
import java . util . regex . Matcher ; import java . util . regex . Pattern ; public class IdentifyAdverbs { /** * Fetches all adverbs and their locations in a given sentence utilizing regular expression .
* > > > identify _ adverbs ( ' Undoubtedly , she has no reason for such behavior . ' )
* ' 0-11 : Undoubtedly '
* > > > identify _ adverbs ( ' Deal with the situation cautiously ' )
* ' 25-35 : cautiously '
* > > > identify _ adverbs ( ' Finish the task promptly ' )
* ' 18-25 : promptly '
* @ param sentence : String input representing the sentence .
* @ return str : The starting and ending indexes and the adverb found . */
public static String identifyAdverbs ( String sentence ) { } } | Pattern p = Pattern . compile ( "\\b\\w+ly\\b" ) ; Matcher m = p . matcher ( sentence ) ; if ( m . find ( ) ) { return m . start ( ) + "-" + m . end ( ) + ": " + m . group ( ) ; } return null ; |
public class ViolationThresholdComparator { /** * Returns true if solutions s1 and / or s2 have an overall constraint
* violation with value less than 0 */
public boolean needToCompare ( S solution1 , S solution2 ) { } } | boolean needToCompare ; double overall1 , overall2 ; overall1 = Math . abs ( numberOfViolatedConstraints . getAttribute ( solution1 ) * overallConstraintViolation . getAttribute ( solution1 ) ) ; overall2 = Math . abs ( numberOfViolatedConstraints . getAttribute ( solution2 ) * overallConstraintViolation . getAttribute ( solution2 ) ) ; needToCompare = ( overall1 > this . threshold ) || ( overall2 > this . threshold ) ; return needToCompare ; |
public class AttachStaticIpRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AttachStaticIpRequest attachStaticIpRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( attachStaticIpRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( attachStaticIpRequest . getStaticIpName ( ) , STATICIPNAME_BINDING ) ; protocolMarshaller . marshall ( attachStaticIpRequest . getInstanceName ( ) , INSTANCENAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class TextAnalyticsManager { /** * Initializes an instance of Text Analytics API client .
* @ param region Supported Azure regions for Cognitive Services endpoints .
* @ param credentials the management credentials for Azure
* @ return the Text Analytics API client */
public static TextAnalyticsAPI authenticate ( AzureRegions region , ServiceClientCredentials credentials ) { } } | return authenticate ( "https://{AzureRegion}.api.cognitive.microsoft.com/text/analytics/" , credentials ) . withAzureRegion ( region ) ; |
public class LogPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getRemoteServiceCalled ( ) { } } | if ( remoteServiceCalledEClass == null ) { remoteServiceCalledEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( LogPackage . eNS_URI ) . getEClassifiers ( ) . get ( 31 ) ; } return remoteServiceCalledEClass ; |
public class WAudioExample { /** * Build the UI for this example . */
private void buildUI ( ) { } } | // build the configuration options UI .
WFieldLayout layout = new WFieldLayout ( WFieldLayout . LAYOUT_STACKED ) ; layout . setMargin ( new Margin ( null , null , Size . LARGE , null ) ) ; add ( layout ) ; layout . addField ( "Autoplay" , cbAutoPlay ) ; layout . addField ( "Loop" , cbLoop ) ; layout . addField ( "Disable" , cbDisable ) ; layout . addField ( "Show only play/pause" , cbControls ) ; layout . addField ( ( WLabel ) null , btnApply ) ; // enable disable option only when control PLAY _ PAUSE is used .
WSubordinateControl control = new WSubordinateControl ( ) ; add ( control ) ; Rule rule = new Rule ( ) ; rule . setCondition ( new Equal ( cbControls , Boolean . TRUE . toString ( ) ) ) ; rule . addActionOnTrue ( new Enable ( cbDisable ) ) ; rule . addActionOnFalse ( new Disable ( cbDisable ) ) ; control . addRule ( rule ) ; // allow config to change without reloading the whole page .
add ( new WAjaxControl ( btnApply , audio ) ) ; // add the audio to the UI
add ( audio ) ; |
public class DoubleMaps { /** * Returns a linearly interpolated value from the given map . < br >
* < br >
* For the given key , the next larger and next smaller key
* will be determined . The values associated with these keys
* will be interpolated , based on the location of the given
* key between the next larger and smaller key . < br >
* < br >
* If the given key is larger than the largest key in the
* given map , then the value of the largest key will be
* returned . < br >
* < br >
* If the given key is smaller than the smallest key in the
* given map , then the value of the smallest key will be
* returned .
* @ param map The map
* @ param key The key
* @ return The interpolated value
* @ throws IllegalArgumentException If the given map is empty */
public static double getInterpolated ( NavigableMap < Double , ? extends Number > map , double key ) { } } | if ( map . isEmpty ( ) ) { throw new IllegalArgumentException ( "Empty map" ) ; } Entry < Double , ? extends Number > c = map . ceilingEntry ( key ) ; Entry < Double , ? extends Number > f = map . floorEntry ( key ) ; if ( c == null ) { return f . getValue ( ) . doubleValue ( ) ; } if ( f == null ) { return c . getValue ( ) . doubleValue ( ) ; } if ( c . equals ( f ) ) { return c . getValue ( ) . doubleValue ( ) ; } double deltaKeys = c . getKey ( ) - f . getKey ( ) ; double alpha = ( key - f . getKey ( ) ) / deltaKeys ; double deltaValues = c . getValue ( ) . doubleValue ( ) - f . getValue ( ) . doubleValue ( ) ; double result = f . getValue ( ) . doubleValue ( ) + alpha * deltaValues ; return result ; |
public class AccountSettings { /** * Returns the unmetered devices you have purchased or want to purchase .
* @ param unmeteredDevices
* Returns the unmetered devices you have purchased or want to purchase .
* @ return Returns a reference to this object so that method calls can be chained together . */
public AccountSettings withUnmeteredDevices ( java . util . Map < String , Integer > unmeteredDevices ) { } } | setUnmeteredDevices ( unmeteredDevices ) ; return this ; |
public class DefaultParameterEquivalencer { /** * { @ inheritDoc } */
@ Override public List < Parameter > findEquivalences ( Parameter sourceParameter ) throws ResourceDownloadError , IndexingFailure , IOException { } } | openAllEquivalences ( ) ; final List < Parameter > equivalentParameters = new ArrayList < Parameter > ( ) ; Set < Entry < String , JDBMEquivalenceLookup > > equivalenceEntries = openEquivalences . entrySet ( ) ; for ( Entry < String , JDBMEquivalenceLookup > equivalenceEntry : equivalenceEntries ) { final String equivalentValue = doFindEquivalence ( sourceParameter . getNamespace ( ) . getResourceLocation ( ) , equivalenceEntry . getKey ( ) , sourceParameter . getValue ( ) ) ; if ( equivalentValue != null ) { equivalentParameters . add ( new Parameter ( new Namespace ( "" , equivalenceEntry . getKey ( ) ) , equivalentValue ) ) ; } } return equivalentParameters ; |
public class CLDRBase { /** * Convert the Java locale to a CLDR locale object . */
public CLDR . Locale fromJavaLocale ( java . util . Locale javaLocale ) { } } | return MetaLocale . fromJavaLocale ( javaLocale ) ; |
public class ReplicationInstance { /** * The VPC security group for the instance .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setVpcSecurityGroups ( java . util . Collection ) } or { @ link # withVpcSecurityGroups ( java . util . Collection ) } if
* you want to override the existing values .
* @ param vpcSecurityGroups
* The VPC security group for the instance .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ReplicationInstance withVpcSecurityGroups ( VpcSecurityGroupMembership ... vpcSecurityGroups ) { } } | if ( this . vpcSecurityGroups == null ) { setVpcSecurityGroups ( new java . util . ArrayList < VpcSecurityGroupMembership > ( vpcSecurityGroups . length ) ) ; } for ( VpcSecurityGroupMembership ele : vpcSecurityGroups ) { this . vpcSecurityGroups . add ( ele ) ; } return this ; |
public class JMExceptionManager { /** * Log runtime exception .
* @ param log the log
* @ param exceptionMessage the exception message
* @ param method the method
* @ param params the params */
public static void logRuntimeException ( Logger log , String exceptionMessage , String method , Object ... params ) { } } | handleException ( log , newRunTimeException ( exceptionMessage ) , method , params ) ; |
public class AbstractComponent { /** * { @ inheritDoc } */
@ Override public final void listen ( final WaveChecker waveChecker , final Method method , final WaveType ... waveTypes ) { } } | // Check API compliance
if ( ! this . processUncaughtWave ) { CheckerUtility . checkWaveTypeContract ( this . getClass ( ) , waveTypes ) ; } final Component < ? > waveReady = this ; LOGGER . trace ( LinkMessages . LISTEN_WAVE_TYPE , getWaveTypesString ( waveTypes ) , waveReady . getClass ( ) . getSimpleName ( ) ) ; // Use the JRebirth Thread to add new subscriptions for given Wave Type
JRebirth . runIntoJIT ( LISTEN_WAVE_TYPE . getText ( getWaveTypesString ( waveTypes ) , waveReady . getClass ( ) . getSimpleName ( ) ) , ( ) -> getNotifier ( ) . listen ( waveReady , waveChecker , method , waveTypes ) ) ; |
public class FindNullDeref { /** * Determine whether or not given instruction is a goto .
* @ param instruction
* the instruction
* @ return true if the instruction is a goto , false otherwise */
private boolean isGoto ( Instruction instruction ) { } } | return instruction . getOpcode ( ) == Const . GOTO || instruction . getOpcode ( ) == Const . GOTO_W ; |
public class Tile { /** * Defines the color that will be used to colorize the bar of
* the gauge ( if it has a bar ) .
* @ param COLOR */
public void setBarColor ( final Color COLOR ) { } } | if ( null == barColor ) { _barColor = COLOR ; fireTileEvent ( REDRAW_EVENT ) ; } else { barColor . set ( COLOR ) ; } |
public class Miscellaneous { /** * Counts how many times the substring appears in the larger String . < / p >
* A < code > null < / code > or empty ( " " ) String input returns
* < code > 0 < / code > . < / p >
* < pre >
* StringUtils . countMatches ( null , * ) = 0
* StringUtils . countMatches ( " " , * ) = 0
* StringUtils . countMatches ( " abba " , null ) = 0
* StringUtils . countMatches ( " abba " , " " ) = 0
* StringUtils . countMatches ( " abba " , " a " ) = 2
* StringUtils . countMatches ( " abba " , " ab " ) = 1
* StringUtils . countMatches ( " abba " , " xxx " ) = 0
* < / pre >
* @ param str the String to check , may be null
* @ param subStrRegExp the substring reg expression to count , may be null
* @ return the number of occurrences , 0 if either String is
* < code > null < / code > */
public static int countMatches ( String str , String subStrRegExp ) { } } | if ( isEmpty ( str ) || isEmpty ( subStrRegExp ) ) { return 0 ; } Pattern p = Pattern . compile ( subStrRegExp ) ; Matcher m = p . matcher ( str ) ; int count = 0 ; while ( m . find ( ) ) { count += 1 ; } return count ; |
public class TaskInProgress { /** * Return the dispatch time */
public long getDispatchTime ( TaskAttemptID taskid ) { } } | Long l = dispatchTimeMap . get ( taskid ) ; if ( l != null ) { return l . longValue ( ) ; } return 0 ; |
public class StringParser { /** * Parse the given { @ link String } as int with the specified radix .
* @ param sStr
* The String to parse . May be < code > null < / code > .
* @ param nRadix
* The radix to use . Must be & ge ; { @ link Character # MIN _ RADIX } and & le ;
* { @ link Character # MAX _ RADIX } .
* @ param nDefault
* The value to be returned if the string cannot be converted to a
* valid value .
* @ return The passed default parameter if the string does not represent a
* valid value . */
public static int parseInt ( @ Nullable final String sStr , @ Nonnegative final int nRadix , final int nDefault ) { } } | if ( sStr != null && sStr . length ( ) > 0 ) try { return Integer . parseInt ( sStr , nRadix ) ; } catch ( final NumberFormatException ex ) { // Fall through
} return nDefault ; |
public class MvtUtil { /** * Return whether the MVT geometry type should be closed with a { @ link GeomCmd # ClosePath } .
* @ param geomType the type of MVT geometry
* @ return true if the geometry should be closed , false if it should not be closed */
public static boolean shouldClosePath ( VectorTile . Tile . GeomType geomType ) { } } | final boolean closeReq ; switch ( geomType ) { case POLYGON : closeReq = true ; break ; default : closeReq = false ; break ; } return closeReq ; |
public class FibonacciHeap { /** * Inserts a new entry into the heap and returns the entry if heap is not full . Returns absent otherwise .
* No heap consolidation is performed .
* Runtime : O ( 1) */
public Entry add ( V value , P priority ) { } } | Preconditions . checkNotNull ( value ) ; Preconditions . checkNotNull ( priority ) ; if ( size >= MAX_CAPACITY ) return null ; final Entry result = new Entry ( value , priority ) ; // add as a root
oMinEntry = mergeLists ( result , oMinEntry ) ; size ++ ; return result ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getIfcAssemblyPlaceEnum ( ) { } } | if ( ifcAssemblyPlaceEnumEEnum == null ) { ifcAssemblyPlaceEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 782 ) ; } return ifcAssemblyPlaceEnumEEnum ; |
public class Context2 { /** * Process a raw XML 1.0 name in this context .
* @ param qName The raw XML 1.0 name .
* @ param isAttribute true if this is an attribute name .
* @ return An array of three strings containing the
* URI part ( or empty string ) , the local part ,
* and the raw name , all internalized , or null
* if there is an undeclared prefix .
* @ see org . xml . sax . helpers . NamespaceSupport2 # processName */
String [ ] processName ( String qName , boolean isAttribute ) { } } | String name [ ] ; Hashtable table ; // Select the appropriate table .
if ( isAttribute ) { if ( elementNameTable == null ) elementNameTable = new Hashtable ( ) ; table = elementNameTable ; } else { if ( attributeNameTable == null ) attributeNameTable = new Hashtable ( ) ; table = attributeNameTable ; } // Start by looking in the cache , and
// return immediately if the name
// is already known in this content
name = ( String [ ] ) table . get ( qName ) ; if ( name != null ) { return name ; } // We haven ' t seen this name in this
// context before .
name = new String [ 3 ] ; int index = qName . indexOf ( ':' ) ; // No prefix .
if ( index == - 1 ) { if ( isAttribute || defaultNS == null ) { name [ 0 ] = "" ; } else { name [ 0 ] = defaultNS ; } name [ 1 ] = qName . intern ( ) ; name [ 2 ] = name [ 1 ] ; } // Prefix
else { String prefix = qName . substring ( 0 , index ) ; String local = qName . substring ( index + 1 ) ; String uri ; if ( "" . equals ( prefix ) ) { uri = defaultNS ; } else { uri = ( String ) prefixTable . get ( prefix ) ; } if ( uri == null ) { return null ; } name [ 0 ] = uri ; name [ 1 ] = local . intern ( ) ; name [ 2 ] = qName . intern ( ) ; } // Save in the cache for future use .
table . put ( name [ 2 ] , name ) ; tablesDirty = true ; return name ; |
public class Strings { /** * Convert the first letter of each words of target
* to uppercase ( title - case , in fact )
* for all the elements in the target set .
* The default delimiter characters between the words are
* the whitespace characters
* ( see Characters . IsWhiteSpace method in the Java documentation ) .
* @ param target the set of Strings to be capitalized .
* If non - String objects , toString ( ) will be called .
* @ return a Set with the result of capitalizing each element of the target .
* @ since 1.1.2 */
public Set < String > setCapitalizeWords ( final Set < ? > target ) { } } | if ( target == null ) { return null ; } final Set < String > result = new LinkedHashSet < String > ( target . size ( ) + 2 ) ; for ( final Object element : target ) { result . add ( capitalizeWords ( element ) ) ; } return result ; |
public class PersistentExecutorImpl { /** * { @ inheritDoc } */
@ Override public void startPolling ( ) { } } | Config config = configRef . get ( ) ; if ( config . initialPollDelay != - 1 ) throw new IllegalStateException ( "initialPollDelay: " + config . initialPollDelay ) ; if ( ! deactivated && ! pollingStartSignalReceived . getAndSet ( true ) && readyForPollingTask . addAndCheckIfReady ( PollingManager . SIGNAL_RECEIVED ) ) startPollingTask ( config ) ; |
public class IIRFilterBase { /** * Call this to initialize . Will set the memory to 0
* @ since 09.01.2012 */
public void initialize ( final int sampleRate , final int channels , final int frequency , final float parameter ) { } } | this . frequency = frequency ; this . sampleRate = sampleRate ; inArray = new float [ channels ] [ HISTORYSIZE ] ; outArray = new float [ channels ] [ HISTORYSIZE ] ; clearHistory ( ) ; |
public class CommerceDiscountPersistenceImpl { /** * Returns the first commerce discount in the ordered set where uuid = & # 63 ; and companyId = & # 63 ; .
* @ param uuid the uuid
* @ param companyId the company ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce discount
* @ throws NoSuchDiscountException if a matching commerce discount could not be found */
@ Override public CommerceDiscount findByUuid_C_First ( String uuid , long companyId , OrderByComparator < CommerceDiscount > orderByComparator ) throws NoSuchDiscountException { } } | CommerceDiscount commerceDiscount = fetchByUuid_C_First ( uuid , companyId , orderByComparator ) ; if ( commerceDiscount != null ) { return commerceDiscount ; } StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "uuid=" ) ; msg . append ( uuid ) ; msg . append ( ", companyId=" ) ; msg . append ( companyId ) ; msg . append ( "}" ) ; throw new NoSuchDiscountException ( msg . toString ( ) ) ; |
public class RequestUtil { /** * 从cookie获取用户通行证 .
* @ param request
* @ return */
public static String getCookieUsername ( HttpServletRequest request ) { } } | String username = CookieUtil . getCookie ( "username" , request ) ; try { username = URLDecoder . decode ( username , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e . getMessage ( ) , e ) ; } return username ; |
public class TopicsInner { /** * Update a topic .
* Asynchronously updates a topic with the specified parameters .
* @ param resourceGroupName The name of the resource group within the user ' s subscription .
* @ param topicName Name of the topic
* @ param tags Tags of the resource
* @ 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 < TopicInner > updateAsync ( String resourceGroupName , String topicName , Map < String , String > tags , final ServiceCallback < TopicInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( updateWithServiceResponseAsync ( resourceGroupName , topicName , tags ) , serviceCallback ) ; |
public class BandwidthClient { /** * Validate if the credentials are set and has access to catapult */
private static void validateCredentials ( ) { } } | try { Account . get ( ) . getAccountInfo ( ) ; } catch ( Exception e ) { if ( e instanceof AppPlatformException ) { AppPlatformException appEx = ( AppPlatformException ) e ; if ( appEx . getStatus ( ) == 401 ) { throw new InvalidCredentialsException ( ) ; } } else { throw new RuntimeException ( e ) ; } } |
public class Network { /** * This registers objects that are going to be sent over the network . */
static public void register ( EndPoint endPoint ) { } } | Kryo kryo = endPoint . getKryo ( ) ; // This must be called in order to use ObjectSpaces .
ObjectSpace . registerClasses ( kryo ) ; // The interfaces that will be used as remote objects must be registered .
kryo . register ( IPlayer . class ) ; kryo . register ( IChatFrame . class ) ; // The classes of all method parameters and return values
// for remote objects must also be registered .
kryo . register ( String [ ] . class ) ; |
public class QueryController { /** * Returns whether query belongs to given panel
* @ param query query
* @ param panel panel
* @ return whether query belongs to given panel */
public boolean isPanelsQuery ( Query query , Panel panel ) { } } | Panel queryPanel = resourceController . getResourcePanel ( query ) ; if ( queryPanel == null || panel == null ) { return false ; } return queryPanel . getId ( ) . equals ( panel . getId ( ) ) ; |
public class MailUtil { /** * 将多个联系人转为列表 , 分隔符为逗号或者分号
* @ param addresses 多个联系人 , 如果为空返回null
* @ return 联系人列表 */
private static List < String > splitAddress ( String addresses ) { } } | if ( StrUtil . isBlank ( addresses ) ) { return null ; } List < String > result ; if ( StrUtil . contains ( addresses , ',' ) ) { result = StrUtil . splitTrim ( addresses , ',' ) ; } else if ( StrUtil . contains ( addresses , ';' ) ) { result = StrUtil . splitTrim ( addresses , ';' ) ; } else { result = CollUtil . newArrayList ( addresses ) ; } return result ; |
public class JavaMod { /** * parses through the parameter - params ( starting with ' - ' ) are not
* allowed here - we filter them out
* @ since 31.12.2010
* @ param args
* @ return the given filename */
private static String getFileName ( String [ ] args ) { } } | String fileName = null ; for ( int i = 0 ; i < args . length ; i ++ ) { if ( ! args [ i ] . startsWith ( "-" ) ) { fileName = args [ i ] ; break ; } } return fileName ; |
public class BaseNarrativeGenerator { /** * Trims the superfluous whitespace out of an HTML block */
public static String cleanWhitespace ( String theResult ) { } } | StringBuilder b = new StringBuilder ( ) ; boolean inWhitespace = false ; boolean betweenTags = false ; boolean lastNonWhitespaceCharWasTagEnd = false ; boolean inPre = false ; for ( int i = 0 ; i < theResult . length ( ) ; i ++ ) { char nextChar = theResult . charAt ( i ) ; if ( inPre ) { b . append ( nextChar ) ; continue ; } else if ( nextChar == '>' ) { b . append ( nextChar ) ; betweenTags = true ; lastNonWhitespaceCharWasTagEnd = true ; continue ; } else if ( nextChar == '\n' || nextChar == '\r' ) { continue ; } if ( betweenTags ) { if ( Character . isWhitespace ( nextChar ) ) { inWhitespace = true ; } else if ( nextChar == '<' ) { if ( inWhitespace && ! lastNonWhitespaceCharWasTagEnd ) { b . append ( ' ' ) ; } b . append ( nextChar ) ; inWhitespace = false ; betweenTags = false ; lastNonWhitespaceCharWasTagEnd = false ; if ( i + 3 < theResult . length ( ) ) { char char1 = Character . toLowerCase ( theResult . charAt ( i + 1 ) ) ; char char2 = Character . toLowerCase ( theResult . charAt ( i + 2 ) ) ; char char3 = Character . toLowerCase ( theResult . charAt ( i + 3 ) ) ; char char4 = Character . toLowerCase ( ( i + 4 < theResult . length ( ) ) ? theResult . charAt ( i + 4 ) : ' ' ) ; if ( char1 == 'p' && char2 == 'r' && char3 == 'e' ) { inPre = true ; } else if ( char1 == '/' && char2 == 'p' && char3 == 'r' && char4 == 'e' ) { inPre = false ; } } } else { lastNonWhitespaceCharWasTagEnd = false ; if ( inWhitespace ) { b . append ( ' ' ) ; inWhitespace = false ; } b . append ( nextChar ) ; } } else { b . append ( nextChar ) ; } } return b . toString ( ) ; |
public class IOUtils { /** * Read column as set
* @ param infile - filename
* @ param field index of field to read
* @ return a set of the entries in column field
* @ throws IOException */
public static Set < String > readColumnSet ( String infile , int field ) throws IOException { } } | BufferedReader br = IOUtils . getBufferedFileReader ( infile ) ; String line ; Set < String > set = new HashSet < String > ( ) ; while ( ( line = br . readLine ( ) ) != null ) { line = line . trim ( ) ; if ( line . length ( ) > 0 ) { if ( field < 0 ) { set . add ( line ) ; } else { String [ ] fields = tab . split ( line ) ; if ( field < fields . length ) { set . add ( fields [ field ] ) ; } } } } br . close ( ) ; return set ; |
public class StartContinuousExportRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( StartContinuousExportRequest startContinuousExportRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( startContinuousExportRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ParseIntRanges { /** * Parse integer ranges , in different syntaxes .
* < code >
* 1,2,3 , . . . , 10
* 1,3 , , 10
* 1,3 , . . , 10
* 1,3 , . . . , 10
* 1 , + = 2,10
* 1 , * = 2,16
* 1,2,3,4 , . . , 10,100
* 100,1,3 , . . , 10
* 1,2 , . . , 10,20 , . . , 100,200 , . . , 1000
* < / code >
* @ param str Ranges to parse
* @ return Ranges */
public static IntGenerator parseIntRanges ( String str ) { } } | ArrayList < IntGenerator > generators = new ArrayList < > ( ) ; IntegerArray ints = new IntegerArray ( ) ; int last = Integer . MAX_VALUE ; // Last seen integer
for ( int pos = 0 , next = - 1 ; pos < str . length ( ) ; pos = next + 1 ) { // Find next comma :
next = nextSep ( str , pos ) ; // Syntaxes involving " , , " or " , . . , " or " , . . . , " equivalently :
if ( next == pos || ( str . charAt ( pos ) == '.' && ( ( next - pos == 2 && str . charAt ( pos + 1 ) == '.' ) || ( next - pos == 3 && str . charAt ( pos + 1 ) == '.' && str . charAt ( pos + 2 ) == '.' ) ) ) ) { if ( ints . size ( ) == 0 || next == str . length ( ) ) { throw new NumberFormatException ( "Not a valid integer range." ) ; } // Shorter ( but less tolerant ) syntax : 1 , . . , 10
if ( ints . size ( ) == 1 ) { int start = ints . get ( 0 ) ; // Hack for : 1 , . . , 10,20 , . . , 100 : reuse last value !
int step = last == Integer . MAX_VALUE ? 1 : start - last ; // Find next comma :
next = nextSep ( str , pos = next + 1 ) ; last = ParseUtil . parseIntBase10 ( str , pos , next ) ; // Update last !
generators . add ( new LinearIntGenerator ( start , step , last ) ) ; ints . clear ( ) ; continue ; } // Longer syntax : 10,15 , . . , 35 or 10,15 , . . . , 35 or 10,15 , , 35
assert ( ints . size ( ) > 1 ) ; int start = ints . get ( ints . size ( ) - 2 ) ; int step = ints . get ( ints . size ( ) - 1 ) - start ; ints . remove ( ints . size ( ) - 2 , 2 ) ; // Remove additional static entries if step size is consistent :
while ( ! ints . isEmpty ( ) && ints . get ( ints . size ( ) - 1 ) == start - step ) { start -= step ; ints . remove ( ints . size ( ) - 1 , 1 ) ; } // Leading elements not part of this sequence :
if ( ! ints . isEmpty ( ) ) { generators . add ( new StaticIntGenerator ( ints . toArray ( ) ) ) ; } // Find next comma :
next = nextSep ( str , pos = next + 1 ) ; last = ParseUtil . parseIntBase10 ( str , pos , next ) ; // Update last !
generators . add ( new LinearIntGenerator ( start , step , last ) ) ; ints . clear ( ) ; } // Explicit syntax : 0 , + = 4,16
else if ( next - pos > 2 && str . charAt ( pos ) == '+' && str . charAt ( pos + 1 ) == '=' ) { if ( ints . size ( ) == 0 || next == str . length ( ) ) { throw new NumberFormatException ( "Not a valid integer range." ) ; } int start = ints . get ( ints . size ( ) - 1 ) ; int step = ParseUtil . parseIntBase10 ( str , pos + 2 , next ) ; ints . remove ( ints . size ( ) - 1 , 1 ) ; // Remove additional static entries if step size is consistent :
while ( ! ints . isEmpty ( ) && ints . get ( ints . size ( ) - 1 ) == start - step ) { start -= step ; ints . remove ( ints . size ( ) - 1 , 1 ) ; } // Leading elements not part of this sequence :
if ( ! ints . isEmpty ( ) ) { generators . add ( new StaticIntGenerator ( ints . toArray ( ) ) ) ; } // Find next comma :
next = nextSep ( str , pos = next + 1 ) ; last = ParseUtil . parseIntBase10 ( str , pos , next ) ; // Update last !
generators . add ( new LinearIntGenerator ( start , step , last ) ) ; ints . clear ( ) ; } // Explicit syntax : 0 , + = 4,16
else if ( next - pos > 2 && str . charAt ( pos ) == '*' && str . charAt ( pos + 1 ) == '=' ) { if ( ints . size ( ) == 0 || next == str . length ( ) ) { throw new NumberFormatException ( "Not a valid integer range." ) ; } int start = ints . get ( ints . size ( ) - 1 ) ; int factor = ParseUtil . parseIntBase10 ( str , pos + 2 , next ) ; ints . remove ( ints . size ( ) - 1 , 1 ) ; // Remove additional static entries if step size is consistent :
while ( ints . size ( ) > 2 && ints . get ( ints . size ( ) - 1 ) * factor == start ) { start = ints . get ( ints . size ( ) - 1 ) ; ints . remove ( ints . size ( ) - 1 , 1 ) ; } // Leading elements not part of this sequence :
if ( ! ints . isEmpty ( ) ) { generators . add ( new StaticIntGenerator ( ints . toArray ( ) ) ) ; } // Find next comma :
next = nextSep ( str , pos = next + 1 ) ; last = ParseUtil . parseIntBase10 ( str , pos , next ) ; // Update last !
generators . add ( new ExponentialIntGenerator ( start , factor , last ) ) ; ints . clear ( ) ; } else { // Default case : an integer
ints . add ( ParseUtil . parseIntBase10 ( str , pos , next ) ) ; } } // Trailing static values .
if ( ! ints . isEmpty ( ) ) { generators . add ( new StaticIntGenerator ( ints . toArray ( ) ) ) ; } return generators . size ( ) == 1 ? generators . get ( 0 ) : new CombinedIntGenerator ( generators ) ; |
public class MemoryMapArchiveBase { /** * Used to retrieve a { @ link Node } from the content of the { @ link Archive } . If the { @ link Node } doesn � t exists in
* the specified location , it is created and added to the { @ link Archive } . The same happens to all its non - existing
* parents . However , if the { @ link Node } is an asset , an IllegalArchivePathException is thrown .
* @ param path
* The { @ link ArchivePath } from which we are obtaining the { @ link Node }
* @ return The { @ link Node } in the specified path
* @ throws IllegalArchivePathException
* if the node is an { @ link Asset } */
private NodeImpl obtainParent ( ArchivePath path ) { } } | if ( path == null ) { return null ; } NodeImpl node = content . get ( path ) ; // If the node exists , just return it
if ( node != null ) { // if the node is an asset , throw an exception
if ( node . getAsset ( ) != null ) { throw new IllegalArchivePathException ( "Could not create node under " + path . getParent ( ) + ". It points to an asset." ) ; } return node ; } // If the node doesn ' t exists , create it . Also create all possible non - existing
// parents
node = new NodeImpl ( path ) ; NodeImpl parentNode = obtainParent ( path . getParent ( ) ) ; if ( parentNode != null ) { parentNode . addChild ( node ) ; } // Add the node to the contents of the archive
content . put ( path , node ) ; return node ; |
public class ThreadedEventProviderIT { /** * Parameterizes the test instances .
* @ return Collection of parameters for the constructor of
* { @ link EventProviderTestBase } . */
@ Parameters public static final Collection < Object [ ] > getParameters ( ) { } } | return Arrays . asList ( new Object [ ] { ( Function < ListenerStore , ? extends EventProvider > ) ParallelEventProvider :: new , ( Supplier < ListenerStore > ) ( ) -> DefaultListenerStore . create ( ) . synchronizedView ( ) } , new Object [ ] { ( Function < ListenerStore , ? extends EventProvider > ) AsynchronousEventProvider :: new , ( Supplier < ListenerStore > ) ( ) -> DefaultListenerStore . create ( ) . synchronizedView ( ) } , new Object [ ] { ( Function < ListenerStore , ? extends EventProvider > ) BlockingParallelEventProvider :: new , ( Supplier < ListenerStore > ) ( ) -> DefaultListenerStore . create ( ) . synchronizedView ( ) } , new Object [ ] { ( Function < ListenerStore , ? extends EventProvider > ) store -> new StatisticsEventProvider < > ( new ParallelEventProvider ( store ) ) , ( Supplier < ListenerStore > ) ( ) -> DefaultListenerStore . create ( ) . synchronizedView ( ) } , new Object [ ] { ( Function < ListenerStore , ? extends EventProvider > ) store -> new StatisticsEventProvider < > ( new BlockingParallelEventProvider ( store ) ) , ( Supplier < ListenerStore > ) ( ) -> DefaultListenerStore . create ( ) . synchronizedView ( ) } , new Object [ ] { ( Function < ListenerStore , ? extends EventProvider > ) store -> new StatisticsEventProvider < > ( new AsynchronousEventProvider ( store ) ) , ( Supplier < ListenerStore > ) ( ) -> DefaultListenerStore . create ( ) . synchronizedView ( ) } ) ; |
public class BuildMojo { /** * check for a run - java . sh dependency an extract the script to target / if found */
private void executeBuildPlugins ( ) { } } | try { Enumeration < URL > dmpPlugins = Thread . currentThread ( ) . getContextClassLoader ( ) . getResources ( DMP_PLUGIN_DESCRIPTOR ) ; while ( dmpPlugins . hasMoreElements ( ) ) { URL dmpPlugin = dmpPlugins . nextElement ( ) ; File outputDir = getAndEnsureOutputDirectory ( ) ; processDmpPluginDescription ( dmpPlugin , outputDir ) ; } } catch ( IOException e ) { log . error ( "Cannot load dmp-plugins from %s" , DMP_PLUGIN_DESCRIPTOR ) ; } |
public class TypicalFaihyApiFailureHook { @ Override public ApiResponse handleApplicationException ( ApiFailureResource resource , RuntimeException cause ) { } } | final FaihyUnifiedFailureType failureType = FaihyUnifiedFailureType . BUSINESS_ERROR ; final FaihyUnifiedFailureResult result = createFailureResult ( failureType , resource , cause ) ; return asJson ( result ) . httpStatus ( prepareBusinessFailureStatus ( ) ) ; |
public class TaskGroupInformation { /** * Creates a new builder of convert type with the specified parameters .
* @ param input the input format
* @ param output the output format
* @ return returns a new builder */
public static Builder newConvertBuilder ( String input , String output ) { } } | return new Builder ( input , output , TaskGroupActivity . CONVERT ) ; |
public class ChunkMapReader { /** * Read processing metadata from processing instructions . */
private void readProcessingInstructions ( final Document doc ) { } } | final NodeList docNodes = doc . getChildNodes ( ) ; for ( int i = 0 ; i < docNodes . getLength ( ) ; i ++ ) { final Node node = docNodes . item ( i ) ; if ( node . getNodeType ( ) == Node . PROCESSING_INSTRUCTION_NODE ) { final ProcessingInstruction pi = ( ProcessingInstruction ) node ; switch ( pi . getNodeName ( ) ) { case PI_WORKDIR_TARGET : workdir = pi ; break ; case PI_WORKDIR_TARGET_URI : workdirUrl = pi ; break ; case PI_PATH2PROJ_TARGET : path2proj = pi ; break ; case PI_PATH2PROJ_TARGET_URI : path2projUrl = pi ; break ; case PI_PATH2ROOTMAP_TARGET_URI : path2rootmapUrl = pi ; break ; } } } |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcBlock ( ) { } } | if ( ifcBlockEClass == null ) { ifcBlockEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 41 ) ; } return ifcBlockEClass ; |
public class MavenHelpers { /** * Returns true if the list has the given dependency */
public static boolean hasDependency ( List < org . apache . maven . model . Dependency > dependencies , String groupId , String artifactId ) { } } | if ( dependencies != null ) { for ( org . apache . maven . model . Dependency dependency : dependencies ) { if ( Objects . equal ( groupId , dependency . getGroupId ( ) ) && Objects . equal ( artifactId , dependency . getArtifactId ( ) ) ) { return true ; } } } return false ; |
public class AttachThingPrincipalRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AttachThingPrincipalRequest attachThingPrincipalRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( attachThingPrincipalRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( attachThingPrincipalRequest . getThingName ( ) , THINGNAME_BINDING ) ; protocolMarshaller . marshall ( attachThingPrincipalRequest . getPrincipal ( ) , PRINCIPAL_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MessageStoreImpl { /** * register new Item link .
* @ param newLink
* @ param item */
public final void registerLink ( final AbstractItemLink newLink , final AbstractItem item ) { } } | register ( newLink ) ; _setMembership ( newLink , item ) ; |
public class AbstractFlatteningPersonAttributeDao { /** * / * ( non - Javadoc )
* @ see org . jasig . services . persondir . IPersonAttributeDao # getPeople ( java . util . Map ) */
@ Override public final Set < IPersonAttributes > getPeople ( final Map < String , Object > query , final IPersonAttributeDaoFilter filter ) { } } | final Map < String , List < Object > > multivaluedSeed = MultivaluedPersonAttributeUtils . toMultivaluedMap ( query ) ; return this . getPeopleWithMultivaluedAttributes ( multivaluedSeed , filter ) ; |
public class TableFinishOperator { /** * Both the statistics and the row _ count + fragments are transferred over the same communication
* link between the TableWriterOperator and the TableFinishOperator . Thus the multiplexing is needed .
* The transferred page layout looks like :
* [ [ row _ count _ channel ] , [ fragment _ channel ] , [ statistic _ channel _ 1 ] . . . [ statistic _ channel _ N ] ]
* [ row _ count _ channel ] - contains number of rows processed by a TableWriterOperator instance
* [ fragment _ channel ] - contains arbitrary binary data provided by the ConnectorPageSink # finish for
* the further post processing on the coordinator
* [ statistic _ channel _ 1 ] . . . [ statistic _ channel _ N ] - contain pre - aggregated statistics computed by the
* statistics aggregation operator within the
* TableWriterOperator
* Since the final aggregation operator in the TableFinishOperator doesn ' t know what to do with the
* first two channels , those must be pruned . For the convenience we never set both , the
* [ row _ count _ channel ] + [ fragment _ channel ] and the [ statistic _ channel _ 1 ] . . . [ statistic _ channel _ N ] .
* If this is a row that holds statistics - the [ row _ count _ channel ] + [ fragment _ channel ] will be NULL .
* It this is a row that holds the row count or the fragment - all the statistics channels will be set
* to NULL .
* Since neither [ row _ count _ channel ] or [ fragment _ channel ] cannot hold the NULL value naturally , by
* checking isNull on these two channels we can determine if this is a row that contains statistics . */
private static boolean isStatisticsPosition ( Page page , int position ) { } } | return page . getBlock ( ROW_COUNT_CHANNEL ) . isNull ( position ) && page . getBlock ( FRAGMENT_CHANNEL ) . isNull ( position ) ; |
public class CardAPI { /** * 更改卡券信息接口 ( 优惠券 )
* @ param accessToken accessToken
* @ param updateGeneralCoupon updateGeneralCoupon
* @ return result */
public static UpdateResult update ( String accessToken , UpdateGeneralCoupon updateGeneralCoupon ) { } } | return update ( accessToken , JsonUtil . toJSONString ( updateGeneralCoupon ) ) ; |
public class vm_device { /** * < pre >
* Converts API response of bulk operation into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } } | vm_device_responses result = ( vm_device_responses ) service . get_payload_formatter ( ) . string_to_resource ( vm_device_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result . message , result . errorcode , ( base_response [ ] ) result . vm_device_response_array ) ; } vm_device [ ] result_vm_device = new vm_device [ result . vm_device_response_array . length ] ; for ( int i = 0 ; i < result . vm_device_response_array . length ; i ++ ) { result_vm_device [ i ] = result . vm_device_response_array [ i ] . vm_device [ 0 ] ; } return result_vm_device ; |
public class InsertStmt { /** * Gets the .
* @ param _ printStmt the print stmt
* @ return the prints the stmt */
public static InsertStmt get ( final IInsertStatement _insertStmt ) { } } | final InsertStmt ret = new InsertStmt ( ) ; ret . setEQLStmt ( _insertStmt ) ; return ret ; |
public class MongoDBBasicOperations { /** * Get the basic services from mongo template */
private synchronized void fetchMappingContextAndConversionService ( ) { } } | if ( mappingContext == null ) { MongoConverter mongoConverter = this . mongoTemplate . getConverter ( ) ; mappingContext = mongoConverter . getMappingContext ( ) ; conversionService = mongoConverter . getConversionService ( ) ; MongoPersistentEntity < ? > persistentEntity = mappingContext . getPersistentEntity ( entityClass ) ; MongoPersistentProperty idProperty = persistentEntity . getIdProperty ( ) ; this . idKey = idProperty == null ? "_id" : idProperty . getName ( ) ; } |
public class CassandraEmbeddedStoreManager { /** * Raw type warnings are suppressed in this method because
* { @ link StorageService # getLocalPrimaryRanges ( String ) } returns a raw
* ( unparameterized ) type . */
public List < KeyRange > getLocalKeyPartition ( ) throws BackendException { } } | ensureKeyspaceExists ( keySpaceName ) ; @ SuppressWarnings ( "rawtypes" ) Collection < Range < Token > > ranges = StorageService . instance . getPrimaryRanges ( keySpaceName ) ; List < KeyRange > keyRanges = new ArrayList < KeyRange > ( ranges . size ( ) ) ; for ( @ SuppressWarnings ( "rawtypes" ) Range < Token > range : ranges ) { keyRanges . add ( CassandraHelper . transformRange ( range ) ) ; } return keyRanges ; |
public class DirectMetaProperty { /** * Factory to create a derived read - only meta - property avoiding duplicate generics .
* @ param < P > the property type
* @ param metaBean the meta - bean , not null
* @ param propertyName the property name , not empty
* @ param declaringType the type declaring the property , not null
* @ param propertyType the property type , not null
* @ return the property , not null */
public static < P > DirectMetaProperty < P > ofDerived ( MetaBean metaBean , String propertyName , Class < ? > declaringType , Class < P > propertyType ) { } } | Field field = findField ( metaBean , propertyName ) ; return new DirectMetaProperty < > ( metaBean , propertyName , declaringType , propertyType , PropertyStyle . DERIVED , field ) ; |
public class MetricValue { /** * Construct a metric value from a Number implementation .
* @ param number A floating point or integral type .
* @ return a MetricValue holding the specified number .
* @ throws IllegalArgumentException if the derived type of Number is not recognized . */
public static MetricValue fromNumberValue ( Number number ) { } } | if ( number == null ) { return EMPTY ; } else if ( number instanceof Float || number instanceof Double ) { return fromDblValue ( number . doubleValue ( ) ) ; } else if ( number instanceof Byte || number instanceof Short || number instanceof Integer || number instanceof Long ) { return fromIntValue ( number . longValue ( ) ) ; } else { throw new IllegalArgumentException ( "Unrecognized number type: " + number . getClass ( ) ) ; } |
public class BlockingInputStream { /** * Verifies that length doesn ' t exceed a buffer ' s length
* @ param buf
* @ param offset
* @ param length */
protected static void sanityCheck ( byte [ ] buf , int offset , int length ) { } } | if ( buf == null ) throw new NullPointerException ( "buffer is null" ) ; if ( offset + length > buf . length ) throw new ArrayIndexOutOfBoundsException ( "length (" + length + ") + offset (" + offset + ") > buf.length (" + buf . length + ")" ) ; |
public class SpringRegistrator { /** * - - - LOAD MOLECULER SERVICES - - - */
@ Override public void setApplicationContext ( ApplicationContext applicationContext ) throws BeansException { } } | try { HashSet < Class < ? > > registeredTypes = new HashSet < > ( ) ; // Get Service Broker
ServiceBroker broker = applicationContext . getBean ( ServiceBroker . class ) ; // Find Services in Spring Application Context
Map < String , Service > serviceMap = applicationContext . getBeansOfType ( Service . class ) ; if ( serviceMap != null && ! serviceMap . isEmpty ( ) ) { String name ; for ( Map . Entry < String , Service > service : serviceMap . entrySet ( ) ) { // Register Service in Broker
name = service . getKey ( ) ; registeredTypes . add ( service . getClass ( ) ) ; if ( name != null && name . startsWith ( "$" ) ) { broker . createService ( name , service . getValue ( ) ) ; logger . info ( "Service \"" + name + "\" registered." ) ; } else { Service instance = service . getValue ( ) ; broker . createService ( instance ) ; logger . info ( "Service \"" + instance . getName ( ) + "\" registered." ) ; } } } // Add new Services
if ( packagesToScan != null && packagesToScan . length > 0 ) { DefaultListableBeanFactory beanFactory = ( DefaultListableBeanFactory ) applicationContext . getAutowireCapableBeanFactory ( ) ; for ( String packageName : packagesToScan ) { if ( ! packageName . isEmpty ( ) ) { LinkedList < String > classNames = scan ( packageName ) ; for ( String className : classNames ) { if ( className . indexOf ( '$' ) > - 1 ) { continue ; } className = packageName + '.' + className ; Class < ? > type = Class . forName ( className ) ; if ( Service . class . isAssignableFrom ( type ) ) { // Check type
if ( ! registeredTypes . add ( type ) ) { continue ; } // Register Service in Spring
String name = nameOf ( type , false ) ; BeanDefinition definition = BeanDefinitionBuilder . genericBeanDefinition ( type ) . setScope ( BeanDefinition . SCOPE_SINGLETON ) . setAutowireMode ( DefaultListableBeanFactory . AUTOWIRE_BY_TYPE ) . setLazyInit ( false ) . getBeanDefinition ( ) ; beanFactory . registerBeanDefinition ( name , definition ) ; Service service = ( Service ) beanFactory . createBean ( type ) ; // Register Service in Broker
broker . createService ( service ) ; // Log
logger . info ( "Service \"" + name + "\" registered." ) ; } } } } } } catch ( Exception cause ) { throw new FatalBeanException ( "Unable to define Moleculer Service!" , cause ) ; } |
public class XmlAssert { /** * Check if actual value is valid against schema provided by given sources
* @ throws AssertionError if the actual value is { @ code null } .
* @ throws AssertionError if the actual value is invalid */
public XmlAssert isValidAgainst ( Object ... schemaSources ) { } } | isNotNull ( ) ; ValidationAssert . create ( actual , schemaSources ) . isValid ( ) ; return this ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public OBPXoaOrent createOBPXoaOrentFromString ( EDataType eDataType , String initialValue ) { } } | OBPXoaOrent result = OBPXoaOrent . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class FeatureLinkHelper { /** * / * @ Nullable */
public LightweightTypeReference getExpectedReceiverType ( JvmIdentifiableElement linkedFeature , LightweightTypeReference receiverType ) { } } | if ( receiverType . isMultiType ( ) && linkedFeature instanceof JvmMember ) { LightweightTypeReference declaratorReference = receiverType . getOwner ( ) . newParameterizedTypeReference ( ( ( JvmMember ) linkedFeature ) . getDeclaringType ( ) ) ; if ( ! declaratorReference . isAssignableFrom ( receiverType . toJavaType ( ) ) ) { for ( LightweightTypeReference multiTypeComponent : receiverType . getMultiTypeComponents ( ) ) { if ( declaratorReference . isAssignableFrom ( multiTypeComponent ) ) { return multiTypeComponent ; } } } else { return declaratorReference ; } } else if ( receiverType . isSynonym ( ) && linkedFeature instanceof JvmMember ) { List < LightweightTypeReference > components = receiverType . getMultiTypeComponents ( ) ; return components . get ( components . size ( ) - 1 ) ; } return receiverType ; |
public class ZNeedle { /** * Get a string from the frame */
public String getShortString ( ) { } } | String value = Wire . getShortString ( needle , needle . position ( ) ) ; forward ( value . length ( ) + 1 ) ; return value ; |
public class MethodAttribUtils { /** * Check BMT beans for unneeded Tran Attributes in XML ( ie . WCCM ) */
public static final void chkBMTFromXML ( List < ContainerTransaction > tranAttrList , EnterpriseBean enterpriseBean , J2EEName j2eeName ) { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "chkBMTFromXML" ) ; if ( tranAttrList != null && enterpriseBean != null ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "tranAttrList non-null" ) ; // Elements of highestStyleOnMethod [ ] are initialized to zero by Java rules .
// i : TranAttrList loop
// j : MethodElements loop
for ( int i = 0 ; i < tranAttrList . size ( ) ; ++ i ) { ContainerTransaction methodTransaction = tranAttrList . get ( i ) ; List < com . ibm . ws . javaee . dd . ejb . Method > methodElements = methodTransaction . getMethodElements ( ) ; for ( int j = 0 ; j < methodElements . size ( ) ; ++ j ) { com . ibm . ws . javaee . dd . ejb . Method me = methodElements . get ( j ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) { trace ( me , me . getInterfaceTypeValue ( ) == com . ibm . ws . javaee . dd . ejb . Method . INTERFACE_TYPE_UNSPECIFIED ? "Interface type unspecified" : "Interface type: " + me . getInterfaceTypeValue ( ) ) ; } if ( enterpriseBean . getName ( ) . equals ( me . getEnterpriseBeanName ( ) ) ) { Tr . warning ( tc , "BMT_DEFINES_CMT_ATTRIBUTES_CNTR0067W" , new Object [ ] { j2eeName } ) ; } // enterpriseBean name matches parm in methodExtension
} // methodElements loop ( j )
} // tranAttrList loop ( i )
} // tranAttrList ! = nullcd
if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "chkBMTFromXML" ) ; return ; |
public class Javalin { /** * Adds a PUT request handler with the given roles for the specified path to the instance .
* Requires an access manager to be set on the instance .
* @ see AccessManager
* @ see < a href = " https : / / javalin . io / documentation # handlers " > Handlers in docs < / a > */
public Javalin put ( @ NotNull String path , @ NotNull Handler handler , @ NotNull Set < Role > permittedRoles ) { } } | return addHandler ( HandlerType . PUT , path , handler , permittedRoles ) ; |
public class A_CmsGroupEditor { /** * Enables or disables the save button . < p >
* @ param enabled < code > true < / code > to enable the save button
* @ param disabledMessage the message to display when the button is disabled */
protected void setSaveEnabled ( boolean enabled , String disabledMessage ) { } } | if ( m_saveButton != null ) { if ( enabled ) { m_saveButton . enable ( ) ; } else { m_saveButton . disable ( disabledMessage ) ; } } |
public class ApiOvhDedicatedCloud { /** * Add a new Datacenter in your Private Cloud
* REST : POST / dedicatedCloud / { serviceName } / datacenter
* @ param vrackName [ required ] Name of the Vrack link to the new datacenter .
* @ param commercialRangeName [ required ] The commercial range of this new datacenter . You can see what commercial ranges are orderable on this API section : / dedicatedCloud / commercialRange /
* @ param serviceName [ required ] Domain of the service */
public OvhTask serviceName_datacenter_POST ( String serviceName , String commercialRangeName , String vrackName ) throws IOException { } } | String qPath = "/dedicatedCloud/{serviceName}/datacenter" ; StringBuilder sb = path ( qPath , serviceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "commercialRangeName" , commercialRangeName ) ; addBody ( o , "vrackName" , vrackName ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhTask . class ) ; |
public class ByteBufferOutputStream { public void ensureCapacity ( int n ) throws IOException { } } | // Do we have space ?
if ( n > capacity ( ) ) { // Make a bigger buffer if we are allowed .
if ( _fixed ) throw new IllegalStateException ( "Fixed" ) ; int new_size = ( ( n + _preReserve + _postReserve + 4095 ) / 4096 ) * 4096 ; byte [ ] old = _buf ; _buf = new byte [ new_size ] ; if ( _pos > _start ) System . arraycopy ( old , _start , _buf , _start , _pos - _start ) ; if ( ! _resized ) ByteArrayPool . returnByteArray ( old ) ; _end = _buf . length - _postReserve ; _resized = true ; } |
public class PlingStemmer { /** * Test routine */
public static void main ( String [ ] argv ) throws Exception { } } | System . out . println ( "Enter an English word in plural form and press ENTER" ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String w = in . readLine ( ) ; if ( w . length ( ) == 0 ) break ; if ( isPlural ( w ) ) System . out . println ( "This word is plural" ) ; if ( isSingular ( w ) ) System . out . println ( "This word is singular" ) ; System . out . println ( "Stemmed to singular: " + stem ( w ) ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.