signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class XMLOutputter { /** * Adds an attribute to the current element , with a < code > boolean < / code > value . There must
* currently be an open element .
* The attribute value is surrounded by the quotation mark character ( see
* { @ link # getQuotationMark ( ) } ) .
* @ param name the name of the att... | attribute ( name , value ? "true" : "false" ) ; |
public class CoverageUtil { /** * TODO : Comment */
public float getSpanPercent ( ILexNameToken name ) { } } | int hits = 0 ; int misses = 0 ; ILexLocation span = null ; synchronized ( nameSpans ) { span = nameSpans . get ( name ) ; } synchronized ( allLocations ) { for ( ILexLocation l : allLocations ) { if ( l . getExecutable ( ) && l . within ( span ) ) { if ( l . getHits ( ) > 0 ) { hits ++ ; } else { misses ++ ; } } } } in... |
public class KNNClassifier { /** * Return the predict to every other train vector ' s distance .
* @ return return by Id which is ordered by input sequential . */
@ Override public Map < String , Double > predict ( Tuple predict ) { } } | KNNEngine engine = new KNNEngine ( predict , trainingData , k ) ; if ( mode == 1 ) { engine . getDistance ( engine . chebyshevDistance ) ; } else if ( mode == 2 ) { engine . getDistance ( engine . manhattanDistance ) ; } else { engine . getDistance ( engine . euclideanDistance ) ; } predict . label = engine . getResult... |
public class GenericsUtils { /** * If type is a variable , looks actual variable type , if it contains generics .
* For { @ link ParameterizedType } return actual type parameters , for simple class returns raw class generics .
* Note : returned generics may contain variables inside !
* @ param type type to get ge... | Type [ ] res = NO_TYPES ; Type analyzingType = type ; if ( type instanceof TypeVariable ) { // if type is pure generic recovering parametrization
analyzingType = declaredGeneric ( ( TypeVariable ) type , generics ) ; } if ( ( analyzingType instanceof ParameterizedType ) && ( ( ParameterizedType ) analyzingType ) . getA... |
public class DeletePubSubMsgsThread { /** * This get called from MessageProcessor on ME getting stopped . */
@ Override public void stopThread ( StoppableThreadCache cache ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "stopThread" ) ; this . hasToStop = true ; // Remove this thread from the thread cache
cache . deregisterThread ( this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "stopT... |
public class CommandFaceDescriptor { /** * { @ inheritDoc } */
public void setCaption ( String shortDescription ) { } } | String old = this . caption ; this . caption = shortDescription ; firePropertyChange ( DescribedElement . CAPTION_PROPERTY , old , this . caption ) ; |
public class Metric { /** * Indicate we are done ( stop the timer ) . Once you call this
* method , subsequent calls have no effect .
* @ return time in nanoseconds from the start of this metric , or - 1
* if { @ code false } was passed in the constructor */
public long done ( ) { } } | if ( enabled ) { if ( ! done ) { lastCheckpointNanos = System . nanoTime ( ) ; done = true ; } return lastCheckpointNanos - startNanos ; } return - 1 ; |
public class CreateMojo { /** * Get the branch info for this revision from the repository . For svn , it is in svn info .
* @ return
* @ throws MojoExecutionException
* @ throws MojoExecutionException */
public String getScmBranch ( ) throws MojoExecutionException { } } | try { ScmRepository repository = getScmRepository ( ) ; ScmProvider provider = scmManager . getProviderByRepository ( repository ) ; /* git branch can be obtained directly by a command */
if ( GitScmProviderRepository . PROTOCOL_GIT . equals ( provider . getScmType ( ) ) ) { ScmFileSet fileSet = new ScmFileSet ( scmDir... |
public class RequestUtils { /** * Compares ipAddress with one of the ip addresses listed
* @ param ipAddress ip address to compare
* @ param whitelist list of ip addresses . . . an be a range ip . . . in format 123.123.123.123/28 where last part is a subnet range
* @ return true if allowed , false if not */
publi... | if ( StringUtils . isNullOrEmpty ( ipAddress ) || whitelist == null || whitelist . length == 0 ) { return false ; } for ( String address : whitelist ) { if ( ipAddress . equals ( address ) ) { return true ; } if ( address . contains ( "/" ) ) { // is range definition
SubnetUtils utils = new SubnetUtils ( address ) ; ut... |
public class AssignInstanceRequest { /** * The layer ID , which must correspond to a custom layer . You cannot assign a registered instance to a built - in
* layer .
* @ return The layer ID , which must correspond to a custom layer . You cannot assign a registered instance to a
* built - in layer . */
public java... | if ( layerIds == null ) { layerIds = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return layerIds ; |
public class TopKSampler { /** * Start to record samples
* @ param capacity
* Number of sample items to keep in memory , the lower this is
* the less accurate results are . For best results use value
* close to cardinality , but understand the memory trade offs . */
public synchronized void beginSampling ( int ... | if ( ! enabled ) { summary = new StreamSummary < T > ( capacity ) ; hll = new HyperLogLogPlus ( 14 ) ; enabled = true ; } |
public class BindMapHelper { /** * Parse a map .
* @ param context the context
* @ param parserWrapper the parser wrapper
* @ param map the map
* @ return map */
public static Map < String , Object > parseMap ( AbstractContext context , ParserWrapper parserWrapper , Map < String , Object > map ) { } } | switch ( context . getSupportedFormat ( ) ) { case XML : throw ( new KriptonRuntimeException ( context . getSupportedFormat ( ) + " context does not support parse direct map parsing" ) ) ; default : JacksonWrapperParser wrapperParser = ( JacksonWrapperParser ) parserWrapper ; JsonParser parser = wrapperParser . jackson... |
public class Connection { /** * { @ inheritDoc }
* @ throws java . sql . SQLFeatureNotSupportedException if | autoGeneratedKeys | is Statement . RETURN _ GENERATED _ KEYS
* @ see # prepareStatement ( java . lang . String ) */
public PreparedStatement prepareStatement ( final String sql , final int autoGeneratedKeys... | checkClosed ( ) ; return new acolyte . jdbc . PreparedStatement ( this , sql , autoGeneratedKeys , null , null , this . handler . getStatementHandler ( ) ) ; |
public class CompositeTextWatcher { /** * Add a { @ link TextWatcher } with a specified Id and whether or not it is enabled by default
* @ param id the id of the { @ link TextWatcher } to add
* @ param watcher the { @ link TextWatcher } to add
* @ param enabled whether or not it is enabled by default */
public vo... | mWatchers . put ( id , watcher ) ; mEnabledKeys . put ( id , enabled ) ; |
public class BigtableTableAdminClient { /** * Constructs an instance of BigtableTableAdminClient with the given instanceName and stub . */
public static BigtableTableAdminClient create ( @ Nonnull String projectId , @ Nonnull String instanceId , @ Nonnull EnhancedBigtableTableAdminStub stub ) { } } | return new BigtableTableAdminClient ( projectId , instanceId , stub ) ; |
public class TimeBasedOneTimePasswordHelper { /** * Decode base - 32 method . I didn ' t want to add a dependency to Apache Codec just for this decode method . Exposed for
* testing . */
static byte [ ] decodeBase32 ( String str ) { } } | // each base - 32 character encodes 5 bits
int numBytes = ( ( str . length ( ) * 5 ) + 7 ) / 8 ; byte [ ] result = new byte [ numBytes ] ; int resultIndex = 0 ; int which = 0 ; int working = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char ch = str . charAt ( i ) ; int val ; if ( ch >= 'a' && ch <= 'z' ) { va... |
public class ClassNode { /** * Specify the class represented by this ` ClassNode ` is annotated
* by an annotation class specified by the name
* @ param name the name of the annotation class
* @ return this ` ClassNode ` instance */
public ClassNode annotatedWith ( String name ) { } } | ClassNode anno = infoBase . node ( name ) ; this . annotations . add ( anno ) ; anno . annotated . add ( this ) ; return this ; |
public class JJTree { /** * Assembles the command line arguments for the invocation of JJTree according
* to the configuration . < br / >
* < br / >
* < strong > Note : < / strong > To prevent conflicts with JavaCC options that might
* be set directly in the grammar file , only those parameters that have been
... | final List < String > argsList = new ArrayList < > ( ) ; if ( StringUtils . isNotEmpty ( this . grammarEncoding ) ) { argsList . add ( "-GRAMMAR_ENCODING=" + this . grammarEncoding ) ; } if ( StringUtils . isNotEmpty ( this . outputEncoding ) ) { argsList . add ( "-OUTPUT_ENCODING=" + this . outputEncoding ) ; } if ( S... |
public class FldExporter { /** * Saves the engine as a FuzzyLite Dataset into the specified file
* @ param file is file to save the dataset into
* @ param engine is the engine to export
* @ param values is the number of values to export
* @ param scope indicates the scope of the values
* @ param activeVariabl... | if ( ! file . createNewFile ( ) ) { FuzzyLite . logger ( ) . log ( Level . FINE , "Replacing file {0}" , file . getAbsolutePath ( ) ) ; } BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( file ) , FuzzyLite . UTF_8 ) ) ; try { write ( engine , writer , values , scope , activeV... |
public class ClassInfo { /** * Add an implemented interface to this class .
* @ param interfaceName
* the interface name
* @ param classNameToClassInfo
* the map from class name to class info */
void addImplementedInterface ( final String interfaceName , final Map < String , ClassInfo > classNameToClassInfo ) {... | final ClassInfo interfaceClassInfo = getOrCreateClassInfo ( interfaceName , /* classModifiers = */
Modifier . INTERFACE , classNameToClassInfo ) ; interfaceClassInfo . isInterface = true ; interfaceClassInfo . modifiers |= Modifier . INTERFACE ; this . addRelatedClass ( RelType . IMPLEMENTED_INTERFACES , interfaceClass... |
public class ProfilingTimer { /** * Append the given string to the log message of the current subtask */
public void appendToLog ( String logAppendMessage ) { } } | ProfilingTimerNode currentNode = current . get ( ) ; if ( currentNode != null ) { currentNode . appendToLog ( logAppendMessage ) ; } |
public class PushBroadcastReceiver { /** * Dispatch received push message to external listener .
* @ param listener Push message listener .
* @ param message Received push message to be dispatched . */
private void dispatchMessage ( PushMessageListener listener , RemoteMessage message ) { } } | if ( listener != null ) { mainThreadHandler . post ( ( ) -> listener . onMessageReceived ( message ) ) ; } |
public class DefaultExceptionFactory { /** * Create an { @ link LdapException } from an { @ link ILdapResult }
* @ param result the result code
* @ return a new LDAPException */
public static LdapException create ( ILdapResult result ) { } } | return new LdapException ( result . getResultCode ( ) , result . getMessage ( ) , null ) ; |
public class CollectionUtils { /** * Wrap hash set .
* @ param < T > the type parameter
* @ param source the source
* @ return the set */
public static < T > HashSet < T > wrapHashSet ( final T ... source ) { } } | val list = new HashSet < T > ( ) ; addToCollection ( list , source ) ; return list ; |
public class ImageSessionFilter { /** * 取出保存的所有UploadFile集合 , 但不从Session删除这些集合
* @ param request
* @ return */
public Collection getAllUploadFile ( HttpServletRequest request ) { } } | Collection uploadList = null ; try { HttpSession session = request . getSession ( ) ; if ( session != null ) { uploadList = ( Collection ) session . getAttribute ( PIC_NAME_PACKAGE ) ; } } catch ( Exception ex ) { Debug . logError ( "[JdonFramework] not found the upload files in session" + ex , module ) ; } return uplo... |
public class TagTypeImpl { /** * If not already created , a new < code > attribute < / code > element will be created and returned .
* Otherwise , the first existing < code > attribute < / code > element will be returned .
* @ return the instance defined for the element < code > attribute < / code > */
public TldAt... | List < Node > nodeList = childNode . get ( "attribute" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new TldAttributeTypeImpl < TagType < T > > ( this , "attribute" , childNode , nodeList . get ( 0 ) ) ; } return createAttribute ( ) ; |
public class VisitorState { /** * Given the binary name of a class , returns the { @ link Type } .
* < p > If this method returns null , the compiler doesn ' t have access to this type , which means that
* if you are comparing other types to this for equality or the subtype relation , your result
* would always b... | try { return typeCache . get ( typeStr ) . orNull ( ) ; } catch ( ExecutionException e ) { return null ; } |
public class GammaDistribution { /** * Approximate probit for chi squared distribution
* Based on first half of algorithm AS 91
* Reference :
* D . J . Best , D . E . Roberts < br >
* Algorithm AS 91 : The percentage points of the χ2 distribution < br >
* Journal of the Royal Statistical Society . Series C ( ... | final double EPS1 = 1e-14 ; // Approximation quality
// Sanity checks
if ( Double . isNaN ( p ) || Double . isNaN ( nu ) ) { return Double . NaN ; } // Range check
if ( p <= 0 ) { return 0 ; } if ( p >= 1 ) { return Double . POSITIVE_INFINITY ; } // Invalid parameters
if ( nu <= 0 ) { return Double . NaN ; } // Shape o... |
public class OkHttpSimpleTextRequest { /** * will be invoked in remote service */
@ Override public String loadDataFromNetwork ( ) throws Exception { } } | try { Ln . d ( "Call web service " + url ) ; OkUrlFactory urlFactory = new OkUrlFactory ( getOkHttpClient ( ) ) ; HttpURLConnection connection = urlFactory . open ( new URL ( url ) ) ; return IOUtils . toString ( connection . getInputStream ( ) ) ; } catch ( final MalformedURLException e ) { Ln . e ( e , "Unable to cre... |
public class Http2Stream { /** * Accept headers from the network and store them until the client calls { @ link # takeHeaders } , or
* { @ link FramingSource # read } them . */
void receiveHeaders ( Headers headers , boolean inFinished ) { } } | assert ( ! Thread . holdsLock ( Http2Stream . this ) ) ; boolean open ; synchronized ( this ) { if ( ! hasResponseHeaders || ! inFinished ) { hasResponseHeaders = true ; headersQueue . add ( headers ) ; } else { this . source . trailers = headers ; } if ( inFinished ) { this . source . finished = true ; } open = isOpen... |
public class Message { /** * Sets the message format arguments .
* @ param args the message arguments . */
public void setArgs ( final Serializable ... args ) { } } | this . args = args == null || args . length == 0 ? null : args ; |
public class StorageProviderFactoryImpl { /** * Removes a particular storage provider from the cache , which will
* require that the connection be recreated on the next call .
* @ param storageAccountId - the ID of the storage provider account */
@ Override public void expireStorageProvider ( String storageAccountI... | storageAccountId = checkStorageAccountId ( storageAccountId ) ; log . info ( "Expiring storage provider connection! Storage account id: {}" , storageAccountId ) ; storageProviders . remove ( storageAccountId ) ; |
public class Journal { /** * Format the local storage with the given namespace . */
private void formatImage ( NamespaceInfo nsInfo ) throws IOException { } } | Preconditions . checkState ( nsInfo . getNamespaceID ( ) != 0 , "can't format with uninitialized namespace info: %s" , nsInfo . toColonSeparatedString ( ) ) ; LOG . info ( "Formatting image " + this . getJournalId ( ) + " with namespace info: (" + nsInfo . toColonSeparatedString ( ) + ")" ) ; imageStorage . backupDirs ... |
public class JsonReader { /** * Read the Json from the passed File .
* @ param aFile
* The file containing the Json to be parsed . May not be
* < code > null < / code > .
* @ param aFallbackCharset
* The charset to be used in case no is BOM is present . May not be
* < code > null < / code > .
* @ return <... | return readFromFile ( aFile , aFallbackCharset , null ) ; |
public class TreeHashGenerator { /** * Calculates a hex encoded binary hash using a tree hashing algorithm for
* the data in the specified input stream . The method will consume all the
* inputStream and close it when returned .
* @ param input
* The input stream containing the data to hash .
* @ return The h... | try { TreeHashInputStream treeHashInputStream = new TreeHashInputStream ( input ) ; byte [ ] buffer = new byte [ 1024 ] ; while ( treeHashInputStream . read ( buffer , 0 , buffer . length ) != - 1 ) ; // closing is currently required to compute the checksum
treeHashInputStream . close ( ) ; return calculateTreeHash ( t... |
public class TrustedCertificates { /** * Loads X509 certificates and signing policy files from specified
* locations . The locations can be either files or
* directories . The directories will be automatically traversed
* and all files in the form of < i > hashcode . number < / i > and will be
* loaded automati... | TrustedCertificates tc = TrustedCertificates . load ( locations ) ; return ( tc == null ) ? null : tc . getCertificates ( ) ; |
public class AbstractCluster { /** * 通知状态变成不可用 , 主要是 : < br >
* 1 . 注册中心删除 , 更新节点后变成不可用时 < br >
* 2 . 连接断线后 ( 心跳 + 调用 ) , 如果是可用节点为空 */
public void notifyStateChangeToUnavailable ( ) { } } | final List < ConsumerStateListener > onprepear = consumerConfig . getOnAvailable ( ) ; if ( onprepear != null ) { AsyncRuntime . getAsyncThreadPool ( ) . execute ( new Runnable ( ) { @ Override public void run ( ) { // 状态变化通知监听器
for ( ConsumerStateListener listener : onprepear ) { try { listener . onUnavailable ( consu... |
public class EnvironmentsInner { /** * Create or replace an existing Environment .
* @ param resourceGroupName The name of the resource group .
* @ param labAccountName The name of the lab Account .
* @ param labName The name of the lab .
* @ param environmentSettingName The name of the environment Setting .
... | return ServiceFuture . fromResponse ( createOrUpdateWithServiceResponseAsync ( resourceGroupName , labAccountName , labName , environmentSettingName , environmentName , environment ) , serviceCallback ) ; |
public class XMLResourceBundle { /** * Gets the value from the { @ link ResourceBundle } for the supplied message key and additional details .
* @ param aMessage A message key
* @ param aDetailsArray Additional details for the message
* @ return The value of the bundle message */
public String get ( final String ... | final String [ ] details = new String [ aDetailsArray . length ] ; for ( int index = 0 ; index < details . length ; index ++ ) { details [ index ] = aDetailsArray [ index ] . toString ( ) ; } LOGGER . debug ( MessageCodes . UTIL_026 , aMessage , details ) ; return StringUtils . format ( super . getString ( aMessage ) ,... |
public class FNORGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . FNORG__RESERVED : return getReserved ( ) ; case AfplibPackage . FNORG__CHAR_ROT : return getCharRot ( ) ; case AfplibPackage . FNORG__MAX_BOSET : return getMaxBOset ( ) ; case AfplibPackage . FNORG__MAX_CHAR_INC : return getMaxCharInc ( ) ; case AfplibPackage . FNORG__SP_CHAR... |
public class ClassGenerator { /** * See if any of the parsed types in the given list needs warning suppression . */
boolean needsSuppressWarnings ( List < MessageType > msgTypes ) { } } | return msgTypes . stream ( ) . anyMatch ( t -> t . accept ( suppressWarningsVisitor , null ) ) ; |
public class SimpleBloomFilter { /** * Computes the required number of bits needed by the Bloom Filter as a factor of the approximate number of elements
* to be added to the filter along with the desired , acceptable false positive rate ( probability ) .
* m = n * ( log p ) / ( log 2 ) ^ 2
* m is the required num... | double numberOfBits = Math . abs ( ( approximateNumberOfElements * Math . log ( acceptableFalsePositiveRate ) ) / Math . pow ( Math . log ( 2.0d ) , 2.0d ) ) ; return Double . valueOf ( Math . ceil ( numberOfBits ) ) . intValue ( ) ; |
public class ManagedChannelBuilder { /** * Creates a channel with the target ' s address and port number .
* @ see # forTarget ( String )
* @ since 1.0.0 */
public static ManagedChannelBuilder < ? > forAddress ( String name , int port ) { } } | return ManagedChannelProvider . provider ( ) . builderForAddress ( name , port ) ; |
public class SwaggerBuilder { /** * Returns the Tag for a controller .
* @ param controllerClass
* @ return a controller tag or null */
protected Tag getControllerTag ( Class < ? extends Controller > controllerClass ) { } } | if ( controllerClass . isAnnotationPresent ( ApiOperations . class ) ) { ApiOperations annotation = controllerClass . getAnnotation ( ApiOperations . class ) ; io . swagger . models . Tag tag = new io . swagger . models . Tag ( ) ; tag . setName ( Optional . fromNullable ( Strings . emptyToNull ( annotation . tag ( ) )... |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getMDR ( ) { } } | if ( mdrEClass == null ) { mdrEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 294 ) ; } return mdrEClass ; |
public class ExifReader { /** * Reads TIFF formatted Exif data at a specified offset within a { @ link RandomAccessReader } . */
public void extract ( @ NotNull final RandomAccessReader reader , @ NotNull final Metadata metadata , int readerOffset , @ Nullable Directory parentDirectory ) { } } | ExifTiffHandler exifTiffHandler = new ExifTiffHandler ( metadata , parentDirectory ) ; try { // Read the TIFF - formatted Exif data
new TiffReader ( ) . processTiff ( reader , exifTiffHandler , readerOffset ) ; } catch ( TiffProcessingException e ) { exifTiffHandler . error ( "Exception processing TIFF data: " + e . ge... |
public class Sequential { /** * Checks to see if the subscriber is a predicated subscriber , and if it
* applies .
* @ param s
* - The subscriber to check .
* @ param message
* - The message to check .
* @ return If the subscriber is not predicated or it is and applies , then it
* returns true . If it ' s... | if ( s instanceof PredicatedSubscriber && ! ( ( PredicatedSubscriber < ? > ) s ) . appliesO ( message ) ) { return false ; } return true ; |
public class cufftHandle { /** * Set the size of this plan
* @ param x Size in x
* @ param y Size in y
* @ param z Size in z */
void setSize ( int x , int y , int z ) { } } | this . sizeX = x ; this . sizeY = y ; this . sizeZ = z ; |
public class ObjectAccumulator { /** * Increases the count of object o by inc and returns the new count value
* @ param o
* @ param inc
* @ return */
public double incBy ( K o , double inc ) { } } | Counter c = countMap . get ( o ) ; if ( c == null ) { c = new Counter ( ) ; countMap . put ( o , c ) ; } c . count += inc ; return c . count ; |
public class NodeTypeSchemata { /** * Determine if the session overrides any namespace mappings used by this schemata .
* @ param session the session ; may not be null
* @ return true if the session overrides one or more namespace mappings used in this schemata , or false otherwise */
private boolean overridesNames... | NamespaceRegistry registry = session . context ( ) . getNamespaceRegistry ( ) ; if ( registry instanceof LocalNamespaceRegistry ) { Set < Namespace > localNamespaces = ( ( LocalNamespaceRegistry ) registry ) . getLocalNamespaces ( ) ; if ( localNamespaces . isEmpty ( ) ) { // There are no local mappings . . .
return fa... |
public class OWLSubDataPropertyOfAxiomImpl_CustomFieldSerializer { /** * Deserializes the content of the object from the
* { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } .
* @ param streamReader the { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } to r... | deserialize ( streamReader , instance ) ; |
public class PdfStamper { /** * Sets the encryption options for this document . The userPassword and the
* ownerPassword can be null or have zero length . In this case the ownerPassword
* is replaced by a random string . The open permissions for the document can be
* AllowPrinting , AllowModifyContents , AllowCop... | if ( stamper . isAppend ( ) ) throw new DocumentException ( "Append mode does not support changing the encryption status." ) ; if ( stamper . isContentWritten ( ) ) throw new DocumentException ( "Content was already written to the output." ) ; stamper . setEncryption ( userPassword , ownerPassword , permissions , encry... |
public class HttpMethodBase { /** * Sets the query string of this HTTP method . The pairs are encoded as UTF - 8 characters .
* To use a different charset the parameters can be encoded manually using EncodingUtil
* and set as a single String .
* @ param params an array of { @ link NameValuePair } s to add as quer... | LOG . trace ( "enter HttpMethodBase.setQueryString(NameValuePair[])" ) ; queryString = EncodingUtil . formUrlEncode ( params , "UTF-8" ) ; |
public class ReturnUrl { /** * Get Resource Url for GetAvailablePaymentActionsForReturn
* @ param paymentId Unique identifier of the payment for which to perform the action .
* @ param returnId Unique identifier of the return whose items you want to get .
* @ return String Resource Url */
public static MozuUrl ge... | UrlFormatter formatter = new UrlFormatter ( "/api/commerce/returns/{returnId}/payments/{paymentId}/actions" ) ; formatter . formatUrl ( "paymentId" , paymentId ) ; formatter . formatUrl ( "returnId" , returnId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; |
public class DatabaseAccountsInner { /** * Online the specified region for the specified Azure Cosmos DB database account .
* @ param resourceGroupName Name of an Azure resource group .
* @ param accountName Cosmos DB database account name .
* @ param region Cosmos DB region , with spaces between words and each w... | return ServiceFuture . fromResponse ( onlineRegionWithServiceResponseAsync ( resourceGroupName , accountName , region ) , serviceCallback ) ; |
public class JvmTypesBuilder { /** * / * @ Nullable */
public JvmGenericType toClass ( /* @ Nullable */
EObject sourceElement , /* @ Nullable */
String name ) { } } | return toClass ( sourceElement , name , null ) ; |
public class Searches { /** * Searches the only matching element returning just element if found ,
* nothing otherwise .
* @ param < E > the element type parameter
* @ param array the array to be searched
* @ param predicate the predicate to be applied to each element
* @ throws IllegalStateException if more ... | final Iterator < E > filtered = new FilteringIterator < E > ( new ArrayIterator < E > ( array ) , predicate ) ; return new MaybeOneElement < E > ( ) . apply ( filtered ) ; |
public class RedisBase { /** * 删除给定的一个 key 。
* 不存在的 key 会被忽略 。
* @ param keyBytes
* @ return true : 存在该key删除时返回
* false : 不存在该key */
public boolean remove ( ) { } } | try { if ( ! isBinary ) return getJedisCommands ( groupName ) . del ( key ) == 1 ; if ( isCluster ( groupName ) ) { return getBinaryJedisClusterCommands ( groupName ) . del ( keyBytes ) == 1 ; } return getBinaryJedisCommands ( groupName ) . del ( keyBytes ) == 1 ; } finally { getJedisProvider ( groupName ) . release ( ... |
public class ObjectBindTransform { /** * / * ( non - Javadoc )
* @ see com . abubusoft . kripton . processor . bind . transform . BindTransform # generateParseOnXml ( com . abubusoft . kripton . processor . bind . BindTypeContext , com . squareup . javapoet . MethodSpec . Builder , java . lang . String , com . square... | // TODO QUA
// TypeName typeName = resolveTypeName ( property . getParent ( ) ,
// property . getPropertyType ( ) . getTypeName ( ) ) ;
TypeName typeName = property . getPropertyType ( ) . getTypeName ( ) ; String bindName = context . getBindMapperName ( context , typeName ) ; methodBuilder . addStatement ( setter ( be... |
public class IfcPersonImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < IfcActorRole > getRoles ( ) { } } | return ( EList < IfcActorRole > ) eGet ( Ifc2x3tc1Package . Literals . IFC_PERSON__ROLES , true ) ; |
public class Labeling { /** * labeling observation sequences .
* @ param file the file
* @ return a list of sentences with tags annotated */
@ SuppressWarnings ( "unchecked" ) public List seqLabeling ( File file ) { } } | List < Sentence > obsvSeqs = dataReader . readFile ( file . getPath ( ) ) ; return labeling ( obsvSeqs ) ; |
public class AzureBatchHelper { /** * Adds a single task to a job on Azure Batch .
* @ param jobId the ID of the job .
* @ param taskId the ID of the task .
* @ param jobJarUri the publicly accessible uri list to the job jar directory .
* @ param confUri the publicly accessible uri list to the job configuration... | final List < ResourceFile > resources = new ArrayList < > ( ) ; final ResourceFile jarSourceFile = new ResourceFile ( ) . withBlobSource ( jobJarUri . toString ( ) ) . withFilePath ( AzureBatchFileNames . getTaskJarFileName ( ) ) ; resources . add ( jarSourceFile ) ; final ResourceFile confSourceFile = new ResourceFile... |
public class ResourceUtil { /** * check if moveing a file is ok with the rules for the Resource interface , to not change this
* rules .
* @ param source
* @ param target
* @ throws IOException */
public static void checkMoveToOK ( Resource source , Resource target ) throws IOException { } } | if ( ! source . exists ( ) ) { throw new IOException ( "can't move [" + source . getPath ( ) + "] to [" + target . getPath ( ) + "], source file does not exist" ) ; } if ( source . isDirectory ( ) && target . isFile ( ) ) throw new IOException ( "can't move [" + source . getPath ( ) + "] directory to [" + target . getP... |
public class ListUtil { /** * Helper function for { @ link # removeRef } , etc . */
protected static Object remove ( EqualityComparator eqc , Object [ ] list , Object element ) { } } | return remove ( list , indexOf ( eqc , list , element ) ) ; |
public class Syslog { /** * destroyInstance ( ) gracefully shuts down the specified Syslog protocol and
* removes the instance from Syslog4j .
* @ param protocol - the Syslog protocol to destroy
* @ throws SyslogRuntimeException */
public synchronized static void destroyInstance ( String protocol ) throws SyslogR... | if ( StringUtils . isBlank ( protocol ) ) { return ; } String _protocol = protocol . toLowerCase ( ) ; if ( instances . containsKey ( _protocol ) ) { SyslogUtility . sleep ( SyslogConstants . THREAD_LOOP_INTERVAL_DEFAULT ) ; SyslogIF syslog = instances . get ( _protocol ) ; try { syslog . shutdown ( ) ; } finally { ins... |
public class GovernmentChecker { /** * Looks for a noun in the sentence ' s objects .
* @ param sentence
* entered by the user
* @ return a < tt > List > < / tt > of every noun found in the sentence ' s objects and
* its location in the sentence */
public List < Token > findNouns ( Sentence sentence ) { } } | List < Token > nouns = new ArrayList < Token > ( ) ; List < SyntacticChunk > syntChunks = sentence . getSyntacticChunks ( ) ; for ( int i = 0 ; i < syntChunks . size ( ) ; i ++ ) { String tag = syntChunks . get ( i ) . getTag ( ) ; if ( tag . equals ( "PIV" ) || tag . equals ( "ACC" ) || tag . equals ( "SC" ) ) { for (... |
public class TimeZone { /** * internal version ( which is called by public APIs ) accepts
* SHORT , LONG , SHORT _ GENERIC , LONG _ GENERIC , SHORT _ GMT , LONG _ GMT ,
* SHORT _ COMMONLY _ USED and GENERIC _ LOCATION . */
private String _getDisplayName ( int style , boolean daylight , ULocale locale ) { } } | if ( locale == null ) { throw new NullPointerException ( "locale is null" ) ; } String result = null ; if ( style == GENERIC_LOCATION || style == LONG_GENERIC || style == SHORT_GENERIC ) { // Generic format
TimeZoneFormat tzfmt = TimeZoneFormat . getInstance ( locale ) ; long date = System . currentTimeMillis ( ) ; Out... |
public class PropertyController { /** * Gets the value for a given property for an entity . If the property is not set , a non - null
* { @ link net . nemerosa . ontrack . model . structure . Property } is returned but is marked as
* { @ linkplain net . nemerosa . ontrack . model . structure . Property # isEmpty ( ... | return Resource . of ( propertyService . getProperty ( getEntity ( entityType , id ) , propertyTypeName ) , uri ( on ( getClass ( ) ) . getPropertyValue ( entityType , id , propertyTypeName ) ) ) ; |
public class XMLSerializer { /** * Gets the property .
* @ param name the name
* @ return obj
* @ throws IllegalArgumentException the illegal argument exception */
public Object getProperty ( String name ) throws IllegalArgumentException { } } | if ( name == null ) { throw new IllegalArgumentException ( "property name can not be null" ) ; } if ( PROPERTY_SERIALIZER_INDENTATION . equals ( name ) ) { return indentationString ; } else if ( PROPERTY_SERIALIZER_LINE_SEPARATOR . equals ( name ) ) { return lineSeparator ; } else if ( PROPERTY_LOCATION . equals ( name... |
public class ClassScanner { /** * Find all implementations of an interface ( if an interface is provided ) or extensions ( if a class is provided )
* @ param clazz
* @ param < T >
* @ return */
public < T > List < Class < ? extends T > > getImplementations ( final Class < T > clazz ) { } } | return getImplementations ( clazz , null ) ; |
public class FileUtils { /** * Devuelve true si es un fichero y se puede leer .
* @ param abstolutePath el path absoluto de un fichero
* @ return */
public static boolean canWriteFile ( File file ) { } } | if ( file != null && file . canWrite ( ) && ! file . isDirectory ( ) ) { return true ; } else { return false ; } |
public class BaseAdsServiceClientFactoryHelper { /** * Creates an { @ link AdsServiceDescriptor } for a specified service .
* @ param interfaceClass the ads service that we want a descriptor for
* @ param version the version of the service
* @ return a descriptor of the requested service */
@ Override public D cr... | return adsServiceDescriptorFactory . create ( interfaceClass , version ) ; |
public class appfwprofile_cookieconsistency_binding { /** * Use this API to fetch appfwprofile _ cookieconsistency _ binding resources of given name . */
public static appfwprofile_cookieconsistency_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | appfwprofile_cookieconsistency_binding obj = new appfwprofile_cookieconsistency_binding ( ) ; obj . set_name ( name ) ; appfwprofile_cookieconsistency_binding response [ ] = ( appfwprofile_cookieconsistency_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class Rollbar { /** * Record a debug error with custom parameters and human readable description .
* @ param error the error .
* @ param custom the custom data .
* @ param description the human readable description of error . */
public void debug ( Throwable error , Map < String , Object > custom , String ... | log ( error , custom , description , Level . DEBUG ) ; |
public class WSRdbManagedConnectionImpl { /** * Safely gets the NetworkTimeout . This method differs from the original getNetworkTimeout ( ) method
* by returning a default value when before JDBC - 4.1 or on a driver that does not support getNetworkTimeout ( ) .
* @ return The networkTimeout , or a default value if... | if ( ! mcf . supportsGetNetworkTimeout ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Returning default network timeout." , defaultNetworkTimeout ) ; return defaultNetworkTimeout ; } Throwable x ; try { return getNetworkTimeout ( ) ; } catch ( AbstractMethodError e ) {... |
public class BytecodeHelper { /** * Generates the bytecode to autobox the current value on the stack */
@ Deprecated public static boolean box ( MethodVisitor mv , Class type ) { } } | if ( ReflectionCache . getCachedClass ( type ) . isPrimitive && type != void . class ) { String returnString = "(" + BytecodeHelper . getTypeDescription ( type ) + ")Ljava/lang/Object;" ; mv . visitMethodInsn ( INVOKESTATIC , DTT_CLASSNAME , "box" , returnString , false ) ; return true ; } return false ; |
public class SyntheticStorableReferenceBuilder { /** * Generates a property name which doesn ' t clash with any already defined . */
private String generateSafeMethodName ( StorableInfo info , String prefix ) { } } | Class type = info . getStorableType ( ) ; // Try a few times to generate a unique name . There ' s nothing special
// about choosing 100 as the limit .
int value = 0 ; for ( int i = 0 ; i < 100 ; i ++ ) { String name = prefix + value ; if ( ! methodExists ( type , name ) ) { return name ; } value = name . hashCode ( ) ... |
public class URLs { /** * Encodes the specified string .
* @ param str the specified string
* @ return URL encoded string */
public static String encode ( final String str ) { } } | try { return URLEncoder . encode ( str , "UTF-8" ) ; } catch ( final Exception e ) { LOGGER . log ( Level . WARN , "Encodes str [" + str + "] failed" , e ) ; return str ; } |
public class PushApplicationEndpoint { /** * Update Push Application
* @ param pushApplicationID id of { @ link PushApplication }
* @ param updatedPushApp new info of { @ link PushApplication }
* @ return updated { @ link PushApplication }
* @ statuscode 204 The PushApplication updated successfully
* @ status... | PushApplication pushApp = getSearch ( ) . findByPushApplicationIDForDeveloper ( pushApplicationID ) ; if ( pushApp != null ) { // some validation
try { validateModelClass ( updatedPushApp ) ; } catch ( ConstraintViolationException cve ) { logger . info ( "Unable to update Push Application '{}'" , pushApplicationID ) ; ... |
public class CodeBuilder { /** * creation style instructions */
public void newObject ( TypeDesc type ) { } } | if ( type . isArray ( ) ) { newObject ( type , 1 ) ; } else { ConstantInfo info = mCp . addConstantClass ( type ) ; addCode ( 1 , Opcode . NEW , info ) ; } |
public class StandardDirectoryAgentServer { /** * Handles unicast UDP AttrRqst message arrived to this directory agent .
* < br / >
* This directory agent will reply with a list of attributes of matching services .
* @ param attrRqst the AttrRqst message to handle
* @ param localAddress the socket address the m... | // Match scopes , RFC 2608 , 11.1
if ( ! scopes . weakMatch ( attrRqst . getScopes ( ) ) ) { udpAttrRply . perform ( localAddress , remoteAddress , attrRqst , SLPError . SCOPE_NOT_SUPPORTED ) ; return ; } Attributes attributes = matchAttributes ( attrRqst ) ; if ( logger . isLoggable ( Level . FINE ) ) logger . fine ( ... |
public class Clock { /** * Defines if the date of the clock will be drawn .
* @ param VISIBLE */
public void setDateVisible ( final boolean VISIBLE ) { } } | if ( null == dateVisible ) { _dateVisible = VISIBLE ; fireUpdateEvent ( VISIBILITY_EVENT ) ; } else { dateVisible . set ( VISIBLE ) ; } |
public class SQLParser { /** * Build a pattern segment to recognize all the ALLOW or PARTITION modifier clauses
* of a CREATE PROCEDURE statement .
* @ return Pattern to be used by the caller inside a CREATE PROCEDURE pattern .
* Capture groups :
* ( 1 ) All ALLOW / PARTITION modifier clauses as one string */
s... | // Force the leading space to go inside the repeat block .
return SPF . capture ( SPF . repeat ( makeInnerProcedureModifierClausePattern ( false ) ) ) . withFlags ( SQLPatternFactory . ADD_LEADING_SPACE_TO_CHILD ) ; |
public class RpcHelper { /** * Uses idToken to retrieve the user account information from GITkit service .
* @ param idToken */
public JSONObject getAccountInfo ( String idToken ) throws GitkitClientException , GitkitServerException { } } | try { // Uses idToken to make the server call to GITKit
JSONObject params = new JSONObject ( ) . put ( "idToken" , idToken ) ; return invokeGoogle2LegOauthApi ( "getAccountInfo" , params ) ; } catch ( JSONException e ) { throw new GitkitServerException ( "OAuth API failed" ) ; } |
public class Dct { /** * setter for timexId - sets
* @ generated
* @ param v value to set into the feature */
public void setTimexId ( String v ) { } } | if ( Dct_Type . featOkTst && ( ( Dct_Type ) jcasType ) . casFeat_timexId == null ) jcasType . jcas . throwFeatMissing ( "timexId" , "de.unihd.dbs.uima.types.heideltime.Dct" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Dct_Type ) jcasType ) . casFeatCode_timexId , v ) ; |
public class ConfigTool { /** * Processes the decoration model , acquiring the skin and page
* configuration .
* The decoration model are the contents of the site . xml file .
* @ param model
* decoration data */
private final void processDecoration ( final DecorationModel model ) { } } | final Object customObj ; // Object for the < custom > node
final Xpp3Dom customNode ; // < custom > node
final Xpp3Dom skinNode ; // < skinConfig > node
customObj = model . getCustom ( ) ; if ( customObj instanceof Xpp3Dom ) { // This is the < custom > node in the site . xml file
customNode = ( Xpp3Dom ) customObj ; //... |
public class FileSystem { /** * Opens an FSDataOutputStream at the indicated Path with write - progress
* reporting . Same as create ( ) , except fails if parent directory doesn ' t
* already exist .
* @ param f the file name to open
* @ param overwrite if a file with this name already exists , then if true ,
... | return this . createNonRecursive ( f , FsPermission . getDefault ( ) , overwrite , bufferSize , replication , blockSize , progress ) ; |
public class JDBCConnection { /** * is called from within nativeSQL when the start of an JDBC escape sequence is encountered */
private int onStartEscapeSequence ( String sql , StringBuffer sb , int i ) throws SQLException { } } | sb . setCharAt ( i ++ , ' ' ) ; i = StringUtil . skipSpaces ( sql , i ) ; if ( sql . regionMatches ( true , i , "fn " , 0 , 3 ) || sql . regionMatches ( true , i , "oj " , 0 , 3 ) || sql . regionMatches ( true , i , "ts " , 0 , 3 ) ) { sb . setCharAt ( i ++ , ' ' ) ; sb . setCharAt ( i ++ , ' ' ) ; } else if ( sql . re... |
public class FilePolicyIndex { /** * ( non - Javadoc )
* @ seemelcoe . xacml . pdp . data . Index # getPolicies ( org . jboss . security . xacml . sunxacml .
* EvaluationCtx ) */
@ Override public Map < String , AbstractPolicy > getPolicies ( EvaluationCtx eval , PolicyFinder policyFinder ) throws PolicyIndexExcept... | // no indexing , return everything
// return a copy , otherwise the map could change during evaluation if policies are added , deleted etc
readLock . lock ( ) ; try { Map < String , AbstractPolicy > result = new ConcurrentHashMap < String , AbstractPolicy > ( ) ; for ( String id : policies . keySet ( ) ) { AbstractPoli... |
public class ArrayUtils { /** * Returns an { @ link Iterator } iterating over the elements in the array .
* @ param < T > Class type of the elements in the array .
* @ param array array to iterate .
* @ return an { @ link Iterator } to iterate over the elements in the array
* or an empty { @ link Iterator } if ... | return ( array == null ? Collections . emptyIterator ( ) : new Iterator < T > ( ) { private int index = 0 ; @ Override public boolean hasNext ( ) { return ( index < array . length ) ; } @ Override public T next ( ) { Assert . isTrue ( hasNext ( ) , new NoSuchElementException ( "No more elements" ) ) ; return array [ in... |
public class DiscordWebSocketAdapter { /** * Adds a server id to be queued for the " request guild members " packet .
* @ param server The server . */
public void queueRequestGuildMembers ( Server server ) { } } | logger . debug ( "Queued {} for request guild members packet" , server ) ; requestGuildMembersQueue . add ( server . getId ( ) ) ; |
public class ComponentBindingsValuesProvider { /** * ( non - Javadoc )
* @ see
* org . apache . sling . scripting . api . BindingsValuesProvider # addBindings ( javax
* . script . Bindings ) */
@ SuppressWarnings ( "unchecked" ) // Suppressing warnings since Commons Collections is gangster . . .
@ Override public... | try { SlingHttpServletRequest request = ( SlingHttpServletRequest ) bindings . get ( "request" ) ; String resourceType = request . getResource ( ) . getResourceType ( ) ; Collection < ComponentBindingsProvider > cis = cif . getComponentBindingsProviders ( resourceType ) ; if ( cis != null && cis . size ( ) > 0 ) { CQVa... |
public class JournalNode { /** * Get the list of journal addresses to connect .
* Consistent with the QuorumJournalManager . getHttpAddresses . */
static List < InetSocketAddress > getJournalHttpAddresses ( Configuration conf ) { } } | String [ ] hosts = JournalConfigHelper . getJournalHttpHosts ( conf ) ; List < InetSocketAddress > addrs = new ArrayList < InetSocketAddress > ( ) ; for ( String host : hosts ) { addrs . add ( NetUtils . createSocketAddr ( host ) ) ; } return addrs ; |
public class WSKeyStore { /** * Query the password of a key entry in this keystore .
* @ param alias
* @ return */
private SerializableProtectedString getKeyPassword ( String alias ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getKeyPassword " + alias ) ; SerializableProtectedString keyPass = certAliasInfo . get ( alias ) ; if ( keyPass != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getKeyPa... |
public class DeterministicKey { /** * Return the fingerprint of this key ' s parent as an int value , or zero if this key is the
* root node of the key hierarchy . Raise an exception if the arguments are inconsistent .
* This method exists to avoid code repetition in the constructors . */
private int ascertainParen... | if ( parentFingerprint != 0 ) { if ( parent != null ) checkArgument ( parent . getFingerprint ( ) == parentFingerprint , "parent fingerprint mismatch" , Integer . toHexString ( parent . getFingerprint ( ) ) , Integer . toHexString ( parentFingerprint ) ) ; return parentFingerprint ; } else return 0 ; |
public class EvaluatorRegistry { /** * Adds an evaluator definition class to the registry using the
* evaluator class name . The class will be loaded and the corresponting
* evaluator ID will be added to the registry . In case there exists
* an implementation for that ID already , the new implementation will
* ... | try { Class < EvaluatorDefinition > defClass = ( Class < EvaluatorDefinition > ) this . classloader . loadClass ( className ) ; EvaluatorDefinition def = defClass . newInstance ( ) ; addEvaluatorDefinition ( def ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( "Class not found for evaluator defin... |
public class TextureVideoView { /** * Clears the surface texture by attaching a GL context and clearing it .
* Code taken from < a href = " http : / / stackoverflow . com / a / 31582209 " > Hugo Gresse ' s answer on stackoverflow . com < / a > . */
private void clearSurface ( ) { } } | if ( mSurface == null || Build . VERSION . SDK_INT < Build . VERSION_CODES . JELLY_BEAN ) { return ; } EGL10 egl = ( EGL10 ) EGLContext . getEGL ( ) ; EGLDisplay display = egl . eglGetDisplay ( EGL10 . EGL_DEFAULT_DISPLAY ) ; egl . eglInitialize ( display , null ) ; int [ ] attribList = { EGL10 . EGL_RED_SIZE , 8 , EGL... |
public class ListActiveElementsCommand { /** * - - - - - private methods - - - - - */
private void collectActiveElements ( final List < GraphObject > resultList , final DOMNode root , final Set < String > parentDataKeys , final String parent , final int depth ) { } } | final String childDataKey = root . getDataKey ( ) ; final Set < String > dataKeys = new LinkedHashSet < > ( parentDataKeys ) ; String parentId = parent ; int dataCentricDepth = depth ; if ( ! StringUtils . isEmpty ( childDataKey ) ) { dataKeys . add ( childDataKey ) ; dataCentricDepth ++ ; } final ActiveElementState st... |
public class CmsAdminMenu { /** * Adds a menu item at the given position . < p >
* @ param group the group
* @ param position the position
* @ see CmsIdentifiableObjectContainer # addIdentifiableObject ( String , Object , float ) */
public void addGroup ( CmsAdminMenuGroup group , float position ) { } } | m_groupContainer . addIdentifiableObject ( group . getName ( ) , group , position ) ; |
public class GoogleMapShapeConverter { /** * Convert a list of List < LatLng > to a { @ link MultiLineString }
* @ param polylineList polyline list
* @ return multi line string */
public MultiLineString toMultiLineStringFromList ( List < List < LatLng > > polylineList ) { } } | return toMultiLineStringFromList ( polylineList , false , false ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.