signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class JSONML { /** * Convert a well - formed ( but not necessarily valid ) XML string into a JSONArray using the JsonML transform . Each XML tag is represented as a JSONArray in which the first element is the tag name . If
* the tag has attributes , then the second element will be JSONObject containing the nam... | return ( JSONArray ) parse ( x , true , null ) ; |
public class CmsModulesUploadFromServer { /** * Creates the list of widgets for this dialog . < p > */
@ Override protected void defineWidgets ( ) { } } | List selectOptions = getModulesFromServer ( ) ; if ( selectOptions . isEmpty ( ) ) { // no import modules available , display message
addWidget ( new CmsWidgetDialogParameter ( this , "moduleupload" , PAGES [ 0 ] , new CmsDisplayWidget ( key ( Messages . GUI_MODULES_IMPORT_NOT_AVAILABLE_0 ) ) ) ) ; } else { // add the ... |
public class AWSDynamoUtils { /** * Returns the table name for a given app id . Table names are usually in the form ' prefix - appid ' .
* @ param appIdentifier app id
* @ return the table name */
public static String getTableNameForAppid ( String appIdentifier ) { } } | if ( StringUtils . isBlank ( appIdentifier ) ) { return null ; } else { if ( isSharedAppid ( appIdentifier ) ) { // app is sharing a table with other apps
appIdentifier = SHARED_TABLE ; } return ( App . isRoot ( appIdentifier ) || appIdentifier . startsWith ( Config . PARA . concat ( "-" ) ) ) ? appIdentifier : Config ... |
public class LayerUtil { /** * Returns the depth of the given layer in its local scene graph . A root layer ( one with null
* parent ) will always return 0. */
public static int graphDepth ( Layer layer ) { } } | int depth = - 1 ; while ( layer != null ) { layer = layer . parent ( ) ; depth ++ ; } return depth ; |
public class FluentAnswer { /** * Creates a new instance for the given type .
* @ param type
* the return type of the answer
* @ param < T >
* generic parameter of the return type
* @ return new Answer that returns the mock itself */
public static < T extends Query < ? , R > , R extends Object > FluentAnswer ... | return new FluentAnswer < T , R > ( type ) ; |
public class DefaultMultipartResourceRequest { /** * { @ inheritDoc } */
@ Override public Enumeration < String > getParameterNames ( ) { } } | Set < String > paramNames = new HashSet < String > ( ) ; Enumeration < String > paramEnum = super . getParameterNames ( ) ; while ( paramEnum . hasMoreElements ( ) ) { paramNames . add ( ( String ) paramEnum . nextElement ( ) ) ; } paramNames . addAll ( getMultipartParameters ( ) . keySet ( ) ) ; return Collections . e... |
public class ST_IsValidDetail { /** * Returns a valid _ detail as an array of objects
* [ 0 ] = isvalid , [ 1 ] = reason , [ 2 ] = error location
* isValid equals true if the geometry is valid .
* reason correponds to an error message describing this error .
* error returns the location of this error ( on the {... | if ( geometry != null ) { if ( flag == 0 ) { return detail ( geometry , false ) ; } else if ( flag == 1 ) { return detail ( geometry , true ) ; } else { throw new IllegalArgumentException ( "Supported arguments is 0 or 1." ) ; } } return null ; |
public class LifecycleQueryChaincodeDefinitionProposalResponse { /** * The validation parameter bytes that were set when the chaincode was defined .
* @ return validation parameter .
* @ throws ProposalException */
public byte [ ] getValidationParameter ( ) throws ProposalException { } } | ByteString payloadBytes = parsePayload ( ) . getValidationParameter ( ) ; if ( null == payloadBytes ) { return null ; } return payloadBytes . toByteArray ( ) ; |
public class KubernetesClientTimeoutException { /** * Creates a string listing all the resources that are not ready .
* @ param resources The resources that are not ready .
* @ return */
private static String notReadyToString ( Iterable < HasMetadata > resources ) { } } | StringBuilder sb = new StringBuilder ( ) ; sb . append ( "Resources that are not ready: " ) ; boolean first = true ; for ( HasMetadata r : resources ) { if ( first ) { first = false ; } else { sb . append ( ", " ) ; } sb . append ( "[Kind:" ) . append ( r . getKind ( ) ) . append ( " Name:" ) . append ( r . getMetadata... |
public class JsonBuilder { /** * Allows you to add incomplete object builders without calling get ( )
* @ param elements json builders
* @ return json array with the builder objects */
public static @ Nonnull JsonSet set ( JsonBuilder ... elements ) { } } | JsonSet jjArray = new JsonSet ( ) ; for ( JsonBuilder b : elements ) { jjArray . add ( b ) ; } return jjArray ; |
public class SheetResourcesImpl { /** * Imports a sheet .
* It mirrors to the following Smartsheet REST API method : POST / sheets / import
* @ param file path to the CSV file
* @ param sheetName destination sheet name
* @ param headerRowIndex index ( 0 based ) of row to be used for column names
* @ param pri... | return importFile ( "sheets/import" , file , "text/csv" , sheetName , headerRowIndex , primaryRowIndex ) ; |
public class ClassUtils { /** * 迭代查询全部方法 , 包括本类和父类
* @ param clazz 对象类
* @ return 所有字段列表 */
public static List < Method > getAllMethods ( Class clazz ) { } } | List < Method > all = new ArrayList < Method > ( ) ; for ( Class < ? > c = clazz ; c != Object . class && c != null ; c = c . getSuperclass ( ) ) { Method [ ] methods = c . getDeclaredMethods ( ) ; // 所有方法 , 不包含父类
for ( Method method : methods ) { int mod = method . getModifiers ( ) ; // native的不要
if ( Modifier . isNat... |
public class DefaultPushNotificationMessageMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DefaultPushNotificationMessage defaultPushNotificationMessage , ProtocolMarshaller protocolMarshaller ) { } } | if ( defaultPushNotificationMessage == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( defaultPushNotificationMessage . getAction ( ) , ACTION_BINDING ) ; protocolMarshaller . marshall ( defaultPushNotificationMessage . getBody ( ) , BODY_BI... |
public class ExecutionEnvironment { /** * Creates a new data set that contains the given elements . The elements must all be of the same type ,
* for example , all of the { @ link String } or { @ link Integer } . The sequence of elements must not be empty .
* < p > The framework will try and determine the exact typ... | if ( data == null ) { throw new IllegalArgumentException ( "The data must not be null." ) ; } if ( data . length == 0 ) { throw new IllegalArgumentException ( "The number of elements must not be zero." ) ; } TypeInformation < X > typeInfo ; try { typeInfo = TypeExtractor . getForObject ( data [ 0 ] ) ; } catch ( Except... |
public class MediaServicesInner { /** * Regenerates a primary or secondary key for a Media Service .
* @ param resourceGroupName Name of the resource group within the Azure subscription .
* @ param mediaServiceName Name of the Media Service .
* @ param keyType The keyType indicating which key you want to regenera... | return regenerateKeyWithServiceResponseAsync ( resourceGroupName , mediaServiceName , keyType ) . map ( new Func1 < ServiceResponse < RegenerateKeyOutputInner > , RegenerateKeyOutputInner > ( ) { @ Override public RegenerateKeyOutputInner call ( ServiceResponse < RegenerateKeyOutputInner > response ) { return response ... |
public class URLUtils { /** * Encode multi form parameters */
public static String encodeForms ( Collection < ? extends Parameter < String > > queries , Charset charset ) { } } | StringBuilder sb = new StringBuilder ( ) ; try { for ( Parameter < String > query : queries ) { sb . append ( URLEncoder . encode ( query . name ( ) , charset . name ( ) ) ) ; sb . append ( '=' ) ; sb . append ( URLEncoder . encode ( query . value ( ) , charset . name ( ) ) ) ; sb . append ( '&' ) ; } } catch ( Unsuppo... |
public class TypeConverter { /** * Get the class to use . In case the passed class is a primitive type , the
* corresponding wrapper class is used .
* @ param aClass
* The class to check . Can be < code > null < / code > but should not be
* < code > null < / code > .
* @ return < code > null < / code > if the... | final Class < ? > aPrimitiveWrapperType = ClassHelper . getPrimitiveWrapperClass ( aClass ) ; return aPrimitiveWrapperType != null ? aPrimitiveWrapperType : aClass ; |
public class CollectionMapperFactory { /** * Returns the Mapper for the given field . If a Mapper exists in the cache that can map the given
* field , the cached Mapper will be returned . Otherwise , a new Mapper is created and returned .
* @ param field
* the field of an entity for which a Mapper is to be produc... | Type genericType = field . getGenericType ( ) ; Property propertyAnnotation = field . getAnnotation ( Property . class ) ; boolean indexed = true ; if ( propertyAnnotation != null ) { indexed = propertyAnnotation . indexed ( ) ; } String cacheKey = computeCacheKey ( genericType , indexed ) ; Mapper mapper = cache . get... |
public class CompactChangeEvent { /** * Creates a copy of this change event with uncommitted writes flag set to false .
* @ return new change event without uncommitted writes flag */
public CompactChangeEvent < DocumentT > withoutUncommittedWrites ( ) { } } | return new CompactChangeEvent < > ( this . getOperationType ( ) , this . getFullDocument ( ) , this . getDocumentKey ( ) , this . getUpdateDescription ( ) , this . getStitchDocumentVersion ( ) , this . getStitchDocumentHash ( ) , false ) ; |
public class ProcessEngineConfigurationImpl { /** * password digest / / / / / */
protected void initPasswordDigest ( ) { } } | if ( saltGenerator == null ) { saltGenerator = new Default16ByteSaltGenerator ( ) ; } if ( passwordEncryptor == null ) { passwordEncryptor = new Sha512HashDigest ( ) ; } if ( customPasswordChecker == null ) { customPasswordChecker = Collections . emptyList ( ) ; } if ( passwordManager == null ) { passwordManager = new ... |
public class RefreshableThreadObject { /** * Remove the object from the Thread instances
* @ param env */
public void remove ( Env env ) { } } | T obj = objs . remove ( Thread . currentThread ( ) ) ; if ( obj != null ) obj . destroy ( env ) ; |
public class ResourceErrorMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ResourceError resourceError , ProtocolMarshaller protocolMarshaller ) { } } | if ( resourceError == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( resourceError . getErrorCode ( ) , ERRORCODE_BINDING ) ; protocolMarshaller . marshall ( resourceError . getErrorMessage ( ) , ERRORMESSAGE_BINDING ) ; protocolMarshaller ... |
public class CalibratingTimer { /** * Returns the difference between _ startStamp and current ( ) */
protected long elapsed ( ) { } } | long current = current ( ) ; if ( _driftRatio != 1.0 ) { long elapsed = current - _priorCurrent ; _startStamp += ( elapsed - ( elapsed * _driftRatio ) ) ; } _priorCurrent = current ; return current - _startStamp ; |
public class TransformIterable { /** * Convert array from D type to type which set by { @ code dClass } parameter .
* @ return array with type { @ code dClass } . */
public Object [ ] toArray ( ) { } } | ArrayList < D > l = new ArrayList < D > ( ) ; for ( S o : wrapped ) { l . add ( xform . transform ( o , clazz ) ) ; } return l . toArray ( ) ; |
public class SemanticServiceImpl { /** * { @ inheritDoc } */
@ Override public void checkListUsage ( final Statement statement , final Document document ) throws SemanticWarning { } } | Object object = statement . getObject ( ) ; if ( object != null && ! statement . hasNestedStatement ( ) && object . getTerm ( ) . getFunctionEnum ( ) == FunctionEnum . LIST && ! statement . getRelationshipType ( ) . isListable ( ) ) { if ( document != null ) { pruneStatement ( statement , document ) ; } final String er... |
public class JSONArray { /** * Get the enum value associated with a key .
* @ param < E >
* Enum Type
* @ param clazz
* The type of enum to retrieve .
* @ param index
* The index must be between 0 and length ( ) - 1.
* @ return The enum value at the index location or null if not found */
public < E extend... | return this . optEnum ( clazz , index , null ) ; |
public class XMLConfigFactory { /** * load XML Document from XML File
* @ param is InoutStream to read
* @ return returns the Document
* @ throws SAXException
* @ throws IOException */
private static Document _loadDocument ( InputStream is ) throws SAXException , IOException { } } | InputSource source = new InputSource ( is ) ; return XMLUtil . parse ( source , null , false ) ; |
public class MavenJDOMWriter { /** * Method updateNotifier .
* @ param value
* @ param element
* @ param counter
* @ param xmlTag */
protected void updateNotifier ( Notifier value , String xmlTag , Counter counter , Element element ) { } } | Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "type" , value . getType ( ) , "mail" ) ; findAndReplaceSimpleElement ( innerCount , root , "sendOnError" , ( value . isSendOnError ( ) == true ) ? null : String . valueOf ( value... |
public class GenericTableColumnsModel { /** * Callback method for set the canEdit array from the generic given type . This method is invoked
* in the constructor from the derived classes and can be overridden so users can provide their
* own version of a column classes */
protected void onSetCanEdit ( ) { } } | Field [ ] fields = ReflectionExtensions . getDeclaredFields ( getType ( ) , "serialVersionUID" ) ; canEdit = new boolean [ fields . length ] ; for ( int i = 0 ; i < fields . length ; i ++ ) { canEdit [ i ] = false ; } |
public class Billing { /** * < pre >
* Billing configurations for sending metrics to the consumer project .
* There can be multiple consumer destinations per service , each one must have
* a different monitored resource type . A metric can be used in at most
* one consumer destination .
* < / pre >
* < code... | return consumerDestinations_ ; |
public class XSLServlet { /** * Get or Create a transformer for the specified stylesheet .
* @ param req
* @ param servletTask
* @ param screen
* @ return
* @ throws ServletException
* @ throws IOException */
public Transformer getTransformer ( HttpServletRequest req , ServletTask servletTask , ScreenModel ... | String stylesheet = null ; if ( stylesheet == null ) stylesheet = req . getParameter ( DBParams . TEMPLATE ) ; if ( stylesheet == null ) if ( screen != null ) if ( screen . getScreenFieldView ( ) != null ) stylesheet = screen . getScreenFieldView ( ) . getStylesheetPath ( ) ; if ( stylesheet == null ) stylesheet = req ... |
public class ManagedContext { /** * This should only be called when SIGINT is received */
private void close ( ) { } } | lock . lock ( ) ; try { for ( SocketBase s : sockets ) { try { s . setSocketOpt ( ZMQ . ZMQ_LINGER , 0 ) ; s . close ( ) ; } catch ( Exception ignore ) { } } sockets . clear ( ) ; } finally { lock . unlock ( ) ; } |
public class VirtualNetworkGatewaysInner { /** * Gets pre - generated VPN profile for P2S client of the virtual network gateway in the specified resource group . The profile needs to be generated first using generateVpnProfile .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetworkGa... | return getVpnProfilePackageUrlWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class GoogleCredential { /** * { @ link Beta } < br / >
* Return a credential defined by a Json file .
* @ param credentialStream the stream with the credential definition .
* @ return the credential defined by the credentialStream .
* @ throws IOException if the credential cannot be created from the str... | return fromStream ( credentialStream , Utils . getDefaultTransport ( ) , Utils . getDefaultJsonFactory ( ) ) ; |
public class FunctionCall { /** * Get a parameter assignment .
* @ param name the parameter name
* @ return the number */
public Number getParameter ( String name ) { } } | Number number = bindings . get ( name ) ; if ( number == null ) { throw new FuzzerException ( function . getName ( ) + ": undefined parameter '" + name + "'" ) ; } return number ; |
public class CarRent { /** * Rent a car available in the last serach result
* @ param intp - the command interpreter instance */
public void racRent ( ) { } } | pos = pos - 1 ; String userName = CarSearch . getLastSearchParams ( ) [ 0 ] ; String pickupDate = CarSearch . getLastSearchParams ( ) [ 1 ] ; String returnDate = CarSearch . getLastSearchParams ( ) [ 2 ] ; this . searcher . search ( userName , pickupDate , returnDate ) ; if ( searcher != null && searcher . getCars ( ) ... |
public class DashboardAuditServiceImpl { /** * Calculates audit response for a given dashboard
* @ param dashboardTitle
* @ param dashboardType
* @ param businessService
* @ param businessApp
* @ param beginDate
* @ param endDate
* @ param auditTypes
* @ return @ DashboardReviewResponse for a given dash... | validateParameters ( dashboardTitle , dashboardType , businessService , businessApp , beginDate , endDate ) ; DashboardReviewResponse dashboardReviewResponse = new DashboardReviewResponse ( ) ; Dashboard dashboard = getDashboard ( dashboardTitle , dashboardType , businessService , businessApp ) ; if ( dashboard == null... |
public class BeanPropertiesToCsvHeaderConverter { public String toHeaderRow ( Class < ? > objectClass ) { } } | if ( ClassPath . isPrimitive ( objectClass ) || Scheduler . isDateOrTime ( objectClass ) ) return new StringBuilder ( objectClass . getSimpleName ( ) ) . append ( "\n" ) . toString ( ) ; Method [ ] methodArray = objectClass . getMethods ( ) ; Method m ; String methodName = null ; methods = new TreeMap < String , Method... |
public class CmsSearchIndex { /** * Adds a parameter . < p >
* @ param key the key / name of the parameter
* @ param value the value of the parameter */
@ Override public void addConfigurationParameter ( String key , String value ) { } } | if ( PERMISSIONS . equals ( key ) ) { m_checkPermissions = Boolean . valueOf ( value ) . booleanValue ( ) ; } else if ( EXTRACT_CONTENT . equals ( key ) ) { setExtractContent ( Boolean . valueOf ( value ) . booleanValue ( ) ) ; } else if ( BACKUP_REINDEXING . equals ( key ) ) { m_backupReindexing = Boolean . valueOf ( ... |
public class StoreDefinitionUtils { /** * Ensure that new store definitions that are specified for an update do not include breaking changes to the store .
* Non - breaking changes include changes to
* description
* preferredWrites
* requiredWrites
* preferredReads
* requiredReads
* retentionPeriodDays
... | if ( ! oldStoreDef . getName ( ) . equals ( newStoreDef . getName ( ) ) ) { throw new VoldemortException ( "Cannot compare stores of different names: " + oldStoreDef . getName ( ) + " and " + newStoreDef . getName ( ) ) ; } String store = oldStoreDef . getName ( ) ; verifySamePropertyForUpdate ( oldStoreDef . getReplic... |
public class BooleanOperation { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div >
* < div color = ' red ' style = " font - size : 18px ; color : red " > < i > test for containment in a list of matched domain objects < / i > < / div >... | DomainObjectMatch < ? > delegate = APIAccess . getDelegate ( domainObjects ) ; DomainObjectMatch < ? > match = delegate != null ? delegate : domainObjects ; getPredicateExpression ( ) . setOperator ( Operator . IN ) ; getPredicateExpression ( ) . setValue_2 ( match ) ; TerminalResult ret = APIAccess . createTerminalRes... |
public class KafkaTopicsDescriptor { /** * Check if the input topic matches the topics described by this KafkaTopicDescriptor .
* @ return true if found a match . */
public boolean isMatchingTopic ( String topic ) { } } | if ( isFixedTopics ( ) ) { return getFixedTopics ( ) . contains ( topic ) ; } else { return topicPattern . matcher ( topic ) . matches ( ) ; } |
public class DataGridStateFactory { /** * Get an instance of a DataGridStateFactory given a { @ link ServletRequest } .
* @ param request the current { @ link ServletRequest }
* @ return an instance of the factory */
public static final DataGridStateFactory getInstance ( ServletRequest request ) { } } | Object obj = request . getAttribute ( KEY ) ; if ( obj != null ) { assert obj instanceof DataGridStateFactory ; return ( DataGridStateFactory ) obj ; } else { DataGridStateFactory factory = new DataGridStateFactory ( request ) ; request . setAttribute ( KEY , factory ) ; return factory ; } |
public class CertificatesInner { /** * Generate verification code for proof of possession flow .
* Generates verification code for proof of possession flow . The verification code will be used to generate a leaf certificate .
* @ param resourceGroupName The name of the resource group that contains the IoT hub .
*... | return ServiceFuture . fromResponse ( generateVerificationCodeWithServiceResponseAsync ( resourceGroupName , resourceName , certificateName , ifMatch ) , serviceCallback ) ; |
public class BundlePackagerMojo { /** * Execute method creates application bundle . Also creates the application distribution if the
* { @ link # wisdomDirectory } parameter is not set and if { @ link # disableDistributionPackaging }
* is set to false .
* @ throws MojoExecutionException if the bundle or the distr... | try { createApplicationBundle ( ) ; if ( ! disableDistributionPackaging ) { if ( wisdomDirectory != null ) { getLog ( ) . warn ( "Cannot create the distribution of " + project . getArtifactId ( ) + " because it is using a remote Wisdom server (" + wisdomDirectory . getAbsolutePath ( ) + ")." ) ; } else { createApplicat... |
public class ThriftCodecByteCodeGenerator { /** * Defines the code to construct the struct ( or builder ) instance and stores it in a local
* variable . */
private LocalVariableDefinition constructStructInstance ( MethodDefinition read , Map < Short , LocalVariableDefinition > structData ) { } } | LocalVariableDefinition instance = read . addLocalVariable ( structType , "instance" ) ; // create the new instance ( or builder )
if ( metadata . getBuilderClass ( ) == null ) { read . newObject ( structType ) . dup ( ) ; } else { read . newObject ( metadata . getBuilderClass ( ) ) . dup ( ) ; } // invoke constructor
... |
public class Items { /** * Gets a read - only view all the { @ link Item } s recursively in the { @ link ItemGroup } tree visible to the supplied
* authentication without concern for the order in which items are returned . Each iteration
* of the view will be " live " reflecting the items available between the time... | return new AllItemsIterable < > ( root , authentication , type ) ; |
public class DefaultJsonWriter { /** * { @ inheritDoc } */
@ Override public final void setIndent ( String indent ) { } } | if ( indent . length ( ) == 0 ) { this . indent = null ; this . separator = ":" ; } else { this . indent = indent ; this . separator = ": " ; } |
public class LittleEndian { /** * Sets a 32 - bit integer in the given byte array at the given offset . */
public static void setInt32 ( byte [ ] dst , int offset , long value ) throws IllegalArgumentException { } } | assert value <= Integer . MAX_VALUE : "value out of range" ; dst [ offset + 0 ] = ( byte ) ( value & 0xFF ) ; dst [ offset + 1 ] = ( byte ) ( ( value >>> 8 ) & 0xFF ) ; dst [ offset + 2 ] = ( byte ) ( ( value >>> 16 ) & 0xFF ) ; dst [ offset + 3 ] = ( byte ) ( ( value >>> 24 ) & 0xFF ) ; |
public class ListStatistics { /** * once we have the Item available to determine it from . */
public final void updateTotal ( int oldSizeInBytes , int newSizeInBytes ) throws SevereMessageStoreException { } } | boolean doCallback = false ; synchronized ( this ) { // We ' re only replacing an old size estimation
// with a new one so we do not need to change
// or inspect the count total and watermark
// Check whether we were between our limits before
// before this update .
boolean wasBelowHighLimit = ( _countTotalBytes < _wat... |
public class Counter { /** * This method will apply normalization to counter values and totals . */
public void normalize ( ) { } } | for ( T key : keySet ( ) ) { setCount ( key , getCount ( key ) / totalCount . get ( ) ) ; } rebuildTotals ( ) ; |
public class DataSourceTypeImpl { /** * Returns the < code > max - idle - time < / code > element
* @ return the node defined for the element < code > max - idle - time < / code > */
public Integer getMaxIdleTime ( ) { } } | if ( childNode . getTextValueForPatternName ( "max-idle-time" ) != null && ! childNode . getTextValueForPatternName ( "max-idle-time" ) . equals ( "null" ) ) { return Integer . valueOf ( childNode . getTextValueForPatternName ( "max-idle-time" ) ) ; } return null ; |
public class DB { /** * Set JDBDT save - point .
* @ param callInfo Call info . */
void save ( CallInfo callInfo ) { } } | access ( callInfo , ( ) -> { if ( ! savepointSupport ) { throw new UnsupportedOperationException ( "Savepoints are not supported by the database driver." ) ; } logSetup ( callInfo ) ; clearSavePointIfSet ( ) ; if ( connection . getAutoCommit ( ) ) { throw new InvalidOperationException ( "Auto-commit is set for database... |
public class UrlMappingsHolderFactoryBean { /** * Set the ApplicationContext that this object runs in .
* Normally this call will be used to initialize the object .
* < p > Invoked after population of normal bean properties but before an init callback such
* as { @ link org . springframework . beans . factory . I... | this . applicationContext = applicationContext ; setGrailsApplication ( applicationContext . getBean ( GrailsApplication . APPLICATION_ID , GrailsApplication . class ) ) ; setPluginManager ( applicationContext . containsBean ( GrailsPluginManager . BEAN_NAME ) ? applicationContext . getBean ( GrailsPluginManager . BEAN... |
public class RepairingHandler { /** * TODO : really need to pass partition ID ? */
public void updateLastKnownStaleSequence ( MetaDataContainer metaData , int partition ) { } } | long lastReceivedSequence ; long lastKnownStaleSequence ; do { lastReceivedSequence = metaData . getSequence ( ) ; lastKnownStaleSequence = metaData . getStaleSequence ( ) ; if ( lastKnownStaleSequence >= lastReceivedSequence ) { break ; } } while ( ! metaData . casStaleSequence ( lastKnownStaleSequence , lastReceivedS... |
public class URLStreamHandlerAdapter { /** * @ see org . osgi . service . url . URLStreamHandlerService # toExternalForm ( java . net . URL ) */
@ Override public String toExternalForm ( URL url ) { } } | try { return ( String ) _toExternalForm . invoke ( getInstance ( ) , new Object [ ] { url } ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , getClass ( ) . getName ( ) , "toExternalForm" , url ) ; return null ; } |
public class dnspolicy { /** * Use this API to fetch dnspolicy resource of given name . */
public static dnspolicy get ( nitro_service service , String name ) throws Exception { } } | dnspolicy obj = new dnspolicy ( ) ; obj . set_name ( name ) ; dnspolicy response = ( dnspolicy ) obj . get_resource ( service ) ; return response ; |
public class NettyServer { /** * close all channels , and release resources */
public void close ( ) { } } | LOG . info ( "Begin to shutdown NettyServer" ) ; if ( allChannels != null ) { new Thread ( new Runnable ( ) { @ Override public void run ( ) { try { // await ( 5 , TimeUnit . SECONDS )
// sometimes allChannels . close ( ) will block the exit thread
allChannels . close ( ) . await ( 1 , TimeUnit . SECONDS ) ; LOG . info... |
public class AmazonLexModelBuildingClient { /** * Gets a list of built - in intents that meet the specified criteria .
* This operation requires permission for the < code > lex : GetBuiltinIntents < / code > action .
* @ param getBuiltinIntentsRequest
* @ return Result of the GetBuiltinIntents operation returned ... | request = beforeClientExecution ( request ) ; return executeGetBuiltinIntents ( request ) ; |
public class IntTupleStreams { /** * Returns a stream that returns the { @ link MutableIntTuple } s from the
* given delegate that are contained in the given bounds . < br >
* < br >
* Copies of the given tuples will be stored internally . < br >
* < br >
* @ param < T > The type of the stream elements
* @ ... | Utils . checkForEqualSize ( min , max ) ; IntTuple localMin = IntTuples . copy ( min ) ; IntTuple localMax = IntTuples . copy ( max ) ; return delegate . filter ( t -> IntTuples . areElementsGreaterThanOrEqual ( t , localMin ) && IntTuples . areElementsLessThan ( t , localMax ) ) ; |
public class CommonOps_DDF5 { /** * Performs an element by element scalar multiplication . < br >
* < br >
* b < sub > i < / sub > = & alpha ; * a < sub > i < / sub >
* @ param alpha the amount each element is multiplied by .
* @ param a The vector that is to be scaled . Not modified .
* @ param b Where the s... | b . a1 = a . a1 * alpha ; b . a2 = a . a2 * alpha ; b . a3 = a . a3 * alpha ; b . a4 = a . a4 * alpha ; b . a5 = a . a5 * alpha ; |
import java . math . * ; public class CalculateMinimumSumOfFactors { /** * This java function calculates the minimum sum of factors of a number .
* > > > calculateMinimumSumOfFactors ( 12)
* > > > calculateMinimumSumOfFactors ( 105)
* 15
* > > > calculateMinimumSumOfFactors ( 2) */
public static double calculat... | double factorSum = 0 ; int divisor = 2 ; while ( ( divisor * divisor ) <= inputNumber ) { while ( ( inputNumber % divisor ) == 0 ) { factorSum += divisor ; inputNumber /= divisor ; } divisor += 1 ; } factorSum += inputNumber ; return factorSum ; |
public class UniverseApi { /** * Get item group information Get information on an item group - - - This
* route expires daily at 11:05
* @ param groupId
* An Eve item group ID ( required )
* @ param acceptLanguage
* Language to use in the response ( optional , default to en - us )
* @ param datasource
* T... | ApiResponse < GroupResponse > resp = getUniverseGroupsGroupIdWithHttpInfo ( groupId , acceptLanguage , datasource , ifNoneMatch , language ) ; return resp . getData ( ) ; |
public class OutgoingFileTransfer { /** * This method handles the stream negotiation process and transmits the file
* to the remote user . It returns immediately and the progress of the file
* transfer can be monitored through several methods :
* < UL >
* < LI > { @ link FileTransfer # getStatus ( ) }
* < LI ... | checkTransferThread ( ) ; if ( file == null || ! file . exists ( ) || ! file . canRead ( ) ) { throw new IllegalArgumentException ( "Could not read file" ) ; } else { setFileInfo ( file . getAbsolutePath ( ) , file . getName ( ) , file . length ( ) ) ; } transferThread = new Thread ( new Runnable ( ) { @ Override publi... |
public class ApplicationSession { /** * When a correct login occurs , read all relevant userinformation into
* session .
* @ param event
* the loginEvent that triggered this handler . */
protected void handleLoginEvent ( LoginEvent event ) { } } | ApplicationSessionInitializer asi = getApplicationSessionInitializer ( ) ; if ( asi != null ) { asi . initializeUser ( ) ; Map < String , Object > userAttributes = asi . getUserAttributes ( ) ; if ( userAttributes != null ) { setUserAttributes ( userAttributes ) ; } } Authentication auth = ( Authentication ) event . ge... |
public class HtmlDocumentUtils { /** * Searches for the given selector if found it returns the text of the first result .
* @ param aElementSelector The selector for the searched element .
* @ param aDocument The document in which will be searched .
* @ return A { @ link Optional } containing the found element or... | final Elements selected = aDocument . select ( aElementSelector ) ; if ( ! selected . isEmpty ( ) ) { return Optional . of ( selected . first ( ) . text ( ) ) ; } return Optional . empty ( ) ; |
public class ColorComponent { /** * Gets the { @ link EnumDyeColor color } for the { @ link IBlockState } .
* @ param state the state
* @ return the EnumDyeColor , null if the block is not { @ link ColorComponent } */
public static EnumDyeColor getColor ( IBlockState state ) { } } | ColorComponent cc = IComponent . getComponent ( ColorComponent . class , state . getBlock ( ) ) ; if ( cc == null ) return EnumDyeColor . WHITE ; PropertyEnum < EnumDyeColor > property = cc . getProperty ( ) ; if ( property == null || ! state . getProperties ( ) . containsKey ( property ) ) return EnumDyeColor . WHITE ... |
public class ArgumentMatchers { /** * Object argument that is reflection - equal to the given value with support for excluding
* selected fields from a class .
* This matcher can be used when equals ( ) is not implemented on compared objects .
* Matcher uses java reflection API to compare fields of wanted and act... | reportMatcher ( new ReflectionEquals ( value , excludeFields ) ) ; return null ; |
public class Calendar { /** * Sets all the calendar field values and the time value
* ( millisecond offset from the < a href = " # Epoch " > Epoch < / a > ) of
* this < code > Calendar < / code > undefined . This means that { @ link
* # isSet ( int ) isSet ( ) } will return < code > false < / code > for all the
... | for ( int i = 0 ; i < fields . length ; ) { stamp [ i ] = fields [ i ] = 0 ; // UNSET = = 0
isSet [ i ++ ] = false ; } areAllFieldsSet = areFieldsSet = false ; isTimeSet = false ; |
public class PersonRecognition { /** * 构建viterbi路径
* @ param terms
* @ return */
private Viterbi < PersonNode > getPersonNodeViterbi ( Term [ ] terms ) { } } | Term first ; PersonNatureAttr fPna ; Term second ; Term third ; Term from ; for ( int i = 0 ; i < terms . length - 1 ; i ++ ) { first = terms [ i ] ; if ( first == null ) { continue ; } fPna = getPersonNature ( first ) ; setNode ( first , A ) ; if ( fPna . getY ( ) > 0 ) { setNode ( first , Y ) ; } if ( ! fPna . isActi... |
public class RealVoltDB { /** * Verify the integrity of the newly updated catalog stored on the ZooKeeper */
@ Override public String verifyJarAndPrepareProcRunners ( byte [ ] catalogBytes , String diffCommands , byte [ ] catalogBytesHash , byte [ ] deploymentBytes ) { } } | ImmutableMap . Builder < String , Class < ? > > classesMap = ImmutableMap . < String , Class < ? > > builder ( ) ; InMemoryJarfile newCatalogJar ; JarLoader jarLoader ; String errorMsg ; try { newCatalogJar = new InMemoryJarfile ( catalogBytes ) ; jarLoader = newCatalogJar . getLoader ( ) ; for ( String classname : jar... |
public class ZoomSlider { /** * Update the list of scales to include only the list of usable scales ( from all possible scales ) . */
public void updateUsableScales ( ) { } } | Bbox bgBounds = backgroundPart . getBounds ( ) ; /* * First move background a little bit to right based on difference in width with the sliderUnit . */
int internalHorMargin = ( int ) ( sliderUnit . getBounds ( ) . getWidth ( ) - backgroundPart . getBounds ( ) . getWidth ( ) ) / 2 ; bgBounds . setX ( internalHorMargin ... |
public class DeviceProxy { public void command_inout_asynch ( String cmdname , DeviceData argin , CallBack cb ) throws DevFailed { } } | deviceProxyDAO . command_inout_asynch ( this , cmdname , argin , cb ) ; |
public class ResolvedDependenciesCache { /** * Convenience method around { @ link # resolve ( com . cloudbees . sdk . GAV ) } since most often
* the result is used to create a classloader , which wants URL [ ] . */
public URL [ ] resolveToURLs ( GAV gav ) throws IOException , RepositoryException { } } | List < URL > jars = new ArrayList < URL > ( ) ; for ( File f : resolve ( gav ) ) { jars . add ( f . toURI ( ) . toURL ( ) ) ; } return jars . toArray ( new URL [ jars . size ( ) ] ) ; |
public class FileUtil { /** * Recursively delete a directory .
* @ param fs { @ link FileSystem } on which the path is present
* @ param dir directory to recursively delete
* @ throws IOException
* @ deprecated Use { @ link FileSystem # delete ( Path , boolean ) } */
@ Deprecated public static void fullyDelete ... | fs . delete ( dir , true ) ; |
public class FEELParser { /** * Either namePart is a string of digits , or it must be a valid name itself */
public static boolean isVariableNamePartValid ( String namePart , Scope scope ) { } } | if ( DIGITS_PATTERN . matcher ( namePart ) . matches ( ) ) { return true ; } if ( REUSABLE_KEYWORDS . contains ( namePart ) ) { return scope . followUp ( namePart , true ) ; } return isVariableNameValid ( namePart ) ; |
public class Static { /** * Compares two objects . This method is careful about < code > null < / code > values .
* @ param thisObject One object
* @ param thatObject Other object
* @ return < code > true < / code > if the one object equals the other object ; < code > false < / code > otherwise */
public static b... | return thisObject == null ? thatObject == null : thisObject . equals ( thatObject ) ; |
public class ReflectionUtils { /** * Get all non static , non transient , fields of the passed in class , including
* private fields . Note , the special this $ field is also not returned . The result
* is cached in a static ConcurrentHashMap to benefit execution performance .
* @ param c Class instance
* @ ret... | if ( _reflectedFields . containsKey ( c ) ) { return _reflectedFields . get ( c ) ; } Collection < Field > fields = new ArrayList < > ( ) ; Class curr = c ; while ( curr != null ) { getDeclaredFields ( curr , fields ) ; curr = curr . getSuperclass ( ) ; } _reflectedFields . put ( c , fields ) ; return fields ; |
public class CmsFlexController { /** * Adds another flex request / response pair to the stack . < p >
* @ param req the request to add
* @ param res the response to add */
public void push ( CmsFlexRequest req , CmsFlexResponse res ) { } } | m_flexRequestList . add ( req ) ; m_flexResponseList . add ( res ) ; m_flexContextInfoList . add ( new CmsFlexRequestContextInfo ( ) ) ; updateRequestContextInfo ( ) ; |
public class EvaluateClustering { /** * Given an array summarizing selected measures , set the appropriate flag options */
protected void setMeasures ( boolean [ ] measures ) { } } | this . generalEvalOption . setValue ( measures [ 0 ] ) ; this . f1Option . setValue ( measures [ 1 ] ) ; this . entropyOption . setValue ( measures [ 2 ] ) ; this . cmmOption . setValue ( measures [ 3 ] ) ; this . ssqOption . setValue ( measures [ 4 ] ) ; this . separationOption . setValue ( measures [ 5 ] ) ; this . s... |
public class Slice { /** * Compare slice with other slice .
* Slice ordering :
* - Firstly ordered by start ( offset ) position .
* - Secondly ordered by reverse length ( longest slice first ) .
* Result is undefined of the two slices point to different byte buffers .
* @ param o The other slice .
* @ retur... | if ( o . off != off ) { return Integer . compare ( off , o . off ) ; } return Integer . compare ( o . len , len ) ; |
public class PairtreeUtils { /** * Maps the supplied ID to a Pairtree path using the supplied base path .
* @ param aID An ID to map to a Pairtree path
* @ param aBasePath The base path to use in the mapping
* @ param aEncapsulatedName The name of the encapsulating directory
* @ return The Pairtree path for the... | final String ptPath ; Objects . requireNonNull ( aID ) ; if ( aEncapsulatedName == null ) { ptPath = concat ( aBasePath , mapToPtPath ( aID ) ) ; } else { ptPath = concat ( aBasePath , mapToPtPath ( aID ) , encodeID ( aEncapsulatedName ) ) ; } return ptPath ; |
public class Resources { /** * Consolidates the information contained in multiple responses for the same path .
* Internally creates new resources . */
public void consolidateMultiplePaths ( ) { } } | Map < String , Set < ResourceMethod > > oldResources = resources ; resources = new HashMap < > ( ) ; oldResources . keySet ( ) . forEach ( s -> consolidateMultipleMethodsForSamePath ( s , oldResources . get ( s ) ) ) ; |
public class CmsDialogUploadButtonHandler { /** * Opens the upload dialog for the given file references . < p >
* @ param files the file references */
public void openDialogWithFiles ( List < CmsFileInfo > files ) { } } | if ( m_uploadDialog == null ) { try { m_uploadDialog = GWT . create ( CmsUploadDialogImpl . class ) ; I_CmsUploadContext context = m_contextFactory . get ( ) ; m_uploadDialog . setContext ( context ) ; updateDialog ( ) ; if ( m_button != null ) { // the current upload button is located outside the dialog , reinitialize... |
public class SibRaDestinationSession { /** * Closes this session . Delegates .
* @ throws SIErrorException
* if the delegation fails
* @ throws SIResourceException
* if the delegation fails
* @ throws SIConnectionLostException
* if the delegation fails */
public void close ( ) throws SIConnectionLostExcepti... | final String methodName = "close" ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } _delegateSession . close ( ) ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } |
public class Completable { /** * Returns a Completable which calls the given onEvent callback with the ( throwable ) for an onError
* or ( null ) for an onComplete signal from this Completable before delivering said signal to the downstream .
* < img width = " 640 " height = " 305 " src = " https : / / raw . github... | ObjectHelper . requireNonNull ( onEvent , "onEvent is null" ) ; return RxJavaPlugins . onAssembly ( new CompletableDoOnEvent ( this , onEvent ) ) ; |
public class ServerView { /** * / * @ inheritDoc */
public void inputChanged ( final Viewer viewer , Object oldInput , Object newInput ) { } } | if ( oldInput == CONTENT_ROOT ) ServerRegistry . getInstance ( ) . removeListener ( this ) ; if ( newInput == CONTENT_ROOT ) ServerRegistry . getInstance ( ) . addListener ( this ) ; |
public class DisposalMethod { /** * A disposer method is bound to a producer if the producer is assignable to the disposed parameter .
* @ param enhancedDisposedParameter
* @ return the set of required qualifiers for the given disposed parameter */
private Set < QualifierInstance > getRequiredQualifiers ( EnhancedA... | Set < Annotation > disposedParameterQualifiers = enhancedDisposedParameter . getMetaAnnotations ( Qualifier . class ) ; if ( disposedParameterQualifiers . isEmpty ( ) ) { disposedParameterQualifiers = Collections . < Annotation > singleton ( Default . Literal . INSTANCE ) ; } return beanManager . getServices ( ) . get ... |
public class UpdateCsvClassifierRequest { /** * A list of strings representing column names .
* @ param header
* A list of strings representing column names . */
public void setHeader ( java . util . Collection < String > header ) { } } | if ( header == null ) { this . header = null ; return ; } this . header = new java . util . ArrayList < String > ( header ) ; |
public class JCasUtil2 { /** * Same as { @ linkplain org . apache . uima . fit . util . JCasUtil # select ( org . apache . uima . jcas . cas . FSArray , Class ) }
* but works across all views in jcas .
* @ param jCas jcas
* @ param type desired type
* @ return collection of annotations */
public static < T exte... | Collection < T > result = new ArrayList < T > ( ) ; try { Iterator < JCas > viewIterator = jCas . getViewIterator ( ) ; while ( viewIterator . hasNext ( ) ) { JCas next = viewIterator . next ( ) ; result . addAll ( JCasUtil . select ( next , type ) ) ; } return result ; } catch ( CASException ex ) { throw new RuntimeEx... |
public class KerberosAuthenticator { /** * Creates the Hadoop authentication HTTP cookie .
* @ param resp the response object .
* @ param token authentication token for the cookie .
* @ param domain the cookie domain .
* @ param path the cookie path .
* @ param expires UNIX timestamp that indicates the expire... | resp . addHeader ( "Set-Cookie" , tokenToCookieString ( token , domain , path , expires , isCookiePersistent , isSecure ) ) ; |
public class RaftContext { /** * Sets the state term .
* @ param term The state term . */
public void setTerm ( long term ) { } } | if ( term > this . term ) { this . term = term ; this . leader = null ; this . lastVotedFor = null ; meta . storeTerm ( this . term ) ; meta . storeVote ( this . lastVotedFor ) ; log . debug ( "Set term {}" , term ) ; } |
public class MultipartProcessor { /** * Adds a file field to the multipart message , but takes in an InputStream instead of
* just a file to read bytes from .
* @ param name Field name
* @ param fileName Name of the " file " being uploaded .
* @ param inputStream Stream of bytes to use in place of a file .
* ... | writer . append ( "--" ) . append ( boundary ) . append ( LINE_BREAK ) ; writer . append ( "Content-Disposition: form-data; name=\"" ) . append ( name ) . append ( "\"; filename=\"" ) . append ( fileName ) . append ( "\"" ) . append ( LINE_BREAK ) ; String probableContentType = URLConnection . guessContentTypeFromName ... |
public class SameDiff { /** * Adds outgoing arguments to the graph for the specified DifferentialFunction
* Also checks for input arguments and updates the graph adding an appropriate edge when the full graph is declared .
* @ param variables Variables - arguments for the specified differential function
* @ param... | String [ ] varNames = new String [ variables . length ] ; for ( int i = 0 ; i < varNames . length ; i ++ ) { varNames [ i ] = variables [ i ] . getVarName ( ) ; } addOutgoingFor ( varNames , function ) ; |
public class BatchGetItemOutcome { /** * Returns a map of table name to the list of retrieved items */
public Map < String , List < Item > > getTableItems ( ) { } } | Map < String , List < Map < String , AttributeValue > > > res = result . getResponses ( ) ; Map < String , List < Item > > map = new LinkedHashMap < String , List < Item > > ( res . size ( ) ) ; for ( Map . Entry < String , List < Map < String , AttributeValue > > > e : res . entrySet ( ) ) { String tableName = e . get... |
public class TcpResources { /** * Safely check if existing resource exist and proceed to update / cleanup if new
* resources references are passed .
* @ param ref the resources atomic reference
* @ param loops the eventual new { @ link LoopResources }
* @ param provider the eventual new { @ link ConnectionProvi... | T update ; for ( ; ; ) { T resources = ref . get ( ) ; if ( resources == null || loops != null || provider != null ) { update = create ( resources , loops , provider , name , onNew ) ; if ( ref . compareAndSet ( resources , update ) ) { if ( resources != null ) { if ( loops != null ) { if ( log . isWarnEnabled ( ) ) { ... |
public class AbstractPacketOutputStream { /** * Buffer growing use 4 size only to avoid creating / copying that are expensive operations .
* possible size
* < ol >
* < li > SMALL _ BUFFER _ SIZE = 8k ( default ) < / li >
* < li > MEDIUM _ BUFFER _ SIZE = 128k < / li >
* < li > LARGE _ BUFFER _ SIZE = 1M < / l... | int bufferLength = buf . length ; int newCapacity ; if ( bufferLength == SMALL_BUFFER_SIZE ) { if ( len + pos < MEDIUM_BUFFER_SIZE ) { newCapacity = MEDIUM_BUFFER_SIZE ; } else if ( len + pos < LARGE_BUFFER_SIZE ) { newCapacity = LARGE_BUFFER_SIZE ; } else { newCapacity = getMaxPacketLength ( ) ; } } else if ( bufferLe... |
public class ChangeFocusOnChangeHandler { /** * Set this cloned listener to the same state at this listener .
* @ param field The field this new listener will be added to .
* @ param The new listener to sync to this .
* @ param Has the init method been called ?
* @ return True if I called init . */
public boole... | if ( ! bInitCalled ) ( ( ChangeFocusOnChangeHandler ) listener ) . init ( null , m_screenField , m_fldTarget ) ; bInitCalled = super . syncClonedListener ( field , listener , true ) ; ( ( ChangeFocusOnChangeHandler ) listener ) . setChangeFocusIfNull ( m_bChangeIfNull ) ; return bInitCalled ; |
public class ElasticSearchResponseStore { /** * { @ inheritDoc } */
@ Override public void addResponse ( Response response ) { } } | logger . warn ( "Security response " + response . getAction ( ) + " triggered for user: " + response . getUser ( ) . getUsername ( ) ) ; try { responseRepository . save ( response ) ; } catch ( JsonProcessingException e ) { throw new RuntimeException ( e ) ; } super . notifyListeners ( response ) ; |
public class ExecutionContext { /** * Creates an OrFuture that is already completed with a { @ link Good } .
* @ param good the success value
* @ param < G > the success type
* @ return an instance of OrFuture */
public < G , B > OrFuture < G , B > goodFuture ( G good ) { } } | return this . < G , B > promise ( ) . success ( good ) . future ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.