signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Tuple3 { /** * Apply this tuple as arguments to a function . */
public final < R > R map ( Function3 < ? super T1 , ? super T2 , ? super T3 , ? extends R > function ) { } } | return function . apply ( v1 , v2 , v3 ) ; |
public class VoiceApi { /** * Perform a single - step transfer to the specified destination .
* @ param connId The connection ID of the call to transfer .
* @ param destination The number where the call should be transferred . */
public void singleStepTransfer ( String connId , String destination ) throws Workspace... | this . singleStepTransfer ( connId , destination , null , null , null , null ) ; |
public class ClasspathUtils { /** * Tries to find a resource with the given name in the classpath .
* @ param resourceName the name of the resource
* @ return the URL to the found resource or < b > null < / b > if the resource
* cannot be found */
public static URL locateOnClasspath ( String resourceName ) { } } | URL url = null ; // attempt to load from the context classpath
ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( loader != null ) { url = loader . getResource ( resourceName ) ; if ( url != null ) { log . debug ( "Located '{}' in the context classpath" , resourceName ) ; } } // attempt ... |
public class OSGiConfigUtils { /** * Get the current application name using the CDIService . During CDI startup , the CDIService knows which application it is currently working with so we can ask it !
* @ param bundleContext the context to use to find the CDIService
* @ return The application name */
public static ... | String appName = null ; if ( FrameworkState . isValid ( ) ) { // Get the CDIService
CDIService cdiService = getCDIService ( bundleContext ) ; if ( cdiService != null ) { appName = cdiService . getCurrentApplicationContextID ( ) ; } } return appName ; |
public class ParentViewHolder { /** * Triggers expansion of the parent . */
@ UiThread protected void expandView ( ) { } } | setExpanded ( true ) ; onExpansionToggled ( false ) ; if ( mParentViewHolderExpandCollapseListener != null ) { mParentViewHolderExpandCollapseListener . onParentExpanded ( getAdapterPosition ( ) ) ; } |
public class RegExAnnotator { /** * Invokes this annotator ' s analysis logic . This annotator uses the java regular expression
* package to find annotations using the regular expressions defined by its configuration
* parameters .
* @ param aCAS
* the CAS to process
* @ throws AnalysisEngineProcessException ... | // add " fake " separator to cas text , computes offsets
final int [ ] offsets ; StringBuilder sb = new StringBuilder ( ) ; try { int currPos = 0 ; offsets = new int [ ( ( int ) ( aCAS . getDocumentText ( ) . length ( ) * 1.7 ) ) + 100 ] ; Collection < Token > tokens = JCasUtil . select ( aCAS . getJCas ( ) , Token . c... |
public class FlowTypeCheck { /** * In this case , we are assuming the environments are exclusive from each other
* ( i . e . this is the opposite of threading them through ) . For example , consider
* this case :
* < pre >
* function f ( int | null x ) - > ( bool r ) :
* return ( x is null ) | | ( x > = 0)
... | Tuple < Expr > operands = expr . getOperands ( ) ; if ( sign ) { Environment [ ] refinements = new Environment [ operands . size ( ) ] ; for ( int i = 0 ; i != operands . size ( ) ; ++ i ) { refinements [ i ] = checkCondition ( operands . get ( i ) , sign , environment ) ; // The clever bit . Recalculate assuming oppos... |
public class ParaClient { /** * Converts Markdown to HTML .
* @ param markdownString Markdown
* @ return HTML */
public String markdownToHtml ( String markdownString ) { } } | MultivaluedMap < String , String > params = new MultivaluedHashMap < > ( ) ; params . putSingle ( "md" , markdownString ) ; return getEntity ( invokeGet ( "utils/md2html" , params ) , String . class ) ; |
public class Strman { /** * Ensures that the value ends with suffix . If it doesn ' t , it ' s appended . This operation is case sensitive .
* @ param value The input String
* @ param suffix The substr to be ensured to be right
* @ return The string which is guarenteed to start with substr */
public static String... | return ensureRight ( value , suffix , true ) ; |
public class ArraysUtil { /** * Concatenate all the arrays in the list into a vector .
* @ param arrays List of arrays .
* @ return Vector . */
public static int [ ] ConcatenateInt ( List < int [ ] > arrays ) { } } | int size = 0 ; for ( int i = 0 ; i < arrays . size ( ) ; i ++ ) { size += arrays . get ( i ) . length ; } int [ ] all = new int [ size ] ; int idx = 0 ; for ( int i = 0 ; i < arrays . size ( ) ; i ++ ) { int [ ] v = arrays . get ( i ) ; for ( int j = 0 ; j < v . length ; j ++ ) { all [ idx ++ ] = v [ i ] ; } } return a... |
public class Fibers { /** * Blocks on the input fibers and creates a new list from the results . The result list is the same order as the
* input list .
* @ param time to wait for all requests to complete
* @ param unit the time is in
* @ param fibers to combine */
@ SuppressWarnings ( "unchecked" ) public stat... | return FiberUtil . get ( time , unit , fibers ) ; |
public class XtextSemanticSequencer { /** * Contexts :
* Disjunction returns ParameterReference
* Disjunction . Disjunction _ 1_0 returns ParameterReference
* Conjunction returns ParameterReference
* Conjunction . Conjunction _ 1_0 returns ParameterReference
* Negation returns ParameterReference
* Atom retu... | if ( errorAcceptor != null ) { if ( transientValues . isValueTransient ( semanticObject , XtextPackage . Literals . PARAMETER_REFERENCE__PARAMETER ) == ValueTransient . YES ) errorAcceptor . accept ( diagnosticProvider . createFeatureValueMissing ( semanticObject , XtextPackage . Literals . PARAMETER_REFERENCE__PARAMET... |
public class MultimediaPickerFragment { /** * An extremely simple method for identifying multimedia . This
* could be improved , but it ' s good enough for this example .
* @ param file which could be an image or a video
* @ return true if the file can be previewed , false otherwise */
protected boolean isMultime... | // noinspection SimplifiableIfStatement
if ( isDir ( file ) ) { return false ; } String path = file . getPath ( ) . toLowerCase ( ) ; for ( String ext : MULTIMEDIA_EXTENSIONS ) { if ( path . endsWith ( ext ) ) { return true ; } } return false ; |
public class Relation { /** * Returns the number of & lt ; key , value & gt ; pairs in
* < code > this < / code > relation . Linear in the size of the
* relation . This may be also implemented in O ( 1 ) by
* incrementally updating a < code > size < / code > field , but that may
* complicate the code in the pre... | int size = 0 ; for ( K key : keys ( ) ) { size += getValues ( key ) . size ( ) ; } return size ; |
public class JcrRepository { /** * Determine the initial delay before the garbage collection process ( es ) should be run , based upon the supplied initial
* expression . Note that the initial expression specifies the hours and minutes in local time , whereas this method should
* return the delay in milliseconds af... | Matcher matcher = RepositoryConfiguration . INITIAL_TIME_PATTERN . matcher ( initialTimeExpression ) ; if ( matcher . matches ( ) ) { int hours = Integer . valueOf ( matcher . group ( 1 ) ) ; int mins = Integer . valueOf ( matcher . group ( 2 ) ) ; LocalDateTime dateTime = LocalDateTime . of ( LocalDate . now ( ZoneOff... |
public class JcrTools { /** * Execute the supplied JCR - SQL2 query and , if printing is enabled , print out the results .
* @ param session the session
* @ param jcrSql2 the JCR - SQL2 query
* @ param expectedNumberOfResults the expected number of rows in the results , or - 1 if this is not to be checked
* @ p... | Map < String , String > keyValuePairs = new HashMap < String , String > ( ) ; for ( Variable var : variables ) { keyValuePairs . put ( var . key , var . value ) ; } return printQuery ( session , jcrSql2 , Query . JCR_SQL2 , expectedNumberOfResults , keyValuePairs ) ; |
public class CodecSearchTree { /** * Search mtas tree .
* @ param treeItem the tree item
* @ param startPosition the start position
* @ param endPosition the end position
* @ param in the in
* @ param isSinglePoint the is single point
* @ param isStoreAdditionalId the is store additional id
* @ param obje... | if ( startPosition <= treeItem . max ) { // match current node
if ( ( endPosition >= treeItem . left ) && ( startPosition <= treeItem . right ) ) { for ( int i = 0 ; i < treeItem . objectRefs . length ; i ++ ) { list . add ( new MtasTreeHit < > ( treeItem . left , treeItem . right , treeItem . objectRefs [ i ] , treeIt... |
public class JavacProcessingEnvironment { /** * Convert import - style string for supported annotations into a
* regex matching that string . If the string is not a valid
* import - style string , return a regex that won ' t match anything . */
private static Pattern importStringToPattern ( boolean allowModules , S... | String module ; String pkg ; int slash = s . indexOf ( '/' ) ; if ( slash == ( - 1 ) ) { if ( s . equals ( "*" ) ) { return MatchingUtils . validImportStringToPattern ( s ) ; } module = allowModules ? ".*/" : "" ; pkg = s ; } else { module = Pattern . quote ( s . substring ( 0 , slash + 1 ) ) ; pkg = s . substring ( sl... |
public class AudioWife { /** * Sets the audio pause functionality on click event of the view passed in as a parameter . You
* can set { @ link android . widget . Button } or an { @ link android . widget . ImageView } as audio pause control . Audio pause
* functionality will be unavailable if this method is not call... | if ( pause == null ) { throw new NullPointerException ( "PauseView cannot be null" ) ; } if ( mHasDefaultUi ) { Log . w ( TAG , "Already using default UI. Setting pause view will have no effect" ) ; return this ; } mPauseButton = pause ; initOnPauseClick ( ) ; return this ; |
public class DynamoDBQueryModelDAO { @ Override public T findUniqueUsingQueryModel ( QueryModel queryModel ) throws NoSuchItemException , TooManyItemsException , JeppettoException { } } | DynamoDBIterable < T > dynamoDBIterable = ( DynamoDBIterable < T > ) findUsingQueryModel ( queryModel ) ; dynamoDBIterable . setLimit ( 1 ) ; Iterator < T > results = dynamoDBIterable . iterator ( ) ; if ( ! results . hasNext ( ) ) { throw new NoSuchItemException ( ) ; } T result = results . next ( ) ; if ( dynamoDBIte... |
public class InstallerModule { /** * Search for matching installer . Extension may match multiple installer , but only one will be actually
* used ( note that installers are ordered )
* @ param type extension type
* @ param holder extensions holder bean
* @ return matching installer or null if no matching insta... | for ( FeatureInstaller installer : holder . getInstallers ( ) ) { if ( installer . matches ( type ) ) { return installer ; } } return null ; |
public class Utils { /** * Convert character to hex representation by representing each byte ' s
* value as upper - cased hex string , as in URL - encoding . */
protected static String convertNonNCNameChar ( char c ) { } } | String str = "" + c ; byte [ ] bytes = str . getBytes ( ) ; StringBuilder sb = new StringBuilder ( 4 ) ; for ( int i = 0 ; i < bytes . length ; i ++ ) { sb . append ( String . format ( "%x" , bytes [ i ] ) ) ; } return sb . toString ( ) . toUpperCase ( ) ; |
public class AnyAdapter { /** * Unmarshals an Object ( expect to be a DOM Element ) into an Attribute .
* @ see javax . xml . bind . annotation . adapters . XmlAdapter # unmarshal ( java . lang . Object ) */
public org . openprovenance . prov . model . Attribute unmarshal ( Object value ) { } } | // System . out . println ( " AnyAdapter unmarshalling for " + value ) ;
if ( value instanceof org . w3c . dom . Element ) { org . w3c . dom . Element el = ( org . w3c . dom . Element ) value ; return domProcessor . unmarshallAttribute ( el , pFactory , vconv ) ; } /* if ( value instanceof JAXBElement ) {
JAXBElement... |
public class NewChunk { /** * Append all of ' nc ' onto the current NewChunk . Kill nc . */
public void add ( NewChunk nc ) { } } | assert _cidx >= 0 ; assert _sparseLen <= _len ; assert nc . _sparseLen <= nc . _len : "_sparseLen = " + nc . _sparseLen + ", _len = " + nc . _len ; if ( nc . _len == 0 ) return ; if ( _len == 0 ) { _ls = nc . _ls ; nc . _ls = null ; _xs = nc . _xs ; nc . _xs = null ; _id = nc . _id ; nc . _id = null ; _ds = nc . _ds ; ... |
public class TextUtils { /** * Checks whether a text ends with a specified suffix .
* @ param caseSensitive whether the comparison must be done in a case - sensitive or case - insensitive way .
* @ param text the text to be checked for suffixes .
* @ param suffix the suffix to be searched .
* @ return whether t... | if ( text == null ) { throw new IllegalArgumentException ( "Text cannot be null" ) ; } if ( suffix == null ) { throw new IllegalArgumentException ( "Suffix cannot be null" ) ; } if ( text instanceof String && suffix instanceof String ) { return ( caseSensitive ? ( ( String ) text ) . endsWith ( ( String ) suffix ) : en... |
public class RuleOptionsImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case SimpleAntlrPackage . RULE_OPTIONS__OPTIONS : return getOptions ( ) ; case SimpleAntlrPackage . RULE_OPTIONS__ELEMENT : return getElement ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class ArrayTrie { @ Override public V get ( ByteBuffer b , int offset , int len ) { } } | int t = 0 ; for ( int i = 0 ; i < len ; i ++ ) { byte c = b . get ( offset + i ) ; int index = __lookup [ c & 0x7f ] ; if ( index >= 0 ) { int idx = t * ROW_SIZE + index ; t = _rowIndex [ idx ] ; if ( t == 0 ) return null ; } else { char [ ] big = _bigIndex == null ? null : _bigIndex [ t ] ; if ( big == null ) return n... |
public class HistoricJobLogManager { /** * byte array delete / / / / / */
protected void deleteExceptionByteArrayByParameterMap ( String key , Object value ) { } } | EnsureUtil . ensureNotNull ( key , value ) ; Map < String , Object > parameterMap = new HashMap < String , Object > ( ) ; parameterMap . put ( key , value ) ; getDbEntityManager ( ) . delete ( ByteArrayEntity . class , "deleteExceptionByteArraysByIds" , parameterMap ) ; |
public class Matrix4x3d { /** * Set this matrix to a rotation transformation to make < code > - z < / code >
* point along < code > dir < / code > .
* This is equivalent to calling
* { @ link # setLookAt ( Vector3dc , Vector3dc , Vector3dc ) setLookAt ( ) }
* with < code > eye = ( 0 , 0 , 0 ) < / code > and < c... | return setLookAlong ( dir . x ( ) , dir . y ( ) , dir . z ( ) , up . x ( ) , up . y ( ) , up . z ( ) ) ; |
public class JSONArray { /** * Put or replace an int value . If the index is greater than the length of
* the JSONArray , then null elements will be added as necessary to pad
* it out .
* @ param index The subscript .
* @ param value An int value .
* @ return this
* @ throws JSONException If the index is ne... | put ( index , Integer . valueOf ( value ) ) ; return this ; |
public class BitfinexSymbols { /** * returns symbol for raw order book channel
* @ param currencyPair of raw order book channel
* @ return symbol */
public static BitfinexOrderBookSymbol rawOrderBook ( final BitfinexCurrencyPair currencyPair ) { } } | return new BitfinexOrderBookSymbol ( currencyPair , BitfinexOrderBookSymbol . Precision . R0 , null , null ) ; |
public class AntClassLoader { /** * Returns a stream to read the requested resource name from this loader .
* @ param name The name of the resource for which a stream is required .
* Must not be < code > null < / code > .
* @ return a stream to the required resource or < code > null < / code > if
* the resource... | // we need to search the components of the path to see if we can
// find the class we want .
InputStream stream = null ; Enumeration e = pathComponents . elements ( ) ; while ( e . hasMoreElements ( ) && stream == null ) { File pathComponent = ( File ) e . nextElement ( ) ; stream = getResourceStream ( pathComponent , ... |
public class MediaIntents { /** * Open the media player to play the given media
* @ param path The file path of the media to play .
* @ param type The mime type
* @ return the intent */
public static Intent newPlayMediaFileIntent ( String path , String type ) { } } | return newPlayMediaIntent ( Uri . fromFile ( new File ( path ) ) , type ) ; |
public class PinEntryEditText { /** * Request focus on this PinEntryEditText */
public void focus ( ) { } } | requestFocus ( ) ; // Show keyboard
InputMethodManager inputMethodManager = ( InputMethodManager ) getContext ( ) . getSystemService ( Context . INPUT_METHOD_SERVICE ) ; inputMethodManager . showSoftInput ( this , 0 ) ; |
public class CmsListItem { /** * Adds the main widget to the list item . < p >
* In most cases , the widget will be a list item widget . If this is the case , then further calls to { @ link CmsListItem # getListItemWidget ( ) } will
* return the widget which was passed as a parameter to this method . Otherwise , th... | assert m_mainWidget == null ; assert m_listItemWidget == null ; if ( widget instanceof CmsListItemWidget ) { m_listItemWidget = ( CmsListItemWidget ) widget ; } m_mainWidget = widget ; |
public class KeyVaultClientBaseImpl { /** * Creates or updates a new storage account . This operation requires the storage / set permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param storageAccountName The name of the storage account .
* @ param res... | return setStorageAccountWithServiceResponseAsync ( vaultBaseUrl , storageAccountName , resourceId , activeKeyName , autoRegenerateKey , regenerationPeriod , storageAccountAttributes , tags ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class MetadataProviderImpl { /** * Return the { @ link TypeMetadata } for a given type .
* The metadata will be created if it does not exist yet .
* @ param type
* The type .
* @ return The { @ link TypeMetadata } . */
private TypeMetadata getOrCreateTypeMetadata ( Class < ? > type ) { } } | AnnotatedType annotatedType = new AnnotatedType ( type ) ; TypeMetadata typeMetadata = metadataByType . get ( annotatedType . getAnnotatedElement ( ) ) ; if ( typeMetadata == null ) { typeMetadata = createTypeMetadata ( annotatedType ) ; LOGGER . debug ( "Registering class {}" , annotatedType . getName ( ) ) ; metadata... |
public class BitmapIterationBenchmark { /** * General benchmark of bitmap iteration , this is a part of { @ link org . apache . druid . segment . IndexMerger # merge } and
* query processing on both realtime and historical nodes . */
@ Benchmark public int iter ( IterState state ) { } } | ImmutableBitmap bitmap = state . bitmap ; return iter ( bitmap ) ; |
public class MetamodelSource { /** * Save this instance representation as a Java source file . The Java source
* file is saved as the name adding ' _ ' prefix to the entity class name and
* into the same package as the entity class . If the source file has been
* already saved , this method deletes the file and t... | Filer filer = environment . getFiler ( ) ; FileObject resource = filer . getResource ( StandardLocation . SOURCE_OUTPUT , packageName , metamodelName + ".java" ) ; File file = new File ( resource . toUri ( ) . toString ( ) ) ; if ( file . exists ( ) ) { file . delete ( ) ; } StringBuilder source = new StringBuilder ( )... |
public class BitVector { /** * specialized implementation for the common case of setting an individual bit */
private void performSetAdj ( int position , boolean value ) { } } | checkMutable ( ) ; final int i = position >> ADDRESS_BITS ; final long m = 1L << ( position & ADDRESS_MASK ) ; if ( value ) { bits [ i ] |= m ; } else { bits [ i ] &= ~ m ; } |
public class BeanQuery { /** * Create a BeanQuery instance without the function of convert result into Map
* function . If you just want to filter bean collection , sort bean collection
* and want to get the execute result as a list of beans , you should use this
* method to create a BeanQuery instance .
* @ de... | return new BeanQuery < T > ( new BeanSelector < T > ( beanClass ) ) ; |
public class JSONRPCExporter { /** * Unregister all servlets registered by this exporter . */
private void unregisterAllServlets ( ) { } } | for ( String endpoint : registeredServlets ) { registeredServlets . remove ( endpoint ) ; web . unregister ( endpoint ) ; LOG . info ( "endpoint {} unregistered" , endpoint ) ; } |
public class MyArrays { /** * 计算熵
* @ param c 概率数组
* @ return */
public static float entropy ( float [ ] c ) { } } | float e = 0.0f ; for ( int i = 0 ; i < c . length ; i ++ ) { if ( c [ i ] != 0.0 && c [ i ] != 1 ) { e -= c [ i ] * Math . log ( c [ i ] ) ; } } return e ; |
public class SQLUtils { /** * 获得主键in ( ? ) 的where子句 , 包含where关键字 。 会自动处理软删除条件
* @ param clazz
* @ return */
public static String getKeyInWhereSQL ( Class < ? > clazz ) { } } | Field keyField = DOInfoReader . getOneKeyColumn ( clazz ) ; return autoSetSoftDeleted ( "WHERE " + getColumnName ( keyField . getAnnotation ( Column . class ) ) + " in (?)" , clazz ) ; |
public class MessageCodeGenerator { /** * キーの候補を生成する 。
* < p > コンテキストのキーの形式として 、 次の優先順位に一致したものを返す 。
* @ param code 元となるメッセージのコード
* @ param objectName オブジェクト名 ( クラスのフルパス )
* @ param field フィールド名 ( 指定しない場合はnullを設定する )
* @ param fieldType フィールドのクラスタイプ ( 指定しない場合はnullを設定する )
* @ return */
public String [... | final String baseCode = getPrefix ( ) . isEmpty ( ) ? code : getPrefix ( ) + code ; final List < String > codeList = new ArrayList < > ( ) ; final List < String > fieldList = new ArrayList < > ( ) ; buildFieldList ( field , fieldList ) ; addCodes ( codeList , baseCode , objectName , fieldList ) ; if ( Utils . isNotEmpt... |
public class HtmlParser { /** * Test if this tag , the prospective parent , can accept the proposed child .
* @ param child potential child tag .
* @ return true if this can contain child . */
boolean canContain ( Tag parent , Tag child ) { } } | Validate . notNull ( child ) ; if ( child . isBlock ( ) && ! parent . canContainBlock ( ) ) return false ; if ( ! child . isBlock ( ) && parent . isData ( ) ) return false ; if ( closingOptional . contains ( parent . getName ( ) ) && parent . getName ( ) . equals ( child . getName ( ) ) ) return false ; if ( parent . i... |
public class IstioAssistant { /** * Deploys application reading resources from classpath , matching the given regular expression .
* For example istio / . * \ \ . json will deploy all resources ending with json placed at istio classpath directory .
* @ param pattern to match the resources . */
public List < IstioRe... | final List < IstioResource > istioResources = new ArrayList < > ( ) ; final FastClasspathScanner fastClasspathScanner = new FastClasspathScanner ( ) ; fastClasspathScanner . matchFilenamePattern ( pattern , ( FileMatchProcessor ) ( relativePath , inputStream , lengthBytes ) -> { istioResources . addAll ( deployIstioRes... |
public class BackgroundApplier { /** * { @ inheritDoc } */
public Map < String , String > parse ( Map < String , String > style ) { } } | Map < String , String > mapRtn = new HashMap < String , String > ( ) ; String bg = style . get ( BACKGROUND ) ; String bgColor = null ; if ( StringUtils . isNotBlank ( bg ) ) { for ( String bgAttr : bg . split ( "(?<=\\)|\\w|%)\\s+(?=\\w)" ) ) { if ( ( bgColor = CssUtils . processColor ( bgAttr ) ) != null ) { mapRtn .... |
public class CmsSiteManagerImpl { /** * Returns < code > true < / code > if the given root path matches any of the stored additional sites . < p >
* @ param rootPath the root path to check
* @ return < code > true < / code > if the given root path matches any of the stored additional sites */
private String lookupA... | for ( int i = 0 , size = m_additionalSiteRoots . size ( ) ; i < size ; i ++ ) { String siteRoot = m_additionalSiteRoots . get ( i ) ; if ( rootPath . startsWith ( siteRoot + "/" ) ) { return siteRoot ; } } return null ; |
public class BusNetworkLayer { /** * Invoked when a bus line was removed from the attached network .
* < p > This function exists to allow be override to provide a specific behaviour
* when a bus line has been removed .
* @ param line is the removed line .
* @ param index is the index of the bus line .
* @ re... | if ( this . autoUpdate . get ( ) ) { try { removeMapLayerAt ( index ) ; return true ; } catch ( Throwable exception ) { } } return false ; |
public class WeakArrayList { /** * Fire the reference release event .
* @ param released is the count of released objects . */
protected void fireReferenceRelease ( int released ) { } } | final List < ReferenceListener > list = this . listeners ; if ( list != null && ! list . isEmpty ( ) ) { for ( final ReferenceListener listener : list ) { listener . referenceReleased ( released ) ; } } |
public class Script { /** * Verifies that this script ( interpreted as a scriptSig ) correctly spends the given scriptPubKey , enabling all
* validation rules .
* @ param txContainingThis The transaction in which this input scriptSig resides .
* Accessing txContainingThis from another thread while this method run... | correctlySpends ( txContainingThis , scriptSigIndex , scriptPubKey , ALL_VERIFY_FLAGS ) ; |
public class GrassLegacyUtilities { /** * Fill polygon areas mapping on a raster
* @ param active the active region
* @ param polygon the jts polygon geometry
* @ param raster the empty raster data to be filled
* @ param rasterToMap the map from which the values to fill raster are taken ( if null , the value
... | GeometryFactory gFactory = new GeometryFactory ( ) ; int rows = active . getRows ( ) ; int cols = active . getCols ( ) ; double delta = active . getWEResolution ( ) / 4.0 ; monitor . beginTask ( "rasterizing..." , rows ) ; // $ NON - NLS - 1 $
for ( int i = 0 ; i < rows ; i ++ ) { monitor . worked ( 1 ) ; // do scan li... |
public class JsonUtils { /** * Json字符串转Java对象 */
public static Object json2Object ( String jsonString , Class < ? > c ) { } } | if ( jsonString == null || "" . equals ( jsonString ) ) { return "" ; } else { try { return objectMapper . readValue ( jsonString , c ) ; } catch ( Exception e ) { log . warn ( "json error:" + e . getMessage ( ) ) ; } } return "" ; |
public class ExtendedSwidProcessor { /** * Defines product supported languages ( tag : supported _ languages ) .
* @ param supportedLanguagesList
* product supported languages
* @ return a reference to this object . */
public ExtendedSwidProcessor setSupportedLanguages ( final String ... supportedLanguagesList ) ... | SupportedLanguagesComplexType slct = new SupportedLanguagesComplexType ( ) ; if ( supportedLanguagesList . length > 0 ) { for ( String supportedLanguage : supportedLanguagesList ) { slct . getLanguage ( ) . add ( new Token ( supportedLanguage , idGenerator . nextId ( ) ) ) ; } } swidTag . setSupportedLanguages ( slct )... |
public class CHFWBundle { /** * DS method for setting the event reference .
* @ param service */
@ Reference ( service = EventEngine . class , cardinality = ReferenceCardinality . MANDATORY ) protected void setEventService ( EventEngine service ) { } } | this . eventService = service ; |
public class NNStorage { /** * See if any of removed storages is " writable " again , and can be returned
* into service . */
void attemptRestoreRemovedStorage ( ) { } } | // if directory is " alive " - copy the images there . . .
if ( removedStorageDirs . size ( ) == 0 ) return ; // nothing to restore
/* We don ' t want more than one thread trying to restore at a time */
synchronized ( this . restorationLock ) { LOG . info ( "attemptRestoreRemovedStorage: check removed(failed) " + "stor... |
public class ArrayHeap { /** * Finds the object with the minimum key , removes it from the heap ,
* and returns it .
* @ return the object with minimum key */
public E extractMin ( ) { } } | if ( isEmpty ( ) ) { throw new NoSuchElementException ( ) ; } HeapEntry < E > minEntry = indexToEntry . get ( 0 ) ; int lastIndex = size ( ) - 1 ; if ( lastIndex > 0 ) { HeapEntry < E > lastEntry = indexToEntry . get ( lastIndex ) ; swap ( lastEntry , minEntry ) ; removeLast ( minEntry ) ; heapifyDown ( lastEntry ) ; }... |
public class WindowedEventCounter { /** * Record a new event . */
public void mark ( ) { } } | final long currentTimeMillis = clock . currentTimeMillis ( ) ; synchronized ( queue ) { if ( queue . size ( ) == capacity ) { /* * we ' re all filled up already , let ' s dequeue the oldest
* timestamp to make room for this new one . */
queue . removeFirst ( ) ; } queue . addLast ( currentTimeMillis ) ; } |
public class BaseEntity { /** * Returns the property value as a blob .
* @ throws DatastoreException if no such property
* @ throws ClassCastException if value is not a blob */
@ SuppressWarnings ( "unchecked" ) public Blob getBlob ( String name ) { } } | return ( ( Value < Blob > ) getValue ( name ) ) . get ( ) ; |
public class RawPacket { /** * Read a integer from this packet at specified offset
* @ param off start offset of the integer to be read
* @ return the integer to be read */
public int readInt ( int off ) { } } | this . buffer . rewind ( ) ; return ( ( buffer . get ( off ++ ) & 0xFF ) << 24 ) | ( ( buffer . get ( off ++ ) & 0xFF ) << 16 ) | ( ( buffer . get ( off ++ ) & 0xFF ) << 8 ) | ( buffer . get ( off ++ ) & 0xFF ) ; |
public class SimilarityCosineAlgorithm { /** * @ param secondVector Vector for search
* @ param entry Entry that must be search
* @ param < T > First vector class type
* @ param < K > axis class type
* @ return */
private < T extends FacetRank , K extends FacetRank > Optional < K > getVectorAxis ( @ NotNull Col... | return secondVector . stream ( ) . filter ( facet -> { return Facet . same ( facet . getKey ( ) , entry . getKey ( ) ) ; } ) . findFirst ( ) ; |
public class PlanAssembler { /** * Generate best cost plans for a list of derived tables , which
* we call FROM sub - queries and common table queries .
* @ param subqueryNodes - list of FROM sub - queries .
* @ return ParsedResultAccumulator */
private ParsedResultAccumulator getBestCostPlanForEphemeralScans ( L... | int nextPlanId = m_planSelector . m_planId ; boolean orderIsDeterministic = true ; boolean hasSignificantOffsetOrLimit = false ; String contentNonDeterminismMessage = null ; for ( StmtEphemeralTableScan scan : scans ) { if ( scan instanceof StmtSubqueryScan ) { nextPlanId = planForParsedSubquery ( ( StmtSubqueryScan ) ... |
public class PatternToken { /** * Checks whether an exception matches .
* @ param token AnalyzedToken to check matching against
* @ return True if any of the exceptions matches ( logical disjunction ) . */
public boolean isExceptionMatched ( AnalyzedToken token ) { } } | if ( exceptionSet ) { for ( PatternToken testException : exceptionList ) { if ( ! testException . exceptionValidNext ) { if ( testException . isMatched ( token ) ) { return true ; } } } } return false ; |
public class VariationalAutoencoder { /** * This method ADDS additional TrainingListener to existing listeners
* @ param listeners */
@ Override public void addListeners ( TrainingListener ... listeners ) { } } | if ( this . trainingListeners == null ) { setListeners ( listeners ) ; return ; } for ( TrainingListener listener : listeners ) trainingListeners . add ( listener ) ; |
public class ButtonCellRenderer { /** * When the mouse is pressed the editor is invoked . If you then then drag
* the mouse to another cell before releasing it , the editor is still
* active . Make sure editing is stopped when the mouse is released . */
@ Override public void mousePressed ( MouseEvent e ) { } } | if ( table . isEditing ( ) && table . getCellEditor ( ) == this ) { isButtonColumnEditor = true ; } |
public class ManagedChannelImpl { /** * Must be run from syncContext */
private void enterIdleMode ( ) { } } | // nameResolver and loadBalancer are guaranteed to be non - null . If any of them were null ,
// either the idleModeTimer ran twice without exiting the idle mode , or the task in shutdown ( )
// did not cancel idleModeTimer , or enterIdle ( ) ran while shutdown or in idle , all of
// which are bugs .
shutdownNameResolv... |
public class SystemObserver { /** * Return the current running mode type . May be one of
* { UI _ MODE _ TYPE _ NORMAL Configuration . UI _ MODE _ TYPE _ NORMAL } ,
* { UI _ MODE _ TYPE _ DESK Configuration . UI _ MODE _ TYPE _ DESK } ,
* { UI _ MODE _ TYPE _ CAR Configuration . UI _ MODE _ TYPE _ CAR } ,
* { U... | String mode = "UI_MODE_TYPE_UNDEFINED" ; UiModeManager modeManager = null ; try { if ( context != null ) { modeManager = ( UiModeManager ) context . getSystemService ( UI_MODE_SERVICE ) ; } if ( modeManager != null ) { switch ( modeManager . getCurrentModeType ( ) ) { case 1 : mode = "UI_MODE_TYPE_NORMAL" ; break ; cas... |
public class LdapTemplate { /** * { @ inheritDoc } */
@ Override public void search ( Name base , String filter , int searchScope , boolean returningObjFlag , NameClassPairCallbackHandler handler ) { } } | search ( base , filter , getDefaultSearchControls ( searchScope , returningObjFlag , ALL_ATTRIBUTES ) , handler ) ; |
public class Story { /** * Useful when debugging a ( very short ) story , to visualise the state of the
* story . Add this call as a watch and open the extended text . A left - arrow mark
* will denote the current point of the story . It ' s only recommended that this
* is used on very short debug stories , since... | StringBuilder sb = new StringBuilder ( ) ; getMainContentContainer ( ) . buildStringOfHierarchy ( sb , 0 , state . getCurrentPointer ( ) . resolve ( ) ) ; return sb . toString ( ) ; |
public class Provider { /** * Add a service . If a service of the same type with the same algorithm
* name exists and it was added using { @ link # putService putService ( ) } ,
* it is replaced by the new service .
* This method also places information about this service
* in the provider ' s Hashtable values ... | check ( "putProviderProperty." + name ) ; // if ( debug ! = null ) {
// debug . println ( name + " . putService ( ) : " + s ) ;
if ( s == null ) { throw new NullPointerException ( ) ; } if ( s . getProvider ( ) != this ) { throw new IllegalArgumentException ( "service.getProvider() must match this Provider object" ) ; ... |
public class DelegatingScript { /** * Sets the delegation target . */
public void setDelegate ( Object delegate ) { } } | this . delegate = delegate ; this . metaClass = InvokerHelper . getMetaClass ( delegate . getClass ( ) ) ; |
public class IonStreamUtils { /** * writes an IonList with a series of IonBool values . This
* starts a List , writes the values ( without any annoations )
* and closes the list . For text and tree writers this is
* just a convienience , but for the binary writer it can be
* optimized internally .
* @ param v... | if ( writer instanceof _Private_ListWriter ) { ( ( _Private_ListWriter ) writer ) . writeBoolList ( values ) ; return ; } writer . stepIn ( IonType . LIST ) ; for ( int ii = 0 ; ii < values . length ; ii ++ ) { writer . writeBool ( values [ ii ] ) ; } writer . stepOut ( ) ; |
public class BeanData { /** * Gets the effective scope to use in the meta .
* @ return the scope */
public String getEffectiveMetaScope ( ) { } } | String scope = beanMetaScope ; if ( "smart" . equals ( scope ) ) { scope = typeScope ; } return "package" . equals ( scope ) ? "" : scope + " " ; |
public class DefaultDataGridURLBuilder { /** * Get a URL query parameter map that will change the data grid ' s page value to display the
* < i > previous < / i > page in a data set relative to the current page . This map also contains all of
* the other existing URL parameters . The { @ link Map } contains key / v... | Map params = _codec . getExistingParams ( ) ; Map newParams = new HashMap ( ) ; PagerModel pagerModel = getDataGridState ( ) . getPagerModel ( ) ; assert pagerModel != null ; addSortParams ( newParams ) ; addFilterParams ( newParams ) ; newParams . putAll ( _codec . buildPageParamMap ( new Integer ( pagerModel . getRow... |
public class ExtensionUtils { /** * " add " an object in a readonly { @ link Set } . This method return a new Set which contains the passed set and object
* to add .
* @ param readonly the { @ link Set } to add an object to
* @ param obj the object to add
* @ return the new { @ link Set } */
public static < T >... | Set < T > writable = readonly != null ? new HashSet < > ( readonly ) : new HashSet < > ( ) ; writable . add ( obj ) ; return writable ; |
public class FlowConfigClient { /** * Create a flow configuration
* @ param flowConfig flow configuration attributes
* @ throws RemoteInvocationException */
public void createFlowConfig ( FlowConfig flowConfig ) throws RemoteInvocationException { } } | LOG . debug ( "createFlowConfig with groupName " + flowConfig . getId ( ) . getFlowGroup ( ) + " flowName " + flowConfig . getId ( ) . getFlowName ( ) ) ; CreateIdRequest < ComplexResourceKey < FlowId , EmptyRecord > , FlowConfig > request = _flowconfigsRequestBuilders . create ( ) . input ( flowConfig ) . build ( ) ; ... |
public class ResourceUtils { /** * Returns a resource on the classpath as a Properties object
* @ param loader
* The classloader used to load the resource
* @ param resource
* The resource to find
* @ throws IOException
* If the resource cannot be found or read
* @ return The resource */
public static Pro... | Properties props = new Properties ( ) ; InputStream in = null ; String propfile = resource ; in = getResourceAsStream ( loader , propfile ) ; props . load ( in ) ; in . close ( ) ; return props ; |
public class EventConsumer { void readAttributeAndPush ( EventChannelStruct eventChannelStruct , EventCallBackStruct callbackStruct ) { } } | // Check if known event name
boolean found = false ; for ( int i = 0 ; ! found && i < eventNames . length ; i ++ ) found = callbackStruct . event_name . equals ( eventNames [ i ] ) ; if ( ! found ) return ; // Else do the synchronous call
DeviceAttribute deviceAttribute = null ; DevicePipe devicePipe = null ; Attribute... |
public class Tree { /** * Associates the specified Map ( ~ = JSON object ) container with the
* specified path . If the structure previously contained a mapping for the
* path , the old value is replaced . Sample code : < br >
* < br >
* Tree response = . . . < br >
* Tree headers = response . getMeta ( ) . p... | return putObjectInternal ( path , new LinkedHashMap < String , Object > ( ) , putIfAbsent ) ; |
public class Substance { /** * syntactic sugar */
public SubstanceInstanceComponent addInstance ( ) { } } | SubstanceInstanceComponent t = new SubstanceInstanceComponent ( ) ; if ( this . instance == null ) this . instance = new ArrayList < SubstanceInstanceComponent > ( ) ; this . instance . add ( t ) ; return t ; |
public class DiskClient { /** * Resizes the specified persistent disk . You can only increase the size of the disk .
* < p > Sample code :
* < pre > < code >
* try ( DiskClient diskClient = DiskClient . create ( ) ) {
* ProjectZoneDiskName disk = ProjectZoneDiskName . of ( " [ PROJECT ] " , " [ ZONE ] " , " [ D... | ResizeDiskHttpRequest request = ResizeDiskHttpRequest . newBuilder ( ) . setDisk ( disk ) . setDisksResizeRequestResource ( disksResizeRequestResource ) . build ( ) ; return resizeDisk ( request ) ; |
public class FailoverGroupsInner { /** * Fails over from the current primary server to this server .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server conta... | return ServiceFuture . fromResponse ( beginFailoverWithServiceResponseAsync ( resourceGroupName , serverName , failoverGroupName ) , serviceCallback ) ; |
public class IfcRepresentationItemImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < IfcStyledItem > getStyledByItem ( ) { } } | return ( EList < IfcStyledItem > ) eGet ( Ifc2x3tc1Package . Literals . IFC_REPRESENTATION_ITEM__STYLED_BY_ITEM , true ) ; |
public class RegisteredHttpServiceImpl { /** * { @ inheritDoc } */
@ Override public void unregister ( String alias ) { } } | synchronized ( servletLock ) { Servlet servlet = container . getHandlerRegistry ( ) . removeServletByAlias ( alias ) ; if ( servlet != null ) this . localServlets . remove ( servlet ) ; } |
public class NioTCPSession { /** * Blocking write using temp selector
* @ param channel
* @ param message
* @ param writeBuffer
* @ return
* @ throws IOException
* @ throws ClosedChannelException */
protected final Object blockingWrite ( SelectableChannel channel , WriteMessage message , IoBuffer writeBuffe... | SelectionKey tmpKey = null ; Selector writeSelector = null ; int attempts = 0 ; int bytesProduced = 0 ; try { while ( writeBuffer . hasRemaining ( ) ) { long len = doRealWrite ( channel , writeBuffer ) ; if ( len > 0 ) { attempts = 0 ; bytesProduced += len ; statistics . statisticsWrite ( len ) ; } else { attempts ++ ;... |
public class CreateDateExtensions { /** * Creates a new Date object from the given values .
* @ param year
* The year .
* @ param month
* The month .
* @ param day
* The day .
* @ param hour
* The hour .
* @ param min
* The minute .
* @ param sec
* The second .
* @ return Returns the created D... | return newDate ( year , month , day , hour , min , sec , 0 ) ; |
public class CssFormatter { /** * Write a comment . The compress formatter do nothing .
* @ param msg the comment including the comment markers
* @ return a reference to this object */
CssFormatter comment ( String msg ) { } } | getOutput ( ) . append ( insets ) . append ( msg ) . append ( '\n' ) ; return this ; |
public class AsynchronousRequest { /** * For more info on exchange coins API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / commerce / exchange / coins " > here < / a > < br / >
* Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( C... | isValueValid ( quantity ) ; gw2API . getExchangeInfo ( currency . name ( ) , Long . toString ( quantity ) ) . enqueue ( callback ) ; |
public class OBaseParser { /** * Parses the next word . If no word is found or the parsed word is not present in the word array received as parameter then a
* SyntaxError exception with the custom message received as parameter is thrown . It returns the word parsed if any .
* @ param iUpperCase
* True if must ret... | if ( iSeparators == null ) iSeparators = " =><(),\r\n" ; parserNextWord ( iUpperCase , iSeparators ) ; if ( parserLastWord . length ( ) == 0 ) throwSyntaxErrorException ( iCustomMessage ) ; return parserLastWord . toString ( ) ; |
public class TimestampInterval { /** * / * [ deutsch ]
* < p > Erzeugt ein unbegrenztes halb - offenes Intervall ab dem angegebenen
* Startzeitpunkt . < / p >
* @ param start timestamp of lower boundary ( inclusive )
* @ return new timestamp interval
* @ since 2.0 */
public static TimestampInterval since ( Pl... | Boundary < PlainTimestamp > future = Boundary . infiniteFuture ( ) ; return new TimestampInterval ( Boundary . of ( CLOSED , start ) , future ) ; |
public class RecursiveObjectWriter { /** * Copies content of one object to another object by recursively reading all
* properties from source object and then recursively writing them to
* destination object .
* @ param dest a destination object to write properties to .
* @ param src a source object to read prop... | if ( dest == null || src == null ) return ; Map < String , Object > values = RecursiveObjectReader . getProperties ( src ) ; setProperties ( dest , values ) ; |
public class LdapCompensatingTransactionOperationFactory { /** * @ see org . springframework . transaction . compensating .
* CompensatingTransactionOperationFactory
* # createRecordingOperation ( java . lang . Object , java . lang . String ) */
public CompensatingTransactionOperationRecorder createRecordingOperati... | if ( ObjectUtils . nullSafeEquals ( operation , LdapTransactionUtils . BIND_METHOD_NAME ) ) { log . debug ( "Bind operation recorded" ) ; return new BindOperationRecorder ( createLdapOperationsInstance ( ( DirContext ) resource ) ) ; } else if ( ObjectUtils . nullSafeEquals ( operation , LdapTransactionUtils . REBIND_M... |
public class RestEventManager { /** * { @ inheritDoc } */
@ Override public void addAttack ( Attack attack ) { } } | // make request
target . path ( "api" ) . path ( "v1.0" ) . path ( "attacks" ) . request ( ) . header ( clientApplicationIdName , clientApplicationIdValue ) . post ( Entity . entity ( attack , MediaType . APPLICATION_JSON ) , Attack . class ) ; |
public class Utils { /** * Converts the given query JSON into a Query object
* @ param queryInputStream query JSON stream
* @ return Query object containing the query
* @ throws JsonParseException Thrown if JSON parsing failed
* @ throws JsonMappingException Thrown if there was a problem mapping the JSON
* @ ... | return JSON_MAPPER . readValue ( queryInputStream , Query . class ) ; |
public class AbstractArmeriaCentralDogmaBuilder { /** * Sets the interval between health check requests in milliseconds . The default value is
* { @ value # DEFAULT _ HEALTH _ CHECK _ INTERVAL _ MILLIS } milliseconds .
* @ param healthCheckIntervalMillis the interval between health check requests in milliseconds . ... | checkArgument ( healthCheckIntervalMillis >= 0 , "healthCheckIntervalMillis: %s (expected: >= 0)" , healthCheckIntervalMillis ) ; healthCheckInterval = Duration . ofMillis ( healthCheckIntervalMillis ) ; return self ( ) ; |
public class ExamplePnP { /** * Uses robust techniques to remove outliers */
public Se3_F64 estimateOutliers ( List < Point2D3D > observations ) { } } | // We can no longer trust that each point is a real observation . Let ' s use RANSAC to separate the points
// You will need to tune the number of iterations and inlier threshold ! ! !
ModelMatcherMultiview < Se3_F64 , Point2D3D > ransac = FactoryMultiViewRobust . pnpRansac ( new ConfigPnP ( ) , new ConfigRansac ( 300 ... |
public class LPAAddParameter { /** * Performs parameter child element creation in the passed in Element .
* @ param node the parent node in which to create the parameter .
* @ param name the name of the parameter to be created .
* @ param value the value of the parameter to be created . */
static void addParamete... | if ( node != null ) { Document doc = node . getOwnerDocument ( ) ; Element parm = doc . createElement ( Constants . ELM_PARAMETER ) ; parm . setAttribute ( Constants . ATT_NAME , name ) ; parm . setAttribute ( Constants . ATT_VALUE , value ) ; /* * Set the override attribute to ' yes ' . This isn ' t persisted since
... |
public class KeyboardManager { /** * documentation inherited from interface KeyEventDispatcher */
public boolean dispatchKeyEvent ( KeyEvent e ) { } } | // bail if we ' re not enabled , we haven ' t the focus , or we ' re not
// showing on - screen
if ( ! _enabled || ! _focus || ! _target . isShowing ( ) ) { // log . info ( " dispatchKeyEvent [ enabled = " + _ enabled +
// " , focus = " + _ focus +
// " , showing = " + ( ( _ target = = null ) ? " N / A " :
// " " + _ t... |
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 269:1 : compilationUnit : ( annotations ) ? ( packageDeclaration ) ? ( importDeclaration ) * ( typeDeclaration ) * ; */
public final void compilationUnit ( ) throws RecognitionException { } } | int compilationUnit_StartIndex = input . index ( ) ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 1 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 270:5 : ( ( annotations ) ? ( packageDeclaration ) ? ( importDeclaration ) * ( typeDecla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.