signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class SourceLineAnnotation { /** * Factory method to create an unknown source line annotation . This variant
* looks up the source filename automatically based on the class using best
* effort .
* @ param className
* the class name
* @ return the SourceLineAnnotation */
public static SourceLineAnnotation createUnknown ( @ DottedClassName String className ) { } } | return createUnknown ( className , AnalysisContext . currentAnalysisContext ( ) . lookupSourceFile ( className ) , - 1 , - 1 ) ; |
public class MapUtil { /** * 将已知Map转换为key为驼峰风格的Map < br >
* 如果KEY为非String类型 , 保留原值
* @ param map 原Map
* @ return 驼峰风格Map
* @ since 3.3.1 */
public static < K , V > Map < K , V > toCamelCaseMap ( Map < K , V > map ) { } } | return ( map instanceof LinkedHashMap ) ? new CamelCaseLinkedMap < > ( map ) : new CamelCaseMap < > ( map ) ; |
public class ByteMatchTupleMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ByteMatchTuple byteMatchTuple , ProtocolMarshaller protocolMarshaller ) { } } | if ( byteMatchTuple == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( byteMatchTuple . getFieldToMatch ( ) , FIELDTOMATCH_BINDING ) ; protocolMarshaller . marshall ( byteMatchTuple . getTargetString ( ) , TARGETSTRING_BINDING ) ; protocolMarshaller . marshall ( byteMatchTuple . getTextTransformation ( ) , TEXTTRANSFORMATION_BINDING ) ; protocolMarshaller . marshall ( byteMatchTuple . getPositionalConstraint ( ) , POSITIONALCONSTRAINT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class IntegerField { /** * Move the physical binary data to this SQL parameter row .
* @ param resultset The resultset to get the SQL data from .
* @ param iColumn the column in the resultset that has my data .
* @ exception SQLException From SQL calls . */
public void moveSQLToField ( ResultSet resultset , int iColumn ) throws SQLException { } } | int sResult = resultset . getInt ( iColumn ) ; if ( resultset . wasNull ( ) ) this . setString ( Constants . BLANK , false , DBConstants . READ_MOVE ) ; // Null value
else { if ( ( ! this . isNullable ( ) ) && ( sResult == NAN ) ) this . setString ( Constants . BLANK , false , DBConstants . READ_MOVE ) ; // Null value
else this . setValue ( sResult , false , DBConstants . READ_MOVE ) ; } |
public class NameValue { /** * Set the owner of this value . */
public void addThisMessageFilter ( BaseMessageFilter filter ) { } } | if ( m_filter == null ) m_filter = filter ; else { if ( m_filter instanceof BaseMessageFilter ) { BaseMessageFilter filterFirst = ( BaseMessageFilter ) m_filter ; m_filter = new Hashtable < String , Object > ( ) ; ( ( Map ) m_filter ) . put ( filterFirst . getFilterID ( ) , filterFirst ) ; } ( ( Map ) m_filter ) . put ( filter . getFilterID ( ) , filter ) ; } |
public class BeansUtil { /** * Copies the properties from the object to the other object .
* @ param dst
* the destination object to which the property value is set .
* @ param src
* the source object from which the property value is got .
* @ param properties
* the names of the properties that should not be copied .
* @ return
* the number of properties copied . */
public static int copyPropertiesExcept ( final Object dst , final Object src , final String [ ] properties ) { } } | if ( dst == null ) { throw new IllegalArgumentException ( "no destination object specified" ) ; } if ( src == null ) { throw new IllegalArgumentException ( "no source object specified" ) ; } Collection < String > excepts = null ; if ( properties != null && properties . length > 0 ) { excepts = Arrays . asList ( properties ) ; } int count = 0 ; Collection < String > names = getPropertyNames ( src ) ; for ( String name : names ) { if ( excepts != null && excepts . contains ( name ) ) { continue ; } count += copyProperty ( dst , src , name ) ; } return count ; |
public class Range { /** * Checks if another { @ code range } is within the bounds of this range .
* < p > A range is considered to be within this range if both of its endpoints
* are within this range . < / p >
* @ param range a non - { @ code null } { @ code T } reference
* @ return { @ code true } if the range is within this inclusive range , { @ code false } otherwise
* @ throws NullPointerException if { @ code range } was { @ code null } */
public boolean contains ( @ NonNull Range < T > range ) { } } | if ( range == null ) throw new IllegalArgumentException ( "value must not be null" ) ; boolean gteLower = range . mLower . compareTo ( mLower ) >= 0 ; boolean lteUpper = range . mUpper . compareTo ( mUpper ) <= 0 ; return gteLower && lteUpper ; |
public class MySQLMetadataDAO { /** * Check if a { @ link WorkflowDef } with the same { @ literal name } and { @ literal version } already exist .
* @ param connection The { @ link Connection } to use for queries .
* @ param def The { @ code WorkflowDef } to check for .
* @ return { @ literal true } if a { @ code WorkflowDef } already exists with the same values . */
private Boolean workflowExists ( Connection connection , WorkflowDef def ) { } } | final String CHECK_WORKFLOW_DEF_EXISTS_QUERY = "SELECT COUNT(*) FROM meta_workflow_def WHERE name = ? AND " + "version = ?" ; return query ( connection , CHECK_WORKFLOW_DEF_EXISTS_QUERY , q -> q . addParameter ( def . getName ( ) ) . addParameter ( def . getVersion ( ) ) . exists ( ) ) ; |
public class ScheduledEventServiceImpl { /** * @ see
* com . ibm . websphere . event . ScheduledEventService # schedule ( com . ibm . websphere
* . event . Topic , java . util . Map , long , java . util . concurrent . TimeUnit ) */
@ Override public ScheduledFuture < ? > schedule ( Topic topic , Map < ? , ? > context , long delay , TimeUnit unit ) { } } | final EventEngine engine = this . eventSvc ; final ScheduledExecutorService scheduler = this . execSvc ; if ( null == scheduler || null == engine ) { throw new IllegalStateException ( "Service is not running" ) ; } if ( null == topic ) { throw new IllegalArgumentException ( "Missing topic" ) ; } Task task = new Task ( topic , context , engine , CurrentEvent . get ( ) ) ; return scheduler . schedule ( task , delay , unit ) ; |
public class Node { /** * Adds the given node to the neighbours of this node . Both nodes must be in the same graph .
* @ param o the given node */
void connectTo ( final Node < T > o ) { } } | if ( ! this . graph . equals ( o . graph ) ) throw new IllegalArgumentException ( "Cannot connect to nodes of two different graphs." ) ; if ( this . equals ( o ) ) { return ; } neighbours . add ( o ) ; |
public class SimpleBlas { /** * Compute A < - alpha * x * y ^ H + A ( general rank - 1 update ) */
public static ComplexDoubleMatrix gerc ( ComplexDouble alpha , ComplexDoubleMatrix x , ComplexDoubleMatrix y , ComplexDoubleMatrix a ) { } } | NativeBlas . zgerc ( a . rows , a . columns , alpha , x . data , 0 , 1 , y . data , 0 , 1 , a . data , 0 , a . rows ) ; return a ; |
public class QuartzJobSpecScheduler { /** * { @ inheritDoc } */
@ Override protected void doUnschedule ( JobSpecSchedule existingSchedule ) { } } | Preconditions . checkNotNull ( existingSchedule ) ; Preconditions . checkArgument ( existingSchedule instanceof QuartzJobSchedule ) ; QuartzJobSchedule quartzSchedule = ( QuartzJobSchedule ) existingSchedule ; try { _scheduler . getScheduler ( ) . deleteJob ( quartzSchedule . getQuartzTrigger ( ) . getJobKey ( ) ) ; } catch ( SchedulerException e ) { throw new RuntimeException ( "Unscheduling failed for " + existingSchedule . getJobSpec ( ) + ":" + e , e ) ; } |
public class RepositoryServiceImpl { /** * ( non - Javadoc )
* @ see
* org . fcrepo . kernel . api . services . RepositoryService # getRepositoryObjectCount ( ) */
@ Override public Long getRepositoryObjectCount ( ) { } } | final Repository repo = getJcrRepository ( repository ) ; try { return getRepositoryCount ( repo ) ; } catch ( final RepositoryException e ) { throw new RepositoryRuntimeException ( e ) ; } |
public class EmailSender { /** * Send email with a string content and attachment
* @ param to destination eamil address
* @ param subject email subject
* @ param content email content
* @ param filename attachment filename
* @ throws MessagingException messaging exception */
public void sendMailWithAttachment ( String to , String subject , String content , String filename ) throws MessagingException { } } | Properties props = new Properties ( ) ; props . put ( "mail.smtp.user" , emailConfg . getUser ( ) ) ; props . put ( "mail.smtp.host" , emailConfg . getHost ( ) ) ; props . put ( "mail.smtp.port" , emailConfg . getPort ( ) ) ; props . put ( "mail.smtp.starttls.enable" , "true" ) ; props . put ( "mail.smtp.debug" , emailConfg . getDebug ( ) ) ; props . put ( "mail.smtp.auth" , emailConfg . getAuth ( ) ) ; props . put ( "mail.smtp.ssl.trust" , emailConfg . host ) ; SMTPAuthenticator auth = new SMTPAuthenticator ( emailConfg . getUser ( ) , ( String ) secret . get ( SecretConstants . EMAIL_PASSWORD ) ) ; Session session = Session . getInstance ( props , auth ) ; MimeMessage message = new MimeMessage ( session ) ; message . setFrom ( new InternetAddress ( emailConfg . getUser ( ) ) ) ; message . addRecipient ( Message . RecipientType . TO , new InternetAddress ( to ) ) ; message . setSubject ( subject ) ; // Create the message part
BodyPart messageBodyPart = new MimeBodyPart ( ) ; // Now set the actual message
messageBodyPart . setText ( content ) ; // Create a multipar message
Multipart multipart = new MimeMultipart ( ) ; // Set text message part
multipart . addBodyPart ( messageBodyPart ) ; // Part two is attachment
messageBodyPart = new MimeBodyPart ( ) ; DataSource source = new FileDataSource ( filename ) ; messageBodyPart . setDataHandler ( new DataHandler ( source ) ) ; messageBodyPart . setFileName ( filename ) ; multipart . addBodyPart ( messageBodyPart ) ; // Send the complete message parts
message . setContent ( multipart ) ; // Send message
Transport . send ( message ) ; if ( logger . isInfoEnabled ( ) ) logger . info ( "An email has been sent to " + to + " with subject " + subject ) ; |
public class LZ09 { /** * control the PS shapes of 3 - D instances */
double psfunc3 ( double x , double t1 , double t2 , int dim , int type ) { } } | // type : the type of curve
// css : the class of index
double beta ; beta = 0.0 ; dim ++ ; if ( type == 31 ) { double xy = 4 * ( x - 0.5 ) ; double rate = 1.0 * dim / nvar ; beta = xy - 4 * ( t1 * t1 * rate + t2 * ( 1.0 - rate ) ) + 2 ; } if ( type == 32 ) { double theta = 2 * Math . PI * t1 + dim * Math . PI / nvar ; double xy = 4 * ( x - 0.5 ) ; beta = xy - 2 * t2 * Math . sin ( theta ) ; } return beta ; |
public class JmxRegisterCallback { /** * Unregister all previously registered Simons . */
private synchronized void unregisterAllSimons ( ) { } } | Iterator < String > namesIter = registeredNames . iterator ( ) ; while ( namesIter . hasNext ( ) ) { String name = namesIter . next ( ) ; try { ObjectName objectName = new ObjectName ( name ) ; mBeanServer . unregisterMBean ( objectName ) ; // I have to use iterator . remove ( ) - hence no common method for clearManager ( ) and simonDestroyed ( simon )
namesIter . remove ( ) ; onManagerMessage ( "Unregistered Simon with the name: " + objectName ) ; } catch ( JMException e ) { onManagerWarning ( "JMX unregistration failed for: " + name , e ) ; } } |
public class SourceDocumentRepositoryMongoImpl { /** * { @ inheritDoc } */
@ Override public final Iterable < SourceDocument > findAll ( final RootDocument rootDocument ) { } } | final Iterable < SourceDocument > sourceDocuments = findAll ( rootDocument . getFilename ( ) ) ; if ( sourceDocuments == null ) { return null ; } for ( final SourceDocument sourceDocument : sourceDocuments ) { final Source source = sourceDocument . getGedObject ( ) ; source . setParent ( rootDocument . getGedObject ( ) ) ; } return sourceDocuments ; |
public class AnnotationParser { /** * Handle a string with an annotation handler
* @ param s the String to process
* @ param ah the annotation handler to use . */
public static void handle ( String s , AnnotationHandler ah ) { } } | Map < String , Map < String , String > > l = new LinkedHashMap < String , Map < String , String > > ( ) ; Matcher m = annPattern . matcher ( s ) ; while ( m . find ( ) ) { // for ( int i = 1 ; i < = m . groupCount ( ) ; i + + ) {
// System . out . println ( " Group " + i + " ' " + m . group ( i ) + " ' " ) ;
String rest = s . substring ( m . end ( 0 ) ) . trim ( ) ; String srcLine = null ; if ( rest . indexOf ( '\n' ) > - 1 ) { srcLine = rest . substring ( 0 , rest . indexOf ( '\n' ) ) ; } else { srcLine = rest ; } Map < String , String > val = new LinkedHashMap < String , String > ( ) ; String annArgs = m . group ( 3 ) ; if ( annArgs == null ) { // no annotations arguments
// e . g ' @ Function '
} else if ( annArgs . indexOf ( '=' ) > - 1 ) { // KVP annotation
// e . g . ' @ Function ( name = " test " , scope = " global " ) '
StringTokenizer t = new StringTokenizer ( annArgs , "," ) ; while ( t . hasMoreTokens ( ) ) { String arg = t . nextToken ( ) ; String key = arg . substring ( 0 , arg . indexOf ( '=' ) ) ; String value = arg . substring ( arg . indexOf ( '=' ) + 1 ) ; val . put ( key . trim ( ) , value . trim ( ) ) ; } } else { // single value annotation
// e . g . ' @ Function ( " test " ) ;
val . put ( AnnotationHandler . VALUE , annArgs ) ; } l . put ( m . group ( 1 ) , val ) ; // If the next line also has an annotation
// no source line will be passed into the handler
if ( ! annTestPattern . matcher ( srcLine ) . find ( ) ) { ah . handle ( l , srcLine ) ; ah . log ( " Ann -> " + l ) ; ah . log ( " Src -> " + srcLine ) ; l = new LinkedHashMap < String , Map < String , String > > ( ) ; } } |
public class ProfilerBenchmark { private static void assertProfilingWorks ( CallStackElement cse ) { } } | if ( cse . getChildren ( ) . isEmpty ( ) || ! cse . getChildren ( ) . get ( 0 ) . getSignature ( ) . contains ( "method1" ) ) { throw new IllegalStateException ( "profiling did not work! " + ManagementFactory . getRuntimeMXBean ( ) . getInputArguments ( ) + "\n" + cse ) ; } |
public class GZIPInputStream { /** * Reads uncompressed data into an array of bytes . If < code > len < / code > is not
* zero , the method will block until some input can be decompressed ; otherwise ,
* no bytes are read and < code > 0 < / code > is returned .
* @ param buf the buffer into which the data is read
* @ param off the start offset in the destination array < code > b < / code >
* @ param len the maximum number of bytes read
* @ return the actual number of bytes read , or - 1 if the end of the
* compressed input stream is reached
* @ exception NullPointerException If < code > buf < / code > is < code > null < / code > .
* @ exception IndexOutOfBoundsException If < code > off < / code > is negative ,
* < code > len < / code > is negative , or < code > len < / code > is greater than
* < code > buf . length - off < / code >
* @ exception ZipException if the compressed input data is corrupt .
* @ exception IOException if an I / O error has occurred . */
public int read ( byte [ ] buf , int off , int len ) throws IOException { } } | ensureOpen ( ) ; if ( eos ) { return - 1 ; } int n = super . read ( buf , off , len ) ; if ( n == - 1 ) { if ( readTrailer ( ) ) eos = true ; else return this . read ( buf , off , len ) ; } else { crc . update ( buf , off , n ) ; } return n ; |
public class DU { /** * Start the disk usage checking thread . */
public void start ( ) { } } | // only start the thread if the interval is sane
if ( refreshInterval > 0 ) { refreshUsed = new Thread ( new DURefreshThread ( ) , "refreshUsed-" + dirPath ) ; refreshUsed . setDaemon ( true ) ; refreshUsed . start ( ) ; } |
public class CmsGalleryService { /** * Reads the resources for a collection of structure ids and returns the list of resources which could be read . < p >
* @ param structureIds the structure ids for which we want to read the resources
* @ param filter the filter used to read the resource
* @ return the list of resources for the given structure id */
protected List < CmsResource > readAll ( Collection < CmsUUID > structureIds , CmsResourceFilter filter ) { } } | List < CmsResource > result = new ArrayList < CmsResource > ( ) ; for ( CmsUUID id : structureIds ) { try { result . add ( getCmsObject ( ) . readResource ( id , filter ) ) ; } catch ( CmsException e ) { LOG . info ( e . getLocalizedMessage ( ) , e ) ; } } return result ; |
public class AmazonEC2Client { /** * Modifies attributes of a specified VPC endpoint . The attributes that you can modify depend on the type of VPC
* endpoint ( interface or gateway ) . For more information , see < a
* href = " https : / / docs . aws . amazon . com / AmazonVPC / latest / UserGuide / vpc - endpoints . html " > VPC Endpoints < / a > in the
* < i > Amazon Virtual Private Cloud User Guide < / i > .
* @ param modifyVpcEndpointRequest
* Contains the parameters for ModifyVpcEndpoint .
* @ return Result of the ModifyVpcEndpoint operation returned by the service .
* @ sample AmazonEC2 . ModifyVpcEndpoint
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / ModifyVpcEndpoint " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ModifyVpcEndpointResult modifyVpcEndpoint ( ModifyVpcEndpointRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeModifyVpcEndpoint ( request ) ; |
public class RouteUtils { /** * Extracts the name of the parameters from a route .
* / { my _ id } / { my _ name }
* would return a List with " my _ id " and " my _ name "
* @ param rawRoute the route ' s uri
* @ return a list with the names of all parameters in that route . */
public static List < String > extractParameters ( String rawRoute ) { } } | List < String > list = new ArrayList < > ( ) ; Matcher m = PATH_PARAMETER_REGEX . matcher ( rawRoute ) ; while ( m . find ( ) ) { if ( m . group ( 1 ) . indexOf ( '<' ) != - 1 ) { // Regex case name < reg >
list . add ( m . group ( 1 ) . substring ( 0 , m . group ( 1 ) . indexOf ( '<' ) ) ) ; } else if ( m . group ( 1 ) . indexOf ( '*' ) != - 1 ) { // Star case name *
list . add ( m . group ( 1 ) . substring ( 0 , m . group ( 1 ) . indexOf ( '*' ) ) ) ; } else if ( m . group ( 1 ) . indexOf ( '+' ) != - 1 ) { // Plus case name +
list . add ( m . group ( 1 ) . substring ( 0 , m . group ( 1 ) . indexOf ( '+' ) ) ) ; } else { // Basic case ( name )
list . add ( m . group ( 1 ) ) ; } } return list ; |
public class Cpe { /** * Method that split versions for ' . ' , ' | ' , ' : ' and ' - " . Then if a token
* start with a number and then contains letters , it will split it too . For
* example " 12a " is split into [ " 12 " , " a " ] . This is done to support correct
* comparison of " 5.0.3a " , " 5.0.9 " and " 5.0.30 " .
* @ param s the string to split
* @ return an Array of String containing the tokens to be compared */
private static List < String > splitVersion ( String s ) { } } | // TODO improve performance by removing regex .
final Pattern pattern = Pattern . compile ( "^([\\d]+?)(.*)$" ) ; final String [ ] splitString = s . split ( "(\\.|:-)" ) ; final List < String > res = new ArrayList < > ( ) ; for ( String token : splitString ) { if ( token . matches ( "^[\\d]+?[A-z]+" ) ) { final Matcher matcher = pattern . matcher ( token ) ; matcher . find ( ) ; final String g1 = matcher . group ( 1 ) ; final String g2 = matcher . group ( 2 ) ; res . add ( g1 ) ; res . add ( g2 ) ; } else { res . add ( token ) ; } } return res ; |
public class CPOptionCategoryLocalServiceBaseImpl { /** * Updates the cp option category in the database or adds it if it does not yet exist . Also notifies the appropriate model listeners .
* @ param cpOptionCategory the cp option category
* @ return the cp option category that was updated */
@ Indexable ( type = IndexableType . REINDEX ) @ Override public CPOptionCategory updateCPOptionCategory ( CPOptionCategory cpOptionCategory ) { } } | return cpOptionCategoryPersistence . update ( cpOptionCategory ) ; |
public class FNCount { /** * { @ inheritDoc } */
@ Override protected byte [ ] computeResult ( ) { } } | final AbsAxis axis = getArgs ( ) . get ( 0 ) ; Integer count = 0 ; while ( axis . hasNext ( ) ) { axis . next ( ) ; count ++ ; } return TypedValue . getBytes ( count . toString ( ) ) ; |
public class AbstractVerifyMojo { /** * Guess the { @ code & lt ; defaultLanguage & gt ; } value to use for the passed file using the following algorithm :
* < ul >
* < li > If the page name matches one of the regexes defined by the user as content pages then check that the
* default language is { @ link # defaultLanguage } . < / li >
* < li > If the page name matches one of the regexes defined by the user as technial pages then check that the
* default language is empty . Matching technical pages have precedence over matching content pages . < / li >
* < li > If there ' s no other translation of the file then consider default language to be empty to signify that
* it ' s a technical document . < / li >
* < li > If there are other translations ( " ( prefix ) . ( language ) . xml " format ) then the default language should be
* { @ link # defaultLanguage } < / li >
* < / ul >
* @ param file the XML file for which to guess the default language that it should have
* @ param xwikiXmlFiles the list of all XML files that is used to check for translations of the passed XML file
* @ return the default language as a string ( e . g . " en " for English or " " for an empty default language )
* @ since 5.4.1 */
protected String guessDefaultLanguage ( File file , Collection < File > xwikiXmlFiles ) { } } | String fileName = file . getName ( ) ; // Note that we need to check for content pages before technical pages because some pages are both content
// pages ( Translation pages for example ) and technical pages .
// Is it in the list of defined content pages ?
String language = guessDefaultLanguageForPatterns ( fileName , this . contentPagePatterns , this . defaultLanguage ) ; if ( language != null ) { return language ; } // Is it in the list of defined technical pages ?
language = guessDefaultLanguageForPatterns ( fileName , this . technicalPagePatterns , "" ) ; if ( language != null ) { return language ; } language = "" ; // Check if the doc is a translation
Matcher matcher = TRANSLATION_PATTERN . matcher ( fileName ) ; if ( matcher . matches ( ) ) { // We ' re in a translation , use the default language
language = this . defaultLanguage ; } else { // We ' re not in a translation , check if there are translations . First get the doc name before the extension
String prefix = StringUtils . substringBeforeLast ( fileName , EXTENSION ) ; // Check for a translation now
Pattern translationPattern = Pattern . compile ( String . format ( "%s\\..*\\.xml" , Pattern . quote ( prefix ) ) ) ; for ( File xwikiXmlFile : xwikiXmlFiles ) { Matcher translationMatcher = translationPattern . matcher ( xwikiXmlFile . getName ( ) ) ; if ( translationMatcher . matches ( ) ) { // Found a translation , use the default language
language = this . defaultLanguage ; break ; } } } return language ; |
public class LinkedList { /** * ( non - Javadoc )
* @ see com . ibm . ws . objectManager . Collection # add ( com . ibm . ws . objectManager . Token , com . ibm . ws . objectManager . Transaction ) */
public boolean add ( Token token , Transaction transaction ) throws ObjectManagerException { } } | addEntry ( token , transaction ) ; return true ; |
public class DateIteratorFactory { /** * given a block of RRULE , EXRULE , RDATE , and EXDATE content lines , parse
* them into a single date iterator .
* @ param rdata RRULE , EXRULE , RDATE , and EXDATE lines .
* @ param start the first occurrence of the series .
* @ param tzid the local timezone - - used to interpret start and any dates in
* RDATE and EXDATE lines that don ' t have TZID params .
* @ param strict true if any failure to parse should result in a
* ParseException . false causes bad content lines to be logged and ignored . */
public static DateIterator createDateIterator ( String rdata , Date start , TimeZone tzid , boolean strict ) throws ParseException { } } | return new RecurrenceIteratorWrapper ( RecurrenceIteratorFactory . createRecurrenceIterator ( rdata , dateToDateValue ( start , true ) , tzid , strict ) ) ; |
public class XVariableDeclarationImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public NotificationChain basicSetRight ( XExpression newRight , NotificationChain msgs ) { } } | XExpression oldRight = right ; right = newRight ; if ( eNotificationRequired ( ) ) { ENotificationImpl notification = new ENotificationImpl ( this , Notification . SET , XbasePackage . XVARIABLE_DECLARATION__RIGHT , oldRight , newRight ) ; if ( msgs == null ) msgs = notification ; else msgs . add ( notification ) ; } return msgs ; |
public class Ifc4FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcSystemFurnitureElementTypeEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class FedoraBinaryImpl { /** * Get the proxied binary content object wrapped by this object
* @ return the fedora binary */
private FedoraBinary getBinary ( final String extUrl ) { } } | if ( wrappedBinary == null ) { wrappedBinary = getBinaryImplementation ( extUrl ) ; } return wrappedBinary ; |
public class KamImpl { /** * { @ inheritDoc } */
@ Override public void union ( Collection < KamEdge > kamEdges ) throws InvalidArgument { } } | for ( KamEdge kamEdge : kamEdges ) { if ( ! this . getKamInfo ( ) . equals ( kamEdge . getKam ( ) . getKamInfo ( ) ) ) { throw new InvalidArgument ( "Edge does not belong to the KAM" ) ; } // See if the edge already exists
if ( ! edgeIdMap . containsKey ( kamEdge ) ) { // Make sure the nodes are valid for this kam , if not then add them
if ( ! contains ( kamEdge . getSourceNode ( ) ) ) { addNode ( kamEdge . getSourceNode ( ) ) ; } if ( ! contains ( kamEdge . getTargetNode ( ) ) ) { addNode ( kamEdge . getTargetNode ( ) ) ; } // add this edge into the graph
addEdge ( kamEdge ) ; } } |
public class SpotifyApi { /** * Get the current users top artists based on calculated affinity .
* @ return A { @ link GetUsersTopArtistsRequest . Builder } .
* @ see # getUsersTopArtistsAndTracks ( ModelObjectType ) */
public GetUsersTopArtistsRequest . Builder getUsersTopArtists ( ) { } } | return new GetUsersTopArtistsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; |
public class ArrayUtil { /** * convert a primitive array ( value type ) to Object Array ( reference type ) .
* @ param primArr value type Array
* @ return reference type Array */
public static Boolean [ ] toReferenceType ( boolean [ ] primArr ) { } } | Boolean [ ] refArr = new Boolean [ primArr . length ] ; for ( int i = 0 ; i < primArr . length ; i ++ ) refArr [ i ] = Caster . toBoolean ( primArr [ i ] ) ; return refArr ; |
public class JMPathOperation { /** * Copy path .
* @ param sourcePath the source path
* @ param destinationPath the destination path
* @ param options the options
* @ return the path */
public static Path copy ( Path sourcePath , Path destinationPath , CopyOption ... options ) { } } | return operate ( sourcePath , destinationPath , "copy" , finalPath -> { try { return Files . copy ( sourcePath , finalPath , options ) ; } catch ( Exception e ) { return JMExceptionManager . handleExceptionAndReturnNull ( log , e , "copy" , sourcePath , destinationPath , options ) ; } } ) ; |
public class MultiFileJournalReader { /** * Look in the directory for files that match the prefix . If there are none ,
* leave with currentFile still null . If we find one , advance into it . */
protected JournalInputFile openNextFile ( ) throws JournalException { } } | File [ ] journalFiles = MultiFileJournalHelper . getSortedArrayOfJournalFiles ( journalDirectory , filenamePrefix ) ; if ( journalFiles . length == 0 ) { return null ; } JournalInputFile nextFile = new JournalInputFile ( journalFiles [ 0 ] ) ; recoveryLog . log ( "Opening journal file: '" + nextFile . getFilename ( ) + "'" ) ; return nextFile ; |
public class CSSClass { /** * Append CSS definition to a stream
* @ param buf String buffer to append to . */
public void appendCSSDefinition ( StringBuilder buf ) { } } | buf . append ( "\n." ) ; buf . append ( name ) ; buf . append ( '{' ) ; for ( Pair < String , String > pair : statements ) { buf . append ( pair . getFirst ( ) ) ; buf . append ( ':' ) ; buf . append ( pair . getSecond ( ) ) ; buf . append ( ";\n" ) ; } buf . append ( "}\n" ) ; |
public class SimpleTypeUtil { /** * 注册新的类型 , 不存在时不抛出异常
* @ param clazz */
private static void registerSimpleTypeSilence ( String clazz ) { } } | try { SIMPLE_TYPE_SET . add ( Class . forName ( clazz ) ) ; } catch ( ClassNotFoundException e ) { // ignore
} |
public class DoubleTuples { /** * Reverse the given tuple . This will create a new tuple whose elements
* are the same as in the given tuple , but in reverse order . < br >
* < br >
* In order to create a reversed < i > view < / i > on a tuple , the
* { @ link # reversed ( DoubleTuple ) } method may be used .
* @ param t The input tuple
* @ param result The result tuple
* @ return The result tuple
* @ throws IllegalArgumentException If the given tuples do not
* have the same { @ link Tuple # getSize ( ) size } */
public static MutableDoubleTuple reverse ( DoubleTuple t , MutableDoubleTuple result ) { } } | result = validate ( t , result ) ; if ( t == result ) { int n = t . getSize ( ) ; int nh = n / 2 ; for ( int i = 0 ; i < nh ; i ++ ) { double temp = result . get ( i ) ; result . set ( i , result . get ( n - 1 - i ) ) ; result . set ( n - 1 - i , temp ) ; } } else { int n = t . getSize ( ) ; for ( int i = 0 ; i < n ; i ++ ) { result . set ( i , t . get ( n - 1 - i ) ) ; } } return result ; |
public class RestrictorFactory { /** * Lookup a restrictor based on an URL
* @ param pLocation classpath or URL representing the location of the policy restrictor
* @ return the restrictor created or < code > null < / code > if none could be found .
* @ throws IOException if reading of the policy stream failed */
public static PolicyRestrictor lookupPolicyRestrictor ( String pLocation ) throws IOException { } } | InputStream is ; if ( pLocation . startsWith ( "classpath:" ) ) { String path = pLocation . substring ( "classpath:" . length ( ) ) ; is = ClassUtil . getResourceAsStream ( path ) ; if ( is == null ) { is = RestrictorFactory . class . getResourceAsStream ( path ) ; } } else { URL url = new URL ( pLocation ) ; is = url . openStream ( ) ; } return is != null ? new PolicyRestrictor ( is ) : null ; |
public class BasicFileServlet { /** * Check to see if a Accept header accept part matches any of the given types .
* @ param typeParams
* @ param type
* @ return */
private static boolean hasMatch ( String [ ] typeParams , String ... type ) { } } | boolean matches = false ; for ( String t : type ) { for ( String typeParam : typeParams ) { if ( typeParam . contains ( "/" ) ) { String typePart = typeParam . replace ( "*" , "" ) ; if ( t . startsWith ( typePart ) || t . endsWith ( typePart ) ) { matches = true ; break ; } } else if ( t . equals ( typeParam ) ) { matches = true ; break ; } } if ( matches ) { break ; } } return matches ; |
public class DoublesUtil { /** * Returns an on - heap copy of the given sketch
* @ param sketch the given sketch
* @ return a copy of the given sketch */
static HeapUpdateDoublesSketch copyToHeap ( final DoublesSketch sketch ) { } } | final HeapUpdateDoublesSketch qsCopy ; qsCopy = HeapUpdateDoublesSketch . newInstance ( sketch . getK ( ) ) ; qsCopy . putN ( sketch . getN ( ) ) ; qsCopy . putMinValue ( sketch . getMinValue ( ) ) ; qsCopy . putMaxValue ( sketch . getMaxValue ( ) ) ; qsCopy . putBaseBufferCount ( sketch . getBaseBufferCount ( ) ) ; qsCopy . putBitPattern ( sketch . getBitPattern ( ) ) ; if ( sketch . isCompact ( ) ) { final int combBufItems = Util . computeCombinedBufferItemCapacity ( sketch . getK ( ) , sketch . getN ( ) ) ; final double [ ] combBuf = new double [ combBufItems ] ; qsCopy . putCombinedBuffer ( combBuf ) ; final DoublesSketchAccessor sketchAccessor = DoublesSketchAccessor . wrap ( sketch ) ; final DoublesSketchAccessor copyAccessor = DoublesSketchAccessor . wrap ( qsCopy ) ; // start with BB
copyAccessor . putArray ( sketchAccessor . getArray ( 0 , sketchAccessor . numItems ( ) ) , 0 , 0 , sketchAccessor . numItems ( ) ) ; long bitPattern = sketch . getBitPattern ( ) ; for ( int lvl = 0 ; bitPattern != 0L ; ++ lvl , bitPattern >>>= 1 ) { if ( ( bitPattern & 1L ) > 0L ) { sketchAccessor . setLevel ( lvl ) ; copyAccessor . setLevel ( lvl ) ; copyAccessor . putArray ( sketchAccessor . getArray ( 0 , sketchAccessor . numItems ( ) ) , 0 , 0 , sketchAccessor . numItems ( ) ) ; } } } else { final double [ ] combBuf = sketch . getCombinedBuffer ( ) ; qsCopy . putCombinedBuffer ( Arrays . copyOf ( combBuf , combBuf . length ) ) ; } return qsCopy ; |
public class Node { /** * Transitions the node to the success state . */
void markSuccess ( ) { } } | // It ' s possible that the dag is killed before this method is called .
assertRunningOrKilling ( ) ; changeStatus ( Status . SUCCESS ) ; for ( final Node child : this . children ) { child . runIfAllowed ( ) ; } this . dag . updateDagStatus ( ) ; |
public class MaterialSpinner { /** * INITIALISATION METHODS */
private void init ( Context context , AttributeSet attrs ) { } } | initAttributes ( context , attrs ) ; initPaintObjects ( ) ; initDimensions ( ) ; initPadding ( ) ; initFloatingLabelAnimator ( ) ; initOnItemSelectedListener ( ) ; setMinimumHeight ( getPaddingTop ( ) + getPaddingBottom ( ) + minContentHeight ) ; // Erase the drawable selector not to be affected by new size ( extra paddings )
setBackgroundResource ( R . drawable . my_background ) ; |
public class PhoneNumberUtil { /** * parse phone number .
* @ param pphoneNumber phone number as string
* @ param pphoneNumberData phone number data to fill
* @ param pcountryData country data
* @ return PhoneNumberData , the same as in second parameter */
public PhoneNumberInterface parsePhoneNumber ( final String pphoneNumber , final PhoneNumberInterface pphoneNumberData , final PhoneCountryData pcountryData ) { } } | if ( pphoneNumber == null ) { return null ; } final ValueWithPos < PhoneNumberData > formatedValue = this . parsePhoneNumber ( new ValueWithPos < > ( pphoneNumber , - 1 ) , pphoneNumberData , pcountryData ) ; return formatedValue . getValue ( ) ; |
public class CmsProgressWidget { /** * Generates the widget HTML for the progress bar . < p >
* @ return the widget HTML for the progress bar */
public String getWidget ( ) { } } | StringBuffer result = new StringBuffer ( ) ; CmsProgressThread thread = getProgressThread ( getKey ( ) ) ; // if the thread is finished before the widget is rendered
// show directly the result
if ( ( thread != null ) && ( ! thread . isAlive ( ) ) ) { result . append ( "<script type=\"text/javascript\">\n" ) ; result . append ( "\tprogressState = 0;\n" ) ; result . append ( "\tprogressResult = '" ) ; result . append ( CmsStringUtil . escapeJavaScript ( getActualProgress ( ) ) ) ; result . append ( "';\n" ) ; result . append ( "\t" ) ; result . append ( getJsFinishMethod ( ) ) ; result . append ( "();\n" ) ; result . append ( "</script>\n" ) ; } else { // check if to show the wait symbol
boolean showWait = false ; if ( getShowWaitTime ( ) > 0 ) { // show if the thread is running and the time running is smaller than the configured
if ( ( thread != null ) && ( thread . isAlive ( ) ) && ( thread . getRuntime ( ) < getShowWaitTime ( ) ) ) { showWait = true ; } else if ( ( thread == null ) && ( getShowWaitTime ( ) > 0 ) ) { // show if there is no thread
showWait = true ; } } result . append ( "<div id=\"progressbar_desc\" style=\"margin-bottom:5px;display:" ) ; result . append ( showWait ? "none" : "block" ) ; result . append ( "\"></div>" ) ; result . append ( "<div style=\"width:" ) ; result . append ( getWidth ( ) ) ; result . append ( ";border-width:1px;border-style:solid;padding:0px;margin:0px;float:left;display:" ) ; result . append ( showWait ? "none" : "inline" ) ; result . append ( ";\">\n" ) ; result . append ( "\t<div id=\"progressbar_bar\" style=\"width:0%;background-color:" ) ; result . append ( getColor ( ) ) ; result . append ( ";\"> </div>\n" ) ; result . append ( "</div>\n" ) ; result . append ( " " ) ; result . append ( "<div id=\"progressbar_percent\" style=\"display:" ) ; result . append ( showWait ? "none" : "inline" ) ; result . append ( ";\" >0%</div>\n" ) ; result . append ( "<div id=\"progressbar_error\" style=\"display:none;color:#B40000;font-weight:bold;\"></div>\n" ) ; result . append ( "<div id=\"progressbar_wait\" style=\"display:" ) ; result . append ( showWait ? "block" : "none" ) ; result . append ( ";color:#000099;font-weight:bold;\"><img src=\"" ) ; result . append ( CmsWorkplace . getSkinUri ( ) ) ; result . append ( "commons/wait.gif\" width='32' height='32' alt='' align='absmiddle' />" ) ; result . append ( org . opencms . workplace . Messages . get ( ) . getBundle ( getJsp ( ) . getRequestContext ( ) . getLocale ( ) ) . key ( org . opencms . workplace . Messages . GUI_AJAX_REPORT_WAIT_0 ) ) ; result . append ( "</div>\n" ) ; result . append ( "<script type=\"text/javascript\">\n" ) ; result . append ( "\tstartProgressBar();\n" ) ; result . append ( "</script>\n" ) ; } return result . toString ( ) ; |
public class csparameter { /** * Use this API to fetch all the csparameter resources that are configured on netscaler . */
public static csparameter get ( nitro_service service ) throws Exception { } } | csparameter obj = new csparameter ( ) ; csparameter [ ] response = ( csparameter [ ] ) obj . get_resources ( service ) ; return response [ 0 ] ; |
public class ProjectManager { /** * @ param projectKey string - based project key ( like " TEST " )
* @ return list of project members ( users or groups ) */
public List < Membership > getProjectMembers ( String projectKey ) throws RedmineException { } } | return transport . getChildEntries ( Project . class , projectKey , Membership . class ) ; |
public class MessageRenderer { /** * Renders a single message
* @ param msg message to render
* @ return string with the rendered message , empty if parameter was null */
public String render ( Message5WH msg ) { } } | if ( msg != null ) { ST ret = this . stg . getInstanceOf ( "message5wh" ) ; if ( msg . getWhereLocation ( ) != null ) { ST where = this . stg . getInstanceOf ( "where" ) ; where . add ( "location" , msg . getWhereLocation ( ) ) ; if ( msg . getWhereLine ( ) > 0 ) { where . add ( "line" , msg . getWhereLine ( ) ) ; } if ( msg . getWhereColumn ( ) > 0 ) { where . add ( "column" , msg . getWhereColumn ( ) ) ; } ret . add ( "where" , where ) ; } ret . add ( "reporter" , msg . getReporter ( ) ) ; if ( msg . getType ( ) != null ) { Map < String , Boolean > typeMap = new HashMap < > ( ) ; typeMap . put ( msg . getType ( ) . toString ( ) , true ) ; ret . add ( "type" , typeMap ) ; } if ( msg . getWhat ( ) != null && ! StringUtils . isBlank ( msg . getWhat ( ) . toString ( ) ) ) { ret . add ( "what" , msg . getWhat ( ) ) ; } ret . add ( "who" , msg . getWho ( ) ) ; ret . add ( "when" , msg . getWhen ( ) ) ; ret . add ( "why" , msg . getWhy ( ) ) ; ret . add ( "how" , msg . getHow ( ) ) ; return ret . render ( ) ; } return "" ; |
public class LRSigner { /** * Helper for map normalization ; inspects list and returns
* a replacement list that has been normalized .
* @ param list
* @ return Normalized list for encoding / hashing / signing */
private List < Object > normalizeList ( List < Object > list ) { } } | List < Object > result = new ArrayList < Object > ( ) ; for ( Object o : list ) { if ( o == null ) { result . add ( nullLiteral ) ; } else if ( o instanceof Boolean ) { result . add ( ( ( Boolean ) o ) . toString ( ) ) ; } else if ( o instanceof List < ? > ) { result . add ( normalizeList ( ( List < Object > ) o ) ) ; } else if ( o instanceof Map < ? , ? > ) { result . add ( normalizeMap ( ( Map < String , Object > ) o ) ) ; } else if ( ! ( o instanceof Number ) ) { result . add ( o ) ; } } return result ; |
public class ExampleDetectDescribe { /** * Any arbitrary implementation of InterestPointDetector , OrientationImage , DescribeRegionPoint
* can be combined into DetectDescribePoint . The syntax is more complex , but the end result is more flexible .
* This should only be done if there isn ' t a pre - made DetectDescribePoint . */
public static < T extends ImageGray < T > , TD extends TupleDesc > DetectDescribePoint < T , TD > createFromComponents ( Class < T > imageType ) { } } | // create a corner detector
Class derivType = GImageDerivativeOps . getDerivativeType ( imageType ) ; GeneralFeatureDetector corner = FactoryDetectPoint . createShiTomasi ( new ConfigGeneralDetector ( 1000 , 5 , 1 ) , null , derivType ) ; InterestPointDetector detector = FactoryInterestPoint . wrapPoint ( corner , 1 , imageType , derivType ) ; // describe points using BRIEF
DescribeRegionPoint describe = FactoryDescribeRegionPoint . brief ( new ConfigBrief ( true ) , imageType ) ; // Combine together .
// NOTE : orientation will not be estimated
return FactoryDetectDescribe . fuseTogether ( detector , null , describe ) ; |
public class SampleClient { /** * Demonstrates obtaining the request history data from a test run */
public static void getHistory ( ) throws Exception { } } | Client client = new Client ( "ProfileName" , false ) ; // Obtain the 100 history entries starting from offset 0
History [ ] history = client . refreshHistory ( 100 , 0 ) ; client . clearHistory ( ) ; |
public class Binder { /** * Process the incoming arguments using the given handle , leaving the argument list
* unmodified .
* @ param function the function that will process the incoming arguments . Its
* signature must match the current signature ' s arguments exactly .
* @ return a new Binder */
public Binder foldVoid ( MethodHandle function ) { } } | if ( type ( ) . returnType ( ) == void . class ) { return fold ( function ) ; } else { return fold ( function . asType ( function . type ( ) . changeReturnType ( void . class ) ) ) ; } |
public class WrappingSimonDataSource { /** * Attempts to establish a connection with the data source that this { @ code DataSource } object represents .
* @ param user the database user on whose behalf the connection is being made
* @ param password the user ' s password
* @ return a connection to the data source
* @ throws SQLException if a database access error occurs */
@ Override public Connection getConnection ( String user , String password ) throws SQLException { } } | return new SimonConnection ( getDataSource ( ) . getConnection ( user , password ) , getPrefix ( ) ) ; |
public class Maps { /** * Read cp maps .
* @ param fin the fin
* @ throws IOException Signals that an I / O exception has occurred . */
public void readCpMaps ( BufferedReader fin ) throws IOException { } } | if ( cpStr2Int != null ) { cpStr2Int . clear ( ) ; } else { cpStr2Int = new HashMap ( ) ; } if ( cpInt2Str != null ) { cpInt2Str . clear ( ) ; } else { cpInt2Str = new HashMap ( ) ; } String line ; // get size of context predicate map
if ( ( line = fin . readLine ( ) ) == null ) { System . out . println ( "No context predicate map size information" ) ; return ; } int numCps = Integer . parseInt ( line ) ; if ( numCps <= 0 ) { System . out . println ( "Invalid mapping size" ) ; return ; } System . out . println ( "Reading the context predicate maps ..." ) ; for ( int i = 0 ; i < numCps ; i ++ ) { line = fin . readLine ( ) ; if ( line == null ) { System . out . println ( "Invalid context predicate mapping line" ) ; return ; } StringTokenizer strTok = new StringTokenizer ( line , " \t\r\n" ) ; if ( strTok . countTokens ( ) != 2 ) { continue ; } String cpStr = strTok . nextToken ( ) ; String cpInt = strTok . nextToken ( ) ; cpStr2Int . put ( cpStr , new Integer ( cpInt ) ) ; cpInt2Str . put ( new Integer ( cpInt ) , cpStr ) ; } System . out . println ( "Reading context predicate maps (" + Integer . toString ( cpStr2Int . size ( ) ) + " entries) completed!" ) ; // read the line # # # . . .
line = fin . readLine ( ) ; |
public class RangeValuesMaker { /** * Factory method . Given a list of values and the produced maker will exhaust them before throwing an exception .
* @ param first
* first value
* @ param rest
* rest of the values
* @ param < T >
* value type
* @ return a RangeValuesMaker */
public static < T > Maker < T > errorOnEnd ( T first , T ... rest ) { } } | ImmutableList < T > values = ImmutableList . < T > builder ( ) . add ( first ) . add ( rest ) . build ( ) ; return new RangeValuesMaker < T > ( values . iterator ( ) ) ; |
public class FileMgr { /** * Reads the contents of a disk block into a byte buffer .
* @ param blk
* a block ID
* @ param buffer
* the byte buffer */
void read ( BlockId blk , IoBuffer buffer ) { } } | try { IoChannel fileChannel = getFileChannel ( blk . fileName ( ) ) ; // clear the buffer
buffer . clear ( ) ; // read a block from file
fileChannel . read ( buffer , blk . number ( ) * BLOCK_SIZE ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw new RuntimeException ( "cannot read block " + blk ) ; } |
public class AttributesBuilder { /** * Creates attributes builder .
* @ return atributes builder . */
public static AttributesBuilder attributes ( String [ ] arguments ) { } } | AttributesBuilder attributesBuilder = new AttributesBuilder ( ) ; attributesBuilder . arguments ( arguments ) ; return attributesBuilder ; |
public class GenericDao { /** * 批量更新
* @ param entities
* @ return */
public int update ( List < ENTITY > entities ) { } } | if ( entities == null || entities . size ( ) == 0 ) { recordLog ( " param entity is null!" ) ; return 0 ; } final List < Query > queries = queryGenerator . getUpdateQuery ( entities ) ; String sql = queries . get ( 0 ) . getSql ( ) ; jdbcTemplate . batchUpdate ( sql , new BatchPreparedStatementSetter ( ) { public void setValues ( PreparedStatement stmt , int index ) throws SQLException { int i = 1 ; List < Object > params = queries . get ( index ) . getParams ( ) ; for ( Object o : params ) { stmt . setObject ( i ++ , o ) ; } } public int getBatchSize ( ) { return queries . size ( ) ; } } ) ; return entities . size ( ) ; |
public class BaseFlashCreative { /** * Sets the flashAsset value for this BaseFlashCreative .
* @ param flashAsset * The flash asset . This attribute is required . To view the Flash
* image , use the
* { @ link CreativeAsset # assetUrl } . */
public void setFlashAsset ( com . google . api . ads . admanager . axis . v201805 . CreativeAsset flashAsset ) { } } | this . flashAsset = flashAsset ; |
public class JTSPolygonExpression { /** * Returns the exterior ring of this Polygon .
* @ return exterior ring */
public JTSLineStringExpression < ? > exteriorRing ( ) { } } | if ( exteriorRing == null ) { exteriorRing = JTSGeometryExpressions . lineStringOperation ( SpatialOps . EXTERIOR_RING , mixin ) ; } return exteriorRing ; |
public class AbstractIntList { /** * Appends the part of the specified list between < code > from < / code > ( inclusive ) and < code > to < / code > ( inclusive ) to the receiver .
* @ param other the list to be added to the receiver .
* @ param from the index of the first element to be appended ( inclusive ) .
* @ param to the index of the last element to be appended ( inclusive ) .
* @ exception IndexOutOfBoundsException index is out of range ( < tt > other . size ( ) & gt ; 0 & & ( from & lt ; 0 | | from & gt ; to | | to & gt ; = other . size ( ) ) < / tt > ) . */
public void addAllOfFromTo ( AbstractIntList other , int from , int to ) { } } | beforeInsertAllOfFromTo ( size , other , from , to ) ; |
public class JQLChecker { /** * Given a sql , replace som component like where , order by , etc . .
* Note that only first level of variable statements will be replaced .
* @ param jqlContext
* the jql context
* @ param jql
* the jql
* @ param listener
* the listener
* @ return the string */
public String replaceVariableStatements ( final JQLContext jqlContext , final String jql , final JQLReplaceVariableStatementListener listener ) { } } | final List < Triple < Token , Token , String > > replace = new ArrayList < > ( ) ; final One < Integer > currentSelectLevel = new One < Integer > ( - 1 ) ; JqlBaseListener rewriterListener = new JqlBaseListener ( ) { @ Override public void enterSelect_core ( Select_coreContext ctx ) { currentSelectLevel . value0 ++ ; } @ Override public void enterSelect_or_values ( Select_or_valuesContext ctx ) { currentSelectLevel . value0 ++ ; } @ Override public void exitSelect_core ( Select_coreContext ctx ) { currentSelectLevel . value0 -- ; } @ Override public void exitSelect_or_values ( Select_or_valuesContext ctx ) { currentSelectLevel . value0 -- ; } @ Override public void enterProjected_columns ( Projected_columnsContext ctx ) { // we work on level 0
if ( currentSelectLevel . value0 > 0 ) return ; int start = ctx . getStart ( ) . getStartIndex ( ) - 1 ; int stop = ctx . getStop ( ) . getStopIndex ( ) + 1 ; if ( start == stop ) return ; String statement = jql . substring ( start , stop ) ; String value = listener . onProjectedColumns ( statement ) ; if ( value != null ) { replace . add ( new Triple < Token , Token , String > ( ctx . start , ctx . stop , value ) ) ; } } @ Override public void enterWhere_stmt ( Where_stmtContext ctx ) { // we work on level 0
if ( currentSelectLevel . value0 > 0 ) return ; int start = ctx . getStart ( ) . getStartIndex ( ) - 1 ; int stop = ctx . getStop ( ) . getStopIndex ( ) + 1 ; if ( start == stop ) return ; String statement = jql . substring ( start , stop ) ; String value = listener . onWhere ( statement ) ; if ( value != null ) { replace . add ( new Triple < Token , Token , String > ( ctx . start , ctx . stop , value ) ) ; } } @ Override public void enterOrder_stmt ( Order_stmtContext ctx ) { // we work on level 0
if ( currentSelectLevel . value0 > 0 ) return ; int start = ctx . getStart ( ) . getStartIndex ( ) - 1 ; int stop = ctx . getStop ( ) . getStopIndex ( ) + 1 ; if ( start == stop ) return ; String statement = jql . substring ( start , stop ) ; String value = listener . onOrderBy ( statement ) ; if ( value != null ) { replace . add ( new Triple < Token , Token , String > ( ctx . start , ctx . stop , value ) ) ; } } @ Override public void enterGroup_stmt ( Group_stmtContext ctx ) { // we work on level 0
if ( currentSelectLevel . value0 > 0 ) return ; int start = ctx . getStart ( ) . getStartIndex ( ) - 1 ; int stop = ctx . getStop ( ) . getStopIndex ( ) + 1 ; if ( start == stop ) return ; String statement = jql . substring ( start , stop ) ; String value = listener . onGroup ( statement ) ; if ( value != null ) { replace . add ( new Triple < Token , Token , String > ( ctx . start , ctx . stop , value ) ) ; } } @ Override public void enterHaving_stmt ( Having_stmtContext ctx ) { // we work on level 0
if ( currentSelectLevel . value0 > 0 ) return ; int start = ctx . getStart ( ) . getStartIndex ( ) - 1 ; int stop = ctx . getStop ( ) . getStopIndex ( ) + 1 ; if ( start == stop ) return ; String statement = jql . substring ( start , stop ) ; String value = listener . onHaving ( statement ) ; if ( value != null ) { replace . add ( new Triple < Token , Token , String > ( ctx . start , ctx . stop , value ) ) ; } } @ Override public void enterOffset_stmt ( Offset_stmtContext ctx ) { // we work on level 0
if ( currentSelectLevel . value0 > 0 ) return ; int start = ctx . getStart ( ) . getStartIndex ( ) - 1 ; int stop = ctx . getStop ( ) . getStopIndex ( ) + 1 ; if ( start == stop ) return ; String statement = jql . substring ( start , stop ) ; String value = listener . onOffset ( statement ) ; if ( value != null ) { replace . add ( new Triple < Token , Token , String > ( ctx . start , ctx . stop , value ) ) ; } } @ Override public void enterLimit_stmt ( Limit_stmtContext ctx ) { // we work on level 0
if ( currentSelectLevel . value0 > 0 ) return ; int start = ctx . getStart ( ) . getStartIndex ( ) - 1 ; int stop = ctx . getStop ( ) . getStopIndex ( ) + 1 ; if ( start == stop ) return ; String statement = jql . substring ( start , stop ) ; String value = listener . onLimit ( statement ) ; if ( value != null ) { replace . add ( new Triple < Token , Token , String > ( ctx . start , ctx . stop , value ) ) ; } } @ Override public void enterColumn_name_set ( Column_name_setContext ctx ) { // we work on level 0
if ( currentSelectLevel . value0 > 0 ) return ; int start = ctx . getStart ( ) . getStartIndex ( ) - 1 ; int stop = ctx . getStop ( ) . getStopIndex ( ) + 2 ; if ( start == stop ) return ; String statement = jql . substring ( start , stop ) ; String value = listener . onColumnNameSet ( statement ) ; if ( value != null ) { replace . add ( new Triple < Token , Token , String > ( ctx . start , ctx . stop , value ) ) ; } } @ Override public void enterColumn_value_set ( Column_value_setContext ctx ) { // we work on level 0
if ( currentSelectLevel . value0 > 0 ) return ; int start = ctx . getStart ( ) . getStartIndex ( ) - 1 ; int stop = ctx . getStop ( ) . getStopIndex ( ) + 2 ; if ( start == stop ) return ; String statement = jql . substring ( start , stop ) ; String value = listener . onColumnValueSet ( statement ) ; if ( value != null ) { replace . add ( new Triple < Token , Token , String > ( ctx . start , ctx . stop , value ) ) ; } } } ; return replaceInternal ( jqlContext , jql , replace , rewriterListener ) ; |
public class ConfigUtils { /** * Method is used to return an InetSocketAddress from a hostname : port string .
* @ param config config to read the value from
* @ param key key for the value
* @ return InetSocketAddress for the supplied string . */
public static InetSocketAddress inetSocketAddress ( AbstractConfig config , String key ) { } } | Preconditions . checkNotNull ( config , "config cannot be null" ) ; String value = config . getString ( key ) ; return parseInetSocketAddress ( value ) ; |
public class DeleteScheduledAuditRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteScheduledAuditRequest deleteScheduledAuditRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteScheduledAuditRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteScheduledAuditRequest . getScheduledAuditName ( ) , SCHEDULEDAUDITNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MongodbQueueFactory { /** * Setter for { @ link # defaultMongoClient } .
* @ param mongoClient
* @ return */
public MongodbQueueFactory < T , ID , DATA > setDefaultMongoClient ( MongoClient mongoClient ) { } } | return setDefaultMongoClient ( mongoClient , false ) ; |
public class JmxValueFormatterImpl { /** * Returns value as a Character List .
* @ param value array to convert .
* @ return value as a Character List . */
private List < Character > asCharList ( Object value ) { } } | char [ ] values = ( char [ ] ) value ; List < Character > list = new ArrayList < Character > ( values . length ) ; for ( char charValue : values ) { list . add ( charValue ) ; } return list ; |
public class ResolvedTypes { /** * / * @ Nullable */
private LightweightTypeReference getMergedType ( MergeData mergeData , List < TypeData > values ) { } } | LightweightTypeReference mergedType = ! mergeData . references . isEmpty ( ) || ! mergeData . voidSeen ? getMergedType ( /* mergedFlags , */
mergeData . references ) : values . get ( 0 ) . getActualType ( ) ; return mergedType ; |
public class RaftContext { /** * Sets the state last voted for candidate .
* @ param candidate The candidate that was voted for . */
public void setLastVotedFor ( MemberId candidate ) { } } | // If we ' ve already voted for another candidate in this term then the last voted for candidate cannot be overridden .
checkState ( ! ( lastVotedFor != null && candidate != null ) , "Already voted for another candidate" ) ; DefaultRaftMember member = cluster . getMember ( candidate ) ; checkState ( member != null , "Unknown candidate: %d" , candidate ) ; this . lastVotedFor = candidate ; meta . storeVote ( this . lastVotedFor ) ; if ( candidate != null ) { log . debug ( "Voted for {}" , member . memberId ( ) ) ; } else { log . trace ( "Reset last voted for" ) ; } |
public class WebSiteManagementClientImpl { /** * Validate if a resource can be created .
* Validate if a resource can be created .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param validateRequest Request with the resources to validate .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws DefaultErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the ValidateResponseInner object if successful . */
public ValidateResponseInner validate ( String resourceGroupName , ValidateRequest validateRequest ) { } } | return validateWithServiceResponseAsync ( resourceGroupName , validateRequest ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class GeneralVarTagBinding { /** * 按照标签变量声明的顺序绑定
* @ param array */
public void binds ( Object ... array ) { } } | if ( name2Index == null ) { throw new RuntimeException ( "html标签没有定义绑定变量,但标签实现中试图绑定" + Arrays . asList ( array ) ) ; } Iterator < Integer > it = name2Index . values ( ) . iterator ( ) ; for ( int i = 0 ; i < array . length ; i ++ ) { int index = it . next ( ) ; ctx . vars [ index ] = array [ i ] ; } |
public class AtomicBigInteger { /** * Atomically adds the given value to the current value .
* @ param delta the value to add
* @ return the previous value */
public BigInteger getAndAdd ( BigInteger delta ) { } } | while ( true ) { BigInteger current = get ( ) ; BigInteger next = current . add ( delta ) ; if ( compareAndSet ( current , next ) ) return current ; } |
public class WordNet { /** * 获取顶点数组
* @ return Vertex [ ] 按行优先列次之的顺序构造的顶点数组 */
private Vertex [ ] getVertexesLineFirst ( ) { } } | Vertex [ ] vertexes = new Vertex [ size ] ; int i = 0 ; for ( List < Vertex > vertexList : this . vertexes ) { for ( Vertex v : vertexList ) { v . index = i ; // 设置id
vertexes [ i ++ ] = v ; } } return vertexes ; |
public class AbstractRadial { /** * Enables or disables the visibility of the lcd display
* @ param LCD _ VISIBLE */
public void setLcdVisible ( final boolean LCD_VISIBLE ) { } } | getModel ( ) . setLcdVisible ( LCD_VISIBLE ) ; init ( getInnerBounds ( ) . width , getInnerBounds ( ) . height ) ; repaint ( getInnerBounds ( ) ) ; |
public class DataUnitBuilder { /** * Decodes a transport layer protocol control information into a textual
* representation .
* @ param tpci transport layer protocol control information
* @ param dst KNX destination address belonging to the tpci , might be
* < code > null < / code >
* @ return textual representation of TPCI */
public static String decodeTPCI ( int tpci , KNXAddress dst ) { } } | final int ctrl = tpci & 0xff ; if ( ( ctrl & 0xFC ) == 0 ) { if ( dst == null ) return "T-broadcast/group/ind" ; if ( dst . getRawAddress ( ) == 0 ) return "T-broadcast" ; if ( dst instanceof GroupAddress ) return "T-group" ; return "T-individual" ; } if ( ( ctrl & 0xC0 ) == 0x40 ) return "T-connected seq " + ( ctrl >> 2 & 0xF ) ; if ( ctrl == T_CONNECT ) return "T-connect" ; if ( ctrl == T_DISCONNECT ) return "T-disconnect" ; if ( ( ctrl & 0xC3 ) == T_ACK ) return "T-ack seq " + ( ctrl >> 2 & 0xF ) ; if ( ( ctrl & 0xC3 ) == T_NAK ) return "T-nak seq " + ( ctrl >> 2 & 0xF ) ; return "unknown TPCI" ; |
public class Builder { /** * This method can be used as an optimization to filter out
* certificates that do not have policies which are valid .
* It returns the set of policies ( String OIDs ) that should exist in
* the certificate policies extension of the certificate that is
* needed by the builder . The logic applied is as follows :
* 1 ) If some initial policies have been set * and * policy mappings are
* inhibited , then acceptable certificates are those that include
* the ANY _ POLICY OID or with policies that intersect with the
* initial policies .
* 2 ) If no initial policies have been set * or * policy mappings are
* not inhibited then we don ' t have much to work with . All we know is
* that a certificate must have * some * policy because if it didn ' t
* have any policy then the policy tree would become null ( and validation
* would fail ) .
* @ return the Set of policies any of which must exist in a
* cert ' s certificate policies extension in order for a cert to be selected . */
Set < String > getMatchingPolicies ( ) { } } | if ( matchingPolicies != null ) { Set < String > initialPolicies = buildParams . initialPolicies ( ) ; if ( ( ! initialPolicies . isEmpty ( ) ) && ( ! initialPolicies . contains ( PolicyChecker . ANY_POLICY ) ) && ( buildParams . policyMappingInhibited ( ) ) ) { matchingPolicies = new HashSet < > ( initialPolicies ) ; matchingPolicies . add ( PolicyChecker . ANY_POLICY ) ; } else { // we just return an empty set to make sure that there is
// at least a certificate policies extension in the cert
matchingPolicies = Collections . < String > emptySet ( ) ; } } return matchingPolicies ; |
public class SqlExecutor { /** * 批量执行非查询语句 < br >
* 语句包括 插入 、 更新 、 删除 < br >
* 此方法不会关闭Connection
* @ param conn 数据库连接对象
* @ param sqls SQL列表
* @ return 每个SQL执行影响的行数
* @ throws SQLException SQL执行异常
* @ since 4.5.6 */
public static int [ ] executeBatch ( Connection conn , String ... sqls ) throws SQLException { } } | return executeBatch ( conn , new ArrayIter < String > ( sqls ) ) ; |
public class CupboardDbHelper { /** * Returns a raw handle to the SQLite database connection . Do not close !
* @ param context A context , which is used to ( when needed ) set up a connection to the database
* @ return The single , unique connection to the database , as is ( also ) used by our Cupboard instance */
public synchronized static SQLiteDatabase getConnection ( Context context ) { } } | if ( database == null ) { // Construct the single helper and open the unique ( ! ) db connection for the app
database = new CupboardDbHelper ( context . getApplicationContext ( ) ) . getWritableDatabase ( ) ; } return database ; |
public class MiniSatBackbone { /** * Generates a solver vector of a clause .
* @ param clause the clause
* @ return the solver vector */
private LNGIntVector generateClauseVector ( final Formula clause ) { } } | final LNGIntVector clauseVec = new LNGIntVector ( clause . numberOfOperands ( ) ) ; for ( final Literal lit : clause . literals ( ) ) { int index = this . idxForName ( lit . name ( ) ) ; if ( index == - 1 ) { index = this . newVar ( false , true ) ; this . addName ( lit . name ( ) , index ) ; } final int litNum = lit . phase ( ) ? index * 2 : ( index * 2 ) ^ 1 ; clauseVec . push ( litNum ) ; } return clauseVec ; |
public class ApiOvhOrder { /** * Create order
* REST : POST / order / cdn / dedicated / { serviceName } / backend / { duration }
* @ param backend [ required ] Backend number that will be ordered
* @ param serviceName [ required ] The internal name of your CDN offer
* @ param duration [ required ] Duration */
public OvhOrder cdn_dedicated_serviceName_backend_duration_POST ( String serviceName , String duration , Long backend ) throws IOException { } } | String qPath = "/order/cdn/dedicated/{serviceName}/backend/{duration}" ; StringBuilder sb = path ( qPath , serviceName , duration ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "backend" , backend ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhOrder . class ) ; |
public class AccessControlUtils { /** * Returns the lowest property defined on a class with visibility information . */
@ Nullable static ObjectType getObjectType ( @ Nullable ObjectType referenceType , boolean isOverride , String propertyName ) { } } | if ( referenceType == null ) { return null ; } // Find the lowest property defined on a class with visibility information .
ObjectType current = isOverride ? referenceType . getImplicitPrototype ( ) : referenceType ; for ( ; current != null ; current = current . getImplicitPrototype ( ) ) { JSDocInfo docInfo = current . getOwnPropertyJSDocInfo ( propertyName ) ; if ( docInfo != null && docInfo . getVisibility ( ) != Visibility . INHERITED ) { return current ; } } return null ; |
public class MemTokenStore { /** * / * package */
String getKey ( URL remoteURL , String localUUID ) { } } | if ( remoteURL == null ) throw new IllegalArgumentException ( "remoteURL is null" ) ; String service = remoteURL . toExternalForm ( ) ; String label = String . format ( Locale . ENGLISH , "%s OpenID Connect tokens" , remoteURL . getHost ( ) ) ; if ( localUUID == null ) return String . format ( Locale . ENGLISH , "%s%s" , label , service ) ; else return String . format ( Locale . ENGLISH , "%s%s%s" , label , service , localUUID ) ; |
public class MutableURI { /** * Set the value of the < code > MutableURI < / code > .
* < p > This method can also be used to clear the < code > MutableURI < / code > . < / p >
* @ param uri the URI */
public void setURI ( URI uri ) { } } | if ( uri == null ) { setScheme ( null ) ; setUserInfo ( null ) ; setHost ( null ) ; setPort ( UNDEFINED_PORT ) ; setPath ( null ) ; setQuery ( null ) ; setFragment ( null ) ; } else if ( uri . isOpaque ( ) ) { setUserInfo ( null ) ; setHost ( null ) ; setPort ( UNDEFINED_PORT ) ; setPath ( null ) ; setQuery ( null ) ; setOpaque ( uri . getScheme ( ) , uri . getSchemeSpecificPart ( ) ) ; setFragment ( uri . getRawFragment ( ) ) ; } else { setSchemeSpecificPart ( null ) ; setScheme ( uri . getScheme ( ) ) ; setUserInfo ( uri . getRawUserInfo ( ) ) ; setHost ( uri . getHost ( ) ) ; setPort ( uri . getPort ( ) ) ; setPath ( uri . getRawPath ( ) ) ; setQuery ( uri . getRawQuery ( ) ) ; setFragment ( uri . getRawFragment ( ) ) ; } |
public class AdminToolMenuUtils { /** * retuns the menu name for given requestUrl or the overrideName if set .
* @ param request
* @ param overrideName ( optional )
* @ return */
public String getMenuName ( HttpServletRequest request , String overrideName ) { } } | if ( ! StringUtils . isEmpty ( overrideName ) ) { return overrideName ; } String name = request . getRequestURI ( ) . replaceFirst ( AdminTool . ROOTCONTEXT , "" ) ; if ( ! StringUtils . isEmpty ( request . getContextPath ( ) ) ) { name = name . replaceFirst ( request . getContextPath ( ) , "" ) ; } if ( name . startsWith ( "/" ) ) { name = name . substring ( 1 , name . length ( ) ) ; } return name ; |
public class SslContextBuilder { /** * Identifying certificate for this host . { @ code keyCertChainInputStream } and { @ code keyInputStream } may
* be { @ code null } for client contexts , which disables mutual authentication .
* @ param keyCertChainInputStream an input stream for an X . 509 certificate chain in PEM format
* @ param keyInputStream an input stream for a PKCS # 8 private key in PEM format */
public SslContextBuilder keyManager ( InputStream keyCertChainInputStream , InputStream keyInputStream ) { } } | return keyManager ( keyCertChainInputStream , keyInputStream , null ) ; |
public class ByteArrayUtil { /** * Write a long to the byte array at the given offset .
* @ param array Array to write to
* @ param offset Offset to write to
* @ param v data
* @ return number of bytes written */
public static int writeLong ( byte [ ] array , int offset , long v ) { } } | array [ offset + 0 ] = ( byte ) ( v >>> 56 ) ; array [ offset + 1 ] = ( byte ) ( v >>> 48 ) ; array [ offset + 2 ] = ( byte ) ( v >>> 40 ) ; array [ offset + 3 ] = ( byte ) ( v >>> 32 ) ; array [ offset + 4 ] = ( byte ) ( v >>> 24 ) ; array [ offset + 5 ] = ( byte ) ( v >>> 16 ) ; array [ offset + 6 ] = ( byte ) ( v >>> 8 ) ; array [ offset + 7 ] = ( byte ) ( v >>> 0 ) ; return SIZE_LONG ; |
public class MpscAtomicArrayQueue { /** * { @ inheritDoc }
* IMPLEMENTATION NOTES : < br >
* Lock free poll using ordered loads / stores . As class name suggests access is limited to a single thread .
* @ see java . util . Queue # poll ( )
* @ see org . jctools _ voltpatches . queues . MessagePassingQueue # poll ( ) */
@ Override public E poll ( ) { } } | final long consumerIndex = lvConsumerIndex ( ) ; // LoadLoad
final int offset = calcElementOffset ( consumerIndex ) ; // Copy field to avoid re - reading after volatile load
final AtomicReferenceArray < E > buffer = this . buffer ; // If we can ' t see the next available element we can ' t poll
E e = lvElement ( buffer , offset ) ; // LoadLoad
if ( null == e ) { /* * NOTE : Queue may not actually be empty in the case of a producer ( P1 ) being interrupted after
* winning the CAS on offer but before storing the element in the queue . Other producers may go on
* to fill up the queue after this element . */
if ( consumerIndex != lvProducerIndex ( ) ) { do { e = lvElement ( buffer , offset ) ; } while ( e == null ) ; } else { return null ; } } spElement ( buffer , offset , null ) ; soConsumerIndex ( consumerIndex + 1 ) ; // StoreStore
return e ; |
public class CmsJSONSearchConfigurationParser { /** * Returns the configured Solr index , or < code > null < / code > if no core is configured .
* @ return The configured Solr index , or < code > null < / code > if no core is configured . */
protected String getIndex ( ) { } } | try { return m_configObject . getString ( JSON_KEY_INDEX ) ; } catch ( JSONException e ) { if ( null == m_baseConfig ) { if ( LOG . isInfoEnabled ( ) ) { LOG . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_NO_INDEX_SPECIFIED_0 ) , e ) ; } return null ; } else { return m_baseConfig . getGeneralConfig ( ) . getSolrIndex ( ) ; } } |
public class StaticWord2Vec { /** * Words nearest based on positive and negative words
* PLEASE NOTE : This method is not available in this implementation .
* @ param positive the positive words
* @ param negative the negative words
* @ param top the top n words
* @ return the words nearest the mean of the words */
@ Override public Collection < String > wordsNearest ( Collection < String > positive , Collection < String > negative , int top ) { } } | throw new UnsupportedOperationException ( "Method isn't implemented. Please use usual Word2Vec implementation" ) ; |
public class UnionType { /** * Use UnionTypeBuilder to rebuild the list of alternates and hashcode of the current UnionType . */
private void rebuildAlternates ( ) { } } | UnionTypeBuilder builder = UnionTypeBuilder . create ( registry ) ; builder . addAlternates ( alternates ) ; alternates = builder . getAlternates ( ) ; |
public class RouterMiddleware { /** * Creates a { @ link Route } object and adds it to the routes list . It will respond to the GET HTTP method and the
* specified < code > path < / code > invoking the { @ link RouteHandler } object .
* @ param path the path to which this route will respond .
* @ param handler the object that will be invoked when the route matches . */
public void get ( String path , RouteHandler handler ) { } } | try { addRoute ( HttpMethod . GET , path , handler , "handle" ) ; } catch ( NoSuchMethodException e ) { // shouldn ' t happen unless we change the name of the method in RouteHandler
throw new RuntimeException ( e ) ; } |
public class VirtualMachineImagesInner { /** * Gets a virtual machine image .
* @ param location The name of a supported Azure region .
* @ param publisherName A valid image publisher .
* @ param offer A valid image publisher offer .
* @ param skus A valid image SKU .
* @ param version A valid image SKU version .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the VirtualMachineImageInner object */
public Observable < VirtualMachineImageInner > getAsync ( String location , String publisherName , String offer , String skus , String version ) { } } | return getWithServiceResponseAsync ( location , publisherName , offer , skus , version ) . map ( new Func1 < ServiceResponse < VirtualMachineImageInner > , VirtualMachineImageInner > ( ) { @ Override public VirtualMachineImageInner call ( ServiceResponse < VirtualMachineImageInner > response ) { return response . body ( ) ; } } ) ; |
public class JFSTextScroller { /** * Set the value .
* @ param objValue The raw data ( a Boolean ) . */
public void setControlValue ( Object objValue ) { } } | if ( objValue instanceof String ) m_control . setText ( objValue . toString ( ) ) ; m_bDirty = false ; |
public class CipherUtils { /** * Encrypts the given data using the given key . The key holds the algorithm used for encryption . If you are
* encrypting data that is supposed to be a string , consider that it might be Base64 - encoded .
* @ throws EncryptionException if the string cannot be encrypted with the given key */
public static byte [ ] encrypt ( byte [ ] text , Key key ) throws EncryptionException { } } | return encrypt ( text , key , key . getAlgorithm ( ) ) ; |
public class OWLDataSomeValuesFromImpl_CustomFieldSerializer { /** * Serializes the content of the object into the
* { @ link com . google . gwt . user . client . rpc . SerializationStreamWriter } .
* @ param streamWriter the { @ link com . google . gwt . user . client . rpc . SerializationStreamWriter } to write the
* object ' s content to
* @ param instance the object instance to serialize
* @ throws com . google . gwt . user . client . rpc . SerializationException
* if the serialization operation is not
* successful */
@ Override public void serializeInstance ( SerializationStreamWriter streamWriter , OWLDataSomeValuesFromImpl instance ) throws SerializationException { } } | serialize ( streamWriter , instance ) ; |
public class J4pRequestHandler { /** * Extract the complete JSON response out of a HTTP response
* @ param pHttpResponse the resulting http response
* @ return JSON content of the answer */
@ SuppressWarnings ( "PMD.PreserveStackTrace" ) public JSONAware extractJsonResponse ( HttpResponse pHttpResponse ) throws IOException , ParseException { } } | HttpEntity entity = pHttpResponse . getEntity ( ) ; try { JSONParser parser = new JSONParser ( ) ; Header contentEncoding = entity . getContentEncoding ( ) ; if ( contentEncoding != null ) { return ( JSONAware ) parser . parse ( new InputStreamReader ( entity . getContent ( ) , Charset . forName ( contentEncoding . getValue ( ) ) ) ) ; } else { return ( JSONAware ) parser . parse ( new InputStreamReader ( entity . getContent ( ) ) ) ; } } finally { if ( entity != null ) { EntityUtils . consume ( entity ) ; } } |
public class Filter { /** * { @ inheritDoc } */
@ Override public void map ( Key key , Value value , Context context ) throws IOException , InterruptedException { } } | writer . setContext ( context ) ; init ( ) ; Record record = new Record ( ) ; if ( inputLabels != null ) { int i = 0 ; for ( ValueWritable vw : key . getGrouping ( ) ) { vw . getLabel ( ) . set ( inputLabels [ i ++ ] ) ; } for ( ValueWritable vw : value . getValues ( ) ) { vw . getLabel ( ) . set ( inputLabels [ i ++ ] ) ; } } record . setKey ( key ) ; record . setValue ( value ) ; writer . setDefaultRecord ( record ) ; filter ( record , writer ) ; |
public class AnnotationUtils { /** * Recursive annotation search on type , it annotations and parents hierarchy . Interfaces ignored .
* @ param type
* { @ link Class }
* @ param targetAnnotationClass
* required { @ link Annotation } class
* @ param < A >
* type param
* @ return { @ link A } in case if found , { @ code null } otherwise */
public static < A extends Annotation > A findTypeAnnotation ( final Class < ? > type , final Class < A > targetAnnotationClass ) { } } | Objects . requireNonNull ( type , "incoming 'type' is not valid" ) ; Objects . requireNonNull ( targetAnnotationClass , "incoming 'targetAnnotationClass' is not valid" ) ; if ( type . equals ( Object . class ) ) return null ; // check annotation presence on class itself and its annotations if any
final A annotation = findAnnotation ( type , targetAnnotationClass ) ; if ( annotation != null ) return annotation ; // recursive call to check superclass if present
final Class < ? > superClass = type . getSuperclass ( ) ; if ( superClass != null ) return findTypeAnnotation ( superClass , targetAnnotationClass ) ; return null ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.