signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1177:1 : shiftExpression : additiveExpression ( shiftOp additiveExpression ) * ; */
public final void shiftExpression ( ) throws RecognitionException { } } | int shiftExpression_StartIndex = input . index ( ) ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 120 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1178:5 : ( additiveExpression ( shiftOp additiveExpression ) * )
// src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1178:9 : additiveExpression ( shiftOp additiveExpression ) *
{ pushFollow ( FOLLOW_additiveExpression_in_shiftExpression5337 ) ; additiveExpression ( ) ; state . _fsp -- ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1178:28 : ( shiftOp additiveExpression ) *
loop152 : while ( true ) { int alt152 = 2 ; alt152 = dfa152 . predict ( input ) ; switch ( alt152 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1178:30 : shiftOp additiveExpression
{ pushFollow ( FOLLOW_shiftOp_in_shiftExpression5341 ) ; shiftOp ( ) ; state . _fsp -- ; if ( state . failed ) return ; pushFollow ( FOLLOW_additiveExpression_in_shiftExpression5343 ) ; additiveExpression ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; default : break loop152 ; } } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving
if ( state . backtracking > 0 ) { memoize ( input , 120 , shiftExpression_StartIndex ) ; } } |
public class FixedDurationTemporalRandomIndexingMain { /** * Computes the ranking of which words underwent the most dramatic shifts in
* the most recent partition and then prints the ranking list of a file .
* @ param dateString the string to use when indiciation which partition is
* having its ranking lists printed . This string becomes a part of
* the file name . */
private void printShiftRankings ( String dateString , long startOfMostRecentPartition , TimeSpan partitionDuration ) throws IOException { } } | SortedMultiMap < Double , String > shiftToWord = new TreeMultiMap < Double , String > ( ) ; // Create a second time span than is twice the duration . We will use
// this to check whether two partition ' s vectors were adjacent in the
// slice by seeing wether the timestamps fall within this duration
TimeSpan twoPartitions = new TimeSpan ( partitionDuration . getYears ( ) * 2 , partitionDuration . getMonths ( ) * 2 , partitionDuration . getWeeks ( ) * 2 , partitionDuration . getDays ( ) * 2 , partitionDuration . getHours ( ) * 2 ) ; // Once we have all the vectors for each word in each sspace ,
// calculate how much the vector has changed .
for ( Map . Entry < String , SortedMap < Long , double [ ] > > e : wordToTemporalSemantics . entrySet ( ) ) { String word = e . getKey ( ) ; SortedMap < Long , double [ ] > m = e . getValue ( ) ; // Skip computing shifts for words without enough partitions
if ( m . size ( ) < 2 ) continue ; // Get the timestamps as a navigable map so we can identify the last
// two keys in it more easly .
NavigableMap < Long , double [ ] > timestampToVector = ( e instanceof NavigableMap ) ? ( NavigableMap < Long , double [ ] > ) m : new TreeMap < Long , double [ ] > ( m ) ; Map . Entry < Long , double [ ] > mostRecent = timestampToVector . lastEntry ( ) ; // Skip calculating the shift for words who most recent partition
// was not the same as the most recent partition for TRI
if ( ! mostRecent . getKey ( ) . equals ( startOfMostRecentPartition ) ) continue ; Map . Entry < Long , double [ ] > secondMostRecent = timestampToVector . lowerEntry ( mostRecent . getKey ( ) ) ; // Skip calculating the shift for words where the two most recent
// partitoins aren ' t contiguous . Check for this using the custom
// time span that covers two partitions
if ( ! twoPartitions . insideRange ( secondMostRecent . getKey ( ) , mostRecent . getKey ( ) ) ) continue ; // Compute the semantic shift of the two partitions
shiftToWord . put ( Similarity . cosineSimilarity ( secondMostRecent . getValue ( ) , mostRecent . getValue ( ) ) , word ) ; } PrintWriter pw = new PrintWriter ( new File ( outputDir , "shift-ranks-for." + dateString + ".txt" ) ) ; for ( Map . Entry < Double , String > e : shiftToWord . entrySet ( ) ) { pw . println ( e . getKey ( ) + "\t" + e . getValue ( ) ) ; } pw . close ( ) ; |
public class AsciiTable { /** * Sets left and right padding for all cells in the table .
* @ param padding new padding for left and right , ignored if smaller than 0
* @ return this to allow chaining */
public AsciiTable setPaddingLeftRight ( int padding ) { } } | for ( AT_Row row : this . rows ) { if ( row . getType ( ) == TableRowType . CONTENT ) { row . setPaddingLeftRight ( padding ) ; } } return this ; |
public class CopyJobConfiguration { /** * Creates a builder for a BigQuery Copy Job configuration given destination and source tables . */
public static Builder newBuilder ( TableId destinationTable , List < TableId > sourceTables ) { } } | return new Builder ( ) . setDestinationTable ( destinationTable ) . setSourceTables ( sourceTables ) ; |
public class ReferenceIndividualGroupService { /** * Returns a cached < code > IEntityGroup < / code > or null if it has not been cached . */
protected IEntityGroup getGroupFromCache ( String key ) throws CachingException { } } | return ( IEntityGroup ) EntityCachingService . instance ( ) . get ( ICompositeGroupService . GROUP_ENTITY_TYPE , key ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EEnum getIfcGeographicElementTypeEnum ( ) { } } | if ( ifcGeographicElementTypeEnumEEnum == null ) { ifcGeographicElementTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 997 ) ; } return ifcGeographicElementTypeEnumEEnum ; |
public class HashIntMap { /** * Turn the specified key into an index . */
protected final int keyToIndex ( int key ) { } } | // we lift the hash - fixing function from HashMap because Sun
// wasn ' t kind enough to make it public
key += ~ ( key << 9 ) ; key ^= ( key >>> 14 ) ; key += ( key << 4 ) ; key ^= ( key >>> 10 ) ; return key & ( _buckets . length - 1 ) ; |
public class BaseField { /** * Get the physical binary data from this field .
* Behaviors are often used to initiate a complicated action only when the system asks for this data .
* @ return The raw data for this field . */
public Object getData ( ) { } } | Object objData = null ; FieldListener nextListener = ( FieldListener ) this . getNextValidListener ( DBConstants . SCREEN_MOVE ) ; // Fix this
if ( nextListener != null ) { boolean bOldState = nextListener . setEnabledListener ( false ) ; // Disable the listener to eliminate echos
objData = nextListener . doGetData ( ) ; nextListener . setEnabledListener ( bOldState ) ; // Reenable
} else objData = this . doGetData ( ) ; return objData ; |
public class CeSymm { /** * Analyze a single level of symmetry .
* @ param atoms
* Atom array of the current level
* @ return CeSymmResult
* @ throws StructureException */
public static CeSymmResult analyzeLevel ( Atom [ ] atoms , CESymmParameters params ) throws StructureException { } } | if ( atoms . length < 1 ) throw new IllegalArgumentException ( "Empty Atom array given." ) ; CeSymmResult result = align ( atoms , params ) ; if ( result . isRefined ( ) ) { // STEP 5 : symmetry alignment optimization
if ( result . getParams ( ) . getOptimization ( ) ) { try { MultipleAlignment msa = result . getMultipleAlignment ( ) ; SymmOptimizer optimizer = new SymmOptimizer ( result ) ; msa = optimizer . optimize ( ) ; result . setMultipleAlignment ( msa ) ; } catch ( RefinerFailedException e ) { logger . debug ( "Optimization failed:" + e . getMessage ( ) ) ; } } } return result ; |
public class ModifyClusterIamRolesRequest { /** * Zero or more IAM roles in ARN format to disassociate from the cluster . You can disassociate up to 10 IAM roles
* from a single cluster in a single request .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setRemoveIamRoles ( java . util . Collection ) } or { @ link # withRemoveIamRoles ( java . util . Collection ) } if you want
* to override the existing values .
* @ param removeIamRoles
* Zero or more IAM roles in ARN format to disassociate from the cluster . You can disassociate up to 10 IAM
* roles from a single cluster in a single request .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ModifyClusterIamRolesRequest withRemoveIamRoles ( String ... removeIamRoles ) { } } | if ( this . removeIamRoles == null ) { setRemoveIamRoles ( new com . amazonaws . internal . SdkInternalList < String > ( removeIamRoles . length ) ) ; } for ( String ele : removeIamRoles ) { this . removeIamRoles . add ( ele ) ; } return this ; |
public class ApiBuilder { /** * Adds a POST request handler for the specified path to the { @ link Javalin } instance .
* The method can only be called inside a { @ link Javalin # routes ( EndpointGroup ) } .
* @ see < a href = " https : / / javalin . io / documentation # handlers " > Handlers in docs < / a > */
public static void post ( @ NotNull String path , @ NotNull Handler handler ) { } } | staticInstance ( ) . post ( prefixPath ( path ) , handler ) ; |
public class CharSequences { /** * Utility for comparing the contents of CharSequences
* @ deprecated This API is ICU internal only .
* @ hide draft / provisional / internal are hidden on Android */
@ Deprecated public static boolean equalsChars ( CharSequence a , CharSequence b ) { } } | // do length test first for fast path
return a . length ( ) == b . length ( ) && compare ( a , b ) == 0 ; |
public class PrcCsvSampleDataRow { /** * < p > Process entity request . < / p >
* @ param pAddParam additional param
* @ param pRequestData Request Data
* @ throws Exception - an exception */
@ Override public final void process ( final Map < String , Object > pAddParam , final IRequestData pRequestData ) throws Exception { } } | String retrieverName = pRequestData . getParameter ( "nmRet" ) ; ICsvDataRetriever ret = this . retrievers . get ( retrieverName ) ; if ( ret == null ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "Can't find retriever " + retrieverName ) ; } pRequestData . setAttribute ( "dataTree" , ret . getSampleDataRow ( pAddParam ) ) ; |
public class HostProcess { /** * Skips the plugin with the given ID with the given { @ code reason } .
* Ideally the { @ code reason } should be internationalised as it is shown in the GUI .
* @ param pluginId the ID of the plugin that will be skipped .
* @ param reason the reason why the plugin was skipped , might be { @ code null } .
* @ since 2.7.0
* @ see # pluginSkipped ( Plugin , String ) */
public void pluginSkipped ( int pluginId , String reason ) { } } | Plugin plugin = pluginFactory . getPlugin ( pluginId ) ; if ( plugin == null ) { return ; } pluginSkipped ( plugin , reason ) ; |
public class Configs { /** * Get self config string .
* @ param configAbsoluteClassPath config path .
* @ param key config key in configAbsoluteClassPath config file
* @ return config value string . Return null if not add config file or not config in config file .
* @ see # addSelfConfigs ( String , OneProperties ) */
public static String getSelfConfig ( String configAbsoluteClassPath , IConfigKey key ) { } } | OneProperties configs = otherConfigs . get ( configAbsoluteClassPath ) ; if ( configs == null ) { addSelfConfigs ( configAbsoluteClassPath , null ) ; configs = otherConfigs . get ( configAbsoluteClassPath ) ; if ( configs == null ) { return VOID_CONFIGS . getConfig ( key ) ; } } return configs . getConfig ( key ) ; |
public class InternalQueries { /** * Converts array of objects to { @ code List < Object > } .
* @ param args array of objects .
* @ return non - null , unmodifiable list of objects . */
@ NonNull public static List < Object > unmodifiableNonNullList ( @ Nullable Object [ ] args ) { } } | return args == null || args . length == 0 ? emptyList ( ) : unmodifiableList ( asList ( args ) ) ; |
public class AppDeployer { /** * Deploy a single application and any found yaml configuration files . */
public void deployAll ( ) throws MojoExecutionException { } } | stager . stage ( ) ; ImmutableList . Builder < Path > computedDeployables = ImmutableList . builder ( ) ; // Look for app . yaml
Path appYaml = deployMojo . getStagingDirectory ( ) . resolve ( "app.yaml" ) ; if ( ! Files . exists ( appYaml ) ) { throw new MojoExecutionException ( "Failed to deploy all: could not find app.yaml." ) ; } deployMojo . getLog ( ) . info ( "deployAll: Preparing to deploy app.yaml" ) ; computedDeployables . add ( appYaml ) ; // Look for config yamls
String [ ] configYamls = { "cron.yaml" , "dispatch.yaml" , "dos.yaml" , "index.yaml" , "queue.yaml" } ; for ( String yamlName : configYamls ) { Path yaml = appengineDirectory . resolve ( yamlName ) ; if ( Files . exists ( yaml ) ) { deployMojo . getLog ( ) . info ( "deployAll: Preparing to deploy " + yamlName ) ; computedDeployables . add ( yaml ) ; } } DeployConfiguration config = configBuilder . buildDeployConfiguration ( computedDeployables . build ( ) ) ; try { deployMojo . getAppEngineFactory ( ) . deployment ( ) . deploy ( config ) ; } catch ( AppEngineException ex ) { throw new MojoExecutionException ( "Failed to deploy" , ex ) ; } |
public class LottieDrawable { /** * Sets the minimum progress that the animation will start from when playing or looping . */
public void setMinProgress ( final float minProgress ) { } } | if ( composition == null ) { lazyCompositionTasks . add ( new LazyCompositionTask ( ) { @ Override public void run ( LottieComposition composition ) { setMinProgress ( minProgress ) ; } } ) ; return ; } setMinFrame ( ( int ) MiscUtils . lerp ( composition . getStartFrame ( ) , composition . getEndFrame ( ) , minProgress ) ) ; |
public class LzoCodec { /** * Check if native - lzo library is loaded & initialized .
* @ param conf configuration
* @ return < code > true < / code > if native - lzo library is loaded & initialized ;
* else < code > false < / code > */
public static synchronized boolean isNativeLzoLoaded ( Configuration conf ) { } } | if ( ! nativeLzoChecked ) { if ( GPLNativeCodeLoader . isNativeCodeLoaded ( ) ) { nativeLzoLoaded = LzoCompressor . isNativeLzoLoaded ( ) && LzoDecompressor . isNativeLzoLoaded ( ) ; if ( nativeLzoLoaded ) { LOG . info ( "Successfully loaded & initialized native-lzo library" ) ; } else { LOG . error ( "Failed to load/initialize native-lzo library" ) ; } } else { LOG . error ( "Cannot load native-lzo without native-hadoop" ) ; } nativeLzoChecked = true ; } return nativeLzoLoaded && conf . getBoolean ( "hadoop.native.lib" , true ) ; |
public class DeepWaterTask { /** * Transfer ownership from global ( shared ) model to local model which will be worked on */
@ Override protected void setupLocal ( ) { } } | // long start = System . currentTimeMillis ( ) ;
assert ( _localmodel == null ) ; _localmodel = _sharedmodel ; _sharedmodel = null ; _localmodel . set_processed_local ( 0 ) ; final int weightIdx = _fr . find ( _localmodel . get_params ( ) . _weights_column ) ; final int respIdx = _fr . find ( _localmodel . get_params ( ) . _response_column ) ; final int batchSize = _localmodel . get_params ( ) . _mini_batch_size ; // long nativetime = 0;
DeepWaterIterator iter = null ; long seed = 0xDECAF + 0xD00D * _localmodel . get_processed_global ( ) ; Random rng = RandomUtils . getRNG ( seed ) ; if ( _fr . numRows ( ) > Integer . MAX_VALUE ) { throw H2O . unimpl ( "Need to implement batching into int-sized chunks." ) ; } int len = ( int ) _fr . numRows ( ) ; int j = 0 ; Futures fs = new Futures ( ) ; ArrayList trainLabels = new ArrayList < > ( ) ; ArrayList trainData = new ArrayList < > ( ) ; try { // Binary data ( Images / Documents / etc . )
if ( _localmodel . get_params ( ) . _problem_type == DeepWaterParameters . ProblemType . image || _localmodel . get_params ( ) . _problem_type == DeepWaterParameters . ProblemType . text ) { int dataIdx = 0 ; // must be the first column / / FIXME
Log . debug ( "Using column " + _fr . name ( dataIdx ) + " for " + ( ( _localmodel . get_params ( ) . _problem_type == DeepWaterParameters . ProblemType . image ) ? "path to image data" : ( ( _localmodel . get_params ( ) . _problem_type == DeepWaterParameters . ProblemType . text ) ? "text data" : "path to arbitrary bytes" ) ) ) ; // full passes over the data
BufferedString bs = new BufferedString ( ) ; int fullpasses = ( int ) _useFraction ; // Example : train _ samples _ per _ iteration = 4700 , and train . numRows ( ) = 1000 - > _ useFraction = 4.7 - > fullpasses = 4
while ( j ++ < fullpasses ) { for ( int i = 0 ; i < _fr . numRows ( ) ; ++ i ) { double weight = weightIdx == - 1 ? 1 : _fr . vec ( weightIdx ) . at ( i ) ; if ( weight == 0 ) continue ; BufferedString file = _fr . vec ( dataIdx ) . atStr ( bs , i ) ; if ( file != null ) trainData . add ( file . toString ( ) ) ; float response = ( float ) _fr . vec ( respIdx ) . at ( i ) ; trainLabels . add ( response ) ; } } // fractional passes / / 0.7
while ( trainData . size ( ) < _useFraction * len || trainData . size ( ) % batchSize != 0 ) { assert ( _shuffle ) ; int i = rng . nextInt ( len ) ; double weight = weightIdx == - 1 ? 1 : _fr . vec ( weightIdx ) . at ( i ) ; if ( weight == 0 ) continue ; BufferedString file = _fr . vec ( dataIdx ) . atStr ( bs , i ) ; if ( file != null ) trainData . add ( file . toString ( ) ) ; float response = ( float ) _fr . vec ( respIdx ) . at ( i ) ; trainLabels . add ( response ) ; } } // Numeric data ( H2O Frame full with numeric columns )
else if ( _localmodel . get_params ( ) . _problem_type == DeepWaterParameters . ProblemType . dataset ) { double mul = _localmodel . _dataInfo . _normRespMul != null ? _localmodel . _dataInfo . _normRespMul [ 0 ] : 1 ; double sub = _localmodel . _dataInfo . _normRespSub != null ? _localmodel . _dataInfo . _normRespSub [ 0 ] : 0 ; // full passes over the data
int fullpasses = ( int ) _useFraction ; while ( j ++ < fullpasses ) { for ( int i = 0 ; i < _fr . numRows ( ) ; ++ i ) { double weight = weightIdx == - 1 ? 1 : _fr . vec ( weightIdx ) . at ( i ) ; if ( weight == 0 ) continue ; float response = ( float ) ( ( _fr . vec ( respIdx ) . at ( i ) - sub ) / mul ) ; trainData . add ( i ) ; trainLabels . add ( response ) ; } } // fractional passes
while ( trainData . size ( ) < _useFraction * len || trainData . size ( ) % batchSize != 0 ) { int i = rng . nextInt ( len ) ; double weight = weightIdx == - 1 ? 1 : _fr . vec ( weightIdx ) . at ( i ) ; if ( weight == 0 ) continue ; float response = ( float ) ( ( _fr . vec ( respIdx ) . at ( i ) - sub ) / mul ) ; trainData . add ( i ) ; trainLabels . add ( response ) ; } } // shuffle the ( global ) list
if ( _shuffle ) { rng . setSeed ( seed ) ; Collections . shuffle ( trainLabels , rng ) ; rng . setSeed ( seed ) ; Collections . shuffle ( trainData , rng ) ; } if ( _localmodel . get_params ( ) . _problem_type == DeepWaterParameters . ProblemType . image ) { iter = new DeepWaterImageIterator ( trainData , trainLabels , _localmodel . _meanData , batchSize , _localmodel . _width , _localmodel . _height , _localmodel . _channels , _localmodel . get_params ( ) . _cache_data ) ; } else if ( _localmodel . get_params ( ) . _problem_type == DeepWaterParameters . ProblemType . dataset ) { assert ( _localmodel . _dataInfo != null ) ; iter = new DeepWaterDatasetIterator ( trainData , trainLabels , _localmodel . _dataInfo , batchSize , _localmodel . get_params ( ) . _cache_data ) ; } else if ( _localmodel . get_params ( ) . _problem_type == DeepWaterParameters . ProblemType . text ) { iter = new DeepWaterTextIterator ( trainData , trainLabels , batchSize , 56 /* FIXME */
, _localmodel . get_params ( ) . _cache_data ) ; } NativeTrainTask ntt ; while ( iter . Next ( fs ) && ! _job . isStopping ( ) ) { // if ( ntt ! = null ) nativetime + = ntt . _ timeInMillis ;
long n = _localmodel . get_processed_total ( ) ; // if ( ! _ localmodel . get _ params ( ) . _ quiet _ mode )
// Log . info ( " Trained " + n + " samples . Training on " + Arrays . toString ( ( ( DeepWaterImageIterator ) iter ) . getFiles ( ) ) ) ;
_localmodel . _backend . setParameter ( _localmodel . getModel ( ) . get ( ) , "learning_rate" , _localmodel . get_params ( ) . learningRate ( ( double ) n ) ) ; _localmodel . _backend . setParameter ( _localmodel . getModel ( ) . get ( ) , "momentum" , _localmodel . get_params ( ) . momentum ( ( double ) n ) ) ; // fork off GPU work , but let the iterator . Next ( ) wait on completion before swapping again
// System . err . println ( " data : " + Arrays . toString ( iter . getData ( ) ) ) ;
/* float [ ] preds = _ localmodel . _ backend . predict ( _ localmodel . _ model , iter . getData ( ) ) ;
if ( Float . isNaN ( ArrayUtils . sum ( preds ) ) ) {
Log . err ( DeepWaterModel . unstable _ msg ) ;
throw new UnsupportedOperationException ( DeepWaterModel . unstable _ msg ) ; */
// System . err . println ( " pred : " + Arrays . toString ( preds ) ) ;
ntt = new NativeTrainTask ( _localmodel . _backend , _localmodel . getModel ( ) . get ( ) , iter . getData ( ) , iter . getLabel ( ) ) ; fs . add ( H2O . submitTask ( ntt ) ) ; _localmodel . add_processed_local ( iter . _batch_size ) ; } fs . blockForPending ( ) ; // nativetime + = ntt . _ timeInMillis ;
} catch ( IOException e ) { e . printStackTrace ( ) ; // gracefully continue if we can ' t find files etc .
} // long end = System . currentTimeMillis ( ) ;
// if ( ! _ localmodel . get _ params ( ) . _ quiet _ mode ) {
// Log . info ( " Time for one iteration : " + PrettyPrint . msecs ( end - start , true ) ) ;
// Log . info ( " Time for native training : " + PrettyPrint . msecs ( nativetime , true ) ) ; |
public class CmsSearchParameters { /** * Creates a query String build from this search parameters for HTML links . < p >
* @ return a query String build from this search parameters for HTML links */
public String toQueryString ( ) { } } | StringBuffer result = new StringBuffer ( 128 ) ; result . append ( "?action=search" ) ; if ( getParsedQuery ( ) != null ) { result . append ( "&parsedQuery=" ) ; result . append ( CmsEncoder . encodeParameter ( getParsedQuery ( ) ) ) ; } else { result . append ( "&query=" ) ; result . append ( CmsEncoder . encodeParameter ( getQuery ( ) ) ) ; } result . append ( "&matchesPerPage=" ) ; result . append ( getMatchesPerPage ( ) ) ; result . append ( "&displayPages=" ) ; result . append ( getDisplayPages ( ) ) ; result . append ( "&index=" ) ; result . append ( CmsEncoder . encodeParameter ( getIndex ( ) ) ) ; Sort sort = getSort ( ) ; if ( sort != CmsSearchParameters . SORT_DEFAULT ) { result . append ( "&sort=" ) ; if ( sort == CmsSearchParameters . SORT_TITLE ) { result . append ( "title" ) ; } else if ( sort == CmsSearchParameters . SORT_DATE_CREATED ) { result . append ( "date-created" ) ; } else if ( sort == CmsSearchParameters . SORT_DATE_LASTMODIFIED ) { result . append ( "date-lastmodified" ) ; } } if ( ( getCategories ( ) != null ) && ( getCategories ( ) . size ( ) > 0 ) ) { result . append ( "&category=" ) ; Iterator < String > it = getCategories ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { result . append ( it . next ( ) ) ; if ( it . hasNext ( ) ) { result . append ( ',' ) ; } } } if ( getMinDateCreated ( ) > Long . MIN_VALUE ) { result . append ( "&minDateCreated=" ) ; result . append ( getMinDateCreated ( ) ) ; } if ( getMinDateLastModified ( ) > Long . MIN_VALUE ) { result . append ( "&minDateLastModified=" ) ; result . append ( getMinDateLastModified ( ) ) ; } if ( getMaxDateCreated ( ) < Long . MAX_VALUE ) { result . append ( "&maxDateCreated=" ) ; result . append ( getMaxDateCreated ( ) ) ; } if ( getMaxDateLastModified ( ) < Long . MAX_VALUE ) { result . append ( "&maxDateLastModified=" ) ; result . append ( getMaxDateLastModified ( ) ) ; } if ( ( getRoots ( ) != null ) && ( getRoots ( ) . size ( ) > 0 ) ) { result . append ( "&searchRoots=" ) ; Iterator < String > it = getRoots ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { result . append ( CmsEncoder . encode ( it . next ( ) ) ) ; if ( it . hasNext ( ) ) { result . append ( ',' ) ; } } } if ( isExcerptOnlySearchedFields ( ) ) { result . append ( "&excerptOnlySearchedFields=true" ) ; } return result . toString ( ) ; |
public class ConfigReferenceHolder { /** * Called by a proxy to lookup a map of object references . The proxy knows
* the schema name so the hold does not need to bother storing it . */
public Map < String , Object > getObjectReferenceMap ( String field , String schemaName ) { } } | List < String > instanceIds = references . get ( field ) ; if ( instanceIds == null || instanceIds . size ( ) == 0 ) { return null ; } Map < String , Object > objects = new HashMap < > ( ) ; for ( String instanceId : instanceIds ) { BeanId id = BeanId . create ( instanceId , schemaName ) ; Object instance = instances . get ( id ) ; if ( instance != null ) { objects . put ( instanceId , instance ) ; } else { instance = cache . get ( id ) ; instances . put ( id , instance ) ; objects . put ( instanceId , instance ) ; } } return objects ; |
public class PatreonAPI { /** * Add fields [ type ] = fieldName , fieldName , fieldName as a query parameter to the request represented by builder
* @ param builder A URIBuilder building a request to the API
* @ param type A BaseResource annotated with { @ link com . github . jasminb . jsonapi . annotations . Type }
* @ param fields A list of fields to include . Only fields in this list will be retrieved in the query
* @ return builder */
private URIBuilder addFieldsParam ( URIBuilder builder , Class < ? extends BaseResource > type , Collection < ? extends Field > fields ) { } } | List < String > fieldNames = new ArrayList < > ( ) ; for ( Field f : fields ) { fieldNames . add ( f . getPropertyName ( ) ) ; } String typeStr = BaseResource . getType ( type ) ; builder . addParameter ( "fields[" + typeStr + "]" , String . join ( "," , fieldNames ) ) ; return builder ; |
public class IndexFacesResult { /** * An array of faces that were detected in the image but weren ' t indexed . They weren ' t indexed because the quality
* filter identified them as low quality , or the < code > MaxFaces < / code > request parameter filtered them out . To use
* the quality filter , you specify the < code > QualityFilter < / code > request parameter .
* @ param unindexedFaces
* An array of faces that were detected in the image but weren ' t indexed . They weren ' t indexed because the
* quality filter identified them as low quality , or the < code > MaxFaces < / code > request parameter filtered
* them out . To use the quality filter , you specify the < code > QualityFilter < / code > request parameter . */
public void setUnindexedFaces ( java . util . Collection < UnindexedFace > unindexedFaces ) { } } | if ( unindexedFaces == null ) { this . unindexedFaces = null ; return ; } this . unindexedFaces = new java . util . ArrayList < UnindexedFace > ( unindexedFaces ) ; |
public class GlobalUsersInner { /** * Register a user to a managed lab .
* @ param userName The name of the user .
* @ 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 < Void > registerAsync ( String userName , final ServiceCallback < Void > serviceCallback ) { } } | return ServiceFuture . fromResponse ( registerWithServiceResponseAsync ( userName ) , serviceCallback ) ; |
public class MathUtil { /** * 从一个词的词性到另一个词的词的分数
* @ param from
* 前面的词
* @ param to
* 后面的词
* @ return 分数 */
public static double compuScore ( Term from , Term to , Map < String , Double > relationMap ) { } } | double frequency = from . termNatures ( ) . allFreq + 1 ; if ( frequency < 0 ) { double score = from . score ( ) + MAX_FREQUENCE ; from . score ( score ) ; return score ; } double nTwoWordsFreq = NgramLibrary . getTwoWordFreq ( from , to ) ; if ( relationMap != null ) { Double d = relationMap . get ( from . getName ( ) + TAB + to . getName ( ) ) ; if ( d != null ) { nTwoWordsFreq += d ; } } double value = - Math . log ( dSmoothingPara * frequency / ( MAX_FREQUENCE + 80000 ) + ( 1 - dSmoothingPara ) * ( ( 1 - dTemp ) * nTwoWordsFreq / frequency + dTemp ) ) ; if ( value < 0 ) { value += frequency ; } return from . score ( ) + value ; |
public class ClusterPanel { /** * GEN - LAST : event _ formMouseClicked */
@ Override protected void paintComponent ( Graphics g ) { } } | updateLocation ( ) ; if ( highligted ) { g . setColor ( Color . BLUE ) ; } else { g . setColor ( default_color ) ; } int c = ( int ) ( panel_size / 2 ) ; if ( cluster . getId ( ) >= 0 ) g . drawString ( "C" + ( int ) cluster . getId ( ) , c , c ) ; g . drawOval ( 0 , 0 , panel_size , panel_size ) ; if ( direction != null ) { double length = Math . sqrt ( Math . pow ( direction [ 0 ] , 2 ) + Math . pow ( direction [ 1 ] , 2 ) ) ; g . drawLine ( c , c , c + ( int ) ( ( direction [ 0 ] / length ) * panel_size ) , c + ( int ) ( ( direction [ 1 ] / length ) * panel_size ) ) ; } updateTooltip ( ) ; |
public class Choice { /** * Returns a choice of the optional value , if it is present , or the empty choice if it is absent . */
public static < T > Choice < T > fromOptional ( Optional < T > optional ) { } } | return optional . isPresent ( ) ? of ( optional . get ( ) ) : Choice . < T > none ( ) ; |
public class CmsAddDialogTypeHelper { /** * Creates list of resource type beans for gallery or ' New ' dialog . < p >
* @ param cms the CMS context
* @ param folderRootPath the current folder
* @ param checkViewableReferenceUri the reference uri to use for viewability check
* @ param elementView the element view
* @ param checkEnabled object to check whether resource types should be enabled
* @ return the list of resource type beans
* @ throws CmsException if something goes wrong */
public List < CmsResourceTypeBean > getResourceTypes ( CmsObject cms , String folderRootPath , String checkViewableReferenceUri , CmsElementView elementView , I_CmsResourceTypeEnabledCheck checkEnabled ) throws CmsException { } } | if ( elementView == null ) { LOG . error ( "Element view is null" ) ; return Collections . emptyList ( ) ; } List < I_CmsResourceType > additionalTypes = Lists . newArrayList ( ) ; // First store the types in a map , to avoid duplicates
Map < String , I_CmsResourceType > additionalTypeMap = Maps . newHashMap ( ) ; if ( elementView . getExplorerType ( ) != null ) { List < CmsExplorerTypeSettings > explorerTypes = OpenCms . getWorkplaceManager ( ) . getExplorerTypesForView ( elementView . getExplorerType ( ) . getName ( ) ) ; for ( CmsExplorerTypeSettings explorerType : explorerTypes ) { if ( elementView . isOther ( ) && m_includedAdeTypes . contains ( explorerType . getName ( ) ) ) { continue ; } additionalTypeMap . put ( explorerType . getName ( ) , OpenCms . getResourceManager ( ) . getResourceType ( explorerType . getName ( ) ) ) ; } } if ( OpenCms . getRoleManager ( ) . hasRole ( cms , CmsRole . DEVELOPER ) && elementView . isOther ( ) ) { Set < String > hiddenTypes = new HashSet < String > ( m_allAdeTypes ) ; hiddenTypes . removeAll ( m_includedAdeTypes ) ; for ( String typeName : hiddenTypes ) { if ( OpenCms . getResourceManager ( ) . hasResourceType ( typeName ) ) { additionalTypeMap . put ( typeName , OpenCms . getResourceManager ( ) . getResourceType ( typeName ) ) ; } } } additionalTypes . addAll ( additionalTypeMap . values ( ) ) ; return internalGetResourceTypesFromConfig ( cms , folderRootPath , checkViewableReferenceUri , elementView , additionalTypes , checkEnabled ) ; |
public class GrapesClient { /** * Returns the artifact available versions
* @ param gavc String
* @ return List < String > */
public List < String > getArtifactVersions ( final String gavc ) throws GrapesCommunicationException { } } | final Client client = getClient ( ) ; final WebResource resource = client . resource ( serverURL ) . path ( RequestUtils . getArtifactVersions ( gavc ) ) ; final ClientResponse response = resource . accept ( MediaType . APPLICATION_JSON ) . get ( ClientResponse . class ) ; client . destroy ( ) ; if ( ClientResponse . Status . OK . getStatusCode ( ) != response . getStatus ( ) ) { final String message = FAILED_TO_GET_CORPORATE_FILTERS ; if ( LOG . isErrorEnabled ( ) ) { LOG . error ( String . format ( HTTP_STATUS_TEMPLATE_MSG , message , response . getStatus ( ) ) ) ; } throw new GrapesCommunicationException ( message , response . getStatus ( ) ) ; } return response . getEntity ( new GenericType < List < String > > ( ) { } ) ; |
public class ResourceBundle { /** * Finds the named { @ code ResourceBundle } for the specified { @ code Locale } and the caller
* { @ code ClassLoader } .
* @ param bundleName
* the name of the { @ code ResourceBundle } .
* @ param locale
* the { @ code Locale } .
* @ return the requested resource bundle .
* @ throws MissingResourceException
* if the resource bundle cannot be found . */
public static ResourceBundle getBundle ( String bundleName , Locale locale ) { } } | ClassLoader classLoader = ClassLoader . getSystemClassLoader ( ) ; if ( classLoader == null ) { classLoader = getLoader ( ) ; } return getBundle ( bundleName , locale , classLoader ) ; |
public class EmailSettingsApi { /** * Modify outbound settings .
* Adds or updates outbound settings .
* @ param body Body Data ( required )
* @ return ApiResponse & lt ; ApiSuccessResponse & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < ApiSuccessResponse > modifyOutboundSettingsWithHttpInfo ( ModifyOutboundData body ) throws ApiException { } } | com . squareup . okhttp . Call call = modifyOutboundSettingsValidateBeforeCall ( body , null , null ) ; Type localVarReturnType = new TypeToken < ApiSuccessResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class MappingContextImpl { /** * Determines whether the { @ code subPath } is shaded . */
boolean isShaded ( String subPath ) { } } | for ( String shadedPath : shadedPaths ) if ( subPath . startsWith ( shadedPath ) ) return true ; return false ; |
public class XmlMapper { /** * Java Collection - > Xml with encoding , 特别支持Root Element是Collection的情形 . */
public static String toXml ( Collection < ? > root , String rootName , Class clazz , String encoding ) { } } | try { CollectionWrapper wrapper = new CollectionWrapper ( ) ; wrapper . collection = root ; JAXBElement < CollectionWrapper > wrapperElement = new JAXBElement < CollectionWrapper > ( new QName ( rootName ) , CollectionWrapper . class , wrapper ) ; StringWriter writer = new StringWriter ( ) ; createMarshaller ( clazz , encoding ) . marshal ( wrapperElement , writer ) ; return writer . toString ( ) ; } catch ( JAXBException e ) { throw ExceptionUtil . unchecked ( e ) ; } |
public class Contents { /** * Get the Tile Matrix Set , should only return one or no value
* @ return tile matrix set */
public TileMatrixSet getTileMatrixSet ( ) { } } | TileMatrixSet result = null ; if ( tileMatrixSet . size ( ) > 1 ) { // This shouldn ' t happen with the table name primary key on tile
// matrix set
throw new GeoPackageException ( "Unexpected state. More than one TileMatrixSet has a foreign key to the Contents. Count: " + tileMatrixSet . size ( ) ) ; } else if ( tileMatrixSet . size ( ) == 1 ) { CloseableIterator < TileMatrixSet > iterator = tileMatrixSet . closeableIterator ( ) ; try { result = iterator . next ( ) ; } finally { try { iterator . close ( ) ; } catch ( IOException e ) { throw new GeoPackageException ( "Failed to close the Tile Matrix Set iterator" , e ) ; } } } return result ; |
public class StringTextValue { /** * Sets the given value and set the initalValue flag if the flag should keep his state .
* @ param value
* the value
* @ param initialValue
* this flag tells the generator if the value is initial . This flag is taken for the
* generation of javascript , if false this { @ link StringTextValue } will be not added .
* @ return the string text value */
public StringTextValue < T > setValue ( final T value , final boolean initialValue ) { } } | this . initialValue = initialValue ; this . value = value ; return this ; |
public class RemoteRegistry { /** * Method blocks until the registry is not handling any tasks and is currently consistent .
* Note : If you have just modified the registry this method can maybe return immediately if the task is not yet received by the registry controller .
* So you should prefer the futures of the modification methods for synchronization tasks .
* @ return a future which is finished if the registry is ready . */
public Future < Void > waitUntilReadyFuture ( ) { } } | try { return getRegistryRemote ( ) . waitUntilReadyFuture ( ) ; } catch ( NotAvailableException ex ) { return FutureProcessor . canceledFuture ( null , ex ) ; } |
public class CodepointHelper { /** * Verifies a sequence of codepoints using the specified filter
* @ param aIter
* Codepointer iterator
* @ param aFilter
* filter */
public static void verify ( final AbstractCodepointIterator aIter , final IntPredicate aFilter ) { } } | final CodepointIteratorRestricted rci = aIter . restrict ( aFilter , false ) ; while ( rci . hasNext ( ) ) rci . next ( ) ; |
public class SubItemUtil { /** * retrieves a flat list of the items in the adapter , respecting subitems regardless of there current visibility
* @ param adapter the adapter instance
* @ param countHeaders if true , headers will be counted as well
* @ return list of items in the adapter */
public static List < IItem > getAllItems ( final IItemAdapter adapter , boolean countHeaders ) { } } | return getAllItems ( adapter . getAdapterItems ( ) , countHeaders , false , null ) ; |
public class UserRegistryProxy { /** * { @ inheritDoc } */
@ Override public String mapCertificate ( X509Certificate [ ] chain ) throws CertificateMapNotSupportedException , CertificateMapFailedException , RegistryException { } } | for ( UserRegistry registry : delegates ) { try { return registry . mapCertificate ( chain ) ; } catch ( CertificateMapNotSupportedException cmnse ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "CertificateMapNotSupportedException caught on mapCertificate" , registry , chain , cmnse ) ; } } catch ( CertificateMapFailedException cmfe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "CertificateMapFailedException caught on mapCertificate" , registry , chain , cmfe ) ; } } } throw new CertificateMapFailedException ( "Unable to map certificate: " + chain ) ; |
public class ConfigValidator { /** * Valid configuration elements . If a validation problem is found , generate a validation
* message and emit this as a trace warning . A validation message , if generated , will
* usually be a multi - line message , with a half - dozen lines or more per problem which
* is detected .
* @ param registryEntry The registry entry associated with the PID of the configuration elements .
* @ param pid TBD
* @ param id TBD
* @ param elements The configuration elements which are to be validated .
* @ return True or false telling if the configuration elements are valid . */
public boolean validate ( RegistryEntry registryEntry , String pid , ConfigID id , List < ? extends ConfigElement > elements ) { } } | Map < String , ConfigElementList > conflictedElementLists = generateConflictMap ( registryEntry , elements ) ; if ( conflictedElementLists . isEmpty ( ) ) { return true ; } logRegistryEntry ( registryEntry ) ; String validationMessage = generateCollisionMessage ( pid , id , registryEntry , conflictedElementLists ) ; Tr . audit ( tc , "info.config.conflict" , validationMessage ) ; return false ; |
public class JPnlPropertyEditorDBMetaSchema { /** * GEN - END : initComponents */
public void setEditorTarget ( PropertyEditorTarget target ) { } } | if ( target instanceof DBMetaSchemaNode ) { super . setEditorTarget ( target ) ; this . tfSchemaName . setText ( ( String ) target . getAttribute ( DBMetaSchemaNode . ATT_SCHEMA_NAME ) ) ; } else { throw new UnsupportedOperationException ( "This editor can only edit DBSchemaCatalogNode objects" ) ; } |
public class responderpolicy { /** * Use this API to update responderpolicy resources . */
public static base_responses update ( nitro_service client , responderpolicy resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { responderpolicy updateresources [ ] = new responderpolicy [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { updateresources [ i ] = new responderpolicy ( ) ; updateresources [ i ] . name = resources [ i ] . name ; updateresources [ i ] . rule = resources [ i ] . rule ; updateresources [ i ] . action = resources [ i ] . action ; updateresources [ i ] . undefaction = resources [ i ] . undefaction ; updateresources [ i ] . comment = resources [ i ] . comment ; updateresources [ i ] . logaction = resources [ i ] . logaction ; updateresources [ i ] . appflowaction = resources [ i ] . appflowaction ; } result = update_bulk_request ( client , updateresources ) ; } return result ; |
public class TimeZoneFormat { /** * Private method returning the instance of TZDBTimeZoneNames .
* The instance if used only for parsing when { @ link ParseOption # TZ _ DATABASE _ ABBREVIATIONS }
* is enabled .
* @ return an instance of TZDBTimeZoneNames . */
private TimeZoneNames getTZDBTimeZoneNames ( ) { } } | if ( _tzdbNames == null ) { synchronized ( this ) { if ( _tzdbNames == null ) { _tzdbNames = new TZDBTimeZoneNames ( _locale ) ; } } } return _tzdbNames ; |
public class date { /** * Parse a data string into a real Date
* Note : ( e . g . " yyyy - MM - dd HH : mm : ss " )
* @ param dateString date in String format
* @ param dateFormat desired format ( e . g . " yyyy - MM - dd HH : mm : ss " )
* @ return */
public static java . util . Date parseDate ( String dateString , String dateFormat ) { } } | java . util . Date newDate = null ; try { newDate = new SimpleDateFormat ( dateFormat , Locale . ENGLISH ) . parse ( dateString ) ; } catch ( ParseException e ) { QuickUtils . log . d ( "parse error" , e ) ; } return newDate ; |
public class HealthPinger { /** * Pings the service and completes if successful - and fails if it didn ' t work
* for some reason ( reason is in the exception ) . */
private static Observable < PingServiceHealth > pingQuery ( final NetworkAddress hostname , final String bucket , final String password , final ClusterFacade core , final long timeout , final TimeUnit timeUnit ) { } } | final AtomicReference < CouchbaseRequest > request = new AtomicReference < CouchbaseRequest > ( ) ; Observable < com . couchbase . client . core . message . query . PingResponse > response = Observable . defer ( new Func0 < Observable < com . couchbase . client . core . message . query . PingResponse > > ( ) { @ Override public Observable < com . couchbase . client . core . message . query . PingResponse > call ( ) { CouchbaseRequest r ; try { r = new com . couchbase . client . core . message . query . PingRequest ( InetAddress . getByName ( hostname . address ( ) ) , bucket , password ) ; } catch ( Exception e ) { return Observable . error ( e ) ; } request . set ( r ) ; return core . send ( r ) ; } } ) . timeout ( timeout , timeUnit ) ; return mapToServiceHealth ( null , ServiceType . QUERY , response , request , timeout , timeUnit ) ; |
public class ResponseMessage { /** * @ see javax . servlet . http . HttpServletResponse # addIntHeader ( java . lang . String , int ) */
@ Override public void addIntHeader ( String hdr , int value ) { } } | this . response . addHeader ( hdr , Integer . toString ( value ) ) ; |
public class HmacSignatureBuilder { /** * 断言认证失败 . < br >
* 若认证成功 , 则抛出异常 { @ link java . lang . IllegalArgumentException } .
* @ param expectedSignature
* 传入的期望摘要
* @ param builderMode
* 采用的构建模式
* @ param errorMessage
* 自定义异常抛出的消息
* @ throws IllegalArgumentException
* 参数不合法异常
* @ author zhd
* @ since 1.0.0 */
public void assertAuthFail ( byte [ ] expectedSignature , BuilderMode builderMode , String errorMessage ) { } } | if ( isHashEquals ( expectedSignature , builderMode ) ) { if ( Validator . isEmpty ( errorMessage ) ) { throw new IllegalArgumentException ( ) ; } else { throw new IllegalArgumentException ( errorMessage ) ; } } |
public class A_CmsVfsDocument { /** * Creates a document factory lookup key for the given resource type name / MIME type configuration . < p >
* If the given < code > mimeType < / code > is < code > null < / code > , this indicates that the key should
* match all VFS resource of the given resource type regardless of the MIME type . < p >
* @ param type the resource type name to use
* @ param mimeType the MIME type to use
* @ return a document factory lookup key for the given resource id / MIME type configuration */
public static String getDocumentKey ( String type , String mimeType ) { } } | StringBuffer result = new StringBuffer ( 16 ) ; result . append ( I_CmsSearchDocument . VFS_DOCUMENT_KEY_PREFIX ) ; result . append ( '_' ) ; result . append ( type ) ; if ( mimeType != null ) { result . append ( ':' ) ; result . append ( mimeType ) ; } return result . toString ( ) ; |
public class BaseTraceFormatter { /** * Format an object for a verbose message .
* @ param obj the non - null parameter object
* @ return the reformatted object , or null if the object can be used as - is */
private Object formatVerboseObj ( Object obj ) { } } | // Make sure that we don ' t truncate any stack traces during verbose logging
if ( obj instanceof TruncatableThrowable ) { TruncatableThrowable truncatable = ( TruncatableThrowable ) obj ; final Throwable wrappedException = truncatable . getWrappedException ( ) ; return DataFormatHelper . throwableToString ( wrappedException ) ; } else if ( obj instanceof Throwable ) { return DataFormatHelper . throwableToString ( ( Throwable ) obj ) ; } return null ; |
public class FessMessages { /** * Add the created action message for the key ' success . upload _ stemmeroverride _ file ' with parameters .
* < pre >
* message : Uploaded Stemmer Override file .
* < / pre >
* @ param property The property name for the message . ( NotNull )
* @ return this . ( NotNull ) */
public FessMessages addSuccessUploadStemmeroverrideFile ( String property ) { } } | assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( SUCCESS_upload_stemmeroverride_file ) ) ; return this ; |
public class DataFileCache { /** * Renames the * . data . new file .
* @ throws HsqlException */
void renameDataFile ( boolean wasNio ) { } } | writeLock . lock ( ) ; try { if ( fa . isStreamElement ( fileName + ".new" ) ) { deleteFile ( wasNio ) ; fa . renameElement ( fileName + ".new" , fileName ) ; } } finally { writeLock . unlock ( ) ; } |
public class AsyncHttpClient { /** * 发起异步请求 , 不携带任何历史可用的头部信息
* @ param asyncRequest
* @ param asyncResponseCallback */
public void asyncRequestWithoutSession ( AsyncRequest asyncRequest , AsyncResponseCallback asyncResponseCallback ) { } } | doRequest . doRequest ( asyncRequest , false , asyncResponseCallback ) ; |
public class Version { /** * Parses the given string representation of a version into a { @ link Version } object .
* @ param version must not be { @ literal null } or empty .
* @ return returns version */
public static Version parse ( String version ) { } } | Assert . hasText ( version , "Version must not be null o empty!" ) ; String [ ] parts = version . trim ( ) . split ( "\\." ) ; int [ ] intParts = new int [ parts . length ] ; for ( int i = 0 ; i < parts . length ; i ++ ) { String input = i == parts . length - 1 ? parts [ i ] . replaceAll ( "\\D.*" , "" ) : parts [ i ] ; if ( StringUtils . hasText ( input ) ) { try { intParts [ i ] = Integer . parseInt ( input ) ; } catch ( IllegalArgumentException o_O ) { throw new IllegalArgumentException ( String . format ( VERSION_PARSE_ERROR , input , version ) , o_O ) ; } } } return new Version ( intParts ) ; |
public class ScanStream { /** * Sequentially iterate over elements in a set identified by { @ code key } . This method uses { @ code SSCAN } to perform an
* iterative scan .
* @ param commands the commands interface , must not be { @ literal null } .
* @ param key the sorted set to scan .
* @ param scanArgs the scan arguments , must not be { @ literal null } .
* @ param < K > Key type .
* @ param < V > Value type .
* @ return a new { @ link Flux } . */
public static < K , V > Flux < ScoredValue < V > > zscan ( RedisSortedSetReactiveCommands < K , V > commands , K key , ScanArgs scanArgs ) { } } | LettuceAssert . notNull ( scanArgs , "ScanArgs must not be null" ) ; return zscan ( commands , key , Optional . of ( scanArgs ) ) ; |
public class DriverFactory { /** * Generates a firefox webdriver .
* @ return
* A firefox webdriver
* @ throws TechnicalException
* if an error occured when Webdriver setExecutable to true . */
private WebDriver generateFirefoxDriver ( ) throws TechnicalException { } } | final String pathWebdriver = DriverFactory . getPath ( Driver . FIREFOX ) ; if ( ! new File ( pathWebdriver ) . setExecutable ( true ) ) { throw new TechnicalException ( Messages . getMessage ( TechnicalException . TECHNICAL_ERROR_MESSAGE_WEBDRIVER_SET_EXECUTABLE ) ) ; } logger . info ( "Generating Firefox driver ({}) ..." , pathWebdriver ) ; System . setProperty ( Driver . FIREFOX . getDriverName ( ) , pathWebdriver ) ; final FirefoxOptions firefoxOptions = new FirefoxOptions ( ) ; final FirefoxBinary firefoxBinary = new FirefoxBinary ( ) ; final DesiredCapabilities capabilities = DesiredCapabilities . firefox ( ) ; capabilities . setCapability ( CapabilityType . ForSeleniumServer . ENSURING_CLEAN_SESSION , true ) ; capabilities . setCapability ( CapabilityType . UNEXPECTED_ALERT_BEHAVIOUR , UnexpectedAlertBehaviour . ACCEPT ) ; setLoggingLevel ( capabilities ) ; // Proxy configuration
if ( Context . getProxy ( ) . getProxyType ( ) != ProxyType . UNSPECIFIED && Context . getProxy ( ) . getProxyType ( ) != ProxyType . AUTODETECT ) { capabilities . setCapability ( CapabilityType . PROXY , Context . getProxy ( ) ) ; } if ( Context . isHeadless ( ) ) { firefoxBinary . addCommandLineOptions ( "--headless" ) ; firefoxOptions . setBinary ( firefoxBinary ) ; } firefoxOptions . setLogLevel ( Level . OFF ) ; capabilities . setCapability ( FirefoxOptions . FIREFOX_OPTIONS , firefoxOptions ) ; return new FirefoxDriver ( capabilities ) ; |
public class StringUtil { /** * Remove all the multi - line comments from a block of text
* @ param text The text to remove multi - line comments from
* @ return The multi - line comment free text */
public static String stripMultiLineComments ( String text ) { } } | if ( text == null ) { return null ; } try { StringBuffer output = new StringBuffer ( ) ; // Comment rules :
/* / This is still a comment */
// Comments do not nest
// / * * / This is in a comment
// The second / / is needed to make this a comment .
// First we strip multi line comments . I think this is important :
boolean inMultiLine = false ; BufferedReader in = new BufferedReader ( new StringReader ( text ) ) ; while ( true ) { String line = in . readLine ( ) ; if ( line == null ) { break ; } if ( ! inMultiLine ) { // We are not in a multi - line comment , check for a start
int cstart = line . indexOf ( COMMENT_MULTILINE_START ) ; if ( cstart >= 0 ) { // This could be a MLC on one line . . .
int cend = line . indexOf ( COMMENT_MULTILINE_END , cstart + COMMENT_MULTILINE_START . length ( ) ) ; if ( cend >= 0 ) { // A comment that starts and ends on one line
// BUG : you can have more than 1 multi - line comment on a line
line = line . substring ( 0 , cstart ) + SPACE + line . substring ( cend + COMMENT_MULTILINE_END . length ( ) ) ; } else { // A real multi - line comment
inMultiLine = true ; line = line . substring ( 0 , cstart ) + SPACE ; } } else { // We are not in a multi line comment and we havn ' t
// started one so we are going to ignore closing
// comments even if they exist .
} } else { // We are in a multi - line comment , check for the end
int cend = line . indexOf ( COMMENT_MULTILINE_END ) ; if ( cend >= 0 ) { // End of comment
line = line . substring ( cend + COMMENT_MULTILINE_END . length ( ) ) ; inMultiLine = false ; } else { // The comment continues
line = SPACE ; } } output . append ( line ) ; output . append ( '\n' ) ; } return output . toString ( ) ; } catch ( IOException e ) { throw new IllegalArgumentException ( e ) ; } |
public class MamManager { /** * The the XMPP address of this MAM archive . Note that this method may return { @ code null } if this MamManager
* handles the local entity ' s archive and if the connection has never been authenticated at least once .
* @ return the XMPP address of this MAM archive or { @ code null } .
* @ since 4.3.0 */
public Jid getArchiveAddress ( ) { } } | if ( archiveAddress == null ) { EntityFullJid localJid = connection ( ) . getUser ( ) ; if ( localJid == null ) { return null ; } return localJid . asBareJid ( ) ; } return archiveAddress ; |
public class Encryption { /** * Sets the encryptionType
* @ param encryptionType The new encryptionType value .
* @ return This object for method chaining . */
public Encryption withEncryptionType ( SSEAlgorithm encryptionType ) { } } | setEncryptionType ( encryptionType == null ? null : encryptionType . toString ( ) ) ; return this ; |
public class ODatabaseFactory { /** * Unregisters all the database instances that share the storage received as argument .
* @ param iStorage */
public synchronized void unregister ( final OStorage iStorage ) { } } | for ( ODatabaseComplex < ? > db : new HashSet < ODatabaseComplex < ? > > ( instances . keySet ( ) ) ) { if ( db != null && db . getStorage ( ) == iStorage ) { db . close ( ) ; instances . remove ( db ) ; } } |
public class Log { /** * Send a DEBUG log message with subsystem { @ link SUBSYSTEM # MAIN } as a default one .
* @ param tag Used to identify the source of a log message . It usually identifies the class or
* activity where the log call occurs .
* @ param pattern The message pattern
* @ return */
public static void d ( String tag , String pattern , Object ... parameters ) { } } | d ( SUBSYSTEM . MAIN , tag , pattern , parameters ) ; |
public class ApiOvhHostingprivateDatabase { /** * Get this object properties
* REST : GET / hosting / privateDatabase / { serviceName } / database / { databaseName }
* @ param serviceName [ required ] The internal name of your private database
* @ param databaseName [ required ] Database name */
public OvhDatabase serviceName_database_databaseName_GET ( String serviceName , String databaseName ) throws IOException { } } | String qPath = "/hosting/privateDatabase/{serviceName}/database/{databaseName}" ; StringBuilder sb = path ( qPath , serviceName , databaseName ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhDatabase . class ) ; |
public class ChannelServiceImpl { /** * / * - - - - - 优化内容 : listAll 、 listByIds 、 findById合并 - - - - - */
public List < Channel > listByIds ( Long ... identities ) { } } | List < Channel > channels = new ArrayList < Channel > ( ) ; try { List < ChannelDO > channelDos = null ; if ( identities . length < 1 ) { channelDos = channelDao . listAll ( ) ; if ( channelDos . isEmpty ( ) ) { logger . debug ( "DEBUG ## couldn't query any channel, maybe hasn't create any channel." ) ; return channels ; } } else { channelDos = channelDao . listByMultiId ( identities ) ; if ( channelDos . isEmpty ( ) ) { String exceptionCause = "couldn't query any channel by channelIds:" + Arrays . toString ( identities ) ; logger . error ( "ERROR ## " + exceptionCause ) ; throw new ManagerException ( exceptionCause ) ; } } channels = doToModel ( channelDos ) ; } catch ( Exception e ) { logger . error ( "ERROR ## query channels has an exception!" ) ; throw new ManagerException ( e ) ; } return channels ; |
public class FileInputFormat { /** * Returns the extension of a file name ( ! = a path ) .
* @ return the extension of the file name or { @ code null } if there is no extension . */
protected static String extractFileExtension ( String fileName ) { } } | checkNotNull ( fileName ) ; int lastPeriodIndex = fileName . lastIndexOf ( '.' ) ; if ( lastPeriodIndex < 0 ) { return null ; } else { return fileName . substring ( lastPeriodIndex + 1 ) ; } |
public class TAEnabledRandomAccessFile { /** * reads the next length bytes starting form the current file position .
* If there are not enough bytes available ( from the current position to the visible end of the file ) to read the data an exception is thrown .
* overflow ( position is beyond committed data ) , is
* kopiert den Bereich zwischen startPosition und enedPosition der Datei in den ByteBuffer .
* Es wird die Read - methode des RandomAccessFiles genommen , da sich
* herausgestellt hat , dass die Methode im Batchbetrieb etwas schneller
* ist als die Channel - methode .
* Ee werden bytes gelesen fuer die gilt :
* startPosition & le ; b & lt ; endPosition
* @ param length umber of bytes to be read
* @ return content
* @ throws java . io . IOException IO Error */
public byte [ ] read ( int length ) throws IOException { } } | check ( ) ; checkRead ( length ) ; if ( length >= Integer . MAX_VALUE ) { throw new IOException ( "Length of read area may not exceed " + Integer . MAX_VALUE ) ; } if ( this . position ( ) + length > this . getCommittedSize ( ) ) { throw new IOException ( "Length of read area may not exceed the committed size of " + this . getCommittedSize ( ) ) ; } int intLength = Long . valueOf ( length ) . intValue ( ) ; byte [ ] buffer = new byte [ intLength ] ; if ( isClose ( ) ) { throw new IOException ( "TAEnabledChanneList ist closed" ) ; } long retVal = this . getRandomAccessFile ( ) . read ( buffer , 0 , intLength ) ; if ( retVal < 0 ) { throw new IOException ( "Channel cannot read " + ( position ( ) + intLength ) ) ; } return buffer ; |
public class Instruction { /** * Return the direction like ' NE ' based on the first tracksegment of the instruction . If
* Instruction does not contain enough coordinate points , an empty string will be returned . */
public String calcDirection ( Instruction nextI ) { } } | double azimuth = calcAzimuth ( nextI ) ; if ( Double . isNaN ( azimuth ) ) return "" ; return AC . azimuth2compassPoint ( azimuth ) ; |
public class CypherFormatterUtils { /** * - - - - properties - - - - */
public static String formatNodeProperties ( String id , Node node , Map < String , Set < String > > uniqueConstraints , Set < String > indexNames , boolean jsonStyle ) { } } | StringBuilder result = formatProperties ( id , node . getAllProperties ( ) , jsonStyle ) ; if ( getNodeIdLabels ( node , uniqueConstraints , indexNames ) . endsWith ( label ( UNIQUE_ID_LABEL ) ) ) { result . append ( ", " ) ; result . append ( formatPropertyName ( id , UNIQUE_ID_PROP , node . getId ( ) , jsonStyle ) ) ; } return result . length ( ) > 0 ? result . substring ( 2 ) : "" ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcEngineType ( ) { } } | if ( ifcEngineTypeEClass == null ) { ifcEngineTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 234 ) ; } return ifcEngineTypeEClass ; |
public class EntityFilter { /** * A map of entity tags attached to the affected entity .
* @ param tags
* A map of entity tags attached to the affected entity .
* @ return Returns a reference to this object so that method calls can be chained together . */
public EntityFilter withTags ( java . util . Collection < java . util . Map < String , String > > tags ) { } } | setTags ( tags ) ; return this ; |
public class HeaderFooterGridView { /** * Removes a previously - added footer view .
* @ param v The view to remove
* @ return true if the view was removed , false if the view was not a footer view */
public boolean removeFooterView ( View v ) { } } | if ( mFooterViewInfos . size ( ) > 0 ) { boolean result = false ; ListAdapter adapter = getAdapter ( ) ; if ( adapter != null && ( ( HeaderFooterViewGridAdapter ) adapter ) . removeFooter ( v ) ) { result = true ; } removeFixedViewInfo ( v , mFooterViewInfos ) ; return result ; } return false ; |
public class RelationalOperations { /** * segments of _ multipathB . */
private static boolean linearPathIntersectsLinearPath_ ( MultiPath multipathA , MultiPath multipathB , double tolerance ) { } } | MultiPathImpl multi_path_impl_a = ( MultiPathImpl ) multipathA . _getImpl ( ) ; MultiPathImpl multi_path_impl_b = ( MultiPathImpl ) multipathB . _getImpl ( ) ; SegmentIteratorImpl segIterA = multi_path_impl_a . querySegmentIterator ( ) ; SegmentIteratorImpl segIterB = multi_path_impl_b . querySegmentIterator ( ) ; PairwiseIntersectorImpl intersector = new PairwiseIntersectorImpl ( multi_path_impl_a , multi_path_impl_b , tolerance , false ) ; while ( intersector . next ( ) ) { int vertex_a = intersector . getRedElement ( ) ; int vertex_b = intersector . getBlueElement ( ) ; segIterA . resetToVertex ( vertex_a ) ; segIterB . resetToVertex ( vertex_b ) ; Segment segmentA = segIterA . nextSegment ( ) ; Segment segmentB = segIterB . nextSegment ( ) ; int result = segmentB . intersect ( segmentA , null , null , null , tolerance ) ; if ( result > 0 ) { return true ; } } return false ; |
public class SmartBinder { /** * Create a new SmartBinder from the given Signature , using the given
* Lookup for any handle lookups .
* @ param lookup the Lookup to use for handle lookups
* @ param inbound the Signature to start from
* @ return a new SmartBinder */
public static SmartBinder from ( Lookup lookup , Signature inbound ) { } } | return new SmartBinder ( inbound , Binder . from ( lookup , inbound . type ( ) ) ) ; |
public class TextProcessorAdapter { /** * Process the text
* @ param source the sourcetext
* @ return the result of text processing */
public StringBuffer process ( StringBuffer source ) { } } | CharSequence result = process ( ( CharSequence ) source ) ; if ( result instanceof StringBuffer ) { return ( StringBuffer ) result ; } else { return new StringBuffer ( result ) ; } |
public class TokenAuthenticationHandler { /** * Convert secret to bytes honoring { @ link RegisteredServiceProperty . RegisteredServiceProperties # TOKEN _ SECRETS _ ARE _ BASE64 _ ENCODED }
* config parameter .
* @ param secret - String to be represented to byte [ ]
* @ param secretIsBase64Encoded - is this a base64 encoded # secret ?
* @ return byte [ ] representation of # secret */
private static byte [ ] getSecretBytes ( final String secret , final boolean secretIsBase64Encoded ) { } } | return secretIsBase64Encoded ? new Base64 ( secret ) . decode ( ) : secret . getBytes ( UTF_8 ) ; |
public class SpotifyApi { /** * Check if a track is saved in the users " Your Music " library .
* @ param ids The tracks IDs to check for in the user ' s Your Music library . Maximum : 50 IDs .
* @ return A { @ link CheckUsersSavedAlbumsRequest . Builder } .
* @ see < a href = " https : / / developer . spotify . com / web - api / user - guide / # spotify - uris - and - ids " > Spotify : URLs & amp ; IDs < / a > */
public CheckUsersSavedAlbumsRequest . Builder checkUsersSavedAlbums ( String ... ids ) { } } | return new CheckUsersSavedAlbumsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . ids ( concat ( ids , ',' ) ) ; |
public class Queue { /** * Replace current queue alerts with a given list of alerts . If there is no queue , an EmptyQueueException is thrown .
* @ param alerts The array list of alerts .
* @ throws io . iron . ironmq . HTTPException If the IronMQ service returns a status other than 200 OK .
* @ throws java . io . IOException If there is an error accessing the IronMQ server . */
public QueueModel updateAlerts ( ArrayList < Alert > alerts ) throws IOException { } } | QueueModel payload = new QueueModel ( alerts ) ; return this . update ( payload ) ; |
public class DateUtil { /** * 减一秒 . */
public static Date subSeconds ( @ NotNull final Date date , int amount ) { } } | return DateUtils . addSeconds ( date , - amount ) ; |
public class Sources { /** * Search class loader tree for resource , current implementation
* attempts up to 10 levels of nested class loaders .
* @ param startLoader class loader to start from
* @ param resourceName the resource name on class path
* @ return A { @ link URL } object for reading the resource
* @ throws java . lang . IllegalArgumentException if the resource could not be found
* or the invoker doesn ' t have adequate privileges to get the resource
* @ see java . lang . ClassLoader # getResource ( String ) */
public static URL getDeepResource ( ClassLoader startLoader , String resourceName ) { } } | ClassLoader currentLoader = checkNotNull ( startLoader ) ; URL url = currentLoader . getResource ( checkNotEmpty ( resourceName ) ) ; int attempts = 0 ; while ( url == null && attempts < 10 ) { // search the class loader tree
currentLoader = currentLoader . getParent ( ) ; attempts += 1 ; // no inspection ConstantConditions
if ( currentLoader == null ) { break ; // we are at the bootstrap class loader
} url = currentLoader . getResource ( resourceName ) ; } checkArgument ( url != null , "resource %s not found for the context class loader %s" , resourceName , startLoader ) ; return url ; |
public class Session { /** * / * ( non - Javadoc )
* @ see java . lang . Thread # run ( ) */
public synchronized void run ( ) { } } | while ( true ) { try { if ( incoming == null ) { wait ( ) ; } System . out . println ( "Socket opening ..." ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( incoming . getInputStream ( ) , "UTF-8" ) ) ; // PrintStream out = ( PrintStream ) incoming . getOutputStream ( ) ;
BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( incoming . getOutputStream ( ) , "UTF-8" ) ) ; String content = "" ; while ( true ) { int ch = in . read ( ) ; if ( ch == 0 ) // end of string
break ; content += ( char ) ch ; } // System . out . println ( content ) ;
String tagged = textpro . process ( content ) ; // Thread . sleep ( 4000 ) ;
out . write ( tagged . trim ( ) ) ; out . write ( ( char ) 0 ) ; out . flush ( ) ; } catch ( InterruptedIOException e ) { System . out . println ( "The conection is interrupted" ) ; } catch ( Exception e ) { System . out . println ( e ) ; e . printStackTrace ( ) ; } // update pool
// go back in wait queue if there is fewer than max
this . setSocket ( null ) ; Vector < Session > pool = TaggingService . pool ; synchronized ( pool ) { if ( pool . size ( ) >= TaggingService . maxNSession ) { /* too many threads , exit this one */
return ; } else { pool . addElement ( this ) ; } } } |
public class PBKDF { /** * Implementation of PBKDF2 ( RFC2898 ) .
* @ param alg HMAC algorithm to use .
* @ param P Password .
* @ param S Salt .
* @ param c Iteration count .
* @ param dkLen Intended length , in octets , of the derived key .
* @ return The derived key .
* @ throws GeneralSecurityException */
public static byte [ ] pbkdf2 ( String alg , byte [ ] P , byte [ ] S , int c , int dkLen ) throws GeneralSecurityException { } } | Mac mac = Mac . getInstance ( alg ) ; mac . init ( new SecretKeySpec ( P , alg ) ) ; byte [ ] DK = new byte [ dkLen ] ; pbkdf2 ( mac , S , c , DK , dkLen ) ; return DK ; |
public class SubmitJobRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SubmitJobRequest submitJobRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( submitJobRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( submitJobRequest . getJobName ( ) , JOBNAME_BINDING ) ; protocolMarshaller . marshall ( submitJobRequest . getJobQueue ( ) , JOBQUEUE_BINDING ) ; protocolMarshaller . marshall ( submitJobRequest . getArrayProperties ( ) , ARRAYPROPERTIES_BINDING ) ; protocolMarshaller . marshall ( submitJobRequest . getDependsOn ( ) , DEPENDSON_BINDING ) ; protocolMarshaller . marshall ( submitJobRequest . getJobDefinition ( ) , JOBDEFINITION_BINDING ) ; protocolMarshaller . marshall ( submitJobRequest . getParameters ( ) , PARAMETERS_BINDING ) ; protocolMarshaller . marshall ( submitJobRequest . getContainerOverrides ( ) , CONTAINEROVERRIDES_BINDING ) ; protocolMarshaller . marshall ( submitJobRequest . getNodeOverrides ( ) , NODEOVERRIDES_BINDING ) ; protocolMarshaller . marshall ( submitJobRequest . getRetryStrategy ( ) , RETRYSTRATEGY_BINDING ) ; protocolMarshaller . marshall ( submitJobRequest . getTimeout ( ) , TIMEOUT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CliClient { /** * Execute a CLI Statement */
public void executeCLIStatement ( String statement ) throws CharacterCodingException , TException , TimedOutException , NotFoundException , NoSuchFieldException , InvalidRequestException , UnavailableException , InstantiationException , IllegalAccessException { } } | Tree tree = CliCompiler . compileQuery ( statement ) ; try { switch ( tree . getType ( ) ) { case CliParser . NODE_EXIT : cleanupAndExit ( ) ; break ; case CliParser . NODE_THRIFT_GET : executeGet ( tree ) ; break ; case CliParser . NODE_THRIFT_GET_WITH_CONDITIONS : executeGetWithConditions ( tree ) ; break ; case CliParser . NODE_HELP : executeHelp ( tree ) ; break ; case CliParser . NODE_THRIFT_SET : executeSet ( tree ) ; break ; case CliParser . NODE_THRIFT_DEL : executeDelete ( tree ) ; break ; case CliParser . NODE_THRIFT_COUNT : executeCount ( tree ) ; break ; case CliParser . NODE_ADD_KEYSPACE : executeAddKeySpace ( tree . getChild ( 0 ) ) ; break ; case CliParser . NODE_ADD_COLUMN_FAMILY : executeAddColumnFamily ( tree . getChild ( 0 ) ) ; break ; case CliParser . NODE_UPDATE_KEYSPACE : executeUpdateKeySpace ( tree . getChild ( 0 ) ) ; break ; case CliParser . NODE_UPDATE_COLUMN_FAMILY : executeUpdateColumnFamily ( tree . getChild ( 0 ) ) ; break ; case CliParser . NODE_DEL_COLUMN_FAMILY : executeDelColumnFamily ( tree ) ; break ; case CliParser . NODE_DEL_KEYSPACE : executeDelKeySpace ( tree ) ; break ; case CliParser . NODE_SHOW_CLUSTER_NAME : executeShowClusterName ( ) ; break ; case CliParser . NODE_SHOW_VERSION : executeShowVersion ( ) ; break ; case CliParser . NODE_SHOW_KEYSPACES : executeShowKeySpaces ( ) ; break ; case CliParser . NODE_SHOW_SCHEMA : executeShowSchema ( tree ) ; break ; case CliParser . NODE_DESCRIBE : executeDescribe ( tree ) ; break ; case CliParser . NODE_DESCRIBE_CLUSTER : executeDescribeCluster ( ) ; break ; case CliParser . NODE_USE_TABLE : executeUseKeySpace ( tree ) ; break ; case CliParser . NODE_TRACE_NEXT_QUERY : executeTraceNextQuery ( ) ; break ; case CliParser . NODE_CONNECT : executeConnect ( tree ) ; break ; case CliParser . NODE_LIST : executeList ( tree ) ; break ; case CliParser . NODE_TRUNCATE : executeTruncate ( tree . getChild ( 0 ) . getText ( ) ) ; break ; case CliParser . NODE_ASSUME : executeAssumeStatement ( tree ) ; break ; case CliParser . NODE_CONSISTENCY_LEVEL : executeConsistencyLevelStatement ( tree ) ; break ; case CliParser . NODE_THRIFT_INCR : executeIncr ( tree , 1L ) ; break ; case CliParser . NODE_THRIFT_DECR : executeIncr ( tree , - 1L ) ; break ; case CliParser . NODE_DROP_INDEX : executeDropIndex ( tree ) ; break ; case CliParser . NODE_NO_OP : // comment lines come here ; they are treated as no ops .
break ; default : sessionState . err . println ( "Invalid Statement (Type: " + tree . getType ( ) + ")" ) ; if ( sessionState . batch ) System . exit ( 2 ) ; break ; } } catch ( SchemaDisagreementException e ) { throw new RuntimeException ( "schema does not match across nodes, (try again later)." , e ) ; } |
public class TypeUtils { /** * Append a space if necessary ( if not at the beginning of the buffer , and the last character is not already a
* space ) , then append a modifier keyword .
* @ param buf
* the buf
* @ param modifierKeyword
* the modifier keyword */
private static void appendModifierKeyword ( final StringBuilder buf , final String modifierKeyword ) { } } | if ( buf . length ( ) > 0 && buf . charAt ( buf . length ( ) - 1 ) != ' ' ) { buf . append ( ' ' ) ; } buf . append ( modifierKeyword ) ; |
public class LocalDObjectMgr { /** * Creates a { @ link DObjectManager } that posts directly to this local object manager , but first
* sets the source oid of all events to properly identify them with the supplied client oid .
* Normally this oid setting happens when an event is received on the server over the network ,
* but in local mode we have to do it by hand . */
public DObjectManager getClientDObjectMgr ( final int clientOid ) { } } | return new DObjectManager ( ) { public boolean isManager ( DObject object ) { return LocalDObjectMgr . this . isManager ( object ) ; } public < T extends DObject > void subscribeToObject ( int oid , Subscriber < T > target ) { LocalDObjectMgr . this . subscribeToObject ( oid , target ) ; } public < T extends DObject > void unsubscribeFromObject ( int oid , Subscriber < T > target ) { LocalDObjectMgr . this . unsubscribeFromObject ( oid , target ) ; } public void postEvent ( DEvent event ) { event . setSourceOid ( clientOid ) ; LocalDObjectMgr . this . postEvent ( event ) ; } public void removedLastSubscriber ( DObject obj , boolean deathWish ) { LocalDObjectMgr . this . removedLastSubscriber ( obj , deathWish ) ; } } ; |
public class OIDValueSelect { /** * { @ inheritDoc } */
@ Override public Object getValue ( final Object _object ) throws EFapsException { } } | final StringBuilder bldr = new StringBuilder ( ) ; boolean retNull = false ; if ( _object instanceof Object [ ] ) { final Object [ ] object = ( Object [ ] ) _object ; if ( object [ 0 ] == null || object [ 1 ] == null ) { retNull = true ; } else { bldr . append ( object [ 1 ] ) . append ( "." ) . append ( object [ 0 ] ) ; } } else { if ( _object == null ) { retNull = true ; } else { bldr . append ( this . type . getId ( ) ) . append ( "." ) . append ( _object ) ; } } return retNull ? null : bldr . toString ( ) ; |
public class StringUtil { /** * Appends the given String to all elements of the given array .
* @ param append must not be < code > null < / code > .
* @ param appendTo must not be < code > null < / code > .
* @ return a new array with all elements of the old array concatenated with the given string . */
public static String [ ] appendToAll ( String append , String [ ] appendTo ) { } } | if ( append == null ) { throw new IllegalArgumentException ( "Method argument append must not be null." ) ; } if ( appendTo == null ) { throw new IllegalArgumentException ( "Method argument to must not be null." ) ; } String [ ] result = new String [ appendTo . length ] ; for ( int i = 0 ; i < appendTo . length ; ++ i ) { result [ i ] = appendTo [ i ] == null ? null : appendTo [ i ] + append ; } return result ; |
public class BaseSparseNDArrayCOO { /** * Check that the length of indices and values are coherent and matches the rank of the matrix . */
protected void checkBufferCoherence ( ) { } } | if ( values . length ( ) < length ) { throw new IllegalStateException ( "nnz is larger than capacity of buffers" ) ; } if ( values . length ( ) * rank ( ) != indices . length ( ) ) { throw new IllegalArgumentException ( "Sizes of values, indices and shape are incoherent." ) ; } |
public class DefaultDecomposer { /** * ( non - Javadoc )
* @ see org . jsmpp . util . PDUDecomposer # unbind ( byte [ ] ) */
public Unbind unbind ( byte [ ] b ) { } } | Unbind req = new Unbind ( ) ; assignHeader ( req , b ) ; return req ; |
public class DRL5Expressions { /** * src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 608:1 : createdName : ( ID ( typeArguments ) ? ( DOT ID ( typeArguments ) ? ) * | primitiveType ) ; */
public final void createdName ( ) throws RecognitionException { } } | try { // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 609:5 : ( ID ( typeArguments ) ? ( DOT ID ( typeArguments ) ? ) * | primitiveType )
int alt71 = 2 ; int LA71_0 = input . LA ( 1 ) ; if ( ( LA71_0 == ID ) ) { int LA71_1 = input . LA ( 2 ) ; if ( ( ! ( ( ( ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . SHORT ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . LONG ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . BOOLEAN ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . BYTE ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . FLOAT ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . DOUBLE ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . INT ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . CHAR ) ) ) ) ) ) ) ) { alt71 = 1 ; } else if ( ( ( ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . SHORT ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . LONG ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . BOOLEAN ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . BYTE ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . FLOAT ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . DOUBLE ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . INT ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . CHAR ) ) ) ) ) ) { alt71 = 2 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } int nvaeMark = input . mark ( ) ; try { input . consume ( ) ; NoViableAltException nvae = new NoViableAltException ( "" , 71 , 1 , input ) ; throw nvae ; } finally { input . rewind ( nvaeMark ) ; } } } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } NoViableAltException nvae = new NoViableAltException ( "" , 71 , 0 , input ) ; throw nvae ; } switch ( alt71 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 609:7 : ID ( typeArguments ) ? ( DOT ID ( typeArguments ) ? ) *
{ match ( input , ID , FOLLOW_ID_in_createdName3476 ) ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 609:10 : ( typeArguments ) ?
int alt68 = 2 ; int LA68_0 = input . LA ( 1 ) ; if ( ( LA68_0 == LESS ) ) { alt68 = 1 ; } switch ( alt68 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 609:10 : typeArguments
{ pushFollow ( FOLLOW_typeArguments_in_createdName3478 ) ; typeArguments ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 610:9 : ( DOT ID ( typeArguments ) ? ) *
loop70 : while ( true ) { int alt70 = 2 ; int LA70_0 = input . LA ( 1 ) ; if ( ( LA70_0 == DOT ) ) { alt70 = 1 ; } switch ( alt70 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 610:11 : DOT ID ( typeArguments ) ?
{ match ( input , DOT , FOLLOW_DOT_in_createdName3491 ) ; if ( state . failed ) return ; match ( input , ID , FOLLOW_ID_in_createdName3493 ) ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 610:18 : ( typeArguments ) ?
int alt69 = 2 ; int LA69_0 = input . LA ( 1 ) ; if ( ( LA69_0 == LESS ) ) { alt69 = 1 ; } switch ( alt69 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 610:18 : typeArguments
{ pushFollow ( FOLLOW_typeArguments_in_createdName3495 ) ; typeArguments ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } } break ; default : break loop70 ; } } } break ; case 2 : // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 611:11 : primitiveType
{ pushFollow ( FOLLOW_primitiveType_in_createdName3510 ) ; primitiveType ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } } catch ( RecognitionException re ) { throw re ; } finally { // do for sure before leaving
} |
public class Submitter { /** * Set the configuration , if it doesn ' t already have a value for the given
* key .
* @ param conf the configuration to modify
* @ param key the key to set
* @ param value the new " default " value to set */
private static void setIfUnset ( JobConf conf , String key , String value ) { } } | if ( conf . get ( key ) == null ) { conf . set ( key , value ) ; } |
public class YamlFileNetworkTopologySnitch { /** * Called in preparation for the initiation of the gossip loop . */
@ Override public synchronized void gossiperStarting ( ) { } } | gossiperInitialized = true ; StorageService . instance . gossipSnitchInfo ( ) ; Gossiper . instance . register ( new ReconnectableSnitchHelper ( this , localNodeData . datacenter , true ) ) ; |
public class ReplicatedTree { /** * Prints a representation of the node defined by { @ code fqn } . Output includes name , fqn and
* data . */
public String print ( String fqn ) { } } | Node n = findNode ( fqn ) ; if ( n == null ) return null ; return n . toString ( ) ; |
public class CmsDetailPageTable { /** * Moves the detail page information for a given page to the front of the detail pages for the same type . < p >
* @ param id a page id
* @ return the original position of the detail page entry in the list for the same type */
public int bump ( CmsUUID id ) { } } | CmsDetailPageInfo info = m_infoById . get ( id ) ; if ( info == null ) { throw new IllegalArgumentException ( ) ; } String type = info . getType ( ) ; List < CmsDetailPageInfo > infos = m_map . get ( type ) ; int oldPos = infos . indexOf ( info ) ; infos . remove ( oldPos ) ; infos . add ( 0 , info ) ; return oldPos ; |
public class TopLevelDomainsInner { /** * Gets all legal agreements that user needs to accept before purchasing a domain .
* Gets all legal agreements that user needs to accept before purchasing a domain .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; TldLegalAgreementInner & gt ; object */
public Observable < ServiceResponse < Page < TldLegalAgreementInner > > > listAgreementsNextWithServiceResponseAsync ( final String nextPageLink ) { } } | return listAgreementsNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < TldLegalAgreementInner > > , Observable < ServiceResponse < Page < TldLegalAgreementInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < TldLegalAgreementInner > > > call ( ServiceResponse < Page < TldLegalAgreementInner > > page ) { String nextPageLink = page . body ( ) . nextPageLink ( ) ; if ( nextPageLink == null ) { return Observable . just ( page ) ; } return Observable . just ( page ) . concatWith ( listAgreementsNextWithServiceResponseAsync ( nextPageLink ) ) ; } } ) ; |
public class AdminDictStemmeroverrideAction { @ Execute public HtmlResponse downloadpage ( final String dictId ) { } } | saveToken ( ) ; return asHtml ( path_AdminDictStemmeroverride_AdminDictStemmeroverrideDownloadJsp ) . useForm ( DownloadForm . class , op -> { op . setup ( form -> { form . dictId = dictId ; } ) ; } ) . renderWith ( data -> { stemmerOverrideService . getStemmerOverrideFile ( dictId ) . ifPresent ( file -> { RenderDataUtil . register ( data , "path" , file . getPath ( ) ) ; } ) . orElse ( ( ) -> { throwValidationError ( messages -> messages . addErrorsFailedToDownloadStemmeroverrideFile ( GLOBAL ) , ( ) -> asDictIndexHtml ( ) ) ; } ) ; } ) ; |
public class BDIImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setIndxName ( String newIndxName ) { } } | String oldIndxName = indxName ; indxName = newIndxName ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . BDI__INDX_NAME , oldIndxName , indxName ) ) ; |
public class ExecuteAsUser { /** * API to execute a command on behalf of another user .
* @ param user The proxy user
* @ param command the list containing the program and its arguments
* @ return The return value of the shell command */
public int execute ( final String user , final List < String > command ) throws IOException { } } | log . info ( "Command: " + command ) ; final Process process = new ProcessBuilder ( ) . command ( constructExecuteAsCommand ( user , command ) ) . inheritIO ( ) . start ( ) ; int exitCode ; try { exitCode = process . waitFor ( ) ; } catch ( final InterruptedException e ) { log . error ( e . getMessage ( ) , e ) ; exitCode = 1 ; } return exitCode ; |
public class PrivateRootActor { @ Override public void inform ( Throwable throwable , Supervised supervised ) { } } | logger ( ) . log ( "PrivateRootActor: Failure of: " + supervised . address ( ) + " because: " + throwable . getMessage ( ) + " Action: Stopping." , throwable ) ; supervised . stop ( strategy . scope ( ) ) ; |
public class RuntimeProvider { /** * Creates a formatter for { @ link Timestamp Timestamps } .
* @ param pattern
* Format pattern that is compatible with { @ link DateTimeFormatter }
* @ param locale
* Locale for formatting
* @ return Formatter for formatting timestamps */
public static TimestampFormatter createTimestampFormatter ( final String pattern , final Locale locale ) { } } | return dialect . createTimestampFormatter ( pattern , locale ) ; |
public class ErrorRootCauseMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ErrorRootCause errorRootCause , ProtocolMarshaller protocolMarshaller ) { } } | if ( errorRootCause == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( errorRootCause . getServices ( ) , SERVICES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.