signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class MultiBackgroundInitializer { /** * Returns the number of tasks needed for executing all child { @ code * BackgroundInitializer } objects in parallel . This implementation sums up * the required tasks for all child initializers ( which is necessary if one * of the child initializers is itself a { @ co...
int result = 1 ; for ( final BackgroundInitializer < ? > bi : childInitializers . values ( ) ) { result += bi . getTaskCount ( ) ; } return result ;
public class JaxbUtils { /** * Creates an XMLStreamReader based on an input stream . * @ param is the input stream from which the data to be parsed will be taken * @ param namespaceAware if { @ code false } the XMLStreamReader will remove all namespaces from all * XML elements * @ return platform - specific XML...
XMLInputFactory xif = getXmlInputFactory ( namespaceAware ) ; XMLStreamReader xsr = null ; try { xsr = xif . createXMLStreamReader ( is ) ; } catch ( XMLStreamException e ) { throw new JAXBException ( e ) ; } return xsr ;
public class AppsImpl { /** * Gets the endpoint URLs for the prebuilt Cortana applications . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PersonalAssistantsResponse object */ public Observable < ServiceResponse < PersonalAssistantsResponse > > listCor...
if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } String parameterizedHost = Joiner . on ( ", " ) . join ( "{Endpoint}" , this . client . endpoint ( ) ) ; return service . listCortanaEndpoints ( this . client . acc...
public class Cache { /** * Add objects . * @ param obj the obj */ @ Override public void add ( ApiType obj ) { } }
String key = keyFunc . apply ( obj ) ; lock . lock ( ) ; try { ApiType oldObj = this . items . get ( key ) ; this . items . put ( key , obj ) ; this . updateIndices ( oldObj , obj , key ) ; } finally { lock . unlock ( ) ; }
public class EmailUtils { /** * Send a job cancellation notification email . * @ param jobId job name * @ param message email message * @ param jobState a { @ link State } object carrying job configuration properties * @ throws EmailException if there is anything wrong sending the email */ public static void se...
sendEmail ( jobState , String . format ( "Gobblin notification: job %s has been cancelled" , jobId ) , message ) ;
public class SpringInstanceProvider { /** * 返回指定类型的实例 。 * @ param beanClass 实例的类型 * @ return 指定类型的实例 。 */ @ SuppressWarnings ( "unchecked" ) public < T > T getInstance ( Class < T > beanClass ) { } }
String [ ] beanNames = applicationContext . getBeanNamesForType ( beanClass ) ; if ( beanNames . length == 0 ) { return null ; } return ( T ) applicationContext . getBean ( beanNames [ 0 ] ) ;
public class Shape { /** * Convert a linear index to * the equivalent nd index based on the shape of the specified ndarray . * Infers the number of indices from the specified shape . * @ param arr the array to compute the indexes * based on * @ param index the index to map * @ return the mapped indexes alon...
if ( arr . rank ( ) == 1 ) return new long [ ] { index } ; return ind2subC ( arr . shape ( ) , index , ArrayUtil . prodLong ( arr . shape ( ) ) ) ;
public class ServerCache { /** * Since the cache instances are stored with key as cacheName , it has to change default cache JNDI name to internal * cache name . */ @ Trivial public static String normalizeCacheName ( String cacheName , CacheConfig cacheConfig ) { } }
String tempCacheName = cacheName ; if ( cacheName . equalsIgnoreCase ( DCacheBase . DEFAULT_BASE_JNDI_NAME ) ) { tempCacheName = DCacheBase . DEFAULT_CACHE_NAME ; } else if ( cacheName . equalsIgnoreCase ( DCacheBase . DEFAULT_DMAP_JNDI_NAME ) ) { tempCacheName = DCacheBase . DEFAULT_DISTRIBUTED_MAP_NAME ; } // Make su...
public class JobSchedulesImpl { /** * Gets information about the specified job schedule . * @ param jobScheduleId The ID of the job schedule to get . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the va...
return ServiceFuture . fromHeaderResponse ( getWithServiceResponseAsync ( jobScheduleId ) , serviceCallback ) ;
public class ForeignDestination { /** * / * ( non - Javadoc ) * @ see com . ibm . ws . sib . processor . runtime . SIMPMessageHandlerControllable # isLocal ( ) */ public boolean isLocal ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isLocal" ) ; boolean isLocal = false ; if ( foreignDest . getResolvedDestinationHandler ( ) . getLocalLocalizationPoint ( ) != null ) isLocal = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( )...
public class ElemNumber { /** * Given a ' from ' pattern ( ala xsl : number ) , a match pattern * and a context , find the first ancestor that matches the * pattern ( including the context handed in ) . * @ param xctxt The XPath runtime state for this . * @ param fromMatchPattern The ancestor must match this pa...
DTM dtm = xctxt . getDTM ( context ) ; while ( DTM . NULL != context ) { if ( null != fromMatchPattern ) { if ( fromMatchPattern . getMatchScore ( xctxt , context ) != XPath . MATCH_SCORE_NONE ) { // context = null ; break ; } } if ( null != countMatchPattern ) { if ( countMatchPattern . getMatchScore ( xctxt , context...
public class ExtensionList { /** * Used to bind extension to URLs by their class names . * @ since 1.349 */ public T getDynamic ( String className ) { } }
for ( T t : this ) if ( t . getClass ( ) . getName ( ) . equals ( className ) ) return t ; return null ;
public class ListEntitiesDetectionJobsResult { /** * A list containing the properties of each job that is returned . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setEntitiesDetectionJobPropertiesList ( java . util . Collection ) } or * { @ link # withEnt...
if ( this . entitiesDetectionJobPropertiesList == null ) { setEntitiesDetectionJobPropertiesList ( new java . util . ArrayList < EntitiesDetectionJobProperties > ( entitiesDetectionJobPropertiesList . length ) ) ; } for ( EntitiesDetectionJobProperties ele : entitiesDetectionJobPropertiesList ) { this . entitiesDetecti...
public class Vectors { /** * Creates a mul function that multiplies given { @ code value } by it ' s argument . * @ param arg a value to be multiplied by function ' s argument * @ return a closure that does { @ code _ * _ } */ public static VectorFunction asMulFunction ( final double arg ) { } }
return new VectorFunction ( ) { @ Override public double evaluate ( int i , double value ) { return value * arg ; } } ;
public class MapQuestTileSource { /** * Reads the mapbox map id from the manifest . < br > * It will use the default value of mapquest if not defined */ public final void retrieveMapBoxMapId ( final Context aContext ) { } }
// Retrieve the MapId from the Manifest String temp = ManifestUtil . retrieveKey ( aContext , MAPBOX_MAPID ) ; if ( temp != null && temp . length ( ) > 0 ) mapBoxMapId = temp ;
public class TypeParameterBuilderImpl { /** * Add upper type bounds . * @ param type the type . */ public void addUpperConstraint ( String type ) { } }
final JvmUpperBound constraint = this . jvmTypesFactory . createJvmUpperBound ( ) ; constraint . setTypeReference ( newTypeRef ( this . context , type ) ) ; getJvmTypeParameter ( ) . getConstraints ( ) . add ( constraint ) ;
public class DefaultDatabus { /** * Produces a list - of - lists for all unique tag sets for a given databus event . < code > existingTags < / code > must either * be null or the result of a previous call to { @ link # sortedTagUnion ( java . util . List , java . util . List ) } or * { @ link # sortedTagUnion ( jav...
return sortedTagUnion ( existingTags , asSortedList ( newTagSet ) ) ;
public class KenBurnsView { /** * Creates a new transition and starts over . */ public void restart ( ) { } }
int width = getWidth ( ) ; int height = getHeight ( ) ; if ( width == 0 || height == 0 ) { return ; // Can ' t call restart ( ) when view area is zero . } updateViewport ( width , height ) ; updateDrawableBounds ( ) ; startNewTransition ( ) ;
public class SeekableOutputStream { /** * / Outputstream overrides */ @ Override public final void write ( byte pBytes [ ] ) throws IOException { } }
write ( pBytes , 0 , pBytes != null ? pBytes . length : 1 ) ;
public class SendTemplatedEmailRequest { /** * A list of tags , in the form of name / value pairs , to apply to an email that you send using * < code > SendTemplatedEmail < / code > . Tags correspond to characteristics of the email that you define , so that you can * publish email sending events . * < b > NOTE : ...
if ( this . tags == null ) { setTags ( new com . amazonaws . internal . SdkInternalList < MessageTag > ( tags . length ) ) ; } for ( MessageTag ele : tags ) { this . tags . add ( ele ) ; } return this ;
public class AbstractLoggingExceptionHandler { /** * Log an exception */ public void logException ( Thread thread , Throwable throwable ) { } }
String logMessage ; String errorCode = extractErrorCode ( throwable ) ; if ( errorCode != null ) { logMessage = "Uncaught throwable handled with errorCode (" + errorCode + ")." ; } else { logMessage = "Uncaught throwable handled." ; } doLogException ( logMessage , throwable ) ;
public class ConsistentHashPartitionFilter { /** * Returns a list of pseudo - random 32 - bit values derived from the specified end point ID . */ private List < Integer > computeHashCodes ( String endPointId ) { } }
// Use the libketama approach of using MD5 hashes to generate 32 - bit random values . This assigns a set of // randomly generated ranges to each end point . The individual ranges may vary widely in size , but , with // sufficient # of entries per end point , the overall amount of data assigned to each server tends to ...
public class HttpRequestHelper { /** * Returns the target host as defined in the Host header or extracted from the request URI . * Usefull to generate Host header in a HttpRequest * @ param request * @ return the host formatted as host : port */ public static HttpHost getHost ( HttpRequest request ) { } }
HttpHost httpHost = UriUtils . extractHost ( request . getRequestLine ( ) . getUri ( ) ) ; String scheme = httpHost . getSchemeName ( ) ; String host = httpHost . getHostName ( ) ; int port = httpHost . getPort ( ) ; Header [ ] headers = request . getHeaders ( HttpHeaders . HOST ) ; if ( headers != null && headers . le...
public class FileUtilities { /** * Read a file into a byte array . * @ param filePath the path to the file . * @ return the array of bytes . * @ throws IOException */ public static byte [ ] readFileToBytes ( String filePath ) throws IOException { } }
Path path = Paths . get ( filePath ) ; byte [ ] bytes = Files . readAllBytes ( path ) ; return bytes ;
public class UserTypeMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UserType userType , ProtocolMarshaller protocolMarshaller ) { } }
if ( userType == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( userType . getUsername ( ) , USERNAME_BINDING ) ; protocolMarshaller . marshall ( userType . getAttributes ( ) , ATTRIBUTES_BINDING ) ; protocolMarshaller . marshall ( userType...
public class WsAddressingHeaders { /** * Sets the to uri by string . * @ param to the to to set */ public void setTo ( String to ) { } }
try { this . to = new URI ( to ) ; } catch ( URISyntaxException e ) { throw new CitrusRuntimeException ( "Invalid to uri" , e ) ; }
public class ElementUtils { /** * Determine if the element contains any undefined ( transient ) elements . The call will return null if no undefined * elements are found ; it will return a string indicating the relative path if an undefined element is found . * @ param e Element to search for undefined Elements *...
if ( e instanceof Resource ) { // recursively check all of the resources children Resource r = ( Resource ) e ; for ( Resource . Entry entry : r ) { String rpath = locateUndefinedElement ( entry . getValue ( ) ) ; String term = entry . getKey ( ) . toString ( ) ; if ( rpath != null ) { return ( ! "" . equals ( rpath ) ...
public class Logging { /** * Log a message at the ' STATISTICS ' level . * You should check isTime ( ) before building the message . * @ param message Informational log message . * @ param e Exception */ public void statistics ( CharSequence message , Throwable e ) { } }
log ( Level . STATISTICS , message , e ) ;
public class XDBHandler { /** * Receive notification of the end of an element . */ @ Override public void endElement ( String uri , String l , String q ) { } }
/* * 1 . If current element is a String , update its value from the string buffer . * 2 . Add the element to parent . */ XDB . Element element = Enum . valueOf ( XDB . Element . class , l . toUpperCase ( ) ) ; switch ( element ) { case M : break ; case P : _binder . put ( _name , _text . toString ( ) ) ; break ; case...
public class Matrix { /** * Set a row of this matrix from a row vector . * @ param rv the row vector * @ param r the row index * @ throws numbercruncher . MatrixException for an invalid index or * an invalid vector size */ public void setRow ( RowVector rv , int r ) throws MatrixException { } }
if ( ( r < 0 ) || ( r >= nRows ) ) { throw new MatrixException ( MatrixException . INVALID_INDEX ) ; } if ( nCols != rv . nCols ) { throw new MatrixException ( MatrixException . INVALID_DIMENSIONS ) ; } for ( int c = 0 ; c < nCols ; ++ c ) { this . values [ r ] [ c ] = rv . values [ 0 ] [ c ] ; }
public class WebService { /** * method to convert the input HELM into a standard HELM * @ param notation * HELM input * @ return standard HELM * @ throws HELM1FormatException * if the HELM input contains HELM2 features * @ throws ValidationException * if the HELM input is not valid * @ throws MonomerLoa...
String result = HELM1Utils . getStandard ( validate ( notation ) ) ; setMonomerFactoryToDefault ( notation ) ; return result ;
public class HealthCheck { /** * Register a health check task . * @ param task The task function . */ public void register ( Task task ) { } }
Optional . ofNullable ( task ) . filter ( t -> t . getTask ( ) != null ) . filter ( t -> StringUtils . hasText ( t . getName ( ) ) ) . ifPresent ( t -> checkTaskMap . put ( t . getName ( ) , t ) ) ;
public class Library { /** * Setup native library . This is the first method that must be called ! * @ param libraryName the name of the library to load * @ param engine Support for external a Crypto Device ( " engine " ) , usually * @ return { @ code true } if initialization was successful * @ throws Exception...
if ( _instance == null ) { _instance = libraryName == null ? new Library ( ) : new Library ( libraryName ) ; if ( aprMajorVersion ( ) < 1 ) { throw new UnsatisfiedLinkError ( "Unsupported APR Version (" + aprVersionString ( ) + ")" ) ; } if ( ! aprHasThreads ( ) ) { throw new UnsatisfiedLinkError ( "Missing APR_HAS_THR...
public class JPAEntityManager { /** * New JPA 2.0 API methods / / F743-954 , F743-954.1 d597764 */ @ Override public void detach ( Object entity ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "em.detach(" + entity + ");\n" + toString ( ) ) ; getEMInvocationInfo ( false ) . detach ( entity ) ;
public class BigtableTableAdminClient { /** * Constructs an instance of BigtableTableAdminClient with the given settings . */ public static BigtableTableAdminClient create ( @ Nonnull BigtableTableAdminSettings settings ) throws IOException { } }
EnhancedBigtableTableAdminStub stub = EnhancedBigtableTableAdminStub . createEnhanced ( settings . getStubSettings ( ) ) ; return create ( settings . getProjectId ( ) , settings . getInstanceId ( ) , stub ) ;
public class EpsilonInsensitiveLoss { /** * Computes the first derivative of the & epsilon ; - insensitive loss * @ param pred the predicted value * @ param y the true value * @ param eps the epsilon tolerance * @ return the first derivative of the & epsilon ; - insensitive loss */ public static double deriv ( ...
final double x = pred - y ; if ( eps < Math . abs ( x ) ) return Math . signum ( x ) ; else return 0 ;
public class SpringBootUtil { /** * Get the Spring Boot Uber JAR in its expected location , validating the JAR * contents and handling spring - boot - maven - plugin classifier configuration as * well . If the JAR was not found in its expected location , then return null . * @ param outputDirectory * @ param pr...
File fatArchive = getSpringBootUberJARLocation ( project , log ) ; if ( net . wasdev . wlp . common . plugins . util . SpringBootUtil . isSpringBootUberJar ( fatArchive ) ) { log . info ( "Found Spring Boot Uber JAR: " + fatArchive . getAbsolutePath ( ) ) ; return fatArchive ; } log . warn ( "Spring Boot Uber JAR was n...
public class BaseSetupSiteProcess { /** * PopulateSourceDir Method . */ public boolean populateSourceDir ( String templateDir , String srcDir ) { } }
URL fromDirUrl = this . getTask ( ) . getApplication ( ) . getResourceURL ( templateDir , null ) ; if ( "http" . equalsIgnoreCase ( fromDirUrl . getProtocol ( ) ) ) { String packageName = templateDir + "/main_tourgeek_user/org/jbundle/main/user/db" ; packageName = packageName . replace ( '/' , '.' ) ; Bundle bundle = (...
public class BlueCasUtil { /** * If this cas has no Sentence annotation , creates one with the whole cas * text */ public static void fixNoSentences ( JCas jCas ) { } }
Collection < Sentence > sentences = select ( jCas , Sentence . class ) ; if ( sentences . size ( ) == 0 ) { String text = jCas . getDocumentText ( ) ; Sentence sentence = new Sentence ( jCas , 0 , text . length ( ) ) ; sentence . addToIndexes ( ) ; }
public class ConvolutionalTrieSerializer { /** * Gets upper bound . * @ param currentParent the current parent * @ param currentChildren the current children * @ param godchildNode the godchild node * @ param godchildAdjustment the godchild adjustment * @ return the upper bound */ protected long getUpperBound...
return Math . min ( currentParent . getCursorCount ( ) - currentChildren . get ( ) , godchildNode . getCursorCount ( ) - godchildAdjustment ) ;
public class CharsetConversion { /** * Return converted charset name for java . */ public static String getJavaCharset ( final int id ) { } }
Entry entry = getEntry ( id ) ; if ( entry != null ) { if ( entry . javaCharset != null ) { return entry . javaCharset ; } else { logger . warn ( "Unknown java charset for: id = " + id + ", name = " + entry . mysqlCharset + ", coll = " + entry . mysqlCollation ) ; return null ; } } else { logger . warn ( "Unexpect mysq...
public class CmsDriverManager { /** * Creates a new user . < p > * @ param dbc the current database context * @ param name the name for the new user * @ param password the password for the new user * @ param description the description for the new user * @ param additionalInfos the additional infos for the us...
// no space before or after the name name = name . trim ( ) ; // check the user name String userName = CmsOrganizationalUnit . getSimpleName ( name ) ; OpenCms . getValidationHandler ( ) . checkUserName ( userName ) ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( userName ) ) { throw new CmsIllegalArgumentException ( ...
public class JSONTokener { /** * Get the next value . The value can be a Boolean , Double , Integer , * JSONArray , JSONObject , Long , or String , or the JSONObject . NULL object . * @ throws JSONException If syntax error . * @ return An object . */ public Object nextValue ( ) throws JSONException { } }
char c = this . nextClean ( ) ; String string ; switch ( c ) { case '"' : case '\'' : return this . nextString ( c ) ; case '{' : this . back ( ) ; return new JSONObject ( this ) ; case '[' : this . back ( ) ; return new JSONArray ( this ) ; } /* * Handle unquoted text . This could be the values true , false , or * n...
public class MutableDictionary { /** * Set a Blob object for the given key . * @ param key The key * @ param value The Blob object . * @ return The self object . */ @ NonNull @ Override public MutableDictionary setBlob ( @ NonNull String key , Blob value ) { } }
return setValue ( key , value ) ;
public class AWSMigrationHubClient { /** * Registers a new migration task which represents a server , database , etc . , being migrated to AWS by a migration * tool . * This API is a prerequisite to calling the < code > NotifyMigrationTaskState < / code > API as the migration tool must * first register the migrat...
request = beforeClientExecution ( request ) ; return executeImportMigrationTask ( request ) ;
public class BaseController { /** * 构造系统业务错误 * @ param message * 错误消息 * @ return JsonObject */ @ SuppressWarnings ( "unchecked" ) protected JsonObject bizError ( String message ) { } }
JsonObject json = JsonObject . create ( ) ; json . setMsg ( Arrays . asList ( message ) ) ; json . addData ( WebResponseConstant . MESSAGE_MSG , message ) ; json . setStatus ( GlobalResponseStatusMsg . BIZ_ERROR . getMessage ( ) . getCode ( ) ) ; return json ;
public class CPDisplayLayoutLocalServiceWrapper { /** * Returns the cp display layout with the primary key . * @ param CPDisplayLayoutId the primary key of the cp display layout * @ return the cp display layout * @ throws PortalException if a cp display layout with the primary key could not be found */ @ Override...
return _cpDisplayLayoutLocalService . getCPDisplayLayout ( CPDisplayLayoutId ) ;
public class MaterialConfigs { /** * To two methods below are to avoid creating methods on already long Material interface with a No Op implementations . */ private List < ScmMaterialConfig > filterScmMaterials ( ) { } }
List < ScmMaterialConfig > scmMaterials = new ArrayList < > ( ) ; for ( MaterialConfig material : this ) { if ( material instanceof ScmMaterialConfig ) { scmMaterials . add ( ( ScmMaterialConfig ) material ) ; } } return scmMaterials ;
public class PageLeafEntry { /** * Copies the row and its inline blobs to the target buffer . * @ return - 1 if the row or the blobs can ' t fit in the new buffer . */ public int copyTo ( byte [ ] buffer , int rowOffset , int blobTail ) { } }
byte [ ] blockBuffer = _block . getBuffer ( ) ; System . arraycopy ( blockBuffer , _rowOffset , buffer , rowOffset , _length ) ; return _row . copyBlobs ( blockBuffer , _rowOffset , buffer , rowOffset , blobTail ) ;
public class StandardIdGenerator { /** * Create a new random number generator instance we should use for generating session identifiers . */ private SecureRandom createSecureRandom ( ) { } }
SecureRandom result ; try { result = SecureRandom . getInstance ( "SHA1PRNG" ) ; } catch ( NoSuchAlgorithmException e ) { result = new SecureRandom ( ) ; } // Force seeding to take place . result . nextInt ( ) ; return result ;
public class LineageResource { /** * Returns the schema for the given dataset id . * @ param guid dataset entity id */ @ GET @ Path ( "{guid}/schema" ) @ Consumes ( Servlets . JSON_MEDIA_TYPE ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public Response schema ( @ PathParam ( "guid" ) String guid ) { } }
if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "==> LineageResource.schema({})" , guid ) ; } AtlasPerfTracer perf = null ; try { if ( AtlasPerfTracer . isPerfTraceEnabled ( PERF_LOG ) ) { perf = AtlasPerfTracer . getPerfTracer ( PERF_LOG , "LineageResource.schema(" + guid + ")" ) ; } final String jsonResult = lineageS...
public class DualInputSemanticProperties { /** * Adds , to the existing information , a field that is forwarded directly * from the source record ( s ) in the first input to the destination * record ( s ) . * @ param sourceField the position in the source record ( s ) from the first input * @ param destinationF...
FieldSet fs ; if ( ( fs = this . forwardedFields1 . get ( sourceField ) ) != null ) { fs . add ( destinationField ) ; } else { fs = new FieldSet ( destinationField ) ; this . forwardedFields1 . put ( sourceField , fs ) ; }
public class CaffeineSpec { /** * Configures the value as weak or soft references . */ void recordStats ( @ Nullable String value ) { } }
requireArgument ( value == null , "record stats does not take a value" ) ; requireArgument ( ! recordStats , "record stats was already set" ) ; recordStats = true ;
public class ReadInputRegistersResponse { /** * Returns a reference to the array of input registers read . * @ return a < tt > InputRegister [ ] < / tt > instance . */ public synchronized InputRegister [ ] getRegisters ( ) { } }
InputRegister [ ] dest = new InputRegister [ registers . length ] ; System . arraycopy ( registers , 0 , dest , 0 , dest . length ) ; return dest ;
public class EventProcessorHost { /** * Synchronized string UUID generation convenience method . * We saw null and empty strings returned from UUID . randomUUID ( ) . toString ( ) when used from multiple * threads and there is no clear answer on the net about whether it is really thread - safe or not . * One of t...
synchronized ( EventProcessorHost . UUID_SYNCHRONIZER ) { final UUID newUuid = UUID . randomUUID ( ) ; return newUuid . toString ( ) ; }
public class DefaultHistoryManager { /** * ( non - Javadoc ) * @ see org . activiti . engine . impl . history . HistoryManagerInterface # isHistoryLevelAtLeast ( org . activiti . engine . impl . history . HistoryLevel ) */ @ Override public boolean isHistoryLevelAtLeast ( HistoryLevel level ) { } }
if ( log . isDebugEnabled ( ) ) { log . debug ( "Current history level: {}, level required: {}" , historyLevel , level ) ; } // Comparing enums actually compares the location of values declared in // the enum return historyLevel . isAtLeast ( level ) ;
public class Balance { /** * Returns the total amount of the < code > currency < / code > in this balance . * @ return the total amount . */ public BigDecimal getTotal ( ) { } }
if ( total == null ) { return available . add ( frozen ) . subtract ( borrowed ) . add ( loaned ) . add ( withdrawing ) . add ( depositing ) ; } else { return total ; }
public class FactionWarfareApi { /** * An overview of statistics about factions involved in faction warfare * Statistical overviews of factions involved in faction warfare - - - This * route expires daily at 11:05 * @ param datasource * The server name you would like data from ( optional , default to * tranqu...
com . squareup . okhttp . Call call = getFwStatsValidateBeforeCall ( datasource , ifNoneMatch , null ) ; Type localVarReturnType = new TypeToken < List < FactionWarfareStatsResponse > > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ;
public class RemediationExecutionStatusMarshaller { /** * Marshall the given parameter object . */ public void marshall ( RemediationExecutionStatus remediationExecutionStatus , ProtocolMarshaller protocolMarshaller ) { } }
if ( remediationExecutionStatus == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( remediationExecutionStatus . getResourceKey ( ) , RESOURCEKEY_BINDING ) ; protocolMarshaller . marshall ( remediationExecutionStatus . getState ( ) , STATE_BI...
public class AsciiString { /** * Copies the characters in this string to a character array . * @ return a character array containing the characters of this string . */ public char [ ] toCharArray ( int start , int end ) { } }
int length = end - start ; if ( length == 0 ) { return EmptyArrays . EMPTY_CHARS ; } if ( isOutOfBounds ( start , length , length ( ) ) ) { throw new IndexOutOfBoundsException ( "expected: " + "0 <= start(" + start + ") <= srcIdx + length(" + length + ") <= srcLen(" + length ( ) + ')' ) ; } final char [ ] buffer = new ...
public class JsonObject { /** * Returns the { @ link JsonArray } at the given key , or the default if it does not exist or is the * wrong type . */ public Json . Array getArray ( String key , Json . Array default_ ) { } }
Object o = get ( key ) ; return ( o instanceof Json . Array ) ? ( Json . Array ) o : default_ ;
public class CommerceOrderPaymentPersistenceImpl { /** * Returns a range of all the commerce order payments where commerceOrderId = & # 63 ; . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys ...
return findByCommerceOrderId ( commerceOrderId , start , end , null ) ;
public class AWSGlueClient { /** * Updates a specified DevEndpoint . * @ param updateDevEndpointRequest * @ return Result of the UpdateDevEndpoint operation returned by the service . * @ throws EntityNotFoundException * A specified entity does not exist * @ throws InternalServiceException * An internal serv...
request = beforeClientExecution ( request ) ; return executeUpdateDevEndpoint ( request ) ;
public class DiameterStackMultiplexer { /** * ( non - Javadoc ) * @ see org . mobicents . diameter . stack . DiameterStackMultiplexerMBean # _ LocalPeer _ setVendorId ( java . lang . String ) */ @ Override public void _LocalPeer_setVendorId ( long vendorId ) throws MBeanException { } }
// validate vendor - id try { getMutableConfiguration ( ) . setLongValue ( OwnVendorID . ordinal ( ) , vendorId ) ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "Local Peer Vendor-Id successfully changed to '" + vendorId + "'. Restart to Diameter stack is needed to apply changes." ) ; } } catch ( NumberFormatExc...
public class CommerceCurrencyUtil { /** * Returns the commerce currency where uuid = & # 63 ; and groupId = & # 63 ; or throws a { @ link NoSuchCurrencyException } if it could not be found . * @ param uuid the uuid * @ param groupId the group ID * @ return the matching commerce currency * @ throws NoSuchCurrenc...
return getPersistence ( ) . findByUUID_G ( uuid , groupId ) ;
public class ManageAddOnsDialog { /** * Notifies that the given { @ code addOn } was installed . The add - on is added to the table of installed add - ons , or if an * update , set it as updated , and , if available in marketplace , removed from the table of available add - ons . * @ param addOn the add - on that w...
if ( EventQueue . isDispatchThread ( ) ) { if ( latestInfo != null && latestInfo . getAddOn ( addOn . getId ( ) ) != null ) { uninstalledAddOnsModel . removeAddOn ( addOn ) ; } installedAddOnsModel . addOrRefreshAddOn ( addOn ) ; } else { EventQueue . invokeLater ( new Runnable ( ) { @ Override public void run ( ) { no...
public class SerializedFormBuilder { /** * Build the serialization overview for the given class . * @ param typeElement the class to print the overview for . * @ param classContentTree content tree to which the documentation will be added */ public void buildFieldSerializationOverview ( TypeElement typeElement , Co...
if ( utils . definesSerializableFields ( typeElement ) ) { VariableElement ve = utils . serializableFields ( typeElement ) . first ( ) ; // Check to see if there are inline comments , tags or deprecation // information to be printed . if ( fieldWriter . shouldPrintOverview ( ve ) ) { Content serializableFieldsTree = fi...
public class Interpreter { /** * Execute a While statement at a given point in the function or method * body . This will loop over the body zero or more times . * @ param stmt * - - - Loop statement to executed * @ param frame * - - - The current stack frame * @ return */ private Status executeWhile ( Stmt ...
Status r ; do { RValue . Bool operand = executeExpression ( BOOL_T , stmt . getCondition ( ) , frame ) ; if ( operand == RValue . False ) { return Status . NEXT ; } // Keep executing the loop body until we exit it somehow . r = executeBlock ( stmt . getBody ( ) , frame , scope ) ; } while ( r == Status . NEXT || r == S...
public class FeatureCoreStyleExtension { /** * Determine if an icon relationship exists for the feature table * @ param featureTable * feature table * @ return true if relationship exists */ public boolean hasIconRelationship ( String featureTable ) { } }
return hasStyleRelationship ( getMappingTableName ( TABLE_MAPPING_ICON , featureTable ) , featureTable , IconTable . TABLE_NAME ) ;
public class AbstractRegistry { /** * 恢复 * @ throws Exception */ protected void recover ( ) throws Exception { } }
// register Set < Node > recoverRegistered = new HashSet < Node > ( getRegistered ( ) ) ; if ( ! recoverRegistered . isEmpty ( ) ) { if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Recover register node " + recoverRegistered ) ; } for ( Node node : recoverRegistered ) { register ( node ) ; } } // subscribe Map < N...
public class AttributeValue { /** * An attribute of type Number Set . For example : * < code > " NS " : [ " 42.2 " , " - 19 " , " 7.5 " , " 3.14 " ] < / code > * Numbers are sent across the network to DynamoDB as strings , to maximize compatibility across languages and * libraries . However , DynamoDB treats them...
if ( this . nS == null ) { setNS ( new java . util . ArrayList < String > ( nS . length ) ) ; } for ( String ele : nS ) { this . nS . add ( ele ) ; } return this ;
public class AccessControlEntryImpl { /** * Adds specified privileges to the given list . * @ param list the result list of combined privileges . * @ param privileges privileges to add . * @ return true if at least one of privileges was added . */ protected boolean combineRecursively ( List < Privilege > list , P...
boolean res = false ; for ( Privilege p : privileges ) { if ( p . isAggregate ( ) ) { res = combineRecursively ( list , p . getAggregatePrivileges ( ) ) ; } else if ( ! contains ( list , p ) ) { list . add ( p ) ; res = true ; } } return res ;
public class Utils { /** * Returns all of the constructors in a { @ link TypeElement } that PaperParcel can use . */ static ImmutableList < ExecutableElement > orderedConstructorsIn ( TypeElement element , List < String > reflectAnnotations ) { } }
List < ExecutableElement > allConstructors = ElementFilter . constructorsIn ( element . getEnclosedElements ( ) ) ; List < ExecutableElement > visibleConstructors = new ArrayList < > ( allConstructors . size ( ) ) ; for ( ExecutableElement constructor : allConstructors ) { if ( Visibility . ofElement ( constructor ) !=...
public class WizardDialogDecorator { /** * Adapts the enable state of the tab layout , which indicates the currently shown fragment . */ private void adaptTabLayoutEnableState ( ) { } }
if ( tabLayout != null ) { LinearLayout tabStrip = ( ( LinearLayout ) tabLayout . getChildAt ( 0 ) ) ; tabStrip . setEnabled ( tabLayoutEnabled ) ; for ( int i = 0 ; i < tabStrip . getChildCount ( ) ; i ++ ) { tabStrip . getChildAt ( i ) . setEnabled ( tabLayoutEnabled ) ; } }
public class DynamicObject { /** * - - - - internal API - - - - - */ public static Map < String , Object > getPropertyMap ( Object obj ) { } }
Assert . notNull ( obj , "Argument cannot be null" ) ; try { BeanInfo beanInfo = Introspector . getBeanInfo ( obj . getClass ( ) ) ; PropertyDescriptor [ ] propertyDescriptors = beanInfo . getPropertyDescriptors ( ) ; Map < String , Object > propertyMap = new HashMap < String , Object > ( propertyDescriptors . length )...
public class WrapFactory { /** * Wrap an object newly created by a constructor call . * @ param cx the current Context for this thread * @ param scope the scope of the executing script * @ param obj the object to be wrapped * @ return the wrapped value . */ public Scriptable wrapNewObject ( Context cx , Scripta...
if ( obj instanceof Scriptable ) { return ( Scriptable ) obj ; } Class < ? > cls = obj . getClass ( ) ; if ( cls . isArray ( ) ) { return NativeJavaArray . wrap ( scope , obj ) ; } return wrapAsJavaObject ( cx , scope , obj , null ) ;
public class CassandraDataHandlerBase { /** * Constructs Thrift Tow ( each record ) for Index Table . * @ param columnFamily * Column family Name for Index Table * @ param embeddedFieldName * the embedded field name * @ param obj * Embedded Object instance * @ param column * Instance of { @ link Column ...
// Column Name Field columnField = ( Field ) column . getJavaMember ( ) ; byte [ ] indexColumnName = PropertyAccessorHelper . get ( obj , columnField ) ; ThriftRow tr = null ; if ( indexColumnName != null && indexColumnName . length != 0 && rowKey != null ) { // Construct Index Table Thrift Row tr = new ThriftRow ( ) ;...
public class BaseApplet { /** * The browser back button was pressed ( Javascript called me ) . * @ param command The command that was popped from the browser history . */ public void doForward ( String command ) { } }
if ( command != null ) if ( command . startsWith ( "#" ) ) command = command . substring ( 1 ) ; Util . getLogger ( ) . info ( "Browser forward: java browser command=" + command + " = target: " + this . cleanCommand ( command ) ) ; BaseApplet . handleAction ( this . cleanCommand ( command ) , this , this , Constants . ...
public class AngularPass { /** * Add node to the list of injectables . * @ param n node to add . */ private void addNode ( Node n ) { } }
Node target = null ; Node fn = null ; String name = null ; switch ( n . getToken ( ) ) { // handles assignment cases like : // a = function ( ) { } // a = b = c = function ( ) { } case ASSIGN : if ( ! n . getFirstChild ( ) . isQualifiedName ( ) ) { compiler . report ( JSError . make ( n , INJECTED_FUNCTION_ON_NON_QNAME...
public class ByFullTextUtil { /** * Add a predicate for each simple property whose value is not null . */ public < T > List < Predicate > byExample ( ManagedType < T > mt , Path < T > mtPath , T mtValue , SearchParameters sp , CriteriaBuilder builder ) { } }
List < Predicate > predicates = newArrayList ( ) ; for ( SingularAttribute < ? super T , ? > attr : mt . getSingularAttributes ( ) ) { if ( ! isPrimaryKey ( mt , attr ) ) { continue ; } Object attrValue = jpaUtil . getValue ( mtValue , attr ) ; if ( attrValue != null ) { predicates . add ( builder . equal ( mtPath . ge...
public class HierarchicalUriComponents { /** * Normalize the path removing sequences like " path / . . " . * @ see StringUtils # cleanPath ( String ) */ @ Override public UriComponents normalize ( ) { } }
String normalizedPath = StringUtils . cleanPath ( getPath ( ) ) ; return new HierarchicalUriComponents ( getScheme ( ) , this . userInfo , this . host , this . port , new FullPathComponent ( normalizedPath ) , this . queryParams , getFragment ( ) , this . encoded , false ) ;
public class ConvertNullTo { /** * { @ inheritDoc } */ public Object execute ( final Object value , final CsvContext context ) { } }
if ( value == null ) { return returnValue ; } return next . execute ( value , context ) ;
public class ParserPropertyHelper { /** * Check if the path to the property correspond to an association . * @ param targetTypeName the name of the entity containing the property * @ param pathWithoutAlias the path to the property WITHOUT aliases * @ return { @ code true } if the property is an association or { @...
OgmEntityPersister persister = getPersister ( targetTypeName ) ; Type propertyType = persister . getPropertyType ( pathWithoutAlias . get ( 0 ) ) ; return propertyType . isAssociationType ( ) ;
public class BehaviorTreeReader { /** * Parses the given input stream . * @ param input the input stream * @ throws SerializationException if the input stream cannot be successfully parsed . */ public void parse ( InputStream input ) { } }
try { parse ( new InputStreamReader ( input , "UTF-8" ) ) ; } catch ( IOException ex ) { throw new SerializationException ( ex ) ; } finally { StreamUtils . closeQuietly ( input ) ; }
public class InternalChannelz { /** * Returns a server list . */ public ServerList getServers ( long fromId , int maxPageSize ) { } }
List < InternalInstrumented < ServerStats > > serverList = new ArrayList < > ( maxPageSize ) ; Iterator < InternalInstrumented < ServerStats > > iterator = servers . tailMap ( fromId ) . values ( ) . iterator ( ) ; while ( iterator . hasNext ( ) && serverList . size ( ) < maxPageSize ) { serverList . add ( iterator . n...
public class SurveyFragment { /** * Run this when the user hits the send button , and only send if it returns true . This method will update the visual validation state of all questions , and update the answers instance variable with the latest answer state . * @ return true if all questions that have constraints hav...
boolean validationPassed = true ; List < Fragment > fragments = getRetainedChildFragmentManager ( ) . getFragments ( ) ; for ( Fragment fragment : fragments ) { SurveyQuestionView surveyQuestionView = ( SurveyQuestionView ) fragment ; answers . put ( surveyQuestionView . getQuestionId ( ) , surveyQuestionView . getAnsw...
public class Jsr309ConferenceController { /** * EVENTS */ @ Override public void onReceive ( Object message ) throws Exception { } }
final Class < ? > klass = message . getClass ( ) ; final ActorRef self = self ( ) ; final ActorRef sender = sender ( ) ; final State state = fsm . state ( ) ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "********** Conference Controller Current State: \"" + state . toString ( ) ) ; logger . info ( "********** C...
public class WorkspacePersistentDataManager { /** * { @ inheritDoc } */ public ItemData getItemData ( final NodeData parentData , final QPathEntry name , ItemType itemType ) throws RepositoryException { } }
final WorkspaceStorageConnection con = dataContainer . openConnection ( ) ; try { return con . getItemData ( parentData , name , itemType ) ; } finally { con . close ( ) ; }
public class HttpClientService { public void get ( String url ) throws Exception { } }
String response = excuteGet ( url , false ) ; if ( response == null ) { LOGGER . error ( "call uri error, response is null, uri = " + url ) ; } // parseResultMap ( response , url ) ;
public class ServiceHttpClientFactory { /** * Creates { @ link HttpClient } instances for each defined { @ link ServiceHttpClientConfiguration } . * @ param configuration The configuration * @ param instanceList The instance list * @ return The client bean */ @ EachBean ( ServiceHttpClientConfiguration . class ) ...
List < URI > originalURLs = configuration . getUrls ( ) ; Collection < URI > loadBalancedURIs = instanceList . getLoadBalancedURIs ( ) ; boolean isHealthCheck = configuration . isHealthCheck ( ) ; LoadBalancer loadBalancer = loadBalancerFactory . create ( instanceList ) ; Optional < String > path = configuration . getP...
public class StandaloneMetaProperty { @ Override public P get ( Bean bean ) { } }
return clazz . cast ( metaBean ( ) . metaProperty ( name ( ) ) . get ( bean ) ) ;
public class FixDependencyChecker { /** * Returns if the apars list apars1 is superseded by apars2 . Apars1 is superseded by apars2 if all the apars in apars1 is also included in apars2 * @ param apars1 Fix to check * @ param apars2 * @ return Returns true if apars list apars1 is superseded by apars2 . Else retur...
boolean result = true ; // Now iterate over the current list of problems , and see if the incoming IFixInfo contains all of the problems from this IfixInfo . // If it does then return true , to indicate that this IFixInfo object has been superseded . for ( Iterator < Problem > iter1 = apars1 . iterator ( ) ; iter1 . ha...
public class StreamExecutionEnvironment { /** * Creates a new data stream that contains elements in the iterator . The iterator is splittable , * allowing the framework to create a parallel data stream source that returns the elements in * the iterator . * < p > Because the iterator will remain unmodified until t...
return fromParallelCollection ( iterator , typeInfo , "Parallel Collection Source" ) ;
public class Config { /** * Parses configuration file and extracts values for test environment * @ param context * list of parameters includes values within & lt ; suite & gt ; & lt ; / suite & gt ; and & lt ; test & gt ; & lt ; / test & gt ; * tags */ public synchronized static void initConfig ( ITestContext con...
SeLionLogger . getLogger ( ) . entering ( context ) ; Map < ConfigProperty , String > initialValues = new HashMap < > ( ) ; Map < String , String > testParams = context . getCurrentXmlTest ( ) . getLocalParameters ( ) ; if ( ! testParams . isEmpty ( ) ) { for ( ConfigProperty prop : ConfigProperty . values ( ) ) { // C...
public class MethodProxy { /** * Add a proxy for this method . Each call to the method will be routed to * the invocationHandler instead . */ public static void proxy ( Method method , InvocationHandler invocationHandler ) { } }
assertInvocationHandlerNotNull ( invocationHandler ) ; MockRepository . putMethodProxy ( method , invocationHandler ) ;
public class DownloadRequestQueue { /** * Generates a download id for the request and adds the download request to the download request queue for the dispatchers pool to act on immediately . * @ param request * @ return downloadId */ int add ( DownloadRequest request ) { } }
int downloadId = getDownloadId ( ) ; // Tag the request as belonging to this queue and add it to the set of current requests . request . setDownloadRequestQueue ( this ) ; synchronized ( mCurrentRequests ) { mCurrentRequests . add ( request ) ; } // Process requests in the order they are added . request . setDownloadId...
public class CmsJspScopedVarBodyTagSuport { /** * Returns the int value of the specified scope string . < p > * The default value is { @ link PageContext # PAGE _ SCOPE } . < p > * @ param scope the string name of the desired scope , e . g . " application " , " request " * @ return the int value of the specified ...
int scopeValue ; switch ( SCOPES_LIST . indexOf ( scope ) ) { case 3 : // application scopeValue = PageContext . APPLICATION_SCOPE ; break ; case 2 : // session scopeValue = PageContext . SESSION_SCOPE ; break ; case 1 : // request scopeValue = PageContext . REQUEST_SCOPE ; break ; default : // page scopeValue = PageCo...
public class CmsVfsSitemapService { /** * Creates a navigation level type info . < p > * @ return the navigation level type info bean * @ throws CmsException if reading the sub level redirect copy page fails */ private CmsNewResourceInfo createNavigationLevelTypeInfo ( ) throws CmsException { } }
String name = CmsResourceTypeFolder . getStaticTypeName ( ) ; Locale locale = getWorkplaceLocale ( ) ; String subtitle = Messages . get ( ) . getBundle ( getWorkplaceLocale ( ) ) . key ( Messages . GUI_NAVIGATION_LEVEL_SUBTITLE_0 ) ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( subtitle ) ) { subtitle = CmsWorkplaceM...
public class StateMachineDefinition { /** * Get the transition definitions * @ param transitionthe transition * @ returnthe definitions */ public Transition < S > getTransition ( S fromState , T transition ) { } }
Transition < S > transitionDef = transitions . get ( new DoubleValueBean < S , T > ( fromState , transition ) ) ; if ( transitionDef == null ) { throw new IllegalArgumentException ( "Transition '" + transition + "' from state '" + fromState + "' has not been defined." ) ; } return transitionDef ;
public class br { /** * < pre > * Performs generic data validation for the operation to be performed * < / pre > */ protected void validate ( String operationType ) throws Exception { } }
super . validate ( operationType ) ; MPSDouble br_cpu_usage_validator = new MPSDouble ( ) ; br_cpu_usage_validator . validate ( operationType , br_cpu_usage , "\"br_cpu_usage\"" ) ; MPSDouble br_memory_usage_validator = new MPSDouble ( ) ; br_memory_usage_validator . validate ( operationType , br_memory_usage , "\"br_m...