signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ExtensionHookView { /** * Adds the given { @ link AbstractPanel } to the view hook , to be later added to the
* { @ link org . parosproxy . paros . view . WorkbenchPanel WorkbenchPanel } as a
* { @ link org . parosproxy . paros . view . WorkbenchPanel . PanelType # STATUS status } panel .
* @ param p... | if ( statusPanelList == null ) { statusPanelList = createList ( ) ; } statusPanelList . add ( panel ) ; |
public class PrcEntitySave { /** * < p > Process entity request . < / p >
* @ param pAddParam additional param , e . g . return this line ' s
* document in " nextEntity " for farther process
* @ param pRequestData Request Data
* @ param pEntity Entity to process
* @ return Entity processed for farther process... | if ( pEntity . getIsNew ( ) ) { this . srvOrm . insertEntity ( pAddParam , pEntity ) ; pEntity . setIsNew ( false ) ; } else { this . srvOrm . updateEntity ( pAddParam , pEntity ) ; } return pEntity ; |
public class TagsInner { /** * Creates a tag value . The name of the tag must already exist .
* @ param tagName The name of the tag .
* @ param tagValue The value of the tag to create .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the TagValueInner ob... | return createOrUpdateValueWithServiceResponseAsync ( tagName , tagValue ) . map ( new Func1 < ServiceResponse < TagValueInner > , TagValueInner > ( ) { @ Override public TagValueInner call ( ServiceResponse < TagValueInner > response ) { return response . body ( ) ; } } ) ; |
public class JdbcDatabase { /** * Commit the transactions since the last commit .
* Override this for SQL implementations .
* @ exception DBException An exception . */
public void commit ( ) throws DBException { } } | super . commit ( ) ; // Will throw an error if something is not set up right .
try { if ( m_JDBCConnection != null ) m_JDBCConnection . commit ( ) ; } catch ( SQLException ex ) { throw this . convertError ( ex ) ; } |
public class AbstractSorter { /** * Swaps elements at 2 different positions ( indexes ) in the List of elements .
* @ param < E > the Class type of the elements in the List .
* @ param elements the List of elements to perform an element swap on .
* @ param index1 the index of the first element to swap .
* @ par... | E elementFromIndex1 = elements . get ( index1 ) ; elements . set ( index1 , elements . get ( index2 ) ) ; elements . set ( index2 , elementFromIndex1 ) ; |
public class Unmarshaller { /** * Unmarshals the given native Entity into an object of given type , entityClass .
* @ param < T >
* target object type
* @ param nativeEntity
* the native Entity
* @ param entityClass
* the target type
* @ return Object that is equivalent to the given native entity . If the... | return unmarshalBaseEntity ( nativeEntity , entityClass ) ; |
public class HistoryHandler { /** * Move the date field ( or the current time ) to the target date field . */
public void moveDateToTarget ( ) { } } | DateTimeField fldHistoryDateTarget = ( DateTimeField ) this . getHistoryRecord ( ) . getField ( m_iHistoryDateSeq ) ; if ( ( this . getHistorySourceDate ( ) != null ) && ( ! this . getHistorySourceDate ( ) . isNull ( ) ) ) fldHistoryDateTarget . moveFieldToThis ( this . getHistorySourceDate ( ) ) ; else fldHistoryDateT... |
public class MisoUtil { /** * Convert the given fine coordinates to pixel coordinates within
* the containing tile . Converted coordinates are placed in the
* given point object .
* @ param x the x - position fine coordinate .
* @ param y the y - position fine coordinate .
* @ param ppos the point object to p... | ppos . x = metrics . tilehwid + ( ( x - y ) * metrics . finehwid ) ; ppos . y = ( x + y ) * metrics . finehhei ; |
public class DataSegmentFactory { /** * Creates a data segment of the given format and with the given chunk size ( in bytes ) .
* @ param format A format from the < code > DataSegmentFormat < / code > enumeration .
* @ param maxChunkSize The size ( in bytes ) of one chunk , which represents the < code > MaxRecvData... | final IDataSegment dataSegment ; switch ( format ) { case TEXT : dataSegment = new TextParameterDataSegment ( maxChunkSize ) ; break ; case BINARY : dataSegment = new BinaryDataSegment ( maxChunkSize ) ; break ; case NONE : dataSegment = new NullDataSegment ( maxChunkSize ) ; break ; default : throw new IllegalArgument... |
public class AdSenseSettings { /** * Gets the borderStyle value for this AdSenseSettings .
* @ return borderStyle * Specifies the border - style of the { @ link AdUnit } . This attribute
* is
* optional and defaults to the ad unit ' s parent or ancestor ' s
* setting if one
* has been set . If no ancestor of ... | return borderStyle ; |
public class RoaringBitmap { /** * Return the jth value stored in this bitmap . The provided value
* needs to be smaller than the cardinality otherwise an
* IllegalArgumentException
* exception is thrown .
* @ param j index of the value
* @ return the value
* @ see < a href = " https : / / en . wikipedia . ... | long leftover = Util . toUnsignedLong ( j ) ; for ( int i = 0 ; i < this . highLowContainer . size ( ) ; i ++ ) { Container c = this . highLowContainer . getContainerAtIndex ( i ) ; int thiscard = c . getCardinality ( ) ; if ( thiscard > leftover ) { int keycontrib = this . highLowContainer . getKeyAtIndex ( i ) << 16 ... |
public class UserCoreDao { /** * Query for typed values
* @ param < T >
* result value type
* @ param sql
* sql statement
* @ param args
* arguments
* @ param limit
* result row limit
* @ return results
* @ since 3.1.0 */
public < T > List < List < T > > queryTypedResults ( String sql , String [ ] a... | return db . queryTypedResults ( sql , args , limit ) ; |
public class SheetColumnResourcesImpl { /** * Add column to a sheet .
* It mirrors to the following Smartsheet REST API method : POST / sheets / { sheetId } / columns
* Exceptions :
* IllegalArgumentException : if any argument is null
* InvalidRequestException : if there is any problem with the REST API request... | return this . postAndReceiveList ( "sheets/" + sheetId + "/columns" , columns , Column . class ) ; |
public class CPFriendlyURLEntryLocalServiceUtil { /** * Returns a range of all the cp friendly url entries .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result s... | return getService ( ) . getCPFriendlyURLEntries ( start , end ) ; |
public class XmlExporter { /** * http : / / www . javaworld . com / javatips / jw - javatip117 . html */
public String getBinaryDataForXml ( byte [ ] buffer ) { } } | StringBuffer hexData = new StringBuffer ( ) ; Base64Encoder encoder = new Base64Encoder ( ) ; return encoder . encode ( buffer ) ; |
public class BusItinerary { /** * Replies the nearest bus halt to the given point .
* @ param x x coordinate .
* @ param y y coordinate .
* @ return the nearest bus halt or < code > null < / code > if none was found . */
@ Pure public BusItineraryHalt getNearestBusHalt ( double x , double y ) { } } | double distance = Double . POSITIVE_INFINITY ; BusItineraryHalt besthalt = null ; double dist ; for ( final BusItineraryHalt halt : this . validHalts ) { dist = halt . distance ( x , y ) ; if ( dist < distance ) { distance = dist ; besthalt = halt ; } } return besthalt ; |
public class AbstractMultiDataSetNormalizer { /** * Undo ( revert ) the normalization applied by this normalizer to a specific labels array .
* If labels normalization is disabled ( i . e . , { @ link # isFitLabel ( ) } = = false ) then this is a no - op .
* Can also be used to undo normalization for network output... | if ( isFitLabel ( ) ) { strategy . revert ( labels , mask , getLabelStats ( output ) ) ; } |
public class SimpleValueCreator { /** * { @ inheritDoc } */
@ Override public void create ( String string , Value value ) throws DataFormatException { } } | String [ ] strings = splitter . split ( string ) ; for ( int i = 0 ; i < strings . length ; i ++ ) { value . addPrimitiveValue ( String . valueOf ( i ) , strings [ i ] ) ; } |
public class StorageProviderUtil { /** * Determines if the checksum for a particular piece of content
* stored in a StorageProvider matches the expected checksum value .
* @ param provider The StorageProvider where the content was stored
* @ param spaceId The Space in which the content was stored
* @ param cont... | String providerChecksum = provider . getContentProperties ( spaceId , contentId ) . get ( StorageProvider . PROPERTIES_CONTENT_CHECKSUM ) ; return compareChecksum ( providerChecksum , spaceId , contentId , checksum ) ; |
public class State { /** * { @ inheritDoc } */
@ Override public < B > State < S , B > fmap ( Function < ? super A , ? extends B > fn ) { } } | return Monad . super . < B > fmap ( fn ) . coerce ( ) ; |
public class CPDefinitionLinkLocalServiceUtil { /** * Returns a range of all the cp definition links .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . T... | return getService ( ) . getCPDefinitionLinks ( start , end ) ; |
public class Item { /** * Sets the value of the specified attribute in the current item to the
* given value . */
public Item withNumber ( String attrName , BigDecimal val ) { } } | checkInvalidAttribute ( attrName , val ) ; attributes . put ( attrName , val ) ; return this ; |
public class DestinationDefinitionImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . admin . DestinationDefinition # setAuditAllowed ( boolean
* value ) */
void setAuditAllowed ( boolean auditAllowed ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "setAuditAllowed" , Boolean . valueOf ( auditAllowed ) ) ; } _isAuditAllowed = auditAllowed ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , "setAuditAllowed" ) ; } |
public class Image { /** * Creates an Image with CCITT G3 or G4 compression . It assumes that the
* data bytes are already compressed .
* @ param width
* the exact width of the image
* @ param height
* the exact height of the image
* @ param reverseBits
* reverses the bits in < code > data < / code > . Bi... | return Image . getInstance ( width , height , reverseBits , typeCCITT , parameters , data , null ) ; |
public class Model { /** * Export a context into the given configuration
* @ param ctx the context to export .
* @ param config the { @ code Configuration } where to export the context data .
* @ throws IllegalArgumentException ( since TODO add version ) if the given context is { @ code null } .
* @ since 2.4.0... | validateContextNotNull ( ctx ) ; validateConfigNotNull ( config ) ; for ( ContextDataFactory cdf : this . contextDataFactories ) { cdf . exportContextData ( ctx , config ) ; } |
public class AbstractFileBasedContentStoreAdapter { /** * Creates and configures an XML SAX reader . */
protected SAXReader createXmlReader ( ) { } } | SAXReader xmlReader = new SAXReader ( ) ; xmlReader . setMergeAdjacentText ( true ) ; xmlReader . setStripWhitespaceText ( true ) ; xmlReader . setIgnoreComments ( true ) ; try { xmlReader . setFeature ( "http://apache.org/xml/features/disallow-doctype-decl" , true ) ; xmlReader . setFeature ( "http://xml.org/sax/featu... |
public class DBUtils { /** * 用于查询记录中大数据类型值 , 若有多条记录符合要求则返回第一条记录的大数据
* @ param sql 查询SQL语句 , 查询字段的类型必须为Blob类型
* @ param arg 传入的占位符的参数
* @ return 返回查询的大数据 , 封装在Map中 , 若没有符合条件的记录则返回空Map */
public static Map < String , byte [ ] > getBigData ( String sql , Object ... arg ) { } } | Map < String , byte [ ] > bigDataMap = new HashMap < String , byte [ ] > ( ) ; Connection connection = JDBCUtils . getConnection ( ) ; PreparedStatement ps = null ; ResultSet result = null ; // 填充占位符
try { ps = connection . prepareStatement ( sql ) ; for ( int i = 0 ; i < arg . length ; i ++ ) { ps . setObject ( i + 1 ... |
public class InvocationRegistry { /** * Deregisters an invocation . If the associated operation is inactive , takes no action and returns { @ code false } .
* This ensures the idempotency of deregistration .
* @ param invocation The Invocation to deregister .
* @ return { @ code true } if this call deregistered t... | if ( ! deactivate ( invocation . op ) ) { return false ; } invocations . remove ( invocation . op . getCallId ( ) ) ; callIdSequence . complete ( ) ; return true ; |
public class AdminPathmapAction { private static OptionalEntity < PathMapping > getEntity ( final CreateForm form , final String username , final long currentTime ) { } } | switch ( form . crudMode ) { case CrudMode . CREATE : return OptionalEntity . of ( new PathMapping ( ) ) . map ( entity -> { entity . setCreatedBy ( username ) ; entity . setCreatedTime ( currentTime ) ; return entity ; } ) ; case CrudMode . EDIT : if ( form instanceof EditForm ) { return ComponentUtil . getComponent (... |
public class ImageUtil { /** * public static Type getImageType ( ) { return Type . getType ( " Lorg / lucee / extension / image / Image ; " ) ; } */
public static boolean isCastableToImage ( PageContext pc , Object obj ) { } } | try { Class clazz = ImageUtil . getImageClass ( ) ; if ( clazz != null ) { Method m = clazz . getMethod ( "isCastableToImage" , new Class [ ] { PageContext . class , Object . class } ) ; return ( boolean ) m . invoke ( null , new Object [ ] { pc , obj } ) ; } } catch ( Exception e ) { } return false ; |
public class EventContextDataTypeMarshaller { /** * Marshall the given parameter object . */
public void marshall ( EventContextDataType eventContextDataType , ProtocolMarshaller protocolMarshaller ) { } } | if ( eventContextDataType == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( eventContextDataType . getIpAddress ( ) , IPADDRESS_BINDING ) ; protocolMarshaller . marshall ( eventContextDataType . getDeviceName ( ) , DEVICENAME_BINDING ) ; pr... |
public class GetDeviceMethodsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetDeviceMethodsRequest getDeviceMethodsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getDeviceMethodsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getDeviceMethodsRequest . getDeviceId ( ) , DEVICEID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " ... |
public class TypeRefImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case XtextPackage . TYPE_REF__METAMODEL : return metamodel != null ; case XtextPackage . TYPE_REF__CLASSIFIER : return classifier != null ; } return super . eIsSet ( featureID ) ; |
public class MongoDBClient { /** * Gets the GFSDB files .
* @ param mongoQuery
* the mongo query
* @ param sort
* the sort
* @ param collectionName
* the collection name
* @ param maxResult
* the max result
* @ param firstResult
* the first result
* @ return the GFSDB files */
private List < GridF... | KunderaGridFS gfs = new KunderaGridFS ( mongoDb , collectionName ) ; return gfs . find ( mongoQuery , sort , firstResult , maxResult ) ; |
public class HLL { /** * / * package , for testing */
double sparseProbabilisticAlgorithmCardinality ( ) { } } | final int m = this . m /* for performance */
; // compute the " indicator function " - - sum ( 2 ^ ( - M [ j ] ) ) where M [ j ] is the
// ' j ' th register value
double sum = 0 ; int numberOfZeroes = 0 /* " V " in the paper */
; for ( int j = 0 ; j < m ; j ++ ) { final long register = sparseProbabilisticStorage . get ... |
public class SeekableStringReader { /** * Read everything until one of the sentinel ( s ) , which must exist in the string .
* Sentinel char is read but not returned in the result . */
public String readUntil ( String sentinels ) { } } | int index = Integer . MAX_VALUE ; for ( char s : sentinels . toCharArray ( ) ) { int i = str . indexOf ( s , cursor ) ; if ( i >= 0 ) index = Math . min ( i , index ) ; } if ( index >= 0 && index < Integer . MAX_VALUE ) { String result = str . substring ( cursor , index ) ; cursor = index + 1 ; return result ; } throw ... |
public class RetryerBuilder { /** * Sets the stop strategy used to decide when to stop retrying . The default strategy is to not stop at all .
* @ param stopStrategy the strategy used to decide when to stop retrying
* @ return < code > this < / code >
* @ throws IllegalStateException if a stop strategy has alread... | Preconditions . checkNotNull ( stopStrategy , "stopStrategy may not be null" ) ; Preconditions . checkState ( this . stopStrategy == null , "a stop strategy has already been set %s" , this . stopStrategy ) ; this . stopStrategy = stopStrategy ; return this ; |
public class GeneralNames { /** * Write the extension to the DerOutputStream .
* @ param out the DerOutputStream to write the extension to .
* @ exception IOException on error . */
public void encode ( DerOutputStream out ) throws IOException { } } | if ( isEmpty ( ) ) { return ; } DerOutputStream temp = new DerOutputStream ( ) ; for ( GeneralName gn : names ) { gn . encode ( temp ) ; } out . write ( DerValue . tag_Sequence , temp ) ; |
public class DeviceProxyDAODefaultImpl { @ Deprecated public AttributeInfo get_attribute_config ( final DeviceProxy deviceProxy , final String attname ) throws DevFailed { } } | return get_attribute_info ( deviceProxy , attname ) ; |
public class CommandLineParser { /** * Add an argument for this command line parser . Options should not be
* prepended by dashes .
* @ param shortForm
* Single character command line option
* @ param longForm
* String command line option
* @ param helpText
* Help text to show after the short and long for... | Argument f = new Argument ( ) ; f . option = "" + shortForm ; f . longOption = longForm ; f . takesValue = takesValue ; f . valueRequired = valueRequired ; f . helpText = helpText ; f . isParam = isParameter ; if ( isParameter ) params . add ( f ) ; addArgument ( f ) ; |
public class Profiler { /** * Run performance test for the specified < code > method < / code > with the specified < code > threadNum < / code > and < code > loopNum < / code > for each thread .
* The performance test will be repeatedly execute times specified by < code > roundNum < / code > .
* @ param instance
... | return run ( instance , method . getName ( ) , method , args , setUpForMethod , tearDownForMethod , setUpForLoop , tearDownForLoop , threadNum , threadDelay , loopNum , loopDelay , roundNum ) ; |
public class CNFactory { /** * 词性标注
* @ param input 词数组
* @ return 词性数组 */
public String [ ] tag ( String [ ] input ) { } } | if ( pos == null ) return null ; return pos . tagSeged ( input ) ; |
public class ModelResource { /** * Insert a model .
* success status 201
* @ param model the model to insert
* @ return a { @ link javax . ws . rs . core . Response } object .
* @ throws java . lang . Exception if any . */
@ POST public final Response insert ( @ NotNull @ Valid final MODEL model ) throws Except... | return super . insert ( model ) ; |
public class ClassInstanceProvider { /** * If the instance is provided by the user , { @ link Closeable # close ( ) }
* will not be invoked . */
protected void releaseInstance ( T instance ) throws IOException { } } | AtomicInteger currentCount = providedVsCount . get ( instance ) ; if ( currentCount != null ) { if ( currentCount . decrementAndGet ( ) < 0 ) { currentCount . incrementAndGet ( ) ; throw new IllegalArgumentException ( "Given instance of " + instance . getClass ( ) . getName ( ) + " is not managed by this provider" ) ; ... |
public class PanController { /** * Private methods : */
private void stopPanning ( HumanInputEvent < ? > event ) { } } | mapWidget . getMapModel ( ) . getMapView ( ) . setPanDragging ( false ) ; panning = false ; moving = false ; mapWidget . setCursorString ( mapWidget . getDefaultCursorString ( ) ) ; if ( null != event ) { updateView ( event ) ; } |
public class StreamSet { /** * Get the persistence of this StreamSet
* @ return true if this StreamSet is persistent */
public boolean isPersistent ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( this , tc , "isPersistent" ) ; SibTr . exit ( tc , "isPersistent" , Boolean . valueOf ( persistent ) ) ; } return persistent ; |
public class ExcelUtils { /** * 基于Excel模板与注解 { @ link com . github . crab2died . annotation . ExcelField } 导出多sheet的Excel
* @ param sheetWrappers sheet包装类
* @ param templatePath Excel模板路径
* @ param targetPath 导出Excel文件路径
* @ throws Excel4JException 异常 */
public void normalSheet2Excel ( List < NormalSheetWrapper... | try ( SheetTemplate sheetTemplate = exportExcelByModuleHandler ( templatePath , sheetWrappers ) ) { sheetTemplate . write2File ( targetPath ) ; } catch ( IOException e ) { throw new Excel4JException ( e ) ; } |
public class S4DoTask { /** * ( non - Javadoc )
* @ see org . apache . s4 . core . App # onStart ( ) */
@ Override protected void onStart ( ) { } } | logger . info ( "Starting DoTaskApp... App Partition [{}]" , this . getPartitionId ( ) ) ; // < < < < < HEAD Task doesn ' t have start in latest storm - impl
// TODO change the way the app starts
// if ( this . getPartitionId ( ) = = 0)
S4Topology s4topology = ( S4Topology ) getTask ( ) . getTopology ( ) ; S4EntrancePr... |
public class CreateProjectRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateProjectRequest createProjectRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createProjectRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createProjectRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createProjectRequest . getDefaultJobTimeoutMinutes ( ) , DEFAULTJOBTIMEOUTMINU... |
public class Subspace { /** * Returns true if this subspace is a subspace of the specified subspace , i . e .
* if the set of dimensions building this subspace are contained in the set of
* dimensions building the specified subspace .
* @ param subspace the subspace to test
* @ return true if this subspace is a... | return this . dimensionality <= subspace . dimensionality && BitsUtil . intersectionSize ( dimensions , subspace . dimensions ) == dimensionality ; |
public class EC2TagFilterMarshaller { /** * Marshall the given parameter object . */
public void marshall ( EC2TagFilter eC2TagFilter , ProtocolMarshaller protocolMarshaller ) { } } | if ( eC2TagFilter == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( eC2TagFilter . getKey ( ) , KEY_BINDING ) ; protocolMarshaller . marshall ( eC2TagFilter . getValue ( ) , VALUE_BINDING ) ; protocolMarshaller . marshall ( eC2TagFilter . g... |
public class Datatype_Builder { /** * If the value to be returned by { @ link Datatype # getRebuildableType ( ) } is present , replaces it by
* applying { @ code mapper } to it and using the result .
* < p > If the result is null , clears the value .
* @ return this { @ code Builder } object
* @ throws NullPoin... | return setRebuildableType ( getRebuildableType ( ) . map ( mapper ) ) ; |
public class CPDefinitionOptionRelPersistenceImpl { /** * Returns the cp definition option rel where uuid = & # 63 ; and groupId = & # 63 ; or throws a { @ link NoSuchCPDefinitionOptionRelException } if it could not be found .
* @ param uuid the uuid
* @ param groupId the group ID
* @ return the matching cp defin... | CPDefinitionOptionRel cpDefinitionOptionRel = fetchByUUID_G ( uuid , groupId ) ; if ( cpDefinitionOptionRel == null ) { StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "uuid=" ) ; msg . append ( uuid ) ; msg . append ( ", groupId=" ) ; msg . append ( groupId ) ; ... |
public class PdfContentStreamProcessor { /** * Gets the width of a String .
* @ param stringthe string that needs measuring
* @ param tjtext adjustment
* @ returnthe width of a String */
public float getStringWidth ( String string , float tj ) { } } | DocumentFont font = gs ( ) . font ; char [ ] chars = string . toCharArray ( ) ; float totalWidth = 0 ; for ( int i = 0 ; i < chars . length ; i ++ ) { float w = font . getWidth ( chars [ i ] ) / 1000.0f ; float wordSpacing = chars [ i ] == 32 ? gs ( ) . wordSpacing : 0f ; totalWidth += ( ( w - tj / 1000f ) * gs ( ) . f... |
public class SingleItemSketch { /** * Create this sketch with the given byte array .
* If the byte array is null or empty no create attempt is made and the method returns null .
* @ param data The given byte array .
* @ return a SingleItemSketch or null */
public static SingleItemSketch create ( final byte [ ] da... | if ( ( data == null ) || ( data . length == 0 ) ) { return null ; } return new SingleItemSketch ( hash ( data , DEFAULT_UPDATE_SEED ) [ 0 ] >>> 1 ) ; |
public class DTSTrackImpl { /** * EXTSS _ MD */
private boolean parseExtssmd ( int size , ByteBuffer bb ) { } } | int a = bb . get ( ) ; int b = bb . getShort ( ) ; extAvgBitrate = ( a << 16 ) | ( b & 0xffff ) ; int i = 3 ; if ( isVBR ) { a = bb . get ( ) ; b = bb . getShort ( ) ; extPeakBitrate = ( a << 16 ) | ( b & 0xffff ) ; extSmoothBuffSize = bb . getShort ( ) ; i += 5 ; } else { extFramePayloadInBytes = bb . getInt ( ) ; i +... |
public class BackupsInner { /** * Triggers backup for specified backed up item . This is an asynchronous operation . To know the status of the operation , call GetProtectedItemOperationResult API .
* @ param vaultName The name of the recovery services vault .
* @ param resourceGroupName The name of the resource gro... | return triggerWithServiceResponseAsync ( vaultName , resourceGroupName , fabricName , containerName , protectedItemName , parameters ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class SessionWindowAssigner { /** * Merge curWindow and other , return a new window which covers curWindow and other
* if they are overlapped . Otherwise , returns the curWindow itself . */
private TimeWindow mergeWindow ( TimeWindow curWindow , TimeWindow other , Collection < TimeWindow > mergedWindow ) { } } | if ( curWindow . intersects ( other ) ) { mergedWindow . add ( other ) ; return curWindow . cover ( other ) ; } else { return curWindow ; } |
public class PaytrailService { /** * Get url for payment
* @ param payment payment
* @ return Result result
* @ throws PaytrailException */
public Result processPayment ( Payment payment ) throws PaytrailException { } } | try { String data = marshaller . objectToString ( payment ) ; String url = serviceUrl + "/api-payment/create" ; IOHandlerResult requestResult = postJsonRequest ( url , data ) ; if ( requestResult . getCode ( ) != 201 ) { JsonError jsonError = marshaller . stringToObject ( JsonError . class , requestResult . getResponse... |
public class SimpleConfiguration { /** * Loads configuration from InputStream . Later loads have lower priority .
* @ param in InputStream to load from
* @ since 1.2.0 */
public void load ( InputStream in ) { } } | try { PropertiesConfiguration config = new PropertiesConfiguration ( ) ; // disabled to prevent accumulo classpath value from being shortened
config . setDelimiterParsingDisabled ( true ) ; config . load ( in ) ; ( ( CompositeConfiguration ) internalConfig ) . addConfiguration ( config ) ; } catch ( ConfigurationExcept... |
public class BELScriptWalker { /** * BELScriptWalker . g : 364:1 : statement : st = outer _ term ( rel = relationship ( ( OPEN _ PAREN nst = outer _ term nrel = relationship not = outer _ term CLOSE _ PAREN ) | ot = outer _ term ) ) ? ( comment = STATEMENT _ COMMENT ) ? ; */
public final BELScriptWalker . statement_ret... | BELScriptWalker . statement_return retval = new BELScriptWalker . statement_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; CommonTree _first_0 = null ; CommonTree _last = null ; CommonTree comment = null ; CommonTree OPEN_PAREN30 = null ; CommonTree CLOSE_PAREN31 = null ; BELScriptWalker . ... |
public class ResourceObjectIncludeImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . RESOURCE_OBJECT_INCLUDE__OBJ_TYPE : return getObjType ( ) ; case AfplibPackage . RESOURCE_OBJECT_INCLUDE__OBJ_NAME : return getObjName ( ) ; case AfplibPackage . RESOURCE_OBJECT_INCLUDE__XOBJ_OSET : return getXobjOset ( ) ; case AfplibPackage . RESOURCE_OBJECT_INCLUDE__YOBJ_O... |
public class Utils { /** * Returns the size of an iterable . This method should only be used with fixed size
* collections . It will attempt to find an efficient method to get the size before falling
* back to a traversal of the iterable . */
@ SuppressWarnings ( "PMD.UnusedLocalVariable" ) public static < T > int ... | if ( iter instanceof ArrayTagSet ) { return ( ( ArrayTagSet ) iter ) . size ( ) ; } else if ( iter instanceof Collection < ? > ) { return ( ( Collection < ? > ) iter ) . size ( ) ; } else { int size = 0 ; for ( T v : iter ) { ++ size ; } return size ; } |
public class BigDecimalUtil { /** * returns a new BigDecimal with correct scale after being round to n dec places .
* @ param bd value
* @ param numberOfDecPlaces number of dec place to round to
* @ param finalScale final scale of result ( typically numberOfDecPlaces & lt ; finalScale ) ;
* @ return new bd or n... | return setScale ( setScale ( bd , numberOfDecPlaces , BigDecimal . ROUND_HALF_UP ) , finalScale ) ; |
public class ServerPluginRepository { /** * Removes the plugins that are not compatible with current environment . */
private void unloadIncompatiblePlugins ( ) { } } | // loop as long as the previous loop ignored some plugins . That allows to support dependencies
// on many levels , for example D extends C , which extends B , which requires A . If A is not installed ,
// then B , C and D must be ignored . That ' s not possible to achieve this algorithm with a single
// iteration over... |
public class DigitLookupMap { /** * Prints out certain number of spaces . */
private void printSpaces ( int count , java . io . PrintStream out ) { } } | for ( int i = 0 ; i < count ; i ++ ) { out . print ( " " ) ; } |
public class TaskTracker { /** * Close down the TaskTracker and all its components . We must also shutdown
* any running tasks or threads , and cleanup disk space . A new TaskTracker
* within the same process space might be restarted , so everything must be
* clean . */
public synchronized void close ( ) throws I... | // Kill running tasks . Do this in a 2nd vector , called ' tasksToClose ' ,
// because calling jobHasFinished ( ) may result in an edit to ' tasks ' .
TreeMap < TaskAttemptID , TaskInProgress > tasksToClose = new TreeMap < TaskAttemptID , TaskInProgress > ( ) ; tasksToClose . putAll ( tasks ) ; for ( TaskInProgress tip... |
public class ShortColumn { /** * Returns a new DoubleColumn containing a value for each value in this column , truncating if necessary .
* A widening primitive conversion from an int to a double does not lose information about the overall magnitude
* of a numeric value . It may , however , result in loss of precisi... | DoubleArrayList values = new DoubleArrayList ( ) ; for ( int d : data ) { values . add ( d ) ; } values . trim ( ) ; return DoubleColumn . create ( this . name ( ) , values . elements ( ) ) ; |
public class EsMarshalling { /** * Unmarshals the given map source into a bean .
* @ param map the search hit map
* @ return the plugin summary */
public static PluginSummaryBean unmarshallPluginSummary ( Map < String , Object > map ) { } } | PluginSummaryBean bean = new PluginSummaryBean ( ) ; bean . setId ( asLong ( map . get ( "id" ) ) ) ; bean . setName ( asString ( map . get ( "name" ) ) ) ; if ( map . containsKey ( "description" ) ) { bean . setDescription ( asString ( map . get ( "description" ) ) ) ; } bean . setGroupId ( asString ( map . get ( "gro... |
public class Graph { /** * This method allows access to the graph ' s edge values along with its source and target vertex values .
* @ return a triplet DataSet consisting of ( srcVertexId , trgVertexId , srcVertexValue , trgVertexValue , edgeValue ) */
public DataSet < Triplet < K , VV , EV > > getTriplets ( ) { } } | return this . getVertices ( ) . join ( this . getEdges ( ) ) . where ( 0 ) . equalTo ( 0 ) . with ( new ProjectEdgeWithSrcValue < > ( ) ) . name ( "Project edge with source value" ) . join ( this . getVertices ( ) ) . where ( 1 ) . equalTo ( 0 ) . with ( new ProjectEdgeWithVertexValues < > ( ) ) . name ( "Project edge ... |
public class Area { /** * Intersects the supplied area with this area . */
public void intersect ( Area area ) { } } | if ( area == null ) { return ; } else if ( isEmpty ( ) || area . isEmpty ( ) ) { reset ( ) ; return ; } if ( isPolygonal ( ) && area . isPolygonal ( ) ) { intersectPolygon ( area ) ; } else { intersectCurvePolygon ( area ) ; } if ( areaBoundsSquare ( ) < GeometryUtil . EPSILON ) { reset ( ) ; } |
public class V1Span { /** * Returns the distinct { @ link Endpoint # serviceName ( ) service names } that logged to this span . */
public Set < String > serviceNames ( ) { } } | Set < String > result = new LinkedHashSet < > ( ) ; for ( V1Annotation a : annotations ) { if ( a . endpoint == null ) continue ; if ( a . endpoint . serviceName ( ) == null ) continue ; result . add ( a . endpoint . serviceName ( ) ) ; } for ( V1BinaryAnnotation a : binaryAnnotations ) { if ( a . endpoint == null ) co... |
public class Locale { /** * Checks whether a given string is an ASCII alphanumeric string . */
private static boolean isAsciiAlphaNum ( String string ) { } } | for ( int i = 0 ; i < string . length ( ) ; i ++ ) { final char character = string . charAt ( i ) ; if ( ! ( character >= 'a' && character <= 'z' || character >= 'A' && character <= 'Z' || character >= '0' && character <= '9' ) ) { return false ; } } return true ; |
public class AppServiceEnvironmentsInner { /** * Get a diagnostics item for an App Service Environment .
* Get a diagnostics item for an App Service Environment .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service Environment .
* @ param... | return getDiagnosticsItemWithServiceResponseAsync ( resourceGroupName , name , diagnosticsName ) . map ( new Func1 < ServiceResponse < HostingEnvironmentDiagnosticsInner > , HostingEnvironmentDiagnosticsInner > ( ) { @ Override public HostingEnvironmentDiagnosticsInner call ( ServiceResponse < HostingEnvironmentDiagnos... |
public class ImagePyramidBase { /** * Initializes internal data structures based on the input image ' s size . Should be called each time a new image
* is processed .
* @ param width Image width
* @ param height Image height */
@ Override public void initialize ( int width , int height ) { } } | // see if it has already been initialized
if ( bottomWidth == width && bottomHeight == height ) return ; this . bottomWidth = width ; this . bottomHeight = height ; layers = imageType . createArray ( getNumLayers ( ) ) ; double scaleFactor = getScale ( 0 ) ; if ( scaleFactor == 1 ) { if ( ! saveOriginalReference ) { la... |
public class SidesIconProvider { /** * Gets the { @ link Icon } for the side for the block in world . < br >
* Takes in account the facing of the block . < br >
* If no icon was set for the side , { @ link # defaultIcon } is used .
* @ param world the world
* @ param pos the pos
* @ param state the state
* ... | return getIcon ( side ) ; |
public class CreateLayerRequest { /** * An array containing the layer custom security group IDs .
* @ return An array containing the layer custom security group IDs . */
public java . util . List < String > getCustomSecurityGroupIds ( ) { } } | if ( customSecurityGroupIds == null ) { customSecurityGroupIds = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return customSecurityGroupIds ; |
public class MultiPoint { /** * Return the bounding box spanning the full list of points . */
public Bbox getBounds ( ) { } } | if ( isEmpty ( ) ) { return null ; } double minX = Double . MAX_VALUE ; double minY = Double . MAX_VALUE ; double maxX = - Double . MAX_VALUE ; double maxY = - Double . MAX_VALUE ; for ( Point point : points ) { if ( point . getX ( ) < minX ) { minX = point . getX ( ) ; } if ( point . getY ( ) < minY ) { minY = point .... |
public class OneShotSQLGeneratorEngine { /** * Generates the SQL string that forms or retrieves the given term . The
* function takes as input either : a constant ( value or URI ) , a variable , or
* a Function ( i . e . , uri ( ) , eq ( . . ) , ISNULL ( . . ) , etc ) ) .
* If the input is a constant , it will re... | if ( term == null ) { return "" ; } if ( term instanceof ValueConstant ) { ValueConstant ct = ( ValueConstant ) term ; if ( hasIRIDictionary ( ) ) { if ( ct . getType ( ) . isA ( XSD . STRING ) ) { int id = getUriid ( ct . getValue ( ) ) ; if ( id >= 0 ) // return jdbcutil . getSQLLexicalForm ( String . valueOf ( id ) ... |
public class TupleCombinerBuilder { /** * Excludes the given variables from this combiner . */
public TupleCombinerBuilder exclude ( Stream < String > varNamePatterns ) { } } | varNamePatterns . forEach ( varNamePattern -> tupleCombiner_ . addExcludedVar ( varNamePattern ) ) ; return this ; |
public class CollectionUtils { /** * Create a list out of the items in the Iterable .
* @ param < T >
* The type of items in the Iterable .
* @ param items
* The items to be made into a list .
* @ return A list consisting of the items of the Iterable , in the same order . */
public static < T > List < T > toL... | List < T > list = new ArrayList < T > ( ) ; addAll ( list , items ) ; return list ; |
public class DtoConverterServiceImpl { /** * Convert a geometry class to a layer type .
* @ param geometryClass
* JTS geometry class
* @ return Geomajas layer type */
public LayerType toDto ( Class < ? extends com . vividsolutions . jts . geom . Geometry > geometryClass ) { } } | if ( geometryClass == LineString . class ) { return LayerType . LINESTRING ; } else if ( geometryClass == MultiLineString . class ) { return LayerType . MULTILINESTRING ; } else if ( geometryClass == Point . class ) { return LayerType . POINT ; } else if ( geometryClass == MultiPoint . class ) { return LayerType . MULT... |
public class _Private_IonBinaryWriterBuilder { /** * Fills all properties and returns an immutable builder . */
private _Private_IonBinaryWriterBuilder fillDefaults ( ) { } } | // Ensure that we don ' t modify the user ' s builder .
_Private_IonBinaryWriterBuilder b = copy ( ) ; if ( b . getSymtabValueFactory ( ) == null ) { IonSystem system = IonSystemBuilder . standard ( ) . build ( ) ; b . setSymtabValueFactory ( system ) ; } return b . immutable ( ) ; |
public class JamaLU { /** * Return upper triangular factor
* @ return U */
public Matrix getU ( ) { } } | Matrix X = MatrixFactory . createMatrix ( n , n ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i <= j ) { X . set ( i , j , LU [ i ] [ j ] ) ; } } } return X ; |
public class HSQLInterface { /** * Modify the current schema with a SQL DDL command .
* @ param ddl The SQL DDL statement to be run .
* @ throws HSQLParseException Throws exception if SQL parse error is
* encountered . */
public void runDDLCommand ( String ddl ) throws HSQLParseException { } } | sessionProxy . clearLocalTables ( ) ; Result result = sessionProxy . executeDirectStatement ( ddl ) ; if ( result . hasError ( ) ) { throw new HSQLParseException ( result . getMainString ( ) ) ; } |
public class TogglingCommandLink { /** * Changes the state without executing the command . */
public void setState ( State state ) { } } | this . state = state ; setText ( state . isPrimary ( ) ? text1 : text2 ) ; |
public class BootstrapContextImpl { /** * Stop the resource adapter context descriptor task if one was started .
* @ param raThreadContextDescriptor
* @ param threadContext */
private void stopTask ( ThreadContextDescriptor raThreadContextDescriptor , ArrayList < ThreadContext > threadContext ) { } } | if ( raThreadContextDescriptor != null ) raThreadContextDescriptor . taskStopping ( threadContext ) ; |
public class ClassRef { /** * Reads a class Object .
* @ param in source to read from
* @ return the Class read */
public static Class < ? > read ( ObjectInput in ) throws java . io . IOException { } } | byte dim ; Class < ? > cl ; String name ; dim = in . readByte ( ) ; if ( dim == - 1 ) { return null ; } else { name = in . readUTF ( ) ; cl = classFind ( name ) ; if ( cl == null ) { throw new RuntimeException ( "can't load class " + name ) ; } while ( dim -- > 0 ) { cl = net . oneandone . sushi . util . Arrays . getAr... |
public class RegistriesInner { /** * Gets the quota usages for the specified container registry .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ throws IllegalArgumentException thrown if parameter... | return listUsagesWithServiceResponseAsync ( resourceGroupName , registryName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class StorableProperties { /** * Before it saves this value it creates a string out of it . */
public synchronized StorableProperties put ( String key , Object val ) { } } | if ( ! key . equals ( toLowerCase ( key ) ) ) throw new IllegalArgumentException ( "Do not use upper case keys (" + key + ") for StorableProperties since 0.7" ) ; map . put ( key , val . toString ( ) ) ; return this ; |
public class JKIOUtil { /** * Convert to string .
* @ param input the input
* @ return the string
* @ throws IOException Signals that an I / O exception has occurred . */
public static String convertToString ( InputStream input ) throws IOException { } } | try { if ( input == null ) { throw new IOException ( "Input Stream Cannot be NULL" ) ; } StringBuilder sb1 = new StringBuilder ( ) ; String line ; try { BufferedReader r1 = new BufferedReader ( new InputStreamReader ( input , "UTF-8" ) ) ; while ( ( line = r1 . readLine ( ) ) != null ) { sb1 . append ( line ) ; } } fin... |
public class CmsOrgUnitBean { /** * Sets the parentOu . < p >
* @ param parentOu the parentOu to set */
public void setParentOu ( String parentOu ) { } } | if ( parentOu . startsWith ( CmsOrganizationalUnit . SEPARATOR ) ) { parentOu = parentOu . substring ( 1 ) ; } m_parentOu = parentOu ; |
public class CommonUtils { /** * Append the given { @ code annotation } to list of annotations for the given { @ code field } . */
public static void addAnnotation ( JVar field , JAnnotationUse annotation ) { } } | List < JAnnotationUse > annotations = getPrivateField ( field , "annotations" ) ; annotations . add ( annotation ) ; |
public class UtlInvBase { /** * < p > Makes invoice line final results . < / p >
* @ param < T > invoice type
* @ param < L > invoice line type
* @ param pLine invoice line
* @ param pTotTxs total line taxes
* @ param pTotTxsFc total line taxes FC
* @ param pIsTxByUser if tax set by user */
public final < T... | if ( pIsTxByUser ) { if ( pLine . getItsOwner ( ) . getForeignCurrency ( ) == null ) { if ( pLine . getTotalTaxes ( ) . compareTo ( pTotTxs ) != 0 ) { if ( pLine . getDescription ( ) == null ) { pLine . setDescription ( pLine . getTotalTaxes ( ) . toString ( ) + "!=" + pTotTxs + "!" ) ; } else { pLine . setDescription ... |
public class BeanValidationImpl { /** * Start
* @ exception Throwable If an error occurs */
public void start ( ) throws Throwable { } } | Context context = null ; try { Properties properties = new Properties ( ) ; properties . setProperty ( Context . PROVIDER_URL , jndiProtocol + "://" + jndiHost + ":" + jndiPort ) ; context = new InitialContext ( properties ) ; context . rebind ( VALIDATOR_FACTORY , new SerializableValidatorFactory ( validatorFactory ) ... |
public class SimulatorImpl { /** * Shuts down properly .
* This method is typically called from a shutdown hook to terminate the simulator properly .
* Cancels the timer thread used for task scheduling .
* Overloading implementations should call this method AFTER doing its own work . */
protected void shutdown ( ... | LOGGER . info ( "Shutting down SimulatorImpl" ) ; LOGGER . info ( "Cancelling timer thread" ) ; mTimer . cancel ( ) ; mTimer = null ; mSimulator = mPySimulator = null ; mInterpreter = null ; |
public class CoreNLPConstituencyParse { /** * finds the open / closes using a stack */
private static ImmutableList < Range < Integer > > findAllOpenCloseParens ( final String parse ) { } } | final ImmutableList . Builder < Range < Integer > > ret = ImmutableList . builder ( ) ; final Stack < Integer > openPositions = new Stack < > ( ) ; for ( int pos = 0 ; pos < parse . length ( ) ; pos ++ ) { // push
if ( parse . charAt ( pos ) == '(' ) { openPositions . push ( pos ) ; } // pop
if ( parse . charAt ( pos )... |
public class VarCheck { /** * Returns true if n is the name of a variable that declares a namespace in an externs file . */
static boolean isExternNamespace ( Node n ) { } } | return n . getParent ( ) . isVar ( ) && n . isFromExterns ( ) && NodeUtil . isNamespaceDecl ( n ) ; |
public class AuditAnnotationAttributes { /** * Gets the action .
* @ param annotations
* the annotations
* @ param method
* the method
* @ return the action */
private String getAction ( final Annotation [ ] annotations , final Method method ) { } } | for ( final Annotation annotation : annotations ) { if ( annotation instanceof Audit ) { final Audit audit = ( Audit ) annotation ; String action = audit . action ( ) ; if ( ACTION . equals ( action ) ) { return method . getName ( ) ; } else { return action ; } } } return null ; |
public class UnicodeUtilImpl { /** * @ see # normalize2Ascii ( char )
* @ param character is the character to convert .
* @ param nonNormalizableCharaterReplacement is the character used to replace unicode characters that have
* no { @ link # normalize2Ascii ( char ) corresponding ASCII representation } . Use { @... | String transliteration = transliterate ( character ) ; if ( transliteration == null ) { return CHARACTER_TO_ASCII_MAP . get ( Character . valueOf ( character ) ) ; } else { int length = transliteration . length ( ) ; if ( length == 1 ) { return CHARACTER_TO_ASCII_MAP . get ( Character . valueOf ( transliteration . char... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.