signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class NDArrayIndex { /** * Add indexes for the given shape * @ param shape the shape ot convert to indexes * @ return the indexes for the given shape */ public static INDArrayIndex [ ] indexesFor ( long ... shape ) { } }
INDArrayIndex [ ] ret = new INDArrayIndex [ shape . length ] ; for ( int i = 0 ; i < shape . length ; i ++ ) { ret [ i ] = NDArrayIndex . point ( shape [ i ] ) ; } return ret ;
public class JsonService { private static void checkArguments ( JSONObject jsonObject , String key ) throws JSONException { } }
if ( key == null ) { throw new IllegalArgumentException ( "Can't go searching for a null key." ) ; } if ( jsonObject == null ) { throw new JSONException ( "Can't search for key '" + key + "' in a null object." ) ; } if ( ! jsonObject . containsKey ( key ) ) { throw new JSONException ( "Key '" + key + "' could not be found." ) ; } // Please , proceed . . .
public class SimpleKeyComponent { @ Override public ColumnBinding createReferenceBinding ( Facet referencingFacet , NamingStrategy strategy ) { } }
SubFacet sub = new SubFacet ( referencingFacet , getFacet ( ) , false ) ; return new SimpleFacetBinding ( sub , strategy . getColumnName ( sub ) , getConverter ( ) ) ;
public class Loader { /** * Handle the sequence with its screen until no more sequence to run . * @ param config The configuration used . * @ param sequenceClass The the next sequence to start . * @ param arguments The sequence arguments list if needed by its constructor . * @ throws LionEngineException If an exception occurred . */ private static void handle ( Config config , Class < ? extends Sequencable > sequenceClass , Object ... arguments ) { } }
final Screen screen = Graphics . createScreen ( config ) ; try { screen . start ( ) ; screen . awaitReady ( ) ; final Context context = new ContextWrapper ( screen ) ; Sequencable nextSequence = UtilSequence . create ( sequenceClass , context , arguments ) ; while ( nextSequence != null ) { final Sequencable sequence = nextSequence ; final String sequenceName = sequence . getClass ( ) . getName ( ) ; Verbose . info ( SEQUENCE_START , sequenceName ) ; sequence . start ( screen ) ; Verbose . info ( SEQUENCE_END , sequenceName ) ; nextSequence = sequence . getNextSequence ( ) ; sequence . onTerminated ( nextSequence != null ) ; } } finally { screen . dispose ( ) ; }
public class DefaultFastFileStorageClient { /** * 删除文件 */ @ Override public void deleteFile ( String filePath ) { } }
StorePath storePath = StorePath . parseFromUrl ( filePath ) ; super . deleteFile ( storePath . getGroup ( ) , storePath . getPath ( ) ) ;
public class MyX509TrustManager { /** * Delegate to the default trust manager . */ public void checkServerTrusted ( X509Certificate [ ] chain , String authType ) throws CertificateException { } }
try { pkixTrustManager . checkServerTrusted ( chain , authType ) ; } catch ( CertificateException excep ) { /* * Possibly pop up a dialog box asking whether to trust the * cert chain . */ }
public class BitsUtil { /** * Set bit number " off " in v . * Low - endian layout for the array . * @ param v Buffer * @ param off Offset to set */ public static long [ ] setI ( long [ ] v , int off ) { } }
final int wordindex = off >>> LONG_LOG2_SIZE ; v [ wordindex ] |= ( 1L << off ) ; return v ;
public class snmp_view { /** * < pre > * Use this operation to get SNMP View details . * < / pre > */ public static snmp_view [ ] get ( nitro_service client ) throws Exception { } }
snmp_view resource = new snmp_view ( ) ; resource . validate ( "get" ) ; return ( snmp_view [ ] ) resource . get_resources ( client ) ;
public class BigComplex { /** * Calculates the addition of the given complex value to this complex number . * < p > This methods < strong > does not < / strong > modify this instance . < / p > * @ param value the { @ link BigComplex } value to add * @ return the calculated { @ link BigComplex } result */ public BigComplex add ( BigComplex value ) { } }
return valueOf ( re . add ( value . re ) , im . add ( value . im ) ) ;
public class MappedBytes { /** * Allocates a mapped buffer in { @ link java . nio . channels . FileChannel . MapMode # READ _ WRITE } mode . * Memory will be mapped by opening and expanding the given { @ link java . io . File } to the desired { @ code count } and mapping the * file contents into memory via { @ link java . nio . channels . FileChannel # map ( java . nio . channels . FileChannel . MapMode , long , long ) } . * @ param file The file to map into memory . If the file doesn ' t exist it will be automatically created . * @ param size The count of the buffer to allocate ( in bytes ) . * @ return The mapped buffer . * @ throws NullPointerException If { @ code file } is { @ code null } * @ throws IllegalArgumentException If { @ code count } is greater than { @ link MappedMemory # MAX _ SIZE } * @ see # allocate ( java . io . File , java . nio . channels . FileChannel . MapMode , long ) */ public static MappedBytes allocate ( File file , long size ) { } }
return allocate ( file , FileChannel . MapMode . READ_WRITE , size ) ;
public class AbstractCheckedFuture { /** * { @ inheritDoc } * < p > This implementation calls { @ link # get ( ) } and maps that method ' s standard * exceptions to instances of type { @ code X } using { @ link # mapException } . * < p > In addition , if { @ code get } throws an { @ link InterruptedException } , this * implementation will set the current thread ' s interrupt status before * calling { @ code mapException } . * @ throws X if { @ link # get ( ) } throws an { @ link InterruptedException } , * { @ link CancellationException } , or { @ link ExecutionException } */ @ Override public V checkedGet ( ) throws X { } }
try { return get ( ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw mapException ( e ) ; } catch ( CancellationException e ) { throw mapException ( e ) ; } catch ( ExecutionException e ) { throw mapException ( e ) ; }
public class WorkStealingQueue { /** * Executes the given task in the future . * Queues the task and notifies the waiting thread . Also it makes * the Work assigner to wait if the queued task reaches to threshold */ @ SuppressWarnings ( "unchecked" ) public boolean execute ( Runnable r ) { } }
try { queue [ queue_no ++ % nThreads ] . putFirst ( r ) ; if ( queue_no == nThreads ) { queue_no = 0 ; } return true ; } catch ( InterruptedException e ) { String info = "Failed to enqueue task: " ; Throwable baseCause = org . gautelis . vopn . lang . Stacktrace . getBaseCause ( e ) ; info += baseCause . getMessage ( ) ; log . warn ( info , e ) ; } return false ;
public class LanguageAlchemyEntity { /** * Set number of persons who natively speak the detected language . * Based on the wikipedia page there will be no fewer than 1 million speakers . * Based on results from calling the alchemy api this will be a string in the * format : * 6.45 million * 105 million * 309-400 million * @ param numberOfNativeSpeakers number of persons who natively speak the detected language * @ see < a href = " https : / / en . wikipedia . org / wiki / List _ of _ languages _ by _ number _ of _ native _ speakers " > https : / / en . wikipedia . org / wiki / List _ of _ languages _ by _ number _ of _ native _ speakers < / a > */ public void setNumberOfNativeSpeakers ( String numberOfNativeSpeakers ) { } }
if ( numberOfNativeSpeakers != null ) { numberOfNativeSpeakers = numberOfNativeSpeakers . trim ( ) ; } this . numberOfNativeSpeakers = numberOfNativeSpeakers ; setMinimumNumberOfNativeSpeakers ( NumberUtil . minimumFromRange ( numberOfNativeSpeakers ) ) ; setMaximumNumberOfNativeSpeakers ( NumberUtil . maximumFromRange ( numberOfNativeSpeakers ) ) ;
public class BingVideosImpl { /** * The Video Search API lets you send a search query to Bing and get back a list of videos that are relevant to the search query . This section provides technical details about the query parameters and headers that you use to request videos and the JSON response objects that contain them . For examples that show how to make requests , see [ Searching the Web for Videos ] ( https : / / docs . microsoft . com / azure / cognitive - services / bing - video - search / search - the - web ) . * @ param query The user ' s search query string . The query string cannot be empty . The query string may contain [ Bing Advanced Operators ] ( http : / / msdn . microsoft . com / library / ff795620 . aspx ) . For example , to limit videos to a specific domain , use the [ site : ] ( http : / / msdn . microsoft . com / library / ff795613 . aspx ) operator . Use this parameter only with the Video Search API . Do not specify this parameter when calling the Trending Videos API . * @ param searchOptionalParameter the object representing the optional parameters to be set before calling this API * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the VideosModel object */ public Observable < VideosModel > searchAsync ( String query , SearchOptionalParameter searchOptionalParameter ) { } }
return searchWithServiceResponseAsync ( query , searchOptionalParameter ) . map ( new Func1 < ServiceResponse < VideosModel > , VideosModel > ( ) { @ Override public VideosModel call ( ServiceResponse < VideosModel > response ) { return response . body ( ) ; } } ) ;
public class OptionInjector { /** * Invokes the methodss annotated with { @ link PostInject } on the target and its injected option . * @ param target * the target to invoke the post inject methods * @ param < T > */ private < T > void preFlightCheck ( final T target ) { } }
if ( target == null ) { return ; } preFlightCheckFields ( target ) ; final List < Method > methods = getPostInjectMethods ( target ) ; preFlightCheckMethods ( target , methods ) ;
public class EventHandler { /** * Push an event with a set of attribute pairs . * @ param eventName The name of the event * @ param eventActions A { @ link HashMap } , with keys as strings , and values as { @ link String } , * { @ link Integer } , { @ link Long } , { @ link Boolean } , { @ link Float } , { @ link Double } , * { @ link java . util . Date } , or { @ link Character } * @ deprecated use { @ link CleverTapAPI # pushEvent ( String eventName , Map eventActions ) } */ @ Deprecated public void push ( String eventName , Map < String , Object > eventActions ) { } }
CleverTapAPI cleverTapAPI = weakReference . get ( ) ; if ( cleverTapAPI == null ) { Logger . d ( "CleverTap Instance is null." ) ; } else { cleverTapAPI . pushEvent ( eventName , eventActions ) ; }
public class AbstractIoBuffer { /** * { @ inheritDoc } */ @ Override public < E extends Enum < E > > E getEnumShort ( Class < E > enumClass ) { } }
return toEnum ( enumClass , getUnsignedShort ( ) ) ;
public class NumberListBuilder { /** * but I ' m going to rely on the user to not do anything silly */ private Object toActualNumber ( Double value , Type type ) { } }
if ( type . equals ( Byte . class ) ) return value . byteValue ( ) ; if ( type . equals ( Short . class ) ) return value . shortValue ( ) ; if ( type . equals ( Integer . class ) ) return value . intValue ( ) ; if ( type . equals ( Long . class ) ) return value . longValue ( ) ; if ( type . equals ( Float . class ) ) return value . floatValue ( ) ; if ( type . equals ( Double . class ) ) return value ; if ( type . equals ( BigInteger . class ) ) return BigInteger . valueOf ( value . longValue ( ) ) ; if ( type . equals ( BigDecimal . class ) ) return BigDecimal . valueOf ( value ) ; return value ;
public class RunFromFileSystemModel { /** * Gets properties . * @ param envVars the env vars * @ return the properties */ @ Nullable public Properties getProperties ( EnvVars envVars , VariableResolver < String > varResolver ) { } }
return createProperties ( envVars , varResolver ) ;
public class Component { /** * Finds the nearest ancestor of this component stack . * @ param clazz * the class to look for , or if assignable from . * @ return the component if found , < tt > null < / tt > if not . */ @ SuppressWarnings ( "unchecked" ) protected < T extends Component > T findAncestor ( Class < T > clazz ) { } }
Stack < ? extends Component > componentStack = getComponentStack ( ) ; for ( int i = componentStack . size ( ) - 2 ; i >= 0 ; i -- ) { Component component = componentStack . get ( i ) ; if ( clazz . equals ( component . getClass ( ) ) ) return ( T ) component ; } return null ;
public class GatewayClient { /** * Reads a publishing exception from the response . * @ param response */ private PublishingException readPublishingException ( HttpResponse response ) { } }
InputStream is = null ; PublishingException exception ; try { is = response . getEntity ( ) . getContent ( ) ; GatewayApiErrorBean error = mapper . reader ( GatewayApiErrorBean . class ) . readValue ( is ) ; exception = new PublishingException ( error . getMessage ( ) ) ; StackTraceElement [ ] stack = parseStackTrace ( error . getStacktrace ( ) ) ; if ( stack != null ) { exception . setStackTrace ( stack ) ; } } catch ( Exception e ) { exception = new PublishingException ( e . getMessage ( ) , e ) ; } finally { IOUtils . closeQuietly ( is ) ; } return exception ;
public class LocaleData { /** * Returns the set of exemplar characters for a locale . * @ param options Bitmask for options to apply to the exemplar pattern . * Specify zero to retrieve the exemplar set as it is * defined in the locale data . Specify * UnicodeSet . CASE to retrieve a case - folded exemplar * set . See { @ link UnicodeSet # applyPattern ( String , * int ) } for a complete list of valid options . The * IGNORE _ SPACE bit is always set , regardless of the * value of ' options ' . * @ param extype The type of exemplar set to be retrieved , * ES _ STANDARD , ES _ INDEX , ES _ AUXILIARY , or ES _ PUNCTUATION * @ return The set of exemplar characters for the given locale . * If there is nothing available for the locale , * then null is returned if { @ link # getNoSubstitute ( ) } is true , otherwise the * root value is returned ( which may be UnicodeSet . EMPTY ) . * @ exception RuntimeException if the extype is invalid . */ public UnicodeSet getExemplarSet ( int options , int extype ) { } }
String [ ] exemplarSetTypes = { "ExemplarCharacters" , "AuxExemplarCharacters" , "ExemplarCharactersIndex" , "ExemplarCharactersCurrency" , "ExemplarCharactersPunctuation" } ; if ( extype == ES_CURRENCY ) { // currency symbol exemplar is no longer available return noSubstitute ? null : UnicodeSet . EMPTY ; } try { final String aKey = exemplarSetTypes [ extype ] ; // will throw an out - of - bounds exception ICUResourceBundle stringBundle = ( ICUResourceBundle ) bundle . get ( aKey ) ; if ( noSubstitute && ! bundle . isRoot ( ) && stringBundle . isRoot ( ) ) { return null ; } String unicodeSetPattern = stringBundle . getString ( ) ; return new UnicodeSet ( unicodeSetPattern , UnicodeSet . IGNORE_SPACE | options ) ; } catch ( ArrayIndexOutOfBoundsException aiooe ) { throw new IllegalArgumentException ( aiooe ) ; } catch ( Exception ex ) { return noSubstitute ? null : UnicodeSet . EMPTY ; }
public class ZipShort { /** * Get value as two bytes in big endian byte order . * @ return the value as a a two byte array in big endian byte order * @ since 1.1 */ public byte [ ] getBytes ( ) { } }
byte [ ] result = new byte [ 2 ] ; result [ 0 ] = ( byte ) ( value & BYTE_MASK ) ; result [ 1 ] = ( byte ) ( ( value & BYTE_1_MASK ) >> BYTE_1_SHIFT ) ; return result ;
public class DatabaseException { /** * Wrap an exception with a DatabaseException , taking into account all known * subtypes such that we wrap subtypes in a matching type ( so we don ' t obscure * the type available to catch clauses ) . * @ param message the new wrapping exception will have this message * @ param cause the exception to be wrapped * @ return the exception you should throw */ public static DatabaseException wrap ( String message , Throwable cause ) { } }
if ( cause instanceof ConstraintViolationException ) { return new ConstraintViolationException ( message , cause ) ; } return new DatabaseException ( message , cause ) ;
public class GrailsDomainBinder { /** * Interrogates the specified constraints looking for any constraints that would limit the * precision and / or scale of the property ' s value . If such constraints exist , this method adjusts * the precision and / or scale of the column accordingly . * @ param column the column that corresponds to the property * @ param property the property ' s constraints * @ param cc the column configuration */ protected void bindNumericColumnConstraints ( Column column , PersistentProperty property , ColumnConfig cc ) { } }
int scale = Column . DEFAULT_SCALE ; int precision = Column . DEFAULT_PRECISION ; PropertyConfig constrainedProperty = ( PropertyConfig ) property . getMapping ( ) . getMappedForm ( ) ; if ( cc != null && cc . getScale ( ) > - 1 ) { column . setScale ( cc . getScale ( ) ) ; } else if ( constrainedProperty . getScale ( ) > - 1 ) { scale = constrainedProperty . getScale ( ) ; column . setScale ( scale ) ; } if ( cc != null && cc . getPrecision ( ) > - 1 ) { column . setPrecision ( cc . getPrecision ( ) ) ; } else { Comparable < ? > minConstraintValue = constrainedProperty . getMin ( ) ; Comparable < ? > maxConstraintValue = constrainedProperty . getMax ( ) ; int minConstraintValueLength = 0 ; if ( ( minConstraintValue != null ) && ( minConstraintValue instanceof Number ) ) { minConstraintValueLength = Math . max ( countDigits ( ( Number ) minConstraintValue ) , countDigits ( ( ( Number ) minConstraintValue ) . longValue ( ) ) + scale ) ; } int maxConstraintValueLength = 0 ; if ( ( maxConstraintValue != null ) && ( maxConstraintValue instanceof Number ) ) { maxConstraintValueLength = Math . max ( countDigits ( ( Number ) maxConstraintValue ) , countDigits ( ( ( Number ) maxConstraintValue ) . longValue ( ) ) + scale ) ; } if ( minConstraintValueLength > 0 && maxConstraintValueLength > 0 ) { // If both of min and max constraints are setted we could use // maximum digits number in it as precision precision = Math . max ( minConstraintValueLength , maxConstraintValueLength ) ; } else { // Overwise we should also use default precision precision = DefaultGroovyMethods . max ( new Integer [ ] { precision , minConstraintValueLength , maxConstraintValueLength } ) ; } column . setPrecision ( precision ) ; }
public class ScriptContext { /** * Loads the properties file for the test . This file may reference further configuration files , * which are searched relatively to the configuration directory . These extra files must have * keys starting with { @ code system . properties . } . * @ param fileName * the name of the properties file , relative to jFunk ' s configuration directory * @ param preserveExistingProps * if { @ code true } , already existing properties are preserved */ @ Cmd public void load ( final String fileName , final boolean preserveExistingProps ) { } }
config . load ( fileName , preserveExistingProps ) ; String scriptDir = getScriptDir ( ) ; if ( scriptDir != null ) { config . put ( JFunkConstants . SCRIPT_DIR , scriptDir ) ; config . put ( JFunkConstants . SCRIPT_NAME , script . getName ( ) ) ; } config . put ( JFunkConstants . THREAD_ID , Thread . currentThread ( ) . getName ( ) ) ;
public class AbstractConnectionManager { /** * { @ inheritDoc } */ public void prepareShutdown ( int seconds , GracefulCallback cb ) { } }
shutdown . set ( true ) ; if ( gracefulCallback == null ) gracefulCallback = cb ; if ( pool != null ) pool . flush ( FlushMode . GRACEFULLY ) ; if ( seconds > 0 && scheduledGraceful == null ) { if ( scheduledExecutorService == null ) scheduledExecutorService = Executors . newScheduledThreadPool ( 1 ) ; scheduledGraceful = scheduledExecutorService . schedule ( new ConnectionManagerShutdown ( this ) , seconds , TimeUnit . SECONDS ) ; }
public class GetActivityInstanceCmd { /** * Loads all executions that are part of this process instance tree from the dbSqlSession cache . * ( optionally querying the db if a child is not already loaded . * @ param execution the current root execution ( already contained in childExecutions ) * @ param childExecutions the list in which all child executions should be collected */ protected void loadChildExecutionsFromCache ( ExecutionEntity execution , List < ExecutionEntity > childExecutions ) { } }
List < ExecutionEntity > childrenOfThisExecution = execution . getExecutions ( ) ; if ( childrenOfThisExecution != null ) { childExecutions . addAll ( childrenOfThisExecution ) ; for ( ExecutionEntity child : childrenOfThisExecution ) { loadChildExecutionsFromCache ( child , childExecutions ) ; } }
public class Util { /** * Attempts to exhaust { @ code source } , returning true if successful . This is useful when reading a * complete source is helpful , such as when doing so completes a cache body or frees a socket * connection for reuse . */ public static boolean discard ( Source source , int timeout , TimeUnit timeUnit ) { } }
try { return skipAll ( source , timeout , timeUnit ) ; } catch ( IOException e ) { return false ; }
public class MorfologikPolishSpellerRule { /** * Remove suggestions - - not really runon words using a list of non - word suffixes * @ return A list of pruned suggestions . */ private List < String > pruneSuggestions ( final List < String > suggestions ) { } }
List < String > prunedSuggestions = new ArrayList < > ( suggestions . size ( ) ) ; for ( final String suggestion : suggestions ) { if ( suggestion . indexOf ( ' ' ) == - 1 ) { prunedSuggestions . add ( suggestion ) ; } else { String [ ] complexSug = suggestion . split ( " " ) ; if ( ! bannedSuffixes . contains ( complexSug [ 1 ] ) ) { prunedSuggestions . add ( suggestion ) ; } } } return prunedSuggestions ;
public class StunAttributeFactory { /** * Creates an ErrorCodeAttribute with the specified error class , number and * reason phrase . * @ param errorClass * a valid error class . * @ param errorNumber * a valid error number . * @ param reasonPhrase * a human readable reason phrase . A null reason phrase would be * replaced ( if possible ) by a default one as defined byte the * rfc3489. * @ return the newly created attribute . * @ throws StunException * if the error class or number have invalid values according to * rfc3489. */ public static ErrorCodeAttribute createErrorCodeAttribute ( byte errorClass , byte errorNumber , String reasonPhrase ) throws StunException { } }
ErrorCodeAttribute attribute = new ErrorCodeAttribute ( ) ; attribute . setErrorClass ( errorClass ) ; attribute . setErrorNumber ( errorNumber ) ; attribute . setReasonPhrase ( reasonPhrase == null ? ErrorCodeAttribute . getDefaultReasonPhrase ( attribute . getErrorCode ( ) ) : reasonPhrase ) ; return attribute ;
public class MapTileTransitionModel { /** * Get the new transition type from two transitions on horizontal and vertical axis . * @ param a The inner transition . * @ param b The outer transition . * @ param ox The horizontal offset to update . * @ param oy The vertical offset to update . * @ return The new transition type , < code > null < / code > if none . */ private static TransitionType getTransitionHorizontalVertical ( TransitionType a , TransitionType b , int ox , int oy ) { } }
final TransitionType type ; if ( ox == - 1 && oy == 0 ) { type = TransitionType . from ( ! b . getDownRight ( ) , a . getDownLeft ( ) , ! b . getUpRight ( ) , a . getUpLeft ( ) ) ; } else if ( ox == 1 && oy == 0 ) { type = TransitionType . from ( a . getDownRight ( ) , ! b . getDownLeft ( ) , a . getUpRight ( ) , ! b . getUpLeft ( ) ) ; } else if ( ox == 0 && oy == 1 ) { type = TransitionType . from ( ! b . getDownRight ( ) , ! b . getDownLeft ( ) , a . getUpRight ( ) , a . getUpLeft ( ) ) ; } else if ( ox == 0 && oy == - 1 ) { type = TransitionType . from ( a . getDownRight ( ) , a . getDownLeft ( ) , ! b . getUpRight ( ) , ! b . getUpLeft ( ) ) ; } else { type = null ; } return type ;
public class ApplicationSettingsResourceMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ApplicationSettingsResource applicationSettingsResource , ProtocolMarshaller protocolMarshaller ) { } }
if ( applicationSettingsResource == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( applicationSettingsResource . getApplicationId ( ) , APPLICATIONID_BINDING ) ; protocolMarshaller . marshall ( applicationSettingsResource . getCampaignHook ( ) , CAMPAIGNHOOK_BINDING ) ; protocolMarshaller . marshall ( applicationSettingsResource . getLastModifiedDate ( ) , LASTMODIFIEDDATE_BINDING ) ; protocolMarshaller . marshall ( applicationSettingsResource . getLimits ( ) , LIMITS_BINDING ) ; protocolMarshaller . marshall ( applicationSettingsResource . getQuietTime ( ) , QUIETTIME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ByteArray { /** * Translate the each ByteArray in an iterable into a hexadecimal string * @ param arrays The array of bytes to translate * @ return An iterable of converted strings */ public static Iterable < String > toHexStrings ( Iterable < ByteArray > arrays ) { } }
ArrayList < String > ret = new ArrayList < String > ( ) ; for ( ByteArray array : arrays ) ret . add ( ByteUtils . toHexString ( array . get ( ) ) ) ; return ret ;
public class ESGImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case AfplibPackage . ESG__REG_NAME : setREGName ( ( String ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class CmsJspNavElement { /** * Returns the value of the property PROPERTY _ NAVTEXT of this navigation element , * or a warning message if this property is not set * ( this method will never return < code > null < / code > ) . < p > * @ return the value of the property PROPERTY _ NAVTEXT of this navigation element , * or a warning message if this property is not set * ( this method will never return < code > null < / code > ) */ public String getNavText ( ) { } }
if ( m_text == null ) { // use " lazy initializing " m_text = getProperties ( ) . get ( CmsPropertyDefinition . PROPERTY_NAVTEXT ) ; if ( m_text == null ) { m_text = CmsMessages . formatUnknownKey ( CmsPropertyDefinition . PROPERTY_NAVTEXT ) ; } } return m_text ;
public class MavenArtifactUrlReference { /** * { @ inheritDoc } */ public MavenArtifactUrlReference version ( final VersionResolver resolver ) { } }
validateNotNull ( resolver , "Version resolver" ) ; return version ( resolver . getVersion ( m_groupId , m_artifactId ) ) ;
public class SubnetsInner { /** * Gets the specified subnet by virtual network and resource group . * @ param resourceGroupName The name of the resource group . * @ param virtualNetworkName The name of the virtual network . * @ param subnetName The name of the subnet . * @ param expand Expands referenced resources . * @ 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 < SubnetInner > getAsync ( String resourceGroupName , String virtualNetworkName , String subnetName , String expand , final ServiceCallback < SubnetInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( resourceGroupName , virtualNetworkName , subnetName , expand ) , serviceCallback ) ;
public class PiwikRequest { /** * Add a custom tracking parameter to the specified key . This allows users * to have multiple parameters with the same name and different values , * commonly used during situations where list parameters are needed * @ param key the parameter ' s key . Cannot be null * @ param value the parameter ' s value . Cannot be null */ public void addCustomTrackingParameter ( String key , Object value ) { } }
if ( key == null ) { throw new NullPointerException ( "Key cannot be null." ) ; } if ( value == null ) { throw new NullPointerException ( "Cannot add a null custom tracking parameter." ) ; } else { List l = customTrackingParameters . get ( key ) ; if ( l == null ) { l = new ArrayList ( ) ; customTrackingParameters . put ( key , l ) ; } l . add ( value ) ; }
public class GridSearch { /** * Start a new grid search job . < p > This method launches any grid search traversing space of hyper * parameters based on specified strategy . * @ param destKey A key to store result of grid search under . * @ param hyperSpaceWalker defines a strategy for traversing a hyper space . The object itself * holds definition of hyper space . * @ return GridSearch Job , with models run with these parameters , built as needed - expected to be * an expensive operation . If the models in question are " in progress " , a 2nd build will NOT be * kicked off . This is a non - blocking call . */ public static < MP extends Model . Parameters > Job < Grid > startGridSearch ( final Key < Grid > destKey , final HyperSpaceWalker < MP , ? > hyperSpaceWalker ) { } }
// Compute key for destination object representing grid MP params = hyperSpaceWalker . getParams ( ) ; Key < Grid > gridKey = destKey != null ? destKey : gridKeyName ( params . algoName ( ) , params . train ( ) ) ; // Start the search return new GridSearch < > ( gridKey , hyperSpaceWalker ) . start ( ) ;
public class SslListener { /** * Allow the Listener a chance to customise the request . before the server does its stuff . < br > * This allows the required attributes to be set for SSL requests . < br > * The requirements of the Servlet specs are : * < ul > * < li > an attribute named " javax . servlet . request . cipher _ suite " of type String . < / li > * < li > an attribute named " javax . servlet . request . key _ size " of type Integer . < / li > * < li > an attribute named " javax . servlet . request . X509Certificate " of type * java . security . cert . X509Certificate [ ] . This is an array of objects of type X509Certificate , * the order of this array is defined as being in ascending order of trust . The first * certificate in the chain is the one set by the client , the next is the one used to * authenticate the first , and so on . < / li > * < / ul > * @ param socket The Socket the request arrived on . This should be a javax . net . ssl . SSLSocket . * @ param request HttpRequest to be customised . */ protected void customizeRequest ( Socket socket , HttpRequest request ) { } }
super . customizeRequest ( socket , request ) ; if ( ! ( socket instanceof javax . net . ssl . SSLSocket ) ) return ; // I ' m tempted to let it throw an // exception . . . try { SSLSocket sslSocket = ( SSLSocket ) socket ; SSLSession sslSession = sslSocket . getSession ( ) ; String cipherSuite = sslSession . getCipherSuite ( ) ; Integer keySize ; X509Certificate [ ] certs ; CachedInfo cachedInfo = ( CachedInfo ) sslSession . getValue ( CACHED_INFO_ATTR ) ; if ( cachedInfo != null ) { keySize = cachedInfo . getKeySize ( ) ; certs = cachedInfo . getCerts ( ) ; } else { keySize = new Integer ( ServletSSL . deduceKeyLength ( cipherSuite ) ) ; certs = getCertChain ( sslSession ) ; cachedInfo = new CachedInfo ( keySize , certs ) ; sslSession . putValue ( CACHED_INFO_ATTR , cachedInfo ) ; } if ( certs != null ) request . setAttribute ( "javax.servlet.request.X509Certificate" , certs ) ; else if ( _needClientAuth ) // Sanity check throw new HttpException ( HttpResponse . __403_Forbidden ) ; request . setAttribute ( "javax.servlet.request.cipher_suite" , cipherSuite ) ; request . setAttribute ( "javax.servlet.request.key_size" , keySize ) ; } catch ( Exception e ) { log . warn ( LogSupport . EXCEPTION , e ) ; }
public class TheMovieDbApi { /** * Get all of the images for a particular collection by collection id . * @ param collectionId collectionId * @ param language language * @ return ResultList * @ throws MovieDbException exception */ public ResultList < Artwork > getCollectionImages ( int collectionId , String language ) throws MovieDbException { } }
return tmdbCollections . getCollectionImages ( collectionId , language ) ;
public class ClientSocketStats { /** * Record the checkout wait time in us * @ param dest Destination of the socket to checkout . Will actually record * if null . Otherwise will call this on self and corresponding child * with this param null . * @ param checkoutTimeUs The number of us to wait before getting a socket */ public void recordCheckoutTimeUs ( SocketDestination dest , long checkoutTimeUs ) { } }
if ( dest != null ) { getOrCreateNodeStats ( dest ) . recordCheckoutTimeUs ( null , checkoutTimeUs ) ; recordCheckoutTimeUs ( null , checkoutTimeUs ) ; } else { this . checkoutTimeRequestCounter . addRequest ( checkoutTimeUs * Time . NS_PER_US ) ; }
public class Query { /** * < code > * Add a range refinement . Takes a refinement name , a lower and upper bounds . * < / code > * @ param navigationName * The name of the refinement * @ param low * The low value * @ param high * The high value */ public Query addRangeRefinement ( String navigationName , String low , String high ) { } }
return addRangeRefinement ( navigationName , low , high , false ) ;
public class TranslatorTypes { /** * throws NumberFormatException */ private static int getMainNumber ( int mainNumber , String dptID ) { } }
return mainNumber != 0 ? mainNumber : Integer . parseInt ( dptID . substring ( 0 , dptID . indexOf ( '.' ) ) ) ;
public class CollectionUtilsExtended { /** * Does a " group by " or map aggregation on a collection based on keys that are emitted by the given function . For * each key emitted by the function , the map will contain a list at that key entry containing at least one element * from the collection . * @ param collection the collection to group * @ param keyFn the function that emits the key for each value * @ param < K > the key type * @ param < V > the value type * @ return a map of lists where each list contains elements that */ public static < K , V > Map < K , List < V > > group ( Collection < V > collection , Function < V , K > keyFn ) { } }
Map < K , List < V > > map = new HashMap < > ( ) ; for ( V value : collection ) { K key = keyFn . apply ( value ) ; if ( map . get ( key ) == null ) { map . put ( key , new ArrayList < V > ( ) ) ; } map . get ( key ) . add ( value ) ; } return map ;
public class LessCompilationEngineFactory { /** * Create a new engine of the specified type if available , or a default engine . * @ param type The engine type . " rhino " , " nashorn " and " commandline " are supported out of the box . * @ param executable The executable in case of commandline engine * @ return A new RhinoLessCompilationEngine */ public static LessCompilationEngine create ( String type , String executable ) { } }
if ( type == null || RHINO . equals ( type ) ) { return create ( ) ; } if ( COMMAND_LINE . equals ( type ) ) { return new CommandLineLesscCompilationEngine ( executable ) ; } return new ScriptEngineLessCompilationEngine ( type ) ;
public class PullToRefreshView { /** * This method sets padding for the refresh ( progress ) view . */ public void setRefreshViewPadding ( int left , int top , int right , int bottom ) { } }
mRefreshView . setPadding ( left , top , right , bottom ) ;
public class ListDiscoveredResourcesRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListDiscoveredResourcesRequest listDiscoveredResourcesRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listDiscoveredResourcesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listDiscoveredResourcesRequest . getResourceType ( ) , RESOURCETYPE_BINDING ) ; protocolMarshaller . marshall ( listDiscoveredResourcesRequest . getResourceIds ( ) , RESOURCEIDS_BINDING ) ; protocolMarshaller . marshall ( listDiscoveredResourcesRequest . getResourceName ( ) , RESOURCENAME_BINDING ) ; protocolMarshaller . marshall ( listDiscoveredResourcesRequest . getLimit ( ) , LIMIT_BINDING ) ; protocolMarshaller . marshall ( listDiscoveredResourcesRequest . getIncludeDeletedResources ( ) , INCLUDEDELETEDRESOURCES_BINDING ) ; protocolMarshaller . marshall ( listDiscoveredResourcesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class KeyVaultClientBaseImpl { /** * Restores a backed up certificate to a vault . * Restores a backed up certificate , and all its versions , to a vault . This operation requires the certificates / restore permission . * @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net . * @ param certificateBundleBackup The backup blob associated with a certificate bundle . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws KeyVaultErrorException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the CertificateBundle object if successful . */ public CertificateBundle restoreCertificate ( String vaultBaseUrl , byte [ ] certificateBundleBackup ) { } }
return restoreCertificateWithServiceResponseAsync ( vaultBaseUrl , certificateBundleBackup ) . toBlocking ( ) . single ( ) . body ( ) ;
public class JsonHelper { /** * Formats the specified timestamp as an ISO 8601 string with milliseconds and UTC timezone . */ public static String formatTimestamp ( @ Nullable Date date ) { } }
return ( date != null ) ? date . toInstant ( ) . toString ( ) : null ;
public class UUID { /** * 返回指定长度随机数字组成的字符串 * @ param length 指定长度 * @ return 随机字符串 */ public static String captchaNumber ( int length ) { } }
StringBuilder sb = new StringBuilder ( ) ; Random rand = new Random ( ) ; for ( int i = 0 ; i < length ; i ++ ) { sb . append ( rand . nextInt ( 10 ) ) ; } return sb . toString ( ) ;
public class CmsSearchTab { /** * Removes the given parameter type . < p > * @ param type the parameter type */ public void removeParameter ( ParamType type ) { } }
switch ( type ) { case language : m_localeSelection . reset ( ) ; break ; case text : m_searchInput . setFormValueAsString ( "" ) ; break ; case expired : m_includeExpiredCheckBox . setChecked ( false ) ; break ; case creation : m_dateCreatedStartDateBox . setValue ( null , true ) ; m_dateCreatedEndDateBox . setValue ( null , true ) ; break ; case modification : m_dateModifiedStartDateBox . setValue ( null , true ) ; m_dateModifiedEndDateBox . setValue ( null , true ) ; break ; case scope : m_scopeSelection . setFormValueAsString ( m_defaultScope . name ( ) ) ; break ; default : }
public class LUDecomposition { /** * Return pivot permutation vector * @ return piv */ public int [ ] getPivot ( ) { } }
int [ ] p = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { p [ i ] = piv [ i ] ; } return p ;
public class BigQuerySnippets { /** * [ VARIABLE " my _ table _ name " ] */ public Table getTable ( String datasetName , String tableName ) { } }
// [ START ] Table table = bigquery . getTable ( datasetName , tableName ) ; // [ END ] return table ;
public class CmsVfsCache { /** * Removes a bunch of cached resources from the cache . < p > * @ param resources a list of resources * @ see # uncacheResource ( CmsResource ) */ protected void uncacheResources ( List < CmsResource > resources ) { } }
if ( resources == null ) { return ; } for ( int i = 0 , n = resources . size ( ) ; i < n ; i ++ ) { // remove the resource uncacheResource ( resources . get ( i ) ) ; }
public class CrossDriver { @ Override public void setup ( TaskContext < CrossFunction < T1 , T2 , OT > , OT > context ) { } }
this . taskContext = context ; this . running = true ;
public class PlayEngine { /** * Schedule a stop to be run from a separate thread to allow the background thread to stop cleanly . */ private void runDeferredStop ( ) { } }
// Stop current jobs from running . clearWaitJobs ( ) ; // Schedule deferred stop executor . log . trace ( "Ran deferred stop" ) ; if ( deferredStop == null ) { // set deferred stop if we get a job name returned deferredStop = subscriberStream . scheduleWithFixedDelay ( new DeferredStopRunnable ( ) , 100 ) ; }
public class CmsObjectWrapper { /** * Moves a resource to the given destination . < p > * Iterates through all configured resource wrappers till the first returns < code > true < / code > . < p > * @ see I _ CmsResourceWrapper # moveResource ( CmsObject , String , String ) * @ see CmsObject # moveResource ( String , String ) * @ param source the name of the resource to move ( full path ) * @ param destination the destination resource name ( full path ) * @ throws CmsException if something goes wrong */ public void moveResource ( String source , String destination ) throws CmsException { } }
boolean exec = false ; // iterate through all wrappers and call " moveResource " till one does not return false List < I_CmsResourceWrapper > wrappers = getWrappers ( ) ; Iterator < I_CmsResourceWrapper > iter = wrappers . iterator ( ) ; while ( iter . hasNext ( ) ) { I_CmsResourceWrapper wrapper = iter . next ( ) ; exec = wrapper . moveResource ( m_cms , source , destination ) ; if ( exec ) { break ; } } // delegate the call to the CmsObject if ( ! exec ) { m_cms . moveResource ( source , destination ) ; }
public class DependenciesDeployer { /** * Copy jars specified as BootClasspathLibraryOption in system * to the karaf lib path to make them available in the boot classpath * @ throws IOException if copy fails */ public void copyBootClasspathLibraries ( ) throws IOException { } }
BootClasspathLibraryOption [ ] bootClasspathLibraryOptions = subsystem . getOptions ( BootClasspathLibraryOption . class ) ; for ( BootClasspathLibraryOption bootClasspathLibraryOption : bootClasspathLibraryOptions ) { UrlReference libraryUrl = bootClasspathLibraryOption . getLibraryUrl ( ) ; FileUtils . copyURLToFile ( new URL ( libraryUrl . getURL ( ) ) , createUnique ( libraryUrl . getURL ( ) , new File ( karafHome + "/lib" ) , new String [ ] { "jar" } ) ) ; }
public class LongTermRetentionBackupsInner { /** * Deletes a long term retention backup . * @ param locationName The location of the database * @ param longTermRetentionServerName the String value * @ param longTermRetentionDatabaseName the String value * @ param backupName The backup name . * @ 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 */ public void delete ( String locationName , String longTermRetentionServerName , String longTermRetentionDatabaseName , String backupName ) { } }
deleteWithServiceResponseAsync ( locationName , longTermRetentionServerName , longTermRetentionDatabaseName , backupName ) . toBlocking ( ) . last ( ) . body ( ) ;
public class LogNormalDistributionTypeImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case BpsimPackage . LOG_NORMAL_DISTRIBUTION_TYPE__MEAN : unsetMean ( ) ; return ; case BpsimPackage . LOG_NORMAL_DISTRIBUTION_TYPE__STANDARD_DEVIATION : unsetStandardDeviation ( ) ; return ; } super . eUnset ( featureID ) ;
public class CommandFaceDescriptor { /** * Sets the main default large icon for the command . * @ param icon The large icon . May be null . */ public void setLargeIcon ( Icon icon ) { } }
Icon old = null ; if ( largeIconInfo == CommandButtonIconInfo . BLANK_ICON_INFO ) { if ( icon != null ) { // new IconInfo fires event setLargeIconInfo ( new CommandButtonIconInfo ( icon ) ) ; } } else { old = largeIconInfo . getIcon ( ) ; this . largeIconInfo . setIcon ( icon ) ; } firePropertyChange ( LARGE_ICON_PROPERTY , old , icon ) ;
public class ListAppsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListAppsRequest listAppsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listAppsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listAppsRequest . getAppIds ( ) , APPIDS_BINDING ) ; protocolMarshaller . marshall ( listAppsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listAppsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class K3poRule { /** * Blocking call to await for the K3po threads to stop executing . If the connects have not already been initiated via the * start ( ) method , they will be implicitly called . * @ throws Exception if an error has occurred in the execution of the tests . */ public void finish ( ) throws Exception { } }
assertTrue ( format ( "Did you call finish() from outside @%s test?" , Specification . class . getSimpleName ( ) ) , ! latch . isInInitState ( ) ) ; // wait for script to finish latch . notifyStartable ( ) ; latch . awaitFinished ( ) ;
public class AttributeService { /** * Returns attributes of the given file as an object of the given type . * @ throws UnsupportedOperationException if the given attributes type is not supported */ @ SuppressWarnings ( "unchecked" ) public < A extends BasicFileAttributes > A readAttributes ( File file , Class < A > type ) { } }
AttributeProvider provider = providersByAttributesType . get ( type ) ; if ( provider != null ) { return ( A ) provider . readAttributes ( file ) ; } throw new UnsupportedOperationException ( "unsupported attributes type: " + type ) ;
public class CIType { /** * Get the type this Configuration item represents . * @ return Type */ public org . efaps . admin . datamodel . Type getType ( ) { } }
org . efaps . admin . datamodel . Type ret = null ; try { ret = org . efaps . admin . datamodel . Type . get ( this . uuid ) ; } catch ( final CacheReloadException e ) { CIType . LOG . error ( "Error on retrieving Type for CIType with uuid: {}" , this . uuid ) ; } return ret ;
public class Builder { /** * Declares the interpreter to be used when invoking the RPM * pre - installation script that can be set with the * { @ link # setPreInstallScript ( String ) } method . * @ param program Path to the interpretter */ public void setPreInstallProgram ( final String program ) { } }
if ( null == program ) { format . getHeader ( ) . createEntry ( PREINPROG , DEFAULTSCRIPTPROG ) ; } else if ( 0 == program . length ( ) ) { format . getHeader ( ) . createEntry ( PREINPROG , DEFAULTSCRIPTPROG ) ; } else { format . getHeader ( ) . createEntry ( PREINPROG , program ) ; }
public class ModelSerializer { /** * Load a computation graph from a file * @ param path path to the model file , to get the computation graph from * @ return the loaded computation graph * @ throws IOException */ public static ComputationGraph restoreComputationGraph ( @ NonNull String path , boolean loadUpdater ) throws IOException { } }
return restoreComputationGraph ( new File ( path ) , loadUpdater ) ;
public class SubWriterHolderWriter { /** * Get the summary table . * @ param mw the writer for the member being documented * @ param cd the classdoc to be documented * @ param tableContents list of summary table contents * @ param showTabs true if the table needs to show tabs * @ return the content tree for the summary table */ public Content getSummaryTableTree ( AbstractMemberWriter mw , ClassDoc cd , List < Content > tableContents , boolean showTabs ) { } }
Content caption ; if ( showTabs ) { caption = getTableCaption ( mw . methodTypes ) ; generateMethodTypesScript ( mw . typeMap , mw . methodTypes ) ; } else { caption = getTableCaption ( mw . getCaption ( ) ) ; } Content table = HtmlTree . TABLE ( HtmlStyle . memberSummary , 0 , 3 , 0 , mw . getTableSummary ( ) , caption ) ; table . addContent ( getSummaryTableHeader ( mw . getSummaryTableHeader ( cd ) , "col" ) ) ; for ( int i = 0 ; i < tableContents . size ( ) ; i ++ ) { table . addContent ( tableContents . get ( i ) ) ; } return table ;
public class CredHubInfoTemplate { /** * Retrieve the version information from the CredHub server . * @ return the server version information */ @ Override public VersionInfo version ( ) { } }
return credHubOperations . doWithRest ( restOperations -> { ResponseEntity < VersionInfo > response = restOperations . getForEntity ( VERSION_URL_PATH , VersionInfo . class ) ; ExceptionUtils . throwExceptionOnError ( response ) ; return response . getBody ( ) ; } ) ;
public class DomainData { /** * Get the data * @ return The data */ public MBeanData [ ] getData ( ) { } }
MBeanData [ ] data = new MBeanData [ domainData . size ( ) ] ; domainData . toArray ( data ) ; return data ;
public class ScanUploader { /** * Sometimes due to unexpected errors while submitting scan ranges to the underlying queues a scan can get stuck . * This method takes all available tasks for a scan and resubmits them . This method is safe because * the underlying system is resilient to task resubmissions and concurrent work on the same task . */ public ScanStatus resubmitWorkflowTasks ( String scanId ) { } }
ScanStatus status = _scanStatusDAO . getScanStatus ( scanId ) ; if ( status == null ) { return null ; } if ( status . getCompleteTime ( ) == null ) { // Resubmit any active tasks for ( ScanRangeStatus active : status . getActiveScanRanges ( ) ) { _scanWorkflow . addScanRangeTask ( scanId , active . getTaskId ( ) , active . getPlacement ( ) , active . getScanRange ( ) ) ; } // Send notification to evaluate whether any new range tasks can be started _scanWorkflow . scanStatusUpdated ( scanId ) ; } return status ;
public class AbstractApi { /** * Convenience method for adding query and form parameters to a get ( ) or post ( ) call . * If required is true and value is null , will throw an IllegalArgumentException . * @ param formData the Form containing the name / value pairs * @ param name the name of the field / attribute to add * @ param value the value of the field / attribute to add * @ param required the field is required flag * @ throws IllegalArgumentException if a required parameter is null or empty */ protected void addFormParam ( Form formData , String name , Object value , boolean required ) throws IllegalArgumentException { } }
if ( value == null ) { if ( required ) { throw new IllegalArgumentException ( name + " cannot be empty or null" ) ; } return ; } String stringValue = value . toString ( ) ; if ( required && stringValue . trim ( ) . length ( ) == 0 ) { throw new IllegalArgumentException ( name + " cannot be empty or null" ) ; } formData . param ( name , stringValue ) ;
public class CliFrontend { /** * Builds command line options for the run action . * @ return Command line options for the run action . */ static Options getRunOptions ( Options options ) { } }
Options o = getProgramSpecificOptions ( options ) ; return getJobManagerAddressOption ( o ) ;
public class JobCat { /** * Remove a global logger . * @ param logger Your desired logger . * @ see # addLogger ( JobLogger ) */ public static synchronized void removeLogger ( @ NonNull JobLogger logger ) { } }
for ( int i = 0 ; i < loggers . length ; i ++ ) { if ( logger . equals ( loggers [ i ] ) ) { loggers [ i ] = null ; // continue , maybe for some reason the logger is twice in the array } }
public class NullLevelFilterFactory { /** * Creates a { @ link Filter } that will always defer to the next Filter in the chain , if any . * @ param threshold the parameter is ignored * @ return a { @ link Filter } with a { @ link Filter # decide ( Object ) } method that will always return { @ link FilterReply # NEUTRAL } . */ @ Override public Filter < E > build ( Level threshold ) { } }
return new Filter < E > ( ) { @ Override public FilterReply decide ( E event ) { return FilterReply . NEUTRAL ; } } ;
public class JapaneseCalendar { /** * / * [ deutsch ] * < p > Erzeugt einen modernen japanischen Kalender f & uuml ; r jedes Datum seit Meiji 6 * ( gregorianische Kalenderregeln ) . < / p > * < p > Die gregorianische Bedingung au & szlig ; er Acht lassend , & auml ; quivalent zu * { @ code JapaneseCalendar . of ( nengo , yearOfNengo , EastAsianMonth . valueOf ( month ) , dayOfMonth , Leniency . SMART ) } . < / p > * @ param nengo Japanese era ( Meiji or later ) * @ param yearOfNengo year of nengo starting with number 1 ( if Meiji then starting with 6) * @ param month gregorian month ( 1-12) * @ param dayOfMonth day of month { @ code > = 1} * @ return new instance of { @ code JapaneseCalendar } * @ throws IllegalArgumentException in case of any inconsistencies * @ see # of ( Nengo , int , EastAsianMonth , int , Leniency ) */ public static JapaneseCalendar ofGregorian ( Nengo nengo , int yearOfNengo , int month , int dayOfMonth ) { } }
if ( ! nengo . isModern ( ) || ( ( nengo == Nengo . MEIJI ) && ( yearOfNengo < 6 ) ) ) { throw new IllegalArgumentException ( "Cannot create modern calendar with lunisolar calendar year." ) ; } return JapaneseCalendar . of ( nengo , yearOfNengo , EastAsianMonth . valueOf ( month ) , dayOfMonth , Leniency . SMART ) ;
public class DeviceDataMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeviceData deviceData , ProtocolMarshaller protocolMarshaller ) { } }
if ( deviceData == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deviceData . getDeviceArn ( ) , DEVICEARN_BINDING ) ; protocolMarshaller . marshall ( deviceData . getDeviceSerialNumber ( ) , DEVICESERIALNUMBER_BINDING ) ; protocolMarshaller . marshall ( deviceData . getDeviceType ( ) , DEVICETYPE_BINDING ) ; protocolMarshaller . marshall ( deviceData . getDeviceName ( ) , DEVICENAME_BINDING ) ; protocolMarshaller . marshall ( deviceData . getSoftwareVersion ( ) , SOFTWAREVERSION_BINDING ) ; protocolMarshaller . marshall ( deviceData . getMacAddress ( ) , MACADDRESS_BINDING ) ; protocolMarshaller . marshall ( deviceData . getDeviceStatus ( ) , DEVICESTATUS_BINDING ) ; protocolMarshaller . marshall ( deviceData . getRoomArn ( ) , ROOMARN_BINDING ) ; protocolMarshaller . marshall ( deviceData . getRoomName ( ) , ROOMNAME_BINDING ) ; protocolMarshaller . marshall ( deviceData . getDeviceStatusInfo ( ) , DEVICESTATUSINFO_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class MtasSolrCollectionCache { /** * Encode . * @ param o the o * @ return the string * @ throws IOException Signals that an I / O exception has occurred . */ private String encode ( MtasSolrCollectionCacheItem o ) throws IOException { } }
if ( o != null ) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ( ) ; ObjectOutputStream objectOutputStream ; objectOutputStream = new ObjectOutputStream ( byteArrayOutputStream ) ; objectOutputStream . writeObject ( o ) ; objectOutputStream . close ( ) ; byte [ ] byteArray = byteArrayOutputStream . toByteArray ( ) ; return Base64 . byteArrayToBase64 ( byteArray ) ; } else { throw new IOException ( "nothing to encode" ) ; }
public class OrcReader { /** * Does the file start with the ORC magic bytes ? */ private static boolean isValidHeaderMagic ( OrcDataSource source ) throws IOException { } }
byte [ ] headerMagic = new byte [ MAGIC . length ( ) ] ; source . readFully ( 0 , headerMagic ) ; return MAGIC . equals ( Slices . wrappedBuffer ( headerMagic ) ) ;
public class CodedInput { /** * Resets the buffer position and limit to re - use this CodedInput object . */ public void reset ( ) { } }
this . bufferSize = 0 ; this . bufferPos = 0 ; this . bufferSizeAfterLimit = 0 ; this . currentLimit = Integer . MAX_VALUE ; this . lastTag = 0 ; this . packedLimit = 0 ; this . sizeLimit = DEFAULT_SIZE_LIMIT ; resetSizeCounter ( ) ;
public class QueryParser { /** * pseudo selector : contains ( text ) , containsOwn ( text ) */ private void contains ( boolean own ) { } }
tq . consume ( own ? ":containsOwn" : ":contains" ) ; String searchText = TokenQueue . unescape ( tq . chompBalanced ( '(' , ')' ) ) ; Validate . notEmpty ( searchText , ":contains(text) query must not be empty" ) ; if ( own ) evals . add ( new Evaluator . ContainsOwnText ( searchText ) ) ; else evals . add ( new Evaluator . ContainsText ( searchText ) ) ;
public class GenericHibernateDao { /** * Gets the unique result , that matches a variable number of passed * criterions . * @ param criterion A variable number of hibernate criterions * @ return Entity matching the passed hibernate criterions * @ throws HibernateException if there is more than one matching result */ @ SuppressWarnings ( "unchecked" ) public E findByUniqueCriteria ( Criterion ... criterion ) throws HibernateException { } }
LOG . trace ( "Finding one unique " + entityClass . getSimpleName ( ) + " based on " + criterion . length + " criteria" ) ; Criteria criteria = createDistinctRootEntityCriteria ( criterion ) ; return ( E ) criteria . uniqueResult ( ) ;
public class MailMessageConverter { /** * Reads basic message information such as sender , recipients and mail subject to message headers . * @ param msg * @ return */ protected Map < String , Object > createMessageHeaders ( MimeMailMessage msg ) throws MessagingException , IOException { } }
Map < String , Object > headers = new HashMap < > ( ) ; headers . put ( CitrusMailMessageHeaders . MAIL_MESSAGE_ID , msg . getMimeMessage ( ) . getMessageID ( ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_FROM , StringUtils . arrayToCommaDelimitedString ( msg . getMimeMessage ( ) . getFrom ( ) ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_TO , StringUtils . arrayToCommaDelimitedString ( ( msg . getMimeMessage ( ) . getRecipients ( javax . mail . Message . RecipientType . TO ) ) ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_CC , StringUtils . arrayToCommaDelimitedString ( ( msg . getMimeMessage ( ) . getRecipients ( javax . mail . Message . RecipientType . CC ) ) ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_BCC , StringUtils . arrayToCommaDelimitedString ( ( msg . getMimeMessage ( ) . getRecipients ( javax . mail . Message . RecipientType . BCC ) ) ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_REPLY_TO , StringUtils . arrayToCommaDelimitedString ( ( msg . getMimeMessage ( ) . getReplyTo ( ) ) ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_DATE , msg . getMimeMessage ( ) . getSentDate ( ) != null ? dateFormat . format ( msg . getMimeMessage ( ) . getSentDate ( ) ) : null ) ; headers . put ( CitrusMailMessageHeaders . MAIL_SUBJECT , msg . getMimeMessage ( ) . getSubject ( ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_CONTENT_TYPE , parseContentType ( msg . getMimeMessage ( ) . getContentType ( ) ) ) ; return headers ;
public class PortalConversionService { /** * / * ( non - Javadoc ) * Modify this method to add more converters . */ @ Override protected void addDefaultConverters ( ) { } }
super . addDefaultConverters ( ) ; /* Add the " shortDate " conversion . */ StringToDate dateAndTimeToDate = new StringToDate ( ) ; dateAndTimeToDate . setPattern ( DATE_AND_TIME_FORMAT ) ; addConverter ( "date" , dateAndTimeToDate ) ;
public class Expressions { /** * Creates an IsBetween expression from the given expressions . * @ param date The date to compare . * @ param lowDate The low date to compare to . * @ param highDate The high date to compare to * @ return A DateIsBetween expression . */ public static DateIsBetween isBetween ( ComparableExpression < Date > date , ComparableExpression < Date > lowDate , ComparableExpression < Date > highDate ) { } }
return new DateIsBetween ( date , lowDate , highDate ) ;
public class GroupHandlerImpl { /** * Notifying listeners after group deletion . * @ param group * the group which is used in delete operation * @ throws Exception * if any listener failed to handle the event */ private void postDelete ( Group group ) throws Exception { } }
for ( GroupEventListener listener : listeners ) { listener . postDelete ( group ) ; }
public class TypedObject { /** * Factory method * @ param < IDTYPE > * The type of the ID . * @ param aObjectType * Object type to use . May not be < code > null < / code > . * @ param aID * ID to be used . May not be < code > null < / code > . * @ return new { @ link TypedObject } */ @ Nonnull public static < IDTYPE extends Serializable > TypedObject < IDTYPE > create ( @ Nonnull final ObjectType aObjectType , @ Nonnull final IDTYPE aID ) { } }
return new TypedObject < > ( aObjectType , aID ) ;
public class ReadFileExtensions { /** * Reads every line from the given InputStream and puts them to the List . * @ param input * The InputStream from where the input comes . * @ param trim * the flag trim if the lines shell be trimed . * @ return The List with all lines from the file . * @ throws IOException * When a io - problem occurs . */ public static List < String > readLinesInList ( final InputStream input , final boolean trim ) throws IOException { } }
// return the list with all lines from the file . return readLinesInList ( input , Charset . forName ( "UTF-8" ) , trim ) ;
public class GraphitePickleWriter { /** * Send given metrics to the Graphite server . */ @ Override public void write ( Iterable < QueryResult > results ) { } }
logger . debug ( "Export to '{}' results {}" , graphiteServerHostAndPort , results ) ; SocketOutputStream socketOutputStream = null ; try { socketOutputStream = socketOutputStreamPool . borrowObject ( graphiteServerHostAndPort ) ; PyList list = new PyList ( ) ; for ( QueryResult result : results ) { String metricName = metricPathPrefix + result . getName ( ) ; int time = ( int ) result . getEpoch ( TimeUnit . SECONDS ) ; PyObject pyValue ; if ( result . getValue ( ) instanceof Integer ) { pyValue = new PyInteger ( ( Integer ) result . getValue ( ) ) ; } else if ( result . getValue ( ) instanceof Long ) { pyValue = new PyLong ( ( Long ) result . getValue ( ) ) ; } else if ( result . getValue ( ) instanceof Float ) { pyValue = new PyFloat ( ( Float ) result . getValue ( ) ) ; } else if ( result . getValue ( ) instanceof Double ) { pyValue = new PyFloat ( ( Double ) result . getValue ( ) ) ; } else if ( result . getValue ( ) instanceof Date ) { pyValue = new PyLong ( TimeUnit . SECONDS . convert ( ( ( Date ) result . getValue ( ) ) . getTime ( ) , TimeUnit . MILLISECONDS ) ) ; } else { pyValue = new PyString ( result . getValue ( ) . toString ( ) ) ; } list . add ( new PyTuple ( new PyString ( metricName ) , new PyTuple ( new PyInteger ( time ) , pyValue ) ) ) ; logger . debug ( "Export '{}': " , metricName , result ) ; } PyString payload = cPickle . dumps ( list ) ; byte [ ] header = ByteBuffer . allocate ( 4 ) . putInt ( payload . __len__ ( ) ) . array ( ) ; socketOutputStream . write ( header ) ; socketOutputStream . write ( payload . toBytes ( ) ) ; socketOutputStream . flush ( ) ; socketOutputStreamPool . returnObject ( graphiteServerHostAndPort , socketOutputStream ) ; } catch ( Exception e ) { logger . warn ( "Failure to send result to graphite server '{}' with {}" , graphiteServerHostAndPort , socketOutputStream , e ) ; if ( socketOutputStream != null ) { try { socketOutputStreamPool . invalidateObject ( graphiteServerHostAndPort , socketOutputStream ) ; } catch ( Exception e2 ) { logger . warn ( "Exception invalidating socketWriter connected to graphite server '{}': {}" , graphiteServerHostAndPort , socketOutputStream , e2 ) ; } } }
public class BitmapUtil { /** * Creates and returns a bitmap from a specific text . The text is centered . * @ param context * The context , which should be used , as an instance of the class { @ link Context } . The * context may not be null * @ param width * The width of the bitmap , which should be created , in pixels as an { @ link Integer } * value * @ param height * The height of the bitmap , which should be created , in pixels as an { @ link Integer } * value * @ param backgroundColor * The background color of the bitmap , which should be created , as an { @ link Integer } * value * @ param text * The text , the bitmap should be created from , as an instance of the type { @ link * CharSequence } . The text may neither be null , nor empty * @ param textSize * The text size , which should be used , in sp as an { @ link Integer } value * @ param textColor * The text color , which should be used , as an { @ link Integer } value The color of the * text * @ param typeface * The typeface , which should be used , as a value of the enum { @ link Typeface } or null , * if the default typeface should be used * @ return The bitmap , which has been created , as an instance of the class { @ link Bitmap } */ public static Bitmap textToBitmap ( @ NonNull final Context context , final int width , final int height , @ ColorInt final int backgroundColor , @ NonNull final CharSequence text , final float textSize , @ ColorInt final int textColor , @ Nullable final Typeface typeface ) { } }
Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; Condition . INSTANCE . ensureNotNull ( text , "The text may not be null" ) ; Condition . INSTANCE . ensureNotEmpty ( text , "The text may not be empty" ) ; Condition . INSTANCE . ensureAtLeast ( textSize , 1 , "The text size must be at least 1" ) ; Bitmap bitmap = colorToBitmap ( width , height , backgroundColor ) ; Canvas canvas = new Canvas ( bitmap ) ; Paint paint = new Paint ( Paint . ANTI_ALIAS_FLAG ) ; paint . setColor ( textColor ) ; paint . setTextSize ( textSize * getDensity ( context ) ) ; paint . setTextAlign ( Align . CENTER ) ; if ( typeface != null ) { paint . setTypeface ( typeface ) ; } int x = bitmap . getWidth ( ) / 2 ; int y = ( int ) ( ( bitmap . getHeight ( ) / 2 ) - ( ( paint . descent ( ) + paint . ascent ( ) ) / 2 ) ) ; canvas . drawText ( text . toString ( ) , x , y , paint ) ; return bitmap ;
public class JsExprUtils { /** * Builds one JS expression that computes the concatenation of the given JS expressions . The ' + ' * operator is used for concatenation . Operands will be protected with an extra pair of * parentheses if and only if needed . * < p > The resulting expression is not guaranteed to be a string if the operands do not produce * strings when combined with the plus operator ; e . g . 2 + 2 might be 4 instead of ' 22 ' . * @ param jsExprs The JS expressions to concatentate . * @ return One JS expression that computes the concatenation of the given JS expressions . */ public static JsExpr concatJsExprs ( List < ? extends JsExpr > jsExprs ) { } }
if ( jsExprs . isEmpty ( ) ) { return EMPTY_STRING ; } if ( jsExprs . size ( ) == 1 ) { return jsExprs . get ( 0 ) ; } int plusOpPrec = Operator . PLUS . getPrecedence ( ) ; StringBuilder resultSb = new StringBuilder ( ) ; boolean isFirst = true ; for ( JsExpr jsExpr : jsExprs ) { // The first operand needs protection only if it ' s strictly lower precedence . The non - first // operands need protection when they ' re lower or equal precedence . ( This is true for all // left - associative operators . ) boolean needsProtection = isFirst ? jsExpr . getPrecedence ( ) < plusOpPrec : jsExpr . getPrecedence ( ) <= plusOpPrec ; if ( isFirst ) { isFirst = false ; } else { resultSb . append ( " + " ) ; } if ( needsProtection ) { resultSb . append ( '(' ) . append ( jsExpr . getText ( ) ) . append ( ')' ) ; } else { resultSb . append ( jsExpr . getText ( ) ) ; } } return new JsExpr ( resultSb . toString ( ) , plusOpPrec ) ;
public class BlockDataHandler { /** * Gets the { @ link ChunkData } for the specified identifier and { @ link BlockPos } * @ param < T > the generic type * @ param identifier the identifier * @ param world the world * @ param pos the pos * @ return the chunk data */ private < T > ChunkData < T > chunkData ( String identifier , World world , BlockPos pos ) { } }
return world != null ? chunkData ( identifier , world , world . getChunkFromBlockCoords ( pos ) ) : null ;
public class DurableLog { /** * region Helpers */ private void ensureRunning ( ) { } }
Exceptions . checkNotClosed ( this . closed . get ( ) , this ) ; if ( state ( ) != State . RUNNING ) { throw new IllegalContainerStateException ( getId ( ) , state ( ) , State . RUNNING ) ; } else if ( isOffline ( ) ) { throw new ContainerOfflineException ( getId ( ) ) ; }
public class Transformation3D { /** * Sets all elements to 0 , thus producing and invalid transformation . */ public void setZero ( ) { } }
xx = 0.0 ; yx = 0.0 ; zx = 0.0 ; xy = 0.0 ; yy = 0.0 ; zy = 0.0 ; xz = 0.0 ; yz = 0.0 ; zz = 0.0 ; xd = 0.0 ; yd = 0.0 ; zd = 0.0 ;
public class CalendarApi { /** * Respond to an event ( asynchronously ) Set your response status to an event * - - - SSO Scope : esi - calendar . respond _ calendar _ events . v1 * @ param characterId * An EVE character ID ( required ) * @ param eventId * The ID of the event requested ( required ) * @ param datasource * The server name you would like data from ( optional , default to * tranquility ) * @ param token * Access token to use if unable to set a header ( optional ) * @ param characterCalendarEvent * ( optional ) * @ param callback * The callback to be executed when the API call finishes * @ return The request call * @ throws ApiException * If fail to process the API call , e . g . serializing the request * body object */ public com . squareup . okhttp . Call putCharactersCharacterIdCalendarEventIdAsync ( Integer characterId , Integer eventId , String datasource , String token , CharacterCalendarEvent characterCalendarEvent , final ApiCallback < Void > callback ) throws ApiException { } }
com . squareup . okhttp . Call call = putCharactersCharacterIdCalendarEventIdValidateBeforeCall ( characterId , eventId , datasource , token , characterCalendarEvent , callback ) ; apiClient . executeAsync ( call , callback ) ; return call ;
public class NumberBackgroundColorTableCellRenderer { /** * Creates the function that returns the cell background color for a * given value . If the value is a number , it will be mapped from * the range ( min , max ) to the range ( 0,1 ) , and the given function * will be used to look up the color based on that value . If the * argument is not a number , then the function will return * < code > null < / code > * @ param min The minimum of the range * @ param max The maximum of the range * @ param colorFunction The function that maps values in the range ( 0,1) * to a color . * @ return The cell color function */ private static Function < Object , ? extends Color > createCellColorFunction ( double min , double max , DoubleFunction < ? extends Color > colorFunction ) { } }
Objects . requireNonNull ( colorFunction , "The colorFunction may not be null" ) ; DoubleUnaryOperator mapping = value -> ( value - min ) / ( max - min ) ; Function < Object , Color > cellColorFunction = object -> { if ( object instanceof Number ) { Number number = ( Number ) object ; double normalized = mapping . applyAsDouble ( number . doubleValue ( ) ) ; Color color = colorFunction . apply ( normalized ) ; return color ; } return null ; } ; return cellColorFunction ;
public class SloppyMath { /** * Returns the minimum of three int values . */ public static int min ( int a , int b , int c ) { } }
int mi ; mi = a ; if ( b < mi ) { mi = b ; } if ( c < mi ) { mi = c ; } return mi ;
public class RestHttpClientImpl { /** * Format the given parameter object into string . */ private String parameterToString ( Object param ) { } }
if ( param == null ) { return "" ; } else if ( param instanceof Date ) { return formatDate ( ( Date ) param ) ; } else if ( param instanceof Collection ) { StringBuilder b = new StringBuilder ( ) ; for ( Object o : ( Collection ) param ) { if ( b . length ( ) > 0 ) { b . append ( "," ) ; } b . append ( String . valueOf ( o ) ) ; } return b . toString ( ) ; } else { return String . valueOf ( param ) ; }