signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class RecyclableArrayList { /** * Create a new empty { @ link RecyclableArrayList } instance with the given capacity . */ public static RecyclableArrayList newInstance ( int minCapacity ) { } }
RecyclableArrayList ret = RECYCLER . get ( ) ; ret . ensureCapacity ( minCapacity ) ; return ret ;
public class DFSInputStream { /** * Get blocks in the specified range . The locations of all blocks * overlapping with the given segment of the file are retrieved . Fetch them * from the namenode if not cached . * @ param offset the offset of the segment to read * @ param length the length of the segment to rea...
List < LocatedBlock > blockRange = new ArrayList < LocatedBlock > ( ) ; // Zero length . Not sure this ever happens in practice . if ( length == 0 ) return blockRange ; // A defensive measure to ensure that we never loop here eternally . // With a 256 M block size , 10000 blocks will correspond to 2.5 TB . // No one sh...
public class SqlInfoBuilder { /** * 根据指定的模式 ` pattern ` 来构建like模糊查询需要的SqlInfo信息 . * @ param fieldText 数据库字段的文本 * @ param pattern like匹配的模式 * @ return sqlInfo */ public SqlInfo buildLikePatternSql ( String fieldText , String pattern ) { } }
this . suffix = StringHelper . isBlank ( this . suffix ) ? ZealotConst . LIKE_KEY : this . suffix ; join . append ( prefix ) . append ( fieldText ) . append ( this . suffix ) . append ( "'" ) . append ( pattern ) . append ( "' " ) ; return sqlInfo . setJoin ( join ) ;
public class HThriftClient { /** * { @ inheritDoc } */ public Cassandra . Client getCassandra ( String keyspaceNameArg ) { } }
getCassandra ( ) ; if ( keyspaceNameArg != null && ! StringUtils . equals ( keyspaceName , keyspaceNameArg ) ) { if ( log . isDebugEnabled ( ) ) log . debug ( "keyspace reseting from {} to {}" , keyspaceName , keyspaceNameArg ) ; try { cassandraClient . set_keyspace ( keyspaceNameArg ) ; } catch ( InvalidRequestExcepti...
public class JobFilePartitioner { /** * Do the actual work . * @ see org . apache . hadoop . util . Tool # run ( java . lang . String [ ] ) */ @ Override public int run ( String [ ] args ) throws Exception { } }
myConf = getConf ( ) ; // Presume this is all HDFS paths , even when access as file : / / hdfs = FileSystem . get ( myConf ) ; // Grab input args and allow for - Dxyz style arguments String [ ] otherArgs = new GenericOptionsParser ( myConf , args ) . getRemainingArgs ( ) ; // Grab the arguments we ' re looking for . Co...
public class ParamConfig { /** * Prepares the parameter ' s datasource , passing it the extra options and if necessary executing the appropriate * code and caching the value . * @ param extra */ public void prepareParameter ( Map < String , Object > extra ) { } }
if ( from != null ) { from . prepareParameter ( extra ) ; }
public class Util { /** * Generate UUID across the entire app and it is used for correlationId . * @ return String correlationId */ public static String getUUID ( ) { } }
UUID id = UUID . randomUUID ( ) ; ByteBuffer bb = ByteBuffer . wrap ( new byte [ 16 ] ) ; bb . putLong ( id . getMostSignificantBits ( ) ) ; bb . putLong ( id . getLeastSignificantBits ( ) ) ; return Base64 . encodeBase64URLSafeString ( bb . array ( ) ) ;
public class LinearClassifierFactor { /** * Returns a vector ( 1 - dimensional tensor ) containing the feature weights used * to predict { @ code outputClass } . { @ code outputClass } must contain a value * for every output variable of this factor . * @ param outputClass * @ return */ public Tensor getFeatureW...
int [ ] classIndexes = getOutputVariables ( ) . assignmentToIntArray ( outputClass ) ; int [ ] dimensionNums = getOutputVariables ( ) . getVariableNumsArray ( ) ; return logWeights . slice ( dimensionNums , classIndexes ) ;
public class DownloadRequestQueue { /** * Perform construction with custom thread pool size . */ private void initialize ( Handler callbackHandler , int threadPoolSize ) { } }
mDownloadDispatchers = new DownloadDispatcher [ threadPoolSize ] ; mDelivery = new CallBackDelivery ( callbackHandler ) ;
public class TaskSchedulerBuilder { /** * Set the prefix to use for the names of newly created threads . * @ param threadNamePrefix the thread name prefix to set * @ return a new builder instance */ public TaskSchedulerBuilder threadNamePrefix ( String threadNamePrefix ) { } }
return new TaskSchedulerBuilder ( this . poolSize , this . awaitTermination , this . awaitTerminationPeriod , threadNamePrefix , this . customizers ) ;
public class ExtensionUtils { /** * find the Require - Bundle name from the specified jar file . */ static private String getRequiredBundles ( File file ) throws IOException { } }
JarFile jar = new JarFile ( file ) ; Attributes attr = jar . getManifest ( ) . getMainAttributes ( ) ; jar . close ( ) ; return attr . getValue ( "Require-Bundle" ) ;
public class FaultFormatTextDecorator { /** * Converts the target fault into a formatted text . * @ see nyla . solutions . core . data . Textable # getText ( ) */ @ Override public String getText ( ) { } }
if ( this . target == null ) return null ; try { // Check if load of template needed if ( ( this . template == null || this . template . length ( ) == 0 ) && this . templateName != null ) { try { this . template = Text . loadTemplate ( templateName ) ; } catch ( Exception e ) { throw new SetupException ( "Cannot load t...
public class ServiceDirectoryClient { /** * Convert the ProvidedServiceInstance Json String to ProvidedServiceInstance . * @ param jsonString * the ProvidedServiceInstance Json String . * @ return * the ProvidedServiceInstance Object . * @ throws JsonParseException * @ throws JsonMappingException * @ thro...
return deserialize ( jsonString . getBytes ( ) , ProvidedServiceInstance . class ) ;
public class Matrix2D { public void print ( ) { } }
int big = ( int ) Math . abs ( Math . max ( max ( Math . abs ( m00 ) , Math . abs ( m01 ) , Math . abs ( m02 ) ) , max ( Math . abs ( m10 ) , Math . abs ( m11 ) , Math . abs ( m12 ) ) ) ) ; int digits = 1 ; if ( Double . isNaN ( big ) || Double . isInfinite ( big ) ) { // avoid infinite loop digits = 5 ; } else { while...
public class HighestValueFilter { /** * ~ Methods * * * * * */ @ Override public List < Metric > filter ( Map < Metric , String > extendedSortedMap , String limit ) { } }
SystemAssert . requireArgument ( extendedSortedMap != null && ! extendedSortedMap . isEmpty ( ) , "New map is not constructed successfully!" ) ; SystemAssert . requireArgument ( limit != null && ! limit . equals ( "" ) , "Limit must be provided!" ) ; List < Metric > result = new ArrayList < Metric > ( ) ; for ( Metric ...
public class EvaluationTools { /** * Given a { @ link ROC } chart , export the ROC chart and precision vs . recall charts to a stand - alone HTML file * @ param roc ROC to export * @ param file File to export to */ public static void exportRocChartsToHtmlFile ( ROC roc , File file ) throws IOException { } }
String rocAsHtml = rocChartToHtml ( roc ) ; FileUtils . writeStringToFile ( file , rocAsHtml ) ;
public class CollectionsDeserializationBenchmark { /** * Benchmark to measure deserializing objects by hand */ public void timeCollectionsStreaming ( int reps ) throws IOException { } }
for ( int i = 0 ; i < reps ; ++ i ) { StringReader reader = new StringReader ( json ) ; JsonReader jr = new JsonReader ( reader ) ; jr . beginArray ( ) ; List < BagOfPrimitives > bags = new ArrayList < BagOfPrimitives > ( ) ; while ( jr . hasNext ( ) ) { jr . beginObject ( ) ; long longValue = 0 ; int intValue = 0 ; bo...
public class SnorocketOWLReasoner { /** * Transforms a { @ link ClassNode } into a { @ link Node } of { @ link OWLClass } es . * @ param n may be null , in which case an empty Node is returned * @ return */ private Node < OWLClass > nodeToOwlClassNode ( au . csiro . ontology . Node n ) { } }
if ( n == null ) return new OWLClassNode ( ) ; final Set < OWLClass > classes = new HashSet < > ( ) ; for ( Object eq : n . getEquivalentConcepts ( ) ) { classes . add ( getOWLClass ( eq ) ) ; } return new OWLClassNode ( classes ) ;
public class ForwardingRuleClient { /** * Changes target URL for forwarding rule . The new target should be of the same type as the old * target . * < p > Sample code : * < pre > < code > * try ( ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient . create ( ) ) { * ProjectRegionForwardingRuleNam...
SetTargetForwardingRuleHttpRequest request = SetTargetForwardingRuleHttpRequest . newBuilder ( ) . setForwardingRule ( forwardingRule ) . setTargetReferenceResource ( targetReferenceResource ) . build ( ) ; return setTargetForwardingRule ( request ) ;
public class CloudSpannerPooledConnection { /** * Gets a handle for a client to use . This is a wrapper around the physical connection , so the * client can call close and it will just return the connection to the pool without really closing * the physical connection . * According to the JDBC 2.0 Optional Package...
if ( con == null ) { // Before throwing the exception , let ' s notify the registered // listeners about the error SQLException sqlException = new CloudSpannerSQLException ( "This PooledConnection has already been closed." , Code . FAILED_PRECONDITION ) ; fireConnectionFatalError ( sqlException ) ; throw sqlException ;...
public class RebalanceTaskInfo { /** * Returns the total count of partitions across all stores . * @ return returns the total count of partitions across all stores . */ public synchronized int getPartitionStoreCount ( ) { } }
int count = 0 ; for ( String store : storeToPartitionIds . keySet ( ) ) { count += storeToPartitionIds . get ( store ) . size ( ) ; } return count ;
public class IdentifierSequences { /** * Returns the last index ( ID count ) returned for a specific * value of the { @ code id } attribute ( without incrementing * the count ) . * @ param id the ID for which the last count will be retrieved * @ return the count */ public Integer getPreviousIDSeq ( final String...
Validate . notNull ( id , "ID cannot be null" ) ; final Integer count = this . idCounts . get ( id ) ; if ( count == null ) { throw new TemplateProcessingException ( "Cannot obtain previous ID count for ID \"" + id + "\"" ) ; } return Integer . valueOf ( count . intValue ( ) - 1 ) ;
public class MapsInner { /** * Gets an integration account map . * @ param resourceGroupName The resource group name . * @ param integrationAccountName The integration account name . * @ param mapName The integration account map name . * @ throws IllegalArgumentException thrown if parameters fail the validation...
return getWithServiceResponseAsync ( resourceGroupName , integrationAccountName , mapName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class ElementFilter { /** * Returns a list of packages in { @ code elements } . * @ return a list of packages in { @ code elements } * @ param elements the elements to filter */ public static List < PackageElement > packagesIn ( Iterable < ? extends Element > elements ) { } }
return listFilter ( elements , PACKAGE_KIND , PackageElement . class ) ;
public class MongoDBFactory { /** * Create a MongoDB client with params . * @ param hosts list of hosts of the form * " mongodb : / / [ username : password @ ] host1 [ : port1 ] [ , host2 [ : port2 ] , . . . [ , hostN [ : portN ] ] ] [ / [ database ] [ ? options ] ] " * @ return MongoDB client * @ see < a href ...
MongoClientURI connectionString = new MongoClientURI ( hosts ) ; return new MongoClient ( connectionString ) ;
public class CreateApplicationRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CreateApplicationRequest createApplicationRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( createApplicationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createApplicationRequest . getApplicationName ( ) , APPLICATIONNAME_BINDING ) ; protocolMarshaller . marshall ( createApplicationRequest . getComputePlatform ( ...
public class CPDefinitionLinkPersistenceImpl { /** * Clears the cache for all cp definition links . * The { @ link EntityCache } and { @ link FinderCache } are both cleared by this method . */ @ Override public void clearCache ( ) { } }
entityCache . clearCache ( CPDefinitionLinkImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ;
public class SwiftConnectionManager { /** * Creates custom retry handler to be used if HTTP exception happens * @ return retry handler */ private HttpRequestRetryHandler getRetryHandler ( ) { } }
final HttpRequestRetryHandler myRetryHandler = new HttpRequestRetryHandler ( ) { public boolean retryRequest ( IOException exception , int executionCount , HttpContext context ) { if ( executionCount >= connectionConfiguration . getExecutionCount ( ) ) { // Do not retry if over max retry count LOG . debug ( "Execution ...
public class HttpOutboundServiceContextImpl { /** * Retrieve the next buffer of the response message ' s body . This will give * the buffer without any modifications , avoiding decompression or chunked * encoding removal . * A null buffer will be returned if there is no more data to get . * The caller is respon...
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "getRawResponseBodyBuffer(sync)" ) ; } setRawBody ( true ) ; WsByteBuffer buffer = getResponseBodyBuffer ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getRawResponseBodyB...
public class XMLRPCClient { /** * Cancel a specific asynchronous call . * @ param id The id of the call as returned by the callAsync method . */ public void cancel ( long id ) { } }
// Lookup the background call for the given id . Caller cancel = backgroundCalls . get ( id ) ; if ( cancel == null ) { return ; } // Cancel the thread cancel . cancel ( ) ; try { // Wait for the thread cancel . join ( ) ; } catch ( InterruptedException ex ) { // Ignore this }
public class CmsADEManager { /** * Saves an element list to the user additional infos . < p > * @ param cms the cms context * @ param elementList the element list * @ param listKey the list key * @ throws CmsException if something goes wrong */ private void saveElementList ( CmsObject cms , List < CmsContainerE...
// limit the favorite list size to avoid the additional info size limit if ( elementList . size ( ) > DEFAULT_ELEMENT_LIST_SIZE ) { elementList = elementList . subList ( 0 , DEFAULT_ELEMENT_LIST_SIZE ) ; } JSONArray data = new JSONArray ( ) ; Set < String > excludedSettings = new HashSet < String > ( ) ; // do not stor...
public class MetadataService { /** * Creates a new { @ link Token } with the specified { @ code appId } , { @ code isAdmin } and an auto - generated * secret . */ public CompletableFuture < Revision > createToken ( Author author , String appId , boolean isAdmin ) { } }
return createToken ( author , appId , SECRET_PREFIX + UUID . randomUUID ( ) , isAdmin ) ;
public class SoundLoader { /** * Read the data from the resource manager . */ protected byte [ ] loadClipData ( String bundle , String path ) throws IOException { } }
InputStream clipin = null ; try { clipin = getSound ( bundle , path ) ; } catch ( FileNotFoundException fnfe ) { // only play the default sound if we have verbose sound debugging turned on . if ( JavaSoundPlayer . _verbose . getValue ( ) ) { log . warning ( "Could not locate sound data" , "bundle" , bundle , "path" , p...
public class SimpleJob { /** * Job { @ link Summarizer } class setting . * @ param clazz { @ link Summarizer } class * @ param combine If true is set the combiner in the Summarizer * @ param cache In - Mapper Combine output cahce number . Default value is 200. * @ return this */ public SimpleJob setSummarizer (...
super . setReducerClass ( clazz ) ; reducer = true ; if ( combine ) { setCombiner ( clazz , cache ) ; } return this ;
public class JavacFileManager { /** * Open a new zip file directory , and cache it . */ private Archive openArchive ( File zipFileName , boolean useOptimizedZip ) throws IOException { } }
File origZipFileName = zipFileName ; if ( symbolFileEnabled && locations . isDefaultBootClassPathRtJar ( zipFileName ) ) { File file = zipFileName . getParentFile ( ) . getParentFile ( ) ; // $ { java . home } if ( new File ( file . getName ( ) ) . equals ( new File ( "jre" ) ) ) file = file . getParentFile ( ) ; // fi...
public class KeePassDatabase { /** * Opens a KeePass database with the given password and keyfile stream and * returns the KeePassFile for further processing . * If the database cannot be decrypted with the provided password and * keyfile stream an exception will be thrown . * @ param password * the password ...
if ( password == null ) { throw new IllegalArgumentException ( MSG_EMPTY_MASTER_KEY ) ; } if ( keyFileStream == null ) { throw new IllegalArgumentException ( "You must provide a non-empty KeePass keyfile stream." ) ; } try { byte [ ] passwordBytes = password . getBytes ( UTF_8 ) ; byte [ ] hashedPassword = Sha256 . has...
public class DocumentIdentifier { /** * The operating system platform . * @ return The operating system platform . * @ see PlatformType */ public java . util . List < String > getPlatformTypes ( ) { } }
if ( platformTypes == null ) { platformTypes = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return platformTypes ;
public class RedshiftDestinationUpdateMarshaller { /** * Marshall the given parameter object . */ public void marshall ( RedshiftDestinationUpdate redshiftDestinationUpdate , ProtocolMarshaller protocolMarshaller ) { } }
if ( redshiftDestinationUpdate == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( redshiftDestinationUpdate . getRoleARN ( ) , ROLEARN_BINDING ) ; protocolMarshaller . marshall ( redshiftDestinationUpdate . getClusterJDBCURL ( ) , CLUSTERJDB...
public class ListeFilme { /** * Get the age of the film list . * @ return Age in seconds . */ public int getAge ( ) { } }
int ret = 0 ; Date now = new Date ( System . currentTimeMillis ( ) ) ; Date filmDate = getAgeAsDate ( ) ; if ( filmDate != null ) { ret = Math . round ( ( now . getTime ( ) - filmDate . getTime ( ) ) / ( 1000 ) ) ; if ( ret < 0 ) { ret = 0 ; } } return ret ;
public class ASegment { /** * get the next punctuation pair word from the current position * of the input stream . * @ param c * @ param pos * @ return IWord could be null and that mean we reached a stop word * @ throws IOException */ protected IWord getNextPunctuationPairWord ( int c , int pos ) throws IOExc...
IWord w = null , w2 = null ; String text = getPairPunctuationText ( c ) ; // handle the punctuation . String str = String . valueOf ( ( char ) c ) ; if ( ! ( config . CLEAR_STOPWORD && dic . match ( ILexicon . STOP_WORD , str ) ) ) { w = new Word ( str , IWord . T_PUNCTUATION ) ; w . setPartSpeech ( IWord . PUNCTUATION...
public class DBInitializerHelper { /** * Returns path where SQL scripts for database initialization is stored . */ public static String scriptPath ( String dbDialect , boolean multiDb ) { } }
String suffix = multiDb ? "m" : "s" ; String sqlPath = null ; if ( dbDialect . startsWith ( DBConstants . DB_DIALECT_ORACLE ) ) { sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.ora.sql" ; } else if ( dbDialect . startsWith ( DBConstants . DB_DIALECT_PGSQL ) ) { sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.pgsql.sql...
public class Environment { /** * to be used with Runtime . exec ( String [ ] cmdarray , String [ ] envp ) */ String [ ] toArray ( ) { } }
String [ ] arr = new String [ super . size ( ) ] ; Enumeration it = super . keys ( ) ; int i = - 1 ; while ( it . hasMoreElements ( ) ) { String key = ( String ) it . nextElement ( ) ; String val = ( String ) get ( key ) ; i ++ ; arr [ i ] = key + "=" + val ; } return arr ;
public class BagArrayFrom { /** * from a resource , with the mime type specified */ static public BagArray resource ( Class context , String name ) { } }
return resource ( context , name , ( ) -> null ) ;
public class Block { /** * The type of entity . The following can be returned : * < ul > * < li > * < i > KEY < / i > - An identifier for a field on the document . * < / li > * < li > * < i > VALUE < / i > - The field text . * < / li > * < / ul > * < code > EntityTypes < / code > isn ' t returned by <...
if ( this . entityTypes == null ) { setEntityTypes ( new java . util . ArrayList < String > ( entityTypes . length ) ) ; } for ( String ele : entityTypes ) { this . entityTypes . add ( ele ) ; } return this ;
public class TaskStatus { /** * Update the status of the task . * @ param status updated status */ synchronized void statusUpdate ( TaskStatus status ) { } }
setProgress ( status . getProgress ( ) ) ; this . runState = status . getRunState ( ) ; this . stateString = status . getStateString ( ) ; this . nextRecordRange = status . getNextRecordRange ( ) ; setDiagnosticInfo ( status . getDiagnosticInfo ( ) ) ; if ( status . getStartTime ( ) > 0 ) { this . startTime = status . ...
public class TransliteratorParser { /** * Return true if the given rule looks like a pragma . * @ param pos offset to the first non - whitespace character * of the rule . * @ param limit pointer past the last character of the rule . */ static boolean resemblesPragma ( String rule , int pos , int limit ) { } }
// Must start with / use \ s / i return Utility . parsePattern ( rule , pos , limit , "use " , null ) >= 0 ;
public class ApplicationScoreService { /** * Process scores for each widget based on widget settings * @ param widgets List of widgets * @ param scoreCriteriaSettings Score Criteria Settings * @ return List of widget scores */ private List < ScoreWeight > processWidgetScores ( List < Widget > widgets , ScoreCrite...
List < ScoreWeight > scoreWeights = new ArrayList < > ( ) ; Map < String , ScoreComponentSettings > scoreParamSettingsMap = generateWidgetSettings ( scoreCriteriaSettings ) ; Set < String > widgetTypes = scoreParamSettingsMap . keySet ( ) ; if ( widgetTypes . isEmpty ( ) ) { return null ; } // For each widget calculate...
public class FacesConfigTypeImpl { /** * Returns all < code > navigation - rule < / code > elements * @ return list of < code > navigation - rule < / code > */ public List < FacesConfigNavigationRuleType < FacesConfigType < T > > > getAllNavigationRule ( ) { } }
List < FacesConfigNavigationRuleType < FacesConfigType < T > > > list = new ArrayList < FacesConfigNavigationRuleType < FacesConfigType < T > > > ( ) ; List < Node > nodeList = childNode . get ( "navigation-rule" ) ; for ( Node node : nodeList ) { FacesConfigNavigationRuleType < FacesConfigType < T > > type = new Faces...
public class CloudPlatform { /** * IoT Connector configuration */ @ Bean AMQPComponent amqp ( @ Value ( "${AMQP_SERVICE_HOST:localhost}" ) String amqpBrokerUrl , @ Value ( "${AMQP_SERVICE_PORT:5672}" ) int amqpBrokerPort ) throws MalformedURLException { } }
LOG . debug ( "About to create AMQP component {}:{}" , amqpBrokerUrl , amqpBrokerPort ) ; return amqp10Component ( "amqp://" + amqpBrokerUrl + ":" + amqpBrokerPort ) ;
public class SSHLauncher { public String logConfiguration ( ) { } }
final StringBuilder sb = new StringBuilder ( "SSHLauncher{" ) ; sb . append ( "host='" ) . append ( getHost ( ) ) . append ( '\'' ) ; sb . append ( ", port=" ) . append ( getPort ( ) ) ; sb . append ( ", credentialsId='" ) . append ( Util . fixNull ( credentialsId ) ) . append ( '\'' ) ; sb . append ( ", jvmOptions='" ...
public class UnorderedCollection { /** * Swaps the contents of this { @ link UnorderedCollection } with another one storing the same elements . This operation * runs in constant time , by only swapping storage references . * @ param other * the { @ link UnorderedCollection } to swap contents with . */ public void...
int sizeTmp = size ; size = other . size ; other . size = sizeTmp ; storage . swap ( other . storage ) ;
public class SnowflakeAzureClient { /** * Handles exceptions thrown by Azure Storage * It will retry transient errors as defined by the Azure Client retry policy * It will re - create the client if the SAS token has expired , and re - try * @ param ex the exception to handle * @ param retryCount current number ...
// no need to retry if it is invalid key exception if ( ex . getCause ( ) instanceof InvalidKeyException ) { // Most likely cause is that the unlimited strength policy files are not installed // Log the error and throw a message that explains the cause SnowflakeFileTransferAgent . throwJCEMissingError ( operation , ex ...
public class ByteArrayDiskQueue { /** * Creates a new disk - based queue of byte arrays using an existing file . * < p > Note that you have to supply the correct number of byte arrays contained in the dump file of * the underlying { @ link ByteDiskQueue } . Failure to do so will cause unpredictable behaviour . * ...
final ByteArrayDiskQueue byteArrayDiskQueue = new ByteArrayDiskQueue ( ByteDiskQueue . createFromFile ( file , bufferSize , direct ) ) ; byteArrayDiskQueue . size = size ; return byteArrayDiskQueue ;
public class DeltaT { /** * Estimate Delta T for the given Calendar . This is based on Espenak and Meeus , " Five Millennium Canon of * Solar Eclipses : - 1999 to + 3000 " ( NASA / TP - 2006-214141 ) . * @ param forDate date and time * @ return estimated delta T value ( seconds ) */ public static double estimate ...
final double year = decimalYear ( forDate ) ; final double deltaT ; if ( year < - 500 ) { double u = ( year - 1820 ) / 100 ; deltaT = - 20 + 32 * pow ( u , 2 ) ; } else if ( year < 500 ) { double u = year / 100 ; deltaT = 10583.6 - 1014.41 * u + 33.78311 * pow ( u , 2 ) - 5.952053 * pow ( u , 3 ) - 0.1798452 * pow ( u ...
public class MavenModelScannerPlugin { /** * Adds declared and managed dependencies to the given * { @ link MavenDependentDescriptor } . * @ param dependentDescriptor * The { @ link MavenDependentDescriptor } . * @ param model * The { @ link ModelBase } providing the dependencies . * @ param scannerContext ...
dependentDescriptor . getDeclaresDependencies ( ) . addAll ( getDependencies ( dependentDescriptor , model . getDependencies ( ) , declaresDependencyType , scannerContext ) ) ; dependentDescriptor . getManagesDependencies ( ) . addAll ( addManagedDependencies ( dependentDescriptor , model . getDependencyManagement ( ) ...
public class Tags { /** * Parses an optional metric and tags out of the given string , any of * which may be null . Requires at least one metric , tagk or tagv . * @ param metric A string of the form " metric " or " metric { tag = value , . . . } " * or even " { tag = value , . . . } " where the metric may be mis...
final int curly = metric . indexOf ( '{' ) ; if ( curly < 0 ) { if ( metric . isEmpty ( ) ) { throw new IllegalArgumentException ( "Metric string was empty" ) ; } return metric ; } final int len = metric . length ( ) ; if ( metric . charAt ( len - 1 ) != '}' ) { // " foo { " throw new IllegalArgumentException ( "Missin...
public class RpcWrapper { /** * Make the call to a specified IP address . * @ param request * The request to send . * @ param response * A response to hold the returned data . * @ param ipAddress * The IP address to use for communication . * @ throws RpcException */ public void callRpcNaked ( S request , ...
Xdr xdr = new Xdr ( _maximumRequestSize ) ; request . marshalling ( xdr ) ; response . unmarshalling ( callRpc ( ipAddress , xdr , request . isUsePrivilegedPort ( ) ) ) ;
public class RC4 { /** * 加密或解密指定值 , 调用此方法前需初始化密钥 * @ param msg 要加密或解密的消息 * @ return 加密或解密后的值 */ public byte [ ] crypt ( final byte [ ] msg ) { } }
final ReadLock readLock = this . lock . readLock ( ) ; readLock . lock ( ) ; byte [ ] code ; try { final int [ ] sbox = this . sbox . clone ( ) ; code = new byte [ msg . length ] ; int i = 0 ; int j = 0 ; for ( int n = 0 ; n < msg . length ; n ++ ) { i = ( i + 1 ) % SBOX_LENGTH ; j = ( j + sbox [ i ] ) % SBOX_LENGTH ; ...
public class VirtualMachineExtensionImagesInner { /** * Gets a virtual machine extension image . * @ param location The name of a supported Azure region . * @ param publisherName the String value * @ param type the String value * @ param version the String value * @ throws IllegalArgumentException thrown if p...
if ( location == null ) { throw new IllegalArgumentException ( "Parameter location is required and cannot be null." ) ; } if ( publisherName == null ) { throw new IllegalArgumentException ( "Parameter publisherName is required and cannot be null." ) ; } if ( type == null ) { throw new IllegalArgumentException ( "Parame...
public class RegExHelper { /** * Convert an identifier to a programming language identifier by replacing all * non - word characters with an underscore . * @ param s * The string to convert . May be < code > null < / code > or empty . * @ param sReplacement * The replacement string to be used for all non - id...
ValueEnforcer . notNull ( sReplacement , "Replacement" ) ; if ( StringHelper . hasNoText ( s ) ) return s ; // replace all non - word characters with the replacement character // Important : replacement does not need to be quoted , because it is not // treated as a regular expression ! final String ret = stringReplaceP...
public class AbstractVFState { /** * { @ inheritDoc } */ @ Override final void remove ( int n , int m ) { } }
m1 [ n ] = m2 [ m ] = UNMAPPED ; size = size - 1 ; for ( int w : g1 [ n ] ) if ( t1 [ w ] > size ) t1 [ w ] = 0 ; for ( int w : g2 [ m ] ) if ( t2 [ w ] > size ) t2 [ w ] = 0 ;
public class EncodingImpl { /** * { @ inheritDoc } */ @ Override public Encoding addHeader ( String key , Header header ) { } }
if ( header == null ) { return this ; } if ( this . headers == null ) { this . headers = new HashMap < > ( ) ; } this . headers . put ( key , header ) ; return this ;
public class IPv4PacketImpl { /** * Algorithm adopted from RFC 1071 - Computing the Internet Checksum * @ return */ private int calculateChecksum ( ) { } }
long sum = 0 ; for ( int i = 0 ; i < this . headers . capacity ( ) - 1 ; i += 2 ) { if ( i != 10 ) { sum += this . headers . getUnsignedShort ( i ) ; } } while ( sum >> 16 != 0 ) { sum = ( sum & 0xffff ) + ( sum >> 16 ) ; } return ( int ) ~ sum & 0xFFFF ;
public class AmazonSimpleEmailServiceClient { /** * Returns the custom MAIL FROM attributes for a list of identities ( email addresses : domains ) . * This operation is throttled at one request per second and can only get custom MAIL FROM attributes for up to 100 * identities at a time . * @ param getIdentityMail...
request = beforeClientExecution ( request ) ; return executeGetIdentityMailFromDomainAttributes ( request ) ;
public class StatusPanel { /** * Creates the default pane . */ @ Override public void afterInitialized ( BaseComponent comp ) { } }
super . afterInitialized ( comp ) ; createLabel ( "default" ) ; getEventManager ( ) . subscribe ( EventUtil . STATUS_EVENT , this ) ;
public class JAXBUtils { /** * Converts an XML name to a Java identifier according to the mapping * algorithm outlined in the JAXB specification * @ param name the XML name * @ return the Java identifier */ public static String nameToIdentifier ( String name , IdentifierType type ) { } }
if ( null == name || name . length ( ) == 0 ) { return name ; } // algorithm will not change an XML name that is already a legal and // conventional ( ! ) Java class , method , or constant identifier boolean legalIdentifier = false ; StringBuilder buf = new StringBuilder ( name ) ; boolean hasUnderscore = false ; legal...
public class StoredServerChannel { /** * Gets the canonical { @ link PaymentChannelServerState } object for this channel , either by returning an existing one * or by creating a new one . * @ param wallet The wallet which holds the { @ link PaymentChannelServerState } in which this is saved and which will * be us...
if ( state == null ) { switch ( majorVersion ) { case 1 : state = new PaymentChannelV1ServerState ( this , wallet , broadcaster ) ; break ; case 2 : state = new PaymentChannelV2ServerState ( this , wallet , broadcaster ) ; break ; default : throw new IllegalStateException ( "Invalid version number found" ) ; } } checkA...
public class SCMDescriptor { /** * Returns the list of { @ link RepositoryBrowser } { @ link Descriptor } * that can be used with this SCM . * @ return * can be empty but never null . */ public List < Descriptor < RepositoryBrowser < ? > > > getBrowserDescriptors ( ) { } }
if ( repositoryBrowser == null ) return Collections . emptyList ( ) ; return RepositoryBrowsers . filter ( repositoryBrowser ) ;
public class JSONArray { /** * Get the object value associated with an index . * @ param index The index must be between 0 and length ( ) - 1. * @ return An object value . * @ throws JSONException If there is no value for the index . */ public Object get ( int index ) { } }
Object o = opt ( index ) ; if ( o == null ) { throw new RuntimeException ( new JSONException ( "JSONArray[" + index + "] not found." ) ) ; } return o ;
public class Logging { /** * Given to TANGO logging level , converts it to lo4j level */ public Level tango_to_log4j_level ( String level ) { } }
level = level . toUpperCase ( ) ; if ( level . equals ( LOGGING_LEVELS [ LOGGING_OFF ] ) ) { return Level . OFF ; } if ( level . equals ( LOGGING_LEVELS [ LOGGING_FATAL ] ) ) { return Level . FATAL ; } if ( level . equals ( LOGGING_LEVELS [ LOGGING_ERROR ] ) ) { return Level . ERROR ; } if ( level . equals ( LOGGING_LE...
public class AbstractResultSetWrapper { /** * { @ inheritDoc } * @ see java . sql . ResultSet # updateArray ( java . lang . String , java . sql . Array ) */ @ Override public void updateArray ( final String columnLabel , final Array x ) throws SQLException { } }
wrapped . updateArray ( columnLabel , x ) ;
public class WsMessagePullParser { /** * Returns the next binary message received on this connection . This method * will block till a binar message is received . Any text messages that may * arrive will be ignored . A null is returned when the connection is closed . * An IOException is thrown if the connection h...
WebSocketMessageType msgType = null ; while ( ( msgType = _messageReader . next ( ) ) != WebSocketMessageType . EOS ) { if ( msgType == WebSocketMessageType . BINARY ) { return _messageReader . getBinary ( ) ; } } return null ;
public class IOUtils { /** * Convert either a file or jar url into a local canonical file , or null if the file is a different scheme . * @ param fileURL the url to resolve to a canonical file . * @ return null if given URL is null , not using the jar scheme , or not using the file scheme . Otherwise , returns the ...
if ( fileURL == null ) { return null ; } // Only handle jar : and file : schemes if ( ! "jar" . equals ( fileURL . getProtocol ( ) ) && ! "file" . equals ( fileURL . getProtocol ( ) ) ) { return null ; } // Parse the jar file location from the jar url . Doesn ' t open any resources . if ( "jar" . equals ( fileURL . get...
public class Postcard { public void pushLogging ( String key , Object value ) { } }
assertArgumentNotNull ( "key" , key ) ; assertArgumentNotNull ( "value" , value ) ; if ( pushedLoggingMap == null ) { pushedLoggingMap = new LinkedHashMap < String , Object > ( 4 ) ; } pushedLoggingMap . put ( key , value ) ;
public class CassandraDefs { /** * Create a SlicePredicate that selects a single column . * @ param colName Column name as a byte [ ] . * @ return SlicePredicate that select the given column name only . */ static SlicePredicate slicePredicateColName ( byte [ ] colName ) { } }
SlicePredicate slicePred = new SlicePredicate ( ) ; slicePred . addToColumn_names ( ByteBuffer . wrap ( colName ) ) ; return slicePred ;
public class SubtitleChatOverlay { /** * Update the chat glyphs in the specified list to be set to the current dimmed setting . */ protected void updateDimmed ( List < ? extends ChatGlyph > glyphs ) { } }
for ( ChatGlyph glyph : glyphs ) { glyph . setDim ( _dimmed ) ; }
public class TraceEventHelper { /** * Is end state * @ param te The event * @ return The value */ public static boolean isEndState ( TraceEvent te ) { } }
if ( te . getType ( ) == TraceEvent . RETURN_CONNECTION_LISTENER || te . getType ( ) == TraceEvent . RETURN_CONNECTION_LISTENER_WITH_KILL || te . getType ( ) == TraceEvent . RETURN_INTERLEAVING_CONNECTION_LISTENER || te . getType ( ) == TraceEvent . RETURN_INTERLEAVING_CONNECTION_LISTENER_WITH_KILL || te . getType ( ) ...
public class HealthCheckRegistry { /** * Runs the registered health checks in parallel and returns a map of the results . * @ param executor object to launch and track health checks progress * @ return a map of the health check results */ public SortedMap < String , HealthCheck . Result > runHealthChecks ( Executor...
return runHealthChecks ( executor , HealthCheckFilter . ALL ) ;
public class MultiFormatParser { /** * / * [ deutsch ] * < p > Erzeugt einen neuen Multiformatinterpretierer . < / p > * @ param < T > generic type of chronological entity * @ param formats array of multiple formats * @ return new immutable instance of MultiFormatParser * @ since 3.14/4.11 */ @ SafeVarargs pu...
ChronoFormatter < T > [ ] parsers = Arrays . copyOf ( formats , formats . length ) ; return new MultiFormatParser < > ( parsers ) ;
public class Sftp { /** * 获取远程文件 * @ param src 远程文件路径 * @ param dest 目标文件路径 * @ return this */ public Sftp get ( String src , String dest ) { } }
try { channel . get ( src , dest ) ; } catch ( SftpException e ) { throw new JschRuntimeException ( e ) ; } return this ;
public class BloodhoundDatum { /** * Utility method to get all tokens from a single value * @ param sValue * The value to use . May not be < code > null < / code > . * @ return An array of tokens to use . Never < code > null < / code > . */ @ Nonnull public static String [ ] getTokensFromValue ( @ Nonnull final S...
return RegExHelper . getSplitToArray ( StringHelper . trim ( sValue ) , "\\W+" ) ;
public class OComparatorFactory { /** * Returns { @ link Comparator } instance if applicable one exist or < code > null < / code > otherwise . * @ param clazz * Class of object that is going to be compared . * @ param < T > * Class of object that is going to be compared . * @ return { @ link Comparator } inst...
if ( clazz . equals ( byte [ ] . class ) ) { if ( unsafeWasDetected ) return ( Comparator < T > ) OUnsafeByteArrayComparator . INSTANCE ; return ( Comparator < T > ) OByteArrayComparator . INSTANCE ; } return null ;
public class TokenFilter { /** * Given an arbitrary map containing String values , replace each non - null * value with the corresponding filtered value . * @ param map * The map whose values should be filtered . */ public void filterValues ( Map < ? , String > map ) { } }
// For each map entry for ( Map . Entry < ? , String > entry : map . entrySet ( ) ) { // If value is non - null , filter value through this TokenFilter String value = entry . getValue ( ) ; if ( value != null ) entry . setValue ( filter ( value ) ) ; }
public class TapeArchiveMarshaller { /** * Marshall the given parameter object . */ public void marshall ( TapeArchive tapeArchive , ProtocolMarshaller protocolMarshaller ) { } }
if ( tapeArchive == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( tapeArchive . getTapeARN ( ) , TAPEARN_BINDING ) ; protocolMarshaller . marshall ( tapeArchive . getTapeBarcode ( ) , TAPEBARCODE_BINDING ) ; protocolMarshaller . marshall (...
public class Contextualizer { /** * Contextualizes operation with contexts given by { @ link OperationalContext } which is given by provided * { @ link OperationalContextRetriver } * @ param retriever the context retriever * @ param instance the instance to wrap ( must comply with given interface ) * @ param in...
return ( T ) Proxy . newProxyInstance ( instance . getClass ( ) . getClassLoader ( ) , new Class < ? > [ ] { interfaze } , new InvocationHandler ( ) { public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { OperationalContext context = retriver . retrieve ( ) ; context . activate ( ) ...
public class EvaluatorSetupHelper { /** * Assembles the configuration for an Evaluator . * @ param resourceLaunchEvent * @ return * @ throws IOException */ private Configuration makeEvaluatorConfiguration ( final ResourceLaunchEvent resourceLaunchEvent ) throws IOException { } }
return Tang . Factory . getTang ( ) . newConfigurationBuilder ( resourceLaunchEvent . getEvaluatorConf ( ) ) . build ( ) ;
public class GLINERGImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case AfplibPackage . GLINERG__XPOS : return getXPOS ( ) ; case AfplibPackage . GLINERG__YPOS : return getYPOS ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class BackupManagerImpl { /** * { @ inheritDoc } */ public void restoreExistingWorkspace ( File workspaceBackupSetDir , boolean asynchronous ) throws BackupOperationException , BackupConfigurationException { } }
File [ ] cfs = PrivilegedFileHelper . listFiles ( workspaceBackupSetDir , new BackupLogsFilter ( ) ) ; if ( cfs . length == 0 ) { throw new BackupConfigurationException ( "Can not found workspace backup log in directory : " + workspaceBackupSetDir . getPath ( ) ) ; } if ( cfs . length > 1 ) { throw new BackupConfigurat...
public class DeleteProcedureDescriptor { /** * @ see XmlCapable # toXML ( ) */ public String toXML ( ) { } }
RepositoryTags tags = RepositoryTags . getInstance ( ) ; String eol = System . getProperty ( "line.separator" ) ; // The result StringBuffer result = new StringBuffer ( 1024 ) ; result . append ( eol ) ; result . append ( " " ) ; // Opening tag and attributes result . append ( " " ) ; result . append ( tags . getOpen...
public class JsonObject { /** * Returns the value mapped by { @ code name } if it exists and is a { @ code * JsonObject } , or null otherwise . */ public JsonObject optJsonObject ( String name ) { } }
JsonElement el = null ; try { el = get ( name ) ; } catch ( JsonException e ) { return null ; } if ( ! el . isJsonObject ( ) ) { return null ; } return el . asJsonObject ( ) ;
public class MessageProcessorControl { /** * / * ( non - Javadoc ) * @ see com . ibm . ws . sib . processor . runtime . MessageProcessorControllable # getVirtualLinkByID ( java . lang . String ) */ public SIMPVirtualLinkControllable getVirtualLinkByName ( String name ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getVirtualLinkByName" , new Object [ ] { name } ) ; LinkHandler link = destinationManager . getLink ( name ) ; // See if the controllable is in the preReconstituted cache VirtualLinkControl control = ( VirtualLinkControl ) ...
public class BsonObjectTraversingParser { /** * / * Closeable implementation */ @ Override public void close ( ) throws IOException { } }
if ( ! closed ) { closed = true ; nodeCursor = null ; _currToken = null ; }
public class DFSOutputStream { /** * All data is written out to datanodes . It is not guaranteed * that data has been flushed to persistent store on the * datanode . Block allocations are persisted on namenode . */ public void sync ( ) throws IOException { } }
long start = System . currentTimeMillis ( ) ; try { long toWaitFor ; synchronized ( this ) { eventStartSync ( ) ; /* Record current blockOffset . This might be changed inside * flushBuffer ( ) where a partial checksum chunk might be flushed . * After the flush , reset the bytesCurBlock back to its previous value , ...
public class ChannelUpdateHandler { /** * Handles a server channel update . * @ param jsonChannel The channel data . */ private void handleServerChannel ( JsonNode jsonChannel ) { } }
long channelId = jsonChannel . get ( "id" ) . asLong ( ) ; long guildId = jsonChannel . get ( "guild_id" ) . asLong ( ) ; ServerImpl server = api . getPossiblyUnreadyServerById ( guildId ) . map ( ServerImpl . class :: cast ) . orElse ( null ) ; if ( server == null ) { return ; } ServerChannelImpl channel = server . ge...
public class BaseBuffer { /** * Constructor . * @ param data The physical data to initialize this buffer to ( optional ) . * @ param iFieldTypes The default field types to cache . */ public void init ( Object data , int iFieldsTypes ) { } }
if ( data == null ) this . clearBuffer ( ) ; else { m_iHeaderCount = 0 ; this . setPhysicalData ( data ) ; this . resetPosition ( ) ; } m_iFieldsTypes = iFieldsTypes ; // Default - assume all fields ( call bufferToFields ( xxx , false ) if not )
public class CompareRetinaApiImpl { /** * { @ inheritDoc } */ @ Override public Metric compare ( String jsonModel1 , Model model2 ) throws JsonProcessingException , ApiException { } }
validateRequiredModels ( model2 ) ; LOG . debug ( "Compare models: model1: " + jsonModel1 + " model: " + model2 . toJson ( ) ) ; return compareApi . compare ( "[ " + jsonModel1 + ", " + model2 . toJson ( ) + " ]" , this . retinaName ) ;
public class Engine { /** * Configures the engine with clones of the given operators . * @ param conjunction is the operator to process the propositions joined by * ` and ` in the antecedent of the rules * @ param disjunction is the operator to process the propositions joined by * ` or ` in the antecedent of th...
try { for ( RuleBlock ruleblock : this . ruleBlocks ) { ruleblock . setConjunction ( conjunction == null ? null : conjunction . clone ( ) ) ; ruleblock . setDisjunction ( disjunction == null ? null : disjunction . clone ( ) ) ; ruleblock . setImplication ( implication == null ? null : implication . clone ( ) ) ; rulebl...
public class EDIImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case AfplibPackage . EDI__INDX_NAME : setIndxName ( ( String ) newValue ) ; return ; case AfplibPackage . EDI__TRIPLETS : getTriplets ( ) . clear ( ) ; getTriplets ( ) . addAll ( ( Collection < ? extends Triplet > ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class EntityInfo { /** * 获取Entity的DELETE SQL * @ param bean Entity对象 * @ return String */ public String getDeletePrepareSQL ( T bean ) { } }
if ( this . tableStrategy == null ) return deletePrepareSQL ; return deletePrepareSQL . replace ( "${newtable}" , getTable ( bean ) ) ;
public class BookKeeperServiceRunner { /** * Resumes ZooKeeper ( if it had previously been suspended ) . * @ throws Exception If an exception got thrown . */ public void resumeZooKeeper ( ) throws Exception { } }
val zk = new ZooKeeperServiceRunner ( this . zkPort , this . secureZK , this . tLSKeyStore , this . tLSKeyStorePasswordPath , this . tlsTrustStore ) ; if ( this . zkServer . compareAndSet ( null , zk ) ) { // Initialize ZK runner ( since nobody else did it for us ) . zk . initialize ( ) ; log . info ( "ZooKeeper initia...