signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AttributeRenderer { /** * This method will add an attribute to the list of inheritted attributes .
* @ param list
* @ param attr
* @ param removes */
private void addAttribute ( int list , TreeHtmlAttributeInfo attr , RemoveInfo removes ) { } } | ArrayList al = _lists [ list ] ; // if the array list is the empty list then we need to allocate a new array list
if ( al == empty ) { al = new ArrayList ( ) ; _lists [ list ] = al ; } // check to see if this attribute is already inside the tree .
int cnt = al . size ( ) ; for ( int i = 0 ; i < cnt ; i ++ ) { TreeHtmlA... |
public class ModClusterContainer { /** * Management command enabling all contexts on the given node .
* @ param jvmRoute the jvmRoute
* @ return */
public synchronized boolean enableNode ( final String jvmRoute ) { } } | final Node node = nodes . get ( jvmRoute ) ; if ( node != null ) { for ( final Context context : node . getContexts ( ) ) { context . enable ( ) ; } return true ; } return false ; |
public class FastAdapterDialog { /** * add an array of items at the given position within the existing items
* @ param position the global position
* @ param items the items to add */
@ SafeVarargs public final FastAdapterDialog < Item > add ( int position , Item ... items ) { } } | mItemAdapter . add ( position , items ) ; return this ; |
public class QueryRow { /** * This method was created in VisualAge .
* @ param name java . lang . String
* @ param val java . lang . String */
protected void put ( String name , String val ) { } } | if ( val == null ) { row . put ( name , "" ) ; } else { row . put ( name , val ) ; } |
public class Util { /** * Locate the setting for the server properties . */
public static String findServerSettings ( String [ ] args ) { } } | for ( String s : args ) { if ( s . startsWith ( "--server:" ) ) { return s ; } } return null ; |
public class SingleSignOnSessionsEndpoint { /** * Gets sso sessions .
* @ param option the option
* @ return the sso sessions */
private Collection < Map < String , Object > > getActiveSsoSessions ( final SsoSessionReportOptions option ) { } } | val activeSessions = new ArrayList < Map < String , Object > > ( ) ; val dateFormat = new ISOStandardDateFormat ( ) ; getNonExpiredTicketGrantingTickets ( ) . stream ( ) . map ( TicketGrantingTicket . class :: cast ) . filter ( tgt -> ! ( option == SsoSessionReportOptions . DIRECT && tgt . getProxiedBy ( ) != null ) ) ... |
public class RelativeToEasterSundayParser { /** * Returns the easter Sunday for a given year .
* @ param nYear
* The year to retrieve Easter Sunday date
* @ return Easter Sunday . */
public static ChronoLocalDate getEasterSunday ( final int nYear ) { } } | return nYear <= CPDT . LAST_JULIAN_YEAR ? getJulianEasterSunday ( nYear ) : getGregorianEasterSunday ( nYear ) ; |
public class AWSServiceCatalogClient { /** * Lists the specified TagOptions or all TagOptions .
* @ param listTagOptionsRequest
* @ return Result of the ListTagOptions operation returned by the service .
* @ throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions m... | request = beforeClientExecution ( request ) ; return executeListTagOptions ( request ) ; |
public class VirtualNetworkGatewaysInner { /** * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetw... | return setVpnclientIpsecParametersWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName , vpnclientIpsecParams ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class AddUser { /** * Find the command - line arg corresponding to the parameter { @ code arg } .
* @ param arg
* @ return The corresponding arg or null . */
private static CommandLineArgument findCommandLineOption ( String arg ) { } } | for ( CommandLineArgument commandLineArgument : CommandLineArgument . values ( ) ) { if ( commandLineArgument . match ( arg ) ) { return commandLineArgument ; } } return null ; |
public class JKDefaultExceptionHandler { /** * ( non - Javadoc )
* @ see com . jk . exceptions . ExceptionHandler # handle ( java . lang . Throwable , boolean ) */
@ Override public void handle ( final T throwable , final boolean throwRuntimeException ) { } } | this . logger . error ( throwable ) ; if ( throwRuntimeException ) { if ( throwable instanceof RuntimeException ) { throw ( RuntimeException ) throwable ; } throw new RuntimeException ( throwable ) ; } |
public class WalletTool { /** * Sets up all objects needed for network communication but does not bring up the peers . */
private static void setup ( ) throws BlockStoreException { } } | if ( store != null ) return ; // Already done .
// Will create a fresh chain if one doesn ' t exist or there is an issue with this one .
boolean reset = ! chainFileName . exists ( ) ; if ( reset ) { // No chain , so reset the wallet as we will be downloading from scratch .
System . out . println ( "Chain file is missin... |
public class ListCreateAccountStatusRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListCreateAccountStatusRequest listCreateAccountStatusRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listCreateAccountStatusRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listCreateAccountStatusRequest . getStates ( ) , STATES_BINDING ) ; protocolMarshaller . marshall ( listCreateAccountStatusRequest . getNextToken ( ) , NE... |
public class StringHelper { /** * Get everything from the string from and excluding the passed string .
* @ param sStr
* The source string . May be < code > null < / code > .
* @ param sSearch
* The string to search . May be < code > null < / code > .
* @ return < code > null < / code > if the passed string d... | return _getFromLast ( sStr , sSearch , false ) ; |
public class ClientAliasedDiscoveryConfigUtils { /** * Gets the { @ link AliasedDiscoveryConfig } from { @ code config } by { @ code tag } . */
public static AliasedDiscoveryConfig getConfigByTag ( ClientNetworkConfig config , String tag ) { } } | if ( "aws" . equals ( tag ) ) { return config . getAwsConfig ( ) ; } else if ( "gcp" . equals ( tag ) ) { return config . getGcpConfig ( ) ; } else if ( "azure" . equals ( tag ) ) { return config . getAzureConfig ( ) ; } else if ( "kubernetes" . equals ( tag ) ) { return config . getKubernetesConfig ( ) ; } else if ( "... |
public class SqlLineHighlighter { /** * Marks single / double quoted string position
* in sqlline command based on input .
* < p > Assumes that the input is a sqlline command but not SQL itself .
* @ param line line with sqlline command where to handle
* single / double quoted string
* @ param quoteBitSet Bit... | int doubleQuoteStart = - 1 ; int quoteStart = - 1 ; for ( int pos = 0 ; pos < line . length ( ) ; pos ++ ) { char ch = line . charAt ( pos ) ; if ( doubleQuoteStart > - 1 ) { doubleQuoteBitSet . set ( pos ) ; if ( ch == '"' ) { doubleQuoteStart = - 1 ; } continue ; } else if ( quoteStart > - 1 ) { quoteBitSet . set ( p... |
public class backup_file { /** * Use this API to fetch filtered set of backup _ file resources .
* filter string should be in JSON format . eg : " vm _ state : DOWN , name : [ a - z ] + " */
public static backup_file [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | backup_file obj = new backup_file ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; backup_file [ ] response = ( backup_file [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class Caster { /** * cast a Object to a DateTime Object
* @ param o Object to cast
* @ param alsoNumbers define if also numbers will casted to a datetime value
* @ param tz
* @ return casted DateTime Object
* @ throws PageException */
public static DateTime toDate ( Object o , boolean alsoNumbers , Tim... | return DateCaster . toDateAdvanced ( o , alsoNumbers ? DateCaster . CONVERTING_TYPE_OFFSET : DateCaster . CONVERTING_TYPE_NONE , tz ) ; |
public class ConverterRegistry { /** * 注册默认转换器
* @ return 转换器 */
private ConverterRegistry defaultConverter ( ) { } } | defaultConverterMap = new ConcurrentHashMap < > ( ) ; // 原始类型转换器
defaultConverterMap . put ( int . class , new PrimitiveConverter ( int . class ) ) ; defaultConverterMap . put ( long . class , new PrimitiveConverter ( long . class ) ) ; defaultConverterMap . put ( byte . class , new PrimitiveConverter ( byte . class ) ... |
public class RtfField { /** * Writes the end of the field instruction area .
* @ param result The < code > OutputStream < / code > to write to . */
private void writeFieldInstEnd ( OutputStream result ) throws IOException { } } | if ( fieldAlt ) { result . write ( DELIMITER ) ; result . write ( FIELD_ALT ) ; } result . write ( CLOSE_GROUP ) ; |
public class ClassUtils { /** * < p > Gets the abbreviated name of a { @ code Class } . < / p >
* @ param cls the class to get the abbreviated name for , may be { @ code null }
* @ param len the desired length of the abbreviated name
* @ return the abbreviated name or an empty string
* @ throws IllegalArgumentE... | if ( cls == null ) { return StringUtils . EMPTY ; } return getAbbreviatedName ( cls . getName ( ) , len ) ; |
public class AppServiceCertificateOrdersInner { /** * Get the certificate associated with a certificate order .
* Get the certificate associated with a certificate order .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param certificateOrderName Name of the certificate ... | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( certificateOrderName == null ) { throw new IllegalArgumentException ( "Parameter certificateOrderName is required and cannot be null." ) ; } if ( name == null ) { throw new Il... |
public class JsTopicInterceptor { /** * The topic receive directly payload in json
* @ param method
* @ return */
boolean isJsonPayload ( Method method ) { } } | if ( null == method || ! method . isAnnotationPresent ( JsTopic . class ) ) { return false ; } JsTopic jsTopic = method . getAnnotation ( JsTopic . class ) ; return jsTopic . jsonPayload ( ) ; |
public class JMElasticsearchSearchAndCount { /** * Gets search request builder .
* @ param queryBuilder the query builder
* @ param aggregationBuilders the aggregation builders
* @ param indices the indices
* @ return the search request builder */
public SearchRequestBuilder getSearchRequestBuilder ( QueryBuild... | return getSearchRequestBuilder ( indices , null , queryBuilder , aggregationBuilders ) ; |
public class DescribeElasticLoadBalancersResult { /** * A list of < code > ElasticLoadBalancer < / code > objects that describe the specified Elastic Load Balancing instances .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setElasticLoadBalancers ( java . u... | if ( this . elasticLoadBalancers == null ) { setElasticLoadBalancers ( new com . amazonaws . internal . SdkInternalList < ElasticLoadBalancer > ( elasticLoadBalancers . length ) ) ; } for ( ElasticLoadBalancer ele : elasticLoadBalancers ) { this . elasticLoadBalancers . add ( ele ) ; } return this ; |
public class JapaneseDate { /** * Checks if the specified field is supported .
* This checks if this date can be queried for the specified field .
* If false , then calling the { @ link # range ( TemporalField ) range } and
* { @ link # get ( TemporalField ) get } methods will throw an exception .
* If the fiel... | if ( field == ChronoField . ALIGNED_DAY_OF_WEEK_IN_MONTH || field == ChronoField . ALIGNED_DAY_OF_WEEK_IN_YEAR || field == ChronoField . ALIGNED_WEEK_OF_MONTH || field == ChronoField . ALIGNED_WEEK_OF_YEAR ) { return false ; } return super . isSupported ( field ) ; |
public class RelationGraph { /** * Gets sub tree nodes .
* @ param node the node
* @ param childRelations the child relations
* @ return the sub tree nodes */
public Set < Annotation > getSubTreeNodes ( @ NonNull Annotation node , String ... childRelations ) { } } | Set < Annotation > children = new HashSet < > ( ) ; Set < String > targetRel = childRelations == null ? Collections . emptySet ( ) : Sets . asSet ( Arrays . asList ( childRelations ) ) ; Predicate < RelationEdge > keep = edge -> targetRel . size ( ) == 0 || targetRel . contains ( edge . getRelation ( ) ) ; Queue < Rela... |
public class BetterCFGBuilder2 { /** * Inline all JSR subroutines into the top - level subroutine . This produces a
* complete CFG for the entire method , in which all JSR subroutines are
* inlined .
* @ return the CFG for the method */
private CFG inlineAll ( ) throws CFGBuilderException { } } | CFG result = new CFG ( ) ; Context rootContext = new Context ( null , topLevelSubroutine , result ) ; rootContext . mapBlock ( topLevelSubroutine . getEntry ( ) , result . getEntry ( ) ) ; rootContext . mapBlock ( topLevelSubroutine . getExit ( ) , result . getExit ( ) ) ; BasicBlock resultStartBlock = rootContext . ge... |
public class StaticConfiguration { /** * Get QTaste root directory from QTASTE _ ROOT environment variable .
* @ return the QTaste root directory */
private static String getQTasteRoot ( ) { } } | String qtasteRoot = System . getenv ( "QTASTE_ROOT" ) ; if ( qtasteRoot == null ) { System . err . println ( "QTASTE_ROOT environment variable is not defined" ) ; System . exit ( 1 ) ; } try { qtasteRoot = new File ( qtasteRoot ) . getCanonicalPath ( ) ; } catch ( IOException e ) { System . err . println ( "QTASTE_ROOT... |
public class AdminToolLog4j2Util { /** * closes output stream and removes appender from loggers
* @ param appenderName
* @ throws IOException
* @ since 1.1.1 */
public void closeOutputStreamAppender ( String appenderName ) throws IOException { } } | if ( null == appenderName ) { return ; } final LoggerContext ctx = ( LoggerContext ) LogManager . getContext ( false ) ; final Configuration config = ctx . getConfiguration ( ) ; AdminToolLog4j2OutputStream baos = outputStreams . get ( appenderName ) ; if ( null != config && null != config . getAppenders ( ) ) { Output... |
public class Mapper1_0 { /** * / * ( non - Javadoc )
* @ see com . att . authz . certman . mapper . Mapper # toDrop ( com . att . authz . env . AuthzTrans , java . lang . Object ) */
@ Override public Result < CertDrop > toDrop ( AuthzTrans trans , BaseRequest req ) { } } | return Result . err ( Result . ERR_NotImplemented , "Not Implemented... yet" ) ; |
public class Identity { /** * OJB can handle only classes that declare at least one primary key attribute ,
* this method checks this condition .
* @ param realObject The real object to check
* @ throws ClassNotPersistenceCapableException thrown if no primary key is specified for the objects class */
protected vo... | // if no PKs are specified OJB can ' t handle this class !
if ( m_pkValues == null || m_pkValues . length == 0 ) { throw createException ( "OJB needs at least one primary key attribute for class: " , realObject , null ) ; } // arminw : should never happen
// if ( m _ pkValues [ 0 ] instanceof ValueContainer )
// throw ... |
public class JaxWsHttpServletRequestAdapter { /** * ( non - Javadoc )
* @ see javax . servlet . http . HttpServletRequest # getPart ( java . lang . String ) */
@ Override public Part getPart ( String arg0 ) throws IOException , ServletException { } } | try { collaborator . preInvoke ( componentMetaData ) ; return request . getPart ( arg0 ) ; } finally { collaborator . postInvoke ( ) ; } |
public class MultipartPostRequest { /** * Adds a file parameter to the request
* @ param name
* parameter name
* @ param filename
* the name of the file
* @ param is
* input stream to read the contents of the file from */
public void setParameter ( final String name , final String filename , final InputStre... | boundary ( ) ; writeName ( name ) ; write ( "; filename=\"" ) ; write ( filename ) ; write ( '"' ) ; newline ( ) ; write ( "Content-Type: " ) ; String type = URLConnection . guessContentTypeFromName ( filename ) ; if ( type == null ) { type = "application/octet-stream" ; } writeln ( type ) ; newline ( ) ; pipe ( is , o... |
public class ColumnInfo { /** * Get the value associated with this field from the object parameter either by getting from the field or calling
* the get method . */
public T getValue ( Object obj ) throws IllegalAccessException , InvocationTargetException { } } | if ( field == null ) { @ SuppressWarnings ( "unchecked" ) T cast = ( T ) getMethod . invoke ( obj ) ; return cast ; } else { @ SuppressWarnings ( "unchecked" ) T cast = ( T ) field . get ( obj ) ; return cast ; } |
public class RRDToolWriter { /** * Get a list of DsNames used to create the datasource . */
private List < String > getDsNames ( DsDef [ ] defs ) { } } | List < String > names = new ArrayList < > ( ) ; for ( DsDef def : defs ) { names . add ( def . getDsName ( ) ) ; } return names ; |
public class UpdateRuleRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateRuleRequest updateRuleRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateRuleRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateRuleRequest . getRuleId ( ) , RULEID_BINDING ) ; protocolMarshaller . marshall ( updateRuleRequest . getChangeToken ( ) , CHANGETOKEN_BINDING ) ; protocolMarshal... |
public class CmsSecurityManager { /** * Moves an user to the given organizational unit . < p >
* @ param context the current request context
* @ param orgUnit the organizational unit to add the principal to
* @ param user the user that is to be move to the organizational unit
* @ throws CmsException if somethin... | CmsDbContext dbc = m_dbContextFactory . getDbContext ( context ) ; try { checkRole ( dbc , CmsRole . ADMINISTRATOR . forOrgUnit ( orgUnit . getName ( ) ) ) ; checkOfflineProject ( dbc ) ; m_driverManager . setUsersOrganizationalUnit ( dbc , orgUnit , user ) ; } catch ( Exception e ) { dbc . report ( null , Messages . g... |
public class TransactionContext { /** * Aborts the given transaction , and rolls back all data set changes . If rollback fails ,
* the transaction is invalidated . If an exception is caught during rollback , the exception
* is rethrown wrapped into a TransactionFailureException , after all remaining TransactionAwar... | if ( currentTx == null ) { // might be called by some generic exception handler even though already aborted / finished - we allow that
return ; } try { boolean success = true ; for ( TransactionAware txAware : txAwares ) { try { if ( ! txAware . rollbackTx ( ) ) { success = false ; } } catch ( Throwable e ) { String me... |
public class GeomajasServiceImpl { /** * Register the given { @ link Map } with applicationId and mapId .
* @ param applicationId
* the application id .
* @ param mapId
* the map id .
* @ param map
* the map to register . */
public void registerMap ( String applicationId , String mapId , Map map ) { } } | HashMap < String , Map > mapMap ; if ( maps . containsKey ( applicationId ) ) { mapMap = maps . get ( applicationId ) ; if ( ! mapMap . containsKey ( mapId ) ) { mapMap . put ( mapId , map ) ; } } else { mapMap = new HashMap < String , Map > ( ) ; mapMap . put ( mapId , map ) ; maps . put ( applicationId , mapMap ) ; } |
public class Ix { /** * Emits the elements of the other sequence if this sequence is empty .
* The result ' s Iterator forwards calls of remove ( ) to this ' or the other ' s Iterator .
* @ param other the other Iterable instance , not null
* @ return the new Ix instance
* @ throws NullPointerException if other... | return new IxSwitchIfEmpty < T > ( this , nullCheck ( other , "other is null" ) ) ; |
public class Ledgers { /** * Closes the given LedgerHandle .
* @ param handle The LedgerHandle to close .
* @ throws DurableDataLogException If an exception occurred . The causing exception is wrapped inside it . */
static void close ( LedgerHandle handle ) throws DurableDataLogException { } } | try { Exceptions . handleInterrupted ( handle :: close ) ; } catch ( BKException bkEx ) { throw new DurableDataLogException ( String . format ( "Unable to close ledger %d." , handle . getId ( ) ) , bkEx ) ; } |
public class RBBITableBuilder { void mergeRuleStatusVals ( ) { } } | // The basic outline of what happens here is this . . .
// for each state in this state table
// if the status tag list for this state is in the global statuses list
// record where and
// continue with the next state
// else
// add the tag list for this state to the global list .
int n ; // Pre - load a single tag of ... |
public class SendTaskHeartbeatRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SendTaskHeartbeatRequest sendTaskHeartbeatRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( sendTaskHeartbeatRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( sendTaskHeartbeatRequest . getTaskToken ( ) , TASKTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON... |
public class CssBoxPngRenderer { /** * Renders the URL and prints the result to the specified output stream in
* the specified format .
* @ param urlstring
* the source URL
* @ param out
* output stream
* @ param type
* output type
* @ return true in case of success , false otherwise
* @ throws SAXExc... | // Open the network connection
DocumentSource docSource = new DefaultDocumentSource ( urlstring ) ; // Parse the input document
DOMSource parser = new DefaultDOMSource ( docSource ) ; Document doc = parser . parse ( ) ; // create the media specification
MediaSpec media = new MediaSpec ( mediaType ) ; media . setDimensi... |
public class CmsNewResourceBuilder { /** * Creates a resource , but doesn ' t throw any exceptions . < p >
* Exceptions will be passed to the onError method of registered callbacks . < p >
* @ return the created resource */
public CmsResource safeCreateResource ( ) { } } | try { return createResource ( ) ; } catch ( Exception e ) { for ( I_Callback callback : m_callbacks ) { callback . onError ( e ) ; } return null ; } |
public class NonBlockingBufferedOutputStream { /** * Writes < code > len < / code > bytes from the specified byte array starting at
* offset < code > off < / code > to this buffered output stream .
* Ordinarily this method stores bytes from the given array into this stream ' s
* buffer , flushing the buffer to th... | if ( nLen >= m_aBuf . length ) { /* * If the request length exceeds the size of the output buffer , flush the
* output buffer and then write the data directly . In this way buffered
* streams will cascade harmlessly . */
_flushBuffer ( ) ; out . write ( aBuf , nOfs , nLen ) ; return ; } if ( nLen > m_aBuf . length ... |
public class ProducerService { /** * Publish a message to the specified producer . Use this only when publishing to a single
* producer .
* @ param channel The channel on which to publish the message .
* @ param message Message to publish .
* @ param producer The message producer .
* @ param recipients Option... | if ( producer != null ) { prepare ( channel , message , recipients ) ; return producer . publish ( channel , message ) ; } return false ; |
public class BufferInt { /** * Adds a new value .
* @ param value new value */
public void addInt ( int value ) { } } | data [ endOffset ] = value ; endOffset ++ ; // Grow the buffer if needed
if ( endOffset == data . length ) resize ( ) ; |
public class ExampleColorBackend { /** * Creates a simple animation backend that cycles through a list of colors .
* @ return the backend to use */
public static AnimationBackend createSampleColorAnimationBackend ( Resources resources ) { } } | // Get the animation duration in ms for each color frame
int frameDurationMs = resources . getInteger ( android . R . integer . config_mediumAnimTime ) ; // Create and return the backend
return new ExampleColorBackend ( SampleData . COLORS , frameDurationMs ) ; |
public class BinaryString { /** * Reverse each character in current string .
* @ return a new string which character order is reverse to current string . */
public BinaryString reverse ( ) { } } | ensureMaterialized ( ) ; if ( inFirstSegment ( ) ) { byte [ ] result = new byte [ this . sizeInBytes ] ; // position in byte
int byteIdx = 0 ; while ( byteIdx < sizeInBytes ) { int charBytes = numBytesForFirstByte ( getByteOneSegment ( byteIdx ) ) ; segments [ 0 ] . get ( offset + byteIdx , result , result . length - b... |
public class VisualizeImageData { /** * Renders a gray scale image using color values from cold to hot .
* @ param disparity Input disparity image
* @ param dst Where the image is rendered into . If null a new BufferedImage will be created and return .
* @ param minDisparity Minimum disparity that can be computed... | if ( dst == null ) dst = new BufferedImage ( disparity . getWidth ( ) , disparity . getHeight ( ) , BufferedImage . TYPE_INT_RGB ) ; if ( disparity . getDataType ( ) . isInteger ( ) ) { return disparity ( ( GrayI ) disparity , dst , minDisparity , maxDisparity , invalidColor ) ; } else if ( disparity instanceof GrayF32... |
public class EmbeddedGobblinDistcp { /** * If { @ link # delete ( ) } is used , specifies that newly empty parent directories should also be deleted . */
@ CliObjectOption ( description = "If deleting files on target, also delete newly empty parent directories." ) public EmbeddedGobblinDistcp deleteEmptyParentDirectori... | this . setConfiguration ( RecursiveCopyableDataset . DELETE_EMPTY_DIRECTORIES_KEY , Boolean . toString ( true ) ) ; return this ; |
public class CmsUser { /** * Sets the zip code information of this user . < p >
* @ param zipcode the zip code information to set */
public void setZipcode ( String zipcode ) { } } | checkZipCode ( zipcode ) ; if ( zipcode != null ) { zipcode = zipcode . toUpperCase ( ) ; } setAdditionalInfo ( CmsUserSettings . ADDITIONAL_INFO_ZIPCODE , zipcode ) ; |
public class DefaultYAMLParser { /** * the generated parser .
* Maintains a dynamic state and value stack .
* @ param yyLex scanner .
* @ return result of the last reduction , if any . */
public Object yyparse ( yyInput yyLex ) throws java . io . IOException { } } | if ( yyMax <= 0 ) yyMax = 256 ; // initial size
int yyState = 0 , yyStates [ ] = new int [ yyMax ] ; // state stack
Object yyVal = null , yyVals [ ] = new Object [ yyMax ] ; // value stack
int yyToken = - 1 ; // current input
int yyErrorFlag = 0 ; // # tokens to shift
yyLoop : for ( int yyTop = 0 ; ; ++ yyTop ) { if ( ... |
public class ClassUtils { /** * Return a list of class setters . Supports inheritance and overriding , that is when a method is found on the
* lowest level of inheritance chain , no other method can override it . Supports inheritance
* and doesn ' t return synthetic methods .
* @ param beanClass class to be searc... | Map < String , Method > result = new HashMap < > ( ) ; Class < ? > currentClass = beanClass ; while ( currentClass != null && currentClass != Object . class ) { for ( Method method : currentClass . getDeclaredMethods ( ) ) { if ( ! method . isSynthetic ( ) && isSetter ( method ) ) { result . putIfAbsent ( method . getN... |
public class StandardChecker { /** * Checkt to make sure an arg doesn ' t have duplicate modifiers */
private List < SemanticError > check ( DataType dataType , Constructor constructor , Arg arg ) { } } | logger . finest ( "Checking semantic constraints on data type " + dataType . name + ", constructor " + constructor . name ) ; final List < SemanticError > errors = new ArrayList < SemanticError > ( ) ; final Set < ArgModifier > modifiers = new HashSet < ArgModifier > ( ) ; for ( ArgModifier modifier : arg . modifiers )... |
public class ImportCatalogActionRelative { /** * get result . */
@ Override public void getResult ( final ContentHandler buf ) throws SAXException { } } | final String templateFilePath = paramTable . get ( FileGenerator . PARAM_TEMPLATE ) ; for ( final Value value : valueSet ) { buf . startElement ( "urn:oasis:names:tc:entity:xmlns:xml:catalog" , "nextCatalog" , "nextCatalog" , new AttributesBuilder ( ) . add ( "catalog" , FileUtils . getRelativeUnixPath ( templateFilePa... |
public class CachedMonitorSource { /** * Get monitor information for given location .
* First monitor information is looked up in cache .
* Then , when not found , delegate is called .
* @ param location Location
* @ return Monitor information */
private MonitorInformation getMonitorInformation ( L location ) {... | final K monitorKey = getLocationKey ( location ) ; MonitorInformation monitorInformation = monitorInformations . get ( monitorKey ) ; if ( monitorInformation == null ) { // Not found , let ' s call delegate
if ( delegate . isMonitored ( location ) ) { monitorInformation = new MonitorInformation ( true , delegate . getM... |
public class TableModel { /** * Adds a new column into the table model as the last column . You can optionally supply values for the existing rows
* through the { @ code newColumnValues } .
* @ param label Label for the header of the new column
* @ param newColumnValues Optional values to assign to the existing r... | return insertColumn ( getColumnCount ( ) , label , newColumnValues ) ; |
public class XmlJobDefExporter { /** * Exports several ( given ) job def to a given stream . Stream is not closed here . */
public static void export ( OutputStream os , List < JobDef > jobDefList , DbConn cnx ) throws JqmXmlException { } } | // Argument tests
if ( os == null ) { throw new IllegalArgumentException ( "output stream cannot be null" ) ; } if ( jobDefList == null || jobDefList . isEmpty ( ) ) { throw new IllegalArgumentException ( "job def list cannot be null or empty" ) ; } if ( cnx == null ) { throw new IllegalArgumentException ( "database co... |
public class SiteJarResourceLoader { /** * Things won ' t ever be modified when loaded from the servlet context
* because they came from the webapp . war file and if that is reloaded ,
* everything will be thrown away and started afresh . */
@ Override public boolean isSourceModified ( Resource resource ) { } } | SiteKey skey = new SiteKey ( resource . getName ( ) ) ; // if the resource is for the default site , it is never considered to
// be modified
if ( skey . siteId == SiteIdentifier . DEFAULT_SITE_ID ) { return false ; } else { // otherwise compare the last modified time of the loaded resource
// with that of the associat... |
public class ProtocolDataUnit { /** * Reads from the given < code > SocketChannel < / code > all the neccassary bytes to fill this PDU .
* @ param sChannel < code > SocketChannel < / code > to read from .
* @ return The number of bytes , possibly zero , or < code > - 1 < / code > if the channel has reached end - of... | // read Basic Header Segment first to determine the total length of this
// Protocol Data Unit .
clear ( ) ; final ByteBuffer bhs = ByteBuffer . allocate ( BasicHeaderSegment . BHS_FIXED_SIZE ) ; int len = 0 ; while ( len < BasicHeaderSegment . BHS_FIXED_SIZE ) { int lens = sChannel . read ( bhs ) ; if ( lens == - 1 ) ... |
public class DatanodeID { /** * { @ inheritDoc } */
public void write ( DataOutput out ) throws IOException { } } | UTF8 . writeStringOpt ( out , name ) ; UTF8 . writeStringOpt ( out , storageID ) ; out . writeShort ( infoPort ) ; |
public class ProductPartitionTree { /** * Returns a new instance of this class by retrieving the product partitions of the
* specified ad group . All parameters are required . */
public static ProductPartitionTree createAdGroupTree ( AdWordsServicesInterface services , AdWordsSession session , Long adGroupId ) throws... | return new ProductPartitionTree ( ProductPartitionTreeImpl . createAdGroupTree ( services , session , adGroupId ) ) ; |
public class CSSWriter { /** * Write the CSS content to the passed writer . No specific charset is used .
* @ param aCSS
* The CSS to write . May not be < code > null < / code > .
* @ param aWriter
* The write to write the text to . May not be < code > null < / code > . Is
* automatically closed after the wri... | ValueEnforcer . notNull ( aCSS , "CSS" ) ; ValueEnforcer . notNull ( aWriter , "Writer" ) ; try { final boolean bOptimizedOutput = m_aSettings . isOptimizedOutput ( ) ; final String sNewLineString = m_aSettings . getNewLineString ( ) ; // Write file header
if ( m_bWriteHeaderText && StringHelper . hasText ( m_sHeaderTe... |
public class CmsWidgetDialogParameter { /** * Checks if a value for this widget base type with the given id is available . < p >
* This should only be used if the base object is a collection . < p >
* @ param index the index to check
* @ return < code > true < / code > if a value for this widget base type with th... | if ( m_baseCollection instanceof List ) { return index < ( ( List < ? > ) m_baseCollection ) . size ( ) ; } else if ( m_baseCollection instanceof SortedMap ) { return index < ( ( SortedMap < ? , ? > ) m_baseCollection ) . size ( ) ; } return false ; |
public class CcgParse { /** * Gets the lexicon entries for all terminal children of this
* parse tree node , in left - to - right order .
* @ return */
public List < LexiconEntryInfo > getSpannedLexiconEntries ( ) { } } | if ( isTerminal ( ) ) { return Arrays . asList ( lexiconEntry ) ; } else { List < LexiconEntryInfo > lexiconEntries = Lists . newArrayList ( ) ; lexiconEntries . addAll ( left . getSpannedLexiconEntries ( ) ) ; lexiconEntries . addAll ( right . getSpannedLexiconEntries ( ) ) ; return lexiconEntries ; } |
public class MoreThrowables { /** * Throws { code t } if it is an instance of { @ link RuntimeException } or { @ link Error } .
* < p > This is intended to mimic Guava ' s method by the same name , but which is unavailable to us
* due to compatibility with older Guava versions . */
public static void throwIfUncheck... | Preconditions . checkNotNull ( t ) ; if ( t instanceof RuntimeException ) { throw ( RuntimeException ) t ; } if ( t instanceof Error ) { throw ( Error ) t ; } |
public class ConnectionPool { /** * Sets the login timeout for any segments that are configured
* with a { @ code DataSource } for connections .
* @ param seconds The timeout in seconds . */
void setDataSourceLoginTimeout ( int seconds ) throws SQLException { } } | for ( ConnectionPoolSegment segment : segments ) { if ( segment . dbConnection . datasource != null ) { segment . dbConnection . datasource . setLoginTimeout ( seconds ) ; } } |
public class Task { /** * Update resource information counters */
void updateResourceCounters ( ) { } } | if ( resourceCalculator == null ) { return ; } ProcResourceValues res = resourceCalculator . getProcResourceValues ( ) ; long cpuTime = res . getCumulativeCpuTime ( ) ; long pMem = res . getPhysicalMemorySize ( ) ; long vMem = res . getVirtualMemorySize ( ) ; long cpuJvmTime = this . jmxThreadInfoTracker . getCumulativ... |
public class InstanceClient { /** * Deletes the specified Instance resource . For more information , see Stopping or Deleting an
* Instance .
* < p > Sample code :
* < pre > < code >
* try ( InstanceClient instanceClient = InstanceClient . create ( ) ) {
* ProjectZoneInstanceName instance = ProjectZoneInstanc... | DeleteInstanceHttpRequest request = DeleteInstanceHttpRequest . newBuilder ( ) . setInstance ( instance ) . build ( ) ; return deleteInstance ( request ) ; |
public class NodeOverridesMarshaller { /** * Marshall the given parameter object . */
public void marshall ( NodeOverrides nodeOverrides , ProtocolMarshaller protocolMarshaller ) { } } | if ( nodeOverrides == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( nodeOverrides . getNumNodes ( ) , NUMNODES_BINDING ) ; protocolMarshaller . marshall ( nodeOverrides . getNodePropertyOverrides ( ) , NODEPROPERTYOVERRIDES_BINDING ) ; } c... |
public class KeyEncoder { /** * Encodes the given Double object into exactly 8 bytes for descending
* order . A non - canonical NaN value is used to represent null .
* @ param value optional Double value to encode
* @ param dst destination for encoded bytes
* @ param dstOffset offset into destination array */
p... | if ( value == null ) { DataEncoder . encode ( ~ 0x7fffffffffffffffL , dst , dstOffset ) ; } else { encodeDesc ( value . doubleValue ( ) , dst , dstOffset ) ; } |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcMapConversion ( ) { } } | if ( ifcMapConversionEClass == null ) { ifcMapConversionEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 354 ) ; } return ifcMapConversionEClass ; |
public class FactorGraph { /** * Gets the indices of all factors which are adjacent ( that is ,
* share at least one variable ) with { @ code factorNum } .
* @ param factorNum
* @ return */
public Set < Integer > getAdjacentFactors ( int factorNum ) { } } | Set < Integer > adjacentFactors = Sets . newHashSet ( ) ; for ( Integer variableNum : factorVariableMap . get ( factorNum ) ) { adjacentFactors . addAll ( variableFactorMap . get ( variableNum ) ) ; } return adjacentFactors ; |
public class PredictionsImpl { /** * Gets predictions for a given utterance , in the form of intents and entities . The current maximum query size is 500 characters .
* @ param appId The LUIS application ID ( Guid ) .
* @ param query The utterance to predict .
* @ param resolveOptionalParameter the object represe... | if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } if ( query == null ) { throw new IllegalArgument... |
public class TracingSugar { /** * Convenience shorthand for < code > obj . trace . appendTemplate ( ' ' ' some template ' ' ' ) < / code > */
public CompositeGeneratorNode trace ( final EObject obj , final StringConcatenationClient code ) { } } | return this . appendTemplate ( this . trace ( obj ) , code ) ; |
public class FileUtils { /** * Deprecated in favor of the CharSource version to force the user to define their encoding . If
* you call this , it will use UTF _ 8 encoding .
* @ deprecated */
@ Deprecated public static ImmutableMultimap < Symbol , Symbol > loadSymbolMultimap ( File multimapFile ) throws IOException... | return loadSymbolMultimap ( Files . asCharSource ( multimapFile , Charsets . UTF_8 ) ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcRelConnectsPathElements ( ) { } } | if ( ifcRelConnectsPathElementsEClass == null ) { ifcRelConnectsPathElementsEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 535 ) ; } return ifcRelConnectsPathElementsEClass ; |
public class AnnotationSagaAnalyzer { /** * Checks all methods for saga annotations . */
private SagaHandlersMap determineMessageHandlers ( final Class < ? extends Saga > sagaType ) { } } | SagaHandlersMap handlerMap = new SagaHandlersMap ( sagaType ) ; Method [ ] methods = sagaType . getMethods ( ) ; for ( Method method : methods ) { if ( isHandlerMethod ( method ) ) { // method matches expected handler signature - > add to handler map
Class < ? > handlerType = method . getParameterTypes ( ) [ 0 ] ; bool... |
public class RemoteMongoCollectionImpl { /** * Finds a document in the collection and delete it .
* @ param filter the query filter
* @ return a task containing the resulting document */
public Task < DocumentT > findOneAndDelete ( final Bson filter ) { } } | return dispatcher . dispatchTask ( new Callable < DocumentT > ( ) { @ Override public DocumentT call ( ) { return proxy . findOneAndDelete ( filter ) ; } } ) ; |
public class CommerceWarehouseItemLocalServiceUtil { /** * Updates the commerce warehouse item in the database or adds it if it does not yet exist . Also notifies the appropriate model listeners .
* @ param commerceWarehouseItem the commerce warehouse item
* @ return the commerce warehouse item that was updated */
... | return getService ( ) . updateCommerceWarehouseItem ( commerceWarehouseItem ) ; |
public class Lock { /** * Releases the exclusive lock .
* @ exception NoExclusiveLockException The caller does not hold the exclusive lock . */
public void releaseExclusiveLock ( ) throws NoExclusiveLockException { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "releaseExclusiveLock" , this ) ; Thread currentThread = Thread . currentThread ( ) ; synchronized ( this ) { if ( ( _threadHoldingExclusiveLock == null ) || ( ! _threadHoldingExclusiveLock . equals ( currentThread ) ) ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , ... |
public class AbstractMessageSelector { /** * Reads message payload as String either from message object directly or from nested Citrus message representation .
* @ param message
* @ return */
String getPayloadAsString ( Message < ? > message ) { } } | if ( message . getPayload ( ) instanceof com . consol . citrus . message . Message ) { return ( ( com . consol . citrus . message . Message ) message . getPayload ( ) ) . getPayload ( String . class ) ; } else { return message . getPayload ( ) . toString ( ) ; } |
public class PingsActivity { /** * Listeners section */
public View . OnClickListener getPingDetailListener ( final GeoPoint targetUserGeoPoint ) { } } | return new View . OnClickListener ( ) { @ Override public void onClick ( View view ) { Lifecycle . runMatchViewActivityFromPings ( PingsActivity . this , currentUserGeoPoint , targetUserGeoPoint , "1" ) ; } } ; |
public class TitlePaneCloseButtonPainter { /** * Create the gradient for the close button .
* @ param s the shape to fill .
* @ param top the top color .
* @ param bottom the bottom color .
* @ return the gradient . */
private Paint decodeCloseGradient ( Shape s , Color top , Color bottom ) { } } | Rectangle r = s . getBounds ( ) ; int width = r . width ; int height = r . height ; return createGradient ( r . x + width / 2 , r . y , r . x + width / 2 , r . y + height - 1 , new float [ ] { 0f , 1f } , new Color [ ] { top , bottom } ) ; |
public class ElementPlugin { /** * Sets a value for a registered property .
* @ param propInfo Property info .
* @ param value The value to set .
* @ throws Exception Unspecified exception . */
@ Override public void setPropertyValue ( PropertyInfo propInfo , Object value ) throws Exception { } } | String propId = propInfo . getId ( ) ; Object obj = registeredProperties == null ? null : registeredProperties . get ( propId ) ; if ( obj == null ) { obj = new PropertyProxy ( propInfo , value ) ; registerProperties ( obj , propId ) ; } else if ( obj instanceof PropertyProxy ) { ( ( PropertyProxy ) obj ) . setValue ( ... |
public class DefaultVOMSProxyInfoBehaviour { /** * Returns a formatted list of KeyUsage */
private String getProxyKeyUsages ( ) { } } | StringBuilder usage = new StringBuilder ( ) ; Iterator < String > it = proxyKeyUsageList . iterator ( ) ; if ( it . hasNext ( ) ) usage . append ( it . next ( ) ) ; while ( it . hasNext ( ) ) { usage . append ( ", " + it . next ( ) ) ; } return usage . toString ( ) ; |
public class SmartsFragmentExtractor { /** * Select the lowest ring number for use in SMARTS .
* @ return ring number
* @ throws IllegalStateException all ring numbers are used */
private int chooseRingNumber ( ) { } } | for ( int i = 1 ; i < rnums . length ; i ++ ) { if ( rnums [ i ] == 0 ) { rnums [ i ] = 1 ; return i ; } } throw new IllegalStateException ( "No more ring numbers available!" ) ; |
public class Message { /** * Returns timestamp as an { @ link java . time . Instant } .
* @ return a java . time . Instant representing the message timestamp */
Instant getInstant ( ) { } } | // long tsSeconds = TimeUnit . NANOSECONDS . toSeconds ( this . timestamp ) ;
long tsSeconds = this . timestamp / 1000000000L ; long tsNanos = this . timestamp - ( tsSeconds * 1000000000L ) ; return Instant . ofEpochSecond ( tsSeconds ) . plusNanos ( tsNanos ) ; |
public class BlacklistedDirectories { /** * Adds parent directory of the file ( or the file itself , if it is a directory )
* to the set of unreadable directories .
* @ return the blacklisted directory or null if nothing has been added to the list . */
public static File maybeMarkUnreadable ( File path ) { } } | File directory = getDirectory ( path ) ; if ( instance . unreadableDirectories . add ( directory ) ) { logger . warn ( "Blacklisting {} for reads" , directory ) ; return directory ; } return null ; |
public class JsonFluentAssert { /** * Compares JSON for equality . The expected object is converted to JSON
* before comparison . Ignores order of sibling nodes and whitespaces .
* Please note that if you pass a String , it ' s parsed as JSON which can lead to an
* unexpected behavior . If you pass in " 1 " it is... | Diff diff = createDiff ( expected , configuration ) ; diff . failIfDifferent ( description ) ; return this ; |
public class FieldAccess { /** * Check that the Variables determined for the field and the value
* loaded / stored are consistent with previous variable definitions .
* @ param field
* Variable representing the field
* @ param value
* Variable representing the value loaded / stored
* @ param bindingSet
* ... | // Ensure that the field and value variables are consistent with
// previous definitions ( if any )
bindingSet = addOrCheckDefinition ( fieldVarName , field , bindingSet ) ; if ( bindingSet == null ) { return null ; } bindingSet = addOrCheckDefinition ( valueVarName , value , bindingSet ) ; if ( bindingSet == null ) { ... |
public class DateTimeFormatter { /** * Parses the default style of the { @ link DateFormat } from context labels .
* @ param args The arguments of the macro .
* @ return The id of the style . */
private int parseDateFormatStyle ( Arguments args ) { } } | if ( args . has ( SHORT_STYLE ) ) { return DateFormat . SHORT ; } else if ( args . has ( MEDIUM_STYLE ) ) { return DateFormat . MEDIUM ; } else if ( args . has ( LONG_STYLE ) ) { return DateFormat . LONG ; } else if ( args . has ( FULL_STYLE ) ) { return DateFormat . FULL ; } return DateFormat . DEFAULT ; |
public class BPR { /** * The function determines the subbuckets after refining this bucket and recursively
* calls the refinement function for the subbuckets .
* @ param leftPtr points to the leftmost suffix of the current bucket .
* @ param rightPtr points to the rightmost suffix of the current bucket .
* @ pa... | /* * for all buckets with resp . pointer > rightPtr determine buckets via setting
* sufPtrMap */
int leftIntervalPtr = rightPtr ; int rightIntervalPtr = rightPtr ; int tmpPtr ; while ( leftPtr <= leftIntervalPtr && rightPtr < ( tmpPtr = sufPtrMap [ suffixArray [ leftIntervalPtr ] + offset ] ) ) { do { sufPtrMap [ suf... |
public class AffectedChecker { /** * Find all non affected classes . */
private static void includeAffected ( Set < String > allClasses , Set < String > affectedClasses , List < File > sortedFiles ) { } } | Storer storer = Config . createStorer ( ) ; Hasher hasher = Config . createHasher ( ) ; NameBasedCheck classCheck = Config . DEBUG_MODE_V != Config . DebugMode . NONE ? new DebugNameCheck ( storer , hasher , DependencyAnalyzer . CLASS_EXT ) : new NameBasedCheck ( storer , hasher , DependencyAnalyzer . CLASS_EXT ) ; Nam... |
public class StringValueArrayComparator { /** * Read the length of the next serialized { @ code StringValue } .
* @ param source the input view containing the record
* @ return the length of the next serialized { @ code StringValue }
* @ throws IOException if the input view raised an exception when reading the le... | int len = source . readByte ( ) & 0xFF ; if ( len >= HIGH_BIT ) { int shift = 7 ; int curr ; len = len & 0x7F ; while ( ( curr = source . readByte ( ) & 0xFF ) >= HIGH_BIT ) { len |= ( curr & 0x7F ) << shift ; shift += 7 ; } len |= curr << shift ; } return len ; |
public class DefaultGroovyMethods { /** * Removes the last item from the List .
* < pre class = " groovyTestCase " >
* def list = [ " a " , false , 2]
* assert list . removeLast ( ) = = 2
* assert list = = [ " a " , false ]
* < / pre >
* Using add ( ) and removeLast ( ) is similar to push and pop on a Stack... | if ( self . isEmpty ( ) ) { throw new NoSuchElementException ( "Cannot removeLast() an empty List" ) ; } return self . remove ( self . size ( ) - 1 ) ; |
public class AssociativeArray2D { /** * Convenience function used to put a value in a particular key positions .
* @ param key1
* @ param key2
* @ param value
* @ return */
public final Object put2d ( Object key1 , Object key2 , Object value ) { } } | AssociativeArray tmp = internalData . get ( key1 ) ; if ( tmp == null ) { internalData . put ( key1 , new AssociativeArray ( ) ) ; } return internalData . get ( key1 ) . internalData . put ( key2 , value ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.