signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Dates { /** * 添加小时
* @ param date
* @ param hours
* @ return */
public static Date plusHours ( Date date , int hours ) { } } | return plus ( date , hours , DateTimeField . HOURS ) ; |
public class SybylAtomTypeMatcher { /** * { @ inheritDoc } */
@ Override public IAtomType [ ] findMatchingAtomTypes ( IAtomContainer atomContainer ) throws CDKException { } } | for ( IAtom atom : atomContainer . atoms ( ) ) { IAtomType type = cdkMatcher . findMatchingAtomType ( atomContainer , atom ) ; atom . setAtomTypeName ( type == null ? null : type . getAtomTypeName ( ) ) ; atom . setHybridization ( type == null ? null : type . getHybridization ( ) ) ; } Aromaticity . cdkLegacy ( ) . apply ( atomContainer ) ; IAtomType [ ] types = new IAtomType [ atomContainer . getAtomCount ( ) ] ; int typeCounter = 0 ; for ( IAtom atom : atomContainer . atoms ( ) ) { String mappedType = mapCDKToSybylType ( atom ) ; if ( mappedType == null ) { types [ typeCounter ] = null ; } else { types [ typeCounter ] = factory . getAtomType ( mappedType ) ; } typeCounter ++ ; } return types ; |
public class ResponseStatusDetails { /** * Stringify the status details and the status in a best effort manner . */
public static String stringify ( final ResponseStatus status , final ResponseStatusDetails details ) { } } | String result = status . toString ( ) ; if ( details != null ) { result = result + " (Context: " + details . context ( ) + ", Reference: " + details . reference ( ) + ")" ; } return result ; |
public class RouterImpl { /** * It is not consistent that this particular injector handles implementations from both core and server */
private final Route calculateRoute ( HttpMethod httpMethod , String requestUri /* , ActionInvoker invoker */
/* , Injector injector */
) throws RouteException { } } | if ( routes == null ) throw new IllegalStateException ( "Routes have not been compiled. Call #compileRoutes() first" ) ; final Route route = matchCustom ( httpMethod , requestUri ) ; if ( route != null ) return route ; // nothing is found - try to deduce a route from controllers
// if ( isDev ) {
try { return matchStandard ( httpMethod , requestUri , invoker /* injector */
) ; } catch ( ClassLoadException e ) { // a route could not be deduced
} throw new RouteException ( "Failed to map resource to URI: " + requestUri ) ; |
public class BaseTable { /** * Reposition to this record using this bookmark .
* @ param bookmark The handle to use to position the record .
* @ param iHandleType The type of handle ( DATA _ SOURCE / OBJECT _ ID , OBJECT _ SOURCE , BOOKMARK ) .
* @ return - true - record found / false - record not found
* @ exception FILE _ NOT _ OPEN .
* @ exception DBException File exception . */
public boolean doSetHandle ( Object bookmark , int iHandleType ) throws DBException { } } | switch ( iHandleType ) { case DBConstants . DATA_SOURCE_HANDLE : m_dataSource = bookmark ; return true ; // Success
case DBConstants . OBJECT_ID_HANDLE : m_objectID = bookmark ; // Override this to make it work
return true ; // Success
case DBConstants . OBJECT_SOURCE_HANDLE : case DBConstants . FULL_OBJECT_HANDLE : // Override to handle this case .
return true ; // Success ?
case DBConstants . BOOKMARK_HANDLE : default : this . getRecord ( ) . getKeyArea ( DBConstants . MAIN_KEY_AREA ) . reverseBookmark ( bookmark , DBConstants . FILE_KEY_AREA ) ; String strCurrentOrder = this . getRecord ( ) . getKeyArea ( ) . getKeyName ( ) ; this . getRecord ( ) . setKeyArea ( DBConstants . MAIN_KEY_AREA ) ; m_bIsOpen = false ; boolean bSuccess = this . doSeek ( "=" ) ; m_bIsOpen = true ; this . getRecord ( ) . setKeyArea ( strCurrentOrder ) ; return bSuccess ; } |
public class SizeBasedTriggeringPolicy { /** * { @ inheritDoc } */
public boolean isTriggeringEvent ( final Appender appender , final LoggingEvent event , final String file , final long fileLength ) { } } | // System . out . println ( " Size " + file . length ( ) ) ;
return ( fileLength >= maxFileSize ) ; |
public class EvaluateCIndex { /** * Evaluate a single clustering .
* @ param db Database
* @ param rel Data relation
* @ param c Clustering
* @ return C - Index */
public double evaluateClustering ( Database db , Relation < ? extends O > rel , DistanceQuery < O > dq , Clustering < ? > c ) { } } | List < ? extends Cluster < ? > > clusters = c . getAllClusters ( ) ; // Count ignored noise , and within - cluster distances
int ignorednoise = 0 , w = 0 ; for ( Cluster < ? > cluster : clusters ) { if ( cluster . size ( ) <= 1 || cluster . isNoise ( ) ) { switch ( noiseOption ) { case IGNORE_NOISE : ignorednoise += cluster . size ( ) ; continue ; // Ignore
case TREAT_NOISE_AS_SINGLETONS : continue ; // No within - cluster distances !
case MERGE_NOISE : break ; // Treat like a cluster
default : LOG . warning ( "Unknown noise handling option: " + noiseOption ) ; } } w += ( cluster . size ( ) * ( cluster . size ( ) - 1 ) ) >>> 1 ; } // TODO : for small k = 2 , and balanced clusters , it may be more efficient to
// just build a long array with all distances , and select the quantiles .
// The heaps used below pay off in memory consumption for k > 2
// Yes , maxDists is supposed to be a min heap , and the other way .
// Because we want to replace the smallest of the current k - largest
// distances .
DoubleHeap maxDists = new DoubleMinHeap ( w ) ; DoubleHeap minDists = new DoubleMaxHeap ( w ) ; double theta = 0. ; // Sum of within - cluster distances
FiniteProgress prog = LOG . isVerbose ( ) ? new FiniteProgress ( "Processing clusters for C-Index" , clusters . size ( ) , LOG ) : null ; for ( int i = 0 ; i < clusters . size ( ) ; i ++ ) { Cluster < ? > cluster = clusters . get ( i ) ; if ( cluster . size ( ) <= 1 || cluster . isNoise ( ) ) { switch ( noiseOption ) { case IGNORE_NOISE : LOG . incrementProcessed ( prog ) ; continue ; // Ignore
case TREAT_NOISE_AS_SINGLETONS : processSingleton ( cluster , rel , dq , maxDists , minDists , w ) ; LOG . incrementProcessed ( prog ) ; continue ; case MERGE_NOISE : break ; // Treat like a cluster , below
} } theta += processCluster ( cluster , clusters , i , dq , maxDists , minDists , w ) ; LOG . incrementProcessed ( prog ) ; } LOG . ensureCompleted ( prog ) ; // Simulate best and worst cases :
double min = 0 , max = 0 ; // Sum of largest and smallest
assert ( minDists . size ( ) == w ) ; assert ( maxDists . size ( ) == w ) ; for ( DoubleHeap . UnsortedIter it = minDists . unsortedIter ( ) ; it . valid ( ) ; it . advance ( ) ) { min += it . get ( ) ; } for ( DoubleHeap . UnsortedIter it = maxDists . unsortedIter ( ) ; it . valid ( ) ; it . advance ( ) ) { max += it . get ( ) ; } assert ( max >= min ) ; double cIndex = ( max > min ) ? ( theta - min ) / ( max - min ) : 1. ; if ( LOG . isStatistics ( ) ) { LOG . statistics ( new StringStatistic ( key + ".c-index.noise-handling" , noiseOption . toString ( ) ) ) ; if ( ignorednoise > 0 ) { LOG . statistics ( new LongStatistic ( key + ".c-index.ignored" , ignorednoise ) ) ; } LOG . statistics ( new DoubleStatistic ( key + ".c-index" , cIndex ) ) ; } EvaluationResult ev = EvaluationResult . findOrCreate ( db . getHierarchy ( ) , c , "Internal Clustering Evaluation" , "internal evaluation" ) ; MeasurementGroup g = ev . findOrCreateGroup ( "Distance-based Evaluation" ) ; g . addMeasure ( "C-Index" , cIndex , 0. , 1. , 0. , true ) ; db . getHierarchy ( ) . resultChanged ( ev ) ; return cIndex ; |
public class HiveAvroSerDeManager { /** * Add an Avro { @ link Schema } to the given { @ link HiveRegistrationUnit } .
* If { @ link # USE _ SCHEMA _ FILE } is true , the schema will be added via { @ link # SCHEMA _ URL } pointing to
* the schema file named { @ link # SCHEMA _ FILE _ NAME } .
* If { @ link # USE _ SCHEMA _ FILE } is false , the schema will be obtained by { @ link # getDirectorySchema ( Path ) } .
* If the length of the schema is less than { @ link # SCHEMA _ LITERAL _ LENGTH _ LIMIT } , it will be added via
* { @ link # SCHEMA _ LITERAL } . Otherwise , the schema will be written to { @ link # SCHEMA _ FILE _ NAME } and added
* via { @ link # SCHEMA _ URL } . */
@ Override public void addSerDeProperties ( Path path , HiveRegistrationUnit hiveUnit ) throws IOException { } } | Preconditions . checkArgument ( this . fs . getFileStatus ( path ) . isDirectory ( ) , path + " is not a directory." ) ; Schema schema ; try ( Timer . Context context = metricContext . timer ( HIVE_SPEC_SCHEMA_READING_TIMER ) . time ( ) ) { schema = getDirectorySchema ( path ) ; } if ( schema == null ) { return ; } hiveUnit . setSerDeType ( this . serDeWrapper . getSerDe ( ) . getClass ( ) . getName ( ) ) ; hiveUnit . setInputFormat ( this . serDeWrapper . getInputFormatClassName ( ) ) ; hiveUnit . setOutputFormat ( this . serDeWrapper . getOutputFormatClassName ( ) ) ; addSchemaProperties ( path , hiveUnit , schema ) ; |
public class ComponentMaximiser { /** * Unmaximises the current maximised component .
* It does nothing if no component is maximised .
* @ see # maximiseComponent ( Component ) */
public void unmaximiseComponent ( ) { } } | if ( maximisedComponent == null ) { return ; } container . remove ( maximisedComponent ) ; container . add ( containerChild ) ; parentMaximisedComponent . add ( maximisedComponent ) ; container . validate ( ) ; containerChild = null ; parentMaximisedComponent = null ; maximisedComponent = null ; |
public class PoolStatisticsImpl { /** * { @ inheritDoc } */
public void deltaCommit ( long time ) { } } | commitCount . incrementAndGet ( ) ; if ( time > 0 ) { commitTotalTime . addAndGet ( time ) ; if ( time > commitMaxTime . get ( ) ) commitMaxTime . set ( time ) ; } |
public class CmsStringUtil { /** * Splits a String into substrings along the provided char delimiter and returns
* the result as a List of Substrings . < p >
* @ param source the String to split
* @ param delimiter the delimiter to split at
* @ param trim flag to indicate if leading and trailing white spaces should be omitted
* @ return the List of splitted Substrings */
public static List < String > splitAsList ( String source , char delimiter , boolean trim ) { } } | List < String > result = new ArrayList < String > ( ) ; int i = 0 ; int l = source . length ( ) ; int n = source . indexOf ( delimiter ) ; while ( n != - 1 ) { // zero - length items are not seen as tokens at start or end
if ( ( i < n ) || ( ( i > 0 ) && ( i < l ) ) ) { result . add ( trim ? source . substring ( i , n ) . trim ( ) : source . substring ( i , n ) ) ; } i = n + 1 ; n = source . indexOf ( delimiter , i ) ; } // is there a non - empty String to cut from the tail ?
if ( n < 0 ) { n = source . length ( ) ; } if ( i < n ) { result . add ( trim ? source . substring ( i ) . trim ( ) : source . substring ( i ) ) ; } return result ; |
public class ImmutableUtility { /** * used for example for dao select result
* @ param entity
* @ param methodBuilder
* @ param name
* @ param typeName */
public static void generateImmutableCollectionIfPossible ( ModelClass < ? > entity , Builder methodBuilder , String name , TypeName typeName ) { } } | if ( TypeUtility . isList ( typeName ) && ( ( ParameterizedTypeName ) typeName ) . rawType . equals ( ClassName . get ( List . class ) ) ) { methodBuilder . addCode ( "($L==null ? null : $T.unmodifiableList($L))" , name , Collections . class , name ) ; } else if ( TypeUtility . isSet ( typeName ) && ( ( ParameterizedTypeName ) typeName ) . rawType . equals ( ClassName . get ( SortedSet . class ) ) ) { methodBuilder . addCode ( "($L==null ? null : $T.unmodifiableSortedSet($L))" , name , Collections . class , name ) ; } else if ( TypeUtility . isSet ( typeName ) && ( ( ParameterizedTypeName ) typeName ) . rawType . equals ( ClassName . get ( Set . class ) ) ) { methodBuilder . addCode ( "($L==null ? null : $T.unmodifiableSet($L))" , name , Collections . class , name ) ; } else if ( TypeUtility . isMap ( typeName ) && ( ( ParameterizedTypeName ) typeName ) . rawType . equals ( ClassName . get ( SortedMap . class ) ) ) { methodBuilder . addCode ( "($L==null ? null : $T.unmodifiableSortedMap($L))" , name , Collections . class , name ) ; } else if ( TypeUtility . isMap ( typeName ) && ( ( ParameterizedTypeName ) typeName ) . rawType . equals ( ClassName . get ( Map . class ) ) ) { methodBuilder . addCode ( "($L==null ? null : $T.unmodifiableMap($L))" , name , Collections . class , name ) ; } else { methodBuilder . addCode ( name ) ; } |
public class QuorumCall { /** * Wait for the quorum to achieve a certain number of responses .
* Note that , even after this returns , more responses may arrive ,
* causing the return value of other methods in this class to change .
* @ param minResponses return as soon as this many responses have been
* received , regardless of whether they are successes or exceptions
* @ param minSuccesses return as soon as this many successful ( non - exception )
* responses have been received
* @ param maxExceptions return as soon as this many exception responses
* have been received . Pass 0 to return immediately if any exception is
* received .
* @ param millis the number of milliseconds to wait for
* @ throws InterruptedException if the thread is interrupted while waiting
* @ throws TimeoutException if the specified timeout elapses before
* achieving the desired conditions */
public synchronized void waitFor ( int minResponses , int minSuccesses , int maxExceptions , int millis , String operationName ) throws InterruptedException , TimeoutException { } } | long st = monotonicNow ( ) ; long nextLogTime = st + ( long ) ( millis * WAIT_PROGRESS_INFO_THRESHOLD ) ; long et = st + millis ; while ( true ) { checkAssertionErrors ( ) ; if ( minResponses > 0 && countResponses ( ) >= minResponses ) return ; if ( minSuccesses > 0 && countSuccesses ( ) >= minSuccesses ) return ; if ( ( maxExceptions > 0 && countExceptions ( ) >= maxExceptions ) || ( maxExceptions == 0 && countExceptions ( ) > 0 ) ) { return ; } long now = monotonicNow ( ) ; if ( now > nextLogTime ) { long waited = now - st ; String msg = String . format ( "Waited %s ms (timeout=%s ms) for a response for %s" , waited , millis , operationName ) ; if ( ! successes . isEmpty ( ) ) { msg += ". Succeeded so far: [" + Joiner . on ( "," ) . join ( successes . keySet ( ) ) + "]" ; } if ( ! exceptions . isEmpty ( ) ) { msg += ". Exceptions so far: [" + mapToString ( exceptions ) + "]" ; } if ( successes . isEmpty ( ) && exceptions . isEmpty ( ) ) { msg += ". No responses yet." ; } if ( waited > millis * WAIT_PROGRESS_WARN_THRESHOLD ) { QuorumJournalManager . LOG . warn ( msg ) ; } else { QuorumJournalManager . LOG . info ( msg ) ; } nextLogTime = now + WAIT_PROGRESS_INTERVAL_MILLIS ; } long rem = et - now ; if ( rem <= 0 ) { throw new TimeoutException ( ) ; } rem = Math . min ( rem , nextLogTime - now ) ; rem = Math . max ( rem , 1 ) ; wait ( rem ) ; } |
public class PolicyStatesInner { /** * Summarizes policy states for the resources under the management group .
* @ param managementGroupName Management group name .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < SummarizeResultsInner > summarizeForManagementGroupAsync ( String managementGroupName , final ServiceCallback < SummarizeResultsInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( summarizeForManagementGroupWithServiceResponseAsync ( managementGroupName ) , serviceCallback ) ; |
public class InfinispanConfigurationParser { /** * Resolves an Infinispan configuration file but using the Hibernate Search classloader . The returned Infinispan
* configuration template also overrides Infinispan ' s runtime classloader to the one of Hibernate Search .
* @ param filename Infinispan configuration resource name
* @ param transportOverrideResource An alternative JGroups configuration file to be injected
* @ param serviceManager the ServiceManager to load resources
* @ return
* @ throws IOException */
public ConfigurationBuilderHolder parseFile ( String filename , String transportOverrideResource , ServiceManager serviceManager ) throws IOException { } } | ClassLoaderService classLoaderService = serviceManager . requestService ( ClassLoaderService . class ) ; try { return parseFile ( classLoaderService , filename , transportOverrideResource ) ; } finally { serviceManager . releaseService ( ClassLoaderService . class ) ; } |
public class lbmonitor { /** * Use this API to unset the properties of lbmonitor resources .
* Properties that need to be unset are specified in args array . */
public static base_responses unset ( nitro_service client , lbmonitor resources [ ] , String [ ] args ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { lbmonitor unsetresources [ ] = new lbmonitor [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { unsetresources [ i ] = new lbmonitor ( ) ; unsetresources [ i ] . monitorname = resources [ i ] . monitorname ; unsetresources [ i ] . type = resources [ i ] . type ; unsetresources [ i ] . ipaddress = resources [ i ] . ipaddress ; } result = unset_bulk_request ( client , unsetresources , args ) ; } return result ; |
public class Formula { /** * Performs a simultaneous substitution on this formula given a single mapping from variable to formula .
* @ param variable the variable
* @ param formula the formula
* @ return a new substituted formula */
public Formula substitute ( final Variable variable , final Formula formula ) { } } | final Substitution subst = new Substitution ( ) ; subst . addMapping ( variable , formula ) ; return this . substitute ( subst ) ; |
public class ListStreamConsumersResult { /** * An array of JSON objects . Each object represents one registered consumer .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setConsumers ( java . util . Collection ) } or { @ link # withConsumers ( java . util . Collection ) } if you want to
* override the existing values .
* @ param consumers
* An array of JSON objects . Each object represents one registered consumer .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListStreamConsumersResult withConsumers ( Consumer ... consumers ) { } } | if ( this . consumers == null ) { setConsumers ( new com . amazonaws . internal . SdkInternalList < Consumer > ( consumers . length ) ) ; } for ( Consumer ele : consumers ) { this . consumers . add ( ele ) ; } return this ; |
public class BitCount { /** * Test
* @ param args */
public static void main ( String [ ] args ) { } } | final int trials = 10000 ; final int maxLength = 10000 ; Random rnd = new Random ( ) ; final int seed = rnd . nextInt ( ) ; System . out . print ( "Test correctness... " ) ; rnd = new Random ( seed ) ; for ( int i = 0 ; i < trials ; i ++ ) { int [ ] x = new int [ rnd . nextInt ( maxLength ) ] ; for ( int j = 0 ; j < x . length ; j ++ ) x [ j ] = rnd . nextInt ( Integer . MAX_VALUE ) ; int size1 = 0 ; for ( int j = 0 ; j < x . length ; j ++ ) size1 += Integer . bitCount ( x [ j ] ) ; int size2 = count ( x ) ; if ( size1 != size2 ) { System . out . println ( "i = " + i ) ; System . out . println ( "ERRORE!" ) ; System . out . println ( size1 + ", " + size2 ) ; for ( int j = 0 ; j < x . length ; j ++ ) System . out . format ( "x[%d] = %d --> %d\n" , j , x [ j ] , Integer . bitCount ( x [ j ] ) ) ; return ; } } System . out . println ( "done!" ) ; System . out . print ( "Test correctness II... " ) ; rnd = new Random ( seed ) ; for ( int i = 0 ; i < trials ; i ++ ) { int [ ] x = new int [ rnd . nextInt ( maxLength << 1 ) ] ; for ( int j = 1 ; j < x . length ; j += 2 ) x [ j ] = rnd . nextInt ( Integer . MAX_VALUE ) ; int size1 = 0 ; for ( int j = 1 ; j < x . length ; j += 2 ) size1 += Integer . bitCount ( x [ j ] ) ; int size2 = count_2 ( x ) ; if ( size1 != size2 ) { System . out . println ( "i = " + i ) ; System . out . println ( "ERRORE!" ) ; System . out . println ( size1 + ", " + size2 ) ; for ( int j = 1 ; j < x . length ; j += 2 ) System . out . format ( "x[%d] = %d --> %d\n" , j , x [ j ] , Integer . bitCount ( x [ j ] ) ) ; return ; } } System . out . println ( "done!" ) ; System . out . print ( "Test time count(): " ) ; rnd = new Random ( seed ) ; long t = System . currentTimeMillis ( ) ; for ( int i = 0 ; i < trials ; i ++ ) { int [ ] x = new int [ rnd . nextInt ( maxLength ) ] ; for ( int j = 0 ; j < x . length ; j ++ ) x [ j ] = rnd . nextInt ( Integer . MAX_VALUE ) ; @ SuppressWarnings ( "unused" ) int size = 0 ; for ( int j = 0 ; j < x . length ; j ++ ) size += Integer . bitCount ( x [ j ] ) ; } System . out . println ( System . currentTimeMillis ( ) - t ) ; System . out . print ( "Test time BitCount.count(): " ) ; rnd = new Random ( seed ) ; t = System . currentTimeMillis ( ) ; for ( int i = 0 ; i < trials ; i ++ ) { int [ ] x = new int [ rnd . nextInt ( maxLength ) ] ; for ( int j = 0 ; j < x . length ; j ++ ) x [ j ] = rnd . nextInt ( Integer . MAX_VALUE ) ; count ( x ) ; } System . out . println ( System . currentTimeMillis ( ) - t ) ; System . out . print ( "Test II time count(): " ) ; rnd = new Random ( seed ) ; t = System . currentTimeMillis ( ) ; for ( int i = 0 ; i < trials ; i ++ ) { int [ ] x = new int [ rnd . nextInt ( maxLength << 1 ) ] ; for ( int j = 1 ; j < x . length ; j += 2 ) x [ j ] = rnd . nextInt ( Integer . MAX_VALUE ) ; @ SuppressWarnings ( "unused" ) int size = 0 ; for ( int j = 1 ; j < x . length ; j += 2 ) size += Integer . bitCount ( x [ j ] ) ; } System . out . println ( System . currentTimeMillis ( ) - t ) ; System . out . print ( "Test II time BitCount.count(): " ) ; rnd = new Random ( seed ) ; t = System . currentTimeMillis ( ) ; for ( int i = 0 ; i < trials ; i ++ ) { int [ ] x = new int [ rnd . nextInt ( maxLength << 1 ) ] ; for ( int j = 1 ; j < x . length ; j += 2 ) x [ j ] = rnd . nextInt ( Integer . MAX_VALUE ) ; count_2 ( x ) ; } System . out . println ( System . currentTimeMillis ( ) - t ) ; |
public class DateIntervalInfo { /** * / * Set Interval pattern .
* @ param skeleton skeleton on which the interval pattern based
* @ param lrgDiffCalUnit the largest different calendar unit .
* @ param ptnInfo interval pattern infomration */
private void setIntervalPattern ( String skeleton , String lrgDiffCalUnit , PatternInfo ptnInfo ) { } } | Map < String , PatternInfo > patternsOfOneSkeleton = fIntervalPatterns . get ( skeleton ) ; patternsOfOneSkeleton . put ( lrgDiffCalUnit , ptnInfo ) ; |
public class EmbedBuilder { /** * Sets the Thumbnail of the embed .
* < p > < b > < a href = " http : / / i . imgur . com / Zc3qwqB . png " > Example < / a > < / b >
* < p > < b > Uploading images with Embeds < / b >
* < br > When uploading an < u > image < / u >
* ( using { @ link net . dv8tion . jda . core . entities . MessageChannel # sendFile ( java . io . File , net . dv8tion . jda . core . entities . Message ) MessageChannel . sendFile ( . . . ) } )
* you can reference said image using the specified filename as URI { @ code attachment : / / filename . ext } .
* < p > < u > Example < / u >
* < pre > < code >
* MessageChannel channel ; / / = reference of a MessageChannel
* MessageBuilder message = new MessageBuilder ( ) ;
* EmbedBuilder embed = new EmbedBuilder ( ) ;
* InputStream file = new URL ( " https : / / http . cat / 500 " ) . openStream ( ) ;
* embed . setThumbnail ( " attachment : / / cat . png " ) / / we specify this in sendFile as " cat . png "
* . setDescription ( " This is a cute cat : 3 " ) ;
* message . setEmbed ( embed . build ( ) ) ;
* channel . sendFile ( file , " cat . png " , message . build ( ) ) . queue ( ) ;
* < / code > < / pre >
* @ param url
* the url of the thumbnail of the embed
* @ throws java . lang . IllegalArgumentException
* < ul >
* < li > If the length of { @ code url } is longer than { @ link net . dv8tion . jda . core . entities . MessageEmbed # URL _ MAX _ LENGTH } . < / li >
* < li > If the provided { @ code url } is not a properly formatted http or https url . < / li >
* < / ul >
* @ return the builder after the thumbnail has been set */
public EmbedBuilder setThumbnail ( String url ) { } } | if ( url == null ) { this . thumbnail = null ; } else { urlCheck ( url ) ; this . thumbnail = new MessageEmbed . Thumbnail ( url , null , 0 , 0 ) ; } return this ; |
public class JSTypeRegistry { /** * Returns whether the given property can possibly be set on the given type . */
public PropDefinitionKind canPropertyBeDefined ( JSType type , String propertyName ) { } } | if ( type . isStruct ( ) ) { // We are stricter about " struct " types and only allow access to
// properties that to the best of our knowledge are available at creation
// time and specifically not properties only defined on subtypes .
switch ( type . getPropertyKind ( propertyName ) ) { case KNOWN_PRESENT : return PropDefinitionKind . KNOWN ; case MAYBE_PRESENT : // TODO ( johnlenz ) : return LOOSE _ UNION here .
return PropDefinitionKind . KNOWN ; case ABSENT : return PropDefinitionKind . UNKNOWN ; } } else { if ( ! type . isEmptyType ( ) && ! type . isUnknownType ( ) ) { switch ( type . getPropertyKind ( propertyName ) ) { case KNOWN_PRESENT : return PropDefinitionKind . KNOWN ; case MAYBE_PRESENT : // TODO ( johnlenz ) : return LOOSE _ UNION here .
return PropDefinitionKind . KNOWN ; case ABSENT : // check for loose properties below .
break ; } } if ( typesIndexedByProperty . containsKey ( propertyName ) ) { for ( JSType alternative : typesIndexedByProperty . get ( propertyName ) ) { JSType greatestSubtype = alternative . getGreatestSubtype ( type ) ; if ( ! greatestSubtype . isEmptyType ( ) ) { // We ' ve found a type with this property . Now we just have to make
// sure it ' s not a type used for internal bookkeeping .
RecordType maybeRecordType = greatestSubtype . toMaybeRecordType ( ) ; if ( maybeRecordType != null && maybeRecordType . isSynthetic ( ) ) { continue ; } return PropDefinitionKind . LOOSE ; } } } if ( type . toMaybeRecordType ( ) != null ) { RecordType rec = type . toMaybeRecordType ( ) ; boolean mayBeInUnion = false ; for ( String pname : rec . getPropertyMap ( ) . getOwnPropertyNames ( ) ) { if ( this . propertiesOfSupertypesInUnions . contains ( pname ) ) { mayBeInUnion = true ; break ; } } if ( mayBeInUnion && this . droppedPropertiesOfUnions . contains ( propertyName ) ) { return PropDefinitionKind . LOOSE ; } } } return PropDefinitionKind . UNKNOWN ; |
public class DescribeCacheClustersResult { /** * A list of clusters . Each item in the list contains detailed information about one cluster .
* @ return A list of clusters . Each item in the list contains detailed information about one cluster . */
public java . util . List < CacheCluster > getCacheClusters ( ) { } } | if ( cacheClusters == null ) { cacheClusters = new com . amazonaws . internal . SdkInternalList < CacheCluster > ( ) ; } return cacheClusters ; |
public class Sql { /** * Executes the given SQL with embedded expressions inside .
* Also saves the updateCount , if any , for subsequent examination .
* Example usage :
* < pre >
* def scott = [ firstname : " Scott " , lastname : " Davis " , id : 5 , location _ id : 50]
* sql . execute " " "
* insert into PERSON ( id , firstname , lastname , location _ id ) values ( $ scott . id , $ scott . firstname , $ scott . lastname , $ scott . location _ id )
* assert sql . updateCount = = 1
* < / pre >
* Resource handling is performed automatically where appropriate .
* @ param gstring a GString containing the SQL query with embedded params
* @ return < code > true < / code > if the first result is a < code > ResultSet < / code >
* object ; < code > false < / code > if it is an update count or there are
* no results
* @ throws SQLException if a database access error occurs
* @ see # expand ( Object ) */
public boolean execute ( GString gstring ) throws SQLException { } } | List < Object > params = getParameters ( gstring ) ; String sql = asSql ( gstring , params ) ; return execute ( sql , params ) ; |
public class LdapRdn { /** * Create an immutable copy of this instance . It will not be possible to add
* or remove components or modify the keys and values of these components .
* @ return an immutable copy of this instance .
* @ since 1.3 */
public LdapRdn immutableLdapRdn ( ) { } } | Map < String , LdapRdnComponent > mapWithImmutableRdns = new LinkedHashMap < String , LdapRdnComponent > ( components . size ( ) ) ; for ( Iterator iterator = components . values ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { LdapRdnComponent rdnComponent = ( LdapRdnComponent ) iterator . next ( ) ; mapWithImmutableRdns . put ( rdnComponent . getKey ( ) , rdnComponent . immutableLdapRdnComponent ( ) ) ; } Map < String , LdapRdnComponent > unmodifiableMapOfImmutableRdns = Collections . unmodifiableMap ( mapWithImmutableRdns ) ; LdapRdn immutableRdn = new LdapRdn ( ) ; immutableRdn . components = unmodifiableMapOfImmutableRdns ; return immutableRdn ; |
public class CommonOps_DDRM { /** * Multiplies every element in column i by value [ i ] .
* @ param A Matrix . Modified .
* @ param values array . Not modified . */
public static void multCols ( DMatrixRMaj A , double values [ ] ) { } } | if ( values . length < A . numCols ) { throw new IllegalArgumentException ( "Not enough elements in values." ) ; } int index = 0 ; for ( int row = 0 ; row < A . numRows ; row ++ ) { for ( int col = 0 ; col < A . numCols ; col ++ , index ++ ) { A . data [ index ] *= values [ col ] ; } } |
public class NetUtils { /** * Encodes an IP address properly as a URL string . This method makes sure that IPv6 addresses
* have the proper formatting to be included in URLs .
* @ param address The IP address to encode .
* @ return The proper URL string encoded IP address . */
public static String ipAddressToUrlString ( InetAddress address ) { } } | if ( address == null ) { throw new NullPointerException ( "address is null" ) ; } else if ( address instanceof Inet4Address ) { return address . getHostAddress ( ) ; } else if ( address instanceof Inet6Address ) { return getIPv6UrlRepresentation ( ( Inet6Address ) address ) ; } else { throw new IllegalArgumentException ( "Unrecognized type of InetAddress: " + address ) ; } |
public class Hasher { /** * Hashes and hex it with the given { @ link String } object with the given parameters .
* @ param hashIt
* the hash it
* @ param salt
* the salt
* @ param hashAlgorithm
* the hash algorithm
* @ param charset
* the charset
* @ return the generated { @ link String } object
* @ throws NoSuchAlgorithmException
* is thrown if instantiation of the MessageDigest object fails .
* @ throws UnsupportedEncodingException
* is thrown by get the byte array of the private key String object fails .
* @ throws NoSuchPaddingException
* is thrown if instantiation of the cypher object fails .
* @ throws InvalidKeyException
* the invalid key exception is thrown if initialization of the cypher object fails .
* @ throws BadPaddingException
* is thrown if { @ link Cipher # doFinal ( byte [ ] ) } fails .
* @ throws IllegalBlockSizeException
* is thrown if { @ link Cipher # doFinal ( byte [ ] ) } fails .
* @ throws InvalidAlgorithmParameterException
* is thrown if initialization of the cypher object fails .
* @ throws InvalidKeySpecException
* is thrown if generation of the SecretKey object fails . */
public static String hashAndHex ( final String hashIt , final String salt , final HashAlgorithm hashAlgorithm , final Charset charset ) throws NoSuchAlgorithmException , InvalidKeyException , UnsupportedEncodingException , NoSuchPaddingException , IllegalBlockSizeException , BadPaddingException , InvalidKeySpecException , InvalidAlgorithmParameterException { } } | final HexableEncryptor hexEncryptor = new HexableEncryptor ( CompoundAlgorithm . PRIVATE_KEY ) ; return hexEncryptor . encrypt ( HashExtensions . hash ( hashIt , salt , hashAlgorithm , charset ) ) ; |
public class JPAExPcBindingContext { /** * d468174 */
private void writeObject ( java . io . ObjectOutputStream out ) throws IOException { } } | // Write non transient fields .
out . defaultWriteObject ( ) ; // Write transient fields .
int n = ivPuIds . length ; out . writeInt ( n ) ; for ( int i = 0 ; i < n ; ++ i ) { JPAPuId id = ivPuIds [ i ] ; out . writeObject ( id ) ; } |
public class ObrClassFinderService { /** * Convenience method to start the class finder utility service .
* If admin service is not up yet , this starts it .
* @ param className
* @ return true If I ' m up already
* @ return false If I had a problem . */
public boolean startClassFinderActivator ( BundleContext context ) { } } | if ( ClassFinderActivator . getClassFinder ( context , 0 ) == this ) return true ; // Already up !
// If the repository is not up , but the bundle is deployed , this will find it
String packageName = ClassFinderActivator . getPackageName ( ClassFinderActivator . class . getName ( ) , false ) ; Bundle bundle = this . findBundle ( null , context , packageName , null ) ; if ( bundle == null ) { Resource resource = ( Resource ) this . deployThisResource ( packageName , null , false ) ; // Get the bundle info from the repos
bundle = this . findBundle ( resource , context , packageName , null ) ; } if ( bundle != null ) { if ( ( ( bundle . getState ( ) & Bundle . ACTIVE ) == 0 ) && ( ( bundle . getState ( ) & Bundle . STARTING ) == 0 ) ) { try { bundle . start ( ) ; } catch ( BundleException e ) { e . printStackTrace ( ) ; } } ClassFinderActivator . setClassFinder ( this ) ; return true ; // Success
} return false ; // Error ! Where is my bundle ? |
public class JobTargetExecutionsInner { /** * Gets a target execution .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param jobAgentName The name of the job agent .
* @ param jobName The name of the job to get .
* @ param jobExecutionId The unique id of the job execution
* @ param stepName The name of the step .
* @ param targetId The target id .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < JobExecutionInner > getAsync ( String resourceGroupName , String serverName , String jobAgentName , String jobName , UUID jobExecutionId , String stepName , UUID targetId , final ServiceCallback < JobExecutionInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( resourceGroupName , serverName , jobAgentName , jobName , jobExecutionId , stepName , targetId ) , serviceCallback ) ; |
public class CmsContainerpageService { /** * Converts the given setting values according to the setting configuration of the given resource . < p >
* @ param resource the resource
* @ param settings the settings to convert
* @ param locale the locale used for accessing the element settings
* @ return the converted settings
* @ throws CmsException if something goes wrong */
private Map < String , String > convertSettingValues ( CmsResource resource , Map < String , String > settings , Locale locale ) throws CmsException { } } | CmsObject cms = getCmsObject ( ) ; Locale origLocale = cms . getRequestContext ( ) . getLocale ( ) ; try { cms . getRequestContext ( ) . setLocale ( locale ) ; Map < String , CmsXmlContentProperty > settingsConf = OpenCms . getADEManager ( ) . getElementSettings ( cms , resource ) ; Map < String , String > changedSettings = new HashMap < String , String > ( ) ; if ( settings != null ) { for ( Map . Entry < String , String > entry : settings . entrySet ( ) ) { String settingName = entry . getKey ( ) ; String settingType = "string" ; if ( settingsConf . get ( settingName ) != null ) { settingType = settingsConf . get ( settingName ) . getType ( ) ; } changedSettings . put ( settingName , CmsXmlContentPropertyHelper . getPropValueIds ( getCmsObject ( ) , settingType , entry . getValue ( ) ) ) ; } } return changedSettings ; } finally { cms . getRequestContext ( ) . setLocale ( origLocale ) ; } |
public class RawXJC2Mojo { /** * Augments Maven paths with generated resources . */
protected void setupMavenPaths ( ) { } } | if ( getAddCompileSourceRoot ( ) ) { getProject ( ) . addCompileSourceRoot ( getGenerateDirectory ( ) . getPath ( ) ) ; } if ( getAddTestCompileSourceRoot ( ) ) { getProject ( ) . addTestCompileSourceRoot ( getGenerateDirectory ( ) . getPath ( ) ) ; } if ( getEpisode ( ) && getEpisodeFile ( ) != null ) { final String episodeFilePath = getEpisodeFile ( ) . getAbsolutePath ( ) ; final String generatedDirectoryPath = getGenerateDirectory ( ) . getAbsolutePath ( ) ; if ( episodeFilePath . startsWith ( generatedDirectoryPath + File . separator ) ) { final String path = episodeFilePath . substring ( generatedDirectoryPath . length ( ) + 1 ) ; final Resource resource = new Resource ( ) ; resource . setDirectory ( generatedDirectoryPath ) ; resource . addInclude ( path ) ; if ( getAddCompileSourceRoot ( ) ) { getProject ( ) . addResource ( resource ) ; } if ( getAddTestCompileSourceRoot ( ) ) { getProject ( ) . addTestResource ( resource ) ; } } } |
public class MetricFilterWithInteralReducerTransform { /** * Reduces the give metric to a single value based on the specified reducer .
* @ param metric The metric to reduce .
* @ param reducerType The type of reduction to perform .
* @ return The reduced value .
* @ throws UnsupportedOperationException If an unknown reducer type is specified . */
public static String internalReducer ( Metric metric , String reducerType ) { } } | Map < Long , Double > sortedDatapoints = new TreeMap < > ( ) ; List < Double > operands = new ArrayList < Double > ( ) ; if ( ! reducerType . equals ( InternalReducerType . NAME . getName ( ) ) ) { if ( metric . getDatapoints ( ) != null && metric . getDatapoints ( ) . size ( ) > 0 ) { sortedDatapoints . putAll ( metric . getDatapoints ( ) ) ; for ( Double value : sortedDatapoints . values ( ) ) { if ( value == null ) { operands . add ( 0.0 ) ; } else { operands . add ( value ) ; } } } else { return null ; } } InternalReducerType type = InternalReducerType . fromString ( reducerType ) ; switch ( type ) { case AVG : return String . valueOf ( ( new Mean ( ) ) . evaluate ( Doubles . toArray ( operands ) ) ) ; case MIN : return String . valueOf ( Collections . min ( operands ) ) ; case MAX : return String . valueOf ( Collections . max ( operands ) ) ; case RECENT : return String . valueOf ( operands . get ( operands . size ( ) - 1 ) ) ; case MAXIMA : return String . valueOf ( Collections . max ( operands ) ) ; case MINIMA : return String . valueOf ( Collections . min ( operands ) ) ; case NAME : return metric . getMetric ( ) ; case DEVIATION : return String . valueOf ( ( new StandardDeviation ( ) ) . evaluate ( Doubles . toArray ( operands ) ) ) ; default : throw new UnsupportedOperationException ( reducerType ) ; } |
public class VorbisStyleComments { /** * Removes any existing comments for a given tag ,
* and replaces them with the supplied list */
public void setComments ( String tag , List < String > comments ) { } } | String nt = normaliseTag ( tag ) ; if ( this . comments . containsKey ( nt ) ) { this . comments . remove ( nt ) ; } this . comments . put ( nt , comments ) ; |
public class CliClient { /** * Update column family definition attributes
* @ param statement - ANTLR tree representing current statement
* @ param cfDefToUpdate - column family definition to apply updates on
* @ return cfDef - updated column family definition */
private CfDef updateCfDefAttributes ( Tree statement , CfDef cfDefToUpdate ) { } } | CfDef cfDef = new CfDef ( cfDefToUpdate ) ; for ( int i = 1 ; i < statement . getChildCount ( ) ; i += 2 ) { String currentArgument = statement . getChild ( i ) . getText ( ) . toUpperCase ( ) ; ColumnFamilyArgument mArgument = ColumnFamilyArgument . valueOf ( currentArgument ) ; String mValue = statement . getChild ( i + 1 ) . getText ( ) ; switch ( mArgument ) { case COLUMN_TYPE : cfDef . setColumn_type ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case COMPARATOR : cfDef . setComparator_type ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case SUBCOMPARATOR : cfDef . setSubcomparator_type ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case COMMENT : cfDef . setComment ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case READ_REPAIR_CHANCE : double chance = Double . parseDouble ( mValue ) ; if ( chance < 0 || chance > 1 ) throw new RuntimeException ( "Error: read_repair_chance must be between 0 and 1." ) ; cfDef . setRead_repair_chance ( chance ) ; break ; case DCLOCAL_READ_REPAIR_CHANCE : double localChance = Double . parseDouble ( mValue ) ; if ( localChance < 0 || localChance > 1 ) throw new RuntimeException ( "Error: dclocal_read_repair_chance must be between 0 and 1." ) ; cfDef . setDclocal_read_repair_chance ( localChance ) ; break ; case GC_GRACE : cfDef . setGc_grace_seconds ( Integer . parseInt ( mValue ) ) ; break ; case COLUMN_METADATA : Tree arrayOfMetaAttributes = statement . getChild ( i + 1 ) ; if ( ! arrayOfMetaAttributes . getText ( ) . equals ( "ARRAY" ) ) throw new RuntimeException ( "'column_metadata' format - [{ k:v, k:v, ..}, { ... }, ...]" ) ; cfDef . setColumn_metadata ( getCFColumnMetaFromTree ( cfDef , arrayOfMetaAttributes ) ) ; break ; case MEMTABLE_OPERATIONS : break ; case MEMTABLE_THROUGHPUT : break ; case DEFAULT_VALIDATION_CLASS : cfDef . setDefault_validation_class ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case MIN_COMPACTION_THRESHOLD : int threshold = Integer . parseInt ( mValue ) ; if ( threshold <= 0 ) throw new RuntimeException ( "Disabling compaction by setting min/max compaction thresholds to 0 has been deprecated, set compaction_strategy_options={'enabled':false} instead" ) ; cfDef . setMin_compaction_threshold ( threshold ) ; cfDef . putToCompaction_strategy_options ( CFPropDefs . KW_MINCOMPACTIONTHRESHOLD , Integer . toString ( threshold ) ) ; break ; case MAX_COMPACTION_THRESHOLD : threshold = Integer . parseInt ( mValue ) ; if ( threshold <= 0 ) throw new RuntimeException ( "Disabling compaction by setting min/max compaction thresholds to 0 has been deprecated, set compaction_strategy_options={'enabled':false} instead" ) ; cfDef . setMax_compaction_threshold ( Integer . parseInt ( mValue ) ) ; cfDef . putToCompaction_strategy_options ( CFPropDefs . KW_MAXCOMPACTIONTHRESHOLD , Integer . toString ( threshold ) ) ; break ; case REPLICATE_ON_WRITE : cfDef . setReplicate_on_write ( Boolean . parseBoolean ( mValue ) ) ; break ; case KEY_VALIDATION_CLASS : cfDef . setKey_validation_class ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case COMPACTION_STRATEGY : cfDef . setCompaction_strategy ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case COMPACTION_STRATEGY_OPTIONS : cfDef . setCompaction_strategy_options ( getStrategyOptionsFromTree ( statement . getChild ( i + 1 ) ) ) ; break ; case COMPRESSION_OPTIONS : cfDef . setCompression_options ( getStrategyOptionsFromTree ( statement . getChild ( i + 1 ) ) ) ; break ; case BLOOM_FILTER_FP_CHANCE : cfDef . setBloom_filter_fp_chance ( Double . parseDouble ( mValue ) ) ; break ; case MEMTABLE_FLUSH_PERIOD_IN_MS : cfDef . setMemtable_flush_period_in_ms ( Integer . parseInt ( mValue ) ) ; break ; case CACHING : cfDef . setCaching ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case CELLS_PER_ROW_TO_CACHE : cfDef . setCells_per_row_to_cache ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case DEFAULT_TIME_TO_LIVE : cfDef . setDefault_time_to_live ( Integer . parseInt ( mValue ) ) ; break ; case INDEX_INTERVAL : cfDef . setIndex_interval ( Integer . parseInt ( mValue ) ) ; break ; case SPECULATIVE_RETRY : cfDef . setSpeculative_retry ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case POPULATE_IO_CACHE_ON_FLUSH : cfDef . setPopulate_io_cache_on_flush ( Boolean . parseBoolean ( mValue ) ) ; break ; default : // must match one of the above or we ' d throw an exception at the valueOf statement above .
assert ( false ) ; } } return cfDef ; |
public class ExampleTrifocalStereoUncalibrated { /** * TODO Do this correction without running bundle adjustment again */
private static void checkBehindCamera ( SceneStructureMetric structure , SceneObservations observations , BundleAdjustment < SceneStructureMetric > bundleAdjustment ) { } } | int totalBehind = 0 ; Point3D_F64 X = new Point3D_F64 ( ) ; for ( int i = 0 ; i < structure . points . length ; i ++ ) { structure . points [ i ] . get ( X ) ; if ( X . z < 0 ) totalBehind ++ ; } structure . views [ 1 ] . worldToView . T . print ( ) ; if ( totalBehind > structure . points . length / 2 ) { System . out . println ( "Flipping because it's reversed. score = " + bundleAdjustment . getFitScore ( ) ) ; for ( int i = 1 ; i < structure . views . length ; i ++ ) { Se3_F64 w2v = structure . views [ i ] . worldToView ; w2v . set ( w2v . invert ( null ) ) ; } triangulatePoints ( structure , observations ) ; bundleAdjustment . setParameters ( structure , observations ) ; bundleAdjustment . optimize ( structure ) ; System . out . println ( " after = " + bundleAdjustment . getFitScore ( ) ) ; } else { System . out . println ( "Points not behind camera. " + totalBehind + " / " + structure . points . length ) ; } |
public class LocalFileSystem { @ Override public BlockLocation [ ] getFileBlockLocations ( FileStatus file , long start , long len ) throws IOException { } } | return new BlockLocation [ ] { new LocalBlockLocation ( hostName , file . getLen ( ) ) } ; |
public class SessionStoreInterceptor { /** * Saves all fields in session .
* @ param fields Fields to save in session .
* @ param actionBean ActionBean .
* @ param session HttpSession .
* @ throws IllegalAccessException Cannot get access to some fields . */
protected void saveFields ( Collection < Field > fields , ActionBean actionBean , HttpSession session ) throws IllegalAccessException { } } | for ( Field field : fields ) { if ( ! field . isAccessible ( ) ) { field . setAccessible ( true ) ; } setAttribute ( session , getFieldKey ( field , actionBean . getClass ( ) ) , field . get ( actionBean ) , ( ( Session ) field . getAnnotation ( Session . class ) ) . serializable ( ) , ( ( Session ) field . getAnnotation ( Session . class ) ) . maxTime ( ) ) ; } |
public class Token { /** * setter for lemmaStr - sets
* @ generated
* @ param v value to set into the feature */
public void setLemmaStr ( String v ) { } } | if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_lemmaStr == null ) jcasType . jcas . throwFeatMissing ( "lemmaStr" , "de.julielab.jules.types.Token" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_lemmaStr , v ) ; |
public class MultiVertexGeometryImpl { /** * Checked vs . Jan 11 , 2011 */
@ Override public Point2D getXY ( int index ) { } } | Point2D pt = new Point2D ( ) ; getXY ( index , pt ) ; return pt ; |
public class ResourceHandler { void handleMove ( HttpRequest request , HttpResponse response , String pathInContext , Resource resource ) throws IOException { } } | if ( ! resource . exists ( ) || ! passConditionalHeaders ( request , response , resource ) ) return ; String newPath = URI . canonicalPath ( request . getField ( "New-uri" ) ) ; if ( newPath == null ) { response . sendError ( HttpResponse . __405_Method_Not_Allowed , "Bad new uri" ) ; return ; } String contextPath = getHttpContext ( ) . getContextPath ( ) ; if ( contextPath != null && ! newPath . startsWith ( contextPath ) ) { response . sendError ( HttpResponse . __405_Method_Not_Allowed , "Not in context" ) ; return ; } // Find path
try { // TODO - Check this
String newInfo = newPath ; if ( contextPath != null ) newInfo = newInfo . substring ( contextPath . length ( ) ) ; Resource newFile = getHttpContext ( ) . getBaseResource ( ) . addPath ( newInfo ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Moving " + resource + " to " + newFile ) ; resource . renameTo ( newFile ) ; response . setStatus ( HttpResponse . __204_No_Content ) ; request . setHandled ( true ) ; } catch ( Exception ex ) { log . warn ( LogSupport . EXCEPTION , ex ) ; setAllowHeader ( response ) ; response . sendError ( HttpResponse . __405_Method_Not_Allowed , "Error:" + ex ) ; return ; } |
public class ExcelUtil { /** * 通过Sax方式读取Excel , 同时支持03和07格式
* @ param file Excel文件
* @ param sheetIndex sheet序号
* @ param rowHandler 行处理器
* @ since 3.2.0 */
public static void readBySax ( File file , int sheetIndex , RowHandler rowHandler ) { } } | BufferedInputStream in = null ; try { in = FileUtil . getInputStream ( file ) ; readBySax ( in , sheetIndex , rowHandler ) ; } finally { IoUtil . close ( in ) ; } |
public class Hours { /** * Obtains a { @ code Hours } from a text string such as { @ code PTnH } .
* This will parse the string produced by { @ code toString ( ) } and other
* related formats based on ISO - 8601 { @ code PnDTnH } .
* The string starts with an optional sign , denoted by the ASCII negative
* or positive symbol . If negative , the whole amount is negated .
* The ASCII letter " P " is next in upper or lower case .
* There are two sections consisting of a number and a suffix .
* There is one section for days suffixed by " D " ,
* followed by one section for hours suffixed by " H " .
* At least one section must be present .
* If the hours section is present it must be prefixed by " T " .
* If the hours section is omitted the " T " must be omitted .
* Letters must be in ASCII upper or lower case .
* The number part of each section must consist of ASCII digits .
* The number may be prefixed by the ASCII negative or positive symbol .
* The number must parse to an { @ code int } .
* The leading plus / minus sign , and negative values for days and hours
* are not part of the ISO - 8601 standard .
* For example , the following are valid inputs :
* < pre >
* " PT2H " - - Hours . of ( 2)
* " PT - HM " - - Hours . of ( - 2)
* " - PT2H " - - Hours . of ( - 2)
* " - PT - 2H " - - Hours . of ( 2)
* " P3D " - - Hours . of ( 3 * 24)
* " P3DT2H " - - Hours . of ( 3 * 24 + 2)
* < / pre >
* @ param text the text to parse , not null
* @ return the parsed period , not null
* @ throws DateTimeParseException if the text cannot be parsed to a period */
@ FromString public static Hours parse ( CharSequence text ) { } } | Objects . requireNonNull ( text , "text" ) ; Matcher matcher = PATTERN . matcher ( text ) ; if ( matcher . matches ( ) ) { int negate = "-" . equals ( matcher . group ( 1 ) ) ? - 1 : 1 ; String daysStr = matcher . group ( 2 ) ; String hoursStr = matcher . group ( 3 ) ; if ( daysStr != null || hoursStr != null ) { int hours = 0 ; if ( hoursStr != null ) { try { hours = Integer . parseInt ( hoursStr ) ; } catch ( NumberFormatException ex ) { throw new DateTimeParseException ( "Text cannot be parsed to Hours, non-numeric hours" , text , 0 , ex ) ; } } if ( daysStr != null ) { try { int daysAsHours = Math . multiplyExact ( Integer . parseInt ( daysStr ) , HOURS_PER_DAY ) ; hours = Math . addExact ( hours , daysAsHours ) ; } catch ( NumberFormatException ex ) { throw new DateTimeParseException ( "Text cannot be parsed to Hours, non-numeric days" , text , 0 , ex ) ; } } return of ( Math . multiplyExact ( hours , negate ) ) ; } } throw new DateTimeParseException ( "Text cannot be parsed to Hours" , text , 0 ) ; |
public class RaftSessionListener { /** * Handles a publish request .
* @ param request The publish request to handle . */
@ SuppressWarnings ( "unchecked" ) private void handlePublish ( PublishRequest request ) { } } | log . trace ( "Received {}" , request ) ; // If the request is for another session ID , this may be a session that was previously opened
// for this client .
if ( request . session ( ) != state . getSessionId ( ) . id ( ) ) { log . trace ( "Inconsistent session ID: {}" , request . session ( ) ) ; return ; } // Store eventIndex in a local variable to prevent multiple volatile reads .
long eventIndex = state . getEventIndex ( ) ; // If the request event index has already been processed , return .
if ( request . eventIndex ( ) <= eventIndex ) { log . trace ( "Duplicate event index {}" , request . eventIndex ( ) ) ; return ; } // If the request ' s previous event index doesn ' t equal the previous received event index ,
// respond with an undefined error and the last index received . This will cause the cluster
// to resend events starting at eventIndex + 1.
if ( request . previousIndex ( ) != eventIndex ) { log . trace ( "Inconsistent event index: {}" , request . previousIndex ( ) ) ; ResetRequest resetRequest = ResetRequest . builder ( ) . withSession ( state . getSessionId ( ) . id ( ) ) . withIndex ( eventIndex ) . build ( ) ; log . trace ( "Sending {}" , resetRequest ) ; protocol . reset ( memberSelector . members ( ) , resetRequest ) ; return ; } // Store the event index . This will be used to verify that events are received in sequential order .
state . setEventIndex ( request . eventIndex ( ) ) ; sequencer . sequenceEvent ( request , ( ) -> { for ( PrimitiveEvent event : request . events ( ) ) { Set < Consumer < PrimitiveEvent > > listeners = eventListeners . get ( event . type ( ) ) ; if ( listeners != null ) { for ( Consumer < PrimitiveEvent > listener : listeners ) { listener . accept ( event ) ; } } } } ) ; |
public class ParserAdapter { /** * Construct an exception for the current context .
* @ param message The error message . */
private SAXParseException makeException ( String message ) { } } | if ( locator != null ) { return new SAXParseException ( message , locator ) ; } else { return new SAXParseException ( message , null , null , - 1 , - 1 ) ; } |
public class ModifyLaunchTemplateRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < ModifyLaunchTemplateRequest > getDryRunRequest ( ) { } } | Request < ModifyLaunchTemplateRequest > request = new ModifyLaunchTemplateRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class Metadata { /** * Returns the last metadata entry added with the name ' name ' parsed as T .
* @ return the parsed metadata entry or null if there are none . */
@ Nullable public < T > T get ( Key < T > key ) { } } | for ( int i = size - 1 ; i >= 0 ; i -- ) { if ( bytesEqual ( key . asciiName ( ) , name ( i ) ) ) { return key . parseBytes ( value ( i ) ) ; } } return null ; |
public class WaveformPreview { /** * Scan the segments to find the largest height value present .
* @ return the largest waveform height anywhere in the preview . */
private int getMaxHeight ( ) { } } | int result = 0 ; for ( int i = 0 ; i < segmentCount ; i ++ ) { result = Math . max ( result , segmentHeight ( i , false ) ) ; } return result ; |
public class ElasticIndexer { /** * e . g . aba : 123 or subcell : 5883 */
static Pair < String , Integer > getId ( Annotation annot ) { } } | if ( annot instanceof DictTerm ) { DictTerm dt = ( DictTerm ) annot ; String [ ] split = dt . getEntityId ( ) . split ( ":" ) ; return Pair . of ( split [ 0 ] , parseInt ( split [ 1 ] ) ) ; // } else if ( annot instanceof Measure ) {
// Measure m = ( Measure ) annot ;
// return Pair . of ( " " + m . getNormalizedUnit ( ) , parseInt ( split [ 1 ] ) ) ;
} else throw new RuntimeException ( "NOT IMPLEMENTED xxx" ) ; // FIXME |
public class ActivationImpl { /** * Get the configProperties .
* @ return the configProperties . */
@ Override public Map < String , String > getConfigProperties ( ) { } } | return configProperties == null ? null : Collections . unmodifiableMap ( configProperties ) ; |
public class TrxMessageHeader { /** * Return the state of this object as a properties object .
* @ return The properties . */
public Map < String , Object > getProperties ( ) { } } | Map < String , Object > properties = super . getProperties ( ) ; if ( m_mapMessageHeader != null ) properties . putAll ( m_mapMessageHeader ) ; if ( m_mapMessageInfo != null ) properties . putAll ( m_mapMessageInfo ) ; if ( m_mapMessageTransport != null ) properties . putAll ( m_mapMessageTransport ) ; return properties ; |
public class RobotstxtServer { /** * Please note that in the case of a bad URL , TRUE will be returned
* @ throws InterruptedException
* @ throws IOException */
public boolean allows ( WebURL webURL ) throws IOException , InterruptedException { } } | if ( ! config . isEnabled ( ) ) { return true ; } try { URL url = new URL ( webURL . getURL ( ) ) ; String host = getHost ( url ) ; String path = url . getPath ( ) ; HostDirectives directives = host2directivesCache . get ( host ) ; if ( directives != null && directives . needsRefetch ( ) ) { synchronized ( host2directivesCache ) { host2directivesCache . remove ( host ) ; directives = null ; } } if ( directives == null ) { directives = fetchDirectives ( url ) ; } return directives . allows ( path ) ; } catch ( MalformedURLException e ) { logger . error ( "Bad URL in Robots.txt: " + webURL . getURL ( ) , e ) ; } logger . warn ( "RobotstxtServer: default: allow" , webURL . getURL ( ) ) ; return true ; |
public class ApiOvhPackxdsl { /** * Allowed shipping addresses given a context
* REST : GET / pack / xdsl / { packName } / shippingAddresses
* @ param context [ required ] Context
* @ param packName [ required ] The internal name of your pack */
public ArrayList < OvhShippingAddress > packName_shippingAddresses_GET ( String packName , OvhShippingAddressContextEnum context ) throws IOException { } } | String qPath = "/pack/xdsl/{packName}/shippingAddresses" ; StringBuilder sb = path ( qPath , packName ) ; query ( sb , "context" , context ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t4 ) ; |
public class ManagedInstanceVulnerabilityAssessmentsInner { /** * Gets the managed instance ' s vulnerability assessment policies .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ param serviceFuture the ServiceFuture object tracking the Retrofit calls
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < List < ManagedInstanceVulnerabilityAssessmentInner > > listByInstanceNextAsync ( final String nextPageLink , final ServiceFuture < List < ManagedInstanceVulnerabilityAssessmentInner > > serviceFuture , final ListOperationCallback < ManagedInstanceVulnerabilityAssessmentInner > serviceCallback ) { } } | return AzureServiceFuture . fromPageResponse ( listByInstanceNextSinglePageAsync ( nextPageLink ) , new Func1 < String , Observable < ServiceResponse < Page < ManagedInstanceVulnerabilityAssessmentInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < ManagedInstanceVulnerabilityAssessmentInner > > > call ( String nextPageLink ) { return listByInstanceNextSinglePageAsync ( nextPageLink ) ; } } , serviceCallback ) ; |
public class X509Utils { /** * Returns either a string that " sums up " the certificate for humans , in a similar manner to what you might see
* in a web browser , or null if one cannot be extracted . This will typically be the common name ( CN ) field , but
* can also be the org ( O ) field , org + location + country if withLocation is set , or the email
* address for S / MIME certificates . */
@ Nullable public static String getDisplayNameFromCertificate ( @ Nonnull X509Certificate certificate , boolean withLocation ) throws CertificateParsingException { } } | X500Name name = new X500Name ( certificate . getSubjectX500Principal ( ) . getName ( ) ) ; String commonName = null , org = null , location = null , country = null ; for ( RDN rdn : name . getRDNs ( ) ) { AttributeTypeAndValue pair = rdn . getFirst ( ) ; String val = ( ( ASN1String ) pair . getValue ( ) ) . getString ( ) ; ASN1ObjectIdentifier type = pair . getType ( ) ; if ( type . equals ( RFC4519Style . cn ) ) commonName = val ; else if ( type . equals ( RFC4519Style . o ) ) org = val ; else if ( type . equals ( RFC4519Style . l ) ) location = val ; else if ( type . equals ( RFC4519Style . c ) ) country = val ; } final Collection < List < ? > > subjectAlternativeNames = certificate . getSubjectAlternativeNames ( ) ; String altName = null ; if ( subjectAlternativeNames != null ) for ( final List < ? > subjectAlternativeName : subjectAlternativeNames ) if ( ( Integer ) subjectAlternativeName . get ( 0 ) == 1 ) // rfc822name
altName = ( String ) subjectAlternativeName . get ( 1 ) ; if ( org != null ) { return withLocation ? Joiner . on ( ", " ) . skipNulls ( ) . join ( org , location , country ) : org ; } else if ( commonName != null ) { return commonName ; } else { return altName ; } |
public class LByteFunctionBuilder { /** * One of ways of creating builder . This might be the only way ( considering all _ functional _ builders ) that might be utilize to specify generic params only once . */
@ Nonnull public static < R > LByteFunctionBuilder < R > byteFunction ( Consumer < LByteFunction < R > > consumer ) { } } | return new LByteFunctionBuilder ( consumer ) ; |
public class StatusRepresentation { /** * Determines whether the Twitter status is related to one of the users in the
* set of given ids .
* @ param infs
* a set of influential contributors
* @ param sender
* if the person who created the status is in the ids set , return
* true
* @ param userMentions
* if the status contains a user mention that is contained in the ids
* set , return true
* @ param retweetOrigin
* if the status is a retweet that was originated by a user in the
* ids set , return true
* @ returns true if one of the ids in the input parameter matches an id found
* in the tweet */
public boolean isRelatedTo ( InfluentialContributorSet infs , boolean sender , boolean userMentions , boolean retweetOrigin ) { } } | if ( sender ) { // check for the presence of the id in the path :
// { " user " : { " id " : USER _ ID
JsonElement js = getJsonObject ( ) . get ( "user" ) ; if ( js != null ) { js = js . getAsJsonObject ( ) . get ( "id" ) ; if ( js != null ) { // long userId = js . getAsLong ( ) ;
String userId = js . getAsString ( ) ; if ( infs . contains ( userId ) ) return true ; } } } // check for the presence of the id in the path :
// { " retweeted _ status " : { " user " : { " id " : USER _ ID
if ( retweetOrigin ) { JsonElement js = getJsonObject ( ) . get ( "retweeted_status" ) ; if ( js != null ) { js = js . getAsJsonObject ( ) . get ( "user" ) ; if ( js != null ) { js = js . getAsJsonObject ( ) . get ( "id" ) ; if ( js != null ) { // long userId = js . getAsLong ( ) ;
String userId = js . getAsString ( ) ; if ( infs . contains ( userId ) ) return true ; } } } } // check for the presence of the id in the path :
// { " entities " : { " user _ mentions " : [ { " id " : USER _ ID
if ( userMentions ) { JsonElement js = getJsonObject ( ) . get ( "entities" ) ; if ( js != null ) { js = js . getAsJsonObject ( ) . get ( "user_mentions" ) ; if ( js != null ) { JsonArray jsa = js . getAsJsonArray ( ) ; for ( int j = 0 ; j < jsa . size ( ) ; j ++ ) { js = jsa . get ( j ) . getAsJsonObject ( ) . get ( "id" ) ; if ( js != null ) { // long userId = js . getAsLong ( ) ;
String userId = js . getAsString ( ) ; if ( infs . contains ( userId ) ) return true ; } } } } } // otherwise the tweet isn ' t relevant
return false ; |
public class Keyspace { /** * Clear all the snapshots for a given keyspace .
* @ param snapshotName the user supplied snapshot name . It empty or null ,
* all the snapshots will be cleaned */
public static void clearSnapshot ( String snapshotName , String keyspace ) { } } | List < File > snapshotDirs = Directories . getKSChildDirectories ( keyspace ) ; Directories . clearSnapshot ( snapshotName , snapshotDirs ) ; |
public class LoadBalancers { /** * public @ Nullable String getLoadBalancerForAddress ( @ Nonnull String address ) throws InternalException , CloudException {
* APITrace . begin ( getProvider ( ) , " LB . getLoadBalancerForAddress " ) ;
* try {
* boolean isId = isId ( address ) ;
* String key = ( isId ? " publicIpId " : " publicIp " ) ;
* CSMethod method = new CSMethod ( getProvider ( ) ) ;
* Document doc = method . get ( method . buildUrl ( LIST _ LOAD _ BALANCER _ RULES , new Param [ ] { new Param ( key , address ) } ) , LIST _ LOAD _ BALANCER _ RULES ) ;
* NodeList rules = doc . getElementsByTagName ( " loadbalancerrule " ) ;
* if ( rules . getLength ( ) > 0 ) {
* return address ;
* return null ;
* finally {
* APITrace . end ( ) ; */
private @ Nullable String getRuleId ( @ Nonnull String loadBalancerId ) throws CloudException , InternalException { } } | // TODO : add trace
try { final boolean isId = isId ( loadBalancerId ) ; final String key = ( isId ? "publicIpId" : "publicIp" ) ; final Document doc = new CSMethod ( getProvider ( ) ) . get ( LIST_LOAD_BALANCER_RULES , new Param ( key , loadBalancerId ) ) ; NodeList rules = doc . getElementsByTagName ( "loadbalancerrule" ) ; for ( int i = 0 ; i < rules . getLength ( ) ; i ++ ) { NodeList attributes = rules . item ( i ) . getChildNodes ( ) ; String ruleId = null ; String publicIp = null ; for ( int j = 0 ; j < attributes . getLength ( ) ; j ++ ) { Node n = attributes . item ( j ) ; String name = n . getNodeName ( ) . toLowerCase ( ) ; String value ; if ( n . getChildNodes ( ) . getLength ( ) > 0 ) { value = n . getFirstChild ( ) . getNodeValue ( ) ; } else { value = null ; } if ( name . equals ( "publicip" ) ) { publicIp = value ; } else if ( name . equals ( "id" ) ) { ruleId = value ; } } if ( loadBalancerId . equals ( publicIp ) ) { return ruleId ; } } } catch ( CSException e ) { if ( e . getHttpCode ( ) == 431 ) { return null ; } throw e ; } return null ; |
public class Candidate { /** * For the given class locate and add Object Factory classes to the map .
* @ return { @ code true } if value class generation is enabled */
public boolean addObjectFactoryForClass ( JDefinedClass clazz ) { } } | JDefinedClass valueObjectFactoryClass = clazz . _package ( ) . _getClass ( FACTORY_CLASS_NAME ) ; if ( objectFactoryClasses . containsKey ( valueObjectFactoryClass . fullName ( ) ) ) { return false ; } objectFactoryClasses . put ( valueObjectFactoryClass . fullName ( ) , valueObjectFactoryClass ) ; JDefinedClass objectFactoryClass = null ; // If class has a non - hidden interface , then there is object factory in another package .
for ( Iterator < JClass > iter = clazz . _implements ( ) ; iter . hasNext ( ) ; ) { JClass interfaceClass = iter . next ( ) ; if ( ! isHiddenClass ( interfaceClass ) ) { objectFactoryClass = interfaceClass . _package ( ) . _getClass ( FACTORY_CLASS_NAME ) ; if ( objectFactoryClass != null ) { objectFactoryClasses . put ( objectFactoryClass . fullName ( ) , objectFactoryClass ) ; } } } return objectFactoryClass != null ; |
public class DatabaseDAODefaultImpl { public void rename_server ( Database database , String srcServerName , String newServerName ) throws DevFailed { } } | if ( ! database . isAccess_checked ( ) ) checkAccess ( database ) ; DeviceData argIn = new DeviceData ( ) ; argIn . insert ( new String [ ] { srcServerName , newServerName } ) ; command_inout ( database , "DbRenameServer" , argIn ) ; |
public class SecurityUtils { /** * Returns the value of the app setting , read from from app . settings or from the config file if app is root .
* @ param app the app in which to look for these keys
* @ param key setting key
* @ param defaultValue default value
* @ return the value of the configuration property as string */
public static String getSettingForApp ( App app , String key , String defaultValue ) { } } | if ( app != null ) { Map < String , Object > settings = app . getSettings ( ) ; if ( settings . containsKey ( key ) ) { return String . valueOf ( settings . getOrDefault ( key , defaultValue ) ) ; } else if ( app . isRootApp ( ) ) { return Config . getConfigParam ( key , defaultValue ) ; } } return defaultValue ; |
public class JavaElasticSearch { /** * 获取es client对象
* @ return */
public Client getClient ( ) { } } | if ( transportClient != null ) return ( ( TransportClientUtil ) transportClient . getEventClientUtil ( indexNameBuilder ) ) . getClient ( ) ; else return null ; |
public class SocketChannelWrapperBar { /** * Returns the server inet address that accepted the request . */
@ Override public InetSocketAddress ipLocal ( ) { } } | SocketChannel s = _channel ; if ( s != null ) { try { return ( InetSocketAddress ) s . getLocalAddress ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } else { return null ; } |
public class LocalNetworkGatewaysInner { /** * Gets the specified local network gateway in a resource group .
* @ param resourceGroupName The name of the resource group .
* @ param localNetworkGatewayName The name of the local network gateway .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < LocalNetworkGatewayInner > getByResourceGroupAsync ( String resourceGroupName , String localNetworkGatewayName , final ServiceCallback < LocalNetworkGatewayInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( getByResourceGroupWithServiceResponseAsync ( resourceGroupName , localNetworkGatewayName ) , serviceCallback ) ; |
public class PatternVariantBuilder { /** * Parses the { @ link # input } received at construction and generates the
* variants . When there are multiple patterns in the input , the method will
* recurse on itself to generate the variants for the tailing end after the
* first matched pattern .
* Generated variants are stored in a { @ link Set } , so there will never be
* any duplicates , even if the input ' s patterns were to result in such . */
private Set < String > variantsFor ( String input ) { } } | // Store current invocation ' s results
Set < String > variants = new HashSet < > ( ) ; Matcher m = regex . matcher ( input ) ; boolean matches = m . matches ( ) ; if ( ! matches ) { // if the regex does not find any patterns ,
// simply add the input as is
variants . add ( input ) ; // end recursion
return variants ; } // isolate the part before the first pattern
String head = m . group ( 1 ) ; // isolate the pattern itself , removing its wrapping { }
String patternGroup = m . group ( 2 ) . replaceAll ( "[\\{\\}]" , "" ) ; // isolate the remaining part of the input
String tail = m . group ( 6 ) ; // split the pattern into its options and add an empty
// string if it ends with a separator
List < String > patternParts = new ArrayList < > ( ) ; patternParts . addAll ( asList ( patternGroup . split ( "\\|" ) ) ) ; if ( patternGroup . endsWith ( "|" ) ) { patternParts . add ( "" ) ; } // Iterate over the current pattern ' s
// variants and construct the result .
for ( String part : patternParts ) { StringBuilder builder = new StringBuilder ( ) ; if ( head != null ) { builder . append ( head ) ; } builder . append ( part ) ; // recurse on the tail of the input
// to handle the next pattern
Set < String > tails = variantsFor ( tail ) ; // append all variants of the tail end
// and add each of them to the part we have
// built up so far .
for ( String tailVariant : tails ) { StringBuilder tailBuilder = new StringBuilder ( builder . toString ( ) ) ; tailBuilder . append ( tailVariant ) ; variants . add ( tailBuilder . toString ( ) ) ; } } return variants ; |
public class AmazonChimeClient { /** * Disassociates the primary provisioned phone number from the specified Amazon Chime user .
* @ param disassociatePhoneNumberFromUserRequest
* @ return Result of the DisassociatePhoneNumberFromUser operation returned by the service .
* @ throws UnauthorizedClientException
* The client is not currently authorized to make the request .
* @ throws NotFoundException
* One or more of the resources in the request does not exist in the system .
* @ throws ForbiddenException
* The client is permanently forbidden from making the request . For example , when a user tries to create an
* account from an unsupported region .
* @ throws BadRequestException
* The input parameters don ' t match the service ' s restrictions .
* @ throws ThrottledClientException
* The client exceeded its request rate limit .
* @ throws ServiceUnavailableException
* The service is currently unavailable .
* @ throws ServiceFailureException
* The service encountered an unexpected error .
* @ sample AmazonChime . DisassociatePhoneNumberFromUser
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / chime - 2018-05-01 / DisassociatePhoneNumberFromUser "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DisassociatePhoneNumberFromUserResult disassociatePhoneNumberFromUser ( DisassociatePhoneNumberFromUserRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDisassociatePhoneNumberFromUser ( request ) ; |
public class PathTemplate { /** * Returns the name of a singleton variable used by this template . If the template does not
* contain a single variable , returns null . */
@ Nullable public String singleVar ( ) { } } | if ( bindings . size ( ) == 1 ) { return bindings . entrySet ( ) . iterator ( ) . next ( ) . getKey ( ) ; } return null ; |
public class Get { /** * Executes a getter ( < tt > getX ( ) < / tt > ) on the target object which returns Double .
* If the specified attribute is , for example , " < tt > name < / tt > " , the called method
* will be " < tt > getName ( ) < / tt > " .
* @ param attributeName the name of the attribute
* @ return the result of the method execution */
public static Function < Object , Double > attrOfDouble ( final String attributeName ) { } } | return new Get < Object , Double > ( Types . DOUBLE , attributeName ) ; |
public class CssBuilder { /** * Add CSS class item . Empty / Null items are ignore . d
* @ param cssClass Item */
public void add ( String cssClass ) { } } | if ( StringUtils . isBlank ( cssClass ) ) { return ; } String [ ] parts = StringUtils . split ( cssClass , " " ) ; for ( String part : parts ) { items . add ( StringUtils . trim ( part ) ) ; } |
public class ManagerConnectionImpl { /** * Get asterisk version by ' core settings ' actions . This is supported from
* Asterisk 1.6 onwards .
* @ return
* @ throws Exception */
protected AsteriskVersion determineVersionByCoreSettings ( ) throws Exception { } } | ManagerResponse response = sendAction ( new CoreSettingsAction ( ) ) ; if ( ! ( response instanceof CoreSettingsResponse ) ) { // NOTE : you need system or reporting permissions
logger . info ( "Could not get core settings, do we have the necessary permissions?" ) ; return null ; } String ver = ( ( CoreSettingsResponse ) response ) . getAsteriskVersion ( ) ; return AsteriskVersion . getDetermineVersionFromString ( "Asterisk " + ver ) ; |
public class HttpsClientUtil { /** * POST方式向Http ( s ) 提交数据并获取返回结果
* @ param url URL
* @ param header Header
* @ param param 参数 ( String )
* @ return 服务器数据
* @ throws KeyManagementException [ ellipsis ]
* @ throws NoSuchAlgorithmException [ ellipsis ]
* @ throws IOException [ ellipsis ] */
public static String doPost ( String url , Map < String , String > header , String param ) throws KeyManagementException , NoSuchAlgorithmException , IOException { } } | String result = null ; HttpClient httpClient = new SSLClient ( ) ; httpClient . getParams ( ) . setParameter ( CoreConnectionPNames . CONNECTION_TIMEOUT , Constant . DEFAULT_CONN_TIMEOUT ) ; httpClient . getParams ( ) . setParameter ( CoreConnectionPNames . SO_TIMEOUT , Constant . DEFAULT_READ_TIMEOUT ) ; HttpPost httpPost = new HttpPost ( url ) ; Iterator iterator ; if ( header != null ) { Set < String > keys = header . keySet ( ) ; iterator = keys . iterator ( ) ; while ( iterator . hasNext ( ) ) { String key = ( String ) iterator . next ( ) ; httpPost . setHeader ( key , header . get ( key ) ) ; } } httpPost . setEntity ( new StringEntity ( param , Constant . DEFAULT_CHARSET ) ) ; HttpResponse response = httpClient . execute ( httpPost ) ; if ( response != null ) { HttpEntity resEntity = response . getEntity ( ) ; if ( resEntity != null ) { result = EntityUtils . toString ( resEntity , Constant . DEFAULT_CHARSET ) ; } } return result ; |
public class AbstractChangeObserver { /** * determines the target node ( the node to perform the change ) of one event item */
protected Node getContentNode ( Session session , String path ) throws RepositoryException { } } | Node node = null ; try { Item item = session . getItem ( path ) ; if ( item . isNode ( ) ) { node = ( Node ) item ; } else { node = item . getParent ( ) ; } while ( node != null && ! isTargetNode ( node ) && ( path = getTargetPath ( node ) ) != null ) { node = node . getParent ( ) ; } } catch ( PathNotFoundException ignore ) { // probably removed . . . ignore
} return path != null ? node : null ; |
public class PureXbaseSwitch { /** * Calls < code > caseXXX < / code > for each class of the model until one returns a non null result ; it yields that result .
* < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ return the first non - null result returned by a < code > caseXXX < / code > call .
* @ generated */
@ Override protected T doSwitch ( int classifierID , EObject theEObject ) { } } | switch ( classifierID ) { case PureXbasePackage . MODEL : { Model model = ( Model ) theEObject ; T result = caseModel ( model ) ; if ( result == null ) result = defaultCase ( theEObject ) ; return result ; } default : return defaultCase ( theEObject ) ; } |
public class MessageUtil { /** * Decomposes a compound key into its constituent parts . Arguments that were tainted during
* composition will remain tainted . */
public static String [ ] decompose ( String compoundKey ) { } } | String [ ] args = compoundKey . split ( "\\|" ) ; for ( int ii = 0 ; ii < args . length ; ii ++ ) { args [ ii ] = unescape ( args [ ii ] ) ; } return args ; |
public class AddIpRoutesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AddIpRoutesRequest addIpRoutesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( addIpRoutesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( addIpRoutesRequest . getDirectoryId ( ) , DIRECTORYID_BINDING ) ; protocolMarshaller . marshall ( addIpRoutesRequest . getIpRoutes ( ) , IPROUTES_BINDING ) ; protocolMarshaller . marshall ( addIpRoutesRequest . getUpdateSecurityGroupForDirectoryControllers ( ) , UPDATESECURITYGROUPFORDIRECTORYCONTROLLERS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CmsSearchIndexTable { /** * Shows dialog for variations of given resource . < p >
* @ param resource to show variations for */
void showSourcesWindow ( String resource ) { } } | final Window window = CmsBasicDialog . prepareWindow ( DialogWidth . wide ) ; CmsSourceDialog sourceDialog = new CmsSourceDialog ( m_manager , new Runnable ( ) { public void run ( ) { window . close ( ) ; } } ) ; sourceDialog . setSource ( resource ) ; window . setCaption ( CmsVaadinUtils . getMessageText ( Messages . GUI_SEARCHINDEX_INDEXSOURCE_SHOW_1 , resource ) ) ; window . setContent ( sourceDialog ) ; UI . getCurrent ( ) . addWindow ( window ) ; |
public class DSLMapParser { /** * src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 144:1 : meta _ section : LEFT _ SQUARE ( LITERAL ) ? RIGHT _ SQUARE - > ^ ( VT _ META [ $ LEFT _ SQUARE , \ " META SECTION \ " ] ( LITERAL ) ? ) ; */
public final DSLMapParser . meta_section_return meta_section ( ) throws RecognitionException { } } | DSLMapParser . meta_section_return retval = new DSLMapParser . meta_section_return ( ) ; retval . start = input . LT ( 1 ) ; Object root_0 = null ; Token LEFT_SQUARE13 = null ; Token LITERAL14 = null ; Token RIGHT_SQUARE15 = null ; Object LEFT_SQUARE13_tree = null ; Object LITERAL14_tree = null ; Object RIGHT_SQUARE15_tree = null ; RewriteRuleTokenStream stream_RIGHT_SQUARE = new RewriteRuleTokenStream ( adaptor , "token RIGHT_SQUARE" ) ; RewriteRuleTokenStream stream_LITERAL = new RewriteRuleTokenStream ( adaptor , "token LITERAL" ) ; RewriteRuleTokenStream stream_LEFT_SQUARE = new RewriteRuleTokenStream ( adaptor , "token LEFT_SQUARE" ) ; try { // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 145:5 : ( LEFT _ SQUARE ( LITERAL ) ? RIGHT _ SQUARE - > ^ ( VT _ META [ $ LEFT _ SQUARE , \ " META SECTION \ " ] ( LITERAL ) ? ) )
// src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 145:7 : LEFT _ SQUARE ( LITERAL ) ? RIGHT _ SQUARE
{ LEFT_SQUARE13 = ( Token ) match ( input , LEFT_SQUARE , FOLLOW_LEFT_SQUARE_in_meta_section530 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) stream_LEFT_SQUARE . add ( LEFT_SQUARE13 ) ; // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 145:19 : ( LITERAL ) ?
int alt7 = 2 ; int LA7_0 = input . LA ( 1 ) ; if ( ( LA7_0 == LITERAL ) ) { alt7 = 1 ; } switch ( alt7 ) { case 1 : // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 145:19 : LITERAL
{ LITERAL14 = ( Token ) match ( input , LITERAL , FOLLOW_LITERAL_in_meta_section532 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) stream_LITERAL . add ( LITERAL14 ) ; } break ; } RIGHT_SQUARE15 = ( Token ) match ( input , RIGHT_SQUARE , FOLLOW_RIGHT_SQUARE_in_meta_section535 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) stream_RIGHT_SQUARE . add ( RIGHT_SQUARE15 ) ; // AST REWRITE
// elements : LITERAL
// token labels :
// rule labels : retval
// token list labels :
// rule list labels :
// wildcard labels :
if ( state . backtracking == 0 ) { retval . tree = root_0 ; RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream ( adaptor , "rule retval" , retval != null ? retval . getTree ( ) : null ) ; root_0 = ( Object ) adaptor . nil ( ) ; // 146:5 : - > ^ ( VT _ META [ $ LEFT _ SQUARE , \ " META SECTION \ " ] ( LITERAL ) ? )
{ // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 146:8 : ^ ( VT _ META [ $ LEFT _ SQUARE , \ " META SECTION \ " ] ( LITERAL ) ? )
{ Object root_1 = ( Object ) adaptor . nil ( ) ; root_1 = ( Object ) adaptor . becomeRoot ( ( Object ) adaptor . create ( VT_META , LEFT_SQUARE13 , "META SECTION" ) , root_1 ) ; // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 146:48 : ( LITERAL ) ?
if ( stream_LITERAL . hasNext ( ) ) { adaptor . addChild ( root_1 , stream_LITERAL . nextNode ( ) ) ; } stream_LITERAL . reset ( ) ; adaptor . addChild ( root_0 , root_1 ) ; } } retval . tree = root_0 ; } } retval . stop = input . LT ( - 1 ) ; if ( state . backtracking == 0 ) { retval . tree = ( Object ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( Object ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { // do for sure before leaving
} return retval ; |
public class DefaultUrlCreator { /** * Appends all the request parameters to the URI buffer */
private void appendRequestParams ( FastStringWriter actualUriBuf , Map < Object , Object > params , String encoding ) { } } | boolean querySeparator = false ; for ( Map . Entry < Object , Object > entry : params . entrySet ( ) ) { Object name = entry . getKey ( ) ; if ( name . equals ( GrailsControllerClass . CONTROLLER ) || name . equals ( GrailsControllerClass . ACTION ) || name . equals ( ARGUMENT_ID ) ) { continue ; } if ( ! querySeparator ) { actualUriBuf . append ( '?' ) ; querySeparator = true ; } else { actualUriBuf . append ( ENTITY_AMPERSAND ) ; } Object value = entry . getValue ( ) ; if ( value instanceof Collection ) { Collection values = ( Collection ) value ; Iterator valueIterator = values . iterator ( ) ; while ( valueIterator . hasNext ( ) ) { Object currentValue = valueIterator . next ( ) ; appendRequestParam ( actualUriBuf , name , currentValue , encoding ) ; if ( valueIterator . hasNext ( ) ) { actualUriBuf . append ( ENTITY_AMPERSAND ) ; } } } else if ( value != null && value . getClass ( ) . isArray ( ) ) { Object [ ] array = ( Object [ ] ) value ; for ( int j = 0 ; j < array . length ; j ++ ) { Object currentValue = array [ j ] ; appendRequestParam ( actualUriBuf , name , currentValue , encoding ) ; if ( j < ( array . length - 1 ) ) { actualUriBuf . append ( ENTITY_AMPERSAND ) ; } } } else { appendRequestParam ( actualUriBuf , name , value , encoding ) ; } } |
public class FieldList { /** * Do a remote command .
* @ param strCommand
* @ param properties
* @ return */
public final Object handleRemoteCommand ( String strCommand , Map < String , Object > properties ) throws DBException , RemoteException { } } | boolean bDontCallIfLocal = false ; if ( properties != null ) if ( Constants . TRUE . equals ( properties . get ( "DontCallIfLocal" ) ) ) bDontCallIfLocal = true ; return this . handleRemoteCommand ( strCommand , properties , true , bDontCallIfLocal , true ) ; |
public class PathShadow3afp { /** * Compute the crossings between this shadow and
* the given segment .
* @ param crossings is the initial value of the crossings .
* @ param x0 is the first point of the segment .
* @ param y0 is the first point of the segment .
* @ param z0 is the first point of the segment .
* @ param x1 is the second point of the segment .
* @ param y1 is the second point of the segment .
* @ param z1 is the second point of the segment .
* @ return the crossings or { @ link MathConstants # SHAPE _ INTERSECTS } . */
@ Pure public int computeCrossings ( int crossings , double x0 , double y0 , double z0 , double x1 , double y1 , double z1 ) { } } | if ( this . bounds == null ) { return crossings ; } int numCrosses = Segment3afp . computeCrossingsFromRect ( crossings , this . bounds . getMinX ( ) , this . bounds . getMinY ( ) , this . bounds . getMinZ ( ) , this . bounds . getMaxX ( ) , this . bounds . getMaxY ( ) , this . bounds . getMaxZ ( ) , x0 , y0 , z0 , x1 , y1 , z1 ) ; if ( numCrosses == GeomConstants . SHAPE_INTERSECTS ) { // The segment is intersecting the bounds of the shadow path .
// We must consider the shape of shadow path now .
final PathShadowData data = new PathShadowData ( this . bounds . getMaxX ( ) , this . bounds . getMinY ( ) , this . bounds . getMaxY ( ) ) ; computeCrossings1 ( this . path , x0 , y0 , z0 , x1 , y1 , z1 , false , this . path . getWindingRule ( ) , this . path . getGeomFactory ( ) , data ) ; numCrosses = data . getCrossings ( ) ; final int mask = this . path . getWindingRule ( ) == PathWindingRule . NON_ZERO ? - 1 : 2 ; if ( numCrosses == GeomConstants . SHAPE_INTERSECTS || ( numCrosses & mask ) != 0 ) { // The given line is intersecting the path shape
return GeomConstants . SHAPE_INTERSECTS ; } // There is no intersection with the shadow path ' s shape .
int inc = 0 ; if ( data . hasX4ymin ( ) ) { ++ inc ; } if ( data . hasX4ymax ( ) ) { ++ inc ; } if ( y0 < y1 ) { numCrosses += inc ; } else { numCrosses -= inc ; } // Apply the previously computed crossings
numCrosses += crossings ; } return numCrosses ; |
public class NodeUtil { /** * This method determines whether the supplied URI matches the
* original URI on the node .
* @ param node The node
* @ param uri The URI
* @ return Whether the supplied URI is the same as the node ' s original
* @ deprecated Only used in original JavaAgent . Not to be used with OpenTracing . */
@ Deprecated public static boolean isOriginalURI ( Node node , String uri ) { } } | if ( node . getUri ( ) . equals ( uri ) ) { return true ; } if ( node . hasProperty ( APM_ORIGINAL_URI ) ) { return node . getProperties ( APM_ORIGINAL_URI ) . iterator ( ) . next ( ) . getValue ( ) . equals ( uri ) ; } return false ; |
public class SocketBindingManagerImpl { /** * { @ inheritDoc } */
@ Override public DatagramSocket createDatagramSocket ( SocketAddress address ) throws SocketException { } } | Assert . checkNotNullParam ( "address" , address ) ; return new ManagedDatagramSocketBinding ( null , this . unnamedRegistry , address ) ; |
public class AWSOpsWorksClient { /** * Gets a generated host name for the specified layer , based on the current host name theme .
* < b > Required Permissions < / b > : To use this action , an IAM user must have a Manage permissions level for the stack ,
* or an attached policy that explicitly grants permissions . For more information on user permissions , see < a
* href = " http : / / docs . aws . amazon . com / opsworks / latest / userguide / opsworks - security - users . html " > Managing User
* Permissions < / a > .
* @ param getHostnameSuggestionRequest
* @ return Result of the GetHostnameSuggestion operation returned by the service .
* @ throws ValidationException
* Indicates that a request was not valid .
* @ throws ResourceNotFoundException
* Indicates that a resource was not found .
* @ sample AWSOpsWorks . GetHostnameSuggestion
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / opsworks - 2013-02-18 / GetHostnameSuggestion " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public GetHostnameSuggestionResult getHostnameSuggestion ( GetHostnameSuggestionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetHostnameSuggestion ( request ) ; |
public class ParameterBinder { /** * Binds the parameters to the given query and applies special parameter types ( e . g . pagination ) .
* @ param query must not be { @ literal null } .
* @ return */
public EbeanQueryWrapper bindAndPrepare ( EbeanQueryWrapper query ) { } } | Assert . notNull ( query , "query must not be null!" ) ; return bindAndPrepare ( query , parameters ) ; |
public class SingleError { /** * Overridable implementation of Throwable for the Linked exception field .
* This can be overridden to implement a different algorithm . This is
* customizable because there is no default way of hashing Exceptions in Java .
* If you override this method you must also override
* { @ link # equalsLinkedException ( Throwable , Throwable ) } !
* @ param aHCG
* The hash code generator to append to . Never < code > null < / code > .
* @ param t
* The Throwable to append . May be < code > null < / code > . */
@ OverrideOnDemand protected void hashCodeLinkedException ( @ Nonnull final HashCodeGenerator aHCG , @ Nullable final Throwable t ) { } } | if ( t == null ) aHCG . append ( HashCodeCalculator . HASHCODE_NULL ) ; else aHCG . append ( t . getClass ( ) ) . append ( t . getMessage ( ) ) ; |
public class AccountCRCAlgs { /** * TODO : more tests */
public static boolean alg_74 ( int [ ] blz , int [ ] number ) { } } | int sum = addProducts ( number , 0 , 8 , new int [ ] { 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 } , true ) ; int crc = ( 10 - sum % 10 ) % 10 ; if ( number [ 9 ] == crc ) { return true ; } if ( number [ 0 ] + number [ 1 ] + number [ 2 ] + number [ 3 ] == 0 && number [ 4 ] != 0 ) { crc = ( 5 - sum % 5 ) ; return number [ 9 ] == crc ; } return false ; |
public class BottomSheetDialog { /** * Set the height params of this BottomSheetDialog ' s content view .
* @ param height The height param . Can be the size in pixels , or { @ link ViewGroup . LayoutParams # WRAP _ CONTENT } or { @ link ViewGroup . LayoutParams # MATCH _ PARENT } .
* @ return The BottomSheetDialog for chaining methods . */
public BottomSheetDialog heightParam ( int height ) { } } | if ( mLayoutHeight != height ) { mLayoutHeight = height ; if ( isShowing ( ) && mContentView != null ) { mRunShowAnimation = true ; mContainer . forceLayout ( ) ; mContainer . requestLayout ( ) ; } } return this ; |
public class ProductPartitionTreeImpl { /** * Retrieves the { @ link BiddingStrategyConfiguration } of an ad group .
* @ param services the AdWordsServices
* @ param session the session to use for the request
* @ param adGroupId the ad group ID
* @ return the non - null BiddingStrategyConfiguration of the ad group */
private static BiddingStrategyConfiguration getAdGroupBiddingStrategyConfiguration ( AdWordsServicesInterface services , AdWordsSession session , Long adGroupId ) throws ApiException , RemoteException { } } | AdGroupServiceInterface adGroupService = services . get ( session , AdGroupServiceInterface . class ) ; Selector selector = new SelectorBuilder ( ) . fields ( AdGroupField . Id , AdGroupField . BiddingStrategyType , AdGroupField . BiddingStrategyId , AdGroupField . BiddingStrategyName ) . equalsId ( adGroupId ) . build ( ) ; AdGroupPage adGroupPage = adGroupService . get ( selector ) ; if ( adGroupPage . getEntries ( ) == null || adGroupPage . getEntries ( ) . length == 0 ) { throw new IllegalArgumentException ( "No ad group found with ID " + adGroupId ) ; } AdGroup adGroup = adGroupPage . getEntries ( 0 ) ; Preconditions . checkState ( adGroup . getBiddingStrategyConfiguration ( ) != null , "Unexpected state - ad group ID %s has a null BiddingStrategyConfiguration" , adGroupId ) ; return adGroup . getBiddingStrategyConfiguration ( ) ; |
public class Expression { /** * Creates a code chunk representing a JavaScript number literal . */
public static Expression number ( long value ) { } } | Preconditions . checkArgument ( IntegerNode . isInRange ( value ) , "Number is outside JS safe integer range: %s" , value ) ; return Leaf . create ( Long . toString ( value ) , /* isCheap = */
true ) ; |
public class DeleteRuleRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteRuleRequest deleteRuleRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteRuleRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteRuleRequest . getRuleId ( ) , RULEID_BINDING ) ; protocolMarshaller . marshall ( deleteRuleRequest . getChangeToken ( ) , CHANGETOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ServletUtil { /** * Gets the URL for the provided absolute path or < code > null < / code > if no resource
* is mapped to the path .
* @ deprecated Use regular methods directly
* @ see ServletContext # getResource ( java . lang . String )
* @ see ServletContextCache # getResource ( java . lang . String )
* @ see ServletContextCache # getResource ( javax . servlet . ServletContext , java . lang . String ) */
@ Deprecated public static URL getResource ( ServletContext servletContext , String path ) throws MalformedURLException { } } | return servletContext . getResource ( path ) ; |
public class HexUtil { /** * Appends 4 characters to a StringBuilder with the short in a " Big Endian "
* hexidecimal format . For example , a short 0x1234 will be appended as a
* String in format " 1234 " . A short of value 0 will be appended as " 0000 " .
* @ param buffer The StringBuilder the short value in hexidecimal format
* will be appended to . If the buffer is null , this method will throw
* a NullPointerException .
* @ param value The short value that will be converted to a hexidecimal String . */
static public void appendHexString ( StringBuilder buffer , short value ) { } } | assertNotNull ( buffer ) ; int nibble = ( value & 0xF000 ) >>> 12 ; buffer . append ( HEX_TABLE [ nibble ] ) ; nibble = ( value & 0x0F00 ) >>> 8 ; buffer . append ( HEX_TABLE [ nibble ] ) ; nibble = ( value & 0x00F0 ) >>> 4 ; buffer . append ( HEX_TABLE [ nibble ] ) ; nibble = ( value & 0x000F ) ; buffer . append ( HEX_TABLE [ nibble ] ) ; |
public class MetricCollectorSupport { /** * Retarts with a new CloudWatch collector . */
static synchronized boolean restartSingleton ( CloudWatchMetricConfig config ) { } } | if ( singleton == null ) { throw new IllegalStateException ( MetricCollectorSupport . class . getSimpleName ( ) + " has neven been initialized" ) ; } log . info ( "Re-initializing " + MetricCollectorSupport . class . getSimpleName ( ) ) ; singleton . stop ( ) ; // singleton is set to null at this point via the stop method
return createAndStartCollector ( config ) ; |
public class StandardClassBodyEmitter { /** * / * ( non - Javadoc )
* @ see com . pogofish . jadt . emitter . ClassBodyEmitter # constructorFactory ( com . pogofish . jadt . emitter . Sink , java . lang . String , java . lang . String , com . pogofish . jadt . ast . Constructor ) */
@ Override public void constructorFactory ( Sink sink , String dataTypeName , String factoryName , List < String > typeParametrs , Constructor constructor ) { } } | if ( constructor . args . isEmpty ( ) ) { if ( typeParametrs . isEmpty ( ) ) { logger . finest ( "Generating no args, no types factory for " + constructor . name ) ; } else { logger . finest ( "Generating no args, type arguments factory for " + constructor . name ) ; sink . write ( " @SuppressWarnings(\"rawtypes\")\n" ) ; } sink . write ( " private static final " + dataTypeName + " _" + factoryName + " = new " + constructor . name + "();\n" ) ; sink . write ( ASTPrinter . printComments ( " " , commentProcessor . leftAlign ( commentProcessor . javaDocOnly ( constructor . comments ) ) ) ) ; if ( ! typeParametrs . isEmpty ( ) ) { sink . write ( " @SuppressWarnings(\"unchecked\")\n" ) ; } sink . write ( " public static final " ) ; emitParameterizedTypeName ( sink , typeParametrs ) ; sink . write ( " " ) ; sink . write ( dataTypeName ) ; emitParameterizedTypeName ( sink , typeParametrs ) ; sink . write ( " _" + factoryName + "() { return _" + factoryName + "; }" ) ; } else { logger . finest ( "Generating args factory for " + constructor . name ) ; sink . write ( ASTPrinter . printComments ( " " , commentProcessor . leftAlign ( constructor . comments ) ) ) ; sink . write ( " public static final " ) ; emitParameterizedTypeName ( sink , typeParametrs ) ; sink . write ( " " ) ; sink . write ( dataTypeName ) ; emitParameterizedTypeName ( sink , typeParametrs ) ; sink . write ( " _" + factoryName + "(" ) ; constructorArgs ( sink , constructor , true ) ; sink . write ( ") { return new " + constructor . name ) ; emitParameterizedTypeName ( sink , typeParametrs ) ; sink . write ( "(" ) ; constructorArgs ( sink , constructor , false ) ; sink . write ( "); }" ) ; } |
public class ExhaustiveNeighbor { /** * Finds the index of the point which has the smallest Euclidean distance to ' p ' and is { @ code < } maxDistance
* away .
* @ param p A point .
* @ param maxDistance The maximum distance ( Euclidean squared ) the neighbor can be .
* @ return Index of the closest point . */
public int findClosest ( P p , double maxDistance ) { } } | int best = - 1 ; bestDistance = maxDistance ; for ( int i = 0 ; i < points . size ( ) ; i ++ ) { P c = points . get ( i ) ; double distanceC = distance . distance ( p , c ) ; if ( distanceC <= bestDistance ) { bestDistance = distanceC ; best = i ; } } return best ; |
public class JVnTextPro { /** * Do pos tagging .
* @ param text to be tagged with POS of speech ( need to have words segmented )
* @ return the string */
public String posTagging ( String text ) { } } | String ret = text ; if ( vnPosTagger != null ) { ret = vnPosTagger . tagging ( text ) ; } return ret ; |
public class BlockConstraintSolver { /** * Extracts a specific { @ link BoundingBox } from the domain of a { @ link RectangularRegion } .
* @ param rect The { @ link RectangularRegion } from to extract the { @ link BoundingBox } .
* @ return A specific { @ link BoundingBox } from the domain of a { @ link RectangularRegion } . */
public BoundingBox extractBoundingBoxesFromSTPs ( RectangularCuboidRegion rect ) { } } | Bounds xLB , xUB , yLB , yUB , zLB , zUB ; xLB = new Bounds ( ( ( AllenInterval ) rect . getInternalVariables ( ) [ 0 ] ) . getEST ( ) , ( ( AllenInterval ) rect . getInternalVariables ( ) [ 0 ] ) . getLST ( ) ) ; xUB = new Bounds ( ( ( AllenInterval ) rect . getInternalVariables ( ) [ 0 ] ) . getEET ( ) , ( ( AllenInterval ) rect . getInternalVariables ( ) [ 0 ] ) . getLET ( ) ) ; yLB = new Bounds ( ( ( AllenInterval ) rect . getInternalVariables ( ) [ 1 ] ) . getEST ( ) , ( ( AllenInterval ) rect . getInternalVariables ( ) [ 1 ] ) . getLST ( ) ) ; yUB = new Bounds ( ( ( AllenInterval ) rect . getInternalVariables ( ) [ 1 ] ) . getEET ( ) , ( ( AllenInterval ) rect . getInternalVariables ( ) [ 1 ] ) . getLET ( ) ) ; zLB = new Bounds ( ( ( AllenInterval ) rect . getInternalVariables ( ) [ 2 ] ) . getEST ( ) , ( ( AllenInterval ) rect . getInternalVariables ( ) [ 2 ] ) . getLST ( ) ) ; zUB = new Bounds ( ( ( AllenInterval ) rect . getInternalVariables ( ) [ 2 ] ) . getEET ( ) , ( ( AllenInterval ) rect . getInternalVariables ( ) [ 2 ] ) . getLET ( ) ) ; return new BoundingBox ( xLB , xUB , yLB , yUB , zLB , zUB ) ; |
public class ThreadCpuStats { /** * Start collecting cpu stats for the threads . */
public synchronized void start ( ) { } } | if ( ! running ) { running = true ; Thread t = new Thread ( new CpuStatRunnable ( ) , "ThreadCpuStatsCollector" ) ; t . setDaemon ( true ) ; t . start ( ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.