signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class LoggingSnippets { /** * [ VARIABLE " my _ metric _ name " ] */ public Metric getMetricAsync ( String metricName ) throws ExecutionException , InterruptedException { } }
// [ START getMetricAsync ] Future < Metric > future = logging . getMetricAsync ( metricName ) ; Metric metric = future . get ( ) ; if ( metric == null ) { // metric was not found } // [ END getMetricAsync ] return metric ;
public class VerboseFormatter { /** * Append thrown exception trace . * @ param message The message builder . * @ param event The log record . */ private static void appendThrown ( StringBuilder message , LogRecord event ) { } }
final Throwable thrown = event . getThrown ( ) ; if ( thrown != null ) { final StringWriter sw = new StringWriter ( ) ; thrown . printStackTrace ( new PrintWriter ( sw ) ) ; message . append ( sw ) ; }
public class ListOrganizationsResult { /** * The overview of owned organizations presented as a list of organization summaries . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setOrganizationSummaries ( java . util . Collection ) } or * { @ link # withOrga...
if ( this . organizationSummaries == null ) { setOrganizationSummaries ( new java . util . ArrayList < OrganizationSummary > ( organizationSummaries . length ) ) ; } for ( OrganizationSummary ele : organizationSummaries ) { this . organizationSummaries . add ( ele ) ; } return this ;
public class BoxApiMetadata { /** * Gets a request that retrieves available metadata templates under the enterprise scope * @ return request to retrieve available metadata templates */ public BoxRequestsMetadata . GetMetadataTemplates getMetadataTemplatesRequest ( ) { } }
BoxRequestsMetadata . GetMetadataTemplates request = new BoxRequestsMetadata . GetMetadataTemplates ( getMetadataTemplatesUrl ( ) , mSession ) ; return request ;
public class Mapper { /** * Map dynamically using a bean property name . * @ param property the name of a bean property * @ param i an iterator of objects * @ return collection * @ throws ClassCastException if there is an error invoking the method on any object . */ public static Collection beanMap ( String pro...
return beanMap ( property , i , false ) ;
public class PlainTime { /** * / * [ deutsch ] * < p > Definiert eine nat & uuml ; rliche Ordnung , die auf der zeitlichen * Position basiert . < / p > * < p > Der Vergleich ist konsistent mit { @ code equals ( ) } . < / p > * @ see # isBefore ( PlainTime ) * @ see # isAfter ( PlainTime ) */ @ Override public...
int delta = this . hour - time . hour ; if ( delta == 0 ) { delta = this . minute - time . minute ; if ( delta == 0 ) { delta = this . second - time . second ; if ( delta == 0 ) { delta = this . nano - time . nano ; } } } return ( ( delta < 0 ) ? - 1 : ( ( delta == 0 ) ? 0 : 1 ) ) ;
public class AWSCodeBuildClient { /** * Gets information about build projects . * @ param batchGetProjectsRequest * @ return Result of the BatchGetProjects operation returned by the service . * @ throws InvalidInputException * The input value that was provided is not valid . * @ sample AWSCodeBuild . BatchGet...
request = beforeClientExecution ( request ) ; return executeBatchGetProjects ( request ) ;
public class ConcurrentUtils { /** * Checks if a concurrent map contains a key and creates a corresponding * value if not , suppressing checked exceptions . This method calls * { @ code createIfAbsent ( ) } . If a { @ link ConcurrentException } is thrown , it * is caught and re - thrown as a { @ link ConcurrentRu...
try { return createIfAbsent ( map , key , init ) ; } catch ( final ConcurrentException cex ) { throw new ConcurrentRuntimeException ( cex . getCause ( ) ) ; }
public class FileHelper { /** * Reads a PID ( Process Id ) file * @ param f * File The process Id file ( must exist ! ) * @ param carefulProcessing * boolean If true , non - numeric chars are stripped from the PID before it is parsed * @ return String The process Id represented by the file ( or - 1 if the fil...
if ( f . exists ( ) ) { String pidString = cat ( f ) ; if ( carefulProcessing ) pidString = pidString . replaceAll ( "[^0-9]" , "" ) ; // Strip out anything that ' s not a number else pidString = pidString . replace ( "\n" , "" ) ; // Just remove newlines if ( pidString . length ( ) > 0 ) return Long . parseLong ( pidS...
public class NotesDao { /** * Retrieve those notes in the given area that match the given search string * @ param handler The handler which is fed the incoming notes * @ param bounds the area within the notes should be queried . This is usually limited at 25 * square degrees . Check the server capabilities . * ...
if ( limit <= 0 || limit > 10000 ) { throw new IllegalArgumentException ( "limit must be within 1 and 10000" ) ; } if ( bounds . crosses180thMeridian ( ) ) { throw new IllegalArgumentException ( "bounds may not cross the 180th meridian" ) ; } String searchQuery = "" ; if ( search != null && ! search . isEmpty ( ) ) { s...
public class InternalPureXbaseLexer { /** * $ ANTLR start " T _ _ 24" */ public final void mT__24 ( ) throws RecognitionException { } }
try { int _type = T__24 ; int _channel = DEFAULT_TOKEN_CHANNEL ; // InternalPureXbase . g : 22:7 : ( ' - = ' ) // InternalPureXbase . g : 22:9 : ' - = ' { match ( "-=" ) ; } state . type = _type ; state . channel = _channel ; } finally { }
public class TacoTangoDevice { DeviceData command_inout ( String command , DeviceData argin ) throws DevFailed { } }
return tacoDevice . command_inout ( this , command , argin ) ;
public class HibernateSearchPropertyHelper { /** * Determines whether the given property path denotes an embedded entity ( not a property of such entity ) . * @ param entityType the indexed type * @ param propertyPath the path of interest * @ return { @ code true } if the given path denotes an embedded entity of ...
EntityIndexBinding indexBinding = searchFactory . getIndexBindings ( ) . get ( entityType ) ; if ( indexBinding != null ) { ResolvedProperty resolvedProperty = resolveProperty ( indexBinding , propertyPath ) ; if ( resolvedProperty != null ) { return resolvedProperty . propertyMetadata == null ; } } return super . hasE...
public class SimpleNumberControl { /** * { @ inheritDoc } */ @ Override public void setupEventHandlers ( ) { } }
editableSpinner . getEditor ( ) . setOnKeyPressed ( event -> { switch ( event . getCode ( ) ) { case UP : editableSpinner . increment ( 1 ) ; break ; case DOWN : editableSpinner . decrement ( 1 ) ; break ; default : } } ) ;
public class Translations { /** * use configured language * @ param id - the id of the message to retrieve * @ param defaultMsg - string to use if the message is not defined or a language match is not found ( if null , then will default to english ) * @ return the message */ public String getMessage ( String id ,...
return getMessage ( id , lang , defaultMsg ) ;
public class ScreenFullAwt { /** * Check if the display mode is supported . * @ param display The display mode to check . * @ return Supported display , < code > null < / code > else . */ private DisplayMode isSupported ( DisplayMode display ) { } }
final DisplayMode [ ] supported = dev . getDisplayModes ( ) ; for ( final DisplayMode current : supported ) { final boolean multiDepth = current . getBitDepth ( ) != DisplayMode . BIT_DEPTH_MULTI && display . equals ( current ) ; if ( multiDepth || current . getBitDepth ( ) == DisplayMode . BIT_DEPTH_MULTI && display ....
public class ResourceAwareObject { /** * Wouldn ' t it be nice if we wrote some tests ? */ protected ByteSource stream ( final String resourceId ) { } }
return new ByteSource ( ) { @ Override public InputStream openStream ( ) throws IOException { return loader . getResource ( resourceId ) . getInputStream ( ) ; } } ;
public class KeyVaultClientBaseImpl { /** * Updates the specified certificate issuer . * The UpdateCertificateIssuer operation performs an update on the specified certificate issuer entity . This operation requires the certificates / setissuers permission . * @ param vaultBaseUrl The vault name , for example https ...
return ServiceFuture . fromResponse ( updateCertificateIssuerWithServiceResponseAsync ( vaultBaseUrl , issuerName ) , serviceCallback ) ;
public class HlpEntitiesPage { /** * < p > Make SQL WHERE clause for boolean if need . < / p > * @ param pSbWhere result clause * @ param pRequestData - Request Data * @ param pEntityClass - entity class * @ param pFldNm - field name * @ param pFilterMap - map to store current filter * @ param pFilterAppear...
String nmRnd = pRequestData . getParameter ( "nmRnd" ) ; String fltOrdPrefix ; if ( nmRnd . contains ( "pickerDub" ) ) { fltOrdPrefix = "fltordPD" ; } else if ( nmRnd . contains ( "picker" ) ) { fltOrdPrefix = "fltordP" ; } else { fltOrdPrefix = "fltordM" ; } String fltforcedName = fltOrdPrefix + "forcedFor" ; String f...
public class ObjIntConsumerBuilder { /** * One of ways of creating builder . This might be the only way ( considering all _ functional _ builders ) that might be utilize to specify generic params only once . */ @ Nonnull public static < T > ObjIntConsumerBuilder < T > objIntConsumer ( Consumer < ObjIntConsumer < T > > ...
return new ObjIntConsumerBuilder ( consumer ) ;
public class DereferenceExpression { /** * If this DereferenceExpression looks like a QualifiedName , return QualifiedName . * Otherwise return null */ public static QualifiedName getQualifiedName ( DereferenceExpression expression ) { } }
List < String > parts = tryParseParts ( expression . base , expression . field . getValue ( ) . toLowerCase ( Locale . ENGLISH ) ) ; return parts == null ? null : QualifiedName . of ( parts ) ;
public class InterleavedU8 { /** * Returns an integer formed from 3 bands . a [ i ] < < 16 | a [ i + 1 ] < < 8 | a [ i + 2] * @ param x column * @ param y row * @ return 32 bit integer */ public int get24 ( int x , int y ) { } }
int i = startIndex + y * stride + x * 3 ; return ( ( data [ i ] & 0xFF ) << 16 ) | ( ( data [ i + 1 ] & 0xFF ) << 8 ) | ( data [ i + 2 ] & 0xFF ) ;
public class ESQuery { /** * Checks whether key exist in ES Query . * @ param key * the key * @ return true , if is new key */ private boolean checkIfKeyExists ( String key ) { } }
if ( aggregationsKeySet == null ) { aggregationsKeySet = new HashSet < String > ( ) ; } return aggregationsKeySet . add ( key ) ;
public class SubGraphPredicate { /** * Determine if the subgraph , starting with the root function , matches the predicate * @ param sameDiff SameDiff instance the function belongs to * @ param rootFn Function that defines the root of the subgraph * @ return True if the subgraph mathes the predicate */ public boo...
if ( ! root . matches ( sameDiff , rootFn ) ) { return false ; } SDVariable [ ] inputs = rootFn . args ( ) ; int inCount = inputs == null ? 0 : inputs . length ; if ( inputCount != null ) { if ( inCount != this . inputCount ) return false ; } SDVariable [ ] outputs = rootFn . outputVariables ( ) ; int outCount = output...
public class GoogleComputeInstanceMetadataResolver { /** * Get instance Metadata JSON . * @ param url The metadata URL * @ param connectionTimeoutMs connection timeout in millis * @ param readTimeoutMs read timeout in millis * @ return The Metadata JSON * @ throws IOException Failed or interrupted I / O opera...
return readMetadataUrl ( url , connectionTimeoutMs , readTimeoutMs , objectMapper , Collections . emptyMap ( ) ) ;
public class DisassociateCertificateRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DisassociateCertificateRequest disassociateCertificateRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( disassociateCertificateRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( disassociateCertificateRequest . getArn ( ) , ARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON...
public class FreeRingSoft { /** * Try to get an object from the free list . Returns null if the free list * is empty . * @ return the new object or null . */ public T allocate ( ) { } }
while ( true ) { SoftReference < T > ref ; ref = _ringQueue . poll ( ) ; if ( ref == null ) { return null ; } T value = ref . get ( ) ; if ( value != null ) { return value ; } }
public class GuidedDecisionTable52 { /** * This method expands Composite columns into individual columns where * knowledge of individual columns is necessary ; for example separate * columns in the user - interface or where individual columns need to be * analysed . * @ return A List of individual columns */ pu...
final List < BaseColumn > columns = new ArrayList < BaseColumn > ( ) ; columns . add ( rowNumberCol ) ; columns . add ( descriptionCol ) ; columns . addAll ( metadataCols ) ; columns . addAll ( attributeCols ) ; for ( CompositeColumn < ? > cc : this . conditionPatterns ) { boolean explode = ! ( cc instanceof LimitedEnt...
public class AnyValueMap { /** * Converts map element into a string or returns null if conversion is not * possible . * @ param key a key of element to get . * @ return string value of the element or null if conversion is not supported . * @ see StringConverter # toNullableString ( Object ) */ public String get...
Object value = getAsObject ( key ) ; return StringConverter . toNullableString ( value ) ;
public class ElementParentsIterable { /** * Creates stream with parent chain * @ param element element to start with ( will be included to chain ) * @ return stream with elements from current with his parents until package ( inclusive ) */ public static Stream < Element > stream ( Element element ) { } }
return StreamSupport . stream ( new ElementParentsIterable ( element ) . spliterator ( ) , false ) ;
public class MessageProcessorMatching { /** * Method deregisterConsumerSetMonitor * Deregisters a previously registered callback . * @ param connection * @ param callback * @ throws SINotPossibleInCurrentConfigurationException */ public void deregisterConsumerSetMonitor ( ConnectionImpl connection , ConsumerSet...
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "deregisterConsumerSetMonitor" , new Object [ ] { connection , callback } ) ; // Deregister under a lock on the targets table synchronized ( _targets ) { _consumerMonitoring . deregisterConsumerSetMonitor ( connection , call...
public class CompositeBinding { /** * Disposes itself and all inner Bindings . * < p > After call of this method , new { @ code Binding } s added to { @ link CompositeBinding } * will be disposed immediately . */ public void dispose ( ) { } }
if ( ! disposedInd ) { Collection < Binding > unsubscribe1 = null ; Collection < CompositeBinding > unsubscribe2 = null ; disposedInd = true ; unsubscribe1 = bindings ; unsubscribe2 = compBindings ; bindings = null ; compBindings = null ; // we will only get here once unsubscribeFromAll ( unsubscribe1 ) ; unsubscribeFr...
public class JsonParser { private void write ( JsonLikeWriter theEventWriter , String theChildName , BigDecimal theDecimalValue ) throws IOException { } }
theEventWriter . write ( theChildName , theDecimalValue ) ;
public class OracleHelper { /** * order of array is : 0 - clientId */ @ Override public void setClientInformationArray ( String [ ] clientInfoArray , WSRdbManagedConnectionImpl mc , boolean explicitCall ) throws SQLException { } }
// set the flag here even if the call fails , safer that way . if ( explicitCall ) mc . clientInfoExplicitlySet = true ; else mc . clientInfoImplicitlySet = true ; // set the clientid in the matrix matrix [ 1 /* OracleConnection . END _ TO _ END _ CLIENTID _ INDEX */ ] = clientInfoArray [ 0 ] ; setEndToEndMetrics ( mc ...
public class ListVolumeInitiatorsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListVolumeInitiatorsRequest listVolumeInitiatorsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listVolumeInitiatorsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listVolumeInitiatorsRequest . getVolumeARN ( ) , VOLUMEARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request t...
public class Job { /** * Get a map of string properties . * @ return map of properties , may be an empty map */ public Map < String , String > getProperties ( ) { } }
final Map < String , String > res = new HashMap < > ( ) ; for ( final Map . Entry < String , Object > e : prop . entrySet ( ) ) { if ( e . getValue ( ) instanceof String ) { res . put ( e . getKey ( ) , ( String ) e . getValue ( ) ) ; } } return Collections . unmodifiableMap ( res ) ;
public class FacebookProfileCreator { /** * Adds the token to the URL in question . If we require appsecret _ proof , then this method * will also add the appsecret _ proof parameter to the URL , as Facebook expects . * @ param url the URL to modify * @ param accessToken the token we ' re passing back and forth ...
final FacebookProfileDefinition profileDefinition = ( FacebookProfileDefinition ) configuration . getProfileDefinition ( ) ; final FacebookConfiguration facebookConfiguration = ( FacebookConfiguration ) configuration ; String computedUrl = url ; if ( facebookConfiguration . isUseAppsecretProof ( ) ) { computedUrl = pro...
public class DiffusionDither { /** * Converts an int ARGB to int triplet . */ private static int [ ] toRGBArray ( int pARGB , int [ ] pBuffer ) { } }
pBuffer [ 0 ] = ( ( pARGB & 0x00ff0000 ) >> 16 ) ; pBuffer [ 1 ] = ( ( pARGB & 0x0000ff00 ) >> 8 ) ; pBuffer [ 2 ] = ( ( pARGB & 0x000000ff ) ) ; // pBuffer [ 3 ] = ( ( pARGB & 0xff00000 ) > > 24 ) ; / / alpha return pBuffer ;
public class Schema { /** * Create a schema from a given json string * @ param json the json to create the schema from * @ return the created schema based on the json */ public static Schema fromJson ( String json ) { } }
try { return JsonMappers . getMapper ( ) . readValue ( json , Schema . class ) ; } catch ( Exception e ) { // TODO better exceptions throw new RuntimeException ( e ) ; }
public class ProcessThread { /** * Match waiting thread waiting for given thread to be notified . */ public static @ Nonnull Predicate waitingOnLock ( final @ Nonnull String className ) { } }
return new Predicate ( ) { @ Override public boolean isValid ( @ Nonnull ProcessThread < ? , ? , ? > thread ) { final ThreadLock lock = thread . getWaitingOnLock ( ) ; return lock != null && lock . getClassName ( ) . equals ( className ) ; } } ;
public class GA4GHPicardRunner { /** * Parses cmd line with JCommander */ void parseCmdLine ( String [ ] args ) { } }
JCommander parser = new JCommander ( this , args ) ; parser . setProgramName ( "GA4GHPicardRunner" ) ; LOG . info ( "Cmd line parsed" ) ;
public class TagUtils { /** * Converts the global Tag list into a Map where the tag name is the key and the Tag the value . * Either ordered or as - is , if the comparator is null . * @ param tags the List of tags * @ param comparator the comparator to use . * @ return the Map of tags . Either ordered or as - i...
Map < String , Tag > sortedMap ; if ( comparator == null ) sortedMap = new LinkedHashMap < > ( ) ; else sortedMap = new TreeMap < > ( comparator ) ; tags . forEach ( tag -> sortedMap . put ( tag . getName ( ) , tag ) ) ; return sortedMap ;
public class Security { /** * Returns a Set of Strings containing the names of all available * algorithms or types for the specified Java cryptographic service * ( e . g . , Signature , MessageDigest , Cipher , Mac , KeyStore ) . Returns * an empty Set if there is no provider that supports the * specified servi...
if ( ( serviceName == null ) || ( serviceName . length ( ) == 0 ) || ( serviceName . endsWith ( "." ) ) ) { return Collections . EMPTY_SET ; } HashSet < String > result = new HashSet < > ( ) ; Provider [ ] providers = Security . getProviders ( ) ; for ( int i = 0 ; i < providers . length ; i ++ ) { // Check the keys fo...
public class ConvertRaster { /** * Checks to see if it is a known byte format */ public static boolean isKnownByteFormat ( BufferedImage image ) { } }
int type = image . getType ( ) ; return type != BufferedImage . TYPE_BYTE_INDEXED && type != BufferedImage . TYPE_BYTE_BINARY && type != BufferedImage . TYPE_CUSTOM ;
public class LUDecompositionBase_DDRM { /** * Writes the upper triangular matrix into the specified matrix . * @ param upper Where the upper triangular matrix is writen to . */ @ Override public DMatrixRMaj getUpper ( DMatrixRMaj upper ) { } }
int numRows = LU . numRows < LU . numCols ? LU . numRows : LU . numCols ; int numCols = LU . numCols ; upper = UtilDecompositons_DDRM . checkZerosLT ( upper , numRows , numCols ) ; for ( int i = 0 ; i < numRows ; i ++ ) { for ( int j = i ; j < numCols ; j ++ ) { upper . unsafe_set ( i , j , LU . unsafe_get ( i , j ) ) ...
public class JobState { /** * Add a collection of { @ link TaskState } s . * @ param taskStates collection of { @ link TaskState } s to add */ public void addTaskStates ( Collection < TaskState > taskStates ) { } }
for ( TaskState taskState : taskStates ) { this . taskStates . put ( taskState . getTaskId ( ) , taskState ) ; }
public class Scs_cumsum { /** * p [ 0 . f . n ] = cumulative sum of c [ 0 . f . n - 1 ] , and then copy p [ 0 . f . n - 1 ] into c * @ param p * size n + 1 , cumulative sum of c * @ param c * size n , overwritten with p [ 0 . f . n - 1 ] on output * @ param n * length of c * @ return sum ( c ) , null on e...
int i , nz = 0 ; float nz2 = 0 ; if ( p == null || c == null ) return ( - 1 ) ; /* check inputs */ for ( i = 0 ; i < n ; i ++ ) { p [ i ] = nz ; nz += c [ i ] ; nz2 += c [ i ] ; /* also in float to avoid int overflow */ c [ i ] = p [ i ] ; /* also copy p [ 0 . f . n - 1 ] back into c [ 0 . f . n - 1] */ } p [ n ] = nz ...
public class HttpInputStream { /** * Read Http body from input stream as a string basing on the content length on the method . * @ param httpHeader * @ return Http body */ public synchronized HttpRequestBody readRequestBody ( HttpHeader httpHeader ) { } }
int contentLength = httpHeader . getContentLength ( ) ; // -1 = default to unlimited length until connection close HttpRequestBody body = ( contentLength > 0 ) ? new HttpRequestBody ( contentLength ) : new HttpRequestBody ( ) ; readBody ( contentLength , body ) ; return body ;
public class BaseFlowGraph { /** * Delete a { @ link DataNode } by its identifier * @ param nodeId identifier of the { @ link DataNode } to be deleted . * @ return true if { @ link DataNode } is successfully deleted . */ @ Override public boolean deleteDataNode ( String nodeId ) { } }
try { rwLock . writeLock ( ) . lock ( ) ; return this . dataNodeMap . containsKey ( nodeId ) && deleteDataNode ( this . dataNodeMap . get ( nodeId ) ) ; } finally { rwLock . writeLock ( ) . unlock ( ) ; }
public class EndianNumbers { /** * Converting four bytes to a Big Endian integer . * @ param b1 the first byte . * @ param b2 the second byte . * @ param b3 the third byte . * @ param b4 the fourth byte . * @ return the conversion result */ @ Pure public static int toBEInt ( int b1 , int b2 , int b3 , int b4 ...
return ( ( b1 & 0xFF ) << 24 ) + ( ( b2 & 0xFF ) << 16 ) + ( ( b3 & 0xFF ) << 8 ) + ( b4 & 0xFF ) ;
public class MapTileProviderBase { /** * Called by implementation class methods indicating that they have failed to retrieve the * requested map tile . a MAPTILE _ FAIL _ ID message is sent . * @ param pState * the map tile request state object */ @ Override public void mapTileRequestFailed ( final MapTileRequest...
if ( mTileNotFoundImage != null ) { putTileIntoCache ( pState . getMapTile ( ) , mTileNotFoundImage , ExpirableBitmapDrawable . NOT_FOUND ) ; for ( final Handler handler : mTileRequestCompleteHandlers ) { if ( handler != null ) { handler . sendEmptyMessage ( MAPTILE_SUCCESS_ID ) ; } } } else { for ( final Handler handl...
public class CreativeWrapper { /** * Sets the ordering value for this CreativeWrapper . * @ param ordering * If there are multiple wrappers for a creative , then * { @ code ordering } defines the order in which the HTML * snippets are rendered . */ public void setOrdering ( com . google . api . ads . admanager . ...
this . ordering = ordering ;
public class DefaultApplicationContext { /** * Creates the default environment for the given environment name . * @ deprecated Use { @ link # createEnvironment ( ApplicationContextConfiguration ) } instead * @ param environmentNames The environment name * @ return The environment instance */ @ Deprecated protecte...
return createEnvironment ( ( ) -> Arrays . asList ( environmentNames ) ) ;
public class BaseAsyncInterceptor { /** * Invoke the next interceptor , possibly with a new command , and execute an { @ link InvocationCallback } * after all the interceptors have finished successfully . * < p > You need to wrap the result with { @ link # makeStage ( Object ) } if you need to add another handler ....
try { Object rv ; if ( nextDDInterceptor != null ) { rv = command . acceptVisitor ( ctx , nextDDInterceptor ) ; } else { rv = nextInterceptor . visitCommand ( ctx , command ) ; } if ( rv instanceof InvocationStage ) { return ( ( InvocationStage ) rv ) . thenAccept ( ctx , command , action ) ; } action . accept ( ctx , ...
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link RuleType } { @ code > } } */ @ XmlElementDecl ( namespace = "urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" , name = "Rule" ) public JAXBElement < RuleType > createRule ( RuleType value ) { } }
return new JAXBElement < RuleType > ( _Rule_QNAME , RuleType . class , null , value ) ;
public class LdaGibbsSampler { /** * Print table of multinomial data * @ param data * vector of evidence * @ param fmax * max frequency in display * the scaled histogram bin values */ public static void hist ( float [ ] data , int fmax ) { } }
float [ ] hist = new float [ data . length ] ; // scale maximum float hmax = 0 ; for ( int i = 0 ; i < data . length ; i ++ ) { hmax = Math . max ( data [ i ] , hmax ) ; } float shrink = fmax / hmax ; for ( int i = 0 ; i < data . length ; i ++ ) { hist [ i ] = shrink * data [ i ] ; } NumberFormat nf = new DecimalFormat...
public class WebInterfaceUtils { /** * Determines whether or not the given node contains web content . * @ param node The node to evaluate * @ return { @ code true } if the node contains web content , { @ code false } otherwise */ public static boolean supportsWebActions ( AccessibilityNodeInfoCompat node ) { } }
return AccessibilityNodeInfoUtils . supportsAnyAction ( node , AccessibilityNodeInfoCompat . ACTION_NEXT_HTML_ELEMENT , AccessibilityNodeInfoCompat . ACTION_PREVIOUS_HTML_ELEMENT ) ;
public class HttpResourceModel { /** * Gathers all parameters ' annotations for the given method , starting from the third parameter . */ private List < Map < Class < ? extends Annotation > , ParameterInfo < ? > > > createParametersInfos ( Method method ) { } }
if ( method . getParameterTypes ( ) . length <= 2 ) { return Collections . emptyList ( ) ; } List < Map < Class < ? extends Annotation > , ParameterInfo < ? > > > result = new ArrayList < > ( ) ; Type [ ] parameterTypes = method . getGenericParameterTypes ( ) ; Annotation [ ] [ ] parameterAnnotations = method . getPara...
public class CharSkippingBufferedString { /** * Marks a character in the backing array as skipped . Such character is no longer serialized when toString ( ) method * is called on this buffer . * @ param skippedCharIndex Index of the character in the backing array to skip */ protected final void skipIndex ( final in...
_bufferedString . addChar ( ) ; if ( _skipped . length == 0 || _skipped [ _skipped . length - 1 ] != - 1 ) { _skipped = Arrays . copyOf ( _skipped , Math . max ( _skipped . length + 1 , 1 ) ) ; } _skipped [ _skippedWriteIndex ] = skippedCharIndex ; _skippedWriteIndex ++ ;
public class CmsResourceHistoryTable { /** * Helper method for adding a table column with a given width and label . < p > * @ param label the column label * @ param width the column width in pixels * @ param col the column to add */ private void addColumn ( String label , int width , Column < CmsHistoryResourceBe...
addColumn ( col , label ) ; setColumnWidth ( col , width , Unit . PX ) ;
public class EncoderConverter { /** * Retrieve ( in string format ) from this field . * @ return This field as a percent string . */ public String getString ( ) { } }
String string = super . getString ( ) ; if ( ( string != null ) && ( string . length ( ) > 0 ) ) string = this . decodeString ( string ) ; return string ;
public class Matrix { /** * Adds one row to matrix . * @ param i the row index * @ return matrix with row . */ public Matrix insertRow ( int i , Vector row ) { } }
if ( i > rows || i < 0 ) { throw new IndexOutOfBoundsException ( "Illegal row number, must be 0.." + rows ) ; } Matrix result ; if ( columns == 0 ) { result = blankOfShape ( rows + 1 , row . length ( ) ) ; } else { result = blankOfShape ( rows + 1 , columns ) ; } for ( int ii = 0 ; ii < i ; ii ++ ) { result . setRow ( ...
public class SecurityDomain { /** * Initialize the key and trust stores * @ throws SecurityDomainException */ protected void initStores ( ) throws SecurityDomainException { } }
setDomainEnvironment ( ) ; char [ ] keyStorePasswd = domainProperties . getProperty ( JAVAX_NET_SSL_KEYSTORE_PASSWORD , "" ) . toCharArray ( ) ; char [ ] trustStorePasswd = domainProperties . getProperty ( JAVAX_NET_SSL_TRUSTSTORE_PASSWORD , "" ) . toCharArray ( ) ; String keyStoreName = domainProperties . getProperty ...
public class NumberRange { /** * Decrements by given step * @ param value the value to decrement * @ param step the amount to decrement * @ return the decremented value */ @ SuppressWarnings ( "unchecked" ) private Comparable decrement ( Object value , Number step ) { } }
return ( Comparable ) minus ( ( Number ) value , step ) ;
public class AmazonEC2Client { /** * Describes the permissions for your network interfaces . * @ param describeNetworkInterfacePermissionsRequest * Contains the parameters for DescribeNetworkInterfacePermissions . * @ return Result of the DescribeNetworkInterfacePermissions operation returned by the service . *...
request = beforeClientExecution ( request ) ; return executeDescribeNetworkInterfacePermissions ( request ) ;
public class ActivityChooserModel { /** * Persists the history data to the backing file if the latter * was provided . Calling this method before a call to { @ link # readHistoricalData ( ) } * throws an exception . Calling this method more than one without choosing an * activity has not effect . * @ throws Ill...
synchronized ( mInstanceLock ) { if ( ! mReadShareHistoryCalled ) { throw new IllegalStateException ( "No preceding call to #readHistoricalData" ) ; } if ( ! mHistoricalRecordsChanged ) { return ; } mHistoricalRecordsChanged = false ; mCanReadHistoricalData = true ; if ( ! TextUtils . isEmpty ( mHistoryFileName ) ) { /...
public class SpringBootUtil { /** * Read the value of the classifier configuration parameter from the * spring - boot - maven - plugin * @ param project * @ param log * @ return the value if it was found , null otherwise */ public static String getSpringBootMavenPluginClassifier ( MavenProject project , Log log...
String classifier = null ; try { classifier = MavenProjectUtil . getPluginGoalConfigurationString ( project , "org.springframework.boot:spring-boot-maven-plugin" , "repackage" , "classifier" ) ; } catch ( PluginScenarioException e ) { log . debug ( "No classifier found for spring-boot-maven-plugin" ) ; } return classif...
public class ToSAXHandler { /** * This method gets the node ' s value as a String and uses that String as if * it were an input character notification . * @ param node the Node to serialize * @ throws org . xml . sax . SAXException */ public void characters ( org . w3c . dom . Node node ) throws org . xml . sax ....
// remember the current node if ( m_state != null ) { m_state . setCurrentNode ( node ) ; } // Get the node ' s value as a String and use that String as if // it were an input character notification . String data = node . getNodeValue ( ) ; if ( data != null ) { this . characters ( data ) ; }
public class AbstractTextFileConverter { /** * Prepare the output stream . * @ param outputFileName * the file to write into . * @ throws IOException * if a problem occurs . */ private void openOutputFile ( final String outputFileName ) throws IOException { } }
myOutputFile = new File ( outputFileName ) ; myOutputStream = new FileOutputStream ( myOutputFile ) ; myStreamWriter = new OutputStreamWriter ( myOutputStream , getOutputEncodingCode ( ) ) ; myBufferedWriter = new BufferedWriter ( myStreamWriter ) ;
public class NetworkEndpointGroupClient { /** * Deletes the specified network endpoint group . The network endpoints in the NEG and the VM * instances they belong to are not terminated when the NEG is deleted . Note that the NEG cannot * be deleted if there are backend services referencing it . * < p > Sample cod...
DeleteNetworkEndpointGroupHttpRequest request = DeleteNetworkEndpointGroupHttpRequest . newBuilder ( ) . setNetworkEndpointGroup ( networkEndpointGroup == null ? null : networkEndpointGroup . toString ( ) ) . build ( ) ; return deleteNetworkEndpointGroup ( request ) ;
public class CommerceTaxFixedRateAddressRelLocalServiceBaseImpl { /** * Deletes the commerce tax fixed rate address rel with the primary key from the database . Also notifies the appropriate model listeners . * @ param commerceTaxFixedRateAddressRelId the primary key of the commerce tax fixed rate address rel * @ r...
return commerceTaxFixedRateAddressRelPersistence . remove ( commerceTaxFixedRateAddressRelId ) ;
public class ConfigUtils { /** * Method is used to retrieve a URI from a configuration key . * @ param config Config to read * @ param key Key to read * @ return URI for the value . */ public static URI uri ( AbstractConfig config , String key ) { } }
final String value = config . getString ( key ) ; return uri ( key , value ) ;
public class DiskStorageCache { /** * Test if the cache size has exceeded its limits , and if so , evict some files . * It also calls maybeUpdateFileCacheSize * This method uses mLock for synchronization purposes . */ private void maybeEvictFilesInCacheDir ( ) throws IOException { } }
synchronized ( mLock ) { boolean calculatedRightNow = maybeUpdateFileCacheSize ( ) ; // Update the size limit ( mCacheSizeLimit ) updateFileCacheSizeLimit ( ) ; long cacheSize = mCacheStats . getSize ( ) ; // If we are going to evict force a recalculation of the size // ( except if it was already calculated ! ) if ( ca...
public class UriTemplate { /** * Expand the template of a composite map property . Eg : If d : = [ ( " semi " , " ; " ) , ( " dot " , * " . " ) , ( " comma " , " , " ) ] then { / d * } is expanded to " / semi = % 3B / dot = . / comma = % 2C " * @ param varName The name of the variable the value corresponds to . Eg ...
if ( map . isEmpty ( ) ) { return "" ; } StringBuilder retBuf = new StringBuilder ( ) ; String joiner ; String mapElementsJoiner ; if ( containsExplodeModifier ) { joiner = compositeOutput . getExplodeJoiner ( ) ; mapElementsJoiner = "=" ; } else { joiner = COMPOSITE_NON_EXPLODE_JOINER ; mapElementsJoiner = COMPOSITE_N...
public class LocationBasedPopupHandler { /** * Prepare all { @ link LocationBasedAction } s that are contained in the * items of the menu based on the component and coordinates of the * given mouse event * @ param e The mouse event */ private void prepareAndShowPopup ( MouseEvent e ) { } }
prepareMenu ( popupMenu , e . getComponent ( ) , e . getX ( ) , e . getY ( ) ) ; popupMenu . show ( e . getComponent ( ) , e . getX ( ) , e . getY ( ) ) ;
public class DERUTCTime { /** * return an UTC Time from the passed in object . * @ exception IllegalArgumentException if the object cannot be converted . */ public static DERUTCTime getInstance ( Object obj ) { } }
if ( obj == null || obj instanceof DERUTCTime ) { return ( DERUTCTime ) obj ; } if ( obj instanceof ASN1OctetString ) { return new DERUTCTime ( ( ( ASN1OctetString ) obj ) . getOctets ( ) ) ; } throw new IllegalArgumentException ( "illegal object in getInstance: " + obj . getClass ( ) . getName ( ) ) ;
public class MultiIndex { /** * Recursively creates an index starting with the NodeState * < code > node < / code > . * @ param tasks * the queue of existing indexing tasks * @ param node * the current NodeState . * @ param stateMgr * the shared item state manager . * @ param count * the number of nod...
NodeData childState = null ; try { childState = ( NodeData ) stateMgr . getItemData ( nodeData . getIdentifier ( ) ) ; } catch ( RepositoryException e ) { LOG . error ( "Error indexing subtree " + node . getQPath ( ) . getAsString ( ) + ". Check JCR consistency. " + e . getMessage ( ) , e ) ; return ; } if ( childState...
public class TransportLayerImpl { /** * { @ inheritDoc } Only one destination can be created per remote address . If a * destination with the supplied remote address already exists for this transport * layer , a { @ link KNXIllegalArgumentException } is thrown . < br > * A transport layer can only handle one conn...
if ( detached ) throw new IllegalStateException ( "TL detached" ) ; synchronized ( proxies ) { if ( proxies . containsKey ( remote ) ) throw new KNXIllegalArgumentException ( "destination already created: " + remote ) ; final AggregatorProxy p = new AggregatorProxy ( this ) ; final Destination d = new Destination ( p ,...
public class GrailsResourceUtils { /** * Gets the path relative to the project base directory . * Input : / usr / joe / project / grails - app / conf / BootStrap . groovy * Output : grails - app / conf / BootStrap . groovy * @ param path The path * @ return The path relative to the base directory or null if it ...
int i = path . indexOf ( "grails-app/" ) ; if ( i > - 1 ) { return path . substring ( i + 11 ) ; } else { try { File baseDir = BuildSettings . BASE_DIR ; String basePath = baseDir != null ? baseDir . getCanonicalPath ( ) : null ; if ( basePath != null ) { String canonicalPath = new File ( path ) . getCanonicalPath ( ) ...
public class ClusterMetadataCodec { /** * Decodes metadata into { @ link ServiceEndpoint } . * @ param metadata - raw metadata to decode from . * @ return decoded { @ link ServiceEndpoint } . In case of deserialization error returns { @ code null } */ public static ServiceEndpoint decodeMetadata ( String metadata )...
try { return objectMapper . readValue ( metadata , ServiceEndpoint . class ) ; } catch ( IOException e ) { LOGGER . error ( "Failed to read metadata: " + e ) ; return null ; }
public class SimpleDataSource { /** * 内部的にコネクションを返します 。 * @ param info JDBCドライバへのプロパティ * @ return コネクション * @ throws SQLException SQLに関する例外が発生した場合 */ protected Connection getConnectionInternal ( Properties info ) throws SQLException { } }
if ( url == null ) { throw new SQLException ( Message . DOMAGEN5002 . getMessage ( ) ) ; } try { return DriverManager . getConnection ( url , info ) ; } catch ( SQLException e ) { if ( UNABLE_TO_ESTABLISH_CONNECTION . equals ( e . getSQLState ( ) ) ) { throw new SQLException ( Message . DOMAGEN5001 . getMessage ( ) , U...
public class DeleteFileExtensions { /** * Deletes the File and if it is an directory it deletes his sub - directories recursively . * @ param file * The File to delete . * @ throws IOException * Signals that an I / O exception has occurred . */ public static void deleteAllFiles ( final File file ) throws IOExce...
String error = null ; if ( ! file . exists ( ) ) { return ; } final Exception ex = checkFile ( file ) ; if ( ex != null ) { try { throw ex ; } catch ( final Exception e ) { e . printStackTrace ( ) ; } } DeleteFileExtensions . deleteFiles ( file ) ; if ( ! file . delete ( ) ) { error = "Cannot delete the File " + file ....
public class GlobusGSSManagerImpl { /** * for acceptors */ public GSSContext createContext ( GSSCredential cred ) throws GSSException { } }
GlobusGSSCredentialImpl globusCred = null ; if ( cred == null ) { globusCred = ( GlobusGSSCredentialImpl ) createCredential ( GSSCredential . ACCEPT_ONLY ) ; } else if ( cred instanceof GlobusGSSCredentialImpl ) { globusCred = ( GlobusGSSCredentialImpl ) cred ; } else { throw new GSSException ( GSSException . NO_CRED )...
public class ServiceRegistryInitializer { /** * Init service registry if necessary . */ @ SuppressFBWarnings ( "PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" ) public void initServiceRegistryIfNecessary ( ) { } }
val size = this . serviceRegistry . size ( ) ; LOGGER . trace ( "Service registry contains [{}] service definition(s)" , size ) ; LOGGER . warn ( "Service registry [{}] will be auto-initialized from JSON service definitions. " + "This behavior is only useful for testing purposes and MAY NOT be appropriate for productio...
public class FileUtils { /** * Get relative path to base path . * < p > For { @ code foo / bar / baz . txt } return { @ code . . / . . / } < / p > * @ param relativePath relative path * @ param sep path separator * @ return relative path to base path , { @ code null } if reference path was a single file */ priv...
final StringTokenizer tokenizer = new StringTokenizer ( relativePath . replace ( WINDOWS_SEPARATOR , UNIX_SEPARATOR ) , UNIX_SEPARATOR ) ; final StringBuilder buffer = new StringBuilder ( ) ; if ( tokenizer . countTokens ( ) == 1 ) { return null ; } else { while ( tokenizer . countTokens ( ) > 1 ) { tokenizer . nextTok...
public class UResourceBundle { /** * < strong > [ icu ] < / strong > Loads a new resource bundle for the given base name , locale and class loader . * Optionally will disable loading of fallback bundles . * @ param baseName string containing the name of the data package . * If null the default ICU package name is...
RootType rootType = getRootType ( baseName , root ) ; switch ( rootType ) { case ICU : return ICUResourceBundle . getBundleInstance ( baseName , localeName , root , disableFallback ) ; case JAVA : return ResourceBundleWrapper . getBundleInstance ( baseName , localeName , root , disableFallback ) ; case MISSING : defaul...
public class MatchState { /** * Converts case of the string token according to match element attributes . * @ param s Token to be converted . * @ param sample the sample string used to determine how the original string looks like ( used only on case preservation ) * @ return Converted string . */ String convertCa...
return CaseConversionHelper . convertCase ( match . getCaseConversionType ( ) , s , sample , lang ) ;
public class ExtensionFactoryRegistry { /** * Finds all factory from the extensions directory . * @ param factories list of factories to add to */ private void scanExtensions ( List < T > factories , String extensionsDir ) { } }
LOG . info ( "Loading extension jars from {}" , extensionsDir ) ; scan ( Arrays . asList ( ExtensionUtils . listExtensions ( extensionsDir ) ) , factories ) ;
public class CmsValidationController { /** * Internal method which is executed when the results of the asynchronous validation are received from the server . < p > * @ param results the validation results */ protected void onReceiveValidationResults ( Map < String , CmsValidationResult > results ) { } }
try { for ( Map . Entry < String , CmsValidationResult > resultEntry : results . entrySet ( ) ) { String fieldName = resultEntry . getKey ( ) ; CmsValidationResult result = resultEntry . getValue ( ) ; provideValidationResult ( fieldName , result ) ; } m_handler . onValidationFinished ( m_validationOk ) ; } finally { C...
public class ListDeploymentTargetsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListDeploymentTargetsRequest listDeploymentTargetsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listDeploymentTargetsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listDeploymentTargetsRequest . getDeploymentId ( ) , DEPLOYMENTID_BINDING ) ; protocolMarshaller . marshall ( listDeploymentTargetsRequest . getNextToken ( ...
public class ConsumerDispatcherState { /** * Sets the topic space . * @ param topicSpace The topicSpaceUuid to set */ public void setTopicSpaceUuid ( SIBUuid12 topicSpace ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setTopicSpaceUuid" , topicSpace ) ; this . topicSpaceUuid = topicSpace ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setTopicSpaceUuid" ) ;
public class AmazonApiGatewayV2Client { /** * Gets a Route . * @ param getRouteRequest * @ return Result of the GetRoute operation returned by the service . * @ throws NotFoundException * The resource specified in the request was not found . * @ throws TooManyRequestsException * The client is sending more t...
request = beforeClientExecution ( request ) ; return executeGetRoute ( request ) ;
public class TransactionImpl { /** * Lock and register the specified object , make sure that when cascading locking and register * is enabled to specify a List to register the already processed object Identiy . */ public synchronized void lockAndRegister ( RuntimeObject rtObject , int lockMode , boolean cascade , Lis...
if ( log . isDebugEnabled ( ) ) log . debug ( "Lock and register called for " + rtObject . getIdentity ( ) ) ; // if current object was already locked , do nothing // avoid endless loops when circular object references are used if ( ! registeredObjects . contains ( rtObject . getIdentity ( ) ) ) { if ( cascade ) { // i...
public class JsDocInfoParser { /** * Looks for a type expression at the current token and if found , * returns it . Note that this method consumes input . * Parameter type expressions are special for two reasons : * < ol > * < li > They must begin with ' { ' , to distinguish type names from param names . * < ...
checkArgument ( token == JsDocToken . LEFT_CURLY ) ; int lineno = stream . getLineno ( ) ; int startCharno = stream . getCharno ( ) ; Node typeNode = parseParamTypeExpressionAnnotation ( token ) ; recordTypeNode ( lineno , startCharno , typeNode , true ) ; return typeNode ;
public class ListRetirableGrantsResult { /** * A list of grants . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setGrants ( java . util . Collection ) } or { @ link # withGrants ( java . util . Collection ) } if you want to override the * existing values ...
if ( this . grants == null ) { setGrants ( new com . ibm . cloud . objectstorage . internal . SdkInternalList < GrantListEntry > ( grants . length ) ) ; } for ( GrantListEntry ele : grants ) { this . grants . add ( ele ) ; } return this ;
public class LsImageVisitor { /** * values needed to display the inode in ls - style format . */ @ Override void visit ( ImageElement element , String value ) throws IOException { } }
if ( inInode ) { switch ( element ) { case INODE_PATH : if ( value . equals ( "" ) ) path = "/" ; else path = value ; break ; case PERMISSION_STRING : perms = value ; break ; case REPLICATION : replication = value ; break ; case USER_NAME : username = value ; break ; case GROUP_NAME : group = value ; break ; case NUM_B...
public class Money { /** * Returns a copy of this monetary value with the amount added . * This adds the specified amount to this monetary amount , returning a new object . * If the amount to add exceeds the scale of the currency , then the * rounding mode will be used to adjust the result . * This instance is ...
return with ( money . plusRetainScale ( amountToAdd , roundingMode ) ) ;
public class Util { /** * Returns a byte - array representation of an ASCII string . * < p > This method is significantly faster than those relying on character encoders , and it allocates just * one object & mdash ; the resulting byte array . * @ param s an ASCII string . * @ return a byte - array representati...
final byte [ ] byteArray = new byte [ s . length ( ) ] ; // This needs to be fast . for ( int i = s . length ( ) ; i -- != 0 ; ) { assert s . charAt ( i ) < ( char ) 0x80 : s . charAt ( i ) ; byteArray [ i ] = ( byte ) s . charAt ( i ) ; } return byteArray ;
public class Vector4f { /** * Rotate this vector the specified radians around the given rotation axis . * @ param angle * the angle in radians * @ param x * the x component of the rotation axis * @ param y * the y component of the rotation axis * @ param z * the z component of the rotation axis * @ re...
return rotateAxis ( angle , x , y , z , thisOrNew ( ) ) ;
public class MiscUtils { /** * Compare two versions . Version should be represented as an array of * integers . * @ param left * @ param right * @ return - 1 if left is smaller than right , 0 if they are equal , 1 if left * is greater than right . */ public static int compareVersions ( Object [ ] left , Objec...
if ( left == null || right == null ) { throw new IllegalArgumentException ( "Invalid versions" ) ; } for ( int i = 0 ; i < left . length ; i ++ ) { // right is shorter than left and share the same prefix = > left must be larger if ( right . length == i ) { return 1 ; } if ( left [ i ] instanceof Integer ) { if ( right ...