signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ParserME { /** * Returns a parse for the specified parse of tokens .
* @ param tokens The root node of a flat parse containing only tokens .
* @ return A full parse of the specified tokens or the flat chunks of the tokens if a fullparse could not be found . */
public Parse parse ( Parse tokens ) { } } | Parse p = parse ( tokens , 1 ) [ 0 ] ; setParents ( p ) ; return p ; |
public class TimeBasedAvroWriterPartitioner { /** * Check if the partition column value is present and is a Long object . Otherwise , use current system time . */
private static long getRecordTimestamp ( Optional < Object > writerPartitionColumnValue ) { } } | return writerPartitionColumnValue . orNull ( ) instanceof Long ? ( Long ) writerPartitionColumnValue . get ( ) : System . currentTimeMillis ( ) ; |
public class FloatingLabelWidgetBase { /** * Inflate the widget layout and make sure we have everything in there
* @ param context The context
* @ param layoutId The id of the layout to inflate */
private void inflateWidgetLayout ( Context context , int layoutId ) { } } | inflate ( context , layoutId , this ) ; floatingLabel = ( TextView ) findViewById ( R . id . flw_floating_label ) ; if ( floatingLabel == null ) { throw new RuntimeException ( "Your layout must have a TextView whose ID is @id/flw_floating_label" ) ; } View iw = findViewById ( R . id . flw_input_widget ) ; if ( iw == nu... |
public class JPnlPropertyEditorDBMetaCatalog { /** * GEN - END : initComponents */
public void setEditorTarget ( PropertyEditorTarget target ) { } } | if ( target instanceof DBMetaCatalogNode ) { super . setEditorTarget ( target ) ; this . tfCatalogName . setText ( ( String ) target . getAttribute ( DBMetaCatalogNode . ATT_CATALOG_NAME ) ) ; } else { throw new UnsupportedOperationException ( "This editor can only edit DBMetaCatalogNode objects" ) ; } |
public class PolicyEventsInner { /** * Queries policy events for the subscription level policy set definition .
* @ param subscriptionId Microsoft Azure subscription ID .
* @ param policySetDefinitionName Policy set definition name .
* @ param serviceCallback the async ServiceCallback to handle successful and fai... | return ServiceFuture . fromResponse ( listQueryResultsForPolicySetDefinitionWithServiceResponseAsync ( subscriptionId , policySetDefinitionName ) , serviceCallback ) ; |
public class AWSServiceCatalogClient { /** * Gets information about the resource changes for the specified plan .
* @ param describeProvisionedProductPlanRequest
* @ return Result of the DescribeProvisionedProductPlan operation returned by the service .
* @ throws ResourceNotFoundException
* The specified resou... | request = beforeClientExecution ( request ) ; return executeDescribeProvisionedProductPlan ( request ) ; |
public class IotVizClient { /** * Create a token
* @ param ttl - token ' s time to live , in seconds
* @ return a string token */
public String createToken ( int ttl ) { } } | checkArgument ( ttl > 0 ) ; CreateTokenRequest request = new CreateTokenRequest ( ) ; request . setTtl ( ttl ) ; InternalRequest internalRequest = createRequest ( request , HttpMethodName . POST , null , TOKEN ) ; CreateTokenResponse response = this . invokeHttpClient ( internalRequest , CreateTokenResponse . class ) ;... |
public class MethodAnnotation { /** * Get the " full " method name . This is a format which looks sort of like a
* method signature that would appear in Java source code .
* note : If shortenPackeges = = true , this will return the same value as
* getNameInClass ( ) , except that method caches the result and this... | // Convert to " nice " representation
StringBuilder result = new StringBuilder ( ) ; if ( ! omitMethodName ) { if ( useJVMMethodName ) { result . append ( getMethodName ( ) ) ; } else { result . append ( getJavaSourceMethodName ( ) ) ; } } result . append ( '(' ) ; // append args
SignatureConverter converter = new Sign... |
public class TargetsApi { /** * Get personal favorites
* Get the agent & # 39 ; s personal favorites .
* @ param limit Number of results to return . The default value is 50 . ( optional )
* @ return TargetsResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the ... | ApiResponse < TargetsResponse > resp = getPersonalFavoritesWithHttpInfo ( limit ) ; return resp . getData ( ) ; |
public class ScheduleManager { /** * Schedules the flow , but doesn ' t save the schedule afterwards . */
private synchronized void internalSchedule ( final Schedule s ) { } } | this . scheduleIDMap . put ( s . getScheduleId ( ) , s ) ; this . scheduleIdentityPairMap . put ( s . getScheduleIdentityPair ( ) , s ) ; |
public class BranchNode { /** * Returns true if one of the tree nodes has outer join */
@ Override public boolean hasOuterJoin ( ) { } } | assert ( m_leftNode != null && m_rightNode != null ) ; return m_joinType != JoinType . INNER || m_leftNode . hasOuterJoin ( ) || m_rightNode . hasOuterJoin ( ) ; |
public class MapServiceContextImpl { /** * { @ inheritDoc }
* The method will set the owned partition set in a CAS loop because
* this method can be called concurrently . */
@ Override public void reloadOwnedPartitions ( ) { } } | final IPartitionService partitionService = nodeEngine . getPartitionService ( ) ; for ( ; ; ) { final PartitionIdSet expected = ownedPartitions . get ( ) ; final Collection < Integer > partitions = partitionService . getMemberPartitions ( nodeEngine . getThisAddress ( ) ) ; final PartitionIdSet newSet = immutablePartit... |
public class ProcCode { /** * Parse bb - code
* Before invocation suspicious method must be call
* @ param context the bb - processing context
* @ return true - if parse source
* false - if can ' t parse code
* @ throws NestingException if nesting is too big . */
public boolean process ( Context context ) thr... | for ( ProcPattern pattern : patterns ) { Context codeContext = new Context ( context ) ; if ( pattern . parse ( codeContext ) ) { if ( transparent ) { codeContext . mergeWithParent ( ) ; } template . generate ( codeContext ) ; if ( logContext . isTraceEnabled ( ) ) { for ( Map . Entry < String , CharSequence > entry : ... |
public class SnapshotNode { /** * Shutdown snapshot node and attached daemons */
public void shutdown ( ) { } } | if ( purgeThread != null ) { WaitingRoomPurger purger = ( WaitingRoomPurger ) purgeThread . getRunnable ( ) ; purger . shutdown ( ) ; } RPC . stopProxy ( namenode ) ; if ( server != null ) server . stop ( ) ; |
public class CharacterParser { public Match parseMax ( String src ) throws SyntaxError { } } | Options options = new Options ( ) ; return this . parseMax ( src , options ) ; |
public class PropertiesUtils { /** * Load a file from an directory .
* @ param baseUrl
* Directory URL - Cannot be < code > null < / code > .
* @ param filename
* Filename without path - Cannot be < code > null < / code > .
* @ return Properties . */
public static Properties loadProperties ( final URL baseUrl... | return loadProperties ( createUrl ( baseUrl , "" , filename ) ) ; |
public class ServiceDirectory { /** * Set the Directory User .
* @ param userName
* the user name .
* @ param password
* the password of the user .
* @ throws ServiceException */
public static void setUser ( String userName , String password ) { } } | getImpl ( ) . getDirectoryServiceClient ( ) . setUser ( userName , password ) ; |
public class Keys { private static int [ ] makeFields ( int [ ] fields , TupleTypeInfo < ? > type ) { } } | int inLength = type . getArity ( ) ; // null parameter means all fields are considered
if ( fields == null || fields . length == 0 ) { fields = new int [ inLength ] ; for ( int i = 0 ; i < inLength ; i ++ ) { fields [ i ] = i ; } return fields ; } else { return rangeCheckAndOrderFields ( fields , inLength - 1 ) ; } |
public class CloseInstancePublicPortsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CloseInstancePublicPortsRequest closeInstancePublicPortsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( closeInstancePublicPortsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( closeInstancePublicPortsRequest . getPortInfo ( ) , PORTINFO_BINDING ) ; protocolMarshaller . marshall ( closeInstancePublicPortsRequest . getInstanceNam... |
public class FieldMetadata { /** * Returns a Function which gets the ` isLegacyId ` setting from a FieldMetadata , if present ,
* or { @ link Optional # absent ( ) } if not , ish .
* The semantics would ideally want are :
* < pre >
* 1 @ ThriftField ( id = X , isLegacyId = false ) = > Optional . of ( false )
... | return new Function < T , Optional < Boolean > > ( ) { @ Override public Optional < Boolean > apply ( @ Nullable T input ) { if ( input == null ) { return Optional . absent ( ) ; } Boolean value = input . isLegacyId ( ) ; if ( input . getId ( ) == null || input . getId ( ) . shortValue ( ) == Short . MIN_VALUE ) { if (... |
public class AlternateOf { /** * Gets the value of the alternate2 property .
* @ return
* possible object is
* { @ link org . openprovenance . prov . sql . IDRef } */
@ ManyToOne ( targetEntity = org . openprovenance . prov . sql . QualifiedName . class , cascade = { } } | CascadeType . ALL } ) @ JoinColumn ( name = "ALTERNATE2" ) public org . openprovenance . prov . model . QualifiedName getAlternate2 ( ) { return alternate2 ; |
public class LineSignatureValidator { /** * Generate signature value .
* @ param content Body of the http request .
* @ return generated signature value . */
public byte [ ] generateSignature ( @ NonNull byte [ ] content ) { } } | try { Mac mac = Mac . getInstance ( HASH_ALGORITHM ) ; mac . init ( secretKeySpec ) ; return mac . doFinal ( content ) ; } catch ( NoSuchAlgorithmException | InvalidKeyException e ) { // " HmacSHA256 " is always supported in Java 8 platform .
// ( see https : / / docs . oracle . com / javase / 8 / docs / api / javax / ... |
public class ResourceCompliantRRPacking { /** * Attempts to place the instance the current containerId .
* @ param planBuilder packing plan builder
* @ param componentName the component name of the instance that needs to be placed in the container
* @ throws ResourceExceededException if there is no room on the cu... | planBuilder . addInstance ( this . containerId , componentName ) ; this . containerId = nextContainerId ( this . containerId ) ; |
public class TaskManagerService { /** * See if the given in - progress task may be hung or abandoned . */
private void checkForDeadTask ( Tenant tenant , TaskRecord taskRecord ) { } } | Calendar lastReport = taskRecord . getTime ( TaskRecord . PROP_PROGRESS_TIME ) ; if ( lastReport == null ) { lastReport = taskRecord . getTime ( TaskRecord . PROP_START_TIME ) ; if ( lastReport == null ) { return ; // corrupt / incomplete task record
} } long minsSinceLastActivity = ( System . currentTimeMillis ( ) - l... |
public class Strings { /** * joins a collection of objects together as a String using a separator */
public static String join ( final Collection < ? > collection , final String separator ) { } } | StringBuffer buffer = new StringBuffer ( ) ; boolean first = true ; Iterator < ? > iter = collection . iterator ( ) ; while ( iter . hasNext ( ) ) { Object next = iter . next ( ) ; if ( first ) { first = false ; } else { buffer . append ( separator ) ; } buffer . append ( next ) ; } return buffer . toString ( ) ; |
public class BaseLayoutHelper { /** * Helper function which do layout children and also update layoutRegion
* but it won ' t consider margin in layout , so you need take care of margin if you apply margin to your layoutView
* @ param child child that will be laid
* @ param left left position
* @ param top top p... | layoutChildWithMargin ( child , left , top , right , bottom , helper , false ) ; |
public class XBlockExpressionImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case XbasePackage . XBLOCK_EXPRESSION__EXPRESSIONS : getExpressions ( ) . clear ( ) ; getExpressions ( ) . addAll ( ( Collection < ? extends XExpression > ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class GosuParser { /** * < i > array - value - list < / i >
* & lt ; expression & gt ;
* & lt ; array - value - list & gt ; , & lt ; expression & gt ; */
List < Expression > parseArrayValueList ( IType componentType ) { } } | while ( componentType instanceof TypeVariableType ) { componentType = ( ( TypeVariableType ) componentType ) . getBoundingType ( ) ; } List < Expression > valueExpressions = new ArrayList < > ( ) ; do { parseExpression ( new ContextType ( componentType ) ) ; Expression e = popExpression ( ) ; valueExpressions . add ( e... |
public class ByteToCharBase { /** * Sets the encoding for the converter . */
public void setEncoding ( String encoding ) throws UnsupportedEncodingException { } } | if ( encoding != null ) { _readEncoding = Encoding . getReadEncoding ( this , encoding ) ; _readEncodingName = Encoding . getMimeName ( encoding ) ; } else { _readEncoding = null ; _readEncodingName = null ; } |
public class AvatarShell { /** * run */
public int run ( String argv [ ] ) throws Exception { } } | if ( argv . length < 1 ) { printUsage ( ) ; return - 1 ; } AvatarShellCommand cmd = AvatarShellCommand . parseCommand ( argv ) ; if ( cmd == null ) { printUsage ( ) ; return - 1 ; } int exitCode = 0 ; if ( conf . get ( FSConstants . DFS_FEDERATION_NAMESERVICES ) != null && ( ! cmd . isServiceCommand ) && ( ! cmd . isAd... |
public class FtpFileUtil { /** * Upload a given file to FTP server .
* @ param hostName the FTP server host name to connect
* @ param port the port to connect
* @ param userName the user name
* @ param password the password
* @ param localFileFullName the full name ( inclusive path ) of the local file .
* @... | String result = null ; FTPClient ftpClient = new FTPClient ( ) ; String errorMessage = "Unable to upload file '%s' for FTP server '%s'." ; InputStream inputStream = null ; try { connectAndLoginOnFTPServer ( ftpClient , hostName , port , userName , password ) ; ftpClient . setFileType ( FTP . BINARY_FILE_TYPE ) ; ftpCli... |
public class ServerLogImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < LogAction > getActions ( ) { } } | return ( EList < LogAction > ) eGet ( LogPackage . Literals . SERVER_LOG__ACTIONS , true ) ; |
public class PathUtils { /** * Use { @ link java . nio . file . Path # relativize ( java . nio . file . Path ) } in JDK1.7.
* @ param baseDir
* @ param file
* @ return */
public static String getRelativePath ( File baseDir , File file ) { } } | if ( ! baseDir . isDirectory ( ) ) { throw new IllegalArgumentException ( "Base directory must be a directory." ) ; } String dirPath = FilenameUtils . normalize ( baseDir . getAbsolutePath ( ) , true ) ; String filePath = FilenameUtils . normalize ( file . getAbsolutePath ( ) , true ) ; if ( ! dirPath . endsWith ( "/" ... |
public class PeriodFormatterBuilder { /** * Constructs a PeriodFormatter using all the appended elements .
* This is the main method used by applications at the end of the build
* process to create a usable formatter .
* Once this method has been called , the builder is in an invalid state .
* The returned form... | PeriodFormatter formatter = toFormatter ( iElementPairs , iNotPrinter , iNotParser ) ; for ( FieldFormatter fieldFormatter : iFieldFormatters ) { if ( fieldFormatter != null ) { fieldFormatter . finish ( iFieldFormatters ) ; } } iFieldFormatters = ( FieldFormatter [ ] ) iFieldFormatters . clone ( ) ; return formatter ; |
public class LogHelper { /** * Generically log something
* @ param aLoggingClass
* Logging class to use . May not be < code > null < / code > .
* @ param aErrorLevelProvider
* Error level provided to use . May not be < code > null < / code > .
* @ param aMsgSupplier
* Message supplier to use . The supplier ... | log ( LoggerFactory . getLogger ( aLoggingClass ) , aErrorLevelProvider . getErrorLevel ( ) , aMsgSupplier , t ) ; |
public class Options { /** * Convert a comma separated list of extension names to an int . Each name is
* converted to upper case , any ' - ' is replaced by ' _ ' . The result is expected to
* be a flag from { @ link Extensions } .
* @ param extensions A comma separated list of PegDown extensions .
* @ return A... | int result = 0 ; for ( String ext : Splitter . on ( ',' ) . trimResults ( ) . omitEmptyStrings ( ) . split ( extensions ) ) { try { Field f = Extensions . class . getField ( ext . replace ( '-' , '_' ) . toUpperCase ( ) ) ; result |= ( int ) f . get ( null ) ; } catch ( NoSuchFieldException e ) { throw new IllegalArgum... |
public class ValidationResult { /** * Adds an error .
* @ param desc Error description
* @ param loc Error Location
* @ param value the integer value that caused the error */
public void addError ( String desc , String loc , long value ) { } } | iaddError ( desc , "" + value , loc ) ; |
public class MessageDecryption { /** * 随机生成16位字符串 */
private String getRandomStr ( ) { } } | String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" ; Random random = new Random ( ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < 16 ; i ++ ) { int number = random . nextInt ( base . length ( ) ) ; sb . append ( base . charAt ( number ) ) ; } return sb . toString ( ) ; |
public class Unpooled { /** * Creates a new 4 - byte big - endian buffer that holds the specified 32 - bit floating point number . */
public static ByteBuf copyFloat ( float value ) { } } | ByteBuf buf = buffer ( 4 ) ; buf . writeFloat ( value ) ; return buf ; |
public class PmiModuleConfig { /** * Returns the data ID for a Statistic name in this module ( Stats ) */
public int getDataId ( String name ) { } } | Iterator allData = perfData . values ( ) . iterator ( ) ; while ( allData . hasNext ( ) ) { PmiDataInfo dataInfo = ( PmiDataInfo ) allData . next ( ) ; if ( dataInfo . getName ( ) . equalsIgnoreCase ( name ) ) return dataInfo . getId ( ) ; } return UNKNOWN_ID ; |
public class Dater { /** * Analyst date time string
* @ param date
* @ return */
private static String analyst ( String date ) { } } | String style = null ; boolean hasDiagonal = false ; Replacer r = Replacer . of ( checkNotNull ( date ) ) ; if ( hasDiagonal = r . contain ( "/" ) ) { r . update ( r . lookups ( "/" ) . with ( "-" ) ) ; } // ISO
if ( r . containAll ( "." , "T" ) ) { style = DateStyle . ISO_FORMAT ; } // CST
else if ( r . contain ( "CST"... |
public class AbstractNegatedTokenImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public NotificationChain eInverseRemove ( InternalEObject otherEnd , int featureID , NotificationChain msgs ) { } } | switch ( featureID ) { case XtextPackage . ABSTRACT_NEGATED_TOKEN__TERMINAL : return basicSetTerminal ( null , msgs ) ; } return super . eInverseRemove ( otherEnd , featureID , msgs ) ; |
public class CmsWebdavServlet { /** * Handle a partial PUT . < p >
* New content specified in request is appended to
* existing content in oldRevisionContent ( if present ) . This code does
* not support simultaneous partial updates to the same resource . < p >
* @ param req the servlet request we are processin... | // Append data specified in ranges to existing content for this
// resource - create a temp . file on the local filesystem to
// perform this operation
File tempDir = ( File ) getServletContext ( ) . getAttribute ( ATT_SERVLET_TEMPDIR ) ; // Convert all ' / ' characters to ' . ' in resourcePath
String convertedResource... |
public class DTDEnumAttr { /** * Method called by the validator
* to let the attribute do necessary normalization and / or validation
* for the value . */
@ Override public String validate ( DTDValidatorBase v , char [ ] cbuf , int start , int end , boolean normalize ) throws XMLStreamException { } } | String ok = validateEnumValue ( cbuf , start , end , normalize , mEnumValues ) ; if ( ok == null ) { String val = new String ( cbuf , start , ( end - start ) ) ; return reportValidationProblem ( v , "Invalid enumerated value '" + val + "': has to be one of (" + mEnumValues + ")" ) ; } return ok ; |
public class Choice5 { /** * { @ inheritDoc } */
@ Override public < F > Choice5 < A , B , C , D , F > zip ( Applicative < Function < ? super E , ? extends F > , Choice5 < A , B , C , D , ? > > appFn ) { } } | return Monad . super . zip ( appFn ) . coerce ( ) ; |
public class ZipChemCompProvider { /** * Use DownloadChemCompProvider to grab a gzipped cif record from the PDB .
* Zip all downloaded cif . gz files into the dictionary .
* @ param recordName is the three - letter chemical component code ( i . e . residue name ) .
* @ return ChemComp matching recordName */
priva... | final ChemComp cc = m_dlProvider . getChemComp ( recordName ) ; // final File [ ] files = finder ( m _ tempDir . resolve ( " chemcomp " ) . toString ( ) , " cif . gz " ) ;
final File [ ] files = new File [ 1 ] ; Path cif = m_tempDir . resolve ( "chemcomp" ) . resolve ( recordName + ".cif.gz" ) ; files [ 0 ] = cif . toF... |
public class ApiOvhTelephony { /** * Ask to cancel the portability
* REST : POST / telephony / { billingAccount } / portability / { id } / cancel
* @ param reason [ required ] The cancellation reason
* @ param billingAccount [ required ] The name of your billingAccount
* @ param id [ required ] The ID of the po... | String qPath = "/telephony/{billingAccount}/portability/{id}/cancel" ; StringBuilder sb = path ( qPath , billingAccount , id ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "reason" , reason ) ; exec ( qPath , "POST" , sb . toString ( ) , o ) ; |
public class VendorExtensionImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public NotificationChain eInverseRemove ( InternalEObject otherEnd , int featureID , NotificationChain msgs ) { } } | switch ( featureID ) { case BpsimPackage . VENDOR_EXTENSION__ANY : return ( ( InternalEList < ? > ) getAny ( ) ) . basicRemove ( otherEnd , msgs ) ; case BpsimPackage . VENDOR_EXTENSION__ANY_ATTRIBUTE : return ( ( InternalEList < ? > ) getAnyAttribute ( ) ) . basicRemove ( otherEnd , msgs ) ; } return super . eInverseR... |
public class GenericTableModel { /** * Update the row .
* @ param row
* the row */
public void update ( final T row ) { } } | final int index = data . indexOf ( row ) ; if ( index != - 1 ) { data . set ( index , row ) ; fireTableDataChanged ( ) ; } |
public class OAuth20Utils { /** * Gets attributes .
* @ param attributes the attributes
* @ param context the context
* @ return the attributes */
public static Map < String , Object > getRequestParameters ( final Collection < String > attributes , final HttpServletRequest context ) { } } | return attributes . stream ( ) . filter ( a -> StringUtils . isNotBlank ( context . getParameter ( a ) ) ) . map ( m -> { val values = context . getParameterValues ( m ) ; val valuesSet = new LinkedHashSet < Object > ( ) ; if ( values != null && values . length > 0 ) { Arrays . stream ( values ) . forEach ( v -> values... |
public class DescribeDBLogFilesResult { /** * The DB log files returned .
* @ param describeDBLogFiles
* The DB log files returned . */
public void setDescribeDBLogFiles ( java . util . Collection < DescribeDBLogFilesDetails > describeDBLogFiles ) { } } | if ( describeDBLogFiles == null ) { this . describeDBLogFiles = null ; return ; } this . describeDBLogFiles = new com . amazonaws . internal . SdkInternalList < DescribeDBLogFilesDetails > ( describeDBLogFiles ) ; |
public class JobResource { /** * The Amazon Machine Images ( AMIs ) associated with this job .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setEc2AmiResources ( java . util . Collection ) } or { @ link # withEc2AmiResources ( java . util . Collection ) } i... | if ( this . ec2AmiResources == null ) { setEc2AmiResources ( new java . util . ArrayList < Ec2AmiResource > ( ec2AmiResources . length ) ) ; } for ( Ec2AmiResource ele : ec2AmiResources ) { this . ec2AmiResources . add ( ele ) ; } return this ; |
public class FormValidations { /** * Validates an internet address ( url , email address , etc . ) .
* @ param address The address to validate
* @ return { @ link hudson . util . FormValidation . ok ( ) } if valid or empty , error otherwise */
public static FormValidation validateInternetAddress ( String address ) ... | if ( Strings . isNullOrEmpty ( address ) ) { return FormValidation . ok ( ) ; } Matcher matcher = VALID_EMAIL_PATTERN . matcher ( address ) ; if ( matcher . matches ( ) ) { return FormValidation . ok ( ) ; } else { return FormValidation . error ( "Email address is invalid" ) ; } |
public class TreeKernel { /** * 计算Tree Kernel
* @ param t1
* @ param t2
* @ param depth
* @ return */
private float getDepScore ( DependencyTree t1 , DependencyTree t2 , int depth ) { } } | float score = 0.0f ; float modify = getDepthModify ( depth ) ; if ( modify == 0 ) return score ; double sScore = getWordScore ( t1 , t2 ) ; if ( sScore != 0 ) score += modify * sScore ; else score += factor * modify * getTagScore ( t1 , t2 ) ; for ( int i = 0 ; i < t1 . leftChilds . size ( ) ; i ++ ) for ( int j = 0 ; ... |
public class DateConverter { /** * { @ inheritDoc } */
protected Object doConvert ( String value ) { } } | try { return format . parse ( value ) ; } catch ( ParseException ex ) { throw new IllegalArgumentException ( "Unsupported date format" , ex ) ; } |
public class ListAccountsResult { /** * A list of objects in the organization .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAccounts ( java . util . Collection ) } or { @ link # withAccounts ( java . util . Collection ) } if you want to override
* th... | if ( this . accounts == null ) { setAccounts ( new java . util . ArrayList < Account > ( accounts . length ) ) ; } for ( Account ele : accounts ) { this . accounts . add ( ele ) ; } return this ; |
public class FSNamesystem { /** * stores the modification and access time for this inode .
* The access time is precise upto an hour . The transaction , if needed , is
* written to the edits log but is not flushed . */
public void setTimes ( String src , long mtime , long atime ) throws IOException { } } | if ( ! accessTimeTouchable && atime != - 1 ) { throw new AccessTimeException ( "setTimes is not allowed for accessTime" ) ; } setTimesInternal ( src , mtime , atime ) ; getEditLog ( ) . logSync ( false ) ; |
public class HaltonUniformDistribution { /** * Compute the inverse with respect to the given base .
* @ param current Current value
* @ return Integer inverse */
private long inverse ( double current ) { } } | // Represent to base b .
short [ ] digits = new short [ maxi ] ; for ( int j = 0 ; j < maxi ; j ++ ) { current *= base ; digits [ j ] = ( short ) current ; current -= digits [ j ] ; if ( current <= 1e-10 ) { break ; } } long inv = 0 ; for ( int j = maxi - 1 ; j >= 0 ; j -- ) { inv = inv * base + digits [ j ] ; } return... |
public class JvmTypesBuilder { /** * / * @ Nullable */
public JvmGenericType toInterface ( /* @ Nullable */
EObject sourceElement , /* @ Nullable */
String name , /* @ Nullable */
Procedure1 < ? super JvmGenericType > initializer ) { } } | final JvmGenericType result = createJvmGenericType ( sourceElement , name ) ; if ( result == null ) return null ; result . setInterface ( true ) ; result . setAbstract ( true ) ; associate ( sourceElement , result ) ; return initializeSafely ( result , initializer ) ; |
public class MessageProcessorControl { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . runtime . SIMPMessageProcessorControllable # getRemoteSubscriptionIterator ( ) */
public SIMPIterator getRemoteSubscriptionIterator ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getRemoteSubscriptionIterator" ) ; DestinationTypeFilter filter = new DestinationTypeFilter ( ) ; filter . QUEUE = Boolean . FALSE ; Collection mpAIHCollection = new LinkedList ( ) ; for ( SIMPIterator iter = destinationInd... |
public class CmsImageAdvancedForm { /** * Displays the provided image information . < p >
* @ param imageInfo the image information
* @ param imageAttributes the image attributes
* @ param initialFill flag to indicate that a new image has been selected */
public void fillContent ( CmsImageInfoBean imageInfo , Cms... | for ( Entry < Attribute , I_CmsFormWidget > entry : m_fields . entrySet ( ) ) { String val = imageAttributes . getString ( entry . getKey ( ) . name ( ) ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( val ) ) { if ( ( entry . getKey ( ) == Attribute . linkPath ) && val . startsWith ( CmsCoreProvider . get ( ) . g... |
public class YPipe { /** * Check whether item is available for reading . */
@ Override public boolean checkRead ( ) { } } | // Was the value prefetched already ? If so , return .
int h = queue . frontPos ( ) ; if ( h != r ) { return true ; } // There ' s no prefetched value , so let us prefetch more values .
// Prefetching is to simply retrieve the
// pointer from c in atomic fashion . If there are no
// items to prefetch , set c to - 1 ( u... |
public class CmsResourceTreeContainer { /** * Gets the name to display for the given resource . < p >
* @ param cms the CMS context
* @ param resource a resource
* @ param parentId the id of the parent of the resource
* @ return the name for the given resoure */
protected String getName ( CmsObject cms , CmsRes... | return parentId == null ? resource . getRootPath ( ) : resource . getName ( ) ; |
public class PostBuilder { /** * Add existing Category term items when building a post . */
public PostBuilder withCategories ( Term ... terms ) { } } | return withCategories ( Arrays . stream ( terms ) . map ( Term :: getId ) . collect ( toList ( ) ) ) ; |
public class Math { /** * Returns the index of maximum value of an array . */
public static int whichMax ( int [ ] x ) { } } | int m = x [ 0 ] ; int which = 0 ; for ( int i = 1 ; i < x . length ; i ++ ) { if ( x [ i ] > m ) { m = x [ i ] ; which = i ; } } return which ; |
public class JenkinsServer { /** * Get a list of all the computers on the server ( at the summary level )
* @ return map of defined computers ( summary level , for details @ see
* Computer # details
* @ throws IOException in case of an error . */
public Map < String , Computer > getComputers ( ) throws IOExceptio... | List < Computer > computers = client . get ( "computer/" , Computer . class ) . getComputers ( ) ; return computers . stream ( ) . map ( SET_CLIENT ( this . client ) ) . collect ( Collectors . toMap ( s -> s . getDisplayName ( ) . toLowerCase ( ) , Function . identity ( ) ) ) ; |
public class Predicates { /** * Adds a clause that checks whether ANY set bits in a bitmask are present
* in a numeric expression .
* @ param expr
* SQL numeric expression to check .
* @ param bits
* Integer containing the bits for which to check . */
public static Predicate anyBitsSet ( final String expr , f... | return new Predicate ( ) { private String param ; public void init ( AbstractSqlCreator creator ) { param = creator . allocateParameter ( ) ; creator . setParameter ( param , bits ) ; } public String toSql ( ) { return String . format ( "(%s & :%s) > 0" , expr , param ) ; } } ; |
public class IOWritePool { /** * Write the given buffer . */
public void write ( ByteBuffer buffer ) throws IOException { } } | synchronized ( buffers ) { if ( writing == null ) { writing = io . writeAsync ( buffer ) ; writing . listenInline ( listener ) ; return ; } if ( writing . hasError ( ) ) throw writing . getError ( ) ; buffers . add ( buffer ) ; } |
public class CredentialUtils { /** * Returns the credentials provider that will be used to fetch the
* credentials when signing the request . Request specific credentials
* takes precedence over the credentials / credentials provider set in the
* client . */
public static AWSCredentialsProvider getCredentialsProv... | if ( req != null && req . getRequestCredentialsProvider ( ) != null ) { return req . getRequestCredentialsProvider ( ) ; } return base ; |
public class StackedTryBlocks { /** * overrides the visitor to document what catch blocks do with regard to rethrowing the exceptions , and if the message is a static message
* @ param seen
* the currently parsed opcode */
@ Override public void sawOpcode ( int seen ) { } } | String message = null ; try { stack . precomputation ( this ) ; if ( ( seen == Const . TABLESWITCH ) || ( seen == Const . LOOKUPSWITCH ) ) { int pc = getPC ( ) ; for ( int offset : getSwitchOffsets ( ) ) { transitionPoints . set ( pc + offset ) ; } transitionPoints . set ( pc + getDefaultSwitchOffset ( ) ) ; } else if ... |
public class NetworkInterfacesInner { /** * Gets all network interfaces in a virtual machine scale set .
* @ param resourceGroupName The name of the resource group .
* @ param virtualMachineScaleSetName The name of the virtual machine scale set .
* @ throws IllegalArgumentException thrown if parameters fail the v... | ServiceResponse < Page < NetworkInterfaceInner > > response = listVirtualMachineScaleSetNetworkInterfacesSinglePageAsync ( resourceGroupName , virtualMachineScaleSetName ) . toBlocking ( ) . single ( ) ; return new PagedList < NetworkInterfaceInner > ( response . body ( ) ) { @ Override public Page < NetworkInterfaceIn... |
public class SitelinkFeedItem { /** * Gets the sitelinkFinalMobileUrls value for this SitelinkFeedItem .
* @ return sitelinkFinalMobileUrls * A list of possible final mobile URLs after all cross domain
* redirects . */
public com . google . api . ads . adwords . axis . v201809 . cm . UrlList getSitelinkFinalMobileU... | return sitelinkFinalMobileUrls ; |
public class DeleteApplicationRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteApplicationRequest deleteApplicationRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteApplicationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteApplicationRequest . getApplicationId ( ) , APPLICATIONID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request... |
public class MapLens { /** * A lens that focuses on a map while mapping its values with the mapping { @ link Iso } .
* Note that for this lens to be lawful , < code > iso < / code > must be lawful .
* @ param iso the mapping { @ link Iso }
* @ param < K > the key type
* @ param < V > the unfocused map value typ... | return simpleLens ( m -> toMap ( HashMap :: new , map ( t -> t . biMapR ( view ( iso ) ) , map ( Tuple2 :: fromEntry , m . entrySet ( ) ) ) ) , ( s , b ) -> view ( mappingValues ( iso . mirror ( ) ) , b ) ) ; |
public class StaticFeatureSet { /** * Returns the registered instance of { @ code featureType } , or the value of
* { @ link FeatureType # testDefault } if no explicit instance was registered with this set . */
@ Override public < T extends Feature < T > > T get ( FeatureType < T > featureType ) { } } | @ SuppressWarnings ( "unchecked" ) T feature = ( T ) featuresByType . get ( featureType . type ( ) ) ; if ( feature != null ) { return feature ; } return featureType . testDefault ( this ) ; |
public class ObjectMapper { /** * Builds a SQL FROM clause from the tables / joins Hashtable */
private String buildFromClause ( ) { } } | StringBuilder sqlBuf = new StringBuilder ( ) ; sqlBuf . append ( "FROM " ) ; String table = null ; String schema = null ; for ( Enumeration from = mTables . keys ( ) ; from . hasMoreElements ( ) ; ) { table = ( String ) from . nextElement ( ) ; /* schema = ( String ) schemas . get ( table ) ;
if ( schema ! = null )
... |
public class Endpoint { /** * Converts this endpoint into the authority part of a URI .
* @ return the authority string */
public String authority ( ) { } } | String authority = this . authority ; if ( authority != null ) { return authority ; } if ( isGroup ( ) ) { authority = "group:" + groupName ; } else if ( port != 0 ) { if ( hostType == HostType . IPv6_ONLY ) { authority = '[' + host ( ) + "]:" + port ; } else { authority = host ( ) + ':' + port ; } } else if ( hostType... |
public class EventHandlers { /** * This method is called from Javascript , passing in the previously created
* callback key . It uses that to find the correct handler and then passes on
* the call . State events in the Google Maps API don ' t pass any parameters .
* @ param callbackKey Key generated by the call t... | if ( handlers . containsKey ( callbackKey ) && handlers . get ( callbackKey ) instanceof StateEventHandler ) { ( ( StateEventHandler ) handlers . get ( callbackKey ) ) . handle ( ) ; } else { System . err . println ( "Error in handle: " + callbackKey + " for state handler " ) ; } |
public class Env { /** * 添加本 Template 的 ISource , 以及该 Template 使用 include 包含进来的所有 ISource
* 以便于在 devMode 之下判断该 Template 是否被 modified , 进而 reload 该 Template */
public void addSource ( ISource source ) { } } | if ( sourceList == null ) { sourceList = new ArrayList < ISource > ( ) ; } sourceList . add ( source ) ; |
public class MuzeiArtSource { /** * Schedules an update for some time in the future . Any previously scheduled updates will be
* replaced . When the update time elapses , { @ link # onUpdate ( int ) } will be called with
* { @ link # UPDATE _ REASON _ SCHEDULED } .
* < p > Note that this is persisted across devic... | getSharedPreferences ( ) . edit ( ) . putLong ( PREF_SCHEDULED_UPDATE_TIME_MILLIS , scheduledUpdateTimeMillis ) . apply ( ) ; setUpdateAlarm ( scheduledUpdateTimeMillis ) ; |
public class DatePickerDialog { /** * Sets a list of days which are the only valid selections .
* Setting this value will take precedence over using setMinDate ( ) and setMaxDate ( )
* @ param selectableDays an Array of Calendar Objects containing the selectable dates */
@ SuppressWarnings ( "unused" ) public void ... | mDefaultLimiter . setSelectableDays ( selectableDays ) ; if ( mDayPickerView != null ) mDayPickerView . onChange ( ) ; |
public class JmxUtils { /** * Register the given mbean with the platform mbean server
* @ param mbean The mbean to register
* @ param name The name to register under */
public static void registerMbean ( Object mbean , ObjectName name ) { } } | registerMbean ( ManagementFactory . getPlatformMBeanServer ( ) , JmxUtils . createModelMBean ( mbean ) , name ) ; |
public class MwsUtl { /** * Create a new instance of a class , wrap exceptions .
* @ param cls
* @ return The new instance . */
static < T > T newInstance ( Class < T > cls ) { } } | try { return cls . newInstance ( ) ; } catch ( Exception e ) { throw wrap ( e ) ; } |
public class SQLUtils { /** * 往where sql里面插入AND关系的表达式 。
* 例如 : whereSql为 where a ! = 3 or a ! = 2 limit 1
* condExpress为 deleted = 0
* 那么返回 : where ( deleted = 0 and ( a ! = 3 or a ! = 2 ) ) limit 1
* @ param whereSql 从where起的sql子句 , 如果有where必须带上where关键字 。
* @ param condExpression 例如a = ? 不带where或and关键字 。
*... | if ( condExpression == null || condExpression . trim ( ) . isEmpty ( ) ) { return whereSql == null ? "" : whereSql ; } if ( whereSql == null || whereSql . trim ( ) . isEmpty ( ) ) { return "WHERE " + condExpression ; } whereSql = whereSql . trim ( ) ; if ( ! whereSql . toUpperCase ( ) . startsWith ( "WHERE " ) ) { retu... |
public class NetworkInterfacesInner { /** * Get the specified network interface ip configuration in a virtual machine scale set .
* @ param resourceGroupName The name of the resource group .
* @ param virtualMachineScaleSetName The name of the virtual machine scale set .
* @ param virtualmachineIndex The virtual ... | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( virtualMachineScaleSetName == null ) { throw new IllegalArgumentException ( "Parameter virtualMachineScaleSetName is required and cannot be null." ) ; } if ( virtualmachineInd... |
public class DoubleHistogram { /** * Add the contents of another histogram to this one .
* @ param fromHistogram The other histogram .
* @ throws ArrayIndexOutOfBoundsException ( may throw ) if values in fromHistogram ' s cannot be
* covered by this histogram ' s range */
public void add ( final DoubleHistogram f... | int arrayLength = fromHistogram . integerValuesHistogram . countsArrayLength ; AbstractHistogram fromIntegerHistogram = fromHistogram . integerValuesHistogram ; for ( int i = 0 ; i < arrayLength ; i ++ ) { long count = fromIntegerHistogram . getCountAtIndex ( i ) ; if ( count > 0 ) { recordValueWithCount ( fromIntegerH... |
public class RandomNumbersTool { /** * Generates a random integer between the specified values .
* @ param lo the lower bound for the generated integer .
* @ param hi the upper bound for the generated integer .
* @ return a random integer between < code > lo < / code > and < code > hi < / code > . */
public stati... | return ( Math . abs ( random . nextInt ( ) ) % ( hi - lo + 1 ) ) + lo ; |
public class LogMetaInfUtils { /** * This method performs part of the factory search outlined in section 10.2.6.1. */
@ SuppressWarnings ( "unchecked" ) protected static void logMetaInf ( ) { } } | if ( ! log . isLoggable ( Level . WARNING ) ) { return ; } try { Map < String , List < JarInfo > > libs = new HashMap < String , List < JarInfo > > ( 30 ) ; Iterator < URL > it = ClassUtils . getResources ( "META-INF/MANIFEST.MF" , LogMetaInfUtils . class ) ; while ( it . hasNext ( ) ) { URL url = it . next ( ) ; addJa... |
public class SearchManager { /** * { @ inheritDoc } */
public Set < String > getFieldNames ( ) throws IndexException { } } | final Set < String > fildsSet = new HashSet < String > ( ) ; if ( handler instanceof SearchIndex ) { IndexReader reader = null ; try { reader = ( ( SearchIndex ) handler ) . getIndexReader ( ) ; FieldInfos infos = ReaderUtil . getMergedFieldInfos ( reader ) ; for ( FieldInfo info : infos ) { fildsSet . add ( info . nam... |
public class Encrypter { /** * Methode de decryptage d ' un texte
* @ param textTexte a decrypter
* @ returnTexte decrypte */
public synchronized String decryptText ( String text ) { } } | try { // Mise en mode Decrypt
cipher . init ( Cipher . DECRYPT_MODE , this . createDESSecretKey ( stringKey ) ) ; // Obtention des bytes
byte [ ] encodedByteText = new Base64 ( ) . decode ( text ) ; // Decryption
byte [ ] byteText = cipher . doFinal ( encodedByteText ) ; // Retour de la chaine
return new String ( byteT... |
public class QuerySpecification { void resolveColumnReferencesInOrderBy ( SortAndSlice sortAndSlice ) { } } | // replace the aliases with expressions
// replace column names with expressions and resolve the table columns
int orderCount = sortAndSlice . getOrderLength ( ) ; for ( int i = 0 ; i < orderCount ; i ++ ) { ExpressionOrderBy e = ( ExpressionOrderBy ) sortAndSlice . exprList . get ( i ) ; replaceColumnIndexInOrderBy ( ... |
public class FluoConfigurationImpl { /** * Gets the time before stale entries in the cache are evicted based on age . This method returns a
* long representing the time converted from the TimeUnit passed in .
* @ param conf The FluoConfiguration
* @ param tu The TimeUnit desired to represent the cache timeout */
... | long millis = conf . getLong ( VISIBILITY_CACHE_TIMEOUT , VISIBILITY_CACHE_TIMEOUT_DEFAULT ) ; if ( millis <= 0 ) { throw new IllegalArgumentException ( "Timeout must positive for " + VISIBILITY_CACHE_TIMEOUT ) ; } return tu . convert ( millis , TimeUnit . MILLISECONDS ) ; |
public class sslcipher { /** * Use this API to fetch sslcipher resource of given name . */
public static sslcipher get ( nitro_service service , String ciphergroupname ) throws Exception { } } | sslcipher obj = new sslcipher ( ) ; obj . set_ciphergroupname ( ciphergroupname ) ; sslcipher response = ( sslcipher ) obj . get_resource ( service ) ; return response ; |
public class PoolablePreparedStatement { /** * Method setNCharacterStream .
* @ param parameterIndex
* @ param value
* @ throws SQLException
* @ see java . sql . PreparedStatement # setNCharacterStream ( int , Reader ) */
@ Override public void setNCharacterStream ( int parameterIndex , Reader value ) throws SQ... | internalStmt . setNCharacterStream ( parameterIndex , value ) ; |
public class Slf4jLogger { /** * Log an exception ( throwable ) at the DEBUG level with an
* accompanying message .
* @ param msg the message accompanying the exception
* @ param t the exception ( throwable ) to log */
public void debug ( String msg , Throwable t ) { } } | if ( m_delegate . isDebugEnabled ( ) ) { m_delegate . debug ( msg , t ) ; } |
import java . util . * ; public class CollectPrefixes { /** * Generates a list of all prefixes of the input string in ascending order of their length
* @ param word The string from which prefixes are to be generated
* @ return The list of all possible prefixes of the input string
* Example :
* > > > collect _ p... | List < String > resultList = new ArrayList < > ( ) ; for ( int i = 0 ; i < word . length ( ) ; i ++ ) { resultList . add ( word . substring ( 0 , i + 1 ) ) ; } return resultList ; |
public class DefaultXPathEvaluator { /** * Perform an XPath evaluation on an invocation context .
* @ param expression
* @ param node
* @ param method
* @ param invocationContext
* @ return a list of evaluation results
* @ throws XPathExpressionException */
public static List < ? > evaluateAsList ( final XP... | // assert targetComponentType ! = null ;
final Class < ? > targetComponentType = invocationContext . getTargetComponentType ( ) ; final NodeList nodes = ( NodeList ) expression . evaluate ( node , XPathConstants . NODESET ) ; final List < Object > linkedList = new LinkedList < Object > ( ) ; final TypeConverter typeCon... |
public class SlaveComputer { /** * { @ inheritDoc } */
@ Override public void taskCompleted ( Executor executor , Queue . Task task , long durationMS ) { } } | super . taskCompleted ( executor , task , durationMS ) ; if ( launcher instanceof ExecutorListener ) { ( ( ExecutorListener ) launcher ) . taskCompleted ( executor , task , durationMS ) ; } RetentionStrategy r = getRetentionStrategy ( ) ; if ( r instanceof ExecutorListener ) { ( ( ExecutorListener ) r ) . taskCompleted... |
public class WCardManager { /** * Override method to show Error indicators on the visible card .
* @ param diags the list of diagnostics containing errors . */
@ Override public void showErrorIndicators ( final List < Diagnostic > diags ) { } } | WComponent visibleComponent = getVisible ( ) ; visibleComponent . showErrorIndicators ( diags ) ; |
public class Emitter { /** * syck _ scan _ scalar */
public int scanScalar ( int req_width , Pointer _cursor , int len ) { } } | byte [ ] cursorb = _cursor . buffer ; int cursor = _cursor . start ; int start = 0 ; int flags = SCAN_NONE ; if ( len < 1 ) { return flags ; } switch ( cursorb [ cursor ] ) { case '[' : case ']' : case '{' : case '}' : case '!' : case '*' : case '&' : case '|' : case '>' : case '\'' : case '"' : case '#' : case '%' : c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.