signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Reflections { /** * Checks if the given type is fully resolved . */ public static boolean isResolved ( Type type ) { } }
if ( type instanceof GenericArrayType ) { return isResolved ( ( ( GenericArrayType ) type ) . getGenericComponentType ( ) ) ; } if ( type instanceof ParameterizedType ) { for ( Type t : ( ( ParameterizedType ) type ) . getActualTypeArguments ( ) ) { if ( ! isResolved ( t ) ) { return false ; } } return true ; } return type instanceof Class ;
public class CycledLeScanner { /** * Tells the cycler the scan rate and whether it is in operating in background mode . * Background mode flag is used only with the Android 5.0 scanning implementations to switch * between LOW _ POWER _ MODE vs . LOW _ LATENCY _ MODE * @ param backgroundFlag */ @ MainThread public void setScanPeriods ( long scanPeriod , long betweenScanPeriod , boolean backgroundFlag ) { } }
LogManager . d ( TAG , "Set scan periods called with %s, %s Background mode must have changed." , scanPeriod , betweenScanPeriod ) ; if ( mBackgroundFlag != backgroundFlag ) { mRestartNeeded = true ; } mBackgroundFlag = backgroundFlag ; mScanPeriod = scanPeriod ; mBetweenScanPeriod = betweenScanPeriod ; if ( mBackgroundFlag ) { LogManager . d ( TAG , "We are in the background. Setting wakeup alarm" ) ; setWakeUpAlarm ( ) ; } else { LogManager . d ( TAG , "We are not in the background. Cancelling wakeup alarm" ) ; cancelWakeUpAlarm ( ) ; } long now = SystemClock . elapsedRealtime ( ) ; if ( mNextScanCycleStartTime > now ) { // We are waiting to start scanning . We may need to adjust the next start time // only do an adjustment if we need to make it happen sooner . Otherwise , it will // take effect on the next cycle . long proposedNextScanStartTime = ( mLastScanCycleEndTime + betweenScanPeriod ) ; if ( proposedNextScanStartTime < mNextScanCycleStartTime ) { mNextScanCycleStartTime = proposedNextScanStartTime ; LogManager . i ( TAG , "Adjusted nextScanStartTime to be %s" , new Date ( mNextScanCycleStartTime - SystemClock . elapsedRealtime ( ) + System . currentTimeMillis ( ) ) ) ; } } if ( mScanCycleStopTime > now ) { // we are waiting to stop scanning . We may need to adjust the stop time // only do an adjustment if we need to make it happen sooner . Otherwise , it will // take effect on the next cycle . long proposedScanStopTime = ( mLastScanCycleStartTime + scanPeriod ) ; if ( proposedScanStopTime < mScanCycleStopTime ) { mScanCycleStopTime = proposedScanStopTime ; LogManager . i ( TAG , "Adjusted scanStopTime to be %s" , mScanCycleStopTime ) ; } }
public class Bits { /** * Reads an int from a buffer . * @ param buf the buffer * @ return the int read from the buffer */ public static int readInt ( ByteBuffer buf ) { } }
byte len = buf . get ( ) ; if ( len == 0 ) return 0 ; return makeInt ( buf , len ) ;
public class CopyToModule { /** * Copy files and replace workdir PI contents . * @ param src source URI in temporary directory * @ param target target URI in temporary directory * @ param copytoTargetFilename target URI relative to temporary directory * @ param inputMapInTemp input map URI in temporary directory */ private void copyFileWithPIReplaced ( final URI src , final URI target , final URI copytoTargetFilename , final URI inputMapInTemp ) { } }
assert src . isAbsolute ( ) ; assert target . isAbsolute ( ) ; assert ! copytoTargetFilename . isAbsolute ( ) ; assert inputMapInTemp . isAbsolute ( ) ; final File workdir = new File ( target ) . getParentFile ( ) ; if ( ! workdir . exists ( ) && ! workdir . mkdirs ( ) ) { logger . error ( "Failed to create copy-to target directory " + workdir . toURI ( ) ) ; return ; } final File path2project = getPathtoProject ( copytoTargetFilename , target , inputMapInTemp , job ) ; final File path2rootmap = getPathtoRootmap ( target , inputMapInTemp ) ; XMLFilter filter = new CopyToFilter ( workdir , path2project , path2rootmap , src , target ) ; logger . info ( "Processing " + src + " to " + target ) ; try { xmlUtils . transform ( src , target , Collections . singletonList ( filter ) ) ; } catch ( final DITAOTException e ) { logger . error ( "Failed to write copy-to file: " + e . getMessage ( ) , e ) ; }
public class JMXetricXmlConfigurationService { /** * Makes a list of { @ link MBeanAttribute } that corresponds to an < attribute > * node that contains multiple < composite > nodes . * @ param attr * the < attribute > node * @ param mBeanName * name of the parent mbean * @ param mBeanPublishName * publish name of the parent mbean * @ param mBeanDMax * value of dmax specified by parent mbean * @ return list of { @ link MBeanAttribute } , one for each < composite > * @ throws XPathExpressionException */ private List < MBeanAttribute > makeCompositeAttributes ( Node attr , String mBeanName , String mBeanPublishName , String mBeanDMax ) throws XPathExpressionException { } }
List < MBeanAttribute > mbas = new Vector < MBeanAttribute > ( ) ; MBeanAttribute mba = null ; NodeList composites = getXmlNodeSet ( "composite" , attr ) ; String name = selectParameterFromNode ( attr , "name" , "NULL" ) ; for ( int l = 0 ; l < composites . getLength ( ) ; l ++ ) { Node composite = composites . item ( l ) ; mba = makeMBeanCompositeAttribute ( composite , mBeanName , mBeanPublishName , mBeanDMax , name ) ; log . finer ( "Attr is " + name ) ; mbas . add ( mba ) ; } return mbas ;
public class NlsBundleFactoryGenerator { /** * Generates the { @ code createBundle } method . * @ param sourceWriter is the { @ link SourceWriter } . * @ param logger is the { @ link TreeLogger } . * @ param context is the { @ link GeneratorContext } . */ protected void generateMethodCreateBundle ( SourceWriter sourceWriter , TreeLogger logger , GeneratorContext context ) { } }
// method declaration sourceWriter . print ( "public <BUNDLE extends " ) ; sourceWriter . print ( NlsBundle . class . getSimpleName ( ) ) ; sourceWriter . println ( "> BUNDLE createBundle(Class<BUNDLE> bundleInterface) {" ) ; sourceWriter . indent ( ) ; // method body sourceWriter . println ( "BUNDLE bundle = getBundle(bundleInterface);" ) ; sourceWriter . println ( "if (bundle == null) {" ) ; sourceWriter . indent ( ) ; // create and register generateBlockBundleCreation ( sourceWriter , logger , context ) ; sourceWriter . outdent ( ) ; sourceWriter . println ( "}" ) ; sourceWriter . println ( "return bundle;" ) ; // end method . . . sourceWriter . outdent ( ) ; sourceWriter . println ( "}" ) ;
public class Type { /** * Returns the descriptor corresponding to this type . * @ return the descriptor corresponding to this type . */ public String getDescriptor ( ) { } }
if ( sort == OBJECT ) { return valueBuffer . substring ( valueBegin - 1 , valueEnd + 1 ) ; } else if ( sort == INTERNAL ) { StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( 'L' ) ; stringBuilder . append ( valueBuffer , valueBegin , valueEnd ) ; stringBuilder . append ( ';' ) ; return stringBuilder . toString ( ) ; } else { return valueBuffer . substring ( valueBegin , valueEnd ) ; }
public class ZealotKhala { /** * 根据指定的模式字符串生成带 " AND " 前缀的 " NOT LIKE " 模糊查询的SQL片段 . * < p > 示例 : 传入 { " b . title " , " Java % " } 两个参数 , 生成的SQL片段为 : " AND b . title NOT LIKE ' Java % ' " < / p > * @ param field 数据库字段 * @ param pattern 模式字符串 * @ return ZealotKhala实例 */ public ZealotKhala andNotLikePattern ( String field , String pattern ) { } }
return this . doLikePattern ( ZealotConst . AND_PREFIX , field , pattern , true , false ) ;
public class Span { /** * Returns a Span that covers all rows beginning with a prefix . */ public static Span prefix ( Bytes rowPrefix ) { } }
Objects . requireNonNull ( rowPrefix ) ; Bytes fp = followingPrefix ( rowPrefix ) ; return new Span ( rowPrefix , true , fp == null ? Bytes . EMPTY : fp , false ) ;
public class UserDictionary { /** * Lookup words in text * @ param text text to look up user dictionary matches for * @ return list of UserDictionaryMatch , not null */ public List < UserDictionaryMatch > findUserDictionaryMatches ( String text ) { } }
List < UserDictionaryMatch > matchInfos = new ArrayList < > ( ) ; int startIndex = 0 ; while ( startIndex < text . length ( ) ) { int matchLength = 0 ; while ( startIndex + matchLength < text . length ( ) && entries . containsKeyPrefix ( text . substring ( startIndex , startIndex + matchLength + 1 ) ) ) { matchLength ++ ; } if ( matchLength > 0 ) { String match = text . substring ( startIndex , startIndex + matchLength ) ; int [ ] details = entries . get ( match ) ; if ( details != null ) { matchInfos . addAll ( makeMatchDetails ( startIndex , details ) ) ; } } startIndex ++ ; } return matchInfos ;
public class ProxyDataSourceBuilder { /** * Register { @ link CommonsSlowQueryListener } . * @ param thresholdTime slow query threshold time * @ param timeUnit slow query threshold time unit * @ return builder * @ since 1.4.1 */ public ProxyDataSourceBuilder logSlowQueryByCommons ( long thresholdTime , TimeUnit timeUnit ) { } }
return logSlowQueryByCommons ( thresholdTime , timeUnit , null , null ) ;
public class IdType { /** * Creates a new instance of this ID which is identical , but refers to the * specific version of this resource ID noted by theVersion . * @ param theVersion * The actual version string , e . g . " 1" * @ return A new instance of IdType which is identical , but refers to the * specific version of this resource ID noted by theVersion . */ public IdType withVersion ( String theVersion ) { } }
Validate . notBlank ( theVersion , "Version may not be null or empty" ) ; String existingValue = getValue ( ) ; int i = existingValue . indexOf ( "_history" ) ; String value ; if ( i > 1 ) { value = existingValue . substring ( 0 , i - 1 ) ; } else { value = existingValue ; } return new IdType ( value + '/' + "_history" + '/' + theVersion ) ;
public class OperationsInner { /** * Gets a list of compute operations . * @ 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 < ComputeOperationValueInner > > listAsync ( final ServiceCallback < List < ComputeOperationValueInner > > serviceCallback ) { } }
return ServiceFuture . fromResponse ( listWithServiceResponseAsync ( ) , serviceCallback ) ;
public class GoogleAnalyticsUnsampledExtractor { /** * Copy WorkUnitState so that work unit also contains job state . FileBasedExtractor needs properties from job state ( mostly source . * properties ) , * where it has been already removed when reached here . * @ param src * @ return */ private WorkUnitState copyOf ( WorkUnitState src ) { } }
WorkUnit copiedWorkUnit = WorkUnit . copyOf ( src . getWorkunit ( ) ) ; copiedWorkUnit . addAllIfNotExist ( src . getJobState ( ) ) ; WorkUnitState workUnitState = new WorkUnitState ( copiedWorkUnit , src . getJobState ( ) ) ; workUnitState . addAll ( src ) ; return workUnitState ;
public class ReadWriteLockPoint { /** * To call when the thread leaves the read mode and release this lock point . */ public void endRead ( ) { } }
SynchronizationPoint < NoException > sp ; synchronized ( this ) { // if others are still reading , nothing to do if ( -- readers > 0 ) return ; // if nobody is waiting to write , nothing to do if ( writersWaiting == null ) return ; sp = writersWaiting . removeFirst ( ) ; if ( writersWaiting . isEmpty ( ) ) writersWaiting = null ; writer = true ; } sp . unblock ( ) ;
public class CouchDBSchemaManager { /** * Drop database . * @ throws IOException * Signals that an I / O exception has occurred . * @ throws ClientProtocolException * the client protocol exception * @ throws URISyntaxException * the URI syntax exception */ private void dropDatabase ( ) throws IOException , ClientProtocolException , URISyntaxException { } }
HttpResponse delRes = null ; try { URI uri = new URI ( CouchDBConstants . PROTOCOL , null , httpHost . getHostName ( ) , httpHost . getPort ( ) , CouchDBConstants . URL_SEPARATOR + databaseName . toLowerCase ( ) , null , null ) ; HttpDelete delete = new HttpDelete ( uri ) ; delRes = httpClient . execute ( httpHost , delete , CouchDBUtils . getContext ( httpHost ) ) ; } finally { CouchDBUtils . closeContent ( delRes ) ; }
public class SecurityConstraintCollectionImpl { /** * { @ inheritDoc } */ @ Override public MatchResponse getMatchResponse ( String resourceName , String method ) { } }
if ( securityConstraints == null || securityConstraints . isEmpty ( ) ) { return MatchResponse . NO_MATCH_RESPONSE ; } return MatchingStrategy . match ( this , resourceName , method ) ;
public class ClinicalMongoDBAdaptor { private QueryResult getClinvarPhenotypeGeneRelations ( QueryOptions queryOptions ) { } }
List < Bson > pipeline = new ArrayList < > ( ) ; pipeline . add ( new Document ( "$match" , new Document ( "clinvarSet.referenceClinVarAssertion.clinVarAccession.acc" , new Document ( "$exists" , 1 ) ) ) ) ; // pipeline . add ( new Document ( " $ match " , new Document ( " clinvarSet " , new Document ( " $ exists " , 1 ) ) ) ) ; pipeline . add ( new Document ( "$unwind" , "$clinvarSet.referenceClinVarAssertion.measureSet.measure" ) ) ; pipeline . add ( new Document ( "$unwind" , "$clinvarSet.referenceClinVarAssertion.measureSet.measure.measureRelationship" ) ) ; pipeline . add ( new Document ( "$unwind" , "$clinvarSet.referenceClinVarAssertion.measureSet.measure.measureRelationship.symbol" ) ) ; pipeline . add ( new Document ( "$unwind" , "$clinvarSet.referenceClinVarAssertion.traitSet.trait" ) ) ; pipeline . add ( new Document ( "$unwind" , "$clinvarSet.referenceClinVarAssertion.traitSet.trait.name" ) ) ; Document groupFields = new Document ( ) ; groupFields . put ( "_id" , "$clinvarSet.referenceClinVarAssertion.traitSet.trait.name.elementValue.value" ) ; groupFields . put ( "associatedGenes" , new Document ( "$addToSet" , "$clinvarSet.referenceClinVarAssertion.measureSet.measure.measureRelationship.symbol.elementValue.value" ) ) ; pipeline . add ( new Document ( "$group" , groupFields ) ) ; Document fields = new Document ( ) ; fields . put ( "_id" , 0 ) ; fields . put ( "phenotype" , "$_id" ) ; fields . put ( "associatedGenes" , 1 ) ; pipeline . add ( new Document ( "$project" , fields ) ) ; return executeAggregation2 ( "" , pipeline , queryOptions ) ;
public class ProvFactory { /** * Factory method to create an instance of the PROV - DM prov : value attribute ( see { @ link Value } ) . * Use class { @ link Name } for predefined { @ link QualifiedName } s for the common types . * @ param value an { @ link Object } * @ param type a { @ link QualifiedName } to denote the type of value * @ return a new { @ link Value } */ public Value newValue ( Object value , QualifiedName type ) { } }
if ( value == null ) return null ; Value res = of . createValue ( ) ; res . setType ( type ) ; res . setValueFromObject ( value ) ; return res ;
public class JacksonDBCollection { /** * Inserts objects into the database . * if the objects _ id is null , one will be generated * you can get the _ id that were generated by calling getSavedObjects ( ) or getSavedIds ( ) on the result * @ param objects The objects to insert * @ param concern the write concern * @ return The result * @ throws MongoException If an error occurred */ public WriteResult < T , K > insert ( WriteConcern concern , T ... objects ) throws MongoException { } }
DBObject [ ] dbObjects = convertToDbObjects ( objects ) ; return new WriteResult < T , K > ( this , dbCollection . insert ( concern , dbObjects ) , dbObjects ) ;
public class DefaultDirectSuperclasses { /** * Get the direct superclasses of a class . * This is complicated , and possibly evil : in dylan , any class * which does not have another direct superclass extends Object . * In java , interfaces do not extend Object , or any equivalent . * This implementation makes an interface with no super interfaces * extend Object . Further , in classes which extend object , and * implement 1 or more interfaces , Object is last in the list * of direct superclasses , while any other super class comes first . * This seems a bit arbitrary , but works , and gives sensible * results in most cases . */ public List < Class < ? > > directSuperclasses ( Class < ? > c ) { } }
if ( c . isPrimitive ( ) ) { return primitiveSuperclasses ( c ) ; } else if ( c . isArray ( ) ) { return arrayDirectSuperclasses ( 0 , c ) ; } else { List < Class < ? > > interfaces = Arrays . asList ( c . getInterfaces ( ) ) ; Class < ? > superclass = c . getSuperclass ( ) ; if ( c == Object . class ) { return ImmutableList . of ( ) ; } else if ( superclass == null && interfaces . isEmpty ( ) ) { return classList ( Object . class ) ; } else if ( superclass == Object . class ) { return newArrayList ( concat ( interfaces , classList ( Object . class ) ) ) ; } else if ( superclass == null ) { return interfaces ; } else { System . out . println ( "default: " + newArrayList ( concat ( classList ( superclass ) , interfaces ) ) ) ; return newArrayList ( concat ( classList ( superclass ) , interfaces ) ) ; } }
public class Assert { /** * Asserts that a confirmation present on the page has content matching the * expected text . This information will be logged and recorded , with a * screenshot for traceability and added debugging support . * @ param expectedConfirmationPattern the expected text of the confirmation */ @ Override public void confirmationMatches ( String expectedConfirmationPattern ) { } }
String confirmation = checkConfirmationMatches ( expectedConfirmationPattern , 0 , 0 ) ; assertTrue ( "Confirmation Text Mismatch: confirmation text of '" + confirmation + DOES_NOT_MATCH_PATTERN + expectedConfirmationPattern + "'" , confirmation . matches ( expectedConfirmationPattern ) ) ;
public class AbstractMatcher { /** * Obtains all the matching resources that have a precise MatchType with the URIs of { @ code origin } . * @ param origins URIs to match * @ param type the MatchType we want to obtain * @ return a { @ link com . google . common . collect . Table } with the result of the matching indexed by origin URI and then destination URI . */ @ Override public Table < URI , URI , MatchResult > listMatchesOfType ( Set < URI > origins , MatchType type ) { } }
return listMatchesWithinRange ( origins , type , type ) ;
public class StringUtil { /** * HC specific settings , operands etc . use this method . * Creates an uppercase string from the given string . * @ param s the given string * @ return an uppercase string , or { @ code null } / empty if the string is { @ code null } / empty */ public static String upperCaseInternal ( String s ) { } }
if ( isNullOrEmpty ( s ) ) { return s ; } return s . toUpperCase ( LOCALE_INTERNAL ) ;
public class ScopeUtil { /** * Creates a new event scope execution and moves existing event subscriptions to this new execution */ public static void createCopyOfSubProcessExecutionForCompensation ( ExecutionEntity subProcessExecution ) { } }
EventSubscriptionEntityManager eventSubscriptionEntityManager = Context . getCommandContext ( ) . getEventSubscriptionEntityManager ( ) ; List < EventSubscriptionEntity > eventSubscriptions = eventSubscriptionEntityManager . findEventSubscriptionsByExecutionAndType ( subProcessExecution . getId ( ) , "compensate" ) ; List < CompensateEventSubscriptionEntity > compensateEventSubscriptions = new ArrayList < CompensateEventSubscriptionEntity > ( ) ; for ( EventSubscriptionEntity event : eventSubscriptions ) { if ( event instanceof CompensateEventSubscriptionEntity ) { compensateEventSubscriptions . add ( ( CompensateEventSubscriptionEntity ) event ) ; } } if ( CollectionUtil . isNotEmpty ( compensateEventSubscriptions ) ) { ExecutionEntity processInstanceExecutionEntity = subProcessExecution . getProcessInstance ( ) ; ExecutionEntity eventScopeExecution = Context . getCommandContext ( ) . getExecutionEntityManager ( ) . createChildExecution ( processInstanceExecutionEntity ) ; eventScopeExecution . setActive ( false ) ; eventScopeExecution . setEventScope ( true ) ; eventScopeExecution . setCurrentFlowElement ( subProcessExecution . getCurrentFlowElement ( ) ) ; // copy local variables to eventScopeExecution by value . This way , // the eventScopeExecution references a ' snapshot ' of the local variables new SubProcessVariableSnapshotter ( ) . setVariablesSnapshots ( subProcessExecution , eventScopeExecution ) ; // set event subscriptions to the event scope execution : for ( CompensateEventSubscriptionEntity eventSubscriptionEntity : compensateEventSubscriptions ) { eventSubscriptionEntityManager . delete ( eventSubscriptionEntity ) ; CompensateEventSubscriptionEntity newSubscription = eventSubscriptionEntityManager . insertCompensationEvent ( eventScopeExecution , eventSubscriptionEntity . getActivityId ( ) ) ; newSubscription . setConfiguration ( eventSubscriptionEntity . getConfiguration ( ) ) ; newSubscription . setCreated ( eventSubscriptionEntity . getCreated ( ) ) ; } CompensateEventSubscriptionEntity eventSubscription = eventSubscriptionEntityManager . insertCompensationEvent ( processInstanceExecutionEntity , eventScopeExecution . getCurrentFlowElement ( ) . getId ( ) ) ; eventSubscription . setConfiguration ( eventScopeExecution . getId ( ) ) ; }
public class Nbvcxz { /** * Gets the entropy from the number of guesses passed in . * @ param guesses a { @ code BigDecimal } representing the number of guesses . * @ return entropy { @ code Double } that is calculated based on the guesses . */ public static Double getEntropyFromGuesses ( final BigDecimal guesses ) { } }
Double guesses_tmp = guesses . doubleValue ( ) ; guesses_tmp = guesses_tmp . isInfinite ( ) ? Double . MAX_VALUE : guesses_tmp ; return Math . log ( guesses_tmp ) / Math . log ( 2 ) ;
public class Main { /** * Function to sum two integers num1 and num2. * Examples : * sumTwoNumbers ( 2 , 3 ) ; returns 5 * sumTwoNumbers ( 5 , 7 ) ; returns 12 * @ param num1 The first number . * @ param num2 The second number . * @ return The sum of num1 and num2 */ public static int sumTwoNumbers ( int num1 , int num2 ) { } public static void main ( String [ ] args ) { System . out . println ( sumTwoNumbers ( 2 , 3 ) ) ; // Outputs 5 System . out . println ( sumTwoNumbers ( 5 , 7 ) ) ; // Outputs 12 } }
return num1 + num2 ;
public class DoubleStream { /** * Returns a stream consisting of the results of replacing each element of * this stream with the contents of a mapped stream produced by applying * the provided mapping function to each element . * < p > This is an intermediate operation . * < p > Example : * < pre > * mapper : ( a ) - & gt ; [ a , a + 5] * stream : [ 1 , 2 , 3 , 4] * result : [ 1 , 6 , 2 , 7 , 3 , 8 , 4 , 9] * < / pre > * @ param mapper the mapper function used to apply to each element * @ return the new stream * @ see Stream # flatMap ( com . annimon . stream . function . Function ) */ @ NotNull public DoubleStream flatMap ( @ NotNull final DoubleFunction < ? extends DoubleStream > mapper ) { } }
return new DoubleStream ( params , new DoubleFlatMap ( iterator , mapper ) ) ;
public class DependencyBuilder { /** * @ param identifier of the form " groupId : artifactId " , " groupId : artifactId : version " , " groupId : artifactId : scope , " * groupId : artifactId : version : scope " , " groupId : artifactId : version : scope : packaging " * For classifier specification , see { @ link # setClassifier ( String ) } */ public static DependencyBuilder create ( final String identifier ) { } }
DependencyBuilder dependencyBuilder = new DependencyBuilder ( ) ; if ( identifier != null ) { String [ ] split = identifier . split ( ":" ) ; if ( split . length > 0 ) { dependencyBuilder . setGroupId ( split [ 0 ] . trim ( ) ) ; } if ( split . length > 1 ) { dependencyBuilder . setArtifactId ( split [ 1 ] . trim ( ) ) ; } if ( split . length > 2 ) { dependencyBuilder . setVersion ( split [ 2 ] . trim ( ) ) ; } if ( split . length > 3 ) { String trimmed = split [ 3 ] . trim ( ) ; dependencyBuilder . setScopeType ( trimmed ) ; } if ( split . length > 4 ) { String trimmed = split [ 4 ] . trim ( ) ; dependencyBuilder . setPackaging ( trimmed ) ; } } return dependencyBuilder ;
public class ConnectionUtil { /** * this is useful if we want to test the connection */ public static Connection createTempConnection ( StorageService storageService , final DataSource dataSource ) throws RepositoryException { } }
if ( DataSource . JNDI_VENDOR . equals ( dataSource . getVendor ( ) ) ) { return getJNDIConnection ( storageService , dataSource ) ; } final String driver = dataSource . getDriver ( ) ; try { Class . forName ( driver ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; LOG . error ( e . getMessage ( ) , e ) ; throw new RepositoryException ( "Driver '" + driver + "' not found." , e ) ; } final String url = dataSource . getUrl ( ) ; final String username = dataSource . getUsername ( ) ; final String password = dataSource . getPassword ( ) ; Settings settings = storageService . getSettings ( ) ; int connectionTimeout = settings . getConnectionTimeout ( ) ; if ( connectionTimeout <= 0 ) { // wait as long as driver manager ( not deterministic ) try { if ( driver . equals ( CSVDialect . DRIVER_CLASS ) ) { return DriverManager . getConnection ( url , convertListToProperties ( dataSource . getProperties ( ) ) ) ; } else { return DriverManager . getConnection ( url , username , password ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; LOG . error ( e . getMessage ( ) , e ) ; Locale locale = LanguageManager . getInstance ( ) . getLocale ( storageService . getSettings ( ) . getLanguage ( ) ) ; ResourceBundle bundle = ResourceBundle . getBundle ( "ro.nextreports.server.web.NextServerApplication" , locale ) ; throw new RepositoryException ( bundle . getString ( "Connection.failed" ) + " '" + dataSource . getPath ( ) + "'" , e ) ; } } else { // wait just the number of seconds configured ( deterministic ) Connection connection ; FutureTask < Connection > createConnectionTask = null ; try { createConnectionTask = new FutureTask < Connection > ( new Callable < Connection > ( ) { public Connection call ( ) throws Exception { if ( driver . equals ( CSVDialect . DRIVER_CLASS ) ) { return DriverManager . getConnection ( url , convertListToProperties ( dataSource . getProperties ( ) ) ) ; } else { return DriverManager . getConnection ( url , username , password ) ; } } } ) ; new Thread ( createConnectionTask ) . start ( ) ; connection = createConnectionTask . get ( connectionTimeout , TimeUnit . SECONDS ) ; } catch ( Exception e ) { Locale locale = LanguageManager . getInstance ( ) . getLocale ( storageService . getSettings ( ) . getLanguage ( ) ) ; ResourceBundle bundle = ResourceBundle . getBundle ( "ro.nextreports.server.web.NextServerApplication" , locale ) ; throw new RepositoryException ( bundle . getString ( "Connection.failed" ) + " '" + dataSource . getPath ( ) + "'" , e ) ; } return connection ; }
public class CodepointHelper { /** * Verifies a sequence of codepoints using the specified profile * @ param aArray * char array * @ param eProfile * profile to use */ public static void verify ( @ Nullable final char [ ] aArray , @ Nonnull final ECodepointProfile eProfile ) { } }
if ( aArray != null ) verify ( new CodepointIteratorCharArray ( aArray ) , eProfile ) ;
public class Utils { /** * This sets up a search view to use Calendar ' s search suggestions provider * and to allow refining the search . * @ param view The { @ link android . widget . SearchView } to set up * @ param act The activity using the view */ public static void setUpSearchView ( SearchView view , Activity act ) { } }
SearchManager searchManager = ( SearchManager ) act . getSystemService ( Context . SEARCH_SERVICE ) ; view . setSearchableInfo ( searchManager . getSearchableInfo ( act . getComponentName ( ) ) ) ; view . setQueryRefinementEnabled ( true ) ;
public class PipelineInterpreter { /** * Evaluates all pipelines that apply to the given messages , based on the current stream routing * of the messages . * The processing loops on each single message ( passed in or created by pipelines ) until the set * of streams does not change anymore . No cycle detection is performed . * @ param messages the messages to process through the pipelines * @ param interpreterListener a listener which gets called for each processing stage ( e . g . to * trace execution ) * @ param state the pipeline / stage / rule / stream connection state to use during * processing * @ return the processed messages */ public Messages process ( Messages messages , InterpreterListener interpreterListener , State state ) { } }
interpreterListener . startProcessing ( ) ; // message id + stream id final Set < Tuple2 < String , String > > processingBlacklist = Sets . newHashSet ( ) ; final List < Message > toProcess = Lists . newArrayList ( messages ) ; final List < Message > fullyProcessed = Lists . newArrayListWithExpectedSize ( toProcess . size ( ) ) ; while ( ! toProcess . isEmpty ( ) ) { final MessageCollection currentSet = new MessageCollection ( toProcess ) ; // we ' ll add them back below toProcess . clear ( ) ; for ( Message message : currentSet ) { final String msgId = message . getId ( ) ; // this makes a copy of the list , which is mutated later in updateStreamBlacklist // it serves as a worklist , to keep track of which < msg , stream > tuples need to be re - run again final Set < String > initialStreamIds = message . getStreams ( ) . stream ( ) . map ( Stream :: getId ) . collect ( Collectors . toSet ( ) ) ; final ImmutableSet < Pipeline > pipelinesToRun = selectPipelines ( interpreterListener , processingBlacklist , message , initialStreamIds , state . getStreamPipelineConnections ( ) ) ; toProcess . addAll ( processForResolvedPipelines ( message , msgId , pipelinesToRun , interpreterListener , state ) ) ; // add each processed message - stream combination to the blacklist set and figure out if the processing // has added a stream to the message , in which case we need to cycle and determine whether to process // its pipeline connections , too boolean addedStreams = updateStreamBlacklist ( processingBlacklist , message , initialStreamIds ) ; potentiallyDropFilteredMessage ( message ) ; // go to 1 and iterate over all messages again until no more streams are being assigned if ( ! addedStreams || message . getFilterOut ( ) ) { log . debug ( "[{}] no new streams matches or dropped message, not running again" , msgId ) ; fullyProcessed . add ( message ) ; } else { // process again , we ' ve added a stream log . debug ( "[{}] new streams assigned, running again for those streams" , msgId ) ; toProcess . add ( message ) ; } } } interpreterListener . finishProcessing ( ) ; // 7 . return the processed messages return new MessageCollection ( fullyProcessed ) ;
public class ScorecardPMMLUtils { public static String getExtensionValue ( List extensions , String extensionName ) { } }
for ( Object obj : extensions ) { if ( obj instanceof Extension ) { Extension extension = ( Extension ) obj ; if ( extensionName . equalsIgnoreCase ( extension . getName ( ) ) ) { return extension . getValue ( ) ; } } } return null ;
public class CmsDefaultPageEditor { /** * Performs the cleanup body action of the editor . < p > */ public void actionCleanupBodyElement ( ) { } }
try { // save eventually changed content of the editor to the temporary file Locale oldLocale = CmsLocaleManager . getLocale ( getParamOldelementlanguage ( ) ) ; performSaveContent ( getParamOldelementname ( ) , oldLocale ) ; } catch ( CmsException e ) { // show error page try { showErrorPage ( this , e ) ; } catch ( JspException exc ) { // should usually never happen if ( LOG . isInfoEnabled ( ) ) { LOG . info ( exc ) ; } } }
public class NettyMessagingService { /** * Executes the given callback on a transient connection . * @ param address the connection address * @ param callback the callback to execute * @ param executor an executor on which to complete the callback future * @ param < T > the callback response type */ private < T > CompletableFuture < T > executeOnTransientConnection ( Address address , Function < ClientConnection , CompletableFuture < T > > callback , Executor executor ) { } }
CompletableFuture < T > future = new CompletableFuture < > ( ) ; if ( address . equals ( returnAddress ) ) { callback . apply ( localConnection ) . whenComplete ( ( result , error ) -> { if ( error == null ) { executor . execute ( ( ) -> future . complete ( result ) ) ; } else { executor . execute ( ( ) -> future . completeExceptionally ( error ) ) ; } } ) ; return future ; } openChannel ( address ) . whenComplete ( ( channel , channelError ) -> { if ( channelError == null ) { callback . apply ( getOrCreateClientConnection ( channel ) ) . whenComplete ( ( result , sendError ) -> { if ( sendError == null ) { executor . execute ( ( ) -> future . complete ( result ) ) ; } else { executor . execute ( ( ) -> future . completeExceptionally ( sendError ) ) ; } channel . close ( ) ; } ) ; } else { executor . execute ( ( ) -> future . completeExceptionally ( channelError ) ) ; } } ) ; return future ;
public class AbstractJRebirthPreloader { /** * Gets the message from code . * @ param messageCode the message code * @ return the message from code */ private String getMessageFromCode ( final int messageCode ) { } }
String res = "" ; switch ( messageCode ) { case 100 : res = "Initializing" ; break ; case 200 : res = "" ; // Provisioned for custom pre - init task break ; case 300 : res = "" ; // Provisioned for custom pre - init task break ; case 400 : res = "Loading Messages Properties" ; break ; case 500 : res = "Loading Parameters Properties" ; break ; case 600 : res = "Preparing Core Engine" ; break ; case 700 : res = "Preloading Resources" ; break ; case 800 : res = "Preloading Modules" ; break ; case 900 : res = "" ; // Provisioned for custom post - init task break ; case 1000 : res = "Starting" ; break ; default : } return res ;
public class ExpirationManager { /** * Starts scheduling of the task that clears expired entries . * Calling this method multiple times has same effect . */ public void scheduleExpirationTask ( ) { } }
if ( nodeEngine . getLocalMember ( ) . isLiteMember ( ) || scheduled . get ( ) || ! scheduled . compareAndSet ( false , true ) ) { return ; } scheduledExpirationTask = globalTaskScheduler . scheduleWithRepetition ( task , taskPeriodSeconds , taskPeriodSeconds , SECONDS ) ; scheduledOneTime . set ( true ) ;
public class TransactionGeomIndex { public Geometry getGeometry ( FeatureTransaction featureTransaction ) { } }
if ( featureIndex >= 0 && featureTransaction . getNewFeatures ( ) != null && featureTransaction . getNewFeatures ( ) . length > featureIndex ) { return featureTransaction . getNewFeatures ( ) [ featureIndex ] . getGeometry ( ) ; } return null ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcCurveStyleFontAndScaling ( ) { } }
if ( ifcCurveStyleFontAndScalingEClass == null ) { ifcCurveStyleFontAndScalingEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 166 ) ; } return ifcCurveStyleFontAndScalingEClass ;
public class JinjavaInterpreter { /** * Resolve a variable from the interpreter context , returning null if not found . This method updates the template error accumulators when a variable is not found . * @ param variable * name of variable in context * @ param lineNumber * current line number , for error reporting * @ param startPosition * current line position , for error reporting * @ return resolved value for variable */ public Object retraceVariable ( String variable , int lineNumber , int startPosition ) { } }
if ( StringUtils . isBlank ( variable ) ) { return "" ; } Variable var = new Variable ( this , variable ) ; String varName = var . getName ( ) ; Object obj = context . get ( varName ) ; if ( obj != null ) { if ( obj instanceof DeferredValue ) { throw new DeferredValueException ( variable , lineNumber , startPosition ) ; } obj = var . resolve ( obj ) ; } else if ( getConfig ( ) . isFailOnUnknownTokens ( ) ) { throw new UnknownTokenException ( variable , lineNumber , startPosition ) ; } return obj ;
public class Mail { /** * Add a custom argument to the email . * @ param key argument ' s key . * @ param value the argument ' s value . */ public void addCustomArg ( String key , String value ) { } }
this . customArgs = addToMap ( key , value , this . customArgs ) ;
public class Capacity { /** * return the next power of two after @ param capacity or * capacity if it is already */ public static int getCapacity ( int capacity ) { } }
int c = 1 ; if ( capacity >= MAX_POWER2 ) { c = MAX_POWER2 ; } else { while ( c < capacity ) c <<= 1 ; } if ( isPowerOf2 ( c ) ) { return c ; } else { throw new RuntimeException ( "Capacity is not a power of 2." ) ; }
public class ApiOvhPackxdsl { /** * Get resiliation terms * REST : GET / pack / xdsl / { packName } / resiliationTerms * @ param resiliationDate [ required ] The desired resiliation date * @ param packName [ required ] The internal name of your pack */ public OvhResiliationTerms packName_resiliationTerms_GET ( String packName , Date resiliationDate ) throws IOException { } }
String qPath = "/pack/xdsl/{packName}/resiliationTerms" ; StringBuilder sb = path ( qPath , packName ) ; query ( sb , "resiliationDate" , resiliationDate ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhResiliationTerms . class ) ;
public class ExpressionsParser { /** * P1 */ Rule level1ExpressionChaining ( ) { } }
return Sequence ( primaryExpression ( ) . label ( "head" ) , set ( ) , ZeroOrMore ( FirstOf ( arrayAccessOperation ( ) . label ( "arrayAccess" ) , methodInvocationWithTypeArgsOperation ( ) . label ( "methodInvocation" ) , select ( ) . label ( "select" ) ) ) , set ( actions . createLevel1Expression ( node ( "head" ) , nodes ( "ZeroOrMore/FirstOf" ) ) ) ) ;
public class NotificationBoard { /** * Set the x location of pivot point around which this board is rotated . * @ param x */ public void setBoardPivotX ( float x ) { } }
if ( mListeners != null ) { for ( StateListener l : mListeners ) { l . onBoardPivotX ( this , x ) ; } } mContentView . setPivotX ( x ) ;
public class DbSqlSession { /** * delete / / / / / */ @ Override protected void deleteEntity ( DbEntityOperation operation ) { } }
final DbEntity dbEntity = operation . getEntity ( ) ; // get statement String deleteStatement = dbSqlSessionFactory . getDeleteStatement ( dbEntity . getClass ( ) ) ; ensureNotNull ( "no delete statement for " + dbEntity . getClass ( ) + " in the ibatis mapping files" , "deleteStatement" , deleteStatement ) ; LOG . executeDatabaseOperation ( "DELETE" , dbEntity ) ; // execute the delete int nrOfRowsDeleted = executeDelete ( deleteStatement , dbEntity ) ; operation . setRowsAffected ( nrOfRowsDeleted ) ; // It only makes sense to check for optimistic locking exceptions for objects that actually have a revision if ( dbEntity instanceof HasDbRevision && nrOfRowsDeleted == 0 ) { operation . setFailed ( true ) ; return ; } // perform post delete action entityDeleted ( dbEntity ) ;
public class SftpFileAttributes { /** * Set the permissions from a string in the format " rwxr - xr - x " * @ param newPermissions */ public void setPermissions ( String newPermissions ) { } }
int cp = 0 ; if ( permissions != null ) { cp = cp | ( ( ( permissions . longValue ( ) & S_IFMT ) == S_IFMT ) ? S_IFMT : 0 ) ; cp = cp | ( ( ( permissions . longValue ( ) & S_IFSOCK ) == S_IFSOCK ) ? S_IFSOCK : 0 ) ; cp = cp | ( ( ( permissions . longValue ( ) & S_IFLNK ) == S_IFLNK ) ? S_IFLNK : 0 ) ; cp = cp | ( ( ( permissions . longValue ( ) & S_IFREG ) == S_IFREG ) ? S_IFREG : 0 ) ; cp = cp | ( ( ( permissions . longValue ( ) & S_IFBLK ) == S_IFBLK ) ? S_IFBLK : 0 ) ; cp = cp | ( ( ( permissions . longValue ( ) & S_IFDIR ) == S_IFDIR ) ? S_IFDIR : 0 ) ; cp = cp | ( ( ( permissions . longValue ( ) & S_IFCHR ) == S_IFCHR ) ? S_IFCHR : 0 ) ; cp = cp | ( ( ( permissions . longValue ( ) & S_IFIFO ) == S_IFIFO ) ? S_IFIFO : 0 ) ; cp = cp | ( ( ( permissions . longValue ( ) & S_ISUID ) == S_ISUID ) ? S_ISUID : 0 ) ; cp = cp | ( ( ( permissions . longValue ( ) & S_ISGID ) == S_ISGID ) ? S_ISGID : 0 ) ; } int len = newPermissions . length ( ) ; if ( len >= 1 ) { cp = cp | ( ( newPermissions . charAt ( 0 ) == 'r' ) ? SftpFileAttributes . S_IRUSR : 0 ) ; } if ( len >= 2 ) { cp = cp | ( ( newPermissions . charAt ( 1 ) == 'w' ) ? SftpFileAttributes . S_IWUSR : 0 ) ; } if ( len >= 3 ) { cp = cp | ( ( newPermissions . charAt ( 2 ) == 'x' ) ? SftpFileAttributes . S_IXUSR : 0 ) ; } if ( len >= 4 ) { cp = cp | ( ( newPermissions . charAt ( 3 ) == 'r' ) ? SftpFileAttributes . S_IRGRP : 0 ) ; } if ( len >= 5 ) { cp = cp | ( ( newPermissions . charAt ( 4 ) == 'w' ) ? SftpFileAttributes . S_IWGRP : 0 ) ; } if ( len >= 6 ) { cp = cp | ( ( newPermissions . charAt ( 5 ) == 'x' ) ? SftpFileAttributes . S_IXGRP : 0 ) ; } if ( len >= 7 ) { cp = cp | ( ( newPermissions . charAt ( 6 ) == 'r' ) ? SftpFileAttributes . S_IROTH : 0 ) ; } if ( len >= 8 ) { cp = cp | ( ( newPermissions . charAt ( 7 ) == 'w' ) ? SftpFileAttributes . S_IWOTH : 0 ) ; } if ( len >= 9 ) { cp = cp | ( ( newPermissions . charAt ( 8 ) == 'x' ) ? SftpFileAttributes . S_IXOTH : 0 ) ; } setPermissions ( new UnsignedInteger32 ( cp ) ) ;
public class CameraEncoder { /** * Apply a filter to the camera input * @ param filter */ public void applyFilter ( int filter ) { } }
Filters . checkFilterArgument ( filter ) ; mDisplayRenderer . changeFilterMode ( filter ) ; synchronized ( mReadyForFrameFence ) { mNewFilter = filter ; }
public class WebSocketClientHandshaker { /** * Validates and finishes the opening handshake initiated by { @ link # handshake } } . * @ param channel * Channel * @ param response * HTTP response containing the closing handshake details */ public final void finishHandshake ( Channel channel , FullHttpResponse response ) { } }
verify ( response ) ; // Verify the subprotocol that we received from the server . // This must be one of our expected subprotocols - or null / empty if we didn ' t want to speak a subprotocol String receivedProtocol = response . headers ( ) . get ( HttpHeaderNames . SEC_WEBSOCKET_PROTOCOL ) ; receivedProtocol = receivedProtocol != null ? receivedProtocol . trim ( ) : null ; String expectedProtocol = expectedSubprotocol != null ? expectedSubprotocol : "" ; boolean protocolValid = false ; if ( expectedProtocol . isEmpty ( ) && receivedProtocol == null ) { // No subprotocol required and none received protocolValid = true ; setActualSubprotocol ( expectedSubprotocol ) ; // null or " " - we echo what the user requested } else if ( ! expectedProtocol . isEmpty ( ) && receivedProtocol != null && ! receivedProtocol . isEmpty ( ) ) { // We require a subprotocol and received one - > verify it for ( String protocol : expectedProtocol . split ( "," ) ) { if ( protocol . trim ( ) . equals ( receivedProtocol ) ) { protocolValid = true ; setActualSubprotocol ( receivedProtocol ) ; break ; } } } // else mixed cases - which are all errors if ( ! protocolValid ) { throw new WebSocketHandshakeException ( String . format ( "Invalid subprotocol. Actual: %s. Expected one of: %s" , receivedProtocol , expectedSubprotocol ) ) ; } setHandshakeComplete ( ) ; final ChannelPipeline p = channel . pipeline ( ) ; // Remove decompressor from pipeline if its in use HttpContentDecompressor decompressor = p . get ( HttpContentDecompressor . class ) ; if ( decompressor != null ) { p . remove ( decompressor ) ; } // Remove aggregator if present before HttpObjectAggregator aggregator = p . get ( HttpObjectAggregator . class ) ; if ( aggregator != null ) { p . remove ( aggregator ) ; } ChannelHandlerContext ctx = p . context ( HttpResponseDecoder . class ) ; if ( ctx == null ) { ctx = p . context ( HttpClientCodec . class ) ; if ( ctx == null ) { throw new IllegalStateException ( "ChannelPipeline does not contain " + "a HttpRequestEncoder or HttpClientCodec" ) ; } final HttpClientCodec codec = ( HttpClientCodec ) ctx . handler ( ) ; // Remove the encoder part of the codec as the user may start writing frames after this method returns . codec . removeOutboundHandler ( ) ; p . addAfter ( ctx . name ( ) , "ws-decoder" , newWebsocketDecoder ( ) ) ; // Delay the removal of the decoder so the user can setup the pipeline if needed to handle // WebSocketFrame messages . // See https : / / github . com / netty / netty / issues / 4533 channel . eventLoop ( ) . execute ( new Runnable ( ) { @ Override public void run ( ) { p . remove ( codec ) ; } } ) ; } else { if ( p . get ( HttpRequestEncoder . class ) != null ) { // Remove the encoder part of the codec as the user may start writing frames after this method returns . p . remove ( HttpRequestEncoder . class ) ; } final ChannelHandlerContext context = ctx ; p . addAfter ( context . name ( ) , "ws-decoder" , newWebsocketDecoder ( ) ) ; // Delay the removal of the decoder so the user can setup the pipeline if needed to handle // WebSocketFrame messages . // See https : / / github . com / netty / netty / issues / 4533 channel . eventLoop ( ) . execute ( new Runnable ( ) { @ Override public void run ( ) { p . remove ( context . handler ( ) ) ; } } ) ; }
public class FileUtil { /** * write the content to a file ; * @ param output * @ param content * @ throws Exception */ public static void createFile ( String output , String content ) throws Exception { } }
OutputStreamWriter fw = null ; PrintWriter out = null ; try { if ( ENCODING == null ) ENCODING = PropsUtil . ENCODING ; fw = new OutputStreamWriter ( new FileOutputStream ( output ) , ENCODING ) ; out = new PrintWriter ( fw ) ; out . print ( content ) ; } catch ( Exception ex ) { throw new Exception ( ex ) ; } finally { if ( out != null ) out . close ( ) ; if ( fw != null ) fw . close ( ) ; }
public class CreateRouteRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CreateRouteRequest createRouteRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( createRouteRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createRouteRequest . getApiId ( ) , APIID_BINDING ) ; protocolMarshaller . marshall ( createRouteRequest . getApiKeyRequired ( ) , APIKEYREQUIRED_BINDING ) ; protocolMarshaller . marshall ( createRouteRequest . getAuthorizationScopes ( ) , AUTHORIZATIONSCOPES_BINDING ) ; protocolMarshaller . marshall ( createRouteRequest . getAuthorizationType ( ) , AUTHORIZATIONTYPE_BINDING ) ; protocolMarshaller . marshall ( createRouteRequest . getAuthorizerId ( ) , AUTHORIZERID_BINDING ) ; protocolMarshaller . marshall ( createRouteRequest . getModelSelectionExpression ( ) , MODELSELECTIONEXPRESSION_BINDING ) ; protocolMarshaller . marshall ( createRouteRequest . getOperationName ( ) , OPERATIONNAME_BINDING ) ; protocolMarshaller . marshall ( createRouteRequest . getRequestModels ( ) , REQUESTMODELS_BINDING ) ; protocolMarshaller . marshall ( createRouteRequest . getRequestParameters ( ) , REQUESTPARAMETERS_BINDING ) ; protocolMarshaller . marshall ( createRouteRequest . getRouteKey ( ) , ROUTEKEY_BINDING ) ; protocolMarshaller . marshall ( createRouteRequest . getRouteResponseSelectionExpression ( ) , ROUTERESPONSESELECTIONEXPRESSION_BINDING ) ; protocolMarshaller . marshall ( createRouteRequest . getTarget ( ) , TARGET_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class NetworkInterfacesInner { /** * Get the specified network interface ip configuration in a virtual machine scale set . * @ param resourceGroupName The name of the resource group . * @ param virtualMachineScaleSetName The name of the virtual machine scale set . * @ param virtualmachineIndex The virtual machine index . * @ param networkInterfaceName The name of the network interface . * @ param expand Expands referenced resources . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the PagedList & lt ; NetworkInterfaceIPConfigurationInner & gt ; object if successful . */ public PagedList < NetworkInterfaceIPConfigurationInner > listVirtualMachineScaleSetIpConfigurations ( final String resourceGroupName , final String virtualMachineScaleSetName , final String virtualmachineIndex , final String networkInterfaceName , final String expand ) { } }
ServiceResponse < Page < NetworkInterfaceIPConfigurationInner > > response = listVirtualMachineScaleSetIpConfigurationsSinglePageAsync ( resourceGroupName , virtualMachineScaleSetName , virtualmachineIndex , networkInterfaceName , expand ) . toBlocking ( ) . single ( ) ; return new PagedList < NetworkInterfaceIPConfigurationInner > ( response . body ( ) ) { @ Override public Page < NetworkInterfaceIPConfigurationInner > nextPage ( String nextPageLink ) { return listVirtualMachineScaleSetIpConfigurationsNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ;
public class JMainScreen { /** * Push this command onto the history stack . * NOTE : Do not use this method in most cases , use the method in BaseApplet . * @ param strHistory The history command to push onto the stack . */ public void pushHistory ( String strHistory ) { } }
if ( m_vHistory == null ) m_vHistory = new Vector < String > ( ) ; m_vHistory . addElement ( strHistory ) ;
public class DefaultExtensionRepositoryManager { /** * AdvancedSearchable */ @ Override public IterableResult < Extension > search ( ExtensionQuery query ) throws SearchException { } }
return RepositoryUtils . search ( query , this . repositories ) ;
public class Matcher { /** * Replaces every subsequence of the input sequence that matches the * pattern with the given replacement string . * < p > This method first resets this matcher . It then scans the input * sequence looking for matches of the pattern . Characters that are not * part of any match are appended directly to the result string ; each match * is replaced in the result by the replacement string . The replacement * string may contain references to captured subsequences as in the { @ link * # appendReplacement appendReplacement } method . * < p > Note that backslashes ( < tt > \ < / tt > ) and dollar signs ( < tt > $ < / tt > ) in * the replacement string may cause the results to be different than if it * were being treated as a literal replacement string . Dollar signs may be * treated as references to captured subsequences as described above , and * backslashes are used to escape literal characters in the replacement * string . * < p > Given the regular expression < tt > a * b < / tt > , the input * < tt > " aabfooaabfooabfoob " < / tt > , and the replacement string * < tt > " - " < / tt > , an invocation of this method on a matcher for that * expression would yield the string < tt > " - foo - foo - foo - " < / tt > . * < p > Invoking this method changes this matcher ' s state . If the matcher * is to be used in further matching operations then it should first be * reset . < / p > * @ param replacement * The replacement string * @ return The string constructed by replacing each matching subsequence * by the replacement string , substituting captured subsequences * as needed */ public String replaceAll ( String replacement ) { } }
reset ( ) ; StringBuffer buffer = new StringBuffer ( input . length ( ) ) ; while ( find ( ) ) { appendReplacement ( buffer , replacement ) ; } return appendTail ( buffer ) . toString ( ) ;
public class DBIDUtil { /** * Compute the set intersection size of two sets . * @ param first First set * @ param second Second set * @ return size */ private static int internalIntersectionSize ( DBIDs first , DBIDs second ) { } }
second = second . size ( ) > 16 && ! ( second instanceof SetDBIDs ) ? newHashSet ( second ) : second ; int c = 0 ; for ( DBIDIter it = first . iter ( ) ; it . valid ( ) ; it . advance ( ) ) { if ( second . contains ( it ) ) { c ++ ; } } return c ;
public class MeterRegistry { /** * Register a custom meter type . * @ param id Id of the meter being registered . * @ param type Meter type , which may be used by naming conventions to normalize the name . * @ param measurements A sequence of measurements describing how to sample the meter . * @ return The registry . */ Meter register ( Meter . Id id , Meter . Type type , Iterable < Measurement > measurements ) { } }
return registerMeterIfNecessary ( Meter . class , id , id2 -> newMeter ( id2 , type , measurements ) , NoopMeter :: new ) ;
public class ProcessClosurePrimitives { /** * Verifies that setCssNameMapping is called with the correct methods . * @ return Whether the arguments checked out okay */ private boolean verifySetCssNameMapping ( Node methodName , Node firstArg ) { } }
DiagnosticType diagnostic = null ; if ( firstArg == null ) { diagnostic = NULL_ARGUMENT_ERROR ; } else if ( ! firstArg . isObjectLit ( ) ) { diagnostic = EXPECTED_OBJECTLIT_ERROR ; } else if ( firstArg . getNext ( ) != null ) { Node secondArg = firstArg . getNext ( ) ; if ( ! secondArg . isString ( ) ) { diagnostic = EXPECTED_STRING_ERROR ; } else if ( secondArg . getNext ( ) != null ) { diagnostic = TOO_MANY_ARGUMENTS_ERROR ; } } if ( diagnostic != null ) { compiler . report ( JSError . make ( methodName , diagnostic , methodName . getQualifiedName ( ) ) ) ; return false ; } return true ;
public class _MethodExpressionToMethodBinding { /** * - - - - - StateHolder methods - - - - - */ public void restoreState ( FacesContext context , Object state ) { } }
if ( state != null ) { methodExpression = ( MethodExpression ) state ; }
public class CmsUserDataFormLayout { /** * Store fields to given user . < p > * @ param user User to write information to * @ param cms CmsObject * @ param afterWrite runnable which gets called after writing user */ public void submit ( CmsUser user , CmsObject cms , Runnable afterWrite ) { } }
submit ( user , cms , afterWrite , false ) ;
public class Iterate { /** * Returns a new collection with the results of applying the specified function for each element of the iterable . * Example using a Java 8 lambda expression : * < pre > * Collection & lt ; String & gt ; names = * Iterate . < b > collect < / b > ( people , person - > person . getFirstName ( ) + " " + person . getLastName ( ) ) ; * < / pre > * Example using an anonymous inner class : * < pre > * Collection & lt ; String & gt ; names = * Iterate . < b > collect < / b > ( people , * new Function & lt ; Person , String & gt ; ( ) * public String value ( Person person ) * return person . getFirstName ( ) + " " + person . getLastName ( ) ; * < / pre > */ public static < T , V > Collection < V > collect ( Iterable < T > iterable , Function < ? super T , ? extends V > function ) { } }
if ( iterable instanceof MutableCollection ) { return ( ( MutableCollection < T > ) iterable ) . collect ( function ) ; } if ( iterable instanceof ArrayList ) { return ArrayListIterate . collect ( ( ArrayList < T > ) iterable , function ) ; } if ( iterable instanceof RandomAccess ) { return RandomAccessListIterate . collect ( ( List < T > ) iterable , function ) ; } if ( iterable instanceof Collection ) { return IterableIterate . collect ( iterable , function , DefaultSpeciesNewStrategy . INSTANCE . < V > speciesNew ( ( Collection < T > ) iterable , ( ( Collection < T > ) iterable ) . size ( ) ) ) ; } if ( iterable != null ) { return IterableIterate . collect ( iterable , function ) ; } throw new IllegalArgumentException ( "Cannot perform a collect on null" ) ;
public class FastAdapterDiffUtil { /** * convenient function for { @ link # set ( FastItemAdapter , List , DiffCallback , boolean ) } * @ return the adapter to allow chaining */ public static < A extends FastItemAdapter < Item > , Item extends IItem > A set ( final A adapter , DiffUtil . DiffResult result ) { } }
set ( adapter . getItemAdapter ( ) , result ) ; return adapter ;
public class S3SignedObjectMarshaller { /** * Marshall the given parameter object . */ public void marshall ( S3SignedObject s3SignedObject , ProtocolMarshaller protocolMarshaller ) { } }
if ( s3SignedObject == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( s3SignedObject . getBucketName ( ) , BUCKETNAME_BINDING ) ; protocolMarshaller . marshall ( s3SignedObject . getKey ( ) , KEY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class PApplicationException { /** * Exception message . * @ return Optional of the < code > message < / code > field value . */ @ javax . annotation . Nonnull public java . util . Optional < String > optionalMessage ( ) { } }
return java . util . Optional . ofNullable ( mMessage ) ;
public class PolicyChecker { /** * Initializes the internal state of the checker from parameters * specified in the constructor * @ param forward a boolean indicating whether this checker should be * initialized capable of building in the forward direction * @ throws CertPathValidatorException if user wants to enable forward * checking and forward checking is not supported . */ @ Override public void init ( boolean forward ) throws CertPathValidatorException { } }
if ( forward ) { throw new CertPathValidatorException ( "forward checking not supported" ) ; } certIndex = 1 ; explicitPolicy = ( expPolicyRequired ? 0 : certPathLen + 1 ) ; policyMapping = ( polMappingInhibited ? 0 : certPathLen + 1 ) ; inhibitAnyPolicy = ( anyPolicyInhibited ? 0 : certPathLen + 1 ) ;
public class MapUtil { /** * 将map转成字符串 * @ param < K > 键类型 * @ param < V > 值类型 * @ param map Map * @ param separator entry之间的连接符 * @ param keyValueSeparator kv之间的连接符 * @ return 连接字符串 * @ since 3.1.1 */ public static < K , V > String join ( Map < K , V > map , String separator , String keyValueSeparator ) { } }
return join ( map , separator , keyValueSeparator , false ) ;
public class MathUtils { /** * Given a start and end and a number of steps this method generates a sequence of expontentially spaced integer * values , starting at the start ( inclusive ) and finishing at the end ( inclusive ) with the specified number of * values in the sequence . An exponentially spaced sequence is one where the ratio between any two consecutive * numbers in the sequence remains constant . The sequence returned may contain less than the specified number where * the difference between two consecutive values is too small ( this is more likely at the start of the sequence , * where the values are closer together ) . * < p / > As the results are integers , they will not be perfectly exponentially spaced but a best - fit . * @ param start The sequence start . * @ param end The sequence end . * @ param steps The number of steps . * @ return The sequence . */ public static int [ ] generateExpSequence ( int start , int end , int steps ) { } }
// Check that there are at least two steps . if ( steps < 2 ) { throw new IllegalArgumentException ( "There must be at least 2 steps." ) ; } List < Integer > result = new ArrayList < Integer > ( ) ; // Calculate the sequence using floating point , then round into the results . double fStart = start ; double fEnd = end ; // float fCurrent = start ; double diff = fEnd - fStart ; double factor = java . lang . Math . pow ( diff , ( 1.0f / ( steps - 1 ) ) ) ; for ( int i = 0 ; i < steps ; i ++ ) { // This is a cheat to get the end exactly on and lose the accumulated rounding error . if ( i == ( steps - 1 ) ) { result . add ( end ) ; } else { roundAndAdd ( result , fStart - 1.0f + java . lang . Math . pow ( factor , i ) ) ; } } // Return the results after converting to a primitive array . return intListToPrimitiveArray ( result ) ;
public class DefaultWhereClauseGenerator { /** * Explicitly disallow reflexivity . * Can be used if the other conditions allow reflexivity but the operator not . * It depends on the search conditions if two results are not equal . * < b > For two nodes ( including searches for token ) : < / b > < br / > * node IDs are different * < b > If both nodes are an annotation : < / b > < br / > * node IDs are different or annotation namespace + name are different * < b > For a node with and one without annotation condition : < / b > < br / > * always different * @ param conditions * @ param node * @ param target */ private void notReflexive ( List < String > conditions , QueryNode node , QueryNode target ) { } }
Validate . isTrue ( node != target , "notReflexive(...) implies that source " + "and target node are not the same, but someone is violating this constraint!" ) ; Validate . notNull ( node ) ; Validate . notNull ( target ) ; if ( node . getNodeAnnotations ( ) . isEmpty ( ) && target . getNodeAnnotations ( ) . isEmpty ( ) ) { joinOnNode ( conditions , node , target , "<>" , "id" , "id" ) ; } else if ( ! node . getNodeAnnotations ( ) . isEmpty ( ) && ! target . getNodeAnnotations ( ) . isEmpty ( ) ) { TableAccessStrategy tasNode = tables ( node ) ; TableAccessStrategy tasTarget = tables ( target ) ; String nodeDifferent = join ( "<>" , tasNode . aliasedColumn ( NODE_TABLE , "id" ) , tasTarget . aliasedColumn ( NODE_TABLE , "id" ) ) ; String annoCatDifferent = join ( "IS DISTINCT FROM" , tasNode . aliasedColumn ( NODE_ANNOTATION_TABLE , "category" ) , tasTarget . aliasedColumn ( NODE_ANNOTATION_TABLE , "category" ) ) ; conditions . add ( "(" + Joiner . on ( " OR " ) . join ( nodeDifferent , annoCatDifferent ) + ")" ) ; }
public class ProtegeKnowledgeSourceBackend { /** * Returns the Cls from Protege if a matching Cls is found with the given * ancestor * @ param name Name of the class to fetch * @ param superClass name of the anscestor * @ return A Cls containing the given class name * @ throws KnowledgeSourceReadException */ private Cls readClass ( String name , String superClass ) throws KnowledgeSourceReadException { } }
Cls cls = this . cm . getCls ( name ) ; Cls superCls = this . cm . getCls ( superClass ) ; if ( cls != null && cls . hasSuperclass ( superCls ) ) { return cls ; } else { return null ; }
public class EJBUtils { /** * Returns the ' methodId ' of the specified method , which is basically * the index of the method in the array of all methods . < p > * The methodId is ' hard coded ' into the generated code , and passed to * preInvoke , to allow the runtime to quickly associate the method * call with its corresponding method info . And , to insure the methodId * is the same between the generated code ( formerly EJBDeploy ) and * the runtime , the methods are sorted in basically alphabetical order . < p > * This method searches through the list of the ' sorted ' set of all methods , * to find the correct index or methodId for the specified index . And , it * takes advantage of the fact they are sorted , by not searching from the * beginning of the list every time , but from the last index that was * found . < p > * Unfortunately , the methods are not sorted by method name and parameters * alone , but also the return type and fully package qualified classname * of the defining class . This poses a problem when a method is present * on multiple interfaces for an EJB ; for example , both the component * and a business interface . Duplicate method name / parameter combinations * do not exist in the sorted list . . and this method does find matches * regardless of the defining class , but the sort order may vary depending * on the interface currently being deployed . To accomodate this , this * method will always search the entire list of all methods , though it * will generally see a performance advantage by starting with the last * found index . < p > * @ param method method to get the methodId / index for * @ param allMethods array of all methods for the desired interface type * @ param startIndex position in the array of all methods to start * looking for the current method . * @ return methodId for the specified method . */ static int getMethodId ( Method method , Method [ ] allMethods , int startIndex ) { } }
int numMethods = allMethods . length ; for ( int i = startIndex ; i < numMethods ; ++ i ) { if ( methodsMatch ( method , allMethods [ i ] ) ) return i ; } // Search through from the beginning back to the starting point , // in case the method is on multiple interfaces , and thus may // be sorted in a different order in the allMethods list . d369262.6 for ( int i = 0 ; i < startIndex ; ++ i ) { if ( methodsMatch ( method , allMethods [ i ] ) ) return i ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "getMethodId: start = " + startIndex ) ; Tr . debug ( tc , "getMethodId: method = " + method ) ; for ( int i = 0 ; i < numMethods ; ++ i ) { Tr . debug ( tc , "getMethodId: [" + i + "] = " + allMethods [ i ] ) ; } } throw new RuntimeException ( "Internal Error: Method not found: " + method ) ;
public class MySqlDdlParser { /** * { @ inheritDoc } * @ see org . modeshape . sequencer . ddl . StandardDdlParser # parseDropStatement ( org . modeshape . sequencer . ddl . DdlTokenStream , * org . modeshape . sequencer . ddl . node . AstNode ) */ @ Override protected AstNode parseDropStatement ( DdlTokenStream tokens , AstNode parentNode ) throws ParsingException { } }
assert tokens != null ; assert parentNode != null ; if ( tokens . matches ( STMT_DROP_DATABASE ) ) { return parseStatement ( tokens , STMT_DROP_DATABASE , parentNode , TYPE_DROP_DATABASE_STATEMENT ) ; } else if ( tokens . matches ( STMT_DROP_EVENT ) ) { return parseStatement ( tokens , STMT_DROP_EVENT , parentNode , TYPE_DROP_EVENT_STATEMENT ) ; } else if ( tokens . matches ( STMT_DROP_FUNCTION ) ) { return parseStatement ( tokens , STMT_DROP_FUNCTION , parentNode , TYPE_DROP_FUNCTION_STATEMENT ) ; } else if ( tokens . matches ( STMT_DROP_INDEX ) ) { return parseStatement ( tokens , STMT_DROP_INDEX , parentNode , TYPE_DROP_INDEX_STATEMENT ) ; } else if ( tokens . matches ( STMT_DROP_OFFLINE_INDEX ) ) { return parseStatement ( tokens , STMT_DROP_OFFLINE_INDEX , parentNode , TYPE_DROP_INDEX_STATEMENT ) ; } else if ( tokens . matches ( STMT_DROP_ONLINE_INDEX ) ) { return parseStatement ( tokens , STMT_DROP_ONLINE_INDEX , parentNode , TYPE_DROP_INDEX_STATEMENT ) ; } else if ( tokens . matches ( STMT_DROP_LOGFILE_GROUP ) ) { return parseStatement ( tokens , STMT_DROP_LOGFILE_GROUP , parentNode , TYPE_DROP_LOGFILE_GROUP_STATEMENT ) ; } else if ( tokens . matches ( STMT_DROP_PROCEDURE ) ) { return parseStatement ( tokens , STMT_DROP_PROCEDURE , parentNode , TYPE_DROP_PROCEDURE_STATEMENT ) ; } else if ( tokens . matches ( STMT_DROP_SERVER ) ) { return parseStatement ( tokens , STMT_DROP_SERVER , parentNode , TYPE_DROP_SERVER_STATEMENT ) ; } else if ( tokens . matches ( STMT_DROP_TABLESPACE ) ) { return parseStatement ( tokens , STMT_DROP_TABLESPACE , parentNode , TYPE_DROP_TABLESPACE_STATEMENT ) ; } else if ( tokens . matches ( STMT_DROP_TRIGGER ) ) { return parseStatement ( tokens , STMT_DROP_TRIGGER , parentNode , TYPE_DROP_TRIGGER_STATEMENT ) ; } return super . parseDropStatement ( tokens , parentNode ) ;
public class FactoryDescribeImageDense { /** * Creates a dense HOG descriptor . * @ see DescribeDenseHogFastAlg * @ see DescribeDenseHogAlg * @ param config Configuration for HOG descriptor . Can ' t be null . * @ param imageType Type of input image . Can be single band or planar * @ return Dense HOG extractor */ public static < T extends ImageBase < T > > DescribeImageDense < T , TupleDesc_F64 > hog ( @ Nullable ConfigDenseHoG config , ImageType < T > imageType ) { } }
if ( config == null ) config = new ConfigDenseHoG ( ) ; config . checkValidity ( ) ; ImageType actualType ; if ( imageType . getDataType ( ) != ImageDataType . F32 ) { actualType = new ImageType ( imageType . getFamily ( ) , ImageDataType . F32 , imageType . getNumBands ( ) ) ; } else { actualType = imageType ; } BaseDenseHog hog ; if ( config . fastVariant ) { hog = FactoryDescribeImageDenseAlg . hogFast ( config , actualType ) ; } else { hog = FactoryDescribeImageDenseAlg . hog ( config , actualType ) ; } DescribeImageDenseHoG output = new DescribeImageDenseHoG ( hog ) ; // If the data type isn ' t F32 convert it into that data type first if ( actualType != imageType ) { return new DescribeImageDense_Convert < > ( output , imageType ) ; } else { return output ; }
public class MapMessage { /** * Get the message data as a XML String . * @ return The XML String . */ public String getXML ( boolean bIncludeHeader ) { } }
StringBuffer sbXML = new StringBuffer ( ) ; String rootTag = ROOT_TAG ; if ( this . getMessageDataDesc ( null ) != null ) if ( this . getMessageDataDesc ( null ) . getKey ( ) != null ) rootTag = this . getMessageDataDesc ( null ) . getKey ( ) ; Util . addStartTag ( sbXML , rootTag ) . append ( Constant . RETURN ) ; Util . addXMLMap ( sbXML , this . getMap ( ) ) ; if ( bIncludeHeader ) if ( this . getMessageHeader ( ) != null ) this . getMessageHeader ( ) . addXML ( sbXML ) ; Util . addEndTag ( sbXML , rootTag ) ; return sbXML . toString ( ) ;
public class ScenarioParametersImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public NotificationChain basicSetDuration ( Parameter newDuration , NotificationChain msgs ) { } }
Parameter oldDuration = duration ; duration = newDuration ; if ( eNotificationRequired ( ) ) { ENotificationImpl notification = new ENotificationImpl ( this , Notification . SET , BpsimPackage . SCENARIO_PARAMETERS__DURATION , oldDuration , newDuration ) ; if ( msgs == null ) msgs = notification ; else msgs . add ( notification ) ; } return msgs ;
public class JarVerifier { /** * true if file is part of the signature mechanism itself */ static boolean isSigningRelated ( String name ) { } }
name = name . toUpperCase ( Locale . ENGLISH ) ; if ( ! name . startsWith ( "META-INF/" ) ) { return false ; } name = name . substring ( 9 ) ; if ( name . indexOf ( '/' ) != - 1 ) { return false ; } if ( name . endsWith ( ".DSA" ) || name . endsWith ( ".RSA" ) || name . endsWith ( ".SF" ) || name . endsWith ( ".EC" ) || name . startsWith ( "SIG-" ) || name . equals ( "MANIFEST.MF" ) ) { return true ; } return false ;
public class CmsJspActionElement { /** * Returns the HTML for an < code > & lt ; img src = " . . . " / & gt ; < / code > tag that includes the given image scaling parameters . < p > * @ param target the target URI of the file in the OpenCms VFS * @ param scaler the image scaler to use for scaling the image * @ param attributes a map of additional HTML attributes that are added to the output * @ param partialTag if < code > true < / code > , the opening < code > & lt ; img < / code > and closing < code > / & gt ; < / code > is omitted * @ return the HTML for an < code > & lt ; img src & gt ; < / code > tag that includes the given image scaling parameters */ public String img ( String target , CmsImageScaler scaler , Map < String , String > attributes , boolean partialTag ) { } }
try { return CmsJspTagImage . imageTagAction ( target , scaler , attributes , partialTag , getRequest ( ) ) ; } catch ( Throwable t ) { handleException ( t ) ; } CmsMessageContainer msgContainer = Messages . get ( ) . container ( Messages . GUI_ERR_IMG_SCALE_2 , target , scaler == null ? "null" : scaler . toString ( ) ) ; return getMessage ( msgContainer ) ;
public class ListProvisioningArtifactsForServiceActionResult { /** * An array of objects with information about product views and provisioning artifacts . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setProvisioningArtifactViews ( java . util . Collection ) } or * { @ link # withProvisioningArtifactViews ( java . util . Collection ) } if you want to override the existing values . * @ param provisioningArtifactViews * An array of objects with information about product views and provisioning artifacts . * @ return Returns a reference to this object so that method calls can be chained together . */ public ListProvisioningArtifactsForServiceActionResult withProvisioningArtifactViews ( ProvisioningArtifactView ... provisioningArtifactViews ) { } }
if ( this . provisioningArtifactViews == null ) { setProvisioningArtifactViews ( new java . util . ArrayList < ProvisioningArtifactView > ( provisioningArtifactViews . length ) ) ; } for ( ProvisioningArtifactView ele : provisioningArtifactViews ) { this . provisioningArtifactViews . add ( ele ) ; } return this ;
public class PriorityQueue { /** * Version of remove using reference equality , not equals . * Needed by iterator . remove . * @ param o element to be removed from this queue , if present * @ return { @ code true } if removed */ boolean removeEq ( Object o ) { } }
for ( int i = 0 ; i < size ; i ++ ) { if ( o == queue [ i ] ) { removeAt ( i ) ; return true ; } } return false ;
public class JCudaDriver { /** * Load a module ' s data with options . < br / > * < br / > * < b > Note < / b > : It is hardly possible to properly pass in the required * option values for this method . Thus , the arguments here must be < br / > * numOptions = 0 < br / > * options = new int [ 0 ] < br / > * optionValues = Pointer . to ( new int [ 0 ] ) ) < br / > * For passing in real options , use * { @ link # cuModuleLoadDataJIT ( CUmodule , Pointer , JITOptions ) } instead * < pre > * CUresult cuModuleLoadDataEx ( * CUmodule * module , * const void * image , * unsigned int numOptions , * CUjit _ option * options , * void * * optionValues ) * < / pre > * < div > * < p > Load a module ' s data with options . Takes * a pointer < tt > image < / tt > and loads the corresponding module < tt > module < / tt > into the current context . The pointer may be obtained by * mapping a cubin or PTX or fatbin file , passing a cubin or PTX or * fatbin file as a NULL - terminated text * string , or incorporating a cubin or fatbin object into the executable * resources and * using operating system calls such as * Windows < tt > FindResource ( ) < / tt > to obtain the pointer . Options are * passed as an array via < tt > options < / tt > and any corresponding * parameters are passed in < tt > optionValues < / tt > . The number of total * options is supplied via < tt > numOptions < / tt > . Any outputs will be * returned via < tt > optionValues < / tt > . Supported options are ( types for * the option values are specified in parentheses after the option name ) : * < ul > * < li > * < p > CU _ JIT _ MAX _ REGISTERS : ( unsigned * int ) input specifies the maximum number of registers per thread ; * < / li > * < li > * < p > CU _ JIT _ THREADS _ PER _ BLOCK : * ( unsigned int ) input specifies number of threads per block to target * compilation for ; output returns the number of threads * the compiler actually targeted ; * < / li > * < li > * < p > CU _ JIT _ WALL _ TIME : ( float ) * output returns the float value of wall clock time , in milliseconds , * spent compiling the PTX code ; * < / li > * < li > * < p > CU _ JIT _ INFO _ LOG _ BUFFER : ( char * ) * input is a pointer to a buffer in which to print any informational log * messages from PTX assembly ( the buffer size * is specified via option * CU _ JIT _ INFO _ LOG _ BUFFER _ SIZE _ BYTES ) ; * < / li > * < li > * < p > CU _ JIT _ INFO _ LOG _ BUFFER _ SIZE _ BYTES : * ( unsigned int ) input is the size in bytes of the buffer ; output is the * number of bytes filled with messages ; * < / li > * < li > * < p > CU _ JIT _ ERROR _ LOG _ BUFFER : * ( char * ) input is a pointer to a buffer in which to print any error log * messages from PTX assembly ( the buffer size is specified * via option * CU _ JIT _ ERROR _ LOG _ BUFFER _ SIZE _ BYTES ) ; * < / li > * < li > * < p > CU _ JIT _ ERROR _ LOG _ BUFFER _ SIZE _ BYTES : * ( unsigned int ) input is the size in bytes of the buffer ; output is the * number of bytes filled with messages ; * < / li > * < li > * < p > CU _ JIT _ OPTIMIZATION _ LEVEL : * ( unsigned int ) input is the level of optimization to apply to generated * code ( 0 - 4 ) , with 4 being the default and highest * level ; * < / li > * < li > * < p > CU _ JIT _ TARGET _ FROM _ CUCONTEXT : * ( No option value ) causes compilation target to be determined based on * current attached context ( default ) ; * < / li > * < li > * < div > * CU _ JIT _ TARGET : ( unsigned int * for enumerated type CUjit _ target _ enum ) input is the compilation target * based on supplied CUjit _ target _ enum ; * possible values are : * < ul > * < li > * < p > CU _ TARGET _ COMPUTE _ 10 < / p > * < / li > * < li > * < p > CU _ TARGET _ COMPUTE _ 11 < / p > * < / li > * < li > * < p > CU _ TARGET _ COMPUTE _ 12 < / p > * < / li > * < li > * < p > CU _ TARGET _ COMPUTE _ 13 < / p > * < / li > * < li > * < p > CU _ TARGET _ COMPUTE _ 20 < / p > * < / li > * < / ul > * < / div > * < / li > * < li > * < div > * CU _ JIT _ FALLBACK _ STRATEGY : * ( unsigned int for enumerated type CUjit _ fallback _ enum ) chooses fallback * strategy if matching cubin is not found ; possible * values are : * < ul > * < li > * < p > CU _ PREFER _ PTX < / p > * < / li > * < li > * < p > CU _ PREFER _ BINARY < / p > * < / li > * < / ul > * < / div > * < / li > * < / ul > * < div > * < span > Note : < / span > * < p > Note that this * function may also return error codes from previous , asynchronous * launches . * < / div > * < / div > * @ param module Returned module * @ param image Module data to load * @ param numOptions Number of options * @ param options Options for JIT * @ param optionValues Option values for JIT * @ return CUDA _ SUCCESS , CUDA _ ERROR _ DEINITIALIZED , CUDA _ ERROR _ NOT _ INITIALIZED , * CUDA _ ERROR _ INVALID _ CONTEXT , CUDA _ ERROR _ INVALID _ VALUE , * CUDA _ ERROR _ OUT _ OF _ MEMORY , CUDA _ ERROR _ NO _ BINARY _ FOR _ GPU , * CUDA _ ERROR _ SHARED _ OBJECT _ SYMBOL _ NOT _ FOUND , * CUDA _ ERROR _ SHARED _ OBJECT _ INIT _ FAILED * @ see JCudaDriver # cuModuleGetFunction * @ see JCudaDriver # cuModuleGetGlobal * @ see JCudaDriver # cuModuleGetTexRef * @ see JCudaDriver # cuModuleLoad * @ see JCudaDriver # cuModuleLoadData * @ see JCudaDriver # cuModuleLoadFatBinary * @ see JCudaDriver # cuModuleUnload */ public static int cuModuleLoadDataEx ( CUmodule phMod , Pointer p , int numOptions , int options [ ] , Pointer optionValues ) { } }
// Although it should be possible to pass ' null ' for these parameters // when numOptions = = 0 , the driver crashes when they are ' null ' , so // they are replaced by non - null ( but empty ) arrays here . // Also see the corresponding notes in the native method . if ( numOptions == 0 ) { if ( options == null ) { options = new int [ 0 ] ; } if ( optionValues == null ) { optionValues = Pointer . to ( new int [ 0 ] ) ; } } return checkResult ( cuModuleLoadDataExNative ( phMod , p , numOptions , options , optionValues ) ) ;
public class NumberPath { /** * Method to construct the equals expression for integer * @ param value the integer * @ return Expression */ public Expression < Integer > eq ( int value ) { } }
String valueString = "'" + value + "'" ; return new Expression < Integer > ( this , Operation . eq , valueString ) ;
public class StoriesBase { /** * Adds a comment to a task . The comment will be authored by the * currently authenticated user , and timestamped when the server receives * the request . * Returns the full record for the new story added to the task . * @ param task Globally unique identifier for the task . * @ return Request object */ public ItemRequest < Story > createOnTask ( String task ) { } }
String path = String . format ( "/tasks/%s/stories" , task ) ; return new ItemRequest < Story > ( this , Story . class , path , "POST" ) ;
public class DestinationManager { /** * Method destinationExists * @ param addr * @ return boolean * @ throws SIMPNullParameterException * < p > This method returns true if the named destination is known in the * destination manager , otherwise it returns false . < / p > */ public boolean destinationExists ( JsDestinationAddress addr ) throws SIMPNullParameterException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "destinationExists" , new Object [ ] { addr } ) ; // Now look for the destination in the hash table boolean exists = destinationExists ( addr . getDestinationName ( ) , addr . getBusName ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "destinationExists" , new Boolean ( exists ) ) ; return exists ;
public class GeoJsonToAssembler { /** * Creates the correct TO starting from any geolatte geometry . * @ param geometry the geometry to convert * @ return a TO that , once serialized , results in a valid geoJSON representation of the geometry */ public GeoJsonTo toTransferObject ( Geometry geometry ) { } }
if ( geometry instanceof Point ) { return toTransferObject ( ( Point ) geometry ) ; } else if ( geometry instanceof LineString ) { return toTransferObject ( ( LineString ) geometry ) ; } else if ( geometry instanceof MultiPoint ) { return toTransferObject ( ( MultiPoint ) geometry ) ; } else if ( geometry instanceof MultiLineString ) { return toTransferObject ( ( MultiLineString ) geometry ) ; } else if ( geometry instanceof Polygon ) { return toTransferObject ( ( Polygon ) geometry ) ; } else if ( geometry instanceof MultiPolygon ) { return toTransferObject ( ( MultiPolygon ) geometry ) ; } else if ( geometry instanceof GeometryCollection ) { return toTransferObject ( ( GeometryCollection ) geometry ) ; } return null ;
public class MainActivity { /** * Called when the activity is first created . */ @ Override public void onCreate ( Bundle savedInstanceState ) { } }
super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . main ) ; final ActionBar ab = getSupportActionBar ( ) ; // set defaults for logo & home up ab . setDisplayHomeAsUpEnabled ( showHomeUp ) ; ab . setDisplayUseLogoEnabled ( useLogo ) ; // set up tabs nav for ( int i = 1 ; i < 4 ; i ++ ) { ab . addTab ( ab . newTab ( ) . setText ( "Tab " + i ) . setTabListener ( this ) ) ; } // set up list nav ab . setListNavigationCallbacks ( ArrayAdapter . createFromResource ( this , R . array . sections , R . layout . sherlock_spinner_dropdown_item ) , new OnNavigationListener ( ) { public boolean onNavigationItemSelected ( int itemPosition , long itemId ) { // FIXME add proper implementation rotateLeftFrag ( ) ; return false ; } } ) ; // default to tab navigation showTabsNav ( ) ; // create a couple of simple fragments as placeholders final int MARGIN = 16 ; leftFrag = new RoundedColourFragment ( getResources ( ) . getColor ( R . color . android_green ) , 1f , MARGIN , MARGIN / 2 , MARGIN , MARGIN ) ; rightFrag = new RoundedColourFragment ( getResources ( ) . getColor ( R . color . honeycombish_blue ) , 2f , MARGIN / 2 , MARGIN , MARGIN , MARGIN ) ; FragmentTransaction ft = getSupportFragmentManager ( ) . beginTransaction ( ) ; ft . add ( R . id . root , leftFrag ) ; ft . add ( R . id . root , rightFrag ) ; ft . commit ( ) ;
public class FactoryTrackerAlg { /** * Creates a { @ link KltTracker } . * NOTE : The pyramid ' s structure is determined by the input pyramid that is processed . * @ param config KLT configuration * @ param imageType Type of input image * @ param derivType Type of image derivative * @ param < I > Input image type . * @ param < D > Derivative image type . * @ return Tracker */ public static < I extends ImageGray < I > , D extends ImageGray < D > > KltTracker < I , D > klt ( @ Nullable KltConfig config , Class < I > imageType , Class < D > derivType ) { } }
if ( config == null ) config = new KltConfig ( ) ; if ( derivType == null ) derivType = GImageDerivativeOps . getDerivativeType ( imageType ) ; InterpolateRectangle < I > interpInput = FactoryInterpolation . < I > bilinearRectangle ( imageType ) ; InterpolateRectangle < D > interpDeriv = FactoryInterpolation . < D > bilinearRectangle ( derivType ) ; return new KltTracker < > ( interpInput , interpDeriv , config ) ;
public class JmxExecRequest { /** * Conver string tags if required */ private static List < String > convertSpecialStringTags ( List < String > extraArgs ) { } }
if ( extraArgs == null ) { return null ; } List < String > args = new ArrayList < String > ( ) ; for ( String arg : extraArgs ) { args . add ( StringToObjectConverter . convertSpecialStringTags ( arg ) ) ; } return args ;
public class StringUtils { /** * Convert byte size into machine friendly format . * @ param size the human friendly byte size ( includes units ) * @ return a number of bytes * @ throws NumberFormatException if failed parse given size */ @ SuppressWarnings ( "fallthrough" ) public static long convertToMachineFriendlyByteSize ( String size ) { } }
double d ; try { d = Double . parseDouble ( size . replaceAll ( "[GMK]?[B]?$" , "" ) ) ; } catch ( NumberFormatException e ) { String msg = "Size must be specified as bytes (B), " + "kilobytes (KB), megabytes (MB), gigabytes (GB). " + "E.g. 1024, 1KB, 10M, 10MB, 100G, 100GB" ; throw new NumberFormatException ( msg + " " + e . getMessage ( ) ) ; } long l = Math . round ( d * 1024 * 1024 * 1024L ) ; int index = Math . max ( 0 , size . length ( ) - ( size . endsWith ( "B" ) ? 2 : 1 ) ) ; switch ( size . charAt ( index ) ) { default : l /= 1024 ; case 'K' : l /= 1024 ; case 'M' : l /= 1024 ; case 'G' : return l ; }
public class SipCall { /** * This method is equivalent to the basic respondToReinvite ( ) method except that it allows the * caller to specify additional JAIN - SIP API message headers to add to or replace in the outbound * message . Use of this method requires knowledge of the JAIN - SIP API . * NOTE : The additionalHeaders parameter passed to this method must contain a ContentTypeHeader in * order for a body to be included in the message . * The extra parameters supported by this method are : * @ param additionalHeaders ArrayList of javax . sip . header . Header , each element a SIP header to add * to the outbound message . These headers are added to the message after a correct message * has been constructed . Note that if you try to add a header that there is only supposed * to be one of in a message , and it ' s already there and only one single value is allowed * for that header , then this header addition attempt will be ignored . Use the * ' replaceHeaders ' parameter instead if you want to replace the existing header with your * own . Use null for no additional message headers . * @ param replaceHeaders ArrayList of javax . sip . header . Header , each element a SIP header to add to * the outbound message , replacing existing header ( s ) of that type if present in the * message . These headers are applied to the message after a correct message has been * constructed . Use null for no replacement of message headers . * @ return true if the response was successfully sent , false otherwise . */ public boolean respondToReinvite ( SipTransaction siptrans , int statusCode , String reasonPhrase , int expires , String newContact , String displayName , ArrayList < Header > additionalHeaders , ArrayList < Header > replaceHeaders , String body ) { } }
initErrorInfo ( ) ; try { ContactHeader contact_hdr = null ; if ( newContact == null ) { contact_hdr = ( ContactHeader ) parent . getContactInfo ( ) . getContactHeader ( ) . clone ( ) ; } else { contact_hdr = parent . updateContactInfo ( newContact , displayName ) ; } if ( additionalHeaders == null ) additionalHeaders = new ArrayList < > ( ) ; additionalHeaders . add ( contact_hdr ) ; if ( parent . sendReply ( siptrans , statusCode , reasonPhrase , null , null , expires , additionalHeaders , replaceHeaders , body ) == null ) { setException ( parent . getException ( ) ) ; setErrorMessage ( parent . getErrorMessage ( ) ) ; setReturnCode ( parent . getReturnCode ( ) ) ; return false ; } return true ; } catch ( Exception ex ) { setException ( ex ) ; setErrorMessage ( "Exception: " + ex . getClass ( ) . getName ( ) + ": " + ex . getMessage ( ) ) ; setReturnCode ( SipSession . EXCEPTION_ENCOUNTERED ) ; return false ; }
public class PolynomialSolver { /** * A cubic polynomial of the form " f ( x ) = a + b * x + c * x < sup > 2 < / sup > + d * x < sup > 3 < / sup > " has * three roots . These roots will either be all real or one real and two imaginary . This function * will return a root which is always real . * WARNING : Not as numerically stable as { @ link # polynomialRootsEVD ( double . . . ) } , but still fairly stable . * @ param a polynomial coefficient . * @ param b polynomial coefficient . * @ param c polynomial coefficient . * @ param d polynomial coefficient . * @ return A real root of the cubic polynomial */ public static double cubicRootReal ( double a , double b , double c , double d ) { } }
// normalize for numerical stability double norm = Math . max ( Math . abs ( a ) , Math . abs ( b ) ) ; norm = Math . max ( norm , Math . abs ( c ) ) ; norm = Math . max ( norm , Math . abs ( d ) ) ; a /= norm ; b /= norm ; c /= norm ; d /= norm ; // proceed with standard algorithm double insideLeft = 2 * c * c * c - 9 * d * c * b + 27 * d * d * a ; double temp = c * c - 3 * d * b ; double insideOfSqrt = insideLeft * insideLeft - 4 * temp * temp * temp ; if ( insideOfSqrt >= 0 ) { double insideRight = Math . sqrt ( insideOfSqrt ) ; double ret = c + root3 ( 0.5 * ( insideLeft + insideRight ) ) + root3 ( 0.5 * ( insideLeft - insideRight ) ) ; return - ret / ( 3.0 * d ) ; } else { Complex_F64 inside = new Complex_F64 ( 0.5 * insideLeft , 0.5 * Math . sqrt ( - insideOfSqrt ) ) ; Complex_F64 root = new Complex_F64 ( ) ; ComplexMath_F64 . root ( inside , 3 , 2 , root ) ; // imaginary components cancel out double ret = c + 2 * root . getReal ( ) ; return - ret / ( 3.0 * d ) ; }
public class CmsRepositoryManager { /** * Gets a list of the repositories for the given superclass . < p > * @ param cls the superclass * @ return the repositories for whose classes the given class is a superclass */ @ SuppressWarnings ( "unchecked" ) public < REPO extends I_CmsRepository > List < REPO > getRepositories ( Class < REPO > cls ) { } }
List < REPO > result = new ArrayList < REPO > ( ) ; for ( I_CmsRepository repo : m_repositoryMap . values ( ) ) { if ( cls . isInstance ( repo ) ) { result . add ( ( REPO ) repo ) ; } } return result ;
public class DirectoryConnection { /** * Generate the obfuscated auth data . * @ param userName * the user name . * @ param password * the password . * @ return * the AuthData . */ private AuthData generateDirectoryAuthData ( String userName , String password ) { } }
if ( password != null && ! password . isEmpty ( ) ) { byte [ ] secret = ObfuscatUtil . base64Encode ( password . getBytes ( ) ) ; return new AuthData ( AuthScheme . DIRECTORY , userName , secret , true ) ; } else { return new AuthData ( AuthScheme . DIRECTORY , userName , null , false ) ; }
public class ChemObjectRef { /** * { @ inheritDoc } */ @ Override public void setProperty ( Object description , Object property ) { } }
chemobj . setProperty ( description , property ) ;
public class SequencesUtils { /** * Used to write legacy file formats . * @ return Bit2Array representation of nucleotide sequence */ public static Bit2Array convertNSequenceToBit2Array ( NucleotideSequence seq ) { } }
if ( seq . containWildcards ( ) ) throw new IllegalArgumentException ( "Sequences with wildcards are not supported." ) ; Bit2Array bar = new Bit2Array ( seq . size ( ) ) ; for ( int i = 0 ; i < seq . size ( ) ; i ++ ) bar . set ( i , seq . codeAt ( i ) ) ; return bar ;
public class JsonRpcUtils { /** * Perform a HTTP PUT request . * @ param client * @ param url * @ param headers * @ param urlParams * @ param requestData * @ return * @ since 0.9.1.6 */ public static RequestResponse callHttpPut ( HttpJsonRpcClient client , String url , Map < String , Object > headers , Map < String , Object > urlParams , Object requestData ) { } }
return client . doPut ( url , headers , urlParams , requestData ) ;
public class XmlUtil { /** * 根据节点名获得第一个子节点 * @ param element 节点 * @ param tagName 节点名 * @ return 节点 */ public static Element getElement ( Element element , String tagName ) { } }
final NodeList nodeList = element . getElementsByTagName ( tagName ) ; if ( nodeList == null || nodeList . getLength ( ) < 1 ) { return null ; } int length = nodeList . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { Element childEle = ( Element ) nodeList . item ( i ) ; if ( childEle == null || childEle . getParentNode ( ) == element ) { return childEle ; } } return null ;
public class NativeInt8Array { /** * List implementation ( much of it handled by the superclass ) */ @ Override public Byte get ( int i ) { } }
if ( checkIndex ( i ) ) { throw new IndexOutOfBoundsException ( ) ; } return ( Byte ) js_get ( i ) ;
public class RoleGraphEditingPlugin { /** * If the mouse is pressed in an empty area , create a new vertex there . * If the mouse is pressed on an existing vertex , prepare to create * an edge from that vertex to another */ @ SuppressWarnings ( "unchecked" ) public void mousePressed ( MouseEvent e ) { } }
if ( checkModifiers ( e ) ) { final VisualizationViewer < String , String > vv = ( VisualizationViewer < String , String > ) e . getSource ( ) ; final Point2D p = e . getPoint ( ) ; GraphElementAccessor < String , String > pickSupport = vv . getPickSupport ( ) ; if ( pickSupport != null ) { final String vertex = pickSupport . getVertex ( vv . getModel ( ) . getGraphLayout ( ) , p . getX ( ) , p . getY ( ) ) ; if ( vertex != null ) { // get ready to make an edge startVertex = vertex ; down = e . getPoint ( ) ; transformEdgeShape ( down , down ) ; vv . addPostRenderPaintable ( edgePaintable ) ; transformArrowShape ( down , e . getPoint ( ) ) ; vv . addPostRenderPaintable ( arrowPaintable ) ; } } vv . repaint ( ) ; }
public class OutSegment { /** * Syncs the segment to the disk . After the segment ' s data is synced , the * headers can be written . A second sync is needed to complete the header * writes . */ private void fsyncImpl ( Result < Boolean > result , FsyncType fsyncType ) { } }
try { flushData ( ) ; ArrayList < SegmentFsyncCallback > fsyncListeners = new ArrayList < > ( _fsyncListeners ) ; _fsyncListeners . clear ( ) ; Result < Boolean > resultNext = result . then ( ( v , r ) -> afterDataFsync ( r , _position , fsyncType , fsyncListeners ) ) ; if ( _isDirty || ! fsyncType . isSchedule ( ) ) { _isDirty = false ; try ( OutStore sOut = _readWrite . openWrite ( _segment . extent ( ) ) ) { if ( fsyncType . isSchedule ( ) ) { sOut . fsyncSchedule ( resultNext ) ; } else { sOut . fsync ( resultNext ) ; } } } else { resultNext . ok ( true ) ; } } catch ( Throwable e ) { e . printStackTrace ( ) ; result . fail ( e ) ; }
public class CDKAtomTypeMatcher { /** * Count the number of doubly bonded atoms . * @ param connectedBonds bonds connected to the atom * @ param atom the atom being looked at * @ param order the desired bond order of the attached bonds * @ param symbol If not null , then it only counts the double bonded atoms which * match the given symbol . * @ return the number of doubly bonded atoms */ private int countAttachedBonds ( List < IBond > connectedBonds , IAtom atom , IBond . Order order , String symbol ) { } }
// count the number of double bonded oxygens int neighborcount = connectedBonds . size ( ) ; int doubleBondedAtoms = 0 ; for ( int i = neighborcount - 1 ; i >= 0 ; i -- ) { IBond bond = connectedBonds . get ( i ) ; if ( bond . getOrder ( ) == order ) { if ( bond . getAtomCount ( ) == 2 ) { if ( symbol != null ) { // if other atom is of the given element ( by its symbol ) if ( bond . getOther ( atom ) . getSymbol ( ) . equals ( symbol ) ) { doubleBondedAtoms ++ ; } } else { doubleBondedAtoms ++ ; } } } } return doubleBondedAtoms ;