signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CmsCloneModuleThread { /** * Returns a list of all module names . < p >
* @ return a list of all module names */
public List < String > getAllModuleNames ( ) { } } | List < String > sortedModuleNames = new ArrayList < String > ( OpenCms . getModuleManager ( ) . getModuleNames ( ) ) ; java . util . Collections . sort ( sortedModuleNames ) ; return sortedModuleNames ; |
public class Ftp { /** * 初始化连接
* @ param host 域名或IP
* @ param port 端口
* @ param user 用户名
* @ param password 密码
* @ return this */
public Ftp init ( String host , int port , String user , String password ) { } } | return this . init ( host , port , user , password , null ) ; |
public class ServiceEndpointPoliciesInner { /** * Gets all service endpoint Policies in a resource group .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; ServiceEndpointPolicyInner & gt ; object */
public Observable < Page < ServiceEndpointPolicyInner > > listByResourceGroupNextAsync ( final String nextPageLink ) { } } | return listByResourceGroupNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < ServiceEndpointPolicyInner > > , Page < ServiceEndpointPolicyInner > > ( ) { @ Override public Page < ServiceEndpointPolicyInner > call ( ServiceResponse < Page < ServiceEndpointPolicyInner > > response ) { return response . body ( ) ; } } ) ; |
public class ImageModerationsImpl { /** * Returns probabilities of the image containing racy or adult content .
* @ param contentType The content type .
* @ param imageUrl The image url .
* @ param evaluateUrlInputOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws APIErrorException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the Evaluate object if successful . */
public Evaluate evaluateUrlInput ( String contentType , BodyModelModel imageUrl , EvaluateUrlInputOptionalParameter evaluateUrlInputOptionalParameter ) { } } | return evaluateUrlInputWithServiceResponseAsync ( contentType , imageUrl , evaluateUrlInputOptionalParameter ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Frame { /** * Sets the value of the given local variable .
* @ param i
* a local variable index .
* @ param value
* the new value of this local variable .
* @ throws IndexOutOfBoundsException
* if the variable does not exist . */
public void setLocal ( final int i , final V value ) throws IndexOutOfBoundsException { } } | if ( i >= locals ) { throw new IndexOutOfBoundsException ( "Trying to access an inexistant local variable " + i ) ; } values [ i ] = value ; |
public class BoxTransactionalAPIConnection { /** * Request a scoped transactional token .
* @ param accessToken application access token .
* @ param scope scope of transactional token .
* @ return a BoxAPIConnection which can be used to perform transactional requests . */
public static BoxAPIConnection getTransactionConnection ( String accessToken , String scope ) { } } | return BoxTransactionalAPIConnection . getTransactionConnection ( accessToken , scope , null ) ; |
public class FtpServerBuilder { /** * Sets the ftp server .
* @ param server
* @ return */
public FtpServerBuilder server ( org . apache . ftpserver . FtpServer server ) { } } | endpoint . setFtpServer ( server ) ; return this ; |
public class Mediawiki { /** * handle the given Throwable ( in commandline mode )
* @ param t */
public void handle ( Throwable t ) { } } | System . out . flush ( ) ; System . err . println ( t . getClass ( ) . getSimpleName ( ) + ":" + t . getMessage ( ) ) ; if ( debug ) t . printStackTrace ( ) ; |
public class BoxApiFile { /** * Gets a request that moves a file to another folder
* @ param id id of file to move
* @ param parentId id of parent folder to move file into
* @ return request to move a file */
public BoxRequestsFile . UpdateFile getMoveRequest ( String id , String parentId ) { } } | BoxRequestsFile . UpdateFile request = new BoxRequestsFile . UpdateFile ( id , getFileInfoUrl ( id ) , mSession ) ; request . setParentId ( parentId ) ; return request ; |
public class PlatformSummary { /** * The tiers in which the platform runs .
* @ param supportedTierList
* The tiers in which the platform runs . */
public void setSupportedTierList ( java . util . Collection < String > supportedTierList ) { } } | if ( supportedTierList == null ) { this . supportedTierList = null ; return ; } this . supportedTierList = new com . amazonaws . internal . SdkInternalList < String > ( supportedTierList ) ; |
public class GraphicsUtil { /** * 创建 { @ link Graphics2D }
* @ param image { @ link BufferedImage }
* @ param color { @ link Color } 背景颜色以及当前画笔颜色
* @ return { @ link Graphics2D }
* @ since 4.5.2 */
public static Graphics2D createGraphics ( BufferedImage image , Color color ) { } } | final Graphics2D g = image . createGraphics ( ) ; // 填充背景
g . setColor ( color ) ; g . fillRect ( 0 , 0 , image . getWidth ( ) , image . getHeight ( ) ) ; return g ; |
public class AbstractAdminObject { /** * Sets the link properties for this object .
* @ param _ linkTypeUUID UUID of the type of the link property
* @ param _ toId to id
* @ param _ toTypeUUID UUDI of the to type
* @ param _ toName to name
* @ throws EFapsException on error */
protected void setLinkProperty ( final UUID _linkTypeUUID , final long _toId , final UUID _toTypeUUID , final String _toName ) throws EFapsException { } } | setDirty ( ) ; |
public class ServerAddress { /** * Creates a new ServerAddress instance from a string matching the format
* < code > host : port < / code > .
* @ param string a string matching the format < code > host : port < / code > .
* @ return A new ServerAddress instance based on the string representation . */
public static ServerAddress fromString ( String string ) { } } | String tokens [ ] = string . split ( ":" ) ; if ( tokens . length == 1 ) { return new ServerAddress ( tokens [ 0 ] , null ) ; } return new ServerAddress ( tokens [ 0 ] , Integer . valueOf ( tokens [ 1 ] ) ) ; |
public class ErrorToFixMapper { /** * Creates a SuggestedFix for the given error . Note that some errors have multiple fixes
* so getFixesForJsError should often be used instead of this . */
public static SuggestedFix getFixForJsError ( JSError error , AbstractCompiler compiler ) { } } | switch ( error . getType ( ) . key ) { case "JSC_REDECLARED_VARIABLE" : return getFixForRedeclaration ( error , compiler ) ; case "JSC_REFERENCE_BEFORE_DECLARE" : return getFixForEarlyReference ( error , compiler ) ; case "JSC_MISSING_SEMICOLON" : return getFixForMissingSemicolon ( error , compiler ) ; case "JSC_REQUIRES_NOT_SORTED" : return getFixForUnsortedRequires ( error , compiler ) ; case "JSC_PROVIDES_NOT_SORTED" : return getFixForUnsortedProvides ( error , compiler ) ; case "JSC_DEBUGGER_STATEMENT_PRESENT" : return removeNode ( error , compiler ) ; case "JSC_USELESS_EMPTY_STATEMENT" : return removeEmptyStatement ( error , compiler ) ; case "JSC_INEXISTENT_PROPERTY" : return getFixForInexistentProperty ( error , compiler ) ; case "JSC_MISSING_CALL_TO_SUPER" : return getFixForMissingSuper ( error , compiler ) ; case "JSC_INVALID_SUPER_CALL_WITH_SUGGESTION" : return getFixForInvalidSuper ( error , compiler ) ; case "JSC_MISSING_REQUIRE_WARNING" : case "JSC_MISSING_REQUIRE_STRICT_WARNING" : return getFixForMissingRequire ( error , compiler ) ; case "JSC_EXTRA_REQUIRE_WARNING" : return getFixForExtraRequire ( error , compiler ) ; case "JSC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME" : case "JSC_JSDOC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME" : case "JSC_REFERENCE_TO_FULLY_QUALIFIED_IMPORT_NAME" : // TODO ( tbreisacher ) : Apply this fix for JSC _ JSDOC _ REFERENCE _ TO _ FULLY _ QUALIFIED _ IMPORT _ NAME .
return getFixForReferenceToShortImportByLongName ( error , compiler ) ; case "JSC_REDUNDANT_NULLABILITY_MODIFIER_JSDOC" : return getFixForRedundantNullabilityModifierJsDoc ( error , compiler ) ; default : return null ; } |
public class CompositeUnicode2Unicode { /** * Convert a vietnamese string with composite unicode encoding to unicode encoding .
* @ param text string in vietnamese with composite unicode encoding
* @ return string with unicode encoding */
public String convert ( String text ) { } } | String ret = text ; if ( cpsUni2Uni == null ) return ret ; Iterator < String > it = cpsUni2Uni . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { String cpsChar = it . next ( ) ; ret = ret . replaceAll ( cpsChar , cpsUni2Uni . get ( cpsChar ) ) ; } return ret ; |
public class ReservoirItemsSketch { /** * Computes an estimated subset sum from the entire stream for objects matching a given
* predicate . Provides a lower bound , estimate , and upper bound using a target of 2 standard
* deviations .
* < p > This is technically a heuristic method , and tries to err on the conservative side . < / p >
* @ param predicate A predicate to use when identifying items .
* @ return A summary object containing the estimate , upper and lower bounds , and the total
* sketch weight . */
public SampleSubsetSummary estimateSubsetSum ( final Predicate < T > predicate ) { } } | if ( itemsSeen_ == 0 ) { return new SampleSubsetSummary ( 0.0 , 0.0 , 0.0 , 0.0 ) ; } final long numSamples = getNumSamples ( ) ; final double samplingRate = numSamples / ( double ) itemsSeen_ ; assert samplingRate >= 0.0 ; assert samplingRate <= 1.0 ; int trueCount = 0 ; for ( int i = 0 ; i < numSamples ; ++ i ) { if ( predicate . test ( data_ . get ( i ) ) ) { ++ trueCount ; } } // if in exact mode , we can return an exact answer
if ( itemsSeen_ <= reservoirSize_ ) { return new SampleSubsetSummary ( trueCount , trueCount , trueCount , numSamples ) ; } final double lbTrueFraction = pseudoHypergeometricLBonP ( numSamples , trueCount , samplingRate ) ; final double estimatedTrueFraction = ( 1.0 * trueCount ) / numSamples ; final double ubTrueFraction = pseudoHypergeometricUBonP ( numSamples , trueCount , samplingRate ) ; return new SampleSubsetSummary ( itemsSeen_ * lbTrueFraction , itemsSeen_ * estimatedTrueFraction , itemsSeen_ * ubTrueFraction , itemsSeen_ ) ; |
public class JsMainImpl { /** * ( non - Javadoc )
* @ see com . ibm . wsspi . runtime . component . WsComponent # stop ( ) */
public void stop ( ) { } } | String thisMethodName = CLASS_NAME + ".stop()" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { // SibTr . entry ( tc , thisMethodName ) ;
} // Get the MEs on this server
Enumeration meEnum = _messagingEngines . elements ( ) ; // Stop each ME on this server . Any exceptions are caught and
// deliberately
// not
// rethrown as errors in one ME must not affect any others that might
// exist .
while ( meEnum . hasMoreElements ( ) ) { Object o = meEnum . nextElement ( ) ; Object c = ( ( MessagingEngine ) o ) . getRuntime ( ) ; try { ( ( BaseMessagingEngineImpl ) c ) . stopConditional ( JsConstants . ME_STOP_IMMEDIATE ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , thisMethodName , "1:854:1.108" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_ERROR_SIAS0003" , e ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName ) ; } |
public class OlmConnector { /** * / * ( non - Javadoc )
* @ see org . springframework . beans . factory . InitializingBean # afterPropertiesSet ( ) */
public void afterPropertiesSet ( ) { } } | connector = ConnectorFactory . create ( olmConnectorPropertyFile , connectorName ) ; connector . setResponseManager ( olmAckManger ) ; connector . setErrorManager ( errorManager ) ; connector . configure ( ) ; |
public class DeepFetchNode { /** * mapper is not necessarily this . relatedFinder . mapper . chained mapper and linked mapper ' s callbacks . */
public Operation createMappedOperationForDeepFetch ( Mapper mapper ) { } } | Operation rootOperation = this . getRootOperation ( ) ; if ( rootOperation == null ) return null ; return mapper . createMappedOperationForDeepFetch ( rootOperation ) ; |
public class TableFunctionsCellTable { /** * Create an anchor with the title and the pubMedId
* In the config file use :
* fieldName = " func ( PUBMED _ URL ( title , pubMedID ) ) " */
private String pubMedURL ( ) { } } | if ( params . length != 2 ) { throw new IllegalArgumentException ( "Wrong number of Parameters for limit string expression" ) ; } final String title = record . getValueByFieldName ( params [ 0 ] ) ; String pubMedId = record . getValueByFieldName ( params [ 1 ] ) ; if ( pubMedId . isEmpty ( ) ) { return title ; } String result = "<a href=" + "http://www.ncbi.nlm.nih.gov/pubmed/" + pubMedId + " target=_blank>" + title + "</a>" ; return result ; |
public class LoggingCharacterComponent { /** * / * ( non - Javadoc )
* @ see org . apereo . portal . rendering . PipelineComponent # getEventReader ( javax . servlet . http . HttpServletRequest , javax . servlet . http . HttpServletResponse ) */
@ Override public PipelineEventReader < CharacterEventReader , CharacterEvent > getEventReader ( HttpServletRequest request , HttpServletResponse response ) { } } | final PipelineEventReader < CharacterEventReader , CharacterEvent > pipelineEventReader = this . wrappedComponent . getEventReader ( request , response ) ; final CharacterEventReader eventReader = pipelineEventReader . getEventReader ( ) ; final LoggingCharacterEventReader loggingEventReader = new LoggingCharacterEventReader ( eventReader ) ; final Map < String , String > outputProperties = pipelineEventReader . getOutputProperties ( ) ; return new PipelineEventReaderImpl < CharacterEventReader , CharacterEvent > ( loggingEventReader , outputProperties ) ; |
public class OptionUtil { /** * 导出到指定文件
* @ param option
* @ param folderPath
* @ param fileName
* @ return 返回html路径 */
public static String exportToHtml ( Option option , String folderPath , String fileName ) { } } | if ( fileName == null || fileName . length ( ) == 0 ) { return exportToHtml ( option , folderPath ) ; } Writer writer = null ; List < String > lines = readLines ( option ) ; // 写入文件
File html = new File ( getFolderPath ( folderPath ) + "/" + fileName ) ; try { writer = new OutputStreamWriter ( new FileOutputStream ( html ) , "UTF-8" ) ; for ( String l : lines ) { writer . write ( l + "\n" ) ; } } catch ( Exception e ) { } finally { if ( writer != null ) { try { writer . close ( ) ; } catch ( IOException e ) { // ignore
} } } // 处理
try { return html . getAbsolutePath ( ) ; } catch ( Exception e ) { return null ; } |
public class JobmanagerInfoServlet { /** * Writes ManagementGraph as Json for all recent jobs
* @ param wrt
* @ param jobs */
private void writeJsonForJobs ( PrintWriter wrt , List < RecentJobEvent > jobs ) { } } | try { wrt . write ( "[" ) ; // Loop Jobs
for ( int i = 0 ; i < jobs . size ( ) ; i ++ ) { RecentJobEvent jobEvent = jobs . get ( i ) ; writeJsonForJob ( wrt , jobEvent ) ; // Write seperator between json objects
if ( i != jobs . size ( ) - 1 ) { wrt . write ( "," ) ; } } wrt . write ( "]" ) ; } catch ( EofException eof ) { // Connection closed by client
LOG . info ( "Info server for jobmanager: Connection closed by client, EofException" ) ; } catch ( IOException ioe ) { // Connection closed by client
LOG . info ( "Info server for jobmanager: Connection closed by client, IOException" ) ; } |
public class Governator { /** * Add a runtime profiles . Profiles are processed by the conditional binding { @ literal @ } ConditionalOnProfile and
* are injectable as { @ literal @ } Profiles Set { @ literal < } String { @ literal > } .
* @ param profiles Set of profiles
* @ return this */
public Governator addProfiles ( Collection < String > profiles ) { } } | if ( profiles != null ) { this . profiles . addAll ( profiles ) ; } return this ; |
public class RowSeq { /** * Extracts the value of a cell containing a data point .
* @ param value The contents of a cell in HBase .
* @ param value _ idx The offset inside { @ code values } at which the value
* starts .
* @ param flags The flags for this value .
* @ return The value of the cell .
* @ throws IllegalDataException if the data is malformed */
static double extractFloatingPointValue ( final byte [ ] values , final int value_idx , final byte flags ) { } } | switch ( flags & Const . LENGTH_MASK ) { case 7 : return Double . longBitsToDouble ( Bytes . getLong ( values , value_idx ) ) ; case 3 : return Float . intBitsToFloat ( Bytes . getInt ( values , value_idx ) ) ; } throw new IllegalDataException ( "Floating point value @ " + value_idx + " not on 8 or 4 bytes in " + Arrays . toString ( values ) ) ; |
public class Controller { /** * Removes a child { @ link Router } from this Controller . When removed , all Controllers currently managed by
* the { @ link Router } will be destroyed .
* @ param childRouter The router to be removed */
public final void removeChildRouter ( @ NonNull Router childRouter ) { } } | if ( ( childRouter instanceof ControllerHostedRouter ) && childRouters . remove ( childRouter ) ) { childRouter . destroy ( true ) ; } |
public class DevicesInner { /** * Gets the network settings of the specified data box edge / gateway device .
* @ param deviceName The device name .
* @ param resourceGroupName The resource group name .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the NetworkSettingsInner object */
public Observable < ServiceResponse < NetworkSettingsInner > > getNetworkSettingsWithServiceResponseAsync ( String deviceName , String resourceGroupName ) { } } | if ( deviceName == null ) { throw new IllegalArgumentException ( "Parameter deviceName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . getNetworkSettings ( deviceName , this . client . subscriptionId ( ) , resourceGroupName , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < NetworkSettingsInner > > > ( ) { @ Override public Observable < ServiceResponse < NetworkSettingsInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < NetworkSettingsInner > clientResponse = getNetworkSettingsDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class NotificationManager { /** * Init all static components of the notification .
* @ param context context used to instantiate the builder . */
private void initNotificationBuilder ( Context context ) { } } | // inti builder .
mNotificationBuilder = new NotificationCompat . Builder ( context ) ; mNotificationView = new RemoteViews ( context . getPackageName ( ) , R . layout . simple_sound_cloud_notification ) ; mNotificationExpandedView = new RemoteViews ( context . getPackageName ( ) , R . layout . simple_sound_cloud_notification_expanded ) ; // add right icon on Lollipop .
if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) { addSmallIcon ( mNotificationView ) ; addSmallIcon ( mNotificationExpandedView ) ; } // set pending intents
mNotificationView . setOnClickPendingIntent ( R . id . simple_sound_cloud_notification_previous , mPreviousPendingIntent ) ; mNotificationExpandedView . setOnClickPendingIntent ( R . id . simple_sound_cloud_notification_previous , mPreviousPendingIntent ) ; mNotificationView . setOnClickPendingIntent ( R . id . simple_sound_cloud_notification_next , mNextPendingIntent ) ; mNotificationExpandedView . setOnClickPendingIntent ( R . id . simple_sound_cloud_notification_next , mNextPendingIntent ) ; mNotificationView . setOnClickPendingIntent ( R . id . simple_sound_cloud_notification_play , mTogglePlaybackPendingIntent ) ; mNotificationExpandedView . setOnClickPendingIntent ( R . id . simple_sound_cloud_notification_play , mTogglePlaybackPendingIntent ) ; mNotificationView . setOnClickPendingIntent ( R . id . simple_sound_cloud_notification_clear , mClearPendingIntent ) ; mNotificationExpandedView . setOnClickPendingIntent ( R . id . simple_sound_cloud_notification_clear , mClearPendingIntent ) ; // add icon for action bar .
mNotificationBuilder . setSmallIcon ( mNotificationConfig . getNotificationIcon ( ) ) ; // set the remote view .
mNotificationBuilder . setContent ( mNotificationView ) ; // set the notification priority .
mNotificationBuilder . setPriority ( NotificationCompat . PRIORITY_HIGH ) ; mNotificationBuilder . setStyle ( new NotificationCompat . DecoratedCustomViewStyle ( ) ) ; // set the content intent .
Class < ? > playerActivity = mNotificationConfig . getNotificationActivity ( ) ; if ( playerActivity != null ) { Intent i = new Intent ( context , playerActivity ) ; PendingIntent contentIntent = PendingIntent . getActivity ( context , REQUEST_DISPLAYING_CONTROLLER , i , PendingIntent . FLAG_UPDATE_CURRENT ) ; mNotificationBuilder . setContentIntent ( contentIntent ) ; } |
public class AppOpticsMeterRegistry { /** * VisibleForTesting */
Optional < String > writeTimeGauge ( TimeGauge timeGauge ) { } } | double value = timeGauge . value ( getBaseTimeUnit ( ) ) ; if ( ! Double . isFinite ( value ) ) { return Optional . empty ( ) ; } return Optional . of ( write ( timeGauge . getId ( ) , "timeGauge" , Fields . Value . tag ( ) , decimal ( value ) ) ) ; |
public class Slice { /** * Transfers data from the specified slice into this buffer starting at
* the specified absolute { @ code index } .
* @ param sourceIndex the first index of the source
* @ param length the number of bytes to transfer
* @ throws IndexOutOfBoundsException if the specified { @ code index } is less than { @ code 0 } ,
* if the specified { @ code sourceIndex } is less than { @ code 0 } ,
* if { @ code index + length } is greater than
* { @ code this . length ( ) } , or
* if { @ code sourceIndex + length } is greater than
* { @ code source . length ( ) } */
public void setBytes ( int index , Slice source , int sourceIndex , int length ) { } } | checkIndexLength ( index , length ) ; checkPositionIndexes ( sourceIndex , sourceIndex + length , source . length ( ) ) ; copyMemory ( source . base , source . address + sourceIndex , base , address + index , length ) ; |
public class AllureReportUtils { /** * Serialize specified object to directory with specified name . Given output stream will be closed .
* @ param obj object to serialize
* @ return number of bytes written to directory */
public static int serialize ( OutputStream stream , Object obj ) { } } | ObjectMapper mapper = createMapperWithJaxbAnnotationInspector ( ) ; try ( DataOutputStream data = new DataOutputStream ( stream ) ; OutputStreamWriter writer = new OutputStreamWriter ( data , StandardCharsets . UTF_8 ) ) { mapper . writerWithDefaultPrettyPrinter ( ) . writeValue ( writer , obj ) ; return data . size ( ) ; } catch ( IOException e ) { throw new ReportGenerationException ( e ) ; } |
public class YarnJobSubmissionHandler { /** * Extracts the queue name from the driverConfiguration or return default if none is set .
* @ param driverConfiguration The drievr configuration
* @ return the queue name from the driverConfiguration or return default if none is set . */
private String getQueue ( final Configuration driverConfiguration ) { } } | try { return Tang . Factory . getTang ( ) . newInjector ( driverConfiguration ) . getNamedInstance ( JobQueue . class ) ; } catch ( final InjectionException e ) { return this . defaultQueueName ; } |
public class BaseFont { /** * Gets the name without the modifiers Bold , Italic or BoldItalic .
* @ param name the full name of the font
* @ return the name without the modifiers Bold , Italic or BoldItalic */
protected static String getBaseName ( String name ) { } } | if ( name . endsWith ( ",Bold" ) ) return name . substring ( 0 , name . length ( ) - 5 ) ; else if ( name . endsWith ( ",Italic" ) ) return name . substring ( 0 , name . length ( ) - 7 ) ; else if ( name . endsWith ( ",BoldItalic" ) ) return name . substring ( 0 , name . length ( ) - 11 ) ; else return name ; |
public class TemplateNodeBuilder { /** * Private helper for the constructor to clean the SoyDoc . ( 1 ) Changes all newlines to " \ n " . ( 2)
* Escapes deprecated javadoc tags . ( 3 ) Strips the start / end tokens and spaces ( including newlines
* if they occupy their own lines ) . ( 4 ) Removes common indent from all lines ( e . g .
* space - star - space ) .
* @ param soyDoc The SoyDoc to clean .
* @ return The cleaned SoyDoc . */
private static String cleanSoyDocHelper ( String soyDoc ) { } } | // Change all newlines to " \ n " .
soyDoc = NEWLINE . matcher ( soyDoc ) . replaceAll ( "\n" ) ; // Escape all @ deprecated javadoc tags .
// TODO ( cushon ) : add this to the specification and then also generate @ Deprecated annotations
soyDoc = soyDoc . replace ( "@deprecated" , "@deprecated" ) ; // Strip start / end tokens and spaces ( including newlines if they occupy their own lines ) .
soyDoc = SOY_DOC_START . matcher ( soyDoc ) . replaceFirst ( "" ) ; soyDoc = SOY_DOC_END . matcher ( soyDoc ) . replaceFirst ( "" ) ; // Split into lines .
List < String > lines = Lists . newArrayList ( Splitter . on ( NEWLINE ) . split ( soyDoc ) ) ; // Remove indent common to all lines . Note that SoyDoc indents often include a star
// ( specifically the most common indent is space - star - space ) . Thus , we first remove common
// spaces , then remove one common star , and finally , if we did remove a star , then we once again
// remove common spaces .
removeCommonStartCharHelper ( lines , ' ' , true ) ; if ( removeCommonStartCharHelper ( lines , '*' , false ) == 1 ) { removeCommonStartCharHelper ( lines , ' ' , true ) ; } return CharMatcher . whitespace ( ) . trimTrailingFrom ( Joiner . on ( '\n' ) . join ( lines ) ) ; |
public class BioVerb { /** * getter for canonical - gets
* @ generated
* @ return value of the feature */
public String getCanonical ( ) { } } | if ( BioVerb_Type . featOkTst && ( ( BioVerb_Type ) jcasType ) . casFeat_canonical == null ) jcasType . jcas . throwFeatMissing ( "canonical" , "ch.epfl.bbp.uima.types.BioVerb" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( BioVerb_Type ) jcasType ) . casFeatCode_canonical ) ; |
public class XMLConfigAdmin { /** * insert or update a mapping on system
* @ param virtual
* @ param physical
* @ param archive
* @ param primary
* @ param trusted
* @ param toplevel
* @ throws ExpressionException
* @ throws SecurityException */
public void updateMapping ( String virtual , String physical , String archive , String primary , short inspect , boolean toplevel , int listenerMode , int listenerType , boolean readOnly ) throws ExpressionException , SecurityException { } } | checkWriteAccess ( ) ; _updateMapping ( virtual , physical , archive , primary , inspect , toplevel , listenerMode , listenerType , readOnly ) ; |
public class Get { /** * Retrieves the full html source of the current page the application is on
* @ return String - current application page source */
public String htmlSource ( ) { } } | try { return driver . getPageSource ( ) ; } catch ( Exception e ) { log . warn ( e ) ; return null ; } |
public class Transformation2D { /** * Initialize transformation from two rectangles . */
void initializeFromRect ( Envelope2D src , Envelope2D dest ) { } } | if ( src . isEmpty ( ) || dest . isEmpty ( ) || 0 == src . getWidth ( ) || 0 == src . getHeight ( ) ) setZero ( ) ; else { xy = yx = 0 ; xx = dest . getWidth ( ) / src . getWidth ( ) ; yy = dest . getHeight ( ) / src . getHeight ( ) ; xd = dest . xmin - src . xmin * xx ; yd = dest . ymin - src . ymin * yy ; } |
public class Const { /** * { @ inheritDoc } */
@ Override @ SuppressWarnings ( "unchecked" ) public < C > Const < A , C > flatMap ( Function < ? super B , ? extends Monad < C , Const < A , ? > > > f ) { } } | return ( Const < A , C > ) this ; |
public class LabelingJobResourceConfigMarshaller { /** * Marshall the given parameter object . */
public void marshall ( LabelingJobResourceConfig labelingJobResourceConfig , ProtocolMarshaller protocolMarshaller ) { } } | if ( labelingJobResourceConfig == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( labelingJobResourceConfig . getVolumeKmsKeyId ( ) , VOLUMEKMSKEYID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class StateHelper { /** * < p > Creates a Random node identifier as described in IEFT UUID URN
* specification . < / p >
* @ return a random node idenfifier based on MD5 of system information . */
public static byte [ ] randomNodeIdentifier ( ) { } } | // Holds the 16 byte MD5 value
byte [ ] seed = new byte [ UUID_BYTE_LENGTH ] ; // Set the initial string buffer capacity
// Time + Object . hashCode + HostName + Guess of all system properties
int bufSize = ( LONG_CHAR_LEN * 2 ) + HOSTNAME_MAX_CHAR_LEN + ( 2 * BUF_PAGE_SZ ) ; StringBuffer randInfo = new StringBuffer ( bufSize ) ; // Add current time
long time = 0 ; try { time = getClockImpl ( ) . getUUIDTime ( ) ; } catch ( OverClockedException oce ) { time = System . currentTimeMillis ( ) ; } randInfo . append ( time ) ; // Add hostname
try { InetAddress address = InetAddress . getLocalHost ( ) ; randInfo . append ( address . getHostName ( ) ) ; } catch ( UnknownHostException ukhe ) { randInfo . append ( "Host Unknown" ) ; } // Add something else " random "
randInfo . append ( new Object ( ) . hashCode ( ) ) ; // Add system properties
Collection info = System . getProperties ( ) . values ( ) ; Iterator it = info . iterator ( ) ; while ( it . hasNext ( ) ) { randInfo . append ( it . next ( ) ) ; } // MD5 Hash code the system information to get a node id .
seed = DigestUtils . md5 ( randInfo . toString ( ) ) ; // Return upper 6 bytes of hash
byte [ ] raw = new byte [ NODE_ID_BYTE_LENGTH ] ; System . arraycopy ( seed , 0 , raw , 0 , NODE_ID_BYTE_LENGTH ) ; // Per draft set multi - cast bit true
raw [ 0 ] |= MULTICAST_BIT_SET ; return raw ; |
public class UpdateLoggerDefinitionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateLoggerDefinitionRequest updateLoggerDefinitionRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateLoggerDefinitionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateLoggerDefinitionRequest . getLoggerDefinitionId ( ) , LOGGERDEFINITIONID_BINDING ) ; protocolMarshaller . marshall ( updateLoggerDefinitionRequest . getName ( ) , NAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class RelationMention { /** * indexed getter for arguments - gets an indexed value -
* @ generated
* @ param i index in the array to get
* @ return value of the element at index i */
public ArgumentMention getArguments ( int i ) { } } | if ( RelationMention_Type . featOkTst && ( ( RelationMention_Type ) jcasType ) . casFeat_arguments == null ) jcasType . jcas . throwFeatMissing ( "arguments" , "de.julielab.jules.types.RelationMention" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( RelationMention_Type ) jcasType ) . casFeatCode_arguments ) , i ) ; return ( ArgumentMention ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( RelationMention_Type ) jcasType ) . casFeatCode_arguments ) , i ) ) ) ; |
public class ConsumerService { /** * Callback entry point for all registered consumers . */
@ Override public void onMessage ( String channel , Message message ) { } } | if ( MessageUtil . isMessageExcluded ( message , RecipientType . CONSUMER , nodeId ) ) { return ; } if ( updateDelivered ( message ) ) { LinkedHashSet < IMessageCallback > callbacks = getCallbacks ( channel , false , true ) ; if ( callbacks != null ) { dispatchMessages ( channel , message , callbacks ) ; } } |
public class AbstractGwtMojo { /** * Add classpath elements to a classpath URL set
* @ param elements the initial URL set
* @ param urls the urls to add
* @ param startPosition the position to insert URLS
* @ return full classpath URL set
* @ throws MojoExecutionException some error occured */
protected int addClasspathElements ( Collection < ? > elements , URL [ ] urls , int startPosition ) throws MojoExecutionException { } } | for ( Object object : elements ) { try { if ( object instanceof Artifact ) { urls [ startPosition ] = ( ( Artifact ) object ) . getFile ( ) . toURI ( ) . toURL ( ) ; } else if ( object instanceof Resource ) { urls [ startPosition ] = new File ( ( ( Resource ) object ) . getDirectory ( ) ) . toURI ( ) . toURL ( ) ; } else { urls [ startPosition ] = new File ( ( String ) object ) . toURI ( ) . toURL ( ) ; } } catch ( MalformedURLException e ) { throw new MojoExecutionException ( "Failed to convert original classpath element " + object + " to URL." , e ) ; } startPosition ++ ; } return startPosition ; |
public class DeleteFolderRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteFolderRequest deleteFolderRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteFolderRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteFolderRequest . getAuthenticationToken ( ) , AUTHENTICATIONTOKEN_BINDING ) ; protocolMarshaller . marshall ( deleteFolderRequest . getFolderId ( ) , FOLDERID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CoreStitchAuth { /** * Internal method which performs the authenticated request by preparing the auth request with
* the provided auth info and request . */
private synchronized Response doAuthenticatedRequest ( final StitchAuthRequest stitchReq , final AuthInfo authInfo ) { } } | try { return requestClient . doRequest ( prepareAuthRequest ( stitchReq , authInfo ) ) ; } catch ( final StitchServiceException ex ) { return handleAuthFailure ( ex , stitchReq ) ; } |
public class DNSSEC { /** * Builds a DNSKEY record from a PublicKey */
static byte [ ] fromPublicKey ( PublicKey key , int alg ) throws DNSSECException { } } | switch ( alg ) { case Algorithm . RSAMD5 : case Algorithm . RSASHA1 : case Algorithm . RSA_NSEC3_SHA1 : case Algorithm . RSASHA256 : case Algorithm . RSASHA512 : if ( ! ( key instanceof RSAPublicKey ) ) throw new IncompatibleKeyException ( ) ; return fromRSAPublicKey ( ( RSAPublicKey ) key ) ; case Algorithm . DSA : case Algorithm . DSA_NSEC3_SHA1 : if ( ! ( key instanceof DSAPublicKey ) ) throw new IncompatibleKeyException ( ) ; return fromDSAPublicKey ( ( DSAPublicKey ) key ) ; case Algorithm . ECC_GOST : if ( ! ( key instanceof ECPublicKey ) ) throw new IncompatibleKeyException ( ) ; return fromECGOSTPublicKey ( ( ECPublicKey ) key , GOST ) ; case Algorithm . ECDSAP256SHA256 : if ( ! ( key instanceof ECPublicKey ) ) throw new IncompatibleKeyException ( ) ; return fromECDSAPublicKey ( ( ECPublicKey ) key , ECDSA_P256 ) ; case Algorithm . ECDSAP384SHA384 : if ( ! ( key instanceof ECPublicKey ) ) throw new IncompatibleKeyException ( ) ; return fromECDSAPublicKey ( ( ECPublicKey ) key , ECDSA_P384 ) ; default : throw new UnsupportedAlgorithmException ( alg ) ; } |
public class Http2SettingsHandler { /** * Wait for this handler to be added after the upgrade to HTTP / 2 , and for initial preface
* handshake to complete .
* @ param timeout Time to wait
* @ param unit { @ link java . util . concurrent . TimeUnit } for { @ code timeout }
* @ throws Exception if timeout or other failure occurs */
public void awaitSettings ( long timeout , TimeUnit unit ) throws Exception { } } | if ( ! promise . awaitUninterruptibly ( timeout , unit ) ) { throw new IllegalStateException ( "Timed out waiting for settings" ) ; } if ( ! promise . isSuccess ( ) ) { throw new RuntimeException ( promise . cause ( ) ) ; } |
public class CascadingClassLoadHelper { /** * Enable sharing of the " best " class - loader with 3rd party .
* @ return the class - loader user be the helper . */
@ Override public ClassLoader getClassLoader ( ) { } } | return ( this . bestCandidate == null ) ? Thread . currentThread ( ) . getContextClassLoader ( ) : this . bestCandidate . getClassLoader ( ) ; |
public class PrefixedProperties { /** * Creates the cascading prefix properties .
* @ param configs
* the configs
* @ return the prefixed properties */
public static PrefixedProperties createCascadingPrefixProperties ( final List < PrefixConfig > configs ) { } } | PrefixedProperties properties = null ; for ( final PrefixConfig config : configs ) { if ( properties == null ) { properties = new PrefixedProperties ( ( config == null ) ? new DynamicPrefixConfig ( ) : config ) ; } else { properties = new PrefixedProperties ( properties , ( config == null ) ? new DynamicPrefixConfig ( ) : config ) ; } } return properties ; |
public class NumberUtil { /** * 无符号bytes转 { @ link BigInteger }
* @ param buf 无符号bytes
* @ param off 起始位置
* @ param length 长度
* @ return { @ link BigInteger } */
public static BigInteger fromUnsignedByteArray ( byte [ ] buf , int off , int length ) { } } | byte [ ] mag = buf ; if ( off != 0 || length != buf . length ) { mag = new byte [ length ] ; System . arraycopy ( buf , off , mag , 0 , length ) ; } return new BigInteger ( 1 , mag ) ; |
public class KeyDecoder { /** * Decodes a double from exactly 8 bytes , as encoded for descending order .
* @ param src source of encoded bytes
* @ param srcOffset offset into source array
* @ return double value */
public static double decodeDoubleDesc ( byte [ ] src , int srcOffset ) throws CorruptEncodingException { } } | long bits = DataDecoder . decodeDoubleBits ( src , srcOffset ) ; if ( bits >= 0 ) { bits ^= 0x7fffffffffffffffL ; } return Double . longBitsToDouble ( bits ) ; |
public class ClassPath { public static boolean isPrimitive ( Class < ? > aClass ) { } } | if ( aClass == null ) return false ; String className = aClass . getName ( ) ; return className . matches ( "(float|char|short|double|int|long|byte|boolean|(java.lang.(Long|Integer|String|Float|Double|Short|Byte|Boolean)))" ) ; |
public class _ArrayMap { /** * Removes the value for the key from the array , returning a
* new array if necessary . */
static public Object [ ] remove ( Object [ ] array , Object key , boolean reallocate ) { } } | if ( array != null ) { int length = array . length ; for ( int i = 0 ; i < length ; i += 2 ) { Object curKey = array [ i ] ; if ( ( ( curKey != null ) && curKey . equals ( key ) ) || ( curKey == key ) ) { Object [ ] newArray = array ; if ( reallocate ) { newArray = new Object [ length - 2 ] ; System . arraycopy ( array , 0 , newArray , 0 , i ) ; } System . arraycopy ( array , i + 2 , newArray , i , length - i - 2 ) ; if ( ! reallocate ) { array [ length - 1 ] = null ; array [ length - 2 ] = null ; } return newArray ; } } } return array ; |
public class AnsjAnalyzer { /** * 获得一个tokenizer
* @ param reader
* @ return */
public static Tokenizer getTokenizer ( Reader reader , Map < String , String > args ) { } } | if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "to create tokenizer " + args ) ; } Analysis analysis = null ; String temp = null ; String type = args . get ( "type" ) ; if ( type == null ) { type = AnsjAnalyzer . TYPE . base_ansj . name ( ) ; } switch ( AnsjAnalyzer . TYPE . valueOf ( type ) ) { case base_ansj : analysis = new BaseAnalysis ( ) ; break ; case index_ansj : analysis = new IndexAnalysis ( ) ; break ; case dic_ansj : analysis = new DicAnalysis ( ) ; break ; case query_ansj : analysis = new ToAnalysis ( ) ; break ; case nlp_ansj : analysis = new NlpAnalysis ( ) ; if ( StringUtil . isNotBlank ( temp = args . get ( CrfLibrary . DEFAULT ) ) ) { ( ( NlpAnalysis ) analysis ) . setCrfModel ( CrfLibrary . get ( temp ) ) ; } break ; default : analysis = new BaseAnalysis ( ) ; } if ( reader != null ) { analysis . resetContent ( reader ) ; } if ( StringUtil . isNotBlank ( temp = args . get ( DicLibrary . DEFAULT ) ) ) { // 用户自定义词典
String [ ] split = temp . split ( "," ) ; Forest [ ] forests = new Forest [ split . length ] ; for ( int i = 0 ; i < forests . length ; i ++ ) { if ( StringUtil . isBlank ( split [ i ] ) ) { continue ; } forests [ i ] = DicLibrary . get ( split [ i ] ) ; } analysis . setForests ( forests ) ; } List < StopRecognition > filters = null ; if ( StringUtil . isNotBlank ( temp = args . get ( StopLibrary . DEFAULT ) ) ) { // 用户自定义词典
String [ ] split = temp . split ( "," ) ; filters = new ArrayList < StopRecognition > ( ) ; for ( String key : split ) { StopRecognition stop = StopLibrary . get ( key . trim ( ) ) ; if ( stop != null ) filters . add ( stop ) ; } } List < SynonymsRecgnition > synonyms = null ; if ( StringUtil . isNotBlank ( temp = args . get ( SynonymsLibrary . DEFAULT ) ) ) { // 同义词词典
String [ ] split = temp . split ( "," ) ; synonyms = new ArrayList < SynonymsRecgnition > ( ) ; for ( String key : split ) { SmartForest < List < String > > sf = SynonymsLibrary . get ( key . trim ( ) ) ; if ( sf != null ) synonyms . add ( new SynonymsRecgnition ( sf ) ) ; } } if ( StringUtil . isNotBlank ( temp = args . get ( AmbiguityLibrary . DEFAULT ) ) ) { // 歧义词典
analysis . setAmbiguityForest ( AmbiguityLibrary . get ( temp . trim ( ) ) ) ; } if ( StringUtil . isNotBlank ( temp = args . get ( "isNameRecognition" ) ) ) { // 是否开启人名识别
analysis . setIsNameRecognition ( Boolean . valueOf ( temp ) ) ; } if ( StringUtil . isNotBlank ( temp = args . get ( "isNumRecognition" ) ) ) { // 是否开启数字识别
analysis . setIsNumRecognition ( Boolean . valueOf ( temp ) ) ; } if ( StringUtil . isNotBlank ( temp = args . get ( "isQuantifierRecognition" ) ) ) { // 量词识别
analysis . setIsQuantifierRecognition ( Boolean . valueOf ( temp ) ) ; } if ( StringUtil . isNotBlank ( temp = args . get ( "isRealName" ) ) ) { // 是否保留原字符
analysis . setIsRealName ( Boolean . valueOf ( temp ) ) ; } return new AnsjTokenizer ( analysis , filters , synonyms ) ; |
public class PairIdGenerator { @ Override public Pair < T1 , T2 > generateId ( ) { } } | return new Pair < T1 , T2 > ( firstIdGenerator . generateId ( ) , secondIdGenerator . generateId ( ) ) ; |
public class DirectoryServiceRestfulClient { /** * Deserialize a JSON String to a generic object .
* This method is used when the target object is generic .
* @ param body
* the JSON String .
* @ param typeRef
* the generic type .
* @ return
* the deserialized object instance .
* @ throws ServiceException */
< T > T deserialize ( String body , TypeReference < T > typeRef ) { } } | if ( body == null || body . isEmpty ( ) ) { throw new ServiceException ( ErrorCode . REMOTE_DIRECTORY_SERVER_ERROR , ErrorCode . REMOTE_DIRECTORY_SERVER_ERROR . getMessageTemplate ( ) , "the message body is empty" ) ; } try { return JsonSerializer . deserialize ( body . getBytes ( ) , typeRef ) ; } catch ( Exception e ) { throw new ServiceException ( ErrorCode . REMOTE_DIRECTORY_SERVER_ERROR , e , ErrorCode . REMOTE_DIRECTORY_SERVER_ERROR . getMessageTemplate ( ) , "unrecognized message, deserialize failed." ) ; } |
public class SlackMessage { /** * Convert SlackMessage to JSON
* @ return JsonObject */
public JsonObject prepare ( ) { } } | if ( channel != null ) { slackMessage . addProperty ( CHANNEL , channel ) ; } if ( username != null ) { slackMessage . addProperty ( USERNAME , username ) ; } if ( icon != null ) { if ( icon . contains ( HTTP ) ) { slackMessage . addProperty ( ICON_URL , icon ) ; } else { slackMessage . addProperty ( ICON_EMOJI , icon ) ; } } slackMessage . addProperty ( UNFURL_MEDIA , unfurlMedia ) ; slackMessage . addProperty ( UNFURL_LINKS , unfurlLinks ) ; slackMessage . addProperty ( LINK_NAMES , linkNames ) ; if ( text == null ) { throw new IllegalArgumentException ( "Missing Text field @ SlackMessage" ) ; } else { slackMessage . addProperty ( TEXT , text ) ; } if ( ! attach . isEmpty ( ) ) { slackMessage . add ( ATTACHMENTS , this . prepareAttach ( ) ) ; } return slackMessage ; |
public class CharsetMapping { /** * MySQL charset could map to several Java encodings .
* So here we choose the one according to next rules :
* if there is no static mapping for this charset then return javaEncoding value as is because this
* could be a custom charset for example
* if static mapping exists and javaEncoding equals to one of Java encoding canonical names or aliases available
* for this mapping then javaEncoding value as is ; this is required when result should match to connection encoding , for example if connection encoding is
* Cp943 we must avoid getting SHIFT _ JIS for sjis mysql charset
* if static mapping exists and javaEncoding doesn ' t match any Java encoding canonical
* names or aliases available for this mapping then return default Java encoding ( the first in mapping list )
* @ param mysqlCharsetName String
* @ param javaEncoding String
* @ return String */
public static String getJavaEncodingForMysqlCharset ( String mysqlCharsetName , String javaEncoding ) { } } | String res = javaEncoding ; MysqlCharset cs = CHARSET_NAME_TO_CHARSET . get ( mysqlCharsetName ) ; if ( cs != null ) { res = cs . getMatchingJavaEncoding ( javaEncoding ) ; } return res ; |
public class IOState { /** * The local endpoint has reached a read failure .
* This could be a normal result after a proper close handshake , or even a premature close due to a connection disconnect .
* @ param t the read failure */
public void onReadFailure ( Throwable t ) { } } | ConnectionState event = null ; synchronized ( this ) { if ( this . state == ConnectionState . CLOSED ) { // already closed
return ; } // Build out Close Reason
String reason = "WebSocket Read Failure" ; if ( t instanceof EOFException ) { reason = "WebSocket Read EOF" ; Throwable cause = t . getCause ( ) ; if ( ( cause != null ) && ( StringUtils . hasText ( cause . getMessage ( ) ) ) ) { reason = "EOF: " + cause . getMessage ( ) ; } } else { if ( StringUtils . hasText ( t . getMessage ( ) ) ) { reason = t . getMessage ( ) ; } } CloseInfo close = new CloseInfo ( StatusCode . ABNORMAL , reason ) ; finalClose . compareAndSet ( null , close ) ; this . cleanClose = false ; this . state = ConnectionState . CLOSED ; this . closeInfo = close ; this . inputAvailable = false ; this . outputAvailable = false ; this . closeHandshakeSource = CloseHandshakeSource . ABNORMAL ; event = this . state ; } notifyStateListeners ( event ) ; |
public class DescribePrefixListsResult { /** * All available prefix lists .
* @ param prefixLists
* All available prefix lists . */
public void setPrefixLists ( java . util . Collection < PrefixList > prefixLists ) { } } | if ( prefixLists == null ) { this . prefixLists = null ; return ; } this . prefixLists = new com . amazonaws . internal . SdkInternalList < PrefixList > ( prefixLists ) ; |
public class WebApplicationContext { public synchronized void addEventListener ( EventListener listener ) throws IllegalArgumentException { } } | if ( listener instanceof ServletContextListener ) { _contextListeners = LazyList . add ( _contextListeners , listener ) ; } super . addEventListener ( listener ) ; |
public class FloatLabel { /** * Sets the EditText ' s text without animating the label
* @ param text char [ ] text
* @ param start int start of char array to use
* @ param len int characters to use from the array */
public void setTextWithoutAnimation ( char [ ] text , int start , int len ) { } } | mSkipAnimation = true ; mEditText . setText ( text , start , len ) ; |
public class AmazonAlexaForBusinessClient { /** * Gets details about a specific conference provider .
* @ param getConferenceProviderRequest
* @ return Result of the GetConferenceProvider operation returned by the service .
* @ throws NotFoundException
* The resource is not found .
* @ sample AmazonAlexaForBusiness . GetConferenceProvider
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / alexaforbusiness - 2017-11-09 / GetConferenceProvider "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public GetConferenceProviderResult getConferenceProvider ( GetConferenceProviderRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetConferenceProvider ( request ) ; |
public class DelegateExecutionContext { /** * Returns the current delegation execution or null if the
* execution is not available .
* @ return the current delegation execution or null if not available */
public static DelegateExecution getCurrentDelegationExecution ( ) { } } | BpmnExecutionContext bpmnExecutionContext = Context . getBpmnExecutionContext ( ) ; ExecutionEntity executionEntity = null ; if ( bpmnExecutionContext != null ) { executionEntity = bpmnExecutionContext . getExecution ( ) ; } return executionEntity ; |
public class InstrumentationFieldCompleteParameters { /** * Returns a cloned parameters object with the new state
* @ param instrumentationState the new state for this parameters object
* @ return a new parameters object with the new state */
public InstrumentationFieldCompleteParameters withNewState ( InstrumentationState instrumentationState ) { } } | return new InstrumentationFieldCompleteParameters ( this . executionContext , executionStrategyParameters , this . fieldDef , this . typeInfo , this . fetchedValue , instrumentationState ) ; |
public class _ArrayMap { /** * Gets the object stored with the given key , using
* only object identity . */
static public Object getByIdentity ( Object [ ] array , Object key ) { } } | if ( array != null ) { int length = array . length ; for ( int i = 0 ; i < length ; i += 2 ) { if ( array [ i ] == key ) { return array [ i + 1 ] ; } } } return null ; |
public class ChronicleMapBuilder { /** * Inject your SPI around logic of all { @ code ChronicleMap } ' s operations with individual keys :
* from { @ link ChronicleMap # containsKey } to { @ link ChronicleMap # acquireUsing } and
* { @ link ChronicleMap # merge } .
* < p > This affects behaviour of ordinary map calls , as well as < i > remote calls < / i > .
* < p > This is a < a href = " # jvm - configurations " > JVM - level configuration < / a > .
* @ return this builder back */
public ChronicleMapBuilder < K , V > mapMethods ( MapMethods < K , V , ? > mapMethods ) { } } | Objects . requireNonNull ( mapMethods ) ; this . methods = mapMethods ; return this ; |
public class LostInstanceCheck { /** * Determine if the instance created with < code > new < / code > ist followed by a dot . If so , it is being used for
* something , so its existence is not considered useless .
* @ param pLiteralNew the current LITERAL _ NEW token found by the visitor
* @ return < code > true < / code > if the instance is being dereferenced */
private boolean isBeingDereferenced ( final DetailAST pLiteralNew ) { } } | boolean result = false ; final DetailAST parent = pLiteralNew . getParent ( ) ; if ( parent . getType ( ) == TokenTypes . DOT && ( pLiteralNew . getNextSibling ( ) != null || parent . getParent ( ) . getType ( ) == TokenTypes . DOT ) ) { result = true ; } return result ; |
public class FeatureManagerBuilder { /** * Adds an additional { @ link ActivationStrategy } to the current { @ link ActivationStrategyProvider } . This currently only
* works if you are using the { @ link DefaultActivationStrategyProvider } . */
public FeatureManagerBuilder activationStrategy ( ActivationStrategy strategy ) { } } | if ( strategyProvider instanceof DefaultActivationStrategyProvider ) { ( ( DefaultActivationStrategyProvider ) strategyProvider ) . addActivationStrategy ( strategy ) ; return this ; } throw new IllegalStateException ( "Adding ActivationStrategies is only allowed when using " + DefaultActivationStrategyProvider . class . getSimpleName ( ) ) ; |
public class HttpClient { /** * Http head request
* @ param url url for the request
* @ return request builder */
public RequestBuilder head ( final String url ) { } } | checkNotNull ( url , "url may not be null" ) ; final AsyncHttpClient . BoundRequestBuilder ningRequestBuilder = asyncHttpClient . prepareHead ( url ) ; return createNewRequestBuilder ( url , ningRequestBuilder ) ; |
public class LolChat { /** * Get all your friends , both online and offline .
* @ return A List of all your Friends */
public List < Friend > getFriends ( ) { } } | return getFriends ( new Filter < Friend > ( ) { public boolean accept ( Friend e ) { return true ; } } ) ; |
public class DirectoryLoaderAdaptor { /** * Index segment files might be larger than 2GB ; so it ' s possible to have an autoChunksize
* which is too low to contain all bytes in a single array ( overkill anyway ) .
* In this case we ramp up and try splitting with larger chunkSize values . */
public static int figureChunksNumber ( final String fileName , final long fileLength , int chunkSize ) { } } | if ( chunkSize < 0 ) { throw new IllegalStateException ( "Overflow in rescaling chunkSize. File way too large?" ) ; } final long numChunks = ( fileLength % chunkSize == 0 ) ? ( fileLength / chunkSize ) : ( fileLength / chunkSize ) + 1 ; if ( numChunks > Integer . MAX_VALUE ) { log . rescalingChunksize ( fileName , fileLength , chunkSize ) ; chunkSize = 32 * chunkSize ; return figureChunksNumber ( fileName , fileLength , chunkSize ) ; } else { return ( int ) numChunks ; } |
public class AbstractInterceptor { /** * Returns name of the given method .
* @ param method { @ link Method }
* @ return the method name or custom name provided via { @ link StatName } annotation */
private String getMethodName ( Method method ) { } } | StatName statNameAnnotation = method . getAnnotation ( StatName . class ) ; return statNameAnnotation != null ? statNameAnnotation . value ( ) : method . getName ( ) ; |
public class SimpleNaviRpcClient { /** * 通过反射出来的本地方法以及参数构造 < tt > RequestDTO < / tt >
* @ param methodName
* @ param args
* @ param prarameterTypes
* @ return RequestDTO */
private RequestDTO makeRequestDTO ( String methodName , Object [ ] args , Class < ? > [ ] prarameterTypes ) { } } | RequestDTO request = new RequestDTO ( ) ; request . setTraceId ( IdGenerator . genUUID ( ) ) ; request . setMethod ( methodName ) ; request . setParamterTypes ( MethodUtil . getArgsTypeNameArray ( prarameterTypes ) ) ; request . setParameters ( args ) ; return request ; |
public class JettyBootstrap { /** * Shortcut to start Jetty when called within a JAR file containing the WEB - INF folder and needed libraries .
* Basically uses { @ link # addSelf ( ) } and { @ link # startServer ( ) }
* @ return a new instance of { @ link JettyBootstrap }
* @ throws JettyBootstrapException
* if an error occurs during the startup */
public static JettyBootstrap startSelf ( ) throws JettyBootstrapException { } } | final JettyBootstrap jettyBootstrap = new JettyBootstrap ( ) ; jettyBootstrap . addSelf ( ) ; return jettyBootstrap . startServer ( ) ; |
public class IOUtils { /** * < p > readFileBufferedAsString . < / p >
* @ param file a { @ link java . io . File } object .
* @ param charset a { @ link java . lang . String } object .
* @ return a { @ link java . lang . String } object .
* @ throws java . io . IOException if any . */
public static String readFileBufferedAsString ( final File file , final String charset ) throws IOException { } } | return readInputStreamBufferedAsString ( new FileInputStream ( file ) , charset ) ; |
public class ITFReader { /** * Skip all whitespace until we get to the first black line .
* @ param row row of black / white values to search
* @ return index of the first black line .
* @ throws NotFoundException Throws exception if no black lines are found in the row */
private static int skipWhiteSpace ( BitArray row ) throws NotFoundException { } } | int width = row . getSize ( ) ; int endStart = row . getNextSet ( 0 ) ; if ( endStart == width ) { throw NotFoundException . getNotFoundInstance ( ) ; } return endStart ; |
public class PySrcMain { /** * Generates Python source files given a Soy parse tree , an options object , and information on
* where to put the output files .
* @ param soyTree The Soy parse tree to generate Python source code for .
* @ param pySrcOptions The compilation options relevant to this backend .
* @ param outputPathFormat The format string defining how to build the output file path
* corresponding to an input file path .
* @ param errorReporter The Soy error reporter that collects errors during code generation .
* @ throws IOException If there is an error in opening / writing an output Python file . */
public void genPyFiles ( SoyFileSetNode soyTree , SoyPySrcOptions pySrcOptions , String outputPathFormat , ErrorReporter errorReporter ) throws IOException { } } | ImmutableList < SoyFileNode > srcsToCompile = ImmutableList . copyOf ( soyTree . getChildren ( ) ) ; // Determine the output paths .
List < String > soyNamespaces = getSoyNamespaces ( soyTree ) ; Multimap < String , Integer > outputs = MainEntryPointUtils . mapOutputsToSrcs ( null , outputPathFormat , srcsToCompile ) ; // Generate the manifest and add it to the current manifest .
ImmutableMap < String , String > manifest = generateManifest ( soyNamespaces , outputs ) ; // Generate the Python source .
List < String > pyFileContents = genPySrc ( soyTree , pySrcOptions , manifest , errorReporter ) ; if ( srcsToCompile . size ( ) != pyFileContents . size ( ) ) { throw new AssertionError ( String . format ( "Expected to generate %d code chunk(s), got %d" , srcsToCompile . size ( ) , pyFileContents . size ( ) ) ) ; } // Write out the Python outputs .
for ( String outputFilePath : outputs . keySet ( ) ) { try ( Writer out = Files . newWriter ( new File ( outputFilePath ) , StandardCharsets . UTF_8 ) ) { for ( int inputFileIndex : outputs . get ( outputFilePath ) ) { out . write ( pyFileContents . get ( inputFileIndex ) ) ; } } } // Write out the manifest file .
if ( pySrcOptions . namespaceManifestFile ( ) != null ) { try ( Writer out = Files . newWriter ( new File ( pySrcOptions . namespaceManifestFile ( ) ) , StandardCharsets . UTF_8 ) ) { Properties prop = new Properties ( ) ; for ( String namespace : manifest . keySet ( ) ) { prop . put ( namespace , manifest . get ( namespace ) ) ; } prop . store ( out , null ) ; } } |
public class DefaultVOMSACService { /** * Extracts an AC from a VOMS response
* @ param request
* the request
* @ param response
* the received response
* @ return a possibly < code > null < / code > { @ link AttributeCertificate } object */
protected AttributeCertificate getACFromResponse ( VOMSACRequest request , VOMSResponse response ) { } } | byte [ ] acBytes = response . getAC ( ) ; if ( acBytes == null ) return null ; ASN1InputStream asn1InputStream = new ASN1InputStream ( acBytes ) ; AttributeCertificate attributeCertificate = null ; try { attributeCertificate = AttributeCertificate . getInstance ( asn1InputStream . readObject ( ) ) ; asn1InputStream . close ( ) ; return attributeCertificate ; } catch ( Throwable e ) { requestListener . notifyVOMSRequestFailure ( request , null , new VOMSError ( "Error unmarshalling VOMS AC. Cause: " + e . getMessage ( ) , e ) ) ; return null ; } |
public class ReplaceStrings { /** * From a provide name extract the method name . */
private static String getMethodFromDeclarationName ( String fullDeclarationName ) { } } | String [ ] parts = fullDeclarationName . split ( "\\.prototype\\." ) ; checkState ( parts . length == 1 || parts . length == 2 ) ; if ( parts . length == 2 ) { return parts [ 1 ] ; } return null ; |
public class Messenger { /** * Toggle muting of call
* @ param callId Call Id */
@ ObjectiveCName ( "toggleCallMuteWithCallId:" ) public void toggleCallMute ( long callId ) { } } | if ( modules . getCallsModule ( ) . getCall ( callId ) . getIsAudioEnabled ( ) . get ( ) ) { modules . getCallsModule ( ) . muteCall ( callId ) ; } else { modules . getCallsModule ( ) . unmuteCall ( callId ) ; } |
public class BaseDuration { /** * Converts this duration to a Period instance using the specified period type
* and chronology .
* Only precise fields in the period type will be used .
* Exactly which fields are precise depends on the chronology .
* Only the time fields are precise for ISO chronology with a time zone .
* However , ISO UTC also has precise days and weeks .
* For more control over the conversion process , you must pair the duration with
* an instant , see { @ link # toPeriodFrom ( ReadableInstant , PeriodType ) } and
* { @ link # toPeriodTo ( ReadableInstant , PeriodType ) }
* @ param type the period type to use , null means standard
* @ param chrono the chronology to use , null means ISO default
* @ return a Period created using the millisecond duration from this instance */
public Period toPeriod ( PeriodType type , Chronology chrono ) { } } | return new Period ( getMillis ( ) , type , chrono ) ; |
public class ParserBase { /** * Locate and process license agreement and information files within a jar
* @ param esa
* @ param resource
* @ throws IOException */
protected void processLAandLI ( File archive , RepositoryResourceWritable resource , Manifest manifest ) throws RepositoryException , IOException { } } | Attributes attribs = manifest . getMainAttributes ( ) ; String LAHeader = attribs . getValue ( LA_HEADER_PRODUCT ) ; String LIHeader = attribs . getValue ( LI_HEADER_PRODUCT ) ; processLAandLI ( archive , resource , LAHeader , LIHeader ) ; |
public class Parser { /** * Removes the option or its group from the list of expected elements .
* @ param opt */
private void updateRequiredOptions ( Option opt ) throws ParseException { } } | // if the option is a required option remove the option from
// the requiredOptions list
if ( opt . isRequired ( ) ) { getRequiredOptions ( ) . remove ( opt . getKey ( ) ) ; } // if the option is in an OptionGroup make that option the selected
// option of the group
if ( getOptions ( ) . getOptionGroup ( opt ) != null ) { OptionGroup group = getOptions ( ) . getOptionGroup ( opt ) ; if ( group . isRequired ( ) ) { getRequiredOptions ( ) . remove ( group ) ; } group . setSelected ( opt ) ; } |
public class DBCluster { /** * Identifies all custom endpoints associated with the cluster .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setCustomEndpoints ( java . util . Collection ) } or { @ link # withCustomEndpoints ( java . util . Collection ) } if you
* want to override the existing values .
* @ param customEndpoints
* Identifies all custom endpoints associated with the cluster .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DBCluster withCustomEndpoints ( String ... customEndpoints ) { } } | if ( this . customEndpoints == null ) { setCustomEndpoints ( new com . amazonaws . internal . SdkInternalList < String > ( customEndpoints . length ) ) ; } for ( String ele : customEndpoints ) { this . customEndpoints . add ( ele ) ; } return this ; |
public class ManagedDatabasesInner { /** * Gets a managed database .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param managedInstanceName The name of the managed instance .
* @ param databaseName The name of the database .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ManagedDatabaseInner object */
public Observable < ManagedDatabaseInner > getAsync ( String resourceGroupName , String managedInstanceName , String databaseName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , managedInstanceName , databaseName ) . map ( new Func1 < ServiceResponse < ManagedDatabaseInner > , ManagedDatabaseInner > ( ) { @ Override public ManagedDatabaseInner call ( ServiceResponse < ManagedDatabaseInner > response ) { return response . body ( ) ; } } ) ; |
public class SessionProvider { /** * Gives a { @ link SessionProvider } for a given list of { @ link AccessControlEntry } .
* @ param accessList list of { @ link AccessControlEntry }
* @ return a { @ link SessionProvider } allowing to provide sessions with the
* corresponding ACL . */
public static SessionProvider createProvider ( List < AccessControlEntry > accessList ) { } } | if ( accessList == null || accessList . isEmpty ( ) ) { return createAnonimProvider ( ) ; } else { HashSet < MembershipEntry > membershipEntries = new HashSet < MembershipEntry > ( ) ; for ( AccessControlEntry ace : accessList ) { membershipEntries . add ( ace . getMembershipEntry ( ) ) ; } return new SessionProvider ( membershipEntries ) ; } |
public class EditorGridPanel { /** * Use only after click / doubleClicked in that row or the editor is already opened
* @ return active editor */
public TextField getActiveEditor ( ) { } } | TextField editor ; WebLocator container = new WebLocator ( "x-editor" , this ) ; WebLocator editableEl = new WebLocator ( container ) . setElPath ( "//*[contains(@class, '-focus')]" ) ; String stringClass = editableEl . getAttributeClass ( ) ; LOGGER . debug ( "active editor stringClass: " + stringClass ) ; if ( stringClass == null ) { LOGGER . warn ( "active editor stringClass is null: " + editableEl ) ; // TODO investigate this problem
stringClass = "" ; } if ( stringClass . contains ( "x-form-field-trigger-wrap" ) ) { // TODO when is DateField
LOGGER . debug ( "active editor is ComboBox" ) ; editor = new ComboBox ( ) ; editor . setInfoMessage ( "active combo editor" ) ; } else if ( stringClass . contains ( "x-form-textarea" ) ) { LOGGER . debug ( "active editor is TextArea" ) ; editor = new TextArea ( ) ; } else { LOGGER . debug ( "active editor is TextField" ) ; editor = new TextField ( ) ; } editor . setContainer ( this ) . setClasses ( "x-form-focus" ) . setRenderMillis ( 1000 ) . setInfoMessage ( "active editor" ) ; return editor ; |
public class MariaDbBlob { /** * Retrieves the byte position in the < code > BLOB < / code > value designated by this < code > Blob < / code >
* object at which
* < code > pattern < / code > begins . The search begins at position < code > start < / code > .
* @ param pattern the < code > Blob < / code > object designating the < code > BLOB < / code > value for which
* to search
* @ param start the position in the < code > BLOB < / code > value at which to begin searching ; the
* first position is 1
* @ return the position at which the pattern begins , else - 1 */
public long position ( final Blob pattern , final long start ) throws SQLException { } } | return position ( pattern . getBytes ( 1 , ( int ) pattern . length ( ) ) , start ) ; |
public class UpdatePresetRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdatePresetRequest updatePresetRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updatePresetRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updatePresetRequest . getCategory ( ) , CATEGORY_BINDING ) ; protocolMarshaller . marshall ( updatePresetRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( updatePresetRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( updatePresetRequest . getSettings ( ) , SETTINGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CPDefinitionOptionValueRelLocalServiceUtil { /** * Deletes the cp definition option value rel with the primary key from the database . Also notifies the appropriate model listeners .
* @ param CPDefinitionOptionValueRelId the primary key of the cp definition option value rel
* @ return the cp definition option value rel that was removed
* @ throws PortalException if a cp definition option value rel with the primary key could not be found */
public static com . liferay . commerce . product . model . CPDefinitionOptionValueRel deleteCPDefinitionOptionValueRel ( long CPDefinitionOptionValueRelId ) throws com . liferay . portal . kernel . exception . PortalException { } } | return getService ( ) . deleteCPDefinitionOptionValueRel ( CPDefinitionOptionValueRelId ) ; |
public class OpenCmsCore { /** * Handles the user authentification for each request sent to OpenCms . < p >
* User authentification is done in three steps :
* < ol >
* < li > Session authentification : OpenCms stores information of all authentificated
* users in an internal storage based on the users session . < / li >
* < li > Authorization handler authentification : If the session authentification fails ,
* the current configured authorization handler is called . < / li >
* < li > Default user : When both authentification methods fail , the user is set to
* the default ( Guest ) user . < / li >
* < / ol >
* @ param req the current http request
* @ param res the current http response
* @ return the initialized cms context
* @ throws IOException if user authentication fails
* @ throws CmsException in case something goes wrong */
private CmsObject initCmsObject ( HttpServletRequest req , HttpServletResponse res ) throws IOException , CmsException { } } | return initCmsObject ( req , res , true ) ; |
public class WsLocationAdminImpl { /** * Construct the WsLocationAdminService singleton based on a set of initial
* properties provided by bootstrap or other initialization code ( e . g . an
* initializer in a test environment ) .
* @ param initProps
* @ return WsLocationAdmin */
public static WsLocationAdminImpl createLocations ( final Map < String , Object > initProps ) { } } | if ( instance . get ( ) == null ) { SymbolRegistry . getRegistry ( ) . clear ( ) ; Callable < WsLocationAdminImpl > initializer = new Callable < WsLocationAdminImpl > ( ) { @ Override public WsLocationAdminImpl call ( ) throws Exception { return new WsLocationAdminImpl ( initProps ) ; } } ; instance = StaticValue . mutateStaticValue ( instance , initializer ) ; } return instance . get ( ) ; |
public class SPathParser { /** * Actual SPath grammar */
final public Path expression ( ) throws ParseException { } } | Path expr ; if ( jj_2_1 ( 2147483647 ) ) { expr = absolutePath ( ) ; jj_consume_token ( 0 ) ; } else { switch ( ( jj_ntk == - 1 ) ? jj_ntk ( ) : jj_ntk ) { case QNAME : case NSWILDCARD : case SLASH : case STAR : expr = relativePath ( ) ; jj_consume_token ( 0 ) ; break ; default : jj_la1 [ 0 ] = jj_gen ; jj_consume_token ( - 1 ) ; throw new ParseException ( ) ; } } { if ( true ) return expr ; } throw new Error ( "Missing return statement in function" ) ; |
public class N { /** * Gets the median of three values .
* @ param a
* @ param b
* @ param c
* @ return the median of the values
* @ see # median ( int . . . ) */
public static < T extends Comparable < ? super T > > T median ( final T a , final T b , final T c ) { } } | return ( T ) median ( a , b , c , NATURAL_ORDER ) ; |
public class TypeUtility { /** * Convert a TypeMirror in a typeName .
* @ param typeMirror
* the type mirror
* @ return typeName */
public static TypeName typeName ( TypeMirror typeMirror ) { } } | LiteralType literalType = LiteralType . of ( typeMirror . toString ( ) ) ; if ( literalType . isArray ( ) ) { return ArrayTypeName . of ( typeName ( literalType . getRawType ( ) ) ) ; } else if ( literalType . isCollection ( ) ) { return ParameterizedTypeName . get ( TypeUtility . className ( literalType . getRawType ( ) ) , typeName ( literalType . getTypeParameter ( ) ) ) ; } TypeName [ ] values = { TypeName . BOOLEAN , TypeName . BYTE , TypeName . CHAR , TypeName . DOUBLE , TypeName . FLOAT , TypeName . INT , TypeName . LONG , TypeName . SHORT , TypeName . VOID } ; for ( TypeName item : values ) { if ( typeMirror . toString ( ) . equals ( item . toString ( ) ) ) { return item ; } } return TypeName . get ( typeMirror ) ; |
public class CassandraDataHandlerBase { /** * On discriminator column .
* @ param tr
* the tr
* @ param timestamp
* the timestamp
* @ param entityType
* the entity type */
private void onDiscriminatorColumn ( ThriftRow tr , long timestamp , EntityType entityType ) { } } | String discrColumn = ( ( AbstractManagedType ) entityType ) . getDiscriminatorColumn ( ) ; String discrValue = ( ( AbstractManagedType ) entityType ) . getDiscriminatorValue ( ) ; // No need to check for empty or blank , as considering it as valid name
// for nosql !
if ( discrColumn != null && discrValue != null ) { Column column = prepareColumn ( PropertyAccessorHelper . getBytes ( discrValue ) , PropertyAccessorHelper . getBytes ( discrColumn ) , timestamp , 0 ) ; tr . addColumn ( column ) ; } |
public class PayMchAPI { /** * 刷卡支付 授权码查询OPENID接口
* @ param authcodetoopenid authcodetoopenid
* @ param key key
* @ return AuthcodetoopenidResult */
public static AuthcodetoopenidResult toolsAuthcodetoopenid ( Authcodetoopenid authcodetoopenid , String key ) { } } | Map < String , String > map = MapUtil . objectToMap ( authcodetoopenid ) ; String sign = SignatureUtil . generateSign ( map , authcodetoopenid . getSign_type ( ) , key ) ; authcodetoopenid . setSign ( sign ) ; String shorturlXML = XMLConverUtil . convertToXML ( authcodetoopenid ) ; HttpUriRequest httpUriRequest = RequestBuilder . post ( ) . setHeader ( xmlHeader ) . setUri ( baseURI ( ) + "/tools/authcodetoopenid" ) . setEntity ( new StringEntity ( shorturlXML , Charset . forName ( "utf-8" ) ) ) . build ( ) ; return LocalHttpClient . executeXmlResult ( httpUriRequest , AuthcodetoopenidResult . class , authcodetoopenid . getSign_type ( ) , key ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.