signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class FormulaWriter { /** * Writes a given formula to a file with a given formula formatter .
* @ param fileName the file name of the file
* @ param formula the formula to write
* @ param splitAndMultiline indicates whether - if the formula is an conjunction - the single operands should be
* written to d... | write ( new File ( fileName ) , formula , splitAndMultiline , formatter ) ; |
public class JainSipUtils { /** * RFC 1918 address spaces */
public static int getAddressOutboundness ( String address ) { } } | if ( address . startsWith ( "127.0" ) ) return 0 ; if ( address . startsWith ( "192.168" ) ) return 1 ; if ( address . startsWith ( "10." ) ) return 2 ; if ( address . startsWith ( "172.16" ) || address . startsWith ( "172.17" ) || address . startsWith ( "172.18" ) || address . startsWith ( "172.19" ) || address . star... |
public class SynchronizeFXTomcatServlet { /** * Creates a new { @ link SynchronizeFxServer } that synchronizes it ' s own model .
* Each { @ link SynchronizeFxServer } managed by this servlet must have its own channel name .
* @ param root The root object of the model that should be synchronized .
* @ param chann... | synchronized ( channels ) { if ( channels . containsKey ( channelName ) ) { throw new IllegalArgumentException ( "A new SynchronizeFX channel with the name \"" + channelName + "\" should be created a channel with this name does already exist." ) ; } final SynchronizeFXTomcatChannel channel = new SynchronizeFXTomcatChan... |
public class BeamSearch { /** * Returns the best sequence of outcomes based on model for this object .
* @ param sequence The input sequence .
* @ param additionalContext An Object [ ] of additional context . This is passed to the context generator blindly with the assumption that the context are appropiate .
* @... | return bestSequences ( 1 , sequence , additionalContext , zeroLog ) [ 0 ] ; |
public class CmsSetupUI { /** * Shows the given step .
* @ param step the step */
protected void showStep ( A_CmsSetupStep step ) { } } | Window window = newWindow ( ) ; window . setContent ( step ) ; window . setCaption ( step . getTitle ( ) ) ; A_CmsUI . get ( ) . addWindow ( window ) ; window . center ( ) ; |
public class CommentGenerator { /** * 添加新元素到子元素的最前面 */
public void addToFirstChildren ( XmlElement parent , Element child ) { } } | List < Element > elements = parent . getElements ( ) ; elements . add ( 0 , child ) ; |
public class CmsDomUtil { /** * Returns the computed style of the given element as floating point number . < p >
* @ param element the element
* @ param style the CSS property
* @ return the currently computed style */
public static double getCurrentStyleFloat ( Element element , Style style ) { } } | String currentStyle = getCurrentStyle ( element , style ) ; return CmsClientStringUtil . parseFloat ( currentStyle ) ; |
public class ShrinkWrapPath { /** * Relativizes the paths recursively
* @ param thisOriginal
* @ param thisCurrent
* @ param otherOriginal
* @ param otherCurrent
* @ param backupCount
* @ return */
private static ShrinkWrapPath relativizeCommonRoot ( final ShrinkWrapPath thisOriginal , final Path thisCurren... | // Preconditions
assert thisOriginal != null ; assert thisCurrent != null ; assert otherOriginal != null ; assert otherCurrent != null ; assert backupCount >= 0 ; // Do we yet have a common root ?
if ( ! otherCurrent . startsWith ( thisCurrent ) ) { // Back up until we do
final Path otherParent = otherCurrent . getPare... |
public class LabelSetterFactory { /** * フィールドのラベル情報を設定するためのアクセッサを作成します 。
* @ param beanClass フィールドが定義されているクラス情報
* @ param fieldName フィールドの名称
* @ return 位置情報のsetterが存在しない場合は空を返す 。
* @ throws IllegalArgumentException { @ literal beanClass = = null or fieldName = = null }
* @ throws IllegalArgumentExceptio... | ArgUtils . notNull ( beanClass , "beanClass" ) ; ArgUtils . notEmpty ( fieldName , "fieldName" ) ; // フィールド Map labelsの場合
Optional < LabelSetter > LabelSetter = createMapField ( beanClass , fieldName ) ; if ( LabelSetter . isPresent ( ) ) { return LabelSetter ; } // setter メソッドの場合
LabelSetter = createMethod ( beanCla... |
public class Days { /** * Obtains a { @ code Days } from a text string such as { @ code PnD } .
* This will parse the string produced by { @ code toString ( ) } which is
* based on the ISO - 8601 period formats { @ code PnD } and { @ code PnW } .
* The string starts with an optional sign , denoted by the ASCII ne... | Objects . requireNonNull ( text , "text" ) ; Matcher matcher = PATTERN . matcher ( text ) ; if ( matcher . matches ( ) ) { int negate = "-" . equals ( matcher . group ( 1 ) ) ? - 1 : 1 ; String weeksStr = matcher . group ( 2 ) ; String daysStr = matcher . group ( 3 ) ; if ( weeksStr != null || daysStr != null ) { int d... |
public class RequestFromVertx { /** * Gets all the parameters from the request .
* @ return The parameters */
@ Override public Map < String , List < String > > parameters ( ) { } } | Map < String , List < String > > result = new HashMap < > ( ) ; for ( String key : request . params ( ) . names ( ) ) { result . put ( key , request . params ( ) . getAll ( key ) ) ; } return result ; |
public class SpatialDbsImportUtils { /** * Create a spatial table using a schema .
* @ param db the database to use .
* @ param schema the schema to use .
* @ param newTableName the new name of the table . If null , the shp name is used .
* @ return the name of the created table .
* @ param avoidSpatialIndex ... | GeometryDescriptor geometryDescriptor = schema . getGeometryDescriptor ( ) ; ADatabaseSyntaxHelper dsh = db . getType ( ) . getDatabaseSyntaxHelper ( ) ; List < String > attrSql = new ArrayList < String > ( ) ; List < AttributeDescriptor > attributeDescriptors = schema . getAttributeDescriptors ( ) ; for ( AttributeDes... |
public class PForDelta { /** * Decompress b - bit slots
* @ param outDecompSlots
* decompressed block which is the output
* @ param inCompBlock
* the compressed block which is the input
* @ param blockSize
* the block size
* @ param bits
* the value of the parameter b
* @ return the compressed size in... | int compressedBitSize = 0 ; int offset = HEADER_SIZE ; for ( int i = 0 ; i < blockSize ; i ++ ) { outDecompSlots [ i ] = readBits ( inCompBlock , offset , bits ) ; offset += bits ; } compressedBitSize = bits * blockSize ; return compressedBitSize ; |
public class RecurlyClient { /** * Deletes a specific redemption .
* @ param accountCode recurly account id
* @ param redemptionUuid recurly coupon redemption uuid */
public void deleteCouponRedemption ( final String accountCode , final String redemptionUuid ) { } } | doDELETE ( Accounts . ACCOUNTS_RESOURCE + "/" + accountCode + Redemption . REDEMPTIONS_RESOURCE + "/" + redemptionUuid ) ; |
public class DockerClient { /** * * MISC API */
public Info info ( ) throws DockerException { } } | WebResource webResource = client . resource ( restEndpointUrl + "/info" ) ; try { LOGGER . trace ( "GET: {}" , webResource ) ; return webResource . accept ( MediaType . APPLICATION_JSON ) . get ( Info . class ) ; } catch ( UniformInterfaceException exception ) { if ( exception . getResponse ( ) . getStatus ( ) == 500 )... |
public class RepositoryApi { /** * Get a Stream of repository branches from a project , sorted by name alphabetically .
* < pre > < code > GitLab Endpoint : GET / projects / : id / repository / branches < / code > < / pre >
* @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , o... | return ( getBranches ( projectIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; |
public class RecordingListener { /** * Process the queued items . */
private void processQueue ( ) { } } | CachedEvent cachedEvent ; try { IRTMPEvent event = null ; RTMPMessage message = null ; // get first event in the queue
cachedEvent = queue . poll ( ) ; if ( cachedEvent != null ) { // get the data type
final byte dataType = cachedEvent . getDataType ( ) ; // get the data
IoBuffer buffer = cachedEvent . getData ( ) ; //... |
public class LeaderRole { /** * Commits a command .
* @ param request the command request
* @ param future the command response future */
private void commitCommand ( CommandRequest request , CompletableFuture < CommandResponse > future ) { } } | final long term = raft . getTerm ( ) ; final long timestamp = System . currentTimeMillis ( ) ; CommandEntry command = new CommandEntry ( term , timestamp , request . session ( ) , request . sequenceNumber ( ) , request . operation ( ) ) ; appendAndCompact ( command ) . whenCompleteAsync ( ( entry , error ) -> { if ( er... |
public class DescribeStackSummaryRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeStackSummaryRequest describeStackSummaryRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeStackSummaryRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeStackSummaryRequest . getStackId ( ) , STACKID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JS... |
public class ImportSupport { /** * Strips a servlet session ID from < tt > url < / tt > . The session ID
* is encoded as a URL " path parameter " beginning with " jsessionid = " .
* We thus remove anything we find between " ; jsessionid = " ( inclusive )
* and either EOS or a subsequent ' ; ' ( exclusive ) . */
p... | StringBuffer u = new StringBuffer ( url ) ; int sessionStart ; while ( ( sessionStart = u . toString ( ) . indexOf ( ";jsessionid=" ) ) != - 1 ) { int sessionEnd = u . toString ( ) . indexOf ( ";" , sessionStart + 1 ) ; if ( sessionEnd == - 1 ) { sessionEnd = u . toString ( ) . indexOf ( "?" , sessionStart + 1 ) ; } if... |
public class DBFField { /** * Creates a DBFField object from the data read from the given
* DataInputStream .
* The data in the DataInputStream object is supposed to be organised
* correctly and the stream " pointer " is supposed to be positioned properly .
* @ param in DataInputStream
* @ param charset chars... | DBFField field = new DBFField ( ) ; byte t_byte = in . readByte ( ) ; if ( t_byte == ( byte ) 0x0d ) { return null ; } byte [ ] fieldName = new byte [ 11 ] ; in . readFully ( fieldName , 1 , 10 ) ; /* 1-10 */
fieldName [ 0 ] = t_byte ; int nameNullIndex = fieldName . length - 1 ; for ( int i = 0 ; i < fieldName . lengt... |
public class EpollServerSocketChannelConfig { /** * Set the { @ code TCP _ DEFER _ ACCEPT } option on the socket . See { @ code man 7 tcp } for more details . */
public EpollServerSocketChannelConfig setTcpDeferAccept ( int deferAccept ) { } } | try { ( ( EpollServerSocketChannel ) channel ) . socket . setTcpDeferAccept ( deferAccept ) ; return this ; } catch ( IOException e ) { throw new ChannelException ( e ) ; } |
public class CmsImageInfoDisplay { /** * Sets the crop format . < p >
* @ param cropFormat the crop format */
public void setCropFormat ( String cropFormat ) { } } | boolean visible = ( cropFormat != null ) ; if ( cropFormat == null ) { cropFormat = "" ; } m_labelCropFormat . setVisible ( visible ) ; m_removeCrop . setVisible ( visible ) ; m_displayCropFormat . setText ( cropFormat ) ; |
public class ZipFileContainer { /** * a single consolidated wrapper . */
@ Trivial private boolean deleteAll ( File rootFile ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Delete [ " + rootFile . getAbsolutePath ( ) + " ]" ) ; } if ( FileUtils . fileIsFile ( rootFile ) ) { boolean didDelete = FileUtils . fileDelete ( rootFile ) ; if ( ! didDelete ) { Tr . error ( tc , "Could not delete file [ ... |
public class StorageSnippets { /** * [ VARIABLE " my _ unique _ bucket " ] */
public Acl updateDefaultBucketAcl ( String bucketName ) { } } | // [ START updateDefaultBucketAcl ]
Acl acl = storage . updateDefaultAcl ( bucketName , Acl . of ( User . ofAllAuthenticatedUsers ( ) , Role . OWNER ) ) ; // [ END updateDefaultBucketAcl ]
return acl ; |
public class GSFLWImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . GSFLW__MH : setMH ( ( Integer ) newValue ) ; return ; case AfplibPackage . GSFLW__MFR : setMFR ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class Neighbour { /** * Gets the UUID for this Neighbour
* @ return SIBUuid */
public final SIBUuid8 getUUID ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getUUID" ) ; SibTr . exit ( tc , "getUUID" , iMEUuid ) ; } return iMEUuid ; |
public class RulePrunerPrinter { /** * Main runnable .
* @ param args parameters used .
* @ throws Exception if error occurs . */
public static void main ( String [ ] args ) throws Exception { } } | try { RulePrunerParameters params = new RulePrunerParameters ( ) ; JCommander jct = new JCommander ( params , args ) ; if ( 0 == args . length ) { jct . usage ( ) ; } else { // get params printed
StringBuffer sb = new StringBuffer ( 1024 ) ; sb . append ( "Rule pruner CLI v.1" ) . append ( CR ) ; sb . append ( "paramet... |
public class MarketplaceComment { /** * Sets the creationTime value for this MarketplaceComment .
* @ param creationTime * The creation { @ link DateTime } of this { @ code MarketplaceComment } . */
public void setCreationTime ( com . google . api . ads . admanager . axis . v201805 . DateTime creationTime ) { } } | this . creationTime = creationTime ; |
public class MultiEnvAware { /** * By default we don ' t try to resolve anything , but others can extend this behavior if they ' d like to try to resolve
* not found values differently .
* @ param sKey
* @ param value
* @ return */
protected T resolve ( String sKey , T value ) { } } | LOG . error ( "Fail to find environment [{}] in {}" , sKey , this . keySet ( ) ) ; throw new MultiEnvSupportException ( String . format ( "Fail to find configuration for environment %s" , sKey ) ) ; |
public class RESTArtifactLoaderService { /** * Create response for browsing Maven repository .
* @ param node
* the root node for browsing .
* @ param mavenPath
* the Maven path , used for creating & lt ; a & gt ; element .
* @ return @ see { @ link Response } .
* @ throws IOException
* if i / o error occ... | final PipedOutputStream po = new PipedOutputStream ( ) ; final PipedInputStream pi = new PipedInputStream ( po ) ; new Thread ( ) { @ Override @ SuppressWarnings ( "unchecked" ) public void run ( ) { try { XMLOutputFactory factory = XMLOutputFactory . newInstance ( ) ; // name spaces
factory . setProperty ( XMLOutputFa... |
public class CacheMetricsRegistrarConfiguration { /** * Get the name of a { @ link CacheManager } based on its { @ code beanName } .
* @ param beanName the name of the { @ link CacheManager } bean
* @ return a name for the given cache manager */
private String getCacheManagerName ( String beanName ) { } } | if ( beanName . length ( ) > CACHE_MANAGER_SUFFIX . length ( ) && StringUtils . endsWithIgnoreCase ( beanName , CACHE_MANAGER_SUFFIX ) ) { return beanName . substring ( 0 , beanName . length ( ) - CACHE_MANAGER_SUFFIX . length ( ) ) ; } return beanName ; |
public class CommercePriceListAccountRelLocalServiceBaseImpl { /** * Returns a range of commerce price list account rels matching the UUID and company .
* @ param uuid the UUID of the commerce price list account rels
* @ param companyId the primary key of the company
* @ param start the lower bound of the range o... | return commercePriceListAccountRelPersistence . findByUuid_C ( uuid , companyId , start , end , orderByComparator ) ; |
public class NodeUtils { /** * Determines if leaf represents a possible range of values ( bounded or unbounded ) */
public static boolean isRangeLeaf ( Leaf leaf ) { } } | return leaf instanceof RangeLeaf || leaf instanceof GreaterThanEqualsLeaf || leaf instanceof GreaterThanLeaf || leaf instanceof LessThanLeaf || leaf instanceof LessThanEqualsLeaf ; |
public class U { /** * Documented , # once */
public static < T > Supplier < T > once ( final Supplier < T > function ) { } } | return new Supplier < T > ( ) { private volatile boolean executed ; private T result ; @ Override public T get ( ) { if ( ! executed ) { executed = true ; result = function . get ( ) ; } return result ; } } ; |
public class CompiledTranslator { /** * httl . properties : engine . name = httl . properties */
public void setEngineName ( String name ) { } } | if ( HTTL_DEFAULT . equals ( name ) ) { name = "" ; } else { if ( name . startsWith ( HTTL_PREFIX ) ) { name = name . substring ( HTTL_PREFIX . length ( ) ) ; } if ( name . endsWith ( PROPERTIES_SUFFIX ) ) { name = name . substring ( 0 , name . length ( ) - PROPERTIES_SUFFIX . length ( ) ) ; } } this . engineName = nam... |
public class CalcPoint { /** * Center a cloud of points . This means subtracting the { @ lin
* # centroid ( Point3d [ ] ) } of the cloud to each point .
* @ param x
* array of points . Point objects will be modified */
public static void center ( Point3d [ ] x ) { } } | Point3d center = centroid ( x ) ; center . negate ( ) ; translate ( new Vector3d ( center ) , x ) ; |
public class Database { public String [ ] get_class_attribute_list ( String classname , String wildcard ) throws DevFailed { } } | return databaseDAO . get_class_attribute_list ( this , classname , wildcard ) ; |
public class ChildWorkflowExecutionTimedOutEventAttributesMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes , ProtocolMarshaller protocolMarshaller ) { } } | if ( childWorkflowExecutionTimedOutEventAttributes == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( childWorkflowExecutionTimedOutEventAttributes . getWorkflowExecution ( ) , WORKFLOWEXECUTION_BINDING ) ; protocolMarshaller . marshall ( ch... |
public class Http100ContWriteCallback { /** * @ see
* com . ibm . wsspi . tcpchannel . TCPWriteCompletedCallback # complete ( com . ibm . wsspi
* . channelfw . VirtualConnection ,
* com . ibm . wsspi . tcpchannel . TCPWriteRequestContext ) */
@ SuppressWarnings ( "unused" ) public void complete ( VirtualConnectio... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "complete() called for vc=" + vc ) ; } HttpInboundLink link = ( HttpInboundLink ) vc . getStateMap ( ) . get ( CallbackIDs . CALLBACK_HTTPICL ) ; // we ' ve written the 100 continue response , now we can call up to the
// app... |
public class Utils { /** * Get the identifier for the resource with a given type and key . */
private static int getIdentifier ( Context context , String type , String key ) { } } | return context . getResources ( ) . getIdentifier ( key , type , context . getPackageName ( ) ) ; |
public class Popups { /** * Displays an info message below the specified widget . */
public static InfoPopup infoBelow ( String message , Widget target ) { } } | return info ( message , Position . BELOW , target ) ; |
public class MenuUtil { /** * Adds a new menu item to the menu with the specified name and
* attributes .
* @ param l the action listener .
* @ param menu the menu to add the item to .
* @ param name the item name .
* @ param mnem the mnemonic key for the item or null if none .
* @ param accel the keystroke... | JMenuItem item = createItem ( name , mnem , accel ) ; item . addActionListener ( l ) ; menu . add ( item ) ; return item ; |
public class AbstractHistogram { /** * Shift recorded values to the left ( the equivalent of a & lt ; & lt ; shift operation on all recorded values ) . The
* configured integer value range limits and value precision setting will remain unchanged .
* An { @ link ArrayIndexOutOfBoundsException } will be thrown if any... | if ( numberOfBinaryOrdersOfMagnitude < 0 ) { throw new IllegalArgumentException ( "Cannot shift by a negative number of magnitudes" ) ; } if ( numberOfBinaryOrdersOfMagnitude == 0 ) { return ; } if ( getTotalCount ( ) == getCountAtIndex ( 0 ) ) { // ( no need to shift any values if all recorded values are at the 0 valu... |
public class SRTServletRequestThreadData { /** * Save the state of the parameters before a call to include or forward . */
public void pushParameterStack ( Map parameters ) { } } | if ( parameters == null ) { _paramStack . push ( null ) ; } else { _paramStack . push ( ( ( Hashtable ) parameters ) . clone ( ) ) ; } |
public class ScriptActionsInner { /** * Gets the script execution detail for the given script execution ID .
* @ param resourceGroupName The name of the resource group .
* @ param clusterName The name of the cluster .
* @ param scriptExecutionId The script execution Id
* @ throws IllegalArgumentException thrown... | return getExecutionDetailWithServiceResponseAsync ( resourceGroupName , clusterName , scriptExecutionId ) . map ( new Func1 < ServiceResponse < RuntimeScriptActionDetailInner > , RuntimeScriptActionDetailInner > ( ) { @ Override public RuntimeScriptActionDetailInner call ( ServiceResponse < RuntimeScriptActionDetailInn... |
public class ShanksAgentBayesianReasoningCapability { /** * Add soft - evidence to the Bayesian network to reason with it .
* @ param bn
* @ param nodeName
* @ param softEvidence
* @ throws ShanksException */
public static void addSoftEvidence ( Network bn , String nodeName , HashMap < String , Double > softEvi... | String auxNodeName = softEvidenceNodePrefix + nodeName ; int targetNode = bn . getNode ( nodeName ) ; boolean found = false ; int [ ] children = bn . getChildren ( targetNode ) ; for ( int child : children ) { if ( bn . getNodeName ( child ) . equals ( auxNodeName ) ) { if ( bn . getOutcomeCount ( child ) == 2 && bn . ... |
public class DatastoreSnippets { /** * [ TARGET allocateId ( IncompleteKey ) ] */
public Key allocateIdSingle ( ) { } } | // [ START allocateIdSingle ]
KeyFactory keyFactory = datastore . newKeyFactory ( ) . setKind ( "MyKind" ) ; IncompleteKey incompleteKey = keyFactory . newKey ( ) ; // let cloud datastore automatically assign an id
Key key = datastore . allocateId ( incompleteKey ) ; // [ END allocateIdSingle ]
return key ; |
public class BigQueryOutputConfiguration { /** * Gets a configured instance of the stored { @ link FileOutputFormat } in the configuration .
* @ param conf the configuration to reference the keys from .
* @ return a configured instance of the stored { @ link FileOutputFormat } in the configuration .
* @ throws IO... | // Ensure the BigQuery output information is valid .
ConfigurationUtil . getMandatoryConfig ( conf , BigQueryConfiguration . OUTPUT_FORMAT_CLASS_KEY ) ; Class < ? > confClass = conf . getClass ( BigQueryConfiguration . OUTPUT_FORMAT_CLASS_KEY , null ) ; // Fail if the default value was used , or the class isn ' t a Fil... |
public class MtasDataItemAdvanced { /** * ( non - Javadoc )
* @ see mtas . codec . util . collector . MtasDataItem # getCompareValueType ( ) */
@ Override public int getCompareValueType ( ) throws IOException { } } | switch ( sortType ) { case CodecUtil . STATS_TYPE_N : return 0 ; case CodecUtil . STATS_TYPE_SUM : return 1 ; case CodecUtil . STATS_TYPE_MAX : return 1 ; case CodecUtil . STATS_TYPE_MIN : return 1 ; case CodecUtil . STATS_TYPE_SUMSQ : return 1 ; case CodecUtil . STATS_TYPE_SUMOFLOGS : return 2 ; case CodecUtil . STATS... |
public class ListItemBox { /** * Draws a bullet or text marker */
protected void drawBullet ( Graphics2D g ) { } } | ctx . updateGraphics ( g ) ; int x = ( int ) Math . round ( getAbsoluteContentX ( ) - 1.2 * ctx . getEm ( ) ) ; int y = ( int ) Math . round ( getAbsoluteContentY ( ) + 0.5 * ctx . getEm ( ) ) ; int r = ( int ) Math . round ( 0.4 * ctx . getEm ( ) ) ; if ( styleType == CSSProperty . ListStyleType . CIRCLE ) g . drawOva... |
public class StringEntityRepository { /** * This method allows to replace all string children , it will remove any children which are not in the list , add the
* new ones and update which are in the list .
* @ param strings string children list to replace . */
public void replaceStringChildren ( List < String > str... | ArrayList < StringEntity > entities = new ArrayList < > ( ) ; for ( String string : strings ) { StringEntity entity = new StringEntity ( ) ; entity . setValue ( string ) ; entities . add ( entity ) ; } replaceAll ( entities ) ; |
public class CmsPreviewDialog { /** * Initializes the locale selector if needed . < p >
* @ param previewInfo the preview info */
private void initLocales ( CmsPreviewInfo previewInfo ) { } } | if ( m_localeSelect != null ) { removeButton ( m_localeSelect ) ; m_localeSelect = null ; } if ( previewInfo . hasAdditionalLocales ( ) ) { m_localeSelect = new CmsSelectBox ( previewInfo . getLocales ( ) ) ; m_localeSelect . setFormValueAsString ( previewInfo . getLocale ( ) ) ; m_localeSelect . addValueChangeHandler ... |
public class Headers { /** * Get charset set in content type header .
* @ return the charset , or defaultCharset if no charset is set . */
public Charset getCharset ( Charset defaultCharset ) { } } | String contentType = getHeader ( HttpHeaders . NAME_CONTENT_TYPE ) ; if ( contentType == null ) { return defaultCharset ; } String [ ] items = contentType . split ( ";" ) ; for ( String item : items ) { item = item . trim ( ) ; if ( item . isEmpty ( ) ) { continue ; } int idx = item . indexOf ( '=' ) ; if ( idx < 0 ) {... |
public class Query { /** * < code >
* Add a value refinement . Takes a refinement name , a value , and whether or not to exclude this refinement .
* < / code >
* @ param navigationName
* The name of the navigation
* @ param value
* The refinement value
* @ param exclude
* True if the results should excl... | return addRefinement ( navigationName , new RefinementValue ( ) . setValue ( value ) . setExclude ( exclude ) ) ; |
public class TemplateAstMatcher { /** * Creates a template parameter or string literal template node . */
private Node createTemplateParameterNode ( int index , JSType type , boolean isStringLiteral ) { } } | checkState ( index >= 0 ) ; checkNotNull ( type ) ; Node n = Node . newNumber ( index ) ; if ( isStringLiteral ) { n . setToken ( TEMPLATE_STRING_LITERAL ) ; } else { n . setToken ( TEMPLATE_TYPE_PARAM ) ; } n . setJSType ( type ) ; return n ; |
public class SchemaStoreItemStream { /** * Remove an item from our index */
void removeFromIndex ( SchemaStoreItem item ) { } } | schemaIndex . remove ( item . getSchema ( ) . getLongID ( ) ) ; item . setStream ( null ) ; |
public class JBBPSafeInstantiator { /** * Find a constructor for an inner class .
* @ param klazz a class to find a constructor , must not be null
* @ param declaringClass the declaring class for the class , must not be null
* @ return found constructor to be used to make an instance */
private static Constructor... | final Constructor < ? > [ ] constructors = klazz . getDeclaredConstructors ( ) ; if ( constructors . length == 1 ) { return constructors [ 0 ] ; } for ( final Constructor < ? > c : constructors ) { final Class < ? > [ ] params = c . getParameterTypes ( ) ; if ( params . length == 1 && params [ 0 ] == declaringClass ) {... |
public class ElasticSearchRestDAOV5 { /** * Initializes the index with the required templates and mappings . */
private void initIndex ( ) throws Exception { } } | // 0 . Add the tasklog template
if ( doesResourceNotExist ( "/_template/tasklog_template" ) ) { logger . info ( "Creating the index template 'tasklog_template'" ) ; InputStream stream = ElasticSearchDAOV5 . class . getResourceAsStream ( "/template_tasklog.json" ) ; byte [ ] templateSource = IOUtils . toByteArray ( stre... |
public class Pac4jPrincipal { /** * Returns a name for the principal based upon one of the attributes
* of the main CommonProfile . The attribute name used to query the CommonProfile
* is specified in the constructor .
* @ return a name for the Principal or null if the attribute is not populated . */
@ Override p... | CommonProfile profile = this . getProfile ( ) ; if ( null == principalNameAttribute ) { return profile . getId ( ) ; } Object attrValue = profile . getAttribute ( principalNameAttribute ) ; return ( null == attrValue ) ? null : String . valueOf ( attrValue ) ; |
public class TopologyInfo { /** * Split totalOwnedSegments segments into the given locations recursively .
* @ param locations List of locations of the same level , sorted descending by capacity factor */
private void splitExpectedOwnedSegments ( Collection < ? extends Location > locations , float totalOwnedSegments ... | float remainingCapacity = totalCapacity ; float remainingOwned = totalOwnedSegments ; // First pass , assign expected owned segments for locations with too little capacity
// We know we can do it without a loop because locations are ordered descending by capacity
List < Location > remainingLocations = new ArrayList < >... |
public class AbcGrammar { /** * abc - tune : : = abc - header abc - music eol */
public Rule AbcTune ( ) { } } | return Sequence ( AbcHeader ( ) , AbcMusic ( ) , FirstOf ( WhiteLines ( ) , Eols ( ) , EOI ) . suppressNode ( ) ) . label ( AbcTune ) ; |
public class MoreQueues { /** * 支持后进先出的栈 , 用ArrayDeque实现 , 经过Collections # asLifoQueue ( ) 转换顺序
* 需设置初始长度 , 默认为16 , 数组满时成倍扩容
* @ see Collections # asLifoQueue ( ) */
public static < E > Queue < E > createStack ( int initSize ) { } } | return Collections . asLifoQueue ( new ArrayDeque < E > ( initSize ) ) ; |
public class SocketChannelStream { /** * Initialize the SocketStream with a new Socket .
* @ param s the new socket . */
public void init ( SocketChannel s ) { } } | _s = s ; try { s . setOption ( StandardSocketOptions . TCP_NODELAY , true ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; ; } // _ is = null ;
// _ os = null ;
_needsFlush = false ; _readBuffer . clear ( ) . flip ( ) ; _writeBuffer . clear ( ) ; |
public class DocumentRevisionTree { /** * < p > Returns the child with a given revision ID of a parent
* { @ link InternalDocumentRevision } . < / p >
* @ param parentNode parent { @ code DocumentRevision }
* @ param childRevision revision to look for in child nodes
* @ return the child with a given revision ID... | Misc . checkNotNull ( parentNode , "Parent node" ) ; Misc . checkArgument ( sequenceMap . containsKey ( parentNode . getSequence ( ) ) , "The given parent DocumentRevision must be in the tree." ) ; DocumentRevisionNode p = sequenceMap . get ( parentNode . getSequence ( ) ) ; Iterator i = p . iterateChildren ( ) ; while... |
public class AbstractClientProvider { /** * Initialize the service discovery client , we will reuse that
* every time we need to create a new client . */
private void initDiscovery ( ) { } } | if ( discoveryServiceClient == null ) { LOG . info ( "No DiscoveryServiceClient provided. Skipping service discovery." ) ; return ; } endpointStrategy = new TimeLimitEndpointStrategy ( new RandomEndpointStrategy ( discoveryServiceClient . discover ( configuration . get ( TxConstants . Service . CFG_DATA_TX_DISCOVERY_SE... |
public class DefaultPassConfig { /** * Create a compiler pass that runs the given passes in serial . */
private static CompilerPass runInSerial ( final Collection < CompilerPass > passes ) { } } | return new CompilerPass ( ) { @ Override public void process ( Node externs , Node root ) { for ( CompilerPass pass : passes ) { pass . process ( externs , root ) ; } } } ; |
public class AmazonS3Client { /** * Copies a source object to a part of a multipart upload .
* To copy an object , the caller ' s account must have read access to the source object and
* write access to the destination bucket .
* If constraints are specified in the < code > CopyPartRequest < / code >
* ( e . g ... | copyPartRequest = beforeClientExecution ( copyPartRequest ) ; rejectNull ( copyPartRequest . getSourceBucketName ( ) , "The source bucket name must be specified when copying a part" ) ; rejectNull ( copyPartRequest . getSourceKey ( ) , "The source object key must be specified when copying a part" ) ; rejectNull ( copyP... |
public class GenerateConfigMojo { /** * Creates scanner directives from artifact to be parsed by pax runner .
* Also includes options found and matched in settings part of configuration .
* @ param artifact to be used to create scanner directive .
* @ param optionTokens to be used to create scanner directive .
... | return "scan-bundle:" + artifact . getFile ( ) . toURI ( ) . normalize ( ) . toString ( ) + "@update" + optionTokens ; |
public class ManifestElementReader { /** * This method binds a ChunksManifest xml document to a ChunksManifest
* object
* @ param doc ChunksManifest xml document
* @ return ChunksManifest object */
public static ChunksManifest createManifestFrom ( ChunksManifestDocument doc ) { } } | ChunksManifestType manifestType = doc . getChunksManifest ( ) ; HeaderType headerType = manifestType . getHeader ( ) ; ChunksManifest . ManifestHeader header = createHeaderFromElement ( headerType ) ; ChunksType chunksType = manifestType . getChunks ( ) ; List < ChunksManifestBean . ManifestEntry > entries = createEntr... |
public class CurrencyDateCalculatorBuilder { /** * If brokenDate is not allowed , we do require to check the WorkingWeek and Holiday for the crossCcy when
* validating the SpotDate or a Tenor date .
* @ param crossCcyCalendar the set of holidays for the crossCcy
* @ return the builder */
public CurrencyDateCalcul... | if ( crossCcyCalendar != null ) { this . crossCcyCalendar = crossCcyCalendar ; } return this ; |
public class SqlParserImpl { /** * IF文解析 */
protected void parseIf ( ) { } } | String condition = tokenizer . getToken ( ) . substring ( 2 ) ; if ( StringUtils . isBlank ( condition ) ) { throw new IfConditionNotFoundRuntimeException ( ) ; } IfNode ifNode = new IfNode ( Math . max ( this . position - 2 , 0 ) , condition ) ; this . position = this . tokenizer . getPosition ( ) ; peek ( ) . addChil... |
public class CustomField { /** * Gets the dataType value for this CustomField .
* @ return dataType * The type of data this custom field contains . This attribute
* is read - only
* if there exists a { @ link CustomFieldValue } for this
* field . */
public com . google . api . ads . admanager . axis . v201902 .... | return dataType ; |
public class AssessmentRun { /** * A list of notifications for the event subscriptions . A notification about a particular generated finding is added
* to this list only once .
* @ param notifications
* A list of notifications for the event subscriptions . A notification about a particular generated finding
* i... | if ( notifications == null ) { this . notifications = null ; return ; } this . notifications = new java . util . ArrayList < AssessmentRunNotification > ( notifications ) ; |
public class DelayedGitServiceInitializer { /** * Sets the common reference an releases any threads waiting for the reference to be set .
* @ param git */
public void setGitService ( GitService git ) { } } | if ( git != null ) { logger . debug ( "Setting git service" ) ; this . git = git ; latch . countDown ( ) ; } |
public class NotEmptyIfOtherIsNotEmptyValidator { /** * { @ inheritDoc } initialize the validator .
* @ see javax . validation . ConstraintValidator # initialize ( java . lang . annotation . Annotation ) */
@ Override public final void initialize ( final NotEmptyIfOtherIsNotEmpty pconstraintAnnotation ) { } } | message = pconstraintAnnotation . message ( ) ; fieldCheckName = pconstraintAnnotation . field ( ) ; fieldCompareName = pconstraintAnnotation . fieldCompare ( ) ; |
public class MultiScopeRecoveryLog { /** * Instructs the recovery log to perfom a keypoint operation . Any redundant
* information will be removed and all cached information will be forced to disk .
* @ exception LogClosedException Thrown if the log is closed .
* @ exception InternalLogException Thrown if an unex... | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "keypoint" , this ) ; // If this recovery log instance has been marked as incompatible then throw an exception
// accordingly .
if ( incompatible ( ) ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "keypoint" , "LogIncompatibleException" ) ; throw new LogIncompatible... |
public class Payout { /** * Retrieves the details of an existing payout . Supply the unique payout ID from either a payout
* creation request or the payout list , and Stripe will return the corresponding payout
* information . */
public static Payout retrieve ( String payout ) throws StripeException { } } | return retrieve ( payout , ( Map < String , Object > ) null , ( RequestOptions ) null ) ; |
public class GroupByDOMOperator { /** * Takes the leaf areas and tries to join the homogeneous paragraphs . */
private void groupByDOM ( AreaImpl root ) { } } | if ( root . getChildCount ( ) > 1 ) findSuperAreas ( root , 1 ) ; for ( int i = 0 ; i < root . getChildCount ( ) ; i ++ ) groupByDOM ( ( AreaImpl ) root . getChildAt ( i ) ) ; |
public class JsonRpcMultiServer { /** * Get the handler ( object ) that should be invoked to execute the specified
* RPC method based on the specified service name .
* @ param serviceName the service name
* @ return the handler to invoke the RPC call against */
@ Override protected Object getHandler ( String serv... | Object handler = handlerMap . get ( serviceName ) ; if ( handler == null ) { logger . error ( "Service '{}' is not registered in this multi-server" , serviceName ) ; throw new RuntimeException ( "Service '" + serviceName + "' does not exist" ) ; } return handler ; |
public class Profile { /** * Returns the config for { @ code type } , or null if it is not configured . */
private @ Nullable TypeConfigElement typeConfig ( ProtoType type ) { } } | for ( ProfileFileElement element : profileFiles ) { for ( TypeConfigElement typeConfig : element . getTypeConfigs ( ) ) { if ( typeConfig . getType ( ) . equals ( type . toString ( ) ) ) return typeConfig ; } } return null ; |
public class MediaType { /** * Returns { @ code true } if this { @ link MediaType } belongs to the given { @ link MediaType } .
* Similar to what { @ link MediaType # is ( MediaType ) } does except that this one compares the parameters
* case - insensitively and excludes ' q ' parameter . */
public boolean belongsT... | return ( mediaTypeRange . type . equals ( WILDCARD ) || mediaTypeRange . type . equals ( type ) ) && ( mediaTypeRange . subtype . equals ( WILDCARD ) || mediaTypeRange . subtype . equals ( subtype ) ) && containsAllParameters ( mediaTypeRange . parameters ( ) , parameters ( ) ) ; |
public class FundamentalLinear8 { /** * Computes a fundamental or essential matrix from a set of associated point correspondences .
* @ param points List of corresponding image coordinates . In pixel for fundamental matrix or
* normalized coordinates for essential matrix .
* @ return true If successful or false i... | if ( points . size ( ) < 8 ) throw new IllegalArgumentException ( "Must be at least 8 points. Was only " + points . size ( ) ) ; // use normalized coordinates for pixel and calibrated
// TODO re - evaluate decision to normalize for calibrated case
LowLevelMultiViewOps . computeNormalization ( points , N1 , N2 ) ; creat... |
public class Option { /** * If a value is present , apply the provided { @ code Option } - bearing
* mapping function to it , return that result , otherwise return
* { @ link # NONE } . This method is similar to { @ link # map ( Function ) } ,
* but the provided mapper is one whose result is already an
* { @ co... | E . NPE ( mapper ) ; Option < B > result = isDefined ( ) ? mapper . apply ( get ( ) ) : NONE ; E . NPE ( null == result ) ; return result ; |
public class UnicodeSet { /** * Returns the number of elements in this set ( its cardinality )
* Note than the elements of a set may include both individual
* codepoints and strings .
* @ return the number of elements in this set ( its cardinality ) . */
public int size ( ) { } } | int n = 0 ; int count = getRangeCount ( ) ; for ( int i = 0 ; i < count ; ++ i ) { n += getRangeEnd ( i ) - getRangeStart ( i ) + 1 ; } return n + strings . size ( ) ; |
public class DWOF { /** * This method prepares a container for the radii of the objects and
* initializes radii according to the equation :
* initialRadii of a certain object = ( absoluteMinDist of all objects ) *
* ( avgDist of the object ) / ( minAvgDist of all objects )
* @ param ids Database IDs to process ... | FiniteProgress avgDistProgress = LOG . isVerbose ( ) ? new FiniteProgress ( "Calculating average kNN distances-" , ids . size ( ) , LOG ) : null ; double absoluteMinDist = Double . POSITIVE_INFINITY ; double minAvgDist = Double . POSITIVE_INFINITY ; // to get the mean for each object
Mean mean = new Mean ( ) ; // Itera... |
public class DatabaseError { /** * { @ inheritDoc } */
@ Override public String getUserFacingMessage ( ) { } } | final StringBuilder bldr = new StringBuilder ( ) ; bldr . append ( getMessage ( ) ) ; bldr . append ( " for " ) ; bldr . append ( getName ( ) ) ; bldr . append ( "\n\treason: " ) ; final SQLException cause = ( SQLException ) getCause ( ) ; final int code = cause . getErrorCode ( ) ; final String msg = cause . getMessag... |
public class DomainService { /** * Gets a Connector by id .
* @ param evse evse which should contain the connector .
* @ param id connector id .
* @ param exceptionIfNotFound throw EntityNotFoundException if connector cannot be found .
* @ return connector or null if it cannot be found and exceptionIfNotFound i... | for ( Connector connector : evse . getConnectors ( ) ) { if ( id . equals ( connector . getId ( ) ) ) { return connector ; } } if ( exceptionIfNotFound ) { throw new EntityNotFoundException ( String . format ( "Unable to find connector with id '%s'" , id ) ) ; } else { return null ; } |
public class SDBaseOps { /** * Get a subset of the specified input , by specifying the first element , last element , and the strides . < br >
* For example , if input is : < br >
* [ a , b , c ] < br >
* [ d , e , f ] < br >
* [ g , h , i ] < br >
* then stridedSlice ( input , begin = [ 0,1 ] , end = [ 2,2 ]... | return stridedSlice ( name , input , begin , end , strides , 0 , 0 , 0 , 0 , 0 ) ; |
public class OverviewMap { /** * Set a new style for the rectangle that shows the current position on the target map .
* @ param rectangleStyle
* rectangle style
* @ since 1.8.0 */
@ Api public void setRectangleStyle ( ShapeStyle rectangleStyle ) { } } | this . rectangleStyle = rectangleStyle ; if ( targetRectangle != null ) { targetRectangle . setStyle ( rectangleStyle ) ; render ( targetRectangle , RenderGroup . SCREEN , RenderStatus . ALL ) ; } |
public class ValueBinder { /** * Binds to { @ code Value . timestampArray ( values ) } */
public R toTimestampArray ( @ Nullable Iterable < Timestamp > values ) { } } | return handle ( Value . timestampArray ( values ) ) ; |
public class ModelUtils { /** * Resolves a setter method for a field .
* @ param field The field
* @ return An optional setter method */
Optional < ExecutableElement > findSetterMethodFor ( Element field ) { } } | String name = field . getSimpleName ( ) . toString ( ) ; if ( field . asType ( ) . getKind ( ) == TypeKind . BOOLEAN ) { if ( name . length ( ) > 2 && Character . isUpperCase ( name . charAt ( 2 ) ) ) { name = name . replaceFirst ( "^(is)(.+)" , "$2" ) ; } } String setterName = setterNameFor ( name ) ; // FIXME refine ... |
public class UniqueId { /** * Appends the given UID to the given string buffer , followed by " \ \ E " .
* @ param buf The buffer to append
* @ param id The UID to add as a binary regex pattern
* @ since 2.1 */
public static void addIdToRegexp ( final StringBuilder buf , final byte [ ] id ) { } } | boolean backslash = false ; for ( final byte b : id ) { buf . append ( ( char ) ( b & 0xFF ) ) ; if ( b == 'E' && backslash ) { // If we saw a ` \ ' and now we have a ` E ' .
// So we just terminated the quoted section because we just added \ E
// to ` buf ' . So let ' s put a literal \ E now and start quoting again .
... |
public class PartialResponseWriter { /** * < p class = " changed _ added _ 2_0 " > Write the start of an eval operation . < / p >
* @ throws IOException if an input / output error occurs
* @ since 2.0 */
public void startEval ( ) throws IOException { } } | startChangesIfNecessary ( ) ; ResponseWriter writer = getWrapped ( ) ; writer . startElement ( "eval" , null ) ; writer . startCDATA ( ) ; |
public class MetricUtils { /** * Concatenate { @ code size } many values from the passed in arrays , starting at offset { @ code start } .
* @ param arrays arrays to concatenate
* @ param start starting offset position
* @ param size number of elements
* @ return concatenated array */
public static long [ ] con... | long [ ] result = new long [ size ] ; // How many values we still need to move over
int howManyLeft = size ; // Where in the resulting array we ' re currently bulk - writing
int targetPosition = 0 ; // Where we ' re copying * from * , in ( one of ) the source array .
// Typically 0 , except maybe for the first array in... |
public class CommercePriceListAccountRelUtil { /** * Removes the commerce price list account rel with the primary key from the database . Also notifies the appropriate model listeners .
* @ param commercePriceListAccountRelId the primary key of the commerce price list account rel
* @ return the commerce price list ... | return getPersistence ( ) . remove ( commercePriceListAccountRelId ) ; |
public class DatePickerDialog { /** * Set the range of selectable dates .
* @ param minDay The day value of minimum date .
* @ param minMonth The month value of minimum date .
* @ param minYear The year value of minimum date .
* @ param maxDay The day value of maximum date .
* @ param maxMonth The month value... | mDatePickerLayout . setDateRange ( minDay , minMonth , minYear , maxDay , maxMonth , maxYear ) ; return this ; |
public class CompressedRamStorage { /** * Store object into storage , if it doesn ' t exist
* @ param key
* @ param object
* @ return Returns TRUE if store operation was applied , FALSE otherwise */
@ Override public boolean storeIfAbsent ( T key , INDArray object ) { } } | try { if ( emulateIsAbsent ) lock . writeLock ( ) . lock ( ) ; if ( compressedEntries . containsKey ( key ) ) { return false ; } else { store ( key , object ) ; return true ; } } finally { if ( emulateIsAbsent ) lock . writeLock ( ) . unlock ( ) ; } |
public class User { /** * api keys */
public List < ApiKey > apiKeys ( ) throws EasyPostException { } } | ApiKeys parentKeys = ApiKeys . all ( ) ; if ( this . getId ( ) == parentKeys . getId ( ) ) { return parentKeys . getKeys ( ) ; } for ( int i = 0 ; i < parentKeys . children . size ( ) ; i ++ ) { if ( this . getId ( ) . equals ( parentKeys . children . get ( i ) . getId ( ) ) ) { return parentKeys . children . get ( i )... |
public class MsBuildParser { /** * Returns whether the warning type is of the specified type .
* @ param matcher
* the matcher
* @ param type
* the type to match with
* @ return < code > true < / code > if the warning type is of the specified type */
private boolean isOfType ( final Matcher matcher , final St... | return StringUtils . containsIgnoreCase ( matcher . group ( 4 ) , type ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.