signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class I18nRuntimeException { /** * Constructs our I18n exception message using the supplied bundle name .
* @ param aBundleName A name of a bundle in which to look up the supplied key .
* @ param aMessageKey A key value to look up in the < code > ResourceBundle < / code > .
* @ param aVarargs Additional de... | return format ( null , aBundleName , aMessageKey , aVarargs ) ; |
public class AbstractAsymmetricCrypto { /** * 编码为Base64字符串 , 使用UTF - 8编码
* @ param data 被加密的字符串
* @ param keyType 私钥或公钥 { @ link KeyType }
* @ return Base64字符串
* @ since 4.0.1 */
public String encryptBase64 ( String data , KeyType keyType ) { } } | return Base64 . encode ( encrypt ( data , keyType ) ) ; |
public class ResultDescriptor { /** * Returns the set of unique source names ; The names of the underlying samples used as the
* source of aggregations .
* @ return source names */
public Set < String > getSourceNames ( ) { } } | return Sets . newHashSet ( Iterables . transform ( getDatasources ( ) . values ( ) , new Function < Datasource , String > ( ) { @ Override public String apply ( Datasource input ) { return input . getSource ( ) ; } } ) ) ; |
public class MetadataManager { /** * Merge the given { @ link org . apache . ojb . broker . metadata . DescriptorRepository }
* files , the source objects will be pushed to the target repository . If parameter
* < tt > deep < / tt > is set < code > true < / code > deep copies of source objects were made .
* < br ... | Iterator it = sourceRepository . iterator ( ) ; while ( it . hasNext ( ) ) { ClassDescriptor cld = ( ClassDescriptor ) it . next ( ) ; if ( deep ) { // TODO : adopt copy / clone methods for metadata classes ?
cld = ( ClassDescriptor ) SerializationUtils . clone ( cld ) ; } targetRepository . put ( cld . getClassOfObjec... |
public class AWSServiceCatalogClient { /** * Gets information about the specified constraint .
* @ param describeConstraintRequest
* @ return Result of the DescribeConstraint operation returned by the service .
* @ throws ResourceNotFoundException
* The specified resource was not found .
* @ sample AWSService... | request = beforeClientExecution ( request ) ; return executeDescribeConstraint ( request ) ; |
public class ConstantFlowRegulator { /** * Wrap the given service call with the { @ link ConstantFlowRegulator }
* protection logic .
* @ param c the { @ link Callable } to attempt
* @ return whatever c would return on success
* @ throws FlowRateExceededException if the total requests per second
* through the... | if ( canProceed ( ) ) { return c . call ( ) ; } else { throw mapException ( new FlowRateExceededException ( ) ) ; } |
public class CmsHistoryList { /** * Restores a backed up resource version . < p >
* @ throws CmsException if something goes wrong */
protected void performRestoreOperation ( ) throws CmsException { } } | CmsUUID structureId = new CmsUUID ( getSelectedItem ( ) . get ( LIST_COLUMN_STRUCTURE_ID ) . toString ( ) ) ; int version = Integer . parseInt ( getSelectedItems ( ) . get ( 0 ) . getId ( ) ) ; if ( version == CmsHistoryResourceHandler . PROJECT_OFFLINE_VERSION ) { // it is not possible to restore the offline version
r... |
public class AbstractBootstrap { /** * the { @ link ChannelHandler } to use for serving the requests . */
public B handler ( ChannelHandler handler ) { } } | if ( handler == null ) { throw new NullPointerException ( "handler" ) ; } this . handler = handler ; return self ( ) ; |
public class MappingUtils { /** * Checks is value is of Primitive type
* @ param value value which would be checked
* @ return true - if value is primitive ( or it ' s wrapper ) type */
public static boolean isPrimitive ( Object value ) { } } | if ( value == null ) { return true ; } else if ( value . getClass ( ) . isPrimitive ( ) == true ) { return true ; } else if ( Integer . class . isInstance ( value ) ) { return true ; } else if ( Long . class . isInstance ( value ) ) { return true ; } else if ( Double . class . isInstance ( value ) ) { return true ; } e... |
public class ExceptionSet { /** * Get the least ( lowest in the lattice ) common supertype of the exceptions
* in the set . Returns the special TOP type if the set is empty . */
public Type getCommonSupertype ( ) throws ClassNotFoundException { } } | if ( commonSupertype != null ) { return commonSupertype ; } if ( isEmpty ( ) ) { // This probably means that we ' re looking at an
// infeasible exception path .
return TypeFrame . getTopType ( ) ; } // Compute first common superclass
ThrownExceptionIterator i = iterator ( ) ; ReferenceType result = i . next ( ) ; whil... |
public class AuthorizerDescriptionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AuthorizerDescription authorizerDescription , ProtocolMarshaller protocolMarshaller ) { } } | if ( authorizerDescription == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( authorizerDescription . getAuthorizerName ( ) , AUTHORIZERNAME_BINDING ) ; protocolMarshaller . marshall ( authorizerDescription . getAuthorizerArn ( ) , AUTHORIZE... |
public class EventEngineImpl { /** * { @ inheritDoc } */
@ Override public EventHandle postEvent ( Topic topic , Map < ? , ? > properties ) { } } | return postEvent ( topic , properties , null ) ; |
public class PluginClassLoader { /** * By default , it uses a child first delegation model rather than the standard parent first .
* If the requested class cannot be found in this class loader , the parent class loader will be consulted
* via the standard { @ link ClassLoader # loadClass ( String ) } mechanism .
... | synchronized ( getClassLoadingLock ( className ) ) { // first check whether it ' s a system class , delegate to the system loader
if ( className . startsWith ( JAVA_PACKAGE_PREFIX ) ) { return findSystemClass ( className ) ; } // if the class is part of the plugin engine use parent class loader
if ( className . startsW... |
public class MoreCollectors { /** * Returns a { @ code Collector } which collects at most specified number of
* the first stream elements into the { @ link List } .
* This method returns a
* < a href = " package - summary . html # ShortCircuitReduction " > short - circuiting
* collector < / a > .
* There are ... | if ( n <= 0 ) return empty ( ) ; return new CancellableCollectorImpl < > ( ArrayList :: new , ( acc , t ) -> { if ( acc . size ( ) < n ) acc . add ( t ) ; } , ( acc1 , acc2 ) -> { acc1 . addAll ( acc2 . subList ( 0 , Math . min ( acc2 . size ( ) , n - acc1 . size ( ) ) ) ) ; return acc1 ; } , Function . identity ( ) , ... |
public class Unmarshaller { /** * Initializes the Embedded object represented by the given metadata .
* @ param embeddedMetadata
* the metadata of the embedded field
* @ param target
* the object in which the embedded field is declared / accessible from
* @ return the initialized object
* @ throws EntityMan... | try { ConstructorMetadata constructorMetadata = embeddedMetadata . getConstructorMetadata ( ) ; Object embeddedObject = null ; if ( constructorMetadata . isClassicConstructionStrategy ( ) ) { embeddedObject = embeddedMetadata . getReadMethod ( ) . invoke ( target ) ; } if ( embeddedObject == null ) { embeddedObject = c... |
public class StringUtils { /** * Normalize to canonical form .
* @ param input the input string
* @ return the normalized string */
public static String toCanonicalForm ( CharSequence input ) { } } | if ( input == null ) { return null ; } return StringFunctions . CANONICAL_NORMALIZATION . apply ( input . toString ( ) ) ; |
public class NodeSchema { /** * names are the same . Don ' t worry about the differentiator field . */
public boolean equalsOnlyNames ( NodeSchema otherSchema ) { } } | if ( otherSchema == null ) { return false ; } if ( otherSchema . size ( ) != size ( ) ) { return false ; } for ( int colIndex = 0 ; colIndex < size ( ) ; colIndex ++ ) { SchemaColumn col1 = otherSchema . getColumn ( colIndex ) ; SchemaColumn col2 = m_columns . get ( colIndex ) ; if ( col1 . compareNames ( col2 ) != 0 )... |
public class CacheStatisticCollector { /** * Dumps all the cache statistic values to a { @ link StringBuilder } */
public final void dumpTo ( StringBuilder builder ) { } } | StringWriter stringWriter = new StringWriter ( ) ; globalContainer . dumpTo ( new PrintWriter ( stringWriter ) ) ; builder . append ( stringWriter . getBuffer ( ) ) ; |
public class WriterFactoryImpl { /** * { @ inheritDoc } */
public ProfilePackageSummaryWriter getProfilePackageSummaryWriter ( PackageDoc packageDoc , PackageDoc prevPkg , PackageDoc nextPkg , Profile profile ) throws Exception { } } | return new ProfilePackageWriterImpl ( configuration , packageDoc , prevPkg , nextPkg , profile ) ; |
public class DescribeCacheEngineVersionsResult { /** * A list of cache engine version details . Each element in the list contains detailed information about one cache
* engine version .
* @ param cacheEngineVersions
* A list of cache engine version details . Each element in the list contains detailed information ... | if ( cacheEngineVersions == null ) { this . cacheEngineVersions = null ; return ; } this . cacheEngineVersions = new com . amazonaws . internal . SdkInternalList < CacheEngineVersion > ( cacheEngineVersions ) ; |
public class DropwizardClusterStatsCollector { /** * protected access for testing purposes */
protected String getName ( final String key ) { } } | return MetricRegistry . name ( DropwizardClusterStatsCollector . class , "cluster" , clusterId . applicationName , clusterId . clusterName , key ) ; |
public class SVGAndroidRenderer { /** * Render dispatcher */
private void render ( SVG . SvgObject obj ) { } } | if ( obj instanceof NotDirectlyRendered ) return ; // Save state
statePush ( ) ; checkXMLSpaceAttribute ( obj ) ; if ( obj instanceof SVG . Svg ) { render ( ( SVG . Svg ) obj ) ; } else if ( obj instanceof SVG . Use ) { render ( ( SVG . Use ) obj ) ; } else if ( obj instanceof SVG . Switch ) { render ( ( SVG . Switch )... |
public class OcrClient { /** * Gets the idcard recognition properties of specific image resource .
* The caller < i > must < / i > authenticate with a valid BCE Access Key / Private Key pair .
* @ param image The image data which needs to be base64
* @ param side The side of idcard image . ( front / back )
* @ ... | IdcardRecognitionRequest request = new IdcardRecognitionRequest ( ) . withImage ( image ) . withSide ( side ) . withDirection ( direction ) ; return idcardRecognition ( request ) ; |
public class MessageReceiverFilterList { /** * Remove all the filters that have this as a listener .
* @ param listener Filters with this listener will be removed ( pass null to free them all ) . */
public void freeFiltersWithListener ( JMessageListener listener ) { } } | Object [ ] rgFilter = m_mapFilters . values ( ) . toArray ( ) ; for ( int i = 0 ; i < rgFilter . length ; i ++ ) { BaseMessageFilter filter = ( BaseMessageFilter ) rgFilter [ i ] ; for ( int j = 0 ; ( filter . getMessageListener ( j ) != null ) ; j ++ ) { if ( ( filter . getMessageListener ( j ) == listener ) || ( list... |
public class AsyncMutateInBuilder { /** * Set insertDocument to true , if the document has to be created only if it does not exist
* @ param insertDocument true to insert document . */
@ InterfaceStability . Committed public AsyncMutateInBuilder insertDocument ( boolean insertDocument ) { } } | if ( this . upsertDocument && insertDocument ) { throw new IllegalArgumentException ( "Cannot set both upsertDocument and insertDocument to true" ) ; } this . insertDocument = insertDocument ; return this ; |
public class UpgradeManagerDatanode { /** * Start distributed upgrade .
* Instantiates distributed upgrade objects .
* @ return true if distributed upgrade is required or false otherwise
* @ throws IOException */
public synchronized boolean startUpgrade ( ) throws IOException { } } | if ( upgradeState ) { // upgrade is already in progress
assert currentUpgrades != null : "UpgradeManagerDatanode.currentUpgrades is null." ; UpgradeObjectDatanode curUO = ( UpgradeObjectDatanode ) currentUpgrades . first ( ) ; curUO . startUpgrade ( ) ; return true ; } if ( broadcastCommand != null ) { if ( broadcastCo... |
public class GraphAnalysisLoader { /** * Resolves the given class name into a { @ link TypeElement } . The class name is a binary name , but
* { @ link Elements # getTypeElement ( CharSequence ) } wants a canonical name . So this method searches
* the space of possible canonical names , starting with the most likel... | int index = nextDollar ( className , className , 0 ) ; if ( index == - 1 ) { return getTypeElement ( elements , className ) ; } // have to test various possibilities of replacing ' $ ' with ' . ' since ' . ' in a canonical name
// of a nested type is replaced with ' $ ' in the binary name .
StringBuilder sb = new Strin... |
public class GrouperEntityGroupStoreFactory { /** * Construction with parameters .
* @ param svcDescriptor The parameters .
* @ return The instance .
* @ throws GroupsException if there is an error
* @ see IEntityGroupStoreFactory
* # newGroupStore ( org . apereo . portal . groups . ComponentGroupServiceDescr... | if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Creating New Grouper IEntityGroupStore" ) ; } return getGroupStore ( ) ; |
public class TmdbEpisodes { /** * Get the primary information about a TV episode by combination of a season
* and episode number .
* @ param tvID
* @ param seasonNumber
* @ param episodeNumber
* @ param language
* @ param appendToResponse
* @ return
* @ throws MovieDbException */
public TVEpisodeInfo ge... | TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , tvID ) ; parameters . add ( Param . SEASON_NUMBER , seasonNumber ) ; parameters . add ( Param . EPISODE_NUMBER , episodeNumber ) ; parameters . add ( Param . LANGUAGE , language ) ; parameters . add ( Param . APPEND , appendToResponse ... |
public class EJBMDOrchestrator { /** * F743-506 */
private void processAutomaticTimerMetaData ( BeanMetaData bmd ) throws EJBConfigurationException , ContainerException { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "processAutomaticTimerMetaData: " + bmd . j2eeName ) ; // There are several considerations for how to obtain this metadata :
// 1 . Schedule / Schedules annotations can exist on super class... |
public class DnsNameResolver { /** * Sends a DNS query with the specified question with additional records . */
public Future < AddressedEnvelope < DnsResponse , InetSocketAddress > > query ( DnsQuestion question , Iterable < DnsRecord > additionals ) { } } | return query ( nextNameServerAddress ( ) , question , additionals ) ; |
public class ExecutionEntity { /** * scopes / / / / / */
@ Override @ SuppressWarnings ( "unchecked" ) public void initialize ( ) { } } | LOG . initializeExecution ( this ) ; ScopeImpl scope = getScopeActivity ( ) ; ensureParentInitialized ( ) ; List < VariableDeclaration > variableDeclarations = ( List < VariableDeclaration > ) scope . getProperty ( BpmnParse . PROPERTYNAME_VARIABLE_DECLARATIONS ) ; if ( variableDeclarations != null ) { for ( VariableDe... |
public class SQLiteConnectionPool { /** * Might throw . */
private SQLiteConnection waitForConnection ( String sql , int connectionFlags , CancellationSignal cancellationSignal ) { } } | final boolean wantPrimaryConnection = ( connectionFlags & CONNECTION_FLAG_PRIMARY_CONNECTION_AFFINITY ) != 0 ; final ConnectionWaiter waiter ; final int nonce ; synchronized ( mLock ) { throwIfClosedLocked ( ) ; // Abort if canceled .
if ( cancellationSignal != null ) { cancellationSignal . throwIfCanceled ( ) ; } // T... |
public class VertxServerHttpExchange { /** * { @ link HttpServerRequest } is available . */
@ Override public < T > T unwrap ( Class < T > clazz ) { } } | return HttpServerRequest . class . isAssignableFrom ( clazz ) ? clazz . cast ( request ) : null ; |
public class AbstractManagedServiceFactory { protected static String getProperty ( String name , Dictionary < String , ? > configProperties ) throws ConfigurationException { } } | return getProperty ( name , true , configProperties ) ; |
public class JDBCResourceMBeanImpl { /** * ( non - Javadoc )
* @ see com . ibm . websphere . management . j2ee . JDBCResourceMBean # getjdbcDataSources ( ) */
@ Override public String [ ] getjdbcDataSources ( ) { } } | final String methodName = "getjdbcDataSources()" ; final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( tc , methodName , this ) ; final Collection < JDBCDataSourceMBeanImpl > c = dataSourceMBeanChildrenList . values ( ) ; final int size = c . size ( ) ; ... |
public class QualitygatesService { /** * This is part of the internal API .
* This is a POST request .
* @ see < a href = " https : / / next . sonarqube . com / sonarqube / web _ api / api / qualitygates / destroy " > Further information about this action online ( including a response example ) < / a >
* @ since ... | call ( new PostRequest ( path ( "destroy" ) ) . setParam ( "id" , request . getId ( ) ) . setParam ( "organization" , request . getOrganization ( ) ) . setMediaType ( MediaTypes . JSON ) ) . content ( ) ; |
public class ResourceLoader { /** * Load the global ConformanceConfig */
public static ConformanceConfig loadGlobalConformance ( Class < ? > clazz ) { } } | ConformanceConfig . Builder builder = ConformanceConfig . newBuilder ( ) ; if ( resourceExists ( clazz , "global_conformance.binarypb" ) ) { try { builder . mergeFrom ( clazz . getResourceAsStream ( "global_conformance.binarypb" ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return builder . b... |
public class WindowUtil { /** * Returns the vertical scroll position needed to place the specified target widget in view ,
* while trying to minimize scrolling . */
public static int getScrollIntoView ( Widget target ) { } } | int top = Window . getScrollTop ( ) , height = Window . getClientHeight ( ) ; int ttop = target . getAbsoluteTop ( ) , theight = target . getOffsetHeight ( ) ; // if the target widget is taller than the browser window , or is above the current scroll
// position of the browser window , scroll the top of the widget to t... |
public class MmtfUtils { /** * Count the total number of groups in the structure
* @ param structure the input structure
* @ return the total number of groups */
public static int getNumGroups ( Structure structure ) { } } | int count = 0 ; for ( int i = 0 ; i < structure . nrModels ( ) ; i ++ ) { for ( Chain chain : structure . getChains ( i ) ) { count += chain . getAtomGroups ( ) . size ( ) ; } } return count ; |
public class AstaDatabaseFileReader { /** * Extract a list of time entries .
* @ param shiftData string representation of time entries
* @ return list of time entry rows */
private List < Row > createTimeEntryRowList ( String shiftData ) throws ParseException { } } | List < Row > list = new ArrayList < Row > ( ) ; String [ ] shifts = shiftData . split ( ",|:" ) ; int index = 1 ; while ( index < shifts . length ) { index += 2 ; int entryCount = Integer . parseInt ( shifts [ index ] ) ; index ++ ; for ( int entryIndex = 0 ; entryIndex < entryCount ; entryIndex ++ ) { Integer exceptio... |
public class FormBuilder { /** * Append a field to the form .
* @ param key The form key , which must be URLEncoded before calling this method .
* @ param value The value associated with the key . The value will be URLEncoded by this method . */
public void appendField ( final String key , final String value ) { } ... | if ( builder . length ( ) > 0 ) { builder . append ( "&" ) ; } try { builder . append ( key ) . append ( "=" ) . append ( URLEncoder . encode ( value , "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { throw new AssertionError ( "UTF-8 encoding should always be available." ) ; } |
public class FileUtil { /** * 读取文件的每行内容到List < String > .
* @ see { @ link Files # readAllLines } */
public static List < String > toLines ( final File file ) throws IOException { } } | return Files . readAllLines ( file . toPath ( ) , Charsets . UTF_8 ) ; |
public class ConfigurationValidation { /** * Check configuration errors */
public List < String > getConfigurationErrors ( boolean projectPerFolder , String configProjectToken , String configProjectName , String configApiToken , String configFilePath , int archiveDepth , String [ ] includes , String [ ] projectPerFolde... | List < String > errors = new ArrayList < > ( ) ; String [ ] requirements = pythonIncludes [ Constants . ZERO ] . split ( Constants . WHITESPACE ) ; if ( StringUtils . isBlank ( configApiToken ) ) { String error = "Could not retrieve " + ORG_TOKEN_PROPERTY_KEY + " property from " + configFilePath ; errors . add ( error ... |
public class Solo { /** * Get the location of a view on the screen
* @ param view - string reference to the view
* @ return - int array ( x , y ) of the view location
* @ throws Exception */
public static int [ ] getLocationOnScreen ( String view ) throws Exception { } } | int [ ] location = new int [ 2 ] ; JSONArray results = Client . getInstance ( ) . map ( Constants . ROBOTIUM_SOLO , "getLocationOnScreen" , view ) ; location [ 0 ] = results . getInt ( 0 ) ; location [ 1 ] = results . getInt ( 1 ) ; return location ; |
public class RetryableResource { /** * Recover exchange bindings using the { @ code channelSupplier } . */
void recoverExchangeBindings ( Iterable < Binding > exchangeBindings ) throws Exception { } } | if ( exchangeBindings != null ) synchronized ( exchangeBindings ) { for ( Binding binding : exchangeBindings ) try { log . info ( "Recovering exchange binding from {} to {} with {} via {}" , binding . source , binding . destination , binding . routingKey , this ) ; getRecoveryChannel ( ) . exchangeBind ( binding . dest... |
public class ServiceRefTypeImpl { /** * If not already created , a new < code > handler - chains < / code > element with the given value will be created .
* Otherwise , the existing < code > handler - chains < / code > element will be returned .
* @ return a new or existing instance of < code > HandlerChainsType < ... | Node node = childNode . getOrCreate ( "handler-chains" ) ; HandlerChainsType < ServiceRefType < T > > handlerChains = new HandlerChainsTypeImpl < ServiceRefType < T > > ( this , "handler-chains" , childNode , node ) ; return handlerChains ; |
public class SessionAttributeInitializingFilter { /** * Puts all pre - configured attributes into the actual session attribute
* map and forward the event to the next filter . */
@ Override public void sessionCreated ( NextFilter nextFilter , IoSession session ) throws Exception { } } | for ( Map . Entry < String , Object > e : attributes . entrySet ( ) ) { session . setAttribute ( e . getKey ( ) , e . getValue ( ) ) ; } nextFilter . sessionCreated ( session ) ; |
public class Insert { /** * { @ inheritDoc } */
@ Override public void execute ( ) throws EFapsException { } } | final boolean hasAccess = getType ( ) . hasAccess ( Instance . get ( getType ( ) , 0 ) , AccessTypeEnums . CREATE . getAccessType ( ) , getNewValuesMap ( ) ) ; if ( ! hasAccess ) { Insert . LOG . error ( "Insert not permitted for Person: {} on Type: {}" , Context . getThreadContext ( ) . getPerson ( ) , getType ( ) ) ;... |
public class SignerWithChooserByPrivateKeyIdImpl { /** * Signs a message .
* @ param privateKeyId the logical name of the private key as configured in
* the private key map
* @ param message the message to sign
* @ return the signature
* @ see # setPrivateKeyMap ( java . util . Map ) */
public byte [ ] sign (... | Signer signer = cache . get ( privateKeyId ) ; if ( signer != null ) { return signer . sign ( message ) ; } SignerImpl signerImpl = new SignerImpl ( ) ; PrivateKey privateKey = privateKeyMap . get ( privateKeyId ) ; if ( privateKey == null ) { throw new SignatureException ( "private key not found: privateKeyId=" + priv... |
public class CmsDateBox { /** * Validates the time and prints out an error message if the time format is incorrect . < p > */
private void checkTime ( ) { } } | if ( ! isValidTime ( ) ) { m_time . setErrorMessageWidth ( ( m_popup . getOffsetWidth ( ) - 32 ) + Unit . PX . toString ( ) ) ; m_time . setErrorMessage ( Messages . get ( ) . key ( Messages . ERR_DATEBOX_INVALID_TIME_FORMAT_0 ) ) ; } else { m_time . setErrorMessage ( null ) ; } updateCloseBehavior ( ) ; |
public class service { /** * Use this API to add service resources . */
public static base_responses add ( nitro_service client , service resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { service addresources [ ] = new service [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { addresources [ i ] = new service ( ) ; addresources [ i ] . name = resources [ i ] . name ; addresources [ i ] . ip = re... |
public class OjbTagsHandler { /** * Sets the current collection definition derived from the current member , and optionally some attributes .
* @ param template The template
* @ param attributes The attributes of the tag
* @ exception XDocletException If an error occurs
* @ doc . tag type = " block "
* @ doc ... | String name = OjbMemberTagsHandler . getMemberName ( ) ; CollectionDescriptorDef collDef = _curClassDef . getCollection ( name ) ; String attrName ; if ( collDef == null ) { collDef = new CollectionDescriptorDef ( name ) ; _curClassDef . addCollection ( collDef ) ; } LogHelper . debug ( false , OjbTagsHandler . class ,... |
public class IpcLogEntry { /** * Set the exception that was thrown while trying to execute the request . This will be
* logged and can be used to fill in the error reason . */
public IpcLogEntry withException ( Throwable exception ) { } } | this . exception = exception ; if ( statusDetail == null ) { statusDetail = exception . getClass ( ) . getSimpleName ( ) ; } if ( status == null ) { status = IpcStatus . forException ( exception ) ; } return this ; |
public class Expressions { /** * Get the intersection of the given Boolean expressions
* @ param exprs predicates
* @ return intersection of predicates */
public static BooleanExpression allOf ( BooleanExpression ... exprs ) { } } | BooleanExpression rv = null ; for ( BooleanExpression b : exprs ) { rv = rv == null ? b : rv . and ( b ) ; } return rv ; |
public class HttpMethodBase { /** * Gets the response header associated with the given name . Header name
* matching is case insensitive . < tt > null < / tt > will be returned if either
* < i > headerName < / i > is < tt > null < / tt > or there is no matching header for
* < i > headerName < / i > .
* @ param ... | if ( headerName == null ) { return null ; } else { return getResponseHeaderGroup ( ) . getCondensedHeader ( headerName ) ; } |
public class TypeHandlerUtils { /** * Converts array of Object into sql . Array
* @ param conn connection for which sql . Array object would be created
* @ param array array of objects
* @ return sql . Array from array of Object
* @ throws SQLException */
public static Object convertArray ( Connection conn , Ob... | Object result = null ; result = createArrayOf ( conn , convertJavaClassToSqlType ( array . getClass ( ) . getComponentType ( ) . getSimpleName ( ) ) , array ) ; return result ; |
public class JaxWsDDHelper { /** * Get the PortComponent by ejb - link .
* @ param ejbLink
* @ param containerToAdapt
* @ return
* @ throws UnableToAdaptException */
static PortComponent getPortComponentByEJBLink ( String ejbLink , Adaptable containerToAdapt ) throws UnableToAdaptException { } } | return getHighLevelElementByServiceImplBean ( ejbLink , containerToAdapt , PortComponent . class , LinkType . EJB ) ; |
public class FileUtil { /** * Check if the file is well formatted regarding an extension prefix .
* Check also if the file doesn ' t exist .
* @ param file
* @ param prefix
* @ return
* @ throws SQLException
* @ throws java . io . FileNotFoundException */
public static boolean isFileImportable ( File file ,... | if ( isExtensionWellFormated ( file , prefix ) ) { if ( file . exists ( ) ) { return true ; } else { throw new FileNotFoundException ( "The following file does not exists:\n" + file . getPath ( ) ) ; } } else { throw new SQLException ( "Please use " + prefix + " extension." ) ; } |
public class NormalizedWord2VecModel { /** * Normalizes the vectors in this model */
private void normalize ( ) { } } | for ( int i = 0 ; i < vocab . size ( ) ; ++ i ) { double len = 0 ; for ( int j = i * layerSize ; j < ( i + 1 ) * layerSize ; ++ j ) len += vectors . get ( j ) * vectors . get ( j ) ; len = Math . sqrt ( len ) ; for ( int j = i * layerSize ; j < ( i + 1 ) * layerSize ; ++ j ) vectors . put ( j , vectors . get ( j ) / le... |
public class Main { /** * Processes listed classes given a JDK 9 home . */
boolean processJdk9 ( String jdkHome , Collection < String > classes ) throws IOException { } } | systemModules . add ( new File ( jdkHome ) ) ; return doClassNames ( classes ) ; |
public class QueryParametersLazyList { /** * Silently closes supplied result set
* @ param rs result set which should be closed */
private void closeResultSet ( ResultSet rs ) { } } | if ( closedResultSet . contains ( rs ) == false ) { MjdbcUtils . closeQuietly ( rs ) ; closedResultSet . add ( rs ) ; } |
public class RedisStrHashMap { /** * 查看缓存hash是否包含某个key
* @ param field
* @ return */
public boolean containsKey ( String field ) { } } | try { return getJedisCommands ( groupName ) . hexists ( key , field ) ; } finally { getJedisProvider ( groupName ) . release ( ) ; } |
public class Predicate { /** * Complete AND operation . Similar to { @ link # AND } but no
* short - circuit : in all situations , < code > a < / code > is evaluated
* and next < code > b < / code > is evaluated . Good for impure
* predicates . */
public static < T > Predicate < T > FULL_AND ( final Predicate < T... | return new Predicate < T > ( ) { public boolean check ( T obj ) { return a . check ( obj ) & b . check ( obj ) ; } } ; |
public class CmsHelpNavigationListView { /** * Returns a String of spaces . < p >
* @ param n the count of spaces
* @ return a String of spaces */
private static String getSpaces ( int n ) { } } | // avoid negative NegativeArraySizeException in case uri is missing
n = Math . max ( n , 0 ) ; StringBuffer result = new StringBuffer ( n ) ; for ( ; n > 0 ; n -- ) { result . append ( ' ' ) ; } return result . toString ( ) ; |
public class LastSplitsCallback { /** * When a Splits is stopped , it is added to the stopwatch a Last Splits attribute . */
@ Override public void onStopwatchStop ( Split split , StopwatchSample sample ) { } } | LastSplits lastSplits = getLastSplits ( split . getStopwatch ( ) ) ; lastSplits . add ( split ) ; lastSplits . log ( split ) ; |
public class FunctionTypeBuilder { /** * Infers the type of { @ code this } .
* @ param info The JSDocInfo for this function . */
FunctionTypeBuilder inferThisType ( JSDocInfo info ) { } } | if ( info != null && info . hasThisType ( ) ) { // TODO ( johnlenz ) : In ES5 strict mode a function can have a null or
// undefined " this " value , but all the existing " @ this " annotations
// don ' t declare restricted types .
JSType maybeThisType = info . getThisType ( ) . evaluate ( templateScope , typeRegistry ... |
public class Stripe { /** * Blocking method to create a { @ link Token } for a Connect Account . Do not call this on the UI
* thread or your app will crash . The method uses the currently set
* { @ link # mDefaultPublishableKey } .
* @ param accountParams params to use for this token .
* @ return a { @ link Tok... | return createAccountTokenSynchronous ( accountParams , mDefaultPublishableKey ) ; |
public class TaskOperations { /** * Lists the { @ link CloudTask tasks } of the specified job .
* @ param jobId
* The ID of the job .
* @ param detailLevel
* A { @ link DetailLevel } used for filtering the list and for
* controlling which properties are retrieved from the service .
* @ param additionalBehav... | TaskListOptions options = new TaskListOptions ( ) ; BehaviorManager bhMgr = new BehaviorManager ( this . customBehaviors ( ) , additionalBehaviors ) ; bhMgr . appendDetailLevelToPerCallBehaviors ( detailLevel ) ; bhMgr . applyRequestBehaviors ( options ) ; return this . parentBatchClient . protocolLayer ( ) . tasks ( )... |
public class ParentRunnerSpy { /** * Reflectively invokes a { @ link ParentRunner } ' s getFilteredChildren method . Manipulating this
* list lets us control which tests will be run . */
static < T > List < T > getFilteredChildren ( ParentRunner < T > parentRunner ) { } } | try { // noinspection unchecked
return new ArrayList < > ( ( Collection < T > ) getFilteredChildrenMethod . invoke ( parentRunner ) ) ; } catch ( IllegalAccessException | InvocationTargetException e ) { throw new RuntimeException ( "Failed to invoke getFilteredChildren()" , e ) ; } |
public class BinaryJedis { /** * Decrement the number stored at key by one . If the key does not exist or contains a value of a
* wrong type , set the key to the value of " 0 " before to perform the decrement operation .
* INCR commands are limited to 64 bit signed integers .
* Note : this is actually a string op... | checkIsInMultiOrPipeline ( ) ; client . decr ( key ) ; return client . getIntegerReply ( ) ; |
public class TransactionIdManager { /** * Generate a unique id that contains a timestamp , a counter
* and a siteid packed into a 64 - bit long value . Subsequent calls
* to this method will return strictly larger long values .
* @ return The newly generated transaction id . */
public long getNextUniqueTransactio... | // get the current time , usually the salt value is zero
// in testing it is used to simulate clock skew
long currentTime = m_clock . get ( ) + m_timestampTestingSalt ; if ( currentTime == lastUsedTime ) { // increment the counter for this millisecond
counterValue ++ ; // handle the case where we ' ve run out of counte... |
public class ClassPathGeneratorHelper { /** * Checks if the entry is a direct child of the root Entry
* isDirectChildPath ( ' / a / b / c / ' , ' / a / b / c / d . txt ' ) = > true isDirectChildPath (
* ' / a / b / c / ' , ' / a / b / c / d / ' ) = > true isDirectChildPath ( ' / a / b / c / ' ,
* ' / a / b / c / ... | boolean result = false ; if ( entryPath . length ( ) > rootEntryPath . length ( ) && entryPath . startsWith ( rootEntryPath ) ) { int idx = entryPath . indexOf ( URL_SEPARATOR , rootEntryPath . length ( ) ) ; if ( idx == - 1 ) { // case where the entry is a child file
// / a / b / c / d . txt
result = true ; } else { i... |
public class AbstractBitOutput { /** * Writes an unsigned value whose size is { @ value Short # SIZE } in maximum .
* @ param size the number of lower bits to write ; between { @ code 1 } and { @ value Short # SIZE } , both inclusive .
* @ param value the value to write
* @ throws IOException if an I / O error oc... | requireValidSizeUnsigned16 ( size ) ; final int quotient = size / Byte . SIZE ; final int remainder = size % Byte . SIZE ; if ( remainder > 0 ) { unsigned8 ( remainder , value >> ( quotient * Byte . SIZE ) ) ; } for ( int i = quotient - 1 ; i >= 0 ; i -- ) { unsigned8 ( Byte . SIZE , value >> ( Byte . SIZE * i ) ) ; } |
public class GcmRegistration { /** * private final static int PLAY _ SERVICES _ RESOLUTION _ REQUEST = 9000; */
protected static void getRegistrationId ( OrtcClient ortcClient ) { } } | if ( checkPlayServices ( ortcClient ) ) { gcm = GoogleCloudMessaging . getInstance ( ortcClient . appContext ) ; if ( ortcClient . registrationId . isEmpty ( ) ) { String regid = getRegistrationId ( ortcClient . appContext ) ; ortcClient . registrationId = regid ; if ( regid . isEmpty ( ) ) { registerInBackground ( ort... |
public class RBBIRuleBuilder { static void compileRules ( String rules , OutputStream os ) throws IOException { } } | // Read the input rules , generate a parse tree , symbol table ,
// and list of all Unicode Sets referenced by the rules .
RBBIRuleBuilder builder = new RBBIRuleBuilder ( rules ) ; builder . fScanner . parse ( ) ; // UnicodeSet processing .
// Munge the Unicode Sets to create a set of character categories .
// Generate... |
public class HString { /** * Gets this HString as an annotation . If the HString is already an annotation it is simply cast . Otherwise a
* detached annotation of type < code > AnnotationType . ROOT < / code > is created .
* @ return An annotation . */
public Annotation asAnnotation ( ) { } } | if ( this instanceof Annotation ) { return Cast . as ( this ) ; } else if ( document ( ) != null ) { return document ( ) . annotationBuilder ( ) . type ( AnnotationType . ROOT ) . bounds ( this ) . attributes ( this ) . createDetached ( ) ; } return Fragments . detachedAnnotation ( AnnotationType . ROOT , start ( ) , e... |
public class ProxyImpl { /** * In sequential proxying get some untried branch and start it , then wait for response and repeat */
public void startNextUntriedBranch ( ) { } } | if ( this . parallel ) throw new IllegalStateException ( "This method is only for sequantial proxying" ) ; for ( final MobicentsProxyBranch pbi : this . proxyBranches . values ( ) ) { // Issue http : / / code . google . com / p / mobicents / issues / detail ? id = 2461
// don ' t start the branch is it has been cancell... |
public class GenerationMojo { /** * Load an optional model from the project resources .
* @ return Model or empty optional if not present . */
private < T > Optional < T > loadOptionalModel ( Class < T > clzz , String location ) { } } | return ModelLoaderUtils . loadOptionalModel ( clzz , getResourceLocation ( location ) ) ; |
public class CommerceDiscountUserSegmentRelLocalServiceBaseImpl { /** * Adds the commerce discount user segment rel to the database . Also notifies the appropriate model listeners .
* @ param commerceDiscountUserSegmentRel the commerce discount user segment rel
* @ return the commerce discount user segment rel that... | commerceDiscountUserSegmentRel . setNew ( true ) ; return commerceDiscountUserSegmentRelPersistence . update ( commerceDiscountUserSegmentRel ) ; |
public class SerializationUtilities { /** * Serialize an object to disk .
* @ param file
* the file to write to .
* @ param obj
* the object to write .
* @ throws IOException */
public static void serializeToDisk ( File file , Object obj ) throws IOException { } } | byte [ ] serializedObj = serialize ( obj ) ; try ( RandomAccessFile raFile = new RandomAccessFile ( file , "rw" ) ) { raFile . write ( serializedObj ) ; } |
public class CreateInsightRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateInsightRequest createInsightRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createInsightRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createInsightRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createInsightRequest . getFilters ( ) , FILTERS_BINDING ) ; protocolMarshaller... |
public class ServletInvocationEvent { /** * Get the request used for the servlet invocation . */
public HttpServletRequest getRequest ( ) { } } | // moved as part of LIDB - 3598 to ServletUtil
/* ServletRequest r = _ req ;
while ( ! ( r instanceof HttpServletRequest ) )
if ( r instanceof ServletRequestWrapper )
r = ( ( ServletRequestWrapper ) r ) . getRequest ( ) ;
return ( HttpServletRequest ) r ; */
// begin 311003 , 61FVT : Simple SIP request generati... |
public class DoubleStreamEx { /** * Returns the maximum element of this stream according to the provided key
* extractor function .
* This is a terminal operation .
* @ param keyExtractor a non - interfering , stateless function
* @ return an { @ code OptionalDouble } describing the first element of this
* st... | return collect ( PrimitiveBox :: new , ( box , d ) -> { int key = keyExtractor . applyAsInt ( d ) ; if ( ! box . b || box . i < key ) { box . b = true ; box . i = key ; box . d = d ; } } , PrimitiveBox . MAX_INT ) . asDouble ( ) ; |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcAnalysisTheoryTypeEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class MessageBatch { /** * Returns the total number of bytes of the message batch ( by calling { @ link org . jgroups . Message # getLength ( ) } on all messages ) */
public int length ( ) { } } | int retval = 0 ; for ( int i = 0 ; i < index ; i ++ ) retval += length_visitor . applyAsInt ( messages [ i ] , this ) ; return retval ; |
public class FileUtil { /** * Checks if the extension is valid . This method only permits letters , digits ,
* and an underscore character .
* @ param extension The file extension to validate
* @ return True if its valid , otherwise false */
public static boolean isValidFileExtension ( String extension ) { } } | for ( int i = 0 ; i < extension . length ( ) ; i ++ ) { char c = extension . charAt ( i ) ; if ( ! ( Character . isDigit ( c ) || Character . isLetter ( c ) || c == '_' ) ) { return false ; } } return true ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public FNCPatAlign createFNCPatAlignFromString ( EDataType eDataType , String initialValue ) { } } | FNCPatAlign result = FNCPatAlign . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class ByteBuffer { /** * Gets a copy of the current buffer as byte array , but the new byte [ ]
* has the specified capacity . Useful if you need to store additional bytes
* in the returned byte [ ] and dont ' want to do an additional System . arraycopy ( )
* afterwards . Method will allocate memory to hol... | // validate the offset , length are ok
ByteBuffer . checkOffsetLength ( size ( ) , offset , length ) ; // will we have a large enough byte [ ] allocated ?
if ( capacity < length ) { throw new IllegalArgumentException ( "Capacity must be large enough to hold a byte[] of at least a size=" + length ) ; } byte [ ] arrayCop... |
public class DefaultGroovyMethods { /** * Returns a < code > BufferedIterator < / code > that allows examining the next element without
* consuming it .
* < pre class = " groovyTestCase " >
* assert [ 1 , 2 , 3 , 4 ] . iterator ( ) . buffered ( ) . with { [ head ( ) , toList ( ) ] } = = [ 1 , [ 1 , 2 , 3 , 4 ] ] ... | if ( self instanceof BufferedIterator ) { return ( BufferedIterator < T > ) self ; } else { return new IteratorBufferedIterator < T > ( self ) ; } |
public class DepAnn { /** * Reports a dep - ann error for a declaration if : ( 1 ) javadoc contains the deprecated javadoc tag
* ( 2 ) the declaration is not annotated with { @ link java . lang . Deprecated } */
@ SuppressWarnings ( "javadoc" ) private Description checkDeprecatedAnnotation ( Tree tree , VisitorState ... | Symbol symbol = ASTHelpers . getSymbol ( tree ) ; // javac sets the DEPRECATED bit in flags if the Javadoc contains @ deprecated
if ( ( symbol . flags ( ) & DEPRECATED ) == 0 ) { return Description . NO_MATCH ; } if ( symbol . attribute ( state . getSymtab ( ) . deprecatedType . tsym ) != null ) { return Description . ... |
public class CmsFlexCache { /** * Clears all entries in the cache , online or offline . < p >
* The keys are not cleared . < p >
* Only users with administrator permissions are allowed
* to perform this operation . < p > */
private synchronized void clearEntries ( ) { } } | if ( ! isEnabled ( ) ) { return ; } if ( LOG . isInfoEnabled ( ) ) { LOG . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_FLEXCACHE_CLEAR_ALL_0 ) ) ; } // create new set to avoid ConcurrentModificationExceptions
Set < String > cacheKeys = synchronizedCopyKeys ( m_keyCache ) ; Iterator < String > i = c... |
public class ULocale { /** * Append a tag to a StringBuilder , adding the separator if necessary . The tag must
* not be a zero - length string .
* @ param tag The tag to add .
* @ param buffer The output buffer . */
private static void appendTag ( String tag , StringBuilder buffer ) { } } | if ( buffer . length ( ) != 0 ) { buffer . append ( UNDERSCORE ) ; } buffer . append ( tag ) ; |
public class Item { /** * Sets the item to a BootstrapMethod item .
* @ param position
* position in byte in the class attribute BootrapMethods .
* @ param hashCode
* hashcode of the item . This hashcode is processed from the
* hashcode of the bootstrap method and the hashcode of all
* bootstrap arguments .... | this . type = ClassWriter . BSM ; this . intVal = position ; this . hashCode = hashCode ; |
public class DashPackageMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DashPackage dashPackage , ProtocolMarshaller protocolMarshaller ) { } } | if ( dashPackage == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( dashPackage . getEncryption ( ) , ENCRYPTION_BINDING ) ; protocolMarshaller . marshall ( dashPackage . getManifestLayout ( ) , MANIFESTLAYOUT_BINDING ) ; protocolMarshaller ... |
public class MG2Encoder { /** * Convert the normals to a new coordinate system : magnitude , phi , theta
* ( relative to predicted smooth normals ) .
* @ param vertices vertex data
* @ param normals normal data
* @ param indices model indices
* @ param sortVertices sorted vertices
* @ return encoded normals... | // Calculate smooth normals ( Note : aVertices and aIndices use the sorted
// index space , so smoothNormals will too )
float [ ] smoothNormals = calcSmoothNormals ( vertices , indices ) ; // Normal scaling factor
float scale = 1.0f / normalPrecision ; int vc = vertices . length / CTM_POSITION_ELEMENT_COUNT ; int [ ] i... |
public class Jdt2Ecore { /** * Replies if the given method is marked has automatically generated by the SARL compiler .
* @ param method the method to check .
* @ return < code > true < / code > if the method is annoted with SyntheticMember ; < code > false < / code >
* otherwise . */
public boolean isGeneratedOp... | return getAnnotation ( method , SyntheticMember . class . getName ( ) ) != null || getAnnotation ( method , Generated . class . getName ( ) ) != null ; |
public class ModelReflector { /** * Find extension points of the form prefix . < i > modelClass . getSimpleName ( ) < / i > . suffix for all relevant models in the right sequence .
* @ param prefix
* @ param suffix
* @ return */
public List < String > getExtensionPoints ( String prefix , String suffix ) { } } | return extensionPointsCache . get ( prefix + "@" + suffix ) ; |
public class AbstractSqlBuilder { /** * 设置float类型参数 .
* @ param fieldName 参数名
* @ param value 参数值 */
public void setFloat ( String fieldName , Float value ) { } } | if ( value == null ) { throw new IllegalArgumentException ( "参数值[" + fieldName + "]不能为NULL." ) ; } fieldList . add ( fieldName ) ; statementParameter . setFloat ( value ) ; |
public class XMLChar { /** * Check to see if a string is a valid NCName according to [ 4]
* from the XML Namespaces 1.0 Recommendation
* @ param ncName string to check
* @ return true if name is a valid NCName */
public static boolean isValidNCName ( String ncName ) { } } | final int length = ncName . length ( ) ; if ( length == 0 ) { return false ; } char ch = ncName . charAt ( 0 ) ; if ( ! isNCNameStart ( ch ) ) { return false ; } for ( int i = 1 ; i < length ; ++ i ) { ch = ncName . charAt ( i ) ; if ( ! isNCName ( ch ) ) { return false ; } } return true ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.